mirror of
https://github.com/HarbourMasters/Shipwright
synced 2026-08-22 07:04:54 -04:00
Shuffle Treasure Chest Game (#7020)
This commit is contained in:
@@ -135,7 +135,8 @@ void EnBox_Init(Actor* thisx, PlayState* play2) {
|
||||
|
||||
if (play) {} // helps the compiler store play2 into s1
|
||||
|
||||
if (Flags_GetTreasure(play, this->dyna.actor.params & 0x1F)) {
|
||||
if (GameInteractor_Should(VB_CHEST_CONSIDER_CHEST_OPEN, Flags_GetTreasure(play, this->dyna.actor.params & 0x1F),
|
||||
this)) {
|
||||
this->alpha = 255;
|
||||
this->iceSmokeTimer = 100;
|
||||
EnBox_SetupAction(this, EnBox_Open);
|
||||
@@ -441,7 +442,9 @@ void EnBox_WaitOpen(EnBox* this, PlayState* play) {
|
||||
}
|
||||
}
|
||||
osSyncPrintf("Actor_Environment_Tbox_On() %d\n", this->dyna.actor.params & 0x1F);
|
||||
Flags_SetTreasure(play, this->dyna.actor.params & 0x1F);
|
||||
if (GameInteractor_Should(VB_CHEST_SET_TREASURE_FLAG, true, this)) {
|
||||
Flags_SetTreasure(play, this->dyna.actor.params & 0x1F);
|
||||
}
|
||||
} else {
|
||||
player = GET_PLAYER(play);
|
||||
Actor_WorldToActorCoords(&this->dyna.actor, &sp4C, &player->actor.world.pos);
|
||||
@@ -449,7 +452,8 @@ void EnBox_WaitOpen(EnBox* this, PlayState* play) {
|
||||
Player_IsFacingActor(&this->dyna.actor, 0x3000, play)) {
|
||||
Actor_OfferGetItemNearby(&this->dyna.actor, play, -(this->dyna.actor.params >> 5 & 0x7F));
|
||||
}
|
||||
if (Flags_GetTreasure(play, this->dyna.actor.params & 0x1F)) {
|
||||
if (GameInteractor_Should(VB_CHEST_CONSIDER_CHEST_OPEN, Flags_GetTreasure(play, this->dyna.actor.params & 0x1F),
|
||||
this)) {
|
||||
EnBox_SetupAction(this, EnBox_Open);
|
||||
}
|
||||
}
|
||||
@@ -576,9 +580,10 @@ void EnBox_UpdateTexture(EnBox* this, PlayState* play) {
|
||||
GetItemCategory getItemCategory;
|
||||
GetItemEntry chestItem = this->getItemEntry;
|
||||
|
||||
// Exclude treasure game chests except for the final room, unless the chest game is shuffled
|
||||
int isVanilla = !csmc || (requiresStoneAgony && !CHECK_QUEST_ITEM(QUEST_STONE_OF_AGONY)) ||
|
||||
(play->sceneNum == SCENE_TREASURE_BOX_SHOP &&
|
||||
this->dyna.actor.room != 6); // Exclude treasure game chests except for the final room
|
||||
(play->sceneNum == SCENE_TREASURE_BOX_SHOP && this->dyna.actor.room != 6 &&
|
||||
!Randomizer_GetSettingValue(RSK_SHUFFLE_CHEST_MINIGAME));
|
||||
|
||||
if (!isVanilla) {
|
||||
getItemCategory = Randomizer_AdjustItemCategory(chestItem);
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
#include "vt.h"
|
||||
#include "overlays/actors/ovl_Item_Etcetera/z_item_etcetera.h"
|
||||
#include "overlays/actors/ovl_En_Ex_Item/z_en_ex_item.h"
|
||||
#include "soh/Enhancements/game-interactor/GameInteractor_Hooks.h"
|
||||
|
||||
#define FLAGS 0
|
||||
|
||||
@@ -136,7 +137,7 @@ void EnChanger_Init(Actor* thisx, PlayState* play2) {
|
||||
this->rightChestGetItemId = GI_DOOR_KEY;
|
||||
rightChestItem = ITEM_ETC_KEY_SMALL_CHEST_GAME;
|
||||
|
||||
if (Rand_ZeroFloat(1.99f) < 1.0f) {
|
||||
if (GameInteractor_Should(VB_EN_CHANGER_SWAP_CHESTS, Rand_ZeroFloat(1.99f) < 1.0f, this)) {
|
||||
rightChestParams = (sLoserGetItemIds[play->roomCtx.curRoom.num] << 5) | 0x4000;
|
||||
this->rightChestNum = new_var;
|
||||
this->rightChestGetItemId = sLoserGetItemIds[play->roomCtx.curRoom.num];
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
#include "soh/OTRGlobals.h"
|
||||
#include "soh/ResourceManagerHelpers.h"
|
||||
#include "soh/Enhancements/savestate_serialize.h"
|
||||
#include "soh/Enhancements/game-interactor/GameInteractor_Hooks.h"
|
||||
|
||||
#define FLAGS \
|
||||
(ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_FRIENDLY | ACTOR_FLAG_UPDATE_CULLING_DISABLED | \
|
||||
@@ -64,8 +65,10 @@ void EnTakaraMan_Init(Actor* thisx, PlayState* play) {
|
||||
osSyncPrintf("\n\n");
|
||||
// "Bun! %x" (needs a better translation)
|
||||
osSyncPrintf(VT_FGCOL(PURPLE) "☆☆☆☆☆ ばぅん! ☆☆☆☆☆ %x\n" VT_RST, play->actorCtx.flags.chest);
|
||||
play->actorCtx.flags.chest = 0;
|
||||
gSaveContext.inventory.dungeonKeys[gSaveContext.mapIndex] = -1;
|
||||
if (GameInteractor_Should(VB_TAKARA_MAN_RESET_CHESTS_AND_KEYS, true, this)) {
|
||||
play->actorCtx.flags.chest = 0;
|
||||
gSaveContext.inventory.dungeonKeys[gSaveContext.mapIndex] = -1;
|
||||
}
|
||||
SkelAnime_InitFlex(play, &this->skelAnime, &object_ts_Skel_004FE0, &object_ts_Anim_000498, this->jointTable,
|
||||
this->morphTable, 10);
|
||||
thisx->focus.pos = thisx->world.pos;
|
||||
@@ -156,7 +159,9 @@ void func_80B17934(EnTakaraMan* this, PlayState* play) {
|
||||
Rupees_ChangeBy(-10);
|
||||
this->unk_214 = 1;
|
||||
this->actor.parent = NULL;
|
||||
Actor_OfferGetItem(&this->actor, play, GI_DOOR_KEY, 2000.0f, 1000.0f);
|
||||
if (GameInteractor_Should(VB_TAKARA_MAN_OFFER_GET_ITEM, true, this)) {
|
||||
Actor_OfferGetItem(&this->actor, play, GI_DOOR_KEY, 2000.0f, 1000.0f);
|
||||
}
|
||||
this->actionFunc = func_80B17A6C;
|
||||
} else {
|
||||
Message_CloseTextbox(play);
|
||||
@@ -180,7 +185,7 @@ void func_80B17934(EnTakaraMan* this, PlayState* play) {
|
||||
void func_80B17A6C(EnTakaraMan* this, PlayState* play) {
|
||||
if (Actor_HasParent(&this->actor, play)) {
|
||||
this->actionFunc = func_80B17AC4;
|
||||
} else {
|
||||
} else if (GameInteractor_Should(VB_TAKARA_MAN_OFFER_GET_ITEM, true, this)) {
|
||||
Actor_OfferGetItem(&this->actor, play, GI_DOOR_KEY, 2000.0f, 1000.0f);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user