summaryrefslogtreecommitdiff
path: root/src/koopatlas/hud.cpp
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/koopatlas/hud.cpp66
1 files changed, 45 insertions, 21 deletions
diff --git a/src/koopatlas/hud.cpp b/src/koopatlas/hud.cpp
index 531c3b1..c20f026 100644
--- a/src/koopatlas/hud.cpp
+++ b/src/koopatlas/hud.cpp
@@ -56,6 +56,9 @@ int dWMHud_c::onCreate() {
showPointBar();
+ if (dScKoopatlas_c::instance->pathManager.mustComplainToMapCreator)
+ dWMHud_c::instance->setText("Please Fix Your Missing Entrance. Thanks");
+
layoutLoaded = true;
}
@@ -88,30 +91,36 @@ void dWMHud_c::updateText() {
}
-void dWMHud_c::setPointName() {
- wchar_t newPointName[120];
- int length;
+void dWMHud_c::setText(const char *str, int length) {
+ if (str == 0) {
+ setText("--NULL STRING--");
+ return;
+ }
- // figure this out...
- dKPNode_s *node = dScKoopatlas_c::instance->pathManager.currentNode;
+ if (length == -1) {
+ length = strlen(str);
+ }
- if (node->type == dKPNode_s::LEVEL) {
- dLevelInfo_c *li = &dScKoopatlas_c::instance->levelInfo;
- dLevelInfo_c::entry_s *entry = li->search(node->levelNumber[0] - 1, node->levelNumber[1] - 1);
+ wchar_t newString[128];
- const char *levelName = li->getNameForLevel(entry);
+ int i;
+ for (i = 0; i < length && i < 128; i++) {
+ newString[i] = str[i];
+ }
+ newString[i] = 0;
- // copy it
- // I need to make this into a function.
- for (int i = 0; i < 120 && i < entry->nameLength; i++) {
- newPointName[i] = levelName[i];
- }
- length = entry->nameLength;
- newPointName[entry->nameLength] = 0;
+ setText(newString, i);
+}
- } else {
- newPointName[0] = 0;
- length = 0;
+
+void dWMHud_c::setText(const wchar_t *str, int length) {
+ if (str == 0) {
+ setText("--NULL STRING--");
+ return;
+ }
+
+ if (length == -1) {
+ length = wcslen(str);
}
nw4r::lyt::TextBox *box = layout.findTextBoxByName("T_levelname_01");
@@ -124,14 +133,29 @@ void dWMHud_c::setPointName() {
if (box->tagProc != 0)
tw.tagProcessorMaybe = box->tagProc;
- float width = tw.CalcStringWidth(newPointName, length);
+ float width = tw.CalcStringWidth(str, length);
SpammyReport("Text width: %f\n", width);
layout.findWindowByName("W_levelname")->size.x = width + 22;
layout.findPictureByName("P_topleftboxbg")->size.x = width;
layout.findPictureByName("P_topthinboxbg")->size.x = 597 - width;
- box->SetString(newPointName);
+ box->SetString(str);
+}
+
+
+void dWMHud_c::setPointName() {
+ // figure this out...
+ dKPNode_s *node = dScKoopatlas_c::instance->pathManager.currentNode;
+
+ if (node->type == dKPNode_s::LEVEL) {
+ dLevelInfo_c *li = &dScKoopatlas_c::instance->levelInfo;
+ dLevelInfo_c::entry_s *entry = li->search(node->levelNumber[0] - 1, node->levelNumber[1] - 1);
+
+ setText(li->getNameForLevel(entry));
+ } else {
+ setText("");
+ }
}