mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-03-22 23:30:14 +00:00
Add transport registration to movement packets (WIP - awaiting server MOVEMENT updates)
- Added transport fields to MovementInfo struct (transportGuid, transportX/Y/Z/O, transportTime) - Updated MovementPacket::build() to serialize transport data when ONTRANSPORT flag set - Modified GameHandler::sendMovement() to include transport info when player on transport - Fixed coordinate conversion for transport offsets (server↔canonical) - Added transport tracking in both CREATE_OBJECT and MOVEMENT update handlers - Connected M2Renderer to WMORenderer for hierarchical doodad transforms - Server-authoritative transport movement (no client-side animation) Issue: Server not sending MOVEMENT updates for transports, so they remain stationary. Transports register successfully but don't animate without server position updates.
This commit is contained in:
parent
f3f3b62880
commit
55a40fc3aa
8 changed files with 425 additions and 60 deletions
|
|
@ -27,6 +27,7 @@ struct TransportPath {
|
|||
std::vector<TimedPoint> points; // Time-indexed waypoints (includes duplicate first point at end for wrap)
|
||||
bool looping; // Set to false after adding explicit wrap point
|
||||
uint32_t durationMs; // Total loop duration in ms (includes wrap segment if added)
|
||||
bool zOnly; // True if path only has Z movement (elevator/bobbing), false if real XY travel
|
||||
};
|
||||
|
||||
struct ActiveTransport {
|
||||
|
|
@ -100,7 +101,7 @@ private:
|
|||
std::unordered_map<uint64_t, ActiveTransport> transports_;
|
||||
std::unordered_map<uint32_t, TransportPath> paths_; // Indexed by transportEntry (pathId from TransportAnimation.dbc)
|
||||
rendering::WMORenderer* wmoRenderer_ = nullptr;
|
||||
bool clientSideAnimation_ = true; // Enable client animation - smooth movement, synced with server updates
|
||||
bool clientSideAnimation_ = false; // DISABLED - use server positions instead of client prediction
|
||||
float elapsedTime_ = 0.0f; // Total elapsed time (seconds)
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -411,6 +411,14 @@ struct MovementInfo {
|
|||
float jumpCosAngle = 0.0f; // Jump horizontal cos
|
||||
float jumpXYSpeed = 0.0f; // Jump horizontal speed
|
||||
|
||||
// Transport fields (when ONTRANSPORT flag is set)
|
||||
uint64_t transportGuid = 0; // GUID of transport (boat/zeppelin/etc)
|
||||
float transportX = 0.0f; // Local position on transport
|
||||
float transportY = 0.0f;
|
||||
float transportZ = 0.0f;
|
||||
float transportO = 0.0f; // Local orientation on transport
|
||||
uint32_t transportTime = 0; // Transport movement timestamp
|
||||
|
||||
bool hasFlag(MovementFlags flag) const {
|
||||
return (flags & static_cast<uint32_t>(flag)) != 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ namespace rendering {
|
|||
class Camera;
|
||||
class Shader;
|
||||
class Frustum;
|
||||
class M2Renderer;
|
||||
|
||||
/**
|
||||
* WMO (World Model Object) Renderer
|
||||
|
|
@ -49,6 +50,11 @@ public:
|
|||
*/
|
||||
void shutdown();
|
||||
|
||||
/**
|
||||
* Set M2 renderer for hierarchical transform updates (doodads follow parent WMO)
|
||||
*/
|
||||
void setM2Renderer(M2Renderer* renderer) { m2Renderer_ = renderer; }
|
||||
|
||||
/**
|
||||
* Load WMO model and create GPU resources
|
||||
* @param model WMO model with geometry data
|
||||
|
|
@ -89,6 +95,27 @@ public:
|
|||
*/
|
||||
void setInstanceTransform(uint32_t instanceId, const glm::mat4& transform);
|
||||
|
||||
/**
|
||||
* Add doodad (child M2) to WMO instance
|
||||
* @param instanceId WMO instance to add doodad to
|
||||
* @param m2InstanceId M2 instance ID of the doodad
|
||||
* @param localTransform Local transform relative to WMO origin
|
||||
*/
|
||||
void addDoodadToInstance(uint32_t instanceId, uint32_t m2InstanceId, const glm::mat4& localTransform);
|
||||
|
||||
// Forward declare DoodadTemplate for public API
|
||||
struct DoodadTemplate {
|
||||
std::string m2Path;
|
||||
glm::mat4 localTransform;
|
||||
};
|
||||
|
||||
/**
|
||||
* Get doodad templates for a WMO model
|
||||
* @param modelId WMO model ID
|
||||
* @return Vector of doodad templates (empty if no doodads or model not found)
|
||||
*/
|
||||
const std::vector<DoodadTemplate>* getDoodadTemplates(uint32_t modelId) const;
|
||||
|
||||
/**
|
||||
* Remove WMO instance
|
||||
* @param instanceId Instance to remove
|
||||
|
|
@ -363,6 +390,10 @@ private:
|
|||
glm::vec3 boundingBoxMax;
|
||||
bool isLowPlatform = false;
|
||||
|
||||
// Doodad templates (M2 models placed in WMO, stored for instancing)
|
||||
// Uses the public DoodadTemplate struct defined above
|
||||
std::vector<DoodadTemplate> doodadTemplates;
|
||||
|
||||
// Texture handles for this model (indexed by texture path order)
|
||||
std::vector<GLuint> textures;
|
||||
|
||||
|
|
@ -510,6 +541,9 @@ private:
|
|||
// Asset manager for loading textures
|
||||
pipeline::AssetManager* assetManager = nullptr;
|
||||
|
||||
// M2 renderer for hierarchical transforms (doodads following WMO parent)
|
||||
M2Renderer* m2Renderer_ = nullptr;
|
||||
|
||||
// Current map name for zone-specific floor cache
|
||||
std::string mapName_;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue