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 modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
11 Lugaru 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. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with Lugaru. If not, see <http://www.gnu.org/licenses/>.
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"
51 //#include <DrawSprocket.h>
61 #define NB_CAMPAIGN_MENU_ITEM 7
65 extern Texture terraintexture;
66 extern Texture terraintexture2;
67 extern Texture loadscreentexture;
68 extern Texture Maparrowtexture;
69 extern Texture Mapboxtexture;
70 extern Texture Mapcircletexture;
71 extern Texture cursortexture;
72 extern GLuint screentexture;
73 extern GLuint screentexture2;
74 extern Texture Mainmenuitems[10];
80 extern int newscreenwidth;
81 extern int newscreenheight;
84 extern float deltah, deltav;
85 extern int mousecoordh, mousecoordv;
86 extern int oldmousecoordh, oldmousecoordv;
87 extern float yaw, pitch;
88 extern SkyBox *skybox;
89 extern bool cameramode;
90 extern bool firstload;
92 extern float leveltime;
93 extern float loadtime;
96 extern XYZ hawkcoords;
97 extern XYZ realhawkcoords;
98 extern Texture hawktexture;
100 extern float hawkcalldelay;
106 extern bool stealthloading;
109 extern int musictype;
111 extern XYZ mapcenter;
112 extern float mapradius;
117 extern bool editorenabled;
118 extern int editortype;
119 extern float editorsize;
120 extern float editoryaw;
121 extern float editorpitch;
125 extern XYZ pathpoint[30];
126 extern int numpathpoints;
127 extern int numpathpointconnect[30];
128 extern int pathpointconnect[30][30];
129 extern int pathpointselected;
132 extern bool scoreadded;
133 extern int numchallengelevels;
136 extern std::string consoletext[15];
137 extern std::string displaytext[15];
138 extern float displaytime[15];
139 extern float displayblinkdelay;
140 extern bool displayblink;
141 extern unsigned displayselected;
142 extern float consoleblinkdelay;
143 extern bool consoleblink;
144 extern unsigned consoleselected;
146 extern int oldenvironment;
147 extern int targetlevel;
148 extern float changedelay;
151 extern Account* accountactive;
153 extern unsigned short crouchkey, jumpkey, forwardkey, backkey, leftkey, rightkey, drawkey, throwkey, attackkey;
154 extern unsigned short consolekey;
161 void LoadScreenTexture();
162 void LoadingScreen();
163 int DrawGLScene(StereoSide side);
167 void TickOnceAfter();
168 void SetUpLighting();
169 GLvoid ReSizeGLScene(float fov, float near);
170 int checkcollide(XYZ startpoint, XYZ endpoint);
171 int checkcollide(XYZ startpoint, XYZ endpoint, int what);
173 void fireSound(int sound = fireendsound);
174 void setKeySelected();
176 void inputText(std::string& str, unsigned* charselected);
180 #ifndef __forceinline
182 # define __forceinline inline __attribute__((always_inline))
186 static __forceinline void swap_gl_buffers(void)
188 extern SDL_Window *sdlwindow;
189 SDL_GL_SwapWindow(sdlwindow);
191 // try to limit this to 60fps, even if vsync fails.
193 static Uint32 frameticks = 0;
194 const Uint32 endticks = (frameticks + 16);
195 while ((now = SDL_GetTicks()) < endticks) { /* spin. */ }
200 void UndefinedSymbolToExposeStubbedCode(void);
202 //#define STUBBED(x) UndefinedSymbolToExposeStubbedCode();
203 #define STUBBED(x) { static bool seen = false; if (!seen) { seen = true; fprintf(stderr, "STUBBED: %s at %s:%d\n", x, __FILE__, __LINE__); } }
206 extern int numdialogues;
207 const int max_dialogues = 20;
208 const int max_dialoguelength = 20;
209 extern int numdialogueboxes[max_dialogues];
210 extern int dialoguetype[max_dialogues];
211 extern int dialogueboxlocation[max_dialogues][max_dialoguelength];
212 extern float dialogueboxcolor[max_dialogues][max_dialoguelength][3];
213 extern int dialogueboxsound[max_dialogues][max_dialoguelength];
214 extern char dialoguetext[max_dialogues][max_dialoguelength][128];
215 extern char dialoguename[max_dialogues][max_dialoguelength][64];
216 extern XYZ dialoguecamera[max_dialogues][max_dialoguelength];
217 extern XYZ participantlocation[max_dialogues][10];
218 extern int participantfocus[max_dialogues][max_dialoguelength];
219 extern int participantaction[max_dialogues][max_dialoguelength];
220 extern float participantyaw[max_dialogues][10];
221 extern XYZ participantfacing[max_dialogues][max_dialoguelength][10];
222 extern float dialoguecamerayaw[max_dialogues][max_dialoguelength];
223 extern float dialoguecamerapitch[max_dialogues][max_dialoguelength];
224 extern int indialogue;
225 extern int whichdialogue;
226 extern int directing;
227 extern float dialoguetime;
228 extern int dialoguegonethrough[20];
231 mapkilleveryone, mapgosomewhere,
232 mapkillsomeone, mapkillmost // These two are unused
235 enum pathtypes {wpkeepwalking, wppause};
237 extern const char *pathtypenames[2];
239 enum editortypes {typeactive, typesitting, typesittingwall, typesleeping,
240 typedead1, typedead2, typedead3, typedead4
243 extern const char *editortypenames[8];