This commit is contained in:
aozhiwei 2023-01-06 17:08:30 +08:00
parent 06aaf1bd32
commit a724def626
2 changed files with 40 additions and 18 deletions

View File

@ -1413,31 +1413,53 @@ void Creature::DecInventory(int slot_id, int num)
void Creature::CheckSpecObject()
{
long long old_cell_flags = cell_flags_;
cell_flags_ = 0;
int ext_flags = 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) {
ext_flags = room->GetPolyExtFlag(poly_idx);
#if 0
if ((poly->flags & SAMPLE_POLYFLAGS_SWIM) == SAMPLE_POLYFLAGS_SWIM) {
a8::SetBitFlag(cell_flags_, kColliderTag_Water);
}
#endif
poly_ext_flags_ = room->GetPolyExtFlag(poly_idx);
}
}
if (old_cell_flags != cell_flags_) {
#if 0
if (!a8::SameBitFlag(old_cell_flags, cell_flags_, kColliderTag_Water)) {
if (a8::HasBitFlag(cell_flags_, kColliderTag_Water)) {
TryAddBuff(this, kInWater1BuffId);
} else {
RemoveBuffByEffectId(kBET_InWater);
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);
}
}
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
}
}

View File

@ -323,7 +323,7 @@ protected:
int action_item_id = 0;
int action_target_id = 0;
long long cell_flags_ = 0;
int poly_ext_flags_ = 0;
std::array<Inventory, IS_END> buff_inventory_ = {};
int camouflage_move_addition_ = 0;