Changed: Renamed a few classes

Changed: Moved most sensible objects into the OpenArena namespace
~g2k
This commit is contained in:
2005-06-29 11:33:11 -04:00
parent f6a191d21d
commit c16a0dae6d
17 changed files with 1818 additions and 1781 deletions

View File

@@ -9,82 +9,82 @@
#include "mygl.h"
#include "screen.h"
class CameraClass
namespace OpenArena
{
public:
//Constructors
CameraClass(); //Default Constructor
//Purpose:
//
class Camera
{
public:
//Constructors
Camera(); //Default Constructor
//Purpose:
//
//Camera(const Camera&); //Copy Constructor
//Purpose:
//
//Observer Accessors
Vec3f Position();
//Purpose:
//
//CameraClass(const CameraClass&); //Copy Constructor
//Purpose:
//
Vec3f View();
//Purpose:
//
//Observer Accessors
Vec3f Position();
//Purpose:
//
Vec3f UpVector();
//Purpose:
//
Vec3f View();
//Purpose:
//
Vec3f Strafe();
//Purpose:
//
Vec3f UpVector();
//Purpose:
//
//Mutators
void PositionCamera(double xpos, double ypos, double zpos,
double xview, double yview, double zview,
double xup, double yup, double zup);
//Purpose:
//
void PositionCamera(Vec3f pos, Vec3f view, Vec3f up);
//Purpose:
//
Vec3f Strafe();
//Purpose:
//
void RotateView(double angle, double X, double Y, double Z);
//Purpose:
//
//Mutators
void PositionCamera(double xpos, double ypos, double zpos,
double xview, double yview, double zview,
double xup, double yup, double zup);
//Purpose:
//
void PositionCamera(Vec3f pos, Vec3f view, Vec3f up);
//Purpose:
//
void RotateView(double angle, double X, double Y, double Z);
//Purpose:
//
void SetViewByMouse(SCREEN g_Screen);
//Purpose:
//
void RotateAroundPoint(Vec3f vCenter, double X, double Y, double Z);
//Purpose:
//
void StrafeCamera(double speed);
//Purpose:
//
void MoveCamera(double speed);
//Purpose:
//
void Update();
//Purpose:
//
void Look();
//Purpose:
//
void SetViewByMouse(Screen g_Screen);
//Purpose:
//
void RotateAroundPoint(Vec3f vCenter, double X, double Y, double Z);
//Purpose:
//
void StrafeCamera(double speed);
//Purpose:
//
void MoveCamera(double speed);
//Purpose:
//
private:
Vec3f m_vPosition;
Vec3f m_vView;
Vec3f m_vUpVector;
Vec3f m_vStrafe;
void Update();
//Purpose:
//
void Look();
//Purpose:
//
private:
Vec3f m_vPosition;
Vec3f m_vView;
Vec3f m_vUpVector;
Vec3f m_vStrafe;
};
};
#endif

View File

@@ -1,16 +1,20 @@
#include "vector.h"
#include "myglTexture.h"
struct TRIANGLE
namespace OpenArena
{
GL_MY_TEXTURE texture;
uint32 texID;
Vec3f vertecies[3];
Vec2f texCoords[3];
Vec3f normal;
class Triangle
{
public:
Texture texture;
uint32 texID;
Vec3f vertecies[3];
Vec2f texCoords[3];
Vec3f normal;
};
};
class POSITION
/*//This class seems to never be used and I dont' remember why I made it.
class Position
{
public:
GLfloat xrot; // X rotation
@@ -21,7 +25,7 @@ public:
GLfloat ztrans; // Z translation
bool stepRight;
bool stepLeft;
POSITION()
Position()
{
xtrans = 0.0f;
ytrans = 0.0f;
@@ -33,3 +37,4 @@ public:
private:
};
*/

View File

@@ -30,78 +30,81 @@
#include "keys.h"
using namespace std;
using OpenArena::Triangle;
const float piover180 = 0.0174532925f;
const string DEFAULT_TEXTURE_NAME = "oa/textures/default.bmp";
const unsigned int MAX_CONSOLE_LINES = 30; //The max number of lines to be displayed in the console
const unsigned int MAX_CONSOLE_HISTORY_LINES = MAX_CONSOLE_LINES + 20; //The max number of console lines to store in the history
const unsigned int MAX_CONSOLE_OUTPUT_LINES = MAX_CONSOLE_LINES;
const unsigned int MAX_OUTPUT_TEXT_LINES = 4; //The max number of output lines to be displayed on the screen
enum {GL_MY_TEXTURE_CONSOLEBACKGROUND=0, NUM_MENU_TEXTURES};
class LEVEL
namespace OpenArena
{
public:
LEVEL();
~LEVEL();
bool LoadMap(string mapname);
bool LoadMap();
void SaveMap(string mapname);
bool LoadConfig(string cfgname);
void LoadConfig();
void SaveConfig(string cfgname);
void Execute(string cmd);
void LoadGLTextures();
void Render();
void UnloadMap();
void UpdateConsole(char);
uint32 FPS();
void ParseCmds(const char*);
void Print(int x, int y, const char* string, unsigned int set);
/*Not Yet Implemented
void PlayerConnect(); // implement later
void PlayerDisconnect(); // implement later
*/
SCREEN screen;
GLFontClass glFont;
string nextLevel;
PLAYER* defaultPlayer;
uint32 numTextures;
string* textureNames;
const float piover180 = 0.0174532925f;
const string DEFAULT_TEXTURE_NAME = "oa/textures/default.bmp";
const unsigned int MAX_CONSOLE_LINES = 30; //The max number of lines to be displayed in the console
const unsigned int MAX_CONSOLE_HISTORY_LINES = MAX_CONSOLE_LINES + 20; //The max number of console lines to store in the history
const unsigned int MAX_CONSOLE_OUTPUT_LINES = MAX_CONSOLE_LINES;
const unsigned int MAX_OUTPUT_TEXT_LINES = 4; //The max number of output lines to be displayed on the screen
string bgm;
#ifdef WIN32
HSTREAM bgmStream;
#endif
unsigned char bgmCDA;
string gamedir;
float gravity;
bool mlook;
bool showFPS;
bool showConsole;
bool sound;
float turnSpeed;
float moveSpeed;
float mouseSpeed;
unsigned char maxFPS;
//Map
TRIANGLE* triangles;
uint32 numTriangles;
list<PLAYER> players;
list<ENTITY> ents;
//list<GL_MY_TEXTURE> textures;
GL_MY_TEXTURE* textures;
GL_MY_TEXTURE menuTextures[NUM_MENU_TEXTURES];
enum {GL_MY_TEXTURE_CONSOLEBACKGROUND=0, NUM_MENU_TEXTURES};
private:
void ConsolePrint(string);
string consoleHistory[MAX_CONSOLE_HISTORY_LINES];
string consoleOutput[MAX_CONSOLE_OUTPUT_LINES];
string outputText[MAX_OUTPUT_TEXT_LINES];
};
class Level
{
public:
Level();
~Level();
bool LoadMap(string mapname);
bool LoadMap();
void SaveMap(string mapname);
bool LoadConfig(string cfgname);
void LoadConfig();
void SaveConfig(string cfgname);
void Execute(string cmd);
void LoadGLTextures();
void Render();
void UnloadMap();
void UpdateConsole(char);
uint32 FPS();
void ParseCmds(const char*);
void Print(int x, int y, const char* string, unsigned int set);
/*Not Yet Implemented
void PlayerConnect(); // implement later
void PlayerDisconnect(); // implement later
*/
Screen screen;
Font glFont;
string nextLevel;
Player* defaultPlayer;
uint32 numTextures;
string* textureNames;
string bgm;
#ifdef WIN32
HSTREAM bgmStream;
#endif
unsigned char bgmCDA;
string gamedir;
float gravity;
bool mlook;
bool showFPS;
bool showConsole;
bool sound;
float turnSpeed;
float moveSpeed;
float mouseSpeed;
unsigned char maxFPS;
//Map
Triangle* triangles;
uint32 numTriangles;
list<Player> players;
list<ENTITY> ents;
//list<GL_MY_TEXTURE> textures;
Texture* textures;
Texture menuTextures[NUM_MENU_TEXTURES];
private:
void ConsolePrint(string);
string consoleHistory[MAX_CONSOLE_HISTORY_LINES];
string consoleOutput[MAX_CONSOLE_OUTPUT_LINES];
string outputText[MAX_OUTPUT_TEXT_LINES];
};
};
#endif

View File

@@ -22,8 +22,11 @@ using namespace std;
static HINSTANCE hInstance; // Application instance
#endif
extern OpenArena::Window g_Screen;
int InitGL(GLvoid);
bool LoadGLTexture(string , GLuint&, GLuint = GL_LINEAR, GLuint = GL_LINEAR);
void FreeGLTexture(GLuint&);
//This doesn't need to be here I think
//int InitGL(GLvoid);
namespace OpenArena
{
bool LoadGLTexture(string , GLuint&, GLuint = GL_LINEAR, GLuint = GL_LINEAR);
void FreeGLTexture(GLuint&);
};
#endif

View File

@@ -3,27 +3,29 @@
#include "mygl.h"
class GLFontClass
namespace OpenArena
{
private:
short screenWidth;
short screenHeight;
unsigned int base;
unsigned int texture;
bool status;
public:
GLFontClass();
~GLFontClass();
bool BuildFont(const char*);
bool FreeFont();
void Print(int, int, const char*, unsigned int = 0);
bool Loaded();
void SetScreenDimensions(short, short);
void SetScreenWidth(short);
void SetScreenHeight(short);
short ScreenWidth();
short ScreenHeight();
class Font
{
private:
short screenWidth;
short screenHeight;
unsigned int base;
unsigned int texture;
bool status;
public:
Font();
~Font();
bool BuildFont(const char*);
bool FreeFont();
void Print(int, int, const char*, unsigned int = 0);
bool Loaded();
void SetScreenDimensions(short, short);
void SetScreenWidth(short);
void SetScreenHeight(short);
short ScreenWidth();
short ScreenHeight();
};
};
#endif

View File

@@ -7,29 +7,31 @@
using namespace std;
class GL_MY_TEXTURE
namespace OpenArena
{
public:
GL_MY_TEXTURE();
~GL_MY_TEXTURE();
string Filename();
GLuint ID();
bool Load(string filename);
bool Load(string filename, GLuint min, GLuint mag);
void Free();
bool Loaded();
bool operator<(const GL_MY_TEXTURE&);
bool operator<=(const GL_MY_TEXTURE&);
bool operator==(const GL_MY_TEXTURE&);
bool operator!=(const GL_MY_TEXTURE&);
bool operator>=(const GL_MY_TEXTURE&);
bool operator>(const GL_MY_TEXTURE&);
private:
GLuint minFilter;
GLuint magFilter;
string filename;
GLuint id;
};
class Texture
{
public:
Texture();
~Texture();
string Filename();
GLuint ID();
bool Load(string filename);
bool Load(string filename, GLuint min, GLuint mag);
void Free();
bool Loaded();
bool operator<(const Texture&);
bool operator<=(const Texture&);
bool operator==(const Texture&);
bool operator!=(const Texture&);
bool operator>=(const Texture&);
bool operator>(const Texture&);
private:
GLuint minFilter;
GLuint magFilter;
string filename;
GLuint id;
};
};
#endif

View File

@@ -4,23 +4,25 @@
#include "camera.h"
#include "ctrls.h"
class PLAYER
namespace OpenArena
{
public:
void Load();
void Save();
void CreateCharacter();
//void FirePrimary(ENTITY& ent);
//void FireSecondary();
void AddItem(unsigned int item);
void RemoveItem(unsigned int item);
ControlSchemeClass controls;
CameraClass camera;
private:
class Player
{
public:
void Load();
void Save();
void CreateCharacter();
//void FirePrimary(ENTITY& ent);
//void FireSecondary();
void AddItem(unsigned int item);
void RemoveItem(unsigned int item);
ControlSchemeClass controls;
Camera camera;
private:
};
};
#endif

View File

@@ -3,26 +3,27 @@
#include <string>
using namespace std;
class SCREEN
namespace OpenArena
{
public:
SCREEN()
class Screen
{
width=640;
height=480;
bpp=16;
fullscreen=false;
name = "";
}
short width;
short height;
char bpp;
bool fullscreen;
string name;
public:
Screen()
{
width=640;
height=480;
bpp=16;
fullscreen=false;
name = "";
}
short width;
short height;
char bpp;
bool fullscreen;
string name;
};
};
#endif

View File

@@ -1,8 +1,9 @@
#ifndef __texture_h__
#define __texture_h__
struct TextureImage
class TextureImage
{
public:
unsigned char* data;
unsigned int bpp;
unsigned int sizeX;

View File

@@ -19,7 +19,7 @@ namespace OpenArena
typedef void (*ResizeFunc)(GLsizei width, GLsizei height);
typedef int (*InitFunc)();
class Window: public SCREEN
class Window: public Screen
{
public:
Window();

View File

@@ -3,6 +3,6 @@
#include "level.h"
static LEVEL level;
static OpenArena::Level level;
#endif