X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Fgame.c;h=4f3f3cab928b23f3146b9353c9fa6cff061bfac2;hb=75ebfce89c39bc740367807c4c16f469135ba6d5;hp=332da783035d540ce04ec1552087f136b78c67e3;hpb=7cd6d9ecca4ccd4927eddc994b616569ef23b231;p=rocksndiamonds.git diff --git a/src/game.c b/src/game.c index 332da783..4f3f3cab 100644 --- a/src/game.c +++ b/src/game.c @@ -292,6 +292,8 @@ static void InitField(int x, int y, boolean init_game) Feld[x][y] = EL_SP_MURPHY_CLONE; break; } + + Feld[x][y] = EL_PLAYER1; } /* no break! */ case EL_PLAYER1: @@ -484,7 +486,7 @@ void DrawGameDoorValues() for (i=0; i 6) - frame = 6; - } - else - { - if ((frame = ((96 - MovDelay[x][y]) / 6) % 8) > 3) - frame = 7 - frame; - } -#else - frame = getNewGraphicAnimationFrame(graphic, 96 - MovDelay[x][y]); -#endif + frame = getGraphicAnimationFrame(graphic, 96 - MovDelay[x][y]); /* printf("-> %d: %d [%d]\n", graphic, frame, MovDelay[x][y]); */ -#if 0 if (game.emulation == EMU_SUPAPLEX) - DrawGraphic(sx, sy, GFX_SP_DISK_RED); + DrawGraphic(sx, sy, IMG_SP_DISK_RED, 0); else if (Store[x][y]) - DrawGraphicThruMask(sx, sy, graphic + frame); + 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 - DrawNewGraphic(sx, sy, graphic, frame); -#endif + DrawGraphic(sx, sy, graphic, frame); } void CheckDynamite(int x, int y) @@ -1725,50 +1701,29 @@ void Explode(int ex, int ey, int phase, int mode) InitField(x, y, FALSE); if (CAN_MOVE(element) || COULD_MOVE(element)) InitMovDir(x, y); - DrawNewLevelField(x, y); + DrawLevelField(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))) + else if (phase >= delay && IN_SCR_FIELD(SCREENX(x), SCREENY(y))) { -#if 0 - int graphic = GFX_EXPLOSION; - - if (game.emulation == EMU_SUPAPLEX) - graphic = (Store[x][y] == EL_SP_INFOTRON ? - GFX_SP_EXPLODE_INFOTRON : - GFX_SP_EXPLODE_EMPTY); - - 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 + int stored = Store[x][y]; + int graphic = (game.emulation != EMU_SUPAPLEX ? IMG_EXPLOSION : + stored == EL_SP_INFOTRON ? IMG_SP_EXPLOSION_INFOTRON : + IMG_SP_EXPLOSION); + int frame = getGraphicAnimationFrame(graphic, phase - delay); if (phase == delay) DrawCrumbledSand(SCREENX(x), SCREENY(y)); if (IS_PFORTE(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 + DrawLevelElement(x, y, Store[x][y]); + DrawGraphicThruMask(SCREENX(x), SCREENY(y), graphic, frame); } else -#if 0 - DrawGraphic(SCREENX(x), SCREENY(y), graphic); -#else - DrawNewGraphic(SCREENX(x), SCREENY(y), graphic, frame); -#endif + DrawGraphic(SCREENX(x), SCREENY(y), graphic, frame); } } @@ -1898,14 +1853,9 @@ void Blurb(int x, int y) } else /* go on */ { -#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; @@ -1914,20 +1864,16 @@ 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]); + int frame = getGraphicAnimationFrame(graphic, 8 - MovDelay[x][y]); - DrawNewGraphic(SCREENX(x), SCREENY(y), graphic, frame); + DrawGraphic(SCREENX(x), SCREENY(y), graphic, frame); } -#endif if (!MovDelay[x][y]) { Feld[x][y] = EL_EMPTY; - DrawNewLevelField(x, y); + DrawLevelField(x, y); } } } @@ -2004,7 +1950,7 @@ static void ToggleBeltSwitch(int x, int y) if (e_belt_nr == belt_nr) { Feld[xx][yy] = belt_base_switch_element[belt_nr] + belt_dir_nr; - DrawNewLevelField(xx, yy); + DrawLevelField(xx, yy); } } else if (IS_BELT(element) && belt_dir != MV_NO_MOVING) @@ -2016,7 +1962,7 @@ static void ToggleBeltSwitch(int x, int y) int belt_part = Feld[xx][yy] - belt_base_element[belt_nr]; Feld[xx][yy] = belt_base_active_element[belt_nr] + belt_part; - DrawNewLevelField(xx, yy); + DrawLevelField(xx, yy); } } else if (IS_BELT_ACTIVE(element) && belt_dir == MV_NO_MOVING) @@ -2028,7 +1974,7 @@ static void ToggleBeltSwitch(int x, int y) int belt_part = Feld[xx][yy] - belt_base_active_element[belt_nr]; Feld[xx][yy] = belt_base_element[belt_nr] + belt_part; - DrawNewLevelField(xx, yy); + DrawLevelField(xx, yy); } } } @@ -2051,7 +1997,7 @@ static void ToggleSwitchgateSwitch(int x, int y) element == EL_SWITCHGATE_SWITCH_DOWN) { Feld[xx][yy] = EL_SWITCHGATE_SWITCH_UP + game.switchgate_pos; - DrawNewLevelField(xx, yy); + DrawLevelField(xx, yy); } else if (element == EL_SWITCHGATE_OPEN || element == EL_SWITCHGATE_OPENING) @@ -2097,13 +2043,13 @@ static void RedrawAllLightSwitchesAndInvisibleElements() game.light_time_left > 0) { Feld[x][y] = EL_LIGHT_SWITCH_ACTIVE; - DrawNewLevelField(x, y); + DrawLevelField(x, y); } else if (element == EL_LIGHT_SWITCH_ACTIVE && game.light_time_left == 0) { Feld[x][y] = EL_LIGHT_SWITCH; - DrawNewLevelField(x, y); + DrawLevelField(x, y); } else if (element == EL_INVISIBLE_STEELWALL || element == EL_INVISIBLE_WALL || @@ -2112,7 +2058,7 @@ static void RedrawAllLightSwitchesAndInvisibleElements() if (game.light_time_left > 0) Feld[x][y] = getInvisibleActiveFromInvisibleElement(element); - DrawNewLevelField(x, y); + DrawLevelField(x, y); } else if (element == EL_INVISIBLE_STEELWALL_ACTIVE || element == EL_INVISIBLE_WALL_ACTIVE || @@ -2121,7 +2067,7 @@ static void RedrawAllLightSwitchesAndInvisibleElements() if (game.light_time_left == 0) Feld[x][y] = getInvisibleFromInvisibleActiveElement(element); - DrawNewLevelField(x, y); + DrawLevelField(x, y); } } } @@ -2380,18 +2326,18 @@ void TurnRound(int x, int y) int element = Feld[x][y]; int old_move_dir = MovDir[x][y]; - int left_dir = turn[old_move_dir].left; + int left_dir = turn[old_move_dir].left; int right_dir = turn[old_move_dir].right; - int back_dir = turn[old_move_dir].back; + int back_dir = turn[old_move_dir].back; - int left_dx = move_xy[left_dir].x, left_dy = move_xy[left_dir].y; - int right_dx = move_xy[right_dir].x, right_dy = move_xy[right_dir].y; - int move_dx = move_xy[old_move_dir].x, move_dy = move_xy[old_move_dir].y; - int back_dx = move_xy[back_dir].x, back_dy = move_xy[back_dir].y; + int left_dx = move_xy[left_dir].x, left_dy = move_xy[left_dir].y; + int right_dx = move_xy[right_dir].x, right_dy = move_xy[right_dir].y; + int move_dx = move_xy[old_move_dir].x, move_dy = move_xy[old_move_dir].y; + int back_dx = move_xy[back_dir].x, back_dy = move_xy[back_dir].y; - int left_x = x+left_dx, left_y = y+left_dy; - int right_x = x+right_dx, right_y = y+right_dy; - int move_x = x+move_dx, move_y = y+move_dy; + int left_x = x + left_dx, left_y = y + left_dy; + int right_x = x + right_dx, right_y = y + right_dy; + int move_x = x + move_dx, move_y = y + move_dy; if (element == EL_BUG || element == EL_BD_BUTTERFLY) { @@ -2635,17 +2581,18 @@ void TurnRound(int x, int y) MovDir[x][y] = game.balloon_dir; MovDelay[x][y] = 0; } - else if (element == EL_SPRING_MOVING) + else if (element == EL_SPRING) { - if (!IN_LEV_FIELD(move_x, move_y) || !IS_FREE(move_x, move_y) || - (IN_LEV_FIELD(x, y+1) && IS_FREE(x, y+1))) - { - Feld[x][y] = EL_SPRING; + if ((MovDir[x][y] == MV_LEFT || MovDir[x][y] == MV_RIGHT) && + (!IN_LEV_FIELD(move_x, move_y) || !IS_FREE(move_x, move_y) || + (IN_LEV_FIELD(x, y + 1) && IS_FREE(x, y + 1)))) MovDir[x][y] = MV_NO_MOVING; - } + MovDelay[x][y] = 0; } - else if (element == EL_ROBOT || element == EL_SATELLITE || element == EL_PENGUIN) + else if (element == EL_ROBOT || + element == EL_SATELLITE || + element == EL_PENGUIN) { int attr_x = -1, attr_y = -1; @@ -2966,33 +2913,50 @@ void StartMoving(int x, int y) if ((belt_dir == MV_LEFT && left_is_free) || (belt_dir == MV_RIGHT && right_is_free)) + { InitMovingField(x, y, belt_dir); + GfxAction[x][y] = GFX_ACTION_DEFAULT; + } } } - else if (CAN_MOVE(element)) + + if (CAN_MOVE(element)) /* not "else if" because of EL_SPRING */ { int newx, newy; - if ((element == EL_SATELLITE || element == EL_BALLOON || - element == EL_SPRING_MOVING) + if ((element == EL_SATELLITE || + element == EL_BALLOON || + element == EL_SPRING) && JustBeingPushed(x, y)) return; + if (element == EL_SPRING && MovDir[x][y] == MV_DOWN) + Feld[x][y + 1] = EL_EMPTY; /* was set to EL_BLOCKED above */ + if (!MovDelay[x][y]) /* start new movement phase */ { /* all objects that can change their move direction after each step */ /* (MAMPFER, MAMPFER2 and PACMAN go straight until they hit a wall */ - if (element!=EL_YAMYAM && element!=EL_DARK_YAMYAM && element!=EL_PACMAN) + if (element != EL_YAMYAM && + element != EL_DARK_YAMYAM && + element != EL_PACMAN) { +#if 0 + if (element == EL_SPRING) + printf("1--> %d\n", MovDir[x][y]); +#endif TurnRound(x, y); - +#if 0 + if (element == EL_SPRING) + printf("2--> %d\n", MovDir[x][y]); +#endif if (MovDelay[x][y] && (element == EL_BUG || element == EL_SPACESHIP || element == EL_SP_SNIKSNAK || element == EL_SP_ELECTRON || element == EL_MOLE)) - DrawNewLevelField(x, y); + DrawLevelField(x, y); } } @@ -3003,22 +2967,13 @@ void StartMoving(int x, int y) if (element == EL_ROBOT || element == EL_YAMYAM || element == EL_DARK_YAMYAM) { - int phase = MovDelay[x][y] % 8; - - if (phase > 3) - phase = 7 - phase; - if (IN_SCR_FIELD(SCREENX(x), SCREENY(y))) -#if 0 - DrawGraphic(SCREENX(x), SCREENY(y), el2gfx(element) + phase); -#else { int graphic = el2img(element); - int frame = getNewGraphicAnimationFrame(graphic, MovDelay[x][y] % 8); + int frame = getGraphicAnimationFrame(graphic, MovDelay[x][y] % 8); - DrawNewGraphic(SCREENX(x), SCREENY(y), graphic, frame); + DrawGraphic(SCREENX(x), SCREENY(y), graphic, frame); } -#endif if (MovDelay[x][y] % 4 == 3) { @@ -3029,30 +2984,18 @@ void StartMoving(int x, int y) } } else if (element == EL_SP_ELECTRON) -#if 0 - DrawGraphicAnimation(x, y, GFX2_SP_ELECTRON, 8, 2, ANIM_LOOP); -#else - DrawNewGraphicAnimation(x, y, IMG_SP_ELECTRON); -#endif + DrawGraphicAnimation(SCREENX(x), SCREENY(y), IMG_SP_ELECTRON); else if (element == EL_DRAGON) { int i; int dir = MovDir[x][y]; int dx = (dir == MV_LEFT ? -1 : dir == MV_RIGHT ? +1 : 0); int dy = (dir == MV_UP ? -1 : dir == MV_DOWN ? +1 : 0); -#if 0 - int graphic = (dir == MV_LEFT ? GFX_FLAMMEN_LEFT : - dir == MV_RIGHT ? GFX_FLAMMEN_RIGHT : - dir == MV_UP ? GFX_FLAMMEN_UP : - dir == MV_DOWN ? GFX_FLAMMEN_DOWN : GFX_LEERRAUM); - int phase = FrameCounter % 2; -#else int graphic = (dir == MV_LEFT ? IMG_FLAMES_LEFT1 : dir == MV_RIGHT ? IMG_FLAMES_RIGHT1 : dir == MV_UP ? IMG_FLAMES_UP1 : dir == MV_DOWN ? IMG_FLAMES_DOWN1 : IMG_EMPTY); - int frame = getNewGraphicAnimationFrame(graphic, -1); -#endif + int frame = getGraphicAnimationFrame(graphic, -1); for (i=1; i<=3; i++) { @@ -3075,17 +3018,13 @@ void StartMoving(int x, int y) Feld[xx][yy] = EL_FLAMES; if (IN_SCR_FIELD(sx, sy)) -#if 0 - DrawGraphic(sx, sy, graphic + phase*3 + i-1); -#else - DrawNewGraphic(sx, sy, flame_graphic, frame); -#endif + DrawGraphic(sx, sy, flame_graphic, frame); } else { if (Feld[xx][yy] == EL_FLAMES) Feld[xx][yy] = EL_EMPTY; - DrawNewLevelField(xx, yy); + DrawLevelField(xx, yy); } } } @@ -3130,16 +3069,11 @@ void StartMoving(int x, int y) if (Feld[newx][newy] == EL_EXIT_OPEN) { Feld[x][y] = EL_EMPTY; - DrawNewLevelField(x, y); + DrawLevelField(x, y); PlaySoundLevel(newx, newy, SND_PENGUIN_PASSING_EXIT); if (IN_SCR_FIELD(SCREENX(newx), SCREENY(newy))) -#if 0 - DrawGraphicThruMask(SCREENX(newx), SCREENY(newy), el2gfx(element)); -#else - DrawNewGraphicThruMask(SCREENX(newx), SCREENY(newy), el2img(element), - 0); -#endif + DrawGraphicThruMask(SCREENX(newx),SCREENY(newy), el2img(element), 0); local_player->friends_still_needed--; if (!local_player->friends_still_needed && @@ -3151,7 +3085,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) - DrawNewLevelField(newx, newy); + DrawLevelField(newx, newy); else MovDir[x][y] = MV_NO_MOVING; } @@ -3160,7 +3094,7 @@ void StartMoving(int x, int y) if (IS_PLAYER(x, y)) DrawPlayerField(x, y); else - DrawNewLevelField(x, y); + DrawLevelField(x, y); return; } } @@ -3173,7 +3107,7 @@ void StartMoving(int x, int y) else { Feld[newx][newy] = EL_EMPTY; - DrawNewLevelField(newx, newy); + DrawLevelField(newx, newy); } PlaySoundLevel(x, y, SND_PIG_EATING); @@ -3183,7 +3117,7 @@ void StartMoving(int x, int y) if (IS_PLAYER(x, y)) DrawPlayerField(x, y); else - DrawNewLevelField(x, y); + DrawLevelField(x, y); return; } } @@ -3194,7 +3128,7 @@ void StartMoving(int x, int y) if (IS_PLAYER(x, y)) DrawPlayerField(x, y); else - DrawNewLevelField(x, y); + DrawLevelField(x, y); return; } else @@ -3215,7 +3149,7 @@ void StartMoving(int x, int y) if (IS_PLAYER(x, y)) DrawPlayerField(x, y); else - DrawNewLevelField(x, y); + DrawLevelField(x, y); PlaySoundLevel(x, y, SND_DRAGON_ATTACKING); @@ -3237,7 +3171,7 @@ void StartMoving(int x, int y) else { Feld[newx][newy] = EL_EMPTY; - DrawNewLevelField(newx, newy); + DrawLevelField(newx, newy); } PlaySoundLevel(x, y, SND_YAMYAM_EATING); @@ -3258,7 +3192,7 @@ void StartMoving(int x, int y) else { Feld[newx][newy] = EL_EMPTY; - DrawNewLevelField(newx, newy); + DrawLevelField(newx, newy); } PlaySoundLevel(x, y, SND_DARK_YAMYAM_EATING); @@ -3284,7 +3218,7 @@ void StartMoving(int x, int y) else /* element == EL_PACMAN */ { Feld[newx][newy] = EL_EMPTY; - DrawNewLevelField(newx, newy); + DrawLevelField(newx, newy); PlaySoundLevel(x, y, SND_PACMAN_EATING); } } @@ -3303,36 +3237,16 @@ void StartMoving(int x, int y) if (element == EL_BUG || element == EL_SPACESHIP || element == EL_SP_SNIKSNAK) -#if 0 DrawLevelField(x, y); -#else - DrawNewLevelField(x, y); -#endif else if (element == EL_BUG || element == EL_SPACESHIP || element == EL_SP_SNIKSNAK || element == EL_MOLE) -#if 0 DrawLevelField(x, y); -#else - DrawNewLevelField(x, y); -#endif else if (element == EL_BD_BUTTERFLY || element == EL_BD_FIREFLY) -#if 0 - DrawGraphicAnimation(x, y, el2gfx(element), 2, 4, ANIM_LOOP); -#else - DrawNewGraphicAnimation(x, y, el2img(element)); -#endif + DrawGraphicAnimation(SCREENX(x), SCREENY(y), el2img(element)); else if (element == EL_SATELLITE) -#if 0 - DrawGraphicAnimation(x, y, GFX_SONDE_START, 8, 2, ANIM_LOOP); -#else - DrawNewGraphicAnimation(x, y, IMG_SATELLITE); -#endif + DrawGraphicAnimation(SCREENX(x), SCREENY(y), IMG_SATELLITE); else if (element == EL_SP_ELECTRON) -#if 0 - DrawGraphicAnimation(x, y, GFX2_SP_ELECTRON, 8, 2, ANIM_LOOP); -#else - DrawNewGraphicAnimation(x, y, IMG_SP_ELECTRON); -#endif + DrawGraphicAnimation(SCREENX(x), SCREENY(y), IMG_SP_ELECTRON); if (DONT_TOUCH(element)) TestIfBadThingTouchesHero(x, y); @@ -3357,7 +3271,7 @@ void ContinueMoving(int x, int y) int direction = MovDir[x][y]; int dx = (direction == MV_LEFT ? -1 : direction == MV_RIGHT ? +1 : 0); int dy = (direction == MV_UP ? -1 : direction == MV_DOWN ? +1 : 0); - int horiz_move = (dx!=0); + int horiz_move = (dx != 0); int newx = x + dx, newy = y + dy; int step = (horiz_move ? dx : dy) * TILEX / 8; @@ -3374,8 +3288,8 @@ void ContinueMoving(int x, int y) else if (CAN_FALL(element) && horiz_move && y < lev_fieldy-1 && IS_BELT_ACTIVE(Feld[x][y+1])) step /= 2; - else if (element == EL_SPRING_MOVING) - step*=2; + else if (element == EL_SPRING && horiz_move) + step *= 2; #if OLD_GAME_BEHAVIOUR else if (CAN_FALL(element) && horiz_move && !IS_SP_ELEMENT(element)) @@ -3401,7 +3315,7 @@ void ContinueMoving(int x, int y) }; Feld[x][y] = EL_SAND; - DrawNewLevelField(x, y); + DrawLevelField(x, y); for(i=0; i<4; i++) { @@ -3411,7 +3325,7 @@ void ContinueMoving(int x, int y) yy = y + xy[i][1]; if (IN_LEV_FIELD(xx, yy) && Feld[xx][yy] == EL_SAND) - DrawNewLevelField(xx, yy); /* for "DrawCrumbledSand()" */ + DrawLevelField(xx, yy); /* for "DrawCrumbledSand()" */ } } @@ -3470,11 +3384,22 @@ void ContinueMoving(int x, int y) GfxAction[newx][newy] = GfxAction[x][y]; /* keep action one frame */ GfxAction[x][y] = GFX_ACTION_DEFAULT; +#if 0 if (!CAN_MOVE(element)) MovDir[newx][newy] = 0; +#else + /* + if (CAN_FALL(element) && MovDir[newx][newy] == MV_DOWN) + MovDir[newx][newy] = 0; + */ - DrawNewLevelField(x, y); - DrawNewLevelField(newx, newy); + if (!CAN_MOVE(element) || + (element == EL_SPRING && MovDir[newx][newy] == MV_DOWN)) + MovDir[newx][newy] = 0; +#endif + + DrawLevelField(x, y); + DrawLevelField(newx, newy); Stop[newx][newy] = TRUE; JustStopped[newx][newy] = 3; @@ -3494,10 +3419,16 @@ void ContinueMoving(int x, int y) } else /* still moving on */ { +#if 0 if (GfxAction[x][y] == GFX_ACTION_DEFAULT) + { + printf("reset GfxAction...\n"); + GfxAction[x][y] = GFX_ACTION_MOVING; + } +#endif - DrawNewLevelField(x, y); + DrawLevelField(x, y); } } @@ -3668,7 +3599,7 @@ void AmoebeUmwandelnBD(int ax, int ay, int new_element) AmoebaNr[x][y] = 0; Feld[x][y] = new_element; InitField(x, y, FALSE); - DrawNewLevelField(x, y); + DrawLevelField(x, y); done = TRUE; } } @@ -3703,22 +3634,18 @@ 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]); + int frame = getGraphicAnimationFrame(IMG_AMOEBA_CREATING, + 6 - MovDelay[x][y]); - DrawNewGraphic(SCREENX(x), SCREENY(y), IMG_AMOEBA_CREATING, frame); + DrawGraphic(SCREENX(x), SCREENY(y), IMG_AMOEBA_CREATING, frame); } -#endif if (!MovDelay[x][y]) { Feld[x][y] = Store[x][y]; Store[x][y] = 0; - DrawNewLevelField(x, y); + DrawLevelField(x, y); } } } @@ -3740,21 +3667,17 @@ 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]); + int frame = getGraphicAnimationFrame(IMG_AMOEBA_SHRINKING, + 6 - MovDelay[x][y]); - DrawNewGraphic(SCREENX(x), SCREENY(y), IMG_AMOEBA_SHRINKING, frame); + DrawGraphic(SCREENX(x), SCREENY(y), IMG_AMOEBA_SHRINKING, frame); } -#endif if (!MovDelay[x][y]) { Feld[x][y] = EL_EMPTY; - DrawNewLevelField(x, y); + DrawLevelField(x, y); /* don't let mole enter this field in this cycle; (give priority to objects falling to this field from above) */ @@ -3779,7 +3702,7 @@ void AmoebeAbleger(int ax, int ay) if (!level.amoeba_speed) { Feld[ax][ay] = EL_AMOEBA_DEAD; - DrawNewLevelField(ax, ay); + DrawLevelField(ax, ay); return; } @@ -3842,7 +3765,7 @@ void AmoebeAbleger(int ax, int ay) if (i == 4 && (!waiting_for_player || game.emulation == EMU_BOULDERDASH)) { Feld[ax][ay] = EL_AMOEBA_DEAD; - DrawNewLevelField(ax, ay); + DrawLevelField(ax, ay); AmoebaCnt[AmoebaNr[ax][ay]]--; if (AmoebaCnt[AmoebaNr[ax][ay]] <= 0) /* amoeba is completely dead */ @@ -3905,7 +3828,7 @@ void AmoebeAbleger(int ax, int ay) return; } - DrawNewLevelField(newax, neway); + DrawLevelField(newax, neway); } void Life(int ax, int ay) @@ -3957,7 +3880,7 @@ void Life(int ax, int ay) { Feld[xx][yy] = EL_EMPTY; if (!Stop[xx][yy]) - DrawNewLevelField(xx, yy); + DrawLevelField(xx, yy); Stop[xx][yy] = TRUE; changed = TRUE; } @@ -3969,7 +3892,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]) - DrawNewLevelField(xx, yy); + DrawLevelField(xx, yy); Stop[xx][yy] = TRUE; changed = TRUE; } @@ -3992,23 +3915,21 @@ 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); + { + int frame = getGraphicAnimationFrame(IMG_ROBOT_WHEEL_ACTIVE, -1); + + DrawGraphic(SCREENX(x), SCREENY(y), IMG_ROBOT_WHEEL_ACTIVE, frame); + } + + PlaySoundLevel(x, y, SND_ROBOT_WHEEL_ACTIVE); - DrawNewGraphic(SCREENX(x), SCREENY(y), IMG_ROBOT_WHEEL_ACTIVE, frame); - } -#endif - if (!(MovDelay[x][y]%4)) - PlaySoundLevel(x, y, SND_ROBOT_WHEEL_ACTIVE); return; } } Feld[x][y] = EL_ROBOT_WHEEL; - DrawNewLevelField(x, y); + DrawLevelField(x, y); + if (ZX == x && ZY == y) ZX = ZY = -1; } @@ -4024,40 +3945,26 @@ 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); + { + int frame = getGraphicAnimationFrame(IMG_TIMEGATE_SWITCH_ACTIVE, -1); + + DrawGraphic(SCREENX(x), SCREENY(y), IMG_TIMEGATE_SWITCH_ACTIVE, frame); + } + + PlaySoundLevel(x, y, SND_TIMEGATE_SWITCH_ACTIVE); - DrawNewGraphic(SCREENX(x), SCREENY(y), IMG_TIMEGATE_SWITCH_ACTIVE, frame); - } -#endif - if (!(MovDelay[x][y]%4)) - PlaySoundLevel(x, y, SND_TIMEGATE_SWITCH_ACTIVE); return; } } Feld[x][y] = EL_TIMEGATE_SWITCH; - DrawNewLevelField(x, y); + DrawLevelField(x, y); + + /* !!! THIS LOOKS WRONG !!! */ if (ZX == x && ZY == y) ZX = ZY = -1; } -void Blubber(int x, int y) -{ -#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_LOOP); -#else - DrawNewGraphicAnimation(x, y, IMG_ACID); -#endif -} - void NussKnacken(int x, int y) { if (!MovDelay[x][y]) /* next animation frame */ @@ -4066,25 +3973,22 @@ void NussKnacken(int x, int y) if (MovDelay[x][y]) /* wait some time before next frame */ { 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 + if (MovDelay[x][y]) { - int frame = getNewGraphicAnimationFrame(IMG_NUT_CRACKING, - 6 - MovDelay[x][y]); + if (IN_SCR_FIELD(SCREENX(x), SCREENY(y))) + { + int frame = getGraphicAnimationFrame(IMG_NUT_CRACKING, + 6 - MovDelay[x][y]); - DrawNewGraphic(SCREENX(x), SCREENY(y), IMG_NUT_CRACKING, frame); - } -#endif + DrawGraphic(SCREENX(x), SCREENY(y), IMG_NUT_CRACKING, frame); + } - if (!MovDelay[x][y]) - { - Feld[x][y] = EL_EMERALD; - DrawNewLevelField(x, y); + return; } } + + Feld[x][y] = EL_EMERALD; + DrawLevelField(x, y); } void BreakingPearl(int x, int y) @@ -4095,38 +3999,29 @@ void BreakingPearl(int x, int y) if (MovDelay[x][y]) /* wait some time before next frame */ { 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 + if (MovDelay[x][y]) { - int frame = getNewGraphicAnimationFrame(IMG_PEARL_BREAKING, - 8 - MovDelay[x][y]); + if (IN_SCR_FIELD(SCREENX(x), SCREENY(y))) + { + int frame = getGraphicAnimationFrame(IMG_PEARL_BREAKING, + 8 - MovDelay[x][y]); - DrawNewGraphic(SCREENX(x), SCREENY(y), IMG_PEARL_BREAKING, frame); - } -#endif + DrawGraphic(SCREENX(x), SCREENY(y), IMG_PEARL_BREAKING, frame); + } - if (!MovDelay[x][y]) - { - Feld[x][y] = EL_EMPTY; - DrawNewLevelField(x, y); + return; } } + + Feld[x][y] = EL_EMPTY; + DrawLevelField(x, y); } void SiebAktivieren(int x, int y, int type) { -#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 + DrawGraphicAnimation(SCREENX(x), SCREENY(y), graphic); } void AusgangstuerPruefen(int x, int y) @@ -4171,34 +4066,24 @@ void AusgangstuerOeffnen(int x, int y) int tuer; 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 + tuer = MovDelay[x][y] / delay; + + if (!(MovDelay[x][y] % delay)) { - int frame = getNewGraphicAnimationFrame(IMG_EXIT_OPENING, - 29 - MovDelay[x][y]); + if (IN_SCR_FIELD(SCREENX(x), SCREENY(y))) + { + int frame = getGraphicAnimationFrame(IMG_EXIT_OPENING, + 29 - MovDelay[x][y]); - DrawNewGraphic(SCREENX(x), SCREENY(y), IMG_EXIT_OPENING, frame); - } -#endif + DrawGraphic(SCREENX(x), SCREENY(y), IMG_EXIT_OPENING, frame); + } - if (!MovDelay[x][y]) - { - Feld[x][y] = EL_EXIT_OPEN; - DrawNewLevelField(x, y); + return; } } -} -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 + Feld[x][y] = EL_EXIT_OPEN; + DrawLevelField(x, y); } void OpenSwitchgate(int x, int y) @@ -4210,28 +4095,24 @@ void OpenSwitchgate(int x, int y) if (MovDelay[x][y]) /* wait some time before next frame */ { - int phase; - 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 + + if (!(MovDelay[x][y] % delay)) { - int frame = getNewGraphicAnimationFrame(IMG_SWITCHGATE_OPENING, - 29 - MovDelay[x][y]); + if (IN_SCR_FIELD(SCREENX(x), SCREENY(y))) + { + int frame = getGraphicAnimationFrame(IMG_SWITCHGATE_OPENING, + 29 - MovDelay[x][y]); - DrawNewGraphic(SCREENX(x), SCREENY(y), IMG_SWITCHGATE_OPENING, frame); - } -#endif + DrawGraphic(SCREENX(x), SCREENY(y), IMG_SWITCHGATE_OPENING, frame); + } - if (!MovDelay[x][y]) - { - Feld[x][y] = EL_SWITCHGATE_OPEN; - DrawNewLevelField(x, y); + return; } } + + Feld[x][y] = EL_SWITCHGATE_OPEN; + DrawLevelField(x, y); } void CloseSwitchgate(int x, int y) @@ -4243,28 +4124,24 @@ void CloseSwitchgate(int x, int y) if (MovDelay[x][y]) /* wait some time before next frame */ { - int phase; - 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 + + if (!(MovDelay[x][y] % delay)) { - int frame = getNewGraphicAnimationFrame(IMG_SWITCHGATE_CLOSING, - 29 - MovDelay[x][y]); + if (IN_SCR_FIELD(SCREENX(x), SCREENY(y))) + { + int frame = getGraphicAnimationFrame(IMG_SWITCHGATE_CLOSING, + 29 - MovDelay[x][y]); - DrawNewGraphic(SCREENX(x), SCREENY(y), IMG_SWITCHGATE_CLOSING, frame); - } -#endif + DrawGraphic(SCREENX(x), SCREENY(y), IMG_SWITCHGATE_CLOSING, frame); + } - if (!MovDelay[x][y]) - { - Feld[x][y] = EL_SWITCHGATE_CLOSED; - DrawNewLevelField(x, y); + return; } } + + Feld[x][y] = EL_SWITCHGATE_CLOSED; + DrawLevelField(x, y); } void OpenTimegate(int x, int y) @@ -4276,28 +4153,24 @@ void OpenTimegate(int x, int y) if (MovDelay[x][y]) /* wait some time before next frame */ { - int phase; - 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 + + if (!(MovDelay[x][y] % delay)) { - int frame = getNewGraphicAnimationFrame(IMG_TIMEGATE_OPENING, - 29 - MovDelay[x][y]); + if (IN_SCR_FIELD(SCREENX(x), SCREENY(y))) + { + int frame = getGraphicAnimationFrame(IMG_TIMEGATE_OPENING, + 29 - MovDelay[x][y]); - DrawNewGraphic(SCREENX(x), SCREENY(y), IMG_TIMEGATE_OPENING, frame); - } -#endif + DrawGraphic(SCREENX(x), SCREENY(y), IMG_TIMEGATE_OPENING, frame); + } - if (!MovDelay[x][y]) - { - Feld[x][y] = EL_TIMEGATE_OPEN; - DrawNewLevelField(x, y); + return; } } + + Feld[x][y] = EL_TIMEGATE_OPEN; + DrawLevelField(x, y); } void CloseTimegate(int x, int y) @@ -4309,28 +4182,24 @@ void CloseTimegate(int x, int y) if (MovDelay[x][y]) /* wait some time before next frame */ { - int phase; - 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 + + if (!(MovDelay[x][y] % delay)) { - int frame = getNewGraphicAnimationFrame(IMG_TIMEGATE_CLOSING, - 29 - MovDelay[x][y]); + if (IN_SCR_FIELD(SCREENX(x), SCREENY(y))) + { + int frame = getGraphicAnimationFrame(IMG_TIMEGATE_CLOSING, + 29 - MovDelay[x][y]); - DrawNewGraphic(SCREENX(x), SCREENY(y), IMG_TIMEGATE_CLOSING, frame); - } -#endif + DrawGraphic(SCREENX(x), SCREENY(y), IMG_TIMEGATE_CLOSING, frame); + } - if (!MovDelay[x][y]) - { - Feld[x][y] = EL_TIMEGATE_CLOSED; - DrawNewLevelField(x, y); + return; } } + + Feld[x][y] = EL_TIMEGATE_CLOSED; + DrawLevelField(x, y); } static void CloseAllOpenTimegates() @@ -4358,11 +4227,7 @@ 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 + DrawGraphicAnimation(SCREENX(x), SCREENY(y), IMG_BD_DIAMOND); else { if (!MovDelay[x][y]) /* next animation frame */ @@ -4376,29 +4241,17 @@ void EdelsteinFunkeln(int x, int y) SetDrawtoField(DRAW_BUFFERED); #if 0 - DrawGraphic(SCREENX(x), SCREENY(y), el2gfx(Feld[x][y])); + DrawGraphic(SCREENX(x), SCREENY(y), el2img(Feld[x][y]), 0); #else - DrawNewGraphic(SCREENX(x), SCREENY(y), el2img(Feld[x][y]), 0); + DrawGraphicAnimation(SCREENX(x), SCREENY(y), el2img(Feld[x][y])); #endif if (MovDelay[x][y]) { - int phase = (MovDelay[x][y]-1)/2; - - 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]); + int frame = getGraphicAnimationFrame(IMG_TWINKLE_WHITE, + 10 - MovDelay[x][y]); - DrawNewGraphicThruMask(SCREENX(x), SCREENY(y), IMG_TWINKLE_WHITE, - frame); - } -#endif + DrawGraphicThruMask(SCREENX(x), SCREENY(y), IMG_TWINKLE_WHITE, frame); if (setup.direct_draw) { @@ -4425,54 +4278,43 @@ void MauerWaechst(int x, int y) if (MovDelay[x][y]) /* wait some time before next frame */ { - int phase; - MovDelay[x][y]--; - 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]); + int frame = getGraphicAnimationFrame(graphic, 17 - MovDelay[x][y]); - DrawNewGraphic(SCREENX(x), SCREENY(y), graphic, frame); + DrawGraphic(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])) - DrawNewLevelField(x - 1, y); + DrawLevelField(x - 1, y); } else if (MovDir[x][y] == MV_RIGHT) { if (IN_LEV_FIELD(x + 1, y) && IS_MAUER(Feld[x + 1][y])) - DrawNewLevelField(x + 1, y); + DrawLevelField(x + 1, y); } else if (MovDir[x][y] == MV_UP) { if (IN_LEV_FIELD(x, y - 1) && IS_MAUER(Feld[x][y - 1])) - DrawNewLevelField(x, y - 1); + DrawLevelField(x, y - 1); } else { if (IN_LEV_FIELD(x, y + 1) && IS_MAUER(Feld[x][y + 1])) - DrawNewLevelField(x, y + 1); + DrawLevelField(x, y + 1); } Feld[x][y] = Store[x][y]; Store[x][y] = 0; MovDir[x][y] = MV_NO_MOVING; - DrawNewLevelField(x, y); + DrawLevelField(x, y); } } } @@ -4513,12 +4355,8 @@ void MauerAbleger(int ax, int ay) 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 + DrawGraphic(SCREENX(ax), SCREENY(ay - 1), + IMG_WALL_GROWING_ACTIVE_UP, 0); new_wall = TRUE; } if (unten_frei) @@ -4527,12 +4365,8 @@ void MauerAbleger(int ax, int ay) 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 + DrawGraphic(SCREENX(ax), SCREENY(ay + 1), + IMG_WALL_GROWING_ACTIVE_DOWN, 0); new_wall = TRUE; } } @@ -4546,12 +4380,8 @@ void MauerAbleger(int ax, int ay) 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 + DrawGraphic(SCREENX(ax - 1), SCREENY(ay), + IMG_WALL_GROWING_ACTIVE_LEFT, 0); new_wall = TRUE; } @@ -4561,18 +4391,14 @@ void MauerAbleger(int ax, int ay) 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 + DrawGraphic(SCREENX(ax + 1), SCREENY(ay), + IMG_WALL_GROWING_ACTIVE_RIGHT, 0); new_wall = TRUE; } } if (element == EL_WALL_GROWING && (links_frei || rechts_frei)) - DrawNewLevelField(ax, ay); + DrawLevelField(ax, ay); if (!IN_LEV_FIELD(ax, ay-1) || IS_MAUER(Feld[ax][ay-1])) oben_massiv = TRUE; @@ -4633,7 +4459,7 @@ void CheckForDragon(int x, int y) if (IN_LEV_FIELD(xx, yy) && Feld[xx][yy] == EL_FLAMES) { Feld[xx][yy] = EL_EMPTY; - DrawNewLevelField(xx, yy); + DrawLevelField(xx, yy); } else break; @@ -4655,11 +4481,7 @@ 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 + DrawGraphic(SCREENX(x), SCREENY(y), IMG_SP_BUGGY_BASE, 0); if (MovDelay[x][y]) return; @@ -4686,16 +4508,12 @@ 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)); + int frame = getGraphicAnimationFrame(graphic, SimpleRND(100)); - DrawNewGraphic(SCREENX(x), SCREENY(y), graphic, frame); + DrawGraphic(SCREENX(x), SCREENY(y), graphic, frame); } -#endif for (i=0; i<4; i++) { @@ -4712,7 +4530,7 @@ static void CheckBuggyBase(int x, int y) } Feld[x][y] = EL_SP_BUGGY_BASE; - DrawNewLevelField(x, y); + DrawLevelField(x, y); } } } @@ -4752,22 +4570,12 @@ static void CheckTrap(int x, int y) { if (!(MovDelay[x][y] % delay)) { - int phase = MovDelay[x][y]/delay; - - if (phase >= num_frames/2) - phase = num_frames - phase; - if (IN_SCR_FIELD(SCREENX(x), SCREENY(y))) { -#if 0 - DrawGraphic(SCREENX(x),SCREENY(y), GFX_TRAP_INACTIVE + phase - 1); -#else int graphic = IMG_TRAP_ACTIVE; - int frame = getNewGraphicAnimationFrame(graphic, - 31 - MovDelay[x][y]); + int frame = getGraphicAnimationFrame(graphic, 31 - MovDelay[x][y]); - DrawNewGraphic(SCREENX(x),SCREENY(y), graphic, frame); -#endif + DrawGraphic(SCREENX(x),SCREENY(y), graphic, frame); DrawCrumbledSand(SCREENX(x), SCREENY(y)); } } @@ -4776,7 +4584,7 @@ static void CheckTrap(int x, int y) } Feld[x][y] = EL_TRAP; - DrawNewLevelField(x, y); + DrawLevelField(x, y); } } } @@ -4788,17 +4596,9 @@ static void DrawBeltAnimation(int x, int y, int element) if (belt_dir != MV_NO_MOVING) { -#if 0 - int delay = 2; - 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 + DrawGraphicAnimation(SCREENX(x), SCREENY(y), graphic); if (!(FrameCounter % 2)) PlaySoundLevel(x, y, SND_CONVEYOR_BELT_ACTIVE); @@ -4895,6 +4695,7 @@ static void PlayerActions(struct PlayerInfo *player, byte player_action) */ #endif + /* if the player does not move for some time, reset animation to start */ if (++player->frame_reset_delay > player->move_delay_value) player->Frame = 0; } @@ -5093,6 +4894,13 @@ void GameActions() { StartMoving(x, y); +#if 1 + if (Feld[x][y] == EL_EMERALD && + new_graphic_info[IMG_EMERALD].anim_frames > 1 && + !IS_MOVING(x, y)) + DrawGraphicAnimation(SCREENX(x), SCREENY(y), IMG_EMERALD); +#endif + if (IS_GEM(element) || element == EL_SP_INFOTRON) EdelsteinFunkeln(x, y); } @@ -5121,7 +4929,7 @@ void GameActions() else if (element == EL_TIMEGATE_SWITCH_ACTIVE) TimegateWheel(x, y); else if (element == EL_ACID) - Blubber(x, y); + DrawGraphicAnimation(SCREENX(x), SCREENY(y), IMG_ACID); else if (element == EL_ACID_SPLASH_LEFT || element == EL_ACID_SPLASH_RIGHT) Blurb(x, y); @@ -5136,9 +4944,9 @@ void GameActions() else if (element == EL_EXIT_OPENING) AusgangstuerOeffnen(x, y); else if (element == EL_EXIT_OPEN) - AusgangstuerBlinken(x, y); + DrawGraphicAnimation(SCREENX(x), SCREENY(y), IMG_EXIT_OPEN); else if (element == EL_SP_EXIT_OPEN) - ; /* !!! ADD SOME (OPTIONAL) ANIMATIONS HERE !!! */ + DrawGraphicAnimation(SCREENX(x), SCREENY(y), IMG_SP_EXIT_OPEN); else if (element == EL_WALL_GROWING_ACTIVE) MauerWaechst(x, y); else if (element == EL_WALL_GROWING || @@ -5153,24 +4961,9 @@ void GameActions() else if (element == EL_TRAP || element == EL_TRAP_ACTIVE) CheckTrap(x, y); else if (element == EL_SP_TERMINAL) -#if 0 - DrawGraphicAnimation(x, y, GFX2_SP_TERMINAL, 7, 12, ANIM_LOOP); -#else - DrawNewGraphicAnimation(x, y, IMG_SP_TERMINAL); -#endif + DrawGraphicAnimation(SCREENX(x), SCREENY(y), IMG_SP_TERMINAL); else if (element == EL_SP_TERMINAL_ACTIVE) - { -#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 - } + DrawGraphicAnimation(SCREENX(x), SCREENY(y), IMG_SP_TERMINAL_ACTIVE); else if (IS_BELT_ACTIVE(element)) DrawBeltAnimation(x, y, element); else if (element == EL_SWITCHGATE_OPENING) @@ -5182,37 +4975,11 @@ void GameActions() else if (element == EL_TIMEGATE_CLOSING) CloseTimegate(x, y); else if (element == EL_EXTRA_TIME) -#if 0 - DrawGraphicAnimation(x, y, GFX_EXTRA_TIME, 6, 4, ANIM_LOOP); -#else - DrawNewGraphicAnimation(x, y, IMG_EXTRA_TIME); -#endif + DrawGraphicAnimation(SCREENX(x), SCREENY(y), IMG_EXTRA_TIME); else if (element == EL_SHIELD_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 - } + DrawGraphicAnimation(SCREENX(x), SCREENY(y), IMG_SHIELD_NORMAL); else if (element == EL_SHIELD_DEADLY) - { -#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); -#endif - } + DrawGraphicAnimation(SCREENX(x), SCREENY(y), IMG_SHIELD_DEADLY); if (game.magic_wall_active) { @@ -5329,13 +5096,13 @@ void GameActions() element == EL_MAGIC_WALL_FULL) { Feld[x][y] = EL_MAGIC_WALL_DEAD; - DrawNewLevelField(x, y); + DrawLevelField(x, y); } else if (element == EL_BD_MAGIC_WALL_ACTIVE || element == EL_BD_MAGIC_WALL_FULL) { Feld[x][y] = EL_BD_MAGIC_WALL_DEAD; - DrawNewLevelField(x, y); + DrawLevelField(x, y); } } @@ -5489,14 +5256,14 @@ void ScrollLevel(int dx, int dy) { x = (dx == 1 ? BX1 : BX2); for (y=BY1; y<=BY2; y++) - DrawNewScreenField(x, y); + DrawScreenField(x, y); } if (dy) { y = (dy == 1 ? BY1 : BY2); for (x=BX1; x<=BX2; x++) - DrawNewScreenField(x, y); + DrawScreenField(x, y); } redraw_mask |= REDRAW_FIELD; @@ -5728,7 +5495,11 @@ boolean MoveFigure(struct PlayerInfo *player, int dx, int dy) if (!(moved & MF_MOVING) && !player->Pushing) player->Frame = 0; else +#if 0 player->Frame = (player->Frame + 1) % 4; +#else + player->Frame += 1 * 0; +#endif if (moved & MF_MOVING) { @@ -5737,7 +5508,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); - DrawNewLevelField(jx, jy); /* for "DrawCrumbledSand()" */ + DrawLevelField(jx, jy); /* for "DrawCrumbledSand()" */ player->last_move_dir = player->MovDir; player->is_moving = TRUE; @@ -5773,6 +5544,8 @@ void ScrollFigure(struct PlayerInfo *player, int mode) { player->actual_frame_counter = FrameCounter; player->GfxPos = move_stepsize * (player->MovPos / move_stepsize); + if (player->Frame) + player->Frame += 1; if (Feld[last_jx][last_jy] == EL_EMPTY) Feld[last_jx][last_jy] = EL_PLAYER_IS_LEAVING; @@ -5785,6 +5558,7 @@ void ScrollFigure(struct PlayerInfo *player, int mode) player->MovPos += (player->MovPos > 0 ? -1 : 1) * move_stepsize; player->GfxPos = move_stepsize * (player->MovPos / move_stepsize); + player->Frame += 1; if (Feld[last_jx][last_jy] == EL_PLAYER_IS_LEAVING) Feld[last_jx][last_jy] = EL_EMPTY; @@ -6306,9 +6080,9 @@ int DigField(struct PlayerInfo *player, RemoveField(x, y); player->key[key_nr] = TRUE; RaiseScoreElement(element); - DrawNewMiniGraphicExt(drawto, DX_KEYS + key_nr * MINI_TILEX, DY_KEYS, + DrawMiniGraphicExt(drawto, DX_KEYS + key_nr * MINI_TILEX, DY_KEYS, GFX_SCHLUESSEL1 + key_nr); - DrawNewMiniGraphicExt(window, DX_KEYS + key_nr * MINI_TILEX, DY_KEYS, + DrawMiniGraphicExt(window, DX_KEYS + key_nr * MINI_TILEX, DY_KEYS, GFX_SCHLUESSEL1 + key_nr); PlaySoundLevel(x, y, SND_KEY_COLLECTING); break; @@ -6324,9 +6098,9 @@ int DigField(struct PlayerInfo *player, RemoveField(x, y); player->key[key_nr] = TRUE; RaiseScoreElement(element); - DrawNewMiniGraphicExt(drawto, DX_KEYS + key_nr * MINI_TILEX, DY_KEYS, + DrawMiniGraphicExt(drawto, DX_KEYS + key_nr * MINI_TILEX, DY_KEYS, GFX_SCHLUESSEL1 + key_nr); - DrawNewMiniGraphicExt(window, DX_KEYS + key_nr * MINI_TILEX, DY_KEYS, + DrawMiniGraphicExt(window, DX_KEYS + key_nr * MINI_TILEX, DY_KEYS, GFX_SCHLUESSEL1 + key_nr); PlaySoundLevel(x, y, SND_KEY_COLLECTING); break; @@ -6336,7 +6110,7 @@ int DigField(struct PlayerInfo *player, Feld[x][y] = EL_ROBOT_WHEEL_ACTIVE; ZX = x; ZY = y; - DrawNewLevelField(x, y); + DrawLevelField(x, y); PlaySoundLevel(x, y, SND_ROBOT_WHEEL_ACTIVATING); return MF_ACTION; break; @@ -6481,18 +6255,18 @@ int DigField(struct PlayerInfo *player, else { RemoveField(x, y); - Feld[x+dx][y+dy] = element; + Feld[x + dx][y + dy] = element; } if (element == EL_SPRING) { - Feld[x+dx][y+dy] = EL_SPRING_MOVING; - MovDir[x+dx][y+dy] = move_direction; + Feld[x + dx][y + dy] = EL_SPRING; + MovDir[x + dx][y + dy] = move_direction; } player->push_delay_value = (element == EL_SPRING ? 0 : 2 + RND(8)); - DrawNewLevelField(x + dx, y + dy); + DrawLevelField(x + dx, y + dy); PlaySoundLevelElementAction(x, y, element, SND_ACTION_PUSHING); break; @@ -6662,7 +6436,7 @@ int DigField(struct PlayerInfo *player, case EL_LAMP: Feld[x][y] = EL_LAMP_ACTIVE; local_player->lights_still_needed--; - DrawNewLevelField(x, y); + DrawLevelField(x, y); PlaySoundLevel(x, y, SND_LAMP_ACTIVATING); return MF_ACTION; break; @@ -6671,7 +6445,7 @@ 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); - DrawNewLevelField(x, y); + DrawLevelField(x, y); PlaySoundStereo(SND_TIME_ORB_FULL_COLLECTING, SOUND_MAX_RIGHT); return MF_ACTION; break; @@ -6756,8 +6530,8 @@ int DigField(struct PlayerInfo *player, player->push_delay_value = (element == EL_BALLOON ? 0 : 2); - DrawNewLevelField(x, y); - DrawNewLevelField(x + dx, y + dy); + DrawLevelField(x, y); + DrawLevelField(x + dx, y + dy); if (IS_SB_ELEMENT(element) && local_player->sokobanfields_still_needed == 0 && @@ -6815,7 +6589,7 @@ boolean SnapField(struct PlayerInfo *player, int dx, int dy) return FALSE; player->snapped = TRUE; - DrawNewLevelField(x, y); + DrawLevelField(x, y); BackToFront(); return TRUE; @@ -6847,18 +6621,10 @@ 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); + DrawGraphic(SCREENX(jx), SCREENY(jy), IMG_SP_DISK_RED, 0); else - DrawNewGraphicThruMask(SCREENX(jx), SCREENY(jy), - IMG_DYNAMITE_ACTIVE, 0); -#endif + DrawGraphicThruMask(SCREENX(jx), SCREENY(jy), IMG_DYNAMITE_ACTIVE, 0); } PlaySoundLevel(jx, jy, SND_DYNAMITE_DROPPING); @@ -6870,12 +6636,7 @@ boolean PlaceBomb(struct PlayerInfo *player) 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 + DrawGraphicThruMask(SCREENX(jx), SCREENY(jy), el2img(Feld[jx][jy]), 0); PlaySoundLevel(jx, jy, SND_DYNABOMB_DROPPING); } @@ -7086,7 +6847,7 @@ void CreateGameButtons() for (i=0; i