Changed: Add new lua command force_camera_fp to force camarea to first person view

--HG--
branch : develop
This commit is contained in:
Riasan 2017-05-22 19:50:47 +02:00
parent 603b0e6a84
commit 18823c28fa
3 changed files with 29 additions and 1 deletions

View file

@ -225,6 +225,17 @@ class CAHToggleCamera : public IActionHandler
};
REGISTER_ACTION_HANDLER (CAHToggleCamera, "toggle_camera");
// ------------------------------------------------------------------------------------------------
class CAHToggleForceFP : public IActionHandler
{
virtual void execute (CCtrlBase * /* pCaller */, const string &/* Params */)
{
// Change the camera view to first person
UserEntity->forceCamareaFirstPerson();
}
};
REGISTER_ACTION_HANDLER (CAHToggleForceFP, "force_camera_fp");
// ------------------------------------------------------------------------------------------------
class CAHToggleNames : public IActionHandler
{
@ -446,4 +457,3 @@ class CAHToggleDodgeParry : public IActionHandler
}
};
REGISTER_ACTION_HANDLER (CAHToggleDodgeParry, "toggle_dodge_parry");

View file

@ -748,6 +748,7 @@ void displayHelp()
// DISP_TEXT(0.0f, "SHIFT + F11 : Test");
DISP_TEXT(0.0f, getActionKey("enter_modal", "group=ui:interface:quit_dialog") + " : Quit");
DISP_TEXT(0.0f, getActionKey("toggle_camera") + " : First/Third Person View");
DISP_TEXT(0.0f, getActionKey("force_camera_fp") + " : Force Camera to First Person View");
line = 1.f;
TextContext->setHotSpot(UTextContext::TopRight);

View file

@ -3213,6 +3213,23 @@ void CUserEntity::toggleCamera()
}
}// toggleCamera //
//-----------------------------------------------
// forceCamareaFirstPerson :
// Force Camera to First Person View
//-----------------------------------------------
void CUserEntity::forceCamareaFirstPerson()
{
// You cannot change the camera view when dead.
if(isDead())
return;
// Only if not inside a building.
if(!UserEntity->forceIndoorFPV())
{
//Enter the 1st Person View Mode
UserEntity->viewMode(CUserEntity::FirstPV);
}
}// forceCamareaFirstPerson //
//---------------------------------------------------
// getScale :
// Return the entity scale. (return 1.0 if there is any problem).