#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; }