Changed: Try to implement better pos correct from gpms

--HG--
branch : compatibility-develop
hg/compatibility-develop
ulukyn@gmail.com 7 years ago
parent d29865deae
commit 49f048787f

@ -2024,7 +2024,7 @@ int CLuaIHMRyzom::getIslandId(CLuaState &ls)
// *************************************************************************** // ***************************************************************************
// //
// addShape("shape", x, y, z, "angle", scale, collision?) // addShape("shape", .x, .y, .z, "angle", .scale, collision?, "context", "url", highlight?, transparency?, "texture", "skeleton")
// //
//******** //********
int CLuaIHMRyzom::addShape(CLuaState &ls) int CLuaIHMRyzom::addShape(CLuaState &ls)

@ -1403,6 +1403,12 @@ void impulseCorrectPos(NLMISC::CBitMemStream &impulse)
nlinfo("impulseCorrectPos: new user position %d %d %d", x, y, z); nlinfo("impulseCorrectPos: new user position %d %d %d", x, y, z);
if(UserEntity->mode() != MBEHAV::COMBAT_FLOAT) if(UserEntity->mode() != MBEHAV::COMBAT_FLOAT)
{
if (x == 0) // Get SpeedAdjustement
{
UserEntity->setSpeedServerAdjust((float)y/1000.0f);
}
else
{ {
// Compute the destination. // Compute the destination.
CVectorD dest = CVectorD((float)x/1000.0f, (float)y/1000.0f, (float)z/1000.0f); CVectorD dest = CVectorD((float)x/1000.0f, (float)y/1000.0f, (float)z/1000.0f);
@ -1411,6 +1417,7 @@ void impulseCorrectPos(NLMISC::CBitMemStream &impulse)
// Change the user poisition. // Change the user poisition.
UserEntity->correctPos(dest); UserEntity->correctPos(dest);
} }
}
}// impulseCorrectPos // }// impulseCorrectPos //
class CDummyProgress : public IProgressCallback class CDummyProgress : public IProgressCallback

@ -1218,6 +1218,7 @@ void CUserEntity::applyMotion(CEntityCL *target)
// don't increase speed // don't increase speed
clamp(modif, 0.0, 1.0); clamp(modif, 0.0, 1.0);
speed *= modif; speed *= modif;
speed *= _SpeedServerAdjust;
// Move // Move
_HasMoved = true; _HasMoved = true;
_Primitive->move(speed, dynamicWI); _Primitive->move(speed, dynamicWI);
@ -1227,6 +1228,7 @@ void CUserEntity::applyMotion(CEntityCL *target)
// Third Person View // Third Person View
else else
{ {
speed *= _SpeedServerAdjust;
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));
@ -1243,6 +1245,9 @@ void CUserEntity::applyMotion(CEntityCL *target)
mount->_Stages.addStage(NetMngr.getCurrentClientTick()+time, CLFECOMMON::PROPERTY_POSZ, z); mount->_Stages.addStage(NetMngr.getCurrentClientTick()+time, CLFECOMMON::PROPERTY_POSZ, z);
} }
} }
_SpeedServerAdjust += 0.05;
clamp(_SpeedServerAdjust, 0.8, 1.0);
}// applyMotion // }// applyMotion //

@ -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) {_SpeedServerAdjust = 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();
@ -423,6 +425,7 @@ public:
void tp(const NLMISC::CVectorD &dest); void tp(const NLMISC::CVectorD &dest);
/// Teleport the player to correct his position. /// Teleport the player to correct his position.
void correctPos(const NLMISC::CVectorD &dest); void correctPos(const NLMISC::CVectorD &dest);
/// Skill Up /// Skill Up
void skillUp(); void skillUp();
/// get the level of the player (max of all skills) /// get the level of the player (max of all skills)
@ -545,6 +548,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…
Cancel
Save