blob: c0130b008c5ac1f53dcecccd0132351740675b22 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
#include "levelinfo.h"
void LevelInfo::load(void *buffer) {
data = (Header*)buffer;
// decrypt all the level names
for (int sect = 0; sect < sectionCount(); sect++) {
// parse this section
Section *thisSect = getSectionByIndex(sect);
Entry *levels = getLevelsForSection(thisSect);
for (int lev = 0; lev < thisSect->levelCount; lev++) {
Entry *level = &levels[lev];
char *name = getNameForLevel(level);
for (int i = 0; i < level->nameLength+1; i++) {
name[i] -= 0xD0;
}
}
}
}
LevelInfo::Entry *LevelInfo::search(int world, int level) {
for (int i = 0; i < sectionCount(); i++) {
Section *sect = getSectionByIndex(i);
for (int j = 0; j < sect->levelCount; j++) {
Entry *entry = &getLevelsForSection(sect)[j];
if (entry->world == world && entry->level == level)
return entry;
}
}
return 0;
}
|