added options "game.forced_scroll_x" and "game.forced_scroll_y"
authorHolger Schemel <info@artsoft.org>
Sat, 14 Oct 2023 18:33:14 +0000 (20:33 +0200)
committerHolger Schemel <info@artsoft.org>
Sat, 14 Oct 2023 18:33:14 +0000 (20:33 +0200)
This adds the above two "graphicsinfo.conf" options to override the
automatically calculated playfield scroll values when starting a game.

The purpose of these options is to force an initial scroll position
(which is used for all levels), which means that the visible part of
the playfield when the game is started is not determined by the player
position, but by the values defined using the above options.

This may be useful in combination with a large value for the option
"game.forced_scroll_delay_value" to limit the visible part of the
playfield to a smaller, screen-sized area, while the remaining part of
the playfield contains some control elements. It may also be useful
for levels using teleportation from one area to another area while
still controlling which parts of the playfield entered by the player
are visible. It can also be used to force a certain initial visible
part of the playfield, regardless of the exact position of the player
within that area. And it is currently the only way to force showing
levels with an even width or even height with the player near the
border of the playfield with half-tile border elements, which would
also be needed for teleporting the player to a different part of the
playfield without scrolling the playfield relative to the player's
screen position.

Therefore, this feature should probably be considered experimental.

src/conf_gfx.c
src/game.c
src/game.h

index 0fe69a8d2301f97ef5985fbd44c9f2f96bf7b1b7..73eb60dbcd3f70232e43956a874275bf086e9139 100644 (file)
@@ -10077,6 +10077,8 @@ struct ConfigInfo image_config[] =
 
   { "game.graphics_engine_version",            "-1"                    },
   { "game.forced_scroll_delay_value",          "-1"                    },
+  { "game.forced_scroll_x",                    ARG_UNDEFINED           },
+  { "game.forced_scroll_y",                    ARG_UNDEFINED           },
   { "game.use_native_emc_graphics_engine",     "false"                 },
   { "game.use_native_sp_graphics_engine",      "true"                  },
   { "game.use_masked_pushing",                 "false"                 },
index 53410d5ace4c808511e21dad4c6e2e8cf04e6ada..88fa0a6e3e19a3d80126795e35459f6d0f3d167e 100644 (file)
@@ -4445,6 +4445,11 @@ void InitGame(void)
     scroll_y = SCROLL_POSITION_Y(local_player->jy);
   }
 
+  if (game.forced_scroll_x != ARG_UNDEFINED_VALUE)
+    scroll_x = game.forced_scroll_x;
+  if (game.forced_scroll_y != ARG_UNDEFINED_VALUE)
+    scroll_y = game.forced_scroll_y;
+
   // !!! FIX THIS (START) !!!
   if (level.game_engine_type == GAME_ENGINE_TYPE_EM)
   {
index 7eb19cdedbb1e7d60b241dabdc915803dd587975..dee1bdb1c71292b22350fb235d64d334b9a7ac33 100644 (file)
@@ -163,6 +163,8 @@ struct GameInfo
   boolean use_masked_pushing;
   boolean use_masked_elements;
   boolean use_masked_elements_initial;
+  int forced_scroll_x;
+  int forced_scroll_y;
   int forced_scroll_delay_value;
   int scroll_delay_value;
   int tile_size;