diff options
Diffstat (limited to '')
-rwxr-xr-x | include/game.h | 3 | ||||
-rw-r--r-- | src/fileselect.S | 2 | ||||
-rw-r--r-- | src/koopatlas/hud.cpp | 48 | ||||
-rw-r--r-- | src/koopatlas/hud.h | 3 | ||||
-rw-r--r-- | src/koopatlas/mapdata.h | 4 | ||||
-rw-r--r-- | src/koopatlas/pathmanager.cpp | 1 | ||||
-rw-r--r-- | src/levelinfo.cpp | 19 | ||||
-rw-r--r-- | src/levelinfo.h | 14 |
8 files changed, 75 insertions, 19 deletions
diff --git a/include/game.h b/include/game.h index ef6aba4..91dd77a 100755 --- a/include/game.h +++ b/include/game.h @@ -160,6 +160,7 @@ bool IsWideScreen(); #define COND_COIN1 1
#define COND_COIN2 2
#define COND_COIN3 4
+#define COND_COIN_ALL 7
#define COND_NORMAL 0x10
#define COND_SECRET 0x20
#define COND_SGNORMAL 0x80
@@ -244,7 +245,7 @@ public: GXColor hudTextColours[2]; // 0x730
s16 hudHintH, hudHintS, hudHintL; // 0x738
u8 currentMapMusic; // 0x73E
- u8 _padding; // 0x73F
+ u8 newerWorldID; // 0x73F
};
};
u8 toad_location[10]; // 0x742
diff --git a/src/fileselect.S b/src/fileselect.S index 6ee1c39..8e9249e 100644 --- a/src/fileselect.S +++ b/src/fileselect.S @@ -306,7 +306,7 @@ DefaultSavefileInfoData: .long 0x173714FF,0x3C9135FF .long 0xFFFF99FF,0x1FB423FF .short 0x75,0x2E,0xB -.byte 0,0 +.byte 0,1 DefaultSavefileInfoDataEnd: .long 0 diff --git a/src/koopatlas/hud.cpp b/src/koopatlas/hud.cpp index 2401a04..7046e77 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) @@ -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); } 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/mapdata.h b/src/koopatlas/mapdata.h index a0beb4d..8c133b4 100644 --- a/src/koopatlas/mapdata.h +++ b/src/koopatlas/mapdata.h @@ -193,11 +193,11 @@ struct dKPWorldDef_s { GXColor fsTextColours[2]; GXColor fsHintColours[2]; GXColor hudTextColours[2]; - u8 hudHintH; + u16 hudHintH; s8 hudHintS, hudHintL; u8 key, trackID; u8 worldID; - u8 padding1, padding2; + u8 padding; }; struct dKPMapFile_s { 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++) { diff --git a/src/levelinfo.cpp b/src/levelinfo.cpp index 8ce2845..d5ef8e7 100644 --- a/src/levelinfo.cpp +++ b/src/levelinfo.cpp @@ -7,10 +7,9 @@ void dLevelInfo_c::load(void *buffer) { for (int sect = 0; sect < sectionCount(); sect++) {
// parse this section
section_s *thisSect = getSectionByIndex(sect);
- entry_s *levels = getLevelsForSection(thisSect);
for (int lev = 0; lev < thisSect->levelCount; lev++) {
- entry_s *level = &levels[lev];
+ entry_s *level = &thisSect->levels[lev];
SetSomeConditionShit(level->worldSlot, level->levelSlot, level->flags);
@@ -28,7 +27,7 @@ dLevelInfo_c::entry_s *dLevelInfo_c::searchBySlot(int world, int level) { section_s *sect = getSectionByIndex(i);
for (int j = 0; j < sect->levelCount; j++) {
- entry_s *entry = &getLevelsForSection(sect)[j];
+ entry_s *entry = §->levels[j];
if (entry->worldSlot == world && entry->levelSlot == level)
return entry;
}
@@ -37,3 +36,17 @@ dLevelInfo_c::entry_s *dLevelInfo_c::searchBySlot(int world, int level) { return 0;
}
+dLevelInfo_c::entry_s *dLevelInfo_c::searchByDisplayNum(int world, int level) {
+ for (int i = 0; i < sectionCount(); i++) {
+ section_s *sect = getSectionByIndex(i);
+
+ for (int j = 0; j < sect->levelCount; j++) {
+ entry_s *entry = §->levels[j];
+ if (entry->displayWorld == world && entry->displayLevel == level)
+ return entry;
+ }
+ }
+
+ return 0;
+}
+
diff --git a/src/levelinfo.h b/src/levelinfo.h index 20628d9..8c8fe58 100644 --- a/src/levelinfo.h +++ b/src/levelinfo.h @@ -11,10 +11,6 @@ public: u32 sectionOffsets[1];
};
- struct section_s {
- u32 levelCount;
- };
-
struct entry_s {
u8 worldSlot;
u8 levelSlot;
@@ -26,6 +22,11 @@ public: u32 nameOffset;
};
+ struct section_s {
+ u32 levelCount;
+ entry_s levels[1];
+ };
+
private:
header_s *data;
@@ -33,6 +34,7 @@ public: void load(void *buffer);
entry_s *searchBySlot(int world, int level);
+ entry_s *searchByDisplayNum(int world, int level);
u32 sectionCount() {
return data->sectionCount;
@@ -42,10 +44,6 @@ public: return (section_s*)(((char*)data) + data->sectionOffsets[index]);
}
- entry_s *getLevelsForSection(section_s *section) {
- return (entry_s*)(section + 1);
- }
-
const char *getNameForLevel(entry_s *entry) {
return (const char*)data + entry->nameOffset;
}
|