diff options
Diffstat (limited to 'src/game/game.cc')
-rw-r--r-- | src/game/game.cc | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/src/game/game.cc b/src/game/game.cc index f35670a..ca06c81 100644 --- a/src/game/game.cc +++ b/src/game/game.cc @@ -13,6 +13,7 @@ #include "game/game.h" #include "game/navpoint.h" #include "game/planet.h" +#include "game/racetrack.h" #include "game/ship.h" #include "game/star.h" #include "math/mathlib.h" @@ -313,6 +314,8 @@ bool Game::load_zone(core::Zone *zone) Planet *planet = 0; Star *star = 0; NavPoint *navpoint = 0; + RaceTrack *racetrack = 0; + CheckPoint *checkpoint = 0; core::Entity *entity = 0; float direction; @@ -404,6 +407,50 @@ bool Game::load_zone(core::Zone *zone) con_warn << zoneini.name() << " unknown key '" << zoneini.key() << "' at line " << zoneini.line() << std::endl; } + } else if (zoneini.section().compare("racetrack") == 0) { + if (zoneini.got_key_string("label", strval)) { + aux::to_label(strval); + racetrack->entity_label.assign(strval); + continue; + } else if (zoneini.got_key_string("name", racetrack->entity_name)) { + continue; + } else if (zoneini.got_key_vector3f("location", racetrack->entity_location )) { + continue; + } else if (zoneini.got_key_color("color", racetrack->entity_color)) { + continue; + } else if (zoneini.got_key_angle("direction", direction)) { + racetrack->axis().change_direction(direction); + continue; + } else if (zoneini.got_key_angle("pitch", pitch)) { + racetrack->axis().change_pitch(pitch); + continue; + } else if (zoneini.got_key_string("model", racetrack->entity_modelname)) { + continue; + } else { + con_warn << zoneini.name() << " unknown key '" << zoneini.key() << "' at line " << zoneini.line() << std::endl; + } + + } else if (zoneini.section().compare("checkpoint") == 0) { + if (zoneini.got_key_string("label", strval)) { + aux::to_label(strval); + checkpoint->entity_label.assign(strval); + continue; + } else if (zoneini.got_key_string("name", checkpoint->entity_name)) { + continue; + } else if (zoneini.got_key_vector3f("location", checkpoint->entity_location )) { + continue; + } else if (zoneini.got_key_angle("direction", direction)) { + checkpoint->axis().change_direction(direction); + continue; + } else if (zoneini.got_key_angle("pitch", pitch)) { + checkpoint->axis().change_pitch(pitch); + continue; + } else if (zoneini.got_key_string("model", checkpoint->entity_modelname)) { + continue; + } else { + con_warn << zoneini.name() << " unknown key '" << zoneini.key() << "' at line " << zoneini.line() << std::endl; + } + } else if (zoneini.section().compare("entity") == 0) { std::string shapename; if (zoneini.got_key_string("shape", shapename)) { @@ -460,6 +507,16 @@ bool Game::load_zone(core::Zone *zone) navpoint = new NavPoint(); navpoint->set_zone(zone); count ++; + + } else if(zoneini.got_section("racetrack")) { + racetrack = new RaceTrack(); + racetrack->set_zone(zone); + + } else if(zoneini.got_section("checkpoint")) { + checkpoint = new CheckPoint(racetrack); + if (!racetrack) { + con_warn << zoneini.name() << " checkpoint without racetrack at line " << zoneini.line() << std::endl; + } } else if (zoneini.got_section("planet")) { planet = new Planet(); |