X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Fgame.c;h=dbc5458281c82836719c2db85724588faebd3b11;hb=33df7a5ca87e883c2b718171fd7d05c22fc0353f;hp=15c379531fc488fc94a14f84cc5b0c02b7d6cc5e;hpb=cf5b3a1e9077e88eb40ce2fb59e985a0ae037c84;p=rocksndiamonds.git diff --git a/src/game.c b/src/game.c index 15c37953..dbc54582 100644 --- a/src/game.c +++ b/src/game.c @@ -75,6 +75,7 @@ void InitGame() TimeFrames = 0; TimeLeft = level.time; PlayerMovDir = MV_NO_MOVING; + PlayerMovPos = 0; PlayerFrame = 0; PlayerPushing = FALSE; PlayerGone = LevelSolved = GameOver = SiebAktiv = FALSE; @@ -2386,7 +2387,7 @@ void EdelsteinFunkeln(int x, int y) MovDelay[x][y]--; if (direct_draw_on && MovDelay[x][y]) - drawto_field = backbuffer; + SetDrawtoField(DRAW_BUFFERED); DrawGraphic(SCROLLX(x),SCROLLY(y), el2gfx(Feld[x][y])); @@ -2397,8 +2398,8 @@ void EdelsteinFunkeln(int x, int y) src_x = SX+GFX_PER_LINE*TILEX; src_y = SY+(phase > 2 ? 4-phase : phase)*TILEY; - dest_x = SX+SCROLLX(x)*TILEX; - dest_y = SY+SCROLLY(y)*TILEY; + dest_x = FX+SCROLLX(x)*TILEX; + dest_y = FY+SCROLLY(y)*TILEY; XSetClipOrigin(display,clip_gc[PIX_BACK],dest_x-src_x,dest_y-src_y); XCopyArea(display,pix[PIX_BACK],drawto_field,clip_gc[PIX_BACK], @@ -2406,9 +2407,9 @@ void EdelsteinFunkeln(int x, int y) if (direct_draw_on) { - XCopyArea(display,backbuffer,window,gc, + XCopyArea(display,drawto_field,window,gc, dest_x,dest_y, TILEX,TILEY, dest_x,dest_y); - drawto_field = window; + SetDrawtoField(DRAW_DIRECT); } } } @@ -2564,7 +2565,23 @@ void GameActions() action_delay_value = (tape.playing && tape.fast_forward ? FFWD_FRAME_DELAY : Gamespeed); + /* if (DelayReached(&action_delay, action_delay_value)) + */ + + + + if (PlayerMovPos) + ScrollFigure(0); + + DrawPlayerField(); + + + + + if (!DelayReached(&action_delay, action_delay_value)) + return; + { int x,y,element; int sieb_x = 0, sieb_y = 0; @@ -2696,6 +2713,14 @@ void GameActions() } } } + + /* + if (PlayerMovPos) + ScrollFigure(0); + + DrawPlayerField(); + */ + } if (TimeLeft>0 && TimeFrames>=25 && !tape.pausing) @@ -2715,32 +2740,53 @@ void GameActions() KillHero(); } + /* + if (PlayerMovPos) + ScrollFigure(0); + */ + + + /* + DrawPlayerField(); + */ + + BackToFront(); } void ScrollLevel(int dx, int dy) { int x,y; + int softscroll_offset = (FX == TILEX ? TILEX : 0); + + if (soft_scrolling_on) + { + ScreenMovPos = PlayerMovPos; + redraw_mask |= REDRAW_FIELD; + } XCopyArea(display,drawto_field,drawto_field,gc, - SX+TILEX*(dx==-1),SY+TILEY*(dy==-1), - SXSIZE-TILEX*(dx!=0),SYSIZE-TILEY*(dy!=0), - SX+TILEX*(dx==1),SY+TILEY*(dy==1)); + FX + TILEX*(dx==-1) - softscroll_offset, + FY + TILEY*(dy==-1) - softscroll_offset, + SXSIZE - TILEX*(dx!=0) + 2*softscroll_offset, + SYSIZE - TILEY*(dy!=0) + 2*softscroll_offset, + FX + TILEX*(dx==1) - softscroll_offset, + FY + TILEY*(dy==1) - softscroll_offset); if (dx) { - x = (dx==1 ? 0 : SCR_FIELDX-1); - for(y=0;y 0 || dy > 0 ? -1 : 1) * 3*TILEX/4; ScrollFigure(-1); @@ -2897,7 +2942,9 @@ BOOL MoveFigure(int dx, int dy) TestIfHeroHitsBadThing(); + /* BackToFront(); + */ if (PlayerGone) RemoveHero(); @@ -2908,10 +2955,29 @@ BOOL MoveFigure(int dx, int dy) void ScrollFigure(int init) { static long actual_frame_counter; + static int oldX = -1, oldY = -1; if (init) { + if (PlayerMovPos && oldX != -1 && oldY != -1) + { + DrawLevelElement(oldX,oldY, Feld[oldX][oldY]); + DrawPlayerField(); + } + + oldX = JX2; + oldY = JY2; actual_frame_counter = FrameCounter; + + redraw[redraw_x1 + oldX][redraw_y1 + oldY] = 1; + redraw_tiles++; + + /* + DrawLevelElement(oldX,oldY, Feld[oldX][oldY]); + */ + + DrawPlayerField(); + return; } else if (!FrameReached(&actual_frame_counter,1)) @@ -2919,8 +2985,20 @@ void ScrollFigure(int init) PlayerMovPos += (PlayerMovPos > 0 ? -1 : 1) * TILEX/4; - DrawLevelElement(JX2,JY2, Feld[JX2][JY2]); + if (ScreenMovPos) + { + ScreenMovPos = PlayerMovPos; + redraw_mask |= REDRAW_FIELD; + } + + DrawLevelElement(oldX,oldY, Feld[oldX][oldY]); DrawPlayerField(); + + if (!PlayerMovPos) + { + JX2 = JX; + JY2 = JY; + } } void TestIfGoodThingHitsBadThing(int goodx, int goody) @@ -3493,7 +3571,6 @@ void RaiseScore(int value) { Score += value; DrawText(DX_SCORE,DY_SCORE,int2str(Score,5),FS_SMALL,FC_YELLOW); - BackToFront(); } void RaiseScoreElement(int element)