Merge with develop

--HG--
branch : compatibility-develop
hg/compatibility-develop
Nimetu 6 years ago
commit f979597830

@ -222,6 +222,7 @@ inline double isValidDouble (double v)
* \param str a string to transform to lower case
*/
std::string toLower ( const char *str );
std::string toLower ( const std::string &str );
void toLower ( char *str );
char toLower ( const char ch ); // convert only one character

@ -1443,12 +1443,11 @@ namespace NLGUI
if (_FontName == name)
return;
if (_FontName.length() > 0)
{
if (_Index != 0xFFFFFFFF)
CViewRenderer::getTextContext(_FontName)->erase (_Index);
clearLines();
}
if (_Index != 0xFFFFFFFF)
CViewRenderer::getTextContext(_FontName)->erase (_Index);
clearLines();
resetTextIndex();
_FontName = name;
computeFontSize ();

@ -591,6 +591,22 @@ NLMISC_CATEGORISED_COMMAND(nel,stohr, "Convert a second number into an human rea
return true;
}
std::string toLower(const char *str)
{
if (!str) return "";
uint len = strlen(str);
string res;
res.reserve(len);
for(uint i = 0; i < len; i++)
{
if( (str[i] >= 'A') && (str[i] <= 'Z') )
res += str[i] - 'A' + 'a';
else
res += str[i];
}
return res;
}
std::string toLower(const std::string &str)
{

@ -84,9 +84,6 @@ bool InitMouseWithCursor (bool hardware)
MouseHardware = hardware;
CViewPointer::setHWMouse( hardware );
// Update mouse information
UpdateMouse ();
if (InitMouseFirstTime)
{
InitMouseFirstTime = false;
@ -129,16 +126,6 @@ bool IsMouseCursorHardware ()
return MouseHardware;
}
// *********************************************************************************
// Set the mouse mode. Call this method once per frame to update window size
void UpdateMouse ()
{
if (!Driver->isSystemCursorCaptured())
{
DownMouseButtons = 0;
}
}
// *********************************************************************************
// Use this method to toggle the mouse (freelook <- cursor)
void SetMouseFreeLook ()
@ -160,7 +147,6 @@ void SetMouseFreeLook ()
pointer->show (false);
}
}
UpdateMouse ();
}
}
@ -202,7 +188,6 @@ void SetMouseCursor (bool updatePos)
}
MouseFreeLook = false;
UpdateMouse ();
// Integer coordinates
sint ix = (sint)(x*(float)width+0.5f);
@ -253,7 +238,6 @@ void SetMouseCursor (bool updatePos)
void SetMouseSpeed (float speed)
{
MouseCursorSpeed = speed;
UpdateMouse ();
}
// *********************************************************************************
@ -261,12 +245,27 @@ void SetMouseSpeed (float speed)
void SetMouseAcceleration (uint accel)
{
MouseCursorAcceleration = accel;
UpdateMouse ();
}
// *********************************************************************************
void HandleSystemCursorCapture(const CEvent &event)
{
static bool mouseCaptured = false;
// capture on first move event after button is held down or free look is activated
if (event == EventMouseMoveId && !mouseCaptured && (MouseFreeLook || DownMouseButtons != 0))
{
mouseCaptured = true;
Driver->setCapture(true);
}
// release when button is released and not in free look
if (mouseCaptured && !MouseFreeLook && DownMouseButtons == 0)
{
mouseCaptured = false;
Driver->setCapture(false);
}
if (event == EventMouseDownId)
{
CEventMouseDown &em = (CEventMouseDown &) event;
@ -279,8 +278,6 @@ void HandleSystemCursorCapture(const CEvent &event)
cursor->setPointerMiddleDown(em.Button == middleButton);
cursor->setPointerRightDown(em.Button == rightButton);
}
Driver->setCapture(true);
}
if (event == EventMouseUpId)
@ -297,7 +294,6 @@ void HandleSystemCursorCapture(const CEvent &event)
cursor->setPointerMiddleDown(false);
cursor->setPointerRightDown(false);
}
Driver->setCapture(false);
}
}

@ -44,9 +44,6 @@ bool InitMouseWithCursor (bool hardware);
// Is mouse cursor hardware ?
bool IsMouseCursorHardware ();
// Set the mouse mode. Call this method once per frame to update window size
void UpdateMouse ();
// Use this method to toggle the mouse (freelook <- cursor)
void SetMouseFreeLook ();

@ -163,6 +163,7 @@ CUserEntity::CUserEntity()
// Your are not on a mount at the beginning.
_OnMount = false;
_HiddenMount = CLFECOMMON::INVALID_SLOT;
_AnimAttackOn = false;
@ -3188,6 +3189,8 @@ void CUserEntity::viewMode(CUserEntity::TView viewMode, bool changeView)
CEntityCL *mount = EntitiesMngr.entity(_Mount);
if(mount)
mount->displayable(false);
_HiddenMount = _Mount;
}
// Change Controls.
if( isRiding() )
@ -3205,11 +3208,14 @@ void CUserEntity::viewMode(CUserEntity::TView viewMode, bool changeView)
case ThirdPV:
if(changeView)
ClientCfg.FPV = false;
if(_Mount != CLFECOMMON::INVALID_SLOT)
if(_HiddenMount != CLFECOMMON::INVALID_SLOT)
{
CEntityCL *mount = EntitiesMngr.entity(_Mount);
CEntityCL *mount = EntitiesMngr.entity(_HiddenMount);
if(mount)
mount->displayable(true);
_HiddenMount == CLFECOMMON::INVALID_SLOT;
}
// Change Controls.
UserControls.mode(CUserControls::ThirdMode);
@ -3393,9 +3399,24 @@ void CUserEntity::updateVisualDisplay()
if(UserControls.isInternalView() || View.forceFirstPersonView())
{
// Hide the mount
CCharacterCL *mount = dynamic_cast<CCharacterCL *>(EntitiesMngr.entity(_Mount));
if(mount)
mount->displayable(false);
if (_Mount != CLFECOMMON::INVALID_SLOT)
{
CCharacterCL *mount = dynamic_cast<CCharacterCL *>(EntitiesMngr.entity(_Mount));
if(mount)
mount->displayable(false);
_HiddenMount = _Mount;
}
else if (_HiddenMount != CLFECOMMON::INVALID_SLOT)
{
// not on mount anymore, but still in FPV
CCharacterCL *mount = dynamic_cast<CCharacterCL *>(EntitiesMngr.entity(_HiddenMount));
if(mount)
mount->displayable(true);
_HiddenMount = CLFECOMMON::INVALID_SLOT;
}
// Hide all user body parts.
for(uint i=0; i<_Instances.size(); ++i)
if(!_Instances[i].Current.empty())

@ -701,6 +701,8 @@ protected:
private:
/// TO know if the user is on a mount at the moment.
bool _OnMount;
/// Keep track of last hidden mount when switching to FPV mode
CLFECOMMON::TCLEntityId _HiddenMount;
/// Is the attack animation is currently playing.
bool _AnimAttackOn;
/// Current View Mode (First/Third Person View).

Loading…
Cancel
Save