Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--osirion.kdevelop.pcsbin757250 -> 757694 bytes
-rw-r--r--osirion.kdevses21
-rw-r--r--src/core/application.cc5
-rw-r--r--src/core/cvar.cc2
-rw-r--r--src/core/cvar.h2
-rw-r--r--src/core/gameinterface.cc33
-rw-r--r--src/render/camera.cc14
7 files changed, 38 insertions, 39 deletions
diff --git a/osirion.kdevelop.pcs b/osirion.kdevelop.pcs
index a51e0e4..5125b19 100644
--- a/osirion.kdevelop.pcs
+++ b/osirion.kdevelop.pcs
Binary files differ
diff --git a/osirion.kdevses b/osirion.kdevses
index 1533cd9..e8415d1 100644
--- a/osirion.kdevses
+++ b/osirion.kdevses
@@ -1,26 +1,7 @@
<?xml version = '1.0' encoding = 'UTF-8'?>
<!DOCTYPE KDevPrjSession>
<KDevPrjSession>
- <DocsAndViews NumberOfDocuments="6" >
- <Doc0 NumberOfViews="1" URL="file:///home/ingar/projects/osirion/osirion-work/src/core/application.cc" >
- <View0 Encoding="" line="358" Type="Source" />
- </Doc0>
- <Doc1 NumberOfViews="1" URL="file:///home/ingar/projects/osirion/osirion-work/src/client/keyboard.cc" >
- <View0 Encoding="" line="183" Type="Source" />
- </Doc1>
- <Doc2 NumberOfViews="1" URL="file:///home/ingar/projects/osirion/osirion-work/src/client/keyboard.h" >
- <View0 Encoding="" line="36" Type="Source" />
- </Doc2>
- <Doc3 NumberOfViews="1" URL="file:///home/ingar/projects/osirion/osirion-work/src/client/input.cc" >
- <View0 Encoding="" line="488" Type="Source" />
- </Doc3>
- <Doc4 NumberOfViews="1" URL="file:///home/ingar/projects/osirion/osirion-work/src/client/view.cc" >
- <View0 Encoding="" line="211" Type="Source" />
- </Doc4>
- <Doc5 NumberOfViews="1" URL="file:///home/ingar/projects/osirion/osirion-work/src/render/camera.cc" >
- <View0 Encoding="" line="264" Type="Source" />
- </Doc5>
- </DocsAndViews>
+ <DocsAndViews NumberOfDocuments="0" />
<pluginList>
<kdevdebugger>
<breakpointList/>
diff --git a/src/core/application.cc b/src/core/application.cc
index 09b3f61..fb82c6c 100644
--- a/src/core/application.cc
+++ b/src/core/application.cc
@@ -130,7 +130,10 @@ void Application::init(int count, char **arguments)
// client can set this to 1
Cvar::sv_private = Cvar::get("sv_private", "0");
- Cvar::sv_private->set_info("[bool] indicates the client runs a networked server");
+ Cvar::sv_private->set_info("[bool] enable or disable network server for a client");
+
+ Cvar::cl_prediction = Cvar::get("cl_prediction", "1", Cvar::Archive);
+ Cvar::cl_prediction->set_info("[bool] enable or disable client prediction");
// load configuration
load_config();
diff --git a/src/core/cvar.cc b/src/core/cvar.cc
index 83ec5c4..9d90afd 100644
--- a/src/core/cvar.cc
+++ b/src/core/cvar.cc
@@ -23,6 +23,8 @@ Cvar *Cvar::sv_private = 0;
Cvar *Cvar::sv_framerate = 0;
Cvar *Cvar::sv_name = 0;
+Cvar *Cvar::cl_prediction = 0;
+
Cvar *Cvar::net_host = 0;
Cvar *Cvar::net_port = 0;
Cvar *Cvar::net_maxclients = 0;
diff --git a/src/core/cvar.h b/src/core/cvar.h
index fceb79b..620096b 100644
--- a/src/core/cvar.h
+++ b/src/core/cvar.h
@@ -116,6 +116,8 @@ public:
static Cvar *con_ansi; // console ANSI colors
+ static Cvar *cl_prediction; // client prediction
+
static Cvar *net_host; // network server ip (default binds to all interfaces)
static Cvar *net_port; // network port
static Cvar *net_maxclients;// maximum number of connected clients
diff --git a/src/core/gameinterface.cc b/src/core/gameinterface.cc
index f50c1cc..cfa557b 100644
--- a/src/core/gameinterface.cc
+++ b/src/core/gameinterface.cc
@@ -128,17 +128,23 @@ void GameInterface::update_entity_clientstate(Entity *entity)
entity->entity_clientstate->assign(entity);
}
- if (!(entity->flags() & core::Entity::Static))
+ if(Cvar::cl_prediction->value() == 0) {
+
+ entity->state()->state_axis.assign(entity->axis());
+ entity->state()->state_location.assign(entity->location());
return;
+ }
+
+ if (!(entity->flags() & core::Entity::Static)) {
- if (game_clientframetime < game_serverframetime) {
+ // clientstate location
+ entity->state()->state_location = entity->state()->previouslocation() +
+ (entity->location() - entity->state()->previouslocation()) * timeoffset();
+
+ if (game_clientframetime < game_serverframetime) {
- if (!(entity->flags() & core::Entity::Static)) {
-
- // clientstate location
- entity->state()->state_location = entity->state()->previouslocation() +
- (entity->location() - entity->state()->previouslocation()) * timeoffset();
-
+ //FIXME this is hopelessly broken
+
// http://local.wasp.uwa.edu.au/~pbourke/geometry/planeline/
float cosangle;
float angle;
@@ -164,7 +170,7 @@ void GameInterface::update_entity_clientstate(Entity *entity)
l = p.length();
if ((fabs(side) - MIN_DELTA > 0)) {
- cosangle = math::dotproduct(p, entity->state()->axis().up());
+ cosangle = math::dotproduct(p, entity->state()->axis().up());
if (fabs(cosangle) + MIN_DELTA < 1 ) {
angle = acos(cosangle) * 180.0f / M_PI;
angle = math::sgnf(side) * angle * timeoffset();
@@ -216,15 +222,20 @@ void GameInterface::update_entity_clientstate(Entity *entity)
}
}
+ } else {
+ entity->state()->state_axis.assign(entity->axis());
}
} else {
+
entity->state()->assign(entity);
}
}
void GameInterface::update_clientstate(float seconds)
{
+ game_clientframetime += seconds;
+
std::map<unsigned int, core::Entity *>::iterator it;
for (it=core::Entity::registry.begin(); it != core::Entity::registry.end(); it++) {
update_entity_clientstate((*it).second);
@@ -233,8 +244,8 @@ void GameInterface::update_clientstate(float seconds)
float GameInterface::timeoffset() {
- if (game_clientframetime > game_serverframetime)
- return 1;
+ //if (game_clientframetime > game_serverframetime)
+ // return 1;
float d = game_serverframetime - game_previousframetime;
if (d <= 0)
diff --git a/src/render/camera.cc b/src/render/camera.cc
index a879b82..7f1f307 100644
--- a/src/render/camera.cc
+++ b/src/render/camera.cc
@@ -181,7 +181,7 @@ void Camera::draw(float seconds)
camera_target.assign(core::localcontrol()->location());
target_axis.assign(core::localcontrol()->axis());
}
-
+
if (core::localcontrol()->model()) {
distance = core::localcontrol()->model()->radius();
} else {
@@ -193,7 +193,7 @@ void Camera::draw(float seconds)
float angle;
float side;
float u;
- const float cam_speed = seconds;
+ //const float camspeed = 90.0f * seconds; // 180 degrees per second
math::Vector3f n;
math::Vector3f p;
@@ -215,7 +215,7 @@ void Camera::draw(float seconds)
cosangle = math::dotproduct(p, camera_axis.up());
if (fabs(cosangle) + MIN_DELTA < 1 ) {
angle = acos(cosangle) * 180.0f / M_PI;
- angle = math::sgnf(side) * angle * cam_speed;
+ angle = math::sgnf(side) * angle * seconds;
camera_axis.change_pitch(-angle);
}
}
@@ -237,7 +237,7 @@ void Camera::draw(float seconds)
cosangle = math::dotproduct(p, camera_axis.forward());
if (fabs(cosangle) + MIN_DELTA < 1 ) {
angle = acos(cosangle) * 180.0f / M_PI;
- angle = math::sgnf(side) * angle * cam_speed;
+ angle = math::sgnf(side) * angle * seconds;
camera_axis.change_direction(angle);
}
}
@@ -259,16 +259,16 @@ void Camera::draw(float seconds)
cosangle = math::dotproduct(p, camera_axis.up());
if (fabs(cosangle) + MIN_DELTA < 1 ) {
angle = acos(cosangle) * 180.0f / M_PI;
- angle = math::sgnf(side) * angle * cam_speed;
+ angle = math::sgnf(side) * angle * seconds;
camera_axis.change_roll(angle);
}
}
- if (core::localcontrol()->model()) {
+/* if (core::localcontrol()->model()) {
camera_target -= (core::localcontrol()->model()->maxbbox().x + 0.1f) * camera_axis.forward();
camera_target += (core::localcontrol()->model()->maxbbox().z + 0.1f ) * camera_axis.up();
}
-
+*/
} else if (mode() == Free) {
camera_axis.assign(target_axis);