Fix NPC visibility and stabilize world transport/taxi updates

This commit is contained in:
Kelsi 2026-02-11 18:25:04 -08:00
parent 6ff27e789b
commit b0af2c928d
16 changed files with 452 additions and 173 deletions

View file

@ -1,6 +1,9 @@
#pragma once
#include <string>
#include <cstdint>
#include <unordered_map>
#include <vector>
namespace wowee {
namespace pipeline { class AssetManager; }
@ -23,6 +26,7 @@ public:
void setVolume(int volume);
int getVolume() const { return volumePercent; }
void setUnderwaterMode(bool underwater);
void preloadMusic(const std::string& mpqPath);
bool isPlaying() const { return playing; }
bool isInitialized() const { return assetManager != nullptr; }
@ -41,6 +45,8 @@ private:
std::string pendingTrack;
float fadeTimer = 0.0f;
float fadeDuration = 0.0f;
std::unordered_map<std::string, std::vector<uint8_t>> musicDataCache_;
};
} // namespace audio

View file

@ -7,6 +7,7 @@
#include <string>
#include <vector>
#include <unordered_map>
#include <unordered_set>
namespace wowee {
@ -192,7 +193,12 @@ private:
float x, y, z, orientation;
};
std::vector<PendingCreatureSpawn> pendingCreatureSpawns_;
static constexpr int MAX_SPAWNS_PER_FRAME = 2;
static constexpr int MAX_SPAWNS_PER_FRAME = 24;
static constexpr uint16_t MAX_CREATURE_SPAWN_RETRIES = 300;
std::unordered_set<uint64_t> pendingCreatureSpawnGuids_;
std::unordered_map<uint64_t, uint16_t> creatureSpawnRetryCounts_;
std::unordered_set<uint32_t> nonRenderableCreatureDisplayIds_;
std::unordered_set<uint64_t> creaturePermanentFailureGuids_;
void processCreatureSpawnQueue();
struct PendingGameObjectSpawn {

View file

@ -427,6 +427,8 @@ public:
uint32_t getPlayerXp() const { return playerXp_; }
uint32_t getPlayerNextLevelXp() const { return playerNextLevelXp_; }
uint32_t getPlayerLevel() const { return serverPlayerLevel_; }
const std::vector<uint32_t>& getPlayerExploredZoneMasks() const { return playerExploredZones_; }
bool hasPlayerExploredZoneMasks() const { return hasPlayerExploredZones_; }
static uint32_t killXp(uint32_t playerLevel, uint32_t victimLevel);
// Server time (for deterministic moon phases, etc.)
@ -1085,11 +1087,8 @@ private:
float taxiLandingCooldown_ = 0.0f; // Prevent re-entering taxi right after landing
size_t taxiClientIndex_ = 0;
std::vector<glm::vec3> taxiClientPath_;
float taxiClientSpeed_ = 18.0f; // Reduced from 32 to prevent loading hitches
float taxiClientSpeed_ = 32.0f;
float taxiClientSegmentProgress_ = 0.0f;
bool taxiMountingDelay_ = false; // Delay before flight starts (terrain precache time)
float taxiMountingTimer_ = 0.0f;
std::vector<uint32_t> taxiPendingPath_; // Path nodes waiting for mounting delay
bool taxiRecoverPending_ = false;
uint32_t taxiRecoverMapId_ = 0;
glm::vec3 taxiRecoverPos_{0.0f};
@ -1144,9 +1143,15 @@ private:
std::unordered_map<uint32_t, uint32_t> spellToSkillLine_; // spellID -> skillLineID
bool skillLineDbcLoaded_ = false;
bool skillLineAbilityLoaded_ = false;
static constexpr uint16_t PLAYER_EXPLORED_ZONES_START = 1041; // 3.3.5a UpdateFields
static constexpr size_t PLAYER_EXPLORED_ZONES_COUNT = 128;
std::vector<uint32_t> playerExploredZones_ =
std::vector<uint32_t>(PLAYER_EXPLORED_ZONES_COUNT, 0u);
bool hasPlayerExploredZones_ = false;
void loadSkillLineDbc();
void loadSkillLineAbilityDbc();
void extractSkillFields(const std::map<uint16_t, uint32_t>& fields);
void extractExploredZoneFields(const std::map<uint16_t, uint32_t>& fields);
NpcDeathCallback npcDeathCallback_;
NpcAggroCallback npcAggroCallback_;

View file

@ -21,6 +21,7 @@ public:
uint32_t getZoneId(int tileX, int tileY) const;
const ZoneInfo* getZoneInfo(uint32_t zoneId) const;
std::string getRandomMusic(uint32_t zoneId) const;
std::vector<std::string> getAllMusicPaths() const;
private:
// tile key = tileX * 100 + tileY

View file

@ -323,6 +323,9 @@ private:
float mountHeightOffset_ = 0.0f;
float mountPitch_ = 0.0f; // Up/down tilt (radians)
float mountRoll_ = 0.0f; // Left/right banking (radians)
int mountSeatAttachmentId_ = -1; // -1 unknown, -2 unavailable
glm::vec3 smoothedMountSeatPos_ = glm::vec3(0.0f);
bool mountSeatSmoothingInit_ = false;
float prevMountYaw_ = 0.0f; // Previous yaw for turn rate calculation (procedural lean)
float lastDeltaTime_ = 0.0f; // Cached for use in updateCharacterAnimation()
MountAction mountAction_ = MountAction::None; // Current mount action (jump/rear-up)

View file

@ -20,6 +20,7 @@ struct WorldMapZone {
float locLeft = 0, locRight = 0, locTop = 0, locBottom = 0;
uint32_t displayMapID = 0;
uint32_t parentWorldMapID = 0;
uint32_t exploreFlag = 0;
// Per-zone cached textures
GLuint tileTextures[12] = {};
@ -34,6 +35,7 @@ public:
void initialize(pipeline::AssetManager* assetManager);
void render(const glm::vec3& playerRenderPos, int screenWidth, int screenHeight);
void setMapName(const std::string& name);
void setServerExplorationMask(const std::vector<uint32_t>& masks, bool hasData);
bool isOpen() const { return open; }
void close() { open = false; }
@ -87,6 +89,8 @@ private:
GLuint tileQuadVBO = 0;
// Exploration / fog of war
std::vector<uint32_t> serverExplorationMask;
bool hasServerExplorationMask = false;
std::unordered_set<int> exploredZones; // zone indices the player has visited
};