doc surface types

This commit is contained in:
theo3 2021-12-25 16:35:54 -08:00
parent c6b88dafea
commit 1f515e6958
24 changed files with 227 additions and 181 deletions

View File

@ -182,7 +182,7 @@ PlayerParachute: @ 0x08073420
bl sub_08078EFC bl sub_08078EFC
cmp r0, #0 cmp r0, #0
bne _0807345E bne _0807345E
bl sub_0807A1B8 bl UpdateFloorType
ldrb r2, [r4, #0x1b] ldrb r2, [r4, #0x1b]
movs r1, #0x3f movs r1, #0x3f
adds r0, r1, #0 adds r0, r1, #0
@ -1105,7 +1105,7 @@ _08073AFA:
bl sub_0807A2B8 bl sub_0807A2B8
movs r0, #0 movs r0, #0
strb r0, [r6, #2] strb r0, [r6, #2]
bl sub_0807A1B8 bl UpdateFloorType
ldrb r0, [r6, #0xc] ldrb r0, [r6, #0xc]
cmp r0, #0 cmp r0, #0
bne _08073B5C bne _08073B5C
@ -1422,7 +1422,7 @@ _08073D74:
_08073D80: _08073D80:
adds r0, r4, #0 adds r0, r4, #0
bl sub_08073904 bl sub_08073904
bl sub_0807A1B8 bl UpdateFloorType
ldrb r0, [r5, #2] ldrb r0, [r5, #2]
cmp r0, #0 cmp r0, #0
beq _08073D96 beq _08073D96

View File

@ -3371,8 +3371,8 @@ sub_0807A180: @ 0x0807A180
.align 2, 0 .align 2, 0
_0807A1B4: .4byte 0xFFFC0000 _0807A1B4: .4byte 0xFFFC0000
thumb_func_start sub_0807A1B8 thumb_func_start UpdateFloorType
sub_0807A1B8: @ 0x0807A1B8 UpdateFloorType: @ 0x0807A1B8
push {r4, lr} push {r4, lr}
ldr r4, _0807A1DC @ =gPlayerEntity ldr r4, _0807A1DC @ =gPlayerEntity
adds r0, r4, #0 adds r0, r4, #0

View File

@ -154,7 +154,7 @@ _080708AC:
ands r0, r6 ands r0, r6
cmp r0, #0 cmp r0, #0
bne _080708C4 bne _080708C4
bl sub_0807A1B8 bl UpdateFloorType
_080708C4: _080708C4:
bl sub_08078EFC bl sub_08078EFC
cmp r0, #0 cmp r0, #0
@ -194,7 +194,7 @@ _08070902:
beq _0807090C beq _0807090C
b _08070BE4 b _08070BE4
_0807090C: _0807090C:
bl sub_0807A1B8 bl UpdateFloorType
bl sub_08078EFC bl sub_08078EFC
b _08070BE4 b _08070BE4
.align 2, 0 .align 2, 0

View File

@ -5,7 +5,7 @@
adds r0, r4, #0 adds r0, r4, #0
bl sub_080085B0 bl sub_080085B0
bl sub_08079E08 bl sub_08079E08
bl sub_0807A1B8 bl UpdateFloorType
bl sub_08078EFC bl sub_08078EFC
cmp r0, #0 cmp r0, #0
bne _08070E76 bne _08070E76

View File

@ -147,7 +147,7 @@ extern void sub_08077728();
extern void sub_0807AEE4(); extern void sub_0807AEE4();
extern u32 sub_08078EFC(); extern u32 sub_08078EFC();
extern void sub_0807921C(); extern void sub_0807921C();
extern void sub_0807A1B8(); extern void UpdateFloorType();
extern void sub_08079938(); extern void sub_08079938();
extern void sub_0807ACCC(Entity*); extern void sub_0807ACCC(Entity*);
extern void sub_080A2BE4(Entity*, u32); extern void sub_080A2BE4(Entity*, u32);

View File

@ -107,6 +107,54 @@ enum PlayerFlags {
PL_USE_OCARINA = (1 << 28), PL_USE_OCARINA = (1 << 28),
}; };
enum SurfaceType {
SURFACE_NORMAL,
SURFACE_PIT,
SURFACE_2,
SURFACE_3,
SURFACE_SLOPE_GNDGND_V,
SURFACE_SLOPE_GNDGND_H,
SURFACE_6,
SURFACE_7,
SURFACE_MINISH_DOOR_FRONT,
SURFACE_MINISH_DOOR_BACK,
SURFACE_A,
SURFACE_B,
SURFACE_SLOPE_GNDWATER,
SURFACE_D,
SURFACE_E,
SURFACE_F,
SURFACE_10,
SURFACE_11,
SURFACE_DOOR,
SURFACE_DOOR_13,
SURFACE_14,
SURFACE_CLONE_TILE,
SURFACE_16,
SURFACE_ICE,
SURFACE_SHALLOW_WATER,
SURFACE_WATER,
SURFACE_BUTTON,
SURFACE_1B,
SURFACE_1C,
SURFACE_1D,
SURFACE_LADDER,
SURFACE_1F,
SURFACE_20,
SURFACE_21,
SURFACE_22,
SURFACE_EDGE,
SURFACE_24,
SURFACE_DUST,
SURFACE_26,
SURFACE_HOLE,
SURFACE_LIGHT_GRADE,
SURFACE_29,
SURFACE_AUTO_LADDER,
SURFACE_CLIMB_WALL,
SURFACE_2C,
};
typedef struct { typedef struct {
/*0x00*/ u8 field_0x0[2]; /*0x00*/ u8 field_0x0[2];
/*0x02*/ u8 jumpStatus; /*0x02*/ u8 jumpStatus;
@ -121,32 +169,24 @@ typedef struct {
/*0x0d*/ u8 field_0xd; /*0x0d*/ u8 field_0xd;
/*0x0e*/ u8 field_0xe; /*0x0e*/ u8 field_0xe;
/*0x0f*/ u8 hurtBlinkSpeed; /*0x0f*/ u8 hurtBlinkSpeed;
/*0x10*/ u8 field_0x10[4]; /*0x10*/ u8 field_0x10;
/*0x11*/ u8 field_0x14; /*0x11*/ u8 field_0x11;
/*0x11*/ u8 field_0x15; /*0x12*/ u8 floor_type;
/*0x14*/ u16 startPosX; /*0x13*/ u8 floor_type_last;
/*0x16*/ u16 startPosY; /*0x14*/ u8 field_0x14;
/*0x15*/ u8 field_0x15;
/*0x16*/ u16 startPosX;
/*0x18*/ u16 startPosY;
/*0x1a*/ u8 field_0x1a[2]; /*0x1a*/ u8 field_0x1a[2];
/*0x1c*/ u8 field_0x1c; /*0x1c*/ u8 field_0x1c;
/*0x1d*/ u8 field_0x1d[5]; /*0x1d*/ u8 field_0x1d;
/*0x1e*/ u8 dash_state;
/*0x1f*/ u8 field_0x1f[3];
/*0x22*/ u16 field_0x22[2]; /*0x22*/ u16 field_0x22[2];
/*0x26*/ u8 swimState; /*0x26*/ u8 swimState;
/*0x27*/ u8 field_0x27[5]; /*0x27*/ u8 field_0x27[5];
/*0x2c*/ u8* field_0x2c; /*0x2c*/ Entity* item;
/*0x30*/ u32 flags; /*0x30*/ u32 flags;
/* unk1 : 1; */
/* unk2 : 1; */
/* unk4 : 1; */
/* noMinishCap : 1; */
/* pullingState : 1; */
/* windyState : 1; */
/* filler6 : 1; */
/* unk7 : 1; */
/* unk8 : 1; */
/* unk9 : 1; */
/* slipperyState : 1; */
/* filler11 : 5; */
/* filler11b : 16; */
/*0x34*/ u8 field_0x34[2]; /*0x34*/ u8 field_0x34[2];
/*0x36*/ s16 field_0x36; /*0x36*/ s16 field_0x36;
/*0x38*/ u8 field_0x38; /*0x38*/ u8 field_0x38;
@ -162,7 +202,8 @@ typedef struct {
/*0x80*/ u16 field_0x80; /*0x80*/ u16 field_0x80;
/*0x82*/ u8 field_0x82[9]; /*0x82*/ u8 field_0x82[9];
/*0x8b*/ u8 controlMode; /*0x8b*/ u8 controlMode;
/*0x8c*/ u32 field_0x8c; /*0x8c*/ u16 vel_x;
/*0x8e*/ u16 vel_y;
/*0x90*/ union SplitWord field_0x90; /*0x90*/ union SplitWord field_0x90;
/*0x94*/ u32 field_0x94; /*0x94*/ u32 field_0x94;
/*0x98*/ u16 field_0x98; /*0x98*/ u16 field_0x98;

View File

@ -18,18 +18,18 @@ extern Entity* sub_0805E744();
extern struct_0811BE48 gUnk_0811BE48[]; extern struct_0811BE48 gUnk_0811BE48[];
void sub_08077B98(UnkItemStruct* unk) { void sub_08077B98(UnkItemStruct* unk) {
if ((gPlayerState.field_0x2c == NULL) || (gPlayerState.field_0x2c[9] != 1)) { if ((gPlayerState.item == NULL) || (gPlayerState.item->id != 1)) {
gPlayerState.field_0x2c = sub_08077C54(unk); gPlayerState.item = sub_08077C54(unk);
} }
} }
void sub_08077BB8(ItemBehavior* beh) { void sub_08077BB8(ItemBehavior* beh) {
UnkItemStruct* unk = (UnkItemStruct*)beh; // @nocheckin UnkItemStruct* unk = (UnkItemStruct*)beh; // @nocheckin
u8* temp = sub_08077C54(unk); Entity* temp = sub_08077C54(unk);
if (temp != NULL) { if (temp != NULL) {
temp[0x10] = 0x20; temp->flags = 0x20;
} }
gPlayerState.field_0x2c = temp; gPlayerState.item = temp;
} }
Entity* sub_08077BD4(ItemBehavior* beh) { Entity* sub_08077BD4(ItemBehavior* beh) {
@ -164,11 +164,11 @@ void sub_08077E78(ItemBehavior* arg0, u32 bits) {
u32 not ; u32 not ;
if (bits == 0) { if (bits == 0) {
if (gPlayerState.field_0x2c != NULL) { if (gPlayerState.item != NULL) {
((Unk_bitfield*)gPlayerState.field_0x2c)[0x11].b0 = 6; ((Unk_bitfield*)gPlayerState.item)[0x11].b0 = 6;
gPlayerState.field_0x2c = (u8*)bits; gPlayerState.item = NULL;
} else { } else {
gPlayerState.field_0x2c = (u8*)bits; gPlayerState.item = NULL;
} }
} }

View File

@ -359,7 +359,7 @@ s32 CollisionGroundItem(Entity* org, Entity* tgt, u32 direction, ColSettings* se
} }
s32 sub_08017B1C(Entity* org, Entity* tgt, u32 direction, ColSettings* settings) { s32 sub_08017B1C(Entity* org, Entity* tgt, u32 direction, ColSettings* settings) {
if ((gPlayerState.field_0x1d[1] & 0x60) != 0) { if ((gPlayerState.dash_state & 0x60) != 0) {
COLLISION_OFF(tgt); COLLISION_OFF(tgt);
} else { } else {
org->knockbackDuration = 0x10; org->knockbackDuration = 0x10;
@ -372,7 +372,7 @@ s32 sub_08017B1C(Entity* org, Entity* tgt, u32 direction, ColSettings* settings)
s32 sub_08017B58(Entity* org, Entity* tgt, u32 direction, ColSettings* settings) { s32 sub_08017B58(Entity* org, Entity* tgt, u32 direction, ColSettings* settings) {
if ((tgt->field_0x3a & 4) != 0) { if ((tgt->field_0x3a & 4) != 0) {
if (tgt->field_0x1d) { if (tgt->field_0x1d) {
s32 x = tgt->field_0x1d = tgt->field_0x1d - gPlayerState.field_0x1d[0]; s32 x = tgt->field_0x1d = tgt->field_0x1d - gPlayerState.field_0x1d;
if (x << 24 <= 0) { if (x << 24 <= 0) {
tgt->field_0x1d = 0; tgt->field_0x1d = 0;
tgt->subAction = 2; tgt->subAction = 2;

View File

@ -62,7 +62,7 @@ u32 sub_0806F3E4(Entity* ent) {
if ((gPlayerState.field_0x1c & 0x7F) != 1) if ((gPlayerState.field_0x1c & 0x7F) != 1)
return 0; return 0;
switch (gPlayerState.field_0x1d[0]) { switch (gPlayerState.field_0x1d) {
case 1: case 1:
ent->field_0x46 += 64; ent->field_0x46 += 64;
break; break;
@ -93,7 +93,7 @@ u32 sub_0806F3E4(Entity* ent) {
} }
SoundReq(SFX_ED); SoundReq(SFX_ED);
} else if (state == 1) { } else if (state == 1) {
gPlayerState.field_0x2c[10] = 1; gPlayerState.item->type = 1;
SoundReq(SFX_EF); SoundReq(SFX_EF);
} }
return 1; return 1;

View File

@ -1001,7 +1001,7 @@ void VaatiWrathType0PreAction(Entity* this) {
temp = gPlayerState.framestate_last; temp = gPlayerState.framestate_last;
if (temp < 2) { if (temp < 2) {
if (temp >= 0) { if (temp >= 0) {
if (gPlayerState.field_0x2c == NULL) { if (gPlayerState.item == NULL) {
if (gPlayerEntity.field_0x7a.HWORD == 0) { if (gPlayerEntity.field_0x7a.HWORD == 0) {
if ((gPlayerEntity.z.HALF.HI & 0x8000U) == 0 || (gPlayerState.field_0xa != 0)) { if ((gPlayerEntity.z.HALF.HI & 0x8000U) == 0 || (gPlayerState.field_0xa != 0)) {
CreateEzloHint(0xb70, 0); CreateEzloHint(0xb70, 0);

View File

@ -16,7 +16,7 @@ void sub_08075DF4(ItemBehavior* this, u32 arg1) {
sub_0806F948(&gPlayerEntity); sub_0806F948(&gPlayerEntity);
sub_08077BB8(this); sub_08077BB8(this);
sub_08077D38(this, arg1); sub_08077D38(this, arg1);
gPlayerState.field_0x1d[4] = 1; gPlayerState.field_0x1f[2] = 1;
} else { } else {
sub_08077E78(this, arg1); sub_08077E78(this, arg1);
} }
@ -25,7 +25,7 @@ void sub_08075DF4(ItemBehavior* this, u32 arg1) {
void sub_08075E40(ItemBehavior* this, u32 arg1) { void sub_08075E40(ItemBehavior* this, u32 arg1) {
u8 bVar1; u8 bVar1;
if (gPlayerState.field_0x1d[4] != 0) { if (gPlayerState.field_0x1f[2] != 0) {
bVar1 = gPlayerState.field_0x3[1] & 0x80; bVar1 = gPlayerState.field_0x3[1] & 0x80;
if (bVar1 == 0) { if (bVar1 == 0) {
UpdateItemAnim(this); UpdateItemAnim(this);
@ -40,7 +40,7 @@ void sub_08075E40(ItemBehavior* this, u32 arg1) {
return; return;
} }
} }
gPlayerState.field_0x1d[4] = 0; gPlayerState.field_0x1f[2] = 0;
sub_08077E78(this, arg1); sub_08077E78(this, arg1);
} }
@ -51,8 +51,8 @@ void sub_08075EC0(ItemBehavior* this, u32 arg1) {
arrowCount = gSave.stats.arrowCount; arrowCount = gSave.stats.arrowCount;
iVar2 = sub_08077EFC(this); iVar2 = sub_08077EFC(this);
if (iVar2 != 0 && arrowCount != 0) { if (iVar2 != 0 && arrowCount != 0) {
if (((gPlayerState.field_0x3[1] & 0x80) != 0) || (gPlayerState.field_0x1d[4] == 0)) { if (((gPlayerState.field_0x3[1] & 0x80) != 0) || (gPlayerState.field_0x1f[2] == 0)) {
gPlayerState.field_0x1d[4] = 0; gPlayerState.field_0x1f[2] = 0;
sub_08077E78(this, arg1); sub_08077E78(this, arg1);
} }
} else { } else {
@ -65,19 +65,19 @@ void sub_08075EC0(ItemBehavior* this, u32 arg1) {
} }
void sub_08075F38(ItemBehavior* this, u32 arg1) { void sub_08075F38(ItemBehavior* this, u32 arg1) {
if (((gPlayerState.field_0x3[1] & 0x80) == 0) && (gPlayerState.field_0x1d[4] != 0)) { if (((gPlayerState.field_0x3[1] & 0x80) == 0) && (gPlayerState.field_0x1f[2] != 0)) {
UpdateItemAnim(this); UpdateItemAnim(this);
if ((this->field_0x5[9] & 1) != 0) { if ((this->field_0x5[9] & 1) != 0) {
this->stateID = 4; this->stateID = 4;
} }
} else { } else {
gPlayerState.field_0x1d[4] = 0; gPlayerState.field_0x1f[2] = 0;
sub_08077E78(this, arg1); sub_08077E78(this, arg1);
} }
} }
void sub_08075F84(ItemBehavior* this, u32 arg1) { void sub_08075F84(ItemBehavior* this, u32 arg1) {
if (((gPlayerState.field_0x3[1] & 0x80) == 0) && (gPlayerState.field_0x1d[4] != 0)) { if (((gPlayerState.field_0x3[1] & 0x80) == 0) && (gPlayerState.field_0x1f[2] != 0)) {
if (GetInventoryValue(0x70) == 1) { if (GetInventoryValue(0x70) == 1) {
sub_08077E3C(this, 5); sub_08077E3C(this, 5);
} else { } else {
@ -87,6 +87,6 @@ void sub_08075F84(ItemBehavior* this, u32 arg1) {
return; return;
} }
} }
gPlayerState.field_0x1d[4] = 0; gPlayerState.field_0x1f[2] = 0;
sub_08077E78(this, arg1); sub_08077E78(this, arg1);
} }

View File

@ -21,7 +21,7 @@ void sub_08075A0C(ItemBehavior* this, u32 arg1) {
s8* tmp; s8* tmp;
itemSlot = IsItemEquipped(this->behaviorID); itemSlot = IsItemEquipped(this->behaviorID);
if (gPlayerState.heldObject != 0 || gPlayerState.playerAction == 0x18 || gPlayerState.jumpStatus != 0 || if (gPlayerState.heldObject != 0 || gPlayerState.playerAction == 0x18 || gPlayerState.jumpStatus != 0 ||
gPlayerState.field_0x2c != NULL || (gPlayerState.flags & PL_MINISH) != 0) { gPlayerState.item != NULL || (gPlayerState.flags & PL_MINISH) != 0) {
ForceEquipItem(0xf, itemSlot); ForceEquipItem(0xf, itemSlot);
gPlayerState.flags &= 0xff7fffff; gPlayerState.flags &= 0xff7fffff;
ForceEquipItem(0xf, itemSlot); ForceEquipItem(0xf, itemSlot);
@ -50,7 +50,7 @@ ASM_FUNC("asm/non_matching/eu/sub_08075ADC.inc", void sub_08075ADC(ItemBehavior*
void sub_08075ADC(ItemBehavior* this, u32 arg1) { void sub_08075ADC(ItemBehavior* this, u32 arg1) {
u32 bVar1; u32 bVar1;
if (gPlayerState.field_0x2c != NULL || (this->field_0x5[9] & 1) == 0 || (gPlayerState.flags & 0x110) != 0 || if (gPlayerState.item != NULL || (this->field_0x5[9] & 1) == 0 || (gPlayerState.flags & 0x110) != 0 ||
sub_08079D48() == 0) { sub_08079D48() == 0) {
this->field_0xf = 0; this->field_0xf = 0;
this->stateID += 1; this->stateID += 1;

View File

@ -14,7 +14,7 @@ void ItemPegasusBoots(ItemBehavior* this, u32 arg1) {
u32 uVar4; u32 uVar4;
if (gPlayerEntity.field_0x7a.HWORD != 0) { if (gPlayerEntity.field_0x7a.HWORD != 0) {
gPlayerState.field_0x1d[1] = 0; gPlayerState.dash_state = 0;
gPlayerState.field_0xe = 0; gPlayerState.field_0xe = 0;
sub_08077E78(this, arg1); sub_08077E78(this, arg1);
} else { } else {
@ -24,7 +24,7 @@ void ItemPegasusBoots(ItemBehavior* this, u32 arg1) {
SoundReq(SFX_PLY_LAND); SoundReq(SFX_PLY_LAND);
} }
if (((gPlayerState.flags & PL_MINISH) == 0) && ((this->field_0x5[2] & 7) == 0)) { if (((gPlayerState.flags & PL_MINISH) == 0) && ((this->field_0x5[2] & 7) == 0)) {
if (gPlayerState.field_0x10[2] == 0x11) { if (gPlayerState.floor_type == SURFACE_11) {
if (gPlayerEntity.spriteOffsetY == 0) { if (gPlayerEntity.spriteOffsetY == 0) {
CreateFx(&gPlayerEntity, FX_GREEN_SPLASH, 0); CreateFx(&gPlayerEntity, FX_GREEN_SPLASH, 0);
} }
@ -56,8 +56,8 @@ void sub_080768F8(ItemBehavior* this, u32 arg1) {
bVar2 = (gPlayerState.flags & 0x1000); bVar2 = (gPlayerState.flags & 0x1000);
bVar1 |= bVar2; bVar1 |= bVar2;
if (bVar1 == 0) { if (bVar1 == 0) {
gPlayerState.field_0x1d[1] = 1; gPlayerState.dash_state = 1;
gPlayerState.field_0x1d[4] = bVar1; gPlayerState.field_0x1f[2] = bVar1;
if ((gPlayerState.flags & PL_MINISH) == 0) { if ((gPlayerState.flags & PL_MINISH) == 0) {
this->field_0x5[2] = 0x10; this->field_0x5[2] = 0x10;
} else { } else {
@ -66,7 +66,7 @@ void sub_080768F8(ItemBehavior* this, u32 arg1) {
sub_08077D38(this, arg1); sub_08077D38(this, arg1);
sub_08076964(this, arg1); sub_08076964(this, arg1);
} else { } else {
gPlayerState.field_0x1d[1] = 0; gPlayerState.dash_state = 0;
gPlayerState.field_0xe = 0; gPlayerState.field_0xe = 0;
sub_08077E78(this, arg1); sub_08077E78(this, arg1);
} }

View File

@ -12,7 +12,7 @@ extern bool32 sub_08077EFC(ItemBehavior*);
sub_08076758(this, arg1); sub_08076758(this, arg1);
return; return;
} }
if (gPlayerState.field_0x2c == NULL) { if (gPlayerState.item == NULL) {
if (gPlayerState.field_0x0[1] == 0) { if (gPlayerState.field_0x0[1] == 0) {
if (((u8)(gPlayerState.field_0x1a[1] | gPlayerState.field_0xa | gPlayerState.field_0x3[1] | if (((u8)(gPlayerState.field_0x1a[1] | gPlayerState.field_0xa | gPlayerState.field_0x3[1] |
gPlayerState.heldObject | gPlayerState.field_0x1c | gPlayerState.field_0x3c[1]) == 0) && gPlayerState.heldObject | gPlayerState.field_0x1c | gPlayerState.field_0x3c[1]) == 0) &&
@ -24,7 +24,7 @@ extern bool32 sub_08077EFC(ItemBehavior*);
if (-1 < gPlayerEntity.z.WORD) { if (-1 < gPlayerEntity.z.WORD) {
gPlayerEntity.zVelocity = 0x20000; gPlayerEntity.zVelocity = 0x20000;
gPlayerState.jumpStatus = 1; gPlayerState.jumpStatus = 1;
gPlayerState.field_0x2c = NULL; gPlayerState.item = NULL;
this->stateID += 1; this->stateID += 1;
goto _0807673C; goto _0807673C;
} }
@ -44,7 +44,7 @@ extern bool32 sub_08077EFC(ItemBehavior*);
gPlayerState.keepFacing = 0; gPlayerState.keepFacing = 0;
gPlayerState.jumpStatus = 1; gPlayerState.jumpStatus = 1;
gPlayerState.field_0xe = -1; gPlayerState.field_0xe = -1;
gPlayerState.field_0x2c = NULL; gPlayerState.item = NULL;
gPlayerEntity.zVelocity = 0x20000; gPlayerEntity.zVelocity = 0x20000;
_0807673C: _0807673C:
sub_08077F84(); sub_08077F84();

View File

@ -27,7 +27,7 @@ void sub_08075580(ItemBehavior* this, u32 arg1) {
if ((sub_08077EFC(this) != 0) && (gPlayerState.jumpStatus == 0)) { if ((sub_08077EFC(this) != 0) && (gPlayerState.jumpStatus == 0)) {
gPlayerState.field_0xa = gPlayerState.field_0xa & ~(8 >> arg1); gPlayerState.field_0xa = gPlayerState.field_0xa & ~(8 >> arg1);
gPlayerState.field_0x1a[1] = 1; gPlayerState.field_0x1a[1] = 1;
gPlayerState.field_0x2c[0x40] = 0xd; gPlayerState.item->hurtType = 0xd;
this->field_0xf = 0; this->field_0xf = 0;
this->stateID = 2; this->stateID = 2;
if ((gPlayerState.field_0xac & 0x200) != 0) { if ((gPlayerState.field_0xac & 0x200) != 0) {
@ -126,6 +126,6 @@ void sub_080759B8(ItemBehavior* this, u32 arg1) {
} }
gPlayerState.flags &= 0xf7ffffff; gPlayerState.flags &= 0xf7ffffff;
gPlayerState.field_0x1a[1] = 0; gPlayerState.field_0x1a[1] = 0;
gPlayerState.field_0x2c = NULL; gPlayerState.item = NULL;
sub_08077E78(this, arg1); sub_08077E78(this, arg1);
} }

View File

@ -296,7 +296,7 @@ void sub_0805A758(Manager15* this) {
} }
void sub_0805A76C(Manager15* this) { void sub_0805A76C(Manager15* this) {
if ((gPlayerEntity.health != 0) && (gPlayerEntity.z.HALF.HI == 0) && (!gPlayerState.field_0x2c)) { if ((gPlayerEntity.health != 0) && (gPlayerEntity.z.HALF.HI == 0) && (!gPlayerState.item)) {
switch (gPlayerState.framestate_last) { switch (gPlayerState.framestate_last) {
case PL_STATE_IDLE: case PL_STATE_IDLE:
case PL_STATE_WALK: case PL_STATE_WALK:

View File

@ -14,7 +14,7 @@ void Manager6_Main(Manager6* this) {
return; return;
} }
} }
if (this->manager.unk_0e == 0 || gPlayerState.field_0x10[2] == 0x1e) { if (this->manager.unk_0e == 0 || gPlayerState.floor_type == SURFACE_LADDER) {
for (i = this->warpList; i->posX != 0xFFFF; i++) { for (i = this->warpList; i->posX != 0xFFFF; i++) {
tmp = (i->unk_07.all & 0x3); tmp = (i->unk_07.all & 0x3);
if (((tmp & (gPlayerEntity.collisionLayer)) != 0) && if (((tmp & (gPlayerEntity.collisionLayer)) != 0) &&

View File

@ -103,7 +103,7 @@ Entity* CreateNPC(u32 subtype, u32 form, u32 parameter) {
u32 sub_0806ED78(Entity* ent) { u32 sub_0806ED78(Entity* ent) {
u32 result = sub_0800445C(ent); u32 result = sub_0800445C(ent);
if (result) { if (result) {
if (gPlayerState.field_0x1d[1] & 0x40) { if (gPlayerState.dash_state & 0x40) {
sub_08077B20(); sub_08077B20();
} }
} }

View File

@ -282,7 +282,7 @@ static void FurnitureUpdate(FurnitureEntity* this) {
break; break;
case 0x80: case 0x80:
if (gPlayerEntity.y.HALF.HI < super->y.HALF.HI + 8) { if (gPlayerEntity.y.HALF.HI < super->y.HALF.HI + 8) {
if (gPlayerState.field_0x10[2] != 30 && GetTileTypeByEntity(super) == 0x4017) { if (gPlayerState.floor_type != SURFACE_LADDER && GetTileTypeByEntity(super) == 0x4017) {
SetTile(0x4026, this->tile, super->collisionLayer); SetTile(0x4026, this->tile, super->collisionLayer);
SetTile(0x403D, this->tile - 64, super->collisionLayer); SetTile(0x403D, this->tile - 64, super->collisionLayer);
SetTile(0x403D, this->tile - 128, super->collisionLayer); SetTile(0x403D, this->tile - 128, super->collisionLayer);

View File

@ -666,7 +666,7 @@ u32 sub_08052B24(void) {
gUnk_0200AF00.filler0[1]) gUnk_0200AF00.filler0[1])
return 0; return 0;
if ((gPlayerState.flags & 0x118) || (gPlayerState.framestate_last > tmp) || gPlayerState.field_0x2c || if ((gPlayerState.flags & 0x118) || (gPlayerState.framestate_last > tmp) || gPlayerState.item ||
gPlayerEntity.field_0x7a.HWORD) gPlayerEntity.field_0x7a.HWORD)
return 0; return 0;

View File

@ -54,12 +54,12 @@ static EntityAction PlayerUseEntrance;
EntityAction PlayerParachute; EntityAction PlayerParachute;
// PLAYER_FALL // PLAYER_FALL
static EntityAction sub_08070C3C; static EntityAction PlayerFallInit;
static EntityAction sub_08070CB4; static EntityAction PlayerFallUpdate;
// PLAYER_BOUNCE // PLAYER_BOUNCE
static EntityAction sub_08070D38; static EntityAction PlayerBounceInit;
static EntityAction sub_08070DC4; static EntityAction PlayerBounceUpdate;
static EntityAction sub_08070E7C; static EntityAction sub_08070E7C;
// PLAYER_08070E9C // PLAYER_08070E9C
@ -67,17 +67,17 @@ static EntityAction sub_08070EDC;
static EntityAction sub_08070f24; static EntityAction sub_08070f24;
// PLAYER_ITEMGET // PLAYER_ITEMGET
static EntityAction sub_08070FA4; static EntityAction PlayerItemGetInit;
static EntityAction sub_08071020; static EntityAction PlayerItemGetUpdate;
static EntityAction sub_08071038; static EntityAction sub_08071038;
// PLAYER_JUMP // PLAYER_JUMP
static EntityAction sub_080710A8; static EntityAction PlayerJumpInit;
static EntityAction sub_08071130; static EntityAction sub_08071130;
static EntityAction sub_08071208; static EntityAction sub_08071208;
// PLAYER_DROWN // PLAYER_DROWN
static EntityAction sub_0807127C; static EntityAction PlayerDrownInit;
static EntityAction sub_080712F0; static EntityAction sub_080712F0;
// PLAYER_USEPORTAL // PLAYER_USEPORTAL
@ -91,18 +91,18 @@ static EntityAction PortalEnterUpdate;
static EntityAction PortalUnknownUpdate; static EntityAction PortalUnknownUpdate;
// PLAYER_TALKEZLO // PLAYER_TALKEZLO
static EntityAction sub_080718A0; static EntityAction PlayerTalkEzloInit;
static EntityAction sub_0807193C; static EntityAction sub_0807193C;
static EntityAction sub_08071990; static EntityAction sub_08071990;
static EntityAction sub_08071A4C; static EntityAction sub_08071A4C;
// PLAYER_PUSH // PLAYER_PUSH
static EntityAction sub_08071AB0; static EntityAction PlayerPushInit;
static EntityAction sub_08071AF0; static EntityAction PlayerPushUpdate;
static EntityAction sub_08071B60; static EntityAction sub_08071B60;
// PLAYER_MINISHDIE // PLAYER_MINISHDIE
static EntityAction sub_08071BDC; static EntityAction PlayerMinishDieInit;
static EntityAction sub_08071CAC; static EntityAction sub_08071CAC;
static EntityAction sub_08071D04; static EntityAction sub_08071D04;
static EntityAction sub_08071D80; static EntityAction sub_08071D80;
@ -113,12 +113,12 @@ static EntityAction sub_08071E04;
static EntityAction sub_08071E74; static EntityAction sub_08071E74;
// PLAYER_EMPTYBOTTLE // PLAYER_EMPTYBOTTLE
static EntityAction sub_08071EB0; static EntityAction PlayerEmptyBottleInit;
static EntityAction sub_08071F14; static EntityAction PlayerEmptyBottleUpdate;
// PLAYER_FROZEN // PLAYER_FROZEN
static EntityAction sub_08071F50; static EntityAction PlayerFrozenInit;
static EntityAction sub_08071F80; static EntityAction PlayerFrozenUpdate;
// PLAYER_0807204C // PLAYER_0807204C
static EntityAction sub_08072064; static EntityAction sub_08072064;
@ -133,7 +133,7 @@ static EntityAction sub_08072214;
static EntityAction sub_08072260; static EntityAction sub_08072260;
// PLAYER_LAVA // PLAYER_LAVA
static EntityAction sub_080722DC; static EntityAction PlayerLavaInit;
static EntityAction sub_08072354; static EntityAction sub_08072354;
static EntityAction sub_080723D0; static EntityAction sub_080723D0;
static EntityAction sub_0807240C; static EntityAction sub_0807240C;
@ -147,12 +147,12 @@ static EntityAction sub_080724DC;
static EntityAction sub_0807258C; static EntityAction sub_0807258C;
// PLAYER_ROLL // PLAYER_ROLL
static EntityAction sub_08072650; static EntityAction PlayerRollInit;
static EntityAction sub_080726F4; static EntityAction PlayerRollUpdate;
// PLAYER_INHOLE // PLAYER_INHOLE
static EntityAction sub_08072970; static EntityAction PlayerInHoleInit;
static EntityAction sub_08072A60; static EntityAction PlayerInHoleUpdate;
static EntityAction sub_08072ACC; static EntityAction sub_08072ACC;
static EntityAction sub_08072B5C; static EntityAction sub_08072B5C;
static EntityAction sub_08072C48; static EntityAction sub_08072C48;
@ -280,7 +280,7 @@ static void PlayerInit(Entity* this) {
if (sub_08078EFC() == 0) { if (sub_08078EFC() == 0) {
sub_0807921C(); sub_0807921C();
sub_0807A1B8(); UpdateFloorType();
if (gPlayerState.swimState != 0) { if (gPlayerState.swimState != 0) {
Entity* ent; Entity* ent;
gPlayerState.swimState = 1; gPlayerState.swimState = 1;
@ -310,8 +310,8 @@ static void sub_08070BEC(Entity* this, u32 r0) {
static void PlayerFall(Entity* this) { static void PlayerFall(Entity* this) {
static EntityAction* const sPlayerFallStates[] = { static EntityAction* const sPlayerFallStates[] = {
sub_08070C3C, PlayerFallInit,
sub_08070CB4, PlayerFallUpdate,
}; };
gPlayerState.field_0xd = 0xFF; gPlayerState.field_0xd = 0xFF;
@ -321,7 +321,7 @@ static void PlayerFall(Entity* this) {
sPlayerFallStates[this->subAction](this); sPlayerFallStates[this->subAction](this);
} }
static void sub_08070C3C(Entity* this) { static void PlayerFallInit(Entity* this) {
sub_08004168(this); sub_08004168(this);
gPlayerState.flags |= PL_BUSY | PL_DROWNING; gPlayerState.flags |= PL_BUSY | PL_DROWNING;
@ -345,7 +345,7 @@ static void sub_08070C3C(Entity* this) {
SoundReq(SFX_FALL_HOLE); SoundReq(SFX_FALL_HOLE);
} }
static void sub_08070CB4(Entity* this) { static void PlayerFallUpdate(Entity* this) {
UpdateAnimationSingleFrame(this); UpdateAnimationSingleFrame(this);
if ((this->frame & 0x80) != 0) { if ((this->frame & 0x80) != 0) {
if ((gSave.stats.health != 0) && ((gPlayerState.flags & 0x8000) != 0)) { if ((gSave.stats.health != 0) && ((gPlayerState.flags & 0x8000) != 0)) {
@ -363,14 +363,14 @@ static void sub_08070CB4(Entity* this) {
static void PlayerBounce(Entity* this) { static void PlayerBounce(Entity* this) {
static EntityAction* const sPlayerBounceStates[] = { static EntityAction* const sPlayerBounceStates[] = {
sub_08070D38, PlayerBounceInit,
sub_08070DC4, PlayerBounceUpdate,
sub_08070E7C, sub_08070E7C,
}; };
sPlayerBounceStates[this->subAction](this); sPlayerBounceStates[this->subAction](this);
} }
static void sub_08070D38(Entity* this) { static void PlayerBounceInit(Entity* this) {
COLLISION_OFF(this); COLLISION_OFF(this);
this->direction = DirectionTurnAround(Direction8FromAnimationState(AnimationStateWalk(this->animationState))); this->direction = DirectionTurnAround(Direction8FromAnimationState(AnimationStateWalk(this->animationState)));
this->speed = 0x100; this->speed = 0x100;
@ -395,11 +395,11 @@ static void sub_08070D38(Entity* this) {
} }
// minor regalloc // minor regalloc
static NONMATCH("asm/non_matching/player/sub_08070DC4.inc", void sub_08070DC4(Entity* this)) { static NONMATCH("asm/non_matching/player/sub_08070DC4.inc", void PlayerBounceUpdate(Entity* this)) {
UpdateAnimationSingleFrame(this); UpdateAnimationSingleFrame(this);
sub_080085B0(this); sub_080085B0(this);
sub_08079E08(); sub_08079E08();
sub_0807A1B8(); UpdateFloorType();
if (sub_08078EFC() || sub_08003FC4(this, 0x2000)) if (sub_08078EFC() || sub_08003FC4(this, 0x2000))
return; return;
@ -423,7 +423,7 @@ static NONMATCH("asm/non_matching/player/sub_08070DC4.inc", void sub_08070DC4(En
COLLISION_ON(this); COLLISION_ON(this);
if ((gPlayerState.field_0x14 == 0) && sub_08008B22()) { if ((gPlayerState.field_0x14 == 0) && sub_08008B22()) {
gPlayerState.field_0x10[1] = 7; gPlayerState.field_0x11 = 7;
sub_08079938(); sub_08079938();
sub_080791BC(); sub_080791BC();
return; return;
@ -456,7 +456,7 @@ static void sub_08070E9C(Entity* this) {
} else { } else {
gPlayerState.field_0x27[0] = 4; gPlayerState.field_0x27[0] = 4;
gPlayerState.framestate = PL_STATE_TALKEZLO; gPlayerState.framestate = PL_STATE_TALKEZLO;
sub_0807A1B8(); UpdateFloorType();
gUnk_0811BA74[this->subAction](this); gUnk_0811BA74[this->subAction](this);
} }
} }
@ -483,8 +483,8 @@ static void sub_08070f24(Entity* this) {
static void PlayerItemGet(Entity* this) { static void PlayerItemGet(Entity* this) {
static EntityAction* const sPlayerItemGetStates[] = { static EntityAction* const sPlayerItemGetStates[] = {
sub_08070FA4, PlayerItemGetInit,
sub_08071020, PlayerItemGetUpdate,
sub_08071038, sub_08071038,
}; };
@ -504,7 +504,7 @@ static void PlayerItemGet(Entity* this) {
} }
} }
static void sub_08070FA4(Entity* this) { static void PlayerItemGetInit(Entity* this) {
this->spriteSettings.flipX = FALSE; this->spriteSettings.flipX = FALSE;
this->animationState = IdleSouth; this->animationState = IdleSouth;
@ -534,9 +534,9 @@ static void sub_08070FA4(Entity* this) {
sub_08078F60(); sub_08078F60();
} }
static void sub_08071020(Entity* this) { static void PlayerItemGetUpdate(Entity* this) {
UpdateAnimationSingleFrame(this); UpdateAnimationSingleFrame(this);
if (this->frame != 0) if (this->frame != /* entire animation is a static frame */ 0)
this->subAction = 2; this->subAction = 2;
} }
@ -557,7 +557,7 @@ static void sub_08071038(Entity* this) {
static void PlayerJump(Entity* this) { static void PlayerJump(Entity* this) {
static EntityAction* const sPlayerJumpStates[] = { static EntityAction* const sPlayerJumpStates[] = {
sub_080710A8, PlayerJumpInit,
sub_08071130, sub_08071130,
sub_08071208, sub_08071208,
}; };
@ -566,7 +566,7 @@ static void PlayerJump(Entity* this) {
sPlayerJumpStates[this->subAction](this); sPlayerJumpStates[this->subAction](this);
} }
static void sub_080710A8(Entity* this) { static void PlayerJumpInit(Entity* this) {
u32 temp; u32 temp;
this->subAction++; this->subAction++;
@ -588,7 +588,7 @@ static void sub_080710A8(Entity* this) {
} }
} }
gPlayerState.field_0x1d[1] = 0; gPlayerState.dash_state = 0;
this->direction = Direction8FromAnimationState(AnimationStateWalk(this->animationState)); this->direction = Direction8FromAnimationState(AnimationStateWalk(this->animationState));
temp = sub_08079FC4(1); temp = sub_08079FC4(1);
@ -629,7 +629,7 @@ static void sub_08071130(Entity* this) {
if (gPlayerState.field_0x14) if (gPlayerState.field_0x14)
return; return;
sub_0807A1B8(); UpdateFloorType();
if (sub_08078EFC()) if (sub_08078EFC())
return; return;
@ -672,7 +672,7 @@ static void sub_08071208(Entity* this) {
static void PlayerDrown(Entity* this) { static void PlayerDrown(Entity* this) {
static EntityAction* const sPlayerDrownStates[] = { static EntityAction* const sPlayerDrownStates[] = {
sub_0807127C, PlayerDrownInit,
sub_080712F0, sub_080712F0,
}; };
@ -682,7 +682,7 @@ static void PlayerDrown(Entity* this) {
sPlayerDrownStates[this->subAction](this); sPlayerDrownStates[this->subAction](this);
} }
static void sub_0807127C(Entity* this) { static void PlayerDrownInit(Entity* this) {
this->subAction = 1; this->subAction = 1;
this->spritePriority.b1 = 0; this->spritePriority.b1 = 0;
@ -934,7 +934,7 @@ static void sub_080717F8(Entity* this) {
static void PlayerTalkEzlo(Entity* this) { static void PlayerTalkEzlo(Entity* this) {
static EntityAction* const sPlayerTalkEzloStates[] = { static EntityAction* const sPlayerTalkEzloStates[] = {
sub_080718A0, PlayerTalkEzloInit,
sub_0807193C, sub_0807193C,
sub_08071990, sub_08071990,
sub_08071A4C, sub_08071A4C,
@ -950,7 +950,7 @@ static void PlayerTalkEzlo(Entity* this) {
} }
} }
static void sub_080718A0(Entity* this) { static void PlayerTalkEzloInit(Entity* this) {
ResetPlayer(); ResetPlayer();
gUnk_03000B80.filler[0x63] = 0; gUnk_03000B80.filler[0x63] = 0;
this->iframes = 0; this->iframes = 0;
@ -1053,8 +1053,8 @@ static void ResetPlayerPriority(void) {
static void PlayerPush(Entity* this) { static void PlayerPush(Entity* this) {
static EntityAction* const sPlayerPushStates[] = { static EntityAction* const sPlayerPushStates[] = {
sub_08071AB0, PlayerPushInit,
sub_08071AF0, PlayerPushUpdate,
sub_08071B60, sub_08071B60,
}; };
@ -1062,7 +1062,7 @@ static void PlayerPush(Entity* this) {
sPlayerPushStates[this->subAction](this); sPlayerPushStates[this->subAction](this);
} }
static void sub_08071AB0(Entity* this) { static void PlayerPushInit(Entity* this) {
u32 speed; u32 speed;
this->subAction++; this->subAction++;
@ -1074,10 +1074,10 @@ static void sub_08071AB0(Entity* this) {
} else { } else {
this->speed = (gPlayerState.flags & PL_MINISH) ? 64 : 128; this->speed = (gPlayerState.flags & PL_MINISH) ? 64 : 128;
} }
sub_08071AF0(this); PlayerPushUpdate(this);
} }
static void sub_08071AF0(Entity* this) { static void PlayerPushUpdate(Entity* this) {
typedef struct { typedef struct {
u8 frame; u8 frame;
u16 speed; u16 speed;
@ -1125,7 +1125,7 @@ static void sub_08071B60(Entity* this) {
static void PlayerMinishDie(Entity* this) { static void PlayerMinishDie(Entity* this) {
static EntityAction* const sPlayerMinishDieStates[] = { static EntityAction* const sPlayerMinishDieStates[] = {
sub_08071BDC, PlayerMinishDieInit,
sub_08071CAC, sub_08071CAC,
sub_08071D04, sub_08071D04,
sub_08071D80, sub_08071D80,
@ -1136,7 +1136,7 @@ static void PlayerMinishDie(Entity* this) {
gPlayerState.framestate = PL_STATE_DIE; gPlayerState.framestate = PL_STATE_DIE;
} }
static void sub_08071BDC(Entity* this) { static void PlayerMinishDieInit(Entity* this) {
u32 temp; u32 temp;
if (gPlayerState.flags & (0x10 | 0x100)) if (gPlayerState.flags & (0x10 | 0x100))
@ -1152,7 +1152,8 @@ static void sub_08071BDC(Entity* this) {
gPlayerState.playerAction = 0; gPlayerState.playerAction = 0;
if (gPlayerState.flags & PL_MINISH) { if (gPlayerState.flags & PL_MINISH) {
if ((u8)(gPlayerState.field_0x10[2] - 8) < 3) { if (gPlayerState.floor_type == SURFACE_MINISH_DOOR_FRONT ||
gPlayerState.floor_type == SURFACE_MINISH_DOOR_BACK || gPlayerState.floor_type == SURFACE_A) {
sub_0807A298(this); sub_0807A298(this);
RespawnPlayer(); RespawnPlayer();
this->action = 10; this->action = 10;
@ -1258,9 +1259,9 @@ static void sub_08071DD0(Entity* this) {
static void sub_08071E04(Entity* this) { static void sub_08071E04(Entity* this) {
if ((this->z.WORD != 0) && (gPlayerState.field_0x14 == '\0')) { if ((this->z.WORD != 0) && (gPlayerState.field_0x14 == '\0')) {
sub_0807A1B8(); UpdateFloorType();
if (gPlayerState.field_0x10[2] == 1) { if (gPlayerState.floor_type == SURFACE_PIT) {
gPlayerState.field_0x10[1] = 7; gPlayerState.field_0x11 = 7;
gPlayerState.flags |= 0x200; gPlayerState.flags |= 0x200;
sub_080791BC(); sub_080791BC();
return; return;
@ -1295,14 +1296,14 @@ static void sub_08071E74(Entity* this) {
static void PlayerEmptyBottle(Entity* this) { static void PlayerEmptyBottle(Entity* this) {
static EntityAction* const sPlayerEmptyBottleStates[] = { static EntityAction* const sPlayerEmptyBottleStates[] = {
sub_08071EB0, PlayerEmptyBottleInit,
sub_08071F14, PlayerEmptyBottleUpdate,
}; };
sPlayerEmptyBottleStates[this->subAction](this); sPlayerEmptyBottleStates[this->subAction](this);
} }
static void sub_08071EB0(Entity* this) { static void PlayerEmptyBottleInit(Entity* this) {
Entity* ent; Entity* ent;
ResetPlayer(); ResetPlayer();
@ -1325,24 +1326,24 @@ static void sub_08071EB0(Entity* this) {
} }
} }
static void sub_08071F14(Entity* this) { static void PlayerEmptyBottleUpdate(Entity* this) {
UpdateAnimationSingleFrame(this); UpdateAnimationSingleFrame(this);
if (this->frame & 0x80) { if (this->frame & 0x80) {
gPlayerState.field_0x2c = NULL; gPlayerState.item = NULL;
sub_0807921C(); sub_0807921C();
} }
} }
static void PlayerFrozen(Entity* this) { static void PlayerFrozen(Entity* this) {
static EntityAction* const sPlayerFrozenStates[] = { static EntityAction* const sPlayerFrozenStates[] = {
sub_08071F50, PlayerFrozenInit,
sub_08071F80, PlayerFrozenUpdate,
}; };
sPlayerFrozenStates[this->subAction](this); sPlayerFrozenStates[this->subAction](this);
} }
static void sub_08071F50(Entity* this) { static void PlayerFrozenInit(Entity* this) {
COLLISION_OFF(this); COLLISION_OFF(this);
this->actionDelay = 120; this->actionDelay = 120;
this->subAction++; this->subAction++;
@ -1351,7 +1352,7 @@ static void sub_08071F50(Entity* this) {
SoundReq(SFX_195); SoundReq(SFX_195);
} }
static void sub_08071F80(Entity* this) { static void PlayerFrozenUpdate(Entity* this) {
if (sub_08003FC4(this, 0x2000) == 0) { if (sub_08003FC4(this, 0x2000) == 0) {
UpdateSpriteForCollisionLayer(this); UpdateSpriteForCollisionLayer(this);
gPlayerState.jumpStatus = 0; gPlayerState.jumpStatus = 0;
@ -1515,7 +1516,7 @@ static void sub_08072260(Entity* this) {
static void PlayerLava(Entity* this) { static void PlayerLava(Entity* this) {
static EntityAction* const sPlayerLavaStates[] = { static EntityAction* const sPlayerLavaStates[] = {
sub_080722DC, PlayerLavaInit,
sub_08072354, sub_08072354,
sub_080723D0, sub_080723D0,
sub_0807240C, sub_0807240C,
@ -1525,7 +1526,7 @@ static void PlayerLava(Entity* this) {
sPlayerLavaStates[this->subAction](this); sPlayerLavaStates[this->subAction](this);
} }
static void sub_080722DC(Entity* this) { static void PlayerLavaInit(Entity* this) {
Entity* ent; Entity* ent;
COLLISION_OFF(this); COLLISION_OFF(this);
@ -1674,15 +1675,15 @@ static void sub_0807258C(Entity* this) {
static void PlayerRoll(Entity* this) { static void PlayerRoll(Entity* this) {
static EntityAction* const sPlayerRollStates[] = { static EntityAction* const sPlayerRollStates[] = {
sub_08072650, PlayerRollInit,
sub_080726F4, PlayerRollUpdate,
}; };
gPlayerState.framestate = PL_STATE_ROLL; gPlayerState.framestate = PL_STATE_ROLL;
sPlayerRollStates[this->subAction](this); sPlayerRollStates[this->subAction](this);
} }
static void sub_08072650(Entity* this) { static void PlayerRollInit(Entity* this) {
u32 temp; u32 temp;
if ((gPlayerState.flags & 0x200000) == 0) { if ((gPlayerState.flags & 0x200000) == 0) {
@ -1713,7 +1714,7 @@ static void sub_08072650(Entity* this) {
SoundReq(SFX_7E); SoundReq(SFX_7E);
} }
static void sub_080726F4(Entity* this) { static void PlayerRollUpdate(Entity* this) {
if (((gPlayerState.flags & (PL_ROLLING | 0x80000)) != PL_ROLLING) || if (((gPlayerState.flags & (PL_ROLLING | 0x80000)) != PL_ROLLING) ||
(!(gPlayerState.flags & 0x200000) && (this->iframes != 0) && (this->bitfield & 0x80))) { (!(gPlayerState.flags & 0x200000) && (this->iframes != 0) && (this->bitfield & 0x80))) {
gPlayerState.flags &= ~PL_ROLLING; gPlayerState.flags &= ~PL_ROLLING;
@ -1728,7 +1729,7 @@ static void sub_080726F4(Entity* this) {
this->actionDelay = 4; this->actionDelay = 4;
} }
if ((gPlayerState.flags & 2) == 0) { if ((gPlayerState.flags & 2) == 0) {
sub_0807A1B8(); UpdateFloorType();
} }
if (sub_08078EFC()) { if (sub_08078EFC()) {
gPlayerState.flags &= ~PL_ROLLING; gPlayerState.flags &= ~PL_ROLLING;
@ -1750,7 +1751,8 @@ static void sub_080726F4(Entity* this) {
return; return;
} }
if (gPlayerState.field_0x10[2] == 0x17) { if (gPlayerState.floor_type == SURFACE_ICE) {
// roll in place when on ice
sub_0800892E(this); sub_0800892E(this);
} else { } else {
switch (this->frame & 0xf) { switch (this->frame & 0xf) {
@ -1773,7 +1775,8 @@ static void sub_080726F4(Entity* this) {
sub_08079E08(); sub_08079E08();
} }
if (((this->frame & 0x10) == 0) && ((gPlayerState.flags & PL_MINISH) == 0)) { if (((this->frame & 0x10) == 0) && ((gPlayerState.flags & PL_MINISH) == 0)) {
*(u8*)&this->hurtType = 0; // dont take damage
this->hurtType = 0;
} }
if ((this->frame & 0x40) != 0) { if ((this->frame & 0x40) != 0) {
sub_08077698(this); sub_08077698(this);
@ -1796,31 +1799,31 @@ static void sub_080728AC(Entity* this) {
if (gPlayerState.swimState != 0) if (gPlayerState.swimState != 0)
this->speed = 0; this->speed = 0;
if (!(gPlayerState.flags & 0x40)) if ((gPlayerState.flags & 0x40) == 0)
gPlayerEntity.spriteSettings.draw = 3; gPlayerEntity.spriteSettings.draw = 3;
if (!(gPlayerState.flags & PL_MINISH)) if ((gPlayerState.flags & PL_MINISH) == 0)
gPlayerEntity.spritePriority.b1 = 1; gPlayerEntity.spritePriority.b1 = 1;
if (!(gRoomControls.unk6 & 4)) { if ((gRoomControls.unk6 & 4) == 0) {
if ((gPlayerState.flags & 0x40)) if (gPlayerState.flags & 0x40)
COLLISION_ON(this); COLLISION_ON(this);
sub_080791D0(); sub_080791D0();
} }
if (!(gPlayerState.flags & 2)) { if ((gPlayerState.flags & 2) == 0) {
sub_0807A1B8(); UpdateFloorType();
} }
} }
static void PlayerInHole(Entity* this) { static void PlayerInHole(Entity* this) {
static EntityAction* const sPlayerInHoleStates[] = { static EntityAction* const sPlayerInHoleStates[] = {
sub_08072970, sub_08072A60, sub_08072ACC, sub_08072B5C, sub_08072C48, PlayerInHoleInit, PlayerInHoleUpdate, sub_08072ACC, sub_08072B5C, sub_08072C48,
}; };
gPlayerState.framestate = PL_STATE_HOLE; gPlayerState.framestate = PL_STATE_HOLE;
sPlayerInHoleStates[this->subAction](this); sPlayerInHoleStates[this->subAction](this);
} }
static void sub_08072970(Entity* this) { static void PlayerInHoleInit(Entity* this) {
if (this->health != 0) { if (this->health != 0) {
this->subAction = 1; this->subAction = 1;
this->x.HALF.HI = (this->x.HALF.HI & ~0xF) | 8; this->x.HALF.HI = (this->x.HALF.HI & ~0xF) | 8;
@ -1840,12 +1843,12 @@ static void sub_08072970(Entity* this) {
} }
SetTile(0x4070, COORD_TO_TILE(this), this->collisionLayer); SetTile(0x4070, COORD_TO_TILE(this), this->collisionLayer);
ResetPlayer(); ResetPlayer();
sub_08072A60(this); PlayerInHoleUpdate(this);
SoundReq(0x81); SoundReq(0x81);
} }
} }
static void sub_08072A60(Entity* this) { static void PlayerInHoleUpdate(Entity* this) {
if (this->frame & 0x80) { if (this->frame & 0x80) {
if (this->actionDelay == 1) { if (this->actionDelay == 1) {
this->subAction = 3; this->subAction = 3;
@ -1932,7 +1935,7 @@ static void sub_08072C48(Entity* this) {
sub_08008790(this, 7); sub_08008790(this, 7);
if (gPlayerState.field_0x14) { if (gPlayerState.field_0x14) {
if (sub_08008B22()) { if (sub_08008B22()) {
gPlayerState.field_0x10[1] = 7; gPlayerState.field_0x11 = 7;
if (!(gPlayerState.flags & PL_MINISH)) { if (!(gPlayerState.flags & PL_MINISH)) {
sub_080791BC(); sub_080791BC();
} }
@ -2061,7 +2064,7 @@ static NONMATCH("asm/non_matching/player/sub_08072D54.inc", void sub_08072D54(En
sub_08008790(this, 7); sub_08008790(this, 7);
if (gPlayerState.field_0x14 != 0) { if (gPlayerState.field_0x14 != 0) {
if (sub_08008B22() == 0) { if (sub_08008B22() == 0) {
gPlayerState.field_0x10[1] = 7; gPlayerState.field_0x11 = 7;
if (!(gPlayerState.flags & PL_MINISH)) { if (!(gPlayerState.flags & PL_MINISH)) {
sub_080791BC(); sub_080791BC();
} }
@ -2097,7 +2100,7 @@ static void sub_08072F34(Entity* this) {
if (!sub_08078EFC()) { if (!sub_08078EFC()) {
gPlayerState.framestate = PL_STATE_CLIMB; gPlayerState.framestate = PL_STATE_CLIMB;
gPlayerState.field_0x10[2] = GetSurfaceCalcType(this, 0, 0); gPlayerState.floor_type = GetSurfaceCalcType(this, 0, 0);
gUnk_0811BBE4[this->subAction](this); gUnk_0811BBE4[this->subAction](this);
if (this->knockbackDuration != 0) { if (this->knockbackDuration != 0) {
sub_080792D8(); sub_080792D8();
@ -2114,18 +2117,20 @@ static void sub_08072F34(Entity* this) {
static void sub_08072F94(Entity* this) { static void sub_08072F94(Entity* this) {
u32 bVar1; u32 bVar1;
switch (gPlayerState.field_0x10[2]) { switch (gPlayerState.floor_type) {
default: default:
sub_0807921C(); sub_0807921C();
break; break;
case 0x1E: case SURFACE_LADDER:
case 0x2A ... 0x2C: case SURFACE_AUTO_LADDER:
case SURFACE_CLIMB_WALL:
case SURFACE_2C:
this->spritePriority.b1 = 0; this->spritePriority.b1 = 0;
bVar1 = gPlayerState.field_0xd; bVar1 = gPlayerState.field_0xd;
if ((gPlayerState.field_0xd & 0x80) == 0) { if ((gPlayerState.field_0xd & 0x80) == 0) {
this->direction = gPlayerState.field_0xd; this->direction = gPlayerState.field_0xd;
if ((gPlayerState.field_0xd == 8) || (gPlayerState.field_0xd == 0x18)) { if ((gPlayerState.field_0xd == 8) || (gPlayerState.field_0xd == 0x18)) {
if (gPlayerState.field_0x10[2] == 0x1e) { if (gPlayerState.floor_type == SURFACE_LADDER) {
return; return;
} }
if ((this->frame & 0x10)) { if ((this->frame & 0x10)) {
@ -2135,7 +2140,7 @@ static void sub_08072F94(Entity* this) {
} }
sub_08073094(this); sub_08073094(this);
} else { } else {
if ((gPlayerState.field_0x10[2] == 0x1e) && ((bVar1 & 7) != 0)) { if ((gPlayerState.floor_type == SURFACE_LADDER) && ((bVar1 & 7) != 0)) {
this->direction = (bVar1 + 8) & 0x10; this->direction = (bVar1 + 8) & 0x10;
} }
if (this->direction & 0x10) { if (this->direction & 0x10) {
@ -2174,36 +2179,36 @@ static void sub_08073094(Entity* this) {
sub_08079E08(); sub_08079E08();
if (!sub_08019840()) { if (!sub_08019840()) {
gPlayerState.pushedObject ^= 0x80; gPlayerState.pushedObject ^= 0x80;
if ((gPlayerState.field_0x10[2] != 0x2a) && (gPlayerState.field_0x10[2] != 0x2c)) { if ((gPlayerState.floor_type != SURFACE_AUTO_LADDER) && (gPlayerState.floor_type != SURFACE_2C)) {
sub_0807A1B8(); UpdateFloorType();
} }
if (sub_08078EFC() == 0) { if (sub_08078EFC() == 0) {
switch (gPlayerState.field_0x10[2]) { switch (gPlayerState.floor_type) {
case 0x2a: case SURFACE_AUTO_LADDER:
case 0x2c: case SURFACE_2C:
this->knockbackDuration = 0; this->knockbackDuration = 0;
gPlayerState.flags |= 0x20000000; gPlayerState.flags |= 0x20000000;
UpdateAnimationSingleFrame(this); UpdateAnimationSingleFrame(this);
if ((this->frame & 0x40) != 0) { if ((this->frame & 0x40) != 0) {
sub_0807A1B8(); UpdateFloorType();
if (!sub_08078EFC()) { if (!sub_08078EFC()) {
this->subAction--; this->subAction--;
} }
} }
break; break;
case 0x19: case SURFACE_WATER:
sub_08074808(this); sub_08074808(this);
sub_080791D0(); sub_080791D0();
break; break;
default: default:
sub_0807921C(); sub_0807921C();
break; break;
case 0x1e: case SURFACE_LADDER:
case 0x2b: case SURFACE_CLIMB_WALL:
UpdateAnimationSingleFrame(this); UpdateAnimationSingleFrame(this);
if ((this->frame & 0x40) != 0) { if ((this->frame & 0x40) != 0) {
sub_0807A1B8(); UpdateFloorType();
if (!sub_08078EFC()) { if (!sub_08078EFC()) {
this->subAction--; this->subAction--;
} }

View File

@ -55,7 +55,7 @@ void sub_08018CBC(Entity* this) {
this->spriteIndex = 0xa6; this->spriteIndex = 0xa6;
this->palette.raw = 0x33; this->palette.raw = 0x33;
this->spriteVramOffset = 0; this->spriteVramOffset = 0;
this->type = gPlayerState.field_0x1d[0] - 1; this->type = gPlayerState.field_0x1d - 1;
this->actionDelay = gUnk_080B3DE0[this->type * 2]; this->actionDelay = gUnk_080B3DE0[this->type * 2];
this->damage = gUnk_080B3DE0[this->type * 2 + 1]; this->damage = gUnk_080B3DE0[this->type * 2 + 1];
this->hurtType = 0x1b; this->hurtType = 0x1b;

View File

@ -17,8 +17,8 @@ void PlayerItemC(Entity* this) {
} }
void sub_0801B8B0(Entity* this) { void sub_0801B8B0(Entity* this) {
if (gPlayerState.field_0x1d[1] != 0) { if (gPlayerState.dash_state != 0) {
gPlayerState.field_0x2c = (u8*)this; gPlayerState.item = this;
this->flags |= 0x20; this->flags |= 0x20;
this->action = 0x01; this->action = 0x01;
this->flags2 = 8; this->flags2 = 8;
@ -33,12 +33,12 @@ void sub_0801B8B0(Entity* this) {
void sub_0801B8FC(Entity* this) { void sub_0801B8FC(Entity* this) {
Entity* pbVar1; Entity* pbVar1;
pbVar1 = (Entity*)gPlayerState.field_0x2c; pbVar1 = (Entity*)gPlayerState.item;
if ((Entity*)gPlayerState.field_0x2c != this) { if ((Entity*)gPlayerState.item != this) {
DeleteThisEntity(); DeleteThisEntity();
} else { } else {
if ((u8*)(u32)gPlayerState.field_0x1d[1] == NULL) { if (gPlayerState.dash_state == 0) {
gPlayerState.field_0x2c = (u8*)(u32)gPlayerState.field_0x1d[1]; gPlayerState.item = NULL;
DeleteThisEntity(); DeleteThisEntity();
} else { } else {
pbVar1->flags |= 0x80; pbVar1->flags |= 0x80;

View File

@ -10,7 +10,7 @@ void sub_080ADC84(Entity*);
void sub_080ADCA0(Entity*, u32); void sub_080ADCA0(Entity*, u32);
void PlayerItemGustJar(Entity* this) { void PlayerItemGustJar(Entity* this) {
if (((Entity*)gPlayerState.field_0x2c != this) || (gPlayerState.field_0x1c == 0)) { if (((Entity*)gPlayerState.item != this) || (gPlayerState.field_0x1c == 0)) {
DeleteThisEntity(); DeleteThisEntity();
} }
gUnk_08132700[this->action](this); gUnk_08132700[this->action](this);