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 SDL_Surface *sdlscreen;
23 #error please define your platform.
25 extern int kTextureSize;
26 extern FRUSTUM frustum;
28 extern Objects objects;
30 extern float usermousesensitivity;
32 extern float camerashake;
33 extern Weapons weapons;
34 extern Person player[maxplayers];
36 extern float slomodelay;
37 extern bool ismotionblur;
39 extern float blackout;
40 extern bool damageeffects;
42 extern int numplayers;
43 extern bool texttoggle;
44 extern float blurness;
45 extern float targetblurness;
46 extern float playerdist;
47 extern bool cellophane;
49 extern float flashamount,flashr,flashg,flashb;
50 extern int flashdelay;
52 extern float motionbluramount;
54 extern bool alwaysblur;
56 extern bool tilt2weird;
57 extern bool tiltweird;
59 extern bool proportionweird;
60 extern bool vertexweird[6];
61 extern bool velocityblur;
62 extern bool buttons[3];
63 extern bool debugmode;
65 extern int oldmainmenu;
66 extern int bloodtoggle;
67 extern int difficulty;
70 //extern int texdetail;
71 extern float texdetail;
72 extern bool musictoggle;
74 extern float bonusvalue;
75 extern float bonustotal;
76 extern float bonustime;
78 extern float startbonustotal;
79 extern float bonusnum[100];
80 extern int tutoriallevel;
81 extern float smoketex;
82 extern float tutorialstagetime;
83 extern float tutorialmaxtime;
84 extern int tutorialstage;
85 extern bool againbonus;
86 extern float damagedealt;
87 extern float damagetaken;
88 extern bool invertmouse;
90 extern int numhotspots;
91 extern int winhotspot;
92 extern int killhotspot;
93 extern XYZ hotspot[40];
94 extern int hotspottype[40];
95 extern float hotspotsize[40];
96 extern char hotspottext[40][256];
97 extern int currenthotspot;
99 extern int numaccounts;
100 extern int accountactive;
101 extern int accountdifficulty[10];
102 extern int accountprogress[10];
103 extern float accountpoints[10];
104 extern float accounthighscore[10][50];
105 extern float accountfasttime[10][50];
106 extern bool accountunlocked[10][60];
107 extern char accountname[10][256];
110 extern int numflipfail;
112 extern int numstaffattack;
113 extern int numswordattack;
114 extern int numknifeattack;
115 extern int numunarmedattack;
116 extern int numescaped;
117 extern int numflipped;
118 extern int numwallflipped;
119 extern int numthrowkill;
120 extern int numafterkill;
121 extern int numreversals;
122 extern int numattacks;
123 extern int maxalarmed;
124 extern int numresponded;
126 extern bool campaign;
127 extern bool winfreeze;
129 extern float menupulse;
131 extern bool gamestart;
133 extern int numdialogues;
134 extern int numdialogueboxes[max_dialogues];
135 extern int dialoguetype[max_dialogues];
136 extern int dialogueboxlocation[max_dialogues][max_dialoguelength];
137 extern float dialogueboxcolor[max_dialogues][max_dialoguelength][3];
138 extern int dialogueboxsound[max_dialogues][max_dialoguelength];
139 extern char dialoguetext[max_dialogues][max_dialoguelength][128];
140 extern char dialoguename[max_dialogues][max_dialoguelength][64];
141 extern XYZ dialoguecamera[max_dialogues][max_dialoguelength];
142 extern XYZ participantlocation[max_dialogues][10];
143 extern int participantfocus[max_dialogues][max_dialoguelength];
144 extern int participantaction[max_dialogues][max_dialoguelength];
145 extern float participantrotation[max_dialogues][10];
146 extern XYZ participantfacing[max_dialogues][max_dialoguelength][10];
147 extern float dialoguecamerarotation[max_dialogues][max_dialoguelength];
148 extern float dialoguecamerarotation2[max_dialogues][max_dialoguelength];
149 extern int indialogue;
150 extern int whichdialogue;
151 extern int directing;
152 extern float dialoguetime;
153 extern int dialoguegonethrough[20];
155 extern int accountcampaignchoicesmade[10];
156 extern int accountcampaignchoices[10][5000];
158 extern float accountcampaignhighscore[10];
159 extern float accountcampaignfasttime[10];
160 extern float accountcampaignscore[10];
161 extern float accountcampaigntime[10];
163 extern bool gamestarted;
165 extern FSOUND_SAMPLE *samp[100];
166 extern int channels[100];
167 extern "C" void PlaySoundEx(int channel, FSOUND_SAMPLE *sptr, FSOUND_DSPUNIT *dsp, signed char startpaused);
170 #define LONGLONGCONST(x) (x##ll)
172 #define LONGLONGCONST(x) (x)
175 /*********************> DrawGLScene() <*****/
176 long long Game::MD5_string (char *string){
181 sprintf (temp, "%s",string);
184 while (i<256&&temp[i]!='\0'){
185 if(temp[i]%3==0)num+=temp[i]*124;
186 else if(temp[i]%3==1)num-=temp[i]*temp[i];
191 num=longlongabs(num);
194 while(num<LONGLONGCONST(5000000000000000)){
198 while(num>LONGLONGCONST(9900000000000000)){
204 //return 1111111111111111;
207 int Game::DrawGLScene(GLvoid)
209 static float texcoordwidth,texcoordheight;
210 static float texviewwidth, texviewheight;
212 static GLubyte color;
213 static float newbrightness;
214 static float changespeed;
215 static XYZ checkpoint;
216 static float tempmult;
218 static char string[256]="";
219 static char string2[256]="";
220 static char string3[256]="";
222 static float lastcheck;
224 lastcheck+=multiplier;
226 glColorMask( 1.0, 1.0, 1.0, 1.0 );
227 if(!registered)debugmode=0;
230 if(freeze||winfreeze||(mainmenu&&gameon)||(!gameon&&gamestarted)){
237 numboundaries=mapradius*2;
238 if(numboundaries>360)numboundaries=360;
239 for(i=0;i<numboundaries;i++){
242 boundary[i]=mapcenter+DoRotation(boundary[i]*mapradius,0,i*(360/((float)(numboundaries))),0);
251 olddrawmode=drawmode;
252 if(ismotionblur&&!loading){
253 if((findLengthfast(&player[0].velocity)>200)&&velocityblur&&!cameramode){
254 drawmode=motionblurmode;
255 motionbluramount=200/(findLengthfast(&player[0].velocity));
258 if(player[0].damage-player[0].superpermanentdamage>(player[0].damagetolerance-player[0].superpermanentdamage)*1/2&&damageeffects&&!cameramode){
259 drawmode=doublevisionmode;
266 drawmode=motionblurmode;
268 slomodelay-=multiplier;
269 if(slomodelay<0)slomo=0;
273 if((!changed&&!slomo)||loading){
275 if(ismotionblur&&(/*fps>100||*/alwaysblur)){
276 if(olddrawmode!=realmotionblurmode)change=1;
278 drawmode=realmotionblurmode;
280 else if(olddrawmode==realmotionblurmode)change=2;
284 if(freeze||winfreeze||(mainmenu&&gameon)||(!gameon&&gamestarted))drawmode=normalmode;
285 if((freeze||winfreeze)&&ismotionblur&&!mainmenu)drawmode=radialzoommode;
287 if(winfreeze||mainmenu)drawmode=normalmode;
290 if(drawmode==glowmode){
296 DSpContext_FadeGamma(NULL,200,&color2);
300 if(drawtoggle!=2)drawtoggle=1-drawtoggle;
304 texviewwidth=kTextureSize;
305 if(texviewwidth>screenwidth)texviewwidth=screenwidth;
306 texviewheight=kTextureSize;
307 if(texviewheight>screenheight)texviewheight=screenheight;
309 texcoordwidth=screenwidth/kTextureSize;
310 texcoordheight=screenheight/kTextureSize;
311 if(texcoordwidth>1)texcoordwidth=1;
312 if(texcoordheight>1)texcoordheight=1;
315 glDrawBuffer(GL_BACK);
316 glReadBuffer(GL_BACK);
318 /*if(environment==desertenvironment)glTexEnvf( GL_TEXTURE_FILTER_CONTROL_EXT, GL_TEXTURE_LOD_BIAS_EXT, (float)(abs(Random()%100))/50 );
319 else glTexEnvf( GL_TEXTURE_FILTER_CONTROL_EXT, GL_TEXTURE_LOD_BIAS_EXT, 0);
321 if(abs(blurness-targetblurness)<multiplier*10||abs(blurness-targetblurness)>2){
322 blurness=targetblurness;
323 targetblurness=(float)(abs(Random()%100))/40;
325 if(blurness<targetblurness)blurness+=multiplier*5;
326 if(blurness>targetblurness)blurness-=multiplier*5;
329 static XYZ terrainlight;
330 static float distance;
331 //if(drawmode==normalmode)ReSizeGLScene(90,.1);
332 if(drawmode==normalmode)ReSizeGLScene(90,.1f);
333 if(drawmode!=normalmode)glViewport(0,0,texviewwidth,texviewheight);
334 glDepthFunc(GL_LEQUAL);
336 glAlphaFunc(GL_GREATER, 0.0001f);
337 glEnable(GL_ALPHA_TEST);
338 glClearColor(0.25f, 0.25f, 0.25f, 1.0f);
339 glClear(GL_DEPTH_BUFFER_BIT);
341 glMatrixMode (GL_MODELVIEW);
342 glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
344 if(!cameramode&&!freeze&&!winfreeze){
345 glRotatef(float(Random()%100)/10*camerashake/*+(woozy*woozy)/10*/,0,0,1);
346 glRotatef(rotation2+sin(woozy/2)*(player[0].damage/player[0].damagetolerance)*5,1,0,0);
347 glRotatef(rotation+sin(woozy)*(player[0].damage/player[0].damagetolerance)*5,0,1,0);
349 if(cameramode||freeze||winfreeze){
350 //glRotatef(float(Random()%100)/10*camerashake/*+(woozy*woozy)/10*/,0,0,1);
351 glRotatef(rotation2,1,0,0);
352 glRotatef(rotation,0,1,0);
355 if(environment==desertenvironment){
356 glRotatef((float)(abs(Random()%100))/3000-1,1,0,0);
357 glRotatef((float)(abs(Random()%100))/3000-1,0,1,0);
358 //glRotatef(blurness/40-1,1,0,0);
359 //glRotatef(blurness/40-1,0,1,0);
361 SetUpLight(&light,0);
363 if(environment==desertenvironment&&detail==2)glTexEnvf( GL_TEXTURE_FILTER_CONTROL_EXT, GL_TEXTURE_LOD_BIAS_EXT, blurness+.4 );
364 if(environment==desertenvironment){
365 glRotatef((float)(abs(Random()%100))/1000,1,0,0);
366 glRotatef((float)(abs(Random()%100))/1000,0,1,0);
369 glTexEnvf( GL_TEXTURE_FILTER_CONTROL_EXT, GL_TEXTURE_LOD_BIAS_EXT, 0);
371 glTranslatef(-viewer.x,-viewer.y,-viewer.z);
372 frustum.GetFrustum();
376 static float size,opacity,rotation;
378 for(k=0;k<numplayers;k++){
379 if(!player[k].skeleton.free&&player[k].playerdetail&&player[k].howactive<typesleeping)
380 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)
381 for(i=0;i<player[k].skeleton.num_joints;i++){
382 if(player[k].skeleton.joints[i].label==leftknee||player[k].skeleton.joints[i].label==rightknee||player[k].skeleton.joints[i].label==groin){
383 point=DoRotation(player[k].skeleton.joints[i].position,0,player[k].rotation,0)*player[k].scale+player[k].coords;
385 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;
386 if(k!=0&&tutoriallevel==1){
387 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;
389 terrain.MakeDecal(shadowdecal,point,size,opacity,rotation);
390 if(terrain.patchobjectnum[player[k].whichpatchx][player[k].whichpatchz])
391 for(l=0;l<terrain.patchobjectnum[player[k].whichpatchx][player[k].whichpatchz];l++){
392 j=terrain.patchobjects[player[k].whichpatchx][player[k].whichpatchz][l];
393 if(objects.position[j].y<player[k].coords.y||objects.type[j]==tunneltype||objects.type[j]==weirdtype){
394 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);
397 if(k!=0&&tutoriallevel==1){
398 opacity=.2+.2*sin(smoketex*6+i);
400 objects.model[j].MakeDecal(shadowdecal,&point,&size,&opacity,&rotation);
405 if((player[k].skeleton.free||player[k].howactive>=typesleeping)&&player[k].playerdetail)
406 if(frustum.SphereInFrustum(player[k].coords.x,player[k].coords.y,player[k].coords.z,player[k].scale*5)&&player[k].occluded<25)
407 for(i=0;i<player[k].skeleton.num_joints;i++){
408 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){
409 if(player[k].skeleton.free)point=player[k].skeleton.joints[i].position*player[k].scale+player[k].coords;
410 else point=DoRotation(player[k].skeleton.joints[i].position,0,player[k].rotation,0)*player[k].scale+player[k].coords;
412 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;
413 if(k!=0&&tutoriallevel==1){
414 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;
416 terrain.MakeDecal(shadowdecal,point,size,opacity*.7,rotation);
417 if(terrain.patchobjectnum[player[k].whichpatchx][player[k].whichpatchz])
418 for(l=0;l<terrain.patchobjectnum[player[k].whichpatchx][player[k].whichpatchz];l++){
419 j=terrain.patchobjects[player[k].whichpatchx][player[k].whichpatchz][l];
420 if(objects.position[j].y<player[k].coords.y||objects.type[j]==tunneltype||objects.type[j]==weirdtype){
421 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);
422 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);
425 if(k!=0&&tutoriallevel==1){
426 opacity=.2+.2*sin(smoketex*6+i);
428 objects.model[j].MakeDecal(shadowdecal,&point,&size,&opacity,&rotation);
434 if(!player[k].playerdetail)
435 if(frustum.SphereInFrustum(player[k].coords.x,player[k].coords.y,player[k].coords.z,player[k].scale*5))
437 point=player[k].coords;
439 opacity=.4-(player[k].coords.y-terrain.getHeight(player[k].coords.x,player[k].coords.z))/5;
440 terrain.MakeDecal(shadowdecal,point,size,opacity*.7,rotation);
441 if(terrain.patchobjectnum[player[k].whichpatchx][player[k].whichpatchz])
442 for(l=0;l<terrain.patchobjectnum[player[k].whichpatchx][player[k].whichpatchz];l++){
443 j=terrain.patchobjects[player[k].whichpatchx][player[k].whichpatchz][l];
444 point=DoRotation(player[k].coords-objects.position[j],0,-objects.rotation[j],0);
447 objects.model[j].MakeDecal(shadowdecal,&point,&size,&opacity,&rotation);
453 glEnable(GL_TEXTURE_2D);
455 glEnable(GL_DEPTH_TEST);
456 glEnable(GL_CULL_FACE);
458 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
459 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
460 glBindTexture( GL_TEXTURE_2D, terraintexture);
462 glBindTexture( GL_TEXTURE_2D, terraintexture2);
464 //glBindTexture( GL_TEXTURE_2D, terraintexture3);
465 //glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
468 terrain.drawdecals();
471 glEnable(GL_CULL_FACE);
472 glEnable(GL_LIGHTING);
474 glEnable(GL_TEXTURE_2D);
477 glEnable(GL_COLOR_MATERIAL);
492 glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
493 glEnable(GL_CULL_FACE);
494 glCullFace(GL_FRONT);
496 for(k=0;k<numplayers;k++){
497 if(k==0||tutoriallevel!=1){
499 glEnable(GL_LIGHTING);
500 terrainlight=terrain.getLighting(player[k].coords.x,player[k].coords.z);
501 distance=findDistancefast(&viewer,&player[k].coords);
502 distance=(viewdistance*viewdistance-(distance-(viewdistance*viewdistance*fadestart))*(1/(1-fadestart)))/viewdistance/viewdistance;
503 glColor4f(terrainlight.x,terrainlight.y,terrainlight.z,distance);
504 if(distance>=1)glDisable(GL_BLEND);
506 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;
508 if(!player[k].occluded==0)i=checkcollide(viewer,checkpoint,player[k].lastoccluded);
509 if(i==-1||player[k].occluded==0)i=checkcollide(viewer,checkpoint);
511 player[k].occluded+=1;
512 player[k].lastoccluded=i;
514 else player[k].occluded=0;
515 if(player[k].occluded<25)player[k].DrawSkeleton();
521 if(!cameramode&&musictype==stream_music2)playerdist=findDistancefastflat(&player[0].coords,&viewer);
522 else playerdist=-100;
525 glEnable(GL_TEXTURE_2D);
530 if(frustum.SphereInFrustum(realhawkcoords.x+hawk.boundingspherecenter.x,realhawkcoords.y+hawk.boundingspherecenter.y,realhawkcoords.z+hawk.boundingspherecenter.z,2)){
531 glAlphaFunc(GL_GREATER, 0.0001f);
533 glDisable(GL_CULL_FACE);
534 glDisable(GL_LIGHTING);
536 glTranslatef(hawkcoords.x,hawkcoords.y,hawkcoords.z);
537 glRotatef(hawkrotation,0,1,0);
538 glTranslatef(25,0,0);
539 distance=findDistancefast(&viewer,&realhawkcoords)*1.2;
540 glColor4f(light.color[0],light.color[1],light.color[2],(viewdistance*viewdistance-(distance-(viewdistance*viewdistance*fadestart))*(1/(1-fadestart)))/viewdistance/viewdistance);
541 if((viewdistance*viewdistance-(distance-(viewdistance*viewdistance*fadestart))*(1/(1-fadestart)))/viewdistance/viewdistance>1)glColor4f(light.color[0],light.color[1],light.color[2],1);
542 if((viewdistance*viewdistance-(distance-(viewdistance*viewdistance*fadestart))*(1/(1-fadestart)))/viewdistance/viewdistance>0)
543 hawk.drawdifftex(hawktexture);
548 /*glEnable(GL_CULL_FACE);
549 glCullFace(GL_FRONT);
551 for(k=0;k<numplayers;k++){
553 glEnable(GL_LIGHTING);
554 terrainlight=terrain.getLighting(player[k].coords.x,player[k].coords.z);
555 distance=findDistancefast(&viewer,&player[k].coords);
556 distance=(viewdistance*viewdistance-(distance-(viewdistance*viewdistance*fadestart))*(1/(1-fadestart)))/viewdistance/viewdistance;
557 glColor4f(terrainlight.x,terrainlight.y,terrainlight.z,distance);
558 if(distance>=1)glDisable(GL_BLEND);
560 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;
562 if(checkcollide(viewer,checkpoint)){
563 player[k].occluded+=1;
565 else player[k].occluded=0;
566 if(player[k].occluded<25)player[k].DrawSkeleton();
570 glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
571 glEnable(GL_CULL_FACE);
572 glCullFace(GL_FRONT);
574 for(k=0;k<numplayers;k++){
575 if(!(k==0||tutoriallevel!=1)){
577 glEnable(GL_LIGHTING);
578 terrainlight=terrain.getLighting(player[k].coords.x,player[k].coords.z);
579 distance=findDistancefast(&viewer,&player[k].coords);
580 distance=(viewdistance*viewdistance-(distance-(viewdistance*viewdistance*fadestart))*(1/(1-fadestart)))/viewdistance/viewdistance;
581 glColor4f(terrainlight.x,terrainlight.y,terrainlight.z,distance);
582 if(distance>=1)glDisable(GL_BLEND);
584 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;
586 if(!player[k].occluded==0)i=checkcollide(viewer,checkpoint,player[k].lastoccluded);
587 if(i==-1||player[k].occluded==0)i=checkcollide(viewer,checkpoint);
589 player[k].occluded+=1;
590 player[k].lastoccluded=i;
592 else player[k].occluded=0;
593 if(player[k].occluded<25)player[k].DrawSkeleton();
600 glEnable(GL_TEXTURE_2D);
605 glDisable(GL_COLOR_MATERIAL);
607 glDisable(GL_LIGHTING);
608 glDisable(GL_TEXTURE_2D);
616 glDisable(GL_LIGHTING);
617 glDisable(GL_TEXTURE_2D);
618 glDisable(GL_COLOR_MATERIAL);
621 for(k=0;k<numplayers;k++){
622 if(player[k].numwaypoints>1){
623 glBegin(GL_LINE_LOOP);
624 for(i=0;i<player[k].numwaypoints;i++){
625 glVertex3f(player[k].waypoints[i].x,player[k].waypoints[i].y+.5,player[k].waypoints[i].z);
634 for(k=0;k<numpathpoints;k++){
635 if(numpathpointconnect[k]){
636 for(i=0;i<numpathpointconnect[k];i++){
637 glBegin(GL_LINE_LOOP);
638 glVertex3f(pathpoint[k].x,pathpoint[k].y+.5,pathpoint[k].z);
639 glVertex3f(pathpoint[pathpointconnect[k][i]].x,pathpoint[pathpointconnect[k][i]].y+.5,pathpoint[pathpointconnect[k][i]].z);
647 glVertex3f(pathpoint[pathpointselected].x,pathpoint[pathpointselected].y+.5,pathpoint[pathpointselected].z);
654 glEnable(GL_TEXTURE_2D);
655 glColor4f(.5,.5,.5,1);
657 sprintf (string, " ",(int)(fps));
658 text.glPrint(10,30,string,0,.8,screenwidth,screenheight);
661 if(bonus>0&&bonustime<1&&!winfreeze&&indialogue==-1/*bonustime<4*/){
662 if(bonus==tracheotomy)sprintf (string, "Tracheotomy!");
663 else if(bonus==backstab)sprintf (string, "Backstabber!");
664 else if(bonus==spinecrusher)sprintf (string, "Spinecrusher!");
665 else if(bonus==ninja)sprintf (string, "Ninja Bonus!");
666 else if(bonus==style)sprintf (string, "Style Bonus!");
667 else if(bonus==cannon)sprintf (string, "Leg Cannon!");
668 else if(bonus==aimbonus)sprintf (string, "Nice Aim!");
669 else if(bonus==deepimpact)sprintf (string, "Heavy Impact!");
670 else if(bonus==touchofdeath)sprintf (string, "Touch of Death!");
671 else if(bonus==swordreversebonus)sprintf (string, "Sword Disarm!");
672 else if(bonus==staffreversebonus)sprintf (string, "Staff Disarm!");
673 else if(bonus==reverseko)sprintf (string, "Reversal KO!");
674 else if(bonus==solidhit)sprintf (string, "Solid Hit!");
675 else if(bonus==twoxcombo)sprintf (string, "2X Combo!");
676 else if(bonus==threexcombo)sprintf (string, "3X Combo!");
677 else if(bonus==fourxcombo)sprintf (string, "4X COMBO!");
678 else if(bonus==megacombo)sprintf (string, "MEGA COMBO!");
679 else if(bonus==Reversal)sprintf (string, "Reversal!");
680 else if(bonus==Stabbonus)sprintf (string, "Punctured!");
681 else if(bonus==Slicebonus)sprintf (string, "Sliced!");
682 else if(bonus==Bullseyebonus)sprintf (string, "Bullseye!");
683 else if(bonus==Slashbonus)sprintf (string, "Slashed!");
684 else if(bonus==Wolfbonus)sprintf (string, "WOLF SLAYER!");
685 else if(bonus==FinishedBonus)sprintf (string, "SLAIN!");
686 else if(bonus==TackleBonus)sprintf (string, "Tackle!");
687 else if(bonus==AboveBonus)sprintf (string, "Death from Above!");
688 else sprintf (string, "Excellent!");
690 glColor4f(0,0,0,1-bonustime);
691 text.glPrintOutline(1024/2-10*strlen(string)-4,768/16-4+768*4/5,string,1,2.5,1024,768);
692 glColor4f(1,0,0,1-bonustime);
693 text.glPrint(1024/2-10*strlen(string),768/16+768*4/5,string,1,2,1024,768);
695 sprintf (string, "%d",(int)bonusvalue);
696 glColor4f(0,0,0,1-bonustime);
697 text.glPrintOutline(1024/2-10*strlen(string)-4,768/16-4-20+768*4/5,string,1,2.5*.8,1024,768);
698 glColor4f(1,0,0,1-bonustime);
699 text.glPrint(1024/2-10*strlen(string),768/16-20+768*4/5,string,1,2*.8,1024,768);
700 glColor4f(.5,.5,.5,1);
703 if(tutoriallevel==1){
704 tutorialopac=tutorialmaxtime-tutorialstagetime;
705 if(tutorialopac>1)tutorialopac=1;
706 if(tutorialopac<0)tutorialopac=0;
708 sprintf (string, " ");
709 sprintf (string2, " ");
710 sprintf (string3, " ");
711 if(tutorialstage==0){
712 sprintf (string, " ");
713 sprintf (string2, " ");
714 sprintf (string3, " ");
716 if(tutorialstage==1){
717 sprintf (string, "Welcome to the Lugaru training level!");
718 sprintf (string2, " ");
719 sprintf (string3, " ");
721 if(tutorialstage==2){
722 sprintf (string, "BASIC MOVEMENT:");
723 sprintf (string2, " ");
724 sprintf (string3, " ");
726 if(tutorialstage==3){
727 sprintf (string, "You can move the mouse to rotate the camera.");
728 sprintf (string2, " ");
729 sprintf (string3, " ");
731 if(tutorialstage==4){
732 sprintf (string, "Try using the %s, %s, %s and %s keys to move around.",KeyToChar(forwardkey),KeyToChar(leftkey),KeyToChar(backkey),KeyToChar(rightkey));
733 sprintf (string2, "All movement is relative to the camera.");
734 sprintf (string3, " ");
736 if(tutorialstage==5){
737 sprintf (string, "Please press %s to jump.",KeyToChar(jumpkey));
738 sprintf (string2, "You can hold it longer to jump higher.");
739 sprintf (string3, " ");
741 if(tutorialstage==6){
742 sprintf (string, "You can press %s to crouch.",KeyToChar(crouchkey));
743 sprintf (string2, "You can jump higher from a crouching position.");
744 sprintf (string3, " ");
746 if(tutorialstage==7){
747 sprintf (string, "While running, you can press %s to roll.",KeyToChar(crouchkey));
748 sprintf (string2, " ");
749 sprintf (string3, " ");
751 if(tutorialstage==8){
752 sprintf (string, "While crouching, you can sneak around silently");
753 sprintf (string2, "using the movement keys.");
754 sprintf (string3, " ");
756 if(tutorialstage==9){
757 sprintf (string, "Release the crouch key while sneaking and hold the movement keys");
758 sprintf (string2, "to run animal-style.");
759 sprintf (string3, " ");
761 if(tutorialstage==10){
762 sprintf (string, "ADVANCED MOVEMENT:");
763 sprintf (string2, " ");
764 sprintf (string3, " ");
766 if(tutorialstage==11){
767 sprintf (string, "When you jump at a wall, you can hold %s again",KeyToChar(jumpkey));
768 sprintf (string2, "during impact to perform a walljump.");
769 sprintf (string3, "Be sure to use the movement keys to press against the wall");
771 if(tutorialstage==12){
772 sprintf (string, "While in the air, you can press crouch to flip.",KeyToChar(jumpkey));
773 sprintf (string2, "Walljumps and flips confuse enemies and give you more control.");
774 sprintf (string3, " ");
776 if(tutorialstage==13){
777 sprintf (string, "BASIC COMBAT:");
778 sprintf (string2, " ");
779 sprintf (string3, " ");
781 if(tutorialstage==14){
782 sprintf (string, "There is now an imaginary enemy");
783 sprintf (string2, "in the middle of the training area.");
784 sprintf (string3, " ");
786 if(tutorialstage==15){
787 if(attackkey==MAC_MOUSEBUTTON1)sprintf (string, "Click to attack when you are near an enemy.");
788 else sprintf (string, "Press %s to attack when you are near an enemy.",KeyToChar(attackkey));
789 sprintf (string2, "You can punch by standing still near an enemy and attacking.");
790 sprintf (string3, " ");
792 if(tutorialstage==16){
793 sprintf (string, "If you are close, you will perform a weak punch.");
794 sprintf (string2, "The weak punch is excellent for starting attack combinations.");
795 sprintf (string3, " ");
797 if(tutorialstage==17){
798 sprintf (string, "Attacking while running results in a spin kick.");
799 sprintf (string2, "This is one of your most powerful ground attacks.");
800 sprintf (string3, " ");
802 if(tutorialstage==18){
803 sprintf (string, "Sweep the enemy's legs out by attacking while crouched.");
804 sprintf (string2, "This is a very fast attack, and easy to follow up.");
805 sprintf (string3, " ");
807 if(tutorialstage==19){
808 sprintf (string, "When an enemy is on the ground, you can deal some extra");
809 sprintf (string2, "damage by running up and drop-kicking him.");
810 sprintf (string3, "(Try knocking them down with a sweep first)");
812 if(tutorialstage==20){
813 sprintf (string, "Your most powerful individual attack is the rabbit kick.");
814 if(attackkey==MAC_MOUSEBUTTON1)sprintf (string2, "Run at the enemy while holding the mouse button, and press");
815 else sprintf (string2, "Run at the enemy while holding %s, and press", KeyToChar(attackkey));
816 sprintf (string3, "the jump key (%s) to attack.",KeyToChar(jumpkey));
818 if(tutorialstage==21){
819 sprintf (string, "This attack is devastating if timed correctly.");
820 sprintf (string2, "Even if timed incorrectly, it will knock the enemy over.");
821 if(againbonus)sprintf (string3, "Try rabbit-kicking the imaginary enemy again.");
822 else sprintf (string3, "Try rabbit-kicking the imaginary enemy.");
824 if(tutorialstage==22){
825 sprintf (string, "If you sneak behind an enemy unnoticed, you can kill");
826 sprintf (string2, "him instantly. Move close behind this enemy");
827 sprintf (string3, "and attack.");
829 if(tutorialstage==23){
830 sprintf (string, "Another important attack is the wall kick. When an enemy");
831 sprintf (string2, "is near a wall, perform a walljump nearby and hold");
832 sprintf (string3, "the attack key during impact with the wall.");
834 if(tutorialstage==24){
835 sprintf (string, "You can tackle enemies by running at them animal-style");
836 if(attackkey==MAC_MOUSEBUTTON1)sprintf (string2, "and pressing jump (%s) or attack(mouse button).",KeyToChar(jumpkey));
837 else sprintf (string2, "and pressing jump (%s) or attack(%s).",KeyToChar(jumpkey),KeyToChar(attackkey));
838 sprintf (string3, "This is especially useful when they are running away.");
840 if(tutorialstage==25){
841 sprintf (string, "Dodge by pressing back and attack. Dodging is essential");
842 sprintf (string2, "against enemies with swords or other long weapons.");
843 sprintf (string3, " ");
845 if(tutorialstage==26){
846 sprintf (string, "REVERSALS AND COUNTER-REVERSALS");
847 sprintf (string2, " ");
848 sprintf (string3, " ");
850 if(tutorialstage==27){
851 sprintf (string, "The enemy can now reverse your attacks.");
852 sprintf (string2, " ");
853 sprintf (string3, " ");
855 if(tutorialstage==28){
856 sprintf (string, "If you attack, you will notice that the enemy now sometimes");
857 sprintf (string2, "catches your attack and uses it against you. Hold");
858 sprintf (string3, "crouch (%s) after attacking to escape from reversals.",KeyToChar(crouchkey));
860 if(tutorialstage==29){
861 sprintf (string, "Try escaping from two more reversals in a row.");
862 sprintf (string2, " ");
863 sprintf (string3, " ");
865 if(tutorialstage==30){
866 sprintf (string, "Good!");
867 sprintf (string2, " ");
868 sprintf (string3, " ");
870 if(tutorialstage==31){
871 sprintf (string, "To reverse an attack, you must tap crouch (%s) during the",KeyToChar(crouchkey));
872 sprintf (string2, "enemy's attack. You must also be close to the enemy;");
873 sprintf (string3, "this is especially important against armed opponents.");
875 if(tutorialstage==32){
876 sprintf (string, "The enemy can attack in %d seconds.", (int)(tutorialmaxtime-tutorialstagetime));
877 sprintf (string2, "This imaginary opponents attacks will be highlighted");
878 sprintf (string3, "to make this easier.");
880 if(tutorialstage==33){
881 sprintf (string, "Reverse three enemy attacks!");
882 sprintf (string2, " ");
883 sprintf (string3, " ");
885 if(tutorialstage==34){
886 sprintf (string, "Reverse two more enemy attacks!");
887 sprintf (string2, " ");
888 sprintf (string3, " ");
890 if(tutorialstage==35){
891 sprintf (string, "Reverse one more enemy attack!");
892 sprintf (string2, " ");
893 sprintf (string3, " ");
895 if(tutorialstage==36){
896 sprintf (string, "Excellent!");
897 sprintf (string2, " ");
898 sprintf (string3, " ");
900 if(tutorialstage==37){
901 sprintf (string, "Now spar with the enemy for %d more seconds.", (int)(tutorialmaxtime-tutorialstagetime));
902 sprintf (string2, "Damage dealt: %d",(int)damagedealt);
903 sprintf (string3, "Damage taken: %d.",(int)damagetaken);
905 if(tutorialstage==38){
906 sprintf (string, "WEAPONS:");
907 sprintf (string2, " ");
908 sprintf (string3, " ");
910 if(tutorialstage==39){
911 sprintf (string, "There is now an imaginary knife");
912 sprintf (string2, "in the center of the training area.");
913 sprintf (string3, " ");
915 if(tutorialstage==40){
916 sprintf (string, "Stand, roll or handspring over the knife");
917 sprintf (string2, "while pressing %s to pick it up.",KeyToChar(throwkey));
918 sprintf (string3, "You can crouch and press the same key to drop it again.");
920 if(tutorialstage==41){
921 sprintf (string, "You can equip and unequip weapons using the %s key.",KeyToChar(drawkey));
922 sprintf (string2, "Sometimes it is best to keep them unequipped to");
923 sprintf (string3, "prevent enemies from taking them. ");
925 if(tutorialstage==42){
926 sprintf (string, "The knife is the smallest weapon and the least encumbering.");
927 sprintf (string2, "You can equip or unequip it while standing, crouching,");
928 sprintf (string3, "running or flipping.");
930 if(tutorialstage==43){
931 sprintf (string, "You perform weapon attacks the same way as unarmed attacks,");
932 sprintf (string2, "but sharp weapons cause permanent damage, instead of the");
933 sprintf (string3, "temporary trauma from blunt weapons, fists and feet.");
935 if(tutorialstage==44){
936 sprintf (string, "The enemy now has your knife!");
937 sprintf (string2, "Please reverse two of his knife attacks.");
938 sprintf (string3, " ");
940 if(tutorialstage==45){
941 sprintf (string, "Please reverse one more of his knife attacks.");
942 sprintf (string2, " ");
943 sprintf (string3, " ");
945 if(tutorialstage==46){
946 sprintf (string, "Now he has a sword!");
947 sprintf (string2, "The sword has longer reach than your arms, so you");
948 sprintf (string3, "must move close to reverse the sword slash.");
950 if(tutorialstage==47){
951 sprintf (string, "Long weapons like the sword and staff are also useful for defense;");
952 sprintf (string2, "you can parry enemy weapon attacks by pressing the attack key");
953 sprintf (string3, "at the right time. Please try parrying the enemy's attacks!");
955 if(tutorialstage==48){
956 sprintf (string, "The staff is like the sword, but has two main attacks.");
957 sprintf (string2, "The standing smash is fast and effective, and the running");
958 sprintf (string3, "spin smash is slower and more powerful.");
960 if(tutorialstage==49){
961 sprintf (string, "When facing an enemy, you can throw the knife with %s.",KeyToChar(throwkey));
962 sprintf (string2, "It is possible to throw the knife while flipping,");
963 sprintf (string3, "but it is very inaccurate.");
965 if(tutorialstage==50){
966 sprintf (string, "You now know everything you can learn from training.");
967 sprintf (string2, "Everything else you must learn from experience!");
968 sprintf (string3, " ");
970 if(tutorialstage==51){
971 sprintf (string, "Walk out of the training area to return to the main menu.");
972 sprintf (string2, " ");
973 sprintf (string3, " ");
976 glColor4f(0,0,0,tutorialopac);
977 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);
978 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);
979 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);
980 glColor4f(1,1,1,tutorialopac);
981 text.glPrint(screenwidth/2-7.6*strlen(string)*screenwidth/1024,screenheight/16+screenheight*4/5,string,1,1.5*screenwidth/1024,screenwidth,screenheight);
982 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);
983 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);
985 sprintf (string, "Press 'tab' to skip to the next item.",KeyToChar(jumpkey));
986 sprintf (string2, "Press escape at any time to");
987 sprintf (string3, "pause or exit the tutorial.");
990 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);
991 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);
992 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);
993 glColor4f(0.5,0.5,0.5,1);
994 text.glPrint(screenwidth/2-7.6*strlen(string)*screenwidth/1024*.8,0+screenheight*1/10,string,1,1.5*screenwidth/1024*.8,screenwidth,screenheight);
995 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);
996 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);
1000 if(numhotspots&&(bonustime>=1||bonus<=0||bonustime<0)&&!tutoriallevel){
1002 float closestdist=-1;
1004 closest=currenthotspot;
1005 for(i=0;i<numhotspots;i++){
1006 distance=findDistancefast(&player[0].coords,&hotspot[i]);
1007 if(closestdist==-1||distance<closestdist){
1008 if(findDistancefast(&player[0].coords,&hotspot[i])<hotspotsize[i]&&((hotspottype[i]<=10&&hotspottype[i]>=0)||(hotspottype[i]<=40&&hotspottype[i]>=20))){
1009 closestdist=distance;
1015 currenthotspot=closest;
1016 if(currenthotspot!=-1){
1017 if(hotspottype[closest]<=10){
1018 if(findDistancefast(&player[0].coords,&hotspot[closest])<hotspotsize[closest])
1019 tutorialstagetime=0;
1021 tutorialopac=tutorialmaxtime-tutorialstagetime;
1022 if(tutorialopac>1)tutorialopac=1;
1023 if(tutorialopac<0)tutorialopac=0;
1025 sprintf (string, "%s", hotspottext[closest]);
1033 if(string[i]=='\n'||string[i]>'z'||string[i]<' '||string[i]=='\0'){
1034 glColor4f(0,0,0,tutorialopac);
1035 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);
1036 glColor4f(1,1,1,tutorialopac);
1037 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);
1040 if(string[i]=='\0')done=1;
1046 else if (hotspottype[closest]>=20&&dialoguegonethrough[hotspottype[closest]-20]==0){
1047 whichdialogue=hotspottype[closest]-20;
1048 for(j=0;j<numdialogueboxes[whichdialogue];j++){
1049 player[participantfocus[whichdialogue][j]].coords=participantlocation[whichdialogue][participantfocus[whichdialogue][j]];
1050 player[participantfocus[whichdialogue][j]].rotation=participantrotation[whichdialogue][participantfocus[whichdialogue][j]];
1051 player[participantfocus[whichdialogue][j]].targetrotation=participantrotation[whichdialogue][participantfocus[whichdialogue][j]];
1052 player[participantfocus[whichdialogue][j]].velocity=0;
1053 player[participantfocus[whichdialogue][j]].targetanimation=player[participantfocus[whichdialogue][j]].getIdle();
1054 player[participantfocus[whichdialogue][j]].targetframe=0;
1058 dialoguegonethrough[whichdialogue]++;
1059 if(dialogueboxsound[whichdialogue][indialogue]!=0){
1060 static float gLoc[3];
1061 static float vel[3];
1062 gLoc[0]=player[participantfocus[whichdialogue][indialogue]].coords.x;
1063 gLoc[1]=player[participantfocus[whichdialogue][indialogue]].coords.y;
1064 gLoc[2]=player[participantfocus[whichdialogue][indialogue]].coords.z;
1069 if(dialogueboxsound[whichdialogue][indialogue]==1)whichsoundplay=rabbitchitter;
1070 if(dialogueboxsound[whichdialogue][indialogue]==2)whichsoundplay=rabbitchitter2;
1071 if(dialogueboxsound[whichdialogue][indialogue]==3)whichsoundplay=rabbitpainsound;
1072 if(dialogueboxsound[whichdialogue][indialogue]==4)whichsoundplay=rabbitpain1sound;
1073 if(dialogueboxsound[whichdialogue][indialogue]==5)whichsoundplay=rabbitattacksound;
1074 if(dialogueboxsound[whichdialogue][indialogue]==6)whichsoundplay=rabbitattack2sound;
1075 if(dialogueboxsound[whichdialogue][indialogue]==7)whichsoundplay=rabbitattack3sound;
1076 if(dialogueboxsound[whichdialogue][indialogue]==8)whichsoundplay=rabbitattack4sound;
1077 if(dialogueboxsound[whichdialogue][indialogue]==9)whichsoundplay=growlsound;
1078 if(dialogueboxsound[whichdialogue][indialogue]==10)whichsoundplay=growl2sound;
1079 if(dialogueboxsound[whichdialogue][indialogue]==11)whichsoundplay=snarlsound;
1080 if(dialogueboxsound[whichdialogue][indialogue]==12)whichsoundplay=snarl2sound;
1081 if(dialogueboxsound[whichdialogue][indialogue]==13)whichsoundplay=barksound;
1082 if(dialogueboxsound[whichdialogue][indialogue]==14)whichsoundplay=bark2sound;
1083 if(dialogueboxsound[whichdialogue][indialogue]==15)whichsoundplay=bark3sound;
1084 if(dialogueboxsound[whichdialogue][indialogue]==16)whichsoundplay=barkgrowlsound;
1085 if(dialogueboxsound[whichdialogue][indialogue]==-1)whichsoundplay=fireendsound;
1086 if(dialogueboxsound[whichdialogue][indialogue]==-2)whichsoundplay=firestartsound;
1087 if(dialogueboxsound[whichdialogue][indialogue]==-3)whichsoundplay=consolesuccesssound;
1088 if(dialogueboxsound[whichdialogue][indialogue]==-4)whichsoundplay=consolefailsound;
1089 PlaySoundEx( whichsoundplay, samp[whichsoundplay], NULL, TRUE);
1090 FSOUND_3D_SetAttributes(channels[whichsoundplay], gLoc, vel);
1091 FSOUND_SetVolume(channels[whichsoundplay], 256);
1092 FSOUND_SetPaused(channels[whichsoundplay], FALSE);
1098 if(indialogue!=-1&&!mainmenu){
1099 glDisable(GL_DEPTH_TEST); // Disables Depth Testing
1100 glDisable(GL_CULL_FACE);
1101 glDisable(GL_LIGHTING);
1102 glDisable(GL_TEXTURE_2D);
1104 glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
1105 glPushMatrix(); // Store The Projection Matrix
1106 glLoadIdentity(); // Reset The Projection Matrix
1107 glOrtho(0,screenwidth,0,screenheight,-100,100); // Set Up An Ortho Screen
1108 glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
1109 glPushMatrix(); // Store The Modelview Matrix
1110 glLoadIdentity(); // Reset The Modelview Matrix
1111 if(dialogueboxlocation[whichdialogue][indialogue]==1)glTranslatef(0,screenheight*3/4,0);
1112 glScalef(screenwidth,screenheight/4,1);
1113 glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
1116 glColor4f(dialogueboxcolor[whichdialogue][indialogue][0],dialogueboxcolor[whichdialogue][indialogue][1],dialogueboxcolor[whichdialogue][indialogue][2],0.7);
1118 glVertex3f(0, 0, 0.0f);
1119 glVertex3f(1, 0, 0.0f);
1120 glVertex3f(1, 1, 0.0f);
1121 glVertex3f(0, 1, 0.0f);
1123 glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
1124 glPopMatrix(); // Restore The Old Projection Matrix
1125 glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
1126 glPopMatrix(); // Restore The Old Projection Matrix
1127 glEnable(GL_DEPTH_TEST); // Enables Depth Testing
1128 glEnable(GL_CULL_FACE);
1129 glDisable(GL_BLEND);
1131 glEnable(GL_TEXTURE_2D);
1138 startx=screenwidth*1/5;
1139 if(dialogueboxlocation[whichdialogue][indialogue]==1)starty=screenheight/16+screenheight*4/5;
1140 if(dialogueboxlocation[whichdialogue][indialogue]==2)starty=screenheight*1/5-screenheight/16;
1142 // char tempname[64];
1146 // for(i=0;i<64;i++){
1151 for(i=0;i<(int)strlen(dialoguename[whichdialogue][indialogue]);i++){
1152 tempname[tempnum]=dialoguename[whichdialogue][indialogue][i];
1154 if(dialoguename[whichdialogue][indialogue][i]=='#'||dialoguename[whichdialogue][indialogue][i]=='\0')goodchar=0;
1155 //if(tempnum>2)if(tempname[tempnum-2]=='e'&&tempname[tempnum-1]=='r')goodchar=0;
1156 //if(tempnum>2)if(tempname[tempnum]=='r'&&tempname[0]=='a')goodchar=0;
1157 if(goodchar)tempnum++;
1158 else tempname[tempnum]='\0';
1161 sprintf (string, "%s: ", tempname);
1163 if(dialogueboxcolor[whichdialogue][indialogue][0]+dialogueboxcolor[whichdialogue][indialogue][1]+dialogueboxcolor[whichdialogue][indialogue][2]<1.5){
1164 glColor4f(0,0,0,tutorialopac);
1165 text.glPrintOutline(startx-2*7.6*strlen(string)*screenwidth/1024-4,starty-4,string,1,1.5*1.25*screenwidth/1024,screenwidth,screenheight);
1166 glColor4f(0.7,0.7,0.7,tutorialopac);
1167 text.glPrint(startx-2*7.6*strlen(string)*screenwidth/1024,starty,string,1,1.5*screenwidth/1024,screenwidth,screenheight);
1171 glColor4f(0,0,0,tutorialopac);
1172 text.glPrintOutline(startx-2*7.6*strlen(string)*screenwidth/1024-4,starty-4,string,1,1.5*1.25*screenwidth/1024,screenwidth,screenheight);
1177 for(i=0;i<(int)strlen(dialoguetext[whichdialogue][indialogue])+1;i++){
1178 tempname[tempnum]=dialoguetext[whichdialogue][indialogue][i];
1179 if(dialoguetext[whichdialogue][indialogue][i]!='#')tempnum++;
1183 sprintf (string, "%s", tempname);
1192 if(string[i]=='\n'||string[i]>'z'||string[i]<' '||string[i]=='\0'){
1193 if(dialogueboxcolor[whichdialogue][indialogue][0]+dialogueboxcolor[whichdialogue][indialogue][1]+dialogueboxcolor[whichdialogue][indialogue][2]<1.5){
1194 glColor4f(0,0,0,tutorialopac);
1195 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);
1196 glColor4f(1,1,1,tutorialopac);
1197 text.glPrint(startx/*-7.6*(i-lastline)*screenwidth/1024*/,starty-20*screenwidth/1024*line,string,1,1.5*screenwidth/1024,screenwidth,screenheight,lastline,i);
1201 glColor4f(0,0,0,tutorialopac);
1202 text.glPrint(startx/*-7.6*(i-lastline)*screenwidth/1024*/,starty-20*screenwidth/1024*line,string,1,1.5*screenwidth/1024,screenwidth,screenheight,lastline,i);
1206 if(string[i]=='\0')done=1;
1213 if(!tutoriallevel&&!winfreeze&&indialogue==-1&&!mainmenu){
1215 if(!scoreadded)sprintf (string, "Score: %d", (int)accountcampaignscore[accountactive]+(int)bonustotal);//(int)bonustotal);
1216 if(scoreadded)sprintf (string, "Score: %d", (int)accountcampaignscore[accountactive]);//(int)bonustotal);
1218 if(!campaign)sprintf (string, "Score: %d", (int)bonustotal);
1220 text.glPrintOutline(1024/40-4,768/16-4+768*14/16,string,1,1.5*1.25,1024,768);
1222 text.glPrint(1024/40,768/16+768*14/16,string,1,1.5,1024,768);
1225 glColor4f(.5,.5,.5,1);
1228 if((texttoggle||editorenabled)&&debugmode&&!mainmenu){
1229 sprintf (string, "The framespersecond is %d.",(int)(fps));
1230 text.glPrint(10,30,string,0,.8,1024,768);
1232 sprintf (string, "Name: %s", registrationname);
1233 text.glPrint(10,260,string,0,.8,1024,768);
1236 if(editorenabled)sprintf (string, "Map editor enabled.");
1237 if(!editorenabled)sprintf (string, "Map editor Disabled.");
1238 text.glPrint(10,60,string,0,.8,1024,768);
1240 sprintf (string, "Object size: %f",editorsize);
1241 text.glPrint(10,75,string,0,.8,1024,768);
1242 if(editorrotation>=0)sprintf (string, "Object rotation: %f",editorrotation);
1243 else sprintf (string, "Object rotation: Random");
1244 text.glPrint(10,90,string,0,.8,1024,768);
1245 if(editorrotation2>=0)sprintf (string, "Object rotation2: %f",editorrotation2);
1246 else sprintf (string, "Object rotation2: Random");
1247 text.glPrint(10,105,string,0,.8,1024,768);
1248 sprintf (string, "Object type: %d",editortype);
1249 text.glPrint(10,120,string,0,.8,1024,768);
1250 if(editortype==boxtype)sprintf (string, "(box)");
1251 if(editortype==treetrunktype)sprintf (string, "(tree)");
1252 if(editortype==walltype)sprintf (string, "(wall)");
1253 if(editortype==weirdtype)sprintf (string, "(weird)");
1254 if(editortype==spiketype)sprintf (string, "(spike)");
1255 if(editortype==rocktype)sprintf (string, "(rock)");
1256 if(editortype==bushtype)sprintf (string, "(bush)");
1257 if(editortype==tunneltype)sprintf (string, "(tunnel)");
1258 if(editortype==chimneytype)sprintf (string, "(chimney)");
1259 if(editortype==platformtype)sprintf (string, "(platform)");
1260 if(editortype==cooltype)sprintf (string, "(cool)");
1261 if(editortype==firetype)sprintf (string, "(fire)");
1262 text.glPrint(130,120,string,0,.8,1024,768);
1264 sprintf (string, "Numplayers: %d",numplayers);
1265 text.glPrint(10,155,string,0,.8,1024,768);
1266 sprintf (string, "Player %d: numwaypoints: %d",numplayers,player[numplayers-1].numwaypoints);
1267 text.glPrint(10,140,string,0,.8,1024,768);
1269 /*sprintf (string, "Coords are: %f %f %f",player[0].coords.x,player[0].coords.y,player[0].coords.z);
1270 text.glPrint(10,200,string,0,.8,1024,768);*/
1271 sprintf (string, "Difficulty: %d",difficulty);
1272 text.glPrint(10,240,string,0,.8,1024,768);
1274 sprintf (string, "lasthotspot: %d",hotspottype[numhotspots-1]);
1275 text.glPrint(10,240,string,0,.8,1024,768);
1276 sprintf (string, "killhotspot: %d",killhotspot);
1277 text.glPrint(10,220,string,0,.8,1024,768);
1278 sprintf (string, "winhotspot: %d",winhotspot);
1279 text.glPrint(10,200,string,0,.8,1024,768);*/
1284 if(drawmode==glowmode){
1285 glDisable(GL_DEPTH_TEST); // Disables Depth Testing
1286 glDisable(GL_CULL_FACE);
1287 glDisable(GL_LIGHTING);
1288 glDisable(GL_TEXTURE_2D);
1290 glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
1291 glPushMatrix(); // Store The Projection Matrix
1292 glLoadIdentity(); // Reset The Projection Matrix
1293 glOrtho(0,screenwidth,0,screenheight,-100,100); // Set Up An Ortho Screen
1294 glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
1295 glPushMatrix(); // Store The Modelview Matrix
1296 glLoadIdentity(); // Reset The Modelview Matrix
1297 glScalef(screenwidth,screenheight,1);
1298 glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
1300 glColor4f(0,0,0,.5);
1302 glVertex3f(0, 0, 0.0f);
1303 glVertex3f(256, 0, 0.0f);
1304 glVertex3f(256, 256, 0.0f);
1305 glVertex3f(0, 256, 0.0f);
1307 glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
1308 glPopMatrix(); // Restore The Old Projection Matrix
1309 glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
1310 glPopMatrix(); // Restore The Old Projection Matrix
1311 glEnable(GL_DEPTH_TEST); // Enables Depth Testing
1312 glEnable(GL_CULL_FACE);
1313 glDisable(GL_BLEND);
1317 if((((blackout&&damageeffects)||(player[0].bloodloss>0&&damageeffects&&player[0].blooddimamount>0)||player[0].dead)&&!cameramode)||console){
1318 glDisable(GL_DEPTH_TEST); // Disables Depth Testing
1319 glDisable(GL_CULL_FACE);
1320 glDisable(GL_LIGHTING);
1321 glDisable(GL_TEXTURE_2D);
1323 glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
1324 glPushMatrix(); // Store The Projection Matrix
1325 glLoadIdentity(); // Reset The Projection Matrix
1326 glOrtho(0,screenwidth,0,screenheight,-100,100); // Set Up An Ortho Screen
1327 glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
1328 glPushMatrix(); // Store The Modelview Matrix
1329 glLoadIdentity(); // Reset The Modelview Matrix
1330 glScalef(screenwidth,screenheight,1);
1331 glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
1333 if(player[0].dead)blackout+=multiplier*3;
1334 if(player[0].dead==1)blackout=.4f;
1335 if(player[0].dead==2&&blackout>.6)blackout=.6;
1336 glColor4f(0,0,0,blackout);
1337 if(!player[0].dead){
1338 if((player[0].bloodloss/player[0].damagetolerance*(sin(woozy)/4+.5))*.3<.3){
1339 glColor4f(0,0,0,player[0].blooddimamount*player[0].bloodloss/player[0].damagetolerance*(sin(woozy)/4+.5)*.3);
1340 blackout=player[0].blooddimamount*player[0].bloodloss/player[0].damagetolerance*(sin(woozy)/4+.5)*.3;
1343 glColor4f(0,0,0,player[0].blooddimamount*.3);
1344 blackout=player[0].blooddimamount*.3;
1347 if(console)glColor4f(.7,0,0,.2);
1349 glVertex3f(0, 0, 0.0f);
1350 glVertex3f(256, 0, 0.0f);
1351 glVertex3f(256, 256, 0.0f);
1352 glVertex3f(0, 256, 0.0f);
1354 glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
1355 glPopMatrix(); // Restore The Old Projection Matrix
1356 glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
1357 glPopMatrix(); // Restore The Old Projection Matrix
1358 glEnable(GL_DEPTH_TEST); // Enables Depth Testing
1359 glEnable(GL_CULL_FACE);
1360 glDisable(GL_BLEND);
1364 if(flashamount>0&&damageeffects){
1365 if(flashamount>1)flashamount=1;
1366 if(flashdelay<=0)flashamount-=multiplier;
1368 if(flashamount<0)flashamount=0;
1369 glDisable(GL_DEPTH_TEST); // Disables Depth Testing
1370 glDisable(GL_CULL_FACE);
1371 glDisable(GL_LIGHTING);
1373 glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
1374 glPushMatrix(); // Store The Projection Matrix
1375 glLoadIdentity(); // Reset The Projection Matrix
1376 glOrtho(0,screenwidth,0,screenheight,-100,100); // Set Up An Ortho Screen
1377 glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
1378 glPushMatrix(); // Store The Modelview Matrix
1379 glLoadIdentity(); // Reset The Modelview Matrix
1380 glScalef(screenwidth,screenheight,1);
1381 glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
1383 glColor4f(flashr,flashg,flashb,flashamount);
1385 glVertex3f(0, 0, 0.0f);
1386 glVertex3f(256, 0, 0.0f);
1387 glVertex3f(256, 256, 0.0f);
1388 glVertex3f(0, 256, 0.0f);
1390 glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
1391 glPopMatrix(); // Restore The Old Projection Matrix
1392 glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
1393 glPopMatrix(); // Restore The Old Projection Matrix
1394 glEnable(GL_DEPTH_TEST); // Enables Depth Testing
1395 glEnable(GL_CULL_FACE);
1396 glDisable(GL_BLEND);
1402 glEnable(GL_TEXTURE_2D);
1405 sprintf (string, " ]");
1406 text.glPrint(10,30+screenheight-330,string,0,1,screenwidth,screenheight);
1408 sprintf (string, "_");
1409 text.glPrint(30+(float)(displayselected)*10,30+(screenheight-330),string,0,1,screenwidth,screenheight);
1413 if((i!=0||chatting)&&displaytime[i]<4)
1414 for(j=0;j<displaychars[i];j++){
1415 glColor4f(1,1,1,4-displaytime[i]);
1416 if(j<displaychars[i]){
1417 sprintf (string, "%c",displaytext[i][j]);
1418 text.glPrint(30+j*10,30+i*20+(screenheight-330),string,0,1,screenwidth,screenheight);
1424 if(minimap&&indialogue==-1){
1428 glDisable(GL_DEPTH_TEST);
1429 glColor3f (1.0, 1.0, 1.0); // no coloring
1431 glEnable(GL_TEXTURE_2D);
1432 glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE );
1433 glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE );
1434 glDisable(GL_DEPTH_TEST); // Disables Depth Testing
1435 glDisable(GL_CULL_FACE);
1436 glDisable(GL_LIGHTING);
1438 glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
1439 glPushMatrix(); // Store The Projection Matrix
1440 glLoadIdentity(); // Reset The Projection Matrix
1441 glOrtho(0,screenwidth,0,screenheight,-100,100); // Set Up An Ortho Screen
1442 glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
1443 glPushMatrix(); // Store The Modelview Matrix
1444 glLoadIdentity(); // Reset The Modelview Matrix
1445 glScalef((float)screenwidth/2,(float)screenwidth/2,1);
1446 glTranslatef(1.75,.25,0);
1447 glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
1457 int numliveplayers=0;
1458 for(i=0;i<numplayers;i++){
1459 if(!player[i].dead)numliveplayers++;
1465 for(i=0;i<objects.numobjects;i++){
1466 if(objects.type[i]==treetrunktype||objects.type[i]==boxtype){
1467 center+=objects.position[i];
1471 for(i=0;i<numplayers;i++){
1472 if(!player[i].dead)center+=player[i].coords;
1474 center/=numadd+numliveplayers;
1476 center=player[0].coords;
1478 float maxdistance=0;
1481 for(i=0;i<objects.numobjects;i++){
1482 tempdist=findDistancefast(¢er,&objects.position[i]);
1483 if(tempdist>maxdistance){
1485 maxdistance=tempdist;
1488 for(i=0;i<numplayers;i++){
1489 if(!player[i].dead){
1490 tempdist=findDistancefast(¢er,&player[i].coords);
1491 if(tempdist>maxdistance){
1493 maxdistance=tempdist;
1497 radius=fast_sqrt(maxdistance);
1501 glScalef(.25/radius*256*terrain.scale*.4,.25/radius*256*terrain.scale*.4,1);
1503 glScalef(1/(1/radius*256*terrain.scale*.4),1/(1/radius*256*terrain.scale*.4),1);
1504 /*float startx,starty,endx,endy;
1506 glTexCoord2f(1-(center.x-radius)/terrain.scale/256,(center.z-radius)/terrain.scale/256);
1507 glVertex3f(-1, -1, 0.0f);
1508 glTexCoord2f(1-(center.x+radius)/terrain.scale/256,(center.z-radius)/terrain.scale/256);
1509 glVertex3f(1, -1, 0.0f);
1510 glTexCoord2f(1-(center.x+radius)/terrain.scale/256,(center.z+radius)/terrain.scale/256);
1511 glVertex3f(1, 1, 0.0f);
1512 glTexCoord2f(1-(center.x-radius)/terrain.scale/256,(center.z+radius)/terrain.scale/256);
1513 glVertex3f(-1, 1, 0.0f);
1516 glRotatef(player[0].lookrotation*-1+180,0,0,1);
1517 glTranslatef(-(center.x/terrain.scale/256*-2+1),(center.z/terrain.scale/256*-2+1),0);
1518 for(i=0;i<objects.numobjects;i++){
1519 if(objects.type[i]==treetrunktype){
1520 distcheck=findDistancefast(&player[0].coords,&objects.position[i]);
1521 if(distcheck<mapviewdist){
1522 glBindTexture( GL_TEXTURE_2D, Mapcircletexture);
1523 glColor4f(0,.3,0,opac*(1-distcheck/mapviewdist));
1525 glTranslatef(objects.position[i].x/terrain.scale/256*-2+1,objects.position[i].z/terrain.scale/256*2-1,0);
1526 glRotatef(objects.rotation[i],0,0,1);
1527 glScalef(.003,.003,.003);
1530 glVertex3f(-1, -1, 0.0f);
1532 glVertex3f(1, -1, 0.0f);
1534 glVertex3f(1, 1, 0.0f);
1536 glVertex3f(-1, 1, 0.0f);
1541 if(objects.type[i]==boxtype){
1542 distcheck=findDistancefast(&player[0].coords,&objects.position[i]);
1543 if(distcheck<mapviewdist){
1544 glBindTexture( GL_TEXTURE_2D, Mapboxtexture);
1545 glColor4f(.4,.4,.4,opac*(1-distcheck/mapviewdist));
1547 glTranslatef(objects.position[i].x/terrain.scale/256*-2+1,objects.position[i].z/terrain.scale/256*2-1,0);
1548 glRotatef(objects.rotation[i],0,0,1);
1549 glScalef(.01*objects.scale[i],.01*objects.scale[i],.01*objects.scale[i]);
1552 glVertex3f(-1, -1, 0.0f);
1554 glVertex3f(1, -1, 0.0f);
1556 glVertex3f(1, 1, 0.0f);
1558 glVertex3f(-1, 1, 0.0f);
1565 glBindTexture( GL_TEXTURE_2D, Mapcircletexture);
1566 for(i=0;i<numboundaries;i++){
1567 glColor4f(0,0,0,opac/3);
1569 glTranslatef(boundary[i].x/terrain.scale/256*-2+1,boundary[i].z/terrain.scale/256*2-1,0);
1570 glScalef(.002,.002,.002);
1573 glVertex3f(-1, -1, 0.0f);
1575 glVertex3f(1, -1, 0.0f);
1577 glVertex3f(1, 1, 0.0f);
1579 glVertex3f(-1, 1, 0.0f);
1584 for(i=0;i<numplayers;i++){
1585 distcheck=findDistancefast(&player[0].coords,&player[i].coords);
1586 if(distcheck<mapviewdist){
1588 glBindTexture( GL_TEXTURE_2D, Maparrowtexture);
1589 if(i==0)glColor4f(1,1,1,opac);
1590 else if(player[i].dead==2||player[i].howactive>typesleeping)glColor4f(0,0,0,opac*(1-distcheck/mapviewdist));
1591 else if(player[i].dead)glColor4f(.3,.3,.3,opac*(1-distcheck/mapviewdist));
1592 else if(player[i].aitype==attacktypecutoff)glColor4f(1,0,0,opac*(1-distcheck/mapviewdist));
1593 else if(player[i].aitype==passivetype)glColor4f(0,1,0,opac*(1-distcheck/mapviewdist));
1594 else glColor4f(1,1,0,1);
1595 glTranslatef(player[i].coords.x/terrain.scale/256*-2+1,player[i].coords.z/terrain.scale/256*2-1,0);
1596 glRotatef(player[i].rotation+180,0,0,1);
1597 glScalef(.005,.005,.005);
1600 glVertex3f(-1, -1, 0.0f);
1602 glVertex3f(1, -1, 0.0f);
1604 glVertex3f(1, 1, 0.0f);
1606 glVertex3f(-1, 1, 0.0f);
1608 /*glBegin(GL_TRIANGLES);
1610 glVertex3f(-1, -1, 0.0f);
1612 glVertex3f(1, -1, 0.0f);
1614 glVertex3f(0, 1, 0.0f);
1619 /*glBegin(GL_QUADS);
1621 glVertex3f(-1, -1, 0.0f);
1623 glVertex3f(1, -1, 0.0f);
1625 glVertex3f(1, 1, 0.0f);
1627 glVertex3f(-1, 1, 0.0f);
1630 glDisable(GL_TEXTURE_2D);
1631 glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
1632 glPopMatrix(); // Restore The Old Projection Matrix
1633 glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
1634 glPopMatrix(); // Restore The Old Projection Matrix
1635 glEnable(GL_DEPTH_TEST); // Enables Depth Testing
1636 glEnable(GL_CULL_FACE);
1637 glDisable(GL_BLEND);
1643 drawmode=normalmode;
1647 if(loading&&!stealthloading&&(!campaign||player[0].dead)){
1648 glDisable(GL_DEPTH_TEST); // Disables Depth Testing
1649 glDisable(GL_CULL_FACE);
1650 glDisable(GL_LIGHTING);
1651 glDisable(GL_TEXTURE_2D);
1653 glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
1654 glPushMatrix(); // Store The Projection Matrix
1655 glLoadIdentity(); // Reset The Projection Matrix
1656 glOrtho(0,screenwidth,0,screenheight,-100,100); // Set Up An Ortho Screen
1657 glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
1658 glPushMatrix(); // Store The Modelview Matrix
1659 glLoadIdentity(); // Reset The Modelview Matrix
1660 glScalef(screenwidth,screenheight,1);
1661 glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
1663 glColor4f(0,0,0,.7);
1665 glVertex3f(0, 0, 0.0f);
1666 glVertex3f(256, 0, 0.0f);
1667 glVertex3f(256, 256, 0.0f);
1668 glVertex3f(0, 256, 0.0f);
1670 glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
1671 glPopMatrix(); // Restore The Old Projection Matrix
1672 glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
1673 glPopMatrix(); // Restore The Old Projection Matrix
1674 glEnable(GL_DEPTH_TEST); // Enables Depth Testing
1675 glEnable(GL_CULL_FACE);
1676 glDisable(GL_BLEND);
1680 glDisable(GL_DEPTH_TEST);
1681 glColor3f (1.0, 1.0, 1.0); // no coloring
1683 glEnable(GL_TEXTURE_2D);
1684 /*glBindTexture( GL_TEXTURE_2D, logotexture);
1685 glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE );
1686 glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE );
1687 glDisable(GL_DEPTH_TEST); // Disables Depth Testing
1688 glDisable(GL_CULL_FACE);
1689 glDisable(GL_LIGHTING);
1691 glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
1692 glPushMatrix(); // Store The Projection Matrix
1693 glLoadIdentity(); // Reset The Projection Matrix
1694 glOrtho(0,screenwidth,0,screenheight,-100,100); // Set Up An Ortho Screen
1695 glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
1696 glPushMatrix(); // Store The Modelview Matrix
1697 glLoadIdentity(); // Reset The Modelview Matrix
1698 glScalef((float)screenwidth/2,(float)screenwidth/2,1);
1699 glTranslatef(1.8,1.25,0);
1700 glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
1704 glScalef(.25,.25,.25);
1707 glVertex3f(-1, -1, 0.0f);
1709 glVertex3f(1, -1, 0.0f);
1711 glVertex3f(1, 1, 0.0f);
1713 glVertex3f(-1, 1, 0.0f);
1716 glDisable(GL_TEXTURE_2D);
1717 glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
1718 glPopMatrix(); // Restore The Old Projection Matrix
1719 glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
1720 glPopMatrix(); // Restore The Old Projection Matrix
1721 glEnable(GL_DEPTH_TEST); // Enables Depth Testing
1722 glEnable(GL_CULL_FACE);
1723 glDisable(GL_BLEND);
1729 glEnable(GL_TEXTURE_2D);
1731 sprintf (string, "Loading...");
1732 text.glPrint(1024/2-90,768/2,string,1,2,1024,768);
1735 //if(ismotionblur)drawmode=motionblurmode;
1736 drawmode=normalmode;
1739 if(winfreeze&&!campaign){
1740 glDisable(GL_DEPTH_TEST); // Disables Depth Testing
1741 glDisable(GL_CULL_FACE);
1742 glDisable(GL_LIGHTING);
1743 glDisable(GL_TEXTURE_2D);
1745 glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
1746 glPushMatrix(); // Store The Projection Matrix
1747 glLoadIdentity(); // Reset The Projection Matrix
1748 glOrtho(0,screenwidth,0,screenheight,-100,100); // Set Up An Ortho Screen
1749 glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
1750 glPushMatrix(); // Store The Modelview Matrix
1751 glLoadIdentity(); // Reset The Modelview Matrix
1752 glScalef(screenwidth,screenheight,1);
1753 glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
1755 glColor4f(0,0,0,.4);
1757 glVertex3f(0, 0, 0.0f);
1758 glVertex3f(256, 0, 0.0f);
1759 glVertex3f(256, 256, 0.0f);
1760 glVertex3f(0, 256, 0.0f);
1762 glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
1763 glPopMatrix(); // Restore The Old Projection Matrix
1764 glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
1765 glPopMatrix(); // Restore The Old Projection Matrix
1766 glEnable(GL_DEPTH_TEST); // Enables Depth Testing
1767 glEnable(GL_CULL_FACE);
1768 glDisable(GL_BLEND);
1772 glDisable(GL_DEPTH_TEST);
1773 glColor3f (1.0, 1.0, 1.0); // no coloring
1775 glEnable(GL_TEXTURE_2D);
1776 /*glBindTexture( GL_TEXTURE_2D, logotexture);
1777 glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE );
1778 glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE );
1779 glDisable(GL_DEPTH_TEST); // Disables Depth Testing
1780 glDisable(GL_CULL_FACE);
1781 glDisable(GL_LIGHTING);
1783 glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
1784 glPushMatrix(); // Store The Projection Matrix
1785 glLoadIdentity(); // Reset The Projection Matrix
1786 glOrtho(0,screenwidth,0,screenheight,-100,100); // Set Up An Ortho Screen
1787 glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
1788 glPushMatrix(); // Store The Modelview Matrix
1789 glLoadIdentity(); // Reset The Modelview Matrix
1790 glScalef((float)screenwidth/2,(float)screenwidth/2,1);
1791 glTranslatef(1.8,1.25,0);
1792 glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
1796 glScalef(.25,.25,.25);
1799 glVertex3f(-1, -1, 0.0f);
1801 glVertex3f(1, -1, 0.0f);
1803 glVertex3f(1, 1, 0.0f);
1805 glVertex3f(-1, 1, 0.0f);
1808 glDisable(GL_TEXTURE_2D);
1809 glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
1810 glPopMatrix(); // Restore The Old Projection Matrix
1811 glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
1812 glPopMatrix(); // Restore The Old Projection Matrix
1813 glEnable(GL_DEPTH_TEST); // Enables Depth Testing
1814 glEnable(GL_CULL_FACE);
1815 glDisable(GL_BLEND);
1823 if(damagetaken==0&&player[0].bloodloss==0){
1824 awards[numawards]=awardflawless;
1830 for(i=1;i<numplayers;i++){
1831 if(player[i].dead!=2)alldead=0;
1834 awards[numawards]=awardalldead;
1839 for(i=1;i<numplayers;i++){
1840 if(player[i].dead!=1)alldead=0;
1843 awards[numawards]=awardnodead;
1846 if(numresponded==0&&!numthrowkill){
1847 awards[numawards]=awardstealth;
1850 if(numattacks==numstaffattack&&numattacks>0){
1851 awards[numawards]=awardbojutsu;
1854 if(numattacks==numswordattack&&numattacks>0){
1855 awards[numawards]=awardswordsman;
1858 if(numattacks==numknifeattack&&numattacks>0){
1859 awards[numawards]=awardknifefighter;
1862 if(numattacks==numunarmedattack&&numthrowkill==0&&weapons.numweapons>0){
1863 awards[numawards]=awardkungfu;
1867 awards[numawards]=awardevasion;
1870 if(numflipfail==0&&numflipped+numwallflipped*2>20){
1871 awards[numawards]=awardacrobat;
1874 if(numthrowkill==numplayers-1){
1875 awards[numawards]=awardlongrange;
1880 for(i=1;i<numplayers;i++){
1881 if(player[i].dead!=2)alldead=0;
1883 if(numafterkill>0&&alldead){
1884 awards[numawards]=awardbrutal;
1887 if(numreversals>((float)numattacks)*.8&&numreversals>3){
1888 awards[numawards]=awardaikido;
1891 if(maxalarmed==1&&numplayers>2){
1892 awards[numawards]=awardstrategy;
1896 awards[numawards]=awardklutz;
1901 //Win Screen Won Victory
1903 glEnable(GL_TEXTURE_2D);
1905 sprintf (string, "Level Cleared!");
1906 text.glPrintOutlined(1024/2-strlen(string)*10,768*7/8,string,1,2,1024,768);
1908 sprintf (string, "Score: %d",(int)(bonustotal-startbonustotal));
1909 text.glPrintOutlined(1024/30,768*6/8,string,1,2,1024,768);
1911 if(!campaign)sprintf (string, "Press Escape to return to menu or Space to continue");
1912 if(campaign)sprintf (string, "Press Escape or Space to continue");
1913 text.glPrintOutlined(640/2-strlen(string)*5,480*1/16,string,1,1,640,480);
1917 for(i=0;i<255;i++)string[i]='\0';
1918 sprintf (temp, "Time: %d:",(int)(((int)leveltime-(int)(leveltime)%60)/60));
1919 strcat(string,temp);
1920 if((int)(leveltime)%60<10)strcat(string,"0");
1921 sprintf (temp, "%d",(int)(leveltime)%60);
1922 strcat(string,temp);
1923 text.glPrintOutlined(1024/30,768*6/8-40,string,1,2,1024,768);
1925 for(i=0;i<numawards;i++){
1927 if(awards[i]==awardklutz)sprintf (string, "Suicidal");
1928 if(awards[i]==awardflawless)sprintf (string, "Flawless!");
1929 if(awards[i]==awardalldead)sprintf (string, "Take no prisoners");
1930 if(awards[i]==awardnodead)sprintf (string, "Merciful");
1931 if(awards[i]==awardstealth)sprintf (string, "One with the shadows!");
1932 if(awards[i]==awardswordsman)sprintf (string, "Swordsman");
1933 if(awards[i]==awardkungfu)sprintf (string, "Unarmed!");
1934 if(awards[i]==awardknifefighter)sprintf (string, "Knife fighter");
1935 if(awards[i]==awardcoward)sprintf (string, "Coward");
1936 if(awards[i]==awardevasion)sprintf (string, "Escape artist");
1937 if(awards[i]==awardacrobat)sprintf (string, "Gymnast");
1938 if(awards[i]==awardlongrange)sprintf (string, "Blade slinger");
1939 if(awards[i]==awardbrutal)sprintf (string, "Brutal");
1940 if(awards[i]==awardhyper)sprintf (string, "Hyper");
1941 if(awards[i]==awardaikido)sprintf (string, "Aikido master!");
1942 if(awards[i]==awardrambo)sprintf (string, "Rambo");
1943 if(awards[i]==awardfast)sprintf (string, "Fast");
1944 if(awards[i]==awardrealfast)sprintf (string, "Real fast");
1945 if(awards[i]==awarddamnfast)sprintf (string, "Damn fast");
1946 if(awards[i]==awardstrategy)sprintf (string, "Divide and conquer");
1947 if(awards[i]==awardbojutsu)sprintf (string, "Bojutsu");
1948 text.glPrintOutlined(1024/30,768*6/8-90-40*i,string,1,2,1024,768);
1952 //drawmode=normalmode;
1955 if(drawmode!=normalmode){
1956 glEnable(GL_TEXTURE_2D);
1958 if(!drawtoggle||drawmode!=realmotionblurmode||(drawtoggle==2||change==1)){
1961 glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE_EXT);
1962 GLfloat subtractColor[4] = { 0.5, 0.5, 0.5, 0.0 };
1963 glTexEnvfv(GL_TEXTURE_ENV, GL_TEXTURE_ENV_COLOR, subtractColor);
1964 //glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB_EXT, GL_SUBTRACT);
1965 glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_RGB_EXT, GL_TEXTURE);
1966 glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE1_RGB_EXT, GL_CONSTANT_EXT);
1967 glTexEnvf(GL_TEXTURE_ENV, GL_RGB_SCALE_EXT, 2.0f);
1969 glBindTexture( GL_TEXTURE_2D, screentexture);
1970 glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 0, texviewwidth, texviewheight);
1973 if((drawtoggle||change==1)&&drawmode==realmotionblurmode){
1975 glBindTexture( GL_TEXTURE_2D, screentexture2);
1976 glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 0, texviewwidth, texviewheight);
1978 if(!screentexture2){
1979 glPixelStorei( GL_UNPACK_ALIGNMENT, 1 );
1981 glGenTextures( 1, &screentexture2 );
1982 glTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE );
1984 glEnable(GL_TEXTURE_2D);
1985 glBindTexture( GL_TEXTURE_2D, screentexture2);
1986 glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR );
1987 glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR );
1989 glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 0, 0, kTextureSize, kTextureSize, 0);
1995 glClear(GL_DEPTH_BUFFER_BIT);
1996 ReSizeGLScene(90,.1f);
1997 glViewport(0,0,screenwidth,screenheight);
1999 if(drawmode!=normalmode){
2000 glDisable(GL_DEPTH_TEST);
2001 if(drawmode==motionblurmode){
2002 glDrawBuffer(GL_FRONT);
2003 glReadBuffer(GL_BACK);
2004 //myassert(glGetError() == GL_NO_ERROR);
2007 glColor3f (1.0, 1.0, 1.0); // no coloring
2009 glEnable(GL_TEXTURE_2D);
2010 glBindTexture( GL_TEXTURE_2D, screentexture);
2011 glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE );
2012 glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE );
2013 glDisable(GL_DEPTH_TEST); // Disables Depth Testing
2014 glDisable(GL_CULL_FACE);
2015 glDisable(GL_LIGHTING);
2017 glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
2018 glPushMatrix(); // Store The Projection Matrix
2019 glLoadIdentity(); // Reset The Projection Matrix
2020 glOrtho(0,screenwidth,0,screenheight,-100,100); // Set Up An Ortho Screen
2021 glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
2022 glPushMatrix(); // Store The Modelview Matrix
2023 glLoadIdentity(); // Reset The Modelview Matrix
2024 glScalef((float)screenwidth/2,(float)screenheight/2,1);
2025 glTranslatef(1,1,0);
2026 glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
2028 if(drawmode==motionblurmode){
2029 if(motionbluramount<.2)motionbluramount=.2;
2030 //glColor4f(1,1,1,fast_sqrt(multiplier)*2.9*motionbluramount);
2031 glColor4f(1,1,1,motionbluramount);
2035 glVertex3f(-1, -1, 0.0f);
2036 glTexCoord2f(texcoordwidth,0);
2037 glVertex3f(1, -1, 0.0f);
2038 glTexCoord2f(texcoordwidth,texcoordheight);
2039 glVertex3f(1, 1, 0.0f);
2040 glTexCoord2f(0,texcoordheight);
2041 glVertex3f(-1, 1, 0.0f);
2045 if(drawmode==realmotionblurmode){
2046 glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
2047 glClear(GL_COLOR_BUFFER_BIT);
2048 glBlendFunc(GL_SRC_ALPHA,GL_ONE);
2049 glBindTexture( GL_TEXTURE_2D, screentexture);
2050 glColor4f(1,1,1,.5);
2054 glVertex3f(-1, -1, 0.0f);
2055 glTexCoord2f(texcoordwidth,0);
2056 glVertex3f(1, -1, 0.0f);
2057 glTexCoord2f(texcoordwidth,texcoordheight);
2058 glVertex3f(1, 1, 0.0f);
2059 glTexCoord2f(0,texcoordheight);
2060 glVertex3f(-1, 1, 0.0f);
2063 glBindTexture( GL_TEXTURE_2D, screentexture2);
2064 glColor4f(1,1,1,.5);
2068 glVertex3f(-1, -1, 0.0f);
2069 glTexCoord2f(texcoordwidth,0);
2070 glVertex3f(1, -1, 0.0f);
2071 glTexCoord2f(texcoordwidth,texcoordheight);
2072 glVertex3f(1, 1, 0.0f);
2073 glTexCoord2f(0,texcoordheight);
2074 glVertex3f(-1, 1, 0.0f);
2077 glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
2079 if(drawmode==doublevisionmode){
2080 static float crosseyedness;
2081 crosseyedness=abs(player[0].damage-player[0].superpermanentdamage-(player[0].damagetolerance-player[0].superpermanentdamage)*1/2)/30;
2082 if(crosseyedness>1)crosseyedness=1;
2083 if(crosseyedness<0)crosseyedness=0;
2085 glDisable(GL_BLEND);
2090 glVertex3f(-1, -1, 0.0f);
2091 glTexCoord2f(texcoordwidth,0);
2092 glVertex3f(1, -1, 0.0f);
2093 glTexCoord2f(texcoordwidth,texcoordheight);
2094 glVertex3f(1, 1, 0.0f);
2095 glTexCoord2f(0,texcoordheight);
2096 glVertex3f(-1, 1, 0.0f);
2100 glColor4f(1,1,1,.5);
2103 glTranslatef(.015*crosseyedness,0,0);
2107 glVertex3f(-1, -1, 0.0f);
2108 glTexCoord2f(texcoordwidth,0);
2109 glVertex3f(1, -1, 0.0f);
2110 glTexCoord2f(texcoordwidth,texcoordheight);
2111 glVertex3f(1, 1, 0.0f);
2112 glTexCoord2f(0,texcoordheight);
2113 glVertex3f(-1, 1, 0.0f);
2118 if(drawmode==glowmode){
2119 glColor4f(.5,.5,.5,.5);
2121 glBlendFunc(GL_SRC_ALPHA,GL_ONE);
2123 glTranslatef(.01,0,0);
2126 glVertex3f(-1, -1, 0.0f);
2127 glTexCoord2f(texcoordwidth,0);
2128 glVertex3f(1, -1, 0.0f);
2129 glTexCoord2f(texcoordwidth,texcoordheight);
2130 glVertex3f(1, 1, 0.0f);
2131 glTexCoord2f(0,texcoordheight);
2132 glVertex3f(-1, 1, 0.0f);
2136 glTranslatef(-.01,0,0);
2139 glVertex3f(-1, -1, 0.0f);
2140 glTexCoord2f(texcoordwidth,0);
2141 glVertex3f(1, -1, 0.0f);
2142 glTexCoord2f(texcoordwidth,texcoordheight);
2143 glVertex3f(1, 1, 0.0f);
2144 glTexCoord2f(0,texcoordheight);
2145 glVertex3f(-1, 1, 0.0f);
2149 glTranslatef(.0,.01,0);
2152 glVertex3f(-1, -1, 0.0f);
2153 glTexCoord2f(texcoordwidth,0);
2154 glVertex3f(1, -1, 0.0f);
2155 glTexCoord2f(texcoordwidth,texcoordheight);
2156 glVertex3f(1, 1, 0.0f);
2157 glTexCoord2f(0,texcoordheight);
2158 glVertex3f(-1, 1, 0.0f);
2162 glTranslatef(0,-.01,0);
2165 glVertex3f(-1, -1, 0.0f);
2166 glTexCoord2f(texcoordwidth,0);
2167 glVertex3f(1, -1, 0.0f);
2168 glTexCoord2f(texcoordwidth,texcoordheight);
2169 glVertex3f(1, 1, 0.0f);
2170 glTexCoord2f(0,texcoordheight);
2171 glVertex3f(-1, 1, 0.0f);
2175 if(drawmode==radialzoommode){
2177 //glRotatef((float)i*.1,0,0,1);
2178 glColor4f(1,1,1,1/((float)i+1));
2180 glScalef(1+(float)i*.01,1+(float)i*.01,1);
2183 glVertex3f(-1, -1, 0.0f);
2184 glTexCoord2f(texcoordwidth,0);
2185 glVertex3f(1, -1, 0.0f);
2186 glTexCoord2f(texcoordwidth,texcoordheight);
2187 glVertex3f(1, 1, 0.0f);
2188 glTexCoord2f(0,texcoordheight);
2189 glVertex3f(-1, 1, 0.0f);
2194 glDisable(GL_TEXTURE_2D);
2195 glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
2196 glPopMatrix(); // Restore The Old Projection Matrix
2197 glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
2198 glPopMatrix(); // Restore The Old Projection Matrix
2199 glEnable(GL_DEPTH_TEST); // Enables Depth Testing
2200 glEnable(GL_CULL_FACE);
2201 glDisable(GL_BLEND);
2206 glEnable(GL_TEXTURE_2D);
2211 if(consoleselected>=60)offset=consoleselected-60;
2212 sprintf (string, " ]");
2213 text.glPrint(10,30,string,0,1,1024,768);
2215 sprintf (string, "_");
2216 text.glPrint(30+(float)(consoleselected)*10-offset*10,30,string,0,1,1024,768);
2219 for(j=0;j<consolechars[i];j++){
2220 glColor4f(1,1,1,1-(float)(i)/16);
2221 if(j<consolechars[i]){
2222 sprintf (string, "%c",consoletext[i][j]);
2223 text.glPrint(30+j*10-offset*10,30+i*20,string,0,1,1024,768);
2231 if(freeze||winfreeze||(mainmenu&&gameon)||(!gameon&&gamestarted)||(mainmenu&&gameon)||(!gameon&&gamestarted)||(!gameon&&gamestarted)){
2232 multiplier=tempmult;
2236 glDrawBuffer(GL_BACK);
2237 glReadBuffer(GL_BACK);
2238 glTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE );
2239 ReSizeGLScene(90,.1f);
2242 temptexdetail=texdetail;
2243 if(texdetail>2)texdetail=2;
2244 if(mainmenu!=oldmainmenu&&oldmainmenu!=0){
2246 LoadTexture(":Data:Textures:Newgame.png",&Mainmenuitems[1],0,0);
2247 LoadTexture(":Data:Textures:Quit.png",&Mainmenuitems[3],0,0);
2248 /*if(oldmainmenu==1||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 LoadTexture(":Data:Textures:Resume.png",&Mainmenuitems[1],0,0);
2257 LoadTexture(":Data:Textures:Endgame.png",&Mainmenuitems[3],0,0);
2258 /*if(oldmainmenu==2||oldmainmenu==0){
2259 LoadTexture(":Data:Textures:World.png",&Mainmenuitems[7],0,0);
2260 LoadTexture(":Data:Textures:Options.png",&Mainmenuitems[2],0,0);
2261 LoadTexture(":Data:Textures:Lugaru.png",&Mainmenuitems[0],0,0);
2266 if(lastcheck>.5||oldmainmenu!=mainmenu){
2268 // ifstream ipstream(":Data:Campaigns:main.txt");
2269 ifstream ipstream("./Data/Campaigns/main.txt");
2270 //campaignnumlevels=0;
2271 //accountcampaignchoicesmade[accountactive]=0;
2272 ipstream.ignore(256,':');
2273 ipstream >> campaignnumlevels;
2274 for(i=0;i<campaignnumlevels;i++){
2275 ipstream.ignore(256,':');
2276 ipstream.ignore(256,':');
2277 ipstream.ignore(256,' ');
2278 ipstream >> campaignmapname[i];
2279 ipstream.ignore(256,':');
2280 ipstream >> campaigndescription[i];
2282 if(campaigndescription[i][j]=='_')campaigndescription[i][j]=' ';
2284 ipstream.ignore(256,':');
2285 ipstream >> campaignchoosenext[i];
2286 ipstream.ignore(256,':');
2287 ipstream >> campaignnumnext[i];
2288 if(campaignnumnext[i])
2289 for(j=0;j<campaignnumnext[i];j++){
2290 ipstream.ignore(256,':');
2291 ipstream >> campaignnextlevel[i][j];
2292 campaignnextlevel[i][j]-=1;
2294 ipstream.ignore(256,':');
2295 ipstream >> campaignlocationx[i];
2296 //campaignlocationx[i]-=30;
2297 ipstream.ignore(256,':');
2298 ipstream >> campaignlocationy[i];
2299 //campaignlocationy[i]+=30;
2303 for(i=0;i<campaignnumlevels;i++){
2305 levelhighlight[i]=0;
2310 if(accountcampaignchoicesmade[accountactive])
2311 for(i=0;i<accountcampaignchoicesmade[accountactive];i++){
2312 levelorder[i+1]=campaignnextlevel[levelorder[i]][accountcampaignchoices[accountactive][i]];
2313 levelvisible[levelorder[i+1]]=1;
2315 int whichlevelstart;
2316 whichlevelstart=accountcampaignchoicesmade[accountactive]-1;
2317 if(whichlevelstart<0){
2318 accountcampaignscore[accountactive]=0;
2319 accountcampaignfasttime[accountactive]=0;
2320 campaignchoicenum=1;
2321 campaignchoicewhich[0]=0;
2325 campaignchoicenum=campaignnumnext[levelorder[whichlevelstart]];
2326 if(campaignchoicenum==0){
2327 if(accountcampaignscore[accountactive]>accountcampaignhighscore[accountactive])accountcampaignhighscore[accountactive]=accountcampaignscore[accountactive];
2328 if(accountcampaignfasttime[accountactive]==0||accountcampaigntime[accountactive]<accountcampaignfasttime[accountactive])accountcampaignfasttime[accountactive]=accountcampaigntime[accountactive];
2330 if(campaignchoicenum)
2331 for(i=0;i<campaignchoicenum;i++){
2332 campaignchoicewhich[i]=campaignnextlevel[levelorder[whichlevelstart]][i];
2333 levelvisible[campaignnextlevel[levelorder[whichlevelstart]][i]]=1;
2334 levelhighlight[campaignnextlevel[levelorder[whichlevelstart]][i]]=1;
2347 texdetail=temptexdetail;
2349 /*if(mainmenu!=0)*/oldmainmenu=mainmenu;
2351 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){
2352 glClear(GL_DEPTH_BUFFER_BIT);
2353 glEnable(GL_ALPHA_TEST);
2354 glAlphaFunc(GL_GREATER, 0.001f);
2355 glEnable(GL_TEXTURE_2D);
2356 glDisable(GL_DEPTH_TEST); // Disables Depth Testing
2357 glDisable(GL_CULL_FACE);
2358 glDisable(GL_LIGHTING);
2360 glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
2361 glPushMatrix(); // Store The Projection Matrix
2362 glLoadIdentity(); // Reset The Projection Matrix
2363 glOrtho(0,screenwidth,0,screenheight,-100,100); // Set Up An Ortho Screen
2364 glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
2365 glPushMatrix(); // Store The Modelview Matrix
2366 glLoadIdentity(); // Reset The Modelview Matrix
2367 glTranslatef(screenwidth/2,screenheight/2,0);
2369 glScalef((float)screenwidth/2,(float)screenheight/2,1);
2370 glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
2371 glDisable(GL_BLEND);
2372 glColor4f(0,0,0,1.0);
2373 glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP );
2374 glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP );
2375 glDisable(GL_TEXTURE_2D);
2377 //glScalef(.25,.25,.25);
2380 glVertex3f(-1, -1, 0.0f);
2382 glVertex3f(1, -1, 0.0f);
2384 glVertex3f(1, 1, 0.0f);
2386 glVertex3f(-1, 1, 0.0f);
2390 glColor4f(0.4,0.4,0.4,1.0);
2391 glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP );
2392 glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP );
2393 glEnable(GL_TEXTURE_2D);
2394 glBindTexture( GL_TEXTURE_2D, Mainmenuitems[4]);
2396 //glScalef(.25,.25,.25);
2399 glVertex3f(-1, -1, 0.0f);
2401 glVertex3f(1, -1, 0.0f);
2403 glVertex3f(1, 1, 0.0f);
2405 glVertex3f(-1, 1, 0.0f);
2410 glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
2412 glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
2416 if((float)newscreenwidth>(float)newscreenheight*1.61||(float)newscreenwidth<(float)newscreenheight*1.59)sprintf (menustring[0], "Resolution: %d*%d",(int)newscreenwidth,(int)newscreenheight);
2417 else sprintf (menustring[0], "Resolution: %d*%d (widescreen)",(int)newscreenwidth,(int)newscreenheight);
2420 endx[0]=startx[0]+strlen(menustring[0])*10;
2421 endy[0]=starty[0]+20;
2425 if(newdetail==2)sprintf (menustring[1], "Detail: High");
2426 else if(newdetail==1)sprintf (menustring[1], "Detail: Medium");
2427 else sprintf (menustring[1], "Detail: Low");
2430 endx[1]=startx[1]+strlen(menustring[1])*10;
2431 endy[1]=starty[1]+20;
2435 if(bloodtoggle==2)sprintf (menustring[2], "Blood: On, high detail (slower)");
2436 if(bloodtoggle==1)sprintf (menustring[2], "Blood: On, low detail");
2437 if(bloodtoggle==0)sprintf (menustring[2], "Blood: Off");
2440 endx[2]=startx[2]+strlen(menustring[2])*10;
2441 endy[2]=starty[2]+20;
2445 if(difficulty==2)sprintf (menustring[3], "Difficulty: Insane");
2446 if(difficulty==1)sprintf (menustring[3], "Difficulty: Difficult");
2447 if(difficulty==0)sprintf (menustring[3], "Difficulty: Easier");
2448 startx[3]=10+20-1000;
2450 endx[3]=startx[3]+strlen(menustring[3])*10;
2451 endy[3]=starty[3]+20;
2455 if(ismotionblur==1)sprintf (menustring[4], "Blur Effects: Enabled (less compatible)");
2456 if(ismotionblur==0)sprintf (menustring[4], "Blur Effects: Disabled (more compatible)");
2459 endx[4]=startx[4]+strlen(menustring[4])*10;
2460 endy[4]=starty[4]+20;
2464 if(decals==1)sprintf (menustring[5], "Decals: Enabled (slower)");
2465 if(decals==0)sprintf (menustring[5], "Decals: Disabled");
2468 endx[5]=startx[5]+strlen(menustring[5])*10;
2469 endy[5]=starty[5]+20;
2473 if(musictoggle==1)sprintf (menustring[6], "Music: Enabled");
2474 if(musictoggle==0)sprintf (menustring[6], "Music: Disabled");
2477 endx[6]=startx[6]+strlen(menustring[6])*10;
2478 endy[6]=starty[6]+20;
2482 if(invertmouse==1)sprintf (menustring[9], "Invert mouse: Yes");
2483 if(invertmouse==0)sprintf (menustring[9], "Invert mouse: No");
2486 endx[9]=startx[9]+strlen(menustring[9])*10;
2487 endy[9]=starty[9]+20;
2491 sprintf (menustring[10], "Mouse Speed: %d", (int)(usermousesensitivity*5));
2494 endx[10]=startx[10]+strlen(menustring[10])*10;
2495 endy[10]=starty[10]+20;
2499 sprintf (menustring[11], "Volume: %d%", (int)(volume*100));
2502 endx[11]=startx[11]+strlen(menustring[11])*10;
2503 endy[11]=starty[11]+20;
2507 sprintf (menustring[7], "-Configure Controls-");
2510 endx[7]=startx[7]+strlen(menustring[7])*10;
2511 endy[7]=starty[7]+20;
2515 if(newdetail==detail&&newscreenheight==(int)screenheight&&newscreenwidth==(int)screenwidth)sprintf (menustring[8], "Back");
2516 else sprintf (menustring[8], "Back (some changes take effect next time Lugaru is opened)");
2518 endx[8]=startx[8]+strlen(menustring[8])*10;
2520 endy[8]=starty[8]+20;
2527 if(keyselect!=0)sprintf (menustring[0], "Forwards: %s",KeyToChar(forwardkey));
2528 else sprintf (menustring[0], "Forwards: _");
2531 endx[0]=startx[0]+strlen(menustring[0])*10;
2532 endy[0]=starty[0]+20;
2536 if(keyselect!=1)sprintf (menustring[1], "Back: %s",KeyToChar(backkey));
2537 else sprintf (menustring[1], "Back: _");
2540 endx[1]=startx[1]+strlen(menustring[1])*10;
2541 endy[1]=starty[1]+20;
2545 if(keyselect!=2)sprintf (menustring[2], "Left: %s",KeyToChar(leftkey));
2546 else sprintf (menustring[2], "Left: _");
2549 endx[2]=startx[2]+strlen(menustring[2])*10;
2550 endy[2]=starty[2]+20;
2554 if(keyselect!=3)sprintf (menustring[3], "Right: %s",KeyToChar(rightkey));
2555 else sprintf (menustring[3], "Right: _");
2558 endx[3]=startx[3]+strlen(menustring[3])*10;
2559 endy[3]=starty[3]+20;
2563 if(keyselect!=4)sprintf (menustring[4], "Crouch: %s",KeyToChar(crouchkey));
2564 else sprintf (menustring[4], "Crouch: _");
2567 endx[4]=startx[4]+strlen(menustring[4])*10;
2568 endy[4]=starty[4]+20;
2572 if(keyselect!=5)sprintf (menustring[5], "Jump: %s",KeyToChar(jumpkey));
2573 else sprintf (menustring[5], "Jump: _");
2576 endx[5]=startx[5]+strlen(menustring[5])*10;
2577 endy[5]=starty[5]+20;
2581 if(keyselect!=6)sprintf (menustring[6], "Draw: %s",KeyToChar(drawkey));
2582 else sprintf (menustring[6], "Draw: _");
2585 endx[6]=startx[6]+strlen(menustring[6])*10;
2586 endy[6]=starty[6]+20;
2590 if(keyselect!=7)sprintf (menustring[7], "Throw: %s",KeyToChar(throwkey));
2591 else sprintf (menustring[7], "Throw: _");
2594 endx[7]=startx[7]+strlen(menustring[7])*10;
2595 endy[7]=starty[7]+20;
2599 if(keyselect!=8)sprintf (menustring[8], "Attack: %s",KeyToChar(attackkey));
2600 else sprintf (menustring[8], "Attack: _");
2603 endx[8]=startx[8]+strlen(menustring[8])*10;
2604 endy[8]=starty[8]+20;
2610 sprintf (menustring[9], "Back");
2612 endx[9]=startx[9]+strlen(menustring[9])*10;
2614 endy[9]=starty[9]+20;
2619 nummenuitems=7+accountcampaignchoicesmade[accountactive]+campaignchoicenum;
2621 sprintf (menustring[0], "%s",accountname[accountactive]);
2624 endx[0]=startx[0]+strlen(menustring[0])*10;
2625 endy[0]=starty[0]+20;
2629 sprintf (menustring[1], "Tutorial");
2632 endx[1]=startx[1]+strlen(menustring[1])*10;
2633 endy[1]=starty[1]+20;
2637 sprintf (menustring[2], "Challenge");
2640 endx[2]=startx[2]+strlen(menustring[2])*10;
2641 endy[2]=starty[2]+20;
2645 sprintf (menustring[3], "Delete User");
2648 endx[3]=startx[3]+strlen(menustring[3])*10;
2649 endy[3]=starty[3]+20;
2653 sprintf (menustring[4], "Main Menu");
2656 endx[4]=startx[4]+strlen(menustring[4])*10;
2657 endy[4]=starty[4]+20;
2661 sprintf (menustring[5], "Change User");
2663 endx[5]=startx[5]+strlen(menustring[5])*10;
2665 endy[5]=starty[5]+20;
2671 sprintf (menustring[6], "World");
2673 starty[6]=30+480-400-50;
2674 endx[6]=startx[6]+400;
2679 if(accountcampaignchoicesmade[accountactive])
2680 for(i=0;i<accountcampaignchoicesmade[accountactive];i++){
2681 sprintf (menustring[7+i], campaigndescription[levelorder[i]]);
2682 startx[7+i]=30+120+campaignlocationx[levelorder[i]]*400/512;
2683 starty[7+i]=30+30+(512-campaignlocationy[levelorder[i]])*400/512;
2684 endx[7+i]=startx[7+i]+10;
2685 endy[7+i]=starty[7+i]+10;
2690 if(campaignchoicenum>0)
2691 for(i=accountcampaignchoicesmade[accountactive];i<accountcampaignchoicesmade[accountactive]+campaignchoicenum;i++){
2692 sprintf (menustring[7+i], campaigndescription[levelorder[i]]);
2693 startx[7+i]=30+120+campaignlocationx[campaignchoicewhich[i-(accountcampaignchoicesmade[accountactive])]]*400/512;
2694 starty[7+i]=30+30+(512-campaignlocationy[campaignchoicewhich[i-(accountcampaignchoicesmade[accountactive])]])*400/512;
2695 endx[7+i]=startx[7+i]+10;
2696 endy[7+i]=starty[7+i]+10;
2701 /*sprintf (menustring[7], "Dot");
2702 startx[7]=120+260*400/512;
2703 starty[7]=30+(512-184)*400/512;
2704 endx[7]=startx[7]+10;
2705 endy[7]=starty[7]+10;
2709 sprintf (menustring[8], "Dot");
2710 startx[8]=120+129*400/512;
2711 starty[8]=30+(512-284)*400/512;
2712 endx[8]=startx[8]+10;
2713 endy[8]=starty[8]+10;
2717 sprintf (menustring[9], "Dot");
2718 startx[9]=120+358*400/512;
2719 starty[9]=30+(512-235)*400/512;
2720 endx[9]=startx[9]+10;
2721 endy[9]=starty[9]+10;
2725 sprintf (menustring[10], "Dot");
2726 startx[10]=120+359*400/512;
2727 starty[10]=30+(512-308)*400/512;
2728 endx[10]=startx[10]+10;
2729 endy[10]=starty[10]+10;
2733 sprintf (menustring[11], "Dot");
2734 startx[11]=120+288*400/512;
2735 starty[11]=30+(512-277)*400/512;
2736 endx[11]=startx[11]+10;
2737 endy[11]=starty[11]+10;
2745 sprintf (menustring[0], "Are you sure you want to delete this user?");
2748 endx[0]=startx[0]+strlen(menustring[0])*10;
2749 endy[0]=starty[0]+20;
2753 sprintf (menustring[1], "Yes");
2756 endx[1]=startx[1]+strlen(menustring[1])*10;
2757 endy[1]=starty[1]+20;
2761 sprintf (menustring[2], "No");
2764 endx[2]=startx[2]+strlen(menustring[2])*10;
2765 endy[2]=starty[2]+20;
2769 sprintf (menustring[3], "Extra 4");
2772 endx[3]=startx[3]+strlen(menustring[3])*10;
2773 endy[3]=starty[3]+20;
2777 sprintf (menustring[4], "Extra 5");
2780 endx[4]=startx[4]+strlen(menustring[4])*10;
2781 endy[4]=starty[4]+20;
2785 sprintf (menustring[5], "Back");
2787 endx[5]=startx[5]+strlen(menustring[5])*10;
2789 endy[5]=starty[5]+20;
2795 nummenuitems=numaccounts+2;
2800 sprintf (menustring[0], "New User");
2802 sprintf (menustring[0], "No More Users");
2805 endx[0]=startx[0]+strlen(menustring[0])*10;
2806 endy[0]=starty[0]+20;
2810 if(entername)startx[0]+=10;
2815 for(i=0;i<numaccounts;i++){
2816 sprintf (menustring[num], "%s",accountname[i]);
2818 starty[num]=360-20-20*num;
2819 endx[num]=startx[num]+strlen(menustring[num])*10;
2820 endy[num]=starty[num]+20;
2827 sprintf (menustring[num], "Back");
2829 endx[num]=startx[num]+strlen(menustring[num])*10;
2831 endy[num]=starty[num]+20;
2838 sprintf (menustring[0], "Easier");
2841 endx[0]=startx[0]+strlen(menustring[0])*10;
2842 endy[0]=starty[0]+20;
2846 sprintf (menustring[1], "Difficult");
2849 endx[1]=startx[1]+strlen(menustring[1])*10;
2850 endy[1]=starty[1]+20;
2854 sprintf (menustring[2], "Insane");
2857 endx[2]=startx[2]+strlen(menustring[2])*10;
2858 endy[2]=starty[2]+20;
2864 //tempncl=numchallengelevels;
2865 //numchallengelevels=9;
2866 nummenuitems=2+numchallengelevels;
2869 for(j=0;j<numchallengelevels;j++){
2870 for(i=0;i<255;i++)menustring[j][i]='\0';
2871 sprintf (temp, "Level %d",j+1);
2872 strcpy(menustring[j],temp);
2873 for(i=0;i<17;i++)if(menustring[j][i]=='\0')menustring[j][i]=' ';
2874 menustring[j][17]='\0';
2875 sprintf (temp, "%d",(int)accounthighscore[accountactive][j]);
2876 strcat(menustring[j],temp);
2877 for(i=18;i<32;i++)if(menustring[j][i]=='\0')menustring[j][i]=' ';
2878 menustring[j][32]='\0';
2879 sprintf (temp, "%d:",(int)(((int)accountfasttime[accountactive][j]-(int)(accountfasttime[accountactive][j])%60)/60));
2880 strcat(menustring[j],temp);
2881 if((int)(accountfasttime[accountactive][j])%60<10)strcat(menustring[j],"0");
2882 sprintf (temp, "%d",(int)(accountfasttime[accountactive][j])%60);
2883 strcat(menustring[j],temp);
2887 endx[j]=startx[j]+strlen(menustring[j])*10;
2888 endy[j]=starty[j]+20;
2893 sprintf (menustring[numchallengelevels], "Back");
2894 startx[numchallengelevels]=10;
2895 endx[numchallengelevels]=startx[numchallengelevels]+strlen(menustring[numchallengelevels])*10;
2896 starty[numchallengelevels]=10;
2897 endy[numchallengelevels]=starty[numchallengelevels]+20;
2898 movex[numchallengelevels]=0;
2899 movey[numchallengelevels]=0;
2901 sprintf (menustring[numchallengelevels+1], " High Score Best Time");
2902 startx[numchallengelevels+1]=10;
2903 starty[numchallengelevels+1]=440;
2904 endx[numchallengelevels+1]=startx[numchallengelevels+1]+strlen(menustring[numchallengelevels+1])*10;
2905 endy[numchallengelevels+1]=starty[numchallengelevels+1]+20;
2906 movex[numchallengelevels+1]=0;
2907 movey[numchallengelevels+1]=0;
2909 //numchallengelevels=tempncl;
2913 nummenuitems=2+numchallengelevels;
2916 for(j=0;j<numchallengelevels;j++){
2917 for(i=0;i<255;i++)menustring[j][i]='\0';
2918 sprintf (temp, "Level %d",j+1);
2919 strcpy(menustring[j],temp);
2920 for(i=0;i<17;i++)if(menustring[j][i]=='\0')menustring[j][i]=' ';
2921 menustring[j][17]='\0';
2922 sprintf (temp, "%d",(int)accounthighscore[accountactive][j]);
2923 strcat(menustring[j],temp);
2924 for(i=18;i<32;i++)if(menustring[j][i]=='\0')menustring[j][i]=' ';
2925 menustring[j][32]='\0';
2926 sprintf (temp, "%d:",(int)(((int)accountfasttime[accountactive][j]-(int)(accountfasttime[accountactive][j])%60)/60));
2927 strcat(menustring[j],temp);
2928 if((int)(accountfasttime[accountactive][j])%60<10)strcat(menustring[j],"0");
2929 sprintf (temp, "%d",(int)(accountfasttime[accountactive][j])%60);
2930 strcat(menustring[j],temp);
2934 endx[j]=startx[j]+strlen(menustring[j])*10;
2935 endy[j]=starty[j]+20;
2940 sprintf (menustring[numchallengelevels], "Back");
2941 startx[numchallengelevels]=10;
2942 endx[numchallengelevels]=startx[numchallengelevels]+strlen(menustring[numchallengelevels])*10;
2943 starty[numchallengelevels]=10;
2944 endy[numchallengelevels]=starty[numchallengelevels]+20;
2945 movex[numchallengelevels]=0;
2946 movey[numchallengelevels]=0;
2948 sprintf (menustring[numchallengelevels+1], " High Score Best Time");
2949 startx[numchallengelevels+1]=10;
2950 starty[numchallengelevels+1]=400;
2951 endx[numchallengelevels+1]=startx[numchallengelevels+1]+strlen(menustring[numchallengelevels+1])*10;
2952 endy[numchallengelevels+1]=starty[numchallengelevels+1]+20;
2953 movex[numchallengelevels+1]=0;
2954 movey[numchallengelevels+1]=0;
2961 sprintf (menustring[0], "Congratulations!");
2964 endx[0]=startx[0]+strlen(menustring[0])*10;
2965 endy[0]=starty[0]+20;
2969 sprintf (menustring[1], "You have avenged your family and");
2972 endx[1]=startx[1]+strlen(menustring[1])*10;
2973 endy[1]=starty[1]+20;
2977 sprintf (menustring[2], "restored peace to the island of Lugaru.");
2980 endx[2]=startx[2]+strlen(menustring[2])*10;
2981 endy[2]=starty[2]+20;
2985 sprintf (menustring[3], "Back");
2987 endx[3]=startx[3]+strlen(menustring[3])*10;
2989 endy[3]=starty[3]+20;
2993 for(i=0;i<255;i++)menustring[4][i]='\0';
2994 sprintf (temp, "Your score:");
2995 strcpy(menustring[4],temp);
2996 for(i=0;i<20;i++)if(menustring[4][i]=='\0')menustring[4][i]=' ';
2997 menustring[4][20]='\0';
2998 sprintf (temp, "%d",(int)accountcampaignscore[accountactive]);
2999 strcat(menustring[4],temp);
3001 endx[4]=startx[4]+strlen(menustring[4])*10;
3003 endy[4]=starty[4]+20;
3007 for(i=0;i<255;i++)menustring[5][i]='\0';
3008 sprintf (temp, "Your time:");
3009 strcpy(menustring[5],temp);
3010 for(i=0;i<20;i++)if(menustring[5][i]=='\0')menustring[5][i]=' ';
3011 menustring[5][20]='\0';
3012 sprintf (temp, "%d",(int)accountcampaigntime[accountactive]);
3013 strcat(menustring[5],temp);
3015 endx[5]=startx[5]+strlen(menustring[5])*10;
3017 endy[5]=starty[5]+20;
3021 for(i=0;i<255;i++)menustring[5][i]='\0';
3022 sprintf (temp, "Highest score:");
3023 strcpy(menustring[5],temp);
3024 for(i=0;i<20;i++)if(menustring[5][i]=='\0')menustring[5][i]=' ';
3025 menustring[5][20]='\0';
3026 sprintf (temp, "%d",(int)accountcampaignhighscore[accountactive]);
3027 strcat(menustring[5],temp);
3029 endx[5]=startx[5]+strlen(menustring[5])*10;
3031 endy[5]=starty[5]+20;
3035 for(i=0;i<255;i++)menustring[7][i]='\0';
3036 sprintf (temp, "Lowest time:");
3037 strcpy(menustring[7],temp);
3038 for(i=0;i<20;i++)if(menustring[7][i]=='\0')menustring[7][i]=' ';
3039 menustring[7][20]='\0';
3040 sprintf (temp, "%d",(int)accountcampaignfasttime[accountactive]);
3041 strcat(menustring[7],temp);
3043 endx[7]=startx[7]+strlen(menustring[7])*10;
3045 endy[7]=starty[7]+20;
3052 menupulse+=multiplier*2;
3057 sprintf (menustring[0], "Register now for only $19.95!");
3060 endx[0]=startx[0]+strlen(menustring[0])*10;
3061 endy[0]=starty[0]+20;
3065 sprintf (menustring[1], "Confront raiders, wolves, and more!");
3068 endx[1]=startx[1]+strlen(menustring[1])*10;
3069 endy[1]=starty[1]+20;
3073 sprintf (menustring[2], "Fight using swords, staves and armor!");
3076 endx[2]=startx[2]+strlen(menustring[2])*10;
3077 endy[2]=starty[2]+20;
3081 if(!tryquit)sprintf (menustring[3], "Back");
3082 else sprintf (menustring[3], "Quit");
3084 endx[3]=startx[3]+strlen(menustring[3])*10;
3086 endy[3]=starty[3]+20;
3090 sprintf (menustring[4], "Register now!");
3092 endx[4]=startx[4]+strlen(menustring[4])*10;
3094 endy[4]=starty[4]+20;
3098 sprintf (menustring[5], "Enter registration code!");
3100 endx[5]=startx[5]+strlen(menustring[5])*10;
3102 endy[5]=starty[5]+20;
3111 sprintf (menustring[0], "Thank you for supporting Wolfire Software!");
3114 endx[0]=startx[0]+strlen(menustring[0])*10;
3115 endy[0]=starty[0]+20;
3119 sprintf (menustring[1], "Back");
3121 endx[1]=startx[1]+strlen(menustring[1])*10;
3123 endy[1]=starty[1]+20;
3132 sprintf (menustring[0], "Sorry, that name/serial number combination is incorrect.");
3135 endx[0]=startx[0]+strlen(menustring[0])*10;
3136 endy[0]=starty[0]+20;
3140 sprintf (menustring[1], "Back");
3142 endx[1]=startx[1]+strlen(menustring[1])*10;
3144 endy[1]=starty[1]+20;
3148 sprintf (menustring[2], "Please make sure you are copying your name and serial");
3151 endx[2]=startx[2]+strlen(menustring[2])*10;
3152 endy[2]=starty[2]+20;
3156 sprintf (menustring[3], "number exactly as they appear in your email.");
3159 endx[3]=startx[3]+strlen(menustring[3])*10;
3160 endy[3]=starty[3]+20;
3164 sprintf (menustring[4], "Capitalization and punctuation matter!");
3167 endx[4]=startx[4]+strlen(menustring[4])*10;
3168 endy[4]=starty[4]+20;
3177 sprintf (menustring[0], "Please enter your name:");
3180 endx[0]=startx[0]+strlen(menustring[0])*10;
3181 endy[0]=starty[0]+20;
3185 sprintf (menustring[1], "Please enter your name:");
3188 endx[1]=startx[1]+strlen(menustring[1])*10;
3189 endy[1]=starty[1]+20;
3198 sprintf (menustring[0], "Please enter your number:");
3201 endx[0]=startx[0]+strlen(menustring[0])*10;
3202 endy[0]=starty[0]+20;
3206 sprintf (menustring[1], "Please enter your name:");
3209 endx[1]=startx[1]+strlen(menustring[1])*10;
3210 endy[1]=starty[1]+20;
3214 char tempstring[256];
3215 sprintf (tempstring, "%s", registrationname);
3221 longnum = MD5_string ( tempstring);
3222 //longnum = 1111111111111111;
3223 num1 = longnum/100000000;
3224 num2 = longnum%100000000;
3225 sprintf (tempstring, "%d-%d-%d-%d", num1/10000, num1%10000, num2/10000, num2%10000);
3227 sprintf (menustring[2], "%s", tempstring);
3230 endx[2]=startx[2]+strlen(menustring[2])*10;
3231 endy[2]=starty[2]+20;
3236 if(mainmenu==1||mainmenu==2){
3246 starty[1]=480-152-32;
3253 starty[2]=480-228-32;
3261 starty[3]=480-306-32;
3270 starty[3]=480-306-32;
3284 starty[4]=480-140-256;
3291 starty[5]=480-138-256;
3298 starty[6]=480-144-256;
3306 starty[4]=480-140-256;
3313 starty[5]=480-138-256;
3320 starty[6]=480-144-256;
3328 starty[4]=480-140-256;
3335 starty[5]=480-150-256;
3342 starty[6]=480-144-256;
3350 starty[4]=480-140-256;
3357 starty[5]=480-150-256;
3364 starty[6]=480-144-256;
3372 starty[4]=480-100-256;
3379 starty[5]=480-120-256;
3386 starty[6]=480-144-256;
3396 if(mainmenu==1||mainmenu==2)
3398 if((mousecoordh/screenwidth*640)>startx[i]&&(mousecoordh/screenwidth*640)<endx[i]&&480-(mousecoordv/screenheight*480)>starty[i]&&480-(mousecoordv/screenheight*480)<endy[i]){
3403 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)
3404 for(i=0;i<nummenuitems;i++){
3405 if((mousecoordh/screenwidth*640)>startx[i]&&(mousecoordh/screenwidth*640)<endx[i]&&480-(mousecoordv/screenheight*480)>starty[i]&&480-(mousecoordv/screenheight*480)<endy[i]){
3406 if(mainmenu!=5)selected=i;
3407 if(mainmenu==5&&(i!=0&&i!=6))selected=i;
3408 if(mainmenu==9&&(i!=numchallengelevels+1))selected=i;
3409 if(mainmenu==11&&(i!=numchallengelevels+1))selected=i;
3414 for(i=0;i<nummenuitems;i++){
3415 if(selected==i)selectedlong[i]+=multiplier*5;
3416 if(selectedlong[i]>1)selectedlong[i]=1;
3417 if(selected!=i)selectedlong[i]-=multiplier*5;
3418 if(selectedlong[i]<0)selectedlong[i]=0;
3419 //if(i>=4)selectedlong[i]=.3;
3420 if(i>=4&&(mainmenu==1||mainmenu==2))selectedlong[i]=0;
3424 for(i=0;i<nummenuitems;i++){
3425 offsetx[i]=(startx[i]+endx[i])/2-(mousecoordh/screenwidth*640);
3426 offsety[i]=(starty[i]+endy[i])/2-(480-(mousecoordv/screenheight*480));
3431 if(i>=4&&(mainmenu==1||mainmenu==2)){
3432 offsetx[i]=(startx[i]+endx[i]+movex[i]*transition)/2-(640+190)/2;
3433 offsety[i]=(starty[i]+endy[i]+movey[i]*transition)/2-(336+150)/2;
3439 if(mainmenu==1||mainmenu==2){
3440 glClear(GL_DEPTH_BUFFER_BIT);
3441 glEnable(GL_ALPHA_TEST);
3442 glAlphaFunc(GL_GREATER, 0.001f);
3443 glEnable(GL_TEXTURE_2D);
3444 glDisable(GL_DEPTH_TEST); // Disables Depth Testing
3445 glDisable(GL_CULL_FACE);
3446 glDisable(GL_LIGHTING);
3448 glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
3449 glPushMatrix(); // Store The Projection Matrix
3450 glLoadIdentity(); // Reset The Projection Matrix
3451 glOrtho(0,screenwidth,0,screenheight,-100,100); // Set Up An Ortho Screen
3452 glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
3453 glPushMatrix(); // Store The Modelview Matrix
3454 glLoadIdentity(); // Reset The Modelview Matrix
3455 glTranslatef(screenwidth/2,screenheight/2,0);
3457 glScalef((float)screenwidth/2,(float)screenheight/2,1);
3458 glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
3459 glDisable(GL_BLEND);
3460 glColor4f(0,0,0,1.0);
3461 glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP );
3462 glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP );
3463 glDisable(GL_TEXTURE_2D);
3465 //glScalef(.25,.25,.25);
3468 glVertex3f(-1, -1, 0.0f);
3470 glVertex3f(1, -1, 0.0f);
3472 glVertex3f(1, 1, 0.0f);
3474 glVertex3f(-1, 1, 0.0f);
3478 glColor4f(0.4,0.4,0.4,1.0);
3479 glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP );
3480 glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP );
3481 glEnable(GL_TEXTURE_2D);
3482 glBindTexture( GL_TEXTURE_2D, Mainmenuitems[4]);
3484 //glScalef(.25,.25,.25);
3487 glVertex3f(-1, -1, 0.0f);
3489 glVertex3f(1, -1, 0.0f);
3491 glVertex3f(1, 1, 0.0f);
3493 glVertex3f(-1, 1, 0.0f);
3498 glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
3501 glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
3502 glPushMatrix(); // Store The Projection Matrix
3503 glLoadIdentity(); // Reset The Projection Matrix
3504 glOrtho(0,640,0,480,-100,100); // Set Up An Ortho Screen
3505 glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
3506 glPushMatrix(); // Store The Modelview Matrix
3507 glLoadIdentity(); // Reset The Modelview Matrix
3509 glDisable(GL_TEXTURE_2D);
3514 if(anim!=1)glVertex3f(190, 150, 0.0f);
3515 if(anim==1)glVertex3f(190+movex[4]*transition, 150, 0.0f);
3517 glVertex3f(640, 150, 0.0f);
3519 glVertex3f(640, 336, 0.0f);
3521 if(anim!=1)glVertex3f(190, 336, 0.0f);
3522 if(anim==1)glVertex3f(190+movex[4]*transition, 336, 0.0f);
3527 glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
3529 glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
3533 glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
3534 glPushMatrix(); // Store The Projection Matrix
3535 glLoadIdentity(); // Reset The Projection Matrix
3536 glOrtho(0,640,0,480,-100,100); // Set Up An Ortho Screen
3537 glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
3538 glPushMatrix(); // Store The Modelview Matrix
3539 glLoadIdentity(); // Reset The Modelview Matrix
3540 glEnable(GL_TEXTURE_2D);
3543 for(j=0;j<nummenuitems;j++)
3545 if(j<=3||(mainmenu!=1&&mainmenu!=2))
3547 //glDisable(GL_BLEND);
3548 glEnable(GL_ALPHA_TEST);
3550 //glDisable(GL_ALPHA_TEST);
3551 glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
3552 if(mainmenu==1||mainmenu==2)
3555 glBlendFunc(GL_SRC_ALPHA,GL_ONE);
3556 glBindTexture( GL_TEXTURE_2D, Mainmenuitems[j]);
3557 glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE );
3558 glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE );
3559 glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
3563 glVertex3f(startx[j]+movex[j]*transition, starty[j]+movey[j]*transition, 0.0f);
3565 glVertex3f(endx[j]+movex[j]*transition, starty[j]+movey[j]*transition, 0.0f);
3567 glVertex3f(endx[j]+movex[j]*transition, endy[j]+movey[j]*transition, 0.0f);
3569 glVertex3f(startx[j]+movex[j]*transition, endy[j]+movey[j]*transition, 0.0f);
3573 //glDisable(GL_ALPHA_TEST);
3574 if(j<4)glBlendFunc(GL_SRC_ALPHA,GL_ONE);
3577 if(1-((float)i)/10-(1-selectedlong[j])>0)
3579 glColor4f(1,1,1,(1-((float)i)/10-(1-selectedlong[j]))*.25);
3580 glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
3584 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);
3586 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);
3588 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);
3590 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);
3596 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)
3598 if(mainmenu!=5||j<6)
3601 if(mainmenu==12&&j==4)glColor4f(1,(sin(menupulse)+1)/2,(sin(menupulse)+1)/2,1);
3602 if(mainmenu==9&&j>accountprogress[accountactive]&&j<numchallengelevels)glColor4f(0.5,0,0,1);
3603 if(mainmenu==11&&j>accountprogress[accountactive]&&j<numchallengelevels)glColor4f(0.5,0,0,1);
3604 //if(1-((float)i)/10-(1-selectedlong[j])>0){
3605 glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
3607 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);
3611 sprintf (string, "_");
3612 text.glPrint(startx[j]+(float)(displayselected)*10,starty[j],string,0,1,640,480);
3615 for(l=0;l<displaychars[k];l++){
3616 if(l<displaychars[k]){
3617 sprintf (string, "%c",displaytext[k][l]);
3618 text.glPrint(startx[j]+l*10,starty[j],string,0,1,640,480);
3626 sprintf (string, "Hooo!");
3627 text.glPrint(startx[0],starty[0],string,0,1,640,480);
3631 glBlendFunc(GL_SRC_ALPHA,GL_ONE);
3634 if(1-((float)i)/15-(1-selectedlong[j])>0)
3636 glColor4f(1,0,0,(1-((float)i)/10-(1-selectedlong[j]))*.25);
3637 if(mainmenu==12&&j==4)glColor4f(1,(sin(menupulse)+1)/2,(sin(menupulse)+1)/2,(1-((float)i)/10-(1-selectedlong[j]))*.25);
3638 if(mainmenu==9&&j>accountprogress[accountactive]&&j<numchallengelevels)glColor4f(0.5,0,0,(1-((float)i)/10-(1-selectedlong[j]))*.25);
3639 if(mainmenu==11&&j>accountprogress[accountactive]&&j<numchallengelevels)glColor4f(0.5,0,0,(1-((float)i)/10-(1-selectedlong[j]))*.25);
3640 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);
3641 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);
3642 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);
3643 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);
3644 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);
3645 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);
3646 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);
3647 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);
3648 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);
3649 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);
3650 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);
3651 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);
3652 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);
3653 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);
3654 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);
3657 sprintf (string, "_");
3658 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);
3661 for(l=0;l<displaychars[k];l++){
3662 if(l<displaychars[k]){
3663 sprintf (string, "%c",displaytext[k][l]);
3664 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);
3673 glClear(GL_DEPTH_BUFFER_BIT);
3674 glEnable(GL_ALPHA_TEST);
3675 glAlphaFunc(GL_GREATER, 0.001f);
3676 glEnable(GL_TEXTURE_2D);
3677 glDisable(GL_DEPTH_TEST); // Disables Depth Testing
3678 glDisable(GL_CULL_FACE);
3679 glDisable(GL_LIGHTING);
3680 if(j==6)glColor4f(1,1,1,1);
3681 else glColor4f(1,0,0,1);
3683 glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
3684 glPushMatrix(); // Store The Projection Matrix
3685 glLoadIdentity(); // Reset The Projection Matrix
3686 glOrtho(0,640,0,480,-100,100); // Set Up An Ortho Screen
3687 glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
3688 glPushMatrix(); // Store The Modelview Matrix
3689 glLoadIdentity(); // Reset The Modelview Matrix
3692 //Draw world, draw map
3693 glTranslatef(2,-5,0);
3695 if(j>6&&j<nummenuitems-1)
3697 XYZ linestart,lineend,offset;
3704 //float linestartx,lineendx,linestarty,lineendy,offsetx,offsety;
3705 linestart.x=(startx[j]+endx[j])/2;
3706 linestart.y=(starty[j]+endy[j])/2;
3707 if(j>=6+accountcampaignchoicesmade[accountactive]){
3708 linestart.x=(startx[6+accountcampaignchoicesmade[accountactive]]+endx[6+accountcampaignchoicesmade[accountactive]])/2;
3709 linestart.y=(starty[6+accountcampaignchoicesmade[accountactive]]+endy[6+accountcampaignchoicesmade[accountactive]])/2;
3711 lineend.x=(startx[j+1]+endx[j+1])/2;
3712 lineend.y=(starty[j+1]+endy[j+1])/2;
3713 offset=lineend-linestart;
3716 offset=DoRotation(offset,0,0,90);
3718 glDisable(GL_TEXTURE_2D);
3720 if(j<6+accountcampaignchoicesmade[accountactive]){
3721 glColor4f(0.5,0,0,1);
3725 if(j>=6+accountcampaignchoicesmade[accountactive]){
3731 linestart+=fac*4*startsize;
3732 lineend-=fac*4*endsize;
3734 if(!(j>7+accountcampaignchoicesmade[accountactive]+campaignchoicenum)){
3735 glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
3739 glVertex3f(linestart.x-offset.x*startsize, linestart.y-offset.y*startsize, 0.0f);
3741 glVertex3f(linestart.x+offset.x*startsize, linestart.y+offset.y*startsize, 0.0f);
3743 glVertex3f(lineend.x+offset.x*endsize, lineend.y+offset.y*endsize, 0.0f);
3745 glVertex3f(lineend.x-offset.x*endsize, lineend.y-offset.y*endsize, 0.0f);
3749 glEnable(GL_TEXTURE_2D);
3753 if(j==6)glBindTexture( GL_TEXTURE_2D, Mainmenuitems[7]);
3754 else glBindTexture( GL_TEXTURE_2D, Mapcircletexture);
3755 glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE );
3756 glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE );
3757 if(j-7<accountcampaignchoicesmade[accountactive])glColor4f(0.5,0,0,1);
3758 if(j-7>=accountcampaignchoicesmade[accountactive])glColor4f(1,0,0,1);
3759 if(j==6)glColor4f(1,1,1,1);
3762 itemsize=abs(startx[j]-endx[j])/2;
3764 midpoint.x=(startx[j]+endx[j])/2;
3765 midpoint.y=(starty[j]+endy[j])/2;
3766 if(j>6&&(j-7<accountcampaignchoicesmade[accountactive]))itemsize*=.5;
3767 if(!(j-7>accountcampaignchoicesmade[accountactive]+campaignchoicenum))
3769 glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
3773 glVertex3f(midpoint.x-itemsize+movex[j]*transition, midpoint.y-itemsize+movey[j]*transition, 0.0f);
3775 glVertex3f(midpoint.x+itemsize+movex[j]*transition, midpoint.y-itemsize+movey[j]*transition, 0.0f);
3777 glVertex3f(midpoint.x+itemsize+movex[j]*transition, midpoint.y+itemsize+movey[j]*transition, 0.0f);
3779 glVertex3f(midpoint.x-itemsize+movex[j]*transition, midpoint.y+itemsize+movey[j]*transition, 0.0f);
3783 //glDisable(GL_ALPHA_TEST);
3784 if(j<4)glBlendFunc(GL_SRC_ALPHA,GL_ONE);
3787 if(1-((float)i)/10-(1-selectedlong[j])>0)
3789 glColor4f(1,0,0,(1-((float)i)/10-(1-selectedlong[j]))*.25);
3790 glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
3794 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);
3796 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 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);
3800 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);
3808 glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
3810 glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
3812 if(j-7>=accountcampaignchoicesmade[accountactive]){
3813 //glColor4f(0,0,0,1);
3814 //text.glPrintOutline(startx[j]+10-1.5,starty[j]-4-1.5,menustring[j],0,0.6*1.25,640,480);
3815 //glColor4f(1,0,0,1);
3816 //text.glPrint(startx[j]+10,starty[j]-4,menustring[j],0,0.6,640,480);
3817 text.glPrintOutlined(0.9,0,0,startx[j]+10,starty[j]-4,menustring[j],0,0.6,640,480);
3818 glDisable(GL_DEPTH_TEST);
3825 glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
3827 glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
3830 if(mainmenu==1||mainmenu==2)
3831 if(transition<.1||transition>.9){
3832 glClear(GL_DEPTH_BUFFER_BIT);
3833 glEnable(GL_ALPHA_TEST);
3834 glAlphaFunc(GL_GREATER, 0.001f);
3835 glEnable(GL_TEXTURE_2D);
3836 glDisable(GL_DEPTH_TEST); // Disables Depth Testing
3837 glDisable(GL_CULL_FACE);
3838 glDisable(GL_LIGHTING);
3840 glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
3841 glPushMatrix(); // Store The Projection Matrix
3842 glLoadIdentity(); // Reset The Projection Matrix
3843 glOrtho(0,640,0,480,-100,100); // Set Up An Ortho Screen
3844 glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
3845 glPushMatrix(); // Store The Modelview Matrix
3846 glLoadIdentity(); // Reset The Modelview Matrix
3848 glDisable(GL_TEXTURE_2D);
3849 if(transition<.1)glColor4f(1,0,0,1-(transition*10));
3850 if(transition>.9)glColor4f(1,0,0,1-((1-transition)*10));
3854 glVertex3f(190, 150, 0.0f);
3856 glVertex3f(640, 150, 0.0f);
3858 glVertex3f(640, 336, 0.0f);
3860 glVertex3f(190, 336, 0.0f);
3865 glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
3869 glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
3870 glPushMatrix(); // Store The Projection Matrix
3871 glLoadIdentity(); // Reset The Projection Matrix
3872 glOrtho(0,screenwidth,0,screenheight,-100,100); // Set Up An Ortho Screen
3873 glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
3874 glPushMatrix(); // Store The Modelview Matrix
3875 glLoadIdentity(); // Reset The Modelview Matrix
3876 glTranslatef(screenwidth/2,screenheight/2,0);
3878 glScalef((float)screenwidth/2,(float)screenheight/2,1);
3879 glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
3881 glEnable(GL_TEXTURE_2D);
3883 glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP );
3884 glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP );
3887 glTranslatef(mousecoordh-screenwidth/2,mousecoordv*-1+screenheight/2,0);
3888 glScalef((float)screenwidth/64,(float)screenwidth/64,1);
3889 glTranslatef(1,-1,0);
3890 glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
3892 glBindTexture( GL_TEXTURE_2D, cursortexture);
3894 //glScalef(.25,.25,.25);
3897 glVertex3f(-1, -1, 0.0f);
3899 glVertex3f(1, -1, 0.0f);
3901 glVertex3f(1, 1, 0.0f);
3903 glVertex3f(-1, 1, 0.0f);
3908 glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
3914 if(flashamount>1)flashamount=1;
3915 if(flashdelay<=0)flashamount-=multiplier;
3917 if(flashamount<0)flashamount=0;
3918 glDisable(GL_DEPTH_TEST); // Disables Depth Testing
3919 glDisable(GL_CULL_FACE);
3920 glDisable(GL_LIGHTING);
3921 glDisable(GL_TEXTURE_2D);
3923 glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
3924 glPushMatrix(); // Store The Projection Matrix
3925 glLoadIdentity(); // Reset The Projection Matrix
3926 glOrtho(0,screenwidth,0,screenheight,-100,100); // Set Up An Ortho Screen
3927 glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
3928 glPushMatrix(); // Store The Modelview Matrix
3929 glLoadIdentity(); // Reset The Modelview Matrix
3930 glScalef(screenwidth,screenheight,1);
3931 glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
3933 glColor4f(flashr,flashg,flashb,flashamount);
3935 glVertex3f(0, 0, 0.0f);
3936 glVertex3f(256, 0, 0.0f);
3937 glVertex3f(256, 256, 0.0f);
3938 glVertex3f(0, 256, 0.0f);
3940 glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
3941 glPopMatrix(); // Restore The Old Projection Matrix
3942 glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
3943 glPopMatrix(); // Restore The Old Projection Matrix
3944 glEnable(GL_DEPTH_TEST); // Enables Depth Testing
3945 glEnable(GL_CULL_FACE);
3946 glDisable(GL_BLEND);
3951 if(freeze||winfreeze||(mainmenu&&gameon)||(!gameon&&gamestarted)||(!gameon&&gamestarted)){
3952 tempmult=multiplier;
3958 if(drawmode!=motionblurmode||mainmenu){
3960 if(drawmode!=motionblurmode) SwapBuffers( hDC);
3961 #elif PLATFORM_MACOSX
3962 if(drawmode!=motionblurmode)aglSwapBuffers(gaglContext); // send swap command
3964 if(drawmode!=motionblurmode)SDL_GL_SwapBuffers();
3966 #error define your platform.
3967 #endif // send swap command
3970 //myassert(glGetError() == GL_NO_ERROR);
3971 glDrawBuffer(GL_BACK);
3972 glReadBuffer(GL_BACK);
3977 if(drawtoggle==2)drawtoggle=0;
3979 if(freeze||winfreeze||(mainmenu&&gameon)||(!gameon&&gamestarted)){
3980 multiplier=tempmult;
3982 //Jordan fixed your warning!