summaryrefslogtreecommitdiff
path: root/src/koopatlas/hud.cpp
diff options
context:
space:
mode:
authorColin Noga <Tempus@chronometry.ca>2012-10-03 12:55:15 -0500
committerColin Noga <Tempus@chronometry.ca>2012-10-03 12:55:15 -0500
commit34efbdba59b460a2f565c25a5ff20efb8d1077a0 (patch)
treec1729468fd611f9523e3a2bf492363e34c2fb879 /src/koopatlas/hud.cpp
parentc1365802c73376609e53b97440ae037b14f6324f (diff)
parent21d8492ded507f8f09bc28919b8d351b86fa0dd0 (diff)
downloadkamek-34efbdba59b460a2f565c25a5ff20efb8d1077a0.tar.gz
kamek-34efbdba59b460a2f565c25a5ff20efb8d1077a0.zip
Merge branch 'level-select' of ssh://treeki.rustedlogic.net:30000/Kamek into level-select
Diffstat (limited to 'src/koopatlas/hud.cpp')
-rw-r--r--src/koopatlas/hud.cpp40
1 files changed, 26 insertions, 14 deletions
diff --git a/src/koopatlas/hud.cpp b/src/koopatlas/hud.cpp
index 7046e77..bcfab17 100644
--- a/src/koopatlas/hud.cpp
+++ b/src/koopatlas/hud.cpp
@@ -490,21 +490,25 @@ void dWMHud_c::loadFooterInfo() {
// Star 1: all exits complete
// Star 2: all star coins obtained
- int lastLevelID = 27; // airship
- if (save->newerWorldID >= 10)
- lastLevelID = 24; // fortress
- else if (save->newerWorldID == 8)
- lastLevelID = 25; // final castle
+ static int lastLevelIDs[] = {
+ -1, /*no world*/
+ 27, 27, 27, 27, 27, 27, 27, 25,
+ -1, /*no end level in W9*/
+ 24, 24, 24, 3, 5
+ };
+
+ bool starVisibility[3];
+ starVisibility[0] = false;
dLevelInfo_c *linfo = &dScKoopatlas_c::instance->levelInfo;
- dLevelInfo_c::entry_s *lastLevel = linfo->searchByDisplayNum(save->newerWorldID, lastLevelID);
- bool lastComplete = false;
+ dLevelInfo_c::entry_s *lastLevel = linfo->searchByDisplayNum(save->newerWorldID, lastLevelIDs[save->newerWorldID]);
if (lastLevel) {
- lastComplete = (save->GetLevelCondition(lastLevel->worldSlot,lastLevel->levelSlot) & COND_NORMAL);
+ starVisibility[0] = (save->GetLevelCondition(lastLevel->worldSlot,lastLevel->levelSlot) & COND_NORMAL);
}
// now calculate the other two
- bool haveExits = true, haveCoins = true;
+ starVisibility[1] = true;
+ starVisibility[2] = true;
dLevelInfo_c::section_s *sect = linfo->getSectionByIndex(save->newerWorldID);
@@ -514,17 +518,25 @@ void dWMHud_c::loadFooterInfo() {
if (((entry->flags & 0x10) && !(conds & COND_NORMAL)) ||
((entry->flags & 0x20) && !(conds & COND_SECRET)))
- haveExits = false;
+ starVisibility[1] = false;
if (entry->flags & 2) {
if ((conds & COND_COIN_ALL) != COND_COIN_ALL)
- haveCoins = false;
+ starVisibility[2] = false;
+ }
+ }
+
+ float startX = Star[0]->trans.x;
+ for (int i = 0; i < 3; i++) {
+ Star[i]->SetVisible(starVisibility[i]);
+ Star[i]->trans.x = startX;
+ if (starVisibility[i]) {
+ startX += Star[i]->size.x + 4.0f;
}
}
- Star[0]->SetVisible(lastComplete);
- Star[1]->SetVisible(haveExits);
- Star[2]->SetVisible(haveCoins);
+ WorldName->trans.x = startX + 4.0f;
+ WorldNameS->trans.x = startX + 6.0f;
}