X-Git-Url: https://git.artsoft.org/?p=rocksndiamonds.git;a=blobdiff_plain;f=src%2Fgame_mm%2Fmm_game.c;h=6da722c13dd62de101a7a4c391442286dc2df383;hp=d34eec08eed4c2c22c2813f252c48de01edafd10;hb=a29d462b1da802456be5d55e67337541aa0cbcc5;hpb=0ac301d6e3c5551a5ff66baaaa8ce867bb1aceb1 diff --git a/src/game_mm/mm_game.c b/src/game_mm/mm_game.c index d34eec08..6da722c1 100644 --- a/src/game_mm/mm_game.c +++ b/src/game_mm/mm_game.c @@ -17,19 +17,19 @@ #include "mm_game.h" #include "mm_tools.h" -/* graphic position values for game controls */ +// graphic position values for game controls #define ENERGY_XSIZE 32 #define ENERGY_YSIZE MAX_LASER_ENERGY #define OVERLOAD_XSIZE ENERGY_XSIZE #define OVERLOAD_YSIZE MAX_LASER_OVERLOAD -/* values for Explode_MM() */ +// values for Explode_MM() #define EX_PHASE_START 0 #define EX_NORMAL 0 #define EX_KETTLE 1 #define EX_SHORT 2 -/* special positions in the game control window (relative to control window) */ +// special positions in the game control window (relative to control window) #define XX_LEVEL 36 #define YY_LEVEL 23 #define XX_KETTLES 29 @@ -41,7 +41,7 @@ #define XX_OVERLOAD 60 #define YY_OVERLOAD YY_ENERGY -/* special positions in the game control window (relative to main window) */ +// special positions in the game control window (relative to main window) #define DX_LEVEL (DX + XX_LEVEL) #define DY_LEVEL (DY + YY_LEVEL) #define DX_KETTLES (DX + XX_KETTLES) @@ -56,20 +56,20 @@ #define IS_LOOP_SOUND(s) ((s) == SND_FUEL) #define IS_MUSIC_SOUND(s) ((s) == SND_TYGER || (s) == SND_VOYAGER) -/* game button identifiers */ +// game button identifiers #define GAME_CTRL_ID_LEFT 0 #define GAME_CTRL_ID_MIDDLE 1 #define GAME_CTRL_ID_RIGHT 2 #define NUM_GAME_BUTTONS 3 -/* values for DrawLaser() */ +// values for DrawLaser() #define DL_LASER_DISABLED 0 #define DL_LASER_ENABLED 1 -/* values for 'click_delay_value' in ClickElement() */ -#define CLICK_DELAY_FIRST 12 /* delay (frames) after first click */ -#define CLICK_DELAY 6 /* delay (frames) for pressed butten */ +// values for 'click_delay_value' in ClickElement() +#define CLICK_DELAY_FIRST 12 // delay (frames) after first click +#define CLICK_DELAY 6 // delay (frames) for pressed butten #define AUTO_ROTATE_DELAY CLICK_DELAY #define INIT_GAME_ACTIONS_DELAY (ONE_SECOND_DELAY / GAME_FRAME_DELAY) @@ -90,7 +90,7 @@ program.headless = last_headless; \ } \ -/* forward declaration for internal use */ +// forward declaration for internal use static int MovingOrBlocked2Element_MM(int, int); static void Bang_MM(int, int); static void RaiseScore_MM(int); @@ -100,23 +100,23 @@ static void InitMovingField_MM(int, int, int); static void ContinueMoving_MM(int, int); static void Moving2Blocked_MM(int, int, int *, int *); -/* bitmap for laser beam detection */ +// bitmap for laser beam detection static Bitmap *laser_bitmap = NULL; -/* variables for laser control */ +// variables for laser control static int last_LX = 0, last_LY = 0, last_hit_mask = 0; static int hold_x = -1, hold_y = -1; -/* variables for pacman control */ +// variables for pacman control static int pacman_nr = -1; -/* various game engine delay counters */ +// various game engine delay counters static unsigned int rotate_delay = 0; static unsigned int pacman_delay = 0; static unsigned int energy_delay = 0; static unsigned int overload_delay = 0; -/* element masks for scanning pixels of MM elements */ +// element masks for scanning pixels of MM elements static const char mm_masks[10][16][16 + 1] = { { @@ -318,7 +318,7 @@ static int get_opposite_angle(int angle) { int opposite_angle = angle + ANG_RAY_180; - /* make sure "opposite_angle" is in valid interval [0, 15] */ + // make sure "opposite_angle" is in valid interval [0, 15] return (opposite_angle + 16) % 16; } @@ -326,7 +326,7 @@ static int get_mirrored_angle(int laser_angle, int mirror_angle) { int reflected_angle = 16 - laser_angle + mirror_angle; - /* make sure "reflected_angle" is in valid interval [0, 15] */ + // make sure "reflected_angle" is in valid interval [0, 15] return (reflected_angle + 16) % 16; } @@ -357,7 +357,7 @@ static boolean CheckLaserPixel(int x, int y) return (pixel == WHITE_PIXEL); } -static void CheckExitMM() +static void CheckExitMM(void) { int exit_element = EL_EMPTY; int exit_x = 0; @@ -377,7 +377,7 @@ static void CheckExitMM() { if (Feld[x][y] == EL_EXIT_CLOSED) { - /* initiate opening animation of exit door */ + // initiate opening animation of exit door Feld[x][y] = EL_EXIT_OPENING; exit_element = EL_EXIT_OPEN; @@ -386,7 +386,7 @@ static void CheckExitMM() } else if (IS_RECEIVER(Feld[x][y])) { - /* remove field that blocks receiver */ + // remove field that blocks receiver int phase = Feld[x][y] - EL_RECEIVER_START; int blocking_x, blocking_y; @@ -478,7 +478,7 @@ static void InitField(int x, int y, boolean init_game) { static int steps_grid_auto = 0; - if (game_mm.num_cycle == 0) /* initialize cycle steps for grids */ + if (game_mm.num_cycle == 0) // initialize cycle steps for grids steps_grid_auto = RND(16) * (RND(2) ? -1 : +1); if (IS_GRID_STEEL_AUTO(element) || @@ -517,11 +517,11 @@ static void InitField(int x, int y, boolean init_game) } } -static void InitCycleElements_RotateSingleStep() +static void InitCycleElements_RotateSingleStep(void) { int i; - if (game_mm.num_cycle == 0) /* no elements to cycle */ + if (game_mm.num_cycle == 0) // no elements to cycle return; for (i = 0; i < game_mm.num_cycle; i++) @@ -542,7 +542,7 @@ static void InitCycleElements_RotateSingleStep() } } -static void InitLaser() +static void InitLaser(void) { int start_element = Feld[laser.start_edge.x][laser.start_edge.y]; int step = (IS_LASER(start_element) ? 4 : 0); @@ -572,7 +572,7 @@ static void InitLaser() laser.dest_element = EL_EMPTY; laser.wall_mask = 0; - AddLaserEdge(LX, LY); /* set laser starting edge */ + AddLaserEdge(LX, LY); // set laser starting edge pen_ray = GetPixelFromRGB(window, native_mm_level.laser_red * 0xFF, @@ -580,19 +580,19 @@ static void InitLaser() native_mm_level.laser_blue * 0xFF); } -void InitGameEngine_MM() +void InitGameEngine_MM(void) { int i, x, y; BEGIN_NO_HEADLESS { - /* initialize laser bitmap to current playfield (screen) size */ + // initialize laser bitmap to current playfield (screen) size ReCreateBitmap(&laser_bitmap, drawto->width, drawto->height); ClearRectangle(laser_bitmap, 0, 0, drawto->width, drawto->height); } END_NO_HEADLESS - /* set global game control values */ + // set global game control values game_mm.num_cycle = 0; game_mm.num_pacman = 0; @@ -610,7 +610,7 @@ void InitGameEngine_MM() game_mm.laser_overload_value = 0; game_mm.laser_enabled = FALSE; - /* set global laser control values (must be set before "InitLaser()") */ + // set global laser control values (must be set before "InitLaser()") laser.start_edge.x = 0; laser.start_edge.y = 0; laser.start_angle = 0; @@ -660,14 +660,10 @@ void InitGameEngine_MM() } } -#if 0 - CloseDoor(DOOR_CLOSE_1); -#endif - DrawLevel_MM(); } -void InitGameActions_MM() +void InitGameActions_MM(void) { int num_init_game_frames = INIT_GAME_ACTIONS_DELAY; int cycle_steps_done = 0; @@ -675,36 +671,6 @@ void InitGameActions_MM() InitLaser(); -#if 0 - /* copy default game door content to main double buffer */ - BlitBitmap(pix[PIX_DOOR], drawto, - DOOR_GFX_PAGEX5, DOOR_GFX_PAGEY1, DXSIZE, DYSIZE, DX, DY); -#endif - -#if 0 - DrawText(DX_LEVEL, DY_LEVEL, - int2str(level_nr, 2), FONT_TEXT_2); - DrawText(DX_KETTLES, DY_KETTLES, - int2str(game_mm.kettles_still_needed, 3), FONT_TEXT_2); - DrawText(DX_SCORE, DY_SCORE, - int2str(game_mm.score, 4), FONT_TEXT_2); -#endif - -#if 0 - UnmapGameButtons(); - MapGameButtons(); -#endif - -#if 0 - /* copy actual game door content to door double buffer for OpenDoor() */ - BlitBitmap(drawto, pix[PIX_DB_DOOR], - DX, DY, DXSIZE, DYSIZE, DOOR_GFX_PAGEX1, DOOR_GFX_PAGEY1); -#endif - -#if 0 - OpenDoor(DOOR_OPEN_ALL); -#endif - for (i = 0; i <= num_init_game_frames; i++) { if (i == num_init_game_frames) @@ -735,11 +701,6 @@ void InitGameActions_MM() #endif } -#if 0 - if (setup.sound_music && num_bg_loops) - PlayMusic(level_nr % num_bg_loops); -#endif - ScanLaser(); if (game_mm.kettles_still_needed == 0) @@ -751,15 +712,18 @@ void InitGameActions_MM() void AddLaserEdge(int lx, int ly) { - if (lx < -2 || ly < -2 || lx >= SXSIZE + 2 || ly >= SYSIZE + 2) + int clx = dSX + lx; + int cly = dSY + ly; + + if (clx < -2 || cly < -2 || clx >= SXSIZE + 2 || cly >= SYSIZE + 2) { Error(ERR_WARN, "AddLaserEdge: out of bounds: %d, %d", lx, ly); return; } - laser.edge[laser.num_edges].x = SX + 2 + lx; - laser.edge[laser.num_edges].y = SY + 2 + ly; + laser.edge[laser.num_edges].x = cSX2 + lx; + laser.edge[laser.num_edges].y = cSY2 + ly; laser.num_edges++; laser.redraw = TRUE; @@ -775,14 +739,14 @@ void AddDamagedField(int ex, int ey) laser.num_damages++; } -boolean StepBehind() +static boolean StepBehind(void) { if (laser.num_edges) { int x = LX - XS; int y = LY - YS; - int last_x = laser.edge[laser.num_edges - 1].x - SX - 2; - int last_y = laser.edge[laser.num_edges - 1].y - SY - 2; + int last_x = laser.edge[laser.num_edges - 1].x - cSX2; + int last_y = laser.edge[laser.num_edges - 1].y - cSY2; return ((x - last_x) * XS < 0 || (y - last_y) * YS < 0); } @@ -802,7 +766,7 @@ static int getMaskFromElement(int element) return IMG_MM_MASK_CIRCLE; } -int ScanPixel() +static int ScanPixel(void) { int hit_mask = 0; @@ -811,13 +775,13 @@ int ScanPixel() LX, LY, LX / TILEX, LY / TILEY, LX % TILEX, LY % TILEY); #endif - /* follow laser beam until it hits something (at least the screen border) */ + // follow laser beam until it hits something (at least the screen border) while (hit_mask == HIT_MASK_NO_HIT) { int i; #if 0 - /* for safety */ + // for safety if (SX + LX < REAL_SX || SX + LX >= REAL_SX + FULL_SXSIZE || SY + LY < REAL_SY || SY + LY >= REAL_SY + FULL_SYSIZE) { @@ -833,8 +797,8 @@ int ScanPixel() int py = LY + (i / 2) * 2; int dx = px % TILEX; int dy = py % TILEY; - int lx = (px + TILEX) / TILEX - 1; /* ...+TILEX...-1 to get correct */ - int ly = (py + TILEY) / TILEY - 1; /* negative values! */ + int lx = (px + TILEX) / TILEX - 1; // ...+TILEX...-1 to get correct + int ly = (py + TILEY) / TILEY - 1; // negative values! Pixel pixel; if (IN_LEV_FIELD(lx, ly)) @@ -860,8 +824,8 @@ int ScanPixel() } else { - pixel = (SX + px < REAL_SX || SX + px >= REAL_SX + FULL_SXSIZE || - SY + py < REAL_SY || SY + py >= REAL_SY + FULL_SYSIZE); + pixel = (cSX + px < REAL_SX || cSX + px >= REAL_SX + FULL_SXSIZE || + cSY + py < REAL_SY || cSY + py >= REAL_SY + FULL_SYSIZE); } if ((Sign[laser.current_angle] & (1 << i)) && pixel) @@ -870,7 +834,7 @@ int ScanPixel() if (hit_mask == HIT_MASK_NO_HIT) { - /* hit nothing -- go on with another step */ + // hit nothing -- go on with another step LX += XS; LY += YS; } @@ -879,12 +843,12 @@ int ScanPixel() return hit_mask; } -void ScanLaser() +void ScanLaser(void) { int element; int end = 0, rf = laser.num_edges; - /* do not scan laser again after the game was lost for whatever reason */ + // do not scan laser again after the game was lost for whatever reason if (game_mm.game_over) return; @@ -917,7 +881,7 @@ void ScanLaser() LX, LY, XS, YS); #endif - /* hit something -- check out what it was */ + // hit something -- check out what it was ELX = (LX + XS) / TILEX; ELY = (LY + YS) / TILEY; @@ -949,7 +913,7 @@ void ScanLaser() { /* we have hit the top-left and bottom-right element -- choose the top-left one */ - /* !!! SEE ABOVE !!! */ + // !!! SEE ABOVE !!! ELX = (LX - 2) / TILEX; ELY = (LY - 2) / TILEY; } @@ -1066,7 +1030,7 @@ void ScanLaser() #endif } -void DrawLaserExt(int start_edge, int num_edges, int mode) +static void DrawLaserExt(int start_edge, int num_edges, int mode) { int element; int elx, ely; @@ -1097,7 +1061,7 @@ void DrawLaserExt(int start_edge, int num_edges, int mode) } #endif - /* now draw the laser to the backbuffer and (if enabled) to the screen */ + // now draw the laser to the backbuffer and (if enabled) to the screen DrawLaserLines(&laser.edge[start_edge], num_edges, mode); redraw_mask |= REDRAW_FIELD; @@ -1105,13 +1069,13 @@ void DrawLaserExt(int start_edge, int num_edges, int mode) if (mode == DL_LASER_ENABLED) return; - /* after the laser was deleted, the "damaged" graphics must be restored */ + // after the laser was deleted, the "damaged" graphics must be restored if (laser.num_damages) { int damage_start = 0; int i; - /* determine the starting edge, from which graphics need to be restored */ + // determine the starting edge, from which graphics need to be restored if (start_edge > 0) { for (i = 0; i < laser.num_damages; i++) @@ -1125,7 +1089,7 @@ void DrawLaserExt(int start_edge, int num_edges, int mode) } } - /* restore graphics from this starting edge to the end of damage list */ + // restore graphics from this starting edge to the end of damage list for (i = damage_start; i < laser.num_damages; i++) { int lx = laser.damage[i].x; @@ -1165,7 +1129,7 @@ void DrawLaserExt(int start_edge, int num_edges, int mode) laser.num_beamers > 0 && start_edge == laser.beamer_edge[laser.num_beamers - 1]) { - /* element is outgoing beamer */ + // element is outgoing beamer laser.num_damages = damage_start + 1; if (IS_BEAMER(element)) @@ -1173,14 +1137,14 @@ void DrawLaserExt(int start_edge, int num_edges, int mode) } else { - /* element is incoming beamer or other element */ + // element is incoming beamer or other element laser.num_damages = damage_start; laser.current_angle = laser.damage[laser.num_damages].angle; } } else { - /* no damages but McDuffin himself (who needs to be redrawn anyway) */ + // no damages but McDuffin himself (who needs to be redrawn anyway) elx = laser.start_edge.x; ely = laser.start_edge.y; @@ -1191,8 +1155,8 @@ void DrawLaserExt(int start_edge, int num_edges, int mode) if (start_edge == 0) laser.current_angle = laser.start_angle; - LX = laser.edge[start_edge].x - (SX + 2); - LY = laser.edge[start_edge].y - (SY + 2); + LX = laser.edge[start_edge].x - cSX2; + LY = laser.edge[start_edge].y - cSY2; XS = 2 * Step[laser.current_angle].x; YS = 2 * Step[laser.current_angle].y; @@ -1216,7 +1180,7 @@ void DrawLaserExt(int start_edge, int num_edges, int mode) printf("element == %d\n", element); #endif - if (IS_22_5_ANGLE(laser.current_angle)) /* neither 90° nor 45° angle */ + if (IS_22_5_ANGLE(laser.current_angle)) // neither 90° nor 45° angle step_size = ((IS_BEAMER(element) || IS_FIBRE_OPTIC(element)) ? 4 : 3); else step_size = 8; @@ -1226,7 +1190,7 @@ void DrawLaserExt(int start_edge, int num_edges, int mode) (laser.num_beamers == 0 || start_edge != laser.beamer_edge[laser.num_beamers - 1]))) { - /* element is incoming beamer or other element */ + // element is incoming beamer or other element step_size = -step_size; laser.num_edges--; } @@ -1265,7 +1229,7 @@ void DrawLaser(int start_edge, int mode) return; } - /* check if laser is interrupted by beamer element */ + // check if laser is interrupted by beamer element if (laser.num_beamers > 0 && start_edge < laser.beamer_edge[laser.num_beamers - 1]) { @@ -1274,7 +1238,7 @@ void DrawLaser(int start_edge, int mode) int i; int tmp_start_edge = start_edge; - /* draw laser segments forward from the start to the last beamer */ + // draw laser segments forward from the start to the last beamer for (i = 0; i < laser.num_beamers; i++) { int tmp_num_edges = laser.beamer_edge[i] - tmp_start_edge; @@ -1292,7 +1256,7 @@ void DrawLaser(int start_edge, int mode) tmp_start_edge = laser.beamer_edge[i]; } - /* draw last segment from last beamer to the end */ + // draw last segment from last beamer to the end DrawLaserExt(tmp_start_edge, laser.num_edges - tmp_start_edge, DL_LASER_ENABLED); } @@ -1302,7 +1266,7 @@ void DrawLaser(int start_edge, int mode) int last_num_edges = laser.num_edges; int num_beamers = laser.num_beamers; - /* delete laser segments backward from the end to the first beamer */ + // delete laser segments backward from the end to the first beamer for (i = num_beamers - 1; i >= 0; i--) { int tmp_num_edges = last_num_edges - laser.beamer_edge[i]; @@ -1327,7 +1291,7 @@ void DrawLaser(int start_edge, int mode) if (last_num_edges - start_edge == 1 && start_edge > 0) DrawLaserLines(&laser.edge[start_edge - 1], 2, DL_LASER_DISABLED); - /* delete first segment from start to the first beamer */ + // delete first segment from start to the first beamer DrawLaserExt(start_edge, last_num_edges - start_edge, DL_LASER_DISABLED); } } @@ -1339,7 +1303,7 @@ void DrawLaser(int start_edge, int mode) game_mm.laser_enabled = mode; } -void DrawLaser_MM() +void DrawLaser_MM(void) { DrawLaser(0, game_mm.laser_enabled); } @@ -1365,10 +1329,10 @@ boolean HitElement(int element, int hit_mask) AddDamagedField(ELX, ELY); - /* this is more precise: check if laser would go through the center */ + // this is more precise: check if laser would go through the center if ((ELX * TILEX + 14 - LX) * YS != (ELY * TILEY + 14 - LY) * XS) { - /* skip the whole element before continuing the scan */ + // skip the whole element before continuing the scan do { LX += XS; @@ -1480,7 +1444,7 @@ boolean HitElement(int element, int hit_mask) XS = 2 * Step[laser.current_angle].x; YS = 2 * Step[laser.current_angle].y; - if (!IS_22_5_ANGLE(laser.current_angle)) /* 90° or 45° angle */ + if (!IS_22_5_ANGLE(laser.current_angle)) // 90° or 45° angle step_size = 8; else step_size = 4; @@ -1489,7 +1453,7 @@ boolean HitElement(int element, int hit_mask) LY += step_size * YS; #if 0 - /* draw sparkles on mirror */ + // draw sparkles on mirror if ((IS_MIRROR(element) || IS_MIRROR_FIXED(element)) && current_angle != laser.current_angle) { @@ -1541,6 +1505,8 @@ boolean HitElement(int element, int hit_mask) if (game_mm.kettles_still_needed > 0) game_mm.kettles_still_needed--; + game.snapshot.collected_item = TRUE; + if (game_mm.kettles_still_needed == 0) { CheckExitMM(); @@ -1667,7 +1633,7 @@ boolean HitElement(int element, int hit_mask) boolean HitOnlyAnEdge(int element, int hit_mask) { - /* check if the laser hit only the edge of an element and, if so, go on */ + // check if the laser hit only the edge of an element and, if so, go on #if 0 printf("LX, LY, hit_mask == %d, %d, %d\n", LX, LY, hit_mask); @@ -1677,7 +1643,7 @@ boolean HitOnlyAnEdge(int element, int hit_mask) hit_mask == HIT_MASK_TOPRIGHT || hit_mask == HIT_MASK_BOTTOMLEFT || hit_mask == HIT_MASK_BOTTOMRIGHT) && - laser.current_angle % 4) /* angle is not 90° */ + laser.current_angle % 4) // angle is not 90° { int dx, dy; @@ -1696,7 +1662,7 @@ boolean HitOnlyAnEdge(int element, int hit_mask) dx = -1; dy = +1; } - else /* (hit_mask == HIT_MASK_BOTTOMRIGHT) */ + else // (hit_mask == HIT_MASK_BOTTOMRIGHT) { dx = +1; dy = +1; @@ -1744,7 +1710,7 @@ boolean HitPolarizer(int element, int hit_mask) if (laser.current_angle == grid_angle || laser.current_angle == get_opposite_angle(grid_angle)) { - /* skip the whole element before continuing the scan */ + // skip the whole element before continuing the scan do { LX += XS; @@ -1790,7 +1756,7 @@ boolean HitPolarizer(int element, int hit_mask) { return HitReflectingWalls(element, hit_mask); } - else /* IS_GRID_WOOD */ + else // IS_GRID_WOOD { return HitAbsorbingWalls(element, hit_mask); } @@ -1979,7 +1945,7 @@ boolean HitLaserDestination(int element, int hit_mask) boolean HitReflectingWalls(int element, int hit_mask) { - /* check if laser hits side of a wall with an angle that is not 90° */ + // check if laser hits side of a wall with an angle that is not 90° if (!IS_90_ANGLE(laser.current_angle) && (hit_mask == HIT_MASK_TOP || hit_mask == HIT_MASK_LEFT || hit_mask == HIT_MASK_RIGHT || @@ -1993,7 +1959,7 @@ boolean HitReflectingWalls(int element, int hit_mask) if (!IS_DF_GRID(element)) AddLaserEdge(LX, LY); - /* check if laser hits wall with an angle of 45° */ + // check if laser hits wall with an angle of 45° if (!IS_22_5_ANGLE(laser.current_angle)) { if (hit_mask == HIT_MASK_TOP || hit_mask == HIT_MASK_BOTTOM) @@ -2002,7 +1968,7 @@ boolean HitReflectingWalls(int element, int hit_mask) laser.current_angle = get_mirrored_angle(laser.current_angle, ANG_MIRROR_0); } - else /* hit_mask == HIT_MASK_LEFT || hit_mask == HIT_MASK_RIGHT */ + else // hit_mask == HIT_MASK_LEFT || hit_mask == HIT_MASK_RIGHT { LY += 2 * YS; laser.current_angle = get_mirrored_angle(laser.current_angle, @@ -2041,7 +2007,7 @@ boolean HitReflectingWalls(int element, int hit_mask) return FALSE; } - else /* hit_mask == HIT_MASK_LEFT || hit_mask == HIT_MASK_RIGHT */ + else // hit_mask == HIT_MASK_LEFT || hit_mask == HIT_MASK_RIGHT { laser.current_angle = get_mirrored_angle(laser.current_angle, ANG_MIRROR_90); @@ -2068,7 +2034,7 @@ boolean HitReflectingWalls(int element, int hit_mask) } } - /* reflection at the edge of reflecting DF style wall */ + // reflection at the edge of reflecting DF style wall if (IS_DF_WALL_STEEL(element) && IS_22_5_ANGLE(laser.current_angle)) { if (((laser.current_angle == 1 || laser.current_angle == 3) && @@ -2103,7 +2069,7 @@ boolean HitReflectingWalls(int element, int hit_mask) } } - /* reflection inside an edge of reflecting DF style wall */ + // reflection inside an edge of reflecting DF style wall if (IS_DF_WALL_STEEL(element) && IS_22_5_ANGLE(laser.current_angle)) { if (((laser.current_angle == 1 || laser.current_angle == 3) && @@ -2144,7 +2110,7 @@ boolean HitReflectingWalls(int element, int hit_mask) } } - /* check if laser hits DF style wall with an angle of 90° */ + // check if laser hits DF style wall with an angle of 90° if (IS_DF_WALL(element) && IS_90_ANGLE(laser.current_angle)) { if ((IS_HORIZ_ANGLE(laser.current_angle) && @@ -2152,7 +2118,7 @@ boolean HitReflectingWalls(int element, int hit_mask) (IS_VERT_ANGLE(laser.current_angle) && (!(hit_mask & HIT_MASK_LEFT) || !(hit_mask & HIT_MASK_RIGHT)))) { - /* laser at last step touched nothing or the same side of the wall */ + // laser at last step touched nothing or the same side of the wall if (LX != last_LX || LY != last_LY || hit_mask == last_hit_mask) { AddDamagedField(ELX, ELY); @@ -2220,10 +2186,10 @@ boolean HitAbsorbingWalls(int element, int hit_mask) { int mask; - mask = (LX + XS) / MINI_TILEX - ELX * 2 + 1; /* Quadrant (horizontal) */ - mask <<= (((LY + YS) / MINI_TILEY - ELY * 2) > 0) * 2; /* || (vertical) */ + mask = (LX + XS) / MINI_TILEX - ELX * 2 + 1; // Quadrant (horizontal) + mask <<= (((LY + YS) / MINI_TILEY - ELY * 2) > 0) * 2; // || (vertical) - /* check if laser hits wall with an angle of 90° */ + // check if laser hits wall with an angle of 90° if (IS_90_ANGLE(laser.current_angle)) mask += mask * (2 + IS_HORIZ_ANGLE(laser.current_angle) * 2); @@ -2281,14 +2247,14 @@ boolean HitAbsorbingWalls(int element, int hit_mask) return TRUE; } -void OpenExit(int x, int y) +static void OpenExit(int x, int y) { int delay = 6; - if (!MovDelay[x][y]) /* next animation frame */ + if (!MovDelay[x][y]) // next animation frame MovDelay[x][y] = 4 * delay; - if (MovDelay[x][y]) /* wait some time before next frame */ + if (MovDelay[x][y]) // wait some time before next frame { int phase; @@ -2306,14 +2272,14 @@ void OpenExit(int x, int y) } } -void OpenSurpriseBall(int x, int y) +static void OpenSurpriseBall(int x, int y) { int delay = 2; - if (!MovDelay[x][y]) /* next animation frame */ + if (!MovDelay[x][y]) // next animation frame MovDelay[x][y] = 50 * delay; - if (MovDelay[x][y]) /* wait some time before next frame */ + if (MovDelay[x][y]) // wait some time before next frame { MovDelay[x][y]--; @@ -2327,7 +2293,7 @@ void OpenSurpriseBall(int x, int y) getGraphicSource(graphic, 0, &bitmap, &gx, &gy); BlitBitmap(bitmap, drawto, gx + dx, gy + dy, 6, 6, - SX + x * TILEX + dx, SY + y * TILEY + dy); + cSX + x * TILEX + dx, cSY + y * TILEY + dy); MarkTileDirty(x, y); } @@ -2343,15 +2309,15 @@ void OpenSurpriseBall(int x, int y) } } -void MeltIce(int x, int y) +static void MeltIce(int x, int y) { int frames = 5; int delay = 5; - if (!MovDelay[x][y]) /* next animation frame */ + if (!MovDelay[x][y]) // next animation frame MovDelay[x][y] = frames * delay; - if (MovDelay[x][y]) /* wait some time before next frame */ + if (MovDelay[x][y]) // wait some time before next frame { int phase; int wall_mask = Store2[x][y]; @@ -2392,15 +2358,15 @@ void MeltIce(int x, int y) } } -void GrowAmoeba(int x, int y) +static void GrowAmoeba(int x, int y) { int frames = 5; int delay = 1; - if (!MovDelay[x][y]) /* next animation frame */ + if (!MovDelay[x][y]) // next animation frame MovDelay[x][y] = frames * delay; - if (MovDelay[x][y]) /* wait some time before next frame */ + if (MovDelay[x][y]) // wait some time before next frame { int phase; int wall_mask = Store2[x][y]; @@ -2432,13 +2398,13 @@ static void Explode_MM(int x, int y, int phase, int mode) laser.redraw = TRUE; - if (phase == EX_PHASE_START) /* initialize 'Store[][]' field */ + if (phase == EX_PHASE_START) // initialize 'Store[][]' field { int center_element = Feld[x][y]; if (IS_MOVING(x, y) || IS_BLOCKED(x, y)) { - /* put moving element to center field (and let it explode there) */ + // put moving element to center field (and let it explode there) center_element = MovingOrBlocked2Element_MM(x, y); RemoveMovingField_MM(x, y); @@ -2488,6 +2454,8 @@ static void Explode_MM(int x, int y, int phase, int mode) else if (IS_MCDUFFIN(Store[x][y])) { Store[x][y] = EL_EMPTY; + + game.restart_game_message = "Bomb killed Mc Duffin! Play it again?"; } Feld[x][y] = Store[x][y]; @@ -2536,7 +2504,7 @@ static void Explode_MM(int x, int y, int phase, int mode) getGraphicSource(graphic, graphic_phase, &bitmap, &src_x, &src_y); BlitBitmap(bitmap, drawto_field, src_x, src_y, TILEX, TILEY, - FX + x * TILEX, FY + y * TILEY); + cFX + x * TILEX, cFY + y * TILEY); MarkTileDirty(x, y); } @@ -2643,7 +2611,7 @@ static void StartMoving_MM(int x, int y) { int newx, newy; - if (MovDelay[x][y]) /* wait some time before next movement */ + if (MovDelay[x][y]) // wait some time before next movement { MovDelay[x][y]--; @@ -2651,9 +2619,9 @@ static void StartMoving_MM(int x, int y) return; } - /* now make next step */ + // now make next step - Moving2Blocked_MM(x, y, &newx, &newy); /* get next screen position */ + Moving2Blocked_MM(x, y, &newx, &newy); // get next screen position if (element == EL_PACMAN && IN_LEV_FIELD(newx, newy) && IS_EATABLE4PACMAN(Feld[newx][newy]) && @@ -2667,7 +2635,7 @@ static void StartMoving_MM(int x, int y) else if (!IN_LEV_FIELD(newx, newy) || !IS_FREE(newx, newy) || ObjHit(newx, newy, HIT_POS_CENTER)) { - /* object was running against a wall */ + // object was running against a wall TurnRound(x, y); @@ -2693,7 +2661,7 @@ static void ContinueMoving_MM(int x, int y) MovPos[x][y] += step; - if (ABS(MovPos[x][y]) >= TILEX) /* object reached its destination */ + if (ABS(MovPos[x][y]) >= TILEX) // object reached its destination { Feld[x][y] = EL_EMPTY; Feld[newx][newy] = element; @@ -2723,7 +2691,7 @@ static void ContinueMoving_MM(int x, int y) } } } - else /* still moving on */ + else // still moving on { DrawField_MM(x, y); } @@ -2731,49 +2699,50 @@ static void ContinueMoving_MM(int x, int y) laser.redraw = TRUE; } -void ClickElement(int x, int y, int button) +boolean ClickElement(int x, int y, int button) { static unsigned int click_delay = 0; static int click_delay_value = CLICK_DELAY; static boolean new_button = TRUE; + boolean element_clicked = FALSE; int element; if (button == -1) { - /* initialize static variables */ + // initialize static variables click_delay = 0; click_delay_value = CLICK_DELAY; new_button = TRUE; - return; + return FALSE; } - /* do not rotate objects hit by the laser after the game was solved */ + // do not rotate objects hit by the laser after the game was solved if (game_mm.level_solved && Hit[x][y]) - return; + return FALSE; if (button == MB_RELEASED) { new_button = TRUE; click_delay_value = CLICK_DELAY; - /* release eventually hold auto-rotating mirror */ + // release eventually hold auto-rotating mirror RotateMirror(x, y, MB_RELEASED); - return; + return FALSE; } if (!FrameReached(&click_delay, click_delay_value) && !new_button) - return; + return FALSE; - if (button == MB_MIDDLEBUTTON) /* middle button has no function */ - return; + if (button == MB_MIDDLEBUTTON) // middle button has no function + return FALSE; if (!IN_LEV_FIELD(x, y)) - return; + return FALSE; if (Feld[x][y] == EL_EMPTY) - return; + return FALSE; element = Feld[x][y]; @@ -2785,6 +2754,8 @@ void ClickElement(int x, int y, int button) IS_DF_MIRROR_AUTO(element)) { RotateMirror(x, y, button); + + element_clicked = TRUE; } else if (IS_MCDUFFIN(element)) { @@ -2811,17 +2782,21 @@ void ClickElement(int x, int y, int button) if (!laser.fuse_off) ScanLaser(); + + element_clicked = TRUE; } else if (element == EL_FUSE_ON && laser.fuse_off) { if (x != laser.fuse_x || y != laser.fuse_y) - return; + return FALSE; laser.fuse_off = FALSE; laser.fuse_x = laser.fuse_y = -1; DrawGraphic_MM(x, y, IMG_MM_FUSE_ACTIVE); ScanLaser(); + + element_clicked = TRUE; } else if (element == EL_FUSE_ON && !laser.fuse_off && new_button) { @@ -2832,23 +2807,29 @@ void ClickElement(int x, int y, int button) DrawLaser(0, DL_LASER_DISABLED); DrawGraphic_MM(x, y, IMG_MM_FUSE); + + element_clicked = TRUE; } else if (element == EL_LIGHTBALL) { Bang_MM(x, y); RaiseScoreElement_MM(element); DrawLaser(0, DL_LASER_ENABLED); + + element_clicked = TRUE; } click_delay_value = (new_button ? CLICK_DELAY_FIRST : CLICK_DELAY); new_button = FALSE; + + return element_clicked; } void RotateMirror(int x, int y, int button) { if (button == MB_RELEASED) { - /* release eventually hold auto-rotating mirror */ + // release eventually hold auto-rotating mirror hold_x = -1; hold_y = -1; @@ -2869,8 +2850,8 @@ void RotateMirror(int x, int y, int button) { if (button == MB_LEFTBUTTON) { - /* left mouse button only for manual adjustment, no auto-rotating; - freeze mirror for until mouse button released */ + // left mouse button only for manual adjustment, no auto-rotating; + // freeze mirror for until mouse button released hold_x = x; hold_y = y; } @@ -2939,7 +2920,7 @@ void RotateMirror(int x, int y, int button) } } -void AutoRotateMirrors() +static void AutoRotateMirrors(void) { int x, y; @@ -2952,7 +2933,7 @@ void AutoRotateMirrors() { int element = Feld[x][y]; - /* do not rotate objects hit by the laser after the game was solved */ + // do not rotate objects hit by the laser after the game was solved if (game_mm.level_solved && Hit[x][y]) continue; @@ -2974,24 +2955,24 @@ boolean ObjHit(int obx, int oby, int bits) if (bits & HIT_POS_CENTER) { - if (CheckLaserPixel(SX + obx + 15, - SY + oby + 15)) + if (CheckLaserPixel(cSX + obx + 15, + cSY + oby + 15)) return TRUE; } if (bits & HIT_POS_EDGE) { for (i = 0; i < 4; i++) - if (CheckLaserPixel(SX + obx + 31 * (i % 2), - SY + oby + 31 * (i / 2))) + if (CheckLaserPixel(cSX + obx + 31 * (i % 2), + cSY + oby + 31 * (i / 2))) return TRUE; } if (bits & HIT_POS_BETWEEN) { for (i = 0; i < 4; i++) - if (CheckLaserPixel(SX + 4 + obx + 22 * (i % 2), - SY + 4 + oby + 22 * (i / 2))) + if (CheckLaserPixel(cSX + 4 + obx + 22 * (i % 2), + cSY + 4 + oby + 22 * (i / 2))) return TRUE; } @@ -3101,9 +3082,9 @@ static void GameActions_MM_Ext(struct MouseActionInfo action, boolean warp_mode) AutoRotateMirrors(); #if 1 - /* !!! CHANGE THIS: REDRAW ONLY WHEN NEEDED !!! */ + // !!! CHANGE THIS: REDRAW ONLY WHEN NEEDED !!! - /* redraw after Explode_MM() ... */ + // redraw after Explode_MM() ... if (laser.redraw) DrawLaser(0, DL_LASER_ENABLED); laser.redraw = FALSE; @@ -3128,12 +3109,6 @@ static void GameActions_MM_Ext(struct MouseActionInfo action, boolean warp_mode) { game_mm.energy_left--; -#if 0 - BlitBitmap(pix[PIX_DOOR], drawto, - DOOR_GFX_PAGEX5 + XX_ENERGY, DOOR_GFX_PAGEY1 + YY_ENERGY, - ENERGY_XSIZE, ENERGY_YSIZE - game_mm.energy_left, - DX_ENERGY, DY_ENERGY); -#endif redraw_mask |= REDRAW_DOOR_1; } else if (setup.time_limit && !game_mm.game_over) @@ -3152,7 +3127,7 @@ static void GameActions_MM_Ext(struct MouseActionInfo action, boolean warp_mode) DrawLaser(0, DL_LASER_ENABLED); BackToFront(); - Delay(50); + Delay_WithScreenUpdates(50); } StopSound_MM(SND_MM_GAME_HEALTH_CHARGING); @@ -3166,8 +3141,10 @@ static void GameActions_MM_Ext(struct MouseActionInfo action, boolean warp_mode) SetTileCursorActive(FALSE); + game.restart_game_message = "Out of magic energy! Play it again?"; + #if 0 - if (Request("Out of magic energy ! Play it again ?", + if (Request("Out of magic energy! Play it again?", REQ_ASK | REQ_STAY_CLOSED)) { InitGame(); @@ -3238,9 +3215,6 @@ static void GameActions_MM_Ext(struct MouseActionInfo action, boolean warp_mode) (native_mm_level.laser_blue ? color_down : 0x00)); DrawLaser(0, DL_LASER_ENABLED); -#if 0 - BackToFront(); -#endif } if (!laser.overloaded) @@ -3278,6 +3252,8 @@ static void GameActions_MM_Ext(struct MouseActionInfo action, boolean warp_mode) { int i; + UpdateAndDisplayGameControlValues(); + for (i = 15; i >= 0; i--) { #if 0 @@ -3288,7 +3264,7 @@ static void GameActions_MM_Ext(struct MouseActionInfo action, boolean warp_mode) DrawLaser(0, DL_LASER_ENABLED); BackToFront(); - Delay(50); + Delay_WithScreenUpdates(50); } DrawLaser(0, DL_LASER_DISABLED); @@ -3298,8 +3274,10 @@ static void GameActions_MM_Ext(struct MouseActionInfo action, boolean warp_mode) SetTileCursorActive(FALSE); + game.restart_game_message = "Magic spell hit Mc Duffin! Play it again?"; + #if 0 - if (Request("Magic spell hit Mc Duffin ! Play it again ?", + if (Request("Magic spell hit Mc Duffin! Play it again?", REQ_ASK | REQ_STAY_CLOSED)) { InitGame(); @@ -3343,7 +3321,7 @@ static void GameActions_MM_Ext(struct MouseActionInfo action, boolean warp_mode) laser.num_edges = 0; Bang_MM(laser.start_edge.x, laser.start_edge.y); - if (Request("Bomb killed Mc Duffin ! Play it again ?", + if (Request("Bomb killed Mc Duffin! Play it again?", REQ_ASK | REQ_STAY_CLOSED)) { InitGame(); @@ -3387,7 +3365,7 @@ static void GameActions_MM_Ext(struct MouseActionInfo action, boolean warp_mode) Store[ELX][ELY] = new_element + RND(get_num_elements(new_element)); Feld[ELX][ELY] = EL_GRAY_BALL_OPENING; - /* !!! CHECK AGAIN: Laser on Polarizer !!! */ + // !!! CHECK AGAIN: Laser on Polarizer !!! ScanLaser(); return; @@ -3439,7 +3417,7 @@ static void GameActions_MM_Ext(struct MouseActionInfo action, boolean warp_mode) DrawLaser(0, DL_LASER_ENABLED); - Delay(50); + Delay_WithScreenUpdates(50); } Feld[ELX][ELY] = element; @@ -3449,7 +3427,7 @@ static void GameActions_MM_Ext(struct MouseActionInfo action, boolean warp_mode) printf("NEW ELEMENT: (%d, %d)\n", ELX, ELY); #endif - /* above stuff: GRAY BALL -> PRISM !!! */ + // above stuff: GRAY BALL -> PRISM !!! /* LX = ELX * TILEX + 14; LY = ELY * TILEY + 14; @@ -3513,7 +3491,7 @@ static void GameActions_MM_Ext(struct MouseActionInfo action, boolean warp_mode) DrawWallsAnimation_MM(ELX, ELY, Feld[ELX][ELY], phase, laser.wall_mask); BackToFront(); - Delay(100); + Delay_WithScreenUpdates(100); } if (Feld[ELX][ELY] == EL_WALL_ICE) @@ -3521,8 +3499,8 @@ static void GameActions_MM_Ext(struct MouseActionInfo action, boolean warp_mode) /* laser.num_edges--; - LX = laser.edge[laser.num_edges].x - (SX + 2); - LY = laser.edge[laser.num_edges].y - (SY + 2); + LX = laser.edge[laser.num_edges].x - cSX2; + LY = laser.edge[laser.num_edges].y - cSY2; */ for (i = (laser.num_damages > 0 ? laser.num_damages - 1 : 0); i >= 0; i--) @@ -3575,12 +3553,12 @@ static void GameActions_MM_Ext(struct MouseActionInfo action, boolean warp_mode) { if (laser.wall_mask & (1 << i)) { - if (CheckLaserPixel(SX + ELX * TILEX + 14 + (i % 2) * 2, - SY + ELY * TILEY + 31 * (i / 2))) + if (CheckLaserPixel(cSX + ELX * TILEX + 14 + (i % 2) * 2, + cSY + ELY * TILEY + 31 * (i / 2))) break; - if (CheckLaserPixel(SX + ELX * TILEX + 31 * (i % 2), - SY + ELY * TILEY + 14 + (i / 2) * 2)) + if (CheckLaserPixel(cSX + ELX * TILEX + 31 * (i % 2), + cSY + ELY * TILEY + 14 + (i / 2) * 2)) break; } } @@ -3591,8 +3569,8 @@ static void GameActions_MM_Ext(struct MouseActionInfo action, boolean warp_mode) { if (laser.wall_mask & (1 << i)) { - if (CheckLaserPixel(SX + ELX * TILEX + 31 * (i % 2), - SY + ELY * TILEY + 31 * (i / 2))) + if (CheckLaserPixel(cSX + ELX * TILEX + 31 * (i % 2), + cSY + ELY * TILEY + 31 * (i / 2))) break; } } @@ -3601,8 +3579,8 @@ static void GameActions_MM_Ext(struct MouseActionInfo action, boolean warp_mode) if (laser.num_beamers > 0 || k1 < 1 || k2 < 4 || k3 < 4 || - CheckLaserPixel(SX + ELX * TILEX + 14, - SY + ELY * TILEY + 14)) + CheckLaserPixel(cSX + ELX * TILEX + 14, + cSY + ELY * TILEY + 14)) { laser.num_edges = r; laser.num_damages = d; @@ -3646,7 +3624,7 @@ static void GameActions_MM_Ext(struct MouseActionInfo action, boolean warp_mode) DrawWallsAnimation_MM(dx, dy, de, i, dm); BackToFront(); - Delay(20); + Delay_WithScreenUpdates(20); } DrawLaser(0, DL_LASER_ENABLED); @@ -3727,7 +3705,7 @@ static void GameActions_MM_Ext(struct MouseActionInfo action, boolean warp_mode) redraw_mask |= REDRAW_DOOR_1; BackToFront(); - Delay(20); + Delay_WithScreenUpdates(20); } game_mm.energy_left = MAX_LASER_ENERGY; @@ -3744,14 +3722,15 @@ static void GameActions_MM_Ext(struct MouseActionInfo action, boolean warp_mode) void GameActions_MM(struct MouseActionInfo action, boolean warp_mode) { - ClickElement(action.lx, action.ly, action.button); + boolean element_clicked = ClickElement(action.lx, action.ly, action.button); + boolean button_released = (action.button == MB_RELEASED); GameActions_MM_Ext(action, warp_mode); - CheckSingleStepMode_MM(action.button == MB_RELEASED); + CheckSingleStepMode_MM(element_clicked, button_released); } -void MovePacMen() +void MovePacMen(void) { int mx, my, ox, oy, nx, ny; int element; @@ -3816,8 +3795,8 @@ void MovePacMen() getGraphicSource(graphic, 0, &bitmap, &src_x, &src_y); CT = FrameCounter; - ox = SX + ox * TILEX; - oy = SY + oy * TILEY; + ox = cSX + ox * TILEX; + oy = cSY + oy * TILEY; for (i = 1; i < 33; i += 2) BlitBitmap(bitmap, window, @@ -3856,7 +3835,7 @@ void MovePacMen() } } -void GameWon_MM() +void GameWon_MM(void) { int hi_pos; boolean raise_level = FALSE; @@ -3899,13 +3878,13 @@ void GameWon_MM() } BackToFront(); - Delay(10); + Delay_WithScreenUpdates(10); } if (setup.sound_loops) StopSound(SND_SIRR); } - else if (native_mm_level.time == 0) /* level without time limit */ + else if (native_mm_level.time == 0) // level without time limit { if (setup.sound_loops) PlaySoundExt(SND_SIRR, SOUND_MAX_VOLUME, SOUND_MAX_RIGHT, @@ -3927,20 +3906,16 @@ void GameWon_MM() */ BackToFront(); - Delay(10); + Delay_WithScreenUpdates(10); } if (setup.sound_loops) StopSound(SND_SIRR); } -#if 0 - FadeSounds(); -#endif - CloseDoor(DOOR_CLOSE_1); - Request("Level solved !", REQ_CONFIRM); + Request("Level solved!", REQ_CONFIRM); if (level_nr == leveldir_current->handicap_level) { @@ -3949,9 +3924,9 @@ void GameWon_MM() } if (level_editor_test_game) - game_mm.score = -1; /* no highscore when playing from editor */ + game_mm.score = -1; // no highscore when playing from editor else if (level_nr < leveldir_current->last_level) - raise_level = TRUE; /* advance to next level */ + raise_level = TRUE; // advance to next level if ((hi_pos = NewHiScore_MM()) >= 0) { @@ -3975,7 +3950,7 @@ void GameWon_MM() BackToFront(); } -int NewHiScore_MM() +int NewHiScore_MM(void) { int k, l; int position = -1; @@ -3990,7 +3965,7 @@ int NewHiScore_MM() { if (game_mm.score > highscore[k].Score) { - /* player has made it to the hall of fame */ + // player has made it to the hall of fame if (k < MAX_SCORE_ENTRIES - 1) { @@ -4000,7 +3975,7 @@ int NewHiScore_MM() for (l = k; l < MAX_SCORE_ENTRIES; l++) if (!strcmp(setup.player_name, highscore[l].Name)) m = l; - if (m == k) /* player's new highscore overwrites his old one */ + if (m == k) // player's new highscore overwrites his old one goto put_into_list; #endif @@ -4025,7 +4000,7 @@ int NewHiScore_MM() #ifdef ONE_PER_NAME else if (!strncmp(setup.player_name, highscore[k].Name, MAX_PLAYER_NAME_LEN)) - break; /* player already there with a higher score */ + break; // player already there with a higher score #endif } @@ -4173,11 +4148,6 @@ void PlaySoundLevel(int x, int y, int sound_nr) static void RaiseScore_MM(int value) { game_mm.score += value; - -#if 0 - DrawText(DX_SCORE, DY_SCORE, int2str(game_mm.score, 4), - FONT_TEXT_2); -#endif } void RaiseScoreElement_MM(int element) @@ -4211,9 +4181,9 @@ void RaiseScoreElement_MM(int element) } -/* ------------------------------------------------------------------------- */ -/* Mirror Magic game engine snapshot handling functions */ -/* ------------------------------------------------------------------------- */ +// ---------------------------------------------------------------------------- +// Mirror Magic game engine snapshot handling functions +// ---------------------------------------------------------------------------- void SaveEngineSnapshotValues_MM(ListNode **buffers) { @@ -4256,11 +4226,11 @@ void SaveEngineSnapshotValues_MM(ListNode **buffers) engine_snapshot_mm.overload_delay = overload_delay; } -void LoadEngineSnapshotValues_MM() +void LoadEngineSnapshotValues_MM(void) { int x, y; - /* stored engine snapshot buffers already restored at this point */ + // stored engine snapshot buffers already restored at this point game_mm = engine_snapshot_mm.game_mm; laser = engine_snapshot_mm.laser; @@ -4298,7 +4268,7 @@ void LoadEngineSnapshotValues_MM() energy_delay = engine_snapshot_mm.energy_delay; overload_delay = engine_snapshot_mm.overload_delay; - RedrawPlayfield_MM(TRUE); + RedrawPlayfield_MM(); } static int getAngleFromTouchDelta(int dx, int dy, int base) @@ -4314,8 +4284,8 @@ static int getAngleFromTouchDelta(int dx, int dy, int base) int getButtonFromTouchPosition(int x, int y, int dst_mx, int dst_my) { // calculate start (source) position to be at the middle of the tile - int src_mx = SX + x * TILESIZE_VAR + TILESIZE_VAR / 2; - int src_my = SY + y * TILESIZE_VAR + TILESIZE_VAR / 2; + int src_mx = cSX + x * TILESIZE_VAR + TILESIZE_VAR / 2; + int src_my = cSY + y * TILESIZE_VAR + TILESIZE_VAR / 2; int dx = dst_mx - src_mx; int dy = dst_my - src_my; int element;