From eb6d3b3dbe844476a1b2cd53650ff8cd0e41c2d3 Mon Sep 17 00:00:00 2001 From: lachwright Date: Mon, 4 Nov 2019 23:10:13 +0800 Subject: [PATCH] Improve A_SignSpin --- src/info.c | 12 +++++++----- src/info.h | 2 ++ src/p_enemy.c | 21 ++++++++++++++------- 3 files changed, 23 insertions(+), 12 deletions(-) diff --git a/src/info.c b/src/info.c index 23048e49c..ddb3d5ca7 100644 --- a/src/info.c +++ b/src/info.c @@ -1926,10 +1926,12 @@ state_t states[NUMSTATES] = // Level End Sign {SPR_SIGN, 0, -1, {A_SignPlayer}, -3, 0, S_NULL}, // S_SIGN - {SPR_SIGN, 0, 1, {A_SignSpin}, 30, S_SIGNPLAYER, S_SIGNSPINLOOP}, // S_SIGNSPIN + {SPR_SIGN, 0, 1, {A_SignSpin}, 30, 0, S_SIGNSPINLOOP}, // S_SIGNSPIN {SPR_SIGN, 0, 0, {A_Repeat}, 4, S_SIGNSPIN, S_SIGNROULETTE}, // S_SIGNSPINLOOP {SPR_SIGN, 0, 0, {A_SignPlayer}, -2, 0, S_SIGNSPIN}, // S_SIGNROULETTE - {SPR_SIGN, 0, -1, {A_SignPlayer}, -1, 0, S_NULL}, // S_SIGNPLAYER + {SPR_SIGN, 0, 1, {A_SignPlayer}, -1, 0, S_SIGNSLOW}, // S_SIGNPLAYER + {SPR_SIGN, 0, 1, {A_SignSpin}, 30, 0, S_SIGNSLOW}, // S_SIGNSLOW + {SPR_SIGN, 0, -1, {NULL}, 0, 0, S_NULL}, // S_SIGNSTOP {SPR_SIGN, FF_PAPERSPRITE|2, -1, {NULL}, 0, 0, S_NULL}, // S_SIGNBOARD {SPR_SIGN, FF_PAPERSPRITE|1, -1, {NULL}, 0, 29, S_NULL}, // S_EGGMANSIGN @@ -7792,16 +7794,16 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = sfx_lvpass, // seesound 8, // reactiontime sfx_None, // attacksound - S_NULL, // painstate + S_SIGNPLAYER, // painstate MT_SPARK, // painchance sfx_None, // painsound S_EGGMANSIGN, // meleestate S_NULL, // missilestate - S_NULL, // deathstate + S_SIGNSTOP, // deathstate S_NULL, // xdeathstate sfx_None, // deathsound 8, // speed - 32*FRACUNIT, // radius + 36*FRACUNIT, // radius 32*FRACUNIT, // height 0, // display offset 16, // mass diff --git a/src/info.h b/src/info.h index c23d05ebc..548ce81d9 100644 --- a/src/info.h +++ b/src/info.h @@ -2064,6 +2064,8 @@ typedef enum state S_SIGNSPINLOOP, S_SIGNROULETTE, S_SIGNPLAYER, + S_SIGNSLOW, + S_SIGNSTOP, S_SIGNBOARD, S_EGGMANSIGN, diff --git a/src/p_enemy.c b/src/p_enemy.c index a6860e823..b52ad61a7 100644 --- a/src/p_enemy.c +++ b/src/p_enemy.c @@ -5011,8 +5011,8 @@ void A_UnsetSolidSteam(mobj_t *actor) // // Description: Spins a signpost until it hits the ground and reaches its mapthing's angle. // -// var1 = degrees to rotate object -// var2 = state to set object to once spinning stops +// var1 = degrees to rotate object (must be positive, because I'm lazy) +// var2 = unused // void A_SignSpin(mobj_t *actor) { @@ -5031,12 +5031,15 @@ void A_SignSpin(mobj_t *actor) { angle_t mapangle = FixedAngle(actor->spawnpoint->angle << FRACBITS); angle_t diff = mapangle - actor->angle; - if (diff < rotateangle) + if (diff < ANG2) { actor->angle = mapangle; - P_SetMobjState(actor, locvar2); + P_SetMobjState(actor, actor->info->deathstate); return; } + if (actor->state-states != actor->info->painstate) + P_SetMobjState(actor, actor->info->painstate); + actor->movedir = min((mapangle - actor->angle) >> 2, actor->movedir); } else // no mapthing? just finish in your current angle { @@ -5044,15 +5047,19 @@ void A_SignSpin(mobj_t *actor) return; } } - actor->angle += rotateangle; - if (leveltime & 1 || actor->tracer == NULL) return; + else + { + actor->movedir = rotateangle; + } + actor->angle += actor->movedir; + if (actor->tracer == NULL || P_MobjWasRemoved(actor->tracer)) return; for (i = -1; i < 2; i += 2) { P_SpawnMobjFromMobj(actor, P_ReturnThrustX(actor, actor->tracer->angle, i * actor->radius), P_ReturnThrustY(actor, actor->tracer->angle, i * actor->radius), (actor->eflags & MFE_VERTICALFLIP) ? 0 : actor->height, - actor->info->painchance); + actor->info->painchance)->destscale >>= 1; } }