Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStijn Buys <ingar@osirion.org>2010-11-24 23:00:28 +0000
committerStijn Buys <ingar@osirion.org>2010-11-24 23:00:28 +0000
commit02b285bf20603bab6fc75d106acbaccead645eb9 (patch)
tree7be22d06339e1bb70b7ef5011312c13865976ced /src/core/entity.h
parentf66a28a68114f3c9efe109b6948ecec163cdb153 (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.h')
-rw-r--r--src/core/entity.h91
1 files changed, 72 insertions, 19 deletions
diff --git a/src/core/entity.h b/src/core/entity.h
index 5c34f97..2d79132 100644
--- a/src/core/entity.h
+++ b/src/core/entity.h
@@ -595,6 +595,10 @@ class EntityControlable : public EntityDynamic
{
friend class Player;
public:
+
+ /// control flags
+ enum ControlFlags {ControlFlagNone = 0, ControlFlagImpulse = 1};
+
/// bullet action interface class
class ActionInterface: public btActionInterface {
public:
@@ -634,9 +638,9 @@ public:
return entity_thrust;
}
- /// movement indicator
- inline float movement() const {
- return entity_movement;
+ /// control flags
+ inline unsigned int control_flags() const {
+ return entity_control_flags;
}
/// physics action
@@ -656,6 +660,21 @@ public:
virtual void serialize_server_update(std::ostream & os) const;
/*----- mutators -------------------------------------------------- */
+
+ /// set all control flags
+ inline void set_control_flags(unsigned 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;
+ }
+
+ /// unset a single control flag
+ inline void unset_control_flag(ControlFlags control_flag) {
+ entity_control_flags &= ~control_flag;
+ }
/**
* @brief set the zone the entity is currently in
@@ -748,7 +767,7 @@ protected:
float target_vstrafe;
- float entity_movement;
+ unsigned int entity_control_flags;
ActionInterface *entity_actioninterface;
@@ -768,16 +787,58 @@ public:
virtual ~EntityGlobe();
/*----- inspectors ----------------------------------------------- */
+ /// core type id
+ virtual inline const unsigned int type() const {
+ return Entity::Globe;
+ }
+
/// texture name
- inline const std::string &texture() const {
- return entity_texture;
+ inline const std::string &texturename() const {
+ return entity_texturename;
+ }
+
+ /// texture render id
+ inline size_t texture_id() const {
+ return entity_texture_id;
+ }
+
+ /// corona texture name
+ inline const std::string &coronaname() const {
+ return entity_coronaname;
}
+ /// corona texture id
+ inline size_t corona_id() const {
+ return entity_corona_id;
+ }
+
/// rotation speed in degrees per second
inline float rotationspeed() const {
return entity_rotationspeed;
}
+ /*----- mutators -------------------------------------------------- */
+
+ inline void set_rotationspeed(const float rotationspeed) {
+ entity_rotationspeed = rotationspeed;
+ }
+
+ inline void set_texture_id(size_t texture_id) {
+ entity_texture_id = texture_id;
+ }
+
+ inline void set_corona_id(size_t texture_id) {
+ entity_corona_id = texture_id;
+ }
+
+ inline void set_texturename(const std::string & texturename) {
+ entity_texturename.assign(texturename);
+ }
+
+ inline void set_coronaname(const std::string & texturename) {
+ entity_coronaname.assign(texturename);
+ }
+
/*----- serializers ----------------------------------------------- */
/// serialize the entity to a stream
@@ -786,20 +847,12 @@ public:
/// receive a server-to-client create from a stream
virtual void receive_server_create(std::istream &is);
- /*----- inspectors ------------------------------------------------ */
-
- /// core type id
- virtual inline const unsigned int type() const {
- return Entity::Globe;
- }
-
- std::string entity_texture;
-
- /// client side, texture id
- unsigned int render_texture;
-
- /// rotation speed in degrees/second;
+private:
float entity_rotationspeed;
+ size_t entity_texture_id;
+ size_t entity_corona_id;
+ std::string entity_texturename;
+ std::string entity_coronaname;
};
}