From 70fc89d31b81a0cc49fc4b8daf527dd187544d9e Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Sun, 8 Jun 2008 18:39:17 +0000 Subject: disable client prediction by default, add --without-client option to configure --- src/Makefile.am | 14 +++++++++-- src/core/application.cc | 2 +- src/core/gameinterface.cc | 4 ++-- src/model/engine.cc | 2 ++ src/model/engine.h | 2 ++ src/model/map.cc | 4 +++- src/render/draw.cc | 61 +++++++++++++++++++++++++++-------------------- 7 files changed, 57 insertions(+), 32 deletions(-) (limited to 'src') diff --git a/src/Makefile.am b/src/Makefile.am index 37e1b2e..9c55179 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -4,10 +4,20 @@ SUFFIXES = .rc .rc.o: windres $< -o $@ -SUBDIRS = sys math auxiliary filesystem model core server audio render client \ - game +if BUILD_CLIENT + MAYBE_CLIENT_SUBDIRS = audio render client + MAYBE_CLIENT_PROGRAMS = osirion +endif + +SUBDIRS = sys math auxiliary filesystem model core server $(MAYBE_CLIENT_SUBDIRS) game + noinst_HEADERS = config.h + +if BUILD_CLIENT bin_PROGRAMS = osiriond osirion +else +bin_PROGRAMS = osiriond +endif # dedicated server osiriond_SOURCES = osiriond.cc diff --git a/src/core/application.cc b/src/core/application.cc index fb82c6c..738a071 100644 --- a/src/core/application.cc +++ b/src/core/application.cc @@ -132,7 +132,7 @@ void Application::init(int count, char **arguments) Cvar::sv_private = Cvar::get("sv_private", "0"); 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 = Cvar::get("cl_prediction", "0", Cvar::Archive); Cvar::cl_prediction->set_info("[bool] enable or disable client prediction"); // load configuration diff --git a/src/core/gameinterface.cc b/src/core/gameinterface.cc index cfa557b..4aa59be 100644 --- a/src/core/gameinterface.cc +++ b/src/core/gameinterface.cc @@ -244,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/model/engine.cc b/src/model/engine.cc index 1a89ea2..7c8d117 100644 --- a/src/model/engine.cc +++ b/src/model/engine.cc @@ -16,6 +16,8 @@ Engine::Engine() : engine_location() { engine_radius = 1.0f; + engine_flare = 0; + engine_color.assign(1.0f, 0.0f, 0.0f , 1.0f); } Engine::Engine(math::Vector3f const & location) : diff --git a/src/model/engine.h b/src/model/engine.h index 5254973..569eb4e 100644 --- a/src/model/engine.h +++ b/src/model/engine.h @@ -23,6 +23,8 @@ public: inline math::Vector3f const & location() const { return engine_location; } + inline math::Color const & color() const { return engine_color; } + inline float radius() const { return engine_radius; } inline unsigned int flare() const { return engine_flare; } diff --git a/src/model/map.cc b/src/model/map.cc index 6769ba8..39e2b9c 100644 --- a/src/model/map.cc +++ b/src/model/map.cc @@ -138,7 +138,9 @@ Model * Map::load(std::string const &name) } else if (mapfile.got_key_int("flare", engine->engine_flare)) { continue; - } + } else if (mapfile.got_key_color("_color", engine->engine_color)) { + continue; + } } } diff --git a/src/render/draw.cc b/src/render/draw.cc index f3df6c0..448b2ce 100644 --- a/src/render/draw.cc +++ b/src/render/draw.cc @@ -232,14 +232,26 @@ void pass_prepare(float seconds) for (std::list::iterator lit = entity->model()->model_light.begin(); lit != entity->model()->model_light.end(); lit++) { model::Light *light = (*lit); - // load flare texture + // load light texture // FIXME optimize std::stringstream flarename; flarename << "bitmaps/fx/flare" << std::setfill('0') << std::setw(2) << light->flare(); light->render_texture = Textures::load(flarename.str()); } - for (std::list::iterator flit = entity->model()->model_flare.begin(); flit != entity->model()->model_flare.end(); flit++) { + for(std::list::iterator eit = entity->model()->model_engine.begin(); eit != entity->model()->model_engine.end(); eit++) { + model::Engine *engine = (*eit); + + if (!engine->flare()) engine->engine_flare = 1; + + // load engine texture + // FIXME optimize + std::stringstream flarename; + flarename << "bitmaps/fx/flare" << std::setfill('0') << std::setw(2) << engine->flare(); + engine->render_texture = Textures::load(flarename.str()); + } + + for (std::list::iterator flit = entity->model()->model_flare.begin(); flit != entity->model()->model_flare.end(); flit++) { model::Flare *flare = (*flit); // load flare texture @@ -444,7 +456,6 @@ void draw_pass_model_fx() float t; size_t flare_texture = Textures::bind("bitmaps/fx/flare00"); - size_t engine_texture = Textures::find("bitmaps/fx/flare01"); gl::enable(GL_TEXTURE_2D); @@ -464,20 +475,22 @@ void draw_pass_model_fx() t = (core::application()->time() + entity->state()->fuzz() - (*lit)->offset()) * (*lit)->frequency(); if (!(*lit)->strobe() || (( t - floorf(t)) <= (*lit)->time())) { - math::Vector3f location = entity->state()->location() + (entity->state()->axis() * (*lit)->location()); + model::Light *light = (*lit); + + math::Vector3f location = entity->state()->location() + (entity->state()->axis() * light->location()); float light_size = 0.0625 * (*lit)->radius(); - if ((*lit)->render_texture != flare_texture) { + if (flare_texture != light->texture()) { gl::end(); - flare_texture = Textures::bind((*lit)->render_texture); + flare_texture = Textures::bind(light->texture()); gl::begin(gl::Quads); } math::Color color; - if ((*lit)->entity()) { + if (light->entity()) { color.assign(entity->color()); } else { - color.assign((*lit)->color()); + color.assign(light->color()); } color.a = 0.8; gl::color(color); @@ -514,9 +527,9 @@ void draw_pass_model_fx() math::Vector3f location = entity->state()->location() + (entity->state()->axis() * flare->location()); float light_size = 0.0625 * flare->radius(); - if (flare->render_texture != flare_texture) { + if (flare_texture != flare->texture()) { gl::end(); - flare_texture = Textures::bind(flare->render_texture); + flare_texture = Textures::bind(flare->texture()); gl::begin(gl::Quads); } @@ -550,26 +563,22 @@ void draw_pass_model_fx() // draw model engines for Controlable entities if (entity->type() == core::Entity::Controlable && entity->model()->model_engine.size()) { - if (flare_texture != engine_texture) { - gl::end(); - flare_texture = Textures::bind(engine_texture); - gl::begin(gl::Quads); - } - float u = static_cast(entity)->thrust(); - t = entity->state()->fuzz() + core::application()->time() * 4; - - t = t - floorf(t); - if (t > 0.5) - t = 1-t; - t = 0.75f + t/2; - for(std::list::iterator eit = entity->model()->model_engine.begin(); eit != entity->model()->model_engine.end(); eit++) { - math::Vector3f location = entity->state()->location() + (entity->state()->axis() * (*eit)->location()); - float engine_size = 0.0625 * (*eit)->radius() * t; - math::Color color(1.0f, 0.0f, 0.0f, 0.9f * u); + model::Engine *engine = (*eit); + + math::Vector3f location = entity->state()->location() + (entity->state()->axis() * engine->location()); + float engine_size = 0.0625 * engine->radius(); + math::Color color(engine->color()); + color.a = 0.9f * u; + + if (flare_texture != engine->texture() ) { + gl::end(); + flare_texture = Textures::bind(engine->texture()); + gl::begin(gl::Quads); + } gl::color(color); glTexCoord2f(0,1); -- cgit v1.2.3