diff options
-rw-r--r-- | include/newer.h | 2 | ||||
-rw-r--r-- | kamek_pal.x | 1 | ||||
-rw-r--r-- | src/fileselect.S | 12 | ||||
-rw-r--r-- | src/koopatlas/core.cpp | 5 | ||||
-rw-r--r-- | src/koopatlas/core.h | 2 | ||||
-rw-r--r-- | src/koopatlas/hud.cpp | 15 | ||||
-rw-r--r-- | src/koopatlas/pathmanager.cpp | 24 | ||||
-rw-r--r-- | src/newer.cpp | 10 |
8 files changed, 56 insertions, 15 deletions
diff --git a/include/newer.h b/include/newer.h index af6f00b..5f23ca9 100644 --- a/include/newer.h +++ b/include/newer.h @@ -1,6 +1,8 @@ #ifndef NEWER_H #define NEWER_H +extern int lastLevelIDs[]; + void WriteAsciiToTextBox(nw4r::lyt::TextBox *tb, const char *source); int getUnspentStarCoinCount(); diff --git a/kamek_pal.x b/kamek_pal.x index 9a0fee1..98b7881 100644 --- a/kamek_pal.x +++ b/kamek_pal.x @@ -379,6 +379,7 @@ SECTIONS { calculateAdjacentCollision__14collisionMgr_cFPf = 0x8006FA40; s_80070760__14collisionMgr_cFv = 0x80070760; s_800707E0__14collisionMgr_cFv = 0x800707E0; + getTileBehaviour1At__14collisionMgr_cFffUc = 0x80070BA0; /* freezeMgr_c */ __ct_11freezeMgr_c = 0x800b8490; diff --git a/src/fileselect.S b/src/fileselect.S index 20acc3e..4d6ce85 100644 --- a/src/fileselect.S +++ b/src/fileselect.S @@ -73,6 +73,14 @@ DFNiceWorldName: # Savefile is in r31 # World Name field is in r20 + lhz r4, 0x734(r31) + cmpwi r4, 1000 + blt useNormalWName + lis r4, WarpZoneName@h + ori r4, r4, WarpZoneName@l + b chosenWName + +useNormalWName: lis r4, ConvertedWorldName@h ori r4, r4, ConvertedWorldName@l mr r3, r4 @@ -86,6 +94,7 @@ convWNameLoop: addi r5, r5, 1 bdnz convWNameLoop +chosenWName: mr r3, r20 li r5, 0 lwz r12, 0(r3) @@ -360,6 +369,9 @@ ConvertedWorldName: .short 0,0,0,0,0,0,0,0,0,0,0,0 # 12 .short 0,0,0,0,0,0,0,0 # 8 +WarpZoneName: +.short 'W','a','r','p',' ','Z','o','n','e',0 + .align 4 DefaultSavefileInfoData: .string "Yoshi's Island" #15 diff --git a/src/koopatlas/core.cpp b/src/koopatlas/core.cpp index c67226e..36e594a 100644 --- a/src/koopatlas/core.cpp +++ b/src/koopatlas/core.cpp @@ -181,6 +181,10 @@ bool WMInit_LoadResources2(void *ptr) { wm->mapPath = wm->getMapNameForIndex(wm->currentMapID); if (wm->mapPath == 0) wm->mapPath = wm->getMapNameForIndex(0); + if (!strcmp(wm->mapPath, "/Maps/WSEL.kpbin")) + wm->warpZoneHacks = true; + else + wm->warpZoneHacks = false; OSReport("Load map: %s\n", wm->mapPath); } @@ -1042,6 +1046,7 @@ int dScKoopatlas_c::getIndexForMapName(const char *name) { void dScKoopatlas_c::showSaveWindow() { + hud->hideAll(); state.setState(&StateID_SaveOpen); YESNO_TYPE(yesNoWindow) = 1; YESNO_VISIBLE(yesNoWindow) = 1; diff --git a/src/koopatlas/core.h b/src/koopatlas/core.h index 788ad62..a55624d 100644 --- a/src/koopatlas/core.h +++ b/src/koopatlas/core.h @@ -115,6 +115,8 @@ class dScKoopatlas_c : public dScene_c { bool isFirstPlay; void startMusic(); + bool warpZoneHacks; + u32 iterateMapList(u32(*callback)(u32,const char *,int,int), u32 userData, int *ptrIndex = 0); const char *getMapNameForIndex(int index); int getIndexForMapName(const char *name); diff --git a/src/koopatlas/hud.cpp b/src/koopatlas/hud.cpp index 6166d64..157821b 100644 --- a/src/koopatlas/hud.cpp +++ b/src/koopatlas/hud.cpp @@ -1,8 +1,6 @@ #include "koopatlas/hud.h" #include <newer.h> - - dWMHud_c *dWMHud_c::instance = 0; dWMHud_c *dWMHud_c::build() { @@ -109,7 +107,7 @@ int dWMHud_c::onCreate() { loadFooterInfo(); SaveBlock *save = GetSaveFile()->GetBlock(-1); - willShowFooter = (save->newerWorldName[0] != 0); + willShowFooter = (save->newerWorldName[0] != 0) && (save->hudHintH != 2000); if (!dScKoopatlas_c::instance->pathManager.isMoving) enteredNode(); @@ -303,7 +301,7 @@ void dWMHud_c::loadHeaderInfo() { Header_Right->trans.x = totalWidth; SaveBlock *save = GetSaveFile()->GetBlock(-1); - headerCol.colourise(save->hudHintH, save->hudHintS, save->hudHintL); + headerCol.colourise(save->hudHintH%1000, save->hudHintS, save->hudHintL); } @@ -325,20 +323,13 @@ void dWMHud_c::loadFooterInfo() { WorldName->colour1 = save->hudTextColours[0]; WorldName->colour2 = save->hudTextColours[1]; - footerCol.colourise(save->hudHintH, save->hudHintS, save->hudHintL); + footerCol.colourise(save->hudHintH%1000, save->hudHintS, save->hudHintL); // figure out if stars are needed // Star 0: world is complete // Star 1: all exits complete // Star 2: all star coins obtained - static int lastLevelIDs[] = { - -1, /*no world*/ - 27, 27, 27, 27, 27, 27, 27, 25, - -1, /*no end level in W9*/ - 24, 24, 24, 3, 5 - }; - bool starVisibility[3]; starVisibility[0] = false; diff --git a/src/koopatlas/pathmanager.cpp b/src/koopatlas/pathmanager.cpp index 7f4b754..435c6f1 100644 --- a/src/koopatlas/pathmanager.cpp +++ b/src/koopatlas/pathmanager.cpp @@ -753,7 +753,7 @@ void dWMPathManager_c::moveThroughPath(int pressedDir) { // Quick check: do we *actually* need to stop on this node? // If it's a junction with more than two exits, but only two are open, // take the opposite open one - if (to->getExitCount() > 2 && to->getAvailableExitCount() == 2) + if (!dScKoopatlas_c::instance->warpZoneHacks && to->getExitCount() > 2 && to->getAvailableExitCount() == 2) reallyStop = false; else reallyStop = true; @@ -791,8 +791,26 @@ void dWMPathManager_c::moveThroughPath(int pressedDir) { save->titleScreenWorld = world->titleScreenWorld; save->titleScreenLevel = world->titleScreenLevel; - if (visiblyChange && dWMHud_c::instance) - dWMHud_c::instance->showFooter(); + bool wzHack = false; + if (dScKoopatlas_c::instance->warpZoneHacks) { + save->hudHintH += 1000; + + if (world->worldID > 0) { + dLevelInfo_c *linfo = &dLevelInfo_c::s_info; + dLevelInfo_c::entry_s *lastLevel = linfo->searchByDisplayNum(world->worldID-1, lastLevelIDs[world->worldID-1]); + if (lastLevel) { + wzHack = !(save->GetLevelCondition(lastLevel->worldSlot,lastLevel->levelSlot) & COND_NORMAL); + } + } + } + + if (wzHack) { + save->hudHintH = 2000; + dWMHud_c::instance->hideFooter(); + } else { + if (visiblyChange && dWMHud_c::instance) + dWMHud_c::instance->showFooter(); + } dKPMusic::play(world->trackID); diff --git a/src/newer.cpp b/src/newer.cpp index 0830988..50fc1d1 100644 --- a/src/newer.cpp +++ b/src/newer.cpp @@ -1,6 +1,16 @@ #include <game.h> #include <newer.h> +int lastLevelIDs[] = { + -1, /*no world*/ + 27, 27, 27, 27, 27, 27, 27, 25, + -1, /*no end level in W9*/ + 24, 24, 24, 3, 5 +}; + + + + void WriteAsciiToTextBox(nw4r::lyt::TextBox *tb, const char *source) { int i = 0; wchar_t buffer[1024]; |