From: Holger Schemel Date: Thu, 2 Mar 2017 17:45:58 +0000 (+0100) Subject: whitespace changes X-Git-Tag: 4.1.0.0~182 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=98272a6958328946fb3ceab794cb21f59f91d22f;p=rocksndiamonds.git whitespace changes --- diff --git a/src/game_mm/mm_files.c b/src/game_mm/mm_files.c index d31d8c81..31e56633 100644 --- a/src/game_mm/mm_files.c +++ b/src/game_mm/mm_files.c @@ -90,8 +90,8 @@ void setLevelInfoToDefaults_MM() lev_fieldx = native_mm_level.fieldx = STD_LEV_FIELDX; lev_fieldy = native_mm_level.fieldy = STD_LEV_FIELDY; - for(x=0; xfile_version), &(level->game_version)); + ReadChunk_MM_VERS(file, &level->file_version, &level->game_version); return chunk_size; } -static int LoadLevel_MM_HEAD(File *file, int chunk_size, struct LevelInfo_MM *level) +static int LoadLevel_MM_HEAD(File *file, int chunk_size, + struct LevelInfo_MM *level) { int i; int laser_color; @@ -149,11 +151,11 @@ static int LoadLevel_MM_HEAD(File *file, int chunk_size, struct LevelInfo_MM *le level->time = getFile16BitInteger(file, BYTE_ORDER_BIG_ENDIAN); level->kettles_needed = getFile16BitInteger(file, BYTE_ORDER_BIG_ENDIAN); - for(i=0; iname[i] = getFile8Bit(file); level->name[MAX_LEVEL_NAME_LEN] = 0; - for(i=0; iscore[i] = getFile8Bit(file); level->auto_count_kettles = (getFile8Bit(file) == 1 ? TRUE : FALSE); @@ -172,18 +174,20 @@ static int LoadLevel_MM_HEAD(File *file, int chunk_size, struct LevelInfo_MM *le return chunk_size; } -static int LoadLevel_MM_AUTH(File *file, int chunk_size, struct LevelInfo_MM *level) +static int LoadLevel_MM_AUTH(File *file, int chunk_size, + struct LevelInfo_MM *level) { int i; - for(i=0; iauthor[i] = getFile8Bit(file); level->author[MAX_LEVEL_NAME_LEN] = 0; return chunk_size; } -static int LoadLevel_MM_BODY(File *file, int chunk_size, struct LevelInfo_MM *level) +static int LoadLevel_MM_BODY(File *file, int chunk_size, + struct LevelInfo_MM *level) { int x, y; int chunk_size_expected = level->fieldx * level->fieldy; @@ -199,11 +203,12 @@ static int LoadLevel_MM_BODY(File *file, int chunk_size, struct LevelInfo_MM *le if (chunk_size_expected != chunk_size) { ReadUnusedBytesFromFile(file, chunk_size); + return chunk_size_expected; } - for(y=0; yfieldy; y++) - for(x=0; xfieldx; x++) + for (y = 0; y < level->fieldy; y++) + for (x = 0; x < level->fieldx; x++) native_mm_level.field[x][y] = Feld[x][y] = Ur[x][y] = checkLevelElement(level->encoding_16bit_field ? getFile16BitInteger(file, BYTE_ORDER_BIG_ENDIAN) : @@ -253,6 +258,7 @@ boolean LoadNativeLevel_MM(char *filename, boolean level_info_only) if (strcmp(chunk_name, "CAVE") != 0) { Error(ERR_WARN, "unknown format of level file '%s'", filename); + closeFile(file); return FALSE; @@ -268,14 +274,17 @@ boolean LoadNativeLevel_MM(char *filename, boolean level_info_only) if (!checkCookieString(cookie, LEVEL_COOKIE_TMPL)) { Error(ERR_WARN, "unknown format of level file '%s'", filename); + closeFile(file); return FALSE; } - if ((native_mm_level.file_version = getFileVersionFromCookieString(cookie)) == -1) + if ((native_mm_level.file_version = getFileVersionFromCookieString(cookie)) + == -1) { Error(ERR_WARN, "unsupported version of level file '%s'", filename); + closeFile(file); return FALSE; @@ -294,6 +303,7 @@ boolean LoadNativeLevel_MM(char *filename, boolean level_info_only) { Error(ERR_WARN, "unknown chunk '%s' in level file '%s'", chunk_name, filename); + ReadUnusedBytesFromFile(file, chunk_size); } else if (chunk_info[i].size != -1 && @@ -301,6 +311,7 @@ boolean LoadNativeLevel_MM(char *filename, boolean level_info_only) { Error(ERR_WARN, "wrong size (%d) of chunk '%s' in level file '%s'", chunk_size, chunk_name, filename); + ReadUnusedBytesFromFile(file, chunk_size); } else @@ -313,10 +324,8 @@ boolean LoadNativeLevel_MM(char *filename, boolean level_info_only) chunks first (like "HEAD" and "BODY") that contain some header information, so check them here */ if (chunk_size_expected != chunk_size) - { Error(ERR_WARN, "wrong size (%d) of chunk '%s' in level file '%s'", chunk_size, chunk_name, filename); - } } } @@ -336,10 +345,10 @@ static void SaveLevel_MM_HEAD(FILE *file, struct LevelInfo_MM *level) putFile16BitInteger(file, level->time, BYTE_ORDER_BIG_ENDIAN); putFile16BitInteger(file, level->kettles_needed, BYTE_ORDER_BIG_ENDIAN); - for(i=0; iname[i], file); - for(i=0; iscore[i], file); fputc((level->auto_count_kettles ? 1 : 0), file); @@ -360,7 +369,7 @@ static void SaveLevel_MM_AUTH(FILE *file, struct LevelInfo_MM *level) { int i; - for(i=0; iauthor[i], file); } @@ -368,8 +377,8 @@ static void SaveLevel_MM_BODY(FILE *file, struct LevelInfo_MM *level) { int x, y; - for(y=0; yfieldy; y++) - for(x=0; xfieldx; x++) + for (y = 0; y < level->fieldy; y++) + for (x = 0; x < level->fieldx; x++) if (level->encoding_16bit_field) putFile16BitInteger(file, Ur[x][y], BYTE_ORDER_BIG_ENDIAN); else @@ -385,18 +394,21 @@ void SaveNativeLevel_MM(char *filename) if (!(file = fopen(filename, MODE_WRITE))) { Error(ERR_WARN, "cannot save level file '%s'", filename); + return; } /* check level field for 16-bit elements */ native_mm_level.encoding_16bit_field = FALSE; - for(y=0; y 255) native_mm_level.encoding_16bit_field = TRUE; body_chunk_size = - native_mm_level.fieldx * native_mm_level.fieldy * (native_mm_level.encoding_16bit_field ? 2 : 1); + native_mm_level.fieldx * native_mm_level.fieldy * + (native_mm_level.encoding_16bit_field ? 2 : 1); putFileChunk(file, "MMII", CHUNK_SIZE_UNDEFINED, BYTE_ORDER_BIG_ENDIAN); putFileChunk(file, "CAVE", CHUNK_SIZE_NONE, BYTE_ORDER_BIG_ENDIAN); diff --git a/src/game_mm/mm_game.c b/src/game_mm/mm_game.c index c2c7df2b..4de58b82 100644 --- a/src/game_mm/mm_game.c +++ b/src/game_mm/mm_game.c @@ -55,15 +55,15 @@ #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 @@ -114,9 +114,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) @@ -222,9 +222,9 @@ static void InitCycleElements() if (game_mm.num_cycle == 0) /* no elements to cycle */ return; - for(i=0; i<16; i++) + for (i = 0; i < 16; i++) { - for(j=0; j= SXSIZE + 2 || ly >= SYSIZE + 2) { Error(ERR_WARN, "AddLaserEdge: out of bounds: %d, %d", lx, ly); + return; } @@ -464,8 +465,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 +506,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; @@ -588,6 +589,7 @@ void ScanLaser() { end = 1; laser.overloaded = TRUE; + break; } @@ -677,6 +679,7 @@ void ScanLaser() if (HitBlock(element, hit_mask)) { rf = 1; + break; } } @@ -731,6 +734,7 @@ void ScanLaser() LX -= XS; LY -= YS; + AddLaserEdge(LX, LY); } @@ -758,12 +762,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 +798,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 +851,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 +874,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 +945,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 +959,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 +995,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 +1011,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 +1084,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 +1094,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 +1114,7 @@ boolean HitElement(int element, int hit_mask) LX = ELX * TILEX + 14; LY = ELY * TILEY + 14; + AddLaserEdge(LX, LY); } @@ -1114,7 +1131,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 +1228,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 +1969,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 +2003,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 +2025,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 +2034,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 +2081,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 +2127,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 +2150,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 +2158,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 +2198,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 +2212,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 +2228,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 +2242,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 +2318,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 +2366,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,7 +2429,9 @@ static void ContinueMoving_MM(int x, int y) } } else /* still moving on */ + { DrawField_MM(x, y); + } laser.redraw = TRUE; } @@ -2412,6 +2483,7 @@ void ClickElement(int mx, int my, int button) if (!laser.fuse_off) { DrawLaser(0, DL_LASER_DISABLED); + /* BackToFront(); */ @@ -2424,9 +2496,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 +2569,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,9 +2641,9 @@ void AutoRotateMirrors() if (!DelayReached(&rotate_delay, AUTO_ROTATE_DELAY)) return; - for (x=0; x 0x100) new = 0x001; } @@ -2696,10 +2773,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 +2846,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); @@ -2844,10 +2922,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 +2935,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 +2972,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 +3055,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 +3114,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 +3183,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 +3193,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 +3217,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 +3239,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 +3259,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 +3280,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 +3300,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 +3329,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 +3361,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 +3383,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 +3408,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, @@ -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; } diff --git a/src/game_mm/mm_init.c b/src/game_mm/mm_init.c index b3376a12..85bf271a 100644 --- a/src/game_mm/mm_init.c +++ b/src/game_mm/mm_init.c @@ -37,7 +37,7 @@ void InitElementProperties_MM() EL_GRID_WOOD_02, EL_GRID_WOOD_03, }; - static int ep_grid_num = sizeof(ep_grid)/sizeof(int); + static int ep_grid_num = sizeof(ep_grid) / sizeof(int); static int ep_mcduffin[] = { @@ -46,7 +46,7 @@ void InitElementProperties_MM() EL_MCDUFFIN_LEFT, EL_MCDUFFIN_DOWN, }; - static int ep_mcduffin_num = sizeof(ep_mcduffin)/sizeof(int); + static int ep_mcduffin_num = sizeof(ep_mcduffin) / sizeof(int); static int ep_rectangle[] = { @@ -59,7 +59,7 @@ void InitElementProperties_MM() EL_GATE_STONE, EL_GATE_WOOD }; - static int ep_rectangle_num = sizeof(ep_rectangle)/sizeof(int); + static int ep_rectangle_num = sizeof(ep_rectangle) / sizeof(int); static int ep_mirror[] = { @@ -80,7 +80,7 @@ void InitElementProperties_MM() EL_MIRROR_14, EL_MIRROR_15, }; - static int ep_mirror_num = sizeof(ep_mirror)/sizeof(int); + static int ep_mirror_num = sizeof(ep_mirror) / sizeof(int); static int ep_mirror_fixed[] = { @@ -89,7 +89,7 @@ void InitElementProperties_MM() EL_MIRROR_FIXED_02, EL_MIRROR_FIXED_03, }; - static int ep_mirror_fixed_num = sizeof(ep_mirror_fixed)/sizeof(int); + static int ep_mirror_fixed_num = sizeof(ep_mirror_fixed) / sizeof(int); static int ep_polar[] = { @@ -110,7 +110,7 @@ void InitElementProperties_MM() EL_POLAR_14, EL_POLAR_15, }; - static int ep_polar_num = sizeof(ep_polar)/sizeof(int); + static int ep_polar_num = sizeof(ep_polar) / sizeof(int); static int ep_polar_cross[] = { @@ -119,7 +119,7 @@ void InitElementProperties_MM() EL_POLAR_CROSS_02, EL_POLAR_CROSS_03, }; - static int ep_polar_cross_num = sizeof(ep_polar_cross)/sizeof(int); + static int ep_polar_cross_num = sizeof(ep_polar_cross) / sizeof(int); static int ep_beamer[] = { @@ -140,27 +140,27 @@ void InitElementProperties_MM() EL_BEAMER_14, EL_BEAMER_15, }; - static int ep_beamer_num = sizeof(ep_beamer)/sizeof(int); + static int ep_beamer_num = sizeof(ep_beamer) / sizeof(int); static int ep_reflecting[] = { }; - static int ep_reflecting_num = sizeof(ep_reflecting)/sizeof(int); + static int ep_reflecting_num = sizeof(ep_reflecting) / sizeof(int); static int ep_absorbing[] = { }; - static int ep_absorbing_num = sizeof(ep_absorbing)/sizeof(int); + static int ep_absorbing_num = sizeof(ep_absorbing) / sizeof(int); static int ep_inactive[] = { }; - static int ep_inactive_num = sizeof(ep_inactive)/sizeof(int); + static int ep_inactive_num = sizeof(ep_inactive) / sizeof(int); static int ep_wall[] = { }; - static int ep_wall_num = sizeof(ep_wall)/sizeof(int); + static int ep_wall_num = sizeof(ep_wall) / sizeof(int); static int ep_pacman[] = { @@ -169,7 +169,7 @@ void InitElementProperties_MM() EL_PACMAN_LEFT, EL_PACMAN_DOWN, }; - static int ep_pacman_num = sizeof(ep_pacman)/sizeof(int); + static int ep_pacman_num = sizeof(ep_pacman) / sizeof(int); static long ep_bit[] = { @@ -219,19 +219,19 @@ void InitElementProperties_MM() &ep_wall_num, &ep_pacman_num, }; - static int num_properties = sizeof(ep_num)/sizeof(int *); + static int num_properties = sizeof(ep_num) / sizeof(int *); - for(i=0; i=0 && (x)=0 &&(y)=BX1 && (x)<=BX2 && (y)>=BY1 &&(y)<=BY2) -#define IN_LEV_FIELD(x,y) ((x)>=0 && (x)=0 &&(y)=0 && (x)=0 && (y)= 0 && (x) < (xsize) && \ + (y) >= 0 && (y) < (ysize)) +#define IN_FIELD_MINMAX(x, y, xmin, ymin, xmax, ymax) \ + ((x) >= (xmin) && (x) <= (xmax) && \ + (y) >= (ymin) && (y) <= (ymax)) + +#define IN_PIX_FIELD(x, y) IN_FIELD(x, y, SXSIZE, SYSIZE) +#define IN_VIS_FIELD(x, y) IN_FIELD(x, y, SCR_FIELDX, SCR_FIELDY) +#define IN_LEV_FIELD(x, y) IN_FIELD(x, y, lev_fieldx, lev_fieldy) +#define IN_SCR_FIELD(x, y) IN_FIELD_MINMAX(x, y, BX1, BY1, BX2, BY2) /* values for 'Elementeigenschaften' */ #define EP_BIT_GRID (1 << 0) @@ -166,8 +173,8 @@ struct EditorInfo }; extern Bitmap *pix[]; -extern DrawBuffer *fieldbuffer; -extern DrawBuffer *drawto_field; +extern DrawBuffer *fieldbuffer; +extern DrawBuffer *drawto_field; extern int joystick_device; extern char *joystick_device_name[]; @@ -204,16 +211,16 @@ extern short AmoebaCnt[MAX_NUM_AMOEBA], AmoebaCnt2[MAX_NUM_AMOEBA]; extern unsigned int Elementeigenschaften[MAX_ELEMENTS]; extern int level_nr; -extern int lev_fieldx,lev_fieldy, scroll_x,scroll_y; +extern int lev_fieldx, lev_fieldy, scroll_x, scroll_y; -extern int FX,FY, ScrollStepSize; +extern int FX, FY, ScrollStepSize; extern int ScreenMovDir, ScreenMovPos, ScreenGfxPos; extern int GameFrameDelay; extern int FfwdFrameDelay; -extern int BX1,BY1, BX2,BY2; +extern int BX1, BY1, BX2, BY2; extern int SBX_Left, SBX_Right; extern int SBY_Upper, SBY_Lower; -extern int ZX,ZY, ExitX,ExitY; +extern int ZX, ZY, ExitX, ExitY; extern int AllPlayersGone; extern int TimeFrames, TimePlayed, TimeLeft; extern boolean SiebAktiv; @@ -228,8 +235,8 @@ extern struct LaserInfo laser; extern struct EditorInfo editor; extern struct GlobalInfo global; -extern short LX,LY, XS,YS, ELX,ELY; -extern short CT,Ct; +extern short LX, LY, XS, YS, ELX, ELY; +extern short CT, Ct; extern Pixel pen_fg, pen_bg, pen_ray, pen_magicolor[2]; extern int color_status; @@ -237,10 +244,10 @@ extern int color_status; extern struct XY Step[]; extern short Sign[16]; -extern char *sound_name[]; +extern char *sound_name[]; extern int background_loop[]; extern int num_bg_loops; -extern char *element_info[]; +extern char *element_info[]; extern int num_element_info; /* often used screen positions */ @@ -457,38 +464,38 @@ extern int num_element_info; #define EL_MM_END_1 155 #define EL_CHAR_START 160 -#define EL_CHAR_ASCII0 (EL_CHAR_START-32) -#define EL_CHAR_AUSRUF (EL_CHAR_ASCII0+33) -#define EL_CHAR_ZOLL (EL_CHAR_ASCII0+34) -#define EL_CHAR_RAUTE (EL_CHAR_ASCII0+35) -#define EL_CHAR_DOLLAR (EL_CHAR_ASCII0+36) -#define EL_CHAR_PROZ (EL_CHAR_ASCII0+37) -#define EL_CHAR_AMPERSAND (EL_CHAR_ASCII0+38) -#define EL_CHAR_APOSTR (EL_CHAR_ASCII0+39) -#define EL_CHAR_KLAMM1 (EL_CHAR_ASCII0+40) -#define EL_CHAR_KLAMM2 (EL_CHAR_ASCII0+41) -#define EL_CHAR_MULT (EL_CHAR_ASCII0+42) -#define EL_CHAR_PLUS (EL_CHAR_ASCII0+43) -#define EL_CHAR_KOMMA (EL_CHAR_ASCII0+44) -#define EL_CHAR_MINUS (EL_CHAR_ASCII0+45) -#define EL_CHAR_PUNKT (EL_CHAR_ASCII0+46) -#define EL_CHAR_SLASH (EL_CHAR_ASCII0+47) -#define EL_CHAR_0 (EL_CHAR_ASCII0+48) -#define EL_CHAR_9 (EL_CHAR_ASCII0+57) -#define EL_CHAR_DOPPEL (EL_CHAR_ASCII0+58) -#define EL_CHAR_SEMIKL (EL_CHAR_ASCII0+59) -#define EL_CHAR_LT (EL_CHAR_ASCII0+60) -#define EL_CHAR_GLEICH (EL_CHAR_ASCII0+61) -#define EL_CHAR_GT (EL_CHAR_ASCII0+62) -#define EL_CHAR_FRAGE (EL_CHAR_ASCII0+63) -#define EL_CHAR_AT (EL_CHAR_ASCII0+64) -#define EL_CHAR_A (EL_CHAR_ASCII0+65) -#define EL_CHAR_Z (EL_CHAR_ASCII0+90) -#define EL_CHAR_AE (EL_CHAR_ASCII0+91) -#define EL_CHAR_OE (EL_CHAR_ASCII0+92) -#define EL_CHAR_UE (EL_CHAR_ASCII0+93) -#define EL_CHAR_COPY (EL_CHAR_ASCII0+94) -#define EL_CHAR_END (EL_CHAR_START+79) +#define EL_CHAR_ASCII0 (EL_CHAR_START - 32) +#define EL_CHAR_AUSRUF (EL_CHAR_ASCII0 + 33) +#define EL_CHAR_ZOLL (EL_CHAR_ASCII0 + 34) +#define EL_CHAR_RAUTE (EL_CHAR_ASCII0 + 35) +#define EL_CHAR_DOLLAR (EL_CHAR_ASCII0 + 36) +#define EL_CHAR_PROZ (EL_CHAR_ASCII0 + 37) +#define EL_CHAR_AMPERSAND (EL_CHAR_ASCII0 + 38) +#define EL_CHAR_APOSTR (EL_CHAR_ASCII0 + 39) +#define EL_CHAR_KLAMM1 (EL_CHAR_ASCII0 + 40) +#define EL_CHAR_KLAMM2 (EL_CHAR_ASCII0 + 41) +#define EL_CHAR_MULT (EL_CHAR_ASCII0 + 42) +#define EL_CHAR_PLUS (EL_CHAR_ASCII0 + 43) +#define EL_CHAR_KOMMA (EL_CHAR_ASCII0 + 44) +#define EL_CHAR_MINUS (EL_CHAR_ASCII0 + 45) +#define EL_CHAR_PUNKT (EL_CHAR_ASCII0 + 46) +#define EL_CHAR_SLASH (EL_CHAR_ASCII0 + 47) +#define EL_CHAR_0 (EL_CHAR_ASCII0 + 48) +#define EL_CHAR_9 (EL_CHAR_ASCII0 + 57) +#define EL_CHAR_DOPPEL (EL_CHAR_ASCII0 + 58) +#define EL_CHAR_SEMIKL (EL_CHAR_ASCII0 + 59) +#define EL_CHAR_LT (EL_CHAR_ASCII0 + 60) +#define EL_CHAR_GLEICH (EL_CHAR_ASCII0 + 61) +#define EL_CHAR_GT (EL_CHAR_ASCII0 + 62) +#define EL_CHAR_FRAGE (EL_CHAR_ASCII0 + 63) +#define EL_CHAR_AT (EL_CHAR_ASCII0 + 64) +#define EL_CHAR_A (EL_CHAR_ASCII0 + 65) +#define EL_CHAR_Z (EL_CHAR_ASCII0 + 90) +#define EL_CHAR_AE (EL_CHAR_ASCII0 + 91) +#define EL_CHAR_OE (EL_CHAR_ASCII0 + 92) +#define EL_CHAR_UE (EL_CHAR_ASCII0 + 93) +#define EL_CHAR_COPY (EL_CHAR_ASCII0 + 94) +#define EL_CHAR_END (EL_CHAR_START + 79) #define EL_CHAR(x) ((x) == CHAR_BYTE_UMLAUT_A ? EL_CHAR_AE : \ (x) == CHAR_BYTE_UMLAUT_O ? EL_CHAR_OE : \ @@ -1071,13 +1078,13 @@ extern int num_element_info; #define SETUP 8 /* return values for GameActions */ -#define ACT_GO_ON 0 -#define ACT_GAME_OVER 1 -#define ACT_NEW_GAME 2 +#define ACT_GO_ON 0 +#define ACT_GAME_OVER 1 +#define ACT_NEW_GAME 2 /* values for color_status */ -#define STATIC_COLORS 0 -#define DYNAMIC_COLORS 1 +#define STATIC_COLORS 0 +#define DYNAMIC_COLORS 1 #define PROGRAM_VERSION_MAJOR 2 #define PROGRAM_VERSION_MINOR 0 @@ -1123,6 +1130,6 @@ extern int num_element_info; /* sound control */ -#define ST(x) (((x)-8)*16) +#define ST(x) (((x) - 8) * 16) #endif /* MM_MAIN_H */ diff --git a/src/game_mm/mm_tools.c b/src/game_mm/mm_tools.c index 9f52eb73..aa09879e 100644 --- a/src/game_mm/mm_tools.c +++ b/src/game_mm/mm_tools.c @@ -49,6 +49,7 @@ void DrawGraphic_MM(int x, int y, int graphic) #endif DrawGraphicExt_MM(drawto_field, FX + x*TILEX, FY + y*TILEY, graphic); + MarkTileDirty(x, y); } @@ -58,6 +59,7 @@ void DrawGraphicExt_MM(DrawBuffer *d, int x, int y, int graphic) int src_x, src_y; getGraphicSource(graphic, 0, &bitmap, &src_x, &src_y); + BlitBitmap(bitmap, d, src_x, src_y, TILEX, TILEY, x, y); } @@ -72,7 +74,9 @@ void DrawGraphicThruMask_MM(int x, int y, int graphic) } #endif - DrawGraphicThruMaskExt_MM(drawto_field, FX + x*TILEX, FY + y*TILEY, graphic); + DrawGraphicThruMaskExt_MM(drawto_field, FX + x * TILEX, FY + y * TILEY, + graphic); + MarkTileDirty(x,y); } @@ -92,8 +96,10 @@ void DrawGraphicThruMaskExt_MM(DrawBuffer *d, int dest_x, int dest_y, void DrawMiniGraphic_MM(int x, int y, int graphic) { - DrawMiniGraphicExt_MM(drawto, SX + x*MINI_TILEX, SY + y*MINI_TILEY, graphic); - MarkTileDirty(x/2, y/2); + DrawMiniGraphicExt_MM(drawto, SX + x * MINI_TILEX, SY + y * MINI_TILEY, + graphic); + + MarkTileDirty(x / 2, y / 2); } void getMicroGraphicSource(int graphic, Bitmap **bitmap, int *x, int *y) @@ -107,6 +113,7 @@ void DrawMiniGraphicExt_MM(DrawBuffer *d, int x, int y, int graphic) int src_x, src_y; getMiniGraphicSource(graphic, &bitmap, &src_x, &src_y); + BlitBitmap(bitmap, d, src_x, src_y, MINI_TILEX, MINI_TILEY, x, y); } @@ -121,6 +128,7 @@ void DrawGraphicShifted_MM(int x,int y, int dx,int dy, int graphic, if (graphic < 0) { DrawGraphic_MM(x, y, graphic); + return; } @@ -183,9 +191,13 @@ void DrawGraphicShifted_MM(int x,int y, int dx,int dy, int graphic, MarkTileDirty(x, y + 1); } /* Element verläßt unten das Bild */ else if (dy > 0 && (y == BY2 || cut_mode == CUT_BELOW)) + { height -= dy; + } else if (dy) /* allg. Bewegung in y-Richtung */ + { MarkTileDirty(x, y + SIGN(dy)); + } } getGraphicSource(graphic, 0, &src_bitmap, &src_x, &src_y); @@ -206,10 +218,8 @@ void DrawGraphicShifted_MM(int x,int y, int dx,int dy, int graphic, #endif if (mask_mode == USE_MASKING) - { BlitBitmapMasked(src_bitmap, drawto_field, src_x, src_y, TILEX, TILEY, dest_x, dest_y); - } else BlitBitmap(src_bitmap, drawto_field, src_x, src_y, width, height, dest_x, dest_y); @@ -220,7 +230,7 @@ void DrawGraphicShifted_MM(int x,int y, int dx,int dy, int graphic, void DrawGraphicShiftedThruMask_MM(int x,int y, int dx,int dy, int graphic, int cut_mode) { - DrawGraphicShifted_MM(x,y, dx,dy, graphic, cut_mode, USE_MASKING); + DrawGraphicShifted_MM(x, y, dx, dy, graphic, cut_mode, USE_MASKING); } void DrawScreenElementExt_MM(int x, int y, int dx, int dy, int element, @@ -323,23 +333,31 @@ void DrawScreenField_MM(int x, int y) int horiz_move; Blocked2Moving(x, y, &oldx, &oldy); + sx = SCREENX(oldx); sy = SCREENY(oldy); horiz_move = (MovDir[oldx][oldy] == MV_LEFT || MovDir[oldx][oldy] == MV_RIGHT); DrawScreenElement_MM(x, y, EL_EMPTY); + element = Feld[oldx][oldy]; if (horiz_move) - DrawScreenElementShifted_MM(sx,sy, MovPos[oldx][oldy],0,element,NO_CUTTING); + DrawScreenElementShifted_MM(sx, sy, MovPos[oldx][oldy], 0, element, + NO_CUTTING); else - DrawScreenElementShifted_MM(sx,sy, 0,MovPos[oldx][oldy],element,NO_CUTTING); + DrawScreenElementShifted_MM(sx, sy, 0, MovPos[oldx][oldy], element, + NO_CUTTING); } else if (IS_DRAWABLE(element)) + { DrawScreenElement_MM(x, y, element); + } else + { DrawScreenElement_MM(x, y, EL_EMPTY); + } } void DrawLevelField_MM(int x, int y) @@ -354,10 +372,12 @@ void DrawMiniElement_MM(int x, int y, int element) if (!element) { DrawMiniGraphic_MM(x, y, IMG_EMPTY); + return; } graphic = el2gfx(element); + DrawMiniGraphic_MM(x, y, graphic); } @@ -384,8 +404,8 @@ void DrawLevel_MM() ClearWindow(); - for (x=0; x DY+249 && y < DY+278) + if (y > DY + 249 && y < DY + 278) { - if (x > DX+1 && x < DX+48) + if (x > DX + 1 && x < DX + 48) return 1; - else if (x > DX+51 && x < DX+98) + else if (x > DX + 51 && x < DX + 98) return 2; } + return 0; }