void CScriptGameObject::set_sight (const CMemoryInfo *memory_object, bool torso_look) { CAI_Stalker *stalker = smart_cast<CAI_Stalker*>(&object()); if (!stalker) ai().script_engine().script_log (ScriptStorage::eLuaMessageTypeError,"CSightManager : cannot access class member set_sight!"); else stalker->sight().setup (memory_object,torso_look); }
void CScriptGameObject::set_sight (SightManager::ESightType sight_type, const Fvector *vector3d) { CAI_Stalker *stalker = smart_cast<CAI_Stalker*>(&object()); if (!stalker) ai().script_engine().script_log (ScriptStorage::eLuaMessageTypeError,"CSightManager : cannot access class member set_sight!"); else stalker->sight().setup (sight_type,vector3d); }
void CScriptGameObject::set_sight (CScriptGameObject *object_to_look, bool torso_look, bool fire_object, bool no_pitch) { CAI_Stalker *stalker = smart_cast<CAI_Stalker*>(&object()); if (!stalker) ai().script_engine().script_log (ScriptStorage::eLuaMessageTypeError,"CSightManager : cannot access class member set_sight!"); else stalker->sight().setup (CSightAction(&object_to_look->object(),torso_look,fire_object,no_pitch)); }
CSightParams CScriptGameObject::sight_params () { CAI_Stalker *stalker = smart_cast<CAI_Stalker*>(&object()); if (!stalker) { ai().script_engine().script_log (ScriptStorage::eLuaMessageTypeError,"CAI_Stalker : cannot access class member sight_params!"); CSightParams result; result.m_object = 0; result.m_vector = Fvector().set(flt_max,flt_max,flt_max); result.m_sight_type = SightManager::eSightTypeDummy; return (result); } const CSightControlAction &action = stalker->sight().current_action(); CSightParams result; result.m_sight_type = action.sight_type(); result.m_object = action.object_to_look() ? action.object_to_look()->lua_game_object() : 0; result.m_vector = action.vector3d(); return (result); }
TEMPLATE_SPECIALIZATION void _detail::callback (CBoneInstance *B) { CAI_Stalker* A = static_cast<CAI_Stalker*>(B->Callback_Param); VERIFY (_valid(B->mTransform)); Fvector c = B->mTransform.c; Fmatrix spin; float yaw_factor = 0, pitch_factor = 0; if (A->sight().use_torso_look()) { yaw_factor = yaw_factor_fire/100.f; pitch_factor = pitch_factor_fire/100.f; } else { yaw_factor = yaw_factor_non_fire/100.f; pitch_factor = pitch_factor_non_fire/100.f; } float effector_yaw = 0.f, effector_pitch = 0.f; if (A->weapon_shot_effector().IsActive()) { Fvector temp; A->weapon_shot_effector().GetDeltaAngle(temp); effector_yaw = temp.y; VERIFY (_valid(effector_yaw)); effector_pitch = temp.x; VERIFY (_valid(effector_pitch)); } VERIFY (_valid(A->movement().head_orientation().current.yaw)); VERIFY (_valid(A->movement().body_orientation().current.yaw)); VERIFY (_valid(A->NET_Last.o_torso.pitch)); float yaw = angle_normalize_signed(-yaw_factor * angle_normalize_signed(A->movement().head_orientation().current.yaw + effector_yaw - (A->movement().body_orientation().current.yaw))); float pitch = angle_normalize_signed(-pitch_factor * angle_normalize_signed(A->NET_Last.o_torso.pitch + effector_pitch)); VERIFY (_valid(yaw)); VERIFY (_valid(pitch)); spin.setXYZ (pitch, yaw, 0); VERIFY (_valid(spin)); B->mTransform.mulA_43 (spin); B->mTransform.c = c; }