Skip to content

Commit

Permalink
Renamed some real math types
Browse files Browse the repository at this point in the history
Updated `render_camera`
Added `s_transparent_types`
Added `s_transparency_marker`
Added `c_sorter`
  • Loading branch information
twist84 committed Jan 10, 2025
1 parent a2b41d3 commit e413ec1
Show file tree
Hide file tree
Showing 80 changed files with 299 additions and 260 deletions.
6 changes: 3 additions & 3 deletions game/source/ai/ai_debug.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ void __cdecl ai_debug_render()
if (!actor_datum_available_to_current_thread() || !ai_globals->ai_initialized_for_map)
return;

short_rectangle2d bounds{};
rectangle2d bounds{};
interface_get_current_display_settings(NULL, NULL, NULL, &bounds);
global_ai_debug_string_position = bounds.y1 - 20;
//dword_143C86DD8 = (dword_143C86DD8 + 1) % 1000;
Expand Down Expand Up @@ -381,7 +381,7 @@ void ai_debug_string(char const* string, short tab_stop_count, short const* tab_
c_rasterizer_draw_string draw_string;
c_font_cache_mt_safe font_cache;

short_rectangle2d bounds{};
rectangle2d bounds{};
bounds.x0 = 0;
bounds.y0 = global_ai_debug_string_position;
bounds.x1 = SHRT_MAX;
Expand All @@ -397,7 +397,7 @@ void ai_debug_string(char const* string, short tab_stop_count, short const* tab_
draw_string.set_bounds(&bounds);
draw_string.draw(&font_cache, string);

int16_point2d cursor{};
point2d cursor{};
draw_string.get_cursor(&cursor);
global_ai_debug_string_position -= cursor.y - bounds.y0;
}
Expand Down
2 changes: 1 addition & 1 deletion game/source/bink/bink_playback.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
//.text:006161B0 ; void __cdecl bink_close(s_bink_runtime*)
//.text:00616220 ;
//.text:00616240 ; void __cdecl bink_destroy_rasterizer()
//.text:00616250 ; void __cdecl bink_display_frame(short_rectangle2d const*)
//.text:00616250 ; void __cdecl bink_display_frame(rectangle2d const*)
//.text:00616420 ; void __cdecl bink_draw_frame()
//.text:006165A0 ;
//.text:006166A0 ;
Expand Down
2 changes: 1 addition & 1 deletion game/source/bitmaps/bitmap_group_tag_definition.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ struct bitmap_data
c_flags<e_bitmap_flags, word, k_tag_bitmap_flags_count> flags;

// the 'center' of the bitmap - i.e. for particles
int16_point2d registration_point;
point2d registration_point;

// DO NOT CHANGE
char mipmap_count_excluding_highest;
Expand Down
2 changes: 1 addition & 1 deletion game/source/camera/camera_scripting.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ void __cdecl scripted_camera_initialize()
//.text:0072D8F0 ; void __cdecl scripted_camera_set_animation_with_speed(long, long, real)
//.text:0072D920 ; void __cdecl scripted_camera_set_cinematic()
//.text:0072DA10 ; void __cdecl scripted_camera_set_cinematic_scene(long, long, short)
//.text:0072DAF0 ; void __cdecl scripted_camera_set_cinematic_shot_user_input_constraints(long, short_rectangle2d const&, real)
//.text:0072DAF0 ; void __cdecl scripted_camera_set_cinematic_shot_user_input_constraints(long, rectangle2d const&, real)
//.text:0072DC10 ; void __cdecl scripted_camera_set_field_of_view(real, short)
//.text:0072DD30 ; void __cdecl scripted_camera_set_first_person(long)
//.text:0072DD70 ; void __cdecl scripted_camera_set_internal(e_scenario_camera_type, real_point3d const*, real_euler_angles3d const*, real, short, long)
Expand Down
2 changes: 1 addition & 1 deletion game/source/camera/director.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ void __cdecl director_render()
control_mode
);

short_rectangle2d bounds{};
rectangle2d bounds{};
interface_get_current_display_settings(nullptr, nullptr, nullptr, &bounds);
bounds.y0 += 80;

Expand Down
2 changes: 1 addition & 1 deletion game/source/camera/first_person_camera.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ void __thiscall c_first_person_camera::_update(long user_index, real dt, s_obser
//c_first_person_view::m_fov_scale = 1.700000047683716f - camera_fov * 0.01f;

result->field_of_view = unit_get_field_of_view(m_target_object_index, camera_fov * DEG, unit_get_zoom_level(m_target_object_index));
result->field_of_view *= sub_ABEA20(); // cortana effect
result->field_of_view *= cortana_effect_get_fov_scale(); // cortana effect
result->field_of_view *= sub_A8E700(); // chud
result->field_of_view = fminf(fmaxf(result->field_of_view, k_horizontal_field_of_view_min), k_horizontal_field_of_view_max);

Expand Down
2 changes: 1 addition & 1 deletion game/source/cseries/async_xoverlapped.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ void __cdecl overlapped_render()
{
c_simple_font_draw_string draw_string;

short_rectangle2d bounds{};
rectangle2d bounds{};
interface_get_current_display_settings(NULL, NULL, NULL, &bounds);
bounds.x0 += (bounds.x1 - bounds.x0) >> 1;
draw_string.set_bounds(&bounds);
Expand Down
4 changes: 2 additions & 2 deletions game/source/cseries/cseries_events.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -365,10 +365,10 @@ void __cdecl events_debug_render()
if (!g_events_debug_render_enable)
return;

short_rectangle2d display_title_safe_pixel_bounds{};
rectangle2d display_title_safe_pixel_bounds{};
interface_get_current_display_settings(nullptr, nullptr, nullptr, &display_title_safe_pixel_bounds);

short_rectangle2d bounds{};
rectangle2d bounds{};
bounds.x0 = display_title_safe_pixel_bounds.x0;
bounds.y0 = display_title_safe_pixel_bounds.y0 + 70;
bounds.x1 = SHRT_MAX;
Expand Down
8 changes: 4 additions & 4 deletions game/source/cutscene/cinematics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ void __cdecl cinematic_game_pause_handler(bool 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 ; void __cdecl cinematic_get_default_chapter_title_bounds(short_rectangle2d*)
//.text:0067CFA0 ; void __cdecl cinematic_get_default_chapter_title_bounds(rectangle2d*)
//.text:0067CFE0 ; short __cdecl cinematic_get_descriptor()
//.text:0067D0A0 ; long __cdecl cinematic_get_early_exit()
//.text:0067D0C0 ; double __cdecl cinematic_get_fade_amount()
Expand Down Expand Up @@ -176,7 +176,7 @@ void __cdecl cinematics_game_tick()
//.text:0067F1A0 ;
//.text:0067F1D0 ;

void __cdecl draw_quad(short_rectangle2d* rect, dword color)
void __cdecl draw_quad(rectangle2d* rect, dword color)
{
return INVOKE(0x0067F200, draw_quad, rect, color);
}
Expand All @@ -186,8 +186,8 @@ void __cdecl draw_quad(short_rectangle2d* rect, dword color)
//.text:0067F2A0 ;
//.text:0067F2D0 ;
//.text:0067F300 ;
//.text:0067F310 ; void __cdecl get_cinematic_bounds(short_rectangle2d*, short_rectangle2d*, short_rectangle2d*)
//.text:0067F520 ; void __cdecl get_cinematic_bounds_screen_space(short_rectangle2d*, short_rectangle2d*, short_rectangle2d *)
//.text:0067F310 ; void __cdecl get_cinematic_bounds(rectangle2d*, rectangle2d*, rectangle2d*)
//.text:0067F520 ; void __cdecl get_cinematic_bounds_screen_space(rectangle2d*, rectangle2d*, rectangle2d *)
//.text:0067F570 ; s_cinematic_light_globals* __cdecl get_cinematic_light_globals()
//.text:0067F590 ;
//.text:0067F5A0 ; s_cinematic_scene* __cdecl global_cinematic_scene_try_and_get()
Expand Down
2 changes: 1 addition & 1 deletion game/source/cutscene/cinematics.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ extern void __cdecl cinematic_render(bool a1, bool a2);
extern void __cdecl cinematic_start_user_skip_fade_out();
extern void __cdecl cinematic_update();
extern void __cdecl cinematics_game_tick();
extern void __cdecl draw_quad(short_rectangle2d* rect, dword color);
extern void __cdecl draw_quad(rectangle2d* rect, dword color);

extern void cinematic_debug_camera_control_update();

4 changes: 2 additions & 2 deletions game/source/data_mining/data_mine_usability.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ void data_mine_render_mission_segment()
{
c_rasterizer_draw_string draw_string{};
c_font_cache_mt_safe font_cache{};
short_rectangle2d display_title_safe_pixel_bounds{};
short_rectangle2d bounds{};
rectangle2d display_title_safe_pixel_bounds{};
rectangle2d bounds{};

interface_get_current_display_settings(NULL, NULL, NULL, &display_title_safe_pixel_bounds);

Expand Down
2 changes: 1 addition & 1 deletion game/source/editor/editor_render_stubs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ void editor_render_scene(long a1)
// #TODO: implement
}

void editor_render_ui(e_window_index window_index, short_rectangle2d const* bounds)
void editor_render_ui(e_window_index window_index, rectangle2d const* bounds)
{
// #TODO: implement
}
Expand Down
4 changes: 2 additions & 2 deletions game/source/editor/editor_render_stubs.hpp
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#pragma once

enum e_window_index;
union short_rectangle2d;
union rectangle2d;

extern void editor_render_debug();
extern void editor_render_scene(long a1);
extern void editor_render_ui(e_window_index window_index, short_rectangle2d const* bounds);
extern void editor_render_ui(e_window_index window_index, rectangle2d const* bounds);

4 changes: 2 additions & 2 deletions game/source/game/game_engine_display.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -129,14 +129,14 @@ void __cdecl game_engine_render_fade_to_black(long user_index)
if (user_fade_to_black_amount <= 0.0f)
return;

short_rectangle2d display_pixel_bounds{};
rectangle2d display_pixel_bounds{};
interface_get_current_display_settings(nullptr, nullptr, &display_pixel_bounds, nullptr);

real_argb_color fade_color{};
fade_color.rgb = *global_real_rgb_black;
fade_color.alpha = user_fade_to_black_amount;

short_rectangle2d quad_bounds{};
rectangle2d quad_bounds{};
set_rectangle2d(&quad_bounds, 0, 0, display_pixel_bounds.x1 - display_pixel_bounds.x0, display_pixel_bounds.y1 - display_pixel_bounds.y0);
draw_quad(&quad_bounds, real_argb_color_to_pixel32(&fade_color));
}
Expand Down
4 changes: 2 additions & 2 deletions game/source/game/players.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ void players_debug_render()
{
c_rasterizer_draw_string draw_string;

short_rectangle2d bounds{};
rectangle2d bounds{};
interface_get_current_display_settings(NULL, NULL, NULL, &bounds);
bounds.y0 = bounds.y1 - 40;

Expand All @@ -211,7 +211,7 @@ void players_debug_render()
{
//c_rasterizer_draw_string draw_string;
//
//short_rectangle2d bounds{};
//rectangle2d bounds{};
//interface_get_current_display_settings(NULL, NULL, NULL, &bounds);
//bounds.y0 = bounds.y1 - 20;
//
Expand Down
2 changes: 1 addition & 1 deletion game/source/input/input_abstraction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ short __cdecl input_abstraction_get_abstract_stick_pitch(long controller_index)
{
ASSERT(controller_index >= 0 && controller_index < k_number_of_controllers);

int16_point2d* abstract_sticks = input_abstraction_globals.input_states[controller_index].abstract_sticks;
point2d* abstract_sticks = input_abstraction_globals.input_states[controller_index].abstract_sticks;
short joystick_preset = input_abstraction_globals.preferences[controller_index].keyboard_preferences.joystick_preset;

return abstract_sticks[(joystick_preset == 1 || joystick_preset == 3) ? 0 : 1].y;
Expand Down
2 changes: 1 addition & 1 deletion game/source/input/input_abstraction.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ struct s_game_input_state


c_abstract_button abstract_buttons[k_button_action_count_keyboard];
int16_point2d abstract_sticks[2];
point2d abstract_sticks[2];

real forward_movement;
real strafe;
Expand Down
8 changes: 4 additions & 4 deletions game/source/input/input_windows.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -730,10 +730,10 @@ void input_get_raw_data_string(char* buffer, short size)
// {
// csnzappendf(buffer, size, "gamepad %d|t(%d, %d)|t(%d, %d)|n",
// gamepad_index,
// g_debug_gamepad_data[gamepad_index].thumb_left.x,
// g_debug_gamepad_data[gamepad_index].thumb_left.y,
// g_debug_gamepad_data[gamepad_index].thumb_right.x,
// g_debug_gamepad_data[gamepad_index].thumb_right.y);
// g_debug_gamepad_data[gamepad_index].sticks[0].x,
// g_debug_gamepad_data[gamepad_index].sticks[0].y,
// g_debug_gamepad_data[gamepad_index].sticks[1].x,
// g_debug_gamepad_data[gamepad_index].sticks[1].y);
// }
// }
//}
Expand Down
4 changes: 2 additions & 2 deletions game/source/input/input_windows.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -405,8 +405,8 @@ struct gamepad_state
c_static_array<byte, k_controller_button_count> button_frames_down;
c_static_array<word, k_controller_button_count> button_msec_down;

int16_point2d thumb_left;
int16_point2d thumb_right;
point2d thumb_left;
point2d thumb_right;
};
static_assert(sizeof(gamepad_state) == 0x3C);

Expand Down
10 changes: 5 additions & 5 deletions game/source/input/input_xinput.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -193,10 +193,10 @@ bool __cdecl input_xinput_update_gamepad(dword gamepad_index, dword duration_ms,
out_debug_gamepad_data = &g_debug_gamepad_data[gamepad_index];

ASSERT(out_debug_gamepad_data);
out_debug_gamepad_data->thumb_left.x = state.Gamepad.sThumbLX;
out_debug_gamepad_data->thumb_left.y = state.Gamepad.sThumbLY;
out_debug_gamepad_data->thumb_right.x = state.Gamepad.sThumbRX;
out_debug_gamepad_data->thumb_right.y = state.Gamepad.sThumbRY;
out_debug_gamepad_data->sticks[0].x = state.Gamepad.sThumbLX;
out_debug_gamepad_data->sticks[0].y = state.Gamepad.sThumbLY;
out_debug_gamepad_data->sticks[1].x = state.Gamepad.sThumbRX;
out_debug_gamepad_data->sticks[1].y = state.Gamepad.sThumbRY;

input_xinput_update_thumbstick(true, &gamepad_state->thumb_left, state.Gamepad.sThumbLX, state.Gamepad.sThumbLY);
input_xinput_update_thumbstick(false, &gamepad_state->thumb_right, state.Gamepad.sThumbRX, state.Gamepad.sThumbRY);
Expand Down Expand Up @@ -224,7 +224,7 @@ void __cdecl input_xinput_update_rumble_state(dword user_index, rumble_state con
}
}

void __cdecl input_xinput_update_thumbstick(bool left_thumb, int16_point2d* thumbstick, short thumb_x, short thumb_y)
void __cdecl input_xinput_update_thumbstick(bool left_thumb, point2d* thumbstick, short thumb_x, short thumb_y)
{
//INVOKE(0x0065F280, input_xinput_update_thumbstick, left_thumb, thumbstick, thumb_x, thumb_y);

Expand Down
5 changes: 2 additions & 3 deletions game/source/input/input_xinput.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@

struct debug_gamepad_data
{
int16_point2d thumb_left;
int16_point2d thumb_right;
point2d sticks[2];
};
static_assert(sizeof(debug_gamepad_data) == 0x8);

Expand All @@ -25,7 +24,7 @@ extern bool __cdecl input_xinput_initialize();
extern dword __cdecl input_xinput_set_state(dword user_index, _XINPUT_VIBRATION* state);
extern bool __cdecl input_xinput_update_gamepad(dword gamepad_index, dword duration_ms, gamepad_state* state, debug_gamepad_data* out_debug_gamepad_data);
extern void __cdecl input_xinput_update_rumble_state(dword user_index, rumble_state const* state, bool suppressed);
extern void __cdecl input_xinput_update_thumbstick(bool left_thumb, int16_point2d* thumbstick, short thumb_x, short thumb_y);
extern void __cdecl input_xinput_update_thumbstick(bool left_thumb, point2d* thumbstick, short thumb_x, short thumb_y);
extern void __cdecl input_xinput_update_button(byte* trigger_down_frames, word* trigger_down_msec, bool trigger_down, long duration_ms);
extern void __cdecl input_xinput_update_trigger(byte* trigger_down_msec, bool trigger_down, byte duration_ms);

2 changes: 1 addition & 1 deletion game/source/interface/c_gui_screen_widget.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ struct s_window_manager_screen_render_data
long render_data_buffer_count;
s_depth_sorted_render_widget render_list[k_maximum_rendered_child_widgets_per_screen];
long current_count;
short_rectangle2d built_for_viewport_bounds;
rectangle2d built_for_viewport_bounds;
};
static_assert(sizeof(s_window_manager_screen_render_data) == 0x1818);

Expand Down
2 changes: 1 addition & 1 deletion game/source/interface/c_gui_widget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ void __thiscall c_gui_widget::get_unprojected_bounds(gui_real_rectangle2d* unpro

// this is more or less what Halo 3 MCC is doing

short_rectangle2d display_pixel_bounds;
rectangle2d display_pixel_bounds;
interface_get_current_display_settings(nullptr, nullptr, &display_pixel_bounds, nullptr);

real width_scale_factor = (display_pixel_bounds.x1 - display_pixel_bounds.x0) / 1152.0f;
Expand Down
2 changes: 1 addition & 1 deletion game/source/interface/c_gui_widget.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ struct s_core_widget_definition

// bounds 720p & bounds 16x9 (1152x640)
// bounds 480i & bounds 4x3 (640x480)
short_rectangle2d ui_bounds[2];
rectangle2d ui_bounds[2];

c_typed_tag_reference<GUI_WIDGET_ANIMATION_COLLECTION_DEFINITION_TAG, INVALID_TAG> animation_collection;
};
Expand Down
2 changes: 1 addition & 1 deletion game/source/interface/chud/chud_draw.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ struct s_chud_draw_globals
real_rectangle2d rendered_window_bounds;
real_rectangle2d rendered_window_safe_bounds;

short_rectangle2d adjusted_camera_window_title_safe_pixel_bounds;
rectangle2d adjusted_camera_window_title_safe_pixel_bounds;

real virtual_width;
real virtual_height;
Expand Down
5 changes: 2 additions & 3 deletions game/source/interface/chud/cortana_effect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,8 @@ real __cdecl sub_A8E700()
return INVOKE(0x00A8E700, sub_A8E700);
}

// get cortana effect fov?
real __cdecl sub_ABEA20()
real __cdecl cortana_effect_get_fov_scale()
{
return INVOKE(0x00ABEA20, sub_ABEA20);
return INVOKE(0x00ABEA20, cortana_effect_get_fov_scale);
}

2 changes: 1 addition & 1 deletion game/source/interface/chud/cortana_effect.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@ struct s_cortana_globals
static_assert(sizeof(s_cortana_globals) == 0x10);

extern real __cdecl sub_A8E700();
extern real __cdecl sub_ABEA20();
extern real __cdecl cortana_effect_get_fov_scale();

Loading

0 comments on commit e413ec1

Please sign in to comment.