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 <DrawSprocket.h>
63 #define NB_CAMPAIGN_MENU_ITEM 7
67 extern Texture terraintexture;
68 extern Texture terraintexture2;
69 extern Texture loadscreentexture;
70 extern Texture Maparrowtexture;
71 extern Texture Mapboxtexture;
72 extern Texture Mapcircletexture;
73 extern Texture cursortexture;
74 extern GLuint screentexture;
75 extern GLuint screentexture2;
76 extern Texture Mainmenuitems[10];
82 extern int newscreenwidth;
83 extern int newscreenheight;
86 extern float deltah, deltav;
87 extern int mousecoordh, mousecoordv;
88 extern int oldmousecoordh, oldmousecoordv;
89 extern float yaw, pitch;
90 extern SkyBox *skybox;
91 extern bool cameramode;
92 extern bool firstload;
94 extern float leveltime;
95 extern float loadtime;
98 extern XYZ hawkcoords;
99 extern XYZ realhawkcoords;
100 extern Texture hawktexture;
101 extern float hawkyaw;
102 extern float hawkcalldelay;
108 extern bool stealthloading;
111 extern int musictype;
113 extern XYZ mapcenter;
114 extern float mapradius;
119 extern bool editorenabled;
120 extern int editortype;
121 extern float editorsize;
122 extern float editoryaw;
123 extern float editorpitch;
127 extern XYZ pathpoint[30];
128 extern int numpathpoints;
129 extern int numpathpointconnect[30];
130 extern int pathpointconnect[30][30];
131 extern int pathpointselected;
134 extern bool scoreadded;
135 extern int numchallengelevels;
138 extern std::string consoletext[15];
139 extern bool chatting;
140 extern std::string displaytext[15];
141 extern float displaytime[15];
142 extern float displayblinkdelay;
143 extern bool displayblink;
144 extern int displayselected;
145 extern float consoleblinkdelay;
146 extern bool consoleblink;
147 extern int consoleselected;
149 extern int oldenvironment;
150 extern int targetlevel;
151 extern float changedelay;
154 extern Account* accountactive;
156 extern unsigned short crouchkey, jumpkey, forwardkey, chatkey, backkey, leftkey, rightkey, drawkey, throwkey, attackkey;
157 extern unsigned short consolekey;
164 void LoadScreenTexture();
165 void LoadingScreen();
166 int DrawGLScene(StereoSide side);
170 void TickOnceAfter();
171 void SetUpLighting();
172 GLvoid ReSizeGLScene(float fov, float near);
173 int checkcollide(XYZ startpoint, XYZ endpoint);
174 int checkcollide(XYZ startpoint, XYZ endpoint, int what);
176 void fireSound(int sound = fireendsound);
177 void setKeySelected();
179 void inputText(std::string& str, int* charselected);
183 #ifndef __forceinline
185 # define __forceinline inline __attribute__((always_inline))
189 static __forceinline void swap_gl_buffers(void)
191 extern SDL_Window *sdlwindow;
192 SDL_GL_SwapWindow(sdlwindow);
194 // try to limit this to 60fps, even if vsync fails.
196 static Uint32 frameticks = 0;
197 const Uint32 endticks = (frameticks + 16);
198 while ((now = SDL_GetTicks()) < endticks) { /* spin. */ }
203 void UndefinedSymbolToExposeStubbedCode(void);
205 //#define STUBBED(x) UndefinedSymbolToExposeStubbedCode();
206 #define STUBBED(x) { static bool seen = false; if (!seen) { seen = true; fprintf(stderr, "STUBBED: %s at %s:%d\n", x, __FILE__, __LINE__); } }
209 extern int numdialogues;
210 const int max_dialogues = 20;
211 const int max_dialoguelength = 20;
212 extern int numdialogueboxes[max_dialogues];
213 extern int dialoguetype[max_dialogues];
214 extern int dialogueboxlocation[max_dialogues][max_dialoguelength];
215 extern float dialogueboxcolor[max_dialogues][max_dialoguelength][3];
216 extern int dialogueboxsound[max_dialogues][max_dialoguelength];
217 extern char dialoguetext[max_dialogues][max_dialoguelength][128];
218 extern char dialoguename[max_dialogues][max_dialoguelength][64];
219 extern XYZ dialoguecamera[max_dialogues][max_dialoguelength];
220 extern XYZ participantlocation[max_dialogues][10];
221 extern int participantfocus[max_dialogues][max_dialoguelength];
222 extern int participantaction[max_dialogues][max_dialoguelength];
223 extern float participantyaw[max_dialogues][10];
224 extern XYZ participantfacing[max_dialogues][max_dialoguelength][10];
225 extern float dialoguecamerayaw[max_dialogues][max_dialoguelength];
226 extern float dialoguecamerapitch[max_dialogues][max_dialoguelength];
227 extern int indialogue;
228 extern int whichdialogue;
229 extern int directing;
230 extern float dialoguetime;
231 extern int dialoguegonethrough[20];
234 mapkilleveryone, mapgosomewhere,
235 mapkillsomeone, mapkillmost // These two are unused
238 enum pathtypes {wpkeepwalking, wppause};
240 static const char *pathtypenames[] = {"keepwalking", "pause"};
242 enum editortypes {typeactive, typesitting, typesittingwall, typesleeping,
243 typedead1, typedead2, typedead3, typedead4
246 static const char *editortypenames[] = {
247 "active", "sitting", "sitting wall", "sleeping",
248 "dead1", "dead2", "dead3", "dead4"