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>
68 extern GLuint rabbittexture;
73 typedef std::map<std::string, GLuint> TextureList;
74 typedef std::map<GLuint, std::string> GLTextureList;
75 typedef TextureList::iterator TexIter;
76 static TextureList textures;
78 GLuint terraintexture;
79 GLuint terraintexture2;
80 GLuint terraintexture3;
82 GLuint screentexture2;
84 GLuint loadscreentexture;
85 GLuint Maparrowtexture;
87 GLuint Mapcircletexture;
89 GLuint Mainmenuitems[10];
96 float selectedlong[100];
112 char menustring[100][256];
113 char registrationname[256];
114 float registrationnumber;
122 int mousecoordh,mousecoordv;
123 int oldmousecoordh,oldmousecoordv;
124 float rotation,rotation2;
127 bool cameratogglekeydown;
128 bool chattogglekeydown;
131 bool drawmodetogglekeydown;
132 bool explodetogglekeydown;
133 bool detailtogglekeydown;
153 int campaignnumlevels;
154 char campaignmapname[50][256];
155 char campaigndescription[50][256];
156 int campaignchoosenext[50];
157 int campaignnumnext[50];
158 int campaignnextlevel[50][10];
159 int campaignchoicesmade;
160 int campaignchoices[5000];
161 int campaignlocationx[50];
162 int campaignlocationy[50];
163 int campaignchoicenum;
164 int campaignchoicewhich[10];
168 int levelorder[5000];
169 int levelvisible[50];
170 int levelhighlight[50];
174 int musictype,oldmusictype,oldoldmusictype;
189 bool envtogglekeydown;
190 bool slomotogglekeydown;
191 bool texturesizetogglekeydown;
192 bool freezetogglekeydown;
198 float editorrotation;
199 float editorrotation2;
208 int numpathpointconnect[30];
209 int pathpointconnect[30][30];
210 int pathpointselected;
214 int numchallengelevels;
218 char consoletext[15][256];
219 int consolechars[15];
221 char displaytext[15][256];
222 int displaychars[15];
223 float displaytime[15];
224 float displayblinkdelay;
228 bool consoletogglekeydown;
229 float consoleblinkdelay;
232 //int togglekey[140];
233 //float togglekeydelay[140];
237 unsigned short crouchkey,jumpkey,forwardkey,chatkey,backkey,leftkey,rightkey,drawkey,throwkey,attackkey;
240 long long MD5_string (char *string);
241 static void LoadTexture(const char *fileName, GLuint *textureid,int mipmap, bool hasalpha);
242 static void LoadTextureSave(const char *fileName, GLuint *textureid,int mipmap,GLubyte *array, int *skinsize);
243 void LoadSave(const char *fileName, GLuint *textureid,bool mipmap,GLubyte *array, int *skinsize);
244 bool AddClothes(const char *fileName, GLuint *textureid,bool mipmap,GLubyte *array, int *skinsize);
247 void LoadingScreen();
248 void FadeLoadingScreen(float howmuch);
250 int DrawGLScene(StereoSide side);
253 void TickOnceAfter();
254 void SetUpLighting();
255 void Loadlevel(int which);
256 void Loadlevel(char *name);
258 void Setenvironment(int which);
259 GLvoid ReSizeGLScene(float fov, float near);
260 int findPathDist(int start,int end);
261 int checkcollide(XYZ startpoint, XYZ endpoint);
262 int checkcollide(XYZ startpoint, XYZ endpoint, int what);
266 void fireSound(int sound=fireendsound);
267 void setKeySelected();
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 );
300 bool isWaiting() { return waiting; };
302 void setKeySelected_thread();
303 static int thread(void *data);
304 void inputText(char* str, int* charselected, int* nb_chars);
307 bool mainmenutogglekeydown;
309 Account* accountactive;
312 #ifndef __forceinline
314 # define __forceinline inline __attribute__((always_inline))
318 static __forceinline void swap_gl_buffers(void)
321 SDL_GL_SwapBuffers();
326 #define LONGLONGCONST(x) (x##ll)
328 #define LONGLONGCONST(x) (x)
331 extern "C" { void UndefinedSymbolToExposeStubbedCode(void); }
332 //#define STUBBED(x) UndefinedSymbolToExposeStubbedCode();
333 #define STUBBED(x) { static bool seen = false; if (!seen) { seen = true; fprintf(stderr, "STUBBED: %s at %s:%d\n", x, __FILE__, __LINE__); } }