From: Holger Schemel Date: Wed, 25 Nov 2009 22:17:03 +0000 (+0100) Subject: rnd-20091125-1-src X-Git-Tag: 3.3.0.0^2~60 X-Git-Url: https://git.artsoft.org/?p=rocksndiamonds.git;a=commitdiff_plain;h=843029e7c2253a35aa1b4ac87241978808b9e6fc rnd-20091125-1-src * fixed bugs in (auto)scrolling behaviour when passing ports or when wrapping around the playfield through "holes" in the playfield border --- diff --git a/ChangeLog b/ChangeLog index dd42c76d..a7eee8fe 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2009-11-25 + * fixed bugs in (auto)scrolling behaviour when passing ports or when + wrapping around the playfield through "holes" in the playfield border + 2009-11-24 * changed internal playfield bitmap handling from playfield sized bitmap to screen sized bitmap (visible scrolling area), therefore speeding up diff --git a/src/conftime.h b/src/conftime.h index abed863e..e06dc1c5 100644 --- a/src/conftime.h +++ b/src/conftime.h @@ -1 +1 @@ -#define COMPILE_DATE_STRING "2009-11-24 23:00" +#define COMPILE_DATE_STRING "2009-11-25 23:12" diff --git a/src/game_sp/DDScrollBuffer.c b/src/game_sp/DDScrollBuffer.c index fdc925f2..6df6f1e2 100644 --- a/src/game_sp/DDScrollBuffer.c +++ b/src/game_sp/DDScrollBuffer.c @@ -129,6 +129,31 @@ static void ScrollPlayfieldIfNeededExt(boolean reset) return; } +#if 1 + + /* check if scrolling the playfield requires redrawing the viewport bitmap */ + if ((mScrollX != mScrollX_last || + mScrollY != mScrollY_last) && + (ABS(mScrollX - mScrollX_last) >= TILEX || + ABS(mScrollY - mScrollY_last) >= TILEY)) + { + int dx = (ABS(mScrollX - mScrollX_last) < TILEX ? 0 : + mScrollX < mScrollX_last ? 1 : mScrollX > mScrollX_last ? -1 : 0); + int dy = (ABS(mScrollY - mScrollY_last) < TILEY ? 0 : + mScrollY < mScrollY_last ? 1 : mScrollY > mScrollY_last ? -1 : 0); + + mScrollX_last -= dx * TILEX; + mScrollY_last -= dy * TILEY; + + ScrollPlayfield(dx, dy); + +#if 0 + printf("::: %ld, %ld\n", mScrollX, mScrollY); +#endif + } + +#else + /* check if scrolling the playfield reached the destination tile position */ if ((mScrollX != mScrollX_last || mScrollY != mScrollY_last) && mScrollX % TILEX == 0 && mScrollY % TILEY == 0) @@ -140,7 +165,13 @@ static void ScrollPlayfieldIfNeededExt(boolean reset) mScrollY_last = mScrollY; ScrollPlayfield(dx, dy); + +#if 0 + printf("::: %ld, %ld\n", mScrollX, mScrollY); +#endif } + +#endif } static void ScrollPlayfieldIfNeeded() @@ -332,10 +363,22 @@ void DDScrollBuffer_Cls(int BackColor) void BlitScreenToBitmap_SP(Bitmap *target_bitmap) { +#if 0 + int px = 2 * TILEX + mScrollX % TILEX; + int py = 2 * TILEY + mScrollY % TILEY; +#else int px = 2 * TILEX + (mScrollX - mScrollX_last) % TILEX; int py = 2 * TILEY + (mScrollY - mScrollY_last) % TILEY; +#endif int sx, sy, sxsize, sysize; +#if 0 + if (mScrollX % TILEX != (mScrollX - mScrollX_last) % TILEX || + mScrollY % TILEY != (mScrollY - mScrollY_last) % TILEY) + printf("::: %ld, %ld / %ld, %ld\n", + mScrollX, mScrollY, mScrollX_last, mScrollY_last); +#endif + #if 1 int xsize = SXSIZE; int ysize = SYSIZE; @@ -781,8 +824,8 @@ void DDScrollBuffer_ScrollTowards(int X, int Y, double Step) return; #if 0 - printf("::: DDScrollBuffer.c: DDScrollBuffer_ScrollTowards(): (1) mScroll: %ld, %ld [%d, %d, %f]\n", - mScrollX, mScrollY, X, Y, Step); + printf("::: DDScrollBuffer.c: DDScrollBuffer_ScrollTowards(): (1) mScroll: %ld, %ld [%d, %d, %f, %f]\n", + mScrollX, mScrollY, X, Y, Step, Stretch); #endif X = X / Stretch; diff --git a/src/game_sp/MainGameLoop.c b/src/game_sp/MainGameLoop.c index 42bafa50..38f76fc7 100644 --- a/src/game_sp/MainGameLoop.c +++ b/src/game_sp/MainGameLoop.c @@ -581,6 +581,21 @@ int subCalculateScreenScrollPos() int ax, Ay; +#if 1 + int jump_pos = TILEX / 2; + + if (MurphyScreenXPos < -jump_pos) + { + MurphyScreenXPos = FieldWidth * TILEX + MurphyScreenXPos; + MurphyScreenYPos -= TILEY; + } + else if (MurphyScreenXPos >= FieldWidth * TILEX - jump_pos) + { + MurphyScreenXPos = MurphyScreenXPos - FieldWidth * TILEX; + MurphyScreenYPos += TILEY; + } +#endif + if (ExplosionShake != 0) { subGetRandomNumber();