From 9973503db7520dec9ef97986c317ffeafb273cf2 Mon Sep 17 00:00:00 2001 From: Holger Schemel Date: Fri, 7 Sep 2007 21:59:57 +0200 Subject: [PATCH] rnd-20070907-2-src * fixed (experimental only) redrawing of every tile per frame (even if unneeded) for the extended (R'n'D based) EMC graphics engine --- ChangeLog | 4 ++++ src/conftime.h | 2 +- src/editor.c | 6 ++++++ src/engines.h | 2 +- src/game_em/graphics.c | 5 ++++- src/tools.c | 36 +++++++++++++++++++++++++++++++++--- 6 files changed, 49 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index 3c7b8dc3..971e771f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2007-09-07 + * fixed (experimental only) redrawing of every tile per frame (even if + unneeded) for the extended (R'n'D based) EMC graphics engine + 2007-09-03 * fixed bug with displaying background for title messages on info screen * some code cleanup for the extended (R'n'D based) EMC graphics engine diff --git a/src/conftime.h b/src/conftime.h index 83befca2..567075b8 100644 --- a/src/conftime.h +++ b/src/conftime.h @@ -1 +1 @@ -#define COMPILE_DATE_STRING "2007-09-06 23:38" +#define COMPILE_DATE_STRING "2007-09-07 21:55" diff --git a/src/editor.c b/src/editor.c index ac7b42de..fe8976f2 100644 --- a/src/editor.c +++ b/src/editor.c @@ -7066,6 +7066,12 @@ void DrawLevelEd() BlitBitmap(drawto, bitmap_db_door, DX, DY, DXSIZE, DYSIZE, DOOR_GFX_PAGEX1, DOOR_GFX_PAGEY1); +#if 1 + /* draw new control window (with border) to window */ + redraw_mask |= REDRAW_ALL; + BackToFront(); +#endif + OpenDoor(DOOR_OPEN_1); } diff --git a/src/engines.h b/src/engines.h index 72eb3214..156a6398 100644 --- a/src/engines.h +++ b/src/engines.h @@ -34,7 +34,7 @@ extern int getGameFrameDelay_EM(int); extern void PlayLevelSound_EM(int, int, int, int); extern void InitGraphicInfo_EM(void); -void SetGfxAnimation_EM(int, int, int, int); +void SetGfxAnimation_EM(struct GraphicInfo_EM *, int, int, int, int); void getGraphicSourceObjectExt_EM(struct GraphicInfo_EM *, int, int, int, int); void getGraphicSourcePlayerExt_EM(struct GraphicInfo_EM *, int, int, int); diff --git a/src/game_em/graphics.c b/src/game_em/graphics.c index 124be8fd..29d9e15d 100644 --- a/src/game_em/graphics.c +++ b/src/game_em/graphics.c @@ -354,7 +354,8 @@ static void animscreen(void) if (!game.use_native_emc_graphics_engine) for (y = 2; y < EM_MAX_CAVE_HEIGHT - 2; y++) for (x = 2; x < EM_MAX_CAVE_WIDTH - 2; x++) - SetGfxAnimation_EM(Draw[y][x], 7 - frame, x - 2, y - 2); + SetGfxAnimation_EM(&graphic_info_em_object[Draw[y][x]][frame], + Draw[y][x], 7 - frame, x - 2, y - 2); for (y = top; y < top + MAX_BUF_YSIZE; y++) { @@ -391,9 +392,11 @@ static void animscreen(void) redraw_screen_tile = (screentiles[sy][sx] != obj || crumbled_state[sy][sx] != crm); +#if 0 /* !!! TEST ONLY -- CHANGE THIS !!! */ if (!game.use_native_emc_graphics_engine) redraw_screen_tile = TRUE; +#endif /* only redraw screen tiles if they (or their crumbled state) changed */ if (redraw_screen_tile) diff --git a/src/tools.c b/src/tools.c index d950959c..7e2c3752 100644 --- a/src/tools.c +++ b/src/tools.c @@ -6091,9 +6091,19 @@ void ResetGfxAnimation_EM(int x, int y, int tile) GfxFrame[x][y] = 0; } -void SetGfxAnimation_EM(int tile, int frame_em, int x, int y) +void SetGfxAnimation_EM(struct GraphicInfo_EM *g_em, + int tile, int frame_em, int x, int y) { int action = object_mapping[tile].action; +#if 1 + int direction = object_mapping[tile].direction; + int effective_element = get_effective_element_EM(tile, frame_em); + int graphic = (direction == MV_NONE ? + el_act2img(effective_element, action) : + el_act_dir2img(effective_element, action, direction)); + struct GraphicInfo *g = &graphic_info[graphic]; + int sync_frame; +#endif boolean action_removing = (action == ACTION_DIGGING || action == ACTION_SNAPPING || action == ACTION_COLLECTING); @@ -6136,13 +6146,33 @@ void SetGfxAnimation_EM(int tile, int frame_em, int x, int y) { GfxFrame[x][y]++; } + +#if 1 + if (graphic_info[graphic].anim_global_sync) + sync_frame = FrameCounter; + else if (IN_FIELD(x, y, MAX_LEV_FIELDX, MAX_LEV_FIELDY)) + sync_frame = GfxFrame[x][y]; + else + sync_frame = 0; /* playfield border (pseudo steel) */ + + SetRandomAnimationValue(x, y); + + int frame = getAnimationFrame(g->anim_frames, + g->anim_delay, + g->anim_mode, + g->anim_start_frame, + sync_frame); + + g_em->unique_identifier = + (graphic << 16) | ((frame % 8) << 12) | (g_em->width << 6) | g_em->height; +#endif } void getGraphicSourceObjectExt_EM(struct GraphicInfo_EM *g_em, int tile, int frame_em, int x, int y) { - int action = object_mapping[tile].action; - int direction = object_mapping[tile].direction; + int action = object_mapping[tile].action; + int direction = object_mapping[tile].direction; int effective_element = get_effective_element_EM(tile, frame_em); int graphic = (direction == MV_NONE ? el_act2img(effective_element, action) : -- 2.34.1