From: Holger Schemel Date: Tue, 7 Feb 2006 20:43:37 +0000 (+0100) Subject: rnd-20060207-2-src X-Git-Tag: 3.2.0^2~74 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=12d0853b94327eae62e9ff35f66c6a71976bbab0;p=rocksndiamonds.git rnd-20060207-2-src * added scroll delay (as configured in setup) to EMC graphics engine --- diff --git a/ChangeLog b/ChangeLog index 66f05732..7d12a88e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,6 @@ +2006-02-07 + * added scroll delay (as configured in setup) to EMC graphics engine + 2006-02-06 * improved screen redraw for EMC graphics engine (faster and smoother) * when not scrolling, do not redraw the whole playfield if not needed diff --git a/src/conftime.h b/src/conftime.h index 3a96329a..703f3df0 100644 --- a/src/conftime.h +++ b/src/conftime.h @@ -1 +1 @@ -#define COMPILE_DATE_STRING "[2006-02-07 01:20]" +#define COMPILE_DATE_STRING "[2006-02-07 21:40]" diff --git a/src/files.c b/src/files.c index 4ff5c649..ea169389 100644 --- a/src/files.c +++ b/src/files.c @@ -3144,6 +3144,15 @@ static void LoadLevel_InitVersion(struct LevelInfo *level, char *filename) if (leveldir_current == NULL) /* only when dumping level */ return; + /* all engine modifications also valid for levels which use latest engine */ +#if 1 + if (level->game_version < VERSION_IDENT(3,2,0,5)) + { + /* time bonus score was given for 10 s instead of 1 s before 3.2.0-5 */ + level->score[SC_TIME_BONUS] /= 10; + } +#endif + if (leveldir_current->latest_engine) { /* ---------- use latest game engine ----------------------------------- */ @@ -3206,8 +3215,10 @@ static void LoadLevel_InitVersion(struct LevelInfo *level, char *filename) /* extra time score was same value as time left score before 3.2.0-5 */ level->extra_time_score = level->score[SC_TIME_BONUS]; +#if 0 /* time bonus score was given for 10 s instead of 1 s before 3.2.0-5 */ level->score[SC_TIME_BONUS] /= 10; +#endif } /* only few elements were able to actively move into acid before 3.1.0 */ diff --git a/src/game_em/graphics.c b/src/game_em/graphics.c index cc746c0c..be63a3ba 100644 --- a/src/game_em/graphics.c +++ b/src/game_em/graphics.c @@ -9,8 +9,13 @@ unsigned int frame; /* current screen frame */ +#if 0 unsigned int screen_x; /* current scroll position */ unsigned int screen_y; +#else +int screen_x; /* current scroll position */ +int screen_y; +#endif /* tiles currently on screen */ static unsigned int screentiles[MAX_BUF_YSIZE][MAX_BUF_XSIZE]; @@ -444,26 +449,57 @@ void game_initscreen(void) void RedrawPlayfield_EM() { - unsigned int i, x, y; + int i, sx, sy; + +#if 1 + + int screen_x_min = TILEX; + int screen_y_min = TILEY; + int screen_x_max = (lev.width - (SCR_FIELDX - 1)) * TILEX; + int screen_y_max = (lev.height - (SCR_FIELDY - 1)) * TILEY; + int offset = (setup.scroll_delay ? 3 : 0) * TILEX; + int stepsize = TILEX / 8; + int nr = 0; /* !!! FIX THIS (CENTERED TO PLAYER 1) !!! */ + + sx = (frame * ply[nr].oldx + (8 - frame) * ply[nr].x) * stepsize + - ((SCR_FIELDX - 1) * TILEX) / 2; + sy = (frame * ply[nr].oldy + (8 - frame) * ply[nr].y) * stepsize + - ((SCR_FIELDY - 1) * TILEY) / 2; + + /* calculate new screen scrolling position, with regard to scroll delay */ + screen_x = (sx < screen_x - offset ? sx + offset : + sx > screen_x + offset ? sx - offset : screen_x); + screen_y = (sy < screen_y - offset ? sy + offset : + sy > screen_y + offset ? sy - offset : screen_y); + + /* check minimal and maximal boundaries for screen scrolling position */ + screen_x = (screen_x < screen_x_min ? screen_x_min : + screen_x > screen_x_max ? screen_x_max : screen_x); + screen_y = (screen_y < screen_y_min ? screen_y_min : + screen_y > screen_y_max ? screen_y_max : screen_y); + +#else /* !!! FIX THIS (CENTERED TO PLAYER 1) !!! */ - x = (frame * ply[0].oldx + (8 - frame) * ply[0].x) * TILEX / 8 + sx = (frame * ply[0].oldx + (8 - frame) * ply[0].x) * TILEX / 8 + ((SCR_FIELDX - 1) * TILEX) / 2; - y = (frame * ply[0].oldy + (8 - frame) * ply[0].y) * TILEY / 8 + sy = (frame * ply[0].oldy + (8 - frame) * ply[0].y) * TILEY / 8 + ((SCR_FIELDY - 1) * TILEY) / 2; - if (x > lev.width * TILEX) - x = lev.width * TILEX; - if (y > lev.height * TILEY) - y = lev.height * TILEY; + if (sx > lev.width * TILEX) + sx = lev.width * TILEX; + if (sy > lev.height * TILEY) + sy = lev.height * TILEY; - if (x < SCR_FIELDX * TILEX) - x = SCR_FIELDX * TILEY; - if (y < SCR_FIELDY * TILEY) - y = SCR_FIELDY * TILEY; + if (sx < SCR_FIELDX * TILEX) + sx = SCR_FIELDX * TILEY; + if (sy < SCR_FIELDY * TILEY) + sy = SCR_FIELDY * TILEY; - screen_x = x - (SCR_FIELDX - 1) * TILEX; - screen_y = y - (SCR_FIELDY - 1) * TILEY; + screen_x = sx - (SCR_FIELDX - 1) * TILEX; + screen_y = sy - (SCR_FIELDY - 1) * TILEY; + +#endif animscreen(); diff --git a/src/tools.c b/src/tools.c index 4711961d..dacee512 100644 --- a/src/tools.c +++ b/src/tools.c @@ -737,11 +737,14 @@ inline static void DrawGraphicShiftedDouble(int x, int y, int dx, int dy, int y2 = y + SIGN(dy); int anim_frames = graphic_info[graphic].anim_frames; int sync_frame = (dx ? ABS(dx) : ABS(dy)) * anim_frames / TILESIZE; + boolean draw_start_tile = (cut_mode != CUT_ABOVE); /* only for falling! */ + boolean draw_end_tile = (cut_mode != CUT_BELOW); /* only for falling! */ /* re-calculate animation frame for two-tile movement animation */ frame = getGraphicAnimationFrame(graphic, sync_frame); - if (IN_SCR_FIELD(x1, y1)) /* movement start graphic inside screen area */ + /* check if movement start graphic inside screen area and should be drawn */ + if (draw_start_tile && IN_SCR_FIELD(x1, y1)) { getGraphicSourceExt(graphic, frame, &src_bitmap, &src_x, &src_y, TRUE); @@ -762,7 +765,8 @@ inline static void DrawGraphicShiftedDouble(int x, int y, int dx, int dy, MarkTileDirty(x1, y1); } - if (IN_SCR_FIELD(x2, y2)) /* movement end graphic inside screen area */ + /* check if movement end graphic inside screen area and should be drawn */ + if (draw_end_tile && IN_SCR_FIELD(x2, y2)) { getGraphicSourceExt(graphic, frame, &src_bitmap, &src_x, &src_y, FALSE);