mirror of
https://github.com/Xeeynamo/sotn-decomp.git
synced 2024-11-27 06:50:35 +00:00
SAT GetPlayer DistanceX/DistanceY/Side (#347)
This commit is contained in:
parent
5790242e65
commit
08c69ecef6
@ -40,3 +40,6 @@ _AllocEntity = 0x0607B184;
|
||||
_CreateEntityFromCurrentEntity = 0x0607B318;
|
||||
_g_CurrentEntity = 0x0605C6E0;
|
||||
_PfnEntityUpdates = 0x06064648;
|
||||
_GetPlayerDistanceX = 0x0607A9F8;
|
||||
_GetPlayerDistanceY = 0x0607AA1C;
|
||||
_GetPlayerSide = 0x0607AAF4;
|
@ -625,14 +625,59 @@ INCLUDE_ASM("asm/saturn/game/f_nonmat", f607A608, func_0607A608);
|
||||
INCLUDE_ASM("asm/saturn/game/f_nonmat", f607A88C, func_0607A88C);
|
||||
INCLUDE_ASM("asm/saturn/game/f_nonmat", f607A994, func_0607A994);
|
||||
|
||||
// _hkyori_search
|
||||
INCLUDE_ASM("asm/saturn/game/f_nonmat", f607A9F8, func_0607A9F8);
|
||||
INCLUDE_ASM("asm/saturn/game/f_nonmat", f607AA1C, func_0607AA1C);
|
||||
// SAT func_0607A9F8
|
||||
// Original name: _hkyori_search
|
||||
/*
|
||||
* Returns the absolute distance from g_CurrentEntity to player in the X Axis
|
||||
*/
|
||||
s32 GetPlayerDistanceX(Entity* self) {
|
||||
s16 xDistance = self->posX - PLAYER.posX;
|
||||
|
||||
if (xDistance < 0) {
|
||||
xDistance = -xDistance;
|
||||
}
|
||||
return xDistance;
|
||||
}
|
||||
|
||||
// SAT func_0607AA1C
|
||||
/*
|
||||
* Returns the absolute distance from g_CurrentEntity to player in the Y Axis
|
||||
*/
|
||||
s32 GetPlayerDistanceY(Entity* self) {
|
||||
s16 yDistance = self->posY - PLAYER.posY;
|
||||
|
||||
if (yDistance < 0) {
|
||||
yDistance = -yDistance;
|
||||
}
|
||||
return yDistance;
|
||||
}
|
||||
|
||||
INCLUDE_ASM("asm/saturn/game/f_nonmat", f607AA40, func_0607AA40);
|
||||
INCLUDE_ASM("asm/saturn/game/f_nonmat", f607AA74, func_0607AA74);
|
||||
INCLUDE_ASM("asm/saturn/game/f_nonmat", f607AAA4, func_0607AAA4);
|
||||
INCLUDE_ASM("asm/saturn/game/f_nonmat", f607AACC, func_0607AACC);
|
||||
INCLUDE_ASM("asm/saturn/game/f_nonmat", f607AAF4, func_0607AAF4);
|
||||
|
||||
// SAT func_0607AAF4
|
||||
/*
|
||||
* Returns the player's side position relative to g_CurrentEntity
|
||||
* 0 = Player is on the right side
|
||||
* 1 = Player is on the left side
|
||||
* 2 = Player is above
|
||||
*/
|
||||
s16 GetPlayerSide(Entity* self) {
|
||||
Entity* player = &PLAYER;
|
||||
s16 side = 0;
|
||||
|
||||
if (LOW(self->posX) > LOW(player->posX)) {
|
||||
side = 1;
|
||||
}
|
||||
|
||||
if (LOW(self->posY) > LOW(player->posY)) {
|
||||
side |= 2;
|
||||
}
|
||||
return side;
|
||||
}
|
||||
|
||||
INCLUDE_ASM("asm/saturn/game/f_nonmat", f607AB1C, func_0607AB1C);
|
||||
|
||||
// _bicyousei_dir_0
|
||||
|
Loading…
Reference in New Issue
Block a user