Early version of custom messages.

This commit is contained in:
Christopher Leggett 2022-07-13 20:35:42 -04:00
parent 248f49b3bf
commit e9ba8f734f
No known key found for this signature in database
GPG Key ID: 7093AE5FF7037D79
5 changed files with 21 additions and 0 deletions

View File

@ -2419,6 +2419,17 @@ GetItemID Randomizer::GetRandomizedItemIdFromKnownCheck(RandomizerCheck randomiz
return GetItemFromGet(this->itemLocations[randomizerCheck], ogId);
}
std::string Randomizer::GetCustomGetItemMessage(GetItemID giid) {
if (!gSaveContext.n64ddFlag) {
return "Not Randomized.";
}
switch (giid) {
default:
"There is no custom message for this item.";
}
}
RandomizerCheck Randomizer::GetCheckFromActor(s16 sceneNum, s16 actorId, s16 actorParams) {
if (!gSaveContext.n64ddFlag) {
return RC_UNKNOWN_CHECK;

View File

@ -42,6 +42,7 @@ class Randomizer {
std::string GetHintFromCheck(RandomizerCheck check);
GetItemID GetRandomizedItemIdFromKnownCheck(RandomizerCheck randomizerCheck, GetItemID ogId);
GetItemID GetRandomizedItemId(GetItemID ogId, s16 actorId, s16 actorParams, s16 sceneNum);
std::string GetCustomGetItemMessage(GetItemID giid);
};
#ifdef __cplusplus

View File

@ -1528,3 +1528,8 @@ extern "C" s32 GetRandomizedItemId(GetItemID ogId, s16 actorId, s16 actorParams,
extern "C" s32 GetRandomizedItemIdFromKnownCheck(RandomizerCheck randomizerCheck, GetItemID ogId) {
return OTRGlobals::Instance->gRandomizer->GetRandomizedItemIdFromKnownCheck(randomizerCheck, ogId);
}
extern "C" int Randomizer_GetCustomGetItemMessage(GetItemID giid, char* buffer, const int maxBufferSize) {
const std::string& getItemText = OTRGlobals::Instance->gRandomizer->GetCustomGetItemMessage(giid);
return CopyStringToCharBuffer(getItemText, buffer, maxBufferSize);
}

View File

@ -99,6 +99,7 @@ s16 GetItemModelFromId(s16 itemId);
s32 GetItemIDFromGetItemID(s32 getItemId);
s32 GetRandomizedItemId(GetItemID ogId, s16 actorId, s16 actorParams, s16 sceneNum);
s32 GetRandomizedItemIdFromKnownCheck(RandomizerCheck randomizerCheck, GetItemID ogId);
int Randomizer_GetCustomGetItemMessage(GetItemID giid, char* buffer, const int maxBufferSize);
#endif
#endif

View File

@ -1735,6 +1735,9 @@ void Message_OpenText(GlobalContext* globalCtx, u16 textId) {
} else {
msgCtx->msgLength = font->msgLength = CopyGanonHintText(font->msgBuf, sizeof(font->msgBuf));
}
} else if (gSaveContext.n64ddFlag && textId == 0xF8) {
msgCtx->msgLength = font->msgLength = Randomizer_GetCustomGetItemMessage(
GET_PLAYER(globalCtx)->getItemId, font->msgBuf, sizeof(font->msgBuf));
} else {
msgCtx->msgLength = font->msgLength;
char* src = (uintptr_t)font->msgOffset;