mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-04-16 01:03:51 +00:00
refactor(core): decompose Application::setupUICallbacks() into 7 domain handlers
Extract ~1,700 lines / 60+ inline [this]-capturing lambdas from the monolithic
Application::setupUICallbacks() into 7 focused callback handler classes following
the ToastManager/ChatPanel::setupCallbacks() pattern already in the codebase.
New handlers (include/core/ + src/core/):
- NPCInteractionCallbackHandler NPC greeting/farewell/vendor/aggro voice
- AudioCallbackHandler Music, positional sound, level-up, achievement, LFG
- EntitySpawnCallbackHandler Creature/player/GO spawn, despawn, move, state
- AnimationCallbackHandler Death, respawn, combat, emotes, charge, sprint, vehicle
- TransportCallbackHandler Mount, taxi, transport spawn/move
- WorldEntryCallbackHandler World entry, unstuck, hearthstone, bind point
- UIScreenCallbackHandler Auth, realm selection, char selection/creation/deletion
application.cpp: 4,462 → 2,791 lines (−1,671)
setupUICallbacks: ~1,700 → ~50 lines (thin orchestrator)
Deduplication:
resolveSoundEntryPath() — was 3× copy-paste of SoundEntries.dbc lookup
resolveNpcVoiceType() — was 4× copy-paste of display-ID→voice detection
precacheNearbyTiles() — was 3× copy-paste of 17×17 tile loop
4 helper lambdas — promoted to private methods on WorldEntryCallbackHandler
State migration out of Application:
charge* (6 vars) → AnimationCallbackHandler
hearth*/worldEntry*/taxi* → WorldEntryCallbackHandler
pendingCreatedCharacterName_ → UIScreenCallbackHandler
Bug fixes:
- Duplicate `namespace core {` in application.hpp caused wowee::std pollution
- AppState forward decl in ui_screen_callback_handler.hpp was at wrong scope
- world_loader.cpp accessed moved member vars directly via friend; now uses handler API
This commit is contained in:
parent
a23c2172a8
commit
6dcc06697b
18 changed files with 2293 additions and 1765 deletions
|
|
@ -3,6 +3,7 @@
|
|||
|
||||
#include "core/world_loader.hpp"
|
||||
#include "core/application.hpp"
|
||||
#include "core/world_entry_callback_handler.hpp"
|
||||
#include "rendering/animation/animation_ids.hpp"
|
||||
#include "core/entity_spawner.hpp"
|
||||
#include "core/appearance_composer.hpp"
|
||||
|
|
@ -173,9 +174,11 @@ void WorldLoader::processPendingEntry() {
|
|||
auto entry = *pendingWorldEntry_;
|
||||
pendingWorldEntry_.reset();
|
||||
LOG_WARNING("Processing deferred world entry: map ", entry.mapId);
|
||||
app_.worldEntryMovementGraceTimer_ = 2.0f;
|
||||
app_.taxiLandingClampTimer_ = 0.0f;
|
||||
app_.lastTaxiFlight_ = false;
|
||||
if (app_.worldEntryCallbacks_) {
|
||||
app_.worldEntryCallbacks_->setWorldEntryMovementGraceTimer(2.0f);
|
||||
app_.worldEntryCallbacks_->setTaxiLandingClampTimer(0.0f);
|
||||
app_.worldEntryCallbacks_->setLastTaxiFlight(false);
|
||||
}
|
||||
// Clear camera movement inputs before loading terrain
|
||||
if (renderer_ && renderer_->getCameraController()) {
|
||||
renderer_->getCameraController()->clearMovementInputs();
|
||||
|
|
@ -1075,9 +1078,11 @@ void WorldLoader::loadOnlineWorldTerrain(uint32_t mapId, float x, float y, float
|
|||
auto entry = *pendingWorldEntry_;
|
||||
pendingWorldEntry_.reset();
|
||||
LOG_WARNING("Processing deferred world entry: map ", entry.mapId);
|
||||
app_.worldEntryMovementGraceTimer_ = 2.0f;
|
||||
app_.taxiLandingClampTimer_ = 0.0f;
|
||||
app_.lastTaxiFlight_ = false;
|
||||
if (app_.worldEntryCallbacks_) {
|
||||
app_.worldEntryCallbacks_->setWorldEntryMovementGraceTimer(2.0f);
|
||||
app_.worldEntryCallbacks_->setTaxiLandingClampTimer(0.0f);
|
||||
app_.worldEntryCallbacks_->setLastTaxiFlight(false);
|
||||
}
|
||||
// Recursive call — sets loadedMapId_ and IN_GAME state for the final map.
|
||||
loadOnlineWorldTerrain(entry.mapId, entry.x, entry.y, entry.z);
|
||||
return; // The recursive call handles setState(IN_GAME).
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue