- 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].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); // 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);
- Game::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;
+ 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);
+ 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);
+ string = "Level Cleared!";
+ text->glPrintOutlined(1024 / 2 - string.size() * 10, 768 * 7 / 8, string, 1, 2, 1024, 768);
+
+ string = "Score: " + to_string(int(bonustotal - startbonustotal));
+ text->glPrintOutlined(1024 / 30, 768 * 6 / 8, string, 1, 2, 1024, 768);
+
+ string = "Press Escape to return to menu or Space to continue";
+ text->glPrintOutlined(640 / 2 - string.size() * 5, 480 * 1 / 16, string, 1, 1, 640, 480);
+
+ int wontime = (int)round(wonleveltime);
+ string = "Time: " + to_string(int((wontime - wontime % 60) / 60));
+ if (wontime % 60 < 10) {
+ string += "0";
+ }
+ string += to_string(int(wontime % 60));
+ 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);
+ 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, GL_TEXTURE);
+ glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE1_RGB, GL_CONSTANT);
+ glTexEnvf(GL_TEXTURE_ENV, GL_RGB_SCALE, 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);
+ }
+ }
+ }
+
+ glClear(GL_DEPTH_BUFFER_BIT);
+ Game::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);
+ 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)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, 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(Person::players[0]->damage - Person::players[0]->superpermanentdamage - (Person::players[0]->damagetolerance - Person::players[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 (int i = 0; i < 3; i++) {
+ 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);
+ glPopMatrix();
+ glMatrixMode(GL_MODELVIEW);
+ glPopMatrix();
+ glEnable(GL_DEPTH_TEST);
+ 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;
+ }
+ textmono->glPrint(10, 30, " ]", 0, 1, 1024, 768);
+ if (consoleblink) {
+ textmono->glPrint(30 + (float)consoleselected * 10 - offset * 10, 30, "_", 0, 1, 1024, 768);
+ }
+ for (unsigned i = 0; i < 15; i++) {
+ textmono->glPrint(30 - offset * 10, 30 + i * 20, consoletext[i], 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;
+ }
+
+ if (side == stereoRight || side == stereoCenter) {
+ if (drawmode != motionblurmode || mainmenu) {
+ swap_gl_buffers();
+ }
+ }
+
+ glDrawBuffer(GL_BACK);
+ glReadBuffer(GL_BACK);
+
+ weapons.DoStuff();
+
+ if (drawtoggle == 2) {
+ drawtoggle = 0;
+ }
+
+ if (freeze || winfreeze || (mainmenu && gameon) || (!gameon && gamestarted)) {
+ multiplier = tempmult;
+ }
+ //Jordan fixed your warning!
+ return 0;