From 732a1ca33cbd6c1f5b3839f639fc66ee8dd702d1 Mon Sep 17 00:00:00 2001 From: helixhorned Date: Mon, 15 Apr 2013 10:48:15 +0000 Subject: [PATCH] In G_MoveStandables() CRACKx handling, fix oob access of DynamicTileMap[]. Also, in two cases, don't assign A_IncurDamage() result to a variable if it's not needed. git-svn-id: https://svn.eduke32.com/eduke32@3681 1a8010ca-5511-0410-912e-c29ae57300e0 --- polymer/eduke32/source/actors.c | 50 ++++++++++++++++++--------------- 1 file changed, 28 insertions(+), 22 deletions(-) diff --git a/polymer/eduke32/source/actors.c b/polymer/eduke32/source/actors.c index d5fc5aa8e..f1edbbdc9 100644 --- a/polymer/eduke32/source/actors.c +++ b/polymer/eduke32/source/actors.c @@ -1961,31 +1961,37 @@ ACTOR_STATIC void G_MoveStandables(void) { if (s->hitag > 0) { + int32_t k; + t[0] = s->cstat; t[1] = s->ang; - switch (DYNAMICTILEMAP(A_IncurDamage(i))) - { - case FIREEXT__STATIC: - case RPG__STATIC: - case RADIUSEXPLOSION__STATIC: - case SEENINE__STATIC: - case OOZFILTER__STATIC: - for (SPRITES_OF(STAT_STANDABLE, j)) + k = A_IncurDamage(i); + + if (k >= 0) + switch (DYNAMICTILEMAP(k)) { - if (s->hitag == sprite[j].hitag && (sprite[j].picnum == OOZFILTER || sprite[j].picnum == SEENINE)) - if (sprite[j].shade != -32) - sprite[j].shade = -32; + case FIREEXT__STATIC: + case RPG__STATIC: + case RADIUSEXPLOSION__STATIC: + case SEENINE__STATIC: + case OOZFILTER__STATIC: + for (SPRITES_OF(STAT_STANDABLE, j)) + { + if (s->hitag == sprite[j].hitag && (sprite[j].picnum == OOZFILTER || sprite[j].picnum == SEENINE)) + if (sprite[j].shade != -32) + sprite[j].shade = -32; + } + + goto DETONATE; + + default: + s->cstat = t[0]; + s->ang = t[1]; + s->extra = 0; + + goto BOLT; } - - goto DETONATE; - default: - s->cstat = t[0]; - s->ang = t[1]; - s->extra = 0; - - goto BOLT; - } } goto BOLT; } @@ -2446,7 +2452,7 @@ CLEAR_THE_BOLT: case CANWITHSOMETHING3__STATIC: case CANWITHSOMETHING4__STATIC: A_Fall(i); - if ((j = A_IncurDamage(i)) >= 0) + if (A_IncurDamage(i) >= 0) { A_PlaySound(VENT_BUST,i); @@ -6376,7 +6382,7 @@ ACTOR_STATIC void G_MoveEffectors(void) //STATNUM 3 sc->ceilingshade = 0; } - if ((j = A_IncurDamage(i)) >= 0) + if (A_IncurDamage(i) >= 0) { if (++t[3] == 5) {