moved correcting playfield buffer scroll position to EM engine
authorHolger Schemel <info@artsoft.org>
Thu, 28 May 2020 16:28:24 +0000 (18:28 +0200)
committerHolger Schemel <info@artsoft.org>
Thu, 28 May 2020 16:28:24 +0000 (18:28 +0200)
src/game.c
src/game_em/game.c
src/game_em/main_em.h

index f4ae9303776da68ac2be4439c6b5ff651be2fe59..14c652b7dc98b2c0c40dbc788279fcec206b385d 100644 (file)
@@ -4394,15 +4394,6 @@ void UpdateEngineValues(int actual_scroll_x, int actual_scroll_y,
 {
   // this is used for non-R'n'D game engines to update certain engine values
 
-  if (level.game_engine_type == GAME_ENGINE_TYPE_EM)
-  {
-    actual_scroll_x = correctLevelPosX_EM(actual_scroll_x);
-    actual_scroll_y = correctLevelPosY_EM(actual_scroll_y);
-
-    actual_player_x = correctLevelPosX_EM(actual_player_x);
-    actual_player_y = correctLevelPosY_EM(actual_player_y);
-  }
-
   // needed to determine if sounds are played within the visible screen area
   scroll_x = actual_scroll_x;
   scroll_y = actual_scroll_y;
index 2d11170dc6b392e22443a55949b65a83237f59a6..491c290d7a68119a44bdada97268118e798e3b91 100644 (file)
@@ -92,7 +92,10 @@ void GameActions_EM(byte action[MAX_PLAYERS], boolean warp_mode)
   for (i = 0; i < MAX_PLAYERS; i++)
     readjoy(action[i], &ply[i]);
 
-  UpdateEngineValues(screen_x / TILEX, screen_y / TILEY, ply[0].x, ply[0].y);
+  UpdateEngineValues(CAVE_POS_X(screen_x / TILEX),
+                    CAVE_POS_Y(screen_y / TILEY),
+                    CAVE_POS_X(ply[0].x),
+                    CAVE_POS_Y(ply[0].y));
 
   logic();
 
index cdb9325cad4d1be58da3494c85191f42e0faa993..84d5509ba327bcfcf02dd9719c7aadaeee9d80e5 100644 (file)
@@ -76,6 +76,9 @@ extern int                    SX, SY;
 
 #define DISPLAY_TIME(x)                ROUNDED_DIVIDE(x, FRAMES_PER_SECOND)
 
+#define CAVE_POS_X(x)          ((x) - lev.left)
+#define CAVE_POS_Y(x)          ((x) - lev.top)
+
 
 // ----------------------------------------------------------------------------
 // data structure definitions