EnsureGroundDetailVisible effectively matching

This commit is contained in:
Dethrace Labs 2025-10-11 08:34:06 +13:00 committed by Dethrace Engineering Department
parent 61eac41ef5
commit 83d86cf2d4
2 changed files with 14 additions and 14 deletions

View File

@ -195,10 +195,8 @@ if(MSVC_42_FOR_RECCMP)
set_target_properties(dethrace PROPERTIES OUTPUT_NAME "CARM95")
target_link_options(dethrace PRIVATE /INCREMENTAL:NO /subsystem:windows /ENTRY:mainCRTStartup)
set_source_files_properties(common/skidmark.c PROPERTIES COMPILE_FLAGS "/FAs")
set_source_files_properties(common/oil.c PROPERTIES COMPILE_FLAGS "/FAs")
# set_source_files_properties(common/brucetrk.c PROPERTIES COMPILE_FLAGS "/G5")
set_source_files_properties(common/opponent.c PROPERTIES COMPILE_FLAGS "/FAs /G5")
reccmp_add_target(dethrace ID CARM95)
reccmp_configure()
else()

View File

@ -236,18 +236,20 @@ void EnsureGroundDetailVisible(br_vector3* pNew_pos, br_vector3* pGround_normal,
to_camera.v[1] = gCamera_to_world.m[3][1] - pOld_pos->v[1];
to_camera.v[2] = gCamera_to_world.m[3][2] - pOld_pos->v[2];
dist = BrVector3Length(&to_camera);
if (dist > BR_SCALAR_EPSILON) {
factor = BrVector3Dot(pGround_normal, &to_camera) / dist;
if (fabs(factor) <= 0.01f) {
s = 0.01f;
} else {
s = 0.01f / factor;
if (s > 0.1f) {
s = 0.1f;
}
}
Vector3Interpolate(pNew_pos, pOld_pos, (br_vector3*)gCamera_to_world.m[3], s);
if (dist <= BR_SCALAR_EPSILON) {
return;
}
s = BrVector3Dot(pGround_normal, &to_camera);
s /= dist;
if (BR_ABS(s) > 0.01f) {
factor = 0.01f / s;
if (factor > 0.1f) {
factor = 0.1f;
}
} else {
factor = 0.01f;
}
Vector3Interpolate(pNew_pos, pOld_pos, (br_vector3*)gCamera_to_world.m[3], factor);
}
// IDA: void __usercall MungeOilsHeightAboveGround(tOil_spill_info *pOil@<EAX>)