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