From 9f80a278a6f188c8e9131df0684bad14a07491ee Mon Sep 17 00:00:00 2001 From: untodesu Date: Fri, 21 Mar 2025 18:16:40 +0500 Subject: Toggles system rework, added flight pmove mode - Reworked toggles to use a constant-styled enumerations - Added TOGGLE_PM_FLIGHT and an according movement mode. Now server-side just doesn't simulate gravity altogether for players, instead relying on whatever the client provides which works fine for now. Closes #12 --- game/client/toggles.hh | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) (limited to 'game/client/toggles.hh') diff --git a/game/client/toggles.hh b/game/client/toggles.hh index 98b9fe5..d5b18c7 100644 --- a/game/client/toggles.hh +++ b/game/client/toggles.hh @@ -2,6 +2,23 @@ #define CLIENT_TOGGLES_HH 1 #pragma once +using toggle_type = unsigned int; +constexpr static toggle_type TOGGLE_WIREFRAME = 0x0000U; // Render things in wireframe mode +constexpr static toggle_type TOGGLE_FULLBRIGHT = 0x0001U; // Render things without lighting +constexpr static toggle_type TOGGLE_CHUNK_AABB = 0x0002U; // Render chunk bounding boxes +constexpr static toggle_type TOGGLE_METRICS_UI = 0x0003U; // Render debug metrics overlay +constexpr static toggle_type TOGGLE_USE_GAMEPAD = 0x0004U; // Use gamepad for player movement +constexpr static toggle_type TOGGLE_PM_FLIGHT = 0x0005U; // Enable flight for player movement +constexpr static std::size_t TOGGLE_COUNT = 0x0006U; + +struct ToggleEnabledEvent final { + toggle_type type; +}; + +struct ToggleDisabledEvent final { + toggle_type type; +}; + namespace toggles { // The value is true whenever the debug @@ -11,17 +28,12 @@ namespace toggles extern bool is_sequence_await; } // namespace toggles -namespace toggles -{ -extern bool draw_chunk_borders; -extern bool draw_metrics; -extern bool render_fullbright; -extern bool render_wireframe; -} // namespace toggles - namespace toggles { void init(void); +void init_late(void); +bool get(toggle_type type); +void set(toggle_type type, bool value); } // namespace toggles #endif /* CLIENT_TOGGLES_HH */ -- cgit