From c417ffae4c61e5fa4a389b2d1f0c4183a699a6f2 Mon Sep 17 00:00:00 2001 From: lachwright Date: Tue, 11 Feb 2020 15:53:25 +0800 Subject: [PATCH 1/2] Add proper support for animated signpost --- src/info.c | 2 +- src/p_enemy.c | 13 ++++++++----- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/info.c b/src/info.c index 758f137c2..a634bd8d3 100644 --- a/src/info.c +++ b/src/info.c @@ -762,7 +762,7 @@ state_t states[NUMSTATES] = {SPR_PLAY, SPR2_LIFE, 20, {NULL}, 0, 4, S_NULL}, // S_PLAY_ICON3 // Level end sign (uses player sprite) - {SPR_PLAY, SPR2_SIGN|FF_PAPERSPRITE, -1, {NULL}, 0, 29, S_PLAY_SIGN}, // S_PLAY_SIGN + {SPR_PLAY, SPR2_SIGN|FF_PAPERSPRITE, 2, {NULL}, 0, 29, S_PLAY_SIGN}, // S_PLAY_SIGN // NiGHTS Player, transforming {SPR_PLAY, SPR2_TRNS|FF_ANIMATE, 7, {NULL}, 0, 4, S_PLAY_NIGHTS_TRANS2}, // S_PLAY_NIGHTS_TRANS1 diff --git a/src/p_enemy.c b/src/p_enemy.c index db297e684..8ff490a05 100644 --- a/src/p_enemy.c +++ b/src/p_enemy.c @@ -5198,8 +5198,8 @@ void A_SignPlayer(mobj_t *actor) player_t *player = actor->target ? actor->target->player : NULL; UINT8 skinnum; UINT8 skincount = 0; - for (skincount = 0; skincount < numskins; skincount++) - if (!skincheck(skincount)) + for (skinnum = 0; skinnum < numskins; skinnum++) + if (!skincheck(skinnum)) skincount++; skinnum = P_RandomKey(skincount); for (skincount = 0; skincount < numskins; skincount++) @@ -5232,20 +5232,23 @@ void A_SignPlayer(mobj_t *actor) { ov->color = facecolor; ov->skin = skin; - P_SetMobjState(ov, actor->info->seestate); // S_PLAY_SIGN + if (ov->state-states != actor->info->seestate) + P_SetMobjState(ov, actor->info->seestate); // S_PLAY_SIGN } else // CLEAR! sign { ov->color = SKINCOLOR_NONE; ov->skin = NULL; // needs to be NULL in the case of SF_HIRES characters - P_SetMobjState(ov, actor->info->missilestate); // S_CLEARSIGN + if (ov->state-states != actor->info->missilestate) + P_SetMobjState(ov, actor->info->missilestate); // S_CLEARSIGN } } else // Eggman face { ov->color = SKINCOLOR_NONE; ov->skin = NULL; - P_SetMobjState(ov, actor->info->meleestate); // S_EGGMANSIGN + if (ov->state-states != actor->info->meleestate) + P_SetMobjState(ov, actor->info->meleestate); // S_EGGMANSIGN if (!signcolor) signcolor = SKINCOLOR_CARBON; } From 248a80cac48be372effa0e92170a70007dcdbdd4 Mon Sep 17 00:00:00 2001 From: lachwright Date: Tue, 11 Feb 2020 20:36:48 +0800 Subject: [PATCH 2/2] Cast to statenum_t for 32-bit compatibility --- src/p_enemy.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/p_enemy.c b/src/p_enemy.c index 8ff490a05..2ddbd8d29 100644 --- a/src/p_enemy.c +++ b/src/p_enemy.c @@ -5232,14 +5232,14 @@ void A_SignPlayer(mobj_t *actor) { ov->color = facecolor; ov->skin = skin; - if (ov->state-states != actor->info->seestate) + if ((statenum_t)(ov->state-states) != actor->info->seestate) P_SetMobjState(ov, actor->info->seestate); // S_PLAY_SIGN } else // CLEAR! sign { ov->color = SKINCOLOR_NONE; ov->skin = NULL; // needs to be NULL in the case of SF_HIRES characters - if (ov->state-states != actor->info->missilestate) + if ((statenum_t)(ov->state-states) != actor->info->missilestate) P_SetMobjState(ov, actor->info->missilestate); // S_CLEARSIGN } } @@ -5247,7 +5247,7 @@ void A_SignPlayer(mobj_t *actor) { ov->color = SKINCOLOR_NONE; ov->skin = NULL; - if (ov->state-states != actor->info->meleestate) + if ((statenum_t)(ov->state-states) != actor->info->meleestate) P_SetMobjState(ov, actor->info->meleestate); // S_EGGMANSIGN if (!signcolor) signcolor = SKINCOLOR_CARBON;