summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/koopatlas/core.h2
-rw-r--r--src/koopatlas/hud.cpp18
-rw-r--r--src/koopatlas/hud.h2
-rw-r--r--src/koopatlas/pathmanager.cpp18
-rw-r--r--src/koopatlas/pathmanager.h2
5 files changed, 35 insertions, 7 deletions
diff --git a/src/koopatlas/core.h b/src/koopatlas/core.h
index 2674977..fd3e15c 100644
--- a/src/koopatlas/core.h
+++ b/src/koopatlas/core.h
@@ -18,7 +18,7 @@
#include "koopatlas/pathmanager.h"
#define WM_DEBUGGING
-// #define WM_SPAMMY_DEBUGGING
+#define WM_SPAMMY_DEBUGGING
#ifdef WM_DEBUGGING
#define MapReport OSReport
diff --git a/src/koopatlas/hud.cpp b/src/koopatlas/hud.cpp
index 266c284..cd52beb 100644
--- a/src/koopatlas/hud.cpp
+++ b/src/koopatlas/hud.cpp
@@ -50,6 +50,7 @@ int dWMHud_c::onCreate() {
layout.enableNonLoopAnim(SHOW_LIVES);
layout.enableNonLoopAnim(SHOW_FOOTER);
+ layout.resetAnim(SHOW_HEADER);
static const char *tbNames[2] = {"MenuButtonInfo", "ItemsButtonInfo"};
layout.setLangStrings(tbNames, (int[2]){12, 15}, 4, 2);
@@ -72,6 +73,9 @@ int dWMHud_c::onCreate() {
layoutLoaded = true;
willShowHeader = false;
+
+ if (!dScKoopatlas_c::instance->pathManager.isMoving)
+ enteredNode();
}
return true;
@@ -131,7 +135,7 @@ void dWMHud_c::loadHeaderInfo() {
dLevelInfo_c *levelInfo = &dScKoopatlas_c::instance->levelInfo;
dLevelInfo_c::entry_s *infEntry = levelInfo->search(
- nodeForHeader->levelNumber[0], nodeForHeader->levelNumber[1]);
+ nodeForHeader->levelNumber[0]-1, nodeForHeader->levelNumber[1]-1);
if (infEntry == 0) {
LevelName->SetString(L"Unknown Level Name!");
@@ -191,14 +195,18 @@ void dWMHud_c::loadHeaderInfo() {
tw.tagProcessor = LevelName->tagProc;
float width = tw.CalcStringWidth(convertedLevelName, charCount);
- Header_Centre->size.x = width + LevelName->trans.x - 20.0f;
- Header_Right->trans.x = Header_Centre->size.x;
+ float totalWidth = width + LevelName->trans.x - 20.0f;
+ if (totalWidth < 270.0f)
+ totalWidth = 270.0f;
+ Header_Centre->size.x = totalWidth;
+ Header_Right->trans.x = totalWidth;
}
-void dWMHud_c::enteredNode() {
- dKPNode_s *node = dScKoopatlas_c::instance->pathManager.currentNode;
+void dWMHud_c::enteredNode(dKPNode_s *node) {
+ if (node == 0)
+ node = dScKoopatlas_c::instance->pathManager.currentNode;
if (node->type == dKPNode_s::LEVEL) {
willShowHeader = true;
diff --git a/src/koopatlas/hud.h b/src/koopatlas/hud.h
index 632a078..6f10169 100644
--- a/src/koopatlas/hud.h
+++ b/src/koopatlas/hud.h
@@ -19,7 +19,7 @@ class dWMHud_c : public dBase_c {
static dWMHud_c *instance;
- void enteredNode();
+ void enteredNode(dKPNode_s *node = 0);
void leftNode();
private:
diff --git a/src/koopatlas/pathmanager.cpp b/src/koopatlas/pathmanager.cpp
index 3d85f4c..a03541c 100644
--- a/src/koopatlas/pathmanager.cpp
+++ b/src/koopatlas/pathmanager.cpp
@@ -302,6 +302,10 @@ void dWMPathManager_c::startMovementTo(dKPPath_s *path) {
SpammyReport("moving to path %p\n", path);
if (!path->isAvailable) { return; }
+ if (currentNode)
+ dWMHud_c::instance->leftNode();
+
+ calledEnteredNode = false;
SpammyReport("a\n");
isMoving = true;
@@ -496,6 +500,18 @@ void dWMPathManager_c::moveThroughPath() {
player->pos.x += move.x;
player->pos.y -= move.y;
+ // what distance is left?
+ if (to->type == dKPNode_s::LEVEL && !calledEnteredNode) {
+ Vec toEndVec = {to->x - player->pos.x, to->y + player->pos.y, 0.0f};
+ float distToEnd = VECMag(&toEndVec);
+ //OSReport("Distance: %f; To:%d,%d; Player:%f,%f; Diff:%f,%f\n", distToEnd, to->x, to->y, player->pos.x, player->pos.y, toEndVec.x, toEndVec.y);
+
+ if (distToEnd < 64.0f) {
+ calledEnteredNode = true;
+ dWMHud_c::instance->enteredNode(to);
+ }
+ }
+
// Check if we've reached the end yet
if (
((move.x > 0) ? (player->pos.x >= to->x) : (player->pos.x <= to->x)) &&
@@ -557,6 +573,8 @@ void dWMPathManager_c::moveThroughPath() {
SaveBlock *save = GetSaveFile()->GetBlock(-1);
save->current_path_node = pathLayer->findNodeID(to);
+ if (!calledEnteredNode)
+ dWMHud_c::instance->enteredNode();
if (to->type == dKPNode_s::LEVEL) {
NWRWorld nWorld = NewerWorldForLevelID(to->levelNumber[0], to->levelNumber[1]);
diff --git a/src/koopatlas/pathmanager.h b/src/koopatlas/pathmanager.h
index e010aa4..cae96ba 100644
--- a/src/koopatlas/pathmanager.h
+++ b/src/koopatlas/pathmanager.h
@@ -51,6 +51,8 @@ class dWMPathManager_c {
bool evaluateUnlockCondition(u8 *&in, SaveBlock *save, int stack);
bool isEnteringLevel;
+
+ bool calledEnteredNode;
};
#endif