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/intro/intro.cc | 89 +++++++++++++++++++++++-------------------------- 1 file changed, 41 insertions(+), 48 deletions(-) (limited to 'src/game/intro') 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