9 //Jordan included glut.h
12 #include "TGALoader.h"
30 #include "Constants.h"
36 //#include <DrawSprocket.h>
42 extern GLuint rabbittexture;
48 typedef std::map<std::string, GLuint> TextureList;
49 typedef std::map<GLuint, std::string> GLTextureList;
50 typedef TextureList::iterator TexIter;
51 static TextureList textures;
53 GLuint terraintexture;
54 GLuint terraintexture2;
55 GLuint terraintexture3;
57 GLuint screentexture2;
59 GLuint loadscreentexture;
60 GLuint Maparrowtexture;
62 GLuint Mapcircletexture;
64 GLuint Mainmenuitems[10];
71 float selectedlong[100];
88 char menustring[100][256];
89 char registrationname[256];
90 float registrationnumber;
98 int mousecoordh,mousecoordv;
99 int oldmousecoordh,oldmousecoordv;
100 float rotation,rotation2;
103 bool cameratogglekeydown;
104 bool chattogglekeydown;
107 bool drawmodetogglekeydown;
108 bool explodetogglekeydown;
109 bool detailtogglekeydown;
129 int campaignnumlevels;
130 char campaignmapname[50][256];
131 char campaigndescription[50][256];
132 int campaignchoosenext[50];
133 int campaignnumnext[50];
134 int campaignnextlevel[50][10];
135 int campaignchoicesmade;
136 int campaignchoices[5000];
137 int campaignlocationx[50];
138 int campaignlocationy[50];
139 int campaignchoicenum;
140 int campaignchoicewhich[10];
144 int levelorder[5000];
145 int levelvisible[50];
146 int levelhighlight[50];
150 int musictype,oldmusictype,oldoldmusictype;
165 bool envtogglekeydown;
166 bool slomotogglekeydown;
167 bool texturesizetogglekeydown;
168 bool freezetogglekeydown;
174 float editorrotation;
175 float editorrotation2;
184 int numpathpointconnect[30];
185 int pathpointconnect[30][30];
186 int pathpointselected;
190 int numchallengelevels;
194 char consoletext[15][256];
195 int consolechars[15];
197 char displaytext[15][256];
198 int displaychars[15];
199 float displaytime[15];
200 float displayblinkdelay;
204 bool consoletogglekeydown;
205 float consoleblinkdelay;
209 float togglekeydelay[140];
213 unsigned short crouchkey,jumpkey,forwardkey,chatkey,backkey,leftkey,rightkey,drawkey,throwkey,attackkey;
216 long long MD5_string (char *string);
217 static void LoadTexture(char *fileName, GLuint *textureid,int mipmap, bool hasalpha);
218 static void LoadTextureSave(char *fileName, GLuint *textureid,int mipmap,GLubyte *array, int *skinsize);
219 void LoadSave(char *fileName, GLuint *textureid,bool mipmap,GLubyte *array, int *skinsize);
220 bool AddClothes(char *fileName, GLuint *textureid,bool mipmap,GLubyte *array, int *skinsize);
223 void LoadingScreen();
224 void FadeLoadingScreen(float howmuch);
226 int DrawGLScene(GLvoid);
229 void TickOnceAfter();
230 void SetUpLighting();
231 void Loadlevel(int which);
232 void Loadlevel(char *name);
234 void Setenvironment(int which);
235 GLvoid ReSizeGLScene(float fov, float near);
236 int findPathDist(int start,int end);
237 int checkcollide(XYZ startpoint, XYZ endpoint);
238 int checkcollide(XYZ startpoint, XYZ endpoint, int what);
250 float musicvolume[4];
251 float oldmusicvolume[4];
256 for(int i=0;i<10;i++){
257 if(Mainmenuitems[i])glDeleteTextures( 1, &Mainmenuitems[i] );
259 glDeleteTextures( 1, &cursortexture );
260 glDeleteTextures( 1, &Maparrowtexture );
261 glDeleteTextures( 1, &Mapboxtexture );
262 glDeleteTextures( 1, &Mapcircletexture );
263 glDeleteTextures( 1, &terraintexture );
264 glDeleteTextures( 1, &terraintexture2 );
265 if(screentexture>0)glDeleteTextures( 1, &screentexture );
266 if(screentexture2>0)glDeleteTextures( 1, &screentexture2 );
267 glDeleteTextures( 1, &hawktexture );
268 glDeleteTextures( 1, &logotexture );
269 glDeleteTextures( 1, &loadscreentexture );
276 #ifndef __forceinline
278 # define __forceinline inline __attribute__((always_inline))
282 static __forceinline void swap_gl_buffers(void)
288 SDL_GL_SwapBuffers();
289 #elif PLATFORM_MACOSX
290 extern AGLContext gaglContext;
291 aglSwapBuffers(gaglContext);
293 #error define your platform.
298 #define LONGLONGCONST(x) (x##ll)
300 #define LONGLONGCONST(x) (x)
303 extern "C" { void UndefinedSymbolToExposeStubbedCode(void); }
304 //#define STUBBED(x) UndefinedSymbolToExposeStubbedCode();
305 #define STUBBED(x) { static bool seen = false; if (!seen) { seen = true; fprintf(stderr, "STUBBED: %s at %s:%d\n", x, __FILE__, __LINE__); } }