Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
Diffstat (limited to 'src/core')
-rw-r--r--src/core/gameinterface.cc68
-rw-r--r--src/core/gameinterface.h2
-rw-r--r--src/core/gameserver.cc3
3 files changed, 40 insertions, 33 deletions
diff --git a/src/core/gameinterface.cc b/src/core/gameinterface.cc
index ecb58fc..70224b0 100644
--- a/src/core/gameinterface.cc
+++ b/src/core/gameinterface.cc
@@ -152,39 +152,43 @@ void GameInterface::update_entity_clientstate(Entity *entity)
if (game_clientframetime <= game_serverframetime) {
- entity->state()->state_axis.assign(entity->state()->previousaxis());
-
- float cosangle; // cosine of an angle
- float angle; // angle in radians
- math::Vector3f n; // normal of a plane
-
- n.assign(math::crossproduct( entity->state()->axis().forward(), entity->axis().forward()));
- if (!(n.length() < MIN_DELTA)) {
- n.normalize();
- cosangle = math::dotproduct( entity->state()->axis().forward(), entity->axis().forward());
- angle = acos(cosangle) * timeoffset(); // * 180.0f / M_PI;
- if (angle > MIN_DELTA)
- entity->state()->state_axis.rotate(n, -angle);
- }
- /*
- n.assign(math::crossproduct( entity->state()->axis().left(), entity->axis().left()));
- if (!(n.length() < MIN_DELTA)) {
- n.normalize();
- cosangle = math::dotproduct( entity->state()->axis().left(), entity->axis().left());
- angle = acos(cosangle) * timeoffset(); // * 180.0f / M_PI;
- if (angle > MIN_DELTA)
- entity->state()->state_axis.rotate(n, -angle);
+ if(Cvar::cl_prediction->value() > 1) {
+ entity->state()->state_axis.assign(entity->state()->previousaxis());
+
+ float cosangle; // cosine of an angle
+ float angle; // angle in radians
+ math::Vector3f n; // normal of a plane
+
+ n.assign(math::crossproduct( entity->state()->axis().forward(), entity->axis().forward()));
+ if (!(n.length() < MIN_DELTA)) {
+ n.normalize();
+ cosangle = math::dotproduct( entity->state()->axis().forward(), entity->axis().forward());
+ angle = acos(cosangle) * timeoffset(); // * 180.0f / M_PI;
+ if (angle > MIN_DELTA)
+ entity->state()->state_axis.rotate(n, -angle);
+ }
+ /*
+ n.assign(math::crossproduct( entity->state()->axis().left(), entity->axis().left()));
+ if (!(n.length() < MIN_DELTA)) {
+ n.normalize();
+ cosangle = math::dotproduct( entity->state()->axis().left(), entity->axis().left());
+ angle = acos(cosangle) * timeoffset(); // * 180.0f / M_PI;
+ if (angle > MIN_DELTA)
+ entity->state()->state_axis.rotate(n, -angle);
+ }
+
+ n.assign(math::crossproduct( entity->state()->axis().up(), entity->axis().up()));
+ if (!(n.length() < MIN_DELTA)) {
+ n.normalize();
+ cosangle = math::dotproduct( entity->state()->axis().up(), entity->axis().up());
+ angle = acos(cosangle) * timeoffset(); // * 180.0f / M_PI;
+ if (angle > MIN_DELTA)
+ entity->state()->state_axis.rotate(n, -angle);
+ }
+ */
+ } else {
+ entity->state()->state_axis.assign(entity->axis());
}
-
- n.assign(math::crossproduct( entity->state()->axis().up(), entity->axis().up()));
- if (!(n.length() < MIN_DELTA)) {
- n.normalize();
- cosangle = math::dotproduct( entity->state()->axis().up(), entity->axis().up());
- angle = acos(cosangle) * timeoffset(); // * 180.0f / M_PI;
- if (angle > MIN_DELTA)
- entity->state()->state_axis.rotate(n, -angle);
- }
- */
} else {
entity->state()->state_axis.assign(entity->axis());
}
diff --git a/src/core/gameinterface.h b/src/core/gameinterface.h
index 19c6886..ef51545 100644
--- a/src/core/gameinterface.h
+++ b/src/core/gameinterface.h
@@ -31,7 +31,7 @@ public:
inline float serverframetime() const { return game_serverframetime; }
/// return the server time of the previous received server frame
- inline float previousframetime() const { return game_serverframetime; }
+ inline float previousframetime() const { return game_previousframetime; }
/// return the server time of the previous received server frame
inline float clientframetime() const { return game_clientframetime; }
diff --git a/src/core/gameserver.cc b/src/core/gameserver.cc
index 5e1165d..14f97bb 100644
--- a/src/core/gameserver.cc
+++ b/src/core/gameserver.cc
@@ -541,6 +541,9 @@ void GameServer::frame(float seconds)
// copy the previous entity state to the client state
if (!Cvar::sv_dedicated->value()) {
reset_clientstate(server_time, server_previoustime);
+ } else {
+ game_serverframetime = server_time;
+ game_previousframetime = server_previoustime;
}
// run a time frame on each entity