Changed: Merged changes from compatibility-develop
--HG-- branch : develop
This commit is contained in:
parent
3e4a873429
commit
ed884644af
3 changed files with 38 additions and 7 deletions
|
@ -1407,12 +1407,19 @@ void impulseCorrectPos(NLMISC::CBitMemStream &impulse)
|
||||||
|
|
||||||
if(UserEntity->mode() != MBEHAV::COMBAT_FLOAT)
|
if(UserEntity->mode() != MBEHAV::COMBAT_FLOAT)
|
||||||
{
|
{
|
||||||
// Compute the destination.
|
if (x == 0) // Get SpeedAdjustement
|
||||||
CVectorD dest = CVectorD((float)x/1000.0f, (float)y/1000.0f, (float)z/1000.0f);
|
{
|
||||||
// Update the position for the vision.
|
UserEntity->setSpeedServerAdjust(-0.2f);
|
||||||
NetMngr.setReferencePosition(dest);
|
}
|
||||||
// Change the user poisition.
|
else
|
||||||
UserEntity->correctPos(dest);
|
{
|
||||||
|
// Compute the destination.
|
||||||
|
CVectorD dest = CVectorD((float)x/1000.0f, (float)y/1000.0f, (float)z/1000.0f);
|
||||||
|
// Update the position for the vision.
|
||||||
|
NetMngr.setReferencePosition(dest);
|
||||||
|
// Change the user poisition.
|
||||||
|
UserEntity->correctPos(dest);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}// impulseCorrectPos //
|
}// impulseCorrectPos //
|
||||||
|
|
||||||
|
|
|
@ -148,6 +148,8 @@ CUserEntity::CUserEntity()
|
||||||
_FrontVelocity = 0.0f;
|
_FrontVelocity = 0.0f;
|
||||||
_LateralVelocity = 0.0f;
|
_LateralVelocity = 0.0f;
|
||||||
|
|
||||||
|
_SpeedServerAdjust = 1.0f;
|
||||||
|
|
||||||
// \todo GUIGUI : do it more generic.
|
// \todo GUIGUI : do it more generic.
|
||||||
_First_Pos = false;
|
_First_Pos = false;
|
||||||
|
|
||||||
|
@ -1209,7 +1211,11 @@ void CUserEntity::applyMotion(CEntityCL *target)
|
||||||
speed = CVectorD::Null;
|
speed = CVectorD::Null;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
speed = getVelocity()*_SpeedFactor.getValue();
|
speed = getVelocity()*_SpeedFactor.getValue();
|
||||||
|
_SpeedFactor.addFactorValue(0.005f);
|
||||||
|
}
|
||||||
|
|
||||||
// SPEED VECTOR NULL -> NO MOVE
|
// SPEED VECTOR NULL -> NO MOVE
|
||||||
if(speed == CVectorD::Null)
|
if(speed == CVectorD::Null)
|
||||||
return;
|
return;
|
||||||
|
@ -1231,6 +1237,9 @@ void CUserEntity::applyMotion(CEntityCL *target)
|
||||||
// Third Person View
|
// Third Person View
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
double modif = (100.0f/(float)NetMngr.getMsPerTick());
|
||||||
|
clamp(modif, 0.0, 1.0);
|
||||||
|
speed *= modif;
|
||||||
speed += pos();
|
speed += pos();
|
||||||
sint64 x = (sint64)((sint32)(speed.x * 1000.0));
|
sint64 x = (sint64)((sint32)(speed.x * 1000.0));
|
||||||
sint64 y = (sint64)((sint32)(speed.y * 1000.0));
|
sint64 y = (sint64)((sint32)(speed.y * 1000.0));
|
||||||
|
@ -3483,6 +3492,7 @@ void CUserEntity::light()
|
||||||
void CUserEntity::CSpeedFactor::init()
|
void CUserEntity::CSpeedFactor::init()
|
||||||
{
|
{
|
||||||
_Value = 1.0f; // Default speed factor is 1.
|
_Value = 1.0f; // Default speed factor is 1.
|
||||||
|
_ServerFactor = 1.0f;
|
||||||
CInterfaceManager *IM = CInterfaceManager::getInstance ();
|
CInterfaceManager *IM = CInterfaceManager::getInstance ();
|
||||||
CCDBNodeLeaf *pNodeLeaf = NLGUI::CDBManager::getInstance()->getDbProp("SERVER:USER:SPEED_FACTOR", false);
|
CCDBNodeLeaf *pNodeLeaf = NLGUI::CDBManager::getInstance()->getDbProp("SERVER:USER:SPEED_FACTOR", false);
|
||||||
if(pNodeLeaf)
|
if(pNodeLeaf)
|
||||||
|
|
|
@ -297,6 +297,8 @@ public:
|
||||||
// get the velocity vector of the entity
|
// get the velocity vector of the entity
|
||||||
NLMISC::CVector getVelocity() const;
|
NLMISC::CVector getVelocity() const;
|
||||||
|
|
||||||
|
inline void setSpeedServerAdjust(float speed) {_SpeedFactor.addFactorValue(speed);}
|
||||||
|
|
||||||
/// Check if the mount is able to run, and force walking mode if not
|
/// Check if the mount is able to run, and force walking mode if not
|
||||||
void checkMountAbleToRun();
|
void checkMountAbleToRun();
|
||||||
|
|
||||||
|
@ -497,13 +499,23 @@ protected:
|
||||||
/// Release
|
/// Release
|
||||||
void release();
|
void release();
|
||||||
/// Return the speed factor.
|
/// Return the speed factor.
|
||||||
float getValue() const {return _Value;}
|
float getValue() const { return _Value * _ServerFactor; }
|
||||||
|
void setFactorValue(float value) {_ServerFactor = value;}
|
||||||
|
void addFactorValue(float value) {
|
||||||
|
_ServerFactor += value;
|
||||||
|
if (_ServerFactor > 1.0)
|
||||||
|
_ServerFactor = 1.0;
|
||||||
|
if (_ServerFactor < 0.1)
|
||||||
|
_ServerFactor = 0.1;
|
||||||
|
}
|
||||||
|
|
||||||
virtual void serial(class NLMISC::IStream &f) throw(NLMISC::EStream) {f.serial(_Value);}
|
virtual void serial(class NLMISC::IStream &f) throw(NLMISC::EStream) {f.serial(_Value);}
|
||||||
protected:
|
protected:
|
||||||
/// Method called when the ping message is back.
|
/// Method called when the ping message is back.
|
||||||
virtual void update(NLMISC::ICDBNode* leaf);
|
virtual void update(NLMISC::ICDBNode* leaf);
|
||||||
private:
|
private:
|
||||||
float _Value;
|
float _Value;
|
||||||
|
float _ServerFactor;
|
||||||
};
|
};
|
||||||
|
|
||||||
class CMountHunger
|
class CMountHunger
|
||||||
|
@ -546,6 +558,8 @@ protected:
|
||||||
/// Velocity : Front and Lateral
|
/// Velocity : Front and Lateral
|
||||||
float _FrontVelocity;
|
float _FrontVelocity;
|
||||||
float _LateralVelocity;
|
float _LateralVelocity;
|
||||||
|
/// Speed adjustement from gpms
|
||||||
|
float _SpeedServerAdjust;
|
||||||
/// Head Pitch
|
/// Head Pitch
|
||||||
double _HeadPitch;
|
double _HeadPitch;
|
||||||
/// Height of the eyes (camera).
|
/// Height of the eyes (camera).
|
||||||
|
|
Loading…
Reference in a new issue