diff options
author | Stijn Buys <ingar@osirion.org> | 2008-08-07 23:27:42 +0000 |
---|---|---|
committer | Stijn Buys <ingar@osirion.org> | 2008-08-07 23:27:42 +0000 |
commit | a743791e624590e0b41229f28f940db5272b60ba (patch) | |
tree | 6a6ec736e4ed34d5254a292889e6e33300919a63 /src/core/entity.h | |
parent | 1f36b993d603c56251aa15eb6edc6b92ecf599ae (diff) |
rotating planets, navpoints, network protocol updates, entity event state
Diffstat (limited to 'src/core/entity.h')
-rw-r--r-- | src/core/entity.h | 45 |
1 files changed, 32 insertions, 13 deletions
diff --git a/src/core/entity.h b/src/core/entity.h index 40d1ffa..2b2ed00 100644 --- a/src/core/entity.h +++ b/src/core/entity.h @@ -46,6 +46,9 @@ public: /// Entity shape constants enum Shape {Diamond=0, Sphere=1, Cube=2, Axis=3}; + /// EntityDynamic event state classes + enum Event {Normal=0, ImpulseInitiate=2, Impulse=3, JumpInitiate=4, Jump=5}; + /// create a new entity and add it to the registry Entity(unsigned int flags = 0); @@ -111,6 +114,8 @@ public: /// base radius of the entity inline float radius() const { return entity_radius; } +/*----- serializers ----------------------------------------------- */ + /// serialize the entity to a stream virtual void serialize_server_create(std::ostream & os) const; @@ -120,7 +125,6 @@ public: /// serialize a server-to-client update on a stream virtual void serialize_server_update(std::ostream & os) const; - /*----- mutators -------------------------------------------------- */ /// receive a client-to-server update from a stream @@ -227,7 +231,6 @@ public: virtual ~EntityDynamic(); - /*----- inspectors ------------------------------------------------ */ /// core type id virtual inline unsigned int type() const { return Entity::Dynamic; } @@ -235,6 +238,14 @@ public: /// current speed of the entity in game units per second inline float speed() const { return entity_speed; } + /// event state + inline unsigned int eventstate() const { return entity_eventstate; } + + /// event state timer + inline float timer() const { return entity_timer; } + +/*----- serializers ----------------------------------------------- */ + /// serialize the entity to a stream virtual void serialize_server_create(std::ostream & os) const; @@ -264,13 +275,17 @@ public: /// speed of the entity float entity_speed; + +protected: + unsigned int entity_eventstate; + float entity_timer; + }; /// an entity that can be controlled by a player class EntityControlable : public EntityDynamic { friend class Player; - public: /// create a controlable entity EntityControlable(Player *owner, unsigned int flags = 0); @@ -292,6 +307,8 @@ public: /// thrust inline float thrust() const { return entity_thrust; } +/*----- serializers ----------------------------------------------- */ + /// serialize the entity to a stream virtual void serialize_server_create(std::ostream & os) const; @@ -301,10 +318,6 @@ public: /// serialize a server-to-client update on a stream virtual void serialize_server_update(std::ostream & os) const; - /// autolevel mode - bool autolevel() const { return entity_autolevel; } - - /*----- mutators -------------------------------------------------- */ /// receive a client-to-server update from a stream @@ -322,9 +335,6 @@ public: /// set the target direction void set_direction(float direction); - /// set autolevel request - void set_autolevel(bool autolevel); - /// set the target pitch void set_pitch(float pitch); @@ -360,7 +370,6 @@ public: private: // owner of the entity Player *entity_owner; - bool entity_autolevel; }; /// a Globe entity @@ -372,14 +381,21 @@ public: ~EntityGlobe(); +/*----- inspectors ----------------------------------------------- */ + /// texture name + inline const std::string &texture() const { return entity_texture; } + + /// rotation speed in degrees per second + inline float rotationspeed() const { return entity_rotationspeed; } + +/*----- serializers ----------------------------------------------- */ + /// serialize the entity to a stream virtual void serialize_server_create(std::ostream & os) const; /// receive a server-to-client create from a stream virtual void receive_server_create(std::istream &is); - inline const std::string &texture() const { return entity_texture; } - /*----- inspectors ------------------------------------------------ */ /// core type id @@ -389,6 +405,9 @@ public: /// client side, texture id unsigned int render_texture; + + /// rotation speed in degrees/second; + float entity_rotationspeed; }; } |