Merge pull request #633 from Reinmmar/MissingPlayerStateFlags

This commit is contained in:
notyourav 2023-11-30 09:04:24 -08:00 committed by GitHub
commit f0bbb7fde0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 37 additions and 29 deletions

View File

@ -209,6 +209,7 @@ typedef enum {
SURFACE_AUTO_LADDER, SURFACE_AUTO_LADDER,
SURFACE_CLIMB_WALL, SURFACE_CLIMB_WALL,
SURFACE_2C, SURFACE_2C,
SURFACE_FF = 0xff,
} SurfaceType; } SurfaceType;
typedef enum { typedef enum {

View File

@ -8,6 +8,15 @@ typedef enum {
CUT_TREE = 0x1F, CUT_TREE = 0x1F,
ROCK = 0x55, ROCK = 0x55,
CHEST = 0x73, CHEST = 0x73,
CHEST_OPEN = 0x74,
TORCH = 0x76,
TORCH_LIT = 0x77,
PRESSURE_BUTTON = 0x78,
PRESSURE_BUTTON_PRESSED = 0x79,
PRESSURE_SQUARE = 0x7a,
PRESSURE_SQUARE_PRESSED = 0x7b,
STAIRS_UP = 0x92,
STAIRS_DOWN = 0x93,
SIGNPOST = 0x176, SIGNPOST = 0x176,
PERMA_ROCK = 0x1D3, PERMA_ROCK = 0x1D3,
PERMA_ROCK2 = 0x1D4, PERMA_ROCK2 = 0x1D4,

View File

@ -1528,7 +1528,7 @@ void sub_08078FB0(Entity* this) {
if (gPlayerState.flags & PL_MINISH) { if (gPlayerState.flags & PL_MINISH) {
animIndex = 0x18; animIndex = 0x18;
} else { } else {
if (gPlayerState.animation >> 8 == 7) { if (gPlayerState.animation >> 8 == (ANIM_PORTAL_ACTIVATE >> 8)) {
animIndex = 0x34; animIndex = 0x34;
} else { } else {
animIndex = 0xb8; animIndex = 0xb8;
@ -1691,41 +1691,39 @@ void sub_080792BC(s32 speed, u32 direction, u32 field_0x38) {
void sub_080792D8(void) { void sub_080792D8(void) {
Entity* playerEntity = &gPlayerEntity; Entity* playerEntity = &gPlayerEntity;
if (playerEntity->knockbackDuration != 0) { if (playerEntity->knockbackDuration == 0)
if (((((playerEntity->action == 0xb) || (gPlayerState.dash_state != 0)) || return;
((u8)(gPlayerState.heldObject - 1) < 4)) ||
(((gPlayerState.jump_status != 0 || (gPlayerState.floor_type == 0xff)) || if (playerEntity->action == PLAYER_08071DB8 || gPlayerState.dash_state || (u8)(gPlayerState.heldObject - 1) < 4 ||
(((gPlayerState.field_0x7 & 0x80) != 0 || gPlayerState.jump_status || gPlayerState.floor_type == SURFACE_FF || gPlayerState.field_0x7 & 0x80 ||
((0 < (s32)((gPlayerState.swim_state & 0xf) - 1) || (playerEntity->action == 3)))))))) || 0 < (gPlayerState.swim_state & 0xf) - 1 || playerEntity->action == PLAYER_FALL ||
((gPlayerState.flags & 0x40000) != 0)) { gPlayerState.flags & PL_ROLLING) {
playerEntity->knockbackDuration = 0; playerEntity->knockbackDuration = 0;
} else if ((playerEntity->action == 0x1d) && (playerEntity->knockbackDirection != 0x10)) { } else if (playerEntity->action == PLAYER_CLIMB && playerEntity->knockbackDirection != DirectionSouth) {
playerEntity->knockbackDuration = 0; playerEntity->knockbackDuration = 0;
} else { } else {
if ((s8)playerEntity->knockbackDuration >= 1) {
if ((s8)(playerEntity->knockbackDuration) >= 1) {
playerEntity->knockbackDuration--; playerEntity->knockbackDuration--;
} else { } else {
playerEntity->knockbackDuration++; playerEntity->knockbackDuration++;
} }
if (playerEntity->knockbackDuration != 0) {
if (playerEntity->knockbackDuration == 0)
return;
gPlayerState.field_0x7 &= 0xdf; gPlayerState.field_0x7 &= 0xdf;
if ((((0 < playerEntity->iframes) && (gPlayerState.swim_state == 0)) && if (0 < playerEntity->iframes && !gPlayerState.swim_state && !(gPlayerState.flags & PL_MINISH) &&
((gPlayerState.flags & 0x80) == 0)) && !gPlayerState.jump_status) {
gPlayerState.jump_status == 0) {
ResetActiveItems(); ResetActiveItems();
if ((gPlayerState.flags & 8) == 0) { if (!(gPlayerState.flags & PL_NO_CAP)) {
gPlayerState.animation = 0x114; gPlayerState.animation = ANIM_BOUNCE;
} else { } else {
gPlayerState.animation = 0x418; gPlayerState.animation = ANIM_BOUNCE_NOCAP;
} }
} }
sub_080027EA(playerEntity, 0x280, playerEntity->knockbackDirection); sub_080027EA(playerEntity, 0x280, playerEntity->knockbackDirection);
sub_0807A5B8(playerEntity->knockbackDirection); sub_0807A5B8(playerEntity->knockbackDirection);
} }
}
}
} }
bool32 sub_080793E4(u32 param_1) { bool32 sub_080793E4(u32 param_1) {