Core/Units: Second part of SMSG_MOVE_SET_COLLISION_HGT implementation: compute proper collision height according to client formulae and send this to the client when mounting up.
This commit is contained in:
@@ -760,7 +760,7 @@ struct CreatureModelDataEntry
|
|||||||
//uint32 Flags;
|
//uint32 Flags;
|
||||||
//char* ModelPath[16]
|
//char* ModelPath[16]
|
||||||
//uint32 Unk1;
|
//uint32 Unk1;
|
||||||
//float Scale; // Used in calculation of unit collision data
|
float Scale; // Used in calculation of unit collision data
|
||||||
//int32 Unk2
|
//int32 Unk2
|
||||||
//int32 Unk3
|
//int32 Unk3
|
||||||
//uint32 Unk4
|
//uint32 Unk4
|
||||||
@@ -770,9 +770,9 @@ struct CreatureModelDataEntry
|
|||||||
//float Unk8
|
//float Unk8
|
||||||
//uint32 Unk9
|
//uint32 Unk9
|
||||||
//uint32 Unk10
|
//uint32 Unk10
|
||||||
float CollisionWidth;
|
//float CollisionWidth;
|
||||||
float CollisionHeight;
|
float CollisionHeight;
|
||||||
//float Unk11; // Used in calculation of unit collision data when mounted
|
float MountHeight; // Used in calculation of unit collision data when mounted
|
||||||
//float Unks[11]
|
//float Unks[11]
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ const char ChrRacesEntryfmt[]="nxixiixixxxxixssssssssssssssssxxxxxxxxxxxxxxxxxxx
|
|||||||
const char CinematicSequencesEntryfmt[]="nxxxxxxxxx";
|
const char CinematicSequencesEntryfmt[]="nxxxxxxxxx";
|
||||||
const char CreatureDisplayInfofmt[]="nixxfxxxxxxxxxxx";
|
const char CreatureDisplayInfofmt[]="nixxfxxxxxxxxxxx";
|
||||||
const char CreatureFamilyfmt[]="nfifiiiiixssssssssssssssssxx";
|
const char CreatureFamilyfmt[]="nfifiiiiixssssssssssssssssxx";
|
||||||
const char CreatureModelDatafmt[]="nxxxxxxxxxxxxxffxxxxxxxxxxxx";
|
const char CreatureModelDatafmt[]="nxxxfxxxxxxxxxxffxxxxxxxxxxx";
|
||||||
const char CreatureSpellDatafmt[]="niiiixxxx";
|
const char CreatureSpellDatafmt[]="niiiixxxx";
|
||||||
const char CreatureTypefmt[]="nxxxxxxxxxxxxxxxxxx";
|
const char CreatureTypefmt[]="nxxxxxxxxxxxxxxxxxx";
|
||||||
const char CurrencyTypesfmt[]="xnxi";
|
const char CurrencyTypesfmt[]="xnxi";
|
||||||
|
|||||||
@@ -2494,16 +2494,37 @@ class Player : public Unit, public GridObject<Player>
|
|||||||
bool IsInWhisperWhiteList(uint64 guid);
|
bool IsInWhisperWhiteList(uint64 guid);
|
||||||
|
|
||||||
//! Return collision height sent to client
|
//! Return collision height sent to client
|
||||||
//! we currently only send this on dismount
|
float GetCollisionHeight(bool mounted)
|
||||||
float GetCollisionHeight()
|
|
||||||
{
|
{
|
||||||
CreatureDisplayInfoEntry const* displayInfo = sCreatureDisplayInfoStore.LookupEntry(GetNativeDisplayId());
|
if (mounted)
|
||||||
ASSERT(displayInfo);
|
{
|
||||||
CreatureModelDataEntry const* modelData = sCreatureModelDataStore.LookupEntry(displayInfo->ModelId);
|
CreatureDisplayInfoEntry const* mountDisplayInfo = sCreatureDisplayInfoStore.LookupEntry(GetUInt32Value(UNIT_FIELD_MOUNTDISPLAYID));
|
||||||
ASSERT(modelData);
|
if (!mountDisplayInfo)
|
||||||
|
return GetCollisionHeight(false);
|
||||||
|
|
||||||
|
CreatureModelDataEntry const* mountModelData = sCreatureModelDataStore.LookupEntry(mountDisplayInfo->ModelId);
|
||||||
|
if (!mountModelData)
|
||||||
|
return GetCollisionHeight(false);
|
||||||
|
|
||||||
return modelData->CollisionHeight;
|
CreatureDisplayInfoEntry const* displayInfo = sCreatureDisplayInfoStore.LookupEntry(GetNativeDisplayId());
|
||||||
|
ASSERT(displayInfo);
|
||||||
|
CreatureModelDataEntry const* modelData = sCreatureModelDataStore.LookupEntry(displayInfo->ModelId);
|
||||||
|
ASSERT(modelData);
|
||||||
|
|
||||||
|
float scaleMod = GetFloatValue(OBJECT_FIELD_SCALE_X); // 99% sure about this
|
||||||
|
|
||||||
|
return scaleMod * mountModelData->MountHeight + modelData->CollisionHeight * 0.5f;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//! Dismounting case - use basic default model data
|
||||||
|
CreatureDisplayInfoEntry const* displayInfo = sCreatureDisplayInfoStore.LookupEntry(GetNativeDisplayId());
|
||||||
|
ASSERT(displayInfo);
|
||||||
|
CreatureModelDataEntry const* modelData = sCreatureModelDataStore.LookupEntry(displayInfo->ModelId);
|
||||||
|
ASSERT(modelData);
|
||||||
|
|
||||||
|
return modelData->CollisionHeight;
|
||||||
|
}
|
||||||
//! TODO: Need a proper calculation for collision height when mounted
|
//! TODO: Need a proper calculation for collision height when mounted
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -11934,6 +11934,12 @@ void Unit::Mount(uint32 mount, uint32 VehicleId, uint32 creatureEntry)
|
|||||||
else
|
else
|
||||||
player->UnsummonPetTemporaryIfAny();
|
player->UnsummonPetTemporaryIfAny();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
WorldPacket data(SMSG_MOVE_SET_COLLISION_HGT, GetPackGUID().size() + 4 + 4);
|
||||||
|
data.append(GetPackGUID());
|
||||||
|
data << uint32(sWorld->GetGameTime()); // Packet counter
|
||||||
|
data << player->GetCollisionHeight(true);
|
||||||
|
player->GetSession()->SendPacket(&data);
|
||||||
}
|
}
|
||||||
|
|
||||||
RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_MOUNT);
|
RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_MOUNT);
|
||||||
@@ -11952,7 +11958,7 @@ void Unit::Unmount()
|
|||||||
WorldPacket data(SMSG_MOVE_SET_COLLISION_HGT, GetPackGUID().size() + 4 + 4);
|
WorldPacket data(SMSG_MOVE_SET_COLLISION_HGT, GetPackGUID().size() + 4 + 4);
|
||||||
data.append(GetPackGUID());
|
data.append(GetPackGUID());
|
||||||
data << uint32(sWorld->GetGameTime()); // Packet counter
|
data << uint32(sWorld->GetGameTime()); // Packet counter
|
||||||
data << thisPlayer->GetCollisionHeight();
|
data << thisPlayer->GetCollisionHeight(false);
|
||||||
thisPlayer->GetSession()->SendPacket(&data);
|
thisPlayer->GetSession()->SendPacket(&data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user