Skip to content

Commit

Permalink
Fixed main_loop
Browse files Browse the repository at this point in the history
Updated `game.cpp`
Updated `game_engine.cpp`
  • Loading branch information
twist84 committed Jan 18, 2025
1 parent c532f07 commit 02e22e6
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 10 deletions.
42 changes: 35 additions & 7 deletions game/source/game/game.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -981,12 +981,8 @@ bool __cdecl game_is_synchronous_networking()
{
//return INVOKE(0x00531E60, game_is_synchronous_networking);

char game_simulation = game_options_get()->game_simulation;
if (game_simulation >= _game_simulation_synchronous_client &&
game_simulation <= _game_simulation_synchronous_server)
return true;

return false;
return IN_RANGE_INCLUSIVE(game_options_get()->game_simulation,
_game_simulation_synchronous_client, _game_simulation_synchronous_server);
}

bool __cdecl game_is_ui_shell()
Expand Down Expand Up @@ -1113,14 +1109,46 @@ bool __cdecl game_options_valid()

void __cdecl game_options_validate(game_options* options)
{
INVOKE(0x00532680, game_options_validate, options);
//INVOKE(0x00532680, game_options_validate, options);

game_engine_variant_validate(&options->multiplayer_variant);
options->map_variant.validate();
}

//.text:005326B0 ; void __cdecl game_options_validate_for_saved_game(long)

bool __cdecl game_options_verify(game_options const* options, char* error_string, long error_string_length)
{
return INVOKE(0x005326F0, game_options_verify, options, error_string, error_string_length);

//if (options->game_mode < _game_mode_none || options->game_mode >= k_game_mode_count)
// return false;
//
//if (options->game_simulation < _game_simulation_none || options->game_simulation >= k_game_simulation_count)
// return false;
//
//if (options->game_tick_rate <= 0 && options->game_tick_rate > 300)
// return false;
//
//if (options->scenario_path.is_empty())
// return false;
//
//if (options->initial_zone_set_index < 0 || options->initial_zone_set_index >= 48)
// return false;
//
//if (options->record_saved_film && (options->game_playback < _game_playback_none || options->game_playback >= k_game_playback_count))
// return false;
//
//if (options->map_variant.m_map_id != NONE && options->map_id != options->map_variant.m_map_id)
// return false;
//
//if (options->campaign_metagame_scoring < 0 || options->campaign_metagame_scoring >= 3)
// return false;
//
//if (options->campaign_insertion_point < 0 || options->campaign_insertion_point >= 9)
// return false;
//
//// #TODO: more checks
}

e_game_playback_type __cdecl game_playback_get()
Expand Down
4 changes: 2 additions & 2 deletions game/source/game/game_engine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,8 @@ void __cdecl game_engine_game_starting()

//.text:0054EC60 ; void __cdecl game_engine_garbage_collect()
//.text:0054EFC0 ; void __cdecl game_engine_garbage_collect_for_round_switch()
//.text:0054F220 ; char const* __cdecl game_engine_get_game_variant_name() // named by us
//.text:0054F250 ; game_engine_get_change_colors, modified by saber
//.text:0054F220 ; char const* __cdecl game_engine_get_current_variant_name() // named by us
//.text:0054F250 ; real __cdecl game_engine_get_change_colors(long, dword, e_game_team, real_rgb_color*, bool*), modified by saber
//.text:0054F5E0 ; long __cdecl game_engine_get_current_talker(long)
//.text:0054F670 ; game_engine_get_damage_multiplier, modified by saber
//.text:0054FC10 ; long __cdecl game_engine_get_finalized_player_place(long)
Expand Down
2 changes: 1 addition & 1 deletion game/source/main/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -711,7 +711,7 @@ void __cdecl main_loop()
g_single_thread_request_flags.set_bit(3, byte_244DF08 /* sub_6103F0 */ || byte_244DF07 /* sub_610530 */);
if (game_is_multithreaded())
{
if ((g_single_thread_request_flags.peek() != 0) != requested_single_thread)
if ((g_single_thread_request_flags.peek() == 0) != requested_single_thread)
{
if (requested_single_thread)
unlock_resources_and_resume_render_thread(wait_for_render_thread);
Expand Down

0 comments on commit 02e22e6

Please # to comment.