From 6182743cfb62d4330c97734c50a2de03694e06c0 Mon Sep 17 00:00:00 2001 From: Treeki Date: Sat, 29 Sep 2012 16:00:27 +0200 Subject: Fixed colourise algorithm --- src/koopatlas/hud.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/koopatlas/hud.cpp') diff --git a/src/koopatlas/hud.cpp b/src/koopatlas/hud.cpp index 2401a04..b309e44 100644 --- a/src/koopatlas/hud.cpp +++ b/src/koopatlas/hud.cpp @@ -54,7 +54,7 @@ inline static float hslValue(float n1, float n2, float hue) { hue += 6.0f; if (hue < 1.0f) - return n1 + (n1 - n1) * hue; + return n1 + (n2 - n1) * hue; else if (hue < 3.0f) return n2; else if (hue < 4.0f) -- cgit v1.2.3 From 1db72b5e45cc25eb183817f05a2ee631d8fff837 Mon Sep 17 00:00:00 2001 From: Treeki Date: Sun, 30 Sep 2012 01:04:08 +0200 Subject: added world stars, still needs fixed positioning though --- src/koopatlas/hud.cpp | 46 ++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 44 insertions(+), 2 deletions(-) (limited to 'src/koopatlas/hud.cpp') 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 = §->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); } -- cgit v1.2.3