Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions include/bgcheck.h
Original file line number Diff line number Diff line change
Expand Up @@ -144,9 +144,9 @@ typedef enum WallType {
} WallType;

#define WALL_FLAG_0 (1 << 0)
#define WALL_FLAG_1 (1 << 1)
#define WALL_FLAG_2 (1 << 2)
#define WALL_FLAG_3 (1 << 3)
#define WALL_FLAG_LADDER (1 << 1)
#define WALL_FLAG_LADDER_TOP (1 << 2)
#define WALL_FLAG_CLIMBABLE (1 << 3)
#define WALL_FLAG_CRAWLSPACE_1 (1 << 4)
#define WALL_FLAG_CRAWLSPACE_2 (1 << 5)
#define WALL_FLAG_6 (1 << 6)
Expand Down Expand Up @@ -441,8 +441,8 @@ u32 SurfaceType_GetFloorType(CollisionContext* colCtx, CollisionPoly* poly, s32
u32 func_80041D70(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId);
s32 SurfaceType_GetWallFlags(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId);
s32 SurfaceType_CheckWallFlag0(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId);
s32 SurfaceType_CheckWallFlag1(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId);
s32 SurfaceType_CheckWallFlag2(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId);
s32 SurfaceType_CheckWallFlagLadder(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId);
s32 SurfaceType_CheckWallFlagLadderTop(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId);
u32 SurfaceType_GetFloorProperty(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId);
u32 SurfaceType_IsSoft(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId);
u32 SurfaceType_IsHorseBlocked(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId);
Expand Down
9 changes: 6 additions & 3 deletions include/player.h
Original file line number Diff line number Diff line change
Expand Up @@ -689,7 +689,7 @@ typedef struct PlayerAgeProperties {
/* 0xA4 */ LinkAnimationHeader* unk_A4;
/* 0xA8 */ LinkAnimationHeader* unk_A8;
/* 0xAC */ LinkAnimationHeader* unk_AC[4];
/* 0xBC */ LinkAnimationHeader* unk_BC[2];
/* 0xBC */ LinkAnimationHeader* sideClimbAnim[2]; // Climbing walls sideways
/* 0xC4 */ LinkAnimationHeader* unk_C4[2];
/* 0xCC */ LinkAnimationHeader* unk_CC[2];
} PlayerAgeProperties; // size = 0xD4
Expand Down Expand Up @@ -726,7 +726,7 @@ typedef struct WeaponInfo {
#define PLAYER_STATE1_18 (1 << 18)
#define PLAYER_STATE1_19 (1 << 19)
#define PLAYER_STATE1_20 (1 << 20)
#define PLAYER_STATE1_21 (1 << 21)
#define PLAYER_STATE1_CLIMBING (1 << 21) // Player is on a climbable wall/ladder
#define PLAYER_STATE1_SHIELDING (1 << 22) // Shielding in any form (regular, hylian shield as child, "shielding" with a two handed sword, etc.)
#define PLAYER_STATE1_23 (1 << 23)
#define PLAYER_STATE1_USING_BOOMERANG (1 << 24) // Currently using the boomerang. This includes all phases (aiming, throwing, and catching).
Expand All @@ -750,7 +750,7 @@ typedef struct WeaponInfo {
#define PLAYER_STATE2_FORCE_SAND_FLOOR_SOUND (1 << 9) // Forces sand footstep sounds regardless of current floor type
#define PLAYER_STATE2_10 (1 << 10)
#define PLAYER_STATE2_11 (1 << 11)
#define PLAYER_STATE2_12 (1 << 12)
#define PLAYER_STATE2_CLIMB_STILL (1 << 12) // Climbing but currently not moving
#define PLAYER_STATE2_LOCK_ON_WITH_SWITCH (1 << 13) // Actor lock-on is active, specifically with Switch Targeting. Hold Targeting checks the state of the Z button instead of this flag.
#define PLAYER_STATE2_14 (1 << 14)
#define PLAYER_STATE2_15 (1 << 15)
Expand Down Expand Up @@ -917,6 +917,7 @@ typedef struct Player {
s8 facingUpSlope; // Player_Action_SlideOnSlope: Facing uphill when sliding on a slope
s8 isLakeHyliaCs; // Player_Action_BlueWarpArrive: In Lake Hylia CS after Water Temple. Floating down is delayed until a specific point in the cutscene.
s8 bottleCatchType; // Player_Action_SwingBottle: entry type for `sBottleCatchInfo`, corresponds to actor caught in a bottle
s8 isClimbWall; // Player_Action_Climbing: True if climbed wall is a climbable wall and not ladder
} av1; // "Action Variable 1": context dependent variable that has different meanings depending on what action is currently running

/* 0x0850 */ union {
Expand All @@ -929,6 +930,8 @@ typedef struct Player {
s16 csDelayTimer; // Player_Action_WaitForCutscene: Number of frames to wait before responding to a cutscene
s16 playedLandingSfx; // Player_Action_BlueWarpArrive: Played sfx when landing on the ground
s16 appearTimer; // Player_Action_FaroresWindArrive: Counts up, appear at 20 frames (1 second)
s16 climbStartAnimFinished; // Player_Action_Climbing: Negative if start climb animation has not finished yet
s16 leftFootAbove; // Player_Action_Climbing: 1 = left foot higher up during climb
} av2; // "Action Variable 2": context dependent variable that has different meanings depending on what action is currently running

/* 0x0854 */ f32 unk_854;
Expand Down
6 changes: 3 additions & 3 deletions src/code/z_actor.c
Original file line number Diff line number Diff line change
Expand Up @@ -1171,7 +1171,7 @@ s32 func_8002DDE4(PlayState* play) {
s32 func_8002DDF4(PlayState* play) {
Player* player = GET_PLAYER(play);

return player->stateFlags2 & PLAYER_STATE2_12;
return player->stateFlags2 & PLAYER_STATE2_CLIMB_STILL;
}

/**
Expand Down Expand Up @@ -1866,7 +1866,7 @@ s32 Actor_OfferGetItem(Actor* actor, PlayState* play, s32 getItemId, f32 xzRange

if (!(player->stateFlags1 &
(PLAYER_STATE1_DEAD | PLAYER_STATE1_CHARGING_SPIN_ATTACK | PLAYER_STATE1_13 | PLAYER_STATE1_14 |
PLAYER_STATE1_18 | PLAYER_STATE1_19 | PLAYER_STATE1_20 | PLAYER_STATE1_21)) &&
PLAYER_STATE1_18 | PLAYER_STATE1_19 | PLAYER_STATE1_20 | PLAYER_STATE1_CLIMBING)) &&
Player_GetExplosiveHeld(player) < 0) {
if ((((player->heldActor != NULL) || (player->talkActor == actor)) && (getItemId > GI_NONE) &&
(getItemId < GI_MAX)) ||
Expand Down Expand Up @@ -1940,7 +1940,7 @@ u32 Actor_SetRideActor(PlayState* play, Actor* horse, s32 mountSide) {

if (!(player->stateFlags1 &
(PLAYER_STATE1_DEAD | PLAYER_STATE1_CARRYING_ACTOR | PLAYER_STATE1_CHARGING_SPIN_ATTACK | PLAYER_STATE1_13 |
PLAYER_STATE1_14 | PLAYER_STATE1_18 | PLAYER_STATE1_19 | PLAYER_STATE1_20 | PLAYER_STATE1_21))) {
PLAYER_STATE1_14 | PLAYER_STATE1_18 | PLAYER_STATE1_19 | PLAYER_STATE1_20 | PLAYER_STATE1_CLIMBING))) {
player->rideActor = horse;
player->mountSide = mountSide;
return true;
Expand Down
14 changes: 7 additions & 7 deletions src/code/z_bgcheck.c
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,9 @@ void BgCheck_ResetPolyCheckTbl(SSNodeList* nodeList, s32 numPolys);
s32 D_80119D90[WALL_TYPE_MAX] = {
0, // WALL_TYPE_0
WALL_FLAG_0, // WALL_TYPE_1
WALL_FLAG_0 | WALL_FLAG_1, // WALL_TYPE_2
WALL_FLAG_0 | WALL_FLAG_2, // WALL_TYPE_3
WALL_FLAG_3, // WALL_TYPE_4
WALL_FLAG_0 | WALL_FLAG_LADDER, // WALL_TYPE_2
WALL_FLAG_0 | WALL_FLAG_LADDER_TOP, // WALL_TYPE_3
WALL_FLAG_CLIMBABLE, // WALL_TYPE_4
WALL_FLAG_CRAWLSPACE_1, // WALL_TYPE_5
WALL_FLAG_CRAWLSPACE_2, // WALL_TYPE_6
WALL_FLAG_6, // WALL_TYPE_7
Expand Down Expand Up @@ -4129,12 +4129,12 @@ s32 SurfaceType_CheckWallFlag0(CollisionContext* colCtx, CollisionPoly* poly, s3
return (SurfaceType_GetWallFlags(colCtx, poly, bgId) & WALL_FLAG_0) ? true : false;
}

s32 SurfaceType_CheckWallFlag1(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId) {
return (SurfaceType_GetWallFlags(colCtx, poly, bgId) & WALL_FLAG_1) ? true : false;
s32 SurfaceType_CheckWallFlagLadder(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId) {
return (SurfaceType_GetWallFlags(colCtx, poly, bgId) & WALL_FLAG_LADDER) ? true : false;
}

s32 SurfaceType_CheckWallFlag2(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId) {
return (SurfaceType_GetWallFlags(colCtx, poly, bgId) & WALL_FLAG_2) ? true : false;
s32 SurfaceType_CheckWallFlagLadderTop(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId) {
return (SurfaceType_GetWallFlags(colCtx, poly, bgId) & WALL_FLAG_LADDER_TOP) ? true : false;
}

u32 SurfaceType_GetFloorProperty2(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId) {
Expand Down
10 changes: 5 additions & 5 deletions src/code/z_camera.c
Original file line number Diff line number Diff line change
Expand Up @@ -1211,7 +1211,7 @@ s32 Camera_CalcAtForParallel(Camera* camera, VecGeo* arg1, f32 yOffset, f32* arg
}

if (camera->playerGroundY == camera->playerPosRot.pos.y || camera->player->actor.gravity > -0.1f ||
camera->player->stateFlags1 & PLAYER_STATE1_21) {
camera->player->stateFlags1 & PLAYER_STATE1_CLIMBING) {
*arg3 = Camera_LERPCeilF(playerPosRot->pos.y, *arg3, CAM_GLOBAL_43, 0.1f);
phi_f20 = playerPosRot->pos.y - *arg3;
playerToAtOffsetTarget.y -= phi_f20;
Expand Down Expand Up @@ -1317,7 +1317,7 @@ s32 Camera_CalcAtForLockOn(Camera* camera, VecGeo* eyeAtDir, Vec3f* targetPos, f
playerToAtOffsetTarget.z += lookFromOffset.z;

if (camera->playerGroundY == camera->playerPosRot.pos.y || camera->player->actor.gravity > -0.1f ||
camera->player->stateFlags1 & PLAYER_STATE1_21) {
camera->player->stateFlags1 & PLAYER_STATE1_CLIMBING) {
*yPosOffset = Camera_LERPCeilF(playerPosRot->pos.y, *yPosOffset, CAM_GLOBAL_43, 0.1f);
yPosDelta = playerPosRot->pos.y - *yPosOffset;
playerToAtOffsetTarget.y -= yPosDelta;
Expand Down Expand Up @@ -2256,7 +2256,7 @@ s32 Camera_Parallel1(Camera* camera) {
}

if (camera->playerGroundY == camera->playerPosRot.pos.y || camera->player->actor.gravity > -0.1f ||
camera->player->stateFlags1 & PLAYER_STATE1_21) {
camera->player->stateFlags1 & PLAYER_STATE1_CLIMBING) {
rwData->yTarget = playerPosRot->pos.y;
sp6A = 0;
} else {
Expand Down Expand Up @@ -3029,7 +3029,7 @@ s32 Camera_Battle1(Camera* camera) {
}

if (camera->playerGroundY == camera->playerPosRot.pos.y || camera->player->actor.gravity > -0.1f ||
camera->player->stateFlags1 & PLAYER_STATE1_21) {
camera->player->stateFlags1 & PLAYER_STATE1_CLIMBING) {
isOffGround = false;
rwData->yPosOffset = playerPosRot->pos.y;
} else {
Expand Down Expand Up @@ -3353,7 +3353,7 @@ s32 Camera_KeepOn1(Camera* camera) {
rwData->unk_0C = NULL;
cont:
if (camera->playerGroundY == camera->playerPosRot.pos.y || camera->player->actor.gravity > -0.1f ||
camera->player->stateFlags1 & PLAYER_STATE1_21) {
camera->player->stateFlags1 & PLAYER_STATE1_CLIMBING) {
rwData->unk_08 = playerPosRot->pos.y;
isOffGround = false;
} else {
Expand Down
4 changes: 2 additions & 2 deletions src/code/z_parameter.c
Original file line number Diff line number Diff line change
Expand Up @@ -808,7 +808,7 @@ void func_80083108(PlayState* play) {
}

Interface_ChangeHudVisibilityMode(HUD_VISIBILITY_ALL);
} else if ((player->stateFlags1 & PLAYER_STATE1_21) || (player->stateFlags2 & PLAYER_STATE2_CRAWLING)) {
} else if ((player->stateFlags1 & PLAYER_STATE1_CLIMBING) || (player->stateFlags2 & PLAYER_STATE2_CRAWLING)) {
if (gSaveContext.buttonStatus[0] != BTN_DISABLED) {
gSaveContext.buttonStatus[0] = BTN_DISABLED;
gSaveContext.buttonStatus[1] = BTN_DISABLED;
Expand Down Expand Up @@ -2911,7 +2911,7 @@ void Interface_DrawItemButtons(PlayState* play) {
(gSaveContext.hudVisibilityMode == HUD_VISIBILITY_NOTHING_ALT) ||
(gSaveContext.hudVisibilityMode == HUD_VISIBILITY_A_HEARTS_MAGIC_FORCE)) {
temp = 0;
} else if ((player->stateFlags1 & PLAYER_STATE1_21) ||
} else if ((player->stateFlags1 & PLAYER_STATE1_CLIMBING) ||
(Player_GetEnvironmentalHazard(play) == PLAYER_ENV_HAZARD_UNDERWATER_FREE) ||
(player->stateFlags2 & PLAYER_STATE2_CRAWLING)) {
temp = 70;
Expand Down
4 changes: 2 additions & 2 deletions src/code/z_player_lib.c
Original file line number Diff line number Diff line change
Expand Up @@ -750,12 +750,12 @@ void Player_ReleaseLockOn(Player* this) {
*/
void Player_ClearZTargeting(Player* this) {
if ((this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) ||
(this->stateFlags1 & (PLAYER_STATE1_21 | PLAYER_STATE1_23 | PLAYER_STATE1_27)) ||
(this->stateFlags1 & (PLAYER_STATE1_CLIMBING | PLAYER_STATE1_23 | PLAYER_STATE1_27)) ||
(!(this->stateFlags1 & (PLAYER_STATE1_18 | PLAYER_STATE1_19)) &&
((this->actor.world.pos.y - this->actor.floorHeight) < 100.0f))) {
this->stateFlags1 &= ~(PLAYER_STATE1_Z_TARGETING | PLAYER_STATE1_FRIENDLY_ACTOR_FOCUS | PLAYER_STATE1_PARALLEL |
PLAYER_STATE1_18 | PLAYER_STATE1_19 | PLAYER_STATE1_LOCK_ON_FORCED_TO_RELEASE);
} else if (!(this->stateFlags1 & (PLAYER_STATE1_18 | PLAYER_STATE1_19 | PLAYER_STATE1_21))) {
} else if (!(this->stateFlags1 & (PLAYER_STATE1_18 | PLAYER_STATE1_19 | PLAYER_STATE1_CLIMBING))) {
this->stateFlags1 |= PLAYER_STATE1_19;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ void BgJyaZurerukabe_InitDynaPoly(BgJyaZurerukabe* this, PlayState* play, Collis
void func_8089B4C8(BgJyaZurerukabe* this, PlayState* play) {
Player* player = GET_PLAYER(play);

if ((player->stateFlags1 == PLAYER_STATE1_21) && (player->actor.wallPoly != NULL)) {
if ((player->stateFlags1 == PLAYER_STATE1_CLIMBING) && (player->actor.wallPoly != NULL)) {
s32 i;

for (i = 0; i < ARRAY_COUNT(D_8089BA18); i++) {
Expand Down
4 changes: 2 additions & 2 deletions src/overlays/actors/ovl_En_Rd/z_en_rd.c
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,7 @@ void EnRd_WalkToPlayer(EnRd* this, PlayState* play) {

if ((ABS(yaw) < 0x1554) && (Actor_WorldDistXYZToActor(&this->actor, &player->actor) <= 150.0f)) {
if (!(player->stateFlags1 & (PLAYER_STATE1_DEAD | PLAYER_STATE1_13 | PLAYER_STATE1_14 | PLAYER_STATE1_18 |
PLAYER_STATE1_19 | PLAYER_STATE1_21)) &&
PLAYER_STATE1_19 | PLAYER_STATE1_CLIMBING)) &&
!(player->stateFlags2 & PLAYER_STATE2_7)) {
if (this->playerStunWaitTimer == 0) {
if (!(this->rdFlags & 0x80)) {
Expand Down Expand Up @@ -464,7 +464,7 @@ void EnRd_WalkToHome(EnRd* this, PlayState* play) {
SkelAnime_Update(&this->skelAnime);

if (!(player->stateFlags1 & (PLAYER_STATE1_DEAD | PLAYER_STATE1_13 | PLAYER_STATE1_14 | PLAYER_STATE1_18 |
PLAYER_STATE1_19 | PLAYER_STATE1_21)) &&
PLAYER_STATE1_19 | PLAYER_STATE1_CLIMBING)) &&
!(player->stateFlags2 & PLAYER_STATE2_7) &&
(Actor_WorldDistXYZToPoint(&player->actor, &this->actor.home.pos) < 150.0f)) {
this->actor.attentionRangeType = ATTENTION_RANGE_0;
Expand Down
2 changes: 1 addition & 1 deletion src/overlays/actors/ovl_En_Ru1/z_en_ru1.c
Original file line number Diff line number Diff line change
Expand Up @@ -956,7 +956,7 @@ void EnRu1_CheckStartFirstEncounter(EnRu1* this, PlayState* play) {
Player* player = GET_PLAYER(play);

if ((EnRu1_IsPlayerInRangeForFirstEncounter(this, play)) && (!Play_InCsMode(play)) &&
(!(player->stateFlags1 & (PLAYER_STATE1_13 | PLAYER_STATE1_14 | PLAYER_STATE1_21))) &&
(!(player->stateFlags1 & (PLAYER_STATE1_13 | PLAYER_STATE1_14 | PLAYER_STATE1_CLIMBING))) &&
(player->actor.bgCheckFlags & BGCHECKFLAG_GROUND)) {

play->csCtx.script = gRutoFirstMeetingCs;
Expand Down
2 changes: 1 addition & 1 deletion src/overlays/actors/ovl_En_Sw/z_en_sw.c
Original file line number Diff line number Diff line change
Expand Up @@ -725,7 +725,7 @@ s32 func_80B0DEA8(EnSw* this, PlayState* play, s32 arg2) {
s32 sp54;
Vec3f sp48;

if (!(player->stateFlags1 & PLAYER_STATE1_21) && arg2) {
if (!(player->stateFlags1 & PLAYER_STATE1_CLIMBING) && arg2) {
return false;
} else if (func_8002DDF4(play) && arg2) {
return false;
Expand Down
Loading