Changed: Renamed a few classes
Changed: Moved most sensible objects into the OpenArena namespace ~g2k
This commit is contained in:
@@ -9,17 +9,17 @@
|
|||||||
#include "mygl.h"
|
#include "mygl.h"
|
||||||
#include "screen.h"
|
#include "screen.h"
|
||||||
|
|
||||||
|
namespace OpenArena
|
||||||
|
{
|
||||||
class CameraClass
|
class Camera
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
//Constructors
|
//Constructors
|
||||||
CameraClass(); //Default Constructor
|
Camera(); //Default Constructor
|
||||||
//Purpose:
|
//Purpose:
|
||||||
//
|
//
|
||||||
|
|
||||||
//CameraClass(const CameraClass&); //Copy Constructor
|
//Camera(const Camera&); //Copy Constructor
|
||||||
//Purpose:
|
//Purpose:
|
||||||
//
|
//
|
||||||
|
|
||||||
@@ -55,7 +55,7 @@ public:
|
|||||||
//Purpose:
|
//Purpose:
|
||||||
//
|
//
|
||||||
|
|
||||||
void SetViewByMouse(SCREEN g_Screen);
|
void SetViewByMouse(Screen g_Screen);
|
||||||
//Purpose:
|
//Purpose:
|
||||||
//
|
//
|
||||||
|
|
||||||
@@ -79,12 +79,12 @@ public:
|
|||||||
//Purpose:
|
//Purpose:
|
||||||
//
|
//
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Vec3f m_vPosition;
|
Vec3f m_vPosition;
|
||||||
Vec3f m_vView;
|
Vec3f m_vView;
|
||||||
Vec3f m_vUpVector;
|
Vec3f m_vUpVector;
|
||||||
Vec3f m_vStrafe;
|
Vec3f m_vStrafe;
|
||||||
};
|
};
|
||||||
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -1,16 +1,20 @@
|
|||||||
#include "vector.h"
|
#include "vector.h"
|
||||||
#include "myglTexture.h"
|
#include "myglTexture.h"
|
||||||
|
|
||||||
struct TRIANGLE
|
namespace OpenArena
|
||||||
{
|
{
|
||||||
GL_MY_TEXTURE texture;
|
class Triangle
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
Texture texture;
|
||||||
uint32 texID;
|
uint32 texID;
|
||||||
Vec3f vertecies[3];
|
Vec3f vertecies[3];
|
||||||
Vec2f texCoords[3];
|
Vec2f texCoords[3];
|
||||||
Vec3f normal;
|
Vec3f normal;
|
||||||
};
|
};
|
||||||
|
};
|
||||||
class POSITION
|
/*//This class seems to never be used and I dont' remember why I made it.
|
||||||
|
class Position
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
GLfloat xrot; // X rotation
|
GLfloat xrot; // X rotation
|
||||||
@@ -21,7 +25,7 @@ public:
|
|||||||
GLfloat ztrans; // Z translation
|
GLfloat ztrans; // Z translation
|
||||||
bool stepRight;
|
bool stepRight;
|
||||||
bool stepLeft;
|
bool stepLeft;
|
||||||
POSITION()
|
Position()
|
||||||
{
|
{
|
||||||
xtrans = 0.0f;
|
xtrans = 0.0f;
|
||||||
ytrans = 0.0f;
|
ytrans = 0.0f;
|
||||||
@@ -33,3 +37,4 @@ public:
|
|||||||
private:
|
private:
|
||||||
|
|
||||||
};
|
};
|
||||||
|
*/
|
||||||
|
|||||||
@@ -30,7 +30,10 @@
|
|||||||
#include "keys.h"
|
#include "keys.h"
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
using OpenArena::Triangle;
|
||||||
|
|
||||||
|
namespace OpenArena
|
||||||
|
{
|
||||||
const float piover180 = 0.0174532925f;
|
const float piover180 = 0.0174532925f;
|
||||||
const string DEFAULT_TEXTURE_NAME = "oa/textures/default.bmp";
|
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_LINES = 30; //The max number of lines to be displayed in the console
|
||||||
@@ -40,11 +43,11 @@ const unsigned int MAX_OUTPUT_TEXT_LINES = 4; //The max number of output lines
|
|||||||
|
|
||||||
enum {GL_MY_TEXTURE_CONSOLEBACKGROUND=0, NUM_MENU_TEXTURES};
|
enum {GL_MY_TEXTURE_CONSOLEBACKGROUND=0, NUM_MENU_TEXTURES};
|
||||||
|
|
||||||
class LEVEL
|
class Level
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
LEVEL();
|
Level();
|
||||||
~LEVEL();
|
~Level();
|
||||||
bool LoadMap(string mapname);
|
bool LoadMap(string mapname);
|
||||||
bool LoadMap();
|
bool LoadMap();
|
||||||
void SaveMap(string mapname);
|
void SaveMap(string mapname);
|
||||||
@@ -64,10 +67,10 @@ public:
|
|||||||
void PlayerConnect(); // implement later
|
void PlayerConnect(); // implement later
|
||||||
void PlayerDisconnect(); // implement later
|
void PlayerDisconnect(); // implement later
|
||||||
*/
|
*/
|
||||||
SCREEN screen;
|
Screen screen;
|
||||||
GLFontClass glFont;
|
Font glFont;
|
||||||
string nextLevel;
|
string nextLevel;
|
||||||
PLAYER* defaultPlayer;
|
Player* defaultPlayer;
|
||||||
uint32 numTextures;
|
uint32 numTextures;
|
||||||
string* textureNames;
|
string* textureNames;
|
||||||
|
|
||||||
@@ -87,13 +90,13 @@ public:
|
|||||||
float mouseSpeed;
|
float mouseSpeed;
|
||||||
unsigned char maxFPS;
|
unsigned char maxFPS;
|
||||||
//Map
|
//Map
|
||||||
TRIANGLE* triangles;
|
Triangle* triangles;
|
||||||
uint32 numTriangles;
|
uint32 numTriangles;
|
||||||
list<PLAYER> players;
|
list<Player> players;
|
||||||
list<ENTITY> ents;
|
list<ENTITY> ents;
|
||||||
//list<GL_MY_TEXTURE> textures;
|
//list<GL_MY_TEXTURE> textures;
|
||||||
GL_MY_TEXTURE* textures;
|
Texture* textures;
|
||||||
GL_MY_TEXTURE menuTextures[NUM_MENU_TEXTURES];
|
Texture menuTextures[NUM_MENU_TEXTURES];
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -103,5 +106,5 @@ private:
|
|||||||
string consoleOutput[MAX_CONSOLE_OUTPUT_LINES];
|
string consoleOutput[MAX_CONSOLE_OUTPUT_LINES];
|
||||||
string outputText[MAX_OUTPUT_TEXT_LINES];
|
string outputText[MAX_OUTPUT_TEXT_LINES];
|
||||||
};
|
};
|
||||||
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -22,8 +22,11 @@ using namespace std;
|
|||||||
static HINSTANCE hInstance; // Application instance
|
static HINSTANCE hInstance; // Application instance
|
||||||
#endif
|
#endif
|
||||||
extern OpenArena::Window g_Screen;
|
extern OpenArena::Window g_Screen;
|
||||||
int InitGL(GLvoid);
|
//This doesn't need to be here I think
|
||||||
|
//int InitGL(GLvoid);
|
||||||
|
namespace OpenArena
|
||||||
|
{
|
||||||
bool LoadGLTexture(string , GLuint&, GLuint = GL_LINEAR, GLuint = GL_LINEAR);
|
bool LoadGLTexture(string , GLuint&, GLuint = GL_LINEAR, GLuint = GL_LINEAR);
|
||||||
void FreeGLTexture(GLuint&);
|
void FreeGLTexture(GLuint&);
|
||||||
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -3,7 +3,9 @@
|
|||||||
|
|
||||||
#include "mygl.h"
|
#include "mygl.h"
|
||||||
|
|
||||||
class GLFontClass
|
namespace OpenArena
|
||||||
|
{
|
||||||
|
class Font
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
short screenWidth;
|
short screenWidth;
|
||||||
@@ -13,8 +15,8 @@ private:
|
|||||||
bool status;
|
bool status;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
GLFontClass();
|
Font();
|
||||||
~GLFontClass();
|
~Font();
|
||||||
bool BuildFont(const char*);
|
bool BuildFont(const char*);
|
||||||
bool FreeFont();
|
bool FreeFont();
|
||||||
void Print(int, int, const char*, unsigned int = 0);
|
void Print(int, int, const char*, unsigned int = 0);
|
||||||
@@ -25,5 +27,5 @@ public:
|
|||||||
short ScreenWidth();
|
short ScreenWidth();
|
||||||
short ScreenHeight();
|
short ScreenHeight();
|
||||||
};
|
};
|
||||||
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -7,23 +7,25 @@
|
|||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
class GL_MY_TEXTURE
|
namespace OpenArena
|
||||||
|
{
|
||||||
|
class Texture
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
GL_MY_TEXTURE();
|
Texture();
|
||||||
~GL_MY_TEXTURE();
|
~Texture();
|
||||||
string Filename();
|
string Filename();
|
||||||
GLuint ID();
|
GLuint ID();
|
||||||
bool Load(string filename);
|
bool Load(string filename);
|
||||||
bool Load(string filename, GLuint min, GLuint mag);
|
bool Load(string filename, GLuint min, GLuint mag);
|
||||||
void Free();
|
void Free();
|
||||||
bool Loaded();
|
bool Loaded();
|
||||||
bool operator<(const GL_MY_TEXTURE&);
|
bool operator<(const Texture&);
|
||||||
bool operator<=(const GL_MY_TEXTURE&);
|
bool operator<=(const Texture&);
|
||||||
bool operator==(const GL_MY_TEXTURE&);
|
bool operator==(const Texture&);
|
||||||
bool operator!=(const GL_MY_TEXTURE&);
|
bool operator!=(const Texture&);
|
||||||
bool operator>=(const GL_MY_TEXTURE&);
|
bool operator>=(const Texture&);
|
||||||
bool operator>(const GL_MY_TEXTURE&);
|
bool operator>(const Texture&);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
GLuint minFilter;
|
GLuint minFilter;
|
||||||
@@ -31,5 +33,5 @@ private:
|
|||||||
string filename;
|
string filename;
|
||||||
GLuint id;
|
GLuint id;
|
||||||
};
|
};
|
||||||
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -4,7 +4,9 @@
|
|||||||
#include "camera.h"
|
#include "camera.h"
|
||||||
#include "ctrls.h"
|
#include "ctrls.h"
|
||||||
|
|
||||||
class PLAYER
|
namespace OpenArena
|
||||||
|
{
|
||||||
|
class Player
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
void Load();
|
void Load();
|
||||||
@@ -16,11 +18,11 @@ public:
|
|||||||
void RemoveItem(unsigned int item);
|
void RemoveItem(unsigned int item);
|
||||||
|
|
||||||
ControlSchemeClass controls;
|
ControlSchemeClass controls;
|
||||||
CameraClass camera;
|
Camera camera;
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
};
|
};
|
||||||
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -3,11 +3,12 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
namespace OpenArena
|
||||||
class SCREEN
|
{
|
||||||
|
class Screen
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
SCREEN()
|
Screen()
|
||||||
{
|
{
|
||||||
width=640;
|
width=640;
|
||||||
height=480;
|
height=480;
|
||||||
@@ -24,5 +25,5 @@ public:
|
|||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -1,8 +1,9 @@
|
|||||||
#ifndef __texture_h__
|
#ifndef __texture_h__
|
||||||
#define __texture_h__
|
#define __texture_h__
|
||||||
|
|
||||||
struct TextureImage
|
class TextureImage
|
||||||
{
|
{
|
||||||
|
public:
|
||||||
unsigned char* data;
|
unsigned char* data;
|
||||||
unsigned int bpp;
|
unsigned int bpp;
|
||||||
unsigned int sizeX;
|
unsigned int sizeX;
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ namespace OpenArena
|
|||||||
typedef void (*ResizeFunc)(GLsizei width, GLsizei height);
|
typedef void (*ResizeFunc)(GLsizei width, GLsizei height);
|
||||||
typedef int (*InitFunc)();
|
typedef int (*InitFunc)();
|
||||||
|
|
||||||
class Window: public SCREEN
|
class Window: public Screen
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Window();
|
Window();
|
||||||
|
|||||||
@@ -3,6 +3,6 @@
|
|||||||
|
|
||||||
#include "level.h"
|
#include "level.h"
|
||||||
|
|
||||||
static LEVEL level;
|
static OpenArena::Level level;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -10,8 +10,8 @@
|
|||||||
// To implement an OpenGL Camera
|
// To implement an OpenGL Camera
|
||||||
//
|
//
|
||||||
// Summary of Methods:
|
// Summary of Methods:
|
||||||
// CameraClass
|
// Camera
|
||||||
// -CameraClass();
|
// -Camera();
|
||||||
// Initalize PDM's. Sets position to 0,0,0 up to 0,1,0 and view to 0,0,-1
|
// Initalize PDM's. Sets position to 0,0,0 up to 0,1,0 and view to 0,0,-1
|
||||||
// -Vec3f Position();
|
// -Vec3f Position();
|
||||||
// Returns a copy of the position vector.
|
// Returns a copy of the position vector.
|
||||||
@@ -29,7 +29,7 @@
|
|||||||
// Sets the position, up, and view vectors to those passed in.
|
// Sets the position, up, and view vectors to those passed in.
|
||||||
// -void RotateView(double angle, double X, double Y, double Z);
|
// -void RotateView(double angle, double X, double Y, double Z);
|
||||||
// Rotates the view angle degrees on the axis specified by X, Y, and Z.
|
// Rotates the view angle degrees on the axis specified by X, Y, and Z.
|
||||||
// -void SetViewByMouse(SCREEN g_Screen);
|
// -void SetViewByMouse(Screen g_Screen);
|
||||||
// Rotates the pitch and yaw of the view based on the mouse.
|
// Rotates the pitch and yaw of the view based on the mouse.
|
||||||
// -void RotateAroundPoint(double angle, double X, double Y, double Z, Vec3f vCenter);
|
// -void RotateAroundPoint(double angle, double X, double Y, double Z, Vec3f vCenter);
|
||||||
// Rotates the view angle degrees around a point vCenter on the axis specified by X, Y, Z.
|
// Rotates the view angle degrees around a point vCenter on the axis specified by X, Y, Z.
|
||||||
@@ -46,14 +46,16 @@
|
|||||||
|
|
||||||
#include "../include/camera.h"
|
#include "../include/camera.h"
|
||||||
|
|
||||||
CameraClass::CameraClass()
|
namespace OpenArena
|
||||||
|
{
|
||||||
|
Camera::Camera()
|
||||||
{
|
{
|
||||||
m_vPosition = Vec3f(0,0,0);
|
m_vPosition = Vec3f(0,0,0);
|
||||||
m_vView = Vec3f(0,0,-1);
|
m_vView = Vec3f(0,0,-1);
|
||||||
m_vUpVector = Vec3f(0,1,0);
|
m_vUpVector = Vec3f(0,1,0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CameraClass::PositionCamera(double xpos, double ypos, double zpos,
|
void Camera::PositionCamera(double xpos, double ypos, double zpos,
|
||||||
double xview, double yview, double zview,
|
double xview, double yview, double zview,
|
||||||
double xup, double yup, double zup)
|
double xup, double yup, double zup)
|
||||||
{
|
{
|
||||||
@@ -62,14 +64,14 @@ void CameraClass::PositionCamera(double xpos, double ypos, double zpos,
|
|||||||
m_vUpVector = Vec3f(xup, yup, zup);
|
m_vUpVector = Vec3f(xup, yup, zup);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CameraClass::PositionCamera(Vec3f pos, Vec3f view, Vec3f up)
|
void Camera::PositionCamera(Vec3f pos, Vec3f view, Vec3f up)
|
||||||
{
|
{
|
||||||
m_vPosition = pos;
|
m_vPosition = pos;
|
||||||
m_vView = view;
|
m_vView = view;
|
||||||
m_vUpVector = up;
|
m_vUpVector = up;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CameraClass::SetViewByMouse(SCREEN g_Screen)
|
void Camera::SetViewByMouse(Screen g_Screen)
|
||||||
{
|
{
|
||||||
//Most of this is sorta right for linux I think but since I don't know how yet it's currently windows only
|
//Most of this is sorta right for linux I think but since I don't know how yet it's currently windows only
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
@@ -111,7 +113,7 @@ void CameraClass::SetViewByMouse(SCREEN g_Screen)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void CameraClass::MoveCamera(double speed)
|
void Camera::MoveCamera(double speed)
|
||||||
{
|
{
|
||||||
Vec3f heading = (m_vView - m_vPosition).normalized();
|
Vec3f heading = (m_vView - m_vPosition).normalized();
|
||||||
|
|
||||||
@@ -121,7 +123,7 @@ void CameraClass::MoveCamera(double speed)
|
|||||||
m_vView.z += heading.z * speed;
|
m_vView.z += heading.z * speed;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CameraClass::RotateView(double angle, double x, double y, double z)
|
void Camera::RotateView(double angle, double x, double y, double z)
|
||||||
{
|
{
|
||||||
Vec3f nView;
|
Vec3f nView;
|
||||||
Vec3f cView;
|
Vec3f cView;
|
||||||
@@ -148,7 +150,7 @@ void CameraClass::RotateView(double angle, double x, double y, double z)
|
|||||||
m_vView.z = m_vPosition.z + nView.z;
|
m_vView.z = m_vPosition.z + nView.z;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CameraClass::StrafeCamera(double speed)
|
void Camera::StrafeCamera(double speed)
|
||||||
{
|
{
|
||||||
m_vPosition.x += m_vStrafe.x * speed;
|
m_vPosition.x += m_vStrafe.x * speed;
|
||||||
m_vPosition.z += m_vStrafe.z * speed;
|
m_vPosition.z += m_vStrafe.z * speed;
|
||||||
@@ -158,36 +160,37 @@ void CameraClass::StrafeCamera(double speed)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
void CameraClass::Update()
|
void Camera::Update()
|
||||||
{
|
{
|
||||||
m_vStrafe =((m_vView - m_vPosition).cross(m_vUpVector)).normalized();
|
m_vStrafe =((m_vView - m_vPosition).cross(m_vUpVector)).normalized();
|
||||||
//SetViewByMouse(); //TODO take this whole function out asap
|
//SetViewByMouse(); //TODO take this whole function out asap
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CameraClass::Look()
|
void Camera::Look()
|
||||||
{
|
{
|
||||||
gluLookAt(m_vPosition.x, m_vPosition.y, m_vPosition.z,
|
gluLookAt(m_vPosition.x, m_vPosition.y, m_vPosition.z,
|
||||||
m_vView.x, m_vView.y, m_vView.z,
|
m_vView.x, m_vView.y, m_vView.z,
|
||||||
m_vUpVector.x, m_vUpVector.y, m_vUpVector.z);
|
m_vUpVector.x, m_vUpVector.y, m_vUpVector.z);
|
||||||
}
|
}
|
||||||
|
|
||||||
Vec3f CameraClass::Position()
|
Vec3f Camera::Position()
|
||||||
{
|
{
|
||||||
return m_vPosition;
|
return m_vPosition;
|
||||||
}
|
}
|
||||||
|
|
||||||
Vec3f CameraClass::Strafe()
|
Vec3f Camera::Strafe()
|
||||||
{
|
{
|
||||||
return m_vStrafe;
|
return m_vStrafe;
|
||||||
}
|
}
|
||||||
|
|
||||||
Vec3f CameraClass::UpVector()
|
Vec3f Camera::UpVector()
|
||||||
{
|
{
|
||||||
return m_vUpVector;
|
return m_vUpVector;
|
||||||
}
|
}
|
||||||
|
|
||||||
Vec3f CameraClass::View()
|
Vec3f Camera::View()
|
||||||
{
|
{
|
||||||
return m_vView;
|
return m_vView;
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|||||||
@@ -30,7 +30,9 @@
|
|||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
LEVEL::LEVEL()
|
namespace OpenArena
|
||||||
|
{
|
||||||
|
Level::Level()
|
||||||
{
|
{
|
||||||
textureNames = NULL;
|
textureNames = NULL;
|
||||||
numTextures = 0;
|
numTextures = 0;
|
||||||
@@ -45,7 +47,7 @@ LEVEL::LEVEL()
|
|||||||
gamedir = "oa/";
|
gamedir = "oa/";
|
||||||
sound = true;
|
sound = true;
|
||||||
|
|
||||||
defaultPlayer = new PLAYER;
|
defaultPlayer = new Player;
|
||||||
|
|
||||||
numTriangles = 0;
|
numTriangles = 0;
|
||||||
triangles = NULL;
|
triangles = NULL;
|
||||||
@@ -60,7 +62,7 @@ LEVEL::LEVEL()
|
|||||||
mlook = true;
|
mlook = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
LEVEL::~LEVEL()
|
Level::~Level()
|
||||||
{
|
{
|
||||||
if(defaultPlayer)
|
if(defaultPlayer)
|
||||||
{
|
{
|
||||||
@@ -69,7 +71,7 @@ LEVEL::~LEVEL()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool LEVEL::LoadMap(string mapname)
|
bool Level::LoadMap(string mapname)
|
||||||
{
|
{
|
||||||
ifstream input;
|
ifstream input;
|
||||||
string readBuffer;
|
string readBuffer;
|
||||||
@@ -111,7 +113,7 @@ bool LEVEL::LoadMap(string mapname)
|
|||||||
numTriangles = Integer(readBuffer);
|
numTriangles = Integer(readBuffer);
|
||||||
|
|
||||||
//Triangle Data
|
//Triangle Data
|
||||||
triangles = new TRIANGLE[numTriangles];
|
triangles = new Triangle[numTriangles];
|
||||||
for(unsigned int i=0; i<numTriangles; i++)
|
for(unsigned int i=0; i<numTriangles; i++)
|
||||||
{
|
{
|
||||||
//TextureID
|
//TextureID
|
||||||
@@ -211,12 +213,12 @@ bool LEVEL::LoadMap(string mapname)
|
|||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
bool LEVEL::LoadMap()
|
bool Level::LoadMap()
|
||||||
{
|
{
|
||||||
return LoadMap(nextLevel);
|
return LoadMap(nextLevel);
|
||||||
}
|
}
|
||||||
|
|
||||||
void LEVEL::SaveMap(string mapname)
|
void Level::SaveMap(string mapname)
|
||||||
{
|
{
|
||||||
ofstream output;
|
ofstream output;
|
||||||
|
|
||||||
@@ -281,7 +283,7 @@ void LEVEL::SaveMap(string mapname)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void LEVEL::Render()
|
void Level::Render()
|
||||||
{
|
{
|
||||||
glPushMatrix();
|
glPushMatrix();
|
||||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||||
@@ -390,7 +392,7 @@ void LEVEL::Render()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void LEVEL::UnloadMap()
|
void Level::UnloadMap()
|
||||||
{
|
{
|
||||||
//Stop audio
|
//Stop audio
|
||||||
//This needs to be abstracted somehow
|
//This needs to be abstracted somehow
|
||||||
@@ -425,7 +427,7 @@ void LEVEL::UnloadMap()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void LEVEL::LoadGLTextures()
|
void Level::LoadGLTextures()
|
||||||
{
|
{
|
||||||
|
|
||||||
/*GLfloat light[4] = {1.0f,1.0f,1.0f,0.5f};
|
/*GLfloat light[4] = {1.0f,1.0f,1.0f,0.5f};
|
||||||
@@ -438,7 +440,7 @@ void LEVEL::LoadGLTextures()
|
|||||||
delete [] textures;
|
delete [] textures;
|
||||||
}
|
}
|
||||||
|
|
||||||
textures = new GL_MY_TEXTURE[numTextures];
|
textures = new Texture[numTextures];
|
||||||
|
|
||||||
for(uint32 i=0; i<numTextures; i++)
|
for(uint32 i=0; i<numTextures; i++)
|
||||||
{
|
{
|
||||||
@@ -454,7 +456,7 @@ void LEVEL::LoadGLTextures()
|
|||||||
menuTextures[GL_MY_TEXTURE_CONSOLEBACKGROUND].Load("oa/textures/menu/con_back.bmp");
|
menuTextures[GL_MY_TEXTURE_CONSOLEBACKGROUND].Load("oa/textures/menu/con_back.bmp");
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32 LEVEL::FPS()
|
uint32 Level::FPS()
|
||||||
{
|
{
|
||||||
static uint32 fps=0;
|
static uint32 fps=0;
|
||||||
static uint32 fps2=0;
|
static uint32 fps2=0;
|
||||||
@@ -478,7 +480,7 @@ uint32 LEVEL::FPS()
|
|||||||
return fps2;
|
return fps2;
|
||||||
}
|
}
|
||||||
|
|
||||||
void LEVEL::Execute(string cmd)
|
void Level::Execute(string cmd)
|
||||||
{
|
{
|
||||||
string command;
|
string command;
|
||||||
|
|
||||||
@@ -782,7 +784,7 @@ void LEVEL::Execute(string cmd)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void LEVEL::ParseCmds(const char* lpCmdLine)
|
void Level::ParseCmds(const char* lpCmdLine)
|
||||||
{
|
{
|
||||||
string cmd = lpCmdLine;
|
string cmd = lpCmdLine;
|
||||||
string command;
|
string command;
|
||||||
@@ -936,7 +938,7 @@ void LEVEL::ParseCmds(const char* lpCmdLine)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void LEVEL::LoadConfig()
|
void Level::LoadConfig()
|
||||||
{
|
{
|
||||||
showFPS = false;
|
showFPS = false;
|
||||||
nextLevel = "intro.map";
|
nextLevel = "intro.map";
|
||||||
@@ -948,7 +950,7 @@ void LEVEL::LoadConfig()
|
|||||||
moveSpeed = .2f;
|
moveSpeed = .2f;
|
||||||
mlook = true;
|
mlook = true;
|
||||||
}
|
}
|
||||||
bool LEVEL::LoadConfig(string cfgname)
|
bool Level::LoadConfig(string cfgname)
|
||||||
{
|
{
|
||||||
ifstream input;
|
ifstream input;
|
||||||
string readBuffer;
|
string readBuffer;
|
||||||
@@ -982,7 +984,7 @@ bool LEVEL::LoadConfig(string cfgname)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void LEVEL::SaveConfig(string cfgname)
|
void Level::SaveConfig(string cfgname)
|
||||||
{
|
{
|
||||||
ofstream output;
|
ofstream output;
|
||||||
|
|
||||||
@@ -1175,12 +1177,12 @@ void LEVEL::SaveConfig(string cfgname)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void LEVEL::Print(int x, int y, const char* str, unsigned int set)
|
void Level::Print(int x, int y, const char* str, unsigned int set)
|
||||||
{
|
{
|
||||||
glFont.Print(x,y,str, set);
|
glFont.Print(x,y,str, set);
|
||||||
}
|
}
|
||||||
|
|
||||||
void LEVEL::UpdateConsole(char newChar)
|
void Level::UpdateConsole(char newChar)
|
||||||
{
|
{
|
||||||
if(newChar == '\n')
|
if(newChar == '\n')
|
||||||
{
|
{
|
||||||
@@ -1208,7 +1210,7 @@ void LEVEL::UpdateConsole(char newChar)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void LEVEL::ConsolePrint(string line)
|
void Level::ConsolePrint(string line)
|
||||||
{
|
{
|
||||||
for (int i=MAX_CONSOLE_OUTPUT_LINES - 1; i>0; i--)
|
for (int i=MAX_CONSOLE_OUTPUT_LINES - 1; i>0; i--)
|
||||||
{
|
{
|
||||||
@@ -1216,3 +1218,4 @@ void LEVEL::ConsolePrint(string line)
|
|||||||
}
|
}
|
||||||
consoleOutput[0] = line;
|
consoleOutput[0] = line;
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
|
|
||||||
#include "../include/mygl.h"
|
#include "../include/mygl.h"
|
||||||
|
namespace OpenArena
|
||||||
|
{
|
||||||
void FreeGLTexture(GLuint& texture)
|
void FreeGLTexture(GLuint& texture)
|
||||||
{
|
{
|
||||||
glDeleteTextures(1, &texture);
|
glDeleteTextures(1, &texture);
|
||||||
@@ -61,5 +62,6 @@ bool LoadGLTexture(string fn, GLuint& texture, GLuint mag, GLuint min)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
OpenArena::Window g_Screen;
|
OpenArena::Window g_Screen;
|
||||||
|
|||||||
@@ -25,7 +25,9 @@
|
|||||||
|
|
||||||
#include "../include/myglFont.h"
|
#include "../include/myglFont.h"
|
||||||
|
|
||||||
GLFontClass::GLFontClass()
|
namespace OpenArena
|
||||||
|
{
|
||||||
|
Font::Font()
|
||||||
{
|
{
|
||||||
status = 0;
|
status = 0;
|
||||||
base = 0;
|
base = 0;
|
||||||
@@ -34,12 +36,12 @@ GLFontClass::GLFontClass()
|
|||||||
screenHeight = 1;
|
screenHeight = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
GLFontClass::~GLFontClass()
|
Font::~Font()
|
||||||
{
|
{
|
||||||
FreeFont();
|
FreeFont();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GLFontClass::BuildFont(const char* texName)
|
bool Font::BuildFont(const char* texName)
|
||||||
{
|
{
|
||||||
FreeFont();
|
FreeFont();
|
||||||
|
|
||||||
@@ -71,7 +73,7 @@ bool GLFontClass::BuildFont(const char* texName)
|
|||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GLFontClass::FreeFont()
|
bool Font::FreeFont()
|
||||||
{
|
{
|
||||||
if(status)
|
if(status)
|
||||||
{
|
{
|
||||||
@@ -81,7 +83,7 @@ bool GLFontClass::FreeFont()
|
|||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GLFontClass::Print(int x, int y, const char* str, unsigned int set)
|
void Font::Print(int x, int y, const char* str, unsigned int set)
|
||||||
{
|
{
|
||||||
if(status)
|
if(status)
|
||||||
{
|
{
|
||||||
@@ -110,33 +112,34 @@ void GLFontClass::Print(int x, int y, const char* str, unsigned int set)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GLFontClass::Loaded()
|
bool Font::Loaded()
|
||||||
{
|
{
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GLFontClass::SetScreenDimensions(short x, short y)
|
void Font::SetScreenDimensions(short x, short y)
|
||||||
{
|
{
|
||||||
screenWidth = x;
|
screenWidth = x;
|
||||||
screenHeight = y;
|
screenHeight = y;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GLFontClass::SetScreenWidth(short x)
|
void Font::SetScreenWidth(short x)
|
||||||
{
|
{
|
||||||
screenWidth = x;
|
screenWidth = x;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GLFontClass::SetScreenHeight(short y)
|
void Font::SetScreenHeight(short y)
|
||||||
{
|
{
|
||||||
screenHeight = y;
|
screenHeight = y;
|
||||||
}
|
}
|
||||||
|
|
||||||
short GLFontClass::ScreenWidth()
|
short Font::ScreenWidth()
|
||||||
{
|
{
|
||||||
return screenWidth;
|
return screenWidth;
|
||||||
}
|
}
|
||||||
|
|
||||||
short GLFontClass::ScreenHeight()
|
short Font::ScreenHeight()
|
||||||
{
|
{
|
||||||
return screenHeight;
|
return screenHeight;
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|||||||
@@ -1,6 +1,9 @@
|
|||||||
#include "../include/myglTexture.h"
|
#include "../include/myglTexture.h"
|
||||||
|
using namespace OpenArena;
|
||||||
|
|
||||||
GL_MY_TEXTURE::GL_MY_TEXTURE()
|
namespace OpenArena
|
||||||
|
{
|
||||||
|
Texture::Texture()
|
||||||
{
|
{
|
||||||
id=0xFFFFFFFF;
|
id=0xFFFFFFFF;
|
||||||
filename = "";
|
filename = "";
|
||||||
@@ -8,27 +11,27 @@ GL_MY_TEXTURE::GL_MY_TEXTURE()
|
|||||||
magFilter = GL_LINEAR;
|
magFilter = GL_LINEAR;
|
||||||
}
|
}
|
||||||
|
|
||||||
GL_MY_TEXTURE::~GL_MY_TEXTURE()
|
Texture::~Texture()
|
||||||
{
|
{
|
||||||
Free();
|
Free();
|
||||||
}
|
}
|
||||||
|
|
||||||
string GL_MY_TEXTURE::Filename()
|
string Texture::Filename()
|
||||||
{
|
{
|
||||||
return filename;
|
return filename;
|
||||||
}
|
}
|
||||||
|
|
||||||
GLuint GL_MY_TEXTURE::ID()
|
GLuint Texture::ID()
|
||||||
{
|
{
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GL_MY_TEXTURE::Loaded()
|
bool Texture::Loaded()
|
||||||
{
|
{
|
||||||
return filename != "";
|
return filename != "";
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GL_MY_TEXTURE::Load(string fn)
|
bool Texture::Load(string fn)
|
||||||
{
|
{
|
||||||
if(Loaded())
|
if(Loaded())
|
||||||
Free();
|
Free();
|
||||||
@@ -45,7 +48,7 @@ bool GL_MY_TEXTURE::Load(string fn)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GL_MY_TEXTURE::Load(string fn, GLuint min, GLuint mag)
|
bool Texture::Load(string fn, GLuint min, GLuint mag)
|
||||||
{
|
{
|
||||||
if(Loaded())
|
if(Loaded())
|
||||||
Free();
|
Free();
|
||||||
@@ -64,7 +67,7 @@ bool GL_MY_TEXTURE::Load(string fn, GLuint min, GLuint mag)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void GL_MY_TEXTURE::Free()
|
void Texture::Free()
|
||||||
{
|
{
|
||||||
if(Loaded())
|
if(Loaded())
|
||||||
{
|
{
|
||||||
@@ -76,32 +79,33 @@ void GL_MY_TEXTURE::Free()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GL_MY_TEXTURE::operator<(const GL_MY_TEXTURE& rtOp)
|
bool Texture::operator<(const Texture& rtOp)
|
||||||
{
|
{
|
||||||
return id<rtOp.id;
|
return id<rtOp.id;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GL_MY_TEXTURE::operator<=(const GL_MY_TEXTURE& rtOp)
|
bool Texture::operator<=(const Texture& rtOp)
|
||||||
{
|
{
|
||||||
return id<=rtOp.id;
|
return id<=rtOp.id;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GL_MY_TEXTURE::operator==(const GL_MY_TEXTURE& rtOp)
|
bool Texture::operator==(const Texture& rtOp)
|
||||||
{
|
{
|
||||||
return id==rtOp.id;
|
return id==rtOp.id;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GL_MY_TEXTURE::operator!=(const GL_MY_TEXTURE& rtOp)
|
bool Texture::operator!=(const Texture& rtOp)
|
||||||
{
|
{
|
||||||
return id!=rtOp.id;
|
return id!=rtOp.id;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GL_MY_TEXTURE::operator>=(const GL_MY_TEXTURE& rtOp)
|
bool Texture::operator>=(const Texture& rtOp)
|
||||||
{
|
{
|
||||||
return id>=rtOp.id;
|
return id>=rtOp.id;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GL_MY_TEXTURE::operator>(const GL_MY_TEXTURE& rtOp)
|
bool Texture::operator>(const Texture& rtOp)
|
||||||
{
|
{
|
||||||
return id>rtOp.id;
|
return id>rtOp.id;
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|||||||
@@ -1,23 +1,26 @@
|
|||||||
#include "../include/player.h"
|
#include "../include/player.h"
|
||||||
|
|
||||||
void PLAYER::Load()
|
namespace OpenArena
|
||||||
|
{
|
||||||
|
void Player::Load()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void PLAYER::Save()
|
void Player::Save()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void PLAYER::AddItem(unsigned int item)
|
void Player::AddItem(unsigned int item)
|
||||||
{
|
{
|
||||||
// inventory = inventory | item;
|
// inventory = inventory | item;
|
||||||
}
|
}
|
||||||
|
|
||||||
void PLAYER::RemoveItem(unsigned int item)
|
void Player::RemoveItem(unsigned int item)
|
||||||
{
|
{
|
||||||
// inventory = inventory & ~item;
|
// inventory = inventory & ~item;
|
||||||
}
|
}
|
||||||
|
|
||||||
void PLAYER::CreateCharacter()
|
void Player::CreateCharacter()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user