diff options
author | Treeki <treeki@gmail.com> | 2011-03-12 23:17:12 +0100 |
---|---|---|
committer | Treeki <treeki@gmail.com> | 2011-03-12 23:17:12 +0100 |
commit | 7d4e4c0b34a613dd3c0220475ae4e448197522c1 (patch) | |
tree | 4f5cee367de3fdef4f9a7c84af59ffe76a2bb1c3 /src/levelinfo.h | |
download | kamek-7d4e4c0b34a613dd3c0220475ae4e448197522c1.tar.gz kamek-7d4e4c0b34a613dd3c0220475ae4e448197522c1.zip |
initial commit. now I can start playing with stuff!
Diffstat (limited to '')
-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..1b75275 --- /dev/null +++ b/src/levelinfo.h @@ -0,0 +1,56 @@ +#ifndef __NEWER_LEVELINFO_H
+#define __NEWER_LEVELINFO_H
+
+#include <common.h>
+#include "fileload.h"
+
+struct LevelInfo_Header {
+ u32 magic;
+ u32 sectionCount;
+};
+
+struct LevelInfo_Section {
+ u32 levelCount;
+};
+
+struct LevelInfo_Entry {
+ u8 world;
+ u8 level;
+ u8 reserved1;
+ u8 reserved2;
+ u8 nameLength;
+ u8 reserved3;
+ u16 flags;
+ u32 nameOffset;
+};
+
+inline u32 LevelInfo_GetSectionCount(void *file) {
+ return ((LevelInfo_Header*)file)->sectionCount;
+}
+
+inline u32 *LevelInfo_GetOffsets(void *file) {
+ return (u32*)(((LevelInfo_Header*)file)+1);
+}
+
+inline LevelInfo_Section *LevelInfo_GetSection(void *file, int id) {
+ u32 offs = LevelInfo_GetOffsets(file)[id];
+ return (LevelInfo_Section*)(((char*)file)+offs);
+};
+
+inline LevelInfo_Entry *LevelInfo_GetLevels(void *file, LevelInfo_Section *section) {
+ return (LevelInfo_Entry*)(section+1);
+}
+
+inline LevelInfo_Entry *LevelInfo_GetLevels(void *file, int sectionID) {
+ return (LevelInfo_Entry*)(LevelInfo_GetSection(file, sectionID)+1);
+}
+
+inline char *LevelInfo_GetName(void *file, LevelInfo_Entry *entry) {
+ return ((char*)file)+entry->nameOffset;
+}
+
+void LevelInfo_Prepare(FileHandle *fh);
+LevelInfo_Entry *LevelInfo_Search(void *file, int world, int level);
+
+
+#endif
|