fix: R key resets camera angles only; consume all SpellCastTargets bytes

- CameraController::resetAngles(): new method that only resets yaw/pitch
  without teleporting the player. R key now calls resetAngles() instead
  of reset() so pressing R no longer moves the character to spawn.
  The full reset() (position + angles) is still used on world-entry and
  respawn via application.cpp.

- packet_parsers_classic: parseSpellStart now calls
  skipClassicSpellCastTargets() to consume all target payload bytes
  (UNIT, ITEM, SOURCE_LOCATION, DEST_LOCATION, etc.) instead of only
  handling UNIT/OBJECT. Prevents packet-read corruption for ground-
  targeted AoE spells.

- packet_parsers_tbc: added skipTbcSpellCastTargets() static helper
  (uint32 targetFlags, full payload coverage including TRADE_ITEM and
  STRING targets). parseSpellStart now uses it.
This commit is contained in:
Kelsi 2026-03-17 21:52:45 -07:00
parent a731223e47
commit 32497552d1
4 changed files with 95 additions and 33 deletions

View file

@ -388,10 +388,11 @@ void CameraController::update(float deltaTime) {
if (mounted_) sitting = false;
xKeyWasDown = xDown;
// Reset camera with R key (edge-triggered) — only when UI doesn't want keyboard
// Reset camera angles with R key (edge-triggered) — only when UI doesn't want keyboard
// Does NOT move the player; full reset() is reserved for world-entry/respawn.
bool rDown = !uiWantsKeyboard && input.isKeyPressed(SDL_SCANCODE_R);
if (rDown && !rKeyWasDown) {
reset();
resetAngles();
}
rKeyWasDown = rDown;
@ -1941,6 +1942,14 @@ void CameraController::processMouseButton(const SDL_MouseButtonEvent& event) {
mouseButtonDown = anyDown;
}
void CameraController::resetAngles() {
if (!camera) return;
yaw = defaultYaw;
facingYaw = defaultYaw;
pitch = defaultPitch;
camera->setRotation(yaw, pitch);
}
void CameraController::reset() {
if (!camera) {
return;