2 Copyright (C) 2003, 2010 - Wolfire Games
3 Copyright (C) 2010-2016 - Lugaru contributors (see AUTHORS file)
5 This file is part of Lugaru.
7 Lugaru is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
12 Lugaru is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with Lugaru. If not, see <http://www.gnu.org/licenses/>.
46 #define NB_CAMPAIGN_MENU_ITEM 7
50 extern Texture terraintexture;
51 extern Texture terraintexture2;
52 extern Texture loadscreentexture;
53 extern Texture Maparrowtexture;
54 extern Texture Mapboxtexture;
55 extern Texture Mapcircletexture;
56 extern Texture cursortexture;
57 extern GLuint screentexture;
58 extern GLuint screentexture2;
59 extern Texture Mainmenuitems[10];
65 extern int newscreenwidth;
66 extern int newscreenheight;
69 extern float deltah, deltav;
70 extern int mousecoordh, mousecoordv;
71 extern int oldmousecoordh, oldmousecoordv;
72 extern float yaw, pitch;
73 extern SkyBox *skybox;
74 extern bool cameramode;
75 extern bool firstload;
77 extern float leveltime;
78 extern float loadtime;
81 extern XYZ hawkcoords;
82 extern XYZ realhawkcoords;
83 extern Texture hawktexture;
85 extern float hawkcalldelay;
91 extern bool stealthloading;
97 extern float mapradius;
102 extern bool editorenabled;
103 extern int editortype;
104 extern float editorsize;
105 extern float editoryaw;
106 extern float editorpitch;
110 extern XYZ pathpoint[30];
111 extern int numpathpoints;
112 extern int numpathpointconnect[30];
113 extern int pathpointconnect[30][30];
114 extern int pathpointselected;
117 extern bool scoreadded;
118 extern int numchallengelevels;
121 extern std::string consoletext[15];
122 extern std::string displaytext[15];
123 extern float displaytime[15];
124 extern float displayblinkdelay;
125 extern bool displayblink;
126 extern unsigned displayselected;
127 extern float consoleblinkdelay;
128 extern bool consoleblink;
129 extern unsigned consoleselected;
131 extern int oldenvironment;
132 extern int targetlevel;
133 extern float changedelay;
136 extern Account* accountactive;
138 extern unsigned short crouchkey, jumpkey, forwardkey, backkey, leftkey, rightkey, drawkey, throwkey, attackkey;
139 extern unsigned short consolekey;
146 void LoadScreenTexture();
147 void LoadingScreen();
148 int DrawGLScene(StereoSide side);
150 void playdialogueboxsound();
151 int findClosestPlayer();
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];
220 mapkilleveryone, mapgosomewhere,
221 mapkillsomeone, mapkillmost // These two are unused
224 enum pathtypes {wpkeepwalking, wppause};
226 extern const char *pathtypenames[2];
228 enum editortypes {typeactive, typesitting, typesittingwall, typesleeping,
229 typedead1, typedead2, typedead3, typedead4
232 extern const char *editortypenames[8];
234 extern const char *rabbitskin[10];
236 extern const char *wolfskin[3];
238 extern const char **creatureskin[2];
240 SDL_bool sdlEventProc(const SDL_Event &e);