summaryrefslogtreecommitdiff
path: root/src/koopatlas/hud.cpp
diff options
context:
space:
mode:
authorColin Noga <Tempus@chronometry.ca>2012-07-19 02:55:17 -0500
committerColin Noga <Tempus@chronometry.ca>2012-07-19 02:55:17 -0500
commitc6893153b5e4772baee92dae71613ea367837188 (patch)
treefd8393f383d8089db56a8cfedab5446d77e9d605 /src/koopatlas/hud.cpp
parent5f03da589c0d0eb22e73993198a709ddb95f2960 (diff)
downloadkamek-c6893153b5e4772baee92dae71613ea367837188.tar.gz
kamek-c6893153b5e4772baee92dae71613ea367837188.zip
updates to HUD and commenting out of some spec changes
Diffstat (limited to '')
-rw-r--r--src/koopatlas/hud.cpp50
1 files changed, 48 insertions, 2 deletions
diff --git a/src/koopatlas/hud.cpp b/src/koopatlas/hud.cpp
index 286bbf5..3565c10 100644
--- a/src/koopatlas/hud.cpp
+++ b/src/koopatlas/hud.cpp
@@ -2,6 +2,27 @@
void CharToWChar(const char *input, wchar_t *output, int length) { for (int i = 0; i < length; i++) output[i] = input[i]; }
+int getStarCoinCount() {
+
+ SaveBlock *save = GetSaveFile()->GetBlock(-1);
+ int coinsSpent = save->ambush_countdown[0];
+ int coinsEarned = 0;
+
+ for (int w = 0; w < 10; w++) {
+ for (int l = 0; l < 10; l++) {
+ u32 conds = save->GetLevelCondition(w, l);
+
+ if (conds & COND_COIN1) { coinsEarned++; }
+ if (conds & COND_COIN2) { coinsEarned++; }
+ if (conds & COND_COIN3) { coinsEarned++; }
+ }
+ }
+
+ int coinsLeft = coinsEarned - coinsSpent;
+ return coinsLeft;
+}
+
+
dWMHud_c *dWMHud_c::instance = 0;
dWMHud_c *dWMHud_c::build() {
@@ -14,8 +35,6 @@ dWMHud_c *dWMHud_c::build() {
return c;
}
-
-
dWMHud_c::dWMHud_c() {
layoutLoaded = false;
}
@@ -125,6 +144,18 @@ void dWMHud_c::updateLives() {
pic->alpha = 0;
}
}
+
+ nw4r::lyt::TextBox *coinbox = layout.findTextBoxByName("T_coin_count_01");
+
+ char stars [4];
+ int starCoinCount = getStarCoinCount();
+ sprintf(stars, "%03d", starCoinCount);
+ const char *scoins = stars;
+ wchar_t wcoins;
+
+ CharToWChar(scoins, &wcoins, 4);
+
+ coinbox->SetString(&wcoins);
}
void dWMHud_c::setLevelText(const char *str, int length) {
@@ -269,6 +300,16 @@ void dWMHud_c::checkPointStatus() {
pic->alpha = 0;
}
+ u8 deaths = save->death_counts[world-1][level-1];
+ nw4r::lyt::TextBox *deathbox = layout.findTextBoxByName("T_death_01");
+
+ char die [4];
+ sprintf(die, "%03d", deaths);
+ const char *dies = die;
+ wchar_t wdie;
+ CharToWChar(dies, &wdie, 4);
+ deathbox->SetString(&wdie);
+
} else {
nw4r::lyt::Pane *pic;
@@ -279,6 +320,11 @@ void dWMHud_c::checkPointStatus() {
pic = layout.findPictureByName(picNames[i]);
pic->alpha = 0;
}
+
+ nw4r::lyt::TextBox *deathbox = layout.findTextBoxByName("T_death_01");
+ wchar_t noDie;
+ CharToWChar("---", &noDie, 4);
+ deathbox->SetString(&noDie);
}
}