X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Fgame_mm%2Fmm_game.c;h=4f4af5f87c9aac8c71acb7a51ab4ffd0803cf6e6;hb=e67a93043d558993882f89c5f2a933882f934a29;hp=bc96959f179e1470e8477ff507e7379691a7671b;hpb=6cbe5843be6799c25bbd90cfa48371fb920c5606;p=rocksndiamonds.git diff --git a/src/game_mm/mm_game.c b/src/game_mm/mm_game.c index bc96959f..4f4af5f8 100644 --- a/src/game_mm/mm_game.c +++ b/src/game_mm/mm_game.c @@ -344,9 +344,15 @@ void InitGameEngine_MM() } } +#if 0 CloseDoor(DOOR_CLOSE_1); +#endif DrawLevel_MM(); +} + +void InitGameEngine_MM_AfterFadingIn() +{ InitCycleElements(); InitLaser(); @@ -365,8 +371,10 @@ void InitGameEngine_MM() 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() */ @@ -374,7 +382,9 @@ void InitGameEngine_MM() DX, DY, DXSIZE, DYSIZE, DOOR_GFX_PAGEX1, DOOR_GFX_PAGEY1); #endif +#if 0 OpenDoor(DOOR_OPEN_ALL); +#endif if (setup.sound_loops) PlaySoundExt(SND_FUEL, SOUND_MAX_VOLUME, SOUND_MAX_RIGHT, SND_CTRL_PLAY_LOOP); @@ -461,13 +471,13 @@ boolean StepBehind() static int getMaskFromElement(int element) { if (IS_GRID(element)) - return GFX_MASK_GRID_00 + get_element_phase(element); + return IMG_MM_MASK_GRID_1 + get_element_phase(element); else if (IS_MCDUFFIN(element)) - return GFX_MASK_MCDUFFIN_00 + get_element_phase(element); + return IMG_MM_MASK_MCDUFFIN_RIGHT + get_element_phase(element); else if (IS_RECTANGLE(element) || IS_DF_GRID(element)) - return GFX_MASK_RECTANGLE; + return IMG_MM_MASK_RECTANGLE; else - return GFX_MASK_CIRCLE; + return IMG_MM_MASK_CIRCLE; } int ScanPixel() @@ -497,53 +507,47 @@ int ScanPixel() for (i=0; i<4; i++) { + int px = LX + (i % 2) * 2; + 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! */ Pixel pixel; - int px, py, lx, ly; - - px = SX + LX + (i % 2) * 2; - py = SY + LY + (i / 2) * 2; - lx = (px - SX + TILEX) / TILEX - 1; /* ...+TILEX...-1 to get correct */ - ly = (py - SY + TILEY) / TILEY - 1; /* negative values! */ if (IN_LEV_FIELD(lx, ly)) { int element = Feld[lx][ly]; if (element == EL_EMPTY || element == EL_EXPLODING_TRANSP) + { pixel = 0; + } else if (IS_WALL(element) || IS_WALL_CHANGING(element)) { - int pos = - ((py - SY - ly * TILEY) / MINI_TILEX) * 2 + - (px - SX - lx * TILEX) / MINI_TILEY; + int pos = dy / MINI_TILEY * 2 + dx / MINI_TILEX; pixel = ((element & (1 << pos)) ? 1 : 0); } else { int graphic_mask = getMaskFromElement(element); + Bitmap *bitmap; + int src_x, src_y; int mask_x, mask_y; - int dx = px - lx * TILEX; - int dy = py - ly * TILEY; - mask_x = (graphic_mask % GFX_PER_LINE) * TILEX + dx; - mask_y = (graphic_mask / GFX_PER_LINE) * TILEY + dy; + getGraphicSource(graphic_mask, 0, &bitmap, &src_x, &src_y); -#if 1 - // !!! temporary fix to compile -- change to game graphics !!! - pixel = (ReadPixel(drawto, mask_x, mask_y) ? 1 : 0); -#else - pixel = (ReadPixel(pix[PIX_BACK], mask_x, mask_y) ? 1 : 0); -#endif + mask_x = src_x + dx; + mask_y = src_y + dy; + + pixel = (ReadPixel(bitmap, mask_x, mask_y) ? 1 : 0); } } else { - if (px < REAL_SX || px >= REAL_SX + FULL_SXSIZE || - py < REAL_SY || py >= REAL_SY + FULL_SYSIZE) - pixel = 1; - else - pixel = 0; + pixel = (SX + px < REAL_SX || SX + px >= REAL_SX + FULL_SXSIZE || + SY + py < REAL_SY || SY + py >= REAL_SY + FULL_SYSIZE); } if ((Sign[laser.current_angle] & (1 << i)) && pixel) @@ -2126,6 +2130,7 @@ static void Explode_MM(int x, int y, int phase, int mode) Store[x][y] = EL_EMPTY; } + 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); @@ -2133,28 +2138,29 @@ static void Explode_MM(int x, int y, int phase, int mode) } else if (!(phase % delay) && IN_SCR_FIELD(SCREENX(x), SCREENY(y))) { - int graphic = GFX_EXPLOSION_START; + int graphic = IMG_MM_DEFAULT_EXPLODING; int graphic_phase = (phase / delay - 1); + Bitmap *bitmap; + int src_x, src_y; if (Store2[x][y] == EX_KETTLE) { if (graphic_phase < 3) - graphic = GFX_EXPLOSION_KETTLE; + graphic = IMG_MM_KETTLE_EXPLODING; else if (graphic_phase < 5) { - graphic = GFX_EXPLOSION_LAST; - graphic_phase -= graphic_phase; + graphic_phase += 3; } else { - graphic = GFX_EMPTY; + graphic = IMG_EMPTY; graphic_phase = 0; } } else if (Store2[x][y] == EX_SHORT) { if (graphic_phase < 4) - graphic = GFX_EXPLOSION_SHORT; + graphic_phase += 4; else { graphic = GFX_EMPTY; @@ -2162,7 +2168,11 @@ static void Explode_MM(int x, int y, int phase, int mode) } } - DrawGraphic_MM(x, y, graphic + graphic_phase); + 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); + MarkTileDirty(x, y); } } @@ -2425,7 +2435,7 @@ void ClickElement(int mx, int my, int button) laser.fuse_off = FALSE; laser.fuse_x = laser.fuse_y = -1; - DrawGraphic_MM(x, y, GFX_FUSE_ON); + DrawGraphic_MM(x, y, IMG_MM_FUSE_ACTIVE); ScanLaser(); } else if (element == EL_FUSE_ON && !laser.fuse_off && new_button) @@ -2436,7 +2446,7 @@ void ClickElement(int mx, int my, int button) laser.overloaded = FALSE; DrawLaser(0, DL_LASER_DISABLED); - DrawGraphic_MM(x, y, GFX_FUSE_OFF); + DrawGraphic_MM(x, y, IMG_MM_FUSE); } else if (element == EL_LIGHTBALL) { @@ -2670,7 +2680,7 @@ void ColorCycling(void) } } -void GameActions_MM(byte action[MAX_PLAYERS], boolean warp_mode) +static void GameActions_MM_Ext(byte action[MAX_PLAYERS], boolean warp_mode) { static unsigned int action_delay = 0; static unsigned int pacman_delay = 0; @@ -2960,7 +2970,7 @@ void GameActions_MM(byte action[MAX_PLAYERS], boolean warp_mode) laser.fuse_x = ELX; laser.fuse_y = ELY; DrawLaser(0, DL_LASER_DISABLED); - DrawGraphic_MM(ELX, ELY, GFX_FUSE_OFF); + DrawGraphic_MM(ELX, ELY, IMG_MM_FUSE); } if (element == EL_BALL_GRAY && CT > 1500) @@ -3346,6 +3356,14 @@ void GameActions_MM(byte action[MAX_PLAYERS], boolean warp_mode) return; } +void GameActions_MM(byte action[MAX_PLAYERS], boolean warp_mode) +{ + if (!button_status) + ClickElement(0, 0, MB_NOT_PRESSED); + + GameActions_MM_Ext(action, warp_mode); +} + void MovePacMen() { static int p = -1; @@ -3398,7 +3416,7 @@ void MovePacMen() game_mm.pacman[p].x = nx; game_mm.pacman[p].y = ny; g = Feld[nx][ny] - EL_PACMAN_RIGHT; - DrawGraphic_MM(ox, oy, GFX_EMPTY); + DrawGraphic_MM(ox, oy, IMG_EMPTY); if (element != EL_EMPTY) {