Skip to content

Commit

Permalink
Update visibility_render_objects.cpp
Browse files Browse the repository at this point in the history
  • Loading branch information
twist84 committed Sep 23, 2024
1 parent 04a45b1 commit 6027a35
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 20 deletions.
2 changes: 1 addition & 1 deletion game/source/game/players.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ struct s_emblem_info
emblem_secondary_color(),
emblem_background_color(),
pad(0),
__pad8({})
__pad8()
{
}

Expand Down
31 changes: 12 additions & 19 deletions game/source/visibility/visibility_render_objects.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,28 +5,21 @@

HOOK_DECLARE_CALL(0x00A44961, visibility_render_objects_compute_alpha_and_shadow_alpha);

void __cdecl visibility_render_objects_compute_alpha_and_shadow_alpha(long object_index, real shadow_fade_distance, byte* desired_alpha)
bool object_has_cinematic_lod(long object_index)
{
// get the object
if (void* object = object_try_and_get_and_verify_type(object_index, 0xFFFFFFFF))
{
// get the object flags
dword_flags* flags = &reinterpret_cast<dword_flags*>(object)[1];

// save the flags
dword_flags previous_flags = *flags;

// set cinematic lod bit
*flags |= FLAG(19);

INVOKE(0x00A195E0, visibility_render_objects_compute_alpha_and_shadow_alpha, object_index, shadow_fade_distance, desired_alpha);

// reset the flags
*flags = previous_flags;
object_datum* object = object_get(object_index);
return object && object->object.flags.test(_object_cinematic_lod_bit);
}

return;
}
void __cdecl visibility_render_objects_compute_alpha_and_shadow_alpha(long object_index, real shadow_fade_distance, byte* desired_alpha)
{
bool cinematic_lod = object_has_cinematic_lod(object_index);
if (!cinematic_lod)
object_cinematic_lod(object_index, true);

INVOKE(0x00A195E0, visibility_render_objects_compute_alpha_and_shadow_alpha, object_index, shadow_fade_distance, desired_alpha);

if (!cinematic_lod)
object_cinematic_lod(object_index, false);
}

0 comments on commit 6027a35

Please sign in to comment.