]> git.jsancho.org Git - lugaru.git/blob - Source/Game.h
Initial import.
[lugaru.git] / Source / Game.h
1 #ifndef _GAME_H_
2 #define _GAME_H_
3
4 #ifndef WIN32
5 #include <Carbon.h>
6 #include "Quicktime.h"
7 #endif
8 //Jordan included glut.h
9 //#include <glut.h>
10
11 #include "TGALoader.h"
12 #ifdef WIN32
13 #include "WinInput.h"
14 #else
15 #include "Macinput.h"
16 #endif
17 #include "Terrain.h"
18 #include "Skybox.h"
19 #include "Skeleton.h"
20 #include "Models.h"   
21 #include "Lights.h"
22 #include "Person.h"
23 #include "Constants.h"
24 #include "fmod.h"
25 #include "Sprites.h"
26 //#include <agl.h>
27 #include "Text.h"
28 #include "Objects.h"
29 //#include <DrawSprocket.h>
30 #include "Weapons.h"
31 #include "binio.h"
32 #include <fstream>
33 #include "gl.h"
34
35 extern GLuint rabbittexture;
36
37
38 class Game              
39 {
40 public:
41
42         typedef std::map<std::string, GLuint> TextureList;
43         typedef std::map<GLuint, std::string> GLTextureList;
44         typedef TextureList::iterator TexIter;
45         static TextureList textures;
46
47         GLuint terraintexture;
48         GLuint terraintexture2;
49         GLuint terraintexture3;
50         GLuint screentexture;
51         GLuint screentexture2;
52         GLuint logotexture;
53         GLuint loadscreentexture;
54         GLuint Maparrowtexture;
55         GLuint Mapboxtexture;
56         GLuint Mapcircletexture;
57         GLuint cursortexture;
58         GLuint Mainmenuitems[10];
59
60         int nummenuitems;
61         int startx[100];
62         int starty[100];
63         int endx[100];
64         int endy[100];
65         float selectedlong[100];
66         float offsetx[100];
67         float offsety[100];
68         float movex[100];
69         float movey[100];
70         float transition;
71         int anim;
72         int selected;
73         int loaddistrib;
74         int keyselect;
75         int indemo;
76         int registered;
77
78         bool won;
79
80         bool entername;
81
82         char menustring[100][256];
83         char registrationname[256];
84         float registrationnumber;
85
86         int newdetail;
87         int newscreenwidth;
88         int newscreenheight;
89
90         bool gameon;
91         float deltah,deltav;
92         int mousecoordh,mousecoordv;
93         int oldmousecoordh,oldmousecoordv;
94         float rotation,rotation2;
95         SkyBox skybox;
96         bool cameramode;
97         bool cameratogglekeydown;
98         bool chattogglekeydown;
99         int olddrawmode;
100         int drawmode;
101         bool drawmodetogglekeydown;
102         bool explodetogglekeydown;
103         bool detailtogglekeydown;
104         bool firstload;
105         bool oldbutton;
106
107         float leveltime;
108         float loadtime;
109
110         Model hawk;
111         XYZ hawkcoords;
112         XYZ realhawkcoords;
113         GLuint hawktexture;
114         float hawkrotation;
115         float hawkcalldelay;
116
117         Model eye;
118         Model iris;
119         Model cornea;
120
121         bool stealthloading;
122
123         int campaignnumlevels;
124         char campaignmapname[50][256];
125         char campaigndescription[50][256];
126         int campaignchoosenext[50];
127         int campaignnumnext[50];
128         int campaignnextlevel[50][10];
129         int campaignchoicesmade;
130         int campaignchoices[5000];
131         int campaignlocationx[50];
132         int campaignlocationy[50];
133         int campaignchoicenum;
134         int campaignchoicewhich[10];
135         int whichchoice;
136
137         int numlevelspassed;
138         int levelorder[5000];
139         int levelvisible[50];
140         int levelhighlight[50];
141
142         bool minimap;
143
144         int musictype,oldmusictype,oldoldmusictype;
145         bool realthreat;
146
147         Model rabbit;
148         XYZ rabbitcoords;
149
150         XYZ mapcenter;
151         float mapradius;
152
153         Text text;
154         float fps;
155
156         XYZ cameraloc;
157         float cameradist;
158
159         bool envtogglekeydown;
160         bool slomotogglekeydown;
161         bool texturesizetogglekeydown;
162         bool freezetogglekeydown;
163         int drawtoggle;
164
165         bool editorenabled;
166         int editortype;
167         float editorsize;
168         float editorrotation;
169         float editorrotation2;
170
171         float brightness;
172
173         int quit;
174         int tryquit;
175
176         XYZ pathpoint[30];
177         int numpathpoints;
178         int numpathpointconnect[30];
179         int pathpointconnect[30][30];
180         int pathpointselected;
181
182         int endgame;
183         bool scoreadded;
184         int numchallengelevels;
185
186         bool console;
187         int archiveselected;
188         char consoletext[15][256];
189         int consolechars[15];
190         bool chatting;
191         char displaytext[15][256];
192         int displaychars[15];
193         float displaytime[15];
194         float displayblinkdelay;
195         bool displayblink;
196         int displayselected;
197         bool consolekeydown;
198         bool consoletogglekeydown;
199         float consoleblinkdelay;
200         bool consoleblink;
201         int consoleselected;
202         int togglekey[140];
203         float togglekeydelay[140];
204         bool registernow;
205         bool autocam;
206
207         unsigned short crouchkey,jumpkey,forwardkey,chatkey,backkey,leftkey,rightkey,drawkey,throwkey,attackkey;
208         bool oldattackkey;
209
210         long long MD5_string (char *string);
211         static void LoadTexture(char *fileName, GLuint *textureid,int mipmap, bool hasalpha);
212         static void LoadTextureSave(char *fileName, GLuint *textureid,int mipmap,GLubyte *array, int *skinsize);
213         void LoadSave(char *fileName, GLuint *textureid,bool mipmap,GLubyte *array, int *skinsize);
214         bool AddClothes(char *fileName, GLuint *textureid,bool mipmap,GLubyte *array, int *skinsize);
215         void InitGame();
216         void LoadStuff();
217         void LoadingScreen();
218         void FadeLoadingScreen(float howmuch);
219         void Dispose();
220         int DrawGLScene(GLvoid);
221         void Tick();
222         void TickOnce();
223         void TickOnceAfter();
224         void SetUpLighting();
225         void Loadlevel(int which);
226         void Loadlevel(char *name);
227         void LoadSounds();
228         void Setenvironment(int which);
229         GLvoid ReSizeGLScene(float fov, float near);
230         int findPathDist(int start,int end);
231         int checkcollide(XYZ startpoint, XYZ endpoint);
232         int checkcollide(XYZ startpoint, XYZ endpoint, int what);
233         int loading;
234         float talkdelay;
235
236         int numboundaries;
237         XYZ boundary[360];
238
239         int whichlevel;
240         int oldenvironment;
241         int targetlevel;
242         float changedelay;
243
244         float musicvolume[4];
245         float oldmusicvolume[4];
246         int musicselected;
247         int change;
248         Game();
249         ~Game() {               
250                 for(int i=0;i<10;i++){
251                         if(Mainmenuitems[i])glDeleteTextures( 1, (const unsigned long *)&Mainmenuitems[i] );
252                 }
253                 glDeleteTextures( 1, (const unsigned long *)&cursortexture );
254                 glDeleteTextures( 1, (const unsigned long *)&Maparrowtexture );
255                 glDeleteTextures( 1, (const unsigned long *)&Mapboxtexture );
256                 glDeleteTextures( 1, (const unsigned long *)&Mapcircletexture );
257                 glDeleteTextures( 1, (const unsigned long *)&terraintexture );
258                 glDeleteTextures( 1, (const unsigned long *)&terraintexture2 );
259                 if(screentexture>0)glDeleteTextures( 1, (const unsigned long *)&screentexture );
260                 if(screentexture2>0)glDeleteTextures( 1, (const unsigned long *)&screentexture2 );
261                 glDeleteTextures( 1, (const unsigned long *)&hawktexture );
262                 glDeleteTextures( 1, (const unsigned long *)&logotexture );
263                 glDeleteTextures( 1, (const unsigned long *)&loadscreentexture );
264
265                 Dispose();
266         }
267
268 };
269
270 #endif