physics: send MSG_MOVE_START/STOP_ASCEND and START_DESCEND during flight

When flyingActive_, detect Space/X key transitions and emit proper flight
vertical movement opcodes so the server (and other players) see the
correct ascending/descending animation state:

- MSG_MOVE_START_ASCEND  (Space pressed while flying)  → sets ASCENDING flag
- MSG_MOVE_STOP_ASCEND   (Space released while flying) → clears ASCENDING flag
- MSG_MOVE_START_DESCEND (X pressed while flying)      → clears ASCENDING flag
- MSG_MOVE_STOP_ASCEND   (X released while flying)     → clears vertical state

Track wasAscending_/wasDescending_ member state to detect transitions.
Also clear lingering vertical state when leaving flight mode.
This commit is contained in:
Kelsi 2026-03-10 14:32:30 -07:00
parent a9ddfe70c2
commit 132598fc88
3 changed files with 43 additions and 0 deletions

View file

@ -7329,6 +7329,17 @@ void GameHandler::sendMovement(Opcode opcode) {
case Opcode::MSG_MOVE_HEARTBEAT:
// No flag changes — just sends current position
break;
case Opcode::MSG_MOVE_START_ASCEND:
movementInfo.flags |= static_cast<uint32_t>(MovementFlags::ASCENDING);
break;
case Opcode::MSG_MOVE_STOP_ASCEND:
// Clears ascending (and descending) — one stop opcode for both directions
movementInfo.flags &= ~static_cast<uint32_t>(MovementFlags::ASCENDING);
break;
case Opcode::MSG_MOVE_START_DESCEND:
// Descending: no separate flag; clear ASCENDING so they don't conflict
movementInfo.flags &= ~static_cast<uint32_t>(MovementFlags::ASCENDING);
break;
default:
break;
}