Improve A_SignSpin

This commit is contained in:
lachwright 2019-11-04 23:10:13 +08:00
parent 5e03d40b33
commit eb6d3b3dbe
3 changed files with 23 additions and 12 deletions

View file

@ -1926,10 +1926,12 @@ state_t states[NUMSTATES] =
// Level End Sign // Level End Sign
{SPR_SIGN, 0, -1, {A_SignPlayer}, -3, 0, S_NULL}, // S_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_Repeat}, 4, S_SIGNSPIN, S_SIGNROULETTE}, // S_SIGNSPINLOOP
{SPR_SIGN, 0, 0, {A_SignPlayer}, -2, 0, S_SIGNSPIN}, // S_SIGNROULETTE {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|2, -1, {NULL}, 0, 0, S_NULL}, // S_SIGNBOARD
{SPR_SIGN, FF_PAPERSPRITE|1, -1, {NULL}, 0, 29, S_NULL}, // S_EGGMANSIGN {SPR_SIGN, FF_PAPERSPRITE|1, -1, {NULL}, 0, 29, S_NULL}, // S_EGGMANSIGN
@ -7792,16 +7794,16 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
sfx_lvpass, // seesound sfx_lvpass, // seesound
8, // reactiontime 8, // reactiontime
sfx_None, // attacksound sfx_None, // attacksound
S_NULL, // painstate S_SIGNPLAYER, // painstate
MT_SPARK, // painchance MT_SPARK, // painchance
sfx_None, // painsound sfx_None, // painsound
S_EGGMANSIGN, // meleestate S_EGGMANSIGN, // meleestate
S_NULL, // missilestate S_NULL, // missilestate
S_NULL, // deathstate S_SIGNSTOP, // deathstate
S_NULL, // xdeathstate S_NULL, // xdeathstate
sfx_None, // deathsound sfx_None, // deathsound
8, // speed 8, // speed
32*FRACUNIT, // radius 36*FRACUNIT, // radius
32*FRACUNIT, // height 32*FRACUNIT, // height
0, // display offset 0, // display offset
16, // mass 16, // mass

View file

@ -2064,6 +2064,8 @@ typedef enum state
S_SIGNSPINLOOP, S_SIGNSPINLOOP,
S_SIGNROULETTE, S_SIGNROULETTE,
S_SIGNPLAYER, S_SIGNPLAYER,
S_SIGNSLOW,
S_SIGNSTOP,
S_SIGNBOARD, S_SIGNBOARD,
S_EGGMANSIGN, S_EGGMANSIGN,

View file

@ -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. // Description: Spins a signpost until it hits the ground and reaches its mapthing's angle.
// //
// var1 = degrees to rotate object // var1 = degrees to rotate object (must be positive, because I'm lazy)
// var2 = state to set object to once spinning stops // var2 = unused
// //
void A_SignSpin(mobj_t *actor) 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 mapangle = FixedAngle(actor->spawnpoint->angle << FRACBITS);
angle_t diff = mapangle - actor->angle; angle_t diff = mapangle - actor->angle;
if (diff < rotateangle) if (diff < ANG2)
{ {
actor->angle = mapangle; actor->angle = mapangle;
P_SetMobjState(actor, locvar2); P_SetMobjState(actor, actor->info->deathstate);
return; 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 else // no mapthing? just finish in your current angle
{ {
@ -5044,15 +5047,19 @@ void A_SignSpin(mobj_t *actor)
return; return;
} }
} }
actor->angle += rotateangle; else
if (leveltime & 1 || actor->tracer == NULL) return; {
actor->movedir = rotateangle;
}
actor->angle += actor->movedir;
if (actor->tracer == NULL || P_MobjWasRemoved(actor->tracer)) return;
for (i = -1; i < 2; i += 2) for (i = -1; i < 2; i += 2)
{ {
P_SpawnMobjFromMobj(actor, P_SpawnMobjFromMobj(actor,
P_ReturnThrustX(actor, actor->tracer->angle, i * actor->radius), P_ReturnThrustX(actor, actor->tracer->angle, i * actor->radius),
P_ReturnThrustY(actor, actor->tracer->angle, i * actor->radius), P_ReturnThrustY(actor, actor->tracer->angle, i * actor->radius),
(actor->eflags & MFE_VERTICALFLIP) ? 0 : actor->height, (actor->eflags & MFE_VERTICALFLIP) ? 0 : actor->height,
actor->info->painchance); actor->info->painchance)->destscale >>= 1;
} }
} }