From: Holger Schemel Date: Tue, 17 Jan 2023 23:09:55 +0000 (+0100) Subject: fixed using custom laser color defined in DF style laser for MM engine X-Git-Tag: 4.3.5.0~38 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=7f33353a6e8ce4dc9a3b7a604a4c7deb836544f7;p=rocksndiamonds.git fixed using custom laser color defined in DF style laser for MM engine --- diff --git a/src/files.c b/src/files.c index 926ce926..fb0c740c 100644 --- a/src/files.c +++ b/src/files.c @@ -4161,9 +4161,13 @@ static void CopyNativeLevel_RND_to_MM(struct LevelInfo *level) level_mm->kettles_needed = level->gems_needed; level_mm->auto_count_kettles = level->auto_count_gems; - level_mm->laser_red = level->mm_laser_red; - level_mm->laser_green = level->mm_laser_green; - level_mm->laser_blue = level->mm_laser_blue; + level_mm->mm_laser_red = level->mm_laser_red; + level_mm->mm_laser_green = level->mm_laser_green; + level_mm->mm_laser_blue = level->mm_laser_blue; + + level_mm->df_laser_red = level->df_laser_red; + level_mm->df_laser_green = level->df_laser_green; + level_mm->df_laser_blue = level->df_laser_blue; strcpy(level_mm->name, level->name); strcpy(level_mm->author, level->author); @@ -4205,9 +4209,13 @@ static void CopyNativeLevel_MM_to_RND(struct LevelInfo *level) level->gems_needed = level_mm->kettles_needed; level->auto_count_gems = level_mm->auto_count_kettles; - level->mm_laser_red = level_mm->laser_red; - level->mm_laser_green = level_mm->laser_green; - level->mm_laser_blue = level_mm->laser_blue; + level->mm_laser_red = level_mm->mm_laser_red; + level->mm_laser_green = level_mm->mm_laser_green; + level->mm_laser_blue = level_mm->mm_laser_blue; + + level->df_laser_red = level_mm->df_laser_red; + level->df_laser_green = level_mm->df_laser_green; + level->df_laser_blue = level_mm->df_laser_blue; strcpy(level->name, level_mm->name); diff --git a/src/game_mm/export.h b/src/game_mm/export.h index e9d84fda..b628a8d0 100644 --- a/src/game_mm/export.h +++ b/src/game_mm/export.h @@ -141,6 +141,7 @@ struct GameInfo_MM int lights_still_needed; int num_keys; int ball_choice_pos; // current content element choice position + boolean laser_red, laser_green, laser_blue; boolean level_solved; boolean game_over; @@ -164,7 +165,8 @@ struct LevelInfo_MM int time; int kettles_needed; boolean auto_count_kettles; - boolean laser_red, laser_green, laser_blue; + boolean mm_laser_red, mm_laser_green, mm_laser_blue; + boolean df_laser_red, df_laser_green, df_laser_blue; char name[MM_MAX_LEVEL_NAME_LEN + 1]; char author[MM_MAX_LEVEL_AUTHOR_LEN + 1]; int score[MM_LEVEL_SCORE_ELEMENTS]; diff --git a/src/game_mm/mm_files.c b/src/game_mm/mm_files.c index d334b8a0..4a853609 100644 --- a/src/game_mm/mm_files.c +++ b/src/game_mm/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'; @@ -209,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); @@ -401,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); diff --git a/src/game_mm/mm_game.c b/src/game_mm/mm_game.c index 571c9094..45c65634 100644 --- a/src/game_mm/mm_game.c +++ b/src/game_mm/mm_game.c @@ -433,9 +433,9 @@ static void SetLaserColor(int brightness) pen_ray = GetPixelFromRGB(window, - (native_mm_level.laser_red ? color_max : color_up), - (native_mm_level.laser_green ? color_down : color_min), - (native_mm_level.laser_blue ? color_down : color_min)); + (game_mm.laser_red ? color_max : color_up), + (game_mm.laser_green ? color_down : color_min), + (game_mm.laser_blue ? color_down : color_min)); } static void InitMovDir_MM(int x, int y) @@ -538,6 +538,19 @@ static void InitField(int x, int y) laser.start_edge.x = x; laser.start_edge.y = y; laser.start_angle = get_element_angle(element); + + if (IS_MCDUFFIN(element)) + { + game_mm.laser_red = native_mm_level.mm_laser_red; + game_mm.laser_green = native_mm_level.mm_laser_green; + game_mm.laser_blue = native_mm_level.mm_laser_blue; + } + else + { + game_mm.laser_red = native_mm_level.df_laser_red; + game_mm.laser_green = native_mm_level.df_laser_green; + game_mm.laser_blue = native_mm_level.df_laser_blue; + } } break; @@ -627,6 +640,10 @@ void InitGameEngine_MM(void) game_mm.num_keys = 0; game_mm.ball_choice_pos = 0; + game_mm.laser_red = FALSE; + game_mm.laser_green = FALSE; + game_mm.laser_blue = TRUE; + game_mm.level_solved = FALSE; game_mm.game_over = FALSE; game_mm.game_over_cause = 0;