Changed Moved resources around
~G2k
This commit is contained in:
1221
include/bass.h
1221
include/bass.h
File diff suppressed because it is too large
Load Diff
@@ -1,12 +0,0 @@
|
||||
#ifndef __bmp_h__
|
||||
#define __bmp_h__
|
||||
|
||||
#include "mygl.h"
|
||||
#include "datatypes.h"
|
||||
#include "texture.h"
|
||||
|
||||
namespace OpenArena{
|
||||
TextureImage* LoadBMP(const char* Filename);
|
||||
};
|
||||
|
||||
#endif
|
||||
100
include/camera.h
100
include/camera.h
@@ -1,100 +0,0 @@
|
||||
#ifndef __camera_h__
|
||||
#define __camera_h__
|
||||
|
||||
#include <cmath>
|
||||
#ifdef WIN32
|
||||
#include <windows.h> //Currently used for mouse stuff this should be replaced by oa_input
|
||||
#endif
|
||||
#include "vector.h"
|
||||
#include "mygl.h"
|
||||
#include "screen.h"
|
||||
|
||||
namespace OpenArena
|
||||
{
|
||||
class Camera
|
||||
{
|
||||
public:
|
||||
//Constructors
|
||||
Camera(); //Default Constructor
|
||||
//Purpose:
|
||||
// Creates a new Camera object located at the origin, pointing at the negative z-axis with up being the positive y-axis
|
||||
|
||||
//Camera(const Camera&); //Copy Constructor
|
||||
//Purpose:
|
||||
//
|
||||
|
||||
//Observer Accessors
|
||||
Vec3f Position();
|
||||
//Purpose:
|
||||
// Returns the position vector of this camera.
|
||||
// This vector is the location of the camera.
|
||||
|
||||
Vec3f View();
|
||||
//Purpose:
|
||||
// Returns the view vector of this camera.
|
||||
// This vector is the direction the camera is pointing.
|
||||
|
||||
Vec3f UpVector();
|
||||
//Purpose:
|
||||
// Returns the up vector of this camera.
|
||||
// This vector points up in the rendered view.
|
||||
|
||||
Vec3f Strafe();
|
||||
//Purpose:
|
||||
// Returns the strafe vector fo this camera.
|
||||
// This is the direction StrafeCamera will move
|
||||
|
||||
//Mutators
|
||||
void PositionCamera(double xpos, double ypos, double zpos,
|
||||
double xview, double yview, double zview,
|
||||
double xup, double yup, double zup);
|
||||
//Purpose:
|
||||
// Relocates and reorientates the camera as determined by the given vector components.
|
||||
|
||||
void PositionCamera(Vec3f pos, Vec3f view, Vec3f up);
|
||||
//Purpose:
|
||||
// Relocates and reorientates the camera as determined by the given vectos.
|
||||
|
||||
void Camera::RotateView(double angle, Vec3d axis);
|
||||
//Purpose:
|
||||
// Rotates the camera by angle degrees about the axis specified by axis.
|
||||
|
||||
void RotateView(double angle, double X, double Y, double Z);
|
||||
//Purpose:
|
||||
// Rotates the camera by angle degrees about the axis specified by the given components.
|
||||
// Works the same as glRotatef(angle, X, Y, Z).
|
||||
|
||||
void SetViewByMouse(Window window);
|
||||
//Purpose:
|
||||
// Updates the view Vector based on the change in mouse position since the last time it was called.
|
||||
|
||||
//This function needs to be reimagined and better fleshed out.
|
||||
//void RotateAroundPoint(Vec3f vCenter, double X, double Y, double Z);
|
||||
//Purpose:
|
||||
// Rotates the camera arount the point vCenter X degrees around the x-axis, Y degrees around the y-axis, and Z degrees around the z-axis in that order
|
||||
|
||||
void StrafeCamera(double speed);
|
||||
//Purpose:
|
||||
// Moves the camera along it's strafe vector speed units.
|
||||
|
||||
void MoveCamera(double speed);
|
||||
//Purpose:
|
||||
// Moves the camera along it's view vector speed units.
|
||||
|
||||
void Update();
|
||||
//Purpose:
|
||||
// Recalculates the strafe vector.
|
||||
|
||||
void Look();
|
||||
//Purpose:
|
||||
// Calls gluLookAt with stored values to set the scene to the camera.
|
||||
|
||||
private:
|
||||
Vec3f m_vPosition;
|
||||
Vec3f m_vView;
|
||||
Vec3f m_vUpVector;
|
||||
Vec3f m_vStrafe;
|
||||
};
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -1,42 +0,0 @@
|
||||
#include "keys.h"
|
||||
#include "physics.h"
|
||||
#include "datatypes.h"
|
||||
#include "list.h"
|
||||
|
||||
namespace OpenArena{
|
||||
class ControlScheme
|
||||
{
|
||||
public:
|
||||
enum Action{ACTION_FORWARD, ACTION_BACKWARD, ACTION_LOOKLEFT, ACTION_LOOKRIGHT, ACTION_LOOKUP,
|
||||
ACTION_LOOKDOWN, ACTION_MOVELEFT, ACTION_MOVERIGHT, ACTION_MOVEUP, ACTION_MOVEDOWN,
|
||||
ACTION_ROLLLEFT, ACTION_ROLLRIGHT, ACTION_FIREPRIMARY, ACTION_FIRESECONDARY,
|
||||
ACTION_WEAPONNEXT, ACTION_WEAPONPREV, ACTION_TOGGLE_LIGHTS, ACTION_TOGGLE_FPS,
|
||||
ACTION_TOGGLE_CONSOLE, ACTION_TOGGLE_MOUSELOOK, ACTION_QUICKMOUSELOOK};
|
||||
void LoadDefaultControlScheme();
|
||||
void ClearControlScheme();
|
||||
void Unbind(uint8);
|
||||
bool Bind(uint32, uint8);
|
||||
|
||||
list<uint8> forward;
|
||||
list<uint8> backward;
|
||||
list<uint8> lookLeft;
|
||||
list<uint8> lookRight;
|
||||
list<uint8> lookUp;
|
||||
list<uint8> lookDown;
|
||||
list<uint8> moveLeft;
|
||||
list<uint8> moveRight;
|
||||
list<uint8> moveUp;
|
||||
list<uint8> moveDown;
|
||||
list<uint8> firePrimary;
|
||||
list<uint8> fireSecondary;
|
||||
list<uint8> weaponNext;
|
||||
list<uint8> weaponPrev;
|
||||
list<uint8> toggleLights;
|
||||
list<uint8> toggleFPS;
|
||||
list<uint8> toggleConsole;
|
||||
list<uint8> toggleMouseLook;
|
||||
list<uint8> quickMouseLook;
|
||||
list<uint8> rollLeft;
|
||||
list<uint8> rollRight;
|
||||
};
|
||||
};
|
||||
@@ -1,58 +0,0 @@
|
||||
#ifndef __datatypes_h__
|
||||
#define __datatypes_h__
|
||||
|
||||
#ifdef WIN32 //Make this MSVC something
|
||||
typedef unsigned __int8 uint8;
|
||||
typedef unsigned __int16 uint16;
|
||||
typedef unsigned __int32 uint32;
|
||||
typedef unsigned __int64 uint64;
|
||||
typedef __int8 int8;
|
||||
typedef __int16 int16;
|
||||
typedef __int32 int32;
|
||||
typedef __int64 int64;
|
||||
typedef signed __int8 sint8;
|
||||
typedef signed __int16 sint16;
|
||||
typedef signed __int32 sint32;
|
||||
typedef signed __int64 sint64;
|
||||
|
||||
/*
|
||||
typedef unsigned __int8 byte;
|
||||
typedef unsigned __int16 word;
|
||||
typedef unsigned __int32 dword;
|
||||
typedef unsigned __int64 qword;
|
||||
|
||||
typedef byte db;
|
||||
typedef word dw;
|
||||
typedef dword dd;
|
||||
typedef qword dq;
|
||||
*/
|
||||
#endif
|
||||
|
||||
#ifdef __GNUC__ //ie if we are using GCC //used to be __linux
|
||||
typedef unsigned char uint8;
|
||||
typedef unsigned short uint16;
|
||||
typedef unsigned long uint32;
|
||||
typedef unsigned long long uint64;
|
||||
typedef char int8;
|
||||
typedef short int16;
|
||||
typedef long int32;
|
||||
typedef long long int64;
|
||||
typedef signed char sint8;
|
||||
typedef signed short sint16;
|
||||
typedef signed long sint32;
|
||||
typedef signed long long sint64;
|
||||
|
||||
/*
|
||||
typedef unsigned char byte;
|
||||
typedef unsigned short word;
|
||||
typedef unsigned long dword;
|
||||
typedef unsigned long long qword;
|
||||
|
||||
typedef byte db;
|
||||
typedef word dw;
|
||||
typedef dword dd;
|
||||
typedef qword dq;
|
||||
*/
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -1,60 +0,0 @@
|
||||
//Yank/rename these maybe MapEntities
|
||||
using namespace std;
|
||||
using OpenArena::Vec3d;
|
||||
|
||||
struct LIGHT
|
||||
{
|
||||
GLfloat coords[4];
|
||||
GLfloat color[4];
|
||||
};
|
||||
|
||||
struct PLAYER_START
|
||||
{
|
||||
Vec3d coords;
|
||||
Vec3d heading;
|
||||
};
|
||||
struct PLAYER_DEATHMATCH_START
|
||||
{
|
||||
Vec3d coords;
|
||||
Vec3d heading;
|
||||
};
|
||||
struct BOT_START
|
||||
{
|
||||
Vec3d coords;
|
||||
Vec3d heading;
|
||||
string name;
|
||||
};
|
||||
struct GEOMETRY
|
||||
{
|
||||
int x;
|
||||
};
|
||||
struct PROJECTILE
|
||||
{
|
||||
Vec3d heading;
|
||||
Vec3d start;
|
||||
Vec3d end;
|
||||
int dammage;
|
||||
float creation;
|
||||
|
||||
};
|
||||
//const PROJECTILE BULLET = {{0,0,0},{0,0,0},{0,0,0},5};
|
||||
//const PROJECTILE SPIKE = {{0,0,0},{0,0,0},{0,0,0},10};
|
||||
|
||||
struct ENTITY
|
||||
{
|
||||
PLAYER_START* Player_Start;
|
||||
int numPlayer_Start;
|
||||
PLAYER_DEATHMATCH_START* Player_Deathmatch_Start;
|
||||
int numPlayer_Deathmatch_Start;
|
||||
BOT_START* Bot_Start;
|
||||
int numBot_Start;
|
||||
GEOMETRY* Geometry;
|
||||
int numGeometry;
|
||||
PROJECTILE* Projectile;
|
||||
int numProjectile;
|
||||
|
||||
ENTITY();
|
||||
|
||||
};
|
||||
|
||||
enum ITEM_TYPE{/*all weapons go first*/WEAPON_LASERPISTOL = 1, WEAPON_SHOTGUN = 2, ITEM_BANDAGES = 4, RUNE_DAMMAGEMULTIPLIER = 8, RUNE_PROTECTION = 16, RUNE_VAMPIRE = 32, RUNE_SPEED = 64, RUNE_DOC = 128};//This semicolon got rid of 107 errors and no warnings
|
||||
@@ -1,31 +0,0 @@
|
||||
//Yank/rename this class
|
||||
#ifndef __entity_h__
|
||||
#define __entity_h__
|
||||
|
||||
#include "datatypes.h"
|
||||
|
||||
enum { //Begin entity declaration
|
||||
ENTITY_NONE=0, //Nonexistant entity this should never be used.
|
||||
ENTITY_PLAYER_MULTI_START //Player start position for multiplayer.
|
||||
}; //End entity declaration
|
||||
|
||||
class ENTITY
|
||||
{
|
||||
public:
|
||||
ENTITY()
|
||||
{
|
||||
type = ENTITY_NONE;
|
||||
vPosition = Vec3f(0,0,0);
|
||||
vHeading = Vec3f(0,0,0);
|
||||
vUp = Vec3f(0,0,0);
|
||||
health = 0;
|
||||
}
|
||||
|
||||
uint32 type;
|
||||
Vec3f vPosition;
|
||||
Vec3f vHeading;
|
||||
Vec3f vUp;
|
||||
uint16 health;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -1,15 +0,0 @@
|
||||
#include "vector.h"
|
||||
#include "myglTexture.h"
|
||||
|
||||
namespace OpenArena
|
||||
{
|
||||
class Triangle
|
||||
{
|
||||
public:
|
||||
Texture texture;
|
||||
uint32 texID;
|
||||
Vec3f vertecies[3];
|
||||
Vec2f texCoords[3];
|
||||
Vec3f normal;
|
||||
};
|
||||
};
|
||||
117
include/keys.h
117
include/keys.h
@@ -1,117 +0,0 @@
|
||||
#ifndef __keys_h__
|
||||
#define __keys_h__
|
||||
|
||||
namespace OpenArena
|
||||
{
|
||||
enum Keys{
|
||||
KEY_UNKNOWN = 0,
|
||||
KEY_BUTTON0,
|
||||
KEY_BUTTON1,
|
||||
KEY_BUTTON2,
|
||||
KEY_BUTTON3,
|
||||
KEY_BUTTON4,
|
||||
KEY_LEFT,
|
||||
KEY_RIGHT,
|
||||
KEY_UP,
|
||||
KEY_DOWN,
|
||||
KEY_SPACE,
|
||||
KEY_RETURN,
|
||||
KEY_SHIFT,
|
||||
KEY_PAUSE,
|
||||
KEY_CONTROL,
|
||||
KEY_CAPITAL,
|
||||
KEY_ESCAPE,
|
||||
KEY_PRIOR,
|
||||
KEY_NEXT,
|
||||
KEY_END,
|
||||
KEY_HOME,
|
||||
KEY_INSERT,
|
||||
KEY_DELETE,
|
||||
KEY_LWIN,
|
||||
KEY_RWIN,
|
||||
KEY_APPS,
|
||||
KEY_NUMPAD0,
|
||||
KEY_NUMPAD1,
|
||||
KEY_NUMPAD2,
|
||||
KEY_NUMPAD3,
|
||||
KEY_NUMPAD4,
|
||||
KEY_NUMPAD5,
|
||||
KEY_NUMPAD6,
|
||||
KEY_NUMPAD7,
|
||||
KEY_NUMPAD8,
|
||||
KEY_NUMPAD9,
|
||||
KEY_MULTIPLY,
|
||||
KEY_ADD,
|
||||
KEY_SUBTRACT,
|
||||
KEY_DIVIDE,
|
||||
KEY_F1,
|
||||
KEY_F2,
|
||||
KEY_F3,
|
||||
KEY_F4,
|
||||
KEY_F5,
|
||||
KEY_F6,
|
||||
KEY_F7,
|
||||
KEY_F8,
|
||||
KEY_F9,
|
||||
KEY_F10,
|
||||
KEY_F11,
|
||||
KEY_F12,
|
||||
KEY_NUMLOCK,
|
||||
KEY_SCROLL,
|
||||
KEY_SEPARATOR,
|
||||
KEY_OEM_1,
|
||||
KEY_OEM_2,
|
||||
KEY_OEM_3,
|
||||
KEY_OEM_4,
|
||||
KEY_OEM_5,
|
||||
KEY_OEM_6,
|
||||
KEY_OEM_7,
|
||||
KEY_OEM_PERIOD,
|
||||
KEY_OEM_PLUS,
|
||||
KEY_OEM_MINUS,
|
||||
KEY_OEM_COMMA,
|
||||
KEY_BACK,
|
||||
KEY_TAB,
|
||||
KEY_0,
|
||||
KEY_1,
|
||||
KEY_2,
|
||||
KEY_3,
|
||||
KEY_4,
|
||||
KEY_5,
|
||||
KEY_6,
|
||||
KEY_7,
|
||||
KEY_8,
|
||||
KEY_9,
|
||||
KEY_A,
|
||||
KEY_B,
|
||||
KEY_C,
|
||||
KEY_D,
|
||||
KEY_E,
|
||||
KEY_F,
|
||||
KEY_G,
|
||||
KEY_H,
|
||||
KEY_I,
|
||||
KEY_J,
|
||||
KEY_K,
|
||||
KEY_L,
|
||||
KEY_M,
|
||||
KEY_N,
|
||||
KEY_O,
|
||||
KEY_P,
|
||||
KEY_Q,
|
||||
KEY_R,
|
||||
KEY_S,
|
||||
KEY_T,
|
||||
KEY_U,
|
||||
KEY_V,
|
||||
KEY_W,
|
||||
KEY_X,
|
||||
KEY_Y,
|
||||
KEY_Z
|
||||
};
|
||||
const Keys KEY_LBUTTON = KEY_BUTTON0;
|
||||
const Keys KEY_RBUTTON = KEY_BUTTON1;
|
||||
const Keys KEY_MBUTTON = KEY_BUTTON2;
|
||||
char KeyToASCII(Keys key, bool shift);
|
||||
};
|
||||
#endif
|
||||
121
include/level.h
121
include/level.h
@@ -1,121 +0,0 @@
|
||||
#ifndef __LEVEL_H__
|
||||
#define __LEVEL_H__
|
||||
|
||||
#ifdef WIN32
|
||||
#include <windows.h> //prolly used for alot but should be removed
|
||||
#endif
|
||||
#include <string>
|
||||
#include <fstream>
|
||||
#include <cctype>
|
||||
#include <cmath>
|
||||
#include <iostream>
|
||||
#ifdef WIN32
|
||||
#include <GL/gl.h>
|
||||
#endif
|
||||
#ifdef __linux
|
||||
#include <GL/gl.h>
|
||||
#endif
|
||||
#ifdef __APPLE___
|
||||
#include <gl.h>
|
||||
#endif
|
||||
#include <cstdio> //for file I/O
|
||||
|
||||
#include "mydefs.h"
|
||||
#include "bmp.h"
|
||||
#include "tga.h"
|
||||
#include "list.h"
|
||||
#ifdef WIN32
|
||||
#include "bass.h" //for audio in windows only this should be replaced by oa_audio
|
||||
#endif
|
||||
#include "vector.h"
|
||||
#include "camera.h"
|
||||
#include "entities.h"
|
||||
#include "geometry.h"
|
||||
#include "myglFont.h"
|
||||
#include "myglTexture.h"
|
||||
#include "player.h"
|
||||
#include "strmanip.h"
|
||||
#include "keys.h"
|
||||
|
||||
using namespace std;
|
||||
using OpenArena::Triangle;
|
||||
|
||||
namespace OpenArena
|
||||
{
|
||||
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
|
||||
{
|
||||
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);
|
||||
void SetWindow(Window*);
|
||||
Window* GetWindow();
|
||||
|
||||
/*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];
|
||||
Window* _window;
|
||||
|
||||
|
||||
// private:
|
||||
void ConsolePrint(string);
|
||||
private:
|
||||
string consoleHistory[MAX_CONSOLE_HISTORY_LINES];
|
||||
string consoleOutput[MAX_CONSOLE_OUTPUT_LINES];
|
||||
string outputText[MAX_OUTPUT_TEXT_LINES];
|
||||
};
|
||||
};
|
||||
#endif
|
||||
380
include/list.h
380
include/list.h
@@ -1,380 +0,0 @@
|
||||
#ifndef __list_h__
|
||||
#define __list_h__
|
||||
|
||||
#include <cstdlib>
|
||||
|
||||
#pragma warning(disable:4715)
|
||||
|
||||
namespace OpenArena{
|
||||
typedef unsigned int LIST_ARRAY_INDEX_TYPE;
|
||||
|
||||
template <class ItemType>
|
||||
class listNode
|
||||
{
|
||||
public:
|
||||
listNode();
|
||||
ItemType data;
|
||||
listNode<ItemType>* next;
|
||||
};
|
||||
|
||||
template <class ItemType>
|
||||
class list
|
||||
{
|
||||
public:
|
||||
list();
|
||||
~list();
|
||||
list(const list&);
|
||||
|
||||
bool IsEmpty() const;
|
||||
bool IsFull() const;
|
||||
void Insert(ItemType newItem);
|
||||
void Remove(ItemType target);
|
||||
void Remove();
|
||||
ItemType Retrieve() const;
|
||||
bool PrevPosition();
|
||||
bool NextPosition();
|
||||
bool IsFirstPosition() const;
|
||||
bool IsLastPosition() const;
|
||||
void FirstPosition();
|
||||
void LastPosition();
|
||||
void Clear();
|
||||
bool Contains(ItemType) const;
|
||||
unsigned int Length();
|
||||
void operator=(const list<ItemType>&);
|
||||
ItemType operator[](LIST_ARRAY_INDEX_TYPE) const;
|
||||
ItemType& operator[](LIST_ARRAY_INDEX_TYPE);
|
||||
|
||||
private:
|
||||
listNode<ItemType>* head;
|
||||
listNode<ItemType>* tail;
|
||||
listNode<ItemType>* currPos;
|
||||
};
|
||||
|
||||
template <class ItemType>
|
||||
listNode<ItemType>::listNode()
|
||||
{
|
||||
next = NULL;
|
||||
}
|
||||
|
||||
template <class ItemType>
|
||||
list<ItemType>::list()
|
||||
{
|
||||
head = NULL;
|
||||
tail = NULL;
|
||||
currPos = NULL;
|
||||
}
|
||||
|
||||
template <class ItemType>
|
||||
list<ItemType>::~list()
|
||||
{
|
||||
currPos = NULL;
|
||||
while(head != NULL)
|
||||
{
|
||||
tail = head;
|
||||
head = head->next;
|
||||
delete tail;
|
||||
tail = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
template <class ItemType>
|
||||
list<ItemType>::list(const list<ItemType>& rtOp)
|
||||
{
|
||||
head = NULL;
|
||||
tail = NULL;
|
||||
currPos = NULL;
|
||||
|
||||
operator=(rtOp);
|
||||
}
|
||||
|
||||
template <class ItemType>
|
||||
void list<ItemType>::Clear()
|
||||
{
|
||||
while(head)
|
||||
Remove(head->data);
|
||||
}
|
||||
|
||||
template <class ItemType>
|
||||
void list<ItemType>::operator=(const list<ItemType>& rtOp)
|
||||
{
|
||||
Clear();
|
||||
|
||||
if(!rtOp.IsEmpty())
|
||||
{
|
||||
listNode<ItemType>* temp = rtOp.head->next;
|
||||
listNode<ItemType>* temp2 = NULL;
|
||||
|
||||
if(temp != NULL)
|
||||
{
|
||||
head = new listNode<ItemType>;
|
||||
head->data = rtOp.head->data;
|
||||
tail = head;
|
||||
temp2 = head;
|
||||
}
|
||||
|
||||
while (temp != NULL)
|
||||
{
|
||||
temp2->next = new listNode<ItemType>;
|
||||
temp2 = temp2->next;
|
||||
temp2->data = temp->data;
|
||||
temp = temp->next;
|
||||
}
|
||||
|
||||
tail = temp2;
|
||||
}
|
||||
}
|
||||
|
||||
template <class ItemType>
|
||||
bool list<ItemType>::IsEmpty() const
|
||||
{
|
||||
return head == NULL;
|
||||
}
|
||||
|
||||
template <class ItemType>
|
||||
bool list<ItemType>::IsFull() const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
template <class ItemType>
|
||||
void list<ItemType>::Insert(ItemType newItem)
|
||||
{
|
||||
listNode<ItemType>* temp = head;
|
||||
listNode<ItemType>* temp2 = NULL;
|
||||
|
||||
if(head == NULL)
|
||||
{
|
||||
temp = tail = head = new listNode<ItemType>;
|
||||
}
|
||||
else
|
||||
{
|
||||
if(newItem < head->data)
|
||||
{
|
||||
temp2 = head;
|
||||
temp = head = new listNode<ItemType>;
|
||||
head->next = temp2;
|
||||
temp2 = NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
//temp = head;
|
||||
while(temp->next != NULL && newItem > temp->next->data)
|
||||
{
|
||||
temp = temp->next;
|
||||
}
|
||||
temp2 = temp->next;
|
||||
temp = temp->next = new listNode<ItemType>;
|
||||
temp->next = temp2;
|
||||
temp2 = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
temp->data = newItem;
|
||||
|
||||
if(temp->next == NULL)
|
||||
{
|
||||
tail = temp;
|
||||
}
|
||||
}
|
||||
|
||||
template <class ItemType>
|
||||
void list<ItemType>::Remove(ItemType target)
|
||||
{
|
||||
if(head != NULL)
|
||||
{
|
||||
listNode<ItemType>* temp = head;
|
||||
listNode<ItemType>* temp2 = head;
|
||||
|
||||
while(temp->next != NULL && temp->data != target)
|
||||
{
|
||||
temp2 = temp;
|
||||
temp = temp->next;
|
||||
}
|
||||
|
||||
if(temp->data == target)
|
||||
{
|
||||
if(temp != head)
|
||||
{
|
||||
temp2->next = temp->next;
|
||||
delete temp;
|
||||
}
|
||||
else
|
||||
{
|
||||
if(tail == head)
|
||||
tail = NULL;
|
||||
head = head->next;
|
||||
delete temp2;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
template <class ItemType>
|
||||
bool list<ItemType>::PrevPosition()
|
||||
{
|
||||
if(currPos != head)
|
||||
{
|
||||
tail->next = currPos;
|
||||
currPos = head;
|
||||
|
||||
if(currPos != tail->next)
|
||||
{
|
||||
while(currPos->next != tail->next)
|
||||
{
|
||||
currPos = currPos->next;
|
||||
}
|
||||
}
|
||||
|
||||
tail->next = NULL;
|
||||
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
template <class ItemType>
|
||||
bool list<ItemType>::NextPosition()
|
||||
{
|
||||
if(currPos != tail)
|
||||
{
|
||||
currPos = currPos->next;
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
template <class ItemType>
|
||||
void list<ItemType>::Remove()
|
||||
{
|
||||
if(currPos != NULL)
|
||||
{
|
||||
tail->next = currPos;
|
||||
currPos = currPos->next;
|
||||
delete tail->next;
|
||||
tail->next = NULL;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
template <class ItemType>
|
||||
ItemType list<ItemType>::Retrieve() const
|
||||
{
|
||||
if(currPos != NULL)
|
||||
return currPos->data;
|
||||
}
|
||||
|
||||
template <class ItemType>
|
||||
bool list<ItemType>::IsFirstPosition() const
|
||||
{
|
||||
return currPos == head;
|
||||
}
|
||||
|
||||
template <class ItemType>
|
||||
bool list<ItemType>::IsLastPosition() const
|
||||
{
|
||||
return currPos == tail;
|
||||
}
|
||||
|
||||
template <class ItemType>
|
||||
void list<ItemType>::FirstPosition()
|
||||
{
|
||||
currPos = head;
|
||||
}
|
||||
|
||||
template <class ItemType>
|
||||
void list<ItemType>::LastPosition()
|
||||
{
|
||||
currPos = tail;
|
||||
}
|
||||
|
||||
template <class ItemType>
|
||||
ItemType list<ItemType>::operator[](LIST_ARRAY_INDEX_TYPE index) const
|
||||
{
|
||||
if(head == NULL)
|
||||
{
|
||||
//We should throw an exception here but instead I'll just return shit guess for now if somebody does this they're just fucked.
|
||||
}
|
||||
else
|
||||
{
|
||||
listNode<ItemType>* temp = head;
|
||||
LIST_ARRAY_INDEX_TYPE current;
|
||||
|
||||
for(current=0;current <index; current++)
|
||||
{
|
||||
if(temp->next == NULL)
|
||||
{
|
||||
temp->next = new listNode<ItemType>;
|
||||
}
|
||||
temp = temp->next;
|
||||
}
|
||||
return temp->data;
|
||||
}
|
||||
}
|
||||
|
||||
template <class ItemType>
|
||||
ItemType& list<ItemType>::operator[](LIST_ARRAY_INDEX_TYPE index)
|
||||
{
|
||||
if(head == NULL)
|
||||
{
|
||||
tail = currPos = head = new listNode<ItemType>;
|
||||
return (ItemType&)(head->data);
|
||||
}
|
||||
else
|
||||
{
|
||||
listNode<ItemType>* temp = head;
|
||||
LIST_ARRAY_INDEX_TYPE current;
|
||||
|
||||
for(current=0;current <index; current++)
|
||||
{
|
||||
if(temp->next == NULL)
|
||||
{
|
||||
temp->next = new listNode<ItemType>;
|
||||
}
|
||||
temp = temp->next;
|
||||
}
|
||||
return (ItemType&)(temp->data);
|
||||
}
|
||||
}
|
||||
|
||||
template <class ItemType>
|
||||
unsigned int list<ItemType>::Length()
|
||||
{
|
||||
if (head == NULL)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
int len = 1;
|
||||
listNode<ItemType> temp = head->next;
|
||||
while (temp != NULL)
|
||||
{
|
||||
temp = temp->next;
|
||||
len++;
|
||||
}
|
||||
return len;
|
||||
}
|
||||
}
|
||||
|
||||
template<class ItemType>
|
||||
bool list<ItemType>::Contains(ItemType value) const
|
||||
{
|
||||
listNode<ItemType>* temp = head;
|
||||
while(temp != NULL)
|
||||
{
|
||||
if(temp->data == value)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
temp = temp->next;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
};
|
||||
#endif
|
||||
@@ -1,62 +0,0 @@
|
||||
#ifndef __main_h__
|
||||
#define __main_h__
|
||||
|
||||
#ifdef WIN32
|
||||
#include <windows.h> // Header file for windows
|
||||
#endif
|
||||
#include <cstdio> // Header file for standard input/output
|
||||
#ifdef WIN32
|
||||
#include <GL/gl.h> // Header file for OpenGL32 library
|
||||
#include <GL/glu.h> // Header file for Glu32 library
|
||||
#endif
|
||||
#ifdef __linux
|
||||
#include <GL/gl.h> // Header file for OpenGL32 library
|
||||
#include <GL/glu.h> // Header file for Glu32 library
|
||||
#endif
|
||||
#ifdef __APPLE__
|
||||
#include <GL/gl.h> // Header file for OpenGL32 library
|
||||
#include <GL/glu.h> // Header file for Glu32 library
|
||||
#endif
|
||||
#include <math.h>
|
||||
|
||||
#include "camera.h"
|
||||
#include "level.h"
|
||||
#include "mygl.h"
|
||||
#include "worlddefs.h"
|
||||
#include "mydefs.h"
|
||||
#include "screen.h"
|
||||
#include "window.h"
|
||||
#include "vector.h"
|
||||
#pragma warning(disable: 4786)
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Variables
|
||||
|
||||
static bool keys[256]; // Array for which keys are down now
|
||||
static bool keys2[256]; // Array for which keys are were down already
|
||||
static bool active=true; // Is window active flag
|
||||
static bool fullscreen=true; // Is window fullscreen flag
|
||||
//static bool showConsole = false;// Do we need to draw the console
|
||||
static OpenArena::Vec2i g_mousePosition;
|
||||
|
||||
|
||||
|
||||
#ifdef WIN32
|
||||
static POINT mpos;
|
||||
#endif
|
||||
static float lastTime = 0.0f; // This will hold the time from the last frame
|
||||
static float currentTime;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Function Declarations
|
||||
|
||||
//This shouldn't need to be here
|
||||
//LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM); // Declaration for WndProc
|
||||
|
||||
void InitControls(); // Sets up player controls
|
||||
int InitGL(); // All setup for OpenGL goes here
|
||||
void ReSizeGLScene(GLsizei width, GLsizei height); // Resize and initialize the GL window
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
@@ -1,7 +0,0 @@
|
||||
#ifndef __mydefs_h__
|
||||
#define __mydefs_h__
|
||||
#ifdef WIN32 //This whole file is windows specific right now
|
||||
#include <windows.h>
|
||||
static HWND g_hWnd = NULL;
|
||||
#endif
|
||||
#endif
|
||||
@@ -1,40 +0,0 @@
|
||||
#ifndef __MYGL_H__
|
||||
#define __MYGL_H__
|
||||
|
||||
#ifdef WIN32
|
||||
#include <windows.h> //Remove if possible
|
||||
#include <GL/gl.h>
|
||||
#include <GL/glu.h>
|
||||
#endif
|
||||
#ifdef __linux
|
||||
#include <GL/gl.h>
|
||||
#include <GL/glu.h>
|
||||
#endif
|
||||
#ifdef __APPLE__
|
||||
#include <GL/gl.h>
|
||||
#include <GL/glu.h>
|
||||
#endif
|
||||
//#include <gl/glaux.h> //Hopefully nothing needs this remove if it works in windows
|
||||
#include <string>
|
||||
#include "datatypes.h"
|
||||
#include "screen.h"
|
||||
#include "tga.h"
|
||||
#include "bmp.h"
|
||||
#include "strmanip.h"
|
||||
#include "window.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
#ifdef WIN32
|
||||
//These this is windows specific
|
||||
static HINSTANCE hInstance; // Application instance
|
||||
#endif
|
||||
extern OpenArena::Window g_Screen;
|
||||
//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
|
||||
@@ -1,31 +0,0 @@
|
||||
#ifndef __glPrint_h__
|
||||
#define __glPrint_h__
|
||||
|
||||
#include "mygl.h"
|
||||
|
||||
namespace OpenArena
|
||||
{
|
||||
class Font
|
||||
{
|
||||
private:
|
||||
short screenWidth;
|
||||
short screenHeight;
|
||||
unsigned int base;
|
||||
GLuint 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
|
||||
@@ -1,37 +0,0 @@
|
||||
#ifndef __myglTexture_h__
|
||||
#define __myglTexture_h__
|
||||
|
||||
#include <string>
|
||||
#include "datatypes.h"
|
||||
#include "mygl.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
namespace OpenArena
|
||||
{
|
||||
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
|
||||
@@ -1,31 +0,0 @@
|
||||
#ifndef __oa_audio_h__
|
||||
#define __oa_audio_h__
|
||||
|
||||
#include "vector.h"
|
||||
|
||||
//NO REAL work is done by _init or _fini they should just call
|
||||
// Init and DeInit instead.
|
||||
void _init();
|
||||
void _fini();
|
||||
void Init();
|
||||
void DeInit();
|
||||
|
||||
namespace OpenArena
|
||||
{
|
||||
namespace Audio
|
||||
{
|
||||
class Stream
|
||||
{
|
||||
Stream();
|
||||
Stream(const char* filename);
|
||||
bool Load(const char* filename);
|
||||
void UnLoad();
|
||||
bool Play();
|
||||
bool Play3D();
|
||||
SetPosition(Vec3d position);
|
||||
Vec3d GetPosition();
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -1,18 +0,0 @@
|
||||
#ifndef __oa_game_h__
|
||||
#define __oa_game_h__
|
||||
|
||||
//NO REAL work is done by _init or _fini they should just call
|
||||
// Init and DeInit instead.
|
||||
void _init();
|
||||
void _fini();
|
||||
void Init();
|
||||
void DeInit();
|
||||
|
||||
namespace OpenArena
|
||||
{
|
||||
namespace Game
|
||||
{
|
||||
};
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -1,18 +0,0 @@
|
||||
#ifndef __oa_input_h__
|
||||
#define __oa_input_h__
|
||||
|
||||
//NO REAL work is done by _init or _fini they should just call
|
||||
// Init and DeInit instead.
|
||||
void _init();
|
||||
void _fini();
|
||||
void Init();
|
||||
void DeInit();
|
||||
|
||||
namespace OpenArena
|
||||
{
|
||||
namespace Input
|
||||
{
|
||||
};
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -1,18 +0,0 @@
|
||||
#ifndef __oa_net_h__
|
||||
#define __oa_net_h__
|
||||
|
||||
//NO REAL work is done by _init or _fini they should just call
|
||||
// Init and DeInit instead.
|
||||
void _init();
|
||||
void _fini();
|
||||
void Init();
|
||||
void DeInit();
|
||||
|
||||
namespace OpenArena
|
||||
{
|
||||
namespace Net
|
||||
{
|
||||
};
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -1,18 +0,0 @@
|
||||
#ifndef __oa_video_h__
|
||||
#define __oa_video_h__
|
||||
|
||||
//NO REAL work is done by _init or _fini they should just call
|
||||
// Init and DeInit instead.
|
||||
void _init();
|
||||
void _fini();
|
||||
void Init();
|
||||
void DeInit();
|
||||
|
||||
namespace OpenArena
|
||||
{
|
||||
namespace Video
|
||||
{
|
||||
};
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -1,9 +0,0 @@
|
||||
#ifndef __opengl_h__
|
||||
#define __opengl_h__
|
||||
|
||||
#include<windows.h>
|
||||
#include <gl/gl.h>
|
||||
#include <gl/glu.h>
|
||||
#include <gl/glaux.h>
|
||||
|
||||
#endif
|
||||
@@ -1,6 +0,0 @@
|
||||
//Rename/Move
|
||||
class WORLD_PHYSICS
|
||||
{
|
||||
public:
|
||||
WORLD_PHYSICS();
|
||||
};
|
||||
@@ -1,28 +0,0 @@
|
||||
#ifndef __PLAYER_H__
|
||||
#define __PLAYER_H__
|
||||
|
||||
#include "camera.h"
|
||||
#include "ctrls.h"
|
||||
|
||||
namespace OpenArena
|
||||
{
|
||||
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);
|
||||
|
||||
ControlScheme controls;
|
||||
Camera camera;
|
||||
|
||||
|
||||
private:
|
||||
|
||||
};
|
||||
};
|
||||
#endif
|
||||
@@ -1,34 +0,0 @@
|
||||
#ifndef __screen_h__
|
||||
#define __screen_h__
|
||||
#include <string>
|
||||
|
||||
using namespace std;
|
||||
namespace OpenArena
|
||||
{
|
||||
class Screen
|
||||
{
|
||||
public:
|
||||
Screen();
|
||||
int GetWidth();
|
||||
int GetHeight();
|
||||
int GetColorDepth();
|
||||
bool GetFullscreen();
|
||||
const char* GetName();
|
||||
void SetWidth(int);
|
||||
void SetHeight(int);
|
||||
void Resize(int, int);
|
||||
void SetColorDepth(int);
|
||||
void SetFullscreen(bool);
|
||||
void ToggleFullscreen();
|
||||
void SetName(const char*);
|
||||
void SetName(string);
|
||||
protected:
|
||||
short _width;
|
||||
short _height;
|
||||
char _colorDepth;
|
||||
bool _fullscreen;
|
||||
// public:
|
||||
string _name;
|
||||
};
|
||||
};
|
||||
#endif
|
||||
@@ -1,22 +0,0 @@
|
||||
#ifndef __strmanip_h__
|
||||
#define __strmanip_h__
|
||||
|
||||
#include <string>
|
||||
#include <cmath>
|
||||
#include "keys.h"
|
||||
#include "datatypes.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
bool Truth(string str);
|
||||
int Integer(string str);
|
||||
float Floating(string str);
|
||||
uint8 KeyName(string str);
|
||||
string KeyString(uint8);
|
||||
string Right(string, uint32);
|
||||
string Left(string, uint32);
|
||||
string tolower(string);
|
||||
string toupper(string);
|
||||
string word(string, uint32);
|
||||
|
||||
#endif
|
||||
@@ -1,14 +0,0 @@
|
||||
#ifndef __texture_h__
|
||||
#define __texture_h__
|
||||
|
||||
class TextureImage
|
||||
{
|
||||
public:
|
||||
unsigned char* data;
|
||||
unsigned int bpp;
|
||||
unsigned int sizeX;
|
||||
unsigned int sizeY;
|
||||
unsigned int type;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -1,43 +0,0 @@
|
||||
#ifndef __TGA_H__
|
||||
#define __TGA_H__
|
||||
|
||||
#pragma comment(lib, "OpenGL32.lib")
|
||||
#ifdef WIN32
|
||||
#include <windows.h> //I think this was only needed because gl.h uses it
|
||||
#include <GL/gl.h>
|
||||
#endif
|
||||
#ifdef __linux
|
||||
#include <GL/gl.h>
|
||||
#endif
|
||||
#ifdef __APPLE__
|
||||
#include <GL/gl.h>
|
||||
#endif
|
||||
#include <cstdio>
|
||||
#include <string>
|
||||
#include "texture.h"
|
||||
|
||||
namespace OpenArena{
|
||||
struct TGAHeader
|
||||
{
|
||||
GLubyte Header[12]; // File Header To Determine File Type
|
||||
};
|
||||
|
||||
struct TGA
|
||||
{
|
||||
GLubyte header[6]; // Holds The First 6 Useful Bytes Of The File
|
||||
GLuint bytesPerPixel; // Number Of BYTES Per Pixel (3 Or 4)
|
||||
GLuint imageSize; // Amount Of Memory Needed To Hold The Image
|
||||
GLuint type; // The Type Of Image, GL_RGB Or GL_RGBA
|
||||
GLuint Height; // Height Of Image
|
||||
GLuint Width; // Width Of Image
|
||||
GLuint Bpp; // Number Of BITS Per Pixel (24 Or 32)
|
||||
};
|
||||
|
||||
TextureImage* LoadTGA(const char *filename);
|
||||
|
||||
const GLubyte uTGAcompare[12] = {0,0,2, 0,0,0,0,0,0,0,0,0}; // Uncompressed TGA Header
|
||||
const GLubyte cTGAcompare[12] = {0,0,10,0,0,0,0,0,0,0,0,0}; // Compressed TGA Header
|
||||
TextureImage* LoadUncompressedTGA(FILE *); // Load an Uncompressed file
|
||||
TextureImage* LoadCompressedTGA(FILE *); // Load a Compressed file
|
||||
};
|
||||
#endif
|
||||
@@ -1,83 +0,0 @@
|
||||
#ifndef __vector_h__
|
||||
#define __vector_h__
|
||||
|
||||
#include <cmath>
|
||||
namespace OpenArena{
|
||||
class Vec3d
|
||||
{
|
||||
public:
|
||||
double x,y,z;
|
||||
Vec3d(); //Default Constructor
|
||||
Vec3d(const Vec3d&); //Copy Constructor
|
||||
Vec3d(double, double); //From an angle
|
||||
Vec3d(double, double, double); //From values
|
||||
double lengthsquared() const;
|
||||
double length() const;
|
||||
void normalize();
|
||||
Vec3d normalized() const;
|
||||
|
||||
Vec3d cross(const Vec3d&) const;
|
||||
void operator=(const Vec3d&);
|
||||
Vec3d operator*(const Vec3d&) const;
|
||||
Vec3d operator+(const Vec3d&) const;
|
||||
Vec3d operator-(const Vec3d&) const;
|
||||
Vec3d operator*(double) const;
|
||||
Vec3d operator/(double) const;
|
||||
|
||||
};
|
||||
|
||||
Vec3d Vector(double, double);
|
||||
//Vec3d Angle2Vec3f()
|
||||
class Vec2f
|
||||
{
|
||||
public:
|
||||
float x,y;
|
||||
Vec2f(); //Default Constructor
|
||||
Vec2f(const Vec2f&); //Copy Constructor
|
||||
Vec2f(double); // from an angle
|
||||
Vec2f(double, double); //from values
|
||||
|
||||
double lengthsquared() const;
|
||||
double length() const;
|
||||
void normalize();
|
||||
Vec2f normalized() const;
|
||||
|
||||
Vec2f cross(const Vec2f&) const;
|
||||
Vec2f operator=(const Vec2f&);
|
||||
Vec2f operator*(const Vec2f&) const;
|
||||
Vec2f operator+(const Vec2f&) const;
|
||||
Vec2f operator-(const Vec2f&) const;
|
||||
//Vec2f operator/(const Vec2f&) const; //Is this right?
|
||||
Vec2f operator*(double) const;
|
||||
Vec2f operator/(double) const;
|
||||
};
|
||||
|
||||
typedef Vec3d Vec3f;
|
||||
|
||||
class Vec2i
|
||||
{
|
||||
public:
|
||||
int x,y;
|
||||
Vec2i(); //Default Constructor
|
||||
Vec2i(const Vec2i&); //Copy Constructor
|
||||
Vec2i(int); // from an angle
|
||||
Vec2i(int,int); //from values
|
||||
|
||||
int lengthsquared() const;
|
||||
int length() const;
|
||||
void normalize();
|
||||
Vec2i normalized() const;
|
||||
|
||||
Vec2i cross(const Vec2i&) const;
|
||||
Vec2i operator=(const Vec2i&);
|
||||
Vec2i operator*(const Vec2i&) const;
|
||||
Vec2i operator+(const Vec2i&) const;
|
||||
Vec2i operator-(const Vec2i&) const;
|
||||
//Vec2i operator/(const Vec2i&) const; //Is this right?
|
||||
Vec2i operator*(int) const;
|
||||
Vec2i operator/(int) const;
|
||||
bool operator==(const Vec2i&) const;
|
||||
bool operator!=(const Vec2i&) const;
|
||||
};
|
||||
};
|
||||
#endif
|
||||
@@ -1,2 +0,0 @@
|
||||
//#define OPENARENA_VERSION "OpenArena: v0.1.2"
|
||||
#define OPENARENA_VERSION "OpenArena: CVS"
|
||||
113
include/window.h
113
include/window.h
@@ -1,113 +0,0 @@
|
||||
#ifndef __window_h__
|
||||
#define __window_h__
|
||||
|
||||
#include "screen.h"
|
||||
#ifdef __linux
|
||||
#include <GL/gl.h>
|
||||
#include <GL/glx.h>
|
||||
#include <X11/extensions/xf86vmode.h>
|
||||
#include <X11/keysym.h>
|
||||
#endif
|
||||
|
||||
#ifdef __APPLE__
|
||||
#include <GL/gl.h>
|
||||
#include <GL/glu.h>
|
||||
#include <GL/glx.h>
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/Xutil.h>
|
||||
//#include <X11/extensions/xf86vmode.h>
|
||||
#include <X11/keysym.h>
|
||||
#endif
|
||||
|
||||
#ifdef WIN32
|
||||
#include <windows.h>
|
||||
#include <GL/gl.h>
|
||||
#include <GL/glu.h>
|
||||
#endif
|
||||
#include "vector.h"
|
||||
|
||||
namespace OpenArena
|
||||
{
|
||||
class Window: public Screen
|
||||
{
|
||||
public:
|
||||
class Resizer
|
||||
{
|
||||
public:
|
||||
void Resize(GLsizei width, GLsizei height);
|
||||
};
|
||||
|
||||
class Initializer
|
||||
{
|
||||
public:
|
||||
int Initialize();
|
||||
};
|
||||
|
||||
public:
|
||||
Window();
|
||||
~Window();
|
||||
void Close();
|
||||
bool Open();
|
||||
bool Open(string title, int width, int height, int bits, bool fullscreenflag); //make that string a const char* after this works
|
||||
void SetInitializer(Initializer* initializer);
|
||||
void SetResizer(Resizer* resizer);
|
||||
void SwapBuffers();
|
||||
void Resize(GLsizei width, GLsizei height);
|
||||
Vec2i GetMousePosition();
|
||||
void SetMousePosition(Vec2i pos);
|
||||
|
||||
#ifdef __linux
|
||||
Display* GetDisplay();
|
||||
|
||||
private:
|
||||
Cursor CreateWindowedCursor();
|
||||
Cursor CreateFullscreenCursor();
|
||||
int screen;
|
||||
::Window window;
|
||||
GLXContext hRC;
|
||||
XSetWindowAttributes attributes;
|
||||
bool doubleBuffered;
|
||||
XF86VidModeModeInfo vidMode;
|
||||
int x, y;
|
||||
Display* display;
|
||||
#endif
|
||||
#ifdef __APPLE__
|
||||
Display* GetDisplay();
|
||||
|
||||
private:
|
||||
Cursor CreateWindowedCursor();
|
||||
Cursor CreateFullscreenCursor();
|
||||
int screen;
|
||||
::Window window;
|
||||
GLXContext hRC;
|
||||
XSetWindowAttributes attributes;
|
||||
bool doubleBuffered;
|
||||
//XF86VidModeModeInfo vidMode;
|
||||
int x, y;
|
||||
Display* display;
|
||||
#endif
|
||||
private:
|
||||
Resizer* _resizer;
|
||||
Initializer* _initializer;
|
||||
#ifdef WIN32
|
||||
HGLRC glContext;
|
||||
HWND window;
|
||||
HDC deviceContext;
|
||||
HINSTANCE instance;
|
||||
#endif
|
||||
};
|
||||
};
|
||||
|
||||
#ifdef WIN32
|
||||
LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
|
||||
#endif
|
||||
#ifdef __linux
|
||||
static int attrListSgl[] = {GLX_RGBA, GLX_RED_SIZE, 4, GLX_GREEN_SIZE, 4, GLX_BLUE_SIZE, 4, GLX_DEPTH_SIZE, 16, None};
|
||||
static int attrListDbl[] = {GLX_RGBA, GLX_DOUBLEBUFFER, GLX_RED_SIZE, 4, GLX_GREEN_SIZE, 4, GLX_BLUE_SIZE, 4, GLX_DEPTH_SIZE, 16, None};
|
||||
#endif
|
||||
#ifdef __APPLE__
|
||||
static int attrListSgl[] = {GLX_RGBA, GLX_RED_SIZE, 4, GLX_GREEN_SIZE, 4, GLX_BLUE_SIZE, 4, GLX_DEPTH_SIZE, 16, None};
|
||||
static int attrListDbl[] = {GLX_RGBA, GLX_DOUBLEBUFFER, GLX_RED_SIZE, 4, GLX_GREEN_SIZE, 4, GLX_BLUE_SIZE, 4, GLX_DEPTH_SIZE, 16, None};
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -1,8 +0,0 @@
|
||||
#ifndef __WorldDefs_h__
|
||||
#define __WorldDefs_h__
|
||||
|
||||
#include "level.h"
|
||||
|
||||
static OpenArena::Level level;
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user