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/>.
30 #include "Animation/Skeleton.h"
45 #include "optionparser.h"
47 #define NB_CAMPAIGN_MENU_ITEM 7
51 extern Texture terraintexture;
52 extern Texture terraintexture2;
53 extern Texture loadscreentexture;
54 extern Texture Maparrowtexture;
55 extern Texture Mapboxtexture;
56 extern Texture Mapcircletexture;
57 extern Texture cursortexture;
58 extern GLuint screentexture;
59 extern GLuint screentexture2;
60 extern Texture Mainmenuitems[10];
66 extern int newscreenwidth;
67 extern int newscreenheight;
70 extern float deltah, deltav;
71 extern int mousecoordh, mousecoordv;
72 extern int oldmousecoordh, oldmousecoordv;
73 extern float yaw, pitch;
74 extern SkyBox *skybox;
75 extern bool cameramode;
76 extern bool firstload;
78 extern float leveltime;
79 extern float wonleveltime;
80 extern float loadtime;
83 extern XYZ hawkcoords;
84 extern XYZ realhawkcoords;
85 extern Texture hawktexture;
87 extern float hawkcalldelay;
93 extern bool stealthloading;
99 extern float mapradius;
104 extern bool editorenabled;
105 extern int editortype;
106 extern float editorsize;
107 extern float editoryaw;
108 extern float editorpitch;
112 extern XYZ pathpoint[30];
113 extern int numpathpoints;
114 extern int numpathpointconnect[30];
115 extern int pathpointconnect[30][30];
116 extern int pathpointselected;
119 extern bool scoreadded;
120 extern int numchallengelevels;
123 extern std::string consoletext[15];
124 extern std::string displaytext[15];
125 extern float displaytime[15];
126 extern float displayblinkdelay;
127 extern bool displayblink;
128 extern unsigned displayselected;
129 extern float consoleblinkdelay;
130 extern bool consoleblink;
131 extern unsigned consoleselected;
133 extern int oldenvironment;
134 extern int targetlevel;
135 extern float changedelay;
138 extern Account* accountactive;
140 extern unsigned short crouchkey, jumpkey, forwardkey, backkey, leftkey, rightkey, drawkey, throwkey, attackkey;
141 extern unsigned short consolekey;
148 void LoadScreenTexture();
149 void LoadingScreen();
150 int DrawGLScene(StereoSide side);
151 void playdialoguescenesound();
152 int findClosestPlayer();
153 void Loadlevel(int which);
154 void Loadlevel(const std::string& name);
157 void TickOnceAfter();
158 void SetUpLighting();
159 GLvoid ReSizeGLScene(float fov, float near);
160 int checkcollide(XYZ startpoint, XYZ endpoint);
161 int checkcollide(XYZ startpoint, XYZ endpoint, int what);
163 void fireSound(int sound = fireendsound);
165 void inputText(std::string& str, unsigned* charselected);
166 void flash(float amount = 1, int delay = 1);
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__); } }
196 mapkilleveryone, mapgosomewhere,
197 mapkillsomeone, mapkillmost // These two are unused
200 enum pathtypes {wpkeepwalking, wppause};
202 extern const char *pathtypenames[2];
204 enum editortypes {typeactive, typesitting, typesittingwall, typesleeping,
205 typedead1, typedead2, typedead3, typedead4
208 extern const char *editortypenames[8];
210 extern const char *rabbitskin[10];
212 extern const char *wolfskin[3];
214 extern const char **creatureskin[2];
216 SDL_bool sdlEventProc(const SDL_Event &e);
220 enum optionIndex { UNKNOWN, HELP, FULLSCREEN, NOMOUSEGRAB, SOUND, OPENALINFO, SHOWRESOLUTIONS, DEBUG };
221 /* Number of options + 1 */
222 const int commandLineOptionsNumber = 9;
224 extern const option::Descriptor usage[13];
226 extern option::Option commandLineOptions[commandLineOptionsNumber];
227 extern option::Option* commandLineOptionsBuffer;