From 25e3d5e35a7fd7efdffc420efe3c41a91cefe43f Mon Sep 17 00:00:00 2001 From: sf17k Date: Sun, 14 Apr 2013 22:28:24 -0400 Subject: [PATCH] CLEANED UP WHITESPACE and removed some useless comments --- Source/Animation.h | 2 +- Source/Frustum.cpp | 2 +- Source/GameDraw.cpp | 482 ++++++++++++++++++------------------ Source/GameInitDispose.cpp | 176 ++++++------- Source/GameTick.cpp | 66 ++--- Source/Input.cpp | 2 +- Source/Input.h | 6 +- Source/Lights.cpp | 18 +- Source/MacCompatibility.cpp | 2 +- Source/MacCompatibility.h | 2 +- Source/Menu.cpp | 8 +- Source/Models.cpp | 26 +- Source/Models.h | 10 +- Source/Objects.cpp | 6 +- Source/OpenGL_Windows.cpp | 92 +++---- Source/Person.cpp | 2 +- Source/PhysicsMath.h | 294 +++++++++++----------- Source/Quaternions.h | 2 +- Source/Skeleton.cpp | 18 +- Source/Skybox.cpp | 7 +- Source/Sprite.cpp | 2 +- Source/TGALoader.cpp | 36 +-- Source/TGALoader.h | 16 +- Source/Terrain.cpp | 22 +- Source/Terrain.h | 10 +- Source/Text.cpp | 150 +++++------ Source/Weapons.cpp | 24 +- Source/WinDefs.cpp | 2 +- Source/WinDefs.h | 6 +- Source/binio.h | 4 +- Source/private.h | 2 +- 31 files changed, 748 insertions(+), 749 deletions(-) diff --git a/Source/Animation.h b/Source/Animation.h index 8c8d5e5..e982c9a 100644 --- a/Source/Animation.h +++ b/Source/Animation.h @@ -20,7 +20,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef ANIMATION_H -#define ANIMATION_H +#define ANIMATION_H enum anim_attack_type { neutral, normalattack, reversed, reversal diff --git a/Source/Frustum.cpp b/Source/Frustum.cpp index 84d4b8d..2ec54a8 100644 --- a/Source/Frustum.cpp +++ b/Source/Frustum.cpp @@ -36,7 +36,7 @@ GetFrustum() 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]; diff --git a/Source/GameDraw.cpp b/Source/GameDraw.cpp index ee33c5f..83b7ca3 100644 --- a/Source/GameDraw.cpp +++ b/Source/GameDraw.cpp @@ -1022,18 +1022,18 @@ int Game::DrawGLScene(StereoSide side) } 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); @@ -1042,16 +1042,16 @@ int Game::DrawGLScene(StereoSide side) 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); @@ -1147,18 +1147,18 @@ int Game::DrawGLScene(StereoSide side) 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); @@ -1213,11 +1213,11 @@ int Game::DrawGLScene(StereoSide side) 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); @@ -1311,51 +1311,51 @@ int Game::DrawGLScene(StereoSide side) } 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); @@ -1378,16 +1378,16 @@ int Game::DrawGLScene(StereoSide side) 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); @@ -1401,32 +1401,32 @@ int Game::DrawGLScene(StereoSide side) 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); @@ -1464,17 +1464,17 @@ int Game::DrawGLScene(StereoSide side) 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); @@ -1549,13 +1549,13 @@ int Game::DrawGLScene(StereoSide side) 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(); } @@ -1571,13 +1571,13 @@ int Game::DrawGLScene(StereoSide side) 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(); } @@ -1592,13 +1592,13 @@ int Game::DrawGLScene(StereoSide side) 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(); } @@ -1625,57 +1625,57 @@ int Game::DrawGLScene(StereoSide side) 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); @@ -1700,33 +1700,33 @@ int Game::DrawGLScene(StereoSide side) } 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); @@ -1828,17 +1828,17 @@ int Game::DrawGLScene(StereoSide side) 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); @@ -1851,13 +1851,13 @@ int Game::DrawGLScene(StereoSide side) 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(); } @@ -1870,13 +1870,13 @@ int Game::DrawGLScene(StereoSide side) 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); @@ -1884,13 +1884,13 @@ int Game::DrawGLScene(StereoSide side) 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); @@ -1908,13 +1908,13 @@ int Game::DrawGLScene(StereoSide side) 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) { @@ -1925,13 +1925,13 @@ int Game::DrawGLScene(StereoSide side) 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(); } @@ -1944,52 +1944,52 @@ int Game::DrawGLScene(StereoSide side) 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(); } @@ -2001,23 +2001,23 @@ int Game::DrawGLScene(StereoSide side) 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); @@ -2098,17 +2098,17 @@ void DrawMenu() 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); @@ -2142,36 +2142,36 @@ void DrawMenu() 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); @@ -2206,7 +2206,7 @@ void DrawMenu() glPopMatrix(); } glPopMatrix(); - glMatrixMode(GL_PROJECTION); // Select The Projection Matrix + glMatrixMode(GL_PROJECTION); glPopMatrix(); @@ -2219,33 +2219,33 @@ void DrawMenu() 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); diff --git a/Source/GameInitDispose.cpp b/Source/GameInitDispose.cpp index db86503..a02c05b 100644 --- a/Source/GameInitDispose.cpp +++ b/Source/GameInitDispose.cpp @@ -229,9 +229,9 @@ void Game::LoadingScreen() 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; @@ -240,7 +240,7 @@ void Game::LoadingScreen() 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 @@ -262,17 +262,17 @@ void Game::LoadingScreen() 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); @@ -282,13 +282,13 @@ void Game::LoadingScreen() //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); @@ -296,20 +296,20 @@ void Game::LoadingScreen() //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); @@ -317,17 +317,17 @@ void Game::LoadingScreen() 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); @@ -338,20 +338,20 @@ void Game::LoadingScreen() //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); @@ -359,17 +359,17 @@ void Game::LoadingScreen() 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); @@ -379,20 +379,20 @@ void Game::LoadingScreen() //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); @@ -406,33 +406,33 @@ void Game::LoadingScreen() 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); @@ -462,17 +462,17 @@ void FadeLoadingScreen(float howmuch) //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); @@ -482,20 +482,20 @@ void FadeLoadingScreen(float howmuch) //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 diff --git a/Source/GameTick.cpp b/Source/GameTick.cpp index 5403605..4a0229b 100644 --- a/Source/GameTick.cpp +++ b/Source/GameTick.cpp @@ -1311,11 +1311,11 @@ static void cmd_dispatch(const string cmd) /********************> 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) @@ -1509,7 +1509,7 @@ void Setenvironment(int which) 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", @@ -1547,7 +1547,7 @@ void Setenvironment(int which) 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", @@ -1584,7 +1584,7 @@ void Setenvironment(int which) 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", @@ -8507,33 +8507,33 @@ void Game::TickOnceAfter() /* //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)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;j400){ + 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)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 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 @@ -39,7 +39,7 @@ public: 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(); }; diff --git a/Source/Lights.cpp b/Source/Lights.cpp index ab93c86..b8332c3 100644 --- a/Source/Lights.cpp +++ b/Source/Lights.cpp @@ -31,9 +31,9 @@ void SetUpLight(Light* whichsource, int whichlight) //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); @@ -63,9 +63,9 @@ void SetUpLight(Light* whichsource, int whichlight) 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); @@ -83,9 +83,9 @@ void SetUpMainLight(Light* whichsource, int whichlight, float ambientr, float am //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); diff --git a/Source/MacCompatibility.cpp b/Source/MacCompatibility.cpp index 738739d..eb626ba 100644 --- a/Source/MacCompatibility.cpp +++ b/Source/MacCompatibility.cpp @@ -68,7 +68,7 @@ public: 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; diff --git a/Source/MacCompatibility.h b/Source/MacCompatibility.h index 17745cd..92f16b2 100644 --- a/Source/MacCompatibility.h +++ b/Source/MacCompatibility.h @@ -76,7 +76,7 @@ typedef struct AbsoluteTime { 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; diff --git a/Source/Menu.cpp b/Source/Menu.cpp index 8eb10e4..c402c8d 100644 --- a/Source/Menu.cpp +++ b/Source/Menu.cpp @@ -242,10 +242,10 @@ void Menu::drawItems() 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); diff --git a/Source/Models.cpp b/Source/Models.cpp index 65d9ff8..dfa8ad0 100644 --- a/Source/Models.cpp +++ b/Source/Models.cpp @@ -448,8 +448,8 @@ void Model::UpdateVertexArrayNoTexNoNorm() bool Model::loadnotex(const char *filename ) { - FILE *tfile; - long i; + FILE *tfile; + long i; int oldvertexNum, oldTriangleNum; oldvertexNum = vertexNum; @@ -480,7 +480,7 @@ bool Model::loadnotex(const char *filename ) } 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]; @@ -516,8 +516,8 @@ bool Model::loadnotex(const char *filename ) bool Model::load(const char *filename, bool texture ) { - FILE *tfile; - long i; + FILE *tfile; + long i; LOGFUNC; @@ -558,7 +558,7 @@ bool Model::load(const char *filename, bool texture ) } 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]; @@ -595,8 +595,8 @@ bool Model::load(const char *filename, bool texture ) bool Model::loaddecal(const char *filename, bool texture ) { - FILE *tfile; - long i, j; + FILE *tfile; + long i, j; LOGFUNC; @@ -640,7 +640,7 @@ bool Model::loaddecal(const char *filename, bool texture ) } 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]; @@ -699,8 +699,8 @@ bool Model::loaddecal(const char *filename, bool texture ) bool Model::loadraw(char *filename ) { - FILE *tfile; - long i; + FILE *tfile; + long i; LOGFUNC; @@ -737,7 +737,7 @@ bool Model::loadraw(char *filename ) } 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]; @@ -1184,7 +1184,7 @@ void Model::drawdecals(Texture shadowtexture, Texture bloodtexture, Texture bloo 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++) { diff --git a/Source/Models.h b/Source/Models.h index e69cca9..a18854a 100644 --- a/Source/Models.h +++ b/Source/Models.h @@ -40,9 +40,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // // Textures List // -typedef struct { - long xsz, ysz; - GLubyte *txt; +typedef struct { + long xsz, ysz; + GLubyte *txt; } ModelTexture; // @@ -52,7 +52,7 @@ typedef struct { class TexturedTriangle { public: - short vertex[3]; + short vertex[3]; float gx[3], gy[3]; }; @@ -67,7 +67,7 @@ public: class Model { public: - short vertexNum, TriangleNum; + short vertexNum, TriangleNum; bool hastexture; int type, oldtype; diff --git a/Source/Objects.cpp b/Source/Objects.cpp index 6f3d3c0..572f16b 100644 --- a/Source/Objects.cpp +++ b/Source/Objects.cpp @@ -39,7 +39,7 @@ extern bool skyboxtexture; //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; @@ -111,7 +111,7 @@ void Objects::Draw() } 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); @@ -366,7 +366,7 @@ void Objects::Draw() 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); diff --git a/Source/OpenGL_Windows.cpp b/Source/OpenGL_Windows.cpp index 59f8490..aa2e728 100644 --- a/Source/OpenGL_Windows.cpp +++ b/Source/OpenGL_Windows.cpp @@ -194,7 +194,7 @@ void initGL() 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); @@ -215,13 +215,13 @@ void initGL() 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); @@ -446,9 +446,9 @@ void DoFrameRate (int update) 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; @@ -457,18 +457,18 @@ void DoFrameRate (int update) 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; } } @@ -516,38 +516,38 @@ void DoUpdate () 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); @@ -803,8 +803,8 @@ static bool load_image(const char *file_name, TGAImageRec &tex) 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; @@ -820,8 +820,8 @@ static bool load_jpg(const char *file_name, TGAImageRec &tex) { 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) diff --git a/Source/Person.cpp b/Source/Person.cpp index 52b9b20..33a57f3 100644 --- a/Source/Person.cpp +++ b/Source/Person.cpp @@ -5017,7 +5017,7 @@ void Person::DoStuff() yaw = targetyaw; frameTarget = 0; - // frameTarget=2; + // frameTarget=2; animTarget = flipanim; crouchtogglekeydown = 1; target = 0; diff --git a/Source/PhysicsMath.h b/Source/PhysicsMath.h index fdf7d40..0777f38 100644 --- a/Source/PhysicsMath.h +++ b/Source/PhysicsMath.h @@ -30,24 +30,24 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // 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; } @@ -69,23 +69,23 @@ public: 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) @@ -96,7 +96,7 @@ register float result; if (arg == 0.0) return 0.0; asm { -frsqrte result,arg // Calculate Square root +frsqrte result,arg // Calculate Square root } // Newton Rhapson iterations. @@ -120,12 +120,12 @@ inline Vector::Vector(float xi, float yi, float zi) 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) @@ -142,7 +142,7 @@ inline void Vector::Normalize(void) z = 0.0f; } -inline void Vector::Reverse(void) +inline void Vector::Reverse(void) { x = -x; y = -y; @@ -157,7 +157,7 @@ inline Vector& Vector::operator+=(Vector u) return *this; } -inline Vector& Vector::operator-=(Vector u) +inline Vector& Vector::operator-=(Vector u) { x -= u.x; y -= u.y; @@ -165,7 +165,7 @@ inline Vector& Vector::operator-=(Vector u) return *this; } -inline Vector& Vector::operator*=(float s) +inline Vector& Vector::operator*=(float s) { x *= s; y *= s; @@ -173,7 +173,7 @@ inline Vector& Vector::operator*=(float s) return *this; } -inline Vector& Vector::operator/=(float s) +inline Vector& Vector::operator/=(float s) { x /= s; y /= s; @@ -181,55 +181,55 @@ inline Vector& Vector::operator/=(float 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); @@ -246,16 +246,16 @@ class Matrix3x3 { 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); @@ -263,20 +263,20 @@ public: 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; @@ -289,7 +289,7 @@ inline Matrix3x3::Matrix3x3(void) 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 ) { @@ -304,9 +304,9 @@ inline Matrix3x3::Matrix3x3( float r1c1, float r1c2, float r1c3, 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 + @@ -314,14 +314,14 @@ inline float Matrix3x3::det(void) 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 + @@ -331,7 +331,7 @@ inline Matrix3x3 Matrix3x3::Inverse(void) 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, @@ -342,7 +342,7 @@ inline Matrix3x3 Matrix3x3::Inverse(void) (e11 * e22 - e12 * e21) / d ); } -inline Matrix3x3& Matrix3x3::operator+=(Matrix3x3 m) +inline Matrix3x3& Matrix3x3::operator+=(Matrix3x3 m) { e11 += m.e11; e12 += m.e12; @@ -356,7 +356,7 @@ inline Matrix3x3& Matrix3x3::operator+=(Matrix3x3 m) return *this; } -inline Matrix3x3& Matrix3x3::operator-=(Matrix3x3 m) +inline Matrix3x3& Matrix3x3::operator-=(Matrix3x3 m) { e11 -= m.e11; e12 -= m.e12; @@ -370,7 +370,7 @@ inline Matrix3x3& Matrix3x3::operator-=(Matrix3x3 m) return *this; } -inline Matrix3x3& Matrix3x3::operator*=(float s) +inline Matrix3x3& Matrix3x3::operator*=(float s) { e11 *= s; e12 *= s; @@ -384,7 +384,7 @@ inline Matrix3x3& Matrix3x3::operator*=(float s) return *this; } -inline Matrix3x3& Matrix3x3::operator/=(float s) +inline Matrix3x3& Matrix3x3::operator/=(float s) { e11 /= s; e12 /= s; @@ -398,9 +398,9 @@ inline Matrix3x3& Matrix3x3::operator/=(float 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, @@ -411,9 +411,9 @@ inline Matrix3x3 operator+(Matrix3x3 m1, Matrix3x3 m2) 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, @@ -424,9 +424,9 @@ inline Matrix3x3 operator-(Matrix3x3 m1, Matrix3x3 m2) 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, @@ -437,9 +437,9 @@ inline Matrix3x3 operator/(Matrix3x3 m, float 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, @@ -450,9 +450,9 @@ inline Matrix3x3 operator*(Matrix3x3 m1, Matrix3x3 m2) 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, @@ -463,9 +463,9 @@ inline Matrix3x3 operator*(Matrix3x3 m, float 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, @@ -476,16 +476,16 @@ inline Matrix3x3 operator*(float s, Matrix3x3 m) 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); } @@ -497,41 +497,41 @@ inline Vector operator*(Vector u, Matrix3x3 m) 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; @@ -539,7 +539,7 @@ inline Quaternion::Quaternion(void) 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; @@ -547,22 +547,22 @@ inline Quaternion::Quaternion(float e0, float e1, float e2, float e3) 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; @@ -571,7 +571,7 @@ inline Quaternion Quaternion::operator+=(Quaternion q) return *this; } -inline Quaternion Quaternion::operator-=(Quaternion q) +inline Quaternion Quaternion::operator-=(Quaternion q) { n -= q.n; v.x -= q.v.x; @@ -580,7 +580,7 @@ inline Quaternion Quaternion::operator-=(Quaternion q) return *this; } -inline Quaternion Quaternion::operator*=(float s) +inline Quaternion Quaternion::operator*=(float s) { n *= s; v.x *= s; @@ -589,7 +589,7 @@ inline Quaternion Quaternion::operator*=(float s) return *this; } -inline Quaternion Quaternion::operator/=(float s) +inline Quaternion Quaternion::operator/=(float s) { n /= s; v.x /= s; @@ -598,72 +598,72 @@ inline Quaternion Quaternion::operator/=(float 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; @@ -677,30 +677,30 @@ inline Vector QGetAxis(Quaternion q) 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); @@ -722,12 +722,12 @@ inline Quaternion MakeQFromEulerAngles(float x, float y, float z) 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; @@ -752,7 +752,7 @@ inline Vector MakeEulerAnglesFromQ(Quaternion q) } 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; diff --git a/Source/Quaternions.h b/Source/Quaternions.h index 4e96bc7..29f82d7 100644 --- a/Source/Quaternions.h +++ b/Source/Quaternions.h @@ -255,7 +255,7 @@ inline float fast_sqrt (register float arg) return 0.0; asm { - frsqrte result, arg // Calculate Square root + frsqrte result, arg // Calculate Square root } // Newton Rhapson iterations. diff --git a/Source/Skeleton.cpp b/Source/Skeleton.cpp index c8207a0..90f8541 100644 --- a/Source/Skeleton.cpp +++ b/Source/Skeleton.cpp @@ -1360,24 +1360,24 @@ Skeleton::Skeleton() 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; diff --git a/Source/Skybox.cpp b/Source/Skybox.cpp index cb9505e..b20f728 100644 --- a/Source/Skybox.cpp +++ b/Source/Skybox.cpp @@ -30,9 +30,8 @@ extern float skyboxr; 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); @@ -42,7 +41,7 @@ SkyBox::load (const char *ffront, const char *fleft, const char *fback, down.load(fdown, true, false); } -void SkyBox::draw() +void SkyBox::draw() { static float size = viewdistance / 4; glPushMatrix(); diff --git a/Source/Sprite.cpp b/Source/Sprite.cpp index 174caa6..f405331 100644 --- a/Source/Sprite.cpp +++ b/Source/Sprite.cpp @@ -209,7 +209,7 @@ void Sprite::Draw() } 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)) { diff --git a/Source/TGALoader.cpp b/Source/TGALoader.cpp index fdb2afa..c68cfb5 100644 --- a/Source/TGALoader.cpp +++ b/Source/TGALoader.cpp @@ -42,16 +42,16 @@ bool upload_image(const unsigned char* filePath, bool hasalpha) 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 @@ -120,18 +120,18 @@ bool upload_image(const unsigned char* filePath, bool hasalpha) 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; } @@ -141,8 +141,8 @@ bool upload_image(const unsigned char* filePath, bool hasalpha) 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;*/ } @@ -159,7 +159,7 @@ bool upload_image(const unsigned char* filePath, bool hasalpha) 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++; } } diff --git a/Source/TGALoader.h b/Source/TGALoader.h index f3b6af7..16e46a2 100644 --- a/Source/TGALoader.h +++ b/Source/TGALoader.h @@ -19,8 +19,8 @@ along with this program; if not, write to the Free Software 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 @@ -39,7 +39,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "GL/gl.h" #else #include "gamegl.h" -// #include "MoreFilesX.h" +// #include "MoreFilesX.h" #endif //#include @@ -47,11 +47,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. /**> 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); diff --git a/Source/Terrain.cpp b/Source/Terrain.cpp index b09f806..9441af0 100644 --- a/Source/Terrain.cpp +++ b/Source/Terrain.cpp @@ -404,7 +404,7 @@ void Terrain::UpdateVertexArray(int whichx, int whichy) bool Terrain::load(const char *fileName) { - static long i, j; + static long i, j; static long x, y; static float patch_size; @@ -548,14 +548,14 @@ bool Terrain::load(const char *fileName) for(j=0;j 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) @@ -1232,7 +1232,7 @@ void Terrain::drawdecals() 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++) { diff --git a/Source/Terrain.h b/Source/Terrain.h index f9a127b..aa4a6f8 100644 --- a/Source/Terrain.h +++ b/Source/Terrain.h @@ -30,10 +30,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #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 @@ -67,7 +67,7 @@ public: Texture bodyprinttexture; Texture breaktexture; Texture terraintexture; - short size; + short size; int patchobjectnum[subdivision][subdivision]; int patchobjects[subdivision][subdivision][300]; diff --git a/Source/Text.cpp b/Source/Text.cpp index 934093a..06ff6cd 100644 --- a/Source/Text.cpp +++ b/Source/Text.cpp @@ -26,7 +26,7 @@ extern TGAImageRec texture; void Text::LoadFontTexture(const char *fileName) { - GLuint type; + GLuint type; LOGFUNC; @@ -34,32 +34,32 @@ void Text::LoadFontTexture(const char *fileName) 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); @@ -67,10 +67,10 @@ void Text::LoadFontTexture(const char *fileName) } } -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; @@ -82,91 +82,91 @@ void Text::BuildFont() // Build Our Font Display List //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); diff --git a/Source/Weapons.cpp b/Source/Weapons.cpp index 1784f33..6649643 100644 --- a/Source/Weapons.cpp +++ b/Source/Weapons.cpp @@ -221,8 +221,8 @@ void Weapon::DoStuff(int i) 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; @@ -301,7 +301,7 @@ void Weapon::DoStuff(int i) 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(); @@ -948,15 +948,15 @@ void Weapon::Draw() 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 || @@ -987,7 +987,7 @@ void Weapon::Draw() 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) @@ -1056,7 +1056,7 @@ void Weapon::Draw() 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); diff --git a/Source/WinDefs.cpp b/Source/WinDefs.cpp index 3c5e325..65ecaac 100644 --- a/Source/WinDefs.cpp +++ b/Source/WinDefs.cpp @@ -36,7 +36,7 @@ public: 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; diff --git a/Source/WinDefs.h b/Source/WinDefs.h index de92c5f..31dd352 100644 --- a/Source/WinDefs.h +++ b/Source/WinDefs.h @@ -63,7 +63,7 @@ typedef struct AbsoluteTime { 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; @@ -84,8 +84,8 @@ Duration AbsoluteDeltaToDuration( AbsoluteTime& a, AbsoluteTime& b); /* 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); } */ diff --git a/Source/binio.h b/Source/binio.h index c67ad58..b555db7 100644 --- a/Source/binio.h +++ b/Source/binio.h @@ -75,9 +75,9 @@ extern "C" { #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 diff --git a/Source/private.h b/Source/private.h index 0c40c67..f2458c6 100644 --- a/Source/private.h +++ b/Source/private.h @@ -49,7 +49,7 @@ typedef unsigned char uint8_t; 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 -- 2.39.2