Shipwright/soh/soh/Enhancements/randomizer/randomizer.h
Ralphie Morell 7964bde063
Rando: Misc. Hints (#1947)
* Added too much

* Added 3d settings and brought over to soh

* fixed conditionals for replacing LA hint

* whoops

* Finshed making settings consistent; minor text edit

* fix leftovers from adding warp hints

* more fixes from merge

* fix skull hint messages

* Added fire temple goron junk hints; menu stuff

* Address feedback

* Added optional scrub text

* whoops

* Add hint cvars to clear preset func

* whoops again

* whoops the third

* ADD: French Pass

* FIXED: Dampe + Skull Reward

* TWEAK: German skulltula hint

* TWEAK: French oopsie

* Address feedback

* whoops

* remove "staticness" from altar/ganon text funcs

* ADD: German

* actually add warp song hints to things;
always generate ganon hint and let OTRGlobals handle showing it

* Fix CVar Getters

* whoops

* for real this time

* Actually implemented scrub text in 3d rando

Co-authored-by: PurpleHato <linkvssangoku.jr@gmail.com>
2023-01-19 23:45:34 -05:00

108 lines
5.0 KiB
C++

#pragma once
#include <unordered_map>
#include <unordered_set>
#include <string>
#include <vector>
#include <libultraship/libultra.h>
#include "z64item.h"
#include <memory>
#include <soh/Enhancements/randomizer/randomizerTypes.h>
#include "soh/Enhancements/randomizer/randomizer_check_objects.h"
#include <soh/Enhancements/custom-message/CustomMessageManager.h>
#include "soh/Enhancements/item-tables/ItemTableTypes.h"
#define NUM_NAVI_MESSAGES 19
#define NUM_ICE_TRAP_MESSAGES 23
#define NUM_GORON_MESSAGES 9
class Randomizer {
private:
std::unordered_map<RandomizerCheck, RandomizerGetData> itemLocations;
std::unordered_map<RandomizerCheck, std::string> hintLocations;
std::string childAltarText;
std::string adultAltarText;
std::string ganonHintText;
std::string ganonText;
std::string dampeText;
std::unordered_map<RandomizerSettingKey, u8> randoSettings;
void ParseRandomizerSettingsFile(const char* spoilerFileName);
void ParseHintLocationsFile(const char* spoilerFileName);
void ParseRequiredTrialsFile(const char* spoilerFileName);
void ParseMasterQuestDungeonsFile(const char* spoilerFileName);
void ParseItemLocationsFile(const char* spoilerFileName, bool silent);
void ParseEntranceDataFile(const char* spoilerFileName, bool silent);
bool IsItemVanilla(RandomizerGet randoGet);
GetItemEntry GetItemEntryFromRGData(RandomizerGetData rgData, GetItemID ogItemId, bool checkObtainability = true);
int16_t GetVanillaMerchantPrice(RandomizerCheck check);
public:
Randomizer();
~Randomizer();
static const std::string getItemMessageTableID;
static const std::string hintMessageTableID;
static const std::string merchantMessageTableID;
static const std::string rupeeMessageTableID;
static const std::string NaviRandoMessageTableID;
static const std::string IceTrapRandoMessageTableID;
static const std::string randoMiscHintsTableID;
// Public for now to be accessed by SaveManager, will be made private again soon :tm:
std::unordered_map<RandomizerInf, bool> trialsRequired;
std::unordered_set<uint16_t> masterQuestDungeons;
std::unordered_map<RandomizerCheck, u16> merchantPrices;
std::unordered_map<RandomizerGet, std::vector<std::string>> EnumToSpoilerfileGetName;
static Sprite* GetSeedTexture(uint8_t index);
s16 GetItemModelFromId(s16 itemId);
s32 GetItemIDFromGetItemID(s32 getItemId);
bool SpoilerFileExists(const char* spoilerFileName);
void LoadRandomizerSettings(const char* spoilerFileName);
void LoadHintLocations(const char* spoilerFileName);
void LoadMerchantMessages(const char* spoilerFileName);
void LoadItemLocations(const char* spoilerFileName, bool silent);
void LoadRequiredTrials(const char* spoilerFileName);
void LoadMasterQuestDungeons(const char* spoilerFileName);
bool IsTrialRequired(RandomizerInf trial);
void LoadEntranceOverrides(const char* spoilerFileName, bool silent);
u8 GetRandoSettingValue(RandomizerSettingKey randoSettingKey);
RandomizerCheck GetCheckFromActor(s16 actorId, s16 sceneNum, s16 actorParams);
RandomizerCheck GetCheckFromRandomizerInf(RandomizerInf randomizerInf);
RandomizerInf GetRandomizerInfFromCheck(RandomizerCheck rc);
RandomizerGetData GetRandomizerGetDataFromActor(s16 actorId, s16 sceneNum, s16 actorParams);
RandomizerGetData GetRandomizerGetDataFromKnownCheck(RandomizerCheck randomizerCheck);
std::string GetChildAltarText() const;
std::string GetAdultAltarText() const;
std::string GetGanonText() const;
std::string GetGanonHintText() const;
std::string GetDampeText() const;
RandomizerCheckObject GetCheckObjectFromActor(s16 actorId, s16 sceneNum, s32 actorParams);
ScrubIdentity IdentifyScrub(s32 sceneNum, s32 actorParams, s32 respawnData);
ShopItemIdentity IdentifyShopItem(s32 sceneNum, u8 slotIndex);
CowIdentity IdentifyCow(s32 sceneNum, s32 posX, s32 posZ);
GetItemEntry GetItemFromKnownCheck(RandomizerCheck randomizerCheck, GetItemID ogItemId, bool checkObtainability = true);
GetItemEntry GetItemFromActor(s16 actorId, s16 sceneNum, s16 actorParams, GetItemID ogItemId, bool checkObtainability = true);
GetItemID GetItemIdFromRandomizerGet(RandomizerGet randoGet, GetItemID ogItemId);
ItemObtainability GetItemObtainabilityFromRandomizerCheck(RandomizerCheck randomizerCheck);
ItemObtainability GetItemObtainabilityFromRandomizerGet(RandomizerGet randomizerCheck);
CustomMessageEntry GetWarpSongMessage(u16 textId, bool mysterious = false);
CustomMessageEntry GetMerchantMessage(RandomizerInf randomizerInf, u16 textId, bool mysterious = false);
CustomMessageEntry GetCursedSkullMessage(s16 params);
CustomMessageEntry GetGoronMessage(u16 index);
CustomMessageEntry GetMapGetItemMessageWithHint(GetItemEntry itemEntry);
static void CreateCustomMessages();
static CustomMessageEntry GetRupeeMessage(u16 rupeeTextId);
bool CheckContainsVanillaItem(RandomizerCheck randoCheck);
};
#ifdef __cplusplus
extern "C" {
#endif
void Rando_Init(void);
#ifdef __cplusplus
}
#endif