diff options
author | Treeki <treeki@gmail.com> | 2012-01-17 00:40:00 +0100 |
---|---|---|
committer | Treeki <treeki@gmail.com> | 2012-01-17 00:40:00 +0100 |
commit | bb5d7f7e737e318d095d23939b7d288eaf5f9e63 (patch) | |
tree | ec41984cd10376e7fec2b24e22b1b695c3692b36 /src/levelinfo.cpp | |
parent | 28efd888af3ffe227565683e2cd2960ea5b52f61 (diff) | |
download | kamek-bb5d7f7e737e318d095d23939b7d288eaf5f9e63.tar.gz kamek-bb5d7f7e737e318d095d23939b7d288eaf5f9e63.zip |
added path support and the new API LevelInfo
Diffstat (limited to '')
-rw-r--r-- | src/levelinfo.cpp | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/src/levelinfo.cpp b/src/levelinfo.cpp new file mode 100644 index 0000000..3a0ef6f --- /dev/null +++ b/src/levelinfo.cpp @@ -0,0 +1,37 @@ +#include "levelinfo.h"
+
+void dLevelInfo_c::load(void *buffer) {
+ data = (header_s*)buffer;
+
+ // decode all the level names
+ for (int sect = 0; sect < sectionCount(); sect++) {
+ // parse this section
+ section_s *thisSect = getSectionByIndex(sect);
+ entry_s *levels = getLevelsForSection(thisSect);
+
+ for (int lev = 0; lev < thisSect->levelCount; lev++) {
+ entry_s *level = &levels[lev];
+
+ char *name = (char*)getNameForLevel(level);
+
+ for (int i = 0; i < level->nameLength+1; i++) {
+ name[i] -= 0xD0;
+ }
+ }
+ }
+}
+
+dLevelInfo_c::entry_s *dLevelInfo_c::search(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)
+ return entry;
+ }
+ }
+
+ return 0;
+}
+
|