mirror of
https://github.com/HarbourMasters/Shipwright
synced 2026-06-25 18:24:27 -04:00
4166dbf907
* Rough mockup of LUS XML loading * Updated code for merge * Loading from FS support and custom DList WIP implementation * Added current directory support to F3D and impl most of the dlist cmds * WIP Skeleton support * Almost done * Rebase fixes * Submodule updates * HD Texture Support * Fixes * bump lus * fix exporter build, header update * soh builds * setMesh image path cleanup * Update soh/src/overlays/actors/ovl_player_actor/z_player.c * Update soh/src/overlays/actors/ovl_player_actor/z_player.c * Update OTRExporter/OTRExporter/Main.cpp * Update ZAPDTR/ZAPD/ZResource.h * Update soh/src/code/z_skelanime.c * Update OTRExporter/OTRExporter/Main.cpp * Fixed jpeg backgrounds and decreased icon buffer size * Bump lus * Increased even more the buffer because it crashes on long texts * Removed print because sometimes the if is not triggered when the image is already byteswapped * fix non-windows build * fix build Co-authored-by: Kenix <kenixwhisperwind@gmail.com> * add hd checkbox * Various fixes for custom model support (#23) * Some fixes * Updated LUS Version * Fixed issue with Link Skirt on pause menu * Added CVar for custom link model changes * Fixed headers * Additional header fixes * Tweaks * Unload HD game assets on scene transition. (#16) * Unload game assets on scene transition. * Bump LUS * Unloads all HD assets on scene transition. * Only unload hd assets if hd assets are turned on. * Fixes issues on toggling between HD and non HD assets. --------- Co-authored-by: briaguya <briaguya@alice> * fix: actually load hd debug font (#27) * fix: actually load hd debug font * toggle debug text correctly --------- Co-authored-by: briaguya <briaguya> * Yes. (#28) * Merge branch 'develop' into dev-to-ghost * HD Skeleton Swapping and Language Fixes (#32) * Yes. * HD Skeleton Swapping and Language Fixes * Test * Fixed issues with ganon cape (#34) * Fixed Bongo Bongo Crash (#35) * Added HD Assets Toggle (#37) * Ivan the Fairy - Coop Mode (#36) * wip * hookshotable ivan * added hookshot item * new items & changes & fixes & restored navi * farore, din and nayru's spells are done * fixed slingshot & bow * added more items supported * done with all main items * bug fixes & ready * added imgui button * wip * hookshotable ivan * added hookshot item * new items & changes & fixes & restored navi * farore, din and nayru's spells are done * fixed slingshot & bow * added more items supported * fix own dungeon items on shuffled boss rooms (#2683) * bump lus (#2692) * fix: lowercase package names for vcpkg (#2693) vcpkg was throwing an error `error: invalid character in package name (must be lowercase, digits, '-')` this updates our calls to `vcpkg_install_packages` to use lowercase package names instead of uppercase * fix death mountain cloud in rando (#2691) * Fix: Switch Age No Longer Reloads Start Room (#2679) * [Reduced Clutter] Disable Hot/Underwater Warning Text (#2684) * Disable Warning Text * Moved to Reduced Clutter * done with all main items * bug fixes & ready * fix: process roms in consistent order (#2696) * chore: move rando savefile setup and document flags (#2697) * remove rando save init from sram * move rando savefile init logic and set more flags * document flags for rando save creation * Fix: Use correct fps value for frame interpolation with match refresh rate (#2694) * Fix: Kak GS placement on construction site (#2695) * added imgui button * addressed kenix's comments * fixed useless null * added rupee dash mode in extra modes * changed menu position --------- Co-authored-by: Adam Bird <Archez@users.noreply.github.com> Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com> Co-authored-by: inspectredc <78732756+inspectredc@users.noreply.github.com> Co-authored-by: Patrick12115 <115201185+Patrick12115@users.noreply.github.com> * LUS Scancodes (#42) * Added HD Assets Toggle * Switched out SDL for LUS scancodes * Ivan tweaks (#45) * Magic consumption slowed down; Bosses now affected by Ivan's Din spell * Adjust magic timer * clean up imgui * model fixes/improvements (#50) * replace `gUseCustomLinkModel` with custom resource check * handle adult/child * bump lus * fix model switching with tab * use lus main * fix carpet man (#52) Co-authored-by: Rozelette <Rozelette@users.noreply.github.com> * get ship model and lus texture into soh.otr, use `gAuthenticLogo` to toggle between ship and authentic (#55) * Use libultra features for CPU-modified textures (#40) * Use libultra features for CPU-modified textures * Comment * bump lus on ghost (#58) * fix: properly use `Interface_LoadActionLabel` to display start button text (#61) * Changes hd -> alt for texture replacement. (#65) * Changes hd -> alt for texture replacement. * Renames variables in gfxprint for hd -> alt change. * Update soh/soh/resource/type/Skeleton.cpp --------- Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com> * Fixes kaleido dungeon maps (#67) * skeleton stuff (#69) * comment out wii u build (#70) * bump lus (#71) * Rework readme (#72) * Update README.md * docs * put custom music docs somewhere * Update README.md * Update README.md * Update README.md * Update README.md * dark/light title image * lus * Update README.md * Fixed vanilla minimap (#73) * Fixed vanilla minimap * Workaround for pulsing SD maps with non-broken HD maps. --------- Co-authored-by: Christopher Leggett <chris@leggett.dev> * Skeleton fix fixed (#75) * WIP skelton patcher fix * Fixes skeleton reference change. * Adds const back to name in ResourceMgr_LoadSkeletonByName --------- Co-authored-by: Christopher Leggett <chris@leggett.dev> Co-authored-by: Kenix <kenixwhisperwind@gmail.com> * Fixes z_message_otr memory leak. * Update soh/soh/z_message_OTR.cpp * Update soh/src/code/game.c * docs: add how to find otr files to switch instructions (#78) * bump lus (#79) * comment out RegisterBlendedTexture in king d (#80) --------- Co-authored-by: Nicholas Estelami <NEstelami@users.noreply.github.com> Co-authored-by: David Chavez <david@dcvz.io> Co-authored-by: briaguya <briaguya@alice> Co-authored-by: Kenix3 <kenixwhisperwind@gmail.com> Co-authored-by: KiritoDv <kiritodev01@gmail.com> Co-authored-by: briaguya <briaguya> Co-authored-by: Ralphie Morell <stratomaster64@gmail.com> Co-authored-by: MelonSpeedruns <melonspeedruns@outlook.com> Co-authored-by: Adam Bird <Archez@users.noreply.github.com> Co-authored-by: inspectredc <78732756+inspectredc@users.noreply.github.com> Co-authored-by: Patrick12115 <115201185+Patrick12115@users.noreply.github.com> Co-authored-by: Rozelette <Rozelette@users.noreply.github.com> Co-authored-by: Christopher Leggett <chris@leggett.dev> Co-authored-by: Lywx <36680385+KiritoDv@users.noreply.github.com>
183 lines
9.4 KiB
C++
183 lines
9.4 KiB
C++
#include "OTRGlobals.h"
|
|
#include <ResourceMgr.h>
|
|
#include "soh/resource/type/Scene.h"
|
|
#include <Utils/StringHelper.h>
|
|
#include "global.h"
|
|
#include "vt.h"
|
|
#include "soh/resource/type/Text.h"
|
|
#include <message_data_static.h>
|
|
#include "Enhancements/custom-message/CustomMessageManager.h"
|
|
#include "Enhancements/custom-message/CustomMessageTypes.h"
|
|
|
|
extern "C" MessageTableEntry* sNesMessageEntryTablePtr;
|
|
extern "C" MessageTableEntry* sGerMessageEntryTablePtr;
|
|
extern "C" MessageTableEntry* sFraMessageEntryTablePtr;
|
|
extern "C" MessageTableEntry* sStaffMessageEntryTablePtr;
|
|
//extern "C" MessageTableEntry* _message_0xFFFC_nes;
|
|
|
|
MessageTableEntry* OTRMessage_LoadTable(const char* filePath, bool isNES) {
|
|
auto file = std::static_pointer_cast<Ship::Text>(OTRGlobals::Instance->context->GetResourceManager()->LoadResource(filePath));
|
|
|
|
if (file == nullptr)
|
|
return nullptr;
|
|
|
|
// Allocate room for an additional message
|
|
// OTRTODO: Should not be malloc'ing here. It's fine for now since we check elsewhere that the message table is
|
|
// already null.
|
|
MessageTableEntry* table = (MessageTableEntry*)malloc(sizeof(MessageTableEntry) * (file->messages.size() + 1));
|
|
|
|
for (size_t i = 0; i < file->messages.size(); i++) {
|
|
// Look for Owl Text
|
|
if (file->messages[i].id == 0x2066) {
|
|
// Create a new message based on the Owl Text
|
|
uint32_t kaeporaMsgSize = file->messages[i].msg.size();
|
|
// OTRTODO: Should not be malloc'ing here. It's fine for now since we check elsewhere that the message table
|
|
// is already null.
|
|
char* kaeporaOg = (char*)malloc(sizeof(char) * kaeporaMsgSize);
|
|
char* kaeporaPatch = (char*)malloc(sizeof(char) * kaeporaMsgSize);
|
|
file->messages[i].msg.copy(kaeporaOg, kaeporaMsgSize, 0);
|
|
file->messages[i].msg.copy(kaeporaPatch, kaeporaMsgSize, 0);
|
|
|
|
size_t colorPos = file->messages[i].msg.find(QM_GREEN);
|
|
size_t newLinePos = colorPos + file->messages[i].msg.substr(colorPos + 1).find(CTRL_NEWLINE) + 1;
|
|
size_t endColorPos = newLinePos + file->messages[i].msg.substr(newLinePos).find(CTRL_COLOR);
|
|
size_t NoLength = newLinePos - (colorPos + 1);
|
|
size_t YesLength = endColorPos - (newLinePos + 1);
|
|
// Swap the order of yes and no in this new message
|
|
size_t yes = 0;
|
|
while (yes < YesLength) {
|
|
kaeporaPatch[colorPos + yes + 1] = kaeporaOg[newLinePos + yes + 1];
|
|
yes++;
|
|
}
|
|
kaeporaPatch[colorPos + yes + 1] = CTRL_NEWLINE;
|
|
size_t no = 0;
|
|
while (no < NoLength) {
|
|
kaeporaPatch[colorPos + yes + 2 + no] = kaeporaOg[colorPos + 1 + no];
|
|
no++;
|
|
}
|
|
|
|
// load data into message
|
|
table[file->messages.size()].textId = 0x71B3;
|
|
table[file->messages.size()].typePos = (file->messages[i].textboxType << 4) | file->messages[i].textboxYPos;
|
|
table[file->messages.size()].segment = kaeporaPatch;
|
|
table[file->messages.size()].msgSize = kaeporaMsgSize;
|
|
}
|
|
|
|
table[i].textId = file->messages[i].id;
|
|
table[i].typePos = (file->messages[i].textboxType << 4) | file->messages[i].textboxYPos;
|
|
table[i].segment = file->messages[i].msg.c_str();
|
|
table[i].msgSize = file->messages[i].msg.size();
|
|
|
|
if (isNES && file->messages[i].id == 0xFFFC)
|
|
_message_0xFFFC_nes = (char*)file->messages[i].msg.c_str();
|
|
}
|
|
|
|
return table;
|
|
}
|
|
|
|
extern "C" void OTRMessage_Init()
|
|
{
|
|
// OTRTODO: Added a lot of null checks here so that we don't malloc the table multiple times causing a memory leak.
|
|
// We really ought to fix the implementation such that we aren't malloc'ing new tables.
|
|
// Once we fix the implementation, remove these NULL checks.
|
|
if (sNesMessageEntryTablePtr == NULL) {
|
|
sNesMessageEntryTablePtr = OTRMessage_LoadTable("text/nes_message_data_static/nes_message_data_static", true);
|
|
}
|
|
if (sGerMessageEntryTablePtr == NULL) {
|
|
sGerMessageEntryTablePtr = OTRMessage_LoadTable("text/ger_message_data_static/ger_message_data_static", false);
|
|
}
|
|
if (sFraMessageEntryTablePtr == NULL) {
|
|
sFraMessageEntryTablePtr = OTRMessage_LoadTable("text/fra_message_data_static/fra_message_data_static", false);
|
|
}
|
|
|
|
if (sStaffMessageEntryTablePtr == NULL) {
|
|
auto file2 =
|
|
std::static_pointer_cast<Ship::Text>(OTRGlobals::Instance->context->GetResourceManager()->LoadResource(
|
|
"text/staff_message_data_static/staff_message_data_static"));
|
|
// OTRTODO: Should not be malloc'ing here. It's fine for now since we check that the message table is already null.
|
|
sStaffMessageEntryTablePtr = (MessageTableEntry*)malloc(sizeof(MessageTableEntry) * file2->messages.size());
|
|
|
|
for (size_t i = 0; i < file2->messages.size(); i++) {
|
|
sStaffMessageEntryTablePtr[i].textId = file2->messages[i].id;
|
|
sStaffMessageEntryTablePtr[i].typePos =
|
|
(file2->messages[i].textboxType << 4) | file2->messages[i].textboxYPos;
|
|
sStaffMessageEntryTablePtr[i].segment = file2->messages[i].msg.c_str();
|
|
sStaffMessageEntryTablePtr[i].msgSize = file2->messages[i].msg.size();
|
|
}
|
|
}
|
|
|
|
CustomMessageManager::Instance->AddCustomMessageTable(customMessageTableID);
|
|
CustomMessageManager::Instance->CreateGetItemMessage(
|
|
customMessageTableID, (GetItemID)TEXT_GS_NO_FREEZE, ITEM_SKULL_TOKEN,
|
|
{
|
|
TEXTBOX_TYPE_BLUE, TEXTBOX_POS_BOTTOM,
|
|
"You got a %rGold Skulltula Token%w!&You've collected %r{{gsCount}}%w tokens&in total!\x0E\x3C",
|
|
"Ein %rGoldenes Skulltula-Symbol%w!&Du hast nun insgesamt %r{{gsCount}}&%wGoldene Skulltula-Symbole&gesammelt!\x0E\x3C",
|
|
"Vous obtenez un %rSymbole de&Skulltula d'or%w! Vous avez&collecté %r{{gsCount}}%w symboles en tout!\x0E\x3C"
|
|
}
|
|
);
|
|
CustomMessageManager::Instance->CreateGetItemMessage(
|
|
customMessageTableID, (GetItemID)TEXT_GS_FREEZE, ITEM_SKULL_TOKEN,
|
|
{
|
|
TEXTBOX_TYPE_BLUE, TEXTBOX_POS_BOTTOM,
|
|
"You got a %rGold Skulltula Token%w!&You've collected %r{{gsCount}}%w tokens&in total!",
|
|
"Ein %rGoldenes Skulltula-Symbol%w!&Du hast nun insgesamt %r{{gsCount}}&%wGoldene Skulltula-Symbole&gesammelt!",
|
|
"Vous obtenez un %rSymbole de&Skulltula d'or%w! Vous avez&collecté %r{{gsCount}}%w symboles en tout!"
|
|
}
|
|
);
|
|
CustomMessageManager::Instance->CreateMessage(
|
|
customMessageTableID, TEXT_BUY_BOMBCHU_10_DESC,
|
|
{
|
|
TEXTBOX_TYPE_BLACK, TEXTBOX_POS_BOTTOM,
|
|
"\x08%rBombchu (10 pieces) 99 Rupees&%wThis looks like a toy mouse, but&it's actually a self-propelled time&bomb!\x09\x0A",
|
|
"\x08%rKrabbelmine 10 Stück 99 Rubine&%wDas ist eine praktische Zeitbombe,&die Du als Distanzwaffe&einsetzen kannst!\x09\x0A",
|
|
"\x08%rMissile 10 unités 99 Rubis&%wProfilée comme une souris&mécanique, cette arme est &destructrice!!!\x09\x0A",
|
|
}
|
|
);
|
|
CustomMessageManager::Instance->CreateMessage(
|
|
customMessageTableID, TEXT_BUY_BOMBCHU_10_PROMPT,
|
|
{
|
|
TEXTBOX_TYPE_BLACK, TEXTBOX_POS_BOTTOM,
|
|
"\x08" "Bombchu 10 pieces 99 Rupees\x09&&\x1B%gBuy&Don't buy%w",
|
|
"\x08Krabbelmine 10 Stück 99 Rubine\x09&&\x1B%gKaufen!&Nicht kaufen!%w",
|
|
"\x08Missiles 10 unités 99 Rubis\x09&&\x1B%gAcheter&Ne pas acheter%w",
|
|
}
|
|
);
|
|
CustomMessageManager::Instance->CreateGetItemMessage(
|
|
customMessageTableID, (GetItemID)TEXT_HEART_CONTAINER, ITEM_HEART_CONTAINER,
|
|
{
|
|
TEXTBOX_TYPE_BLUE, TEXTBOX_POS_BOTTOM,
|
|
"You got a %rHeart Container%w!&You've collected %r{{heartContainerCount}}%w containers&in total!",
|
|
"Ein %rHerzcontainer%w!&Du hast nun insgesamt %r{{heartContainerCount}}%w&Herzcontainer gesammelt!",
|
|
"Vous obtenez un %rCoeur&d'Energie%w! Vous en avez&collecté %r{{heartContainerCount}}%w en tout!"
|
|
}
|
|
);
|
|
CustomMessageManager::Instance->CreateGetItemMessage(
|
|
customMessageTableID, (GetItemID)TEXT_HEART_PIECE, ITEM_HEART_PIECE,
|
|
{
|
|
TEXTBOX_TYPE_BLUE, TEXTBOX_POS_BOTTOM,
|
|
"You got a %rHeart Piece%w!&You've collected %r{{heartPieceCount}}%w pieces&in total!",
|
|
"Ein %rHerzteil%w!&Du hast nun insgesamt %r{{heartPieceCount}}%w&Herteile gesammelt!",
|
|
"Vous obtenez un %rQuart de&Coeur%w! Vous en avez collecté&%r{{heartPieceCount}}%w en tout!"
|
|
}
|
|
);
|
|
CustomMessageManager::Instance->CreateMessage(
|
|
customMessageTableID, TEXT_MARKET_GUARD_NIGHT,
|
|
{
|
|
TEXTBOX_TYPE_BLACK, TEXTBOX_POS_BOTTOM,
|
|
"You look bored. Wanna go out for a&walk?\x1B&%gYes&No%w",
|
|
"Du siehst gelangweilt aus.&Willst du einen Spaziergang machen?\x1B&%gJa&Nein%w",
|
|
"Tu as l'air de t'ennuyer. Tu veux&aller faire un tour?\x1B&%gOui&Non%w",
|
|
}
|
|
);
|
|
CustomMessageManager::Instance->CreateMessage(
|
|
customMessageTableID, TEXT_RANDO_SAVE_VERSION_WARNING,
|
|
{
|
|
TEXTBOX_TYPE_NONE_BOTTOM, TEXTBOX_POS_BOTTOM,
|
|
"This save was created on&a different version of SoH.&&Things may be broken.",
|
|
"Dieser Spielstand wurde auf einer&anderen Version von SoH erstellt.&&Es könnten Fehler auftreten.",
|
|
"Cette sauvegarde a été créée sur&une version différente de SoH.&Certaines fonctionnalités&peuvent être corrompues.",
|
|
}
|
|
);
|
|
}
|