Implement auto-ring use animation

Your current follower spits out the rings. Auto ring is in another branch, so it's just always using this currently.
This commit is contained in:
Sally Coolatta 2024-04-29 09:57:02 -04:00 committed by James R
parent 71cc9c0800
commit a557039ce3
2 changed files with 37 additions and 5 deletions

View file

@ -12649,6 +12649,25 @@ void K_MoveKartPlayer(player_t *player, boolean onground)
ring->extravalue2 = 1; // Ring use animation flag
ring->shadowscale = 0;
P_SetTarget(&ring->target, player->mo); // user
if (player->follower && !P_MobjWasRemoved(player->follower))
{
// TODO: only do when using an auto-ring
ring->cusval = player->follower->x - player->mo->x;
ring->cvmem = player->follower->y - player->mo->y;
ring->movefactor = P_GetMobjHead(player->follower) - P_GetMobjHead(player->mo);
}
else
{
ring->cusval = ring->cvmem = ring->movefactor = 0;
}
// really silly stupid dumb HACK to fix interp
// without needing to duplicate any code
A_AttractChase(ring);
P_SetOrigin(ring, ring->x, ring->y, ring->z);
ring->extravalue1 = 1;
player->rings--;
if (player->autoring && !(cmd->buttons & BT_ATTACK))
player->ringdelay = 6;

View file

@ -3547,13 +3547,26 @@ void A_AttractChase(mobj_t *actor)
}
else
{
fixed_t offz = FixedMul(80*actor->target->scale, FINESINE(FixedAngle((90 - (9 * abs(10 - actor->extravalue1))) << FRACBITS) >> ANGLETOFINESHIFT));
fixed_t hop = FixedMul(
80 * actor->target->scale,
FINESINE(FixedAngle((90 - (9 * abs(10 - actor->extravalue1))) << FRACBITS) >> ANGLETOFINESHIFT)
);
fixed_t offsFrac = (20 - (actor->extravalue1 - 1)) * FRACUNIT / 20;
fixed_t offsX = FixedMul(actor->cusval, offsFrac);
fixed_t offsY = FixedMul(actor->cvmem, offsFrac);
fixed_t offsZ = FixedMul(actor->movefactor, offsFrac);
//P_SetScale(actor, (actor->destscale = actor->target->scale));
actor->z = actor->target->z;
K_MatchGenericExtraFlags(actor, actor->target);
P_MoveOrigin(actor, actor->target->x, actor->target->y,
actor->z +
( actor->target->height + offz )* P_MobjFlip(actor));
P_MoveOrigin(
actor,
actor->target->x + offsX,
actor->target->y + offsY,
actor->target->z + offsZ + ( actor->target->height + hop ) * P_MobjFlip(actor)
);
actor->extravalue1++;
}
}