summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/wm_hud.cpp42
-rw-r--r--src/worldmap.cpp2
2 files changed, 44 insertions, 0 deletions
diff --git a/src/wm_hud.cpp b/src/wm_hud.cpp
index 670683c..62ebb99 100644
--- a/src/wm_hud.cpp
+++ b/src/wm_hud.cpp
@@ -29,6 +29,8 @@ int dWMHud_c::onCreate() {
layout.build("banner.brlyt");
+ layout.findTextBoxByName("T_area_01")->AllocStringBuffer(100);
+
layoutLoaded = true;
}
@@ -55,3 +57,43 @@ int dWMHud_c::onDraw() {
return true;
}
+
+void dWMHud_c::updateText() {
+ u16 newPointName[120];
+
+ OSReport("Updating text.\n");
+
+ // figure this out...
+ WMPathPoint *point = dScNewerWorldMap_c::instance->currentPoint;
+ OSReport("Obtained point: %p\n", point);
+
+ if (point->type == WMPathPoint::LEVEL_TYPE) {
+ OSReport("It's a level: %d, %d\n", point->params[0], point->params[1]);
+
+ LevelInfo *li = &dScNewerWorldMap_c::instance->levelInfo;
+ LevelInfo::Entry *entry = li->search(point->params[0] - 1, point->params[1] - 1);
+
+ OSReport("Got entry: %p\n", entry);
+
+ char *levelName = li->getNameForLevel(entry);
+
+ OSReport("Got name: %s\n", levelName);
+ OSReport("Length: %d\n", entry->nameLength);
+
+ // copy it
+ // I need to make this into a function.
+ for (int i = 0; i < 120 && i < entry->nameLength; i++) {
+ newPointName[i] = levelName[i];
+ }
+ newPointName[entry->nameLength] = 0;
+ } else {
+ OSReport("No name!\n");
+ newPointName[0] = 0;
+ }
+
+ nw4r::lyt::TextBox *t = layout.findTextBoxByName("T_area_01");
+ OSReport("TextBox: %p\n", t);
+ layout.findTextBoxByName("T_area_01")->SetString((wchar_t*)newPointName);
+ OSReport("Set it to T_area_01\n");
+}
+
diff --git a/src/worldmap.cpp b/src/worldmap.cpp
index 4f8b0c5..33bda60 100644
--- a/src/worldmap.cpp
+++ b/src/worldmap.cpp
@@ -887,6 +887,8 @@ void dScNewerWorldMap_c::MoveThroughPath() {
SaveBlock *save = GetSaveFile()->GetBlock(-1);
//save->current_world = newPage; ?
save->current_path_node = pathData.getPointID(this->currentPoint);
+
+ dWMHud_c::instance->updateText();
} else {
this->MoveToSegment(nextSegment);
}