9 //Jordan included glut.h
12 #include "TGALoader.h"
27 #include "Constants.h"
33 //#include <DrawSprocket.h>
39 extern GLuint rabbittexture;
45 typedef std::map<std::string, GLuint> TextureList;
46 typedef std::map<GLuint, std::string> GLTextureList;
47 typedef TextureList::iterator TexIter;
48 static TextureList textures;
50 GLuint terraintexture;
51 GLuint terraintexture2;
52 GLuint terraintexture3;
54 GLuint screentexture2;
56 GLuint loadscreentexture;
57 GLuint Maparrowtexture;
59 GLuint Mapcircletexture;
61 GLuint Mainmenuitems[10];
68 float selectedlong[100];
85 char menustring[100][256];
86 char registrationname[256];
87 float registrationnumber;
95 int mousecoordh,mousecoordv;
96 int oldmousecoordh,oldmousecoordv;
97 float rotation,rotation2;
100 bool cameratogglekeydown;
101 bool chattogglekeydown;
104 bool drawmodetogglekeydown;
105 bool explodetogglekeydown;
106 bool detailtogglekeydown;
126 int campaignnumlevels;
127 char campaignmapname[50][256];
128 char campaigndescription[50][256];
129 int campaignchoosenext[50];
130 int campaignnumnext[50];
131 int campaignnextlevel[50][10];
132 int campaignchoicesmade;
133 int campaignchoices[5000];
134 int campaignlocationx[50];
135 int campaignlocationy[50];
136 int campaignchoicenum;
137 int campaignchoicewhich[10];
141 int levelorder[5000];
142 int levelvisible[50];
143 int levelhighlight[50];
147 int musictype,oldmusictype,oldoldmusictype;
162 bool envtogglekeydown;
163 bool slomotogglekeydown;
164 bool texturesizetogglekeydown;
165 bool freezetogglekeydown;
171 float editorrotation;
172 float editorrotation2;
181 int numpathpointconnect[30];
182 int pathpointconnect[30][30];
183 int pathpointselected;
187 int numchallengelevels;
191 char consoletext[15][256];
192 int consolechars[15];
194 char displaytext[15][256];
195 int displaychars[15];
196 float displaytime[15];
197 float displayblinkdelay;
201 bool consoletogglekeydown;
202 float consoleblinkdelay;
206 float togglekeydelay[140];
210 unsigned short crouchkey,jumpkey,forwardkey,chatkey,backkey,leftkey,rightkey,drawkey,throwkey,attackkey;
213 long long MD5_string (char *string);
214 static void LoadTexture(char *fileName, GLuint *textureid,int mipmap, bool hasalpha);
215 static void LoadTextureSave(char *fileName, GLuint *textureid,int mipmap,GLubyte *array, int *skinsize);
216 void LoadSave(char *fileName, GLuint *textureid,bool mipmap,GLubyte *array, int *skinsize);
217 bool AddClothes(char *fileName, GLuint *textureid,bool mipmap,GLubyte *array, int *skinsize);
220 void LoadingScreen();
221 void FadeLoadingScreen(float howmuch);
223 int DrawGLScene(GLvoid);
226 void TickOnceAfter();
227 void SetUpLighting();
228 void Loadlevel(int which);
229 void Loadlevel(char *name);
231 void Setenvironment(int which);
232 GLvoid ReSizeGLScene(float fov, float near);
233 int findPathDist(int start,int end);
234 int checkcollide(XYZ startpoint, XYZ endpoint);
235 int checkcollide(XYZ startpoint, XYZ endpoint, int what);
247 float musicvolume[4];
248 float oldmusicvolume[4];
253 for(int i=0;i<10;i++){
254 if(Mainmenuitems[i])glDeleteTextures( 1, &Mainmenuitems[i] );
256 glDeleteTextures( 1, &cursortexture );
257 glDeleteTextures( 1, &Maparrowtexture );
258 glDeleteTextures( 1, &Mapboxtexture );
259 glDeleteTextures( 1, &Mapcircletexture );
260 glDeleteTextures( 1, &terraintexture );
261 glDeleteTextures( 1, &terraintexture2 );
262 if(screentexture>0)glDeleteTextures( 1, &screentexture );
263 if(screentexture2>0)glDeleteTextures( 1, &screentexture2 );
264 glDeleteTextures( 1, &hawktexture );
265 glDeleteTextures( 1, &logotexture );
266 glDeleteTextures( 1, &loadscreentexture );
273 #ifndef __forceinline
275 # define __forceinline inline __attribute__((always_inline))
279 static __forceinline void swap_gl_buffers(void)
285 SDL_GL_SwapBuffers();
286 #elif PLATFORM_MACOSX
287 extern AGLContext gaglContext;
288 aglSwapBuffers(gaglContext);
290 #error define your platform.
295 #define LONGLONGCONST(x) (x##ll)
297 #define LONGLONGCONST(x) (x)