diff --git a/server/gameserver/creature.cc b/server/gameserver/creature.cc index ecdd90c5..bf3880f1 100644 --- a/server/gameserver/creature.cc +++ b/server/gameserver/creature.cc @@ -1413,56 +1413,20 @@ void Creature::DecInventory(int slot_id, int num) void Creature::CheckSpecObject(int new_poly_flags) { - #if 0 - int old_poly_ext_flags = poly_ext_flags_; - poly_ext_flags_ = 0; - { - int poly_idx = 0; - dtPoly* poly = room->map_instance->GetPoly(GetPos().ToGlmVec3(), poly_idx); - if (poly) { - poly_ext_flags_ = room->GetPolyExtFlag(poly_idx); - } - } - if (old_poly_ext_flags != poly_ext_flags_) { - for (int i = 0; i < sizeof(poly_ext_flags_) * 8; ++i) { - if (!a8::SameBitFlag(old_poly_ext_flags, poly_ext_flags_, i)) { - switch (i) { - case kWater1ExtFlag: - { - if (a8::HasBitFlag(poly_ext_flags_, i)) { - TryAddBuff(this, kInWater1BuffId); - } else { - RemoveBuffByEffectId(kBET_InWater); - } + if (poly_ext_flags_ != new_poly_flags) { + for (int i = 0; i < 16; ++i) { + if (!a8::SameBitFlag(poly_ext_flags_, new_poly_flags, i)) { + if ((1 << i) == SAMPLE_POLYFLAGS_SWIM) { + if (a8::HasBitFlag(poly_ext_flags_, i)) { + TryAddBuff(this, kInWater1BuffId); + } else { + RemoveBuffByEffectId(kBET_InWater); } - break; - case kWater2ExtFlag: - { - if (a8::HasBitFlag(poly_ext_flags_, i)) { - TryAddBuff(this, kInWater2BuffId); - } else { - RemoveBuffByEffectId(kBET_InWater); - } - } - break; - case kWater3ExtFlag: - { - if (a8::HasBitFlag(poly_ext_flags_, i)) { - TryAddBuff(this, kInWater3BuffId); - } else { - RemoveBuffByEffectId(kBET_InWater); - } - } - break; - default: - { - } - break; } } } } - #endif + poly_ext_flags_ = new_poly_flags; } void Creature::SummonObstacle(Buff* buff, int id, const Position& target_pos) diff --git a/server/gameserver/mapinstance.cc b/server/gameserver/mapinstance.cc index ef9bbdbb..2d0eed76 100644 --- a/server/gameserver/mapinstance.cc +++ b/server/gameserver/mapinstance.cc @@ -377,11 +377,7 @@ bool MapInstance::Raycast(const glm::vec3& start, const glm::vec3& end, #endif } if (npolys <= 0) { - #ifdef DEBUG - abort(); - #else return false; - #endif } if (t > 1) { @@ -634,11 +630,7 @@ bool MapInstance::RaycastEx(const glm::vec3& start, const glm::vec3& end, #endif } if (npolys <= 0) { - #ifdef DEBUG - abort(); - #else return false; - #endif } if (t > 1) { diff --git a/server/gameserver/movement.cc b/server/gameserver/movement.cc index 807c11ec..27c4ce82 100644 --- a/server/gameserver/movement.cc +++ b/server/gameserver/movement.cc @@ -83,7 +83,8 @@ void Movement::CalcTargetPos(float distance) glm::vec3 hit_point; owner_->room->map_instance->Scale(start); owner_->room->map_instance->Scale(end); - bool ret = owner_->room->map_instance->Raycast(start, end, hit_point, hit_result); + bool ret = owner_->room->map_instance->RaycastEx(start, end, hit_point, hit_result, + point.same_polys_flags, point.spec_polys); if (ret) { owner_->room->map_instance->UnScale(hit_point); point.tar_pos.FromGlmVec3(hit_point);