isle-portable/extensions/include/extensions/thirdpersoncamera.h
foxtacles 7e4a86fb39
Some checks failed
CI / clang-format (push) Has been cancelled
CI / ${{ matrix.name }} (false, --toolchain /usr/local/vitasdk/share/vita.toolchain.cmake, false, false, Ninja, Vita, ubuntu-latest, true, true) (push) Has been cancelled
CI / ${{ matrix.name }} (false, -DCMAKE_SYSTEM_NAME=WindowsStore -DCMAKE_SYSTEM_VERSION=10.0.26100.0, false, false, Visual Studio 17 2022, true, Xbox One, windows-latest, amd64, false, true) (push) Has been cancelled
CI / ${{ matrix.name }} (false, -DCMAKE_TOOLCHAIN_FILE=/opt/devkitpro/cmake/3DS.cmake, false, devkitpro/devkitarm:latest, false, Ninja, true, Nintendo 3DS, ubuntu-latest, true) (push) Has been cancelled
CI / ${{ matrix.name }} (false, -DCMAKE_TOOLCHAIN_FILE=/opt/devkitpro/cmake/Switch.cmake, false, devkitpro/devkita64:latest, false, Ninja, Nintendo Switch, true, ubuntu-latest, true) (push) Has been cancelled
CI / ${{ matrix.name }} (false, emcmake, false, false, true, Ninja, Emscripten, ubuntu-latest, true) (push) Has been cancelled
CI / ${{ matrix.name }} (false, false, false, Ninja, true, MSVC (arm64), windows-latest, amd64_arm64, false) (push) Has been cancelled
CI / ${{ matrix.name }} (false, false, true, Ninja, true, MSVC (x86), windows-latest, amd64_x86, false) (push) Has been cancelled
CI / ${{ matrix.name }} (false, true, false, Ninja, true, MSVC (x64), windows-latest, amd64, false) (push) Has been cancelled
CI / ${{ matrix.name }} (false, true, true, false, Ninja, true, MSVC (x64 Debug), windows-latest, amd64, false) (push) Has been cancelled
CI / ${{ matrix.name }} (true, false, -DCMAKE_SYSTEM_NAME=iOS, false, false, Xcode, true, iOS, macos-15, true) (push) Has been cancelled
CI / ${{ matrix.name }} (true, false, false, false, Ninja, Android, ubuntu-latest, true) (push) Has been cancelled
CI / ${{ matrix.name }} (true, false, true, false, Ninja, macOS, macos-latest, true) (push) Has been cancelled
CI / ${{ matrix.name }} (true, true, false, Ninja, true, mingw-w64-x86_64, mingw64, msys2 mingw64, windows-latest, msys2 {0}, true) (push) Has been cancelled
CI / ${{ matrix.name }} (true, true, true, false, Ninja, true, Linux (Debug), ubuntu-latest, true) (push) Has been cancelled
CI / ${{ matrix.name }} (true, true, true, false, Ninja, true, Linux, ubuntu-latest, true) (push) Has been cancelled
CI / Flatpak (${{ matrix.arch }}) (aarch64, ubuntu-22.04-arm) (push) Has been cancelled
CI / Flatpak (${{ matrix.arch }}) (x86_64, ubuntu-latest) (push) Has been cancelled
CI / C++ (push) Has been cancelled
Docker / Publish web port (push) Has been cancelled
CI / Release (push) Has been cancelled
Add third person camera extension (#786)
Introduces a third person camera system with orbit camera, input handling
(mouse/keyboard/touch/gamepad), display actor cloning, and camera-relative
movement. Includes shared character utilities (animator, cloner, customizer)
and an IExtraAnimHandler interface for optional animation extensions.
Also includes generic base game fixes and extension system improvements.
2026-03-31 01:00:07 +02:00

92 lines
3.3 KiB
C++

#pragma once
#include "extensions/extensions.h"
#include "mxtypes.h"
#include <SDL3/SDL_events.h>
#include <map>
#include <string>
class IslePathActor;
class LegoEventNotificationParam;
class LegoNavController;
class LegoPathActor;
class LegoROI;
class LegoWorld;
class Vector3;
namespace Extensions
{
namespace ThirdPersonCamera
{
class Controller;
}
class ThirdPersonCameraExt {
public:
static void Initialize();
static void HandleActorEnter(IslePathActor* p_actor);
static void HandleActorExit(IslePathActor* p_actor);
static void HandleCamAnimEnd(LegoPathActor* p_actor);
static void OnSDLEvent(SDL_Event* p_event);
static MxBool IsThirdPersonCameraActive();
static MxBool HandleTouchInput(SDL_Event* p_event);
static MxBool HandleNavOverride(
LegoNavController* p_nav,
const Vector3& p_curPos,
const Vector3& p_curDir,
Vector3& p_newPos,
Vector3& p_newDir,
float p_deltaTime
);
static MxBool HandleWorldEnable(LegoWorld* p_world, MxBool p_enable);
static MxBool HandleROIClick(LegoROI* p_rootROI, LegoEventNotificationParam& p_param);
static MxBool IsClonedCharacter(const char* p_name);
static void HandleCreate();
LEGO1_EXPORT static void HandleSDLEvent(SDL_Event* p_event);
static ThirdPersonCamera::Controller* GetCamera();
static std::map<std::string, std::string> options;
static bool enabled;
private:
static ThirdPersonCamera::Controller* s_camera;
static bool s_registered;
static bool s_inIsleWorld;
};
namespace TP
{
#ifdef EXTENSIONS
constexpr auto HandleCreate = &ThirdPersonCameraExt::HandleCreate;
constexpr auto HandleWorldEnable = &ThirdPersonCameraExt::HandleWorldEnable;
constexpr auto HandleActorEnter = &ThirdPersonCameraExt::HandleActorEnter;
constexpr auto HandleActorExit = &ThirdPersonCameraExt::HandleActorExit;
constexpr auto HandleCamAnimEnd = &ThirdPersonCameraExt::HandleCamAnimEnd;
constexpr auto HandleSDLEvent = &ThirdPersonCameraExt::OnSDLEvent;
constexpr auto IsThirdPersonCameraActive = &ThirdPersonCameraExt::IsThirdPersonCameraActive;
constexpr auto HandleTouchInput = &ThirdPersonCameraExt::HandleTouchInput;
constexpr auto HandleNavOverride = &ThirdPersonCameraExt::HandleNavOverride;
constexpr auto HandleROIClick = &ThirdPersonCameraExt::HandleROIClick;
constexpr auto IsClonedCharacter = &ThirdPersonCameraExt::IsClonedCharacter;
#else
constexpr decltype(&ThirdPersonCameraExt::HandleCreate) HandleCreate = nullptr;
constexpr decltype(&ThirdPersonCameraExt::HandleWorldEnable) HandleWorldEnable = nullptr;
constexpr decltype(&ThirdPersonCameraExt::HandleActorEnter) HandleActorEnter = nullptr;
constexpr decltype(&ThirdPersonCameraExt::HandleActorExit) HandleActorExit = nullptr;
constexpr decltype(&ThirdPersonCameraExt::HandleCamAnimEnd) HandleCamAnimEnd = nullptr;
constexpr decltype(&ThirdPersonCameraExt::OnSDLEvent) HandleSDLEvent = nullptr;
constexpr decltype(&ThirdPersonCameraExt::IsThirdPersonCameraActive) IsThirdPersonCameraActive = nullptr;
constexpr decltype(&ThirdPersonCameraExt::HandleTouchInput) HandleTouchInput = nullptr;
constexpr decltype(&ThirdPersonCameraExt::HandleNavOverride) HandleNavOverride = nullptr;
constexpr decltype(&ThirdPersonCameraExt::HandleROIClick) HandleROIClick = nullptr;
constexpr decltype(&ThirdPersonCameraExt::IsClonedCharacter) IsClonedCharacter = nullptr;
#endif
} // namespace TP
}; // namespace Extensions