Skip to content

Commit

Permalink
Added c_game_engine implementation (WIP)
Browse files Browse the repository at this point in the history
  • Loading branch information
twist84 committed Sep 7, 2024
1 parent 291a83d commit 4ed9d07
Show file tree
Hide file tree
Showing 2 changed files with 292 additions and 33 deletions.
259 changes: 259 additions & 0 deletions game/source/game/game_engine_default.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,11 @@
#include "game/game_engine.hpp"
#include "game/game_engine_util.hpp"
#include "game/game_engine_variant.hpp"
#include "main/levels.hpp"
#include "memory/bitstream.hpp"
#include "memory/byte_swapping.hpp"
#include "memory/thread_local.hpp"
#include "scenario/scenario.hpp"

void c_game_engine::dump_player_trait_settings(char const* traits_name, c_player_traits const* traits, s_file_reference* file) const
{
Expand Down Expand Up @@ -434,3 +437,259 @@ void c_game_engine_base_variant::set_team_scoring_method(short team_scoring_meth
m_team_scoring_method = team_scoring_method;
}

//long c_game_engine::get_type() const
//{
// //return DECLFUNC(0x00749ED0, long, __thiscall, c_game_engine const*)(this);
//
// return 0;
//}
//
//long c_game_engine::get_score_to_win_round() const
//{
// //return DECLFUNC(0x00749E90, long, __thiscall, c_game_engine const*)(this);
//
// if (current_game_variant())
// return current_game_variant()->get_active_variant()->get_score_to_win_round();
//
// return 0;
//}
//
//long c_game_engine::get_score_unknown() const
//{
// //return DECLFUNC(0x00749E50, long, __thiscall, c_game_engine const*)(this);
//
// if (current_game_variant())
// return current_game_variant()->get_active_variant()->get_score_unknown();
//
// return 0;
//}
//
//void c_game_engine::recompute_team_score(e_game_team game_team, long a1, e_team_scoring_method team_scoring_method) const
//{
// DECLFUNC(0x0074A450, void, __thiscall, c_game_engine const*, e_game_team, long, e_team_scoring_method)(this, game_team, a1, team_scoring_method);
//}
//
//void c_game_engine::get_score_string(long score, c_static_wchar_string<256>* score_string) const
//{
// //DECLFUNC(0x00749E70, void, __thiscall, c_game_engine const*, long, c_static_wchar_string<256>*)(this, score, score_string);
//
// score_string->print(L"%d", score);
//}
//
//void c_game_engine::get_hud_interface_state(long a1, game_engine_interface_state* hud_interface_state) const
//{
// //DECLFUNC(0x00749DB0, void, __thiscall, c_game_engine const*, long, game_engine_interface_state*)(this, a1, hud_interface_state);
//}
//
//bool c_game_engine::initialize_for_new_map() const
//{
// //return DECLFUNC(0x00749F00, bool, __thiscall, c_game_engine const*)(this);
//
// return true;
//}
//
//void c_game_engine::dispose_from_old_map() const
//{
// //DECLFUNC(0x00749BA0, void, __thiscall, c_game_engine const*)(this);
//}
//
//bool c_game_engine::initialize_for_new_round() const
//{
// //return DECLFUNC(0x00749F10, bool, __thiscall, c_game_engine const*)(this);
//
// return true;
//}
//
//void c_game_engine::stats_reset_for_round_switch() const
//{
// //DECLFUNC(0x0074A670, void, __thiscall, c_game_engine const*)(this);
//}
//
//bool c_game_engine::validate_team_designator_for_new_map(e_multiplayer_team_designator team_designator) const
//{
// //return DECLFUNC(0x0074A7A0, bool, __thiscall, c_game_engine const*, e_multiplayer_team_designator)(this, team_designator);
//
// s_level_datum multiplayer_level{};
// return !levels_try_and_get_multiplayer_map(global_scenario_get()->map_id, &multiplayer_level) || team_designator < multiplayer_level.engine_maximum_teams[get_type()];
//}
//
//void c_game_engine::player_added(long player_index) const
//{
// //DECLFUNC(0x00749FB0, void, __thiscall, c_game_engine const*, long)(this, player_index);
//}
//
//void c_game_engine::player_activated(long player_index) const
//{
// //DECLFUNC(0x00749FA0, void, __thiscall, c_game_engine const*, long)(this, player_index);
//}
//
//void c_game_engine::player_left(long player_index) const
//{
// //DECLFUNC(0x0074A1D0, void, __thiscall, c_game_engine const*, long)(this, player_index);
//}
//
//void c_game_engine::player_rejoined(long player_index) const
//{
// //DECLFUNC(0x0074A1F0, void, __thiscall, c_game_engine const*, long)(this, player_index);
//}
//
//void c_game_engine::player_changed_indices(long player_index_a, long player_index_b) const
//{
// //DECLFUNC(0x00749FD0, void, __thiscall, c_game_engine const*, long, long)(this, player_index_a, player_index_b);
//}
//
//void c_game_engine::player_changed_teams(long player_index) const
//{
// //DECLFUNC(0x00749FE0, void, __thiscall, c_game_engine const*, long)(this, player_index);
//}
//
//void c_game_engine::player_about_to_spawn(long player_index) const
//{
// //DECLFUNC(0x00749F90, void, __thiscall, c_game_engine const*, long)(this, player_index);
//}
//
//void c_game_engine::player_just_spawned(long player_index) const
//{
// //DECLFUNC(0x0074A010, void, __thiscall, c_game_engine const*, long)(this, player_index);
//}
//
//void c_game_engine::game_ending() const
//{
// //DECLFUNC(0x00749D80, void, __thiscall, c_game_engine const*)(this);
//}
//
//void c_game_engine::game_starting() const
//{
// //DECLFUNC(0x00749D90, void, __thiscall, c_game_engine const*)(this);
//}
//
//void c_game_engine::render(long user_index) const
//{
// //DECLFUNC(0x0074A540, void, __thiscall, c_game_engine const*, long)(this, user_index);
//}
//
//void c_game_engine::render_debug(long user_index) const
//{
// //DECLFUNC(0x0074A550, void, __thiscall, c_game_engine const*, long)(this, user_index);
//}
//
//void c_game_engine::submit_nav_points(long user_index, long player_index) const
//{
// DECLFUNC(0x0074A680, void, __thiscall, c_game_engine const*, long, long)(this, user_index, player_index);
//}
//
//bool c_game_engine::build_player_nav_point(long a1, long a2, long a3, bool a4, s_chud_navpoint* chud_navpoint) const
//{
// return DECLFUNC(0x0074A680, bool, __thiscall, c_game_engine const*, long, long, long, bool, s_chud_navpoint*)(this, a1, a2, a3, a4, chud_navpoint);
//}
//
//bool c_game_engine::should_draw_nav_point(long user_index, long player_index) const
//{
// return DECLFUNC(0x0074A5B0, bool, __thiscall, c_game_engine const*, long, long)(this, user_index, player_index);
//}
//
//void c_game_engine::update() const
//{
// //DECLFUNC(0x0074A790, void, __thiscall, c_game_engine const*)(this);
//}
//
//void c_game_engine::player_update(long player_index) const
//{
// DECLFUNC(0x0074A200, void, __thiscall, c_game_engine const*, long)(this, player_index);
//}
//
//void c_game_engine::assemble_baseline_traits_for_player(long player_index, c_player_traits* player_traits) const
//{
// //DECLFUNC(0x00748940, void, __thiscall, c_game_engine const*, long, c_player_traits*)(this, player_index, player_traits);
//
// player_traits->set(current_game_variant()->get_active_variant()->get_map_override_options()->get_base_player_traits(), false);
//}
//
//void c_game_engine::apply_game_engine_traits_for_player(long player_index, c_player_traits* player_traits) const
//{
// //DECLFUNC(0x00748960, void, __thiscall, c_game_engine const*, long, c_player_traits*)(this, player_index, player_traits);
//}
//
//void c_game_engine::assemble_spawn_influencers_for_player(long a1, s_netgame_goal_influencer* influencer, long* a3) const
//{
// //DECLFUNC(0x00748F60, void, __thiscall, c_game_engine const*, long, s_netgame_goal_influencer*, long*)(this, a1, influencer, a3);
//
// *a3 = 0;
//}
//
//long c_game_engine::compare_players(long player_index_a, long player_index_b) const
//{
// //return DECLFUNC(0x00749B40, long, __thiscall, c_game_engine const*, long, long)(this, player_index_a, player_index_b);
//
// return 0;
//}
//
//long c_game_engine::compare_teams(e_game_team team_a, e_game_team team_b) const
//{
// //return DECLFUNC(0x00749B50, long, __thiscall, c_game_engine const*, long, long)(this, team_a, team_b);
//
// return 0;
//}
//
//bool c_game_engine::allow_weapon_pickup(long player_index, long weapon_index) const
//{
// //return DECLFUNC(0x00748900, bool, __thiscall, c_game_engine const*, long, long)(this, player_index, weapon_index);
//
// TLS_DATA_GET_VALUE_REFERENCE(player_data);
// bool result = game_engine_in_round();
// if (result)
// result = player_data[player_index].multiplayer.player_traits.get_weapons_traits()->get_weapon_pickup_allowed();
// return result;
//}
//
//bool c_game_engine::should_auto_pickup_weapon(long player_index, long weapon_index) const
//{
// //return DECLFUNC(0x0074A5A0, bool, __thiscall, c_game_engine const*, long, long)(this, player_index, weapon_index);
//
// return false;
//}
//
//void c_game_engine::player_nearby_multiplayer_weapon(long a1, long a2) const
//{
// //DECLFUNC(0x0074A1E0, void, __thiscall, c_game_engine const*, long, long)(this, a1, a2);
//}
//
//long c_game_engine::object_get_emblem_player(long object_index) const
//{
// //return DECLFUNC(0x00749F70, long, __thiscall, c_game_engine const*, long)(this, object_index);
//
// return NONE;
//}
//
//real c_game_engine::compute_object_function(long object_index, long name) const
//{
// //return DECLFUNC(0x00749B60, real, __thiscall, c_game_engine const*, long, long)(this, object_index, name);
//
// return 0.0f;
//}
//
//void c_game_engine::multiplayer_weapon_register(long weapon_index) const
//{
// //DECLFUNC(0x00749F60, void, __thiscall, c_game_engine const*, long)(this, weapon_index);
//}
//
//void c_game_engine::multiplayer_weapon_deregister(long weapon_index) const
//{
// //DECLFUNC(0x00749F30, void, __thiscall, c_game_engine const*, long)(this, weapon_index);
//}
//
//void c_game_engine::multiplayer_weapon_picked_up(long weapon_index, long unit_index) const
//{
// //DECLFUNC(0x00749F50, void, __thiscall, c_game_engine const*, long, long)(this, weapon_index, unit_index);
//}
//
//void c_game_engine::multiplayer_weapon_dropped(long weapon_index, long unit_index) const
//{
// //DECLFUNC(0x00749F40, void, __thiscall, c_game_engine const*, long, long)(this, weapon_index, unit_index);
//}
//
//void c_game_engine::handle_deleted_object(long object_index) const
//{
// //DECLFUNC(0x00749EF0, void, __thiscall, c_game_engine const*, long)(this, object_index);
//}

66 changes: 33 additions & 33 deletions game/source/game/game_engine_default.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -142,46 +142,46 @@ struct c_game_engine
// some new score saber added for halo online
virtual long get_score_unknown() const;

virtual void recompute_team_score(e_multiplayer_team, long, e_team_scoring_method) const;
virtual void get_score_string(long, wchar_t(&)[256]) const;
virtual void get_hud_interface_state(long, game_engine_interface_state*) const;
virtual void recompute_team_score(e_game_team game_team, long a2, e_team_scoring_method team_scoring_method) const;
virtual void get_score_string(long score, c_static_wchar_string<256>* out_score_string) const;
virtual void get_hud_interface_state(long a1, game_engine_interface_state* hud_interface_state) const;
virtual bool initialize_for_new_map() const;
virtual void dispose_from_old_map() const;
virtual bool initialize_for_new_round() const;
virtual void stats_reset_for_round_switch() const;
virtual bool validate_team_designator_for_new_map(e_multiplayer_team_designator) const;
virtual void player_added(long) const;
virtual void player_activated(long) const;
virtual void player_left(long) const;
virtual void player_rejoined(long) const;
virtual void player_changed_indices(long, long) const;
virtual void player_changed_teams(long) const;
virtual void player_about_to_spawn(long) const;
virtual void player_just_spawned(long) const;
virtual bool validate_team_designator_for_new_map(e_multiplayer_team_designator team_designator) const; // not `validate_team_designator_for_new_map`
virtual void player_added(long player_index) const;
virtual void player_activated(long player_index) const;
virtual void player_left(long player_index) const;
virtual void player_rejoined(long player_index) const;
virtual void player_changed_indices(long player_index_a, long player_index_b) const;
virtual void player_changed_teams(long player_index) const;
virtual void player_about_to_spawn(long player_index) const;
virtual void player_just_spawned(long player_index) const;
virtual void game_ending() const;
virtual void game_starting() const;
virtual void render(long) const;
virtual void render_debug(long) const;
virtual void submit_nav_points(long, long) const;
virtual bool build_player_nav_point(long, long, long, bool, s_chud_navpoint*) const;
virtual bool should_draw_nav_point(long, long) const;
virtual void render(long user_index) const;
virtual void render_debug(long user_index) const;
virtual void submit_nav_points(long user_index, long player_index) const;
virtual bool build_player_nav_point(long a1, long a2, long a3, bool a4, s_chud_navpoint* chud_navpoint) const;
virtual bool should_draw_nav_point(long user_index, long player_index) const;
virtual void update() const;
virtual void player_update(long) const;
virtual void assemble_baseline_traits_for_player(long, c_player_traits*) const;
virtual void apply_game_engine_traits_for_player(long, c_player_traits*) const;
virtual void assemble_spawn_influencers_for_player(long, s_netgame_goal_influencer*, long*) const;
virtual long compare_players(long, long) const;
virtual long compare_teams(e_game_team, e_game_team) const;
virtual bool allow_weapon_pickup(long, long) const;
virtual bool should_auto_pickup_weapon(long, long) const;
virtual void player_nearby_multiplayer_weapon(long, long) const;
virtual long object_get_emblem_player(long) const;
virtual real compute_object_function(long, long) const;
virtual void multiplayer_weapon_register(long) const;
virtual void multiplayer_weapon_deregister(long) const;
virtual void multiplayer_weapon_picked_up(long, long) const;
virtual void multiplayer_weapon_dropped(long, long) const;
virtual void handle_deleted_object(long) const;
virtual void player_update(long player_index) const;
virtual void assemble_baseline_traits_for_player(long player_index, c_player_traits* player_traits) const;
virtual void apply_game_engine_traits_for_player(long player_index, c_player_traits* player_traits) const;
virtual void assemble_spawn_influencers_for_player(long a1, s_netgame_goal_influencer* influencer, long* a3) const;
virtual long compare_players(long player_index_a, long player_index_b) const;
virtual long compare_teams(e_game_team team_a, e_game_team team_b) const;
virtual bool allow_weapon_pickup(long player_index, long weapon_index) const;
virtual bool should_auto_pickup_weapon(long player_index, long weapon_index) const;
virtual void player_nearby_multiplayer_weapon(long a1, long a2) const;
virtual long object_get_emblem_player(long object_index) const;
virtual real compute_object_function(long object_index, long name) const;
virtual void multiplayer_weapon_register(long weapon_index) const;
virtual void multiplayer_weapon_deregister(long weapon_index) const;
virtual void multiplayer_weapon_picked_up(long weapon_index, long unit_index) const;
virtual void multiplayer_weapon_dropped(long weapon_index, long unit_index) const;
virtual void handle_deleted_object(long object_index) const;
virtual long get_time_left_in_ticks(long, bool, bool) const;
virtual e_game_team get_defending_team_index() const;
virtual e_multiplayer_team_designator get_player_team_designator(long) const;
Expand Down

0 comments on commit 4ed9d07

Please sign in to comment.