X-Git-Url: https://git.artsoft.org/?p=rocksndiamonds.git;a=blobdiff_plain;f=src%2Fgame_mm%2Fmm_game.c;h=ed84121dd2d75d463aeb4f6535e4ffa47d7d5e41;hp=c2c7df2b0c7920da5b5cc5721d16521a52718253;hb=457e98ec0803cd9005a522018e7c255454d1e915;hpb=5db2619b4949eaaf09b5564ab0be361a332498f4 diff --git a/src/game_mm/mm_game.c b/src/game_mm/mm_game.c index c2c7df2b..ed84121d 100644 --- a/src/game_mm/mm_game.c +++ b/src/game_mm/mm_game.c @@ -55,20 +55,23 @@ #define IS_MUSIC_SOUND(s) ((s) == SND_TYGER || (s) == SND_VOYAGER) /* game button identifiers */ -#define GAME_CTRL_ID_LEFT 0 -#define GAME_CTRL_ID_MIDDLE 1 -#define GAME_CTRL_ID_RIGHT 2 +#define GAME_CTRL_ID_LEFT 0 +#define GAME_CTRL_ID_MIDDLE 1 +#define GAME_CTRL_ID_RIGHT 2 -#define NUM_GAME_BUTTONS 3 +#define NUM_GAME_BUTTONS 3 /* values for DrawLaser() */ -#define DL_LASER_DISABLED 0 -#define DL_LASER_ENABLED 1 +#define DL_LASER_DISABLED 0 +#define DL_LASER_ENABLED 1 /* values for 'click_delay_value' in ClickElement() */ #define CLICK_DELAY_SHORT 125 #define CLICK_DELAY_LONG 250 + #define AUTO_ROTATE_DELAY CLICK_DELAY_SHORT +#define INIT_GAME_ACTIONS_DELAY ONE_SECOND_DELAY +#define NUM_INIT_CYCLE_STEPS 16 /* forward declaration for internal use */ static int MovingOrBlocked2Element_MM(int, int); @@ -114,9 +117,9 @@ static void InitMovDir_MM(int x, int y) int element = Feld[x][y]; static int direction[3][4] = { - { MV_RIGHT, MV_UP, MV_LEFT, MV_DOWN }, - { MV_LEFT, MV_DOWN, MV_RIGHT, MV_UP }, - { MV_LEFT, MV_RIGHT, MV_UP, MV_DOWN } + { MV_RIGHT, MV_UP, MV_LEFT, MV_DOWN }, + { MV_LEFT, MV_DOWN, MV_RIGHT, MV_UP }, + { MV_LEFT, MV_RIGHT, MV_UP, MV_DOWN } }; switch(element) @@ -215,41 +218,28 @@ static void InitField(int x, int y, boolean init_game) } } -static void InitCycleElements() +static void InitCycleElements_RotateSingleStep() { - int i, j; + int i; if (game_mm.num_cycle == 0) /* no elements to cycle */ return; - for(i=0; i<16; i++) + for (i = 0; i < game_mm.num_cycle; i++) { - for(j=0; j= SXSIZE + 2 || ly >= SYSIZE + 2) { Error(ERR_WARN, "AddLaserEdge: out of bounds: %d, %d", lx, ly); + return; } @@ -464,8 +453,8 @@ boolean StepBehind() return ((x - last_x) * XS < 0 || (y - last_y) * YS < 0); } - else - return FALSE; + + return FALSE; } static int getMaskFromElement(int element) @@ -505,7 +494,7 @@ int ScanPixel() } #endif - for (i=0; i<4; i++) + for (i = 0; i < 4; i++) { int px = LX + (i % 2) * 2; int py = LY + (i / 2) * 2; @@ -570,6 +559,10 @@ void ScanLaser() int element; int end = 0, rf = laser.num_edges; + /* do not scan laser again after the game was lost for whatever reason */ + if (game_mm.game_over) + return; + laser.overloaded = FALSE; laser.stops_inside_element = FALSE; @@ -588,6 +581,7 @@ void ScanLaser() { end = 1; laser.overloaded = TRUE; + break; } @@ -677,6 +671,7 @@ void ScanLaser() if (HitBlock(element, hit_mask)) { rf = 1; + break; } } @@ -731,6 +726,7 @@ void ScanLaser() LX -= XS; LY -= YS; + AddLaserEdge(LX, LY); } @@ -758,12 +754,14 @@ void DrawLaserExt(int start_edge, int num_edges, int mode) if (start_edge < 0) { Error(ERR_WARN, "DrawLaserExt: start_edge < 0"); + return; } if (num_edges < 0) { Error(ERR_WARN, "DrawLaserExt: num_edges < 0"); + return; } @@ -792,18 +790,19 @@ void DrawLaserExt(int start_edge, int num_edges, int mode) /* determine the starting edge, from which graphics need to be restored */ if (start_edge > 0) { - for(i=0; i %d\n", laser.beamer_edge[i]); printf("DrawLaserExt: IS_BEAMER: [%d]: Hit[%d][%d] == %d [%d]\n", mode, elx, ely, Hit[elx][ely], start_edge); @@ -844,6 +843,7 @@ void DrawLaserExt(int start_edge, int num_edges, int mode) { /* element is outgoing beamer */ laser.num_damages = damage_start + 1; + if (IS_BEAMER(element)) laser.current_angle = get_element_angle(element); } @@ -866,6 +866,7 @@ void DrawLaserExt(int start_edge, int num_edges, int mode) laser.num_edges = start_edge + 1; 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); XS = 2 * Step[laser.current_angle].x; @@ -936,6 +937,7 @@ void DrawLaser(int start_edge, int mode) if (laser.num_edges - start_edge < 0) { Error(ERR_WARN, "DrawLaser: laser.num_edges - start_edge < 0"); + return; } @@ -949,7 +951,7 @@ void DrawLaser(int start_edge, int mode) int tmp_start_edge = start_edge; /* draw laser segments forward from the start to the last beamer */ - for (i=0; i=0; i--) + for (i = num_beamers-1; i >= 0; i--) { int tmp_num_edges = last_num_edges - laser.beamer_edge[i]; @@ -984,6 +987,7 @@ void DrawLaser(int start_edge, int mode) break; DrawLaserExt(laser.beamer_edge[i], tmp_num_edges, DL_LASER_DISABLED); + last_num_edges = laser.beamer_edge[i]; laser.num_beamers--; } @@ -999,7 +1003,9 @@ void DrawLaser(int start_edge, int mode) } } else + { DrawLaserExt(start_edge, laser.num_edges - start_edge, mode); + } } boolean HitElement(int element, int hit_mask) @@ -1070,6 +1076,7 @@ boolean HitElement(int element, int hit_mask) (element - EL_POLAR_START) / 2 != laser.current_angle % 8)) { PlaySoundStereo(SND_KINK, ST(ELX)); + laser.num_damages--; return TRUE; @@ -1079,6 +1086,7 @@ boolean HitElement(int element, int hit_mask) (element - EL_POLAR_CROSS_START) != laser.current_angle % 4) { PlaySoundStereo(SND_KINK, ST(ELX)); + laser.num_damages--; return TRUE; @@ -1098,6 +1106,7 @@ boolean HitElement(int element, int hit_mask) LX = ELX * TILEX + 14; LY = ELY * TILEY + 14; + AddLaserEdge(LX, LY); } @@ -1114,7 +1123,9 @@ boolean HitElement(int element, int hit_mask) int step_size; laser.num_damages--; + AddDamagedField(ELX, ELY); + laser.damage[laser.num_damages - 1].is_mirror = TRUE; if (!Hit[ELX][ELY]) @@ -1209,9 +1220,9 @@ boolean HitElement(int element, int hit_mask) PlaySoundStereo(SND_KLING, ST(ELX)); - for(y=0; y 0) == (i % 2) && (YS > 0) == (i / 2)) mask = 15 - (8 >> i); @@ -1916,6 +1961,7 @@ boolean HitAbsorbingWalls(int element, int hit_mask) if (element2 != EL_EMPTY && !IS_WALL_AMOEBA(element2)) { laser.dest_element = EL_EMPTY; + return TRUE; } @@ -1949,6 +1995,7 @@ void OpenExit(int x, int y) MovDelay[x][y]--; phase = MovDelay[x][y] / delay; + if (!(MovDelay[x][y] % delay) && IN_SCR_FIELD(x, y)) DrawGraphicAnimation_MM(x, y, IMG_MM_EXIT_OPENING, 3 - phase); @@ -1970,6 +2017,7 @@ void OpenSurpriseBall(int x, int y) if (MovDelay[x][y]) /* wait some time before next frame */ { MovDelay[x][y]--; + if (!(MovDelay[x][y] % delay) && IN_SCR_FIELD(x, y)) { Bitmap *bitmap; @@ -1978,8 +2026,10 @@ void OpenSurpriseBall(int x, int y) int dx = RND(26), dy = RND(26); getGraphicSource(graphic, 0, &bitmap, &gx, &gy); + BlitBitmap(bitmap, drawto, gx + dx, gy + dy, 6, 6, SX + x * TILEX + dx, SY + y * TILEY + dy); + MarkTileDirty(x, y); } @@ -2023,7 +2073,7 @@ void MeltIce(int x, int y) if (Feld[x][y] == EL_WALL_ICE) Feld[x][y] = EL_EMPTY; - for (i = (laser.num_damages > 0 ? laser.num_damages - 1 : 0); i>=0; i--) + for (i = (laser.num_damages > 0 ? laser.num_damages - 1 : 0); i >= 0; i--) if (laser.damage[i].is_mirror) break; @@ -2069,7 +2119,9 @@ void GrowAmoeba(int x, int y) DrawLaser(0, DL_LASER_ENABLED); } else if (!(MovDelay[x][y] % delay) && IN_SCR_FIELD(x, y)) + { DrawWallsAnimation_MM(x, y, real_element, phase, wall_mask); + } } } @@ -2090,6 +2142,7 @@ static void Explode_MM(int x, int y, int phase, int mode) /* put moving element to center field (and let it explode there) */ center_element = MovingOrBlocked2Element_MM(x, y); RemoveMovingField_MM(x, y); + Feld[x][y] = center_element; } @@ -2097,6 +2150,7 @@ static void Explode_MM(int x, int y, int phase, int mode) Store[x][y] = center_element; else Store[x][y] = EL_EMPTY; + Store2[x][y] = mode; Feld[x][y] = EL_EXPLODING_OPAQUE; MovDir[x][y] = MovPos[x][y] = MovDelay[x][y] = 0; @@ -2136,6 +2190,7 @@ static void Explode_MM(int x, int y, int phase, int mode) Feld[x][y] = Store[x][y]; Store[x][y] = Store2[x][y] = 0; MovDir[x][y] = MovPos[x][y] = MovDelay[x][y] = 0; + InitField(x, y, FALSE); DrawField_MM(x, y); } @@ -2149,7 +2204,9 @@ static void Explode_MM(int x, int y, int phase, int mode) if (Store2[x][y] == EX_KETTLE) { if (graphic_phase < 3) + { graphic = IMG_MM_KETTLE_EXPLODING; + } else if (graphic_phase < 5) { graphic_phase += 3; @@ -2163,7 +2220,9 @@ static void Explode_MM(int x, int y, int phase, int mode) else if (Store2[x][y] == EX_SHORT) { if (graphic_phase < 4) + { graphic_phase += 4; + } else { graphic = IMG_EMPTY; @@ -2175,6 +2234,7 @@ static void Explode_MM(int x, int y, int phase, int mode) BlitBitmap(bitmap, drawto_field, src_x, src_y, TILEX, TILEY, FX + x * TILEX, FY + y * TILEY); + MarkTileDirty(x, y); } } @@ -2250,7 +2310,7 @@ void TurnRound(int x, int y) int right_dir = turn[old_move_dir].right; int back_dir = turn[old_move_dir].back; int right_dx = move_xy[right_dir].x, right_dy = move_xy[right_dir].y; - int right_x = x+right_dx, right_y = y+right_dy; + int right_x = x + right_dx, right_y = y + right_dy; if (element == EL_PACMAN) { @@ -2298,6 +2358,7 @@ static void StartMoving_MM(int x, int y) { Store[newx][newy] = Feld[newx][newy]; Feld[newx][newy] = EL_EMPTY; + DrawField_MM(newx, newy); } else if (!IN_LEV_FIELD(newx, newy) || !IS_FREE(newx, newy) || @@ -2360,18 +2421,23 @@ static void ContinueMoving_MM(int x, int y) } } else /* still moving on */ + { DrawField_MM(x, y); + } laser.redraw = TRUE; } -void ClickElement(int mx, int my, int button) +void ClickElement(int x, int y, int button) { static unsigned int click_delay = 0; static int click_delay_value = CLICK_DELAY_SHORT; static boolean new_button = TRUE; int element; - int x = (mx - SX) / TILEX, y = (my - SY) / TILEY; + + /* do not rotate objects hit by the laser after the game was solved */ + if (game_mm.level_solved && Hit[x][y]) + return; if (button == MB_RELEASED) { @@ -2390,7 +2456,7 @@ void ClickElement(int mx, int my, int button) if (button == MB_MIDDLEBUTTON) /* middle button has no function */ return; - if (!IN_PIX_FIELD(mx - SX, my - SY)) + if (!IN_LEV_FIELD(x, y)) return; if (Feld[x][y] == EL_EMPTY) @@ -2412,6 +2478,7 @@ void ClickElement(int mx, int my, int button) if (!laser.fuse_off) { DrawLaser(0, DL_LASER_DISABLED); + /* BackToFront(); */ @@ -2424,9 +2491,11 @@ void ClickElement(int mx, int my, int button) Feld[x][y] = element; DrawField_MM(x, y); + /* BackToFront(); */ + if (!laser.fuse_off) ScanLaser(); } @@ -2495,7 +2564,9 @@ void RotateMirror(int x, int y, int button) hold_y = y; } else if (button == MB_RIGHTBUTTON && (hold_x != x || hold_y != y)) + { Feld[x][y] = get_rotated_element(Feld[x][y], ROTATE_RIGHT); + } } if (IS_GRID_STEEL_AUTO(Feld[x][y]) || IS_GRID_WOOD_AUTO(Feld[x][y])) @@ -2565,12 +2636,16 @@ void AutoRotateMirrors() if (!DelayReached(&rotate_delay, AUTO_ROTATE_DELAY)) return; - for (x=0; x 0x100) new = 0x001; } @@ -2683,7 +2759,7 @@ void ColorCycling(void) } } -static void GameActions_MM_Ext(byte action[MAX_PLAYERS], boolean warp_mode) +static void GameActions_MM_Ext(struct MouseActionInfo action, boolean warp_mode) { static unsigned int action_delay = 0; static unsigned int pacman_delay = 0; @@ -2696,10 +2772,10 @@ static void GameActions_MM_Ext(byte action[MAX_PLAYERS], boolean warp_mode) WaitUntilDelayReached(&action_delay, GameFrameDelay); - for (y=0; y=0; i--) + for (i = 15; i >= 0; i--) { #if 0 SetRGB(pen_ray, 0x0000, 0x0000, i * color_scale); @@ -2769,6 +2845,7 @@ static void GameActions_MM_Ext(byte action[MAX_PLAYERS], boolean warp_mode) 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(50); @@ -2835,6 +2912,8 @@ static void GameActions_MM_Ext(byte action[MAX_PLAYERS], boolean warp_mode) laser.overload_value = 0; } + game_mm.laser_overload_value = laser.overload_value; + if (laser.overload_value < MAX_LASER_OVERLOAD - 8) { int color_up = 0xFF * laser.overload_value / MAX_LASER_OVERLOAD; @@ -2844,10 +2923,12 @@ static void GameActions_MM_Ext(byte action[MAX_PLAYERS], boolean warp_mode) SetRGB(pen_ray, (laser.overload_value / 6) * color_scale, 0x0000, (15 - (laser.overload_value / 6)) * color_scale); #endif - pen_ray = GetPixelFromRGB(window, - (native_mm_level.laser_red ? 0xFF : color_up), - (native_mm_level.laser_green ? color_down : 0x00), - (native_mm_level.laser_blue ? color_down : 0x00)); + pen_ray = + GetPixelFromRGB(window, + (native_mm_level.laser_red ? 0xFF : color_up), + (native_mm_level.laser_green ? color_down : 0x00), + (native_mm_level.laser_blue ? color_down : 0x00)); + DrawLaser(0, DL_LASER_ENABLED); BackToFront(); } @@ -2855,7 +2936,8 @@ static void GameActions_MM_Ext(byte action[MAX_PLAYERS], boolean warp_mode) if (laser.overloaded) { if (setup.sound_loops) - PlaySoundExt(SND_WARNTON, SOUND_MAX_VOLUME, SOUND_MAX_RIGHT, SND_CTRL_PLAY_LOOP); + PlaySoundExt(SND_WARNTON, SOUND_MAX_VOLUME, SOUND_MAX_RIGHT, + SND_CTRL_PLAY_LOOP); else PlaySoundStereo(SND_WARNTON, SOUND_MAX_RIGHT); } @@ -2891,19 +2973,21 @@ static void GameActions_MM_Ext(byte action[MAX_PLAYERS], boolean warp_mode) { int i; - for(i=15; i>=0; i--) + 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(50); } DrawLaser(0, DL_LASER_DISABLED); + game_mm.game_over = TRUE; game_mm.game_over_cause = GAME_OVER_OVERLOADED; @@ -2972,6 +3056,7 @@ static void GameActions_MM_Ext(byte action[MAX_PLAYERS], boolean warp_mode) laser.fuse_off = TRUE; laser.fuse_x = ELX; laser.fuse_y = ELY; + DrawLaser(0, DL_LASER_DISABLED); DrawGraphic_MM(ELX, ELY, IMG_MM_FUSE); } @@ -3030,7 +3115,7 @@ static void GameActions_MM_Ext(byte action[MAX_PLAYERS], boolean warp_mode) graphic = el2gfx(element); - for(i=0; i<50; i++) + for (i = 0; i < 50; i++) { int x = RND(26); int y = RND(26); @@ -3099,8 +3184,6 @@ static void GameActions_MM_Ext(byte action[MAX_PLAYERS], boolean warp_mode) { PlaySoundStereo(SND_SLURP, ST(ELX)); - - { Feld[ELX][ELY] = Feld[ELX][ELY] - EL_WALL_ICE + EL_WALL_CHANGING; Store[ELX][ELY] = EL_WALL_ICE; @@ -3111,10 +3194,7 @@ static void GameActions_MM_Ext(byte action[MAX_PLAYERS], boolean warp_mode) return; } - - - - for(i=0; i<5; i++) + for (i = 0; i < 5; i++) { int phase = i + 1; @@ -3138,7 +3218,7 @@ static void GameActions_MM_Ext(byte action[MAX_PLAYERS], boolean warp_mode) LY = laser.edge[laser.num_edges].y - (SY + 2); */ - for (i = (laser.num_damages > 0 ? laser.num_damages - 1 : 0); i>=0; i--) + for (i = (laser.num_damages > 0 ? laser.num_damages - 1 : 0); i >= 0; i--) if (laser.damage[i].is_mirror) break; @@ -3160,7 +3240,7 @@ static void GameActions_MM_Ext(byte action[MAX_PLAYERS], boolean warp_mode) if (element2 != EL_EMPTY && !IS_WALL_AMOEBA(element)) return; - for (i = laser.num_damages - 1; i>=0; i--) + for (i = laser.num_damages - 1; i >= 0; i--) if (laser.damage[i].is_mirror) break; @@ -3180,10 +3260,11 @@ static void GameActions_MM_Ext(byte action[MAX_PLAYERS], boolean warp_mode) x = laser.damage[k1].x; y = laser.damage[k1].y; + DrawField_MM(x, y); } - for(i=0; i<4; i++) + for (i = 0; i < 4; i++) { if (laser.wall_mask & (1 << i)) { @@ -3200,7 +3281,7 @@ static void GameActions_MM_Ext(byte action[MAX_PLAYERS], boolean warp_mode) k2 = i; - for(i=0; i<4; i++) + for (i = 0; i < 4; i++) { if (laser.wall_mask & (1 << i)) { @@ -3220,30 +3301,27 @@ static void GameActions_MM_Ext(byte action[MAX_PLAYERS], boolean warp_mode) { laser.num_edges = r; laser.num_damages = d; + DrawLaser(0, DL_LASER_DISABLED); } Feld[ELX][ELY] = element | laser.wall_mask; + dx = ELX; dy = ELY; de = Feld[ELX][ELY]; dm = laser.wall_mask; - - #if 1 { int x = ELX, y = ELY; int wall_mask = laser.wall_mask; - ScanLaser(); DrawLaser(0, DL_LASER_ENABLED); PlaySoundStereo(SND_AMOEBE, ST(dx)); - - Feld[x][y] = Feld[x][y] - EL_WALL_AMOEBA + EL_WALL_CHANGING; Store[x][y] = EL_WALL_AMOEBA; Store2[x][y] = wall_mask; @@ -3252,17 +3330,16 @@ static void GameActions_MM_Ext(byte action[MAX_PLAYERS], boolean warp_mode) } #endif - - DrawWallsAnimation_MM(dx, dy, de, 4, dm); ScanLaser(); DrawLaser(0, DL_LASER_ENABLED); PlaySoundStereo(SND_AMOEBE, ST(dx)); - for(i=4; i>=0; i--) + for (i = 4; i >= 0; i--) { DrawWallsAnimation_MM(dx, dy, de, i, dm); + BackToFront(); Delay(20); } @@ -3285,12 +3362,12 @@ static void GameActions_MM_Ext(byte action[MAX_PLAYERS], boolean warp_mode) if (XS < YS) k += 2; - for(i=0; i<4; i++) + for (i = 0; i < 4; i++) { if (i) k++; if (k > 3) - k=0; + k = 0; x = ELX + Step[k * 4].x; y = ELY + Step[k * 4].y; @@ -3307,6 +3384,7 @@ static void GameActions_MM_Ext(byte action[MAX_PLAYERS], boolean warp_mode) if (i > 3) { laser.overloaded = (element == EL_BLOCK_STONE); + return; } @@ -3331,7 +3409,7 @@ static void GameActions_MM_Ext(byte action[MAX_PLAYERS], boolean warp_mode) if (element == EL_FUEL_FULL && CT > 200) { - for(i=game_mm.energy_left; i<=MAX_LASER_ENERGY; i+=2) + for (i = game_mm.energy_left; i <= MAX_LASER_ENERGY; i+=2) { #if 0 BlitBitmap(pix[PIX_DOOR], drawto, @@ -3359,10 +3437,9 @@ static void GameActions_MM_Ext(byte action[MAX_PLAYERS], boolean warp_mode) return; } -void GameActions_MM(byte action[MAX_PLAYERS], boolean warp_mode) +void GameActions_MM(struct MouseActionInfo action, boolean warp_mode) { - if (!button_status) - ClickElement(0, 0, MB_NOT_PRESSED); + ClickElement(action.lx, action.ly, action.button); GameActions_MM_Ext(action, warp_mode); } @@ -3376,9 +3453,10 @@ void MovePacMen() if (++p >= game_mm.num_pacman) p = 0; + game_mm.pacman[p].dir--; - for(l=1; l<5; l++) + for (l = 1; l < 5; l++) { game_mm.pacman[p].dir++; @@ -3401,6 +3479,7 @@ void MovePacMen() nx = ox + mx; ny = oy + my; element = Feld[nx][ny]; + if (nx < 0 || nx > 15 || ny < 0 || ny > 11) continue; @@ -3434,12 +3513,13 @@ void MovePacMen() ox = SX + ox * TILEX; oy = SY + oy * TILEY; - for(i=1; i<33; i+=2) + for (i = 1; i < 33; i += 2) BlitBitmap(bitmap, window, src_x, src_y, TILEX, TILEY, ox + i * mx, oy + i * my); Ct = Ct + Counter() - CT; } + DrawField_MM(nx, ny); BackToFront(); @@ -3450,14 +3530,13 @@ void MovePacMen() if (ObjHit(nx, ny, HIT_POS_BETWEEN)) { AddDamagedField(nx, ny); + laser.damage[laser.num_damages - 1].edge = 0; } } if (element == EL_BOMB) - { DeletePacMan(nx, ny); - } if (IS_WALL_AMOEBA(element) && (LX + 2 * XS) / TILEX == nx && @@ -3466,6 +3545,7 @@ void MovePacMen() laser.num_edges--; ScanLaser(); } + break; } } @@ -3485,9 +3565,10 @@ void GameWon_MM() if (game_mm.energy_left) { if (setup.sound_loops) - PlaySoundExt(SND_SIRR, SOUND_MAX_VOLUME, SOUND_MAX_RIGHT, SND_CTRL_PLAY_LOOP); + PlaySoundExt(SND_SIRR, SOUND_MAX_VOLUME, SOUND_MAX_RIGHT, + SND_CTRL_PLAY_LOOP); - while(game_mm.energy_left > 0) + while (game_mm.energy_left > 0) { if (!setup.sound_loops) PlaySoundStereo(SND_SIRR, SOUND_MAX_RIGHT); @@ -3521,9 +3602,10 @@ void GameWon_MM() else if (native_mm_level.time == 0) /* level without time limit */ { if (setup.sound_loops) - PlaySoundExt(SND_SIRR, SOUND_MAX_VOLUME, SOUND_MAX_RIGHT, SND_CTRL_PLAY_LOOP); + PlaySoundExt(SND_SIRR, SOUND_MAX_VOLUME, SOUND_MAX_RIGHT, + SND_CTRL_PLAY_LOOP); - while(TimePlayed < 999) + while (TimePlayed < 999) { if (!setup.sound_loops) PlaySoundStereo(SND_SIRR, SOUND_MAX_RIGHT); @@ -3568,15 +3650,19 @@ void GameWon_MM() if ((hi_pos = NewHiScore_MM()) >= 0) { game_status = HALLOFFAME; + // DrawHallOfFame(hi_pos); + if (raise_level) level_nr++; } else { game_status = MAINMENU; + if (raise_level) level_nr++; + // DrawMainMenu(); } @@ -3594,7 +3680,7 @@ int NewHiScore_MM() game_mm.score < highscore[MAX_SCORE_ENTRIES - 1].Score) return -1; - for (k=0; k highscore[k].Score) { @@ -3605,14 +3691,14 @@ int NewHiScore_MM() int m = MAX_SCORE_ENTRIES - 1; #ifdef ONE_PER_NAME - for (l=k; lk; l--) + for (l = m; l>k; l--) { strcpy(highscore[l].Name, highscore[l - 1].Name); highscore[l].Score = highscore[l - 1].Score; @@ -3626,6 +3712,7 @@ int NewHiScore_MM() highscore[k].Name[MAX_PLAYER_NAME_LEN] = '\0'; highscore[k].Score = game_mm.score; position = k; + break; } @@ -3650,6 +3737,7 @@ static void InitMovingField_MM(int x, int y, int direction) MovDir[x][y] = direction; MovDir[newx][newy] = direction; + if (Feld[newx][newy] == EL_EMPTY) Feld[newx][newy] = EL_BLOCKED; } @@ -3692,10 +3780,11 @@ static int MovingOrBlocked2Element_MM(int x, int y) int oldx, oldy; Blocked2Moving_MM(x, y, &oldx, &oldy); + return Feld[oldx][oldy]; } - else - return element; + + return element; } #if 0 @@ -3778,6 +3867,7 @@ 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); @@ -3791,9 +3881,11 @@ void RaiseScoreElement_MM(int element) case EL_PACMAN: RaiseScore_MM(native_mm_level.score[SC_PACMAN]); break; + case EL_KEY: RaiseScore_MM(native_mm_level.score[SC_KEY]); break; + default: break; }