Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/client/client.cc6
-rw-r--r--src/client/console.cc45
-rw-r--r--src/client/view.cc11
-rw-r--r--src/core/application.cc7
-rw-r--r--src/core/commandbuffer.cc13
-rw-r--r--src/core/cvar.cc3
-rw-r--r--src/core/cvar.h1
-rw-r--r--src/core/gameconnection.cc4
-rw-r--r--src/core/netconnection.cc4
-rw-r--r--src/game/ship.cc2
-rw-r--r--src/model/map.cc2
11 files changed, 57 insertions, 41 deletions
diff --git a/src/client/client.cc b/src/client/client.cc
index 6a4d23e..97c0128 100644
--- a/src/client/client.cc
+++ b/src/client/client.cc
@@ -91,13 +91,13 @@ void Client::init(int count, char **arguments)
// client variables
core::Cvar *cvar = 0;
cvar = core::Cvar::get("cl_name", "Player", core::Cvar::Archive | core::Cvar::Info);
- cvar->set_info("[str] client player name");
+ cvar->set_info("[str] player name");
cvar = core::Cvar::get("cl_color", "1.0 1.0 1.0", core::Cvar::Archive | core::Cvar::Info);
- cvar->set_info("[r g b] client player clor");
+ cvar->set_info("[r g b] player color");
cl_framerate = core::Cvar::get("cl_framerate", "120", core::Cvar::Archive);
- cl_framerate->set_info("client framerate in frames/sec");
+ cl_framerate->set_info("[int] client framerate in frames/sec");
// initialize SDL, but do not initialize any subsystems
SDL_Init(0);
diff --git a/src/client/console.cc b/src/client/console.cc
index b60e179..4c65581 100644
--- a/src/client/console.cc
+++ b/src/client/console.cc
@@ -82,6 +82,14 @@ void func_con_toggle(std::string const &args)
//--- public ------------------------------------------------------
+void clear_notify()
+{
+ for (size_t i=0; i < MAXNOTIFYLINES; i++) {
+ notify_text[i].clear();
+ notify_time[i] = 0;
+ }
+}
+
void init()
{
con_print << "^BInitializing console..." << std::endl;
@@ -89,8 +97,10 @@ void init()
console_visible = false;
// add engine functions
- core::Func::add("con_toggle", (core::FuncPtr) func_con_toggle);
-
+ core::Func *func = core::Func::add("con_toggle", (core::FuncPtr) func_con_toggle);
+ func->set_info("toggle console on or off");
+
+ clear_notify();
text.clear();
console_scroll = 0;
@@ -118,19 +128,13 @@ void shutdown()
input_pos = 0;
}
-void clear_notify()
-{
- for (size_t i=0; i < MAXNOTIFYLINES; i++)
- notify_time[i] = 0;
-}
-
void draw_notify()
{
using namespace render;
// draw notifications
Text::setcolor('N');
- size_t width = (size_t) ((video::width - 8) / Text::fontwidth());
+ size_t width = (size_t) ((video::width-8) / Text::fontwidth());
size_t n = notify_pos % MAXNOTIFYLINES;
float h = 4 + 2*Text::fontheight();
for (size_t l = 0; l < MAXNOTIFYLINES; l++) {
@@ -227,31 +231,32 @@ void draw_console()
float con_height = 0.70f;
- // draw version below the bottom of the console
- std::string version(core::name());
- version += ' ';
- version.append(core::version());
- gl::color(0.0f, 1.0f, 0.0f, 0.5f);
- Text::draw(video::width-Text::fontwidth()*(version.size()+1), video::height*con_height-Text::fontheight()-4, version);
gl::disable(GL_TEXTURE_2D);
// draw the transparent console background
- gl::color(1.0f, 1.0f, 1.0f, 0.02f);
+ gl::color(0.0f, 0.0f, 0.0f, 0.5f);
gl::begin(gl::Quads);
gl::vertex(0.0f, 0.0f, 0.0f);
gl::vertex(video::width, 0.0f,0.0f);
gl::vertex(video::width,video::height*con_height,0.0f);
gl::vertex(0,video::height*con_height,0.0f);
gl::end();
-
+
+ gl::enable(GL_TEXTURE_2D);
+
+ // draw version below the bottom of the console
+ std::string version(core::name());
+ version += ' ';
+ version.append(core::version());
+ gl::color(0.0f, 1.0f, 0.0f, 0.5f);
+ Text::draw(video::width-Text::fontwidth()*(version.size()+1), video::height*con_height-Text::fontheight()-4, version);
+
// draw the console text
if (console_scroll > text.size())
console_scroll = text.size();
-
- gl::enable(GL_TEXTURE_2D);
size_t height = (size_t) (video::height * con_height / Text::fontheight()) -1;
- size_t width = (size_t) (video::width / Text::fontwidth()) -2;
+ size_t width = (size_t) ((video::width-8) / Text::fontwidth());
size_t bottom = text.size() - console_scroll;
size_t current_line = 0;
diff --git a/src/client/view.cc b/src/client/view.cc
index 0fa47d4..63c373e 100644
--- a/src/client/view.cc
+++ b/src/client/view.cc
@@ -29,7 +29,7 @@ namespace client
{
core::Cvar *draw_stats = 0;
-core::Cvar *draw_crosshaircolor = 0;
+core::Cvar *cl_crosshaircolor = 0;
namespace view
{
@@ -41,7 +41,10 @@ void init()
camera::init();
draw_stats = core::Cvar::get("draw_stats", "0", core::Cvar::Archive);
- draw_crosshaircolor = core::Cvar::get("draw_crosshaircolor", "1 1 1", core::Cvar::Archive);
+ draw_stats->set_info("[bool] draw network and render statistics");
+
+ cl_crosshaircolor = core::Cvar::get("cl_crosshaircolor", "1 1 1", core::Cvar::Archive);
+ cl_crosshaircolor->set_info("[r g b] crosshairs color");
}
void shutdown()
@@ -180,8 +183,8 @@ void draw_cursor()
render::Textures::bind("bitmaps/crosshair");
math::Color color;
- if (draw_crosshaircolor && draw_crosshaircolor->value()) {
- std::stringstream colorstr(draw_crosshaircolor->str());
+ if (cl_crosshaircolor && cl_crosshaircolor->value()) {
+ std::stringstream colorstr(cl_crosshaircolor->str());
colorstr >> color;
}
diff --git a/src/core/application.cc b/src/core/application.cc
index 2f8cc54..79f4a28 100644
--- a/src/core/application.cc
+++ b/src/core/application.cc
@@ -153,6 +153,9 @@ void Application::init(int count, char **arguments)
Cvar::net_timeout = Cvar::get("net_timeout", "20", Cvar::Archive);
Cvar::net_timeout->set_info("[int] network timeout in seconds");
+ Cvar::net_framerate = Cvar::get("net_framerate", "25", Cvar::Archive);
+ Cvar::net_framerate->set_info("[int] network framerate in frames/sec");
+
#ifdef _WIN32
// Initialize win32 socket library
WSADATA wsa_data;
@@ -294,6 +297,8 @@ void Application::save_config()
return;
}
+ con_print << " writing configuration to " << filename << std::endl;
+
if (!Cvar::sv_dedicated->value())
ofs << "# client.cfg - osirion client configuration" << std::endl;
else
@@ -324,6 +329,8 @@ void Application::load_config()
return;
}
+ con_print << " reading configuration from " << filename << std::endl;
+
char line[MAXCMDSIZE];
while (ifs.getline(line, MAXCMDSIZE-1)) {
if (line[0] && line[0] != '#' && line[0] != ';')
diff --git a/src/core/commandbuffer.cc b/src/core/commandbuffer.cc
index e97a00e..d1c9451 100644
--- a/src/core/commandbuffer.cc
+++ b/src/core/commandbuffer.cc
@@ -42,18 +42,17 @@ void func_set(std::string const &args)
if (!(argstream >> varname))
return;
- // we're setting a new value
std::string value;
- if (!(argstream >> value))
+ if (!(argstream >> value)) {
return;
+ }
char c;
while (argstream.get(c))
value += c;
-
Cvar *cvar = Cvar::set(varname.c_str(), value.c_str(), Cvar::Archive);
-
- con_print << cvar->name() << " " << cvar->str() << "\n";
+
+ con_print << " " << cvar->name() << " " << cvar->str() << "\n";
if (cvar->flags() && Cvar::Info) {
localplayer()->player_dirty = true;
@@ -153,7 +152,7 @@ void CommandBuffer::exec(std::string const &cmdline)
}
}
- con_print << command << " " << cvar->str() << " ^N" << cvar->info() << "\n";
+ con_print << " " << command << " " << cvar->str() << " ^N" << cvar->info() << "\n";
return;
}
@@ -253,7 +252,7 @@ void CommandBuffer::exec_file(std::string const & filename)
return;
}
- con_debug << "Executing " << fn.c_str() << std::endl;
+ con_print << "Executing " << fn.c_str() << std::endl;
char line[MAXCMDSIZE];
while (ifs.getline(line, MAXCMDSIZE-1)) {
diff --git a/src/core/cvar.cc b/src/core/cvar.cc
index 4571240..7593ac3 100644
--- a/src/core/cvar.cc
+++ b/src/core/cvar.cc
@@ -25,6 +25,7 @@ Cvar *Cvar::net_host = 0;
Cvar *Cvar::net_port = 0;
Cvar *Cvar::net_maxclients = 0;
Cvar *Cvar::net_timeout = 0;
+Cvar *Cvar::net_framerate = 0;
std::map<std::string, Cvar*> Cvar::registry;
@@ -180,7 +181,7 @@ void Cvar::list()
typeindicator += ' ';
con_print << " " << typeindicator <<
- " " << (*it).first << " " << (*it).second->str() << " " << (*it).second->info() << std::endl;
+ " " << (*it).first << " " << (*it).second->str() << " ^N" << (*it).second->info() << std::endl;
}
con_print << registry.size() << " registered variables" << std::endl;
}
diff --git a/src/core/cvar.h b/src/core/cvar.h
index e45839f..4125d3c 100644
--- a/src/core/cvar.h
+++ b/src/core/cvar.h
@@ -117,6 +117,7 @@ public:
static Cvar *net_port; // network port
static Cvar *net_maxclients;// maximum number of connected clients
static Cvar *net_timeout; // network timeout in seconds
+ static Cvar *net_framerate; // client network send framerate
private:
std::string cvar_name;
std::string cvar_info;
diff --git a/src/core/gameconnection.cc b/src/core/gameconnection.cc
index e77a3d8..1d022c5 100644
--- a/src/core/gameconnection.cc
+++ b/src/core/gameconnection.cc
@@ -97,8 +97,8 @@ void GameConnection::frame(float seconds)
connection_frametime += seconds;
float f = 0;
- if (core::Cvar::sv_framerate->value()) {
- f = 0.5f / core::Cvar::sv_framerate->value();
+ if (core::Cvar::net_framerate->value()) {
+ f = 0.5f / core::Cvar::net_framerate->value();
if (connection_frametime < f) {
return;
}
diff --git a/src/core/netconnection.cc b/src/core/netconnection.cc
index 55480d2..2bcd6dc 100644
--- a/src/core/netconnection.cc
+++ b/src/core/netconnection.cc
@@ -141,7 +141,7 @@ void NetConnection::receive()
connection_timeout = core::application()->time();
if (bytes_received == 0) {
- con_print << "Disconnected.";
+ con_print << "^BDisconnected.";
abort();
return;
} else if (bytes_received < 0) {
@@ -296,7 +296,7 @@ void NetConnection::parse_incoming_message(const std::string & message)
} else if (command == "connect") {
connection_state = Connected;
- con_print << "Connected." << std::endl;
+ con_print << "^BConnected." << std::endl;
return;
} else if (command == "disconnect") {
diff --git a/src/game/ship.cc b/src/game/ship.cc
index e864aba..bf71215 100644
--- a/src/game/ship.cc
+++ b/src/game/ship.cc
@@ -21,7 +21,7 @@ Ship::Ship(core::Player *owner, ShipModel *shipmodel) :
core::EntityControlable(owner, ship_enttype)
{
entity_modelname = "ships/" + shipmodel->modelname();
- entity_name = shipmodel->name() + ": <" + owner->name() + ">";
+ entity_name = shipmodel->name() + ": <^B" + owner->name() + "^N>";
ship_shipmodel = shipmodel;
entity_moduletypeid = ship_enttype;
diff --git a/src/model/map.cc b/src/model/map.cc
index 618db79..03ebe69 100644
--- a/src/model/map.cc
+++ b/src/model/map.cc
@@ -172,7 +172,7 @@ Model * Map::load(std::string const &name)
}
- con_debug << " maps/" << model->name() << ".map " << mapfile.brushes << " brush " << model->tris()
+ con_print << " maps/" << model->name() << ".map " << mapfile.brushes << " brush " << model->tris()
<< " tris (" << model->details() << " detail)" << std::endl;
return model;