X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Fgame.c;h=56cb38b2a363d17f719130ff276301cc5b8ef44f;hb=a4eaa7fcd8ca604faeee50f049c441415aa4968c;hp=5dd55c76ffa8391c9c2acb1af3ec3b542da531b9;hpb=9091c797c4a3abb34ceb98d80a82ae7310708fbb;p=rocksndiamonds.git diff --git a/src/game.c b/src/game.c index 5dd55c76..56cb38b2 100644 --- a/src/game.c +++ b/src/game.c @@ -795,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; @@ -1213,7 +1214,7 @@ void GameWon() #endif /* Hero disappears */ - DrawLevelField(ExitX, ExitY); + DrawNewLevelField(ExitX, ExitY); BackToFront(); if (tape.playing) @@ -1329,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) @@ -1441,22 +1445,31 @@ 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]); +#else + int graphic = el2img(Feld[x][y]); +#endif int phase; 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 (Feld[x][y] == EL_DYNAMITE_ACTIVE) { @@ -1469,12 +1482,29 @@ void DrawDynamite(int x, int y) phase = 7 - phase; } +#if 1 + phase = getNewGraphicAnimationFrame(graphic, 96 - MovDelay[x][y]); +#endif + + /* + printf("-> %d: %d [%d]\n", graphic, phase, 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); else DrawGraphic(sx, sy, graphic + phase); +#else + if (game.emulation == EMU_SUPAPLEX) + DrawNewGraphic(sx, sy, IMG_SP_DISK_RED, 0); + else if (Store[x][y]) + DrawNewGraphicThruMask(sx, sy, graphic, phase); + else + DrawNewGraphic(sx, sy, graphic, phase); +#endif } void CheckDynamite(int x, int y) @@ -2723,6 +2753,8 @@ void StartMoving(int x, int y) if (Stop[x][y]) return; + GfxAction[x][y] = GFX_ACTION_DEFAULT; + if (CAN_FALL(element) && y0 && IS_PLAYER(x-1, y)) || (x 0 && IS_MOVING(x, y-1) && MovDir[x][y-1] == MV_DOWN) DrawLevelField(x, y-1); else - DrawGraphicAnimation(x, y, GFX_GEBLUBBER, 4, 10, ANIM_NORMAL); + DrawGraphicAnimation(x, y, GFX_GEBLUBBER, 4, 10, ANIM_LOOP); } void NussKnacken(int x, int y) @@ -4500,7 +4533,7 @@ static void DrawBeltAnimation(int x, int y, int element) if (belt_dir != MV_NO_MOVING) { 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); @@ -4858,10 +4891,10 @@ void GameActions() 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); + DrawGraphicAnimation(x, y, GFX2_SP_TERMINAL, 7, 12, ANIM_LOOP); else if (element == EL_SP_TERMINAL_ACTIVE) { - DrawGraphicAnimation(x, y, GFX2_SP_TERMINAL_ACTIVE, 7, 4, ANIM_NORMAL); + DrawGraphicAnimation(x, y, GFX2_SP_TERMINAL_ACTIVE, 7, 4, ANIM_LOOP); #if 0 if (!(FrameCounter % 4)) PlaySoundLevel(x, y, SND_SP_TERMINAL_ACTIVE); @@ -4878,10 +4911,10 @@ 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); + DrawGraphicAnimation(x, y, GFX_EXTRA_TIME, 6, 4, ANIM_LOOP); else if (element == EL_SHIELD_NORMAL) { - DrawGraphicAnimation(x, y, GFX_SHIELD_PASSIVE, 6, 4, ANIM_NORMAL); + DrawGraphicAnimation(x, y, GFX_SHIELD_PASSIVE, 6, 4, ANIM_LOOP); #if 0 if (!(FrameCounter % 4)) PlaySoundLevel(x, y, SND_SHIELD_PASSIVE_ACTIVATED); @@ -4889,7 +4922,7 @@ void GameActions() } else if (element == EL_SHIELD_DEADLY) { - DrawGraphicAnimation(x, y, GFX_SHIELD_ACTIVE, 6, 4, ANIM_NORMAL); + DrawGraphicAnimation(x, y, GFX_SHIELD_ACTIVE, 6, 4, ANIM_LOOP); #if 0 if (!(FrameCounter % 4)) PlaySoundLevel(x, y, SND_SHIELD_DEADLY_ACTIVE);