One handed walking and running - LMB+RMB on your avatar

This commit is contained in:
Siana Gearz
2013-11-29 11:33:59 +01:00
parent b7e9a94744
commit ff3f6eccf7
3 changed files with 38 additions and 0 deletions

View File

@@ -45,6 +45,7 @@
#include "llagentcamera.h"
#include "llbutton.h"
#include "llviewercontrol.h"
#include "llviewerkeyboard.h"
#include "lldrawable.h"
#include "llhoverview.h"
#include "llhudmanager.h"
@@ -312,9 +313,15 @@ BOOL LLToolCamera::handleMouseUp(S32 x, S32 y, MASK mask)
return TRUE;
}
static bool right_hold_mouse_walk=false;
BOOL LLToolCamera::handleHover(S32 x, S32 y, MASK mask)
{
if(right_hold_mouse_walk)
{
agent_push_forward(KEYSTATE_LEVEL);
}
S32 dx = gViewerWindow->getCurrentMouseDX();
S32 dy = gViewerWindow->getCurrentMouseDY();
@@ -449,8 +456,36 @@ BOOL LLToolCamera::handleHover(S32 x, S32 y, MASK mask)
return TRUE;
}
BOOL LLToolCamera::handleRightMouseDown(S32 x, S32 y, MASK mask)
{
if(mMouseSteering)
{
agent_push_forward(KEYSTATE_DOWN);
right_hold_mouse_walk = true;
return TRUE;
}
else
{
return FALSE;
}
}
BOOL LLToolCamera::handleRightMouseUp(S32 x, S32 y, MASK mask)
{
if(mMouseSteering || right_hold_mouse_walk)
{
agent_push_forward(KEYSTATE_UP);
right_hold_mouse_walk = false;
return TRUE;
}
else
{
return FALSE;
}
}
void LLToolCamera::onMouseCaptureLost()
{
releaseMouse();
handleRightMouseUp(0,0,0);
}

View File

@@ -47,6 +47,8 @@ public:
virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask);
virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask);
virtual BOOL handleHover(S32 x, S32 y, MASK mask);
virtual BOOL handleRightMouseDown(S32 x, S32 y, MASK mask);
virtual BOOL handleRightMouseUp(S32 x, S32 y, MASK mask);
virtual void onMouseCaptureLost();

View File

@@ -94,4 +94,5 @@ protected:
extern LLViewerKeyboard gViewerKeyboard;
extern bool isCrouch;
void agent_push_forward(EKeystate s);
#endif // LL_LLVIEWERKEYBOARD_H