From 36e52bc178b2ba25ecc1b3fc13e03f2aee1e8efa Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Sun, 25 May 2008 15:06:09 +0000 Subject: planet updates --- src/game/Makefile.am | 4 ++-- src/game/game.cc | 23 +++++++++++++++++++++-- src/game/game.h | 4 +--- src/game/star.cc | 1 - 4 files changed, 24 insertions(+), 8 deletions(-) (limited to 'src/game') diff --git a/src/game/Makefile.am b/src/game/Makefile.am index e9f8d0b..394e209 100644 --- a/src/game/Makefile.am +++ b/src/game/Makefile.am @@ -2,7 +2,7 @@ INCLUDES = -I$(top_srcdir)/src METASOURCES = AUTO libgame_la_LDFLAGS = -avoid-version -libgame_la_SOURCES = game.cc ship.cc shipmodel.cc star.cc +libgame_la_SOURCES = game.cc planet.cc ship.cc shipmodel.cc star.cc noinst_LTLIBRARIES = libgame.la -noinst_HEADERS = game.h ship.h shipmodel.h star.h +noinst_HEADERS = game.h planet.h ship.h shipmodel.h star.h diff --git a/src/game/game.cc b/src/game/game.cc index 4a77d7d..15ae029 100644 --- a/src/game/game.cc +++ b/src/game/game.cc @@ -11,6 +11,7 @@ #include "filesystem/filesystem.h" #include "filesystem/inifile.h" #include "game/game.h" +#include "game/planet.h" #include "game/ship.h" #include "game/star.h" #include "math/mathlib.h" @@ -156,6 +157,7 @@ void Game::init() return; } + Planet *planet = 0; Star *star = 0; core::Entity *entity = 0; @@ -168,12 +170,26 @@ void Game::init() if (worldini.section().compare("star") == 0) { if (worldini.got_key_string("name", star->entity_name)) continue; - else if (worldini.got_key_string("model", star->entity_modelname)) - continue; else if (worldini.got_key_vector3f("location", star->entity_location )) continue; else if (worldini.got_key_color("color", star->entity_color)) continue; + else if (worldini.got_key_angle("radius", star->entity_radius)) + continue; + else + con_warn << worldini.name() << " unknown key '" << worldini.key() << "' at line " << worldini.line() << std::endl; + + } else if (worldini.section().compare("planet") == 0) { + if (worldini.got_key_string("name", planet->entity_name)) + continue; + else if (worldini.got_key_string("texture", planet->entity_texture)) + continue; + else if (worldini.got_key_vector3f("location", planet->entity_location )) + continue; + else if (worldini.got_key_color("color", planet->entity_color)) + continue; + else if (worldini.got_key_angle("radius", planet->entity_radius)) + continue; else con_warn << worldini.name() << " unknown key '" << worldini.key() << "' at line " << worldini.line() << std::endl; @@ -219,6 +235,9 @@ void Game::init() } else if (worldini.got_section("star")) { star = new Star(); + } else if (worldini.got_section("planet")) { + planet = new Planet(); + } else if (worldini.got_section("entity")) { entity = new core::Entity(); entity->entity_flags += core::Entity::Static; diff --git a/src/game/game.h b/src/game/game.h index 811de84..89889a0 100644 --- a/src/game/game.h +++ b/src/game/game.h @@ -26,9 +26,7 @@ namespace game // entity type constants const unsigned int ship_enttype = 256; const unsigned int star_enttype = 257; -const unsigned int cube_enttype = 258; -const unsigned int sphere_enttype = 259; -const unsigned int axis_enttype = 260; +const unsigned int planet_enttype = 258; class Game : public core::Module { public: diff --git a/src/game/star.cc b/src/game/star.cc index 0a12593..367054f 100644 --- a/src/game/star.cc +++ b/src/game/star.cc @@ -12,7 +12,6 @@ namespace game { Star::Star() : core::EntityGlobe(core::Entity::Static | core::Entity::Solid | core::Entity::Bright) { - entity_shape = core::Entity::Sphere; // a star is a sphere entity_color = math::Color(1,1,1,1); // white entity_radius = 48; // 48 game units -- cgit v1.2.3