Commit 11f2edb4 authored by alistert's avatar alistert

JJ1 levels can now have any file name.

parent 583c31c2
......@@ -209,7 +209,7 @@ int Game::play () {
}
planet = NULL;
fileName = createFileName(F_PLANET, levelFile + strlen(levelFile) - 3);
fileName = createFileName(F_PLANET, level->getWorld());
try {
......
......@@ -177,6 +177,13 @@ bool Level::checkSpikes (fixed x, fixed y) {
}
int Level::getWorld() {
return worldNum;
}
void Level::setNext (int nextLevel, int nextWorld) {
unsigned char buffer[MTL_L_PROP];
......
......@@ -143,6 +143,7 @@ class Level : public BaseLevel {
bool checkMaskUp (fixed x, fixed y);
bool checkMaskDown (fixed x, fixed y);
bool checkSpikes (fixed x, fixed y);
int getWorld ();
void setNext (int nextLevel, int nextWorld);
void setTile (unsigned char gridX, unsigned char gridY, unsigned char tile);
Event* getEvents ();
......
......@@ -470,21 +470,25 @@ int Level::load (char *fileName, unsigned char diff, bool checkpoint) {
} catch (int e) {
delete[] string;
deletePanel();
delete font;
return e;
file = NULL;
}
delete[] string;
if (file) {
file->seek(2, true);
string = file->loadString();
delete file;
} else {
string = createString("CUSTOM");
}
}
switch (fileName[5]) {
......@@ -581,16 +585,9 @@ int Level::load (char *fileName, unsigned char diff, bool checkpoint) {
file->seek(8, false);
ext = file->loadString();
if (!strcmp(ext, "999")) {
// Use the level file's extension instead
delete[] ext;
ext = createString(fileName + strlen(fileName) - 3);
}
// Allocate space for file names
string = createFileName(F_BLOCKS, ext);
// Create tile set file name
if (!strcmp(ext, "999")) string = createFileName(F_BLOCKS, worldNum);
else string = createFileName(F_BLOCKS, ext);
delete[] ext;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment