From 5c519288c928f4136b973613733e70b829dda480 Mon Sep 17 00:00:00 2001 From: Treeki Date: Sun, 12 May 2013 23:41:19 +0200 Subject: show faded out missing exits --- include/game.h | 1 + src/koopatlas/hud.cpp | 24 ++++++++++++++++++++---- 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/include/game.h b/include/game.h index b032f40..1eb7a17 100755 --- a/include/game.h +++ b/include/game.h @@ -178,6 +178,7 @@ bool IsWideScreen(); #define COND_COIN_ALL 7 #define COND_NORMAL 0x10 #define COND_SECRET 0x20 +#define COND_BOTH_EXITS 0x30 #define COND_SGNORMAL 0x80 #define COND_SGSECRET 0x100 #define COND_UNLOCKED 0x200 // NEWER EXCLUSIVE diff --git a/src/koopatlas/hud.cpp b/src/koopatlas/hud.cpp index ff9a0e2..3802c33 100644 --- a/src/koopatlas/hud.cpp +++ b/src/koopatlas/hud.cpp @@ -277,15 +277,31 @@ void dWMHud_c::loadHeaderInfo() { int l = nodeForHeader->levelNumber[1] - 1; u32 conds = GetSaveFile()->GetBlock(-1)->GetLevelCondition(w, l); + // States: 0 = invisible, 1 = visible, 2 = faded + int normalState = 0, secretState = 0; + + if ((conds & COND_BOTH_EXITS) && (infEntry->flags & 0x30) == 0x30) { + // If this level has two exits and one of them is already collected, + // then show the faded flags + normalState = 2; + secretState = 2; + } + + if ((conds & COND_NORMAL) && (infEntry->flags & 0x10)) + normalState = 1; + if ((conds & COND_SECRET) && (infEntry->flags & 0x20)) + secretState = 1; NormalExitFlag->trans.x = currentPos; - NormalExitFlag->SetVisible(conds & COND_NORMAL); - if (conds & COND_NORMAL) + NormalExitFlag->alpha = (normalState == 2) ? 80 : 255; + NormalExitFlag->SetVisible(normalState > 0); + if (normalState > 0) currentPos += NormalExitFlag->size.x; SecretExitFlag->trans.x = currentPos; - SecretExitFlag->SetVisible(conds & COND_SECRET); - if (conds & COND_SECRET) + SecretExitFlag->alpha = (secretState == 2) ? 80 : 255; + SecretExitFlag->SetVisible(secretState > 0); + if (secretState > 0) currentPos += SecretExitFlag->size.x; // are star coins enabled or not? -- cgit v1.2.3