DayZ 1.27
DayZ Explorer by KGB
 
Загрузка...
Поиск...
Не найдено

◆ IsUnderwater()

bool Hologram::IsUnderwater ( )
inlineprotected

См. определение в файле Hologram.c строка 845

846 {
847 if (CfgGameplayHandler.GetDisableIsUnderwaterCheck())
848 return false;
849 // Fast check middle of object
850 string type;
851 int liquid;
852 g_Game.SurfaceUnderObjectCorrectedLiquid(m_Projection, type, liquid);
853
854 if (liquid & (LIQUID_GROUP_WATER - LIQUID_SNOW))
855 {
856 #ifdef DIAG_DEVELOPER
857 DebugText("IsUnderwater: ", false, true, " | Surface under object is water");
858 #endif
859 return true;
860 }
861
862 // Check every corner of the object
863 vector left_close = m_Projection.CoordToParent( GetLeftCloseProjectionVector() );
864 vector right_close = m_Projection.CoordToParent( GetRightCloseProjectionVector() );
865 vector left_far = m_Projection.CoordToParent( GetLeftFarProjectionVector() );
866 vector right_far = m_Projection.CoordToParent( GetRightFarProjectionVector() );
867 float maxSea = g_Game.SurfaceGetSeaLevelMax() + 0.03;
868 bool belowMaxSea = left_close[1] < maxSea || right_close[1] < maxSea || left_far[1] < maxSea || right_far[1] < maxSea;
869
870 #ifdef DIAG_DEVELOPER
871 // I'd rather duplicate this on internal than introduce (even) more raycasts than needed on retail..
872 float lc = g_Game.GetWaterDepth(left_close);
873 float rc = g_Game.GetWaterDepth(right_close);
874 float lf = g_Game.GetWaterDepth(left_far);
875 float rf = g_Game.GetWaterDepth(right_far);
876 bool isTrue = (lc > 0 || rc > 0 || lf > 0 || rf > 0 || belowMaxSea);
877 DebugText("IsUnderwater: ", false, isTrue, " belowMaxSea: " + belowMaxSea + " | (all must be less than zero) | lc: " + lc + " | rc: " + rc + " | lf: " + lf + " | rf: " + rf);
878 //DebugText("Corner Height: ", false, true, " lc: " + left_close[1] + " | rc: " + right_close[1] + " | lf: " + left_far[1] + " | rf: " + right_far[1]);
879 if (isTrue)
880 {
881 array<bool> conditions = {lc <= 0, rc <= 0, lf <= 0, rf <= 0};
882 DrawBaseSpheres(conditions);
883 }
884 #endif
885
886 return (belowMaxSea || g_Game.GetWaterDepth(left_close) > 0 || g_Game.GetWaterDepth(right_close) > 0 || g_Game.GetWaterDepth(left_far) > 0 || g_Game.GetWaterDepth(right_far) > 0);
887 }
DayZGame g_Game
Определения DayZGame.c:3868
vector GetLeftFarProjectionVector()
Определения Hologram.c:1056
EntityAI m_Projection
Определения Hologram.c:22
vector GetRightFarProjectionVector()
Определения Hologram.c:1065
vector GetLeftCloseProjectionVector()
Определения Hologram.c:1038
vector GetRightCloseProjectionVector()
Определения Hologram.c:1046
const int LIQUID_GROUP_WATER
Определения constants.c:555
const int LIQUID_SNOW
Определения constants.c:547

Перекрестные ссылки g_Game, CfgGameplayHandler::GetDisableIsUnderwaterCheck(), GetLeftCloseProjectionVector(), GetLeftFarProjectionVector(), GetRightCloseProjectionVector(), GetRightFarProjectionVector(), LIQUID_GROUP_WATER, LIQUID_SNOW и m_Projection.

Используется в EvaluateCollision().