From 7bec374404aa1a0b30c220aee49b4a9890437f75 Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Sun, 11 Nov 2012 20:56:30 +0000 Subject: Cleaned up core::EntyControlable client-side and server-side proprties API. --- src/core/entity.h | 87 ++++++++++++++++++++++++++----------------------------- 1 file changed, 41 insertions(+), 46 deletions(-) (limited to 'src/core/entity.h') diff --git a/src/core/entity.h b/src/core/entity.h index 092f4a7..72553fa 100644 --- a/src/core/entity.h +++ b/src/core/entity.h @@ -698,13 +698,13 @@ public: } /// control flags - inline int control_flags() const { - return entity_control_flags; + inline int controlflags() const { + return entity_controlflags; } /// returns true if the specified control flag is set - inline bool control_has_flag(ControlFlags flag) const { - return ((flag && entity_control_flags) == flag); + inline bool has_controlflag(ControlFlags flag) const { + return ((flag && entity_controlflags) == flag); } /// physics action @@ -724,27 +724,39 @@ public: virtual void serialize_server_update(std::ostream & os) const; /*----- mutators -------------------------------------------------- */ + + /// set the target thrust + void set_target_thrust(float thrust); + + /// set the target direction + void set_target_direction(float direction); + + /// set the target pitch + void set_target_pitch(float pitch); + + /// set target roll + void set_target_roll(float roll); + + /// set target strafe + void set_target_strafe(float strafe); - /// set all control flags - inline void set_control_flags(int control_flags) { - entity_control_flags = control_flags; - } - - /// set a single control flag - inline void set_control_flag(ControlFlags control_flag) { - entity_control_flags |= control_flag; - } + /// set target vertical strafe + void set_target_vstrafe(float vstrafe); - /// unset a single control flag - inline void unset_control_flag(ControlFlags control_flag) { - entity_control_flags &= ~control_flag; - } + /// set target afterburner/reverse + void set_target_afterburner(float afterburner); + + /// set target aim + void set_target_aim(const math::Vector3f &aim); + + /// set target controlflags + void set_target_controlflags(int controlflags); /** * @brief set the zone the entity is currently in * this fuction removes the entity from its previous zone * and removes it to the new one, if it is not 0 - */ + * */ virtual void set_zone(Zone *zone); /** @@ -763,30 +775,9 @@ public: /// set the player who owns this entity void set_owner(Player *owner); - - /// set the target thrust - void set_thrust(float thrust); - - /// set the target direction - void set_direction(float direction); - - /// set the target pitch - void set_pitch(float pitch); - - /// set target roll - void set_roll(float roll); - - /// set target strafe - void set_strafe(float strafe); - - /// set target vertical strafe - void set_vstrafe(float vstrafe); - - /// set afterburner/reverse - void set_afterburner(float afterburner); - /// set aim - void set_target_aim(const math::Vector3f &aim); + /// set thrust + void set_thrust(float thrust); /** * @brief runs one game frame for the entity @@ -796,14 +787,17 @@ public: */ virtual void frame(const unsigned long elapsed); - /// current thrust - float entity_thrust; - protected: /// physics action interface callback virtual void action (btScalar seconds); + /// current control flags + int entity_controlflags; + + /// current thrust + float entity_thrust; + /* target_ variables can be set by the client */ /** @@ -837,13 +831,14 @@ protected: math::Vector3f target_aim; - int entity_control_flags; + int target_controlflags; ActionInterface *entity_actioninterface; private: - // owner of the entity + /// owner of the entity Player *entity_owner; + }; /// a Globe entity -- cgit v1.2.3