diff --git a/src/beanstalkSubtask.c b/src/beanstalkSubtask.c index e10778f3..3009a41c 100644 --- a/src/beanstalkSubtask.c +++ b/src/beanstalkSubtask.c @@ -204,7 +204,7 @@ u32 UpdatePlayerCollision(void) { ptr1 = &gUnk_080B4490[index * 2]; if (sub_080B1B44(COORD_TO_TILE_OFFSET(&gPlayerEntity, -ptr1[0], -ptr1[1]), gPlayerEntity.collisionLayer) == 0xff) { - if ((((gPlayerState.flags & 0x10002) != 0) || ((gPlayerState.sword_state & 0x10) != 0)) || + if ((((gPlayerState.flags & (PL_FLAGS10000 | PL_FLAGS2)) != 0) || ((gPlayerState.sword_state & 0x10) != 0)) || ((sub_080806BC(gPlayerEntity.x.HALF.HI - gRoomControls.origin_x, gPlayerEntity.y.HALF.HI - gRoomControls.origin_y, index, 5) == 0 && (((gPlayerState.heldObject != 0 || ((gPlayerState.field_0x1c & 0xf) != 0)) || @@ -234,19 +234,19 @@ u32 UpdatePlayerCollision(void) { return 0; } layer->mapData[position] = 0x4001 + (gPlayerEntity.animationState >> 1); - if ((gPlayerState.flags & 0x80) != 0) { + if ((gPlayerState.flags & PL_MINISH) != 0) { gPlayerState.pushedObject = 0xc0; } else { gPlayerState.pushedObject = 0xa0; } gPlayerState.queued_action = PLAYER_PUSH; - gPlayerState.flags |= 1; + gPlayerState.flags |= PL_BUSY; gPlayerEntity.x.HALF.LO = 0; gPlayerEntity.y.HALF.LO = 0; gPlayerEntity.direction = Direction8FromAnimationState(gPlayerEntity.animationState); return 1; case 0x28: - if ((gPlayerState.flags & 0x80) != 0) { + if ((gPlayerState.flags & PL_MINISH) != 0) { return 0; } gPlayerEntity.action = gPlayerEntity.action; @@ -286,7 +286,7 @@ u32 UpdatePlayerCollision(void) { layer->mapData[position] = 0x401c + (gPlayerEntity.animationState >> 1); gPlayerState.pushedObject = 0xa0; gPlayerState.queued_action = PLAYER_PUSH; - gPlayerState.flags |= 1; + gPlayerState.flags |= PL_BUSY; gPlayerEntity.x.HALF.LO = 0; gPlayerEntity.y.HALF.LO = 0; gPlayerEntity.direction = Direction8FromAnimationState(gPlayerEntity.animationState); @@ -304,7 +304,7 @@ u32 UpdatePlayerCollision(void) { case 0x3a: case 0x5b: case 0x4051: - if ((gPlayerState.flags & 0x80) != 0) { + if ((gPlayerState.flags & PL_MINISH) != 0) { return 0; } if (gPlayerEntity.animationState != 0) { @@ -321,7 +321,7 @@ u32 UpdatePlayerCollision(void) { if ((animationState1 & 0xff) != 0) { return 0; } - if ((gPlayerState.flags & 0x4080) != 0) { + if ((gPlayerState.flags & (PL_DRUGGED | PL_MINISH)) != 0) { return 0; } gUnk_0200AF00.rActionInteractTile = R_ACTION_OPEN; @@ -344,7 +344,7 @@ u32 UpdatePlayerCollision(void) { return 2; case 0x3d: case 0x4040 ... 0x4048: - if ((gPlayerState.flags & 0x4000) != 0) { + if ((gPlayerState.flags & PL_DRUGGED) != 0) { return 0; } if (sub_08079778() == 0) { @@ -365,7 +365,7 @@ u32 UpdatePlayerCollision(void) { return 0; } gPlayerState.jump_status = 0x81; - gPlayerState.flags |= 0x20; + gPlayerState.flags |= PL_USE_PORTAL; gPlayerState.queued_action = PLAYER_USEPORTAL; gPlayerEntity.zVelocity = 0x20000; COLLISION_OFF(&gPlayerEntity); @@ -381,7 +381,7 @@ u32 UpdatePlayerCollision(void) { } gPlayerState.pushedObject = 0xa0; gPlayerState.queued_action = PLAYER_PUSH; - gPlayerState.flags |= 1; + gPlayerState.flags |= PL_BUSY; gPlayerEntity.x.HALF.LO = 0; gPlayerEntity.y.HALF.LO = 0; gPlayerEntity.direction = Direction8FromAnimationState(gPlayerEntity.animationState); @@ -393,7 +393,7 @@ u32 UpdatePlayerCollision(void) { layer->mapData[position] = 0x405b + (gPlayerEntity.animationState >> 1); gPlayerState.pushedObject = 0x98; gPlayerState.queued_action = PLAYER_PUSH; - gPlayerState.flags |= 1; + gPlayerState.flags |= PL_BUSY; gPlayerEntity.x.HALF.LO = 0; gPlayerEntity.y.HALF.LO = 0; gPlayerEntity.direction = Direction8FromAnimationState(gPlayerEntity.animationState); @@ -405,7 +405,7 @@ u32 UpdatePlayerCollision(void) { layer->mapData[position] = 0x4037 + (gPlayerEntity.animationState >> 1); gPlayerState.pushedObject = 0xa0; gPlayerState.queued_action = PLAYER_PUSH; - gPlayerState.flags |= 1; + gPlayerState.flags |= PL_BUSY; gPlayerEntity.x.HALF.LO = 0; gPlayerEntity.y.HALF.LO = 0; gPlayerEntity.direction = Direction8FromAnimationState(gPlayerEntity.animationState); @@ -423,7 +423,7 @@ u32 UpdatePlayerCollision(void) { layer->mapData[position] = 0x403f; gPlayerState.pushedObject = 0x82; gPlayerState.queued_action = PLAYER_PUSH; - gPlayerState.flags |= 1; + gPlayerState.flags |= PL_BUSY; gPlayerEntity.x.HALF.LO = 0; gPlayerEntity.y.HALF.LO = 0; gPlayerEntity.direction = Direction8FromAnimationState(gPlayerEntity.animationState); @@ -464,7 +464,7 @@ u32 UpdatePlayerCollision(void) { pushedBlock->collisionLayer = gPlayerEntity.collisionLayer; gPlayerState.pushedObject = 0xa0; gPlayerState.queued_action = PLAYER_PUSH; - gPlayerState.flags |= 1; + gPlayerState.flags |= PL_BUSY; gPlayerEntity.x.HALF.LO = 0; gPlayerEntity.y.HALF.LO = 0; gPlayerEntity.direction = pushedBlock->direction; @@ -472,13 +472,13 @@ u32 UpdatePlayerCollision(void) { case 0x402b ... 0x402d: if (sub_0801A370(layer, position) != 0) { layer->mapData[position] = 0x4030 + ((gPlayerEntity.animationState & 4) >> 2); - if ((gPlayerState.flags & 0x80) != 0) { + if ((gPlayerState.flags & PL_MINISH) != 0) { gPlayerState.pushedObject = 0xa0; } else { gPlayerState.pushedObject = 0x90; } gPlayerState.queued_action = PLAYER_PUSH; - gPlayerState.flags |= 1; + gPlayerState.flags |= PL_BUSY; gPlayerEntity.x.HALF.LO = 0; gPlayerEntity.y.HALF.LO = 0; gPlayerEntity.direction = Direction8FromAnimationState(gPlayerEntity.animationState); @@ -491,13 +491,13 @@ u32 UpdatePlayerCollision(void) { return 0; } layer->mapData[position] = 0x404b + (gPlayerEntity.animationState >> 1); - if ((gPlayerState.flags & 0x80) != 0) { + if ((gPlayerState.flags & PL_MINISH) != 0) { gPlayerState.pushedObject = 0xc0; } else { gPlayerState.pushedObject = 0xa0; } gPlayerState.queued_action = PLAYER_PUSH; - gPlayerState.flags |= 1; + gPlayerState.flags |= PL_BUSY; gPlayerEntity.x.HALF.LO = 0; gPlayerEntity.y.HALF.LO = 0; gPlayerEntity.direction = Direction8FromAnimationState(gPlayerEntity.animationState); @@ -563,7 +563,7 @@ u32 UpdatePlayerCollision(void) { SetTile(0x4074, position, gPlayerEntity.collisionLayer); gPlayerState.pushedObject = 0xa0; gPlayerState.queued_action = PLAYER_PUSH; - gPlayerState.flags |= 1; + gPlayerState.flags |= PL_BUSY; gPlayerEntity.x.HALF.LO = 0; gPlayerEntity.y.HALF.LO = 0; gPlayerEntity.direction = Direction8FromAnimationState(gPlayerEntity.animationState); @@ -831,7 +831,7 @@ bool32 sub_0801AA58(Entity* this, u32 param_2, u32 param_3) { object->collisionLayer = this->collisionLayer; gPlayerState.pushedObject = 0xa0; gPlayerState.queued_action = PLAYER_PUSH; - gPlayerState.flags |= 1; + gPlayerState.flags |= PL_BUSY; this->x.HALF.LO = 0; this->y.HALF.LO = 0; this->direction = param_3; diff --git a/src/code_08049DF4.c b/src/code_08049DF4.c index bbef5e64..e6d53f99 100644 --- a/src/code_08049DF4.c +++ b/src/code_08049DF4.c @@ -43,7 +43,7 @@ Entity* sub_08049E4C(void) { } Entity* sub_08049E80(void) { - if ((gPlayerState.field_0x3c != 0) || !(gPlayerState.flags & 0x80)) { + if ((gPlayerState.field_0x3c != 0) || !(gPlayerState.flags & PL_MINISH)) { return NULL; } gUnk_020000B0 = &gPlayerEntity; @@ -51,7 +51,8 @@ Entity* sub_08049E80(void) { } Entity* sub_08049EB0(void) { - if ((gPlayerState.field_0x3c == 0) && !(gPlayerState.flags & 0x80190)) { + if ((gPlayerState.field_0x3c == 0) && !(gPlayerState.flags & + (PL_MOLDWORM_CAPTURED | PL_DISABLE_ITEMS | PL_MINISH | PL_CAPTURED))) { gUnk_020000B0 = &gPlayerEntity; return &gPlayerEntity; } diff --git a/src/enemy/armos.c b/src/enemy/armos.c index 38a30371..e4fa4af1 100644 --- a/src/enemy/armos.c +++ b/src/enemy/armos.c @@ -422,7 +422,7 @@ bool32 sub_0803086C(ArmosEntity* this) { FORCE_REGISTER(u32 r2, r2); if (this->unk_7c != NULL) { - if ((gPlayerState.flags & 0x80) != 0) { + if ((gPlayerState.flags & PL_MINISH) != 0) { centerX = super->x.HALF_U.HI - gRoomControls.origin_x; centerY = super->y.HALF_U.HI - gRoomControls.origin_y; // TODO for some reason the 0x3f of COORD_TO_TILE(super) needs to be forced to r2 here. diff --git a/src/item/itemSword.c b/src/item/itemSword.c index 87b1070a..5598e0d7 100644 --- a/src/item/itemSword.c +++ b/src/item/itemSword.c @@ -127,7 +127,7 @@ void sub_080754B8(ItemBehavior* this, u32 index) { } if ((this->playerFrame & 0x80) != 0) { - if (((gPlayerState.flags & 0x80) != 0) || ((gPlayerState.skills & SKILL_SPIN_ATTACK) == 0)) { + if (((gPlayerState.flags & PL_MINISH) != 0) || ((gPlayerState.skills & SKILL_SPIN_ATTACK) == 0)) { sub_080759B8(this, index); } else { sub_08075580(this, index); diff --git a/src/object/lilypadLarge.c b/src/object/lilypadLarge.c index 88cf601a..84b11274 100644 --- a/src/object/lilypadLarge.c +++ b/src/object/lilypadLarge.c @@ -117,7 +117,7 @@ void sub_080855E8(LilypadLargeEntity* this) { super->flags |= 0x20; if (sub_0806FC80(super, &gPlayerEntity, 0x18) != 0) { - gPlayerState.flags |= 2; + gPlayerState.flags |= PL_FLAGS2; if (gPlayerEntity.z.WORD == 0) { if (gPlayerState.swim_state != 0) { gPlayerEntity.collisionFlags &= 0xfb; @@ -258,7 +258,7 @@ void sub_080855E8(LilypadLargeEntity* this) { this->unk_85 = 0; } - if ((gPlayerState.flags & 2) != 0) { + if ((gPlayerState.flags & PL_FLAGS2) != 0) { sub_08085F1C(this); } diff --git a/src/object/pushableStatue.c b/src/object/pushableStatue.c index efca1ea6..b29ca269 100644 --- a/src/object/pushableStatue.c +++ b/src/object/pushableStatue.c @@ -132,7 +132,7 @@ void PushableStatue_SubAction0(PushableStatueEntity* this) { if (sub_080896B0()) { gPlayerState.queued_action = PLAYER_PULL; gPlayerState.field_0x38 = 0x20; - gPlayerState.flags |= 1; + gPlayerState.flags |= PL_BUSY; gPlayerEntity.x.HALF.LO = 0; gPlayerEntity.y.HALF.LO = 0; super->direction = (gPlayerEntity.animationState ^ 4) << 2; diff --git a/src/playerItem/playerItemSword.c b/src/playerItem/playerItemSword.c index e1fbacb9..43471e77 100644 --- a/src/playerItem/playerItemSword.c +++ b/src/playerItem/playerItemSword.c @@ -182,7 +182,7 @@ void sub_080A76CC(PlayerItemSwordEntity* this) { } } else { - if ((gPlayerState.flags & 0x8000000) != 0) { + if ((gPlayerState.flags & PL_SWORD_THRUST) != 0) { if (this->unk_68 == 6) { super->hurtType = 0xc; } else { diff --git a/src/playerUtils.c b/src/playerUtils.c index 57bed422..33be1be5 100644 --- a/src/playerUtils.c +++ b/src/playerUtils.c @@ -1526,10 +1526,10 @@ void sub_08078FB0(Entity* this) { gPlayerState.field_0x35 = 0xff; } sub_08079064(this); - if ((gPlayerState.flags & 8) != 0) { + if ((gPlayerState.flags & PL_NO_CAP) != 0) { animIndex = 0x58; } else { - if ((gPlayerState.flags & 0x80) != 0) { + if ((gPlayerState.flags & PL_MINISH) != 0) { animIndex = 0x18; } else { if (gPlayerState.animation >> 8 == 7) { @@ -1722,8 +1722,8 @@ void RespawnPlayer(void) { player->zVelocity = 0; player->knockbackDuration = 0; ResetPlayerPosition(); - if ((gPlayerState.flags & 0x20000) == 0) { - if ((gPlayerState.flags & 0x10000) != 0) { + if ((gPlayerState.flags & PL_GYORG_FIGHT) == 0) { + if ((gPlayerState.flags & PL_FLAGS10000) != 0) { player->x.HALF.HI = gPlayerState.lilypad->x.HALF.HI; player->y.HALF.HI = gPlayerState.lilypad->y.HALF.HI; } else {