Преглед изворни кода

Update Spawn.cpp

- Fix low water line issue, slight offset (-1.0f) also helps for groundspawns slightly out of water
- Added an 'eye level' to line of sight
Image пре 3 година
родитељ
комит
e2a5f86be8
1 измењених фајлова са 17 додато и 4 уклоњено
  1. 17 4
      EQ2/source/WorldServer/Spawn.cpp

+ 17 - 4
EQ2/source/WorldServer/Spawn.cpp

@@ -3602,7 +3602,7 @@ void Spawn::FixZ(bool forceUpdate) {
 	
 	if ( GetZone()->regionmap != nullptr )
 	{
-		glm::vec3 targPos(GetY(), GetX(), GetZ());
+		glm::vec3 targPos(GetY() - 1.0f, GetX(), GetZ());
 		float bestZ = -999999.0f;
 		if ( new_z != BEST_Z_INVALID )
 			bestZ = new_z - 1.0f;
@@ -3624,8 +3624,21 @@ void Spawn::FixZ(bool forceUpdate) {
 
 bool Spawn::CheckLoS(Spawn* target)
 {
-	glm::vec3 targpos(target->GetX(), target->GetZ(), target->GetY()+1.0f);
-	glm::vec3 pos(GetX(), GetZ(), GetY()+1.0f);
+	float radiusSrc = 1.0f;
+	float radiusTarg = 1.0f;
+
+	// we don't have an appropriate eye level height, this will have to do for now
+	if (!target->InWater() )
+	{
+		radiusTarg = 5.0f;
+	}
+	if(!InWater())
+	{
+		radiusSrc = 5.0f;
+	}
+
+	glm::vec3 targpos(target->GetX(), target->GetZ(), target->GetY()+radiusTarg);
+	glm::vec3 pos(GetX(), GetZ(), GetY()+radiusSrc);
 	return CheckLoS(pos, targpos);
 }
 
@@ -3827,7 +3840,7 @@ bool Spawn::InWater()
 				
 		if ( GetZone()->regionmap != nullptr )
 		{
-			glm::vec3 targPos(GetY(), GetX(), GetZ());
+			glm::vec3 targPos(GetY() - 1.0f, GetX(), GetZ());
 			float bestZ = -999999.0f;
 			if ( new_z != BEST_Z_INVALID )
 				bestZ = new_z;