X-Git-Url: https://git.jsancho.org/?p=lugaru.git;a=blobdiff_plain;f=Source%2FGraphic%2FSprite.cpp;h=862d4bbbf71026ba8301f14b4f5677fe1f407661;hp=c775323901c73cc22c58ca5dc8af0b56cdb3d695;hb=1a6ef830cdd01a9b7a8bbcfde8a51b7c430671a3;hpb=828b5b9ec7818c7047e96aebeb67f79837cbc793 diff --git a/Source/Graphic/Sprite.cpp b/Source/Graphic/Sprite.cpp index c775323..862d4bb 100644 --- a/Source/Graphic/Sprite.cpp +++ b/Source/Graphic/Sprite.cpp @@ -349,27 +349,28 @@ void Sprite::Draw() whichpatchx = sprites[i]->position.x / (terrain.size / subdivision * terrain.scale); whichpatchz = sprites[i]->position.z / (terrain.size / subdivision * terrain.scale); - if (whichpatchx > 0 && whichpatchz > 0 && whichpatchx < subdivision && whichpatchz < subdivision) - if (terrain.patchobjectnum[whichpatchx][whichpatchz]) { - if (!spritehit) - 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 (Object::objects[k]->model.LineCheck(&start, &end, &colpoint, &Object::objects[k]->position, &Object::objects[k]->yaw) != -1) { - if (detail == 2 || (detail == 1 && abs(Random() % 4) == 0) || (detail == 0 && abs(Random() % 8) == 0)) - Object::objects[k]->model.MakeDecal(blooddecalfast, DoRotation(colpoint - Object::objects[k]->position, 0, -Object::objects[k]->yaw, 0), sprites[i]->size * 1.6, .5, Random() % 360); - DeleteSprite(i); - spritehit = 1; - } - } + if (whichpatchx > 0 && whichpatchz > 0 && whichpatchx < subdivision && whichpatchz < subdivision) { + if (!spritehit) { + for (unsigned int j = 0; j < terrain.patchobjects[whichpatchx][whichpatchz].size(); j++) { + k = terrain.patchobjects[whichpatchx][whichpatchz][j]; + start = sprites[i]->oldposition; + end = sprites[i]->position; + if (!spritehit) + if (Object::objects[k]->model.LineCheck(&start, &end, &colpoint, &Object::objects[k]->position, &Object::objects[k]->yaw) != -1) { + if (detail == 2 || (detail == 1 && abs(Random() % 4) == 0) || (detail == 0 && abs(Random() % 8) == 0)) + Object::objects[k]->model.MakeDecal(blooddecalfast, DoRotation(colpoint - Object::objects[k]->position, 0, -Object::objects[k]->yaw, 0), sprites[i]->size * 1.6, .5, Random() % 360); + DeleteSprite(i); + spritehit = 1; + } + } } - if (!spritehit) + } + 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, .6, Random() % 360); DeleteSprite(i); } + } } } if (sprites[i]->type == splintersprite) {