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 extern float screenwidth,screenheight;
24 extern float viewdistance;
26 extern XYZ lightlocation;
27 extern float lightambient[3],lightbrightness[3];
28 extern float fadestart;
29 extern float texscale;
32 extern Animation animation[animation_count];
33 extern Skeleton testskeleton;
35 extern FSOUND_SAMPLE *samp[100];
36 extern int channels[100];
37 extern Terrain terrain;
38 extern Sprites sprites;
39 extern int kTextureSize;
40 extern float texdetail;
41 extern float realtexdetail;
42 extern float terraindetail;
44 extern Objects objects;
46 extern bool cellophane;
47 extern GLubyte bloodText[512*512*3];
48 extern GLubyte wolfbloodText[512*512*3];
49 extern bool ismotionblur;
50 extern bool trilinear;
52 extern bool musictoggle;
53 extern Weapons weapons;
54 extern Person player[maxplayers];
55 extern int numplayers;
56 extern int environment;
57 extern bool ambientsound;
58 extern float multiplier;
59 extern int newnetmessages;
60 extern int netdatanew;
62 extern bool stillloading;
63 extern TGAImageRec texture;
67 extern int oldmainmenu;
68 extern bool visibleloading;
69 extern int loadscreencolor;
70 extern float flashamount,flashr,flashg,flashb;
71 extern int flashdelay;
72 extern int whichjointstartarray[26];
73 extern int whichjointendarray[26];
74 extern int difficulty;
75 extern float tintr,tintg,tintb;
76 extern float slomospeed;
77 extern char mapname[256];
78 extern bool gamestarted;
80 extern int numaccounts;
81 extern int accountactive;
82 extern int accountdifficulty[10];
83 extern int accountprogress[10];
84 extern float accountpoints[10];
85 extern float accounthighscore[10][50];
86 extern float accountfasttime[10][50];
87 extern bool accountunlocked[10][60];
88 extern char accountname[10][256];
90 extern int numdialogues;
91 extern int numdialogueboxes[20];
92 extern int dialoguetype[20];
93 extern int dialogueboxlocation[20][20];
94 extern float dialogueboxcolor[20][20][3];
95 extern int dialogueboxsound[20][20];
96 extern char dialoguetext[20][20][128];
97 extern char dialoguename[20][20][64];
98 extern XYZ dialoguecamera[20][20];
99 extern float dialoguecamerarotation[20][20];
100 extern float dialoguecamerarotation2[20][20];
101 extern int indialogue;
102 extern int whichdialogue;
103 extern float dialoguetime;
105 extern float accountcampaignhighscore[10];
106 extern float accountcampaignfasttime[10];
107 extern float accountcampaignscore[10];
108 extern float accountcampaigntime[10];
110 extern int accountcampaignchoicesmade[10];
111 extern int accountcampaignchoices[10][5000];
113 extern FSOUND_STREAM * strm[20];
115 extern "C" void PlaySoundEx(int channel, FSOUND_SAMPLE *sptr, FSOUND_DSPUNIT *dsp, signed char startpaused);
116 extern "C" void PlayStreamEx(int chan, FSOUND_STREAM *sptr, FSOUND_DSPUNIT *dsp, signed char startpaused);
118 Game::TextureList Game::textures;
127 accountcampaignchoicesmade[accountactive]=0;
128 accountcampaignscore[accountactive]=0;
129 accountcampaigntime[accountactive]=0;
134 sprintf (mapname, ":Data:Users");
137 tfile=fopen( mapname, "wb" );
140 fpackf(tfile, "Bi", numaccounts);
141 fpackf(tfile, "Bi", accountactive);
144 for(i=0;i<numaccounts;i++)
146 fpackf(tfile, "Bf", accountcampaigntime[i]);
147 fpackf(tfile, "Bf", accountcampaignscore[i]);
148 fpackf(tfile, "Bf", accountcampaignfasttime[i]);
149 fpackf(tfile, "Bf", accountcampaignhighscore[i]);
150 fpackf(tfile, "Bi", accountdifficulty[i]);
151 fpackf(tfile, "Bi", accountprogress[i]);
152 fpackf(tfile, "Bi", accountcampaignchoicesmade[i]);
153 for(j=0;j<accountcampaignchoicesmade[i];j++)
155 fpackf(tfile, "Bi", accountcampaignchoices[i][j]);
157 fpackf(tfile, "Bf", accountpoints[i]);
160 fpackf(tfile, "Bf", accounthighscore[i][j]);
161 fpackf(tfile, "Bf", accountfasttime[i][j]);
165 fpackf(tfile, "Bb", accountunlocked[i][j]);
167 fpackf(tfile, "Bi", strlen(accountname[i]));
168 if(strlen(accountname[i])>0)
170 for(j=0;j<(int)strlen(accountname[i]);j++)
172 fpackf(tfile, "Bb", accountname[i][j]);
181 TexIter it = textures.begin();
182 for (; it != textures.end(); ++it)
184 if (glIsTexture(it->second))
185 glDeleteTextures(1, &it->second);
189 LOG("Shutting down sound system...");
191 FSOUND_StopSound(FSOUND_ALL);
193 // this is causing problems on Linux, but we'll force an _exit() a little
194 // later in the shutdown process. --ryan.
196 #define streamcount 20
197 #define samplecount 100
199 for (i=0; i < samplecount; ++i)
201 FSOUND_Sample_Free(samp[i]);
204 for (i=0; i < streamcount; ++i)
206 FSOUND_Stream_Close(strm[i]);
219 //void Game::LoadSounds();
220 void Game::LoadSounds()
224 LOG(std::string("Loading sounds..."));
226 FSOUND_3D_SetDopplerFactor(0);
228 FSOUND_SetSFXMasterVolume((int)(volume*255));
230 samp[footstepsound] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:footstepsnow1.ogg", FSOUND_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
231 FSOUND_Sample_SetMinMaxDistance(samp[footstepsound], 4.0f, 1000.0f);
233 samp[footstepsound2] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:footstepsnow2.ogg", FSOUND_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
234 FSOUND_Sample_SetMinMaxDistance(samp[footstepsound2], 4.0f, 1000.0f);
236 samp[footstepsound3] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:footstepstone1.ogg", FSOUND_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
237 FSOUND_Sample_SetMinMaxDistance(samp[footstepsound3], 4.0f, 1000.0f);
239 samp[footstepsound4] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:footstepstone2.ogg", FSOUND_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
240 FSOUND_Sample_SetMinMaxDistance(samp[footstepsound4], 4.0f, 1000.0f);
242 samp[landsound] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:land.ogg", FSOUND_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
243 FSOUND_Sample_SetMinMaxDistance(samp[landsound], 4.0f, 1000.0f);
245 samp[jumpsound] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:jump.ogg", FSOUND_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
246 FSOUND_Sample_SetMinMaxDistance(samp[jumpsound], 4.0f, 1000.0f);
248 samp[hawksound] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:hawk.ogg", FSOUND_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
249 FSOUND_Sample_SetMinMaxDistance(samp[hawksound], 40.0f, 10000.0f);
251 samp[whooshsound] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:whoosh.ogg", FSOUND_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
252 FSOUND_Sample_SetMinMaxDistance(samp[whooshsound], 4.0f, 1000.0f);
253 FSOUND_Sample_SetMode(samp[whooshsound], FSOUND_LOOP_NORMAL);
255 samp[landsound1] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:land1.ogg", FSOUND_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
256 FSOUND_Sample_SetMinMaxDistance(samp[landsound1], 4.0f, 1000.0f);
260 samp[landsound2] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:land2.ogg", FSOUND_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
261 FSOUND_Sample_SetMinMaxDistance(samp[landsound2], 4.0f, 1000.0f);
263 samp[breaksound] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:broken.ogg", FSOUND_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
264 FSOUND_Sample_SetMinMaxDistance(samp[breaksound], 8.0f, 2000.0f);
266 samp[lowwhooshsound] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:Lowwhoosh.ogg", FSOUND_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
267 FSOUND_Sample_SetMinMaxDistance(samp[lowwhooshsound], 8.0f, 2000.0f);
269 samp[midwhooshsound] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:midwhoosh.ogg", FSOUND_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
270 FSOUND_Sample_SetMinMaxDistance(samp[midwhooshsound], 8.0f, 2000.0f);
272 samp[highwhooshsound] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:highwhoosh.ogg", FSOUND_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
273 FSOUND_Sample_SetMinMaxDistance(samp[highwhooshsound], 8.0f, 2000.0f);
275 samp[movewhooshsound] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:movewhoosh.ogg", FSOUND_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
276 FSOUND_Sample_SetMinMaxDistance(samp[movewhooshsound], 8.0f, 2000.0f);
278 samp[heavyimpactsound] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:heavyimpact.ogg", FSOUND_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
279 FSOUND_Sample_SetMinMaxDistance(samp[heavyimpactsound], 8.0f, 2000.0f);
281 samp[whooshhitsound] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:Whooshhit.ogg", FSOUND_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
282 FSOUND_Sample_SetMinMaxDistance(samp[whooshhitsound], 8.0f, 2000.0f);
284 samp[thudsound] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:thud.ogg", FSOUND_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
285 FSOUND_Sample_SetMinMaxDistance(samp[thudsound], 8.0f, 2000.0f);
287 samp[alarmsound] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:alarm.ogg", FSOUND_2D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
288 FSOUND_Sample_SetMinMaxDistance(samp[alarmsound], 8.0f, 2000.0f);
290 samp[breaksound2] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:break.ogg", FSOUND_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
291 FSOUND_Sample_SetMinMaxDistance(samp[breaksound2], 8.0f, 2000.0f);
293 samp[knifedrawsound] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:knifedraw.ogg", FSOUND_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
294 FSOUND_Sample_SetMinMaxDistance(samp[knifedrawsound], 8.0f, 2000.0f);
296 samp[knifesheathesound] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:knifesheathe.ogg", FSOUND_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
297 FSOUND_Sample_SetMinMaxDistance(samp[knifesheathesound], 8.0f, 2000.0f);
299 samp[fleshstabsound] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:Fleshstab.ogg", FSOUND_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
300 FSOUND_Sample_SetMinMaxDistance(samp[fleshstabsound], 8.0f, 2000.0f);
302 samp[fleshstabremovesound] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:Fleshstabremove.ogg", FSOUND_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
303 FSOUND_Sample_SetMinMaxDistance(samp[fleshstabremovesound], 8.0f, 2000.0f);
305 samp[knifeswishsound] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:knifeswish.ogg", FSOUND_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
306 FSOUND_Sample_SetMinMaxDistance(samp[knifeswishsound], 8.0f, 2000.0f);
308 samp[knifeslicesound] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:knifeslice.ogg", FSOUND_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
309 FSOUND_Sample_SetMinMaxDistance(samp[knifeslicesound], 8.0f, 2000.0f);
311 samp[swordslicesound] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:swordslice.ogg", FSOUND_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
312 FSOUND_Sample_SetMinMaxDistance(samp[swordslicesound], 8.0f, 2000.0f);
314 samp[skidsound] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:skid.ogg", FSOUND_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
315 FSOUND_Sample_SetMinMaxDistance(samp[skidsound], 8.0f, 2000.0f);
317 samp[snowskidsound] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:snowskid.ogg", FSOUND_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
318 FSOUND_Sample_SetMinMaxDistance(samp[snowskidsound], 8.0f, 2000.0f);
320 samp[bushrustle] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:bushrustle.ogg", FSOUND_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
321 FSOUND_Sample_SetMinMaxDistance(samp[bushrustle], 4.0f, 1000.0f);
323 samp[clank1sound] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:clank1.ogg", FSOUND_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
324 FSOUND_Sample_SetMinMaxDistance(samp[clank1sound], 8.0f, 2000.0f);
326 samp[clank2sound] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:clank2.ogg", FSOUND_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
327 FSOUND_Sample_SetMinMaxDistance(samp[clank2sound], 8.0f, 2000.0f);
329 samp[clank3sound] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:clank3.ogg", FSOUND_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
330 FSOUND_Sample_SetMinMaxDistance(samp[clank3sound], 8.0f, 2000.0f);
332 samp[clank4sound] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:clank4.ogg", FSOUND_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
333 FSOUND_Sample_SetMinMaxDistance(samp[clank4sound], 8.0f, 2000.0f);
335 samp[consolesuccesssound] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:consolesuccess.ogg", FSOUND_2D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
336 FSOUND_Sample_SetMinMaxDistance(samp[consolesuccesssound], 4.0f, 1000.0f);
338 samp[consolefailsound] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:consolefail.ogg", FSOUND_2D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
339 FSOUND_Sample_SetMinMaxDistance(samp[consolefailsound], 4.0f, 1000.0f);
341 samp[metalhitsound] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:MetalHit.ogg", FSOUND_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
342 FSOUND_Sample_SetMinMaxDistance(samp[metalhitsound], 8.0f, 2000.0f);
344 samp[clawslicesound] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:clawslice.ogg", FSOUND_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
345 FSOUND_Sample_SetMinMaxDistance(samp[clawslicesound], 8.0f, 2000.0f);
347 samp[splattersound] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:splatter.ogg", FSOUND_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
348 FSOUND_Sample_SetMinMaxDistance(samp[splattersound], 8.0f, 2000.0f);
350 samp[growlsound] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:Growl.ogg", FSOUND_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
351 FSOUND_Sample_SetMinMaxDistance(samp[growlsound], 1000.0f, 2000.0f);
353 samp[growl2sound] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:Growl2.ogg", FSOUND_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
354 FSOUND_Sample_SetMinMaxDistance(samp[growl2sound], 1000.0f, 2000.0f);
356 samp[barksound] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:bark.ogg", FSOUND_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
357 FSOUND_Sample_SetMinMaxDistance(samp[barksound], 1000.0f, 2000.0f);
359 samp[bark2sound] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:bark2.ogg", FSOUND_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
360 FSOUND_Sample_SetMinMaxDistance(samp[bark2sound], 1000.0f, 2000.0f);
362 samp[bark3sound] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:bark3.ogg", FSOUND_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
363 FSOUND_Sample_SetMinMaxDistance(samp[bark3sound], 1000.0f, 2000.0f);
365 samp[snarlsound] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:snarl.ogg", FSOUND_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
366 FSOUND_Sample_SetMinMaxDistance(samp[snarlsound], 1000.0f, 2000.0f);
369 samp[snarl2sound] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:snarl2.ogg", FSOUND_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
370 FSOUND_Sample_SetMinMaxDistance(samp[snarl2sound], 1000.0f, 2000.0f);
372 samp[barkgrowlsound] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:barkgrowl.ogg", FSOUND_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
373 FSOUND_Sample_SetMinMaxDistance(samp[barkgrowlsound], 1000.0f, 2000.0f);
375 samp[rabbitattacksound] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:rabbitattack.ogg", FSOUND_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
376 FSOUND_Sample_SetMinMaxDistance(samp[rabbitattacksound], 1000.0f, 2000.0f);
378 samp[rabbitattack2sound] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:rabbitattack2.ogg", FSOUND_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
379 FSOUND_Sample_SetMinMaxDistance(samp[rabbitattack2sound], 1000.0f, 2000.0f);
381 samp[rabbitattack3sound] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:rabbitattack3.ogg", FSOUND_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
382 FSOUND_Sample_SetMinMaxDistance(samp[rabbitattack3sound], 1000.0f, 2000.0f);
384 samp[rabbitattack4sound] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:rabbitattack4.ogg", FSOUND_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
385 FSOUND_Sample_SetMinMaxDistance(samp[rabbitattack4sound], 1000.0f, 2000.0f);
387 samp[rabbitpainsound] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:rabbitpain.ogg", FSOUND_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
388 FSOUND_Sample_SetMinMaxDistance(samp[rabbitpainsound], 1000.0f, 2000.0f);
390 samp[rabbitpain1sound] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:rabbitpain2.ogg", FSOUND_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
391 FSOUND_Sample_SetMinMaxDistance(samp[rabbitpain1sound], 1000.0f, 2000.0f);
393 /*samp[rabbitpain2sound] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:rabbitpain2.ogg", FSOUND_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
394 FSOUND_Sample_SetMinMaxDistance(samp[rabbitpain2sound], 1000.0f, 2000.0f);
396 samp[rabbitchitter] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:rabbitchitter.ogg", FSOUND_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
397 FSOUND_Sample_SetMinMaxDistance(samp[rabbitchitter], 1000.0f, 2000.0f);
399 samp[rabbitchitter2] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:rabbitchitter2.ogg", FSOUND_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
400 FSOUND_Sample_SetMinMaxDistance(samp[rabbitchitter2], 1000.0f, 2000.0f);
402 samp[swordstaffsound] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:swordstaff.ogg", FSOUND_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
403 FSOUND_Sample_SetMinMaxDistance(samp[swordstaffsound], 8.0f, 2000.0f);
405 samp[staffbodysound] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:staffbody.ogg", FSOUND_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
406 FSOUND_Sample_SetMinMaxDistance(samp[staffbodysound], 8.0f, 2000.0f);
408 samp[staffheadsound] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:staffhead.ogg", FSOUND_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
409 FSOUND_Sample_SetMinMaxDistance(samp[staffheadsound], 8.0f, 2000.0f);
411 samp[staffbreaksound] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:staffbreak.wav", FSOUND_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
412 FSOUND_Sample_SetMinMaxDistance(samp[staffbreaksound], 8.0f, 2000.0f);
418 void Game::LoadTexture(char *fileName, GLuint *textureid,int mipmap, bool hasalpha)
424 LOG(std::string("Loading texture...") + fileName);
426 unsigned char fileNamep[256];
427 CopyCStringToPascal(fileName,fileNamep);
429 upload_image( fileNamep ,hasalpha);
431 // std::string fname(fileName);
432 // std::transform(fname.begin(), fname.end(), tolower);
433 // TexIter it = textures.find(fname);
437 //if(textures.end() == it)
440 if ( texture.bpp == 24 )
445 glPixelStorei( GL_UNPACK_ALIGNMENT, 1 );
447 if(!*textureid)glGenTextures( 1, textureid );
448 glTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE );
450 glBindTexture( GL_TEXTURE_2D, *textureid);
451 glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR );
452 if(trilinear)if(mipmap)glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR );
453 if(!trilinear)if(mipmap)glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_NEAREST );
454 if(!mipmap)glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR );
456 //glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, texture.sizeX, texture.sizeY, 0,
457 // GL_BGRA_EXT, GL_UNSIGNED_INT_8_8_8_8_REV, texture.data);
459 //gluBuild2DMipmaps( GL_TEXTURE_2D, type, texture.sizeX, texture.sizeY, GL_BGRA_EXT, GL_UNSIGNED_INT_8_8_8_8_REV, texture.data );
461 gluBuild2DMipmaps( GL_TEXTURE_2D, type, texture.sizeX, texture.sizeY, type, GL_UNSIGNED_BYTE, texture.data );
463 // textures.insert(std::make_pair(fname, *textureid));
467 // *textureid = it->second;
471 void Game::LoadTextureSave(char *fileName, GLuint *textureid,int mipmap,GLubyte *array, int *skinsize)
479 LOG(std::string("Loading texture (S)...") + fileName);
482 unsigned char fileNamep[256];
483 CopyCStringToPascal(fileName,fileNamep);
485 upload_image( fileNamep ,0);
486 //LoadTGA( fileName );
488 // std::string fname(fileName);
489 // std::transform(fname.begin(), fname.end(), tolower);
490 // TexIter it = textures.find(fname);
494 //if(textures.end() == it)
496 bytesPerPixel=texture.bpp/8;
499 if ( texture.bpp == 24 )
504 glPixelStorei( GL_UNPACK_ALIGNMENT, 1 );
506 if(!*textureid)glGenTextures( 1, textureid );
507 glTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE );
509 glBindTexture( GL_TEXTURE_2D, *textureid);
510 glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR );
511 if(trilinear)if(mipmap)glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR );
512 if(!trilinear)if(mipmap)glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_NEAREST );
513 if(!mipmap)glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR );
516 for(i=0;i<(int)(texture.sizeY*texture.sizeX*bytesPerPixel);i++){
517 if((i+1)%4||type==GL_RGB){
518 array[tempnum]=texture.data[i];
523 *skinsize=texture.sizeX;
525 gluBuild2DMipmaps( GL_TEXTURE_2D, type, texture.sizeX, texture.sizeY, GL_RGB, GL_UNSIGNED_BYTE, array );
527 // textures.insert(std::make_pair(fname, *textureid));
531 // *textureid = it->second;
535 void Game::LoadSave(char *fileName, GLuint *textureid,bool mipmap,GLubyte *array, int *skinsize)
542 LOG(std::string("Loading (S)...") + fileName);
545 float temptexdetail=texdetail;
547 //upload_image( fileName );
548 //LoadTGA( fileName );
550 unsigned char fileNamep[256];
551 CopyCStringToPascal(fileName,fileNamep);
553 upload_image( fileNamep ,0);
554 texdetail=temptexdetail;
558 bytesPerPixel=texture.bpp/8;
561 for(i=0;i<(int)(texture.sizeY*texture.sizeX*bytesPerPixel);i++){
562 if((i+1)%4||bytesPerPixel==3){
563 array[tempnum]=texture.data[i];
570 bool Game::AddClothes(char *fileName, GLuint *textureid,bool mipmap,GLubyte *array, int *skinsize)
577 //upload_image( fileName );
578 //LoadTGA( fileName );
580 unsigned char fileNamep[256];
581 CopyCStringToPascal(fileName,fileNamep);
584 opened=upload_image( fileNamep ,1);
597 bytesPerPixel=texture.bpp/8;
601 for(i=0;i<(int)(texture.sizeY*texture.sizeX*bytesPerPixel);i++){
602 if(bytesPerPixel==3)alphanum=255;
603 else if((i+1)%4==0)alphanum=texture.data[i];
605 if((i+1)%4||bytesPerPixel==3){
606 if((i%4)==0)texture.data[i]*=tintr;
607 if((i%4)==1)texture.data[i]*=tintg;
608 if((i%4)==2)texture.data[i]*=tintb;
609 array[tempnum]=(float)array[tempnum]*(1-alphanum/255)+(float)texture.data[i]*(alphanum/255);
619 //***************> ResizeGLScene() <******/
620 GLvoid Game::ReSizeGLScene(float fov, float pnear)
627 glViewport(0,0,screenwidth,screenheight);
629 glMatrixMode(GL_PROJECTION);
632 gluPerspective(fov,(GLfloat)screenwidth/(GLfloat)screenheight,pnear,viewdistance);
634 glMatrixMode(GL_MODELVIEW);
638 void Game::LoadingScreen()
640 static float loadprogress,minprogress,maxprogress;
641 static AbsoluteTime time = {0,0};
642 static AbsoluteTime frametime = {0,0};
643 AbsoluteTime currTime = UpTime ();
644 double deltaTime = (float) AbsoluteDeltaToDuration (currTime, frametime);
646 if (0 > deltaTime) // if negative microseconds
647 deltaTime /= -1000000.0;
648 else // else milliseconds
651 multiplier=deltaTime;
652 if(multiplier<.001)multiplier=.001;
653 if(multiplier>10)multiplier=10;
655 frametime = currTime; // reset for next time interval
660 glClearColor(0,0,0,1);
661 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
664 loadtime+=multiplier*4;
666 loadprogress=loadtime;
667 if(loadprogress>100)loadprogress=100;
669 //loadprogress=abs(Random()%100);
673 glEnable(GL_TEXTURE_2D);
674 glBindTexture( GL_TEXTURE_2D, loadscreentexture);
675 glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT );
676 glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT );
677 glDisable(GL_DEPTH_TEST); // Disables Depth Testing
678 glDisable(GL_CULL_FACE);
679 glDisable(GL_LIGHTING);
681 glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
682 glPushMatrix(); // Store The Projection Matrix
683 glLoadIdentity(); // Reset The Projection Matrix
684 glOrtho(0,screenwidth,0,screenheight,-100,100); // Set Up An Ortho Screen
685 glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
686 glPushMatrix(); // Store The Modelview Matrix
687 glLoadIdentity(); // Reset The Modelview Matrix
688 glTranslatef(screenwidth/2,screenheight/2,0);
689 glScalef((float)screenwidth/2,(float)screenheight/2,1);
690 glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
692 glColor4f(loadprogress/100,loadprogress/100,loadprogress/100,1);
693 //glColor4f(1,1,1,1);
694 /*if(loadscreencolor==0)glColor4f(1,1,1,1);
695 if(loadscreencolor==1)glColor4f(1,0,0,1);
696 if(loadscreencolor==2)glColor4f(0,1,0,1);
697 if(loadscreencolor==3)glColor4f(0,0,1,1);
698 if(loadscreencolor==4)glColor4f(1,1,0,1);
699 if(loadscreencolor==5)glColor4f(1,0,1,1);
702 //glScalef(.25,.25,.25);
704 glTexCoord2f(.1-loadprogress/100,0+loadprogress/100+.3);
705 glVertex3f(-1, -1, 0.0f);
706 glTexCoord2f(.1-loadprogress/100,0+loadprogress/100+.3);
707 glVertex3f(1, -1, 0.0f);
708 glTexCoord2f(.1-loadprogress/100,1+loadprogress/100+.3);
709 glVertex3f(1, 1, 0.0f);
710 glTexCoord2f(.1-loadprogress/100,1+loadprogress/100+.3);
711 glVertex3f(-1, 1, 0.0f);
716 //glScalef(.25,.25,.25);
718 glTexCoord2f(.4+loadprogress/100,0+loadprogress/100);
719 glVertex3f(-1, -1, 0.0f);
720 glTexCoord2f(.4+loadprogress/100,0+loadprogress/100);
721 glVertex3f(1, -1, 0.0f);
722 glTexCoord2f(.4+loadprogress/100,1+loadprogress/100);
723 glVertex3f(1, 1, 0.0f);
724 glTexCoord2f(.4+loadprogress/100,1+loadprogress/100);
725 glVertex3f(-1, 1, 0.0f);
728 glDisable(GL_TEXTURE_2D);
729 glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
730 glPopMatrix(); // Restore The Old Projection Matrix
731 glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
732 glPopMatrix(); // Restore The Old Projection Matrix
736 glEnable(GL_TEXTURE_2D);
737 glBindTexture( GL_TEXTURE_2D, loadscreentexture);
738 glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT );
739 glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT );
740 glDisable(GL_DEPTH_TEST); // Disables Depth Testing
741 glDisable(GL_CULL_FACE);
742 glDisable(GL_LIGHTING);
744 glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
745 glPushMatrix(); // Store The Projection Matrix
746 glLoadIdentity(); // Reset The Projection Matrix
747 glOrtho(0,screenwidth,0,screenheight,-100,100); // Set Up An Ortho Screen
748 glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
749 glPushMatrix(); // Store The Modelview Matrix
750 glLoadIdentity(); // Reset The Modelview Matrix
751 glTranslatef(screenwidth/2,screenheight/2,0);
752 glScalef((float)screenwidth/2*(1.5-(loadprogress)/200),(float)screenheight/2*(1.5-(loadprogress)/200),1);
753 glBlendFunc(GL_SRC_ALPHA,GL_ONE);
755 //glColor4f(loadprogress/100,loadprogress/100,loadprogress/100,1);
756 glColor4f(loadprogress/100,loadprogress/100,loadprogress/100,1);
757 /*if(loadscreencolor==0)glColor4f(1,1,1,1);
758 if(loadscreencolor==1)glColor4f(1,0,0,1);
759 if(loadscreencolor==2)glColor4f(0,1,0,1);
760 if(loadscreencolor==3)glColor4f(0,0,1,1);
761 if(loadscreencolor==4)glColor4f(1,1,0,1);
762 if(loadscreencolor==5)glColor4f(1,0,1,1);
765 //glScalef(.25,.25,.25);
767 glTexCoord2f(0+.5,0+.5);
768 glVertex3f(-1, -1, 0.0f);
769 glTexCoord2f(1+.5,0+.5);
770 glVertex3f(1, -1, 0.0f);
771 glTexCoord2f(1+.5,1+.5);
772 glVertex3f(1, 1, 0.0f);
773 glTexCoord2f(0+.5,1+.5);
774 glVertex3f(-1, 1, 0.0f);
777 glDisable(GL_TEXTURE_2D);
778 glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
779 glPopMatrix(); // Restore The Old Projection Matrix
780 glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
781 glPopMatrix(); // Restore The Old Projection Matrix
785 glEnable(GL_TEXTURE_2D);
786 glBindTexture( GL_TEXTURE_2D, loadscreentexture);
787 glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT );
788 glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT );
789 glDisable(GL_DEPTH_TEST); // Disables Depth Testing
790 glDisable(GL_CULL_FACE);
791 glDisable(GL_LIGHTING);
793 glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
794 glPushMatrix(); // Store The Projection Matrix
795 glLoadIdentity(); // Reset The Projection Matrix
796 glOrtho(0,screenwidth,0,screenheight,-100,100); // Set Up An Ortho Screen
797 glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
798 glPushMatrix(); // Store The Modelview Matrix
799 glLoadIdentity(); // Reset The Modelview Matrix
800 glTranslatef(screenwidth/2,screenheight/2,0);
801 glScalef((float)screenwidth/2*(100+loadprogress)/100,(float)screenheight/2*(100+loadprogress)/100,1);
802 glBlendFunc(GL_SRC_ALPHA,GL_ONE);
804 glColor4f(loadprogress/100,loadprogress/100,loadprogress/100,.4);
806 //glScalef(.25,.25,.25);
808 glTexCoord2f(0+.2,0+.8);
809 glVertex3f(-1, -1, 0.0f);
810 glTexCoord2f(1+.2,0+.8);
811 glVertex3f(1, -1, 0.0f);
812 glTexCoord2f(1+.2,1+.8);
813 glVertex3f(1, 1, 0.0f);
814 glTexCoord2f(0+.2,1+.8);
815 glVertex3f(-1, 1, 0.0f);
818 glDisable(GL_TEXTURE_2D);
819 glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
820 glPopMatrix(); // Restore The Old Projection Matrix
821 glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
822 glPopMatrix(); // Restore The Old Projection Matrix
828 glEnable(GL_TEXTURE_2D);
829 static char string[256]="";
830 sprintf (string, "LOADING... %d%",(int)loadprogress);
832 text.glPrint(280-280*loadprogress/100/2/4,125-125*loadprogress/100/2/4,string,1,1+loadprogress/100,640,480);
833 glColor4f(1.2-loadprogress/100,1.2-loadprogress/100,1.2-loadprogress/100,1);
834 text.glPrint(280,125,string,1,1,640,480);
838 if(flashamount>1)flashamount=1;
839 if(flashdelay<=0)flashamount-=multiplier;
841 if(flashamount<0)flashamount=0;
842 glDisable(GL_DEPTH_TEST); // Disables Depth Testing
843 glDisable(GL_CULL_FACE);
844 glDisable(GL_LIGHTING);
845 glDisable(GL_TEXTURE_2D);
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 glScalef(screenwidth,screenheight,1);
855 glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
857 glColor4f(flashr,flashg,flashb,flashamount);
859 glVertex3f(0, 0, 0.0f);
860 glVertex3f(256, 0, 0.0f);
861 glVertex3f(256, 256, 0.0f);
862 glVertex3f(0, 256, 0.0f);
864 glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
865 glPopMatrix(); // Restore The Old Projection Matrix
866 glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
867 glPopMatrix(); // Restore The Old Projection Matrix
868 glEnable(GL_DEPTH_TEST); // Enables Depth Testing
869 glEnable(GL_CULL_FACE);
879 void Game::FadeLoadingScreen(float howmuch)
881 static float loadprogress,minprogress,maxprogress;
886 glClearColor(0,0,0,1);
887 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
889 loadprogress=howmuch;
891 //loadprogress=abs(Random()%100);
895 //glEnable(GL_TEXTURE_2D);
896 glDisable(GL_TEXTURE_2D);
897 //glBindTexture( GL_TEXTURE_2D, loadscreentexture);
898 glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE );
899 glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE );
900 glDisable(GL_DEPTH_TEST); // Disables Depth Testing
901 glDisable(GL_CULL_FACE);
902 glDisable(GL_LIGHTING);
904 glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
905 glPushMatrix(); // Store The Projection Matrix
906 glLoadIdentity(); // Reset The Projection Matrix
907 glOrtho(0,screenwidth,0,screenheight,-100,100); // Set Up An Ortho Screen
908 glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
909 glPushMatrix(); // Store The Modelview Matrix
910 glLoadIdentity(); // Reset The Modelview Matrix
911 glTranslatef(screenwidth/2,screenheight/2,0);
912 glScalef((float)screenwidth/2,(float)screenheight/2,1);
913 glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
915 glColor4f(loadprogress/100,0,0,1);
916 /*if(loadscreencolor==0)glColor4f(1,1,1,1);
917 if(loadscreencolor==1)glColor4f(1,0,0,1);
918 if(loadscreencolor==2)glColor4f(0,1,0,1);
919 if(loadscreencolor==3)glColor4f(0,0,1,1);
920 if(loadscreencolor==4)glColor4f(1,1,0,1);
921 if(loadscreencolor==5)glColor4f(1,0,1,1);
924 //glScalef(.25,.25,.25);
927 glVertex3f(-1, -1, 0.0f);
929 glVertex3f(1, -1, 0.0f);
931 glVertex3f(1, 1, 0.0f);
933 glVertex3f(-1, 1, 0.0f);
936 glDisable(GL_TEXTURE_2D);
937 glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
938 glPopMatrix(); // Restore The Old Projection Matrix
939 glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
940 glPopMatrix(); // Restore The Old Projection Matrix
945 glEnable(GL_TEXTURE_2D);
946 static char string[256]="";
947 sprintf (string, "LOADING... %d%",(int)loadprogress);
949 text.glPrint(280-280*loadprogress/100/2/4,125-125*loadprogress/100/2/4,string,1,1+loadprogress/100,640,480);
950 glColor4f(1.2-loadprogress/100,1.2-loadprogress/100,1.2-loadprogress/100,1);
951 text.glPrint(280,125,string,1,1,640,480);
958 void Game::InitGame()
961 ProcessSerialNumber PSN;
962 ProcessInfoRec pinfo;
965 /* set up process serial number */
966 PSN.highLongOfPSN = 0;
967 PSN.lowLongOfPSN = kCurrentProcess;
968 /* set up info block */
969 pinfo.processInfoLength = sizeof(pinfo);
970 pinfo.processName = NULL;
971 pinfo.processAppSpec = &pspec;
972 /* grab the vrefnum and directory */
973 err = GetProcessInformation(&PSN, &pinfo);
975 vRefNum = pspec.vRefNum;
986 numchallengelevels=14;
990 /*char tempstring[256];
991 sprintf (tempstring, "%s", registrationname);
997 longnum = MD5_string ( tempstring);
998 //longnum = 1111111111111111;
999 num1 = longnum/100000000;
1000 num2 = longnum%100000000;
1001 sprintf (tempstring, "%d-%d-%d-%d", num1/10000, num1%10000, num2/10000, num2%10000);
1005 tfile=fopen( ":Data:Sounds:flame.ogg", "rb" );
1016 funpackf(tfile, "Bb", ®istered);
1019 funpackf(tfile, "Bi", &numchars);
1022 for(j=0;j<numchars;j++)
1024 funpackf(tfile, "Bb", ®istrationname[j]);
1026 registrationname[numchars]='\0';
1027 funpackf(tfile, "Bi", &num1);
1028 funpackf(tfile, "Bi", &num2);
1029 longnum=num2+num1*100000000;
1031 char tempstring[256];
1032 #if defined(__APPLE__)
1033 sprintf (tempstring, "%s", registrationname);
1034 #elif defined(_MSC_VER) || defined(__linux__)
1035 sprintf (tempstring, "%s-windows", registrationname);
1037 #error Please make sure you have the right registration key stuff here!
1039 longnuma = MD5_string ( tempstring);
1040 num1a = longnuma/100000000;
1041 num2a = longnuma%100000000;
1042 //if(num1a==num1&&num2a==num2)registered=1;
1043 if(numchars>2)registered=1;
1053 sprintf (mapname, ":Data:Users");
1054 tfile=fopen( mapname, "rb" );
1057 funpackf(tfile, "Bi", &numaccounts);
1058 funpackf(tfile, "Bi", &accountactive);
1061 for(i=0;i<numaccounts;i++)
1063 funpackf(tfile, "Bf", &accountcampaigntime[i]);
1064 funpackf(tfile, "Bf", &accountcampaignscore[i]);
1065 funpackf(tfile, "Bf", &accountcampaignfasttime[i]);
1066 funpackf(tfile, "Bf", &accountcampaignhighscore[i]);
1067 funpackf(tfile, "Bi", &accountdifficulty[i]);
1068 funpackf(tfile, "Bi", &accountprogress[i]);
1069 funpackf(tfile, "Bi", &accountcampaignchoicesmade[i]);
1070 for(j=0;j<accountcampaignchoicesmade[i];j++)
1072 funpackf(tfile, "Bi", &accountcampaignchoices[i][j]);
1073 if (accountcampaignchoices[i][j] >= 10)
1075 accountcampaignchoices[i][j] = 0;
1078 funpackf(tfile, "Bf", &accountpoints[i]);
1081 funpackf(tfile, "Bf", &accounthighscore[i][j]);
1082 funpackf(tfile, "Bf", &accountfasttime[i][j]);
1086 funpackf(tfile, "Bb", &accountunlocked[i][j]);
1089 funpackf(tfile, "Bi", &temp);
1094 funpackf(tfile, "Bb", &accountname[i][j]);
1107 whichjointstartarray[0]=righthip;
1108 whichjointendarray[0]=rightfoot;
1110 whichjointstartarray[1]=righthip;
1111 whichjointendarray[1]=rightankle;
1113 whichjointstartarray[2]=righthip;
1114 whichjointendarray[2]=rightknee;
1116 whichjointstartarray[3]=rightknee;
1117 whichjointendarray[3]=rightankle;
1119 whichjointstartarray[4]=rightankle;
1120 whichjointendarray[4]=rightfoot;
1122 whichjointstartarray[5]=lefthip;
1123 whichjointendarray[5]=leftfoot;
1125 whichjointstartarray[6]=lefthip;
1126 whichjointendarray[6]=leftankle;
1128 whichjointstartarray[7]=lefthip;
1129 whichjointendarray[7]=leftknee;
1131 whichjointstartarray[8]=leftknee;
1132 whichjointendarray[8]=leftankle;
1134 whichjointstartarray[9]=leftankle;
1135 whichjointendarray[9]=leftfoot;
1137 whichjointstartarray[10]=abdomen;
1138 whichjointendarray[10]=rightshoulder;
1140 whichjointstartarray[11]=abdomen;
1141 whichjointendarray[11]=rightelbow;
1143 whichjointstartarray[12]=abdomen;
1144 whichjointendarray[12]=rightwrist;
1146 whichjointstartarray[13]=abdomen;
1147 whichjointendarray[13]=righthand;
1149 whichjointstartarray[14]=rightshoulder;
1150 whichjointendarray[14]=rightelbow;
1152 whichjointstartarray[15]=rightelbow;
1153 whichjointendarray[15]=rightwrist;
1155 whichjointstartarray[16]=rightwrist;
1156 whichjointendarray[16]=righthand;
1158 whichjointstartarray[17]=abdomen;
1159 whichjointendarray[17]=leftshoulder;
1161 whichjointstartarray[18]=abdomen;
1162 whichjointendarray[18]=leftelbow;
1164 whichjointstartarray[19]=abdomen;
1165 whichjointendarray[19]=leftwrist;
1167 whichjointstartarray[20]=abdomen;
1168 whichjointendarray[20]=lefthand;
1170 whichjointstartarray[21]=leftshoulder;
1171 whichjointendarray[21]=leftelbow;
1173 whichjointstartarray[22]=leftelbow;
1174 whichjointendarray[22]=leftwrist;
1176 whichjointstartarray[23]=leftwrist;
1177 whichjointendarray[23]=lefthand;
1179 whichjointstartarray[24]=abdomen;
1180 whichjointendarray[24]=neck;
1182 whichjointstartarray[25]=neck;
1183 whichjointendarray[25]=head;
1185 FadeLoadingScreen(0);
1189 texture.data = ( GLubyte* )malloc( 1024*1024*4 );
1191 int temptexdetail=texdetail;
1193 text.LoadFontTexture(":Data:Textures:Font.png");
1195 texdetail=temptexdetail;
1197 FadeLoadingScreen(10);
1213 for (int it = 0; it < 100; ++it)
1218 for (int it = 0; it < 20; ++it)
1223 LOG("Initializing sound system...");
1228 extern bool cmdline(const char *cmd);
1229 unsigned char rc = 0;
1230 output = FSOUND_OUTPUT_ALSA; // Try alsa first...
1231 if (cmdline("forceoss")) // ...but let user override that.
1232 output = FSOUND_OUTPUT_OSS;
1233 else if (cmdline("nosound"))
1234 output = FSOUND_OUTPUT_NOSOUND;
1236 FSOUND_SetOutput(output);
1237 if ((rc = FSOUND_Init(44100, 32, 0)) == false)
1239 // if we tried ALSA and failed, fall back to OSS.
1240 if ( (output == FSOUND_OUTPUT_ALSA) && (!cmdline("forcealsa")) )
1243 output = FSOUND_OUTPUT_OSS;
1244 FSOUND_SetOutput(output);
1245 rc = FSOUND_Init(44100, 32, 0);
1252 output = FSOUND_OUTPUT_NOSOUND; // we tried! just do silence.
1253 FSOUND_SetOutput(output);
1254 rc = FSOUND_Init(44100, 32, 0);
1257 FSOUND_Init(44100, 32, 0);
1260 FSOUND_SetSFXMasterVolume((int)(volume*255));
1262 strm[stream_music3] = FSOUND_Stream_Open(ConvertFileName(":Data:Sounds:music3.mp3"), FSOUND_2D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=0;}
1263 // FSOUND_Sample_SetMinMaxDistance(strm[stream_music3], 4.0f, 1000.0f);
1264 FSOUND_Stream_SetMode(strm[stream_music3], FSOUND_LOOP_NORMAL);
1267 // PlaySoundEx( stream_music3, strm[stream_music3], NULL, true);
1268 PlayStreamEx(stream_music3, strm[stream_music3], 0, true);
1269 FSOUND_SetPaused(channels[stream_music3], false);
1270 FSOUND_SetVolume(channels[stream_music3], 256);
1273 FadeLoadingScreen(20);
1276 strm[stream_wind] = FSOUND_Stream_Open(ConvertFileName(":Data:Sounds:wind.mp3"), FSOUND_2D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
1277 // FSOUND_Sample_SetMinMaxDistance(strm[stream_wind], 4.0f, 1000.0f);
1278 FSOUND_Stream_SetMode(strm[stream_wind], FSOUND_LOOP_NORMAL);
1280 FadeLoadingScreen(30);
1282 strm[stream_desertambient] = FSOUND_Stream_Open(ConvertFileName(":Data:Sounds:desertambient.mp3"), FSOUND_2D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
1283 // FSOUND_Sample_SetMinMaxDistance(strm[stream_desertambient], 4.0f, 1000.0f);
1284 FSOUND_Stream_SetMode(strm[stream_desertambient], FSOUND_LOOP_NORMAL);
1287 FadeLoadingScreen(40);
1289 samp[firestartsound] = FSOUND_Sample_Load(FSOUND_FREE, ConvertFileName(":Data:Sounds:firestart.ogg"), FSOUND_2D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
1290 FSOUND_Sample_SetMinMaxDistance(samp[firestartsound], 8.0f, 2000.0f);
1292 strm[stream_firesound] = FSOUND_Stream_Open(":Data:Sounds:fire.ogg", FSOUND_2D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
1293 // FSOUND_Sample_SetMinMaxDistance(strm[stream_firesound], 8.0f, 2000.0f);
1294 FSOUND_Stream_SetMode(strm[stream_firesound], FSOUND_LOOP_NORMAL);
1296 FadeLoadingScreen(50);
1298 samp[fireendsound] = FSOUND_Sample_Load(FSOUND_FREE, ConvertFileName(":Data:Sounds:fireend.ogg"), FSOUND_2D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
1299 FSOUND_Sample_SetMinMaxDistance(samp[fireendsound], 8.0f, 2000.0f);
1302 strm[stream_music1grass] = FSOUND_Stream_Open(ConvertFileName(":Data:Sounds:music1grass.mp3"), FSOUND_2D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=1;}
1303 // FSOUND_Sample_SetMinMaxDistance(strm[stream_music1grass], 4.0f, 1000.0f);
1304 FSOUND_Stream_SetMode(strm[stream_music1grass], FSOUND_LOOP_NORMAL);
1306 strm[stream_music1snow] = FSOUND_Stream_Open(ConvertFileName(":Data:Sounds:music1snow.mp3"), FSOUND_2D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=2;}
1307 // FSOUND_Sample_SetMinMaxDistance(strm[stream_music1snow], 4.0f, 1000.0f);
1308 FSOUND_Stream_SetMode(strm[stream_music1snow], FSOUND_LOOP_NORMAL);
1310 FadeLoadingScreen(60);
1312 strm[stream_music1desert] = FSOUND_Stream_Open(ConvertFileName(":Data:Sounds:music1desert.mp3"), FSOUND_2D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=3;}
1313 // FSOUND_Sample_SetMinMaxDistance(strm[stream_music1desert], 4.0f, 1000.0f);
1314 FSOUND_Stream_SetMode(strm[stream_music1desert], FSOUND_LOOP_NORMAL);
1316 FadeLoadingScreen(80);
1317 strm[stream_music2] = FSOUND_Stream_Open(ConvertFileName(":Data:Sounds:music2.ogg"), FSOUND_2D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=4;}
1318 // FSOUND_Sample_SetMinMaxDistance(strm[stream_music2], 4.0f, 1000.0f);
1319 FSOUND_Stream_SetMode(strm[stream_music2], FSOUND_LOOP_NORMAL);
1324 FadeLoadingScreen(90);
1327 LoadTexture(":Data:Textures:Cursor.png",&cursortexture,0,1);
1329 LoadTexture(":Data:Textures:MapCircle.png",&Mapcircletexture,0,1);
1330 LoadTexture(":Data:Textures:MapBox.png",&Mapboxtexture,0,1);
1331 LoadTexture(":Data:Textures:MapArrow.png",&Maparrowtexture,0,1);
1333 temptexdetail=texdetail;
1334 if(texdetail>2)texdetail=2;
1335 LoadTexture(":Data:Textures:Lugaru.png",&Mainmenuitems[0],0,0);
1336 LoadTexture(":Data:Textures:Newgame.png",&Mainmenuitems[1],0,0);
1337 LoadTexture(":Data:Textures:Options.png",&Mainmenuitems[2],0,0);
1338 LoadTexture(":Data:Textures:Quit.png",&Mainmenuitems[3],0,0);
1339 LoadTexture(":Data:Textures:World.png",&Mainmenuitems[7],0,0);
1340 LoadTexture(":Data:Textures:Eyelid.png",&Mainmenuitems[4],0,1);
1341 //LoadTexture(":Data:Textures:Eye.jpg",&Mainmenuitems[5],0,1);
1342 texdetail=temptexdetail;
1347 FadeLoadingScreen(95);
1358 newscreenwidth=screenwidth;
1359 newscreenheight=screenheight;
1364 float gLoc[3]={0,0,0};
1365 float vel[3]={0,0,0};
1366 FSOUND_Sample_SetMinMaxDistance(samp[firestartsound], 9999.0f, 99999.0f);
1367 PlaySoundEx( firestartsound, samp[firestartsound], NULL, true);
1368 FSOUND_3D_SetAttributes(channels[firestartsound], gLoc, vel);
1369 FSOUND_SetVolume(channels[firestartsound], 256);
1370 FSOUND_SetPaused(channels[firestartsound], false);
1371 FSOUND_Sample_SetMinMaxDistance(samp[firestartsound], 8.0f, 2000.0f);
1382 void Game::LoadStuff()
1384 static float temptexdetail;
1385 static float viewdistdetail;
1386 static int i,j,texsize;
1393 /*musicvolume[3]=512;
1394 PlaySoundEx( music4, samp[music4], NULL, true);
1395 FSOUND_SetPaused(channels[music4], false);
1396 FSOUND_SetVolume(channels[music4], 512);
1402 //texture.data = ( GLubyte* )malloc( 1024*1024*4 );
1406 for(i=0;i<maxplayers;i++)
1408 if (glIsTexture(player[i].skeleton.drawmodel.textureptr))
1410 glDeleteTextures(1, &player[i].skeleton.drawmodel.textureptr);
1412 player[i].skeleton.drawmodel.textureptr=0;;
1415 //temptexdetail=texdetail;
1418 LoadTexture(":Data:Textures:fire.jpg",&loadscreentexture,1,0);
1419 //texdetail=temptexdetail;
1421 temptexdetail=texdetail;
1423 text.LoadFontTexture(":Data:Textures:Font.png");
1425 texdetail=temptexdetail;
1430 viewdistance=50*megascale*viewdistdetail;
1450 realtexdetail=texdetail;
1453 if(texdetail<1)texdetail=1;
1454 realtexdetail=texdetail*4;
1460 /*LoadTexture(":Data:Textures:snow.png",&terraintexture,1);
1462 LoadTexture(":Data:Textures:rock.png",&terraintexture2,1);
1464 LoadTexture(":Data:Textures:detail.png",&terraintexture3,1);
1468 LOG("Loading weapon data...");
1470 LoadTexture(":Data:Textures:knife.png",&weapons.knifetextureptr,0,1);
1471 LoadTexture(":Data:Textures:bloodknife.png",&weapons.bloodknifetextureptr,0,1);
1472 LoadTexture(":Data:Textures:lightbloodknife.png",&weapons.lightbloodknifetextureptr,0,1);
1473 LoadTexture(":Data:Textures:sword.jpg",&weapons.swordtextureptr,1,0);
1474 LoadTexture(":Data:Textures:Swordblood.jpg",&weapons.bloodswordtextureptr,1,0);
1475 LoadTexture(":Data:Textures:Swordbloodlight.jpg",&weapons.lightbloodswordtextureptr,1,0);
1476 LoadTexture(":Data:Textures:Staff.jpg",&weapons.stafftextureptr,1,0);
1478 weapons.throwingknifemodel.load((char *)":Data:Models:throwingknife.solid",1);
1479 weapons.throwingknifemodel.Scale(.001,.001,.001);
1480 //weapons.throwingknifemodel.Rotate(0,0,-90);
1481 weapons.throwingknifemodel.Rotate(90,0,0);
1482 weapons.throwingknifemodel.Rotate(0,90,0);
1483 weapons.throwingknifemodel.flat=0;
1484 weapons.throwingknifemodel.CalculateNormals(1);
1485 //weapons.throwingknifemodel.ScaleNormals(-1,-1,-1);
1487 weapons.swordmodel.load((char *)":Data:Models:sword.solid",1);
1488 weapons.swordmodel.Scale(.001,.001,.001);
1489 //weapons.swordmodel.Rotate(0,0,-90);
1490 weapons.swordmodel.Rotate(90,0,0);
1491 weapons.swordmodel.Rotate(0,90,0);
1492 weapons.swordmodel.Rotate(0,0,90);
1493 weapons.swordmodel.flat=1;
1494 weapons.swordmodel.CalculateNormals(1);
1495 //weapons.swordmodel.ScaleNormals(-1,-1,-1);
1497 weapons.staffmodel.load((char *)":Data:Models:staff.solid",1);
1498 weapons.staffmodel.Scale(.005,.005,.005);
1499 //weapons.staffmodel.Rotate(0,0,-90);
1500 weapons.staffmodel.Rotate(90,0,0);
1501 weapons.staffmodel.Rotate(0,90,0);
1502 weapons.staffmodel.Rotate(0,0,90);
1503 weapons.staffmodel.flat=1;
1504 weapons.staffmodel.CalculateNormals(1);
1505 //weapons.staffmodel.ScaleNormals(-1,-1,-1);
1507 //temptexdetail=texdetail;
1508 //if(texdetail>4)texdetail=4;
1509 LoadTexture(":Data:Textures:shadow.png",&terrain.shadowtexture,0,1);
1511 LoadTexture(":Data:Textures:blood.png",&terrain.bloodtexture,0,1);
1513 LoadTexture(":Data:Textures:break.png",&terrain.breaktexture,0,1);
1515 LoadTexture(":Data:Textures:blood.png",&terrain.bloodtexture2,0,1);
1518 LoadTexture(":Data:Textures:footprint.png",&terrain.footprinttexture,0,1);
1520 LoadTexture(":Data:Textures:bodyprint.png",&terrain.bodyprinttexture,0,1);
1522 /*LoadTexture(":Data:Textures:cloud.png",&sprites.cloudtexture,1);
1524 LoadTexture(":Data:Textures:cloudimpact.png",&sprites.cloudimpacttexture,1);
1526 LoadTexture(":Data:Textures:bloodparticle.png",&sprites.bloodtexture,1);
1528 LoadTexture(":Data:Textures:snowflake.png",&sprites.snowflaketexture,1);
1530 LoadTexture(":Data:Textures:flame.png",&sprites.flametexture,1);
1532 LoadTexture(":Data:Textures:smoke.png",&sprites.smoketexture,1);
1533 //texdetail=temptexdetail;
1534 LoadTexture(":Data:Textures:shine.png",&sprites.shinetexture,1);*/
1538 LoadTexture(":Data:Textures:hawk.png",&hawktexture,0,1);
1540 LoadTexture(":Data:Textures:logo.png",&logotexture,0,1);
1543 //LoadTexture(":Data:Textures:box.jpg",&objects.boxtextureptr,1,0);
1546 LoadTexture(":Data:Textures:cloud.png",&sprites.cloudtexture,1,1);
1547 LoadTexture(":Data:Textures:cloudimpact.png",&sprites.cloudimpacttexture,1,1);
1548 LoadTexture(":Data:Textures:bloodparticle.png",&sprites.bloodtexture,1,1);
1549 LoadTexture(":Data:Textures:snowflake.png",&sprites.snowflaketexture,1,1);
1550 LoadTexture(":Data:Textures:flame.png",&sprites.flametexture,1,1);
1551 LoadTexture(":Data:Textures:bloodflame.png",&sprites.bloodflametexture,1,1);
1552 LoadTexture(":Data:Textures:smoke.png",&sprites.smoketexture,1,1);
1553 LoadTexture(":Data:Textures:shine.png",&sprites.shinetexture,1,0);
1554 LoadTexture(":Data:Textures:splinter.png",&sprites.splintertexture,1,1);
1555 LoadTexture(":Data:Textures:leaf.png",&sprites.leaftexture,1,1);
1556 LoadTexture(":Data:Textures:tooth.png",&sprites.toothtexture,1,1);
1560 ReSizeGLScene(90,.01);
1567 if(detail)kTextureSize=1024;
1568 if(detail==1)kTextureSize=512;
1569 if(detail==0)kTextureSize=256;
1572 //drawmode=motionblurmode;
1574 //Set up distant light
1578 light.ambient[0]=.2;
1579 light.ambient[1]=.2;
1580 light.ambient[2]=.24;
1583 light.location.z=-.2;
1584 Normalise(&light.location);
1594 texscale=.2/megascale/viewdistdetail;
1595 terrain.scale=3*megascale*terraindetail*viewdistdetail;
1597 viewer.x=terrain.size/2*terrain.scale;
1598 viewer.z=terrain.size/2*terrain.scale;
1600 hawk.load((char *)":Data:Models:hawk.solid",1);
1601 hawk.Scale(.03,.03,.03);
1602 hawk.Rotate(90,1,1);
1603 hawk.CalculateNormals(0);
1604 hawk.ScaleNormals(-1,-1,-1);
1605 hawkcoords.x=terrain.size/2*terrain.scale-5-7;
1606 hawkcoords.z=terrain.size/2*terrain.scale-5-7;
1607 hawkcoords.y=terrain.getHeight(hawkcoords.x,hawkcoords.z)+25;
1610 eye.load((char *)":Data:Models:eye.solid",1);
1611 eye.Scale(.03,.03,.03);
1612 eye.CalculateNormals(0);
1614 cornea.load((char *)":Data:Models:cornea.solid",1);
1615 cornea.Scale(.03,.03,.03);
1616 cornea.CalculateNormals(0);
1618 iris.load((char *)":Data:Models:iris.solid",1);
1619 iris.Scale(.03,.03,.03);
1620 iris.CalculateNormals(0);
1622 LoadSave(":Data:Textures:Bloodfur.png",0,1,&bloodText[0],0);
1623 LoadSave(":Data:Textures:Wolfbloodfur.png",0,1,&wolfbloodText[0],0);
1631 //if(targetlevel!=7)
1632 Loadlevel(targetlevel);
1635 rabbitcoords=player[0].coords;
1636 rabbitcoords.y=terrain.getHeight(rabbitcoords.x,rabbitcoords.z);
1638 animation[runanim].Load((char *)":Data:Animations:Run",middleheight,neutral);
1640 animation[bounceidleanim].Load((char *)":Data:Animations:Idle",middleheight,neutral);
1641 animation[stopanim].Load((char *)":Data:Animations:Stop",middleheight,neutral);
1643 animation[jumpupanim].Load((char *)":Data:Animations:JumpUp",highheight,neutral);
1644 animation[jumpdownanim].Load((char *)":Data:Animations:JumpDown",highheight,neutral);
1646 animation[landanim].Load((char *)":Data:Animations:Landing",lowheight,neutral);
1647 animation[landhardanim].Load((char *)":Data:Animations:Landhard",lowheight,neutral);
1648 animation[climbanim].Load((char *)":Data:Animations:Climb",lowheight,neutral);
1649 animation[hanganim].Load((char *)":Data:Animations:Hangon",lowheight,neutral);
1650 animation[spinkickanim].Load((char *)":Data:Animations:SpinKick",middleheight,normalattack);
1652 animation[getupfromfrontanim].Load((char *)":Data:Animations:GetUpFromFront",lowheight,neutral);
1653 animation[getupfrombackanim].Load((char *)":Data:Animations:GetUpFromBack",lowheight,neutral);
1654 animation[crouchanim].Load((char *)":Data:Animations:Crouch",lowheight,neutral);
1655 animation[sneakanim].Load((char *)":Data:Animations:Sneak",lowheight,neutral);
1656 animation[rollanim].Load((char *)":Data:Animations:Roll",lowheight,neutral);
1657 animation[flipanim].Load((char *)":Data:Animations:Flip",highheight,neutral);
1658 animation[frontflipanim].Load((char *)":Data:Animations:Flip",highheight,neutral);
1659 animation[spinkickreversedanim].Load((char *)":Data:Animations:SpinKickCaught",middleheight,reversed);
1661 animation[spinkickreversalanim].Load((char *)":Data:Animations:SpinKickCatch",middleheight,reversal);
1662 animation[lowkickanim].Load((char *)":Data:Animations:lowkick",middleheight,normalattack);
1663 animation[sweepanim].Load((char *)":Data:Animations:sweep",lowheight,normalattack);
1664 animation[sweepreversedanim].Load((char *)":Data:Animations:SweepCaught",lowheight,reversed);
1665 animation[sweepreversalanim].Load((char *)":Data:Animations:SweepCatch",middleheight,reversal);
1666 animation[rabbitkickanim].Load((char *)":Data:Animations:RabbitKick",middleheight,normalattack);
1667 animation[rabbitkickreversedanim].Load((char *)":Data:Animations:RabbitKickCaught",middleheight,reversed);
1668 animation[rabbitkickreversalanim].Load((char *)":Data:Animations:RabbitKickCatch",lowheight,reversal);
1669 animation[upunchanim].Load((char *)":Data:Animations:Upunch",middleheight,normalattack);
1670 animation[staggerbackhighanim].Load((char *)":Data:Animations:Staggerbackhigh",middleheight,neutral);
1671 animation[upunchreversedanim].Load((char *)":Data:Animations:UpunchCaught",middleheight,reversed);
1673 animation[upunchreversalanim].Load((char *)":Data:Animations:UpunchCatch",middleheight,reversal);
1674 animation[hurtidleanim].Load((char *)":Data:Animations:Hurtidle",middleheight,neutral);
1675 animation[backhandspringanim].Load((char *)":Data:Animations:Backhandspring",middleheight,neutral);
1676 animation[fightidleanim].Load((char *)":Data:Animations:Fightidle",middleheight,neutral);
1677 animation[walkanim].Load((char *)":Data:Animations:Walk",middleheight,neutral);
1679 animation[fightsidestep].Load((char *)":Data:Animations:Fightsidestep",middleheight,neutral);
1680 animation[killanim].Load((char *)":Data:Animations:Kill",middleheight,normalattack);
1681 animation[sneakattackanim].Load((char *)":Data:Animations:Sneakattack",middleheight,reversal);
1682 animation[sneakattackedanim].Load((char *)":Data:Animations:Sneakattacked",middleheight,reversed);
1683 animation[drawrightanim].Load((char *)":Data:Animations:drawright",middleheight,neutral);
1684 animation[knifeslashstartanim].Load((char *)":Data:Animations:slashstart",middleheight,normalattack);
1685 animation[crouchdrawrightanim].Load((char *)":Data:Animations:crouchdrawright",lowheight,neutral);
1686 animation[crouchstabanim].Load((char *)":Data:Animations:crouchstab",lowheight,normalattack);
1688 animation[knifefollowanim].Load((char *)":Data:Animations:slashfollow",middleheight,reversal);
1689 animation[knifefollowedanim].Load((char *)":Data:Animations:slashfollowed",middleheight,reversed);
1690 animation[knifethrowanim].Load((char *)":Data:Animations:knifethrow",middleheight,normalattack);
1691 animation[removeknifeanim].Load((char *)":Data:Animations:removeknife",middleheight,neutral);
1692 animation[crouchremoveknifeanim].Load((char *)":Data:Animations:crouchremoveknife",lowheight,neutral);
1693 animation[jumpreversedanim].Load((char *)":Data:Animations:JumpCaught",middleheight,reversed);
1694 animation[jumpreversalanim].Load((char *)":Data:Animations:JumpCatch",middleheight,reversal);
1695 animation[staggerbackhardanim].Load((char *)":Data:Animations:Staggerbackhard",middleheight,neutral);
1697 animation[dropkickanim].Load((char *)":Data:Animations:Dropkick",middleheight,normalattack);
1698 animation[winduppunchanim].Load((char *)":Data:Animations:Winduppunch",middleheight,normalattack);
1699 animation[winduppunchblockedanim].Load((char *)":Data:Animations:Winduppunchblocked",middleheight,normalattack);
1700 animation[blockhighleftanim].Load((char *)":Data:Animations:Blockhighleft",middleheight,normalattack);
1701 animation[blockhighleftstrikeanim].Load((char *)":Data:Animations:Blockhighleftstrike",middleheight,normalattack);
1702 animation[backflipanim].Load((char *)":Data:Animations:Backflip",highheight,neutral);
1703 animation[walljumpbackanim].Load((char *)":Data:Animations:Walljumpback",highheight,neutral);
1704 animation[walljumpfrontanim].Load((char *)":Data:Animations:Walljumpfront",highheight,neutral);
1705 animation[rightflipanim].Load((char *)":Data:Animations:Rightflip",highheight,neutral);
1706 animation[walljumprightanim].Load((char *)":Data:Animations:Walljumpright",highheight,neutral);
1707 animation[leftflipanim].Load((char *)":Data:Animations:Leftflip",highheight,neutral);
1708 animation[walljumpleftanim].Load((char *)":Data:Animations:Walljumpleft",highheight,neutral);
1709 animation[walljumprightkickanim].Load((char *)":Data:Animations:Walljumprightkick",highheight,neutral);
1710 animation[walljumpleftkickanim].Load((char *)":Data:Animations:Walljumpleftkick",highheight,neutral);
1711 animation[knifefightidleanim].Load((char *)":Data:Animations:Knifefightidle",middleheight,neutral);
1712 animation[knifesneakattackanim].Load((char *)":Data:Animations:Knifesneakattack",middleheight,reversal);
1713 animation[knifesneakattackedanim].Load((char *)":Data:Animations:Knifesneakattacked",middleheight,reversed);
1714 animation[swordfightidleanim].Load((char *)":Data:Animations:swordfightidle",middleheight,neutral);
1715 animation[drawleftanim].Load((char *)":Data:Animations:drawleft",middleheight,neutral);
1716 animation[swordslashanim].Load((char *)":Data:Animations:swordslash",middleheight,normalattack);
1717 animation[swordgroundstabanim].Load((char *)":Data:Animations:swordgroundstab",lowheight,normalattack);
1718 animation[dodgebackanim].Load((char *)":Data:Animations:dodgeback",middleheight,neutral);
1719 animation[swordsneakattackanim].Load((char *)":Data:Animations:Swordsneakattack",middleheight,reversal);
1720 animation[swordsneakattackedanim].Load((char *)":Data:Animations:Swordsneakattacked",middleheight,reversed);
1721 animation[swordslashreversedanim].Load((char *)":Data:Animations:swordslashCaught",middleheight,reversed);
1722 animation[swordslashreversalanim].Load((char *)":Data:Animations:swordslashCatch",middleheight,reversal);
1723 animation[knifeslashreversedanim].Load((char *)":Data:Animations:knifeslashCaught",middleheight,reversed);
1724 animation[knifeslashreversalanim].Load((char *)":Data:Animations:knifeslashCatch",middleheight,reversal);
1725 animation[swordfightidlebothanim].Load((char *)":Data:Animations:swordfightidleboth",middleheight,neutral);
1726 animation[swordslashparryanim].Load((char *)":Data:Animations:sworduprightparry",middleheight,normalattack);
1727 animation[swordslashparriedanim].Load((char *)":Data:Animations:swordslashparried",middleheight,normalattack);
1728 animation[wolfidle].Load((char *)":Data:Animations:Wolfidle",middleheight,neutral);
1729 animation[wolfcrouchanim].Load((char *)":Data:Animations:Wolfcrouch",lowheight,neutral);
1730 animation[wolflandanim].Load((char *)":Data:Animations:Wolflanding",lowheight,neutral);
1731 animation[wolflandhardanim].Load((char *)":Data:Animations:Wolflandhard",lowheight,neutral);
1732 animation[wolfrunanim].Load((char *)":Data:Animations:Wolfrun",middleheight,neutral);
1733 animation[wolfrunninganim].Load((char *)":Data:Animations:Wolfrunning",middleheight,neutral);
1734 animation[rabbitrunninganim].Load((char *)":Data:Animations:Rabbitrunning",middleheight,neutral);
1735 animation[wolfstopanim].Load((char *)":Data:Animations:Wolfstop",middleheight,neutral);
1736 animation[rabbittackleanim].Load((char *)":Data:Animations:Rabbittackle",middleheight,neutral);
1737 animation[rabbittacklinganim].Load((char *)":Data:Animations:Rabbittackling",middleheight,reversal);
1738 animation[rabbittackledbackanim].Load((char *)":Data:Animations:Rabbittackledback",middleheight,reversed);
1739 animation[rabbittackledfrontanim].Load((char *)":Data:Animations:Rabbittackledfront",middleheight,reversed);
1740 animation[wolfslapanim].Load((char *)":Data:Animations:Wolfslap",middleheight,normalattack);
1741 animation[staffhitanim].Load((char *)":Data:Animations:StaffHit",middleheight,normalattack);
1742 animation[staffgroundsmashanim].Load((char *)":Data:Animations:StaffGroundSmash",lowheight,normalattack);
1743 animation[staffspinhitanim].Load((char *)":Data:Animations:Spinwhack",middleheight,normalattack);
1744 animation[staffhitreversedanim].Load((char *)":Data:Animations:StaffHitCaught",middleheight,reversed);
1745 animation[staffhitreversalanim].Load((char *)":Data:Animations:StaffHitCatch",middleheight,reversal);
1746 animation[staffspinhitreversedanim].Load((char *)":Data:Animations:SpinWhackCaught",middleheight,reversed);
1747 animation[staffspinhitreversalanim].Load((char *)":Data:Animations:SpinWhackCatch",middleheight,reversal);
1749 animation[sitanim].Load((char *)":Data:Animations:Sit",lowheight,neutral);
1750 animation[sleepanim].Load((char *)":Data:Animations:Sleep",lowheight,neutral);
1751 animation[talkidleanim].Load((char *)":Data:Animations:TalkIdle",middleheight,neutral);
1753 animation[sitwallanim].Load((char *)":Data:Animations:Dying",lowheight,neutral);
1754 animation[dead1anim].Load((char *)":Data:Animations:Dead1",lowheight,neutral);
1755 animation[dead2anim].Load((char *)":Data:Animations:Dead2",lowheight,neutral);
1756 animation[dead3anim].Load((char *)":Data:Animations:Dead3",lowheight,neutral);
1757 animation[dead4anim].Load((char *)":Data:Animations:Dead4",lowheight,neutral);
1758 //Fix knife stab, too lazy to do it manually
1762 for(i=0;i<player[0].skeleton.num_joints;i++){
1763 for(j=0;j<animation[knifesneakattackanim].numframes;j++){
1764 animation[knifesneakattackanim].position[i][j]+=moveamount;
1771 for(i=0;i<player[0].skeleton.num_joints;i++){
1772 for(j=0;j<animation[knifesneakattackedanim].numframes;j++){
1773 animation[knifesneakattackedanim].position[i][j]+=moveamount;
1780 for(i=0;i<player[0].skeleton.num_joints;i++){
1781 animation[dead1anim].position[i][1]=animation[dead1anim].position[i][0];
1782 animation[dead2anim].position[i][1]=animation[dead2anim].position[i][0];
1783 animation[dead3anim].position[i][1]=animation[dead3anim].position[i][0];
1784 animation[dead4anim].position[i][1]=animation[dead4anim].position[i][0];
1786 animation[dead1anim].speed[0]=0.001;
1787 animation[dead2anim].speed[0]=0.001;
1788 animation[dead3anim].speed[0]=0.001;
1789 animation[dead4anim].speed[0]=0.001;
1791 animation[dead1anim].speed[1]=0.001;
1792 animation[dead2anim].speed[1]=0.001;
1793 animation[dead3anim].speed[1]=0.001;
1794 animation[dead4anim].speed[1]=0.001;
1796 for(i=0;i<player[0].skeleton.num_joints;i++){
1797 for(j=0;j<animation[swordsneakattackanim].numframes;j++){
1798 animation[swordsneakattackanim].position[i][j]+=moveamount;
1803 for(j=0;j<animation[swordsneakattackanim].numframes;j++){
1804 animation[swordsneakattackanim].weapontarget[j]+=moveamount;
1810 for(i=0;i<player[0].skeleton.num_joints;i++){
1811 for(j=0;j<animation[swordsneakattackedanim].numframes;j++){
1812 animation[swordsneakattackedanim].position[i][j]+=moveamount;
1816 for(i=0;i<player[0].skeleton.num_joints;i++){
1817 for(j=0;j<animation[sleepanim].numframes;j++){
1818 animation[sleepanim].position[i][j]=DoRotation(animation[sleepanim].position[i][j],0,180,0);
1824 temptexdetail=texdetail;
1826 texdetail=temptexdetail;
1833 glPixelStorei( GL_UNPACK_ALIGNMENT, 1 );
1835 glGenTextures( 1, &screentexture );
1836 glTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE );
1839 glEnable(GL_TEXTURE_2D);
1840 glBindTexture( GL_TEXTURE_2D, screentexture);
1841 glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR );
1842 glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR );
1844 glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 0, 0, kTextureSize, kTextureSize, 0);
1850 /*PlaySoundEx( consolesuccesssound, samp[consolesuccesssound], NULL, true);
1851 FSOUND_SetVolume(channels[consolesuccesssound], 256);
1852 FSOUND_SetPaused(channels[consolesuccesssound], false);
1855 float gLoc[3]={0,0,0};
1856 float vel[3]={0,0,0};
1857 FSOUND_Sample_SetMinMaxDistance(samp[fireendsound], 9999.0f, 99999.0f);
1858 PlaySoundEx( fireendsound, samp[fireendsound], NULL, true);
1859 FSOUND_3D_SetAttributes(channels[fireendsound], gLoc, vel);
1860 FSOUND_SetVolume(channels[fireendsound], 256);
1861 FSOUND_SetPaused(channels[fireendsound], false);
1862 FSOUND_Sample_SetMinMaxDistance(samp[fireendsound], 8.0f, 2000.0f);
1875 terraintexture2 = 0;
1876 terraintexture3 = 0;
1880 loadscreentexture = 0;
1881 Maparrowtexture = 0;
1883 Mapcircletexture = 0;
1886 memset(Mainmenuitems, 0, sizeof(Mainmenuitems));
1890 memset(startx, 0, sizeof(startx));
1891 memset(starty, 0, sizeof(starty));
1892 memset(endx, 0, sizeof(endx));
1893 memset(endy, 0, sizeof(endy));
1895 memset(selectedlong, 0, sizeof(selectedlong));
1896 memset(offsetx, 0, sizeof(offsetx));
1897 memset(offsety, 0, sizeof(offsety));
1898 memset(movex, 0, sizeof(movex));
1899 memset(movey, 0, sizeof(movey));
1900 memset(endy, 0, sizeof(endy));
1914 memset(menustring, 0, sizeof(menustring));
1915 memset(registrationname, 0, sizeof(registrationname));
1916 registrationnumber = 0;
1920 newscreenheight = 0;
1923 deltah = 0,deltav = 0;
1924 mousecoordh = 0,mousecoordv = 0;
1925 oldmousecoordh = 0,oldmousecoordv = 0;
1926 rotation = 0,rotation2 = 0;
1931 cameratogglekeydown = 0;
1932 chattogglekeydown = 0;
1935 drawmodetogglekeydown = 0;
1936 explodetogglekeydown = 0;
1937 detailtogglekeydown = 0;
1947 // XYZ realhawkcoords;
1959 campaignnumlevels = 0;
1961 memset(campaignmapname, 0, sizeof(campaignmapname));
1962 memset(campaigndescription, 0, sizeof(campaigndescription));
1963 memset(campaignchoosenext, 0, sizeof(campaignchoosenext));
1964 memset(campaignnumnext, 0, sizeof(campaignnumnext));
1965 memset(campaignnextlevel, 0, sizeof(campaignnextlevel));
1966 int campaignchoicesmade;
1967 memset(campaignchoices, 0, sizeof(campaignchoices));
1968 memset(campaignlocationx, 0, sizeof(campaignlocationx));
1969 memset(campaignlocationy, 0, sizeof(campaignlocationy));
1970 memset(campaignlocationy, 0, sizeof(campaignlocationy));
1972 campaignchoicenum = 0;
1974 memset(campaignchoicewhich, 0, sizeof(campaignchoicewhich));
1978 numlevelspassed = 0;
1980 memset(levelorder, 0, sizeof(levelorder));
1981 memset(levelvisible, 0, sizeof(levelvisible));
1982 memset(levelhighlight, 0, sizeof(levelhighlight));
1986 musictype = 0,oldmusictype = 0,oldoldmusictype = 0;
1990 // XYZ rabbitcoords;
2001 envtogglekeydown = 0;
2002 slomotogglekeydown = 0;
2003 texturesizetogglekeydown = 0;
2004 freezetogglekeydown = 0;
2011 editorrotation2 = 0;
2018 // XYZ pathpoint[30];
2020 memset(numpathpointconnect, 0, sizeof(numpathpointconnect));
2021 memset(pathpointconnect, 0, sizeof(pathpointconnect));
2022 pathpointselected = 0;
2026 numchallengelevels = 0;
2029 archiveselected = 0;
2031 memset(consoletext, 0, sizeof(consoletext));
2032 memset(consolechars, 0, sizeof(consolechars));
2034 memset(displaytext, 0, sizeof(displaytext));
2035 memset(displaychars, 0, sizeof(displaychars));
2036 memset(displaytime, 0, sizeof(displaytime));
2037 displayblinkdelay = 0;
2039 displayselected = 0;
2041 consoletogglekeydown = 0;
2042 consoleblinkdelay = 0;
2044 consoleselected = 0;
2045 memset(togglekey, 0, sizeof(togglekey));
2046 memset(togglekeydelay, 0, sizeof(togglekeydelay));
2050 crouchkey = 0,jumpkey = 0,forwardkey = 0,chatkey = 0,backkey = 0,leftkey = 0,rightkey = 0,drawkey = 0,throwkey = 0,attackkey = 0;
2057 // XYZ boundary[360];
2064 memset(musicvolume, 0, sizeof(musicvolume));
2065 memset(oldmusicvolume, 0, sizeof(oldmusicvolume));