Skip to content

Commit

Permalink
Updated g_game_systems (FINAL)
Browse files Browse the repository at this point in the history
`game_sound`, `cinematic`, `object_placement`, `havok`, `object_broadphase`, `player_positions`, `ai`, `portal_activation`, `render_state_cache`

This was *almost* as tedious as TLS (Thread Local Storage) *almost*
  • Loading branch information
twist84 committed Aug 31, 2024
1 parent 5739706 commit f20ebb7
Show file tree
Hide file tree
Showing 21 changed files with 596 additions and 101 deletions.
2 changes: 2 additions & 0 deletions game/game.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -702,6 +702,7 @@ copy /b $(ProjectDir)source\config\version.cpp +,, $(ProjectDir)source\config\ve
<ClCompile Include="source\units\vehicle_type_component.cpp" />
<ClCompile Include="source\units\vehicle_type_human_tank.cpp" />
<ClCompile Include="source\visibility\visibility_collection.cpp" />
<ClCompile Include="source\visibility\visibility_portal_activation.cpp" />
<ClCompile Include="source\visibility\visibility_render_objects.cpp" />
<ClCompile Include="source\xbox\xbox.cpp" />
<ClCompile Include="source\xbox\xgraphics.cpp" />
Expand Down Expand Up @@ -1419,6 +1420,7 @@ copy /b $(ProjectDir)source\config\version.cpp +,, $(ProjectDir)source\config\ve
<ClInclude Include="source\units\vehicle_type_vtol.hpp" />
<ClInclude Include="source\units\vehicle_utilities.hpp" />
<ClInclude Include="source\visibility\visibility_collection.hpp" />
<ClInclude Include="source\visibility\visibility_portal_activation.hpp" />
<ClInclude Include="source\visibility\visibility_render_objects.hpp" />
<ClInclude Include="source\xbox\xbox.hpp" />
<ClInclude Include="source\xbox\xgraphics.hpp" />
Expand Down
6 changes: 6 additions & 0 deletions game/game.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -1581,6 +1581,9 @@
<ClCompile Include="source\error\error_report_render.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="source\visibility\visibility_portal_activation.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="source\camera\camera.hpp">
Expand Down Expand Up @@ -3728,6 +3731,9 @@
<ClInclude Include="source\error\error_report_render.hpp">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="source\visibility\visibility_portal_activation.hpp">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="resource\resource.rc">
Expand Down
38 changes: 32 additions & 6 deletions game/source/ai/ai.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,22 @@
//.text:01431360 ;
//.text:014313B0 ; double __cdecl ai_danger_level(short)
//.text:014314C0 ;
//.text:014314D0 ; void __cdecl ai_dispose()
//.text:01431500 ; void __cdecl ai_dispose_from_old_map()
//.text:01431570 ; void __cdecl ai_dispose_from_old_structure_bsp(dword)

void __cdecl ai_dispose()
{
INVOKE(0x014314D0, ai_dispose);
}

void __cdecl ai_dispose_from_old_map()
{
INVOKE(0x01431500, ai_dispose_from_old_map);
}

void __cdecl ai_dispose_from_old_structure_bsp(dword structure_bsp_mask)
{
INVOKE(0x01431570, ai_dispose_from_old_structure_bsp, structure_bsp_mask);
}

//.text:01431670 ; bool __cdecl ai_enemies_attacking_players(long*, dword*)

bool __cdecl ai_enemies_can_see_player(long* out_unit_index)
Expand Down Expand Up @@ -117,9 +130,22 @@ void __cdecl ai_handle_bump(long object_index, long bump_object_index, vector3d
//.text:01433E70 ;
//.text:01433E80 ;
//.text:01433E90 ;
//.text:01433EA0 ; void __cdecl ai_initialize()
//.text:01433F70 ; void __cdecl ai_initialize_for_new_map()
//.text:01434010 ; void __cdecl ai_initialize_for_new_structure_bsp(dword)

void __cdecl ai_initialize()
{
INVOKE(0x01433EA0, ai_initialize);
}

void __cdecl ai_initialize_for_new_map()
{
INVOKE(0x01433F70, ai_initialize_for_new_map);
}

void __cdecl ai_initialize_for_new_structure_bsp(dword structure_bsp_mask)
{
INVOKE(0x01434010, ai_initialize_for_new_structure_bsp, structure_bsp_mask);
}

//.text:01434150 ; void __cdecl ai_initialize_for_saved_game(long)
//.text:01434180 ; void __cdecl ai_place(long)
//.text:014341B0 ; long __cdecl ai_release_inactive_squads(long, byte*, long, bool*, char*, long)
Expand Down
6 changes: 6 additions & 0 deletions game/source/ai/ai.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,16 @@ struct ai_globals_type
};
static_assert(sizeof(ai_globals_type) == 0x688);

extern void __cdecl ai_dispose();
extern void __cdecl ai_dispose_from_old_map();
extern void __cdecl ai_dispose_from_old_structure_bsp(dword structure_bsp_mask);
extern bool __cdecl ai_enemies_can_see_player(long* out_unit_index);
extern void __cdecl ai_erase(long squad_index, bool delete_immediately);
extern bool __cdecl ai_get_active_clusters(long a1, dword* a2, long a3);
extern void __cdecl ai_globals_set_ai_active(bool ai_active);
extern void __cdecl ai_handle_bump(long object_index, long bump_object_index, vector3d const* linear_velocity);
extern void __cdecl ai_initialize();
extern void __cdecl ai_initialize_for_new_map();
extern void __cdecl ai_initialize_for_new_structure_bsp(dword structure_bsp_mask);
extern void __cdecl ai_update();

132 changes: 126 additions & 6 deletions game/source/cutscene/cinematics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,129 @@
//bool g_cinematic_debugging_enable = false;
//bool g_cinematic_render_enable = false;

void __cdecl cinematic_dispose()
{
INVOKE(0x0067CE30, cinematic_dispose);
}

void __cdecl cinematic_dispose_from_old_map()
{
INVOKE(0x0067CE40, cinematic_dispose_from_old_map);
}

void __cdecl cinematic_dispose_from_old_non_bsp_zone_set(s_game_non_bsp_zone_set const* non_bsp_zone_set)
{
INVOKE(0x0067CE70, cinematic_dispose_from_old_non_bsp_zone_set, non_bsp_zone_set);
}

void __cdecl cinematic_dispose_from_old_structure_bsp(dword structure_bsp_mask)
{
INVOKE(0x0067CE80, cinematic_dispose_from_old_structure_bsp, structure_bsp_mask);
}

//.text:0067CE90 ;

void __cdecl cinematic_game_pause_handler(bool paused)
{
INVOKE(0x0067CEC0, cinematic_game_pause_handler, paused);
}

//.text:0067CF10 ; e_cinematic_channel_type __cdecl cinematic_get_channel_type()
//.text:0067CF60 ; s_cinematic_clip_global const* __cdecl cinematic_get_clip_planes(long*)
//.text:0067CF90 ; cinematic_get_debug_mode
//.text:0067CFA0 ;
//.text:0067CFE0 ;
//.text:0067D0A0 ; long __cdecl cinematic_get_early_exit()
//.text:0067D0C0 ;
//.text:0067D130 ; double __cdecl cinematic_get_letterbox_coverage()
//.text:0067D1C0 ; long __cdecl cinematic_get_scene_index(long, long)
//.text:0067D220 ;
//.text:0067D230 ;
//.text:0067D250 ;

bool __cdecl cinematic_in_progress()
{
return INVOKE(0x0067D270, cinematic_in_progress);
}

void __cdecl cinematic_initialize()
{
INVOKE(0x0067D2A0, cinematic_initialize);
}

void __cdecl cinematic_initialize_for_new_map()
{
INVOKE(0x0067D300, cinematic_initialize_for_new_map);
}

void __cdecl cinematic_initialize_for_new_non_bsp_zone_set(s_game_non_bsp_zone_set const* non_bsp_zone_set)
{
INVOKE(0x0067D400, cinematic_initialize_for_new_non_bsp_zone_set, non_bsp_zone_set);
}

void __cdecl cinematic_initialize_for_new_structure_bsp(dword structure_bsp_mask)
{
INVOKE(0x0067D410, cinematic_initialize_for_new_structure_bsp, structure_bsp_mask);
}

//.text:0067D420 ;
//.text:0067D480 ; void __cdecl cinematic_move_attached_objects(long, long, long, long)
//.text:0067D550 ;
//.text:0067D620 ;
//.text:0067D750 ;
//.text:0067D820 ;
//.text:0067D950 ;
//.text:0067DA30 ; void __cdecl cinematic_object_destroy_internal(long)
//.text:0067DAB0 ;
//.text:0067DB30 ;
//.text:0067DBC0 ; long __cdecl cinematic_object_try_and_get_by_index(long)
//.text:0067DC40 ;
//.text:0067DC60 ; void __cdecl cinematic_predict_shot(s_cinematic_scene*, long, long, c_tag_resource_collector*)

void __cdecl cinematic_prepare_for_new_zone_set(dword a1, dword a2)
{
INVOKE(0x0067DCE0, cinematic_prepare_for_new_zone_set, a1, a2);
}

void __cdecl cinematic_prepare_for_non_bsp_zone_set_switch(s_game_non_bsp_zone_set const* a1, s_game_non_bsp_zone_set const* a2, c_scenario_resource_registry* resource_registry)
{
INVOKE(0x0067DCF0, cinematic_prepare_for_non_bsp_zone_set_switch, a1, a2, resource_registry);
}

//.text:0067DDF0 ; void __cdecl cinematic_print(char const*)
//.text:0067DE00 ; void __cdecl cinematic_render(bool, bool)
//.text:0067E4C0 ; bool __cdecl cinematic_reverts_when_skipped()
//.text:0067E4F0 ;
//.text:0067E590 ;
//.text:0067E5C0 ;
//.text:0067E610 ;
//.text:0067E640 ; void __cdecl cinematic_scripting_suppress_bsp_object_creation(bool)
//.text:0067E660 ; void __cdecl cinematic_set(long)
//.text:0067E680 ; void __cdecl cinematic_set_chud_objective(short)
//.text:0067E700 ; void __cdecl cinematic_set_chud_objective(long, short)
//.text:0067E7B0 ; void __cdecl cinematic_set_debug_mode(bool)
//.text:0067E7C0 ; void __cdecl cinematic_set_early_exit(long)
//.text:0067E7E0 ; void __cdecl cinematic_set_shot(long, long)
//.text:0067E810 ; void __cdecl cinematic_set_title(short)
//.text:0067E830 ; void __cdecl cinematic_set_title_delayed(short, real)
//.text:0067E8B0 ; void __cdecl cinematic_show_letterbox(bool)
//.text:0067E8D0 ; void __cdecl cinematic_show_letterbox_immediate(bool)
//.text:0067E920 ;
//.text:0067E950 ;
//.text:0067E970 ;
//.text:0067E990 ; void __cdecl cinematic_start()
//.text:0067EA10 ; void __cdecl cinematic_start_user_skip_fade_out()
//.text:0067EA60 ; void __cdecl cinematic_stop()
//.text:0067EAD0 ; bool __cdecl cinematic_suppressing_bsp_object_creation()
//.text:0067EAF0 ; long __cdecl cinematic_tag_reference_get_animation(long, long, long)
//.text:0067EB70 ; long __cdecl cinematic_tag_reference_get_bink(long)
//.text:0067EBB0 ; long __cdecl cinematic_tag_reference_get_cinematic(long)
//.text:0067EBD0 ;
//.text:0067EC60 ; long __cdecl cinematic_tag_reference_get_effect(long, long, long, long)
//.text:0067ED00 ; long __cdecl cinematic_tag_reference_get_music(long, long, long, long)
//.text:0067ED90 ; long __cdecl cinematic_tag_reference_get_music_looping(long, long, long, long)
//.text:0067EDA0 ; long __cdecl cinematic_tag_reference_get_scene(long)

void __cdecl cinematic_update()
{
return INVOKE(0x0067EDF0, cinematic_update);
Expand All @@ -24,7 +137,19 @@ void __cdecl cinematics_game_tick()
return INVOKE(0x0067F080, cinematics_game_tick);
}

void __cdecl cinematic_debug_camera_control_update()
//.text:0067F0E0 ;
//.text:0067F140 ;
//.text:0067F160 ;
//.text:0067F170 ;
//.text:0067F1A0 ;
//.text:0067F1D0 ;

void __cdecl draw_quad(short_rectangle2d* rect, dword color)
{
return INVOKE(0x0067F200, draw_quad, rect, color);
}

void cinematic_debug_camera_control_update()
{
//TLS_DATA_GET_VALUE_REFERENCE(cinematic_new_globals);
//
Expand Down Expand Up @@ -112,8 +237,3 @@ void __cdecl cinematic_debug_camera_control_update()
//}
}

void __cdecl draw_quad(short_rectangle2d* rect, dword color)
{
return INVOKE(0x0067F200, draw_quad, rect, color);
}

16 changes: 15 additions & 1 deletion game/source/cutscene/cinematics.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,24 @@ struct s_cinematic_light_globals
};
static_assert(sizeof(s_cinematic_light_globals) == 0xB2C8);

struct s_game_non_bsp_zone_set;
struct c_scenario_resource_registry;

extern void __cdecl cinematic_dispose();
extern void __cdecl cinematic_dispose_from_old_map();
extern void __cdecl cinematic_dispose_from_old_non_bsp_zone_set(s_game_non_bsp_zone_set const* non_bsp_zone_set);
extern void __cdecl cinematic_dispose_from_old_structure_bsp(dword structure_bsp_mask);
extern void __cdecl cinematic_game_pause_handler(bool paused);
extern bool __cdecl cinematic_in_progress();
extern void __cdecl cinematic_initialize();
extern void __cdecl cinematic_initialize_for_new_map();
extern void __cdecl cinematic_initialize_for_new_non_bsp_zone_set(s_game_non_bsp_zone_set const* non_bsp_zone_set);
extern void __cdecl cinematic_initialize_for_new_structure_bsp(dword structure_bsp_mask);
extern void __cdecl cinematic_prepare_for_new_zone_set(dword a1, dword a2);
extern void __cdecl cinematic_prepare_for_non_bsp_zone_set_switch(s_game_non_bsp_zone_set const* a1, s_game_non_bsp_zone_set const* a2, c_scenario_resource_registry* resource_registry);
extern void __cdecl cinematic_update();
extern void __cdecl cinematics_game_tick();
extern void __cdecl cinematic_debug_camera_control_update();
extern void __cdecl draw_quad(short_rectangle2d* rect, dword color);

extern void cinematic_debug_camera_control_update();

Loading

0 comments on commit f20ebb7

Please sign in to comment.