1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-24 15:24:30 +01:00

Add #7726: Shortcut to advance one tick (#7851)

This commit is contained in:
jensj12
2018-09-23 23:40:47 +02:00
committed by Hielke Morsink
parent fd12aff8f7
commit eac9b720ee
9 changed files with 40 additions and 7 deletions

View File

@@ -3728,6 +3728,7 @@ STR_6264 :Always use system file browser
STR_6265 :{SMALLFONT}{BLACK}When enabled, your operating system's file browser will be used instead of OpenRCT2's.
STR_6266 :Open custom content folder
STR_6267 :Open tile inspector
STR_6268 :Advance to next tick
#############
# Scenarios #

View File

@@ -1,5 +1,6 @@
0.2.1+ (in development)
------------------------------------------------------------------------
- Feature: [#7726] Add shortcut to advance one tick.
- Feature: [#7956, #7964] Add sprite font glyphs for Hungarian and some Czech letters.
- Feature: [#7971] Toolbox option to open custom content folder.
- Feature: [#7980] Allow data path for RCT1 to be specified by a command line argument.

View File

@@ -757,6 +757,14 @@ static void shortcut_open_tile_inspector()
context_open_window(WC_TILE_INSPECTOR);
}
static void shortcut_advance_to_next_tick()
{
if (gScreenFlags & (SCREEN_FLAGS_TITLE_DEMO | SCREEN_FLAGS_SCENARIO_EDITOR | SCREEN_FLAGS_TRACK_MANAGER))
return;
gDoSingleUpdate = true;
}
namespace
{
const shortcut_action shortcut_table[SHORTCUT_COUNT] = {
@@ -830,6 +838,7 @@ namespace
shortcut_view_clipping,
shortcut_highlight_path_issues_toggle,
shortcut_open_tile_inspector,
shortcut_advance_to_next_tick,
};
} // anonymous namespace

View File

@@ -94,6 +94,7 @@ enum
SHORTCUT_VIEW_CLIPPING,
SHORTCUT_HIGHLIGHT_PATH_ISSUES_TOGGLE,
SHORTCUT_TILE_INSPECTOR,
SHORTCUT_ADVANCE_TO_NEXT_TICK,
SHORTCUT_COUNT,

View File

@@ -149,6 +149,7 @@ const rct_string_id ShortcutStringIds[SHORTCUT_COUNT] = {
STR_SHORTCUT_VIEW_CLIPPING,
STR_SHORTCUT_HIGHLIGHT_PATH_ISSUES_TOGGLE,
STR_SHORTCUT_OPEN_TILE_INSPECTOR,
STR_ADVANCE_TO_NEXT_TICK,
};
// clang-format on

View File

@@ -68,6 +68,7 @@
uint16_t gTicksSinceLastUpdate;
uint8_t gGamePaused = 0;
int32_t gGameSpeed = 1;
bool gDoSingleUpdate = false;
float gDayNightCycle = 0;
bool gInUpdateCode = false;
bool gInMapInitCode = false;

View File

@@ -140,6 +140,7 @@ extern uint32_t gCurrentTicks;
extern uint16_t gTicksSinceLastUpdate;
extern uint8_t gGamePaused;
extern int32_t gGameSpeed;
extern bool gDoSingleUpdate;
extern float gDayNightCycle;
extern bool gInUpdateCode;
extern bool gInMapInitCode;

View File

@@ -111,17 +111,27 @@ void GameState::Update()
}
}
bool didRunSingleFrame = false;
if (game_is_paused())
{
numUpdates = 0;
// Update the animation list. Note this does not
// increment the map animation.
map_animation_invalidate_all();
if (gDoSingleUpdate && network_get_mode() == NETWORK_MODE_NONE)
{
didRunSingleFrame = true;
pause_toggle();
numUpdates = 1;
}
else
{
numUpdates = 0;
// Update the animation list. Note this does not
// increment the map animation.
map_animation_invalidate_all();
// Special case because we set numUpdates to 0, otherwise in game_logic_update.
network_update();
// Special case because we set numUpdates to 0, otherwise in game_logic_update.
network_update();
network_process_game_commands();
network_process_game_commands();
}
}
// Update the game one or more times
@@ -184,7 +194,13 @@ void GameState::Update()
window_dispatch_update_all();
if (didRunSingleFrame && game_is_not_paused() && !(gScreenFlags & SCREEN_FLAGS_TITLE_DEMO))
{
pause_toggle();
}
gGameCommandNestLevel = 0;
gDoSingleUpdate = false;
gInUpdateCode = false;
}

View File

@@ -3895,6 +3895,8 @@ enum
STR_SHORTCUT_OPEN_TILE_INSPECTOR = 6267,
STR_ADVANCE_TO_NEXT_TICK = 6268,
// Have to include resource strings (from scenarios and objects) for the time being now that language is partially working
STR_COUNT = 32768
};