summaryrefslogtreecommitdiff
path: root/src/newer.cpp
diff options
context:
space:
mode:
authorTreeki <treeki@gmail.com>2013-01-31 04:19:18 +0100
committerTreeki <treeki@gmail.com>2013-01-31 04:19:18 +0100
commit6b12a531091c032c9299a1a260a22eacf226c598 (patch)
treeadda327442dba6f62038ff27a9240478d37d4870 /src/newer.cpp
parent5269d426aea072c714f68517079db024a2e3dec7 (diff)
downloadkamek-6b12a531091c032c9299a1a260a22eacf226c598.tar.gz
kamek-6b12a531091c032c9299a1a260a22eacf226c598.zip
file select's exit counter now ignores non-levels
Diffstat (limited to 'src/newer.cpp')
-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;
+}
+
+