mirror of
https://github.com/HarbourMasters/Shipwright.git
synced 2024-11-16 14:35:06 -05:00
Create const "NaviMsgCount"
So the number of messages doesn't have to be changed in 3 places when adding new entries
This commit is contained in:
parent
e2ff584839
commit
af03a80ad3
@ -4420,11 +4420,12 @@ void CreateScrubMessages() {
|
||||
}
|
||||
|
||||
CustomMessageMinimal NaviMessages[];
|
||||
extern const int NaviMsgCount = 15;
|
||||
|
||||
void CreateNaviRandoMessages() {
|
||||
CustomMessageManager* customMessageManager = CustomMessageManager::Instance;
|
||||
customMessageManager->AddCustomMessageTable(Randomizer::NaviRandoMessageTableID);
|
||||
for (int i = 0; i <= 14; i++) {
|
||||
for (int i = 0; i <= (NaviMsgCount - 1); i++) {
|
||||
customMessageManager->CreateMessage(Randomizer::NaviRandoMessageTableID, i,
|
||||
{ TEXTBOX_TYPE_BLACK, TEXTBOX_POS_BOTTOM, NaviMessages[i].english,
|
||||
NaviMessages[i].german, NaviMessages[i].french });
|
||||
@ -4475,7 +4476,7 @@ void Rando_Init(void) {
|
||||
|
||||
}
|
||||
|
||||
CustomMessageMinimal NaviMessages[15] = {
|
||||
CustomMessageMinimal NaviMessages[NaviMsgCount] = {
|
||||
|
||||
{ "%cMissing a small key in a dungeon?&Maybe the %rboss %chas it!",
|
||||
"%cGerman tip about playing rando! 0",
|
||||
|
@ -1449,8 +1449,10 @@ extern "C" CustomMessageEntry Randomizer_GetScrubMessage(u16 scrubTextId) {
|
||||
return CustomMessageManager::Instance->RetrieveMessage(Randomizer::scrubMessageTableID, price);
|
||||
}
|
||||
|
||||
extern const int NaviMsgCount;
|
||||
|
||||
extern "C" CustomMessageEntry Randomizer_GetNaviMessage() {
|
||||
u16 naviTextId = rand() % 15;
|
||||
u16 naviTextId = rand() % NaviMsgCount;
|
||||
return CustomMessageManager::Instance->RetrieveMessage(Randomizer::NaviRandoMessageTableID, naviTextId);
|
||||
}
|
||||
|
||||
@ -1547,6 +1549,7 @@ extern "C" int CustomMessage_RetrieveIfExists(GlobalContext* globalCtx) {
|
||||
}
|
||||
} else if (textId == TEXT_SCRUB_POH || textId == TEXT_SCRUB_STICK_UPGRADE || textId == TEXT_SCRUB_NUT_UPGRADE) {
|
||||
messageEntry = Randomizer_GetScrubMessage(textId);
|
||||
// In rando, replace Navi's general overworld hints with rando-related gameplay tips
|
||||
} else if (textId >= 0x0140 && textId <= 0x015F) {
|
||||
messageEntry = Randomizer_GetNaviMessage();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user