diff options
Diffstat (limited to '')
-rw-r--r-- | src/koopatlas/mapdata.h | 39 |
1 files changed, 31 insertions, 8 deletions
diff --git a/src/koopatlas/mapdata.h b/src/koopatlas/mapdata.h index 18dd9ee..40e1a43 100644 --- a/src/koopatlas/mapdata.h +++ b/src/koopatlas/mapdata.h @@ -70,13 +70,13 @@ struct dKPNode_s { NodeTypes type; + bool isNew; + dKPNodeExtra_c *extra; // The union is placed at the very end so we can leave out padding in the // kpbin union { - // struct { u8 levelNumber[2]; }; - // FORWARDS COMPATIBILITY: struct { u8 levelNumber[2]; bool hasSecret; }; struct { const char *destMap; u8 thisID, foreignID, transition, _; }; }; @@ -91,18 +91,37 @@ struct dKPNode_s { bool isUnlocked(); void setupNodeExtra(); - dKPPath_s *getOppositeExitTo(dKPPath_s *path); + dKPPath_s *getOppositeExitTo(dKPPath_s *path, bool mustBeAvailable=false); + dKPPath_s *getOppositeAvailableExitTo(dKPPath_s *path) { + return getOppositeExitTo(path, true); + } + + int getExitCount(bool mustBeAvailable=false); + int getAvailableExitCount() { + return getExitCount(true); + } + + void setLayerAlpha(u8 alpha); }; struct dKPPath_s { + enum Availability { + NOT_AVAILABLE = 0, + AVAILABLE = 1, + NEWLY_AVAILABLE = 2, + ALWAYS_AVAILABLE = 3 + }; + dKPNode_s *start, *end; dKPLayer_s *tileLayer, *doodadLayer; - u8 unlockType; // 0 = always, 1 = normal, 2 = secret - u8 unlockLevelNumber[2]; - bool isAvailable; // computed on-the-fly - default from Koopatlas is true + u8 isAvailable; // computed on-the-fly - default from Koopatlas is NOT or ALWAYS + u8 isSecret; + u8 _padding[2]; float speed; int animation; + + void setLayerAlpha(u8 alpha); }; /****************************************************************************** @@ -114,6 +133,8 @@ struct dKPLayer_s { }; LayerTypes type; + u8 alpha; + u8 _padding[3]; typedef u16 sector_s[16][16]; @@ -164,6 +185,8 @@ struct dKPMapFile_s { int tilesetCount; GXTexObj *tilesets; + u8 *unlockData; + dKPLayer_s::sector_s sectors[1]; // variable size }; @@ -174,7 +197,7 @@ class dKPMapData_c { template <typename T> inline T* fixRef(T*& indexAsPtr) { unsigned int index = (unsigned int)indexAsPtr; - if (index == 0xFFFFFFFF) + if (index == 0xFFFFFFFF || index == 0) indexAsPtr = 0; else indexAsPtr = (T*)(((char*)data) + index); @@ -184,7 +207,7 @@ class dKPMapData_c { template <typename T> inline T* fixRefSafe(T*& indexAsPtr) { unsigned int index = (unsigned int)indexAsPtr; - if (index == 0xFFFFFFFF) + if (index == 0xFFFFFFFF || index == 0) indexAsPtr = 0; else if (index < 0x80000000) indexAsPtr = (T*)(((char*)data) + index); |