format: reformat project

Signed-off-by: Vyacheslav Ivanov <islavaivanov76@gmail.com>
This commit is contained in:
Vyacheslav Ivanov
2024-08-03 19:53:48 +03:00
committed by Pugemon
parent 736cd175d5
commit bbf33e8e4d
202 changed files with 7389 additions and 5609 deletions
+34 -23
View File
@@ -1,36 +1,45 @@
#include "LevelController.hpp"
#include "../settings.hpp"
#include "../files/WorldFiles.hpp"
#include "../debug/Logger.hpp"
#include "../world/Level.hpp"
#include "../world/World.hpp"
#include "../physics/Hitbox.hpp"
#include "../objects/Entities.hpp"
#include "scripting/scripting.hpp"
#include "../interfaces/Object.hpp"
#include <algorithm>
#include "../debug/Logger.hpp"
#include "../files/WorldFiles.hpp"
#include "../interfaces/Object.hpp"
#include "../objects/Entities.hpp"
#include "../physics/Hitbox.hpp"
#include "../settings.hpp"
#include "../world/Level.hpp"
#include "../world/World.hpp"
#include "scripting/scripting.hpp"
static debug::Logger logger("level-control");
LevelController::LevelController(EngineSettings& settings, std::unique_ptr<Level> level)
: settings(settings), level(std::move(level)),
blocks(std::make_unique<BlocksController>(this->level.get(), settings.chunks.padding.get())),
chunks(std::make_unique<ChunksController>(this->level.get(), settings.chunks.padding.get())),
player(std::make_unique<PlayerController>(this->level.get(), settings, blocks.get())) {
LevelController::LevelController(
EngineSettings& settings, std::unique_ptr<Level> level
)
: settings(settings),
level(std::move(level)),
blocks(std::make_unique<BlocksController>(
this->level.get(), settings.chunks.padding.get()
)),
chunks(std::make_unique<ChunksController>(
this->level.get(), settings.chunks.padding.get()
)),
player(std::make_unique<PlayerController>(
this->level.get(), settings, blocks.get()
)) {
scripting::on_world_load(this);
}
void LevelController::update(float delta, bool input, bool pause) {
glm::vec3 position = player->getPlayer()->getPosition();
level->loadMatrix(position.x, position.z,
settings.chunks.loadDistance.get() +
settings.chunks.padding.get() * 2);
level->loadMatrix(
position.x,
position.z,
settings.chunks.loadDistance.get() + settings.chunks.padding.get() * 2
);
chunks->update(settings.chunks.loadSpeed.get());
if (!pause) {
// update all objects that needed
for (const auto& obj : level->objects) {
@@ -50,8 +59,10 @@ void LevelController::update(float delta, bool input, bool pause) {
auto& objects = level->objects;
objects.erase(
std::remove_if(
objects.begin(), objects.end(),
[](auto obj) { return obj == nullptr; }),
objects.begin(),
objects.end(),
[](auto obj) { return obj == nullptr; }
),
objects.end()
);
}