9 //Jordan included glut.h
12 #include "TGALoader.h"
27 #include "Constants.h"
33 //#include <DrawSprocket.h>
39 extern GLuint rabbittexture;
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;
59 GLuint terraintexture;
60 GLuint terraintexture2;
61 GLuint terraintexture3;
63 GLuint screentexture2;
65 GLuint loadscreentexture;
66 GLuint Maparrowtexture;
68 GLuint Mapcircletexture;
70 GLuint Mainmenuitems[10];
77 float selectedlong[100];
94 char menustring[100][256];
95 char registrationname[256];
96 float registrationnumber;
104 int mousecoordh,mousecoordv;
105 int oldmousecoordh,oldmousecoordv;
106 float rotation,rotation2;
109 bool cameratogglekeydown;
110 bool chattogglekeydown;
113 bool drawmodetogglekeydown;
114 bool explodetogglekeydown;
115 bool detailtogglekeydown;
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];
150 int levelorder[5000];
151 int levelvisible[50];
152 int levelhighlight[50];
156 int musictype,oldmusictype,oldoldmusictype;
171 bool envtogglekeydown;
172 bool slomotogglekeydown;
173 bool texturesizetogglekeydown;
174 bool freezetogglekeydown;
180 float editorrotation;
181 float editorrotation2;
190 int numpathpointconnect[30];
191 int pathpointconnect[30][30];
192 int pathpointselected;
196 int numchallengelevels;
200 char consoletext[15][256];
201 int consolechars[15];
203 char displaytext[15][256];
204 int displaychars[15];
205 float displaytime[15];
206 float displayblinkdelay;
210 bool consoletogglekeydown;
211 float consoleblinkdelay;
215 float togglekeydelay[140];
219 unsigned short crouchkey,jumpkey,forwardkey,chatkey,backkey,leftkey,rightkey,drawkey,throwkey,attackkey;
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);
229 void LoadingScreen();
230 void FadeLoadingScreen(float howmuch);
232 int DrawGLScene(GLvoid);
235 void TickOnceAfter();
236 void SetUpLighting();
237 void Loadlevel(int which);
238 void Loadlevel(char *name);
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);
256 float musicvolume[4];
257 float oldmusicvolume[4];
262 for(int i=0;i<10;i++){
263 if(Mainmenuitems[i])glDeleteTextures( 1, &Mainmenuitems[i] );
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 );
282 #ifndef __forceinline
284 # define __forceinline inline __attribute__((always_inline))
288 static __forceinline void swap_gl_buffers(void)
294 SDL_GL_SwapBuffers();
295 #elif PLATFORM_MACOSX
296 extern AGLContext gaglContext;
297 aglSwapBuffers(gaglContext);
299 #error define your platform.
304 #define LONGLONGCONST(x) (x##ll)
306 #define LONGLONGCONST(x) (x)