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;
19 extern AGLContext gaglContext;
21 extern int kTextureSize;
22 extern FRUSTUM frustum;
24 extern Objects objects;
26 extern float usermousesensitivity;
28 extern float camerashake;
29 extern Weapons weapons;
30 extern Person player[maxplayers];
32 extern float slomodelay;
33 extern bool ismotionblur;
35 extern float blackout;
36 extern bool damageeffects;
38 extern int numplayers;
39 extern bool texttoggle;
40 extern float blurness;
41 extern float targetblurness;
42 extern float playerdist;
43 extern bool cellophane;
45 extern float flashamount,flashr,flashg,flashb;
46 extern int flashdelay;
48 extern float motionbluramount;
50 extern bool alwaysblur;
52 extern bool tilt2weird;
53 extern bool tiltweird;
55 extern bool proportionweird;
56 extern bool vertexweird[6];
57 extern bool velocityblur;
58 extern bool buttons[3];
59 extern bool debugmode;
61 extern int oldmainmenu;
62 extern int bloodtoggle;
63 extern int difficulty;
66 //extern int texdetail;
67 extern float texdetail;
68 extern bool musictoggle;
70 extern float bonusvalue;
71 extern float bonustotal;
72 extern float bonustime;
74 extern float startbonustotal;
75 extern float bonusnum[100];
76 extern int tutoriallevel;
77 extern float smoketex;
78 extern float tutorialstagetime;
79 extern float tutorialmaxtime;
80 extern int tutorialstage;
81 extern bool againbonus;
82 extern float damagedealt;
83 extern float damagetaken;
84 extern bool invertmouse;
86 extern int numhotspots;
87 extern int winhotspot;
88 extern int killhotspot;
89 extern XYZ hotspot[40];
90 extern int hotspottype[40];
91 extern float hotspotsize[40];
92 extern char hotspottext[40][256];
93 extern int currenthotspot;
95 extern int numaccounts;
96 extern int accountactive;
97 extern int accountdifficulty[10];
98 extern int accountprogress[10];
99 extern float accountpoints[10];
100 extern float accounthighscore[10][50];
101 extern float accountfasttime[10][50];
102 extern bool accountunlocked[10][60];
103 extern char accountname[10][256];
106 extern int numflipfail;
108 extern int numstaffattack;
109 extern int numswordattack;
110 extern int numknifeattack;
111 extern int numunarmedattack;
112 extern int numescaped;
113 extern int numflipped;
114 extern int numwallflipped;
115 extern int numthrowkill;
116 extern int numafterkill;
117 extern int numreversals;
118 extern int numattacks;
119 extern int maxalarmed;
120 extern int numresponded;
122 extern bool campaign;
123 extern bool winfreeze;
125 extern float menupulse;
127 extern bool gamestart;
129 extern int numdialogues;
130 extern int numdialogueboxes[max_dialogues];
131 extern int dialoguetype[max_dialogues];
132 extern int dialogueboxlocation[max_dialogues][max_dialoguelength];
133 extern float dialogueboxcolor[max_dialogues][max_dialoguelength][3];
134 extern int dialogueboxsound[max_dialogues][max_dialoguelength];
135 extern char dialoguetext[max_dialogues][max_dialoguelength][128];
136 extern char dialoguename[max_dialogues][max_dialoguelength][64];
137 extern XYZ dialoguecamera[max_dialogues][max_dialoguelength];
138 extern XYZ participantlocation[max_dialogues][10];
139 extern int participantfocus[max_dialogues][max_dialoguelength];
140 extern int participantaction[max_dialogues][max_dialoguelength];
141 extern float participantrotation[max_dialogues][10];
142 extern XYZ participantfacing[max_dialogues][max_dialoguelength][10];
143 extern float dialoguecamerarotation[max_dialogues][max_dialoguelength];
144 extern float dialoguecamerarotation2[max_dialogues][max_dialoguelength];
145 extern int indialogue;
146 extern int whichdialogue;
147 extern int directing;
148 extern float dialoguetime;
149 extern int dialoguegonethrough[20];
151 extern int accountcampaignchoicesmade[10];
152 extern int accountcampaignchoices[10][5000];
154 extern float accountcampaignhighscore[10];
155 extern float accountcampaignfasttime[10];
156 extern float accountcampaignscore[10];
157 extern float accountcampaigntime[10];
159 extern bool gamestarted;
161 extern FSOUND_SAMPLE *samp[100];
162 extern int channels[100];
163 extern "C" void PlaySoundEx(int channel, FSOUND_SAMPLE *sptr, FSOUND_DSPUNIT *dsp, signed char startpaused);
165 /*********************> DrawGLScene() <*****/
166 long long Game::MD5_string (char *string){
171 sprintf (temp, "%s",string);
174 while (i<256&&temp[i]!='\0'){
175 if(temp[i]%3==0)num+=temp[i]*124;
176 else if(temp[i]%3==1)num-=temp[i]*temp[i];
184 while(num<5000000000000000){
188 while(num>9900000000000000){
194 //return 1111111111111111;
197 int Game::DrawGLScene(GLvoid)
199 static float texcoordwidth,texcoordheight;
200 static float texviewwidth, texviewheight;
202 static GLubyte color;
203 static float newbrightness;
204 static float changespeed;
205 static XYZ checkpoint;
206 static float tempmult;
208 static char string[256]="";
209 static char string2[256]="";
210 static char string3[256]="";
212 static float lastcheck;
214 lastcheck+=multiplier;
216 glColorMask( 1.0, 1.0, 1.0, 1.0 );
217 if(!registered)debugmode=0;
220 if(freeze||winfreeze||(mainmenu&&gameon)||(!gameon&&gamestarted)){
227 numboundaries=mapradius*2;
228 if(numboundaries>360)numboundaries=360;
229 for(i=0;i<numboundaries;i++){
232 boundary[i]=mapcenter+DoRotation(boundary[i]*mapradius,0,i*(360/((float)(numboundaries))),0);
241 olddrawmode=drawmode;
242 if(ismotionblur&&!loading){
243 if((findLengthfast(&player[0].velocity)>200)&&velocityblur&&!cameramode){
244 drawmode=motionblurmode;
245 motionbluramount=200/(findLengthfast(&player[0].velocity));
248 if(player[0].damage-player[0].superpermanentdamage>(player[0].damagetolerance-player[0].superpermanentdamage)*1/2&&damageeffects&&!cameramode){
249 drawmode=doublevisionmode;
256 drawmode=motionblurmode;
258 slomodelay-=multiplier;
259 if(slomodelay<0)slomo=0;
263 if((!changed&&!slomo)||loading){
265 if(ismotionblur&&(/*fps>100||*/alwaysblur)){
266 if(olddrawmode!=realmotionblurmode)change=1;
268 drawmode=realmotionblurmode;
270 else if(olddrawmode==realmotionblurmode)change=2;
274 if(freeze||winfreeze||(mainmenu&&gameon)||(!gameon&&gamestarted))drawmode=normalmode;
275 if((freeze||winfreeze)&&ismotionblur&&!mainmenu)drawmode=radialzoommode;
277 if(winfreeze||mainmenu)drawmode=normalmode;
280 if(drawmode==glowmode){
286 DSpContext_FadeGamma(NULL,200,&color2);
290 if(drawtoggle!=2)drawtoggle=1-drawtoggle;
294 texviewwidth=kTextureSize;
295 if(texviewwidth>screenwidth)texviewwidth=screenwidth;
296 texviewheight=kTextureSize;
297 if(texviewheight>screenheight)texviewheight=screenheight;
299 texcoordwidth=screenwidth/kTextureSize;
300 texcoordheight=screenheight/kTextureSize;
301 if(texcoordwidth>1)texcoordwidth=1;
302 if(texcoordheight>1)texcoordheight=1;
305 glDrawBuffer(GL_BACK);
306 glReadBuffer(GL_BACK);
308 /*if(environment==desertenvironment)glTexEnvf( GL_TEXTURE_FILTER_CONTROL_EXT, GL_TEXTURE_LOD_BIAS_EXT, (float)(abs(Random()%100))/50 );
309 else glTexEnvf( GL_TEXTURE_FILTER_CONTROL_EXT, GL_TEXTURE_LOD_BIAS_EXT, 0);
311 if(abs(blurness-targetblurness)<multiplier*10||abs(blurness-targetblurness)>2){
312 blurness=targetblurness;
313 targetblurness=(float)(abs(Random()%100))/40;
315 if(blurness<targetblurness)blurness+=multiplier*5;
316 if(blurness>targetblurness)blurness-=multiplier*5;
319 static XYZ terrainlight;
320 static float distance;
321 //if(drawmode==normalmode)ReSizeGLScene(90,.1);
322 if(drawmode==normalmode)ReSizeGLScene(90,.1f);
323 if(drawmode!=normalmode)glViewport(0,0,texviewwidth,texviewheight);
324 glDepthFunc(GL_LEQUAL);
326 glAlphaFunc(GL_GREATER, 0.0001f);
327 glEnable(GL_ALPHA_TEST);
328 glClearColor(0.25f, 0.25f, 0.25f, 1.0f);
329 glClear(GL_DEPTH_BUFFER_BIT);
331 glMatrixMode (GL_MODELVIEW);
332 glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
334 if(!cameramode&&!freeze&&!winfreeze){
335 glRotatef(float(Random()%100)/10*camerashake/*+(woozy*woozy)/10*/,0,0,1);
336 glRotatef(rotation2+sin(woozy/2)*(player[0].damage/player[0].damagetolerance)*5,1,0,0);
337 glRotatef(rotation+sin(woozy)*(player[0].damage/player[0].damagetolerance)*5,0,1,0);
339 if(cameramode||freeze||winfreeze){
340 //glRotatef(float(Random()%100)/10*camerashake/*+(woozy*woozy)/10*/,0,0,1);
341 glRotatef(rotation2,1,0,0);
342 glRotatef(rotation,0,1,0);
345 if(environment==desertenvironment){
346 glRotatef((float)(abs(Random()%100))/3000-1,1,0,0);
347 glRotatef((float)(abs(Random()%100))/3000-1,0,1,0);
348 //glRotatef(blurness/40-1,1,0,0);
349 //glRotatef(blurness/40-1,0,1,0);
351 SetUpLight(&light,0);
353 if(environment==desertenvironment&&detail==2)glTexEnvf( GL_TEXTURE_FILTER_CONTROL_EXT, GL_TEXTURE_LOD_BIAS_EXT, blurness+.4 );
354 if(environment==desertenvironment){
355 glRotatef((float)(abs(Random()%100))/1000,1,0,0);
356 glRotatef((float)(abs(Random()%100))/1000,0,1,0);
359 glTexEnvf( GL_TEXTURE_FILTER_CONTROL_EXT, GL_TEXTURE_LOD_BIAS_EXT, 0);
361 glTranslatef(-viewer.x,-viewer.y,-viewer.z);
362 frustum.GetFrustum();
366 static float size,opacity,rotation;
368 for(k=0;k<numplayers;k++){
369 if(!player[k].skeleton.free&&player[k].playerdetail&&player[k].howactive<typesleeping)
370 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)
371 for(i=0;i<player[k].skeleton.num_joints;i++){
372 if(player[k].skeleton.joints[i].label==leftknee||player[k].skeleton.joints[i].label==rightknee||player[k].skeleton.joints[i].label==groin){
373 point=DoRotation(player[k].skeleton.joints[i].position,0,player[k].rotation,0)*player[k].scale+player[k].coords;
375 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;
376 if(k!=0&&tutoriallevel==1){
377 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;
379 terrain.MakeDecal(shadowdecal,point,size,opacity,rotation);
380 if(terrain.patchobjectnum[player[k].whichpatchx][player[k].whichpatchz])
381 for(l=0;l<terrain.patchobjectnum[player[k].whichpatchx][player[k].whichpatchz];l++){
382 j=terrain.patchobjects[player[k].whichpatchx][player[k].whichpatchz][l];
383 if(objects.position[j].y<player[k].coords.y||objects.type[j]==tunneltype||objects.type[j]==weirdtype){
384 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);
387 if(k!=0&&tutoriallevel==1){
388 opacity=.2+.2*sin(smoketex*6+i);
390 objects.model[j].MakeDecal(shadowdecal,&point,&size,&opacity,&rotation);
395 if((player[k].skeleton.free||player[k].howactive>=typesleeping)&&player[k].playerdetail)
396 if(frustum.SphereInFrustum(player[k].coords.x,player[k].coords.y,player[k].coords.z,player[k].scale*5)&&player[k].occluded<25)
397 for(i=0;i<player[k].skeleton.num_joints;i++){
398 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){
399 if(player[k].skeleton.free)point=player[k].skeleton.joints[i].position*player[k].scale+player[k].coords;
400 else point=DoRotation(player[k].skeleton.joints[i].position,0,player[k].rotation,0)*player[k].scale+player[k].coords;
402 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;
403 if(k!=0&&tutoriallevel==1){
404 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;
406 terrain.MakeDecal(shadowdecal,point,size,opacity*.7,rotation);
407 if(terrain.patchobjectnum[player[k].whichpatchx][player[k].whichpatchz])
408 for(l=0;l<terrain.patchobjectnum[player[k].whichpatchx][player[k].whichpatchz];l++){
409 j=terrain.patchobjects[player[k].whichpatchx][player[k].whichpatchz][l];
410 if(objects.position[j].y<player[k].coords.y||objects.type[j]==tunneltype||objects.type[j]==weirdtype){
411 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);
412 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);
415 if(k!=0&&tutoriallevel==1){
416 opacity=.2+.2*sin(smoketex*6+i);
418 objects.model[j].MakeDecal(shadowdecal,&point,&size,&opacity,&rotation);
424 if(!player[k].playerdetail)
425 if(frustum.SphereInFrustum(player[k].coords.x,player[k].coords.y,player[k].coords.z,player[k].scale*5))
427 point=player[k].coords;
429 opacity=.4-(player[k].coords.y-terrain.getHeight(player[k].coords.x,player[k].coords.z))/5;
430 terrain.MakeDecal(shadowdecal,point,size,opacity*.7,rotation);
431 if(terrain.patchobjectnum[player[k].whichpatchx][player[k].whichpatchz])
432 for(l=0;l<terrain.patchobjectnum[player[k].whichpatchx][player[k].whichpatchz];l++){
433 j=terrain.patchobjects[player[k].whichpatchx][player[k].whichpatchz][l];
434 point=DoRotation(player[k].coords-objects.position[j],0,-objects.rotation[j],0);
437 objects.model[j].MakeDecal(shadowdecal,&point,&size,&opacity,&rotation);
443 glEnable(GL_TEXTURE_2D);
445 glEnable(GL_DEPTH_TEST);
446 glEnable(GL_CULL_FACE);
448 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
449 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
450 glBindTexture( GL_TEXTURE_2D, terraintexture);
452 glBindTexture( GL_TEXTURE_2D, terraintexture2);
454 //glBindTexture( GL_TEXTURE_2D, terraintexture3);
455 //glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
458 terrain.drawdecals();
461 glEnable(GL_CULL_FACE);
462 glEnable(GL_LIGHTING);
464 glEnable(GL_TEXTURE_2D);
467 glEnable(GL_COLOR_MATERIAL);
482 glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
483 glEnable(GL_CULL_FACE);
484 glCullFace(GL_FRONT);
486 for(k=0;k<numplayers;k++){
487 if(k==0||tutoriallevel!=1){
489 glEnable(GL_LIGHTING);
490 terrainlight=terrain.getLighting(player[k].coords.x,player[k].coords.z);
491 distance=findDistancefast(&viewer,&player[k].coords);
492 distance=(viewdistance*viewdistance-(distance-(viewdistance*viewdistance*fadestart))*(1/(1-fadestart)))/viewdistance/viewdistance;
493 glColor4f(terrainlight.x,terrainlight.y,terrainlight.z,distance);
494 if(distance>=1)glDisable(GL_BLEND);
496 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;
498 if(!player[k].occluded==0)i=checkcollide(viewer,checkpoint,player[k].lastoccluded);
499 if(i==-1||player[k].occluded==0)i=checkcollide(viewer,checkpoint);
501 player[k].occluded+=1;
502 player[k].lastoccluded=i;
504 else player[k].occluded=0;
505 if(player[k].occluded<25)player[k].DrawSkeleton();
511 if(!cameramode&&musictype==stream_music2)playerdist=findDistancefastflat(&player[0].coords,&viewer);
512 else playerdist=-100;
515 glEnable(GL_TEXTURE_2D);
520 if(frustum.SphereInFrustum(realhawkcoords.x+hawk.boundingspherecenter.x,realhawkcoords.y+hawk.boundingspherecenter.y,realhawkcoords.z+hawk.boundingspherecenter.z,2)){
521 glAlphaFunc(GL_GREATER, 0.0001f);
523 glDisable(GL_CULL_FACE);
524 glDisable(GL_LIGHTING);
526 glTranslatef(hawkcoords.x,hawkcoords.y,hawkcoords.z);
527 glRotatef(hawkrotation,0,1,0);
528 glTranslatef(25,0,0);
529 distance=findDistancefast(&viewer,&realhawkcoords)*1.2;
530 glColor4f(light.color[0],light.color[1],light.color[2],(viewdistance*viewdistance-(distance-(viewdistance*viewdistance*fadestart))*(1/(1-fadestart)))/viewdistance/viewdistance);
531 if((viewdistance*viewdistance-(distance-(viewdistance*viewdistance*fadestart))*(1/(1-fadestart)))/viewdistance/viewdistance>1)glColor4f(light.color[0],light.color[1],light.color[2],1);
532 if((viewdistance*viewdistance-(distance-(viewdistance*viewdistance*fadestart))*(1/(1-fadestart)))/viewdistance/viewdistance>0)
533 hawk.drawdifftex(hawktexture);
538 /*glEnable(GL_CULL_FACE);
539 glCullFace(GL_FRONT);
541 for(k=0;k<numplayers;k++){
543 glEnable(GL_LIGHTING);
544 terrainlight=terrain.getLighting(player[k].coords.x,player[k].coords.z);
545 distance=findDistancefast(&viewer,&player[k].coords);
546 distance=(viewdistance*viewdistance-(distance-(viewdistance*viewdistance*fadestart))*(1/(1-fadestart)))/viewdistance/viewdistance;
547 glColor4f(terrainlight.x,terrainlight.y,terrainlight.z,distance);
548 if(distance>=1)glDisable(GL_BLEND);
550 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;
552 if(checkcollide(viewer,checkpoint)){
553 player[k].occluded+=1;
555 else player[k].occluded=0;
556 if(player[k].occluded<25)player[k].DrawSkeleton();
560 glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
561 glEnable(GL_CULL_FACE);
562 glCullFace(GL_FRONT);
564 for(k=0;k<numplayers;k++){
565 if(!(k==0||tutoriallevel!=1)){
567 glEnable(GL_LIGHTING);
568 terrainlight=terrain.getLighting(player[k].coords.x,player[k].coords.z);
569 distance=findDistancefast(&viewer,&player[k].coords);
570 distance=(viewdistance*viewdistance-(distance-(viewdistance*viewdistance*fadestart))*(1/(1-fadestart)))/viewdistance/viewdistance;
571 glColor4f(terrainlight.x,terrainlight.y,terrainlight.z,distance);
572 if(distance>=1)glDisable(GL_BLEND);
574 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;
576 if(!player[k].occluded==0)i=checkcollide(viewer,checkpoint,player[k].lastoccluded);
577 if(i==-1||player[k].occluded==0)i=checkcollide(viewer,checkpoint);
579 player[k].occluded+=1;
580 player[k].lastoccluded=i;
582 else player[k].occluded=0;
583 if(player[k].occluded<25)player[k].DrawSkeleton();
590 glEnable(GL_TEXTURE_2D);
595 glDisable(GL_COLOR_MATERIAL);
597 glDisable(GL_LIGHTING);
598 glDisable(GL_TEXTURE_2D);
606 glDisable(GL_LIGHTING);
607 glDisable(GL_TEXTURE_2D);
608 glDisable(GL_COLOR_MATERIAL);
611 for(k=0;k<numplayers;k++){
612 if(player[k].numwaypoints>1){
613 glBegin(GL_LINE_LOOP);
614 for(i=0;i<player[k].numwaypoints;i++){
615 glVertex3f(player[k].waypoints[i].x,player[k].waypoints[i].y+.5,player[k].waypoints[i].z);
624 for(k=0;k<numpathpoints;k++){
625 if(numpathpointconnect[k]){
626 for(i=0;i<numpathpointconnect[k];i++){
627 glBegin(GL_LINE_LOOP);
628 glVertex3f(pathpoint[k].x,pathpoint[k].y+.5,pathpoint[k].z);
629 glVertex3f(pathpoint[pathpointconnect[k][i]].x,pathpoint[pathpointconnect[k][i]].y+.5,pathpoint[pathpointconnect[k][i]].z);
637 glVertex3f(pathpoint[pathpointselected].x,pathpoint[pathpointselected].y+.5,pathpoint[pathpointselected].z);
644 glEnable(GL_TEXTURE_2D);
645 glColor4f(.5,.5,.5,1);
647 sprintf (string, " ",(int)(fps));
648 text.glPrint(10,30,string,0,.8,screenwidth,screenheight);
651 if(bonus>0&&bonustime<1&&!winfreeze&&indialogue==-1/*bonustime<4*/){
652 if(bonus==tracheotomy)sprintf (string, "Tracheotomy!");
653 else if(bonus==backstab)sprintf (string, "Backstabber!");
654 else if(bonus==spinecrusher)sprintf (string, "Spinecrusher!");
655 else if(bonus==ninja)sprintf (string, "Ninja Bonus!");
656 else if(bonus==style)sprintf (string, "Style Bonus!");
657 else if(bonus==cannon)sprintf (string, "Leg Cannon!");
658 else if(bonus==aimbonus)sprintf (string, "Nice Aim!");
659 else if(bonus==deepimpact)sprintf (string, "Heavy Impact!");
660 else if(bonus==touchofdeath)sprintf (string, "Touch of Death!");
661 else if(bonus==swordreversebonus)sprintf (string, "Sword Disarm!");
662 else if(bonus==staffreversebonus)sprintf (string, "Staff Disarm!");
663 else if(bonus==reverseko)sprintf (string, "Reversal KO!");
664 else if(bonus==solidhit)sprintf (string, "Solid Hit!");
665 else if(bonus==twoxcombo)sprintf (string, "2X Combo!");
666 else if(bonus==threexcombo)sprintf (string, "3X Combo!");
667 else if(bonus==fourxcombo)sprintf (string, "4X COMBO!");
668 else if(bonus==megacombo)sprintf (string, "MEGA COMBO!");
669 else if(bonus==Reversal)sprintf (string, "Reversal!");
670 else if(bonus==Stabbonus)sprintf (string, "Punctured!");
671 else if(bonus==Slicebonus)sprintf (string, "Sliced!");
672 else if(bonus==Bullseyebonus)sprintf (string, "Bullseye!");
673 else if(bonus==Slashbonus)sprintf (string, "Slashed!");
674 else if(bonus==Wolfbonus)sprintf (string, "WOLF SLAYER!");
675 else if(bonus==FinishedBonus)sprintf (string, "SLAIN!");
676 else if(bonus==TackleBonus)sprintf (string, "Tackle!");
677 else if(bonus==AboveBonus)sprintf (string, "Death from Above!");
678 else sprintf (string, "Excellent!");
680 glColor4f(0,0,0,1-bonustime);
681 text.glPrintOutline(1024/2-10*strlen(string)-4,768/16-4+768*4/5,string,1,2.5,1024,768);
682 glColor4f(1,0,0,1-bonustime);
683 text.glPrint(1024/2-10*strlen(string),768/16+768*4/5,string,1,2,1024,768);
685 sprintf (string, "%d",(int)bonusvalue);
686 glColor4f(0,0,0,1-bonustime);
687 text.glPrintOutline(1024/2-10*strlen(string)-4,768/16-4-20+768*4/5,string,1,2.5*.8,1024,768);
688 glColor4f(1,0,0,1-bonustime);
689 text.glPrint(1024/2-10*strlen(string),768/16-20+768*4/5,string,1,2*.8,1024,768);
690 glColor4f(.5,.5,.5,1);
693 if(tutoriallevel==1){
694 tutorialopac=tutorialmaxtime-tutorialstagetime;
695 if(tutorialopac>1)tutorialopac=1;
696 if(tutorialopac<0)tutorialopac=0;
698 sprintf (string, " ");
699 sprintf (string2, " ");
700 sprintf (string3, " ");
701 if(tutorialstage==0){
702 sprintf (string, " ");
703 sprintf (string2, " ");
704 sprintf (string3, " ");
706 if(tutorialstage==1){
707 sprintf (string, "Welcome to the Lugaru training level!");
708 sprintf (string2, " ");
709 sprintf (string3, " ");
711 if(tutorialstage==2){
712 sprintf (string, "BASIC MOVEMENT:");
713 sprintf (string2, " ");
714 sprintf (string3, " ");
716 if(tutorialstage==3){
717 sprintf (string, "You can move the mouse to rotate the camera.");
718 sprintf (string2, " ");
719 sprintf (string3, " ");
721 if(tutorialstage==4){
722 sprintf (string, "Try using the %s, %s, %s and %s keys to move around.",KeyToChar(forwardkey),KeyToChar(leftkey),KeyToChar(backkey),KeyToChar(rightkey));
723 sprintf (string2, "All movement is relative to the camera.");
724 sprintf (string3, " ");
726 if(tutorialstage==5){
727 sprintf (string, "Please press %s to jump.",KeyToChar(jumpkey));
728 sprintf (string2, "You can hold it longer to jump higher.");
729 sprintf (string3, " ");
731 if(tutorialstage==6){
732 sprintf (string, "You can press %s to crouch.",KeyToChar(crouchkey));
733 sprintf (string2, "You can jump higher from a crouching position.");
734 sprintf (string3, " ");
736 if(tutorialstage==7){
737 sprintf (string, "While running, you can press %s to roll.",KeyToChar(crouchkey));
738 sprintf (string2, " ");
739 sprintf (string3, " ");
741 if(tutorialstage==8){
742 sprintf (string, "While crouching, you can sneak around silently");
743 sprintf (string2, "using the movement keys.");
744 sprintf (string3, " ");
746 if(tutorialstage==9){
747 sprintf (string, "Release the crouch key while sneaking and hold the movement keys");
748 sprintf (string2, "to run animal-style.");
749 sprintf (string3, " ");
751 if(tutorialstage==10){
752 sprintf (string, "ADVANCED MOVEMENT:");
753 sprintf (string2, " ");
754 sprintf (string3, " ");
756 if(tutorialstage==11){
757 sprintf (string, "When you jump at a wall, you can hold %s again",KeyToChar(jumpkey));
758 sprintf (string2, "during impact to perform a walljump.");
759 sprintf (string3, "Be sure to use the movement keys to press against the wall");
761 if(tutorialstage==12){
762 sprintf (string, "While in the air, you can press crouch to flip.",KeyToChar(jumpkey));
763 sprintf (string2, "Walljumps and flips confuse enemies and give you more control.");
764 sprintf (string3, " ");
766 if(tutorialstage==13){
767 sprintf (string, "BASIC COMBAT:");
768 sprintf (string2, " ");
769 sprintf (string3, " ");
771 if(tutorialstage==14){
772 sprintf (string, "There is now an imaginary enemy");
773 sprintf (string2, "in the middle of the training area.");
774 sprintf (string3, " ");
776 if(tutorialstage==15){
777 if(attackkey==MAC_MOUSEBUTTON1)sprintf (string, "Click to attack when you are near an enemy.");
778 else sprintf (string, "Press %s to attack when you are near an enemy.",KeyToChar(attackkey));
779 sprintf (string2, "You can punch by standing still near an enemy and attacking.");
780 sprintf (string3, " ");
782 if(tutorialstage==16){
783 sprintf (string, "If you are close, you will perform a weak punch.");
784 sprintf (string2, "The weak punch is excellent for starting attack combinations.");
785 sprintf (string3, " ");
787 if(tutorialstage==17){
788 sprintf (string, "Attacking while running results in a spin kick.");
789 sprintf (string2, "This is one of your most powerful ground attacks.");
790 sprintf (string3, " ");
792 if(tutorialstage==18){
793 sprintf (string, "Sweep the enemy's legs out by attacking while crouched.");
794 sprintf (string2, "This is a very fast attack, and easy to follow up.");
795 sprintf (string3, " ");
797 if(tutorialstage==19){
798 sprintf (string, "When an enemy is on the ground, you can deal some extra");
799 sprintf (string2, "damage by running up and drop-kicking him.");
800 sprintf (string3, "(Try knocking them down with a sweep first)");
802 if(tutorialstage==20){
803 sprintf (string, "Your most powerful individual attack is the rabbit kick.");
804 if(attackkey==MAC_MOUSEBUTTON1)sprintf (string2, "Run at the enemy while holding the mouse button, and press");
805 else sprintf (string2, "Run at the enemy while holding %s, and press", KeyToChar(attackkey));
806 sprintf (string3, "the jump key (%s) to attack.",KeyToChar(jumpkey));
808 if(tutorialstage==21){
809 sprintf (string, "This attack is devastating if timed correctly.");
810 sprintf (string2, "Even if timed incorrectly, it will knock the enemy over.");
811 if(againbonus)sprintf (string3, "Try rabbit-kicking the imaginary enemy again.");
812 else sprintf (string3, "Try rabbit-kicking the imaginary enemy.");
814 if(tutorialstage==22){
815 sprintf (string, "If you sneak behind an enemy unnoticed, you can kill");
816 sprintf (string2, "him instantly. Move close behind this enemy");
817 sprintf (string3, "and attack.");
819 if(tutorialstage==23){
820 sprintf (string, "Another important attack is the wall kick. When an enemy");
821 sprintf (string2, "is near a wall, perform a walljump nearby and hold");
822 sprintf (string3, "the attack key during impact with the wall.");
824 if(tutorialstage==24){
825 sprintf (string, "You can tackle enemies by running at them animal-style");
826 if(attackkey==MAC_MOUSEBUTTON1)sprintf (string2, "and pressing jump (%s) or attack(mouse button).",KeyToChar(jumpkey));
827 else sprintf (string2, "and pressing jump (%s) or attack(%s).",KeyToChar(jumpkey),KeyToChar(attackkey));
828 sprintf (string3, "This is especially useful when they are running away.");
830 if(tutorialstage==25){
831 sprintf (string, "Dodge by pressing back and attack. Dodging is essential");
832 sprintf (string2, "against enemies with swords or other long weapons.");
833 sprintf (string3, " ");
835 if(tutorialstage==26){
836 sprintf (string, "REVERSALS AND COUNTER-REVERSALS");
837 sprintf (string2, " ");
838 sprintf (string3, " ");
840 if(tutorialstage==27){
841 sprintf (string, "The enemy can now reverse your attacks.");
842 sprintf (string2, " ");
843 sprintf (string3, " ");
845 if(tutorialstage==28){
846 sprintf (string, "If you attack, you will notice that the enemy now sometimes");
847 sprintf (string2, "catches your attack and uses it against you. Hold");
848 sprintf (string3, "crouch (%s) after attacking to escape from reversals.",KeyToChar(crouchkey));
850 if(tutorialstage==29){
851 sprintf (string, "Try escaping from two more reversals in a row.");
852 sprintf (string2, " ");
853 sprintf (string3, " ");
855 if(tutorialstage==30){
856 sprintf (string, "Good!");
857 sprintf (string2, " ");
858 sprintf (string3, " ");
860 if(tutorialstage==31){
861 sprintf (string, "To reverse an attack, you must tap crouch (%s) during the",KeyToChar(crouchkey));
862 sprintf (string2, "enemy's attack. You must also be close to the enemy;");
863 sprintf (string3, "this is especially important against armed opponents.");
865 if(tutorialstage==32){
866 sprintf (string, "The enemy can attack in %d seconds.", (int)(tutorialmaxtime-tutorialstagetime));
867 sprintf (string2, "This imaginary opponents attacks will be highlighted");
868 sprintf (string3, "to make this easier.");
870 if(tutorialstage==33){
871 sprintf (string, "Reverse three enemy attacks!");
872 sprintf (string2, " ");
873 sprintf (string3, " ");
875 if(tutorialstage==34){
876 sprintf (string, "Reverse two more enemy attacks!");
877 sprintf (string2, " ");
878 sprintf (string3, " ");
880 if(tutorialstage==35){
881 sprintf (string, "Reverse one more enemy attack!");
882 sprintf (string2, " ");
883 sprintf (string3, " ");
885 if(tutorialstage==36){
886 sprintf (string, "Excellent!");
887 sprintf (string2, " ");
888 sprintf (string3, " ");
890 if(tutorialstage==37){
891 sprintf (string, "Now spar with the enemy for %d more seconds.", (int)(tutorialmaxtime-tutorialstagetime));
892 sprintf (string2, "Damage dealt: %d",(int)damagedealt);
893 sprintf (string3, "Damage taken: %d.",(int)damagetaken);
895 if(tutorialstage==38){
896 sprintf (string, "WEAPONS:");
897 sprintf (string2, " ");
898 sprintf (string3, " ");
900 if(tutorialstage==39){
901 sprintf (string, "There is now an imaginary knife");
902 sprintf (string2, "in the center of the training area.");
903 sprintf (string3, " ");
905 if(tutorialstage==40){
906 sprintf (string, "Stand, roll or handspring over the knife");
907 sprintf (string2, "while pressing %s to pick it up.",KeyToChar(throwkey));
908 sprintf (string3, "You can crouch and press the same key to drop it again.");
910 if(tutorialstage==41){
911 sprintf (string, "You can equip and unequip weapons using the %s key.",KeyToChar(drawkey));
912 sprintf (string2, "Sometimes it is best to keep them unequipped to");
913 sprintf (string3, "prevent enemies from taking them. ");
915 if(tutorialstage==42){
916 sprintf (string, "The knife is the smallest weapon and the least encumbering.");
917 sprintf (string2, "You can equip or unequip it while standing, crouching,");
918 sprintf (string3, "running or flipping.");
920 if(tutorialstage==43){
921 sprintf (string, "You perform weapon attacks the same way as unarmed attacks,");
922 sprintf (string2, "but sharp weapons cause permanent damage, instead of the");
923 sprintf (string3, "temporary trauma from blunt weapons, fists and feet.");
925 if(tutorialstage==44){
926 sprintf (string, "The enemy now has your knife!");
927 sprintf (string2, "Please reverse two of his knife attacks.");
928 sprintf (string3, " ");
930 if(tutorialstage==45){
931 sprintf (string, "Please reverse one more of his knife attacks.");
932 sprintf (string2, " ");
933 sprintf (string3, " ");
935 if(tutorialstage==46){
936 sprintf (string, "Now he has a sword!");
937 sprintf (string2, "The sword has longer reach than your arms, so you");
938 sprintf (string3, "must move close to reverse the sword slash.");
940 if(tutorialstage==47){
941 sprintf (string, "Long weapons like the sword and staff are also useful for defense;");
942 sprintf (string2, "you can parry enemy weapon attacks by pressing the attack key");
943 sprintf (string3, "at the right time. Please try parrying the enemy's attacks!");
945 if(tutorialstage==48){
946 sprintf (string, "The staff is like the sword, but has two main attacks.");
947 sprintf (string2, "The standing smash is fast and effective, and the running");
948 sprintf (string3, "spin smash is slower and more powerful.");
950 if(tutorialstage==49){
951 sprintf (string, "When facing an enemy, you can throw the knife with %s.",KeyToChar(throwkey));
952 sprintf (string2, "It is possible to throw the knife while flipping,");
953 sprintf (string3, "but it is very inaccurate.");
955 if(tutorialstage==50){
956 sprintf (string, "You now know everything you can learn from training.");
957 sprintf (string2, "Everything else you must learn from experience!");
958 sprintf (string3, " ");
960 if(tutorialstage==51){
961 sprintf (string, "Walk out of the training area to return to the main menu.");
962 sprintf (string2, " ");
963 sprintf (string3, " ");
966 glColor4f(0,0,0,tutorialopac);
967 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);
968 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);
969 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);
970 glColor4f(1,1,1,tutorialopac);
971 text.glPrint(screenwidth/2-7.6*strlen(string)*screenwidth/1024,screenheight/16+screenheight*4/5,string,1,1.5*screenwidth/1024,screenwidth,screenheight);
972 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);
973 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);
975 sprintf (string, "Press 'tab' to skip to the next item.",KeyToChar(jumpkey));
976 sprintf (string2, "Press escape at any time to");
977 sprintf (string3, "pause or exit the tutorial.");
980 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);
981 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);
982 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);
983 glColor4f(0.5,0.5,0.5,1);
984 text.glPrint(screenwidth/2-7.6*strlen(string)*screenwidth/1024*.8,0+screenheight*1/10,string,1,1.5*screenwidth/1024*.8,screenwidth,screenheight);
985 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);
986 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);
990 if(numhotspots&&(bonustime>=1||bonus<=0||bonustime<0)&&!tutoriallevel){
992 float closestdist=-1;
994 closest=currenthotspot;
995 for(i=0;i<numhotspots;i++){
996 distance=findDistancefast(&player[0].coords,&hotspot[i]);
997 if(closestdist==-1||distance<closestdist){
998 if(findDistancefast(&player[0].coords,&hotspot[i])<hotspotsize[i]&&((hotspottype[i]<=10&&hotspottype[i]>=0)||(hotspottype[i]<=40&&hotspottype[i]>=20))){
999 closestdist=distance;
1005 currenthotspot=closest;
1006 if(currenthotspot!=-1){
1007 if(hotspottype[closest]<=10){
1008 if(findDistancefast(&player[0].coords,&hotspot[closest])<hotspotsize[closest])
1009 tutorialstagetime=0;
1011 tutorialopac=tutorialmaxtime-tutorialstagetime;
1012 if(tutorialopac>1)tutorialopac=1;
1013 if(tutorialopac<0)tutorialopac=0;
1015 sprintf (string, "%s", hotspottext[closest]);
1023 if(string[i]=='\n'||string[i]>'z'||string[i]<' '||string[i]=='\0'){
1024 glColor4f(0,0,0,tutorialopac);
1025 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);
1026 glColor4f(1,1,1,tutorialopac);
1027 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);
1030 if(string[i]=='\0')done=1;
1036 else if (hotspottype[closest]>=20&&dialoguegonethrough[hotspottype[closest]-20]==0){
1037 whichdialogue=hotspottype[closest]-20;
1038 for(j=0;j<numdialogueboxes[whichdialogue];j++){
1039 player[participantfocus[whichdialogue][j]].coords=participantlocation[whichdialogue][participantfocus[whichdialogue][j]];
1040 player[participantfocus[whichdialogue][j]].rotation=participantrotation[whichdialogue][participantfocus[whichdialogue][j]];
1041 player[participantfocus[whichdialogue][j]].targetrotation=participantrotation[whichdialogue][participantfocus[whichdialogue][j]];
1042 player[participantfocus[whichdialogue][j]].velocity=0;
1043 player[participantfocus[whichdialogue][j]].targetanimation=player[participantfocus[whichdialogue][j]].getIdle();
1044 player[participantfocus[whichdialogue][j]].targetframe=0;
1048 dialoguegonethrough[whichdialogue]++;
1049 if(dialogueboxsound[whichdialogue][indialogue]!=0){
1050 static float gLoc[3];
1051 static float vel[3];
1052 gLoc[0]=player[participantfocus[whichdialogue][indialogue]].coords.x;
1053 gLoc[1]=player[participantfocus[whichdialogue][indialogue]].coords.y;
1054 gLoc[2]=player[participantfocus[whichdialogue][indialogue]].coords.z;
1059 if(dialogueboxsound[whichdialogue][indialogue]==1)whichsoundplay=rabbitchitter;
1060 if(dialogueboxsound[whichdialogue][indialogue]==2)whichsoundplay=rabbitchitter2;
1061 if(dialogueboxsound[whichdialogue][indialogue]==3)whichsoundplay=rabbitpainsound;
1062 if(dialogueboxsound[whichdialogue][indialogue]==4)whichsoundplay=rabbitpain1sound;
1063 if(dialogueboxsound[whichdialogue][indialogue]==5)whichsoundplay=rabbitattacksound;
1064 if(dialogueboxsound[whichdialogue][indialogue]==6)whichsoundplay=rabbitattack2sound;
1065 if(dialogueboxsound[whichdialogue][indialogue]==7)whichsoundplay=rabbitattack3sound;
1066 if(dialogueboxsound[whichdialogue][indialogue]==8)whichsoundplay=rabbitattack4sound;
1067 if(dialogueboxsound[whichdialogue][indialogue]==9)whichsoundplay=growlsound;
1068 if(dialogueboxsound[whichdialogue][indialogue]==10)whichsoundplay=growl2sound;
1069 if(dialogueboxsound[whichdialogue][indialogue]==11)whichsoundplay=snarlsound;
1070 if(dialogueboxsound[whichdialogue][indialogue]==12)whichsoundplay=snarl2sound;
1071 if(dialogueboxsound[whichdialogue][indialogue]==13)whichsoundplay=barksound;
1072 if(dialogueboxsound[whichdialogue][indialogue]==14)whichsoundplay=bark2sound;
1073 if(dialogueboxsound[whichdialogue][indialogue]==15)whichsoundplay=bark3sound;
1074 if(dialogueboxsound[whichdialogue][indialogue]==16)whichsoundplay=barkgrowlsound;
1075 if(dialogueboxsound[whichdialogue][indialogue]==-1)whichsoundplay=fireendsound;
1076 if(dialogueboxsound[whichdialogue][indialogue]==-2)whichsoundplay=firestartsound;
1077 if(dialogueboxsound[whichdialogue][indialogue]==-3)whichsoundplay=consolesuccesssound;
1078 if(dialogueboxsound[whichdialogue][indialogue]==-4)whichsoundplay=consolefailsound;
1079 PlaySoundEx( whichsoundplay, samp[whichsoundplay], NULL, TRUE);
1080 FSOUND_3D_SetAttributes(channels[whichsoundplay], gLoc, vel);
1081 FSOUND_SetVolume(channels[whichsoundplay], 256);
1082 FSOUND_SetPaused(channels[whichsoundplay], FALSE);
1088 if(indialogue!=-1&&!mainmenu){
1089 glDisable(GL_DEPTH_TEST); // Disables Depth Testing
1090 glDisable(GL_CULL_FACE);
1091 glDisable(GL_LIGHTING);
1092 glDisable(GL_TEXTURE_2D);
1094 glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
1095 glPushMatrix(); // Store The Projection Matrix
1096 glLoadIdentity(); // Reset The Projection Matrix
1097 glOrtho(0,screenwidth,0,screenheight,-100,100); // Set Up An Ortho Screen
1098 glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
1099 glPushMatrix(); // Store The Modelview Matrix
1100 glLoadIdentity(); // Reset The Modelview Matrix
1101 if(dialogueboxlocation[whichdialogue][indialogue]==1)glTranslatef(0,screenheight*3/4,0);
1102 glScalef(screenwidth,screenheight/4,1);
1103 glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
1106 glColor4f(dialogueboxcolor[whichdialogue][indialogue][0],dialogueboxcolor[whichdialogue][indialogue][1],dialogueboxcolor[whichdialogue][indialogue][2],0.7);
1108 glVertex3f(0, 0, 0.0f);
1109 glVertex3f(1, 0, 0.0f);
1110 glVertex3f(1, 1, 0.0f);
1111 glVertex3f(0, 1, 0.0f);
1113 glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
1114 glPopMatrix(); // Restore The Old Projection Matrix
1115 glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
1116 glPopMatrix(); // Restore The Old Projection Matrix
1117 glEnable(GL_DEPTH_TEST); // Enables Depth Testing
1118 glEnable(GL_CULL_FACE);
1119 glDisable(GL_BLEND);
1121 glEnable(GL_TEXTURE_2D);
1128 startx=screenwidth*1/5;
1129 if(dialogueboxlocation[whichdialogue][indialogue]==1)starty=screenheight/16+screenheight*4/5;
1130 if(dialogueboxlocation[whichdialogue][indialogue]==2)starty=screenheight*1/5-screenheight/16;
1132 // char tempname[64];
1136 // for(i=0;i<64;i++){
1141 for(i=0;i<(int)strlen(dialoguename[whichdialogue][indialogue]);i++){
1142 tempname[tempnum]=dialoguename[whichdialogue][indialogue][i];
1144 if(dialoguename[whichdialogue][indialogue][i]=='#'||dialoguename[whichdialogue][indialogue][i]=='\0')goodchar=0;
1145 //if(tempnum>2)if(tempname[tempnum-2]=='e'&&tempname[tempnum-1]=='r')goodchar=0;
1146 //if(tempnum>2)if(tempname[tempnum]=='r'&&tempname[0]=='a')goodchar=0;
1147 if(goodchar)tempnum++;
1148 else tempname[tempnum]='\0';
1151 sprintf (string, "%s: ", tempname);
1153 if(dialogueboxcolor[whichdialogue][indialogue][0]+dialogueboxcolor[whichdialogue][indialogue][1]+dialogueboxcolor[whichdialogue][indialogue][2]<1.5){
1154 glColor4f(0,0,0,tutorialopac);
1155 text.glPrintOutline(startx-2*7.6*strlen(string)*screenwidth/1024-4,starty-4,string,1,1.5*1.25*screenwidth/1024,screenwidth,screenheight);
1156 glColor4f(0.7,0.7,0.7,tutorialopac);
1157 text.glPrint(startx-2*7.6*strlen(string)*screenwidth/1024,starty,string,1,1.5*screenwidth/1024,screenwidth,screenheight);
1161 glColor4f(0,0,0,tutorialopac);
1162 text.glPrintOutline(startx-2*7.6*strlen(string)*screenwidth/1024-4,starty-4,string,1,1.5*1.25*screenwidth/1024,screenwidth,screenheight);
1167 for(i=0;i<(int)strlen(dialoguetext[whichdialogue][indialogue])+1;i++){
1168 tempname[tempnum]=dialoguetext[whichdialogue][indialogue][i];
1169 if(dialoguetext[whichdialogue][indialogue][i]!='#')tempnum++;
1173 sprintf (string, "%s", tempname);
1182 if(string[i]=='\n'||string[i]>'z'||string[i]<' '||string[i]=='\0'){
1183 if(dialogueboxcolor[whichdialogue][indialogue][0]+dialogueboxcolor[whichdialogue][indialogue][1]+dialogueboxcolor[whichdialogue][indialogue][2]<1.5){
1184 glColor4f(0,0,0,tutorialopac);
1185 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);
1186 glColor4f(1,1,1,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 glColor4f(0,0,0,tutorialopac);
1192 text.glPrint(startx/*-7.6*(i-lastline)*screenwidth/1024*/,starty-20*screenwidth/1024*line,string,1,1.5*screenwidth/1024,screenwidth,screenheight,lastline,i);
1196 if(string[i]=='\0')done=1;
1203 if(!tutoriallevel&&!winfreeze&&indialogue==-1&&!mainmenu){
1205 if(!scoreadded)sprintf (string, "Score: %d", (int)accountcampaignscore[accountactive]+(int)bonustotal);//(int)bonustotal);
1206 if(scoreadded)sprintf (string, "Score: %d", (int)accountcampaignscore[accountactive]);//(int)bonustotal);
1208 if(!campaign)sprintf (string, "Score: %d", (int)bonustotal);
1210 text.glPrintOutline(1024/40-4,768/16-4+768*14/16,string,1,1.5*1.25,1024,768);
1212 text.glPrint(1024/40,768/16+768*14/16,string,1,1.5,1024,768);
1215 glColor4f(.5,.5,.5,1);
1218 if((texttoggle||editorenabled)&&debugmode&&!mainmenu){
1219 sprintf (string, "The framespersecond is %d.",(int)(fps));
1220 text.glPrint(10,30,string,0,.8,1024,768);
1222 sprintf (string, "Name: %s", registrationname);
1223 text.glPrint(10,260,string,0,.8,1024,768);
1226 if(editorenabled)sprintf (string, "Map editor enabled.");
1227 if(!editorenabled)sprintf (string, "Map editor Disabled.");
1228 text.glPrint(10,60,string,0,.8,1024,768);
1230 sprintf (string, "Object size: %f",editorsize);
1231 text.glPrint(10,75,string,0,.8,1024,768);
1232 if(editorrotation>=0)sprintf (string, "Object rotation: %f",editorrotation);
1233 else sprintf (string, "Object rotation: Random");
1234 text.glPrint(10,90,string,0,.8,1024,768);
1235 if(editorrotation2>=0)sprintf (string, "Object rotation2: %f",editorrotation2);
1236 else sprintf (string, "Object rotation2: Random");
1237 text.glPrint(10,105,string,0,.8,1024,768);
1238 sprintf (string, "Object type: %d",editortype);
1239 text.glPrint(10,120,string,0,.8,1024,768);
1240 if(editortype==boxtype)sprintf (string, "(box)");
1241 if(editortype==treetrunktype)sprintf (string, "(tree)");
1242 if(editortype==walltype)sprintf (string, "(wall)");
1243 if(editortype==weirdtype)sprintf (string, "(weird)");
1244 if(editortype==spiketype)sprintf (string, "(spike)");
1245 if(editortype==rocktype)sprintf (string, "(rock)");
1246 if(editortype==bushtype)sprintf (string, "(bush)");
1247 if(editortype==tunneltype)sprintf (string, "(tunnel)");
1248 if(editortype==chimneytype)sprintf (string, "(chimney)");
1249 if(editortype==platformtype)sprintf (string, "(platform)");
1250 if(editortype==cooltype)sprintf (string, "(cool)");
1251 if(editortype==firetype)sprintf (string, "(fire)");
1252 text.glPrint(130,120,string,0,.8,1024,768);
1254 sprintf (string, "Numplayers: %d",numplayers);
1255 text.glPrint(10,155,string,0,.8,1024,768);
1256 sprintf (string, "Player %d: numwaypoints: %d",numplayers,player[numplayers-1].numwaypoints);
1257 text.glPrint(10,140,string,0,.8,1024,768);
1259 /*sprintf (string, "Coords are: %f %f %f",player[0].coords.x,player[0].coords.y,player[0].coords.z);
1260 text.glPrint(10,200,string,0,.8,1024,768);*/
1261 sprintf (string, "Difficulty: %d",difficulty);
1262 text.glPrint(10,240,string,0,.8,1024,768);
1264 sprintf (string, "lasthotspot: %d",hotspottype[numhotspots-1]);
1265 text.glPrint(10,240,string,0,.8,1024,768);
1266 sprintf (string, "killhotspot: %d",killhotspot);
1267 text.glPrint(10,220,string,0,.8,1024,768);
1268 sprintf (string, "winhotspot: %d",winhotspot);
1269 text.glPrint(10,200,string,0,.8,1024,768);*/
1274 if(drawmode==glowmode){
1275 glDisable(GL_DEPTH_TEST); // Disables Depth Testing
1276 glDisable(GL_CULL_FACE);
1277 glDisable(GL_LIGHTING);
1278 glDisable(GL_TEXTURE_2D);
1280 glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
1281 glPushMatrix(); // Store The Projection Matrix
1282 glLoadIdentity(); // Reset The Projection Matrix
1283 glOrtho(0,screenwidth,0,screenheight,-100,100); // Set Up An Ortho Screen
1284 glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
1285 glPushMatrix(); // Store The Modelview Matrix
1286 glLoadIdentity(); // Reset The Modelview Matrix
1287 glScalef(screenwidth,screenheight,1);
1288 glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
1290 glColor4f(0,0,0,.5);
1292 glVertex3f(0, 0, 0.0f);
1293 glVertex3f(256, 0, 0.0f);
1294 glVertex3f(256, 256, 0.0f);
1295 glVertex3f(0, 256, 0.0f);
1297 glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
1298 glPopMatrix(); // Restore The Old Projection Matrix
1299 glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
1300 glPopMatrix(); // Restore The Old Projection Matrix
1301 glEnable(GL_DEPTH_TEST); // Enables Depth Testing
1302 glEnable(GL_CULL_FACE);
1303 glDisable(GL_BLEND);
1307 if((((blackout&&damageeffects)||(player[0].bloodloss>0&&damageeffects&&player[0].blooddimamount>0)||player[0].dead)&&!cameramode)||console){
1308 glDisable(GL_DEPTH_TEST); // Disables Depth Testing
1309 glDisable(GL_CULL_FACE);
1310 glDisable(GL_LIGHTING);
1311 glDisable(GL_TEXTURE_2D);
1313 glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
1314 glPushMatrix(); // Store The Projection Matrix
1315 glLoadIdentity(); // Reset The Projection Matrix
1316 glOrtho(0,screenwidth,0,screenheight,-100,100); // Set Up An Ortho Screen
1317 glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
1318 glPushMatrix(); // Store The Modelview Matrix
1319 glLoadIdentity(); // Reset The Modelview Matrix
1320 glScalef(screenwidth,screenheight,1);
1321 glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
1323 if(player[0].dead)blackout+=multiplier*3;
1324 if(player[0].dead==1)blackout=.4f;
1325 if(player[0].dead==2&&blackout>.6)blackout=.6;
1326 glColor4f(0,0,0,blackout);
1327 if(!player[0].dead){
1328 if((player[0].bloodloss/player[0].damagetolerance*(sin(woozy)/4+.5))*.3<.3){
1329 glColor4f(0,0,0,player[0].blooddimamount*player[0].bloodloss/player[0].damagetolerance*(sin(woozy)/4+.5)*.3);
1330 blackout=player[0].blooddimamount*player[0].bloodloss/player[0].damagetolerance*(sin(woozy)/4+.5)*.3;
1333 glColor4f(0,0,0,player[0].blooddimamount*.3);
1334 blackout=player[0].blooddimamount*.3;
1337 if(console)glColor4f(.7,0,0,.2);
1339 glVertex3f(0, 0, 0.0f);
1340 glVertex3f(256, 0, 0.0f);
1341 glVertex3f(256, 256, 0.0f);
1342 glVertex3f(0, 256, 0.0f);
1344 glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
1345 glPopMatrix(); // Restore The Old Projection Matrix
1346 glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
1347 glPopMatrix(); // Restore The Old Projection Matrix
1348 glEnable(GL_DEPTH_TEST); // Enables Depth Testing
1349 glEnable(GL_CULL_FACE);
1350 glDisable(GL_BLEND);
1354 if(flashamount>0&&damageeffects){
1355 if(flashamount>1)flashamount=1;
1356 if(flashdelay<=0)flashamount-=multiplier;
1358 if(flashamount<0)flashamount=0;
1359 glDisable(GL_DEPTH_TEST); // Disables Depth Testing
1360 glDisable(GL_CULL_FACE);
1361 glDisable(GL_LIGHTING);
1363 glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
1364 glPushMatrix(); // Store The Projection Matrix
1365 glLoadIdentity(); // Reset The Projection Matrix
1366 glOrtho(0,screenwidth,0,screenheight,-100,100); // Set Up An Ortho Screen
1367 glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
1368 glPushMatrix(); // Store The Modelview Matrix
1369 glLoadIdentity(); // Reset The Modelview Matrix
1370 glScalef(screenwidth,screenheight,1);
1371 glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
1373 glColor4f(flashr,flashg,flashb,flashamount);
1375 glVertex3f(0, 0, 0.0f);
1376 glVertex3f(256, 0, 0.0f);
1377 glVertex3f(256, 256, 0.0f);
1378 glVertex3f(0, 256, 0.0f);
1380 glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
1381 glPopMatrix(); // Restore The Old Projection Matrix
1382 glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
1383 glPopMatrix(); // Restore The Old Projection Matrix
1384 glEnable(GL_DEPTH_TEST); // Enables Depth Testing
1385 glEnable(GL_CULL_FACE);
1386 glDisable(GL_BLEND);
1392 glEnable(GL_TEXTURE_2D);
1395 sprintf (string, " ]");
1396 text.glPrint(10,30+screenheight-330,string,0,1,screenwidth,screenheight);
1398 sprintf (string, "_");
1399 text.glPrint(30+(float)(displayselected)*10,30+(screenheight-330),string,0,1,screenwidth,screenheight);
1403 if((i!=0||chatting)&&displaytime[i]<4)
1404 for(j=0;j<displaychars[i];j++){
1405 glColor4f(1,1,1,4-displaytime[i]);
1406 if(j<displaychars[i]){
1407 sprintf (string, "%c",displaytext[i][j]);
1408 text.glPrint(30+j*10,30+i*20+(screenheight-330),string,0,1,screenwidth,screenheight);
1414 if(minimap&&indialogue==-1){
1418 glDisable(GL_DEPTH_TEST);
1419 glColor3f (1.0, 1.0, 1.0); // no coloring
1421 glEnable(GL_TEXTURE_2D);
1422 glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE );
1423 glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE );
1424 glDisable(GL_DEPTH_TEST); // Disables Depth Testing
1425 glDisable(GL_CULL_FACE);
1426 glDisable(GL_LIGHTING);
1428 glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
1429 glPushMatrix(); // Store The Projection Matrix
1430 glLoadIdentity(); // Reset The Projection Matrix
1431 glOrtho(0,screenwidth,0,screenheight,-100,100); // Set Up An Ortho Screen
1432 glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
1433 glPushMatrix(); // Store The Modelview Matrix
1434 glLoadIdentity(); // Reset The Modelview Matrix
1435 glScalef((float)screenwidth/2,(float)screenwidth/2,1);
1436 glTranslatef(1.75,.25,0);
1437 glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
1447 int numliveplayers=0;
1448 for(i=0;i<numplayers;i++){
1449 if(!player[i].dead)numliveplayers++;
1455 for(i=0;i<objects.numobjects;i++){
1456 if(objects.type[i]==treetrunktype||objects.type[i]==boxtype){
1457 center+=objects.position[i];
1461 for(i=0;i<numplayers;i++){
1462 if(!player[i].dead)center+=player[i].coords;
1464 center/=numadd+numliveplayers;
1466 center=player[0].coords;
1468 float maxdistance=0;
1471 for(i=0;i<objects.numobjects;i++){
1472 tempdist=findDistancefast(¢er,&objects.position[i]);
1473 if(tempdist>maxdistance){
1475 maxdistance=tempdist;
1478 for(i=0;i<numplayers;i++){
1479 if(!player[i].dead){
1480 tempdist=findDistancefast(¢er,&player[i].coords);
1481 if(tempdist>maxdistance){
1483 maxdistance=tempdist;
1487 radius=fast_sqrt(maxdistance);
1491 glScalef(.25/radius*256*terrain.scale*.4,.25/radius*256*terrain.scale*.4,1);
1493 glScalef(1/(1/radius*256*terrain.scale*.4),1/(1/radius*256*terrain.scale*.4),1);
1494 /*float startx,starty,endx,endy;
1496 glTexCoord2f(1-(center.x-radius)/terrain.scale/256,(center.z-radius)/terrain.scale/256);
1497 glVertex3f(-1, -1, 0.0f);
1498 glTexCoord2f(1-(center.x+radius)/terrain.scale/256,(center.z-radius)/terrain.scale/256);
1499 glVertex3f(1, -1, 0.0f);
1500 glTexCoord2f(1-(center.x+radius)/terrain.scale/256,(center.z+radius)/terrain.scale/256);
1501 glVertex3f(1, 1, 0.0f);
1502 glTexCoord2f(1-(center.x-radius)/terrain.scale/256,(center.z+radius)/terrain.scale/256);
1503 glVertex3f(-1, 1, 0.0f);
1506 glRotatef(player[0].lookrotation*-1+180,0,0,1);
1507 glTranslatef(-(center.x/terrain.scale/256*-2+1),(center.z/terrain.scale/256*-2+1),0);
1508 for(i=0;i<objects.numobjects;i++){
1509 if(objects.type[i]==treetrunktype){
1510 distcheck=findDistancefast(&player[0].coords,&objects.position[i]);
1511 if(distcheck<mapviewdist){
1512 glBindTexture( GL_TEXTURE_2D, Mapcircletexture);
1513 glColor4f(0,.3,0,opac*(1-distcheck/mapviewdist));
1515 glTranslatef(objects.position[i].x/terrain.scale/256*-2+1,objects.position[i].z/terrain.scale/256*2-1,0);
1516 glRotatef(objects.rotation[i],0,0,1);
1517 glScalef(.003,.003,.003);
1520 glVertex3f(-1, -1, 0.0f);
1522 glVertex3f(1, -1, 0.0f);
1524 glVertex3f(1, 1, 0.0f);
1526 glVertex3f(-1, 1, 0.0f);
1531 if(objects.type[i]==boxtype){
1532 distcheck=findDistancefast(&player[0].coords,&objects.position[i]);
1533 if(distcheck<mapviewdist){
1534 glBindTexture( GL_TEXTURE_2D, Mapboxtexture);
1535 glColor4f(.4,.4,.4,opac*(1-distcheck/mapviewdist));
1537 glTranslatef(objects.position[i].x/terrain.scale/256*-2+1,objects.position[i].z/terrain.scale/256*2-1,0);
1538 glRotatef(objects.rotation[i],0,0,1);
1539 glScalef(.01*objects.scale[i],.01*objects.scale[i],.01*objects.scale[i]);
1542 glVertex3f(-1, -1, 0.0f);
1544 glVertex3f(1, -1, 0.0f);
1546 glVertex3f(1, 1, 0.0f);
1548 glVertex3f(-1, 1, 0.0f);
1555 glBindTexture( GL_TEXTURE_2D, Mapcircletexture);
1556 for(i=0;i<numboundaries;i++){
1557 glColor4f(0,0,0,opac/3);
1559 glTranslatef(boundary[i].x/terrain.scale/256*-2+1,boundary[i].z/terrain.scale/256*2-1,0);
1560 glScalef(.002,.002,.002);
1563 glVertex3f(-1, -1, 0.0f);
1565 glVertex3f(1, -1, 0.0f);
1567 glVertex3f(1, 1, 0.0f);
1569 glVertex3f(-1, 1, 0.0f);
1574 for(i=0;i<numplayers;i++){
1575 distcheck=findDistancefast(&player[0].coords,&player[i].coords);
1576 if(distcheck<mapviewdist){
1578 glBindTexture( GL_TEXTURE_2D, Maparrowtexture);
1579 if(i==0)glColor4f(1,1,1,opac);
1580 else if(player[i].dead==2||player[i].howactive>typesleeping)glColor4f(0,0,0,opac*(1-distcheck/mapviewdist));
1581 else if(player[i].dead)glColor4f(.3,.3,.3,opac*(1-distcheck/mapviewdist));
1582 else if(player[i].aitype==attacktypecutoff)glColor4f(1,0,0,opac*(1-distcheck/mapviewdist));
1583 else if(player[i].aitype==passivetype)glColor4f(0,1,0,opac*(1-distcheck/mapviewdist));
1584 else glColor4f(1,1,0,1);
1585 glTranslatef(player[i].coords.x/terrain.scale/256*-2+1,player[i].coords.z/terrain.scale/256*2-1,0);
1586 glRotatef(player[i].rotation+180,0,0,1);
1587 glScalef(.005,.005,.005);
1590 glVertex3f(-1, -1, 0.0f);
1592 glVertex3f(1, -1, 0.0f);
1594 glVertex3f(1, 1, 0.0f);
1596 glVertex3f(-1, 1, 0.0f);
1598 /*glBegin(GL_TRIANGLES);
1600 glVertex3f(-1, -1, 0.0f);
1602 glVertex3f(1, -1, 0.0f);
1604 glVertex3f(0, 1, 0.0f);
1609 /*glBegin(GL_QUADS);
1611 glVertex3f(-1, -1, 0.0f);
1613 glVertex3f(1, -1, 0.0f);
1615 glVertex3f(1, 1, 0.0f);
1617 glVertex3f(-1, 1, 0.0f);
1620 glDisable(GL_TEXTURE_2D);
1621 glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
1622 glPopMatrix(); // Restore The Old Projection Matrix
1623 glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
1624 glPopMatrix(); // Restore The Old Projection Matrix
1625 glEnable(GL_DEPTH_TEST); // Enables Depth Testing
1626 glEnable(GL_CULL_FACE);
1627 glDisable(GL_BLEND);
1633 drawmode=normalmode;
1637 if(loading&&!stealthloading&&(!campaign||player[0].dead)){
1638 glDisable(GL_DEPTH_TEST); // Disables Depth Testing
1639 glDisable(GL_CULL_FACE);
1640 glDisable(GL_LIGHTING);
1641 glDisable(GL_TEXTURE_2D);
1643 glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
1644 glPushMatrix(); // Store The Projection Matrix
1645 glLoadIdentity(); // Reset The Projection Matrix
1646 glOrtho(0,screenwidth,0,screenheight,-100,100); // Set Up An Ortho Screen
1647 glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
1648 glPushMatrix(); // Store The Modelview Matrix
1649 glLoadIdentity(); // Reset The Modelview Matrix
1650 glScalef(screenwidth,screenheight,1);
1651 glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
1653 glColor4f(0,0,0,.7);
1655 glVertex3f(0, 0, 0.0f);
1656 glVertex3f(256, 0, 0.0f);
1657 glVertex3f(256, 256, 0.0f);
1658 glVertex3f(0, 256, 0.0f);
1660 glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
1661 glPopMatrix(); // Restore The Old Projection Matrix
1662 glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
1663 glPopMatrix(); // Restore The Old Projection Matrix
1664 glEnable(GL_DEPTH_TEST); // Enables Depth Testing
1665 glEnable(GL_CULL_FACE);
1666 glDisable(GL_BLEND);
1670 glDisable(GL_DEPTH_TEST);
1671 glColor3f (1.0, 1.0, 1.0); // no coloring
1673 glEnable(GL_TEXTURE_2D);
1674 /*glBindTexture( GL_TEXTURE_2D, logotexture);
1675 glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE );
1676 glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE );
1677 glDisable(GL_DEPTH_TEST); // Disables Depth Testing
1678 glDisable(GL_CULL_FACE);
1679 glDisable(GL_LIGHTING);
1681 glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
1682 glPushMatrix(); // Store The Projection Matrix
1683 glLoadIdentity(); // Reset The Projection Matrix
1684 glOrtho(0,screenwidth,0,screenheight,-100,100); // Set Up An Ortho Screen
1685 glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
1686 glPushMatrix(); // Store The Modelview Matrix
1687 glLoadIdentity(); // Reset The Modelview Matrix
1688 glScalef((float)screenwidth/2,(float)screenwidth/2,1);
1689 glTranslatef(1.8,1.25,0);
1690 glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
1694 glScalef(.25,.25,.25);
1697 glVertex3f(-1, -1, 0.0f);
1699 glVertex3f(1, -1, 0.0f);
1701 glVertex3f(1, 1, 0.0f);
1703 glVertex3f(-1, 1, 0.0f);
1706 glDisable(GL_TEXTURE_2D);
1707 glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
1708 glPopMatrix(); // Restore The Old Projection Matrix
1709 glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
1710 glPopMatrix(); // Restore The Old Projection Matrix
1711 glEnable(GL_DEPTH_TEST); // Enables Depth Testing
1712 glEnable(GL_CULL_FACE);
1713 glDisable(GL_BLEND);
1719 glEnable(GL_TEXTURE_2D);
1721 sprintf (string, "Loading...");
1722 text.glPrint(1024/2-90,768/2,string,1,2,1024,768);
1725 //if(ismotionblur)drawmode=motionblurmode;
1726 drawmode=normalmode;
1729 if(winfreeze&&!campaign){
1730 glDisable(GL_DEPTH_TEST); // Disables Depth Testing
1731 glDisable(GL_CULL_FACE);
1732 glDisable(GL_LIGHTING);
1733 glDisable(GL_TEXTURE_2D);
1735 glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
1736 glPushMatrix(); // Store The Projection Matrix
1737 glLoadIdentity(); // Reset The Projection Matrix
1738 glOrtho(0,screenwidth,0,screenheight,-100,100); // Set Up An Ortho Screen
1739 glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
1740 glPushMatrix(); // Store The Modelview Matrix
1741 glLoadIdentity(); // Reset The Modelview Matrix
1742 glScalef(screenwidth,screenheight,1);
1743 glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
1745 glColor4f(0,0,0,.4);
1747 glVertex3f(0, 0, 0.0f);
1748 glVertex3f(256, 0, 0.0f);
1749 glVertex3f(256, 256, 0.0f);
1750 glVertex3f(0, 256, 0.0f);
1752 glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
1753 glPopMatrix(); // Restore The Old Projection Matrix
1754 glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
1755 glPopMatrix(); // Restore The Old Projection Matrix
1756 glEnable(GL_DEPTH_TEST); // Enables Depth Testing
1757 glEnable(GL_CULL_FACE);
1758 glDisable(GL_BLEND);
1762 glDisable(GL_DEPTH_TEST);
1763 glColor3f (1.0, 1.0, 1.0); // no coloring
1765 glEnable(GL_TEXTURE_2D);
1766 /*glBindTexture( GL_TEXTURE_2D, logotexture);
1767 glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE );
1768 glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE );
1769 glDisable(GL_DEPTH_TEST); // Disables Depth Testing
1770 glDisable(GL_CULL_FACE);
1771 glDisable(GL_LIGHTING);
1773 glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
1774 glPushMatrix(); // Store The Projection Matrix
1775 glLoadIdentity(); // Reset The Projection Matrix
1776 glOrtho(0,screenwidth,0,screenheight,-100,100); // Set Up An Ortho Screen
1777 glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
1778 glPushMatrix(); // Store The Modelview Matrix
1779 glLoadIdentity(); // Reset The Modelview Matrix
1780 glScalef((float)screenwidth/2,(float)screenwidth/2,1);
1781 glTranslatef(1.8,1.25,0);
1782 glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
1786 glScalef(.25,.25,.25);
1789 glVertex3f(-1, -1, 0.0f);
1791 glVertex3f(1, -1, 0.0f);
1793 glVertex3f(1, 1, 0.0f);
1795 glVertex3f(-1, 1, 0.0f);
1798 glDisable(GL_TEXTURE_2D);
1799 glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
1800 glPopMatrix(); // Restore The Old Projection Matrix
1801 glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
1802 glPopMatrix(); // Restore The Old Projection Matrix
1803 glEnable(GL_DEPTH_TEST); // Enables Depth Testing
1804 glEnable(GL_CULL_FACE);
1805 glDisable(GL_BLEND);
1813 if(damagetaken==0&&player[0].bloodloss==0){
1814 awards[numawards]=awardflawless;
1820 for(i=1;i<numplayers;i++){
1821 if(player[i].dead!=2)alldead=0;
1824 awards[numawards]=awardalldead;
1829 for(i=1;i<numplayers;i++){
1830 if(player[i].dead!=1)alldead=0;
1833 awards[numawards]=awardnodead;
1836 if(numresponded==0&&!numthrowkill){
1837 awards[numawards]=awardstealth;
1840 if(numattacks==numstaffattack&&numattacks>0){
1841 awards[numawards]=awardbojutsu;
1844 if(numattacks==numswordattack&&numattacks>0){
1845 awards[numawards]=awardswordsman;
1848 if(numattacks==numknifeattack&&numattacks>0){
1849 awards[numawards]=awardknifefighter;
1852 if(numattacks==numunarmedattack&&numthrowkill==0&&weapons.numweapons>0){
1853 awards[numawards]=awardkungfu;
1857 awards[numawards]=awardevasion;
1860 if(numflipfail==0&&numflipped+numwallflipped*2>20){
1861 awards[numawards]=awardacrobat;
1864 if(numthrowkill==numplayers-1){
1865 awards[numawards]=awardlongrange;
1870 for(i=1;i<numplayers;i++){
1871 if(player[i].dead!=2)alldead=0;
1873 if(numafterkill>0&&alldead){
1874 awards[numawards]=awardbrutal;
1877 if(numreversals>((float)numattacks)*.8&&numreversals>3){
1878 awards[numawards]=awardaikido;
1881 if(maxalarmed==1&&numplayers>2){
1882 awards[numawards]=awardstrategy;
1886 awards[numawards]=awardklutz;
1891 //Win Screen Won Victory
1893 glEnable(GL_TEXTURE_2D);
1895 sprintf (string, "Level Cleared!");
1896 text.glPrintOutlined(1024/2-strlen(string)*10,768*7/8,string,1,2,1024,768);
1898 sprintf (string, "Score: %d",(int)(bonustotal-startbonustotal));
1899 text.glPrintOutlined(1024/30,768*6/8,string,1,2,1024,768);
1901 if(!campaign)sprintf (string, "Press Escape to return to menu or Space to continue");
1902 if(campaign)sprintf (string, "Press Escape or Space to continue");
1903 text.glPrintOutlined(640/2-strlen(string)*5,480*1/16,string,1,1,640,480);
1907 for(i=0;i<255;i++)string[i]='\0';
1908 sprintf (temp, "Time: %d:",(int)(((int)leveltime-(int)(leveltime)%60)/60));
1909 strcat(string,temp);
1910 if((int)(leveltime)%60<10)strcat(string,"0");
1911 sprintf (temp, "%d",(int)(leveltime)%60);
1912 strcat(string,temp);
1913 text.glPrintOutlined(1024/30,768*6/8-40,string,1,2,1024,768);
1915 for(i=0;i<numawards;i++){
1917 if(awards[i]==awardklutz)sprintf (string, "Suicidal");
1918 if(awards[i]==awardflawless)sprintf (string, "Flawless!");
1919 if(awards[i]==awardalldead)sprintf (string, "Take no prisoners");
1920 if(awards[i]==awardnodead)sprintf (string, "Merciful");
1921 if(awards[i]==awardstealth)sprintf (string, "One with the shadows!");
1922 if(awards[i]==awardswordsman)sprintf (string, "Swordsman");
1923 if(awards[i]==awardkungfu)sprintf (string, "Unarmed!");
1924 if(awards[i]==awardknifefighter)sprintf (string, "Knife fighter");
1925 if(awards[i]==awardcoward)sprintf (string, "Coward");
1926 if(awards[i]==awardevasion)sprintf (string, "Escape artist");
1927 if(awards[i]==awardacrobat)sprintf (string, "Gymnast");
1928 if(awards[i]==awardlongrange)sprintf (string, "Blade slinger");
1929 if(awards[i]==awardbrutal)sprintf (string, "Brutal");
1930 if(awards[i]==awardhyper)sprintf (string, "Hyper");
1931 if(awards[i]==awardaikido)sprintf (string, "Aikido master!");
1932 if(awards[i]==awardrambo)sprintf (string, "Rambo");
1933 if(awards[i]==awardfast)sprintf (string, "Fast");
1934 if(awards[i]==awardrealfast)sprintf (string, "Real fast");
1935 if(awards[i]==awarddamnfast)sprintf (string, "Damn fast");
1936 if(awards[i]==awardstrategy)sprintf (string, "Divide and conquer");
1937 if(awards[i]==awardbojutsu)sprintf (string, "Bojutsu");
1938 text.glPrintOutlined(1024/30,768*6/8-90-40*i,string,1,2,1024,768);
1942 //drawmode=normalmode;
1945 if(drawmode!=normalmode){
1946 glEnable(GL_TEXTURE_2D);
1948 if(!drawtoggle||drawmode!=realmotionblurmode||(drawtoggle==2||change==1)){
1951 glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE_EXT);
1952 GLfloat subtractColor[4] = { 0.5, 0.5, 0.5, 0.0 };
1953 glTexEnvfv(GL_TEXTURE_ENV, GL_TEXTURE_ENV_COLOR, subtractColor);
1954 //glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB_EXT, GL_SUBTRACT);
1955 glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_RGB_EXT, GL_TEXTURE);
1956 glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE1_RGB_EXT, GL_CONSTANT_EXT);
1957 glTexEnvf(GL_TEXTURE_ENV, GL_RGB_SCALE_EXT, 2.0f);
1959 glBindTexture( GL_TEXTURE_2D, screentexture);
1960 glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 0, texviewwidth, texviewheight);
1963 if((drawtoggle||change==1)&&drawmode==realmotionblurmode){
1965 glBindTexture( GL_TEXTURE_2D, screentexture2);
1966 glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 0, texviewwidth, texviewheight);
1968 if(!screentexture2){
1969 glPixelStorei( GL_UNPACK_ALIGNMENT, 1 );
1971 glGenTextures( 1, &screentexture2 );
1972 glTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE );
1974 glEnable(GL_TEXTURE_2D);
1975 glBindTexture( GL_TEXTURE_2D, screentexture2);
1976 glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR );
1977 glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR );
1979 glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 0, 0, kTextureSize, kTextureSize, 0);
1985 glClear(GL_DEPTH_BUFFER_BIT);
1986 ReSizeGLScene(90,.1f);
1987 glViewport(0,0,screenwidth,screenheight);
1989 if(drawmode!=normalmode){
1990 glDisable(GL_DEPTH_TEST);
1991 if(drawmode==motionblurmode){
1992 glDrawBuffer(GL_FRONT);
1993 glReadBuffer(GL_BACK);
1994 //myassert(glGetError() == GL_NO_ERROR);
1997 glColor3f (1.0, 1.0, 1.0); // no coloring
1999 glEnable(GL_TEXTURE_2D);
2000 glBindTexture( GL_TEXTURE_2D, screentexture);
2001 glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE );
2002 glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE );
2003 glDisable(GL_DEPTH_TEST); // Disables Depth Testing
2004 glDisable(GL_CULL_FACE);
2005 glDisable(GL_LIGHTING);
2007 glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
2008 glPushMatrix(); // Store The Projection Matrix
2009 glLoadIdentity(); // Reset The Projection Matrix
2010 glOrtho(0,screenwidth,0,screenheight,-100,100); // Set Up An Ortho Screen
2011 glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
2012 glPushMatrix(); // Store The Modelview Matrix
2013 glLoadIdentity(); // Reset The Modelview Matrix
2014 glScalef((float)screenwidth/2,(float)screenheight/2,1);
2015 glTranslatef(1,1,0);
2016 glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
2018 if(drawmode==motionblurmode){
2019 if(motionbluramount<.2)motionbluramount=.2;
2020 //glColor4f(1,1,1,fast_sqrt(multiplier)*2.9*motionbluramount);
2021 glColor4f(1,1,1,motionbluramount);
2025 glVertex3f(-1, -1, 0.0f);
2026 glTexCoord2f(texcoordwidth,0);
2027 glVertex3f(1, -1, 0.0f);
2028 glTexCoord2f(texcoordwidth,texcoordheight);
2029 glVertex3f(1, 1, 0.0f);
2030 glTexCoord2f(0,texcoordheight);
2031 glVertex3f(-1, 1, 0.0f);
2035 if(drawmode==realmotionblurmode){
2036 glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
2037 glClear(GL_COLOR_BUFFER_BIT);
2038 glBlendFunc(GL_SRC_ALPHA,GL_ONE);
2039 glBindTexture( GL_TEXTURE_2D, screentexture);
2040 glColor4f(1,1,1,.5);
2044 glVertex3f(-1, -1, 0.0f);
2045 glTexCoord2f(texcoordwidth,0);
2046 glVertex3f(1, -1, 0.0f);
2047 glTexCoord2f(texcoordwidth,texcoordheight);
2048 glVertex3f(1, 1, 0.0f);
2049 glTexCoord2f(0,texcoordheight);
2050 glVertex3f(-1, 1, 0.0f);
2053 glBindTexture( GL_TEXTURE_2D, screentexture2);
2054 glColor4f(1,1,1,.5);
2058 glVertex3f(-1, -1, 0.0f);
2059 glTexCoord2f(texcoordwidth,0);
2060 glVertex3f(1, -1, 0.0f);
2061 glTexCoord2f(texcoordwidth,texcoordheight);
2062 glVertex3f(1, 1, 0.0f);
2063 glTexCoord2f(0,texcoordheight);
2064 glVertex3f(-1, 1, 0.0f);
2067 glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
2069 if(drawmode==doublevisionmode){
2070 static float crosseyedness;
2071 crosseyedness=abs(player[0].damage-player[0].superpermanentdamage-(player[0].damagetolerance-player[0].superpermanentdamage)*1/2)/30;
2072 if(crosseyedness>1)crosseyedness=1;
2073 if(crosseyedness<0)crosseyedness=0;
2075 glDisable(GL_BLEND);
2080 glVertex3f(-1, -1, 0.0f);
2081 glTexCoord2f(texcoordwidth,0);
2082 glVertex3f(1, -1, 0.0f);
2083 glTexCoord2f(texcoordwidth,texcoordheight);
2084 glVertex3f(1, 1, 0.0f);
2085 glTexCoord2f(0,texcoordheight);
2086 glVertex3f(-1, 1, 0.0f);
2090 glColor4f(1,1,1,.5);
2093 glTranslatef(.015*crosseyedness,0,0);
2097 glVertex3f(-1, -1, 0.0f);
2098 glTexCoord2f(texcoordwidth,0);
2099 glVertex3f(1, -1, 0.0f);
2100 glTexCoord2f(texcoordwidth,texcoordheight);
2101 glVertex3f(1, 1, 0.0f);
2102 glTexCoord2f(0,texcoordheight);
2103 glVertex3f(-1, 1, 0.0f);
2108 if(drawmode==glowmode){
2109 glColor4f(.5,.5,.5,.5);
2111 glBlendFunc(GL_SRC_ALPHA,GL_ONE);
2113 glTranslatef(.01,0,0);
2116 glVertex3f(-1, -1, 0.0f);
2117 glTexCoord2f(texcoordwidth,0);
2118 glVertex3f(1, -1, 0.0f);
2119 glTexCoord2f(texcoordwidth,texcoordheight);
2120 glVertex3f(1, 1, 0.0f);
2121 glTexCoord2f(0,texcoordheight);
2122 glVertex3f(-1, 1, 0.0f);
2126 glTranslatef(-.01,0,0);
2129 glVertex3f(-1, -1, 0.0f);
2130 glTexCoord2f(texcoordwidth,0);
2131 glVertex3f(1, -1, 0.0f);
2132 glTexCoord2f(texcoordwidth,texcoordheight);
2133 glVertex3f(1, 1, 0.0f);
2134 glTexCoord2f(0,texcoordheight);
2135 glVertex3f(-1, 1, 0.0f);
2139 glTranslatef(.0,.01,0);
2142 glVertex3f(-1, -1, 0.0f);
2143 glTexCoord2f(texcoordwidth,0);
2144 glVertex3f(1, -1, 0.0f);
2145 glTexCoord2f(texcoordwidth,texcoordheight);
2146 glVertex3f(1, 1, 0.0f);
2147 glTexCoord2f(0,texcoordheight);
2148 glVertex3f(-1, 1, 0.0f);
2152 glTranslatef(0,-.01,0);
2155 glVertex3f(-1, -1, 0.0f);
2156 glTexCoord2f(texcoordwidth,0);
2157 glVertex3f(1, -1, 0.0f);
2158 glTexCoord2f(texcoordwidth,texcoordheight);
2159 glVertex3f(1, 1, 0.0f);
2160 glTexCoord2f(0,texcoordheight);
2161 glVertex3f(-1, 1, 0.0f);
2165 if(drawmode==radialzoommode){
2167 //glRotatef((float)i*.1,0,0,1);
2168 glColor4f(1,1,1,1/((float)i+1));
2170 glScalef(1+(float)i*.01,1+(float)i*.01,1);
2173 glVertex3f(-1, -1, 0.0f);
2174 glTexCoord2f(texcoordwidth,0);
2175 glVertex3f(1, -1, 0.0f);
2176 glTexCoord2f(texcoordwidth,texcoordheight);
2177 glVertex3f(1, 1, 0.0f);
2178 glTexCoord2f(0,texcoordheight);
2179 glVertex3f(-1, 1, 0.0f);
2184 glDisable(GL_TEXTURE_2D);
2185 glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
2186 glPopMatrix(); // Restore The Old Projection Matrix
2187 glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
2188 glPopMatrix(); // Restore The Old Projection Matrix
2189 glEnable(GL_DEPTH_TEST); // Enables Depth Testing
2190 glEnable(GL_CULL_FACE);
2191 glDisable(GL_BLEND);
2196 glEnable(GL_TEXTURE_2D);
2201 if(consoleselected>=60)offset=consoleselected-60;
2202 sprintf (string, " ]");
2203 text.glPrint(10,30,string,0,1,1024,768);
2205 sprintf (string, "_");
2206 text.glPrint(30+(float)(consoleselected)*10-offset*10,30,string,0,1,1024,768);
2209 for(j=0;j<consolechars[i];j++){
2210 glColor4f(1,1,1,1-(float)(i)/16);
2211 if(j<consolechars[i]){
2212 sprintf (string, "%c",consoletext[i][j]);
2213 text.glPrint(30+j*10-offset*10,30+i*20,string,0,1,1024,768);
2221 if(freeze||winfreeze||(mainmenu&&gameon)||(!gameon&&gamestarted)||(mainmenu&&gameon)||(!gameon&&gamestarted)||(!gameon&&gamestarted)){
2222 multiplier=tempmult;
2226 glDrawBuffer(GL_BACK);
2227 glReadBuffer(GL_BACK);
2228 glTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE );
2229 ReSizeGLScene(90,.1f);
2232 temptexdetail=texdetail;
2233 if(texdetail>2)texdetail=2;
2234 if(mainmenu!=oldmainmenu&&oldmainmenu!=0){
2236 LoadTexture(":Data:Textures:Newgame.png",&Mainmenuitems[1],0,0);
2237 LoadTexture(":Data:Textures:Quit.png",&Mainmenuitems[3],0,0);
2238 /*if(oldmainmenu==1||oldmainmenu==0){
2239 LoadTexture(":Data:Textures:World.png",&Mainmenuitems[7],0,0);
2240 LoadTexture(":Data:Textures:Options.png",&Mainmenuitems[2],0,0);
2241 LoadTexture(":Data:Textures:Lugaru.png",&Mainmenuitems[0],0,0);
2246 LoadTexture(":Data:Textures:Resume.png",&Mainmenuitems[1],0,0);
2247 LoadTexture(":Data:Textures:Endgame.png",&Mainmenuitems[3],0,0);
2248 /*if(oldmainmenu==2||oldmainmenu==0){
2249 LoadTexture(":Data:Textures:World.png",&Mainmenuitems[7],0,0);
2250 LoadTexture(":Data:Textures:Options.png",&Mainmenuitems[2],0,0);
2251 LoadTexture(":Data:Textures:Lugaru.png",&Mainmenuitems[0],0,0);
2256 if(lastcheck>.5||oldmainmenu!=mainmenu){
2258 // ifstream ipstream(":Data:Campaigns:main.txt");
2259 ifstream ipstream("./Data/Campaigns/main.txt");
2260 //campaignnumlevels=0;
2261 //accountcampaignchoicesmade[accountactive]=0;
2262 ipstream.ignore(256,':');
2263 ipstream >> campaignnumlevels;
2264 for(i=0;i<campaignnumlevels;i++){
2265 ipstream.ignore(256,':');
2266 ipstream.ignore(256,':');
2267 ipstream.ignore(256,' ');
2268 ipstream >> campaignmapname[i];
2269 ipstream.ignore(256,':');
2270 ipstream >> campaigndescription[i];
2272 if(campaigndescription[i][j]=='_')campaigndescription[i][j]=' ';
2274 ipstream.ignore(256,':');
2275 ipstream >> campaignchoosenext[i];
2276 ipstream.ignore(256,':');
2277 ipstream >> campaignnumnext[i];
2278 if(campaignnumnext[i])
2279 for(j=0;j<campaignnumnext[i];j++){
2280 ipstream.ignore(256,':');
2281 ipstream >> campaignnextlevel[i][j];
2282 campaignnextlevel[i][j]-=1;
2284 ipstream.ignore(256,':');
2285 ipstream >> campaignlocationx[i];
2286 //campaignlocationx[i]-=30;
2287 ipstream.ignore(256,':');
2288 ipstream >> campaignlocationy[i];
2289 //campaignlocationy[i]+=30;
2293 for(i=0;i<campaignnumlevels;i++){
2295 levelhighlight[i]=0;
2300 if(accountcampaignchoicesmade[accountactive])
2301 for(i=0;i<accountcampaignchoicesmade[accountactive];i++){
2302 levelorder[i+1]=campaignnextlevel[levelorder[i]][accountcampaignchoices[accountactive][i]];
2303 levelvisible[levelorder[i+1]]=1;
2305 int whichlevelstart;
2306 whichlevelstart=accountcampaignchoicesmade[accountactive]-1;
2307 if(whichlevelstart<0){
2308 accountcampaignscore[accountactive]=0;
2309 accountcampaignfasttime[accountactive]=0;
2310 campaignchoicenum=1;
2311 campaignchoicewhich[0]=0;
2315 campaignchoicenum=campaignnumnext[levelorder[whichlevelstart]];
2316 if(campaignchoicenum==0){
2317 if(accountcampaignscore[accountactive]>accountcampaignhighscore[accountactive])accountcampaignhighscore[accountactive]=accountcampaignscore[accountactive];
2318 if(accountcampaignfasttime[accountactive]==0||accountcampaigntime[accountactive]<accountcampaignfasttime[accountactive])accountcampaignfasttime[accountactive]=accountcampaigntime[accountactive];
2320 if(campaignchoicenum)
2321 for(i=0;i<campaignchoicenum;i++){
2322 campaignchoicewhich[i]=campaignnextlevel[levelorder[whichlevelstart]][i];
2323 levelvisible[campaignnextlevel[levelorder[whichlevelstart]][i]]=1;
2324 levelhighlight[campaignnextlevel[levelorder[whichlevelstart]][i]]=1;
2337 texdetail=temptexdetail;
2339 /*if(mainmenu!=0)*/oldmainmenu=mainmenu;
2341 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){
2342 glClear(GL_DEPTH_BUFFER_BIT);
2343 glEnable(GL_ALPHA_TEST);
2344 glAlphaFunc(GL_GREATER, 0.001f);
2345 glEnable(GL_TEXTURE_2D);
2346 glDisable(GL_DEPTH_TEST); // Disables Depth Testing
2347 glDisable(GL_CULL_FACE);
2348 glDisable(GL_LIGHTING);
2350 glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
2351 glPushMatrix(); // Store The Projection Matrix
2352 glLoadIdentity(); // Reset The Projection Matrix
2353 glOrtho(0,screenwidth,0,screenheight,-100,100); // Set Up An Ortho Screen
2354 glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
2355 glPushMatrix(); // Store The Modelview Matrix
2356 glLoadIdentity(); // Reset The Modelview Matrix
2357 glTranslatef(screenwidth/2,screenheight/2,0);
2359 glScalef((float)screenwidth/2,(float)screenheight/2,1);
2360 glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
2361 glDisable(GL_BLEND);
2362 glColor4f(0,0,0,1.0);
2363 glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP );
2364 glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP );
2365 glDisable(GL_TEXTURE_2D);
2367 //glScalef(.25,.25,.25);
2370 glVertex3f(-1, -1, 0.0f);
2372 glVertex3f(1, -1, 0.0f);
2374 glVertex3f(1, 1, 0.0f);
2376 glVertex3f(-1, 1, 0.0f);
2380 glColor4f(0.4,0.4,0.4,1.0);
2381 glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP );
2382 glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP );
2383 glEnable(GL_TEXTURE_2D);
2384 glBindTexture( GL_TEXTURE_2D, Mainmenuitems[4]);
2386 //glScalef(.25,.25,.25);
2389 glVertex3f(-1, -1, 0.0f);
2391 glVertex3f(1, -1, 0.0f);
2393 glVertex3f(1, 1, 0.0f);
2395 glVertex3f(-1, 1, 0.0f);
2400 glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
2402 glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
2406 if((float)newscreenwidth>(float)newscreenheight*1.61||(float)newscreenwidth<(float)newscreenheight*1.59)sprintf (menustring[0], "Resolution: %d*%d",(int)newscreenwidth,(int)newscreenheight);
2407 else sprintf (menustring[0], "Resolution: %d*%d (widescreen)",(int)newscreenwidth,(int)newscreenheight);
2410 endx[0]=startx[0]+strlen(menustring[0])*10;
2411 endy[0]=starty[0]+20;
2415 if(newdetail==2)sprintf (menustring[1], "Detail: High");
2416 else if(newdetail==1)sprintf (menustring[1], "Detail: Medium");
2417 else sprintf (menustring[1], "Detail: Low");
2420 endx[1]=startx[1]+strlen(menustring[1])*10;
2421 endy[1]=starty[1]+20;
2425 if(bloodtoggle==2)sprintf (menustring[2], "Blood: On, high detail (slower)");
2426 if(bloodtoggle==1)sprintf (menustring[2], "Blood: On, low detail");
2427 if(bloodtoggle==0)sprintf (menustring[2], "Blood: Off");
2430 endx[2]=startx[2]+strlen(menustring[2])*10;
2431 endy[2]=starty[2]+20;
2435 if(difficulty==2)sprintf (menustring[3], "Difficulty: Insane");
2436 if(difficulty==1)sprintf (menustring[3], "Difficulty: Difficult");
2437 if(difficulty==0)sprintf (menustring[3], "Difficulty: Easier");
2438 startx[3]=10+20-1000;
2440 endx[3]=startx[3]+strlen(menustring[3])*10;
2441 endy[3]=starty[3]+20;
2445 if(ismotionblur==1)sprintf (menustring[4], "Blur Effects: Enabled (less compatible)");
2446 if(ismotionblur==0)sprintf (menustring[4], "Blur Effects: Disabled (more compatible)");
2449 endx[4]=startx[4]+strlen(menustring[4])*10;
2450 endy[4]=starty[4]+20;
2454 if(decals==1)sprintf (menustring[5], "Decals: Enabled (slower)");
2455 if(decals==0)sprintf (menustring[5], "Decals: Disabled");
2458 endx[5]=startx[5]+strlen(menustring[5])*10;
2459 endy[5]=starty[5]+20;
2463 if(musictoggle==1)sprintf (menustring[6], "Music: Enabled");
2464 if(musictoggle==0)sprintf (menustring[6], "Music: Disabled");
2467 endx[6]=startx[6]+strlen(menustring[6])*10;
2468 endy[6]=starty[6]+20;
2472 if(invertmouse==1)sprintf (menustring[9], "Invert mouse: Yes");
2473 if(invertmouse==0)sprintf (menustring[9], "Invert mouse: No");
2476 endx[9]=startx[9]+strlen(menustring[9])*10;
2477 endy[9]=starty[9]+20;
2481 sprintf (menustring[10], "Mouse Speed: %d", (int)(usermousesensitivity*5));
2484 endx[10]=startx[10]+strlen(menustring[10])*10;
2485 endy[10]=starty[10]+20;
2489 sprintf (menustring[11], "Volume: %d%", (int)(volume*100));
2492 endx[11]=startx[11]+strlen(menustring[11])*10;
2493 endy[11]=starty[11]+20;
2497 sprintf (menustring[7], "-Configure Controls-");
2500 endx[7]=startx[7]+strlen(menustring[7])*10;
2501 endy[7]=starty[7]+20;
2505 if(newdetail==detail&&newscreenheight==(int)screenheight&&newscreenwidth==(int)screenwidth)sprintf (menustring[8], "Back");
2506 else sprintf (menustring[8], "Back (some changes take effect next time Lugaru is opened)");
2508 endx[8]=startx[8]+strlen(menustring[8])*10;
2510 endy[8]=starty[8]+20;
2517 if(keyselect!=0)sprintf (menustring[0], "Forwards: %s",KeyToChar(forwardkey));
2518 else sprintf (menustring[0], "Forwards: _");
2521 endx[0]=startx[0]+strlen(menustring[0])*10;
2522 endy[0]=starty[0]+20;
2526 if(keyselect!=1)sprintf (menustring[1], "Back: %s",KeyToChar(backkey));
2527 else sprintf (menustring[1], "Back: _");
2530 endx[1]=startx[1]+strlen(menustring[1])*10;
2531 endy[1]=starty[1]+20;
2535 if(keyselect!=2)sprintf (menustring[2], "Left: %s",KeyToChar(leftkey));
2536 else sprintf (menustring[2], "Left: _");
2539 endx[2]=startx[2]+strlen(menustring[2])*10;
2540 endy[2]=starty[2]+20;
2544 if(keyselect!=3)sprintf (menustring[3], "Right: %s",KeyToChar(rightkey));
2545 else sprintf (menustring[3], "Right: _");
2548 endx[3]=startx[3]+strlen(menustring[3])*10;
2549 endy[3]=starty[3]+20;
2553 if(keyselect!=4)sprintf (menustring[4], "Crouch: %s",KeyToChar(crouchkey));
2554 else sprintf (menustring[4], "Crouch: _");
2557 endx[4]=startx[4]+strlen(menustring[4])*10;
2558 endy[4]=starty[4]+20;
2562 if(keyselect!=5)sprintf (menustring[5], "Jump: %s",KeyToChar(jumpkey));
2563 else sprintf (menustring[5], "Jump: _");
2566 endx[5]=startx[5]+strlen(menustring[5])*10;
2567 endy[5]=starty[5]+20;
2571 if(keyselect!=6)sprintf (menustring[6], "Draw: %s",KeyToChar(drawkey));
2572 else sprintf (menustring[6], "Draw: _");
2575 endx[6]=startx[6]+strlen(menustring[6])*10;
2576 endy[6]=starty[6]+20;
2580 if(keyselect!=7)sprintf (menustring[7], "Throw: %s",KeyToChar(throwkey));
2581 else sprintf (menustring[7], "Throw: _");
2584 endx[7]=startx[7]+strlen(menustring[7])*10;
2585 endy[7]=starty[7]+20;
2589 if(keyselect!=8)sprintf (menustring[8], "Attack: %s",KeyToChar(attackkey));
2590 else sprintf (menustring[8], "Attack: _");
2593 endx[8]=startx[8]+strlen(menustring[8])*10;
2594 endy[8]=starty[8]+20;
2600 sprintf (menustring[9], "Back");
2602 endx[9]=startx[9]+strlen(menustring[9])*10;
2604 endy[9]=starty[9]+20;
2609 nummenuitems=7+accountcampaignchoicesmade[accountactive]+campaignchoicenum;
2611 sprintf (menustring[0], "%s",accountname[accountactive]);
2614 endx[0]=startx[0]+strlen(menustring[0])*10;
2615 endy[0]=starty[0]+20;
2619 sprintf (menustring[1], "Tutorial");
2622 endx[1]=startx[1]+strlen(menustring[1])*10;
2623 endy[1]=starty[1]+20;
2627 sprintf (menustring[2], "Challenge");
2630 endx[2]=startx[2]+strlen(menustring[2])*10;
2631 endy[2]=starty[2]+20;
2635 sprintf (menustring[3], "Delete User");
2638 endx[3]=startx[3]+strlen(menustring[3])*10;
2639 endy[3]=starty[3]+20;
2643 sprintf (menustring[4], "Main Menu");
2646 endx[4]=startx[4]+strlen(menustring[4])*10;
2647 endy[4]=starty[4]+20;
2651 sprintf (menustring[5], "Change User");
2653 endx[5]=startx[5]+strlen(menustring[5])*10;
2655 endy[5]=starty[5]+20;
2661 sprintf (menustring[6], "World");
2663 starty[6]=30+480-400-50;
2664 endx[6]=startx[6]+400;
2669 if(accountcampaignchoicesmade[accountactive])
2670 for(i=0;i<accountcampaignchoicesmade[accountactive];i++){
2671 sprintf (menustring[7+i], campaigndescription[levelorder[i]]);
2672 startx[7+i]=30+120+campaignlocationx[levelorder[i]]*400/512;
2673 starty[7+i]=30+30+(512-campaignlocationy[levelorder[i]])*400/512;
2674 endx[7+i]=startx[7+i]+10;
2675 endy[7+i]=starty[7+i]+10;
2680 if(campaignchoicenum>0)
2681 for(i=accountcampaignchoicesmade[accountactive];i<accountcampaignchoicesmade[accountactive]+campaignchoicenum;i++){
2682 sprintf (menustring[7+i], campaigndescription[levelorder[i]]);
2683 startx[7+i]=30+120+campaignlocationx[campaignchoicewhich[i-(accountcampaignchoicesmade[accountactive])]]*400/512;
2684 starty[7+i]=30+30+(512-campaignlocationy[campaignchoicewhich[i-(accountcampaignchoicesmade[accountactive])]])*400/512;
2685 endx[7+i]=startx[7+i]+10;
2686 endy[7+i]=starty[7+i]+10;
2691 /*sprintf (menustring[7], "Dot");
2692 startx[7]=120+260*400/512;
2693 starty[7]=30+(512-184)*400/512;
2694 endx[7]=startx[7]+10;
2695 endy[7]=starty[7]+10;
2699 sprintf (menustring[8], "Dot");
2700 startx[8]=120+129*400/512;
2701 starty[8]=30+(512-284)*400/512;
2702 endx[8]=startx[8]+10;
2703 endy[8]=starty[8]+10;
2707 sprintf (menustring[9], "Dot");
2708 startx[9]=120+358*400/512;
2709 starty[9]=30+(512-235)*400/512;
2710 endx[9]=startx[9]+10;
2711 endy[9]=starty[9]+10;
2715 sprintf (menustring[10], "Dot");
2716 startx[10]=120+359*400/512;
2717 starty[10]=30+(512-308)*400/512;
2718 endx[10]=startx[10]+10;
2719 endy[10]=starty[10]+10;
2723 sprintf (menustring[11], "Dot");
2724 startx[11]=120+288*400/512;
2725 starty[11]=30+(512-277)*400/512;
2726 endx[11]=startx[11]+10;
2727 endy[11]=starty[11]+10;
2735 sprintf (menustring[0], "Are you sure you want to delete this user?");
2738 endx[0]=startx[0]+strlen(menustring[0])*10;
2739 endy[0]=starty[0]+20;
2743 sprintf (menustring[1], "Yes");
2746 endx[1]=startx[1]+strlen(menustring[1])*10;
2747 endy[1]=starty[1]+20;
2751 sprintf (menustring[2], "No");
2754 endx[2]=startx[2]+strlen(menustring[2])*10;
2755 endy[2]=starty[2]+20;
2759 sprintf (menustring[3], "Extra 4");
2762 endx[3]=startx[3]+strlen(menustring[3])*10;
2763 endy[3]=starty[3]+20;
2767 sprintf (menustring[4], "Extra 5");
2770 endx[4]=startx[4]+strlen(menustring[4])*10;
2771 endy[4]=starty[4]+20;
2775 sprintf (menustring[5], "Back");
2777 endx[5]=startx[5]+strlen(menustring[5])*10;
2779 endy[5]=starty[5]+20;
2785 nummenuitems=numaccounts+2;
2790 sprintf (menustring[0], "New User");
2792 sprintf (menustring[0], "No More Users");
2795 endx[0]=startx[0]+strlen(menustring[0])*10;
2796 endy[0]=starty[0]+20;
2800 if(entername)startx[0]+=10;
2805 for(i=0;i<numaccounts;i++){
2806 sprintf (menustring[num], "%s",accountname[i]);
2808 starty[num]=360-20-20*num;
2809 endx[num]=startx[num]+strlen(menustring[num])*10;
2810 endy[num]=starty[num]+20;
2817 sprintf (menustring[num], "Back");
2819 endx[num]=startx[num]+strlen(menustring[num])*10;
2821 endy[num]=starty[num]+20;
2828 sprintf (menustring[0], "Easier");
2831 endx[0]=startx[0]+strlen(menustring[0])*10;
2832 endy[0]=starty[0]+20;
2836 sprintf (menustring[1], "Difficult");
2839 endx[1]=startx[1]+strlen(menustring[1])*10;
2840 endy[1]=starty[1]+20;
2844 sprintf (menustring[2], "Insane");
2847 endx[2]=startx[2]+strlen(menustring[2])*10;
2848 endy[2]=starty[2]+20;
2854 //tempncl=numchallengelevels;
2855 //numchallengelevels=9;
2856 nummenuitems=2+numchallengelevels;
2859 for(j=0;j<numchallengelevels;j++){
2860 for(i=0;i<255;i++)menustring[j][i]='\0';
2861 sprintf (temp, "Level %d",j+1);
2862 strcpy(menustring[j],temp);
2863 for(i=0;i<17;i++)if(menustring[j][i]=='\0')menustring[j][i]=' ';
2864 menustring[j][17]='\0';
2865 sprintf (temp, "%d",(int)accounthighscore[accountactive][j]);
2866 strcat(menustring[j],temp);
2867 for(i=18;i<32;i++)if(menustring[j][i]=='\0')menustring[j][i]=' ';
2868 menustring[j][32]='\0';
2869 sprintf (temp, "%d:",(int)(((int)accountfasttime[accountactive][j]-(int)(accountfasttime[accountactive][j])%60)/60));
2870 strcat(menustring[j],temp);
2871 if((int)(accountfasttime[accountactive][j])%60<10)strcat(menustring[j],"0");
2872 sprintf (temp, "%d",(int)(accountfasttime[accountactive][j])%60);
2873 strcat(menustring[j],temp);
2877 endx[j]=startx[j]+strlen(menustring[j])*10;
2878 endy[j]=starty[j]+20;
2883 sprintf (menustring[numchallengelevels], "Back");
2884 startx[numchallengelevels]=10;
2885 endx[numchallengelevels]=startx[numchallengelevels]+strlen(menustring[numchallengelevels])*10;
2886 starty[numchallengelevels]=10;
2887 endy[numchallengelevels]=starty[numchallengelevels]+20;
2888 movex[numchallengelevels]=0;
2889 movey[numchallengelevels]=0;
2891 sprintf (menustring[numchallengelevels+1], " High Score Best Time");
2892 startx[numchallengelevels+1]=10;
2893 starty[numchallengelevels+1]=440;
2894 endx[numchallengelevels+1]=startx[numchallengelevels+1]+strlen(menustring[numchallengelevels+1])*10;
2895 endy[numchallengelevels+1]=starty[numchallengelevels+1]+20;
2896 movex[numchallengelevels+1]=0;
2897 movey[numchallengelevels+1]=0;
2899 //numchallengelevels=tempncl;
2903 nummenuitems=2+numchallengelevels;
2906 for(j=0;j<numchallengelevels;j++){
2907 for(i=0;i<255;i++)menustring[j][i]='\0';
2908 sprintf (temp, "Level %d",j+1);
2909 strcpy(menustring[j],temp);
2910 for(i=0;i<17;i++)if(menustring[j][i]=='\0')menustring[j][i]=' ';
2911 menustring[j][17]='\0';
2912 sprintf (temp, "%d",(int)accounthighscore[accountactive][j]);
2913 strcat(menustring[j],temp);
2914 for(i=18;i<32;i++)if(menustring[j][i]=='\0')menustring[j][i]=' ';
2915 menustring[j][32]='\0';
2916 sprintf (temp, "%d:",(int)(((int)accountfasttime[accountactive][j]-(int)(accountfasttime[accountactive][j])%60)/60));
2917 strcat(menustring[j],temp);
2918 if((int)(accountfasttime[accountactive][j])%60<10)strcat(menustring[j],"0");
2919 sprintf (temp, "%d",(int)(accountfasttime[accountactive][j])%60);
2920 strcat(menustring[j],temp);
2924 endx[j]=startx[j]+strlen(menustring[j])*10;
2925 endy[j]=starty[j]+20;
2930 sprintf (menustring[numchallengelevels], "Back");
2931 startx[numchallengelevels]=10;
2932 endx[numchallengelevels]=startx[numchallengelevels]+strlen(menustring[numchallengelevels])*10;
2933 starty[numchallengelevels]=10;
2934 endy[numchallengelevels]=starty[numchallengelevels]+20;
2935 movex[numchallengelevels]=0;
2936 movey[numchallengelevels]=0;
2938 sprintf (menustring[numchallengelevels+1], " High Score Best Time");
2939 startx[numchallengelevels+1]=10;
2940 starty[numchallengelevels+1]=400;
2941 endx[numchallengelevels+1]=startx[numchallengelevels+1]+strlen(menustring[numchallengelevels+1])*10;
2942 endy[numchallengelevels+1]=starty[numchallengelevels+1]+20;
2943 movex[numchallengelevels+1]=0;
2944 movey[numchallengelevels+1]=0;
2951 sprintf (menustring[0], "Congratulations!");
2954 endx[0]=startx[0]+strlen(menustring[0])*10;
2955 endy[0]=starty[0]+20;
2959 sprintf (menustring[1], "You have avenged your family and");
2962 endx[1]=startx[1]+strlen(menustring[1])*10;
2963 endy[1]=starty[1]+20;
2967 sprintf (menustring[2], "restored peace to the island of Lugaru.");
2970 endx[2]=startx[2]+strlen(menustring[2])*10;
2971 endy[2]=starty[2]+20;
2975 sprintf (menustring[3], "Back");
2977 endx[3]=startx[3]+strlen(menustring[3])*10;
2979 endy[3]=starty[3]+20;
2983 for(i=0;i<255;i++)menustring[4][i]='\0';
2984 sprintf (temp, "Your score:");
2985 strcpy(menustring[4],temp);
2986 for(i=0;i<20;i++)if(menustring[4][i]=='\0')menustring[4][i]=' ';
2987 menustring[4][20]='\0';
2988 sprintf (temp, "%d",(int)accountcampaignscore[accountactive]);
2989 strcat(menustring[4],temp);
2991 endx[4]=startx[4]+strlen(menustring[4])*10;
2993 endy[4]=starty[4]+20;
2997 for(i=0;i<255;i++)menustring[5][i]='\0';
2998 sprintf (temp, "Your time:");
2999 strcpy(menustring[5],temp);
3000 for(i=0;i<20;i++)if(menustring[5][i]=='\0')menustring[5][i]=' ';
3001 menustring[5][20]='\0';
3002 sprintf (temp, "%d",(int)accountcampaigntime[accountactive]);
3003 strcat(menustring[5],temp);
3005 endx[5]=startx[5]+strlen(menustring[5])*10;
3007 endy[5]=starty[5]+20;
3011 for(i=0;i<255;i++)menustring[5][i]='\0';
3012 sprintf (temp, "Highest score:");
3013 strcpy(menustring[5],temp);
3014 for(i=0;i<20;i++)if(menustring[5][i]=='\0')menustring[5][i]=' ';
3015 menustring[5][20]='\0';
3016 sprintf (temp, "%d",(int)accountcampaignhighscore[accountactive]);
3017 strcat(menustring[5],temp);
3019 endx[5]=startx[5]+strlen(menustring[5])*10;
3021 endy[5]=starty[5]+20;
3025 for(i=0;i<255;i++)menustring[7][i]='\0';
3026 sprintf (temp, "Lowest time:");
3027 strcpy(menustring[7],temp);
3028 for(i=0;i<20;i++)if(menustring[7][i]=='\0')menustring[7][i]=' ';
3029 menustring[7][20]='\0';
3030 sprintf (temp, "%d",(int)accountcampaignfasttime[accountactive]);
3031 strcat(menustring[7],temp);
3033 endx[7]=startx[7]+strlen(menustring[7])*10;
3035 endy[7]=starty[7]+20;
3042 menupulse+=multiplier*2;
3047 sprintf (menustring[0], "Register now for only $19.95!");
3050 endx[0]=startx[0]+strlen(menustring[0])*10;
3051 endy[0]=starty[0]+20;
3055 sprintf (menustring[1], "Confront raiders, wolves, and more!");
3058 endx[1]=startx[1]+strlen(menustring[1])*10;
3059 endy[1]=starty[1]+20;
3063 sprintf (menustring[2], "Fight using swords, staves and armor!");
3066 endx[2]=startx[2]+strlen(menustring[2])*10;
3067 endy[2]=starty[2]+20;
3071 if(!tryquit)sprintf (menustring[3], "Back");
3072 else sprintf (menustring[3], "Quit");
3074 endx[3]=startx[3]+strlen(menustring[3])*10;
3076 endy[3]=starty[3]+20;
3080 sprintf (menustring[4], "Register now!");
3082 endx[4]=startx[4]+strlen(menustring[4])*10;
3084 endy[4]=starty[4]+20;
3088 sprintf (menustring[5], "Enter registration code!");
3090 endx[5]=startx[5]+strlen(menustring[5])*10;
3092 endy[5]=starty[5]+20;
3101 sprintf (menustring[0], "Thank you for supporting Wolfire Software!");
3104 endx[0]=startx[0]+strlen(menustring[0])*10;
3105 endy[0]=starty[0]+20;
3109 sprintf (menustring[1], "Back");
3111 endx[1]=startx[1]+strlen(menustring[1])*10;
3113 endy[1]=starty[1]+20;
3122 sprintf (menustring[0], "Sorry, that name/serial number combination is incorrect.");
3125 endx[0]=startx[0]+strlen(menustring[0])*10;
3126 endy[0]=starty[0]+20;
3130 sprintf (menustring[1], "Back");
3132 endx[1]=startx[1]+strlen(menustring[1])*10;
3134 endy[1]=starty[1]+20;
3138 sprintf (menustring[2], "Please make sure you are copying your name and serial");
3141 endx[2]=startx[2]+strlen(menustring[2])*10;
3142 endy[2]=starty[2]+20;
3146 sprintf (menustring[3], "number exactly as they appear in your email.");
3149 endx[3]=startx[3]+strlen(menustring[3])*10;
3150 endy[3]=starty[3]+20;
3154 sprintf (menustring[4], "Capitalization and punctuation matter!");
3157 endx[4]=startx[4]+strlen(menustring[4])*10;
3158 endy[4]=starty[4]+20;
3167 sprintf (menustring[0], "Please enter your name:");
3170 endx[0]=startx[0]+strlen(menustring[0])*10;
3171 endy[0]=starty[0]+20;
3175 sprintf (menustring[1], "Please enter your name:");
3178 endx[1]=startx[1]+strlen(menustring[1])*10;
3179 endy[1]=starty[1]+20;
3188 sprintf (menustring[0], "Please enter your number:");
3191 endx[0]=startx[0]+strlen(menustring[0])*10;
3192 endy[0]=starty[0]+20;
3196 sprintf (menustring[1], "Please enter your name:");
3199 endx[1]=startx[1]+strlen(menustring[1])*10;
3200 endy[1]=starty[1]+20;
3204 char tempstring[256];
3205 sprintf (tempstring, "%s", registrationname);
3211 longnum = MD5_string ( tempstring);
3212 //longnum = 1111111111111111;
3213 num1 = longnum/100000000;
3214 num2 = longnum%100000000;
3215 sprintf (tempstring, "%d-%d-%d-%d", num1/10000, num1%10000, num2/10000, num2%10000);
3217 sprintf (menustring[2], "%s", tempstring);
3220 endx[2]=startx[2]+strlen(menustring[2])*10;
3221 endy[2]=starty[2]+20;
3226 if(mainmenu==1||mainmenu==2){
3236 starty[1]=480-152-32;
3243 starty[2]=480-228-32;
3251 starty[3]=480-306-32;
3260 starty[3]=480-306-32;
3274 starty[4]=480-140-256;
3281 starty[5]=480-138-256;
3288 starty[6]=480-144-256;
3296 starty[4]=480-140-256;
3303 starty[5]=480-138-256;
3310 starty[6]=480-144-256;
3318 starty[4]=480-140-256;
3325 starty[5]=480-150-256;
3332 starty[6]=480-144-256;
3340 starty[4]=480-140-256;
3347 starty[5]=480-150-256;
3354 starty[6]=480-144-256;
3362 starty[4]=480-100-256;
3369 starty[5]=480-120-256;
3376 starty[6]=480-144-256;
3386 if(mainmenu==1||mainmenu==2)
3388 if((mousecoordh/screenwidth*640)>startx[i]&&(mousecoordh/screenwidth*640)<endx[i]&&480-(mousecoordv/screenheight*480)>starty[i]&&480-(mousecoordv/screenheight*480)<endy[i]){
3393 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)
3394 for(i=0;i<nummenuitems;i++){
3395 if((mousecoordh/screenwidth*640)>startx[i]&&(mousecoordh/screenwidth*640)<endx[i]&&480-(mousecoordv/screenheight*480)>starty[i]&&480-(mousecoordv/screenheight*480)<endy[i]){
3396 if(mainmenu!=5)selected=i;
3397 if(mainmenu==5&&(i!=0&&i!=6))selected=i;
3398 if(mainmenu==9&&(i!=numchallengelevels+1))selected=i;
3399 if(mainmenu==11&&(i!=numchallengelevels+1))selected=i;
3404 for(i=0;i<nummenuitems;i++){
3405 if(selected==i)selectedlong[i]+=multiplier*5;
3406 if(selectedlong[i]>1)selectedlong[i]=1;
3407 if(selected!=i)selectedlong[i]-=multiplier*5;
3408 if(selectedlong[i]<0)selectedlong[i]=0;
3409 //if(i>=4)selectedlong[i]=.3;
3410 if(i>=4&&(mainmenu==1||mainmenu==2))selectedlong[i]=0;
3414 for(i=0;i<nummenuitems;i++){
3415 offsetx[i]=(startx[i]+endx[i])/2-(mousecoordh/screenwidth*640);
3416 offsety[i]=(starty[i]+endy[i])/2-(480-(mousecoordv/screenheight*480));
3421 if(i>=4&&(mainmenu==1||mainmenu==2)){
3422 offsetx[i]=(startx[i]+endx[i]+movex[i]*transition)/2-(640+190)/2;
3423 offsety[i]=(starty[i]+endy[i]+movey[i]*transition)/2-(336+150)/2;
3429 if(mainmenu==1||mainmenu==2){
3430 glClear(GL_DEPTH_BUFFER_BIT);
3431 glEnable(GL_ALPHA_TEST);
3432 glAlphaFunc(GL_GREATER, 0.001f);
3433 glEnable(GL_TEXTURE_2D);
3434 glDisable(GL_DEPTH_TEST); // Disables Depth Testing
3435 glDisable(GL_CULL_FACE);
3436 glDisable(GL_LIGHTING);
3438 glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
3439 glPushMatrix(); // Store The Projection Matrix
3440 glLoadIdentity(); // Reset The Projection Matrix
3441 glOrtho(0,screenwidth,0,screenheight,-100,100); // Set Up An Ortho Screen
3442 glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
3443 glPushMatrix(); // Store The Modelview Matrix
3444 glLoadIdentity(); // Reset The Modelview Matrix
3445 glTranslatef(screenwidth/2,screenheight/2,0);
3447 glScalef((float)screenwidth/2,(float)screenheight/2,1);
3448 glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
3449 glDisable(GL_BLEND);
3450 glColor4f(0,0,0,1.0);
3451 glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP );
3452 glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP );
3453 glDisable(GL_TEXTURE_2D);
3455 //glScalef(.25,.25,.25);
3458 glVertex3f(-1, -1, 0.0f);
3460 glVertex3f(1, -1, 0.0f);
3462 glVertex3f(1, 1, 0.0f);
3464 glVertex3f(-1, 1, 0.0f);
3468 glColor4f(0.4,0.4,0.4,1.0);
3469 glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP );
3470 glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP );
3471 glEnable(GL_TEXTURE_2D);
3472 glBindTexture( GL_TEXTURE_2D, Mainmenuitems[4]);
3474 //glScalef(.25,.25,.25);
3477 glVertex3f(-1, -1, 0.0f);
3479 glVertex3f(1, -1, 0.0f);
3481 glVertex3f(1, 1, 0.0f);
3483 glVertex3f(-1, 1, 0.0f);
3488 glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
3491 glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
3492 glPushMatrix(); // Store The Projection Matrix
3493 glLoadIdentity(); // Reset The Projection Matrix
3494 glOrtho(0,640,0,480,-100,100); // Set Up An Ortho Screen
3495 glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
3496 glPushMatrix(); // Store The Modelview Matrix
3497 glLoadIdentity(); // Reset The Modelview Matrix
3499 glDisable(GL_TEXTURE_2D);
3504 if(anim!=1)glVertex3f(190, 150, 0.0f);
3505 if(anim==1)glVertex3f(190+movex[4]*transition, 150, 0.0f);
3507 glVertex3f(640, 150, 0.0f);
3509 glVertex3f(640, 336, 0.0f);
3511 if(anim!=1)glVertex3f(190, 336, 0.0f);
3512 if(anim==1)glVertex3f(190+movex[4]*transition, 336, 0.0f);
3517 glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
3519 glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
3523 glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
3524 glPushMatrix(); // Store The Projection Matrix
3525 glLoadIdentity(); // Reset The Projection Matrix
3526 glOrtho(0,640,0,480,-100,100); // Set Up An Ortho Screen
3527 glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
3528 glPushMatrix(); // Store The Modelview Matrix
3529 glLoadIdentity(); // Reset The Modelview Matrix
3530 glEnable(GL_TEXTURE_2D);
3533 for(j=0;j<nummenuitems;j++)
3535 if(j<=3||(mainmenu!=1&&mainmenu!=2))
3537 //glDisable(GL_BLEND);
3538 glEnable(GL_ALPHA_TEST);
3540 //glDisable(GL_ALPHA_TEST);
3541 glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
3542 if(mainmenu==1||mainmenu==2)
3545 glBlendFunc(GL_SRC_ALPHA,GL_ONE);
3546 glBindTexture( GL_TEXTURE_2D, Mainmenuitems[j]);
3547 glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE );
3548 glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE );
3549 glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
3553 glVertex3f(startx[j]+movex[j]*transition, starty[j]+movey[j]*transition, 0.0f);
3555 glVertex3f(endx[j]+movex[j]*transition, starty[j]+movey[j]*transition, 0.0f);
3557 glVertex3f(endx[j]+movex[j]*transition, endy[j]+movey[j]*transition, 0.0f);
3559 glVertex3f(startx[j]+movex[j]*transition, endy[j]+movey[j]*transition, 0.0f);
3563 //glDisable(GL_ALPHA_TEST);
3564 if(j<4)glBlendFunc(GL_SRC_ALPHA,GL_ONE);
3567 if(1-((float)i)/10-(1-selectedlong[j])>0)
3569 glColor4f(1,1,1,(1-((float)i)/10-(1-selectedlong[j]))*.25);
3570 glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
3574 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);
3576 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);
3578 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);
3580 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);
3586 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)
3588 if(mainmenu!=5||j<6)
3591 if(mainmenu==12&&j==4)glColor4f(1,(sin(menupulse)+1)/2,(sin(menupulse)+1)/2,1);
3592 if(mainmenu==9&&j>accountprogress[accountactive]&&j<numchallengelevels)glColor4f(0.5,0,0,1);
3593 if(mainmenu==11&&j>accountprogress[accountactive]&&j<numchallengelevels)glColor4f(0.5,0,0,1);
3594 //if(1-((float)i)/10-(1-selectedlong[j])>0){
3595 glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
3597 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);
3601 sprintf (string, "_");
3602 text.glPrint(startx[j]+(float)(displayselected)*10,starty[j],string,0,1,640,480);
3605 for(l=0;l<displaychars[k];l++){
3606 if(l<displaychars[k]){
3607 sprintf (string, "%c",displaytext[k][l]);
3608 text.glPrint(startx[j]+l*10,starty[j],string,0,1,640,480);
3616 sprintf (string, "Hooo!");
3617 text.glPrint(startx[0],starty[0],string,0,1,640,480);
3621 glBlendFunc(GL_SRC_ALPHA,GL_ONE);
3624 if(1-((float)i)/15-(1-selectedlong[j])>0)
3626 glColor4f(1,0,0,(1-((float)i)/10-(1-selectedlong[j]))*.25);
3627 if(mainmenu==12&&j==4)glColor4f(1,(sin(menupulse)+1)/2,(sin(menupulse)+1)/2,(1-((float)i)/10-(1-selectedlong[j]))*.25);
3628 if(mainmenu==9&&j>accountprogress[accountactive]&&j<numchallengelevels)glColor4f(0.5,0,0,(1-((float)i)/10-(1-selectedlong[j]))*.25);
3629 if(mainmenu==11&&j>accountprogress[accountactive]&&j<numchallengelevels)glColor4f(0.5,0,0,(1-((float)i)/10-(1-selectedlong[j]))*.25);
3630 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);
3631 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);
3632 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);
3633 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);
3634 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);
3635 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);
3636 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);
3637 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);
3638 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);
3639 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);
3640 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);
3641 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);
3642 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);
3643 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);
3644 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);
3647 sprintf (string, "_");
3648 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);
3651 for(l=0;l<displaychars[k];l++){
3652 if(l<displaychars[k]){
3653 sprintf (string, "%c",displaytext[k][l]);
3654 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);
3663 glClear(GL_DEPTH_BUFFER_BIT);
3664 glEnable(GL_ALPHA_TEST);
3665 glAlphaFunc(GL_GREATER, 0.001f);
3666 glEnable(GL_TEXTURE_2D);
3667 glDisable(GL_DEPTH_TEST); // Disables Depth Testing
3668 glDisable(GL_CULL_FACE);
3669 glDisable(GL_LIGHTING);
3670 if(j==6)glColor4f(1,1,1,1);
3671 else glColor4f(1,0,0,1);
3673 glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
3674 glPushMatrix(); // Store The Projection Matrix
3675 glLoadIdentity(); // Reset The Projection Matrix
3676 glOrtho(0,640,0,480,-100,100); // Set Up An Ortho Screen
3677 glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
3678 glPushMatrix(); // Store The Modelview Matrix
3679 glLoadIdentity(); // Reset The Modelview Matrix
3682 //Draw world, draw map
3683 glTranslatef(2,-5,0);
3685 if(j>6&&j<nummenuitems-1)
3687 XYZ linestart,lineend,offset;
3694 //float linestartx,lineendx,linestarty,lineendy,offsetx,offsety;
3695 linestart.x=(startx[j]+endx[j])/2;
3696 linestart.y=(starty[j]+endy[j])/2;
3697 if(j>=6+accountcampaignchoicesmade[accountactive]){
3698 linestart.x=(startx[6+accountcampaignchoicesmade[accountactive]]+endx[6+accountcampaignchoicesmade[accountactive]])/2;
3699 linestart.y=(starty[6+accountcampaignchoicesmade[accountactive]]+endy[6+accountcampaignchoicesmade[accountactive]])/2;
3701 lineend.x=(startx[j+1]+endx[j+1])/2;
3702 lineend.y=(starty[j+1]+endy[j+1])/2;
3703 offset=lineend-linestart;
3706 offset=DoRotation(offset,0,0,90);
3708 glDisable(GL_TEXTURE_2D);
3710 if(j<6+accountcampaignchoicesmade[accountactive]){
3711 glColor4f(0.5,0,0,1);
3715 if(j>=6+accountcampaignchoicesmade[accountactive]){
3721 linestart+=fac*4*startsize;
3722 lineend-=fac*4*endsize;
3724 if(!(j>7+accountcampaignchoicesmade[accountactive]+campaignchoicenum)){
3725 glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
3729 glVertex3f(linestart.x-offset.x*startsize, linestart.y-offset.y*startsize, 0.0f);
3731 glVertex3f(linestart.x+offset.x*startsize, linestart.y+offset.y*startsize, 0.0f);
3733 glVertex3f(lineend.x+offset.x*endsize, lineend.y+offset.y*endsize, 0.0f);
3735 glVertex3f(lineend.x-offset.x*endsize, lineend.y-offset.y*endsize, 0.0f);
3739 glEnable(GL_TEXTURE_2D);
3743 if(j==6)glBindTexture( GL_TEXTURE_2D, Mainmenuitems[7]);
3744 else glBindTexture( GL_TEXTURE_2D, Mapcircletexture);
3745 glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE );
3746 glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE );
3747 if(j-7<accountcampaignchoicesmade[accountactive])glColor4f(0.5,0,0,1);
3748 if(j-7>=accountcampaignchoicesmade[accountactive])glColor4f(1,0,0,1);
3749 if(j==6)glColor4f(1,1,1,1);
3752 itemsize=abs(startx[j]-endx[j])/2;
3754 midpoint.x=(startx[j]+endx[j])/2;
3755 midpoint.y=(starty[j]+endy[j])/2;
3756 if(j>6&&(j-7<accountcampaignchoicesmade[accountactive]))itemsize*=.5;
3757 if(!(j-7>accountcampaignchoicesmade[accountactive]+campaignchoicenum))
3759 glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
3763 glVertex3f(midpoint.x-itemsize+movex[j]*transition, midpoint.y-itemsize+movey[j]*transition, 0.0f);
3765 glVertex3f(midpoint.x+itemsize+movex[j]*transition, midpoint.y-itemsize+movey[j]*transition, 0.0f);
3767 glVertex3f(midpoint.x+itemsize+movex[j]*transition, midpoint.y+itemsize+movey[j]*transition, 0.0f);
3769 glVertex3f(midpoint.x-itemsize+movex[j]*transition, midpoint.y+itemsize+movey[j]*transition, 0.0f);
3773 //glDisable(GL_ALPHA_TEST);
3774 if(j<4)glBlendFunc(GL_SRC_ALPHA,GL_ONE);
3777 if(1-((float)i)/10-(1-selectedlong[j])>0)
3779 glColor4f(1,0,0,(1-((float)i)/10-(1-selectedlong[j]))*.25);
3780 glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
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);
3786 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);
3788 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);
3790 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);
3798 glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
3800 glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
3802 if(j-7>=accountcampaignchoicesmade[accountactive]){
3803 //glColor4f(0,0,0,1);
3804 //text.glPrintOutline(startx[j]+10-1.5,starty[j]-4-1.5,menustring[j],0,0.6*1.25,640,480);
3805 //glColor4f(1,0,0,1);
3806 //text.glPrint(startx[j]+10,starty[j]-4,menustring[j],0,0.6,640,480);
3807 text.glPrintOutlined(0.9,0,0,startx[j]+10,starty[j]-4,menustring[j],0,0.6,640,480);
3808 glDisable(GL_DEPTH_TEST);
3815 glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
3817 glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
3820 if(mainmenu==1||mainmenu==2)
3821 if(transition<.1||transition>.9){
3822 glClear(GL_DEPTH_BUFFER_BIT);
3823 glEnable(GL_ALPHA_TEST);
3824 glAlphaFunc(GL_GREATER, 0.001f);
3825 glEnable(GL_TEXTURE_2D);
3826 glDisable(GL_DEPTH_TEST); // Disables Depth Testing
3827 glDisable(GL_CULL_FACE);
3828 glDisable(GL_LIGHTING);
3830 glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
3831 glPushMatrix(); // Store The Projection Matrix
3832 glLoadIdentity(); // Reset The Projection Matrix
3833 glOrtho(0,640,0,480,-100,100); // Set Up An Ortho Screen
3834 glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
3835 glPushMatrix(); // Store The Modelview Matrix
3836 glLoadIdentity(); // Reset The Modelview Matrix
3838 glDisable(GL_TEXTURE_2D);
3839 if(transition<.1)glColor4f(1,0,0,1-(transition*10));
3840 if(transition>.9)glColor4f(1,0,0,1-((1-transition)*10));
3844 glVertex3f(190, 150, 0.0f);
3846 glVertex3f(640, 150, 0.0f);
3848 glVertex3f(640, 336, 0.0f);
3850 glVertex3f(190, 336, 0.0f);
3855 glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
3859 glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
3860 glPushMatrix(); // Store The Projection Matrix
3861 glLoadIdentity(); // Reset The Projection Matrix
3862 glOrtho(0,screenwidth,0,screenheight,-100,100); // Set Up An Ortho Screen
3863 glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
3864 glPushMatrix(); // Store The Modelview Matrix
3865 glLoadIdentity(); // Reset The Modelview Matrix
3866 glTranslatef(screenwidth/2,screenheight/2,0);
3868 glScalef((float)screenwidth/2,(float)screenheight/2,1);
3869 glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
3871 glEnable(GL_TEXTURE_2D);
3873 glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP );
3874 glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP );
3877 glTranslatef(mousecoordh-screenwidth/2,mousecoordv*-1+screenheight/2,0);
3878 glScalef((float)screenwidth/64,(float)screenwidth/64,1);
3879 glTranslatef(1,-1,0);
3880 glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
3882 glBindTexture( GL_TEXTURE_2D, cursortexture);
3884 //glScalef(.25,.25,.25);
3887 glVertex3f(-1, -1, 0.0f);
3889 glVertex3f(1, -1, 0.0f);
3891 glVertex3f(1, 1, 0.0f);
3893 glVertex3f(-1, 1, 0.0f);
3898 glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
3904 if(flashamount>1)flashamount=1;
3905 if(flashdelay<=0)flashamount-=multiplier;
3907 if(flashamount<0)flashamount=0;
3908 glDisable(GL_DEPTH_TEST); // Disables Depth Testing
3909 glDisable(GL_CULL_FACE);
3910 glDisable(GL_LIGHTING);
3911 glDisable(GL_TEXTURE_2D);
3913 glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
3914 glPushMatrix(); // Store The Projection Matrix
3915 glLoadIdentity(); // Reset The Projection Matrix
3916 glOrtho(0,screenwidth,0,screenheight,-100,100); // Set Up An Ortho Screen
3917 glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
3918 glPushMatrix(); // Store The Modelview Matrix
3919 glLoadIdentity(); // Reset The Modelview Matrix
3920 glScalef(screenwidth,screenheight,1);
3921 glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
3923 glColor4f(flashr,flashg,flashb,flashamount);
3925 glVertex3f(0, 0, 0.0f);
3926 glVertex3f(256, 0, 0.0f);
3927 glVertex3f(256, 256, 0.0f);
3928 glVertex3f(0, 256, 0.0f);
3930 glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
3931 glPopMatrix(); // Restore The Old Projection Matrix
3932 glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
3933 glPopMatrix(); // Restore The Old Projection Matrix
3934 glEnable(GL_DEPTH_TEST); // Enables Depth Testing
3935 glEnable(GL_CULL_FACE);
3936 glDisable(GL_BLEND);
3941 if(freeze||winfreeze||(mainmenu&&gameon)||(!gameon&&gamestarted)||(!gameon&&gamestarted)){
3942 tempmult=multiplier;
3948 if(drawmode!=motionblurmode||mainmenu){
3950 if(drawmode!=motionblurmode) SwapBuffers( hDC);
3952 if(drawmode!=motionblurmode)aglSwapBuffers(gaglContext); // send swap command
3953 #endif // send swap command
3956 //myassert(glGetError() == GL_NO_ERROR);
3957 glDrawBuffer(GL_BACK);
3958 glReadBuffer(GL_BACK);
3963 if(drawtoggle==2)drawtoggle=0;
3965 if(freeze||winfreeze||(mainmenu&&gameon)||(!gameon&&gamestarted)){
3966 multiplier=tempmult;
3968 //Jordan fixed your warning!