From ed6ecca2a45e52d9be1d91107b9643b5ecdfb8bf Mon Sep 17 00:00:00 2001 From: Leviathan Linden Date: Thu, 16 Nov 2023 13:53:37 -0800 Subject: avatar_motion-->GameControl translation and flycam --- indra/newview/llviewerinput.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'indra/newview/llviewerinput.cpp') diff --git a/indra/newview/llviewerinput.cpp b/indra/newview/llviewerinput.cpp index ea3088613f..4968df943f 100644 --- a/indra/newview/llviewerinput.cpp +++ b/indra/newview/llviewerinput.cpp @@ -35,6 +35,7 @@ #include "llagentcamera.h" #include "llfloaterimnearbychat.h" #include "llfocusmgr.h" +#include "llgamecontrol.h" #include "llkeybind.h" // LLKeyData #include "llmorphview.h" #include "llmoveview.h" @@ -157,9 +158,6 @@ static void agent_handle_doubletap_run(EKeystate s, LLAgent::EDoubleTapRunMode m static void agent_push_forwardbackward( EKeystate s, S32 direction, LLAgent::EDoubleTapRunMode mode ) { - agent_handle_doubletap_run(s, mode); - if (KEYSTATE_UP == s) return; - F32 time = gKeyboard->getCurKeyElapsedTime(); S32 frame_count = ll_round(gKeyboard->getCurKeyElapsedFrameCount()); @@ -668,6 +666,7 @@ bool start_gesture( EKeystate s ) bool run_forward(EKeystate s) { + // HACK: we use AGENT_CONTROL_NUDGE_AT_POS to signify "run forward" if (KEYSTATE_UP != s) { if (gAgent.mDoubleTapRunMode != LLAgent::DOUBLETAP_FORWARD) @@ -693,6 +692,7 @@ bool run_forward(EKeystate s) bool run_backward(EKeystate s) { + // HACK: we use AGENT_CONTROL_NUDGE_AT_NEG to signify "run backward" if (KEYSTATE_UP != s) { if (gAgent.mDoubleTapRunMode != LLAgent::DOUBLETAP_BACKWARD) @@ -718,6 +718,7 @@ bool run_backward(EKeystate s) bool run_left(EKeystate s) { + // HACK: we use AGENT_CONTROL_NUDGE_LEFT_POS to signify "run left" if (KEYSTATE_UP != s) { if (gAgent.mDoubleTapRunMode != LLAgent::DOUBLETAP_SLIDELEFT) @@ -768,6 +769,7 @@ bool run_right(EKeystate s) bool toggle_run(EKeystate s) { + // HACK: we use AGENT_CONTROL_FAST_AT to signify "run button" if (KEYSTATE_DOWN != s) return true; bool run = gAgent.getAlwaysRun(); if (run) @@ -786,6 +788,7 @@ bool toggle_run(EKeystate s) bool toggle_sit(EKeystate s) { + // HACK: we use AGENT_CONTROL_SIT_ON_GROUND to signify "sit button" if (KEYSTATE_DOWN != s) return true; if (gAgent.isSitting()) { -- cgit v1.2.3 From ec39ac89e8529da206dafd519d75ad5944888076 Mon Sep 17 00:00:00 2001 From: leviathan Date: Fri, 1 Mar 2024 14:04:54 -0800 Subject: more GameControl prefs UI --- indra/newview/llviewerinput.cpp | 46 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) (limited to 'indra/newview/llviewerinput.cpp') diff --git a/indra/newview/llviewerinput.cpp b/indra/newview/llviewerinput.cpp index 4968df943f..0bbf7a07b3 100644 --- a/indra/newview/llviewerinput.cpp +++ b/indra/newview/llviewerinput.cpp @@ -916,6 +916,20 @@ bool agent_control_lbutton_handle(EKeystate s) return true; } +template +bool game_control_button(EKeystate s) +{ + if (s == KEYSTATE_DOWN) + { + gAgent.pressGameControlButton(N); + } + else if ( s == KEYSTATE_UP) + { + gAgent.releaseGameControlButton(N); + } + return true; +} + // In-world keybindings, like walking or camera #define REGISTER_KEYBOARD_ACTION(KEY, ACTION) LLREGISTER_STATIC(LLKeyboardActionRegistry, KEY, LLKeybindFunctionData(ACTION, false)); // Global keybindings that should work even with floaters focused, like voice @@ -973,6 +987,38 @@ REGISTER_KEYBOARD_ACTION("walk_to", walk_to); REGISTER_KEYBOARD_GLOBAL_ACTION("toggle_voice", toggle_voice); REGISTER_KEYBOARD_GLOBAL_ACTION("voice_follow_key", voice_follow_key); REGISTER_KEYBOARD_ACTION(script_mouse_handler_name, script_trigger_lbutton); +REGISTER_KEYBOARD_ACTION("game_control_button_0", game_control_button<0>); +REGISTER_KEYBOARD_ACTION("game_control_button_1", game_control_button<1>); +REGISTER_KEYBOARD_ACTION("game_control_button_2", game_control_button<2>); +REGISTER_KEYBOARD_ACTION("game_control_button_3", game_control_button<3>); +REGISTER_KEYBOARD_ACTION("game_control_button_4", game_control_button<4>); +REGISTER_KEYBOARD_ACTION("game_control_button_5", game_control_button<5>); +REGISTER_KEYBOARD_ACTION("game_control_button_6", game_control_button<6>); +REGISTER_KEYBOARD_ACTION("game_control_button_7", game_control_button<7>); +REGISTER_KEYBOARD_ACTION("game_control_button_8", game_control_button<8>); +REGISTER_KEYBOARD_ACTION("game_control_button_9", game_control_button<9>); +REGISTER_KEYBOARD_ACTION("game_control_button_10", game_control_button<10>); +REGISTER_KEYBOARD_ACTION("game_control_button_11", game_control_button<11>); +REGISTER_KEYBOARD_ACTION("game_control_button_12", game_control_button<12>); +REGISTER_KEYBOARD_ACTION("game_control_button_13", game_control_button<13>); +REGISTER_KEYBOARD_ACTION("game_control_button_14", game_control_button<14>); +REGISTER_KEYBOARD_ACTION("game_control_button_15", game_control_button<15>); +REGISTER_KEYBOARD_ACTION("game_control_button_16", game_control_button<16>); +REGISTER_KEYBOARD_ACTION("game_control_button_17", game_control_button<17>); +REGISTER_KEYBOARD_ACTION("game_control_button_18", game_control_button<18>); +REGISTER_KEYBOARD_ACTION("game_control_button_19", game_control_button<19>); +REGISTER_KEYBOARD_ACTION("game_control_button_20", game_control_button<20>); +REGISTER_KEYBOARD_ACTION("game_control_button_21", game_control_button<21>); +REGISTER_KEYBOARD_ACTION("game_control_button_22", game_control_button<22>); +REGISTER_KEYBOARD_ACTION("game_control_button_23", game_control_button<23>); +REGISTER_KEYBOARD_ACTION("game_control_button_24", game_control_button<24>); +REGISTER_KEYBOARD_ACTION("game_control_button_25", game_control_button<25>); +REGISTER_KEYBOARD_ACTION("game_control_button_26", game_control_button<26>); +REGISTER_KEYBOARD_ACTION("game_control_button_27", game_control_button<27>); +REGISTER_KEYBOARD_ACTION("game_control_button_28", game_control_button<28>); +REGISTER_KEYBOARD_ACTION("game_control_button_29", game_control_button<29>); +REGISTER_KEYBOARD_ACTION("game_control_button_30", game_control_button<30>); +REGISTER_KEYBOARD_ACTION("game_control_button_31", game_control_button<31>); #undef REGISTER_KEYBOARD_ACTION LLViewerInput::LLViewerInput() -- cgit v1.2.3 From e74ce9655ed9f1124887aa31aa2e2155ea62d3da Mon Sep 17 00:00:00 2001 From: leviathan Date: Wed, 10 Jul 2024 14:08:17 -0700 Subject: more correct AgentUpdate transmission logic --- indra/newview/llviewerinput.cpp | 5 ----- 1 file changed, 5 deletions(-) (limited to 'indra/newview/llviewerinput.cpp') diff --git a/indra/newview/llviewerinput.cpp b/indra/newview/llviewerinput.cpp index 0bbf7a07b3..66042128f2 100644 --- a/indra/newview/llviewerinput.cpp +++ b/indra/newview/llviewerinput.cpp @@ -666,7 +666,6 @@ bool start_gesture( EKeystate s ) bool run_forward(EKeystate s) { - // HACK: we use AGENT_CONTROL_NUDGE_AT_POS to signify "run forward" if (KEYSTATE_UP != s) { if (gAgent.mDoubleTapRunMode != LLAgent::DOUBLETAP_FORWARD) @@ -692,7 +691,6 @@ bool run_forward(EKeystate s) bool run_backward(EKeystate s) { - // HACK: we use AGENT_CONTROL_NUDGE_AT_NEG to signify "run backward" if (KEYSTATE_UP != s) { if (gAgent.mDoubleTapRunMode != LLAgent::DOUBLETAP_BACKWARD) @@ -718,7 +716,6 @@ bool run_backward(EKeystate s) bool run_left(EKeystate s) { - // HACK: we use AGENT_CONTROL_NUDGE_LEFT_POS to signify "run left" if (KEYSTATE_UP != s) { if (gAgent.mDoubleTapRunMode != LLAgent::DOUBLETAP_SLIDELEFT) @@ -769,7 +766,6 @@ bool run_right(EKeystate s) bool toggle_run(EKeystate s) { - // HACK: we use AGENT_CONTROL_FAST_AT to signify "run button" if (KEYSTATE_DOWN != s) return true; bool run = gAgent.getAlwaysRun(); if (run) @@ -788,7 +784,6 @@ bool toggle_run(EKeystate s) bool toggle_sit(EKeystate s) { - // HACK: we use AGENT_CONTROL_SIT_ON_GROUND to signify "sit button" if (KEYSTATE_DOWN != s) return true; if (gAgent.isSitting()) { -- cgit v1.2.3