- }
-
- if(drawmode==glowmode){
- glDisable(GL_DEPTH_TEST); // Disables Depth Testing
- glDisable(GL_CULL_FACE);
- glDisable(GL_LIGHTING);
- glDisable(GL_TEXTURE_2D);
- glDepthMask(0);
- glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
- glPushMatrix(); // Store The Projection Matrix
- glLoadIdentity(); // Reset The Projection Matrix
- glOrtho(0,screenwidth,0,screenheight,-100,100); // Set Up An Ortho Screen
- glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
- glPushMatrix(); // Store The Modelview Matrix
- glLoadIdentity(); // Reset The Modelview Matrix
- glScalef(screenwidth,screenheight,1);
- glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
- glEnable(GL_BLEND);
- glColor4f(0,0,0,.5);
- glBegin(GL_QUADS);
- glVertex3f(0, 0, 0.0f);
- glVertex3f(256, 0, 0.0f);
- glVertex3f(256, 256, 0.0f);
- glVertex3f(0, 256, 0.0f);
- glEnd();
- glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
- glPopMatrix(); // Restore The Old Projection Matrix
- glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
- glPopMatrix(); // Restore The Old Projection Matrix
- glEnable(GL_DEPTH_TEST); // Enables Depth Testing
- glEnable(GL_CULL_FACE);
- glDisable(GL_BLEND);
- glDepthMask(1);
- }
-
- if((((blackout&&damageeffects)||(player[0].bloodloss>0&&damageeffects&&player[0].blooddimamount>0)||player[0].dead)&&!cameramode)||console){
- glDisable(GL_DEPTH_TEST); // Disables Depth Testing
- glDisable(GL_CULL_FACE);
- glDisable(GL_LIGHTING);
- glDisable(GL_TEXTURE_2D);
- glDepthMask(0);
- glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
- glPushMatrix(); // Store The Projection Matrix
- glLoadIdentity(); // Reset The Projection Matrix
- glOrtho(0,screenwidth,0,screenheight,-100,100); // Set Up An Ortho Screen
- glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
- glPushMatrix(); // Store The Modelview Matrix
- glLoadIdentity(); // Reset The Modelview Matrix
- glScalef(screenwidth,screenheight,1);
- glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
- glEnable(GL_BLEND);
- if(player[0].dead)blackout+=multiplier*3;
- if(player[0].dead==1)blackout=.4f;
- if(player[0].dead==2&&blackout>.6)blackout=.6;
- glColor4f(0,0,0,blackout);
- if(!player[0].dead){
- if((player[0].bloodloss/player[0].damagetolerance*(sin(woozy)/4+.5))*.3<.3){
- glColor4f(0,0,0,player[0].blooddimamount*player[0].bloodloss/player[0].damagetolerance*(sin(woozy)/4+.5)*.3);
- blackout=player[0].blooddimamount*player[0].bloodloss/player[0].damagetolerance*(sin(woozy)/4+.5)*.3;
- }
- else {
- glColor4f(0,0,0,player[0].blooddimamount*.3);
- blackout=player[0].blooddimamount*.3;
- }
- }
- if(console)glColor4f(.7,0,0,.2);
- glBegin(GL_QUADS);
- glVertex3f(0, 0, 0.0f);
- glVertex3f(256, 0, 0.0f);
- glVertex3f(256, 256, 0.0f);
- glVertex3f(0, 256, 0.0f);
- glEnd();
- glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
- glPopMatrix(); // Restore The Old Projection Matrix
- glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
- glPopMatrix(); // Restore The Old Projection Matrix
- glEnable(GL_DEPTH_TEST); // Enables Depth Testing
- glEnable(GL_CULL_FACE);
- glDisable(GL_BLEND);
- glDepthMask(1);
- }
-
- if(flashamount>0&&damageeffects) {
- if(flashamount>1)flashamount=1;
- if(flashdelay<=0)flashamount-=multiplier;
- flashdelay--;
- if(flashamount<0)flashamount=0;
- glDisable(GL_DEPTH_TEST); // Disables Depth Testing
- glDisable(GL_CULL_FACE);
- glDisable(GL_LIGHTING);
- glDepthMask(0);
- glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
- glPushMatrix(); // Store The Projection Matrix
- glLoadIdentity(); // Reset The Projection Matrix
- glOrtho(0,screenwidth,0,screenheight,-100,100); // Set Up An Ortho Screen
- glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
- glPushMatrix(); // Store The Modelview Matrix
- glLoadIdentity(); // Reset The Modelview Matrix
- glScalef(screenwidth,screenheight,1);
- glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
- glEnable(GL_BLEND);
- glColor4f(flashr,flashg,flashb,flashamount);
- glBegin(GL_QUADS);
- glVertex3f(0, 0, 0.0f);
- glVertex3f(256, 0, 0.0f);
- glVertex3f(256, 256, 0.0f);
- glVertex3f(0, 256, 0.0f);
- glEnd();
- glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
- glPopMatrix(); // Restore The Old Projection Matrix
- glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
- glPopMatrix(); // Restore The Old Projection Matrix
- glEnable(GL_DEPTH_TEST); // Enables Depth Testing
- glEnable(GL_CULL_FACE);
- glDisable(GL_BLEND);
- glDepthMask(1);
- }
-
- if(!console) {
- displaytime[0]=0;
- glEnable(GL_TEXTURE_2D);
- glColor4f(1,1,1,1);
- if(chatting){
- sprintf (string, " ]");
- text.glPrint(10,30+screenheight-330,string,0,1,screenwidth,screenheight);
- if(displayblink){
- sprintf (string, "_");
- text.glPrint(30+(float)(displayselected)*10,30+(screenheight-330),string,0,1,screenwidth,screenheight);
- }
- }
- for(i=0;i<15;i++)
- if((i!=0||chatting)&&displaytime[i]<4)
- for(j=0;j<displaychars[i];j++) {
- glColor4f(1,1,1,4-displaytime[i]);
- if(j<displaychars[i]) {
- sprintf (string, "%c",displaytext[i][j]);
- text.glPrint(30+j*10,30+i*20+(screenheight-330),string,0,1,screenwidth,screenheight);
- }
- }
- }
-
- if(minimap&&indialogue==-1){
- float mapviewdist = 20000;
-
- glDisable(GL_DEPTH_TEST);
- glColor3f (1.0, 1.0, 1.0); // no coloring
-
- glEnable(GL_TEXTURE_2D);
- glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE );
- glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE );
- glDisable(GL_DEPTH_TEST); // Disables Depth Testing
- glDisable(GL_CULL_FACE);
- glDisable(GL_LIGHTING);
- glDepthMask(0);
- glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
- glPushMatrix(); // Store The Projection Matrix
- glLoadIdentity(); // Reset The Projection Matrix
- glOrtho(0,screenwidth,0,screenheight,-100,100); // Set Up An Ortho Screen
- glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
- glPushMatrix(); // Store The Modelview Matrix
- glLoadIdentity(); // Reset The Modelview Matrix
- glScalef((float)screenwidth/2,(float)screenwidth/2,1);
- glTranslatef(1.75,.25,0);
- glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
- glEnable(GL_BLEND);
- glColor4f(1,1,1,1);
- glPushMatrix();
- float opac = .7;
- XYZ center;
- float radius;
- float distcheck;
- int numliveplayers=0;
- center = 0;
- for(i=0;i<numplayers;i++){
- if(!player[i].dead) numliveplayers++;
- }
-
- int numadd = 0;
-
- for(i=0;i<objects.numobjects;i++){
- if(objects.type[i]==treetrunktype||objects.type[i]==boxtype){
- center+=objects.position[i];
- numadd++;
- }
- }
- for(i=0;i<numplayers;i++){
- if(!player[i].dead)center+=player[i].coords;
- }
- center/=numadd+numliveplayers;
-
- center=player[0].coords;
-
- float maxdistance=0;
- float tempdist;
- //~ int whichclosest;
- for(i=0;i<objects.numobjects;i++){
- tempdist=findDistancefast(¢er,&objects.position[i]);
- if(tempdist>maxdistance){
- //~ whichclosest=i;
- maxdistance=tempdist;
- }
- }
- for(i=0;i<numplayers;i++){
- if(!player[i].dead){
- tempdist=findDistancefast(¢er,&player[i].coords);
- if(tempdist>maxdistance){
- //~ whichclosest=i;
- maxdistance=tempdist;
- }
- }
- }
- radius=fast_sqrt(maxdistance);
-
- radius=110;
-
- glScalef(.25/radius*256*terrain.scale*.4,.25/radius*256*terrain.scale*.4,1);
- glPushMatrix();
- glScalef(1/(1/radius*256*terrain.scale*.4),1/(1/radius*256*terrain.scale*.4),1);
- glPopMatrix();
- glRotatef(player[0].lookrotation*-1+180,0,0,1);
- glTranslatef(-(center.x/terrain.scale/256*-2+1),(center.z/terrain.scale/256*-2+1),0);
- for(i=0;i<objects.numobjects;i++){
- if(objects.type[i]==treetrunktype){
- distcheck=findDistancefast(&player[0].coords,&objects.position[i]);
- if(distcheck<mapviewdist){
- glBindTexture( GL_TEXTURE_2D, Mapcircletexture);
- glColor4f(0,.3,0,opac*(1-distcheck/mapviewdist));
- glPushMatrix();
- glTranslatef(objects.position[i].x/terrain.scale/256*-2+1,objects.position[i].z/terrain.scale/256*2-1,0);
- glRotatef(objects.rotation[i],0,0,1);
- glScalef(.003,.003,.003);
- glBegin(GL_QUADS);
- glTexCoord2f(0,0);
- glVertex3f(-1, -1, 0.0f);
- glTexCoord2f(1,0);
- glVertex3f(1, -1, 0.0f);
- glTexCoord2f(1,1);
- glVertex3f(1, 1, 0.0f);
- glTexCoord2f(0,1);
- glVertex3f(-1, 1, 0.0f);
- glEnd();
- glPopMatrix();
- }
- }
- if(objects.type[i]==boxtype){
- distcheck=findDistancefast(&player[0].coords,&objects.position[i]);
- if(distcheck<mapviewdist){
- glBindTexture( GL_TEXTURE_2D, Mapboxtexture);
- glColor4f(.4,.4,.4,opac*(1-distcheck/mapviewdist));
- glPushMatrix();
- glTranslatef(objects.position[i].x/terrain.scale/256*-2+1,objects.position[i].z/terrain.scale/256*2-1,0);
- glRotatef(objects.rotation[i],0,0,1);
- glScalef(.01*objects.scale[i],.01*objects.scale[i],.01*objects.scale[i]);
- glBegin(GL_QUADS);
- glTexCoord2f(0,0);
- glVertex3f(-1, -1, 0.0f);
- glTexCoord2f(1,0);
- glVertex3f(1, -1, 0.0f);
- glTexCoord2f(1,1);
- glVertex3f(1, 1, 0.0f);
- glTexCoord2f(0,1);
- glVertex3f(-1, 1, 0.0f);
- glEnd();
- glPopMatrix();
- }
- }
- }
- if(editorenabled){
- glBindTexture( GL_TEXTURE_2D, Mapcircletexture);
- for(i=0;i<numboundaries;i++){
- glColor4f(0,0,0,opac/3);
- glPushMatrix();
- glTranslatef(boundary[i].x/terrain.scale/256*-2+1,boundary[i].z/terrain.scale/256*2-1,0);
- glScalef(.002,.002,.002);
- glBegin(GL_QUADS);
- glTexCoord2f(0,0);
- glVertex3f(-1, -1, 0.0f);
- glTexCoord2f(1,0);
- glVertex3f(1, -1, 0.0f);
- glTexCoord2f(1,1);
- glVertex3f(1, 1, 0.0f);
- glTexCoord2f(0,1);
- glVertex3f(-1, 1, 0.0f);
- glEnd();
- glPopMatrix();
- }
- }
- for(i=0;i<numplayers;i++){
- distcheck=findDistancefast(&player[0].coords,&player[i].coords);
- if(distcheck<mapviewdist){
- glPushMatrix();
- glBindTexture( GL_TEXTURE_2D, Maparrowtexture);
- if(i==0)glColor4f(1,1,1,opac);
- else if(player[i].dead==2||player[i].howactive>typesleeping)glColor4f(0,0,0,opac*(1-distcheck/mapviewdist));
- else if(player[i].dead)glColor4f(.3,.3,.3,opac*(1-distcheck/mapviewdist));
- else if(player[i].aitype==attacktypecutoff)glColor4f(1,0,0,opac*(1-distcheck/mapviewdist));
- else if(player[i].aitype==passivetype)glColor4f(0,1,0,opac*(1-distcheck/mapviewdist));
- else glColor4f(1,1,0,1);
- glTranslatef(player[i].coords.x/terrain.scale/256*-2+1,player[i].coords.z/terrain.scale/256*2-1,0);
- glRotatef(player[i].rotation+180,0,0,1);
- glScalef(.005,.005,.005);
- glBegin(GL_QUADS);
- glTexCoord2f(0,0);
- glVertex3f(-1, -1, 0.0f);
- glTexCoord2f(1,0);
- glVertex3f(1, -1, 0.0f);
- glTexCoord2f(1,1);
- glVertex3f(1, 1, 0.0f);
- glTexCoord2f(0,1);
- glVertex3f(-1, 1, 0.0f);
- glEnd();
- glPopMatrix();
- }
- }
- glPopMatrix();
- glDisable(GL_TEXTURE_2D);
- glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
- glPopMatrix(); // Restore The Old Projection Matrix
- glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
- glPopMatrix(); // Restore The Old Projection Matrix
- glEnable(GL_DEPTH_TEST); // Enables Depth Testing
- glEnable(GL_CULL_FACE);
- glDisable(GL_BLEND);
- glDepthMask(1);
- }
-
- if(loading&&!stealthloading&&(!campaign||player[0].dead)){
- glDisable(GL_DEPTH_TEST); // Disables Depth Testing
- glDisable(GL_CULL_FACE);
- glDisable(GL_LIGHTING);
- glDisable(GL_TEXTURE_2D);
- glDepthMask(0);
- glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
- glPushMatrix(); // Store The Projection Matrix
- glLoadIdentity(); // Reset The Projection Matrix
- glOrtho(0,screenwidth,0,screenheight,-100,100); // Set Up An Ortho Screen
- glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
- glPushMatrix(); // Store The Modelview Matrix
- glLoadIdentity(); // Reset The Modelview Matrix
- glScalef(screenwidth,screenheight,1);
- glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
- glEnable(GL_BLEND);
- glColor4f(0,0,0,.7);
- glBegin(GL_QUADS);
- glVertex3f(0, 0, 0.0f);
- glVertex3f(256, 0, 0.0f);
- glVertex3f(256, 256, 0.0f);
- glVertex3f(0, 256, 0.0f);
- glEnd();
- glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
- glPopMatrix(); // Restore The Old Projection Matrix
- glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
- glPopMatrix(); // Restore The Old Projection Matrix
- glEnable(GL_DEPTH_TEST); // Enables Depth Testing
- glEnable(GL_CULL_FACE);
- glDisable(GL_BLEND);
- glDepthMask(1);
-
- //logo
- glDisable(GL_DEPTH_TEST);
- glColor3f (1.0, 1.0, 1.0); // no coloring
-
- glEnable(GL_TEXTURE_2D);
-
- //Minimap
-
- if(loading!=4){
- glEnable(GL_TEXTURE_2D);
- glColor4f(1,1,1,1);
- sprintf (string, "Loading...");
- text.glPrint(1024/2-90,768/2,string,1,2,1024,768);
- }
- loading=2;
- //if(ismotionblur)drawmode=motionblurmode;
- drawmode=normalmode;
- }
-
- if(winfreeze&&!campaign){
- glDisable(GL_DEPTH_TEST); // Disables Depth Testing
- glDisable(GL_CULL_FACE);
- glDisable(GL_LIGHTING);
- glDisable(GL_TEXTURE_2D);
- glDepthMask(0);
- glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
- glPushMatrix(); // Store The Projection Matrix
- glLoadIdentity(); // Reset The Projection Matrix
- glOrtho(0,screenwidth,0,screenheight,-100,100); // Set Up An Ortho Screen
- glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
- glPushMatrix(); // Store The Modelview Matrix
- glLoadIdentity(); // Reset The Modelview Matrix
- glScalef(screenwidth,screenheight,1);
- glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
- glEnable(GL_BLEND);
- glColor4f(0,0,0,.4);
- glBegin(GL_QUADS);
- glVertex3f(0, 0, 0.0f);
- glVertex3f(256, 0, 0.0f);
- glVertex3f(256, 256, 0.0f);
- glVertex3f(0, 256, 0.0f);
- glEnd();
- glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
- glPopMatrix(); // Restore The Old Projection Matrix
- glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
- glPopMatrix(); // Restore The Old Projection Matrix
- glEnable(GL_DEPTH_TEST); // Enables Depth Testing
- glEnable(GL_CULL_FACE);
- glDisable(GL_BLEND);
- glDepthMask(1);
-
- //logo
- glDisable(GL_DEPTH_TEST);
- glColor3f (1.0, 1.0, 1.0); // no coloring
-
- glEnable(GL_TEXTURE_2D);
-
- //Win Screen Won Victory
-
- glEnable(GL_TEXTURE_2D);
- glColor4f(1,1,1,1);
- sprintf (string, "Level Cleared!");
- text.glPrintOutlined(1024/2-strlen(string)*10,768*7/8,string,1,2,1024,768);
-
- sprintf (string, "Score: %d",(int)(bonustotal-startbonustotal));
- text.glPrintOutlined(1024/30,768*6/8,string,1,2,1024,768);
-
- if(campaign)
- sprintf (string, "Press Escape or Space to continue");
- else
- sprintf (string, "Press Escape to return to menu or Space to continue");
- text.glPrintOutlined(640/2-strlen(string)*5,480*1/16,string,1,1,640,480);
-
- char temp[255];
-
- for(i=0;i<255;i++)string[i]='\0';
- sprintf (temp, "Time: %d:",(int)(((int)leveltime-(int)(leveltime)%60)/60));
- strcat(string,temp);
- if((int)(leveltime)%60<10)strcat(string,"0");
- sprintf (temp, "%d",(int)(leveltime)%60);
- strcat(string,temp);
- text.glPrintOutlined(1024/30,768*6/8-40,string,1,2,1024,768);
-
- //Awards
- int awards[award_count];
- int numawards = award_awards(awards);
-
- for (i = 0; i < numawards && i < 6; i++)
- text.glPrintOutlined(1024/30,768*6/8-90-40*i,award_names[awards[i]],1,2,1024,768);
- }
-
- if(drawmode!=normalmode){
- glEnable(GL_TEXTURE_2D);
- glFinish();
- if(!drawtoggle||drawmode!=realmotionblurmode||(drawtoggle==2||change==1)){
- if(screentexture){
-
- glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE_EXT);
- GLfloat subtractColor[4] = { 0.5, 0.5, 0.5, 0.0 };
- glTexEnvfv(GL_TEXTURE_ENV, GL_TEXTURE_ENV_COLOR, subtractColor);
- //glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB_EXT, GL_SUBTRACT);
- glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_RGB_EXT, GL_TEXTURE);
- glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE1_RGB_EXT, GL_CONSTANT_EXT);
- glTexEnvf(GL_TEXTURE_ENV, GL_RGB_SCALE_EXT, 2.0f);
-
- glBindTexture( GL_TEXTURE_2D, screentexture);
- glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 0, texviewwidth, texviewheight);
- }
- }
- if((drawtoggle||change==1)&&drawmode==realmotionblurmode){
- if(screentexture2){
- glBindTexture( GL_TEXTURE_2D, screentexture2);
- glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 0, texviewwidth, texviewheight);
- }
- if(!screentexture2){
- glPixelStorei( GL_UNPACK_ALIGNMENT, 1 );
-
- glGenTextures( 1, &screentexture2 );
- glTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE );
-
- glEnable(GL_TEXTURE_2D);
- glBindTexture( GL_TEXTURE_2D, screentexture2);
- glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR );
- glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR );
-
- glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 0, 0, kTextureSize, kTextureSize, 0);
- }
- }
- //glFlush();
- }
-
- glClear(GL_DEPTH_BUFFER_BIT);
- ReSizeGLScene(90,.1f);
- glViewport(0,0,screenwidth,screenheight);
-
- if(drawmode!=normalmode){
- glDisable(GL_DEPTH_TEST);
- if(drawmode==motionblurmode){
- glDrawBuffer(GL_FRONT);
- glReadBuffer(GL_BACK);
- }
- glColor3f (1.0, 1.0, 1.0); // no coloring
-
- glEnable(GL_TEXTURE_2D);
- glBindTexture( GL_TEXTURE_2D, screentexture);
- glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE );
- glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE );
- glDisable(GL_DEPTH_TEST); // Disables Depth Testing
- glDisable(GL_CULL_FACE);
- glDisable(GL_LIGHTING);
- glDepthMask(0);
- glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
- glPushMatrix(); // Store The Projection Matrix
- glLoadIdentity(); // Reset The Projection Matrix
- glOrtho(0,screenwidth,0,screenheight,-100,100); // Set Up An Ortho Screen
- glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
- glPushMatrix(); // Store The Modelview Matrix
- glLoadIdentity(); // Reset The Modelview Matrix
- glScalef((float)screenwidth/2,(float)screenheight/2,1);
- glTranslatef(1,1,0);
- glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
- glEnable(GL_BLEND);
- if(drawmode==motionblurmode){
- if(motionbluramount<.2)motionbluramount=.2;
- //glColor4f(1,1,1,fast_sqrt(multiplier)*2.9*motionbluramount);
- glColor4f(1,1,1,motionbluramount);
- glPushMatrix();
- glBegin(GL_QUADS);
- glTexCoord2f(0,0);
- glVertex3f(-1, -1, 0.0f);
- glTexCoord2f(texcoordwidth,0);
- glVertex3f(1, -1, 0.0f);
- glTexCoord2f(texcoordwidth,texcoordheight);
- glVertex3f(1, 1, 0.0f);
- glTexCoord2f(0,texcoordheight);
- glVertex3f(-1, 1, 0.0f);
- glEnd();
- glPopMatrix();
- }
- if(drawmode==realmotionblurmode){
- glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
- glClear(GL_COLOR_BUFFER_BIT);
- glBlendFunc(GL_SRC_ALPHA,GL_ONE);
- glBindTexture( GL_TEXTURE_2D, screentexture);
- glColor4f(1,1,1,.5);
- glPushMatrix();
- glBegin(GL_QUADS);
- glTexCoord2f(0,0);
- glVertex3f(-1, -1, 0.0f);
- glTexCoord2f(texcoordwidth,0);
- glVertex3f(1, -1, 0.0f);
- glTexCoord2f(texcoordwidth,texcoordheight);
- glVertex3f(1, 1, 0.0f);
- glTexCoord2f(0,texcoordheight);
- glVertex3f(-1, 1, 0.0f);
- glEnd();
- glPopMatrix();
- glBindTexture( GL_TEXTURE_2D, screentexture2);
- glColor4f(1,1,1,.5);
- glPushMatrix();
- glBegin(GL_QUADS);
- glTexCoord2f(0,0);
- glVertex3f(-1, -1, 0.0f);
- glTexCoord2f(texcoordwidth,0);
- glVertex3f(1, -1, 0.0f);
- glTexCoord2f(texcoordwidth,texcoordheight);
- glVertex3f(1, 1, 0.0f);
- glTexCoord2f(0,texcoordheight);
- glVertex3f(-1, 1, 0.0f);
- glEnd();
- glPopMatrix();
- glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
- }
- if(drawmode==doublevisionmode){
- static float crosseyedness;
- crosseyedness=abs(player[0].damage-player[0].superpermanentdamage-(player[0].damagetolerance-player[0].superpermanentdamage)*1/2)/30;
- if(crosseyedness>1)crosseyedness=1;
- if(crosseyedness<0)crosseyedness=0;
- glColor4f(1,1,1,1);
- glDisable(GL_BLEND);
- glPushMatrix();
- glScalef(1,1,1);
- glBegin(GL_QUADS);
- glTexCoord2f(0,0);
- glVertex3f(-1, -1, 0.0f);
- glTexCoord2f(texcoordwidth,0);
- glVertex3f(1, -1, 0.0f);
- glTexCoord2f(texcoordwidth,texcoordheight);
- glVertex3f(1, 1, 0.0f);
- glTexCoord2f(0,texcoordheight);
- glVertex3f(-1, 1, 0.0f);
- glEnd();
- glPopMatrix();
- if(crosseyedness){
- glColor4f(1,1,1,.5);
- glEnable(GL_BLEND);
- glPushMatrix();
- glTranslatef(.015*crosseyedness,0,0);
- glScalef(1,1,1);
- glBegin(GL_QUADS);
- glTexCoord2f(0,0);
- glVertex3f(-1, -1, 0.0f);
- glTexCoord2f(texcoordwidth,0);
- glVertex3f(1, -1, 0.0f);
- glTexCoord2f(texcoordwidth,texcoordheight);
- glVertex3f(1, 1, 0.0f);
- glTexCoord2f(0,texcoordheight);
- glVertex3f(-1, 1, 0.0f);
- glEnd();
- glPopMatrix();
- }
- }
- if(drawmode==glowmode){
- glColor4f(.5,.5,.5,.5);
- glEnable(GL_BLEND);
- glBlendFunc(GL_SRC_ALPHA,GL_ONE);
- glPushMatrix();
- glTranslatef(.01,0,0);
- glBegin(GL_QUADS);
- glTexCoord2f(0,0);
- glVertex3f(-1, -1, 0.0f);
- glTexCoord2f(texcoordwidth,0);
- glVertex3f(1, -1, 0.0f);
- glTexCoord2f(texcoordwidth,texcoordheight);
- glVertex3f(1, 1, 0.0f);
- glTexCoord2f(0,texcoordheight);
- glVertex3f(-1, 1, 0.0f);
- glEnd();
- glPopMatrix();
- glPushMatrix();
- glTranslatef(-.01,0,0);
- glBegin(GL_QUADS);
- glTexCoord2f(0,0);
- glVertex3f(-1, -1, 0.0f);
- glTexCoord2f(texcoordwidth,0);
- glVertex3f(1, -1, 0.0f);
- glTexCoord2f(texcoordwidth,texcoordheight);
- glVertex3f(1, 1, 0.0f);
- glTexCoord2f(0,texcoordheight);
- glVertex3f(-1, 1, 0.0f);
- glEnd();
- glPopMatrix();
- glPushMatrix();
- glTranslatef(.0,.01,0);
- glBegin(GL_QUADS);
- glTexCoord2f(0,0);
- glVertex3f(-1, -1, 0.0f);
- glTexCoord2f(texcoordwidth,0);
- glVertex3f(1, -1, 0.0f);
- glTexCoord2f(texcoordwidth,texcoordheight);
- glVertex3f(1, 1, 0.0f);
- glTexCoord2f(0,texcoordheight);
- glVertex3f(-1, 1, 0.0f);
- glEnd();
- glPopMatrix();
- glPushMatrix();
- glTranslatef(0,-.01,0);
- glBegin(GL_QUADS);
- glTexCoord2f(0,0);
- glVertex3f(-1, -1, 0.0f);
- glTexCoord2f(texcoordwidth,0);
- glVertex3f(1, -1, 0.0f);
- glTexCoord2f(texcoordwidth,texcoordheight);
- glVertex3f(1, 1, 0.0f);
- glTexCoord2f(0,texcoordheight);
- glVertex3f(-1, 1, 0.0f);
- glEnd();
- glPopMatrix();
- }
- if(drawmode==radialzoommode){
- for(i=0;i<3;i++){
- //glRotatef((float)i*.1,0,0,1);
- glColor4f(1,1,1,1/((float)i+1));
- glPushMatrix();
- glScalef(1+(float)i*.01,1+(float)i*.01,1);
- glBegin(GL_QUADS);
- glTexCoord2f(0,0);
- glVertex3f(-1, -1, 0.0f);
- glTexCoord2f(texcoordwidth,0);
- glVertex3f(1, -1, 0.0f);
- glTexCoord2f(texcoordwidth,texcoordheight);
- glVertex3f(1, 1, 0.0f);
- glTexCoord2f(0,texcoordheight);
- glVertex3f(-1, 1, 0.0f);
- glEnd();
- glPopMatrix();
- }
- }
- glDisable(GL_TEXTURE_2D);
- glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
- glPopMatrix(); // Restore The Old Projection Matrix
- glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
- glPopMatrix(); // Restore The Old Projection Matrix
- glEnable(GL_DEPTH_TEST); // Enables Depth Testing
- glEnable(GL_CULL_FACE);
- glDisable(GL_BLEND);
- glDepthMask(1);
- }
-
- if(console){
- glEnable(GL_TEXTURE_2D);
- glColor4f(1,1,1,1);
- int offset = 0;
- if(consoleselected>=60)
- offset=consoleselected-60;
- sprintf (string, " ]");
- text.glPrint(10,30,string,0,1,1024,768);
- if(consoleblink){
- sprintf (string, "_");
- text.glPrint(30+(float)(consoleselected)*10-offset*10,30,string,0,1,1024,768);
- }
- for(i=0;i<15;i++)
- for(j=0;j<consolechars[i];j++){
- glColor4f(1,1,1,1-(float)(i)/16);
- if(j<consolechars[i]){
- sprintf (string, "%c",consoletext[i][j]);
- text.glPrint(30+j*10-offset*10,30+i*20,string,0,1,1024,768);
- }
- }
- }
- }
-
- if(freeze||winfreeze||(mainmenu&&gameon)||(!gameon&&gamestarted)){
- multiplier=tempmult;
- }
-
- if(mainmenu){
- DrawMenu();
- }
-
- if(freeze||winfreeze||(mainmenu&&gameon)||(!gameon&&gamestarted)){
- tempmult=multiplier;
- multiplier=0;
- }
-
- //glFlush();
- if ( side == stereoRight || side == stereoCenter ) {
- if(drawmode!=motionblurmode||mainmenu){
- swap_gl_buffers();
- }
- }
-
- //myassert(glGetError() == GL_NO_ERROR);
- glDrawBuffer(GL_BACK);
- glReadBuffer(GL_BACK);
- //glFlush();
-
- weapons.DoStuff();
-
- if(drawtoggle==2)drawtoggle=0;
-
- if(freeze||winfreeze||(mainmenu&&gameon)||(!gameon&&gamestarted)){
- multiplier=tempmult;
- }
- //Jordan fixed your warning!
- return 0;
-}
-
-vector<string> Game::ListCampaigns() {
- DIR *campaigns = opendir(ConvertFileName(":Data:Campaigns"));
- struct dirent *campaign = NULL;
- if(!campaigns) {
- perror("Problem while loading campaigns");
- cerr << "campaign folder was : " << ConvertFileName(":Data:Campaigns") << endl;
- exit(EXIT_FAILURE);
- }
- vector<string> campaignNames;
- while ((campaign = readdir(campaigns)) != NULL) {
- string name(campaign->d_name);
- if(name.length()<5)
- continue;
- if(!name.compare(name.length()-4,4,".txt")) {
- campaignNames.push_back(name.substr(0,name.length()-4));
- }
- }
- closedir(campaigns);
- return campaignNames;
-}
+ }
+
+ if (drawmode == glowmode) {
+ glDisable(GL_DEPTH_TEST);
+ glDisable(GL_CULL_FACE);
+ glDisable(GL_LIGHTING);
+ glDisable(GL_TEXTURE_2D);
+ glDepthMask(0);
+ glMatrixMode(GL_PROJECTION);
+ glPushMatrix();
+ glLoadIdentity();
+ glOrtho(0, screenwidth, 0, screenheight, -100, 100);
+ glMatrixMode(GL_MODELVIEW);
+ glPushMatrix();
+ glLoadIdentity();
+ glScalef(screenwidth, screenheight, 1);
+ glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+ glEnable(GL_BLEND);
+ glColor4f(0, 0, 0, .5);
+ glBegin(GL_QUADS);
+ glVertex3f(0, 0, 0.0f);
+ glVertex3f(256, 0, 0.0f);
+ glVertex3f(256, 256, 0.0f);
+ glVertex3f(0, 256, 0.0f);
+ glEnd();
+ glMatrixMode(GL_PROJECTION);
+ glPopMatrix();
+ glMatrixMode(GL_MODELVIEW);
+ glPopMatrix();
+ glEnable(GL_DEPTH_TEST);
+ glEnable(GL_CULL_FACE);
+ glDisable(GL_BLEND);
+ glDepthMask(1);
+ }
+
+ if ((((blackout && damageeffects) || (Person::players[0]->bloodloss > 0 && damageeffects && Person::players[0]->blooddimamount > 0) || Person::players[0]->dead) && !cameramode) || console) {
+ glDisable(GL_DEPTH_TEST);
+ glDisable(GL_CULL_FACE);
+ glDisable(GL_LIGHTING);
+ glDisable(GL_TEXTURE_2D);
+ glDepthMask(0);
+ glMatrixMode(GL_PROJECTION);
+ glPushMatrix();
+ glLoadIdentity();
+ glOrtho(0, screenwidth, 0, screenheight, -100, 100);
+ glMatrixMode(GL_MODELVIEW);
+ glPushMatrix();
+ glLoadIdentity();
+ glScalef(screenwidth, screenheight, 1);
+ glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+ glEnable(GL_BLEND);
+ if (Person::players[0]->dead)
+ blackout += multiplier * 3;
+ if (Person::players[0]->dead == 1)
+ blackout = .4f;
+ if (Person::players[0]->dead == 2 && blackout > .6)
+ blackout = .6;
+ glColor4f(0, 0, 0, blackout);
+ if (!Person::players[0]->dead) {
+ if ((Person::players[0]->bloodloss / Person::players[0]->damagetolerance * (sin(woozy) / 4 + .5))*.3 < .3) {
+ glColor4f(0, 0, 0, Person::players[0]->blooddimamount * Person::players[0]->bloodloss / Person::players[0]->damagetolerance * (sin(woozy) / 4 + .5)*.3);
+ blackout = Person::players[0]->blooddimamount * Person::players[0]->bloodloss / Person::players[0]->damagetolerance * (sin(woozy) / 4 + .5) * .3;
+ } else {
+ glColor4f(0, 0, 0, Person::players[0]->blooddimamount * .3);
+ blackout = Person::players[0]->blooddimamount * .3;
+ }
+ }
+ if (console)
+ glColor4f(.7, 0, 0, .2);
+ glBegin(GL_QUADS);
+ glVertex3f(0, 0, 0.0f);
+ glVertex3f(256, 0, 0.0f);
+ glVertex3f(256, 256, 0.0f);
+ glVertex3f(0, 256, 0.0f);
+ glEnd();
+ glMatrixMode(GL_PROJECTION);
+ glPopMatrix();
+ glMatrixMode(GL_MODELVIEW);
+ glPopMatrix();
+ glEnable(GL_DEPTH_TEST);
+ glEnable(GL_CULL_FACE);
+ glDisable(GL_BLEND);
+ glDepthMask(1);
+ }
+
+ if (flashamount > 0 && damageeffects) {
+ if (flashamount > 1)
+ flashamount = 1;
+ if (flashdelay <= 0)
+ flashamount -= multiplier;
+ flashdelay--;
+ if (flashamount < 0)
+ flashamount = 0;
+ glDisable(GL_DEPTH_TEST);
+ glDisable(GL_CULL_FACE);
+ glDisable(GL_LIGHTING);
+ glDepthMask(0);
+ glMatrixMode(GL_PROJECTION);
+ glPushMatrix();
+ glLoadIdentity();
+ glOrtho(0, screenwidth, 0, screenheight, -100, 100);
+ glMatrixMode(GL_MODELVIEW);
+ glPushMatrix();
+ glLoadIdentity();
+ glScalef(screenwidth, screenheight, 1);
+ glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+ glEnable(GL_BLEND);
+ glColor4f(flashr, flashg, flashb, flashamount);
+ glBegin(GL_QUADS);
+ glVertex3f(0, 0, 0.0f);
+ glVertex3f(256, 0, 0.0f);
+ glVertex3f(256, 256, 0.0f);
+ glVertex3f(0, 256, 0.0f);
+ glEnd();
+ glMatrixMode(GL_PROJECTION);
+ glPopMatrix();
+ glMatrixMode(GL_MODELVIEW);
+ glPopMatrix();
+ glEnable(GL_DEPTH_TEST);
+ glEnable(GL_CULL_FACE);
+ glDisable(GL_BLEND);
+ glDepthMask(1);
+ }
+
+ if (!console) {
+ displaytime[0] = 0;
+ glEnable(GL_TEXTURE_2D);
+ glColor4f(1, 1, 1, 1);
+ for (unsigned i = 1; i < 15; i++)
+ if (displaytime[i] < 4)
+ for (unsigned j = 0; j < displaytext[i].size(); j++) {
+ glColor4f(1, 1, 1, 4 - displaytime[i]);
+ sprintf (string, "%c", displaytext[i][j]);
+ text->glPrint(30 + j * 10, 30 + i * 20 + (screenheight - 330), string, 0, 1, screenwidth, screenheight);
+ }
+ }
+
+ if (difficulty < 2 && indialogue == -1) { // minimap
+ float mapviewdist = 20000;
+
+ glDisable(GL_DEPTH_TEST);
+ glColor3f (1.0, 1.0, 1.0); // no coloring
+
+ glEnable(GL_TEXTURE_2D);
+ glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE );
+ glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE );
+ glDisable(GL_DEPTH_TEST);
+ glDisable(GL_CULL_FACE);
+ glDisable(GL_LIGHTING);
+ glDepthMask(0);
+ glMatrixMode(GL_PROJECTION);
+ glPushMatrix();
+ glLoadIdentity();
+ glOrtho(0, screenwidth, 0, screenheight, -100, 100);
+ glMatrixMode(GL_MODELVIEW);
+ glPushMatrix();
+ glLoadIdentity();
+ glScalef((float)screenwidth / 2, (float)screenwidth / 2, 1);
+ glTranslatef(1.75, .25, 0);
+ glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+ glEnable(GL_BLEND);
+ glColor4f(1, 1, 1, 1);
+ glPushMatrix();
+ float opac = .7;
+ XYZ center;
+ float radius;
+ float distcheck;
+
+ center = Person::players[0]->coords;
+
+ radius = 110;
+
+ glScalef(.25 / radius * 256 * terrain.scale * .4, .25 / radius * 256 * terrain.scale * .4, 1);
+ glPushMatrix();
+ glScalef(1 / (1 / radius * 256 * terrain.scale * .4), 1 / (1 / radius * 256 * terrain.scale * .4), 1);
+ glPopMatrix();
+ glRotatef(Person::players[0]->lookyaw * -1 + 180, 0, 0, 1);
+ glTranslatef(-(center.x / terrain.scale / 256 * -2 + 1), (center.z / terrain.scale / 256 * -2 + 1), 0);
+ for (int i = 0; i < objects.numobjects; i++) {
+ if (objects.type[i] == treetrunktype) {
+ distcheck = distsq(&Person::players[0]->coords, &objects.position[i]);
+ if (distcheck < mapviewdist) {
+ Mapcircletexture.bind();
+ glColor4f(0, .3, 0, opac * (1 - distcheck / mapviewdist));
+ glPushMatrix();
+ glTranslatef(objects.position[i].x / terrain.scale / 256 * -2 + 1, objects.position[i].z / terrain.scale / 256 * 2 - 1, 0);
+ glRotatef(objects.yaw[i], 0, 0, 1);
+ glScalef(.003, .003, .003);
+ glBegin(GL_QUADS);
+ glTexCoord2f(0, 0);
+ glVertex3f(-1, -1, 0.0f);
+ glTexCoord2f(1, 0);
+ glVertex3f(1, -1, 0.0f);
+ glTexCoord2f(1, 1);
+ glVertex3f(1, 1, 0.0f);
+ glTexCoord2f(0, 1);
+ glVertex3f(-1, 1, 0.0f);
+ glEnd();
+ glPopMatrix();
+ }
+ }
+ if (objects.type[i] == boxtype) {
+ distcheck = distsq(&Person::players[0]->coords, &objects.position[i]);
+ if (distcheck < mapviewdist) {
+ Mapboxtexture.bind();
+ glColor4f(.4, .4, .4, opac * (1 - distcheck / mapviewdist));
+ glPushMatrix();
+ glTranslatef(objects.position[i].x / terrain.scale / 256 * -2 + 1, objects.position[i].z / terrain.scale / 256 * 2 - 1, 0);
+ glRotatef(objects.yaw[i], 0, 0, 1);
+ glScalef(.01 * objects.scale[i], .01 * objects.scale[i], .01 * objects.scale[i]);
+ glBegin(GL_QUADS);
+ glTexCoord2f(0, 0);
+ glVertex3f(-1, -1, 0.0f);
+ glTexCoord2f(1, 0);
+ glVertex3f(1, -1, 0.0f);
+ glTexCoord2f(1, 1);
+ glVertex3f(1, 1, 0.0f);
+ glTexCoord2f(0, 1);
+ glVertex3f(-1, 1, 0.0f);
+ glEnd();
+ glPopMatrix();
+ }
+ }
+ }
+ if (editorenabled) {
+ Mapcircletexture.bind();
+ for (int i = 0; i < numboundaries; i++) {
+ glColor4f(0, 0, 0, opac / 3);
+ glPushMatrix();
+ glTranslatef(boundary[i].x / terrain.scale / 256 * -2 + 1, boundary[i].z / terrain.scale / 256 * 2 - 1, 0);
+ glScalef(.002, .002, .002);
+ glBegin(GL_QUADS);
+ glTexCoord2f(0, 0);
+ glVertex3f(-1, -1, 0.0f);
+ glTexCoord2f(1, 0);
+ glVertex3f(1, -1, 0.0f);
+ glTexCoord2f(1, 1);
+ glVertex3f(1, 1, 0.0f);
+ glTexCoord2f(0, 1);
+ glVertex3f(-1, 1, 0.0f);
+ glEnd();
+ glPopMatrix();
+ }
+ }
+ for (unsigned i = 0; i < Person::players.size(); i++) {
+ distcheck = distsq(&Person::players[0]->coords, &Person::players[i]->coords);
+ if (distcheck < mapviewdist) {
+ glPushMatrix();
+ Maparrowtexture.bind();
+ if (i == 0)
+ glColor4f(1, 1, 1, opac);
+ else if (Person::players[i]->dead == 2 || Person::players[i]->howactive > typesleeping)
+ glColor4f(0, 0, 0, opac * (1 - distcheck / mapviewdist));
+ else if (Person::players[i]->dead)
+ glColor4f(.3, .3, .3, opac * (1 - distcheck / mapviewdist));
+ else if (Person::players[i]->aitype == attacktypecutoff)
+ glColor4f(1, 0, 0, opac * (1 - distcheck / mapviewdist));
+ else if (Person::players[i]->aitype == passivetype)
+ glColor4f(0, 1, 0, opac * (1 - distcheck / mapviewdist));
+ else
+ glColor4f(1, 1, 0, 1);
+ glTranslatef(Person::players[i]->coords.x / terrain.scale / 256 * -2 + 1, Person::players[i]->coords.z / terrain.scale / 256 * 2 - 1, 0);
+ glRotatef(Person::players[i]->yaw + 180, 0, 0, 1);
+ glScalef(.005, .005, .005);
+ glBegin(GL_QUADS);
+ glTexCoord2f(0, 0);
+ glVertex3f(-1, -1, 0.0f);
+ glTexCoord2f(1, 0);
+ glVertex3f(1, -1, 0.0f);
+ glTexCoord2f(1, 1);
+ glVertex3f(1, 1, 0.0f);
+ glTexCoord2f(0, 1);
+ glVertex3f(-1, 1, 0.0f);
+ glEnd();
+ glPopMatrix();
+ }
+ }
+ glPopMatrix();
+ glDisable(GL_TEXTURE_2D);
+ glMatrixMode(GL_PROJECTION);
+ glPopMatrix();
+ glMatrixMode(GL_MODELVIEW);
+ glPopMatrix();
+ glEnable(GL_DEPTH_TEST);
+ glEnable(GL_CULL_FACE);
+ glDisable(GL_BLEND);
+ glDepthMask(1);
+ }
+
+ if (loading && !stealthloading && (!campaign || Person::players[0]->dead)) {
+ glDisable(GL_DEPTH_TEST);
+ glDisable(GL_CULL_FACE);
+ glDisable(GL_LIGHTING);
+ glDisable(GL_TEXTURE_2D);
+ glDepthMask(0);
+ glMatrixMode(GL_PROJECTION);
+ glPushMatrix();
+ glLoadIdentity();
+ glOrtho(0, screenwidth, 0, screenheight, -100, 100);
+ glMatrixMode(GL_MODELVIEW);
+ glPushMatrix();
+ glLoadIdentity();
+ glScalef(screenwidth, screenheight, 1);
+ glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+ glEnable(GL_BLEND);
+ glColor4f(0, 0, 0, .7);
+ glBegin(GL_QUADS);
+ glVertex3f(0, 0, 0.0f);
+ glVertex3f(256, 0, 0.0f);
+ glVertex3f(256, 256, 0.0f);
+ glVertex3f(0, 256, 0.0f);
+ glEnd();
+ glMatrixMode(GL_PROJECTION);
+ glPopMatrix();
+ glMatrixMode(GL_MODELVIEW);
+ glPopMatrix();
+ glEnable(GL_DEPTH_TEST);
+ glEnable(GL_CULL_FACE);
+ glDisable(GL_BLEND);
+ glDepthMask(1);
+
+ //logo
+ glDisable(GL_DEPTH_TEST);
+ glColor3f (1.0, 1.0, 1.0); // no coloring
+
+ glEnable(GL_TEXTURE_2D);
+
+ //Minimap
+
+ if (loading != 4) {
+ glEnable(GL_TEXTURE_2D);
+ glColor4f(1, 1, 1, 1);
+ sprintf (string, "Loading...");
+ text->glPrint(1024 / 2 - 90, 768 / 2, string, 1, 2, 1024, 768);
+ }
+ loading = 2;
+ drawmode = normalmode;
+ }
+
+ if (winfreeze && !campaign) {
+ glDisable(GL_DEPTH_TEST);
+ glDisable(GL_CULL_FACE);
+ glDisable(GL_LIGHTING);
+ glDisable(GL_TEXTURE_2D);
+ glDepthMask(0);
+ glMatrixMode(GL_PROJECTION);
+ glPushMatrix();
+ glLoadIdentity();
+ glOrtho(0, screenwidth, 0, screenheight, -100, 100);
+ glMatrixMode(GL_MODELVIEW);
+ glPushMatrix();
+ glLoadIdentity();
+ glScalef(screenwidth, screenheight, 1);
+ glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+ glEnable(GL_BLEND);
+ glColor4f(0, 0, 0, .4);
+ glBegin(GL_QUADS);
+ glVertex3f(0, 0, 0.0f);
+ glVertex3f(256, 0, 0.0f);
+ glVertex3f(256, 256, 0.0f);
+ glVertex3f(0, 256, 0.0f);
+ glEnd();
+ glMatrixMode(GL_PROJECTION);
+ glPopMatrix();
+ glMatrixMode(GL_MODELVIEW);
+ glPopMatrix();
+ glEnable(GL_DEPTH_TEST);
+ glEnable(GL_CULL_FACE);
+ glDisable(GL_BLEND);
+ glDepthMask(1);
+
+ //logo
+ glDisable(GL_DEPTH_TEST);
+ glColor3f (1.0, 1.0, 1.0); // no coloring
+
+ glEnable(GL_TEXTURE_2D);
+
+ //Win Screen Won Victory
+
+ glEnable(GL_TEXTURE_2D);
+ glColor4f(1, 1, 1, 1);
+ sprintf (string, "Level Cleared!");
+ text->glPrintOutlined(1024 / 2 - strlen(string) * 10, 768 * 7 / 8, string, 1, 2, 1024, 768);
+
+ sprintf (string, "Score: %d", (int)(bonustotal - startbonustotal));
+ text->glPrintOutlined(1024 / 30, 768 * 6 / 8, string, 1, 2, 1024, 768);
+
+ if (campaign)
+ sprintf (string, "Press Escape or Space to continue");
+ else
+ sprintf (string, "Press Escape to return to menu or Space to continue");
+ text->glPrintOutlined(640 / 2 - strlen(string) * 5, 480 * 1 / 16, string, 1, 1, 640, 480);
+
+ char temp[255];
+
+ for (int i = 0; i < 255; i++)
+ string[i] = '\0';
+ sprintf (temp, "Time: %d:", (int)(((int)leveltime - (int)(leveltime) % 60) / 60));
+ strcat(string, temp);
+ if ((int)(leveltime) % 60 < 10)
+ strcat(string, "0");
+ sprintf (temp, "%d", (int)(leveltime) % 60);
+ strcat(string, temp);
+ text->glPrintOutlined(1024 / 30, 768 * 6 / 8 - 40, string, 1, 2, 1024, 768);
+
+ //Awards
+ int awards[award_count];
+ int numawards = award_awards(awards);
+
+ for (int i = 0; i < numawards && i < 6; i++)
+ text->glPrintOutlined(1024 / 30, 768 * 6 / 8 - 90 - 40 * i, award_names[awards[i]], 1, 2, 1024, 768);
+ }
+
+ if (drawmode != normalmode) {
+ glEnable(GL_TEXTURE_2D);
+ glFinish();
+ if (!drawtoggle || drawmode != realmotionblurmode || (drawtoggle == 2 || change == 1)) {
+ if (screentexture) {
+
+ glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE_EXT);
+ GLfloat subtractColor[4] = { 0.5, 0.5, 0.5, 0.0 };
+ glTexEnvfv(GL_TEXTURE_ENV, GL_TEXTURE_ENV_COLOR, subtractColor);
+ glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_RGB_EXT, GL_TEXTURE);
+ glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE1_RGB_EXT, GL_CONSTANT_EXT);
+ glTexEnvf(GL_TEXTURE_ENV, GL_RGB_SCALE_EXT, 2.0f);
+
+ glBindTexture( GL_TEXTURE_2D, screentexture);
+ glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 0, texviewwidth, texviewheight);
+ }
+ }
+ if ((drawtoggle || change == 1) && drawmode == realmotionblurmode) {
+ if (screentexture2) {
+ glBindTexture( GL_TEXTURE_2D, screentexture2);
+ glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 0, texviewwidth, texviewheight);
+ }
+ if (!screentexture2) {
+ glPixelStorei( GL_UNPACK_ALIGNMENT, 1 );