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.
29 #if (defined(__APPLE__) && defined(__MACH__))
30 # ifdef PLATFORM_MACOSX
31 # error Do not define PLATFORM_MACOSX for new builds. It is for the old Carbonized build.
35 #ifdef PLATFORM_MACOSX
37 #include "Quicktime.h"
40 //Jordan included glut.h
43 #include "TGALoader.h"
57 #include "Constants.h"
62 //#include <DrawSprocket.h>
68 extern GLuint rabbittexture;
74 typedef std::map<std::string, GLuint> TextureList;
75 typedef std::map<GLuint, std::string> GLTextureList;
76 typedef TextureList::iterator TexIter;
77 static TextureList textures;
79 GLuint terraintexture;
80 GLuint terraintexture2;
81 GLuint terraintexture3;
83 GLuint screentexture2;
85 GLuint loadscreentexture;
86 GLuint Maparrowtexture;
88 GLuint Mapcircletexture;
90 GLuint Mainmenuitems[10];
97 float selectedlong[100];
114 char menustring[100][256];
115 char registrationname[256];
116 float registrationnumber;
124 int mousecoordh,mousecoordv;
125 int oldmousecoordh,oldmousecoordv;
126 float rotation,rotation2;
129 bool cameratogglekeydown;
130 bool chattogglekeydown;
133 bool drawmodetogglekeydown;
134 bool explodetogglekeydown;
135 bool detailtogglekeydown;
155 int campaignnumlevels;
156 char campaignmapname[50][256];
157 char campaigndescription[50][256];
158 int campaignchoosenext[50];
159 int campaignnumnext[50];
160 int campaignnextlevel[50][10];
161 int campaignchoicesmade;
162 int campaignchoices[5000];
163 int campaignlocationx[50];
164 int campaignlocationy[50];
165 int campaignchoicenum;
166 int campaignchoicewhich[10];
170 int levelorder[5000];
171 int levelvisible[50];
172 int levelhighlight[50];
176 int musictype,oldmusictype,oldoldmusictype;
191 bool envtogglekeydown;
192 bool slomotogglekeydown;
193 bool texturesizetogglekeydown;
194 bool freezetogglekeydown;
200 float editorrotation;
201 float editorrotation2;
210 int numpathpointconnect[30];
211 int pathpointconnect[30][30];
212 int pathpointselected;
216 int numchallengelevels;
220 char consoletext[15][256];
221 int consolechars[15];
223 char displaytext[15][256];
224 int displaychars[15];
225 float displaytime[15];
226 float displayblinkdelay;
230 bool consoletogglekeydown;
231 float consoleblinkdelay;
235 float togglekeydelay[140];
239 unsigned short crouchkey,jumpkey,forwardkey,chatkey,backkey,leftkey,rightkey,drawkey,throwkey,attackkey;
242 long long MD5_string (char *string);
243 static void LoadTexture(const char *fileName, GLuint *textureid,int mipmap, bool hasalpha);
244 static void LoadTextureSave(const char *fileName, GLuint *textureid,int mipmap,GLubyte *array, int *skinsize);
245 void LoadSave(const char *fileName, GLuint *textureid,bool mipmap,GLubyte *array, int *skinsize);
246 bool AddClothes(const char *fileName, GLuint *textureid,bool mipmap,GLubyte *array, int *skinsize);
249 void LoadingScreen();
250 void FadeLoadingScreen(float howmuch);
252 int DrawGLScene(void);
255 void TickOnceAfter();
256 void SetUpLighting();
257 void Loadlevel(int which);
258 void Loadlevel(char *name);
260 void Setenvironment(int which);
261 GLvoid ReSizeGLScene(float fov, float near);
262 int findPathDist(int start,int end);
263 int checkcollide(XYZ startpoint, XYZ endpoint);
264 int checkcollide(XYZ startpoint, XYZ endpoint, int what);
276 float musicvolume[4];
277 float oldmusicvolume[4];
282 for(int i=0;i<10;i++){
283 if(Mainmenuitems[i])glDeleteTextures( 1, &Mainmenuitems[i] );
285 glDeleteTextures( 1, &cursortexture );
286 glDeleteTextures( 1, &Maparrowtexture );
287 glDeleteTextures( 1, &Mapboxtexture );
288 glDeleteTextures( 1, &Mapcircletexture );
289 glDeleteTextures( 1, &terraintexture );
290 glDeleteTextures( 1, &terraintexture2 );
291 if(screentexture>0)glDeleteTextures( 1, &screentexture );
292 if(screentexture2>0)glDeleteTextures( 1, &screentexture2 );
293 glDeleteTextures( 1, &hawktexture );
294 glDeleteTextures( 1, &logotexture );
295 glDeleteTextures( 1, &loadscreentexture );
302 #ifndef __forceinline
304 # define __forceinline inline __attribute__((always_inline))
308 static __forceinline void swap_gl_buffers(void)
314 SDL_GL_SwapBuffers();
315 #elif PLATFORM_MACOSX
316 extern AGLContext gaglContext;
317 aglSwapBuffers(gaglContext);
319 #error define your platform.
324 #define LONGLONGCONST(x) (x##ll)
326 #define LONGLONGCONST(x) (x)
329 extern "C" { void UndefinedSymbolToExposeStubbedCode(void); }
330 //#define STUBBED(x) UndefinedSymbolToExposeStubbedCode();
331 #define STUBBED(x) { static bool seen = false; if (!seen) { seen = true; fprintf(stderr, "STUBBED: %s at %s:%d\n", x, __FILE__, __LINE__); } }