mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-05-03 08:03:50 +00:00
fix: cancel timed cast immediately on movement start
When the player starts moving (forward/backward/strafe/jump) while a timed non-channeled cast is in progress, call cancelCast() before sending the movement packet. Previously the cast bar kept counting down until the server sent SMSG_SPELL_FAILED, causing a visible lag. Channeled spells are excluded (server ends those via MSG_CHANNEL_UPDATE). Turning opcodes are excluded (turning while casting is allowed in WoW).
This commit is contained in:
parent
4907f4124b
commit
60d5edf97f
1 changed files with 15 additions and 0 deletions
|
|
@ -10706,6 +10706,21 @@ void GameHandler::sendMovement(Opcode opcode) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Cancel any timed (non-channeled) cast the moment the player starts moving.
|
||||||
|
// Channeled spells end via MSG_CHANNEL_UPDATE / SMSG_CHANNEL_NOTIFY from the server.
|
||||||
|
// Turning (MSG_MOVE_START_TURN_*) is allowed while casting.
|
||||||
|
if (casting && !castIsChannel) {
|
||||||
|
const bool isPositionalMove =
|
||||||
|
opcode == Opcode::MSG_MOVE_START_FORWARD ||
|
||||||
|
opcode == Opcode::MSG_MOVE_START_BACKWARD ||
|
||||||
|
opcode == Opcode::MSG_MOVE_START_STRAFE_LEFT ||
|
||||||
|
opcode == Opcode::MSG_MOVE_START_STRAFE_RIGHT ||
|
||||||
|
opcode == Opcode::MSG_MOVE_JUMP;
|
||||||
|
if (isPositionalMove) {
|
||||||
|
cancelCast();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Update movement flags based on opcode
|
// Update movement flags based on opcode
|
||||||
switch (opcode) {
|
switch (opcode) {
|
||||||
case Opcode::MSG_MOVE_START_FORWARD:
|
case Opcode::MSG_MOVE_START_FORWARD:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue