Add angle snapping for player animations so it doesn't look to weird

This commit is contained in:
Lucas S. Vieira 2025-01-11 20:33:18 -03:00
parent 32a38deb2e
commit a9cc963b84

View file

@ -1212,21 +1212,22 @@ _snap_angle(int32_t angle)
// These angles work somewhat like floor collision modes,
// and floor/ceiling angles take precedence as well, but they're
// a bit more complex since we also need to leverage diagonal angles.
/* if((angle >= 0xf00) || (angle <= 0x100)) */
/* return 0x0; */
if((angle > 0x100) && (angle < 0x300))
// NOTE: floor and ceiling angles add/subtract half a quarter (128)
// units from their limits so the player doesn't rotate at every small
// slope (e.g. 11.25 degrees or so)
if((angle > 0x180) && (angle < 0x300))
return 0x200;
if((angle >= 0x300) && (angle <= 0x500))
return 0x400;
if((angle > 0x500) && (angle < 0x700))
if((angle > 0x500) && (angle < 0x680))
return 0x600;
if((angle >= 0x700) && (angle <= 0x900))
if((angle >= 0x680) && (angle <= 0x980))
return 0x800;
if((angle > 0x900) && (angle < 0xa38))
if((angle > 0x980) && (angle < 0xa38))
return 0x938;
if((angle >= 0xa38) && (angle <= 0xd00))
return 0xc00;
if((angle > 0xd00) && (angle < 0xf00))
if((angle > 0xd00) && (angle < 0xe80))
return 0xe00;
return 0x00;
}