]> git.jsancho.org Git - lugaru.git/blobdiff - Source/Sprite.cpp
License: Update GPLv2+ header to match current FSF recommendation
[lugaru.git] / Source / Sprite.cpp
index f40533155c5c0e44638970af79f3a4dd8fd976f5..5b7c9e1f935899ee1f4642669bd804d0ab75f934 100644 (file)
@@ -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 <http://www.gnu.org/licenses/>.
 */
 
 #include "Sprite.h"
@@ -57,7 +55,7 @@ vector<Sprite*> Sprite::sprites = vector<Sprite*>();
 //Functions
 void Sprite::Draw()
 {
-    int i, j, k;
+    int k;
     static float M[16];
     static XYZ point;
     static float distancemult;
@@ -97,7 +95,7 @@ void Sprite::Draw()
     glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
     glDepthMask(0);
     glAlphaFunc(GL_GREATER, 0.0001);
-    for (i = 0; i < sprites.size(); i++) {
+    for (unsigned i = 0; i < sprites.size(); i++) {
         if (lasttype != sprites[i]->type) {
             switch (sprites[i]->type) {
             case cloudsprite:
@@ -279,7 +277,7 @@ void Sprite::Draw()
         glPopMatrix();
     }
     tempmult = multiplier;
-    for (i = sprites.size() - 1; i >= 0; i--) {
+    for (unsigned i = sprites.size() - 1; i >= 0; i--) {
         multiplier = tempmult;
         if (sprites[i]->type != snowsprite) {
             sprites[i]->position += sprites[i]->velocity * multiplier;
@@ -330,25 +328,25 @@ void Sprite::Draw()
                 float rotationpoint;
                 int whichtri;
 
-                for (j = 0; j < numplayers; j++) {
-                    if (!spritehit && player[j].dead && sprites[i]->alivetime > .1) {
+                for (unsigned j = 0; j < Person::players.size(); j++) {
+                    if (!spritehit && Person::players[j]->dead && sprites[i]->alivetime > .1) {
                         where = sprites[i]->oldposition;
-                        where -= player[j].coords;
-                        if (!player[j].skeleton.free)
-                            where = DoRotation(where, 0, -player[j].yaw, 0);
+                        where -= Person::players[j]->coords;
+                        if (!Person::players[j]->skeleton.free)
+                            where = DoRotation(where, 0, -Person::players[j]->yaw, 0);
                         startpoint = where;
                         where = sprites[i]->position;
-                        where -= player[j].coords;
-                        if (!player[j].skeleton.free)
-                            where = DoRotation(where, 0, -player[j].yaw, 0);
+                        where -= Person::players[j]->coords;
+                        if (!Person::players[j]->skeleton.free)
+                            where = DoRotation(where, 0, -Person::players[j]->yaw, 0);
                         endpoint = where;
 
                         movepoint = 0;
                         rotationpoint = 0;
-                        whichtri = player[j].skeleton.drawmodel.LineCheck(&startpoint, &endpoint, &footpoint, &movepoint, &rotationpoint);
+                        whichtri = Person::players[j]->skeleton.drawmodel.LineCheck(&startpoint, &endpoint, &footpoint, &movepoint, &rotationpoint);
                         if (whichtri != -1) {
                             spritehit = 1;
-                            player[j].DoBloodBigWhere(0, 160, sprites[i]->oldposition);
+                            Person::players[j]->DoBloodBigWhere(0, 160, sprites[i]->oldposition);
                             DeleteSprite(i);
                         }
                     }
@@ -359,7 +357,7 @@ void Sprite::Draw()
                 if (whichpatchx > 0 && whichpatchz > 0 && whichpatchx < subdivision && whichpatchz < subdivision)
                     if (terrain.patchobjectnum[whichpatchx][whichpatchz]) {
                         if (!spritehit)
-                            for (j = 0; j < terrain.patchobjectnum[whichpatchx][whichpatchz]; j++) {
+                            for (int j = 0; j < terrain.patchobjectnum[whichpatchx][whichpatchz]; j++) {
                                 k = terrain.patchobjects[whichpatchx][whichpatchz][j];
                                 start = sprites[i]->oldposition;
                                 end = sprites[i]->position;
@@ -418,7 +416,7 @@ void Sprite::Draw()
             DeleteSprite(i);
     }
     if (check)
-        for (i = sprites.size() - 1; i >= 0; i--) {
+        for (unsigned i = sprites.size() - 1; i >= 0; i--) {
             sprites[i]->oldposition = sprites[i]->position;
         }
     glAlphaFunc(GL_GREATER, 0.0001);