Skip to content

Commit

Permalink
Merge pull request #4 from rnconrad/accessibility-interaction
Browse files Browse the repository at this point in the history
Add option to allow opening chests from any side
  • Loading branch information
MelonSpeedruns authored Apr 14, 2022
2 parents 730bae0 + 77d7364 commit 6f60652
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
1 change: 1 addition & 0 deletions soh/soh/Enhancements/bootcommands.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ void BootCommands_Init()
CVar_RegisterS32("gDisableLOD", 0);
CVar_RegisterS32("gDebugEnabled", 0);
CVar_RegisterS32("gPauseLiveLink", 0);
CVar_RegisterS32("gAccessibleInteraction", 0);
CVar_RegisterS32("gMoreTargets", 0);
CVar_RegisterS32("gAimAudioCues", 0);
}
Expand Down
14 changes: 10 additions & 4 deletions soh/src/overlays/actors/ovl_En_Box/z_en_box.c
Original file line number Diff line number Diff line change
Expand Up @@ -420,10 +420,16 @@ void EnBox_WaitOpen(EnBox* this, GlobalContext* globalCtx) {
osSyncPrintf("Actor_Environment_Tbox_On() %d\n", this->dyna.actor.params & 0x1F);
Flags_SetTreasure(globalCtx, this->dyna.actor.params & 0x1F);
} else {
player = GET_PLAYER(globalCtx);
func_8002DBD0(&this->dyna.actor, &sp4C, &player->actor.world.pos);
if (sp4C.z > -50.0f && sp4C.z < 0.0f && fabsf(sp4C.y) < 10.0f && fabsf(sp4C.x) < 20.0f &&
Player_IsFacingActor(&this->dyna.actor, 0x3000, globalCtx)) {
bool isPlayerInFrontOfActor;
if (CVar_GetS32("gAccessibleInteraction", 0)) {
isPlayerInFrontOfActor = true;
} else {
player = GET_PLAYER(globalCtx);
func_8002DBD0(&this->dyna.actor, &sp4C, &player->actor.world.pos);
isPlayerInFrontOfActor = sp4C.z > -50.0f && sp4C.z < 0.0f && fabsf(sp4C.y) < 10.0f && fabsf(sp4C.x) < 20.0f;
}

if (isPlayerInFrontOfActor && Player_IsFacingActor(&this->dyna.actor, 0x3000, globalCtx)) {
func_8002F554(&this->dyna.actor, globalCtx, 0 - (this->dyna.actor.params >> 5 & 0x7F));
}
if (Flags_GetTreasure(globalCtx, this->dyna.actor.params & 0x1F)) {
Expand Down

0 comments on commit 6f60652

Please sign in to comment.