diff options
author | Treeki <treeki@gmail.com> | 2012-05-08 02:43:37 +0200 |
---|---|---|
committer | Treeki <treeki@gmail.com> | 2012-05-08 02:43:37 +0200 |
commit | a6ddc5c5bcdbc18feb1c04d38b452d225dd7852b (patch) | |
tree | 18f1a7b3dcd56f9a44284ce2690ff759abec09df /src/koopatlas/hud.cpp | |
parent | 57ffe9814a0074c01843700af0498d35a84c80f0 (diff) | |
download | kamek-a6ddc5c5bcdbc18feb1c04d38b452d225dd7852b.tar.gz kamek-a6ddc5c5bcdbc18feb1c04d38b452d225dd7852b.zip |
I don't even remember what shit this commit contains
Diffstat (limited to '')
-rw-r--r-- | src/koopatlas/hud.cpp | 66 |
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(""); + } } |