X-Git-Url: https://git.jsancho.org/?a=blobdiff_plain;f=Source%2FModels.cpp;h=f6a2a9164e636618eef72a9a892e942397839c94;hb=cd043e3f9e26c2b3406b40a354c2840941e9db7f;hp=65d9ff8642ede49391f1883d9ac64fe3bf6c257e;hpb=87ff660bf58766ab705a749e72e04154ccf5a737;p=lugaru.git diff --git a/Source/Models.cpp b/Source/Models.cpp index 65d9ff8..f6a2a91 100644 --- a/Source/Models.cpp +++ b/Source/Models.cpp @@ -3,20 +3,18 @@ Copyright (C) 2003, 2010 - Wolfire Games This file is part of Lugaru. -Lugaru is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. +Lugaru is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or +(at your option) any later version. -This program is distributed in the hope that it will be useful, +Lugaru is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - -See the GNU General Public License for more details. +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +along with Lugaru. If not, see . */ #include "Game.h" @@ -245,7 +243,7 @@ int Model::SphereCheck(XYZ *p1, float radius, XYZ *p, XYZ *move, float *rotate) int Model::SphereCheckPossible(XYZ *p1, float radius, XYZ *move, float *rotate) { - static int i, j; + static int j; static float distance; static float olddistance; static int intersecting; @@ -448,12 +446,12 @@ void Model::UpdateVertexArrayNoTexNoNorm() bool Model::loadnotex(const char *filename ) { - FILE *tfile; - long i; + FILE *tfile; + long i; - int oldvertexNum, oldTriangleNum; - oldvertexNum = vertexNum; - oldTriangleNum = TriangleNum; + //~ int oldvertexNum, oldTriangleNum; + //~ oldvertexNum = vertexNum; + //~ oldTriangleNum = TriangleNum; type = notextype; color = 0; @@ -480,7 +478,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 +514,8 @@ bool Model::loadnotex(const char *filename ) bool Model::load(const char *filename, bool texture ) { - FILE *tfile; - long i; + FILE *tfile; + long i; LOGFUNC; @@ -526,9 +524,9 @@ bool Model::load(const char *filename, bool texture ) if (visibleloading) Game::LoadingScreen(); - int oldvertexNum, oldTriangleNum; - oldvertexNum = vertexNum; - oldTriangleNum = TriangleNum; + //~ int oldvertexNum, oldTriangleNum; + //~ oldvertexNum = vertexNum; + //~ oldTriangleNum = TriangleNum; type = normaltype; color = 0; @@ -558,7 +556,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 +593,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; @@ -605,9 +603,9 @@ bool Model::loaddecal(const char *filename, bool texture ) LOG(std::string("Loading decal...") + FixedFN); - int oldvertexNum, oldTriangleNum; - oldvertexNum = vertexNum; - oldTriangleNum = TriangleNum; + //~ int oldvertexNum, oldTriangleNum; + //~ oldvertexNum = vertexNum; + //~ oldTriangleNum = TriangleNum; type = decalstype; numdecals = 0; @@ -640,7 +638,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,16 +697,16 @@ bool Model::loaddecal(const char *filename, bool texture ) bool Model::loadraw(char *filename ) { - FILE *tfile; - long i; + FILE *tfile; + long i; LOGFUNC; LOG(std::string("Loading raw...") + filename); - int oldvertexNum, oldTriangleNum; - oldvertexNum = vertexNum; - oldTriangleNum = TriangleNum; + //~ int oldvertexNum, oldTriangleNum; + //~ oldvertexNum = vertexNum; + //~ oldTriangleNum = TriangleNum; type = rawtype; color = 0; @@ -737,7 +735,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]; @@ -1112,13 +1110,13 @@ void Model::drawdecals(Texture shadowtexture, Texture bloodtexture, Texture bloo if (decals) { if (type != decalstype) return; - static int i, j; - static float distancemult; + static int i; + //~ static float distancemult; static int lasttype; - static float viewdistsquared; + //~ static float viewdistsquared; static bool blend; - viewdistsquared = viewdistance * viewdistance; + //~ viewdistsquared = viewdistance * viewdistance; blend = 1; lasttype = -1; @@ -1184,7 +1182,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++) {