diff options
author | Treeki <treeki@gmail.com> | 2013-11-17 20:42:06 +0100 |
---|---|---|
committer | Treeki <treeki@gmail.com> | 2013-11-17 20:42:06 +0100 |
commit | c220e400436703c71adf2b49a04a863b72c41d29 (patch) | |
tree | 5d615b6834ee24233549a5ee4860f363c6e50185 /src | |
parent | d55debf80b417793ce924ec977ed3a16413fd5d6 (diff) | |
download | kamek-c220e400436703c71adf2b49a04a863b72c41d29.tar.gz kamek-c220e400436703c71adf2b49a04a863b72c41d29.zip |
broken translations and shit, possibly final commit before public releaselevel-select
Diffstat (limited to '')
-rw-r--r-- | src/koopatlas/core.cpp | 41 | ||||
-rw-r--r-- | src/koopatlas/hud.cpp | 18 | ||||
-rw-r--r-- | src/koopatlas/shop.cpp | 20 | ||||
-rw-r--r-- | src/koopatlas/starcoin.cpp | 12 | ||||
-rw-r--r-- | src/levelinfo.cpp | 6 | ||||
-rw-r--r-- | src/levelinfo.h | 6 | ||||
-rw-r--r-- | src/msgbox.cpp | 35 | ||||
-rw-r--r-- | src/msgbox.h | 16 | ||||
-rw-r--r-- | src/newer.cpp | 22 | ||||
-rw-r--r-- | src/pregame.cpp | 13 | ||||
-rw-r--r-- | src/randomcrap.S | 13 |
11 files changed, 75 insertions, 127 deletions
diff --git a/src/koopatlas/core.cpp b/src/koopatlas/core.cpp index 40776c8..8712da7 100644 --- a/src/koopatlas/core.cpp +++ b/src/koopatlas/core.cpp @@ -518,6 +518,7 @@ void dScKoopatlas_c::endState_ContinueWait() { void dScKoopatlas_c::executeState_Normal() { + // ghb if (pathManager.completionMessagePending) { OSReport("Going to set CompletionMsg\n"); state.setState(&StateID_CompletionMsg); @@ -1081,37 +1082,21 @@ void dScKoopatlas_c::showSaveWindow() { yesNoWindow->visible = true; } -static const wchar_t *completionMsgs[] = { - L"The most erudite of Buttocks", - L"You've collected all of\nthe \x0B\x014F\xBEEF Star Coins in\n", - L"You have gotten every \x0B\x013B\xBEEF exit\nin", - L"You have gotten everything\nin", - L"You have collected all the\nnecessary \x0B\x014F\xBEEF coins to enter\nthe Special World!", - L"You have collected all the \x0B\x014F\xBEEF Star\nCoins in the game!", - L"You've found every \x0B\x013B\xBEEF exit in the\ngame!", - L"You've completed everything in\nNEWER SUPER MARIO BROS. Wii!\n\nWe present you a new quest.\nTry pressing \x0B\x0122\xBEEF, \x0B\x0123\xBEEF and \x0B\x0125\xBEEF\n on the Star Coin menu." -}; - void dScKoopatlas_c::beginState_CompletionMsg() { + if (pathManager.completionMessageType == 0) + pathManager.completionMessageType = 1; OSReport("CompletionMsg beginning with type %d\n", pathManager.completionMessageType); - static const int ynTypes[8] = { - /*NULL*/ -1, - /*COINS*/ 14, - /*EXITS*/ 7, - /*WORLD*/ 8, - /*COINS EXC W9*/ 9, - /*GLOBAL COINS*/ 11, - /*GLOBAL EXITS*/ 27, - /*EVERYTHING*/ 21 - }; - yesNoWindow->type = ynTypes[pathManager.completionMessageType]; + yesNoWindow->type = 21; yesNoWindow->visible = true; mustFixYesNoText = 10; // hacky shit } void dScKoopatlas_c::endState_CompletionMsg() { + // ghb pathManager.completionMessagePending = false; pathManager.completionMessageType = 0; + //pathManager.completionMessagePending = true; + //pathManager.completionMessageType ++; } void dScKoopatlas_c::executeState_CompletionMsg() { @@ -1121,16 +1106,20 @@ void dScKoopatlas_c::executeState_CompletionMsg() { int type = pathManager.completionMessageType; - const wchar_t *baseText = completionMsgs[type]; + dScript::Res_c *bmg = GetBMG(); + + const wchar_t *baseText = bmg->findStringForMessageID(9000, type); + // Used when we assemble a dynamic message wchar_t text[512]; if (type >= CMP_MSG_COINS && type <= CMP_MSG_WORLD) { // title int w = pathManager.completionMessageWorldNum; + // ghb + //w = 1; int l = ((w == 5) || (w == 7)) ? 101 : 100; - dLevelInfo_c::entry_s *titleEntry = dLevelInfo_c::s_info.searchByDisplayNum(w, l); - const char *title = dLevelInfo_c::s_info.getNameForLevel(titleEntry); + const wchar_t *title = bmg->findStringForMessageID(8000+w, l); // assemble the string @@ -1140,7 +1129,7 @@ void dScKoopatlas_c::executeState_CompletionMsg() { text[pos++] = ' '; while (*title) { - char chr = *(title++); + wchar_t chr = *(title++); if (chr != '-') text[pos++] = chr; } diff --git a/src/koopatlas/hud.cpp b/src/koopatlas/hud.cpp index dceddb8..50899a7 100644 --- a/src/koopatlas/hud.cpp +++ b/src/koopatlas/hud.cpp @@ -227,19 +227,9 @@ void dWMHud_c::loadHeaderInfo() { } // LEVEL NAME - wchar_t convertedLevelName[100]; - const char *sourceLevelName = levelInfo->getNameForLevel(infEntry); - int charCount = 0; - - while (*sourceLevelName != 0 && charCount < 99) { - convertedLevelName[charCount] = *sourceLevelName; - sourceLevelName++; - charCount++; - } - convertedLevelName[charCount] = 0; - - LevelName->SetString(convertedLevelName); - LevelNameS->SetString(convertedLevelName); + dScript::Res_c *bmg = GetBMG(); + Newer_WriteBMGToTextBox(LevelName, bmg, 8000+infEntry->worldSlot+1, infEntry->levelSlot+1, 0); + Newer_WriteBMGToTextBox(LevelNameS, bmg, 8000+infEntry->worldSlot+1, infEntry->levelSlot+1, 0); // a hack because I don't feel like editing the rlyt LevelName->size.x = LevelNameS->size.x = 400.0f; @@ -326,7 +316,7 @@ void dWMHud_c::loadHeaderInfo() { if (LevelName->tagProc != 0) tw.tagProcessor = LevelName->tagProc; - float width = tw.CalcStringWidth(convertedLevelName, charCount); + float width = tw.CalcStringWidth(LevelName->stringBuf, LevelName->stringLength); float totalWidth = width + LevelName->trans.x - 20.0f; if (totalWidth < currentPos) totalWidth = currentPos; diff --git a/src/koopatlas/shop.cpp b/src/koopatlas/shop.cpp index 6f9566e..1ab6458 100644 --- a/src/koopatlas/shop.cpp +++ b/src/koopatlas/shop.cpp @@ -538,23 +538,9 @@ void dWMShop_c::loadInfo() { rightCol.colourise(save->hudHintH, save->hudHintS, save->hudHintL); // find out the shop name - dLevelInfo_c::entry_s *shopNameEntry = - dLevelInfo_c::s_info.searchBySlot(shopKind, 98); - - wchar_t shopName[100]; - // TODO: refactor this a bit - const char *sourceName = dLevelInfo_c::s_info.getNameForLevel(shopNameEntry); - int charCount = 0; - - while (*sourceName != 0 && charCount < 99) { - shopName[charCount] = *sourceName; - sourceName++; - charCount++; - } - shopName[charCount] = 0; - - Title->SetString(shopName); - TitleShadow->SetString(shopName); + dScript::Res_c *bmg = GetBMG(); + Newer_WriteBMGToTextBox(Title, bmg, 8000+shopKind+1, 99, 0); + Newer_WriteBMGToTextBox(TitleShadow, bmg, 8000+shopKind+1, 99, 0); // load the coin count int scCount = getUnspentStarCoinCount(); diff --git a/src/koopatlas/starcoin.cpp b/src/koopatlas/starcoin.cpp index 8cb819b..e81a347 100644 --- a/src/koopatlas/starcoin.cpp +++ b/src/koopatlas/starcoin.cpp @@ -239,6 +239,7 @@ void dWMStarCoin_c::loadInfo() { } void dWMStarCoin_c::loadSectionInfo() { + dScript::Res_c *bmg = GetBMG(); dLevelInfo_c::entry_s *visibleLevels[COLUMN_COUNT][ROW_COUNT]; // reset everything... everything @@ -262,9 +263,9 @@ void dWMStarCoin_c::loadSectionInfo() { SaveBlock *save = GetSaveFile()->GetBlock(-1); dLevelInfo_c *linfo = &dLevelInfo_c::s_info; - dLevelInfo_c::entry_s *names[COLUMN_COUNT]; + const wchar_t *names[COLUMN_COUNT]; for (int i = 0; i < COLUMN_COUNT; i++) - names[i] = linfo->searchByDisplayNum(currentSection, 100+i); + names[i] = bmg->findStringForMessageID(8000+currentSection, 100+i); bool useSubworlds = (COLUMN_COUNT > 1) && names[1]; @@ -321,9 +322,10 @@ void dWMStarCoin_c::loadSectionInfo() { names[1] = 0; // work out the names - WriteAsciiToTextBox(LeftTitle, linfo->getNameForLevel(names[0])); + LeftTitle->SetString(names[0]); + if (names[1]) - WriteAsciiToTextBox(RightTitle, linfo->getNameForLevel(names[1])); + RightTitle->SetString(names[1]); RightTitle->SetVisible(names[1] != 0); // load all level info @@ -351,7 +353,7 @@ void dWMStarCoin_c::loadSectionInfo() { } LevelName[col][row]->SetVisible(true); - WriteAsciiToTextBox(LevelName[col][row], linfo->getNameForLevel(level)); + Newer_WriteBMGToTextBox(LevelName[col][row], bmg, 8000+level->worldSlot+1, level->levelSlot+1, 0); } } diff --git a/src/levelinfo.cpp b/src/levelinfo.cpp index 1b71e70..59bca37 100644 --- a/src/levelinfo.cpp +++ b/src/levelinfo.cpp @@ -33,12 +33,6 @@ void dLevelInfo_c::load(void *buffer) { if (level->levelSlot < 42)
SetSomeConditionShit(level->worldSlot, level->levelSlot, level->flags);
-
- char *name = (char*)getNameForLevel(level);
-
- for (int i = 0; i < level->nameLength+1; i++) {
- name[i] -= 0xD0;
- }
}
}
}
diff --git a/src/levelinfo.h b/src/levelinfo.h index d0eee1a..e8e4ea7 100644 --- a/src/levelinfo.h +++ b/src/levelinfo.h @@ -19,7 +19,7 @@ public: u8 nameLength;
u8 reserved3;
u16 flags;
- u32 nameOffset;
+ u32 nameOffset; // NO LONGER USED
};
struct section_s {
@@ -44,10 +44,6 @@ public: return (section_s*)(((char*)data) + data->sectionOffsets[index]);
}
- const char *getNameForLevel(entry_s *entry) {
- return (const char*)data + entry->nameOffset;
- }
-
static dLevelInfo_c s_info;
};
diff --git a/src/msgbox.cpp b/src/msgbox.cpp index 829fcb3..4f8a958 100644 --- a/src/msgbox.cpp +++ b/src/msgbox.cpp @@ -78,23 +78,11 @@ int dMsgBoxManager_c::onDelete() { MessageBoxIsShowing = false; if (canCancel && StageC4::instance) StageC4::instance->_1D = 0; // disable no-pause - msgDataLoader.unload(); return layout.free(); } /*****************************************************************************/ -// Load Resources -CREATE_STATE_E(dMsgBoxManager_c, LoadRes); - -void dMsgBoxManager_c::executeState_LoadRes() { - if (msgDataLoader.load("/NewerRes/Messages.bin")) { - state.setState(&StateID_Wait); - } else { - } -} - -/*****************************************************************************/ // Waiting CREATE_STATE_E(dMsgBoxManager_c, Wait); @@ -111,25 +99,14 @@ void dMsgBoxManager_c::showMessage(int id, bool canCancel, int delay) { } // get the data file - header_s *data = (header_s*)msgDataLoader.buffer; + dScript::Res_c *bmg = GetBMG(); - const wchar_t *title = 0, *msg = 0; - - for (int i = 0; i < data->count; i++) { - if (data->entry[i].id == id) { - title = (const wchar_t*)((u32)data + data->entry[i].titleOffset); - msg = (const wchar_t*)((u32)data + data->entry[i].msgOffset); - break; - } - } - - if (title == 0) { - OSReport("Message Box: Message %08x not found\n", id); - return; - } + nw4r::lyt::TextBox *tb = layout.findTextBoxByName("T_title"); + nw4r::lyt::TextBox *mb = layout.findTextBoxByName("T_msg"); + mb->alignment = (2*3) + 3; - layout.findTextBoxByName("T_title")->SetString(title); - layout.findTextBoxByName("T_msg")->SetString(msg); + Newer_WriteBMGToTextBox(tb, bmg, 110000 + (id >> 8), id & 0xFF, 0); + Newer_WriteBMGToTextBox(mb, bmg, 100000 + (id >> 8), id & 0xFF, 0); this->canCancel = canCancel; this->delay = delay; diff --git a/src/msgbox.h b/src/msgbox.h index 22ae812..f2d0e16 100644 --- a/src/msgbox.h +++ b/src/msgbox.h @@ -7,7 +7,7 @@ class dMsgBoxManager_c : public dStageActor_c { public: void showMessage(int id, bool canCancel=true, int delay=-1); - dMsgBoxManager_c() : state(this, &StateID_LoadRes) { } + dMsgBoxManager_c() : state(this, &StateID_Wait) { } int onCreate(); int onDelete(); @@ -20,7 +20,6 @@ class dMsgBoxManager_c : public dStageActor_c { int afterDraw(int) { return true; } m2d::EmbedLayout_c layout; - dDvdLoader_c msgDataLoader; bool layoutLoaded; bool visible; @@ -31,7 +30,6 @@ class dMsgBoxManager_c : public dStageActor_c { dStateWrapper_c<dMsgBoxManager_c> state; USING_STATES(dMsgBoxManager_c); - DECLARE_STATE(LoadRes); DECLARE_STATE(Wait); DECLARE_STATE(BoxAppearWait); DECLARE_STATE(ShownWait); @@ -39,17 +37,5 @@ class dMsgBoxManager_c : public dStageActor_c { static dMsgBoxManager_c *instance; static dMsgBoxManager_c *build(); - - private: - struct entry_s { - u32 id; - u32 titleOffset; - u32 msgOffset; - }; - - struct header_s { - u32 count; - entry_s entry[1]; - }; }; #endif /* MSGBOX_H */ diff --git a/src/newer.cpp b/src/newer.cpp index f1da7fc..4183bf5 100644 --- a/src/newer.cpp +++ b/src/newer.cpp @@ -165,3 +165,25 @@ extern "C" GEIFS *GrabExitInfoForFileSelect(GEIFS *out, SaveBlock *save) { } +void Newer_WriteBMGToTextBox_VAList(nw4r::lyt::TextBox *textBox, dScript::Res_c *res, int category, int message, int argCount, va_list *args) { + GameMgrP->layoutShadowFlag = false; + if (textBox->GetExtUserDataNum()) + CheckForUSD1ShadowEntry(textBox); + + GameMgrP->msgCategory = category; + GameMgrP->msgID = message; + + const wchar_t *str = res->findStringForMessageID(category, message); + WriteParsedStringToTextBox(textBox, str, argCount, args, res); +} +void Newer_WriteBMGToTextBox(nw4r::lyt::TextBox *textBox, dScript::Res_c *res, int category, int message, int argCount, ...) { + va_list vl; + + // from CW PPC cstdarg + ((void)argCount, __builtin_va_info(&vl)); + + Newer_WriteBMGToTextBox_VAList(textBox, res, category, message, argCount, &vl); + + // CW PPC cstdarg defines this to (void)0 + //va_end(vl); +} diff --git a/src/pregame.cpp b/src/pregame.cpp index 6ac04de..df8839a 100644 --- a/src/pregame.cpp +++ b/src/pregame.cpp @@ -66,16 +66,9 @@ void LoadPregameStyleNameAndNumber(m2d::EmbedLayout_c *layout) { // work out the thing now dLevelInfo_c::entry_s *level = dLevelInfo_c::s_info.searchBySlot(CurrentWorld, CurrentLevel); if (level) { - wchar_t convLevelName[160]; - const char *srcLevelName = dLevelInfo_c::s_info.getNameForLevel(level); - int i = 0; - while (i < 159 && srcLevelName[i]) { - convLevelName[i] = srcLevelName[i]; - i++; - } - convLevelName[i] = 0; - LevelNameShadow->SetString(convLevelName); - LevelName->SetString(convLevelName); + dScript::Res_c *bmg = GetBMG(); + Newer_WriteBMGToTextBox(LevelName, bmg, 8000+level->worldSlot+1, level->levelSlot+1, 0); + Newer_WriteBMGToTextBox(LevelNameShadow, bmg, 8000+level->worldSlot+1, level->levelSlot+1, 0); wchar_t levelNumber[32]; wcscpy(levelNumber, L"World "); diff --git a/src/randomcrap.S b/src/randomcrap.S index 4b8d830..2a4efea 100644 --- a/src/randomcrap.S +++ b/src/randomcrap.S @@ -1,5 +1,18 @@ .text +.global JrFloorFireHax +JrFloorFireHax: + stw r0, 0x120(r30) + lwz r4, 4(r30) + clrrwi. r4, r4, 28 + beqlr + li r4, 0 + stw r4, 0x778(r30) + lis r4, 0x100 + stw r4, 0x774(r30) + stw r4, 0x77C(r30) + blr + .global TryAndFixScoreGlitch TryAndFixScoreGlitch: lwz r0, 0x4A10(r3) |