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

◆ IsUnderwater()

bool Hologram::IsUnderwater ( )
inlineprotected

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

897 {
898 if (CfgGameplayHandler.GetDisableIsUnderwaterCheck())
899 return false;
900 // Fast check middle of object
901 string type;
902 int liquid;
903 g_Game.SurfaceUnderObjectCorrectedLiquid(m_Projection, type, liquid);
904
905 if (liquid & (LIQUID_GROUP_WATER - LIQUID_SNOW))
906 {
907 #ifdef DIAG_DEVELOPER
908 DebugLog("IsUnderwater: ", false, true, " | Surface under object is water");
909 #endif
910 return true;
911 }
912
913 // Check every corner of the object
914 vector left_close = m_Projection.CoordToParent( GetLeftCloseProjectionVector() );
915 vector right_close = m_Projection.CoordToParent( GetRightCloseProjectionVector() );
916 vector left_far = m_Projection.CoordToParent( GetLeftFarProjectionVector() );
917 vector right_far = m_Projection.CoordToParent( GetRightFarProjectionVector() );
918 float maxSea = g_Game.SurfaceGetSeaLevelMax() + 0.03;
919 bool belowMaxSea = left_close[1] < maxSea || right_close[1] < maxSea || left_far[1] < maxSea || right_far[1] < maxSea;
920
921 #ifdef DIAG_DEVELOPER
922 // I'd rather duplicate this on internal than introduce (even) more raycasts than needed on retail..
923 float lc = g_Game.GetWaterDepth(left_close);
924 float rc = g_Game.GetWaterDepth(right_close);
925 float lf = g_Game.GetWaterDepth(left_far);
926 float rf = g_Game.GetWaterDepth(right_far);
927 bool isTrue = (lc > 0 || rc > 0 || lf > 0 || rf > 0 || belowMaxSea);
928 DebugLog("IsUnderwater: ", false, isTrue, " belowMaxSea: " + belowMaxSea + " | (all must be less than zero) | lc: " + lc + " | rc: " + rc + " | lf: " + lf + " | rf: " + rf);
929 //DebugLog("Corner Height: ", false, true, " lc: " + left_close[1] + " | rc: " + right_close[1] + " | lf: " + left_far[1] + " | rf: " + right_far[1]);
930 if (isTrue)
931 {
932 array<bool> conditions = {lc <= 0, rc <= 0, lf <= 0, rf <= 0};
933 DrawBaseSpheres(conditions);
934 }
935 #endif
936
937 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);
938 }
DayZGame g_Game
Определения DayZGame.c:3942
vector GetLeftFarProjectionVector()
Определения Hologram.c:1107
EntityAI m_Projection
Определения Hologram.c:22
vector GetRightFarProjectionVector()
Определения Hologram.c:1116
vector GetLeftCloseProjectionVector()
Определения Hologram.c:1089
vector GetRightCloseProjectionVector()
Определения Hologram.c:1097
const int LIQUID_GROUP_WATER
Определения 3_Game/DayZ/constants.c:560
const int LIQUID_SNOW
Определения 3_Game/DayZ/constants.c:552

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

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