mirror of
https://github.com/HarbourMasters/Shipwright.git
synced 2024-11-29 12:52:18 -05:00
Fix weirdness with item gets from chests (#4146)
This commit is contained in:
parent
6f7173a5c4
commit
baf7691fbd
@ -260,6 +260,8 @@ typedef enum {
|
|||||||
// Opt: *EnOkarinaTag
|
// Opt: *EnOkarinaTag
|
||||||
VB_PLAY_DOOR_OF_TIME_CS,
|
VB_PLAY_DOOR_OF_TIME_CS,
|
||||||
VB_PLAY_RAINBOW_BRIDGE_CS,
|
VB_PLAY_RAINBOW_BRIDGE_CS,
|
||||||
|
// Opt: *EnBox
|
||||||
|
VB_PLAY_SLOW_CHEST_CS,
|
||||||
|
|
||||||
/*** Give Items ***/
|
/*** Give Items ***/
|
||||||
|
|
||||||
|
@ -37,6 +37,9 @@ extern "C" {
|
|||||||
|
|
||||||
extern SaveContext gSaveContext;
|
extern SaveContext gSaveContext;
|
||||||
extern PlayState* gPlayState;
|
extern PlayState* gPlayState;
|
||||||
|
extern void func_8084DFAC(PlayState* play, Player* player);
|
||||||
|
extern void func_80835DAC(PlayState* play, Player* player, PlayerActionFunc actionFunc, s32 flags);
|
||||||
|
extern s32 func_80836898(PlayState* play, Player* player, PlayerFuncA74 func);
|
||||||
}
|
}
|
||||||
|
|
||||||
#define RAND_GET_OPTION(option) Rando::Context::GetInstance()->GetOption(option).GetSelectedOptionIndex()
|
#define RAND_GET_OPTION(option) Rando::Context::GetInstance()->GetOption(option).GetSelectedOptionIndex()
|
||||||
@ -555,8 +558,26 @@ void RandomizerSetChestGameRandomizerInf(RandomizerCheck rc) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Player_Action_8084E6D4_override(Player* player, PlayState* play) {
|
||||||
|
if (LinkAnimation_Update(play, &player->skelAnime)) {
|
||||||
|
func_8084DFAC(play, player);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void func_8083A434_override(PlayState* play, Player* player) {
|
||||||
|
func_80835DAC(play, player, Player_Action_8084E6D4_override, 0);
|
||||||
|
player->stateFlags1 |= PLAYER_STATE1_GETTING_ITEM | PLAYER_STATE1_IN_CUTSCENE;
|
||||||
|
}
|
||||||
|
|
||||||
void RandomizerOnVanillaBehaviorHandler(GIVanillaBehavior id, bool* should, void* optionalArg) {
|
void RandomizerOnVanillaBehaviorHandler(GIVanillaBehavior id, bool* should, void* optionalArg) {
|
||||||
switch (id) {
|
switch (id) {
|
||||||
|
case VB_PLAY_SLOW_CHEST_CS: {
|
||||||
|
// We force fast chests if SkipGetItemAnimation is enabled because the camera in the CS looks pretty wonky otherwise
|
||||||
|
if (CVarGetInteger(CVAR_ENHANCEMENT("TimeSavers.SkipGetItemAnimation"), SGIA_DISABLED)) {
|
||||||
|
*should = false;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
case VB_GIVE_ITEM_FROM_CHEST: {
|
case VB_GIVE_ITEM_FROM_CHEST: {
|
||||||
EnBox* chest = static_cast<EnBox*>(optionalArg);
|
EnBox* chest = static_cast<EnBox*>(optionalArg);
|
||||||
RandomizerCheck rc = OTRGlobals::Instance->gRandomizer->GetCheckFromActor(chest->dyna.actor.id, gPlayState->sceneNum, chest->dyna.actor.params);
|
RandomizerCheck rc = OTRGlobals::Instance->gRandomizer->GetCheckFromActor(chest->dyna.actor.id, gPlayState->sceneNum, chest->dyna.actor.params);
|
||||||
@ -565,9 +586,8 @@ void RandomizerOnVanillaBehaviorHandler(GIVanillaBehavior id, bool* should, void
|
|||||||
RandomizerSetChestGameRandomizerInf(rc);
|
RandomizerSetChestGameRandomizerInf(rc);
|
||||||
|
|
||||||
Player* player = GET_PLAYER(gPlayState);
|
Player* player = GET_PLAYER(gPlayState);
|
||||||
player->av2.actionVar2 = 1;
|
func_80836898(gPlayState, player, func_8083A434_override);
|
||||||
player->getItemId = GI_NONE;
|
|
||||||
player->getItemEntry = GetItemEntry(GET_ITEM_NONE);
|
|
||||||
*should = false;
|
*should = false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
#include "soh/Enhancements/randomizer/randomizerTypes.h"
|
#include "soh/Enhancements/randomizer/randomizerTypes.h"
|
||||||
#include "soh/Enhancements/game-interactor/GameInteractor.h"
|
#include "soh/Enhancements/game-interactor/GameInteractor.h"
|
||||||
#include "soh/Enhancements/game-interactor/GameInteractor_Hooks.h"
|
#include "soh/Enhancements/game-interactor/GameInteractor_Hooks.h"
|
||||||
|
#include "soh/Enhancements/enhancementTypes.h"
|
||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#include "src/overlays/actors/ovl_En_Wonder_Talk2/z_en_wonder_talk2.h"
|
#include "src/overlays/actors/ovl_En_Wonder_Talk2/z_en_wonder_talk2.h"
|
||||||
@ -14,6 +15,7 @@ extern "C" {
|
|||||||
#include "src/overlays/actors/ovl_En_Ko/z_en_ko.h"
|
#include "src/overlays/actors/ovl_En_Ko/z_en_ko.h"
|
||||||
#include "src/overlays/actors/ovl_En_Ma1/z_en_ma1.h"
|
#include "src/overlays/actors/ovl_En_Ma1/z_en_ma1.h"
|
||||||
#include "src/overlays/actors/ovl_En_Zl4/z_en_zl4.h"
|
#include "src/overlays/actors/ovl_En_Zl4/z_en_zl4.h"
|
||||||
|
#include "src/overlays/actors/ovl_En_Box/z_en_box.h"
|
||||||
#include "src/overlays/actors/ovl_Demo_Im/z_demo_im.h"
|
#include "src/overlays/actors/ovl_Demo_Im/z_demo_im.h"
|
||||||
#include "src/overlays/actors/ovl_En_Sa/z_en_sa.h"
|
#include "src/overlays/actors/ovl_En_Sa/z_en_sa.h"
|
||||||
#include "src/overlays/actors/ovl_Bg_Ddan_Kd/z_bg_ddan_kd.h"
|
#include "src/overlays/actors/ovl_Bg_Ddan_Kd/z_bg_ddan_kd.h"
|
||||||
@ -625,6 +627,15 @@ void TimeSaverOnVanillaBehaviorHandler(GIVanillaBehavior id, bool* should, void*
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case VB_PLAY_SLOW_CHEST_CS: {
|
||||||
|
if (CVarGetInteger(CVAR_ENHANCEMENT("FastChests"), 0)) {
|
||||||
|
*should = false;
|
||||||
|
} else if (CVarGetInteger(CVAR_ENHANCEMENT("ChestSizeAndTextureMatchContents"), CSMC_DISABLED) && *should) {
|
||||||
|
EnBox* enBox = static_cast<EnBox*>(opt);
|
||||||
|
*should = enBox->dyna.actor.scale.x != 0.005f;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6853,10 +6853,6 @@ s32 Player_ActionChange_2(Player* this, PlayState* play) {
|
|||||||
giEntry = this->getItemEntry;
|
giEntry = this->getItemEntry;
|
||||||
}
|
}
|
||||||
EnBox* chest = (EnBox*)interactedActor;
|
EnBox* chest = (EnBox*)interactedActor;
|
||||||
if (CVarGetInteger(CVAR_ENHANCEMENT("FastChests"), 0) != 0) {
|
|
||||||
giEntry.gi = -1 * abs(giEntry.gi);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (giEntry.itemId != ITEM_NONE) {
|
if (giEntry.itemId != ITEM_NONE) {
|
||||||
if (((Item_CheckObtainability(giEntry.itemId) == ITEM_NONE) && (giEntry.field & 0x40)) ||
|
if (((Item_CheckObtainability(giEntry.itemId) == ITEM_NONE) && (giEntry.field & 0x40)) ||
|
||||||
((Item_CheckObtainability(giEntry.itemId) != ITEM_NONE) && (giEntry.field & 0x20))) {
|
((Item_CheckObtainability(giEntry.itemId) != ITEM_NONE) && (giEntry.field & 0x20))) {
|
||||||
@ -6865,11 +6861,12 @@ s32 Player_ActionChange_2(Player* this, PlayState* play) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func_80836898(play, this, func_8083A434);
|
|
||||||
if (GameInteractor_Should(VB_GIVE_ITEM_FROM_CHEST, true, chest)) {
|
if (GameInteractor_Should(VB_GIVE_ITEM_FROM_CHEST, true, chest)) {
|
||||||
|
func_80836898(play, this, func_8083A434);
|
||||||
|
}
|
||||||
this->stateFlags1 |= PLAYER_STATE1_GETTING_ITEM | PLAYER_STATE1_ITEM_OVER_HEAD | PLAYER_STATE1_IN_CUTSCENE;
|
this->stateFlags1 |= PLAYER_STATE1_GETTING_ITEM | PLAYER_STATE1_ITEM_OVER_HEAD | PLAYER_STATE1_IN_CUTSCENE;
|
||||||
func_8083AE40(this, giEntry.objectId);
|
func_8083AE40(this, giEntry.objectId);
|
||||||
}
|
|
||||||
this->actor.world.pos.x =
|
this->actor.world.pos.x =
|
||||||
chest->dyna.actor.world.pos.x - (Math_SinS(chest->dyna.actor.shape.rot.y) * 29.4343f);
|
chest->dyna.actor.world.pos.x - (Math_SinS(chest->dyna.actor.shape.rot.y) * 29.4343f);
|
||||||
this->actor.world.pos.z =
|
this->actor.world.pos.z =
|
||||||
@ -6877,8 +6874,10 @@ s32 Player_ActionChange_2(Player* this, PlayState* play) {
|
|||||||
this->yaw = this->actor.shape.rot.y = chest->dyna.actor.shape.rot.y;
|
this->yaw = this->actor.shape.rot.y = chest->dyna.actor.shape.rot.y;
|
||||||
func_80832224(this);
|
func_80832224(this);
|
||||||
|
|
||||||
if ((giEntry.itemId != ITEM_NONE) && (giEntry.gi >= 0) &&
|
bool vanillaPlaySlowChestCS = (giEntry.itemId != ITEM_NONE) && (giEntry.gi >= 0) &&
|
||||||
(Item_CheckObtainability(giEntry.itemId) == ITEM_NONE)) {
|
(Item_CheckObtainability(giEntry.itemId) == ITEM_NONE);
|
||||||
|
|
||||||
|
if (GameInteractor_Should(VB_PLAY_SLOW_CHEST_CS, vanillaPlaySlowChestCS, chest)) {
|
||||||
Player_AnimPlayOnceAdjusted(play, this, this->ageProperties->unk_98);
|
Player_AnimPlayOnceAdjusted(play, this, this->ageProperties->unk_98);
|
||||||
Player_AnimReplaceApplyFlags(play, this, 0x28F);
|
Player_AnimReplaceApplyFlags(play, this, 0x28F);
|
||||||
chest->unk_1F4 = 1;
|
chest->unk_1F4 = 1;
|
||||||
|
Loading…
Reference in New Issue
Block a user