Fix christmas tree messages

This commit is contained in:
Garrett Cox
2024-11-13 14:19:11 -06:00
committed by Malkierian
parent 2e8fc8873d
commit 2ff9fcc8fa
6 changed files with 58 additions and 13 deletions

View File

@@ -0,0 +1,49 @@
#include "Holiday.hpp"
#include <libultraship/libultraship.h>
#include "soh/UIWidgets.hpp"
#include "soh/Enhancements/game-interactor/GameInteractor.h"
#include "soh/Enhancements/custom-message/CustomMessageManager.h"
#include "include/message_data_fmt.h"
#include "soh/OTRGlobals.h"
extern "C" {
#include "macros.h"
#include "functions.h"
#include "variables.h"
extern PlayState* gPlayState;
}
static void ConfigurationChanged() {
COND_ID_HOOK(OnOpenText, 0x406B, IS_RANDO, [](u16 * textId, bool* loadFromMessageTable) {
if (gPlayState->sceneNum != SCENE_KAKARIKO_VILLAGE) {
return;
}
std::string message;
uint8_t current = gSaveContext.triforcePiecesCollected;
uint8_t required = OTRGlobals::Instance->gRandomizer->GetRandoSettingValue(RSK_TRIFORCE_HUNT_PIECES_REQUIRED);
if (current < required) {
message = "The %yChristmas tree%w seems to be&missing some of %gits magic%w... Find all&ornaments to save %rChristmas%w!";
} else {
message = "The tree's magic has been fully&restored. %gMerry %rChristmas%w!";
}
auto messageEntry = CustomMessage(message);
messageEntry.Format();
messageEntry.LoadIntoFont();
*loadFromMessageTable = false;
});
}
static void RegisterMod() {
// #region Leave this alone unless you know what you are doing
ConfigurationChanged();
// #endregion
GameInteractor::Instance->RegisterGameHook<GameInteractor::OnLoadGame>([](int16_t fileNum) {
ConfigurationChanged();
});
}
static Holiday holiday([]() {}, RegisterMod);

View File

@@ -124,14 +124,14 @@ void Settings::CreateOptionDescriptions() {
"set to either MQ or Random here, you will have fewer MQ Dungeons than the number you "
"set.";
mOptionDescriptions[RSK_TRIFORCE_HUNT] =
"Pieces of the Triforce of Courage have been scattered across the world. Find them all to finish the game!\n\n"
"When the required amount of pieces have been found, the game is saved and Ganon's Boss key is given "
"Ornaments have been scattered across the world. Find them all to finish the game!\n\n"
"When the required amount of ornaments have been found, the game is saved and Ganon's Boss key is given "
"to you when you load back into the game if you desire to beat Ganon afterwards.\n\n"
"Keep in mind Ganon might not be logically beatable when \"All Locations Reachable\" is turned off.";
mOptionDescriptions[RSK_TRIFORCE_HUNT_PIECES_TOTAL] =
"The amount of Triforce pieces that will be placed in the world. "
"Keep in mind seed generation can fail if more pieces are placed than there are junk items in the item pool.";
mOptionDescriptions[RSK_TRIFORCE_HUNT_PIECES_REQUIRED] = "The amount of Triforce pieces required to win the game.";
"The amount of Ornaments that will be placed in the world. "
"Keep in mind seed generation can fail if more ornaments are placed than there are junk items in the item pool.";
mOptionDescriptions[RSK_TRIFORCE_HUNT_PIECES_REQUIRED] = "The amount of Ornaments required to win the game.";
mOptionDescriptions[RSK_SHUFFLE_DUNGEON_ENTRANCES] =
"Shuffle the pool of dungeon entrances, including Bottom of the Well, Ice Cavern and Gerudo Training Ground.\n"
"\n"

View File

@@ -5939,7 +5939,6 @@ void Randomizer::CreateCustomMessages() {
CreateGetItemMessages(getItemMessages);
CreateRupeeMessages();
CreateTriforcePieceMessages();
CreateChristmasTreeMessages();
CreateNaviRandoMessages();
CreateFireTempleGoronMessages();
CreateArchipelagoItemMessage();

View File

@@ -35,7 +35,6 @@ class Randomizer {
static const std::string merchantMessageTableID;
static const std::string rupeeMessageTableID;
static const std::string triforcePieceMessageTableID;
static const std::string christmasTreeMessageTableID;
static const std::string NaviRandoMessageTableID;
static const std::string IceTrapRandoMessageTableID;
static const std::string randoMiscHintsTableID;

View File

@@ -160,9 +160,9 @@ void Settings::CreateOptions() {
OPT_BOOL(RSK_BOMBCHU_BAG, "Bombchu Bag", CVAR_RANDOMIZER_SETTING("BombchuBag"), mOptionDescriptions[RSK_BOMBCHU_BAG]);
OPT_U8(RSK_ENABLE_BOMBCHU_DROPS, "Bombchu Drops", {"No", "Yes"}, OptionCategory::Setting, CVAR_RANDOMIZER_SETTING("EnableBombchuDrops"), mOptionDescriptions[RSK_ENABLE_BOMBCHU_DROPS], WidgetType::Combobox, RO_AMMO_DROPS_ON);
// TODO: AmmoDrops and/or HeartDropRefill, combine with/separate Ammo Drops from Bombchu Drops?
OPT_BOOL(RSK_TRIFORCE_HUNT, "Triforce Hunt", CVAR_RANDOMIZER_SETTING("TriforceHunt"), mOptionDescriptions[RSK_TRIFORCE_HUNT], IMFLAG_NONE);
OPT_U8(RSK_TRIFORCE_HUNT_PIECES_TOTAL, "Triforce Hunt Total Pieces", {NumOpts(1, 100)}, OptionCategory::Setting, CVAR_RANDOMIZER_SETTING("TriforceHuntTotalPieces"), mOptionDescriptions[RSK_TRIFORCE_HUNT_PIECES_TOTAL], WidgetType::Slider, 29, false, IMFLAG_NONE);
OPT_U8(RSK_TRIFORCE_HUNT_PIECES_REQUIRED, "Triforce Hunt Required Pieces", {NumOpts(1, 100)}, OptionCategory::Setting, CVAR_RANDOMIZER_SETTING("TriforceHuntRequiredPieces"), mOptionDescriptions[RSK_TRIFORCE_HUNT_PIECES_REQUIRED], WidgetType::Slider, 19);
OPT_BOOL(RSK_TRIFORCE_HUNT, "Ornament Hunt", CVAR_RANDOMIZER_SETTING("TriforceHunt"), mOptionDescriptions[RSK_TRIFORCE_HUNT], IMFLAG_NONE);
OPT_U8(RSK_TRIFORCE_HUNT_PIECES_TOTAL, "Ornament Hunt Total Pieces", {NumOpts(1, 100)}, OptionCategory::Setting, CVAR_RANDOMIZER_SETTING("TriforceHuntTotalPieces"), mOptionDescriptions[RSK_TRIFORCE_HUNT_PIECES_TOTAL], WidgetType::Slider, 29, false, IMFLAG_NONE);
OPT_U8(RSK_TRIFORCE_HUNT_PIECES_REQUIRED, "Ornament Hunt Required Pieces", {NumOpts(1, 100)}, OptionCategory::Setting, CVAR_RANDOMIZER_SETTING("TriforceHuntRequiredPieces"), mOptionDescriptions[RSK_TRIFORCE_HUNT_PIECES_REQUIRED], WidgetType::Slider, 19);
OPT_U8(RSK_MQ_DUNGEON_RANDOM, "MQ Dungeon Setting", {"None", "Set Number", "Random", "Selection Only"}, OptionCategory::Setting, CVAR_RANDOMIZER_SETTING("MQDungeons"), mOptionDescriptions[RSK_MQ_DUNGEON_RANDOM], WidgetType::Combobox, RO_MQ_DUNGEONS_NONE, true, IMFLAG_NONE);
OPT_U8(RSK_MQ_DUNGEON_COUNT, "MQ Dungeon Count", {NumOpts(0, 12)}, OptionCategory::Setting, CVAR_RANDOMIZER_SETTING("MQDungeonCount"), "", WidgetType::Slider, 12, true, IMFLAG_NONE);
OPT_BOOL(RSK_MQ_DUNGEON_SET, "Set Dungeon Quests", {"Off", "On"}, OptionCategory::Setting, CVAR_RANDOMIZER_SETTING("MQDungeonsSelection"), mOptionDescriptions[RSK_MQ_DUNGEON_SET], WidgetType::Checkbox, false, false, IMFLAG_NONE);

View File

@@ -2439,9 +2439,7 @@ extern "C" int CustomMessage_RetrieveIfExists(PlayState* play) {
bool nonBeanMerchants = ctx->GetOption(RSK_SHUFFLE_MERCHANTS).Is(RO_SHUFFLE_MERCHANTS_ALL_BUT_BEANS) ||
ctx->GetOption(RSK_SHUFFLE_MERCHANTS).Is(RO_SHUFFLE_MERCHANTS_ALL);
Player* player = GET_PLAYER(play);
if (textId == 0x406B && play->sceneNum == SCENE_KAKARIKO_VILLAGE) {
messageEntry = Randomizer::GetChristmasTreeMessage();
} else if (textId == TEXT_RANDOMIZER_CUSTOM_ITEM) {
if (textId == TEXT_RANDOMIZER_CUSTOM_ITEM) {
if (player->getItemEntry.getItemId == RG_ICE_TRAP) {
messageEntry = Randomizer::GetIceTrapMessage();
} else if (player->getItemEntry.getItemId == RG_TRIFORCE_PIECE) {