Fix servant hand not being properly flipped

This commit is contained in:
JugadorXEI 2024-05-22 21:54:40 +02:00
parent 161d375532
commit 87ddd2f794

View file

@ -29,10 +29,18 @@ void Obj_ServantHandSpawning(player_t *player)
player->handtimer++; player->handtimer++;
if (player->hand == NULL && player->handtimer == TICRATE) if (player->hand == NULL && player->handtimer == TICRATE)
{ {
fixed_t heightOffset = player->mo->height + 30*mapobjectscale;
if (P_IsObjectFlipped(player->mo))
{
// This counteracts the offset added by K_FlipFromObject so it looks seamless from non-flipped.
heightOffset += player->mo->height - FixedMul(player->mo->scale, player->mo->height);
heightOffset *= P_MobjFlip(player->mo); // Fleep.
}
mobj_t *hand = P_SpawnMobj( mobj_t *hand = P_SpawnMobj(
player->mo->x, player->mo->x,
player->mo->y, player->mo->y,
player->mo->z + player->mo->height + 30*mapobjectscale, player->mo->z + heightOffset,
MT_SERVANTHAND MT_SERVANTHAND
); );
@ -116,12 +124,16 @@ void Obj_ServantHandThink(mobj_t *hand)
hand->color = player->skincolor; hand->color = player->skincolor;
hand->angle = player->besthanddirection; hand->angle = player->besthanddirection;
fixed_t heightOffset = player->mo->height + 30*mapobjectscale;
if (P_IsObjectFlipped(player->mo))
heightOffset *= P_MobjFlip(player->mo); // Fleep.
K_FlipFromObject(hand, player->mo);
P_MoveOrigin(hand, P_MoveOrigin(hand,
player->mo->x + xoffs, player->mo->x + xoffs,
player->mo->y + yoffs, player->mo->y + yoffs,
player->mo->z + player->mo->height + 30*mapobjectscale player->mo->z + heightOffset
); );
K_FlipFromObject(hand, player->mo);
hand->sprzoff = player->mo->sprzoff; hand->sprzoff = player->mo->sprzoff;