2 Copyright (C) 2003, 2010 - Wolfire Games
4 This file is part of Lugaru.
6 Lugaru is free software; you can redistribute it and/or
7 modify it under the terms of the GNU General Public License
8 as published by the Free Software Foundation; either version 2
9 of the License, or (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
15 See the GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
27 #if (defined(__APPLE__) && defined(__MACH__))
28 # ifdef PLATFORM_MACOSX
29 # error Do not define PLATFORM_MACOSX for new builds. It is for the old Carbonized build.
33 #ifdef PLATFORM_MACOSX
35 #include "Quicktime.h"
38 //Jordan included glut.h
41 #include "TGALoader.h"
55 #include "Constants.h"
60 //#include <DrawSprocket.h>
66 extern GLuint rabbittexture;
72 typedef std::map<std::string, GLuint> TextureList;
73 typedef std::map<GLuint, std::string> GLTextureList;
74 typedef TextureList::iterator TexIter;
75 static TextureList textures;
77 GLuint terraintexture;
78 GLuint terraintexture2;
79 GLuint terraintexture3;
81 GLuint screentexture2;
83 GLuint loadscreentexture;
84 GLuint Maparrowtexture;
86 GLuint Mapcircletexture;
88 GLuint Mainmenuitems[10];
95 float selectedlong[100];
111 char menustring[100][256];
112 char registrationname[256];
113 float registrationnumber;
121 int mousecoordh,mousecoordv;
122 int oldmousecoordh,oldmousecoordv;
123 float rotation,rotation2;
126 bool cameratogglekeydown;
127 bool chattogglekeydown;
130 bool drawmodetogglekeydown;
131 bool explodetogglekeydown;
132 bool detailtogglekeydown;
152 int campaignnumlevels;
153 char campaignmapname[50][256];
154 char campaigndescription[50][256];
155 int campaignchoosenext[50];
156 int campaignnumnext[50];
157 int campaignnextlevel[50][10];
158 int campaignchoicesmade;
159 int campaignchoices[5000];
160 int campaignlocationx[50];
161 int campaignlocationy[50];
162 int campaignchoicenum;
163 int campaignchoicewhich[10];
167 int levelorder[5000];
168 int levelvisible[50];
169 int levelhighlight[50];
173 int musictype,oldmusictype,oldoldmusictype;
188 bool envtogglekeydown;
189 bool slomotogglekeydown;
190 bool texturesizetogglekeydown;
191 bool freezetogglekeydown;
197 float editorrotation;
198 float editorrotation2;
207 int numpathpointconnect[30];
208 int pathpointconnect[30][30];
209 int pathpointselected;
213 int numchallengelevels;
217 char consoletext[15][256];
218 int consolechars[15];
220 char displaytext[15][256];
221 int displaychars[15];
222 float displaytime[15];
223 float displayblinkdelay;
227 bool consoletogglekeydown;
228 float consoleblinkdelay;
232 float togglekeydelay[140];
236 unsigned short crouchkey,jumpkey,forwardkey,chatkey,backkey,leftkey,rightkey,drawkey,throwkey,attackkey;
239 long long MD5_string (char *string);
240 static void LoadTexture(const char *fileName, GLuint *textureid,int mipmap, bool hasalpha);
241 static void LoadTextureSave(const char *fileName, GLuint *textureid,int mipmap,GLubyte *array, int *skinsize);
242 void LoadSave(const char *fileName, GLuint *textureid,bool mipmap,GLubyte *array, int *skinsize);
243 bool AddClothes(const char *fileName, GLuint *textureid,bool mipmap,GLubyte *array, int *skinsize);
246 void LoadingScreen();
247 void FadeLoadingScreen(float howmuch);
249 int DrawGLScene(void);
252 void TickOnceAfter();
253 void SetUpLighting();
254 void Loadlevel(int which);
255 void Loadlevel(char *name);
257 void Setenvironment(int which);
258 GLvoid ReSizeGLScene(float fov, float near);
259 int findPathDist(int start,int end);
260 int checkcollide(XYZ startpoint, XYZ endpoint);
261 int checkcollide(XYZ startpoint, XYZ endpoint, int what);
273 float musicvolume[4];
274 float oldmusicvolume[4];
279 for(int i=0;i<10;i++){
280 if(Mainmenuitems[i])glDeleteTextures( 1, &Mainmenuitems[i] );
282 glDeleteTextures( 1, &cursortexture );
283 glDeleteTextures( 1, &Maparrowtexture );
284 glDeleteTextures( 1, &Mapboxtexture );
285 glDeleteTextures( 1, &Mapcircletexture );
286 glDeleteTextures( 1, &terraintexture );
287 glDeleteTextures( 1, &terraintexture2 );
288 if(screentexture>0)glDeleteTextures( 1, &screentexture );
289 if(screentexture2>0)glDeleteTextures( 1, &screentexture2 );
290 glDeleteTextures( 1, &hawktexture );
291 glDeleteTextures( 1, &logotexture );
292 glDeleteTextures( 1, &loadscreentexture );
299 #ifndef __forceinline
301 # define __forceinline inline __attribute__((always_inline))
305 static __forceinline void swap_gl_buffers(void)
308 SDL_GL_SwapBuffers();
313 #define LONGLONGCONST(x) (x##ll)
315 #define LONGLONGCONST(x) (x)
318 extern "C" { void UndefinedSymbolToExposeStubbedCode(void); }
319 //#define STUBBED(x) UndefinedSymbolToExposeStubbedCode();
320 #define STUBBED(x) { static bool seen = false; if (!seen) { seen = true; fprintf(stderr, "STUBBED: %s at %s:%d\n", x, __FILE__, __LINE__); } }