From 9c56ebfdba5fe33476f8d382da6d72e5b81ab4b8 Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Sun, 10 Aug 2008 18:48:23 +0000 Subject: added racetrack to the game module, added Odin's new structures to the assets documentation --- src/game/game.cc | 57 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) (limited to 'src/game/game.cc') 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(); -- cgit v1.2.3