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