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.
25 #if (defined(__APPLE__) && defined(__MACH__))
26 # ifdef PLATFORM_MACOSX
27 # error Do not define PLATFORM_MACOSX for new builds. It is for the old Carbonized build.
31 #ifdef PLATFORM_MACOSX
33 #include "Quicktime.h"
36 //Jordan included glut.h
39 #include "TGALoader.h"
57 #include "Constants.h"
63 //#include <DrawSprocket.h>
69 extern GLuint rabbittexture;
75 typedef std::map<std::string, GLuint> TextureList;
76 typedef std::map<GLuint, std::string> GLTextureList;
77 typedef TextureList::iterator TexIter;
78 static TextureList textures;
80 GLuint terraintexture;
81 GLuint terraintexture2;
82 GLuint terraintexture3;
84 GLuint screentexture2;
86 GLuint loadscreentexture;
87 GLuint Maparrowtexture;
89 GLuint Mapcircletexture;
91 GLuint Mainmenuitems[10];
98 float selectedlong[100];
115 char menustring[100][256];
116 char registrationname[256];
117 float registrationnumber;
125 int mousecoordh,mousecoordv;
126 int oldmousecoordh,oldmousecoordv;
127 float rotation,rotation2;
130 bool cameratogglekeydown;
131 bool chattogglekeydown;
134 bool drawmodetogglekeydown;
135 bool explodetogglekeydown;
136 bool detailtogglekeydown;
156 int campaignnumlevels;
157 char campaignmapname[50][256];
158 char campaigndescription[50][256];
159 int campaignchoosenext[50];
160 int campaignnumnext[50];
161 int campaignnextlevel[50][10];
162 int campaignchoicesmade;
163 int campaignchoices[5000];
164 int campaignlocationx[50];
165 int campaignlocationy[50];
166 int campaignchoicenum;
167 int campaignchoicewhich[10];
171 int levelorder[5000];
172 int levelvisible[50];
173 int levelhighlight[50];
177 int musictype,oldmusictype,oldoldmusictype;
192 bool envtogglekeydown;
193 bool slomotogglekeydown;
194 bool texturesizetogglekeydown;
195 bool freezetogglekeydown;
201 float editorrotation;
202 float editorrotation2;
211 int numpathpointconnect[30];
212 int pathpointconnect[30][30];
213 int pathpointselected;
217 int numchallengelevels;
221 char consoletext[15][256];
222 int consolechars[15];
224 char displaytext[15][256];
225 int displaychars[15];
226 float displaytime[15];
227 float displayblinkdelay;
231 bool consoletogglekeydown;
232 float consoleblinkdelay;
236 float togglekeydelay[140];
240 unsigned short crouchkey,jumpkey,forwardkey,chatkey,backkey,leftkey,rightkey,drawkey,throwkey,attackkey;
243 long long MD5_string (char *string);
244 static void LoadTexture(char *fileName, GLuint *textureid,int mipmap, bool hasalpha);
245 static void LoadTextureSave(char *fileName, GLuint *textureid,int mipmap,GLubyte *array, int *skinsize);
246 void LoadSave(char *fileName, GLuint *textureid,bool mipmap,GLubyte *array, int *skinsize);
247 bool AddClothes(char *fileName, GLuint *textureid,bool mipmap,GLubyte *array, int *skinsize);
250 void LoadingScreen();
251 void FadeLoadingScreen(float howmuch);
253 int DrawGLScene(void);
256 void TickOnceAfter();
257 void SetUpLighting();
258 void Loadlevel(int which);
259 void Loadlevel(char *name);
261 void Setenvironment(int which);
262 GLvoid ReSizeGLScene(float fov, float near);
263 int findPathDist(int start,int end);
264 int checkcollide(XYZ startpoint, XYZ endpoint);
265 int checkcollide(XYZ startpoint, XYZ endpoint, int what);
277 float musicvolume[4];
278 float oldmusicvolume[4];
283 for(int i=0;i<10;i++){
284 if(Mainmenuitems[i])glDeleteTextures( 1, &Mainmenuitems[i] );
286 glDeleteTextures( 1, &cursortexture );
287 glDeleteTextures( 1, &Maparrowtexture );
288 glDeleteTextures( 1, &Mapboxtexture );
289 glDeleteTextures( 1, &Mapcircletexture );
290 glDeleteTextures( 1, &terraintexture );
291 glDeleteTextures( 1, &terraintexture2 );
292 if(screentexture>0)glDeleteTextures( 1, &screentexture );
293 if(screentexture2>0)glDeleteTextures( 1, &screentexture2 );
294 glDeleteTextures( 1, &hawktexture );
295 glDeleteTextures( 1, &logotexture );
296 glDeleteTextures( 1, &loadscreentexture );
303 #ifndef __forceinline
305 # define __forceinline inline __attribute__((always_inline))
309 static __forceinline void swap_gl_buffers(void)
315 SDL_GL_SwapBuffers();
316 #elif PLATFORM_MACOSX
317 extern AGLContext gaglContext;
318 aglSwapBuffers(gaglContext);
320 #error define your platform.
325 #define LONGLONGCONST(x) (x##ll)
327 #define LONGLONGCONST(x) (x)
330 extern "C" { void UndefinedSymbolToExposeStubbedCode(void); }
331 //#define STUBBED(x) UndefinedSymbolToExposeStubbedCode();
332 #define STUBBED(x) { static bool seen = false; if (!seen) { seen = true; fprintf(stderr, "STUBBED: %s at %s:%d\n", x, __FILE__, __LINE__); } }