mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-04-17 01:23:51 +00:00
Add teleporter panel and server-compatible coordinate conversions
Teleporter panel (T key) lets the player teleport between Goldshire, Stormwind Gate, Ironforge, and Westfall in single-player mode. Adds serverToCanonical/canonicalToServer conversion at the network packet boundary so positions are compatible with TrinityCore/MaNGOS/AzerothCore emulator servers.
This commit is contained in:
parent
6690910712
commit
d8e2becbaa
8 changed files with 258 additions and 43 deletions
|
|
@ -60,6 +60,9 @@ public:
|
|||
// Weapon loading (called at spawn and on equipment change)
|
||||
void loadEquippedWeapons();
|
||||
|
||||
// Teleport to a spawn preset location (single-player only)
|
||||
void teleportTo(int presetIndex);
|
||||
|
||||
// Character skin composite state (saved at spawn for re-compositing on equipment change)
|
||||
const std::string& getBodySkinPath() const { return bodySkinPath_; }
|
||||
const std::vector<std::string>& getUnderwearPaths() const { return underwearPaths_; }
|
||||
|
|
|
|||
|
|
@ -24,6 +24,24 @@ inline constexpr float ZEROPOINT = 32.0f * TILE_SIZE;
|
|||
// Range [0, 34133.333] with center at ZEROPOINT (17066.666).
|
||||
// adtY = height; adtX/adtZ are horizontal.
|
||||
|
||||
// ---- Server / emulator coordinate system ----
|
||||
// WoW emulators (TrinityCore, MaNGOS, AzerothCore, CMaNGOS) send positions
|
||||
// over the wire as (X, Y, Z) where:
|
||||
// server.X = canonical.Y (west axis)
|
||||
// server.Y = canonical.X (north axis)
|
||||
// server.Z = canonical.Z (height)
|
||||
// This is also the byte order inside movement packets on the wire.
|
||||
|
||||
// Convert server/wire coordinates → canonical WoW coordinates.
|
||||
inline glm::vec3 serverToCanonical(const glm::vec3& server) {
|
||||
return glm::vec3(server.y, server.x, server.z);
|
||||
}
|
||||
|
||||
// Convert canonical WoW coordinates → server/wire coordinates.
|
||||
inline glm::vec3 canonicalToServer(const glm::vec3& canonical) {
|
||||
return glm::vec3(canonical.y, canonical.x, canonical.z);
|
||||
}
|
||||
|
||||
// Convert between canonical WoW and engine rendering coordinates (just swap X/Y).
|
||||
inline glm::vec3 canonicalToRender(const glm::vec3& wow) {
|
||||
return glm::vec3(wow.y, wow.x, wow.z);
|
||||
|
|
|
|||
27
include/core/spawn_presets.hpp
Normal file
27
include/core/spawn_presets.hpp
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
#pragma once
|
||||
|
||||
#include <glm/glm.hpp>
|
||||
|
||||
namespace wowee::core {
|
||||
|
||||
struct SpawnPreset {
|
||||
const char* key;
|
||||
const char* label;
|
||||
const char* mapName; // Map name for ADT paths (e.g., "Azeroth")
|
||||
glm::vec3 spawnCanonical; // Canonical WoW coords: +X=North, +Y=West, +Z=Up
|
||||
float yawDeg;
|
||||
float pitchDeg;
|
||||
};
|
||||
|
||||
// Spawn positions in canonical WoW world coordinates (X=north, Y=west, Z=up).
|
||||
// Tile is computed from position via: tileN = floor(32 - wowN / 533.33333)
|
||||
inline const SpawnPreset SPAWN_PRESETS[] = {
|
||||
{"goldshire", "Goldshire", "Azeroth", glm::vec3( 62.0f, -9464.0f, 200.0f), 0.0f, -5.0f},
|
||||
{"stormwind", "Stormwind Gate", "Azeroth", glm::vec3( 425.0f, -9176.0f, 120.0f), 35.0f, -8.0f},
|
||||
{"ironforge", "Ironforge", "Azeroth", glm::vec3( -882.0f, -4981.0f, 510.0f), -20.0f, -8.0f},
|
||||
{"westfall", "Westfall", "Azeroth", glm::vec3( 1215.0f,-10440.0f, 80.0f), 10.0f, -8.0f},
|
||||
};
|
||||
|
||||
inline constexpr int SPAWN_PRESET_COUNT = 4;
|
||||
|
||||
} // namespace wowee::core
|
||||
|
|
@ -29,6 +29,16 @@ public:
|
|||
*/
|
||||
bool isChatInputActive() const { return chatInputActive; }
|
||||
|
||||
/**
|
||||
* Toggle the teleporter panel
|
||||
*/
|
||||
void toggleTeleporter() { showTeleporter = !showTeleporter; }
|
||||
|
||||
/**
|
||||
* Check if teleporter panel is open
|
||||
*/
|
||||
bool isTeleporterOpen() const { return showTeleporter; }
|
||||
|
||||
private:
|
||||
// Chat state
|
||||
char chatInputBuffer[512] = "";
|
||||
|
|
@ -40,6 +50,7 @@ private:
|
|||
bool showChatWindow = true;
|
||||
bool showPlayerInfo = false;
|
||||
bool refocusChatInput = false;
|
||||
bool showTeleporter = false;
|
||||
|
||||
/**
|
||||
* Render player info window
|
||||
|
|
@ -106,6 +117,7 @@ private:
|
|||
void renderLootWindow(game::GameHandler& gameHandler);
|
||||
void renderGossipWindow(game::GameHandler& gameHandler);
|
||||
void renderVendorWindow(game::GameHandler& gameHandler);
|
||||
void renderTeleporterPanel();
|
||||
|
||||
/**
|
||||
* Inventory screen
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue