6 extern int environment;
9 extern Terrain terrain;
10 extern Sprites sprites;
11 extern float multiplier;
13 extern float viewdistance;
14 extern float fadestart;
15 extern float screenwidth,screenheight;
16 extern int kTextureSize;
17 extern FRUSTUM frustum;
19 extern Objects objects;
21 extern float usermousesensitivity;
23 extern float camerashake;
24 extern Weapons weapons;
25 extern Person player[maxplayers];
27 extern float slomodelay;
28 extern bool ismotionblur;
30 extern float blackout;
31 extern bool damageeffects;
33 extern int numplayers;
34 extern bool texttoggle;
35 extern float blurness;
36 extern float targetblurness;
37 extern float playerdist;
38 extern bool cellophane;
40 extern float flashamount,flashr,flashg,flashb;
41 extern int flashdelay;
43 extern float motionbluramount;
45 extern bool alwaysblur;
47 extern bool tilt2weird;
48 extern bool tiltweird;
50 extern bool proportionweird;
51 extern bool vertexweird[6];
52 extern bool velocityblur;
53 extern bool buttons[3];
54 extern bool debugmode;
56 extern int oldmainmenu;
57 extern int bloodtoggle;
58 extern int difficulty;
61 //extern int texdetail;
62 extern float texdetail;
63 extern bool musictoggle;
65 extern float bonusvalue;
66 extern float bonustotal;
67 extern float bonustime;
69 extern float startbonustotal;
70 extern float bonusnum[100];
71 extern int tutoriallevel;
72 extern float smoketex;
73 extern float tutorialstagetime;
74 extern float tutorialmaxtime;
75 extern int tutorialstage;
76 extern bool againbonus;
77 extern float damagedealt;
78 extern float damagetaken;
79 extern bool invertmouse;
81 extern int numhotspots;
82 extern int winhotspot;
83 extern int killhotspot;
84 extern XYZ hotspot[40];
85 extern int hotspottype[40];
86 extern float hotspotsize[40];
87 extern char hotspottext[40][256];
88 extern int currenthotspot;
90 extern int numaccounts;
91 extern int accountactive;
92 extern int accountdifficulty[10];
93 extern int accountprogress[10];
94 extern float accountpoints[10];
95 extern float accounthighscore[10][50];
96 extern float accountfasttime[10][50];
97 extern bool accountunlocked[10][60];
98 extern char accountname[10][256];
101 extern int numflipfail;
103 extern int numstaffattack;
104 extern int numswordattack;
105 extern int numknifeattack;
106 extern int numunarmedattack;
107 extern int numescaped;
108 extern int numflipped;
109 extern int numwallflipped;
110 extern int numthrowkill;
111 extern int numafterkill;
112 extern int numreversals;
113 extern int numattacks;
114 extern int maxalarmed;
115 extern int numresponded;
117 extern bool campaign;
118 extern bool winfreeze;
120 extern float menupulse;
122 extern bool gamestart;
124 extern int numdialogues;
125 extern int numdialogueboxes[max_dialogues];
126 extern int dialoguetype[max_dialogues];
127 extern int dialogueboxlocation[max_dialogues][max_dialoguelength];
128 extern float dialogueboxcolor[max_dialogues][max_dialoguelength][3];
129 extern int dialogueboxsound[max_dialogues][max_dialoguelength];
130 extern char dialoguetext[max_dialogues][max_dialoguelength][128];
131 extern char dialoguename[max_dialogues][max_dialoguelength][64];
132 extern XYZ dialoguecamera[max_dialogues][max_dialoguelength];
133 extern XYZ participantlocation[max_dialogues][10];
134 extern int participantfocus[max_dialogues][max_dialoguelength];
135 extern int participantaction[max_dialogues][max_dialoguelength];
136 extern float participantrotation[max_dialogues][10];
137 extern XYZ participantfacing[max_dialogues][max_dialoguelength][10];
138 extern float dialoguecamerarotation[max_dialogues][max_dialoguelength];
139 extern float dialoguecamerarotation2[max_dialogues][max_dialoguelength];
140 extern int indialogue;
141 extern int whichdialogue;
142 extern int directing;
143 extern float dialoguetime;
144 extern int dialoguegonethrough[20];
146 extern int accountcampaignchoicesmade[10];
147 extern int accountcampaignchoices[10][5000];
149 extern float accountcampaignhighscore[10];
150 extern float accountcampaignfasttime[10];
151 extern float accountcampaignscore[10];
152 extern float accountcampaigntime[10];
154 extern bool gamestarted;
156 extern FSOUND_SAMPLE *samp[100];
157 extern int channels[100];
158 extern "C" void PlaySoundEx(int channel, FSOUND_SAMPLE *sptr, FSOUND_DSPUNIT *dsp, signed char startpaused);
160 /*********************> DrawGLScene() <*****/
161 long long Game::MD5_string (char *string){
166 sprintf (temp, "%s",string);
169 while (i<256&&temp[i]!='\0'){
170 if(temp[i]%3==0)num+=temp[i]*124;
171 else if(temp[i]%3==1)num-=temp[i]*temp[i];
176 num=longlongabs(num);
179 while(num<LONGLONGCONST(5000000000000000)){
183 while(num>LONGLONGCONST(9900000000000000)){
189 //return 1111111111111111;
192 int Game::DrawGLScene(void)
194 static float texcoordwidth,texcoordheight;
195 static float texviewwidth, texviewheight;
197 static GLubyte color;
198 static float newbrightness;
199 static float changespeed;
200 static XYZ checkpoint;
201 static float tempmult;
203 static char string[256]="";
204 static char string2[256]="";
205 static char string3[256]="";
207 static float lastcheck;
209 lastcheck+=multiplier;
211 glColorMask( 1.0, 1.0, 1.0, 1.0 );
212 if(!registered)debugmode=0;
215 if(freeze||winfreeze||(mainmenu&&gameon)||(!gameon&&gamestarted)){
222 numboundaries=mapradius*2;
223 if(numboundaries>360)numboundaries=360;
224 for(i=0;i<numboundaries;i++){
227 boundary[i]=mapcenter+DoRotation(boundary[i]*mapradius,0,i*(360/((float)(numboundaries))),0);
236 olddrawmode=drawmode;
237 if(ismotionblur&&!loading){
238 if((findLengthfast(&player[0].velocity)>200)&&velocityblur&&!cameramode){
239 drawmode=motionblurmode;
240 motionbluramount=200/(findLengthfast(&player[0].velocity));
243 if(player[0].damage-player[0].superpermanentdamage>(player[0].damagetolerance-player[0].superpermanentdamage)*1/2&&damageeffects&&!cameramode){
244 drawmode=doublevisionmode;
251 drawmode=motionblurmode;
253 slomodelay-=multiplier;
254 if(slomodelay<0)slomo=0;
258 if((!changed&&!slomo)||loading){
260 if(ismotionblur&&(/*fps>100||*/alwaysblur)){
261 if(olddrawmode!=realmotionblurmode)change=1;
263 drawmode=realmotionblurmode;
265 else if(olddrawmode==realmotionblurmode)change=2;
269 if(freeze||winfreeze||(mainmenu&&gameon)||(!gameon&&gamestarted))drawmode=normalmode;
270 if((freeze||winfreeze)&&ismotionblur&&!mainmenu)drawmode=radialzoommode;
272 if(winfreeze||mainmenu)drawmode=normalmode;
275 if(drawmode==glowmode){
281 DSpContext_FadeGamma(NULL,200,&color2);
285 if(drawtoggle!=2)drawtoggle=1-drawtoggle;
289 texviewwidth=kTextureSize;
290 if(texviewwidth>screenwidth)texviewwidth=screenwidth;
291 texviewheight=kTextureSize;
292 if(texviewheight>screenheight)texviewheight=screenheight;
294 texcoordwidth=screenwidth/kTextureSize;
295 texcoordheight=screenheight/kTextureSize;
296 if(texcoordwidth>1)texcoordwidth=1;
297 if(texcoordheight>1)texcoordheight=1;
300 glDrawBuffer(GL_BACK);
301 glReadBuffer(GL_BACK);
303 /*if(environment==desertenvironment)glTexEnvf( GL_TEXTURE_FILTER_CONTROL_EXT, GL_TEXTURE_LOD_BIAS_EXT, (float)(abs(Random()%100))/50 );
304 else glTexEnvf( GL_TEXTURE_FILTER_CONTROL_EXT, GL_TEXTURE_LOD_BIAS_EXT, 0);
306 if(abs(blurness-targetblurness)<multiplier*10||abs(blurness-targetblurness)>2){
307 blurness=targetblurness;
308 targetblurness=(float)(abs(Random()%100))/40;
310 if(blurness<targetblurness)blurness+=multiplier*5;
311 if(blurness>targetblurness)blurness-=multiplier*5;
314 static XYZ terrainlight;
315 static float distance;
316 //if(drawmode==normalmode)ReSizeGLScene(90,.1);
317 if(drawmode==normalmode)ReSizeGLScene(90,.1f);
318 if(drawmode!=normalmode)glViewport(0,0,texviewwidth,texviewheight);
319 glDepthFunc(GL_LEQUAL);
321 glAlphaFunc(GL_GREATER, 0.0001f);
322 glEnable(GL_ALPHA_TEST);
323 glClearColor(0.25f, 0.25f, 0.25f, 1.0f);
324 glClear(GL_DEPTH_BUFFER_BIT);
326 glMatrixMode (GL_MODELVIEW);
327 glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
329 if(!cameramode&&!freeze&&!winfreeze){
330 glRotatef(float(Random()%100)/10*camerashake/*+(woozy*woozy)/10*/,0,0,1);
331 glRotatef(rotation2+sin(woozy/2)*(player[0].damage/player[0].damagetolerance)*5,1,0,0);
332 glRotatef(rotation+sin(woozy)*(player[0].damage/player[0].damagetolerance)*5,0,1,0);
334 if(cameramode||freeze||winfreeze){
335 //glRotatef(float(Random()%100)/10*camerashake/*+(woozy*woozy)/10*/,0,0,1);
336 glRotatef(rotation2,1,0,0);
337 glRotatef(rotation,0,1,0);
340 if(environment==desertenvironment){
341 glRotatef((float)(abs(Random()%100))/3000-1,1,0,0);
342 glRotatef((float)(abs(Random()%100))/3000-1,0,1,0);
343 //glRotatef(blurness/40-1,1,0,0);
344 //glRotatef(blurness/40-1,0,1,0);
346 SetUpLight(&light,0);
348 if(environment==desertenvironment&&detail==2)glTexEnvf( GL_TEXTURE_FILTER_CONTROL_EXT, GL_TEXTURE_LOD_BIAS_EXT, blurness+.4 );
349 if(environment==desertenvironment){
350 glRotatef((float)(abs(Random()%100))/1000,1,0,0);
351 glRotatef((float)(abs(Random()%100))/1000,0,1,0);
354 glTexEnvf( GL_TEXTURE_FILTER_CONTROL_EXT, GL_TEXTURE_LOD_BIAS_EXT, 0);
356 glTranslatef(-viewer.x,-viewer.y,-viewer.z);
357 frustum.GetFrustum();
361 static float size,opacity,rotation;
363 for(k=0;k<numplayers;k++){
364 if(!player[k].skeleton.free&&player[k].playerdetail&&player[k].howactive<typesleeping)
365 if(frustum.SphereInFrustum(player[k].coords.x,player[k].coords.y+player[k].scale*3,player[k].coords.z,player[k].scale*7)&&player[k].occluded<25)
366 for(i=0;i<player[k].skeleton.num_joints;i++){
367 if(player[k].skeleton.joints[i].label==leftknee||player[k].skeleton.joints[i].label==rightknee||player[k].skeleton.joints[i].label==groin){
368 point=DoRotation(player[k].skeleton.joints[i].position,0,player[k].rotation,0)*player[k].scale+player[k].coords;
370 opacity=.4-player[k].skeleton.joints[i].position.y*player[k].scale/5-(player[k].coords.y-terrain.getHeight(player[k].coords.x,player[k].coords.z))/10;
371 if(k!=0&&tutoriallevel==1){
372 opacity=.2+.2*sin(smoketex*6+i)-player[k].skeleton.joints[i].position.y*player[k].scale/5-(player[k].coords.y-terrain.getHeight(player[k].coords.x,player[k].coords.z))/10;
374 terrain.MakeDecal(shadowdecal,point,size,opacity,rotation);
375 if(terrain.patchobjectnum[player[k].whichpatchx][player[k].whichpatchz])
376 for(l=0;l<terrain.patchobjectnum[player[k].whichpatchx][player[k].whichpatchz];l++){
377 j=terrain.patchobjects[player[k].whichpatchx][player[k].whichpatchz][l];
378 if(objects.position[j].y<player[k].coords.y||objects.type[j]==tunneltype||objects.type[j]==weirdtype){
379 point=DoRotation(DoRotation(player[k].skeleton.joints[i].position,0,player[k].rotation,0)*player[k].scale+player[k].coords-objects.position[j],0,-objects.rotation[j],0);
382 if(k!=0&&tutoriallevel==1){
383 opacity=.2+.2*sin(smoketex*6+i);
385 objects.model[j].MakeDecal(shadowdecal,&point,&size,&opacity,&rotation);
390 if((player[k].skeleton.free||player[k].howactive>=typesleeping)&&player[k].playerdetail)
391 if(frustum.SphereInFrustum(player[k].coords.x,player[k].coords.y,player[k].coords.z,player[k].scale*5)&&player[k].occluded<25)
392 for(i=0;i<player[k].skeleton.num_joints;i++){
393 if(player[k].skeleton.joints[i].label==leftknee||player[k].skeleton.joints[i].label==rightknee||player[k].skeleton.joints[i].label==groin||player[k].skeleton.joints[i].label==leftelbow||player[k].skeleton.joints[i].label==rightelbow||player[k].skeleton.joints[i].label==neck){
394 if(player[k].skeleton.free)point=player[k].skeleton.joints[i].position*player[k].scale+player[k].coords;
395 else point=DoRotation(player[k].skeleton.joints[i].position,0,player[k].rotation,0)*player[k].scale+player[k].coords;
397 opacity=.4-player[k].skeleton.joints[i].position.y*player[k].scale/5-(player[k].coords.y-terrain.getHeight(player[k].coords.x,player[k].coords.z))/5;
398 if(k!=0&&tutoriallevel==1){
399 opacity=.2+.2*sin(smoketex*6+i)-player[k].skeleton.joints[i].position.y*player[k].scale/5-(player[k].coords.y-terrain.getHeight(player[k].coords.x,player[k].coords.z))/10;
401 terrain.MakeDecal(shadowdecal,point,size,opacity*.7,rotation);
402 if(terrain.patchobjectnum[player[k].whichpatchx][player[k].whichpatchz])
403 for(l=0;l<terrain.patchobjectnum[player[k].whichpatchx][player[k].whichpatchz];l++){
404 j=terrain.patchobjects[player[k].whichpatchx][player[k].whichpatchz][l];
405 if(objects.position[j].y<player[k].coords.y||objects.type[j]==tunneltype||objects.type[j]==weirdtype){
406 if(player[k].skeleton.free)point=DoRotation(player[k].skeleton.joints[i].position*player[k].scale+player[k].coords-objects.position[j],0,-objects.rotation[j],0);
407 else point=DoRotation(DoRotation(player[k].skeleton.joints[i].position,0,player[k].rotation,0)*player[k].scale+player[k].coords-objects.position[j],0,-objects.rotation[j],0);
410 if(k!=0&&tutoriallevel==1){
411 opacity=.2+.2*sin(smoketex*6+i);
413 objects.model[j].MakeDecal(shadowdecal,&point,&size,&opacity,&rotation);
419 if(!player[k].playerdetail)
420 if(frustum.SphereInFrustum(player[k].coords.x,player[k].coords.y,player[k].coords.z,player[k].scale*5))
422 point=player[k].coords;
424 opacity=.4-(player[k].coords.y-terrain.getHeight(player[k].coords.x,player[k].coords.z))/5;
425 terrain.MakeDecal(shadowdecal,point,size,opacity*.7,rotation);
426 if(terrain.patchobjectnum[player[k].whichpatchx][player[k].whichpatchz])
427 for(l=0;l<terrain.patchobjectnum[player[k].whichpatchx][player[k].whichpatchz];l++){
428 j=terrain.patchobjects[player[k].whichpatchx][player[k].whichpatchz][l];
429 point=DoRotation(player[k].coords-objects.position[j],0,-objects.rotation[j],0);
432 objects.model[j].MakeDecal(shadowdecal,&point,&size,&opacity,&rotation);
438 glEnable(GL_TEXTURE_2D);
440 glEnable(GL_DEPTH_TEST);
441 glEnable(GL_CULL_FACE);
443 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
444 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
445 glBindTexture( GL_TEXTURE_2D, terraintexture);
447 glBindTexture( GL_TEXTURE_2D, terraintexture2);
449 //glBindTexture( GL_TEXTURE_2D, terraintexture3);
450 //glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
453 terrain.drawdecals();
456 glEnable(GL_CULL_FACE);
457 glEnable(GL_LIGHTING);
459 glEnable(GL_TEXTURE_2D);
462 glEnable(GL_COLOR_MATERIAL);
477 glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
478 glEnable(GL_CULL_FACE);
479 glCullFace(GL_FRONT);
481 for(k=0;k<numplayers;k++){
482 if(k==0||tutoriallevel!=1){
484 glEnable(GL_LIGHTING);
485 terrainlight=terrain.getLighting(player[k].coords.x,player[k].coords.z);
486 distance=findDistancefast(&viewer,&player[k].coords);
487 distance=(viewdistance*viewdistance-(distance-(viewdistance*viewdistance*fadestart))*(1/(1-fadestart)))/viewdistance/viewdistance;
488 glColor4f(terrainlight.x,terrainlight.y,terrainlight.z,distance);
489 if(distance>=1)glDisable(GL_BLEND);
491 checkpoint=DoRotation(player[k].skeleton.joints[abs(Random()%player[k].skeleton.num_joints)].position,0,player[k].rotation,0)*player[k].scale+player[k].coords;
493 if(!player[k].occluded==0)i=checkcollide(viewer,checkpoint,player[k].lastoccluded);
494 if(i==-1||player[k].occluded==0)i=checkcollide(viewer,checkpoint);
496 player[k].occluded+=1;
497 player[k].lastoccluded=i;
499 else player[k].occluded=0;
500 if(player[k].occluded<25)player[k].DrawSkeleton();
506 if(!cameramode&&musictype==stream_music2)playerdist=findDistancefastflat(&player[0].coords,&viewer);
507 else playerdist=-100;
510 glEnable(GL_TEXTURE_2D);
515 if(frustum.SphereInFrustum(realhawkcoords.x+hawk.boundingspherecenter.x,realhawkcoords.y+hawk.boundingspherecenter.y,realhawkcoords.z+hawk.boundingspherecenter.z,2)){
516 glAlphaFunc(GL_GREATER, 0.0001f);
518 glDisable(GL_CULL_FACE);
519 glDisable(GL_LIGHTING);
521 glTranslatef(hawkcoords.x,hawkcoords.y,hawkcoords.z);
522 glRotatef(hawkrotation,0,1,0);
523 glTranslatef(25,0,0);
524 distance=findDistancefast(&viewer,&realhawkcoords)*1.2;
525 glColor4f(light.color[0],light.color[1],light.color[2],(viewdistance*viewdistance-(distance-(viewdistance*viewdistance*fadestart))*(1/(1-fadestart)))/viewdistance/viewdistance);
526 if((viewdistance*viewdistance-(distance-(viewdistance*viewdistance*fadestart))*(1/(1-fadestart)))/viewdistance/viewdistance>1)glColor4f(light.color[0],light.color[1],light.color[2],1);
527 if((viewdistance*viewdistance-(distance-(viewdistance*viewdistance*fadestart))*(1/(1-fadestart)))/viewdistance/viewdistance>0)
528 hawk.drawdifftex(hawktexture);
533 /*glEnable(GL_CULL_FACE);
534 glCullFace(GL_FRONT);
536 for(k=0;k<numplayers;k++){
538 glEnable(GL_LIGHTING);
539 terrainlight=terrain.getLighting(player[k].coords.x,player[k].coords.z);
540 distance=findDistancefast(&viewer,&player[k].coords);
541 distance=(viewdistance*viewdistance-(distance-(viewdistance*viewdistance*fadestart))*(1/(1-fadestart)))/viewdistance/viewdistance;
542 glColor4f(terrainlight.x,terrainlight.y,terrainlight.z,distance);
543 if(distance>=1)glDisable(GL_BLEND);
545 checkpoint=DoRotation(player[k].skeleton.joints[abs(Random()%player[k].skeleton.num_joints)].position,0,player[k].rotation,0)*player[k].scale+player[k].coords;
547 if(checkcollide(viewer,checkpoint)){
548 player[k].occluded+=1;
550 else player[k].occluded=0;
551 if(player[k].occluded<25)player[k].DrawSkeleton();
555 glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
556 glEnable(GL_CULL_FACE);
557 glCullFace(GL_FRONT);
559 for(k=0;k<numplayers;k++){
560 if(!(k==0||tutoriallevel!=1)){
562 glEnable(GL_LIGHTING);
563 terrainlight=terrain.getLighting(player[k].coords.x,player[k].coords.z);
564 distance=findDistancefast(&viewer,&player[k].coords);
565 distance=(viewdistance*viewdistance-(distance-(viewdistance*viewdistance*fadestart))*(1/(1-fadestart)))/viewdistance/viewdistance;
566 glColor4f(terrainlight.x,terrainlight.y,terrainlight.z,distance);
567 if(distance>=1)glDisable(GL_BLEND);
569 checkpoint=DoRotation(player[k].skeleton.joints[abs(Random()%player[k].skeleton.num_joints)].position,0,player[k].rotation,0)*player[k].scale+player[k].coords;
571 if(!player[k].occluded==0)i=checkcollide(viewer,checkpoint,player[k].lastoccluded);
572 if(i==-1||player[k].occluded==0)i=checkcollide(viewer,checkpoint);
574 player[k].occluded+=1;
575 player[k].lastoccluded=i;
577 else player[k].occluded=0;
578 if(player[k].occluded<25)player[k].DrawSkeleton();
585 glEnable(GL_TEXTURE_2D);
590 glDisable(GL_COLOR_MATERIAL);
592 glDisable(GL_LIGHTING);
593 glDisable(GL_TEXTURE_2D);
601 glDisable(GL_LIGHTING);
602 glDisable(GL_TEXTURE_2D);
603 glDisable(GL_COLOR_MATERIAL);
606 for(k=0;k<numplayers;k++){
607 if(player[k].numwaypoints>1){
608 glBegin(GL_LINE_LOOP);
609 for(i=0;i<player[k].numwaypoints;i++){
610 glVertex3f(player[k].waypoints[i].x,player[k].waypoints[i].y+.5,player[k].waypoints[i].z);
619 for(k=0;k<numpathpoints;k++){
620 if(numpathpointconnect[k]){
621 for(i=0;i<numpathpointconnect[k];i++){
622 glBegin(GL_LINE_LOOP);
623 glVertex3f(pathpoint[k].x,pathpoint[k].y+.5,pathpoint[k].z);
624 glVertex3f(pathpoint[pathpointconnect[k][i]].x,pathpoint[pathpointconnect[k][i]].y+.5,pathpoint[pathpointconnect[k][i]].z);
632 glVertex3f(pathpoint[pathpointselected].x,pathpoint[pathpointselected].y+.5,pathpoint[pathpointselected].z);
639 glEnable(GL_TEXTURE_2D);
640 glColor4f(.5,.5,.5,1);
642 sprintf (string, " ",(int)(fps));
643 text.glPrint(10,30,string,0,.8,screenwidth,screenheight);
646 if(bonus>0&&bonustime<1&&!winfreeze&&indialogue==-1/*bonustime<4*/){
647 if(bonus==tracheotomy)sprintf (string, "Tracheotomy!");
648 else if(bonus==backstab)sprintf (string, "Backstabber!");
649 else if(bonus==spinecrusher)sprintf (string, "Spinecrusher!");
650 else if(bonus==ninja)sprintf (string, "Ninja Bonus!");
651 else if(bonus==style)sprintf (string, "Style Bonus!");
652 else if(bonus==cannon)sprintf (string, "Leg Cannon!");
653 else if(bonus==aimbonus)sprintf (string, "Nice Aim!");
654 else if(bonus==deepimpact)sprintf (string, "Heavy Impact!");
655 else if(bonus==touchofdeath)sprintf (string, "Touch of Death!");
656 else if(bonus==swordreversebonus)sprintf (string, "Sword Disarm!");
657 else if(bonus==staffreversebonus)sprintf (string, "Staff Disarm!");
658 else if(bonus==reverseko)sprintf (string, "Reversal KO!");
659 else if(bonus==solidhit)sprintf (string, "Solid Hit!");
660 else if(bonus==twoxcombo)sprintf (string, "2X Combo!");
661 else if(bonus==threexcombo)sprintf (string, "3X Combo!");
662 else if(bonus==fourxcombo)sprintf (string, "4X COMBO!");
663 else if(bonus==megacombo)sprintf (string, "MEGA COMBO!");
664 else if(bonus==Reversal)sprintf (string, "Reversal!");
665 else if(bonus==Stabbonus)sprintf (string, "Punctured!");
666 else if(bonus==Slicebonus)sprintf (string, "Sliced!");
667 else if(bonus==Bullseyebonus)sprintf (string, "Bullseye!");
668 else if(bonus==Slashbonus)sprintf (string, "Slashed!");
669 else if(bonus==Wolfbonus)sprintf (string, "WOLF SLAYER!");
670 else if(bonus==FinishedBonus)sprintf (string, "SLAIN!");
671 else if(bonus==TackleBonus)sprintf (string, "Tackle!");
672 else if(bonus==AboveBonus)sprintf (string, "Death from Above!");
673 else sprintf (string, "Excellent!");
675 glColor4f(0,0,0,1-bonustime);
676 text.glPrintOutline(1024/2-10*strlen(string)-4,768/16-4+768*4/5,string,1,2.5,1024,768);
677 glColor4f(1,0,0,1-bonustime);
678 text.glPrint(1024/2-10*strlen(string),768/16+768*4/5,string,1,2,1024,768);
680 sprintf (string, "%d",(int)bonusvalue);
681 glColor4f(0,0,0,1-bonustime);
682 text.glPrintOutline(1024/2-10*strlen(string)-4,768/16-4-20+768*4/5,string,1,2.5*.8,1024,768);
683 glColor4f(1,0,0,1-bonustime);
684 text.glPrint(1024/2-10*strlen(string),768/16-20+768*4/5,string,1,2*.8,1024,768);
685 glColor4f(.5,.5,.5,1);
688 if(tutoriallevel==1){
689 tutorialopac=tutorialmaxtime-tutorialstagetime;
690 if(tutorialopac>1)tutorialopac=1;
691 if(tutorialopac<0)tutorialopac=0;
693 sprintf (string, " ");
694 sprintf (string2, " ");
695 sprintf (string3, " ");
696 if(tutorialstage==0){
697 sprintf (string, " ");
698 sprintf (string2, " ");
699 sprintf (string3, " ");
701 if(tutorialstage==1){
702 sprintf (string, "Welcome to the Lugaru training level!");
703 sprintf (string2, " ");
704 sprintf (string3, " ");
706 if(tutorialstage==2){
707 sprintf (string, "BASIC MOVEMENT:");
708 sprintf (string2, " ");
709 sprintf (string3, " ");
711 if(tutorialstage==3){
712 sprintf (string, "You can move the mouse to rotate the camera.");
713 sprintf (string2, " ");
714 sprintf (string3, " ");
716 if(tutorialstage==4){
717 sprintf (string, "Try using the %s, %s, %s and %s keys to move around.",KeyToChar(forwardkey),KeyToChar(leftkey),KeyToChar(backkey),KeyToChar(rightkey));
718 sprintf (string2, "All movement is relative to the camera.");
719 sprintf (string3, " ");
721 if(tutorialstage==5){
722 sprintf (string, "Please press %s to jump.",KeyToChar(jumpkey));
723 sprintf (string2, "You can hold it longer to jump higher.");
724 sprintf (string3, " ");
726 if(tutorialstage==6){
727 sprintf (string, "You can press %s to crouch.",KeyToChar(crouchkey));
728 sprintf (string2, "You can jump higher from a crouching position.");
729 sprintf (string3, " ");
731 if(tutorialstage==7){
732 sprintf (string, "While running, you can press %s to roll.",KeyToChar(crouchkey));
733 sprintf (string2, " ");
734 sprintf (string3, " ");
736 if(tutorialstage==8){
737 sprintf (string, "While crouching, you can sneak around silently");
738 sprintf (string2, "using the movement keys.");
739 sprintf (string3, " ");
741 if(tutorialstage==9){
742 sprintf (string, "Release the crouch key while sneaking and hold the movement keys");
743 sprintf (string2, "to run animal-style.");
744 sprintf (string3, " ");
746 if(tutorialstage==10){
747 sprintf (string, "ADVANCED MOVEMENT:");
748 sprintf (string2, " ");
749 sprintf (string3, " ");
751 if(tutorialstage==11){
752 sprintf (string, "When you jump at a wall, you can hold %s again",KeyToChar(jumpkey));
753 sprintf (string2, "during impact to perform a walljump.");
754 sprintf (string3, "Be sure to use the movement keys to press against the wall");
756 if(tutorialstage==12){
757 sprintf (string, "While in the air, you can press crouch to flip.",KeyToChar(jumpkey));
758 sprintf (string2, "Walljumps and flips confuse enemies and give you more control.");
759 sprintf (string3, " ");
761 if(tutorialstage==13){
762 sprintf (string, "BASIC COMBAT:");
763 sprintf (string2, " ");
764 sprintf (string3, " ");
766 if(tutorialstage==14){
767 sprintf (string, "There is now an imaginary enemy");
768 sprintf (string2, "in the middle of the training area.");
769 sprintf (string3, " ");
771 if(tutorialstage==15){
772 if(attackkey==MAC_MOUSEBUTTON1)sprintf (string, "Click to attack when you are near an enemy.");
773 else sprintf (string, "Press %s to attack when you are near an enemy.",KeyToChar(attackkey));
774 sprintf (string2, "You can punch by standing still near an enemy and attacking.");
775 sprintf (string3, " ");
777 if(tutorialstage==16){
778 sprintf (string, "If you are close, you will perform a weak punch.");
779 sprintf (string2, "The weak punch is excellent for starting attack combinations.");
780 sprintf (string3, " ");
782 if(tutorialstage==17){
783 sprintf (string, "Attacking while running results in a spin kick.");
784 sprintf (string2, "This is one of your most powerful ground attacks.");
785 sprintf (string3, " ");
787 if(tutorialstage==18){
788 sprintf (string, "Sweep the enemy's legs out by attacking while crouched.");
789 sprintf (string2, "This is a very fast attack, and easy to follow up.");
790 sprintf (string3, " ");
792 if(tutorialstage==19){
793 sprintf (string, "When an enemy is on the ground, you can deal some extra");
794 sprintf (string2, "damage by running up and drop-kicking him.");
795 sprintf (string3, "(Try knocking them down with a sweep first)");
797 if(tutorialstage==20){
798 sprintf (string, "Your most powerful individual attack is the rabbit kick.");
799 if(attackkey==MAC_MOUSEBUTTON1)sprintf (string2, "Run at the enemy while holding the mouse button, and press");
800 else sprintf (string2, "Run at the enemy while holding %s, and press", KeyToChar(attackkey));
801 sprintf (string3, "the jump key (%s) to attack.",KeyToChar(jumpkey));
803 if(tutorialstage==21){
804 sprintf (string, "This attack is devastating if timed correctly.");
805 sprintf (string2, "Even if timed incorrectly, it will knock the enemy over.");
806 if(againbonus)sprintf (string3, "Try rabbit-kicking the imaginary enemy again.");
807 else sprintf (string3, "Try rabbit-kicking the imaginary enemy.");
809 if(tutorialstage==22){
810 sprintf (string, "If you sneak behind an enemy unnoticed, you can kill");
811 sprintf (string2, "him instantly. Move close behind this enemy");
812 sprintf (string3, "and attack.");
814 if(tutorialstage==23){
815 sprintf (string, "Another important attack is the wall kick. When an enemy");
816 sprintf (string2, "is near a wall, perform a walljump nearby and hold");
817 sprintf (string3, "the attack key during impact with the wall.");
819 if(tutorialstage==24){
820 sprintf (string, "You can tackle enemies by running at them animal-style");
821 if(attackkey==MAC_MOUSEBUTTON1)sprintf (string2, "and pressing jump (%s) or attack(mouse button).",KeyToChar(jumpkey));
822 else sprintf (string2, "and pressing jump (%s) or attack(%s).",KeyToChar(jumpkey),KeyToChar(attackkey));
823 sprintf (string3, "This is especially useful when they are running away.");
825 if(tutorialstage==25){
826 sprintf (string, "Dodge by pressing back and attack. Dodging is essential");
827 sprintf (string2, "against enemies with swords or other long weapons.");
828 sprintf (string3, " ");
830 if(tutorialstage==26){
831 sprintf (string, "REVERSALS AND COUNTER-REVERSALS");
832 sprintf (string2, " ");
833 sprintf (string3, " ");
835 if(tutorialstage==27){
836 sprintf (string, "The enemy can now reverse your attacks.");
837 sprintf (string2, " ");
838 sprintf (string3, " ");
840 if(tutorialstage==28){
841 sprintf (string, "If you attack, you will notice that the enemy now sometimes");
842 sprintf (string2, "catches your attack and uses it against you. Hold");
843 sprintf (string3, "crouch (%s) after attacking to escape from reversals.",KeyToChar(crouchkey));
845 if(tutorialstage==29){
846 sprintf (string, "Try escaping from two more reversals in a row.");
847 sprintf (string2, " ");
848 sprintf (string3, " ");
850 if(tutorialstage==30){
851 sprintf (string, "Good!");
852 sprintf (string2, " ");
853 sprintf (string3, " ");
855 if(tutorialstage==31){
856 sprintf (string, "To reverse an attack, you must tap crouch (%s) during the",KeyToChar(crouchkey));
857 sprintf (string2, "enemy's attack. You must also be close to the enemy;");
858 sprintf (string3, "this is especially important against armed opponents.");
860 if(tutorialstage==32){
861 sprintf (string, "The enemy can attack in %d seconds.", (int)(tutorialmaxtime-tutorialstagetime));
862 sprintf (string2, "This imaginary opponents attacks will be highlighted");
863 sprintf (string3, "to make this easier.");
865 if(tutorialstage==33){
866 sprintf (string, "Reverse three enemy attacks!");
867 sprintf (string2, " ");
868 sprintf (string3, " ");
870 if(tutorialstage==34){
871 sprintf (string, "Reverse two more enemy attacks!");
872 sprintf (string2, " ");
873 sprintf (string3, " ");
875 if(tutorialstage==35){
876 sprintf (string, "Reverse one more enemy attack!");
877 sprintf (string2, " ");
878 sprintf (string3, " ");
880 if(tutorialstage==36){
881 sprintf (string, "Excellent!");
882 sprintf (string2, " ");
883 sprintf (string3, " ");
885 if(tutorialstage==37){
886 sprintf (string, "Now spar with the enemy for %d more seconds.", (int)(tutorialmaxtime-tutorialstagetime));
887 sprintf (string2, "Damage dealt: %d",(int)damagedealt);
888 sprintf (string3, "Damage taken: %d.",(int)damagetaken);
890 if(tutorialstage==38){
891 sprintf (string, "WEAPONS:");
892 sprintf (string2, " ");
893 sprintf (string3, " ");
895 if(tutorialstage==39){
896 sprintf (string, "There is now an imaginary knife");
897 sprintf (string2, "in the center of the training area.");
898 sprintf (string3, " ");
900 if(tutorialstage==40){
901 sprintf (string, "Stand, roll or handspring over the knife");
902 sprintf (string2, "while pressing %s to pick it up.",KeyToChar(throwkey));
903 sprintf (string3, "You can crouch and press the same key to drop it again.");
905 if(tutorialstage==41){
906 sprintf (string, "You can equip and unequip weapons using the %s key.",KeyToChar(drawkey));
907 sprintf (string2, "Sometimes it is best to keep them unequipped to");
908 sprintf (string3, "prevent enemies from taking them. ");
910 if(tutorialstage==42){
911 sprintf (string, "The knife is the smallest weapon and the least encumbering.");
912 sprintf (string2, "You can equip or unequip it while standing, crouching,");
913 sprintf (string3, "running or flipping.");
915 if(tutorialstage==43){
916 sprintf (string, "You perform weapon attacks the same way as unarmed attacks,");
917 sprintf (string2, "but sharp weapons cause permanent damage, instead of the");
918 sprintf (string3, "temporary trauma from blunt weapons, fists and feet.");
920 if(tutorialstage==44){
921 sprintf (string, "The enemy now has your knife!");
922 sprintf (string2, "Please reverse two of his knife attacks.");
923 sprintf (string3, " ");
925 if(tutorialstage==45){
926 sprintf (string, "Please reverse one more of his knife attacks.");
927 sprintf (string2, " ");
928 sprintf (string3, " ");
930 if(tutorialstage==46){
931 sprintf (string, "Now he has a sword!");
932 sprintf (string2, "The sword has longer reach than your arms, so you");
933 sprintf (string3, "must move close to reverse the sword slash.");
935 if(tutorialstage==47){
936 sprintf (string, "Long weapons like the sword and staff are also useful for defense;");
937 sprintf (string2, "you can parry enemy weapon attacks by pressing the attack key");
938 sprintf (string3, "at the right time. Please try parrying the enemy's attacks!");
940 if(tutorialstage==48){
941 sprintf (string, "The staff is like the sword, but has two main attacks.");
942 sprintf (string2, "The standing smash is fast and effective, and the running");
943 sprintf (string3, "spin smash is slower and more powerful.");
945 if(tutorialstage==49){
946 sprintf (string, "When facing an enemy, you can throw the knife with %s.",KeyToChar(throwkey));
947 sprintf (string2, "It is possible to throw the knife while flipping,");
948 sprintf (string3, "but it is very inaccurate.");
950 if(tutorialstage==50){
951 sprintf (string, "You now know everything you can learn from training.");
952 sprintf (string2, "Everything else you must learn from experience!");
953 sprintf (string3, " ");
955 if(tutorialstage==51){
956 sprintf (string, "Walk out of the training area to return to the main menu.");
957 sprintf (string2, " ");
958 sprintf (string3, " ");
961 glColor4f(0,0,0,tutorialopac);
962 text.glPrintOutline(screenwidth/2-7.6*strlen(string)*screenwidth/1024-4,screenheight/16-4+screenheight*4/5,string,1,1.5*1.25*screenwidth/1024,screenwidth,screenheight);
963 text.glPrintOutline(screenwidth/2-7.6*strlen(string2)*screenwidth/1024-4,screenheight/16-4+screenheight*4/5-20*screenwidth/1024,string2,1,1.5*1.25*screenwidth/1024,screenwidth,screenheight);
964 text.glPrintOutline(screenwidth/2-7.6*strlen(string3)*screenwidth/1024-4,screenheight/16-4+screenheight*4/5-40*screenwidth/1024,string3,1,1.5*1.25*screenwidth/1024,screenwidth,screenheight);
965 glColor4f(1,1,1,tutorialopac);
966 text.glPrint(screenwidth/2-7.6*strlen(string)*screenwidth/1024,screenheight/16+screenheight*4/5,string,1,1.5*screenwidth/1024,screenwidth,screenheight);
967 text.glPrint(screenwidth/2-7.6*strlen(string2)*screenwidth/1024,screenheight/16+screenheight*4/5-20*screenwidth/1024,string2,1,1.5*screenwidth/1024,screenwidth,screenheight);
968 text.glPrint(screenwidth/2-7.6*strlen(string3)*screenwidth/1024,screenheight/16+screenheight*4/5-40*screenwidth/1024,string3,1,1.5*screenwidth/1024,screenwidth,screenheight);
970 sprintf (string, "Press 'tab' to skip to the next item.",KeyToChar(jumpkey));
971 sprintf (string2, "Press escape at any time to");
972 sprintf (string3, "pause or exit the tutorial.");
975 text.glPrintOutline(screenwidth/2-7.6*strlen(string)*screenwidth/1024*.8-4,0-4+screenheight*1/10,string,1,1.5*1.25*screenwidth/1024*.8,screenwidth,screenheight);
976 text.glPrintOutline(screenwidth/2-7.6*strlen(string2)*screenwidth/1024*.8-4,0-4+screenheight*1/10-20*.8*screenwidth/1024,string2,1,1.5*1.25*screenwidth/1024*.8,screenwidth,screenheight);
977 text.glPrintOutline(screenwidth/2-7.6*strlen(string3)*screenwidth/1024*.8-4,0-4+screenheight*1/10-40*.8*screenwidth/1024,string3,1,1.5*1.25*screenwidth/1024*.8,screenwidth,screenheight);
978 glColor4f(0.5,0.5,0.5,1);
979 text.glPrint(screenwidth/2-7.6*strlen(string)*screenwidth/1024*.8,0+screenheight*1/10,string,1,1.5*screenwidth/1024*.8,screenwidth,screenheight);
980 text.glPrint(screenwidth/2-7.6*strlen(string2)*screenwidth/1024*.8,0+screenheight*1/10-20*.8*screenwidth/1024,string2,1,1.5*screenwidth/1024*.8,screenwidth,screenheight);
981 text.glPrint(screenwidth/2-7.6*strlen(string3)*screenwidth/1024*.8,0+screenheight*1/10-40*.8*screenwidth/1024,string3,1,1.5*screenwidth/1024*.8,screenwidth,screenheight);
985 if(numhotspots&&(bonustime>=1||bonus<=0||bonustime<0)&&!tutoriallevel){
987 float closestdist=-1;
989 closest=currenthotspot;
990 for(i=0;i<numhotspots;i++){
991 distance=findDistancefast(&player[0].coords,&hotspot[i]);
992 if(closestdist==-1||distance<closestdist){
993 if(findDistancefast(&player[0].coords,&hotspot[i])<hotspotsize[i]&&((hotspottype[i]<=10&&hotspottype[i]>=0)||(hotspottype[i]<=40&&hotspottype[i]>=20))){
994 closestdist=distance;
1000 currenthotspot=closest;
1001 if(currenthotspot!=-1){
1002 if(hotspottype[closest]<=10){
1003 if(findDistancefast(&player[0].coords,&hotspot[closest])<hotspotsize[closest])
1004 tutorialstagetime=0;
1006 tutorialopac=tutorialmaxtime-tutorialstagetime;
1007 if(tutorialopac>1)tutorialopac=1;
1008 if(tutorialopac<0)tutorialopac=0;
1010 sprintf (string, "%s", hotspottext[closest]);
1018 if(string[i]=='\n'||string[i]>'z'||string[i]<' '||string[i]=='\0'){
1019 glColor4f(0,0,0,tutorialopac);
1020 text.glPrintOutline(screenwidth/2-7.6*(i-lastline)*screenwidth/1024-4,screenheight/16-4+screenheight*4/5-20*screenwidth/1024*line,string,1,1.5*1.25*screenwidth/1024,screenwidth,screenheight,lastline,i);
1021 glColor4f(1,1,1,tutorialopac);
1022 text.glPrint(screenwidth/2-7.6*(i-lastline)*screenwidth/1024,screenheight/16+screenheight*4/5-20*screenwidth/1024*line,string,1,1.5*screenwidth/1024,screenwidth,screenheight,lastline,i);
1025 if(string[i]=='\0')done=1;
1031 else if (hotspottype[closest]>=20&&dialoguegonethrough[hotspottype[closest]-20]==0){
1032 whichdialogue=hotspottype[closest]-20;
1033 for(j=0;j<numdialogueboxes[whichdialogue];j++){
1034 player[participantfocus[whichdialogue][j]].coords=participantlocation[whichdialogue][participantfocus[whichdialogue][j]];
1035 player[participantfocus[whichdialogue][j]].rotation=participantrotation[whichdialogue][participantfocus[whichdialogue][j]];
1036 player[participantfocus[whichdialogue][j]].targetrotation=participantrotation[whichdialogue][participantfocus[whichdialogue][j]];
1037 player[participantfocus[whichdialogue][j]].velocity=0;
1038 player[participantfocus[whichdialogue][j]].targetanimation=player[participantfocus[whichdialogue][j]].getIdle();
1039 player[participantfocus[whichdialogue][j]].targetframe=0;
1043 dialoguegonethrough[whichdialogue]++;
1044 if(dialogueboxsound[whichdialogue][indialogue]!=0){
1045 static float gLoc[3];
1046 static float vel[3];
1047 gLoc[0]=player[participantfocus[whichdialogue][indialogue]].coords.x;
1048 gLoc[1]=player[participantfocus[whichdialogue][indialogue]].coords.y;
1049 gLoc[2]=player[participantfocus[whichdialogue][indialogue]].coords.z;
1054 if(dialogueboxsound[whichdialogue][indialogue]==1)whichsoundplay=rabbitchitter;
1055 if(dialogueboxsound[whichdialogue][indialogue]==2)whichsoundplay=rabbitchitter2;
1056 if(dialogueboxsound[whichdialogue][indialogue]==3)whichsoundplay=rabbitpainsound;
1057 if(dialogueboxsound[whichdialogue][indialogue]==4)whichsoundplay=rabbitpain1sound;
1058 if(dialogueboxsound[whichdialogue][indialogue]==5)whichsoundplay=rabbitattacksound;
1059 if(dialogueboxsound[whichdialogue][indialogue]==6)whichsoundplay=rabbitattack2sound;
1060 if(dialogueboxsound[whichdialogue][indialogue]==7)whichsoundplay=rabbitattack3sound;
1061 if(dialogueboxsound[whichdialogue][indialogue]==8)whichsoundplay=rabbitattack4sound;
1062 if(dialogueboxsound[whichdialogue][indialogue]==9)whichsoundplay=growlsound;
1063 if(dialogueboxsound[whichdialogue][indialogue]==10)whichsoundplay=growl2sound;
1064 if(dialogueboxsound[whichdialogue][indialogue]==11)whichsoundplay=snarlsound;
1065 if(dialogueboxsound[whichdialogue][indialogue]==12)whichsoundplay=snarl2sound;
1066 if(dialogueboxsound[whichdialogue][indialogue]==13)whichsoundplay=barksound;
1067 if(dialogueboxsound[whichdialogue][indialogue]==14)whichsoundplay=bark2sound;
1068 if(dialogueboxsound[whichdialogue][indialogue]==15)whichsoundplay=bark3sound;
1069 if(dialogueboxsound[whichdialogue][indialogue]==16)whichsoundplay=barkgrowlsound;
1070 if(dialogueboxsound[whichdialogue][indialogue]==-1)whichsoundplay=fireendsound;
1071 if(dialogueboxsound[whichdialogue][indialogue]==-2)whichsoundplay=firestartsound;
1072 if(dialogueboxsound[whichdialogue][indialogue]==-3)whichsoundplay=consolesuccesssound;
1073 if(dialogueboxsound[whichdialogue][indialogue]==-4)whichsoundplay=consolefailsound;
1074 PlaySoundEx( whichsoundplay, samp[whichsoundplay], NULL, TRUE);
1075 FSOUND_3D_SetAttributes(channels[whichsoundplay], gLoc, vel);
1076 FSOUND_SetVolume(channels[whichsoundplay], 256);
1077 FSOUND_SetPaused(channels[whichsoundplay], FALSE);
1083 if(indialogue!=-1&&!mainmenu){
1084 glDisable(GL_DEPTH_TEST); // Disables Depth Testing
1085 glDisable(GL_CULL_FACE);
1086 glDisable(GL_LIGHTING);
1087 glDisable(GL_TEXTURE_2D);
1089 glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
1090 glPushMatrix(); // Store The Projection Matrix
1091 glLoadIdentity(); // Reset The Projection Matrix
1092 glOrtho(0,screenwidth,0,screenheight,-100,100); // Set Up An Ortho Screen
1093 glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
1094 glPushMatrix(); // Store The Modelview Matrix
1095 glLoadIdentity(); // Reset The Modelview Matrix
1096 if(dialogueboxlocation[whichdialogue][indialogue]==1)glTranslatef(0,screenheight*3/4,0);
1097 glScalef(screenwidth,screenheight/4,1);
1098 glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
1101 glColor4f(dialogueboxcolor[whichdialogue][indialogue][0],dialogueboxcolor[whichdialogue][indialogue][1],dialogueboxcolor[whichdialogue][indialogue][2],0.7);
1103 glVertex3f(0, 0, 0.0f);
1104 glVertex3f(1, 0, 0.0f);
1105 glVertex3f(1, 1, 0.0f);
1106 glVertex3f(0, 1, 0.0f);
1108 glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
1109 glPopMatrix(); // Restore The Old Projection Matrix
1110 glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
1111 glPopMatrix(); // Restore The Old Projection Matrix
1112 glEnable(GL_DEPTH_TEST); // Enables Depth Testing
1113 glEnable(GL_CULL_FACE);
1114 glDisable(GL_BLEND);
1116 glEnable(GL_TEXTURE_2D);
1123 startx=screenwidth*1/5;
1124 if(dialogueboxlocation[whichdialogue][indialogue]==1)starty=screenheight/16+screenheight*4/5;
1125 if(dialogueboxlocation[whichdialogue][indialogue]==2)starty=screenheight*1/5-screenheight/16;
1127 // char tempname[64];
1131 // for(i=0;i<64;i++){
1136 for(i=0;i<(int)strlen(dialoguename[whichdialogue][indialogue]);i++){
1137 tempname[tempnum]=dialoguename[whichdialogue][indialogue][i];
1139 if(dialoguename[whichdialogue][indialogue][i]=='#'||dialoguename[whichdialogue][indialogue][i]=='\0')goodchar=0;
1140 //if(tempnum>2)if(tempname[tempnum-2]=='e'&&tempname[tempnum-1]=='r')goodchar=0;
1141 //if(tempnum>2)if(tempname[tempnum]=='r'&&tempname[0]=='a')goodchar=0;
1142 if(goodchar)tempnum++;
1143 else tempname[tempnum]='\0';
1146 sprintf (string, "%s: ", tempname);
1148 if(dialogueboxcolor[whichdialogue][indialogue][0]+dialogueboxcolor[whichdialogue][indialogue][1]+dialogueboxcolor[whichdialogue][indialogue][2]<1.5){
1149 glColor4f(0,0,0,tutorialopac);
1150 text.glPrintOutline(startx-2*7.6*strlen(string)*screenwidth/1024-4,starty-4,string,1,1.5*1.25*screenwidth/1024,screenwidth,screenheight);
1151 glColor4f(0.7,0.7,0.7,tutorialopac);
1152 text.glPrint(startx-2*7.6*strlen(string)*screenwidth/1024,starty,string,1,1.5*screenwidth/1024,screenwidth,screenheight);
1156 glColor4f(0,0,0,tutorialopac);
1157 text.glPrintOutline(startx-2*7.6*strlen(string)*screenwidth/1024-4,starty-4,string,1,1.5*1.25*screenwidth/1024,screenwidth,screenheight);
1162 for(i=0;i<(int)strlen(dialoguetext[whichdialogue][indialogue])+1;i++){
1163 tempname[tempnum]=dialoguetext[whichdialogue][indialogue][i];
1164 if(dialoguetext[whichdialogue][indialogue][i]!='#')tempnum++;
1168 sprintf (string, "%s", tempname);
1177 if(string[i]=='\n'||string[i]>'z'||string[i]<' '||string[i]=='\0'){
1178 if(dialogueboxcolor[whichdialogue][indialogue][0]+dialogueboxcolor[whichdialogue][indialogue][1]+dialogueboxcolor[whichdialogue][indialogue][2]<1.5){
1179 glColor4f(0,0,0,tutorialopac);
1180 text.glPrintOutline(startx/*-7.6*(i-lastline)*screenwidth/1024*/-4,starty-4-20*screenwidth/1024*line,string,1,1.5*1.25*screenwidth/1024,screenwidth,screenheight,lastline,i);
1181 glColor4f(1,1,1,tutorialopac);
1182 text.glPrint(startx/*-7.6*(i-lastline)*screenwidth/1024*/,starty-20*screenwidth/1024*line,string,1,1.5*screenwidth/1024,screenwidth,screenheight,lastline,i);
1186 glColor4f(0,0,0,tutorialopac);
1187 text.glPrint(startx/*-7.6*(i-lastline)*screenwidth/1024*/,starty-20*screenwidth/1024*line,string,1,1.5*screenwidth/1024,screenwidth,screenheight,lastline,i);
1191 if(string[i]=='\0')done=1;
1198 if(!tutoriallevel&&!winfreeze&&indialogue==-1&&!mainmenu){
1200 if(!scoreadded)sprintf (string, "Score: %d", (int)accountcampaignscore[accountactive]+(int)bonustotal);//(int)bonustotal);
1201 if(scoreadded)sprintf (string, "Score: %d", (int)accountcampaignscore[accountactive]);//(int)bonustotal);
1203 if(!campaign)sprintf (string, "Score: %d", (int)bonustotal);
1205 text.glPrintOutline(1024/40-4,768/16-4+768*14/16,string,1,1.5*1.25,1024,768);
1207 text.glPrint(1024/40,768/16+768*14/16,string,1,1.5,1024,768);
1210 glColor4f(.5,.5,.5,1);
1213 if((texttoggle||editorenabled)&&debugmode&&!mainmenu){
1214 sprintf (string, "The framespersecond is %d.",(int)(fps));
1215 text.glPrint(10,30,string,0,.8,1024,768);
1217 sprintf (string, "Name: %s", registrationname);
1218 text.glPrint(10,260,string,0,.8,1024,768);
1221 if(editorenabled)sprintf (string, "Map editor enabled.");
1222 if(!editorenabled)sprintf (string, "Map editor Disabled.");
1223 text.glPrint(10,60,string,0,.8,1024,768);
1225 sprintf (string, "Object size: %f",editorsize);
1226 text.glPrint(10,75,string,0,.8,1024,768);
1227 if(editorrotation>=0)sprintf (string, "Object rotation: %f",editorrotation);
1228 else sprintf (string, "Object rotation: Random");
1229 text.glPrint(10,90,string,0,.8,1024,768);
1230 if(editorrotation2>=0)sprintf (string, "Object rotation2: %f",editorrotation2);
1231 else sprintf (string, "Object rotation2: Random");
1232 text.glPrint(10,105,string,0,.8,1024,768);
1233 sprintf (string, "Object type: %d",editortype);
1234 text.glPrint(10,120,string,0,.8,1024,768);
1235 if(editortype==boxtype)sprintf (string, "(box)");
1236 if(editortype==treetrunktype)sprintf (string, "(tree)");
1237 if(editortype==walltype)sprintf (string, "(wall)");
1238 if(editortype==weirdtype)sprintf (string, "(weird)");
1239 if(editortype==spiketype)sprintf (string, "(spike)");
1240 if(editortype==rocktype)sprintf (string, "(rock)");
1241 if(editortype==bushtype)sprintf (string, "(bush)");
1242 if(editortype==tunneltype)sprintf (string, "(tunnel)");
1243 if(editortype==chimneytype)sprintf (string, "(chimney)");
1244 if(editortype==platformtype)sprintf (string, "(platform)");
1245 if(editortype==cooltype)sprintf (string, "(cool)");
1246 if(editortype==firetype)sprintf (string, "(fire)");
1247 text.glPrint(130,120,string,0,.8,1024,768);
1249 sprintf (string, "Numplayers: %d",numplayers);
1250 text.glPrint(10,155,string,0,.8,1024,768);
1251 sprintf (string, "Player %d: numwaypoints: %d",numplayers,player[numplayers-1].numwaypoints);
1252 text.glPrint(10,140,string,0,.8,1024,768);
1254 /*sprintf (string, "Coords are: %f %f %f",player[0].coords.x,player[0].coords.y,player[0].coords.z);
1255 text.glPrint(10,200,string,0,.8,1024,768);*/
1256 sprintf (string, "Difficulty: %d",difficulty);
1257 text.glPrint(10,240,string,0,.8,1024,768);
1259 sprintf (string, "lasthotspot: %d",hotspottype[numhotspots-1]);
1260 text.glPrint(10,240,string,0,.8,1024,768);
1261 sprintf (string, "killhotspot: %d",killhotspot);
1262 text.glPrint(10,220,string,0,.8,1024,768);
1263 sprintf (string, "winhotspot: %d",winhotspot);
1264 text.glPrint(10,200,string,0,.8,1024,768);*/
1269 if(drawmode==glowmode){
1270 glDisable(GL_DEPTH_TEST); // Disables Depth Testing
1271 glDisable(GL_CULL_FACE);
1272 glDisable(GL_LIGHTING);
1273 glDisable(GL_TEXTURE_2D);
1275 glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
1276 glPushMatrix(); // Store The Projection Matrix
1277 glLoadIdentity(); // Reset The Projection Matrix
1278 glOrtho(0,screenwidth,0,screenheight,-100,100); // Set Up An Ortho Screen
1279 glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
1280 glPushMatrix(); // Store The Modelview Matrix
1281 glLoadIdentity(); // Reset The Modelview Matrix
1282 glScalef(screenwidth,screenheight,1);
1283 glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
1285 glColor4f(0,0,0,.5);
1287 glVertex3f(0, 0, 0.0f);
1288 glVertex3f(256, 0, 0.0f);
1289 glVertex3f(256, 256, 0.0f);
1290 glVertex3f(0, 256, 0.0f);
1292 glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
1293 glPopMatrix(); // Restore The Old Projection Matrix
1294 glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
1295 glPopMatrix(); // Restore The Old Projection Matrix
1296 glEnable(GL_DEPTH_TEST); // Enables Depth Testing
1297 glEnable(GL_CULL_FACE);
1298 glDisable(GL_BLEND);
1302 if((((blackout&&damageeffects)||(player[0].bloodloss>0&&damageeffects&&player[0].blooddimamount>0)||player[0].dead)&&!cameramode)||console){
1303 glDisable(GL_DEPTH_TEST); // Disables Depth Testing
1304 glDisable(GL_CULL_FACE);
1305 glDisable(GL_LIGHTING);
1306 glDisable(GL_TEXTURE_2D);
1308 glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
1309 glPushMatrix(); // Store The Projection Matrix
1310 glLoadIdentity(); // Reset The Projection Matrix
1311 glOrtho(0,screenwidth,0,screenheight,-100,100); // Set Up An Ortho Screen
1312 glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
1313 glPushMatrix(); // Store The Modelview Matrix
1314 glLoadIdentity(); // Reset The Modelview Matrix
1315 glScalef(screenwidth,screenheight,1);
1316 glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
1318 if(player[0].dead)blackout+=multiplier*3;
1319 if(player[0].dead==1)blackout=.4f;
1320 if(player[0].dead==2&&blackout>.6)blackout=.6;
1321 glColor4f(0,0,0,blackout);
1322 if(!player[0].dead){
1323 if((player[0].bloodloss/player[0].damagetolerance*(sin(woozy)/4+.5))*.3<.3){
1324 glColor4f(0,0,0,player[0].blooddimamount*player[0].bloodloss/player[0].damagetolerance*(sin(woozy)/4+.5)*.3);
1325 blackout=player[0].blooddimamount*player[0].bloodloss/player[0].damagetolerance*(sin(woozy)/4+.5)*.3;
1328 glColor4f(0,0,0,player[0].blooddimamount*.3);
1329 blackout=player[0].blooddimamount*.3;
1332 if(console)glColor4f(.7,0,0,.2);
1334 glVertex3f(0, 0, 0.0f);
1335 glVertex3f(256, 0, 0.0f);
1336 glVertex3f(256, 256, 0.0f);
1337 glVertex3f(0, 256, 0.0f);
1339 glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
1340 glPopMatrix(); // Restore The Old Projection Matrix
1341 glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
1342 glPopMatrix(); // Restore The Old Projection Matrix
1343 glEnable(GL_DEPTH_TEST); // Enables Depth Testing
1344 glEnable(GL_CULL_FACE);
1345 glDisable(GL_BLEND);
1349 if(flashamount>0&&damageeffects){
1350 if(flashamount>1)flashamount=1;
1351 if(flashdelay<=0)flashamount-=multiplier;
1353 if(flashamount<0)flashamount=0;
1354 glDisable(GL_DEPTH_TEST); // Disables Depth Testing
1355 glDisable(GL_CULL_FACE);
1356 glDisable(GL_LIGHTING);
1358 glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
1359 glPushMatrix(); // Store The Projection Matrix
1360 glLoadIdentity(); // Reset The Projection Matrix
1361 glOrtho(0,screenwidth,0,screenheight,-100,100); // Set Up An Ortho Screen
1362 glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
1363 glPushMatrix(); // Store The Modelview Matrix
1364 glLoadIdentity(); // Reset The Modelview Matrix
1365 glScalef(screenwidth,screenheight,1);
1366 glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
1368 glColor4f(flashr,flashg,flashb,flashamount);
1370 glVertex3f(0, 0, 0.0f);
1371 glVertex3f(256, 0, 0.0f);
1372 glVertex3f(256, 256, 0.0f);
1373 glVertex3f(0, 256, 0.0f);
1375 glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
1376 glPopMatrix(); // Restore The Old Projection Matrix
1377 glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
1378 glPopMatrix(); // Restore The Old Projection Matrix
1379 glEnable(GL_DEPTH_TEST); // Enables Depth Testing
1380 glEnable(GL_CULL_FACE);
1381 glDisable(GL_BLEND);
1387 glEnable(GL_TEXTURE_2D);
1390 sprintf (string, " ]");
1391 text.glPrint(10,30+screenheight-330,string,0,1,screenwidth,screenheight);
1393 sprintf (string, "_");
1394 text.glPrint(30+(float)(displayselected)*10,30+(screenheight-330),string,0,1,screenwidth,screenheight);
1398 if((i!=0||chatting)&&displaytime[i]<4)
1399 for(j=0;j<displaychars[i];j++){
1400 glColor4f(1,1,1,4-displaytime[i]);
1401 if(j<displaychars[i]){
1402 sprintf (string, "%c",displaytext[i][j]);
1403 text.glPrint(30+j*10,30+i*20+(screenheight-330),string,0,1,screenwidth,screenheight);
1409 if(minimap&&indialogue==-1){
1413 glDisable(GL_DEPTH_TEST);
1414 glColor3f (1.0, 1.0, 1.0); // no coloring
1416 glEnable(GL_TEXTURE_2D);
1417 glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE );
1418 glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE );
1419 glDisable(GL_DEPTH_TEST); // Disables Depth Testing
1420 glDisable(GL_CULL_FACE);
1421 glDisable(GL_LIGHTING);
1423 glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
1424 glPushMatrix(); // Store The Projection Matrix
1425 glLoadIdentity(); // Reset The Projection Matrix
1426 glOrtho(0,screenwidth,0,screenheight,-100,100); // Set Up An Ortho Screen
1427 glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
1428 glPushMatrix(); // Store The Modelview Matrix
1429 glLoadIdentity(); // Reset The Modelview Matrix
1430 glScalef((float)screenwidth/2,(float)screenwidth/2,1);
1431 glTranslatef(1.75,.25,0);
1432 glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
1442 int numliveplayers=0;
1443 for(i=0;i<numplayers;i++){
1444 if(!player[i].dead)numliveplayers++;
1450 for(i=0;i<objects.numobjects;i++){
1451 if(objects.type[i]==treetrunktype||objects.type[i]==boxtype){
1452 center+=objects.position[i];
1456 for(i=0;i<numplayers;i++){
1457 if(!player[i].dead)center+=player[i].coords;
1459 center/=numadd+numliveplayers;
1461 center=player[0].coords;
1463 float maxdistance=0;
1466 for(i=0;i<objects.numobjects;i++){
1467 tempdist=findDistancefast(¢er,&objects.position[i]);
1468 if(tempdist>maxdistance){
1470 maxdistance=tempdist;
1473 for(i=0;i<numplayers;i++){
1474 if(!player[i].dead){
1475 tempdist=findDistancefast(¢er,&player[i].coords);
1476 if(tempdist>maxdistance){
1478 maxdistance=tempdist;
1482 radius=fast_sqrt(maxdistance);
1486 glScalef(.25/radius*256*terrain.scale*.4,.25/radius*256*terrain.scale*.4,1);
1488 glScalef(1/(1/radius*256*terrain.scale*.4),1/(1/radius*256*terrain.scale*.4),1);
1489 /*float startx,starty,endx,endy;
1491 glTexCoord2f(1-(center.x-radius)/terrain.scale/256,(center.z-radius)/terrain.scale/256);
1492 glVertex3f(-1, -1, 0.0f);
1493 glTexCoord2f(1-(center.x+radius)/terrain.scale/256,(center.z-radius)/terrain.scale/256);
1494 glVertex3f(1, -1, 0.0f);
1495 glTexCoord2f(1-(center.x+radius)/terrain.scale/256,(center.z+radius)/terrain.scale/256);
1496 glVertex3f(1, 1, 0.0f);
1497 glTexCoord2f(1-(center.x-radius)/terrain.scale/256,(center.z+radius)/terrain.scale/256);
1498 glVertex3f(-1, 1, 0.0f);
1501 glRotatef(player[0].lookrotation*-1+180,0,0,1);
1502 glTranslatef(-(center.x/terrain.scale/256*-2+1),(center.z/terrain.scale/256*-2+1),0);
1503 for(i=0;i<objects.numobjects;i++){
1504 if(objects.type[i]==treetrunktype){
1505 distcheck=findDistancefast(&player[0].coords,&objects.position[i]);
1506 if(distcheck<mapviewdist){
1507 glBindTexture( GL_TEXTURE_2D, Mapcircletexture);
1508 glColor4f(0,.3,0,opac*(1-distcheck/mapviewdist));
1510 glTranslatef(objects.position[i].x/terrain.scale/256*-2+1,objects.position[i].z/terrain.scale/256*2-1,0);
1511 glRotatef(objects.rotation[i],0,0,1);
1512 glScalef(.003,.003,.003);
1515 glVertex3f(-1, -1, 0.0f);
1517 glVertex3f(1, -1, 0.0f);
1519 glVertex3f(1, 1, 0.0f);
1521 glVertex3f(-1, 1, 0.0f);
1526 if(objects.type[i]==boxtype){
1527 distcheck=findDistancefast(&player[0].coords,&objects.position[i]);
1528 if(distcheck<mapviewdist){
1529 glBindTexture( GL_TEXTURE_2D, Mapboxtexture);
1530 glColor4f(.4,.4,.4,opac*(1-distcheck/mapviewdist));
1532 glTranslatef(objects.position[i].x/terrain.scale/256*-2+1,objects.position[i].z/terrain.scale/256*2-1,0);
1533 glRotatef(objects.rotation[i],0,0,1);
1534 glScalef(.01*objects.scale[i],.01*objects.scale[i],.01*objects.scale[i]);
1537 glVertex3f(-1, -1, 0.0f);
1539 glVertex3f(1, -1, 0.0f);
1541 glVertex3f(1, 1, 0.0f);
1543 glVertex3f(-1, 1, 0.0f);
1550 glBindTexture( GL_TEXTURE_2D, Mapcircletexture);
1551 for(i=0;i<numboundaries;i++){
1552 glColor4f(0,0,0,opac/3);
1554 glTranslatef(boundary[i].x/terrain.scale/256*-2+1,boundary[i].z/terrain.scale/256*2-1,0);
1555 glScalef(.002,.002,.002);
1558 glVertex3f(-1, -1, 0.0f);
1560 glVertex3f(1, -1, 0.0f);
1562 glVertex3f(1, 1, 0.0f);
1564 glVertex3f(-1, 1, 0.0f);
1569 for(i=0;i<numplayers;i++){
1570 distcheck=findDistancefast(&player[0].coords,&player[i].coords);
1571 if(distcheck<mapviewdist){
1573 glBindTexture( GL_TEXTURE_2D, Maparrowtexture);
1574 if(i==0)glColor4f(1,1,1,opac);
1575 else if(player[i].dead==2||player[i].howactive>typesleeping)glColor4f(0,0,0,opac*(1-distcheck/mapviewdist));
1576 else if(player[i].dead)glColor4f(.3,.3,.3,opac*(1-distcheck/mapviewdist));
1577 else if(player[i].aitype==attacktypecutoff)glColor4f(1,0,0,opac*(1-distcheck/mapviewdist));
1578 else if(player[i].aitype==passivetype)glColor4f(0,1,0,opac*(1-distcheck/mapviewdist));
1579 else glColor4f(1,1,0,1);
1580 glTranslatef(player[i].coords.x/terrain.scale/256*-2+1,player[i].coords.z/terrain.scale/256*2-1,0);
1581 glRotatef(player[i].rotation+180,0,0,1);
1582 glScalef(.005,.005,.005);
1585 glVertex3f(-1, -1, 0.0f);
1587 glVertex3f(1, -1, 0.0f);
1589 glVertex3f(1, 1, 0.0f);
1591 glVertex3f(-1, 1, 0.0f);
1593 /*glBegin(GL_TRIANGLES);
1595 glVertex3f(-1, -1, 0.0f);
1597 glVertex3f(1, -1, 0.0f);
1599 glVertex3f(0, 1, 0.0f);
1604 /*glBegin(GL_QUADS);
1606 glVertex3f(-1, -1, 0.0f);
1608 glVertex3f(1, -1, 0.0f);
1610 glVertex3f(1, 1, 0.0f);
1612 glVertex3f(-1, 1, 0.0f);
1615 glDisable(GL_TEXTURE_2D);
1616 glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
1617 glPopMatrix(); // Restore The Old Projection Matrix
1618 glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
1619 glPopMatrix(); // Restore The Old Projection Matrix
1620 glEnable(GL_DEPTH_TEST); // Enables Depth Testing
1621 glEnable(GL_CULL_FACE);
1622 glDisable(GL_BLEND);
1628 drawmode=normalmode;
1632 if(loading&&!stealthloading&&(!campaign||player[0].dead)){
1633 glDisable(GL_DEPTH_TEST); // Disables Depth Testing
1634 glDisable(GL_CULL_FACE);
1635 glDisable(GL_LIGHTING);
1636 glDisable(GL_TEXTURE_2D);
1638 glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
1639 glPushMatrix(); // Store The Projection Matrix
1640 glLoadIdentity(); // Reset The Projection Matrix
1641 glOrtho(0,screenwidth,0,screenheight,-100,100); // Set Up An Ortho Screen
1642 glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
1643 glPushMatrix(); // Store The Modelview Matrix
1644 glLoadIdentity(); // Reset The Modelview Matrix
1645 glScalef(screenwidth,screenheight,1);
1646 glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
1648 glColor4f(0,0,0,.7);
1650 glVertex3f(0, 0, 0.0f);
1651 glVertex3f(256, 0, 0.0f);
1652 glVertex3f(256, 256, 0.0f);
1653 glVertex3f(0, 256, 0.0f);
1655 glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
1656 glPopMatrix(); // Restore The Old Projection Matrix
1657 glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
1658 glPopMatrix(); // Restore The Old Projection Matrix
1659 glEnable(GL_DEPTH_TEST); // Enables Depth Testing
1660 glEnable(GL_CULL_FACE);
1661 glDisable(GL_BLEND);
1665 glDisable(GL_DEPTH_TEST);
1666 glColor3f (1.0, 1.0, 1.0); // no coloring
1668 glEnable(GL_TEXTURE_2D);
1669 /*glBindTexture( GL_TEXTURE_2D, logotexture);
1670 glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE );
1671 glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE );
1672 glDisable(GL_DEPTH_TEST); // Disables Depth Testing
1673 glDisable(GL_CULL_FACE);
1674 glDisable(GL_LIGHTING);
1676 glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
1677 glPushMatrix(); // Store The Projection Matrix
1678 glLoadIdentity(); // Reset The Projection Matrix
1679 glOrtho(0,screenwidth,0,screenheight,-100,100); // Set Up An Ortho Screen
1680 glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
1681 glPushMatrix(); // Store The Modelview Matrix
1682 glLoadIdentity(); // Reset The Modelview Matrix
1683 glScalef((float)screenwidth/2,(float)screenwidth/2,1);
1684 glTranslatef(1.8,1.25,0);
1685 glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
1689 glScalef(.25,.25,.25);
1692 glVertex3f(-1, -1, 0.0f);
1694 glVertex3f(1, -1, 0.0f);
1696 glVertex3f(1, 1, 0.0f);
1698 glVertex3f(-1, 1, 0.0f);
1701 glDisable(GL_TEXTURE_2D);
1702 glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
1703 glPopMatrix(); // Restore The Old Projection Matrix
1704 glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
1705 glPopMatrix(); // Restore The Old Projection Matrix
1706 glEnable(GL_DEPTH_TEST); // Enables Depth Testing
1707 glEnable(GL_CULL_FACE);
1708 glDisable(GL_BLEND);
1714 glEnable(GL_TEXTURE_2D);
1716 sprintf (string, "Loading...");
1717 text.glPrint(1024/2-90,768/2,string,1,2,1024,768);
1720 //if(ismotionblur)drawmode=motionblurmode;
1721 drawmode=normalmode;
1724 if(winfreeze&&!campaign){
1725 glDisable(GL_DEPTH_TEST); // Disables Depth Testing
1726 glDisable(GL_CULL_FACE);
1727 glDisable(GL_LIGHTING);
1728 glDisable(GL_TEXTURE_2D);
1730 glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
1731 glPushMatrix(); // Store The Projection Matrix
1732 glLoadIdentity(); // Reset The Projection Matrix
1733 glOrtho(0,screenwidth,0,screenheight,-100,100); // Set Up An Ortho Screen
1734 glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
1735 glPushMatrix(); // Store The Modelview Matrix
1736 glLoadIdentity(); // Reset The Modelview Matrix
1737 glScalef(screenwidth,screenheight,1);
1738 glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
1740 glColor4f(0,0,0,.4);
1742 glVertex3f(0, 0, 0.0f);
1743 glVertex3f(256, 0, 0.0f);
1744 glVertex3f(256, 256, 0.0f);
1745 glVertex3f(0, 256, 0.0f);
1747 glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
1748 glPopMatrix(); // Restore The Old Projection Matrix
1749 glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
1750 glPopMatrix(); // Restore The Old Projection Matrix
1751 glEnable(GL_DEPTH_TEST); // Enables Depth Testing
1752 glEnable(GL_CULL_FACE);
1753 glDisable(GL_BLEND);
1757 glDisable(GL_DEPTH_TEST);
1758 glColor3f (1.0, 1.0, 1.0); // no coloring
1760 glEnable(GL_TEXTURE_2D);
1761 /*glBindTexture( GL_TEXTURE_2D, logotexture);
1762 glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE );
1763 glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE );
1764 glDisable(GL_DEPTH_TEST); // Disables Depth Testing
1765 glDisable(GL_CULL_FACE);
1766 glDisable(GL_LIGHTING);
1768 glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
1769 glPushMatrix(); // Store The Projection Matrix
1770 glLoadIdentity(); // Reset The Projection Matrix
1771 glOrtho(0,screenwidth,0,screenheight,-100,100); // Set Up An Ortho Screen
1772 glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
1773 glPushMatrix(); // Store The Modelview Matrix
1774 glLoadIdentity(); // Reset The Modelview Matrix
1775 glScalef((float)screenwidth/2,(float)screenwidth/2,1);
1776 glTranslatef(1.8,1.25,0);
1777 glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
1781 glScalef(.25,.25,.25);
1784 glVertex3f(-1, -1, 0.0f);
1786 glVertex3f(1, -1, 0.0f);
1788 glVertex3f(1, 1, 0.0f);
1790 glVertex3f(-1, 1, 0.0f);
1793 glDisable(GL_TEXTURE_2D);
1794 glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
1795 glPopMatrix(); // Restore The Old Projection Matrix
1796 glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
1797 glPopMatrix(); // Restore The Old Projection Matrix
1798 glEnable(GL_DEPTH_TEST); // Enables Depth Testing
1799 glEnable(GL_CULL_FACE);
1800 glDisable(GL_BLEND);
1808 if(damagetaken==0&&player[0].bloodloss==0){
1809 awards[numawards]=awardflawless;
1815 for(i=1;i<numplayers;i++){
1816 if(player[i].dead!=2)alldead=0;
1819 awards[numawards]=awardalldead;
1824 for(i=1;i<numplayers;i++){
1825 if(player[i].dead!=1)alldead=0;
1828 awards[numawards]=awardnodead;
1831 if(numresponded==0&&!numthrowkill){
1832 awards[numawards]=awardstealth;
1835 if(numattacks==numstaffattack&&numattacks>0){
1836 awards[numawards]=awardbojutsu;
1839 if(numattacks==numswordattack&&numattacks>0){
1840 awards[numawards]=awardswordsman;
1843 if(numattacks==numknifeattack&&numattacks>0){
1844 awards[numawards]=awardknifefighter;
1847 if(numattacks==numunarmedattack&&numthrowkill==0&&weapons.numweapons>0){
1848 awards[numawards]=awardkungfu;
1852 awards[numawards]=awardevasion;
1855 if(numflipfail==0&&numflipped+numwallflipped*2>20){
1856 awards[numawards]=awardacrobat;
1859 if(numthrowkill==numplayers-1){
1860 awards[numawards]=awardlongrange;
1865 for(i=1;i<numplayers;i++){
1866 if(player[i].dead!=2)alldead=0;
1868 if(numafterkill>0&&alldead){
1869 awards[numawards]=awardbrutal;
1872 if(numreversals>((float)numattacks)*.8&&numreversals>3){
1873 awards[numawards]=awardaikido;
1876 if(maxalarmed==1&&numplayers>2){
1877 awards[numawards]=awardstrategy;
1881 awards[numawards]=awardklutz;
1886 //Win Screen Won Victory
1888 glEnable(GL_TEXTURE_2D);
1890 sprintf (string, "Level Cleared!");
1891 text.glPrintOutlined(1024/2-strlen(string)*10,768*7/8,string,1,2,1024,768);
1893 sprintf (string, "Score: %d",(int)(bonustotal-startbonustotal));
1894 text.glPrintOutlined(1024/30,768*6/8,string,1,2,1024,768);
1896 if(!campaign)sprintf (string, "Press Escape to return to menu or Space to continue");
1897 if(campaign)sprintf (string, "Press Escape or Space to continue");
1898 text.glPrintOutlined(640/2-strlen(string)*5,480*1/16,string,1,1,640,480);
1902 for(i=0;i<255;i++)string[i]='\0';
1903 sprintf (temp, "Time: %d:",(int)(((int)leveltime-(int)(leveltime)%60)/60));
1904 strcat(string,temp);
1905 if((int)(leveltime)%60<10)strcat(string,"0");
1906 sprintf (temp, "%d",(int)(leveltime)%60);
1907 strcat(string,temp);
1908 text.glPrintOutlined(1024/30,768*6/8-40,string,1,2,1024,768);
1910 for(i=0;i<numawards;i++){
1912 if(awards[i]==awardklutz)sprintf (string, "Suicidal");
1913 if(awards[i]==awardflawless)sprintf (string, "Flawless!");
1914 if(awards[i]==awardalldead)sprintf (string, "Take no prisoners");
1915 if(awards[i]==awardnodead)sprintf (string, "Merciful");
1916 if(awards[i]==awardstealth)sprintf (string, "One with the shadows!");
1917 if(awards[i]==awardswordsman)sprintf (string, "Swordsman");
1918 if(awards[i]==awardkungfu)sprintf (string, "Unarmed!");
1919 if(awards[i]==awardknifefighter)sprintf (string, "Knife fighter");
1920 if(awards[i]==awardcoward)sprintf (string, "Coward");
1921 if(awards[i]==awardevasion)sprintf (string, "Escape artist");
1922 if(awards[i]==awardacrobat)sprintf (string, "Gymnast");
1923 if(awards[i]==awardlongrange)sprintf (string, "Blade slinger");
1924 if(awards[i]==awardbrutal)sprintf (string, "Brutal");
1925 if(awards[i]==awardhyper)sprintf (string, "Hyper");
1926 if(awards[i]==awardaikido)sprintf (string, "Aikido master!");
1927 if(awards[i]==awardrambo)sprintf (string, "Rambo");
1928 if(awards[i]==awardfast)sprintf (string, "Fast");
1929 if(awards[i]==awardrealfast)sprintf (string, "Real fast");
1930 if(awards[i]==awarddamnfast)sprintf (string, "Damn fast");
1931 if(awards[i]==awardstrategy)sprintf (string, "Divide and conquer");
1932 if(awards[i]==awardbojutsu)sprintf (string, "Bojutsu");
1933 text.glPrintOutlined(1024/30,768*6/8-90-40*i,string,1,2,1024,768);
1937 //drawmode=normalmode;
1940 if(drawmode!=normalmode){
1941 glEnable(GL_TEXTURE_2D);
1943 if(!drawtoggle||drawmode!=realmotionblurmode||(drawtoggle==2||change==1)){
1946 glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE_EXT);
1947 GLfloat subtractColor[4] = { 0.5, 0.5, 0.5, 0.0 };
1948 glTexEnvfv(GL_TEXTURE_ENV, GL_TEXTURE_ENV_COLOR, subtractColor);
1949 //glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB_EXT, GL_SUBTRACT);
1950 glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_RGB_EXT, GL_TEXTURE);
1951 glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE1_RGB_EXT, GL_CONSTANT_EXT);
1952 glTexEnvf(GL_TEXTURE_ENV, GL_RGB_SCALE_EXT, 2.0f);
1954 glBindTexture( GL_TEXTURE_2D, screentexture);
1955 glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 0, texviewwidth, texviewheight);
1958 if((drawtoggle||change==1)&&drawmode==realmotionblurmode){
1960 glBindTexture( GL_TEXTURE_2D, screentexture2);
1961 glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 0, texviewwidth, texviewheight);
1963 if(!screentexture2){
1964 glPixelStorei( GL_UNPACK_ALIGNMENT, 1 );
1966 glGenTextures( 1, &screentexture2 );
1967 glTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE );
1969 glEnable(GL_TEXTURE_2D);
1970 glBindTexture( GL_TEXTURE_2D, screentexture2);
1971 glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR );
1972 glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR );
1974 glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 0, 0, kTextureSize, kTextureSize, 0);
1980 glClear(GL_DEPTH_BUFFER_BIT);
1981 ReSizeGLScene(90,.1f);
1982 glViewport(0,0,screenwidth,screenheight);
1984 if(drawmode!=normalmode){
1985 glDisable(GL_DEPTH_TEST);
1986 if(drawmode==motionblurmode){
1987 glDrawBuffer(GL_FRONT);
1988 glReadBuffer(GL_BACK);
1989 //myassert(glGetError() == GL_NO_ERROR);
1992 glColor3f (1.0, 1.0, 1.0); // no coloring
1994 glEnable(GL_TEXTURE_2D);
1995 glBindTexture( GL_TEXTURE_2D, screentexture);
1996 glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE );
1997 glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE );
1998 glDisable(GL_DEPTH_TEST); // Disables Depth Testing
1999 glDisable(GL_CULL_FACE);
2000 glDisable(GL_LIGHTING);
2002 glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
2003 glPushMatrix(); // Store The Projection Matrix
2004 glLoadIdentity(); // Reset The Projection Matrix
2005 glOrtho(0,screenwidth,0,screenheight,-100,100); // Set Up An Ortho Screen
2006 glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
2007 glPushMatrix(); // Store The Modelview Matrix
2008 glLoadIdentity(); // Reset The Modelview Matrix
2009 glScalef((float)screenwidth/2,(float)screenheight/2,1);
2010 glTranslatef(1,1,0);
2011 glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
2013 if(drawmode==motionblurmode){
2014 if(motionbluramount<.2)motionbluramount=.2;
2015 //glColor4f(1,1,1,fast_sqrt(multiplier)*2.9*motionbluramount);
2016 glColor4f(1,1,1,motionbluramount);
2020 glVertex3f(-1, -1, 0.0f);
2021 glTexCoord2f(texcoordwidth,0);
2022 glVertex3f(1, -1, 0.0f);
2023 glTexCoord2f(texcoordwidth,texcoordheight);
2024 glVertex3f(1, 1, 0.0f);
2025 glTexCoord2f(0,texcoordheight);
2026 glVertex3f(-1, 1, 0.0f);
2030 if(drawmode==realmotionblurmode){
2031 glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
2032 glClear(GL_COLOR_BUFFER_BIT);
2033 glBlendFunc(GL_SRC_ALPHA,GL_ONE);
2034 glBindTexture( GL_TEXTURE_2D, screentexture);
2035 glColor4f(1,1,1,.5);
2039 glVertex3f(-1, -1, 0.0f);
2040 glTexCoord2f(texcoordwidth,0);
2041 glVertex3f(1, -1, 0.0f);
2042 glTexCoord2f(texcoordwidth,texcoordheight);
2043 glVertex3f(1, 1, 0.0f);
2044 glTexCoord2f(0,texcoordheight);
2045 glVertex3f(-1, 1, 0.0f);
2048 glBindTexture( GL_TEXTURE_2D, screentexture2);
2049 glColor4f(1,1,1,.5);
2053 glVertex3f(-1, -1, 0.0f);
2054 glTexCoord2f(texcoordwidth,0);
2055 glVertex3f(1, -1, 0.0f);
2056 glTexCoord2f(texcoordwidth,texcoordheight);
2057 glVertex3f(1, 1, 0.0f);
2058 glTexCoord2f(0,texcoordheight);
2059 glVertex3f(-1, 1, 0.0f);
2062 glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
2064 if(drawmode==doublevisionmode){
2065 static float crosseyedness;
2066 crosseyedness=abs(player[0].damage-player[0].superpermanentdamage-(player[0].damagetolerance-player[0].superpermanentdamage)*1/2)/30;
2067 if(crosseyedness>1)crosseyedness=1;
2068 if(crosseyedness<0)crosseyedness=0;
2070 glDisable(GL_BLEND);
2075 glVertex3f(-1, -1, 0.0f);
2076 glTexCoord2f(texcoordwidth,0);
2077 glVertex3f(1, -1, 0.0f);
2078 glTexCoord2f(texcoordwidth,texcoordheight);
2079 glVertex3f(1, 1, 0.0f);
2080 glTexCoord2f(0,texcoordheight);
2081 glVertex3f(-1, 1, 0.0f);
2085 glColor4f(1,1,1,.5);
2088 glTranslatef(.015*crosseyedness,0,0);
2092 glVertex3f(-1, -1, 0.0f);
2093 glTexCoord2f(texcoordwidth,0);
2094 glVertex3f(1, -1, 0.0f);
2095 glTexCoord2f(texcoordwidth,texcoordheight);
2096 glVertex3f(1, 1, 0.0f);
2097 glTexCoord2f(0,texcoordheight);
2098 glVertex3f(-1, 1, 0.0f);
2103 if(drawmode==glowmode){
2104 glColor4f(.5,.5,.5,.5);
2106 glBlendFunc(GL_SRC_ALPHA,GL_ONE);
2108 glTranslatef(.01,0,0);
2111 glVertex3f(-1, -1, 0.0f);
2112 glTexCoord2f(texcoordwidth,0);
2113 glVertex3f(1, -1, 0.0f);
2114 glTexCoord2f(texcoordwidth,texcoordheight);
2115 glVertex3f(1, 1, 0.0f);
2116 glTexCoord2f(0,texcoordheight);
2117 glVertex3f(-1, 1, 0.0f);
2121 glTranslatef(-.01,0,0);
2124 glVertex3f(-1, -1, 0.0f);
2125 glTexCoord2f(texcoordwidth,0);
2126 glVertex3f(1, -1, 0.0f);
2127 glTexCoord2f(texcoordwidth,texcoordheight);
2128 glVertex3f(1, 1, 0.0f);
2129 glTexCoord2f(0,texcoordheight);
2130 glVertex3f(-1, 1, 0.0f);
2134 glTranslatef(.0,.01,0);
2137 glVertex3f(-1, -1, 0.0f);
2138 glTexCoord2f(texcoordwidth,0);
2139 glVertex3f(1, -1, 0.0f);
2140 glTexCoord2f(texcoordwidth,texcoordheight);
2141 glVertex3f(1, 1, 0.0f);
2142 glTexCoord2f(0,texcoordheight);
2143 glVertex3f(-1, 1, 0.0f);
2147 glTranslatef(0,-.01,0);
2150 glVertex3f(-1, -1, 0.0f);
2151 glTexCoord2f(texcoordwidth,0);
2152 glVertex3f(1, -1, 0.0f);
2153 glTexCoord2f(texcoordwidth,texcoordheight);
2154 glVertex3f(1, 1, 0.0f);
2155 glTexCoord2f(0,texcoordheight);
2156 glVertex3f(-1, 1, 0.0f);
2160 if(drawmode==radialzoommode){
2162 //glRotatef((float)i*.1,0,0,1);
2163 glColor4f(1,1,1,1/((float)i+1));
2165 glScalef(1+(float)i*.01,1+(float)i*.01,1);
2168 glVertex3f(-1, -1, 0.0f);
2169 glTexCoord2f(texcoordwidth,0);
2170 glVertex3f(1, -1, 0.0f);
2171 glTexCoord2f(texcoordwidth,texcoordheight);
2172 glVertex3f(1, 1, 0.0f);
2173 glTexCoord2f(0,texcoordheight);
2174 glVertex3f(-1, 1, 0.0f);
2179 glDisable(GL_TEXTURE_2D);
2180 glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
2181 glPopMatrix(); // Restore The Old Projection Matrix
2182 glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
2183 glPopMatrix(); // Restore The Old Projection Matrix
2184 glEnable(GL_DEPTH_TEST); // Enables Depth Testing
2185 glEnable(GL_CULL_FACE);
2186 glDisable(GL_BLEND);
2191 glEnable(GL_TEXTURE_2D);
2196 if(consoleselected>=60)offset=consoleselected-60;
2197 sprintf (string, " ]");
2198 text.glPrint(10,30,string,0,1,1024,768);
2200 sprintf (string, "_");
2201 text.glPrint(30+(float)(consoleselected)*10-offset*10,30,string,0,1,1024,768);
2204 for(j=0;j<consolechars[i];j++){
2205 glColor4f(1,1,1,1-(float)(i)/16);
2206 if(j<consolechars[i]){
2207 sprintf (string, "%c",consoletext[i][j]);
2208 text.glPrint(30+j*10-offset*10,30+i*20,string,0,1,1024,768);
2216 if(freeze||winfreeze||(mainmenu&&gameon)||(!gameon&&gamestarted)||(mainmenu&&gameon)||(!gameon&&gamestarted)||(!gameon&&gamestarted)){
2217 multiplier=tempmult;
2221 glDrawBuffer(GL_BACK);
2222 glReadBuffer(GL_BACK);
2223 glTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE );
2224 ReSizeGLScene(90,.1f);
2227 temptexdetail=texdetail;
2228 if(texdetail>2)texdetail=2;
2229 if(mainmenu!=oldmainmenu&&oldmainmenu!=0){
2231 LoadTexture(":Data:Textures:Newgame.png",&Mainmenuitems[1],0,0);
2232 LoadTexture(":Data:Textures:Quit.png",&Mainmenuitems[3],0,0);
2233 /*if(oldmainmenu==1||oldmainmenu==0){
2234 LoadTexture(":Data:Textures:World.png",&Mainmenuitems[7],0,0);
2235 LoadTexture(":Data:Textures:Options.png",&Mainmenuitems[2],0,0);
2236 LoadTexture(":Data:Textures:Lugaru.png",&Mainmenuitems[0],0,0);
2241 LoadTexture(":Data:Textures:Resume.png",&Mainmenuitems[1],0,0);
2242 LoadTexture(":Data:Textures:Endgame.png",&Mainmenuitems[3],0,0);
2243 /*if(oldmainmenu==2||oldmainmenu==0){
2244 LoadTexture(":Data:Textures:World.png",&Mainmenuitems[7],0,0);
2245 LoadTexture(":Data:Textures:Options.png",&Mainmenuitems[2],0,0);
2246 LoadTexture(":Data:Textures:Lugaru.png",&Mainmenuitems[0],0,0);
2251 if(lastcheck>.5||oldmainmenu!=mainmenu){
2253 ifstream ipstream(ConvertFileName(":Data:Campaigns:main.txt"));
2254 //campaignnumlevels=0;
2255 //accountcampaignchoicesmade[accountactive]=0;
2256 ipstream.ignore(256,':');
2257 ipstream >> campaignnumlevels;
2258 for(i=0;i<campaignnumlevels;i++){
2259 ipstream.ignore(256,':');
2260 ipstream.ignore(256,':');
2261 ipstream.ignore(256,' ');
2262 ipstream >> campaignmapname[i];
2263 ipstream.ignore(256,':');
2264 ipstream >> campaigndescription[i];
2266 if(campaigndescription[i][j]=='_')campaigndescription[i][j]=' ';
2268 ipstream.ignore(256,':');
2269 ipstream >> campaignchoosenext[i];
2270 ipstream.ignore(256,':');
2271 ipstream >> campaignnumnext[i];
2272 if(campaignnumnext[i])
2273 for(j=0;j<campaignnumnext[i];j++){
2274 ipstream.ignore(256,':');
2275 ipstream >> campaignnextlevel[i][j];
2276 campaignnextlevel[i][j]-=1;
2278 ipstream.ignore(256,':');
2279 ipstream >> campaignlocationx[i];
2280 //campaignlocationx[i]-=30;
2281 ipstream.ignore(256,':');
2282 ipstream >> campaignlocationy[i];
2283 //campaignlocationy[i]+=30;
2287 for(i=0;i<campaignnumlevels;i++){
2289 levelhighlight[i]=0;
2294 if(accountcampaignchoicesmade[accountactive])
2295 for(i=0;i<accountcampaignchoicesmade[accountactive];i++){
2296 levelorder[i+1]=campaignnextlevel[levelorder[i]][accountcampaignchoices[accountactive][i]];
2297 levelvisible[levelorder[i+1]]=1;
2299 int whichlevelstart;
2300 whichlevelstart=accountcampaignchoicesmade[accountactive]-1;
2301 if(whichlevelstart<0){
2302 accountcampaignscore[accountactive]=0;
2303 accountcampaignfasttime[accountactive]=0;
2304 campaignchoicenum=1;
2305 campaignchoicewhich[0]=0;
2309 campaignchoicenum=campaignnumnext[levelorder[whichlevelstart]];
2310 if(campaignchoicenum==0){
2311 if(accountcampaignscore[accountactive]>accountcampaignhighscore[accountactive])accountcampaignhighscore[accountactive]=accountcampaignscore[accountactive];
2312 if(accountcampaignfasttime[accountactive]==0||accountcampaigntime[accountactive]<accountcampaignfasttime[accountactive])accountcampaignfasttime[accountactive]=accountcampaigntime[accountactive];
2314 if(campaignchoicenum)
2315 for(i=0;i<campaignchoicenum;i++){
2316 campaignchoicewhich[i]=campaignnextlevel[levelorder[whichlevelstart]][i];
2317 levelvisible[campaignnextlevel[levelorder[whichlevelstart]][i]]=1;
2318 levelhighlight[campaignnextlevel[levelorder[whichlevelstart]][i]]=1;
2331 texdetail=temptexdetail;
2333 /*if(mainmenu!=0)*/oldmainmenu=mainmenu;
2335 if(mainmenu==3||mainmenu==4||mainmenu==5||mainmenu==6||mainmenu==7||mainmenu==8||mainmenu==9||mainmenu==10||mainmenu==119||mainmenu==12||mainmenu==13||mainmenu==14||mainmenu==15||mainmenu==16||mainmenu==17){
2336 glClear(GL_DEPTH_BUFFER_BIT);
2337 glEnable(GL_ALPHA_TEST);
2338 glAlphaFunc(GL_GREATER, 0.001f);
2339 glEnable(GL_TEXTURE_2D);
2340 glDisable(GL_DEPTH_TEST); // Disables Depth Testing
2341 glDisable(GL_CULL_FACE);
2342 glDisable(GL_LIGHTING);
2344 glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
2345 glPushMatrix(); // Store The Projection Matrix
2346 glLoadIdentity(); // Reset The Projection Matrix
2347 glOrtho(0,screenwidth,0,screenheight,-100,100); // Set Up An Ortho Screen
2348 glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
2349 glPushMatrix(); // Store The Modelview Matrix
2350 glLoadIdentity(); // Reset The Modelview Matrix
2351 glTranslatef(screenwidth/2,screenheight/2,0);
2353 glScalef((float)screenwidth/2,(float)screenheight/2,1);
2354 glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
2355 glDisable(GL_BLEND);
2356 glColor4f(0,0,0,1.0);
2357 glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP );
2358 glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP );
2359 glDisable(GL_TEXTURE_2D);
2361 //glScalef(.25,.25,.25);
2364 glVertex3f(-1, -1, 0.0f);
2366 glVertex3f(1, -1, 0.0f);
2368 glVertex3f(1, 1, 0.0f);
2370 glVertex3f(-1, 1, 0.0f);
2374 glColor4f(0.4,0.4,0.4,1.0);
2375 glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP );
2376 glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP );
2377 glEnable(GL_TEXTURE_2D);
2378 glBindTexture( GL_TEXTURE_2D, Mainmenuitems[4]);
2380 //glScalef(.25,.25,.25);
2383 glVertex3f(-1, -1, 0.0f);
2385 glVertex3f(1, -1, 0.0f);
2387 glVertex3f(1, 1, 0.0f);
2389 glVertex3f(-1, 1, 0.0f);
2394 glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
2396 glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
2400 if((float)newscreenwidth>(float)newscreenheight*1.61||(float)newscreenwidth<(float)newscreenheight*1.59)sprintf (menustring[0], "Resolution: %d*%d",(int)newscreenwidth,(int)newscreenheight);
2401 else sprintf (menustring[0], "Resolution: %d*%d (widescreen)",(int)newscreenwidth,(int)newscreenheight);
2404 endx[0]=startx[0]+strlen(menustring[0])*10;
2405 endy[0]=starty[0]+20;
2409 if(newdetail==2)sprintf (menustring[1], "Detail: High");
2410 else if(newdetail==1)sprintf (menustring[1], "Detail: Medium");
2411 else sprintf (menustring[1], "Detail: Low");
2414 endx[1]=startx[1]+strlen(menustring[1])*10;
2415 endy[1]=starty[1]+20;
2419 if(bloodtoggle==2)sprintf (menustring[2], "Blood: On, high detail (slower)");
2420 if(bloodtoggle==1)sprintf (menustring[2], "Blood: On, low detail");
2421 if(bloodtoggle==0)sprintf (menustring[2], "Blood: Off");
2424 endx[2]=startx[2]+strlen(menustring[2])*10;
2425 endy[2]=starty[2]+20;
2429 if(difficulty==2)sprintf (menustring[3], "Difficulty: Insane");
2430 if(difficulty==1)sprintf (menustring[3], "Difficulty: Difficult");
2431 if(difficulty==0)sprintf (menustring[3], "Difficulty: Easier");
2432 startx[3]=10+20-1000;
2434 endx[3]=startx[3]+strlen(menustring[3])*10;
2435 endy[3]=starty[3]+20;
2439 if(ismotionblur==1)sprintf (menustring[4], "Blur Effects: Enabled (less compatible)");
2440 if(ismotionblur==0)sprintf (menustring[4], "Blur Effects: Disabled (more compatible)");
2443 endx[4]=startx[4]+strlen(menustring[4])*10;
2444 endy[4]=starty[4]+20;
2448 if(decals==1)sprintf (menustring[5], "Decals: Enabled (slower)");
2449 if(decals==0)sprintf (menustring[5], "Decals: Disabled");
2452 endx[5]=startx[5]+strlen(menustring[5])*10;
2453 endy[5]=starty[5]+20;
2457 if(musictoggle==1)sprintf (menustring[6], "Music: Enabled");
2458 if(musictoggle==0)sprintf (menustring[6], "Music: Disabled");
2461 endx[6]=startx[6]+strlen(menustring[6])*10;
2462 endy[6]=starty[6]+20;
2466 if(invertmouse==1)sprintf (menustring[9], "Invert mouse: Yes");
2467 if(invertmouse==0)sprintf (menustring[9], "Invert mouse: No");
2470 endx[9]=startx[9]+strlen(menustring[9])*10;
2471 endy[9]=starty[9]+20;
2475 sprintf (menustring[10], "Mouse Speed: %d", (int)(usermousesensitivity*5));
2478 endx[10]=startx[10]+strlen(menustring[10])*10;
2479 endy[10]=starty[10]+20;
2483 sprintf (menustring[11], "Volume: %d%", (int)(volume*100));
2486 endx[11]=startx[11]+strlen(menustring[11])*10;
2487 endy[11]=starty[11]+20;
2491 sprintf (menustring[7], "-Configure Controls-");
2494 endx[7]=startx[7]+strlen(menustring[7])*10;
2495 endy[7]=starty[7]+20;
2499 if(newdetail==detail&&newscreenheight==(int)screenheight&&newscreenwidth==(int)screenwidth)sprintf (menustring[8], "Back");
2500 else sprintf (menustring[8], "Back (some changes take effect next time Lugaru is opened)");
2502 endx[8]=startx[8]+strlen(menustring[8])*10;
2504 endy[8]=starty[8]+20;
2511 if(keyselect!=0)sprintf (menustring[0], "Forwards: %s",KeyToChar(forwardkey));
2512 else sprintf (menustring[0], "Forwards: _");
2515 endx[0]=startx[0]+strlen(menustring[0])*10;
2516 endy[0]=starty[0]+20;
2520 if(keyselect!=1)sprintf (menustring[1], "Back: %s",KeyToChar(backkey));
2521 else sprintf (menustring[1], "Back: _");
2524 endx[1]=startx[1]+strlen(menustring[1])*10;
2525 endy[1]=starty[1]+20;
2529 if(keyselect!=2)sprintf (menustring[2], "Left: %s",KeyToChar(leftkey));
2530 else sprintf (menustring[2], "Left: _");
2533 endx[2]=startx[2]+strlen(menustring[2])*10;
2534 endy[2]=starty[2]+20;
2538 if(keyselect!=3)sprintf (menustring[3], "Right: %s",KeyToChar(rightkey));
2539 else sprintf (menustring[3], "Right: _");
2542 endx[3]=startx[3]+strlen(menustring[3])*10;
2543 endy[3]=starty[3]+20;
2547 if(keyselect!=4)sprintf (menustring[4], "Crouch: %s",KeyToChar(crouchkey));
2548 else sprintf (menustring[4], "Crouch: _");
2551 endx[4]=startx[4]+strlen(menustring[4])*10;
2552 endy[4]=starty[4]+20;
2556 if(keyselect!=5)sprintf (menustring[5], "Jump: %s",KeyToChar(jumpkey));
2557 else sprintf (menustring[5], "Jump: _");
2560 endx[5]=startx[5]+strlen(menustring[5])*10;
2561 endy[5]=starty[5]+20;
2565 if(keyselect!=6)sprintf (menustring[6], "Draw: %s",KeyToChar(drawkey));
2566 else sprintf (menustring[6], "Draw: _");
2569 endx[6]=startx[6]+strlen(menustring[6])*10;
2570 endy[6]=starty[6]+20;
2574 if(keyselect!=7)sprintf (menustring[7], "Throw: %s",KeyToChar(throwkey));
2575 else sprintf (menustring[7], "Throw: _");
2578 endx[7]=startx[7]+strlen(menustring[7])*10;
2579 endy[7]=starty[7]+20;
2583 if(keyselect!=8)sprintf (menustring[8], "Attack: %s",KeyToChar(attackkey));
2584 else sprintf (menustring[8], "Attack: _");
2587 endx[8]=startx[8]+strlen(menustring[8])*10;
2588 endy[8]=starty[8]+20;
2594 sprintf (menustring[9], "Back");
2596 endx[9]=startx[9]+strlen(menustring[9])*10;
2598 endy[9]=starty[9]+20;
2603 nummenuitems=7+accountcampaignchoicesmade[accountactive]+campaignchoicenum;
2605 sprintf (menustring[0], "%s",accountname[accountactive]);
2608 endx[0]=startx[0]+strlen(menustring[0])*10;
2609 endy[0]=starty[0]+20;
2613 sprintf (menustring[1], "Tutorial");
2616 endx[1]=startx[1]+strlen(menustring[1])*10;
2617 endy[1]=starty[1]+20;
2621 sprintf (menustring[2], "Challenge");
2624 endx[2]=startx[2]+strlen(menustring[2])*10;
2625 endy[2]=starty[2]+20;
2629 sprintf (menustring[3], "Delete User");
2632 endx[3]=startx[3]+strlen(menustring[3])*10;
2633 endy[3]=starty[3]+20;
2637 sprintf (menustring[4], "Main Menu");
2640 endx[4]=startx[4]+strlen(menustring[4])*10;
2641 endy[4]=starty[4]+20;
2645 sprintf (menustring[5], "Change User");
2647 endx[5]=startx[5]+strlen(menustring[5])*10;
2649 endy[5]=starty[5]+20;
2655 sprintf (menustring[6], "World");
2657 starty[6]=30+480-400-50;
2658 endx[6]=startx[6]+400;
2663 if(accountcampaignchoicesmade[accountactive])
2664 for(i=0;i<accountcampaignchoicesmade[accountactive];i++){
2665 sprintf (menustring[7+i], campaigndescription[levelorder[i]]);
2666 startx[7+i]=30+120+campaignlocationx[levelorder[i]]*400/512;
2667 starty[7+i]=30+30+(512-campaignlocationy[levelorder[i]])*400/512;
2668 endx[7+i]=startx[7+i]+10;
2669 endy[7+i]=starty[7+i]+10;
2674 if(campaignchoicenum>0)
2675 for(i=accountcampaignchoicesmade[accountactive];i<accountcampaignchoicesmade[accountactive]+campaignchoicenum;i++){
2676 sprintf (menustring[7+i], campaigndescription[levelorder[i]]);
2677 startx[7+i]=30+120+campaignlocationx[campaignchoicewhich[i-(accountcampaignchoicesmade[accountactive])]]*400/512;
2678 starty[7+i]=30+30+(512-campaignlocationy[campaignchoicewhich[i-(accountcampaignchoicesmade[accountactive])]])*400/512;
2679 endx[7+i]=startx[7+i]+10;
2680 endy[7+i]=starty[7+i]+10;
2685 /*sprintf (menustring[7], "Dot");
2686 startx[7]=120+260*400/512;
2687 starty[7]=30+(512-184)*400/512;
2688 endx[7]=startx[7]+10;
2689 endy[7]=starty[7]+10;
2693 sprintf (menustring[8], "Dot");
2694 startx[8]=120+129*400/512;
2695 starty[8]=30+(512-284)*400/512;
2696 endx[8]=startx[8]+10;
2697 endy[8]=starty[8]+10;
2701 sprintf (menustring[9], "Dot");
2702 startx[9]=120+358*400/512;
2703 starty[9]=30+(512-235)*400/512;
2704 endx[9]=startx[9]+10;
2705 endy[9]=starty[9]+10;
2709 sprintf (menustring[10], "Dot");
2710 startx[10]=120+359*400/512;
2711 starty[10]=30+(512-308)*400/512;
2712 endx[10]=startx[10]+10;
2713 endy[10]=starty[10]+10;
2717 sprintf (menustring[11], "Dot");
2718 startx[11]=120+288*400/512;
2719 starty[11]=30+(512-277)*400/512;
2720 endx[11]=startx[11]+10;
2721 endy[11]=starty[11]+10;
2729 sprintf (menustring[0], "Are you sure you want to delete this user?");
2732 endx[0]=startx[0]+strlen(menustring[0])*10;
2733 endy[0]=starty[0]+20;
2737 sprintf (menustring[1], "Yes");
2740 endx[1]=startx[1]+strlen(menustring[1])*10;
2741 endy[1]=starty[1]+20;
2745 sprintf (menustring[2], "No");
2748 endx[2]=startx[2]+strlen(menustring[2])*10;
2749 endy[2]=starty[2]+20;
2753 sprintf (menustring[3], "Extra 4");
2756 endx[3]=startx[3]+strlen(menustring[3])*10;
2757 endy[3]=starty[3]+20;
2761 sprintf (menustring[4], "Extra 5");
2764 endx[4]=startx[4]+strlen(menustring[4])*10;
2765 endy[4]=starty[4]+20;
2769 sprintf (menustring[5], "Back");
2771 endx[5]=startx[5]+strlen(menustring[5])*10;
2773 endy[5]=starty[5]+20;
2779 nummenuitems=numaccounts+2;
2784 sprintf (menustring[0], "New User");
2786 sprintf (menustring[0], "No More Users");
2789 endx[0]=startx[0]+strlen(menustring[0])*10;
2790 endy[0]=starty[0]+20;
2794 if(entername)startx[0]+=10;
2799 for(i=0;i<numaccounts;i++){
2800 sprintf (menustring[num], "%s",accountname[i]);
2802 starty[num]=360-20-20*num;
2803 endx[num]=startx[num]+strlen(menustring[num])*10;
2804 endy[num]=starty[num]+20;
2811 sprintf (menustring[num], "Back");
2813 endx[num]=startx[num]+strlen(menustring[num])*10;
2815 endy[num]=starty[num]+20;
2822 sprintf (menustring[0], "Easier");
2825 endx[0]=startx[0]+strlen(menustring[0])*10;
2826 endy[0]=starty[0]+20;
2830 sprintf (menustring[1], "Difficult");
2833 endx[1]=startx[1]+strlen(menustring[1])*10;
2834 endy[1]=starty[1]+20;
2838 sprintf (menustring[2], "Insane");
2841 endx[2]=startx[2]+strlen(menustring[2])*10;
2842 endy[2]=starty[2]+20;
2848 //tempncl=numchallengelevels;
2849 //numchallengelevels=9;
2850 nummenuitems=2+numchallengelevels;
2853 for(j=0;j<numchallengelevels;j++){
2854 for(i=0;i<255;i++)menustring[j][i]='\0';
2855 sprintf (temp, "Level %d",j+1);
2856 strcpy(menustring[j],temp);
2857 for(i=0;i<17;i++)if(menustring[j][i]=='\0')menustring[j][i]=' ';
2858 menustring[j][17]='\0';
2859 sprintf (temp, "%d",(int)accounthighscore[accountactive][j]);
2860 strcat(menustring[j],temp);
2861 for(i=18;i<32;i++)if(menustring[j][i]=='\0')menustring[j][i]=' ';
2862 menustring[j][32]='\0';
2863 sprintf (temp, "%d:",(int)(((int)accountfasttime[accountactive][j]-(int)(accountfasttime[accountactive][j])%60)/60));
2864 strcat(menustring[j],temp);
2865 if((int)(accountfasttime[accountactive][j])%60<10)strcat(menustring[j],"0");
2866 sprintf (temp, "%d",(int)(accountfasttime[accountactive][j])%60);
2867 strcat(menustring[j],temp);
2871 endx[j]=startx[j]+strlen(menustring[j])*10;
2872 endy[j]=starty[j]+20;
2877 sprintf (menustring[numchallengelevels], "Back");
2878 startx[numchallengelevels]=10;
2879 endx[numchallengelevels]=startx[numchallengelevels]+strlen(menustring[numchallengelevels])*10;
2880 starty[numchallengelevels]=10;
2881 endy[numchallengelevels]=starty[numchallengelevels]+20;
2882 movex[numchallengelevels]=0;
2883 movey[numchallengelevels]=0;
2885 sprintf (menustring[numchallengelevels+1], " High Score Best Time");
2886 startx[numchallengelevels+1]=10;
2887 starty[numchallengelevels+1]=440;
2888 endx[numchallengelevels+1]=startx[numchallengelevels+1]+strlen(menustring[numchallengelevels+1])*10;
2889 endy[numchallengelevels+1]=starty[numchallengelevels+1]+20;
2890 movex[numchallengelevels+1]=0;
2891 movey[numchallengelevels+1]=0;
2893 //numchallengelevels=tempncl;
2897 nummenuitems=2+numchallengelevels;
2900 for(j=0;j<numchallengelevels;j++){
2901 for(i=0;i<255;i++)menustring[j][i]='\0';
2902 sprintf (temp, "Level %d",j+1);
2903 strcpy(menustring[j],temp);
2904 for(i=0;i<17;i++)if(menustring[j][i]=='\0')menustring[j][i]=' ';
2905 menustring[j][17]='\0';
2906 sprintf (temp, "%d",(int)accounthighscore[accountactive][j]);
2907 strcat(menustring[j],temp);
2908 for(i=18;i<32;i++)if(menustring[j][i]=='\0')menustring[j][i]=' ';
2909 menustring[j][32]='\0';
2910 sprintf (temp, "%d:",(int)(((int)accountfasttime[accountactive][j]-(int)(accountfasttime[accountactive][j])%60)/60));
2911 strcat(menustring[j],temp);
2912 if((int)(accountfasttime[accountactive][j])%60<10)strcat(menustring[j],"0");
2913 sprintf (temp, "%d",(int)(accountfasttime[accountactive][j])%60);
2914 strcat(menustring[j],temp);
2918 endx[j]=startx[j]+strlen(menustring[j])*10;
2919 endy[j]=starty[j]+20;
2924 sprintf (menustring[numchallengelevels], "Back");
2925 startx[numchallengelevels]=10;
2926 endx[numchallengelevels]=startx[numchallengelevels]+strlen(menustring[numchallengelevels])*10;
2927 starty[numchallengelevels]=10;
2928 endy[numchallengelevels]=starty[numchallengelevels]+20;
2929 movex[numchallengelevels]=0;
2930 movey[numchallengelevels]=0;
2932 sprintf (menustring[numchallengelevels+1], " High Score Best Time");
2933 startx[numchallengelevels+1]=10;
2934 starty[numchallengelevels+1]=400;
2935 endx[numchallengelevels+1]=startx[numchallengelevels+1]+strlen(menustring[numchallengelevels+1])*10;
2936 endy[numchallengelevels+1]=starty[numchallengelevels+1]+20;
2937 movex[numchallengelevels+1]=0;
2938 movey[numchallengelevels+1]=0;
2945 sprintf (menustring[0], "Congratulations!");
2948 endx[0]=startx[0]+strlen(menustring[0])*10;
2949 endy[0]=starty[0]+20;
2953 sprintf (menustring[1], "You have avenged your family and");
2956 endx[1]=startx[1]+strlen(menustring[1])*10;
2957 endy[1]=starty[1]+20;
2961 sprintf (menustring[2], "restored peace to the island of Lugaru.");
2964 endx[2]=startx[2]+strlen(menustring[2])*10;
2965 endy[2]=starty[2]+20;
2969 sprintf (menustring[3], "Back");
2971 endx[3]=startx[3]+strlen(menustring[3])*10;
2973 endy[3]=starty[3]+20;
2977 for(i=0;i<255;i++)menustring[4][i]='\0';
2978 sprintf (temp, "Your score:");
2979 strcpy(menustring[4],temp);
2980 for(i=0;i<20;i++)if(menustring[4][i]=='\0')menustring[4][i]=' ';
2981 menustring[4][20]='\0';
2982 sprintf (temp, "%d",(int)accountcampaignscore[accountactive]);
2983 strcat(menustring[4],temp);
2985 endx[4]=startx[4]+strlen(menustring[4])*10;
2987 endy[4]=starty[4]+20;
2991 for(i=0;i<255;i++)menustring[5][i]='\0';
2992 sprintf (temp, "Your time:");
2993 strcpy(menustring[5],temp);
2994 for(i=0;i<20;i++)if(menustring[5][i]=='\0')menustring[5][i]=' ';
2995 menustring[5][20]='\0';
2996 sprintf (temp, "%d",(int)accountcampaigntime[accountactive]);
2997 strcat(menustring[5],temp);
2999 endx[5]=startx[5]+strlen(menustring[5])*10;
3001 endy[5]=starty[5]+20;
3005 for(i=0;i<255;i++)menustring[5][i]='\0';
3006 sprintf (temp, "Highest score:");
3007 strcpy(menustring[5],temp);
3008 for(i=0;i<20;i++)if(menustring[5][i]=='\0')menustring[5][i]=' ';
3009 menustring[5][20]='\0';
3010 sprintf (temp, "%d",(int)accountcampaignhighscore[accountactive]);
3011 strcat(menustring[5],temp);
3013 endx[5]=startx[5]+strlen(menustring[5])*10;
3015 endy[5]=starty[5]+20;
3019 for(i=0;i<255;i++)menustring[7][i]='\0';
3020 sprintf (temp, "Lowest time:");
3021 strcpy(menustring[7],temp);
3022 for(i=0;i<20;i++)if(menustring[7][i]=='\0')menustring[7][i]=' ';
3023 menustring[7][20]='\0';
3024 sprintf (temp, "%d",(int)accountcampaignfasttime[accountactive]);
3025 strcat(menustring[7],temp);
3027 endx[7]=startx[7]+strlen(menustring[7])*10;
3029 endy[7]=starty[7]+20;
3036 menupulse+=multiplier*2;
3041 sprintf (menustring[0], "Register now for only $19.95!");
3044 endx[0]=startx[0]+strlen(menustring[0])*10;
3045 endy[0]=starty[0]+20;
3049 sprintf (menustring[1], "Confront raiders, wolves, and more!");
3052 endx[1]=startx[1]+strlen(menustring[1])*10;
3053 endy[1]=starty[1]+20;
3057 sprintf (menustring[2], "Fight using swords, staves and armor!");
3060 endx[2]=startx[2]+strlen(menustring[2])*10;
3061 endy[2]=starty[2]+20;
3065 if(!tryquit)sprintf (menustring[3], "Back");
3066 else sprintf (menustring[3], "Quit");
3068 endx[3]=startx[3]+strlen(menustring[3])*10;
3070 endy[3]=starty[3]+20;
3074 sprintf (menustring[4], "Register now!");
3076 endx[4]=startx[4]+strlen(menustring[4])*10;
3078 endy[4]=starty[4]+20;
3082 sprintf (menustring[5], "Enter registration code!");
3084 endx[5]=startx[5]+strlen(menustring[5])*10;
3086 endy[5]=starty[5]+20;
3095 sprintf (menustring[0], "Thank you for supporting Wolfire Software!");
3098 endx[0]=startx[0]+strlen(menustring[0])*10;
3099 endy[0]=starty[0]+20;
3103 sprintf (menustring[1], "Back");
3105 endx[1]=startx[1]+strlen(menustring[1])*10;
3107 endy[1]=starty[1]+20;
3116 sprintf (menustring[0], "Sorry, that name/serial number combination is incorrect.");
3119 endx[0]=startx[0]+strlen(menustring[0])*10;
3120 endy[0]=starty[0]+20;
3124 sprintf (menustring[1], "Back");
3126 endx[1]=startx[1]+strlen(menustring[1])*10;
3128 endy[1]=starty[1]+20;
3132 sprintf (menustring[2], "Please make sure you are copying your name and serial");
3135 endx[2]=startx[2]+strlen(menustring[2])*10;
3136 endy[2]=starty[2]+20;
3140 sprintf (menustring[3], "number exactly as they appear in your email.");
3143 endx[3]=startx[3]+strlen(menustring[3])*10;
3144 endy[3]=starty[3]+20;
3148 sprintf (menustring[4], "Capitalization and punctuation matter!");
3151 endx[4]=startx[4]+strlen(menustring[4])*10;
3152 endy[4]=starty[4]+20;
3161 sprintf (menustring[0], "Please enter your name:");
3164 endx[0]=startx[0]+strlen(menustring[0])*10;
3165 endy[0]=starty[0]+20;
3169 sprintf (menustring[1], "Please enter your name:");
3172 endx[1]=startx[1]+strlen(menustring[1])*10;
3173 endy[1]=starty[1]+20;
3182 sprintf (menustring[0], "Please enter your number:");
3185 endx[0]=startx[0]+strlen(menustring[0])*10;
3186 endy[0]=starty[0]+20;
3190 sprintf (menustring[1], "Please enter your name:");
3193 endx[1]=startx[1]+strlen(menustring[1])*10;
3194 endy[1]=starty[1]+20;
3198 char tempstring[256];
3199 sprintf (tempstring, "%s", registrationname);
3205 longnum = MD5_string ( tempstring);
3206 //longnum = 1111111111111111;
3207 num1 = longnum/100000000;
3208 num2 = longnum%100000000;
3209 sprintf (tempstring, "%d-%d-%d-%d", num1/10000, num1%10000, num2/10000, num2%10000);
3211 sprintf (menustring[2], "%s", tempstring);
3214 endx[2]=startx[2]+strlen(menustring[2])*10;
3215 endy[2]=starty[2]+20;
3220 if(mainmenu==1||mainmenu==2){
3230 starty[1]=480-152-32;
3237 starty[2]=480-228-32;
3245 starty[3]=480-306-32;
3254 starty[3]=480-306-32;
3268 starty[4]=480-140-256;
3275 starty[5]=480-138-256;
3282 starty[6]=480-144-256;
3290 starty[4]=480-140-256;
3297 starty[5]=480-138-256;
3304 starty[6]=480-144-256;
3312 starty[4]=480-140-256;
3319 starty[5]=480-150-256;
3326 starty[6]=480-144-256;
3334 starty[4]=480-140-256;
3341 starty[5]=480-150-256;
3348 starty[6]=480-144-256;
3356 starty[4]=480-100-256;
3363 starty[5]=480-120-256;
3370 starty[6]=480-144-256;
3380 if(mainmenu==1||mainmenu==2)
3382 if((mousecoordh/screenwidth*640)>startx[i]&&(mousecoordh/screenwidth*640)<endx[i]&&480-(mousecoordv/screenheight*480)>starty[i]&&480-(mousecoordv/screenheight*480)<endy[i]){
3387 if(mainmenu==3||mainmenu==4||mainmenu==5||mainmenu==6||mainmenu==7||mainmenu==8||mainmenu==9||mainmenu==10||mainmenu==11||mainmenu==12||mainmenu==13||mainmenu==14||mainmenu==15||mainmenu==16||mainmenu==17)
3388 for(i=0;i<nummenuitems;i++){
3389 if((mousecoordh/screenwidth*640)>startx[i]&&(mousecoordh/screenwidth*640)<endx[i]&&480-(mousecoordv/screenheight*480)>starty[i]&&480-(mousecoordv/screenheight*480)<endy[i]){
3390 if(mainmenu!=5)selected=i;
3391 if(mainmenu==5&&(i!=0&&i!=6))selected=i;
3392 if(mainmenu==9&&(i!=numchallengelevels+1))selected=i;
3393 if(mainmenu==11&&(i!=numchallengelevels+1))selected=i;
3398 for(i=0;i<nummenuitems;i++){
3399 if(selected==i)selectedlong[i]+=multiplier*5;
3400 if(selectedlong[i]>1)selectedlong[i]=1;
3401 if(selected!=i)selectedlong[i]-=multiplier*5;
3402 if(selectedlong[i]<0)selectedlong[i]=0;
3403 //if(i>=4)selectedlong[i]=.3;
3404 if(i>=4&&(mainmenu==1||mainmenu==2))selectedlong[i]=0;
3408 for(i=0;i<nummenuitems;i++){
3409 offsetx[i]=(startx[i]+endx[i])/2-(mousecoordh/screenwidth*640);
3410 offsety[i]=(starty[i]+endy[i])/2-(480-(mousecoordv/screenheight*480));
3415 if(i>=4&&(mainmenu==1||mainmenu==2)){
3416 offsetx[i]=(startx[i]+endx[i]+movex[i]*transition)/2-(640+190)/2;
3417 offsety[i]=(starty[i]+endy[i]+movey[i]*transition)/2-(336+150)/2;
3423 if(mainmenu==1||mainmenu==2){
3424 glClear(GL_DEPTH_BUFFER_BIT);
3425 glEnable(GL_ALPHA_TEST);
3426 glAlphaFunc(GL_GREATER, 0.001f);
3427 glEnable(GL_TEXTURE_2D);
3428 glDisable(GL_DEPTH_TEST); // Disables Depth Testing
3429 glDisable(GL_CULL_FACE);
3430 glDisable(GL_LIGHTING);
3432 glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
3433 glPushMatrix(); // Store The Projection Matrix
3434 glLoadIdentity(); // Reset The Projection Matrix
3435 glOrtho(0,screenwidth,0,screenheight,-100,100); // Set Up An Ortho Screen
3436 glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
3437 glPushMatrix(); // Store The Modelview Matrix
3438 glLoadIdentity(); // Reset The Modelview Matrix
3439 glTranslatef(screenwidth/2,screenheight/2,0);
3441 glScalef((float)screenwidth/2,(float)screenheight/2,1);
3442 glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
3443 glDisable(GL_BLEND);
3444 glColor4f(0,0,0,1.0);
3445 glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP );
3446 glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP );
3447 glDisable(GL_TEXTURE_2D);
3449 //glScalef(.25,.25,.25);
3452 glVertex3f(-1, -1, 0.0f);
3454 glVertex3f(1, -1, 0.0f);
3456 glVertex3f(1, 1, 0.0f);
3458 glVertex3f(-1, 1, 0.0f);
3462 glColor4f(0.4,0.4,0.4,1.0);
3463 glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP );
3464 glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP );
3465 glEnable(GL_TEXTURE_2D);
3466 glBindTexture( GL_TEXTURE_2D, Mainmenuitems[4]);
3468 //glScalef(.25,.25,.25);
3471 glVertex3f(-1, -1, 0.0f);
3473 glVertex3f(1, -1, 0.0f);
3475 glVertex3f(1, 1, 0.0f);
3477 glVertex3f(-1, 1, 0.0f);
3482 glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
3485 glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
3486 glPushMatrix(); // Store The Projection Matrix
3487 glLoadIdentity(); // Reset The Projection Matrix
3488 glOrtho(0,640,0,480,-100,100); // Set Up An Ortho Screen
3489 glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
3490 glPushMatrix(); // Store The Modelview Matrix
3491 glLoadIdentity(); // Reset The Modelview Matrix
3493 glDisable(GL_TEXTURE_2D);
3498 if(anim!=1)glVertex3f(190, 150, 0.0f);
3499 if(anim==1)glVertex3f(190+movex[4]*transition, 150, 0.0f);
3501 glVertex3f(640, 150, 0.0f);
3503 glVertex3f(640, 336, 0.0f);
3505 if(anim!=1)glVertex3f(190, 336, 0.0f);
3506 if(anim==1)glVertex3f(190+movex[4]*transition, 336, 0.0f);
3511 glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
3513 glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
3517 glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
3518 glPushMatrix(); // Store The Projection Matrix
3519 glLoadIdentity(); // Reset The Projection Matrix
3520 glOrtho(0,640,0,480,-100,100); // Set Up An Ortho Screen
3521 glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
3522 glPushMatrix(); // Store The Modelview Matrix
3523 glLoadIdentity(); // Reset The Modelview Matrix
3524 glEnable(GL_TEXTURE_2D);
3527 for(j=0;j<nummenuitems;j++)
3529 if(j<=3||(mainmenu!=1&&mainmenu!=2))
3531 //glDisable(GL_BLEND);
3532 glEnable(GL_ALPHA_TEST);
3534 //glDisable(GL_ALPHA_TEST);
3535 glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
3536 if(mainmenu==1||mainmenu==2)
3539 glBlendFunc(GL_SRC_ALPHA,GL_ONE);
3540 glBindTexture( GL_TEXTURE_2D, Mainmenuitems[j]);
3541 glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE );
3542 glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE );
3543 glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
3547 glVertex3f(startx[j]+movex[j]*transition, starty[j]+movey[j]*transition, 0.0f);
3549 glVertex3f(endx[j]+movex[j]*transition, starty[j]+movey[j]*transition, 0.0f);
3551 glVertex3f(endx[j]+movex[j]*transition, endy[j]+movey[j]*transition, 0.0f);
3553 glVertex3f(startx[j]+movex[j]*transition, endy[j]+movey[j]*transition, 0.0f);
3557 //glDisable(GL_ALPHA_TEST);
3558 if(j<4)glBlendFunc(GL_SRC_ALPHA,GL_ONE);
3561 if(1-((float)i)/10-(1-selectedlong[j])>0)
3563 glColor4f(1,1,1,(1-((float)i)/10-(1-selectedlong[j]))*.25);
3564 glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
3568 glVertex3f(startx[j]-((float)i)*1/2+offsetx[j]*((float)i)/2+movex[j]*transition, starty[j]-((float)i)*1/2+offsety[j]*((float)i)/2+movey[j]*transition, 0.0f);
3570 glVertex3f(endx[j]+((float)i)*1/2+offsetx[j]*((float)i)/2+movex[j]*transition, starty[j]-((float)i)*1/2+offsety[j]*((float)i)/2+movey[j]*transition, 0.0f);
3572 glVertex3f(endx[j]+((float)i)*1/2+offsetx[j]*((float)i)/2+movex[j]*transition, endy[j]+((float)i)*1/2+offsety[j]*((float)i)/2+movey[j]*transition, 0.0f);
3574 glVertex3f(startx[j]-((float)i)*1/2+offsetx[j]*((float)i)/2+movex[j]*transition, endy[j]+((float)i)*1/2+offsety[j]*((float)i)/2+movey[j]*transition, 0.0f);
3580 if(mainmenu==3||mainmenu==4||mainmenu==5||mainmenu==6||mainmenu==7||mainmenu==8||mainmenu==9||mainmenu==10||mainmenu==11||mainmenu==12||mainmenu==13||mainmenu==14||mainmenu==15||mainmenu==16||mainmenu==17)
3582 if(mainmenu!=5||j<6)
3585 if(mainmenu==12&&j==4)glColor4f(1,(sin(menupulse)+1)/2,(sin(menupulse)+1)/2,1);
3586 if(mainmenu==9&&j>accountprogress[accountactive]&&j<numchallengelevels)glColor4f(0.5,0,0,1);
3587 if(mainmenu==11&&j>accountprogress[accountactive]&&j<numchallengelevels)glColor4f(0.5,0,0,1);
3588 //if(1-((float)i)/10-(1-selectedlong[j])>0){
3589 glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
3591 if((mainmenu!=7||j!=0||!entername)&&(mainmenu!=13||j!=1)&&(mainmenu!=14||j!=1))text.glPrint(startx[j],starty[j],menustring[j],0,1,640,480);
3595 sprintf (string, "_");
3596 text.glPrint(startx[j]+(float)(displayselected)*10,starty[j],string,0,1,640,480);
3599 for(l=0;l<displaychars[k];l++){
3600 if(l<displaychars[k]){
3601 sprintf (string, "%c",displaytext[k][l]);
3602 text.glPrint(startx[j]+l*10,starty[j],string,0,1,640,480);
3610 sprintf (string, "Hooo!");
3611 text.glPrint(startx[0],starty[0],string,0,1,640,480);
3615 glBlendFunc(GL_SRC_ALPHA,GL_ONE);
3618 if(1-((float)i)/15-(1-selectedlong[j])>0)
3620 glColor4f(1,0,0,(1-((float)i)/10-(1-selectedlong[j]))*.25);
3621 if(mainmenu==12&&j==4)glColor4f(1,(sin(menupulse)+1)/2,(sin(menupulse)+1)/2,(1-((float)i)/10-(1-selectedlong[j]))*.25);
3622 if(mainmenu==9&&j>accountprogress[accountactive]&&j<numchallengelevels)glColor4f(0.5,0,0,(1-((float)i)/10-(1-selectedlong[j]))*.25);
3623 if(mainmenu==11&&j>accountprogress[accountactive]&&j<numchallengelevels)glColor4f(0.5,0,0,(1-((float)i)/10-(1-selectedlong[j]))*.25);
3624 if(mainmenu==3)text.glPrint(startx[j]-((float)i)+offsetx[j]*((float)i)/4-((/*1*/+((float)i)/70)*strlen(menustring[j]))*3,starty[j]/*-i*1/2*/+offsety[j]*((float)i)/4,menustring[j],0,1+((float)i)/70,640,480);
3625 if(mainmenu==4)text.glPrint(startx[j]-((float)i)+offsetx[j]*((float)i)/4/*-((((float)i)/70)*strlen(menustring[j]))*3*/,starty[j]/*-i*1/2*/+offsety[j]*((float)i)/4,menustring[j],0,1+((float)i)/70,640,480);
3626 if(mainmenu==5)text.glPrint(startx[j]-((float)i)+offsetx[j]*((float)i)/4/*-((((float)i)/70)*strlen(menustring[j]))*3*/,starty[j]/*-i*1/2*/+offsety[j]*((float)i)/4,menustring[j],0,1+((float)i)/70,640,480);
3627 if(mainmenu==6)text.glPrint(startx[j]-((float)i)+offsetx[j]*((float)i)/4/*-((((float)i)/70)*strlen(menustring[j]))*3*/,starty[j]/*-i*1/2*/+offsety[j]*((float)i)/4,menustring[j],0,1+((float)i)/70,640,480);
3628 if(mainmenu==7&&(j!=0||!entername))text.glPrint(startx[j]-((float)i)+offsetx[j]*((float)i)/4/*-((((float)i)/70)*strlen(menustring[j]))*3*/,starty[j]/*-i*1/2*/+offsety[j]*((float)i)/4,menustring[j],0,1+((float)i)/70,640,480);
3629 if(mainmenu==8)text.glPrint(startx[j]-((float)i)+offsetx[j]*((float)i)/4/*-((((float)i)/70)*strlen(menustring[j]))*3*/,starty[j]/*-i*1/2*/+offsety[j]*((float)i)/4,menustring[j],0,1+((float)i)/70,640,480);
3630 if(mainmenu==9)text.glPrint(startx[j]-((float)i)+offsetx[j]*((float)i)/4/*-((((float)i)/70)*strlen(menustring[j]))*3*/,starty[j]/*-i*1/2*/+offsety[j]*((float)i)/4,menustring[j],0,1+((float)i)/70,640,480);
3631 if(mainmenu==11)text.glPrint(startx[j]-((float)i)+offsetx[j]*((float)i)/4/*-((((float)i)/70)*strlen(menustring[j]))*3*/,starty[j]/*-i*1/2*/+offsety[j]*((float)i)/4,menustring[j],0,1+((float)i)/70,640,480);
3632 if(mainmenu==10)text.glPrint(startx[j]-((float)i)+offsetx[j]*((float)i)/4/*-((((float)i)/70)*strlen(menustring[j]))*3*/,starty[j]/*-i*1/2*/+offsety[j]*((float)i)/4,menustring[j],0,1+((float)i)/70,640,480);
3633 if(mainmenu==12)text.glPrint(startx[j]-((float)i)+offsetx[j]*((float)i)/4/*-((((float)i)/70)*strlen(menustring[j]))*3*/,starty[j]/*-i*1/2*/+offsety[j]*((float)i)/4,menustring[j],0,1+((float)i)/70,640,480);
3634 if(mainmenu==15)text.glPrint(startx[j]-((float)i)+offsetx[j]*((float)i)/4/*-((((float)i)/70)*strlen(menustring[j]))*3*/,starty[j]/*-i*1/2*/+offsety[j]*((float)i)/4,menustring[j],0,1+((float)i)/70,640,480);
3635 if(mainmenu==16)text.glPrint(startx[j]-((float)i)+offsetx[j]*((float)i)/4/*-((((float)i)/70)*strlen(menustring[j]))*3*/,starty[j]/*-i*1/2*/+offsety[j]*((float)i)/4,menustring[j],0,1+((float)i)/70,640,480);
3636 if(mainmenu==17)text.glPrint(startx[j]-((float)i)+offsetx[j]*((float)i)/4/*-((((float)i)/70)*strlen(menustring[j]))*3*/,starty[j]/*-i*1/2*/+offsety[j]*((float)i)/4,menustring[j],0,1+((float)i)/70,640,480);
3637 if(mainmenu==13&&j!=1)text.glPrint(startx[j]-((float)i)+offsetx[j]*((float)i)/4/*-((((float)i)/70)*strlen(menustring[j]))*3*/,starty[j]/*-i*1/2*/+offsety[j]*((float)i)/4,menustring[j],0,1+((float)i)/70,640,480);
3638 if(mainmenu==14&&j!=1)text.glPrint(startx[j]-((float)i)+offsetx[j]*((float)i)/4/*-((((float)i)/70)*strlen(menustring[j]))*3*/,starty[j]/*-i*1/2*/+offsety[j]*((float)i)/4,menustring[j],0,1+((float)i)/70,640,480);
3641 sprintf (string, "_");
3642 text.glPrint(startx[j]-((float)i)+offsetx[j]*((float)i)/4+(float)(displayselected)*10*(1+((float)i)/70),starty[j]+offsety[j]*((float)i)/4,string,0,1+((float)i)/70,640,480);
3645 for(l=0;l<displaychars[k];l++){
3646 if(l<displaychars[k]){
3647 sprintf (string, "%c",displaytext[k][l]);
3648 text.glPrint(startx[j]-((float)k)+offsetx[j]*((float)k)/4+l*10*(1+((float)i)/70),starty[j]+offsety[j]*((float)i)/4,string,0,1+((float)i)/70,640,480);
3657 glClear(GL_DEPTH_BUFFER_BIT);
3658 glEnable(GL_ALPHA_TEST);
3659 glAlphaFunc(GL_GREATER, 0.001f);
3660 glEnable(GL_TEXTURE_2D);
3661 glDisable(GL_DEPTH_TEST); // Disables Depth Testing
3662 glDisable(GL_CULL_FACE);
3663 glDisable(GL_LIGHTING);
3664 if(j==6)glColor4f(1,1,1,1);
3665 else glColor4f(1,0,0,1);
3667 glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
3668 glPushMatrix(); // Store The Projection Matrix
3669 glLoadIdentity(); // Reset The Projection Matrix
3670 glOrtho(0,640,0,480,-100,100); // Set Up An Ortho Screen
3671 glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
3672 glPushMatrix(); // Store The Modelview Matrix
3673 glLoadIdentity(); // Reset The Modelview Matrix
3676 //Draw world, draw map
3677 glTranslatef(2,-5,0);
3679 if(j>6&&j<nummenuitems-1)
3681 XYZ linestart,lineend,offset;
3688 //float linestartx,lineendx,linestarty,lineendy,offsetx,offsety;
3689 linestart.x=(startx[j]+endx[j])/2;
3690 linestart.y=(starty[j]+endy[j])/2;
3691 if(j>=6+accountcampaignchoicesmade[accountactive]){
3692 linestart.x=(startx[6+accountcampaignchoicesmade[accountactive]]+endx[6+accountcampaignchoicesmade[accountactive]])/2;
3693 linestart.y=(starty[6+accountcampaignchoicesmade[accountactive]]+endy[6+accountcampaignchoicesmade[accountactive]])/2;
3695 lineend.x=(startx[j+1]+endx[j+1])/2;
3696 lineend.y=(starty[j+1]+endy[j+1])/2;
3697 offset=lineend-linestart;
3700 offset=DoRotation(offset,0,0,90);
3702 glDisable(GL_TEXTURE_2D);
3704 if(j<6+accountcampaignchoicesmade[accountactive]){
3705 glColor4f(0.5,0,0,1);
3709 if(j>=6+accountcampaignchoicesmade[accountactive]){
3715 linestart+=fac*4*startsize;
3716 lineend-=fac*4*endsize;
3718 if(!(j>7+accountcampaignchoicesmade[accountactive]+campaignchoicenum)){
3719 glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
3723 glVertex3f(linestart.x-offset.x*startsize, linestart.y-offset.y*startsize, 0.0f);
3725 glVertex3f(linestart.x+offset.x*startsize, linestart.y+offset.y*startsize, 0.0f);
3727 glVertex3f(lineend.x+offset.x*endsize, lineend.y+offset.y*endsize, 0.0f);
3729 glVertex3f(lineend.x-offset.x*endsize, lineend.y-offset.y*endsize, 0.0f);
3733 glEnable(GL_TEXTURE_2D);
3737 if(j==6)glBindTexture( GL_TEXTURE_2D, Mainmenuitems[7]);
3738 else glBindTexture( GL_TEXTURE_2D, Mapcircletexture);
3739 glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE );
3740 glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE );
3741 if(j-7<accountcampaignchoicesmade[accountactive])glColor4f(0.5,0,0,1);
3742 if(j-7>=accountcampaignchoicesmade[accountactive])glColor4f(1,0,0,1);
3743 if(j==6)glColor4f(1,1,1,1);
3746 itemsize=abs(startx[j]-endx[j])/2;
3748 midpoint.x=(startx[j]+endx[j])/2;
3749 midpoint.y=(starty[j]+endy[j])/2;
3750 if(j>6&&(j-7<accountcampaignchoicesmade[accountactive]))itemsize*=.5;
3751 if(!(j-7>accountcampaignchoicesmade[accountactive]+campaignchoicenum))
3753 glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
3757 glVertex3f(midpoint.x-itemsize+movex[j]*transition, midpoint.y-itemsize+movey[j]*transition, 0.0f);
3759 glVertex3f(midpoint.x+itemsize+movex[j]*transition, midpoint.y-itemsize+movey[j]*transition, 0.0f);
3761 glVertex3f(midpoint.x+itemsize+movex[j]*transition, midpoint.y+itemsize+movey[j]*transition, 0.0f);
3763 glVertex3f(midpoint.x-itemsize+movex[j]*transition, midpoint.y+itemsize+movey[j]*transition, 0.0f);
3767 //glDisable(GL_ALPHA_TEST);
3768 if(j<4)glBlendFunc(GL_SRC_ALPHA,GL_ONE);
3771 if(1-((float)i)/10-(1-selectedlong[j])>0)
3773 glColor4f(1,0,0,(1-((float)i)/10-(1-selectedlong[j]))*.25);
3774 glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
3778 glVertex3f(midpoint.x-itemsize-((float)i)*1/2+offsetx[j]*((float)i)/2+movex[j]*transition, midpoint.y-itemsize-((float)i)*1/2+offsety[j]*((float)i)/2+movey[j]*transition, 0.0f);
3780 glVertex3f(midpoint.x+itemsize+((float)i)*1/2+offsetx[j]*((float)i)/2+movex[j]*transition, midpoint.y-itemsize-((float)i)*1/2+offsety[j]*((float)i)/2+movey[j]*transition, 0.0f);
3782 glVertex3f(midpoint.x+itemsize+((float)i)*1/2+offsetx[j]*((float)i)/2+movex[j]*transition, midpoint.y+itemsize+((float)i)*1/2+offsety[j]*((float)i)/2+movey[j]*transition, 0.0f);
3784 glVertex3f(midpoint.x-itemsize-((float)i)*1/2+offsetx[j]*((float)i)/2+movex[j]*transition, midpoint.y+itemsize+((float)i)*1/2+offsety[j]*((float)i)/2+movey[j]*transition, 0.0f);
3792 glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
3794 glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
3796 if(j-7>=accountcampaignchoicesmade[accountactive]){
3797 //glColor4f(0,0,0,1);
3798 //text.glPrintOutline(startx[j]+10-1.5,starty[j]-4-1.5,menustring[j],0,0.6*1.25,640,480);
3799 //glColor4f(1,0,0,1);
3800 //text.glPrint(startx[j]+10,starty[j]-4,menustring[j],0,0.6,640,480);
3801 text.glPrintOutlined(0.9,0,0,startx[j]+10,starty[j]-4,menustring[j],0,0.6,640,480);
3802 glDisable(GL_DEPTH_TEST);
3809 glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
3811 glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
3814 if(mainmenu==1||mainmenu==2)
3815 if(transition<.1||transition>.9){
3816 glClear(GL_DEPTH_BUFFER_BIT);
3817 glEnable(GL_ALPHA_TEST);
3818 glAlphaFunc(GL_GREATER, 0.001f);
3819 glEnable(GL_TEXTURE_2D);
3820 glDisable(GL_DEPTH_TEST); // Disables Depth Testing
3821 glDisable(GL_CULL_FACE);
3822 glDisable(GL_LIGHTING);
3824 glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
3825 glPushMatrix(); // Store The Projection Matrix
3826 glLoadIdentity(); // Reset The Projection Matrix
3827 glOrtho(0,640,0,480,-100,100); // Set Up An Ortho Screen
3828 glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
3829 glPushMatrix(); // Store The Modelview Matrix
3830 glLoadIdentity(); // Reset The Modelview Matrix
3832 glDisable(GL_TEXTURE_2D);
3833 if(transition<.1)glColor4f(1,0,0,1-(transition*10));
3834 if(transition>.9)glColor4f(1,0,0,1-((1-transition)*10));
3838 glVertex3f(190, 150, 0.0f);
3840 glVertex3f(640, 150, 0.0f);
3842 glVertex3f(640, 336, 0.0f);
3844 glVertex3f(190, 336, 0.0f);
3849 glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
3853 glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
3854 glPushMatrix(); // Store The Projection Matrix
3855 glLoadIdentity(); // Reset The Projection Matrix
3856 glOrtho(0,screenwidth,0,screenheight,-100,100); // Set Up An Ortho Screen
3857 glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
3858 glPushMatrix(); // Store The Modelview Matrix
3859 glLoadIdentity(); // Reset The Modelview Matrix
3860 glTranslatef(screenwidth/2,screenheight/2,0);
3862 glScalef((float)screenwidth/2,(float)screenheight/2,1);
3863 glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
3865 glEnable(GL_TEXTURE_2D);
3867 glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP );
3868 glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP );
3871 glTranslatef(mousecoordh-screenwidth/2,mousecoordv*-1+screenheight/2,0);
3872 glScalef((float)screenwidth/64,(float)screenwidth/64,1);
3873 glTranslatef(1,-1,0);
3874 glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
3876 glBindTexture( GL_TEXTURE_2D, cursortexture);
3878 //glScalef(.25,.25,.25);
3881 glVertex3f(-1, -1, 0.0f);
3883 glVertex3f(1, -1, 0.0f);
3885 glVertex3f(1, 1, 0.0f);
3887 glVertex3f(-1, 1, 0.0f);
3892 glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
3898 if(flashamount>1)flashamount=1;
3899 if(flashdelay<=0)flashamount-=multiplier;
3901 if(flashamount<0)flashamount=0;
3902 glDisable(GL_DEPTH_TEST); // Disables Depth Testing
3903 glDisable(GL_CULL_FACE);
3904 glDisable(GL_LIGHTING);
3905 glDisable(GL_TEXTURE_2D);
3907 glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
3908 glPushMatrix(); // Store The Projection Matrix
3909 glLoadIdentity(); // Reset The Projection Matrix
3910 glOrtho(0,screenwidth,0,screenheight,-100,100); // Set Up An Ortho Screen
3911 glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
3912 glPushMatrix(); // Store The Modelview Matrix
3913 glLoadIdentity(); // Reset The Modelview Matrix
3914 glScalef(screenwidth,screenheight,1);
3915 glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
3917 glColor4f(flashr,flashg,flashb,flashamount);
3919 glVertex3f(0, 0, 0.0f);
3920 glVertex3f(256, 0, 0.0f);
3921 glVertex3f(256, 256, 0.0f);
3922 glVertex3f(0, 256, 0.0f);
3924 glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
3925 glPopMatrix(); // Restore The Old Projection Matrix
3926 glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
3927 glPopMatrix(); // Restore The Old Projection Matrix
3928 glEnable(GL_DEPTH_TEST); // Enables Depth Testing
3929 glEnable(GL_CULL_FACE);
3930 glDisable(GL_BLEND);
3935 if(freeze||winfreeze||(mainmenu&&gameon)||(!gameon&&gamestarted)||(!gameon&&gamestarted)){
3936 tempmult=multiplier;
3942 if(drawmode!=motionblurmode||mainmenu){
3944 // this prevents menus from rendering if you hit ESC during
3945 // motion blur sequences...maybe SDL is buffering differently?
3946 if(drawmode!=motionblurmode)
3953 //myassert(glGetError() == GL_NO_ERROR);
3954 glDrawBuffer(GL_BACK);
3955 glReadBuffer(GL_BACK);
3960 if(drawtoggle==2)drawtoggle=0;
3962 if(freeze||winfreeze||(mainmenu&&gameon)||(!gameon&&gamestarted)){
3963 multiplier=tempmult;
3965 //Jordan fixed your warning!