summaryrefslogtreecommitdiff
path: root/src/koopatlas
diff options
context:
space:
mode:
authorTreeki <treeki@gmail.com>2012-09-30 01:04:08 +0200
committerTreeki <treeki@gmail.com>2012-09-30 01:04:08 +0200
commit1db72b5e45cc25eb183817f05a2ee631d8fff837 (patch)
tree8633e5de1122d50d100805df2edb5cdb34d83c52 /src/koopatlas
parentb854fa55f6f17be4d8c45e84e81cdc7715d6a044 (diff)
downloadkamek-1db72b5e45cc25eb183817f05a2ee631d8fff837.tar.gz
kamek-1db72b5e45cc25eb183817f05a2ee631d8fff837.zip
added world stars, still needs fixed positioning though
Diffstat (limited to '')
-rw-r--r--src/koopatlas/hud.cpp46
-rw-r--r--src/koopatlas/hud.h3
-rw-r--r--src/koopatlas/pathmanager.cpp1
3 files changed, 47 insertions, 3 deletions
diff --git a/src/koopatlas/hud.cpp b/src/koopatlas/hud.cpp
index b309e44..7046e77 100644
--- a/src/koopatlas/hud.cpp
+++ b/src/koopatlas/hud.cpp
@@ -210,9 +210,10 @@ int dWMHud_c::onCreate() {
"StarCoinOff0", "StarCoinOff1", "StarCoinOff2",
"StarCoinOn0", "StarCoinOn1", "StarCoinOn2",
"P_marioFace_00", "P_luigiFace_00",
- "P_BkinoFace_00", "P_YkinoFace_00"
+ "P_BkinoFace_00", "P_YkinoFace_00",
+ "Star0", "Star1", "Star2"
};
- layout.getPictures(pictureNames, &Header_Centre, 15);
+ layout.getPictures(pictureNames, &Header_Centre, 18);
static const char *textBoxNames[] = {
"LevelName", "LevelNameS",
@@ -483,6 +484,47 @@ void dWMHud_c::loadFooterInfo() {
WorldName->colour2 = save->hudTextColours[1];
footerCol.colourise(save->hudHintH, save->hudHintS, save->hudHintL);
+
+ // figure out if stars are needed
+ // Star 0: world is complete
+ // 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
+
+ dLevelInfo_c *linfo = &dScKoopatlas_c::instance->levelInfo;
+ dLevelInfo_c::entry_s *lastLevel = linfo->searchByDisplayNum(save->newerWorldID, lastLevelID);
+ bool lastComplete = false;
+ if (lastLevel) {
+ lastComplete = (save->GetLevelCondition(lastLevel->worldSlot,lastLevel->levelSlot) & COND_NORMAL);
+ }
+
+ // now calculate the other two
+ bool haveExits = true, haveCoins = true;
+
+ dLevelInfo_c::section_s *sect = linfo->getSectionByIndex(save->newerWorldID);
+
+ for (int i = 0; i < sect->levelCount; i++) {
+ dLevelInfo_c::entry_s *entry = &sect->levels[i];
+ u32 conds = save->GetLevelCondition(entry->worldSlot, entry->levelSlot);
+
+ if (((entry->flags & 0x10) && !(conds & COND_NORMAL)) ||
+ ((entry->flags & 0x20) && !(conds & COND_SECRET)))
+ haveExits = false;
+
+ if (entry->flags & 2) {
+ if ((conds & COND_COIN_ALL) != COND_COIN_ALL)
+ haveCoins = false;
+ }
+ }
+
+ Star[0]->SetVisible(lastComplete);
+ Star[1]->SetVisible(haveExits);
+ Star[2]->SetVisible(haveCoins);
}
diff --git a/src/koopatlas/hud.h b/src/koopatlas/hud.h
index 5996b88..ee64133 100644
--- a/src/koopatlas/hud.h
+++ b/src/koopatlas/hud.h
@@ -70,7 +70,8 @@ class dWMHud_c : public dBase_c {
*StarCoinOff[3],
*StarCoinOn[3],
*P_marioFace_00, *P_luigiFace_00,
- *P_BkinoFace_00, *P_YkinoFace_00;
+ *P_BkinoFace_00, *P_YkinoFace_00,
+ *Star[3];
nw4r::lyt::TextBox
*LevelName, *LevelNameS,
diff --git a/src/koopatlas/pathmanager.cpp b/src/koopatlas/pathmanager.cpp
index c691a89..995c906 100644
--- a/src/koopatlas/pathmanager.cpp
+++ b/src/koopatlas/pathmanager.cpp
@@ -615,6 +615,7 @@ void dWMPathManager_c::moveThroughPath() {
OSReport("Found!\n");
strncpy(save->newerWorldName, world->name, 36);
save->newerWorldName[35] = 0;
+ save->newerWorldID = world->worldID;
save->currentMapMusic = world->trackID;
for (int i = 0; i < 2; i++) {