From 3a1dda75ede7e95b6a8ec61a225602bf783c5beb Mon Sep 17 00:00:00 2001 From: ForserX Date: Fri, 6 Dec 2024 22:38:42 +0300 Subject: [PATCH] Add step wallmark option for `engine_external` AIW compatibility --- gamedata/configs/engine_external.ltx | 22 ++++++--- src/Layers/xrRender/WallmarksEngine.cpp | 17 +++++-- src/Layers/xrRender/WallmarksEngine.h | 4 +- src/Layers/xrRenderPC_R1/FStaticRender.cpp | 19 ++++---- src/Layers/xrRenderPC_R1/FStaticRender.h | 6 +-- src/Layers/xrRenderPC_R2/r2.cpp | 15 ++++--- src/Layers/xrRenderPC_R2/r2.h | 4 +- src/Layers/xrRenderPC_R4/r4.cpp | 9 ++-- src/Layers/xrRenderPC_R4/r4.h | 4 +- src/xrEngine/EngineExternal.cpp | 38 ++++++++++++++-- src/xrEngine/EngineExternal.h | 4 ++ src/xrEngine/Render.h | 2 +- src/xrGame/Actor.cpp | 52 +++++++++++++++++++++- src/xrGame/Actor.h | 1 + src/xrGame/GameObject.h | 2 +- src/xrGame/step_manager.cpp | 2 + src/xrGame/wallmark_manager.cpp | 40 +++++------------ src/xrGame/wallmark_manager.h | 3 +- 18 files changed, 170 insertions(+), 74 deletions(-) diff --git a/gamedata/configs/engine_external.ltx b/gamedata/configs/engine_external.ltx index eb43a6822..1c5d0ccf1 100644 --- a/gamedata/configs/engine_external.ltx +++ b/gamedata/configs/engine_external.ltx @@ -1,6 +1,8 @@ [general] title = st_ixray_title ; Mod name +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; Engine features [ui] HQIcons = false DisableCharacterInfo = false @@ -17,16 +19,26 @@ EnableNPCLookAtActor = false EnableBlockSprintInReload = true EnableAutoreload = false EnableMonstersInventory = true -EnableWeaponInertion = false ;Shoker Mod Style -EnableWeaponCollision = false ;Shoker Mod Style +EnableWeaponInertion = false ; Shoker Mod Style +EnableWeaponCollision = false ; Shoker Mod Style EnableArtefactDegradation = false DisableSprintWhileOverweight = false - -[player_hud] -;PlayerHudOmfAdditional = dynamics\weapons\hud_hands_animation\*.omf +EnableActorStepWallmarks = false ; AIW Style [render] DisableLoadScreenTips = false [environment] ReadSunConfig = false + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; Extended sections + +[player_hud] +;PlayerHudOmfAdditional = dynamics\weapons\hud_hands_animation\*.omf ; Place your omf file pathes + +; Need [gameplay]:EnableActorStepWallmarks +[step_wallmark] +materials = earth, test1 ; Material names +left_mark = l_foot ; left foot wallmark section +right_mark = r_foot ; right foot wallmark section \ No newline at end of file diff --git a/src/Layers/xrRender/WallmarksEngine.cpp b/src/Layers/xrRender/WallmarksEngine.cpp index 42f3d2f26..bdea1aca0 100644 --- a/src/Layers/xrRender/WallmarksEngine.cpp +++ b/src/Layers/xrRender/WallmarksEngine.cpp @@ -183,7 +183,7 @@ void CWallmarksEngine::BuildMatrix (Fmatrix &mView, float invsz, const Fvector& mView.mulA_43 (mScale); } -void CWallmarksEngine::AddWallmark_internal (CDB::TRI* pTri, const Fvector* pVerts, const Fvector &contact_point, ref_shader hShader, float sz) +void CWallmarksEngine::AddWallmark_internal (CDB::TRI* pTri, const Fvector* pVerts, const Fvector &contact_point, ref_shader hShader, float sz, bool UseCameraDirection) { // query for polygons in bounding box // calculate adjacency @@ -219,7 +219,16 @@ void CWallmarksEngine::AddWallmark_internal (CDB::TRI* pTri, const Fvector* pVer // build 3D ortho-frustum Fmatrix mView,mRot; BuildMatrix (mView,1/sz,contact_point); - mRot.rotateZ (::Random.randF(deg2rad(-20.f),deg2rad(20.f))); + + if (UseCameraDirection) + { + mRot.rotateZ(::Random.randF(-0.175f, 0.175f) - Device.vCameraDirection.getH()); + } + else + { + mRot.rotateZ(::Random.randF(deg2rad(-20.f), deg2rad(20.f))); + } + mView.mulA_43 (mRot); sml_clipper.CreateFromMatrix (mView,FRUSTUM_P_LRTB); @@ -273,7 +282,7 @@ void CWallmarksEngine::AddWallmark_internal (CDB::TRI* pTri, const Fvector* pVer //} } -void CWallmarksEngine::AddStaticWallmark (CDB::TRI* pTri, const Fvector* pVerts, const Fvector &contact_point, ref_shader hShader, float sz) +void CWallmarksEngine::AddStaticWallmark (CDB::TRI* pTri, const Fvector* pVerts, const Fvector &contact_point, ref_shader hShader, float sz, bool UseCameraDirection) { // optimization cheat: don't allow wallmarks more than 100 m from viewer/actor if (contact_point.distance_to_sqr(Device.vCameraPosition) > _sqr(100.f)) @@ -281,7 +290,7 @@ void CWallmarksEngine::AddStaticWallmark (CDB::TRI* pTri, const Fvector* pVerts, // Physics may add wallmarks in parallel with rendering lock.Enter (); - AddWallmark_internal (pTri,pVerts,contact_point,hShader,sz); + AddWallmark_internal (pTri,pVerts,contact_point,hShader,sz, UseCameraDirection); lock.Leave (); } diff --git a/src/Layers/xrRender/WallmarksEngine.h b/src/Layers/xrRender/WallmarksEngine.h index 0e0e99bb7..24f354c2d 100644 --- a/src/Layers/xrRender/WallmarksEngine.h +++ b/src/Layers/xrRender/WallmarksEngine.h @@ -50,7 +50,7 @@ class CWallmarksEngine private: void BuildMatrix (Fmatrix &dest, float invsz, const Fvector& from); void RecurseTri (u32 T, Fmatrix &mView, static_wallmark &W); - void AddWallmark_internal (CDB::TRI* pTri, const Fvector* pVerts, const Fvector &contact_point, ref_shader hTexture, float sz); + void AddWallmark_internal (CDB::TRI* pTri, const Fvector* pVerts, const Fvector &contact_point, ref_shader hTexture, float sz, bool UseCameraDirection); static_wallmark* static_wm_allocate (); void static_wm_render (static_wallmark* W, FVF::LIT* &V); @@ -61,7 +61,7 @@ class CWallmarksEngine CWallmarksEngine (); ~CWallmarksEngine (); // edit wallmarks - void AddStaticWallmark (CDB::TRI* pTri, const Fvector* pVerts, const Fvector &contact_point, ref_shader hTexture, float sz); + void AddStaticWallmark (CDB::TRI* pTri, const Fvector* pVerts, const Fvector &contact_point, ref_shader hTexture, float sz, bool UseCameraDirection = false); void AddSkeletonWallmark (intrusive_ptr wm); void AddSkeletonWallmark (const Fmatrix* xf, CKinematics* obj, ref_shader& sh, const Fvector& start, const Fvector& dir, float size); diff --git a/src/Layers/xrRenderPC_R1/FStaticRender.cpp b/src/Layers/xrRenderPC_R1/FStaticRender.cpp index dacda2b5c..56001365d 100644 --- a/src/Layers/xrRenderPC_R1/FStaticRender.cpp +++ b/src/Layers/xrRenderPC_R1/FStaticRender.cpp @@ -237,24 +237,25 @@ void CRender::add_Visual (IRenderVisual* V, bool ignore_opt) add_leafs_Dynamic ((dxRender_Visual*)V, ignore_opt); } void CRender::add_Geometry (IRenderVisual* V ){ add_Static((dxRender_Visual*)V,View->getMask()); } -void CRender::add_StaticWallmark (ref_shader& S, const Fvector& P, float s, CDB::TRI* T, Fvector* verts) + +void CRender::add_StaticWallmark(ref_shader& S, const Fvector& P, float s, CDB::TRI* T, Fvector* verts, bool UseCameraDirection) { if (T->suppress_wm) return; - VERIFY2 (_valid(P) && _valid(s) && T && verts && (s>EPS_L), "Invalid static wallmark params"); - Wallmarks->AddStaticWallmark (T,verts,P,&*S,s); + VERIFY2(_valid(P) && _valid(s) && T && verts && (s > EPS_L), "Invalid static wallmark params"); + Wallmarks->AddStaticWallmark(T, verts, P, &*S, s, UseCameraDirection); } -void CRender::add_StaticWallmark (IWallMarkArray *pArray, const Fvector& P, float s, CDB::TRI* T, Fvector* V) +void CRender::add_StaticWallmark(IWallMarkArray* pArray, const Fvector& P, float s, CDB::TRI* T, Fvector* V, bool UseCameraDirection) { - dxWallMarkArray *pWMA = (dxWallMarkArray *)pArray; - ref_shader *pShader = pWMA->dxGenerateWallmark(); - if (pShader) add_StaticWallmark (*pShader, P, s, T, V); + dxWallMarkArray* pWMA = (dxWallMarkArray*)pArray; + ref_shader* pShader = pWMA->dxGenerateWallmark(); + if (pShader) add_StaticWallmark(*pShader, P, s, T, V, UseCameraDirection); } -void CRender::add_StaticWallmark (const wm_shader& S, const Fvector& P, float s, CDB::TRI* T, Fvector* V) +void CRender::add_StaticWallmark(const wm_shader& S, const Fvector& P, float s, CDB::TRI* T, Fvector* V) { dxUIShader* pShader = (dxUIShader*)&*S; - add_StaticWallmark (pShader->hShader, P, s, T, V); + add_StaticWallmark(pShader->hShader, P, s, T, V); } void CRender::clear_static_wallmarks () diff --git a/src/Layers/xrRenderPC_R1/FStaticRender.h b/src/Layers/xrRenderPC_R1/FStaticRender.h index 09b39dc57..ff3fb7eaf 100644 --- a/src/Layers/xrRenderPC_R1/FStaticRender.h +++ b/src/Layers/xrRenderPC_R1/FStaticRender.h @@ -162,9 +162,9 @@ class CRender : public R_dsgraph_structure virtual void add_Geometry (IRenderVisual* V ); // add visual(s) (all culling performed) // wallmarks - virtual void add_StaticWallmark (ref_shader& S, const Fvector& P, float s, CDB::TRI* T, Fvector* V); - virtual void add_StaticWallmark (IWallMarkArray *pArray, const Fvector& P, float s, CDB::TRI* T, Fvector* V); - virtual void add_StaticWallmark (const wm_shader& S, const Fvector& P, float s, CDB::TRI* T, Fvector* V); + virtual void add_StaticWallmark (ref_shader& S, const Fvector& P, float s, CDB::TRI* T, Fvector* V, bool UseCameraDirection = false); + virtual void add_StaticWallmark (IWallMarkArray* pArray, const Fvector& P, float s, CDB::TRI* T, Fvector* V, bool UseCameraDirection = false) override; + virtual void add_StaticWallmark (const wm_shader& S, const Fvector& P, float s, CDB::TRI* T, Fvector* V); virtual void clear_static_wallmarks (); virtual void add_SkeletonWallmark (intrusive_ptr wm); virtual void add_SkeletonWallmark (const Fmatrix* xf, CKinematics* obj, ref_shader& sh, const Fvector& start, const Fvector& dir, float size); diff --git a/src/Layers/xrRenderPC_R2/r2.cpp b/src/Layers/xrRenderPC_R2/r2.cpp index a344017c8..dc88d8fe4 100644 --- a/src/Layers/xrRenderPC_R2/r2.cpp +++ b/src/Layers/xrRenderPC_R2/r2.cpp @@ -417,18 +417,19 @@ BOOL CRender::occ_visible (Fbox& P) { return HOM.visible(P); } void CRender::add_Visual (IRenderVisual* V, bool ignore_opt) { add_leafs_Dynamic((dxRender_Visual*)V, ignore_opt); } void CRender::add_Geometry (IRenderVisual* V ) { add_Static((dxRender_Visual*)V,View->getMask()); } -void CRender::add_StaticWallmark (ref_shader& S, const Fvector& P, float s, CDB::TRI* T, Fvector* verts) + +void CRender::add_StaticWallmark(ref_shader& S, const Fvector& P, float s, CDB::TRI* T, Fvector* verts, bool UseCameraDirection) { if (T->suppress_wm) return; - VERIFY2 (_valid(P) && _valid(s) && T && verts && (s>EPS_L), "Invalid static wallmark params"); - Wallmarks->AddStaticWallmark (T,verts,P,&*S,s); + VERIFY2(_valid(P) && _valid(s) && T && verts && (s > EPS_L), "Invalid static wallmark params"); + Wallmarks->AddStaticWallmark(T, verts, P, &*S, s, UseCameraDirection); } -void CRender::add_StaticWallmark (IWallMarkArray *pArray, const Fvector& P, float s, CDB::TRI* T, Fvector* V) +void CRender::add_StaticWallmark(IWallMarkArray* pArray, const Fvector& P, float s, CDB::TRI* T, Fvector* V, bool UseCameraDirection) { - dxWallMarkArray *pWMA = (dxWallMarkArray *)pArray; - ref_shader *pShader = pWMA->dxGenerateWallmark(); - if (pShader) add_StaticWallmark (*pShader, P, s, T, V); + dxWallMarkArray* pWMA = (dxWallMarkArray*)pArray; + ref_shader* pShader = pWMA->dxGenerateWallmark(); + if (pShader) add_StaticWallmark(*pShader, P, s, T, V, UseCameraDirection); } void CRender::add_StaticWallmark (const wm_shader& S, const Fvector& P, float s, CDB::TRI* T, Fvector* V) diff --git a/src/Layers/xrRenderPC_R2/r2.h b/src/Layers/xrRenderPC_R2/r2.h index 18be57fe8..94dd28858 100644 --- a/src/Layers/xrRenderPC_R2/r2.h +++ b/src/Layers/xrRenderPC_R2/r2.h @@ -249,8 +249,8 @@ class CRender : public R_dsgraph_structure virtual void add_Geometry (IRenderVisual* V ); // add visual(s) (all culling performed) // wallmarks - virtual void add_StaticWallmark (ref_shader& S, const Fvector& P, float s, CDB::TRI* T, Fvector* V); - virtual void add_StaticWallmark (IWallMarkArray *pArray, const Fvector& P, float s, CDB::TRI* T, Fvector* V); + virtual void add_StaticWallmark (ref_shader& S, const Fvector& P, float s, CDB::TRI* T, Fvector* V, bool UseCameraDirection = false); + virtual void add_StaticWallmark (IWallMarkArray *pArray, const Fvector& P, float s, CDB::TRI* T, Fvector* V, bool UseCameraDirection = false) override; virtual void add_StaticWallmark (const wm_shader& S, const Fvector& P, float s, CDB::TRI* T, Fvector* V); virtual void clear_static_wallmarks (); virtual void add_SkeletonWallmark (intrusive_ptr wm); diff --git a/src/Layers/xrRenderPC_R4/r4.cpp b/src/Layers/xrRenderPC_R4/r4.cpp index 72824b753..fd8c1c72b 100644 --- a/src/Layers/xrRenderPC_R4/r4.cpp +++ b/src/Layers/xrRenderPC_R4/r4.cpp @@ -470,19 +470,20 @@ void CRender::add_Geometry(IRenderVisual* V) { add_Static((dxRender_Visual*)V, View->getMask()); } -void CRender::add_StaticWallmark(ref_shader& S, const Fvector& P, float s, CDB::TRI* T, Fvector* verts) { +void CRender::add_StaticWallmark(ref_shader& S, const Fvector& P, float s, CDB::TRI* T, Fvector* verts, bool UseCameraDirection) +{ if(T->suppress_wm) { return; } VERIFY2(_valid(P) && _valid(s) && T && verts && (s > EPS_L), "Invalid static wallmark params"); - Wallmarks->AddStaticWallmark(T, verts, P, &*S, s); + Wallmarks->AddStaticWallmark(T, verts, P, &*S, s, UseCameraDirection); } -void CRender::add_StaticWallmark(IWallMarkArray* pArray, const Fvector& P, float s, CDB::TRI* T, Fvector* V) { +void CRender::add_StaticWallmark(IWallMarkArray* pArray, const Fvector& P, float s, CDB::TRI* T, Fvector* V, bool UseCameraDirection) { dxWallMarkArray* pWMA = (dxWallMarkArray*)pArray; ref_shader* pShader = pWMA->dxGenerateWallmark(); if(pShader) { - add_StaticWallmark(*pShader, P, s, T, V); + add_StaticWallmark(*pShader, P, s, T, V, UseCameraDirection); } } diff --git a/src/Layers/xrRenderPC_R4/r4.h b/src/Layers/xrRenderPC_R4/r4.h index c3c425cdd..5dd1ddfdb 100644 --- a/src/Layers/xrRenderPC_R4/r4.h +++ b/src/Layers/xrRenderPC_R4/r4.h @@ -264,8 +264,8 @@ class CRender : public R_dsgraph_structure virtual void add_Geometry (IRenderVisual* V ); // add visual(s) (all culling performed) // wallmarks - virtual void add_StaticWallmark (ref_shader& S, const Fvector& P, float s, CDB::TRI* T, Fvector* V); - virtual void add_StaticWallmark (IWallMarkArray *pArray, const Fvector& P, float s, CDB::TRI* T, Fvector* V); + virtual void add_StaticWallmark (ref_shader& S, const Fvector& P, float s, CDB::TRI* T, Fvector* V, bool UseCameraDirection = false); + virtual void add_StaticWallmark (IWallMarkArray *pArray, const Fvector& P, float s, CDB::TRI* T, Fvector* V, bool UseCameraDirection = false) override; virtual void add_StaticWallmark (const wm_shader& S, const Fvector& P, float s, CDB::TRI* T, Fvector* V); virtual void clear_static_wallmarks (); virtual void add_SkeletonWallmark (intrusive_ptr wm); diff --git a/src/xrEngine/EngineExternal.cpp b/src/xrEngine/EngineExternal.cpp index 99861df05..4aba625e2 100644 --- a/src/xrEngine/EngineExternal.cpp +++ b/src/xrEngine/EngineExternal.cpp @@ -10,11 +10,13 @@ CEngineExternal::CEngineExternal() pOptions = new CInifile(fname); } -CEngineExternal::~CEngineExternal() { +CEngineExternal::~CEngineExternal() +{ xr_delete(pOptions); } -xr_string CEngineExternal::GetTitle() const { +xr_string CEngineExternal::GetTitle() const +{ return READ_IF_EXISTS(pOptions, r_string_wb, "general", "title", "IX-Ray Platform").c_str(); } @@ -23,6 +25,35 @@ const char* CEngineExternal::GetPlayerHudOmfAdditional() const return READ_IF_EXISTS(pOptions, r_string_wb, "player_hud", "PlayerHudOmfAdditional", "").c_str(); } +const xr_vector CEngineExternal::StepWallmarksMaterials() const +{ + xr_vector TempVector; + xr_string Items = READ_IF_EXISTS(pOptions, r_string_wb, "step_wallmark", "materials", "").c_str(); + + size_t MaterialsCount = _GetItemCount(Items.c_str()); + TempVector.resize(MaterialsCount); + + size_t Iter = 0; + for (shared_str& Item : TempVector) + { + xr_string _temp; + Item = _GetItem(Items.c_str(), (int)Iter, _temp); + Iter++; + } + + return std::move(TempVector); +} + +const xr_string CEngineExternal::WallmarkLeft() const +{ + return READ_IF_EXISTS(pOptions, r_string_wb, "step_wallmark", "left_mark", "").c_str(); +} + +const xr_string CEngineExternal::WallmarkRight() const +{ + return READ_IF_EXISTS(pOptions, r_string_wb, "step_wallmark", "right_mark", "").c_str(); +} + bool CEngineExternal::operator[](const EEngineExternalUI& ID) const { return READ_IF_EXISTS(pOptions, r_bool, "ui", magic_enum::enum_name(ID).data(), false); @@ -47,7 +78,8 @@ bool CEngineExternal::operator[](const EEngineExternalEnvironment& ID) const { return READ_IF_EXISTS(pOptions, r_bool, "environment", magic_enum::enum_name(ID).data(), false); } -ENGINE_API CEngineExternal& EngineExternal() { +ENGINE_API CEngineExternal& EngineExternal() +{ if (g_pEngineExternal == nullptr) { g_pEngineExternal = new CEngineExternal; } diff --git a/src/xrEngine/EngineExternal.h b/src/xrEngine/EngineExternal.h index 91ef19b04..873f535ed 100644 --- a/src/xrEngine/EngineExternal.h +++ b/src/xrEngine/EngineExternal.h @@ -24,6 +24,7 @@ enum class EEngineExternalGame EnableWeaponInertion, EnableWeaponCollision, EnableArtefactDegradation, + EnableActorStepWallmarks, DisableSprintWhileOverweight }; @@ -49,6 +50,9 @@ class ENGINE_API CEngineExternal final xr_string GetTitle() const; const char* GetPlayerHudOmfAdditional() const; + const xr_vector StepWallmarksMaterials() const; + const xr_string WallmarkLeft() const; + const xr_string WallmarkRight() const; bool operator[](const EEngineExternalUI& ID) const; bool operator[](const EEngineExternalPhysical& ID) const; diff --git a/src/xrEngine/Render.h b/src/xrEngine/Render.h index 579487e14..43e94a84b 100644 --- a/src/xrEngine/Render.h +++ b/src/xrEngine/Render.h @@ -248,7 +248,7 @@ class ENGINE_API IRender_interface virtual void add_StaticWallmark (const wm_shader& S, const Fvector& P, float s, CDB::TRI* T, Fvector* V) {}; // Prefer this function when possible - virtual void add_StaticWallmark (IWallMarkArray *pArray, const Fvector& P, float s, CDB::TRI* T, Fvector* V) {}; + virtual void add_StaticWallmark (IWallMarkArray *pArray, const Fvector& P, float s, CDB::TRI* T, Fvector* V, bool UseCameraDirection = false) {}; virtual void clear_static_wallmarks () {}; // Prefer this function when possible diff --git a/src/xrGame/Actor.cpp b/src/xrGame/Actor.cpp index cef39c032..a0fa53cff 100644 --- a/src/xrGame/Actor.cpp +++ b/src/xrGame/Actor.cpp @@ -438,7 +438,7 @@ if(!g_dedicated_server) } } - cam_Set(eacFirstEye); + cam_Set(eacFirstEye); // sheduler shedule.t_min = shedule.t_max = 1; @@ -740,7 +740,55 @@ void CActor::HitMark (float P, xr_sprintf( sect_name, "effector_fire_hit_%d", id ); AddEffector( this, effFireHit, sect_name, P * 0.001f ); - }//if hit_type + } +} + +void CActor::FootStepCallback(float power, bool b_play, bool b_on_ground, bool b_hud_view) +{ + static bool EnableStepWallmarks = EngineExternal()[EEngineExternalGame::EnableActorStepWallmarks]; + if (EnableStepWallmarks) + { + u16 mtl_idx = Actor()->material().last_material_idx(); + if (mtl_idx != GAMEMTL_NONE_IDX) + { + static CWalmarkManager m_wallmark_r; + static CWalmarkManager m_wallmark_l; + static bool inited = false; + static bool left_step = false; + + static shared_str RightSect = EngineExternal().WallmarkRight().c_str(); + static shared_str LeftSect = EngineExternal().WallmarkLeft().c_str(); + if (!inited) + { + m_wallmark_r.m_owner = this; + m_wallmark_l.m_owner = this; + m_wallmark_r.Load(RightSect.c_str()); + m_wallmark_l.Load(LeftSect.c_str()); + bool inited = true; + } + + const SGameMtl* mtl = GMLib.GetMaterialByIdx(mtl_idx); + static auto MaterialsList = EngineExternal().StepWallmarksMaterials(); + for (const shared_str& MaterialName : MaterialsList) + { + if (MaterialName == mtl->m_Name) + { + if (left_step) + { + m_wallmark_r.PlaceWallmarks(Position(), RightSect); + left_step = false; + } + else + { + m_wallmark_l.PlaceWallmarks(Position(), LeftSect); + left_step = true; + } + + break; + } + } + } + } } void CActor::HitSignal(float perc, Fvector& vLocalDir, CObject* who, s16 element) diff --git a/src/xrGame/Actor.h b/src/xrGame/Actor.h index a50c9eeff..fdb5b4910 100644 --- a/src/xrGame/Actor.h +++ b/src/xrGame/Actor.h @@ -183,6 +183,7 @@ struct SDefNewsMsg{ virtual void HitSignal (float P, Fvector &vLocalDir, CObject* who, s16 element); void HitSector (CObject* who, CObject* weapon); void HitMark (float P, Fvector dir, CObject* who, s16 element, Fvector position_in_bone_space, float impulse, ALife::EHitType hit_type); + virtual void FootStepCallback(float power, bool b_play, bool b_on_ground, bool b_hud_view); void Feel_Grenade_Update( float rad ); diff --git a/src/xrGame/GameObject.h b/src/xrGame/GameObject.h index 375e62690..af3b3e41d 100644 --- a/src/xrGame/GameObject.h +++ b/src/xrGame/GameObject.h @@ -260,7 +260,7 @@ const animation_movement_controller* animation_movement ( ) const { return m_an return (m_story_id); } - void FootStepCallback(float power, bool b_play, bool b_on_ground, bool b_hud_view); + virtual void FootStepCallback(float power, bool b_play, bool b_on_ground, bool b_hud_view); public: virtual u32 ef_creature_type () const; diff --git a/src/xrGame/step_manager.cpp b/src/xrGame/step_manager.cpp index 9b31de5ca..527da386e 100644 --- a/src/xrGame/step_manager.cpp +++ b/src/xrGame/step_manager.cpp @@ -196,7 +196,9 @@ void CStepManager::update(bool b_hud_view) CGameObject* object = smart_cast(m_object); if (object) + { object->FootStepCallback(m_step_info.params.step[i].power, b_play, is_on_ground(), b_hud_view); + } // Играть партиклы if(b_play && !mtl_pair->CollideParticles.empty()) diff --git a/src/xrGame/wallmark_manager.cpp b/src/xrGame/wallmark_manager.cpp index 4b9f1380f..812df1dc4 100644 --- a/src/xrGame/wallmark_manager.cpp +++ b/src/xrGame/wallmark_manager.cpp @@ -56,32 +56,6 @@ void CWalmarkManager::AddWallmark(const Fvector& dir, const Fvector& start_pos, } } -/* -void CWalmarkManager::PlaceWallmark(const Fvector& dir, const Fvector& start_pos, - float trace_dist, float wallmark_size, - SHADER_VECTOR& wallmarks_vector,CObject* ignore_obj) -{ - collide::rq_result result; - BOOL reach_wall = - Level().ObjectSpace.RayPick( - start_pos, - dir, - trace_dist, - collide::rqtBoth, - result, - ignore_obj - ) - && - !result.O; - - //если кровь долетела до статического объекта - if(reach_wall) - { - AddWallmark(dir,start_pos,result.range,wallmark_size,wallmarks_vector,result.element); - } -} -*/ - void CWalmarkManager::PlaceWallmarks(const Fvector& start_pos) { m_pos = start_pos; @@ -104,9 +78,19 @@ void CWalmarkManager::PlaceWallmarks(const Fvector& start_pos) StartWorkflow(sect); } +void CWalmarkManager::PlaceWallmarks(const Fvector& start_pos, shared_str Sect) +{ + m_pos = start_pos; + + if (m_owner == nullptr) + return; + + StartWorkflow(Sect, true); +} + float Distance (const Fvector& rkPoint, const Fvector rkTri[3], float& pfSParam, float& pfTParam, Fvector& closest, Fvector& dir); -void CWalmarkManager::StartWorkflow(const shared_str& sect) +void CWalmarkManager::StartWorkflow(const shared_str& sect, bool UseCamDir) { float m_trace_dist = pSettings->r_float(sect,"dist"); float m_wallmark_size = pSettings->r_float(sect,"size"); @@ -166,7 +150,7 @@ void CWalmarkManager::StartWorkflow(const shared_str& sect) if(dist <= m_trace_dist ) { - ::Render->add_StaticWallmark(&*m_wallmarks, end_point, m_wallmark_size, _t, V_array); + ::Render->add_StaticWallmark(&*m_wallmarks, end_point, m_wallmark_size, _t, V_array, UseCamDir); ++wm_count; }else ++_not_dist; diff --git a/src/xrGame/wallmark_manager.h b/src/xrGame/wallmark_manager.h index b64344ca8..bf6db4f2e 100644 --- a/src/xrGame/wallmark_manager.h +++ b/src/xrGame/wallmark_manager.h @@ -19,6 +19,7 @@ class CWalmarkManager void Clear () ; void AddWallmark (const Fvector& dir, const Fvector& start_pos, float range, float wallmark_size,IWallMarkArray &wallmarks_vector,int t); void PlaceWallmarks ( const Fvector& start_pos); + void PlaceWallmarks ( const Fvector& start_pos, shared_str Sect); - void StartWorkflow (const shared_str& Sect); + void StartWorkflow (const shared_str& Sect, bool UseCamDir = false); }; \ No newline at end of file