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"
53 #include "Constants.h"
58 //#include <DrawSprocket.h>
66 extern GLuint rabbittexture;
71 typedef std::map<std::string, GLuint> TextureList;
72 typedef std::map<GLuint, std::string> GLTextureList;
73 typedef TextureList::iterator TexIter;
74 static TextureList textures;
76 GLuint terraintexture;
77 GLuint terraintexture2;
78 GLuint terraintexture3;
80 GLuint screentexture2;
82 GLuint loadscreentexture;
83 GLuint Maparrowtexture;
85 GLuint Mapcircletexture;
87 GLuint Mainmenuitems[10];
94 float selectedlong[100];
110 char menustring[100][256];
111 char registrationname[256];
112 float registrationnumber;
120 int mousecoordh,mousecoordv;
121 int oldmousecoordh,oldmousecoordv;
122 float rotation,rotation2;
125 bool cameratogglekeydown;
126 bool chattogglekeydown;
129 bool drawmodetogglekeydown;
130 bool explodetogglekeydown;
131 bool detailtogglekeydown;
151 int campaignnumlevels;
152 char campaignmapname[50][256];
153 char campaigndescription[50][256];
154 int campaignchoosenext[50];
155 int campaignnumnext[50];
156 int campaignnextlevel[50][10];
157 int campaignchoicesmade;
158 int campaignchoices[5000];
159 int campaignlocationx[50];
160 int campaignlocationy[50];
161 int campaignchoicenum;
162 int campaignchoicewhich[10];
166 int levelorder[5000];
167 int levelvisible[50];
168 int levelhighlight[50];
172 int musictype,oldmusictype,oldoldmusictype;
187 bool envtogglekeydown;
188 bool slomotogglekeydown;
189 bool texturesizetogglekeydown;
190 bool freezetogglekeydown;
196 float editorrotation;
197 float editorrotation2;
206 int numpathpointconnect[30];
207 int pathpointconnect[30][30];
208 int pathpointselected;
212 int numchallengelevels;
216 char consoletext[15][256];
217 int consolechars[15];
219 char displaytext[15][256];
220 int displaychars[15];
221 float displaytime[15];
222 float displayblinkdelay;
226 bool consoletogglekeydown;
227 float consoleblinkdelay;
230 //int togglekey[140];
231 //float togglekeydelay[140];
235 unsigned short crouchkey,jumpkey,forwardkey,chatkey,backkey,leftkey,rightkey,drawkey,throwkey,attackkey;
238 long long MD5_string (char *string);
239 static void LoadTexture(const char *fileName, GLuint *textureid,int mipmap, bool hasalpha);
240 static void LoadTextureSave(const char *fileName, GLuint *textureid,int mipmap,GLubyte *array, int *skinsize);
241 void LoadSave(const char *fileName, GLuint *textureid,bool mipmap,GLubyte *array, int *skinsize);
242 bool AddClothes(const char *fileName, GLuint *textureid,bool mipmap,GLubyte *array, int *skinsize);
245 void LoadingScreen();
246 void FadeLoadingScreen(float howmuch);
248 int DrawGLScene(StereoSide side);
251 void TickOnceAfter();
252 void SetUpLighting();
253 void Loadlevel(int which);
254 void Loadlevel(char *name);
256 void Setenvironment(int which);
257 GLvoid ReSizeGLScene(float fov, float near);
258 int findPathDist(int start,int end);
259 int checkcollide(XYZ startpoint, XYZ endpoint);
260 int checkcollide(XYZ startpoint, XYZ endpoint, int what);
264 void fireSound(int sound=fireendsound);
265 void setKeySelected();
275 float musicvolume[4];
276 float oldmusicvolume[4];
281 for(int i=0;i<10;i++){
282 if(Mainmenuitems[i])glDeleteTextures( 1, &Mainmenuitems[i] );
284 glDeleteTextures( 1, &cursortexture );
285 glDeleteTextures( 1, &Maparrowtexture );
286 glDeleteTextures( 1, &Mapboxtexture );
287 glDeleteTextures( 1, &Mapcircletexture );
288 glDeleteTextures( 1, &terraintexture );
289 glDeleteTextures( 1, &terraintexture2 );
290 if(screentexture>0)glDeleteTextures( 1, &screentexture );
291 if(screentexture2>0)glDeleteTextures( 1, &screentexture2 );
292 glDeleteTextures( 1, &hawktexture );
293 glDeleteTextures( 1, &logotexture );
294 glDeleteTextures( 1, &loadscreentexture );
298 bool isWaiting() { return waiting; };
300 void setKeySelected_thread();
301 static int thread(void *data);
302 void inputText(char* str, int* charselected, int* nb_chars);
305 bool mainmenutogglekeydown;
307 Account* accountactive;
310 #ifndef __forceinline
312 # define __forceinline inline __attribute__((always_inline))
316 static __forceinline void swap_gl_buffers(void)
319 SDL_GL_SwapBuffers();
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__); } }