Sync with Alchemy to go from keys.ini to keys.xml

This commit is contained in:
Inusaito Sayori
2015-07-22 01:53:42 -04:00
parent 4c0038a8ec
commit 1a6e99a9e3
7 changed files with 915 additions and 816 deletions

View File

@@ -45,6 +45,7 @@
#include "lltoolfocus.h"
#include "llviewerwindow.h"
#include "llvoavatarself.h"
#include "llxuiparser.h"
void handle_reset_view();
@@ -58,7 +59,6 @@ const F32 FLY_FRAMES = 4;
const F32 NUDGE_TIME = 0.25f; // in seconds
const S32 NUDGE_FRAMES = 2;
const F32 ORBIT_NUDGE_RATE = 0.05f; // fraction of normal speed
const F32 YAW_NUDGE_RATE = 0.05f; // fraction of normal speed
struct LLKeyboardActionRegistry
: public LLRegistrySingleton<std::string, boost::function<void (EKeystate keystate)>, LLKeyboardActionRegistry>
@@ -86,6 +86,7 @@ void agent_jump( EKeystate s )
gAgent.moveUp(1);
}
}
// <singu>
void agent_toggle_down( EKeystate s )
{
if (KEYSTATE_UP == s) return;
@@ -96,6 +97,7 @@ void agent_toggle_down( EKeystate s )
}
gAgent.moveUp(-1);
}
// </singu>
void agent_push_down( EKeystate s )
{
@@ -103,22 +105,29 @@ void agent_push_down( EKeystate s )
gAgent.moveUp(-1);
}
static void agent_check_temporary_run(LLAgent::EDoubleTapRunMode mode)
{
// if (gAgent.mDoubleTapRunMode == mode &&
// gAgent.getRunning() &&
// !gAgent.getAlwaysRun())
// {
// // Turn off temporary running.
// gAgent.clearRunning();
// gAgent.sendWalkRun(gAgent.getRunning());
// }
// [RLVa:KB] - Checked: 2011-05-11 (RLVa-1.3.0i) | Added: RLVa-1.3.0i
if ( (gAgent.mDoubleTapRunMode == mode) && (gAgent.getTempRun()) )
gAgent.clearTempRun();
// [/RLVa:KB]
}
static void agent_handle_doubletap_run(EKeystate s, LLAgent::EDoubleTapRunMode mode)
{
if (KEYSTATE_UP == s)
{
// if (gAgent.mDoubleTapRunMode == mode &&
// gAgent.getRunning() &&
// !gAgent.getAlwaysRun())
// {
// // Turn off temporary running.
// gAgent.clearRunning();
// gAgent.sendWalkRun(gAgent.getRunning());
// }
// [RLVa:KB] - Checked: 2011-05-11 (RLVa-1.3.0i) | Added: RLVa-1.3.0i
if ( (gAgent.mDoubleTapRunMode == mode) && (gAgent.getTempRun()) )
gAgent.clearTempRun();
// [/RLVa:KB]
// Note: in case shift is already released, slide left/right run
// will be released in agent_turn_left()/agent_turn_right()
agent_check_temporary_run(mode);
}
else if (gSavedSettings.getBOOL("AllowTapTapHoldRun") &&
KEYSTATE_DOWN == s &&
@@ -208,7 +217,10 @@ void agent_turn_left( EKeystate s )
}
else
{
if (KEYSTATE_UP == s) return;
if (KEYSTATE_UP == s)
{
return;
}
F32 time = gKeyboard->getCurKeyElapsedTime();
gAgent.moveYaw( LLFloaterMove::getYawRate( time ) );
}
@@ -223,7 +235,10 @@ void agent_turn_right( EKeystate s )
}
else
{
if (KEYSTATE_UP == s) return;
if (KEYSTATE_UP == s)
{
return;
}
F32 time = gKeyboard->getCurKeyElapsedTime();
gAgent.moveYaw( -LLFloaterMove::getYawRate( time ) );
}
@@ -758,6 +773,61 @@ BOOL LLViewerKeyboard::bindKey(const S32 mode, const KEY key, const MASK mask, c
return TRUE;
}
LLViewerKeyboard::KeyBinding::KeyBinding()
: key("key"),
mask("mask"),
command("command")
{}
LLViewerKeyboard::KeyMode::KeyMode(EKeyboardMode _mode)
: bindings("binding"),
mode(_mode)
{}
LLViewerKeyboard::Keys::Keys()
: first_person("first_person", KeyMode(MODE_FIRST_PERSON)),
third_person("third_person", KeyMode(MODE_THIRD_PERSON)),
edit("edit", KeyMode(MODE_EDIT)),
sitting("sitting", KeyMode(MODE_SITTING)),
edit_avatar("edit_avatar", KeyMode(MODE_EDIT_AVATAR))
{}
S32 LLViewerKeyboard::loadBindingsXML(const std::string& filename)
{
S32 binding_count = 0;
Keys keys;
LLSimpleXUIParser parser;
if (parser.readXUI(filename, keys)
&& keys.validateBlock())
{
binding_count += loadBindingMode(keys.first_person);
binding_count += loadBindingMode(keys.third_person);
binding_count += loadBindingMode(keys.edit);
binding_count += loadBindingMode(keys.sitting);
binding_count += loadBindingMode(keys.edit_avatar);
}
return binding_count;
}
S32 LLViewerKeyboard::loadBindingMode(const LLViewerKeyboard::KeyMode& keymode)
{
S32 binding_count = 0;
for (LLInitParam::ParamIterator<KeyBinding>::const_iterator it = keymode.bindings.begin(),
end_it = keymode.bindings.end();
it != end_it;
++it)
{
KEY key;
MASK mask;
LLKeyboard::keyFromString(it->key, &key);
LLKeyboard::maskFromString(it->mask, &mask);
bindKey(keymode.mode, key, mask, it->command);
binding_count++;
}
return binding_count;
}
S32 LLViewerKeyboard::loadBindings(const std::string& filename)
{