From 02b285bf20603bab6fc75d106acbaccead645eb9 Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Wed, 24 Nov 2010 23:00:28 +0000 Subject: 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 --- src/game/base/game.cc | 6 ---- src/game/base/planet.cc | 3 +- src/game/base/star.cc | 3 ++ src/game/intro/intro.cc | 89 +++++++++++++++++++++++-------------------------- 4 files changed, 45 insertions(+), 56 deletions(-) (limited to 'src/game') diff --git a/src/game/base/game.cc b/src/game/base/game.cc index 7ed01e1..108c13f 100644 --- a/src/game/base/game.cc +++ b/src/game/base/game.cc @@ -1232,8 +1232,6 @@ bool Game::load_zone(core::Zone *zone) } else if (zoneini.in_section("star")) { if (core::Parser::got_entity_key(zoneini, star)) { continue; - } else if (zoneini.got_key_string("texture", star->entity_texture)) { - continue; } else { zoneini.unkown_key(); } @@ -1289,10 +1287,6 @@ bool Game::load_zone(core::Zone *zone) } else if (zoneini.in_section("planet")) { if (core::Parser::got_entity_key(zoneini, planet)) { continue; - } else if (zoneini.got_key_string("texture", planet->entity_texture)) { - continue; - } else if (zoneini.got_key_float("rotationspeed", planet->entity_rotationspeed)) { - continue; } else if (zoneini.got_key_bool("dock", b)) { if (b) { planet->set_flag(core::Entity::Dockable); diff --git a/src/game/base/planet.cc b/src/game/base/planet.cc index 8723af4..2adb1fb 100644 --- a/src/game/base/planet.cc +++ b/src/game/base/planet.cc @@ -17,10 +17,9 @@ Planet::Planet() : core::EntityGlobe() get_color().assign(1.0f, 1.0f); // white set_radius(64.0f); // 64 game units + set_rotationspeed(1.0f); // default rotationspeed: 1 degree per second entity_moduletypeid = planet_enttype; - - entity_rotationspeed = 1.0f; } Planet::~Planet() diff --git a/src/game/base/star.cc b/src/game/base/star.cc index 6327223..c54788a 100644 --- a/src/game/base/star.cc +++ b/src/game/base/star.cc @@ -21,6 +21,9 @@ Star::Star() : core::EntityGlobe() set_radius(96.0f); entity_moduletypeid = star_enttype; + + // default star corona name + set_coronaname("default"); } Star::~Star() diff --git a/src/game/intro/intro.cc b/src/game/intro/intro.cc index 072f06d..8d44391 100644 --- a/src/game/intro/intro.cc +++ b/src/game/intro/intro.cc @@ -37,11 +37,11 @@ bool Intro::load_world() { std::string filename("ini/intro"); - filesystem::IniFile ini; - ini.open(filename); + filesystem::IniFile inifile; + inifile.open(filename); - if (!ini.is_open()) { - con_error << "Could not open " << ini.name() << std::endl; + if (!inifile.is_open()) { + con_error << "Could not open " << inifile.name() << std::endl; return false; } @@ -54,101 +54,94 @@ bool Intro::load_world() math::Color color; math::Vector3f v; float f; - bool b; - while (ini.getline()) { + while (inifile.getline()) { - if (ini.got_section()) { - if (ini.got_section("intro")) { + if (inifile.got_section()) { + if (inifile.got_section("intro")) { zone = new core::Zone("intro"); zone->set_name("Introduction"); zone->set_sky("sky"); core::Zone::add(zone); - } else if (ini.got_section("entity")) { + } else if (inifile.got_section("entity")) { if (zone) { entity = new core::Entity(); + entity->set_zone(zone); + entity->set_radius(0); } - } else if (ini.got_section("convoy")) { + } else if (inifile.got_section("convoy")) { if (zone) { convoy = new Convoy(zone); } - } else if (ini.got_section("globe")) { + } else if (inifile.got_section("globe")) { if (zone) { globe = new core::EntityGlobe(); globe->set_zone(zone); } } else { - ini.unknown_section(); + inifile.unknown_section(); } - } else if (zone && ini.got_key()) { + } else if (zone && inifile.got_key()) { - if (ini.in_section("intro")) { + if (inifile.in_section("intro")) { - if (ini.got_key_string("label", strval)) { + if (inifile.got_key_string("label", strval)) { zone->set_label(strval); - } else if (ini.got_key_string("sky", strval)) { + } else if (inifile.got_key_string("sky", strval)) { zone->set_sky(strval); - } else if (ini.got_key()) { - ini.unkown_key(); + } else if (inifile.got_key()) { + inifile.unkown_key(); } - } else if (ini.in_section("entity")) { + } else if (inifile.in_section("entity")) { - if (core::Parser::got_entity_key(ini, entity)) { - entity->set_radius(0); + if (core::Parser::got_entity_key(inifile, entity)) { continue; } else { - ini.unkown_key(); + inifile.unkown_key(); + } + + } else if (inifile.in_section("globe")) { + + if (core::Parser::got_entity_key(inifile, globe)) { + continue; + + } else if (inifile.got_key()) { + inifile.unkown_key(); } - } else if (ini.in_section("convoy")) { + } else if (inifile.in_section("convoy")) { - if (ini.got_key_string("label", strval)) { + if (inifile.got_key_string("label", strval)) { convoy->set_label(strval); - } else if (ini.got_key_color("color", color)) { + } else if (inifile.got_key_color("color", color)) { convoy->set_color(color); - } else if (ini.got_key_color("colorsecond", color)) { + } else if (inifile.got_key_color("colorsecond", color)) { convoy->set_color_second(color); - } else if (ini.got_key_vector3f("location", v)) { + } else if (inifile.got_key_vector3f("location", v)) { convoy->get_location().assign(v); - } else if (ini.got_key_float("direction", f)) { + } else if (inifile.got_key_float("direction", f)) { convoy->get_axis().change_direction(f); - } else if (ini.got_key_float("speed", f)) { + } else if (inifile.got_key_float("speed", f)) { convoy->set_speed(f); - } else if (ini.got_key_string("ship", strval)) { + } else if (inifile.got_key_string("ship", strval)) { convoy->add(strval); - } else if (ini.got_key()) { - ini.unkown_key(); - } - - } else if (ini.in_section("globe")) { - - if (core::Parser::got_entity_key(ini, globe)) { - continue; - } else if (ini.got_key_string("texture", globe->entity_texture)) { - continue; - } else if (ini.got_key_float("rotationspeed", globe->entity_rotationspeed)) { - continue; - } else if (ini.got_key_bool("bright", b)) { - if (b) { - globe->set_flag(core::Entity::Bright); - } - } else if (ini.got_key()) { - ini.unkown_key(); + } else if (inifile.got_key()) { + inifile.unkown_key(); } } } -- cgit v1.2.3