X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Fgame_mm%2Fmm_files.c;h=4a85360925f4b409d969d114a3fca4718a6195ce;hb=HEAD;hp=b2899f0123d528d2110840de37e64e9c0700a379;hpb=64e7c54dce6ea8c063f04198c64c5057d751c928;p=rocksndiamonds.git diff --git a/src/game_mm/mm_files.c b/src/game_mm/mm_files.c index b2899f01..4a853609 100644 --- a/src/game_mm/mm_files.c +++ b/src/game_mm/mm_files.c @@ -4,7 +4,7 @@ // (c) 1994-2017 by Artsoft Entertainment // Holger Schemel // info@artsoft.org -// http://www.artsoft.org/ +// https://www.artsoft.org/ // ---------------------------------------------------------------------------- // mm_files.c // ============================================================================ @@ -112,9 +112,12 @@ void setLevelInfoToDefaults_MM(void) native_mm_level.time_bomb = 75; native_mm_level.time_ball = 75; native_mm_level.time_block = 75; - native_mm_level.laser_red = FALSE; - native_mm_level.laser_green = FALSE; - native_mm_level.laser_blue = TRUE; + native_mm_level.mm_laser_red = FALSE; + native_mm_level.mm_laser_green = FALSE; + native_mm_level.mm_laser_blue = TRUE; + native_mm_level.df_laser_red = TRUE; + native_mm_level.df_laser_green = TRUE; + native_mm_level.df_laser_blue = FALSE; for (i = 0; i < MAX_LEVEL_NAME_LEN; i++) native_mm_level.name[i] = '\0'; @@ -127,6 +130,25 @@ void setLevelInfoToDefaults_MM(void) for (i = 0; i < LEVEL_SCORE_ELEMENTS; i++) native_mm_level.score[i] = 10; + int ball_content[] = + { + EL_MIRROR_START, + EL_MIRROR_FIXED_START, + EL_POLAR_START, + EL_POLAR_CROSS_START, + EL_PACMAN_START, + EL_KETTLE, + EL_BOMB, + EL_PRISM + }; + int num_ball_contents = sizeof(ball_content) / sizeof(int); + + native_mm_level.num_ball_contents = num_ball_contents; + native_mm_level.ball_choice_mode = ANIM_RANDOM; + + for (i = 0; i < num_ball_contents; i++) + native_mm_level.ball_content[i] = ball_content[i]; + native_mm_level.field[0][0] = Ur[0][0] = EL_MCDUFFIN_RIGHT; native_mm_level.field[STD_LEV_FIELDX-1][STD_LEV_FIELDY-1] = Ur[STD_LEV_FIELDX-1][STD_LEV_FIELDY-1] = EL_EXIT_CLOSED; @@ -136,7 +158,8 @@ static int checkLevelElement(int element) { if (element >= EL_FIRST_RUNTIME_EL) { - Error(ERR_WARN, "invalid level element %d", element); + Warn("invalid level element %d", element); + element = EL_CHAR_FRAGE; } @@ -189,9 +212,9 @@ static int LoadLevel_MM_HEAD(File *file, int chunk_size, level->time_fuse = 25; laser_color = getFile8Bit(file); - level->laser_red = (laser_color >> 2) & 0x01; - level->laser_green = (laser_color >> 1) & 0x01; - level->laser_blue = (laser_color >> 0) & 0x01; + level->mm_laser_red = (laser_color >> 2) & 0x01; + level->mm_laser_green = (laser_color >> 1) & 0x01; + level->mm_laser_blue = (laser_color >> 0) & 0x01; level->encoding_16bit_field = (getFile8Bit(file) == 1 ? TRUE : FALSE); @@ -270,7 +293,7 @@ boolean LoadNativeLevel_MM(char *filename, boolean level_info_only) if (!(file = openFile(filename, MODE_READ))) { if (!level_info_only) - Error(ERR_WARN, "cannot read level '%s' - creating new level", filename); + Warn("cannot read level '%s' - creating new level", filename); return FALSE; } @@ -283,7 +306,7 @@ boolean LoadNativeLevel_MM(char *filename, boolean level_info_only) getFileChunk(file, chunk_name, NULL, BYTE_ORDER_BIG_ENDIAN); if (strcmp(chunk_name, "CAVE") != 0) { - Error(ERR_WARN, "unknown format of level file '%s'", filename); + Warn("unknown format of level file '%s'", filename); closeFile(file); @@ -299,7 +322,7 @@ boolean LoadNativeLevel_MM(char *filename, boolean level_info_only) if (!checkCookieString(cookie, LEVEL_COOKIE_TMPL)) { - Error(ERR_WARN, "unknown format of level file '%s'", filename); + Warn("unknown format of level file '%s'", filename); closeFile(file); @@ -309,7 +332,7 @@ boolean LoadNativeLevel_MM(char *filename, boolean level_info_only) if ((native_mm_level.file_version = getFileVersionFromCookieString(cookie)) == -1) { - Error(ERR_WARN, "unsupported version of level file '%s'", filename); + Warn("unsupported version of level file '%s'", filename); closeFile(file); @@ -327,7 +350,7 @@ boolean LoadNativeLevel_MM(char *filename, boolean level_info_only) if (chunk_info[i].name == NULL) { - Error(ERR_WARN, "unknown chunk '%s' in level file '%s'", + Warn("unknown chunk '%s' in level file '%s'", chunk_name, filename); ReadUnusedBytesFromFile(file, chunk_size); @@ -335,7 +358,7 @@ boolean LoadNativeLevel_MM(char *filename, boolean level_info_only) else if (chunk_info[i].size != -1 && chunk_info[i].size != chunk_size) { - Error(ERR_WARN, "wrong size (%d) of chunk '%s' in level file '%s'", + Warn("wrong size (%d) of chunk '%s' in level file '%s'", chunk_size, chunk_name, filename); ReadUnusedBytesFromFile(file, chunk_size); @@ -346,11 +369,11 @@ boolean LoadNativeLevel_MM(char *filename, boolean level_info_only) int chunk_size_expected = (chunk_info[i].loader)(file, chunk_size, &native_mm_level); - /* the size of some chunks cannot be checked before reading other - chunks first (like "HEAD" and "BODY") that contain some header - information, so check them here */ + // the size of some chunks cannot be checked before reading other + // chunks first (like "HEAD" and "BODY") that contain some header + // information, so check them here if (chunk_size_expected != chunk_size) - Error(ERR_WARN, "wrong size (%d) of chunk '%s' in level file '%s'", + Warn("wrong size (%d) of chunk '%s' in level file '%s'", chunk_size, chunk_name, filename); } } @@ -381,9 +404,9 @@ static void SaveLevel_MM_HEAD(FILE *file, struct LevelInfo_MM *level) fputc(level->amoeba_speed, file); fputc(level->time_fuse, file); - laser_color = ((level->laser_red << 2) | - (level->laser_green << 1) | - (level->laser_blue << 0)); + laser_color = ((level->mm_laser_red << 2) | + (level->mm_laser_green << 1) | + (level->mm_laser_blue << 0)); fputc(laser_color, file); fputc((level->encoding_16bit_field ? 1 : 0), file); @@ -419,7 +442,7 @@ void SaveNativeLevel_MM(char *filename) if (!(file = fopen(filename, MODE_WRITE))) { - Error(ERR_WARN, "cannot save level file '%s'", filename); + Warn("cannot save level file '%s'", filename); return; }