summaryrefslogtreecommitdiff
path: root/src/newer.cpp
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/newer.cpp38
1 files changed, 38 insertions, 0 deletions
diff --git a/src/newer.cpp b/src/newer.cpp
index 50fc1d1..3635c09 100644
--- a/src/newer.cpp
+++ b/src/newer.cpp
@@ -1,5 +1,6 @@
#include <game.h>
#include <newer.h>
+#include "levelinfo.h"
int lastLevelIDs[] = {
-1, /*no world*/
@@ -91,3 +92,40 @@ int getStarCoinCount() {
return coinsEarned;
}
+
+
+struct GEIFS {
+ int starCoins, exits;
+};
+extern "C" GEIFS *GrabExitInfoForFileSelect(GEIFS *out, SaveBlock *save) {
+ out->starCoins = 0;
+ out->exits = 0;
+
+ for (int i = 0; i < dLevelInfo_c::s_info.sectionCount(); i++) {
+ dLevelInfo_c::section_s *section = dLevelInfo_c::s_info.getSectionByIndex(i);
+
+ for (int j = 0; j < section->levelCount; j++) {
+ dLevelInfo_c::entry_s *l = &section->levels[j];
+ if (l->flags & 2) {
+ //OSReport("Checking %d-%d...\n", l->worldSlot+1, l->levelSlot+1);
+ u32 cond = save->GetLevelCondition(l->worldSlot, l->levelSlot);
+ if ((l->flags & 0x10) && (cond & COND_NORMAL))
+ out->exits++;
+ if ((l->flags & 0x20) && (cond & COND_SECRET))
+ out->exits++;
+ if (cond & COND_COIN1)
+ out->starCoins++;
+ if (cond & COND_COIN2)
+ out->starCoins++;
+ if (cond & COND_COIN3)
+ out->starCoins++;
+ }
+ }
+ }
+
+ OSReport("Done, got %d coins and %d exits\n", out->starCoins, out->exits);
+
+ return out;
+}
+
+