terrain: pre-load bind point tiles during Hearthstone cast

When the player starts casting Hearthstone (spell IDs 6948/8690),
trigger background terrain loading at the bind point so tiles are
ready when the teleport fires.

- Add HearthstonePreloadCallback to GameHandler, called from
  handleSpellStart when a Hearthstone cast begins.
- Application callback enqueues a 5×5 tile grid around the bind
  point via precacheTiles() (same-map) or starts a file-cache warm
  via startWorldPreload() (cross-map) during the ~10 s cast time.
- On same-map teleport arrival, call processAllReadyTiles() to
  GPU-upload any tiles that finished parsing during the cast before
  the first frame at the new position.

Fixes: player landing in unloaded terrain and falling after Hearthstone.
This commit is contained in:
Kelsi 2026-03-09 21:57:42 -07:00
parent 0a6f88e8ad
commit 8f0d2cc4ab
3 changed files with 64 additions and 0 deletions

View file

@ -12430,6 +12430,14 @@ void GameHandler::handleSpellStart(network::Packet& packet) {
ssm->playPrecast(school, audio::SpellSoundManager::SpellPower::MEDIUM);
}
}
// Hearthstone cast: begin pre-loading terrain at bind point during cast time
// so tiles are ready when the teleport fires (avoids falling through un-loaded terrain).
// Spell IDs: 6948 = Vanilla Hearthstone (rank 1), 8690 = TBC/WotLK Hearthstone
const bool isHearthstone = (data.spellId == 6948 || data.spellId == 8690);
if (isHearthstone && hasHomeBind_ && hearthstonePreloadCallback_) {
hearthstonePreloadCallback_(homeBindMapId_, homeBindPos_.x, homeBindPos_.y, homeBindPos_.z);
}
}
}