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;
33 extern AGLContext gaglContext;
36 extern bool musictoggle;
37 extern Weapons weapons;
38 extern Person player[maxplayers];
39 extern int numplayers;
40 extern int environment;
41 extern bool ambientsound;
42 extern float multiplier;
43 extern int newnetmessages;
44 extern int netdatanew;
46 extern bool stillloading;
47 extern TGAImageRec texture;
51 extern int oldmainmenu;
52 extern bool visibleloading;
53 extern int loadscreencolor;
54 extern float flashamount,flashr,flashg,flashb;
55 extern int flashdelay;
56 extern int whichjointstartarray[26];
57 extern int whichjointendarray[26];
58 extern int difficulty;
59 extern float tintr,tintg,tintb;
60 extern float slomospeed;
61 extern char mapname[256];
62 extern bool gamestarted;
64 extern int numaccounts;
65 extern int accountactive;
66 extern int accountdifficulty[10];
67 extern int accountprogress[10];
68 extern float accountpoints[10];
69 extern float accounthighscore[10][50];
70 extern float accountfasttime[10][50];
71 extern bool accountunlocked[10][60];
72 extern char accountname[10][256];
74 extern int numdialogues;
75 extern int numdialogueboxes[20];
76 extern int dialoguetype[20];
77 extern int dialogueboxlocation[20][20];
78 extern float dialogueboxcolor[20][20][3];
79 extern int dialogueboxsound[20][20];
80 extern char dialoguetext[20][20][128];
81 extern char dialoguename[20][20][64];
82 extern XYZ dialoguecamera[20][20];
83 extern float dialoguecamerarotation[20][20];
84 extern float dialoguecamerarotation2[20][20];
85 extern int indialogue;
86 extern int whichdialogue;
87 extern float dialoguetime;
89 extern float accountcampaignhighscore[10];
90 extern float accountcampaignfasttime[10];
91 extern float accountcampaignscore[10];
92 extern float accountcampaigntime[10];
94 extern int accountcampaignchoicesmade[10];
95 extern int accountcampaignchoices[10][5000];
97 extern FSOUND_STREAM * strm[10];
99 extern "C" void PlaySoundEx(int channel, FSOUND_SAMPLE *sptr, FSOUND_DSPUNIT *dsp, signed char startpaused);
100 extern "C" void PlayStreamEx(int chan, FSOUND_STREAM *sptr, FSOUND_DSPUNIT *dsp, signed char startpaused);
102 Game::TextureList Game::textures;
111 accountcampaignchoicesmade[accountactive]=0;
112 accountcampaignscore[accountactive]=0;
113 accountcampaigntime[accountactive]=0;
118 sprintf (mapname, ":Data:Users");
121 tfile=fopen( mapname, "wb" );
124 fpackf(tfile, "Bi", numaccounts);
125 fpackf(tfile, "Bi", accountactive);
128 for(i=0;i<numaccounts;i++)
130 fpackf(tfile, "Bf", accountcampaigntime[i]);
131 fpackf(tfile, "Bf", accountcampaignscore[i]);
132 fpackf(tfile, "Bf", accountcampaignfasttime[i]);
133 fpackf(tfile, "Bf", accountcampaignhighscore[i]);
134 fpackf(tfile, "Bi", accountdifficulty[i]);
135 fpackf(tfile, "Bi", accountprogress[i]);
136 fpackf(tfile, "Bi", accountcampaignchoicesmade[i]);
137 for(j=0;j<accountcampaignchoicesmade[i];j++)
139 fpackf(tfile, "Bi", accountcampaignchoices[i][j]);
141 fpackf(tfile, "Bf", accountpoints[i]);
144 fpackf(tfile, "Bf", accounthighscore[i][j]);
145 fpackf(tfile, "Bf", accountfasttime[i][j]);
149 fpackf(tfile, "Bb", accountunlocked[i][j]);
151 fpackf(tfile, "Bi", strlen(accountname[i]));
152 if(strlen(accountname[i])>0)
154 for(j=0;j<(int)strlen(accountname[i]);j++)
156 fpackf(tfile, "Bb", accountname[i][j]);
165 TexIter it = textures.begin();
166 for (; it != textures.end(); ++it)
168 if (glIsTexture(it->second))
169 glDeleteTextures(1, &it->second);
173 LOG("Shutting down sound system...");
175 FSOUND_StopSound(FSOUND_ALL);
177 #define streamcount 20
178 #define samplecount 100
180 for (i=0; i < samplecount; ++i)
182 FSOUND_Sample_Free(samp[i]);
185 for (i=0; i < streamcount; ++i)
187 FSOUND_Stream_Close(strm[i]);
199 //void Game::LoadSounds();
200 void Game::LoadSounds()
204 LOG(std::string("Loading sounds..."));
206 FSOUND_3D_SetDopplerFactor(0);
208 FSOUND_SetSFXMasterVolume((int)(volume*255));
210 samp[footstepsound] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:footstepsnow1.ogg", FSOUND_HW3D, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
211 FSOUND_Sample_SetMinMaxDistance(samp[footstepsound], 4.0f, 1000.0f);
213 samp[footstepsound2] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:footstepsnow2.ogg", FSOUND_HW3D, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
214 FSOUND_Sample_SetMinMaxDistance(samp[footstepsound2], 4.0f, 1000.0f);
216 samp[footstepsound3] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:footstepstone1.ogg", FSOUND_HW3D, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
217 FSOUND_Sample_SetMinMaxDistance(samp[footstepsound3], 4.0f, 1000.0f);
219 samp[footstepsound4] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:footstepstone2.ogg", FSOUND_HW3D, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
220 FSOUND_Sample_SetMinMaxDistance(samp[footstepsound4], 4.0f, 1000.0f);
222 samp[landsound] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:land.ogg", FSOUND_HW3D, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
223 FSOUND_Sample_SetMinMaxDistance(samp[landsound], 4.0f, 1000.0f);
225 samp[jumpsound] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:jump.ogg", FSOUND_HW3D, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
226 FSOUND_Sample_SetMinMaxDistance(samp[jumpsound], 4.0f, 1000.0f);
228 samp[hawksound] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:hawk.ogg", FSOUND_HW3D, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
229 FSOUND_Sample_SetMinMaxDistance(samp[hawksound], 40.0f, 10000.0f);
231 samp[whooshsound] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:whoosh.ogg", FSOUND_HW3D, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
232 FSOUND_Sample_SetMinMaxDistance(samp[whooshsound], 4.0f, 1000.0f);
233 FSOUND_Sample_SetMode(samp[whooshsound], FSOUND_LOOP_NORMAL);
235 samp[landsound1] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:land1.ogg", FSOUND_HW3D, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
236 FSOUND_Sample_SetMinMaxDistance(samp[landsound1], 4.0f, 1000.0f);
240 samp[landsound2] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:land2.ogg", FSOUND_HW3D, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
241 FSOUND_Sample_SetMinMaxDistance(samp[landsound2], 4.0f, 1000.0f);
243 samp[breaksound] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:broken.ogg", FSOUND_HW3D, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
244 FSOUND_Sample_SetMinMaxDistance(samp[breaksound], 8.0f, 2000.0f);
246 samp[lowwhooshsound] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:Lowwhoosh.ogg", FSOUND_HW3D, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
247 FSOUND_Sample_SetMinMaxDistance(samp[lowwhooshsound], 8.0f, 2000.0f);
249 samp[midwhooshsound] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:midwhoosh.ogg", FSOUND_HW3D, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
250 FSOUND_Sample_SetMinMaxDistance(samp[midwhooshsound], 8.0f, 2000.0f);
252 samp[highwhooshsound] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:highwhoosh.ogg", FSOUND_HW3D, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
253 FSOUND_Sample_SetMinMaxDistance(samp[highwhooshsound], 8.0f, 2000.0f);
255 samp[movewhooshsound] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:movewhoosh.ogg", FSOUND_HW3D, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
256 FSOUND_Sample_SetMinMaxDistance(samp[movewhooshsound], 8.0f, 2000.0f);
258 samp[heavyimpactsound] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:heavyimpact.ogg", FSOUND_HW3D, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
259 FSOUND_Sample_SetMinMaxDistance(samp[heavyimpactsound], 8.0f, 2000.0f);
261 samp[whooshhitsound] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:Whooshhit.ogg", FSOUND_HW3D, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
262 FSOUND_Sample_SetMinMaxDistance(samp[whooshhitsound], 8.0f, 2000.0f);
264 samp[thudsound] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:thud.ogg", FSOUND_HW3D, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
265 FSOUND_Sample_SetMinMaxDistance(samp[thudsound], 8.0f, 2000.0f);
267 samp[alarmsound] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:alarm.ogg", FSOUND_2D, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
268 FSOUND_Sample_SetMinMaxDistance(samp[alarmsound], 8.0f, 2000.0f);
270 samp[breaksound2] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:break.ogg", FSOUND_HW3D, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
271 FSOUND_Sample_SetMinMaxDistance(samp[breaksound2], 8.0f, 2000.0f);
273 samp[knifedrawsound] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:knifedraw.ogg", FSOUND_HW3D, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
274 FSOUND_Sample_SetMinMaxDistance(samp[knifedrawsound], 8.0f, 2000.0f);
276 samp[knifesheathesound] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:knifesheathe.ogg", FSOUND_HW3D, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
277 FSOUND_Sample_SetMinMaxDistance(samp[knifesheathesound], 8.0f, 2000.0f);
279 samp[fleshstabsound] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:Fleshstab.ogg", FSOUND_HW3D, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
280 FSOUND_Sample_SetMinMaxDistance(samp[fleshstabsound], 8.0f, 2000.0f);
282 samp[fleshstabremovesound] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:Fleshstabremove.ogg", FSOUND_HW3D, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
283 FSOUND_Sample_SetMinMaxDistance(samp[fleshstabremovesound], 8.0f, 2000.0f);
285 samp[knifeswishsound] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:knifeswish.ogg", FSOUND_HW3D, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
286 FSOUND_Sample_SetMinMaxDistance(samp[knifeswishsound], 8.0f, 2000.0f);
288 samp[knifeslicesound] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:knifeslice.ogg", FSOUND_HW3D, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
289 FSOUND_Sample_SetMinMaxDistance(samp[knifeslicesound], 8.0f, 2000.0f);
291 samp[swordslicesound] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:swordslice.ogg", FSOUND_HW3D, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
292 FSOUND_Sample_SetMinMaxDistance(samp[swordslicesound], 8.0f, 2000.0f);
294 samp[skidsound] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:skid.ogg", FSOUND_HW3D, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
295 FSOUND_Sample_SetMinMaxDistance(samp[skidsound], 8.0f, 2000.0f);
297 samp[snowskidsound] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:snowskid.ogg", FSOUND_HW3D, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
298 FSOUND_Sample_SetMinMaxDistance(samp[snowskidsound], 8.0f, 2000.0f);
300 samp[bushrustle] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:bushrustle.ogg", FSOUND_HW3D, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
301 FSOUND_Sample_SetMinMaxDistance(samp[bushrustle], 4.0f, 1000.0f);
303 samp[clank1sound] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:clank1.ogg", FSOUND_HW3D, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
304 FSOUND_Sample_SetMinMaxDistance(samp[clank1sound], 8.0f, 2000.0f);
306 samp[clank2sound] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:clank2.ogg", FSOUND_HW3D, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
307 FSOUND_Sample_SetMinMaxDistance(samp[clank2sound], 8.0f, 2000.0f);
309 samp[clank3sound] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:clank3.ogg", FSOUND_HW3D, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
310 FSOUND_Sample_SetMinMaxDistance(samp[clank3sound], 8.0f, 2000.0f);
312 samp[clank4sound] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:clank4.ogg", FSOUND_HW3D, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
313 FSOUND_Sample_SetMinMaxDistance(samp[clank4sound], 8.0f, 2000.0f);
315 samp[consolesuccesssound] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:consolesuccess.ogg", FSOUND_2D, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
316 FSOUND_Sample_SetMinMaxDistance(samp[consolesuccesssound], 4.0f, 1000.0f);
318 samp[consolefailsound] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:consolefail.ogg", FSOUND_2D, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
319 FSOUND_Sample_SetMinMaxDistance(samp[consolefailsound], 4.0f, 1000.0f);
321 samp[metalhitsound] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:MetalHit.ogg", FSOUND_HW3D, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
322 FSOUND_Sample_SetMinMaxDistance(samp[metalhitsound], 8.0f, 2000.0f);
324 samp[clawslicesound] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:clawslice.ogg", FSOUND_HW3D, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
325 FSOUND_Sample_SetMinMaxDistance(samp[clawslicesound], 8.0f, 2000.0f);
327 samp[splattersound] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:splatter.ogg", FSOUND_HW3D, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
328 FSOUND_Sample_SetMinMaxDistance(samp[splattersound], 8.0f, 2000.0f);
330 samp[growlsound] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:Growl.ogg", FSOUND_HW3D, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
331 FSOUND_Sample_SetMinMaxDistance(samp[growlsound], 1000.0f, 2000.0f);
333 samp[growl2sound] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:Growl2.ogg", FSOUND_HW3D, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
334 FSOUND_Sample_SetMinMaxDistance(samp[growl2sound], 1000.0f, 2000.0f);
336 samp[barksound] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:bark.ogg", FSOUND_HW3D, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
337 FSOUND_Sample_SetMinMaxDistance(samp[barksound], 1000.0f, 2000.0f);
339 samp[bark2sound] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:bark2.ogg", FSOUND_HW3D, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
340 FSOUND_Sample_SetMinMaxDistance(samp[bark2sound], 1000.0f, 2000.0f);
342 samp[bark3sound] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:bark3.ogg", FSOUND_HW3D, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
343 FSOUND_Sample_SetMinMaxDistance(samp[bark3sound], 1000.0f, 2000.0f);
345 samp[snarlsound] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:snarl.ogg", FSOUND_HW3D, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
346 FSOUND_Sample_SetMinMaxDistance(samp[snarlsound], 1000.0f, 2000.0f);
349 samp[snarl2sound] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:snarl2.ogg", FSOUND_HW3D, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
350 FSOUND_Sample_SetMinMaxDistance(samp[snarl2sound], 1000.0f, 2000.0f);
352 samp[barkgrowlsound] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:barkgrowl.ogg", FSOUND_HW3D, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
353 FSOUND_Sample_SetMinMaxDistance(samp[barkgrowlsound], 1000.0f, 2000.0f);
355 samp[rabbitattacksound] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:rabbitattack.ogg", FSOUND_HW3D, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
356 FSOUND_Sample_SetMinMaxDistance(samp[rabbitattacksound], 1000.0f, 2000.0f);
358 samp[rabbitattack2sound] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:rabbitattack2.ogg", FSOUND_HW3D, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
359 FSOUND_Sample_SetMinMaxDistance(samp[rabbitattack2sound], 1000.0f, 2000.0f);
361 samp[rabbitattack3sound] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:rabbitattack3.ogg", FSOUND_HW3D, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
362 FSOUND_Sample_SetMinMaxDistance(samp[rabbitattack3sound], 1000.0f, 2000.0f);
364 samp[rabbitattack4sound] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:rabbitattack4.ogg", FSOUND_HW3D, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
365 FSOUND_Sample_SetMinMaxDistance(samp[rabbitattack4sound], 1000.0f, 2000.0f);
367 samp[rabbitpainsound] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:rabbitpain.ogg", FSOUND_HW3D, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
368 FSOUND_Sample_SetMinMaxDistance(samp[rabbitpainsound], 1000.0f, 2000.0f);
370 samp[rabbitpain1sound] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:rabbitpain2.ogg", FSOUND_HW3D, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
371 FSOUND_Sample_SetMinMaxDistance(samp[rabbitpain1sound], 1000.0f, 2000.0f);
373 /*samp[rabbitpain2sound] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:rabbitpain2.ogg", FSOUND_HW3D, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
374 FSOUND_Sample_SetMinMaxDistance(samp[rabbitpain2sound], 1000.0f, 2000.0f);
376 samp[rabbitchitter] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:rabbitchitter.ogg", FSOUND_HW3D, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
377 FSOUND_Sample_SetMinMaxDistance(samp[rabbitchitter], 1000.0f, 2000.0f);
379 samp[rabbitchitter2] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:rabbitchitter2.ogg", FSOUND_HW3D, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
380 FSOUND_Sample_SetMinMaxDistance(samp[rabbitchitter2], 1000.0f, 2000.0f);
382 samp[swordstaffsound] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:swordstaff.ogg", FSOUND_HW3D, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
383 FSOUND_Sample_SetMinMaxDistance(samp[swordstaffsound], 8.0f, 2000.0f);
385 samp[staffbodysound] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:staffbody.ogg", FSOUND_HW3D, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
386 FSOUND_Sample_SetMinMaxDistance(samp[staffbodysound], 8.0f, 2000.0f);
388 samp[staffheadsound] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:staffhead.ogg", FSOUND_HW3D, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
389 FSOUND_Sample_SetMinMaxDistance(samp[staffheadsound], 8.0f, 2000.0f);
391 samp[staffbreaksound] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:staffbreak.wav", FSOUND_HW3D, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
392 FSOUND_Sample_SetMinMaxDistance(samp[staffbreaksound], 8.0f, 2000.0f);
398 void Game::LoadTexture(char *fileName, GLuint *textureid,int mipmap, bool hasalpha)
404 LOG(std::string("Loading texture...") + fileName);
406 unsigned char fileNamep[256];
407 CopyCStringToPascal(fileName,fileNamep);
409 upload_image( fileNamep ,hasalpha);
411 // std::string fname(fileName);
412 // std::transform(fname.begin(), fname.end(), tolower);
413 // TexIter it = textures.find(fname);
417 //if(textures.end() == it)
420 if ( texture.bpp == 24 )
425 glPixelStorei( GL_UNPACK_ALIGNMENT, 1 );
427 if(!*textureid)glGenTextures( 1, textureid );
428 glTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE );
430 glBindTexture( GL_TEXTURE_2D, *textureid);
431 glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR );
432 if(trilinear)if(mipmap)glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR );
433 if(!trilinear)if(mipmap)glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_NEAREST );
434 if(!mipmap)glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR );
436 //glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, texture.sizeX, texture.sizeY, 0,
437 // GL_BGRA_EXT, GL_UNSIGNED_INT_8_8_8_8_REV, texture.data);
439 //gluBuild2DMipmaps( GL_TEXTURE_2D, type, texture.sizeX, texture.sizeY, GL_BGRA_EXT, GL_UNSIGNED_INT_8_8_8_8_REV, texture.data );
441 gluBuild2DMipmaps( GL_TEXTURE_2D, type, texture.sizeX, texture.sizeY, type, GL_UNSIGNED_BYTE, texture.data );
443 // textures.insert(std::make_pair(fname, *textureid));
447 // *textureid = it->second;
451 void Game::LoadTextureSave(char *fileName, GLuint *textureid,int mipmap,GLubyte *array, int *skinsize)
459 LOG(std::string("Loading texture (S)...") + fileName);
462 unsigned char fileNamep[256];
463 CopyCStringToPascal(fileName,fileNamep);
465 upload_image( fileNamep ,0);
466 //LoadTGA( fileName );
468 // std::string fname(fileName);
469 // std::transform(fname.begin(), fname.end(), tolower);
470 // TexIter it = textures.find(fname);
474 //if(textures.end() == it)
476 bytesPerPixel=texture.bpp/8;
479 if ( texture.bpp == 24 )
484 glPixelStorei( GL_UNPACK_ALIGNMENT, 1 );
486 if(!*textureid)glGenTextures( 1, textureid );
487 glTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE );
489 glBindTexture( GL_TEXTURE_2D, *textureid);
490 glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR );
491 if(trilinear)if(mipmap)glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR );
492 if(!trilinear)if(mipmap)glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_NEAREST );
493 if(!mipmap)glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR );
496 for(i=0;i<(int)(texture.sizeY*texture.sizeX*bytesPerPixel);i++){
497 if((i+1)%4||type==GL_RGB){
498 array[tempnum]=texture.data[i];
503 *skinsize=texture.sizeX;
505 gluBuild2DMipmaps( GL_TEXTURE_2D, type, texture.sizeX, texture.sizeY, GL_RGB, GL_UNSIGNED_BYTE, array );
507 // textures.insert(std::make_pair(fname, *textureid));
511 // *textureid = it->second;
515 void Game::LoadSave(char *fileName, GLuint *textureid,bool mipmap,GLubyte *array, int *skinsize)
522 LOG(std::string("Loading (S)...") + fileName);
525 float temptexdetail=texdetail;
527 //upload_image( fileName );
528 //LoadTGA( fileName );
530 unsigned char fileNamep[256];
531 CopyCStringToPascal(fileName,fileNamep);
533 upload_image( fileNamep ,0);
534 texdetail=temptexdetail;
538 bytesPerPixel=texture.bpp/8;
541 for(i=0;i<(int)(texture.sizeY*texture.sizeX*bytesPerPixel);i++){
542 if((i+1)%4||bytesPerPixel==3){
543 array[tempnum]=texture.data[i];
550 bool Game::AddClothes(char *fileName, GLuint *textureid,bool mipmap,GLubyte *array, int *skinsize)
557 //upload_image( fileName );
558 //LoadTGA( fileName );
560 unsigned char fileNamep[256];
561 CopyCStringToPascal(fileName,fileNamep);
564 opened=upload_image( fileNamep ,1);
577 bytesPerPixel=texture.bpp/8;
581 for(i=0;i<(int)(texture.sizeY*texture.sizeX*bytesPerPixel);i++){
582 if(bytesPerPixel==3)alphanum=255;
583 else if((i+1)%4==0)alphanum=texture.data[i];
585 if((i+1)%4||bytesPerPixel==3){
586 if((i%4)==0)texture.data[i]*=tintr;
587 if((i%4)==1)texture.data[i]*=tintg;
588 if((i%4)==2)texture.data[i]*=tintb;
589 array[tempnum]=(float)array[tempnum]*(1-alphanum/255)+(float)texture.data[i]*(alphanum/255);
599 //***************> ResizeGLScene() <******/
600 GLvoid Game::ReSizeGLScene(float fov, float pnear)
607 glViewport(0,0,screenwidth,screenheight);
609 glMatrixMode(GL_PROJECTION);
612 gluPerspective(fov,(GLfloat)screenwidth/(GLfloat)screenheight,pnear,viewdistance);
614 glMatrixMode(GL_MODELVIEW);
618 void Game::LoadingScreen()
620 static float loadprogress,minprogress,maxprogress;
621 static AbsoluteTime time = {0,0};
622 static AbsoluteTime frametime = {0,0};
623 AbsoluteTime currTime = UpTime ();
624 double deltaTime = (float) AbsoluteDeltaToDuration (currTime, frametime);
626 if (0 > deltaTime) // if negative microseconds
627 deltaTime /= -1000000.0;
628 else // else milliseconds
631 multiplier=deltaTime;
632 if(multiplier<.001)multiplier=.001;
633 if(multiplier>10)multiplier=10;
635 frametime = currTime; // reset for next time interval
640 glClearColor(0,0,0,1);
641 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
644 loadtime+=multiplier*4;
646 loadprogress=loadtime;
647 if(loadprogress>100)loadprogress=100;
649 //loadprogress=abs(Random()%100);
653 glEnable(GL_TEXTURE_2D);
654 glBindTexture( GL_TEXTURE_2D, loadscreentexture);
655 glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT );
656 glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT );
657 glDisable(GL_DEPTH_TEST); // Disables Depth Testing
658 glDisable(GL_CULL_FACE);
659 glDisable(GL_LIGHTING);
661 glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
662 glPushMatrix(); // Store The Projection Matrix
663 glLoadIdentity(); // Reset The Projection Matrix
664 glOrtho(0,screenwidth,0,screenheight,-100,100); // Set Up An Ortho Screen
665 glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
666 glPushMatrix(); // Store The Modelview Matrix
667 glLoadIdentity(); // Reset The Modelview Matrix
668 glTranslatef(screenwidth/2,screenheight/2,0);
669 glScalef((float)screenwidth/2,(float)screenheight/2,1);
670 glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
672 glColor4f(loadprogress/100,loadprogress/100,loadprogress/100,1);
673 //glColor4f(1,1,1,1);
674 /*if(loadscreencolor==0)glColor4f(1,1,1,1);
675 if(loadscreencolor==1)glColor4f(1,0,0,1);
676 if(loadscreencolor==2)glColor4f(0,1,0,1);
677 if(loadscreencolor==3)glColor4f(0,0,1,1);
678 if(loadscreencolor==4)glColor4f(1,1,0,1);
679 if(loadscreencolor==5)glColor4f(1,0,1,1);
682 //glScalef(.25,.25,.25);
684 glTexCoord2f(.1-loadprogress/100,0+loadprogress/100+.3);
685 glVertex3f(-1, -1, 0.0f);
686 glTexCoord2f(.1-loadprogress/100,0+loadprogress/100+.3);
687 glVertex3f(1, -1, 0.0f);
688 glTexCoord2f(.1-loadprogress/100,1+loadprogress/100+.3);
689 glVertex3f(1, 1, 0.0f);
690 glTexCoord2f(.1-loadprogress/100,1+loadprogress/100+.3);
691 glVertex3f(-1, 1, 0.0f);
696 //glScalef(.25,.25,.25);
698 glTexCoord2f(.4+loadprogress/100,0+loadprogress/100);
699 glVertex3f(-1, -1, 0.0f);
700 glTexCoord2f(.4+loadprogress/100,0+loadprogress/100);
701 glVertex3f(1, -1, 0.0f);
702 glTexCoord2f(.4+loadprogress/100,1+loadprogress/100);
703 glVertex3f(1, 1, 0.0f);
704 glTexCoord2f(.4+loadprogress/100,1+loadprogress/100);
705 glVertex3f(-1, 1, 0.0f);
708 glDisable(GL_TEXTURE_2D);
709 glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
710 glPopMatrix(); // Restore The Old Projection Matrix
711 glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
712 glPopMatrix(); // Restore The Old Projection Matrix
716 glEnable(GL_TEXTURE_2D);
717 glBindTexture( GL_TEXTURE_2D, loadscreentexture);
718 glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT );
719 glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT );
720 glDisable(GL_DEPTH_TEST); // Disables Depth Testing
721 glDisable(GL_CULL_FACE);
722 glDisable(GL_LIGHTING);
724 glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
725 glPushMatrix(); // Store The Projection Matrix
726 glLoadIdentity(); // Reset The Projection Matrix
727 glOrtho(0,screenwidth,0,screenheight,-100,100); // Set Up An Ortho Screen
728 glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
729 glPushMatrix(); // Store The Modelview Matrix
730 glLoadIdentity(); // Reset The Modelview Matrix
731 glTranslatef(screenwidth/2,screenheight/2,0);
732 glScalef((float)screenwidth/2*(1.5-(loadprogress)/200),(float)screenheight/2*(1.5-(loadprogress)/200),1);
733 glBlendFunc(GL_SRC_ALPHA,GL_ONE);
735 //glColor4f(loadprogress/100,loadprogress/100,loadprogress/100,1);
736 glColor4f(loadprogress/100,loadprogress/100,loadprogress/100,1);
737 /*if(loadscreencolor==0)glColor4f(1,1,1,1);
738 if(loadscreencolor==1)glColor4f(1,0,0,1);
739 if(loadscreencolor==2)glColor4f(0,1,0,1);
740 if(loadscreencolor==3)glColor4f(0,0,1,1);
741 if(loadscreencolor==4)glColor4f(1,1,0,1);
742 if(loadscreencolor==5)glColor4f(1,0,1,1);
745 //glScalef(.25,.25,.25);
747 glTexCoord2f(0+.5,0+.5);
748 glVertex3f(-1, -1, 0.0f);
749 glTexCoord2f(1+.5,0+.5);
750 glVertex3f(1, -1, 0.0f);
751 glTexCoord2f(1+.5,1+.5);
752 glVertex3f(1, 1, 0.0f);
753 glTexCoord2f(0+.5,1+.5);
754 glVertex3f(-1, 1, 0.0f);
757 glDisable(GL_TEXTURE_2D);
758 glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
759 glPopMatrix(); // Restore The Old Projection Matrix
760 glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
761 glPopMatrix(); // Restore The Old Projection Matrix
765 glEnable(GL_TEXTURE_2D);
766 glBindTexture( GL_TEXTURE_2D, loadscreentexture);
767 glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT );
768 glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT );
769 glDisable(GL_DEPTH_TEST); // Disables Depth Testing
770 glDisable(GL_CULL_FACE);
771 glDisable(GL_LIGHTING);
773 glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
774 glPushMatrix(); // Store The Projection Matrix
775 glLoadIdentity(); // Reset The Projection Matrix
776 glOrtho(0,screenwidth,0,screenheight,-100,100); // Set Up An Ortho Screen
777 glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
778 glPushMatrix(); // Store The Modelview Matrix
779 glLoadIdentity(); // Reset The Modelview Matrix
780 glTranslatef(screenwidth/2,screenheight/2,0);
781 glScalef((float)screenwidth/2*(100+loadprogress)/100,(float)screenheight/2*(100+loadprogress)/100,1);
782 glBlendFunc(GL_SRC_ALPHA,GL_ONE);
784 glColor4f(loadprogress/100,loadprogress/100,loadprogress/100,.4);
786 //glScalef(.25,.25,.25);
788 glTexCoord2f(0+.2,0+.8);
789 glVertex3f(-1, -1, 0.0f);
790 glTexCoord2f(1+.2,0+.8);
791 glVertex3f(1, -1, 0.0f);
792 glTexCoord2f(1+.2,1+.8);
793 glVertex3f(1, 1, 0.0f);
794 glTexCoord2f(0+.2,1+.8);
795 glVertex3f(-1, 1, 0.0f);
798 glDisable(GL_TEXTURE_2D);
799 glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
800 glPopMatrix(); // Restore The Old Projection Matrix
801 glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
802 glPopMatrix(); // Restore The Old Projection Matrix
808 glEnable(GL_TEXTURE_2D);
809 static char string[256]="";
810 sprintf (string, "LOADING... %d%",(int)loadprogress);
812 text.glPrint(280-280*loadprogress/100/2/4,125-125*loadprogress/100/2/4,string,1,1+loadprogress/100,640,480);
813 glColor4f(1.2-loadprogress/100,1.2-loadprogress/100,1.2-loadprogress/100,1);
814 text.glPrint(280,125,string,1,1,640,480);
818 if(flashamount>1)flashamount=1;
819 if(flashdelay<=0)flashamount-=multiplier;
821 if(flashamount<0)flashamount=0;
822 glDisable(GL_DEPTH_TEST); // Disables Depth Testing
823 glDisable(GL_CULL_FACE);
824 glDisable(GL_LIGHTING);
825 glDisable(GL_TEXTURE_2D);
827 glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
828 glPushMatrix(); // Store The Projection Matrix
829 glLoadIdentity(); // Reset The Projection Matrix
830 glOrtho(0,screenwidth,0,screenheight,-100,100); // Set Up An Ortho Screen
831 glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
832 glPushMatrix(); // Store The Modelview Matrix
833 glLoadIdentity(); // Reset The Modelview Matrix
834 glScalef(screenwidth,screenheight,1);
835 glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
837 glColor4f(flashr,flashg,flashb,flashamount);
839 glVertex3f(0, 0, 0.0f);
840 glVertex3f(256, 0, 0.0f);
841 glVertex3f(256, 256, 0.0f);
842 glVertex3f(0, 256, 0.0f);
844 glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
845 glPopMatrix(); // Restore The Old Projection Matrix
846 glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
847 glPopMatrix(); // Restore The Old Projection Matrix
848 glEnable(GL_DEPTH_TEST); // Enables Depth Testing
849 glEnable(GL_CULL_FACE);
857 aglSwapBuffers(gaglContext);
864 void Game::FadeLoadingScreen(float howmuch)
866 static float loadprogress,minprogress,maxprogress;
871 glClearColor(0,0,0,1);
872 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
874 loadprogress=howmuch;
876 //loadprogress=abs(Random()%100);
880 //glEnable(GL_TEXTURE_2D);
881 glDisable(GL_TEXTURE_2D);
882 //glBindTexture( GL_TEXTURE_2D, loadscreentexture);
883 glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE );
884 glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE );
885 glDisable(GL_DEPTH_TEST); // Disables Depth Testing
886 glDisable(GL_CULL_FACE);
887 glDisable(GL_LIGHTING);
889 glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
890 glPushMatrix(); // Store The Projection Matrix
891 glLoadIdentity(); // Reset The Projection Matrix
892 glOrtho(0,screenwidth,0,screenheight,-100,100); // Set Up An Ortho Screen
893 glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
894 glPushMatrix(); // Store The Modelview Matrix
895 glLoadIdentity(); // Reset The Modelview Matrix
896 glTranslatef(screenwidth/2,screenheight/2,0);
897 glScalef((float)screenwidth/2,(float)screenheight/2,1);
898 glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
900 glColor4f(loadprogress/100,0,0,1);
901 /*if(loadscreencolor==0)glColor4f(1,1,1,1);
902 if(loadscreencolor==1)glColor4f(1,0,0,1);
903 if(loadscreencolor==2)glColor4f(0,1,0,1);
904 if(loadscreencolor==3)glColor4f(0,0,1,1);
905 if(loadscreencolor==4)glColor4f(1,1,0,1);
906 if(loadscreencolor==5)glColor4f(1,0,1,1);
909 //glScalef(.25,.25,.25);
912 glVertex3f(-1, -1, 0.0f);
914 glVertex3f(1, -1, 0.0f);
916 glVertex3f(1, 1, 0.0f);
918 glVertex3f(-1, 1, 0.0f);
921 glDisable(GL_TEXTURE_2D);
922 glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
923 glPopMatrix(); // Restore The Old Projection Matrix
924 glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
925 glPopMatrix(); // Restore The Old Projection Matrix
930 glEnable(GL_TEXTURE_2D);
931 static char string[256]="";
932 sprintf (string, "LOADING... %d%",(int)loadprogress);
934 text.glPrint(280-280*loadprogress/100/2/4,125-125*loadprogress/100/2/4,string,1,1+loadprogress/100,640,480);
935 glColor4f(1.2-loadprogress/100,1.2-loadprogress/100,1.2-loadprogress/100,1);
936 text.glPrint(280,125,string,1,1,640,480);
941 aglSwapBuffers(gaglContext); // send swap command
948 void Game::InitGame()
951 ProcessSerialNumber PSN;
952 ProcessInfoRec pinfo;
955 /* set up process serial number */
956 PSN.highLongOfPSN = 0;
957 PSN.lowLongOfPSN = kCurrentProcess;
958 /* set up info block */
959 pinfo.processInfoLength = sizeof(pinfo);
960 pinfo.processName = NULL;
961 pinfo.processAppSpec = &pspec;
962 /* grab the vrefnum and directory */
963 err = GetProcessInformation(&PSN, &pinfo);
965 vRefNum = pspec.vRefNum;
976 numchallengelevels=14;
980 /*char tempstring[256];
981 sprintf (tempstring, "%s", registrationname);
987 longnum = MD5_string ( tempstring);
988 //longnum = 1111111111111111;
989 num1 = longnum/100000000;
990 num2 = longnum%100000000;
991 sprintf (tempstring, "%d-%d-%d-%d", num1/10000, num1%10000, num2/10000, num2%10000);
995 tfile=fopen( ":Data:Sounds:flame.ogg", "rb" );
1006 funpackf(tfile, "Bb", ®istered);
1009 funpackf(tfile, "Bi", &numchars);
1012 for(j=0;j<numchars;j++)
1014 funpackf(tfile, "Bb", ®istrationname[j]);
1016 registrationname[numchars]='\0';
1017 funpackf(tfile, "Bi", &num1);
1018 funpackf(tfile, "Bi", &num2);
1019 longnum=num2+num1*100000000;
1021 char tempstring[256];
1022 sprintf (tempstring, "%s-windows", registrationname);
1023 longnuma = MD5_string ( tempstring);
1024 num1a = longnuma/100000000;
1025 num2a = longnuma%100000000;
1026 //if(num1a==num1&&num2a==num2)registered=1;
1027 if(numchars>2)registered=1;
1037 sprintf (mapname, ":Data:Users");
1038 tfile=fopen( mapname, "rb" );
1041 funpackf(tfile, "Bi", &numaccounts);
1042 funpackf(tfile, "Bi", &accountactive);
1045 for(i=0;i<numaccounts;i++)
1047 funpackf(tfile, "Bf", &accountcampaigntime[i]);
1048 funpackf(tfile, "Bf", &accountcampaignscore[i]);
1049 funpackf(tfile, "Bf", &accountcampaignfasttime[i]);
1050 funpackf(tfile, "Bf", &accountcampaignhighscore[i]);
1051 funpackf(tfile, "Bi", &accountdifficulty[i]);
1052 funpackf(tfile, "Bi", &accountprogress[i]);
1053 funpackf(tfile, "Bi", &accountcampaignchoicesmade[i]);
1054 for(j=0;j<accountcampaignchoicesmade[i];j++)
1056 funpackf(tfile, "Bi", &accountcampaignchoices[i][j]);
1057 if (accountcampaignchoices[i][j] >= 10)
1059 accountcampaignchoices[i][j] = 0;
1062 funpackf(tfile, "Bf", &accountpoints[i]);
1065 funpackf(tfile, "Bf", &accounthighscore[i][j]);
1066 funpackf(tfile, "Bf", &accountfasttime[i][j]);
1070 funpackf(tfile, "Bb", &accountunlocked[i][j]);
1073 funpackf(tfile, "Bi", &temp);
1078 funpackf(tfile, "Bb", &accountname[i][j]);
1091 whichjointstartarray[0]=righthip;
1092 whichjointendarray[0]=rightfoot;
1094 whichjointstartarray[1]=righthip;
1095 whichjointendarray[1]=rightankle;
1097 whichjointstartarray[2]=righthip;
1098 whichjointendarray[2]=rightknee;
1100 whichjointstartarray[3]=rightknee;
1101 whichjointendarray[3]=rightankle;
1103 whichjointstartarray[4]=rightankle;
1104 whichjointendarray[4]=rightfoot;
1106 whichjointstartarray[5]=lefthip;
1107 whichjointendarray[5]=leftfoot;
1109 whichjointstartarray[6]=lefthip;
1110 whichjointendarray[6]=leftankle;
1112 whichjointstartarray[7]=lefthip;
1113 whichjointendarray[7]=leftknee;
1115 whichjointstartarray[8]=leftknee;
1116 whichjointendarray[8]=leftankle;
1118 whichjointstartarray[9]=leftankle;
1119 whichjointendarray[9]=leftfoot;
1121 whichjointstartarray[10]=abdomen;
1122 whichjointendarray[10]=rightshoulder;
1124 whichjointstartarray[11]=abdomen;
1125 whichjointendarray[11]=rightelbow;
1127 whichjointstartarray[12]=abdomen;
1128 whichjointendarray[12]=rightwrist;
1130 whichjointstartarray[13]=abdomen;
1131 whichjointendarray[13]=righthand;
1133 whichjointstartarray[14]=rightshoulder;
1134 whichjointendarray[14]=rightelbow;
1136 whichjointstartarray[15]=rightelbow;
1137 whichjointendarray[15]=rightwrist;
1139 whichjointstartarray[16]=rightwrist;
1140 whichjointendarray[16]=righthand;
1142 whichjointstartarray[17]=abdomen;
1143 whichjointendarray[17]=leftshoulder;
1145 whichjointstartarray[18]=abdomen;
1146 whichjointendarray[18]=leftelbow;
1148 whichjointstartarray[19]=abdomen;
1149 whichjointendarray[19]=leftwrist;
1151 whichjointstartarray[20]=abdomen;
1152 whichjointendarray[20]=lefthand;
1154 whichjointstartarray[21]=leftshoulder;
1155 whichjointendarray[21]=leftelbow;
1157 whichjointstartarray[22]=leftelbow;
1158 whichjointendarray[22]=leftwrist;
1160 whichjointstartarray[23]=leftwrist;
1161 whichjointendarray[23]=lefthand;
1163 whichjointstartarray[24]=abdomen;
1164 whichjointendarray[24]=neck;
1166 whichjointstartarray[25]=neck;
1167 whichjointendarray[25]=head;
1169 FadeLoadingScreen(0);
1173 texture.data = ( GLubyte* )malloc( 1024*1024*4 );
1175 int temptexdetail=texdetail;
1177 text.LoadFontTexture(":Data:Textures:Font.png");
1179 texdetail=temptexdetail;
1181 FadeLoadingScreen(10);
1197 for (int it = 0; it < 100; ++it)
1202 for (int it = 0; it < 20; ++it)
1207 LOG("Initializing sound system...");
1209 FSOUND_Init(44100, 32, 0);
1211 FSOUND_SetSFXMasterVolume((int)(volume*255));
1213 strm[stream_music3] = FSOUND_Stream_Open(ConvertFileName(":Data:Sounds:music3.mp3"), FSOUND_2D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=0;}
1214 // FSOUND_Sample_SetMinMaxDistance(strm[stream_music3], 4.0f, 1000.0f);
1215 FSOUND_Stream_SetMode(strm[stream_music3], FSOUND_LOOP_NORMAL);
1218 // PlaySoundEx( stream_music3, strm[stream_music3], NULL, TRUE);
1219 PlayStreamEx(stream_music3, strm[stream_music3], 0, TRUE);
1220 FSOUND_SetPaused(channels[stream_music3], FALSE);
1221 FSOUND_SetVolume(channels[stream_music3], 256);
1224 FadeLoadingScreen(20);
1227 strm[stream_wind] = FSOUND_Stream_Open(ConvertFileName(":Data:Sounds:wind.mp3"), FSOUND_2D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
1228 // FSOUND_Sample_SetMinMaxDistance(strm[stream_wind], 4.0f, 1000.0f);
1229 FSOUND_Stream_SetMode(strm[stream_wind], FSOUND_LOOP_NORMAL);
1231 FadeLoadingScreen(30);
1233 strm[stream_desertambient] = FSOUND_Stream_Open(ConvertFileName(":Data:Sounds:desertambient.mp3"), FSOUND_2D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
1234 // FSOUND_Sample_SetMinMaxDistance(strm[stream_desertambient], 4.0f, 1000.0f);
1235 FSOUND_Stream_SetMode(strm[stream_desertambient], FSOUND_LOOP_NORMAL);
1238 FadeLoadingScreen(40);
1240 samp[firestartsound] = FSOUND_Sample_Load(FSOUND_FREE, ConvertFileName(":Data:Sounds:firestart.ogg"), FSOUND_2D, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
1241 FSOUND_Sample_SetMinMaxDistance(samp[firestartsound], 8.0f, 2000.0f);
1243 strm[stream_firesound] = FSOUND_Stream_Open(":Data:Sounds:fire.ogg", FSOUND_2D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
1244 // FSOUND_Sample_SetMinMaxDistance(strm[stream_firesound], 8.0f, 2000.0f);
1245 FSOUND_Stream_SetMode(strm[stream_firesound], FSOUND_LOOP_NORMAL);
1247 FadeLoadingScreen(50);
1249 samp[fireendsound] = FSOUND_Sample_Load(FSOUND_FREE, ConvertFileName(":Data:Sounds:fireend.ogg"), FSOUND_2D, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
1250 FSOUND_Sample_SetMinMaxDistance(samp[fireendsound], 8.0f, 2000.0f);
1253 strm[stream_music1grass] = FSOUND_Stream_Open(ConvertFileName(":Data:Sounds:music1grass.mp3"), FSOUND_2D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=1;}
1254 // FSOUND_Sample_SetMinMaxDistance(strm[stream_music1grass], 4.0f, 1000.0f);
1255 FSOUND_Stream_SetMode(strm[stream_music1grass], FSOUND_LOOP_NORMAL);
1257 strm[stream_music1snow] = FSOUND_Stream_Open(ConvertFileName(":Data:Sounds:music1snow.mp3"), FSOUND_2D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=2;}
1258 // FSOUND_Sample_SetMinMaxDistance(strm[stream_music1snow], 4.0f, 1000.0f);
1259 FSOUND_Stream_SetMode(strm[stream_music1snow], FSOUND_LOOP_NORMAL);
1261 FadeLoadingScreen(60);
1263 strm[stream_music1desert] = FSOUND_Stream_Open(ConvertFileName(":Data:Sounds:music1desert.mp3"), FSOUND_2D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=3;}
1264 // FSOUND_Sample_SetMinMaxDistance(strm[stream_music1desert], 4.0f, 1000.0f);
1265 FSOUND_Stream_SetMode(strm[stream_music1desert], FSOUND_LOOP_NORMAL);
1267 FadeLoadingScreen(80);
1268 strm[stream_music2] = FSOUND_Stream_Open(ConvertFileName(":Data:Sounds:music2.ogg"), FSOUND_2D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=4;}
1269 // FSOUND_Sample_SetMinMaxDistance(strm[stream_music2], 4.0f, 1000.0f);
1270 FSOUND_Stream_SetMode(strm[stream_music2], FSOUND_LOOP_NORMAL);
1275 FadeLoadingScreen(90);
1278 LoadTexture(":Data:Textures:Cursor.png",&cursortexture,0,1);
1280 LoadTexture(":Data:Textures:MapCircle.png",&Mapcircletexture,0,1);
1281 LoadTexture(":Data:Textures:MapBox.png",&Mapboxtexture,0,1);
1282 LoadTexture(":Data:Textures:MapArrow.png",&Maparrowtexture,0,1);
1284 temptexdetail=texdetail;
1285 if(texdetail>2)texdetail=2;
1286 LoadTexture(":Data:Textures:Lugaru.png",&Mainmenuitems[0],0,0);
1287 LoadTexture(":Data:Textures:Newgame.png",&Mainmenuitems[1],0,0);
1288 LoadTexture(":Data:Textures:Options.png",&Mainmenuitems[2],0,0);
1289 LoadTexture(":Data:Textures:Quit.png",&Mainmenuitems[3],0,0);
1290 LoadTexture(":Data:Textures:World.png",&Mainmenuitems[7],0,0);
1291 LoadTexture(":Data:Textures:Eyelid.png",&Mainmenuitems[4],0,1);
1292 //LoadTexture(":Data:Textures:Eye.jpg",&Mainmenuitems[5],0,1);
1293 texdetail=temptexdetail;
1298 FadeLoadingScreen(95);
1309 newscreenwidth=screenwidth;
1310 newscreenheight=screenheight;
1315 float gLoc[3]={0,0,0};
1316 float vel[3]={0,0,0};
1317 FSOUND_Sample_SetMinMaxDistance(samp[firestartsound], 9999.0f, 99999.0f);
1318 PlaySoundEx( firestartsound, samp[firestartsound], NULL, TRUE);
1319 FSOUND_3D_SetAttributes(channels[firestartsound], gLoc, vel);
1320 FSOUND_SetVolume(channels[firestartsound], 256);
1321 FSOUND_SetPaused(channels[firestartsound], FALSE);
1322 FSOUND_Sample_SetMinMaxDistance(samp[firestartsound], 8.0f, 2000.0f);
1333 void Game::LoadStuff()
1335 static float temptexdetail;
1336 static float viewdistdetail;
1337 static int i,j,texsize;
1344 /*musicvolume[3]=512;
1345 PlaySoundEx( music4, samp[music4], NULL, TRUE);
1346 FSOUND_SetPaused(channels[music4], FALSE);
1347 FSOUND_SetVolume(channels[music4], 512);
1353 //texture.data = ( GLubyte* )malloc( 1024*1024*4 );
1357 for(i=0;i<maxplayers;i++)
1359 if (glIsTexture(player[i].skeleton.drawmodel.textureptr))
1361 glDeleteTextures(1, &player[i].skeleton.drawmodel.textureptr);
1363 player[i].skeleton.drawmodel.textureptr=0;;
1366 //temptexdetail=texdetail;
1369 LoadTexture(":Data:Textures:fire.jpg",&loadscreentexture,1,0);
1370 //texdetail=temptexdetail;
1372 temptexdetail=texdetail;
1374 text.LoadFontTexture(":Data:Textures:Font.png");
1376 texdetail=temptexdetail;
1381 viewdistance=50*megascale*viewdistdetail;
1401 realtexdetail=texdetail;
1404 if(texdetail<1)texdetail=1;
1405 realtexdetail=texdetail*4;
1411 /*LoadTexture(":Data:Textures:snow.png",&terraintexture,1);
1413 LoadTexture(":Data:Textures:rock.png",&terraintexture2,1);
1415 LoadTexture(":Data:Textures:detail.png",&terraintexture3,1);
1419 LOG("Loading weapon data...");
1421 LoadTexture(":Data:Textures:knife.png",&weapons.knifetextureptr,0,1);
1422 LoadTexture(":Data:Textures:bloodknife.png",&weapons.bloodknifetextureptr,0,1);
1423 LoadTexture(":Data:Textures:lightbloodknife.png",&weapons.lightbloodknifetextureptr,0,1);
1424 LoadTexture(":Data:Textures:sword.jpg",&weapons.swordtextureptr,1,0);
1425 LoadTexture(":Data:Textures:Swordblood.jpg",&weapons.bloodswordtextureptr,1,0);
1426 LoadTexture(":Data:Textures:Swordbloodlight.jpg",&weapons.lightbloodswordtextureptr,1,0);
1427 LoadTexture(":Data:Textures:Staff.jpg",&weapons.stafftextureptr,1,0);
1429 weapons.throwingknifemodel.load((char *)":Data:Models:throwingknife.solid",1);
1430 weapons.throwingknifemodel.Scale(.001,.001,.001);
1431 //weapons.throwingknifemodel.Rotate(0,0,-90);
1432 weapons.throwingknifemodel.Rotate(90,0,0);
1433 weapons.throwingknifemodel.Rotate(0,90,0);
1434 weapons.throwingknifemodel.flat=0;
1435 weapons.throwingknifemodel.CalculateNormals(1);
1436 //weapons.throwingknifemodel.ScaleNormals(-1,-1,-1);
1438 weapons.swordmodel.load((char *)":Data:Models:sword.solid",1);
1439 weapons.swordmodel.Scale(.001,.001,.001);
1440 //weapons.swordmodel.Rotate(0,0,-90);
1441 weapons.swordmodel.Rotate(90,0,0);
1442 weapons.swordmodel.Rotate(0,90,0);
1443 weapons.swordmodel.Rotate(0,0,90);
1444 weapons.swordmodel.flat=1;
1445 weapons.swordmodel.CalculateNormals(1);
1446 //weapons.swordmodel.ScaleNormals(-1,-1,-1);
1448 weapons.staffmodel.load((char *)":Data:Models:staff.solid",1);
1449 weapons.staffmodel.Scale(.005,.005,.005);
1450 //weapons.staffmodel.Rotate(0,0,-90);
1451 weapons.staffmodel.Rotate(90,0,0);
1452 weapons.staffmodel.Rotate(0,90,0);
1453 weapons.staffmodel.Rotate(0,0,90);
1454 weapons.staffmodel.flat=1;
1455 weapons.staffmodel.CalculateNormals(1);
1456 //weapons.staffmodel.ScaleNormals(-1,-1,-1);
1458 //temptexdetail=texdetail;
1459 //if(texdetail>4)texdetail=4;
1460 LoadTexture(":Data:Textures:shadow.png",&terrain.shadowtexture,0,1);
1462 LoadTexture(":Data:Textures:blood.png",&terrain.bloodtexture,0,1);
1464 LoadTexture(":Data:Textures:break.png",&terrain.breaktexture,0,1);
1466 LoadTexture(":Data:Textures:blood.png",&terrain.bloodtexture2,0,1);
1469 LoadTexture(":Data:Textures:footprint.png",&terrain.footprinttexture,0,1);
1471 LoadTexture(":Data:Textures:bodyprint.png",&terrain.bodyprinttexture,0,1);
1473 /*LoadTexture(":Data:Textures:cloud.png",&sprites.cloudtexture,1);
1475 LoadTexture(":Data:Textures:cloudimpact.png",&sprites.cloudimpacttexture,1);
1477 LoadTexture(":Data:Textures:bloodparticle.png",&sprites.bloodtexture,1);
1479 LoadTexture(":Data:Textures:snowflake.png",&sprites.snowflaketexture,1);
1481 LoadTexture(":Data:Textures:flame.png",&sprites.flametexture,1);
1483 LoadTexture(":Data:Textures:smoke.png",&sprites.smoketexture,1);
1484 //texdetail=temptexdetail;
1485 LoadTexture(":Data:Textures:shine.png",&sprites.shinetexture,1);*/
1489 LoadTexture(":Data:Textures:hawk.png",&hawktexture,0,1);
1491 LoadTexture(":Data:Textures:logo.png",&logotexture,0,1);
1494 //LoadTexture(":Data:Textures:box.jpg",&objects.boxtextureptr,1,0);
1497 LoadTexture(":Data:Textures:cloud.png",&sprites.cloudtexture,1,1);
1498 LoadTexture(":Data:Textures:cloudimpact.png",&sprites.cloudimpacttexture,1,1);
1499 LoadTexture(":Data:Textures:bloodparticle.png",&sprites.bloodtexture,1,1);
1500 LoadTexture(":Data:Textures:snowflake.png",&sprites.snowflaketexture,1,1);
1501 LoadTexture(":Data:Textures:flame.png",&sprites.flametexture,1,1);
1502 LoadTexture(":Data:Textures:bloodflame.png",&sprites.bloodflametexture,1,1);
1503 LoadTexture(":Data:Textures:smoke.png",&sprites.smoketexture,1,1);
1504 LoadTexture(":Data:Textures:shine.png",&sprites.shinetexture,1,0);
1505 LoadTexture(":Data:Textures:splinter.png",&sprites.splintertexture,1,1);
1506 LoadTexture(":Data:Textures:leaf.png",&sprites.leaftexture,1,1);
1507 LoadTexture(":Data:Textures:tooth.png",&sprites.toothtexture,1,1);
1511 ReSizeGLScene(90,.01);
1518 if(detail)kTextureSize=1024;
1519 if(detail==1)kTextureSize=512;
1520 if(detail==0)kTextureSize=256;
1523 //drawmode=motionblurmode;
1525 //Set up distant light
1529 light.ambient[0]=.2;
1530 light.ambient[1]=.2;
1531 light.ambient[2]=.24;
1534 light.location.z=-.2;
1535 Normalise(&light.location);
1545 texscale=.2/megascale/viewdistdetail;
1546 terrain.scale=3*megascale*terraindetail*viewdistdetail;
1548 viewer.x=terrain.size/2*terrain.scale;
1549 viewer.z=terrain.size/2*terrain.scale;
1551 hawk.load((char *)":Data:Models:hawk.solid",1);
1552 hawk.Scale(.03,.03,.03);
1553 hawk.Rotate(90,1,1);
1554 hawk.CalculateNormals(0);
1555 hawk.ScaleNormals(-1,-1,-1);
1556 hawkcoords.x=terrain.size/2*terrain.scale-5-7;
1557 hawkcoords.z=terrain.size/2*terrain.scale-5-7;
1558 hawkcoords.y=terrain.getHeight(hawkcoords.x,hawkcoords.z)+25;
1561 eye.load((char *)":Data:Models:eye.solid",1);
1562 eye.Scale(.03,.03,.03);
1563 eye.CalculateNormals(0);
1565 cornea.load((char *)":Data:Models:cornea.solid",1);
1566 cornea.Scale(.03,.03,.03);
1567 cornea.CalculateNormals(0);
1569 iris.load((char *)":Data:Models:iris.solid",1);
1570 iris.Scale(.03,.03,.03);
1571 iris.CalculateNormals(0);
1573 LoadSave(":Data:Textures:Bloodfur.png",0,1,&bloodText[0],0);
1574 LoadSave(":Data:Textures:Wolfbloodfur.png",0,1,&wolfbloodText[0],0);
1582 //if(targetlevel!=7)
1583 Loadlevel(targetlevel);
1586 rabbitcoords=player[0].coords;
1587 rabbitcoords.y=terrain.getHeight(rabbitcoords.x,rabbitcoords.z);
1589 animation[runanim].Load((char *)":Data:Animations:Run",middleheight,neutral);
1591 animation[bounceidleanim].Load((char *)":Data:Animations:Idle",middleheight,neutral);
1592 animation[stopanim].Load((char *)":Data:Animations:Stop",middleheight,neutral);
1594 animation[jumpupanim].Load((char *)":Data:Animations:JumpUp",highheight,neutral);
1595 animation[jumpdownanim].Load((char *)":Data:Animations:JumpDown",highheight,neutral);
1597 animation[landanim].Load((char *)":Data:Animations:Landing",lowheight,neutral);
1598 animation[landhardanim].Load((char *)":Data:Animations:Landhard",lowheight,neutral);
1599 animation[climbanim].Load((char *)":Data:Animations:Climb",lowheight,neutral);
1600 animation[hanganim].Load((char *)":Data:Animations:Hangon",lowheight,neutral);
1601 animation[spinkickanim].Load((char *)":Data:Animations:SpinKick",middleheight,normalattack);
1603 animation[getupfromfrontanim].Load((char *)":Data:Animations:GetUpFromFront",lowheight,neutral);
1604 animation[getupfrombackanim].Load((char *)":Data:Animations:GetUpFromBack",lowheight,neutral);
1605 animation[crouchanim].Load((char *)":Data:Animations:Crouch",lowheight,neutral);
1606 animation[sneakanim].Load((char *)":Data:Animations:Sneak",lowheight,neutral);
1607 animation[rollanim].Load((char *)":Data:Animations:Roll",lowheight,neutral);
1608 animation[flipanim].Load((char *)":Data:Animations:Flip",highheight,neutral);
1609 animation[frontflipanim].Load((char *)":Data:Animations:Flip",highheight,neutral);
1610 animation[spinkickreversedanim].Load((char *)":Data:Animations:SpinKickCaught",middleheight,reversed);
1612 animation[spinkickreversalanim].Load((char *)":Data:Animations:SpinKickCatch",middleheight,reversal);
1613 animation[lowkickanim].Load((char *)":Data:Animations:lowkick",middleheight,normalattack);
1614 animation[sweepanim].Load((char *)":Data:Animations:sweep",lowheight,normalattack);
1615 animation[sweepreversedanim].Load((char *)":Data:Animations:SweepCaught",lowheight,reversed);
1616 animation[sweepreversalanim].Load((char *)":Data:Animations:SweepCatch",middleheight,reversal);
1617 animation[rabbitkickanim].Load((char *)":Data:Animations:RabbitKick",middleheight,normalattack);
1618 animation[rabbitkickreversedanim].Load((char *)":Data:Animations:RabbitKickCaught",middleheight,reversed);
1619 animation[rabbitkickreversalanim].Load((char *)":Data:Animations:RabbitKickCatch",lowheight,reversal);
1620 animation[upunchanim].Load((char *)":Data:Animations:Upunch",middleheight,normalattack);
1621 animation[staggerbackhighanim].Load((char *)":Data:Animations:Staggerbackhigh",middleheight,neutral);
1622 animation[upunchreversedanim].Load((char *)":Data:Animations:UpunchCaught",middleheight,reversed);
1624 animation[upunchreversalanim].Load((char *)":Data:Animations:UpunchCatch",middleheight,reversal);
1625 animation[hurtidleanim].Load((char *)":Data:Animations:Hurtidle",middleheight,neutral);
1626 animation[backhandspringanim].Load((char *)":Data:Animations:Backhandspring",middleheight,neutral);
1627 animation[fightidleanim].Load((char *)":Data:Animations:Fightidle",middleheight,neutral);
1628 animation[walkanim].Load((char *)":Data:Animations:Walk",middleheight,neutral);
1630 animation[fightsidestep].Load((char *)":Data:Animations:Fightsidestep",middleheight,neutral);
1631 animation[killanim].Load((char *)":Data:Animations:Kill",middleheight,normalattack);
1632 animation[sneakattackanim].Load((char *)":Data:Animations:Sneakattack",middleheight,reversal);
1633 animation[sneakattackedanim].Load((char *)":Data:Animations:Sneakattacked",middleheight,reversed);
1634 animation[drawrightanim].Load((char *)":Data:Animations:drawright",middleheight,neutral);
1635 animation[knifeslashstartanim].Load((char *)":Data:Animations:slashstart",middleheight,normalattack);
1636 animation[crouchdrawrightanim].Load((char *)":Data:Animations:crouchdrawright",lowheight,neutral);
1637 animation[crouchstabanim].Load((char *)":Data:Animations:crouchstab",lowheight,normalattack);
1639 animation[knifefollowanim].Load((char *)":Data:Animations:slashfollow",middleheight,reversal);
1640 animation[knifefollowedanim].Load((char *)":Data:Animations:slashfollowed",middleheight,reversed);
1641 animation[knifethrowanim].Load((char *)":Data:Animations:knifethrow",middleheight,normalattack);
1642 animation[removeknifeanim].Load((char *)":Data:Animations:removeknife",middleheight,neutral);
1643 animation[crouchremoveknifeanim].Load((char *)":Data:Animations:crouchremoveknife",lowheight,neutral);
1644 animation[jumpreversedanim].Load((char *)":Data:Animations:JumpCaught",middleheight,reversed);
1645 animation[jumpreversalanim].Load((char *)":Data:Animations:JumpCatch",middleheight,reversal);
1646 animation[staggerbackhardanim].Load((char *)":Data:Animations:Staggerbackhard",middleheight,neutral);
1648 animation[dropkickanim].Load((char *)":Data:Animations:Dropkick",middleheight,normalattack);
1649 animation[winduppunchanim].Load((char *)":Data:Animations:Winduppunch",middleheight,normalattack);
1650 animation[winduppunchblockedanim].Load((char *)":Data:Animations:Winduppunchblocked",middleheight,normalattack);
1651 animation[blockhighleftanim].Load((char *)":Data:Animations:Blockhighleft",middleheight,normalattack);
1652 animation[blockhighleftstrikeanim].Load((char *)":Data:Animations:Blockhighleftstrike",middleheight,normalattack);
1653 animation[backflipanim].Load((char *)":Data:Animations:Backflip",highheight,neutral);
1654 animation[walljumpbackanim].Load((char *)":Data:Animations:Walljumpback",highheight,neutral);
1655 animation[walljumpfrontanim].Load((char *)":Data:Animations:Walljumpfront",highheight,neutral);
1656 animation[rightflipanim].Load((char *)":Data:Animations:Rightflip",highheight,neutral);
1657 animation[walljumprightanim].Load((char *)":Data:Animations:Walljumpright",highheight,neutral);
1658 animation[leftflipanim].Load((char *)":Data:Animations:Leftflip",highheight,neutral);
1659 animation[walljumpleftanim].Load((char *)":Data:Animations:Walljumpleft",highheight,neutral);
1660 animation[walljumprightkickanim].Load((char *)":Data:Animations:Walljumprightkick",highheight,neutral);
1661 animation[walljumpleftkickanim].Load((char *)":Data:Animations:Walljumpleftkick",highheight,neutral);
1662 animation[knifefightidleanim].Load((char *)":Data:Animations:Knifefightidle",middleheight,neutral);
1663 animation[knifesneakattackanim].Load((char *)":Data:Animations:Knifesneakattack",middleheight,reversal);
1664 animation[knifesneakattackedanim].Load((char *)":Data:Animations:Knifesneakattacked",middleheight,reversed);
1665 animation[swordfightidleanim].Load((char *)":Data:Animations:swordfightidle",middleheight,neutral);
1666 animation[drawleftanim].Load((char *)":Data:Animations:drawleft",middleheight,neutral);
1667 animation[swordslashanim].Load((char *)":Data:Animations:swordslash",middleheight,normalattack);
1668 animation[swordgroundstabanim].Load((char *)":Data:Animations:swordgroundstab",lowheight,normalattack);
1669 animation[dodgebackanim].Load((char *)":Data:Animations:dodgeback",middleheight,neutral);
1670 animation[swordsneakattackanim].Load((char *)":Data:Animations:Swordsneakattack",middleheight,reversal);
1671 animation[swordsneakattackedanim].Load((char *)":Data:Animations:Swordsneakattacked",middleheight,reversed);
1672 animation[swordslashreversedanim].Load((char *)":Data:Animations:swordslashCaught",middleheight,reversed);
1673 animation[swordslashreversalanim].Load((char *)":Data:Animations:swordslashCatch",middleheight,reversal);
1674 animation[knifeslashreversedanim].Load((char *)":Data:Animations:knifeslashCaught",middleheight,reversed);
1675 animation[knifeslashreversalanim].Load((char *)":Data:Animations:knifeslashCatch",middleheight,reversal);
1676 animation[swordfightidlebothanim].Load((char *)":Data:Animations:swordfightidleboth",middleheight,neutral);
1677 animation[swordslashparryanim].Load((char *)":Data:Animations:sworduprightparry",middleheight,normalattack);
1678 animation[swordslashparriedanim].Load((char *)":Data:Animations:swordslashparried",middleheight,normalattack);
1679 animation[wolfidle].Load((char *)":Data:Animations:Wolfidle",middleheight,neutral);
1680 animation[wolfcrouchanim].Load((char *)":Data:Animations:Wolfcrouch",lowheight,neutral);
1681 animation[wolflandanim].Load((char *)":Data:Animations:Wolflanding",lowheight,neutral);
1682 animation[wolflandhardanim].Load((char *)":Data:Animations:Wolflandhard",lowheight,neutral);
1683 animation[wolfrunanim].Load((char *)":Data:Animations:Wolfrun",middleheight,neutral);
1684 animation[wolfrunninganim].Load((char *)":Data:Animations:Wolfrunning",middleheight,neutral);
1685 animation[rabbitrunninganim].Load((char *)":Data:Animations:Rabbitrunning",middleheight,neutral);
1686 animation[wolfstopanim].Load((char *)":Data:Animations:Wolfstop",middleheight,neutral);
1687 animation[rabbittackleanim].Load((char *)":Data:Animations:Rabbittackle",middleheight,neutral);
1688 animation[rabbittacklinganim].Load((char *)":Data:Animations:Rabbittackling",middleheight,reversal);
1689 animation[rabbittackledbackanim].Load((char *)":Data:Animations:Rabbittackledback",middleheight,reversed);
1690 animation[rabbittackledfrontanim].Load((char *)":Data:Animations:Rabbittackledfront",middleheight,reversed);
1691 animation[wolfslapanim].Load((char *)":Data:Animations:Wolfslap",middleheight,normalattack);
1692 animation[staffhitanim].Load((char *)":Data:Animations:StaffHit",middleheight,normalattack);
1693 animation[staffgroundsmashanim].Load((char *)":Data:Animations:StaffGroundSmash",lowheight,normalattack);
1694 animation[staffspinhitanim].Load((char *)":Data:Animations:Spinwhack",middleheight,normalattack);
1695 animation[staffhitreversedanim].Load((char *)":Data:Animations:StaffHitCaught",middleheight,reversed);
1696 animation[staffhitreversalanim].Load((char *)":Data:Animations:StaffHitCatch",middleheight,reversal);
1697 animation[staffspinhitreversedanim].Load((char *)":Data:Animations:SpinWhackCaught",middleheight,reversed);
1698 animation[staffspinhitreversalanim].Load((char *)":Data:Animations:SpinWhackCatch",middleheight,reversal);
1700 animation[sitanim].Load((char *)":Data:Animations:Sit",lowheight,neutral);
1701 animation[sleepanim].Load((char *)":Data:Animations:Sleep",lowheight,neutral);
1702 animation[talkidleanim].Load((char *)":Data:Animations:TalkIdle",middleheight,neutral);
1704 animation[sitwallanim].Load((char *)":Data:Animations:Dying",lowheight,neutral);
1705 animation[dead1anim].Load((char *)":Data:Animations:Dead1",lowheight,neutral);
1706 animation[dead2anim].Load((char *)":Data:Animations:Dead2",lowheight,neutral);
1707 animation[dead3anim].Load((char *)":Data:Animations:Dead3",lowheight,neutral);
1708 animation[dead4anim].Load((char *)":Data:Animations:Dead4",lowheight,neutral);
1709 //Fix knife stab, too lazy to do it manually
1713 for(i=0;i<player[0].skeleton.num_joints;i++){
1714 for(j=0;j<animation[knifesneakattackanim].numframes;j++){
1715 animation[knifesneakattackanim].position[i][j]+=moveamount;
1722 for(i=0;i<player[0].skeleton.num_joints;i++){
1723 for(j=0;j<animation[knifesneakattackedanim].numframes;j++){
1724 animation[knifesneakattackedanim].position[i][j]+=moveamount;
1731 for(i=0;i<player[0].skeleton.num_joints;i++){
1732 animation[dead1anim].position[i][1]=animation[dead1anim].position[i][0];
1733 animation[dead2anim].position[i][1]=animation[dead2anim].position[i][0];
1734 animation[dead3anim].position[i][1]=animation[dead3anim].position[i][0];
1735 animation[dead4anim].position[i][1]=animation[dead4anim].position[i][0];
1737 animation[dead1anim].speed[0]=0.001;
1738 animation[dead2anim].speed[0]=0.001;
1739 animation[dead3anim].speed[0]=0.001;
1740 animation[dead4anim].speed[0]=0.001;
1742 animation[dead1anim].speed[1]=0.001;
1743 animation[dead2anim].speed[1]=0.001;
1744 animation[dead3anim].speed[1]=0.001;
1745 animation[dead4anim].speed[1]=0.001;
1747 for(i=0;i<player[0].skeleton.num_joints;i++){
1748 for(j=0;j<animation[swordsneakattackanim].numframes;j++){
1749 animation[swordsneakattackanim].position[i][j]+=moveamount;
1754 for(j=0;j<animation[swordsneakattackanim].numframes;j++){
1755 animation[swordsneakattackanim].weapontarget[j]+=moveamount;
1761 for(i=0;i<player[0].skeleton.num_joints;i++){
1762 for(j=0;j<animation[swordsneakattackedanim].numframes;j++){
1763 animation[swordsneakattackedanim].position[i][j]+=moveamount;
1767 for(i=0;i<player[0].skeleton.num_joints;i++){
1768 for(j=0;j<animation[sleepanim].numframes;j++){
1769 animation[sleepanim].position[i][j]=DoRotation(animation[sleepanim].position[i][j],0,180,0);
1775 temptexdetail=texdetail;
1777 texdetail=temptexdetail;
1784 glPixelStorei( GL_UNPACK_ALIGNMENT, 1 );
1786 glGenTextures( 1, &screentexture );
1787 glTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE );
1790 glEnable(GL_TEXTURE_2D);
1791 glBindTexture( GL_TEXTURE_2D, screentexture);
1792 glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR );
1793 glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR );
1795 glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 0, 0, kTextureSize, kTextureSize, 0);
1801 /*PlaySoundEx( consolesuccesssound, samp[consolesuccesssound], NULL, TRUE);
1802 FSOUND_SetVolume(channels[consolesuccesssound], 256);
1803 FSOUND_SetPaused(channels[consolesuccesssound], FALSE);
1806 float gLoc[3]={0,0,0};
1807 float vel[3]={0,0,0};
1808 FSOUND_Sample_SetMinMaxDistance(samp[fireendsound], 9999.0f, 99999.0f);
1809 PlaySoundEx( fireendsound, samp[fireendsound], NULL, TRUE);
1810 FSOUND_3D_SetAttributes(channels[fireendsound], gLoc, vel);
1811 FSOUND_SetVolume(channels[fireendsound], 256);
1812 FSOUND_SetPaused(channels[fireendsound], FALSE);
1813 FSOUND_Sample_SetMinMaxDistance(samp[fireendsound], 8.0f, 2000.0f);
1826 terraintexture2 = 0;
1827 terraintexture3 = 0;
1831 loadscreentexture = 0;
1832 Maparrowtexture = 0;
1834 Mapcircletexture = 0;
1837 memset(Mainmenuitems, 0, sizeof(Mainmenuitems));
1841 memset(startx, 0, sizeof(startx));
1842 memset(starty, 0, sizeof(starty));
1843 memset(endx, 0, sizeof(endx));
1844 memset(endy, 0, sizeof(endy));
1846 memset(selectedlong, 0, sizeof(selectedlong));
1847 memset(offsetx, 0, sizeof(offsetx));
1848 memset(offsety, 0, sizeof(offsety));
1849 memset(movex, 0, sizeof(movex));
1850 memset(movey, 0, sizeof(movey));
1851 memset(endy, 0, sizeof(endy));
1865 memset(menustring, 0, sizeof(menustring));
1866 memset(registrationname, 0, sizeof(registrationname));
1867 registrationnumber = 0;
1871 newscreenheight = 0;
1874 deltah = 0,deltav = 0;
1875 mousecoordh = 0,mousecoordv = 0;
1876 oldmousecoordh = 0,oldmousecoordv = 0;
1877 rotation = 0,rotation2 = 0;
1882 cameratogglekeydown = 0;
1883 chattogglekeydown = 0;
1886 drawmodetogglekeydown = 0;
1887 explodetogglekeydown = 0;
1888 detailtogglekeydown = 0;
1898 // XYZ realhawkcoords;
1910 campaignnumlevels = 0;
1912 memset(campaignmapname, 0, sizeof(campaignmapname));
1913 memset(campaigndescription, 0, sizeof(campaigndescription));
1914 memset(campaignchoosenext, 0, sizeof(campaignchoosenext));
1915 memset(campaignnumnext, 0, sizeof(campaignnumnext));
1916 memset(campaignnextlevel, 0, sizeof(campaignnextlevel));
1917 int campaignchoicesmade;
1918 memset(campaignchoices, 0, sizeof(campaignchoices));
1919 memset(campaignlocationx, 0, sizeof(campaignlocationx));
1920 memset(campaignlocationy, 0, sizeof(campaignlocationy));
1921 memset(campaignlocationy, 0, sizeof(campaignlocationy));
1923 campaignchoicenum = 0;
1925 memset(campaignchoicewhich, 0, sizeof(campaignchoicewhich));
1929 numlevelspassed = 0;
1931 memset(levelorder, 0, sizeof(levelorder));
1932 memset(levelvisible, 0, sizeof(levelvisible));
1933 memset(levelhighlight, 0, sizeof(levelhighlight));
1937 musictype = 0,oldmusictype = 0,oldoldmusictype = 0;
1941 // XYZ rabbitcoords;
1952 envtogglekeydown = 0;
1953 slomotogglekeydown = 0;
1954 texturesizetogglekeydown = 0;
1955 freezetogglekeydown = 0;
1962 editorrotation2 = 0;
1969 // XYZ pathpoint[30];
1971 memset(numpathpointconnect, 0, sizeof(numpathpointconnect));
1972 memset(pathpointconnect, 0, sizeof(pathpointconnect));
1973 pathpointselected = 0;
1977 numchallengelevels = 0;
1980 archiveselected = 0;
1982 memset(consoletext, 0, sizeof(consoletext));
1983 memset(consolechars, 0, sizeof(consolechars));
1985 memset(displaytext, 0, sizeof(displaytext));
1986 memset(displaychars, 0, sizeof(displaychars));
1987 memset(displaytime, 0, sizeof(displaytime));
1988 displayblinkdelay = 0;
1990 displayselected = 0;
1992 consoletogglekeydown = 0;
1993 consoleblinkdelay = 0;
1995 consoleselected = 0;
1996 memset(togglekey, 0, sizeof(togglekey));
1997 memset(togglekeydelay, 0, sizeof(togglekeydelay));
2001 crouchkey = 0,jumpkey = 0,forwardkey = 0,chatkey = 0,backkey = 0,leftkey = 0,rightkey = 0,drawkey = 0,throwkey = 0,attackkey = 0;
2008 // XYZ boundary[360];
2015 memset(musicvolume, 0, sizeof(musicvolume));
2016 memset(oldmusicvolume, 0, sizeof(oldmusicvolume));