Skip to content
Open
Show file tree
Hide file tree
Changes from 6 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
3 changes: 3 additions & 0 deletions soh/include/functions.h
Original file line number Diff line number Diff line change
Expand Up @@ -1102,6 +1102,9 @@ void Path_CopyLastPoint(Path* path, Vec3f* dest);
void FrameAdvance_Init(FrameAdvanceContext* frameAdvCtx);
s32 FrameAdvance_Update(FrameAdvanceContext* frameAdvCtx, Input* input);
u8 PlayerGrounded(Player* player);
s32 func_8083FBC0(Player* player, PlayState* play);
f32 func_8083973C(PlayState* play, Player* player, Vec3f* arg2, Vec3f* arg3);
void Player_SetupDismountLadder(Player* player, LinkAnimationHeader* anim, PlayState* play);
void Player_SetBootData(PlayState* play, Player* player);
void Player_StartAnimMovement(PlayState* play, Player* player, s32 flags);
s32 Player_InBlockingCsMode(PlayState* play, Player* player);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -364,9 +364,34 @@ typedef enum {
// true
// ```
// #### `args`
// - None
// - `s32*` (sp80 = x)
// - `s32*` (sp84 = y)
VB_CLIMB,

// #### `result`
// ```c
// (!sp50 && (func_80041DB8(&play->colCtx, sp84, sp80) & 8))
// ```
// #### `args`
// - None
VB_START_CLIMB_FROM_ABOVE,

// #### `result`
// ```c
// true
// ```
// #### `args`
// - None
VB_REATTACH_TO_CLIMB_WALL_LADDER,

// #### `result`
// ```c
// true
// ```
// #### `args`
// - None
VB_NOT_ON_GROUND_ACTION,

// #### `result`
// ```c
// CHECK_BTN_ALL(input->press.button, BTN_START)
Expand Down
60 changes: 57 additions & 3 deletions soh/soh/Enhancements/randomizer/hook_handlers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1039,11 +1039,65 @@ void RandomizerOnVanillaBehaviorHandler(GIVanillaBehavior id, bool* should, va_l
if (RAND_GET_OPTION(RSK_SHUFFLE_CLIMB) && !Flags_GetRandomizerInf(RAND_INF_CAN_CLIMB)) {
s32* x = va_arg(args, s32*);
s32* y = va_arg(args, s32*);
Player* player = GET_PLAYER(gPlayState);

// Detach player if moving up/down when start climb animation has finished
// (except at top of ladder, then normal dismount)
if (player->av2.actionVar2 >= 0 && *y != 0) {
Vec3f pos;
Vec3f raycastOffset = { 0.0f, player->ageProperties->unk_40, 26.0f };
f32 wallHeight = func_8083973C(gPlayState, player, &raycastOffset, &pos);

*x = 0;
if (*y > 0) {
*y = 0;
*should = false;
if (player->av1.actionVar1 == false && *y > 0 && player->actor.world.pos.y < wallHeight) {
Player_SetupDismountLadder(player, player->ageProperties->unk_CC[player->av2.actionVar2],
gPlayState);
} else {
player->actor.bgCheckFlags &= ~BGCHECKFLAG_PLAYER_WALL_INTERACT;
func_8083FBC0(player, gPlayState);
}
}

*x = *y = 0; // Zero speed even for start climb animation
}
break;
case VB_START_CLIMB_FROM_ABOVE:
if (RAND_GET_OPTION(RSK_SHUFFLE_CLIMB) && !Flags_GetRandomizerInf(RAND_INF_CAN_CLIMB)) {
*should = false; // Start hanging action instead of climbing
}
break;
case VB_NOT_ON_GROUND_ACTION:
if (RAND_GET_OPTION(RSK_SHUFFLE_CLIMB) && !Flags_GetRandomizerInf(RAND_INF_CAN_CLIMB)) {
Player* player = GET_PLAYER(gPlayState);
CollisionPoly* wallPoly;
Vec3f raycastPos;
Vec3f posResult;
s32 bgId;

// Check if climb wall/ladder in front. If not, different rotation if hanging fall so check behind
raycastPos.x = player->actor.world.pos.x + 50.0f * Math_SinS(player->actor.world.rot.y);
raycastPos.y = player->actor.world.pos.y;
raycastPos.z = player->actor.world.pos.z + 50.0f * Math_CosS(player->actor.world.rot.y);
BgCheck_EntityLineTest1(&gPlayState->colCtx, &player->actor.world.pos, &raycastPos, &posResult,
&wallPoly, true, false, false, true, &bgId);
if (wallPoly == NULL) {
raycastPos.x = player->actor.world.pos.x - 50.0f * Math_SinS(player->actor.world.rot.y);
raycastPos.z = player->actor.world.pos.z - 50.0f * Math_CosS(player->actor.world.rot.y);
BgCheck_EntityLineTest1(&gPlayState->colCtx, &player->actor.world.pos, &raycastPos, &posResult,
&wallPoly, true, false, false, true, &bgId);
}

// No fall damage if falling from ladder or climbable wall for can take damage logic
if (func_80041E18(&gPlayState->colCtx, wallPoly, bgId) ||
func_80041DB8(&gPlayState->colCtx, wallPoly, bgId) & 8) {
player->fallDistance = 0;
player->fallStartHeight = (s16)player->actor.world.pos.y;
}
}
break;
case VB_REATTACH_TO_CLIMB_WALL_LADDER:
if (RAND_GET_OPTION(RSK_SHUFFLE_CLIMB) && !Flags_GetRandomizerInf(RAND_INF_CAN_CLIMB)) {
*should = false; // Can't attach if can't climb
}
break;
case VB_CRAWL:
Expand Down
10 changes: 8 additions & 2 deletions soh/src/overlays/actors/ovl_player_actor/z_player.c
Original file line number Diff line number Diff line change
Expand Up @@ -5721,7 +5721,9 @@ s32 func_8083A6AC(Player* this, PlayState* play) {
sp54 = Math3D_UDistPlaneToPos(nx, ny, nz, sp84->dist, &this->actor.world.pos);

sp50 = (sPrevFloorProperty == 6);
if (!sp50 && (func_80041DB8(&play->colCtx, sp84, sp80) & 8)) {
// Shuffle climb check
Comment thread
djevangelia marked this conversation as resolved.
Outdated
if (GameInteractor_Should(VB_START_CLIMB_FROM_ABOVE,
(!sp50 && (func_80041DB8(&play->colCtx, sp84, sp80) & 8)))) {
sp50 = 1;
}

Expand Down Expand Up @@ -9631,6 +9633,8 @@ void Player_Action_8084411C(Player* this, PlayState* play) {

Player_GetMovementSpeedAndYaw(this, &sp4C, &sp4A, SPEED_MODE_LINEAR, play);

GameInteractor_Should(VB_NOT_ON_GROUND_ACTION, true);

if (!(this->actor.bgCheckFlags & BGCHECKFLAG_GROUND)) {
if (this->stateFlags1 & PLAYER_STATE1_CARRYING_ACTOR) {
Actor* heldActor = this->heldActor;
Expand Down Expand Up @@ -9681,7 +9685,9 @@ void Player_Action_8084411C(Player* this, PlayState* play) {
(this->linearVelocity > 0.0f)) {
if ((this->yDistToLedge >= 150.0f) &&
(this->controlStickDirections[this->controlStickDataIndex] == 0)) {
func_8083EC18(this, play, sTouchedWallFlags);
if (GameInteractor_Should(VB_REATTACH_TO_CLIMB_WALL_LADDER, true)) {
func_8083EC18(this, play, sTouchedWallFlags);
}
} else if ((this->ledgeClimbType >= 2) && (this->yDistToLedge < 150.0f) &&
(((this->actor.world.pos.y - this->actor.floorHeight) + this->yDistToLedge) >
(70.0f * this->ageProperties->unk_08))) {
Expand Down
Loading