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
7 modify it under the terms of the GNU General Public License
8 as published by the Free Software Foundation; either version 2
9 of the License, or (at your option) any later version.
11 This program 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.
15 See the GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
23 #include "openal_wrapper.h"
25 extern float screenwidth,screenheight;
26 extern float viewdistance;
28 extern XYZ lightlocation;
29 extern float lightambient[3],lightbrightness[3];
30 extern float fadestart;
31 extern float texscale;
34 extern Animation animation[animation_count];
35 extern Skeleton testskeleton;
37 extern OPENAL_SAMPLE *samp[100];
38 extern int channels[100];
39 extern Terrain terrain;
40 //extern Sprites sprites;
41 extern int kTextureSize;
42 extern float texdetail;
43 extern float realtexdetail;
44 extern float terraindetail;
46 extern Objects objects;
48 extern bool cellophane;
49 extern GLubyte bloodText[512*512*3];
50 extern GLubyte wolfbloodText[512*512*3];
51 extern bool ismotionblur;
52 extern bool trilinear;
54 extern bool musictoggle;
55 extern Weapons weapons;
56 extern Person player[maxplayers];
57 extern int numplayers;
58 extern int environment;
59 extern bool ambientsound;
60 extern float multiplier;
61 extern int netdatanew;
63 extern bool stillloading;
64 extern TGAImageRec texture;
68 extern int oldmainmenu;
69 extern bool visibleloading;
70 extern int loadscreencolor;
71 extern float flashamount,flashr,flashg,flashb;
72 extern int flashdelay;
73 extern int whichjointstartarray[26];
74 extern int whichjointendarray[26];
75 extern int difficulty;
76 extern float tintr,tintg,tintb;
77 extern float slomospeed;
78 extern char mapname[256];
79 extern bool gamestarted;
81 extern int numdialogues;
82 extern int numdialogueboxes[20];
83 extern int dialoguetype[20];
84 extern int dialogueboxlocation[20][20];
85 extern float dialogueboxcolor[20][20][3];
86 extern int dialogueboxsound[20][20];
87 extern char dialoguetext[20][20][128];
88 extern char dialoguename[20][20][64];
89 extern XYZ dialoguecamera[20][20];
90 extern float dialoguecamerarotation[20][20];
91 extern float dialoguecamerarotation2[20][20];
92 extern int indialogue;
93 extern int whichdialogue;
94 extern float dialoguetime;
96 extern float accountcampaignhighscore[10];
97 extern float accountcampaignfasttime[10];
98 extern float accountcampaignscore[10];
99 extern float accountcampaigntime[10];
101 extern int accountcampaignchoicesmade[10];
102 extern int accountcampaignchoices[10][5000];
104 extern OPENAL_STREAM * strm[20];
106 extern "C" void PlaySoundEx(int channel, OPENAL_SAMPLE *sptr, OPENAL_DSPUNIT *dsp, signed char startpaused);
107 extern "C" void PlayStreamEx(int chan, OPENAL_STREAM *sptr, OPENAL_DSPUNIT *dsp, signed char startpaused);
109 void LOG(const std::string &fmt, ...)
111 // !!! FIXME: write me.
115 Game::TextureList Game::textures;
124 accountactive->endGame();
128 Account::saveFile(":Data:Users", accountactive);
130 TexIter it = textures.begin();
131 for (; it != textures.end(); ++it)
133 if (glIsTexture(it->second))
134 glDeleteTextures(1, &it->second);
138 LOG("Shutting down sound system...");
140 OPENAL_StopSound(OPENAL_ALL);
142 // this is causing problems on Linux, but we'll force an _exit() a little
143 // later in the shutdown process. --ryan.
145 #define streamcount 20
146 #define samplecount 100
148 for (i=0; i < samplecount; ++i)
150 OPENAL_Sample_Free(samp[i]);
153 for (i=0; i < streamcount; ++i)
155 OPENAL_Stream_Close(strm[i]);
168 //void Game::LoadSounds();
169 void Game::LoadSounds()
173 LOG(std::string("Loading sounds..."));
175 OPENAL_3D_SetDopplerFactor(0);
177 OPENAL_SetSFXMasterVolume((int)(volume*255));
179 samp[footstepsound] = OPENAL_Sample_LoadEx(OPENAL_FREE, ConvertFileName(":Data:Sounds:footstepsnow1.ogg"), OPENAL_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
180 OPENAL_Sample_SetMinMaxDistance(samp[footstepsound], 4.0f, 1000.0f);
182 samp[footstepsound2] = OPENAL_Sample_LoadEx(OPENAL_FREE, ConvertFileName(":Data:Sounds:footstepsnow2.ogg"), OPENAL_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
183 OPENAL_Sample_SetMinMaxDistance(samp[footstepsound2], 4.0f, 1000.0f);
185 samp[footstepsound3] = OPENAL_Sample_LoadEx(OPENAL_FREE, ConvertFileName(":Data:Sounds:footstepstone1.ogg"), OPENAL_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
186 OPENAL_Sample_SetMinMaxDistance(samp[footstepsound3], 4.0f, 1000.0f);
188 samp[footstepsound4] = OPENAL_Sample_LoadEx(OPENAL_FREE, ConvertFileName(":Data:Sounds:footstepstone2.ogg"), OPENAL_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
189 OPENAL_Sample_SetMinMaxDistance(samp[footstepsound4], 4.0f, 1000.0f);
191 samp[landsound] = OPENAL_Sample_LoadEx(OPENAL_FREE, ConvertFileName(":Data:Sounds:land.ogg"), OPENAL_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
192 OPENAL_Sample_SetMinMaxDistance(samp[landsound], 4.0f, 1000.0f);
194 samp[jumpsound] = OPENAL_Sample_LoadEx(OPENAL_FREE, ConvertFileName(":Data:Sounds:jump.ogg"), OPENAL_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
195 OPENAL_Sample_SetMinMaxDistance(samp[jumpsound], 4.0f, 1000.0f);
197 samp[hawksound] = OPENAL_Sample_LoadEx(OPENAL_FREE, ConvertFileName(":Data:Sounds:hawk.ogg"), OPENAL_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
198 OPENAL_Sample_SetMinMaxDistance(samp[hawksound], 40.0f, 10000.0f);
200 samp[whooshsound] = OPENAL_Sample_LoadEx(OPENAL_FREE, ConvertFileName(":Data:Sounds:whoosh.ogg"), OPENAL_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
201 OPENAL_Sample_SetMinMaxDistance(samp[whooshsound], 4.0f, 1000.0f);
202 OPENAL_Sample_SetMode(samp[whooshsound], OPENAL_LOOP_NORMAL);
204 samp[landsound1] = OPENAL_Sample_LoadEx(OPENAL_FREE, ConvertFileName(":Data:Sounds:land1.ogg"), OPENAL_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
205 OPENAL_Sample_SetMinMaxDistance(samp[landsound1], 4.0f, 1000.0f);
209 samp[landsound2] = OPENAL_Sample_LoadEx(OPENAL_FREE, ConvertFileName(":Data:Sounds:land2.ogg"), OPENAL_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
210 OPENAL_Sample_SetMinMaxDistance(samp[landsound2], 4.0f, 1000.0f);
212 samp[breaksound] = OPENAL_Sample_LoadEx(OPENAL_FREE, ConvertFileName(":Data:Sounds:broken.ogg"), OPENAL_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
213 OPENAL_Sample_SetMinMaxDistance(samp[breaksound], 8.0f, 2000.0f);
215 samp[lowwhooshsound] = OPENAL_Sample_LoadEx(OPENAL_FREE, ConvertFileName(":Data:Sounds:Lowwhoosh.ogg"), OPENAL_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
216 OPENAL_Sample_SetMinMaxDistance(samp[lowwhooshsound], 8.0f, 2000.0f);
218 samp[midwhooshsound] = OPENAL_Sample_LoadEx(OPENAL_FREE, ConvertFileName(":Data:Sounds:midwhoosh.ogg"), OPENAL_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
219 OPENAL_Sample_SetMinMaxDistance(samp[midwhooshsound], 8.0f, 2000.0f);
221 samp[highwhooshsound] = OPENAL_Sample_LoadEx(OPENAL_FREE, ConvertFileName(":Data:Sounds:highwhoosh.ogg"), OPENAL_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
222 OPENAL_Sample_SetMinMaxDistance(samp[highwhooshsound], 8.0f, 2000.0f);
224 samp[movewhooshsound] = OPENAL_Sample_LoadEx(OPENAL_FREE, ConvertFileName(":Data:Sounds:movewhoosh.ogg"), OPENAL_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
225 OPENAL_Sample_SetMinMaxDistance(samp[movewhooshsound], 8.0f, 2000.0f);
227 samp[heavyimpactsound] = OPENAL_Sample_LoadEx(OPENAL_FREE, ConvertFileName(":Data:Sounds:heavyimpact.ogg"), OPENAL_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
228 OPENAL_Sample_SetMinMaxDistance(samp[heavyimpactsound], 8.0f, 2000.0f);
230 samp[whooshhitsound] = OPENAL_Sample_LoadEx(OPENAL_FREE, ConvertFileName(":Data:Sounds:Whooshhit.ogg"), OPENAL_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
231 OPENAL_Sample_SetMinMaxDistance(samp[whooshhitsound], 8.0f, 2000.0f);
233 samp[thudsound] = OPENAL_Sample_LoadEx(OPENAL_FREE, ConvertFileName(":Data:Sounds:thud.ogg"), OPENAL_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
234 OPENAL_Sample_SetMinMaxDistance(samp[thudsound], 8.0f, 2000.0f);
236 samp[alarmsound] = OPENAL_Sample_LoadEx(OPENAL_FREE, ConvertFileName(":Data:Sounds:alarm.ogg"), OPENAL_2D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
237 OPENAL_Sample_SetMinMaxDistance(samp[alarmsound], 8.0f, 2000.0f);
239 samp[breaksound2] = OPENAL_Sample_LoadEx(OPENAL_FREE, ConvertFileName(":Data:Sounds:break.ogg"), OPENAL_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
240 OPENAL_Sample_SetMinMaxDistance(samp[breaksound2], 8.0f, 2000.0f);
242 samp[knifedrawsound] = OPENAL_Sample_LoadEx(OPENAL_FREE, ConvertFileName(":Data:Sounds:knifedraw.ogg"), OPENAL_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
243 OPENAL_Sample_SetMinMaxDistance(samp[knifedrawsound], 8.0f, 2000.0f);
245 samp[knifesheathesound] = OPENAL_Sample_LoadEx(OPENAL_FREE, ConvertFileName(":Data:Sounds:knifesheathe.ogg"), OPENAL_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
246 OPENAL_Sample_SetMinMaxDistance(samp[knifesheathesound], 8.0f, 2000.0f);
248 samp[fleshstabsound] = OPENAL_Sample_LoadEx(OPENAL_FREE, ConvertFileName(":Data:Sounds:Fleshstab.ogg"), OPENAL_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
249 OPENAL_Sample_SetMinMaxDistance(samp[fleshstabsound], 8.0f, 2000.0f);
251 samp[fleshstabremovesound] = OPENAL_Sample_LoadEx(OPENAL_FREE, ConvertFileName(":Data:Sounds:Fleshstabremove.ogg"), OPENAL_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
252 OPENAL_Sample_SetMinMaxDistance(samp[fleshstabremovesound], 8.0f, 2000.0f);
254 samp[knifeswishsound] = OPENAL_Sample_LoadEx(OPENAL_FREE, ConvertFileName(":Data:Sounds:knifeswish.ogg"), OPENAL_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
255 OPENAL_Sample_SetMinMaxDistance(samp[knifeswishsound], 8.0f, 2000.0f);
257 samp[knifeslicesound] = OPENAL_Sample_LoadEx(OPENAL_FREE, ConvertFileName(":Data:Sounds:knifeslice.ogg"), OPENAL_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
258 OPENAL_Sample_SetMinMaxDistance(samp[knifeslicesound], 8.0f, 2000.0f);
260 samp[swordslicesound] = OPENAL_Sample_LoadEx(OPENAL_FREE, ConvertFileName(":Data:Sounds:swordslice.ogg"), OPENAL_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
261 OPENAL_Sample_SetMinMaxDistance(samp[swordslicesound], 8.0f, 2000.0f);
263 samp[skidsound] = OPENAL_Sample_LoadEx(OPENAL_FREE, ConvertFileName(":Data:Sounds:skid.ogg"), OPENAL_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
264 OPENAL_Sample_SetMinMaxDistance(samp[skidsound], 8.0f, 2000.0f);
266 samp[snowskidsound] = OPENAL_Sample_LoadEx(OPENAL_FREE, ConvertFileName(":Data:Sounds:snowskid.ogg"), OPENAL_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
267 OPENAL_Sample_SetMinMaxDistance(samp[snowskidsound], 8.0f, 2000.0f);
269 samp[bushrustle] = OPENAL_Sample_LoadEx(OPENAL_FREE, ConvertFileName(":Data:Sounds:bushrustle.ogg"), OPENAL_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
270 OPENAL_Sample_SetMinMaxDistance(samp[bushrustle], 4.0f, 1000.0f);
272 samp[clank1sound] = OPENAL_Sample_LoadEx(OPENAL_FREE, ConvertFileName(":Data:Sounds:clank1.ogg"), OPENAL_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
273 OPENAL_Sample_SetMinMaxDistance(samp[clank1sound], 8.0f, 2000.0f);
275 samp[clank2sound] = OPENAL_Sample_LoadEx(OPENAL_FREE, ConvertFileName(":Data:Sounds:clank2.ogg"), OPENAL_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
276 OPENAL_Sample_SetMinMaxDistance(samp[clank2sound], 8.0f, 2000.0f);
278 samp[clank3sound] = OPENAL_Sample_LoadEx(OPENAL_FREE, ConvertFileName(":Data:Sounds:clank3.ogg"), OPENAL_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
279 OPENAL_Sample_SetMinMaxDistance(samp[clank3sound], 8.0f, 2000.0f);
281 samp[clank4sound] = OPENAL_Sample_LoadEx(OPENAL_FREE, ConvertFileName(":Data:Sounds:clank4.ogg"), OPENAL_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
282 OPENAL_Sample_SetMinMaxDistance(samp[clank4sound], 8.0f, 2000.0f);
284 samp[consolesuccesssound] = OPENAL_Sample_LoadEx(OPENAL_FREE, ConvertFileName(":Data:Sounds:consolesuccess.ogg"), OPENAL_2D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
285 OPENAL_Sample_SetMinMaxDistance(samp[consolesuccesssound], 4.0f, 1000.0f);
287 samp[consolefailsound] = OPENAL_Sample_LoadEx(OPENAL_FREE, ConvertFileName(":Data:Sounds:consolefail.ogg"), OPENAL_2D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
288 OPENAL_Sample_SetMinMaxDistance(samp[consolefailsound], 4.0f, 1000.0f);
290 samp[metalhitsound] = OPENAL_Sample_LoadEx(OPENAL_FREE, ConvertFileName(":Data:Sounds:MetalHit.ogg"), OPENAL_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
291 OPENAL_Sample_SetMinMaxDistance(samp[metalhitsound], 8.0f, 2000.0f);
293 samp[clawslicesound] = OPENAL_Sample_LoadEx(OPENAL_FREE, ConvertFileName(":Data:Sounds:clawslice.ogg"), OPENAL_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
294 OPENAL_Sample_SetMinMaxDistance(samp[clawslicesound], 8.0f, 2000.0f);
296 samp[splattersound] = OPENAL_Sample_LoadEx(OPENAL_FREE, ConvertFileName(":Data:Sounds:splatter.ogg"), OPENAL_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
297 OPENAL_Sample_SetMinMaxDistance(samp[splattersound], 8.0f, 2000.0f);
299 samp[growlsound] = OPENAL_Sample_LoadEx(OPENAL_FREE, ConvertFileName(":Data:Sounds:Growl.ogg"), OPENAL_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
300 OPENAL_Sample_SetMinMaxDistance(samp[growlsound], 1000.0f, 2000.0f);
302 samp[growl2sound] = OPENAL_Sample_LoadEx(OPENAL_FREE, ConvertFileName(":Data:Sounds:Growl2.ogg"), OPENAL_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
303 OPENAL_Sample_SetMinMaxDistance(samp[growl2sound], 1000.0f, 2000.0f);
305 samp[barksound] = OPENAL_Sample_LoadEx(OPENAL_FREE, ConvertFileName(":Data:Sounds:bark.ogg"), OPENAL_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
306 OPENAL_Sample_SetMinMaxDistance(samp[barksound], 1000.0f, 2000.0f);
308 samp[bark2sound] = OPENAL_Sample_LoadEx(OPENAL_FREE, ConvertFileName(":Data:Sounds:bark2.ogg"), OPENAL_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
309 OPENAL_Sample_SetMinMaxDistance(samp[bark2sound], 1000.0f, 2000.0f);
311 samp[bark3sound] = OPENAL_Sample_LoadEx(OPENAL_FREE, ConvertFileName(":Data:Sounds:bark3.ogg"), OPENAL_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
312 OPENAL_Sample_SetMinMaxDistance(samp[bark3sound], 1000.0f, 2000.0f);
314 samp[snarlsound] = OPENAL_Sample_LoadEx(OPENAL_FREE, ConvertFileName(":Data:Sounds:snarl.ogg"), OPENAL_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
315 OPENAL_Sample_SetMinMaxDistance(samp[snarlsound], 1000.0f, 2000.0f);
318 samp[snarl2sound] = OPENAL_Sample_LoadEx(OPENAL_FREE, ConvertFileName(":Data:Sounds:snarl2.ogg"), OPENAL_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
319 OPENAL_Sample_SetMinMaxDistance(samp[snarl2sound], 1000.0f, 2000.0f);
321 samp[barkgrowlsound] = OPENAL_Sample_LoadEx(OPENAL_FREE, ConvertFileName(":Data:Sounds:barkgrowl.ogg"), OPENAL_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
322 OPENAL_Sample_SetMinMaxDistance(samp[barkgrowlsound], 1000.0f, 2000.0f);
324 samp[rabbitattacksound] = OPENAL_Sample_LoadEx(OPENAL_FREE, ConvertFileName(":Data:Sounds:rabbitattack.ogg"), OPENAL_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
325 OPENAL_Sample_SetMinMaxDistance(samp[rabbitattacksound], 1000.0f, 2000.0f);
327 samp[rabbitattack2sound] = OPENAL_Sample_LoadEx(OPENAL_FREE, ConvertFileName(":Data:Sounds:rabbitattack2.ogg"), OPENAL_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
328 OPENAL_Sample_SetMinMaxDistance(samp[rabbitattack2sound], 1000.0f, 2000.0f);
330 samp[rabbitattack3sound] = OPENAL_Sample_LoadEx(OPENAL_FREE, ConvertFileName(":Data:Sounds:rabbitattack3.ogg"), OPENAL_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
331 OPENAL_Sample_SetMinMaxDistance(samp[rabbitattack3sound], 1000.0f, 2000.0f);
333 samp[rabbitattack4sound] = OPENAL_Sample_LoadEx(OPENAL_FREE, ConvertFileName(":Data:Sounds:rabbitattack4.ogg"), OPENAL_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
334 OPENAL_Sample_SetMinMaxDistance(samp[rabbitattack4sound], 1000.0f, 2000.0f);
336 samp[rabbitpainsound] = OPENAL_Sample_LoadEx(OPENAL_FREE, ConvertFileName(":Data:Sounds:rabbitpain.ogg"), OPENAL_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
337 OPENAL_Sample_SetMinMaxDistance(samp[rabbitpainsound], 1000.0f, 2000.0f);
339 samp[rabbitpain1sound] = OPENAL_Sample_LoadEx(OPENAL_FREE, ConvertFileName(":Data:Sounds:rabbitpain2.ogg"), OPENAL_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
340 OPENAL_Sample_SetMinMaxDistance(samp[rabbitpain1sound], 1000.0f, 2000.0f);
342 /*samp[rabbitpain2sound] = OPENAL_Sample_LoadEx(OPENAL_FREE, ConvertFileName(":Data:Sounds:rabbitpain2.ogg"), OPENAL_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
343 OPENAL_Sample_SetMinMaxDistance(samp[rabbitpain2sound], 1000.0f, 2000.0f);
345 samp[rabbitchitter] = OPENAL_Sample_LoadEx(OPENAL_FREE, ConvertFileName(":Data:Sounds:rabbitchitter.ogg"), OPENAL_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
346 OPENAL_Sample_SetMinMaxDistance(samp[rabbitchitter], 1000.0f, 2000.0f);
348 samp[rabbitchitter2] = OPENAL_Sample_LoadEx(OPENAL_FREE, ConvertFileName(":Data:Sounds:rabbitchitter2.ogg"), OPENAL_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
349 OPENAL_Sample_SetMinMaxDistance(samp[rabbitchitter2], 1000.0f, 2000.0f);
351 samp[swordstaffsound] = OPENAL_Sample_LoadEx(OPENAL_FREE, ConvertFileName(":Data:Sounds:swordstaff.ogg"), OPENAL_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
352 OPENAL_Sample_SetMinMaxDistance(samp[swordstaffsound], 8.0f, 2000.0f);
354 samp[staffbodysound] = OPENAL_Sample_LoadEx(OPENAL_FREE, ConvertFileName(":Data:Sounds:staffbody.ogg"), OPENAL_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
355 OPENAL_Sample_SetMinMaxDistance(samp[staffbodysound], 8.0f, 2000.0f);
357 samp[staffheadsound] = OPENAL_Sample_LoadEx(OPENAL_FREE, ConvertFileName(":Data:Sounds:staffhead.ogg"), OPENAL_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
358 OPENAL_Sample_SetMinMaxDistance(samp[staffheadsound], 8.0f, 2000.0f);
360 samp[staffbreaksound] = OPENAL_Sample_LoadEx(OPENAL_FREE, ConvertFileName(":Data:Sounds:staffbreak.wav"), OPENAL_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
361 OPENAL_Sample_SetMinMaxDistance(samp[staffbreaksound], 8.0f, 2000.0f);
364 void Game::LoadTexture(const char *fileName, GLuint *textureid,int mipmap, bool hasalpha)
370 LOG(std::string("Loading texture...") + fileName);
372 // Fix filename so that is os appropreate
373 char * fixedFN = ConvertFileName(fileName);
375 unsigned char fileNamep[256];
376 CopyCStringToPascal(fixedFN, fileNamep);
378 upload_image( fileNamep ,hasalpha);
380 // std::string fname(fileName);
381 // std::transform(fname.begin(), fname.end(), tolower);
382 // TexIter it = textures.find(fname);
386 //if(textures.end() == it)
389 if ( texture.bpp == 24 )
394 glPixelStorei( GL_UNPACK_ALIGNMENT, 1 );
397 glGenTextures( 1, textureid );
398 glTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE );
400 glBindTexture( GL_TEXTURE_2D, *textureid);
401 glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR );
402 if(trilinear)if(mipmap)glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR );
403 if(!trilinear)if(mipmap)glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_NEAREST );
404 if(!mipmap)glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR );
406 gluBuild2DMipmaps( GL_TEXTURE_2D, type, texture.sizeX, texture.sizeY, type, GL_UNSIGNED_BYTE, texture.data );
410 void Game::LoadTextureSave(const char *fileName, GLuint *textureid,int mipmap,GLubyte *array, int *skinsize)
418 LOG(std::string("Loading texture (S)...") + fileName);
421 unsigned char fileNamep[256];
422 CopyCStringToPascal(ConvertFileName(fileName), fileNamep);
424 upload_image( fileNamep ,0);
425 //LoadTGA( fileName );
427 // std::string fname(fileName);
428 // std::transform(fname.begin(), fname.end(), tolower);
429 // TexIter it = textures.find(fname);
433 //if(textures.end() == it)
435 bytesPerPixel=texture.bpp/8;
438 if ( texture.bpp == 24 )
443 glPixelStorei( GL_UNPACK_ALIGNMENT, 1 );
445 if(!*textureid)glGenTextures( 1, textureid );
446 glTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE );
448 glBindTexture( GL_TEXTURE_2D, *textureid);
449 glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR );
450 if(trilinear)if(mipmap)glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR );
451 if(!trilinear)if(mipmap)glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_NEAREST );
452 if(!mipmap)glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR );
455 for(i=0;i<(int)(texture.sizeY*texture.sizeX*bytesPerPixel);i++){
456 if((i+1)%4||type==GL_RGB){
457 array[tempnum]=texture.data[i];
462 *skinsize=texture.sizeX;
464 gluBuild2DMipmaps( GL_TEXTURE_2D, type, texture.sizeX, texture.sizeY, GL_RGB, GL_UNSIGNED_BYTE, array );
466 // textures.insert(std::make_pair(fname, *textureid));
470 // *textureid = it->second;
474 void Game::LoadSave(const char *fileName, GLuint *textureid,bool mipmap,GLubyte *array, int *skinsize)
481 LOG(std::string("Loading (S)...") + fileName);
484 float temptexdetail=texdetail;
486 //upload_image( fileName );
487 //LoadTGA( fileName );
489 // Converting file to something os specific
490 char * fixedFN = ConvertFileName(fileName);
493 unsigned char fileNamep[256];
494 CopyCStringToPascal(fixedFN, fileNamep);
496 upload_image( fileNamep ,0);
497 texdetail=temptexdetail;
501 bytesPerPixel=texture.bpp/8;
504 for(i=0;i<(int)(texture.sizeY*texture.sizeX*bytesPerPixel);i++){
505 if((i+1)%4||bytesPerPixel==3){
506 array[tempnum]=texture.data[i];
513 bool Game::AddClothes(const char *fileName, GLuint *textureid,bool mipmap,GLubyte *array, int *skinsize)
520 //upload_image( fileName );
521 //LoadTGA( fileName );
523 unsigned char fileNamep[256];
524 CopyCStringToPascal(fileName,fileNamep);
527 opened=upload_image( fileNamep ,1);
540 bytesPerPixel=texture.bpp/8;
544 for(i=0;i<(int)(texture.sizeY*texture.sizeX*bytesPerPixel);i++){
545 if(bytesPerPixel==3)alphanum=255;
546 else if((i+1)%4==0)alphanum=texture.data[i];
548 if((i+1)%4||bytesPerPixel==3){
549 if((i%4)==0)texture.data[i]*=tintr;
550 if((i%4)==1)texture.data[i]*=tintg;
551 if((i%4)==2)texture.data[i]*=tintb;
552 array[tempnum]=(float)array[tempnum]*(1-alphanum/255)+(float)texture.data[i]*(alphanum/255);
562 //***************> ResizeGLScene() <******/
563 GLvoid Game::ReSizeGLScene(float fov, float pnear)
570 glViewport(0,0,screenwidth,screenheight);
572 glMatrixMode(GL_PROJECTION);
575 gluPerspective(fov,(GLfloat)screenwidth/(GLfloat)screenheight,pnear,viewdistance);
577 glMatrixMode(GL_MODELVIEW);
581 void Game::LoadingScreen()
583 static float loadprogress,minprogress,maxprogress;
584 static AbsoluteTime time = {0,0};
585 static AbsoluteTime frametime = {0,0};
586 AbsoluteTime currTime = UpTime ();
587 double deltaTime = (float) AbsoluteDeltaToDuration (currTime, frametime);
589 if (0 > deltaTime) // if negative microseconds
590 deltaTime /= -1000000.0;
591 else // else milliseconds
594 multiplier=deltaTime;
595 if(multiplier<.001)multiplier=.001;
596 if(multiplier>10)multiplier=10;
598 frametime = currTime; // reset for next time interval
603 glClearColor(0,0,0,1);
604 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
607 loadtime+=multiplier*4;
609 loadprogress=loadtime;
610 if(loadprogress>100)loadprogress=100;
612 //loadprogress=abs(Random()%100);
616 glEnable(GL_TEXTURE_2D);
617 glBindTexture( GL_TEXTURE_2D, loadscreentexture);
618 glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT );
619 glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT );
620 glDisable(GL_DEPTH_TEST); // Disables Depth Testing
621 glDisable(GL_CULL_FACE);
622 glDisable(GL_LIGHTING);
624 glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
625 glPushMatrix(); // Store The Projection Matrix
626 glLoadIdentity(); // Reset The Projection Matrix
627 glOrtho(0,screenwidth,0,screenheight,-100,100); // Set Up An Ortho Screen
628 glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
629 glPushMatrix(); // Store The Modelview Matrix
630 glLoadIdentity(); // Reset The Modelview Matrix
631 glTranslatef(screenwidth/2,screenheight/2,0);
632 glScalef((float)screenwidth/2,(float)screenheight/2,1);
633 glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
635 glColor4f(loadprogress/100,loadprogress/100,loadprogress/100,1);
636 //glColor4f(1,1,1,1);
637 /*if(loadscreencolor==0)glColor4f(1,1,1,1);
638 if(loadscreencolor==1)glColor4f(1,0,0,1);
639 if(loadscreencolor==2)glColor4f(0,1,0,1);
640 if(loadscreencolor==3)glColor4f(0,0,1,1);
641 if(loadscreencolor==4)glColor4f(1,1,0,1);
642 if(loadscreencolor==5)glColor4f(1,0,1,1);
645 //glScalef(.25,.25,.25);
647 glTexCoord2f(.1-loadprogress/100,0+loadprogress/100+.3);
648 glVertex3f(-1, -1, 0.0f);
649 glTexCoord2f(.1-loadprogress/100,0+loadprogress/100+.3);
650 glVertex3f(1, -1, 0.0f);
651 glTexCoord2f(.1-loadprogress/100,1+loadprogress/100+.3);
652 glVertex3f(1, 1, 0.0f);
653 glTexCoord2f(.1-loadprogress/100,1+loadprogress/100+.3);
654 glVertex3f(-1, 1, 0.0f);
659 //glScalef(.25,.25,.25);
661 glTexCoord2f(.4+loadprogress/100,0+loadprogress/100);
662 glVertex3f(-1, -1, 0.0f);
663 glTexCoord2f(.4+loadprogress/100,0+loadprogress/100);
664 glVertex3f(1, -1, 0.0f);
665 glTexCoord2f(.4+loadprogress/100,1+loadprogress/100);
666 glVertex3f(1, 1, 0.0f);
667 glTexCoord2f(.4+loadprogress/100,1+loadprogress/100);
668 glVertex3f(-1, 1, 0.0f);
671 glDisable(GL_TEXTURE_2D);
672 glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
673 glPopMatrix(); // Restore The Old Projection Matrix
674 glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
675 glPopMatrix(); // Restore The Old Projection Matrix
679 glEnable(GL_TEXTURE_2D);
680 glBindTexture( GL_TEXTURE_2D, loadscreentexture);
681 glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT );
682 glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT );
683 glDisable(GL_DEPTH_TEST); // Disables Depth Testing
684 glDisable(GL_CULL_FACE);
685 glDisable(GL_LIGHTING);
687 glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
688 glPushMatrix(); // Store The Projection Matrix
689 glLoadIdentity(); // Reset The Projection Matrix
690 glOrtho(0,screenwidth,0,screenheight,-100,100); // Set Up An Ortho Screen
691 glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
692 glPushMatrix(); // Store The Modelview Matrix
693 glLoadIdentity(); // Reset The Modelview Matrix
694 glTranslatef(screenwidth/2,screenheight/2,0);
695 glScalef((float)screenwidth/2*(1.5-(loadprogress)/200),(float)screenheight/2*(1.5-(loadprogress)/200),1);
696 glBlendFunc(GL_SRC_ALPHA,GL_ONE);
698 //glColor4f(loadprogress/100,loadprogress/100,loadprogress/100,1);
699 glColor4f(loadprogress/100,loadprogress/100,loadprogress/100,1);
700 /*if(loadscreencolor==0)glColor4f(1,1,1,1);
701 if(loadscreencolor==1)glColor4f(1,0,0,1);
702 if(loadscreencolor==2)glColor4f(0,1,0,1);
703 if(loadscreencolor==3)glColor4f(0,0,1,1);
704 if(loadscreencolor==4)glColor4f(1,1,0,1);
705 if(loadscreencolor==5)glColor4f(1,0,1,1);
708 //glScalef(.25,.25,.25);
710 glTexCoord2f(0+.5,0+.5);
711 glVertex3f(-1, -1, 0.0f);
712 glTexCoord2f(1+.5,0+.5);
713 glVertex3f(1, -1, 0.0f);
714 glTexCoord2f(1+.5,1+.5);
715 glVertex3f(1, 1, 0.0f);
716 glTexCoord2f(0+.5,1+.5);
717 glVertex3f(-1, 1, 0.0f);
720 glDisable(GL_TEXTURE_2D);
721 glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
722 glPopMatrix(); // Restore The Old Projection Matrix
723 glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
724 glPopMatrix(); // Restore The Old Projection Matrix
728 glEnable(GL_TEXTURE_2D);
729 glBindTexture( GL_TEXTURE_2D, loadscreentexture);
730 glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT );
731 glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT );
732 glDisable(GL_DEPTH_TEST); // Disables Depth Testing
733 glDisable(GL_CULL_FACE);
734 glDisable(GL_LIGHTING);
736 glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
737 glPushMatrix(); // Store The Projection Matrix
738 glLoadIdentity(); // Reset The Projection Matrix
739 glOrtho(0,screenwidth,0,screenheight,-100,100); // Set Up An Ortho Screen
740 glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
741 glPushMatrix(); // Store The Modelview Matrix
742 glLoadIdentity(); // Reset The Modelview Matrix
743 glTranslatef(screenwidth/2,screenheight/2,0);
744 glScalef((float)screenwidth/2*(100+loadprogress)/100,(float)screenheight/2*(100+loadprogress)/100,1);
745 glBlendFunc(GL_SRC_ALPHA,GL_ONE);
747 glColor4f(loadprogress/100,loadprogress/100,loadprogress/100,.4);
749 //glScalef(.25,.25,.25);
751 glTexCoord2f(0+.2,0+.8);
752 glVertex3f(-1, -1, 0.0f);
753 glTexCoord2f(1+.2,0+.8);
754 glVertex3f(1, -1, 0.0f);
755 glTexCoord2f(1+.2,1+.8);
756 glVertex3f(1, 1, 0.0f);
757 glTexCoord2f(0+.2,1+.8);
758 glVertex3f(-1, 1, 0.0f);
761 glDisable(GL_TEXTURE_2D);
762 glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
763 glPopMatrix(); // Restore The Old Projection Matrix
764 glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
765 glPopMatrix(); // Restore The Old Projection Matrix
771 glEnable(GL_TEXTURE_2D);
772 static char string[256]="";
773 sprintf (string, "LOADING... %d%",(int)loadprogress);
775 text.glPrint(280-280*loadprogress/100/2/4,125-125*loadprogress/100/2/4,string,1,1+loadprogress/100,640,480);
776 glColor4f(1.2-loadprogress/100,1.2-loadprogress/100,1.2-loadprogress/100,1);
777 text.glPrint(280,125,string,1,1,640,480);
781 if(flashamount>1)flashamount=1;
782 if(flashdelay<=0)flashamount-=multiplier;
784 if(flashamount<0)flashamount=0;
785 glDisable(GL_DEPTH_TEST); // Disables Depth Testing
786 glDisable(GL_CULL_FACE);
787 glDisable(GL_LIGHTING);
788 glDisable(GL_TEXTURE_2D);
790 glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
791 glPushMatrix(); // Store The Projection Matrix
792 glLoadIdentity(); // Reset The Projection Matrix
793 glOrtho(0,screenwidth,0,screenheight,-100,100); // Set Up An Ortho Screen
794 glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
795 glPushMatrix(); // Store The Modelview Matrix
796 glLoadIdentity(); // Reset The Modelview Matrix
797 glScalef(screenwidth,screenheight,1);
798 glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
800 glColor4f(flashr,flashg,flashb,flashamount);
802 glVertex3f(0, 0, 0.0f);
803 glVertex3f(256, 0, 0.0f);
804 glVertex3f(256, 256, 0.0f);
805 glVertex3f(0, 256, 0.0f);
807 glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
808 glPopMatrix(); // Restore The Old Projection Matrix
809 glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
810 glPopMatrix(); // Restore The Old Projection Matrix
811 glEnable(GL_DEPTH_TEST); // Enables Depth Testing
812 glEnable(GL_CULL_FACE);
822 void Game::FadeLoadingScreen(float howmuch)
824 static float loadprogress,minprogress,maxprogress;
829 glClearColor(0,0,0,1);
830 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
832 loadprogress=howmuch;
834 //loadprogress=abs(Random()%100);
838 //glEnable(GL_TEXTURE_2D);
839 glDisable(GL_TEXTURE_2D);
840 //glBindTexture( GL_TEXTURE_2D, loadscreentexture);
841 glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE );
842 glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE );
843 glDisable(GL_DEPTH_TEST); // Disables Depth Testing
844 glDisable(GL_CULL_FACE);
845 glDisable(GL_LIGHTING);
847 glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
848 glPushMatrix(); // Store The Projection Matrix
849 glLoadIdentity(); // Reset The Projection Matrix
850 glOrtho(0,screenwidth,0,screenheight,-100,100); // Set Up An Ortho Screen
851 glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
852 glPushMatrix(); // Store The Modelview Matrix
853 glLoadIdentity(); // Reset The Modelview Matrix
854 glTranslatef(screenwidth/2,screenheight/2,0);
855 glScalef((float)screenwidth/2,(float)screenheight/2,1);
856 glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
858 glColor4f(loadprogress/100,0,0,1);
859 /*if(loadscreencolor==0)glColor4f(1,1,1,1);
860 if(loadscreencolor==1)glColor4f(1,0,0,1);
861 if(loadscreencolor==2)glColor4f(0,1,0,1);
862 if(loadscreencolor==3)glColor4f(0,0,1,1);
863 if(loadscreencolor==4)glColor4f(1,1,0,1);
864 if(loadscreencolor==5)glColor4f(1,0,1,1);
867 //glScalef(.25,.25,.25);
870 glVertex3f(-1, -1, 0.0f);
872 glVertex3f(1, -1, 0.0f);
874 glVertex3f(1, 1, 0.0f);
876 glVertex3f(-1, 1, 0.0f);
879 glDisable(GL_TEXTURE_2D);
880 glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
881 glPopMatrix(); // Restore The Old Projection Matrix
882 glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
883 glPopMatrix(); // Restore The Old Projection Matrix
888 glEnable(GL_TEXTURE_2D);
889 static char string[256]="";
890 sprintf (string, "LOADING... %d%",(int)loadprogress);
892 text.glPrint(280-280*loadprogress/100/2/4,125-125*loadprogress/100/2/4,string,1,1+loadprogress/100,640,480);
893 glColor4f(1.2-loadprogress/100,1.2-loadprogress/100,1.2-loadprogress/100,1);
894 text.glPrint(280,125,string,1,1,640,480);
901 void Game::InitGame()
904 ProcessSerialNumber PSN;
905 ProcessInfoRec pinfo;
908 /* set up process serial number */
909 PSN.highLongOfPSN = 0;
910 PSN.lowLongOfPSN = kCurrentProcess;
911 /* set up info block */
912 pinfo.processInfoLength = sizeof(pinfo);
913 pinfo.processName = NULL;
914 pinfo.processAppSpec = &pspec;
915 /* grab the vrefnum and directory */
916 err = GetProcessInformation(&PSN, &pinfo);
918 vRefNum = pspec.vRefNum;
929 numchallengelevels=14;
931 accountactive=Account::loadFile(":Data:Users");
937 whichjointstartarray[0]=righthip;
938 whichjointendarray[0]=rightfoot;
940 whichjointstartarray[1]=righthip;
941 whichjointendarray[1]=rightankle;
943 whichjointstartarray[2]=righthip;
944 whichjointendarray[2]=rightknee;
946 whichjointstartarray[3]=rightknee;
947 whichjointendarray[3]=rightankle;
949 whichjointstartarray[4]=rightankle;
950 whichjointendarray[4]=rightfoot;
952 whichjointstartarray[5]=lefthip;
953 whichjointendarray[5]=leftfoot;
955 whichjointstartarray[6]=lefthip;
956 whichjointendarray[6]=leftankle;
958 whichjointstartarray[7]=lefthip;
959 whichjointendarray[7]=leftknee;
961 whichjointstartarray[8]=leftknee;
962 whichjointendarray[8]=leftankle;
964 whichjointstartarray[9]=leftankle;
965 whichjointendarray[9]=leftfoot;
967 whichjointstartarray[10]=abdomen;
968 whichjointendarray[10]=rightshoulder;
970 whichjointstartarray[11]=abdomen;
971 whichjointendarray[11]=rightelbow;
973 whichjointstartarray[12]=abdomen;
974 whichjointendarray[12]=rightwrist;
976 whichjointstartarray[13]=abdomen;
977 whichjointendarray[13]=righthand;
979 whichjointstartarray[14]=rightshoulder;
980 whichjointendarray[14]=rightelbow;
982 whichjointstartarray[15]=rightelbow;
983 whichjointendarray[15]=rightwrist;
985 whichjointstartarray[16]=rightwrist;
986 whichjointendarray[16]=righthand;
988 whichjointstartarray[17]=abdomen;
989 whichjointendarray[17]=leftshoulder;
991 whichjointstartarray[18]=abdomen;
992 whichjointendarray[18]=leftelbow;
994 whichjointstartarray[19]=abdomen;
995 whichjointendarray[19]=leftwrist;
997 whichjointstartarray[20]=abdomen;
998 whichjointendarray[20]=lefthand;
1000 whichjointstartarray[21]=leftshoulder;
1001 whichjointendarray[21]=leftelbow;
1003 whichjointstartarray[22]=leftelbow;
1004 whichjointendarray[22]=leftwrist;
1006 whichjointstartarray[23]=leftwrist;
1007 whichjointendarray[23]=lefthand;
1009 whichjointstartarray[24]=abdomen;
1010 whichjointendarray[24]=neck;
1012 whichjointstartarray[25]=neck;
1013 whichjointendarray[25]=head;
1015 FadeLoadingScreen(0);
1019 texture.data = ( GLubyte* )malloc( 1024*1024*4 );
1021 int temptexdetail=texdetail;
1023 text.LoadFontTexture(":Data:Textures:Font.png");
1025 texdetail=temptexdetail;
1027 FadeLoadingScreen(10);
1043 for (int it = 0; it < 100; ++it)
1048 for (int it = 0; it < 20; ++it)
1053 LOG("Initializing sound system...");
1058 extern bool cmdline(const char *cmd);
1059 unsigned char rc = 0;
1060 output = OPENAL_OUTPUT_ALSA; // Try alsa first...
1061 if (cmdline("forceoss")) // ...but let user override that.
1062 output = OPENAL_OUTPUT_OSS;
1063 else if (cmdline("nosound"))
1064 output = OPENAL_OUTPUT_NOSOUND;
1066 OPENAL_SetOutput(output);
1067 if ((rc = OPENAL_Init(44100, 32, 0)) == false)
1069 // if we tried ALSA and failed, fall back to OSS.
1070 if ( (output == OPENAL_OUTPUT_ALSA) && (!cmdline("forcealsa")) )
1073 output = OPENAL_OUTPUT_OSS;
1074 OPENAL_SetOutput(output);
1075 rc = OPENAL_Init(44100, 32, 0);
1082 output = OPENAL_OUTPUT_NOSOUND; // we tried! just do silence.
1083 OPENAL_SetOutput(output);
1084 rc = OPENAL_Init(44100, 32, 0);
1087 OPENAL_Init(44100, 32, 0);
1090 OPENAL_SetSFXMasterVolume((int)(volume*255));
1092 strm[stream_music3] = OPENAL_Stream_Open(ConvertFileName(":Data:Sounds:music3.mp3"), OPENAL_2D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=0;}
1093 // OPENAL_Sample_SetMinMaxDistance(strm[stream_music3], 4.0f, 1000.0f);
1094 OPENAL_Stream_SetMode(strm[stream_music3], OPENAL_LOOP_NORMAL);
1097 // PlaySoundEx( stream_music3, strm[stream_music3], NULL, true);
1098 PlayStreamEx(stream_music3, strm[stream_music3], 0, true);
1099 OPENAL_SetPaused(channels[stream_music3], false);
1100 OPENAL_SetVolume(channels[stream_music3], 256);
1103 FadeLoadingScreen(20);
1106 strm[stream_wind] = OPENAL_Stream_Open(ConvertFileName(":Data:Sounds:wind.mp3"), OPENAL_2D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
1107 // OPENAL_Sample_SetMinMaxDistance(strm[stream_wind], 4.0f, 1000.0f);
1108 OPENAL_Stream_SetMode(strm[stream_wind], OPENAL_LOOP_NORMAL);
1110 FadeLoadingScreen(30);
1112 strm[stream_desertambient] = OPENAL_Stream_Open(ConvertFileName(":Data:Sounds:desertambient.mp3"), OPENAL_2D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
1113 // OPENAL_Sample_SetMinMaxDistance(strm[stream_desertambient], 4.0f, 1000.0f);
1114 OPENAL_Stream_SetMode(strm[stream_desertambient], OPENAL_LOOP_NORMAL);
1117 FadeLoadingScreen(40);
1119 samp[firestartsound] = OPENAL_Sample_Load(OPENAL_FREE, ConvertFileName(":Data:Sounds:firestart.ogg"), OPENAL_2D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
1120 OPENAL_Sample_SetMinMaxDistance(samp[firestartsound], 8.0f, 2000.0f);
1122 strm[stream_firesound] = OPENAL_Stream_Open(ConvertFileName(":Data:Sounds:fire.ogg"), OPENAL_2D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
1123 // OPENAL_Sample_SetMinMaxDistance(strm[stream_firesound], 8.0f, 2000.0f);
1124 OPENAL_Stream_SetMode(strm[stream_firesound], OPENAL_LOOP_NORMAL);
1126 FadeLoadingScreen(50);
1128 samp[fireendsound] = OPENAL_Sample_Load(OPENAL_FREE, ConvertFileName(":Data:Sounds:fireend.ogg"), OPENAL_2D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
1129 OPENAL_Sample_SetMinMaxDistance(samp[fireendsound], 8.0f, 2000.0f);
1132 strm[stream_music1grass] = OPENAL_Stream_Open(ConvertFileName(":Data:Sounds:music1grass.mp3"), OPENAL_2D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=1;}
1133 // OPENAL_Sample_SetMinMaxDistance(strm[stream_music1grass], 4.0f, 1000.0f);
1134 OPENAL_Stream_SetMode(strm[stream_music1grass], OPENAL_LOOP_NORMAL);
1136 strm[stream_music1snow] = OPENAL_Stream_Open(ConvertFileName(":Data:Sounds:music1snow.mp3"), OPENAL_2D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=2;}
1137 // OPENAL_Sample_SetMinMaxDistance(strm[stream_music1snow], 4.0f, 1000.0f);
1138 OPENAL_Stream_SetMode(strm[stream_music1snow], OPENAL_LOOP_NORMAL);
1140 FadeLoadingScreen(60);
1142 strm[stream_music1desert] = OPENAL_Stream_Open(ConvertFileName(":Data:Sounds:music1desert.mp3"), OPENAL_2D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=3;}
1143 // OPENAL_Sample_SetMinMaxDistance(strm[stream_music1desert], 4.0f, 1000.0f);
1144 OPENAL_Stream_SetMode(strm[stream_music1desert], OPENAL_LOOP_NORMAL);
1146 FadeLoadingScreen(80);
1147 strm[stream_music2] = OPENAL_Stream_Open(ConvertFileName(":Data:Sounds:music2.ogg"), OPENAL_2D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=4;}
1148 // OPENAL_Sample_SetMinMaxDistance(strm[stream_music2], 4.0f, 1000.0f);
1149 OPENAL_Stream_SetMode(strm[stream_music2], OPENAL_LOOP_NORMAL);
1154 FadeLoadingScreen(90);
1157 LoadTexture(":Data:Textures:Cursor.png",&cursortexture,0,1);
1159 LoadTexture(":Data:Textures:MapCircle.png",&Mapcircletexture,0,1);
1160 LoadTexture(":Data:Textures:MapBox.png",&Mapboxtexture,0,1);
1161 LoadTexture(":Data:Textures:MapArrow.png",&Maparrowtexture,0,1);
1163 temptexdetail=texdetail;
1164 if(texdetail>2)texdetail=2;
1165 LoadTexture(":Data:Textures:Lugaru.png",&Mainmenuitems[0],0,0);
1166 LoadTexture(":Data:Textures:Newgame.png",&Mainmenuitems[1],0,0);
1167 LoadTexture(":Data:Textures:Options.png",&Mainmenuitems[2],0,0);
1168 LoadTexture(":Data:Textures:Quit.png",&Mainmenuitems[3],0,0);
1169 LoadTexture(":Data:Textures:World.png",&Mainmenuitems[7],0,0);
1170 LoadTexture(":Data:Textures:Eyelid.png",&Mainmenuitems[4],0,1);
1171 //LoadTexture(":Data:Textures:Eye.jpg",&Mainmenuitems[5],0,1);
1172 texdetail=temptexdetail;
1177 FadeLoadingScreen(95);
1188 newscreenwidth=screenwidth;
1189 newscreenheight=screenheight;
1193 void Game::LoadStuff()
1195 static float temptexdetail;
1196 static float viewdistdetail;
1197 static int i,j,texsize;
1204 /*musicvolume[3]=512;
1205 PlaySoundEx( music4, samp[music4], NULL, true);
1206 OPENAL_SetPaused(channels[music4], false);
1207 OPENAL_SetVolume(channels[music4], 512);
1213 //texture.data = ( GLubyte* )malloc( 1024*1024*4 );
1215 for(i=0;i<maxplayers;i++)
1217 if (glIsTexture(player[i].skeleton.drawmodel.textureptr))
1219 glDeleteTextures(1, &player[i].skeleton.drawmodel.textureptr);
1221 player[i].skeleton.drawmodel.textureptr=0;;
1224 //temptexdetail=texdetail;
1227 LoadTexture(":Data:Textures:fire.jpg",&loadscreentexture,1,0);
1228 //texdetail=temptexdetail;
1230 temptexdetail=texdetail;
1232 text.LoadFontTexture(":Data:Textures:Font.png");
1234 texdetail=temptexdetail;
1239 viewdistance=50*megascale*viewdistdetail;
1259 realtexdetail=texdetail;
1262 if(texdetail<1)texdetail=1;
1263 realtexdetail=texdetail*4;
1269 /*LoadTexture(":Data:Textures:snow.png",&terraintexture,1);
1271 LoadTexture(":Data:Textures:rock.png",&terraintexture2,1);
1273 LoadTexture(":Data:Textures:detail.png",&terraintexture3,1);
1277 LOG("Loading weapon data...");
1279 LoadTexture(":Data:Textures:knife.png",&weapons.knifetextureptr,0,1);
1280 LoadTexture(":Data:Textures:bloodknife.png",&weapons.bloodknifetextureptr,0,1);
1281 LoadTexture(":Data:Textures:lightbloodknife.png",&weapons.lightbloodknifetextureptr,0,1);
1282 LoadTexture(":Data:Textures:sword.jpg",&weapons.swordtextureptr,1,0);
1283 LoadTexture(":Data:Textures:Swordblood.jpg",&weapons.bloodswordtextureptr,1,0);
1284 LoadTexture(":Data:Textures:Swordbloodlight.jpg",&weapons.lightbloodswordtextureptr,1,0);
1285 LoadTexture(":Data:Textures:Staff.jpg",&weapons.stafftextureptr,1,0);
1287 weapons.throwingknifemodel.load((char *)":Data:Models:throwingknife.solid",1);
1288 weapons.throwingknifemodel.Scale(.001,.001,.001);
1289 //weapons.throwingknifemodel.Rotate(0,0,-90);
1290 weapons.throwingknifemodel.Rotate(90,0,0);
1291 weapons.throwingknifemodel.Rotate(0,90,0);
1292 weapons.throwingknifemodel.flat=0;
1293 weapons.throwingknifemodel.CalculateNormals(1);
1294 //weapons.throwingknifemodel.ScaleNormals(-1,-1,-1);
1296 weapons.swordmodel.load((char *)":Data:Models:sword.solid",1);
1297 weapons.swordmodel.Scale(.001,.001,.001);
1298 //weapons.swordmodel.Rotate(0,0,-90);
1299 weapons.swordmodel.Rotate(90,0,0);
1300 weapons.swordmodel.Rotate(0,90,0);
1301 weapons.swordmodel.Rotate(0,0,90);
1302 weapons.swordmodel.flat=1;
1303 weapons.swordmodel.CalculateNormals(1);
1304 //weapons.swordmodel.ScaleNormals(-1,-1,-1);
1306 weapons.staffmodel.load((char *)":Data:Models:staff.solid",1);
1307 weapons.staffmodel.Scale(.005,.005,.005);
1308 //weapons.staffmodel.Rotate(0,0,-90);
1309 weapons.staffmodel.Rotate(90,0,0);
1310 weapons.staffmodel.Rotate(0,90,0);
1311 weapons.staffmodel.Rotate(0,0,90);
1312 weapons.staffmodel.flat=1;
1313 weapons.staffmodel.CalculateNormals(1);
1314 //weapons.staffmodel.ScaleNormals(-1,-1,-1);
1316 //temptexdetail=texdetail;
1317 //if(texdetail>4)texdetail=4;
1318 LoadTexture(":Data:Textures:shadow.png",&terrain.shadowtexture,0,1);
1320 LoadTexture(":Data:Textures:blood.png",&terrain.bloodtexture,0,1);
1322 LoadTexture(":Data:Textures:break.png",&terrain.breaktexture,0,1);
1324 LoadTexture(":Data:Textures:blood.png",&terrain.bloodtexture2,0,1);
1327 LoadTexture(":Data:Textures:footprint.png",&terrain.footprinttexture,0,1);
1329 LoadTexture(":Data:Textures:bodyprint.png",&terrain.bodyprinttexture,0,1);
1331 /*LoadTexture(":Data:Textures:cloud.png",&Sprite::cloudtexture,1);
1333 LoadTexture(":Data:Textures:cloudimpact.png",&Sprite::cloudimpacttexture,1);
1335 LoadTexture(":Data:Textures:bloodparticle.png",&Sprite::bloodtexture,1);
1337 LoadTexture(":Data:Textures:snowflake.png",&Sprite::snowflaketexture,1);
1339 LoadTexture(":Data:Textures:flame.png",&Sprite::flametexture,1);
1341 LoadTexture(":Data:Textures:smoke.png",&Sprite::smoketexture,1);
1342 //texdetail=temptexdetail;
1343 LoadTexture(":Data:Textures:shine.png",&Sprite::shinetexture,1);*/
1347 LoadTexture(":Data:Textures:hawk.png",&hawktexture,0,1);
1349 LoadTexture(":Data:Textures:logo.png",&logotexture,0,1);
1352 //LoadTexture(":Data:Textures:box.jpg",&objects.boxtextureptr,1,0);
1355 LoadTexture(":Data:Textures:cloud.png",&Sprite::cloudtexture,1,1);
1356 LoadTexture(":Data:Textures:cloudimpact.png",&Sprite::cloudimpacttexture,1,1);
1357 LoadTexture(":Data:Textures:bloodparticle.png",&Sprite::bloodtexture,1,1);
1358 LoadTexture(":Data:Textures:snowflake.png",&Sprite::snowflaketexture,1,1);
1359 LoadTexture(":Data:Textures:flame.png",&Sprite::flametexture,1,1);
1360 LoadTexture(":Data:Textures:bloodflame.png",&Sprite::bloodflametexture,1,1);
1361 LoadTexture(":Data:Textures:smoke.png",&Sprite::smoketexture,1,1);
1362 LoadTexture(":Data:Textures:shine.png",&Sprite::shinetexture,1,0);
1363 LoadTexture(":Data:Textures:splinter.png",&Sprite::splintertexture,1,1);
1364 LoadTexture(":Data:Textures:leaf.png",&Sprite::leaftexture,1,1);
1365 LoadTexture(":Data:Textures:tooth.png",&Sprite::toothtexture,1,1);
1369 ReSizeGLScene(90,.01);
1376 if(detail)kTextureSize=1024;
1377 if(detail==1)kTextureSize=512;
1378 if(detail==0)kTextureSize=256;
1381 //drawmode=motionblurmode;
1383 //Set up distant light
1387 light.ambient[0]=.2;
1388 light.ambient[1]=.2;
1389 light.ambient[2]=.24;
1392 light.location.z=-.2;
1393 Normalise(&light.location);
1403 texscale=.2/megascale/viewdistdetail;
1404 terrain.scale=3*megascale*terraindetail*viewdistdetail;
1406 viewer.x=terrain.size/2*terrain.scale;
1407 viewer.z=terrain.size/2*terrain.scale;
1409 hawk.load((char *)":Data:Models:hawk.solid",1);
1410 hawk.Scale(.03,.03,.03);
1411 hawk.Rotate(90,1,1);
1412 hawk.CalculateNormals(0);
1413 hawk.ScaleNormals(-1,-1,-1);
1414 hawkcoords.x=terrain.size/2*terrain.scale-5-7;
1415 hawkcoords.z=terrain.size/2*terrain.scale-5-7;
1416 hawkcoords.y=terrain.getHeight(hawkcoords.x,hawkcoords.z)+25;
1419 eye.load((char *)":Data:Models:eye.solid",1);
1420 eye.Scale(.03,.03,.03);
1421 eye.CalculateNormals(0);
1423 cornea.load((char *)":Data:Models:cornea.solid",1);
1424 cornea.Scale(.03,.03,.03);
1425 cornea.CalculateNormals(0);
1427 iris.load((char *)":Data:Models:iris.solid",1);
1428 iris.Scale(.03,.03,.03);
1429 iris.CalculateNormals(0);
1431 LoadSave(":Data:Textures:Bloodfur.png",0,1,&bloodText[0],0);
1432 LoadSave(":Data:Textures:Wolfbloodfur.png",0,1,&wolfbloodText[0],0);
1440 //if(targetlevel!=7)
1441 Loadlevel(targetlevel);
1444 rabbitcoords=player[0].coords;
1445 rabbitcoords.y=terrain.getHeight(rabbitcoords.x,rabbitcoords.z);
1447 animation[runanim].Load((char *)":Data:Animations:Run",middleheight,neutral);
1449 animation[bounceidleanim].Load((char *)":Data:Animations:Idle",middleheight,neutral);
1450 animation[stopanim].Load((char *)":Data:Animations:Stop",middleheight,neutral);
1452 animation[jumpupanim].Load((char *)":Data:Animations:JumpUp",highheight,neutral);
1453 animation[jumpdownanim].Load((char *)":Data:Animations:JumpDown",highheight,neutral);
1455 animation[landanim].Load((char *)":Data:Animations:Landing",lowheight,neutral);
1456 animation[landhardanim].Load((char *)":Data:Animations:Landhard",lowheight,neutral);
1457 animation[climbanim].Load((char *)":Data:Animations:Climb",lowheight,neutral);
1458 animation[hanganim].Load((char *)":Data:Animations:Hangon",lowheight,neutral);
1459 animation[spinkickanim].Load((char *)":Data:Animations:SpinKick",middleheight,normalattack);
1461 animation[getupfromfrontanim].Load((char *)":Data:Animations:GetUpFromFront",lowheight,neutral);
1462 animation[getupfrombackanim].Load((char *)":Data:Animations:GetUpFromBack",lowheight,neutral);
1463 animation[crouchanim].Load((char *)":Data:Animations:Crouch",lowheight,neutral);
1464 animation[sneakanim].Load((char *)":Data:Animations:Sneak",lowheight,neutral);
1465 animation[rollanim].Load((char *)":Data:Animations:Roll",lowheight,neutral);
1466 animation[flipanim].Load((char *)":Data:Animations:Flip",highheight,neutral);
1467 animation[frontflipanim].Load((char *)":Data:Animations:Flip",highheight,neutral);
1468 animation[spinkickreversedanim].Load((char *)":Data:Animations:SpinKickCaught",middleheight,reversed);
1470 animation[spinkickreversalanim].Load((char *)":Data:Animations:SpinKickCatch",middleheight,reversal);
1471 animation[lowkickanim].Load((char *)":Data:Animations:lowkick",middleheight,normalattack);
1472 animation[sweepanim].Load((char *)":Data:Animations:sweep",lowheight,normalattack);
1473 animation[sweepreversedanim].Load((char *)":Data:Animations:SweepCaught",lowheight,reversed);
1474 animation[sweepreversalanim].Load((char *)":Data:Animations:SweepCatch",middleheight,reversal);
1475 animation[rabbitkickanim].Load((char *)":Data:Animations:RabbitKick",middleheight,normalattack);
1476 animation[rabbitkickreversedanim].Load((char *)":Data:Animations:RabbitKickCaught",middleheight,reversed);
1477 animation[rabbitkickreversalanim].Load((char *)":Data:Animations:RabbitKickCatch",lowheight,reversal);
1478 animation[upunchanim].Load((char *)":Data:Animations:Upunch",middleheight,normalattack);
1479 animation[staggerbackhighanim].Load((char *)":Data:Animations:Staggerbackhigh",middleheight,neutral);
1480 animation[upunchreversedanim].Load((char *)":Data:Animations:UpunchCaught",middleheight,reversed);
1482 animation[upunchreversalanim].Load((char *)":Data:Animations:UpunchCatch",middleheight,reversal);
1483 animation[hurtidleanim].Load((char *)":Data:Animations:Hurtidle",middleheight,neutral);
1484 animation[backhandspringanim].Load((char *)":Data:Animations:Backhandspring",middleheight,neutral);
1485 animation[fightidleanim].Load((char *)":Data:Animations:Fightidle",middleheight,neutral);
1486 animation[walkanim].Load((char *)":Data:Animations:Walk",middleheight,neutral);
1488 animation[fightsidestep].Load((char *)":Data:Animations:Fightsidestep",middleheight,neutral);
1489 animation[killanim].Load((char *)":Data:Animations:Kill",middleheight,normalattack);
1490 animation[sneakattackanim].Load((char *)":Data:Animations:Sneakattack",middleheight,reversal);
1491 animation[sneakattackedanim].Load((char *)":Data:Animations:Sneakattacked",middleheight,reversed);
1492 animation[drawrightanim].Load((char *)":Data:Animations:drawright",middleheight,neutral);
1493 animation[knifeslashstartanim].Load((char *)":Data:Animations:slashstart",middleheight,normalattack);
1494 animation[crouchdrawrightanim].Load((char *)":Data:Animations:crouchdrawright",lowheight,neutral);
1495 animation[crouchstabanim].Load((char *)":Data:Animations:crouchstab",lowheight,normalattack);
1497 animation[knifefollowanim].Load((char *)":Data:Animations:slashfollow",middleheight,reversal);
1498 animation[knifefollowedanim].Load((char *)":Data:Animations:slashfollowed",middleheight,reversed);
1499 animation[knifethrowanim].Load((char *)":Data:Animations:knifethrow",middleheight,normalattack);
1500 animation[removeknifeanim].Load((char *)":Data:Animations:removeknife",middleheight,neutral);
1501 animation[crouchremoveknifeanim].Load((char *)":Data:Animations:crouchremoveknife",lowheight,neutral);
1502 animation[jumpreversedanim].Load((char *)":Data:Animations:JumpCaught",middleheight,reversed);
1503 animation[jumpreversalanim].Load((char *)":Data:Animations:JumpCatch",middleheight,reversal);
1504 animation[staggerbackhardanim].Load((char *)":Data:Animations:Staggerbackhard",middleheight,neutral);
1506 animation[dropkickanim].Load((char *)":Data:Animations:Dropkick",middleheight,normalattack);
1507 animation[winduppunchanim].Load((char *)":Data:Animations:Winduppunch",middleheight,normalattack);
1508 animation[winduppunchblockedanim].Load((char *)":Data:Animations:Winduppunchblocked",middleheight,normalattack);
1509 animation[blockhighleftanim].Load((char *)":Data:Animations:Blockhighleft",middleheight,normalattack);
1510 animation[blockhighleftstrikeanim].Load((char *)":Data:Animations:Blockhighleftstrike",middleheight,normalattack);
1511 animation[backflipanim].Load((char *)":Data:Animations:Backflip",highheight,neutral);
1512 animation[walljumpbackanim].Load((char *)":Data:Animations:Walljumpback",highheight,neutral);
1513 animation[walljumpfrontanim].Load((char *)":Data:Animations:Walljumpfront",highheight,neutral);
1514 animation[rightflipanim].Load((char *)":Data:Animations:Rightflip",highheight,neutral);
1515 animation[walljumprightanim].Load((char *)":Data:Animations:Walljumpright",highheight,neutral);
1516 animation[leftflipanim].Load((char *)":Data:Animations:Leftflip",highheight,neutral);
1517 animation[walljumpleftanim].Load((char *)":Data:Animations:Walljumpleft",highheight,neutral);
1518 animation[walljumprightkickanim].Load((char *)":Data:Animations:Walljumprightkick",highheight,neutral);
1519 animation[walljumpleftkickanim].Load((char *)":Data:Animations:Walljumpleftkick",highheight,neutral);
1520 animation[knifefightidleanim].Load((char *)":Data:Animations:Knifefightidle",middleheight,neutral);
1521 animation[knifesneakattackanim].Load((char *)":Data:Animations:Knifesneakattack",middleheight,reversal);
1522 animation[knifesneakattackedanim].Load((char *)":Data:Animations:Knifesneakattacked",middleheight,reversed);
1523 animation[swordfightidleanim].Load((char *)":Data:Animations:swordfightidle",middleheight,neutral);
1524 animation[drawleftanim].Load((char *)":Data:Animations:drawleft",middleheight,neutral);
1525 animation[swordslashanim].Load((char *)":Data:Animations:swordslash",middleheight,normalattack);
1526 animation[swordgroundstabanim].Load((char *)":Data:Animations:swordgroundstab",lowheight,normalattack);
1527 animation[dodgebackanim].Load((char *)":Data:Animations:dodgeback",middleheight,neutral);
1528 animation[swordsneakattackanim].Load((char *)":Data:Animations:Swordsneakattack",middleheight,reversal);
1529 animation[swordsneakattackedanim].Load((char *)":Data:Animations:Swordsneakattacked",middleheight,reversed);
1530 animation[swordslashreversedanim].Load((char *)":Data:Animations:swordslashCaught",middleheight,reversed);
1531 animation[swordslashreversalanim].Load((char *)":Data:Animations:swordslashCatch",middleheight,reversal);
1532 animation[knifeslashreversedanim].Load((char *)":Data:Animations:knifeslashCaught",middleheight,reversed);
1533 animation[knifeslashreversalanim].Load((char *)":Data:Animations:knifeslashCatch",middleheight,reversal);
1534 animation[swordfightidlebothanim].Load((char *)":Data:Animations:swordfightidleboth",middleheight,neutral);
1535 animation[swordslashparryanim].Load((char *)":Data:Animations:sworduprightparry",middleheight,normalattack);
1536 animation[swordslashparriedanim].Load((char *)":Data:Animations:swordslashparried",middleheight,normalattack);
1537 animation[wolfidle].Load((char *)":Data:Animations:Wolfidle",middleheight,neutral);
1538 animation[wolfcrouchanim].Load((char *)":Data:Animations:Wolfcrouch",lowheight,neutral);
1539 animation[wolflandanim].Load((char *)":Data:Animations:Wolflanding",lowheight,neutral);
1540 animation[wolflandhardanim].Load((char *)":Data:Animations:Wolflandhard",lowheight,neutral);
1541 animation[wolfrunanim].Load((char *)":Data:Animations:Wolfrun",middleheight,neutral);
1542 animation[wolfrunninganim].Load((char *)":Data:Animations:Wolfrunning",middleheight,neutral);
1543 animation[rabbitrunninganim].Load((char *)":Data:Animations:Rabbitrunning",middleheight,neutral);
1544 animation[wolfstopanim].Load((char *)":Data:Animations:Wolfstop",middleheight,neutral);
1545 animation[rabbittackleanim].Load((char *)":Data:Animations:Rabbittackle",middleheight,neutral);
1546 animation[rabbittacklinganim].Load((char *)":Data:Animations:Rabbittackling",middleheight,reversal);
1547 animation[rabbittackledbackanim].Load((char *)":Data:Animations:Rabbittackledback",middleheight,reversed);
1548 animation[rabbittackledfrontanim].Load((char *)":Data:Animations:Rabbittackledfront",middleheight,reversed);
1549 animation[wolfslapanim].Load((char *)":Data:Animations:Wolfslap",middleheight,normalattack);
1550 animation[staffhitanim].Load((char *)":Data:Animations:StaffHit",middleheight,normalattack);
1551 animation[staffgroundsmashanim].Load((char *)":Data:Animations:StaffGroundSmash",lowheight,normalattack);
1552 animation[staffspinhitanim].Load((char *)":Data:Animations:Spinwhack",middleheight,normalattack);
1553 animation[staffhitreversedanim].Load((char *)":Data:Animations:StaffHitCaught",middleheight,reversed);
1554 animation[staffhitreversalanim].Load((char *)":Data:Animations:StaffHitCatch",middleheight,reversal);
1555 animation[staffspinhitreversedanim].Load((char *)":Data:Animations:SpinWhackCaught",middleheight,reversed);
1556 animation[staffspinhitreversalanim].Load((char *)":Data:Animations:SpinWhackCatch",middleheight,reversal);
1558 animation[sitanim].Load((char *)":Data:Animations:Sit",lowheight,neutral);
1559 animation[sleepanim].Load((char *)":Data:Animations:Sleep",lowheight,neutral);
1560 animation[talkidleanim].Load((char *)":Data:Animations:TalkIdle",middleheight,neutral);
1562 animation[sitwallanim].Load((char *)":Data:Animations:Dying",lowheight,neutral);
1563 animation[dead1anim].Load((char *)":Data:Animations:Dead1",lowheight,neutral);
1564 animation[dead2anim].Load((char *)":Data:Animations:Dead2",lowheight,neutral);
1565 animation[dead3anim].Load((char *)":Data:Animations:Dead3",lowheight,neutral);
1566 animation[dead4anim].Load((char *)":Data:Animations:Dead4",lowheight,neutral);
1567 //Fix knife stab, too lazy to do it manually
1571 for(i=0;i<player[0].skeleton.num_joints;i++){
1572 for(j=0;j<animation[knifesneakattackanim].numframes;j++){
1573 animation[knifesneakattackanim].position[i][j]+=moveamount;
1580 for(i=0;i<player[0].skeleton.num_joints;i++){
1581 for(j=0;j<animation[knifesneakattackedanim].numframes;j++){
1582 animation[knifesneakattackedanim].position[i][j]+=moveamount;
1589 for(i=0;i<player[0].skeleton.num_joints;i++){
1590 animation[dead1anim].position[i][1]=animation[dead1anim].position[i][0];
1591 animation[dead2anim].position[i][1]=animation[dead2anim].position[i][0];
1592 animation[dead3anim].position[i][1]=animation[dead3anim].position[i][0];
1593 animation[dead4anim].position[i][1]=animation[dead4anim].position[i][0];
1595 animation[dead1anim].speed[0]=0.001;
1596 animation[dead2anim].speed[0]=0.001;
1597 animation[dead3anim].speed[0]=0.001;
1598 animation[dead4anim].speed[0]=0.001;
1600 animation[dead1anim].speed[1]=0.001;
1601 animation[dead2anim].speed[1]=0.001;
1602 animation[dead3anim].speed[1]=0.001;
1603 animation[dead4anim].speed[1]=0.001;
1605 for(i=0;i<player[0].skeleton.num_joints;i++){
1606 for(j=0;j<animation[swordsneakattackanim].numframes;j++){
1607 animation[swordsneakattackanim].position[i][j]+=moveamount;
1612 for(j=0;j<animation[swordsneakattackanim].numframes;j++){
1613 animation[swordsneakattackanim].weapontarget[j]+=moveamount;
1619 for(i=0;i<player[0].skeleton.num_joints;i++){
1620 for(j=0;j<animation[swordsneakattackedanim].numframes;j++){
1621 animation[swordsneakattackedanim].position[i][j]+=moveamount;
1625 for(i=0;i<player[0].skeleton.num_joints;i++){
1626 for(j=0;j<animation[sleepanim].numframes;j++){
1627 animation[sleepanim].position[i][j]=DoRotation(animation[sleepanim].position[i][j],0,180,0);
1633 temptexdetail=texdetail;
1635 texdetail=temptexdetail;
1642 glPixelStorei( GL_UNPACK_ALIGNMENT, 1 );
1644 glGenTextures( 1, &screentexture );
1645 glTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE );
1648 glEnable(GL_TEXTURE_2D);
1649 glBindTexture( GL_TEXTURE_2D, screentexture);
1650 glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR );
1651 glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR );
1653 glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 0, 0, kTextureSize, kTextureSize, 0);
1659 /*PlaySoundEx( consolesuccesssound, samp[consolesuccesssound], NULL, true);
1660 OPENAL_SetVolume(channels[consolesuccesssound], 256);
1661 OPENAL_SetPaused(channels[consolesuccesssound], false);
1664 float gLoc[3]={0,0,0};
1665 float vel[3]={0,0,0};
1666 OPENAL_Sample_SetMinMaxDistance(samp[fireendsound], 9999.0f, 99999.0f);
1667 PlaySoundEx( fireendsound, samp[fireendsound], NULL, true);
1668 OPENAL_3D_SetAttributes(channels[fireendsound], gLoc, vel);
1669 OPENAL_SetVolume(channels[fireendsound], 256);
1670 OPENAL_SetPaused(channels[fireendsound], false);
1671 OPENAL_Sample_SetMinMaxDistance(samp[fireendsound], 8.0f, 2000.0f);