This commit is contained in:
aozhiwei 2023-02-03 17:09:39 +08:00
parent 0efe12e24f
commit 3683a0a00d
3 changed files with 11 additions and 54 deletions

View File

@ -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)

View File

@ -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) {

View File

@ -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);