Skip to content

Commit

Permalink
Mapped c_havok_entity_iterator
Browse files Browse the repository at this point in the history
  • Loading branch information
theTwister authored and theTwister committed Aug 11, 2023
1 parent 6da2798 commit 4327e22
Show file tree
Hide file tree
Showing 5 changed files with 60 additions and 0 deletions.
2 changes: 2 additions & 0 deletions game/game.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -391,6 +391,7 @@ POPD
<ClCompile Include="source\physics\collisions.cpp" />
<ClCompile Include="source\physics\havok.cpp" />
<ClCompile Include="source\physics\havok_component.cpp" />
<ClCompile Include="source\physics\havok_entity_iterator.cpp" />
<ClCompile Include="source\physics\havok_utilities.cpp" />
<ClCompile Include="source\physics\physics_constants.cpp" />
<ClCompile Include="source\rasterizer\rasterizer.cpp" />
Expand Down Expand Up @@ -783,6 +784,7 @@ POPD
<ClInclude Include="source\physics\collision_model_definitions.hpp" />
<ClInclude Include="source\physics\havok.hpp" />
<ClInclude Include="source\physics\havok_component.hpp" />
<ClInclude Include="source\physics\havok_entity_iterator.hpp" />
<ClInclude Include="source\physics\havok_mopp_code_definitions.hpp" />
<ClInclude Include="source\physics\havok_utilities.hpp" />
<ClInclude Include="source\physics\havok_vehicle_physics_definitions.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 @@ -834,6 +834,9 @@
<ClCompile Include="source\physics\havok_component.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="source\physics\havok_entity_iterator.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="source\camera\camera.hpp">
Expand Down Expand Up @@ -2129,6 +2132,9 @@
<ClInclude Include="source\physics\havok_component.hpp">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="source\physics\havok_entity_iterator.hpp">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<None Include="source\tag_files\string_ids\string_ids.global_strings.inl">
Expand Down
28 changes: 28 additions & 0 deletions game/source/main/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@
#include "networking/session/network_managed_session.hpp"
#include "networking/tools/network_blf.hpp"
#include "networking/tools/remote_command.hpp"
#include "physics/havok_component.hpp"
#include "physics/havok_entity_iterator.hpp"
#include "rasterizer/rasterizer.hpp"
#include "render/render_objects_static_lighting.hpp"
#include "render/views/render_view.hpp"
Expand Down Expand Up @@ -236,6 +238,32 @@ void __cdecl main_loop_body_begin()
cache_file_table_of_contents;
cache_file_copy_globals;
g_service_client;
g_havok_component_data;

c_data_iterator<c_havok_component> havok_component_iterator(g_havok_component_data);
while (havok_component_iterator.next())
{
if (c_havok_component* havok_component = havok_component_iterator.get_datum())
{
c_console::write_line("havok_component[%d]->m_rigid_body:", havok_component_iterator.get_absolute_index());

c_console::write_line("\t__point1C = { .x = %.2f, .y = %.2f, .z = %.2f };",
havok_component->m_rigid_body.__point1C.x,
havok_component->m_rigid_body.__point1C.y,
havok_component->m_rigid_body.__point1C.z
);
c_console::write_line("\t__vector28 = { .i = %.2f, .j = %.2f, .k = %.2f };",
havok_component->m_rigid_body.__vector28.i,
havok_component->m_rigid_body.__vector28.j,
havok_component->m_rigid_body.__vector28.k
);
c_console::write_line("\t__vector34 = { .i = %.2f, .j = %.2f, .k = %.2f };",
havok_component->m_rigid_body.__vector34.i,
havok_component->m_rigid_body.__vector34.j,
havok_component->m_rigid_body.__vector34.k
);
}
}

TLS_DATA_GET_VALUE_REFERENCE(g_objectives);
TLS_DATA_GET_VALUE_REFERENCE(ai_globals);
Expand Down
6 changes: 6 additions & 0 deletions game/source/physics/havok_entity_iterator.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#include "physics/havok_entity_iterator.hpp"

#include "cseries/cseries.hpp"

REFERENCE_DECLARE(0x04FC48E8, short, c_havok_entity_iterator::g_num_entity_iterators_in_use);

18 changes: 18 additions & 0 deletions game/source/physics/havok_entity_iterator.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#pragma once

struct hkWorld;
struct c_havok_entity_iterator
{
protected:
bool m_iterating;
bool m_inactive_simulation_islands;
long m_island_index;
long m_entity_index;
hkWorld* m_world;
long m_iteration_type;

private:
static short& g_num_entity_iterators_in_use;
};
static_assert(sizeof(c_havok_entity_iterator) == 0x14);

0 comments on commit 4327e22

Please sign in to comment.