diff options
author | Stijn Buys <ingar@osirion.org> | 2008-05-01 21:08:40 +0000 |
---|---|---|
committer | Stijn Buys <ingar@osirion.org> | 2008-05-01 21:08:40 +0000 |
commit | 36ce28a7557c4b2b73316621471558354024ca54 (patch) | |
tree | 3aeb4502b3a4f91a54df5d25bedfd262e61d1cec /src/core | |
parent | a22542f273de28d06ecaf2bd6fd741821e98512b (diff) |
roll control
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/entity.cc | 13 | ||||
-rw-r--r-- | src/core/entity.h | 7 |
2 files changed, 20 insertions, 0 deletions
diff --git a/src/core/entity.cc b/src/core/entity.cc index ea5b9bc..d05bef2 100644 --- a/src/core/entity.cc +++ b/src/core/entity.cc @@ -262,6 +262,7 @@ EntityControlable::EntityControlable(Player *player, unsigned int flags) : target_direction = 0.0f; target_thrust = 0.0f; target_pitch = 0.0f; + target_roll = 0.0f; } EntityControlable::EntityControlable(std::istream & is) : @@ -296,6 +297,7 @@ void EntityControlable::serialize_client_update(std::ostream & os) const os << " " << target_direction; os << " " << target_pitch; os << " " << target_thrust; + os << " " << target_roll; } @@ -305,6 +307,7 @@ void EntityControlable::recieve_client_update(std::istream &is) is >> target_direction; is >> target_pitch; is >> target_thrust; + is >> target_roll; } void EntityControlable::serialize_server_update(std::ostream & os) const @@ -360,6 +363,16 @@ void EntityControlable::set_pitch(float pitch) } } +void EntityControlable::set_roll(float roll) +{ + if ((flags() & Static) == Static) + return; + + if (target_roll != roll) { + target_roll = roll; + entity_dirty = true; + } +} /*----- EntityGlobe ------------------------------------------------ */ diff --git a/src/core/entity.h b/src/core/entity.h index e71b034..7e6493a 100644 --- a/src/core/entity.h +++ b/src/core/entity.h @@ -269,6 +269,9 @@ public: /// set the target pitch void set_pitch(float pitch); + /// set target roll + void set_roll(float roll); + /// runs one game frame for the entity /** * The default implementation will set direction() and thrust() to the desired targets @@ -293,6 +296,10 @@ public: /** target_pitch must be in the [-1, 1] range */ float target_pitch; + /// target roll as set by the client + /** target_roll must be in the [-1, 1] range + */ + float target_roll; }; /// a Globe entity |