From 35dd657c71814377774ffbdc16158eda05a22ba9 Mon Sep 17 00:00:00 2001 From: Treeki Date: Fri, 28 Sep 2012 00:33:10 +0200 Subject: untested automatically moving elements and world numbers --- src/koopatlas/hud.cpp | 72 +++++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 61 insertions(+), 11 deletions(-) (limited to 'src/koopatlas') diff --git a/src/koopatlas/hud.cpp b/src/koopatlas/hud.cpp index 667feb2..3d2eb04 100644 --- a/src/koopatlas/hud.cpp +++ b/src/koopatlas/hud.cpp @@ -345,31 +345,81 @@ void dWMHud_c::loadHeaderInfo() { LevelNameS->SetString(convertedLevelName); // LEVEL NUMBER - wchar_t levelNumber[6]; - levelNumber[0] = '0' + nodeForHeader->levelNumber[0]; + static const wchar_t *numberKinds[] = { + // 0-19 are handled by code + L"A", // 20, alternate + L"Tower", // 21, tower + L"Tower2", // 22, tower 2 + L"Castle", // 23, castle + L"Fortress", // 24, fortress + L"FCastle", // 25, final castle + L"Train", // 26, train + L"Airship", // 27, airship + L"Palace", // 28, switch palace + L"House", // 29, yoshi's house + L"Key1", // 30, key 1 + L"Key2", // 31, key 2 + L"Key3", // 32, key 3 + L"Key4", // 33, key 4 + L"Key5", // 34, key 5 + L"Key6", // 35, key 6 + }; + + int origWN = nodeForHeader->levelNumber[0]; + int origWL = nodeForHeader->levelNumber[1]; + + wchar_t levelNumber[16]; + levelNumber[0] = (origWN >= 10) ? (origWN-10+'A') : (origWN+'0'); levelNumber[1] = '-'; - if (nodeForHeader->levelNumber[1] >= 10) { - levelNumber[2] = '0' + (nodeForHeader->levelNumber[1] / 10); - levelNumber[3] = '0' + (nodeForHeader->levelNumber[1] % 10); + if (origWL > 20) { + wcscpy(&levelNumber[2], numberKinds[origWL-20]); + } else if (origWL >= 10) { + levelNumber[2] = '1'; + levelNumber[3] = ('0' - 10) + origWL; levelNumber[4] = 0; } else { - levelNumber[2] = '0' + nodeForHeader->levelNumber[1]; + levelNumber[2] = '0' + origWL; levelNumber[3] = 0; } LevelNumber->SetString(levelNumber); LevelNumberS->SetString(levelNumber); + nw4r::ut::TextWriter tw2; + tw2.font = LevelNumber->font; + tw2.SetFontSize(LevelNumber->fontSizeX, LevelNumber->fontSizeY); + tw2.lineSpace = LevelNumber->lineSpace; + tw2.charSpace = LevelNumber->charSpace; + if (LevelNumber->tagProc != 0) + tw2.tagProcessor = LevelNumber->tagProc; + + float spacing = 4.0f; + float currentPos = tw2.CalcStringWidth(levelNumber, wcslen(levelNumber)); + currentPos += LevelNumber->trans.x + spacing; + // INFO int w = nodeForHeader->levelNumber[0] - 1; int l = nodeForHeader->levelNumber[1] - 1; u32 conds = GetSaveFile()->GetBlock(-1)->GetLevelCondition(w, l); + + NormalExitFlag->trans.x = currentPos; NormalExitFlag->SetVisible(conds & COND_NORMAL); + if (conds & COND_NORMAL) + currentPos += NormalExitFlag->size.x + spacing; + + SecretExitFlag->trans.x = currentPos; SecretExitFlag->SetVisible(conds & COND_SECRET); - StarCoinOn[0]->SetVisible(conds & COND_COIN1); - StarCoinOn[1]->SetVisible(conds & COND_COIN2); - StarCoinOn[2]->SetVisible(conds & COND_COIN3); + if (conds & COND_SECRET) + currentPos += SecretExitFlag->size.x + spacing; + + for (int i = 0; i < 3; i++) { + bool flag = (conds & (COND_COIN1 << i)); + StarCoinOn[i]->trans.x = currentPos; + StarCoinOn[i]->SetVisible(flag); + if (flag) + currentPos += StarCoinOn[i]->size.x + spacing; + } // SIZE THING nw4r::ut::TextWriter tw; @@ -382,8 +432,8 @@ void dWMHud_c::loadHeaderInfo() { float width = tw.CalcStringWidth(convertedLevelName, charCount); float totalWidth = width + LevelName->trans.x - 20.0f; - if (totalWidth < 270.0f) - totalWidth = 270.0f; + if (totalWidth < currentPos) + totalWidth = currentPos; Header_Centre->size.x = totalWidth; Header_Right->trans.x = totalWidth; -- cgit v1.2.3