Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'src/client')
-rw-r--r--src/client/camera.cc14
-rw-r--r--src/client/client.cc4
-rw-r--r--src/client/client.h2
-rw-r--r--src/client/draw.cc4
-rw-r--r--src/client/input.cc29
-rw-r--r--src/client/video.cc5
6 files changed, 30 insertions, 28 deletions
diff --git a/src/client/camera.cc b/src/client/camera.cc
index dcf4acf..d9aa16e 100644
--- a/src/client/camera.cc
+++ b/src/client/camera.cc
@@ -82,7 +82,7 @@ void set_mode(Mode newmode) {
case Track:
// switch camera to Track mode
mode = Track;
- yaw_target = core::game()->localplayer()->control->direction();
+ yaw_target = core::localcontrol()->direction();
yaw_current = yaw_target;
pitch_target = pitch_track;
pitch_current = pitch_target;
@@ -91,7 +91,7 @@ void set_mode(Mode newmode) {
case Free:
// switch camera to Free mode
mode = Free;
- yaw_target = core::game()->localplayer()->control->direction();
+ yaw_target = core::localcontrol()->direction();
yaw_current = yaw_target;
pitch_target = pitch_track;
pitch_current = pitch_target;
@@ -112,7 +112,7 @@ void set_mode(Mode newmode) {
void next_mode()
{
- if (!core::game()->localplayer()->control) {
+ if (!core::localcontrol()) {
set_mode(Overview);
return;
}
@@ -133,20 +133,22 @@ void next_mode()
void draw(float elapsed)
{
- if (!core::game()->localplayer()->control) {
+ if (!core::localcontrol()) {
// switch the camera to Overview of the player is not controling anything
if (mode != Overview) {
set_mode(Overview);
+
+ camera::target = math::Vector3f(0,0,0);
}
} else {
if (mode == Overview)
set_mode(Track);
- camera::target = core::game()->localplayer()->control->location();
+ camera::target = core::localcontrol()->location();
}
if (mode == Track) {
- yaw_target = core::game()->localplayer()->control->direction();
+ yaw_target = core::localcontrol()->direction();
}
if ((mode == Free) || (mode == Track)) {
diff --git a/src/client/client.cc b/src/client/client.cc
index 19d6f3e..4874e55 100644
--- a/src/client/client.cc
+++ b/src/client/client.cc
@@ -87,6 +87,10 @@ void Client::init()
core::Cvar::sv_dedicated = core::Cvar::set("sv_private", "0");
core::Application::init();
+ // client variables
+ core::Cvar::get("cl_name", "Player");
+ core::Cvar::get("cl_color", "1.0 1.0 1.0");
+
// initialize SDL, but do not initialize any subsystems
SDL_Init(0);
diff --git a/src/client/client.h b/src/client/client.h
index ee2e7af..2113202 100644
--- a/src/client/client.h
+++ b/src/client/client.h
@@ -13,7 +13,7 @@ namespace client {
/// the client main loop
void main(int count, char **arguments);
-} // namespace client
+}
#endif // __INCLUDED_CLIENT_H__
diff --git a/src/client/draw.cc b/src/client/draw.cc
index 60726b0..11d4aa7 100644
--- a/src/client/draw.cc
+++ b/src/client/draw.cc
@@ -104,12 +104,14 @@ void draw_ship(core::EntityControlable *entity)
Vector3f br(-0.25, -0.125, -0.125);
Box box(tl, br);
+ box.topcolor = entity->color();
+ box.bottomcolor = entity->color() * 0.7;
box.draw();
tl = Vector3f(0, 0.07, 0.25);
br = Vector3f(-0.5, -0.07, 0.125);
Box engine1(tl, br);
- engine1.topcolor = Color(0.7, 0.7, 0.7);
+ engine1.topcolor = Color(0.7, 0.7, 0.7);
engine1.bottomcolor = engine1.topcolor * 0.5;
engine1.draw();
diff --git a/src/client/input.cc b/src/client/input.cc
index 7193c0e..5dda3fb 100644
--- a/src/client/input.cc
+++ b/src/client/input.cc
@@ -24,17 +24,6 @@ float local_turn;
// local thrust setting
float local_thrust;
-core::Player *localplayer() {
- return core::game()->localplayer();
-}
-
-core::EntityControlable *localcontrol() {
- if (core::game()->localplayer())
- return core::game()->localplayer()->control;
- else
- return 0;
-}
-
void init()
{
con_print << "Initializing input..." << std::endl;
@@ -89,8 +78,8 @@ void keypressed(const SDL_keysym &keysym)
case SDLK_KP4:
// TODO set core entity params
local_turn += 5;
- if (math::degrees180f(local_turn - localcontrol()->direction()) > 90)
- local_turn = localcontrol()->direction() + 90;
+ if (math::degrees180f(local_turn - core::localcontrol()->direction()) > 90)
+ local_turn = core::localcontrol()->direction() + 90;
if (local_turn > 360)
local_turn -= 360;
@@ -98,8 +87,8 @@ void keypressed(const SDL_keysym &keysym)
case SDLK_KP6:
// TODO set core entity params
local_turn -= 5;
- if (math::degrees180f(local_turn - localcontrol()->direction()) < -90)
- local_turn = localcontrol()->direction() - 90;
+ if (math::degrees180f(local_turn - core::localcontrol()->direction()) < -90)
+ local_turn = core::localcontrol()->direction() - 90;
if (local_turn < 0)
local_turn += 360;
break;
@@ -117,7 +106,7 @@ void frame(float seconds)
switch (event.type) {
case SDL_KEYUP:
- if (!console::visible() && core::application()->connected() && localcontrol())
+ if (!console::visible() && core::application()->connected() && core::localcontrol())
// send key events to the game world
keyreleased(event.key.keysym);
break;
@@ -127,7 +116,7 @@ void frame(float seconds)
} else if (console::visible()) {
// send key events to the console
console::keypressed(event.key.keysym);
- } else if (core::application()->connected() && localcontrol()) {
+ } else if (core::application()->connected() && core::localcontrol()) {
// send key events to the game world
keypressed(event.key.keysym);
}
@@ -139,9 +128,9 @@ void frame(float seconds)
}
- if (!console::visible() && core::application()->connected() && localcontrol()) {
- localcontrol()->set_thrust(local_thrust);
- localcontrol()->set_direction(local_turn);
+ if (!console::visible() && core::application()->connected() && core::localcontrol()) {
+ core::localcontrol()->set_thrust(local_thrust);
+ core::localcontrol()->set_direction(local_turn);
}
}
diff --git a/src/client/video.cc b/src/client/video.cc
index dfdf511..86fca89 100644
--- a/src/client/video.cc
+++ b/src/client/video.cc
@@ -105,6 +105,11 @@ bool init()
(*r_width) = width;
(*r_height) = height;
+ std::string version(core::name());
+ version += ' ';
+ version.append(core::version());
+ SDL_WM_SetCaption(version.c_str(), 0);
+
render::init();
video::reset();