*** empty log message ***

This commit is contained in:
2003-10-15 00:57:23 -04:00
parent 143c82175e
commit 4c6f5dfb15
69 changed files with 8788 additions and 0 deletions

1221
include/bass.h Normal file

File diff suppressed because it is too large Load Diff

11
include/bmp.h Normal file
View File

@@ -0,0 +1,11 @@
#ifndef __bmp_h__
#define __bmp_h__
#include <gl/glaux.h>
#include <stdio.h>
#include "texture.h"
//AUX_RGBImageRec *LoadBMP(const char *Filename);
TextureImage* LoadBMP(const char* Filename);
#endif

88
include/camera.h Normal file
View File

@@ -0,0 +1,88 @@
#ifndef __camera_h__
#define __camera_h__
#include <cmath>
#include <windows.h>
#include "vector.h"
#include "myGl.h"
#include "screen.h"
class CameraClass
{
public:
//Constructors
CameraClass(); //Default Constructor
//Purpose:
//
//CameraClass(const CameraClass&); //Copy Constructor
//Purpose:
//
//Observer Accessors
Vec3f Position();
//Purpose:
//
Vec3f View();
//Purpose:
//
Vec3f UpVector();
//Purpose:
//
Vec3f Strafe();
//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:
//
private:
Vec3f m_vPosition;
Vec3f m_vView;
Vec3f m_vUpVector;
Vec3f m_vStrafe;
};
#endif

14
include/critter.h Normal file
View File

@@ -0,0 +1,14 @@
#ifndef __critter_h__
#define __critter_h__
#include "md3.h"
class CRITTER
{
public:
MD3_MODEL model;
};
#endif

33
include/ctrls.h Normal file
View File

@@ -0,0 +1,33 @@
#include "physics.h"
#include "datatypes.h"
#include "list.h"
#include <windows.h>
class ControlSchemeClass
{
public:
void LoadDefaultControlScheme();
void ClearControlScheme();
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;
};

28
include/datatypes.h Normal file
View File

@@ -0,0 +1,28 @@
#ifndef __datatypes_h__
#define __datatypes_h__
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

58
include/entities.h Normal file
View File

@@ -0,0 +1,58 @@
using namespace std;
struct LIGHT
{
GLfloat coords[4];
GLfloat color[4];
};
struct PLAYER_START
{
Vec3f coords;
Vec3f heading;
};
struct PLAYER_DEATHMATCH_START
{
Vec3f coords;
Vec3f heading;
};
struct BOT_START
{
Vec3f coords;
Vec3f heading;
string name;
};
struct GEOMETRY
{
int x;
};
struct PROJECTILE
{
Vec3f heading;
Vec3f start;
Vec3f 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

30
include/entity.h Normal file
View File

@@ -0,0 +1,30 @@
#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

35
include/geometry.h Normal file
View File

@@ -0,0 +1,35 @@
#include "vector.h"
#include "myglTexture.h"
struct TRIANGLE
{
GL_MY_TEXTURE texture;
uint32 texID;
Vec3f vertecies[3];
Vec2f texCoords[3];
Vec3f normal;
};
class POSITION
{
public:
GLfloat xrot; // X rotation
GLfloat yrot; // Y rotation
GLfloat zrot; // Z rotation
GLfloat xtrans; // X translation
GLfloat ytrans; // Y translation
GLfloat ztrans; // Z translation
bool stepRight;
bool stepLeft;
POSITION()
{
xtrans = 0.0f;
ytrans = 0.0f;
ztrans = 0.0f;
xrot = 0.0f;
yrot = 0.0f;
zrot = 0.0f;
}
private:
};

99
include/level.h Normal file
View File

@@ -0,0 +1,99 @@
#ifndef __LEVEL_H__
#define __LEVEL_H__
#include <windows.h>
#include <string>
#include <fstream>
#include <cctype>
#include <cmath>
#include <iostream>
#include <gl/gl.h>
#include <gl/glu.h>
#include <gl/glaux.h> //for auxDIBImageLoad
#include <stdio.h> //for file I/O
#include "mydefs.h"
#include "bmp.h"
#include "tga.h"
#include "list.h"
#include "bass.h"
#include "vector.h"
#include "camera.h"
#include "entities.h"
#include "geometry.h"
#include "myglFont.h"
#include "myglTexture.h"
#include "player.h"
#include "strmanip.h"
using namespace std;
const float piover180 = 0.0174532925f;
const string DEFAULT_TEXTURE_NAME = "oa/textures/default.tga";
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
enum {GL_MY_TEXTURE_CONSOLEBACKGROUND=0, NUM_MENU_TEXTURES};
class LEVEL
{
public:
LEVEL();
~LEVEL();
bool LoadMap(string mapname);
void 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();
uint32 FPS();
void ParseCmds(LPSTR);
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;
string bgm;
HSTREAM bgmStream;
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];
private:
string consoleHistory[MAX_CONSOLE_HISTORY_LINES];
};
#endif

246
include/list.cpp Normal file
View File

@@ -0,0 +1,246 @@
/*
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();
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()
{
return head == NULL;
}
template <class ItemType>
bool list<ItemType>::IsFull()
{
return false;
}
template <class ItemType>
void list<ItemType>::Insert(ItemType newItem)
{
listNode<ItemType>* temp = head;
if(head != NULL)
{
while(temp->next!= NULL && temp->data < newItem)
{
temp = temp->next;
}
if(temp == head)
{
tail->next = head;
head = new listNode<ItemType>;
head->next = tail->next;
tail->next = NULL;
temp = head;
}
else if(temp->data != newItem)
{
if(temp == tail)
{
tail->next = new listNode<ItemType>;
tail = tail->next;
temp = tail;
}
else
{
tail->next = temp->next;
temp = temp->next = new listNode<ItemType>;
temp->next = tail->next;
tail->next = NULL;
}
}
}
else
{
temp = tail = head = new listNode<ItemType>;
tail->next = NULL;
}
temp->data = newItem;
}
template <class ItemType>
void list<ItemType>::Remove(ItemType target)
{
if(head != NULL)
{
listNode<ItemType>* temp = head;
tail->next = head;
while(temp->next != NULL && temp->data != target)
{
tail->next = temp;
temp = temp->next;
}
if(temp->data == target)
{
if(tail->next != head)
{
tail->next->next = temp->next;
delete temp;
}
else
{
head = head->next;
delete tail->next;
}
}
tail->next = NULL;
}
}
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()
{
if(currPos != NULL)
return currPos->data;
}
template <class ItemType>
bool list<ItemType>::IsFirstPosition()
{
return currPos == head;
}
template <class ItemType>
bool list<ItemType>::IsLastPosition()
{
return currPos == tail;
}
template <class ItemType>
void list<ItemType>::FirstPosition()
{
currPos = head;
}
template <class ItemType>
void list<ItemType>::LastPosition()
{
currPos = tail;
}
*/

312
include/list.h Normal file
View File

@@ -0,0 +1,312 @@
#ifndef __list_h__
#define __list_h__
#include <cstdlib>
#pragma warning(disable:4715)
template <class ItemType>
class listNode
{
public:
listNode();
listNode<ItemType>* next;
ItemType data;
};
template <class ItemType>
class list
{
public:
list();
~list();
list(const list&);
bool IsEmpty();
bool IsFull();
void Insert(ItemType newItem);
void Remove(ItemType target);
void Remove();
ItemType Retrieve();
bool PrevPosition();
bool NextPosition();
bool IsFirstPosition();
bool IsLastPosition();
void FirstPosition();
void LastPosition();
void Clear();
void operator=(const list<ItemType>&);
ItemType operator[](unsigned int);
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();
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()
{
return head == NULL;
}
template <class ItemType>
bool list<ItemType>::IsFull()
{
return false;
}
template <class ItemType>
void list<ItemType>::Insert(ItemType newItem)
{
listNode<ItemType>* temp = head;
if(head != NULL)
{
while(temp->next!= NULL && temp->data < newItem)
{
temp = temp->next;
}
if(temp == head)
{
tail->next = head;
head = new listNode<ItemType>;
head->next = tail->next;
tail->next = NULL;
temp = head;
}
else if(temp->data != newItem)
{
if(temp == tail)
{
tail->next = new listNode<ItemType>;
tail = tail->next;
temp = tail;
}
else
{
tail->next = temp->next;
temp = temp->next = new listNode<ItemType>;
temp->next = tail->next;
tail->next = NULL;
}
}
}
else
{
temp = tail = head = new listNode<ItemType>;
tail->next = NULL;
}
temp->data = newItem;
}
template <class ItemType>
void list<ItemType>::Remove(ItemType target)
{
if(head != NULL)
{
listNode<ItemType>* temp = head;
tail->next = head;
while(temp->next != NULL && temp->data != target)
{
tail->next = temp;
temp = temp->next;
}
if(temp->data == target)
{
if(tail->next != head)
{
tail->next->next = temp->next;
delete temp;
}
else
{
head = head->next;
delete tail->next;
}
}
tail->next = NULL;
}
}
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()
{
if(currPos != NULL)
return currPos->data;
}
template <class ItemType>
bool list<ItemType>::IsFirstPosition()
{
return currPos == head;
}
template <class ItemType>
bool list<ItemType>::IsLastPosition()
{
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[](unsigned int index)
{
if(head != NULL)
{
listNode<ItemType>* temp = head;
while(index > 0 && temp != NULL)
{
temp = temp->next;
--index;
}
if(temp != NULL)
{
return temp->data;
}
}
}
#include "list.cpp"
#endif

43
include/main.h Normal file
View File

@@ -0,0 +1,43 @@
#ifndef __main_h__
#define __main_h__
#include <windows.h> // Header file for windows
#include <stdio.h> // Header file for standard input/output
#include <gl\gl.h> // Header file for OpenGL32 library
#include <gl\glu.h> // Header file for Glu32 library
#include <gl\glaux.h> // Header file for GLaux library
#include <math.h>
#include "camera.h"
#include "level.h"
#include "myGL.h"
#include "WorldDefs.h"
#include "mydefs.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 SCREEN g_Screen = {800,600,16,1,"OpenArena"};
static POINT mpos;
static float lastTime = 0.0f; // This will hold the time from the last frame
static float currentTime;
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Function Declarations
LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM); // Declaration for WndProc
void InitControls(); // Sets up player controls
int InitGL(); // All setup for OpenGL goes here
GLvoid ReSizeGLScene(GLsizei width, GLsizei height); // Resize and initialize the GL window
GLvoid KillGLWindow(GLvoid); //Properly kill the window
bool CreateGLWindow(string title, int width, int height, int bits, bool fullscreenflag);
#endif

8
include/mydefs.h Normal file
View File

@@ -0,0 +1,8 @@
#ifndef __mydefs_h__
#define __mydefs_h__
#include <windows.h>
static HWND g_hWnd = NULL;
#endif

25
include/mygl.h Normal file
View File

@@ -0,0 +1,25 @@
#ifndef __MYGL_H__
#define __MYGL_H__
#include <windows.h>
#include <gl/gl.h>
#include <gl/glu.h>
#include <gl/glaux.h>
#include <string>
#include "screen.h"
#include "tga.h"
#include "bmp.h"
#include "strmanip.h"
using namespace std;
static HDC hDC=NULL; // Private GDI device context
static HGLRC hRC=NULL; // Permanent rendering context
static HINSTANCE hInstance; // Application instance
static SCREEN g_Screen;
int InitGL(GLvoid);
bool LoadGLTexture(string , unsigned int&, int = GL_LINEAR, int = GL_LINEAR);
void FreeGLTexture(unsigned int&);
#endif

29
include/myglFont.h Normal file
View File

@@ -0,0 +1,29 @@
#ifndef __glPrint_h__
#define __glPrint_h__
#include "myGL.h"
class GLFontClass
{
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 Status();
void SetScreenDimensions(short, short);
void SetScreenWidth(short);
void SetScreenHeight(short);
short ScreenWidth();
short ScreenHeight();
};
#endif

35
include/myglTexture.h Normal file
View File

@@ -0,0 +1,35 @@
#ifndef __myglTexture_h__
#define __myglTexture_h__
#include <string>
#include "datatypes.h"
#include "myGL.h"
using namespace std;
class GL_MY_TEXTURE
{
public:
GL_MY_TEXTURE();
~GL_MY_TEXTURE();
string Filename();
uint32 ID();
bool Load(string filename);
bool Load(string filename, uint32 min, uint32 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:
uint32 minFilter;
uint32 magFilter;
string filename;
uint32 id;
};
#endif

9
include/opengl.h Normal file
View File

@@ -0,0 +1,9 @@
#ifndef __opengl_h__
#define __opengl_h__
#include<windows.h>
#include <gl/gl.h>
#include <gl/glu.h>
#include <gl/glaux.h>
#endif

5
include/physics.h Normal file
View File

@@ -0,0 +1,5 @@
class WORLD_PHYSICS
{
public:
WORLD_PHYSICS();
};

27
include/player.h Normal file
View File

@@ -0,0 +1,27 @@
#ifndef __PLAYER_H__
#define __PLAYER_H__
#include "camera.h"
#include "ctrls.h"
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;
CameraClass camera;
private:
};
#endif

28
include/screen.h Normal file
View File

@@ -0,0 +1,28 @@
#ifndef __screen_h__
#define __screen_h__
#include <string>
using namespace std;
class SCREEN
{
public:
SCREEN()
{
width=640;
height=480;
bpp=16;
fullscreen=false;
name = "";
}
short width;
short height;
char bpp;
bool fullscreen;
string name;
};
#endif

23
include/strmanip.h Normal file
View File

@@ -0,0 +1,23 @@
#ifndef __strmanip_h__
#define __strmanip_h__
#include <string>
#include <cmath>
#include <windows.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

13
include/texture.h Normal file
View File

@@ -0,0 +1,13 @@
#ifndef __texture_h__
#define __texture_h__
struct TextureImage
{
unsigned char* data;
unsigned int bpp;
unsigned int sizeX;
unsigned int sizeY;
unsigned int type;
};
#endif

35
include/tga.h Normal file
View File

@@ -0,0 +1,35 @@
#ifndef __TGA_H__
#define __TGA_H__
#pragma comment(lib, "OpenGL32.lib")
#include <windows.h>
#include <gl\gl.h>
#include <stdio.h>
#include <string>
#include "texture.h"
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

57
include/vector.h Normal file
View File

@@ -0,0 +1,57 @@
#ifndef __vector_h__
#define __vector_h__
#include <cmath>
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;
#endif

8
include/worlddefs.h Normal file
View File

@@ -0,0 +1,8 @@
#ifndef __WorldDefs_h__
#define __WorldDefs_h__
#include "level.h"
static LEVEL level;
#endif