diff options
Diffstat (limited to 'src/levelinfo.h')
-rw-r--r-- | src/levelinfo.h | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/src/levelinfo.h b/src/levelinfo.h new file mode 100644 index 0000000..470992b --- /dev/null +++ b/src/levelinfo.h @@ -0,0 +1,56 @@ +#ifndef __NEWER_LEVELINFO_H
+#define __NEWER_LEVELINFO_H
+
+#include <common.h>
+
+class dLevelInfo_c {
+public:
+ struct header_s {
+ u32 magic;
+ u32 sectionCount;
+ u32 sectionOffsets[1];
+ };
+
+ struct section_s {
+ u32 levelCount;
+ };
+
+ struct entry_s {
+ u8 world;
+ u8 level;
+ u8 reserved1;
+ u8 reserved2;
+ u8 nameLength;
+ u8 reserved3;
+ u16 flags;
+ u32 nameOffset;
+ };
+
+private:
+ header_s *data;
+
+public:
+ void load(void *buffer);
+
+ entry_s *search(int world, int level);
+
+ u32 sectionCount() {
+ return data->sectionCount;
+ }
+
+ section_s *getSectionByIndex(u32 index) {
+ return (section_s*)(((char*)data) + data->sectionOffsets[index]);
+ }
+
+ entry_s *getLevelsForSection(section_s *section) {
+ return (entry_s*)(section + 1);
+ }
+
+ const char *getNameForLevel(entry_s *entry) {
+ return (const char*)data + entry->nameOffset;
+ }
+};
+
+
+#endif
+
|