Rename GetDistanceToPlayer and GetSideToPlayer (#350)

As we decided on Discord
(https://discord.com/channels/1079389589950705684/1087866009983139870/1125555095778644039)
I mass-renamed `GetPlayerDistance` into `GetDistanceToPlayer` and
`GetPlayerSide` into `GetSideToPlayer`.

I also took the opportunity to tweak the comments and add the symbols to
the missing overlays.
This commit is contained in:
Luciano Ciccariello 2023-07-12 08:18:59 +01:00 committed by GitHub
parent 08c69ecef6
commit 5db55fea54
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
41 changed files with 189 additions and 206 deletions

View File

@ -40,6 +40,6 @@ _AllocEntity = 0x0607B184;
_CreateEntityFromCurrentEntity = 0x0607B318;
_g_CurrentEntity = 0x0605C6E0;
_PfnEntityUpdates = 0x06064648;
_GetPlayerDistanceX = 0x0607A9F8;
_GetPlayerDistanceY = 0x0607AA1C;
_GetPlayerSide = 0x0607AAF4;
_GetDistanceToPlayerX = 0x0607A9F8;
_GetDistanceToPlayerY = 0x0607AA1C;
_GetSideToPlayer = 0x0607AAF4;

View File

@ -77,4 +77,7 @@ EntityHeartDrop = 0x80195520;
EntityIntenseExplosion = 0x801964E4;
EntitySoulStealOrb = 0x801982BC;
EntityEnemyBlood = 0x80198650;
EntityRoomForeground = 0x80198B00;
EntityRoomForeground = 0x80198B00;
GetDistanceToPlayerY = 0x80192078;
GetDistanceToPlayerX = 0x8019203C;
GetSideToPlayer = 0x801920AC;

View File

@ -20,6 +20,9 @@ CreateEntityFromCurrentEntity = 0x801934C4;
CreateEntityFromEntity = 0x80193538;
EntityRedDoor = 0x8019362C;
DestroyEntity = 0x80194264;
GetDistanceToPlayerX = 0x80194564;
GetDistanceToPlayerY = 0x801945A0;
GetSideToPlayer = 0x801945D4;
MoveEntity = 0x80194618;
FallEntity = 0x80194648;
AllocEntity = 0x80194AD4;

View File

@ -37,6 +37,9 @@ DestroyEntity = 0x8019A3A8;
DestroyEntityFromIndex = 0x8019A414;
PreventEntityFromRespawning = 0x8019A490;
AnimateEntity = 0x8019A4D8;
GetDistanceToPlayerX = 0x8019A6A8;
GetDistanceToPlayerY = 0x8019A6E4;
GetSideToPlayer = 0x8019A718;
MoveEntity = 0x8019A75C;
FallEntity = 0x8019A78C;
AllocEntity = 0x8019AC18;

View File

@ -71,6 +71,9 @@ DestroyEntity = 0x801C4C64;
DestroyEntityFromIndex = 0x801C4CD0;
PreventEntityFromRespawning = 0x801C4D4C;
AnimateEntity = 0x801C4D94;
GetDistanceToPlayerX = 0x801C4F64;
GetDistanceToPlayerY = 0x801C4FA0;
GetSideToPlayer = 0x801C4FD4;
MoveEntity = 0x801C5018;
FallEntity = 0x801C5048;
AllocEntity = 0x801C54D4;

View File

@ -45,9 +45,9 @@ DestroyEntity = 0x801BC4D4;
DestroyEntityFromIndex = 0x801BC540;
PreventEntityFromRespawning = 0x801BC5BC;
AnimateEntity = 0x801BC604;
GetPlayerDistanceX = 0x801BC7D4;
GetPlayerDistanceY = 0x801BC810;
GetPlayerSide = 0x801BC844;
GetDistanceToPlayerX = 0x801BC7D4;
GetDistanceToPlayerY = 0x801BC810;
GetSideToPlayer = 0x801BC844;
MoveEntity = 0x801BC888;
FallEntity = 0x801BC8B8;
AllocEntity = 0x801BCD44;

View File

@ -78,9 +78,9 @@ EntityRedDoor = 0x801BBCB4;
DestroyEntity = 0x801BC8EC;
PreventEntityFromRespawning = 0x801BC9D4;
AnimateEntity = 0x801BCA1C;
GetPlayerDistanceX = 0x801BCBEC;
GetPlayerDistanceY = 0x801BCC28;
GetPlayerSide = 0x801BCC5C;
GetDistanceToPlayerX = 0x801BCBEC;
GetDistanceToPlayerY = 0x801BCC28;
GetSideToPlayer = 0x801BCC5C;
MoveEntity = 0x801BCCA0;
FallEntity = 0x801BCCD0;
AllocEntity = 0x801BD15C;

View File

@ -38,9 +38,9 @@ DestroyEntity = 0x801B4908;
DestroyEntityFromIndex = 0x801B4974;
PreventEntityFromRespawning = 0x801B49F0;
AnimateEntity = 0x801B4A38;
GetPlayerDistanceX = 0x801B4C08;
GetPlayerDistanceY = 0x801B4C44;
GetPlayerSide = 0x801B4C78;
GetDistanceToPlayerX = 0x801B4C08;
GetDistanceToPlayerY = 0x801B4C44;
GetSideToPlayer = 0x801B4C78;
MoveEntity = 0x801B4CBC;
FallEntity = 0x801B4CEC;
AllocEntity = 0x801B53CC;

View File

@ -81,6 +81,9 @@ DestroyEntity = 0x8018B600;
DestroyEntityFromIndex = 0x8018B66C;
PreventEntityFromRespawning = 0x8018B6E8;
AnimateEntity = 0x8018B730;
GetDistanceToPlayerX = 0x8018B900;
GetDistanceToPlayerY = 0x8018B93C;
GetSideToPlayer = 0x8018B970;
MoveEntity = 0x8018B9B4;
FallEntity = 0x8018B9E4;
AllocEntity = 0x8018BE70;

View File

@ -627,10 +627,8 @@ INCLUDE_ASM("asm/saturn/game/f_nonmat", f607A994, func_0607A994);
// SAT func_0607A9F8
// Original name: _hkyori_search
/*
* Returns the absolute distance from g_CurrentEntity to player in the X Axis
*/
s32 GetPlayerDistanceX(Entity* self) {
// Absolute distance from the specified entity to the player in the X Axis
s32 GetDistanceToPlayerX(Entity* self) {
s16 xDistance = self->posX - PLAYER.posX;
if (xDistance < 0) {
@ -640,10 +638,8 @@ s32 GetPlayerDistanceX(Entity* self) {
}
// SAT func_0607AA1C
/*
* Returns the absolute distance from g_CurrentEntity to player in the Y Axis
*/
s32 GetPlayerDistanceY(Entity* self) {
// Absolute distance from the specified entity to the player in the Y Axis
s32 GetDistanceToPlayerY(Entity* self) {
s16 yDistance = self->posY - PLAYER.posY;
if (yDistance < 0) {
@ -664,7 +660,7 @@ INCLUDE_ASM("asm/saturn/game/f_nonmat", f607AACC, func_0607AACC);
* 1 = Player is on the left side
* 2 = Player is above
*/
s16 GetPlayerSide(Entity* self) {
s16 GetSideToPlayer(Entity* self) {
Entity* player = &PLAYER;
s16 side = 0;

View File

@ -117,7 +117,7 @@ void func_8018DB18(Entity* self) {
self->zPriority = 0xB0;
self->unk19 = 4;
self->animCurFrame = self->params + 28;
facing = func_801945D4() & 1;
facing = GetSideToPlayer() & 1;
temp = (Random() & 30) + 8;
self->ext.generic.unk80.modeS16.unk0 = temp;
@ -324,7 +324,7 @@ void EntityPlatform(Entity* self) {
break;
case 1:
if ((func_80194564() < 32) &&
if ((GetDistanceToPlayerX() < 32) &&
((self->posY.i.hi - player->posY.i.hi) < 80)) {
D_8003C8B8 = 0;
*D_80097400 = 1;
@ -1253,10 +1253,8 @@ u8 func_8019444C(u8 frames[], Entity* self, u8 arg2) {
return var_a1;
}
/*
* Returns the absolute distance from g_CurrentEntity to player in the X Axis
*/
s32 func_80194564(void) {
// Absolute distance from g_CurrentEntity to the player in the X Axis
s32 GetDistanceToPlayerX(void) {
s16 xDistance = g_CurrentEntity->posX.i.hi - PLAYER.posX.i.hi;
if (xDistance < 0) {
@ -1265,10 +1263,8 @@ s32 func_80194564(void) {
return xDistance;
}
/*
* Returns the absolute distance from g_CurrentEntity to player in the Y Axis
*/
s32 func_801945A0(void) {
// Absolute distance from g_CurrentEntity to the player in the Y Axis
s32 GetDistanceToPlayerY(void) {
s32 yDistance = g_CurrentEntity->posY.i.hi - PLAYER.posY.i.hi;
if (yDistance < 0) {
@ -1277,7 +1273,7 @@ s32 func_801945A0(void) {
return yDistance;
}
s16 func_801945D4(void) {
s16 GetSideToPlayer(void) {
s16 var_a0 = g_CurrentEntity->posX.i.hi > PLAYER.posX.i.hi;
if (g_CurrentEntity->posY.i.hi > PLAYER.posY.i.hi) {

View File

@ -60,7 +60,7 @@ void func_80191B44(Entity* entity) {
}
if (entity->unk44 != 0) {
ret = func_8019A718();
ret = GetSideToPlayer();
phi_v1 = entity->ext.generic.unk7C.s;
if (phi_v1 != 0) {
phi_v1 = (ret & 2) * 2;

View File

@ -645,10 +645,8 @@ u8 func_8019A590(u8 frames[], Entity* self, u8 arg2) {
return var_a1;
}
/*
* Returns the absolute distance from g_CurrentEntity to player in the X Axis
*/
s32 func_8019A6A8(void) {
// Absolute distance from g_CurrentEntity to the player in the X Axis
s32 GetDistanceToPlayerX(void) {
s16 xDistance = g_CurrentEntity->posX.i.hi - PLAYER.posX.i.hi;
if (xDistance < 0) {
@ -657,10 +655,8 @@ s32 func_8019A6A8(void) {
return xDistance;
}
/*
* Returns the absolute distance from g_CurrentEntity to player in the Y Axis
*/
s32 func_8019A6E4(void) {
// Absolute distance from g_CurrentEntity to the player in the Y Axis
s32 GetDistanceToPlayerY(void) {
s32 yDistance = g_CurrentEntity->posY.i.hi - PLAYER.posY.i.hi;
if (yDistance < 0) {
@ -669,7 +665,7 @@ s32 func_8019A6E4(void) {
return yDistance;
}
s16 func_8019A718(void) {
s16 GetSideToPlayer(void) {
s16 var_a0 = g_CurrentEntity->posX.i.hi > PLAYER.posX.i.hi;
if (g_CurrentEntity->posY.i.hi > PLAYER.posY.i.hi) {

View File

@ -569,7 +569,7 @@ u8 func_80191F24(u8 frames[], Entity* self, u8 arg2) {
return var_a1;
}
s32 func_8019203C(void) {
s32 GetDistanceToPlayerX(void) {
s16 value = g_CurrentEntity->posX.i.hi - PLAYER.posX.i.hi;
if (value < 0) {
@ -578,7 +578,7 @@ s32 func_8019203C(void) {
return value;
}
s32 func_80192078(void) {
s32 GetDistanceToPlayerY(void) {
s32 value = g_CurrentEntity->posY.i.hi - PLAYER.posY.i.hi;
if (value < 0) {
@ -587,7 +587,7 @@ s32 func_80192078(void) {
return value;
}
s16 func_801920AC(void) {
s16 GetSideToPlayer(void) {
s16 var_a0 = g_CurrentEntity->posX.i.hi > PLAYER.posX.i.hi;
if (g_CurrentEntity->posY.i.hi > PLAYER.posY.i.hi) {

View File

@ -706,10 +706,8 @@ u8 func_801C4E4C(u8 frames[], Entity* self, u8 arg2) {
return var_a1;
}
/*
* Returns the absolute distance from g_CurrentEntity to player in the X Axis
*/
s32 func_801C4F64(void) {
// Absolute distance from g_CurrentEntity to the player in the X Axis
s32 GetDistanceToPlayerX(void) {
s16 xDistance = g_CurrentEntity->posX.i.hi - PLAYER.posX.i.hi;
if (xDistance < 0) {
@ -718,10 +716,8 @@ s32 func_801C4F64(void) {
return xDistance;
}
/*
* Returns the absolute distance from g_CurrentEntity to player in the Y Axis
*/
s32 func_801C4FA0(void) {
// Absolute distance from g_CurrentEntity to the player in the Y Axis
s32 GetDistanceToPlayerY(void) {
s32 yDistance = g_CurrentEntity->posY.i.hi - PLAYER.posY.i.hi;
if (yDistance < 0) {
@ -730,7 +726,7 @@ s32 func_801C4FA0(void) {
return yDistance;
}
s32 func_801C4FD4(void) {
s32 GetSideToPlayer(void) {
s16 var_a0 = g_CurrentEntity->posX.i.hi > PLAYER.posX.i.hi;
if (g_CurrentEntity->posY.i.hi > PLAYER.posY.i.hi) {

View File

@ -1306,7 +1306,7 @@ void func_801CC90C(Entity* arg0) {
s16 temp_v1;
s16 temp_v0;
temp_v0 = func_801C4F64();
temp_v0 = GetDistanceToPlayerX();
temp_v1 = arg0->ext.generic.unk84.S16.unk2;
if (temp_v1 != 0) {
@ -1355,7 +1355,7 @@ void func_801CF58C(Entity* self) {
void func_801CF5E0(Entity* self) {
s16 temp_v0;
if (self->facing == func_801C4FD4()) {
if (self->facing == GetSideToPlayer()) {
SetStep(5);
return;
}
@ -1396,7 +1396,7 @@ void func_801CF6D8(Entity* arg0) {
s16 temp_v1;
s16 temp_v0;
temp_v0 = func_801C4F64();
temp_v0 = GetDistanceToPlayerX();
temp_v1 = arg0->ext.generic.unk84.S16.unk2;
if (temp_v1 != 0) {
@ -1765,8 +1765,8 @@ void func_801D59D0(void) {
}
if (g_CurrentEntity->ext.generic.unk7C.U8.unk0 == 0) {
if (func_801C4F64() < 64) {
if (g_CurrentEntity->facing != (func_801C4FD4() & 1)) {
if (GetDistanceToPlayerX() < 64) {
if (g_CurrentEntity->facing != (GetSideToPlayer() & 1)) {
SetStep(4);
}
}

View File

@ -23,17 +23,17 @@ void EntityBat(Entity* entity) {
break;
case 1:
xDistance = func_801C4F64();
yDistance = func_801C4FA0();
xDistance = GetDistanceToPlayerX();
yDistance = GetDistanceToPlayerY();
if ((xDistance < 0x60) && (yDistance < 0x60) &&
!(func_801C4FD4() & 2)) {
!(GetSideToPlayer() & 2)) {
entity->step++;
}
break;
case 2:
if (AnimateEntity(D_80183C60, entity) == 0) {
entity->facing = (func_801C4FD4() & 1) ^ 1;
entity->facing = (GetSideToPlayer() & 1) ^ 1;
entity->accelerationY = 0xE000;
if (entity->facing != 0) {
entity->accelerationX = 0x4000;
@ -49,7 +49,7 @@ void EntityBat(Entity* entity) {
case 3:
AnimateEntity(D_80183C44, entity);
MoveEntity();
if (func_801C4FA0() < 0x20) {
if (GetDistanceToPlayerY() < 0x20) {
if (entity->facing == 0) {
entity->accelerationX = -0x10000;
} else {

View File

@ -37,7 +37,7 @@ void EntityZombie(Entity* self) {
case 1:
if (func_801C5074(&D_80183CAC) & 1) {
self->facing = (func_801C4FD4() & 1) ^ 1;
self->facing = (GetSideToPlayer() & 1) ^ 1;
self->step++;
}
break;

View File

@ -55,7 +55,7 @@ void func_801B2540(Entity* entity) {
}
if (entity->unk44 != 0) {
ret = GetPlayerSide();
ret = GetSideToPlayer();
phi_v1 = entity->ext.generic.unk7C.s;
if (phi_v1 != 0) {
phi_v1 = (ret & 2) * 2;

View File

@ -165,7 +165,7 @@ void EntitySlogra(Entity* self) {
return;
}
InitializeEntity(D_80180B44);
self->facing = (GetPlayerSide() & 1) ^ 1;
self->facing = (GetSideToPlayer() & 1) ^ 1;
CreateEntityFromCurrentEntity(E_SLOGRA_SPEAR, &self[1]);
case SLOGRA_FLOOR_ALIGN:
@ -176,7 +176,7 @@ void EntitySlogra(Entity* self) {
case SLOGRA_IDLE:
AnimateEntity(D_801812F4, self);
if (GetPlayerDistanceX() < 96) {
if (GetDistanceToPlayerX() < 96) {
SetStep(SLOGRA_WALKING_WITH_SPEAR);
}
break;
@ -189,7 +189,7 @@ void EntitySlogra(Entity* self) {
case SLOGRA_WALKING_WITH_SPEAR:
if (self->step_s == 0) {
self->facing = (GetPlayerSide() & 1) ^ 1;
self->facing = (GetSideToPlayer() & 1) ^ 1;
if (self->ext.GS_Props.attackMode != 0) {
self->ext.GS_Props.flag = 1;
} else {
@ -199,7 +199,7 @@ void EntitySlogra(Entity* self) {
self->step_s++;
}
AnimateEntity(D_801812E8, self);
self->facing = (GetPlayerSide() & 1) ^ 1;
self->facing = (GetSideToPlayer() & 1) ^ 1;
if (self->facing != self->ext.GS_Props.flag) {
self->accelerationX = 0xC000;
} else {
@ -207,7 +207,7 @@ void EntitySlogra(Entity* self) {
}
func_801BCB5C(&D_801812E0);
if (self->ext.GS_Props.flag == 0) {
if (GetPlayerDistanceX() < 72) {
if (GetDistanceToPlayerX() < 72) {
if (self->ext.GS_Props.attackMode == 0) {
self->ext.GS_Props.timer = 1;
} else {
@ -216,7 +216,7 @@ void EntitySlogra(Entity* self) {
}
}
if (self->ext.GS_Props.flag != 0) {
if (GetPlayerDistanceX() > 112) {
if (GetDistanceToPlayerX() > 112) {
if (self->ext.GS_Props.attackMode != 0) {
self->ext.GS_Props.timer = 1;
} else {
@ -254,7 +254,7 @@ void EntitySlogra(Entity* self) {
case SLOGRA_SPEAR_FIRE:
switch (self->step_s) {
case SLOGRA_FIRE_FACE_PLAYER:
self->facing = (GetPlayerSide() & 1) ^ 1;
self->facing = (GetSideToPlayer() & 1) ^ 1;
self->step_s++;
case SLOGRA_FIRE_PROJECTILE:
@ -327,14 +327,14 @@ void EntitySlogra(Entity* self) {
case SLOGRA_WALKING_WITHOUT_SPEAR:
if (self->step_s == 0) {
self->facing = (GetPlayerSide() & 1) ^ 1;
self->facing = (GetSideToPlayer() & 1) ^ 1;
self->ext.GS_Props.flag = 1;
self->ext.GS_Props.timer = 128;
self->step_s++;
}
AnimateEntity(D_80181370, self);
self->facing = (GetPlayerSide() & 1) ^ 1;
self->facing = (GetSideToPlayer() & 1) ^ 1;
if (self->facing != self->ext.GS_Props.flag) {
self->accelerationX = 0xC000;
} else {
@ -343,16 +343,16 @@ void EntitySlogra(Entity* self) {
func_801BCB5C(&D_801812E0);
if (self->ext.GS_Props.flag == 0) {
if (GetPlayerDistanceX() < 72) {
if (GetDistanceToPlayerX() < 72) {
self->ext.GS_Props.flag ^= 1;
}
if (self->ext.GS_Props.flag != 0) {
if (GetPlayerDistanceX() > 112) {
if (GetDistanceToPlayerX() > 112) {
self->ext.GS_Props.flag ^= 1;
}
}
} else {
if (GetPlayerDistanceX() >= 0x71) {
if (GetDistanceToPlayerX() >= 0x71) {
self->ext.GS_Props.flag ^= 1;
}
}
@ -627,7 +627,7 @@ void EntityGaibon(Entity* self) {
return;
}
InitializeEntity(D_80180B68);
self->facing = (GetPlayerSide() & 1) ^ 1;
self->facing = (GetSideToPlayer() & 1) ^ 1;
CreateEntityFromCurrentEntity(0x52, &self[1]);
self[1].zPriority = self->zPriority + 4;
SetStep(GAIBON_IDLE);
@ -638,7 +638,7 @@ void EntityGaibon(Entity* self) {
if (*(s32*)&self->animFrameIdx == 1) {
func_801C2598(NA_SE_EN_GAIBON_FLAP_WINGS);
}
if ((GetPlayerDistanceX() < 96) && (GetPlayerDistanceY() < 96)) {
if ((GetDistanceToPlayerX() < 96) && (GetDistanceToPlayerY() < 96)) {
SetStep(GAIBON_FLY_TOWARDS_PLAYER);
}
break;
@ -646,7 +646,7 @@ void EntityGaibon(Entity* self) {
case GAIBON_FLY_TOWARDS_PLAYER:
switch (self->step_s) {
case GAIBON_FLY_TOWARDS_PLAYER_BEGIN:
self->facing = (GetPlayerSide() & 1) ^ 1;
self->facing = (GetSideToPlayer() & 1) ^ 1;
self->ext.GS_Props.angle =
ratan2((PLAYER.posY.i.hi - 32) - self->posY.i.hi,
PLAYER.posX.i.hi - self->posX.i.hi);
@ -677,7 +677,7 @@ void EntityGaibon(Entity* self) {
if (*(s32*)&self->animFrameIdx == 1) {
func_801C2598(NA_SE_EN_GAIBON_FLAP_WINGS);
}
self->facing = (GetPlayerSide() & 1) ^ 1;
self->facing = (GetSideToPlayer() & 1) ^ 1;
self->ext.GS_Props.timer--;
if (self->ext.GS_Props.timer == 0) {
self->step_s++;
@ -702,10 +702,10 @@ void EntityGaibon(Entity* self) {
case GAIBON_FLY_SHOOT_FIREBALLS:
switch (self->step_s) {
case GAIBON_FLY_SHOOT_FIREBALLS_BEGIN:
self->facing = (GetPlayerSide() & 1) ^ 1;
self->facing = (GetSideToPlayer() & 1) ^ 1;
newEntity = &PLAYER;
temp_s3 = newEntity->posX.i.hi;
if (GetPlayerSide() & 1) {
if (GetSideToPlayer() & 1) {
temp_s3 += 0x60;
} else {
temp_s3 -= 0x60;
@ -830,7 +830,7 @@ void EntityGaibon(Entity* self) {
case GAIBON_SHOOT_FROM_GROUND:
switch (self->step_s) {
case GAIBON_SHOOT_FROM_GROUND_FACE_PLAYER:
self->facing = (GetPlayerSide() & 1) ^ 1;
self->facing = (GetSideToPlayer() & 1) ^ 1;
self->step_s++;
case GAIBON_SHOOT_FROM_GROUND_FACE_SETUP:
@ -993,7 +993,7 @@ void EntityGaibon(Entity* self) {
if (*(s32*)&self->animFrameIdx == 1) {
func_801C2598(NA_SE_EN_GAIBON_FLAP_WINGS);
}
if (GetPlayerSide() & 1) {
if (GetSideToPlayer() & 1) {
self->accelerationX -= 0xA00;
} else {
self->accelerationX += 0xA00;

View File

@ -470,10 +470,8 @@ u8 func_801BC6BC(u8 frames[], Entity* self, u8 arg2) {
return var_a1;
}
/*
* Returns the absolute distance from g_CurrentEntity to player in the X Axis
*/
s32 GetPlayerDistanceX(void) {
// Absolute distance from g_CurrentEntity to the player in the X Axis
s32 GetDistanceToPlayerX(void) {
s16 yDistance = g_CurrentEntity->posX.i.hi - PLAYER.posX.i.hi;
if (yDistance < 0) {
@ -482,10 +480,8 @@ s32 GetPlayerDistanceX(void) {
return yDistance;
}
/*
* Returns the absolute distance from g_CurrentEntity to player in the Y Axis
*/
s32 GetPlayerDistanceY(void) {
// Absolute distance from g_CurrentEntity to the player in the Y Axis
s32 GetDistanceToPlayerY(void) {
s32 yDistance = g_CurrentEntity->posY.i.hi - PLAYER.posY.i.hi;
if (yDistance < 0) {
@ -500,7 +496,7 @@ s32 GetPlayerDistanceY(void) {
* 1 = Player is on the left side
* 2 = Player is above
*/
s16 GetPlayerSide(void) {
s16 GetSideToPlayer(void) {
s16 side = g_CurrentEntity->posX.i.hi > PLAYER.posX.i.hi;
if (g_CurrentEntity->posY.i.hi > PLAYER.posY.i.hi) {

View File

@ -138,7 +138,7 @@ void EntityMerman2(Entity* self) {
self->step_s++;
}
if (AnimateEntity(D_8018229C, self) == 0) {
self->facing = (GetPlayerSide() & 1) ^ 1;
self->facing = (GetSideToPlayer() & 1) ^ 1;
}
MoveEntity();
posX = self->posX.i.hi;
@ -158,7 +158,7 @@ void EntityMerman2(Entity* self) {
if ((u8)self->ext.merman2.timer++ > 32) {
self->ext.merman2.timer = 0;
self->step_s = 0;
if ((GetPlayerDistanceX() >= 48) && !(Random() & 1)) {
if ((GetDistanceToPlayerX() >= 48) && !(Random() & 1)) {
SetStep(MERMAN2_JUMPING);
}
}
@ -318,7 +318,7 @@ void EntityMerman2(Entity* self) {
break;
case MERMAN2_WALKING_TO_PLAYER_FACE_PLAYER:
self->facing = (GetPlayerSide() & 1) ^ 1;
self->facing = (GetSideToPlayer() & 1) ^ 1;
self->ext.merman2.timer = D_80182244[Random() & 3];
self->step_s++;
break;
@ -365,7 +365,7 @@ void EntityMerman2(Entity* self) {
case MERMAN2_SPIT_FIRE:
switch (self->step_s) {
case MERMAN2_SPIT_FIRE_FACE_PLAYER:
self->facing = (GetPlayerSide() & 1) ^ 1;
self->facing = (GetSideToPlayer() & 1) ^ 1;
self->step_s++;
return;
@ -496,7 +496,7 @@ void EntityMerman2(Entity* self) {
self->animCurFrame = 14;
self->flags |= FLAG_DESTROY_IF_OUT_OF_CAMERA |
FLAG_DESTROY_IF_BARELY_OUT_OF_CAMERA;
if (!(GetPlayerSide() & 1)) {
if (!(GetSideToPlayer() & 1)) {
self->accelerationX = -0x20000;
} else {
self->accelerationX = 0x20000;

View File

@ -116,7 +116,7 @@ void EntityMerman(Entity* self) {
self->step_s++;
}
if (AnimateEntity(D_801823D0, self) == 0) {
self->facing = (GetPlayerSide() & 1) ^ 1;
self->facing = (GetSideToPlayer() & 1) ^ 1;
}
MoveEntity();
camY = g_Camera.posY.i.hi;
@ -138,7 +138,7 @@ void EntityMerman(Entity* self) {
if ((u8)self->ext.merman.timer2++ > 32) {
self->ext.merman.timer2 = 0;
self->step_s = 0;
if ((GetPlayerDistanceX() >= 48) && !(Random() & 1)) {
if ((GetDistanceToPlayerX() >= 48) && !(Random() & 1)) {
SetStep(MERMAN_JUMPING);
}
}
@ -219,7 +219,7 @@ void EntityMerman(Entity* self) {
case MERMAN_WALKING_TOWARDS_PLAYER:
switch (self->step_s) {
case MERMAN_WALKING_TOWARDS_START:
self->facing = (GetPlayerSide() & 1) ^ 1;
self->facing = (GetSideToPlayer() & 1) ^ 1;
if (self->facing == 0) {
self->accelerationX = -0x6000;
} else {
@ -260,7 +260,7 @@ void EntityMerman(Entity* self) {
case MERMAN_SPIT_FIRE:
switch (self->step_s) {
case MERMAN_SPIT_FIRE_FACE_PLAYER:
self->facing = (GetPlayerSide() & 1) ^ 1;
self->facing = (GetSideToPlayer() & 1) ^ 1;
self->step_s++;
break;
@ -380,7 +380,7 @@ void EntityMerman(Entity* self) {
case MERMAN_DYING_KNOCKEDBACK:
if (func_801BC8E4(&D_8018237C) & 1) {
if (!(GetPlayerSide() & 1)) {
if (!(GetSideToPlayer() & 1)) {
self->accelerationX = -0x8000;
} else {
self->accelerationX = 0x8000;

View File

@ -36,8 +36,8 @@ void func_801C90E8(void) {
return;
}
if ((g_CurrentEntity->ext.generic.unk7C.U8.unk0) == 0) {
if (GetPlayerDistanceX() < 64) {
if (g_CurrentEntity->facing != (GetPlayerSide() & 1)) {
if (GetDistanceToPlayerX() < 64) {
if (g_CurrentEntity->facing != (GetSideToPlayer() & 1)) {
SetStep(BONE_SCIMITAR_ATTACK);
}
}
@ -84,7 +84,7 @@ void EntityBoneScimitar(Entity* self) {
case BONE_SCIMITAR_WALK_TOWARDS_PLAYER:
if (AnimateEntity(D_80182464, self) == 0) {
self->facing = (GetPlayerSide() & 1) ^ 1;
self->facing = (GetSideToPlayer() & 1) ^ 1;
}
self->ext.generic.unk80.modeS8.unk0 = self->facing;
@ -94,7 +94,7 @@ void EntityBoneScimitar(Entity* self) {
self->accelerationX = 0x8000;
}
if (GetPlayerDistanceX() < 76) {
if (GetDistanceToPlayerX() < 76) {
self->step = BONE_SCIMITAR_WALK_AWAY_FROM_PLAYER;
}
func_801C90E8();
@ -102,7 +102,7 @@ void EntityBoneScimitar(Entity* self) {
case BONE_SCIMITAR_WALK_AWAY_FROM_PLAYER:
if (AnimateEntity(D_80182474, self) == 0) {
self->facing = (GetPlayerSide() & 1) ^ 1;
self->facing = (GetSideToPlayer() & 1) ^ 1;
}
self->ext.generic.unk80.modeS8.unk0 = self->facing ^ 1;
@ -112,7 +112,7 @@ void EntityBoneScimitar(Entity* self) {
self->accelerationX = 0x8000;
}
if (GetPlayerDistanceX() > 92) {
if (GetDistanceToPlayerX() > 92) {
self->step = BONE_SCIMITAR_WALK_TOWARDS_PLAYER;
}
func_801C90E8();
@ -188,7 +188,7 @@ void EntityBoneScimitar(Entity* self) {
break;
case BONE_SCIMITAR_SPECIAL:
self->facing = (GetPlayerSide() & 1) ^ 1;
self->facing = (GetSideToPlayer() & 1) ^ 1;
func_801BCB5C(&D_80182540);
if (((((u32)self->accelerationX) >> 0x1F) ^ self->facing) != 0) {
AnimateEntity(D_80182464, self);
@ -219,7 +219,7 @@ void EntityBoneScimitar(Entity* self) {
return;
}
if ((GetPlayerDistanceX() < 48) && (GetPlayerDistanceY() < 32)) {
if ((GetDistanceToPlayerX() < 48) && (GetDistanceToPlayerY() < 32)) {
SetStep(BONE_SCIMITAR_ATTACK);
}
break;

View File

@ -23,16 +23,16 @@ void EntityBat(Entity* entity) {
break;
case 1:
xDistance = GetPlayerDistanceX();
yDistance = GetPlayerDistanceY();
if ((xDistance < 96) && (yDistance < 96) && !(GetPlayerSide() & 2)) {
xDistance = GetDistanceToPlayerX();
yDistance = GetDistanceToPlayerY();
if ((xDistance < 96) && (yDistance < 96) && !(GetSideToPlayer() & 2)) {
entity->step++;
}
break;
case 2:
if (AnimateEntity(D_80182570, entity) == 0) {
entity->facing = (GetPlayerSide() & 1) ^ 1;
entity->facing = (GetSideToPlayer() & 1) ^ 1;
entity->accelerationY = 0xE000;
if (entity->facing != 0) {
entity->accelerationX = 0x4000;
@ -48,7 +48,7 @@ void EntityBat(Entity* entity) {
case 3:
AnimateEntity(D_80182554, entity);
MoveEntity();
if (GetPlayerDistanceY() < 0x20) {
if (GetDistanceToPlayerY() < 0x20) {
if (entity->facing == 0) {
entity->accelerationX = -0x10000;
} else {

View File

@ -37,7 +37,7 @@ void EntityZombie(Entity* self) {
case 1:
if (func_801BC8E4(D_801825BC) & 1) {
self->facing = (GetPlayerSide() & 1) ^ 1;
self->facing = (GetSideToPlayer() & 1) ^ 1;
self->step++;
}
break;

View File

@ -273,8 +273,8 @@ void EntityBloodyZombie(Entity* self) {
newEntity->posY.i.hi += 12;
}
}
facing = GetPlayerSide() & 1;
if (PLAYER.facing == facing && GetPlayerDistanceX() < 128) {
facing = GetSideToPlayer() & 1;
if (PLAYER.facing == facing && GetDistanceToPlayerX() < 128) {
self->facing = facing ^ 1;
SetStep(BLOODY_ZOMBIE_CHASE);
}
@ -282,7 +282,7 @@ void EntityBloodyZombie(Entity* self) {
case BLOODY_ZOMBIE_CHASE:
if (AnimateEntity(D_8018267C, self) == 0) {
self->facing = (GetPlayerSide() & 1) ^ 1;
self->facing = (GetSideToPlayer() & 1) ^ 1;
}
func_801BCB5C(D_801825E4);
@ -305,7 +305,7 @@ void EntityBloodyZombie(Entity* self) {
}
}
if (GetPlayerDistanceX() < 40) {
if (GetDistanceToPlayerX() < 40) {
SetStep(BLOODY_ZOMBIE_ATTACK);
}
break;
@ -326,7 +326,7 @@ void EntityBloodyZombie(Entity* self) {
newEntity = AllocEntity(D_8007D858, &D_8007D858[32]);
if (newEntity != NULL) {
CreateEntityFromEntity(0x4A, self, newEntity);
newEntity->facing = GetPlayerSide() & 1;
newEntity->facing = GetSideToPlayer() & 1;
}
self->step_s++;
}

View File

@ -38,7 +38,7 @@ extern void func_801BB2F8(s16);
extern void func_801BB3F4(s16);
extern s32 func_801BD308(u16* hitSensors, s16 sensorCount);
extern s32 func_801BD588(Entity* arg0, s32 arg1, s32 arg2, s32 arg3);
extern s32 GetPlayerDistanceX(void);
extern s32 GetDistanceToPlayerX(void);
extern s32 func_801CD658();
extern void EntityPrizeDrop(Entity* entity);
extern void EntityEquipItemDrop(Entity* entity);

View File

@ -540,14 +540,14 @@ void EntityMoveableBox(Entity* self) {
self->accelerationY = 0;
if (var_s1 & 1) {
temp_s1 = GetPlayerSide();
temp_s1 = GetSideToPlayer();
if (temp_s1 & 1 && player->accelerationX > 0) {
if (!(g_blinkTimer & 7)) {
g_api.PlaySfx(0x608);
}
self->accelerationX = 0x8000;
}
temp_s1 = GetPlayerSide();
temp_s1 = GetSideToPlayer();
if (!(primIndex = (temp_s1 & 1)) && (player->accelerationX < 0)) {
if (!(g_blinkTimer & 7)) {
g_api.PlaySfx(0x608);

View File

@ -276,7 +276,7 @@ void EntitySlogra(Entity* self) {
case SLOGRA_WALKING_WITH_SPEAR:
if (self->step_s == 0) {
self->facing = (GetPlayerSide() & 1) ^ 1;
self->facing = (GetSideToPlayer() & 1) ^ 1;
if (self->ext.GS_Props.attackMode != 0) { // shoot projectile ?
self->ext.GS_Props.flag = 1;
} else {
@ -286,7 +286,7 @@ void EntitySlogra(Entity* self) {
self->step_s++;
}
AnimateEntity(D_80181074, self);
self->facing = (GetPlayerSide() & 1) ^ 1;
self->facing = (GetSideToPlayer() & 1) ^ 1;
if (self->facing != self->ext.GS_Props.flag) {
self->accelerationX = 0xC000;
@ -295,7 +295,7 @@ void EntitySlogra(Entity* self) {
}
func_801BCF74(&D_8018106C);
if (self->ext.GS_Props.flag == 0) {
if (GetPlayerDistanceX() < 72) {
if (GetDistanceToPlayerX() < 72) {
if (self->ext.GS_Props.attackMode == 0) {
self->ext.GS_Props.timer = 1;
} else {
@ -304,7 +304,7 @@ void EntitySlogra(Entity* self) {
}
}
if (self->ext.GS_Props.flag != 0) {
if (GetPlayerDistanceX() > 112) {
if (GetDistanceToPlayerX() > 112) {
if (self->ext.GS_Props.attackMode != 0) {
self->ext.GS_Props.timer = 1;
} else {
@ -342,7 +342,7 @@ void EntitySlogra(Entity* self) {
case SLOGRA_SPEAR_FIRE:
switch (self->step_s) {
case SLOGRA_FIRE_FACE_PLAYER:
self->facing = (GetPlayerSide() & 1) ^ 1;
self->facing = (GetSideToPlayer() & 1) ^ 1;
self->step_s++;
case SLOGRA_FIRE_PROJECTILE:
@ -389,7 +389,7 @@ void EntitySlogra(Entity* self) {
case SLOGRA_KNOCKBACK_ACCEL:
self->accelerationY = -0x40000;
if (!(GetPlayerSide() & 1)) {
if (!(GetSideToPlayer() & 1)) {
self->accelerationX = -0x8000;
} else {
self->accelerationX = 0x8000;
@ -437,13 +437,13 @@ void EntitySlogra(Entity* self) {
case SLOGRA_WALKING_WITHOUT_SPEAR:
if (self->step_s == 0) {
self->facing = (GetPlayerSide() & 1) ^ 1;
self->facing = (GetSideToPlayer() & 1) ^ 1;
self->ext.GS_Props.flag = 1;
self->ext.GS_Props.timer = 128;
self->step_s++;
}
AnimateEntity(D_801810FC, self);
self->facing = (GetPlayerSide() & 1) ^ 1;
self->facing = (GetSideToPlayer() & 1) ^ 1;
if (!(self->facing == self->ext.GS_Props.flag)) {
self->accelerationX = 0xC000;
@ -453,16 +453,16 @@ void EntitySlogra(Entity* self) {
func_801BCF74(&D_8018106C);
if (self->ext.GS_Props.flag == 0) {
if (GetPlayerDistanceX() < 72) {
if (GetDistanceToPlayerX() < 72) {
self->ext.GS_Props.flag ^= 1;
}
if (self->ext.GS_Props.flag != 0) {
if (GetPlayerDistanceX() > 112) {
if (GetDistanceToPlayerX() > 112) {
self->ext.GS_Props.flag ^= 1;
}
}
} else {
if (GetPlayerDistanceX() > 112) {
if (GetDistanceToPlayerX() > 112) {
self->ext.GS_Props.flag ^= 1;
}
}
@ -744,7 +744,7 @@ void EntityGaibon(Entity* self) {
case GAIBON_FLY_TOWARDS_PLAYER:
switch (self->step_s) {
case GAIBON_FLY_TOWARDS_PLAYER_BEGIN:
self->facing = (GetPlayerSide() & 1) ^ 1;
self->facing = (GetSideToPlayer() & 1) ^ 1;
self->ext.GS_Props.angle =
ratan2((PLAYER.posY.i.hi - 32) - self->posY.i.hi,
PLAYER.posX.i.hi - self->posX.i.hi);
@ -775,7 +775,7 @@ void EntityGaibon(Entity* self) {
if (*(s32*)&self->animFrameIdx == 1) {
func_801C29B0(NA_SE_EN_GAIBON_FLAP_WINGS);
}
self->facing = (GetPlayerSide() & 1) ^ 1;
self->facing = (GetSideToPlayer() & 1) ^ 1;
self->ext.GS_Props.timer--;
if (self->ext.GS_Props.timer == 0) {
self->step_s++;
@ -799,10 +799,10 @@ void EntityGaibon(Entity* self) {
case GAIBON_FLY_SHOOT_FIREBALLS:
switch (self->step_s) {
case GAIBON_FLY_SHOOT_FIREBALLS_BEGIN:
self->facing = (GetPlayerSide() & 1) ^ 1;
self->facing = (GetSideToPlayer() & 1) ^ 1;
newEntity = &PLAYER;
var_s3 = newEntity->posX.i.hi;
if (GetPlayerSide() & 1) {
if (GetSideToPlayer() & 1) {
var_s3 += 0x60;
} else {
var_s3 -= 0x60;
@ -919,7 +919,7 @@ void EntityGaibon(Entity* self) {
case GAIBON_SHOOT_FROM_GROUND:
switch (self->step_s) {
case GAIBON_SHOOT_FROM_GROUND_FACE_PLAYER:
self->facing = (GetPlayerSide() & 1) ^ 1;
self->facing = (GetSideToPlayer() & 1) ^ 1;
self->step_s++;
case GAIBON_SHOOT_FROM_GROUND_FACE_SETUP:
@ -1078,7 +1078,7 @@ void EntityGaibon(Entity* self) {
if (*(s32*)&self->animFrameIdx == 1) {
func_801C29B0(NA_SE_EN_GAIBON_FLAP_WINGS);
}
if (GetPlayerSide() & 1) {
if (GetSideToPlayer() & 1) {
self->accelerationX -= 0xA00;
} else {
self->accelerationX += 0xA00;

View File

@ -731,10 +731,8 @@ u8 func_801BCAD4(u8 frames[], Entity* self, u8 arg2) {
return var_a1;
}
/*
* Returns the absolute distance from g_CurrentEntity to player in the X Axis
*/
s32 GetPlayerDistanceX(void) {
// Absolute distance from g_CurrentEntity to the player in the X Axis
s32 GetDistanceToPlayerX(void) {
s16 xDistance = g_CurrentEntity->posX.i.hi - PLAYER.posX.i.hi;
if (xDistance < 0) {
@ -743,10 +741,8 @@ s32 GetPlayerDistanceX(void) {
return xDistance;
}
/*
* Returns the absolute distance from g_CurrentEntity to player in the Y Axis
*/
s32 GetPlayerDistanceY(void) {
// Absolute distance from g_CurrentEntity to the player in the Y Axis
s32 GetDistanceToPlayerY(void) {
s32 yDistance = g_CurrentEntity->posY.i.hi - PLAYER.posY.i.hi;
if (yDistance < 0) {
@ -761,7 +757,7 @@ s32 GetPlayerDistanceY(void) {
* 1 = Player is on the left side
* 2 = Player is above
*/
s16 GetPlayerSide(void) {
s16 GetSideToPlayer(void) {
s16 side = g_CurrentEntity->posX.i.hi > PLAYER.posX.i.hi;
if (g_CurrentEntity->posY.i.hi > PLAYER.posY.i.hi) {

View File

@ -37,8 +37,8 @@ void func_801C3708(void) {
}
if (g_CurrentEntity->ext.generic.unk7C.U8.unk0 == 0) {
if (GetPlayerDistanceX() < 64) {
if (g_CurrentEntity->facing != (GetPlayerSide() & 1)) {
if (GetDistanceToPlayerX() < 64) {
if (g_CurrentEntity->facing != (GetSideToPlayer() & 1)) {
SetStep(BONE_SCIMITAR_ATTACK);
}
}
@ -85,7 +85,7 @@ void EntityBoneScimitar(Entity* self) {
case BONE_SCIMITAR_WALK_TOWARDS_PLAYER:
if (AnimateEntity(D_80182090, self) == 0) {
self->facing = (GetPlayerSide() & 1) ^ 1;
self->facing = (GetSideToPlayer() & 1) ^ 1;
}
self->ext.generic.unk80.modeS8.unk0 = self->facing;
@ -95,7 +95,7 @@ void EntityBoneScimitar(Entity* self) {
self->accelerationX = 0x8000;
}
if (GetPlayerDistanceX() < 76) {
if (GetDistanceToPlayerX() < 76) {
self->step = BONE_SCIMITAR_WALK_AWAY_FROM_PLAYER;
}
func_801C3708();
@ -103,7 +103,7 @@ void EntityBoneScimitar(Entity* self) {
case BONE_SCIMITAR_WALK_AWAY_FROM_PLAYER:
if (AnimateEntity(D_801820A0, self) == 0) {
self->facing = (GetPlayerSide() & 1) ^ 1;
self->facing = (GetSideToPlayer() & 1) ^ 1;
}
self->ext.generic.unk80.modeS8.unk0 = self->facing ^ 1;
@ -113,7 +113,7 @@ void EntityBoneScimitar(Entity* self) {
self->accelerationX = 0x8000;
}
if (GetPlayerDistanceX() > 92) {
if (GetDistanceToPlayerX() > 92) {
self->step = BONE_SCIMITAR_WALK_TOWARDS_PLAYER;
}
func_801C3708();
@ -189,7 +189,7 @@ void EntityBoneScimitar(Entity* self) {
break;
case BONE_SCIMITAR_SPECIAL:
self->facing = (GetPlayerSide() & 1) ^ 1;
self->facing = (GetSideToPlayer() & 1) ^ 1;
func_801BCF74(&D_8018216C);
if (((((u32)self->accelerationX) >> 0x1F) ^ self->facing) != 0) {
AnimateEntity(D_80182090, self);
@ -220,7 +220,7 @@ void EntityBoneScimitar(Entity* self) {
return;
}
if ((GetPlayerDistanceX() < 48) && (GetPlayerDistanceY() < 32)) {
if ((GetDistanceToPlayerX() < 48) && (GetDistanceToPlayerY() < 32)) {
SetStep(BONE_SCIMITAR_ATTACK);
}
break;

View File

@ -93,14 +93,14 @@ void EntityAxeKnight(Entity* self) {
switch (self->step) {
case AXE_KNIGHT_INIT:
InitializeEntity(D_80180C64);
self->facing = (GetPlayerSide() & 1) ^ 1;
self->facing = (GetSideToPlayer() & 1) ^ 1;
self->hitboxOffY = 10;
self->ext.generic.unk7C.S8.unk1 = 0;
self->ext.generic.unk80.modeS16.unk2 = 512;
case AXE_KNIGHT_IDLE:
if (func_801BCCFC(&D_80182188) & 1) {
self->facing = (GetPlayerSide() & 1) ^ 1;
self->facing = (GetSideToPlayer() & 1) ^ 1;
SetStep(AXE_KNIGHT_WALK_TOWARDS_PLAYER);
}
break;
@ -117,7 +117,7 @@ void EntityAxeKnight(Entity* self) {
animStatus = AnimateEntity(D_80182210, self);
if (self->animFrameDuration == 0) {
self->facing = (GetPlayerSide() & 1) ^ 1;
self->facing = (GetSideToPlayer() & 1) ^ 1;
}
if (animStatus == 0) {
@ -126,7 +126,7 @@ void EntityAxeKnight(Entity* self) {
} else {
self->accelerationX = 0x3000;
}
if (GetPlayerDistanceX() < 96) {
if (GetDistanceToPlayerX() < 96) {
SetStep(AXE_KNIGHT_WALK_AWAY_FROM_PLAYER);
self->ext.generic.unk7C.S8.unk0 = 1;
}
@ -163,7 +163,7 @@ void EntityAxeKnight(Entity* self) {
animStatus = AnimateEntity(D_80182210, self);
if (self->animFrameDuration == 0) {
self->facing = (GetPlayerSide() & 1) ^ 1;
self->facing = (GetSideToPlayer() & 1) ^ 1;
}
if (animStatus == 0) {
if (self->facing == 0) {
@ -172,7 +172,7 @@ void EntityAxeKnight(Entity* self) {
self->accelerationX = -0x3000;
}
if (GetPlayerDistanceX() > 80) {
if (GetDistanceToPlayerX() > 80) {
SetStep(AXE_KNIGHT_WALK_TOWARDS_PLAYER);
self->ext.generic.unk7C.S8.unk0 = 0;
}
@ -201,7 +201,7 @@ void EntityAxeKnight(Entity* self) {
animStatus = AnimateEntity(D_80182244, self);
if (animStatus == 0) {
label:
if (GetPlayerDistanceX() < 89) {
if (GetDistanceToPlayerX() < 89) {
SetStep(AXE_KNIGHT_WALK_AWAY_FROM_PLAYER);
self->ext.generic.unk7C.S8.unk0 = 1;
} else {
@ -250,7 +250,7 @@ void EntityAxeKnight(Entity* self) {
case AXE_KNIGHT_ARCING_THROW: // unused
animStatus = AnimateEntity(D_80182244, self);
if (animStatus == 0) {
if (GetPlayerDistanceX() > 88) {
if (GetDistanceToPlayerX() > 88) {
SetStep(AXE_KNIGHT_WALK_TOWARDS_PLAYER);
self->ext.generic.unk7C.S8.unk0 = 0;
} else {

View File

@ -273,8 +273,8 @@ void EntityBloodyZombie(Entity* self) {
newEntity->posY.i.hi += 12;
}
}
facing = GetPlayerSide() & 1;
if (PLAYER.facing == facing && GetPlayerDistanceX() < 128) {
facing = GetSideToPlayer() & 1;
if (PLAYER.facing == facing && GetDistanceToPlayerX() < 128) {
self->facing = facing ^ 1;
SetStep(BLOODY_ZOMBIE_CHASE);
}
@ -282,7 +282,7 @@ void EntityBloodyZombie(Entity* self) {
case BLOODY_ZOMBIE_CHASE:
if (AnimateEntity(D_8018237C, self) == 0) {
self->facing = (GetPlayerSide() & 1) ^ 1;
self->facing = (GetSideToPlayer() & 1) ^ 1;
}
func_801BCF74(D_801822E4);
@ -305,7 +305,7 @@ void EntityBloodyZombie(Entity* self) {
}
}
if (GetPlayerDistanceX() < 40) {
if (GetDistanceToPlayerX() < 40) {
SetStep(BLOODY_ZOMBIE_ATTACK);
}
break;
@ -326,7 +326,7 @@ void EntityBloodyZombie(Entity* self) {
newEntity = AllocEntity(D_8007D858, &D_8007D858[32]);
if (newEntity != NULL) {
CreateEntityFromEntity(0x2D, self, newEntity);
newEntity->facing = GetPlayerSide() & 1;
newEntity->facing = GetSideToPlayer() & 1;
}
self->step_s++;
}

View File

@ -43,7 +43,7 @@ void EntitySkeleton(Entity* self) {
break;
case SKELETON_WALK_TOWARDS_PLAYER:
self->facing = (GetPlayerSide() & 1) ^ 1;
self->facing = (GetSideToPlayer() & 1) ^ 1;
self->ext.generic.unk80.modeS8.unk0 = self->facing;
AnimateEntity(D_801823DC, self);
@ -53,14 +53,14 @@ void EntitySkeleton(Entity* self) {
self->accelerationX = 0x8000;
}
if (GetPlayerDistanceX() < 76) {
if (GetDistanceToPlayerX() < 76) {
self->step = SKELETON_WALK_AWAY_FROM_PLAYER;
}
func_801C5F2C(self);
break;
case SKELETON_WALK_AWAY_FROM_PLAYER:
self->facing = (GetPlayerSide() & 1) ^ 1;
self->facing = (GetSideToPlayer() & 1) ^ 1;
self->ext.generic.unk80.modeS8.unk0 = self->facing ^ 1;
AnimateEntity(D_801823EC, self);
@ -70,7 +70,7 @@ void EntitySkeleton(Entity* self) {
self->accelerationX = 0x8000;
}
if (GetPlayerDistanceX() > 92) {
if (GetDistanceToPlayerX() > 92) {
self->step = SKELETON_WALK_TOWARDS_PLAYER;
}
func_801C5F2C(self);
@ -219,7 +219,7 @@ void func_801C6574(Entity* entity) { // Bone Projectile from Skeleton
} else {
InitializeEntity(D_80180CA0);
entity->posY.val -= 0x1000;
xDistanceToPlayer = GetPlayerDistanceX();
xDistanceToPlayer = GetDistanceToPlayerX();
xDistanceToPlayer /= 32;
xDistanceToPlayer = CLAMP_MAX(xDistanceToPlayer, 7);
accelerationX = D_80182488[xDistanceToPlayer];

View File

@ -48,8 +48,8 @@ void EntityBloodSkeleton(Entity* self) {
}
if ((AnimateEntity(D_80182610, self) == 0) &&
(GetPlayerDistanceY() < 48) && (Random() % 4) == 0) {
self->facing = GetPlayerSide() % 2 == 0;
(GetDistanceToPlayerY() < 48) && (Random() % 4) == 0) {
self->facing = GetSideToPlayer() % 2 == 0;
}
if ((u8)func_801C070C(&D_801826AC, self->facing) != 2) {

View File

@ -77,7 +77,7 @@ void EntityLockCamera(Entity* entity) {
}
if (func_801A7E2C(entity)) {
temp_v0_2 = GetPlayerSide();
temp_v0_2 = GetSideToPlayer();
if (entity->ext.generic.unk7C.modeU16) {
phi_v1 = (temp_v0_2 & 2) * 2;
} else {
@ -108,7 +108,7 @@ void func_801A805C(Entity* self) {
if (self->unk44 != 0) {
params_ = params - 2;
if (params_ < 2) {
self->facing = GetPlayerSide() & 1;
self->facing = GetSideToPlayer() & 1;
posY = self->posY.i.hi - 40;
if (params == 2) {

View File

@ -159,7 +159,7 @@ void EntityDracula(Entity* self) {
if (self->ext.dracula.unkA0 != 0) {
g_api.PlaySfx(NA_SE_VO_DR_TAUNT_1);
self->animCurFrame = 1;
self->facing = (GetPlayerSide() & 1) ^ 1;
self->facing = (GetSideToPlayer() & 1) ^ 1;
self->ext.dracula.unkA0 = 0;
}
if (self->ext.dracula.unk9C != 0xFF) {
@ -169,7 +169,7 @@ void EntityDracula(Entity* self) {
break;
case 3:
self->facing = (GetPlayerSide() & 1) ^ 1;
self->facing = (GetSideToPlayer() & 1) ^ 1;
self->ext.dracula.unkA2 = (self->ext.dracula.unkA2 + 1) & 3;
self->hitboxState = 3;
if (self->ext.dracula.unkA2 == 0) {

View File

@ -603,10 +603,8 @@ u8 func_801B4AF0(u8 frames[], Entity* self, u8 arg2) {
return var_a1;
}
/*
* Returns the absolute distance from g_CurrentEntity to player in the X Axis
*/
s16 GetPlayerDistanceX(void) {
// Absolute distance from g_CurrentEntity to the player in the X Axis
s16 GetDistanceToPlayerX(void) {
s16 xDistance = g_CurrentEntity->posX.i.hi - PLAYER.posX.i.hi;
if (xDistance < 0) {
@ -615,10 +613,8 @@ s16 GetPlayerDistanceX(void) {
return xDistance;
}
/*
* Returns the absolute distance from g_CurrentEntity to player in the Y Axis
*/
s32 GetPlayerDistanceY(void) {
// Absolute distance from g_CurrentEntity to the player in the Y Axis
s32 GetDistanceToPlayerY(void) {
s32 yDistance = g_CurrentEntity->posY.i.hi - PLAYER.posY.i.hi;
if (yDistance < 0) {
@ -627,7 +623,7 @@ s32 GetPlayerDistanceY(void) {
return yDistance;
}
s16 GetPlayerSide(void) {
s16 GetSideToPlayer(void) {
s16 side = g_CurrentEntity->posX.i.hi > PLAYER.posX.i.hi;
if (g_CurrentEntity->posY.i.hi > PLAYER.posY.i.hi) {

View File

@ -33,7 +33,7 @@ typedef enum {
} EntityIDs;
void CreateEntityFromEntity(u16 objectId, Entity* source, Entity* entity);
s16 GetPlayerSide();
s16 GetSideToPlayer();
void MoveEntity();
void SetStep(u8);
void EntityExplosion(Entity*);

View File

@ -1245,7 +1245,7 @@ void func_801870B0(Entity* entity) {
}
if (entity->unk44 != 0) {
ret = func_8018B970();
ret = GetSideToPlayer();
phi_v1 = entity->ext.generic.unk7C.s;
if (phi_v1 != 0) {
phi_v1 = (ret & 2) * 2;
@ -2193,10 +2193,8 @@ u8 func_8018B7E8(u8 frames[], Entity* self, u8 arg2) {
return var_a1;
}
/*
* Returns the absolute distance from g_CurrentEntity to player in the X Axis
*/
s16 func_8018B900(void) {
// Absolute distance from g_CurrentEntity to the player in the X Axis
s16 GetDistanceToPlayerX(void) {
s16 xDistance = g_CurrentEntity->posX.i.hi - PLAYER.posX.i.hi;
if (xDistance < 0) {
@ -2205,10 +2203,8 @@ s16 func_8018B900(void) {
return xDistance;
}
/*
* Returns the absolute distance from g_CurrentEntity to player in the Y Axis
*/
s32 func_8018B93C(void) {
// Absolute distance from g_CurrentEntity to the player in the Y Axis
s32 GetDistanceToPlayerY(void) {
s32 yDistance = g_CurrentEntity->posY.i.hi - PLAYER.posY.i.hi;
if (yDistance < 0) {
@ -2217,7 +2213,7 @@ s32 func_8018B93C(void) {
return yDistance;
}
s32 func_8018B970(void) {
s32 GetSideToPlayer(void) {
s16 arg0 = g_CurrentEntity->posX.i.hi > PLAYER.posX.i.hi;
if (g_CurrentEntity->posY.i.hi > PLAYER.posY.i.hi) {