Use player status flags where possible (#1709)

There's some cases which don't nicely map to the defines in place so
I've left as is

-
cf280c66f5/src/st/dre/succubus.c (L583)
- is this a mask like these?
https://github.com/search?q=repo%3AXeeynamo%2Fsotn-decomp%20PLAYER_UNK0C_READY_MASK&type=code
This commit is contained in:
Josh Schreuder 2024-10-02 10:23:24 +10:00 committed by GitHub
parent b9f02684ee
commit b9d7e3fd57
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
22 changed files with 121 additions and 90 deletions

View File

@ -289,22 +289,24 @@ typedef enum {
} EntityFlag;
// document g_Player.unk0C
#define PLAYER_STATUS_BAT_FORM 0x00000001
#define PLAYER_STATUS_MIST_FORM 0x00000002
#define PLAYER_STATUS_WOLF_FORM 0x00000004
#define PLAYER_STATUS_BAT_FORM 0x1
#define PLAYER_STATUS_MIST_FORM 0x2
#define PLAYER_STATUS_WOLF_FORM 0x4
#define PLAYER_STATUS_TRANSFORM \
(PLAYER_STATUS_BAT_FORM | PLAYER_STATUS_MIST_FORM | PLAYER_STATUS_WOLF_FORM)
#define PLAYER_STATUS_UNK8 0x8
#define PLAYER_STATUS_UNK10 0x10
#define PLAYER_STATUS_UNK_20 0x00000020
#define PLAYER_STATUS_UNK_20 0x20
#define PLAYER_STATUS_UNK40 0x40
#define PLAYER_STATUS_STONE 0x00000080
#define PLAYER_STATUS_STONE 0x80
#define PLAYER_STATUS_UNK100 0x100
#define PLAYER_STATUS_UNK200 0x200
#define PLAYER_STATUS_UNK400 0x400
#define PLAYER_STATUS_UNK800 0x800
#define PLAYER_STATUS_UNK1000 0x1000
#define PLAYER_STATUS_UNK2000 0x2000
#define PLAYER_STATUS_POISON 0x00004000
#define PLAYER_STATUS_CURSE 0x00008000
#define PLAYER_STATUS_POISON 0x4000
#define PLAYER_STATUS_CURSE 0x8000
#define PLAYER_STATUS_UNK10000 0x10000 // possibly freezing?
#define PLAYER_STATUS_UNK20000 0x20000
#define PLAYER_STATUS_UNK40000 0x40000
@ -313,10 +315,10 @@ typedef enum {
#define PLAYER_STATUS_UNK200000 0x200000
#define PLAYER_STATUS_UNK400000 0x400000
#define PLAYER_STATUS_UNK800000 0x800000
#define PLAYER_STATUS_AXEARMOR 0x01000000
#define PLAYER_STATUS_ABSORB_BLOOD 0x02000000
#define PLAYER_STATUS_UNK4000000 0x04000000
#define NO_AFTERIMAGE 0x08000000
#define PLAYER_STATUS_AXEARMOR 0x1000000
#define PLAYER_STATUS_ABSORB_BLOOD 0x2000000
#define PLAYER_STATUS_UNK4000000 0x4000000
#define NO_AFTERIMAGE 0x8000000
#define PLAYER_STATUS_UNK10000000 0x10000000
#define PLAYER_STATUS_UNK40000000 0x40000000
#define PLAYER_STATUS_UNK80000000 0x80000000

View File

@ -317,7 +317,7 @@ s32 SetNextRoomToLoad(u32 x, u32 y) {
RoomHeader* room;
u32 stack[4];
if (g_Player.unk0C & 0x40000) {
if (g_Player.unk0C & PLAYER_STATUS_UNK40000) {
return 0;
}
res = func_800F087C(x, y);
@ -1485,7 +1485,7 @@ void RunMainEngine(void) {
if (D_80137598 != 0) {
func_80105428();
}
if (g_Player.unk0C & 0x80000) {
if (g_Player.unk0C & PLAYER_STATUS_UNK80000) {
g_GameEngineStep = Engine_10;
g_MenuStep = MENU_STEP_INIT;
}
@ -1513,7 +1513,7 @@ void RunMainEngine(void) {
D_8006BB00 = 0;
}
}
if (!(g_Player.unk0C & 0x40000)) {
if (!(g_Player.unk0C & PLAYER_STATUS_UNK40000)) {
if ((g_pads[0].tapped & PAD_START) && (D_8003C8B8 != 0)) {
func_801027A4();
if ((g_StageId == STAGE_ST0) ||

View File

@ -671,7 +671,7 @@ s32 HandleDamage(DamageParam* damage, s32 arg1, s32 amount, s32 arg3) {
amount -= amount / 3;
}
}
if (g_Player.unk0C & 0x80) {
if (g_Player.unk0C & PLAYER_STATUS_STONE) {
damage->damageTaken = g_Status.hpMax / 8;
ret = 8;
} else if (damage->effects & 0x200) {
@ -693,7 +693,7 @@ s32 HandleDamage(DamageParam* damage, s32 arg1, s32 amount, s32 arg3) {
} else {
damage->damageTaken = g_Status.hpMax / 8;
}
if (g_Player.unk0C & 0x4000) {
if (g_Player.unk0C & PLAYER_STATUS_POISON) {
damage->damageTaken *= 2;
}
// Check for player wearing a Talisman (chance to dodge attack)
@ -716,7 +716,7 @@ s32 HandleDamage(DamageParam* damage, s32 arg1, s32 amount, s32 arg3) {
ret = 3;
} else {
if (g_Status.defenseEquip > 99 && !(damage->effects & 0x180) &&
!(g_Player.unk0C & 0x80)) {
!(g_Player.unk0C & PLAYER_STATUS_STONE)) {
damage->damageKind = 0;
ret = 1;
} else {
@ -1813,7 +1813,7 @@ void DrawRichterHudSubweapon(void) {
prim->u3 = ((g_Status.hearts / 10) * 8) + 8;
prim->v3 = 0x68;
// Perhaps flashes the heart numbers when you have enough for a crash
if ((g_Player.unk0C & 0x200000) && !(g_Timer & 2)) {
if ((g_Player.unk0C & PLAYER_STATUS_UNK200000) && !(g_Timer & 2)) {
prim->clut = 0x100;
} else {
prim->clut = 0x103;
@ -2049,7 +2049,8 @@ void DrawHudSubweapon() {
}
if ((CheckEquipmentItemCount(ITEM_HEALING_MAIL, EQUIP_ARMOR)) &&
((g_Player.unk0C & 0x04000007) == 0x04000000)) {
((g_Player.unk0C & (PLAYER_STATUS_TRANSFORM |
PLAYER_STATUS_UNK4000000)) == 0x04000000)) {
g_HealingMailTimer[0]++;
if (g_HealingMailTimer[0] >= 128) {
g_Player.unk56 = 2;

View File

@ -145,7 +145,7 @@ void func_801093C4(void) {
}
drawEnv = g_CurrentBuffer->draw;
drawEnv.isbg = false;
if (g_Player.unk0C & 0x04000000) {
if (g_Player.unk0C & PLAYER_STATUS_UNK4000000) {
drawEnv.isbg = true;
}
drawEnv.r0 = drawEnv.g0 = drawEnv.b0 = 0;
@ -271,14 +271,15 @@ void func_80109594() {
weapon = D_8017A000.EntityWeaponAttack;
weapon();
g_Player.unk0C |= 0x01000000;
g_Player.unk0C |= PLAYER_STATUS_AXEARMOR;
func_8010DFF0(1, 10);
func_80109328();
}
void func_80109990(void) {
if (D_80137FB4 == 0) {
if (g_Status.mp == g_Status.mpMax && !(g_Player.unk0C & 0x100000)) {
if (g_Status.mp == g_Status.mpMax &&
!(g_Player.unk0C & PLAYER_STATUS_UNK100000)) {
CreateEntFactoryFromEntity(g_CurrentEntity, 40, 0);
PlaySfx(SFX_UI_MP_FULL);
D_80137FB4++;
@ -452,7 +453,7 @@ void func_8010A234(s32 arg0) {
// Wearing Axe Lord Armor! This is probably when you initially put it on.
if ((weapon() == 0x2D) &&
CheckEquipmentItemCount(ITEM_AXE_LORD_ARMOR, EQUIP_ARMOR)) {
if (!(g_Player.unk0C & 0x01000000)) {
if (!(g_Player.unk0C & PLAYER_STATUS_AXEARMOR)) {
// Alucard says "WHAT?!" when first putting on Axe Lord Armor
PlaySfx(NA_SE_VO_AL_WHAT);
g_Player.padSim = 0;
@ -460,14 +461,14 @@ void func_8010A234(s32 arg0) {
func_8010FAF4();
weapon = D_8017A000.EntityWeaponAttack;
weapon();
g_Player.unk0C |= 0x01000000;
g_Player.unk0C |= PLAYER_STATUS_AXEARMOR;
func_8010DFF0(1, 0xA);
func_80109328();
if (arg0 != 0) {
PlayAnimation(D_800B0130, D_800B01B8);
}
}
} else if (g_Player.unk0C & 0x01000000) {
} else if (g_Player.unk0C & PLAYER_STATUS_AXEARMOR) {
PLAYER.palette = 0x8100;
PLAYER.animSet = 1;
PLAYER.unk5A = 0;
@ -483,7 +484,7 @@ void func_8010A234(s32 arg0) {
} else {
func_8010E7AC();
}
g_Player.unk0C &= ~0x01000000;
g_Player.unk0C &= ~PLAYER_STATUS_AXEARMOR;
func_80111CC0();
if (arg0 != 0) {
PlayAnimation(D_800B0130, D_800B01B8);
@ -565,7 +566,7 @@ void EntityAlucard(void) {
D_80137FB8 = g_unkGraphicsStruct.D_800973FC;
var_s7 = 0;
g_Player.unk72 = func_80110394();
if (!(g_Player.unk0C & 0x40000)) {
if (!(g_Player.unk0C & PLAYER_STATUS_UNK40000)) {
var_s0 = GetTeleportToOtherCastle();
if (var_s0 != 0) {
func_8010E42C(var_s0);
@ -580,14 +581,15 @@ void EntityAlucard(void) {
func_80118C84(g_Player.unk58, 1);
if (g_Player.unk56 == 1) {
PlaySfx(SFX_HEALTH_PICKUP);
if (!(g_Player.unk0C & 0x80)) {
if (!(g_Player.unk0C & PLAYER_STATUS_STONE)) {
CreateEntFactoryFromEntity(
g_CurrentEntity, FACTORY(0x2C, 0x48), 0);
CreateEntFactoryFromEntity(
g_CurrentEntity, FACTORY(0x2C, 0x44), 0);
}
}
if ((g_Player.unk56 == 2) && !(g_Player.unk0C & 0x80)) {
if ((g_Player.unk56 == 2) &&
!(g_Player.unk0C & PLAYER_STATUS_STONE)) {
CreateEntFactoryFromEntity(
g_CurrentEntity, FACTORY(0x2C, 0x48), 0);
}
@ -639,14 +641,16 @@ void EntityAlucard(void) {
if (!--g_Player.timers[var_s0]) {
switch (var_s0) {
case 0:
if (!(g_Player.unk0C & 0x8080)) {
if (!(g_Player.unk0C & (PLAYER_STATUS_STONE |
PLAYER_STATUS_CURSE))) {
g_Player.timers[4] = 0xC;
g_Player.timers[15] = 0xC;
func_8010E168(1, 0xC);
}
continue;
case 1:
if (!(g_Player.unk0C & 0x8080)) {
if (!(g_Player.unk0C & (PLAYER_STATUS_STONE |
PLAYER_STATUS_CURSE))) {
g_Player.timers[4] = 0xC;
g_Player.timers[15] = 0xC;
func_8010E168(1, 0xC);
@ -657,7 +661,9 @@ void EntityAlucard(void) {
continue;
case 3:
PLAYER.palette = 0x8100;
if (!(g_Player.unk0C & 0xC080)) {
if (!(g_Player.unk0C &
(PLAYER_STATUS_STONE | PLAYER_STATUS_POISON |
PLAYER_STATUS_CURSE))) {
g_Player.timers[4] = 0xC;
g_Player.timers[15] = 0xC;
func_8010E168(1, 0xC);
@ -708,7 +714,7 @@ void EntityAlucard(void) {
break;
case 2: /* switch 6 */
func_8010E168(1, 4);
if (g_Player.unk0C & 0x01000000) {
if (g_Player.unk0C & PLAYER_STATUS_AXEARMOR) {
SetPlayerStep(Player_Unk50);
} else {
SetPlayerStep(Player_Unk49);
@ -733,7 +739,7 @@ void EntityAlucard(void) {
}
g_Player.padTapped =
(g_Player.padHeld ^ g_Player.padPressed) & g_Player.padPressed;
if (g_Player.unk0C & 8) {
if (g_Player.unk0C & PLAYER_STATUS_UNK8) {
g_Player.padTapped &= ~(PAD_SQUARE | PAD_CIRCLE);
g_Player.padPressed &= ~(PAD_SQUARE | PAD_CIRCLE);
}
@ -773,7 +779,7 @@ void EntityAlucard(void) {
var_s7 = PLAYER.step_s;
var_s0 = HandleDamage(
&damage, PLAYER.hitParams, PLAYER.hitPoints, 0);
if ((g_Player.unk0C & 0x01000000) &&
if ((g_Player.unk0C & PLAYER_STATUS_AXEARMOR) &&
((var_s0 == 1) || (var_s0 == 7) ||
(var_s0 == 8))) {
var_s0 = 3;
@ -1030,7 +1036,7 @@ block_160:
}
var_s0 = 0;
g_unkGraphicsStruct.unk1C &= ~2;
g_Player.unk0C &= ~8;
g_Player.unk0C &= ~PLAYER_STATUS_UNK8;
g_Player.unk08 = g_Player.unk0C;
g_Status.D_80097BF8 &= ~1;
switch (PLAYER.step) { /* switch 5 */
@ -1193,18 +1199,19 @@ block_160:
g_Status.D_80097BF8 |= 1;
}
if (g_Player.timers[13] | g_Player.timers[14]) {
g_Player.unk0C |= 0x100;
g_Player.unk0C |= PLAYER_STATUS_UNK100;
}
if ((g_Player.unk08 & 0x10000) && !(g_Player.unk0C & 0x50000)) {
if ((g_Player.unk08 & 0x10000) &&
!(g_Player.unk0C & (PLAYER_STATUS_UNK10000 | PLAYER_STATUS_UNK40000))) {
func_8010E168(1, 0xC);
if (!(g_Player.unk0C & 0xC000)) {
if (!(g_Player.unk0C & (PLAYER_STATUS_POISON | PLAYER_STATUS_CURSE))) {
g_Player.timers[4] = 0xC;
g_Player.timers[15] = 4;
PLAYER.palette = 0x8100;
}
}
PlayAnimation(D_800B0130, D_800B01B8);
if (g_Player.unk0C & 0x40000) {
if (g_Player.unk0C & PLAYER_STATUS_UNK40000) {
if (PLAYER.animFrameDuration < 0) {
PLAYER.animCurFrame |= ANIM_FRAME_LOAD;
}
@ -1218,9 +1225,12 @@ block_160:
g_Player.unk14 = 0;
g_Player.unk7A = 0;
func_801093C4();
if (!(g_Player.unk0C & 0x50)) {
if (!(g_Player.unk0C & (PLAYER_STATUS_UNK10 | PLAYER_STATUS_UNK40))) {
if ((CheckEquipmentItemCount(0x58U, 4U) != 0) &&
!(g_Player.unk0C & 0x01050017) &&
!(g_Player.unk0C &
(PLAYER_STATUS_TRANSFORM | PLAYER_STATUS_UNK10 |
PLAYER_STATUS_UNK10000 | PLAYER_STATUS_UNK40000 |
PLAYER_STATUS_AXEARMOR)) &&
!(PLAYER.drawFlags & (FLAG_DRAW_ROTY | FLAG_DRAW_ROTZ))) {
PLAYER.drawFlags |= FLAG_DRAW_ROTY;
PLAYER.rotY = 0x110;
@ -1228,13 +1238,16 @@ block_160:
}
func_8010D59C();
if ((*D_80097448 >= 0x29 ||
((g_Player.unk0C & 4) && *D_80097448 >= 0xD)) &&
((g_Player.unk0C & PLAYER_STATUS_WOLF_FORM) &&
*D_80097448 >= 0xD)) &&
(g_CurrentEntity->nFramesInvincibility == 0)) {
PLAYER.velocityY = PLAYER.velocityY * 3 / 4;
PLAYER.velocityX = PLAYER.velocityX * 3 / 4;
}
temp_s1 = g_Player.pl_vram_flag;
if (!(g_Player.unk0C & (0x40400000 | 5))) {
if (!(g_Player.unk0C &
(PLAYER_STATUS_BAT_FORM | PLAYER_STATUS_WOLF_FORM |
PLAYER_STATUS_UNK400000 | PLAYER_STATUS_UNK40000000))) {
if ((abs(PLAYER.velocityX) >= FIX(2)) || (PLAYER.step == 8)) {
goto block_293;
} else {
@ -1245,7 +1258,8 @@ block_160:
PLAYER.velocityX = PLAYER.velocityX >> 3;
PLAYER.velocityY = PLAYER.velocityY >> 3;
if (PLAYER.posY.i.hi >= 0) {
if (g_Player.unk0C & 0x40400000) {
if (g_Player.unk0C &
(PLAYER_STATUS_UNK400000 | PLAYER_STATUS_UNK40000000)) {
func_80109A44(0);
} else {
func_80109A44(1);
@ -1263,7 +1277,7 @@ block_160:
PLAYER.velocityY *= 8;
goto post_oddblock;
oddblock:
if (g_Player.unk0C & 0x800000) {
if (g_Player.unk0C & PLAYER_STATUS_UNK800000) {
func_80109A44(0);
} else {
func_80109A44(1);
@ -1272,7 +1286,8 @@ block_160:
post_oddblock:
g_Player.unk04 = temp_s1;
if (((*D_80097448 >= 0x29) ||
((g_Player.unk0C & 4) && (*D_80097448 >= 0xD))) &&
((g_Player.unk0C & PLAYER_STATUS_WOLF_FORM) &&
(*D_80097448 >= 0xD))) &&
(g_CurrentEntity->nFramesInvincibility == 0)) {
PLAYER.velocityY = PLAYER.velocityY * 4 / 3;
PLAYER.velocityX = PLAYER.velocityX * 4 / 3;
@ -1311,7 +1326,8 @@ void func_8010BFFC(void) {
if ((g_Player.pl_vram_flag & 1) || (D_801396EA != 0) ||
#if defined(VERSION_US)
(g_Player.unk0C & 0x40000007) ||
(g_Player.unk0C &
(PLAYER_STATUS_TRANSFORM | PLAYER_STATUS_UNK40000000)) ||
((g_PlayableCharacter != 0) && (PLAYER.step == 0x18)) ||
#elif defined(VERSION_HD)
(g_Player.unk0C & PLAYER_STATUS_TRANSFORM) ||
@ -1409,7 +1425,8 @@ void func_8010C36C(void) {
return;
}
if ((PLAYER.velocityY == 0) && (g_Player.unk04 & 1) &&
!(g_Player.unk0C & 3)) {
!(g_Player.unk0C &
(PLAYER_STATUS_BAT_FORM | PLAYER_STATUS_MIST_FORM))) {
var_s5 = 4;
} else {
i = 1;
@ -1419,21 +1436,25 @@ void func_8010C36C(void) {
continue;
}
if (!((g_Player.colliders[i].effects & EFFECT_UNK_0002) ||
(PLAYER.velocityY >= 0) || (g_Player.unk0C & 7) ||
(PLAYER.velocityY >= 0) ||
(g_Player.unk0C & PLAYER_STATUS_TRANSFORM) ||
(abs(PLAYER.velocityX) >= FIX(2)))) {
continue;
}
var_s2 = g_Player.colliders[i].effects &
(EFFECT_UNK_8000 | EFFECT_UNK_0800 | EFFECT_SOLID);
if ((var_s2 == EFFECT_SOLID) || (var_s2 & EFFECT_UNK_0800)) {
if ((g_Player.unk0C & 3) && !(var_s2 & 1)) {
if ((g_Player.unk0C &
(PLAYER_STATUS_BAT_FORM | PLAYER_STATUS_MIST_FORM)) &&
!(var_s2 & 1)) {
continue;
}
argX = *xPosPtr + D_800ACED0[i].x;
argY = *yPosPtr + D_800ACED0[i].y;
argY += (g_Player.colliders[i].unk18 - 1);
CheckCollision(argX, argY, &sp10, 0);
if ((g_Player.unk0C & 2) && (sp10.effects & 0x10)) {
if ((g_Player.unk0C & PLAYER_STATUS_MIST_FORM) &&
(sp10.effects & 0x10)) {
sp10.effects &= ~3;
}
var_s1 = sp10.effects;
@ -1586,13 +1607,16 @@ void func_8010C9F4(void) {
if (g_Player.colliders2[i].effects & EFFECT_SOLID_FROM_ABOVE) {
continue;
}
if ((g_Player.unk0C & 2) && (collider.effects & EFFECT_MIST_ONLY)) {
if ((g_Player.unk0C & PLAYER_STATUS_MIST_FORM) &&
(collider.effects & EFFECT_MIST_ONLY)) {
collider.effects &= ~(EFFECT_UNK_0002 | EFFECT_SOLID);
}
temp_s0 = g_Player.colliders2[i].effects &
(EFFECT_UNK_8000 | EFFECT_UNK_0800 | EFFECT_SOLID);
if ((temp_s0 == EFFECT_SOLID) || (temp_s0 & EFFECT_UNK_8000)) {
if ((g_Player.unk0C & 3) && !(temp_s0 & EFFECT_SOLID)) {
if ((g_Player.unk0C &
(PLAYER_STATUS_BAT_FORM | PLAYER_STATUS_MIST_FORM)) &&
!(temp_s0 & EFFECT_SOLID)) {
continue;
}

View File

@ -673,7 +673,7 @@ void func_80119F70(Entity* entity) {
break;
case 1:
if (!(g_Player.unk0C & 0x10000)) {
if (!(g_Player.unk0C & PLAYER_STATUS_UNK10000)) {
DestroyEntity(entity);
return;
}

View File

@ -153,7 +153,7 @@ void UpdatePlayerEntities(void) {
}
}
// Appears to be a temporary debugging block that was left in.
if ((g_Player.unk0C & 0xC0000) ||
if ((g_Player.unk0C & (PLAYER_STATUS_UNK40000 | PLAYER_STATUS_UNK80000)) ||
(PLAYER.step == Player_Teleport && PLAYER.step_s == 0)) {
#if defined(VERSION_US)
// Japanese for "without hit".
@ -550,7 +550,7 @@ void func_8011B5A4(Entity* self) {
switch (self->step) {
case 0:
// Note that paramsHi is uninitialized here - possible bug?
if ((g_Player.unk0C & 0x20000) && (paramsHi != 9)) {
if ((g_Player.unk0C & PLAYER_STATUS_UNK20000) && (paramsHi != 9)) {
DestroyEntity(self);
return;
}

View File

@ -783,7 +783,7 @@ void EntityHitByIce(Entity* self) {
self->posX.i.hi = PLAYER.posX.i.hi;
self->posY.i.hi = PLAYER.posY.i.hi;
sp18 = (g_Player.unk0C & 0x10000) == sp18;
sp18 = (g_Player.unk0C & PLAYER_STATUS_UNK10000) == sp18;
switch (self->step) {
case 0:
self->primIndex = AllocPrimitives(PRIM_GT3, 24);
@ -2198,7 +2198,7 @@ void UnknownEntId48(Entity* self) {
void UnknownEntId49(Entity* self) {
s32 x_offset;
if (!(g_Player.unk0C & 0x01000000) || (PLAYER.step != 0x2B)) {
if (!(g_Player.unk0C & PLAYER_STATUS_AXEARMOR) || (PLAYER.step != 0x2B)) {
DestroyEntity(self);
return;
}
@ -2230,7 +2230,7 @@ void UnknownEntId49(Entity* self) {
void func_80123A60(Entity* entity) {
Entity* player = &PLAYER;
if (!(g_Player.unk0C & 0x01000000)) {
if (!(g_Player.unk0C & PLAYER_STATUS_AXEARMOR)) {
DestroyEntity(entity);
return;
}

View File

@ -298,7 +298,7 @@ void EntitySubwpnThrownDagger(Entity* self) {
self->hitboxHeight = 2;
self->hitboxOffX = 4;
self->hitboxOffY = 0;
if (!(g_Player.unk0C & 0x20)) {
if (!(g_Player.unk0C & PLAYER_STATUS_UNK_20)) {
self->posY.i.hi -= 9;
}
prim = &g_PrimBuf[self->primIndex];
@ -512,7 +512,7 @@ void EntitySubwpnThrownAxe(Entity* self) {
self->velocityY = FIX(-6);
tempLeft = self->facingLeft;
self->ext.axeCrash.unk7C = tempLeft ? 0x400 : 0xC00;
if (!(g_Player.unk0C & 0x20)) {
if (!(g_Player.unk0C & PLAYER_STATUS_UNK_20)) {
self->posY.i.hi = (u16)self->posY.i.hi - 0xC;
}
sp10 = 0;
@ -2158,7 +2158,7 @@ void EntitySubwpnAgunea(Entity* self) {
u16 tempX;
u32 heartBroachesWorn;
if (g_Player.unk0C & 0x10007) {
if (g_Player.unk0C & (PLAYER_STATUS_TRANSFORM | PLAYER_STATUS_UNK10000)) {
DestroyEntity(self);
return;
}

View File

@ -3124,8 +3124,9 @@ s32 func_800FB23C(MenuNavigation* nav, u8* order, u8* count, u32* selected) {
var_s6 = 0;
func_800F53A4();
if ((g_Player.unk0C & 0x17) | (PLAYER.step == Player_UnmorphWolf) |
(PLAYER.step == Player_BossGrab) | (g_Player.unk60)) {
if ((g_Player.unk0C & (PLAYER_STATUS_TRANSFORM | PLAYER_STATUS_UNK10)) |
(PLAYER.step == Player_UnmorphWolf) | (PLAYER.step == Player_BossGrab) |
(g_Player.unk60)) {
if (itemId == ITEM_AXE_LORD_ARMOR) {
if (D_801375CC == EQUIP_ARMOR) {
if (count[ITEM_AXE_LORD_ARMOR] != 0) {

View File

@ -191,7 +191,7 @@ static void func_801572A8(bool arg0) {
if (arg0) {
for (i = 0; i < LEN(D_801545E4); i++) {
if (unk0C & 0x20) {
if (unk0C & PLAYER_STATUS_UNK_20) {
D_801545F4[i].y = D_80154644[i];
D_801545E4[i].y = D_8015465C[i];
} else {
@ -200,7 +200,7 @@ static void func_801572A8(bool arg0) {
}
}
for (i = 0; i < 7; i++) {
if (unk0C & 0x20) {
if (unk0C & PLAYER_STATUS_UNK_20) {
D_80154604[i].y = D_80154664[i];
D_80154604[i + 7].y = D_80154664[i];
} else {
@ -691,7 +691,7 @@ void RicMain(void) {
}
if (g_Player.timers[PL_T_INVINCIBLE_SCENE] |
g_Player.timers[PL_T_INVINCIBLE]) {
g_Player.unk0C |= 0x100;
g_Player.unk0C |= PLAYER_STATUS_UNK100;
}
g_api.UpdateAnim(D_80155964, D_8015538C);
PLAYER.hitboxState = 1;
@ -714,7 +714,7 @@ void RicMain(void) {
return;
#endif
}
if (g_Player.unk0C & 0x50) {
if (g_Player.unk0C & (PLAYER_STATUS_UNK10 | PLAYER_STATUS_UNK40)) {
return;
}
func_8015C4AC();

View File

@ -1302,7 +1302,7 @@ void RicEntityHitByHoly(Entity* entity) {
entity->step++;
break;
case 1:
if (!(g_Player.unk0C & 0x10000)) {
if (!(g_Player.unk0C & PLAYER_STATUS_UNK10000)) {
DestroyEntity(entity);
return;
}

View File

@ -697,7 +697,7 @@ void RicEntityHitByIce(Entity* self) {
self->posX.i.hi = PLAYER.posX.i.hi;
self->posY.i.hi = PLAYER.posY.i.hi;
// This is badly written but it checks if 0x10000 is unset.
sp18 = ((g_Player.unk0C & 0x10000) == sp18);
sp18 = ((g_Player.unk0C & PLAYER_STATUS_UNK10000) == sp18);
switch (self->step) {
case 0:
self->primIndex = g_api.AllocPrimitives(PRIM_GT3, PrimCount);

View File

@ -1989,7 +1989,7 @@ void RicEntitySubwpnAgunea(Entity* self) {
u16 tempX;
u32 heartBroachesWorn;
if (g_Player.unk0C & 0x10007) {
if (g_Player.unk0C & (PLAYER_STATUS_TRANSFORM | PLAYER_STATUS_UNK10000)) {
DestroyEntity(self);
return;
}

View File

@ -306,7 +306,7 @@ void GetEquipProperties(s32 handId, Equipment* res, s32 equipId) {
itemCategory = g_EquipDefs[equipId].itemCategory;
if (itemCategory != ITEM_FOOD && itemCategory != ITEM_MEDICINE) {
res->attack = func_800F4D38(equipId, g_Status.equipment[1 - handId]);
if (g_Player.unk0C & 0x4000) {
if (g_Player.unk0C & PLAYER_STATUS_POISON) {
res->attack >>= 1;
}
}

View File

@ -10,4 +10,7 @@
extern EnemyDef g_EnemyDefs[];
extern s32 g_RoomCount;
// document g_Player.unk0C
#define PLAYER_STATUS_POISON 0x00004000
#endif

View File

@ -566,7 +566,7 @@ void func_80172120(Entity* self) {
func_801719E0(self);
break;
case 1:
if (g_Player.unk0C & 1) {
if (g_Player.unk0C & PLAYER_STATUS_BAT_FORM) {
self->ext.bat.unk8C = 0;
self->step = 5;
break;
@ -804,14 +804,14 @@ void func_80172C30(Entity* self) {
}
self->facingLeft = PLAYER.facingLeft ? false : true;
if (!self->ext.bat.unkA8) {
if (g_Player.unk0C & 0x800) {
if (g_Player.unk0C & PLAYER_STATUS_UNK800) {
// This causes the bat familiar to shoot a fireball when the
// player does so in bat form.
g_api.CreateEntFactoryFromEntity(self, FACTORY(81, 1), 0);
self->ext.bat.unkA8 = 1;
}
} else if (self->ext.bat.unkA8) {
if (!(g_Player.unk0C & 0x800)) {
if (!(g_Player.unk0C & PLAYER_STATUS_UNK800)) {
self->ext.bat.unkA8 = 0;
}
}
@ -833,7 +833,7 @@ void func_80172C30(Entity* self) {
D_80174C3C[self->ext.bat.unk82][D_80174B30].y =
self->ext.bat.follow->posY.i.hi + self->ext.bat.cameraY;
}
if (!(g_Player.unk0C & 1)) {
if (!(g_Player.unk0C & PLAYER_STATUS_BAT_FORM)) {
self->ext.bat.unk8C = 0;
self->step++;
}

View File

@ -42,13 +42,13 @@ void EntityCSMoveAlucard(Entity* self) {
if (self->ext.generic.unk7C.u != 0) {
self->ext.generic.unk7C.u--;
}
if (g_Player.unk0C & 7) {
if (g_Player.unk0C & PLAYER_STATUS_TRANSFORM) {
if (g_Timer & 1) {
if (g_Player.unk0C & 1) {
if (g_Player.unk0C & PLAYER_STATUS_BAT_FORM) {
g_Player.padSim = 8;
} else if (g_Player.unk0C & 2) {
} else if (g_Player.unk0C & PLAYER_STATUS_MIST_FORM) {
g_Player.padSim = 4;
} else if (g_Player.unk0C & 4) {
} else if (g_Player.unk0C & PLAYER_STATUS_WOLF_FORM) {
g_Player.padSim = 2;
}
}

View File

@ -17,7 +17,7 @@ void EntityElevator(Entity* self) {
FntPrint("elevator:%x\n", g_ElevatorTarget);
if (g_Player.unk0C & 3) {
if (g_Player.unk0C & (PLAYER_STATUS_BAT_FORM | PLAYER_STATUS_MIST_FORM)) {
temp = 0;
} else {
temp = GetPlayerCollisionWith(self, 16, 5, 4);

View File

@ -56,7 +56,7 @@ static void EntityWeaponAttack(Entity* self) {
self->posY.val = PLAYER.posY.val;
self->facingLeft = PLAYER.facingLeft;
}
if ((g_Player.unk0C & 0x10000) && (self->step != 4)) {
if ((g_Player.unk0C & PLAYER_STATUS_UNK10000) && (self->step != 4)) {
self->zPriority = PLAYER.zPriority + 2;
self->step = 4;
if (g_Player.pl_vram_flag & 1) {

View File

@ -248,7 +248,7 @@ static void EntityWeaponAttack(Entity* self) {
self->ext.weapon.unk82 = -20;
}
self->ext.weapon.unk80 = -5;
if (g_Player.unk0C & 0x20) {
if (g_Player.unk0C & PLAYER_STATUS_UNK_20) {
self->ext.weapon.unk80 = 11;
}
self->posX.i.hi = self->posX.i.hi + self->ext.weapon.unk82;
@ -371,7 +371,7 @@ static s32 func_ptr_80170004(Entity* self) {
}
SetWeaponProperties(self, 0);
DestroyEntityWeapon(true);
if (g_Player.unk0C & 0x20) {
if (g_Player.unk0C & PLAYER_STATUS_UNK_20) {
self->ext.weapon_046.unk7C = -0x200;
self->ext.weapon_046.unk94 = -0x200;
self->ext.weapon_046.unk90 = 0x280;

View File

@ -119,7 +119,7 @@ s32 func_ptr_80170004(Entity* self) {
self->ext.weapon.unk82 = -20;
}
self->ext.weapon.unk80 = -5;
if (g_Player.unk0C & 0x20) {
if (g_Player.unk0C & PLAYER_STATUS_UNK_20) {
self->ext.weapon.unk80 = 11;
}
self->posX.i.hi += self->ext.weapon.unk82;
@ -212,7 +212,7 @@ s32 func_ptr_80170004(Entity* self) {
self->ext.weapon.unk82 = -0x26;
}
self->ext.weapon.unk80 = -5;
if (g_Player.unk0C & 0x20) {
if (g_Player.unk0C & PLAYER_STATUS_UNK_20) {
self->ext.weapon.unk80 = 0xB;
}
self->posX.i.hi = self->ext.weapon.unk82 + PLAYER.posX.i.hi;
@ -350,7 +350,7 @@ void func_ptr_8017000C(Entity* self) {
if (self->step == 0) {
self->facingLeft = PLAYER.facingLeft;
self->ext.weapon.unk80 = -5;
if (g_Player.unk0C & 0x20) {
if (g_Player.unk0C & PLAYER_STATUS_UNK_20) {
self->ext.weapon.unk80 = 0xB;
}
self->posY.i.hi = self->posY.i.hi + self->ext.weapon.unk80;

View File

@ -212,7 +212,7 @@ s32 func_ptr_80170004(Entity* self) {
self->ext.weapon.unk82 = -20;
}
self->ext.weapon.unk80 = -5;
if (g_Player.unk0C & 0x20) {
if (g_Player.unk0C & PLAYER_STATUS_UNK_20) {
self->ext.weapon.unk80 = 11;
}
self->posX.i.hi += self->ext.weapon.unk82;
@ -305,7 +305,7 @@ s32 func_ptr_80170004(Entity* self) {
self->ext.weapon.unk82 = -0x26;
}
self->ext.weapon.unk80 = -5;
if (g_Player.unk0C & 0x20) {
if (g_Player.unk0C & PLAYER_STATUS_UNK_20) {
self->ext.weapon.unk80 = 0xB;
}
self->posX.i.hi = self->ext.weapon.unk82 + PLAYER.posX.i.hi;