#define TAPE_COOKIE_TMPL "ROCKSNDIAMONDS_TAPE_FILE_VERSION_x.x"
#define SCORE_COOKIE "ROCKSNDIAMONDS_SCORE_FILE_VERSION_1.2"
+static struct
+{
+ int filetype;
+ char *id;
+}
+filetype_id_list[] =
+{
+ { LEVEL_FILE_TYPE_RND, "RND" },
+ { LEVEL_FILE_TYPE_BD, "BD" },
+ { LEVEL_FILE_TYPE_EM, "EM" },
+ { LEVEL_FILE_TYPE_SP, "SP" },
+ { LEVEL_FILE_TYPE_DX, "DX" },
+ { LEVEL_FILE_TYPE_SB, "SB" },
+ { LEVEL_FILE_TYPE_DC, "DC" },
+ { -1, NULL },
+};
+
/* ========================================================================= */
/* level file functions */
if (level_filename == NULL)
level_filename = getStringCat2("%03d.", LEVELFILE_EXTENSION);
+ else
+ type = LEVEL_FILE_TYPE_UNKNOWN; /* force specified file name/pattern */
switch (type)
{
lfi->filename = getLevelFilenameFromBasename(lfi->basename);
}
+static int getFiletypeFromID(char *filetype_id)
+{
+ char *filetype_id_lower;
+ int filetype = LEVEL_FILE_TYPE_UNKNOWN;
+ int i;
+
+ if (filetype_id == NULL)
+ return LEVEL_FILE_TYPE_UNKNOWN;
+
+ filetype_id_lower = getStringToLower(filetype_id);
+
+ for (i = 0; filetype_id_list[i].id != NULL; i++)
+ {
+ char *id_lower = getStringToLower(filetype_id_list[i].id);
+
+ if (strcmp(filetype_id_lower, id_lower) == 0)
+ filetype = filetype_id_list[i].filetype;
+
+ free(id_lower);
+
+ if (filetype != LEVEL_FILE_TYPE_UNKNOWN)
+ break;
+ }
+
+ free(filetype_id_lower);
+
+ return filetype;
+}
+
static void determineLevelFileInfo_Filename(struct LevelFileInfo *lfi)
{
/* special case: level number is negative => check for level template file */
if (leveldir_current->level_filename != NULL)
{
+ int filetype = getFiletypeFromID(leveldir_current->level_filetype);
+
/* check for file name/pattern specified in "levelinfo.conf" */
- setLevelFileInfo_SingleLevelFilename(lfi, LEVEL_FILE_TYPE_UNKNOWN);
+ setLevelFileInfo_SingleLevelFilename(lfi, filetype);
+
if (fileExists(lfi->filename))
return;
}
lev->width = MIN(level->fieldx, EM_MAX_CAVE_WIDTH);
lev->height = MIN(level->fieldy, EM_MAX_CAVE_HEIGHT);
- lev->time_initial = level->time * 5;
+ lev->time_seconds = level->time;
lev->required_initial = level->gems_needed;
lev->emerald_score = level->score[SC_EMERALD];
level->fieldx = MIN(lev->width, MAX_LEV_FIELDX);
level->fieldy = MIN(lev->height, MAX_LEV_FIELDY);
- level->time = lev->time_initial / 5;
+ level->time = lev->time_seconds;
level->gems_needed = lev->required_initial;
sprintf(level->name, "Level %d", level->file_info.nr);
};
unsigned int i, x, y, temp;
+#if 1
+ lev.time_seconds = src[0x83E] << 8 | src[0x83F];
+ if (lev.time_seconds > 9999)
+ lev.time_seconds = 9999;
+#else
temp = ((src[0x83E] << 8 | src[0x83F]) * 25 + 3) / 4;
if (temp == 0 || temp > 9999)
temp = 9999;
lev.time_initial = temp;
+#endif
+
lev.required_initial = src[0x82F];
temp = src[0x830] << 8 | src[0x831];
for (x = 0; x < WIDTH; x++)
Draw[y][x] = Cave[y][x];
+ lev.time_initial = (lev.time_seconds * 50 + 7) / 8;
lev.time = lev.time_initial;
+
lev.required = lev.required_initial;
lev.score = 0;