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"
24 #include "Animation.h"
26 extern float screenwidth,screenheight;
27 extern float viewdistance;
29 extern XYZ lightlocation;
30 extern float lightambient[3],lightbrightness[3];
31 extern float fadestart;
32 extern float texscale;
35 extern Animation animation[animation_count];
36 extern Skeleton testskeleton;
38 extern OPENAL_SAMPLE *samp[100];
39 extern int channels[100];
40 extern Terrain terrain;
41 //extern Sprites sprites;
42 extern int kTextureSize;
43 extern float texdetail;
44 extern float realtexdetail;
45 extern float terraindetail;
47 extern Objects objects;
49 extern bool cellophane;
50 extern GLubyte bloodText[512*512*3];
51 extern GLubyte wolfbloodText[512*512*3];
52 extern bool ismotionblur;
53 extern bool trilinear;
55 extern bool musictoggle;
56 extern Weapons weapons;
57 extern Person player[maxplayers];
58 extern int numplayers;
59 extern int environment;
60 extern bool ambientsound;
61 extern float multiplier;
62 extern int netdatanew;
64 extern bool stillloading;
65 extern TGAImageRec texture;
69 extern int oldmainmenu;
70 extern bool visibleloading;
71 extern int loadscreencolor;
72 extern float flashamount,flashr,flashg,flashb;
73 extern int flashdelay;
74 extern int whichjointstartarray[26];
75 extern int whichjointendarray[26];
76 extern int difficulty;
77 extern float tintr,tintg,tintb;
78 extern float slomospeed;
79 extern char mapname[256];
80 extern bool gamestarted;
82 extern int numdialogues;
83 extern int numdialogueboxes[20];
84 extern int dialoguetype[20];
85 extern int dialogueboxlocation[20][20];
86 extern float dialogueboxcolor[20][20][3];
87 extern int dialogueboxsound[20][20];
88 extern char dialoguetext[20][20][128];
89 extern char dialoguename[20][20][64];
90 extern XYZ dialoguecamera[20][20];
91 extern float dialoguecamerarotation[20][20];
92 extern float dialoguecamerarotation2[20][20];
93 extern int indialogue;
94 extern int whichdialogue;
95 extern float dialoguetime;
97 extern float accountcampaignhighscore[10];
98 extern float accountcampaignfasttime[10];
99 extern float accountcampaignscore[10];
100 extern float accountcampaigntime[10];
102 extern int accountcampaignchoicesmade[10];
103 extern int accountcampaignchoices[10][5000];
105 extern OPENAL_STREAM * strm[20];
107 extern "C" void PlaySoundEx(int channel, OPENAL_SAMPLE *sptr, OPENAL_DSPUNIT *dsp, signed char startpaused);
108 extern "C" void PlayStreamEx(int chan, OPENAL_STREAM *sptr, OPENAL_DSPUNIT *dsp, signed char startpaused);
110 void LOG(const std::string &fmt, ...)
112 // !!! FIXME: write me.
116 Game::TextureList Game::textures;
125 accountactive->endGame();
129 Account::saveFile(":Data:Users", accountactive);
131 TexIter it = textures.begin();
132 for (; it != textures.end(); ++it)
134 if (glIsTexture(it->second))
135 glDeleteTextures(1, &it->second);
139 LOG("Shutting down sound system...");
141 OPENAL_StopSound(OPENAL_ALL);
143 // this is causing problems on Linux, but we'll force an _exit() a little
144 // later in the shutdown process. --ryan.
146 #define streamcount 20
147 #define samplecount 100
149 for (i=0; i < samplecount; ++i)
151 OPENAL_Sample_Free(samp[i]);
154 for (i=0; i < streamcount; ++i)
156 OPENAL_Stream_Close(strm[i]);
169 //void Game::LoadSounds();
170 void Game::LoadSounds()
174 LOG(std::string("Loading sounds..."));
176 OPENAL_3D_SetDopplerFactor(0);
178 OPENAL_SetSFXMasterVolume((int)(volume*255));
180 samp[footstepsound] = OPENAL_Sample_LoadEx(OPENAL_FREE, ConvertFileName(":Data:Sounds:footstepsnow1.ogg"), OPENAL_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
181 OPENAL_Sample_SetMinMaxDistance(samp[footstepsound], 4.0f, 1000.0f);
183 samp[footstepsound2] = OPENAL_Sample_LoadEx(OPENAL_FREE, ConvertFileName(":Data:Sounds:footstepsnow2.ogg"), OPENAL_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
184 OPENAL_Sample_SetMinMaxDistance(samp[footstepsound2], 4.0f, 1000.0f);
186 samp[footstepsound3] = OPENAL_Sample_LoadEx(OPENAL_FREE, ConvertFileName(":Data:Sounds:footstepstone1.ogg"), OPENAL_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
187 OPENAL_Sample_SetMinMaxDistance(samp[footstepsound3], 4.0f, 1000.0f);
189 samp[footstepsound4] = OPENAL_Sample_LoadEx(OPENAL_FREE, ConvertFileName(":Data:Sounds:footstepstone2.ogg"), OPENAL_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
190 OPENAL_Sample_SetMinMaxDistance(samp[footstepsound4], 4.0f, 1000.0f);
192 samp[landsound] = OPENAL_Sample_LoadEx(OPENAL_FREE, ConvertFileName(":Data:Sounds:land.ogg"), OPENAL_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
193 OPENAL_Sample_SetMinMaxDistance(samp[landsound], 4.0f, 1000.0f);
195 samp[jumpsound] = OPENAL_Sample_LoadEx(OPENAL_FREE, ConvertFileName(":Data:Sounds:jump.ogg"), OPENAL_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
196 OPENAL_Sample_SetMinMaxDistance(samp[jumpsound], 4.0f, 1000.0f);
198 samp[hawksound] = OPENAL_Sample_LoadEx(OPENAL_FREE, ConvertFileName(":Data:Sounds:hawk.ogg"), OPENAL_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
199 OPENAL_Sample_SetMinMaxDistance(samp[hawksound], 40.0f, 10000.0f);
201 samp[whooshsound] = OPENAL_Sample_LoadEx(OPENAL_FREE, ConvertFileName(":Data:Sounds:whoosh.ogg"), OPENAL_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
202 OPENAL_Sample_SetMinMaxDistance(samp[whooshsound], 4.0f, 1000.0f);
203 OPENAL_Sample_SetMode(samp[whooshsound], OPENAL_LOOP_NORMAL);
205 samp[landsound1] = OPENAL_Sample_LoadEx(OPENAL_FREE, ConvertFileName(":Data:Sounds:land1.ogg"), OPENAL_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
206 OPENAL_Sample_SetMinMaxDistance(samp[landsound1], 4.0f, 1000.0f);
210 samp[landsound2] = OPENAL_Sample_LoadEx(OPENAL_FREE, ConvertFileName(":Data:Sounds:land2.ogg"), OPENAL_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
211 OPENAL_Sample_SetMinMaxDistance(samp[landsound2], 4.0f, 1000.0f);
213 samp[breaksound] = OPENAL_Sample_LoadEx(OPENAL_FREE, ConvertFileName(":Data:Sounds:broken.ogg"), OPENAL_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
214 OPENAL_Sample_SetMinMaxDistance(samp[breaksound], 8.0f, 2000.0f);
216 samp[lowwhooshsound] = OPENAL_Sample_LoadEx(OPENAL_FREE, ConvertFileName(":Data:Sounds:Lowwhoosh.ogg"), OPENAL_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
217 OPENAL_Sample_SetMinMaxDistance(samp[lowwhooshsound], 8.0f, 2000.0f);
219 samp[midwhooshsound] = OPENAL_Sample_LoadEx(OPENAL_FREE, ConvertFileName(":Data:Sounds:midwhoosh.ogg"), OPENAL_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
220 OPENAL_Sample_SetMinMaxDistance(samp[midwhooshsound], 8.0f, 2000.0f);
222 samp[highwhooshsound] = OPENAL_Sample_LoadEx(OPENAL_FREE, ConvertFileName(":Data:Sounds:highwhoosh.ogg"), OPENAL_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
223 OPENAL_Sample_SetMinMaxDistance(samp[highwhooshsound], 8.0f, 2000.0f);
225 samp[movewhooshsound] = OPENAL_Sample_LoadEx(OPENAL_FREE, ConvertFileName(":Data:Sounds:movewhoosh.ogg"), OPENAL_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
226 OPENAL_Sample_SetMinMaxDistance(samp[movewhooshsound], 8.0f, 2000.0f);
228 samp[heavyimpactsound] = OPENAL_Sample_LoadEx(OPENAL_FREE, ConvertFileName(":Data:Sounds:heavyimpact.ogg"), OPENAL_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
229 OPENAL_Sample_SetMinMaxDistance(samp[heavyimpactsound], 8.0f, 2000.0f);
231 samp[whooshhitsound] = OPENAL_Sample_LoadEx(OPENAL_FREE, ConvertFileName(":Data:Sounds:Whooshhit.ogg"), OPENAL_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
232 OPENAL_Sample_SetMinMaxDistance(samp[whooshhitsound], 8.0f, 2000.0f);
234 samp[thudsound] = OPENAL_Sample_LoadEx(OPENAL_FREE, ConvertFileName(":Data:Sounds:thud.ogg"), OPENAL_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
235 OPENAL_Sample_SetMinMaxDistance(samp[thudsound], 8.0f, 2000.0f);
237 samp[alarmsound] = OPENAL_Sample_LoadEx(OPENAL_FREE, ConvertFileName(":Data:Sounds:alarm.ogg"), OPENAL_2D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
238 OPENAL_Sample_SetMinMaxDistance(samp[alarmsound], 8.0f, 2000.0f);
240 samp[breaksound2] = OPENAL_Sample_LoadEx(OPENAL_FREE, ConvertFileName(":Data:Sounds:break.ogg"), OPENAL_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
241 OPENAL_Sample_SetMinMaxDistance(samp[breaksound2], 8.0f, 2000.0f);
243 samp[knifedrawsound] = OPENAL_Sample_LoadEx(OPENAL_FREE, ConvertFileName(":Data:Sounds:knifedraw.ogg"), OPENAL_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
244 OPENAL_Sample_SetMinMaxDistance(samp[knifedrawsound], 8.0f, 2000.0f);
246 samp[knifesheathesound] = OPENAL_Sample_LoadEx(OPENAL_FREE, ConvertFileName(":Data:Sounds:knifesheathe.ogg"), OPENAL_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
247 OPENAL_Sample_SetMinMaxDistance(samp[knifesheathesound], 8.0f, 2000.0f);
249 samp[fleshstabsound] = OPENAL_Sample_LoadEx(OPENAL_FREE, ConvertFileName(":Data:Sounds:Fleshstab.ogg"), OPENAL_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
250 OPENAL_Sample_SetMinMaxDistance(samp[fleshstabsound], 8.0f, 2000.0f);
252 samp[fleshstabremovesound] = OPENAL_Sample_LoadEx(OPENAL_FREE, ConvertFileName(":Data:Sounds:Fleshstabremove.ogg"), OPENAL_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
253 OPENAL_Sample_SetMinMaxDistance(samp[fleshstabremovesound], 8.0f, 2000.0f);
255 samp[knifeswishsound] = OPENAL_Sample_LoadEx(OPENAL_FREE, ConvertFileName(":Data:Sounds:knifeswish.ogg"), OPENAL_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
256 OPENAL_Sample_SetMinMaxDistance(samp[knifeswishsound], 8.0f, 2000.0f);
258 samp[knifeslicesound] = OPENAL_Sample_LoadEx(OPENAL_FREE, ConvertFileName(":Data:Sounds:knifeslice.ogg"), OPENAL_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
259 OPENAL_Sample_SetMinMaxDistance(samp[knifeslicesound], 8.0f, 2000.0f);
261 samp[swordslicesound] = OPENAL_Sample_LoadEx(OPENAL_FREE, ConvertFileName(":Data:Sounds:swordslice.ogg"), OPENAL_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
262 OPENAL_Sample_SetMinMaxDistance(samp[swordslicesound], 8.0f, 2000.0f);
264 samp[skidsound] = OPENAL_Sample_LoadEx(OPENAL_FREE, ConvertFileName(":Data:Sounds:skid.ogg"), OPENAL_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
265 OPENAL_Sample_SetMinMaxDistance(samp[skidsound], 8.0f, 2000.0f);
267 samp[snowskidsound] = OPENAL_Sample_LoadEx(OPENAL_FREE, ConvertFileName(":Data:Sounds:snowskid.ogg"), OPENAL_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
268 OPENAL_Sample_SetMinMaxDistance(samp[snowskidsound], 8.0f, 2000.0f);
270 samp[bushrustle] = OPENAL_Sample_LoadEx(OPENAL_FREE, ConvertFileName(":Data:Sounds:bushrustle.ogg"), OPENAL_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
271 OPENAL_Sample_SetMinMaxDistance(samp[bushrustle], 4.0f, 1000.0f);
273 samp[clank1sound] = OPENAL_Sample_LoadEx(OPENAL_FREE, ConvertFileName(":Data:Sounds:clank1.ogg"), OPENAL_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
274 OPENAL_Sample_SetMinMaxDistance(samp[clank1sound], 8.0f, 2000.0f);
276 samp[clank2sound] = OPENAL_Sample_LoadEx(OPENAL_FREE, ConvertFileName(":Data:Sounds:clank2.ogg"), OPENAL_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
277 OPENAL_Sample_SetMinMaxDistance(samp[clank2sound], 8.0f, 2000.0f);
279 samp[clank3sound] = OPENAL_Sample_LoadEx(OPENAL_FREE, ConvertFileName(":Data:Sounds:clank3.ogg"), OPENAL_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
280 OPENAL_Sample_SetMinMaxDistance(samp[clank3sound], 8.0f, 2000.0f);
282 samp[clank4sound] = OPENAL_Sample_LoadEx(OPENAL_FREE, ConvertFileName(":Data:Sounds:clank4.ogg"), OPENAL_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
283 OPENAL_Sample_SetMinMaxDistance(samp[clank4sound], 8.0f, 2000.0f);
285 samp[consolesuccesssound] = OPENAL_Sample_LoadEx(OPENAL_FREE, ConvertFileName(":Data:Sounds:consolesuccess.ogg"), OPENAL_2D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
286 OPENAL_Sample_SetMinMaxDistance(samp[consolesuccesssound], 4.0f, 1000.0f);
288 samp[consolefailsound] = OPENAL_Sample_LoadEx(OPENAL_FREE, ConvertFileName(":Data:Sounds:consolefail.ogg"), OPENAL_2D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
289 OPENAL_Sample_SetMinMaxDistance(samp[consolefailsound], 4.0f, 1000.0f);
291 samp[metalhitsound] = OPENAL_Sample_LoadEx(OPENAL_FREE, ConvertFileName(":Data:Sounds:MetalHit.ogg"), OPENAL_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
292 OPENAL_Sample_SetMinMaxDistance(samp[metalhitsound], 8.0f, 2000.0f);
294 samp[clawslicesound] = OPENAL_Sample_LoadEx(OPENAL_FREE, ConvertFileName(":Data:Sounds:clawslice.ogg"), OPENAL_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
295 OPENAL_Sample_SetMinMaxDistance(samp[clawslicesound], 8.0f, 2000.0f);
297 samp[splattersound] = OPENAL_Sample_LoadEx(OPENAL_FREE, ConvertFileName(":Data:Sounds:splatter.ogg"), OPENAL_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
298 OPENAL_Sample_SetMinMaxDistance(samp[splattersound], 8.0f, 2000.0f);
300 samp[growlsound] = OPENAL_Sample_LoadEx(OPENAL_FREE, ConvertFileName(":Data:Sounds:Growl.ogg"), OPENAL_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
301 OPENAL_Sample_SetMinMaxDistance(samp[growlsound], 1000.0f, 2000.0f);
303 samp[growl2sound] = OPENAL_Sample_LoadEx(OPENAL_FREE, ConvertFileName(":Data:Sounds:Growl2.ogg"), OPENAL_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
304 OPENAL_Sample_SetMinMaxDistance(samp[growl2sound], 1000.0f, 2000.0f);
306 samp[barksound] = OPENAL_Sample_LoadEx(OPENAL_FREE, ConvertFileName(":Data:Sounds:bark.ogg"), OPENAL_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
307 OPENAL_Sample_SetMinMaxDistance(samp[barksound], 1000.0f, 2000.0f);
309 samp[bark2sound] = OPENAL_Sample_LoadEx(OPENAL_FREE, ConvertFileName(":Data:Sounds:bark2.ogg"), OPENAL_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
310 OPENAL_Sample_SetMinMaxDistance(samp[bark2sound], 1000.0f, 2000.0f);
312 samp[bark3sound] = OPENAL_Sample_LoadEx(OPENAL_FREE, ConvertFileName(":Data:Sounds:bark3.ogg"), OPENAL_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
313 OPENAL_Sample_SetMinMaxDistance(samp[bark3sound], 1000.0f, 2000.0f);
315 samp[snarlsound] = OPENAL_Sample_LoadEx(OPENAL_FREE, ConvertFileName(":Data:Sounds:snarl.ogg"), OPENAL_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
316 OPENAL_Sample_SetMinMaxDistance(samp[snarlsound], 1000.0f, 2000.0f);
319 samp[snarl2sound] = OPENAL_Sample_LoadEx(OPENAL_FREE, ConvertFileName(":Data:Sounds:snarl2.ogg"), OPENAL_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
320 OPENAL_Sample_SetMinMaxDistance(samp[snarl2sound], 1000.0f, 2000.0f);
322 samp[barkgrowlsound] = OPENAL_Sample_LoadEx(OPENAL_FREE, ConvertFileName(":Data:Sounds:barkgrowl.ogg"), OPENAL_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
323 OPENAL_Sample_SetMinMaxDistance(samp[barkgrowlsound], 1000.0f, 2000.0f);
325 samp[rabbitattacksound] = OPENAL_Sample_LoadEx(OPENAL_FREE, ConvertFileName(":Data:Sounds:rabbitattack.ogg"), OPENAL_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
326 OPENAL_Sample_SetMinMaxDistance(samp[rabbitattacksound], 1000.0f, 2000.0f);
328 samp[rabbitattack2sound] = OPENAL_Sample_LoadEx(OPENAL_FREE, ConvertFileName(":Data:Sounds:rabbitattack2.ogg"), OPENAL_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
329 OPENAL_Sample_SetMinMaxDistance(samp[rabbitattack2sound], 1000.0f, 2000.0f);
331 samp[rabbitattack3sound] = OPENAL_Sample_LoadEx(OPENAL_FREE, ConvertFileName(":Data:Sounds:rabbitattack3.ogg"), OPENAL_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
332 OPENAL_Sample_SetMinMaxDistance(samp[rabbitattack3sound], 1000.0f, 2000.0f);
334 samp[rabbitattack4sound] = OPENAL_Sample_LoadEx(OPENAL_FREE, ConvertFileName(":Data:Sounds:rabbitattack4.ogg"), OPENAL_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
335 OPENAL_Sample_SetMinMaxDistance(samp[rabbitattack4sound], 1000.0f, 2000.0f);
337 samp[rabbitpainsound] = OPENAL_Sample_LoadEx(OPENAL_FREE, ConvertFileName(":Data:Sounds:rabbitpain.ogg"), OPENAL_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
338 OPENAL_Sample_SetMinMaxDistance(samp[rabbitpainsound], 1000.0f, 2000.0f);
340 samp[rabbitpain1sound] = OPENAL_Sample_LoadEx(OPENAL_FREE, ConvertFileName(":Data:Sounds:rabbitpain2.ogg"), OPENAL_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
341 OPENAL_Sample_SetMinMaxDistance(samp[rabbitpain1sound], 1000.0f, 2000.0f);
343 /*samp[rabbitpain2sound] = OPENAL_Sample_LoadEx(OPENAL_FREE, ConvertFileName(":Data:Sounds:rabbitpain2.ogg"), OPENAL_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
344 OPENAL_Sample_SetMinMaxDistance(samp[rabbitpain2sound], 1000.0f, 2000.0f);
346 samp[rabbitchitter] = OPENAL_Sample_LoadEx(OPENAL_FREE, ConvertFileName(":Data:Sounds:rabbitchitter.ogg"), OPENAL_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
347 OPENAL_Sample_SetMinMaxDistance(samp[rabbitchitter], 1000.0f, 2000.0f);
349 samp[rabbitchitter2] = OPENAL_Sample_LoadEx(OPENAL_FREE, ConvertFileName(":Data:Sounds:rabbitchitter2.ogg"), OPENAL_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
350 OPENAL_Sample_SetMinMaxDistance(samp[rabbitchitter2], 1000.0f, 2000.0f);
352 samp[swordstaffsound] = OPENAL_Sample_LoadEx(OPENAL_FREE, ConvertFileName(":Data:Sounds:swordstaff.ogg"), OPENAL_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
353 OPENAL_Sample_SetMinMaxDistance(samp[swordstaffsound], 8.0f, 2000.0f);
355 samp[staffbodysound] = OPENAL_Sample_LoadEx(OPENAL_FREE, ConvertFileName(":Data:Sounds:staffbody.ogg"), OPENAL_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
356 OPENAL_Sample_SetMinMaxDistance(samp[staffbodysound], 8.0f, 2000.0f);
358 samp[staffheadsound] = OPENAL_Sample_LoadEx(OPENAL_FREE, ConvertFileName(":Data:Sounds:staffhead.ogg"), OPENAL_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
359 OPENAL_Sample_SetMinMaxDistance(samp[staffheadsound], 8.0f, 2000.0f);
361 samp[staffbreaksound] = OPENAL_Sample_LoadEx(OPENAL_FREE, ConvertFileName(":Data:Sounds:staffbreak.wav"), OPENAL_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
362 OPENAL_Sample_SetMinMaxDistance(samp[staffbreaksound], 8.0f, 2000.0f);
365 void Game::LoadTexture(const char *fileName, GLuint *textureid,int mipmap, bool hasalpha)
371 LOG(std::string("Loading texture...") + fileName);
373 // Fix filename so that is os appropreate
374 char * fixedFN = ConvertFileName(fileName);
376 unsigned char fileNamep[256];
377 CopyCStringToPascal(fixedFN, fileNamep);
379 upload_image( fileNamep ,hasalpha);
381 // std::string fname(fileName);
382 // std::transform(fname.begin(), fname.end(), tolower);
383 // TexIter it = textures.find(fname);
387 //if(textures.end() == it)
390 if ( texture.bpp == 24 )
395 glPixelStorei( GL_UNPACK_ALIGNMENT, 1 );
398 glGenTextures( 1, textureid );
399 glTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE );
401 glBindTexture( GL_TEXTURE_2D, *textureid);
402 glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR );
403 if(trilinear)if(mipmap)glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR );
404 if(!trilinear)if(mipmap)glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_NEAREST );
405 if(!mipmap)glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR );
407 gluBuild2DMipmaps( GL_TEXTURE_2D, type, texture.sizeX, texture.sizeY, type, GL_UNSIGNED_BYTE, texture.data );
411 void Game::LoadTextureSave(const char *fileName, GLuint *textureid,int mipmap,GLubyte *array, int *skinsize)
419 LOG(std::string("Loading texture (S)...") + fileName);
422 unsigned char fileNamep[256];
423 CopyCStringToPascal(ConvertFileName(fileName), fileNamep);
425 upload_image( fileNamep ,0);
426 //LoadTGA( fileName );
428 // std::string fname(fileName);
429 // std::transform(fname.begin(), fname.end(), tolower);
430 // TexIter it = textures.find(fname);
434 //if(textures.end() == it)
436 bytesPerPixel=texture.bpp/8;
439 if ( texture.bpp == 24 )
444 glPixelStorei( GL_UNPACK_ALIGNMENT, 1 );
446 if(!*textureid)glGenTextures( 1, textureid );
447 glTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE );
449 glBindTexture( GL_TEXTURE_2D, *textureid);
450 glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR );
451 if(trilinear)if(mipmap)glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR );
452 if(!trilinear)if(mipmap)glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_NEAREST );
453 if(!mipmap)glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR );
456 for(i=0;i<(int)(texture.sizeY*texture.sizeX*bytesPerPixel);i++){
457 if((i+1)%4||type==GL_RGB){
458 array[tempnum]=texture.data[i];
463 *skinsize=texture.sizeX;
465 gluBuild2DMipmaps( GL_TEXTURE_2D, type, texture.sizeX, texture.sizeY, GL_RGB, GL_UNSIGNED_BYTE, array );
467 // textures.insert(std::make_pair(fname, *textureid));
471 // *textureid = it->second;
475 void Game::LoadSave(const char *fileName, GLuint *textureid,bool mipmap,GLubyte *array, int *skinsize)
482 LOG(std::string("Loading (S)...") + fileName);
485 float temptexdetail=texdetail;
487 //upload_image( fileName );
488 //LoadTGA( fileName );
490 // Converting file to something os specific
491 char * fixedFN = ConvertFileName(fileName);
494 unsigned char fileNamep[256];
495 CopyCStringToPascal(fixedFN, fileNamep);
497 upload_image( fileNamep ,0);
498 texdetail=temptexdetail;
502 bytesPerPixel=texture.bpp/8;
505 for(i=0;i<(int)(texture.sizeY*texture.sizeX*bytesPerPixel);i++){
506 if((i+1)%4||bytesPerPixel==3){
507 array[tempnum]=texture.data[i];
514 bool Game::AddClothes(const char *fileName, GLuint *textureid,bool mipmap,GLubyte *array, int *skinsize)
521 //upload_image( fileName );
522 //LoadTGA( fileName );
524 unsigned char fileNamep[256];
525 CopyCStringToPascal(fileName,fileNamep);
528 opened=upload_image( fileNamep ,1);
541 bytesPerPixel=texture.bpp/8;
545 for(i=0;i<(int)(texture.sizeY*texture.sizeX*bytesPerPixel);i++){
546 if(bytesPerPixel==3)alphanum=255;
547 else if((i+1)%4==0)alphanum=texture.data[i];
549 if((i+1)%4||bytesPerPixel==3){
550 if((i%4)==0)texture.data[i]*=tintr;
551 if((i%4)==1)texture.data[i]*=tintg;
552 if((i%4)==2)texture.data[i]*=tintb;
553 array[tempnum]=(float)array[tempnum]*(1-alphanum/255)+(float)texture.data[i]*(alphanum/255);
563 //***************> ResizeGLScene() <******/
564 GLvoid Game::ReSizeGLScene(float fov, float pnear)
571 glViewport(0,0,screenwidth,screenheight);
573 glMatrixMode(GL_PROJECTION);
576 gluPerspective(fov,(GLfloat)screenwidth/(GLfloat)screenheight,pnear,viewdistance);
578 glMatrixMode(GL_MODELVIEW);
582 void Game::LoadingScreen()
584 static float loadprogress,minprogress,maxprogress;
585 static AbsoluteTime time = {0,0};
586 static AbsoluteTime frametime = {0,0};
587 AbsoluteTime currTime = UpTime ();
588 double deltaTime = (float) AbsoluteDeltaToDuration (currTime, frametime);
590 if (0 > deltaTime) // if negative microseconds
591 deltaTime /= -1000000.0;
592 else // else milliseconds
595 multiplier=deltaTime;
596 if(multiplier<.001)multiplier=.001;
597 if(multiplier>10)multiplier=10;
599 frametime = currTime; // reset for next time interval
604 glClearColor(0,0,0,1);
605 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
608 loadtime+=multiplier*4;
610 loadprogress=loadtime;
611 if(loadprogress>100)loadprogress=100;
613 //loadprogress=abs(Random()%100);
617 glEnable(GL_TEXTURE_2D);
618 glBindTexture( GL_TEXTURE_2D, loadscreentexture);
619 glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT );
620 glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT );
621 glDisable(GL_DEPTH_TEST); // Disables Depth Testing
622 glDisable(GL_CULL_FACE);
623 glDisable(GL_LIGHTING);
625 glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
626 glPushMatrix(); // Store The Projection Matrix
627 glLoadIdentity(); // Reset The Projection Matrix
628 glOrtho(0,screenwidth,0,screenheight,-100,100); // Set Up An Ortho Screen
629 glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
630 glPushMatrix(); // Store The Modelview Matrix
631 glLoadIdentity(); // Reset The Modelview Matrix
632 glTranslatef(screenwidth/2,screenheight/2,0);
633 glScalef((float)screenwidth/2,(float)screenheight/2,1);
634 glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
636 glColor4f(loadprogress/100,loadprogress/100,loadprogress/100,1);
637 //glColor4f(1,1,1,1);
638 /*if(loadscreencolor==0)glColor4f(1,1,1,1);
639 if(loadscreencolor==1)glColor4f(1,0,0,1);
640 if(loadscreencolor==2)glColor4f(0,1,0,1);
641 if(loadscreencolor==3)glColor4f(0,0,1,1);
642 if(loadscreencolor==4)glColor4f(1,1,0,1);
643 if(loadscreencolor==5)glColor4f(1,0,1,1);
646 //glScalef(.25,.25,.25);
648 glTexCoord2f(.1-loadprogress/100,0+loadprogress/100+.3);
649 glVertex3f(-1, -1, 0.0f);
650 glTexCoord2f(.1-loadprogress/100,0+loadprogress/100+.3);
651 glVertex3f(1, -1, 0.0f);
652 glTexCoord2f(.1-loadprogress/100,1+loadprogress/100+.3);
653 glVertex3f(1, 1, 0.0f);
654 glTexCoord2f(.1-loadprogress/100,1+loadprogress/100+.3);
655 glVertex3f(-1, 1, 0.0f);
660 //glScalef(.25,.25,.25);
662 glTexCoord2f(.4+loadprogress/100,0+loadprogress/100);
663 glVertex3f(-1, -1, 0.0f);
664 glTexCoord2f(.4+loadprogress/100,0+loadprogress/100);
665 glVertex3f(1, -1, 0.0f);
666 glTexCoord2f(.4+loadprogress/100,1+loadprogress/100);
667 glVertex3f(1, 1, 0.0f);
668 glTexCoord2f(.4+loadprogress/100,1+loadprogress/100);
669 glVertex3f(-1, 1, 0.0f);
672 glDisable(GL_TEXTURE_2D);
673 glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
674 glPopMatrix(); // Restore The Old Projection Matrix
675 glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
676 glPopMatrix(); // Restore The Old Projection Matrix
680 glEnable(GL_TEXTURE_2D);
681 glBindTexture( GL_TEXTURE_2D, loadscreentexture);
682 glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT );
683 glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT );
684 glDisable(GL_DEPTH_TEST); // Disables Depth Testing
685 glDisable(GL_CULL_FACE);
686 glDisable(GL_LIGHTING);
688 glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
689 glPushMatrix(); // Store The Projection Matrix
690 glLoadIdentity(); // Reset The Projection Matrix
691 glOrtho(0,screenwidth,0,screenheight,-100,100); // Set Up An Ortho Screen
692 glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
693 glPushMatrix(); // Store The Modelview Matrix
694 glLoadIdentity(); // Reset The Modelview Matrix
695 glTranslatef(screenwidth/2,screenheight/2,0);
696 glScalef((float)screenwidth/2*(1.5-(loadprogress)/200),(float)screenheight/2*(1.5-(loadprogress)/200),1);
697 glBlendFunc(GL_SRC_ALPHA,GL_ONE);
699 //glColor4f(loadprogress/100,loadprogress/100,loadprogress/100,1);
700 glColor4f(loadprogress/100,loadprogress/100,loadprogress/100,1);
701 /*if(loadscreencolor==0)glColor4f(1,1,1,1);
702 if(loadscreencolor==1)glColor4f(1,0,0,1);
703 if(loadscreencolor==2)glColor4f(0,1,0,1);
704 if(loadscreencolor==3)glColor4f(0,0,1,1);
705 if(loadscreencolor==4)glColor4f(1,1,0,1);
706 if(loadscreencolor==5)glColor4f(1,0,1,1);
709 //glScalef(.25,.25,.25);
711 glTexCoord2f(0+.5,0+.5);
712 glVertex3f(-1, -1, 0.0f);
713 glTexCoord2f(1+.5,0+.5);
714 glVertex3f(1, -1, 0.0f);
715 glTexCoord2f(1+.5,1+.5);
716 glVertex3f(1, 1, 0.0f);
717 glTexCoord2f(0+.5,1+.5);
718 glVertex3f(-1, 1, 0.0f);
721 glDisable(GL_TEXTURE_2D);
722 glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
723 glPopMatrix(); // Restore The Old Projection Matrix
724 glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
725 glPopMatrix(); // Restore The Old Projection Matrix
729 glEnable(GL_TEXTURE_2D);
730 glBindTexture( GL_TEXTURE_2D, loadscreentexture);
731 glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT );
732 glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT );
733 glDisable(GL_DEPTH_TEST); // Disables Depth Testing
734 glDisable(GL_CULL_FACE);
735 glDisable(GL_LIGHTING);
737 glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
738 glPushMatrix(); // Store The Projection Matrix
739 glLoadIdentity(); // Reset The Projection Matrix
740 glOrtho(0,screenwidth,0,screenheight,-100,100); // Set Up An Ortho Screen
741 glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
742 glPushMatrix(); // Store The Modelview Matrix
743 glLoadIdentity(); // Reset The Modelview Matrix
744 glTranslatef(screenwidth/2,screenheight/2,0);
745 glScalef((float)screenwidth/2*(100+loadprogress)/100,(float)screenheight/2*(100+loadprogress)/100,1);
746 glBlendFunc(GL_SRC_ALPHA,GL_ONE);
748 glColor4f(loadprogress/100,loadprogress/100,loadprogress/100,.4);
750 //glScalef(.25,.25,.25);
752 glTexCoord2f(0+.2,0+.8);
753 glVertex3f(-1, -1, 0.0f);
754 glTexCoord2f(1+.2,0+.8);
755 glVertex3f(1, -1, 0.0f);
756 glTexCoord2f(1+.2,1+.8);
757 glVertex3f(1, 1, 0.0f);
758 glTexCoord2f(0+.2,1+.8);
759 glVertex3f(-1, 1, 0.0f);
762 glDisable(GL_TEXTURE_2D);
763 glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
764 glPopMatrix(); // Restore The Old Projection Matrix
765 glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
766 glPopMatrix(); // Restore The Old Projection Matrix
772 glEnable(GL_TEXTURE_2D);
773 static char string[256]="";
774 sprintf (string, "LOADING... %d%",(int)loadprogress);
776 text.glPrint(280-280*loadprogress/100/2/4,125-125*loadprogress/100/2/4,string,1,1+loadprogress/100,640,480);
777 glColor4f(1.2-loadprogress/100,1.2-loadprogress/100,1.2-loadprogress/100,1);
778 text.glPrint(280,125,string,1,1,640,480);
782 if(flashamount>1)flashamount=1;
783 if(flashdelay<=0)flashamount-=multiplier;
785 if(flashamount<0)flashamount=0;
786 glDisable(GL_DEPTH_TEST); // Disables Depth Testing
787 glDisable(GL_CULL_FACE);
788 glDisable(GL_LIGHTING);
789 glDisable(GL_TEXTURE_2D);
791 glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
792 glPushMatrix(); // Store The Projection Matrix
793 glLoadIdentity(); // Reset The Projection Matrix
794 glOrtho(0,screenwidth,0,screenheight,-100,100); // Set Up An Ortho Screen
795 glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
796 glPushMatrix(); // Store The Modelview Matrix
797 glLoadIdentity(); // Reset The Modelview Matrix
798 glScalef(screenwidth,screenheight,1);
799 glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
801 glColor4f(flashr,flashg,flashb,flashamount);
803 glVertex3f(0, 0, 0.0f);
804 glVertex3f(256, 0, 0.0f);
805 glVertex3f(256, 256, 0.0f);
806 glVertex3f(0, 256, 0.0f);
808 glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
809 glPopMatrix(); // Restore The Old Projection Matrix
810 glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
811 glPopMatrix(); // Restore The Old Projection Matrix
812 glEnable(GL_DEPTH_TEST); // Enables Depth Testing
813 glEnable(GL_CULL_FACE);
823 void Game::FadeLoadingScreen(float howmuch)
825 static float loadprogress,minprogress,maxprogress;
830 glClearColor(0,0,0,1);
831 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
833 loadprogress=howmuch;
835 //loadprogress=abs(Random()%100);
839 //glEnable(GL_TEXTURE_2D);
840 glDisable(GL_TEXTURE_2D);
841 //glBindTexture( GL_TEXTURE_2D, loadscreentexture);
842 glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE );
843 glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE );
844 glDisable(GL_DEPTH_TEST); // Disables Depth Testing
845 glDisable(GL_CULL_FACE);
846 glDisable(GL_LIGHTING);
848 glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
849 glPushMatrix(); // Store The Projection Matrix
850 glLoadIdentity(); // Reset The Projection Matrix
851 glOrtho(0,screenwidth,0,screenheight,-100,100); // Set Up An Ortho Screen
852 glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
853 glPushMatrix(); // Store The Modelview Matrix
854 glLoadIdentity(); // Reset The Modelview Matrix
855 glTranslatef(screenwidth/2,screenheight/2,0);
856 glScalef((float)screenwidth/2,(float)screenheight/2,1);
857 glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
859 glColor4f(loadprogress/100,0,0,1);
860 /*if(loadscreencolor==0)glColor4f(1,1,1,1);
861 if(loadscreencolor==1)glColor4f(1,0,0,1);
862 if(loadscreencolor==2)glColor4f(0,1,0,1);
863 if(loadscreencolor==3)glColor4f(0,0,1,1);
864 if(loadscreencolor==4)glColor4f(1,1,0,1);
865 if(loadscreencolor==5)glColor4f(1,0,1,1);
868 //glScalef(.25,.25,.25);
871 glVertex3f(-1, -1, 0.0f);
873 glVertex3f(1, -1, 0.0f);
875 glVertex3f(1, 1, 0.0f);
877 glVertex3f(-1, 1, 0.0f);
880 glDisable(GL_TEXTURE_2D);
881 glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
882 glPopMatrix(); // Restore The Old Projection Matrix
883 glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
884 glPopMatrix(); // Restore The Old Projection Matrix
889 glEnable(GL_TEXTURE_2D);
890 static char string[256]="";
891 sprintf (string, "LOADING... %d%",(int)loadprogress);
893 text.glPrint(280-280*loadprogress/100/2/4,125-125*loadprogress/100/2/4,string,1,1+loadprogress/100,640,480);
894 glColor4f(1.2-loadprogress/100,1.2-loadprogress/100,1.2-loadprogress/100,1);
895 text.glPrint(280,125,string,1,1,640,480);
902 void Game::InitGame()
905 ProcessSerialNumber PSN;
906 ProcessInfoRec pinfo;
909 /* set up process serial number */
910 PSN.highLongOfPSN = 0;
911 PSN.lowLongOfPSN = kCurrentProcess;
912 /* set up info block */
913 pinfo.processInfoLength = sizeof(pinfo);
914 pinfo.processName = NULL;
915 pinfo.processAppSpec = &pspec;
916 /* grab the vrefnum and directory */
917 err = GetProcessInformation(&PSN, &pinfo);
919 vRefNum = pspec.vRefNum;
930 numchallengelevels=14;
932 accountactive=Account::loadFile(":Data:Users");
938 whichjointstartarray[0]=righthip;
939 whichjointendarray[0]=rightfoot;
941 whichjointstartarray[1]=righthip;
942 whichjointendarray[1]=rightankle;
944 whichjointstartarray[2]=righthip;
945 whichjointendarray[2]=rightknee;
947 whichjointstartarray[3]=rightknee;
948 whichjointendarray[3]=rightankle;
950 whichjointstartarray[4]=rightankle;
951 whichjointendarray[4]=rightfoot;
953 whichjointstartarray[5]=lefthip;
954 whichjointendarray[5]=leftfoot;
956 whichjointstartarray[6]=lefthip;
957 whichjointendarray[6]=leftankle;
959 whichjointstartarray[7]=lefthip;
960 whichjointendarray[7]=leftknee;
962 whichjointstartarray[8]=leftknee;
963 whichjointendarray[8]=leftankle;
965 whichjointstartarray[9]=leftankle;
966 whichjointendarray[9]=leftfoot;
968 whichjointstartarray[10]=abdomen;
969 whichjointendarray[10]=rightshoulder;
971 whichjointstartarray[11]=abdomen;
972 whichjointendarray[11]=rightelbow;
974 whichjointstartarray[12]=abdomen;
975 whichjointendarray[12]=rightwrist;
977 whichjointstartarray[13]=abdomen;
978 whichjointendarray[13]=righthand;
980 whichjointstartarray[14]=rightshoulder;
981 whichjointendarray[14]=rightelbow;
983 whichjointstartarray[15]=rightelbow;
984 whichjointendarray[15]=rightwrist;
986 whichjointstartarray[16]=rightwrist;
987 whichjointendarray[16]=righthand;
989 whichjointstartarray[17]=abdomen;
990 whichjointendarray[17]=leftshoulder;
992 whichjointstartarray[18]=abdomen;
993 whichjointendarray[18]=leftelbow;
995 whichjointstartarray[19]=abdomen;
996 whichjointendarray[19]=leftwrist;
998 whichjointstartarray[20]=abdomen;
999 whichjointendarray[20]=lefthand;
1001 whichjointstartarray[21]=leftshoulder;
1002 whichjointendarray[21]=leftelbow;
1004 whichjointstartarray[22]=leftelbow;
1005 whichjointendarray[22]=leftwrist;
1007 whichjointstartarray[23]=leftwrist;
1008 whichjointendarray[23]=lefthand;
1010 whichjointstartarray[24]=abdomen;
1011 whichjointendarray[24]=neck;
1013 whichjointstartarray[25]=neck;
1014 whichjointendarray[25]=head;
1016 FadeLoadingScreen(0);
1020 texture.data = ( GLubyte* )malloc( 1024*1024*4 );
1022 int temptexdetail=texdetail;
1024 text.LoadFontTexture(":Data:Textures:Font.png");
1026 texdetail=temptexdetail;
1028 FadeLoadingScreen(10);
1044 for (int it = 0; it < 100; ++it)
1049 for (int it = 0; it < 20; ++it)
1054 LOG("Initializing sound system...");
1059 extern bool cmdline(const char *cmd);
1060 unsigned char rc = 0;
1061 output = OPENAL_OUTPUT_ALSA; // Try alsa first...
1062 if (cmdline("forceoss")) // ...but let user override that.
1063 output = OPENAL_OUTPUT_OSS;
1064 else if (cmdline("nosound"))
1065 output = OPENAL_OUTPUT_NOSOUND;
1067 OPENAL_SetOutput(output);
1068 if ((rc = OPENAL_Init(44100, 32, 0)) == false)
1070 // if we tried ALSA and failed, fall back to OSS.
1071 if ( (output == OPENAL_OUTPUT_ALSA) && (!cmdline("forcealsa")) )
1074 output = OPENAL_OUTPUT_OSS;
1075 OPENAL_SetOutput(output);
1076 rc = OPENAL_Init(44100, 32, 0);
1083 output = OPENAL_OUTPUT_NOSOUND; // we tried! just do silence.
1084 OPENAL_SetOutput(output);
1085 rc = OPENAL_Init(44100, 32, 0);
1088 OPENAL_Init(44100, 32, 0);
1091 OPENAL_SetSFXMasterVolume((int)(volume*255));
1093 strm[stream_music3] = OPENAL_Stream_Open(ConvertFileName(":Data:Sounds:music3.mp3"), OPENAL_2D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=0;}
1094 // OPENAL_Sample_SetMinMaxDistance(strm[stream_music3], 4.0f, 1000.0f);
1095 OPENAL_Stream_SetMode(strm[stream_music3], OPENAL_LOOP_NORMAL);
1098 // PlaySoundEx( stream_music3, strm[stream_music3], NULL, true);
1099 PlayStreamEx(stream_music3, strm[stream_music3], 0, true);
1100 OPENAL_SetPaused(channels[stream_music3], false);
1101 OPENAL_SetVolume(channels[stream_music3], 256);
1104 FadeLoadingScreen(20);
1107 strm[stream_wind] = OPENAL_Stream_Open(ConvertFileName(":Data:Sounds:wind.mp3"), OPENAL_2D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
1108 // OPENAL_Sample_SetMinMaxDistance(strm[stream_wind], 4.0f, 1000.0f);
1109 OPENAL_Stream_SetMode(strm[stream_wind], OPENAL_LOOP_NORMAL);
1111 FadeLoadingScreen(30);
1113 strm[stream_desertambient] = OPENAL_Stream_Open(ConvertFileName(":Data:Sounds:desertambient.mp3"), OPENAL_2D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
1114 // OPENAL_Sample_SetMinMaxDistance(strm[stream_desertambient], 4.0f, 1000.0f);
1115 OPENAL_Stream_SetMode(strm[stream_desertambient], OPENAL_LOOP_NORMAL);
1118 FadeLoadingScreen(40);
1120 samp[firestartsound] = OPENAL_Sample_Load(OPENAL_FREE, ConvertFileName(":Data:Sounds:firestart.ogg"), OPENAL_2D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
1121 OPENAL_Sample_SetMinMaxDistance(samp[firestartsound], 8.0f, 2000.0f);
1123 strm[stream_firesound] = OPENAL_Stream_Open(ConvertFileName(":Data:Sounds:fire.ogg"), OPENAL_2D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
1124 // OPENAL_Sample_SetMinMaxDistance(strm[stream_firesound], 8.0f, 2000.0f);
1125 OPENAL_Stream_SetMode(strm[stream_firesound], OPENAL_LOOP_NORMAL);
1127 FadeLoadingScreen(50);
1129 samp[fireendsound] = OPENAL_Sample_Load(OPENAL_FREE, ConvertFileName(":Data:Sounds:fireend.ogg"), OPENAL_2D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
1130 OPENAL_Sample_SetMinMaxDistance(samp[fireendsound], 8.0f, 2000.0f);
1133 strm[stream_music1grass] = OPENAL_Stream_Open(ConvertFileName(":Data:Sounds:music1grass.mp3"), OPENAL_2D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=1;}
1134 // OPENAL_Sample_SetMinMaxDistance(strm[stream_music1grass], 4.0f, 1000.0f);
1135 OPENAL_Stream_SetMode(strm[stream_music1grass], OPENAL_LOOP_NORMAL);
1137 strm[stream_music1snow] = OPENAL_Stream_Open(ConvertFileName(":Data:Sounds:music1snow.mp3"), OPENAL_2D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=2;}
1138 // OPENAL_Sample_SetMinMaxDistance(strm[stream_music1snow], 4.0f, 1000.0f);
1139 OPENAL_Stream_SetMode(strm[stream_music1snow], OPENAL_LOOP_NORMAL);
1141 FadeLoadingScreen(60);
1143 strm[stream_music1desert] = OPENAL_Stream_Open(ConvertFileName(":Data:Sounds:music1desert.mp3"), OPENAL_2D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=3;}
1144 // OPENAL_Sample_SetMinMaxDistance(strm[stream_music1desert], 4.0f, 1000.0f);
1145 OPENAL_Stream_SetMode(strm[stream_music1desert], OPENAL_LOOP_NORMAL);
1147 FadeLoadingScreen(80);
1148 strm[stream_music2] = OPENAL_Stream_Open(ConvertFileName(":Data:Sounds:music2.ogg"), OPENAL_2D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=4;}
1149 // OPENAL_Sample_SetMinMaxDistance(strm[stream_music2], 4.0f, 1000.0f);
1150 OPENAL_Stream_SetMode(strm[stream_music2], OPENAL_LOOP_NORMAL);
1155 FadeLoadingScreen(90);
1158 LoadTexture(":Data:Textures:Cursor.png",&cursortexture,0,1);
1160 LoadTexture(":Data:Textures:MapCircle.png",&Mapcircletexture,0,1);
1161 LoadTexture(":Data:Textures:MapBox.png",&Mapboxtexture,0,1);
1162 LoadTexture(":Data:Textures:MapArrow.png",&Maparrowtexture,0,1);
1164 temptexdetail=texdetail;
1165 if(texdetail>2)texdetail=2;
1166 LoadTexture(":Data:Textures:Lugaru.png",&Mainmenuitems[0],0,0);
1167 LoadTexture(":Data:Textures:Newgame.png",&Mainmenuitems[1],0,0);
1168 LoadTexture(":Data:Textures:Options.png",&Mainmenuitems[2],0,0);
1169 LoadTexture(":Data:Textures:Quit.png",&Mainmenuitems[3],0,0);
1170 LoadTexture(":Data:Textures:World.png",&Mainmenuitems[7],0,0);
1171 LoadTexture(":Data:Textures:Eyelid.png",&Mainmenuitems[4],0,1);
1172 //LoadTexture(":Data:Textures:Eye.jpg",&Mainmenuitems[5],0,1);
1173 texdetail=temptexdetail;
1178 FadeLoadingScreen(95);
1189 newscreenwidth=screenwidth;
1190 newscreenheight=screenheight;
1194 void Game::LoadStuff()
1196 static float temptexdetail;
1197 static float viewdistdetail;
1198 static int i,j,texsize;
1205 /*musicvolume[3]=512;
1206 PlaySoundEx( music4, samp[music4], NULL, true);
1207 OPENAL_SetPaused(channels[music4], false);
1208 OPENAL_SetVolume(channels[music4], 512);
1214 //texture.data = ( GLubyte* )malloc( 1024*1024*4 );
1216 for(i=0;i<maxplayers;i++)
1218 if (glIsTexture(player[i].skeleton.drawmodel.textureptr))
1220 glDeleteTextures(1, &player[i].skeleton.drawmodel.textureptr);
1222 player[i].skeleton.drawmodel.textureptr=0;;
1225 //temptexdetail=texdetail;
1228 LoadTexture(":Data:Textures:fire.jpg",&loadscreentexture,1,0);
1229 //texdetail=temptexdetail;
1231 temptexdetail=texdetail;
1233 text.LoadFontTexture(":Data:Textures:Font.png");
1235 texdetail=temptexdetail;
1240 viewdistance=50*megascale*viewdistdetail;
1260 realtexdetail=texdetail;
1263 if(texdetail<1)texdetail=1;
1264 realtexdetail=texdetail*4;
1270 /*LoadTexture(":Data:Textures:snow.png",&terraintexture,1);
1272 LoadTexture(":Data:Textures:rock.png",&terraintexture2,1);
1274 LoadTexture(":Data:Textures:detail.png",&terraintexture3,1);
1278 LOG("Loading weapon data...");
1280 LoadTexture(":Data:Textures:knife.png",&weapons.knifetextureptr,0,1);
1281 LoadTexture(":Data:Textures:bloodknife.png",&weapons.bloodknifetextureptr,0,1);
1282 LoadTexture(":Data:Textures:lightbloodknife.png",&weapons.lightbloodknifetextureptr,0,1);
1283 LoadTexture(":Data:Textures:sword.jpg",&weapons.swordtextureptr,1,0);
1284 LoadTexture(":Data:Textures:Swordblood.jpg",&weapons.bloodswordtextureptr,1,0);
1285 LoadTexture(":Data:Textures:Swordbloodlight.jpg",&weapons.lightbloodswordtextureptr,1,0);
1286 LoadTexture(":Data:Textures:Staff.jpg",&weapons.stafftextureptr,1,0);
1288 weapons.throwingknifemodel.load((char *)":Data:Models:throwingknife.solid",1);
1289 weapons.throwingknifemodel.Scale(.001,.001,.001);
1290 //weapons.throwingknifemodel.Rotate(0,0,-90);
1291 weapons.throwingknifemodel.Rotate(90,0,0);
1292 weapons.throwingknifemodel.Rotate(0,90,0);
1293 weapons.throwingknifemodel.flat=0;
1294 weapons.throwingknifemodel.CalculateNormals(1);
1295 //weapons.throwingknifemodel.ScaleNormals(-1,-1,-1);
1297 weapons.swordmodel.load((char *)":Data:Models:sword.solid",1);
1298 weapons.swordmodel.Scale(.001,.001,.001);
1299 //weapons.swordmodel.Rotate(0,0,-90);
1300 weapons.swordmodel.Rotate(90,0,0);
1301 weapons.swordmodel.Rotate(0,90,0);
1302 weapons.swordmodel.Rotate(0,0,90);
1303 weapons.swordmodel.flat=1;
1304 weapons.swordmodel.CalculateNormals(1);
1305 //weapons.swordmodel.ScaleNormals(-1,-1,-1);
1307 weapons.staffmodel.load((char *)":Data:Models:staff.solid",1);
1308 weapons.staffmodel.Scale(.005,.005,.005);
1309 //weapons.staffmodel.Rotate(0,0,-90);
1310 weapons.staffmodel.Rotate(90,0,0);
1311 weapons.staffmodel.Rotate(0,90,0);
1312 weapons.staffmodel.Rotate(0,0,90);
1313 weapons.staffmodel.flat=1;
1314 weapons.staffmodel.CalculateNormals(1);
1315 //weapons.staffmodel.ScaleNormals(-1,-1,-1);
1317 //temptexdetail=texdetail;
1318 //if(texdetail>4)texdetail=4;
1319 LoadTexture(":Data:Textures:shadow.png",&terrain.shadowtexture,0,1);
1321 LoadTexture(":Data:Textures:blood.png",&terrain.bloodtexture,0,1);
1323 LoadTexture(":Data:Textures:break.png",&terrain.breaktexture,0,1);
1325 LoadTexture(":Data:Textures:blood.png",&terrain.bloodtexture2,0,1);
1328 LoadTexture(":Data:Textures:footprint.png",&terrain.footprinttexture,0,1);
1330 LoadTexture(":Data:Textures:bodyprint.png",&terrain.bodyprinttexture,0,1);
1332 /*LoadTexture(":Data:Textures:cloud.png",&Sprite::cloudtexture,1);
1334 LoadTexture(":Data:Textures:cloudimpact.png",&Sprite::cloudimpacttexture,1);
1336 LoadTexture(":Data:Textures:bloodparticle.png",&Sprite::bloodtexture,1);
1338 LoadTexture(":Data:Textures:snowflake.png",&Sprite::snowflaketexture,1);
1340 LoadTexture(":Data:Textures:flame.png",&Sprite::flametexture,1);
1342 LoadTexture(":Data:Textures:smoke.png",&Sprite::smoketexture,1);
1343 //texdetail=temptexdetail;
1344 LoadTexture(":Data:Textures:shine.png",&Sprite::shinetexture,1);*/
1348 LoadTexture(":Data:Textures:hawk.png",&hawktexture,0,1);
1350 LoadTexture(":Data:Textures:logo.png",&logotexture,0,1);
1353 //LoadTexture(":Data:Textures:box.jpg",&objects.boxtextureptr,1,0);
1356 LoadTexture(":Data:Textures:cloud.png",&Sprite::cloudtexture,1,1);
1357 LoadTexture(":Data:Textures:cloudimpact.png",&Sprite::cloudimpacttexture,1,1);
1358 LoadTexture(":Data:Textures:bloodparticle.png",&Sprite::bloodtexture,1,1);
1359 LoadTexture(":Data:Textures:snowflake.png",&Sprite::snowflaketexture,1,1);
1360 LoadTexture(":Data:Textures:flame.png",&Sprite::flametexture,1,1);
1361 LoadTexture(":Data:Textures:bloodflame.png",&Sprite::bloodflametexture,1,1);
1362 LoadTexture(":Data:Textures:smoke.png",&Sprite::smoketexture,1,1);
1363 LoadTexture(":Data:Textures:shine.png",&Sprite::shinetexture,1,0);
1364 LoadTexture(":Data:Textures:splinter.png",&Sprite::splintertexture,1,1);
1365 LoadTexture(":Data:Textures:leaf.png",&Sprite::leaftexture,1,1);
1366 LoadTexture(":Data:Textures:tooth.png",&Sprite::toothtexture,1,1);
1370 ReSizeGLScene(90,.01);
1377 if(detail)kTextureSize=1024;
1378 if(detail==1)kTextureSize=512;
1379 if(detail==0)kTextureSize=256;
1382 //drawmode=motionblurmode;
1384 //Set up distant light
1388 light.ambient[0]=.2;
1389 light.ambient[1]=.2;
1390 light.ambient[2]=.24;
1393 light.location.z=-.2;
1394 Normalise(&light.location);
1404 texscale=.2/megascale/viewdistdetail;
1405 terrain.scale=3*megascale*terraindetail*viewdistdetail;
1407 viewer.x=terrain.size/2*terrain.scale;
1408 viewer.z=terrain.size/2*terrain.scale;
1410 hawk.load((char *)":Data:Models:hawk.solid",1);
1411 hawk.Scale(.03,.03,.03);
1412 hawk.Rotate(90,1,1);
1413 hawk.CalculateNormals(0);
1414 hawk.ScaleNormals(-1,-1,-1);
1415 hawkcoords.x=terrain.size/2*terrain.scale-5-7;
1416 hawkcoords.z=terrain.size/2*terrain.scale-5-7;
1417 hawkcoords.y=terrain.getHeight(hawkcoords.x,hawkcoords.z)+25;
1420 eye.load((char *)":Data:Models:eye.solid",1);
1421 eye.Scale(.03,.03,.03);
1422 eye.CalculateNormals(0);
1424 cornea.load((char *)":Data:Models:cornea.solid",1);
1425 cornea.Scale(.03,.03,.03);
1426 cornea.CalculateNormals(0);
1428 iris.load((char *)":Data:Models:iris.solid",1);
1429 iris.Scale(.03,.03,.03);
1430 iris.CalculateNormals(0);
1432 LoadSave(":Data:Textures:Bloodfur.png",0,1,&bloodText[0],0);
1433 LoadSave(":Data:Textures:Wolfbloodfur.png",0,1,&wolfbloodText[0],0);
1441 //if(targetlevel!=7)
1442 Loadlevel(targetlevel);
1445 rabbitcoords=player[0].coords;
1446 rabbitcoords.y=terrain.getHeight(rabbitcoords.x,rabbitcoords.z);
1448 animation[runanim].Load((char *)":Data:Animations:Run",middleheight,neutral);
1450 animation[bounceidleanim].Load((char *)":Data:Animations:Idle",middleheight,neutral);
1451 animation[stopanim].Load((char *)":Data:Animations:Stop",middleheight,neutral);
1453 animation[jumpupanim].Load((char *)":Data:Animations:JumpUp",highheight,neutral);
1454 animation[jumpdownanim].Load((char *)":Data:Animations:JumpDown",highheight,neutral);
1456 animation[landanim].Load((char *)":Data:Animations:Landing",lowheight,neutral);
1457 animation[landhardanim].Load((char *)":Data:Animations:Landhard",lowheight,neutral);
1458 animation[climbanim].Load((char *)":Data:Animations:Climb",lowheight,neutral);
1459 animation[hanganim].Load((char *)":Data:Animations:Hangon",lowheight,neutral);
1460 animation[spinkickanim].Load((char *)":Data:Animations:SpinKick",middleheight,normalattack);
1462 animation[getupfromfrontanim].Load((char *)":Data:Animations:GetUpFromFront",lowheight,neutral);
1463 animation[getupfrombackanim].Load((char *)":Data:Animations:GetUpFromBack",lowheight,neutral);
1464 animation[crouchanim].Load((char *)":Data:Animations:Crouch",lowheight,neutral);
1465 animation[sneakanim].Load((char *)":Data:Animations:Sneak",lowheight,neutral);
1466 animation[rollanim].Load((char *)":Data:Animations:Roll",lowheight,neutral);
1467 animation[flipanim].Load((char *)":Data:Animations:Flip",highheight,neutral);
1468 animation[frontflipanim].Load((char *)":Data:Animations:Flip",highheight,neutral);
1469 animation[spinkickreversedanim].Load((char *)":Data:Animations:SpinKickCaught",middleheight,reversed);
1471 animation[spinkickreversalanim].Load((char *)":Data:Animations:SpinKickCatch",middleheight,reversal);
1472 animation[lowkickanim].Load((char *)":Data:Animations:lowkick",middleheight,normalattack);
1473 animation[sweepanim].Load((char *)":Data:Animations:sweep",lowheight,normalattack);
1474 animation[sweepreversedanim].Load((char *)":Data:Animations:SweepCaught",lowheight,reversed);
1475 animation[sweepreversalanim].Load((char *)":Data:Animations:SweepCatch",middleheight,reversal);
1476 animation[rabbitkickanim].Load((char *)":Data:Animations:RabbitKick",middleheight,normalattack);
1477 animation[rabbitkickreversedanim].Load((char *)":Data:Animations:RabbitKickCaught",middleheight,reversed);
1478 animation[rabbitkickreversalanim].Load((char *)":Data:Animations:RabbitKickCatch",lowheight,reversal);
1479 animation[upunchanim].Load((char *)":Data:Animations:Upunch",middleheight,normalattack);
1480 animation[staggerbackhighanim].Load((char *)":Data:Animations:Staggerbackhigh",middleheight,neutral);
1481 animation[upunchreversedanim].Load((char *)":Data:Animations:UpunchCaught",middleheight,reversed);
1483 animation[upunchreversalanim].Load((char *)":Data:Animations:UpunchCatch",middleheight,reversal);
1484 animation[hurtidleanim].Load((char *)":Data:Animations:Hurtidle",middleheight,neutral);
1485 animation[backhandspringanim].Load((char *)":Data:Animations:Backhandspring",middleheight,neutral);
1486 animation[fightidleanim].Load((char *)":Data:Animations:Fightidle",middleheight,neutral);
1487 animation[walkanim].Load((char *)":Data:Animations:Walk",middleheight,neutral);
1489 animation[fightsidestep].Load((char *)":Data:Animations:Fightsidestep",middleheight,neutral);
1490 animation[killanim].Load((char *)":Data:Animations:Kill",middleheight,normalattack);
1491 animation[sneakattackanim].Load((char *)":Data:Animations:Sneakattack",middleheight,reversal);
1492 animation[sneakattackedanim].Load((char *)":Data:Animations:Sneakattacked",middleheight,reversed);
1493 animation[drawrightanim].Load((char *)":Data:Animations:drawright",middleheight,neutral);
1494 animation[knifeslashstartanim].Load((char *)":Data:Animations:slashstart",middleheight,normalattack);
1495 animation[crouchdrawrightanim].Load((char *)":Data:Animations:crouchdrawright",lowheight,neutral);
1496 animation[crouchstabanim].Load((char *)":Data:Animations:crouchstab",lowheight,normalattack);
1498 animation[knifefollowanim].Load((char *)":Data:Animations:slashfollow",middleheight,reversal);
1499 animation[knifefollowedanim].Load((char *)":Data:Animations:slashfollowed",middleheight,reversed);
1500 animation[knifethrowanim].Load((char *)":Data:Animations:knifethrow",middleheight,normalattack);
1501 animation[removeknifeanim].Load((char *)":Data:Animations:removeknife",middleheight,neutral);
1502 animation[crouchremoveknifeanim].Load((char *)":Data:Animations:crouchremoveknife",lowheight,neutral);
1503 animation[jumpreversedanim].Load((char *)":Data:Animations:JumpCaught",middleheight,reversed);
1504 animation[jumpreversalanim].Load((char *)":Data:Animations:JumpCatch",middleheight,reversal);
1505 animation[staggerbackhardanim].Load((char *)":Data:Animations:Staggerbackhard",middleheight,neutral);
1507 animation[dropkickanim].Load((char *)":Data:Animations:Dropkick",middleheight,normalattack);
1508 animation[winduppunchanim].Load((char *)":Data:Animations:Winduppunch",middleheight,normalattack);
1509 animation[winduppunchblockedanim].Load((char *)":Data:Animations:Winduppunchblocked",middleheight,normalattack);
1510 animation[blockhighleftanim].Load((char *)":Data:Animations:Blockhighleft",middleheight,normalattack);
1511 animation[blockhighleftstrikeanim].Load((char *)":Data:Animations:Blockhighleftstrike",middleheight,normalattack);
1512 animation[backflipanim].Load((char *)":Data:Animations:Backflip",highheight,neutral);
1513 animation[walljumpbackanim].Load((char *)":Data:Animations:Walljumpback",highheight,neutral);
1514 animation[walljumpfrontanim].Load((char *)":Data:Animations:Walljumpfront",highheight,neutral);
1515 animation[rightflipanim].Load((char *)":Data:Animations:Rightflip",highheight,neutral);
1516 animation[walljumprightanim].Load((char *)":Data:Animations:Walljumpright",highheight,neutral);
1517 animation[leftflipanim].Load((char *)":Data:Animations:Leftflip",highheight,neutral);
1518 animation[walljumpleftanim].Load((char *)":Data:Animations:Walljumpleft",highheight,neutral);
1519 animation[walljumprightkickanim].Load((char *)":Data:Animations:Walljumprightkick",highheight,neutral);
1520 animation[walljumpleftkickanim].Load((char *)":Data:Animations:Walljumpleftkick",highheight,neutral);
1521 animation[knifefightidleanim].Load((char *)":Data:Animations:Knifefightidle",middleheight,neutral);
1522 animation[knifesneakattackanim].Load((char *)":Data:Animations:Knifesneakattack",middleheight,reversal);
1523 animation[knifesneakattackedanim].Load((char *)":Data:Animations:Knifesneakattacked",middleheight,reversed);
1524 animation[swordfightidleanim].Load((char *)":Data:Animations:swordfightidle",middleheight,neutral);
1525 animation[drawleftanim].Load((char *)":Data:Animations:drawleft",middleheight,neutral);
1526 animation[swordslashanim].Load((char *)":Data:Animations:swordslash",middleheight,normalattack);
1527 animation[swordgroundstabanim].Load((char *)":Data:Animations:swordgroundstab",lowheight,normalattack);
1528 animation[dodgebackanim].Load((char *)":Data:Animations:dodgeback",middleheight,neutral);
1529 animation[swordsneakattackanim].Load((char *)":Data:Animations:Swordsneakattack",middleheight,reversal);
1530 animation[swordsneakattackedanim].Load((char *)":Data:Animations:Swordsneakattacked",middleheight,reversed);
1531 animation[swordslashreversedanim].Load((char *)":Data:Animations:swordslashCaught",middleheight,reversed);
1532 animation[swordslashreversalanim].Load((char *)":Data:Animations:swordslashCatch",middleheight,reversal);
1533 animation[knifeslashreversedanim].Load((char *)":Data:Animations:knifeslashCaught",middleheight,reversed);
1534 animation[knifeslashreversalanim].Load((char *)":Data:Animations:knifeslashCatch",middleheight,reversal);
1535 animation[swordfightidlebothanim].Load((char *)":Data:Animations:swordfightidleboth",middleheight,neutral);
1536 animation[swordslashparryanim].Load((char *)":Data:Animations:sworduprightparry",middleheight,normalattack);
1537 animation[swordslashparriedanim].Load((char *)":Data:Animations:swordslashparried",middleheight,normalattack);
1538 animation[wolfidle].Load((char *)":Data:Animations:Wolfidle",middleheight,neutral);
1539 animation[wolfcrouchanim].Load((char *)":Data:Animations:Wolfcrouch",lowheight,neutral);
1540 animation[wolflandanim].Load((char *)":Data:Animations:Wolflanding",lowheight,neutral);
1541 animation[wolflandhardanim].Load((char *)":Data:Animations:Wolflandhard",lowheight,neutral);
1542 animation[wolfrunanim].Load((char *)":Data:Animations:Wolfrun",middleheight,neutral);
1543 animation[wolfrunninganim].Load((char *)":Data:Animations:Wolfrunning",middleheight,neutral);
1544 animation[rabbitrunninganim].Load((char *)":Data:Animations:Rabbitrunning",middleheight,neutral);
1545 animation[wolfstopanim].Load((char *)":Data:Animations:Wolfstop",middleheight,neutral);
1546 animation[rabbittackleanim].Load((char *)":Data:Animations:Rabbittackle",middleheight,neutral);
1547 animation[rabbittacklinganim].Load((char *)":Data:Animations:Rabbittackling",middleheight,reversal);
1548 animation[rabbittackledbackanim].Load((char *)":Data:Animations:Rabbittackledback",middleheight,reversed);
1549 animation[rabbittackledfrontanim].Load((char *)":Data:Animations:Rabbittackledfront",middleheight,reversed);
1550 animation[wolfslapanim].Load((char *)":Data:Animations:Wolfslap",middleheight,normalattack);
1551 animation[staffhitanim].Load((char *)":Data:Animations:StaffHit",middleheight,normalattack);
1552 animation[staffgroundsmashanim].Load((char *)":Data:Animations:StaffGroundSmash",lowheight,normalattack);
1553 animation[staffspinhitanim].Load((char *)":Data:Animations:Spinwhack",middleheight,normalattack);
1554 animation[staffhitreversedanim].Load((char *)":Data:Animations:StaffHitCaught",middleheight,reversed);
1555 animation[staffhitreversalanim].Load((char *)":Data:Animations:StaffHitCatch",middleheight,reversal);
1556 animation[staffspinhitreversedanim].Load((char *)":Data:Animations:SpinWhackCaught",middleheight,reversed);
1557 animation[staffspinhitreversalanim].Load((char *)":Data:Animations:SpinWhackCatch",middleheight,reversal);
1559 animation[sitanim].Load((char *)":Data:Animations:Sit",lowheight,neutral);
1560 animation[sleepanim].Load((char *)":Data:Animations:Sleep",lowheight,neutral);
1561 animation[talkidleanim].Load((char *)":Data:Animations:TalkIdle",middleheight,neutral);
1563 animation[sitwallanim].Load((char *)":Data:Animations:Dying",lowheight,neutral);
1564 animation[dead1anim].Load((char *)":Data:Animations:Dead1",lowheight,neutral);
1565 animation[dead2anim].Load((char *)":Data:Animations:Dead2",lowheight,neutral);
1566 animation[dead3anim].Load((char *)":Data:Animations:Dead3",lowheight,neutral);
1567 animation[dead4anim].Load((char *)":Data:Animations:Dead4",lowheight,neutral);
1568 //Fix knife stab, too lazy to do it manually
1572 for(i=0;i<player[0].skeleton.num_joints;i++){
1573 for(j=0;j<animation[knifesneakattackanim].numframes;j++){
1574 animation[knifesneakattackanim].position[i][j]+=moveamount;
1581 for(i=0;i<player[0].skeleton.num_joints;i++){
1582 for(j=0;j<animation[knifesneakattackedanim].numframes;j++){
1583 animation[knifesneakattackedanim].position[i][j]+=moveamount;
1590 for(i=0;i<player[0].skeleton.num_joints;i++){
1591 animation[dead1anim].position[i][1]=animation[dead1anim].position[i][0];
1592 animation[dead2anim].position[i][1]=animation[dead2anim].position[i][0];
1593 animation[dead3anim].position[i][1]=animation[dead3anim].position[i][0];
1594 animation[dead4anim].position[i][1]=animation[dead4anim].position[i][0];
1596 animation[dead1anim].speed[0]=0.001;
1597 animation[dead2anim].speed[0]=0.001;
1598 animation[dead3anim].speed[0]=0.001;
1599 animation[dead4anim].speed[0]=0.001;
1601 animation[dead1anim].speed[1]=0.001;
1602 animation[dead2anim].speed[1]=0.001;
1603 animation[dead3anim].speed[1]=0.001;
1604 animation[dead4anim].speed[1]=0.001;
1606 for(i=0;i<player[0].skeleton.num_joints;i++){
1607 for(j=0;j<animation[swordsneakattackanim].numframes;j++){
1608 animation[swordsneakattackanim].position[i][j]+=moveamount;
1613 for(j=0;j<animation[swordsneakattackanim].numframes;j++){
1614 animation[swordsneakattackanim].weapontarget[j]+=moveamount;
1620 for(i=0;i<player[0].skeleton.num_joints;i++){
1621 for(j=0;j<animation[swordsneakattackedanim].numframes;j++){
1622 animation[swordsneakattackedanim].position[i][j]+=moveamount;
1626 for(i=0;i<player[0].skeleton.num_joints;i++){
1627 for(j=0;j<animation[sleepanim].numframes;j++){
1628 animation[sleepanim].position[i][j]=DoRotation(animation[sleepanim].position[i][j],0,180,0);
1634 temptexdetail=texdetail;
1636 texdetail=temptexdetail;
1643 glPixelStorei( GL_UNPACK_ALIGNMENT, 1 );
1645 glGenTextures( 1, &screentexture );
1646 glTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE );
1649 glEnable(GL_TEXTURE_2D);
1650 glBindTexture( GL_TEXTURE_2D, screentexture);
1651 glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR );
1652 glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR );
1654 glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 0, 0, kTextureSize, kTextureSize, 0);
1660 /*PlaySoundEx( consolesuccesssound, samp[consolesuccesssound], NULL, true);
1661 OPENAL_SetVolume(channels[consolesuccesssound], 256);
1662 OPENAL_SetPaused(channels[consolesuccesssound], false);
1665 float gLoc[3]={0,0,0};
1666 float vel[3]={0,0,0};
1667 OPENAL_Sample_SetMinMaxDistance(samp[fireendsound], 9999.0f, 99999.0f);
1668 PlaySoundEx( fireendsound, samp[fireendsound], NULL, true);
1669 OPENAL_3D_SetAttributes(channels[fireendsound], gLoc, vel);
1670 OPENAL_SetVolume(channels[fireendsound], 256);
1671 OPENAL_SetPaused(channels[fireendsound], false);
1672 OPENAL_Sample_SetMinMaxDistance(samp[fireendsound], 8.0f, 2000.0f);