diff options
author | Stijn Buys <ingar@osirion.org> | 2010-11-24 23:00:28 +0000 |
---|---|---|
committer | Stijn Buys <ingar@osirion.org> | 2010-11-24 23:00:28 +0000 |
commit | 02b285bf20603bab6fc75d106acbaccead645eb9 (patch) | |
tree | 7be22d06339e1bb70b7ef5011312c13865976ced /src/core/entity.cc | |
parent | f66a28a68114f3c9efe109b6948ecec163cdb153 (diff) |
Actually add entities in the intro to their zone,
removed core::EntityControlable::movement(),
cleaned up core::EntityGlobe,
adds support for a per-globe corona,
adds core::EntityControlable::control_flags(),
bumps network protocol version to 21
Diffstat (limited to 'src/core/entity.cc')
-rw-r--r-- | src/core/entity.cc | 32 |
1 files changed, 21 insertions, 11 deletions
diff --git a/src/core/entity.cc b/src/core/entity.cc index 013e66d..d6b0a10 100644 --- a/src/core/entity.cc +++ b/src/core/entity.cc @@ -711,7 +711,7 @@ void EntityControlable::ActionInterface::debugDraw(btIDebugDraw* debugDrawer) EntityControlable::EntityControlable() : EntityDynamic() { entity_thrust = 0; - entity_movement = 0; + entity_control_flags = 0; target_direction = 0.0f; target_thrust = 0.0f; @@ -729,7 +729,7 @@ EntityControlable::EntityControlable(std::istream & is) : EntityDynamic(is) { entity_thrust = 0; - entity_movement = 0; + entity_control_flags = 0; target_direction = 0.0f; target_thrust = 0.0f; @@ -828,8 +828,8 @@ void EntityControlable::receive_client_update(std::istream &is) void EntityControlable::serialize_server_update(std::ostream & os) const { EntityDynamic::serialize_server_update(os); - os << roundf(entity_thrust*100.0f) << " "; - os << roundf(entity_movement * 100.0f) << " "; + os << roundf(entity_thrust * 100.0f) << " "; + os << roundf(entity_control_flags) << " "; } void EntityControlable::receive_server_update(std::istream &is) @@ -837,8 +837,8 @@ void EntityControlable::receive_server_update(std::istream &is) EntityDynamic::receive_server_update(is); is >> entity_thrust; entity_thrust /= 100.0f; - is >> entity_movement; - entity_movement /= 100.0f; + + is >> entity_control_flags; } void EntityControlable::set_thrust(float thrust) @@ -1017,14 +1017,16 @@ void EntityControlable::frame(float seconds) EntityGlobe::EntityGlobe() : Entity() { - render_texture = 0; + entity_texture_id = 0; + entity_corona_id = 0; entity_rotationspeed = 0; set_shape(Sphere); } EntityGlobe::EntityGlobe(std::istream & is) : Entity(is) { - render_texture = 0; + entity_texture_id = 0; + entity_corona_id = 0; entity_rotationspeed = 0; set_shape(Sphere); } @@ -1036,7 +1038,7 @@ EntityGlobe::~EntityGlobe() void EntityGlobe::serialize_server_create(std::ostream & os) const { Entity::serialize_server_create(os); - os << entity_rotationspeed << " \"" << entity_texture << "\" "; + os << entity_rotationspeed << " \"" << texturename() << "\" \"" << coronaname() << "\" "; } void EntityGlobe::receive_server_create(std::istream &is) @@ -1047,12 +1049,20 @@ void EntityGlobe::receive_server_create(std::istream &is) std::string n; char c; + + // read texture name while ((is.get(c)) && (c != '"')); while ((is.get(c)) && (c != '"')) n += c; - entity_texture = n; + + entity_texturename.assign(n); + + // read corona name n.clear(); - + while ((is.get(c)) && (c != '"')); + while ((is.get(c)) && (c != '"')) + n += c; + entity_coronaname.assign(n); } } |