74 lines
2.2 KiB
C++
74 lines
2.2 KiB
C++
#pragma once
|
|
#include "components.hpp"
|
|
#include <SFML/Graphics/RenderTexture.hpp>
|
|
#include "map.hpp"
|
|
#include "spatialmap.hpp"
|
|
#include "game_level.hpp"
|
|
|
|
namespace gui {
|
|
enum class Event;
|
|
}
|
|
|
|
namespace System {
|
|
using namespace components;
|
|
using namespace DinkyECS;
|
|
using std::string, matrix::Matrix;
|
|
|
|
void lighting();
|
|
void motion();
|
|
void collision();
|
|
void death();
|
|
void generate_paths();
|
|
void enemy_pathing();
|
|
void enemy_ai_initialize();
|
|
|
|
void device(World &world, Entity actor, Entity item);
|
|
void move_player(Position move_to);
|
|
Entity spawn_item(World& world, const string& name);
|
|
void drop_item(Entity item);
|
|
|
|
void enemy_ai();
|
|
void combat(int attack_id);
|
|
|
|
std::shared_ptr<sf::Shader> sprite_effect(Entity entity);
|
|
void player_status();
|
|
void distribute_loot(Position target_pos);
|
|
|
|
void pickup();
|
|
|
|
bool place_in_container(Entity cont_id, const string& name, Entity world_entity);
|
|
|
|
void remove_from_container(Entity cont_id, const std::string& name);
|
|
void remove_from_world(Entity entity);
|
|
void inventory_swap(Entity container_id, const std::string& a_name, const std::string &b_name);
|
|
bool inventory_occupied(Entity container_id, const std::string& name);
|
|
|
|
void draw_map(Matrix& grid, EntityGrid& entity_map);
|
|
void render_map(Matrix& tiles, EntityGrid& entity_map, sf::RenderTexture& render, int compass_dir, wchar_t player_display);
|
|
|
|
void set_position(DinkyECS::World& world, SpatialMap& collision, Entity entity, Position pos);
|
|
bool use_item(const std::string& slot_name);
|
|
|
|
gui::Event shortest_rotate(Point player_at, Point aiming_at, Point turning_to);
|
|
|
|
template <typename T>
|
|
void multi_path(GameDB::Level& level, Pathing& paths, Matrix& walls) {
|
|
// first, put everything of this type as a target
|
|
level.world->query<Position, T>(
|
|
[&](const auto ent, auto& position, auto&) {
|
|
if(ent != level.player) {
|
|
paths.set_target(position.location);
|
|
}
|
|
});
|
|
|
|
level.world->query<Collision>(
|
|
[&](const auto ent, auto& collision) {
|
|
if(collision.has && ent != level.player) {
|
|
auto& pos = level.world->get<Position>(ent);
|
|
walls[pos.location.y][pos.location.x] = WALL_VALUE;
|
|
}
|
|
});
|
|
|
|
paths.compute_paths(walls);
|
|
}
|
|
}
|