*/
#ifndef ANIMATION_H
-#define ANIMATION_H
+#define ANIMATION_H
enum anim_attack_type {
neutral, normalattack, reversed, reversal
glGetFloatv(GL_MODELVIEW_MATRIX, mvmatrix);
// Combine the matrices
- clip[0] = mvmatrix[0] * projmatrix[0] + mvmatrix[1] * projmatrix[4] + mvmatrix[2] * projmatrix[8] + mvmatrix[3] * projmatrix[12];
+ clip[0] = mvmatrix[0] * projmatrix[0] + mvmatrix[1] * projmatrix[4] + mvmatrix[2] * projmatrix[8] + mvmatrix[3] * projmatrix[12];
clip[1] = mvmatrix[0] * projmatrix[1] + mvmatrix[1] * projmatrix[5] + mvmatrix[2] * projmatrix[9] + mvmatrix[3] * projmatrix[13];
clip[2] = mvmatrix[0] * projmatrix[2] + mvmatrix[1] * projmatrix[6] + mvmatrix[2] * projmatrix[10] + mvmatrix[3] * projmatrix[14];
clip[3] = mvmatrix[0] * projmatrix[3] + mvmatrix[1] * projmatrix[7] + mvmatrix[2] * projmatrix[11] + mvmatrix[3] * projmatrix[15];
}
if (indialogue != -1 && !mainmenu) {
- glDisable(GL_DEPTH_TEST); // Disables Depth Testing
+ glDisable(GL_DEPTH_TEST);
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
+ glMatrixMode(GL_PROJECTION);
+ glPushMatrix();
+ glLoadIdentity();
+ glOrtho(0, screenwidth, 0, screenheight, -100, 100);
+ glMatrixMode(GL_MODELVIEW);
+ glPushMatrix();
+ glLoadIdentity();
if (dialogueboxlocation[whichdialogue][indialogue] == 1)
glTranslatef(0, screenheight * 3 / 4, 0);
glScalef(screenwidth, screenheight / 4, 1);
glColor4f(dialogueboxcolor[whichdialogue][indialogue][0], dialogueboxcolor[whichdialogue][indialogue][1], dialogueboxcolor[whichdialogue][indialogue][2], 0.7);
glBegin(GL_QUADS);
- glVertex3f(0, 0, 0.0f);
- glVertex3f(1, 0, 0.0f);
- glVertex3f(1, 1, 0.0f);
- glVertex3f(0, 1, 0.0f);
+ glVertex3f(0, 0, 0.0f);
+ glVertex3f(1, 0, 0.0f);
+ glVertex3f(1, 1, 0.0f);
+ glVertex3f(0, 1, 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
+ glMatrixMode(GL_PROJECTION);
+ glPopMatrix();
+ glMatrixMode(GL_MODELVIEW);
+ glPopMatrix();
+ glEnable(GL_DEPTH_TEST);
glEnable(GL_CULL_FACE);
glDisable(GL_BLEND);
glDepthMask(1);
glColor4f(1, 0, 0, 1);
text->glPrint(1024 / 40, 768 / 16 + 768 * 14 / 16, string, 1, 1.5, 1024, 768);
if (showdamagebar) {
- glDisable(GL_DEPTH_TEST); // Disables Depth Testing
+ glDisable(GL_DEPTH_TEST);
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
+ glMatrixMode(GL_PROJECTION);
+ glPushMatrix();
+ glLoadIdentity();
+ glOrtho(0, screenwidth, 0, screenheight, -100, 100);
+ glMatrixMode(GL_MODELVIEW);
+ glPushMatrix();
+ glLoadIdentity();
glTranslatef(15, screenheight * 17.5 / 20, 0);
glScalef(screenwidth / 3 + 20, screenheight / 20, 1);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glVertex3f(0, 0, 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
+ glMatrixMode(GL_PROJECTION);
+ glPopMatrix();
+ glMatrixMode(GL_MODELVIEW);
+ glPopMatrix();
+ glEnable(GL_DEPTH_TEST);
glEnable(GL_CULL_FACE);
glDisable(GL_BLEND);
glDepthMask(1);
}
if (drawmode == glowmode) {
- glDisable(GL_DEPTH_TEST); // Disables Depth Testing
+ glDisable(GL_DEPTH_TEST);
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
+ 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);
+ 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
+ glMatrixMode(GL_PROJECTION);
+ glPopMatrix();
+ glMatrixMode(GL_MODELVIEW);
+ glPopMatrix();
+ glEnable(GL_DEPTH_TEST);
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_DEPTH_TEST);
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
+ 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 (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);
+ 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
+ glMatrixMode(GL_PROJECTION);
+ glPopMatrix();
+ glMatrixMode(GL_MODELVIEW);
+ glPopMatrix();
+ glEnable(GL_DEPTH_TEST);
glEnable(GL_CULL_FACE);
glDisable(GL_BLEND);
glDepthMask(1);
flashdelay--;
if (flashamount < 0)
flashamount = 0;
- glDisable(GL_DEPTH_TEST); // Disables Depth Testing
+ glDisable(GL_DEPTH_TEST);
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
+ 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);
+ 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
+ glMatrixMode(GL_PROJECTION);
+ glPopMatrix();
+ glMatrixMode(GL_MODELVIEW);
+ glPopMatrix();
+ glEnable(GL_DEPTH_TEST);
glEnable(GL_CULL_FACE);
glDisable(GL_BLEND);
glDepthMask(1);
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_DEPTH_TEST);
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
+ 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);
glScalef(.003, .003, .003);
glBegin(GL_QUADS);
glTexCoord2f(0, 0);
- glVertex3f(-1, -1, 0.0f);
+ glVertex3f(-1, -1, 0.0f);
glTexCoord2f(1, 0);
- glVertex3f(1, -1, 0.0f);
+ glVertex3f(1, -1, 0.0f);
glTexCoord2f(1, 1);
- glVertex3f(1, 1, 0.0f);
+ glVertex3f(1, 1, 0.0f);
glTexCoord2f(0, 1);
- glVertex3f(-1, 1, 0.0f);
+ glVertex3f(-1, 1, 0.0f);
glEnd();
glPopMatrix();
}
glScalef(.01 * objects.scale[i], .01 * objects.scale[i], .01 * objects.scale[i]);
glBegin(GL_QUADS);
glTexCoord2f(0, 0);
- glVertex3f(-1, -1, 0.0f);
+ glVertex3f(-1, -1, 0.0f);
glTexCoord2f(1, 0);
- glVertex3f(1, -1, 0.0f);
+ glVertex3f(1, -1, 0.0f);
glTexCoord2f(1, 1);
- glVertex3f(1, 1, 0.0f);
+ glVertex3f(1, 1, 0.0f);
glTexCoord2f(0, 1);
- glVertex3f(-1, 1, 0.0f);
+ glVertex3f(-1, 1, 0.0f);
glEnd();
glPopMatrix();
}
glScalef(.002, .002, .002);
glBegin(GL_QUADS);
glTexCoord2f(0, 0);
- glVertex3f(-1, -1, 0.0f);
+ glVertex3f(-1, -1, 0.0f);
glTexCoord2f(1, 0);
- glVertex3f(1, -1, 0.0f);
+ glVertex3f(1, -1, 0.0f);
glTexCoord2f(1, 1);
- glVertex3f(1, 1, 0.0f);
+ glVertex3f(1, 1, 0.0f);
glTexCoord2f(0, 1);
- glVertex3f(-1, 1, 0.0f);
+ glVertex3f(-1, 1, 0.0f);
glEnd();
glPopMatrix();
}
glScalef(.005, .005, .005);
glBegin(GL_QUADS);
glTexCoord2f(0, 0);
- glVertex3f(-1, -1, 0.0f);
+ glVertex3f(-1, -1, 0.0f);
glTexCoord2f(1, 0);
- glVertex3f(1, -1, 0.0f);
+ glVertex3f(1, -1, 0.0f);
glTexCoord2f(1, 1);
- glVertex3f(1, 1, 0.0f);
+ glVertex3f(1, 1, 0.0f);
glTexCoord2f(0, 1);
- glVertex3f(-1, 1, 0.0f);
+ 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
+ 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 || player[0].dead)) {
- glDisable(GL_DEPTH_TEST); // Disables Depth Testing
+ glDisable(GL_DEPTH_TEST);
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
+ 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);
+ 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
+ glMatrixMode(GL_PROJECTION);
+ glPopMatrix();
+ glMatrixMode(GL_MODELVIEW);
+ glPopMatrix();
+ glEnable(GL_DEPTH_TEST);
glEnable(GL_CULL_FACE);
glDisable(GL_BLEND);
glDepthMask(1);
}
if (winfreeze && !campaign) {
- glDisable(GL_DEPTH_TEST); // Disables Depth Testing
+ glDisable(GL_DEPTH_TEST);
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
+ 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);
+ 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
+ glMatrixMode(GL_PROJECTION);
+ glPopMatrix();
+ glMatrixMode(GL_MODELVIEW);
+ glPopMatrix();
+ glEnable(GL_DEPTH_TEST);
glEnable(GL_CULL_FACE);
glDisable(GL_BLEND);
glDepthMask(1);
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_DEPTH_TEST);
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
+ 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);
glPushMatrix();
glBegin(GL_QUADS);
glTexCoord2f(0, 0);
- glVertex3f(-1, -1, 0.0f);
+ glVertex3f(-1, -1, 0.0f);
glTexCoord2f(texcoordwidth, 0);
- glVertex3f(1, -1, 0.0f);
+ glVertex3f(1, -1, 0.0f);
glTexCoord2f(texcoordwidth, texcoordheight);
- glVertex3f(1, 1, 0.0f);
+ glVertex3f(1, 1, 0.0f);
glTexCoord2f(0, texcoordheight);
- glVertex3f(-1, 1, 0.0f);
+ glVertex3f(-1, 1, 0.0f);
glEnd();
glPopMatrix();
}
glPushMatrix();
glBegin(GL_QUADS);
glTexCoord2f(0, 0);
- glVertex3f(-1, -1, 0.0f);
+ glVertex3f(-1, -1, 0.0f);
glTexCoord2f(texcoordwidth, 0);
- glVertex3f(1, -1, 0.0f);
+ glVertex3f(1, -1, 0.0f);
glTexCoord2f(texcoordwidth, texcoordheight);
- glVertex3f(1, 1, 0.0f);
+ glVertex3f(1, 1, 0.0f);
glTexCoord2f(0, texcoordheight);
- glVertex3f(-1, 1, 0.0f);
+ glVertex3f(-1, 1, 0.0f);
glEnd();
glPopMatrix();
glBindTexture( GL_TEXTURE_2D, screentexture2);
glPushMatrix();
glBegin(GL_QUADS);
glTexCoord2f(0, 0);
- glVertex3f(-1, -1, 0.0f);
+ glVertex3f(-1, -1, 0.0f);
glTexCoord2f(texcoordwidth, 0);
- glVertex3f(1, -1, 0.0f);
+ glVertex3f(1, -1, 0.0f);
glTexCoord2f(texcoordwidth, texcoordheight);
- glVertex3f(1, 1, 0.0f);
+ glVertex3f(1, 1, 0.0f);
glTexCoord2f(0, texcoordheight);
- glVertex3f(-1, 1, 0.0f);
+ glVertex3f(-1, 1, 0.0f);
glEnd();
glPopMatrix();
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glScalef(1, 1, 1);
glBegin(GL_QUADS);
glTexCoord2f(0, 0);
- glVertex3f(-1, -1, 0.0f);
+ glVertex3f(-1, -1, 0.0f);
glTexCoord2f(texcoordwidth, 0);
- glVertex3f(1, -1, 0.0f);
+ glVertex3f(1, -1, 0.0f);
glTexCoord2f(texcoordwidth, texcoordheight);
- glVertex3f(1, 1, 0.0f);
+ glVertex3f(1, 1, 0.0f);
glTexCoord2f(0, texcoordheight);
- glVertex3f(-1, 1, 0.0f);
+ glVertex3f(-1, 1, 0.0f);
glEnd();
glPopMatrix();
if (crosseyedness) {
glScalef(1, 1, 1);
glBegin(GL_QUADS);
glTexCoord2f(0, 0);
- glVertex3f(-1, -1, 0.0f);
+ glVertex3f(-1, -1, 0.0f);
glTexCoord2f(texcoordwidth, 0);
- glVertex3f(1, -1, 0.0f);
+ glVertex3f(1, -1, 0.0f);
glTexCoord2f(texcoordwidth, texcoordheight);
- glVertex3f(1, 1, 0.0f);
+ glVertex3f(1, 1, 0.0f);
glTexCoord2f(0, texcoordheight);
- glVertex3f(-1, 1, 0.0f);
+ glVertex3f(-1, 1, 0.0f);
glEnd();
glPopMatrix();
}
glTranslatef(.01, 0, 0);
glBegin(GL_QUADS);
glTexCoord2f(0, 0);
- glVertex3f(-1, -1, 0.0f);
+ glVertex3f(-1, -1, 0.0f);
glTexCoord2f(texcoordwidth, 0);
- glVertex3f(1, -1, 0.0f);
+ glVertex3f(1, -1, 0.0f);
glTexCoord2f(texcoordwidth, texcoordheight);
- glVertex3f(1, 1, 0.0f);
+ glVertex3f(1, 1, 0.0f);
glTexCoord2f(0, texcoordheight);
- glVertex3f(-1, 1, 0.0f);
+ glVertex3f(-1, 1, 0.0f);
glEnd();
glPopMatrix();
glPushMatrix();
glTranslatef(-.01, 0, 0);
glBegin(GL_QUADS);
glTexCoord2f(0, 0);
- glVertex3f(-1, -1, 0.0f);
+ glVertex3f(-1, -1, 0.0f);
glTexCoord2f(texcoordwidth, 0);
- glVertex3f(1, -1, 0.0f);
+ glVertex3f(1, -1, 0.0f);
glTexCoord2f(texcoordwidth, texcoordheight);
- glVertex3f(1, 1, 0.0f);
+ glVertex3f(1, 1, 0.0f);
glTexCoord2f(0, texcoordheight);
- glVertex3f(-1, 1, 0.0f);
+ glVertex3f(-1, 1, 0.0f);
glEnd();
glPopMatrix();
glPushMatrix();
glTranslatef(.0, .01, 0);
glBegin(GL_QUADS);
glTexCoord2f(0, 0);
- glVertex3f(-1, -1, 0.0f);
+ glVertex3f(-1, -1, 0.0f);
glTexCoord2f(texcoordwidth, 0);
- glVertex3f(1, -1, 0.0f);
+ glVertex3f(1, -1, 0.0f);
glTexCoord2f(texcoordwidth, texcoordheight);
- glVertex3f(1, 1, 0.0f);
+ glVertex3f(1, 1, 0.0f);
glTexCoord2f(0, texcoordheight);
- glVertex3f(-1, 1, 0.0f);
+ glVertex3f(-1, 1, 0.0f);
glEnd();
glPopMatrix();
glPushMatrix();
glTranslatef(0, -.01, 0);
glBegin(GL_QUADS);
glTexCoord2f(0, 0);
- glVertex3f(-1, -1, 0.0f);
+ glVertex3f(-1, -1, 0.0f);
glTexCoord2f(texcoordwidth, 0);
- glVertex3f(1, -1, 0.0f);
+ glVertex3f(1, -1, 0.0f);
glTexCoord2f(texcoordwidth, texcoordheight);
- glVertex3f(1, 1, 0.0f);
+ glVertex3f(1, 1, 0.0f);
glTexCoord2f(0, texcoordheight);
- glVertex3f(-1, 1, 0.0f);
+ glVertex3f(-1, 1, 0.0f);
glEnd();
glPopMatrix();
}
glScalef(1 + (float)i * .01, 1 + (float)i * .01, 1);
glBegin(GL_QUADS);
glTexCoord2f(0, 0);
- glVertex3f(-1, -1, 0.0f);
+ glVertex3f(-1, -1, 0.0f);
glTexCoord2f(texcoordwidth, 0);
- glVertex3f(1, -1, 0.0f);
+ glVertex3f(1, -1, 0.0f);
glTexCoord2f(texcoordwidth, texcoordheight);
- glVertex3f(1, 1, 0.0f);
+ glVertex3f(1, 1, 0.0f);
glTexCoord2f(0, texcoordheight);
- glVertex3f(-1, 1, 0.0f);
+ 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
+ glMatrixMode(GL_PROJECTION);
+ glPopMatrix();
+ glMatrixMode(GL_MODELVIEW);
+ glPopMatrix();
+ glEnable(GL_DEPTH_TEST);
glEnable(GL_CULL_FACE);
glDisable(GL_BLEND);
glDepthMask(1);
glEnable(GL_ALPHA_TEST);
glAlphaFunc(GL_GREATER, 0.001f);
glEnable(GL_TEXTURE_2D);
- glDisable(GL_DEPTH_TEST); // Disables Depth Testing
+ glDisable(GL_DEPTH_TEST);
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
+ glMatrixMode(GL_PROJECTION);
+ glPushMatrix();
+ glLoadIdentity();
+ glOrtho(0, screenwidth, 0, screenheight, -100, 100);
+ glMatrixMode(GL_MODELVIEW);
+ glPushMatrix();
+ glLoadIdentity();
glTranslatef(screenwidth / 2, screenheight / 2, 0);
glPushMatrix();
glScalef((float)screenwidth / 2, (float)screenheight / 2, 1);
glEnd();
glPopMatrix();
glPopMatrix();
- glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
+ glMatrixMode(GL_PROJECTION);
glPopMatrix();
- glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
+ glMatrixMode(GL_MODELVIEW);
- glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
- glPushMatrix(); // Store The Projection Matrix
- glLoadIdentity(); // Reset The Projection Matrix
- glOrtho(0, 640, 0, 480, -100, 100); // Set Up An Ortho Screen
- glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
- glPushMatrix(); // Store The Modelview Matrix
- glLoadIdentity(); // Reset The Modelview Matrix
+ glMatrixMode(GL_PROJECTION);
+ glPushMatrix();
+ glLoadIdentity();
+ glOrtho(0, 640, 0, 480, -100, 100);
+ glMatrixMode(GL_MODELVIEW);
+ glPushMatrix();
+ glLoadIdentity();
glEnable(GL_TEXTURE_2D);
Menu::drawItems();
//draw mouse cursor
- glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
+ glMatrixMode(GL_PROJECTION);
glPopMatrix();
- glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
+ glMatrixMode(GL_MODELVIEW);
glPopMatrix();
- 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
+ glMatrixMode(GL_PROJECTION);
+ glPushMatrix();
+ glLoadIdentity();
+ glOrtho(0, screenwidth, 0, screenheight, -100, 100);
+ glMatrixMode(GL_MODELVIEW);
+ glPushMatrix();
+ glLoadIdentity();
glTranslatef(screenwidth / 2, screenheight / 2, 0);
glPushMatrix();
glScalef((float)screenwidth / 2, (float)screenheight / 2, 1);
glPopMatrix();
}
glPopMatrix();
- glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
+ glMatrixMode(GL_PROJECTION);
glPopMatrix();
flashdelay--;
if (flashamount < 0)
flashamount = 0;
- glDisable(GL_DEPTH_TEST); // Disables Depth Testing
+ glDisable(GL_DEPTH_TEST);
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
+ 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);
+ 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
+ glMatrixMode(GL_PROJECTION);
+ glPopMatrix();
+ glMatrixMode(GL_MODELVIEW);
+ glPopMatrix();
+ glEnable(GL_DEPTH_TEST);
glEnable(GL_CULL_FACE);
glDisable(GL_BLEND);
glDepthMask(1);
AbsoluteTime currTime = UpTime ();
double deltaTime = (float) AbsoluteDeltaToDuration (currTime, frametime);
- if (0 > deltaTime) // if negative microseconds
+ if (0 > deltaTime) // if negative microseconds
deltaTime /= -1000000.0;
- else // else milliseconds
+ else // else milliseconds
deltaTime /= 1000.0;
multiplier = deltaTime;
if (multiplier > 10)
multiplier = 10;
if (multiplier > .05) {
- frametime = currTime; // reset for next time interval
+ frametime = currTime; // reset for next time interval
glLoadIdentity();
//Clear to black
loadscreentexture.bind();
glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT );
glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT );
- glDisable(GL_DEPTH_TEST); // Disables Depth Testing
+ glDisable(GL_DEPTH_TEST);
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
+ glMatrixMode(GL_PROJECTION);
+ glPushMatrix();
+ glLoadIdentity();
+ glOrtho(0, screenwidth, 0, screenheight, -100, 100);
+ glMatrixMode(GL_MODELVIEW);
+ glPushMatrix();
+ glLoadIdentity();
glTranslatef(screenwidth / 2, screenheight / 2, 0);
glScalef((float)screenwidth / 2, (float)screenheight / 2, 1);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
//glScalef(.25,.25,.25);
glBegin(GL_QUADS);
glTexCoord2f(.1 - loadprogress / 100, 0 + loadprogress / 100 + .3);
- glVertex3f(-1, -1, 0.0f);
+ glVertex3f(-1, -1, 0.0f);
glTexCoord2f(.1 - loadprogress / 100, 0 + loadprogress / 100 + .3);
- glVertex3f(1, -1, 0.0f);
+ glVertex3f(1, -1, 0.0f);
glTexCoord2f(.1 - loadprogress / 100, 1 + loadprogress / 100 + .3);
- glVertex3f(1, 1, 0.0f);
+ glVertex3f(1, 1, 0.0f);
glTexCoord2f(.1 - loadprogress / 100, 1 + loadprogress / 100 + .3);
- glVertex3f(-1, 1, 0.0f);
+ glVertex3f(-1, 1, 0.0f);
glEnd();
glPopMatrix();
glEnable(GL_BLEND);
//glScalef(.25,.25,.25);
glBegin(GL_QUADS);
glTexCoord2f(.4 + loadprogress / 100, 0 + loadprogress / 100);
- glVertex3f(-1, -1, 0.0f);
+ glVertex3f(-1, -1, 0.0f);
glTexCoord2f(.4 + loadprogress / 100, 0 + loadprogress / 100);
- glVertex3f(1, -1, 0.0f);
+ glVertex3f(1, -1, 0.0f);
glTexCoord2f(.4 + loadprogress / 100, 1 + loadprogress / 100);
- glVertex3f(1, 1, 0.0f);
+ glVertex3f(1, 1, 0.0f);
glTexCoord2f(.4 + loadprogress / 100, 1 + loadprogress / 100);
- glVertex3f(-1, 1, 0.0f);
+ 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
+ glMatrixMode(GL_PROJECTION);
+ glPopMatrix();
+ glMatrixMode(GL_MODELVIEW);
+ glPopMatrix();
glDisable(GL_BLEND);
glDepthMask(1);
loadscreentexture.bind();
glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT );
glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT );
- glDisable(GL_DEPTH_TEST); // Disables Depth Testing
+ glDisable(GL_DEPTH_TEST);
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
+ glMatrixMode(GL_PROJECTION);
+ glPushMatrix();
+ glLoadIdentity();
+ glOrtho(0, screenwidth, 0, screenheight, -100, 100);
+ glMatrixMode(GL_MODELVIEW);
+ glPushMatrix();
+ glLoadIdentity();
glTranslatef(screenwidth / 2, screenheight / 2, 0);
glScalef((float)screenwidth / 2 * (1.5 - (loadprogress) / 200), (float)screenheight / 2 * (1.5 - (loadprogress) / 200), 1);
glBlendFunc(GL_SRC_ALPHA, GL_ONE);
//glScalef(.25,.25,.25);
glBegin(GL_QUADS);
glTexCoord2f(0 + .5, 0 + .5);
- glVertex3f(-1, -1, 0.0f);
+ glVertex3f(-1, -1, 0.0f);
glTexCoord2f(1 + .5, 0 + .5);
- glVertex3f(1, -1, 0.0f);
+ glVertex3f(1, -1, 0.0f);
glTexCoord2f(1 + .5, 1 + .5);
- glVertex3f(1, 1, 0.0f);
+ glVertex3f(1, 1, 0.0f);
glTexCoord2f(0 + .5, 1 + .5);
- glVertex3f(-1, 1, 0.0f);
+ 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
+ glMatrixMode(GL_PROJECTION);
+ glPopMatrix();
+ glMatrixMode(GL_MODELVIEW);
+ glPopMatrix();
glDisable(GL_BLEND);
glDepthMask(1);
loadscreentexture.bind();
glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT );
glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT );
- glDisable(GL_DEPTH_TEST); // Disables Depth Testing
+ glDisable(GL_DEPTH_TEST);
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
+ glMatrixMode(GL_PROJECTION);
+ glPushMatrix();
+ glLoadIdentity();
+ glOrtho(0, screenwidth, 0, screenheight, -100, 100);
+ glMatrixMode(GL_MODELVIEW);
+ glPushMatrix();
+ glLoadIdentity();
glTranslatef(screenwidth / 2, screenheight / 2, 0);
glScalef((float)screenwidth / 2 * (100 + loadprogress) / 100, (float)screenheight / 2 * (100 + loadprogress) / 100, 1);
glBlendFunc(GL_SRC_ALPHA, GL_ONE);
//glScalef(.25,.25,.25);
glBegin(GL_QUADS);
glTexCoord2f(0 + .2, 0 + .8);
- glVertex3f(-1, -1, 0.0f);
+ glVertex3f(-1, -1, 0.0f);
glTexCoord2f(1 + .2, 0 + .8);
- glVertex3f(1, -1, 0.0f);
+ glVertex3f(1, -1, 0.0f);
glTexCoord2f(1 + .2, 1 + .8);
- glVertex3f(1, 1, 0.0f);
+ glVertex3f(1, 1, 0.0f);
glTexCoord2f(0 + .2, 1 + .8);
- glVertex3f(-1, 1, 0.0f);
+ 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
+ glMatrixMode(GL_PROJECTION);
+ glPopMatrix();
+ glMatrixMode(GL_MODELVIEW);
+ glPopMatrix();
glDisable(GL_BLEND);
glDepthMask(1);
flashdelay--;
if (flashamount < 0)
flashamount = 0;
- glDisable(GL_DEPTH_TEST); // Disables Depth Testing
+ glDisable(GL_DEPTH_TEST);
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
+ 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);
+ 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
+ glMatrixMode(GL_PROJECTION);
+ glPopMatrix();
+ glMatrixMode(GL_MODELVIEW);
+ glPopMatrix();
+ glEnable(GL_DEPTH_TEST);
glEnable(GL_CULL_FACE);
glDisable(GL_BLEND);
glDepthMask(1);
//glBindTexture( GL_TEXTURE_2D, loadscreentexture);
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_DEPTH_TEST);
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
+ glMatrixMode(GL_PROJECTION);
+ glPushMatrix();
+ glLoadIdentity();
+ glOrtho(0, screenwidth, 0, screenheight, -100, 100);
+ glMatrixMode(GL_MODELVIEW);
+ glPushMatrix();
+ glLoadIdentity();
glTranslatef(screenwidth / 2, screenheight / 2, 0);
glScalef((float)screenwidth / 2, (float)screenheight / 2, 1);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
//glScalef(.25,.25,.25);
glBegin(GL_QUADS);
glTexCoord2f(0, 0);
- glVertex3f(-1, -1, 0.0f);
+ glVertex3f(-1, -1, 0.0f);
glTexCoord2f(1, 0);
- glVertex3f(1, -1, 0.0f);
+ glVertex3f(1, -1, 0.0f);
glTexCoord2f(1, 1);
- glVertex3f(1, 1, 0.0f);
+ glVertex3f(1, 1, 0.0f);
glTexCoord2f(0, 1);
- glVertex3f(-1, 1, 0.0f);
+ 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
+ glMatrixMode(GL_PROJECTION);
+ glPopMatrix();
+ glMatrixMode(GL_MODELVIEW);
+ glPopMatrix();
glDisable(GL_BLEND);
glDepthMask(1);
//Text
/********************> Tick() <*****/
extern bool save_image(const char * fname);
-void Screenshot (void)
+void Screenshot (void)
{
char temp[1024];
- time_t t = time(NULL);
- struct tm *tme = localtime(&t);
+ time_t t = time(NULL);
+ struct tm *tme = localtime(&t);
sprintf(temp, "Screenshots/Screenshot_%04d_%02d_%02d--%02d_%02d_%02d.png", tme->tm_year + 1900, tme->tm_mon + 1, tme->tm_mday, tme->tm_hour, tme->tm_min, tme->tm_sec);
#if defined(_WIN32)
temptexdetail = texdetail;
if (texdetail > 1)
texdetail = 4;
- skybox->load( ":Data:Textures:Skybox(snow):Front.jpg",
+ skybox->load( ":Data:Textures:Skybox(snow):Front.jpg",
":Data:Textures:Skybox(snow):Left.jpg",
":Data:Textures:Skybox(snow):Back.jpg",
":Data:Textures:Skybox(snow):Right.jpg",
temptexdetail = texdetail;
if (texdetail > 1)
texdetail = 4;
- skybox->load( ":Data:Textures:Skybox(sand):Front.jpg",
+ skybox->load( ":Data:Textures:Skybox(sand):Front.jpg",
":Data:Textures:Skybox(sand):Left.jpg",
":Data:Textures:Skybox(sand):Back.jpg",
":Data:Textures:Skybox(sand):Right.jpg",
temptexdetail = texdetail;
if (texdetail > 1)
texdetail = 4;
- skybox->load( ":Data:Textures:Skybox(grass):Front.jpg",
+ skybox->load( ":Data:Textures:Skybox(grass):Front.jpg",
":Data:Textures:Skybox(grass):Left.jpg",
":Data:Textures:Skybox(grass):Back.jpg",
":Data:Textures:Skybox(grass):Right.jpg",
/*
//what did autocam do?
if(player[0].skeleton.free!=2&&autocam){
- cameraspeed=20;
- if(findLengthfast(&player[0].velocity)>400){
- cameraspeed=20+(findLength(&player[0].velocity)-20)*.96;
- }
- if(player[0].skeleton.free==0&&player[0].animTarget!=hanganim&&player[0].animTarget!=climbanim)target.y+=1.4;
- cameradist+=multiplier*5;
- if(cameradist>3.3)cameradist=3.3;
- coltarget=target-cameraloc;
- if(findLengthfast(&coltarget)<multiplier*multiplier*400)cameraloc=target;
- else if(findLengthfast(&coltarget)>1)
- {
- Normalise(&coltarget);
- if(player[0].animTarget!=hanganim&&player[0].animTarget!=climbanim&&player[0].animCurrent!=climbanim&&player[0].currentoffset.x==0)cameraloc=cameraloc+coltarget*multiplier*cameraspeed;
- else cameraloc=cameraloc+coltarget*multiplier*8;
- }
- if(editorenabled)cameraloc=target;
- viewer=cameraloc;
- colviewer=viewer;
- coltarget=cameraloc;
- objects.SphereCheckPossible(&colviewer, findDistance(&colviewer,&coltarget));
- if(terrain.patchobjectnum[player[0].whichpatchx][player[0].whichpatchz])
- for(int j=0;j<terrain.patchobjectnum[player[0].whichpatchx][player[0].whichpatchz];j++){
- int i=terrain.patchobjects[player[0].whichpatchx][player[0].whichpatchz][j];
- colviewer=viewer;
- coltarget=cameraloc;
- if(objects.model[i].LineCheckPossible(&colviewer,&coltarget,&col,&objects.position[i],&objects.yaw[i])!=-1)viewer=col;
- }
+ cameraspeed=20;
+ if(findLengthfast(&player[0].velocity)>400){
+ cameraspeed=20+(findLength(&player[0].velocity)-20)*.96;
+ }
+ if(player[0].skeleton.free==0&&player[0].animTarget!=hanganim&&player[0].animTarget!=climbanim)target.y+=1.4;
+ cameradist+=multiplier*5;
+ if(cameradist>3.3)cameradist=3.3;
+ coltarget=target-cameraloc;
+ if(findLengthfast(&coltarget)<multiplier*multiplier*400)cameraloc=target;
+ else if(findLengthfast(&coltarget)>1)
+ {
+ Normalise(&coltarget);
+ if(player[0].animTarget!=hanganim&&player[0].animTarget!=climbanim&&player[0].animCurrent!=climbanim&&player[0].currentoffset.x==0)cameraloc=cameraloc+coltarget*multiplier*cameraspeed;
+ else cameraloc=cameraloc+coltarget*multiplier*8;
+ }
+ if(editorenabled)cameraloc=target;
+ viewer=cameraloc;
+ colviewer=viewer;
+ coltarget=cameraloc;
+ objects.SphereCheckPossible(&colviewer, findDistance(&colviewer,&coltarget));
+ if(terrain.patchobjectnum[player[0].whichpatchx][player[0].whichpatchz])
+ for(int j=0;j<terrain.patchobjectnum[player[0].whichpatchx][player[0].whichpatchz];j++){
+ int i=terrain.patchobjects[player[0].whichpatchx][player[0].whichpatchz][j];
+ colviewer=viewer;
+ coltarget=cameraloc;
+ if(objects.model[i].LineCheckPossible(&colviewer,&coltarget,&col,&objects.position[i],&objects.yaw[i])!=-1)viewer=col;
+ }
if(terrain.patchobjectnum[player[0].whichpatchx][player[0].whichpatchz])
for(int j=0;j<terrain.patchobjectnum[player[0].whichpatchx][player[0].whichpatchz];j++){
int i=terrain.patchobjects[player[0].whichpatchx][player[0].whichpatchz][j];
return "unknown";
}
-unsigned short Input::CharToKey(const char* which)
+unsigned short Input::CharToKey(const char* which)
{
for (unsigned short i = 0; i < SDLK_LAST; i++) {
if (!strcasecmp(which, SDL_GetKeyName(SDLKey(i))))
#include "Game.h"
/**> CONSTANT DECLARATIONS <**/
-#define MOUSEBUTTON1 SDLK_LAST+SDL_BUTTON_LEFT
-#define MOUSEBUTTON2 SDLK_LAST+SDL_BUTTON_RIGHT
+#define MOUSEBUTTON1 SDLK_LAST+SDL_BUTTON_LEFT
+#define MOUSEBUTTON2 SDLK_LAST+SDL_BUTTON_RIGHT
/**> FUNCTION PROTOTYPES <**/
class Input
static bool isKeyDown(int k);
static bool isKeyPressed(int k);
static const char* keyToChar(unsigned short which);
- static unsigned short CharToKey(const char* which);
+ static unsigned short CharToKey(const char* which);
static Boolean MouseClicked();
};
//Initialize lights
if (whichlight == 0) {
- GLfloat LightAmbient[] = { whichsource->ambient[0], whichsource->ambient[1], whichsource->ambient[2], 1.0f};
- GLfloat LightDiffuse[] = { whichsource->color[0], whichsource->color[1], whichsource->color[2], 1.0f };
- GLfloat LightPosition[] = { whichsource->location.x, whichsource->location.y, whichsource->location.z, 0.0f };
+ GLfloat LightAmbient[] = { whichsource->ambient[0], whichsource->ambient[1], whichsource->ambient[2], 1.0f};
+ GLfloat LightDiffuse[] = { whichsource->color[0], whichsource->color[1], whichsource->color[2], 1.0f };
+ GLfloat LightPosition[] = { whichsource->location.x, whichsource->location.y, whichsource->location.z, 0.0f };
//glLightfv(GL_LIGHT0, GL_QUADRATIC_ATTENUATION, qattenuation);
glLightfv(GL_LIGHT0, GL_POSITION, LightPosition);
break;
}
- GLfloat LightAmbient[] = { 0, 0, 0, 1.0f};
- GLfloat LightDiffuse[] = { whichsource->color[0], whichsource->color[1], whichsource->color[2], 1.0f };
- GLfloat LightPosition[] = { whichsource->location.x, whichsource->location.y, whichsource->location.z, 1.0f };
+ GLfloat LightAmbient[] = { 0, 0, 0, 1.0f};
+ GLfloat LightDiffuse[] = { whichsource->color[0], whichsource->color[1], whichsource->color[2], 1.0f };
+ GLfloat LightPosition[] = { whichsource->location.x, whichsource->location.y, whichsource->location.z, 1.0f };
glLightfv(lightselect, GL_QUADRATIC_ATTENUATION, qattenuation);
glLightfv(lightselect, GL_POSITION, LightPosition);
//Initialize lights
if (whichlight == 0) {
- GLfloat LightAmbient[] = { ambientr, ambientg, ambientb, 1.0f};
- GLfloat LightDiffuse[] = { whichsource->color[0], whichsource->color[1], whichsource->color[2], 1.0f };
- GLfloat LightPosition[] = { whichsource->location.x, whichsource->location.y, whichsource->location.z, 1.0f };
+ GLfloat LightAmbient[] = { ambientr, ambientg, ambientb, 1.0f};
+ GLfloat LightDiffuse[] = { whichsource->color[0], whichsource->color[1], whichsource->color[2], 1.0f };
+ GLfloat LightPosition[] = { whichsource->location.x, whichsource->location.y, whichsource->location.z, 1.0f };
glLightfv(GL_LIGHT0, GL_QUADRATIC_ATTENUATION, qattenuation);
glLightfv(GL_LIGHT0, GL_POSITION, LightPosition);
QueryPerformanceFrequency( (LARGE_INTEGER*)&counterRate);
QueryPerformanceCounter( (LARGE_INTEGER*)&baseCounter);
}
- __int64 counterRate; // LARGE_INTEGER type has no math functions so use int64
+ __int64 counterRate; // LARGE_INTEGER type has no math functions so use int64
__int64 baseCounter;
};
static AppTime g_appTime;
unsigned long lo;
} AbsoluteTime;
-AbsoluteTime UpTime(); // NOTE: returns time since app started, not system start
+AbsoluteTime UpTime(); // NOTE: returns time since app started, not system start
typedef long Duration;
glPushMatrix();
glTranslatef(2, -5, 0); //from old code
glBegin(GL_QUADS);
- glVertex3f(linestart.x - offset.x * it->linestartsize, linestart.y - offset.y * it->linestartsize, 0.0f);
- glVertex3f(linestart.x + offset.x * it->linestartsize, linestart.y + offset.y * it->linestartsize, 0.0f);
- glVertex3f(lineend.x + offset.x * it->lineendsize, lineend.y + offset.y * it->lineendsize, 0.0f);
- glVertex3f(lineend.x - offset.x * it->lineendsize, lineend.y - offset.y * it->lineendsize, 0.0f);
+ glVertex3f(linestart.x - offset.x * it->linestartsize, linestart.y - offset.y * it->linestartsize, 0.0f);
+ glVertex3f(linestart.x + offset.x * it->linestartsize, linestart.y + offset.y * it->linestartsize, 0.0f);
+ glVertex3f(lineend.x + offset.x * it->lineendsize, lineend.y + offset.y * it->lineendsize, 0.0f);
+ glVertex3f(lineend.x - offset.x * it->lineendsize, lineend.y - offset.y * it->lineendsize, 0.0f);
glEnd();
glPopMatrix();
glEnable(GL_TEXTURE_2D);
bool Model::loadnotex(const char *filename )
{
- FILE *tfile;
- long i;
+ FILE *tfile;
+ long i;
int oldvertexNum, oldTriangleNum;
oldvertexNum = vertexNum;
}
for (i = 0; i < TriangleNum; i++) {
- // funpackf(tfile, "Bi Bi Bi", &Triangles[i].vertex[0], &Triangles[i].vertex[1], &Triangles[i].vertex[2]);
+ //funpackf(tfile, "Bi Bi Bi", &Triangles[i].vertex[0], &Triangles[i].vertex[1], &Triangles[i].vertex[2]);
short vertex[ 6];
funpackf(tfile, "Bs Bs Bs Bs Bs Bs", &vertex[ 0], &vertex[ 1], &vertex[ 2], &vertex[ 3], &vertex[ 4], &vertex[ 5]);
Triangles[i].vertex[ 0] = vertex[ 0];
bool Model::load(const char *filename, bool texture )
{
- FILE *tfile;
- long i;
+ FILE *tfile;
+ long i;
LOGFUNC;
}
for (i = 0; i < TriangleNum; i++) {
- // funpackf(tfile, "Bi Bi Bi", &Triangles[i].vertex[0], &Triangles[i].vertex[1], &Triangles[i].vertex[2]);
+ //funpackf(tfile, "Bi Bi Bi", &Triangles[i].vertex[0], &Triangles[i].vertex[1], &Triangles[i].vertex[2]);
short vertex[ 6];
funpackf(tfile, "Bs Bs Bs Bs Bs Bs", &vertex[ 0], &vertex[ 1], &vertex[ 2], &vertex[ 3], &vertex[ 4], &vertex[ 5]);
Triangles[i].vertex[ 0] = vertex[ 0];
bool Model::loaddecal(const char *filename, bool texture )
{
- FILE *tfile;
- long i, j;
+ FILE *tfile;
+ long i, j;
LOGFUNC;
}
for (i = 0; i < TriangleNum; i++) {
- // funpackf(tfile, "Bi Bi Bi", &Triangles[i].vertex[0], &Triangles[i].vertex[1], &Triangles[i].vertex[2]);
+ //funpackf(tfile, "Bi Bi Bi", &Triangles[i].vertex[0], &Triangles[i].vertex[1], &Triangles[i].vertex[2]);
short vertex[ 6];
funpackf(tfile, "Bs Bs Bs Bs Bs Bs", &vertex[ 0], &vertex[ 1], &vertex[ 2], &vertex[ 3], &vertex[ 4], &vertex[ 5]);
Triangles[i].vertex[ 0] = vertex[ 0];
bool Model::loadraw(char *filename )
{
- FILE *tfile;
- long i;
+ FILE *tfile;
+ long i;
LOGFUNC;
}
for (i = 0; i < TriangleNum; i++) {
- // funpackf(tfile, "Bi Bi Bi", &Triangles[i].vertex[0], &Triangles[i].vertex[1], &Triangles[i].vertex[2]);
+ //funpackf(tfile, "Bi Bi Bi", &Triangles[i].vertex[0], &Triangles[i].vertex[1], &Triangles[i].vertex[2]);
short vertex[ 6];
funpackf(tfile, "Bs Bs Bs Bs Bs Bs", &vertex[ 0], &vertex[ 1], &vertex[ 2], &vertex[ 3], &vertex[ 4], &vertex[ 5]);
Triangles[i].vertex[ 0] = vertex[ 0];
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP);
- glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
+ glMatrixMode(GL_MODELVIEW);
glPushMatrix();
glBegin(GL_TRIANGLES);
for (int j = 0; j < 3; j++) {
//
// Textures List
//
-typedef struct {
- long xsz, ysz;
- GLubyte *txt;
+typedef struct {
+ long xsz, ysz;
+ GLubyte *txt;
} ModelTexture;
//
class TexturedTriangle
{
public:
- short vertex[3];
+ short vertex[3];
float gx[3], gy[3];
};
class Model
{
public:
- short vertexNum, TriangleNum;
+ short vertexNum, TriangleNum;
bool hastexture;
int type, oldtype;
//Functions
-bool Objects::checkcollide(XYZ startpoint, XYZ endpoint, int which)
+bool Objects::checkcollide(XYZ startpoint, XYZ endpoint, int which)
{
static XYZ colpoint, colviewer, coltarget;
static int i;
}
else occluded[i]=0;*/
if (occluded[i] < 6) {
- glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
+ glMatrixMode(GL_MODELVIEW);
glPushMatrix();
if (!model[i].color)
glEnable(GL_LIGHTING);
distance = 1;
if (distance > 0) {
if (1 == 1 || occluded[i] < 6) {
- glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
+ glMatrixMode(GL_MODELVIEW);
glPushMatrix();
glEnable(GL_LIGHTING);
glDepthMask(1);
glDisable( GL_ALPHA_TEST);
glDisable( GL_BLEND);
glDisable( GL_DEPTH_TEST);
- // glDisable( GL_DITHER);
+ //glDisable( GL_DITHER);
glDisable( GL_FOG);
glDisable( GL_LIGHTING);
glDisable( GL_LOGIC_OP);
glClearDepth( 1.0f);
glDepthFunc( GL_LEQUAL);
glDepthMask( GL_TRUE);
- // glDepthRange( FRONT_CLIP, BACK_CLIP);
+ //glDepthRange( FRONT_CLIP, BACK_CLIP);
glEnable( GL_DEPTH_TEST);
glHint( GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);
glCullFace( GL_FRONT);
glEnable( GL_CULL_FACE);
glEnable( GL_LIGHTING);
-// glEnable( GL_LIGHT_MODEL_AMBIENT);
+ //glEnable( GL_LIGHT_MODEL_AMBIENT);
glEnable( GL_DITHER);
glEnable( GL_COLOR_MATERIAL);
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
AbsoluteTime currTime = UpTime ();
double deltaTime = (float) AbsoluteDeltaToDuration (currTime, frametime);
- if (0 > deltaTime) // if negative microseconds
+ if (0 > deltaTime) // if negative microseconds
deltaTime /= -1000000.0;
- else // else milliseconds
+ else // else milliseconds
deltaTime /= 1000.0;
multiplier = deltaTime;
if (multiplier > 10)
multiplier = 10;
if (update)
- frametime = currTime; // reset for next time interval
+ frametime = currTime; // reset for next time interval
deltaTime = (float) AbsoluteDeltaToDuration (currTime, time);
- if (0 > deltaTime) // if negative microseconds
+ if (0 > deltaTime) // if negative microseconds
deltaTime /= -1000000.0;
- else // else milliseconds
+ else // else milliseconds
deltaTime /= 1000.0;
frames++;
- if (0.001 <= deltaTime) { // has update interval passed
+ if (0.001 <= deltaTime) { // has update interval passed
if (update) {
- time = currTime; // reset for next time interval
+ time = currTime; // reset for next time interval
frames = 0;
}
}
TickOnceAfter();
/* - Debug code to test how many channels were active on average per frame
- static long frames = 0;
-
- static AbsoluteTime start = {0,0};
- AbsoluteTime currTime = UpTime ();
- static int num_channels = 0;
-
- num_channels += OPENAL_GetChannelsPlaying();
- double deltaTime = (float) AbsoluteDeltaToDuration (currTime, start);
-
- if (0 > deltaTime) // if negative microseconds
- deltaTime /= -1000000.0;
- else // else milliseconds
- deltaTime /= 1000.0;
-
- ++frames;
-
- if (deltaTime >= 1)
- {
- start = currTime;
- float avg_channels = (float)num_channels / (float)frames;
-
- ofstream opstream("log.txt",ios::app);
- opstream << "Average frame count: ";
- opstream << frames;
- opstream << " frames - ";
- opstream << avg_channels;
- opstream << " per frame.\n";
- opstream.close();
-
- frames = 0;
- num_channels = 0;
- }
+ static long frames = 0;
+
+ static AbsoluteTime start = {0,0};
+ AbsoluteTime currTime = UpTime ();
+ static int num_channels = 0;
+
+ num_channels += OPENAL_GetChannelsPlaying();
+ double deltaTime = (float) AbsoluteDeltaToDuration (currTime, start);
+
+ if (0 > deltaTime) // if negative microseconds
+ deltaTime /= -1000000.0;
+ else // else milliseconds
+ deltaTime /= 1000.0;
+
+ ++frames;
+
+ if (deltaTime >= 1)
+ {
+ start = currTime;
+ float avg_channels = (float)num_channels / (float)frames;
+
+ ofstream opstream("log.txt",ios::app);
+ opstream << "Average frame count: ";
+ opstream << frames;
+ opstream << " frames - ";
+ opstream << avg_channels;
+ opstream << " per frame.\n";
+ opstream.close();
+
+ frames = 0;
+ num_channels = 0;
+ }
*/
if ( stereomode == stereoNone ) {
DrawGLScene(stereoCenter);
struct my_error_mgr {
- struct jpeg_error_mgr pub; /* "public" fields */
- jmp_buf setjmp_buffer; /* for return to caller */
+ struct jpeg_error_mgr pub; /* "public" fields */
+ jmp_buf setjmp_buffer; /* for return to caller */
};
typedef struct my_error_mgr * my_error_ptr;
{
struct jpeg_decompress_struct cinfo;
struct my_error_mgr jerr;
- JSAMPROW buffer[1]; /* Output row buffer */
- int row_stride; /* physical row width in output buffer */
+ JSAMPROW buffer[1]; /* Output row buffer */
+ int row_stride; /* physical row width in output buffer */
FILE *infile = fopen(file_name, "rb");
if (infile == NULL)
yaw = targetyaw;
frameTarget = 0;
- // frameTarget=2;
+ // frameTarget=2;
animTarget = flipanim;
crouchtogglekeydown = 1;
target = 0;
// Misc. Constants
//------------------------------------------------------------------------//
-float const pi = 3.14159265f;
-float const g = -32.174f; // acceleration due to gravity, ft/s^2
-float const rho = 0.0023769f; // desity of air at sea level, slugs/ft^3
-float const tol = 0.0000000001f; // float type tolerance
+float const pi = 3.14159265f;
+float const g = -32.174f; // acceleration due to gravity, ft/s^2
+float const rho = 0.0023769f; // desity of air at sea level, slugs/ft^3
+float const tol = 0.0000000001f; // float type tolerance
//------------------------------------------------------------------------//
// Misc. Functions
//------------------------------------------------------------------------//
-inline float DegreesToRadians(float deg);
-inline float RadiansToDegrees(float rad);
+inline float DegreesToRadians(float deg);
+inline float RadiansToDegrees(float rad);
-inline float DegreesToRadians(float deg)
+inline float DegreesToRadians(float deg)
{
return deg * pi / 180.0f;
}
-inline float RadiansToDegrees(float rad)
+inline float RadiansToDegrees(float rad)
{
return rad * 180.0f / pi;
}
void Normalize(void);
void Reverse(void);
- Vector& operator+=(Vector u); // vector addition
- Vector& operator-=(Vector u); // vector subtraction
- Vector& operator*=(float s); // scalar multiply
- Vector& operator/=(float s); // scalar divide
+ Vector& operator+=(Vector u); // vector addition
+ Vector& operator-=(Vector u); // vector subtraction
+ Vector& operator*=(float s); // scalar multiply
+ Vector& operator/=(float s); // scalar divide
Vector operator-(void);
};
-inline Vector operator+(Vector u, Vector v);
-inline Vector operator-(Vector u, Vector v);
-inline Vector operator^(Vector u, Vector v);
-inline float operator*(Vector u, Vector v);
-inline Vector operator*(float s, Vector u);
-inline Vector operator*(Vector u, float s);
-inline Vector operator/(Vector u, float s);
-inline float TripleScalarProduct(Vector u, Vector v, Vector w);
+inline Vector operator+(Vector u, Vector v);
+inline Vector operator-(Vector u, Vector v);
+inline Vector operator^(Vector u, Vector v);
+inline float operator*(Vector u, Vector v);
+inline Vector operator*(float s, Vector u);
+inline Vector operator*(Vector u, float s);
+inline Vector operator/(Vector u, float s);
+inline float TripleScalarProduct(Vector u, Vector v, Vector w);
/*
float fast_sqrt2 (register float arg);
float fast_sqrt2 (register float arg)
if (arg == 0.0) return 0.0;
asm {
-frsqrte result,arg // Calculate Square root
+frsqrte result,arg // Calculate Square root
}
// Newton Rhapson iterations.
z = zi;
}
-inline float Vector::Magnitude(void)
+inline float Vector::Magnitude(void)
{
return (float) sqrt(x * x + y * y + z * z);
}
-inline void Vector::Normalize(void)
+inline void Vector::Normalize(void)
{
float m = (float) sqrt(x * x + y * y + z * z);
if (m <= tol)
z = 0.0f;
}
-inline void Vector::Reverse(void)
+inline void Vector::Reverse(void)
{
x = -x;
y = -y;
return *this;
}
-inline Vector& Vector::operator-=(Vector u)
+inline Vector& Vector::operator-=(Vector u)
{
x -= u.x;
y -= u.y;
return *this;
}
-inline Vector& Vector::operator*=(float s)
+inline Vector& Vector::operator*=(float s)
{
x *= s;
y *= s;
return *this;
}
-inline Vector& Vector::operator/=(float s)
+inline Vector& Vector::operator/=(float s)
{
x /= s;
y /= s;
return *this;
}
-inline Vector Vector::operator-(void)
+inline Vector Vector::operator-(void)
{
return Vector(-x, -y, -z);
}
-inline Vector operator+(Vector u, Vector v)
+inline Vector operator+(Vector u, Vector v)
{
return Vector(u.x + v.x, u.y + v.y, u.z + v.z);
}
-inline Vector operator-(Vector u, Vector v)
+inline Vector operator-(Vector u, Vector v)
{
return Vector(u.x - v.x, u.y - v.y, u.z - v.z);
}
// Vector cross product (u cross v)
-inline Vector operator^(Vector u, Vector v)
+inline Vector operator^(Vector u, Vector v)
{
- return Vector( u.y * v.z - u.z * v.y,
+ return Vector( u.y * v.z - u.z * v.y,
-u.x * v.z + u.z * v.x,
u.x * v.y - u.y * v.x );
}
// Vector dot product
-inline float operator*(Vector u, Vector v)
+inline float operator*(Vector u, Vector v)
{
return (u.x * v.x + u.y * v.y + u.z * v.z);
}
-inline Vector operator*(float s, Vector u)
+inline Vector operator*(float s, Vector u)
{
return Vector(u.x * s, u.y * s, u.z * s);
}
-inline Vector operator*(Vector u, float s)
+inline Vector operator*(Vector u, float s)
{
return Vector(u.x * s, u.y * s, u.z * s);
}
-inline Vector operator/(Vector u, float s)
+inline Vector operator/(Vector u, float s)
{
return Vector(u.x / s, u.y / s, u.z / s);
}
// triple scalar product (u dot (v cross w))
-inline float TripleScalarProduct(Vector u, Vector v, Vector w)
+inline float TripleScalarProduct(Vector u, Vector v, Vector w)
{
- return float( (u.x * (v.y * w.z - v.z * w.y)) +
+ return float( (u.x * (v.y * w.z - v.z * w.y)) +
(u.y * (-v.x * w.z + v.z * w.x)) +
(u.z * (v.x * w.y - v.y * w.x)) );
//return u*(v^w);
{
public:
// elements eij: i -> row, j -> column
- float e11, e12, e13, e21, e22, e23, e31, e32, e33;
+ float e11, e12, e13, e21, e22, e23, e31, e32, e33;
Matrix3x3(void);
- Matrix3x3( float r1c1, float r1c2, float r1c3,
+ Matrix3x3( float r1c1, float r1c2, float r1c3,
float r2c1, float r2c2, float r2c3,
float r3c1, float r3c2, float r3c3 );
- float det(void);
- Matrix3x3 Transpose(void);
- Matrix3x3 Inverse(void);
+ float det(void);
+ Matrix3x3 Transpose(void);
+ Matrix3x3 Inverse(void);
Matrix3x3& operator+=(Matrix3x3 m);
Matrix3x3& operator-=(Matrix3x3 m);
Matrix3x3& operator/=(float s);
};
-inline Matrix3x3 operator+(Matrix3x3 m1, Matrix3x3 m2);
-inline Matrix3x3 operator-(Matrix3x3 m1, Matrix3x3 m2);
-inline Matrix3x3 operator/(Matrix3x3 m, float s);
-inline Matrix3x3 operator*(Matrix3x3 m1, Matrix3x3 m2);
-inline Matrix3x3 operator*(Matrix3x3 m, float s);
-inline Matrix3x3 operator*(float s, Matrix3x3 m);
-inline Vector operator*(Matrix3x3 m, Vector u);
-inline Vector operator*(Vector u, Matrix3x3 m);
+inline Matrix3x3 operator+(Matrix3x3 m1, Matrix3x3 m2);
+inline Matrix3x3 operator-(Matrix3x3 m1, Matrix3x3 m2);
+inline Matrix3x3 operator/(Matrix3x3 m, float s);
+inline Matrix3x3 operator*(Matrix3x3 m1, Matrix3x3 m2);
+inline Matrix3x3 operator*(Matrix3x3 m, float s);
+inline Matrix3x3 operator*(float s, Matrix3x3 m);
+inline Vector operator*(Matrix3x3 m, Vector u);
+inline Vector operator*(Vector u, Matrix3x3 m);
-inline Matrix3x3::Matrix3x3(void)
+inline Matrix3x3::Matrix3x3(void)
{
e11 = 0;
e12 = 0;
e33 = 0;
}
-inline Matrix3x3::Matrix3x3( float r1c1, float r1c2, float r1c3,
+inline Matrix3x3::Matrix3x3( float r1c1, float r1c2, float r1c3,
float r2c1, float r2c2, float r2c3,
float r3c1, float r3c2, float r3c3 )
{
e33 = r3c3;
}
-inline float Matrix3x3::det(void)
+inline float Matrix3x3::det(void)
{
- return e11 * e22 * e33 -
+ return e11 * e22 * e33 -
e11 * e32 * e23 +
e21 * e32 * e13 -
e21 * e12 * e33 +
e31 * e22 * e13;
}
-inline Matrix3x3 Matrix3x3::Transpose(void)
+inline Matrix3x3 Matrix3x3::Transpose(void)
{
return Matrix3x3(e11, e21, e31, e12, e22, e32, e13, e23, e33);
}
-inline Matrix3x3 Matrix3x3::Inverse(void)
+inline Matrix3x3 Matrix3x3::Inverse(void)
{
- float d = e11 * e22 * e33 -
+ float d = e11 * e22 * e33 -
e11 * e32 * e23 +
e21 * e32 * e13 -
e21 * e12 * e33 +
if (d == 0)
d = 1;
- return Matrix3x3( (e22 * e33 - e23 * e32) / d,
+ return Matrix3x3( (e22 * e33 - e23 * e32) / d,
-(e12 * e33 - e13 * e32) / d,
(e12 * e23 - e13 * e22) / d,
-(e21 * e33 - e23 * e31) / d,
(e11 * e22 - e12 * e21) / d );
}
-inline Matrix3x3& Matrix3x3::operator+=(Matrix3x3 m)
+inline Matrix3x3& Matrix3x3::operator+=(Matrix3x3 m)
{
e11 += m.e11;
e12 += m.e12;
return *this;
}
-inline Matrix3x3& Matrix3x3::operator-=(Matrix3x3 m)
+inline Matrix3x3& Matrix3x3::operator-=(Matrix3x3 m)
{
e11 -= m.e11;
e12 -= m.e12;
return *this;
}
-inline Matrix3x3& Matrix3x3::operator*=(float s)
+inline Matrix3x3& Matrix3x3::operator*=(float s)
{
e11 *= s;
e12 *= s;
return *this;
}
-inline Matrix3x3& Matrix3x3::operator/=(float s)
+inline Matrix3x3& Matrix3x3::operator/=(float s)
{
e11 /= s;
e12 /= s;
return *this;
}
-inline Matrix3x3 operator+(Matrix3x3 m1, Matrix3x3 m2)
+inline Matrix3x3 operator+(Matrix3x3 m1, Matrix3x3 m2)
{
- return Matrix3x3( m1.e11 + m2.e11,
+ return Matrix3x3( m1.e11 + m2.e11,
m1.e12 + m2.e12,
m1.e13 + m2.e13,
m1.e21 + m2.e21,
m1.e33 + m2.e33);
}
-inline Matrix3x3 operator-(Matrix3x3 m1, Matrix3x3 m2)
+inline Matrix3x3 operator-(Matrix3x3 m1, Matrix3x3 m2)
{
- return Matrix3x3( m1.e11 - m2.e11,
+ return Matrix3x3( m1.e11 - m2.e11,
m1.e12 - m2.e12,
m1.e13 - m2.e13,
m1.e21 - m2.e21,
m1.e33 - m2.e33);
}
-inline Matrix3x3 operator/(Matrix3x3 m, float s)
+inline Matrix3x3 operator/(Matrix3x3 m, float s)
{
- return Matrix3x3( m.e11 / s,
+ return Matrix3x3( m.e11 / s,
m.e12 / s,
m.e13 / s,
m.e21 / s,
m.e33 / s);
}
-inline Matrix3x3 operator*(Matrix3x3 m1, Matrix3x3 m2)
+inline Matrix3x3 operator*(Matrix3x3 m1, Matrix3x3 m2)
{
- return Matrix3x3( m1.e11 * m2.e11 + m1.e12 * m2.e21 + m1.e13 * m2.e31,
+ return Matrix3x3( m1.e11 * m2.e11 + m1.e12 * m2.e21 + m1.e13 * m2.e31,
m1.e11 * m2.e12 + m1.e12 * m2.e22 + m1.e13 * m2.e32,
m1.e11 * m2.e13 + m1.e12 * m2.e23 + m1.e13 * m2.e33,
m1.e21 * m2.e11 + m1.e22 * m2.e21 + m1.e23 * m2.e31,
m1.e31 * m2.e13 + m1.e32 * m2.e23 + m1.e33 * m2.e33 );
}
-inline Matrix3x3 operator*(Matrix3x3 m, float s)
+inline Matrix3x3 operator*(Matrix3x3 m, float s)
{
- return Matrix3x3( m.e11 * s,
+ return Matrix3x3( m.e11 * s,
m.e12 * s,
m.e13 * s,
m.e21 * s,
m.e33 * s);
}
-inline Matrix3x3 operator*(float s, Matrix3x3 m)
+inline Matrix3x3 operator*(float s, Matrix3x3 m)
{
- return Matrix3x3( m.e11 * s,
+ return Matrix3x3( m.e11 * s,
m.e12 * s,
m.e13 * s,
m.e21 * s,
m.e33 * s);
}
-inline Vector operator*(Matrix3x3 m, Vector u)
+inline Vector operator*(Matrix3x3 m, Vector u)
{
- return Vector( m.e11 * u.x + m.e12 * u.y + m.e13 * u.z,
+ return Vector( m.e11 * u.x + m.e12 * u.y + m.e13 * u.z,
m.e21 * u.x + m.e22 * u.y + m.e23 * u.z,
m.e31 * u.x + m.e32 * u.y + m.e33 * u.z);
}
-inline Vector operator*(Vector u, Matrix3x3 m)
+inline Vector operator*(Vector u, Matrix3x3 m)
{
- return Vector( u.x * m.e11 + u.y * m.e21 + u.z * m.e31,
+ return Vector( u.x * m.e11 + u.y * m.e21 + u.z * m.e31,
u.x * m.e12 + u.y * m.e22 + u.z * m.e32,
u.x * m.e13 + u.y * m.e23 + u.z * m.e33);
}
class Quaternion
{
public:
- float n; // number (scalar) part
- Vector v; // vector part: v.x, v.y, v.z
+ float n; // number (scalar) part
+ Vector v; // vector part: v.x, v.y, v.z
Quaternion(void);
Quaternion(float e0, float e1, float e2, float e3);
- float Magnitude(void);
- Vector GetVector(void);
- float GetScalar(void);
- Quaternion operator+=(Quaternion q);
- Quaternion operator-=(Quaternion q);
+ float Magnitude(void);
+ Vector GetVector(void);
+ float GetScalar(void);
+ Quaternion operator+=(Quaternion q);
+ Quaternion operator-=(Quaternion q);
Quaternion operator*=(float s);
Quaternion operator/=(float s);
- Quaternion operator~(void) const {
+ Quaternion operator~(void) const {
return Quaternion(n, -v.x, -v.y, -v.z);
}
};
-inline Quaternion operator+(Quaternion q1, Quaternion q2);
-inline Quaternion operator-(Quaternion q1, Quaternion q2);
-inline Quaternion operator*(Quaternion q1, Quaternion q2);
-inline Quaternion operator*(Quaternion q, float s);
-inline Quaternion operator*(float s, Quaternion q);
-inline Quaternion operator*(Quaternion q, Vector v);
-inline Quaternion operator*(Vector v, Quaternion q);
-inline Quaternion operator/(Quaternion q, float s);
-inline float QGetAngle(Quaternion q);
-inline Vector QGetAxis(Quaternion q);
-inline Quaternion QRotate(Quaternion q1, Quaternion q2);
-inline Vector QVRotate(Quaternion q, Vector v);
-inline Quaternion MakeQFromEulerAngles(float x, float y, float z);
-inline Vector MakeEulerAnglesFromQ(Quaternion q);
+inline Quaternion operator+(Quaternion q1, Quaternion q2);
+inline Quaternion operator-(Quaternion q1, Quaternion q2);
+inline Quaternion operator*(Quaternion q1, Quaternion q2);
+inline Quaternion operator*(Quaternion q, float s);
+inline Quaternion operator*(float s, Quaternion q);
+inline Quaternion operator*(Quaternion q, Vector v);
+inline Quaternion operator*(Vector v, Quaternion q);
+inline Quaternion operator/(Quaternion q, float s);
+inline float QGetAngle(Quaternion q);
+inline Vector QGetAxis(Quaternion q);
+inline Quaternion QRotate(Quaternion q1, Quaternion q2);
+inline Vector QVRotate(Quaternion q, Vector v);
+inline Quaternion MakeQFromEulerAngles(float x, float y, float z);
+inline Vector MakeEulerAnglesFromQ(Quaternion q);
-inline Quaternion::Quaternion(void)
+inline Quaternion::Quaternion(void)
{
n = 0;
v.x = 0;
v.z = 0;
}
-inline Quaternion::Quaternion(float e0, float e1, float e2, float e3)
+inline Quaternion::Quaternion(float e0, float e1, float e2, float e3)
{
n = e0;
v.x = e1;
v.z = e3;
}
-inline float Quaternion::Magnitude(void)
+inline float Quaternion::Magnitude(void)
{
return (float) sqrt(n * n + v.x * v.x + v.y * v.y + v.z * v.z);
}
-inline Vector Quaternion::GetVector(void)
+inline Vector Quaternion::GetVector(void)
{
return Vector(v.x, v.y, v.z);
}
-inline float Quaternion::GetScalar(void)
+inline float Quaternion::GetScalar(void)
{
return n;
}
-inline Quaternion Quaternion::operator+=(Quaternion q)
+inline Quaternion Quaternion::operator+=(Quaternion q)
{
n += q.n;
v.x += q.v.x;
return *this;
}
-inline Quaternion Quaternion::operator-=(Quaternion q)
+inline Quaternion Quaternion::operator-=(Quaternion q)
{
n -= q.n;
v.x -= q.v.x;
return *this;
}
-inline Quaternion Quaternion::operator*=(float s)
+inline Quaternion Quaternion::operator*=(float s)
{
n *= s;
v.x *= s;
return *this;
}
-inline Quaternion Quaternion::operator/=(float s)
+inline Quaternion Quaternion::operator/=(float s)
{
n /= s;
v.x /= s;
return *this;
}
-/*inline Quaternion Quaternion::operator~()
+/*inline Quaternion Quaternion::operator~()
{
return Quaternion(n, -v.x, -v.y, -v.z);
}*/
-inline Quaternion operator+(Quaternion q1, Quaternion q2)
+inline Quaternion operator+(Quaternion q1, Quaternion q2)
{
- return Quaternion( q1.n + q2.n,
+ return Quaternion( q1.n + q2.n,
q1.v.x + q2.v.x,
q1.v.y + q2.v.y,
q1.v.z + q2.v.z);
}
-inline Quaternion operator-(Quaternion q1, Quaternion q2)
+inline Quaternion operator-(Quaternion q1, Quaternion q2)
{
- return Quaternion( q1.n - q2.n,
+ return Quaternion( q1.n - q2.n,
q1.v.x - q2.v.x,
q1.v.y - q2.v.y,
q1.v.z - q2.v.z);
}
-inline Quaternion operator*(Quaternion q1, Quaternion q2)
+inline Quaternion operator*(Quaternion q1, Quaternion q2)
{
- return Quaternion( q1.n * q2.n - q1.v.x * q2.v.x - q1.v.y * q2.v.y - q1.v.z * q2.v.z,
+ return Quaternion( q1.n * q2.n - q1.v.x * q2.v.x - q1.v.y * q2.v.y - q1.v.z * q2.v.z,
q1.n * q2.v.x + q1.v.x * q2.n + q1.v.y * q2.v.z - q1.v.z * q2.v.y,
q1.n * q2.v.y + q1.v.y * q2.n + q1.v.z * q2.v.x - q1.v.x * q2.v.z,
q1.n * q2.v.z + q1.v.z * q2.n + q1.v.x * q2.v.y - q1.v.y * q2.v.x);
}
-inline Quaternion operator*(Quaternion q, float s)
+inline Quaternion operator*(Quaternion q, float s)
{
- return Quaternion(q.n * s, q.v.x * s, q.v.y * s, q.v.z * s);
+ return Quaternion(q.n * s, q.v.x * s, q.v.y * s, q.v.z * s);
}
-inline Quaternion operator*(float s, Quaternion q)
+inline Quaternion operator*(float s, Quaternion q)
{
- return Quaternion(q.n * s, q.v.x * s, q.v.y * s, q.v.z * s);
+ return Quaternion(q.n * s, q.v.x * s, q.v.y * s, q.v.z * s);
}
-inline Quaternion operator*(Quaternion q, Vector v)
+inline Quaternion operator*(Quaternion q, Vector v)
{
- return Quaternion( -(q.v.x * v.x + q.v.y * v.y + q.v.z * v.z),
+ return Quaternion( -(q.v.x * v.x + q.v.y * v.y + q.v.z * v.z),
q.n * v.x + q.v.y * v.z - q.v.z * v.y,
q.n * v.y + q.v.z * v.x - q.v.x * v.z,
q.n * v.z + q.v.x * v.y - q.v.y * v.x);
}
-inline Quaternion operator*(Vector v, Quaternion q)
+inline Quaternion operator*(Vector v, Quaternion q)
{
- return Quaternion( -(q.v.x * v.x + q.v.y * v.y + q.v.z * v.z),
+ return Quaternion( -(q.v.x * v.x + q.v.y * v.y + q.v.z * v.z),
q.n * v.x + q.v.z * v.y - q.v.y * v.z,
q.n * v.y + q.v.x * v.z - q.v.z * v.x,
q.n * v.z + q.v.y * v.x - q.v.x * v.y);
}
-inline Quaternion operator/(Quaternion q, float s)
+inline Quaternion operator/(Quaternion q, float s)
{
- return Quaternion(q.n / s, q.v.x / s, q.v.y / s, q.v.z / s);
+ return Quaternion(q.n / s, q.v.x / s, q.v.y / s, q.v.z / s);
}
-inline float QGetAngle(Quaternion q)
+inline float QGetAngle(Quaternion q)
{
- return (float) (2 * acosf(q.n));
+ return (float) (2 * acosf(q.n));
}
-inline Vector QGetAxis(Quaternion q)
+inline Vector QGetAxis(Quaternion q)
{
Vector v;
float m;
return v / m;
}
-inline Quaternion QRotate(Quaternion q1, Quaternion q2)
+inline Quaternion QRotate(Quaternion q1, Quaternion q2)
{
- return q1 * q2 * (~q1);
+ return q1 * q2 * (~q1);
}
-inline Vector QVRotate(Quaternion q, Vector v)
+inline Vector QVRotate(Quaternion q, Vector v)
{
Quaternion t;
t = q * v * (~q);
- return t.GetVector();
+ return t.GetVector();
}
-inline Quaternion MakeQFromEulerAngles(float x, float y, float z)
+inline Quaternion MakeQFromEulerAngles(float x, float y, float z)
{
- Quaternion q;
- double roll = DegreesToRadians(x);
- double pitch = DegreesToRadians(y);
- double yaw = DegreesToRadians(z);
+ Quaternion q;
+ double roll = DegreesToRadians(x);
+ double pitch = DegreesToRadians(y);
+ double yaw = DegreesToRadians(z);
- double cyaw, cpitch, croll, syaw, spitch, sroll;
- double cyawcpitch, syawspitch, cyawspitch, syawcpitch;
+ double cyaw, cpitch, croll, syaw, spitch, sroll;
+ double cyawcpitch, syawspitch, cyawspitch, syawcpitch;
cyaw = cos(0.5f * yaw);
cpitch = cos(0.5f * pitch);
return q;
}
-inline Vector MakeEulerAnglesFromQ(Quaternion q)
+inline Vector MakeEulerAnglesFromQ(Quaternion q)
{
- double r11, r21, r31, r32, r33;
- double q00, q11, q22, q33;
- double tmp;
- Vector u;
+ double r11, r21, r31, r32, r33;
+ double q00, q11, q22, q33;
+ double tmp;
+ Vector u;
q00 = q.n * q.n;
q11 = q.v.x * q.v.x;
}
u.x = RadiansToDegrees((float) atan2(r32, r33)); // roll
- u.y = RadiansToDegrees((float) asinf(-r31)); // pitch
+ u.y = RadiansToDegrees((float) asinf(-r31)); // pitch
u.z = RadiansToDegrees((float) atan2(r21, r11)); // yaw
return u;
return 0.0;
asm {
- frsqrte result, arg // Calculate Square root
+ frsqrte result, arg // Calculate Square root
}
// Newton Rhapson iterations.
selected = 0;
memset(forwardjoints, 0, sizeof(forwardjoints));
- // XYZ forward;
+ // XYZ forward;
id = 0;
memset(lowforwardjoints, 0, sizeof(lowforwardjoints));
- // XYZ lowforward;
+ // XYZ lowforward;
- // XYZ specialforward[5];
+ // XYZ specialforward[5];
memset(jointlabels, 0, sizeof(jointlabels));
- // Model model[7];
- // Model modellow;
- // Model modelclothes;
+ // Model model[7];
+ // Model modellow;
+ // Model modelclothes;
num_models = 0;
- // Model drawmodel;
- // Model drawmodellow;
- // Model drawmodelclothes;
+ // Model drawmodel;
+ // Model drawmodellow;
+ // Model drawmodelclothes;
clothes = 0;
spinny = 0;
extern float skyboxg;
extern float skyboxb;
-void
-SkyBox::load (const char *ffront, const char *fleft, const char *fback,
- const char *fright, const char *fup, const char *fdown)
+void SkyBox::load (const char *ffront, const char *fleft, const char *fback,
+ const char *fright, const char *fup, const char *fdown)
{
front.load(ffront, true, false);
left.load(fleft, true, false);
down.load(fdown, true, false);
}
-void SkyBox::draw()
+void SkyBox::draw()
{
static float size = viewdistance / 4;
glPushMatrix();
}
lasttype = sprites[i]->type;
lastspecial = sprites[i]->special;
- glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
+ glMatrixMode(GL_MODELVIEW);
glPushMatrix();
glTranslatef(sprites[i]->position.x, sprites[i]->position.y, sprites[i]->position.z);
if ((sprites[i]->type == flamesprite || sprites[i]->type == weaponflamesprite || sprites[i]->type == weaponshinesprite)) {
char fileName[256];
CopyPascalStringToC( filePath, fileName);
/*
- // change extension to .TGA
- int len = strlen( fileName);
- if (len > 3)
- {
- fileName[ len - 3] = 't';
- fileName[ len - 2] = 'g';
- fileName[ len - 1] = 'a';
- }
+ // change extension to .TGA
+ int len = strlen( fileName);
+ if (len > 3)
+ {
+ fileName[ len - 3] = 't';
+ fileName[ len - 2] = 'g';
+ fileName[ len - 1] = 'a';
+ }
*/
-// return (LoadTGA( fileName) != NULL);
+//return (LoadTGA( fileName) != NULL);
return (LoadImage(fileName, texture));
#else
DisposeGWorld(gw);
// Loop Through The Image Data
- GLuint imageSize; // Used To Store The Image Size When Setting Aside Ram
- GLuint temp; // Temporary Variable
- GLuint bytesPerPixel; // Temporary Variable
+ GLuint imageSize; // Used To Store The Image Size When Setting Aside Ram
+ GLuint temp; // Temporary Variable
+ GLuint bytesPerPixel; // Temporary Variable
bytesPerPixel = texture.bpp / 8;
imageSize = texture.sizeX * texture.sizeY * bytesPerPixel;
//~ int alltrans=10;
for ( GLuint i = 0; i < int( imageSize ); i += 4 ) {
// Swaps The 1st And 3rd Bytes ('R'ed and 'B'lue)
- temp = texture.data[i]; // Temporarily Store The Value At Image Data 'i'
- texture.data[i] = texture.data[i + 1]; // Set The 1st Byte To The Value Of The 3rd Byte
- texture.data[i + 1] = texture.data[i + 2]; // Set The 3rd Byte To The Value In 'temp' (1st Byte Value)
+ temp = texture.data[i]; // Temporarily Store The Value At Image Data 'i'
+ texture.data[i] = texture.data[i + 1]; // Set The 1st Byte To The Value Of The 3rd Byte
+ texture.data[i + 1] = texture.data[i + 2]; // Set The 3rd Byte To The Value In 'temp' (1st Byte Value)
texture.data[i + 2] = texture.data[i + 3];
texture.data[i + 3] = temp;
}
if (!hasalpha) {
for ( GLuint i = 0; i < int( imageSize ); i += 4 ) {
texture.data[i + 3] = 255;
- /*texture.data[tempplace] = texture.data[i]; // Set The 1st Byte To The Value Of The 3rd Byte
- texture.data[tempplace + 1] = texture.data[i + 1]; // Set The 3rd Byte To The Value In 'temp' (1st Byte Value)
+ /*texture.data[tempplace] = texture.data[i]; // Set The 1st Byte To The Value Of The 3rd Byte
+ texture.data[tempplace + 1] = texture.data[i + 1]; // Set The 3rd Byte To The Value In 'temp' (1st Byte Value)
texture.data[tempplace + 2] = texture.data[i + 2];
tempplace+=3;*/
}
howmany = 0;
for ( GLuint l = 0; l < texdetail * texture.sizeX ; l += texture.sizeX ) {
for ( GLuint j = 0; j < texdetail ; j ++ ) {
- temp += (int)texture.data[k + i + j * bytesPerPixel + l * bytesPerPixel + b]; // Set The 1st Byte To The Value Of The 3rd Byte
+ temp += (int)texture.data[k + i + j * bytesPerPixel + l * bytesPerPixel + b]; // Set The 1st Byte To The Value Of The 3rd Byte
howmany++;
}
}
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-#ifndef _TGA_LOADER_H_
-#define _TGA_LOADER_H_
+#ifndef _TGA_LOADER_H_
+#define _TGA_LOADER_H_
#ifdef _MSC_VER
#pragma once
#include "GL/gl.h"
#else
#include "gamegl.h"
-// #include "MoreFilesX.h"
+// #include "MoreFilesX.h"
#endif
//#include <stdbool.h>
/**> DATA STRUCTURES <**/
typedef struct TGAImageRec {
- GLubyte *data; // Image Data (Up To 32 Bits)
- GLuint bpp; // Image Color Depth In Bits Per Pixel.
- GLuint sizeX;
- GLuint sizeY;
-} TGAImageRec;
+ GLubyte *data; // Image Data (Up To 32 Bits)
+ GLuint bpp; // Image Color Depth In Bits Per Pixel.
+ GLuint sizeX;
+ GLuint sizeY;
+} TGAImageRec;
bool upload_image(const unsigned char* filePath, bool hasalpha);
bool Terrain::load(const char *fileName)
{
- static long i, j;
+ static long i, j;
static long x, y;
static float patch_size;
for(j=0;j<size;j++){
total=0;
todivide=0;
- if(i!=0){ total+=opacityother[j][i-1]; todivide++;}
- if(i!=size-1){ total+=opacityother[j][i+1]; todivide++;}
- if(j!=0){ total+=opacityother[j-1][i]; todivide++;}
- if(j!=size-1){ total+=opacityother[j+1][i]; todivide++;}
- if(i!=0&&j!=0){ total+=opacityother[j-1][i-1]; todivide++;}
- if(i!=size-1&&j!=0){ total+=opacityother[j-1][i+1]; todivide++;}
- if(j!=size-1&&i!=size-1){ total+=opacityother[j+1][i+1]; todivide++;}
- if(j!=size-1&&i!=0){ total+=opacityother[j+1][i-1]; todivide++;}
+ if(i!=0){total+=opacityother[j][i-1]; todivide++;}
+ if(i!=size-1){total+=opacityother[j][i+1]; todivide++;}
+ if(j!=0){total+=opacityother[j-1][i]; todivide++;}
+ if(j!=size-1){total+=opacityother[j+1][i]; todivide++;}
+ if(i!=0&&j!=0){total+=opacityother[j-1][i-1]; todivide++;}
+ if(i!=size-1&&j!=0){total+=opacityother[j-1][i+1]; todivide++;}
+ if(j!=size-1&&i!=size-1){total+=opacityother[j+1][i+1]; todivide++;}
+ if(j!=size-1&&i!=0){total+=opacityother[j+1][i-1]; todivide++;}
total+=opacityother[j][i]; todivide++;
opacityother[j][i]=total/(float)todivide;
if (opacity == 1 && j != subdivision && i != subdivision)
if (distance[i + 1][j + 1] > viewdistsquared * fadestart - viewdistsquared)
opacity = 0;
- glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
+ glMatrixMode(GL_MODELVIEW);
glPushMatrix();
if (frustum.CubeInFrustum(i * patch_size + patch_size * .5, avgypatch[i][j], j * patch_size + patch_size * .5, heightypatch[i][j] / 2)) {
if (environment == desertenvironment && distance[i][j] > viewdistsquared / 4)
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP);
- glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
+ glMatrixMode(GL_MODELVIEW);
glPushMatrix();
glBegin(GL_TRIANGLES);
for (int j = 0; j < 3; j++) {
#include "Quaternions.h"
#include "Texture.h"
-#define max_terrain_size 256
-#define curr_terrain_size size
-#define subdivision 64
-#define max_patch_elements (max_terrain_size/subdivision)*(max_terrain_size/subdivision)*54
+#define max_terrain_size 256
+#define curr_terrain_size size
+#define subdivision 64
+#define max_patch_elements (max_terrain_size/subdivision)*(max_terrain_size/subdivision)*54
#define allfirst 0
#define mixed 1
Texture bodyprinttexture;
Texture breaktexture;
Texture terraintexture;
- short size;
+ short size;
int patchobjectnum[subdivision][subdivision];
int patchobjects[subdivision][subdivision][300];
void Text::LoadFontTexture(const char *fileName)
{
- GLuint type;
+ GLuint type;
LOGFUNC;
FontTexture.load(fileName, false, false);
/*
- //Load Image
- //LoadTGA( fileName );
- unsigned char fileNamep[256];
- CopyCStringToPascal(fileName,fileNamep);
- //Load Image
- upload_image( fileNamep ,1);
-
- //Is it valid?
- if(1==1){
- //Alpha channel?
- if ( texture.bpp == 24 )
- type = GL_RGB;
- else
- type = GL_RGBA;
-
- glPixelStorei( GL_UNPACK_ALIGNMENT, 1 );
-
- if(!FontTexture)glGenTextures( 1, &FontTexture );
- glTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE );
-
- glBindTexture( GL_TEXTURE_2D, FontTexture);
- glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR );
- glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR );
-
- gluBuild2DMipmaps( GL_TEXTURE_2D, type, texture.sizeX, texture.sizeY, type, GL_UNSIGNED_BYTE, texture.data );
- }
+ //Load Image
+ //LoadTGA( fileName );
+ unsigned char fileNamep[256];
+ CopyCStringToPascal(fileName,fileNamep);
+ //Load Image
+ upload_image( fileNamep ,1);
+
+ //Is it valid?
+ if(1==1){
+ //Alpha channel?
+ if ( texture.bpp == 24 )
+ type = GL_RGB;
+ else
+ type = GL_RGBA;
+
+ glPixelStorei( GL_UNPACK_ALIGNMENT, 1 );
+
+ if(!FontTexture)glGenTextures( 1, &FontTexture );
+ glTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE );
+
+ glBindTexture( GL_TEXTURE_2D, FontTexture);
+ glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR );
+ glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR );
+
+ gluBuild2DMipmaps( GL_TEXTURE_2D, type, texture.sizeX, texture.sizeY, type, GL_UNSIGNED_BYTE, texture.data );
+ }
*/
if (base) {
glDeleteLists(base, 512);
}
}
-void Text::BuildFont() // Build Our Font Display List
+void Text::BuildFont() // Build Our Font Display List
{
- float cx; // Holds Our X Character Coord
- float cy; // Holds Our Y Character Coord
+ float cx; // Holds Our X Character Coord
+ float cy; // Holds Our Y Character Coord
int loop;
LOGFUNC;
//return;
}
-// base=glGenLists(256); // Creating 256 Display Lists
- base = glGenLists(512); // Creating 256 Display Lists
+//base=glGenLists(256); // Creating 256 Display Lists
+ base = glGenLists(512); // Creating 256 Display Lists
FontTexture.bind();
- for (loop = 0; loop < 512; loop++) { // Loop Through All 256 Lists
+ for (loop = 0; loop < 512; loop++) { // Loop Through All 256 Lists
if (loop < 256) {
- cx = float(loop % 16) / 16.0f; // X Position Of Current Character
- cy = float(loop / 16) / 16.0f; // Y Position Of Current Character
+ cx = float(loop % 16) / 16.0f; // X Position Of Current Character
+ cy = float(loop / 16) / 16.0f; // Y Position Of Current Character
} else {
- cx = float((loop - 256) % 16) / 16.0f; // X Position Of Current Character
- cy = float((loop - 256) / 16) / 16.0f; // Y Position Of Current Character
+ cx = float((loop - 256) % 16) / 16.0f; // X Position Of Current Character
+ cy = float((loop - 256) / 16) / 16.0f; // Y Position Of Current Character
}
- glNewList(base + loop, GL_COMPILE); // Start Building A List
- glBegin(GL_QUADS); // Use A Quad For Each Character
- glTexCoord2f(cx, 1 - cy - 0.0625f + .001); // Texture Coord (Bottom Left)
- glVertex2i(0, 0); // Vertex Coord (Bottom Left)
- glTexCoord2f(cx + 0.0625f, 1 - cy - 0.0625f + .001); // Texture Coord (Bottom Right)
- glVertex2i(16, 0); // Vertex Coord (Bottom Right)
- glTexCoord2f(cx + 0.0625f, 1 - cy - .001); // Texture Coord (Top Right)
- glVertex2i(16, 16); // Vertex Coord (Top Right)
- glTexCoord2f(cx, 1 - cy - +.001); // Texture Coord (Top Left)
- glVertex2i(0, 16); // Vertex Coord (Top Left)
- glEnd(); // Done Building Our Quad (Character)
+ glNewList(base + loop, GL_COMPILE); // Start Building A List
+ glBegin(GL_QUADS); // Use A Quad For Each Character
+ glTexCoord2f(cx, 1 - cy - 0.0625f + .001); // Texture Coord (Bottom Left)
+ glVertex2i(0, 0); // Vertex Coord (Bottom Left)
+ glTexCoord2f(cx + 0.0625f, 1 - cy - 0.0625f + .001); // Texture Coord (Bottom Right)
+ glVertex2i(16, 0); // Vertex Coord (Bottom Right)
+ glTexCoord2f(cx + 0.0625f, 1 - cy - .001); // Texture Coord (Top Right)
+ glVertex2i(16, 16); // Vertex Coord (Top Right)
+ glTexCoord2f(cx, 1 - cy - +.001); // Texture Coord (Top Left)
+ glVertex2i(0, 16); // Vertex Coord (Top Left)
+ glEnd(); // Done Building Our Quad (Character)
if (loop < 256)
- glTranslated(10, 0, 0); // Move To The Right Of The Character
+ glTranslated(10, 0, 0); // Move To The Right Of The Character
else
- glTranslated(8, 0, 0); // Move To The Right Of The Character
- glEndList(); // Done Building The Display List
- } // Loop Until All 256 Are Built
+ glTranslated(8, 0, 0); // Move To The Right Of The Character
+ glEndList(); // Done Building The Display List
+ } // Loop Until All 256 Are Built
}
-void Text::glPrint(float x, float y, const char *string, int set, float size, float width, float height) // Where The Printing Happens
+void Text::glPrint(float x, float y, const char *string, int set, float size, float width, float height) // Where The Printing Happens
{
glPrint(x, y, string, set, size, width, height, 0, strlen(string));
}
-void Text::_glPrint(float x, float y, const char *string, int set, float size, float width, float height, int start, int end, int offset) // Where The Printing Happens
+void Text::_glPrint(float x, float y, const char *string, int set, float size, float width, float height, int start, int end, int offset) // Where The Printing Happens
{
if (set > 1) {
set = 1;
}
glTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE );
FontTexture.bind();
- glDisable(GL_DEPTH_TEST); // Disables Depth Testing
+ glDisable(GL_DEPTH_TEST);
glDisable(GL_LIGHTING);
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
- glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
- glPushMatrix(); // Store The Projection Matrix
- glLoadIdentity(); // Reset The Projection Matrix
- glOrtho(0, width, 0, height, -100, 100); // Set Up An Ortho Screen
- glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
- glPushMatrix(); // Store The Modelview Matrix
+ glMatrixMode(GL_PROJECTION);
+ glPushMatrix();
+ glLoadIdentity();
+ glOrtho(0, width, 0, height, -100, 100);
+ glMatrixMode(GL_MODELVIEW);
+ glPushMatrix();
glLoadIdentity();
- glTranslated(x, y, 0); // Position The Text (0,0 - Bottom Left)
- glScalef(size, size, 1); // Reset The Modelview Matrix
- glListBase(base - 32 + (128 * set) + offset); // Choose The Font Set (0 or 1)
- glCallLists(end - start, GL_BYTE, &string[start]); // Write The Text To The Screen
- 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
+ glTranslated(x, y, 0);
+ glScalef(size, size, 1);
+ glListBase(base - 32 + (128 * set) + offset); // Choose The Font Set (0 or 1)
+ glCallLists(end - start, GL_BYTE, &string[start]); // Write The Text To The Screen
+ glMatrixMode(GL_PROJECTION);
+ glPopMatrix();
+ glMatrixMode(GL_MODELVIEW);
+ glPopMatrix();
+ glEnable(GL_DEPTH_TEST);
glTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE );
}
-void Text::glPrint(float x, float y, const char *string, int set, float size, float width, float height, int start, int end) // Where The Printing Happens
+void Text::glPrint(float x, float y, const char *string, int set, float size, float width, float height, int start, int end) // Where The Printing Happens
{
_glPrint(x, y, string, set, size, width, height, start, end, 0);
}
-void Text::glPrintOutline(float x, float y, const char *string, int set, float size, float width, float height) // Where The Printing Happens
+void Text::glPrintOutline(float x, float y, const char *string, int set, float size, float width, float height) // Where The Printing Happens
{
glPrintOutline(x, y, string, set, size, width, height, 0, strlen(string));
}
-void Text::glPrintOutline(float x, float y, const char *string, int set, float size, float width, float height, int start, int end) // Where The Printing Happens
+void Text::glPrintOutline(float x, float y, const char *string, int set, float size, float width, float height, int start, int end) // Where The Printing Happens
{
_glPrint(x, y, string, set, size, width, height, start, end, 256);
}
-void Text::glPrintOutlined(float x, float y, const char *string, int set, float size, float width, float height) // Where The Printing Happens
+void Text::glPrintOutlined(float x, float y, const char *string, int set, float size, float width, float height) // Where The Printing Happens
{
glPrintOutlined(1, 1, 1, x, y, string, set, size, width, height);
}
-void Text::glPrintOutlined(float r, float g, float b, float x, float y, const char *string, int set, float size, float width, float height) // Where The Printing Happens
+void Text::glPrintOutlined(float r, float g, float b, float x, float y, const char *string, int set, float size, float width, float height) // Where The Printing Happens
{
glColor4f(0, 0, 0, 1);
glPrintOutline( x - 2 * size, y - 2 * size, string, set, size * 2.5 / 2, width, height);
distsq(&position, &player[j].coords) < 4 && player[j].weaponstuck == -1 &&
!player[j].skeleton.free && j != oldowner) {
if ((player[j].aitype != attacktypecutoff || abs(Random() % 6) == 0 || (player[j].animTarget != backhandspringanim && player[j].animTarget != rollanim && player[j].animTarget != flipanim && Random() % 2 == 0)) && !missed) {
- if ( (player[j].creature == wolftype && Random() % 3 != 0 && player[j].weaponactive == -1 && (player[j].isIdle() || player[j].isRun() || player[j].animTarget == walkanim)) ||
- (player[j].creature == rabbittype && Random() % 2 == 0 && player[j].aitype == attacktypecutoff && player[j].weaponactive == -1)) {
+ if ( (player[j].creature == wolftype && Random() % 3 != 0 && player[j].weaponactive == -1 && (player[j].isIdle() || player[j].isRun() || player[j].animTarget == walkanim)) ||
+ (player[j].creature == rabbittype && Random() % 2 == 0 && player[j].aitype == attacktypecutoff && player[j].weaponactive == -1)) {
emit_sound_at(knifedrawsound, player[j].coords, 128.);
player[j].weaponactive = 0;
terrain.MakeDecal(shadowdecalpermanent, position, .06, .5, 0);
normalrot = terrain.getNormal(position.x, position.z) * -1;
velocity = 0;
- glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
+ glMatrixMode(GL_MODELVIEW);
glPushMatrix();
GLfloat M[16];
glLoadIdentity();
if (player[owner].occluded < 25)
if ((frustum.SphereInFrustum(player[owner].coords.x, player[owner].coords.y + player[owner].scale * 3, player[owner].coords.z, player[owner].scale * 8) && distsq(&viewer, &player[owner].coords) < viewdistance * viewdistance) || player[owner].skeleton.free == 3)
draw = true;
- if (
+ if (
(player[owner].animTarget == knifeslashstartanim ||
player[owner].animTarget == swordsneakattackanim ||
- (player[owner].animCurrent == staffhitanim && player[owner].frameCurrent > 1) ||
- (player[owner].animCurrent == staffhitreversedanim && player[owner].frameCurrent > 1) ||
- (player[owner].animCurrent == staffspinhitanim && player[owner].frameCurrent > 1) ||
- (player[owner].animCurrent == staffspinhitreversedanim && player[owner].frameCurrent > 1) ||
- (player[owner].animCurrent == staffgroundsmashanim && player[owner].frameCurrent > 1) ||
- (player[owner].animTarget == swordslashanim && player[owner].frameTarget < 7) ||
+ (player[owner].animCurrent == staffhitanim && player[owner].frameCurrent > 1) ||
+ (player[owner].animCurrent == staffhitreversedanim && player[owner].frameCurrent > 1) ||
+ (player[owner].animCurrent == staffspinhitanim && player[owner].frameCurrent > 1) ||
+ (player[owner].animCurrent == staffspinhitreversedanim && player[owner].frameCurrent > 1) ||
+ (player[owner].animCurrent == staffgroundsmashanim && player[owner].frameCurrent > 1) ||
+ (player[owner].animTarget == swordslashanim && player[owner].frameTarget < 7) ||
player[owner].animTarget == crouchstabanim ||
player[owner].animTarget == swordslashreversalanim ||
player[owner].animTarget == swordslashreversedanim ||
glAlphaFunc(GL_GREATER, 0.01);
}
for (int j = drawhowmany; j > 0; j--) {
- glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
+ glMatrixMode(GL_MODELVIEW);
glPushMatrix();
glColor4f(terrainlight.x, terrainlight.y, terrainlight.z, j / drawhowmany);
if (owner == -1)
lastdrawnanim = player[owner].animCurrent;
}
if (owner != -1) {
- glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
+ glMatrixMode(GL_MODELVIEW);
glPushMatrix();
glLoadIdentity();
glTranslatef(position.x, position.y - .02, position.z);
QueryPerformanceFrequency( (LARGE_INTEGER*)&counterRate);
QueryPerformanceCounter( (LARGE_INTEGER*)&baseCounter);
}
- __int64 counterRate; // LARGE_INTEGER type has no math functions so use int64
+ __int64 counterRate; // LARGE_INTEGER type has no math functions so use int64
__int64 baseCounter;
};
static AppTime g_appTime;
unsigned long lo;
} AbsoluteTime;
-AbsoluteTime UpTime(); // NOTE: returns time since app started, not system start
+AbsoluteTime UpTime(); // NOTE: returns time since app started, not system start
typedef long Duration;
/*
inline bool isnormal( double x)
{
- int ret = _fpclass( x);
- return (ret == _FPCLASS_NN || ret == _FPCLASS_PN);
+ int ret = _fpclass( x);
+ return (ret == _FPCLASS_NN || ret == _FPCLASS_PN);
}
*/
#else
typedef unsigned char uint8_t;
typedef unsigned short uint16_t;
- typedef unsigned long uint32_t;
+ typedef unsigned long uint32_t;
#ifdef WIN32
- typedef unsigned __int64 uint64_t;
+ typedef unsigned __int64 uint64_t;
#else
typedef unsigned long long uint64_t;
#endif
typedef unsigned short uint16_t;
typedef unsigned long uint32_t;
#ifdef WIN32
-typedef unsigned __int64 uint64_t;
+typedef unsigned __int64 uint64_t;
#else
typedef unsigned long long uint64_t;
#endif