From 8dd73d0fe8785dbcbf6e897335e9e0a626e62cbe Mon Sep 17 00:00:00 2001 From: helixhorned Date: Fri, 10 May 2013 12:31:33 +0000 Subject: [PATCH] Tweak r3681 to obtain the same behavior in the pre-r3681 undefined behavior case. That is, assume that switch(DYNAMICTILEMAP(-1)) (which is an oob access and thus undefined behavior) gets us to the 'default:' label. git-svn-id: https://svn.eduke32.com/eduke32@3743 1a8010ca-5511-0410-912e-c29ae57300e0 --- polymer/eduke32/source/actors.c | 46 +++++++++++++++++---------------- polymer/eduke32/source/actors.h | 4 +-- 2 files changed, 26 insertions(+), 24 deletions(-) diff --git a/polymer/eduke32/source/actors.c b/polymer/eduke32/source/actors.c index 1a7982b5d..d4ad0b438 100644 --- a/polymer/eduke32/source/actors.c +++ b/polymer/eduke32/source/actors.c @@ -1977,31 +1977,33 @@ ACTOR_STATIC void G_MoveStandables(void) t[1] = s->ang; k = A_IncurDamage(i); + if (k < 0) + goto crack_default; - if (k >= 0) - switch (DYNAMICTILEMAP(k)) + switch (DYNAMICTILEMAP(k)) + { + case FIREEXT__STATIC: + case RPG__STATIC: + case RADIUSEXPLOSION__STATIC: + case SEENINE__STATIC: + case OOZFILTER__STATIC: + for (SPRITES_OF(STAT_STANDABLE, j)) { - 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; + 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; + + crack_default: + default: + s->cstat = t[0]; + s->ang = t[1]; + s->extra = 0; + + goto BOLT; + } } goto BOLT; } diff --git a/polymer/eduke32/source/actors.h b/polymer/eduke32/source/actors.h index 93b9a437e..700cd87a2 100644 --- a/polymer/eduke32/source/actors.h +++ b/polymer/eduke32/source/actors.h @@ -224,8 +224,8 @@ enum sflags_t { SPRITE_DIDNOSE7WATER = 0x00080000, // used temporarily }; -// custom projectiles -// KEEPINSYNC lunatic/con_lang.lua +// Custom projectiles "workslike" flags. +// XXX: Currently not predefined from CON. enum pflags_t { PROJECTILE_HITSCAN = 0x00000001, PROJECTILE_RPG = 0x00000002,