mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-03-22 23:30:14 +00:00
feat: show zone entry text on every zone crossing via SMSG_INIT_WORLD_STATES
Previously the "Entering: [Zone]" overlay only triggered when the terrain renderer loaded a new map. Now it also fires whenever worldStateZoneId_ changes (sent by the server via SMSG_INIT_WORLD_STATES on each zone crossing), giving correct "Entering: Ironforge", "Entering: Wailing Caverns" etc. display for sub-zones and dungeon entries without requiring a full map reload. - Added lastKnownWorldStateZoneId_ to track server-reported zone changes - renderZoneText() now takes GameHandler& to access getWorldStateZoneId() and getWhoAreaName() for name lookup via WorldMapArea.dbc cache - Renderer zone name still checked as a fallback for map-level transitions - Both sources de-duplicate to avoid triggering the same text twice
This commit is contained in:
parent
4a439fb0d1
commit
f9947300da
2 changed files with 23 additions and 6 deletions
|
|
@ -634,7 +634,8 @@ private:
|
|||
float zoneTextTimer_ = 0.0f;
|
||||
std::string zoneTextName_;
|
||||
std::string lastKnownZoneName_;
|
||||
void renderZoneText();
|
||||
uint32_t lastKnownWorldStateZoneId_ = 0;
|
||||
void renderZoneText(game::GameHandler& gameHandler);
|
||||
void renderWeatherOverlay(game::GameHandler& gameHandler);
|
||||
|
||||
// Cooldown tracker
|
||||
|
|
|
|||
|
|
@ -744,7 +744,7 @@ void GameScreen::render(game::GameHandler& gameHandler) {
|
|||
renderPvpHonorToasts();
|
||||
renderItemLootToasts();
|
||||
renderResurrectFlash();
|
||||
renderZoneText();
|
||||
renderZoneText(gameHandler);
|
||||
renderWeatherOverlay(gameHandler);
|
||||
|
||||
// World map (M key toggle handled inside)
|
||||
|
|
@ -20496,15 +20496,31 @@ void GameScreen::renderWhisperToasts() {
|
|||
// Zone discovery text — "Entering: <ZoneName>" fades in/out at screen centre
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
void GameScreen::renderZoneText() {
|
||||
// Poll the renderer for zone name changes
|
||||
void GameScreen::renderZoneText(game::GameHandler& gameHandler) {
|
||||
// Poll worldStateZoneId for server-driven zone changes (fires on every zone crossing,
|
||||
// including sub-zones like Ironforge within Dun Morogh).
|
||||
uint32_t wsZoneId = gameHandler.getWorldStateZoneId();
|
||||
if (wsZoneId != 0 && wsZoneId != lastKnownWorldStateZoneId_) {
|
||||
lastKnownWorldStateZoneId_ = wsZoneId;
|
||||
std::string wsName = gameHandler.getWhoAreaName(wsZoneId);
|
||||
if (!wsName.empty()) {
|
||||
zoneTextName_ = wsName;
|
||||
zoneTextTimer_ = ZONE_TEXT_DURATION;
|
||||
}
|
||||
}
|
||||
|
||||
// Also poll the renderer for zone name changes (covers map-level transitions
|
||||
// where worldStateZoneId may not change immediately).
|
||||
auto* appRenderer = core::Application::getInstance().getRenderer();
|
||||
if (appRenderer) {
|
||||
const std::string& zoneName = appRenderer->getCurrentZoneName();
|
||||
if (!zoneName.empty() && zoneName != lastKnownZoneName_) {
|
||||
lastKnownZoneName_ = zoneName;
|
||||
zoneTextName_ = zoneName;
|
||||
zoneTextTimer_ = ZONE_TEXT_DURATION;
|
||||
// Only override if the worldState hasn't already queued this zone
|
||||
if (zoneTextName_ != zoneName) {
|
||||
zoneTextName_ = zoneName;
|
||||
zoneTextTimer_ = ZONE_TEXT_DURATION;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue