summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTreeki <treeki@gmail.com>2012-09-25 04:51:03 +0200
committerTreeki <treeki@gmail.com>2012-09-25 04:51:03 +0200
commitf4be7c3e4a44a6ec870eb61863a3d294da6f10ae (patch)
tree5bdcfdd1d824ef53bfc8e636786b4f3edc01b848
parent245bb3325f613f81973866100e86ee681b0fde9d (diff)
downloadkamek-f4be7c3e4a44a6ec870eb61863a3d294da6f10ae.tar.gz
kamek-f4be7c3e4a44a6ec870eb61863a3d294da6f10ae.zip
fixed display of lives
Diffstat (limited to '')
-rw-r--r--kamek_pal.x1
-rw-r--r--src/koopatlas/hud.cpp58
-rw-r--r--src/koopatlas/hud.h25
3 files changed, 71 insertions, 13 deletions
diff --git a/kamek_pal.x b/kamek_pal.x
index 5f11ac5..80ad1ce 100644
--- a/kamek_pal.x
+++ b/kamek_pal.x
@@ -17,6 +17,7 @@ SECTIONS {
RealAcPyDtor = 0x80144820;
InsertIntIntoTextBox1 = 0x800B3BE0;
+ WriteNumberToTextBox__FPiPCiPQ34nw4r3lyt7TextBoxb = 0x800B3B60;
__ct__20daJrClownForPlayer_cFv = 0x80810480;
__dt__20daJrClownForPlayer_cFv = 0x80810540; /* Beans indeed. */
diff --git a/src/koopatlas/hud.cpp b/src/koopatlas/hud.cpp
index 5fe8072..b7effce 100644
--- a/src/koopatlas/hud.cpp
+++ b/src/koopatlas/hud.cpp
@@ -55,20 +55,30 @@ int dWMHud_c::onCreate() {
static const char *tbNames[2] = {"MenuButtonInfo", "ItemsButtonInfo"};
layout.setLangStrings(tbNames, (int[2]){12, 15}, 4, 2);
- static const char *pictureNames[7] = {
+ static const char *paneNames[] = {
+ "N_IconPos1P_00", "N_IconPos2P_00",
+ "N_IconPos3P_00", "N_IconPos4P_00"
+ };
+ layout.getPanes(paneNames, &N_IconPosXP_00[0], 4);
+
+ static const char *pictureNames[] = {
"Header_Centre", "Header_Right",
"NormalExitFlag", "SecretExitFlag",
- "StarCoinOn0", "StarCoinOn1", "StarCoinOn2"
+ "StarCoinOn0", "StarCoinOn1", "StarCoinOn2",
+ "P_marioFace_00", "P_luigiFace_00",
+ "P_BkinoFace_00", "P_YkinoFace_00"
};
- layout.getPictures(pictureNames, &Header_Centre, 7);
+ layout.getPictures(pictureNames, &Header_Centre, 11);
- static const char *textBoxNames[7] = {
+ static const char *textBoxNames[] = {
"LevelName", "LevelNameS",
"LevelNumber", "LevelNumberS",
"WorldName", "WorldNameS",
- "StarCoinCounter"
+ "StarCoinCounter",
+ "T_lifeNumber_00", "T_lifeNumber_01",
+ "T_lifeNumber_02", "T_lifeNumber_03"
};
- layout.getTextBoxes(textBoxNames, &LevelName, 7);
+ layout.getTextBoxes(textBoxNames, &LevelName, 11);
layoutLoaded = true;
@@ -76,6 +86,8 @@ int dWMHud_c::onCreate() {
if (!dScKoopatlas_c::instance->pathManager.isMoving)
enteredNode();
+
+ setupLives();
}
return true;
@@ -232,4 +244,38 @@ void dWMHud_c::leftNode() {
+void dWMHud_c::setupLives() {
+ static const int LogicalPlayerIDs[] = {0,1,3,2};
+
+ P_marioFace_00->SetVisible(false);
+ P_luigiFace_00->SetVisible(false);
+ P_BkinoFace_00->SetVisible(false);
+ P_YkinoFace_00->SetVisible(false);
+
+ int playerCount = 0;
+
+ for (int i = 0; i < 4; i++) {
+ // The part in setupLives()
+ int playerID = LogicalPlayerIDs[i];
+ int slotID = SearchForIndexOfPlayerID(playerID);
+ int lives = Player_Lives[slotID];
+ int length = 2;
+
+ WriteNumberToTextBox(&lives, &length, T_lifeNumber[slotID], true);
+
+ // The part in setupIconThings()
+ if (QueryPlayerAvailability(slotID)) {
+ playerCount++;
+
+ nw4r::lyt::Pane *facePane = (&P_marioFace_00)[playerID];
+ facePane->trans = N_IconPosXP_00[i]->trans;
+ facePane->SetVisible(true);
+ }
+ }
+
+ for (int i = 0; i < 4; i++)
+ N_IconPosXP_00[i]->SetVisible(false);
+ N_IconPosXP_00[playerCount - 1]->SetVisible(true);
+}
+
diff --git a/src/koopatlas/hud.h b/src/koopatlas/hud.h
index 6f10169..07dde77 100644
--- a/src/koopatlas/hud.h
+++ b/src/koopatlas/hud.h
@@ -22,6 +22,8 @@ class dWMHud_c : public dBase_c {
void enteredNode(dKPNode_s *node = 0);
void leftNode();
+ void setupLives();
+
private:
void playShowHeaderAnim();
void playHideHeaderAnim();
@@ -31,13 +33,22 @@ class dWMHud_c : public dBase_c {
dKPNode_s *nodeForHeader;
- nw4r::lyt::Picture *Header_Centre, *Header_Right;
- nw4r::lyt::Picture *NormalExitFlag, *SecretExitFlag;
- nw4r::lyt::Picture *StarCoinOn[3];
- nw4r::lyt::TextBox *LevelName, *LevelNameS;
- nw4r::lyt::TextBox *LevelNumber, *LevelNumberS;
- nw4r::lyt::TextBox *WorldName, *WorldNameS;
- nw4r::lyt::TextBox *StarCoinCounter;
+ nw4r::lyt::Pane
+ *N_IconPosXP_00[4];
+
+ nw4r::lyt::Picture
+ *Header_Centre, *Header_Right,
+ *NormalExitFlag, *SecretExitFlag,
+ *StarCoinOn[3],
+ *P_marioFace_00, *P_luigiFace_00,
+ *P_BkinoFace_00, *P_YkinoFace_00;
+
+ nw4r::lyt::TextBox
+ *LevelName, *LevelNameS,
+ *LevelNumber, *LevelNumberS,
+ *WorldName, *WorldNameS,
+ *StarCoinCounter,
+ *T_lifeNumber[4];
};
#endif