diff --git a/xlive/Blam/Engine/Networking/PlayerPrediction.h b/xlive/Blam/Engine/Networking/PlayerPrediction.h index 384d135d2..5701f561f 100644 --- a/xlive/Blam/Engine/Networking/PlayerPrediction.h +++ b/xlive/Blam/Engine/Networking/PlayerPrediction.h @@ -4,7 +4,7 @@ struct s_player_prediction { - DWORD predicted_entity_index; + int predicted_entity_index; real_vector3d point_quantized; real_vector3d prediction_axis; real_vector3d prediction_axis2; diff --git a/xlive/Blam/Engine/camera/dead_camera.cpp b/xlive/Blam/Engine/camera/dead_camera.cpp index 05dc55b0a..9c320acef 100644 --- a/xlive/Blam/Engine/camera/dead_camera.cpp +++ b/xlive/Blam/Engine/camera/dead_camera.cpp @@ -31,7 +31,7 @@ __declspec(naked) void object_try_get_node_position_interpolated_intermediate() mov esi, [esp + 4 + current_stack_offset + 0Ch] retn } -#undef current_stack_offset (0Ch) +#undef current_stack_offset } void apply_dead_camera_patches() diff --git a/xlive/Blam/Engine/effects/particle.cpp b/xlive/Blam/Engine/effects/particle.cpp index cbf7a6ef5..283de9629 100644 --- a/xlive/Blam/Engine/effects/particle.cpp +++ b/xlive/Blam/Engine/effects/particle.cpp @@ -9,7 +9,6 @@ s_data_array* get_particle_table() { return *Memory::GetAddress(0x4DD08C, 0x5053B4); } -real32 g_particle_delta_temp; real32 g_particle_interpolator_delta = 0.f; real32 g_particle_interpolator_delta_remainder = 0.f; bool particle_interpolator_enabled = false; @@ -110,7 +109,6 @@ real_vector3d* halo_interpolator_particle_get_interpolated_velocity(datum partic void particle_update(real32 delta) { s_data_iterator particle_system_it(get_particle_system_table()); - g_particle_delta_temp = delta; while (particle_system_it.get_next_datum()) { c_particle_system* particle_system = particle_system_it.get_current_datum(); @@ -123,7 +121,8 @@ void particle_update(real32 delta) c_particle_system::destroy(particle_system_it.get_current_datum_index()); } } - halo_particle_interpolator_update(); + // we run at dt, baby!! + // halo_particle_interpolator_update(); /*g_particle_interpolator_delta += delta; @@ -139,6 +138,8 @@ void particle_update(real32 delta) nearest_whole_tick_delta += game_tick_length; } while (accumulated_delta >= game_tick_length); + accumulated_delta -= ((int32)(accumulated_delta / game_tick_length) * game_tick_length); + g_particle_interpolator_delta = accumulated_delta; if(nearest_whole_tick_delta > 0.f) diff --git a/xlive/Blam/Engine/effects/particle.h b/xlive/Blam/Engine/effects/particle.h index 6743a1051..21d2aa1e2 100644 --- a/xlive/Blam/Engine/effects/particle.h +++ b/xlive/Blam/Engine/effects/particle.h @@ -57,7 +57,6 @@ struct s_particle_frame_data_storage s_particle_interpolation_data_storage target_data; }; -extern real32 g_particle_delta_temp; extern real32 g_particle_interpolator_delta; extern real32 g_particle_interpolator_delta_remainder; extern s_particle_frame_data_storage* g_particle_frame_storage; diff --git a/xlive/Blam/Engine/effects/particle_update.cpp b/xlive/Blam/Engine/effects/particle_update.cpp index 01f7c9688..c037fc21d 100644 --- a/xlive/Blam/Engine/effects/particle_update.cpp +++ b/xlive/Blam/Engine/effects/particle_update.cpp @@ -149,7 +149,7 @@ real_vector3d* __cdecl particle_update_points_interpolate_hook(const real_vector void apply_particle_update_patches() { //p_particle_system_update_particle_position_and_velocity = Memory::GetAddress(0xC4125); - PatchCall(Memory::GetAddress(0x10459E), particle_system_update_particle_position_and_velocity); - PatchCall(Memory::GetAddress(0x508AA), particle_system_update_particle_position_and_velocity); + //PatchCall(Memory::GetAddress(0x10459E), particle_system_update_particle_position_and_velocity); + //PatchCall(Memory::GetAddress(0x508AA), particle_system_update_particle_position_and_velocity); PatchCall(Memory::GetAddress(0x105380), particle_update_points_interpolate_hook); } diff --git a/xlive/Blam/Engine/effects/player_effects.cpp b/xlive/Blam/Engine/effects/player_effects.cpp index de584b515..e7833880e 100644 --- a/xlive/Blam/Engine/effects/player_effects.cpp +++ b/xlive/Blam/Engine/effects/player_effects.cpp @@ -19,15 +19,11 @@ s_player_effect_user_globals* player_effects_get_user_globals(int32 user_index) return &player_effect_globals_get()->user_effects[user_index]; } -/* -void __cdecl player_effect_apply_camera_effect_matrix(int32 user_index, real_matrix4x3* matrix) -{ - INVOKE(0xA432D, 0x963AA, player_effect_apply_camera_effect_matrix, user_index, matrix); - return; -}*/ - void player_effect_apply_camera_effect_matrix(int32 user_index, real_matrix4x3* matrix) { + // INVOKE(0xA432D, 0x963AA, player_effect_apply_camera_effect_matrix, user_index, matrix); + // return; + real_matrix4x3 calculated_matrix; if (user_index != NONE) { @@ -83,14 +79,14 @@ void player_effect_apply_camera_effect_matrix(int32 user_index, real_matrix4x3* } else { - real32 impulse_passed_time = user_effect->camera_impulse.duration - (real32)user_effect->camera_impulse_countdown; + real32 impulse_elapsed_time = user_effect->camera_impulse.duration - (real32)user_effect->camera_impulse_countdown; // do not stale the transition function - impulse_passed_time += halo_interpolator_get_interpolation_time(); + impulse_elapsed_time += halo_interpolator_get_interpolation_time(); transition_result = player_effect_transition_function_evaluate( (e_transition_function_type)user_effect->camera_impulse.fade_function, - user_effect->transition_function_scale_9C, - impulse_passed_time, + user_effect->camera_impulse_transition_scale, + impulse_elapsed_time, user_effect->camera_impulse.duration); } @@ -107,7 +103,7 @@ void player_effect_apply_camera_effect_matrix(int32 user_index, real_matrix4x3* } bool bit_2_result = user_effect->flags.test(_player_effect_apply_camera_shake); - if (user_effect->camera_shake_passed_time > 0 || bit_2_result) + if (user_effect->camera_shake_countdown > 0 || bit_2_result) { calculated_matrix = global_identity4x3; @@ -118,18 +114,18 @@ void player_effect_apply_camera_effect_matrix(int32 user_index, real_matrix4x3* } else { - real32 passed_time = user_effect->camera_shaking.duration - - game_ticks_to_seconds((real32)user_effect->camera_shake_passed_time - halo_interpolator_get_interpolation_time()); + real32 shake_elapsed_time = user_effect->camera_shaking.duration + - game_ticks_to_seconds((real32)user_effect->camera_shake_countdown - halo_interpolator_get_interpolation_time()); transition_function_result = player_effect_transition_function_evaluate( (e_transition_function_type)user_effect->camera_shaking.falloff_function, - user_effect->transition_function_scale_98, - passed_time, + user_effect->camera_shake_transition_scale, + shake_elapsed_time, user_effect->camera_shaking.duration ); } - real32 camera_shake_remaining_time = user_effect->camera_shaking.duration - game_ticks_to_seconds(user_effect->camera_shake_passed_time); + real32 camera_shake_remaining_time = user_effect->camera_shaking.duration - game_ticks_to_seconds(user_effect->camera_shake_countdown); real32 periodic_function_result = periodic_function_evaluate(user_effect->camera_shaking.wobble_function, camera_shake_remaining_time / user_effect->camera_shaking.wobble_function_period); real32 periodic_function_result_scaled = periodic_function_result * (transition_function_result * user_effect->camera_shaking.wobble_weight + transition_function_result * (1.0f - user_effect->camera_shaking.wobble_weight)); diff --git a/xlive/Blam/Engine/effects/player_effects.h b/xlive/Blam/Engine/effects/player_effects.h index 4f2b32411..7500a61d3 100644 --- a/xlive/Blam/Engine/effects/player_effects.h +++ b/xlive/Blam/Engine/effects/player_effects.h @@ -63,14 +63,14 @@ struct s_player_effect_user_globals int16 field_7C; int16 game_time; int16 camera_impulse_countdown; - int16 camera_shake_passed_time; + int16 camera_shake_countdown; int8 field_84[4]; c_flags flags; int8 field_89; int16 pad_8A; real_point3d origin; - real32 transition_function_scale_98; - real32 transition_function_scale_9C; + real32 camera_shake_transition_scale; + real32 camera_impulse_transition_scale; }; CHECK_STRUCT_SIZE(s_player_effect_user_globals, 160); diff --git a/xlive/Blam/Engine/game/game.cpp b/xlive/Blam/Engine/game/game.cpp index 540749526..937443c73 100644 --- a/xlive/Blam/Engine/game/game.cpp +++ b/xlive/Blam/Engine/game/game.cpp @@ -169,10 +169,10 @@ void __cdecl shell_initialize(void) g_target_interpolation_frame_data = &g_frame_data_storage->target_data; halo_interpolator_set_interpolation_enabled(true); - g_particle_frame_storage = (s_particle_frame_data_storage*)VirtualAlloc(0, sizeof(s_particle_frame_data_storage), MEM_COMMIT, PAGE_READWRITE); - g_previous_particle_interpolation_frame_data = &g_particle_frame_storage->previous_data; - g_target_particle_interpolation_frame_data = &g_particle_frame_storage->target_data; - halo_particle_interpolator_set_state(true); + //g_particle_frame_storage = (s_particle_frame_data_storage*)VirtualAlloc(0, sizeof(s_particle_frame_data_storage), MEM_COMMIT, PAGE_READWRITE); + //g_previous_particle_interpolation_frame_data = &g_particle_frame_storage->previous_data; + //g_target_particle_interpolation_frame_data = &g_particle_frame_storage->target_data; + halo_particle_interpolator_set_state(false); } return; } diff --git a/xlive/Blam/Engine/objects/damage.h b/xlive/Blam/Engine/objects/damage.h index 0b91fc31c..a0df97ffb 100644 --- a/xlive/Blam/Engine/objects/damage.h +++ b/xlive/Blam/Engine/objects/damage.h @@ -11,7 +11,6 @@ struct s_damage_owner }; CHECK_STRUCT_SIZE(s_damage_owner, 12); -#pragma pack(push, 1) struct s_damage_data { DWORD damage_tag_index; // 0x0 @@ -40,8 +39,7 @@ struct s_damage_data BYTE gap_80[4]; // 0x80 char field_84; // 0x84 }; -#pragma pack(pop) -CHECK_STRUCT_SIZE(s_damage_data, 0x85); +CHECK_STRUCT_SIZE(s_damage_data, 0x88); // max_count: LONG_MAX struct s_armor_modifier_definition diff --git a/xlive/Blam/Engine/physics/collisions.h b/xlive/Blam/Engine/physics/collisions.h index 80055da5b..0e709f8c7 100644 --- a/xlive/Blam/Engine/physics/collisions.h +++ b/xlive/Blam/Engine/physics/collisions.h @@ -43,10 +43,8 @@ struct collision_result int32 type; real32 t; real_point3d point; - s_location location_0; - s_location location_1; + s_location locations[2]; int16 global_material_index; - int16 pad; real_plane3d fog_plane; int32 field_38; int32 instanced_geometry_instance_index; @@ -57,8 +55,10 @@ struct collision_result int32 field_4C; int32 field_50; int32 flags; - int32 field_58; + int16 field_58; + int16 field_5A; }; +CHECK_STRUCT_SIZE(collision_result, 0x5C); uint16 collision_compute_object_cull_flags(datum object_index); diff --git a/xlive/Blam/Engine/render/render_cartographer_ingame_ui.cpp b/xlive/Blam/Engine/render/render_cartographer_ingame_ui.cpp index 2993d70e9..dd2af8c9b 100644 --- a/xlive/Blam/Engine/render/render_cartographer_ingame_ui.cpp +++ b/xlive/Blam/Engine/render/render_cartographer_ingame_ui.cpp @@ -107,7 +107,7 @@ void render_cartographer_achievements() } draw_string_reset(); - draw_string_set_font_and_options(k_cheevo_title_font, 0, 2, 0, &text_color, *Memory::GetAddress(0x412780), false); + draw_string_set_font_and_options(k_cheevo_title_font, 0, 2, 0, &text_color, global_real_argb_black, false); rasterizer_get_screen_bounds(&bounds); bounds.top += rectangle2d_height(&bounds) / 3 - (widget_total_height / 2); diff --git a/xlive/H2MOD/Modules/Input/PlayerControl.cpp b/xlive/H2MOD/Modules/Input/PlayerControl.cpp index 0195582ca..9db56b64d 100644 --- a/xlive/H2MOD/Modules/Input/PlayerControl.cpp +++ b/xlive/H2MOD/Modules/Input/PlayerControl.cpp @@ -4,28 +4,12 @@ #include "Util/Hooks/Hook.h" #include "H2MOD/Modules/EventHandler/EventHandler.hpp" - -typedef void __cdecl c_UpdatePlayerControl(float* yaw, float* pitch); -c_UpdatePlayerControl* p_UpdatePlayerControl; - -void __cdecl UpdatePlayerControl(float* yawChange, float* pitchChange) -{ - p_UpdatePlayerControl(yawChange, pitchChange); - //EventHandler::execute_callback(execute_after, &yawChange, &pitchChange); - //EventHandler::executePlayerControlCallback(yawChange, pitchChange); -} - typedef void __cdecl p_network_player_actions_to_player_actions(s_player_motion* nActions, player_action* pActions); p_network_player_actions_to_player_actions* network_player_actions_to_player_actions; - void PlayerControl::ApplyHooks() { - return; // TODO FIXME usercall convention functions, bad hooks - p_UpdatePlayerControl = Memory::GetAddress(0x90D62); - network_player_actions_to_player_actions = Memory::GetAddress(0x1DB569); - PatchCall(Memory::GetAddress(0x93596), UpdatePlayerControl); - PatchCall(Memory::GetAddress(0x9390D), UpdatePlayerControl); + return; } player_action PlayerControl::GetPlayerActions(int player_index) @@ -36,13 +20,8 @@ player_action PlayerControl::GetPlayerActions(int player_index) return newActions; } -s_player_motion* PlayerControl::GetPlayerMotion(int player_index) -{ - return Memory::GetAddress(0x514EE8 + player_index * sizeof(s_player_motion)); -} - void PlayerControl::DisableLocalCamera(bool state) { - auto player_controls_globals = *Memory::GetAddress(0x4ca37c); + auto player_controls_globals = *Memory::GetAddress(0x4CA37C); player_controls_globals->disable_camera = state; } diff --git a/xlive/H2MOD/Modules/Input/PlayerControl.h b/xlive/H2MOD/Modules/Input/PlayerControl.h index d732458a9..a711e05fa 100644 --- a/xlive/H2MOD/Modules/Input/PlayerControl.h +++ b/xlive/H2MOD/Modules/Input/PlayerControl.h @@ -8,6 +8,5 @@ namespace PlayerControl void Init(); void ApplyHooks(); player_action GetPlayerActions(int player_index); - s_player_motion* GetPlayerMotion(int player_index); void DisableLocalCamera(bool); }