X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Fgame.c;h=332da783035d540ce04ec1552087f136b78c67e3;hb=7cd6d9ecca4ccd4927eddc994b616569ef23b231;hp=b799fab19bbc4bc5ce50e67ca98a26fcac85c8a0;hpb=6c2ebd029ab05c3f48e84247b81da3fff8519694;p=rocksndiamonds.git diff --git a/src/game.c b/src/game.c index b799fab1..332da783 100644 --- a/src/game.c +++ b/src/game.c @@ -229,21 +229,28 @@ void GetPlayerConfig() InitJoysticks(); } -static int getBeltNrFromElement(int element) +static int getBeltNrFromBeltElement(int element) { return (element < EL_CONVEYOR_BELT2_LEFT ? 0 : element < EL_CONVEYOR_BELT3_LEFT ? 1 : element < EL_CONVEYOR_BELT4_LEFT ? 2 : 3); } -static int getBeltNrFromSwitchElement(int element) +static int getBeltNrFromBeltActiveElement(int element) +{ + return (element < EL_CONVEYOR_BELT2_LEFT_ACTIVE ? 0 : + element < EL_CONVEYOR_BELT3_LEFT_ACTIVE ? 1 : + element < EL_CONVEYOR_BELT4_LEFT_ACTIVE ? 2 : 3); +} + +static int getBeltNrFromBeltSwitchElement(int element) { return (element < EL_CONVEYOR_BELT2_SWITCH_LEFT ? 0 : element < EL_CONVEYOR_BELT3_SWITCH_LEFT ? 1 : element < EL_CONVEYOR_BELT4_SWITCH_LEFT ? 2 : 3); } -static int getBeltDirNrFromSwitchElement(int element) +static int getBeltDirNrFromBeltSwitchElement(int element) { static int belt_base_element[4] = { @@ -253,13 +260,13 @@ static int getBeltDirNrFromSwitchElement(int element) EL_CONVEYOR_BELT4_SWITCH_LEFT }; - int belt_nr = getBeltNrFromSwitchElement(element); + int belt_nr = getBeltNrFromBeltSwitchElement(element); int belt_dir_nr = element - belt_base_element[belt_nr]; return (belt_dir_nr % 3); } -static int getBeltDirFromSwitchElement(int element) +static int getBeltDirFromBeltSwitchElement(int element) { static int belt_move_dir[3] = { @@ -268,7 +275,7 @@ static int getBeltDirFromSwitchElement(int element) MV_RIGHT }; - int belt_dir_nr = getBeltDirNrFromSwitchElement(element); + int belt_dir_nr = getBeltDirNrFromBeltSwitchElement(element); return belt_move_dir[belt_dir_nr]; } @@ -287,10 +294,6 @@ static void InitField(int x, int y, boolean init_game) } } /* no break! */ - case EL_PLAYER: - if (init_game) - Feld[x][y] = EL_PLAYER1; - /* no break! */ case EL_PLAYER1: case EL_PLAYER2: case EL_PLAYER3: @@ -350,16 +353,16 @@ static void InitField(int x, int y, boolean init_game) case EL_SPACESHIP_LEFT: case EL_SPACESHIP_DOWN: case EL_SPACESHIP: - case EL_BUTTERFLY_RIGHT: - case EL_BUTTERFLY_UP: - case EL_BUTTERFLY_LEFT: - case EL_BUTTERFLY_DOWN: - case EL_BUTTERFLY: - case EL_FIREFLY_RIGHT: - case EL_FIREFLY_UP: - case EL_FIREFLY_LEFT: - case EL_FIREFLY_DOWN: - case EL_FIREFLY: + case EL_BD_BUTTERFLY_RIGHT: + case EL_BD_BUTTERFLY_UP: + case EL_BD_BUTTERFLY_LEFT: + case EL_BD_BUTTERFLY_DOWN: + case EL_BD_BUTTERFLY: + case EL_BD_FIREFLY_RIGHT: + case EL_BD_FIREFLY_UP: + case EL_BD_FIREFLY_LEFT: + case EL_BD_FIREFLY_DOWN: + case EL_BD_FIREFLY: case EL_PACMAN_RIGHT: case EL_PACMAN_UP: case EL_PACMAN_LEFT: @@ -386,7 +389,7 @@ static void InitField(int x, int y, boolean init_game) case EL_AMOEBA_DROP: if (y == lev_fieldy - 1) { - Feld[x][y] = EL_AMOEBING; + Feld[x][y] = EL_AMOEBA_CREATING; Store[x][y] = EL_AMOEBA_WET; } break; @@ -399,7 +402,7 @@ static void InitField(int x, int y, boolean init_game) local_player->lights_still_needed++; break; - case EL_SOKOBAN_FELD_LEER: + case EL_SOKOBAN_FIELD_EMPTY: local_player->sokobanfields_still_needed++; break; @@ -443,9 +446,9 @@ static void InitField(int x, int y, boolean init_game) case EL_CONVEYOR_BELT4_SWITCH_RIGHT: if (init_game) { - int belt_nr = getBeltNrFromSwitchElement(Feld[x][y]); - int belt_dir = getBeltDirFromSwitchElement(Feld[x][y]); - int belt_dir_nr = getBeltDirNrFromSwitchElement(Feld[x][y]); + int belt_nr = getBeltNrFromBeltSwitchElement(Feld[x][y]); + int belt_dir = getBeltDirFromBeltSwitchElement(Feld[x][y]); + int belt_dir_nr = getBeltDirNrFromBeltSwitchElement(Feld[x][y]); if (game.belt_dir_nr[belt_nr] == 3) /* initial value */ { @@ -481,7 +484,7 @@ void DrawGameDoorValues() for (i=0; i VERSION_IDENT(2,0,1)) - Elementeigenschaften2[EL_MAUERND] |= EP_BIT_EM_SLIPPERY_WALL; + Elementeigenschaften2[EL_WALL_GROWING_ACTIVE] |= EP_BIT_EM_SLIPPERY_WALL; else - Elementeigenschaften2[EL_MAUERND] &= ~EP_BIT_EM_SLIPPERY_WALL; + Elementeigenschaften2[EL_WALL_GROWING_ACTIVE] &=~EP_BIT_EM_SLIPPERY_WALL; } } @@ -666,12 +669,14 @@ void InitGame() InitGameEngine(); +#if 0 #if DEBUG #if USE_NEW_AMOEBA_CODE printf("Using new amoeba code.\n"); #else printf("Using old amoeba code.\n"); #endif +#endif #endif /* don't play tapes over network */ @@ -731,8 +736,8 @@ void InitGame() player->last_jx = player->last_jy = 0; player->jx = player->jy = 0; - player->shield_passive_time_left = 0; - player->shield_active_time_left = 0; + player->shield_normal_time_left = 0; + player->shield_deadly_time_left = 0; DigField(player, 0, 0, 0, 0, DF_NO_PUSH); SnapField(player, 0, 0); @@ -790,6 +795,7 @@ void InitGame() MovPos[x][y] = MovDir[x][y] = MovDelay[x][y] = 0; Store[x][y] = Store2[x][y] = StorePlayer[x][y] = 0; Frame[x][y] = 0; + GfxAction[x][y] = GFX_ACTION_DEFAULT; AmoebaNr[x][y] = 0; JustStopped[x][y] = 0; Stop[x][y] = FALSE; @@ -1044,20 +1050,20 @@ void InitMovDir(int x, int y) MovDir[x][y] = direction[0][element - EL_SPACESHIP_RIGHT]; break; - case EL_BUTTERFLY_RIGHT: - case EL_BUTTERFLY_UP: - case EL_BUTTERFLY_LEFT: - case EL_BUTTERFLY_DOWN: - Feld[x][y] = EL_BUTTERFLY; - MovDir[x][y] = direction[0][element - EL_BUTTERFLY_RIGHT]; + case EL_BD_BUTTERFLY_RIGHT: + case EL_BD_BUTTERFLY_UP: + case EL_BD_BUTTERFLY_LEFT: + case EL_BD_BUTTERFLY_DOWN: + Feld[x][y] = EL_BD_BUTTERFLY; + MovDir[x][y] = direction[0][element - EL_BD_BUTTERFLY_RIGHT]; break; - case EL_FIREFLY_RIGHT: - case EL_FIREFLY_UP: - case EL_FIREFLY_LEFT: - case EL_FIREFLY_DOWN: - Feld[x][y] = EL_FIREFLY; - MovDir[x][y] = direction[0][element - EL_FIREFLY_RIGHT]; + case EL_BD_FIREFLY_RIGHT: + case EL_BD_FIREFLY_UP: + case EL_BD_FIREFLY_LEFT: + case EL_BD_FIREFLY_DOWN: + Feld[x][y] = EL_BD_FIREFLY; + MovDir[x][y] = direction[0][element - EL_BD_FIREFLY_RIGHT]; break; case EL_PACMAN_RIGHT: @@ -1088,8 +1094,8 @@ void InitMovDir(int x, int y) MovDir[x][y] = 1 << RND(4); if (element != EL_BUG && element != EL_SPACESHIP && - element != EL_BUTTERFLY && - element != EL_FIREFLY) + element != EL_BD_BUTTERFLY && + element != EL_BD_FIREFLY) break; for (i=0; i<4; i++) @@ -1099,12 +1105,12 @@ void InitMovDir(int x, int y) if (!IN_LEV_FIELD(x1, y1) || !IS_FREE(x1, y1)) { - if (element == EL_BUG || element == EL_BUTTERFLY) + if (element == EL_BUG || element == EL_BD_BUTTERFLY) { MovDir[x][y] = direction[0][i]; break; } - else if (element == EL_SPACESHIP || element == EL_FIREFLY || + else if (element == EL_SPACESHIP || element == EL_BD_FIREFLY || element == EL_SP_SNIKSNAK || element == EL_SP_ELECTRON) { MovDir[x][y] = direction[1][i]; @@ -1208,7 +1214,7 @@ void GameWon() #endif /* Hero disappears */ - DrawLevelField(ExitX, ExitY); + DrawNewLevelField(ExitX, ExitY); BackToFront(); if (tape.playing) @@ -1324,8 +1330,11 @@ void InitMovingField(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; + + GfxAction[x][y] = GFX_ACTION_MOVING; } void Moving2Blocked(int x, int y, int *goes_to_x, int *goes_to_y) @@ -1425,7 +1434,7 @@ void RemoveMovingField(int x, int y) if (Feld[x][y] == EL_BLOCKED && (Feld[oldx][oldy] == EL_QUICKSAND_EMPTYING || Feld[oldx][oldy] == EL_MAGIC_WALL_EMPTYING || - Feld[oldx][oldy] == EL_MAGIC_WALL_BD_EMPTYING || + Feld[oldx][oldy] == EL_BD_MAGIC_WALL_EMPTYING || Feld[oldx][oldy] == EL_AMOEBA_DRIPPING)) Feld[oldx][oldy] = get_next_element(Feld[oldx][oldy]); else @@ -1436,40 +1445,66 @@ void RemoveMovingField(int x, int y) Feld[newx][newy] = EL_EMPTY; MovPos[oldx][oldy] = MovDir[oldx][oldy] = MovDelay[oldx][oldy] = 0; MovPos[newx][newy] = MovDir[newx][newy] = MovDelay[newx][newy] = 0; + GfxAction[oldx][oldy] = GfxAction[newx][newy] = GFX_ACTION_DEFAULT; - DrawLevelField(oldx, oldy); - DrawLevelField(newx, newy); + DrawNewLevelField(oldx, oldy); + DrawNewLevelField(newx, newy); } void DrawDynamite(int x, int y) { int sx = SCREENX(x), sy = SCREENY(y); +#if 0 int graphic = el2gfx(Feld[x][y]); - int phase; +#else + int graphic = el2img(Feld[x][y]); +#endif + int frame; if (!IN_SCR_FIELD(sx, sy) || IS_PLAYER(x, y)) return; if (Store[x][y]) +#if 0 DrawGraphic(sx, sy, el2gfx(Store[x][y])); +#else + DrawNewGraphic(sx, sy, el2img(Store[x][y]), 0); +#endif +#if 0 if (Feld[x][y] == EL_DYNAMITE_ACTIVE) { - if ((phase = (96 - MovDelay[x][y]) / 12) > 6) - phase = 6; + if ((frame = (96 - MovDelay[x][y]) / 12) > 6) + frame = 6; } else { - if ((phase = ((96 - MovDelay[x][y]) / 6) % 8) > 3) - phase = 7 - phase; + if ((frame = ((96 - MovDelay[x][y]) / 6) % 8) > 3) + frame = 7 - frame; } +#else + frame = getNewGraphicAnimationFrame(graphic, 96 - MovDelay[x][y]); +#endif + + /* + printf("-> %d: %d [%d]\n", graphic, frame, MovDelay[x][y]); + */ +#if 0 if (game.emulation == EMU_SUPAPLEX) DrawGraphic(sx, sy, GFX_SP_DISK_RED); else if (Store[x][y]) - DrawGraphicThruMask(sx, sy, graphic + phase); + DrawGraphicThruMask(sx, sy, graphic + frame); + else + DrawGraphic(sx, sy, graphic + frame); +#else + if (game.emulation == EMU_SUPAPLEX) + DrawNewGraphic(sx, sy, IMG_SP_DISK_RED, 0); + else if (Store[x][y]) + DrawNewGraphicThruMask(sx, sy, graphic, frame); else - DrawGraphic(sx, sy, graphic + phase); + DrawNewGraphic(sx, sy, graphic, frame); +#endif } void CheckDynamite(int x, int y) @@ -1505,7 +1540,8 @@ void CheckDynamite(int x, int y) void Explode(int ex, int ey, int phase, int mode) { int x, y; - int num_phase = 9, delay = (game.emulation == EMU_SUPAPLEX ? 3 : 2); + int num_phase = 9; + int delay = (game.emulation == EMU_SUPAPLEX ? 3 : 2); int last_phase = num_phase * delay; int half_phase = (num_phase / 2) * delay; int first_phase_after_start = EX_PHASE_START + 1; @@ -1545,7 +1581,7 @@ void Explode(int ex, int ey, int phase, int mode) RemoveMovingField(x, y); } - if (IS_MASSIVE(element) || element == EL_BURNING) + if (IS_MASSIVE(element) || element == EL_FLAMES) continue; if (IS_PLAYER(x, y) && SHIELD_ON(PLAYERINFO(x, y))) @@ -1560,7 +1596,7 @@ void Explode(int ex, int ey, int phase, int mode) continue; } - if (element == EL_EXPLODING) + if (element == EL_EXPLOSION) element = Store2[x][y]; if (IS_PLAYER(ex, ey) && !PLAYER_PROTECTED(ex, ey)) @@ -1591,7 +1627,7 @@ void Explode(int ex, int ey, int phase, int mode) Store[x][y] = EL_EMERALD_PURPLE; else if (center_element == EL_BUG) Store[x][y] = ((x == ex && y == ey) ? EL_DIAMOND : EL_EMERALD); - else if (center_element == EL_BUTTERFLY) + else if (center_element == EL_BD_BUTTERFLY) Store[x][y] = EL_BD_DIAMOND; else if (center_element == EL_SP_ELECTRON) Store[x][y] = EL_SP_INFOTRON; @@ -1625,13 +1661,13 @@ void Explode(int ex, int ey, int phase, int mode) if (AmoebaNr[x][y] && (element == EL_AMOEBA_FULL || element == EL_BD_AMOEBA || - element == EL_AMOEBING)) + element == EL_AMOEBA_CREATING)) { AmoebaCnt[AmoebaNr[x][y]]--; AmoebaCnt2[AmoebaNr[x][y]]--; } - Feld[x][y] = EL_EXPLODING; + Feld[x][y] = EL_EXPLOSION; MovDir[x][y] = MovPos[x][y] = 0; AmoebaNr[x][y] = 0; Frame[x][y] = 1; @@ -1689,13 +1725,14 @@ void Explode(int ex, int ey, int phase, int mode) InitField(x, y, FALSE); if (CAN_MOVE(element) || COULD_MOVE(element)) InitMovDir(x, y); - DrawLevelField(x, y); + DrawNewLevelField(x, y); if (IS_PLAYER(x, y) && !PLAYERINFO(x,y)->present) StorePlayer[x][y] = 0; } else if (!(phase % delay) && IN_SCR_FIELD(SCREENX(x), SCREENY(y))) { +#if 0 int graphic = GFX_EXPLOSION; if (game.emulation == EMU_SUPAPLEX) @@ -1703,18 +1740,35 @@ void Explode(int ex, int ey, int phase, int mode) GFX_SP_EXPLODE_INFOTRON : GFX_SP_EXPLODE_EMPTY); - if (phase == delay) - ErdreichAnbroeckeln(SCREENX(x), SCREENY(y)); - graphic += (phase / delay - 1); +#else + int graphic = IMG_EXPLOSION; + int frame = (phase / delay - 1); + + if (game.emulation == EMU_SUPAPLEX) + graphic = (Store[x][y] == EL_SP_INFOTRON ? + IMG_SP_EXPLOSION_INFOTRON : + IMG_SP_EXPLOSION); +#endif + + if (phase == delay) + DrawCrumbledSand(SCREENX(x), SCREENY(y)); if (IS_PFORTE(Store[x][y])) { - DrawLevelElement(x, y, Store[x][y]); + DrawNewLevelElement(x, y, Store[x][y]); +#if 0 DrawGraphicThruMask(SCREENX(x), SCREENY(y), graphic); +#else + DrawNewGraphicThruMask(SCREENX(x), SCREENY(y), graphic, frame); +#endif } else +#if 0 DrawGraphic(SCREENX(x), SCREENY(y), graphic); +#else + DrawNewGraphic(SCREENX(x), SCREENY(y), graphic, frame); +#endif } } @@ -1734,7 +1788,7 @@ void DynaExplode(int ex, int ey) if (IS_ACTIVE_BOMB(Feld[ex][ey])) { - player = &stored_player[Feld[ex][ey] - EL_DYNABOMB_ACTIVE_1]; + player = &stored_player[Feld[ex][ey] - EL_DYNABOMB_PLAYER1_ACTIVE]; dynabomb_size = player->dynabomb_size; dynabomb_xl = player->dynabomb_xl; player->dynabombs_left++; @@ -1756,14 +1810,14 @@ void DynaExplode(int ex, int ey) element = Feld[x][y]; /* do not restart explosions of fields with active bombs */ - if (element == EL_EXPLODING && IS_ACTIVE_BOMB(Store2[x][y])) + if (element == EL_EXPLOSION && IS_ACTIVE_BOMB(Store2[x][y])) continue; Explode(x, y, EX_PHASE_START, EX_BORDER); if (element != EL_EMPTY && element != EL_SAND && - element != EL_EXPLODING && + element != EL_EXPLOSION && !dynabomb_xl) break; } @@ -1788,8 +1842,8 @@ void Bang(int x, int y) { case EL_BUG: case EL_SPACESHIP: - case EL_BUTTERFLY: - case EL_FIREFLY: + case EL_BD_BUTTERFLY: + case EL_BD_FIREFLY: case EL_YAMYAM: case EL_DARK_YAMYAM: case EL_ROBOT: @@ -1798,10 +1852,10 @@ void Bang(int x, int y) RaiseScoreElement(element); Explode(x, y, EX_PHASE_START, EX_NORMAL); break; - case EL_DYNABOMB_ACTIVE_1: - case EL_DYNABOMB_ACTIVE_2: - case EL_DYNABOMB_ACTIVE_3: - case EL_DYNABOMB_ACTIVE_4: + case EL_DYNABOMB_PLAYER1_ACTIVE: + case EL_DYNABOMB_PLAYER2_ACTIVE: + case EL_DYNABOMB_PLAYER3_ACTIVE: + case EL_DYNABOMB_PLAYER4_ACTIVE: case EL_DYNABOMB_NR: case EL_DYNABOMB_SZ: case EL_DYNABOMB_XL: @@ -1825,25 +1879,33 @@ void Blurb(int x, int y) { int element = Feld[x][y]; - if (element != EL_BLURB_LEFT && element != EL_BLURB_RIGHT) /* start */ + if (element != EL_ACID_SPLASH_LEFT && + element != EL_ACID_SPLASH_RIGHT) /* start */ { PlaySoundLevel(x, y, SND_ACID_SPLASHING); if (IN_LEV_FIELD(x-1, y) && IS_FREE(x-1, y) && (!IN_LEV_FIELD(x-1, y-1) || !CAN_FALL(MovingOrBlocked2Element(x-1, y-1)))) { - Feld[x-1][y] = EL_BLURB_LEFT; + Feld[x-1][y] = EL_ACID_SPLASH_LEFT; } if (IN_LEV_FIELD(x+1, y) && IS_FREE(x+1, y) && (!IN_LEV_FIELD(x+1, y-1) || !CAN_FALL(MovingOrBlocked2Element(x+1, y-1)))) { - Feld[x+1][y] = EL_BLURB_RIGHT; + Feld[x+1][y] = EL_ACID_SPLASH_RIGHT; } } else /* go on */ { - int graphic = (element==EL_BLURB_LEFT ? GFX_BLURB_LEFT : GFX_BLURB_RIGHT); +#if 0 + int graphic = + (element == EL_ACID_SPLASH_LEFT ? GFX_BLURB_LEFT : GFX_BLURB_RIGHT); +#else + int graphic = (element == EL_ACID_SPLASH_LEFT ? + IMG_ACID_SPLASH_LEFT : + IMG_ACID_SPLASH_RIGHT); +#endif if (!MovDelay[x][y]) /* initialize animation counter */ MovDelay[x][y] = 9; @@ -1852,12 +1914,20 @@ void Blurb(int x, int y) { MovDelay[x][y]--; if (MovDelay[x][y]/2 && IN_SCR_FIELD(SCREENX(x), SCREENY(y))) +#if 0 DrawGraphic(SCREENX(x), SCREENY(y), graphic+4-MovDelay[x][y]/2); +#else + { + int frame = getNewGraphicAnimationFrame(graphic, 8 - MovDelay[x][y]); + + DrawNewGraphic(SCREENX(x), SCREENY(y), graphic, frame); + } +#endif if (!MovDelay[x][y]) { Feld[x][y] = EL_EMPTY; - DrawLevelField(x, y); + DrawNewLevelField(x, y); } } } @@ -1866,6 +1936,20 @@ void Blurb(int x, int y) static void ToggleBeltSwitch(int x, int y) { static int belt_base_element[4] = + { + EL_CONVEYOR_BELT1_LEFT, + EL_CONVEYOR_BELT2_LEFT, + EL_CONVEYOR_BELT3_LEFT, + EL_CONVEYOR_BELT4_LEFT + }; + static int belt_base_active_element[4] = + { + EL_CONVEYOR_BELT1_LEFT_ACTIVE, + EL_CONVEYOR_BELT2_LEFT_ACTIVE, + EL_CONVEYOR_BELT3_LEFT_ACTIVE, + EL_CONVEYOR_BELT4_LEFT_ACTIVE + }; + static int belt_base_switch_element[4] = { EL_CONVEYOR_BELT1_SWITCH_LEFT, EL_CONVEYOR_BELT2_SWITCH_LEFT, @@ -1881,10 +1965,10 @@ static void ToggleBeltSwitch(int x, int y) }; int element = Feld[x][y]; - int belt_nr = getBeltNrFromSwitchElement(element); + int belt_nr = getBeltNrFromBeltSwitchElement(element); int belt_dir_nr = (game.belt_dir_nr[belt_nr] + 1) % 4; int belt_dir = belt_move_dir[belt_dir_nr]; - int xx, yy; + int xx, yy, i; if (!IS_BELT_SWITCH(element)) return; @@ -1895,6 +1979,18 @@ static void ToggleBeltSwitch(int x, int y) if (belt_dir_nr == 3) belt_dir_nr = 1; + /* set frame order for belt animation graphic according to belt direction */ + for (i=0; i<3; i++) + { + int element = belt_base_active_element[belt_nr] + i; + int graphic = el2img(element); + + if (belt_dir == MV_LEFT) + new_graphic_info[graphic].anim_mode &= ~ANIM_REVERSE; + else + new_graphic_info[graphic].anim_mode |= ANIM_REVERSE; + } + for (yy=0; yy 0) { Feld[x][y] = EL_LIGHT_SWITCH_ACTIVE; - DrawLevelField(x, y); + DrawNewLevelField(x, y); } else if (element == EL_LIGHT_SWITCH_ACTIVE && game.light_time_left == 0) { Feld[x][y] = EL_LIGHT_SWITCH; - DrawLevelField(x, y); + DrawNewLevelField(x, y); } + else if (element == EL_INVISIBLE_STEELWALL || + element == EL_INVISIBLE_WALL || + element == EL_INVISIBLE_SAND) + { + if (game.light_time_left > 0) + Feld[x][y] = getInvisibleActiveFromInvisibleElement(element); - if (element == EL_INVISIBLE_STEELWALL || - element == EL_INVISIBLE_WALL || - element == EL_SAND_INVISIBLE) - DrawLevelField(x, y); + DrawNewLevelField(x, y); + } + else if (element == EL_INVISIBLE_STEELWALL_ACTIVE || + element == EL_INVISIBLE_WALL_ACTIVE || + element == EL_INVISIBLE_SAND_ACTIVE) + { + if (game.light_time_left == 0) + Feld[x][y] = getInvisibleFromInvisibleActiveElement(element); + + DrawNewLevelField(x, y); + } } } } @@ -2018,9 +2158,9 @@ static void ActivateTimegateSwitch(int x, int y) } /* - else if (element == EL_TIMEGATE_SWITCH_ON) + else if (element == EL_TIMEGATE_SWITCH_ACTIVE) { - Feld[xx][yy] = EL_TIMEGATE_SWITCH_OFF; + Feld[xx][yy] = EL_TIMEGATE_SWITCH; DrawLevelField(xx, yy); } */ @@ -2028,7 +2168,7 @@ static void ActivateTimegateSwitch(int x, int y) } } - Feld[x][y] = EL_TIMEGATE_SWITCH_ON; + Feld[x][y] = EL_TIMEGATE_SWITCH_ACTIVE; } void Impact(int x, int y) @@ -2079,7 +2219,7 @@ void Impact(int x, int y) Bang(x, y+1); else { - Feld[x][y] = EL_AMOEBING; + Feld[x][y] = EL_AMOEBA_CREATING; Store[x][y] = EL_AMOEBA_WET; } return; @@ -2088,12 +2228,12 @@ void Impact(int x, int y) if (!lastline && object_hit) /* check which object was hit */ { if (CAN_CHANGE(element) && - (smashed == EL_MAGIC_WALL || smashed == EL_MAGIC_WALL_BD_OFF)) + (smashed == EL_MAGIC_WALL || smashed == EL_BD_MAGIC_WALL)) { int xx, yy; int activated_magic_wall = - (smashed == EL_MAGIC_WALL ? EL_MAGIC_WALL_EMPTY : - EL_MAGIC_WALL_BD_EMPTY); + (smashed == EL_MAGIC_WALL ? EL_MAGIC_WALL_ACTIVE : + EL_BD_MAGIC_WALL_ACTIVE); /* activate magic wall / mill */ for (yy=0; yy0 && IS_PLAYER(x-1, y)) || (x0 && IS_FREE(x-1, y)); boolean right_is_free = (xfriends_still_needed--; if (!local_player->friends_still_needed && @@ -2983,7 +3151,7 @@ void StartMoving(int x, int y) else if (IS_MAMPF3(Feld[newx][newy])) { if (DigField(local_player, newx, newy, 0, 0, DF_DIG) == MF_MOVING) - DrawLevelField(newx, newy); + DrawNewLevelField(newx, newy); else MovDir[x][y] = MV_NO_MOVING; } @@ -2992,7 +3160,7 @@ void StartMoving(int x, int y) if (IS_PLAYER(x, y)) DrawPlayerField(x, y); else - DrawLevelField(x, y); + DrawNewLevelField(x, y); return; } } @@ -3005,7 +3173,7 @@ void StartMoving(int x, int y) else { Feld[newx][newy] = EL_EMPTY; - DrawLevelField(newx, newy); + DrawNewLevelField(newx, newy); } PlaySoundLevel(x, y, SND_PIG_EATING); @@ -3015,7 +3183,7 @@ void StartMoving(int x, int y) if (IS_PLAYER(x, y)) DrawPlayerField(x, y); else - DrawLevelField(x, y); + DrawNewLevelField(x, y); return; } } @@ -3026,7 +3194,7 @@ void StartMoving(int x, int y) if (IS_PLAYER(x, y)) DrawPlayerField(x, y); else - DrawLevelField(x, y); + DrawNewLevelField(x, y); return; } else @@ -3042,21 +3210,21 @@ void StartMoving(int x, int y) if ((wanna_flame || IS_ENEMY(element1) || IS_ENEMY(element2)) && element1 != EL_DRAGON && element2 != EL_DRAGON && - element1 != EL_BURNING && element2 != EL_BURNING) + element1 != EL_FLAMES && element2 != EL_FLAMES) { if (IS_PLAYER(x, y)) DrawPlayerField(x, y); else - DrawLevelField(x, y); + DrawNewLevelField(x, y); PlaySoundLevel(x, y, SND_DRAGON_ATTACKING); MovDelay[x][y] = 50; - Feld[newx][newy] = EL_BURNING; + Feld[newx][newy] = EL_FLAMES; if (IN_LEV_FIELD(newx1, newy1) && Feld[newx1][newy1] == EL_EMPTY) - Feld[newx1][newy1] = EL_BURNING; + Feld[newx1][newy1] = EL_FLAMES; if (IN_LEV_FIELD(newx2, newy2) && Feld[newx2][newy2] == EL_EMPTY) - Feld[newx2][newy2] = EL_BURNING; + Feld[newx2][newy2] = EL_FLAMES; return; } } @@ -3069,7 +3237,7 @@ void StartMoving(int x, int y) else { Feld[newx][newy] = EL_EMPTY; - DrawLevelField(newx, newy); + DrawNewLevelField(newx, newy); } PlaySoundLevel(x, y, SND_YAMYAM_EATING); @@ -3090,7 +3258,7 @@ void StartMoving(int x, int y) else { Feld[newx][newy] = EL_EMPTY; - DrawLevelField(newx, newy); + DrawNewLevelField(newx, newy); } PlaySoundLevel(x, y, SND_DARK_YAMYAM_EATING); @@ -3108,7 +3276,7 @@ void StartMoving(int x, int y) if (element == EL_MOLE) { - Feld[newx][newy] = EL_DEAMOEBING; + Feld[newx][newy] = EL_AMOEBA_SHRINKING; PlaySoundLevel(x, y, SND_MOLE_EATING); MovDelay[newx][newy] = 0; /* start amoeba shrinking delay */ return; /* wait for shrinking amoeba */ @@ -3121,7 +3289,7 @@ void StartMoving(int x, int y) } } else if (element == EL_MOLE && IN_LEV_FIELD(newx, newy) && - (Feld[newx][newy] == EL_DEAMOEBING || + (Feld[newx][newy] == EL_AMOEBA_SHRINKING || (Feld[newx][newy] == EL_EMPTY && Stop[newx][newy]))) { /* wait for shrinking amoeba to completely disappear */ @@ -3142,26 +3310,26 @@ void StartMoving(int x, int y) #endif else if (element == EL_BUG || element == EL_SPACESHIP || element == EL_SP_SNIKSNAK || element == EL_MOLE) -#if 1 +#if 0 DrawLevelField(x, y); #else DrawNewLevelField(x, y); #endif - else if (element == EL_BUTTERFLY || element == EL_FIREFLY) + else if (element == EL_BD_BUTTERFLY || element == EL_BD_FIREFLY) #if 0 - DrawGraphicAnimation(x, y, el2gfx(element), 2, 4, ANIM_NORMAL); + DrawGraphicAnimation(x, y, el2gfx(element), 2, 4, ANIM_LOOP); #else DrawNewGraphicAnimation(x, y, el2img(element)); #endif else if (element == EL_SATELLITE) #if 0 - DrawGraphicAnimation(x, y, GFX_SONDE_START, 8, 2, ANIM_NORMAL); + DrawGraphicAnimation(x, y, GFX_SONDE_START, 8, 2, ANIM_LOOP); #else DrawNewGraphicAnimation(x, y, IMG_SATELLITE); #endif else if (element == EL_SP_ELECTRON) #if 0 - DrawGraphicAnimation(x, y, GFX2_SP_ELECTRON, 8, 2, ANIM_NORMAL); + DrawGraphicAnimation(x, y, GFX2_SP_ELECTRON, 8, 2, ANIM_LOOP); #else DrawNewGraphicAnimation(x, y, IMG_SP_ELECTRON); #endif @@ -3199,12 +3367,12 @@ void ContinueMoving(int x, int y) element == EL_QUICKSAND_EMPTYING) step /= 4; else if (element == EL_MAGIC_WALL_FILLING || - element == EL_MAGIC_WALL_BD_FILLING || + element == EL_BD_MAGIC_WALL_FILLING || element == EL_MAGIC_WALL_EMPTYING || - element == EL_MAGIC_WALL_BD_EMPTYING) + element == EL_BD_MAGIC_WALL_EMPTYING) step /= 2; else if (CAN_FALL(element) && horiz_move && - y < lev_fieldy-1 && IS_BELT(Feld[x][y+1])) + y < lev_fieldy-1 && IS_BELT_ACTIVE(Feld[x][y+1])) step /= 2; else if (element == EL_SPRING_MOVING) step*=2; @@ -3233,7 +3401,7 @@ void ContinueMoving(int x, int y) }; Feld[x][y] = EL_SAND; - DrawLevelField(x, y); + DrawNewLevelField(x, y); for(i=0; i<4; i++) { @@ -3243,7 +3411,7 @@ void ContinueMoving(int x, int y) yy = y + xy[i][1]; if (IN_LEV_FIELD(xx, yy) && Feld[xx][yy] == EL_SAND) - DrawLevelField(xx, yy); /* for "ErdreichAnbroeckeln()" */ + DrawNewLevelField(xx, yy); /* for "DrawCrumbledSand()" */ } } @@ -3271,18 +3439,18 @@ void ContinueMoving(int x, int y) Feld[x][y] = EL_MAGIC_WALL_DEAD; element = Feld[newx][newy] = Store[x][y]; } - else if (element == EL_MAGIC_WALL_BD_FILLING) + else if (element == EL_BD_MAGIC_WALL_FILLING) { element = Feld[newx][newy] = get_next_element(element); if (!game.magic_wall_active) - element = Feld[newx][newy] = EL_MAGIC_WALL_BD_DEAD; + element = Feld[newx][newy] = EL_BD_MAGIC_WALL_DEAD; Store[newx][newy] = Store[x][y]; } - else if (element == EL_MAGIC_WALL_BD_EMPTYING) + else if (element == EL_BD_MAGIC_WALL_EMPTYING) { Feld[x][y] = get_next_element(element); if (!game.magic_wall_active) - Feld[x][y] = EL_MAGIC_WALL_BD_DEAD; + Feld[x][y] = EL_BD_MAGIC_WALL_DEAD; element = Feld[newx][newy] = Store[x][y]; } else if (element == EL_AMOEBA_DRIPPING) @@ -3299,21 +3467,14 @@ void ContinueMoving(int x, int y) MovPos[x][y] = MovDir[x][y] = MovDelay[x][y] = 0; MovDelay[newx][newy] = 0; + GfxAction[newx][newy] = GfxAction[x][y]; /* keep action one frame */ + GfxAction[x][y] = GFX_ACTION_DEFAULT; + if (!CAN_MOVE(element)) MovDir[newx][newy] = 0; - if (element == EL_BUG || element == EL_SPACESHIP || - element == EL_SP_SNIKSNAK || element == EL_PACMAN || - element == EL_SP_ELECTRON) - { - DrawNewLevelField(x, y); - DrawNewLevelField(newx, newy); - } - else - { - DrawLevelField(x, y); - DrawLevelField(newx, newy); - } + DrawNewLevelField(x, y); + DrawNewLevelField(newx, newy); Stop[newx][newy] = TRUE; JustStopped[newx][newy] = 3; @@ -3333,12 +3494,10 @@ void ContinueMoving(int x, int y) } else /* still moving on */ { - if (element == EL_BUG || element == EL_SPACESHIP || - element == EL_SP_SNIKSNAK || element == EL_PACMAN || - element == EL_SP_ELECTRON) - DrawNewLevelField(x, y); - else - DrawLevelField(x, y); + if (GfxAction[x][y] == GFX_ACTION_DEFAULT) + GfxAction[x][y] = GFX_ACTION_MOVING; + + DrawNewLevelField(x, y); } } @@ -3504,12 +3663,12 @@ void AmoebeUmwandelnBD(int ax, int ay, int new_element) if (AmoebaNr[x][y] == group_nr && (Feld[x][y] == EL_AMOEBA_DEAD || Feld[x][y] == EL_BD_AMOEBA || - Feld[x][y] == EL_AMOEBING)) + Feld[x][y] == EL_AMOEBA_CREATING)) { AmoebaNr[x][y] = 0; Feld[x][y] = new_element; InitField(x, y, FALSE); - DrawLevelField(x, y); + DrawNewLevelField(x, y); done = TRUE; } } @@ -3544,13 +3703,22 @@ void AmoebeWaechst(int x, int y) { MovDelay[x][y]--; if (MovDelay[x][y]/2 && IN_SCR_FIELD(SCREENX(x), SCREENY(y))) +#if 0 DrawGraphic(SCREENX(x), SCREENY(y), GFX_AMOEBING + 3 - MovDelay[x][y]/2); +#else + { + int frame = getNewGraphicAnimationFrame(IMG_AMOEBA_CREATING, + 6 - MovDelay[x][y]); + + DrawNewGraphic(SCREENX(x), SCREENY(y), IMG_AMOEBA_CREATING, frame); + } +#endif if (!MovDelay[x][y]) { Feld[x][y] = Store[x][y]; Store[x][y] = 0; - DrawLevelField(x, y); + DrawNewLevelField(x, y); } } } @@ -3572,12 +3740,21 @@ void AmoebaDisappearing(int x, int y) { MovDelay[x][y]--; if (MovDelay[x][y]/2 && IN_SCR_FIELD(SCREENX(x), SCREENY(y))) +#if 0 DrawGraphic(SCREENX(x), SCREENY(y), GFX_AMOEBING + MovDelay[x][y]/2); +#else + { + int frame = getNewGraphicAnimationFrame(IMG_AMOEBA_SHRINKING, + 6 - MovDelay[x][y]); + + DrawNewGraphic(SCREENX(x), SCREENY(y), IMG_AMOEBA_SHRINKING, frame); + } +#endif if (!MovDelay[x][y]) { Feld[x][y] = EL_EMPTY; - DrawLevelField(x, y); + DrawNewLevelField(x, y); /* don't let mole enter this field in this cycle; (give priority to objects falling to this field from above) */ @@ -3602,7 +3779,7 @@ void AmoebeAbleger(int ax, int ay) if (!level.amoeba_speed) { Feld[ax][ay] = EL_AMOEBA_DEAD; - DrawLevelField(ax, ay); + DrawNewLevelField(ax, ay); return; } @@ -3665,7 +3842,7 @@ void AmoebeAbleger(int ax, int ay) if (i == 4 && (!waiting_for_player || game.emulation == EMU_BOULDERDASH)) { Feld[ax][ay] = EL_AMOEBA_DEAD; - DrawLevelField(ax, ay); + DrawNewLevelField(ax, ay); AmoebaCnt[AmoebaNr[ax][ay]]--; if (AmoebaCnt[AmoebaNr[ax][ay]] <= 0) /* amoeba is completely dead */ @@ -3711,24 +3888,24 @@ void AmoebeAbleger(int ax, int ay) if (element != EL_AMOEBA_WET || neway < ay || !IS_FREE(newax, neway) || (neway == lev_fieldy - 1 && newax != ax)) { - Feld[newax][neway] = EL_AMOEBING; /* simple growth of new amoeba tile */ + Feld[newax][neway] = EL_AMOEBA_CREATING; /* creation of new amoeba */ Store[newax][neway] = element; } else if (neway == ay) { - Feld[newax][neway] = EL_AMOEBA_DROP; /* drop left or right from amoeba */ + Feld[newax][neway] = EL_AMOEBA_DROP; /* drop left/right of amoeba */ PlaySoundLevel(newax, neway, SND_AMOEBA_DROP_CREATING); } else { - InitMovingField(ax, ay, MV_DOWN); /* drop dripping out of amoeba */ + InitMovingField(ax, ay, MV_DOWN); /* drop dripping from amoeba */ Feld[ax][ay] = EL_AMOEBA_DRIPPING; Store[ax][ay] = EL_AMOEBA_DROP; ContinueMoving(ax, ay); return; } - DrawLevelField(newax, neway); + DrawNewLevelField(newax, neway); } void Life(int ax, int ay) @@ -3780,7 +3957,7 @@ void Life(int ax, int ay) { Feld[xx][yy] = EL_EMPTY; if (!Stop[xx][yy]) - DrawLevelField(xx, yy); + DrawNewLevelField(xx, yy); Stop[xx][yy] = TRUE; changed = TRUE; } @@ -3792,7 +3969,7 @@ void Life(int ax, int ay) Feld[xx][yy] = element; MovDelay[xx][yy] = (element == EL_GAMEOFLIFE ? 0 : life_time-1); if (!Stop[xx][yy]) - DrawLevelField(xx, yy); + DrawNewLevelField(xx, yy); Stop[xx][yy] = TRUE; changed = TRUE; } @@ -3815,7 +3992,15 @@ void RobotWheel(int x, int y) if (MovDelay[x][y]) { if (IN_SCR_FIELD(SCREENX(x), SCREENY(y))) +#if 0 DrawGraphic(SCREENX(x), SCREENY(y), GFX_ABLENK+MovDelay[x][y]%4); +#else + { + int frame = getNewGraphicAnimationFrame(IMG_ROBOT_WHEEL_ACTIVE, -1); + + DrawNewGraphic(SCREENX(x), SCREENY(y), IMG_ROBOT_WHEEL_ACTIVE, frame); + } +#endif if (!(MovDelay[x][y]%4)) PlaySoundLevel(x, y, SND_ROBOT_WHEEL_ACTIVE); return; @@ -3823,7 +4008,7 @@ void RobotWheel(int x, int y) } Feld[x][y] = EL_ROBOT_WHEEL; - DrawLevelField(x, y); + DrawNewLevelField(x, y); if (ZX == x && ZY == y) ZX = ZY = -1; } @@ -3839,26 +4024,38 @@ void TimegateWheel(int x, int y) if (MovDelay[x][y]) { if (IN_SCR_FIELD(SCREENX(x), SCREENY(y))) +#if 0 DrawGraphic(SCREENX(x), SCREENY(y), GFX_TIMEGATE_SWITCH + MovDelay[x][y]%4); +#else + { + int frame = getNewGraphicAnimationFrame(IMG_TIMEGATE_SWITCH_ACTIVE, -1); + + DrawNewGraphic(SCREENX(x), SCREENY(y), IMG_TIMEGATE_SWITCH_ACTIVE, frame); + } +#endif if (!(MovDelay[x][y]%4)) - PlaySoundLevel(x, y, SND_TIMEGATE_WHEEL_ACTIVE); + PlaySoundLevel(x, y, SND_TIMEGATE_SWITCH_ACTIVE); return; } } - Feld[x][y] = EL_TIMEGATE_SWITCH_OFF; - DrawLevelField(x, y); + Feld[x][y] = EL_TIMEGATE_SWITCH; + DrawNewLevelField(x, y); if (ZX == x && ZY == y) ZX = ZY = -1; } void Blubber(int x, int y) { - if (y > 0 && IS_MOVING(x, y-1) && MovDir[x][y-1] == MV_DOWN) - DrawLevelField(x, y-1); +#if 0 + if (y > 0 && IS_MOVING(x, y - 1) && MovDir[x][y - 1] == MV_DOWN) + DrawNewLevelField(x, y - 1); else - DrawGraphicAnimation(x, y, GFX_GEBLUBBER, 4, 10, ANIM_NORMAL); + DrawGraphicAnimation(x, y, GFX_GEBLUBBER, 4, 10, ANIM_LOOP); +#else + DrawNewGraphicAnimation(x, y, IMG_ACID); +#endif } void NussKnacken(int x, int y) @@ -3870,13 +4067,22 @@ void NussKnacken(int x, int y) { MovDelay[x][y]--; if (MovDelay[x][y]/2 && IN_SCR_FIELD(SCREENX(x), SCREENY(y))) +#if 0 DrawGraphic(SCREENX(x), SCREENY(y), GFX_CRACKINGNUT + 3 - MovDelay[x][y]/2); +#else + { + int frame = getNewGraphicAnimationFrame(IMG_NUT_CRACKING, + 6 - MovDelay[x][y]); + + DrawNewGraphic(SCREENX(x), SCREENY(y), IMG_NUT_CRACKING, frame); + } +#endif if (!MovDelay[x][y]) { Feld[x][y] = EL_EMERALD; - DrawLevelField(x, y); + DrawNewLevelField(x, y); } } } @@ -3890,22 +4096,37 @@ void BreakingPearl(int x, int y) { MovDelay[x][y]--; if (MovDelay[x][y]/2 && IN_SCR_FIELD(SCREENX(x), SCREENY(y))) +#if 0 DrawGraphic(SCREENX(x), SCREENY(y), GFX_PEARL_BREAKING + 4 - MovDelay[x][y]/2); +#else + { + int frame = getNewGraphicAnimationFrame(IMG_PEARL_BREAKING, + 8 - MovDelay[x][y]); + + DrawNewGraphic(SCREENX(x), SCREENY(y), IMG_PEARL_BREAKING, frame); + } +#endif if (!MovDelay[x][y]) { Feld[x][y] = EL_EMPTY; - DrawLevelField(x, y); + DrawNewLevelField(x, y); } } } -void SiebAktivieren(int x, int y, int typ) +void SiebAktivieren(int x, int y, int type) { - int graphic = (typ == 1 ? GFX_MAGIC_WALL_FULL : GFX_MAGIC_WALL_BD_FULL) + 3; +#if 0 + int graphic = (type == 1 ? GFX_MAGIC_WALL_FULL : GFX_MAGIC_WALL_BD_FULL) + 3; DrawGraphicAnimation(x, y, graphic, 4, 4, ANIM_REVERSE); +#else + int graphic = (type == 1 ? IMG_MAGIC_WALL_FULL : IMG_BD_MAGIC_WALL_FULL); + + DrawNewGraphicAnimation(x, y, graphic); +#endif } void AusgangstuerPruefen(int x, int y) @@ -3915,7 +4136,7 @@ void AusgangstuerPruefen(int x, int y) local_player->lights_still_needed > 0) return; - Feld[x][y] = EL_AUSGANG_ACT; + Feld[x][y] = EL_EXIT_OPENING; PlaySoundLevel(x < LEVELX(BX1) ? LEVELX(BX1) : (x > LEVELX(BX2) ? LEVELX(BX2) : x), @@ -3943,7 +4164,7 @@ void AusgangstuerOeffnen(int x, int y) int delay = 6; if (!MovDelay[x][y]) /* next animation frame */ - MovDelay[x][y] = 5*delay; + MovDelay[x][y] = 5 * delay; if (MovDelay[x][y]) /* wait some time before next frame */ { @@ -3952,19 +4173,32 @@ void AusgangstuerOeffnen(int x, int y) MovDelay[x][y]--; tuer = MovDelay[x][y]/delay; if (!(MovDelay[x][y]%delay) && IN_SCR_FIELD(SCREENX(x), SCREENY(y))) +#if 0 DrawGraphic(SCREENX(x), SCREENY(y), GFX_AUSGANG_AUF-tuer); +#else + { + int frame = getNewGraphicAnimationFrame(IMG_EXIT_OPENING, + 29 - MovDelay[x][y]); + + DrawNewGraphic(SCREENX(x), SCREENY(y), IMG_EXIT_OPENING, frame); + } +#endif if (!MovDelay[x][y]) { Feld[x][y] = EL_EXIT_OPEN; - DrawLevelField(x, y); + DrawNewLevelField(x, y); } } } void AusgangstuerBlinken(int x, int y) { +#if 0 DrawGraphicAnimation(x, y, GFX_AUSGANG_AUF, 4, 4, ANIM_PINGPONG); +#else + DrawNewGraphicAnimation(x, y, IMG_EXIT_OPEN); +#endif } void OpenSwitchgate(int x, int y) @@ -3981,12 +4215,21 @@ void OpenSwitchgate(int x, int y) MovDelay[x][y]--; phase = MovDelay[x][y] / delay; if (!(MovDelay[x][y] % delay) && IN_SCR_FIELD(SCREENX(x), SCREENY(y))) +#if 0 DrawGraphic(SCREENX(x), SCREENY(y), GFX_SWITCHGATE_OPEN - phase); +#else + { + int frame = getNewGraphicAnimationFrame(IMG_SWITCHGATE_OPENING, + 29 - MovDelay[x][y]); + + DrawNewGraphic(SCREENX(x), SCREENY(y), IMG_SWITCHGATE_OPENING, frame); + } +#endif if (!MovDelay[x][y]) { Feld[x][y] = EL_SWITCHGATE_OPEN; - DrawLevelField(x, y); + DrawNewLevelField(x, y); } } } @@ -4005,12 +4248,21 @@ void CloseSwitchgate(int x, int y) MovDelay[x][y]--; phase = MovDelay[x][y] / delay; if (!(MovDelay[x][y] % delay) && IN_SCR_FIELD(SCREENX(x), SCREENY(y))) +#if 0 DrawGraphic(SCREENX(x), SCREENY(y), GFX_SWITCHGATE_CLOSED + phase); +#else + { + int frame = getNewGraphicAnimationFrame(IMG_SWITCHGATE_CLOSING, + 29 - MovDelay[x][y]); + + DrawNewGraphic(SCREENX(x), SCREENY(y), IMG_SWITCHGATE_CLOSING, frame); + } +#endif if (!MovDelay[x][y]) { Feld[x][y] = EL_SWITCHGATE_CLOSED; - DrawLevelField(x, y); + DrawNewLevelField(x, y); } } } @@ -4029,12 +4281,21 @@ void OpenTimegate(int x, int y) MovDelay[x][y]--; phase = MovDelay[x][y] / delay; if (!(MovDelay[x][y] % delay) && IN_SCR_FIELD(SCREENX(x), SCREENY(y))) +#if 0 DrawGraphic(SCREENX(x), SCREENY(y), GFX_TIMEGATE_OPEN - phase); +#else + { + int frame = getNewGraphicAnimationFrame(IMG_TIMEGATE_OPENING, + 29 - MovDelay[x][y]); + + DrawNewGraphic(SCREENX(x), SCREENY(y), IMG_TIMEGATE_OPENING, frame); + } +#endif if (!MovDelay[x][y]) { Feld[x][y] = EL_TIMEGATE_OPEN; - DrawLevelField(x, y); + DrawNewLevelField(x, y); } } } @@ -4053,12 +4314,21 @@ void CloseTimegate(int x, int y) MovDelay[x][y]--; phase = MovDelay[x][y] / delay; if (!(MovDelay[x][y] % delay) && IN_SCR_FIELD(SCREENX(x), SCREENY(y))) +#if 0 DrawGraphic(SCREENX(x), SCREENY(y), GFX_TIMEGATE_CLOSED + phase); +#else + { + int frame = getNewGraphicAnimationFrame(IMG_TIMEGATE_CLOSING, + 29 - MovDelay[x][y]); + + DrawNewGraphic(SCREENX(x), SCREENY(y), IMG_TIMEGATE_CLOSING, frame); + } +#endif if (!MovDelay[x][y]) { Feld[x][y] = EL_TIMEGATE_CLOSED; - DrawLevelField(x, y); + DrawNewLevelField(x, y); } } } @@ -4088,7 +4358,11 @@ void EdelsteinFunkeln(int x, int y) return; if (Feld[x][y] == EL_BD_DIAMOND) +#if 0 DrawGraphicAnimation(x, y, GFX_EDELSTEIN_BD, 4, 4, ANIM_REVERSE); +#else + DrawNewGraphicAnimation(x, y, IMG_BD_DIAMOND); +#endif else { if (!MovDelay[x][y]) /* next animation frame */ @@ -4101,7 +4375,11 @@ void EdelsteinFunkeln(int x, int y) if (setup.direct_draw && MovDelay[x][y]) SetDrawtoField(DRAW_BUFFERED); +#if 0 DrawGraphic(SCREENX(x), SCREENY(y), el2gfx(Feld[x][y])); +#else + DrawNewGraphic(SCREENX(x), SCREENY(y), el2img(Feld[x][y]), 0); +#endif if (MovDelay[x][y]) { @@ -4110,14 +4388,24 @@ void EdelsteinFunkeln(int x, int y) if (phase > 2) phase = 4-phase; +#if 0 DrawGraphicThruMask(SCREENX(x), SCREENY(y), GFX_FUNKELN_WEISS + phase); +#else + { + int frame = getNewGraphicAnimationFrame(IMG_TWINKLE_WHITE, + 10 - MovDelay[x][y]); + + DrawNewGraphicThruMask(SCREENX(x), SCREENY(y), IMG_TWINKLE_WHITE, + frame); + } +#endif if (setup.direct_draw) { int dest_x, dest_y; - dest_x = FX + SCREENX(x)*TILEX; - dest_y = FY + SCREENY(y)*TILEY; + dest_x = FX + SCREENX(x) * TILEX; + dest_y = FY + SCREENY(y) * TILEY; BlitBitmap(drawto_field, window, dest_x, dest_y, TILEX, TILEY, dest_x, dest_y); @@ -4133,48 +4421,58 @@ void MauerWaechst(int x, int y) int delay = 6; if (!MovDelay[x][y]) /* next animation frame */ - MovDelay[x][y] = 3*delay; + MovDelay[x][y] = 3 * delay; if (MovDelay[x][y]) /* wait some time before next frame */ { int phase; MovDelay[x][y]--; - phase = 2-MovDelay[x][y]/delay; + phase = 2 - MovDelay[x][y] / delay; +#if 0 if (!(MovDelay[x][y]%delay) && IN_SCR_FIELD(SCREENX(x), SCREENY(y))) DrawGraphic(SCREENX(x), SCREENY(y), (MovDir[x][y] == MV_LEFT ? GFX_MAUER_LEFT : MovDir[x][y] == MV_RIGHT ? GFX_MAUER_RIGHT : MovDir[x][y] == MV_UP ? GFX_MAUER_UP : GFX_MAUER_DOWN ) + phase); +#else + if (IN_SCR_FIELD(SCREENX(x), SCREENY(y))) + { + int graphic = el_dir2img(Feld[x][y], MovDir[x][y]); + int frame = getNewGraphicAnimationFrame(graphic, 17 - MovDelay[x][y]); + + DrawNewGraphic(SCREENX(x), SCREENY(y), graphic, frame); + } +#endif if (!MovDelay[x][y]) { if (MovDir[x][y] == MV_LEFT) { - if (IN_LEV_FIELD(x-1, y) && IS_MAUER(Feld[x-1][y])) - DrawLevelField(x-1, y); + if (IN_LEV_FIELD(x - 1, y) && IS_MAUER(Feld[x - 1][y])) + DrawNewLevelField(x - 1, y); } else if (MovDir[x][y] == MV_RIGHT) { - if (IN_LEV_FIELD(x+1, y) && IS_MAUER(Feld[x+1][y])) - DrawLevelField(x+1, y); + if (IN_LEV_FIELD(x + 1, y) && IS_MAUER(Feld[x + 1][y])) + DrawNewLevelField(x + 1, y); } else if (MovDir[x][y] == MV_UP) { - if (IN_LEV_FIELD(x, y-1) && IS_MAUER(Feld[x][y-1])) - DrawLevelField(x, y-1); + if (IN_LEV_FIELD(x, y - 1) && IS_MAUER(Feld[x][y - 1])) + DrawNewLevelField(x, y - 1); } else { - if (IN_LEV_FIELD(x, y+1) && IS_MAUER(Feld[x][y+1])) - DrawLevelField(x, y+1); + if (IN_LEV_FIELD(x, y + 1) && IS_MAUER(Feld[x][y + 1])) + DrawNewLevelField(x, y + 1); } Feld[x][y] = Store[x][y]; Store[x][y] = 0; MovDir[x][y] = MV_NO_MOVING; - DrawLevelField(x, y); + DrawNewLevelField(x, y); } } } @@ -4211,20 +4509,30 @@ void MauerAbleger(int ax, int ay) { if (oben_frei) { - Feld[ax][ay-1] = EL_MAUERND; + Feld[ax][ay-1] = EL_WALL_GROWING_ACTIVE; Store[ax][ay-1] = element; MovDir[ax][ay-1] = MV_UP; if (IN_SCR_FIELD(SCREENX(ax), SCREENY(ay-1))) +#if 0 DrawGraphic(SCREENX(ax), SCREENY(ay-1), GFX_MAUER_UP); +#else + DrawNewGraphic(SCREENX(ax), SCREENY(ay - 1), + IMG_WALL_GROWING_ACTIVE_UP, 0); +#endif new_wall = TRUE; } if (unten_frei) { - Feld[ax][ay+1] = EL_MAUERND; + Feld[ax][ay+1] = EL_WALL_GROWING_ACTIVE; Store[ax][ay+1] = element; MovDir[ax][ay+1] = MV_DOWN; if (IN_SCR_FIELD(SCREENX(ax), SCREENY(ay+1))) +#if 0 DrawGraphic(SCREENX(ax), SCREENY(ay+1), GFX_MAUER_DOWN); +#else + DrawNewGraphic(SCREENX(ax), SCREENY(ay + 1), + IMG_WALL_GROWING_ACTIVE_DOWN, 0); +#endif new_wall = TRUE; } } @@ -4234,27 +4542,37 @@ void MauerAbleger(int ax, int ay) { if (links_frei) { - Feld[ax-1][ay] = EL_MAUERND; + Feld[ax-1][ay] = EL_WALL_GROWING_ACTIVE; Store[ax-1][ay] = element; MovDir[ax-1][ay] = MV_LEFT; if (IN_SCR_FIELD(SCREENX(ax-1), SCREENY(ay))) +#if 0 DrawGraphic(SCREENX(ax-1), SCREENY(ay), GFX_MAUER_LEFT); +#else + DrawNewGraphic(SCREENX(ax - 1), SCREENY(ay), + IMG_WALL_GROWING_ACTIVE_LEFT, 0); +#endif new_wall = TRUE; } if (rechts_frei) { - Feld[ax+1][ay] = EL_MAUERND; + Feld[ax+1][ay] = EL_WALL_GROWING_ACTIVE; Store[ax+1][ay] = element; MovDir[ax+1][ay] = MV_RIGHT; if (IN_SCR_FIELD(SCREENX(ax+1), SCREENY(ay))) +#if 0 DrawGraphic(SCREENX(ax+1), SCREENY(ay), GFX_MAUER_RIGHT); +#else + DrawNewGraphic(SCREENX(ax + 1), SCREENY(ay), + IMG_WALL_GROWING_ACTIVE_RIGHT, 0); +#endif new_wall = TRUE; } } if (element == EL_WALL_GROWING && (links_frei || rechts_frei)) - DrawLevelField(ax, ay); + DrawNewLevelField(ax, ay); if (!IN_LEV_FIELD(ax, ay-1) || IS_MAUER(Feld[ax][ay-1])) oben_massiv = TRUE; @@ -4294,7 +4612,7 @@ void CheckForDragon(int x, int y) int xx = x + j*xy[i][0], yy = y + j*xy[i][1]; if (IN_LEV_FIELD(xx, yy) && - (Feld[xx][yy] == EL_BURNING || Feld[xx][yy] == EL_DRAGON)) + (Feld[xx][yy] == EL_FLAMES || Feld[xx][yy] == EL_DRAGON)) { if (Feld[xx][yy] == EL_DRAGON) dragon_found = TRUE; @@ -4312,10 +4630,10 @@ void CheckForDragon(int x, int y) { int xx = x + j*xy[i][0], yy = y + j*xy[i][1]; - if (IN_LEV_FIELD(xx, yy) && Feld[xx][yy] == EL_BURNING) + if (IN_LEV_FIELD(xx, yy) && Feld[xx][yy] == EL_FLAMES) { Feld[xx][yy] = EL_EMPTY; - DrawLevelField(xx, yy); + DrawNewLevelField(xx, yy); } else break; @@ -4328,7 +4646,7 @@ static void CheckBuggyBase(int x, int y) { int element = Feld[x][y]; - if (element == EL_SP_BUG) + if (element == EL_SP_BUGGY_BASE) { if (!MovDelay[x][y]) /* wait some time before activating base */ MovDelay[x][y] = 2 * FRAMES_PER_SECOND + RND(5 * FRAMES_PER_SECOND); @@ -4337,14 +4655,18 @@ static void CheckBuggyBase(int x, int y) { MovDelay[x][y]--; if (MovDelay[x][y] < 5 && IN_SCR_FIELD(SCREENX(x), SCREENY(y))) +#if 0 DrawGraphic(SCREENX(x), SCREENY(y), GFX_SP_BUG_WARNING); +#else + DrawNewGraphic(SCREENX(x), SCREENY(y), IMG_SP_BUGGY_BASE, 0); +#endif if (MovDelay[x][y]) return; - Feld[x][y] = EL_SP_BUG_ACTIVE; + Feld[x][y] = EL_SP_BUGGY_BASE_ACTIVE; } } - else if (element == EL_SP_BUG_ACTIVE) + else if (element == EL_SP_BUGGY_BASE_ACTIVE) { if (!MovDelay[x][y]) /* start activating buggy base */ MovDelay[x][y] = 1 * FRAMES_PER_SECOND + RND(1 * FRAMES_PER_SECOND); @@ -4364,7 +4686,16 @@ static void CheckBuggyBase(int x, int y) }; if (IN_SCR_FIELD(SCREENX(x), SCREENY(y))) +#if 0 DrawGraphic(SCREENX(x),SCREENY(y), GFX_SP_BUG_ACTIVE + SimpleRND(4)); +#else + { + int graphic = IMG_SP_BUGGY_BASE_ACTIVE; + int frame = getNewGraphicAnimationFrame(graphic, SimpleRND(100)); + + DrawNewGraphic(SCREENX(x), SCREENY(y), graphic, frame); + } +#endif for (i=0; i<4; i++) { @@ -4372,7 +4703,7 @@ static void CheckBuggyBase(int x, int y) if (IS_PLAYER(xx, yy)) { - PlaySoundLevel(x, y, SND_SP_BUGGY_BASE_ACTIVATING); + PlaySoundLevel(x, y, SND_SP_BUGGY_BASE_ACTIVE); break; } } @@ -4380,8 +4711,8 @@ static void CheckBuggyBase(int x, int y) return; } - Feld[x][y] = EL_SP_BUG; - DrawLevelField(x, y); + Feld[x][y] = EL_SP_BUGGY_BASE; + DrawNewLevelField(x, y); } } } @@ -4390,7 +4721,7 @@ static void CheckTrap(int x, int y) { int element = Feld[x][y]; - if (element == EL_TRAP_INACTIVE) + if (element == EL_TRAP) { if (!MovDelay[x][y]) /* wait some time before activating trap */ MovDelay[x][y] = 2 * FRAMES_PER_SECOND + RND(5 * FRAMES_PER_SECOND); @@ -4428,32 +4759,46 @@ static void CheckTrap(int x, int y) if (IN_SCR_FIELD(SCREENX(x), SCREENY(y))) { +#if 0 DrawGraphic(SCREENX(x),SCREENY(y), GFX_TRAP_INACTIVE + phase - 1); - ErdreichAnbroeckeln(SCREENX(x), SCREENY(y)); +#else + int graphic = IMG_TRAP_ACTIVE; + int frame = getNewGraphicAnimationFrame(graphic, + 31 - MovDelay[x][y]); + + DrawNewGraphic(SCREENX(x),SCREENY(y), graphic, frame); +#endif + DrawCrumbledSand(SCREENX(x), SCREENY(y)); } } return; } - Feld[x][y] = EL_TRAP_INACTIVE; - DrawLevelField(x, y); + Feld[x][y] = EL_TRAP; + DrawNewLevelField(x, y); } } } static void DrawBeltAnimation(int x, int y, int element) { - int belt_nr = getBeltNrFromElement(element); + int belt_nr = getBeltNrFromBeltActiveElement(element); int belt_dir = game.belt_dir[belt_nr]; if (belt_dir != MV_NO_MOVING) { +#if 0 int delay = 2; - int mode = (belt_dir == MV_LEFT ? ANIM_NORMAL : ANIM_REVERSE); + int mode = ANIM_LOOP | (belt_dir == MV_LEFT ? 0 : ANIM_REVERSE); int graphic = el2gfx(element) + (belt_dir == MV_LEFT ? 0 : 7); DrawGraphicAnimation(x, y, graphic, 8, delay, mode); +#else + int graphic = el2img(element); + + DrawNewGraphicAnimation(x, y, graphic); +#endif if (!(FrameCounter % 2)) PlaySoundLevel(x, y, SND_CONVEYOR_BELT_ACTIVE); @@ -4756,12 +5101,12 @@ void GameActions() else if (IS_ACTIVE_BOMB(element)) CheckDynamite(x, y); #if 0 - else if (element == EL_EXPLODING && !game.explosions_delayed) + else if (element == EL_EXPLOSION && !game.explosions_delayed) Explode(x, y, Frame[x][y], EX_NORMAL); #endif - else if (element == EL_AMOEBING) + else if (element == EL_AMOEBA_CREATING) AmoebeWaechst(x, y); - else if (element == EL_DEAMOEBING) + else if (element == EL_AMOEBA_SHRINKING) AmoebaDisappearing(x, y); #if !USE_NEW_AMOEBA_CODE @@ -4773,13 +5118,14 @@ void GameActions() Life(x, y); else if (element == EL_ROBOT_WHEEL_ACTIVE) RobotWheel(x, y); - else if (element == EL_TIMEGATE_SWITCH_ON) + else if (element == EL_TIMEGATE_SWITCH_ACTIVE) TimegateWheel(x, y); else if (element == EL_ACID) Blubber(x, y); - else if (element == EL_BLURB_LEFT || element == EL_BLURB_RIGHT) + else if (element == EL_ACID_SPLASH_LEFT || + element == EL_ACID_SPLASH_RIGHT) Blurb(x, y); - else if (element == EL_CRACKINGNUT) + else if (element == EL_NUT_CRACKING) NussKnacken(x, y); else if (element == EL_PEARL_BREAKING) BreakingPearl(x, y); @@ -4787,36 +5133,45 @@ void GameActions() AusgangstuerPruefen(x, y); else if (element == EL_SP_EXIT_CLOSED) AusgangstuerPruefen_SP(x, y); - else if (element == EL_AUSGANG_ACT) + else if (element == EL_EXIT_OPENING) AusgangstuerOeffnen(x, y); else if (element == EL_EXIT_OPEN) AusgangstuerBlinken(x, y); else if (element == EL_SP_EXIT_OPEN) ; /* !!! ADD SOME (OPTIONAL) ANIMATIONS HERE !!! */ - else if (element == EL_MAUERND) + else if (element == EL_WALL_GROWING_ACTIVE) MauerWaechst(x, y); else if (element == EL_WALL_GROWING || element == EL_WALL_GROWING_X || element == EL_WALL_GROWING_Y || element == EL_WALL_GROWING_XY) MauerAbleger(x, y); - else if (element == EL_BURNING) + else if (element == EL_FLAMES) CheckForDragon(x, y); - else if (element == EL_SP_BUG || element == EL_SP_BUG_ACTIVE) + else if (element == EL_SP_BUGGY_BASE || element == EL_SP_BUGGY_BASE_ACTIVE) CheckBuggyBase(x, y); - else if (element == EL_TRAP_INACTIVE || element == EL_TRAP_ACTIVE) + else if (element == EL_TRAP || element == EL_TRAP_ACTIVE) CheckTrap(x, y); else if (element == EL_SP_TERMINAL) - DrawGraphicAnimation(x, y, GFX2_SP_TERMINAL, 7, 12, ANIM_NORMAL); +#if 0 + DrawGraphicAnimation(x, y, GFX2_SP_TERMINAL, 7, 12, ANIM_LOOP); +#else + DrawNewGraphicAnimation(x, y, IMG_SP_TERMINAL); +#endif else if (element == EL_SP_TERMINAL_ACTIVE) { - DrawGraphicAnimation(x, y, GFX2_SP_TERMINAL_ACTIVE, 7, 4, ANIM_NORMAL); +#if 0 + DrawGraphicAnimation(x, y, GFX2_SP_TERMINAL_ACTIVE, 7, 4, ANIM_LOOP); +#else + DrawNewGraphicAnimation(x, y, IMG_SP_TERMINAL_ACTIVE); +#endif + #if 0 if (!(FrameCounter % 4)) PlaySoundLevel(x, y, SND_SP_TERMINAL_ACTIVE); #endif } - else if (IS_BELT(element)) + else if (IS_BELT_ACTIVE(element)) DrawBeltAnimation(x, y, element); else if (element == EL_SWITCHGATE_OPENING) OpenSwitchgate(x, y); @@ -4827,18 +5182,32 @@ void GameActions() else if (element == EL_TIMEGATE_CLOSING) CloseTimegate(x, y); else if (element == EL_EXTRA_TIME) - DrawGraphicAnimation(x, y, GFX_EXTRA_TIME, 6, 4, ANIM_NORMAL); +#if 0 + DrawGraphicAnimation(x, y, GFX_EXTRA_TIME, 6, 4, ANIM_LOOP); +#else + DrawNewGraphicAnimation(x, y, IMG_EXTRA_TIME); +#endif else if (element == EL_SHIELD_NORMAL) { - DrawGraphicAnimation(x, y, GFX_SHIELD_PASSIVE, 6, 4, ANIM_NORMAL); +#if 0 + DrawGraphicAnimation(x, y, GFX_SHIELD_PASSIVE, 6, 4, ANIM_LOOP); +#else + DrawNewGraphicAnimation(x, y, IMG_SHIELD_NORMAL); +#endif + #if 0 if (!(FrameCounter % 4)) PlaySoundLevel(x, y, SND_SHIELD_PASSIVE_ACTIVATED); #endif } - else if (element == EL_SHIELD_ACTIVE) + else if (element == EL_SHIELD_DEADLY) { - DrawGraphicAnimation(x, y, GFX_SHIELD_ACTIVE, 6, 4, ANIM_NORMAL); +#if 0 + DrawGraphicAnimation(x, y, GFX_SHIELD_ACTIVE, 6, 4, ANIM_LOOP); +#else + DrawNewGraphicAnimation(x, y, IMG_SHIELD_DEADLY); +#endif + #if 0 if (!(FrameCounter % 4)) PlaySoundLevel(x, y, SND_SHIELD_DEADLY_ACTIVE); @@ -4851,15 +5220,15 @@ void GameActions() int jx = local_player->jx, jy = local_player->jy; if (element == EL_MAGIC_WALL_FULL || - element == EL_MAGIC_WALL_EMPTY || + element == EL_MAGIC_WALL_ACTIVE || element == EL_MAGIC_WALL_EMPTYING) { SiebAktivieren(x, y, 1); sieb = TRUE; } - else if (element == EL_MAGIC_WALL_BD_FULL || - element == EL_MAGIC_WALL_BD_EMPTY || - element == EL_MAGIC_WALL_BD_EMPTYING) + else if (element == EL_BD_MAGIC_WALL_FULL || + element == EL_BD_MAGIC_WALL_ACTIVE || + element == EL_BD_MAGIC_WALL_EMPTYING) { SiebAktivieren(x, y, 2); sieb = TRUE; @@ -4897,8 +5266,8 @@ void GameActions() (element == EL_EMPTY || element == EL_SAND || element == EL_QUICKSAND_EMPTY || - element == EL_BLURB_LEFT || - element == EL_BLURB_RIGHT)) + element == EL_ACID_SPLASH_LEFT || + element == EL_ACID_SPLASH_RIGHT)) { if ((IN_LEV_FIELD(x, y-1) && Feld[x][y-1] == EL_AMOEBA_WET) || (IN_LEV_FIELD(x-1, y) && Feld[x-1][y] == EL_AMOEBA_WET) || @@ -4924,7 +5293,7 @@ void GameActions() if (ExplodeField[x][y]) Explode(x, y, EX_PHASE_START, ExplodeField[x][y]); - else if (element == EL_EXPLODING) + else if (element == EL_EXPLOSION) Explode(x, y, Frame[x][y], EX_NORMAL); ExplodeField[x][y] = EX_NO_EXPLOSION; @@ -4939,9 +5308,9 @@ void GameActions() { int element = Feld[sieb_x][sieb_y]; - if (element == EL_MAGIC_WALL_BD_FULL || - element == EL_MAGIC_WALL_BD_EMPTY || - element == EL_MAGIC_WALL_BD_EMPTYING) + if (element == EL_BD_MAGIC_WALL_FULL || + element == EL_BD_MAGIC_WALL_ACTIVE || + element == EL_BD_MAGIC_WALL_EMPTYING) PlaySoundLevel(sieb_x, sieb_y, SND_BD_MAGIC_WALL_ACTIVE); else PlaySoundLevel(sieb_x, sieb_y, SND_MAGIC_WALL_ACTIVE); @@ -4956,17 +5325,17 @@ void GameActions() { element = Feld[x][y]; - if (element == EL_MAGIC_WALL_EMPTY || + if (element == EL_MAGIC_WALL_ACTIVE || element == EL_MAGIC_WALL_FULL) { Feld[x][y] = EL_MAGIC_WALL_DEAD; - DrawLevelField(x, y); + DrawNewLevelField(x, y); } - else if (element == EL_MAGIC_WALL_BD_EMPTY || - element == EL_MAGIC_WALL_BD_FULL) + else if (element == EL_BD_MAGIC_WALL_ACTIVE || + element == EL_BD_MAGIC_WALL_FULL) { - Feld[x][y] = EL_MAGIC_WALL_BD_DEAD; - DrawLevelField(x, y); + Feld[x][y] = EL_BD_MAGIC_WALL_DEAD; + DrawNewLevelField(x, y); } } @@ -4980,22 +5349,7 @@ void GameActions() game.light_time_left--; if (game.light_time_left == 0) - { - for (y=0; y 0) @@ -5012,9 +5366,9 @@ void GameActions() if (SHIELD_ON(player)) { - if (player->shield_active_time_left) + if (player->shield_deadly_time_left) PlaySoundLevel(player->jx, player->jy, SND_SHIELD_DEADLY_ACTIVE); - else if (player->shield_passive_time_left) + else if (player->shield_normal_time_left) PlaySoundLevel(player->jx, player->jy, SND_SHIELD_NORMAL_ACTIVE); } } @@ -5030,10 +5384,10 @@ void GameActions() if (SHIELD_ON(player)) { - player->shield_passive_time_left--; + player->shield_normal_time_left--; - if (player->shield_active_time_left > 0) - player->shield_active_time_left--; + if (player->shield_deadly_time_left > 0) + player->shield_deadly_time_left--; } } @@ -5135,13 +5489,14 @@ void ScrollLevel(int dx, int dy) { x = (dx == 1 ? BX1 : BX2); for (y=BY1; y<=BY2; y++) - DrawScreenField(x, y); + DrawNewScreenField(x, y); } + if (dy) { y = (dy == 1 ? BY1 : BY2); for (x=BX1; x<=BX2; x++) - DrawScreenField(x, y); + DrawNewScreenField(x, y); } redraw_mask |= REDRAW_FIELD; @@ -5208,7 +5563,7 @@ boolean MoveFigureOneStep(struct PlayerInfo *player, if (element == EL_ACID && dx == 0 && dy == 1) { Blurb(jx, jy); - Feld[jx][jy] = EL_PLAYER; + Feld[jx][jy] = EL_PLAYER1; InitMovingField(jx, jy, MV_DOWN); Store[jx][jy] = EL_ACID; ContinueMoving(jx, jy); @@ -5382,7 +5737,7 @@ boolean MoveFigure(struct PlayerInfo *player, int dx, int dy) else if (old_jx == jx && old_jy != jy) player->MovDir = (old_jy < jy ? MV_DOWN : MV_UP); - DrawLevelField(jx, jy); /* for "ErdreichAnbroeckeln()" */ + DrawNewLevelField(jx, jy); /* for "DrawCrumbledSand()" */ player->last_move_dir = player->MovDir; player->is_moving = TRUE; @@ -5552,7 +5907,7 @@ void TestIfGoodThingHitsBadThing(int good_x, int good_y, int good_move_dir) { struct PlayerInfo *player = PLAYERINFO(good_x, good_y); - if (player->shield_active_time_left > 0) + if (player->shield_deadly_time_left > 0) Bang(kill_x, kill_y); else if (!PLAYER_PROTECTED(good_x, good_y)) KillHero(player); @@ -5581,7 +5936,7 @@ void TestIfBadThingHitsGoodThing(int bad_x, int bad_y, int bad_move_dir) MV_DOWN }; - if (bad_element == EL_EXPLODING) /* skip just exploding bad things */ + if (bad_element == EL_EXPLOSION) /* skip just exploding bad things */ return; for (i=0; i<4; i++) @@ -5649,7 +6004,7 @@ void TestIfBadThingHitsGoodThing(int bad_x, int bad_y, int bad_move_dir) ; #endif - if (player->shield_active_time_left > 0) + if (player->shield_deadly_time_left > 0) Bang(bad_x, bad_y); else if (!PLAYER_PROTECTED(kill_x, kill_y)) KillHero(player); @@ -5711,7 +6066,7 @@ void TestIfBadThingTouchesOtherBadThing(int bad_x, int bad_y) element = Feld[x][y]; if (IS_AMOEBOID(element) || element == EL_GAMEOFLIFE || - element == EL_AMOEBING || element == EL_AMOEBA_DROP) + element == EL_AMOEBA_CREATING || element == EL_AMOEBA_DROP) { kill_x = x; kill_y = y; @@ -5734,8 +6089,8 @@ void KillHero(struct PlayerInfo *player) Feld[jx][jy] = EL_EMPTY; /* deactivate shield (else Bang()/Explode() would not work right) */ - player->shield_passive_time_left = 0; - player->shield_active_time_left = 0; + player->shield_normal_time_left = 0; + player->shield_deadly_time_left = 0; Bang(jx, jy); BuryHero(player); @@ -5812,18 +6167,18 @@ int DigField(struct PlayerInfo *player, int i = 0; int tube_leave_directions[][2] = { - { EL_TUBE_CROSS, MV_LEFT | MV_RIGHT | MV_UP | MV_DOWN }, - { EL_TUBE_VERTICAL, MV_UP | MV_DOWN }, - { EL_TUBE_HORIZONTAL, MV_LEFT | MV_RIGHT }, - { EL_TUBE_VERT_LEFT, MV_LEFT | MV_UP | MV_DOWN }, - { EL_TUBE_VERT_RIGHT, MV_RIGHT | MV_UP | MV_DOWN }, - { EL_TUBE_HORIZ_UP, MV_LEFT | MV_RIGHT | MV_UP }, - { EL_TUBE_HORIZ_DOWN, MV_LEFT | MV_RIGHT | MV_DOWN }, - { EL_TUBE_LEFT_UP, MV_LEFT | MV_UP }, - { EL_TUBE_LEFT_DOWN, MV_LEFT | MV_DOWN }, - { EL_TUBE_RIGHT_UP, MV_RIGHT | MV_UP }, - { EL_TUBE_RIGHT_DOWN, MV_RIGHT | MV_DOWN }, - { -1, MV_LEFT | MV_RIGHT | MV_UP | MV_DOWN } + { EL_TUBE_ALL, MV_LEFT | MV_RIGHT | MV_UP | MV_DOWN }, + { EL_TUBE_VERTICAL, MV_UP | MV_DOWN }, + { EL_TUBE_HORIZONTAL, MV_LEFT | MV_RIGHT }, + { EL_TUBE_VERTICAL_LEFT, MV_LEFT | MV_UP | MV_DOWN }, + { EL_TUBE_VERTICAL_RIGHT, MV_RIGHT | MV_UP | MV_DOWN }, + { EL_TUBE_HORIZONTAL_UP, MV_LEFT | MV_RIGHT | MV_UP }, + { EL_TUBE_HORIZONTAL_DOWN, MV_LEFT | MV_RIGHT | MV_DOWN }, + { EL_TUBE_LEFT_UP, MV_LEFT | MV_UP }, + { EL_TUBE_LEFT_DOWN, MV_LEFT | MV_DOWN }, + { EL_TUBE_RIGHT_UP, MV_RIGHT | MV_UP }, + { EL_TUBE_RIGHT_DOWN, MV_RIGHT | MV_DOWN }, + { -1, MV_LEFT | MV_RIGHT | MV_UP | MV_DOWN } }; while (tube_leave_directions[i][0] != Feld[jx][jy]) @@ -5843,10 +6198,11 @@ int DigField(struct PlayerInfo *player, { case EL_EMPTY: case EL_SAND: - case EL_SAND_INVISIBLE: - case EL_TRAP_INACTIVE: + case EL_INVISIBLE_SAND: + case EL_INVISIBLE_SAND_ACTIVE: + case EL_TRAP: case EL_SP_BASE: - case EL_SP_BUG: + case EL_SP_BUGGY_BASE: RemoveField(x, y); PlaySoundLevelElementAction(x, y, element, SND_ACTION_DIGGING); break; @@ -5896,14 +6252,14 @@ int DigField(struct PlayerInfo *player, case EL_SHIELD_NORMAL: RemoveField(x, y); - player->shield_passive_time_left += 10; + player->shield_normal_time_left += 10; PlaySoundLevel(x, y, SND_SHIELD_NORMAL_COLLECTING); break; - case EL_SHIELD_ACTIVE: + case EL_SHIELD_DEADLY: RemoveField(x, y); - player->shield_passive_time_left += 10; - player->shield_active_time_left += 10; + player->shield_normal_time_left += 10; + player->shield_deadly_time_left += 10; PlaySoundLevel(x, y, SND_SHIELD_DEADLY_COLLECTING); break; @@ -5949,10 +6305,10 @@ int DigField(struct PlayerInfo *player, RemoveField(x, y); player->key[key_nr] = TRUE; - RaiseScoreElement(EL_KEY); - DrawMiniGraphicExt(drawto, DX_KEYS + key_nr * MINI_TILEX, DY_KEYS, + RaiseScoreElement(element); + DrawNewMiniGraphicExt(drawto, DX_KEYS + key_nr * MINI_TILEX, DY_KEYS, GFX_SCHLUESSEL1 + key_nr); - DrawMiniGraphicExt(window, DX_KEYS + key_nr * MINI_TILEX, DY_KEYS, + DrawNewMiniGraphicExt(window, DX_KEYS + key_nr * MINI_TILEX, DY_KEYS, GFX_SCHLUESSEL1 + key_nr); PlaySoundLevel(x, y, SND_KEY_COLLECTING); break; @@ -5967,10 +6323,10 @@ int DigField(struct PlayerInfo *player, RemoveField(x, y); player->key[key_nr] = TRUE; - RaiseScoreElement(EL_KEY); - DrawMiniGraphicExt(drawto, DX_KEYS + key_nr * MINI_TILEX, DY_KEYS, + RaiseScoreElement(element); + DrawNewMiniGraphicExt(drawto, DX_KEYS + key_nr * MINI_TILEX, DY_KEYS, GFX_SCHLUESSEL1 + key_nr); - DrawMiniGraphicExt(window, DX_KEYS + key_nr * MINI_TILEX, DY_KEYS, + DrawNewMiniGraphicExt(window, DX_KEYS + key_nr * MINI_TILEX, DY_KEYS, GFX_SCHLUESSEL1 + key_nr); PlaySoundLevel(x, y, SND_KEY_COLLECTING); break; @@ -5980,7 +6336,7 @@ int DigField(struct PlayerInfo *player, Feld[x][y] = EL_ROBOT_WHEEL_ACTIVE; ZX = x; ZY = y; - DrawLevelField(x, y); + DrawNewLevelField(x, y); PlaySoundLevel(x, y, SND_ROBOT_WHEEL_ACTIVATING); return MF_ACTION; break; @@ -6051,9 +6407,9 @@ int DigField(struct PlayerInfo *player, return MF_ACTION; break; - case EL_TIMEGATE_SWITCH_OFF: + case EL_TIMEGATE_SWITCH: ActivateTimegateSwitch(x, y); - PlaySoundLevel(x, y, SND_TIMEGATE_WHEEL_ACTIVATING); + PlaySoundLevel(x, y, SND_TIMEGATE_SWITCH_ACTIVATING); return MF_ACTION; break; @@ -6062,8 +6418,8 @@ int DigField(struct PlayerInfo *player, case EL_BALLOON_SEND_RIGHT: case EL_BALLOON_SEND_UP: case EL_BALLOON_SEND_DOWN: - case EL_BALLOON_SEND_ANY: - if (element == EL_BALLOON_SEND_ANY) + case EL_BALLOON_SEND_ANY_DIRECTION: + if (element == EL_BALLOON_SEND_ANY_DIRECTION) game.balloon_dir = move_direction; else game.balloon_dir = (element == EL_BALLOON_SEND_LEFT ? MV_LEFT : @@ -6136,7 +6492,7 @@ int DigField(struct PlayerInfo *player, player->push_delay_value = (element == EL_SPRING ? 0 : 2 + RND(8)); - DrawLevelField(x+dx, y+dy); + DrawNewLevelField(x + dx, y + dy); PlaySoundLevelElementAction(x, y, element, SND_ACTION_PUSHING); break; @@ -6242,13 +6598,13 @@ int DigField(struct PlayerInfo *player, PlaySoundLevel(x, y, SND_SP_PORT_PASSING); break; - case EL_TUBE_CROSS: + case EL_TUBE_ALL: case EL_TUBE_VERTICAL: case EL_TUBE_HORIZONTAL: - case EL_TUBE_VERT_LEFT: - case EL_TUBE_VERT_RIGHT: - case EL_TUBE_HORIZ_UP: - case EL_TUBE_HORIZ_DOWN: + case EL_TUBE_VERTICAL_LEFT: + case EL_TUBE_VERTICAL_RIGHT: + case EL_TUBE_HORIZONTAL_UP: + case EL_TUBE_HORIZONTAL_DOWN: case EL_TUBE_LEFT_UP: case EL_TUBE_LEFT_DOWN: case EL_TUBE_RIGHT_UP: @@ -6257,18 +6613,18 @@ int DigField(struct PlayerInfo *player, int i = 0; int tube_enter_directions[][2] = { - { EL_TUBE_CROSS, MV_LEFT | MV_RIGHT | MV_UP | MV_DOWN }, - { EL_TUBE_VERTICAL, MV_UP | MV_DOWN }, - { EL_TUBE_HORIZONTAL, MV_LEFT | MV_RIGHT }, - { EL_TUBE_VERT_LEFT, MV_RIGHT | MV_UP | MV_DOWN }, - { EL_TUBE_VERT_RIGHT, MV_LEFT | MV_UP | MV_DOWN }, - { EL_TUBE_HORIZ_UP, MV_LEFT | MV_RIGHT | MV_DOWN }, - { EL_TUBE_HORIZ_DOWN, MV_LEFT | MV_RIGHT | MV_UP }, - { EL_TUBE_LEFT_UP, MV_RIGHT | MV_DOWN }, - { EL_TUBE_LEFT_DOWN, MV_RIGHT | MV_UP }, - { EL_TUBE_RIGHT_UP, MV_LEFT | MV_DOWN }, - { EL_TUBE_RIGHT_DOWN, MV_LEFT | MV_UP }, - { -1, MV_NO_MOVING } + { EL_TUBE_ALL, MV_LEFT | MV_RIGHT | MV_UP | MV_DOWN }, + { EL_TUBE_VERTICAL, MV_UP | MV_DOWN }, + { EL_TUBE_HORIZONTAL, MV_LEFT | MV_RIGHT }, + { EL_TUBE_VERTICAL_LEFT, MV_RIGHT | MV_UP | MV_DOWN }, + { EL_TUBE_VERTICAL_RIGHT, MV_LEFT | MV_UP | MV_DOWN }, + { EL_TUBE_HORIZONTAL_UP, MV_LEFT | MV_RIGHT | MV_DOWN }, + { EL_TUBE_HORIZONTAL_DOWN, MV_LEFT | MV_RIGHT | MV_UP }, + { EL_TUBE_LEFT_UP, MV_RIGHT | MV_DOWN }, + { EL_TUBE_LEFT_DOWN, MV_RIGHT | MV_UP }, + { EL_TUBE_RIGHT_UP, MV_LEFT | MV_DOWN }, + { EL_TUBE_RIGHT_DOWN, MV_LEFT | MV_UP }, + { -1, MV_NO_MOVING } }; while (tube_enter_directions[i][0] != element) @@ -6287,7 +6643,7 @@ int DigField(struct PlayerInfo *player, case EL_EXIT_CLOSED: case EL_SP_EXIT_CLOSED: - case EL_AUSGANG_ACT: + case EL_EXIT_OPENING: return MF_NO_ACTION; break; @@ -6306,7 +6662,7 @@ int DigField(struct PlayerInfo *player, case EL_LAMP: Feld[x][y] = EL_LAMP_ACTIVE; local_player->lights_still_needed--; - DrawLevelField(x, y); + DrawNewLevelField(x, y); PlaySoundLevel(x, y, SND_LAMP_ACTIVATING); return MF_ACTION; break; @@ -6315,16 +6671,16 @@ int DigField(struct PlayerInfo *player, Feld[x][y] = EL_TIME_ORB_EMPTY; TimeLeft += 10; DrawText(DX_TIME, DY_TIME, int2str(TimeLeft, 3), FS_SMALL, FC_YELLOW); - DrawLevelField(x, y); + DrawNewLevelField(x, y); PlaySoundStereo(SND_TIME_ORB_FULL_COLLECTING, SOUND_MAX_RIGHT); return MF_ACTION; break; - case EL_SOKOBAN_FELD_LEER: + case EL_SOKOBAN_FIELD_EMPTY: break; - case EL_SOKOBAN_OBJEKT: - case EL_SOKOBAN_FELD_VOLL: + case EL_SOKOBAN_OBJECT: + case EL_SOKOBAN_FIELD_FULL: case EL_SATELLITE: case EL_SP_DISK_YELLOW: case EL_BALLOON: @@ -6335,7 +6691,7 @@ int DigField(struct PlayerInfo *player, if (!IN_LEV_FIELD(x+dx, y+dy) || (!IS_FREE(x+dx, y+dy) - && (Feld[x+dx][y+dy] != EL_SOKOBAN_FELD_LEER + && (Feld[x+dx][y+dy] != EL_SOKOBAN_FIELD_EMPTY || !IS_SB_ELEMENT(element)))) return MF_NO_ACTION; @@ -6365,27 +6721,27 @@ int DigField(struct PlayerInfo *player, if (IS_SB_ELEMENT(element)) { - if (element == EL_SOKOBAN_FELD_VOLL) + if (element == EL_SOKOBAN_FIELD_FULL) { - Feld[x][y] = EL_SOKOBAN_FELD_LEER; + Feld[x][y] = EL_SOKOBAN_FIELD_EMPTY; local_player->sokobanfields_still_needed++; } else RemoveField(x, y); - if (Feld[x+dx][y+dy] == EL_SOKOBAN_FELD_LEER) + if (Feld[x+dx][y+dy] == EL_SOKOBAN_FIELD_EMPTY) { - Feld[x+dx][y+dy] = EL_SOKOBAN_FELD_VOLL; + Feld[x+dx][y+dy] = EL_SOKOBAN_FIELD_FULL; local_player->sokobanfields_still_needed--; - if (element == EL_SOKOBAN_OBJEKT) + if (element == EL_SOKOBAN_OBJECT) PlaySoundLevel(x, y, SND_SOKOBAN_FIELD_FILLING); else PlaySoundLevel(x, y, SND_SOKOBAN_OBJECT_PUSHING); } else { - Feld[x+dx][y+dy] = EL_SOKOBAN_OBJEKT; - if (element == EL_SOKOBAN_FELD_VOLL) + Feld[x+dx][y+dy] = EL_SOKOBAN_OBJECT; + if (element == EL_SOKOBAN_FIELD_FULL) PlaySoundLevel(x, y, SND_SOKOBAN_FIELD_EMPTYING); else PlaySoundLevel(x, y, SND_SOKOBAN_OBJECT_PUSHING); @@ -6400,8 +6756,8 @@ int DigField(struct PlayerInfo *player, player->push_delay_value = (element == EL_BALLOON ? 0 : 2); - DrawLevelField(x, y); - DrawLevelField(x+dx, y+dy); + DrawNewLevelField(x, y); + DrawNewLevelField(x + dx, y + dy); if (IS_SB_ELEMENT(element) && local_player->sokobanfields_still_needed == 0 && @@ -6459,7 +6815,7 @@ boolean SnapField(struct PlayerInfo *player, int dx, int dy) return FALSE; player->snapped = TRUE; - DrawLevelField(x, y); + DrawNewLevelField(x, y); BackToFront(); return TRUE; @@ -6476,7 +6832,7 @@ boolean PlaceBomb(struct PlayerInfo *player) element = Feld[jx][jy]; if ((player->dynamite == 0 && player->dynabombs_left == 0) || - IS_ACTIVE_BOMB(element) || element == EL_EXPLODING) + IS_ACTIVE_BOMB(element) || element == EL_EXPLOSION) return FALSE; if (element != EL_EMPTY) @@ -6491,21 +6847,35 @@ boolean PlaceBomb(struct PlayerInfo *player) FS_SMALL, FC_YELLOW); if (IN_SCR_FIELD(SCREENX(jx), SCREENY(jy))) { +#if 0 if (game.emulation == EMU_SUPAPLEX) DrawGraphic(SCREENX(jx), SCREENY(jy), GFX_SP_DISK_RED); else DrawGraphicThruMask(SCREENX(jx), SCREENY(jy), GFX_DYNAMIT); +#else + if (game.emulation == EMU_SUPAPLEX) + DrawNewGraphic(SCREENX(jx), SCREENY(jy), IMG_SP_DISK_RED, 0); + else + DrawNewGraphicThruMask(SCREENX(jx), SCREENY(jy), + IMG_DYNAMITE_ACTIVE, 0); +#endif } PlaySoundLevel(jx, jy, SND_DYNAMITE_DROPPING); } else { - Feld[jx][jy] = EL_DYNABOMB_ACTIVE_1 + (player->element_nr - EL_PLAYER1); + Feld[jx][jy] = + EL_DYNABOMB_PLAYER1_ACTIVE + (player->element_nr - EL_PLAYER1); MovDelay[jx][jy] = 96; player->dynabombs_left--; if (IN_SCR_FIELD(SCREENX(jx), SCREENY(jy))) +#if 0 DrawGraphicThruMask(SCREENX(jx), SCREENY(jy), GFX_DYNABOMB); +#else + DrawNewGraphicThruMask(SCREENX(jx), SCREENY(jy), + el2img(Feld[jx][jy]), 0); +#endif PlaySoundLevel(jx, jy, SND_DYNABOMB_DROPPING); } @@ -6595,11 +6965,11 @@ void RaiseScoreElement(int element) RaiseScore(level.score[SC_DIAMANT]); break; case EL_BUG: - case EL_BUTTERFLY: + case EL_BD_BUTTERFLY: RaiseScore(level.score[SC_KAEFER]); break; case EL_SPACESHIP: - case EL_FIREFLY: + case EL_BD_FIREFLY: RaiseScore(level.score[SC_FLIEGER]); break; case EL_YAMYAM: @@ -6618,7 +6988,10 @@ void RaiseScoreElement(int element) case EL_DYNAMITE: RaiseScore(level.score[SC_DYNAMIT]); break; - case EL_KEY: + case EL_KEY1: + case EL_KEY2: + case EL_KEY3: + case EL_KEY4: RaiseScore(level.score[SC_SCHLUESSEL]); break; default: