Skip to content

Commit a68b4e9

Browse files
committed
Refactored some structures
This has all the potential to break the codebase
1 parent 7535580 commit a68b4e9

File tree

59 files changed

+695
-677
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+695
-677
lines changed

game/game.vcxproj

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1380,7 +1380,6 @@ copy /b $(ProjectDir)source\config\version.cpp +,, $(ProjectDir)source\config\ve
13801380
<ClInclude Include="source\networking\session\network_session_parameters_session.hpp" />
13811381
<ClInclude Include="source\networking\session\network_session_parameters_ui.hpp" />
13821382
<ClInclude Include="source\networking\session\network_session_parameter_type_collection.hpp" />
1383-
<ClInclude Include="source\networking\session\network_session_state.hpp" />
13841383
<ClInclude Include="source\networking\tools\http_client.hpp" />
13851384
<ClInclude Include="source\networking\tools\http_stream.hpp" />
13861385
<ClInclude Include="source\networking\tools\network_blf.hpp" />

game/game.vcxproj.filters

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3131,9 +3131,6 @@
31313131
<ClInclude Include="source\tag_files\tag_resource_cache_stoler.hpp">
31323132
<Filter>Header Files</Filter>
31333133
</ClInclude>
3134-
<ClInclude Include="source\networking\session\network_session_state.hpp">
3135-
<Filter>Header Files</Filter>
3136-
</ClInclude>
31373134
<ClInclude Include="source\cseries\stack_walk_windows.hpp">
31383135
<Filter>Header Files</Filter>
31393136
</ClInclude>

game/source/_force_includes/_force_included_enums.hpp

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,12 @@ enum
1515
k_maximum_scenario_zone_set_count = 48,
1616
};
1717

18+
enum
19+
{
20+
k_network_maximum_machines_per_session = 17,
21+
k_network_maximum_players_per_session = 16,
22+
};
23+
1824
enum
1925
{
2026
_campaign_player0 = 0,
@@ -680,6 +686,24 @@ enum e_network_session_boot_reason
680686
k_network_session_boot_reason_count
681687
};
682688

689+
enum e_network_session_state
690+
{
691+
_network_session_state_none = 0,
692+
_network_session_state_peer_creating,
693+
_network_session_state_peer_joining,
694+
_network_session_state_peer_join_abort,
695+
_network_session_state_peer_established,
696+
_network_session_state_peer_leaving,
697+
_network_session_state_host_established,
698+
_network_session_state_host_disband,
699+
700+
//_network_session_state_host_handoff,
701+
//_network_session_state_host_reestablish,
702+
//_network_session_state_election,
703+
704+
k_network_session_state_count
705+
};
706+
683707
enum e_life_cycle_join_result
684708
{
685709
_life_cycle_join_result_none = 0,

game/source/cache/cache_files.hpp

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -340,11 +340,8 @@ extern void cache_files_update_main_status();
340340

341341
struct tag_iterator
342342
{
343-
uint32 __unknown0;
344-
uint32 __unknown4;
345-
int32 datum_index;
346-
int32 absolute_tag_index;
347-
tag group_tag;
343+
c_data_iterator<void/*s_tag_instance_datum*/> iterator;
344+
tag key_group_tag;
348345
};
349346
static_assert(sizeof(tag_iterator) == 0x14);
350347

game/source/game/cheats.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ void __cdecl cheat_all_chars()
8080

8181
char const* tag_name = tag_get_name(tag_index);
8282
if (tag_name && strstr(tag_name, "character"))
83-
tag_reference_set(&references[reference_count++], iterator.group_tag, tag_name);
83+
tag_reference_set(&references[reference_count++], iterator.key_group_tag, tag_name);
8484
}
8585

8686
cheat_objects(references, reference_count);
@@ -105,9 +105,9 @@ void __cdecl cheat_all_powerups()
105105
if (!VALID_INDEX(reference_count, NUMBEROF(references)))
106106
break;
107107

108-
struct equipment_definition* equipment_definition = TAG_GET(iterator.group_tag, struct equipment_definition, tag_index);
108+
struct equipment_definition* equipment_definition = TAG_GET(iterator.key_group_tag, struct equipment_definition, tag_index);
109109
if (equipment_definition->equipment.spawner.count)
110-
tag_reference_set(&references[reference_count++], iterator.group_tag, tag_get_name(tag_index));
110+
tag_reference_set(&references[reference_count++], iterator.key_group_tag, tag_get_name(tag_index));
111111
}
112112

113113
cheat_objects(references, reference_count);
@@ -126,9 +126,9 @@ void __cdecl cheat_all_vehicles()
126126
if (!VALID_INDEX(reference_count, NUMBEROF(references)))
127127
break;
128128

129-
struct vehicle_definition* vehicle_definition = TAG_GET(iterator.group_tag, struct vehicle_definition, tag_index);
129+
struct vehicle_definition* vehicle_definition = TAG_GET(iterator.key_group_tag, struct vehicle_definition, tag_index);
130130
if (vehicle_definition->unit.powered_seats.count > 0)
131-
tag_reference_set(&references[reference_count++], iterator.group_tag, tag_get_name(tag_index));
131+
tag_reference_set(&references[reference_count++], iterator.key_group_tag, tag_get_name(tag_index));
132132
}
133133

134134
cheat_objects(references, reference_count);
@@ -146,7 +146,7 @@ void __cdecl cheat_all_weapons()
146146
if (!VALID_INDEX(reference_count, NUMBEROF(references)))
147147
break;
148148

149-
tag_reference_set(&references[reference_count++], iterator.group_tag, tag_get_name(tag_index));
149+
tag_reference_set(&references[reference_count++], iterator.key_group_tag, tag_get_name(tag_index));
150150
}
151151

152152
cheat_objects(references, reference_count);
@@ -170,7 +170,7 @@ bool __cdecl cheat_drop_effect(tag group_tag, char const* effect_name, int32 eff
170170
return false;
171171
}
172172

173-
real_point3d collision_position = collision.position;
173+
real_point3d collision_position = collision.point;
174174
real_vector3d normal = collision.plane.n;
175175

176176
collision_position.x -= forward->i * 0.25f;
@@ -542,7 +542,7 @@ void __cdecl cheat_spawn_warthog()
542542

543543
char const* tag_name = tag_get_name(tag_index);
544544
if (tag_name && strstr(tag_name, "warthog"))
545-
tag_reference_set(&references[reference_count++], iterator.group_tag, tag_name);
545+
tag_reference_set(&references[reference_count++], iterator.key_group_tag, tag_name);
546546
}
547547

548548
cheat_objects(references, reference_count);

game/source/game/players.hpp

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -202,21 +202,15 @@ struct game_machine_options
202202
static_assert(sizeof(game_machine_options) == 0x128);
203203
#pragma pack(pop)
204204

205-
struct s_network_session_status_data_player
206-
{
207-
s_player_identifier identifier;
208-
s_player_configuration configuration;
209-
};
210-
static_assert(sizeof(s_network_session_status_data_player) == 0x1628);
211-
212205
struct game_player_options
213206
{
214-
bool player_valid;
207+
bool valid;
215208
bool player_left_game;
216209
int16 user_index;
217210
int32 controller_index;
218211
s_machine_identifier machine_identifier;
219-
s_network_session_status_data_player player_data;
212+
s_player_identifier player_identifier;
213+
s_player_configuration configuration_data;
220214
};
221215
static_assert(sizeof(game_player_options) == 0x1640);
222216

game/source/interface/gui_screens/game_details/gui_game_details.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,6 @@ struct c_gui_game_details :
1515
}
1616

1717
//protected:
18-
s_network_session_status_data m_status_data;
18+
s_network_squad_status_data m_status_data;
1919
};
2020
static_assert(sizeof(c_gui_game_details) == 0x17F60);

game/source/interface/user_interface_session.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,8 @@ int32 __cdecl user_interface_local_player_count()
6767
return INVOKE(0x00A812A0, user_interface_local_player_count);
6868
}
6969

70-
//.text:00A81370 ; bool __cdecl user_interface_remote_squad_contains_local_peer(s_network_session_status_data const* status_data)
71-
//.text:00A81440 ; bool __cdecl user_interface_remote_squad_is_joinable(s_network_session_status_data const* status_data)
70+
//.text:00A81370 ; bool __cdecl user_interface_remote_squad_contains_local_peer(s_network_squad_status_data const* status_data)
71+
//.text:00A81440 ; bool __cdecl user_interface_remote_squad_is_joinable(s_network_squad_status_data const* status_data)
7272
//.text:00A81510 ; bool __cdecl user_interface_squad_can_new_user_join(int32 user_index)
7373

7474
e_controller_index user_interface_session_get_controller_index(int32 player_index)

game/source/main/main_render.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -765,7 +765,7 @@ void __cdecl game_engine_render_frame_watermarks(bool pregame)
765765
game_engine_render_window_watermarks(NONE);
766766

767767
//game_engine_render_frame_watermarks_for_controller(controller_get_first_non_guest_signed_in_controller());
768-
//game_engine_render_frame_watermarks_for_controller(static_cast<e_controller_index>(DECLFUNC(0x00A94930, int16, __cdecl)()));
768+
//game_engine_render_frame_watermarks_for_controller((e_controller_index)DECLFUNC(0x00A94930, int16, __cdecl)());
769769
game_engine_render_frame_watermarks_for_controller(_controller0);
770770
}
771771

game/source/main/main_time.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,16 +49,18 @@ void rasterizer_render_debug_frame_deltas()
4949
bounds.x0 = int16(bounds.x1 - (50.0f * draw_string_get_glyph_scaling_for_display_settings()));
5050
bounds.y0 = int16(bounds.y1 - (75.0f * draw_string_get_glyph_scaling_for_display_settings()));
5151

52-
for (int32 i = (rasterizer_globals.frame_delta_index + 14) % 15; i != rasterizer_globals.frame_delta_index; i = (i + 14) % 15)
52+
for (int32 flip_delta_index = (rasterizer_globals.next_flip_delta_index + 14) % 15;
53+
flip_delta_index != rasterizer_globals.next_flip_delta_index;
54+
flip_delta_index = (flip_delta_index + 14) % 15)
5355
{
5456
bounds.y0 -= 20;
5557
bounds.y1 -= 20;
5658

5759
char str[8]{};
58-
csnzprintf(str, 4, "%d", rasterizer_globals.frame_deltas[i]);
60+
csnzprintf(str, 4, "%d", rasterizer_globals.flip_deltas[flip_delta_index]);
5961

6062
real_argb_color const* color = global_real_argb_green;
61-
if (rasterizer_globals.frame_deltas[i] > 2)
63+
if (rasterizer_globals.flip_deltas[flip_delta_index] > 2)
6264
color = global_real_argb_red;
6365

6466
draw_string.set_justification(_text_justification_right);

0 commit comments

Comments
 (0)