Skip to content

Commit

Permalink
Fix some animations from scripts don't work properly in CS and SOC (#382
Browse files Browse the repository at this point in the history
, #392)

Also returned VERIFY instead of message to the log.
Logging is MUCH more annoying and drops FPS.
  • Loading branch information
Xottab-DUTY committed Dec 27, 2024
1 parent 61f71e8 commit f892cd9
Showing 1 changed file with 25 additions and 16 deletions.
41 changes: 25 additions & 16 deletions src/xrGame/script_game_object3.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -592,7 +592,7 @@ void CScriptGameObject::set_desired_direction(const Fvector* desired_direction)
if (fsimilar(desired_direction->magnitude(), 0.f))
GEnv.ScriptEngine->script_log(LuaMessageType::Error,
"CAI_Stalker : [%s] set_desired_direction - you passed zero direction!", stalker->cName().c_str());
else if (!ClearSkyMode && !ShadowOfChernobylMode)
else if (!ShadowOfChernobylMode)
{
if (!fsimilar(desired_direction->magnitude(), 1.f))
GEnv.ScriptEngine->script_log(LuaMessageType::Error,
Expand All @@ -601,7 +601,7 @@ void CScriptGameObject::set_desired_direction(const Fvector* desired_direction)
}

Fvector direction = *desired_direction;
if (!ClearSkyMode && !ShadowOfChernobylMode)
if (!ShadowOfChernobylMode)
direction.normalize_safe();
stalker->movement().set_desired_direction(&direction);
}
Expand Down Expand Up @@ -767,12 +767,15 @@ void CScriptGameObject::set_sight(SightManager::ESightType sight_type, Fvector*
}
else
{
if ((sight_type == SightManager::eSightTypeDirection) && vector3d && (_abs(vector3d->magnitude() - 1.f) > .01f))
const bool check_for_norm = sight_type == SightManager::eSightTypeDirection && vector3d &&
!ClearSkyMode && !ShadowOfChernobylMode;
if (check_for_norm)
{
#ifndef MASTER_GOLD
Msg("~ CSightManager : non-normalized direction passed [%f][%f][%f]", VPUSH(*vector3d));
#endif
vector3d->normalize();
if (_abs(vector3d->magnitude() - 1.f) > .01f)
{
VERIFY2(false, make_string("non-normalized direction passed [%f][%f][%f]", VPUSH(*vector3d)));
vector3d->normalize();
}
}

stalker->sight().setup(sight_type, vector3d);
Expand All @@ -798,12 +801,15 @@ void CScriptGameObject::set_sight(SightManager::ESightType sight_type, Fvector&
}
else
{
if ((sight_type == SightManager::eSightTypeDirection) && (_abs(vector3d.magnitude() - 1.f) > .01f))
const bool check_for_norm = sight_type == SightManager::eSightTypeDirection &&
!ClearSkyMode && !ShadowOfChernobylMode;
if (check_for_norm)
{
#ifndef MASTER_GOLD
Msg("~ CSightManager : non-normalized direction passed [%f][%f][%f]", VPUSH(vector3d));
#endif
if (_abs(vector3d.magnitude() - 1.f) > .01f)
{
VERIFY2(false, make_string("non-normalized direction passed [%f][%f][%f]", VPUSH(vector3d)));
vector3d.normalize();
}
}

stalker->sight().setup(sight_type, vector3d, torso_look);
Expand All @@ -819,12 +825,15 @@ void CScriptGameObject::set_sight(SightManager::ESightType sight_type, Fvector*
}
else
{
if ((sight_type == SightManager::eSightTypeDirection) && vector3d && (_abs(vector3d->magnitude() - 1.f) > .01f))
const bool check_for_norm = sight_type == SightManager::eSightTypeDirection && vector3d &&
!ClearSkyMode && !ShadowOfChernobylMode;
if (check_for_norm)
{
#ifndef MASTER_GOLD
Msg("~ CSightManager : non-normalized direction passed [%f][%f][%f]", VPUSH(*vector3d));
#endif
vector3d->normalize();
if (_abs(vector3d->magnitude() - 1.f) > .01f)
{
VERIFY2(false, make_string("non-normalized direction passed [%f][%f][%f]", VPUSH(*vector3d)));
vector3d->normalize();
}
}

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

0 comments on commit f892cd9

Please sign in to comment.