Add mount system and crash mouse-release handler

Render mount M2 model under player with seated animation, apply creature
skin textures, server-driven speed via SMSG_FORCE_RUN_SPEED_CHANGE, and
/dismount command. X11 XUngrabPointer on crash/hang to always release mouse.
This commit is contained in:
Kelsi 2026-02-07 17:59:40 -08:00
parent 4a932dd8cd
commit 643611ee79
13 changed files with 363 additions and 3 deletions

View file

@ -1,8 +1,33 @@
#include "core/application.hpp"
#include "core/logger.hpp"
#include <exception>
#include <csignal>
#include <SDL2/SDL.h>
#include <X11/Xlib.h>
static void releaseMouseGrab() {
// Bypass SDL — talk to X11 directly (signal-safe enough for our purposes)
Display* dpy = XOpenDisplay(nullptr);
if (dpy) {
XUngrabPointer(dpy, CurrentTime);
XUngrabKeyboard(dpy, CurrentTime);
XFlush(dpy);
XCloseDisplay(dpy);
}
}
static void crashHandler(int sig) {
releaseMouseGrab();
std::signal(sig, SIG_DFL);
std::raise(sig);
}
int main([[maybe_unused]] int argc, [[maybe_unused]] char* argv[]) {
std::signal(SIGSEGV, crashHandler);
std::signal(SIGABRT, crashHandler);
std::signal(SIGFPE, crashHandler);
std::signal(SIGTERM, crashHandler);
std::signal(SIGINT, crashHandler);
try {
wowee::core::Logger::getInstance().setLogLevel(wowee::core::LogLevel::DEBUG);
LOG_INFO("=== Wowee Native Client ===");
@ -22,10 +47,12 @@ int main([[maybe_unused]] int argc, [[maybe_unused]] char* argv[]) {
return 0;
}
catch (const std::exception& e) {
releaseMouseGrab();
LOG_FATAL("Unhandled exception: ", e.what());
return 1;
}
catch (...) {
releaseMouseGrab();
LOG_FATAL("Unknown exception occurred");
return 1;
}