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/>.
45 #define NB_CAMPAIGN_MENU_ITEM 7
49 extern Texture terraintexture;
50 extern Texture terraintexture2;
51 extern Texture loadscreentexture;
52 extern Texture Maparrowtexture;
53 extern Texture Mapboxtexture;
54 extern Texture Mapcircletexture;
55 extern Texture cursortexture;
56 extern GLuint screentexture;
57 extern GLuint screentexture2;
58 extern Texture Mainmenuitems[10];
64 extern int newscreenwidth;
65 extern int newscreenheight;
68 extern float deltah, deltav;
69 extern int mousecoordh, mousecoordv;
70 extern int oldmousecoordh, oldmousecoordv;
71 extern float yaw, pitch;
72 extern SkyBox *skybox;
73 extern bool cameramode;
74 extern bool firstload;
76 extern float leveltime;
77 extern float loadtime;
80 extern XYZ hawkcoords;
81 extern XYZ realhawkcoords;
82 extern Texture hawktexture;
84 extern float hawkcalldelay;
90 extern bool stealthloading;
96 extern float mapradius;
101 extern bool editorenabled;
102 extern int editortype;
103 extern float editorsize;
104 extern float editoryaw;
105 extern float editorpitch;
109 extern XYZ pathpoint[30];
110 extern int numpathpoints;
111 extern int numpathpointconnect[30];
112 extern int pathpointconnect[30][30];
113 extern int pathpointselected;
116 extern bool scoreadded;
117 extern int numchallengelevels;
120 extern std::string consoletext[15];
121 extern std::string displaytext[15];
122 extern float displaytime[15];
123 extern float displayblinkdelay;
124 extern bool displayblink;
125 extern unsigned displayselected;
126 extern float consoleblinkdelay;
127 extern bool consoleblink;
128 extern unsigned consoleselected;
130 extern int oldenvironment;
131 extern int targetlevel;
132 extern float changedelay;
135 extern Account* accountactive;
137 extern unsigned short crouchkey, jumpkey, forwardkey, backkey, leftkey, rightkey, drawkey, throwkey, attackkey;
138 extern unsigned short consolekey;
145 void LoadScreenTexture();
146 void LoadingScreen();
147 int DrawGLScene(StereoSide side);
149 void playdialogueboxsound();
150 int findClosestPlayer();
151 bool AddClothes(const char *fileName, GLubyte *array);
152 void Loadlevel(int which);
153 void Loadlevel(const char *name);
156 void TickOnceAfter();
157 void SetUpLighting();
158 GLvoid ReSizeGLScene(float fov, float near);
159 int checkcollide(XYZ startpoint, XYZ endpoint);
160 int checkcollide(XYZ startpoint, XYZ endpoint, int what);
162 void fireSound(int sound = fireendsound);
163 void setKeySelected();
165 void inputText(std::string& str, unsigned* charselected);
169 #ifndef __forceinline
171 # define __forceinline inline __attribute__((always_inline))
175 static __forceinline void swap_gl_buffers(void)
177 extern SDL_Window *sdlwindow;
178 SDL_GL_SwapWindow(sdlwindow);
180 // try to limit this to 60fps, even if vsync fails.
182 static Uint32 frameticks = 0;
183 const Uint32 endticks = (frameticks + 16);
184 while ((now = SDL_GetTicks()) < endticks) { /* spin. */ }
189 void UndefinedSymbolToExposeStubbedCode(void);
191 //#define STUBBED(x) UndefinedSymbolToExposeStubbedCode();
192 #define STUBBED(x) { static bool seen = false; if (!seen) { seen = true; fprintf(stderr, "STUBBED: %s at %s:%d\n", x, __FILE__, __LINE__); } }
195 extern int numdialogues;
196 const int max_dialogues = 20;
197 const int max_dialoguelength = 20;
198 extern int numdialogueboxes[max_dialogues];
199 extern int dialoguetype[max_dialogues];
200 extern int dialogueboxlocation[max_dialogues][max_dialoguelength];
201 extern float dialogueboxcolor[max_dialogues][max_dialoguelength][3];
202 extern int dialogueboxsound[max_dialogues][max_dialoguelength];
203 extern char dialoguetext[max_dialogues][max_dialoguelength][128];
204 extern char dialoguename[max_dialogues][max_dialoguelength][64];
205 extern XYZ dialoguecamera[max_dialogues][max_dialoguelength];
206 extern XYZ participantlocation[max_dialogues][10];
207 extern int participantfocus[max_dialogues][max_dialoguelength];
208 extern int participantaction[max_dialogues][max_dialoguelength];
209 extern float participantyaw[max_dialogues][10];
210 extern XYZ participantfacing[max_dialogues][max_dialoguelength][10];
211 extern float dialoguecamerayaw[max_dialogues][max_dialoguelength];
212 extern float dialoguecamerapitch[max_dialogues][max_dialoguelength];
213 extern int indialogue;
214 extern int whichdialogue;
215 extern int directing;
216 extern float dialoguetime;
217 extern int dialoguegonethrough[20];
218 extern float tintr, tintg, tintb;
221 mapkilleveryone, mapgosomewhere,
222 mapkillsomeone, mapkillmost // These two are unused
225 enum pathtypes {wpkeepwalking, wppause};
227 extern const char *pathtypenames[2];
229 enum editortypes {typeactive, typesitting, typesittingwall, typesleeping,
230 typedead1, typedead2, typedead3, typedead4
233 extern const char *editortypenames[8];
235 extern const char *rabbitskin[10];
237 extern const char *wolfskin[3];
239 extern const char **creatureskin[2];