summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTreeki <treeki@gmail.com>2012-09-27 23:29:46 +0200
committerTreeki <treeki@gmail.com>2012-09-27 23:29:46 +0200
commit81ef1a8b7f7d63c72b92f779d73a8b2b0f8158c1 (patch)
treeeb3567c82f79dd6290f95cfb6a6e600cea1e870f
parent624a89dc12d88973486b39937871c5facf6b9bb6 (diff)
downloadkamek-81ef1a8b7f7d63c72b92f779d73a8b2b0f8158c1.tar.gz
kamek-81ef1a8b7f7d63c72b92f779d73a8b2b0f8158c1.zip
new levelinfo format and a couple of fixes
-rw-r--r--src/koopatlas/core.cpp10
-rw-r--r--src/koopatlas/hud.cpp16
-rw-r--r--src/koopatlas/hud.h4
-rw-r--r--src/koopatlas/pathmanager.cpp9
-rw-r--r--src/koopatlas/pathmanager.h1
-rw-r--r--src/koopatlas/starcoin.cpp2
-rw-r--r--src/levelinfo.cpp4
-rw-r--r--src/levelinfo.h12
-rw-r--r--src/levelinfo_old.cpp4
-rw-r--r--src/levelinfo_old.h12
-rw-r--r--src/levelnames.cpp2
11 files changed, 47 insertions, 29 deletions
diff --git a/src/koopatlas/core.cpp b/src/koopatlas/core.cpp
index c20d715..cb13119 100644
--- a/src/koopatlas/core.cpp
+++ b/src/koopatlas/core.cpp
@@ -970,13 +970,13 @@ void dScKoopatlas_c::startLevel(dLevelInfo_c::entry_s *entry) {
sl.unk4 = 0;
sl.purpose = 0;
- sl.world1 = entry->world;
- sl.world2 = entry->world;
- sl.level1 = entry->level;
- sl.level2 = entry->level;
+ sl.world1 = entry->worldSlot;
+ sl.world2 = entry->worldSlot;
+ sl.level1 = entry->levelSlot;
+ sl.level2 = entry->levelSlot;
// hopefully this will fix the Star Coin issues
- SetSomeConditionShit(entry->world, entry->level, 2);
+ SetSomeConditionShit(entry->worldSlot, entry->levelSlot, 2);
ActivateWipe(WIPE_MARIO);
diff --git a/src/koopatlas/hud.cpp b/src/koopatlas/hud.cpp
index 90e769e..667feb2 100644
--- a/src/koopatlas/hud.cpp
+++ b/src/koopatlas/hud.cpp
@@ -156,6 +156,7 @@ dWMHud_c *dWMHud_c::build() {
dWMHud_c::dWMHud_c() {
layoutLoaded = false;
displayedControllerType = -1;
+ isFooterVisible = false;
}
enum WMHudAnimation {
@@ -267,6 +268,7 @@ int dWMHud_c::onExecute() {
if (willShowFooter && (!(layout.isAnimOn(SHOW_FOOTER)))) {
willShowFooter = false;
+ isFooterVisible = true;
loadFooterInfo();
playShowAnim(SHOW_FOOTER);
}
@@ -310,13 +312,15 @@ void dWMHud_c::playHideAnim(int id) {
layout.enableNonLoopAnim(id, true);
}
layout.grpHandlers[id].frameCtrl.flags = 3; // NO_LOOP | REVERSE
+ if (id == SHOW_FOOTER)
+ isFooterVisible = false;
}
void dWMHud_c::loadHeaderInfo() {
dLevelInfo_c *levelInfo = &dScKoopatlas_c::instance->levelInfo;
- dLevelInfo_c::entry_s *infEntry = levelInfo->search(
+ dLevelInfo_c::entry_s *infEntry = levelInfo->searchBySlot(
nodeForHeader->levelNumber[0]-1, nodeForHeader->levelNumber[1]-1);
if (infEntry == 0) {
@@ -434,9 +438,15 @@ void dWMHud_c::leftNode() {
}
-void dWMHud_c::hideAndShowFooter() {
+void dWMHud_c::hideFooter() {
+ if (isFooterVisible)
+ playHideAnim(SHOW_FOOTER);
+}
+
+void dWMHud_c::showFooter() {
willShowFooter = true;
- playHideAnim(SHOW_FOOTER);
+ if (isFooterVisible)
+ playHideAnim(SHOW_FOOTER);
}
diff --git a/src/koopatlas/hud.h b/src/koopatlas/hud.h
index c0079af..05ad07c 100644
--- a/src/koopatlas/hud.h
+++ b/src/koopatlas/hud.h
@@ -38,7 +38,8 @@ class dWMHud_c : public dBase_c {
void enteredNode(dKPNode_s *node = 0);
void leftNode();
- void hideAndShowFooter();
+ void hideFooter();
+ void showFooter();
void setupLives();
@@ -55,6 +56,7 @@ class dWMHud_c : public dBase_c {
void loadFooterInfo();
bool willShowFooter;
+ bool isFooterVisible;
dTexMapColouriser_c headerCol, footerCol;
diff --git a/src/koopatlas/pathmanager.cpp b/src/koopatlas/pathmanager.cpp
index 8a05ea4..c691a89 100644
--- a/src/koopatlas/pathmanager.cpp
+++ b/src/koopatlas/pathmanager.cpp
@@ -628,8 +628,13 @@ void dWMPathManager_c::moveThroughPath() {
save->hudHintL = world->hudHintL;
if (dWMHud_c::instance)
- dWMHud_c::instance->hideAndShowFooter();
+ dWMHud_c::instance->showFooter();
}
+ } else if (to->worldID == 0) {
+ OSReport("No world\n");
+ save->newerWorldName[0] = 0;
+ if (dWMHud_c::instance)
+ dWMHud_c::instance->hideFooter();
} else {
OSReport("Not found!\n");
}
@@ -710,7 +715,7 @@ void dWMPathManager_c::activatePoint() {
isEnteringLevel = true;
levelStartWait = 40;
- enteredLevel = dScKoopatlas_c::instance->levelInfo.search(w, l);
+ enteredLevel = dScKoopatlas_c::instance->levelInfo.searchBySlot(w, l);
}
}
diff --git a/src/koopatlas/pathmanager.h b/src/koopatlas/pathmanager.h
index 5579f66..a1d916d 100644
--- a/src/koopatlas/pathmanager.h
+++ b/src/koopatlas/pathmanager.h
@@ -9,6 +9,7 @@
#endif
#include "koopatlas/mapdata.h"
+#include "levelinfo.h"
extern "C" void *SoundRelatedClass;
extern "C" void *MapSoundPlayer(void *SoundClass, int soundID, int unk);
diff --git a/src/koopatlas/starcoin.cpp b/src/koopatlas/starcoin.cpp
index 3842f87..4366895 100644
--- a/src/koopatlas/starcoin.cpp
+++ b/src/koopatlas/starcoin.cpp
@@ -238,7 +238,7 @@ void dWMStarCoin::LoadCoinsForWorld(int world) {
if (levelArray[world][l][i]) {
levelNum--;
dLevelInfo_c *li = &dScKoopatlas_c::instance->levelInfo;
- dLevelInfo_c::entry_s *entry = li->search(world, levelNum);
+ dLevelInfo_c::entry_s *entry = li->searchBySlot(world, levelNum);
setText(li->getNameForLevel(entry), levelPane);
totalCoins += 3;
diff --git a/src/levelinfo.cpp b/src/levelinfo.cpp
index 3a0ef6f..fd147f3 100644
--- a/src/levelinfo.cpp
+++ b/src/levelinfo.cpp
@@ -21,13 +21,13 @@ void dLevelInfo_c::load(void *buffer) {
}
}
-dLevelInfo_c::entry_s *dLevelInfo_c::search(int world, int level) {
+dLevelInfo_c::entry_s *dLevelInfo_c::searchBySlot(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 = &getLevelsForSection(sect)[j];
- if (entry->world == world && entry->level == level)
+ if (entry->worldSlot == world && entry->levelSlot == level)
return entry;
}
}
diff --git a/src/levelinfo.h b/src/levelinfo.h
index 470992b..8d8a4e5 100644
--- a/src/levelinfo.h
+++ b/src/levelinfo.h
@@ -16,13 +16,13 @@ public:
};
struct entry_s {
- u8 world;
- u8 level;
- u8 reserved1;
- u8 reserved2;
+ u8 worldSlot;
+ u8 levelSlot;
+ u8 displayWorld;
+ u8 displayLevel;
u8 nameLength;
u8 reserved3;
- u16 flags;
+ u16 reserved4;
u32 nameOffset;
};
@@ -32,7 +32,7 @@ private:
public:
void load(void *buffer);
- entry_s *search(int world, int level);
+ entry_s *searchBySlot(int world, int level);
u32 sectionCount() {
return data->sectionCount;
diff --git a/src/levelinfo_old.cpp b/src/levelinfo_old.cpp
index 01dda85..bd5a2eb 100644
--- a/src/levelinfo_old.cpp
+++ b/src/levelinfo_old.cpp
@@ -21,13 +21,13 @@ void LevelInfo_Prepare(FileHandle *fh) {
}
}
-LevelInfo_Entry *LevelInfo_Search(void *file, int world, int level) {
+LevelInfo_Entry *LevelInfo_SearchSlot(void *file, int world, int level) {
for (int i = 0; i < LevelInfo_GetSectionCount(file); i++) {
LevelInfo_Section *sect = LevelInfo_GetSection(file, i);
for (int j = 0; j < sect->levelCount; j++) {
LevelInfo_Entry *entry = &LevelInfo_GetLevels(file, sect)[j];
- if (entry->world == world && entry->level == level)
+ if (entry->worldSlot == world && entry->levelSlot == level)
return entry;
}
}
diff --git a/src/levelinfo_old.h b/src/levelinfo_old.h
index d8cb888..50760c5 100644
--- a/src/levelinfo_old.h
+++ b/src/levelinfo_old.h
@@ -14,13 +14,13 @@ struct LevelInfo_Section {
};
struct LevelInfo_Entry {
- u8 world;
- u8 level;
- u8 reserved1;
- u8 reserved2;
+ u8 worldSlot;
+ u8 levelSlot;
+ u8 displayWorld;
+ u8 displayLevel;
u8 nameLength;
u8 reserved3;
- u16 flags;
+ u16 reserved4;
u32 nameOffset;
};
@@ -50,7 +50,7 @@ inline char *LevelInfo_GetName(void *file, LevelInfo_Entry *entry) {
}
void LevelInfo_Prepare(FileHandle *fh);
-LevelInfo_Entry *LevelInfo_Search(void *file, int world, int level);
+LevelInfo_Entry *LevelInfo_SearchSlot(void *file, int world, int level);
#endif
diff --git a/src/levelnames.cpp b/src/levelnames.cpp
index 1f05386..7c64c0b 100644
--- a/src/levelnames.cpp
+++ b/src/levelnames.cpp
@@ -38,7 +38,7 @@ int DoNames(int state) {
void *info = LoadFile(&fh, "/NewerRes/LevelInfo.bin");
LevelInfo_Prepare(&fh);
- LevelInfo_Entry *entry = LevelInfo_Search(info, wnum, lnum);
+ LevelInfo_Entry *entry = LevelInfo_SearchSlot(info, wnum, lnum);
char *worldname = LevelInfo_GetName(info, entry);
char *levelname = "";