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.cc | 40 +++++++++++++++++++++++++++++----------- 1 file changed, 29 insertions(+), 11 deletions(-) (limited to 'src/core/entity.cc') diff --git a/src/core/entity.cc b/src/core/entity.cc index 78878f9..feff172 100644 --- a/src/core/entity.cc +++ b/src/core/entity.cc @@ -1000,7 +1000,7 @@ void EntityControlable::ActionInterface::debugDraw(btIDebugDraw* debugDrawer) EntityControlable::EntityControlable() : EntityDynamic() { entity_thrust = 0; - entity_control_flags = 0; + entity_controlflags = 0; target_direction = 0.0f; target_thrust = 0.0f; @@ -1008,6 +1008,7 @@ EntityControlable::EntityControlable() : EntityDynamic() target_roll = 0.0f; target_strafe = 0.0f; target_afterburner = 0.0f; + target_controlflags = 0; entity_owner = 0; @@ -1018,7 +1019,7 @@ EntityControlable::EntityControlable(std::istream & is) : EntityDynamic(is) { entity_thrust = 0; - entity_control_flags = 0; + entity_controlflags = 0; target_direction = 0.0f; target_thrust = 0.0f; @@ -1026,6 +1027,7 @@ EntityControlable::EntityControlable(std::istream & is) : target_roll = 0.0f; target_strafe = 0.0f; target_afterburner = 0.0f; + target_controlflags = 0; entity_owner = 0; @@ -1056,6 +1058,14 @@ void EntityControlable::set_owner(Player *owner) } +void EntityControlable::set_thrust(float thrust) +{ + if (entity_thrust != thrust) { + entity_thrust = thrust; + set_dirty(); + } +} + void EntityControlable::serialize_server_create(std::ostream & os) const { EntityDynamic::serialize_server_create(os); @@ -1098,7 +1108,7 @@ void EntityControlable::serialize_client_update(std::ostream & os) const os << target_strafe << " "; os << target_vstrafe << " "; os << target_afterburner << " "; - os << entity_control_flags << " "; + os << target_controlflags << " "; } void EntityControlable::receive_client_update(std::istream &is) @@ -1111,7 +1121,7 @@ void EntityControlable::receive_client_update(std::istream &is) is >> target_strafe; is >> target_vstrafe; is >> target_afterburner; - is >> entity_control_flags; + is >> target_controlflags; } void EntityControlable::serialize_server_update(std::ostream & os) const @@ -1127,7 +1137,7 @@ void EntityControlable::receive_server_update(std::istream &is) entity_thrust /= 100.0f; } -void EntityControlable::set_thrust(float thrust) +void EntityControlable::set_target_thrust(float thrust) { if (thrust != target_thrust) { target_thrust = thrust; @@ -1135,7 +1145,7 @@ void EntityControlable::set_thrust(float thrust) } } -void EntityControlable::set_direction(float direction) +void EntityControlable::set_target_direction(float direction) { if (target_direction != direction) { target_direction = direction; @@ -1143,7 +1153,7 @@ void EntityControlable::set_direction(float direction) } } -void EntityControlable::set_pitch(float pitch) +void EntityControlable::set_target_pitch(float pitch) { if (target_pitch != pitch) { target_pitch = pitch; @@ -1151,7 +1161,7 @@ void EntityControlable::set_pitch(float pitch) } } -void EntityControlable::set_roll(float roll) +void EntityControlable::set_target_roll(float roll) { if (target_roll != roll) { target_roll = roll; @@ -1159,7 +1169,7 @@ void EntityControlable::set_roll(float roll) } } -void EntityControlable::set_strafe(float strafe) +void EntityControlable::set_target_strafe(float strafe) { if (target_strafe != strafe) { target_strafe = strafe; @@ -1167,7 +1177,7 @@ void EntityControlable::set_strafe(float strafe) } } -void EntityControlable::set_vstrafe(float vstrafe) +void EntityControlable::set_target_vstrafe(float vstrafe) { if (target_vstrafe != vstrafe) { target_vstrafe = vstrafe; @@ -1183,7 +1193,7 @@ void EntityControlable::set_target_aim(const math::Vector3f &aim) } } -void EntityControlable::set_afterburner(float afterburner) +void EntityControlable::set_target_afterburner(float afterburner) { if (target_afterburner != afterburner) { target_afterburner = afterburner; @@ -1191,6 +1201,14 @@ void EntityControlable::set_afterburner(float afterburner) } } +void EntityControlable::set_target_controlflags(int controlflags) +{ + if (target_controlflags != controlflags) { + target_controlflags = controlflags; + set_dirty(); + } +} + void EntityControlable::set_zone(Zone *zone) { if (entity_zone == zone) -- cgit v1.2.3