diff options
author | Stijn Buys <ingar@osirion.org> | 2012-12-28 22:53:10 +0000 |
---|---|---|
committer | Stijn Buys <ingar@osirion.org> | 2012-12-28 22:53:10 +0000 |
commit | fe96eee5db2acbef1ea0f360b180fd9f8f990444 (patch) | |
tree | e4c2c65b20ca652861a30fa6b73673e73a07bb59 /src/core | |
parent | 92dafc75bba246aed3f20a558a9c4eed13a1e8a9 (diff) |
Addedd core:: support for EntityGlobe rings.
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/entityglobe.cc | 14 | ||||
-rw-r--r-- | src/core/entityglobe.h | 21 | ||||
-rw-r--r-- | src/core/entityprojectile.cc | 5 | ||||
-rw-r--r-- | src/core/entityprojectile.h | 19 | ||||
-rw-r--r-- | src/core/parser.cc | 4 |
5 files changed, 58 insertions, 5 deletions
diff --git a/src/core/entityglobe.cc b/src/core/entityglobe.cc index c27e05c..df12f66 100644 --- a/src/core/entityglobe.cc +++ b/src/core/entityglobe.cc @@ -17,18 +17,24 @@ namespace core EntityGlobe::EntityGlobe() : Entity() { + set_shape(Sphere); + entity_texture_id = 0; entity_corona_id = 0; + entity_rings_id = 0; + entity_rotationspeed = 0; - set_shape(Sphere); } EntityGlobe::EntityGlobe(std::istream & is) : Entity(is) { + set_shape(Sphere); + entity_texture_id = 0; entity_corona_id = 0; + entity_rings_id = 0; + entity_rotationspeed = 0; - set_shape(Sphere); } EntityGlobe::~EntityGlobe() @@ -38,7 +44,9 @@ EntityGlobe::~EntityGlobe() void EntityGlobe::serialize_server_create(std::ostream & os) const { Entity::serialize_server_create(os); - os << entity_rotationspeed << " \"" << texturename() << "\" \"" << coronaname() << "\" "; + os << entity_rotationspeed << " "; + os << "\"" << texturename() << "\" "; + os << "\"" << coronaname() << "\" "; } void EntityGlobe::receive_server_create(std::istream &is) diff --git a/src/core/entityglobe.h b/src/core/entityglobe.h index e60f61a..2643263 100644 --- a/src/core/entityglobe.h +++ b/src/core/entityglobe.h @@ -48,6 +48,16 @@ public: return entity_corona_id; } + /// rings texture name + inline const std::string &ringsname() const { + return entity_ringsname; + } + + /// rings texture id + inline size_t rings_id() const { + return entity_rings_id; + } + /// rotation speed in degrees per second inline float rotationspeed() const { return entity_rotationspeed; @@ -67,6 +77,10 @@ public: entity_corona_id = texture_id; } + inline void set_rings_id(size_t texture_id) { + entity_rings_id = texture_id; + } + inline void set_texturename(const std::string & texturename) { entity_texturename.assign(texturename); } @@ -74,6 +88,10 @@ public: inline void set_coronaname(const std::string & texturename) { entity_coronaname.assign(texturename); } + + inline void set_ringsname(const std::string & texturename) { + entity_ringsname.assign(texturename); + } /*----- serializers ----------------------------------------------- */ @@ -87,8 +105,11 @@ private: float entity_rotationspeed; size_t entity_texture_id; size_t entity_corona_id; + size_t entity_rings_id; + std::string entity_texturename; std::string entity_coronaname; + std::string entity_ringsname; }; } diff --git a/src/core/entityprojectile.cc b/src/core/entityprojectile.cc index e89c7f7..1fdf12a 100644 --- a/src/core/entityprojectile.cc +++ b/src/core/entityprojectile.cc @@ -198,6 +198,11 @@ void EntityProjectile::set_projectile_modelname(const std::string modelname) set_modelname("maps/projectiles/" + modelname); } +void EntityProjectile::set_projectile_soundname(const std::string soundname) +{ + projectile_soundname_str.assign(soundname); +} + void EntityProjectile::serialize_server_create(std::ostream & os) const { os << moduletype() << " "; diff --git a/src/core/entityprojectile.h b/src/core/entityprojectile.h index 6bbcdfd..cfd534b 100644 --- a/src/core/entityprojectile.h +++ b/src/core/entityprojectile.h @@ -65,13 +65,21 @@ public: } /** - * @brief return the projectile modelname + * @brief return the projectile model name * */ inline const std::string & projectile_modelname() const { return projectile_modelname_str; } + /** + * @brief return the projectile sound name + * */ + inline const std::string & projectile_soundname() const + { + return projectile_soundname_str; + } + /*----- serializers ----------------------------------------------- */ /** @@ -124,10 +132,15 @@ public: } /** - * @brief set the projectile modelname + * @brief set the projectile model name * */ void set_projectile_modelname(const std::string modelname); + /** + * @brief set the projectile sound name + * */ + void set_projectile_soundname(const std::string soundname); + private: unsigned long projectile_timestamp; @@ -135,6 +148,8 @@ private: std::string projectile_modelname_str; + std::string projectile_soundname_str; + float projectile_damage; unsigned int projectile_ownerid; diff --git a/src/core/parser.cc b/src/core/parser.cc index 1c66888..ab280e4 100644 --- a/src/core/parser.cc +++ b/src/core/parser.cc @@ -154,6 +154,10 @@ bool Parser::got_entity_key(filesystem::IniFile &inifile, core::Entity *entity) } else if (inifile.got_key_string("corona", strval)) { globe->set_coronaname(strval); return true; + + } else if (inifile.got_key_string("rings", strval)) { + globe->set_ringsname(strval); + return true; } else if (inifile.got_key_float("rotationspeed", f)) { globe->set_rotationspeed(f); |