From: Holger Schemel Date: Sat, 17 Apr 2010 21:24:08 +0000 (+0200) Subject: rnd-20100417-2-src X-Git-Tag: 3.3.0.0^2~9 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=97fb6c2a140f361991541bcf5a5c1e5d18deaf74;p=rocksndiamonds.git rnd-20100417-2-src --- diff --git a/src/conftime.h b/src/conftime.h index aa3503a0..631c6c00 100644 --- a/src/conftime.h +++ b/src/conftime.h @@ -1 +1 @@ -#define COMPILE_DATE_STRING "2010-04-17 10:50" +#define COMPILE_DATE_STRING "2010-04-17 23:20" diff --git a/src/events.c b/src/events.c index 3284723c..9a42eb47 100644 --- a/src/events.c +++ b/src/events.c @@ -871,6 +871,12 @@ void HandleKey(Key key, int key_status) case KSYM_0: GameFrameDelay = (GameFrameDelay == 500 ? GAME_FRAME_DELAY : 500); break; + + case KSYM_b: + setup.sp_show_border_elements = !setup.sp_show_border_elements; + printf("Supaplex border elements %s\n", + setup.sp_show_border_elements ? "enabled" : "disabled"); + break; #endif default: diff --git a/src/game_sp/DDScrollBuffer.c b/src/game_sp/DDScrollBuffer.c index 70c4c5a6..80cddf0d 100644 --- a/src/game_sp/DDScrollBuffer.c +++ b/src/game_sp/DDScrollBuffer.c @@ -106,8 +106,13 @@ static void ScrollPlayfieldIfNeededExt(boolean reset) if (mScrollX_last == -1 || mScrollY_last == -1) { +#if 1 + mScrollX_last = (mScrollX / TILESIZE) * TILESIZE; + mScrollY_last = (mScrollY / TILESIZE) * TILESIZE; +#else mScrollX_last = mScrollX; mScrollY_last = mScrollY; +#endif return; } @@ -223,10 +228,12 @@ void BlitScreenToBitmap_SP(Bitmap *target_bitmap) int sx, sy, sxsize, sysize; #if 1 - printf("::: %d, %d - %d, %d - %ld, %ld\n", + printf("::: %d, %d / %d, %d / %ld, %ld (%ld, %ld) / %d, %d\n", MurphyScreenXPos, MurphyScreenYPos, ScreenScrollXPos, ScreenScrollYPos, - mScrollX, mScrollY); + mScrollX, mScrollY, + mScrollX_last, mScrollY_last, + px, py); #endif int xsize = SXSIZE; @@ -239,6 +246,20 @@ void BlitScreenToBitmap_SP(Bitmap *target_bitmap) sx = SX + (full_xsize < xsize ? (xsize - full_xsize) / 2 : 0); sy = SY + (full_ysize < ysize ? (ysize - full_ysize) / 2 : 0); +#if 1 +#if 1 + { + px += game_sp.scroll_xoffset; + py += game_sp.scroll_yoffset; + } +#else + if (1) + { + px += TILEX / 2; + py += TILEY / 2; + } +#endif +#else #if 1 if (0 && !menBorder) { @@ -257,6 +278,7 @@ void BlitScreenToBitmap_SP(Bitmap *target_bitmap) px += TILEX / 2; py += TILEY / 2; } +#endif #endif BlitBitmap(bitmap_db_field_sp, target_bitmap, px, py, sxsize, sysize, sx, sy); diff --git a/src/game_sp/MainForm.c b/src/game_sp/MainForm.c index 9f0b6cb5..ec0ba33d 100644 --- a/src/game_sp/MainForm.c +++ b/src/game_sp/MainForm.c @@ -197,6 +197,30 @@ void SetScrollEdges() ScrollMaxX -= TILEX / 2; ScrollMaxY -= TILEY / 2; } +#if 1 + { + ScrollMinX -= game_sp.scroll_xoffset; + ScrollMaxX -= game_sp.scroll_xoffset; + ScrollMinY -= game_sp.scroll_yoffset; + ScrollMaxY -= game_sp.scroll_yoffset; + } +#else + if (1) + { + ScrollMinX -= TILEX / 2; + ScrollMaxX -= TILEX / 2; + ScrollMinY -= TILEY / 2; + ScrollMaxY -= TILEY / 2; + } +#endif +#else + if (!menBorder) + { + ScrollMinX += TILEX / 2; + ScrollMinY += TILEY / 2; + ScrollMaxX -= TILEX / 2; + ScrollMaxY -= TILEY / 2; + } #endif #else diff --git a/src/game_sp/export.h b/src/game_sp/export.h index b5c0d0bb..fe5995fd 100644 --- a/src/game_sp/export.h +++ b/src/game_sp/export.h @@ -111,6 +111,8 @@ struct GameInfo_SP /* needed for engine snapshots */ int preceding_buffer_size; + + int scroll_xoffset, scroll_yoffset; }; struct DemoInfo_SP diff --git a/src/game_sp/main.c b/src/game_sp/main.c index 42f5f753..a29d6205 100644 --- a/src/game_sp/main.c +++ b/src/game_sp/main.c @@ -28,6 +28,9 @@ void InitGameEngine_SP() menBorder = setup.sp_show_border_elements; + game_sp.scroll_xoffset = (EVEN(SCR_FIELDX) ? TILEX / 2 : 0); + game_sp.scroll_yoffset = (EVEN(SCR_FIELDY) ? TILEY / 2 : 0); + for (x = 0; x < SP_MAX_PLAYFIELD_WIDTH; x++) { for (y = 0; y < SP_MAX_PLAYFIELD_HEIGHT; y++) diff --git a/src/libgame/types.h b/src/libgame/types.h index d6f49bdd..6e55364c 100644 --- a/src/libgame/types.h +++ b/src/libgame/types.h @@ -58,6 +58,14 @@ typedef unsigned char byte; #define SIGN(a) ((a) < 0 ? -1 : ((a) > 0 ? 1 : 0)) #endif +#ifndef ODD +#define ODD(a) (((a) & 1) == 1) +#endif + +#ifndef EVEN +#define EVEN(a) (((a) & 1) == 0) +#endif + #define SIZEOF_ARRAY(array, type) (sizeof(array) / sizeof(type)) #define SIZEOF_ARRAY_INT(array) SIZEOF_ARRAY(array, int)