#ifndef __NEWER_LEVELINFO_H #define __NEWER_LEVELINFO_H #include class LevelInfo { public: struct Header { u32 magic; u32 sectionCount; u32 sectionOffsets[1]; }; struct Section { u32 levelCount; }; struct Entry { u8 world; u8 level; u8 reserved1; u8 reserved2; u8 nameLength; u8 reserved3; u16 flags; u32 nameOffset; }; private: Header *data; public: void load(void *buffer); Entry *search(int world, int level); u32 sectionCount() { return data->sectionCount; } Section *getSectionByIndex(u32 index) { return (Section*)(((char*)data) + data->sectionOffsets[index]); } Entry *getLevelsForSection(Section *section) { return (Entry*)(section + 1); } char *getNameForLevel(Entry *entry) { return (char*)data + entry->nameOffset; } }; #endif