diff --git a/game/source/objects/object_types.cpp b/game/source/objects/object_types.cpp index a811eac7e..283007e53 100644 --- a/game/source/objects/object_types.cpp +++ b/game/source/objects/object_types.cpp @@ -1,31 +1,15 @@ #include "objects/object_types.hpp" #include "game/players.hpp" -#include "visibility/visibility_collection.hpp" +#include "render/render_visibility.hpp" +#include "render/render_objects_static_lighting.hpp" REFERENCE_DECLARE_ARRAY(0x01948004, object_type_definition*, object_type_definitions, k_object_type_count); +bool debug_objects_player_only = false; long debug_object_index = NONE; long debug_objects_type_mask = 0; -bool debug_objects_player_only = false; - -void __cdecl render_invisible_objects_iterate(void(*function)(long)) -{ - ASSERT(function); - ASSERT(c_visible_items::get_cluster_starting_index() == 0); - - INVOKE(0x00A7BC50, render_invisible_objects_iterate, function); -} - -long __cdecl render_visible_objects_iterate(void(*function)(long)) -{ - ASSERT(function); - ASSERT(c_visible_items::get_root_objects_starting_index() == 0); - - return INVOKE(0x00A7C130, render_visible_objects_iterate, function); -} - void __cdecl object_type_adjust_placement(object_placement_data* data) { INVOKE(0x00B731D0, object_type_adjust_placement, data); @@ -37,7 +21,17 @@ void __cdecl object_type_adjust_placement(object_placement_data* data) //.text:00B73370 ; bool __cdecl object_type_compute_activation(long, s_game_cluster_bit_vectors const*, bool*) //.text:00B733E0 ; bool __cdecl object_type_compute_function_value(long, long, long, real*, bool*, bool*) //.text:00B73480 ; void __cdecl object_type_create_children(long) -//.text:00B734F0 ; object_type_definition* __cdecl object_type_definition_get(e_object_type) + +object_type_definition* __cdecl object_type_definition_get(e_object_type object_type) +{ + //return INVOKE(0x00B734F0, object_type_definition_get, object_type); + + ASSERT(object_type_definitions[object_type]); + ASSERT(object_type_definitions[object_type]->group_tag); + + return object_type_definitions[object_type]; +} + //.text:00B73500 ; void __cdecl object_type_delete(long) //.text:00B735A0 ; void __cdecl object_type_detach_from_parent(long) //.text:00B73610 ; void __cdecl object_detach_simulation_object_glue(long, long) @@ -75,7 +69,7 @@ void __cdecl object_type_adjust_placement(object_placement_data* data) //.text:00B742B0 ; void __cdecl object_types_initialize() //.text:00B74480 ; void __cdecl object_types_initialize_for_new_map() -void __cdecl render_debug_objects() +void render_debug_objects() { if (!debug_objects) return; @@ -84,7 +78,7 @@ void __cdecl render_debug_objects() render_invisible_objects_iterate(object_type_render_debug); } -void __cdecl object_type_render_debug(long object_index) +void object_type_render_debug(long object_index) { if (!should_render_debug_object(object_index)) return; @@ -97,7 +91,6 @@ void __cdecl object_type_render_debug(long object_index) if (!definition) return; - for (long i = 0; definition->type_definitions[i]; i++) { if (definition->type_definitions[i]->render_debug_proc && (!debug_objects_player_only || player_index_from_unit_index(object_index) != NONE)) @@ -108,12 +101,7 @@ void __cdecl object_type_render_debug(long object_index) object_type_render_debug(child_object_index); } -bool __cdecl render_object_should_be_visible(long object_index) -{ - return INVOKE(0x00A450F0, render_object_should_be_visible, object_index); -} - -bool __cdecl should_render_debug_object(long object_index) +bool should_render_debug_object(long object_index) { if (debug_object_index == NONE) { @@ -128,11 +116,3 @@ bool __cdecl should_render_debug_object(long object_index) return false; } -object_type_definition* __cdecl object_type_definition_get(e_object_type object_type) -{ - ASSERT(object_type_definitions[object_type]); - ASSERT(object_type_definitions[object_type]->group_tag); - - return object_type_definitions[object_type]; -} - diff --git a/game/source/objects/object_types.hpp b/game/source/objects/object_types.hpp index fd6191763..d347e7bfc 100644 --- a/game/source/objects/object_types.hpp +++ b/game/source/objects/object_types.hpp @@ -72,16 +72,16 @@ struct object_type_definition }; static_assert(sizeof(object_type_definition) == 0xF4); +extern bool debug_objects_player_only; extern long debug_object_index; extern long debug_objects_type_mask; -extern bool debug_objects_player_only; -extern object_type_definition* (&object_type_definitions)[k_object_type_count]; +extern object_type_definition*(&object_type_definitions)[k_object_type_count]; extern void __cdecl object_type_adjust_placement(object_placement_data* data); - -extern void __cdecl render_debug_objects(); -extern void __cdecl object_type_render_debug(long object_index); -extern bool __cdecl should_render_debug_object(long object_index); extern object_type_definition* __cdecl object_type_definition_get(e_object_type object_type); +extern void render_debug_objects(); +extern void object_type_render_debug(long object_index); +extern bool should_render_debug_object(long object_index); + diff --git a/game/source/render/render_objects_static_lighting.cpp b/game/source/render/render_objects_static_lighting.cpp index e91372511..cd3ad89bf 100644 --- a/game/source/render/render_objects_static_lighting.cpp +++ b/game/source/render/render_objects_static_lighting.cpp @@ -2,8 +2,59 @@ REFERENCE_DECLARE(0x050FB668, s_render_object_first_person_globals, render_object_globals); +//.text:00A42000 ; +//.text:00A42020 ; +//.text:00A42030 ; +//.text:00A42060 ; +//.text:00A420A0 ; +//.text:00A420D0 ; +//.text:00A42110 ; +//.text:00A42140 ; +//.text:00A421E0 ; +//.text:00A425E0 ; +//.text:00A439A0 ; bool __cdecl is_dynamic_object(e_object_type) + render_lighting const* object_get_cached_render_lighting(long object_index) { return INVOKE(0x00A43A40, object_get_cached_render_lighting, object_index); } +//.text:00A43AC0 ; long __cdecl object_get_cached_render_state(long) +//.text:00A43D10 ; +//.text:00A43D70 ; +//.text:00A445A0 ; render_lighting* __cdecl object_update_cached_render_lighting(long, real) +//.text:00A44740 ; +//.text:00A44750 ; long __cdecl render_model_allocate_and_fill_skinning_matrices(long, byte*, byte, real_matrix4x3 const*, long*, long) +//.text:00A447B0 ; +//.text:00A447C0 ; +//.text:00A44840 ; void __cdecl render_object_calculate_alphas(long, real_point3d const*, real, long, bool, bool, real*) +//.text:00A44BE0 ; bool __cdecl render_object_first_person_globals_valid(void) +//.text:00A44C10 ; +//.text:00A44C70 ; void __cdecl render_object_get_render_model_from_index(long, bool, long*, real_matrix4x3 const**, long*) +//.text:00A44D30 ; s_shader_extern_info* __cdecl render_object_get_render_state_info(long) +//.text:00A44D80 ; char* __cdecl render_object_get_render_state_last_level_of_detail(long) +//.text:00A44DD0 ; char* __cdecl render_object_get_render_state_last_permutations(long, long) +//.text:00A44E30 ; bool __cdecl render_object_get_render_state_last_sample_position(long, real_point3d*) +//.text:00A44E90 ; bool __cdecl render_object_has_lightmap_shadow(long) +//.text:00A44F20 ; void __cdecl render_object_invalidate_cached_render_state(long) +//.text:00A44F70 ; void __cdecl render_object_invalidate_render_state(long) +//.text:00A44FD0 ; bool __cdecl render_object_is_first_person_or_child_weapon(e_output_user_index, long) +//.text:00A45060 ; + +bool __cdecl render_object_should_be_visible(long object_index) +{ + return INVOKE(0x00A450F0, render_object_should_be_visible, object_index); +} + +//.text:00A45160 ; void __cdecl render_object_update_change_colors(long, bool) +//.text:00A45240 ; +//.text:00A45250 ; +//.text:00A45270 ; +//.text:00A452B0 ; void __cdecl render_objects_initialize() +//.text:00A452F0 ; void __cdecl render_objects_initialize_for_new_map() +//.text:00A45310 ; void __cdecl render_objects_prepare_for_window(e_output_user_index) +//.text:00A45410 ; void __cdecl render_objects_reset_render_state(long) +//.text:00A45470 ; +//.text:00A454B0 ; +//.text:00A454D0 ; + diff --git a/game/source/render/render_objects_static_lighting.hpp b/game/source/render/render_objects_static_lighting.hpp index 2c393f2d4..19c7946eb 100644 --- a/game/source/render/render_objects_static_lighting.hpp +++ b/game/source/render/render_objects_static_lighting.hpp @@ -81,4 +81,5 @@ static_assert(sizeof(s_render_object_first_person_globals) == 0xB720); extern s_render_object_first_person_globals& render_object_globals; extern render_lighting const* object_get_cached_render_lighting(long object_index); +extern bool __cdecl render_object_should_be_visible(long object_index); diff --git a/game/source/render/render_visibility.cpp b/game/source/render/render_visibility.cpp index bf9f130f0..75cbb7491 100644 --- a/game/source/render/render_visibility.cpp +++ b/game/source/render/render_visibility.cpp @@ -1,7 +1,25 @@ #include "render/render_visibility.hpp" +#include "visibility/visibility_collection.hpp" + bool debug_pvs_activation = false; +long __cdecl render_visible_objects_iterate(void(*function)(long)) +{ + ASSERT(function); + ASSERT(c_visible_items::get_root_objects_starting_index() == 0); + + return INVOKE(0x00A7C130, render_visible_objects_iterate, function); +} + +void __cdecl render_invisible_objects_iterate(void(*function)(long)) +{ + ASSERT(function); + ASSERT(c_visible_items::get_cluster_starting_index() == 0); + + INVOKE(0x00A7BC50, render_invisible_objects_iterate, function); +} + bool __cdecl render_sphere_visible(real_point3d const* center, real radius) { return INVOKE(0x00A7BDA0, render_sphere_visible, center, radius); diff --git a/game/source/render/render_visibility.hpp b/game/source/render/render_visibility.hpp index 5d175dd77..69e28da3e 100644 --- a/game/source/render/render_visibility.hpp +++ b/game/source/render/render_visibility.hpp @@ -4,5 +4,7 @@ extern bool debug_pvs_activation; +extern long __cdecl render_visible_objects_iterate(void(*function)(long)); +extern void __cdecl render_invisible_objects_iterate(void(*function)(long)); extern bool __cdecl render_sphere_visible(real_point3d const* center, real radius);