Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorStijn Buys <ingar@osirion.org>2008-10-26 13:35:59 +0000
committerStijn Buys <ingar@osirion.org>2008-10-26 13:35:59 +0000
commit654b908c2ed0c7708b609beb9841f06c4d982cc3 (patch)
treeaa092f5522e801b34676fc4c53e8ea0072c9e980 /src
parent95576727e1e328c18dcc6228dc37762b39464dc1 (diff)
intro.ini updates
Diffstat (limited to 'src')
-rw-r--r--src/game/intro/convoy.cc43
-rw-r--r--src/game/intro/convoy.h16
-rw-r--r--src/game/intro/intro.cc11
3 files changed, 64 insertions, 6 deletions
diff --git a/src/game/intro/convoy.cc b/src/game/intro/convoy.cc
index 8174dd6..226f8fa 100644
--- a/src/game/intro/convoy.cc
+++ b/src/game/intro/convoy.cc
@@ -8,6 +8,9 @@
namespace intro {
+
+/* ---- class Member ----------------------------------------------- */
+
Member::Member(std::string const &model) : core::EntityControlable(0, 1)
{
set_name("Convoy member");
@@ -16,6 +19,7 @@ Member::Member(std::string const &model) : core::EntityControlable(0, 1)
entity_modelname = "ships/" + model;
entity_thrust = 1.0f;
+/*
entity_speed = 1.0f;
entity_location.x = -16.0f;
@@ -23,6 +27,7 @@ Member::Member(std::string const &model) : core::EntityControlable(0, 1)
entity_location.z = math::randomf(8.0f) - 6.0f;
entity_axis.change_direction(15.0f);
+*/
}
Member::~Member()
@@ -34,9 +39,12 @@ void Member::frame(float seconds)
entity_location += entity_axis.forward() * speed() * thrust() * seconds;
}
+/* ---- class convoy ----------------------------------------------- */
+
Convoy::Convoy(core::Zone *zone)
{
convoy_zone = zone;
+ convoy_speed = 1;
}
Convoy::~Convoy()
@@ -44,27 +52,56 @@ Convoy::~Convoy()
convoy_members.clear();
}
-void Convoy::set_color(math::Color const &color)
+void Convoy::set_color(const math::Color &color)
{
convoy_color.assign(color);
}
-void Convoy::set_color_second(math::Color const &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));
}
-void Convoy::add(std::string const &model)
+void Convoy::add(const std::string &model)
{
+ float d = 0;
+
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->entity_thrust = 1.0f;
+ member->entity_speed = convoy_speed;
+
+ member->entity_location.assign(convoy_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);
}
void Convoy::frame(float seconds)
diff --git a/src/game/intro/convoy.h b/src/game/intro/convoy.h
index 8f8a64d..20eb0e1 100644
--- a/src/game/intro/convoy.h
+++ b/src/game/intro/convoy.h
@@ -30,12 +30,18 @@ public:
~Convoy();
void add(const char *model);
- void add(std::string const &model);
+ void add(const std::string &model);
void frame(float seconds);
- void set_color(math::Color const &color);
- void set_color_second(math::Color const &color);
+ void set_color(const math::Color &color);
+ void set_color_second(const math::Color &color);
+
+ void set_location(math::Vector3f const &location);
+
+ void set_speed(const float speed);
+
+ void change_direction(float angle);
private:
typedef std::list<Member *> Members;
@@ -43,6 +49,10 @@ private:
core::Zone *convoy_zone;
math::Color convoy_color;
math::Color convoy_color_second;
+
+ math::Vector3f convoy_location;
+ math::Axis convoy_axis;
+ float convoy_speed;
};
}
diff --git a/src/game/intro/intro.cc b/src/game/intro/intro.cc
index 95d003a..55f038f 100644
--- a/src/game/intro/intro.cc
+++ b/src/game/intro/intro.cc
@@ -55,6 +55,8 @@ bool Intro::load_world()
std::string strval;
core::EntityGlobe *globe = 0;
math::Color color;
+ math::Vector3f v;
+ float f;
bool b;
while (ini.getline()) {
@@ -91,6 +93,15 @@ bool Intro::load_world()
} else if (ini.got_key_color("colorsecond", color)) {
intro_convoy->set_color_second(color);
+ } else if (ini.got_key_vector3f("location", v)) {
+ intro_convoy->set_location(v);
+
+ } else if (ini.got_key_float("direction", f)) {
+ intro_convoy->change_direction(f);
+
+ } else if (ini.got_key_float("speed", f)) {
+ intro_convoy->set_speed(f);
+
} else if (ini.got_key_string("ship", strval)) {
intro_convoy->add(strval);