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[10];
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 #define streamcount 20
173 #define samplecount 100
175 for (i=0; i < samplecount; ++i)
177 FSOUND_Sample_Free(samp[i]);
180 for (i=0; i < streamcount; ++i)
182 FSOUND_Stream_Close(strm[i]);
194 //void Game::LoadSounds();
195 void Game::LoadSounds()
199 LOG(std::string("Loading sounds..."));
201 FSOUND_3D_SetDopplerFactor(0);
203 FSOUND_SetSFXMasterVolume((int)(volume*255));
205 samp[footstepsound] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:footstepsnow1.ogg", FSOUND_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
206 FSOUND_Sample_SetMinMaxDistance(samp[footstepsound], 4.0f, 1000.0f);
208 samp[footstepsound2] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:footstepsnow2.ogg", FSOUND_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
209 FSOUND_Sample_SetMinMaxDistance(samp[footstepsound2], 4.0f, 1000.0f);
211 samp[footstepsound3] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:footstepstone1.ogg", FSOUND_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
212 FSOUND_Sample_SetMinMaxDistance(samp[footstepsound3], 4.0f, 1000.0f);
214 samp[footstepsound4] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:footstepstone2.ogg", FSOUND_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
215 FSOUND_Sample_SetMinMaxDistance(samp[footstepsound4], 4.0f, 1000.0f);
217 samp[landsound] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:land.ogg", FSOUND_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
218 FSOUND_Sample_SetMinMaxDistance(samp[landsound], 4.0f, 1000.0f);
220 samp[jumpsound] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:jump.ogg", FSOUND_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
221 FSOUND_Sample_SetMinMaxDistance(samp[jumpsound], 4.0f, 1000.0f);
223 samp[hawksound] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:hawk.ogg", FSOUND_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
224 FSOUND_Sample_SetMinMaxDistance(samp[hawksound], 40.0f, 10000.0f);
226 samp[whooshsound] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:whoosh.ogg", FSOUND_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
227 FSOUND_Sample_SetMinMaxDistance(samp[whooshsound], 4.0f, 1000.0f);
228 FSOUND_Sample_SetMode(samp[whooshsound], FSOUND_LOOP_NORMAL);
230 samp[landsound1] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:land1.ogg", FSOUND_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
231 FSOUND_Sample_SetMinMaxDistance(samp[landsound1], 4.0f, 1000.0f);
235 samp[landsound2] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:land2.ogg", FSOUND_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
236 FSOUND_Sample_SetMinMaxDistance(samp[landsound2], 4.0f, 1000.0f);
238 samp[breaksound] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:broken.ogg", FSOUND_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
239 FSOUND_Sample_SetMinMaxDistance(samp[breaksound], 8.0f, 2000.0f);
241 samp[lowwhooshsound] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:Lowwhoosh.ogg", FSOUND_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
242 FSOUND_Sample_SetMinMaxDistance(samp[lowwhooshsound], 8.0f, 2000.0f);
244 samp[midwhooshsound] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:midwhoosh.ogg", FSOUND_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
245 FSOUND_Sample_SetMinMaxDistance(samp[midwhooshsound], 8.0f, 2000.0f);
247 samp[highwhooshsound] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:highwhoosh.ogg", FSOUND_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
248 FSOUND_Sample_SetMinMaxDistance(samp[highwhooshsound], 8.0f, 2000.0f);
250 samp[movewhooshsound] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:movewhoosh.ogg", FSOUND_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
251 FSOUND_Sample_SetMinMaxDistance(samp[movewhooshsound], 8.0f, 2000.0f);
253 samp[heavyimpactsound] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:heavyimpact.ogg", FSOUND_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
254 FSOUND_Sample_SetMinMaxDistance(samp[heavyimpactsound], 8.0f, 2000.0f);
256 samp[whooshhitsound] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:Whooshhit.ogg", FSOUND_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
257 FSOUND_Sample_SetMinMaxDistance(samp[whooshhitsound], 8.0f, 2000.0f);
259 samp[thudsound] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:thud.ogg", FSOUND_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
260 FSOUND_Sample_SetMinMaxDistance(samp[thudsound], 8.0f, 2000.0f);
262 samp[alarmsound] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:alarm.ogg", FSOUND_2D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
263 FSOUND_Sample_SetMinMaxDistance(samp[alarmsound], 8.0f, 2000.0f);
265 samp[breaksound2] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:break.ogg", FSOUND_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
266 FSOUND_Sample_SetMinMaxDistance(samp[breaksound2], 8.0f, 2000.0f);
268 samp[knifedrawsound] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:knifedraw.ogg", FSOUND_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
269 FSOUND_Sample_SetMinMaxDistance(samp[knifedrawsound], 8.0f, 2000.0f);
271 samp[knifesheathesound] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:knifesheathe.ogg", FSOUND_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
272 FSOUND_Sample_SetMinMaxDistance(samp[knifesheathesound], 8.0f, 2000.0f);
274 samp[fleshstabsound] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:Fleshstab.ogg", FSOUND_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
275 FSOUND_Sample_SetMinMaxDistance(samp[fleshstabsound], 8.0f, 2000.0f);
277 samp[fleshstabremovesound] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:Fleshstabremove.ogg", FSOUND_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
278 FSOUND_Sample_SetMinMaxDistance(samp[fleshstabremovesound], 8.0f, 2000.0f);
280 samp[knifeswishsound] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:knifeswish.ogg", FSOUND_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
281 FSOUND_Sample_SetMinMaxDistance(samp[knifeswishsound], 8.0f, 2000.0f);
283 samp[knifeslicesound] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:knifeslice.ogg", FSOUND_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
284 FSOUND_Sample_SetMinMaxDistance(samp[knifeslicesound], 8.0f, 2000.0f);
286 samp[swordslicesound] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:swordslice.ogg", FSOUND_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
287 FSOUND_Sample_SetMinMaxDistance(samp[swordslicesound], 8.0f, 2000.0f);
289 samp[skidsound] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:skid.ogg", FSOUND_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
290 FSOUND_Sample_SetMinMaxDistance(samp[skidsound], 8.0f, 2000.0f);
292 samp[snowskidsound] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:snowskid.ogg", FSOUND_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
293 FSOUND_Sample_SetMinMaxDistance(samp[snowskidsound], 8.0f, 2000.0f);
295 samp[bushrustle] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:bushrustle.ogg", FSOUND_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
296 FSOUND_Sample_SetMinMaxDistance(samp[bushrustle], 4.0f, 1000.0f);
298 samp[clank1sound] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:clank1.ogg", FSOUND_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
299 FSOUND_Sample_SetMinMaxDistance(samp[clank1sound], 8.0f, 2000.0f);
301 samp[clank2sound] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:clank2.ogg", FSOUND_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
302 FSOUND_Sample_SetMinMaxDistance(samp[clank2sound], 8.0f, 2000.0f);
304 samp[clank3sound] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:clank3.ogg", FSOUND_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
305 FSOUND_Sample_SetMinMaxDistance(samp[clank3sound], 8.0f, 2000.0f);
307 samp[clank4sound] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:clank4.ogg", FSOUND_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
308 FSOUND_Sample_SetMinMaxDistance(samp[clank4sound], 8.0f, 2000.0f);
310 samp[consolesuccesssound] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:consolesuccess.ogg", FSOUND_2D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
311 FSOUND_Sample_SetMinMaxDistance(samp[consolesuccesssound], 4.0f, 1000.0f);
313 samp[consolefailsound] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:consolefail.ogg", FSOUND_2D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
314 FSOUND_Sample_SetMinMaxDistance(samp[consolefailsound], 4.0f, 1000.0f);
316 samp[metalhitsound] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:MetalHit.ogg", FSOUND_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
317 FSOUND_Sample_SetMinMaxDistance(samp[metalhitsound], 8.0f, 2000.0f);
319 samp[clawslicesound] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:clawslice.ogg", FSOUND_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
320 FSOUND_Sample_SetMinMaxDistance(samp[clawslicesound], 8.0f, 2000.0f);
322 samp[splattersound] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:splatter.ogg", FSOUND_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
323 FSOUND_Sample_SetMinMaxDistance(samp[splattersound], 8.0f, 2000.0f);
325 samp[growlsound] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:Growl.ogg", FSOUND_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
326 FSOUND_Sample_SetMinMaxDistance(samp[growlsound], 1000.0f, 2000.0f);
328 samp[growl2sound] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:Growl2.ogg", FSOUND_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
329 FSOUND_Sample_SetMinMaxDistance(samp[growl2sound], 1000.0f, 2000.0f);
331 samp[barksound] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:bark.ogg", FSOUND_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
332 FSOUND_Sample_SetMinMaxDistance(samp[barksound], 1000.0f, 2000.0f);
334 samp[bark2sound] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:bark2.ogg", FSOUND_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
335 FSOUND_Sample_SetMinMaxDistance(samp[bark2sound], 1000.0f, 2000.0f);
337 samp[bark3sound] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:bark3.ogg", FSOUND_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
338 FSOUND_Sample_SetMinMaxDistance(samp[bark3sound], 1000.0f, 2000.0f);
340 samp[snarlsound] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:snarl.ogg", FSOUND_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
341 FSOUND_Sample_SetMinMaxDistance(samp[snarlsound], 1000.0f, 2000.0f);
344 samp[snarl2sound] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:snarl2.ogg", FSOUND_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
345 FSOUND_Sample_SetMinMaxDistance(samp[snarl2sound], 1000.0f, 2000.0f);
347 samp[barkgrowlsound] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:barkgrowl.ogg", FSOUND_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
348 FSOUND_Sample_SetMinMaxDistance(samp[barkgrowlsound], 1000.0f, 2000.0f);
350 samp[rabbitattacksound] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:rabbitattack.ogg", FSOUND_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
351 FSOUND_Sample_SetMinMaxDistance(samp[rabbitattacksound], 1000.0f, 2000.0f);
353 samp[rabbitattack2sound] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:rabbitattack2.ogg", FSOUND_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
354 FSOUND_Sample_SetMinMaxDistance(samp[rabbitattack2sound], 1000.0f, 2000.0f);
356 samp[rabbitattack3sound] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:rabbitattack3.ogg", FSOUND_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
357 FSOUND_Sample_SetMinMaxDistance(samp[rabbitattack3sound], 1000.0f, 2000.0f);
359 samp[rabbitattack4sound] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:rabbitattack4.ogg", FSOUND_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
360 FSOUND_Sample_SetMinMaxDistance(samp[rabbitattack4sound], 1000.0f, 2000.0f);
362 samp[rabbitpainsound] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:rabbitpain.ogg", FSOUND_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
363 FSOUND_Sample_SetMinMaxDistance(samp[rabbitpainsound], 1000.0f, 2000.0f);
365 samp[rabbitpain1sound] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:rabbitpain2.ogg", FSOUND_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
366 FSOUND_Sample_SetMinMaxDistance(samp[rabbitpain1sound], 1000.0f, 2000.0f);
368 /*samp[rabbitpain2sound] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:rabbitpain2.ogg", FSOUND_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
369 FSOUND_Sample_SetMinMaxDistance(samp[rabbitpain2sound], 1000.0f, 2000.0f);
371 samp[rabbitchitter] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:rabbitchitter.ogg", FSOUND_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
372 FSOUND_Sample_SetMinMaxDistance(samp[rabbitchitter], 1000.0f, 2000.0f);
374 samp[rabbitchitter2] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:rabbitchitter2.ogg", FSOUND_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
375 FSOUND_Sample_SetMinMaxDistance(samp[rabbitchitter2], 1000.0f, 2000.0f);
377 samp[swordstaffsound] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:swordstaff.ogg", FSOUND_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
378 FSOUND_Sample_SetMinMaxDistance(samp[swordstaffsound], 8.0f, 2000.0f);
380 samp[staffbodysound] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:staffbody.ogg", FSOUND_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
381 FSOUND_Sample_SetMinMaxDistance(samp[staffbodysound], 8.0f, 2000.0f);
383 samp[staffheadsound] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:staffhead.ogg", FSOUND_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
384 FSOUND_Sample_SetMinMaxDistance(samp[staffheadsound], 8.0f, 2000.0f);
386 samp[staffbreaksound] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:staffbreak.wav", FSOUND_HW3D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
387 FSOUND_Sample_SetMinMaxDistance(samp[staffbreaksound], 8.0f, 2000.0f);
393 void Game::LoadTexture(char *fileName, GLuint *textureid,int mipmap, bool hasalpha)
399 LOG(std::string("Loading texture...") + fileName);
401 unsigned char fileNamep[256];
402 CopyCStringToPascal(fileName,fileNamep);
404 upload_image( fileNamep ,hasalpha);
406 // std::string fname(fileName);
407 // std::transform(fname.begin(), fname.end(), tolower);
408 // TexIter it = textures.find(fname);
412 //if(textures.end() == it)
415 if ( texture.bpp == 24 )
420 glPixelStorei( GL_UNPACK_ALIGNMENT, 1 );
422 if(!*textureid)glGenTextures( 1, textureid );
423 glTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE );
425 glBindTexture( GL_TEXTURE_2D, *textureid);
426 glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR );
427 if(trilinear)if(mipmap)glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR );
428 if(!trilinear)if(mipmap)glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_NEAREST );
429 if(!mipmap)glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR );
431 //glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, texture.sizeX, texture.sizeY, 0,
432 // GL_BGRA_EXT, GL_UNSIGNED_INT_8_8_8_8_REV, texture.data);
434 //gluBuild2DMipmaps( GL_TEXTURE_2D, type, texture.sizeX, texture.sizeY, GL_BGRA_EXT, GL_UNSIGNED_INT_8_8_8_8_REV, texture.data );
436 gluBuild2DMipmaps( GL_TEXTURE_2D, type, texture.sizeX, texture.sizeY, type, GL_UNSIGNED_BYTE, texture.data );
438 // textures.insert(std::make_pair(fname, *textureid));
442 // *textureid = it->second;
446 void Game::LoadTextureSave(char *fileName, GLuint *textureid,int mipmap,GLubyte *array, int *skinsize)
454 LOG(std::string("Loading texture (S)...") + fileName);
457 unsigned char fileNamep[256];
458 CopyCStringToPascal(fileName,fileNamep);
460 upload_image( fileNamep ,0);
461 //LoadTGA( fileName );
463 // std::string fname(fileName);
464 // std::transform(fname.begin(), fname.end(), tolower);
465 // TexIter it = textures.find(fname);
469 //if(textures.end() == it)
471 bytesPerPixel=texture.bpp/8;
474 if ( texture.bpp == 24 )
479 glPixelStorei( GL_UNPACK_ALIGNMENT, 1 );
481 if(!*textureid)glGenTextures( 1, textureid );
482 glTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE );
484 glBindTexture( GL_TEXTURE_2D, *textureid);
485 glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR );
486 if(trilinear)if(mipmap)glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR );
487 if(!trilinear)if(mipmap)glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_NEAREST );
488 if(!mipmap)glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR );
491 for(i=0;i<(int)(texture.sizeY*texture.sizeX*bytesPerPixel);i++){
492 if((i+1)%4||type==GL_RGB){
493 array[tempnum]=texture.data[i];
498 *skinsize=texture.sizeX;
500 gluBuild2DMipmaps( GL_TEXTURE_2D, type, texture.sizeX, texture.sizeY, GL_RGB, GL_UNSIGNED_BYTE, array );
502 // textures.insert(std::make_pair(fname, *textureid));
506 // *textureid = it->second;
510 void Game::LoadSave(char *fileName, GLuint *textureid,bool mipmap,GLubyte *array, int *skinsize)
517 LOG(std::string("Loading (S)...") + fileName);
520 float temptexdetail=texdetail;
522 //upload_image( fileName );
523 //LoadTGA( fileName );
525 unsigned char fileNamep[256];
526 CopyCStringToPascal(fileName,fileNamep);
528 upload_image( fileNamep ,0);
529 texdetail=temptexdetail;
533 bytesPerPixel=texture.bpp/8;
536 for(i=0;i<(int)(texture.sizeY*texture.sizeX*bytesPerPixel);i++){
537 if((i+1)%4||bytesPerPixel==3){
538 array[tempnum]=texture.data[i];
545 bool Game::AddClothes(char *fileName, GLuint *textureid,bool mipmap,GLubyte *array, int *skinsize)
552 //upload_image( fileName );
553 //LoadTGA( fileName );
555 unsigned char fileNamep[256];
556 CopyCStringToPascal(fileName,fileNamep);
559 opened=upload_image( fileNamep ,1);
572 bytesPerPixel=texture.bpp/8;
576 for(i=0;i<(int)(texture.sizeY*texture.sizeX*bytesPerPixel);i++){
577 if(bytesPerPixel==3)alphanum=255;
578 else if((i+1)%4==0)alphanum=texture.data[i];
580 if((i+1)%4||bytesPerPixel==3){
581 if((i%4)==0)texture.data[i]*=tintr;
582 if((i%4)==1)texture.data[i]*=tintg;
583 if((i%4)==2)texture.data[i]*=tintb;
584 array[tempnum]=(float)array[tempnum]*(1-alphanum/255)+(float)texture.data[i]*(alphanum/255);
594 //***************> ResizeGLScene() <******/
595 GLvoid Game::ReSizeGLScene(float fov, float pnear)
602 glViewport(0,0,screenwidth,screenheight);
604 glMatrixMode(GL_PROJECTION);
607 gluPerspective(fov,(GLfloat)screenwidth/(GLfloat)screenheight,pnear,viewdistance);
609 glMatrixMode(GL_MODELVIEW);
613 void Game::LoadingScreen()
615 static float loadprogress,minprogress,maxprogress;
616 static AbsoluteTime time = {0,0};
617 static AbsoluteTime frametime = {0,0};
618 AbsoluteTime currTime = UpTime ();
619 double deltaTime = (float) AbsoluteDeltaToDuration (currTime, frametime);
621 if (0 > deltaTime) // if negative microseconds
622 deltaTime /= -1000000.0;
623 else // else milliseconds
626 multiplier=deltaTime;
627 if(multiplier<.001)multiplier=.001;
628 if(multiplier>10)multiplier=10;
630 frametime = currTime; // reset for next time interval
635 glClearColor(0,0,0,1);
636 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
639 loadtime+=multiplier*4;
641 loadprogress=loadtime;
642 if(loadprogress>100)loadprogress=100;
644 //loadprogress=abs(Random()%100);
648 glEnable(GL_TEXTURE_2D);
649 glBindTexture( GL_TEXTURE_2D, loadscreentexture);
650 glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT );
651 glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT );
652 glDisable(GL_DEPTH_TEST); // Disables Depth Testing
653 glDisable(GL_CULL_FACE);
654 glDisable(GL_LIGHTING);
656 glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
657 glPushMatrix(); // Store The Projection Matrix
658 glLoadIdentity(); // Reset The Projection Matrix
659 glOrtho(0,screenwidth,0,screenheight,-100,100); // Set Up An Ortho Screen
660 glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
661 glPushMatrix(); // Store The Modelview Matrix
662 glLoadIdentity(); // Reset The Modelview Matrix
663 glTranslatef(screenwidth/2,screenheight/2,0);
664 glScalef((float)screenwidth/2,(float)screenheight/2,1);
665 glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
667 glColor4f(loadprogress/100,loadprogress/100,loadprogress/100,1);
668 //glColor4f(1,1,1,1);
669 /*if(loadscreencolor==0)glColor4f(1,1,1,1);
670 if(loadscreencolor==1)glColor4f(1,0,0,1);
671 if(loadscreencolor==2)glColor4f(0,1,0,1);
672 if(loadscreencolor==3)glColor4f(0,0,1,1);
673 if(loadscreencolor==4)glColor4f(1,1,0,1);
674 if(loadscreencolor==5)glColor4f(1,0,1,1);
677 //glScalef(.25,.25,.25);
679 glTexCoord2f(.1-loadprogress/100,0+loadprogress/100+.3);
680 glVertex3f(-1, -1, 0.0f);
681 glTexCoord2f(.1-loadprogress/100,0+loadprogress/100+.3);
682 glVertex3f(1, -1, 0.0f);
683 glTexCoord2f(.1-loadprogress/100,1+loadprogress/100+.3);
684 glVertex3f(1, 1, 0.0f);
685 glTexCoord2f(.1-loadprogress/100,1+loadprogress/100+.3);
686 glVertex3f(-1, 1, 0.0f);
691 //glScalef(.25,.25,.25);
693 glTexCoord2f(.4+loadprogress/100,0+loadprogress/100);
694 glVertex3f(-1, -1, 0.0f);
695 glTexCoord2f(.4+loadprogress/100,0+loadprogress/100);
696 glVertex3f(1, -1, 0.0f);
697 glTexCoord2f(.4+loadprogress/100,1+loadprogress/100);
698 glVertex3f(1, 1, 0.0f);
699 glTexCoord2f(.4+loadprogress/100,1+loadprogress/100);
700 glVertex3f(-1, 1, 0.0f);
703 glDisable(GL_TEXTURE_2D);
704 glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
705 glPopMatrix(); // Restore The Old Projection Matrix
706 glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
707 glPopMatrix(); // Restore The Old Projection Matrix
711 glEnable(GL_TEXTURE_2D);
712 glBindTexture( GL_TEXTURE_2D, loadscreentexture);
713 glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT );
714 glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT );
715 glDisable(GL_DEPTH_TEST); // Disables Depth Testing
716 glDisable(GL_CULL_FACE);
717 glDisable(GL_LIGHTING);
719 glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
720 glPushMatrix(); // Store The Projection Matrix
721 glLoadIdentity(); // Reset The Projection Matrix
722 glOrtho(0,screenwidth,0,screenheight,-100,100); // Set Up An Ortho Screen
723 glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
724 glPushMatrix(); // Store The Modelview Matrix
725 glLoadIdentity(); // Reset The Modelview Matrix
726 glTranslatef(screenwidth/2,screenheight/2,0);
727 glScalef((float)screenwidth/2*(1.5-(loadprogress)/200),(float)screenheight/2*(1.5-(loadprogress)/200),1);
728 glBlendFunc(GL_SRC_ALPHA,GL_ONE);
730 //glColor4f(loadprogress/100,loadprogress/100,loadprogress/100,1);
731 glColor4f(loadprogress/100,loadprogress/100,loadprogress/100,1);
732 /*if(loadscreencolor==0)glColor4f(1,1,1,1);
733 if(loadscreencolor==1)glColor4f(1,0,0,1);
734 if(loadscreencolor==2)glColor4f(0,1,0,1);
735 if(loadscreencolor==3)glColor4f(0,0,1,1);
736 if(loadscreencolor==4)glColor4f(1,1,0,1);
737 if(loadscreencolor==5)glColor4f(1,0,1,1);
740 //glScalef(.25,.25,.25);
742 glTexCoord2f(0+.5,0+.5);
743 glVertex3f(-1, -1, 0.0f);
744 glTexCoord2f(1+.5,0+.5);
745 glVertex3f(1, -1, 0.0f);
746 glTexCoord2f(1+.5,1+.5);
747 glVertex3f(1, 1, 0.0f);
748 glTexCoord2f(0+.5,1+.5);
749 glVertex3f(-1, 1, 0.0f);
752 glDisable(GL_TEXTURE_2D);
753 glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
754 glPopMatrix(); // Restore The Old Projection Matrix
755 glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
756 glPopMatrix(); // Restore The Old Projection Matrix
760 glEnable(GL_TEXTURE_2D);
761 glBindTexture( GL_TEXTURE_2D, loadscreentexture);
762 glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT );
763 glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT );
764 glDisable(GL_DEPTH_TEST); // Disables Depth Testing
765 glDisable(GL_CULL_FACE);
766 glDisable(GL_LIGHTING);
768 glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
769 glPushMatrix(); // Store The Projection Matrix
770 glLoadIdentity(); // Reset The Projection Matrix
771 glOrtho(0,screenwidth,0,screenheight,-100,100); // Set Up An Ortho Screen
772 glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
773 glPushMatrix(); // Store The Modelview Matrix
774 glLoadIdentity(); // Reset The Modelview Matrix
775 glTranslatef(screenwidth/2,screenheight/2,0);
776 glScalef((float)screenwidth/2*(100+loadprogress)/100,(float)screenheight/2*(100+loadprogress)/100,1);
777 glBlendFunc(GL_SRC_ALPHA,GL_ONE);
779 glColor4f(loadprogress/100,loadprogress/100,loadprogress/100,.4);
781 //glScalef(.25,.25,.25);
783 glTexCoord2f(0+.2,0+.8);
784 glVertex3f(-1, -1, 0.0f);
785 glTexCoord2f(1+.2,0+.8);
786 glVertex3f(1, -1, 0.0f);
787 glTexCoord2f(1+.2,1+.8);
788 glVertex3f(1, 1, 0.0f);
789 glTexCoord2f(0+.2,1+.8);
790 glVertex3f(-1, 1, 0.0f);
793 glDisable(GL_TEXTURE_2D);
794 glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
795 glPopMatrix(); // Restore The Old Projection Matrix
796 glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
797 glPopMatrix(); // Restore The Old Projection Matrix
803 glEnable(GL_TEXTURE_2D);
804 static char string[256]="";
805 sprintf (string, "LOADING... %d%",(int)loadprogress);
807 text.glPrint(280-280*loadprogress/100/2/4,125-125*loadprogress/100/2/4,string,1,1+loadprogress/100,640,480);
808 glColor4f(1.2-loadprogress/100,1.2-loadprogress/100,1.2-loadprogress/100,1);
809 text.glPrint(280,125,string,1,1,640,480);
813 if(flashamount>1)flashamount=1;
814 if(flashdelay<=0)flashamount-=multiplier;
816 if(flashamount<0)flashamount=0;
817 glDisable(GL_DEPTH_TEST); // Disables Depth Testing
818 glDisable(GL_CULL_FACE);
819 glDisable(GL_LIGHTING);
820 glDisable(GL_TEXTURE_2D);
822 glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
823 glPushMatrix(); // Store The Projection Matrix
824 glLoadIdentity(); // Reset The Projection Matrix
825 glOrtho(0,screenwidth,0,screenheight,-100,100); // Set Up An Ortho Screen
826 glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
827 glPushMatrix(); // Store The Modelview Matrix
828 glLoadIdentity(); // Reset The Modelview Matrix
829 glScalef(screenwidth,screenheight,1);
830 glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
832 glColor4f(flashr,flashg,flashb,flashamount);
834 glVertex3f(0, 0, 0.0f);
835 glVertex3f(256, 0, 0.0f);
836 glVertex3f(256, 256, 0.0f);
837 glVertex3f(0, 256, 0.0f);
839 glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
840 glPopMatrix(); // Restore The Old Projection Matrix
841 glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
842 glPopMatrix(); // Restore The Old Projection Matrix
843 glEnable(GL_DEPTH_TEST); // Enables Depth Testing
844 glEnable(GL_CULL_FACE);
854 void Game::FadeLoadingScreen(float howmuch)
856 static float loadprogress,minprogress,maxprogress;
861 glClearColor(0,0,0,1);
862 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
864 loadprogress=howmuch;
866 //loadprogress=abs(Random()%100);
870 //glEnable(GL_TEXTURE_2D);
871 glDisable(GL_TEXTURE_2D);
872 //glBindTexture( GL_TEXTURE_2D, loadscreentexture);
873 glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE );
874 glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE );
875 glDisable(GL_DEPTH_TEST); // Disables Depth Testing
876 glDisable(GL_CULL_FACE);
877 glDisable(GL_LIGHTING);
879 glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
880 glPushMatrix(); // Store The Projection Matrix
881 glLoadIdentity(); // Reset The Projection Matrix
882 glOrtho(0,screenwidth,0,screenheight,-100,100); // Set Up An Ortho Screen
883 glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
884 glPushMatrix(); // Store The Modelview Matrix
885 glLoadIdentity(); // Reset The Modelview Matrix
886 glTranslatef(screenwidth/2,screenheight/2,0);
887 glScalef((float)screenwidth/2,(float)screenheight/2,1);
888 glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
890 glColor4f(loadprogress/100,0,0,1);
891 /*if(loadscreencolor==0)glColor4f(1,1,1,1);
892 if(loadscreencolor==1)glColor4f(1,0,0,1);
893 if(loadscreencolor==2)glColor4f(0,1,0,1);
894 if(loadscreencolor==3)glColor4f(0,0,1,1);
895 if(loadscreencolor==4)glColor4f(1,1,0,1);
896 if(loadscreencolor==5)glColor4f(1,0,1,1);
899 //glScalef(.25,.25,.25);
902 glVertex3f(-1, -1, 0.0f);
904 glVertex3f(1, -1, 0.0f);
906 glVertex3f(1, 1, 0.0f);
908 glVertex3f(-1, 1, 0.0f);
911 glDisable(GL_TEXTURE_2D);
912 glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
913 glPopMatrix(); // Restore The Old Projection Matrix
914 glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
915 glPopMatrix(); // Restore The Old Projection Matrix
920 glEnable(GL_TEXTURE_2D);
921 static char string[256]="";
922 sprintf (string, "LOADING... %d%",(int)loadprogress);
924 text.glPrint(280-280*loadprogress/100/2/4,125-125*loadprogress/100/2/4,string,1,1+loadprogress/100,640,480);
925 glColor4f(1.2-loadprogress/100,1.2-loadprogress/100,1.2-loadprogress/100,1);
926 text.glPrint(280,125,string,1,1,640,480);
933 void Game::InitGame()
936 ProcessSerialNumber PSN;
937 ProcessInfoRec pinfo;
940 /* set up process serial number */
941 PSN.highLongOfPSN = 0;
942 PSN.lowLongOfPSN = kCurrentProcess;
943 /* set up info block */
944 pinfo.processInfoLength = sizeof(pinfo);
945 pinfo.processName = NULL;
946 pinfo.processAppSpec = &pspec;
947 /* grab the vrefnum and directory */
948 err = GetProcessInformation(&PSN, &pinfo);
950 vRefNum = pspec.vRefNum;
961 numchallengelevels=14;
965 /*char tempstring[256];
966 sprintf (tempstring, "%s", registrationname);
972 longnum = MD5_string ( tempstring);
973 //longnum = 1111111111111111;
974 num1 = longnum/100000000;
975 num2 = longnum%100000000;
976 sprintf (tempstring, "%d-%d-%d-%d", num1/10000, num1%10000, num2/10000, num2%10000);
980 tfile=fopen( ":Data:Sounds:flame.ogg", "rb" );
991 funpackf(tfile, "Bb", ®istered);
994 funpackf(tfile, "Bi", &numchars);
997 for(j=0;j<numchars;j++)
999 funpackf(tfile, "Bb", ®istrationname[j]);
1001 registrationname[numchars]='\0';
1002 funpackf(tfile, "Bi", &num1);
1003 funpackf(tfile, "Bi", &num2);
1004 longnum=num2+num1*100000000;
1006 char tempstring[256];
1007 sprintf (tempstring, "%s-windows", registrationname);
1008 longnuma = MD5_string ( tempstring);
1009 num1a = longnuma/100000000;
1010 num2a = longnuma%100000000;
1011 //if(num1a==num1&&num2a==num2)registered=1;
1012 if(numchars>2)registered=1;
1022 sprintf (mapname, ":Data:Users");
1023 tfile=fopen( mapname, "rb" );
1026 funpackf(tfile, "Bi", &numaccounts);
1027 funpackf(tfile, "Bi", &accountactive);
1030 for(i=0;i<numaccounts;i++)
1032 funpackf(tfile, "Bf", &accountcampaigntime[i]);
1033 funpackf(tfile, "Bf", &accountcampaignscore[i]);
1034 funpackf(tfile, "Bf", &accountcampaignfasttime[i]);
1035 funpackf(tfile, "Bf", &accountcampaignhighscore[i]);
1036 funpackf(tfile, "Bi", &accountdifficulty[i]);
1037 funpackf(tfile, "Bi", &accountprogress[i]);
1038 funpackf(tfile, "Bi", &accountcampaignchoicesmade[i]);
1039 for(j=0;j<accountcampaignchoicesmade[i];j++)
1041 funpackf(tfile, "Bi", &accountcampaignchoices[i][j]);
1042 if (accountcampaignchoices[i][j] >= 10)
1044 accountcampaignchoices[i][j] = 0;
1047 funpackf(tfile, "Bf", &accountpoints[i]);
1050 funpackf(tfile, "Bf", &accounthighscore[i][j]);
1051 funpackf(tfile, "Bf", &accountfasttime[i][j]);
1055 funpackf(tfile, "Bb", &accountunlocked[i][j]);
1058 funpackf(tfile, "Bi", &temp);
1063 funpackf(tfile, "Bb", &accountname[i][j]);
1076 whichjointstartarray[0]=righthip;
1077 whichjointendarray[0]=rightfoot;
1079 whichjointstartarray[1]=righthip;
1080 whichjointendarray[1]=rightankle;
1082 whichjointstartarray[2]=righthip;
1083 whichjointendarray[2]=rightknee;
1085 whichjointstartarray[3]=rightknee;
1086 whichjointendarray[3]=rightankle;
1088 whichjointstartarray[4]=rightankle;
1089 whichjointendarray[4]=rightfoot;
1091 whichjointstartarray[5]=lefthip;
1092 whichjointendarray[5]=leftfoot;
1094 whichjointstartarray[6]=lefthip;
1095 whichjointendarray[6]=leftankle;
1097 whichjointstartarray[7]=lefthip;
1098 whichjointendarray[7]=leftknee;
1100 whichjointstartarray[8]=leftknee;
1101 whichjointendarray[8]=leftankle;
1103 whichjointstartarray[9]=leftankle;
1104 whichjointendarray[9]=leftfoot;
1106 whichjointstartarray[10]=abdomen;
1107 whichjointendarray[10]=rightshoulder;
1109 whichjointstartarray[11]=abdomen;
1110 whichjointendarray[11]=rightelbow;
1112 whichjointstartarray[12]=abdomen;
1113 whichjointendarray[12]=rightwrist;
1115 whichjointstartarray[13]=abdomen;
1116 whichjointendarray[13]=righthand;
1118 whichjointstartarray[14]=rightshoulder;
1119 whichjointendarray[14]=rightelbow;
1121 whichjointstartarray[15]=rightelbow;
1122 whichjointendarray[15]=rightwrist;
1124 whichjointstartarray[16]=rightwrist;
1125 whichjointendarray[16]=righthand;
1127 whichjointstartarray[17]=abdomen;
1128 whichjointendarray[17]=leftshoulder;
1130 whichjointstartarray[18]=abdomen;
1131 whichjointendarray[18]=leftelbow;
1133 whichjointstartarray[19]=abdomen;
1134 whichjointendarray[19]=leftwrist;
1136 whichjointstartarray[20]=abdomen;
1137 whichjointendarray[20]=lefthand;
1139 whichjointstartarray[21]=leftshoulder;
1140 whichjointendarray[21]=leftelbow;
1142 whichjointstartarray[22]=leftelbow;
1143 whichjointendarray[22]=leftwrist;
1145 whichjointstartarray[23]=leftwrist;
1146 whichjointendarray[23]=lefthand;
1148 whichjointstartarray[24]=abdomen;
1149 whichjointendarray[24]=neck;
1151 whichjointstartarray[25]=neck;
1152 whichjointendarray[25]=head;
1154 FadeLoadingScreen(0);
1158 texture.data = ( GLubyte* )malloc( 1024*1024*4 );
1160 int temptexdetail=texdetail;
1162 text.LoadFontTexture(":Data:Textures:Font.png");
1164 texdetail=temptexdetail;
1166 FadeLoadingScreen(10);
1182 for (int it = 0; it < 100; ++it)
1187 for (int it = 0; it < 20; ++it)
1192 LOG("Initializing sound system...");
1194 FSOUND_Init(44100, 32, 0);
1196 FSOUND_SetSFXMasterVolume((int)(volume*255));
1198 strm[stream_music3] = FSOUND_Stream_Open(ConvertFileName(":Data:Sounds:music3.mp3"), FSOUND_2D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=0;}
1199 // FSOUND_Sample_SetMinMaxDistance(strm[stream_music3], 4.0f, 1000.0f);
1200 FSOUND_Stream_SetMode(strm[stream_music3], FSOUND_LOOP_NORMAL);
1203 // PlaySoundEx( stream_music3, strm[stream_music3], NULL, TRUE);
1204 PlayStreamEx(stream_music3, strm[stream_music3], 0, TRUE);
1205 FSOUND_SetPaused(channels[stream_music3], FALSE);
1206 FSOUND_SetVolume(channels[stream_music3], 256);
1209 FadeLoadingScreen(20);
1212 strm[stream_wind] = FSOUND_Stream_Open(ConvertFileName(":Data:Sounds:wind.mp3"), FSOUND_2D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
1213 // FSOUND_Sample_SetMinMaxDistance(strm[stream_wind], 4.0f, 1000.0f);
1214 FSOUND_Stream_SetMode(strm[stream_wind], FSOUND_LOOP_NORMAL);
1216 FadeLoadingScreen(30);
1218 strm[stream_desertambient] = FSOUND_Stream_Open(ConvertFileName(":Data:Sounds:desertambient.mp3"), FSOUND_2D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
1219 // FSOUND_Sample_SetMinMaxDistance(strm[stream_desertambient], 4.0f, 1000.0f);
1220 FSOUND_Stream_SetMode(strm[stream_desertambient], FSOUND_LOOP_NORMAL);
1223 FadeLoadingScreen(40);
1225 samp[firestartsound] = FSOUND_Sample_Load(FSOUND_FREE, ConvertFileName(":Data:Sounds:firestart.ogg"), FSOUND_2D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
1226 FSOUND_Sample_SetMinMaxDistance(samp[firestartsound], 8.0f, 2000.0f);
1228 strm[stream_firesound] = FSOUND_Stream_Open(":Data:Sounds:fire.ogg", FSOUND_2D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
1229 // FSOUND_Sample_SetMinMaxDistance(strm[stream_firesound], 8.0f, 2000.0f);
1230 FSOUND_Stream_SetMode(strm[stream_firesound], FSOUND_LOOP_NORMAL);
1232 FadeLoadingScreen(50);
1234 samp[fireendsound] = FSOUND_Sample_Load(FSOUND_FREE, ConvertFileName(":Data:Sounds:fireend.ogg"), FSOUND_2D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=5;}
1235 FSOUND_Sample_SetMinMaxDistance(samp[fireendsound], 8.0f, 2000.0f);
1238 strm[stream_music1grass] = FSOUND_Stream_Open(ConvertFileName(":Data:Sounds:music1grass.mp3"), FSOUND_2D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=1;}
1239 // FSOUND_Sample_SetMinMaxDistance(strm[stream_music1grass], 4.0f, 1000.0f);
1240 FSOUND_Stream_SetMode(strm[stream_music1grass], FSOUND_LOOP_NORMAL);
1242 strm[stream_music1snow] = FSOUND_Stream_Open(ConvertFileName(":Data:Sounds:music1snow.mp3"), FSOUND_2D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=2;}
1243 // FSOUND_Sample_SetMinMaxDistance(strm[stream_music1snow], 4.0f, 1000.0f);
1244 FSOUND_Stream_SetMode(strm[stream_music1snow], FSOUND_LOOP_NORMAL);
1246 FadeLoadingScreen(60);
1248 strm[stream_music1desert] = FSOUND_Stream_Open(ConvertFileName(":Data:Sounds:music1desert.mp3"), FSOUND_2D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=3;}
1249 // FSOUND_Sample_SetMinMaxDistance(strm[stream_music1desert], 4.0f, 1000.0f);
1250 FSOUND_Stream_SetMode(strm[stream_music1desert], FSOUND_LOOP_NORMAL);
1252 FadeLoadingScreen(80);
1253 strm[stream_music2] = FSOUND_Stream_Open(ConvertFileName(":Data:Sounds:music2.ogg"), FSOUND_2D, 0, 0); if(visibleloading){LoadingScreen(); loadscreencolor=4;}
1254 // FSOUND_Sample_SetMinMaxDistance(strm[stream_music2], 4.0f, 1000.0f);
1255 FSOUND_Stream_SetMode(strm[stream_music2], FSOUND_LOOP_NORMAL);
1260 FadeLoadingScreen(90);
1263 LoadTexture(":Data:Textures:Cursor.png",&cursortexture,0,1);
1265 LoadTexture(":Data:Textures:MapCircle.png",&Mapcircletexture,0,1);
1266 LoadTexture(":Data:Textures:MapBox.png",&Mapboxtexture,0,1);
1267 LoadTexture(":Data:Textures:MapArrow.png",&Maparrowtexture,0,1);
1269 temptexdetail=texdetail;
1270 if(texdetail>2)texdetail=2;
1271 LoadTexture(":Data:Textures:Lugaru.png",&Mainmenuitems[0],0,0);
1272 LoadTexture(":Data:Textures:Newgame.png",&Mainmenuitems[1],0,0);
1273 LoadTexture(":Data:Textures:Options.png",&Mainmenuitems[2],0,0);
1274 LoadTexture(":Data:Textures:Quit.png",&Mainmenuitems[3],0,0);
1275 LoadTexture(":Data:Textures:World.png",&Mainmenuitems[7],0,0);
1276 LoadTexture(":Data:Textures:Eyelid.png",&Mainmenuitems[4],0,1);
1277 //LoadTexture(":Data:Textures:Eye.jpg",&Mainmenuitems[5],0,1);
1278 texdetail=temptexdetail;
1283 FadeLoadingScreen(95);
1294 newscreenwidth=screenwidth;
1295 newscreenheight=screenheight;
1300 float gLoc[3]={0,0,0};
1301 float vel[3]={0,0,0};
1302 FSOUND_Sample_SetMinMaxDistance(samp[firestartsound], 9999.0f, 99999.0f);
1303 PlaySoundEx( firestartsound, samp[firestartsound], NULL, TRUE);
1304 FSOUND_3D_SetAttributes(channels[firestartsound], gLoc, vel);
1305 FSOUND_SetVolume(channels[firestartsound], 256);
1306 FSOUND_SetPaused(channels[firestartsound], FALSE);
1307 FSOUND_Sample_SetMinMaxDistance(samp[firestartsound], 8.0f, 2000.0f);
1318 void Game::LoadStuff()
1320 static float temptexdetail;
1321 static float viewdistdetail;
1322 static int i,j,texsize;
1329 /*musicvolume[3]=512;
1330 PlaySoundEx( music4, samp[music4], NULL, TRUE);
1331 FSOUND_SetPaused(channels[music4], FALSE);
1332 FSOUND_SetVolume(channels[music4], 512);
1338 //texture.data = ( GLubyte* )malloc( 1024*1024*4 );
1342 for(i=0;i<maxplayers;i++)
1344 if (glIsTexture(player[i].skeleton.drawmodel.textureptr))
1346 glDeleteTextures(1, &player[i].skeleton.drawmodel.textureptr);
1348 player[i].skeleton.drawmodel.textureptr=0;;
1351 //temptexdetail=texdetail;
1354 LoadTexture(":Data:Textures:fire.jpg",&loadscreentexture,1,0);
1355 //texdetail=temptexdetail;
1357 temptexdetail=texdetail;
1359 text.LoadFontTexture(":Data:Textures:Font.png");
1361 texdetail=temptexdetail;
1366 viewdistance=50*megascale*viewdistdetail;
1386 realtexdetail=texdetail;
1389 if(texdetail<1)texdetail=1;
1390 realtexdetail=texdetail*4;
1396 /*LoadTexture(":Data:Textures:snow.png",&terraintexture,1);
1398 LoadTexture(":Data:Textures:rock.png",&terraintexture2,1);
1400 LoadTexture(":Data:Textures:detail.png",&terraintexture3,1);
1404 LOG("Loading weapon data...");
1406 LoadTexture(":Data:Textures:knife.png",&weapons.knifetextureptr,0,1);
1407 LoadTexture(":Data:Textures:bloodknife.png",&weapons.bloodknifetextureptr,0,1);
1408 LoadTexture(":Data:Textures:lightbloodknife.png",&weapons.lightbloodknifetextureptr,0,1);
1409 LoadTexture(":Data:Textures:sword.jpg",&weapons.swordtextureptr,1,0);
1410 LoadTexture(":Data:Textures:Swordblood.jpg",&weapons.bloodswordtextureptr,1,0);
1411 LoadTexture(":Data:Textures:Swordbloodlight.jpg",&weapons.lightbloodswordtextureptr,1,0);
1412 LoadTexture(":Data:Textures:Staff.jpg",&weapons.stafftextureptr,1,0);
1414 weapons.throwingknifemodel.load((char *)":Data:Models:throwingknife.solid",1);
1415 weapons.throwingknifemodel.Scale(.001,.001,.001);
1416 //weapons.throwingknifemodel.Rotate(0,0,-90);
1417 weapons.throwingknifemodel.Rotate(90,0,0);
1418 weapons.throwingknifemodel.Rotate(0,90,0);
1419 weapons.throwingknifemodel.flat=0;
1420 weapons.throwingknifemodel.CalculateNormals(1);
1421 //weapons.throwingknifemodel.ScaleNormals(-1,-1,-1);
1423 weapons.swordmodel.load((char *)":Data:Models:sword.solid",1);
1424 weapons.swordmodel.Scale(.001,.001,.001);
1425 //weapons.swordmodel.Rotate(0,0,-90);
1426 weapons.swordmodel.Rotate(90,0,0);
1427 weapons.swordmodel.Rotate(0,90,0);
1428 weapons.swordmodel.Rotate(0,0,90);
1429 weapons.swordmodel.flat=1;
1430 weapons.swordmodel.CalculateNormals(1);
1431 //weapons.swordmodel.ScaleNormals(-1,-1,-1);
1433 weapons.staffmodel.load((char *)":Data:Models:staff.solid",1);
1434 weapons.staffmodel.Scale(.005,.005,.005);
1435 //weapons.staffmodel.Rotate(0,0,-90);
1436 weapons.staffmodel.Rotate(90,0,0);
1437 weapons.staffmodel.Rotate(0,90,0);
1438 weapons.staffmodel.Rotate(0,0,90);
1439 weapons.staffmodel.flat=1;
1440 weapons.staffmodel.CalculateNormals(1);
1441 //weapons.staffmodel.ScaleNormals(-1,-1,-1);
1443 //temptexdetail=texdetail;
1444 //if(texdetail>4)texdetail=4;
1445 LoadTexture(":Data:Textures:shadow.png",&terrain.shadowtexture,0,1);
1447 LoadTexture(":Data:Textures:blood.png",&terrain.bloodtexture,0,1);
1449 LoadTexture(":Data:Textures:break.png",&terrain.breaktexture,0,1);
1451 LoadTexture(":Data:Textures:blood.png",&terrain.bloodtexture2,0,1);
1454 LoadTexture(":Data:Textures:footprint.png",&terrain.footprinttexture,0,1);
1456 LoadTexture(":Data:Textures:bodyprint.png",&terrain.bodyprinttexture,0,1);
1458 /*LoadTexture(":Data:Textures:cloud.png",&sprites.cloudtexture,1);
1460 LoadTexture(":Data:Textures:cloudimpact.png",&sprites.cloudimpacttexture,1);
1462 LoadTexture(":Data:Textures:bloodparticle.png",&sprites.bloodtexture,1);
1464 LoadTexture(":Data:Textures:snowflake.png",&sprites.snowflaketexture,1);
1466 LoadTexture(":Data:Textures:flame.png",&sprites.flametexture,1);
1468 LoadTexture(":Data:Textures:smoke.png",&sprites.smoketexture,1);
1469 //texdetail=temptexdetail;
1470 LoadTexture(":Data:Textures:shine.png",&sprites.shinetexture,1);*/
1474 LoadTexture(":Data:Textures:hawk.png",&hawktexture,0,1);
1476 LoadTexture(":Data:Textures:logo.png",&logotexture,0,1);
1479 //LoadTexture(":Data:Textures:box.jpg",&objects.boxtextureptr,1,0);
1482 LoadTexture(":Data:Textures:cloud.png",&sprites.cloudtexture,1,1);
1483 LoadTexture(":Data:Textures:cloudimpact.png",&sprites.cloudimpacttexture,1,1);
1484 LoadTexture(":Data:Textures:bloodparticle.png",&sprites.bloodtexture,1,1);
1485 LoadTexture(":Data:Textures:snowflake.png",&sprites.snowflaketexture,1,1);
1486 LoadTexture(":Data:Textures:flame.png",&sprites.flametexture,1,1);
1487 LoadTexture(":Data:Textures:bloodflame.png",&sprites.bloodflametexture,1,1);
1488 LoadTexture(":Data:Textures:smoke.png",&sprites.smoketexture,1,1);
1489 LoadTexture(":Data:Textures:shine.png",&sprites.shinetexture,1,0);
1490 LoadTexture(":Data:Textures:splinter.png",&sprites.splintertexture,1,1);
1491 LoadTexture(":Data:Textures:leaf.png",&sprites.leaftexture,1,1);
1492 LoadTexture(":Data:Textures:tooth.png",&sprites.toothtexture,1,1);
1496 ReSizeGLScene(90,.01);
1503 if(detail)kTextureSize=1024;
1504 if(detail==1)kTextureSize=512;
1505 if(detail==0)kTextureSize=256;
1508 //drawmode=motionblurmode;
1510 //Set up distant light
1514 light.ambient[0]=.2;
1515 light.ambient[1]=.2;
1516 light.ambient[2]=.24;
1519 light.location.z=-.2;
1520 Normalise(&light.location);
1530 texscale=.2/megascale/viewdistdetail;
1531 terrain.scale=3*megascale*terraindetail*viewdistdetail;
1533 viewer.x=terrain.size/2*terrain.scale;
1534 viewer.z=terrain.size/2*terrain.scale;
1536 hawk.load((char *)":Data:Models:hawk.solid",1);
1537 hawk.Scale(.03,.03,.03);
1538 hawk.Rotate(90,1,1);
1539 hawk.CalculateNormals(0);
1540 hawk.ScaleNormals(-1,-1,-1);
1541 hawkcoords.x=terrain.size/2*terrain.scale-5-7;
1542 hawkcoords.z=terrain.size/2*terrain.scale-5-7;
1543 hawkcoords.y=terrain.getHeight(hawkcoords.x,hawkcoords.z)+25;
1546 eye.load((char *)":Data:Models:eye.solid",1);
1547 eye.Scale(.03,.03,.03);
1548 eye.CalculateNormals(0);
1550 cornea.load((char *)":Data:Models:cornea.solid",1);
1551 cornea.Scale(.03,.03,.03);
1552 cornea.CalculateNormals(0);
1554 iris.load((char *)":Data:Models:iris.solid",1);
1555 iris.Scale(.03,.03,.03);
1556 iris.CalculateNormals(0);
1558 LoadSave(":Data:Textures:Bloodfur.png",0,1,&bloodText[0],0);
1559 LoadSave(":Data:Textures:Wolfbloodfur.png",0,1,&wolfbloodText[0],0);
1567 //if(targetlevel!=7)
1568 Loadlevel(targetlevel);
1571 rabbitcoords=player[0].coords;
1572 rabbitcoords.y=terrain.getHeight(rabbitcoords.x,rabbitcoords.z);
1574 animation[runanim].Load((char *)":Data:Animations:Run",middleheight,neutral);
1576 animation[bounceidleanim].Load((char *)":Data:Animations:Idle",middleheight,neutral);
1577 animation[stopanim].Load((char *)":Data:Animations:Stop",middleheight,neutral);
1579 animation[jumpupanim].Load((char *)":Data:Animations:JumpUp",highheight,neutral);
1580 animation[jumpdownanim].Load((char *)":Data:Animations:JumpDown",highheight,neutral);
1582 animation[landanim].Load((char *)":Data:Animations:Landing",lowheight,neutral);
1583 animation[landhardanim].Load((char *)":Data:Animations:Landhard",lowheight,neutral);
1584 animation[climbanim].Load((char *)":Data:Animations:Climb",lowheight,neutral);
1585 animation[hanganim].Load((char *)":Data:Animations:Hangon",lowheight,neutral);
1586 animation[spinkickanim].Load((char *)":Data:Animations:SpinKick",middleheight,normalattack);
1588 animation[getupfromfrontanim].Load((char *)":Data:Animations:GetUpFromFront",lowheight,neutral);
1589 animation[getupfrombackanim].Load((char *)":Data:Animations:GetUpFromBack",lowheight,neutral);
1590 animation[crouchanim].Load((char *)":Data:Animations:Crouch",lowheight,neutral);
1591 animation[sneakanim].Load((char *)":Data:Animations:Sneak",lowheight,neutral);
1592 animation[rollanim].Load((char *)":Data:Animations:Roll",lowheight,neutral);
1593 animation[flipanim].Load((char *)":Data:Animations:Flip",highheight,neutral);
1594 animation[frontflipanim].Load((char *)":Data:Animations:Flip",highheight,neutral);
1595 animation[spinkickreversedanim].Load((char *)":Data:Animations:SpinKickCaught",middleheight,reversed);
1597 animation[spinkickreversalanim].Load((char *)":Data:Animations:SpinKickCatch",middleheight,reversal);
1598 animation[lowkickanim].Load((char *)":Data:Animations:lowkick",middleheight,normalattack);
1599 animation[sweepanim].Load((char *)":Data:Animations:sweep",lowheight,normalattack);
1600 animation[sweepreversedanim].Load((char *)":Data:Animations:SweepCaught",lowheight,reversed);
1601 animation[sweepreversalanim].Load((char *)":Data:Animations:SweepCatch",middleheight,reversal);
1602 animation[rabbitkickanim].Load((char *)":Data:Animations:RabbitKick",middleheight,normalattack);
1603 animation[rabbitkickreversedanim].Load((char *)":Data:Animations:RabbitKickCaught",middleheight,reversed);
1604 animation[rabbitkickreversalanim].Load((char *)":Data:Animations:RabbitKickCatch",lowheight,reversal);
1605 animation[upunchanim].Load((char *)":Data:Animations:Upunch",middleheight,normalattack);
1606 animation[staggerbackhighanim].Load((char *)":Data:Animations:Staggerbackhigh",middleheight,neutral);
1607 animation[upunchreversedanim].Load((char *)":Data:Animations:UpunchCaught",middleheight,reversed);
1609 animation[upunchreversalanim].Load((char *)":Data:Animations:UpunchCatch",middleheight,reversal);
1610 animation[hurtidleanim].Load((char *)":Data:Animations:Hurtidle",middleheight,neutral);
1611 animation[backhandspringanim].Load((char *)":Data:Animations:Backhandspring",middleheight,neutral);
1612 animation[fightidleanim].Load((char *)":Data:Animations:Fightidle",middleheight,neutral);
1613 animation[walkanim].Load((char *)":Data:Animations:Walk",middleheight,neutral);
1615 animation[fightsidestep].Load((char *)":Data:Animations:Fightsidestep",middleheight,neutral);
1616 animation[killanim].Load((char *)":Data:Animations:Kill",middleheight,normalattack);
1617 animation[sneakattackanim].Load((char *)":Data:Animations:Sneakattack",middleheight,reversal);
1618 animation[sneakattackedanim].Load((char *)":Data:Animations:Sneakattacked",middleheight,reversed);
1619 animation[drawrightanim].Load((char *)":Data:Animations:drawright",middleheight,neutral);
1620 animation[knifeslashstartanim].Load((char *)":Data:Animations:slashstart",middleheight,normalattack);
1621 animation[crouchdrawrightanim].Load((char *)":Data:Animations:crouchdrawright",lowheight,neutral);
1622 animation[crouchstabanim].Load((char *)":Data:Animations:crouchstab",lowheight,normalattack);
1624 animation[knifefollowanim].Load((char *)":Data:Animations:slashfollow",middleheight,reversal);
1625 animation[knifefollowedanim].Load((char *)":Data:Animations:slashfollowed",middleheight,reversed);
1626 animation[knifethrowanim].Load((char *)":Data:Animations:knifethrow",middleheight,normalattack);
1627 animation[removeknifeanim].Load((char *)":Data:Animations:removeknife",middleheight,neutral);
1628 animation[crouchremoveknifeanim].Load((char *)":Data:Animations:crouchremoveknife",lowheight,neutral);
1629 animation[jumpreversedanim].Load((char *)":Data:Animations:JumpCaught",middleheight,reversed);
1630 animation[jumpreversalanim].Load((char *)":Data:Animations:JumpCatch",middleheight,reversal);
1631 animation[staggerbackhardanim].Load((char *)":Data:Animations:Staggerbackhard",middleheight,neutral);
1633 animation[dropkickanim].Load((char *)":Data:Animations:Dropkick",middleheight,normalattack);
1634 animation[winduppunchanim].Load((char *)":Data:Animations:Winduppunch",middleheight,normalattack);
1635 animation[winduppunchblockedanim].Load((char *)":Data:Animations:Winduppunchblocked",middleheight,normalattack);
1636 animation[blockhighleftanim].Load((char *)":Data:Animations:Blockhighleft",middleheight,normalattack);
1637 animation[blockhighleftstrikeanim].Load((char *)":Data:Animations:Blockhighleftstrike",middleheight,normalattack);
1638 animation[backflipanim].Load((char *)":Data:Animations:Backflip",highheight,neutral);
1639 animation[walljumpbackanim].Load((char *)":Data:Animations:Walljumpback",highheight,neutral);
1640 animation[walljumpfrontanim].Load((char *)":Data:Animations:Walljumpfront",highheight,neutral);
1641 animation[rightflipanim].Load((char *)":Data:Animations:Rightflip",highheight,neutral);
1642 animation[walljumprightanim].Load((char *)":Data:Animations:Walljumpright",highheight,neutral);
1643 animation[leftflipanim].Load((char *)":Data:Animations:Leftflip",highheight,neutral);
1644 animation[walljumpleftanim].Load((char *)":Data:Animations:Walljumpleft",highheight,neutral);
1645 animation[walljumprightkickanim].Load((char *)":Data:Animations:Walljumprightkick",highheight,neutral);
1646 animation[walljumpleftkickanim].Load((char *)":Data:Animations:Walljumpleftkick",highheight,neutral);
1647 animation[knifefightidleanim].Load((char *)":Data:Animations:Knifefightidle",middleheight,neutral);
1648 animation[knifesneakattackanim].Load((char *)":Data:Animations:Knifesneakattack",middleheight,reversal);
1649 animation[knifesneakattackedanim].Load((char *)":Data:Animations:Knifesneakattacked",middleheight,reversed);
1650 animation[swordfightidleanim].Load((char *)":Data:Animations:swordfightidle",middleheight,neutral);
1651 animation[drawleftanim].Load((char *)":Data:Animations:drawleft",middleheight,neutral);
1652 animation[swordslashanim].Load((char *)":Data:Animations:swordslash",middleheight,normalattack);
1653 animation[swordgroundstabanim].Load((char *)":Data:Animations:swordgroundstab",lowheight,normalattack);
1654 animation[dodgebackanim].Load((char *)":Data:Animations:dodgeback",middleheight,neutral);
1655 animation[swordsneakattackanim].Load((char *)":Data:Animations:Swordsneakattack",middleheight,reversal);
1656 animation[swordsneakattackedanim].Load((char *)":Data:Animations:Swordsneakattacked",middleheight,reversed);
1657 animation[swordslashreversedanim].Load((char *)":Data:Animations:swordslashCaught",middleheight,reversed);
1658 animation[swordslashreversalanim].Load((char *)":Data:Animations:swordslashCatch",middleheight,reversal);
1659 animation[knifeslashreversedanim].Load((char *)":Data:Animations:knifeslashCaught",middleheight,reversed);
1660 animation[knifeslashreversalanim].Load((char *)":Data:Animations:knifeslashCatch",middleheight,reversal);
1661 animation[swordfightidlebothanim].Load((char *)":Data:Animations:swordfightidleboth",middleheight,neutral);
1662 animation[swordslashparryanim].Load((char *)":Data:Animations:sworduprightparry",middleheight,normalattack);
1663 animation[swordslashparriedanim].Load((char *)":Data:Animations:swordslashparried",middleheight,normalattack);
1664 animation[wolfidle].Load((char *)":Data:Animations:Wolfidle",middleheight,neutral);
1665 animation[wolfcrouchanim].Load((char *)":Data:Animations:Wolfcrouch",lowheight,neutral);
1666 animation[wolflandanim].Load((char *)":Data:Animations:Wolflanding",lowheight,neutral);
1667 animation[wolflandhardanim].Load((char *)":Data:Animations:Wolflandhard",lowheight,neutral);
1668 animation[wolfrunanim].Load((char *)":Data:Animations:Wolfrun",middleheight,neutral);
1669 animation[wolfrunninganim].Load((char *)":Data:Animations:Wolfrunning",middleheight,neutral);
1670 animation[rabbitrunninganim].Load((char *)":Data:Animations:Rabbitrunning",middleheight,neutral);
1671 animation[wolfstopanim].Load((char *)":Data:Animations:Wolfstop",middleheight,neutral);
1672 animation[rabbittackleanim].Load((char *)":Data:Animations:Rabbittackle",middleheight,neutral);
1673 animation[rabbittacklinganim].Load((char *)":Data:Animations:Rabbittackling",middleheight,reversal);
1674 animation[rabbittackledbackanim].Load((char *)":Data:Animations:Rabbittackledback",middleheight,reversed);
1675 animation[rabbittackledfrontanim].Load((char *)":Data:Animations:Rabbittackledfront",middleheight,reversed);
1676 animation[wolfslapanim].Load((char *)":Data:Animations:Wolfslap",middleheight,normalattack);
1677 animation[staffhitanim].Load((char *)":Data:Animations:StaffHit",middleheight,normalattack);
1678 animation[staffgroundsmashanim].Load((char *)":Data:Animations:StaffGroundSmash",lowheight,normalattack);
1679 animation[staffspinhitanim].Load((char *)":Data:Animations:Spinwhack",middleheight,normalattack);
1680 animation[staffhitreversedanim].Load((char *)":Data:Animations:StaffHitCaught",middleheight,reversed);
1681 animation[staffhitreversalanim].Load((char *)":Data:Animations:StaffHitCatch",middleheight,reversal);
1682 animation[staffspinhitreversedanim].Load((char *)":Data:Animations:SpinWhackCaught",middleheight,reversed);
1683 animation[staffspinhitreversalanim].Load((char *)":Data:Animations:SpinWhackCatch",middleheight,reversal);
1685 animation[sitanim].Load((char *)":Data:Animations:Sit",lowheight,neutral);
1686 animation[sleepanim].Load((char *)":Data:Animations:Sleep",lowheight,neutral);
1687 animation[talkidleanim].Load((char *)":Data:Animations:TalkIdle",middleheight,neutral);
1689 animation[sitwallanim].Load((char *)":Data:Animations:Dying",lowheight,neutral);
1690 animation[dead1anim].Load((char *)":Data:Animations:Dead1",lowheight,neutral);
1691 animation[dead2anim].Load((char *)":Data:Animations:Dead2",lowheight,neutral);
1692 animation[dead3anim].Load((char *)":Data:Animations:Dead3",lowheight,neutral);
1693 animation[dead4anim].Load((char *)":Data:Animations:Dead4",lowheight,neutral);
1694 //Fix knife stab, too lazy to do it manually
1698 for(i=0;i<player[0].skeleton.num_joints;i++){
1699 for(j=0;j<animation[knifesneakattackanim].numframes;j++){
1700 animation[knifesneakattackanim].position[i][j]+=moveamount;
1707 for(i=0;i<player[0].skeleton.num_joints;i++){
1708 for(j=0;j<animation[knifesneakattackedanim].numframes;j++){
1709 animation[knifesneakattackedanim].position[i][j]+=moveamount;
1716 for(i=0;i<player[0].skeleton.num_joints;i++){
1717 animation[dead1anim].position[i][1]=animation[dead1anim].position[i][0];
1718 animation[dead2anim].position[i][1]=animation[dead2anim].position[i][0];
1719 animation[dead3anim].position[i][1]=animation[dead3anim].position[i][0];
1720 animation[dead4anim].position[i][1]=animation[dead4anim].position[i][0];
1722 animation[dead1anim].speed[0]=0.001;
1723 animation[dead2anim].speed[0]=0.001;
1724 animation[dead3anim].speed[0]=0.001;
1725 animation[dead4anim].speed[0]=0.001;
1727 animation[dead1anim].speed[1]=0.001;
1728 animation[dead2anim].speed[1]=0.001;
1729 animation[dead3anim].speed[1]=0.001;
1730 animation[dead4anim].speed[1]=0.001;
1732 for(i=0;i<player[0].skeleton.num_joints;i++){
1733 for(j=0;j<animation[swordsneakattackanim].numframes;j++){
1734 animation[swordsneakattackanim].position[i][j]+=moveamount;
1739 for(j=0;j<animation[swordsneakattackanim].numframes;j++){
1740 animation[swordsneakattackanim].weapontarget[j]+=moveamount;
1746 for(i=0;i<player[0].skeleton.num_joints;i++){
1747 for(j=0;j<animation[swordsneakattackedanim].numframes;j++){
1748 animation[swordsneakattackedanim].position[i][j]+=moveamount;
1752 for(i=0;i<player[0].skeleton.num_joints;i++){
1753 for(j=0;j<animation[sleepanim].numframes;j++){
1754 animation[sleepanim].position[i][j]=DoRotation(animation[sleepanim].position[i][j],0,180,0);
1760 temptexdetail=texdetail;
1762 texdetail=temptexdetail;
1769 glPixelStorei( GL_UNPACK_ALIGNMENT, 1 );
1771 glGenTextures( 1, &screentexture );
1772 glTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE );
1775 glEnable(GL_TEXTURE_2D);
1776 glBindTexture( GL_TEXTURE_2D, screentexture);
1777 glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR );
1778 glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR );
1780 glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 0, 0, kTextureSize, kTextureSize, 0);
1786 /*PlaySoundEx( consolesuccesssound, samp[consolesuccesssound], NULL, TRUE);
1787 FSOUND_SetVolume(channels[consolesuccesssound], 256);
1788 FSOUND_SetPaused(channels[consolesuccesssound], FALSE);
1791 float gLoc[3]={0,0,0};
1792 float vel[3]={0,0,0};
1793 FSOUND_Sample_SetMinMaxDistance(samp[fireendsound], 9999.0f, 99999.0f);
1794 PlaySoundEx( fireendsound, samp[fireendsound], NULL, TRUE);
1795 FSOUND_3D_SetAttributes(channels[fireendsound], gLoc, vel);
1796 FSOUND_SetVolume(channels[fireendsound], 256);
1797 FSOUND_SetPaused(channels[fireendsound], FALSE);
1798 FSOUND_Sample_SetMinMaxDistance(samp[fireendsound], 8.0f, 2000.0f);
1811 terraintexture2 = 0;
1812 terraintexture3 = 0;
1816 loadscreentexture = 0;
1817 Maparrowtexture = 0;
1819 Mapcircletexture = 0;
1822 memset(Mainmenuitems, 0, sizeof(Mainmenuitems));
1826 memset(startx, 0, sizeof(startx));
1827 memset(starty, 0, sizeof(starty));
1828 memset(endx, 0, sizeof(endx));
1829 memset(endy, 0, sizeof(endy));
1831 memset(selectedlong, 0, sizeof(selectedlong));
1832 memset(offsetx, 0, sizeof(offsetx));
1833 memset(offsety, 0, sizeof(offsety));
1834 memset(movex, 0, sizeof(movex));
1835 memset(movey, 0, sizeof(movey));
1836 memset(endy, 0, sizeof(endy));
1850 memset(menustring, 0, sizeof(menustring));
1851 memset(registrationname, 0, sizeof(registrationname));
1852 registrationnumber = 0;
1856 newscreenheight = 0;
1859 deltah = 0,deltav = 0;
1860 mousecoordh = 0,mousecoordv = 0;
1861 oldmousecoordh = 0,oldmousecoordv = 0;
1862 rotation = 0,rotation2 = 0;
1867 cameratogglekeydown = 0;
1868 chattogglekeydown = 0;
1871 drawmodetogglekeydown = 0;
1872 explodetogglekeydown = 0;
1873 detailtogglekeydown = 0;
1883 // XYZ realhawkcoords;
1895 campaignnumlevels = 0;
1897 memset(campaignmapname, 0, sizeof(campaignmapname));
1898 memset(campaigndescription, 0, sizeof(campaigndescription));
1899 memset(campaignchoosenext, 0, sizeof(campaignchoosenext));
1900 memset(campaignnumnext, 0, sizeof(campaignnumnext));
1901 memset(campaignnextlevel, 0, sizeof(campaignnextlevel));
1902 int campaignchoicesmade;
1903 memset(campaignchoices, 0, sizeof(campaignchoices));
1904 memset(campaignlocationx, 0, sizeof(campaignlocationx));
1905 memset(campaignlocationy, 0, sizeof(campaignlocationy));
1906 memset(campaignlocationy, 0, sizeof(campaignlocationy));
1908 campaignchoicenum = 0;
1910 memset(campaignchoicewhich, 0, sizeof(campaignchoicewhich));
1914 numlevelspassed = 0;
1916 memset(levelorder, 0, sizeof(levelorder));
1917 memset(levelvisible, 0, sizeof(levelvisible));
1918 memset(levelhighlight, 0, sizeof(levelhighlight));
1922 musictype = 0,oldmusictype = 0,oldoldmusictype = 0;
1926 // XYZ rabbitcoords;
1937 envtogglekeydown = 0;
1938 slomotogglekeydown = 0;
1939 texturesizetogglekeydown = 0;
1940 freezetogglekeydown = 0;
1947 editorrotation2 = 0;
1954 // XYZ pathpoint[30];
1956 memset(numpathpointconnect, 0, sizeof(numpathpointconnect));
1957 memset(pathpointconnect, 0, sizeof(pathpointconnect));
1958 pathpointselected = 0;
1962 numchallengelevels = 0;
1965 archiveselected = 0;
1967 memset(consoletext, 0, sizeof(consoletext));
1968 memset(consolechars, 0, sizeof(consolechars));
1970 memset(displaytext, 0, sizeof(displaytext));
1971 memset(displaychars, 0, sizeof(displaychars));
1972 memset(displaytime, 0, sizeof(displaytime));
1973 displayblinkdelay = 0;
1975 displayselected = 0;
1977 consoletogglekeydown = 0;
1978 consoleblinkdelay = 0;
1980 consoleselected = 0;
1981 memset(togglekey, 0, sizeof(togglekey));
1982 memset(togglekeydelay, 0, sizeof(togglekeydelay));
1986 crouchkey = 0,jumpkey = 0,forwardkey = 0,chatkey = 0,backkey = 0,leftkey = 0,rightkey = 0,drawkey = 0,throwkey = 0,attackkey = 0;
1993 // XYZ boundary[360];
2000 memset(musicvolume, 0, sizeof(musicvolume));
2001 memset(oldmusicvolume, 0, sizeof(oldmusicvolume));