X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Fgame_mm%2Fmm_game.c;h=19439a8427458bed53b19d0bb1660c514f0b9f38;hb=2da0cf37374833d0f09e69da0c74135a5f2f0132;hp=8d9743c6df6fc5cdfec7c9ad9cd54f511d38781f;hpb=fa86d670aca8d9505d7e8403b1ec0c9f4b683ec0;p=rocksndiamonds.git diff --git a/src/game_mm/mm_game.c b/src/game_mm/mm_game.c index 8d9743c6..19439a84 100644 --- a/src/game_mm/mm_game.c +++ b/src/game_mm/mm_game.c @@ -92,6 +92,7 @@ static int MovingOrBlocked2Element_MM(int, int); static void Bang_MM(int, int); static void RaiseScore_MM(int); +static void RaiseScoreElement_MM(int); static void RemoveMovingField_MM(int, int); static void InitMovingField_MM(int, int, int); static void ContinueMoving_MM(int, int); @@ -605,6 +606,7 @@ void InitGameEngine_MM() game_mm.game_over_cause = 0; game_mm.laser_overload_value = 0; + game_mm.laser_enabled = FALSE; /* set global laser control values (must be set before "InitLaser()") */ laser.start_edge.x = 0; @@ -1328,6 +1330,13 @@ void DrawLaser(int start_edge, int mode) { DrawLaserExt(start_edge, laser.num_edges - start_edge, mode); } + + game_mm.laser_enabled = mode; +} + +void DrawLaser_MM() +{ + DrawLaser(0, game_mm.laser_enabled); } boolean HitElement(int element, int hit_mask) @@ -1527,8 +1536,6 @@ boolean HitElement(int element, int hit_mask) if (game_mm.kettles_still_needed > 0) game_mm.kettles_still_needed--; - RaiseScore_MM(10); - if (game_mm.kettles_still_needed == 0) { CheckExitMM(); @@ -1540,16 +1547,13 @@ boolean HitElement(int element, int hit_mask) { game_mm.num_keys++; } - else if (element == EL_LIGHTBALL) - { - RaiseScore_MM(10); - } else if (IS_PACMAN(element)) { DeletePacMan(ELX, ELY); - RaiseScore_MM(50); } + RaiseScoreElement_MM(element); + return FALSE; } @@ -2821,7 +2825,7 @@ void ClickElement(int x, int y, int button) else if (element == EL_LIGHTBALL) { Bang_MM(x, y); - RaiseScore_MM(10); + RaiseScoreElement_MM(element); DrawLaser(0, DL_LASER_ENABLED); } @@ -3141,7 +3145,9 @@ static void GameActions_MM_Ext(struct MouseActionInfo action, boolean warp_mode) } StopSound_MM(SND_MM_GAME_HEALTH_CHARGING); +#if 0 FadeMusic(); +#endif DrawLaser(0, DL_LASER_DISABLED); game_mm.game_over = TRUE; @@ -3299,7 +3305,7 @@ static void GameActions_MM_Ext(struct MouseActionInfo action, boolean warp_mode) CT -= Ct; - if (element == EL_BOMB && CT > 75) + if (element == EL_BOMB && CT > native_mm_level.time_bomb) { if (game_mm.cheat_no_explosion) return; @@ -3337,7 +3343,7 @@ static void GameActions_MM_Ext(struct MouseActionInfo action, boolean warp_mode) return; } - if (element == EL_FUSE_ON && CT > 25) + if (element == EL_FUSE_ON && CT > native_mm_level.time_fuse) { laser.fuse_off = TRUE; laser.fuse_x = ELX; @@ -3347,7 +3353,7 @@ static void GameActions_MM_Ext(struct MouseActionInfo action, boolean warp_mode) DrawGraphic_MM(ELX, ELY, IMG_MM_FUSE); } - if (element == EL_BALL_GRAY && CT > 75) + if (element == EL_BALL_GRAY && CT > native_mm_level.time_ball) { static int new_elements[] = { @@ -3634,7 +3640,7 @@ static void GameActions_MM_Ext(struct MouseActionInfo action, boolean warp_mode) } if ((element == EL_BLOCK_WOOD || element == EL_BLOCK_STONE) && - laser.stops_inside_element && CT > 75) + laser.stops_inside_element && CT > native_mm_level.time_block) { int x, y; int k; @@ -3893,7 +3899,7 @@ void GameWon_MM() if (!setup.sound_loops) PlaySoundStereo(SND_SIRR, SOUND_MAX_RIGHT); if (TimePlayed < 999 && !(TimePlayed % 10)) - RaiseScore_MM(native_mm_level.score[SC_ZEITBONUS]); + RaiseScore_MM(native_mm_level.score[SC_TIME_BONUS]); if (TimePlayed < 900 && !(TimePlayed % 10)) TimePlayed += 10; else @@ -4162,6 +4168,10 @@ void RaiseScoreElement_MM(int element) switch(element) { case EL_PACMAN: + case EL_PACMAN_RIGHT: + case EL_PACMAN_UP: + case EL_PACMAN_LEFT: + case EL_PACMAN_DOWN: RaiseScore_MM(native_mm_level.score[SC_PACMAN]); break; @@ -4169,7 +4179,107 @@ void RaiseScoreElement_MM(int element) RaiseScore_MM(native_mm_level.score[SC_KEY]); break; + case EL_KETTLE: + case EL_CELL: + RaiseScore_MM(native_mm_level.score[SC_COLLECTIBLE]); + break; + + case EL_LIGHTBALL: + RaiseScore_MM(native_mm_level.score[SC_LIGHTBALL]); + break; + default: break; } } + + +/* ------------------------------------------------------------------------- */ +/* Mirror Magic game engine snapshot handling functions */ +/* ------------------------------------------------------------------------- */ + +void SaveEngineSnapshotValues_MM(ListNode **buffers) +{ + int x, y; + + engine_snapshot_mm.game_mm = game_mm; + engine_snapshot_mm.laser = laser; + + for (x = 0; x < MAX_PLAYFIELD_WIDTH; x++) + { + for (y = 0; y < MAX_PLAYFIELD_HEIGHT; y++) + { + engine_snapshot_mm.Ur[x][y] = Ur[x][y]; + engine_snapshot_mm.Hit[x][y] = Hit[x][y]; + engine_snapshot_mm.Box[x][y] = Box[x][y]; + engine_snapshot_mm.Angle[x][y] = Angle[x][y]; + engine_snapshot_mm.Frame[x][y] = Frame[x][y]; + } + } + + engine_snapshot_mm.LX = LX; + engine_snapshot_mm.LY = LY; + engine_snapshot_mm.XS = XS; + engine_snapshot_mm.YS = YS; + engine_snapshot_mm.ELX = ELX; + engine_snapshot_mm.ELY = ELY; + engine_snapshot_mm.CT = CT; + engine_snapshot_mm.Ct = Ct; + + engine_snapshot_mm.last_LX = last_LX; + engine_snapshot_mm.last_LY = last_LY; + engine_snapshot_mm.last_hit_mask = last_hit_mask; + engine_snapshot_mm.hold_x = hold_x; + engine_snapshot_mm.hold_y = hold_y; + engine_snapshot_mm.pacman_nr = pacman_nr; + + engine_snapshot_mm.rotate_delay = rotate_delay; + engine_snapshot_mm.pacman_delay = pacman_delay; + engine_snapshot_mm.energy_delay = energy_delay; + engine_snapshot_mm.overload_delay = overload_delay; +} + +void LoadEngineSnapshotValues_MM() +{ + int x, y; + + /* stored engine snapshot buffers already restored at this point */ + + game_mm = engine_snapshot_mm.game_mm; + laser = engine_snapshot_mm.laser; + + for (x = 0; x < MAX_PLAYFIELD_WIDTH; x++) + { + for (y = 0; y < MAX_PLAYFIELD_HEIGHT; y++) + { + Ur[x][y] = engine_snapshot_mm.Ur[x][y]; + Hit[x][y] = engine_snapshot_mm.Hit[x][y]; + Box[x][y] = engine_snapshot_mm.Box[x][y]; + Angle[x][y] = engine_snapshot_mm.Angle[x][y]; + Frame[x][y] = engine_snapshot_mm.Frame[x][y]; + } + } + + LX = engine_snapshot_mm.LX; + LY = engine_snapshot_mm.LY; + XS = engine_snapshot_mm.XS; + YS = engine_snapshot_mm.YS; + ELX = engine_snapshot_mm.ELX; + ELY = engine_snapshot_mm.ELY; + CT = engine_snapshot_mm.CT; + Ct = engine_snapshot_mm.Ct; + + last_LX = engine_snapshot_mm.last_LX; + last_LY = engine_snapshot_mm.last_LY; + last_hit_mask = engine_snapshot_mm.last_hit_mask; + hold_x = engine_snapshot_mm.hold_x; + hold_y = engine_snapshot_mm.hold_y; + pacman_nr = engine_snapshot_mm.pacman_nr; + + rotate_delay = engine_snapshot_mm.rotate_delay; + pacman_delay = engine_snapshot_mm.pacman_delay; + energy_delay = engine_snapshot_mm.energy_delay; + overload_delay = engine_snapshot_mm.overload_delay; + + RedrawPlayfield_MM(TRUE); +}