2 extern float screenwidth,screenheight;
3 extern float viewdistance;
5 extern XYZ lightlocation;
6 extern float lightambient[3],lightbrightness[3];
7 extern float fadestart;
11 extern Animation animation[animation_count];
12 extern Skeleton testskeleton;
14 extern FSOUND_SAMPLE *samp[100];
15 extern int channels[100];
16 extern Terrain terrain;
17 extern Sprites sprites;
18 extern int kTextureSize;
19 extern float texdetail;
20 extern float realtexdetail;
21 extern float terraindetail;
23 extern Objects objects;
25 extern bool cellophane;
26 extern GLubyte bloodText[512*512*3];
27 extern GLubyte wolfbloodText[512*512*3];
28 extern bool ismotionblur;
29 extern bool trilinear;
31 extern bool musictoggle;
32 extern Weapons weapons;
33 extern Person player[maxplayers];
34 extern int numplayers;
35 extern int environment;
36 extern bool ambientsound;
37 extern float multiplier;
38 extern int newnetmessages;
39 extern int netdatanew;
41 extern bool stillloading;
42 extern TGAImageRec texture;
46 extern int oldmainmenu;
47 extern bool visibleloading;
48 extern int loadscreencolor;
49 extern float flashamount,flashr,flashg,flashb;
50 extern int flashdelay;
51 extern int whichjointstartarray[26];
52 extern int whichjointendarray[26];
53 extern int difficulty;
54 extern float tintr,tintg,tintb;
55 extern float slomospeed;
56 extern char mapname[256];
57 extern bool gamestarted;
59 extern int numaccounts;
60 extern int accountactive;
61 extern int accountdifficulty[10];
62 extern int accountprogress[10];
63 extern float accountpoints[10];
64 extern float accounthighscore[10][50];
65 extern float accountfasttime[10][50];
66 extern bool accountunlocked[10][60];
67 extern char accountname[10][256];
69 extern int numdialogues;
70 extern int numdialogueboxes[20];
71 extern int dialoguetype[20];
72 extern int dialogueboxlocation[20][20];
73 extern float dialogueboxcolor[20][20][3];
74 extern int dialogueboxsound[20][20];
75 extern char dialoguetext[20][20][128];
76 extern char dialoguename[20][20][64];
77 extern XYZ dialoguecamera[20][20];
78 extern float dialoguecamerarotation[20][20];
79 extern float dialoguecamerarotation2[20][20];
80 extern int indialogue;
81 extern int whichdialogue;
82 extern float dialoguetime;
84 extern float accountcampaignhighscore[10];
85 extern float accountcampaignfasttime[10];
86 extern float accountcampaignscore[10];
87 extern float accountcampaigntime[10];
89 extern int accountcampaignchoicesmade[10];
90 extern int accountcampaignchoices[10][5000];
92 extern FSOUND_STREAM * strm[20];
94 extern "C" void PlaySoundEx(int channel, FSOUND_SAMPLE *sptr, FSOUND_DSPUNIT *dsp, signed char startpaused);
95 extern "C" void PlayStreamEx(int chan, FSOUND_STREAM *sptr, FSOUND_DSPUNIT *dsp, signed char startpaused);
97 Game::TextureList Game::textures;
106 accountcampaignchoicesmade[accountactive]=0;
107 accountcampaignscore[accountactive]=0;
108 accountcampaigntime[accountactive]=0;
113 sprintf (mapname, ":Data:Users");
116 tfile=fopen( mapname, "wb" );
119 fpackf(tfile, "Bi", numaccounts);
120 fpackf(tfile, "Bi", accountactive);
123 for(i=0;i<numaccounts;i++)
125 fpackf(tfile, "Bf", accountcampaigntime[i]);
126 fpackf(tfile, "Bf", accountcampaignscore[i]);
127 fpackf(tfile, "Bf", accountcampaignfasttime[i]);
128 fpackf(tfile, "Bf", accountcampaignhighscore[i]);
129 fpackf(tfile, "Bi", accountdifficulty[i]);
130 fpackf(tfile, "Bi", accountprogress[i]);
131 fpackf(tfile, "Bi", accountcampaignchoicesmade[i]);
132 for(j=0;j<accountcampaignchoicesmade[i];j++)
134 fpackf(tfile, "Bi", accountcampaignchoices[i][j]);
136 fpackf(tfile, "Bf", accountpoints[i]);
139 fpackf(tfile, "Bf", accounthighscore[i][j]);
140 fpackf(tfile, "Bf", accountfasttime[i][j]);
144 fpackf(tfile, "Bb", accountunlocked[i][j]);
146 fpackf(tfile, "Bi", strlen(accountname[i]));
147 if(strlen(accountname[i])>0)
149 for(j=0;j<(int)strlen(accountname[i]);j++)
151 fpackf(tfile, "Bb", accountname[i][j]);
160 TexIter it = textures.begin();
161 for (; it != textures.end(); ++it)
163 if (glIsTexture(it->second))
164 glDeleteTextures(1, &it->second);
168 LOG("Shutting down sound system...");
170 FSOUND_StopSound(FSOUND_ALL);
172 // this is causing problems on Linux, but we'll force an _exit() a little
173 // later in the shutdown process. --ryan.
175 #define streamcount 20
176 #define samplecount 100
178 for (i=0; i < samplecount; ++i)
180 FSOUND_Sample_Free(samp[i]);
183 for (i=0; i < streamcount; ++i)
185 FSOUND_Stream_Close(strm[i]);
198 //void Game::LoadSounds();
199 void Game::LoadSounds()
203 LOG(std::string("Loading sounds..."));
205 FSOUND_3D_SetDopplerFactor(0);
207 FSOUND_SetSFXMasterVolume((int)(volume*255));
209 samp[footstepsound] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:footstepsnow1.ogg", FSOUND_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
210 FSOUND_Sample_SetMinMaxDistance(samp[footstepsound], 4.0f, 1000.0f);
212 samp[footstepsound2] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:footstepsnow2.ogg", FSOUND_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
213 FSOUND_Sample_SetMinMaxDistance(samp[footstepsound2], 4.0f, 1000.0f);
215 samp[footstepsound3] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:footstepstone1.ogg", FSOUND_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
216 FSOUND_Sample_SetMinMaxDistance(samp[footstepsound3], 4.0f, 1000.0f);
218 samp[footstepsound4] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:footstepstone2.ogg", FSOUND_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
219 FSOUND_Sample_SetMinMaxDistance(samp[footstepsound4], 4.0f, 1000.0f);
221 samp[landsound] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:land.ogg", FSOUND_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
222 FSOUND_Sample_SetMinMaxDistance(samp[landsound], 4.0f, 1000.0f);
224 samp[jumpsound] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:jump.ogg", FSOUND_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
225 FSOUND_Sample_SetMinMaxDistance(samp[jumpsound], 4.0f, 1000.0f);
227 samp[hawksound] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:hawk.ogg", FSOUND_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
228 FSOUND_Sample_SetMinMaxDistance(samp[hawksound], 40.0f, 10000.0f);
230 samp[whooshsound] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:whoosh.ogg", FSOUND_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
231 FSOUND_Sample_SetMinMaxDistance(samp[whooshsound], 4.0f, 1000.0f);
232 FSOUND_Sample_SetMode(samp[whooshsound], FSOUND_LOOP_NORMAL);
234 samp[landsound1] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:land1.ogg", FSOUND_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
235 FSOUND_Sample_SetMinMaxDistance(samp[landsound1], 4.0f, 1000.0f);
239 samp[landsound2] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:land2.ogg", FSOUND_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
240 FSOUND_Sample_SetMinMaxDistance(samp[landsound2], 4.0f, 1000.0f);
242 samp[breaksound] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:broken.ogg", FSOUND_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
243 FSOUND_Sample_SetMinMaxDistance(samp[breaksound], 8.0f, 2000.0f);
245 samp[lowwhooshsound] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:Lowwhoosh.ogg", FSOUND_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
246 FSOUND_Sample_SetMinMaxDistance(samp[lowwhooshsound], 8.0f, 2000.0f);
248 samp[midwhooshsound] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:midwhoosh.ogg", FSOUND_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
249 FSOUND_Sample_SetMinMaxDistance(samp[midwhooshsound], 8.0f, 2000.0f);
251 samp[highwhooshsound] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:highwhoosh.ogg", FSOUND_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
252 FSOUND_Sample_SetMinMaxDistance(samp[highwhooshsound], 8.0f, 2000.0f);
254 samp[movewhooshsound] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:movewhoosh.ogg", FSOUND_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
255 FSOUND_Sample_SetMinMaxDistance(samp[movewhooshsound], 8.0f, 2000.0f);
257 samp[heavyimpactsound] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:heavyimpact.ogg", FSOUND_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
258 FSOUND_Sample_SetMinMaxDistance(samp[heavyimpactsound], 8.0f, 2000.0f);
260 samp[whooshhitsound] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:Whooshhit.ogg", FSOUND_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
261 FSOUND_Sample_SetMinMaxDistance(samp[whooshhitsound], 8.0f, 2000.0f);
263 samp[thudsound] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:thud.ogg", FSOUND_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
264 FSOUND_Sample_SetMinMaxDistance(samp[thudsound], 8.0f, 2000.0f);
266 samp[alarmsound] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:alarm.ogg", FSOUND_2D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
267 FSOUND_Sample_SetMinMaxDistance(samp[alarmsound], 8.0f, 2000.0f);
269 samp[breaksound2] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:break.ogg", FSOUND_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
270 FSOUND_Sample_SetMinMaxDistance(samp[breaksound2], 8.0f, 2000.0f);
272 samp[knifedrawsound] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:knifedraw.ogg", FSOUND_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
273 FSOUND_Sample_SetMinMaxDistance(samp[knifedrawsound], 8.0f, 2000.0f);
275 samp[knifesheathesound] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:knifesheathe.ogg", FSOUND_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
276 FSOUND_Sample_SetMinMaxDistance(samp[knifesheathesound], 8.0f, 2000.0f);
278 samp[fleshstabsound] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:Fleshstab.ogg", FSOUND_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
279 FSOUND_Sample_SetMinMaxDistance(samp[fleshstabsound], 8.0f, 2000.0f);
281 samp[fleshstabremovesound] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:Fleshstabremove.ogg", FSOUND_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
282 FSOUND_Sample_SetMinMaxDistance(samp[fleshstabremovesound], 8.0f, 2000.0f);
284 samp[knifeswishsound] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:knifeswish.ogg", FSOUND_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
285 FSOUND_Sample_SetMinMaxDistance(samp[knifeswishsound], 8.0f, 2000.0f);
287 samp[knifeslicesound] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:knifeslice.ogg", FSOUND_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
288 FSOUND_Sample_SetMinMaxDistance(samp[knifeslicesound], 8.0f, 2000.0f);
290 samp[swordslicesound] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:swordslice.ogg", FSOUND_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
291 FSOUND_Sample_SetMinMaxDistance(samp[swordslicesound], 8.0f, 2000.0f);
293 samp[skidsound] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:skid.ogg", FSOUND_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
294 FSOUND_Sample_SetMinMaxDistance(samp[skidsound], 8.0f, 2000.0f);
296 samp[snowskidsound] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:snowskid.ogg", FSOUND_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
297 FSOUND_Sample_SetMinMaxDistance(samp[snowskidsound], 8.0f, 2000.0f);
299 samp[bushrustle] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:bushrustle.ogg", FSOUND_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
300 FSOUND_Sample_SetMinMaxDistance(samp[bushrustle], 4.0f, 1000.0f);
302 samp[clank1sound] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:clank1.ogg", FSOUND_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
303 FSOUND_Sample_SetMinMaxDistance(samp[clank1sound], 8.0f, 2000.0f);
305 samp[clank2sound] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:clank2.ogg", FSOUND_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
306 FSOUND_Sample_SetMinMaxDistance(samp[clank2sound], 8.0f, 2000.0f);
308 samp[clank3sound] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:clank3.ogg", FSOUND_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
309 FSOUND_Sample_SetMinMaxDistance(samp[clank3sound], 8.0f, 2000.0f);
311 samp[clank4sound] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:clank4.ogg", FSOUND_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
312 FSOUND_Sample_SetMinMaxDistance(samp[clank4sound], 8.0f, 2000.0f);
314 samp[consolesuccesssound] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:consolesuccess.ogg", FSOUND_2D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
315 FSOUND_Sample_SetMinMaxDistance(samp[consolesuccesssound], 4.0f, 1000.0f);
317 samp[consolefailsound] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:consolefail.ogg", FSOUND_2D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
318 FSOUND_Sample_SetMinMaxDistance(samp[consolefailsound], 4.0f, 1000.0f);
320 samp[metalhitsound] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:MetalHit.ogg", FSOUND_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
321 FSOUND_Sample_SetMinMaxDistance(samp[metalhitsound], 8.0f, 2000.0f);
323 samp[clawslicesound] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:clawslice.ogg", FSOUND_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
324 FSOUND_Sample_SetMinMaxDistance(samp[clawslicesound], 8.0f, 2000.0f);
326 samp[splattersound] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:splatter.ogg", FSOUND_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
327 FSOUND_Sample_SetMinMaxDistance(samp[splattersound], 8.0f, 2000.0f);
329 samp[growlsound] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:Growl.ogg", FSOUND_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
330 FSOUND_Sample_SetMinMaxDistance(samp[growlsound], 1000.0f, 2000.0f);
332 samp[growl2sound] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:Growl2.ogg", FSOUND_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
333 FSOUND_Sample_SetMinMaxDistance(samp[growl2sound], 1000.0f, 2000.0f);
335 samp[barksound] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:bark.ogg", FSOUND_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
336 FSOUND_Sample_SetMinMaxDistance(samp[barksound], 1000.0f, 2000.0f);
338 samp[bark2sound] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:bark2.ogg", FSOUND_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
339 FSOUND_Sample_SetMinMaxDistance(samp[bark2sound], 1000.0f, 2000.0f);
341 samp[bark3sound] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:bark3.ogg", FSOUND_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
342 FSOUND_Sample_SetMinMaxDistance(samp[bark3sound], 1000.0f, 2000.0f);
344 samp[snarlsound] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:snarl.ogg", FSOUND_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
345 FSOUND_Sample_SetMinMaxDistance(samp[snarlsound], 1000.0f, 2000.0f);
348 samp[snarl2sound] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:snarl2.ogg", FSOUND_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
349 FSOUND_Sample_SetMinMaxDistance(samp[snarl2sound], 1000.0f, 2000.0f);
351 samp[barkgrowlsound] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:barkgrowl.ogg", FSOUND_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
352 FSOUND_Sample_SetMinMaxDistance(samp[barkgrowlsound], 1000.0f, 2000.0f);
354 samp[rabbitattacksound] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:rabbitattack.ogg", FSOUND_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
355 FSOUND_Sample_SetMinMaxDistance(samp[rabbitattacksound], 1000.0f, 2000.0f);
357 samp[rabbitattack2sound] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:rabbitattack2.ogg", FSOUND_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
358 FSOUND_Sample_SetMinMaxDistance(samp[rabbitattack2sound], 1000.0f, 2000.0f);
360 samp[rabbitattack3sound] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:rabbitattack3.ogg", FSOUND_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
361 FSOUND_Sample_SetMinMaxDistance(samp[rabbitattack3sound], 1000.0f, 2000.0f);
363 samp[rabbitattack4sound] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:rabbitattack4.ogg", FSOUND_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
364 FSOUND_Sample_SetMinMaxDistance(samp[rabbitattack4sound], 1000.0f, 2000.0f);
366 samp[rabbitpainsound] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:rabbitpain.ogg", FSOUND_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
367 FSOUND_Sample_SetMinMaxDistance(samp[rabbitpainsound], 1000.0f, 2000.0f);
369 samp[rabbitpain1sound] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:rabbitpain2.ogg", FSOUND_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
370 FSOUND_Sample_SetMinMaxDistance(samp[rabbitpain1sound], 1000.0f, 2000.0f);
372 /*samp[rabbitpain2sound] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:rabbitpain2.ogg", FSOUND_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
373 FSOUND_Sample_SetMinMaxDistance(samp[rabbitpain2sound], 1000.0f, 2000.0f);
375 samp[rabbitchitter] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:rabbitchitter.ogg", FSOUND_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
376 FSOUND_Sample_SetMinMaxDistance(samp[rabbitchitter], 1000.0f, 2000.0f);
378 samp[rabbitchitter2] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:rabbitchitter2.ogg", FSOUND_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
379 FSOUND_Sample_SetMinMaxDistance(samp[rabbitchitter2], 1000.0f, 2000.0f);
381 samp[swordstaffsound] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:swordstaff.ogg", FSOUND_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
382 FSOUND_Sample_SetMinMaxDistance(samp[swordstaffsound], 8.0f, 2000.0f);
384 samp[staffbodysound] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:staffbody.ogg", FSOUND_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
385 FSOUND_Sample_SetMinMaxDistance(samp[staffbodysound], 8.0f, 2000.0f);
387 samp[staffheadsound] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:staffhead.ogg", FSOUND_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
388 FSOUND_Sample_SetMinMaxDistance(samp[staffheadsound], 8.0f, 2000.0f);
390 samp[staffbreaksound] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:staffbreak.wav", FSOUND_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
391 FSOUND_Sample_SetMinMaxDistance(samp[staffbreaksound], 8.0f, 2000.0f);
397 void Game::LoadTexture(char *fileName, GLuint *textureid,int mipmap, bool hasalpha)
403 LOG(std::string("Loading texture...") + fileName);
405 unsigned char fileNamep[256];
406 CopyCStringToPascal(fileName,fileNamep);
408 upload_image( fileNamep ,hasalpha);
410 // std::string fname(fileName);
411 // std::transform(fname.begin(), fname.end(), tolower);
412 // TexIter it = textures.find(fname);
416 //if(textures.end() == it)
419 if ( texture.bpp == 24 )
424 glPixelStorei( GL_UNPACK_ALIGNMENT, 1 );
426 if(!*textureid)glGenTextures( 1, textureid );
427 glTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE );
429 glBindTexture( GL_TEXTURE_2D, *textureid);
430 glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR );
431 if(trilinear)if(mipmap)glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR );
432 if(!trilinear)if(mipmap)glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_NEAREST );
433 if(!mipmap)glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR );
435 //glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, texture.sizeX, texture.sizeY, 0,
436 // GL_BGRA_EXT, GL_UNSIGNED_INT_8_8_8_8_REV, texture.data);
438 //gluBuild2DMipmaps( GL_TEXTURE_2D, type, texture.sizeX, texture.sizeY, GL_BGRA_EXT, GL_UNSIGNED_INT_8_8_8_8_REV, texture.data );
440 gluBuild2DMipmaps( GL_TEXTURE_2D, type, texture.sizeX, texture.sizeY, type, GL_UNSIGNED_BYTE, texture.data );
442 // textures.insert(std::make_pair(fname, *textureid));
446 // *textureid = it->second;
450 void Game::LoadTextureSave(char *fileName, GLuint *textureid,int mipmap,GLubyte *array, int *skinsize)
458 LOG(std::string("Loading texture (S)...") + fileName);
461 unsigned char fileNamep[256];
462 CopyCStringToPascal(fileName,fileNamep);
464 upload_image( fileNamep ,0);
465 //LoadTGA( fileName );
467 // std::string fname(fileName);
468 // std::transform(fname.begin(), fname.end(), tolower);
469 // TexIter it = textures.find(fname);
473 //if(textures.end() == it)
475 bytesPerPixel=texture.bpp/8;
478 if ( texture.bpp == 24 )
483 glPixelStorei( GL_UNPACK_ALIGNMENT, 1 );
485 if(!*textureid)glGenTextures( 1, textureid );
486 glTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE );
488 glBindTexture( GL_TEXTURE_2D, *textureid);
489 glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR );
490 if(trilinear)if(mipmap)glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR );
491 if(!trilinear)if(mipmap)glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_NEAREST );
492 if(!mipmap)glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR );
495 for(i=0;i<(int)(texture.sizeY*texture.sizeX*bytesPerPixel);i++){
496 if((i+1)%4||type==GL_RGB){
497 array[tempnum]=texture.data[i];
502 *skinsize=texture.sizeX;
504 gluBuild2DMipmaps( GL_TEXTURE_2D, type, texture.sizeX, texture.sizeY, GL_RGB, GL_UNSIGNED_BYTE, array );
506 // textures.insert(std::make_pair(fname, *textureid));
510 // *textureid = it->second;
514 void Game::LoadSave(char *fileName, GLuint *textureid,bool mipmap,GLubyte *array, int *skinsize)
521 LOG(std::string("Loading (S)...") + fileName);
524 float temptexdetail=texdetail;
526 //upload_image( fileName );
527 //LoadTGA( fileName );
529 unsigned char fileNamep[256];
530 CopyCStringToPascal(fileName,fileNamep);
532 upload_image( fileNamep ,0);
533 texdetail=temptexdetail;
537 bytesPerPixel=texture.bpp/8;
540 for(i=0;i<(int)(texture.sizeY*texture.sizeX*bytesPerPixel);i++){
541 if((i+1)%4||bytesPerPixel==3){
542 array[tempnum]=texture.data[i];
549 bool Game::AddClothes(char *fileName, GLuint *textureid,bool mipmap,GLubyte *array, int *skinsize)
556 //upload_image( fileName );
557 //LoadTGA( fileName );
559 unsigned char fileNamep[256];
560 CopyCStringToPascal(fileName,fileNamep);
563 opened=upload_image( fileNamep ,1);
576 bytesPerPixel=texture.bpp/8;
580 for(i=0;i<(int)(texture.sizeY*texture.sizeX*bytesPerPixel);i++){
581 if(bytesPerPixel==3)alphanum=255;
582 else if((i+1)%4==0)alphanum=texture.data[i];
584 if((i+1)%4||bytesPerPixel==3){
585 if((i%4)==0)texture.data[i]*=tintr;
586 if((i%4)==1)texture.data[i]*=tintg;
587 if((i%4)==2)texture.data[i]*=tintb;
588 array[tempnum]=(float)array[tempnum]*(1-alphanum/255)+(float)texture.data[i]*(alphanum/255);
598 //***************> ResizeGLScene() <******/
599 GLvoid Game::ReSizeGLScene(float fov, float pnear)
606 glViewport(0,0,screenwidth,screenheight);
608 glMatrixMode(GL_PROJECTION);
611 gluPerspective(fov,(GLfloat)screenwidth/(GLfloat)screenheight,pnear,viewdistance);
613 glMatrixMode(GL_MODELVIEW);
617 void Game::LoadingScreen()
619 static float loadprogress,minprogress,maxprogress;
620 static AbsoluteTime time = {0,0};
621 static AbsoluteTime frametime = {0,0};
622 AbsoluteTime currTime = UpTime ();
623 double deltaTime = (float) AbsoluteDeltaToDuration (currTime, frametime);
625 if (0 > deltaTime) // if negative microseconds
626 deltaTime /= -1000000.0;
627 else // else milliseconds
630 multiplier=deltaTime;
631 if(multiplier<.001)multiplier=.001;
632 if(multiplier>10)multiplier=10;
634 frametime = currTime; // reset for next time interval
639 glClearColor(0,0,0,1);
640 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
643 loadtime+=multiplier*4;
645 loadprogress=loadtime;
646 if(loadprogress>100)loadprogress=100;
648 //loadprogress=abs(Random()%100);
652 glEnable(GL_TEXTURE_2D);
653 glBindTexture( GL_TEXTURE_2D, loadscreentexture);
654 glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT );
655 glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT );
656 glDisable(GL_DEPTH_TEST); // Disables Depth Testing
657 glDisable(GL_CULL_FACE);
658 glDisable(GL_LIGHTING);
660 glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
661 glPushMatrix(); // Store The Projection Matrix
662 glLoadIdentity(); // Reset The Projection Matrix
663 glOrtho(0,screenwidth,0,screenheight,-100,100); // Set Up An Ortho Screen
664 glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
665 glPushMatrix(); // Store The Modelview Matrix
666 glLoadIdentity(); // Reset The Modelview Matrix
667 glTranslatef(screenwidth/2,screenheight/2,0);
668 glScalef((float)screenwidth/2,(float)screenheight/2,1);
669 glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
671 glColor4f(loadprogress/100,loadprogress/100,loadprogress/100,1);
672 //glColor4f(1,1,1,1);
673 /*if(loadscreencolor==0)glColor4f(1,1,1,1);
674 if(loadscreencolor==1)glColor4f(1,0,0,1);
675 if(loadscreencolor==2)glColor4f(0,1,0,1);
676 if(loadscreencolor==3)glColor4f(0,0,1,1);
677 if(loadscreencolor==4)glColor4f(1,1,0,1);
678 if(loadscreencolor==5)glColor4f(1,0,1,1);
681 //glScalef(.25,.25,.25);
683 glTexCoord2f(.1-loadprogress/100,0+loadprogress/100+.3);
684 glVertex3f(-1, -1, 0.0f);
685 glTexCoord2f(.1-loadprogress/100,0+loadprogress/100+.3);
686 glVertex3f(1, -1, 0.0f);
687 glTexCoord2f(.1-loadprogress/100,1+loadprogress/100+.3);
688 glVertex3f(1, 1, 0.0f);
689 glTexCoord2f(.1-loadprogress/100,1+loadprogress/100+.3);
690 glVertex3f(-1, 1, 0.0f);
695 //glScalef(.25,.25,.25);
697 glTexCoord2f(.4+loadprogress/100,0+loadprogress/100);
698 glVertex3f(-1, -1, 0.0f);
699 glTexCoord2f(.4+loadprogress/100,0+loadprogress/100);
700 glVertex3f(1, -1, 0.0f);
701 glTexCoord2f(.4+loadprogress/100,1+loadprogress/100);
702 glVertex3f(1, 1, 0.0f);
703 glTexCoord2f(.4+loadprogress/100,1+loadprogress/100);
704 glVertex3f(-1, 1, 0.0f);
707 glDisable(GL_TEXTURE_2D);
708 glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
709 glPopMatrix(); // Restore The Old Projection Matrix
710 glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
711 glPopMatrix(); // Restore The Old Projection Matrix
715 glEnable(GL_TEXTURE_2D);
716 glBindTexture( GL_TEXTURE_2D, loadscreentexture);
717 glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT );
718 glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT );
719 glDisable(GL_DEPTH_TEST); // Disables Depth Testing
720 glDisable(GL_CULL_FACE);
721 glDisable(GL_LIGHTING);
723 glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
724 glPushMatrix(); // Store The Projection Matrix
725 glLoadIdentity(); // Reset The Projection Matrix
726 glOrtho(0,screenwidth,0,screenheight,-100,100); // Set Up An Ortho Screen
727 glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
728 glPushMatrix(); // Store The Modelview Matrix
729 glLoadIdentity(); // Reset The Modelview Matrix
730 glTranslatef(screenwidth/2,screenheight/2,0);
731 glScalef((float)screenwidth/2*(1.5-(loadprogress)/200),(float)screenheight/2*(1.5-(loadprogress)/200),1);
732 glBlendFunc(GL_SRC_ALPHA,GL_ONE);
734 //glColor4f(loadprogress/100,loadprogress/100,loadprogress/100,1);
735 glColor4f(loadprogress/100,loadprogress/100,loadprogress/100,1);
736 /*if(loadscreencolor==0)glColor4f(1,1,1,1);
737 if(loadscreencolor==1)glColor4f(1,0,0,1);
738 if(loadscreencolor==2)glColor4f(0,1,0,1);
739 if(loadscreencolor==3)glColor4f(0,0,1,1);
740 if(loadscreencolor==4)glColor4f(1,1,0,1);
741 if(loadscreencolor==5)glColor4f(1,0,1,1);
744 //glScalef(.25,.25,.25);
746 glTexCoord2f(0+.5,0+.5);
747 glVertex3f(-1, -1, 0.0f);
748 glTexCoord2f(1+.5,0+.5);
749 glVertex3f(1, -1, 0.0f);
750 glTexCoord2f(1+.5,1+.5);
751 glVertex3f(1, 1, 0.0f);
752 glTexCoord2f(0+.5,1+.5);
753 glVertex3f(-1, 1, 0.0f);
756 glDisable(GL_TEXTURE_2D);
757 glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
758 glPopMatrix(); // Restore The Old Projection Matrix
759 glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
760 glPopMatrix(); // Restore The Old Projection Matrix
764 glEnable(GL_TEXTURE_2D);
765 glBindTexture( GL_TEXTURE_2D, loadscreentexture);
766 glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT );
767 glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT );
768 glDisable(GL_DEPTH_TEST); // Disables Depth Testing
769 glDisable(GL_CULL_FACE);
770 glDisable(GL_LIGHTING);
772 glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
773 glPushMatrix(); // Store The Projection Matrix
774 glLoadIdentity(); // Reset The Projection Matrix
775 glOrtho(0,screenwidth,0,screenheight,-100,100); // Set Up An Ortho Screen
776 glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
777 glPushMatrix(); // Store The Modelview Matrix
778 glLoadIdentity(); // Reset The Modelview Matrix
779 glTranslatef(screenwidth/2,screenheight/2,0);
780 glScalef((float)screenwidth/2*(100+loadprogress)/100,(float)screenheight/2*(100+loadprogress)/100,1);
781 glBlendFunc(GL_SRC_ALPHA,GL_ONE);
783 glColor4f(loadprogress/100,loadprogress/100,loadprogress/100,.4);
785 //glScalef(.25,.25,.25);
787 glTexCoord2f(0+.2,0+.8);
788 glVertex3f(-1, -1, 0.0f);
789 glTexCoord2f(1+.2,0+.8);
790 glVertex3f(1, -1, 0.0f);
791 glTexCoord2f(1+.2,1+.8);
792 glVertex3f(1, 1, 0.0f);
793 glTexCoord2f(0+.2,1+.8);
794 glVertex3f(-1, 1, 0.0f);
797 glDisable(GL_TEXTURE_2D);
798 glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
799 glPopMatrix(); // Restore The Old Projection Matrix
800 glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
801 glPopMatrix(); // Restore The Old Projection Matrix
807 glEnable(GL_TEXTURE_2D);
808 static char string[256]="";
809 sprintf (string, "LOADING... %d%",(int)loadprogress);
811 text.glPrint(280-280*loadprogress/100/2/4,125-125*loadprogress/100/2/4,string,1,1+loadprogress/100,640,480);
812 glColor4f(1.2-loadprogress/100,1.2-loadprogress/100,1.2-loadprogress/100,1);
813 text.glPrint(280,125,string,1,1,640,480);
817 if(flashamount>1)flashamount=1;
818 if(flashdelay<=0)flashamount-=multiplier;
820 if(flashamount<0)flashamount=0;
821 glDisable(GL_DEPTH_TEST); // Disables Depth Testing
822 glDisable(GL_CULL_FACE);
823 glDisable(GL_LIGHTING);
824 glDisable(GL_TEXTURE_2D);
826 glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
827 glPushMatrix(); // Store The Projection Matrix
828 glLoadIdentity(); // Reset The Projection Matrix
829 glOrtho(0,screenwidth,0,screenheight,-100,100); // Set Up An Ortho Screen
830 glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
831 glPushMatrix(); // Store The Modelview Matrix
832 glLoadIdentity(); // Reset The Modelview Matrix
833 glScalef(screenwidth,screenheight,1);
834 glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
836 glColor4f(flashr,flashg,flashb,flashamount);
838 glVertex3f(0, 0, 0.0f);
839 glVertex3f(256, 0, 0.0f);
840 glVertex3f(256, 256, 0.0f);
841 glVertex3f(0, 256, 0.0f);
843 glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
844 glPopMatrix(); // Restore The Old Projection Matrix
845 glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
846 glPopMatrix(); // Restore The Old Projection Matrix
847 glEnable(GL_DEPTH_TEST); // Enables Depth Testing
848 glEnable(GL_CULL_FACE);
858 void Game::FadeLoadingScreen(float howmuch)
860 static float loadprogress,minprogress,maxprogress;
865 glClearColor(0,0,0,1);
866 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
868 loadprogress=howmuch;
870 //loadprogress=abs(Random()%100);
874 //glEnable(GL_TEXTURE_2D);
875 glDisable(GL_TEXTURE_2D);
876 //glBindTexture( GL_TEXTURE_2D, loadscreentexture);
877 glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE );
878 glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE );
879 glDisable(GL_DEPTH_TEST); // Disables Depth Testing
880 glDisable(GL_CULL_FACE);
881 glDisable(GL_LIGHTING);
883 glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
884 glPushMatrix(); // Store The Projection Matrix
885 glLoadIdentity(); // Reset The Projection Matrix
886 glOrtho(0,screenwidth,0,screenheight,-100,100); // Set Up An Ortho Screen
887 glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
888 glPushMatrix(); // Store The Modelview Matrix
889 glLoadIdentity(); // Reset The Modelview Matrix
890 glTranslatef(screenwidth/2,screenheight/2,0);
891 glScalef((float)screenwidth/2,(float)screenheight/2,1);
892 glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
894 glColor4f(loadprogress/100,0,0,1);
895 /*if(loadscreencolor==0)glColor4f(1,1,1,1);
896 if(loadscreencolor==1)glColor4f(1,0,0,1);
897 if(loadscreencolor==2)glColor4f(0,1,0,1);
898 if(loadscreencolor==3)glColor4f(0,0,1,1);
899 if(loadscreencolor==4)glColor4f(1,1,0,1);
900 if(loadscreencolor==5)glColor4f(1,0,1,1);
903 //glScalef(.25,.25,.25);
906 glVertex3f(-1, -1, 0.0f);
908 glVertex3f(1, -1, 0.0f);
910 glVertex3f(1, 1, 0.0f);
912 glVertex3f(-1, 1, 0.0f);
915 glDisable(GL_TEXTURE_2D);
916 glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
917 glPopMatrix(); // Restore The Old Projection Matrix
918 glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
919 glPopMatrix(); // Restore The Old Projection Matrix
924 glEnable(GL_TEXTURE_2D);
925 static char string[256]="";
926 sprintf (string, "LOADING... %d%",(int)loadprogress);
928 text.glPrint(280-280*loadprogress/100/2/4,125-125*loadprogress/100/2/4,string,1,1+loadprogress/100,640,480);
929 glColor4f(1.2-loadprogress/100,1.2-loadprogress/100,1.2-loadprogress/100,1);
930 text.glPrint(280,125,string,1,1,640,480);
937 void Game::InitGame()
940 ProcessSerialNumber PSN;
941 ProcessInfoRec pinfo;
944 /* set up process serial number */
945 PSN.highLongOfPSN = 0;
946 PSN.lowLongOfPSN = kCurrentProcess;
947 /* set up info block */
948 pinfo.processInfoLength = sizeof(pinfo);
949 pinfo.processName = NULL;
950 pinfo.processAppSpec = &pspec;
951 /* grab the vrefnum and directory */
952 err = GetProcessInformation(&PSN, &pinfo);
954 vRefNum = pspec.vRefNum;
965 numchallengelevels=14;
969 /*char tempstring[256];
970 sprintf (tempstring, "%s", registrationname);
976 longnum = MD5_string ( tempstring);
977 //longnum = 1111111111111111;
978 num1 = longnum/100000000;
979 num2 = longnum%100000000;
980 sprintf (tempstring, "%d-%d-%d-%d", num1/10000, num1%10000, num2/10000, num2%10000);
984 tfile=fopen( ":Data:Sounds:flame.ogg", "rb" );
995 funpackf(tfile, "Bb", ®istered);
998 funpackf(tfile, "Bi", &numchars);
1001 for(j=0;j<numchars;j++)
1003 funpackf(tfile, "Bb", ®istrationname[j]);
1005 registrationname[numchars]='\0';
1006 funpackf(tfile, "Bi", &num1);
1007 funpackf(tfile, "Bi", &num2);
1008 longnum=num2+num1*100000000;
1010 char tempstring[256];
1011 sprintf (tempstring, "%s-windows", registrationname);
1012 longnuma = MD5_string ( tempstring);
1013 num1a = longnuma/100000000;
1014 num2a = longnuma%100000000;
1015 //if(num1a==num1&&num2a==num2)registered=1;
1016 if(numchars>2)registered=1;
1026 sprintf (mapname, ":Data:Users");
1027 tfile=fopen( mapname, "rb" );
1030 funpackf(tfile, "Bi", &numaccounts);
1031 funpackf(tfile, "Bi", &accountactive);
1034 for(i=0;i<numaccounts;i++)
1036 funpackf(tfile, "Bf", &accountcampaigntime[i]);
1037 funpackf(tfile, "Bf", &accountcampaignscore[i]);
1038 funpackf(tfile, "Bf", &accountcampaignfasttime[i]);
1039 funpackf(tfile, "Bf", &accountcampaignhighscore[i]);
1040 funpackf(tfile, "Bi", &accountdifficulty[i]);
1041 funpackf(tfile, "Bi", &accountprogress[i]);
1042 funpackf(tfile, "Bi", &accountcampaignchoicesmade[i]);
1043 for(j=0;j<accountcampaignchoicesmade[i];j++)
1045 funpackf(tfile, "Bi", &accountcampaignchoices[i][j]);
1046 if (accountcampaignchoices[i][j] >= 10)
1048 accountcampaignchoices[i][j] = 0;
1051 funpackf(tfile, "Bf", &accountpoints[i]);
1054 funpackf(tfile, "Bf", &accounthighscore[i][j]);
1055 funpackf(tfile, "Bf", &accountfasttime[i][j]);
1059 funpackf(tfile, "Bb", &accountunlocked[i][j]);
1062 funpackf(tfile, "Bi", &temp);
1067 funpackf(tfile, "Bb", &accountname[i][j]);
1080 whichjointstartarray[0]=righthip;
1081 whichjointendarray[0]=rightfoot;
1083 whichjointstartarray[1]=righthip;
1084 whichjointendarray[1]=rightankle;
1086 whichjointstartarray[2]=righthip;
1087 whichjointendarray[2]=rightknee;
1089 whichjointstartarray[3]=rightknee;
1090 whichjointendarray[3]=rightankle;
1092 whichjointstartarray[4]=rightankle;
1093 whichjointendarray[4]=rightfoot;
1095 whichjointstartarray[5]=lefthip;
1096 whichjointendarray[5]=leftfoot;
1098 whichjointstartarray[6]=lefthip;
1099 whichjointendarray[6]=leftankle;
1101 whichjointstartarray[7]=lefthip;
1102 whichjointendarray[7]=leftknee;
1104 whichjointstartarray[8]=leftknee;
1105 whichjointendarray[8]=leftankle;
1107 whichjointstartarray[9]=leftankle;
1108 whichjointendarray[9]=leftfoot;
1110 whichjointstartarray[10]=abdomen;
1111 whichjointendarray[10]=rightshoulder;
1113 whichjointstartarray[11]=abdomen;
1114 whichjointendarray[11]=rightelbow;
1116 whichjointstartarray[12]=abdomen;
1117 whichjointendarray[12]=rightwrist;
1119 whichjointstartarray[13]=abdomen;
1120 whichjointendarray[13]=righthand;
1122 whichjointstartarray[14]=rightshoulder;
1123 whichjointendarray[14]=rightelbow;
1125 whichjointstartarray[15]=rightelbow;
1126 whichjointendarray[15]=rightwrist;
1128 whichjointstartarray[16]=rightwrist;
1129 whichjointendarray[16]=righthand;
1131 whichjointstartarray[17]=abdomen;
1132 whichjointendarray[17]=leftshoulder;
1134 whichjointstartarray[18]=abdomen;
1135 whichjointendarray[18]=leftelbow;
1137 whichjointstartarray[19]=abdomen;
1138 whichjointendarray[19]=leftwrist;
1140 whichjointstartarray[20]=abdomen;
1141 whichjointendarray[20]=lefthand;
1143 whichjointstartarray[21]=leftshoulder;
1144 whichjointendarray[21]=leftelbow;
1146 whichjointstartarray[22]=leftelbow;
1147 whichjointendarray[22]=leftwrist;
1149 whichjointstartarray[23]=leftwrist;
1150 whichjointendarray[23]=lefthand;
1152 whichjointstartarray[24]=abdomen;
1153 whichjointendarray[24]=neck;
1155 whichjointstartarray[25]=neck;
1156 whichjointendarray[25]=head;
1158 FadeLoadingScreen(0);
1162 texture.data = ( GLubyte* )malloc( 1024*1024*4 );
1164 int temptexdetail=texdetail;
1166 text.LoadFontTexture(":Data:Textures:Font.png");
1168 texdetail=temptexdetail;
1170 FadeLoadingScreen(10);
1186 for (int it = 0; it < 100; ++it)
1191 for (int it = 0; it < 20; ++it)
1196 LOG("Initializing sound system...");
1201 extern bool cmdline(const char *cmd);
1202 unsigned char rc = 0;
1203 output = FSOUND_OUTPUT_ALSA; // Try alsa first...
1204 if (cmdline("forceoss")) // ...but let user override that.
1205 output = FSOUND_OUTPUT_OSS;
1206 else if (cmdline("nosound"))
1207 output = FSOUND_OUTPUT_NOSOUND;
1209 FSOUND_SetOutput(output);
1210 if ((rc = FSOUND_Init(44100, 32, 0)) == FALSE)
1212 // if we tried ALSA and failed, fall back to OSS.
1213 if ( (output == FSOUND_OUTPUT_ALSA) && (!cmdline("forcealsa")) )
1216 output = FSOUND_OUTPUT_OSS;
1217 FSOUND_SetOutput(output);
1218 rc = FSOUND_Init(44100, 32, 0);
1225 output = FSOUND_OUTPUT_NOSOUND; // we tried! just do silence.
1226 FSOUND_SetOutput(output);
1227 rc = FSOUND_Init(44100, 32, 0);
1230 FSOUND_Init(44100, 32, 0);
1233 FSOUND_SetSFXMasterVolume((int)(volume*255));
1235 strm[stream_music3] = FSOUND_Stream_Open(ConvertFileName(":Data:Sounds:music3.mp3"), FSOUND_2D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=0;}
1236 // FSOUND_Sample_SetMinMaxDistance(strm[stream_music3], 4.0f, 1000.0f);
1237 FSOUND_Stream_SetMode(strm[stream_music3], FSOUND_LOOP_NORMAL);
1240 // PlaySoundEx( stream_music3, strm[stream_music3], NULL, TRUE);
1241 PlayStreamEx(stream_music3, strm[stream_music3], 0, TRUE);
1242 FSOUND_SetPaused(channels[stream_music3], FALSE);
1243 FSOUND_SetVolume(channels[stream_music3], 256);
1246 FadeLoadingScreen(20);
1249 strm[stream_wind] = FSOUND_Stream_Open(ConvertFileName(":Data:Sounds:wind.mp3"), FSOUND_2D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
1250 // FSOUND_Sample_SetMinMaxDistance(strm[stream_wind], 4.0f, 1000.0f);
1251 FSOUND_Stream_SetMode(strm[stream_wind], FSOUND_LOOP_NORMAL);
1253 FadeLoadingScreen(30);
1255 strm[stream_desertambient] = FSOUND_Stream_Open(ConvertFileName(":Data:Sounds:desertambient.mp3"), FSOUND_2D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
1256 // FSOUND_Sample_SetMinMaxDistance(strm[stream_desertambient], 4.0f, 1000.0f);
1257 FSOUND_Stream_SetMode(strm[stream_desertambient], FSOUND_LOOP_NORMAL);
1260 FadeLoadingScreen(40);
1262 samp[firestartsound] = FSOUND_Sample_Load(FSOUND_FREE, ConvertFileName(":Data:Sounds:firestart.ogg"), FSOUND_2D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
1263 FSOUND_Sample_SetMinMaxDistance(samp[firestartsound], 8.0f, 2000.0f);
1265 strm[stream_firesound] = FSOUND_Stream_Open(":Data:Sounds:fire.ogg", FSOUND_2D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
1266 // FSOUND_Sample_SetMinMaxDistance(strm[stream_firesound], 8.0f, 2000.0f);
1267 FSOUND_Stream_SetMode(strm[stream_firesound], FSOUND_LOOP_NORMAL);
1269 FadeLoadingScreen(50);
1271 samp[fireendsound] = FSOUND_Sample_Load(FSOUND_FREE, ConvertFileName(":Data:Sounds:fireend.ogg"), FSOUND_2D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
1272 FSOUND_Sample_SetMinMaxDistance(samp[fireendsound], 8.0f, 2000.0f);
1275 strm[stream_music1grass] = FSOUND_Stream_Open(ConvertFileName(":Data:Sounds:music1grass.mp3"), FSOUND_2D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=1;}
1276 // FSOUND_Sample_SetMinMaxDistance(strm[stream_music1grass], 4.0f, 1000.0f);
1277 FSOUND_Stream_SetMode(strm[stream_music1grass], FSOUND_LOOP_NORMAL);
1279 strm[stream_music1snow] = FSOUND_Stream_Open(ConvertFileName(":Data:Sounds:music1snow.mp3"), FSOUND_2D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=2;}
1280 // FSOUND_Sample_SetMinMaxDistance(strm[stream_music1snow], 4.0f, 1000.0f);
1281 FSOUND_Stream_SetMode(strm[stream_music1snow], FSOUND_LOOP_NORMAL);
1283 FadeLoadingScreen(60);
1285 strm[stream_music1desert] = FSOUND_Stream_Open(ConvertFileName(":Data:Sounds:music1desert.mp3"), FSOUND_2D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=3;}
1286 // FSOUND_Sample_SetMinMaxDistance(strm[stream_music1desert], 4.0f, 1000.0f);
1287 FSOUND_Stream_SetMode(strm[stream_music1desert], FSOUND_LOOP_NORMAL);
1289 FadeLoadingScreen(80);
1290 strm[stream_music2] = FSOUND_Stream_Open(ConvertFileName(":Data:Sounds:music2.ogg"), FSOUND_2D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=4;}
1291 // FSOUND_Sample_SetMinMaxDistance(strm[stream_music2], 4.0f, 1000.0f);
1292 FSOUND_Stream_SetMode(strm[stream_music2], FSOUND_LOOP_NORMAL);
1297 FadeLoadingScreen(90);
1300 LoadTexture(":Data:Textures:Cursor.png",&cursortexture,0,1);
1302 LoadTexture(":Data:Textures:MapCircle.png",&Mapcircletexture,0,1);
1303 LoadTexture(":Data:Textures:MapBox.png",&Mapboxtexture,0,1);
1304 LoadTexture(":Data:Textures:MapArrow.png",&Maparrowtexture,0,1);
1306 temptexdetail=texdetail;
1307 if(texdetail>2)texdetail=2;
1308 LoadTexture(":Data:Textures:Lugaru.png",&Mainmenuitems[0],0,0);
1309 LoadTexture(":Data:Textures:Newgame.png",&Mainmenuitems[1],0,0);
1310 LoadTexture(":Data:Textures:Options.png",&Mainmenuitems[2],0,0);
1311 LoadTexture(":Data:Textures:Quit.png",&Mainmenuitems[3],0,0);
1312 LoadTexture(":Data:Textures:World.png",&Mainmenuitems[7],0,0);
1313 LoadTexture(":Data:Textures:Eyelid.png",&Mainmenuitems[4],0,1);
1314 //LoadTexture(":Data:Textures:Eye.jpg",&Mainmenuitems[5],0,1);
1315 texdetail=temptexdetail;
1320 FadeLoadingScreen(95);
1331 newscreenwidth=screenwidth;
1332 newscreenheight=screenheight;
1337 float gLoc[3]={0,0,0};
1338 float vel[3]={0,0,0};
1339 FSOUND_Sample_SetMinMaxDistance(samp[firestartsound], 9999.0f, 99999.0f);
1340 PlaySoundEx( firestartsound, samp[firestartsound], NULL, TRUE);
1341 FSOUND_3D_SetAttributes(channels[firestartsound], gLoc, vel);
1342 FSOUND_SetVolume(channels[firestartsound], 256);
1343 FSOUND_SetPaused(channels[firestartsound], FALSE);
1344 FSOUND_Sample_SetMinMaxDistance(samp[firestartsound], 8.0f, 2000.0f);
1355 void Game::LoadStuff()
1357 static float temptexdetail;
1358 static float viewdistdetail;
1359 static int i,j,texsize;
1366 /*musicvolume[3]=512;
1367 PlaySoundEx( music4, samp[music4], NULL, TRUE);
1368 FSOUND_SetPaused(channels[music4], FALSE);
1369 FSOUND_SetVolume(channels[music4], 512);
1375 //texture.data = ( GLubyte* )malloc( 1024*1024*4 );
1379 for(i=0;i<maxplayers;i++)
1381 if (glIsTexture(player[i].skeleton.drawmodel.textureptr))
1383 glDeleteTextures(1, &player[i].skeleton.drawmodel.textureptr);
1385 player[i].skeleton.drawmodel.textureptr=0;;
1388 //temptexdetail=texdetail;
1391 LoadTexture(":Data:Textures:fire.jpg",&loadscreentexture,1,0);
1392 //texdetail=temptexdetail;
1394 temptexdetail=texdetail;
1396 text.LoadFontTexture(":Data:Textures:Font.png");
1398 texdetail=temptexdetail;
1403 viewdistance=50*megascale*viewdistdetail;
1423 realtexdetail=texdetail;
1426 if(texdetail<1)texdetail=1;
1427 realtexdetail=texdetail*4;
1433 /*LoadTexture(":Data:Textures:snow.png",&terraintexture,1);
1435 LoadTexture(":Data:Textures:rock.png",&terraintexture2,1);
1437 LoadTexture(":Data:Textures:detail.png",&terraintexture3,1);
1441 LOG("Loading weapon data...");
1443 LoadTexture(":Data:Textures:knife.png",&weapons.knifetextureptr,0,1);
1444 LoadTexture(":Data:Textures:bloodknife.png",&weapons.bloodknifetextureptr,0,1);
1445 LoadTexture(":Data:Textures:lightbloodknife.png",&weapons.lightbloodknifetextureptr,0,1);
1446 LoadTexture(":Data:Textures:sword.jpg",&weapons.swordtextureptr,1,0);
1447 LoadTexture(":Data:Textures:Swordblood.jpg",&weapons.bloodswordtextureptr,1,0);
1448 LoadTexture(":Data:Textures:Swordbloodlight.jpg",&weapons.lightbloodswordtextureptr,1,0);
1449 LoadTexture(":Data:Textures:Staff.jpg",&weapons.stafftextureptr,1,0);
1451 weapons.throwingknifemodel.load((char *)":Data:Models:throwingknife.solid",1);
1452 weapons.throwingknifemodel.Scale(.001,.001,.001);
1453 //weapons.throwingknifemodel.Rotate(0,0,-90);
1454 weapons.throwingknifemodel.Rotate(90,0,0);
1455 weapons.throwingknifemodel.Rotate(0,90,0);
1456 weapons.throwingknifemodel.flat=0;
1457 weapons.throwingknifemodel.CalculateNormals(1);
1458 //weapons.throwingknifemodel.ScaleNormals(-1,-1,-1);
1460 weapons.swordmodel.load((char *)":Data:Models:sword.solid",1);
1461 weapons.swordmodel.Scale(.001,.001,.001);
1462 //weapons.swordmodel.Rotate(0,0,-90);
1463 weapons.swordmodel.Rotate(90,0,0);
1464 weapons.swordmodel.Rotate(0,90,0);
1465 weapons.swordmodel.Rotate(0,0,90);
1466 weapons.swordmodel.flat=1;
1467 weapons.swordmodel.CalculateNormals(1);
1468 //weapons.swordmodel.ScaleNormals(-1,-1,-1);
1470 weapons.staffmodel.load((char *)":Data:Models:staff.solid",1);
1471 weapons.staffmodel.Scale(.005,.005,.005);
1472 //weapons.staffmodel.Rotate(0,0,-90);
1473 weapons.staffmodel.Rotate(90,0,0);
1474 weapons.staffmodel.Rotate(0,90,0);
1475 weapons.staffmodel.Rotate(0,0,90);
1476 weapons.staffmodel.flat=1;
1477 weapons.staffmodel.CalculateNormals(1);
1478 //weapons.staffmodel.ScaleNormals(-1,-1,-1);
1480 //temptexdetail=texdetail;
1481 //if(texdetail>4)texdetail=4;
1482 LoadTexture(":Data:Textures:shadow.png",&terrain.shadowtexture,0,1);
1484 LoadTexture(":Data:Textures:blood.png",&terrain.bloodtexture,0,1);
1486 LoadTexture(":Data:Textures:break.png",&terrain.breaktexture,0,1);
1488 LoadTexture(":Data:Textures:blood.png",&terrain.bloodtexture2,0,1);
1491 LoadTexture(":Data:Textures:footprint.png",&terrain.footprinttexture,0,1);
1493 LoadTexture(":Data:Textures:bodyprint.png",&terrain.bodyprinttexture,0,1);
1495 /*LoadTexture(":Data:Textures:cloud.png",&sprites.cloudtexture,1);
1497 LoadTexture(":Data:Textures:cloudimpact.png",&sprites.cloudimpacttexture,1);
1499 LoadTexture(":Data:Textures:bloodparticle.png",&sprites.bloodtexture,1);
1501 LoadTexture(":Data:Textures:snowflake.png",&sprites.snowflaketexture,1);
1503 LoadTexture(":Data:Textures:flame.png",&sprites.flametexture,1);
1505 LoadTexture(":Data:Textures:smoke.png",&sprites.smoketexture,1);
1506 //texdetail=temptexdetail;
1507 LoadTexture(":Data:Textures:shine.png",&sprites.shinetexture,1);*/
1511 LoadTexture(":Data:Textures:hawk.png",&hawktexture,0,1);
1513 LoadTexture(":Data:Textures:logo.png",&logotexture,0,1);
1516 //LoadTexture(":Data:Textures:box.jpg",&objects.boxtextureptr,1,0);
1519 LoadTexture(":Data:Textures:cloud.png",&sprites.cloudtexture,1,1);
1520 LoadTexture(":Data:Textures:cloudimpact.png",&sprites.cloudimpacttexture,1,1);
1521 LoadTexture(":Data:Textures:bloodparticle.png",&sprites.bloodtexture,1,1);
1522 LoadTexture(":Data:Textures:snowflake.png",&sprites.snowflaketexture,1,1);
1523 LoadTexture(":Data:Textures:flame.png",&sprites.flametexture,1,1);
1524 LoadTexture(":Data:Textures:bloodflame.png",&sprites.bloodflametexture,1,1);
1525 LoadTexture(":Data:Textures:smoke.png",&sprites.smoketexture,1,1);
1526 LoadTexture(":Data:Textures:shine.png",&sprites.shinetexture,1,0);
1527 LoadTexture(":Data:Textures:splinter.png",&sprites.splintertexture,1,1);
1528 LoadTexture(":Data:Textures:leaf.png",&sprites.leaftexture,1,1);
1529 LoadTexture(":Data:Textures:tooth.png",&sprites.toothtexture,1,1);
1533 ReSizeGLScene(90,.01);
1540 if(detail)kTextureSize=1024;
1541 if(detail==1)kTextureSize=512;
1542 if(detail==0)kTextureSize=256;
1545 //drawmode=motionblurmode;
1547 //Set up distant light
1551 light.ambient[0]=.2;
1552 light.ambient[1]=.2;
1553 light.ambient[2]=.24;
1556 light.location.z=-.2;
1557 Normalise(&light.location);
1567 texscale=.2/megascale/viewdistdetail;
1568 terrain.scale=3*megascale*terraindetail*viewdistdetail;
1570 viewer.x=terrain.size/2*terrain.scale;
1571 viewer.z=terrain.size/2*terrain.scale;
1573 hawk.load((char *)":Data:Models:hawk.solid",1);
1574 hawk.Scale(.03,.03,.03);
1575 hawk.Rotate(90,1,1);
1576 hawk.CalculateNormals(0);
1577 hawk.ScaleNormals(-1,-1,-1);
1578 hawkcoords.x=terrain.size/2*terrain.scale-5-7;
1579 hawkcoords.z=terrain.size/2*terrain.scale-5-7;
1580 hawkcoords.y=terrain.getHeight(hawkcoords.x,hawkcoords.z)+25;
1583 eye.load((char *)":Data:Models:eye.solid",1);
1584 eye.Scale(.03,.03,.03);
1585 eye.CalculateNormals(0);
1587 cornea.load((char *)":Data:Models:cornea.solid",1);
1588 cornea.Scale(.03,.03,.03);
1589 cornea.CalculateNormals(0);
1591 iris.load((char *)":Data:Models:iris.solid",1);
1592 iris.Scale(.03,.03,.03);
1593 iris.CalculateNormals(0);
1595 LoadSave(":Data:Textures:Bloodfur.png",0,1,&bloodText[0],0);
1596 LoadSave(":Data:Textures:Wolfbloodfur.png",0,1,&wolfbloodText[0],0);
1604 //if(targetlevel!=7)
1605 Loadlevel(targetlevel);
1608 rabbitcoords=player[0].coords;
1609 rabbitcoords.y=terrain.getHeight(rabbitcoords.x,rabbitcoords.z);
1611 animation[runanim].Load((char *)":Data:Animations:Run",middleheight,neutral);
1613 animation[bounceidleanim].Load((char *)":Data:Animations:Idle",middleheight,neutral);
1614 animation[stopanim].Load((char *)":Data:Animations:Stop",middleheight,neutral);
1616 animation[jumpupanim].Load((char *)":Data:Animations:JumpUp",highheight,neutral);
1617 animation[jumpdownanim].Load((char *)":Data:Animations:JumpDown",highheight,neutral);
1619 animation[landanim].Load((char *)":Data:Animations:Landing",lowheight,neutral);
1620 animation[landhardanim].Load((char *)":Data:Animations:Landhard",lowheight,neutral);
1621 animation[climbanim].Load((char *)":Data:Animations:Climb",lowheight,neutral);
1622 animation[hanganim].Load((char *)":Data:Animations:Hangon",lowheight,neutral);
1623 animation[spinkickanim].Load((char *)":Data:Animations:SpinKick",middleheight,normalattack);
1625 animation[getupfromfrontanim].Load((char *)":Data:Animations:GetUpFromFront",lowheight,neutral);
1626 animation[getupfrombackanim].Load((char *)":Data:Animations:GetUpFromBack",lowheight,neutral);
1627 animation[crouchanim].Load((char *)":Data:Animations:Crouch",lowheight,neutral);
1628 animation[sneakanim].Load((char *)":Data:Animations:Sneak",lowheight,neutral);
1629 animation[rollanim].Load((char *)":Data:Animations:Roll",lowheight,neutral);
1630 animation[flipanim].Load((char *)":Data:Animations:Flip",highheight,neutral);
1631 animation[frontflipanim].Load((char *)":Data:Animations:Flip",highheight,neutral);
1632 animation[spinkickreversedanim].Load((char *)":Data:Animations:SpinKickCaught",middleheight,reversed);
1634 animation[spinkickreversalanim].Load((char *)":Data:Animations:SpinKickCatch",middleheight,reversal);
1635 animation[lowkickanim].Load((char *)":Data:Animations:lowkick",middleheight,normalattack);
1636 animation[sweepanim].Load((char *)":Data:Animations:sweep",lowheight,normalattack);
1637 animation[sweepreversedanim].Load((char *)":Data:Animations:SweepCaught",lowheight,reversed);
1638 animation[sweepreversalanim].Load((char *)":Data:Animations:SweepCatch",middleheight,reversal);
1639 animation[rabbitkickanim].Load((char *)":Data:Animations:RabbitKick",middleheight,normalattack);
1640 animation[rabbitkickreversedanim].Load((char *)":Data:Animations:RabbitKickCaught",middleheight,reversed);
1641 animation[rabbitkickreversalanim].Load((char *)":Data:Animations:RabbitKickCatch",lowheight,reversal);
1642 animation[upunchanim].Load((char *)":Data:Animations:Upunch",middleheight,normalattack);
1643 animation[staggerbackhighanim].Load((char *)":Data:Animations:Staggerbackhigh",middleheight,neutral);
1644 animation[upunchreversedanim].Load((char *)":Data:Animations:UpunchCaught",middleheight,reversed);
1646 animation[upunchreversalanim].Load((char *)":Data:Animations:UpunchCatch",middleheight,reversal);
1647 animation[hurtidleanim].Load((char *)":Data:Animations:Hurtidle",middleheight,neutral);
1648 animation[backhandspringanim].Load((char *)":Data:Animations:Backhandspring",middleheight,neutral);
1649 animation[fightidleanim].Load((char *)":Data:Animations:Fightidle",middleheight,neutral);
1650 animation[walkanim].Load((char *)":Data:Animations:Walk",middleheight,neutral);
1652 animation[fightsidestep].Load((char *)":Data:Animations:Fightsidestep",middleheight,neutral);
1653 animation[killanim].Load((char *)":Data:Animations:Kill",middleheight,normalattack);
1654 animation[sneakattackanim].Load((char *)":Data:Animations:Sneakattack",middleheight,reversal);
1655 animation[sneakattackedanim].Load((char *)":Data:Animations:Sneakattacked",middleheight,reversed);
1656 animation[drawrightanim].Load((char *)":Data:Animations:drawright",middleheight,neutral);
1657 animation[knifeslashstartanim].Load((char *)":Data:Animations:slashstart",middleheight,normalattack);
1658 animation[crouchdrawrightanim].Load((char *)":Data:Animations:crouchdrawright",lowheight,neutral);
1659 animation[crouchstabanim].Load((char *)":Data:Animations:crouchstab",lowheight,normalattack);
1661 animation[knifefollowanim].Load((char *)":Data:Animations:slashfollow",middleheight,reversal);
1662 animation[knifefollowedanim].Load((char *)":Data:Animations:slashfollowed",middleheight,reversed);
1663 animation[knifethrowanim].Load((char *)":Data:Animations:knifethrow",middleheight,normalattack);
1664 animation[removeknifeanim].Load((char *)":Data:Animations:removeknife",middleheight,neutral);
1665 animation[crouchremoveknifeanim].Load((char *)":Data:Animations:crouchremoveknife",lowheight,neutral);
1666 animation[jumpreversedanim].Load((char *)":Data:Animations:JumpCaught",middleheight,reversed);
1667 animation[jumpreversalanim].Load((char *)":Data:Animations:JumpCatch",middleheight,reversal);
1668 animation[staggerbackhardanim].Load((char *)":Data:Animations:Staggerbackhard",middleheight,neutral);
1670 animation[dropkickanim].Load((char *)":Data:Animations:Dropkick",middleheight,normalattack);
1671 animation[winduppunchanim].Load((char *)":Data:Animations:Winduppunch",middleheight,normalattack);
1672 animation[winduppunchblockedanim].Load((char *)":Data:Animations:Winduppunchblocked",middleheight,normalattack);
1673 animation[blockhighleftanim].Load((char *)":Data:Animations:Blockhighleft",middleheight,normalattack);
1674 animation[blockhighleftstrikeanim].Load((char *)":Data:Animations:Blockhighleftstrike",middleheight,normalattack);
1675 animation[backflipanim].Load((char *)":Data:Animations:Backflip",highheight,neutral);
1676 animation[walljumpbackanim].Load((char *)":Data:Animations:Walljumpback",highheight,neutral);
1677 animation[walljumpfrontanim].Load((char *)":Data:Animations:Walljumpfront",highheight,neutral);
1678 animation[rightflipanim].Load((char *)":Data:Animations:Rightflip",highheight,neutral);
1679 animation[walljumprightanim].Load((char *)":Data:Animations:Walljumpright",highheight,neutral);
1680 animation[leftflipanim].Load((char *)":Data:Animations:Leftflip",highheight,neutral);
1681 animation[walljumpleftanim].Load((char *)":Data:Animations:Walljumpleft",highheight,neutral);
1682 animation[walljumprightkickanim].Load((char *)":Data:Animations:Walljumprightkick",highheight,neutral);
1683 animation[walljumpleftkickanim].Load((char *)":Data:Animations:Walljumpleftkick",highheight,neutral);
1684 animation[knifefightidleanim].Load((char *)":Data:Animations:Knifefightidle",middleheight,neutral);
1685 animation[knifesneakattackanim].Load((char *)":Data:Animations:Knifesneakattack",middleheight,reversal);
1686 animation[knifesneakattackedanim].Load((char *)":Data:Animations:Knifesneakattacked",middleheight,reversed);
1687 animation[swordfightidleanim].Load((char *)":Data:Animations:swordfightidle",middleheight,neutral);
1688 animation[drawleftanim].Load((char *)":Data:Animations:drawleft",middleheight,neutral);
1689 animation[swordslashanim].Load((char *)":Data:Animations:swordslash",middleheight,normalattack);
1690 animation[swordgroundstabanim].Load((char *)":Data:Animations:swordgroundstab",lowheight,normalattack);
1691 animation[dodgebackanim].Load((char *)":Data:Animations:dodgeback",middleheight,neutral);
1692 animation[swordsneakattackanim].Load((char *)":Data:Animations:Swordsneakattack",middleheight,reversal);
1693 animation[swordsneakattackedanim].Load((char *)":Data:Animations:Swordsneakattacked",middleheight,reversed);
1694 animation[swordslashreversedanim].Load((char *)":Data:Animations:swordslashCaught",middleheight,reversed);
1695 animation[swordslashreversalanim].Load((char *)":Data:Animations:swordslashCatch",middleheight,reversal);
1696 animation[knifeslashreversedanim].Load((char *)":Data:Animations:knifeslashCaught",middleheight,reversed);
1697 animation[knifeslashreversalanim].Load((char *)":Data:Animations:knifeslashCatch",middleheight,reversal);
1698 animation[swordfightidlebothanim].Load((char *)":Data:Animations:swordfightidleboth",middleheight,neutral);
1699 animation[swordslashparryanim].Load((char *)":Data:Animations:sworduprightparry",middleheight,normalattack);
1700 animation[swordslashparriedanim].Load((char *)":Data:Animations:swordslashparried",middleheight,normalattack);
1701 animation[wolfidle].Load((char *)":Data:Animations:Wolfidle",middleheight,neutral);
1702 animation[wolfcrouchanim].Load((char *)":Data:Animations:Wolfcrouch",lowheight,neutral);
1703 animation[wolflandanim].Load((char *)":Data:Animations:Wolflanding",lowheight,neutral);
1704 animation[wolflandhardanim].Load((char *)":Data:Animations:Wolflandhard",lowheight,neutral);
1705 animation[wolfrunanim].Load((char *)":Data:Animations:Wolfrun",middleheight,neutral);
1706 animation[wolfrunninganim].Load((char *)":Data:Animations:Wolfrunning",middleheight,neutral);
1707 animation[rabbitrunninganim].Load((char *)":Data:Animations:Rabbitrunning",middleheight,neutral);
1708 animation[wolfstopanim].Load((char *)":Data:Animations:Wolfstop",middleheight,neutral);
1709 animation[rabbittackleanim].Load((char *)":Data:Animations:Rabbittackle",middleheight,neutral);
1710 animation[rabbittacklinganim].Load((char *)":Data:Animations:Rabbittackling",middleheight,reversal);
1711 animation[rabbittackledbackanim].Load((char *)":Data:Animations:Rabbittackledback",middleheight,reversed);
1712 animation[rabbittackledfrontanim].Load((char *)":Data:Animations:Rabbittackledfront",middleheight,reversed);
1713 animation[wolfslapanim].Load((char *)":Data:Animations:Wolfslap",middleheight,normalattack);
1714 animation[staffhitanim].Load((char *)":Data:Animations:StaffHit",middleheight,normalattack);
1715 animation[staffgroundsmashanim].Load((char *)":Data:Animations:StaffGroundSmash",lowheight,normalattack);
1716 animation[staffspinhitanim].Load((char *)":Data:Animations:Spinwhack",middleheight,normalattack);
1717 animation[staffhitreversedanim].Load((char *)":Data:Animations:StaffHitCaught",middleheight,reversed);
1718 animation[staffhitreversalanim].Load((char *)":Data:Animations:StaffHitCatch",middleheight,reversal);
1719 animation[staffspinhitreversedanim].Load((char *)":Data:Animations:SpinWhackCaught",middleheight,reversed);
1720 animation[staffspinhitreversalanim].Load((char *)":Data:Animations:SpinWhackCatch",middleheight,reversal);
1722 animation[sitanim].Load((char *)":Data:Animations:Sit",lowheight,neutral);
1723 animation[sleepanim].Load((char *)":Data:Animations:Sleep",lowheight,neutral);
1724 animation[talkidleanim].Load((char *)":Data:Animations:TalkIdle",middleheight,neutral);
1726 animation[sitwallanim].Load((char *)":Data:Animations:Dying",lowheight,neutral);
1727 animation[dead1anim].Load((char *)":Data:Animations:Dead1",lowheight,neutral);
1728 animation[dead2anim].Load((char *)":Data:Animations:Dead2",lowheight,neutral);
1729 animation[dead3anim].Load((char *)":Data:Animations:Dead3",lowheight,neutral);
1730 animation[dead4anim].Load((char *)":Data:Animations:Dead4",lowheight,neutral);
1731 //Fix knife stab, too lazy to do it manually
1735 for(i=0;i<player[0].skeleton.num_joints;i++){
1736 for(j=0;j<animation[knifesneakattackanim].numframes;j++){
1737 animation[knifesneakattackanim].position[i][j]+=moveamount;
1744 for(i=0;i<player[0].skeleton.num_joints;i++){
1745 for(j=0;j<animation[knifesneakattackedanim].numframes;j++){
1746 animation[knifesneakattackedanim].position[i][j]+=moveamount;
1753 for(i=0;i<player[0].skeleton.num_joints;i++){
1754 animation[dead1anim].position[i][1]=animation[dead1anim].position[i][0];
1755 animation[dead2anim].position[i][1]=animation[dead2anim].position[i][0];
1756 animation[dead3anim].position[i][1]=animation[dead3anim].position[i][0];
1757 animation[dead4anim].position[i][1]=animation[dead4anim].position[i][0];
1759 animation[dead1anim].speed[0]=0.001;
1760 animation[dead2anim].speed[0]=0.001;
1761 animation[dead3anim].speed[0]=0.001;
1762 animation[dead4anim].speed[0]=0.001;
1764 animation[dead1anim].speed[1]=0.001;
1765 animation[dead2anim].speed[1]=0.001;
1766 animation[dead3anim].speed[1]=0.001;
1767 animation[dead4anim].speed[1]=0.001;
1769 for(i=0;i<player[0].skeleton.num_joints;i++){
1770 for(j=0;j<animation[swordsneakattackanim].numframes;j++){
1771 animation[swordsneakattackanim].position[i][j]+=moveamount;
1776 for(j=0;j<animation[swordsneakattackanim].numframes;j++){
1777 animation[swordsneakattackanim].weapontarget[j]+=moveamount;
1783 for(i=0;i<player[0].skeleton.num_joints;i++){
1784 for(j=0;j<animation[swordsneakattackedanim].numframes;j++){
1785 animation[swordsneakattackedanim].position[i][j]+=moveamount;
1789 for(i=0;i<player[0].skeleton.num_joints;i++){
1790 for(j=0;j<animation[sleepanim].numframes;j++){
1791 animation[sleepanim].position[i][j]=DoRotation(animation[sleepanim].position[i][j],0,180,0);
1797 temptexdetail=texdetail;
1799 texdetail=temptexdetail;
1806 glPixelStorei( GL_UNPACK_ALIGNMENT, 1 );
1808 glGenTextures( 1, &screentexture );
1809 glTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE );
1812 glEnable(GL_TEXTURE_2D);
1813 glBindTexture( GL_TEXTURE_2D, screentexture);
1814 glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR );
1815 glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR );
1817 glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 0, 0, kTextureSize, kTextureSize, 0);
1823 /*PlaySoundEx( consolesuccesssound, samp[consolesuccesssound], NULL, TRUE);
1824 FSOUND_SetVolume(channels[consolesuccesssound], 256);
1825 FSOUND_SetPaused(channels[consolesuccesssound], FALSE);
1828 float gLoc[3]={0,0,0};
1829 float vel[3]={0,0,0};
1830 FSOUND_Sample_SetMinMaxDistance(samp[fireendsound], 9999.0f, 99999.0f);
1831 PlaySoundEx( fireendsound, samp[fireendsound], NULL, TRUE);
1832 FSOUND_3D_SetAttributes(channels[fireendsound], gLoc, vel);
1833 FSOUND_SetVolume(channels[fireendsound], 256);
1834 FSOUND_SetPaused(channels[fireendsound], FALSE);
1835 FSOUND_Sample_SetMinMaxDistance(samp[fireendsound], 8.0f, 2000.0f);
1848 terraintexture2 = 0;
1849 terraintexture3 = 0;
1853 loadscreentexture = 0;
1854 Maparrowtexture = 0;
1856 Mapcircletexture = 0;
1859 memset(Mainmenuitems, 0, sizeof(Mainmenuitems));
1863 memset(startx, 0, sizeof(startx));
1864 memset(starty, 0, sizeof(starty));
1865 memset(endx, 0, sizeof(endx));
1866 memset(endy, 0, sizeof(endy));
1868 memset(selectedlong, 0, sizeof(selectedlong));
1869 memset(offsetx, 0, sizeof(offsetx));
1870 memset(offsety, 0, sizeof(offsety));
1871 memset(movex, 0, sizeof(movex));
1872 memset(movey, 0, sizeof(movey));
1873 memset(endy, 0, sizeof(endy));
1887 memset(menustring, 0, sizeof(menustring));
1888 memset(registrationname, 0, sizeof(registrationname));
1889 registrationnumber = 0;
1893 newscreenheight = 0;
1896 deltah = 0,deltav = 0;
1897 mousecoordh = 0,mousecoordv = 0;
1898 oldmousecoordh = 0,oldmousecoordv = 0;
1899 rotation = 0,rotation2 = 0;
1904 cameratogglekeydown = 0;
1905 chattogglekeydown = 0;
1908 drawmodetogglekeydown = 0;
1909 explodetogglekeydown = 0;
1910 detailtogglekeydown = 0;
1920 // XYZ realhawkcoords;
1932 campaignnumlevels = 0;
1934 memset(campaignmapname, 0, sizeof(campaignmapname));
1935 memset(campaigndescription, 0, sizeof(campaigndescription));
1936 memset(campaignchoosenext, 0, sizeof(campaignchoosenext));
1937 memset(campaignnumnext, 0, sizeof(campaignnumnext));
1938 memset(campaignnextlevel, 0, sizeof(campaignnextlevel));
1939 int campaignchoicesmade;
1940 memset(campaignchoices, 0, sizeof(campaignchoices));
1941 memset(campaignlocationx, 0, sizeof(campaignlocationx));
1942 memset(campaignlocationy, 0, sizeof(campaignlocationy));
1943 memset(campaignlocationy, 0, sizeof(campaignlocationy));
1945 campaignchoicenum = 0;
1947 memset(campaignchoicewhich, 0, sizeof(campaignchoicewhich));
1951 numlevelspassed = 0;
1953 memset(levelorder, 0, sizeof(levelorder));
1954 memset(levelvisible, 0, sizeof(levelvisible));
1955 memset(levelhighlight, 0, sizeof(levelhighlight));
1959 musictype = 0,oldmusictype = 0,oldoldmusictype = 0;
1963 // XYZ rabbitcoords;
1974 envtogglekeydown = 0;
1975 slomotogglekeydown = 0;
1976 texturesizetogglekeydown = 0;
1977 freezetogglekeydown = 0;
1984 editorrotation2 = 0;
1991 // XYZ pathpoint[30];
1993 memset(numpathpointconnect, 0, sizeof(numpathpointconnect));
1994 memset(pathpointconnect, 0, sizeof(pathpointconnect));
1995 pathpointselected = 0;
1999 numchallengelevels = 0;
2002 archiveselected = 0;
2004 memset(consoletext, 0, sizeof(consoletext));
2005 memset(consolechars, 0, sizeof(consolechars));
2007 memset(displaytext, 0, sizeof(displaytext));
2008 memset(displaychars, 0, sizeof(displaychars));
2009 memset(displaytime, 0, sizeof(displaytime));
2010 displayblinkdelay = 0;
2012 displayselected = 0;
2014 consoletogglekeydown = 0;
2015 consoleblinkdelay = 0;
2017 consoleselected = 0;
2018 memset(togglekey, 0, sizeof(togglekey));
2019 memset(togglekeydelay, 0, sizeof(togglekeydelay));
2023 crouchkey = 0,jumpkey = 0,forwardkey = 0,chatkey = 0,backkey = 0,leftkey = 0,rightkey = 0,drawkey = 0,throwkey = 0,attackkey = 0;
2030 // XYZ boundary[360];
2037 memset(musicvolume, 0, sizeof(musicvolume));
2038 memset(oldmusicvolume, 0, sizeof(oldmusicvolume));