summaryrefslogtreecommitdiff
path: root/src/koopatlas
diff options
context:
space:
mode:
authorTreeki <treeki@gmail.com>2013-01-28 02:34:45 +0100
committerTreeki <treeki@gmail.com>2013-01-28 02:34:45 +0100
commitf6ff7ca41f6e9b496a03e05e2ae053481add2a9f (patch)
treea92095aeb5cd326d50e7ee6c1d447a956d9293b7 /src/koopatlas
parent5b3a54abcdfee1f82b200ed45c9b44a4251c8406 (diff)
downloadkamek-f6ff7ca41f6e9b496a03e05e2ae053481add2a9f.tar.gz
kamek-f6ff7ca41f6e9b496a03e05e2ae053481add2a9f.zip
adding warp zone support to maps and a couple of fixes
Diffstat (limited to '')
-rw-r--r--src/koopatlas/core.cpp5
-rw-r--r--src/koopatlas/core.h2
-rw-r--r--src/koopatlas/hud.cpp15
-rw-r--r--src/koopatlas/pathmanager.cpp24
4 files changed, 31 insertions, 15 deletions
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);