X-Git-Url: https://git.jsancho.org/?a=blobdiff_plain;f=Source%2FSprite.cpp;h=d96d09e0ef08eda17c3106c6d36cae813366c5ed;hb=ff29f47f799d99cec7c2a6aa2cf818da2b931fc5;hp=090aec8c09c75d7b47bdf00b8bd890e2e91c83bf;hpb=2ce8e2f8ac6921286ebd6b30362c35b38e935977;p=lugaru.git diff --git a/Source/Sprite.cpp b/Source/Sprite.cpp index 090aec8..d96d09e 100644 --- a/Source/Sprite.cpp +++ b/Source/Sprite.cpp @@ -1,22 +1,21 @@ /* Copyright (C) 2003, 2010 - Wolfire Games +Copyright (C) 2010-2016 - Lugaru contributors (see AUTHORS file) 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 "Sprite.h" @@ -57,7 +56,7 @@ vector Sprite::sprites = vector(); //Functions void Sprite::Draw() { - int i, j, k; + int k; static float M[16]; static XYZ point; static float distancemult; @@ -97,7 +96,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 +278,7 @@ void Sprite::Draw() glPopMatrix(); } tempmult = multiplier; - for (i = sprites.size() - 1; i >= 0; i--) { + for (int i = sprites.size() - 1; i >= 0; i--) { multiplier = tempmult; if (sprites[i]->type != snowsprite) { sprites[i]->position += sprites[i]->velocity * multiplier; @@ -330,7 +329,7 @@ void Sprite::Draw() float rotationpoint; int whichtri; - for (j = 0; j < numplayers; j++) { + for (unsigned j = 0; j < Person::players.size(); j++) { if (!spritehit && Person::players[j]->dead && sprites[i]->alivetime > .1) { where = sprites[i]->oldposition; where -= Person::players[j]->coords; @@ -359,14 +358,14 @@ 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; if (!spritehit) if (objects.model[k].LineCheck(&start, &end, &colpoint, &objects.position[k], &objects.yaw[k]) != -1) { if (detail == 2 || (detail == 1 && abs(Random() % 4) == 0) || (detail == 0 && abs(Random() % 8) == 0)) - objects.model[k].MakeDecal(blooddecalfast, DoRotation(colpoint - objects.position[k], 0, -objects.yaw[k], 0), sprites[i]->size * 1.6/*+abs((float)(Random()%100))/2400*/, .5, Random() % 360); + objects.model[k].MakeDecal(blooddecalfast, DoRotation(colpoint - objects.position[k], 0, -objects.yaw[k], 0), sprites[i]->size * 1.6, .5, Random() % 360); DeleteSprite(i); spritehit = 1; } @@ -374,7 +373,7 @@ void Sprite::Draw() } if (!spritehit) if (sprites[i]->position.y < terrain.getHeight(sprites[i]->position.x, sprites[i]->position.z)) { - terrain.MakeDecal(blooddecalfast, sprites[i]->position, sprites[i]->size * 1.6/*+abs((float)(Random()%100))/2400*/, .6, Random() % 360); + terrain.MakeDecal(blooddecalfast, sprites[i]->position, sprites[i]->size * 1.6, .6, Random() % 360); DeleteSprite(i); } } @@ -418,7 +417,7 @@ void Sprite::Draw() DeleteSprite(i); } if (check) - for (i = sprites.size() - 1; i >= 0; i--) { + for (int i = sprites.size() - 1; i >= 0; i--) { sprites[i]->oldposition = sprites[i]->position; } glAlphaFunc(GL_GREATER, 0.0001);