X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Ffiles.c;h=0f478eb10164b241c93a980ce86c35f44e007a8a;hb=a601eb5bd800d544e8a5154a7b4d2457d020cd3f;hp=ebb61203b4793a13dfc02be87f13d176fe036af3;hpb=8d7a5267680e5bb2dbe9925e3d20ef32fda0c734;p=rocksndiamonds.git diff --git a/src/files.c b/src/files.c index ebb61203..0f478eb1 100644 --- a/src/files.c +++ b/src/files.c @@ -1319,6 +1319,8 @@ filetype_id_list[] = { LEVEL_FILE_TYPE_DX, "DX" }, { LEVEL_FILE_TYPE_SB, "SB" }, { LEVEL_FILE_TYPE_DC, "DC" }, + { LEVEL_FILE_TYPE_MM, "MM" }, + { LEVEL_FILE_TYPE_MM, "DF" }, { -1, NULL }, }; @@ -2120,6 +2122,16 @@ static void determineLevelFileInfo_Filename(struct LevelFileInfo *lfi) if (fileExists(lfi->filename)) return; } + else if (leveldir_current->level_filetype != NULL) + { + int filetype = getFiletypeFromID(leveldir_current->level_filetype); + + /* check for specified native level file with standard file name */ + setLevelFileInfo_FormatLevelFilename(lfi, filetype, + "%03d.%s", nr, LEVELFILE_EXTENSION); + if (fileExists(lfi->filename)) + return; + } /* check for native Rocks'n'Diamonds level file */ setLevelFileInfo_FormatLevelFilename(lfi, LEVEL_FILE_TYPE_RND, @@ -3884,7 +3896,7 @@ void CopyNativeLevel_RND_to_MM(struct LevelInfo *level) level_mm->encoding_16bit_field = level->encoding_16bit_field; level_mm->fieldx = MIN(level->fieldx, MM_MAX_PLAYFIELD_WIDTH); - level_mm->fieldy = MIN(level->fieldx, MM_MAX_PLAYFIELD_HEIGHT); + level_mm->fieldy = MIN(level->fieldy, MM_MAX_PLAYFIELD_HEIGHT); level_mm->time = level->time; level_mm->kettles_needed = level->gems_needed; @@ -3903,9 +3915,10 @@ void CopyNativeLevel_RND_to_MM(struct LevelInfo *level) level_mm->amoeba_speed = level->amoeba_speed; level_mm->time_fuse = 0; - for (y = 0; y < level_mm->fieldx; y++) - for (x = 0; x < level_mm->fieldy; x++) - level_mm->field[x][y] = map_element_RND_to_MM(level->field[x][y]); + for (x = 0; x < level->fieldx; x++) + for (y = 0; y < level->fieldy; y++) + Ur[x][y] = + level_mm->field[x][y] = map_element_RND_to_MM(level->field[x][y]); } void CopyNativeLevel_MM_to_RND(struct LevelInfo *level) @@ -3918,7 +3931,7 @@ void CopyNativeLevel_MM_to_RND(struct LevelInfo *level) level->encoding_16bit_field = level_mm->encoding_16bit_field; level->fieldx = MIN(level_mm->fieldx, MAX_LEV_FIELDX); - level->fieldy = MIN(level_mm->fieldx, MAX_LEV_FIELDY); + level->fieldy = MIN(level_mm->fieldy, MAX_LEV_FIELDY); level->time = level_mm->time; level->gems_needed = level_mm->kettles_needed; @@ -3932,9 +3945,20 @@ void CopyNativeLevel_MM_to_RND(struct LevelInfo *level) level->amoeba_speed = level_mm->amoeba_speed; - for (y = 0; y < level->fieldx; y++) - for (x = 0; x < level->fieldy; x++) + for (x = 0; x < level->fieldx; x++) + for (y = 0; y < level->fieldy; y++) level->field[x][y] = map_element_MM_to_RND(level_mm->field[x][y]); + + if (level_mm->auto_count_kettles) + { + level->gems_needed = 0; + + for (x = 0; x < level->fieldx; x++) + for (y = 0; y < level->fieldy; y++) + if (level->field[x][y] == EL_MM_KETTLE || + level->field[x][y] == EL_DF_CELL) + level->gems_needed++; + } }