2 Copyright (C) 2003, 2010 - Wolfire Games
4 This file is part of Lugaru.
6 Lugaru is free software; you can redistribute it and/or
7 modify it under the terms of the GNU General Public License
8 as published by the Free Software Foundation; either version 2
9 of the License, or (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
15 See the GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
23 #include "openal_wrapper.h"
28 extern int environment;
29 extern float texscale;
31 extern Terrain terrain;
32 extern Sprites sprites;
33 extern float multiplier;
35 extern float viewdistance;
36 extern float fadestart;
37 extern float screenwidth,screenheight;
38 extern int kTextureSize;
39 extern FRUSTUM frustum;
41 extern Objects objects;
43 extern float usermousesensitivity;
45 extern float camerashake;
46 extern Weapons weapons;
47 extern Person player[maxplayers];
49 extern float slomodelay;
50 extern bool ismotionblur;
52 extern float blackout;
53 extern bool damageeffects;
55 extern int numplayers;
56 extern bool texttoggle;
57 extern float blurness;
58 extern float targetblurness;
59 extern float playerdist;
60 extern bool cellophane;
62 extern float flashamount,flashr,flashg,flashb;
63 extern int flashdelay;
65 extern float motionbluramount;
67 extern bool alwaysblur;
69 extern bool tilt2weird;
70 extern bool tiltweird;
72 extern bool proportionweird;
73 extern bool vertexweird[6];
74 extern bool velocityblur;
75 extern bool buttons[3];
76 extern bool debugmode;
78 extern int oldmainmenu;
79 extern int bloodtoggle;
80 extern int difficulty;
83 //extern int texdetail;
84 extern float texdetail;
85 extern bool musictoggle;
87 extern float bonusvalue;
88 extern float bonustotal;
89 extern float bonustime;
91 extern float startbonustotal;
92 extern float bonusnum[100];
93 extern int tutoriallevel;
94 extern float smoketex;
95 extern float tutorialstagetime;
96 extern float tutorialmaxtime;
97 extern int tutorialstage;
98 extern bool againbonus;
99 extern float damagedealt;
100 extern float damagetaken;
101 extern bool invertmouse;
103 extern int numhotspots;
104 extern int winhotspot;
105 extern int killhotspot;
106 extern XYZ hotspot[40];
107 extern int hotspottype[40];
108 extern float hotspotsize[40];
109 extern char hotspottext[40][256];
110 extern int currenthotspot;
112 extern int numaccounts;
113 extern int accountactive;
114 extern int accountdifficulty[10];
115 extern int accountprogress[10];
116 extern float accountpoints[10];
117 extern float accounthighscore[10][50];
118 extern float accountfasttime[10][50];
119 extern bool accountunlocked[10][60];
120 extern char accountname[10][256];
123 extern int numflipfail;
125 extern int numstaffattack;
126 extern int numswordattack;
127 extern int numknifeattack;
128 extern int numunarmedattack;
129 extern int numescaped;
130 extern int numflipped;
131 extern int numwallflipped;
132 extern int numthrowkill;
133 extern int numafterkill;
134 extern int numreversals;
135 extern int numattacks;
136 extern int maxalarmed;
137 extern int numresponded;
139 extern bool campaign;
140 extern bool winfreeze;
142 extern float menupulse;
144 extern bool gamestart;
146 extern int numdialogues;
147 extern int numdialogueboxes[max_dialogues];
148 extern int dialoguetype[max_dialogues];
149 extern int dialogueboxlocation[max_dialogues][max_dialoguelength];
150 extern float dialogueboxcolor[max_dialogues][max_dialoguelength][3];
151 extern int dialogueboxsound[max_dialogues][max_dialoguelength];
152 extern char dialoguetext[max_dialogues][max_dialoguelength][128];
153 extern char dialoguename[max_dialogues][max_dialoguelength][64];
154 extern XYZ dialoguecamera[max_dialogues][max_dialoguelength];
155 extern XYZ participantlocation[max_dialogues][10];
156 extern int participantfocus[max_dialogues][max_dialoguelength];
157 extern int participantaction[max_dialogues][max_dialoguelength];
158 extern float participantrotation[max_dialogues][10];
159 extern XYZ participantfacing[max_dialogues][max_dialoguelength][10];
160 extern float dialoguecamerarotation[max_dialogues][max_dialoguelength];
161 extern float dialoguecamerarotation2[max_dialogues][max_dialoguelength];
162 extern int indialogue;
163 extern int whichdialogue;
164 extern int directing;
165 extern float dialoguetime;
166 extern int dialoguegonethrough[20];
168 extern int accountcampaignchoicesmade[10];
169 extern int accountcampaignchoices[10][5000];
171 extern float accountcampaignhighscore[10];
172 extern float accountcampaignfasttime[10];
173 extern float accountcampaignscore[10];
174 extern float accountcampaigntime[10];
176 extern bool gamestarted;
178 extern OPENAL_SAMPLE *samp[100];
179 extern int channels[100];
180 extern "C" void PlaySoundEx(int channel, OPENAL_SAMPLE *sptr, OPENAL_DSPUNIT *dsp, signed char startpaused);
182 /*********************> DrawGLScene() <*****/
183 long long Game::MD5_string (char *string){
188 sprintf (temp, "%s",string);
191 while (i<256&&temp[i]!='\0'){
192 if(temp[i]%3==0)num+=temp[i]*124;
193 else if(temp[i]%3==1)num-=temp[i]*temp[i];
198 num=longlongabs(num);
201 while(num<LONGLONGCONST(5000000000000000)){
205 while(num>LONGLONGCONST(9900000000000000)){
211 //return 1111111111111111;
214 int Game::DrawGLScene(StereoSide side)
216 static float texcoordwidth,texcoordheight;
217 static float texviewwidth, texviewheight;
219 static GLubyte color;
220 static float newbrightness;
221 static float changespeed;
222 static XYZ checkpoint;
223 static float tempmult;
225 static char string[256]="";
226 static char string2[256]="";
227 static char string3[256]="";
229 static float lastcheck;
231 lastcheck+=multiplier;
233 if ( stereomode == stereoAnaglyph ) {
235 case stereoLeft: glColorMask( 1.0, 0.0, 0.0, 1.0 ); break;
236 case stereoRight: glColorMask( 0.0, 1.0, 1.0, 1.0 ); break;
239 glColorMask( 1.0, 1.0, 1.0, 1.0 );
241 if ( stereomode == stereoHorizontalInterlaced || stereomode == stereoVerticalInterlaced ) {
242 if (!stereoreverse) {
243 glStencilFunc(side == stereoLeft ? GL_NOTEQUAL : GL_EQUAL, 0x01, 0x01);
245 glStencilFunc(side == stereoLeft ? GL_EQUAL : GL_NOTEQUAL, 0x01, 0x01);
250 if(freeze||winfreeze||(mainmenu&&gameon)||(!gameon&&gamestarted)){
257 numboundaries=mapradius*2;
258 if(numboundaries>360)numboundaries=360;
259 for(i=0;i<numboundaries;i++){
262 boundary[i]=mapcenter+DoRotation(boundary[i]*mapradius,0,i*(360/((float)(numboundaries))),0);
271 olddrawmode=drawmode;
272 if(ismotionblur&&!loading){
273 if((findLengthfast(&player[0].velocity)>200)&&velocityblur&&!cameramode){
274 drawmode=motionblurmode;
275 motionbluramount=200/(findLengthfast(&player[0].velocity));
278 if(player[0].damage-player[0].superpermanentdamage>(player[0].damagetolerance-player[0].superpermanentdamage)*1/2&&damageeffects&&!cameramode){
279 drawmode=doublevisionmode;
286 drawmode=motionblurmode;
288 slomodelay-=multiplier;
289 if(slomodelay<0)slomo=0;
293 if((!changed&&!slomo)||loading){
295 if(ismotionblur&&(/*fps>100||*/alwaysblur)){
296 if(olddrawmode!=realmotionblurmode)change=1;
298 drawmode=realmotionblurmode;
300 else if(olddrawmode==realmotionblurmode)change=2;
304 if(freeze||winfreeze||(mainmenu&&gameon)||(!gameon&&gamestarted))drawmode=normalmode;
305 if((freeze||winfreeze)&&ismotionblur&&!mainmenu)drawmode=radialzoommode;
307 if(winfreeze||mainmenu)drawmode=normalmode;
310 if(drawmode==glowmode){
316 DSpContext_FadeGamma(NULL,200,&color2);
320 if(drawtoggle!=2)drawtoggle=1-drawtoggle;
324 texviewwidth=kTextureSize;
325 if(texviewwidth>screenwidth)texviewwidth=screenwidth;
326 texviewheight=kTextureSize;
327 if(texviewheight>screenheight)texviewheight=screenheight;
329 texcoordwidth=screenwidth/kTextureSize;
330 texcoordheight=screenheight/kTextureSize;
331 if(texcoordwidth>1)texcoordwidth=1;
332 if(texcoordheight>1)texcoordheight=1;
335 glDrawBuffer(GL_BACK);
336 glReadBuffer(GL_BACK);
338 /*if(environment==desertenvironment)glTexEnvf( GL_TEXTURE_FILTER_CONTROL_EXT, GL_TEXTURE_LOD_BIAS_EXT, (float)(abs(Random()%100))/50 );
339 else glTexEnvf( GL_TEXTURE_FILTER_CONTROL_EXT, GL_TEXTURE_LOD_BIAS_EXT, 0);
341 if(abs(blurness-targetblurness)<multiplier*10||abs(blurness-targetblurness)>2){
342 blurness=targetblurness;
343 targetblurness=(float)(abs(Random()%100))/40;
345 if(blurness<targetblurness)blurness+=multiplier*5;
346 if(blurness>targetblurness)blurness-=multiplier*5;
349 static XYZ terrainlight;
350 static float distance;
351 //if(drawmode==normalmode)ReSizeGLScene(90,.1);
352 if(drawmode==normalmode)ReSizeGLScene(90,.1f);
353 if(drawmode!=normalmode)glViewport(0,0,texviewwidth,texviewheight);
354 glDepthFunc(GL_LEQUAL);
356 glAlphaFunc(GL_GREATER, 0.0001f);
357 glEnable(GL_ALPHA_TEST);
358 glClearColor(0.25f, 0.25f, 0.25f, 1.0f);
359 glClear(GL_DEPTH_BUFFER_BIT);
361 glMatrixMode (GL_MODELVIEW);
362 glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
365 glTranslatef((stereoseparation/2) * side, 0, 0);
367 if(!cameramode&&!freeze&&!winfreeze){
368 glRotatef(float(Random()%100)/10*camerashake/*+(woozy*woozy)/10*/,0,0,1);
369 glRotatef(rotation2+sin(woozy/2)*(player[0].damage/player[0].damagetolerance)*5,1,0,0);
370 glRotatef(rotation+sin(woozy)*(player[0].damage/player[0].damagetolerance)*5,0,1,0);
372 if(cameramode||freeze||winfreeze){
373 //glRotatef(float(Random()%100)/10*camerashake/*+(woozy*woozy)/10*/,0,0,1);
374 glRotatef(rotation2,1,0,0);
375 glRotatef(rotation,0,1,0);
378 if(environment==desertenvironment){
379 glRotatef((float)(abs(Random()%100))/3000-1,1,0,0);
380 glRotatef((float)(abs(Random()%100))/3000-1,0,1,0);
381 //glRotatef(blurness/40-1,1,0,0);
382 //glRotatef(blurness/40-1,0,1,0);
384 SetUpLight(&light,0);
386 if(environment==desertenvironment&&detail==2)glTexEnvf( GL_TEXTURE_FILTER_CONTROL_EXT, GL_TEXTURE_LOD_BIAS_EXT, blurness+.4 );
387 if(environment==desertenvironment){
388 glRotatef((float)(abs(Random()%100))/1000,1,0,0);
389 glRotatef((float)(abs(Random()%100))/1000,0,1,0);
392 glTexEnvf( GL_TEXTURE_FILTER_CONTROL_EXT, GL_TEXTURE_LOD_BIAS_EXT, 0);
394 glTranslatef(-viewer.x,-viewer.y,-viewer.z);
395 frustum.GetFrustum();
399 static float size,opacity,rotation;
401 for(k=0;k<numplayers;k++){
402 if(!player[k].skeleton.free&&player[k].playerdetail&&player[k].howactive<typesleeping)
403 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)
404 for(i=0;i<player[k].skeleton.num_joints;i++){
405 if(player[k].skeleton.joints[i].label==leftknee||player[k].skeleton.joints[i].label==rightknee||player[k].skeleton.joints[i].label==groin){
406 point=DoRotation(player[k].skeleton.joints[i].position,0,player[k].rotation,0)*player[k].scale+player[k].coords;
408 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;
409 if(k!=0&&tutoriallevel==1){
410 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;
412 terrain.MakeDecal(shadowdecal,point,size,opacity,rotation);
413 if(terrain.patchobjectnum[player[k].whichpatchx][player[k].whichpatchz])
414 for(l=0;l<terrain.patchobjectnum[player[k].whichpatchx][player[k].whichpatchz];l++){
415 j=terrain.patchobjects[player[k].whichpatchx][player[k].whichpatchz][l];
416 if(objects.position[j].y<player[k].coords.y||objects.type[j]==tunneltype||objects.type[j]==weirdtype){
417 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);
420 if(k!=0&&tutoriallevel==1){
421 opacity=.2+.2*sin(smoketex*6+i);
423 objects.model[j].MakeDecal(shadowdecal,&point,&size,&opacity,&rotation);
428 if((player[k].skeleton.free||player[k].howactive>=typesleeping)&&player[k].playerdetail)
429 if(frustum.SphereInFrustum(player[k].coords.x,player[k].coords.y,player[k].coords.z,player[k].scale*5)&&player[k].occluded<25)
430 for(i=0;i<player[k].skeleton.num_joints;i++){
431 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){
432 if(player[k].skeleton.free)point=player[k].skeleton.joints[i].position*player[k].scale+player[k].coords;
433 else point=DoRotation(player[k].skeleton.joints[i].position,0,player[k].rotation,0)*player[k].scale+player[k].coords;
435 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;
436 if(k!=0&&tutoriallevel==1){
437 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;
439 terrain.MakeDecal(shadowdecal,point,size,opacity*.7,rotation);
440 if(terrain.patchobjectnum[player[k].whichpatchx][player[k].whichpatchz])
441 for(l=0;l<terrain.patchobjectnum[player[k].whichpatchx][player[k].whichpatchz];l++){
442 j=terrain.patchobjects[player[k].whichpatchx][player[k].whichpatchz][l];
443 if(objects.position[j].y<player[k].coords.y||objects.type[j]==tunneltype||objects.type[j]==weirdtype){
444 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);
445 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);
448 if(k!=0&&tutoriallevel==1){
449 opacity=.2+.2*sin(smoketex*6+i);
451 objects.model[j].MakeDecal(shadowdecal,&point,&size,&opacity,&rotation);
457 if(!player[k].playerdetail)
458 if(frustum.SphereInFrustum(player[k].coords.x,player[k].coords.y,player[k].coords.z,player[k].scale*5))
460 point=player[k].coords;
462 opacity=.4-(player[k].coords.y-terrain.getHeight(player[k].coords.x,player[k].coords.z))/5;
463 terrain.MakeDecal(shadowdecal,point,size,opacity*.7,rotation);
464 if(terrain.patchobjectnum[player[k].whichpatchx][player[k].whichpatchz])
465 for(l=0;l<terrain.patchobjectnum[player[k].whichpatchx][player[k].whichpatchz];l++){
466 j=terrain.patchobjects[player[k].whichpatchx][player[k].whichpatchz][l];
467 point=DoRotation(player[k].coords-objects.position[j],0,-objects.rotation[j],0);
470 objects.model[j].MakeDecal(shadowdecal,&point,&size,&opacity,&rotation);
476 glEnable(GL_TEXTURE_2D);
478 glEnable(GL_DEPTH_TEST);
479 glEnable(GL_CULL_FACE);
481 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
482 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
483 glBindTexture( GL_TEXTURE_2D, terraintexture);
485 glBindTexture( GL_TEXTURE_2D, terraintexture2);
487 //glBindTexture( GL_TEXTURE_2D, terraintexture3);
488 //glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
491 terrain.drawdecals();
494 glEnable(GL_CULL_FACE);
495 glEnable(GL_LIGHTING);
497 glEnable(GL_TEXTURE_2D);
500 glEnable(GL_COLOR_MATERIAL);
515 glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
516 glEnable(GL_CULL_FACE);
517 glCullFace(GL_FRONT);
519 for(k=0;k<numplayers;k++){
520 if(k==0||tutoriallevel!=1){
522 glEnable(GL_LIGHTING);
523 terrainlight=terrain.getLighting(player[k].coords.x,player[k].coords.z);
524 distance=findDistancefast(&viewer,&player[k].coords);
525 distance=(viewdistance*viewdistance-(distance-(viewdistance*viewdistance*fadestart))*(1/(1-fadestart)))/viewdistance/viewdistance;
526 glColor4f(terrainlight.x,terrainlight.y,terrainlight.z,distance);
527 if(distance>=1)glDisable(GL_BLEND);
529 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;
531 if(!player[k].occluded==0)i=checkcollide(viewer,checkpoint,player[k].lastoccluded);
532 if(i==-1||player[k].occluded==0)i=checkcollide(viewer,checkpoint);
534 player[k].occluded+=1;
535 player[k].lastoccluded=i;
537 else player[k].occluded=0;
538 if(player[k].occluded<25)player[k].DrawSkeleton();
544 if(!cameramode&&musictype==stream_music2)playerdist=findDistancefastflat(&player[0].coords,&viewer);
545 else playerdist=-100;
548 glEnable(GL_TEXTURE_2D);
553 if(frustum.SphereInFrustum(realhawkcoords.x+hawk.boundingspherecenter.x,realhawkcoords.y+hawk.boundingspherecenter.y,realhawkcoords.z+hawk.boundingspherecenter.z,2)){
554 glAlphaFunc(GL_GREATER, 0.0001f);
556 glDisable(GL_CULL_FACE);
557 glDisable(GL_LIGHTING);
559 glTranslatef(hawkcoords.x,hawkcoords.y,hawkcoords.z);
560 glRotatef(hawkrotation,0,1,0);
561 glTranslatef(25,0,0);
562 distance=findDistancefast(&viewer,&realhawkcoords)*1.2;
563 glColor4f(light.color[0],light.color[1],light.color[2],(viewdistance*viewdistance-(distance-(viewdistance*viewdistance*fadestart))*(1/(1-fadestart)))/viewdistance/viewdistance);
564 if((viewdistance*viewdistance-(distance-(viewdistance*viewdistance*fadestart))*(1/(1-fadestart)))/viewdistance/viewdistance>1)glColor4f(light.color[0],light.color[1],light.color[2],1);
565 if((viewdistance*viewdistance-(distance-(viewdistance*viewdistance*fadestart))*(1/(1-fadestart)))/viewdistance/viewdistance>0)
566 hawk.drawdifftex(hawktexture);
571 /*glEnable(GL_CULL_FACE);
572 glCullFace(GL_FRONT);
574 for(k=0;k<numplayers;k++){
576 glEnable(GL_LIGHTING);
577 terrainlight=terrain.getLighting(player[k].coords.x,player[k].coords.z);
578 distance=findDistancefast(&viewer,&player[k].coords);
579 distance=(viewdistance*viewdistance-(distance-(viewdistance*viewdistance*fadestart))*(1/(1-fadestart)))/viewdistance/viewdistance;
580 glColor4f(terrainlight.x,terrainlight.y,terrainlight.z,distance);
581 if(distance>=1)glDisable(GL_BLEND);
583 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;
585 if(checkcollide(viewer,checkpoint)){
586 player[k].occluded+=1;
588 else player[k].occluded=0;
589 if(player[k].occluded<25)player[k].DrawSkeleton();
593 glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
594 glEnable(GL_CULL_FACE);
595 glCullFace(GL_FRONT);
597 for(k=0;k<numplayers;k++){
598 if(!(k==0||tutoriallevel!=1)){
600 glEnable(GL_LIGHTING);
601 terrainlight=terrain.getLighting(player[k].coords.x,player[k].coords.z);
602 distance=findDistancefast(&viewer,&player[k].coords);
603 distance=(viewdistance*viewdistance-(distance-(viewdistance*viewdistance*fadestart))*(1/(1-fadestart)))/viewdistance/viewdistance;
604 glColor4f(terrainlight.x,terrainlight.y,terrainlight.z,distance);
605 if(distance>=1)glDisable(GL_BLEND);
607 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;
609 if(!player[k].occluded==0)i=checkcollide(viewer,checkpoint,player[k].lastoccluded);
610 if(i==-1||player[k].occluded==0)i=checkcollide(viewer,checkpoint);
612 player[k].occluded+=1;
613 player[k].lastoccluded=i;
615 else player[k].occluded=0;
616 if(player[k].occluded<25)player[k].DrawSkeleton();
623 glEnable(GL_TEXTURE_2D);
628 glDisable(GL_COLOR_MATERIAL);
630 glDisable(GL_LIGHTING);
631 glDisable(GL_TEXTURE_2D);
639 glDisable(GL_LIGHTING);
640 glDisable(GL_TEXTURE_2D);
641 glDisable(GL_COLOR_MATERIAL);
644 for(k=0;k<numplayers;k++){
645 if(player[k].numwaypoints>1){
646 glBegin(GL_LINE_LOOP);
647 for(i=0;i<player[k].numwaypoints;i++){
648 glVertex3f(player[k].waypoints[i].x,player[k].waypoints[i].y+.5,player[k].waypoints[i].z);
657 for(k=0;k<numpathpoints;k++){
658 if(numpathpointconnect[k]){
659 for(i=0;i<numpathpointconnect[k];i++){
660 glBegin(GL_LINE_LOOP);
661 glVertex3f(pathpoint[k].x,pathpoint[k].y+.5,pathpoint[k].z);
662 glVertex3f(pathpoint[pathpointconnect[k][i]].x,pathpoint[pathpointconnect[k][i]].y+.5,pathpoint[pathpointconnect[k][i]].z);
670 glVertex3f(pathpoint[pathpointselected].x,pathpoint[pathpointselected].y+.5,pathpoint[pathpointselected].z);
677 glEnable(GL_TEXTURE_2D);
678 glColor4f(.5,.5,.5,1);
680 sprintf (string, " ",(int)(fps));
681 text.glPrint(10,30,string,0,.8,screenwidth,screenheight);
684 if(bonus>0&&bonustime<1&&!winfreeze&&indialogue==-1/*bonustime<4*/){
685 if(bonus==tracheotomy)sprintf (string, "Tracheotomy!");
686 else if(bonus==backstab)sprintf (string, "Backstabber!");
687 else if(bonus==spinecrusher)sprintf (string, "Spinecrusher!");
688 else if(bonus==ninja)sprintf (string, "Ninja Bonus!");
689 else if(bonus==style)sprintf (string, "Style Bonus!");
690 else if(bonus==cannon)sprintf (string, "Leg Cannon!");
691 else if(bonus==aimbonus)sprintf (string, "Nice Aim!");
692 else if(bonus==deepimpact)sprintf (string, "Heavy Impact!");
693 else if(bonus==touchofdeath)sprintf (string, "Touch of Death!");
694 else if(bonus==swordreversebonus)sprintf (string, "Sword Disarm!");
695 else if(bonus==staffreversebonus)sprintf (string, "Staff Disarm!");
696 else if(bonus==reverseko)sprintf (string, "Reversal KO!");
697 else if(bonus==solidhit)sprintf (string, "Solid Hit!");
698 else if(bonus==twoxcombo)sprintf (string, "2X Combo!");
699 else if(bonus==threexcombo)sprintf (string, "3X Combo!");
700 else if(bonus==fourxcombo)sprintf (string, "4X COMBO!");
701 else if(bonus==megacombo)sprintf (string, "MEGA COMBO!");
702 else if(bonus==Reversal)sprintf (string, "Reversal!");
703 else if(bonus==Stabbonus)sprintf (string, "Punctured!");
704 else if(bonus==Slicebonus)sprintf (string, "Sliced!");
705 else if(bonus==Bullseyebonus)sprintf (string, "Bullseye!");
706 else if(bonus==Slashbonus)sprintf (string, "Slashed!");
707 else if(bonus==Wolfbonus)sprintf (string, "WOLF SLAYER!");
708 else if(bonus==FinishedBonus)sprintf (string, "SLAIN!");
709 else if(bonus==TackleBonus)sprintf (string, "Tackle!");
710 else if(bonus==AboveBonus)sprintf (string, "Death from Above!");
711 else sprintf (string, "Excellent!");
713 glColor4f(0,0,0,1-bonustime);
714 text.glPrintOutline(1024/2-10*strlen(string)-4,768/16-4+768*4/5,string,1,2.5,1024,768);
715 glColor4f(1,0,0,1-bonustime);
716 text.glPrint(1024/2-10*strlen(string),768/16+768*4/5,string,1,2,1024,768);
718 sprintf (string, "%d",(int)bonusvalue);
719 glColor4f(0,0,0,1-bonustime);
720 text.glPrintOutline(1024/2-10*strlen(string)-4,768/16-4-20+768*4/5,string,1,2.5*.8,1024,768);
721 glColor4f(1,0,0,1-bonustime);
722 text.glPrint(1024/2-10*strlen(string),768/16-20+768*4/5,string,1,2*.8,1024,768);
723 glColor4f(.5,.5,.5,1);
726 if(tutoriallevel==1){
727 tutorialopac=tutorialmaxtime-tutorialstagetime;
728 if(tutorialopac>1)tutorialopac=1;
729 if(tutorialopac<0)tutorialopac=0;
731 sprintf (string, " ");
732 sprintf (string2, " ");
733 sprintf (string3, " ");
734 if(tutorialstage==0){
735 sprintf (string, " ");
736 sprintf (string2, " ");
737 sprintf (string3, " ");
739 if(tutorialstage==1){
740 sprintf (string, "Welcome to the Lugaru training level!");
741 sprintf (string2, " ");
742 sprintf (string3, " ");
744 if(tutorialstage==2){
745 sprintf (string, "BASIC MOVEMENT:");
746 sprintf (string2, " ");
747 sprintf (string3, " ");
749 if(tutorialstage==3){
750 sprintf (string, "You can move the mouse to rotate the camera.");
751 sprintf (string2, " ");
752 sprintf (string3, " ");
754 if(tutorialstage==4){
755 sprintf (string, "Try using the %s, %s, %s and %s keys to move around.",KeyToChar(forwardkey),KeyToChar(leftkey),KeyToChar(backkey),KeyToChar(rightkey));
756 sprintf (string2, "All movement is relative to the camera.");
757 sprintf (string3, " ");
759 if(tutorialstage==5){
760 sprintf (string, "Please press %s to jump.",KeyToChar(jumpkey));
761 sprintf (string2, "You can hold it longer to jump higher.");
762 sprintf (string3, " ");
764 if(tutorialstage==6){
765 sprintf (string, "You can press %s to crouch.",KeyToChar(crouchkey));
766 sprintf (string2, "You can jump higher from a crouching position.");
767 sprintf (string3, " ");
769 if(tutorialstage==7){
770 sprintf (string, "While running, you can press %s to roll.",KeyToChar(crouchkey));
771 sprintf (string2, " ");
772 sprintf (string3, " ");
774 if(tutorialstage==8){
775 sprintf (string, "While crouching, you can sneak around silently");
776 sprintf (string2, "using the movement keys.");
777 sprintf (string3, " ");
779 if(tutorialstage==9){
780 sprintf (string, "Release the crouch key while sneaking and hold the movement keys");
781 sprintf (string2, "to run animal-style.");
782 sprintf (string3, " ");
784 if(tutorialstage==10){
785 sprintf (string, "ADVANCED MOVEMENT:");
786 sprintf (string2, " ");
787 sprintf (string3, " ");
789 if(tutorialstage==11){
790 sprintf (string, "When you jump at a wall, you can hold %s again",KeyToChar(jumpkey));
791 sprintf (string2, "during impact to perform a walljump.");
792 sprintf (string3, "Be sure to use the movement keys to press against the wall");
794 if(tutorialstage==12){
795 sprintf (string, "While in the air, you can press crouch to flip.",KeyToChar(jumpkey));
796 sprintf (string2, "Walljumps and flips confuse enemies and give you more control.");
797 sprintf (string3, " ");
799 if(tutorialstage==13){
800 sprintf (string, "BASIC COMBAT:");
801 sprintf (string2, " ");
802 sprintf (string3, " ");
804 if(tutorialstage==14){
805 sprintf (string, "There is now an imaginary enemy");
806 sprintf (string2, "in the middle of the training area.");
807 sprintf (string3, " ");
809 if(tutorialstage==15){
810 if(attackkey==MAC_MOUSEBUTTON1)sprintf (string, "Click to attack when you are near an enemy.");
811 else sprintf (string, "Press %s to attack when you are near an enemy.",KeyToChar(attackkey));
812 sprintf (string2, "You can punch by standing still near an enemy and attacking.");
813 sprintf (string3, " ");
815 if(tutorialstage==16){
816 sprintf (string, "If you are close, you will perform a weak punch.");
817 sprintf (string2, "The weak punch is excellent for starting attack combinations.");
818 sprintf (string3, " ");
820 if(tutorialstage==17){
821 sprintf (string, "Attacking while running results in a spin kick.");
822 sprintf (string2, "This is one of your most powerful ground attacks.");
823 sprintf (string3, " ");
825 if(tutorialstage==18){
826 sprintf (string, "Sweep the enemy's legs out by attacking while crouched.");
827 sprintf (string2, "This is a very fast attack, and easy to follow up.");
828 sprintf (string3, " ");
830 if(tutorialstage==19){
831 sprintf (string, "When an enemy is on the ground, you can deal some extra");
832 sprintf (string2, "damage by running up and drop-kicking him.");
833 sprintf (string3, "(Try knocking them down with a sweep first)");
835 if(tutorialstage==20){
836 sprintf (string, "Your most powerful individual attack is the rabbit kick.");
837 if(attackkey==MAC_MOUSEBUTTON1)sprintf (string2, "Run at the enemy while holding the mouse button, and press");
838 else sprintf (string2, "Run at the enemy while holding %s, and press", KeyToChar(attackkey));
839 sprintf (string3, "the jump key (%s) to attack.",KeyToChar(jumpkey));
841 if(tutorialstage==21){
842 sprintf (string, "This attack is devastating if timed correctly.");
843 sprintf (string2, "Even if timed incorrectly, it will knock the enemy over.");
844 if(againbonus)sprintf (string3, "Try rabbit-kicking the imaginary enemy again.");
845 else sprintf (string3, "Try rabbit-kicking the imaginary enemy.");
847 if(tutorialstage==22){
848 sprintf (string, "If you sneak behind an enemy unnoticed, you can kill");
849 sprintf (string2, "him instantly. Move close behind this enemy");
850 sprintf (string3, "and attack.");
852 if(tutorialstage==23){
853 sprintf (string, "Another important attack is the wall kick. When an enemy");
854 sprintf (string2, "is near a wall, perform a walljump nearby and hold");
855 sprintf (string3, "the attack key during impact with the wall.");
857 if(tutorialstage==24){
858 sprintf (string, "You can tackle enemies by running at them animal-style");
859 if(attackkey==MAC_MOUSEBUTTON1)sprintf (string2, "and pressing jump (%s) or attack(mouse button).",KeyToChar(jumpkey));
860 else sprintf (string2, "and pressing jump (%s) or attack(%s).",KeyToChar(jumpkey),KeyToChar(attackkey));
861 sprintf (string3, "This is especially useful when they are running away.");
863 if(tutorialstage==25){
864 sprintf (string, "Dodge by pressing back and attack. Dodging is essential");
865 sprintf (string2, "against enemies with swords or other long weapons.");
866 sprintf (string3, " ");
868 if(tutorialstage==26){
869 sprintf (string, "REVERSALS AND COUNTER-REVERSALS");
870 sprintf (string2, " ");
871 sprintf (string3, " ");
873 if(tutorialstage==27){
874 sprintf (string, "The enemy can now reverse your attacks.");
875 sprintf (string2, " ");
876 sprintf (string3, " ");
878 if(tutorialstage==28){
879 sprintf (string, "If you attack, you will notice that the enemy now sometimes");
880 sprintf (string2, "catches your attack and uses it against you. Hold");
881 sprintf (string3, "crouch (%s) after attacking to escape from reversals.",KeyToChar(crouchkey));
883 if(tutorialstage==29){
884 sprintf (string, "Try escaping from two more reversals in a row.");
885 sprintf (string2, " ");
886 sprintf (string3, " ");
888 if(tutorialstage==30){
889 sprintf (string, "Good!");
890 sprintf (string2, " ");
891 sprintf (string3, " ");
893 if(tutorialstage==31){
894 sprintf (string, "To reverse an attack, you must tap crouch (%s) during the",KeyToChar(crouchkey));
895 sprintf (string2, "enemy's attack. You must also be close to the enemy;");
896 sprintf (string3, "this is especially important against armed opponents.");
898 if(tutorialstage==32){
899 sprintf (string, "The enemy can attack in %d seconds.", (int)(tutorialmaxtime-tutorialstagetime));
900 sprintf (string2, "This imaginary opponents attacks will be highlighted");
901 sprintf (string3, "to make this easier.");
903 if(tutorialstage==33){
904 sprintf (string, "Reverse three enemy attacks!");
905 sprintf (string2, " ");
906 sprintf (string3, " ");
908 if(tutorialstage==34){
909 sprintf (string, "Reverse two more enemy attacks!");
910 sprintf (string2, " ");
911 sprintf (string3, " ");
913 if(tutorialstage==35){
914 sprintf (string, "Reverse one more enemy attack!");
915 sprintf (string2, " ");
916 sprintf (string3, " ");
918 if(tutorialstage==36){
919 sprintf (string, "Excellent!");
920 sprintf (string2, " ");
921 sprintf (string3, " ");
923 if(tutorialstage==37){
924 sprintf (string, "Now spar with the enemy for %d more seconds.", (int)(tutorialmaxtime-tutorialstagetime));
925 sprintf (string2, "Damage dealt: %d",(int)damagedealt);
926 sprintf (string3, "Damage taken: %d.",(int)damagetaken);
928 if(tutorialstage==38){
929 sprintf (string, "WEAPONS:");
930 sprintf (string2, " ");
931 sprintf (string3, " ");
933 if(tutorialstage==39){
934 sprintf (string, "There is now an imaginary knife");
935 sprintf (string2, "in the center of the training area.");
936 sprintf (string3, " ");
938 if(tutorialstage==40){
939 sprintf (string, "Stand, roll or handspring over the knife");
940 sprintf (string2, "while pressing %s to pick it up.",KeyToChar(throwkey));
941 sprintf (string3, "You can crouch and press the same key to drop it again.");
943 if(tutorialstage==41){
944 sprintf (string, "You can equip and unequip weapons using the %s key.",KeyToChar(drawkey));
945 sprintf (string2, "Sometimes it is best to keep them unequipped to");
946 sprintf (string3, "prevent enemies from taking them. ");
948 if(tutorialstage==42){
949 sprintf (string, "The knife is the smallest weapon and the least encumbering.");
950 sprintf (string2, "You can equip or unequip it while standing, crouching,");
951 sprintf (string3, "running or flipping.");
953 if(tutorialstage==43){
954 sprintf (string, "You perform weapon attacks the same way as unarmed attacks,");
955 sprintf (string2, "but sharp weapons cause permanent damage, instead of the");
956 sprintf (string3, "temporary trauma from blunt weapons, fists and feet.");
958 if(tutorialstage==44){
959 sprintf (string, "The enemy now has your knife!");
960 sprintf (string2, "Please reverse two of his knife attacks.");
961 sprintf (string3, " ");
963 if(tutorialstage==45){
964 sprintf (string, "Please reverse one more of his knife attacks.");
965 sprintf (string2, " ");
966 sprintf (string3, " ");
968 if(tutorialstage==46){
969 sprintf (string, "Now he has a sword!");
970 sprintf (string2, "The sword has longer reach than your arms, so you");
971 sprintf (string3, "must move close to reverse the sword slash.");
973 if(tutorialstage==47){
974 sprintf (string, "Long weapons like the sword and staff are also useful for defense;");
975 sprintf (string2, "you can parry enemy weapon attacks by pressing the attack key");
976 sprintf (string3, "at the right time. Please try parrying the enemy's attacks!");
978 if(tutorialstage==48){
979 sprintf (string, "The staff is like the sword, but has two main attacks.");
980 sprintf (string2, "The standing smash is fast and effective, and the running");
981 sprintf (string3, "spin smash is slower and more powerful.");
983 if(tutorialstage==49){
984 sprintf (string, "When facing an enemy, you can throw the knife with %s.",KeyToChar(throwkey));
985 sprintf (string2, "It is possible to throw the knife while flipping,");
986 sprintf (string3, "but it is very inaccurate.");
988 if(tutorialstage==50){
989 sprintf (string, "You now know everything you can learn from training.");
990 sprintf (string2, "Everything else you must learn from experience!");
991 sprintf (string3, " ");
993 if(tutorialstage==51){
994 sprintf (string, "Walk out of the training area to return to the main menu.");
995 sprintf (string2, " ");
996 sprintf (string3, " ");
999 glColor4f(0,0,0,tutorialopac);
1000 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);
1001 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);
1002 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);
1003 glColor4f(1,1,1,tutorialopac);
1004 text.glPrint(screenwidth/2-7.6*strlen(string)*screenwidth/1024,screenheight/16+screenheight*4/5,string,1,1.5*screenwidth/1024,screenwidth,screenheight);
1005 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);
1006 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);
1008 sprintf (string, "Press 'tab' to skip to the next item.",KeyToChar(jumpkey));
1009 sprintf (string2, "Press escape at any time to");
1010 sprintf (string3, "pause or exit the tutorial.");
1013 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);
1014 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);
1015 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);
1016 glColor4f(0.5,0.5,0.5,1);
1017 text.glPrint(screenwidth/2-7.6*strlen(string)*screenwidth/1024*.8,0+screenheight*1/10,string,1,1.5*screenwidth/1024*.8,screenwidth,screenheight);
1018 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);
1019 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);
1023 if(numhotspots&&(bonustime>=1||bonus<=0||bonustime<0)&&!tutoriallevel){
1025 float closestdist=-1;
1027 closest=currenthotspot;
1028 for(i=0;i<numhotspots;i++){
1029 distance=findDistancefast(&player[0].coords,&hotspot[i]);
1030 if(closestdist==-1||distance<closestdist){
1031 if(findDistancefast(&player[0].coords,&hotspot[i])<hotspotsize[i]&&((hotspottype[i]<=10&&hotspottype[i]>=0)||(hotspottype[i]<=40&&hotspottype[i]>=20))){
1032 closestdist=distance;
1038 currenthotspot=closest;
1039 if(currenthotspot!=-1){
1040 if(hotspottype[closest]<=10){
1041 if(findDistancefast(&player[0].coords,&hotspot[closest])<hotspotsize[closest])
1042 tutorialstagetime=0;
1044 tutorialopac=tutorialmaxtime-tutorialstagetime;
1045 if(tutorialopac>1)tutorialopac=1;
1046 if(tutorialopac<0)tutorialopac=0;
1048 sprintf (string, "%s", hotspottext[closest]);
1056 if(string[i]=='\n'||string[i]>'z'||string[i]<' '||string[i]=='\0'){
1057 glColor4f(0,0,0,tutorialopac);
1058 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);
1059 glColor4f(1,1,1,tutorialopac);
1060 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);
1063 if(string[i]=='\0')done=1;
1069 else if (hotspottype[closest]>=20&&dialoguegonethrough[hotspottype[closest]-20]==0){
1070 whichdialogue=hotspottype[closest]-20;
1071 for(j=0;j<numdialogueboxes[whichdialogue];j++){
1072 player[participantfocus[whichdialogue][j]].coords=participantlocation[whichdialogue][participantfocus[whichdialogue][j]];
1073 player[participantfocus[whichdialogue][j]].rotation=participantrotation[whichdialogue][participantfocus[whichdialogue][j]];
1074 player[participantfocus[whichdialogue][j]].targetrotation=participantrotation[whichdialogue][participantfocus[whichdialogue][j]];
1075 player[participantfocus[whichdialogue][j]].velocity=0;
1076 player[participantfocus[whichdialogue][j]].targetanimation=player[participantfocus[whichdialogue][j]].getIdle();
1077 player[participantfocus[whichdialogue][j]].targetframe=0;
1081 dialoguegonethrough[whichdialogue]++;
1082 if(dialogueboxsound[whichdialogue][indialogue]!=0){
1083 static float gLoc[3];
1084 static float vel[3];
1085 gLoc[0]=player[participantfocus[whichdialogue][indialogue]].coords.x;
1086 gLoc[1]=player[participantfocus[whichdialogue][indialogue]].coords.y;
1087 gLoc[2]=player[participantfocus[whichdialogue][indialogue]].coords.z;
1092 if(dialogueboxsound[whichdialogue][indialogue]==1)whichsoundplay=rabbitchitter;
1093 if(dialogueboxsound[whichdialogue][indialogue]==2)whichsoundplay=rabbitchitter2;
1094 if(dialogueboxsound[whichdialogue][indialogue]==3)whichsoundplay=rabbitpainsound;
1095 if(dialogueboxsound[whichdialogue][indialogue]==4)whichsoundplay=rabbitpain1sound;
1096 if(dialogueboxsound[whichdialogue][indialogue]==5)whichsoundplay=rabbitattacksound;
1097 if(dialogueboxsound[whichdialogue][indialogue]==6)whichsoundplay=rabbitattack2sound;
1098 if(dialogueboxsound[whichdialogue][indialogue]==7)whichsoundplay=rabbitattack3sound;
1099 if(dialogueboxsound[whichdialogue][indialogue]==8)whichsoundplay=rabbitattack4sound;
1100 if(dialogueboxsound[whichdialogue][indialogue]==9)whichsoundplay=growlsound;
1101 if(dialogueboxsound[whichdialogue][indialogue]==10)whichsoundplay=growl2sound;
1102 if(dialogueboxsound[whichdialogue][indialogue]==11)whichsoundplay=snarlsound;
1103 if(dialogueboxsound[whichdialogue][indialogue]==12)whichsoundplay=snarl2sound;
1104 if(dialogueboxsound[whichdialogue][indialogue]==13)whichsoundplay=barksound;
1105 if(dialogueboxsound[whichdialogue][indialogue]==14)whichsoundplay=bark2sound;
1106 if(dialogueboxsound[whichdialogue][indialogue]==15)whichsoundplay=bark3sound;
1107 if(dialogueboxsound[whichdialogue][indialogue]==16)whichsoundplay=barkgrowlsound;
1108 if(dialogueboxsound[whichdialogue][indialogue]==-1)whichsoundplay=fireendsound;
1109 if(dialogueboxsound[whichdialogue][indialogue]==-2)whichsoundplay=firestartsound;
1110 if(dialogueboxsound[whichdialogue][indialogue]==-3)whichsoundplay=consolesuccesssound;
1111 if(dialogueboxsound[whichdialogue][indialogue]==-4)whichsoundplay=consolefailsound;
1112 PlaySoundEx( whichsoundplay, samp[whichsoundplay], NULL, true);
1113 OPENAL_3D_SetAttributes(channels[whichsoundplay], gLoc, vel);
1114 OPENAL_SetVolume(channels[whichsoundplay], 256);
1115 OPENAL_SetPaused(channels[whichsoundplay], false);
1121 if(indialogue!=-1&&!mainmenu){
1122 glDisable(GL_DEPTH_TEST); // Disables Depth Testing
1123 glDisable(GL_CULL_FACE);
1124 glDisable(GL_LIGHTING);
1125 glDisable(GL_TEXTURE_2D);
1127 glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
1128 glPushMatrix(); // Store The Projection Matrix
1129 glLoadIdentity(); // Reset The Projection Matrix
1130 glOrtho(0,screenwidth,0,screenheight,-100,100); // Set Up An Ortho Screen
1131 glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
1132 glPushMatrix(); // Store The Modelview Matrix
1133 glLoadIdentity(); // Reset The Modelview Matrix
1134 if(dialogueboxlocation[whichdialogue][indialogue]==1)glTranslatef(0,screenheight*3/4,0);
1135 glScalef(screenwidth,screenheight/4,1);
1136 glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
1139 glColor4f(dialogueboxcolor[whichdialogue][indialogue][0],dialogueboxcolor[whichdialogue][indialogue][1],dialogueboxcolor[whichdialogue][indialogue][2],0.7);
1141 glVertex3f(0, 0, 0.0f);
1142 glVertex3f(1, 0, 0.0f);
1143 glVertex3f(1, 1, 0.0f);
1144 glVertex3f(0, 1, 0.0f);
1146 glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
1147 glPopMatrix(); // Restore The Old Projection Matrix
1148 glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
1149 glPopMatrix(); // Restore The Old Projection Matrix
1150 glEnable(GL_DEPTH_TEST); // Enables Depth Testing
1151 glEnable(GL_CULL_FACE);
1152 glDisable(GL_BLEND);
1154 glEnable(GL_TEXTURE_2D);
1161 startx=screenwidth*1/5;
1162 if(dialogueboxlocation[whichdialogue][indialogue]==1)starty=screenheight/16+screenheight*4/5;
1163 if(dialogueboxlocation[whichdialogue][indialogue]==2)starty=screenheight*1/5-screenheight/16;
1165 // char tempname[64];
1169 // for(i=0;i<64;i++){
1174 for(i=0;i<(int)strlen(dialoguename[whichdialogue][indialogue]);i++){
1175 tempname[tempnum]=dialoguename[whichdialogue][indialogue][i];
1177 if(dialoguename[whichdialogue][indialogue][i]=='#'||dialoguename[whichdialogue][indialogue][i]=='\0')goodchar=0;
1178 //if(tempnum>2)if(tempname[tempnum-2]=='e'&&tempname[tempnum-1]=='r')goodchar=0;
1179 //if(tempnum>2)if(tempname[tempnum]=='r'&&tempname[0]=='a')goodchar=0;
1180 if(goodchar)tempnum++;
1181 else tempname[tempnum]='\0';
1184 sprintf (string, "%s: ", tempname);
1186 if(dialogueboxcolor[whichdialogue][indialogue][0]+dialogueboxcolor[whichdialogue][indialogue][1]+dialogueboxcolor[whichdialogue][indialogue][2]<1.5){
1187 glColor4f(0,0,0,tutorialopac);
1188 text.glPrintOutline(startx-2*7.6*strlen(string)*screenwidth/1024-4,starty-4,string,1,1.5*1.25*screenwidth/1024,screenwidth,screenheight);
1189 glColor4f(0.7,0.7,0.7,tutorialopac);
1190 text.glPrint(startx-2*7.6*strlen(string)*screenwidth/1024,starty,string,1,1.5*screenwidth/1024,screenwidth,screenheight);
1194 glColor4f(0,0,0,tutorialopac);
1195 text.glPrintOutline(startx-2*7.6*strlen(string)*screenwidth/1024-4,starty-4,string,1,1.5*1.25*screenwidth/1024,screenwidth,screenheight);
1200 for(i=0;i<(int)strlen(dialoguetext[whichdialogue][indialogue])+1;i++){
1201 tempname[tempnum]=dialoguetext[whichdialogue][indialogue][i];
1202 if(dialoguetext[whichdialogue][indialogue][i]!='#')tempnum++;
1206 sprintf (string, "%s", tempname);
1215 if(string[i]=='\n'||string[i]>'z'||string[i]<' '||string[i]=='\0'){
1216 if(dialogueboxcolor[whichdialogue][indialogue][0]+dialogueboxcolor[whichdialogue][indialogue][1]+dialogueboxcolor[whichdialogue][indialogue][2]<1.5){
1217 glColor4f(0,0,0,tutorialopac);
1218 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);
1219 glColor4f(1,1,1,tutorialopac);
1220 text.glPrint(startx/*-7.6*(i-lastline)*screenwidth/1024*/,starty-20*screenwidth/1024*line,string,1,1.5*screenwidth/1024,screenwidth,screenheight,lastline,i);
1224 glColor4f(0,0,0,tutorialopac);
1225 text.glPrint(startx/*-7.6*(i-lastline)*screenwidth/1024*/,starty-20*screenwidth/1024*line,string,1,1.5*screenwidth/1024,screenwidth,screenheight,lastline,i);
1229 if(string[i]=='\0')done=1;
1236 if(!tutoriallevel&&!winfreeze&&indialogue==-1&&!mainmenu){
1238 if(!scoreadded)sprintf (string, "Score: %d", (int)accountcampaignscore[accountactive]+(int)bonustotal);//(int)bonustotal);
1239 if(scoreadded)sprintf (string, "Score: %d", (int)accountcampaignscore[accountactive]);//(int)bonustotal);
1241 if(!campaign)sprintf (string, "Score: %d", (int)bonustotal);
1243 text.glPrintOutline(1024/40-4,768/16-4+768*14/16,string,1,1.5*1.25,1024,768);
1245 text.glPrint(1024/40,768/16+768*14/16,string,1,1.5,1024,768);
1248 glColor4f(.5,.5,.5,1);
1251 if((texttoggle||editorenabled)&&debugmode&&!mainmenu){
1252 sprintf (string, "The framespersecond is %d.",(int)(fps));
1253 text.glPrint(10,30,string,0,.8,1024,768);
1255 sprintf (string, "Name: %s", registrationname);
1256 text.glPrint(10,260,string,0,.8,1024,768);
1259 if(editorenabled)sprintf (string, "Map editor enabled.");
1260 if(!editorenabled)sprintf (string, "Map editor Disabled.");
1261 text.glPrint(10,60,string,0,.8,1024,768);
1263 sprintf (string, "Object size: %f",editorsize);
1264 text.glPrint(10,75,string,0,.8,1024,768);
1265 if(editorrotation>=0)sprintf (string, "Object rotation: %f",editorrotation);
1266 else sprintf (string, "Object rotation: Random");
1267 text.glPrint(10,90,string,0,.8,1024,768);
1268 if(editorrotation2>=0)sprintf (string, "Object rotation2: %f",editorrotation2);
1269 else sprintf (string, "Object rotation2: Random");
1270 text.glPrint(10,105,string,0,.8,1024,768);
1271 sprintf (string, "Object type: %d",editortype);
1272 text.glPrint(10,120,string,0,.8,1024,768);
1273 if(editortype==boxtype)sprintf (string, "(box)");
1274 if(editortype==treetrunktype)sprintf (string, "(tree)");
1275 if(editortype==walltype)sprintf (string, "(wall)");
1276 if(editortype==weirdtype)sprintf (string, "(weird)");
1277 if(editortype==spiketype)sprintf (string, "(spike)");
1278 if(editortype==rocktype)sprintf (string, "(rock)");
1279 if(editortype==bushtype)sprintf (string, "(bush)");
1280 if(editortype==tunneltype)sprintf (string, "(tunnel)");
1281 if(editortype==chimneytype)sprintf (string, "(chimney)");
1282 if(editortype==platformtype)sprintf (string, "(platform)");
1283 if(editortype==cooltype)sprintf (string, "(cool)");
1284 if(editortype==firetype)sprintf (string, "(fire)");
1285 text.glPrint(130,120,string,0,.8,1024,768);
1287 sprintf (string, "Numplayers: %d",numplayers);
1288 text.glPrint(10,155,string,0,.8,1024,768);
1289 sprintf (string, "Player %d: numwaypoints: %d",numplayers,player[numplayers-1].numwaypoints);
1290 text.glPrint(10,140,string,0,.8,1024,768);
1292 /*sprintf (string, "Coords are: %f %f %f",player[0].coords.x,player[0].coords.y,player[0].coords.z);
1293 text.glPrint(10,200,string,0,.8,1024,768);*/
1294 sprintf (string, "Difficulty: %d",difficulty);
1295 text.glPrint(10,240,string,0,.8,1024,768);
1297 sprintf (string, "lasthotspot: %d",hotspottype[numhotspots-1]);
1298 text.glPrint(10,240,string,0,.8,1024,768);
1299 sprintf (string, "killhotspot: %d",killhotspot);
1300 text.glPrint(10,220,string,0,.8,1024,768);
1301 sprintf (string, "winhotspot: %d",winhotspot);
1302 text.glPrint(10,200,string,0,.8,1024,768);*/
1307 if(drawmode==glowmode){
1308 glDisable(GL_DEPTH_TEST); // Disables Depth Testing
1309 glDisable(GL_CULL_FACE);
1310 glDisable(GL_LIGHTING);
1311 glDisable(GL_TEXTURE_2D);
1313 glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
1314 glPushMatrix(); // Store The Projection Matrix
1315 glLoadIdentity(); // Reset The Projection Matrix
1316 glOrtho(0,screenwidth,0,screenheight,-100,100); // Set Up An Ortho Screen
1317 glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
1318 glPushMatrix(); // Store The Modelview Matrix
1319 glLoadIdentity(); // Reset The Modelview Matrix
1320 glScalef(screenwidth,screenheight,1);
1321 glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
1323 glColor4f(0,0,0,.5);
1325 glVertex3f(0, 0, 0.0f);
1326 glVertex3f(256, 0, 0.0f);
1327 glVertex3f(256, 256, 0.0f);
1328 glVertex3f(0, 256, 0.0f);
1330 glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
1331 glPopMatrix(); // Restore The Old Projection Matrix
1332 glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
1333 glPopMatrix(); // Restore The Old Projection Matrix
1334 glEnable(GL_DEPTH_TEST); // Enables Depth Testing
1335 glEnable(GL_CULL_FACE);
1336 glDisable(GL_BLEND);
1340 if((((blackout&&damageeffects)||(player[0].bloodloss>0&&damageeffects&&player[0].blooddimamount>0)||player[0].dead)&&!cameramode)||console){
1341 glDisable(GL_DEPTH_TEST); // Disables Depth Testing
1342 glDisable(GL_CULL_FACE);
1343 glDisable(GL_LIGHTING);
1344 glDisable(GL_TEXTURE_2D);
1346 glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
1347 glPushMatrix(); // Store The Projection Matrix
1348 glLoadIdentity(); // Reset The Projection Matrix
1349 glOrtho(0,screenwidth,0,screenheight,-100,100); // Set Up An Ortho Screen
1350 glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
1351 glPushMatrix(); // Store The Modelview Matrix
1352 glLoadIdentity(); // Reset The Modelview Matrix
1353 glScalef(screenwidth,screenheight,1);
1354 glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
1356 if(player[0].dead)blackout+=multiplier*3;
1357 if(player[0].dead==1)blackout=.4f;
1358 if(player[0].dead==2&&blackout>.6)blackout=.6;
1359 glColor4f(0,0,0,blackout);
1360 if(!player[0].dead){
1361 if((player[0].bloodloss/player[0].damagetolerance*(sin(woozy)/4+.5))*.3<.3){
1362 glColor4f(0,0,0,player[0].blooddimamount*player[0].bloodloss/player[0].damagetolerance*(sin(woozy)/4+.5)*.3);
1363 blackout=player[0].blooddimamount*player[0].bloodloss/player[0].damagetolerance*(sin(woozy)/4+.5)*.3;
1366 glColor4f(0,0,0,player[0].blooddimamount*.3);
1367 blackout=player[0].blooddimamount*.3;
1370 if(console)glColor4f(.7,0,0,.2);
1372 glVertex3f(0, 0, 0.0f);
1373 glVertex3f(256, 0, 0.0f);
1374 glVertex3f(256, 256, 0.0f);
1375 glVertex3f(0, 256, 0.0f);
1377 glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
1378 glPopMatrix(); // Restore The Old Projection Matrix
1379 glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
1380 glPopMatrix(); // Restore The Old Projection Matrix
1381 glEnable(GL_DEPTH_TEST); // Enables Depth Testing
1382 glEnable(GL_CULL_FACE);
1383 glDisable(GL_BLEND);
1387 if(flashamount>0&&damageeffects){
1388 if(flashamount>1)flashamount=1;
1389 if(flashdelay<=0)flashamount-=multiplier;
1391 if(flashamount<0)flashamount=0;
1392 glDisable(GL_DEPTH_TEST); // Disables Depth Testing
1393 glDisable(GL_CULL_FACE);
1394 glDisable(GL_LIGHTING);
1396 glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
1397 glPushMatrix(); // Store The Projection Matrix
1398 glLoadIdentity(); // Reset The Projection Matrix
1399 glOrtho(0,screenwidth,0,screenheight,-100,100); // Set Up An Ortho Screen
1400 glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
1401 glPushMatrix(); // Store The Modelview Matrix
1402 glLoadIdentity(); // Reset The Modelview Matrix
1403 glScalef(screenwidth,screenheight,1);
1404 glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
1406 glColor4f(flashr,flashg,flashb,flashamount);
1408 glVertex3f(0, 0, 0.0f);
1409 glVertex3f(256, 0, 0.0f);
1410 glVertex3f(256, 256, 0.0f);
1411 glVertex3f(0, 256, 0.0f);
1413 glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
1414 glPopMatrix(); // Restore The Old Projection Matrix
1415 glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
1416 glPopMatrix(); // Restore The Old Projection Matrix
1417 glEnable(GL_DEPTH_TEST); // Enables Depth Testing
1418 glEnable(GL_CULL_FACE);
1419 glDisable(GL_BLEND);
1425 glEnable(GL_TEXTURE_2D);
1428 sprintf (string, " ]");
1429 text.glPrint(10,30+screenheight-330,string,0,1,screenwidth,screenheight);
1431 sprintf (string, "_");
1432 text.glPrint(30+(float)(displayselected)*10,30+(screenheight-330),string,0,1,screenwidth,screenheight);
1436 if((i!=0||chatting)&&displaytime[i]<4)
1437 for(j=0;j<displaychars[i];j++){
1438 glColor4f(1,1,1,4-displaytime[i]);
1439 if(j<displaychars[i]){
1440 sprintf (string, "%c",displaytext[i][j]);
1441 text.glPrint(30+j*10,30+i*20+(screenheight-330),string,0,1,screenwidth,screenheight);
1447 if(minimap&&indialogue==-1){
1451 glDisable(GL_DEPTH_TEST);
1452 glColor3f (1.0, 1.0, 1.0); // no coloring
1454 glEnable(GL_TEXTURE_2D);
1455 glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE );
1456 glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE );
1457 glDisable(GL_DEPTH_TEST); // Disables Depth Testing
1458 glDisable(GL_CULL_FACE);
1459 glDisable(GL_LIGHTING);
1461 glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
1462 glPushMatrix(); // Store The Projection Matrix
1463 glLoadIdentity(); // Reset The Projection Matrix
1464 glOrtho(0,screenwidth,0,screenheight,-100,100); // Set Up An Ortho Screen
1465 glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
1466 glPushMatrix(); // Store The Modelview Matrix
1467 glLoadIdentity(); // Reset The Modelview Matrix
1468 glScalef((float)screenwidth/2,(float)screenwidth/2,1);
1469 glTranslatef(1.75,.25,0);
1470 glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
1480 int numliveplayers=0;
1481 for(i=0;i<numplayers;i++){
1482 if(!player[i].dead)numliveplayers++;
1488 for(i=0;i<objects.numobjects;i++){
1489 if(objects.type[i]==treetrunktype||objects.type[i]==boxtype){
1490 center+=objects.position[i];
1494 for(i=0;i<numplayers;i++){
1495 if(!player[i].dead)center+=player[i].coords;
1497 center/=numadd+numliveplayers;
1499 center=player[0].coords;
1501 float maxdistance=0;
1504 for(i=0;i<objects.numobjects;i++){
1505 tempdist=findDistancefast(¢er,&objects.position[i]);
1506 if(tempdist>maxdistance){
1508 maxdistance=tempdist;
1511 for(i=0;i<numplayers;i++){
1512 if(!player[i].dead){
1513 tempdist=findDistancefast(¢er,&player[i].coords);
1514 if(tempdist>maxdistance){
1516 maxdistance=tempdist;
1520 radius=fast_sqrt(maxdistance);
1524 glScalef(.25/radius*256*terrain.scale*.4,.25/radius*256*terrain.scale*.4,1);
1526 glScalef(1/(1/radius*256*terrain.scale*.4),1/(1/radius*256*terrain.scale*.4),1);
1527 /*float startx,starty,endx,endy;
1529 glTexCoord2f(1-(center.x-radius)/terrain.scale/256,(center.z-radius)/terrain.scale/256);
1530 glVertex3f(-1, -1, 0.0f);
1531 glTexCoord2f(1-(center.x+radius)/terrain.scale/256,(center.z-radius)/terrain.scale/256);
1532 glVertex3f(1, -1, 0.0f);
1533 glTexCoord2f(1-(center.x+radius)/terrain.scale/256,(center.z+radius)/terrain.scale/256);
1534 glVertex3f(1, 1, 0.0f);
1535 glTexCoord2f(1-(center.x-radius)/terrain.scale/256,(center.z+radius)/terrain.scale/256);
1536 glVertex3f(-1, 1, 0.0f);
1539 glRotatef(player[0].lookrotation*-1+180,0,0,1);
1540 glTranslatef(-(center.x/terrain.scale/256*-2+1),(center.z/terrain.scale/256*-2+1),0);
1541 for(i=0;i<objects.numobjects;i++){
1542 if(objects.type[i]==treetrunktype){
1543 distcheck=findDistancefast(&player[0].coords,&objects.position[i]);
1544 if(distcheck<mapviewdist){
1545 glBindTexture( GL_TEXTURE_2D, Mapcircletexture);
1546 glColor4f(0,.3,0,opac*(1-distcheck/mapviewdist));
1548 glTranslatef(objects.position[i].x/terrain.scale/256*-2+1,objects.position[i].z/terrain.scale/256*2-1,0);
1549 glRotatef(objects.rotation[i],0,0,1);
1550 glScalef(.003,.003,.003);
1553 glVertex3f(-1, -1, 0.0f);
1555 glVertex3f(1, -1, 0.0f);
1557 glVertex3f(1, 1, 0.0f);
1559 glVertex3f(-1, 1, 0.0f);
1564 if(objects.type[i]==boxtype){
1565 distcheck=findDistancefast(&player[0].coords,&objects.position[i]);
1566 if(distcheck<mapviewdist){
1567 glBindTexture( GL_TEXTURE_2D, Mapboxtexture);
1568 glColor4f(.4,.4,.4,opac*(1-distcheck/mapviewdist));
1570 glTranslatef(objects.position[i].x/terrain.scale/256*-2+1,objects.position[i].z/terrain.scale/256*2-1,0);
1571 glRotatef(objects.rotation[i],0,0,1);
1572 glScalef(.01*objects.scale[i],.01*objects.scale[i],.01*objects.scale[i]);
1575 glVertex3f(-1, -1, 0.0f);
1577 glVertex3f(1, -1, 0.0f);
1579 glVertex3f(1, 1, 0.0f);
1581 glVertex3f(-1, 1, 0.0f);
1588 glBindTexture( GL_TEXTURE_2D, Mapcircletexture);
1589 for(i=0;i<numboundaries;i++){
1590 glColor4f(0,0,0,opac/3);
1592 glTranslatef(boundary[i].x/terrain.scale/256*-2+1,boundary[i].z/terrain.scale/256*2-1,0);
1593 glScalef(.002,.002,.002);
1596 glVertex3f(-1, -1, 0.0f);
1598 glVertex3f(1, -1, 0.0f);
1600 glVertex3f(1, 1, 0.0f);
1602 glVertex3f(-1, 1, 0.0f);
1607 for(i=0;i<numplayers;i++){
1608 distcheck=findDistancefast(&player[0].coords,&player[i].coords);
1609 if(distcheck<mapviewdist){
1611 glBindTexture( GL_TEXTURE_2D, Maparrowtexture);
1612 if(i==0)glColor4f(1,1,1,opac);
1613 else if(player[i].dead==2||player[i].howactive>typesleeping)glColor4f(0,0,0,opac*(1-distcheck/mapviewdist));
1614 else if(player[i].dead)glColor4f(.3,.3,.3,opac*(1-distcheck/mapviewdist));
1615 else if(player[i].aitype==attacktypecutoff)glColor4f(1,0,0,opac*(1-distcheck/mapviewdist));
1616 else if(player[i].aitype==passivetype)glColor4f(0,1,0,opac*(1-distcheck/mapviewdist));
1617 else glColor4f(1,1,0,1);
1618 glTranslatef(player[i].coords.x/terrain.scale/256*-2+1,player[i].coords.z/terrain.scale/256*2-1,0);
1619 glRotatef(player[i].rotation+180,0,0,1);
1620 glScalef(.005,.005,.005);
1623 glVertex3f(-1, -1, 0.0f);
1625 glVertex3f(1, -1, 0.0f);
1627 glVertex3f(1, 1, 0.0f);
1629 glVertex3f(-1, 1, 0.0f);
1631 /*glBegin(GL_TRIANGLES);
1633 glVertex3f(-1, -1, 0.0f);
1635 glVertex3f(1, -1, 0.0f);
1637 glVertex3f(0, 1, 0.0f);
1642 /*glBegin(GL_QUADS);
1644 glVertex3f(-1, -1, 0.0f);
1646 glVertex3f(1, -1, 0.0f);
1648 glVertex3f(1, 1, 0.0f);
1650 glVertex3f(-1, 1, 0.0f);
1653 glDisable(GL_TEXTURE_2D);
1654 glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
1655 glPopMatrix(); // Restore The Old Projection Matrix
1656 glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
1657 glPopMatrix(); // Restore The Old Projection Matrix
1658 glEnable(GL_DEPTH_TEST); // Enables Depth Testing
1659 glEnable(GL_CULL_FACE);
1660 glDisable(GL_BLEND);
1666 drawmode=normalmode;
1670 if(loading&&!stealthloading&&(!campaign||player[0].dead)){
1671 glDisable(GL_DEPTH_TEST); // Disables Depth Testing
1672 glDisable(GL_CULL_FACE);
1673 glDisable(GL_LIGHTING);
1674 glDisable(GL_TEXTURE_2D);
1676 glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
1677 glPushMatrix(); // Store The Projection Matrix
1678 glLoadIdentity(); // Reset The Projection Matrix
1679 glOrtho(0,screenwidth,0,screenheight,-100,100); // Set Up An Ortho Screen
1680 glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
1681 glPushMatrix(); // Store The Modelview Matrix
1682 glLoadIdentity(); // Reset The Modelview Matrix
1683 glScalef(screenwidth,screenheight,1);
1684 glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
1686 glColor4f(0,0,0,.7);
1688 glVertex3f(0, 0, 0.0f);
1689 glVertex3f(256, 0, 0.0f);
1690 glVertex3f(256, 256, 0.0f);
1691 glVertex3f(0, 256, 0.0f);
1693 glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
1694 glPopMatrix(); // Restore The Old Projection Matrix
1695 glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
1696 glPopMatrix(); // Restore The Old Projection Matrix
1697 glEnable(GL_DEPTH_TEST); // Enables Depth Testing
1698 glEnable(GL_CULL_FACE);
1699 glDisable(GL_BLEND);
1703 glDisable(GL_DEPTH_TEST);
1704 glColor3f (1.0, 1.0, 1.0); // no coloring
1706 glEnable(GL_TEXTURE_2D);
1707 /*glBindTexture( GL_TEXTURE_2D, logotexture);
1708 glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE );
1709 glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE );
1710 glDisable(GL_DEPTH_TEST); // Disables Depth Testing
1711 glDisable(GL_CULL_FACE);
1712 glDisable(GL_LIGHTING);
1714 glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
1715 glPushMatrix(); // Store The Projection Matrix
1716 glLoadIdentity(); // Reset The Projection Matrix
1717 glOrtho(0,screenwidth,0,screenheight,-100,100); // Set Up An Ortho Screen
1718 glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
1719 glPushMatrix(); // Store The Modelview Matrix
1720 glLoadIdentity(); // Reset The Modelview Matrix
1721 glScalef((float)screenwidth/2,(float)screenwidth/2,1);
1722 glTranslatef(1.8,1.25,0);
1723 glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
1727 glScalef(.25,.25,.25);
1730 glVertex3f(-1, -1, 0.0f);
1732 glVertex3f(1, -1, 0.0f);
1734 glVertex3f(1, 1, 0.0f);
1736 glVertex3f(-1, 1, 0.0f);
1739 glDisable(GL_TEXTURE_2D);
1740 glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
1741 glPopMatrix(); // Restore The Old Projection Matrix
1742 glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
1743 glPopMatrix(); // Restore The Old Projection Matrix
1744 glEnable(GL_DEPTH_TEST); // Enables Depth Testing
1745 glEnable(GL_CULL_FACE);
1746 glDisable(GL_BLEND);
1752 glEnable(GL_TEXTURE_2D);
1754 sprintf (string, "Loading...");
1755 text.glPrint(1024/2-90,768/2,string,1,2,1024,768);
1758 //if(ismotionblur)drawmode=motionblurmode;
1759 drawmode=normalmode;
1762 if(winfreeze&&!campaign){
1763 glDisable(GL_DEPTH_TEST); // Disables Depth Testing
1764 glDisable(GL_CULL_FACE);
1765 glDisable(GL_LIGHTING);
1766 glDisable(GL_TEXTURE_2D);
1768 glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
1769 glPushMatrix(); // Store The Projection Matrix
1770 glLoadIdentity(); // Reset The Projection Matrix
1771 glOrtho(0,screenwidth,0,screenheight,-100,100); // Set Up An Ortho Screen
1772 glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
1773 glPushMatrix(); // Store The Modelview Matrix
1774 glLoadIdentity(); // Reset The Modelview Matrix
1775 glScalef(screenwidth,screenheight,1);
1776 glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
1778 glColor4f(0,0,0,.4);
1780 glVertex3f(0, 0, 0.0f);
1781 glVertex3f(256, 0, 0.0f);
1782 glVertex3f(256, 256, 0.0f);
1783 glVertex3f(0, 256, 0.0f);
1785 glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
1786 glPopMatrix(); // Restore The Old Projection Matrix
1787 glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
1788 glPopMatrix(); // Restore The Old Projection Matrix
1789 glEnable(GL_DEPTH_TEST); // Enables Depth Testing
1790 glEnable(GL_CULL_FACE);
1791 glDisable(GL_BLEND);
1795 glDisable(GL_DEPTH_TEST);
1796 glColor3f (1.0, 1.0, 1.0); // no coloring
1798 glEnable(GL_TEXTURE_2D);
1799 /*glBindTexture( GL_TEXTURE_2D, logotexture);
1800 glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE );
1801 glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE );
1802 glDisable(GL_DEPTH_TEST); // Disables Depth Testing
1803 glDisable(GL_CULL_FACE);
1804 glDisable(GL_LIGHTING);
1806 glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
1807 glPushMatrix(); // Store The Projection Matrix
1808 glLoadIdentity(); // Reset The Projection Matrix
1809 glOrtho(0,screenwidth,0,screenheight,-100,100); // Set Up An Ortho Screen
1810 glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
1811 glPushMatrix(); // Store The Modelview Matrix
1812 glLoadIdentity(); // Reset The Modelview Matrix
1813 glScalef((float)screenwidth/2,(float)screenwidth/2,1);
1814 glTranslatef(1.8,1.25,0);
1815 glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
1819 glScalef(.25,.25,.25);
1822 glVertex3f(-1, -1, 0.0f);
1824 glVertex3f(1, -1, 0.0f);
1826 glVertex3f(1, 1, 0.0f);
1828 glVertex3f(-1, 1, 0.0f);
1831 glDisable(GL_TEXTURE_2D);
1832 glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
1833 glPopMatrix(); // Restore The Old Projection Matrix
1834 glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
1835 glPopMatrix(); // Restore The Old Projection Matrix
1836 glEnable(GL_DEPTH_TEST); // Enables Depth Testing
1837 glEnable(GL_CULL_FACE);
1838 glDisable(GL_BLEND);
1846 if(damagetaken==0&&player[0].bloodloss==0){
1847 awards[numawards]=awardflawless;
1853 for(i=1;i<numplayers;i++){
1854 if(player[i].dead!=2)alldead=0;
1857 awards[numawards]=awardalldead;
1862 for(i=1;i<numplayers;i++){
1863 if(player[i].dead!=1)alldead=0;
1866 awards[numawards]=awardnodead;
1869 if(numresponded==0&&!numthrowkill){
1870 awards[numawards]=awardstealth;
1873 if(numattacks==numstaffattack&&numattacks>0){
1874 awards[numawards]=awardbojutsu;
1877 if(numattacks==numswordattack&&numattacks>0){
1878 awards[numawards]=awardswordsman;
1881 if(numattacks==numknifeattack&&numattacks>0){
1882 awards[numawards]=awardknifefighter;
1885 if(numattacks==numunarmedattack&&numthrowkill==0&&weapons.numweapons>0){
1886 awards[numawards]=awardkungfu;
1890 awards[numawards]=awardevasion;
1893 if(numflipfail==0&&numflipped+numwallflipped*2>20){
1894 awards[numawards]=awardacrobat;
1897 if(numthrowkill==numplayers-1){
1898 awards[numawards]=awardlongrange;
1903 for(i=1;i<numplayers;i++){
1904 if(player[i].dead!=2)alldead=0;
1906 if(numafterkill>0&&alldead){
1907 awards[numawards]=awardbrutal;
1910 if(numreversals>((float)numattacks)*.8&&numreversals>3){
1911 awards[numawards]=awardaikido;
1914 if(maxalarmed==1&&numplayers>2){
1915 awards[numawards]=awardstrategy;
1919 awards[numawards]=awardklutz;
1924 //Win Screen Won Victory
1926 glEnable(GL_TEXTURE_2D);
1928 sprintf (string, "Level Cleared!");
1929 text.glPrintOutlined(1024/2-strlen(string)*10,768*7/8,string,1,2,1024,768);
1931 sprintf (string, "Score: %d",(int)(bonustotal-startbonustotal));
1932 text.glPrintOutlined(1024/30,768*6/8,string,1,2,1024,768);
1934 if(!campaign)sprintf (string, "Press Escape to return to menu or Space to continue");
1935 if(campaign)sprintf (string, "Press Escape or Space to continue");
1936 text.glPrintOutlined(640/2-strlen(string)*5,480*1/16,string,1,1,640,480);
1940 for(i=0;i<255;i++)string[i]='\0';
1941 sprintf (temp, "Time: %d:",(int)(((int)leveltime-(int)(leveltime)%60)/60));
1942 strcat(string,temp);
1943 if((int)(leveltime)%60<10)strcat(string,"0");
1944 sprintf (temp, "%d",(int)(leveltime)%60);
1945 strcat(string,temp);
1946 text.glPrintOutlined(1024/30,768*6/8-40,string,1,2,1024,768);
1948 for(i=0;i<numawards;i++){
1950 if(awards[i]==awardklutz)sprintf (string, "Suicidal");
1951 if(awards[i]==awardflawless)sprintf (string, "Flawless!");
1952 if(awards[i]==awardalldead)sprintf (string, "Take no prisoners");
1953 if(awards[i]==awardnodead)sprintf (string, "Merciful");
1954 if(awards[i]==awardstealth)sprintf (string, "One with the shadows!");
1955 if(awards[i]==awardswordsman)sprintf (string, "Swordsman");
1956 if(awards[i]==awardkungfu)sprintf (string, "Unarmed!");
1957 if(awards[i]==awardknifefighter)sprintf (string, "Knife fighter");
1958 if(awards[i]==awardcoward)sprintf (string, "Coward");
1959 if(awards[i]==awardevasion)sprintf (string, "Escape artist");
1960 if(awards[i]==awardacrobat)sprintf (string, "Gymnast");
1961 if(awards[i]==awardlongrange)sprintf (string, "Blade slinger");
1962 if(awards[i]==awardbrutal)sprintf (string, "Brutal");
1963 if(awards[i]==awardhyper)sprintf (string, "Hyper");
1964 if(awards[i]==awardaikido)sprintf (string, "Aikido master!");
1965 if(awards[i]==awardrambo)sprintf (string, "Rambo");
1966 if(awards[i]==awardfast)sprintf (string, "Fast");
1967 if(awards[i]==awardrealfast)sprintf (string, "Real fast");
1968 if(awards[i]==awarddamnfast)sprintf (string, "Damn fast");
1969 if(awards[i]==awardstrategy)sprintf (string, "Divide and conquer");
1970 if(awards[i]==awardbojutsu)sprintf (string, "Bojutsu");
1971 text.glPrintOutlined(1024/30,768*6/8-90-40*i,string,1,2,1024,768);
1975 //drawmode=normalmode;
1978 if(drawmode!=normalmode){
1979 glEnable(GL_TEXTURE_2D);
1981 if(!drawtoggle||drawmode!=realmotionblurmode||(drawtoggle==2||change==1)){
1984 glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE_EXT);
1985 GLfloat subtractColor[4] = { 0.5, 0.5, 0.5, 0.0 };
1986 glTexEnvfv(GL_TEXTURE_ENV, GL_TEXTURE_ENV_COLOR, subtractColor);
1987 //glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB_EXT, GL_SUBTRACT);
1988 glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_RGB_EXT, GL_TEXTURE);
1989 glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE1_RGB_EXT, GL_CONSTANT_EXT);
1990 glTexEnvf(GL_TEXTURE_ENV, GL_RGB_SCALE_EXT, 2.0f);
1992 glBindTexture( GL_TEXTURE_2D, screentexture);
1993 glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 0, texviewwidth, texviewheight);
1996 if((drawtoggle||change==1)&&drawmode==realmotionblurmode){
1998 glBindTexture( GL_TEXTURE_2D, screentexture2);
1999 glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 0, texviewwidth, texviewheight);
2001 if(!screentexture2){
2002 glPixelStorei( GL_UNPACK_ALIGNMENT, 1 );
2004 glGenTextures( 1, &screentexture2 );
2005 glTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE );
2007 glEnable(GL_TEXTURE_2D);
2008 glBindTexture( GL_TEXTURE_2D, screentexture2);
2009 glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR );
2010 glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR );
2012 glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 0, 0, kTextureSize, kTextureSize, 0);
2018 glClear(GL_DEPTH_BUFFER_BIT);
2019 ReSizeGLScene(90,.1f);
2020 glViewport(0,0,screenwidth,screenheight);
2022 if(drawmode!=normalmode){
2023 glDisable(GL_DEPTH_TEST);
2024 if(drawmode==motionblurmode){
2025 glDrawBuffer(GL_FRONT);
2026 glReadBuffer(GL_BACK);
2027 //myassert(glGetError() == GL_NO_ERROR);
2030 glColor3f (1.0, 1.0, 1.0); // no coloring
2032 glEnable(GL_TEXTURE_2D);
2033 glBindTexture( GL_TEXTURE_2D, screentexture);
2034 glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE );
2035 glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE );
2036 glDisable(GL_DEPTH_TEST); // Disables Depth Testing
2037 glDisable(GL_CULL_FACE);
2038 glDisable(GL_LIGHTING);
2040 glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
2041 glPushMatrix(); // Store The Projection Matrix
2042 glLoadIdentity(); // Reset The Projection Matrix
2043 glOrtho(0,screenwidth,0,screenheight,-100,100); // Set Up An Ortho Screen
2044 glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
2045 glPushMatrix(); // Store The Modelview Matrix
2046 glLoadIdentity(); // Reset The Modelview Matrix
2047 glScalef((float)screenwidth/2,(float)screenheight/2,1);
2048 glTranslatef(1,1,0);
2049 glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
2051 if(drawmode==motionblurmode){
2052 if(motionbluramount<.2)motionbluramount=.2;
2053 //glColor4f(1,1,1,fast_sqrt(multiplier)*2.9*motionbluramount);
2054 glColor4f(1,1,1,motionbluramount);
2058 glVertex3f(-1, -1, 0.0f);
2059 glTexCoord2f(texcoordwidth,0);
2060 glVertex3f(1, -1, 0.0f);
2061 glTexCoord2f(texcoordwidth,texcoordheight);
2062 glVertex3f(1, 1, 0.0f);
2063 glTexCoord2f(0,texcoordheight);
2064 glVertex3f(-1, 1, 0.0f);
2068 if(drawmode==realmotionblurmode){
2069 glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
2070 glClear(GL_COLOR_BUFFER_BIT);
2071 glBlendFunc(GL_SRC_ALPHA,GL_ONE);
2072 glBindTexture( GL_TEXTURE_2D, screentexture);
2073 glColor4f(1,1,1,.5);
2077 glVertex3f(-1, -1, 0.0f);
2078 glTexCoord2f(texcoordwidth,0);
2079 glVertex3f(1, -1, 0.0f);
2080 glTexCoord2f(texcoordwidth,texcoordheight);
2081 glVertex3f(1, 1, 0.0f);
2082 glTexCoord2f(0,texcoordheight);
2083 glVertex3f(-1, 1, 0.0f);
2086 glBindTexture( GL_TEXTURE_2D, screentexture2);
2087 glColor4f(1,1,1,.5);
2091 glVertex3f(-1, -1, 0.0f);
2092 glTexCoord2f(texcoordwidth,0);
2093 glVertex3f(1, -1, 0.0f);
2094 glTexCoord2f(texcoordwidth,texcoordheight);
2095 glVertex3f(1, 1, 0.0f);
2096 glTexCoord2f(0,texcoordheight);
2097 glVertex3f(-1, 1, 0.0f);
2100 glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
2102 if(drawmode==doublevisionmode){
2103 static float crosseyedness;
2104 crosseyedness=abs(player[0].damage-player[0].superpermanentdamage-(player[0].damagetolerance-player[0].superpermanentdamage)*1/2)/30;
2105 if(crosseyedness>1)crosseyedness=1;
2106 if(crosseyedness<0)crosseyedness=0;
2108 glDisable(GL_BLEND);
2113 glVertex3f(-1, -1, 0.0f);
2114 glTexCoord2f(texcoordwidth,0);
2115 glVertex3f(1, -1, 0.0f);
2116 glTexCoord2f(texcoordwidth,texcoordheight);
2117 glVertex3f(1, 1, 0.0f);
2118 glTexCoord2f(0,texcoordheight);
2119 glVertex3f(-1, 1, 0.0f);
2123 glColor4f(1,1,1,.5);
2126 glTranslatef(.015*crosseyedness,0,0);
2130 glVertex3f(-1, -1, 0.0f);
2131 glTexCoord2f(texcoordwidth,0);
2132 glVertex3f(1, -1, 0.0f);
2133 glTexCoord2f(texcoordwidth,texcoordheight);
2134 glVertex3f(1, 1, 0.0f);
2135 glTexCoord2f(0,texcoordheight);
2136 glVertex3f(-1, 1, 0.0f);
2141 if(drawmode==glowmode){
2142 glColor4f(.5,.5,.5,.5);
2144 glBlendFunc(GL_SRC_ALPHA,GL_ONE);
2146 glTranslatef(.01,0,0);
2149 glVertex3f(-1, -1, 0.0f);
2150 glTexCoord2f(texcoordwidth,0);
2151 glVertex3f(1, -1, 0.0f);
2152 glTexCoord2f(texcoordwidth,texcoordheight);
2153 glVertex3f(1, 1, 0.0f);
2154 glTexCoord2f(0,texcoordheight);
2155 glVertex3f(-1, 1, 0.0f);
2159 glTranslatef(-.01,0,0);
2162 glVertex3f(-1, -1, 0.0f);
2163 glTexCoord2f(texcoordwidth,0);
2164 glVertex3f(1, -1, 0.0f);
2165 glTexCoord2f(texcoordwidth,texcoordheight);
2166 glVertex3f(1, 1, 0.0f);
2167 glTexCoord2f(0,texcoordheight);
2168 glVertex3f(-1, 1, 0.0f);
2172 glTranslatef(.0,.01,0);
2175 glVertex3f(-1, -1, 0.0f);
2176 glTexCoord2f(texcoordwidth,0);
2177 glVertex3f(1, -1, 0.0f);
2178 glTexCoord2f(texcoordwidth,texcoordheight);
2179 glVertex3f(1, 1, 0.0f);
2180 glTexCoord2f(0,texcoordheight);
2181 glVertex3f(-1, 1, 0.0f);
2185 glTranslatef(0,-.01,0);
2188 glVertex3f(-1, -1, 0.0f);
2189 glTexCoord2f(texcoordwidth,0);
2190 glVertex3f(1, -1, 0.0f);
2191 glTexCoord2f(texcoordwidth,texcoordheight);
2192 glVertex3f(1, 1, 0.0f);
2193 glTexCoord2f(0,texcoordheight);
2194 glVertex3f(-1, 1, 0.0f);
2198 if(drawmode==radialzoommode){
2200 //glRotatef((float)i*.1,0,0,1);
2201 glColor4f(1,1,1,1/((float)i+1));
2203 glScalef(1+(float)i*.01,1+(float)i*.01,1);
2206 glVertex3f(-1, -1, 0.0f);
2207 glTexCoord2f(texcoordwidth,0);
2208 glVertex3f(1, -1, 0.0f);
2209 glTexCoord2f(texcoordwidth,texcoordheight);
2210 glVertex3f(1, 1, 0.0f);
2211 glTexCoord2f(0,texcoordheight);
2212 glVertex3f(-1, 1, 0.0f);
2217 glDisable(GL_TEXTURE_2D);
2218 glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
2219 glPopMatrix(); // Restore The Old Projection Matrix
2220 glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
2221 glPopMatrix(); // Restore The Old Projection Matrix
2222 glEnable(GL_DEPTH_TEST); // Enables Depth Testing
2223 glEnable(GL_CULL_FACE);
2224 glDisable(GL_BLEND);
2229 glEnable(GL_TEXTURE_2D);
2234 if(consoleselected>=60)offset=consoleselected-60;
2235 sprintf (string, " ]");
2236 text.glPrint(10,30,string,0,1,1024,768);
2238 sprintf (string, "_");
2239 text.glPrint(30+(float)(consoleselected)*10-offset*10,30,string,0,1,1024,768);
2242 for(j=0;j<consolechars[i];j++){
2243 glColor4f(1,1,1,1-(float)(i)/16);
2244 if(j<consolechars[i]){
2245 sprintf (string, "%c",consoletext[i][j]);
2246 text.glPrint(30+j*10-offset*10,30+i*20,string,0,1,1024,768);
2254 if(freeze||winfreeze||(mainmenu&&gameon)||(!gameon&&gamestarted)||(mainmenu&&gameon)||(!gameon&&gamestarted)||(!gameon&&gamestarted)){
2255 multiplier=tempmult;
2260 // !!! FIXME: hack: clamp framerate in menu so text input works correctly on fast systems.
2263 glDrawBuffer(GL_BACK);
2264 glReadBuffer(GL_BACK);
2265 glTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE );
2266 ReSizeGLScene(90,.1f);
2269 temptexdetail=texdetail;
2270 if(texdetail>2)texdetail=2;
2271 if(mainmenu!=oldmainmenu&&oldmainmenu!=0){
2273 LoadTexture(":Data:Textures:Newgame.png",&Mainmenuitems[1],0,0);
2274 LoadTexture(":Data:Textures:Quit.png",&Mainmenuitems[3],0,0);
2275 /*if(oldmainmenu==1||oldmainmenu==0){
2276 LoadTexture(":Data:Textures:World.png",&Mainmenuitems[7],0,0);
2277 LoadTexture(":Data:Textures:Options.png",&Mainmenuitems[2],0,0);
2278 LoadTexture(":Data:Textures:Lugaru.png",&Mainmenuitems[0],0,0);
2283 LoadTexture(":Data:Textures:Resume.png",&Mainmenuitems[1],0,0);
2284 LoadTexture(":Data:Textures:Endgame.png",&Mainmenuitems[3],0,0);
2285 /*if(oldmainmenu==2||oldmainmenu==0){
2286 LoadTexture(":Data:Textures:World.png",&Mainmenuitems[7],0,0);
2287 LoadTexture(":Data:Textures:Options.png",&Mainmenuitems[2],0,0);
2288 LoadTexture(":Data:Textures:Lugaru.png",&Mainmenuitems[0],0,0);
2293 if(lastcheck>.5||oldmainmenu!=mainmenu){
2295 ifstream ipstream(ConvertFileName(":Data:Campaigns:main.txt"));
2296 //campaignnumlevels=0;
2297 //accountcampaignchoicesmade[accountactive]=0;
2298 ipstream.ignore(256,':');
2299 ipstream >> campaignnumlevels;
2300 for(i=0;i<campaignnumlevels;i++){
2301 ipstream.ignore(256,':');
2302 ipstream.ignore(256,':');
2303 ipstream.ignore(256,' ');
2304 ipstream >> campaignmapname[i];
2305 ipstream.ignore(256,':');
2306 ipstream >> campaigndescription[i];
2308 if(campaigndescription[i][j]=='_')campaigndescription[i][j]=' ';
2310 ipstream.ignore(256,':');
2311 ipstream >> campaignchoosenext[i];
2312 ipstream.ignore(256,':');
2313 ipstream >> campaignnumnext[i];
2314 if(campaignnumnext[i])
2315 for(j=0;j<campaignnumnext[i];j++){
2316 ipstream.ignore(256,':');
2317 ipstream >> campaignnextlevel[i][j];
2318 campaignnextlevel[i][j]-=1;
2320 ipstream.ignore(256,':');
2321 ipstream >> campaignlocationx[i];
2322 //campaignlocationx[i]-=30;
2323 ipstream.ignore(256,':');
2324 ipstream >> campaignlocationy[i];
2325 //campaignlocationy[i]+=30;
2329 for(i=0;i<campaignnumlevels;i++){
2331 levelhighlight[i]=0;
2336 if(accountcampaignchoicesmade[accountactive])
2337 for(i=0;i<accountcampaignchoicesmade[accountactive];i++){
2338 levelorder[i+1]=campaignnextlevel[levelorder[i]][accountcampaignchoices[accountactive][i]];
2339 levelvisible[levelorder[i+1]]=1;
2341 int whichlevelstart;
2342 whichlevelstart=accountcampaignchoicesmade[accountactive]-1;
2343 if(whichlevelstart<0){
2344 accountcampaignscore[accountactive]=0;
2345 accountcampaignfasttime[accountactive]=0;
2346 campaignchoicenum=1;
2347 campaignchoicewhich[0]=0;
2351 campaignchoicenum=campaignnumnext[levelorder[whichlevelstart]];
2352 if(campaignchoicenum==0){
2353 if(accountcampaignscore[accountactive]>accountcampaignhighscore[accountactive])accountcampaignhighscore[accountactive]=accountcampaignscore[accountactive];
2354 if(accountcampaignfasttime[accountactive]==0||accountcampaigntime[accountactive]<accountcampaignfasttime[accountactive])accountcampaignfasttime[accountactive]=accountcampaigntime[accountactive];
2356 if(campaignchoicenum)
2357 for(i=0;i<campaignchoicenum;i++){
2358 campaignchoicewhich[i]=campaignnextlevel[levelorder[whichlevelstart]][i];
2359 levelvisible[campaignnextlevel[levelorder[whichlevelstart]][i]]=1;
2360 levelhighlight[campaignnextlevel[levelorder[whichlevelstart]][i]]=1;
2373 texdetail=temptexdetail;
2375 /*if(mainmenu!=0)*/oldmainmenu=mainmenu;
2377 if(mainmenu==3||mainmenu==4||mainmenu==5||mainmenu==6||mainmenu==7||mainmenu==8||mainmenu==9||mainmenu==10||mainmenu==119||mainmenu==13||mainmenu==17){
2378 glClear(GL_DEPTH_BUFFER_BIT);
2379 glEnable(GL_ALPHA_TEST);
2380 glAlphaFunc(GL_GREATER, 0.001f);
2381 glEnable(GL_TEXTURE_2D);
2382 glDisable(GL_DEPTH_TEST); // Disables Depth Testing
2383 glDisable(GL_CULL_FACE);
2384 glDisable(GL_LIGHTING);
2386 glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
2387 glPushMatrix(); // Store The Projection Matrix
2388 glLoadIdentity(); // Reset The Projection Matrix
2389 glOrtho(0,screenwidth,0,screenheight,-100,100); // Set Up An Ortho Screen
2390 glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
2391 glPushMatrix(); // Store The Modelview Matrix
2392 glLoadIdentity(); // Reset The Modelview Matrix
2393 glTranslatef(screenwidth/2,screenheight/2,0);
2395 glScalef((float)screenwidth/2,(float)screenheight/2,1);
2396 glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
2397 glDisable(GL_BLEND);
2398 glColor4f(0,0,0,1.0);
2399 glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP );
2400 glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP );
2401 glDisable(GL_TEXTURE_2D);
2403 //glScalef(.25,.25,.25);
2406 glVertex3f(-1, -1, 0.0f);
2408 glVertex3f(1, -1, 0.0f);
2410 glVertex3f(1, 1, 0.0f);
2412 glVertex3f(-1, 1, 0.0f);
2416 glColor4f(0.4,0.4,0.4,1.0);
2417 glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP );
2418 glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP );
2419 glEnable(GL_TEXTURE_2D);
2420 glBindTexture( GL_TEXTURE_2D, Mainmenuitems[4]);
2422 //glScalef(.25,.25,.25);
2425 glVertex3f(-1, -1, 0.0f);
2427 glVertex3f(1, -1, 0.0f);
2429 glVertex3f(1, 1, 0.0f);
2431 glVertex3f(-1, 1, 0.0f);
2436 glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
2438 glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
2442 if((float)newscreenwidth>(float)newscreenheight*1.61||(float)newscreenwidth<(float)newscreenheight*1.59)sprintf (menustring[0], "Resolution: %d*%d",(int)newscreenwidth,(int)newscreenheight);
2443 else sprintf (menustring[0], "Resolution: %d*%d (widescreen)",(int)newscreenwidth,(int)newscreenheight);
2446 endx[0]=startx[0]+strlen(menustring[0])*10;
2447 endy[0]=starty[0]+20;
2451 if(newdetail==2)sprintf (menustring[1], "Detail: High");
2452 else if(newdetail==1)sprintf (menustring[1], "Detail: Medium");
2453 else sprintf (menustring[1], "Detail: Low");
2456 endx[1]=startx[1]+strlen(menustring[1])*10;
2457 endy[1]=starty[1]+20;
2461 if(bloodtoggle==2)sprintf (menustring[2], "Blood: On, high detail (slower)");
2462 if(bloodtoggle==1)sprintf (menustring[2], "Blood: On, low detail");
2463 if(bloodtoggle==0)sprintf (menustring[2], "Blood: Off");
2466 endx[2]=startx[2]+strlen(menustring[2])*10;
2467 endy[2]=starty[2]+20;
2471 if(difficulty==2)sprintf (menustring[3], "Difficulty: Insane");
2472 if(difficulty==1)sprintf (menustring[3], "Difficulty: Difficult");
2473 if(difficulty==0)sprintf (menustring[3], "Difficulty: Easier");
2474 startx[3]=10+20-1000;
2476 endx[3]=startx[3]+strlen(menustring[3])*10;
2477 endy[3]=starty[3]+20;
2481 if(ismotionblur==1)sprintf (menustring[4], "Blur Effects: Enabled (less compatible)");
2482 if(ismotionblur==0)sprintf (menustring[4], "Blur Effects: Disabled (more compatible)");
2485 endx[4]=startx[4]+strlen(menustring[4])*10;
2486 endy[4]=starty[4]+20;
2490 if(decals==1)sprintf (menustring[5], "Decals: Enabled (slower)");
2491 if(decals==0)sprintf (menustring[5], "Decals: Disabled");
2494 endx[5]=startx[5]+strlen(menustring[5])*10;
2495 endy[5]=starty[5]+20;
2499 if(musictoggle==1)sprintf (menustring[6], "Music: Enabled");
2500 if(musictoggle==0)sprintf (menustring[6], "Music: Disabled");
2503 endx[6]=startx[6]+strlen(menustring[6])*10;
2504 endy[6]=starty[6]+20;
2508 if(invertmouse==1)sprintf (menustring[9], "Invert mouse: Yes");
2509 if(invertmouse==0)sprintf (menustring[9], "Invert mouse: No");
2512 endx[9]=startx[9]+strlen(menustring[9])*10;
2513 endy[9]=starty[9]+20;
2517 sprintf (menustring[10], "Mouse Speed: %d", (int)(usermousesensitivity*5));
2520 endx[10]=startx[10]+strlen(menustring[10])*10;
2521 endy[10]=starty[10]+20;
2525 sprintf (menustring[11], "Volume: %d%%", (int)(volume*100));
2528 endx[11]=startx[11]+strlen(menustring[11])*10;
2529 endy[11]=starty[11]+20;
2533 sprintf (menustring[7], "-Configure Controls-");
2536 endx[7]=startx[7]+strlen(menustring[7])*10;
2537 endy[7]=starty[7]+20;
2541 if(newdetail==detail&&newscreenheight==(int)screenheight&&newscreenwidth==(int)screenwidth)sprintf (menustring[8], "Back");
2542 else sprintf (menustring[8], "Back (some changes take effect next time Lugaru is opened)");
2544 endx[8]=startx[8]+strlen(menustring[8])*10;
2546 endy[8]=starty[8]+20;
2553 if(keyselect!=0)sprintf (menustring[0], "Forwards: %s",KeyToChar(forwardkey));
2554 else sprintf (menustring[0], "Forwards: _");
2557 endx[0]=startx[0]+strlen(menustring[0])*10;
2558 endy[0]=starty[0]+20;
2562 if(keyselect!=1)sprintf (menustring[1], "Back: %s",KeyToChar(backkey));
2563 else sprintf (menustring[1], "Back: _");
2566 endx[1]=startx[1]+strlen(menustring[1])*10;
2567 endy[1]=starty[1]+20;
2571 if(keyselect!=2)sprintf (menustring[2], "Left: %s",KeyToChar(leftkey));
2572 else sprintf (menustring[2], "Left: _");
2575 endx[2]=startx[2]+strlen(menustring[2])*10;
2576 endy[2]=starty[2]+20;
2580 if(keyselect!=3)sprintf (menustring[3], "Right: %s",KeyToChar(rightkey));
2581 else sprintf (menustring[3], "Right: _");
2584 endx[3]=startx[3]+strlen(menustring[3])*10;
2585 endy[3]=starty[3]+20;
2589 if(keyselect!=4)sprintf (menustring[4], "Crouch: %s",KeyToChar(crouchkey));
2590 else sprintf (menustring[4], "Crouch: _");
2593 endx[4]=startx[4]+strlen(menustring[4])*10;
2594 endy[4]=starty[4]+20;
2598 if(keyselect!=5)sprintf (menustring[5], "Jump: %s",KeyToChar(jumpkey));
2599 else sprintf (menustring[5], "Jump: _");
2602 endx[5]=startx[5]+strlen(menustring[5])*10;
2603 endy[5]=starty[5]+20;
2607 if(keyselect!=6)sprintf (menustring[6], "Draw: %s",KeyToChar(drawkey));
2608 else sprintf (menustring[6], "Draw: _");
2611 endx[6]=startx[6]+strlen(menustring[6])*10;
2612 endy[6]=starty[6]+20;
2616 if(keyselect!=7)sprintf (menustring[7], "Throw: %s",KeyToChar(throwkey));
2617 else sprintf (menustring[7], "Throw: _");
2620 endx[7]=startx[7]+strlen(menustring[7])*10;
2621 endy[7]=starty[7]+20;
2625 if(keyselect!=8)sprintf (menustring[8], "Attack: %s",KeyToChar(attackkey));
2626 else sprintf (menustring[8], "Attack: _");
2629 endx[8]=startx[8]+strlen(menustring[8])*10;
2630 endy[8]=starty[8]+20;
2636 sprintf (menustring[9], "Back");
2638 endx[9]=startx[9]+strlen(menustring[9])*10;
2640 endy[9]=starty[9]+20;
2645 nummenuitems=7+accountcampaignchoicesmade[accountactive]+campaignchoicenum;
2647 sprintf (menustring[0], "%s",accountname[accountactive]);
2650 endx[0]=startx[0]+strlen(menustring[0])*10;
2651 endy[0]=starty[0]+20;
2655 sprintf (menustring[1], "Tutorial");
2658 endx[1]=startx[1]+strlen(menustring[1])*10;
2659 endy[1]=starty[1]+20;
2663 sprintf (menustring[2], "Challenge");
2666 endx[2]=startx[2]+strlen(menustring[2])*10;
2667 endy[2]=starty[2]+20;
2671 sprintf (menustring[3], "Delete User");
2674 endx[3]=startx[3]+strlen(menustring[3])*10;
2675 endy[3]=starty[3]+20;
2679 sprintf (menustring[4], "Main Menu");
2682 endx[4]=startx[4]+strlen(menustring[4])*10;
2683 endy[4]=starty[4]+20;
2687 sprintf (menustring[5], "Change User");
2689 endx[5]=startx[5]+strlen(menustring[5])*10;
2691 endy[5]=starty[5]+20;
2697 sprintf (menustring[6], "World");
2699 starty[6]=30+480-400-50;
2700 endx[6]=startx[6]+400;
2705 if(accountcampaignchoicesmade[accountactive])
2706 for(i=0;i<accountcampaignchoicesmade[accountactive];i++){
2707 sprintf (menustring[7+i], "%s", campaigndescription[levelorder[i]]);
2708 startx[7+i]=30+120+campaignlocationx[levelorder[i]]*400/512;
2709 starty[7+i]=30+30+(512-campaignlocationy[levelorder[i]])*400/512;
2710 endx[7+i]=startx[7+i]+10;
2711 endy[7+i]=starty[7+i]+10;
2716 if(campaignchoicenum>0)
2717 for(i=accountcampaignchoicesmade[accountactive];i<accountcampaignchoicesmade[accountactive]+campaignchoicenum;i++){
2718 sprintf (menustring[7+i], "%s", campaigndescription[levelorder[i]]);
2719 startx[7+i]=30+120+campaignlocationx[campaignchoicewhich[i-(accountcampaignchoicesmade[accountactive])]]*400/512;
2720 starty[7+i]=30+30+(512-campaignlocationy[campaignchoicewhich[i-(accountcampaignchoicesmade[accountactive])]])*400/512;
2721 endx[7+i]=startx[7+i]+10;
2722 endy[7+i]=starty[7+i]+10;
2727 /*sprintf (menustring[7], "Dot");
2728 startx[7]=120+260*400/512;
2729 starty[7]=30+(512-184)*400/512;
2730 endx[7]=startx[7]+10;
2731 endy[7]=starty[7]+10;
2735 sprintf (menustring[8], "Dot");
2736 startx[8]=120+129*400/512;
2737 starty[8]=30+(512-284)*400/512;
2738 endx[8]=startx[8]+10;
2739 endy[8]=starty[8]+10;
2743 sprintf (menustring[9], "Dot");
2744 startx[9]=120+358*400/512;
2745 starty[9]=30+(512-235)*400/512;
2746 endx[9]=startx[9]+10;
2747 endy[9]=starty[9]+10;
2751 sprintf (menustring[10], "Dot");
2752 startx[10]=120+359*400/512;
2753 starty[10]=30+(512-308)*400/512;
2754 endx[10]=startx[10]+10;
2755 endy[10]=starty[10]+10;
2759 sprintf (menustring[11], "Dot");
2760 startx[11]=120+288*400/512;
2761 starty[11]=30+(512-277)*400/512;
2762 endx[11]=startx[11]+10;
2763 endy[11]=starty[11]+10;
2771 sprintf (menustring[0], "Are you sure you want to delete this user?");
2774 endx[0]=startx[0]+strlen(menustring[0])*10;
2775 endy[0]=starty[0]+20;
2779 sprintf (menustring[1], "Yes");
2782 endx[1]=startx[1]+strlen(menustring[1])*10;
2783 endy[1]=starty[1]+20;
2787 sprintf (menustring[2], "No");
2790 endx[2]=startx[2]+strlen(menustring[2])*10;
2791 endy[2]=starty[2]+20;
2795 sprintf (menustring[3], "Extra 4");
2798 endx[3]=startx[3]+strlen(menustring[3])*10;
2799 endy[3]=starty[3]+20;
2803 sprintf (menustring[4], "Extra 5");
2806 endx[4]=startx[4]+strlen(menustring[4])*10;
2807 endy[4]=starty[4]+20;
2811 sprintf (menustring[5], "Back");
2813 endx[5]=startx[5]+strlen(menustring[5])*10;
2815 endy[5]=starty[5]+20;
2821 nummenuitems=numaccounts+2;
2826 sprintf (menustring[0], "New User");
2828 sprintf (menustring[0], "No More Users");
2831 endx[0]=startx[0]+strlen(menustring[0])*10;
2832 endy[0]=starty[0]+20;
2836 if(entername)startx[0]+=10;
2841 for(i=0;i<numaccounts;i++){
2842 sprintf (menustring[num], "%s",accountname[i]);
2844 starty[num]=360-20-20*num;
2845 endx[num]=startx[num]+strlen(menustring[num])*10;
2846 endy[num]=starty[num]+20;
2853 sprintf (menustring[num], "Back");
2855 endx[num]=startx[num]+strlen(menustring[num])*10;
2857 endy[num]=starty[num]+20;
2864 sprintf (menustring[0], "Easier");
2867 endx[0]=startx[0]+strlen(menustring[0])*10;
2868 endy[0]=starty[0]+20;
2872 sprintf (menustring[1], "Difficult");
2875 endx[1]=startx[1]+strlen(menustring[1])*10;
2876 endy[1]=starty[1]+20;
2880 sprintf (menustring[2], "Insane");
2883 endx[2]=startx[2]+strlen(menustring[2])*10;
2884 endy[2]=starty[2]+20;
2890 //tempncl=numchallengelevels;
2891 //numchallengelevels=9;
2892 nummenuitems=2+numchallengelevels;
2895 for(j=0;j<numchallengelevels;j++){
2896 for(i=0;i<255;i++)menustring[j][i]='\0';
2897 sprintf (temp, "Level %d",j+1);
2898 strcpy(menustring[j],temp);
2899 for(i=0;i<17;i++)if(menustring[j][i]=='\0')menustring[j][i]=' ';
2900 menustring[j][17]='\0';
2901 sprintf (temp, "%d",(int)accounthighscore[accountactive][j]);
2902 strcat(menustring[j],temp);
2903 for(i=18;i<32;i++)if(menustring[j][i]=='\0')menustring[j][i]=' ';
2904 menustring[j][32]='\0';
2905 sprintf (temp, "%d:",(int)(((int)accountfasttime[accountactive][j]-(int)(accountfasttime[accountactive][j])%60)/60));
2906 strcat(menustring[j],temp);
2907 if((int)(accountfasttime[accountactive][j])%60<10)strcat(menustring[j],"0");
2908 sprintf (temp, "%d",(int)(accountfasttime[accountactive][j])%60);
2909 strcat(menustring[j],temp);
2913 endx[j]=startx[j]+strlen(menustring[j])*10;
2914 endy[j]=starty[j]+20;
2919 sprintf (menustring[numchallengelevels], "Back");
2920 startx[numchallengelevels]=10;
2921 endx[numchallengelevels]=startx[numchallengelevels]+strlen(menustring[numchallengelevels])*10;
2922 starty[numchallengelevels]=10;
2923 endy[numchallengelevels]=starty[numchallengelevels]+20;
2924 movex[numchallengelevels]=0;
2925 movey[numchallengelevels]=0;
2927 sprintf (menustring[numchallengelevels+1], " High Score Best Time");
2928 startx[numchallengelevels+1]=10;
2929 starty[numchallengelevels+1]=440;
2930 endx[numchallengelevels+1]=startx[numchallengelevels+1]+strlen(menustring[numchallengelevels+1])*10;
2931 endy[numchallengelevels+1]=starty[numchallengelevels+1]+20;
2932 movex[numchallengelevels+1]=0;
2933 movey[numchallengelevels+1]=0;
2935 //numchallengelevels=tempncl;
2939 nummenuitems=2+numchallengelevels;
2942 for(j=0;j<numchallengelevels;j++){
2943 for(i=0;i<255;i++)menustring[j][i]='\0';
2944 sprintf (temp, "Level %d",j+1);
2945 strcpy(menustring[j],temp);
2946 for(i=0;i<17;i++)if(menustring[j][i]=='\0')menustring[j][i]=' ';
2947 menustring[j][17]='\0';
2948 sprintf (temp, "%d",(int)accounthighscore[accountactive][j]);
2949 strcat(menustring[j],temp);
2950 for(i=18;i<32;i++)if(menustring[j][i]=='\0')menustring[j][i]=' ';
2951 menustring[j][32]='\0';
2952 sprintf (temp, "%d:",(int)(((int)accountfasttime[accountactive][j]-(int)(accountfasttime[accountactive][j])%60)/60));
2953 strcat(menustring[j],temp);
2954 if((int)(accountfasttime[accountactive][j])%60<10)strcat(menustring[j],"0");
2955 sprintf (temp, "%d",(int)(accountfasttime[accountactive][j])%60);
2956 strcat(menustring[j],temp);
2960 endx[j]=startx[j]+strlen(menustring[j])*10;
2961 endy[j]=starty[j]+20;
2966 sprintf (menustring[numchallengelevels], "Back");
2967 startx[numchallengelevels]=10;
2968 endx[numchallengelevels]=startx[numchallengelevels]+strlen(menustring[numchallengelevels])*10;
2969 starty[numchallengelevels]=10;
2970 endy[numchallengelevels]=starty[numchallengelevels]+20;
2971 movex[numchallengelevels]=0;
2972 movey[numchallengelevels]=0;
2974 sprintf (menustring[numchallengelevels+1], " High Score Best Time");
2975 startx[numchallengelevels+1]=10;
2976 starty[numchallengelevels+1]=400;
2977 endx[numchallengelevels+1]=startx[numchallengelevels+1]+strlen(menustring[numchallengelevels+1])*10;
2978 endy[numchallengelevels+1]=starty[numchallengelevels+1]+20;
2979 movex[numchallengelevels+1]=0;
2980 movey[numchallengelevels+1]=0;
2987 sprintf (menustring[0], "Congratulations!");
2990 endx[0]=startx[0]+strlen(menustring[0])*10;
2991 endy[0]=starty[0]+20;
2995 sprintf (menustring[1], "You have avenged your family and");
2998 endx[1]=startx[1]+strlen(menustring[1])*10;
2999 endy[1]=starty[1]+20;
3003 sprintf (menustring[2], "restored peace to the island of Lugaru.");
3006 endx[2]=startx[2]+strlen(menustring[2])*10;
3007 endy[2]=starty[2]+20;
3011 sprintf (menustring[3], "Back");
3013 endx[3]=startx[3]+strlen(menustring[3])*10;
3015 endy[3]=starty[3]+20;
3019 for(i=0;i<255;i++)menustring[4][i]='\0';
3020 sprintf (temp, "Your score:");
3021 strcpy(menustring[4],temp);
3022 for(i=0;i<20;i++)if(menustring[4][i]=='\0')menustring[4][i]=' ';
3023 menustring[4][20]='\0';
3024 sprintf (temp, "%d",(int)accountcampaignscore[accountactive]);
3025 strcat(menustring[4],temp);
3027 endx[4]=startx[4]+strlen(menustring[4])*10;
3029 endy[4]=starty[4]+20;
3033 for(i=0;i<255;i++)menustring[5][i]='\0';
3034 sprintf (temp, "Your time:");
3035 strcpy(menustring[5],temp);
3036 for(i=0;i<20;i++)if(menustring[5][i]=='\0')menustring[5][i]=' ';
3037 menustring[5][20]='\0';
3038 sprintf (temp, "%d",(int)accountcampaigntime[accountactive]);
3039 strcat(menustring[5],temp);
3041 endx[5]=startx[5]+strlen(menustring[5])*10;
3043 endy[5]=starty[5]+20;
3047 for(i=0;i<255;i++)menustring[5][i]='\0';
3048 sprintf (temp, "Highest score:");
3049 strcpy(menustring[5],temp);
3050 for(i=0;i<20;i++)if(menustring[5][i]=='\0')menustring[5][i]=' ';
3051 menustring[5][20]='\0';
3052 sprintf (temp, "%d",(int)accountcampaignhighscore[accountactive]);
3053 strcat(menustring[5],temp);
3055 endx[5]=startx[5]+strlen(menustring[5])*10;
3057 endy[5]=starty[5]+20;
3061 for(i=0;i<255;i++)menustring[7][i]='\0';
3062 sprintf (temp, "Lowest time:");
3063 strcpy(menustring[7],temp);
3064 for(i=0;i<20;i++)if(menustring[7][i]=='\0')menustring[7][i]=' ';
3065 menustring[7][20]='\0';
3066 sprintf (temp, "%d",(int)accountcampaignfasttime[accountactive]);
3067 strcat(menustring[7],temp);
3069 endx[7]=startx[7]+strlen(menustring[7])*10;
3071 endy[7]=starty[7]+20;
3081 sprintf (menustring[0], "Please enter your name:");
3084 endx[0]=startx[0]+strlen(menustring[0])*10;
3085 endy[0]=starty[0]+20;
3089 sprintf (menustring[1], "Please enter your name:");
3092 endx[1]=startx[1]+strlen(menustring[1])*10;
3093 endy[1]=starty[1]+20;
3097 if(mainmenu==1||mainmenu==2){
3107 starty[1]=480-152-32;
3114 starty[2]=480-228-32;
3122 starty[3]=480-306-32;
3131 starty[3]=480-306-32;
3145 starty[4]=480-140-256;
3152 starty[5]=480-138-256;
3159 starty[6]=480-144-256;
3167 starty[4]=480-140-256;
3174 starty[5]=480-138-256;
3181 starty[6]=480-144-256;
3189 starty[4]=480-140-256;
3196 starty[5]=480-150-256;
3203 starty[6]=480-144-256;
3211 starty[4]=480-140-256;
3218 starty[5]=480-150-256;
3225 starty[6]=480-144-256;
3233 starty[4]=480-100-256;
3240 starty[5]=480-120-256;
3247 starty[6]=480-144-256;
3257 if(mainmenu==1||mainmenu==2)
3259 if((mousecoordh/screenwidth*640)>startx[i]&&(mousecoordh/screenwidth*640)<endx[i]&&480-(mousecoordv/screenheight*480)>starty[i]&&480-(mousecoordv/screenheight*480)<endy[i]){
3264 if(mainmenu==3||mainmenu==4||mainmenu==5||mainmenu==6||mainmenu==7||mainmenu==8||mainmenu==9||mainmenu==10||mainmenu==11||mainmenu==13||mainmenu==17)
3265 for(i=0;i<nummenuitems;i++){
3266 if((mousecoordh/screenwidth*640)>startx[i]&&(mousecoordh/screenwidth*640)<endx[i]&&480-(mousecoordv/screenheight*480)>starty[i]&&480-(mousecoordv/screenheight*480)<endy[i]){
3267 if(mainmenu!=5)selected=i;
3268 if(mainmenu==5&&(i!=0&&i!=6))selected=i;
3269 if(mainmenu==9&&(i!=numchallengelevels+1))selected=i;
3270 if(mainmenu==11&&(i!=numchallengelevels+1))selected=i;
3275 for(i=0;i<nummenuitems;i++){
3276 if(selected==i)selectedlong[i]+=multiplier*5;
3277 if(selectedlong[i]>1)selectedlong[i]=1;
3278 if(selected!=i)selectedlong[i]-=multiplier*5;
3279 if(selectedlong[i]<0)selectedlong[i]=0;
3280 //if(i>=4)selectedlong[i]=.3;
3281 if(i>=4&&(mainmenu==1||mainmenu==2))selectedlong[i]=0;
3285 for(i=0;i<nummenuitems;i++){
3286 offsetx[i]=(startx[i]+endx[i])/2-(mousecoordh/screenwidth*640);
3287 offsety[i]=(starty[i]+endy[i])/2-(480-(mousecoordv/screenheight*480));
3292 if(i>=4&&(mainmenu==1||mainmenu==2)){
3293 offsetx[i]=(startx[i]+endx[i]+movex[i]*transition)/2-(640+190)/2;
3294 offsety[i]=(starty[i]+endy[i]+movey[i]*transition)/2-(336+150)/2;
3300 if(mainmenu==1||mainmenu==2){
3301 glClear(GL_DEPTH_BUFFER_BIT);
3302 glEnable(GL_ALPHA_TEST);
3303 glAlphaFunc(GL_GREATER, 0.001f);
3304 glEnable(GL_TEXTURE_2D);
3305 glDisable(GL_DEPTH_TEST); // Disables Depth Testing
3306 glDisable(GL_CULL_FACE);
3307 glDisable(GL_LIGHTING);
3309 glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
3310 glPushMatrix(); // Store The Projection Matrix
3311 glLoadIdentity(); // Reset The Projection Matrix
3312 glOrtho(0,screenwidth,0,screenheight,-100,100); // Set Up An Ortho Screen
3313 glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
3314 glPushMatrix(); // Store The Modelview Matrix
3315 glLoadIdentity(); // Reset The Modelview Matrix
3316 glTranslatef(screenwidth/2,screenheight/2,0);
3318 glScalef((float)screenwidth/2,(float)screenheight/2,1);
3319 glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
3320 glDisable(GL_BLEND);
3321 glColor4f(0,0,0,1.0);
3322 glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP );
3323 glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP );
3324 glDisable(GL_TEXTURE_2D);
3326 //glScalef(.25,.25,.25);
3329 glVertex3f(-1, -1, 0.0f);
3331 glVertex3f(1, -1, 0.0f);
3333 glVertex3f(1, 1, 0.0f);
3335 glVertex3f(-1, 1, 0.0f);
3339 glColor4f(0.4,0.4,0.4,1.0);
3340 glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP );
3341 glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP );
3342 glEnable(GL_TEXTURE_2D);
3343 glBindTexture( GL_TEXTURE_2D, Mainmenuitems[4]);
3345 //glScalef(.25,.25,.25);
3348 glVertex3f(-1, -1, 0.0f);
3350 glVertex3f(1, -1, 0.0f);
3352 glVertex3f(1, 1, 0.0f);
3354 glVertex3f(-1, 1, 0.0f);
3359 glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
3362 glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
3363 glPushMatrix(); // Store The Projection Matrix
3364 glLoadIdentity(); // Reset The Projection Matrix
3365 glOrtho(0,640,0,480,-100,100); // Set Up An Ortho Screen
3366 glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
3367 glPushMatrix(); // Store The Modelview Matrix
3368 glLoadIdentity(); // Reset The Modelview Matrix
3370 glDisable(GL_TEXTURE_2D);
3375 if(anim!=1)glVertex3f(190, 150, 0.0f);
3376 if(anim==1)glVertex3f(190+movex[4]*transition, 150, 0.0f);
3378 glVertex3f(640, 150, 0.0f);
3380 glVertex3f(640, 336, 0.0f);
3382 if(anim!=1)glVertex3f(190, 336, 0.0f);
3383 if(anim==1)glVertex3f(190+movex[4]*transition, 336, 0.0f);
3388 glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
3390 glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
3394 glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
3395 glPushMatrix(); // Store The Projection Matrix
3396 glLoadIdentity(); // Reset The Projection Matrix
3397 glOrtho(0,640,0,480,-100,100); // Set Up An Ortho Screen
3398 glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
3399 glPushMatrix(); // Store The Modelview Matrix
3400 glLoadIdentity(); // Reset The Modelview Matrix
3401 glEnable(GL_TEXTURE_2D);
3404 for(j=0;j<nummenuitems;j++)
3406 if(j<=3||(mainmenu!=1&&mainmenu!=2))
3408 //glDisable(GL_BLEND);
3409 glEnable(GL_ALPHA_TEST);
3411 //glDisable(GL_ALPHA_TEST);
3412 glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
3413 if(mainmenu==1||mainmenu==2)
3416 glBlendFunc(GL_SRC_ALPHA,GL_ONE);
3417 glBindTexture( GL_TEXTURE_2D, Mainmenuitems[j]);
3418 glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE );
3419 glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE );
3420 glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
3424 glVertex3f(startx[j]+movex[j]*transition, starty[j]+movey[j]*transition, 0.0f);
3426 glVertex3f(endx[j]+movex[j]*transition, starty[j]+movey[j]*transition, 0.0f);
3428 glVertex3f(endx[j]+movex[j]*transition, endy[j]+movey[j]*transition, 0.0f);
3430 glVertex3f(startx[j]+movex[j]*transition, endy[j]+movey[j]*transition, 0.0f);
3434 //glDisable(GL_ALPHA_TEST);
3435 if(j<4)glBlendFunc(GL_SRC_ALPHA,GL_ONE);
3438 if(1-((float)i)/10-(1-selectedlong[j])>0)
3440 glColor4f(1,1,1,(1-((float)i)/10-(1-selectedlong[j]))*.25);
3441 glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
3445 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);
3447 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);
3449 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);
3451 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);
3457 if(mainmenu==3||mainmenu==4||mainmenu==5||mainmenu==6||mainmenu==7||mainmenu==8||mainmenu==9||mainmenu==10||mainmenu==11||mainmenu==13||mainmenu==17)
3459 if(mainmenu!=5||j<6)
3462 if(mainmenu==9&&j>accountprogress[accountactive]&&j<numchallengelevels)glColor4f(0.5,0,0,1);
3463 if(mainmenu==11&&j>accountprogress[accountactive]&&j<numchallengelevels)glColor4f(0.5,0,0,1);
3464 //if(1-((float)i)/10-(1-selectedlong[j])>0){
3465 glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
3467 if(mainmenu!=7||j!=0||!entername)text.glPrint(startx[j],starty[j],menustring[j],0,1,640,480);
3471 sprintf (string, "_");
3472 text.glPrint(startx[j]+(float)(displayselected)*10,starty[j],string,0,1,640,480);
3475 for(l=0;l<displaychars[k];l++){
3476 if(l<displaychars[k]){
3477 sprintf (string, "%c",displaytext[k][l]);
3478 text.glPrint(startx[j]+l*10,starty[j],string,0,1,640,480);
3486 sprintf (string, "Hooo!");
3487 text.glPrint(startx[0],starty[0],string,0,1,640,480);
3491 glBlendFunc(GL_SRC_ALPHA,GL_ONE);
3494 if(1-((float)i)/15-(1-selectedlong[j])>0)
3496 glColor4f(1,0,0,(1-((float)i)/10-(1-selectedlong[j]))*.25);
3497 if(mainmenu==9&&j>accountprogress[accountactive]&&j<numchallengelevels)glColor4f(0.5,0,0,(1-((float)i)/10-(1-selectedlong[j]))*.25);
3498 if(mainmenu==11&&j>accountprogress[accountactive]&&j<numchallengelevels)glColor4f(0.5,0,0,(1-((float)i)/10-(1-selectedlong[j]))*.25);
3499 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);
3500 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);
3501 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);
3502 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);
3503 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);
3504 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);
3505 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);
3506 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);
3507 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);
3508 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);
3509 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);
3512 sprintf (string, "_");
3513 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);
3516 for(l=0;l<displaychars[k];l++){
3517 if(l<displaychars[k]){
3518 sprintf (string, "%c",displaytext[k][l]);
3519 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);
3528 glClear(GL_DEPTH_BUFFER_BIT);
3529 glEnable(GL_ALPHA_TEST);
3530 glAlphaFunc(GL_GREATER, 0.001f);
3531 glEnable(GL_TEXTURE_2D);
3532 glDisable(GL_DEPTH_TEST); // Disables Depth Testing
3533 glDisable(GL_CULL_FACE);
3534 glDisable(GL_LIGHTING);
3535 if(j==6)glColor4f(1,1,1,1);
3536 else glColor4f(1,0,0,1);
3538 glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
3539 glPushMatrix(); // Store The Projection Matrix
3540 glLoadIdentity(); // Reset The Projection Matrix
3541 glOrtho(0,640,0,480,-100,100); // Set Up An Ortho Screen
3542 glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
3543 glPushMatrix(); // Store The Modelview Matrix
3544 glLoadIdentity(); // Reset The Modelview Matrix
3547 //Draw world, draw map
3548 glTranslatef(2,-5,0);
3550 if(j>6&&j<nummenuitems-1)
3552 XYZ linestart,lineend,offset;
3559 //float linestartx,lineendx,linestarty,lineendy,offsetx,offsety;
3560 linestart.x=(startx[j]+endx[j])/2;
3561 linestart.y=(starty[j]+endy[j])/2;
3562 if(j>=6+accountcampaignchoicesmade[accountactive]){
3563 linestart.x=(startx[6+accountcampaignchoicesmade[accountactive]]+endx[6+accountcampaignchoicesmade[accountactive]])/2;
3564 linestart.y=(starty[6+accountcampaignchoicesmade[accountactive]]+endy[6+accountcampaignchoicesmade[accountactive]])/2;
3566 lineend.x=(startx[j+1]+endx[j+1])/2;
3567 lineend.y=(starty[j+1]+endy[j+1])/2;
3568 offset=lineend-linestart;
3571 offset=DoRotation(offset,0,0,90);
3573 glDisable(GL_TEXTURE_2D);
3575 if(j<6+accountcampaignchoicesmade[accountactive]){
3576 glColor4f(0.5,0,0,1);
3580 if(j>=6+accountcampaignchoicesmade[accountactive]){
3586 linestart+=fac*4*startsize;
3587 lineend-=fac*4*endsize;
3589 if(!(j>7+accountcampaignchoicesmade[accountactive]+campaignchoicenum)){
3590 glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
3594 glVertex3f(linestart.x-offset.x*startsize, linestart.y-offset.y*startsize, 0.0f);
3596 glVertex3f(linestart.x+offset.x*startsize, linestart.y+offset.y*startsize, 0.0f);
3598 glVertex3f(lineend.x+offset.x*endsize, lineend.y+offset.y*endsize, 0.0f);
3600 glVertex3f(lineend.x-offset.x*endsize, lineend.y-offset.y*endsize, 0.0f);
3604 glEnable(GL_TEXTURE_2D);
3608 if(j==6)glBindTexture( GL_TEXTURE_2D, Mainmenuitems[7]);
3609 else glBindTexture( GL_TEXTURE_2D, Mapcircletexture);
3610 glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE );
3611 glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE );
3612 if(j-7<accountcampaignchoicesmade[accountactive])glColor4f(0.5,0,0,1);
3613 if(j-7>=accountcampaignchoicesmade[accountactive])glColor4f(1,0,0,1);
3614 if(j==6)glColor4f(1,1,1,1);
3617 itemsize=abs(startx[j]-endx[j])/2;
3619 midpoint.x=(startx[j]+endx[j])/2;
3620 midpoint.y=(starty[j]+endy[j])/2;
3621 if(j>6&&(j-7<accountcampaignchoicesmade[accountactive]))itemsize*=.5;
3622 if(!(j-7>accountcampaignchoicesmade[accountactive]+campaignchoicenum))
3624 glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
3628 glVertex3f(midpoint.x-itemsize+movex[j]*transition, midpoint.y-itemsize+movey[j]*transition, 0.0f);
3630 glVertex3f(midpoint.x+itemsize+movex[j]*transition, midpoint.y-itemsize+movey[j]*transition, 0.0f);
3632 glVertex3f(midpoint.x+itemsize+movex[j]*transition, midpoint.y+itemsize+movey[j]*transition, 0.0f);
3634 glVertex3f(midpoint.x-itemsize+movex[j]*transition, midpoint.y+itemsize+movey[j]*transition, 0.0f);
3638 //glDisable(GL_ALPHA_TEST);
3639 if(j<4)glBlendFunc(GL_SRC_ALPHA,GL_ONE);
3642 if(1-((float)i)/10-(1-selectedlong[j])>0)
3644 glColor4f(1,0,0,(1-((float)i)/10-(1-selectedlong[j]))*.25);
3645 glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
3649 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);
3651 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);
3653 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);
3655 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);
3663 glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
3665 glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
3667 if(j-7>=accountcampaignchoicesmade[accountactive]){
3668 //glColor4f(0,0,0,1);
3669 //text.glPrintOutline(startx[j]+10-1.5,starty[j]-4-1.5,menustring[j],0,0.6*1.25,640,480);
3670 //glColor4f(1,0,0,1);
3671 //text.glPrint(startx[j]+10,starty[j]-4,menustring[j],0,0.6,640,480);
3672 text.glPrintOutlined(0.9,0,0,startx[j]+10,starty[j]-4,menustring[j],0,0.6,640,480);
3673 glDisable(GL_DEPTH_TEST);
3680 glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
3682 glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
3685 if(mainmenu==1||mainmenu==2)
3686 if(transition<.1||transition>.9){
3687 glClear(GL_DEPTH_BUFFER_BIT);
3688 glEnable(GL_ALPHA_TEST);
3689 glAlphaFunc(GL_GREATER, 0.001f);
3690 glEnable(GL_TEXTURE_2D);
3691 glDisable(GL_DEPTH_TEST); // Disables Depth Testing
3692 glDisable(GL_CULL_FACE);
3693 glDisable(GL_LIGHTING);
3695 glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
3696 glPushMatrix(); // Store The Projection Matrix
3697 glLoadIdentity(); // Reset The Projection Matrix
3698 glOrtho(0,640,0,480,-100,100); // Set Up An Ortho Screen
3699 glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
3700 glPushMatrix(); // Store The Modelview Matrix
3701 glLoadIdentity(); // Reset The Modelview Matrix
3703 glDisable(GL_TEXTURE_2D);
3704 if(transition<.1)glColor4f(1,0,0,1-(transition*10));
3705 if(transition>.9)glColor4f(1,0,0,1-((1-transition)*10));
3709 glVertex3f(190, 150, 0.0f);
3711 glVertex3f(640, 150, 0.0f);
3713 glVertex3f(640, 336, 0.0f);
3715 glVertex3f(190, 336, 0.0f);
3720 glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
3724 glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
3725 glPushMatrix(); // Store The Projection Matrix
3726 glLoadIdentity(); // Reset The Projection Matrix
3727 glOrtho(0,screenwidth,0,screenheight,-100,100); // Set Up An Ortho Screen
3728 glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
3729 glPushMatrix(); // Store The Modelview Matrix
3730 glLoadIdentity(); // Reset The Modelview Matrix
3731 glTranslatef(screenwidth/2,screenheight/2,0);
3733 glScalef((float)screenwidth/2,(float)screenheight/2,1);
3734 glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
3736 glEnable(GL_TEXTURE_2D);
3738 glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP );
3739 glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP );
3742 glTranslatef(mousecoordh-screenwidth/2,mousecoordv*-1+screenheight/2,0);
3743 glScalef((float)screenwidth/64,(float)screenwidth/64,1);
3744 glTranslatef(1,-1,0);
3745 glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
3747 glBindTexture( GL_TEXTURE_2D, cursortexture);
3749 //glScalef(.25,.25,.25);
3752 glVertex3f(-1, -1, 0.0f);
3754 glVertex3f(1, -1, 0.0f);
3756 glVertex3f(1, 1, 0.0f);
3758 glVertex3f(-1, 1, 0.0f);
3763 glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
3769 if(flashamount>1)flashamount=1;
3770 if(flashdelay<=0)flashamount-=multiplier;
3772 if(flashamount<0)flashamount=0;
3773 glDisable(GL_DEPTH_TEST); // Disables Depth Testing
3774 glDisable(GL_CULL_FACE);
3775 glDisable(GL_LIGHTING);
3776 glDisable(GL_TEXTURE_2D);
3778 glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
3779 glPushMatrix(); // Store The Projection Matrix
3780 glLoadIdentity(); // Reset The Projection Matrix
3781 glOrtho(0,screenwidth,0,screenheight,-100,100); // Set Up An Ortho Screen
3782 glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
3783 glPushMatrix(); // Store The Modelview Matrix
3784 glLoadIdentity(); // Reset The Modelview Matrix
3785 glScalef(screenwidth,screenheight,1);
3786 glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
3788 glColor4f(flashr,flashg,flashb,flashamount);
3790 glVertex3f(0, 0, 0.0f);
3791 glVertex3f(256, 0, 0.0f);
3792 glVertex3f(256, 256, 0.0f);
3793 glVertex3f(0, 256, 0.0f);
3795 glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
3796 glPopMatrix(); // Restore The Old Projection Matrix
3797 glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
3798 glPopMatrix(); // Restore The Old Projection Matrix
3799 glEnable(GL_DEPTH_TEST); // Enables Depth Testing
3800 glEnable(GL_CULL_FACE);
3801 glDisable(GL_BLEND);
3806 if(freeze||winfreeze||(mainmenu&&gameon)||(!gameon&&gamestarted)||(!gameon&&gamestarted)){
3807 tempmult=multiplier;
3813 if ( side == stereoRight || side == stereoCenter ) {
3814 if(drawmode!=motionblurmode||mainmenu){
3819 //myassert(glGetError() == GL_NO_ERROR);
3820 glDrawBuffer(GL_BACK);
3821 glReadBuffer(GL_BACK);
3826 if(drawtoggle==2)drawtoggle=0;
3828 if(freeze||winfreeze||(mainmenu&&gameon)||(!gameon&&gamestarted)){
3829 multiplier=tempmult;
3831 //Jordan fixed your warning!