mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-05-03 00:03:50 +00:00
Fix Turtle/Classic parsing and online player textures
This commit is contained in:
parent
010243bbd9
commit
bcfc075e1e
13 changed files with 518 additions and 27 deletions
|
|
@ -90,6 +90,13 @@ private:
|
|||
void buildFactionHostilityMap(uint8_t playerRace);
|
||||
void spawnOnlineCreature(uint64_t guid, uint32_t displayId, float x, float y, float z, float orientation);
|
||||
void despawnOnlineCreature(uint64_t guid);
|
||||
void spawnOnlinePlayer(uint64_t guid,
|
||||
uint8_t raceId,
|
||||
uint8_t genderId,
|
||||
uint32_t appearanceBytes,
|
||||
uint8_t facialFeatures,
|
||||
float x, float y, float z, float orientation);
|
||||
void despawnOnlinePlayer(uint64_t guid);
|
||||
void buildCreatureDisplayLookups();
|
||||
std::string getModelPathForDisplayId(uint32_t displayId) const;
|
||||
void spawnOnlineGameObject(uint64_t guid, uint32_t entry, uint32_t displayId, float x, float y, float z, float orientation);
|
||||
|
|
@ -218,6 +225,25 @@ private:
|
|||
std::unordered_set<uint64_t> pendingCreatureSpawnGuids_;
|
||||
std::unordered_map<uint64_t, uint16_t> creatureSpawnRetryCounts_;
|
||||
std::unordered_set<uint32_t> nonRenderableCreatureDisplayIds_;
|
||||
|
||||
// Online player instances (separate from creatures so we can apply per-player skin/hair textures).
|
||||
std::unordered_map<uint64_t, uint32_t> playerInstances_; // guid → render instanceId
|
||||
// Cache base player model geometry by (raceId, genderId)
|
||||
std::unordered_map<uint32_t, uint32_t> playerModelCache_; // key=(race<<8)|gender → modelId
|
||||
struct PlayerTextureSlots { int skin = -1; int hair = -1; int underwear = -1; };
|
||||
std::unordered_map<uint32_t, PlayerTextureSlots> playerTextureSlotsByModelId_;
|
||||
uint32_t nextPlayerModelId_ = 60000;
|
||||
struct PendingPlayerSpawn {
|
||||
uint64_t guid;
|
||||
uint8_t raceId;
|
||||
uint8_t genderId;
|
||||
uint32_t appearanceBytes;
|
||||
uint8_t facialFeatures;
|
||||
float x, y, z, orientation;
|
||||
};
|
||||
std::vector<PendingPlayerSpawn> pendingPlayerSpawns_;
|
||||
std::unordered_set<uint64_t> pendingPlayerSpawnGuids_;
|
||||
void processPlayerSpawnQueue();
|
||||
std::unordered_set<uint64_t> creaturePermanentFailureGuids_;
|
||||
void processCreatureSpawnQueue();
|
||||
|
||||
|
|
|
|||
|
|
@ -480,6 +480,20 @@ public:
|
|||
using CreatureDespawnCallback = std::function<void(uint64_t guid)>;
|
||||
void setCreatureDespawnCallback(CreatureDespawnCallback cb) { creatureDespawnCallback_ = std::move(cb); }
|
||||
|
||||
// Player spawn callback (online mode - triggered when a player enters view).
|
||||
// Players need appearance data so the renderer can build the right body/hair textures.
|
||||
using PlayerSpawnCallback = std::function<void(uint64_t guid,
|
||||
uint32_t displayId,
|
||||
uint8_t raceId,
|
||||
uint8_t genderId,
|
||||
uint32_t appearanceBytes,
|
||||
uint8_t facialFeatures,
|
||||
float x, float y, float z, float orientation)>;
|
||||
void setPlayerSpawnCallback(PlayerSpawnCallback cb) { playerSpawnCallback_ = std::move(cb); }
|
||||
|
||||
using PlayerDespawnCallback = std::function<void(uint64_t guid)>;
|
||||
void setPlayerDespawnCallback(PlayerDespawnCallback cb) { playerDespawnCallback_ = std::move(cb); }
|
||||
|
||||
// GameObject spawn callback (online mode - triggered when gameobject enters view)
|
||||
// Parameters: guid, entry, displayId, x, y, z (canonical), orientation
|
||||
using GameObjectSpawnCallback = std::function<void(uint64_t guid, uint32_t entry, uint32_t displayId, float x, float y, float z, float orientation)>;
|
||||
|
|
@ -1065,6 +1079,8 @@ private:
|
|||
BindPointCallback bindPointCallback_;
|
||||
CreatureSpawnCallback creatureSpawnCallback_;
|
||||
CreatureDespawnCallback creatureDespawnCallback_;
|
||||
PlayerSpawnCallback playerSpawnCallback_;
|
||||
PlayerDespawnCallback playerDespawnCallback_;
|
||||
CreatureMoveCallback creatureMoveCallback_;
|
||||
TransportMoveCallback transportMoveCallback_;
|
||||
TransportSpawnCallback transportSpawnCallback_;
|
||||
|
|
|
|||
|
|
@ -22,6 +22,10 @@ class PacketParsers {
|
|||
public:
|
||||
virtual ~PacketParsers() = default;
|
||||
|
||||
// Size of MovementInfo.flags2 in bytes for MSG_MOVE_* payloads.
|
||||
// Classic: none, TBC: u8, WotLK: u16.
|
||||
virtual uint8_t movementFlags2Size() const { return 2; }
|
||||
|
||||
// --- Movement ---
|
||||
|
||||
/** Parse movement block from SMSG_UPDATE_OBJECT */
|
||||
|
|
@ -145,6 +149,7 @@ class WotlkPacketParsers : public PacketParsers {
|
|||
*/
|
||||
class TbcPacketParsers : public PacketParsers {
|
||||
public:
|
||||
uint8_t movementFlags2Size() const override { return 1; }
|
||||
bool parseMovementBlock(network::Packet& packet, UpdateBlock& block) override;
|
||||
void writeMovementPayload(network::Packet& packet, const MovementInfo& info) override;
|
||||
network::Packet buildMovementPacket(LogicalOpcode opcode,
|
||||
|
|
@ -171,6 +176,7 @@ public:
|
|||
*/
|
||||
class ClassicPacketParsers : public TbcPacketParsers {
|
||||
public:
|
||||
uint8_t movementFlags2Size() const override { return 0; }
|
||||
bool parseCharEnum(network::Packet& packet, CharEnumResponse& response) override;
|
||||
bool parseMovementBlock(network::Packet& packet, UpdateBlock& block) override;
|
||||
void writeMovementPayload(network::Packet& packet, const MovementInfo& info) override;
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@ enum class UF : uint16_t {
|
|||
// Unit fields
|
||||
UNIT_FIELD_TARGET_LO,
|
||||
UNIT_FIELD_TARGET_HI,
|
||||
UNIT_FIELD_BYTES_0,
|
||||
UNIT_FIELD_HEALTH,
|
||||
UNIT_FIELD_POWER1,
|
||||
UNIT_FIELD_MAXHEALTH,
|
||||
|
|
@ -34,6 +35,8 @@ enum class UF : uint16_t {
|
|||
|
||||
// Player fields
|
||||
PLAYER_FLAGS,
|
||||
PLAYER_BYTES,
|
||||
PLAYER_BYTES_2,
|
||||
PLAYER_XP,
|
||||
PLAYER_NEXT_LEVEL_XP,
|
||||
PLAYER_FIELD_COINAGE,
|
||||
|
|
|
|||
|
|
@ -66,6 +66,8 @@ public:
|
|||
const pipeline::M2Model* getModelData(uint32_t modelId) const;
|
||||
void setActiveGeosets(uint32_t instanceId, const std::unordered_set<uint16_t>& geosets);
|
||||
void setGroupTextureOverride(uint32_t instanceId, uint16_t geosetGroup, GLuint textureId);
|
||||
void setTextureSlotOverride(uint32_t instanceId, uint16_t textureSlot, GLuint textureId);
|
||||
void clearTextureSlotOverride(uint32_t instanceId, uint16_t textureSlot);
|
||||
void setInstanceVisible(uint32_t instanceId, bool visible);
|
||||
void removeInstance(uint32_t instanceId);
|
||||
bool getAnimationState(uint32_t instanceId, uint32_t& animationId, float& animationTimeMs, float& animationDurationMs) const;
|
||||
|
|
@ -151,6 +153,9 @@ private:
|
|||
// Per-geoset-group texture overrides (group → GL texture ID)
|
||||
std::unordered_map<uint16_t, GLuint> groupTextureOverrides;
|
||||
|
||||
// Per-texture-slot overrides (slot → GL texture ID)
|
||||
std::unordered_map<uint16_t, GLuint> textureSlotOverrides;
|
||||
|
||||
// Weapon attachments (weapons parented to this instance's bones)
|
||||
std::vector<WeaponAttachment> weaponAttachments;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue