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>2008-12-21 18:03:58 +0000
committerStijn Buys <ingar@osirion.org>2008-12-21 18:03:58 +0000
commit164e3c5b1cd9e6d6f7ca26964df4c54394eb1c84 (patch)
treec34e7e7747d8f76a4161a045d406c05dcbb227a3 /src/game/intro/convoy.cc
parentcf1f5b659873c7eb1557ce7cedc17eed6ca03185 (diff)
multiple introductions
Diffstat (limited to 'src/game/intro/convoy.cc')
-rw-r--r--src/game/intro/convoy.cc61
1 files changed, 16 insertions, 45 deletions
diff --git a/src/game/intro/convoy.cc b/src/game/intro/convoy.cc
index 3421538..6671369 100644
--- a/src/game/intro/convoy.cc
+++ b/src/game/intro/convoy.cc
@@ -19,15 +19,6 @@ Member::Member(std::string const &model) : core::EntityControlable(0, 1)
set_modelname(model);
entity_thrust = 1.0f;
-/*
- entity_speed = 1.0f;
-
- entity_location.x = -16.0f;
- entity_location.y = -math::randomf(8.0f);
- entity_location.z = math::randomf(8.0f) - 6.0f;
-
- entity_axis.change_direction(15.0f);
-*/
}
Member::~Member()
@@ -36,15 +27,19 @@ Member::~Member()
void Member::frame(float seconds)
{
- entity_location += entity_axis.forward() * speed() * thrust() * seconds;
+ entity_location += axis().forward() * speed() * thrust() * seconds;
}
-/* ---- class convoy ----------------------------------------------- */
+/* ---- class Convoy ----------------------------------------------- */
-Convoy::Convoy(core::Zone *zone)
+Convoy::Convoy(core::Zone *zone) : core::EntityDynamic()
{
- convoy_zone = zone;
- convoy_speed = 1;
+ set_zone(zone);
+ set_label("convoy");
+ set_name("Convoy");
+
+ entity_speed = 1;
+ entity_serverside = true;
}
Convoy::~Convoy()
@@ -52,30 +47,6 @@ Convoy::~Convoy()
convoy_members.clear();
}
-void Convoy::set_color(const math::Color &color)
-{
- convoy_color.assign(color);
-}
-void Convoy::set_color_second(const math::Color &color)
-{
- convoy_color_second.assign(color);
-}
-
-void Convoy::set_location(const math::Vector3f &location)
-{
- convoy_location.assign(location);
-}
-
-void Convoy::change_direction(float angle)
-{
- convoy_axis.change_direction(angle);
-}
-
-void Convoy::set_speed(const float speed)
-{
- convoy_speed = speed;
-}
-
void Convoy::add(const char *model)
{
add(std::string(model));
@@ -87,21 +58,21 @@ void Convoy::add(const std::string &model)
Member *member = new Member(model);
convoy_members.push_back(member);
- member->set_zone(convoy_zone);
- member->entity_color.assign(convoy_color);
- member->entity_color_second.assign(convoy_color_second);
+ member->set_zone(zone());
+ member->entity_color.assign(color());
+ member->entity_color_second.assign(color_second());
member->entity_thrust = 1.0f;
- member->entity_speed = convoy_speed;
+ member->entity_speed = speed();
- member->entity_location.assign(convoy_location);
+ member->entity_location.assign(location());
d = ((float) convoy_members.size()) * 0.5f;
member->entity_location.x += math::randomf((float) convoy_members.size()) -d;
member->entity_location.y += math::randomf((float) convoy_members.size()) -d;
member->entity_location.z += (math::randomf((float) convoy_members.size()) -d) * 0.5f;
- member->entity_axis.change_direction(15.0f);
+ member->entity_axis.assign(axis());
}
void Convoy::frame(float seconds)
@@ -109,7 +80,7 @@ void Convoy::frame(float seconds)
for (Members::iterator it = convoy_members.begin(); it != convoy_members.end(); ) {
Member *member = (*it);
if (member->location().length() > 64.0f) {
- std::string model(member->label());
+ std::string model(member->model()->name());
member->die();
convoy_members.erase(it++);
add(model);