mirror of
https://github.com/luksamuk/engine-psx.git
synced 2025-04-28 13:28:02 +03:00
Add angle snapping for player animations so it doesn't look to weird
This commit is contained in:
parent
32a38deb2e
commit
a9cc963b84
1 changed files with 8 additions and 7 deletions
15
src/player.c
15
src/player.c
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue