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);
165 void playdialogueboxsound();
166 int findClosestPlayer();
167 bool AddClothes(const char *fileName, GLubyte *array);
168 void Loadlevel(int which);
169 void Loadlevel(const char *name);
172 void TickOnceAfter();
173 void SetUpLighting();
174 GLvoid ReSizeGLScene(float fov, float near);
175 int checkcollide(XYZ startpoint, XYZ endpoint);
176 int checkcollide(XYZ startpoint, XYZ endpoint, int what);
178 void fireSound(int sound = fireendsound);
179 void setKeySelected();
181 void inputText(std::string& str, unsigned* charselected);
185 #ifndef __forceinline
187 # define __forceinline inline __attribute__((always_inline))
191 static __forceinline void swap_gl_buffers(void)
193 extern SDL_Window *sdlwindow;
194 SDL_GL_SwapWindow(sdlwindow);
196 // try to limit this to 60fps, even if vsync fails.
198 static Uint32 frameticks = 0;
199 const Uint32 endticks = (frameticks + 16);
200 while ((now = SDL_GetTicks()) < endticks) { /* spin. */ }
205 void UndefinedSymbolToExposeStubbedCode(void);
207 //#define STUBBED(x) UndefinedSymbolToExposeStubbedCode();
208 #define STUBBED(x) { static bool seen = false; if (!seen) { seen = true; fprintf(stderr, "STUBBED: %s at %s:%d\n", x, __FILE__, __LINE__); } }
211 extern int numdialogues;
212 const int max_dialogues = 20;
213 const int max_dialoguelength = 20;
214 extern int numdialogueboxes[max_dialogues];
215 extern int dialoguetype[max_dialogues];
216 extern int dialogueboxlocation[max_dialogues][max_dialoguelength];
217 extern float dialogueboxcolor[max_dialogues][max_dialoguelength][3];
218 extern int dialogueboxsound[max_dialogues][max_dialoguelength];
219 extern char dialoguetext[max_dialogues][max_dialoguelength][128];
220 extern char dialoguename[max_dialogues][max_dialoguelength][64];
221 extern XYZ dialoguecamera[max_dialogues][max_dialoguelength];
222 extern XYZ participantlocation[max_dialogues][10];
223 extern int participantfocus[max_dialogues][max_dialoguelength];
224 extern int participantaction[max_dialogues][max_dialoguelength];
225 extern float participantyaw[max_dialogues][10];
226 extern XYZ participantfacing[max_dialogues][max_dialoguelength][10];
227 extern float dialoguecamerayaw[max_dialogues][max_dialoguelength];
228 extern float dialoguecamerapitch[max_dialogues][max_dialoguelength];
229 extern int indialogue;
230 extern int whichdialogue;
231 extern int directing;
232 extern float dialoguetime;
233 extern int dialoguegonethrough[20];
234 extern float tintr, tintg, tintb;
237 mapkilleveryone, mapgosomewhere,
238 mapkillsomeone, mapkillmost // These two are unused
241 enum pathtypes {wpkeepwalking, wppause};
243 extern const char *pathtypenames[2];
245 enum editortypes {typeactive, typesitting, typesittingwall, typesleeping,
246 typedead1, typedead2, typedead3, typedead4
249 extern const char *editortypenames[8];
251 extern const char *rabbitskin[10];
253 extern const char *wolfskin[3];
255 extern const char **creatureskin[2];