Core/Vehicles: implement db side seat attachment offset values as tempoary solution until m2 bone handling is supported
* this is a duc-tape fix until @warpten gets his shit together
This commit is contained in:
1 parent
fc12e97cfe
commit
dd990856c0
4 files changed
+33
-13
No files matched your search
@@ -0,0 +1,5 @@
|
||||
ALTER TABLE `vehicle_seat_addon`
|
||||
ADD COLUMN `SeatOffsetX` FLOAT DEFAULT 0 NULL AFTER `SeatEntry`,
|
||||
ADD COLUMN `SeatOffsetY` FLOAT DEFAULT 0 NULL AFTER `SeatOffsetX`,
|
||||
ADD COLUMN `SeatOffsetZ` FLOAT DEFAULT 0 NULL AFTER `SeatOffsetY`,
|
||||
CHANGE `SeatOrientation` `SeatOffsetO` FLOAT DEFAULT 0 NULL COMMENT 'Seat Orientation override value';
|
||||
@@ -906,11 +906,20 @@ bool VehicleJoinEvent::Execute(uint64, uint32)
|
||||
if (veSeat->HasFlag(VEHICLE_SEAT_FLAG_PASSENGER_NOT_SELECTABLE))
|
||||
Passenger->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
|
||||
|
||||
float o = veSeatAddon ? veSeatAddon->SeatOrientationOffset : 0.f;
|
||||
float o = 0.f;
|
||||
float x = veSeat->AttachmentOffset.X;
|
||||
float y = veSeat->AttachmentOffset.Y;
|
||||
float z = veSeat->AttachmentOffset.Z;
|
||||
|
||||
if (veSeatAddon)
|
||||
{
|
||||
// To-do: extract client m2 model bones and handle this part without db data
|
||||
o += veSeatAddon->SeatOrientationOffset;
|
||||
x += veSeatAddon->SeatXOffset;
|
||||
y += veSeatAddon->SeatYOffset;
|
||||
z += veSeatAddon->SeatZOffset;
|
||||
}
|
||||
|
||||
Passenger->m_movementInfo.transport.pos.Relocate(x, y, z, o);
|
||||
Passenger->m_movementInfo.transport.time = 0;
|
||||
Passenger->m_movementInfo.transport.seat = Seat->first;
|
||||
|
||||
@@ -100,10 +100,13 @@ struct PassengerInfo
|
||||
struct VehicleSeatAddon
|
||||
{
|
||||
VehicleSeatAddon() { }
|
||||
VehicleSeatAddon(float orientatonOffset, float exitX, float exitY, float exitZ, float exitO, uint8 param) :
|
||||
SeatOrientationOffset(orientatonOffset), ExitParameterX(exitX), ExitParameterY(exitY), ExitParameterZ(exitZ),
|
||||
ExitParameterO(exitO), ExitParameter(VehicleExitParameters(param)) { }
|
||||
VehicleSeatAddon(float xOffset, float yOffset, float zOffset, float orientatonOffset, float exitX, float exitY, float exitZ, float exitO, uint8 param) :
|
||||
SeatXOffset(xOffset), SeatYOffset(yOffset), SeatZOffset(zOffset), SeatOrientationOffset(orientatonOffset),
|
||||
ExitParameterX(exitX), ExitParameterY(exitY), ExitParameterZ(exitZ), ExitParameterO(exitO), ExitParameter(VehicleExitParameters(param)) { }
|
||||
|
||||
float SeatXOffset = 0.f;
|
||||
float SeatYOffset = 0.f;
|
||||
float SeatZOffset = 0.f;
|
||||
float SeatOrientationOffset = 0.f;
|
||||
float ExitParameterX = 0.f;
|
||||
float ExitParameterY = 0.f;
|
||||
|
||||
@@ -3101,8 +3101,8 @@ void ObjectMgr::LoadVehicleSeatAddon()
|
||||
|
||||
uint32 count = 0;
|
||||
|
||||
// 0 1
|
||||
QueryResult result = WorldDatabase.Query("SELECT `SeatEntry`, `SeatOrientation`, `ExitParamX`, `ExitParamY`, `ExitParamZ`, `ExitParamO`, `ExitParamValue` FROM `vehicle_seat_addon`");
|
||||
// 0 1 2 3 4 5 6 7 8 9
|
||||
QueryResult result = WorldDatabase.Query("SELECT `SeatEntry`, `SeatOffsetX`, `SeatOffsetY`, `SeatOffsetZ`, `SeatOffsetO`, `ExitParamX`, `ExitParamY`, `ExitParamZ`, `ExitParamO`, `ExitParamValue` FROM `vehicle_seat_addon`");
|
||||
|
||||
if (!result)
|
||||
{
|
||||
@@ -3115,12 +3115,15 @@ void ObjectMgr::LoadVehicleSeatAddon()
|
||||
Field* fields = result->Fetch();
|
||||
|
||||
uint32 seatID = fields[0].GetUInt32();
|
||||
float orientation = fields[1].GetFloat();
|
||||
float exitX = fields[2].GetFloat();
|
||||
float exitY = fields[3].GetFloat();
|
||||
float exitZ = fields[4].GetFloat();
|
||||
float exitO = fields[5].GetFloat();
|
||||
uint8 exitParam = fields[6].GetUInt8();
|
||||
float seatX = fields[1].GetFloat();
|
||||
float seatY = fields[2].GetFloat();
|
||||
float seatZ = fields[3].GetFloat();
|
||||
float orientation = fields[4].GetFloat();
|
||||
float exitX = fields[5].GetFloat();
|
||||
float exitY = fields[6].GetFloat();
|
||||
float exitZ = fields[7].GetFloat();
|
||||
float exitO = fields[8].GetFloat();
|
||||
uint8 exitParam = fields[9].GetUInt8();
|
||||
|
||||
if (!sVehicleSeatStore.LookupEntry(seatID))
|
||||
{
|
||||
@@ -3142,7 +3145,7 @@ void ObjectMgr::LoadVehicleSeatAddon()
|
||||
continue;
|
||||
}
|
||||
|
||||
_vehicleSeatAddonStore[seatID] = VehicleSeatAddon(orientation, exitX, exitY, exitZ, exitO, exitParam);
|
||||
_vehicleSeatAddonStore[seatID] = VehicleSeatAddon(seatX, seatY, seatZ, orientation, exitX, exitY, exitZ, exitO, exitParam);
|
||||
|
||||
++count;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user