Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStijn Buys <ingar@osirion.org>2008-11-01 13:33:18 +0000
committerStijn Buys <ingar@osirion.org>2008-11-01 13:33:18 +0000
commit83d6c17799c4d448a67ab5cdad02954282fa5c94 (patch)
tree2d76abb9bb501491f78e07822ed52e8302fdd247
parenta6bceed80f1b4315f23656efeceb6fe02cc7641c (diff)
server-side model loading, initial @dock function
-rw-r--r--doc/manual.html15
-rw-r--r--src/client/input.cc10
-rw-r--r--src/client/keyboard.cc19
-rw-r--r--src/core/commandbuffer.cc36
-rw-r--r--src/core/entity.cc52
-rw-r--r--src/core/entity.h41
-rw-r--r--src/core/func.cc33
-rw-r--r--src/core/func.h16
-rw-r--r--src/core/gameserver.cc20
-rw-r--r--src/core/parser.cc3
-rw-r--r--src/game/base/base.cc17
-rw-r--r--src/game/base/ship.cc7
-rw-r--r--src/game/intro/convoy.cc2
-rw-r--r--src/game/intro/intro.cc2
-rw-r--r--src/model/engine.cc1
-rw-r--r--src/render/draw.cc70
-rw-r--r--src/render/render.cc3
17 files changed, 238 insertions, 109 deletions
diff --git a/doc/manual.html b/doc/manual.html
index 7508b4b..d1d1781 100644
--- a/doc/manual.html
+++ b/doc/manual.html
@@ -80,6 +80,11 @@ bind p screenshot
</td><td>pitch
</td></tr>
+ <tr><td>keypad home pgup
+ </td><td>roll
+ </td></tr>
+
+
<tr><td>keypad + -
</td><td>increase/decrease forward thruster
</td></tr>
@@ -93,11 +98,11 @@ bind p screenshot
</td></tr>
<tr><td>a d
- </td><td>strafe left/right
+ </td><td>strafe
</td></tr>
- <tr><td>q / e
- </td><td>roll left/right
+ <tr><td>q e
+ </td><td>roll
</td></tr>
<tr><td>w s
@@ -117,6 +122,10 @@ bind p screenshot
</td></tr>
<tr><td>t
+ </td><td>chat box
+ </td></tr>
+
+ <tr><td>enter
</td><td>chat window
</td></tr>
diff --git a/src/client/input.cc b/src/client/input.cc
index 7188de0..d4ccb17 100644
--- a/src/client/input.cc
+++ b/src/client/input.cc
@@ -482,6 +482,8 @@ Key::Modifier convert_SDL_modifier(int const sdlmodifier)
void key_pressed(Key *key)
{
+ // FIXME implement a real 'console key'
+
if (key->bind(Key::None).compare("ui_console") == 0) {
// FIXME bah
local_direction = 0.0f;
@@ -510,10 +512,14 @@ void key_pressed(Key *key)
} else if (core::application()->connected() && core::localcontrol()) {
char c = key->bind(convert_SDL_modifier(keyboard_modifiers)).c_str()[0];
- if (c == '+') {
+ if (c == '@') {
+ // target bind
+ if (targets::current_id())
+ core::cmd() << key->bind(convert_SDL_modifier(keyboard_modifiers)) << " " << targets::current_id() <<"\n";
+ } else if (c == '+') {
// action bind
action_press(key, key->bind(convert_SDL_modifier(keyboard_modifiers)));
- } else if (c) {
+ } else {
// normal bind
core::cmd() << key->bind(convert_SDL_modifier(keyboard_modifiers)) << "\n";
}
diff --git a/src/client/keyboard.cc b/src/client/keyboard.cc
index b4b0e3a..a29b601 100644
--- a/src/client/keyboard.cc
+++ b/src/client/keyboard.cc
@@ -30,8 +30,7 @@ Keyboard::Keyboard()
// ------------------ ACTIONS
- // note: actions should be state keys and not use key repeat
- // FIXME: thruster should be a state key
+ // FIXME actions should be state keys and not use key repeat
add_action("+left", Action::None, "rotate left");
add_action("+right", Action::None, "rotate right");
@@ -57,13 +56,17 @@ Keyboard::Keyboard()
add_action("+control", Action::None, "enable mouse control while pressed");
+ // TODO the @ is a hack for functions that take the current entity as param
+
+ add_action("@dock", Action::None, "send docking request to target");
+
// ------------------ KEYS
Key *key = 0;
add_key("backspace", SDLK_BACKSPACE);
add_key("tab", SDLK_TAB, 0, "impulse");
add_key("clear", SDLK_CLEAR);
- key = add_key("enter", SDLK_RETURN);
+ key = add_key("enter", SDLK_RETURN, 0, "ui_chat");
key->assign(Key::Alt, "toggle r_fullscreen");
add_key("pause", SDLK_PAUSE);
add_key("esc", SDLK_ESCAPE);
@@ -147,13 +150,13 @@ Keyboard::Keyboard()
add_key("kp4", SDLK_KP4, 0, "+left");
add_key("kp5", SDLK_KP5);
add_key("kp6", SDLK_KP6, 0, "+right");
- add_key("kp7", SDLK_KP7);
+ add_key("kp7", SDLK_KP7, 0, "+rollleft");
add_key("kp8", SDLK_KP8, 0, "+down");
- add_key("kp9", SDLK_KP9);
+ add_key("kp9", SDLK_KP9, 0, "+rollright");
add_key("kpperiod", SDLK_KP_PERIOD, '.');
- add_key("kpdiv", SDLK_KP_DIVIDE, '/', "+rollleft");
- add_key("kpmul", SDLK_KP_MULTIPLY, '*', "+rollright");
+ add_key("kpdiv", SDLK_KP_DIVIDE, '/');
+ add_key("kpmul", SDLK_KP_MULTIPLY, '*');
add_key("kpmin", SDLK_KP_MINUS, '-', "+thrustdown");
add_key("kpplus", SDLK_KP_PLUS, '+', "+thrustup");
add_key("kpenter", SDLK_KP_ENTER, '\n', "ui_chat");
@@ -172,7 +175,7 @@ Keyboard::Keyboard()
add_key("f1", SDLK_F1);
add_key("f2", SDLK_F2);
- add_key("f3", SDLK_F3);
+ add_key("f3", SDLK_F3, 0, "@dock");
key = add_key("f4", SDLK_F4);
#ifdef _WIN32
key->assign(Key::Alt, "quit");
diff --git a/src/core/commandbuffer.cc b/src/core/commandbuffer.cc
index 8c3c8a1..d3cb4f2 100644
--- a/src/core/commandbuffer.cc
+++ b/src/core/commandbuffer.cc
@@ -231,19 +231,39 @@ void CommandBuffer::exec(std::string const &cmdline)
// is it a function
Func *f = Func::find(command);
if (f) {
- std::string args;
- char c;
- if (cmdstream >> args) {
- while (cmdstream.get(c))
- args += c;
- }
-
// console can not execute game functions, and neither should rcon
if ((f->flags() & Func::Game) && (Cvar::sv_dedicated->value() == 0)) {
+
if (application()->connected()) {
- f->exec(game()->localplayer(), args);
+
+ if ((f->flags() & Func::Target)) {
+ // target function
+ unsigned int id = 0;
+ if ((cmdstream >> id)) {
+ con_debug << "target function " << command << " " << id << std::endl;
+ Entity *entity = Entity::find(id);
+ if (entity)
+ f->exec(game()->localplayer(), entity);
+ }
+ } else {
+ // game function
+ std::string args;
+ char c;
+ if (cmdstream >> args) {
+ while (cmdstream.get(c))
+ args += c;
+ }
+ f->exec(game()->localplayer(), args);
+ }
}
} else {
+ // regular function
+ std::string args;
+ char c;
+ if (cmdstream >> args) {
+ while (cmdstream.get(c))
+ args += c;
+ }
f->exec(args);
}
return;
diff --git a/src/core/entity.cc b/src/core/entity.cc
index 2c63b18..f9062e0 100644
--- a/src/core/entity.cc
+++ b/src/core/entity.cc
@@ -102,7 +102,6 @@ Entity::Entity(unsigned int flags) :
entity_dirty = false;
entity_model = 0;
- entity_modelname.clear();
entity_label.clear();
entity_name.clear();
@@ -213,22 +212,53 @@ void Entity::hide()
entity_visible = false;
}
+void Entity::set_flag(Flags flag)
+{
+ entity_flags |= flag;
+}
+
+void Entity::unset_flag(Flags flag)
+{
+ entity_flags &= ~flag;
+}
+
+void Entity::set_model(model::Model *model)
+{
+ entity_model = model;
+ if (entity_model) {
+ entity_radius = entity_model->radius();
+ entity_modelname = entity_model->name();
+ }
+}
+
+void Entity::set_modelname(const std::string &modelname)
+{
+ if (!modelname.size()) {
+ set_model(0);
+ } else {
+ set_model(model::Model::load(modelname));
+ }
+
+ if (!entity_model)
+ entity_modelname.clear();
+}
+
void Entity::serialize_server_create(std::ostream & os) const
{
- os << entity_moduletypeid << " "
- << entity_flags << " "
- << (entity_visible ? 1 : 0) << " "
- << (entity_zone ? entity_zone->id() : 0) << " "
+ os << moduletype() << " "
+ << flags() << " "
+ << (visible() ? 1 : 0) << " "
+ << (zone() ? zone()->id() : 0) << " "
<< std::setprecision(8) << entity_location << " "
- << entity_color << " "
- << entity_color_second << " "
- << entity_shape << " "
- << entity_radius << " "
+ << color() << " "
+ << color_second() << " "
+ << shape() << " "
+ << radius() << " "
<< std::setprecision(8) << entity_axis.forward() << " "
<< std::setprecision(8) << entity_axis.left() << " "
<< "\"" << entity_label << "\" "
<< "\"" << entity_name << "\" "
- << "\"" << entity_modelname << "\" ";
+ << "\"" << (entity_model ? entity_model->name() : "") << "\" ";
}
void Entity::receive_server_create(std::istream &is)
@@ -288,8 +318,8 @@ void Entity::receive_server_create(std::istream &is)
while ( (is.get(c)) && (c != '"'));
while ( (is.get(c)) && (c != '"'))
n += c;
- entity_modelname = n;
+ set_modelname(n);
entity_dirty = false;
}
diff --git a/src/core/entity.h b/src/core/entity.h
index 2c4814e..149419b 100644
--- a/src/core/entity.h
+++ b/src/core/entity.h
@@ -35,10 +35,7 @@ class Entity
{
public:
/// Entity flags
- /**
- * entities with the Static flag set will not get client-side interpolation
- */
- enum Flags {Static=1, Solid=2, Bright=4};
+ enum Flags {Static=1, Solid=2, Bright=4, Dock=8};
/// Entity type constants
enum Type {Default=0, Dynamic=1, Controlable=2, Globe=3};
@@ -78,15 +75,15 @@ public:
/// entity name (can not contain double qoutes ")
inline std::string const & name() { return entity_name; }
- /// entity model name
- inline std::string const & modelname() { return entity_modelname; }
-
/// entity client render state
inline ClientState * state() { return entity_clientstate; }
/// pointer to the model, is used client-side
inline model::Model * model() { return entity_model; }
+ /// modelname
+ inline const std::string & modelname() const { return entity_modelname; }
+
/// pointer to the zone the entity belongs to
inline Zone *zone() const { return entity_zone; }
@@ -176,12 +173,24 @@ public:
/// set visibility
void set_visible(bool visible = true);
+ /// set the model name and load the model
+ void set_modelname(const std:: string &model);
+
+ /// set the model
+ void set_model(model::Model *model);
+
/// show the entity, make it visible
virtual void show();
/// hide the entity, make it invisible
virtual void hide();
+ /// set a flag
+ void set_flag(Flags flag);
+
+ /// unset a flag
+ void unset_flag(Flags flag);
+
/// clear all update flags
virtual void clear_updates();
@@ -210,13 +219,10 @@ public:
math::Axis entity_axis;
float entity_radius;
- std::string entity_modelname;
- model::Model *entity_model;
Shape entity_shape;
math::Color entity_color;
math::Color entity_color_second;
unsigned int entity_moduletypeid;
- unsigned int entity_flags;
bool entity_dirty;
bool entity_created;
@@ -236,19 +242,20 @@ protected:
bool entity_visible;
bool entity_serverside;
+private:
+ unsigned int entity_id;
+ unsigned int entity_flags;
+
std::string entity_name;
std::string entity_label;
-private:
- // add an entity to the registry
- static void add(Entity *ent);
-
- // the id is set by add()
- unsigned int entity_id;
+ model::Model *entity_model;
+ std::string entity_modelname;
- // the entity registry
static Registry entity_registry;
static size_t entity_nextid;
+
+ static void add(Entity *ent);
};
diff --git a/src/core/func.cc b/src/core/func.cc
index 81175f8..42c46c8 100644
--- a/src/core/func.cc
+++ b/src/core/func.cc
@@ -18,12 +18,12 @@ namespace core
Func::Registry Func::func_registry;
-Func * Func::add(const char *name, FuncPtr functionptr, unsigned int flags)
+Func * Func::add(const char *name, FuncPtr functionptr, bool shared)
{
Func *func = 0;
Registry::iterator it = func_registry.find(name);
if (it == func_registry.end()) {
- func = new Func(name, (void *)functionptr, flags & ~Func::Game);
+ func = new Func(name, (void *)functionptr, shared ? Shared : 0);
func_registry[std::string(name)] = func;
//con_debug << "Function '" << name << "' registered." << std::endl;
} else {
@@ -33,12 +33,27 @@ Func * Func::add(const char *name, FuncPtr functionptr, unsigned int flags)
return func;
}
-Func *Func::add(const char *name, GameFuncPtr gamefunctionptr, unsigned int flags)
+Func *Func::add(const char *name, GameFuncPtr gamefunctionptr)
{
Func *func = 0;
Registry::iterator it = func_registry.find(name);
if (it == func_registry.end()) {
- func = new Func(name, (void *)gamefunctionptr, flags | Func::Game);
+ func = new Func(name, (void *)gamefunctionptr, Game);
+ func_registry[func->name()] = func;
+ //con_debug << "Function '" << name << "' registered." << std::endl;
+ } else {
+ con_warn << "Function '" << name << "' already registered!" << std::endl;
+ func = (*it).second;
+ }
+ return func;
+}
+
+Func *Func::add(const char *name, TargetFuncPtr targetfunctionptr)
+{
+ Func *func = 0;
+ Registry::iterator it = func_registry.find(name);
+ if (it == func_registry.end()) {
+ func = new Func(name, (void *)targetfunctionptr, Game | Target);
func_registry[func->name()] = func;
//con_debug << "Function '" << name << "' registered." << std::endl;
} else {
@@ -145,5 +160,15 @@ void Func::exec(Player *player, std::string const &args)
gamefunction(player, args);
}
+void Func::exec(Player *player, Entity *entity)
+{
+ if (!(flags() & (Game | Target)))
+ return;
+
+ TargetFuncPtr targetfunction = (TargetFuncPtr) func_ptr;
+ targetfunction(player, entity);
+
+}
+
} // namespace core
diff --git a/src/core/func.h b/src/core/func.h
index 7c5635f..eacd47e 100644
--- a/src/core/func.h
+++ b/src/core/func.h
@@ -8,6 +8,7 @@
#define __INCLUDED_CORE_FUNC_H__
#include "core/player.h"
+#include "core/entity.h"
#include <sstream>
#include <string>
@@ -22,12 +23,15 @@ typedef void(* FuncPtr)(std::string const &args);
/// fuction pointer for game functions
typedef void(* GameFuncPtr)(Player *player, std::string const &args);
+/// fuction pointer for target functions
+typedef void(* TargetFuncPtr)(Player *player, Entity *entity);
+
/// a function pointer encapsulation class
class Func
{
public:
/// function flags
- enum Flags {Game=1, Shared=2};
+ enum Flags {Game=1, Shared=2, Target=4};
/// create a new function
Func(char const * name, void *ptr, unsigned int flags = 0);
@@ -56,16 +60,22 @@ public:
/// execute the function if the Game flag is set
void exec(Player *player, std::string const &args);
+ /// execute the function if the Target flag is set
+ void exec(Player *player, Entity *entity);
+
/* ---- Static functions for the Func registry -------------------- */
/// type definition
typedef std::map<std::string, Func*> Registry;
/// add a function to the registry
- static Func *add(const char *name, FuncPtr functionptr, unsigned int flags=0);
+ static Func *add(const char *name, FuncPtr functionptr, bool shared=false);
/// add a game function to the registry and set the Game flag
- static Func *add(const char *name, GameFuncPtr functionptr, unsigned int flags=0);
+ static Func *add(const char *name, GameFuncPtr functionptr);
+
+ /// add a target function to the registry and set Game and Target flag
+ static Func *add(const char *name, TargetFuncPtr targetfunctionptr);
/// remove a function from the registry
static void remove(const char *name);
diff --git a/src/core/gameserver.cc b/src/core/gameserver.cc
index 4da0be6..3268e38 100644
--- a/src/core/gameserver.cc
+++ b/src/core/gameserver.cc
@@ -178,11 +178,11 @@ GameServer::GameServer() : GameInterface()
func = Func::add("revoke_rcon", func_grant_rcon);
func->set_info("[player] revoke rcon rights");
*/
- /* -- player functions --*/
- func = Func::add("time", func_time, Func::Shared);
+ /* -- shared functions --*/
+ func = Func::add("time", func_time, true);
func->set_info("get the server uptime and current server localtime");
- func = Func::add("who", func_who, Func::Shared);
+ func = Func::add("who", func_who, true);
func->set_info("get a list of connected players");
if (!Cvar::sv_dedicated->value()) {
@@ -489,8 +489,16 @@ void GameServer::exec(Player *player, std::string const & cmdline)
args.assign(cmdline.substr(command.size()+1));
if ((function ->flags() & Func::Game) == Func::Game) {
- function->exec(player, args);
- return;
+ if ((function ->flags() & Func::Target) == Func::Target) {
+ unsigned int id = 0;
+ if ((cmdstream >> id)) {
+ Entity *entity = Entity::find(id);
+ if (entity)
+ function->exec(player, entity);
+ }
+ } else {
+ function->exec(player, args);
+ }
} else if ((function->flags() & Func::Shared) == Func::Shared) {
@@ -505,8 +513,8 @@ void GameServer::exec(Player *player, std::string const & cmdline)
// disable rcon buffering
console()->set_rcon(false);
- return;
}
+ return;
}
std::string message("Unknown command '");
diff --git a/src/core/parser.cc b/src/core/parser.cc
index 99dc1d5..39eb073 100644
--- a/src/core/parser.cc
+++ b/src/core/parser.cc
@@ -43,7 +43,8 @@ bool Parser::got_entity_key(filesystem::IniFile &inifile, core::Entity *entity)
} else if (inifile.got_key_string("name", strval)) {
entity->set_name(strval);
return true;
- } else if (inifile.got_key_string("model", entity->entity_modelname)) {
+ } else if (inifile.got_key_string("model", strval)) {
+ entity->set_modelname(strval);
return true;
} else if (inifile.got_key_angle("direction", direction)) {
entity->axis().change_direction(direction);
diff --git a/src/game/base/base.cc b/src/game/base/base.cc
index 738db04..6a3738e 100644
--- a/src/game/base/base.cc
+++ b/src/game/base/base.cc
@@ -159,6 +159,18 @@ void func_impulse(core::Player *player, std::string const &args)
ship->impulse();
}
+/// a player sends a docking request
+void func_dock(core::Player *player,core::Entity *entity)
+{
+ if (!player->control())
+ return;
+
+ if (player->control()->zone() != entity->zone())
+ return;
+
+ core::server()->send(player, "^BSending docking request to " + entity->name() + "^B...");
+}
+
/* -- class Base static members ----------------------------------- */
// game variables
@@ -211,6 +223,9 @@ void Base::init()
func = core::Func::add("buy", (core::GameFuncPtr) func_buy);
func->set_info("buy a ship");
+ func = core::Func::add("@dock", (core::TargetFuncPtr) func_dock);
+ func->set_info("send a docking request");
+
func = core::Func::add("jump", (core::GameFuncPtr) func_jump);
func->set_info("[string] activate or deactivate hyperspace jump drive");
@@ -389,7 +404,7 @@ bool Base::load_zone(core::Zone *zone)
} else if (zoneini.got_section("entity")) {
entity = new core::Entity();
- entity->entity_flags += core::Entity::Static;
+ entity->set_flag(core::Entity::Static);
entity->set_zone(zone);
count ++;
diff --git a/src/game/base/ship.cc b/src/game/base/ship.cc
index 574d66c..412668d 100644
--- a/src/game/base/ship.cc
+++ b/src/game/base/ship.cc
@@ -26,9 +26,9 @@ const float MIN_DELTA = 0.000001f;
Ship::Ship(core::Player *owner, ShipModel *shipmodel) :
core::EntityControlable(owner, ship_enttype)
{
- entity_modelname = "ships/" + shipmodel->modelname();
- entity_name = shipmodel->name() + ": <^B" + owner->name() + "^N>";
- entity_label = shipmodel->label();
+ set_modelname("ships/" + shipmodel->modelname());
+ set_name(shipmodel->name() + ": <^B" + owner->name() + "^N>");
+ set_label(shipmodel->label());
entity_moduletypeid = ship_enttype;
@@ -266,6 +266,7 @@ void Ship::frame(float seconds)
entity_dirty = true;
// FIXME 5 second cooldown
+ entity_speed = Base::g_impulsespeed->value();
entity_eventstate = core::Entity::Normal;
} else if (entity_eventstate == core::Entity::ImpulseInitiate) {
diff --git a/src/game/intro/convoy.cc b/src/game/intro/convoy.cc
index 226f8fa..c0fba52 100644
--- a/src/game/intro/convoy.cc
+++ b/src/game/intro/convoy.cc
@@ -16,7 +16,7 @@ Member::Member(std::string const &model) : core::EntityControlable(0, 1)
set_name("Convoy member");
set_label(model);
- entity_modelname = "ships/" + model;
+ set_modelname("ships/" + model);
entity_thrust = 1.0f;
/*
diff --git a/src/game/intro/intro.cc b/src/game/intro/intro.cc
index 55f038f..efb3b40 100644
--- a/src/game/intro/intro.cc
+++ b/src/game/intro/intro.cc
@@ -117,7 +117,7 @@ bool Intro::load_world()
} else if (ini.got_key_float("rotationspeed", globe->entity_rotationspeed)) {
continue;
} else if (ini.got_key_bool("bright", b)) {
- if (b) { globe->entity_flags |= core::Entity::Bright; }
+ if (b) { globe->set_flag(core::Entity::Bright); }
} else if (ini.got_key()) {
ini.unkown_key();
}
diff --git a/src/model/engine.cc b/src/model/engine.cc
index 706de15..97011d9 100644
--- a/src/model/engine.cc
+++ b/src/model/engine.cc
@@ -18,6 +18,7 @@ Engine::Engine() :
{
engine_radius = 1.0f;
engine_flare = 0;
+ render_texture = 0;
engine_notrail = false;
engine_noflare = false;
diff --git a/src/render/draw.cc b/src/render/draw.cc
index 69dcecb..7bbb89c 100644
--- a/src/render/draw.cc
+++ b/src/render/draw.cc
@@ -53,8 +53,8 @@ typedef std::map<float, core::EntityGlobe *> Globes;
Globes globes_list;
// function to test flags
-inline bool flag_is_set(unsigned int const spawnflags, unsigned int const flag) {
- return ((spawnflags & flag) == flag);
+inline bool flag_is_set(unsigned int const flags, unsigned int const flag) {
+ return ((flags & flag) == flag);
}
/* ---- Prepare the renderer state --------------------------------- */
@@ -75,51 +75,43 @@ void pass_prepare(float seconds)
core::Entity *entity = (*it);
// load entity models and light flare textures
- if (!entity->model() && entity->modelname().size()) {
- entity->entity_model = Model::load(entity->modelname());
-
- if (!entity->model()) {
- entity->entity_modelname.clear();
- entity->entity_radius = 0.25;
- } else {
- // set entity radius to model radius
- entity->entity_radius = entity->entity_model->radius();
+ if (!entity->model() && entity->modelname().c_str()[0]) {
+ entity->set_modelname(entity->modelname());
+ }
+
+ if (entity->model()) {
+ model::Model *model = entity->model();
- for (Model::Lights::iterator lit = entity->model()->lights().begin(); lit != entity->model()->lights().end(); lit++) {
- Light *light = (*lit);
+ for (Model::Lights::iterator lit = model->lights().begin(); lit != model->lights().end(); lit++) {
+ Light *light = (*lit);
- // load light texture
- std::stringstream flarename;
- flarename << "bitmaps/fx/flare" << std::setfill('0') << std::setw(2) << light->flare();
- light->render_texture = Textures::load(flarename.str());
- }
+ // load light texture
+ std::stringstream flarename;
+ flarename << "bitmaps/fx/flare" << std::setfill('0') << std::setw(2) << light->flare();
+ light->render_texture = Textures::load(flarename.str());
+ }
- for(Model::Engines::iterator eit = entity->model()->engines().begin(); eit != entity->model()->engines().end(); eit++) {
- Engine *engine = (*eit);
+ for(Model::Engines::iterator eit = model->engines().begin(); eit != model->engines().end(); eit++) {
+ Engine *engine = (*eit);
- if (!engine->flare()) engine->engine_flare = 1;
+ if (!engine->flare()) engine->engine_flare = 1;
- // load engine texture
- std::stringstream flarename;
- flarename << "bitmaps/fx/flare" << std::setfill('0') << std::setw(2) << engine->flare();
- engine->render_texture = Textures::load(flarename.str());
- }
+ // load engine texture
+ std::stringstream flarename;
+ flarename << "bitmaps/fx/flare" << std::setfill('0') << std::setw(2) << engine->flare();
+ engine->render_texture = Textures::load(flarename.str());
+ }
- for (Model::Flares::iterator flit = entity->model()->flares().begin(); flit != entity->model()->flares().end(); flit++) {
- Flare *flare = (*flit);
+ for (Model::Flares::iterator flit = model->flares().begin(); flit != model->flares().end(); flit++) {
+ Flare *flare = (*flit);
- // load flare texture
- std::stringstream flarename;
- flarename << "bitmaps/fx/flare" << std::setfill('0') << std::setw(2) << flare->flare();
- flare->render_texture = Textures::load(flarename.str());
- }
+ // load flare texture
+ std::stringstream flarename;
+ flarename << "bitmaps/fx/flare" << std::setfill('0') << std::setw(2) << flare->flare();
+ flare->render_texture = Textures::load(flarename.str());
}
}
-
- if (!entity->state()) {
- entity->entity_clientstate = new core::ClientState(entity);
- }
-
+
entity->state()->state_visible = false;
entity->state()->state_detailvisible = false;
entity->state()->state_targetable = false;
@@ -147,8 +139,8 @@ void pass_prepare(float seconds)
if (entity->type() == core::Entity::Globe) {
core::EntityGlobe *globe = static_cast<core::EntityGlobe *>(entity);
- // add the globe to the globes list
+ // add the globe to the globes list
globes_list[globe->state()->distance()] = globe;
// load globe textures
diff --git a/src/render/render.cc b/src/render/render.cc
index 55756d9..02bd586 100644
--- a/src/render/render.cc
+++ b/src/render/render.cc
@@ -184,6 +184,7 @@ void unload()
// clear all assets
void clear()
{
+ con_debug << "Clearing render data...\n";
// clear zone sky textures
for (core::Zone::Registry::iterator it = core::Zone::registry().begin(); it != core::Zone::registry().end(); it++) {
core::Zone *zone = (*it).second;
@@ -195,7 +196,7 @@ void clear()
core::Entity *entity = (*it).second;
if (entity->model())
- entity->entity_model = 0;
+ entity->set_model(0);
if (entity->type() == core::Entity::Globe) {
core::EntityGlobe *globe = static_cast<core::EntityGlobe *>(entity);