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 #if defined(__APPLE__)
1012 sprintf (tempstring, "%s", registrationname);
1013 #elif defined(_MSC_VER) || defined(__linux__)
1014 sprintf (tempstring, "%s-windows", registrationname);
1016 #error Please make sure you have the right registration key stuff here!
1018 longnuma = MD5_string ( tempstring);
1019 num1a = longnuma/100000000;
1020 num2a = longnuma%100000000;
1021 //if(num1a==num1&&num2a==num2)registered=1;
1022 if(numchars>2)registered=1;
1032 sprintf (mapname, ":Data:Users");
1033 tfile=fopen( mapname, "rb" );
1036 funpackf(tfile, "Bi", &numaccounts);
1037 funpackf(tfile, "Bi", &accountactive);
1040 for(i=0;i<numaccounts;i++)
1042 funpackf(tfile, "Bf", &accountcampaigntime[i]);
1043 funpackf(tfile, "Bf", &accountcampaignscore[i]);
1044 funpackf(tfile, "Bf", &accountcampaignfasttime[i]);
1045 funpackf(tfile, "Bf", &accountcampaignhighscore[i]);
1046 funpackf(tfile, "Bi", &accountdifficulty[i]);
1047 funpackf(tfile, "Bi", &accountprogress[i]);
1048 funpackf(tfile, "Bi", &accountcampaignchoicesmade[i]);
1049 for(j=0;j<accountcampaignchoicesmade[i];j++)
1051 funpackf(tfile, "Bi", &accountcampaignchoices[i][j]);
1052 if (accountcampaignchoices[i][j] >= 10)
1054 accountcampaignchoices[i][j] = 0;
1057 funpackf(tfile, "Bf", &accountpoints[i]);
1060 funpackf(tfile, "Bf", &accounthighscore[i][j]);
1061 funpackf(tfile, "Bf", &accountfasttime[i][j]);
1065 funpackf(tfile, "Bb", &accountunlocked[i][j]);
1068 funpackf(tfile, "Bi", &temp);
1073 funpackf(tfile, "Bb", &accountname[i][j]);
1086 whichjointstartarray[0]=righthip;
1087 whichjointendarray[0]=rightfoot;
1089 whichjointstartarray[1]=righthip;
1090 whichjointendarray[1]=rightankle;
1092 whichjointstartarray[2]=righthip;
1093 whichjointendarray[2]=rightknee;
1095 whichjointstartarray[3]=rightknee;
1096 whichjointendarray[3]=rightankle;
1098 whichjointstartarray[4]=rightankle;
1099 whichjointendarray[4]=rightfoot;
1101 whichjointstartarray[5]=lefthip;
1102 whichjointendarray[5]=leftfoot;
1104 whichjointstartarray[6]=lefthip;
1105 whichjointendarray[6]=leftankle;
1107 whichjointstartarray[7]=lefthip;
1108 whichjointendarray[7]=leftknee;
1110 whichjointstartarray[8]=leftknee;
1111 whichjointendarray[8]=leftankle;
1113 whichjointstartarray[9]=leftankle;
1114 whichjointendarray[9]=leftfoot;
1116 whichjointstartarray[10]=abdomen;
1117 whichjointendarray[10]=rightshoulder;
1119 whichjointstartarray[11]=abdomen;
1120 whichjointendarray[11]=rightelbow;
1122 whichjointstartarray[12]=abdomen;
1123 whichjointendarray[12]=rightwrist;
1125 whichjointstartarray[13]=abdomen;
1126 whichjointendarray[13]=righthand;
1128 whichjointstartarray[14]=rightshoulder;
1129 whichjointendarray[14]=rightelbow;
1131 whichjointstartarray[15]=rightelbow;
1132 whichjointendarray[15]=rightwrist;
1134 whichjointstartarray[16]=rightwrist;
1135 whichjointendarray[16]=righthand;
1137 whichjointstartarray[17]=abdomen;
1138 whichjointendarray[17]=leftshoulder;
1140 whichjointstartarray[18]=abdomen;
1141 whichjointendarray[18]=leftelbow;
1143 whichjointstartarray[19]=abdomen;
1144 whichjointendarray[19]=leftwrist;
1146 whichjointstartarray[20]=abdomen;
1147 whichjointendarray[20]=lefthand;
1149 whichjointstartarray[21]=leftshoulder;
1150 whichjointendarray[21]=leftelbow;
1152 whichjointstartarray[22]=leftelbow;
1153 whichjointendarray[22]=leftwrist;
1155 whichjointstartarray[23]=leftwrist;
1156 whichjointendarray[23]=lefthand;
1158 whichjointstartarray[24]=abdomen;
1159 whichjointendarray[24]=neck;
1161 whichjointstartarray[25]=neck;
1162 whichjointendarray[25]=head;
1164 FadeLoadingScreen(0);
1168 texture.data = ( GLubyte* )malloc( 1024*1024*4 );
1170 int temptexdetail=texdetail;
1172 text.LoadFontTexture(":Data:Textures:Font.png");
1174 texdetail=temptexdetail;
1176 FadeLoadingScreen(10);
1192 for (int it = 0; it < 100; ++it)
1197 for (int it = 0; it < 20; ++it)
1202 LOG("Initializing sound system...");
1207 extern bool cmdline(const char *cmd);
1208 unsigned char rc = 0;
1209 output = FSOUND_OUTPUT_ALSA; // Try alsa first...
1210 if (cmdline("forceoss")) // ...but let user override that.
1211 output = FSOUND_OUTPUT_OSS;
1212 else if (cmdline("nosound"))
1213 output = FSOUND_OUTPUT_NOSOUND;
1215 FSOUND_SetOutput(output);
1216 if ((rc = FSOUND_Init(44100, 32, 0)) == FALSE)
1218 // if we tried ALSA and failed, fall back to OSS.
1219 if ( (output == FSOUND_OUTPUT_ALSA) && (!cmdline("forcealsa")) )
1222 output = FSOUND_OUTPUT_OSS;
1223 FSOUND_SetOutput(output);
1224 rc = FSOUND_Init(44100, 32, 0);
1231 output = FSOUND_OUTPUT_NOSOUND; // we tried! just do silence.
1232 FSOUND_SetOutput(output);
1233 rc = FSOUND_Init(44100, 32, 0);
1236 FSOUND_Init(44100, 32, 0);
1239 FSOUND_SetSFXMasterVolume((int)(volume*255));
1241 strm[stream_music3] = FSOUND_Stream_Open(ConvertFileName(":Data:Sounds:music3.mp3"), FSOUND_2D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=0;}
1242 // FSOUND_Sample_SetMinMaxDistance(strm[stream_music3], 4.0f, 1000.0f);
1243 FSOUND_Stream_SetMode(strm[stream_music3], FSOUND_LOOP_NORMAL);
1246 // PlaySoundEx( stream_music3, strm[stream_music3], NULL, TRUE);
1247 PlayStreamEx(stream_music3, strm[stream_music3], 0, TRUE);
1248 FSOUND_SetPaused(channels[stream_music3], FALSE);
1249 FSOUND_SetVolume(channels[stream_music3], 256);
1252 FadeLoadingScreen(20);
1255 strm[stream_wind] = FSOUND_Stream_Open(ConvertFileName(":Data:Sounds:wind.mp3"), FSOUND_2D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
1256 // FSOUND_Sample_SetMinMaxDistance(strm[stream_wind], 4.0f, 1000.0f);
1257 FSOUND_Stream_SetMode(strm[stream_wind], FSOUND_LOOP_NORMAL);
1259 FadeLoadingScreen(30);
1261 strm[stream_desertambient] = FSOUND_Stream_Open(ConvertFileName(":Data:Sounds:desertambient.mp3"), FSOUND_2D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
1262 // FSOUND_Sample_SetMinMaxDistance(strm[stream_desertambient], 4.0f, 1000.0f);
1263 FSOUND_Stream_SetMode(strm[stream_desertambient], FSOUND_LOOP_NORMAL);
1266 FadeLoadingScreen(40);
1268 samp[firestartsound] = FSOUND_Sample_Load(FSOUND_FREE, ConvertFileName(":Data:Sounds:firestart.ogg"), FSOUND_2D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
1269 FSOUND_Sample_SetMinMaxDistance(samp[firestartsound], 8.0f, 2000.0f);
1271 strm[stream_firesound] = FSOUND_Stream_Open(":Data:Sounds:fire.ogg", FSOUND_2D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
1272 // FSOUND_Sample_SetMinMaxDistance(strm[stream_firesound], 8.0f, 2000.0f);
1273 FSOUND_Stream_SetMode(strm[stream_firesound], FSOUND_LOOP_NORMAL);
1275 FadeLoadingScreen(50);
1277 samp[fireendsound] = FSOUND_Sample_Load(FSOUND_FREE, ConvertFileName(":Data:Sounds:fireend.ogg"), FSOUND_2D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
1278 FSOUND_Sample_SetMinMaxDistance(samp[fireendsound], 8.0f, 2000.0f);
1281 strm[stream_music1grass] = FSOUND_Stream_Open(ConvertFileName(":Data:Sounds:music1grass.mp3"), FSOUND_2D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=1;}
1282 // FSOUND_Sample_SetMinMaxDistance(strm[stream_music1grass], 4.0f, 1000.0f);
1283 FSOUND_Stream_SetMode(strm[stream_music1grass], FSOUND_LOOP_NORMAL);
1285 strm[stream_music1snow] = FSOUND_Stream_Open(ConvertFileName(":Data:Sounds:music1snow.mp3"), FSOUND_2D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=2;}
1286 // FSOUND_Sample_SetMinMaxDistance(strm[stream_music1snow], 4.0f, 1000.0f);
1287 FSOUND_Stream_SetMode(strm[stream_music1snow], FSOUND_LOOP_NORMAL);
1289 FadeLoadingScreen(60);
1291 strm[stream_music1desert] = FSOUND_Stream_Open(ConvertFileName(":Data:Sounds:music1desert.mp3"), FSOUND_2D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=3;}
1292 // FSOUND_Sample_SetMinMaxDistance(strm[stream_music1desert], 4.0f, 1000.0f);
1293 FSOUND_Stream_SetMode(strm[stream_music1desert], FSOUND_LOOP_NORMAL);
1295 FadeLoadingScreen(80);
1296 strm[stream_music2] = FSOUND_Stream_Open(ConvertFileName(":Data:Sounds:music2.ogg"), FSOUND_2D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=4;}
1297 // FSOUND_Sample_SetMinMaxDistance(strm[stream_music2], 4.0f, 1000.0f);
1298 FSOUND_Stream_SetMode(strm[stream_music2], FSOUND_LOOP_NORMAL);
1303 FadeLoadingScreen(90);
1306 LoadTexture(":Data:Textures:Cursor.png",&cursortexture,0,1);
1308 LoadTexture(":Data:Textures:MapCircle.png",&Mapcircletexture,0,1);
1309 LoadTexture(":Data:Textures:MapBox.png",&Mapboxtexture,0,1);
1310 LoadTexture(":Data:Textures:MapArrow.png",&Maparrowtexture,0,1);
1312 temptexdetail=texdetail;
1313 if(texdetail>2)texdetail=2;
1314 LoadTexture(":Data:Textures:Lugaru.png",&Mainmenuitems[0],0,0);
1315 LoadTexture(":Data:Textures:Newgame.png",&Mainmenuitems[1],0,0);
1316 LoadTexture(":Data:Textures:Options.png",&Mainmenuitems[2],0,0);
1317 LoadTexture(":Data:Textures:Quit.png",&Mainmenuitems[3],0,0);
1318 LoadTexture(":Data:Textures:World.png",&Mainmenuitems[7],0,0);
1319 LoadTexture(":Data:Textures:Eyelid.png",&Mainmenuitems[4],0,1);
1320 //LoadTexture(":Data:Textures:Eye.jpg",&Mainmenuitems[5],0,1);
1321 texdetail=temptexdetail;
1326 FadeLoadingScreen(95);
1337 newscreenwidth=screenwidth;
1338 newscreenheight=screenheight;
1343 float gLoc[3]={0,0,0};
1344 float vel[3]={0,0,0};
1345 FSOUND_Sample_SetMinMaxDistance(samp[firestartsound], 9999.0f, 99999.0f);
1346 PlaySoundEx( firestartsound, samp[firestartsound], NULL, TRUE);
1347 FSOUND_3D_SetAttributes(channels[firestartsound], gLoc, vel);
1348 FSOUND_SetVolume(channels[firestartsound], 256);
1349 FSOUND_SetPaused(channels[firestartsound], FALSE);
1350 FSOUND_Sample_SetMinMaxDistance(samp[firestartsound], 8.0f, 2000.0f);
1361 void Game::LoadStuff()
1363 static float temptexdetail;
1364 static float viewdistdetail;
1365 static int i,j,texsize;
1372 /*musicvolume[3]=512;
1373 PlaySoundEx( music4, samp[music4], NULL, TRUE);
1374 FSOUND_SetPaused(channels[music4], FALSE);
1375 FSOUND_SetVolume(channels[music4], 512);
1381 //texture.data = ( GLubyte* )malloc( 1024*1024*4 );
1385 for(i=0;i<maxplayers;i++)
1387 if (glIsTexture(player[i].skeleton.drawmodel.textureptr))
1389 glDeleteTextures(1, &player[i].skeleton.drawmodel.textureptr);
1391 player[i].skeleton.drawmodel.textureptr=0;;
1394 //temptexdetail=texdetail;
1397 LoadTexture(":Data:Textures:fire.jpg",&loadscreentexture,1,0);
1398 //texdetail=temptexdetail;
1400 temptexdetail=texdetail;
1402 text.LoadFontTexture(":Data:Textures:Font.png");
1404 texdetail=temptexdetail;
1409 viewdistance=50*megascale*viewdistdetail;
1429 realtexdetail=texdetail;
1432 if(texdetail<1)texdetail=1;
1433 realtexdetail=texdetail*4;
1439 /*LoadTexture(":Data:Textures:snow.png",&terraintexture,1);
1441 LoadTexture(":Data:Textures:rock.png",&terraintexture2,1);
1443 LoadTexture(":Data:Textures:detail.png",&terraintexture3,1);
1447 LOG("Loading weapon data...");
1449 LoadTexture(":Data:Textures:knife.png",&weapons.knifetextureptr,0,1);
1450 LoadTexture(":Data:Textures:bloodknife.png",&weapons.bloodknifetextureptr,0,1);
1451 LoadTexture(":Data:Textures:lightbloodknife.png",&weapons.lightbloodknifetextureptr,0,1);
1452 LoadTexture(":Data:Textures:sword.jpg",&weapons.swordtextureptr,1,0);
1453 LoadTexture(":Data:Textures:Swordblood.jpg",&weapons.bloodswordtextureptr,1,0);
1454 LoadTexture(":Data:Textures:Swordbloodlight.jpg",&weapons.lightbloodswordtextureptr,1,0);
1455 LoadTexture(":Data:Textures:Staff.jpg",&weapons.stafftextureptr,1,0);
1457 weapons.throwingknifemodel.load((char *)":Data:Models:throwingknife.solid",1);
1458 weapons.throwingknifemodel.Scale(.001,.001,.001);
1459 //weapons.throwingknifemodel.Rotate(0,0,-90);
1460 weapons.throwingknifemodel.Rotate(90,0,0);
1461 weapons.throwingknifemodel.Rotate(0,90,0);
1462 weapons.throwingknifemodel.flat=0;
1463 weapons.throwingknifemodel.CalculateNormals(1);
1464 //weapons.throwingknifemodel.ScaleNormals(-1,-1,-1);
1466 weapons.swordmodel.load((char *)":Data:Models:sword.solid",1);
1467 weapons.swordmodel.Scale(.001,.001,.001);
1468 //weapons.swordmodel.Rotate(0,0,-90);
1469 weapons.swordmodel.Rotate(90,0,0);
1470 weapons.swordmodel.Rotate(0,90,0);
1471 weapons.swordmodel.Rotate(0,0,90);
1472 weapons.swordmodel.flat=1;
1473 weapons.swordmodel.CalculateNormals(1);
1474 //weapons.swordmodel.ScaleNormals(-1,-1,-1);
1476 weapons.staffmodel.load((char *)":Data:Models:staff.solid",1);
1477 weapons.staffmodel.Scale(.005,.005,.005);
1478 //weapons.staffmodel.Rotate(0,0,-90);
1479 weapons.staffmodel.Rotate(90,0,0);
1480 weapons.staffmodel.Rotate(0,90,0);
1481 weapons.staffmodel.Rotate(0,0,90);
1482 weapons.staffmodel.flat=1;
1483 weapons.staffmodel.CalculateNormals(1);
1484 //weapons.staffmodel.ScaleNormals(-1,-1,-1);
1486 //temptexdetail=texdetail;
1487 //if(texdetail>4)texdetail=4;
1488 LoadTexture(":Data:Textures:shadow.png",&terrain.shadowtexture,0,1);
1490 LoadTexture(":Data:Textures:blood.png",&terrain.bloodtexture,0,1);
1492 LoadTexture(":Data:Textures:break.png",&terrain.breaktexture,0,1);
1494 LoadTexture(":Data:Textures:blood.png",&terrain.bloodtexture2,0,1);
1497 LoadTexture(":Data:Textures:footprint.png",&terrain.footprinttexture,0,1);
1499 LoadTexture(":Data:Textures:bodyprint.png",&terrain.bodyprinttexture,0,1);
1501 /*LoadTexture(":Data:Textures:cloud.png",&sprites.cloudtexture,1);
1503 LoadTexture(":Data:Textures:cloudimpact.png",&sprites.cloudimpacttexture,1);
1505 LoadTexture(":Data:Textures:bloodparticle.png",&sprites.bloodtexture,1);
1507 LoadTexture(":Data:Textures:snowflake.png",&sprites.snowflaketexture,1);
1509 LoadTexture(":Data:Textures:flame.png",&sprites.flametexture,1);
1511 LoadTexture(":Data:Textures:smoke.png",&sprites.smoketexture,1);
1512 //texdetail=temptexdetail;
1513 LoadTexture(":Data:Textures:shine.png",&sprites.shinetexture,1);*/
1517 LoadTexture(":Data:Textures:hawk.png",&hawktexture,0,1);
1519 LoadTexture(":Data:Textures:logo.png",&logotexture,0,1);
1522 //LoadTexture(":Data:Textures:box.jpg",&objects.boxtextureptr,1,0);
1525 LoadTexture(":Data:Textures:cloud.png",&sprites.cloudtexture,1,1);
1526 LoadTexture(":Data:Textures:cloudimpact.png",&sprites.cloudimpacttexture,1,1);
1527 LoadTexture(":Data:Textures:bloodparticle.png",&sprites.bloodtexture,1,1);
1528 LoadTexture(":Data:Textures:snowflake.png",&sprites.snowflaketexture,1,1);
1529 LoadTexture(":Data:Textures:flame.png",&sprites.flametexture,1,1);
1530 LoadTexture(":Data:Textures:bloodflame.png",&sprites.bloodflametexture,1,1);
1531 LoadTexture(":Data:Textures:smoke.png",&sprites.smoketexture,1,1);
1532 LoadTexture(":Data:Textures:shine.png",&sprites.shinetexture,1,0);
1533 LoadTexture(":Data:Textures:splinter.png",&sprites.splintertexture,1,1);
1534 LoadTexture(":Data:Textures:leaf.png",&sprites.leaftexture,1,1);
1535 LoadTexture(":Data:Textures:tooth.png",&sprites.toothtexture,1,1);
1539 ReSizeGLScene(90,.01);
1546 if(detail)kTextureSize=1024;
1547 if(detail==1)kTextureSize=512;
1548 if(detail==0)kTextureSize=256;
1551 //drawmode=motionblurmode;
1553 //Set up distant light
1557 light.ambient[0]=.2;
1558 light.ambient[1]=.2;
1559 light.ambient[2]=.24;
1562 light.location.z=-.2;
1563 Normalise(&light.location);
1573 texscale=.2/megascale/viewdistdetail;
1574 terrain.scale=3*megascale*terraindetail*viewdistdetail;
1576 viewer.x=terrain.size/2*terrain.scale;
1577 viewer.z=terrain.size/2*terrain.scale;
1579 hawk.load((char *)":Data:Models:hawk.solid",1);
1580 hawk.Scale(.03,.03,.03);
1581 hawk.Rotate(90,1,1);
1582 hawk.CalculateNormals(0);
1583 hawk.ScaleNormals(-1,-1,-1);
1584 hawkcoords.x=terrain.size/2*terrain.scale-5-7;
1585 hawkcoords.z=terrain.size/2*terrain.scale-5-7;
1586 hawkcoords.y=terrain.getHeight(hawkcoords.x,hawkcoords.z)+25;
1589 eye.load((char *)":Data:Models:eye.solid",1);
1590 eye.Scale(.03,.03,.03);
1591 eye.CalculateNormals(0);
1593 cornea.load((char *)":Data:Models:cornea.solid",1);
1594 cornea.Scale(.03,.03,.03);
1595 cornea.CalculateNormals(0);
1597 iris.load((char *)":Data:Models:iris.solid",1);
1598 iris.Scale(.03,.03,.03);
1599 iris.CalculateNormals(0);
1601 LoadSave(":Data:Textures:Bloodfur.png",0,1,&bloodText[0],0);
1602 LoadSave(":Data:Textures:Wolfbloodfur.png",0,1,&wolfbloodText[0],0);
1610 //if(targetlevel!=7)
1611 Loadlevel(targetlevel);
1614 rabbitcoords=player[0].coords;
1615 rabbitcoords.y=terrain.getHeight(rabbitcoords.x,rabbitcoords.z);
1617 animation[runanim].Load((char *)":Data:Animations:Run",middleheight,neutral);
1619 animation[bounceidleanim].Load((char *)":Data:Animations:Idle",middleheight,neutral);
1620 animation[stopanim].Load((char *)":Data:Animations:Stop",middleheight,neutral);
1622 animation[jumpupanim].Load((char *)":Data:Animations:JumpUp",highheight,neutral);
1623 animation[jumpdownanim].Load((char *)":Data:Animations:JumpDown",highheight,neutral);
1625 animation[landanim].Load((char *)":Data:Animations:Landing",lowheight,neutral);
1626 animation[landhardanim].Load((char *)":Data:Animations:Landhard",lowheight,neutral);
1627 animation[climbanim].Load((char *)":Data:Animations:Climb",lowheight,neutral);
1628 animation[hanganim].Load((char *)":Data:Animations:Hangon",lowheight,neutral);
1629 animation[spinkickanim].Load((char *)":Data:Animations:SpinKick",middleheight,normalattack);
1631 animation[getupfromfrontanim].Load((char *)":Data:Animations:GetUpFromFront",lowheight,neutral);
1632 animation[getupfrombackanim].Load((char *)":Data:Animations:GetUpFromBack",lowheight,neutral);
1633 animation[crouchanim].Load((char *)":Data:Animations:Crouch",lowheight,neutral);
1634 animation[sneakanim].Load((char *)":Data:Animations:Sneak",lowheight,neutral);
1635 animation[rollanim].Load((char *)":Data:Animations:Roll",lowheight,neutral);
1636 animation[flipanim].Load((char *)":Data:Animations:Flip",highheight,neutral);
1637 animation[frontflipanim].Load((char *)":Data:Animations:Flip",highheight,neutral);
1638 animation[spinkickreversedanim].Load((char *)":Data:Animations:SpinKickCaught",middleheight,reversed);
1640 animation[spinkickreversalanim].Load((char *)":Data:Animations:SpinKickCatch",middleheight,reversal);
1641 animation[lowkickanim].Load((char *)":Data:Animations:lowkick",middleheight,normalattack);
1642 animation[sweepanim].Load((char *)":Data:Animations:sweep",lowheight,normalattack);
1643 animation[sweepreversedanim].Load((char *)":Data:Animations:SweepCaught",lowheight,reversed);
1644 animation[sweepreversalanim].Load((char *)":Data:Animations:SweepCatch",middleheight,reversal);
1645 animation[rabbitkickanim].Load((char *)":Data:Animations:RabbitKick",middleheight,normalattack);
1646 animation[rabbitkickreversedanim].Load((char *)":Data:Animations:RabbitKickCaught",middleheight,reversed);
1647 animation[rabbitkickreversalanim].Load((char *)":Data:Animations:RabbitKickCatch",lowheight,reversal);
1648 animation[upunchanim].Load((char *)":Data:Animations:Upunch",middleheight,normalattack);
1649 animation[staggerbackhighanim].Load((char *)":Data:Animations:Staggerbackhigh",middleheight,neutral);
1650 animation[upunchreversedanim].Load((char *)":Data:Animations:UpunchCaught",middleheight,reversed);
1652 animation[upunchreversalanim].Load((char *)":Data:Animations:UpunchCatch",middleheight,reversal);
1653 animation[hurtidleanim].Load((char *)":Data:Animations:Hurtidle",middleheight,neutral);
1654 animation[backhandspringanim].Load((char *)":Data:Animations:Backhandspring",middleheight,neutral);
1655 animation[fightidleanim].Load((char *)":Data:Animations:Fightidle",middleheight,neutral);
1656 animation[walkanim].Load((char *)":Data:Animations:Walk",middleheight,neutral);
1658 animation[fightsidestep].Load((char *)":Data:Animations:Fightsidestep",middleheight,neutral);
1659 animation[killanim].Load((char *)":Data:Animations:Kill",middleheight,normalattack);
1660 animation[sneakattackanim].Load((char *)":Data:Animations:Sneakattack",middleheight,reversal);
1661 animation[sneakattackedanim].Load((char *)":Data:Animations:Sneakattacked",middleheight,reversed);
1662 animation[drawrightanim].Load((char *)":Data:Animations:drawright",middleheight,neutral);
1663 animation[knifeslashstartanim].Load((char *)":Data:Animations:slashstart",middleheight,normalattack);
1664 animation[crouchdrawrightanim].Load((char *)":Data:Animations:crouchdrawright",lowheight,neutral);
1665 animation[crouchstabanim].Load((char *)":Data:Animations:crouchstab",lowheight,normalattack);
1667 animation[knifefollowanim].Load((char *)":Data:Animations:slashfollow",middleheight,reversal);
1668 animation[knifefollowedanim].Load((char *)":Data:Animations:slashfollowed",middleheight,reversed);
1669 animation[knifethrowanim].Load((char *)":Data:Animations:knifethrow",middleheight,normalattack);
1670 animation[removeknifeanim].Load((char *)":Data:Animations:removeknife",middleheight,neutral);
1671 animation[crouchremoveknifeanim].Load((char *)":Data:Animations:crouchremoveknife",lowheight,neutral);
1672 animation[jumpreversedanim].Load((char *)":Data:Animations:JumpCaught",middleheight,reversed);
1673 animation[jumpreversalanim].Load((char *)":Data:Animations:JumpCatch",middleheight,reversal);
1674 animation[staggerbackhardanim].Load((char *)":Data:Animations:Staggerbackhard",middleheight,neutral);
1676 animation[dropkickanim].Load((char *)":Data:Animations:Dropkick",middleheight,normalattack);
1677 animation[winduppunchanim].Load((char *)":Data:Animations:Winduppunch",middleheight,normalattack);
1678 animation[winduppunchblockedanim].Load((char *)":Data:Animations:Winduppunchblocked",middleheight,normalattack);
1679 animation[blockhighleftanim].Load((char *)":Data:Animations:Blockhighleft",middleheight,normalattack);
1680 animation[blockhighleftstrikeanim].Load((char *)":Data:Animations:Blockhighleftstrike",middleheight,normalattack);
1681 animation[backflipanim].Load((char *)":Data:Animations:Backflip",highheight,neutral);
1682 animation[walljumpbackanim].Load((char *)":Data:Animations:Walljumpback",highheight,neutral);
1683 animation[walljumpfrontanim].Load((char *)":Data:Animations:Walljumpfront",highheight,neutral);
1684 animation[rightflipanim].Load((char *)":Data:Animations:Rightflip",highheight,neutral);
1685 animation[walljumprightanim].Load((char *)":Data:Animations:Walljumpright",highheight,neutral);
1686 animation[leftflipanim].Load((char *)":Data:Animations:Leftflip",highheight,neutral);
1687 animation[walljumpleftanim].Load((char *)":Data:Animations:Walljumpleft",highheight,neutral);
1688 animation[walljumprightkickanim].Load((char *)":Data:Animations:Walljumprightkick",highheight,neutral);
1689 animation[walljumpleftkickanim].Load((char *)":Data:Animations:Walljumpleftkick",highheight,neutral);
1690 animation[knifefightidleanim].Load((char *)":Data:Animations:Knifefightidle",middleheight,neutral);
1691 animation[knifesneakattackanim].Load((char *)":Data:Animations:Knifesneakattack",middleheight,reversal);
1692 animation[knifesneakattackedanim].Load((char *)":Data:Animations:Knifesneakattacked",middleheight,reversed);
1693 animation[swordfightidleanim].Load((char *)":Data:Animations:swordfightidle",middleheight,neutral);
1694 animation[drawleftanim].Load((char *)":Data:Animations:drawleft",middleheight,neutral);
1695 animation[swordslashanim].Load((char *)":Data:Animations:swordslash",middleheight,normalattack);
1696 animation[swordgroundstabanim].Load((char *)":Data:Animations:swordgroundstab",lowheight,normalattack);
1697 animation[dodgebackanim].Load((char *)":Data:Animations:dodgeback",middleheight,neutral);
1698 animation[swordsneakattackanim].Load((char *)":Data:Animations:Swordsneakattack",middleheight,reversal);
1699 animation[swordsneakattackedanim].Load((char *)":Data:Animations:Swordsneakattacked",middleheight,reversed);
1700 animation[swordslashreversedanim].Load((char *)":Data:Animations:swordslashCaught",middleheight,reversed);
1701 animation[swordslashreversalanim].Load((char *)":Data:Animations:swordslashCatch",middleheight,reversal);
1702 animation[knifeslashreversedanim].Load((char *)":Data:Animations:knifeslashCaught",middleheight,reversed);
1703 animation[knifeslashreversalanim].Load((char *)":Data:Animations:knifeslashCatch",middleheight,reversal);
1704 animation[swordfightidlebothanim].Load((char *)":Data:Animations:swordfightidleboth",middleheight,neutral);
1705 animation[swordslashparryanim].Load((char *)":Data:Animations:sworduprightparry",middleheight,normalattack);
1706 animation[swordslashparriedanim].Load((char *)":Data:Animations:swordslashparried",middleheight,normalattack);
1707 animation[wolfidle].Load((char *)":Data:Animations:Wolfidle",middleheight,neutral);
1708 animation[wolfcrouchanim].Load((char *)":Data:Animations:Wolfcrouch",lowheight,neutral);
1709 animation[wolflandanim].Load((char *)":Data:Animations:Wolflanding",lowheight,neutral);
1710 animation[wolflandhardanim].Load((char *)":Data:Animations:Wolflandhard",lowheight,neutral);
1711 animation[wolfrunanim].Load((char *)":Data:Animations:Wolfrun",middleheight,neutral);
1712 animation[wolfrunninganim].Load((char *)":Data:Animations:Wolfrunning",middleheight,neutral);
1713 animation[rabbitrunninganim].Load((char *)":Data:Animations:Rabbitrunning",middleheight,neutral);
1714 animation[wolfstopanim].Load((char *)":Data:Animations:Wolfstop",middleheight,neutral);
1715 animation[rabbittackleanim].Load((char *)":Data:Animations:Rabbittackle",middleheight,neutral);
1716 animation[rabbittacklinganim].Load((char *)":Data:Animations:Rabbittackling",middleheight,reversal);
1717 animation[rabbittackledbackanim].Load((char *)":Data:Animations:Rabbittackledback",middleheight,reversed);
1718 animation[rabbittackledfrontanim].Load((char *)":Data:Animations:Rabbittackledfront",middleheight,reversed);
1719 animation[wolfslapanim].Load((char *)":Data:Animations:Wolfslap",middleheight,normalattack);
1720 animation[staffhitanim].Load((char *)":Data:Animations:StaffHit",middleheight,normalattack);
1721 animation[staffgroundsmashanim].Load((char *)":Data:Animations:StaffGroundSmash",lowheight,normalattack);
1722 animation[staffspinhitanim].Load((char *)":Data:Animations:Spinwhack",middleheight,normalattack);
1723 animation[staffhitreversedanim].Load((char *)":Data:Animations:StaffHitCaught",middleheight,reversed);
1724 animation[staffhitreversalanim].Load((char *)":Data:Animations:StaffHitCatch",middleheight,reversal);
1725 animation[staffspinhitreversedanim].Load((char *)":Data:Animations:SpinWhackCaught",middleheight,reversed);
1726 animation[staffspinhitreversalanim].Load((char *)":Data:Animations:SpinWhackCatch",middleheight,reversal);
1728 animation[sitanim].Load((char *)":Data:Animations:Sit",lowheight,neutral);
1729 animation[sleepanim].Load((char *)":Data:Animations:Sleep",lowheight,neutral);
1730 animation[talkidleanim].Load((char *)":Data:Animations:TalkIdle",middleheight,neutral);
1732 animation[sitwallanim].Load((char *)":Data:Animations:Dying",lowheight,neutral);
1733 animation[dead1anim].Load((char *)":Data:Animations:Dead1",lowheight,neutral);
1734 animation[dead2anim].Load((char *)":Data:Animations:Dead2",lowheight,neutral);
1735 animation[dead3anim].Load((char *)":Data:Animations:Dead3",lowheight,neutral);
1736 animation[dead4anim].Load((char *)":Data:Animations:Dead4",lowheight,neutral);
1737 //Fix knife stab, too lazy to do it manually
1741 for(i=0;i<player[0].skeleton.num_joints;i++){
1742 for(j=0;j<animation[knifesneakattackanim].numframes;j++){
1743 animation[knifesneakattackanim].position[i][j]+=moveamount;
1750 for(i=0;i<player[0].skeleton.num_joints;i++){
1751 for(j=0;j<animation[knifesneakattackedanim].numframes;j++){
1752 animation[knifesneakattackedanim].position[i][j]+=moveamount;
1759 for(i=0;i<player[0].skeleton.num_joints;i++){
1760 animation[dead1anim].position[i][1]=animation[dead1anim].position[i][0];
1761 animation[dead2anim].position[i][1]=animation[dead2anim].position[i][0];
1762 animation[dead3anim].position[i][1]=animation[dead3anim].position[i][0];
1763 animation[dead4anim].position[i][1]=animation[dead4anim].position[i][0];
1765 animation[dead1anim].speed[0]=0.001;
1766 animation[dead2anim].speed[0]=0.001;
1767 animation[dead3anim].speed[0]=0.001;
1768 animation[dead4anim].speed[0]=0.001;
1770 animation[dead1anim].speed[1]=0.001;
1771 animation[dead2anim].speed[1]=0.001;
1772 animation[dead3anim].speed[1]=0.001;
1773 animation[dead4anim].speed[1]=0.001;
1775 for(i=0;i<player[0].skeleton.num_joints;i++){
1776 for(j=0;j<animation[swordsneakattackanim].numframes;j++){
1777 animation[swordsneakattackanim].position[i][j]+=moveamount;
1782 for(j=0;j<animation[swordsneakattackanim].numframes;j++){
1783 animation[swordsneakattackanim].weapontarget[j]+=moveamount;
1789 for(i=0;i<player[0].skeleton.num_joints;i++){
1790 for(j=0;j<animation[swordsneakattackedanim].numframes;j++){
1791 animation[swordsneakattackedanim].position[i][j]+=moveamount;
1795 for(i=0;i<player[0].skeleton.num_joints;i++){
1796 for(j=0;j<animation[sleepanim].numframes;j++){
1797 animation[sleepanim].position[i][j]=DoRotation(animation[sleepanim].position[i][j],0,180,0);
1803 temptexdetail=texdetail;
1805 texdetail=temptexdetail;
1812 glPixelStorei( GL_UNPACK_ALIGNMENT, 1 );
1814 glGenTextures( 1, &screentexture );
1815 glTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE );
1818 glEnable(GL_TEXTURE_2D);
1819 glBindTexture( GL_TEXTURE_2D, screentexture);
1820 glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR );
1821 glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR );
1823 glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 0, 0, kTextureSize, kTextureSize, 0);
1829 /*PlaySoundEx( consolesuccesssound, samp[consolesuccesssound], NULL, TRUE);
1830 FSOUND_SetVolume(channels[consolesuccesssound], 256);
1831 FSOUND_SetPaused(channels[consolesuccesssound], FALSE);
1834 float gLoc[3]={0,0,0};
1835 float vel[3]={0,0,0};
1836 FSOUND_Sample_SetMinMaxDistance(samp[fireendsound], 9999.0f, 99999.0f);
1837 PlaySoundEx( fireendsound, samp[fireendsound], NULL, TRUE);
1838 FSOUND_3D_SetAttributes(channels[fireendsound], gLoc, vel);
1839 FSOUND_SetVolume(channels[fireendsound], 256);
1840 FSOUND_SetPaused(channels[fireendsound], FALSE);
1841 FSOUND_Sample_SetMinMaxDistance(samp[fireendsound], 8.0f, 2000.0f);
1854 terraintexture2 = 0;
1855 terraintexture3 = 0;
1859 loadscreentexture = 0;
1860 Maparrowtexture = 0;
1862 Mapcircletexture = 0;
1865 memset(Mainmenuitems, 0, sizeof(Mainmenuitems));
1869 memset(startx, 0, sizeof(startx));
1870 memset(starty, 0, sizeof(starty));
1871 memset(endx, 0, sizeof(endx));
1872 memset(endy, 0, sizeof(endy));
1874 memset(selectedlong, 0, sizeof(selectedlong));
1875 memset(offsetx, 0, sizeof(offsetx));
1876 memset(offsety, 0, sizeof(offsety));
1877 memset(movex, 0, sizeof(movex));
1878 memset(movey, 0, sizeof(movey));
1879 memset(endy, 0, sizeof(endy));
1893 memset(menustring, 0, sizeof(menustring));
1894 memset(registrationname, 0, sizeof(registrationname));
1895 registrationnumber = 0;
1899 newscreenheight = 0;
1902 deltah = 0,deltav = 0;
1903 mousecoordh = 0,mousecoordv = 0;
1904 oldmousecoordh = 0,oldmousecoordv = 0;
1905 rotation = 0,rotation2 = 0;
1910 cameratogglekeydown = 0;
1911 chattogglekeydown = 0;
1914 drawmodetogglekeydown = 0;
1915 explodetogglekeydown = 0;
1916 detailtogglekeydown = 0;
1926 // XYZ realhawkcoords;
1938 campaignnumlevels = 0;
1940 memset(campaignmapname, 0, sizeof(campaignmapname));
1941 memset(campaigndescription, 0, sizeof(campaigndescription));
1942 memset(campaignchoosenext, 0, sizeof(campaignchoosenext));
1943 memset(campaignnumnext, 0, sizeof(campaignnumnext));
1944 memset(campaignnextlevel, 0, sizeof(campaignnextlevel));
1945 int campaignchoicesmade;
1946 memset(campaignchoices, 0, sizeof(campaignchoices));
1947 memset(campaignlocationx, 0, sizeof(campaignlocationx));
1948 memset(campaignlocationy, 0, sizeof(campaignlocationy));
1949 memset(campaignlocationy, 0, sizeof(campaignlocationy));
1951 campaignchoicenum = 0;
1953 memset(campaignchoicewhich, 0, sizeof(campaignchoicewhich));
1957 numlevelspassed = 0;
1959 memset(levelorder, 0, sizeof(levelorder));
1960 memset(levelvisible, 0, sizeof(levelvisible));
1961 memset(levelhighlight, 0, sizeof(levelhighlight));
1965 musictype = 0,oldmusictype = 0,oldoldmusictype = 0;
1969 // XYZ rabbitcoords;
1980 envtogglekeydown = 0;
1981 slomotogglekeydown = 0;
1982 texturesizetogglekeydown = 0;
1983 freezetogglekeydown = 0;
1990 editorrotation2 = 0;
1997 // XYZ pathpoint[30];
1999 memset(numpathpointconnect, 0, sizeof(numpathpointconnect));
2000 memset(pathpointconnect, 0, sizeof(pathpointconnect));
2001 pathpointselected = 0;
2005 numchallengelevels = 0;
2008 archiveselected = 0;
2010 memset(consoletext, 0, sizeof(consoletext));
2011 memset(consolechars, 0, sizeof(consolechars));
2013 memset(displaytext, 0, sizeof(displaytext));
2014 memset(displaychars, 0, sizeof(displaychars));
2015 memset(displaytime, 0, sizeof(displaytime));
2016 displayblinkdelay = 0;
2018 displayselected = 0;
2020 consoletogglekeydown = 0;
2021 consoleblinkdelay = 0;
2023 consoleselected = 0;
2024 memset(togglekey, 0, sizeof(togglekey));
2025 memset(togglekeydelay, 0, sizeof(togglekeydelay));
2029 crouchkey = 0,jumpkey = 0,forwardkey = 0,chatkey = 0,backkey = 0,leftkey = 0,rightkey = 0,drawkey = 0,throwkey = 0,attackkey = 0;
2036 // XYZ boundary[360];
2043 memset(musicvolume, 0, sizeof(musicvolume));
2044 memset(oldmusicvolume, 0, sizeof(oldmusicvolume));