PlayerNormal ok

This commit is contained in:
theo3 2022-01-02 16:10:29 -08:00
parent 466b508413
commit 415f5213a9
39 changed files with 471 additions and 266 deletions

View File

@ -227,8 +227,8 @@ _0801982E:
pop {r4, r5, pc}
.align 2, 0
thumb_func_start sub_08019840
sub_08019840: @ 0x08019840
thumb_func_start UpdatePlayerCollision
UpdatePlayerCollision: @ 0x08019840
push {r4, r5, r6, r7, lr}
mov r7, sb
mov r6, r8

View File

@ -211,7 +211,7 @@ _08070924:
orrs r1, r0
cmp r1, #0
bne _080709D8
bl sub_08019840
bl UpdatePlayerCollision
cmp r0, #0xf
bls _08070940
b _08070BE4

View File

@ -103,10 +103,10 @@ gUnk_0811C120:: @ 0811C120
.4byte SurfaceAction_A
.4byte SurfaceAction_B
.4byte SurfaceAction_SlopeGndWater
.4byte SurfaceAction_D
.4byte SurfaceAction_E
.4byte SurfaceAction_F
.4byte SurfaceAction_10
.4byte SurfaceAction_ConveyerNorth
.4byte SurfaceAction_ConveyerSouth
.4byte SurfaceAction_ConveyerWest
.4byte SurfaceAction_ConveyerEast
.4byte SurfaceAction_Swamp
.4byte SurfaceAction_DoNothing
.4byte SurfaceAction_DoNothing

View File

@ -95,27 +95,30 @@ typedef enum {
} PlayerControlMode;
enum PlayerFlags {
PL_BUSY = (1 << 0),
PL_DROWNING = (1 << 2),
PL_NO_CAP = (1 << 3),
PL_USE_PORTAL = (1 << 5),
PL_HIDDEN = (1 << 6),
PL_MINISH = (1 << 7),
PL_FALLING = (1 << 9),
PL_BURNING = (1 << 10),
PL_FROZEN = (1 << 11),
PL_DRUGGED = (1 << 14),
PL_ROLLING = (1 << 18),
PL_TRAPPED = (1 << 19),
PL_IN_HOLE = (1 << 20),
PL_RELEASED = (1 << 21),
PL_CLONING = (1 << 22),
PL_USE_LANTERN = (1 << 23),
PL_PARACHUTE = (1 << 24),
PL_MINECART = (1 << 26),
PL_SWORD_THRUST = (1 << 27),
PL_USE_OCARINA = (1 << 28),
PL_CLIMBING = (1 << 29),
PL_BUSY = 0x1,
PL_DROWNING = 0x4,
PL_NO_CAP = 0x8,
PL_CAPTURED = 0x10,
PL_USE_PORTAL = 0x20,
PL_HIDDEN = 0x40,
PL_MINISH = 0x80,
PL_DISABLE_ITEMS = 0x100,
PL_FALLING = 0x200,
PL_BURNING = 0x400,
PL_FROZEN = 0x800,
PL_IN_MINECART = 0x1000,
PL_DRUGGED = 0x4000,
PL_ROLLING = 0x40000,
PL_MOLDWORM_CAPTURED = 0x80000,
PL_IN_HOLE = 0x100000,
PL_MOLDWORM_RELEASED = 0x200000,
PL_CLONING = 0x400000,
PL_USE_LANTERN = 0x800000,
PL_PARACHUTE = 0x1000000,
PL_ENTER_MINECART = 0x4000000,
PL_SWORD_THRUST = 0x8000000,
PL_USE_OCARINA = 0x10000000,
PL_CLIMBING = 0x20000000,
};
enum SurfaceType {
@ -168,7 +171,7 @@ enum SurfaceType {
typedef struct {
/*0x00*/ u8 field_0x0[2];
/*0x02*/ u8 jumpStatus;
/*0x02*/ u8 jump_status;
/*0x03*/ u8 field_0x3[2];
/*0x05*/ u8 heldObject;
/*0x06*/ u8 pushedObject;
@ -188,13 +191,14 @@ typedef struct {
/*0x15*/ u8 field_0x15;
/*0x16*/ u16 startPosX;
/*0x18*/ u16 startPosY;
/*0x1a*/ u8 field_0x1a[2];
/*0x1a*/ u8 mobility;
/*0x1b*/ u8 sword_state;
/*0x1c*/ u8 field_0x1c;
/*0x1d*/ u8 field_0x1d;
/*0x1e*/ u8 dash_state;
/*0x1f*/ u8 field_0x1f[3];
/*0x22*/ u16 field_0x22[2];
/*0x26*/ u8 swimState;
/*0x26*/ u8 swim_state;
/*0x27*/ u8 field_0x27[5];
/*0x2c*/ Entity* item;
/*0x30*/ u32 flags;
@ -210,7 +214,7 @@ typedef struct {
/* */ u8 swordBlueParticle : 1;
/* */ u8 filler14 : 6;
/*0x3f*/ u8 field_0x3f;
/*0x40*/ u8 hurtType[64];
/*0x40*/ u8 path_memory[64];
/*0x80*/ u16 speed_modifier;
/*0x82*/ u8 field_0x82[9];
/*0x8b*/ u8 controlMode;

View File

@ -182,7 +182,7 @@ void sub_08077E78(ItemBehavior* arg0, u32 bits) {
u32 sub_08077EC8(ItemBehavior* beh) {
Unk_struct* arg0 = (Unk_struct*)beh; // @nocheckin
if ((gPlayerState.field_0x1a[1] & 8) != 0) {
if ((gPlayerState.sword_state & 8) != 0) {
sub_08077DF4(beh, 0x170);
arg0->unk[7] = 0x28;
arg0->unk[4] = 7;
@ -225,7 +225,7 @@ void sub_08077F84(void) {
if (((gPlayerEntity.collisionLayer & 2) == 0) &&
GetTileTypeByPos(gPlayerEntity.x.HALF.HI, gPlayerEntity.y.HALF.HI - 0xc, 2) - 0x343U < 4) {
sub_0807AA80(&gPlayerEntity);
gPlayerState.jumpStatus |= 8;
gPlayerState.jump_status |= 8;
obj = CreateObject(OBJECT_44, 0, 0);
if (obj != NULL) {
obj->x = gPlayerEntity.x;

View File

@ -444,7 +444,7 @@ s32 sub_08017CBC(Entity* org, Entity* tgt, u32 direction, ColSettings* settings)
}
s32 sub_08017D28(Entity* org, Entity* tgt, u32 direction, ColSettings* settings) {
gPlayerState.field_0x1a[0] = 1;
gPlayerState.mobility = 1;
org->field_0x7a.HWORD = 600;
org->knockbackDuration = 12;
org->iframes = 16;
@ -538,11 +538,11 @@ s32 sub_08017F40(Entity* org, Entity* tgt, u32 direction, ColSettings* settings)
#else
(gPlayerState.flags & PL_MINISH) == 0 &&
#endif
!gPlayerState.swimState) {
gPlayerState.field_0x1a[0] |= 0x80u;
gPlayerState.field_0xa |= 0x80u;
gPlayerState.flags |= 0x10u;
gPlayerState.jumpStatus = 0;
!gPlayerState.swim_state) {
gPlayerState.mobility |= 0x80;
gPlayerState.field_0xa |= 0x80;
gPlayerState.flags |= PL_CAPTURED;
gPlayerState.jump_status = 0;
if (tgt->kind == ENEMY && (tgt->id == GHINI || tgt->id == ENEMY_50)) {
org->z.HALF.HI = 0;
PositionRelative(org, tgt, 0, 0x10000);
@ -632,11 +632,11 @@ s32 sub_08018168(Entity* org, Entity* tgt, u32 direction, ColSettings* settings)
#else
(gPlayerState.flags & (PL_MINISH | PL_ROLLING)) == 0 &&
#endif
gPlayerState.swimState == 0) {
gPlayerState.field_0x1a[0] |= 0x80;
gPlayerState.swim_state == 0) {
gPlayerState.mobility |= 0x80;
gPlayerState.field_0xa |= 0x80;
gPlayerState.flags |= 0x100;
gPlayerState.jumpStatus = 0;
gPlayerState.flags |= PL_DISABLE_ITEMS;
gPlayerState.jump_status = 0;
COLLISION_OFF(&gPlayerEntity);
gPlayerEntity.spriteRendering.b3 = tgt->spriteRendering.b3;
gPlayerEntity.spriteOrientation.flipY = tgt->spriteOrientation.flipY;

View File

@ -230,7 +230,7 @@ void sub_08021B64(Entity* this) {
this->actionDelay = (u8)iVar4;
}
if (gPlayerState.flags & 0x110)
if (gPlayerState.flags & (PL_DISABLE_ITEMS | PL_CAPTURED))
iVar4 = 0;
if (iVar4 == 0) {
@ -244,7 +244,7 @@ void sub_08021B64(Entity* this) {
}
InitializeAnimation(this, 5);
} else {
gPlayerState.field_0x1a[0] |= 0x80;
gPlayerState.mobility |= 0x80;
gPlayerState.speed_modifier -= 0x50;
gPlayerState.field_0xaa++;
CopyPositionAndSpriteOffset(&gPlayerEntity, this);

View File

@ -160,7 +160,7 @@ NONMATCH("asm/non_matching/gibdo/sub_080376D0.inc", void sub_080376D0(Entity* th
u8* x;
if (sub_080379EC(this) == 0) {
ResetPlayer();
gPlayerState.field_0x1a[0] = gPlayerState.field_0x1a[0] | 0x80;
gPlayerState.mobility = gPlayerState.mobility | 0x80;
gPlayerState.field_0xa = gPlayerState.field_0xa | 0x80;
CopyPositionAndSpriteOffset(&gPlayerEntity, this);
UpdateAnimationSingleFrame(this);
@ -347,7 +347,7 @@ void sub_08037A58(Entity* this) {
}
void sub_08037ACC(Entity* this) {
gPlayerState.flags &= ~0x100;
gPlayerState.flags &= ~PL_DISABLE_ITEMS;
COLLISION_ON(&gPlayerEntity);
gPlayerEntity.iframes = 0x1e;
gPlayerEntity.knockbackDirection = DirectionFromAnimationState(this->animationState);

View File

@ -184,7 +184,7 @@ void sub_0802805C(Entity* this) {
sub_0802810C(this);
} else {
ResetPlayer();
gPlayerState.field_0x1a[0] |= 0x80;
gPlayerState.mobility |= 0x80;
PositionRelative(this, &gPlayerEntity, 0, 0x10000);
tmp = GetSpriteSubEntryOffsetDataPointer((u16)this->spriteIndex, this->frameIndex);
@ -203,7 +203,7 @@ void sub_0802805C(Entity* this) {
}
NONMATCH("asm/non_matching/likeLike/sub_0802810C.inc", void sub_0802810C(Entity* this)) {
gPlayerState.jumpStatus = 0x41;
gPlayerState.jump_status = 0x41;
gPlayerState.field_0xa = 0;
gPlayerState.flags &= 0xffffffef;
gPlayerEntity.flags |= 0x80;

View File

@ -1220,9 +1220,9 @@ void sub_0803B724(Entity* param_1) {
}
void sub_0803B798(void) {
gPlayerState.jumpStatus = 0x41;
gPlayerState.jump_status = 0x41;
gPlayerState.field_0xa = 0;
gPlayerState.flags &= 0xffef;
gPlayerState.flags &= ~(0xffff0000 | PL_CAPTURED);
gPlayerEntity.flags |= 0x80;
gPlayerEntity.zVelocity = 0x18000;
gPlayerEntity.z.HALF.HI = -10;
@ -1242,7 +1242,7 @@ void sub_0803B804(Entity* this) {
void sub_0803B824(Entity* this) {
ResetPlayer();
gPlayerState.field_0x1a[0] = gPlayerState.field_0x1a[0] | 0x80;
gPlayerState.mobility = gPlayerState.mobility | 0x80;
sub_0806FA90(this, &gPlayerEntity, gUnk_080CFD1D[this->type], 1);
gPlayerEntity.spriteOffsetY = -6;
gPlayerEntity.spritePriority.b1 = 0;
@ -1252,7 +1252,7 @@ u32 sub_0803B870(Entity* this) {
Entity* entity;
entity = this->child;
if ((entity->bitfield & 0x80) != 0 && (gPlayerState.flags & 0x10) != 0) {
if ((entity->bitfield & 0x80) != 0 && (gPlayerState.flags & PL_CAPTURED)) {
this->action = 0x18;
this->actionDelay = 0x44;
this->spriteSettings.draw = 0;

View File

@ -83,7 +83,7 @@ void sub_080230E4(Entity* this) {
gPlayerEntity.zVelocity = 0x18000;
gPlayerEntity.direction = 0xff;
gPlayerEntity.iframes = -0x14;
gPlayerState.jumpStatus = 0x41;
gPlayerState.jump_status = 0x41;
gPlayerState.flags &= 0xfff7ffff;
}
@ -262,7 +262,7 @@ void sub_0802351C(Entity* this) {
if (this->field_0x7c.BYTES.byte3 == 0) {
if (this->type2 == 0) {
gPlayerEntity.animationState = this->animationState & 7;
gPlayerState.flags |= PL_TRAPPED;
gPlayerState.flags |= PL_MOLDWORM_CAPTURED;
PositionRelative(this, &gPlayerEntity, 0, gUnk_080CBC90[this->animationState & 7] << 0x10);
gPlayerEntity.spriteOffsetY = -gUnk_080CBC90[this->animationState & 7];
}
@ -397,7 +397,7 @@ void sub_08023894(Entity* this) {
this->parent->field_0x7c.BYTES.byte3 = 1;
InitializeAnimation(this, this->animationState);
if (this->parent->type2 == 0) {
gPlayerState.flags |= PL_RELEASED;
gPlayerState.flags |= PL_MOLDWORM_RELEASED;
gPlayerEntity.x.HALF.HI = this->x.HALF.HI;
gPlayerEntity.y.HALF.HI = this->y.HALF.HI;
gPlayerEntity.direction = DirectionRoundUp(GetFacingDirection(*(Entity**)&this->field_0x74, this));

View File

@ -931,8 +931,8 @@ void OctorokBoss_ExecuteAttackVacuum(Entity* this) {
}
if (tmp < 0x10) {
if (sub_0806FC80(this, &gPlayerEntity, 0xf0) != 0) {
if ((gPlayerState.flags & 0x800) == 0) {
if ((gPlayerEntity.flags & 0x80) != 0) {
if ((gPlayerState.flags & PL_FROZEN) == 0) {
if ((gPlayerEntity.flags & PL_MINISH) != 0) {
sub_0806F62C(&gPlayerEntity, 0x280, -GET_ANGLE_HI(this));
if (sub_0806FC80(this, &gPlayerEntity, 0x48) != 0) {
this->field_0x80.HALF.LO = 1;
@ -981,7 +981,7 @@ void OctorokBoss_ExecuteAttackVacuum(Entity* this) {
OctorokBoss_SetAttackTimer(this);
} else {
GET_TIMER(this)--;
if ((gPlayerState.flags == 0x800) && (GET_TIMER(this) == 0x3c)) {
if ((gPlayerState.flags == PL_FROZEN) && (GET_TIMER(this) == 0x3c)) {
tmp = sub_080045DA(gPlayerEntity.x.WORD - this->x.WORD, gPlayerEntity.y.WORD - this->y.WORD);
if ((u8)((tmp - ((u8)-GET_ANGLE_HI(this) ^ 0x80))) > 0x80) {
GET_HELPER(this)->targetAngle = GET_ANGLE_HI(this) + 0x30;

View File

@ -392,10 +392,10 @@ void sub_080244E8(Entity* this) {
sub_080249DC(this);
this->cutsceneBeh.HALF.HI = gPlayerEntity.spritePriority.b1;
gPlayerEntity.flags &= 0x7f;
gPlayerState.flags |= 0x100;
gPlayerState.flags |= PL_DISABLE_ITEMS;
gPlayerState.field_0xa |= 0x80;
if (gPlayerState.swimState != 0) {
gPlayerState.swimState = 0;
if (gPlayerState.swim_state != 0) {
gPlayerState.swim_state = 0;
}
}
break;
@ -636,7 +636,7 @@ bool32 sub_08024B38(Entity* this) {
Entity* ent;
if (gPlayerState.hurtBlinkSpeed != 0) {
if (gPlayerState.swimState == 1) {
if (gPlayerState.swim_state == 1) {
if (gPlayerState.hurtBlinkSpeed > 3) {
gPlayerState.hurtBlinkSpeed -= 3;
} else {
@ -806,7 +806,7 @@ NONMATCH("asm/non_matching/pesto/sub_08024E4C.inc", void sub_08024E4C(Entity* th
Entity* player = &gPlayerEntity;
ResetPlayer();
gPlayerState.flags |= 0x100;
gPlayerState.flags |= PL_DISABLE_ITEMS;
gPlayerState.field_0xa |= 0x80;
gPlayerState.queued_action = PLAYER_0807204C;
gPlayerState.field_0x38 = 0x14;
@ -829,7 +829,7 @@ END_NONMATCH
void sub_08024F50(Entity* this) {
gPlayerState.field_0xa = 0;
gPlayerState.flags &= ~0x100;
gPlayerState.flags &= ~PL_DISABLE_ITEMS;
CopyPosition(this, &gPlayerEntity);
gPlayerEntity.action = 1;
COLLISION_ON(&gPlayerEntity);

View File

@ -163,7 +163,7 @@ void sub_0802953C(Entity* this) {
sub_080296D8(this);
} else {
ResetPlayer();
gPlayerState.field_0x1a[0] |= 0x80;
gPlayerState.mobility |= 0x80;
PositionRelative(this, &gPlayerEntity, 0, 0x10000);
pbVar3 = GetSpriteSubEntryOffsetDataPointer((u16)this->spriteIndex, this->frameIndex);
gPlayerEntity.spriteOffsetX = pbVar3[0];
@ -230,8 +230,8 @@ void sub_080296C8(Entity* this) {
}
void sub_080296D8(Entity* this) {
gPlayerState.jumpStatus = 0x41;
gPlayerState.flags &= ~0x10;
gPlayerState.jump_status = 0x41;
gPlayerState.flags &= ~PL_CAPTURED;
gPlayerEntity.flags |= 0x80;
gPlayerEntity.zVelocity = 0x18000;
gPlayerEntity.iframes = 0xa6;

View File

@ -71,7 +71,7 @@ void VaatiProjectileFunction1(Entity* this) {
entity->flags = entity->flags & 0x7f;
}
} else {
gPlayerState.flags &= 0xfffffeff; // using b.unk8 does not match
gPlayerState.flags &= ~PL_DISABLE_ITEMS;
entity = &gPlayerEntity;
entity->flags = gPlayerEntity.flags | 0x80;
}
@ -222,7 +222,7 @@ void VaatiProjectileFunction0Action9(Entity* this) {
void sub_0803E444(Entity* this) {
ResetPlayer();
gPlayerState.field_0x1a[0] = gPlayerState.field_0x1a[0] | 0x80;
gPlayerState.mobility = gPlayerState.mobility | 0x80;
gPlayerState.field_0xa = gPlayerState.field_0xa | 0x80;
sub_0806FA90(this, this->field_0x4c, 0, -2);
gPlayerEntity.spriteOffsetY += 0xe;

View File

@ -134,7 +134,7 @@ void sub_0802A69C(Entity* this) {
sub_0802A7D0(this);
gPlayerState.field_0xa |= 0x80;
gPlayerState.field_0x1a[0] |= 0x80;
gPlayerState.mobility |= 0x80;
gPlayerEntity.x.HALF.HI = this->field_0x7c.HALF.HI;
gPlayerEntity.y.HALF.HI = this->field_0x80.HWORD;
gPlayerEntity.z.HALF.HI = this->field_0x82.HWORD;
@ -168,7 +168,7 @@ void sub_0802A734(Entity* this) {
} else {
this->z.WORD -= 0x20000;
gPlayerState.field_0xa |= 0x80;
gPlayerState.field_0x1a[0] |= 0x80;
gPlayerState.mobility |= 0x80;
}
}

View File

@ -116,8 +116,8 @@ void sub_0802CE68(Entity* this) {
u8 frames;
gPlayerState.field_0xa |= 0x80;
gPlayerState.field_0x1a[0] |= 0x80;
gPlayerState.flags |= 0x100;
gPlayerState.mobility |= 0x80;
gPlayerState.flags |= PL_DISABLE_ITEMS;
if (!sub_0806FCB8(this, gPlayerEntity.x.HALF.HI, gPlayerEntity.y.HALF.HI, 4)) {
this->direction = GetFacingDirection(this, &gPlayerEntity);
LinearMoveUpdate(this);
@ -145,7 +145,7 @@ void sub_0802CEF4(Entity* this) {
this->spriteSettings.shadow = 1;
}
gPlayerState.field_0xa |= 0x80;
gPlayerState.field_0x1a[0] |= 0x80;
gPlayerState.mobility |= 0x80;
}
}

View File

@ -337,7 +337,7 @@ void InitializePlayer(void) {
sub_080784C8();
MemClear(&gUnk_03000B80, sizeof gUnk_03000B80);
MemClear(&gPlayerState, sizeof gPlayerState);
MemFill32(0xffffffff, &gPlayerState.hurtType, sizeof gPlayerState.hurtType);
MemFill32(0xffffffff, &gPlayerState.path_memory, sizeof gPlayerState.path_memory);
MemClear(&gPlayerEntity, sizeof gPlayerEntity);
pl = &gPlayerEntity;

View File

@ -221,11 +221,11 @@ void PlayerUpdate(Entity* this) {
gPlayerState.flags &= ~PL_DRUGGED;
if (CheckDontUpdate(this) == 0) {
if (gPlayerState.flags & PL_TRAPPED) {
if (gPlayerState.flags & PL_MOLDWORM_CAPTURED) {
sub_08077B20();
if (gPlayerState.flags & PL_RELEASED) {
if (gPlayerState.flags & PL_MOLDWORM_RELEASED) {
gPlayerState.queued_action = PLAYER_ROLL;
gPlayerState.flags &= ~PL_TRAPPED;
gPlayerState.flags &= ~PL_MOLDWORM_CAPTURED;
gPlayerState.hurtBlinkSpeed = 240;
COLLISION_ON(this);
} else {
@ -272,8 +272,8 @@ void HandlePlayerLife(Entity* this) {
gPlayerState.framestate_last = gPlayerState.framestate;
gPlayerState.framestate = PL_STATE_IDLE;
if (gPlayerState.hurtType[0x4a] != 0) {
gPlayerState.hurtType[0x4a]--;
if (gPlayerState.field_0x82[0x8] != 0) {
gPlayerState.field_0x82[0x8]--;
return;
}
@ -321,7 +321,7 @@ void HandlePlayerLife(Entity* this) {
#endif
void sub_080171F0(void) {
if (gPlayerState.field_0x1a[0] != 0)
if (gPlayerState.mobility != 0)
ResetPlayer();
if (gPlayerState.field_0x14 != 0)
gPlayerState.field_0x14--;
@ -342,7 +342,7 @@ void sub_080171F0(void) {
gPlayerState.field_0x7 &= ~0x80;
gPlayerState.field_0xa &= 0xf;
gPlayerState.keepFacing &= ~0x80;
gPlayerState.field_0x1a[0] = 0;
gPlayerState.mobility = 0;
gPlayerState.speed_modifier = 0;
gPlayerState.field_0xaa = 0;
MemClear(&gUnk_03003BE0, 0x8c);
@ -359,7 +359,7 @@ void sub_080171F0(void) {
gPlayerState.flags &= ~PL_CLIMBING;
sub_0807A8D8(&gPlayerEntity);
if (gPlayerState.jumpStatus & 0xc0)
if (gPlayerState.jump_status & 0xc0)
gPlayerEntity.iframes = 0xfe;
if (gPlayerEntity.action != PLAYER_ROOMTRANSITION) {

View File

@ -21,7 +21,7 @@ void sub_08075FF8(ItemBehavior* this, u32 arg1) {
s32 x;
s32 y;
if ((gPlayerState.jumpStatus | gPlayerState.field_0x3[1]) == 0) {
if ((gPlayerState.jump_status | gPlayerState.field_0x3[1]) == 0) {
bombCount = 0;
for (entity = FindEntityByID(8, 2, 2); entity != NULL; entity = FindNextDuplicateID(entity, 2)) {
bombCount += 1;

View File

@ -21,7 +21,7 @@ void sub_08075A0C(ItemBehavior* this, u32 arg1) {
u32 itemSlot;
s8* tmp;
itemSlot = IsItemEquipped(this->behaviorID);
if (gPlayerState.heldObject != 0 || gPlayerState.queued_action == PLAYER_ROLL || gPlayerState.jumpStatus != 0 ||
if (gPlayerState.heldObject != 0 || gPlayerState.queued_action == PLAYER_ROLL || gPlayerState.jump_status != 0 ||
gPlayerState.item != NULL || (gPlayerState.flags & PL_MINISH) != 0) {
ForceEquipItem(0xf, itemSlot);
gPlayerState.flags &= ~PL_USE_LANTERN;
@ -50,8 +50,8 @@ ASM_FUNC("asm/non_matching/eu/sub_08075ADC.inc", void sub_08075ADC(ItemBehavior*
void sub_08075ADC(ItemBehavior* this, u32 arg1) {
u32 bVar1;
if (gPlayerState.item != NULL || (this->field_0x5[9] & 1) == 0 || (gPlayerState.flags & 0x110) != 0 ||
sub_08079D48() == 0) {
if (gPlayerState.item != NULL || (this->field_0x5[9] & 1) == 0 ||
(gPlayerState.flags & (PL_DISABLE_ITEMS | PL_CAPTURED)) != 0 || sub_08079D48() == 0) {
this->field_0xf = 0;
this->stateID += 1;
gPlayerState.flags |= PL_USE_LANTERN;
@ -73,9 +73,9 @@ void sub_08075B54(ItemBehavior* this, u32 arg1) {
Entity* object;
s8* tmp;
if ((gPlayerState.flags & 0x110) == 0) {
if ((gPlayerState.flags & (PL_CAPTURED | PL_DISABLE_ITEMS)) == 0) {
itemSlot = IsItemEquipped(this->behaviorID);
if (!(((sub_08077F10(this) == 0) && (itemSlot < 2)) || (gPlayerState.jumpStatus != 0))) {
if (!(((sub_08077F10(this) == 0) && (itemSlot < 2)) || (gPlayerState.jump_status != 0))) {
ForceEquipItem(0xf, itemSlot);
gPlayerState.flags &= ~PL_USE_LANTERN;
sub_08077E78(this, arg1);
@ -85,7 +85,7 @@ void sub_08075B54(ItemBehavior* this, u32 arg1) {
((u16)gPlayerEntity.spriteIndex == 6)) {
tmp = &gUnk_08126EEC[gPlayerEntity.animationState & 6];
if ((gPlayerState.jumpStatus == 0) &&
if ((gPlayerState.jump_status == 0) &&
(sub_080002F0(TILE(gPlayerEntity.x.HALF.HI + tmp[0], gPlayerEntity.y.HALF.HI + tmp[1]),
gPlayerEntity.collisionLayer, 0x40) != 0)) {
this->field_0xf = 0xf;

View File

@ -19,7 +19,7 @@ void ItemMoleMitts(ItemBehavior* this, u32 arg1) {
void sub_08077130(ItemBehavior* this, u32 arg1) {
s32 iVar1;
if (gPlayerState.jumpStatus == 0) {
if (gPlayerState.jump_status == 0) {
sub_08077D38(this, arg1);
gPlayerState.field_0x3c[1] = 1;
this->field_0x5[4] |= 0x80;

View File

@ -52,8 +52,8 @@ void sub_080768F8(ItemBehavior* this, u32 arg1) {
u32 bVar1;
u32 bVar2;
bVar1 = gPlayerState.field_0x1c | gPlayerState.field_0x3[1] | gPlayerState.heldObject | gPlayerState.jumpStatus;
bVar2 = (gPlayerState.flags & 0x1000);
bVar1 = gPlayerState.field_0x1c | gPlayerState.field_0x3[1] | gPlayerState.heldObject | gPlayerState.jump_status;
bVar2 = (gPlayerState.flags & PL_IN_MINECART);
bVar1 |= bVar2;
if (bVar1 == 0) {
gPlayerState.dash_state = 1;

View File

@ -12,16 +12,16 @@ extern void sub_08077F84(void);
}
if (gPlayerState.item == NULL) {
if (gPlayerState.field_0x0[1] == 0) {
if (((u8)(gPlayerState.field_0x1a[1] | gPlayerState.field_0xa | gPlayerState.field_0x3[1] |
if (((u8)(gPlayerState.sword_state | gPlayerState.field_0xa | gPlayerState.field_0x3[1] |
gPlayerState.heldObject | gPlayerState.field_0x1c | gPlayerState.field_0x3c[1]) == 0) &&
((((1 < (u8)(gPlayerState.field_0x10[2] - 0x12) && (gPlayerState.field_0x10[2] != 1)) ||
(gPlayerEntity.z.WORD != 0)) ||
(gPlayerState.field_0x14 != 0)))) {
if ((gPlayerState.jumpStatus != 0) && ((gPlayerState.jumpStatus & 7) != 3))
if ((gPlayerState.jump_status != 0) && ((gPlayerState.jump_status & 7) != 3))
goto _08076710;
if (-1 < gPlayerEntity.z.WORD) {
gPlayerEntity.zVelocity = 0x20000;
gPlayerState.jumpStatus = 1;
gPlayerState.jump_status = 1;
gPlayerState.item = NULL;
this->stateID += 1;
goto _0807673C;
@ -31,7 +31,7 @@ extern void sub_08077F84(void);
if (((gPlayerState.heldObject | gPlayerState.field_0x3[1]) == 0) &&
(((gPlayerState.field_0x10[2] != 0x12 && (gPlayerState.field_0x10[2] != 1)) ||
((gPlayerEntity.z.WORD != 0 || (gPlayerState.field_0x14 != 0)))))) {
if ((gPlayerState.jumpStatus != 0) && ((gPlayerState.jumpStatus & 7) != 3)) {
if ((gPlayerState.jump_status != 0) && ((gPlayerState.jump_status & 7) != 3)) {
_08076710:
sub_08076758(this, arg1);
return;
@ -40,7 +40,7 @@ extern void sub_08077F84(void);
gPlayerState.field_0x0[1] = 0;
this->stateID += 1;
gPlayerState.keepFacing = 0;
gPlayerState.jumpStatus = 1;
gPlayerState.jump_status = 1;
gPlayerState.field_0xe = -1;
gPlayerState.item = NULL;
gPlayerEntity.zVelocity = 0x20000;
@ -61,15 +61,15 @@ void sub_08076758(ItemBehavior* this, u32 arg1) {
s32 iVar1;
gPlayerState.field_0xe = 0;
if ((((gPlayerState.jumpStatus & 0x28) == 0) && (gPlayerState.jumpStatus != 0)) &&
((gPlayerState.jumpStatus & 7) != 3)) {
if ((((gPlayerState.jump_status & 0x28) == 0) && (gPlayerState.jump_status != 0)) &&
((gPlayerState.jump_status & 7) != 3)) {
if (sub_08077EFC(this)) {
if (this->stateID < 2) {
if ((gPlayerEntity.zVelocity < 1) && ((gPlayerState.jumpStatus & 0x10) == 0)) {
if ((gPlayerEntity.zVelocity < 1) && ((gPlayerState.jump_status & 0x10) == 0)) {
this->stateID = 2;
gPlayerEntity.field_0x7a.HWORD = 2;
gPlayerEntity.zVelocity = 0x20000;
gPlayerState.jumpStatus |= 0x10;
gPlayerState.jump_status |= 0x10;
gPlayerState.animation = 0x288;
SoundReq(SFX_172);
}
@ -79,7 +79,7 @@ void sub_08076758(ItemBehavior* this, u32 arg1) {
} else {
if (this->stateID > 1) {
gPlayerEntity.field_0x7a.HWORD += 1;
gPlayerState.jumpStatus &= 0xef;
gPlayerState.jump_status &= 0xef;
}
}
} else {

View File

@ -25,9 +25,9 @@ ASM_FUNC("asm/non_matching/itemSword/sub_08075338.inc", void sub_08075338(ItemBe
ASM_FUNC("asm/non_matching/itemSword/sub_080754B8.inc", void sub_080754B8(ItemBehavior* this, u32 arg1))
void sub_08075580(ItemBehavior* this, u32 arg1) {
if ((sub_08077EFC(this) != 0) && (gPlayerState.jumpStatus == 0)) {
if ((sub_08077EFC(this) != 0) && (gPlayerState.jump_status == 0)) {
gPlayerState.field_0xa = gPlayerState.field_0xa & ~(8 >> arg1);
gPlayerState.field_0x1a[1] = 1;
gPlayerState.sword_state = 1;
gPlayerState.item->hurtType = 0xd;
this->field_0xf = 0;
this->stateID = 2;
@ -46,11 +46,11 @@ void sub_08075580(ItemBehavior* this, u32 arg1) {
void sub_080755F0(ItemBehavior* this, u32 arg1) {
if (sub_08077EFC(this) != 0) {
if (sub_08077EC8(this) == 0) {
if ((gPlayerState.field_0x1a[1] | gPlayerState.field_0x3[1]) != 0) {
if ((gPlayerState.sword_state | gPlayerState.field_0x3[1]) != 0) {
if (--this->field_0x5[2] == 0) {
this->stateID = 3;
this->field_0x5[4] |= 0x80;
gPlayerState.field_0x1a[1] = gPlayerState.field_0x1a[1] | 0x20;
gPlayerState.sword_state = gPlayerState.sword_state | 0x20;
}
} else {
sub_080759B8(this, arg1);
@ -62,10 +62,10 @@ void sub_080755F0(ItemBehavior* this, u32 arg1) {
}
void sub_0807564C(ItemBehavior* this, u32 arg1) {
if ((gPlayerState.field_0x1a[1] | gPlayerState.field_0x3[1]) == 0) {
if ((gPlayerState.sword_state | gPlayerState.field_0x3[1]) == 0) {
sub_080759B8(this, arg1);
} else {
if ((sub_08077EC8(this) == 0) && ((sub_08077EFC(this) == 0 || ((gPlayerState.field_0x1a[1] & 0x80) != 0)))) {
if ((sub_08077EC8(this) == 0) && ((sub_08077EFC(this) == 0 || ((gPlayerState.sword_state & 0x80) != 0)))) {
sub_08075694(this, arg1);
}
}
@ -85,8 +85,8 @@ void sub_08075694(ItemBehavior* this, u32 arg1) {
this->stateID = 4;
this->field_0xf = 6;
gPlayerEntity.hurtType = 0x1e;
gPlayerState.field_0x1a[1] |= 0x40;
gPlayerState.field_0x1a[1] &= 0xdf;
gPlayerState.sword_state |= 0x40;
gPlayerState.sword_state &= 0xdf;
if ((gPlayerState.field_0xa0[0] == 0x04) && ((gPlayerState.flags & PL_CLONING) == 0)) {
gPlayerState.field_0xa0[0] = 0x01;
DeleteClones();
@ -109,12 +109,12 @@ void sub_080758B0(ItemBehavior* this, u32 arg1) {
UpdateItemAnim(this);
if ((this->field_0x5[9] & 0x80) != 0) {
this->field_0xf = 0;
if ((gPlayerState.field_0x1a[1] & 0x20) != 0) {
if ((gPlayerState.sword_state & 0x20) != 0) {
this->stateID = 3;
} else {
this->stateID = 5;
}
gPlayerState.field_0x1a[1] &= 0xf7;
gPlayerState.sword_state &= 0xf7;
}
}
}
@ -126,7 +126,7 @@ void sub_080759B8(ItemBehavior* this, u32 arg1) {
gPlayerEntity.hurtType = 0;
}
gPlayerState.flags &= ~PL_SWORD_THRUST;
gPlayerState.field_0x1a[1] = 0;
gPlayerState.sword_state = 0;
gPlayerState.item = NULL;
sub_08077E78(this, arg1);
}

View File

@ -46,7 +46,7 @@ void Manager3_Main(Manager3* this) {
gArea.field_0x18 = 1;
gArea.curPortalType = 5;
} else {
if ((gPlayerState.flags & 0x20) && gPlayerState.jumpStatus == 0) {
if ((gPlayerState.flags & PL_USE_PORTAL) && gPlayerState.jump_status == 0) {
gArea.field_0x18 = 2;
} else {
if (sub_08057810()) {

View File

@ -116,11 +116,12 @@ static u32 PlayerStateValid(ManagerA* this) {
static void sub_08058514(ManagerA* this) {
switch (this->manager.unk_0d) {
case 1:
if (gPlayerState.flags & (PL_BUSY | PL_DROWNING | PL_USE_PORTAL | PL_FALLING | 0x1010))
if (gPlayerState.flags &
(PL_BUSY | PL_DROWNING | PL_USE_PORTAL | PL_FALLING | PL_IN_MINECART | PL_CAPTURED))
return;
if (gPlayerEntity.z.HALF.HI != 0)
return;
gPlayerState.jumpStatus = 0;
gPlayerState.jump_status = 0;
CreateEzloHint(this->msg_idx, this->msg_height);
this->manager.unk_0d++;
this->manager.unk_0e = 30;

View File

@ -359,7 +359,7 @@ void sub_0805938C(ManagerF* this) {
}
u32 sub_080593CC(ManagerF* this) {
if (!(gPlayerState.flags & PL_MINISH) && gPlayerState.swimState != 0 && gPlayerEntity.animationState == 0 &&
if (!(gPlayerState.flags & PL_MINISH) && gPlayerState.swim_state != 0 && gPlayerEntity.animationState == 0 &&
(gPlayerState.field_0x90 & 0xF00) == 0x400) {
return sub_0806FCB8(&gPlayerEntity, this->unk_38, this->unk_3a + 0xC, 6);
}

View File

@ -88,7 +88,7 @@ void NPC5(Entity* this) {
void sub_08060A00(Entity* this) {
u32 tmp;
if ((gPlayerState.jumpStatus & 0x80) != 0) {
if ((gPlayerState.jump_status & 0x80) != 0) {
if (this->action != 0) {
if (((((UnkHeap*)this->myHeap)->unk_0) & 4) == 0) {
((UnkHeap*)this->myHeap)->unk_0 |= 4;

View File

@ -19,7 +19,7 @@ extern Hitbox gHitbox_0;
void PicolyteBottle(Entity* this) {
gUnk_081142BC[this->action](this);
if (this->type == 0) {
gPlayerState.field_0x1a[0] |= 0x80;
gPlayerState.mobility |= 0x80;
}
}

View File

@ -147,7 +147,7 @@ Entity* sub_08081D74(Entity* this) {
}
ent = 0;
if (sub_08081E0C(this)) {
if (!(gPlayerState.flags & 0x10) && !(gPlayerState.flags & PL_MINISH)) {
if ((gPlayerState.flags & PL_CAPTURED) == 0 && (gPlayerState.flags & PL_MINISH) == 0) {
ent = &gPlayerEntity;
}
} else {

View File

@ -168,7 +168,7 @@ void sub_0808692C(Entity* this) {
static u8 sub_08086954(Entity* this) {
if (sub_0800445C(this)) {
if (sub_0806ED9C(this, 6, 20) >= 0 && gPlayerEntity.animationState == 0 &&
(u16)gPlayerState.field_0x90 == 0x400 && gPlayerState.jumpStatus == 0) {
(u16)gPlayerState.field_0x90 == 0x400 && gPlayerState.jump_status == 0) {
this->actionDelay--;
}
} else {

View File

@ -269,9 +269,9 @@ void sub_080812A8(Entity* this) {
void sub_080812E8(Entity* this) {
PlayerState* playerState = &gPlayerState;
#ifdef EU
if ((playerState->swimState & 0x80) && sub_080177A0(this, &gPlayerEntity)) {
if ((playerState->swim_state & 0x80) && sub_080177A0(this, &gPlayerEntity)) {
#else
if ((playerState->swimState & 0x80) && (playerState->flags & PL_MINISH) == 0 &&
if ((playerState->swim_state & 0x80) && (playerState->flags & PL_MINISH) == 0 &&
sub_080177A0(this, &gPlayerEntity)) {
#endif
sub_080810FC(this);

View File

@ -108,7 +108,7 @@ void sub_0808C01C(Entity* this, u32 r1) {
type = 2;
gArea.curPortalType = type;
if (r1 == 1) {
if ((gPlayerState.flags & PL_USE_PORTAL) && (gPlayerState.jumpStatus == 0)) {
if ((gPlayerState.flags & PL_USE_PORTAL) && (gPlayerState.jump_status == 0)) {
gArea.field_0x18 = 2;
} else {
if (sub_08057810() != 0) {

View File

@ -23,7 +23,7 @@ void sub_080916EC(Entity* this) {
struct_030010EC* unk = &gScreenTransition.minecart_data[this->actionDelay];
*(struct_030010EC**)&this->cutsceneBeh.HWORD = unk;
if ((gRoomControls.roomID != unk->field_0x4) || (gPlayerState.flags & 0x1000) != 0) {
if ((gRoomControls.roomID != unk->field_0x4) || (gPlayerState.flags & PL_IN_MINECART) != 0) {
DeleteThisEntity();
}
this->x.HALF.HI = gRoomControls.roomOriginX + ((unk->field_0x0 & 0x3f) << 4) + 8;
@ -53,7 +53,7 @@ void sub_080917DC(Entity* this) {
} else {
if (sub_0800445C(this) != 0) {
if (!((gPlayerState.flags & (PL_MINISH | PL_ROLLING)) || gPlayerState.field_0x1c ||
gPlayerState.heldObject || gPlayerState.jumpStatus)) {
gPlayerState.heldObject || gPlayerState.jump_status)) {
this->actionDelay++;
} else {
this->actionDelay = 0;
@ -64,8 +64,8 @@ void sub_080917DC(Entity* this) {
if (this->type2 == 0) {
if (this->actionDelay > 8) {
this->action++;
gPlayerState.jumpStatus = 0x81;
gPlayerState.flags |= PL_MINECART;
gPlayerState.jump_status = 0x81;
gPlayerState.flags |= PL_ENTER_MINECART;
gPlayerEntity.zVelocity = 0x20000;
gPlayerEntity.speed = 0x100;
gPlayerEntity.flags &= ~PL_MINISH;
@ -88,7 +88,7 @@ void sub_080918A4(Entity* this) {
return;
}
gPlayerEntity.animationState = this->animationState << 1;
gPlayerState.flags = (gPlayerState.flags ^ PL_MINECART) | 0x1000;
gPlayerState.flags = (gPlayerState.flags ^ PL_ENTER_MINECART) | PL_IN_MINECART;
this->action++;
this->field_0xf = 1;
this->flags |= ENT_20;
@ -114,7 +114,7 @@ void sub_080919AC(Entity* this) {
u32 uVar3;
gRoomControls.unk5 = 7;
if ((gPlayerState.flags & 0x1000) == 0) {
if ((gPlayerState.flags & PL_IN_MINECART) == 0) {
this->action = 1;
return;
}
@ -159,8 +159,8 @@ void sub_080919AC(Entity* this) {
this->flags2 = 0x80;
this->action = 6;
sub_08017744(this);
gPlayerState.jumpStatus = 0x41;
gPlayerState.flags = (gPlayerState.flags ^ 0x1000) | PL_MINECART;
gPlayerState.jump_status = 0x41;
gPlayerState.flags = (gPlayerState.flags ^ PL_IN_MINECART) | PL_ENTER_MINECART;
gPlayerEntity.zVelocity = 0x20000;
gPlayerEntity.speed = 0x200;
gPlayerEntity.animationState = this->animationState << 1;

View File

@ -32,7 +32,7 @@ Entity* sub_080A276C(Entity* parent, u32 type, u32 type2) {
e->field_0x6c.HALF.LO = gPlayerState.keepFacing;
e->field_0x6c.HALF.HI = gPlayerState.field_0xa;
e->field_0x6e.HALF.LO = gPlayerState.field_0x27[0];
e->field_0x6e.HALF.HI = gPlayerState.field_0x1a[0];
e->field_0x6e.HALF.HI = gPlayerState.mobility;
e->field_0x70.WORD = gPlayerState.flags;
e->field_0x74.HALF.LO = gPlayerState.field_0x82[8];
gPlayerEntity.flags &= ~ENT_COLLIDE;

View File

@ -18,14 +18,23 @@
#define GRAVITY_RATE 0x2000
#define SLOPE_SPEED_MODIFIER 0x50
#define WALK_SPEED 0x140
#define ROLL_SPEED 0x200
#define SHIELDING_SPEED 0xC0
#define GUST_JAR_SPEED 0x80
#define SWORD_CHARGE_SPEED 0xE0
#define BURNING_SPEED 0x300
#define JUMP_SPEED_FWD 0x100
/* Jumping out of a hole */
#define JUMP_SPEED_HOLE_FWD 0x78
#define JUMP_SPEED_HOLE_Z 0x1a000
/* Bouncing off a wall */
#define BOUNCE_SPEED_FWD 0x100
#define BOUNCE_SPEED_Z 0x20000
#define HOLE_SPEED_FWD 0x78
#define HOLE_SPEED_Z 0x1a000
#define PULL_SPEED 0x80
#define PUSH_SPEED 0x80
#define ROLL_SPEED 0x200
#define PIT_DAMAGE 0x2
@ -232,14 +241,15 @@ static EntityAction sub_0807518C;
static EntityAction sub_080751B4;
static void sub_080717F8(Entity*);
static void ResetPlayerPriority();
static void BreakOut(Entity* this);
static void reset_priority();
static void break_out(Entity* this);
static void sub_08073AD4(Entity* this);
static void sub_08073B60(Entity*);
static void sub_08074244(Entity*, u32, u32);
static void hide(Entity*);
static void sub_08074BF8(Entity*);
static void conveyer_push(Entity*);
static void sub_08074D34(Entity*, ScriptExecutionContext*);
static void sub_08070BEC(Entity*, u32);
// exports
void SurfaceAction_Water(Entity*);
@ -257,7 +267,7 @@ extern void sub_08079708();
extern void sub_080792D8();
extern Entity* CreatePlayerBomb();
extern u32 sub_0806F854();
extern u32 sub_08019840();
extern u32 UpdatePlayerCollision();
extern void sub_08079744();
extern void sub_0807AE20();
extern u32 sub_0807A894();
@ -276,7 +286,7 @@ extern void DoJump(Entity*);
extern void SetZeldaFollowTarget(Entity*);
u32 ItemIsSword(u32 item);
extern u32 sub_0807A2B8();
extern u32 sub_08079550(u32);
extern u32 sub_08079550();
extern u32 sub_080782C0();
extern u32 sub_080793E4(u32);
extern void sub_08008AC6(Entity*);
@ -285,6 +295,20 @@ extern void sub_08077AEC();
extern u32 RunQueuedAction();
extern void UpdatePlayerSkills();
void sub_08077698(Entity*);
u32 sub_080782C0(void);
u32 UpdatePlayerCollision(void);
void sub_080797EC(void);
u32 sub_0807AC54(Entity*);
void sub_080792D8(void);
u32 sub_08078F74(Entity*);
void DoJump(Entity*);
void sub_08008926(Entity*);
void UpdatePlayerMovement(void);
void CreateWaterTrace(Entity*);
void sub_08008AC6(Entity*);
void sub_08008AA0(Entity*);
extern ScreenTransitionData gUnk_0813AB58;
extern ScreenTransitionData gUnk_0813AD88[];
extern u8 gUnk_080082DC[];
@ -365,9 +389,9 @@ static void PlayerInit(Entity* this) {
if (RunQueuedAction() == 0) {
sub_0807921C();
UpdateFloorType();
if (gPlayerState.swimState != 0) {
if (gPlayerState.swim_state != 0) {
Entity* ent;
gPlayerState.swimState = 1;
gPlayerState.swim_state = 1;
ResolvePlayerAnimation();
gPlayerState.framestate = PL_STATE_SWIM;
sub_0807ACCC(this);
@ -379,8 +403,183 @@ static void PlayerInit(Entity* this) {
}
}
// PlayerState.flags need to be 100% before this one can reasonably be done
static ASM_FUNC("asm/non_matching/player/PlayerNormal.inc", void PlayerNormal(Entity* this));
static void PlayerNormal(Entity* this) {
gPlayerState.framestate = PL_STATE_IDLE;
if (gPlayerState.flags & PL_CAPTURED) {
this->spritePriority.b1 = 0;
this->knockbackDuration = 0;
this->speed = WALK_SPEED;
gPlayerState.pushedObject = 0x80;
gPlayerState.framestate = PL_STATE_TRAPPED;
if ((this->animationState >> 1) + 92 == this->animIndex && (u16)this->spriteIndex == 2)
UpdateAnimationSingleFrame(&gPlayerEntity);
else
gPlayerState.animation = 604;
sub_0806F948(&gPlayerEntity);
ResetPlayer();
sub_08077698(this);
return;
}
if (gPlayerState.flags & PL_IN_MINECART) {
u32 x;
this->hurtType = 30;
gPlayerState.framestate = PL_STATE_C;
sub_08070BEC(this, this->speed == 0 ? 1 : 0);
return;
}
if (gPlayerState.flags & PL_MOLDWORM_CAPTURED) {
ResolvePlayerAnimation();
return;
}
sub_080085B0(this);
this->hurtType = 0;
if (RunQueuedAction()) {
return;
}
if (!gPlayerState.swim_state && (gPlayerState.jump_status & 0xC0) == 0) {
if (gPlayerState.field_0x3[0] || gPlayerState.field_0x1f[2]) {
this->speed = SHIELDING_SPEED;
} else {
if (gPlayerState.sword_state) {
this->speed = SWORD_CHARGE_SPEED;
} else if (gPlayerState.field_0x1c) {
this->speed = GUST_JAR_SPEED;
} else {
this->speed = WALK_SPEED;
}
}
}
gPlayerState.pushedObject |= 0x80;
if ((gPlayerState.flags & (PL_USE_OCARINA | 2)) == 0) {
UpdateFloorType();
}
if (RunQueuedAction()) {
return;
}
if (gPlayerState.jump_status == 0 && (gPlayerState.flags & PL_BURNING) == 0) {
if (this->knockbackDuration == 0 && sub_080782C0()) {
if (gRoomVars.shopItemType == 0) {
ResetPlayer();
}
if ((gPlayerState.flags & (PL_USE_OCARINA | 2)) == 0) {
UpdateFloorType();
RunQueuedAction();
}
return;
}
if (((gPlayerState.flags &
(PL_BUSY | PL_DROWNING | PL_USE_PORTAL | 0x10 | PL_FALLING | PL_BURNING | 0x1000 | PL_ROLLING)) |
gPlayerState.field_0xaa) == 0) {
switch (UpdatePlayerCollision()) {
case 0:
gPlayerState.pushedObject ^= 0x80;
break;
case 3:
gPlayerState.pushedObject = 0x80;
break;
case 15:
this->flags &= ~ENT_COLLIDE;
sub_080797EC();
return;
case 4:
gPlayerState.pushedObject ^= 0x80;
sub_080797EC();
return;
case 1:
case 2:
case 5 ... 14:
default:
return;
}
}
}
this->field_0x3c = 0;
this->spritePriority.b0 = 4;
if (sub_0807AC54(this)) {
return;
}
sub_08077698(this);
if (RunQueuedAction())
return;
sub_080792D8();
if ((gPlayerState.jump_status | gPlayerState.field_0xa) == 0 && (sub_08079550() || sub_08078F74(this))) {
return;
}
DoJump(this);
if (RunQueuedAction())
return;
if (gPlayerState.jump_status) {
gPlayerState.framestate = PL_STATE_CAPE;
if ((gPlayerState.jump_status & 0xC0) == 0) {
if ((gPlayerState.jump_status & 7) != 3 && (gPlayerState.jump_status & 0x20) == 0) {
this->speed = gPlayerState.jump_status & 0x20;
sub_08008926(this);
} else {
this->direction = 0xff;
}
}
UpdatePlayerMovement();
if ((this->frame & 2) == 0 && !gPlayerState.field_0x3[1])
UpdateAnimationSingleFrame(this);
return;
}
if (this->knockbackDuration == 0) {
u32 v13;
if (gPlayerState.swim_state) {
gPlayerState.framestate = PL_STATE_SWIM;
sub_0807ACCC(this);
} else {
if ((gPlayerState.flags & 0x2000000) == 0)
this->spritePriority.b1 = 1;
if (gPlayerState.dash_state & 0x40) {
sub_08008AA0(this);
} else {
if (gPlayerState.floor_type == SURFACE_ICE) {
sub_08008926(this);
} else if (gPlayerState.floor_type == SURFACE_PIT) {
ResetPlayerVelocity();
} else {
sub_08008AA0(this);
}
}
if ((gPlayerState.sword_state & 0x10) == 0) {
this->direction = gPlayerState.field_0xd;
if (gPlayerState.flags & PL_BURNING) {
this->speed = BURNING_SPEED;
if ((gPlayerState.field_0xd & 0x80) != 0)
this->direction = 4 * (this->animationState & 0xE);
DeleteClones();
}
}
}
v13 = 0;
if ((((gPlayerState.field_0x7 | this->direction) & 0x80) | gPlayerState.field_0xa) == 0 &&
(gPlayerState.field_0x7 & 0x10) == 0) {
v13 = 1;
if (this->knockbackDuration == 0 &&
((gPlayerState.dash_state & 0x40) || gPlayerState.floor_type != SURFACE_ICE))
v13 = 3;
}
sub_08070BEC(this, v13);
sub_08008AC6(this);
if (this->knockbackDuration == 0 && gPlayerState.keepFacing == 0 && gPlayerState.floor_type != SURFACE_LADDER)
sub_0806F948(this);
} else {
if (gPlayerState.item == NULL)
UpdateAnimationSingleFrame(this);
if (gPlayerState.swim_state != 0 && (gScreenTransition.frameCount & 7) == 0)
CreateWaterTrace(this);
return;
}
}
static void sub_08070BEC(Entity* this, u32 r0) {
if (r0 & 1)
@ -411,7 +610,7 @@ static void PlayerFallInit(Entity* this) {
gPlayerState.flags |= PL_BUSY | PL_DROWNING;
gPlayerState.flags &= ~PL_BURNING;
gPlayerState.jumpStatus = 0;
gPlayerState.jump_status = 0;
if (gPlayerState.flags & PL_MINISH)
gPlayerState.animation = 0x1ba;
@ -472,7 +671,7 @@ static void PlayerBounceInit(Entity* this) {
this->zVelocity = (BOUNCE_SPEED_Z * 3) / 4;
}
gPlayerState.jumpStatus = 0x80;
gPlayerState.jump_status = 0x80;
SoundReq(SFX_14C);
ResetPlayer();
ResetPlayerVelocity();
@ -488,13 +687,13 @@ static NONMATCH("asm/non_matching/player/sub_08070DC4.inc", void PlayerBounceUpd
if (RunQueuedAction() || GravityUpdate(this, GRAVITY_RATE))
return;
gPlayerState.jumpStatus = 0;
gPlayerState.jump_status = 0;
if (RunQueuedAction() || sub_08079D48())
return;
if (gPlayerState.swimState != 0) {
gPlayerState.jumpStatus = 0;
if (gPlayerState.swim_state != 0) {
gPlayerState.jump_status = 0;
ResetPlayerAnimationAndAction();
return;
}
@ -524,7 +723,7 @@ END_NONMATCH
static void sub_08070E7C(Entity* this) {
if (--this->actionDelay == 0) {
gPlayerState.jumpStatus = 0;
gPlayerState.jump_status = 0;
ResetPlayerAnimationAndAction();
}
}
@ -593,7 +792,7 @@ static void PlayerItemGetInit(Entity* this) {
this->animationState = IdleSouth;
gPlayerState.flags |= PL_BUSY;
gPlayerState.jumpStatus = 0;
gPlayerState.jump_status = 0;
if ((gPlayerState.flags & PL_MINISH) == 0) {
u32 anim;
@ -634,7 +833,7 @@ static void sub_08071038(Entity* this) {
this->child = NULL;
this->knockbackDuration = 0;
this->iframes = 248;
gPlayerState.jumpStatus = 0;
gPlayerState.jump_status = 0;
ResetPlayerAnimationAndAction();
}
}
@ -660,7 +859,7 @@ static void PlayerJumpInit(Entity* this) {
gPlayerState.queued_action = 0;
if ((gPlayerState.heldObject | gPlayerState.field_0x1a[1]) == 0) {
if ((gPlayerState.heldObject | gPlayerState.sword_state) == 0) {
if ((gPlayerState.flags & PL_MINISH) == 0) {
ResetPlayer();
if (gPlayerState.flags & PL_NO_CAP) {
@ -685,10 +884,10 @@ static void PlayerJumpInit(Entity* this) {
}
static void sub_08071130(Entity* this) {
if (RunQueuedAction(this))
if (RunQueuedAction())
return;
if (gPlayerState.field_0x1a[1] == 0) {
if (gPlayerState.sword_state == 0) {
UpdateAnimationSingleFrame(this);
if (this->frame & 1)
@ -700,7 +899,7 @@ static void sub_08071130(Entity* this) {
if (GravityUpdate(this, GRAVITY_RATE))
return;
gPlayerState.jumpStatus = 0;
gPlayerState.jump_status = 0;
ResetCollisionLayer(this);
if (*(Entity**)&this->field_0x74 != NULL)
@ -716,8 +915,8 @@ static void sub_08071130(Entity* this) {
if (RunQueuedAction())
return;
if ((sub_08079D48() == 0) || (gPlayerState.swimState != 0)) {
gPlayerState.jumpStatus = 0;
if ((sub_08079D48() == 0) || (gPlayerState.swim_state != 0)) {
gPlayerState.jump_status = 0;
ResetPlayerAnimationAndAction();
return;
}
@ -747,7 +946,7 @@ static void sub_08071208(Entity* this) {
}
if (--this->actionDelay == 0xff) {
gPlayerState.jumpStatus = 0;
gPlayerState.jump_status = 0;
ResetPlayerAnimationAndAction();
}
}
@ -810,7 +1009,7 @@ static void sub_080712F0(Entity* this) {
this->iframes = 32;
this->spritePriority.b1 = 1;
this->spriteSettings.draw = FALSE;
gPlayerState.flags &= ~0x4;
gPlayerState.flags &= ~PL_DROWNING;
RespawnPlayer();
}
@ -862,7 +1061,7 @@ static void PortalJumpOnUpdate(Entity* this) {
DoJump(this);
UpdateAnimationSingleFrame(this);
if (gPlayerState.jumpStatus == 0) {
if (gPlayerState.jump_status == 0) {
gPlayerState.flags |= PL_USE_PORTAL;
this->subAction = 1;
this->animationState = IdleSouth;
@ -1022,7 +1221,7 @@ static void PlayerTalkEzlo(Entity* this) {
if (RunQueuedAction()) {
MessageClose();
ResetPlayerPriority();
reset_priority();
} else {
gPlayerState.framestate = PL_STATE_TALKEZLO;
COLLISION_OFF(this);
@ -1044,7 +1243,7 @@ static void PlayerTalkEzloInit(Entity* this) {
return;
}
if (gPlayerState.jumpStatus == 0) {
if (gPlayerState.jump_status == 0) {
this->subAction++;
if (this->animationState == IdleEast)
@ -1057,7 +1256,7 @@ static void PlayerTalkEzloInit(Entity* this) {
}
if (!GravityUpdate(this, GRAVITY_RATE))
gPlayerState.jumpStatus = 0;
gPlayerState.jump_status = 0;
}
static void sub_0807193C(Entity* this) {
@ -1089,7 +1288,7 @@ static void sub_08071990(Entity* this) {
else
gPlayerState.animation = 0x3c9;
} else {
ResetPlayerPriority();
reset_priority();
sub_08079258();
}
return;
@ -1120,12 +1319,12 @@ static void sub_08071990(Entity* this) {
static void sub_08071A4C(Entity* this) {
UpdateAnimationSingleFrame(this);
if (this->frame & 0x80) {
ResetPlayerPriority();
reset_priority();
sub_0807921C();
}
}
static void ResetPlayerPriority(void) {
static void reset_priority(void) {
gPriorityHandler.sys_priority = PRIO_MIN;
gPlayerEntity.updatePriority = gPlayerEntity.updatePriorityPrev;
}
@ -1231,7 +1430,7 @@ static void PlayerMinishDie(Entity* this) {
static void PlayerMinishDieInit(Entity* this) {
u32 temp;
if (gPlayerState.flags & (0x10 | 0x100))
if (gPlayerState.flags & (PL_CAPTURED | PL_DISABLE_ITEMS))
return;
if (GravityUpdate(this, GRAVITY_RATE)) {
@ -1252,16 +1451,17 @@ static void PlayerMinishDieInit(Entity* this) {
}
temp = 0xc1a;
} else {
temp = (gPlayerState.flags & 8) ? 0x459 : 0x1bc;
temp = (gPlayerState.flags & PL_NO_CAP) ? 0x459 : 0x1bc;
}
gPlayerState.animation = temp;
gPlayerState.flags &= ~(PL_PARACHUTE | PL_RELEASED | PL_ROLLING | PL_FROZEN | PL_BURNING | 0x100 | PL_BUSY);
gPlayerState.flags &=
~(PL_PARACHUTE | PL_MOLDWORM_RELEASED | PL_ROLLING | PL_FROZEN | PL_BURNING | 0x100 | PL_BUSY);
this->subAction = 1;
this->animationState = IdleSouth;
this->spritePriority.b1 = 1;
this->spriteSettings.draw = 3;
gPlayerState.jumpStatus = 0;
gPlayerState.jump_status = 0;
gPlayerState.pushedObject = 0;
sub_0800451C(this);
ResetPlayer();
@ -1307,8 +1507,8 @@ static void sub_08071D04(Entity* this) {
this->direction = 0xff;
this->speed = 0;
this->zVelocity = 0x18000;
gPlayerState.jumpStatus = 1;
gPlayerState.swimState = 0;
gPlayerState.jump_status = 1;
gPlayerState.swim_state = 0;
return;
}
@ -1319,8 +1519,8 @@ static void sub_08071D80(Entity* this) {
UpdateAnimationSingleFrame(this);
gPlayerState.field_0x14 = 1;
DoJump(this);
if ((gPlayerState.jumpStatus & 7) == 3) {
gPlayerState.jumpStatus = 0;
if ((gPlayerState.jump_status & 7) == 3) {
gPlayerState.jump_status = 0;
this->iframes = 226;
ResetPlayerEventPriority();
ResetPlayerAnimationAndAction();
@ -1447,10 +1647,10 @@ static void PlayerFrozenInit(Entity* this) {
static void PlayerFrozenUpdate(Entity* this) {
if (GravityUpdate(this, GRAVITY_RATE) == 0) {
UpdateSpriteForCollisionLayer(this);
gPlayerState.jumpStatus = 0;
gPlayerState.jump_status = 0;
if (gPlayerState.field_0x14 == 0) {
if (sub_08079D48() == 0) {
BreakOut(this);
break_out(this);
return;
}
}
@ -1470,10 +1670,10 @@ static void PlayerFrozenUpdate(Entity* this) {
}
}
}
BreakOut(this);
break_out(this);
}
static void BreakOut(Entity* this) {
static void break_out(Entity* this) {
this->iframes = 160;
this->knockbackDuration = 0;
COLLISION_ON(this);
@ -1556,7 +1756,7 @@ static void sub_08072168(Entity* this) {
UpdatePlayerMovement();
}
gPlayerState.field_0xd = this->direction;
sub_08019840();
UpdatePlayerCollision();
if (--this->actionDelay == 0xff) {
this->knockbackDuration = 0;
COLLISION_ON(this);
@ -1718,7 +1918,7 @@ static void sub_080724DC(Entity* this) {
this->knockbackDuration = 0;
DeleteClones();
if (sub_080002B8(this) != 0x29) {
if ((gPlayerState.field_0x82[7] == 0) && (gPlayerState.swimState != 0)) {
if ((gPlayerState.field_0x82[7] == 0) && (gPlayerState.swim_state != 0)) {
sub_0807AE20(this);
}
if (gRoomControls.unk2 == 0) {
@ -1760,7 +1960,7 @@ static void sub_0807258C(Entity* this) {
PlayerWaitForScroll(this);
}
}
if ((gPlayerState.field_0x82[7] == 0) && (gPlayerState.swimState != 0)) {
if ((gPlayerState.field_0x82[7] == 0) && (gPlayerState.swim_state != 0)) {
sub_0807AE20(this);
}
}
@ -1778,7 +1978,7 @@ static void PlayerRoll(Entity* this) {
static void PlayerRollInit(Entity* this) {
u32 temp;
if ((gPlayerState.flags & PL_RELEASED) == 0) {
if ((gPlayerState.flags & PL_MOLDWORM_RELEASED) == 0) {
sub_0806F948(&gPlayerEntity);
this->direction = Direction8FromAnimationState(this->animationState);
}
@ -1807,8 +2007,8 @@ static void PlayerRollInit(Entity* this) {
}
static void PlayerRollUpdate(Entity* this) {
if (((gPlayerState.flags & (PL_ROLLING | PL_TRAPPED)) != PL_ROLLING) ||
((gPlayerState.flags & PL_RELEASED) == 0 && (this->iframes != 0) && (this->bitfield & 0x80))) {
if (((gPlayerState.flags & (PL_ROLLING | PL_MOLDWORM_CAPTURED)) != PL_ROLLING) ||
((gPlayerState.flags & PL_MOLDWORM_RELEASED) == 0 && (this->iframes != 0) && (this->bitfield & 0x80))) {
gPlayerState.flags &= ~PL_ROLLING;
if (RunQueuedAction())
return;
@ -1830,7 +2030,7 @@ static void PlayerRollUpdate(Entity* this) {
return;
}
if (gPlayerState.flags & PL_TRAPPED) {
if (gPlayerState.flags & PL_MOLDWORM_CAPTURED) {
gPlayerState.flags &= ~PL_ROLLING;
return;
}
@ -1839,7 +2039,7 @@ static void PlayerRollUpdate(Entity* this) {
return;
}
if (gPlayerState.flags & (PL_FALLING | PL_HIDDEN | 0x10)) {
if (gPlayerState.flags & (PL_FALLING | PL_HIDDEN | PL_CAPTURED)) {
gPlayerState.flags &= ~PL_ROLLING;
PlayerWaitForScroll(this);
return;
@ -1879,7 +2079,7 @@ static void PlayerRollUpdate(Entity* this) {
ResetPlayerAnimationAndAction();
}
if (this->frame & 0x80) {
gPlayerState.flags &= ~(PL_RELEASED | PL_ROLLING);
gPlayerState.flags &= ~(PL_MOLDWORM_RELEASED | PL_ROLLING);
}
UpdateAnimationSingleFrame(this);
}
@ -1891,7 +2091,7 @@ static void PlayerWaitForScroll(Entity* this) {
else
ResetPlayerVelocity();
if (gPlayerState.swimState != 0)
if (gPlayerState.swim_state != 0)
this->speed = 0;
if ((gPlayerState.flags & PL_HIDDEN) == 0)
gPlayerEntity.spriteSettings.draw = 3;
@ -1969,11 +2169,11 @@ static void sub_08072ACC(Entity* this) {
} else if (this->field_0xf > 7) {
COLLISION_ON(this);
this->direction = gPlayerState.field_0xd;
this->zVelocity = HOLE_SPEED_Z;
this->speed = HOLE_SPEED_FWD;
this->zVelocity = JUMP_SPEED_HOLE_Z;
this->speed = JUMP_SPEED_HOLE_FWD;
this->spritePriority.b0 = 4;
this->spritePriority.b1 = 1;
gPlayerState.jumpStatus = 0x41;
gPlayerState.jump_status = 0x41;
sub_0807921C();
sub_0807BA8C(COORD_TO_TILE(this), this->collisionLayer);
} else {
@ -2001,7 +2201,7 @@ static void sub_08072B5C(Entity* this) {
this->speed = 0x40;
this->zVelocity = 0x39000;
this->z.WORD--;
gPlayerState.jumpStatus = 0x41;
gPlayerState.jump_status = 0x41;
sub_0806F854(this, 0, -12);
sub_0807921C();
return;
@ -2163,7 +2363,7 @@ static NONMATCH("asm/non_matching/player/sub_08072D54.inc", void sub_08072D54(En
}
}
} else {
if ((gPlayerState.flags & 8)) {
if ((gPlayerState.flags & PL_NO_CAP)) {
gPlayerState.animation = 0x424;
} else {
gPlayerState.animation = 0x820;
@ -2270,7 +2470,7 @@ static void sub_08073094(Entity* this) {
this->spritePriority.b1 = 0;
this->speed = sSpeeds[this->frame & 0xf];
UpdatePlayerMovement();
if (!sub_08019840()) {
if (!UpdatePlayerCollision()) {
gPlayerState.pushedObject ^= 0x80;
if ((gPlayerState.floor_type != SURFACE_AUTO_LADDER) && (gPlayerState.floor_type != SURFACE_2C)) {
UpdateFloorType();
@ -2453,7 +2653,7 @@ static void PlayerParachute(Entity* this) {
static void sub_08073468(Entity* this) {
gPlayerState.animation = 1792;
gPlayerState.jumpStatus = 0;
gPlayerState.jump_status = 0;
this->zVelocity = -0x10000;
this->subAction++;
this->field_0x7c.WORD = 480;
@ -2513,7 +2713,7 @@ static NONMATCH("asm/non_matching/player/sub_08073584.inc", void sub_08073584(En
if ((gPlayerState.field_0x92 & 0x80) || this->iframes > 0 || gPlayerState.field_0x3c[0] ||
(gPlayerState.flags & PL_PARACHUTE) == 0) {
gPlayerState.jumpStatus |= 0x40;
gPlayerState.jump_status |= 0x40;
sub_0807921C();
DoJump(this);
gPlayerState.animation = 1840;
@ -2591,7 +2791,7 @@ static NONMATCH("asm/non_matching/player/sub_08073584.inc", void sub_08073584(En
gPlayerState.animation = gUnk_0811BC30[this->field_0x86.HALF.LO];
}
if (--this->field_0x7c.WORD == -1) {
gPlayerState.jumpStatus |= 0x40;
gPlayerState.jump_status |= 0x40;
sub_0807921C();
} else {
u32 di = (this->field_0x7c.WORD / 20);
@ -2622,7 +2822,7 @@ static void sub_080737BC(Entity* this) {
tmp = 0xf;
tmp &= pos;
if (tmp == 8 && !sub_080002D0(this)) {
gPlayerState.jumpStatus |= 0x40;
gPlayerState.jump_status |= 0x40;
sub_0807921C();
}
}
@ -2682,12 +2882,12 @@ void DoJump(Entity* this) {
sub_08073924, sub_08073968, sub_080739EC, sub_08073A94, sub_08073B8C, sub_08073C30,
};
sStates[gPlayerState.jumpStatus & 7](this);
sStates[gPlayerState.jump_status & 7](this);
}
void sub_08073924(Entity* this) {
if ((gPlayerState.flags & PL_ROLLING) == 0 && (this->z.HALF.HI & 0x8000) && !gPlayerState.field_0xa) {
gPlayerState.jumpStatus = 0x40;
gPlayerState.jump_status = 0x40;
gPlayerState.field_0xd = 0xff;
this->direction = 0xff;
sub_08077B20();
@ -2696,7 +2896,7 @@ void sub_08073924(Entity* this) {
}
static void sub_08073968(Entity* this) {
if ((gPlayerState.jumpStatus & 0xC0) == 0) {
if ((gPlayerState.jump_status & 0xC0) == 0) {
this->direction = gPlayerState.field_0xd;
}
sub_08078F24();
@ -2705,45 +2905,45 @@ static void sub_08073968(Entity* this) {
gPlayerState.animation = 1052;
} else {
if ((gPlayerState.flags & PL_MINISH) == 0) {
if (gPlayerState.flags & PL_MINECART) {
if (gPlayerState.flags & PL_ENTER_MINECART) {
gPlayerState.animation = 2064;
} else {
gPlayerState.animation = 2060;
}
}
}
if ((gPlayerState.jumpStatus & 0xC0) == 0) {
if ((gPlayerState.jump_status & 0xC0) == 0) {
sub_0806F948(this);
}
SoundReq(SFX_PLY_JUMP);
}
gPlayerState.jumpStatus = (gPlayerState.jumpStatus & ~7) | 2;
gPlayerState.jump_status = (gPlayerState.jump_status & ~7) | 2;
}
static void sub_080739EC(Entity* this) {
u32 v;
if ((gPlayerState.jumpStatus & 0xC0) != 0) {
if ((gPlayerState.jump_status & 0xC0) != 0) {
gPlayerState.field_0xd = this->direction;
if (gPlayerState.jumpStatus & 0x80)
if (gPlayerState.jump_status & 0x80)
this->collisions = 0;
v = GRAVITY_RATE;
} else {
if ((u16)sub_0806F854(this, 0, -12)) {
gPlayerState.jumpStatus |= 8;
gPlayerState.jump_status |= 8;
v = GRAVITY_RATE * 2;
} else {
v = GRAVITY_RATE;
if (gPlayerState.jumpStatus & 0x10)
if (gPlayerState.jump_status & 0x10)
v /= 2;
}
}
if ((gPlayerState.jumpStatus & 0xC0) == 0) {
if ((gPlayerState.jumpStatus & 0x20) && this->zVelocity == 0) {
if ((gPlayerState.jump_status & 0xC0) == 0) {
if ((gPlayerState.jump_status & 0x20) && this->zVelocity == 0) {
this->zVelocity = 0x28000;
this->actionDelay = 10;
this->direction = 0xff;
gPlayerState.jumpStatus += 2;
gPlayerState.jump_status += 2;
gPlayerState.animation = 372;
ResetPlayerVelocity();
return;
@ -2758,7 +2958,7 @@ void sub_08073A94(Entity* this) {
sub_08073B60(this);
}
if (gPlayerEntity.z.WORD != 0) {
gPlayerState.jumpStatus = 0;
gPlayerState.jump_status = 0;
sub_08073924(this);
}
}
@ -2770,18 +2970,18 @@ static void sub_08073AD4(Entity* this) {
this->spriteOrientation.flipY = 2;
this->spriteRendering.b3 = 2;
}
tmp = (gPlayerState.jumpStatus & ~0xC0);
tmp = (gPlayerState.jump_status & ~0xC0);
if (this->action != PLAYER_MINISHDIE) {
sub_0807A2B8();
gPlayerState.jumpStatus = 0;
gPlayerState.jump_status = 0;
UpdateFloorType();
if (gPlayerState.queued_action != 0 || gPlayerState.swimState != 0) {
if (gPlayerState.queued_action != 0 || gPlayerState.swim_state != 0) {
return;
}
if (gPlayerState.field_0x3[1])
sub_08073B60(this);
}
gPlayerState.jumpStatus = tmp + 1;
gPlayerState.jump_status = tmp + 1;
if (gPlayerState.flags & PL_NO_CAP)
gPlayerState.animation = 1060;
else
@ -2790,9 +2990,9 @@ static void sub_08073AD4(Entity* this) {
}
static void sub_08073B60(Entity* this) {
gPlayerState.field_0x1a[1] = 0;
gPlayerState.sword_state = 0;
gPlayerState.field_0x3[1] = 0;
gPlayerState.jumpStatus = 0;
gPlayerState.jump_status = 0;
ResolvePlayerAnimation();
sub_080085B0(this);
if ((gPlayerState.flags & PL_USE_PORTAL) == 0) {
@ -2820,7 +3020,7 @@ void sub_08073B8C(Entity* this) {
sub_08073B60(this);
return;
}
gPlayerState.jumpStatus++;
gPlayerState.jump_status++;
this->actionDelay = 15;
InitScreenShake(0x10, 0);
SoundReq(SFX_14C);
@ -2876,8 +3076,8 @@ static void sub_08073D20(Entity* this) {
this->spritePriority.b1 = 3;
this->hurtType = 1;
ResetPlayerVelocity();
if (!gPlayerState.swimState)
this->speed = 0xC0;
if (!gPlayerState.swim_state)
this->speed = 0xC0; /* todo: shielding speed? */
if (!sub_08079B24()) {
sub_08079708(this);
return;
@ -2885,17 +3085,17 @@ static void sub_08073D20(Entity* this) {
if (!RunQueuedAction()) {
DoJump(this);
UpdateFloorType();
if (gPlayerState.jumpStatus)
if (gPlayerState.jump_status)
gPlayerState.framestate = PL_STATE_CAPE;
if (gPlayerState.floor_type != SURFACE_SHALLOW_WATER && gPlayerState.floor_type != SURFACE_WATER) {
gPlayerState.swimState = 0;
gPlayerState.swim_state = 0;
this->field_0x3c &= ~4;
}
if (!RunQueuedAction() && this->subAction != 2) {
if ((gPlayerState.flags & PL_HIDDEN) == 0) {
sub_080085B0(this);
sub_080792D8();
if (!gPlayerState.field_0xa && sub_08079550(gPlayerState.field_0xa))
if (!gPlayerState.field_0xa && sub_08079550())
return;
if (this->knockbackDuration) {
this->direction = this->knockbackDirection;
@ -2907,13 +3107,13 @@ static void sub_08073D20(Entity* this) {
}
COLLISION_ON(this);
}
if (!sub_08019840()) {
if (!UpdatePlayerCollision()) {
sub_08077698(this);
if (!GravityUpdate(this, GRAVITY_RATE))
gPlayerState.jumpStatus = 0;
gPlayerState.jump_status = 0;
if ((gPlayerState.field_0x7 & 0x80) == 0 && !gPlayerState.field_0xa) {
if (this->iframes <= 8) {
if (gPlayerState.swimState) {
if (gPlayerState.swim_state) {
gPlayerState.framestate = PL_STATE_SWIM;
sub_0807ACCC(this);
UpdatePlayerMovement();
@ -3074,7 +3274,7 @@ static NONMATCH("asm/non_matching/player/sub_080740D8.inc", void sub_080740D8(En
END_NONMATCH
u32 sub_080741C4() {
if ((gPlayerState.jumpStatus && (gPlayerState.jumpStatus & 7) != 3) || gPlayerEntity.z.WORD != 0) {
if ((gPlayerState.jump_status && (gPlayerState.jump_status & 7) != 3) || gPlayerEntity.z.WORD != 0) {
gPlayerState.field_0x11 = 0;
gPlayerState.field_0x37 = 0;
return 1;
@ -3122,8 +3322,8 @@ static void sub_08074244(Entity* this, u32 a1, u32 a2) {
}
void SurfaceAction_6(Entity* this) {
if (gPlayerState.swimState != 0) {
gPlayerState.swimState = 0;
if (gPlayerState.swim_state != 0) {
gPlayerState.swim_state = 0;
}
this->spritePriority.b0 = 4;
this->field_0x3c &= ~4;
@ -3233,7 +3433,7 @@ void SurfaceAction_CloneTile(Entity* this) {
CopyPosition(this, e);
}
} else {
gPlayerState.field_0x1a[1] |= 0x80;
gPlayerState.sword_state |= 0x80;
gPlayerState.flags |= PL_CLONING;
this->x.WORD = (this->x.WORD & ~0xFFFFF) | 0x80000;
this->y.WORD = (this->y.WORD & ~0xFFFFF) | 0x80000;
@ -3269,11 +3469,11 @@ void SurfaceAction_ShallowWater(Entity* this) {
this->spritePriority.b1 = 0;
SurfaceAction_Water(this);
} else {
if (gPlayerState.swimState) {
if (gPlayerState.swim_state) {
COLLISION_ON(this);
this->field_0x3c &= ~4;
this->spritePriority.b0 = 4;
gPlayerState.swimState = 0;
gPlayerState.swim_state = 0;
}
if ((gPlayerState.field_0x92 & 0xF00) || gPlayerState.field_0x11 == 1)
SoundReq(SFX_WATER_WALK);
@ -3282,11 +3482,11 @@ void SurfaceAction_ShallowWater(Entity* this) {
}
void SurfaceAction_SlopeGndWater(Entity* this) {
if (gPlayerState.swimState) {
if (gPlayerState.swim_state) {
COLLISION_ON(this);
this->field_0x3c &= ~4;
this->spritePriority.b0 = 4;
gPlayerState.swimState = 0;
gPlayerState.swim_state = 0;
}
}
@ -3297,11 +3497,11 @@ void SurfaceAction_Water(Entity* this) {
if (gPlayerState.field_0x14 == 0) {
gPlayerState.field_0x3f += 2;
} else {
gPlayerState.swimState = 0;
gPlayerState.swim_state = 0;
this->spritePriority.b0 = 4;
this->field_0x3c &= ~4;
}
if ((gPlayerState.swimState & 0xF) || sub_08079C30(this)) {
if ((gPlayerState.swim_state & 0xF) || sub_08079C30(this)) {
sub_08074808(this);
}
}
@ -3310,11 +3510,11 @@ void SurfaceAction_Water(Entity* this) {
void sub_08074808(Entity* this) {
sub_08077AEC(this);
if (GetInventoryValue(ITEM_FLIPPERS) == 1) {
if (!gPlayerState.swimState) {
if (!gPlayerState.swim_state) {
if ((gPlayerState.flags & 0x10000) != 0)
gPlayerState.swimState = 1;
gPlayerState.swim_state = 1;
else
gPlayerState.swimState = 8;
gPlayerState.swim_state = 8;
this->speed = 0;
gPlayerState.field_0x82[7] = 0;
if ((gPlayerState.flags & PL_MINISH) == 0)
@ -3322,9 +3522,9 @@ void sub_08074808(Entity* this) {
SoundReq(SFX_1A5);
ResetPlayer();
}
if ((gPlayerState.swimState & 0xF) != 1) {
if ((gPlayerState.swim_state & 0xF) != 1) {
sub_08079744(this);
--gPlayerState.swimState;
--gPlayerState.swim_state;
}
gPlayerState.flags &= ~(PL_BURNING | PL_FROZEN);
if ((gPlayerState.flags & PL_DRUGGED) != 0 && this->field_0x7a.HWORD <= 0xEu)
@ -3372,7 +3572,7 @@ void SurfaceAction_ClimbWall(Entity* this) {
void SurfaceAction_Ladder(Entity* this) {
if (!sub_080741C4()) {
gPlayerState.jumpStatus = 0;
gPlayerState.jump_status = 0;
this->spriteRendering.b3 = 1;
this->spriteOrientation.flipY = 1;
this->animationState = IdleNorth;
@ -3396,7 +3596,7 @@ void SurfaceAction_AutoLadder(Entity* this) {
this->spriteOrientation.flipY = 1;
this->animationState = IdleNorth;
this->collisionLayer = 3;
gPlayerState.swimState = 0;
gPlayerState.swim_state = 0;
this->field_0x3c &= ~4;
if ((this->y.HALF.HI & 0xF) <= 7) {
gPlayerState.animation = 723;
@ -3410,7 +3610,7 @@ void SurfaceAction_AutoLadder(Entity* this) {
}
void SurfaceAction_20(Entity* this) {
if (gPlayerState.swimState & 0x80) {
if (gPlayerState.swim_state & 0x80) {
Entity* e = CreateObjectWithParent(&gPlayerEntity, GROUND_ITEM, ITEM_RUPEE1, 0);
if (e != NULL) {
e->actionDelay = 1;
@ -3455,45 +3655,45 @@ void SurfaceAction_Hole(Entity* this) {
}
}
void SurfaceAction_D(Entity* this) {
void SurfaceAction_ConveyerNorth(Entity* this) {
if (!sub_080741C4() && (gPlayerState.flags & PL_MINISH) == 0) {
this->animationState = IdleNorth;
this->direction = DirectionNorth;
sub_08074BF8(this);
conveyer_push(this);
}
}
void SurfaceAction_E(Entity* this) {
void SurfaceAction_ConveyerSouth(Entity* this) {
if (!sub_080741C4() && (gPlayerState.flags & PL_MINISH) == 0) {
this->animationState = IdleSouth;
this->direction = DirectionSouth;
sub_08074BF8(this);
conveyer_push(this);
}
}
void SurfaceAction_F(Entity* this) {
void SurfaceAction_ConveyerWest(Entity* this) {
if (!sub_080741C4() && (gPlayerState.flags & PL_MINISH) == 0) {
this->animationState = IdleWest;
this->direction = DirectionWest;
sub_08074BF8(this);
conveyer_push(this);
}
}
void SurfaceAction_10(Entity* this) {
void SurfaceAction_ConveyerEast(Entity* this) {
if (!sub_080741C4() && (gPlayerState.flags & PL_MINISH) == 0) {
this->animationState = IdleEast;
this->direction = DirectionEast;
sub_08074BF8(this);
conveyer_push(this);
}
}
static void sub_08074BF8(Entity* this) {
static void conveyer_push(Entity* this) {
ResetPlayer();
this->spritePriority.b1 = 0;
this->speed = 320;
this->speed = WALK_SPEED;
gPlayerState.flags |= 0x2000000;
gPlayerState.field_0xa |= 0x80;
gPlayerState.field_0x1a[0] |= 0x80;
gPlayerState.mobility |= 0x80;
gPlayerState.field_0x27[0]++;
LinearMoveUpdate(this);
}

View File

@ -36,7 +36,7 @@ void sub_080AAC44(Entity* this) {
ResolveEntityOnTop(this->parent, this);
}
ResetPlayer();
gPlayerState.field_0x1a[0] |= 0x80;
gPlayerState.mobility |= 0x80;
gPlayerState.field_0xa |= 0x80;
}
if (gPlayerEntity.health == 0) {
@ -180,11 +180,11 @@ void sub_080AAF74(Entity* this) {
this->action = 1;
this->field_0x80.HALF.LO = 0;
gPlayerEntity.iframes = 0xf0;
gPlayerState.field_0x1a[0] = 0;
gPlayerState.mobility = 0;
this->health = 0;
} else {
ResetPlayer();
gPlayerState.field_0x1a[0] |= 0x80;
gPlayerState.mobility |= 0x80;
gPlayerState.field_0xa |= 0x80;
CopyPosition(&gPlayerEntity, this);
this->z.HALF.HI = gPlayerEntity.z.HALF.HI - 4;

View File

@ -2095,7 +2095,7 @@ void sub_0807FB64(Entity* entity, ScriptExecutionContext* context) {
}
void sub_0807FB74(Entity* entity, ScriptExecutionContext* context) {
gPlayerState.swimState = 0;
gPlayerState.swim_state = 0;
gPlayerEntity.field_0x3c &= ~4;
}
@ -2109,7 +2109,7 @@ void sub_0807FBA0(Entity* entity, ScriptExecutionContext* context) {
}
void sub_0807FBB4(Entity* entity, ScriptExecutionContext* context) {
gPlayerState.field_0x1a[0] |= 0x80;
gPlayerState.mobility |= 0x80;
}
void sub_0807FBC4(Entity* entity, ScriptExecutionContext* context) {