From a0f9dd84ca26309a8ab518caed02a0ce7debd4e2 Mon Sep 17 00:00:00 2001 From: Holger Schemel Date: Thu, 28 May 2020 18:28:24 +0200 Subject: [PATCH] moved correcting playfield buffer scroll position to EM engine --- src/game.c | 9 --------- src/game_em/game.c | 5 ++++- src/game_em/main_em.h | 3 +++ 3 files changed, 7 insertions(+), 10 deletions(-) diff --git a/src/game.c b/src/game.c index f4ae9303..14c652b7 100644 --- a/src/game.c +++ b/src/game.c @@ -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; diff --git a/src/game_em/game.c b/src/game_em/game.c index 2d11170d..491c290d 100644 --- a/src/game_em/game.c +++ b/src/game_em/game.c @@ -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(); diff --git a/src/game_em/main_em.h b/src/game_em/main_em.h index cdb9325c..84d5509b 100644 --- a/src/game_em/main_em.h +++ b/src/game_em/main_em.h @@ -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 -- 2.34.1