mirror of
https://github.com/HarbourMasters/Shipwright.git
synced 2024-12-13 03:32:18 -05:00
Merge pull request #4546 from garrettjoecox/let-it-snow
Fix christmas tree messages
This commit is contained in:
commit
79ede37262
49
soh/soh/Enhancements/Holiday/Rando.cpp
Normal file
49
soh/soh/Enhancements/Holiday/Rando.cpp
Normal 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);
|
@ -109,14 +109,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 Grounds.\n"
|
||||
"\n"
|
||||
|
@ -64,7 +64,6 @@ const std::string Randomizer::hintMessageTableID = "RandomizerHints";
|
||||
const std::string Randomizer::merchantMessageTableID = "RandomizerMerchants";
|
||||
const std::string Randomizer::rupeeMessageTableID = "RandomizerRupees";
|
||||
const std::string Randomizer::triforcePieceMessageTableID = "RandomizerTriforcePiece";
|
||||
const std::string Randomizer::christmasTreeMessageTableID = "RandomizerChristmasTree";
|
||||
const std::string Randomizer::NaviRandoMessageTableID = "RandomizerNavi";
|
||||
const std::string Randomizer::IceTrapRandoMessageTableID = "RandomizerIceTrap";
|
||||
const std::string Randomizer::randoMiscHintsTableID = "RandomizerMiscHints";
|
||||
@ -2255,39 +2254,6 @@ CustomMessage Randomizer::GetTriforcePieceMessage() {
|
||||
messageEntry.Format();
|
||||
return messageEntry;
|
||||
}
|
||||
void CreateChristmasTreeMessages() {
|
||||
CustomMessage ChristmasTreeMessages[2] = {
|
||||
|
||||
{ "The %yChristmas tree%w seems to be&missing some of %gits magic%w... Find all&ornaments to save %rChristmas%w!",
|
||||
"The %yChristmas tree%w seems to be&missing some of %gits magic%w... Find all&ornaments to save %rChristmas%w!",
|
||||
"The %yChristmas tree%w seems to be&missing some of %gits magic%w... Find all&ornaments to save %rChristmas%w!" },
|
||||
|
||||
{ "The tree's magic has been fully&restored. %gMerry %rChristmas%w!",
|
||||
"The tree's magic has been fully&restored. %gMerry %rChristmas%w!",
|
||||
"The tree's magic has been fully&restored. %gMerry %rChristmas%w!" }
|
||||
};
|
||||
CustomMessageManager* customMessageManager = CustomMessageManager::Instance;
|
||||
customMessageManager->AddCustomMessageTable(Randomizer::christmasTreeMessageTableID);
|
||||
for (unsigned int i = 0; i <= 1; i++) {
|
||||
customMessageManager->CreateMessage(Randomizer::christmasTreeMessageTableID, i, ChristmasTreeMessages[i]);
|
||||
}
|
||||
}
|
||||
|
||||
CustomMessage Randomizer::GetChristmasTreeMessage() {
|
||||
// Item is only given after the textbox, so reflect that inside the textbox.
|
||||
uint8_t current = gSaveContext.triforcePiecesCollected;
|
||||
uint8_t required = OTRGlobals::Instance->gRandomizer->GetRandoSettingValue(RSK_TRIFORCE_HUNT_PIECES_REQUIRED);
|
||||
uint8_t messageIndex;
|
||||
|
||||
if (current < required) {
|
||||
messageIndex = 0;
|
||||
} else {
|
||||
messageIndex = 1;
|
||||
}
|
||||
|
||||
CustomMessage messageEntry = CustomMessageManager::Instance->RetrieveMessage(Randomizer::christmasTreeMessageTableID, messageIndex);
|
||||
return messageEntry;
|
||||
}
|
||||
|
||||
void CreateNaviRandoMessages() {
|
||||
CustomMessage NaviMessages[NUM_NAVI_MESSAGES] = {
|
||||
@ -3038,7 +3004,6 @@ void Randomizer::CreateCustomMessages() {
|
||||
CreateGetItemMessages(&getItemMessages);
|
||||
CreateRupeeMessages();
|
||||
CreateTriforcePieceMessages();
|
||||
CreateChristmasTreeMessages();
|
||||
CreateNaviRandoMessages();
|
||||
CreateFireTempleGoronMessages();
|
||||
}
|
||||
|
@ -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;
|
||||
@ -68,7 +67,6 @@ class Randomizer {
|
||||
static CustomMessage GetRupeeMessage(u16 rupeeTextId);
|
||||
static CustomMessage GetIceTrapMessage();
|
||||
static CustomMessage GetTriforcePieceMessage();
|
||||
static CustomMessage GetChristmasTreeMessage();
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
@ -139,9 +139,9 @@ void Settings::CreateOptions() {
|
||||
mOptions[RSK_BOMBCHUS_IN_LOGIC] = Option::Bool("Bombchus in Logic", CVAR_RANDOMIZER_SETTING("BombchusInLogic"), mOptionDescriptions[RSK_BOMBCHUS_IN_LOGIC]);
|
||||
mOptions[RSK_ENABLE_BOMBCHU_DROPS] = Option::U8("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?
|
||||
mOptions[RSK_TRIFORCE_HUNT] = Option::Bool("Triforce Hunt", CVAR_RANDOMIZER_SETTING("TriforceHunt"), mOptionDescriptions[RSK_TRIFORCE_HUNT], IMFLAG_NONE);
|
||||
mOptions[RSK_TRIFORCE_HUNT_PIECES_TOTAL] = Option::U8("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);
|
||||
mOptions[RSK_TRIFORCE_HUNT_PIECES_REQUIRED] = Option::U8("Triforce Hunt Required Pieces", {NumOpts(1, 100)}, OptionCategory::Setting, CVAR_RANDOMIZER_SETTING("TriforceHuntRequiredPieces"), mOptionDescriptions[RSK_TRIFORCE_HUNT_PIECES_REQUIRED], WidgetType::Slider, 19);
|
||||
mOptions[RSK_TRIFORCE_HUNT] = Option::Bool("Ornament Hunt", CVAR_RANDOMIZER_SETTING("TriforceHunt"), mOptionDescriptions[RSK_TRIFORCE_HUNT], IMFLAG_NONE);
|
||||
mOptions[RSK_TRIFORCE_HUNT_PIECES_TOTAL] = Option::U8("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);
|
||||
mOptions[RSK_TRIFORCE_HUNT_PIECES_REQUIRED] = Option::U8("Ornament Hunt Required Pieces", {NumOpts(1, 100)}, OptionCategory::Setting, CVAR_RANDOMIZER_SETTING("TriforceHuntRequiredPieces"), mOptionDescriptions[RSK_TRIFORCE_HUNT_PIECES_REQUIRED], WidgetType::Slider, 19);
|
||||
mOptions[RSK_MQ_DUNGEON_RANDOM] = Option::U8("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);
|
||||
mOptions[RSK_MQ_DUNGEON_COUNT] = Option::U8("MQ Dungeon Count", {NumOpts(0, 12)}, OptionCategory::Setting, CVAR_RANDOMIZER_SETTING("MQDungeonCount"), "", WidgetType::Slider, 12, true, IMFLAG_NONE);
|
||||
mOptions[RSK_MQ_DUNGEON_SET] = Option::Bool("Set Dungeon Quests", {"Off", "On"}, OptionCategory::Setting, CVAR_RANDOMIZER_SETTING("MQDungeonsSelection"), mOptionDescriptions[RSK_MQ_DUNGEON_SET], WidgetType::Checkbox, false, false, IMFLAG_NONE);
|
||||
|
@ -2557,9 +2557,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) {
|
||||
|
Loading…
Reference in New Issue
Block a user