diff --git a/source/game/game_engine.c b/source/game/game_engine.c index 6abcf150..5efd72ae 100644 --- a/source/game/game_engine.c +++ b/source/game/game_engine.c @@ -543,10 +543,12 @@ symbols in this file: #include "game_globals.h" #include "interface/ui_widget.h" +#include "input/input.h" #include "items/weapon_definitions.h" #include "items/weapons.h" #include "main/main.h" #include "networking/network_game_globals.h" +#include "networking/network_server_manager.h" #include "objects.h" #include "player_rumble.h" #include "players.h" @@ -584,7 +586,7 @@ struct game_engine_globals unsigned long flags; byte unused4[4]; real postgame_timer; - byte unusedC[4]; + real postgame_progress; long postgame_state; real hud_message_timers[MAXIMUM_LOCAL_PLAYERS]; }; @@ -605,6 +607,8 @@ typedef char verify_postgame_statistic_entry_size[ typedef char verify_game_engine_goal_size[sizeof(struct game_engine_goal) == 0x20 ? 1 : -1]; typedef char verify_game_engine_globals_postgame_timer_offset[ offsetof(struct game_engine_globals, postgame_timer) == 0x8 ? 1 : -1]; +typedef char verify_game_engine_globals_postgame_progress_offset[ + offsetof(struct game_engine_globals, postgame_progress) == 0xC ? 1 : -1]; typedef char verify_game_engine_globals_postgame_state_offset[ offsetof(struct game_engine_globals, postgame_state) == 0x10 ? 1 : -1]; typedef char verify_game_engine_globals_hud_message_timers_offset[ @@ -833,6 +837,27 @@ static boolean code_00097840( return result; } +static boolean code_00099880( + long button_index) +{ + boolean result = FALSE; + long gamepad_index; + + for (gamepad_index = 0; gamepad_index < 4; gamepad_index++) + { + struct gamepad_state const *gamepad_state = + input_get_gamepad_state((short)gamepad_index); + + if (gamepad_state && gamepad_state->buttons[button_index]) + { + result = TRUE; + break; + } + } + + return result; +} + boolean code_00097c00( void) { @@ -1312,6 +1337,43 @@ void game_engine_nonplayer_post_rasterize( return; } +void game_engine_update_non_deterministic( + real delta_seconds) +{ + if (game_engine) + { + switch (game_engine_globals.postgame_state) + { + case 2: + rumble_clear_all_now(); + game_engine_globals.postgame_timer -= delta_seconds; + if (game_engine_globals.postgame_timer <= 0.0f) + game_engine_globals.postgame_state = 3; + break; + + case 3: + rumble_clear_all_now(); + game_engine_globals.postgame_progress += delta_seconds; + if (game_engine_globals.postgame_progress > 1.0f) + game_engine_globals.postgame_progress = 1.0f; + + if (code_00099880(0) || code_00099880(12)) + { + if (global_network_game_server_get()) + network_game_server_reset_to_pregame( + global_network_game_server_get()); + } + else if (code_00099880(1) || code_00099880(13)) + { + network_game_abort(); + } + break; + } + } + + return; +} + boolean game_engine_display_team_indicators( void) { diff --git a/source/game/game_engine.h b/source/game/game_engine.h index 4b9cf194..8881171e 100644 --- a/source/game/game_engine.h +++ b/source/game/game_engine.h @@ -219,6 +219,9 @@ void game_engine_post_rasterize( void game_engine_nonplayer_post_rasterize( void); +void game_engine_update_non_deterministic( + float delta_seconds); + void game_engine_initialize( struct game_variant *variant); diff --git a/source/game/player_rumble.h b/source/game/player_rumble.h index e25ac236..37cf77d9 100644 --- a/source/game/player_rumble.h +++ b/source/game/player_rumble.h @@ -20,5 +20,7 @@ void rumble_player_set_scripted_values( real right_motor); void rumble_player_clear( short local_player_index); +void rumble_clear_all_now( + void); #endif // __PLAYER_RUMBLE_H diff --git a/source/networking/network_server_manager.h b/source/networking/network_server_manager.h index 3cb0f850..fc26597a 100644 --- a/source/networking/network_server_manager.h +++ b/source/networking/network_server_manager.h @@ -14,7 +14,12 @@ header included in hcex build. /* ---------- structures */ -/* ---------- prototypes/EXAMPLE.C */ +/* ---------- prototypes/NETWORK_SERVER_MANAGER.C */ + +struct network_game_server; + +void network_game_server_reset_to_pregame( + struct network_game_server *server); /* ---------- globals */