small code cleanup of screen redraw functions (EM)
authorHolger Schemel <info@artsoft.org>
Sat, 16 May 2015 19:30:52 +0000 (21:30 +0200)
committerHolger Schemel <info@artsoft.org>
Sat, 16 May 2015 19:41:20 +0000 (21:41 +0200)
src/game_em/global.h
src/game_em/graphics.c
src/game_em/input.c

index b3c5ceaa266ae529f0895d2fcc123297b210d924..89c6804278e9bc3a3c156c4e768d739ea9a2ccf3 100644 (file)
@@ -27,9 +27,7 @@ void close_all(void);
 void readjoy(byte, struct PLAYER *);
 void input_eventloop(void);
 
-void blitscreen(void);
 void game_initscreen(void);
-void game_animscreen(void);
 
 void play_sound(int, int, int);
 void sound_play(void);
index 127d79253d2a73ad8bcda47dd3b38e8d2925f242..03934a71e7beff39ab8d4f8a2e506c4771e1356c 100644 (file)
@@ -37,10 +37,10 @@ int screen_x, screen_y;                     /* current scroll position */
 static int screentiles[MAX_PLAYFIELD_HEIGHT + 2][MAX_PLAYFIELD_WIDTH + 2];
 static int crumbled_state[MAX_PLAYFIELD_HEIGHT + 2][MAX_PLAYFIELD_WIDTH + 2];
 
-/* copy the entire screen to the window at the scroll position */
-
 void BlitScreenToBitmap_EM(Bitmap *target_bitmap)
 {
+  /* blit all (up to four) parts of the scroll buffer to the target bitmap */
+
   int x = screen_x % (MAX_BUF_XSIZE * TILEX);
   int y = screen_y % (MAX_BUF_YSIZE * TILEY);
   int sx, sy, sxsize, sysize;
@@ -96,18 +96,9 @@ void BlitScreenToBitmap_EM(Bitmap *target_bitmap)
 
 void BackToFront_EM(void)
 {
-  /* blit all (up to four) parts of the scroll buffer to the backbuffer */
-  BlitScreenToBitmap_EM(backbuffer);
-
-  /* blit the completely updated backbuffer to the window (in one blit) */
   BlitBitmap(backbuffer, window, SX, SY, SXSIZE, SYSIZE, SX, SY);
 }
 
-void blitscreen(void)
-{
-  BackToFront_EM();
-}
-
 static struct GraphicInfo_EM *getObjectGraphic(int x, int y)
 {
   int tile = Draw[y][x];
@@ -661,7 +652,8 @@ void RedrawPlayfield_EM(boolean force_redraw)
       for (i = 0; i < MAX_PLAYERS; i++)
        blitplayer(&ply[i]);
 
-      blitscreen();
+      BlitScreenToBitmap_EM(backbuffer);
+      BackToFront_EM();
 
       Delay(wait_delay_value);
 
@@ -674,7 +666,8 @@ void RedrawPlayfield_EM(boolean force_redraw)
       for (i = 0; i < MAX_PLAYERS; i++)
        blitplayer(&ply[i]);
 
-      blitscreen();
+      BlitScreenToBitmap_EM(backbuffer);
+      BackToFront_EM();
 
       Delay(wait_delay_value);
     }
@@ -763,8 +756,3 @@ void RedrawPlayfield_EM(boolean force_redraw)
   for (i = 0; i < MAX_PLAYERS; i++)
     blitplayer(&ply[i]);
 }
-
-void game_animscreen(void)
-{
-  RedrawPlayfield_EM(FALSE);
-}
index 73d1c858362281896c2c42e496e791112f62cc18..470975188b35f997624eb5f18519e240a5b45c7a 100644 (file)
@@ -63,7 +63,8 @@ void InitGameEngine_EM()
   prepare_em_level();
 
   game_initscreen();
-  game_animscreen();
+
+  RedrawPlayfield_EM(FALSE);
 }
 
 void UpdateGameDoorValues_EM()
@@ -108,9 +109,10 @@ void GameActions_EM(byte action[MAX_PLAYERS], boolean warp_mode)
   CheckSingleStepMode_EM(action, frame, game_em.any_player_moving,
                         game_em.any_player_snapping, any_player_dropping);
 
-  game_animscreen();
+  RedrawPlayfield_EM(FALSE);
 
-  blitscreen();
+  BlitScreenToBitmap_EM(backbuffer);
+  BackToFront_EM();
 }
 
 /* read input device for players */