Skip to content

Commit

Permalink
Always normalize sight directions passed from scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
Xottab-DUTY committed Mar 2, 2024
1 parent 86355af commit 2bc8808
Showing 1 changed file with 5 additions and 12 deletions.
17 changes: 5 additions & 12 deletions src/xrGame/script_game_object3.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -769,13 +769,10 @@ void CScriptGameObject::set_sight(SightManager::ESightType sight_type, Fvector*
{
if ((sight_type == SightManager::eSightTypeDirection) && vector3d && (_abs(vector3d->magnitude() - 1.f) > .01f))
{
if (!ClearSkyMode && !ShadowOfChernobylMode)
{
#ifndef MASTER_GOLD
Msg("~ non-normalized direction passed [%f][%f][%f]", VPUSH(*vector3d));
Msg("~ CSightManager : non-normalized direction passed [%f][%f][%f]", VPUSH(*vector3d));
#endif
vector3d->normalize();
}
vector3d->normalize();
}

stalker->sight().setup(sight_type, vector3d);
Expand Down Expand Up @@ -803,13 +800,10 @@ void CScriptGameObject::set_sight(SightManager::ESightType sight_type, Fvector&
{
if ((sight_type == SightManager::eSightTypeDirection) && (_abs(vector3d.magnitude() - 1.f) > .01f))
{
if (!ClearSkyMode && !ShadowOfChernobylMode)
{
#ifndef MASTER_GOLD
Msg("~ non-normalized direction passed [%f][%f][%f]", VPUSH(vector3d));
Msg("~ CSightManager : non-normalized direction passed [%f][%f][%f]", VPUSH(vector3d));
#endif
vector3d.normalize();
}
}

stalker->sight().setup(sight_type, vector3d, torso_look);
Expand All @@ -828,10 +822,9 @@ void CScriptGameObject::set_sight(SightManager::ESightType sight_type, Fvector*
if ((sight_type == SightManager::eSightTypeDirection) && vector3d && (_abs(vector3d->magnitude() - 1.f) > .01f))
{
#ifndef MASTER_GOLD
Msg("~ non-normalized direction passed [%f][%f][%f]", VPUSH(*vector3d));
Msg("~ CSightManager : non-normalized direction passed [%f][%f][%f]", VPUSH(*vector3d));
#endif
if (!ClearSkyMode && !ShadowOfChernobylMode)
vector3d->normalize();
vector3d->normalize();
}

stalker->sight().setup(sight_type, vector3d);
Expand Down

0 comments on commit 2bc8808

Please sign in to comment.