And finally fix some of the API names to make more sense in their current location.
This commit is contained in:
parent
a20d701096
commit
7ffa6025ce
11 changed files with 74 additions and 99 deletions
|
@ -9,7 +9,7 @@ int number_left() {
|
||||||
|
|
||||||
GameDB::current_world()->query<components::Position, Comp>(
|
GameDB::current_world()->query<components::Position, Comp>(
|
||||||
[&](const auto ent, auto&, auto&) {
|
[&](const auto ent, auto&, auto&) {
|
||||||
if(ent != GameDB::current().player) {
|
if(ent != GameDB::current_level().player) {
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -19,15 +19,15 @@ int number_left() {
|
||||||
|
|
||||||
template<typename Comp>
|
template<typename Comp>
|
||||||
Pathing compute_paths() {
|
Pathing compute_paths() {
|
||||||
auto& walls_original = GameDB::current().map->$walls;
|
auto& walls_original = GameDB::current_level().map->$walls;
|
||||||
auto walls_copy = walls_original;
|
auto walls_copy = walls_original;
|
||||||
|
|
||||||
Pathing paths{matrix::width(walls_copy), matrix::height(walls_copy)};
|
Pathing paths{matrix::width(walls_copy), matrix::height(walls_copy)};
|
||||||
|
|
||||||
GameDB::current().world->query<components::Position>(
|
GameDB::current_level().world->query<components::Position>(
|
||||||
[&](const auto ent, auto& position) {
|
[&](const auto ent, auto& position) {
|
||||||
if(ent != GameDB::current().player) {
|
if(ent != GameDB::current_level().player) {
|
||||||
if(GameDB::current().world->has<Comp>(ent)) {
|
if(GameDB::current_level().world->has<Comp>(ent)) {
|
||||||
paths.set_target(position.location);
|
paths.set_target(position.location);
|
||||||
} else {
|
} else {
|
||||||
// this will mark that spot as a wall so we don't path there temporarily
|
// this will mark that spot as a wall so we don't path there temporarily
|
||||||
|
@ -110,7 +110,7 @@ bool Autowalker::path_player(Pathing& paths, Point& target_out) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!GameDB::current().map->can_move(target_out)) {
|
if(!GameDB::current_level().map->can_move(target_out)) {
|
||||||
path_fail(paths.$paths, target_out);
|
path_fail(paths.$paths, target_out);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
100
game_level.cpp
100
game_level.cpp
|
@ -41,17 +41,6 @@ namespace GameDB {
|
||||||
shared_ptr<LevelDB> LDB;
|
shared_ptr<LevelDB> LDB;
|
||||||
bool initialized = false;
|
bool initialized = false;
|
||||||
|
|
||||||
void init() {
|
|
||||||
components::init();
|
|
||||||
textures::init();
|
|
||||||
|
|
||||||
if(!initialized) {
|
|
||||||
LDB = make_shared<LevelDB>();
|
|
||||||
initialized = true;
|
|
||||||
new_level(NULL);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
LevelScaling scale_level() {
|
LevelScaling scale_level() {
|
||||||
return {
|
return {
|
||||||
INITIAL_MAP_W + int(LDB->current_level * 2),
|
INITIAL_MAP_W + int(LDB->current_level * 2),
|
||||||
|
@ -59,28 +48,6 @@ namespace GameDB {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
shared_ptr<DinkyECS::World> current_world() {
|
|
||||||
dbc::check(initialized, "Forgot to call GameDB::init()");
|
|
||||||
return current().world;
|
|
||||||
}
|
|
||||||
|
|
||||||
shared_ptr<gui::BossFightUI> create_bossfight() {
|
|
||||||
dbc::check(initialized, "Forgot to call GameDB::init()");
|
|
||||||
auto prev_world = current_world();
|
|
||||||
dbc::check(prev_world != nullptr, "Starter world for boss fights can't be null.");
|
|
||||||
auto world = clone_load_world(prev_world);
|
|
||||||
auto& config = prev_world->get_the<GameConfig>();
|
|
||||||
|
|
||||||
// BUG: the jank is too strong here
|
|
||||||
auto boss_names = config.bosses.keys();
|
|
||||||
auto& level_name = boss_names[LDB->current_level % boss_names.size()];
|
|
||||||
auto& boss_data = config.bosses[level_name];
|
|
||||||
|
|
||||||
auto boss_id = world->entity();
|
|
||||||
components::configure_entity(*world, boss_id, boss_data["components"]);
|
|
||||||
|
|
||||||
return make_shared<gui::BossFightUI>(world, boss_id);
|
|
||||||
}
|
|
||||||
|
|
||||||
size_t new_level(std::shared_ptr<DinkyECS::World> prev_world) {
|
size_t new_level(std::shared_ptr<DinkyECS::World> prev_world) {
|
||||||
dbc::check(initialized, "Forgot to call GameDB::init()");
|
dbc::check(initialized, "Forgot to call GameDB::init()");
|
||||||
|
@ -106,44 +73,57 @@ namespace GameDB {
|
||||||
return index;
|
return index;
|
||||||
}
|
}
|
||||||
|
|
||||||
Level& create_level() {
|
void init() {
|
||||||
dbc::log("current_level");
|
components::init();
|
||||||
size_t level = new_level(current_world());
|
textures::init();
|
||||||
dbc::check(level == LDB->current_level + 1, "new level index is wrong");
|
|
||||||
auto& the_level = next();
|
if(!initialized) {
|
||||||
dbc::check(level == LDB->current_level, "level didn't update?!");
|
LDB = make_shared<LevelDB>();
|
||||||
return the_level;
|
initialized = true;
|
||||||
|
new_level(NULL);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Level &next() {
|
shared_ptr<DinkyECS::World> current_world() {
|
||||||
|
dbc::check(initialized, "Forgot to call GameDB::init()");
|
||||||
|
return current_level().world;
|
||||||
|
}
|
||||||
|
|
||||||
|
shared_ptr<gui::BossFightUI> create_bossfight() {
|
||||||
|
dbc::check(initialized, "Forgot to call GameDB::init()");
|
||||||
|
auto prev_world = current_world();
|
||||||
|
dbc::check(prev_world != nullptr, "Starter world for boss fights can't be null.");
|
||||||
|
auto world = clone_load_world(prev_world);
|
||||||
|
auto& config = prev_world->get_the<GameConfig>();
|
||||||
|
|
||||||
|
// BUG: the jank is too strong here
|
||||||
|
auto boss_names = config.bosses.keys();
|
||||||
|
auto& level_name = boss_names[LDB->current_level % boss_names.size()];
|
||||||
|
auto& boss_data = config.bosses[level_name];
|
||||||
|
|
||||||
|
auto boss_id = world->entity();
|
||||||
|
components::configure_entity(*world, boss_id, boss_data["components"]);
|
||||||
|
|
||||||
|
return make_shared<gui::BossFightUI>(world, boss_id);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Level& create_level() {
|
||||||
dbc::check(initialized, "Forgot to call GameDB::init()");
|
dbc::check(initialized, "Forgot to call GameDB::init()");
|
||||||
dbc::check(LDB->current_level < LDB->levels.size(), "attempt to get next level when at end");
|
dbc::check(LDB->current_level < LDB->levels.size(), "attempt to get next level when at end");
|
||||||
|
|
||||||
|
size_t level = new_level(current_world());
|
||||||
|
dbc::check(level == LDB->current_level + 1, "new level index is wrong");
|
||||||
|
|
||||||
LDB->current_level++;
|
LDB->current_level++;
|
||||||
return LDB->levels.at(LDB->current_level);
|
return LDB->levels.at(LDB->current_level);
|
||||||
}
|
}
|
||||||
|
|
||||||
Level &previous() {
|
Level ¤t_level() {
|
||||||
dbc::check(initialized, "Forgot to call GameDB::init()");
|
|
||||||
dbc::check(LDB->current_level > 0, "attempt to go to previous level when at 0");
|
|
||||||
LDB->current_level--;
|
|
||||||
return LDB->levels.at(LDB->current_level);
|
|
||||||
}
|
|
||||||
|
|
||||||
Level ¤t() {
|
|
||||||
dbc::check(initialized, "Forgot to call GameDB::init()");
|
dbc::check(initialized, "Forgot to call GameDB::init()");
|
||||||
return LDB->levels.at(LDB->current_level);
|
return LDB->levels.at(LDB->current_level);
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t current_index() {
|
|
||||||
dbc::check(initialized, "Forgot to call GameDB::init()");
|
|
||||||
return LDB->current_level;
|
|
||||||
}
|
|
||||||
|
|
||||||
Level &get(size_t index) {
|
|
||||||
dbc::check(initialized, "Forgot to call GameDB::init()");
|
|
||||||
return LDB->levels.at(index);
|
|
||||||
}
|
|
||||||
|
|
||||||
components::Position& player_position() {
|
components::Position& player_position() {
|
||||||
dbc::check(initialized, "Forgot to call GameDB::init()");
|
dbc::check(initialized, "Forgot to call GameDB::init()");
|
||||||
auto world = current_world();
|
auto world = current_world();
|
||||||
|
@ -153,6 +133,6 @@ namespace GameDB {
|
||||||
|
|
||||||
DinkyECS::Entity the_player() {
|
DinkyECS::Entity the_player() {
|
||||||
dbc::check(initialized, "Forgot to call GameDB::init()");
|
dbc::check(initialized, "Forgot to call GameDB::init()");
|
||||||
return current().player;
|
return current_level().player;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,16 +24,11 @@ namespace GameDB {
|
||||||
};
|
};
|
||||||
|
|
||||||
std::shared_ptr<gui::BossFightUI> create_bossfight();
|
std::shared_ptr<gui::BossFightUI> create_bossfight();
|
||||||
size_t new_level(std::shared_ptr<DinkyECS::World> prev_world);
|
|
||||||
Level& create_level();
|
Level& create_level();
|
||||||
|
|
||||||
void init();
|
void init();
|
||||||
Level &next();
|
Level ¤t_level();
|
||||||
Level &previous();
|
|
||||||
Level ¤t();
|
|
||||||
size_t current_index();
|
|
||||||
std::shared_ptr<DinkyECS::World> current_world();
|
std::shared_ptr<DinkyECS::World> current_world();
|
||||||
Level &get(size_t index);
|
|
||||||
components::Position& player_position();
|
components::Position& player_position();
|
||||||
DinkyECS::Entity the_player();
|
DinkyECS::Entity the_player();
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,7 +46,7 @@ namespace gui {
|
||||||
|
|
||||||
void DebugUI::render(sf::RenderWindow& window) {
|
void DebugUI::render(sf::RenderWindow& window) {
|
||||||
if(active) {
|
if(active) {
|
||||||
auto& level = GameDB::current();
|
auto& level = GameDB::current_level();
|
||||||
auto player = level.world->get_the<components::Player>();
|
auto player = level.world->get_the<components::Player>();
|
||||||
auto player_combat = level.world->get<components::Combat>(player.entity);
|
auto player_combat = level.world->get<components::Combat>(player.entity);
|
||||||
auto map = level.map;
|
auto map = level.map;
|
||||||
|
@ -76,7 +76,7 @@ namespace gui {
|
||||||
active = !active;
|
active = !active;
|
||||||
|
|
||||||
if(active) {
|
if(active) {
|
||||||
auto& level = GameDB::current();
|
auto& level = GameDB::current_level();
|
||||||
// it's on now, enable things
|
// it's on now, enable things
|
||||||
auto player = level.world->get_the<components::Player>();
|
auto player = level.world->get_the<components::Player>();
|
||||||
auto& player_combat = level.world->get<components::Combat>(player.entity);
|
auto& player_combat = level.world->get<components::Combat>(player.entity);
|
||||||
|
|
|
@ -267,7 +267,7 @@ namespace gui {
|
||||||
}
|
}
|
||||||
|
|
||||||
void FSM::try_move(int dir, bool strafe) {
|
void FSM::try_move(int dir, bool strafe) {
|
||||||
auto& level = GameDB::current();
|
auto& level = GameDB::current_level();
|
||||||
using enum State;
|
using enum State;
|
||||||
// prevent moving into occupied space
|
// prevent moving into occupied space
|
||||||
Point move_to = $main_ui.plan_move(dir, strafe);
|
Point move_to = $main_ui.plan_move(dir, strafe);
|
||||||
|
|
|
@ -32,7 +32,7 @@ namespace gui {
|
||||||
}
|
}
|
||||||
|
|
||||||
DinkyECS::Entity MainUI::camera_aim() {
|
DinkyECS::Entity MainUI::camera_aim() {
|
||||||
auto& level = GameDB::current();
|
auto& level = GameDB::current_level();
|
||||||
// what happens if there's two things at that spot
|
// what happens if there's two things at that spot
|
||||||
if(level.collision->something_there($rayview->aiming_at)) {
|
if(level.collision->something_there($rayview->aiming_at)) {
|
||||||
return level.collision->get($rayview->aiming_at);
|
return level.collision->get($rayview->aiming_at);
|
||||||
|
@ -98,7 +98,7 @@ namespace gui {
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainUI::update_level() {
|
void MainUI::update_level() {
|
||||||
auto& level = GameDB::current();
|
auto& level = GameDB::current_level();
|
||||||
auto& player_position = GameDB::player_position();
|
auto& player_position = GameDB::player_position();
|
||||||
auto player = player_position.location;
|
auto player = player_position.location;
|
||||||
|
|
||||||
|
|
|
@ -112,7 +112,7 @@ namespace gui {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool StatusUI::place_slot(guecs::Entity gui_id, DinkyECS::Entity world_entity) {
|
bool StatusUI::place_slot(guecs::Entity gui_id, DinkyECS::Entity world_entity) {
|
||||||
auto& level = GameDB::current();
|
auto& level = GameDB::current_level();
|
||||||
auto& slot_name = $gui.name_for(gui_id);
|
auto& slot_name = $gui.name_for(gui_id);
|
||||||
auto& inventory = level.world->get<inventory::Model>(level.player);
|
auto& inventory = level.world->get<inventory::Model>(level.player);
|
||||||
|
|
||||||
|
|
34
systems.cpp
34
systems.cpp
|
@ -33,7 +33,7 @@ void System::set_position(World& world, SpatialMap& collision, Entity entity, Po
|
||||||
}
|
}
|
||||||
|
|
||||||
void System::lighting() {
|
void System::lighting() {
|
||||||
auto& level = GameDB::current();
|
auto& level = GameDB::current_level();
|
||||||
auto& light = *level.lights;
|
auto& light = *level.lights;
|
||||||
auto& world = *level.world;
|
auto& world = *level.world;
|
||||||
auto& map = *level.map;
|
auto& map = *level.map;
|
||||||
|
@ -57,7 +57,7 @@ void System::lighting() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void System::generate_paths() {
|
void System::generate_paths() {
|
||||||
auto& level = GameDB::current();
|
auto& level = GameDB::current_level();
|
||||||
const auto &player_pos = GameDB::player_position();
|
const auto &player_pos = GameDB::player_position();
|
||||||
|
|
||||||
level.map->set_target(player_pos.location);
|
level.map->set_target(player_pos.location);
|
||||||
|
@ -65,7 +65,7 @@ void System::generate_paths() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void System::enemy_ai_initialize() {
|
void System::enemy_ai_initialize() {
|
||||||
auto& level = GameDB::current();
|
auto& level = GameDB::current_level();
|
||||||
auto& world = *level.world;
|
auto& world = *level.world;
|
||||||
auto& map = *level.map;
|
auto& map = *level.map;
|
||||||
|
|
||||||
|
@ -93,7 +93,7 @@ void System::enemy_ai_initialize() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void System::enemy_pathing() {
|
void System::enemy_pathing() {
|
||||||
auto& level = GameDB::current();
|
auto& level = GameDB::current_level();
|
||||||
auto& world = *level.world;
|
auto& world = *level.world;
|
||||||
auto& map = *level.map;
|
auto& map = *level.map;
|
||||||
const auto &player_pos = GameDB::player_position();
|
const auto &player_pos = GameDB::player_position();
|
||||||
|
@ -135,7 +135,7 @@ inline void move_entity(SpatialMap &collider, Map &game_map, Position &position,
|
||||||
}
|
}
|
||||||
|
|
||||||
void System::motion() {
|
void System::motion() {
|
||||||
auto& level = GameDB::current();
|
auto& level = GameDB::current_level();
|
||||||
level.world->query<Position, Motion>(
|
level.world->query<Position, Motion>(
|
||||||
[&](auto ent, auto &position, auto &motion) {
|
[&](auto ent, auto &position, auto &motion) {
|
||||||
// don't process entities that don't move
|
// don't process entities that don't move
|
||||||
|
@ -146,7 +146,7 @@ void System::motion() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void System::distribute_loot(Position target_pos) {
|
void System::distribute_loot(Position target_pos) {
|
||||||
auto& level = GameDB::current();
|
auto& level = GameDB::current_level();
|
||||||
auto& world = *level.world;
|
auto& world = *level.world;
|
||||||
auto& config = world.get_the<GameConfig>();
|
auto& config = world.get_the<GameConfig>();
|
||||||
int inventory_count = Random::uniform(0, 3);
|
int inventory_count = Random::uniform(0, 3);
|
||||||
|
@ -171,7 +171,7 @@ void System::distribute_loot(Position target_pos) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void System::death() {
|
void System::death() {
|
||||||
auto& level = GameDB::current();
|
auto& level = GameDB::current_level();
|
||||||
auto& world = *level.world;
|
auto& world = *level.world;
|
||||||
auto player = world.get_the<Player>();
|
auto player = world.get_the<Player>();
|
||||||
std::vector<Entity> dead_things;
|
std::vector<Entity> dead_things;
|
||||||
|
@ -229,7 +229,7 @@ inline void animate_entity(World &world, Entity entity) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void System::combat(int attack_id) {
|
void System::combat(int attack_id) {
|
||||||
auto& level = GameDB::current();
|
auto& level = GameDB::current_level();
|
||||||
auto& collider = *level.collision;
|
auto& collider = *level.collision;
|
||||||
auto& world = *level.world;
|
auto& world = *level.world;
|
||||||
auto& the_belt = world.get_the<ritual::Belt>();
|
auto& the_belt = world.get_the<ritual::Belt>();
|
||||||
|
@ -286,7 +286,7 @@ void System::combat(int attack_id) {
|
||||||
|
|
||||||
|
|
||||||
void System::collision() {
|
void System::collision() {
|
||||||
auto& level = GameDB::current();
|
auto& level = GameDB::current_level();
|
||||||
auto& collider = *level.collision;
|
auto& collider = *level.collision;
|
||||||
auto& world = *level.world;
|
auto& world = *level.world;
|
||||||
const auto& player_pos = GameDB::player_position();
|
const auto& player_pos = GameDB::player_position();
|
||||||
|
@ -319,7 +319,7 @@ void System::collision() {
|
||||||
* from the world for say, putting into a container or inventory.
|
* from the world for say, putting into a container or inventory.
|
||||||
*/
|
*/
|
||||||
void System::remove_from_world(Entity entity) {
|
void System::remove_from_world(Entity entity) {
|
||||||
auto& level = GameDB::current();
|
auto& level = GameDB::current_level();
|
||||||
auto& item_pos = level.world->get<Position>(entity);
|
auto& item_pos = level.world->get<Position>(entity);
|
||||||
level.collision->remove(item_pos.location, entity);
|
level.collision->remove(item_pos.location, entity);
|
||||||
// if you don't do this you get the bug that you can pickup
|
// if you don't do this you get the bug that you can pickup
|
||||||
|
@ -328,7 +328,7 @@ void System::remove_from_world(Entity entity) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void System::pickup() {
|
void System::pickup() {
|
||||||
auto& level = GameDB::current();
|
auto& level = GameDB::current_level();
|
||||||
auto& world = *level.world;
|
auto& world = *level.world;
|
||||||
auto& collision = *level.collision;
|
auto& collision = *level.collision;
|
||||||
auto pos = GameDB::player_position();
|
auto pos = GameDB::player_position();
|
||||||
|
@ -393,7 +393,7 @@ void System::device(World &world, Entity actor, Entity item) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void System::plan_motion(Position move_to) {
|
void System::plan_motion(Position move_to) {
|
||||||
auto& level = GameDB::current();
|
auto& level = GameDB::current_level();
|
||||||
auto& player_pos = GameDB::player_position();
|
auto& player_pos = GameDB::player_position();
|
||||||
|
|
||||||
player_pos.aiming_at = move_to.aiming_at;
|
player_pos.aiming_at = move_to.aiming_at;
|
||||||
|
@ -405,7 +405,7 @@ void System::plan_motion(Position move_to) {
|
||||||
|
|
||||||
|
|
||||||
void System::player_status() {
|
void System::player_status() {
|
||||||
auto& level = GameDB::current();
|
auto& level = GameDB::current_level();
|
||||||
auto& combat = level.world->get<Combat>(level.player);
|
auto& combat = level.world->get<Combat>(level.player);
|
||||||
float percent = float(combat.hp) / float(combat.max_hp);
|
float percent = float(combat.hp) / float(combat.max_hp);
|
||||||
|
|
||||||
|
@ -450,7 +450,7 @@ Entity System::spawn_item(World& world, const std::string& name) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void System::drop_item(Entity item) {
|
void System::drop_item(Entity item) {
|
||||||
auto& level = GameDB::current();
|
auto& level = GameDB::current_level();
|
||||||
auto& world = *level.world;
|
auto& world = *level.world;
|
||||||
auto& map = *level.map;
|
auto& map = *level.map;
|
||||||
auto player_pos = GameDB::player_position();
|
auto player_pos = GameDB::player_position();
|
||||||
|
@ -498,7 +498,7 @@ void System::remove_from_container(Entity cont_id, const std::string& slot_id) {
|
||||||
|
|
||||||
|
|
||||||
void System::inventory_swap(Entity container_id, const std::string& a_name, const std::string &b_name) {
|
void System::inventory_swap(Entity container_id, const std::string& a_name, const std::string &b_name) {
|
||||||
auto& level = GameDB::current();
|
auto& level = GameDB::current_level();
|
||||||
dbc::check(a_name != b_name, "Attempt to inventory swap the same slot, you should check this and avoid calling me.");
|
dbc::check(a_name != b_name, "Attempt to inventory swap the same slot, you should check this and avoid calling me.");
|
||||||
|
|
||||||
auto& inventory = level.world->get<inventory::Model>(container_id);
|
auto& inventory = level.world->get<inventory::Model>(container_id);
|
||||||
|
@ -516,7 +516,7 @@ bool System::inventory_occupied(Entity container_id, const std::string& name) {
|
||||||
|
|
||||||
|
|
||||||
void System::draw_map(Matrix& grid, EntityGrid& entity_map) {
|
void System::draw_map(Matrix& grid, EntityGrid& entity_map) {
|
||||||
auto& level = GameDB::current();
|
auto& level = GameDB::current_level();
|
||||||
auto& world = *level.world;
|
auto& world = *level.world;
|
||||||
Map &map = *level.map;
|
Map &map = *level.map;
|
||||||
Matrix &fow = level.lights->$fow;
|
Matrix &fow = level.lights->$fow;
|
||||||
|
@ -606,7 +606,7 @@ void System::render_map(Matrix& tiles, EntityGrid& entity_map, sf::RenderTexture
|
||||||
}
|
}
|
||||||
|
|
||||||
bool System::use_item(const string& slot_name) {
|
bool System::use_item(const string& slot_name) {
|
||||||
auto& level = GameDB::current();
|
auto& level = GameDB::current_level();
|
||||||
auto& world = *level.world;
|
auto& world = *level.world;
|
||||||
auto& inventory = world.get<inventory::Model>(level.player);
|
auto& inventory = world.get<inventory::Model>(level.player);
|
||||||
auto& player_combat = world.get<Combat>(level.player);
|
auto& player_combat = world.get<Combat>(level.player);
|
||||||
|
|
|
@ -11,7 +11,7 @@ using namespace lighting;
|
||||||
|
|
||||||
TEST_CASE("lighting a map works", "[lighting]") {
|
TEST_CASE("lighting a map works", "[lighting]") {
|
||||||
GameDB::init();
|
GameDB::init();
|
||||||
auto& level = GameDB::current();
|
auto& level = GameDB::current_level();
|
||||||
auto& map = *level.map;
|
auto& map = *level.map;
|
||||||
|
|
||||||
Point light1, light2;
|
Point light1, light2;
|
||||||
|
|
|
@ -18,7 +18,7 @@ json load_test_data(const string &fname) {
|
||||||
TEST_CASE("camera control", "[map]") {
|
TEST_CASE("camera control", "[map]") {
|
||||||
GameDB::init();
|
GameDB::init();
|
||||||
|
|
||||||
auto& level = GameDB::current();
|
auto& level = GameDB::current_level();
|
||||||
auto& map = *level.map;
|
auto& map = *level.map;
|
||||||
|
|
||||||
Point center = map.center_camera({10,10}, 5, 5);
|
Point center = map.center_camera({10,10}, 5, 5);
|
||||||
|
@ -81,7 +81,7 @@ TEST_CASE("dijkstra algo test", "[map]") {
|
||||||
TEST_CASE("map image test", "[map]") {
|
TEST_CASE("map image test", "[map]") {
|
||||||
GameDB::init();
|
GameDB::init();
|
||||||
|
|
||||||
auto& level = GameDB::current();
|
auto& level = GameDB::current_level();
|
||||||
Matrix map_tiles = matrix::make(7,7);
|
Matrix map_tiles = matrix::make(7,7);
|
||||||
EntityGrid entity_map;
|
EntityGrid entity_map;
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,7 @@ using matrix::Matrix;
|
||||||
|
|
||||||
std::shared_ptr<Map> make_map() {
|
std::shared_ptr<Map> make_map() {
|
||||||
GameDB::init();
|
GameDB::init();
|
||||||
return GameDB::current().map;
|
return GameDB::current_level().map;
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("basic matrix iterator", "[matrix]") {
|
TEST_CASE("basic matrix iterator", "[matrix]") {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue