X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Fgame_mm%2Fmm_game.c;h=a3c22be01a129c6764956c55dca15d229906cee5;hb=a63bf9c0f6165159f261eda69e1b293365cc9162;hp=d4838873c978d51a4958a657ed11b76656315572;hpb=96f2e9a0b1306fa108f3f7e81ad8b8d323ca5517;p=rocksndiamonds.git diff --git a/src/game_mm/mm_game.c b/src/game_mm/mm_game.c index d4838873..a3c22be0 100644 --- a/src/game_mm/mm_game.c +++ b/src/game_mm/mm_game.c @@ -537,7 +537,6 @@ static void InitCycleElements_RotateSingleStep(void) Tile[x][y] = next_element; - DrawField_MM(x, y); game_mm.cycle[i].steps -= step; } } @@ -691,6 +690,11 @@ void InitGameActions_MM(void) cycle_steps_done++; } + AdvanceFrameCounter(); + AdvanceGfxFrame(); + + DrawLevel_MM(); + BackToFront(); ColorCycling(); @@ -710,6 +714,32 @@ void InitGameActions_MM(void) SetTileCursorActive(TRUE); } +static void FadeOutLaser(boolean overloaded) +{ + int i; + + for (i = 15; i >= 0; i--) + { + if (overloaded) + pen_ray = GetPixelFromRGB(window, 0x11 * i, 0x00, 0x00); + else + pen_ray = GetPixelFromRGB(window, + native_mm_level.laser_red * 0x11 * i, + native_mm_level.laser_green * 0x11 * i, + native_mm_level.laser_blue * 0x11 * i); + + DrawLaser(0, DL_LASER_ENABLED); + + BackToFront(); + Delay_WithScreenUpdates(50); + } + + DrawLaser(0, DL_LASER_DISABLED); + + if (!overloaded) + StopSound_MM(SND_MM_GAME_HEALTH_CHARGING); +} + void AddLaserEdge(int lx, int ly) { int clx = dSX + lx; @@ -1459,14 +1489,14 @@ boolean HitElement(int element, int hit_mask) LX += step_size * XS; LY += step_size * YS; -#if 0 // draw sparkles on mirror - if ((IS_MIRROR(element) || IS_MIRROR_FIXED(element)) && + if ((IS_MIRROR(element) || + IS_MIRROR_FIXED(element) || + element == EL_PRISM) && current_angle != laser.current_angle) { - MoveSprite(vp, &Pfeil[2], 4 + 16 * ELX, 5 + 16 * ELY + 1); + MovDelay[ELX][ELY] = 11; // start animation } -#endif if ((!IS_POLAR(element) && !IS_POLAR_CROSS(element)) && current_angle != laser.current_angle) @@ -2398,6 +2428,36 @@ static void GrowAmoeba(int x, int y) } } +static void DrawFieldAnimated_MM(int x, int y) +{ + int element = Tile[x][y]; + + if (IS_BLOCKED(x, y)) + return; + + DrawField_MM(x, y); + + if (IS_MIRROR(element) || + IS_MIRROR_FIXED(element) || + element == EL_PRISM) + { + if (MovDelay[x][y] != 0) // wait some time before next frame + { + MovDelay[x][y]--; + + if (MovDelay[x][y] != 0) + { + int graphic = IMG_TWINKLE_WHITE; + int frame = getGraphicAnimationFrame(graphic, 10 - MovDelay[x][y]); + + DrawGraphicThruMask_MM(SCREENX(x), SCREENY(y), graphic, frame); + } + } + } + + laser.redraw = TRUE; +} + static void Explode_MM(int x, int y, int phase, int mode) { int num_phase = 9, delay = 2; @@ -2916,7 +2976,9 @@ void RotateMirror(int x, int y, int button) LX, LY, laser.beamer_edge, laser.beamer[1].num); #endif +#if 0 laser.num_edges--; +#endif } ScanLaser(); @@ -3084,6 +3146,8 @@ static void GameActions_MM_Ext(void) MeltIce(x, y); else if (IS_WALL_CHANGING(element) && Store[x][y] == EL_WALL_AMOEBA) GrowAmoeba(x, y); + else + DrawFieldAnimated_MM(x, y); } AutoRotateMirrors(); @@ -3110,6 +3174,10 @@ static void GameActions_MM_Ext(void) } } + // skip all following game actions if game is over + if (game_mm.game_over) + return; + if (FrameReached(&energy_delay)) { if (game_mm.energy_left > 0) @@ -3120,29 +3188,8 @@ static void GameActions_MM_Ext(void) } else if (game.time_limit && !game_mm.game_over) { - int i; + FadeOutLaser(FALSE); - for (i = 15; i >= 0; i--) - { -#if 0 - SetRGB(pen_ray, 0x0000, 0x0000, i * color_scale); -#endif - pen_ray = GetPixelFromRGB(window, - native_mm_level.laser_red * 0x11 * i, - native_mm_level.laser_green * 0x11 * i, - native_mm_level.laser_blue * 0x11 * i); - - DrawLaser(0, DL_LASER_ENABLED); - BackToFront(); - Delay_WithScreenUpdates(50); - } - - StopSound_MM(SND_MM_GAME_HEALTH_CHARGING); -#if 0 - FadeMusic(); -#endif - - DrawLaser(0, DL_LASER_DISABLED); game_mm.game_over = TRUE; game_mm.game_over_cause = GAME_OVER_NO_ENERGY; @@ -3246,24 +3293,9 @@ static void GameActions_MM_Ext(void) if (laser.overload_value == MAX_LASER_OVERLOAD) { - int i; - UpdateAndDisplayGameControlValues(); - for (i = 15; i >= 0; i--) - { -#if 0 - SetRGB(pen_ray, i * color_scale, 0x0000, 0x0000); -#endif - - pen_ray = GetPixelFromRGB(window, 0x11 * i, 0x00, 0x00); - - DrawLaser(0, DL_LASER_ENABLED); - BackToFront(); - Delay_WithScreenUpdates(50); - } - - DrawLaser(0, DL_LASER_DISABLED); + FadeOutLaser(TRUE); game_mm.game_over = TRUE; game_mm.game_over_cause = GAME_OVER_OVERLOADED;