X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Ftools.c;h=66796da98780e401a25d3c90a10a152e2f5a70a9;hb=7b61c9f3ee0fb13b190dba016923ebcd547c4f27;hp=ea92646c6baecc36ebe2dc47d567e455f55f7ae0;hpb=9ea8b203a29569f4d2ed059d33def627ff2b17aa;p=rocksndiamonds.git diff --git a/src/tools.c b/src/tools.c index ea92646c..66796da9 100644 --- a/src/tools.c +++ b/src/tools.c @@ -298,59 +298,59 @@ void SetDrawtoField(int mode) #if 1 -void RedrawPlayfield(boolean force_redraw, int x, int y, int width, int height) +static void RedrawPlayfield_RND() { - if (game_status == GAME_MODE_PLAYING && - level.game_engine_type == GAME_ENGINE_TYPE_EM) - { - /* currently there is no partial redraw -- always redraw whole playfield */ - RedrawPlayfield_EM(TRUE); - - /* blit playfield from scroll buffer to normal back buffer for fading in */ - BlitScreenToBitmap_EM(backbuffer); - } - else if (game_status == GAME_MODE_PLAYING && - level.game_engine_type == GAME_ENGINE_TYPE_SP) - { - /* currently there is no partial redraw -- always redraw whole playfield */ - RedrawPlayfield_SP(TRUE); + if (game.envelope_active) + return; - /* blit playfield from scroll buffer to normal back buffer for fading in */ - BlitScreenToBitmap_SP(backbuffer); - } - else if (game_status == GAME_MODE_PLAYING && - !game.envelope_active) - { -#if 0 - DrawLevel(); +#if 1 + DrawLevel(REDRAW_ALL); #else + int x, y; - SetMainBackgroundImage(IMG_BACKGROUND_PLAYING); - // SetDrawBackgroundMask(REDRAW_FIELD); // !!! CHECK THIS !!! + SetMainBackgroundImage(IMG_BACKGROUND_PLAYING); + // SetDrawBackgroundMask(REDRAW_FIELD); // !!! CHECK THIS !!! + SetDrawBackgroundMask(REDRAW_ALL); // !!! CHECK THIS !!! - for (x = BX1; x <= BX2; x++) - for (y = BY1; y <= BY2; y++) - DrawScreenField(x, y); + for (x = BX1; x <= BX2; x++) + for (y = BY1; y <= BY2; y++) + DrawScreenField(x, y); - redraw_mask |= REDRAW_FIELD; + redraw_mask |= REDRAW_FIELD; #endif - DrawAllPlayers(); + DrawAllPlayers(); +#if 0 #if NEW_TILESIZE - BlitScreenToBitmap(backbuffer); + BlitScreenToBitmap(backbuffer); #else - /* blit playfield from scroll buffer to normal back buffer */ - if (setup.soft_scrolling) - { - int fx = FX, fy = FY; + /* blit playfield from scroll buffer to normal back buffer */ + if (setup.soft_scrolling) + { + int fx = FX, fy = FY; - fx += (ScreenMovDir & (MV_LEFT|MV_RIGHT) ? ScreenGfxPos : 0); - fy += (ScreenMovDir & (MV_UP|MV_DOWN) ? ScreenGfxPos : 0); + fx += (ScreenMovDir & (MV_LEFT|MV_RIGHT) ? ScreenGfxPos : 0); + fy += (ScreenMovDir & (MV_UP|MV_DOWN) ? ScreenGfxPos : 0); - BlitBitmap(fieldbuffer, backbuffer, fx,fy, SXSIZE,SYSIZE, SX,SY); - } -#endif + BlitBitmap(fieldbuffer, backbuffer, fx,fy, SXSIZE,SYSIZE, SX,SY); } +#endif +#endif +} + +void RedrawPlayfield() +{ + if (game_status != GAME_MODE_PLAYING) + return; + + if (level.game_engine_type == GAME_ENGINE_TYPE_EM) + RedrawPlayfield_EM(TRUE); + else if (level.game_engine_type == GAME_ENGINE_TYPE_SP) + RedrawPlayfield_SP(TRUE); + else if (level.game_engine_type == GAME_ENGINE_TYPE_RND) + RedrawPlayfield_RND(); + + BlitScreenToBitmap(backbuffer); BlitBitmap(drawto, window, gfx.sx, gfx.sy, gfx.sxsize, gfx.sysize, gfx.sx, gfx.sy); @@ -497,7 +497,7 @@ void DrawMaskedBorder(int redraw_mask) } } -void BlitScreenToBitmap(Bitmap *target_bitmap) +static void BlitScreenToBitmap_RND(Bitmap *target_bitmap) { DrawBuffer *buffer = (drawto_field == window ? backbuffer : drawto_field); int fx = FX, fy = FY; @@ -594,6 +594,16 @@ void BlitScreenToBitmap(Bitmap *target_bitmap) } } +void BlitScreenToBitmap(Bitmap *target_bitmap) +{ + if (level.game_engine_type == GAME_ENGINE_TYPE_EM) + BlitScreenToBitmap_EM(target_bitmap); + else if (level.game_engine_type == GAME_ENGINE_TYPE_SP) + BlitScreenToBitmap_SP(target_bitmap); + else if (level.game_engine_type == GAME_ENGINE_TYPE_RND) + BlitScreenToBitmap_RND(target_bitmap); +} + void BackToFront() { int x, y; @@ -723,7 +733,7 @@ void BackToFront() else { #if 1 - BlitScreenToBitmap(window); + BlitScreenToBitmap_RND(window); #else int fx = FX, fy = FY; @@ -1577,6 +1587,7 @@ inline void getGraphicSourceExt(int graphic, int frame, Bitmap **bitmap, int src_y = g->src_y + (get_backside ? g->offset2_y : 0); #if NEW_TILESIZE + if (TILESIZE_VAR != TILESIZE) return getSizedGraphicSourceExt(graphic, frame, TILESIZE_VAR, bitmap, x, y, get_backside); @@ -3339,12 +3350,16 @@ void ShowEnvelopeRequest(char *text, unsigned int req_state, int action) if (game_status == GAME_MODE_PLAYING) { #if 1 +#if 1 + BlitScreenToBitmap(backbuffer); +#else if (level.game_engine_type == GAME_ENGINE_TYPE_EM) BlitScreenToBitmap_EM(backbuffer); else if (level.game_engine_type == GAME_ENGINE_TYPE_SP) BlitScreenToBitmap_SP(backbuffer); else - BlitScreenToBitmap(backbuffer); + BlitScreenToBitmap_RND(backbuffer); +#endif #else if (level.game_engine_type == GAME_ENGINE_TYPE_EM) BlitScreenToBitmap_EM(backbuffer); @@ -3499,15 +3514,20 @@ void DrawPreviewElement(int dst_x, int dst_y, int element, int tilesize) BlitBitmap(src_bitmap, drawto, src_x, src_y, tilesize, tilesize, dst_x,dst_y); } -void DrawLevel() +void DrawLevel(int draw_background_mask) { int x,y; +#if 1 + SetMainBackgroundImage(IMG_BACKGROUND_PLAYING); + SetDrawBackgroundMask(draw_background_mask); +#else #if 1 SetMainBackgroundImage(IMG_BACKGROUND_PLAYING); SetDrawBackgroundMask(REDRAW_FIELD); #else SetDrawBackgroundMask(REDRAW_NONE); +#endif #endif ClearField(); @@ -4655,10 +4675,14 @@ static boolean RequestDoor(char *text, unsigned int req_state) if (game_status == GAME_MODE_PLAYING) { +#if 1 + BlitScreenToBitmap(backbuffer); +#else if (level.game_engine_type == GAME_ENGINE_TYPE_EM) BlitScreenToBitmap_EM(backbuffer); else if (level.game_engine_type == GAME_ENGINE_TYPE_SP) BlitScreenToBitmap_SP(backbuffer); +#endif } /* disable deactivated drawing when quick-loading level tape recording */ @@ -4852,12 +4876,16 @@ static boolean RequestEnvelope(char *text, unsigned int req_state) if (game_status == GAME_MODE_PLAYING) { #if 1 +#if 1 + BlitScreenToBitmap(backbuffer); +#else if (level.game_engine_type == GAME_ENGINE_TYPE_EM) BlitScreenToBitmap_EM(backbuffer); else if (level.game_engine_type == GAME_ENGINE_TYPE_SP) BlitScreenToBitmap_SP(backbuffer); else - BlitScreenToBitmap(backbuffer); + BlitScreenToBitmap_RND(backbuffer); +#endif #else if (level.game_engine_type == GAME_ENGINE_TYPE_EM) BlitScreenToBitmap_EM(backbuffer); @@ -5074,10 +5102,14 @@ boolean Request(char *text, unsigned int req_state) if (game_status == GAME_MODE_PLAYING) { +#if 1 + BlitScreenToBitmap(backbuffer); +#else if (level.game_engine_type == GAME_ENGINE_TYPE_EM) BlitScreenToBitmap_EM(backbuffer); else if (level.game_engine_type == GAME_ENGINE_TYPE_SP) BlitScreenToBitmap_SP(backbuffer); +#endif } /* disable deactivated drawing when quick-loading level tape recording */ @@ -11467,6 +11499,7 @@ void ChangeViewportPropertiesIfNeeded() boolean init_gfx_buffers = FALSE; boolean init_video_buffer = FALSE; boolean init_gadgets_and_toons = FALSE; + boolean init_em_graphics = FALSE; #if 0 /* !!! TEST ONLY !!! */ @@ -11554,12 +11587,15 @@ void ChangeViewportPropertiesIfNeeded() ) { #if 1 - // changing tile size invalidates scroll values of engine snapshots if (new_tilesize_var != TILESIZE_VAR) { // printf("::: new_tilesize_var != TILESIZE_VAR\n"); + // changing tile size invalidates scroll values of engine snapshots FreeEngineSnapshot(); + + // changing tile size requires update of graphic mapping for EM engine + init_em_graphics = TRUE; } #endif @@ -11652,6 +11688,11 @@ void ChangeViewportPropertiesIfNeeded() InitToons(); } + if (init_em_graphics) + { + InitGraphicInfo_EM(); + } + #if 0 printf("::: %d, %d / %d, %d [%d]\n", VX, VY, EX, EY, game_status); #endif