From a3cfb9c4634e3ce7e052e72ce564d25e5367a430 Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Sat, 15 Aug 2009 13:25:37 +0000 Subject: API cleanups, const optimizations, submodel lights/flares/particles import --- src/game/base/game.cc | 22 +++++++++++----------- src/game/base/planet.cc | 2 +- src/game/base/shipdealer.cc | 6 +++--- src/game/base/station.cc | 2 +- src/game/example/example.cc | 18 +++++++++--------- src/game/intro/convoy.cc | 14 +++++++------- src/game/intro/intro.cc | 4 ++-- 7 files changed, 34 insertions(+), 34 deletions(-) (limited to 'src/game') diff --git a/src/game/base/game.cc b/src/game/base/game.cc index ed1b80e..35dfc5f 100644 --- a/src/game/base/game.cc +++ b/src/game/base/game.cc @@ -82,8 +82,8 @@ void Game::func_join(core::Player *player, std::string const &args) core::Entity *dock = ship->zone()->default_view(); if (dock) { - ship->entity_location.assign(dock->location() + (dock->axis().forward() * ((ship->radius()+ dock->radius())*2.0f))); - ship->entity_axis.assign(dock->axis()); + ship->get_location().assign(dock->location() + (dock->axis().forward() * ((ship->radius()+ dock->radius())*2.0f))); + ship->get_axis().assign(dock->axis()); ship->set_state(core::Entity::Docked); player->set_view(dock); } @@ -237,8 +237,8 @@ void Game::func_launch(core::Player *player, std::string const &args) Ship *ship = static_cast(player->control()); ship->shutdown_physics(); core::Entity *dock = player->view(); - ship->entity_location.assign(dock->location() + (dock->axis().forward() * (ship->radius()+ dock->radius()))); - ship->entity_axis.assign(dock->axis()); + ship->get_location().assign(dock->location() + (dock->axis().forward() * (ship->radius()+ dock->radius()))); + ship->get_axis().assign(dock->axis()); ship->set_state(core::Entity::Normal); ship->init_physics(ship->radius()); ship->set_state(core::Entity::Jump); @@ -265,14 +265,14 @@ void Game::func_respawn(core::Player *player, std::string const &args) ship->shutdown_physics(); if (dock) { - ship->entity_location.assign(dock->location() + (dock->axis().forward() * ((ship->radius()+ dock->radius())))); - ship->entity_axis.assign(dock->axis()); + ship->get_location().assign(dock->location() + (dock->axis().forward() * ((ship->radius()+ dock->radius())))); + ship->get_axis().assign(dock->axis()); ship->set_state(core::Entity::Docked); player->set_view(dock); player->send("^BRespawning at " + dock->name()); } else { - ship->location().clear(); - ship->axis().clear(); + ship->get_location().clear(); + ship->get_axis().clear(); ship->set_state(core::Entity::Jump); player->set_view(0); player->send("^BRespawning"); @@ -303,9 +303,9 @@ void Game::func_goto(core::Player *player, const std::string &args) if (dock) { ship->shutdown_physics(); - ship->entity_location.assign(dock->location() + (dock->axis().forward() * (ship->radius()+dock->radius()))); - ship->entity_axis.assign(dock->axis()); - ship->entity_axis.change_direction(180.0f); + ship->get_location().assign(dock->location() + (dock->axis().forward() * (ship->radius()+dock->radius()))); + ship->get_axis().assign(dock->axis()); + ship->get_axis().change_direction(180.0f); ship->set_state(core::Entity::Normal); ship->init_physics(ship->radius()); diff --git a/src/game/base/planet.cc b/src/game/base/planet.cc index 3242f15..60885b1 100644 --- a/src/game/base/planet.cc +++ b/src/game/base/planet.cc @@ -52,7 +52,7 @@ void Planet::dock(core::Entity *entity) return; } - ship->location().assign(entity->location()); + ship->get_location().assign(entity->location()); ship->set_state(core::Entity::Docked); if (ship->owner() && ship->owner()->control() == ship) { diff --git a/src/game/base/shipdealer.cc b/src/game/base/shipdealer.cc index feef432..408ae43 100644 --- a/src/game/base/shipdealer.cc +++ b/src/game/base/shipdealer.cc @@ -132,10 +132,10 @@ void ShipDealer::func_buy(core::Player *player, const std::string &args) Ship * ship = new Ship(player, shipmodel); if (dock) { ship->set_zone(dock->zone()); - ship->location().assign(dock->location()); + ship->get_location().assign(dock->location()); ship->set_state(core::Entity::Docked); - ship->entity_axis.assign(dock->axis()); - ship->entity_axis.change_direction(180.0f); + ship->get_axis().assign(dock->axis()); + ship->get_axis().change_direction(180.0f); player->set_control(ship); player->set_view(dock); } else { diff --git a/src/game/base/station.cc b/src/game/base/station.cc index 67c1595..0552269 100644 --- a/src/game/base/station.cc +++ b/src/game/base/station.cc @@ -48,7 +48,7 @@ void Station::dock(core::Entity *entity) return; } - ship->location().assign(entity->location()); + ship->get_location().assign(entity->location()); ship->set_state(core::Entity::Docked); if (ship->owner() && ship->owner()->control() == ship) { diff --git a/src/game/example/example.cc b/src/game/example/example.cc index 25daef7..9d4c1ed 100644 --- a/src/game/example/example.cc +++ b/src/game/example/example.cc @@ -43,8 +43,8 @@ Example::Example() : core::Module("The Osirion Project Example", true) cube->set_label("cube"); cube->set_name("The Red Cube"); cube->entity_shape = core::Entity::Cube; // set the shape to cube - cube->entity_location.assign(16, -8, 0); // set location - cube->entity_color.assign(1, 0, 0); // set RGB color red + cube->get_location().assign(16, -8, 0); // set location + cube->get_color().assign(1, 0, 0); // set RGB color red cube->entity_radius = 0.25f; // set radius, in game units cube->set_zone(zone); // add the entity to the zone @@ -52,8 +52,8 @@ Example::Example() : core::Module("The Osirion Project Example", true) sphere->set_label("sphere"); sphere->set_name("The Green Sphere"); sphere->entity_shape = core::Entity::Sphere; // set the shape to sphere - sphere->entity_location.assign(16, 0, 0); // set location - sphere->entity_color.assign(0, 1, 0); // set RGB color green + sphere->get_location().assign(16, 0, 0); // set location + sphere->get_color().assign(0, 1, 0); // set RGB color green sphere->entity_radius = 0.25f; // set radius, in game units sphere->set_zone(zone); // add the entity to the zone @@ -61,8 +61,8 @@ Example::Example() : core::Module("The Osirion Project Example", true) diamond->set_label("diamond"); diamond->set_name("The Blue Diamond"); diamond->entity_shape = core::Entity::Diamond; // set the shape to cube - diamond->entity_location.assign(16, 8, 0); // set location - diamond->entity_color.assign(0, 0, 1); // set RGB color blue + diamond->get_location().assign(16, 8, 0); // set location + diamond->get_color().assign(0, 0, 1); // set RGB color blue diamond->entity_radius = 0.25f; // set radius, in game units diamond->set_zone(zone); // add the entity to the zone @@ -70,9 +70,9 @@ Example::Example() : core::Module("The Osirion Project Example", true) axis->set_label("origin"); axis->set_name("The Origin"); axis->entity_shape = core::Entity::Axis; // set the shape to axis - axis->entity_location.assign(0, 0, 0); // set location - axis->entity_color.assign(1); // set greyscale color white - axis->entity_color_second.assign(0.5f, 0.0f, 0.5f); // set RGB secondary color + axis->get_location().assign(0, 0, 0); // set location + axis->get_color().assign(1); // set greyscale color white + axis->get_color_second().assign(0.5f, 0.0f, 0.5f); // set RGB secondary color axis->entity_radius = 0.25f; // set radius, in game units axis->set_zone(zone); // add the entity to the zone diff --git a/src/game/intro/convoy.cc b/src/game/intro/convoy.cc index 6671369..9e13ae5 100644 --- a/src/game/intro/convoy.cc +++ b/src/game/intro/convoy.cc @@ -59,20 +59,20 @@ void Convoy::add(const std::string &model) Member *member = new Member(model); convoy_members.push_back(member); member->set_zone(zone()); - member->entity_color.assign(color()); - member->entity_color_second.assign(color_second()); + member->get_color().assign(color()); + member->get_color_second().assign(color_second()); member->entity_thrust = 1.0f; member->entity_speed = speed(); - member->entity_location.assign(location()); + member->get_location().assign(location()); d = ((float) convoy_members.size()) * 0.5f; - member->entity_location.x += math::randomf((float) convoy_members.size()) -d; - member->entity_location.y += math::randomf((float) convoy_members.size()) -d; - member->entity_location.z += (math::randomf((float) convoy_members.size()) -d) * 0.5f; + member->get_location().x += math::randomf((float) convoy_members.size()) -d; + member->get_location().y += math::randomf((float) convoy_members.size()) -d; + member->get_location().z += (math::randomf((float) convoy_members.size()) -d) * 0.5f; - member->entity_axis.assign(axis()); + member->get_axis().assign(axis()); } void Convoy::frame(float seconds) diff --git a/src/game/intro/intro.cc b/src/game/intro/intro.cc index 3fafa0f..05dcec7 100644 --- a/src/game/intro/intro.cc +++ b/src/game/intro/intro.cc @@ -104,10 +104,10 @@ bool Intro::load_world() convoy->set_color_second(color); } else if (ini.got_key_vector3f("location", v)) { - convoy->entity_location.assign(v); + convoy->get_location().assign(v); } else if (ini.got_key_float("direction", f)) { - convoy->axis().change_direction(f); + convoy->get_axis().change_direction(f); } else if (ini.got_key_float("speed", f)) { convoy->entity_speed = f; -- cgit v1.2.3