Merge branch 'develop' of github.com:AnonymusRaccoon/Bomberman into parser

# Conflicts:
#	sources/Component/BombHolder/BombHolderComponent.cpp
#	sources/Map/Map.cpp
This commit is contained in:
Clément Le Bihan
2021-06-18 11:17:27 +02:00
53 changed files with 168 additions and 152 deletions
@@ -29,7 +29,7 @@ namespace BBM
return this->_modelAnimation.at(this->_currentAnimIndex).getFrameCounter();
}
RAY::ModelAnimation AnimationsComponent::getCurrentModelAnim()
RAY::ModelAnimation &AnimationsComponent::getCurrentModelAnim()
{
return this->_modelAnimation[this->_currentAnimIndex];
}
@@ -20,7 +20,11 @@ namespace BBM
int _currentAnimIndex;
//! @brief Bool allowing to play pause an animation
bool _animDisabled;
public:
//! @brief Should the next update call be skipped?
bool skipNext = false;
//! @inherit
WAL::Component *clone(WAL::Entity &entity) const override;
@@ -34,7 +38,7 @@ namespace BBM
size_t getCurrentAnimFrameCounter() const;
//! @brief get the current
RAY::ModelAnimation getCurrentModelAnim();
RAY::ModelAnimation &getCurrentModelAnim();
//! @brief set the anim frame counter
void setCurrentAnimFrameCounter(size_t animFrameCounter);
@@ -8,10 +8,10 @@
namespace BBM
{
BasicBombComponent::BasicBombComponent(WAL::Entity &entity, int damage, int explosionRadius, std::vector<unsigned> ignored)
BasicBombComponent::BasicBombComponent(WAL::Entity &entity, int damageHit, int radius, std::vector<unsigned> ignored)
: WAL::Component(entity),
damage(damage),
explosionRadius(explosionRadius),
explosionRadius(radius),
damage(damageHit),
ignoredEntities(std::move(ignored))
{}
@@ -26,7 +26,7 @@ namespace BBM
WAL::Component *clone(WAL::Entity &entity) const override;
//! @brief A component can't be instantiated, it should be derived.
explicit BasicBombComponent(WAL::Entity &entity, int damage, int explosionRadius, std::vector<unsigned> ignored);
explicit BasicBombComponent(WAL::Entity &entity, int damageHit, int radius, std::vector<unsigned> ignored);
//! @brief A component can't be instantiated, it should be derived.
BasicBombComponent(const BasicBombComponent &) = default;
@@ -12,10 +12,10 @@ namespace BBM
: WAL::Component(entity)
{}
BombHolderComponent::BombHolderComponent(WAL::Entity &entity, unsigned int maxBombCount, int explosionRadius)
BombHolderComponent::BombHolderComponent(WAL::Entity &entity, unsigned int maxCount, unsigned int bombExplosionRadius)
: WAL::Component(entity),
maxBombCount(maxBombCount),
explosionRadius(explosionRadius)
maxBombCount(maxCount),
explosionRadius(bombExplosionRadius)
{}
WAL::Component *BombHolderComponent::clone(WAL::Entity &entity) const
@@ -26,7 +26,7 @@ namespace BBM
//! @brief The number of nanosecond before the next bomb refill.
std::chrono::nanoseconds nextBombRefill = refillRate;
//! @brief The radius of the explosion.
int explosionRadius = 3;
unsigned int explosionRadius = 3;
//! @brief The damage made by the explosion on an entity
int damage = 1;
@@ -37,7 +37,7 @@ namespace BBM
explicit BombHolderComponent(WAL::Entity &entity);
//! @brief Constructor
BombHolderComponent(WAL::Entity &entity, unsigned int maxBombCount, int explosionRadius = 3);
BombHolderComponent(WAL::Entity &entity, unsigned int maxBombCount, unsigned int bombExplosionRadius = 3);
//! @brief A component can't be instantiated, it should be derived.
BombHolderComponent(const BombHolderComponent &) = default;
+1 -1
View File
@@ -44,7 +44,7 @@ namespace BBM
//! @brief Constructor with the 3 callback
ButtonComponent(WAL::Entity &entity, WAL::Callback<WAL::Entity &, WAL::Wal &> callback)
: WAL::Component(entity),
onEvent(callback), _up(nullptr), _down(nullptr), _left(nullptr), _right(nullptr)
onEvent(callback), _up(nullptr), _down(nullptr), _right(nullptr), _left(nullptr)
{ }
ButtonComponent &setButtonLinks(WAL::Entity *up = nullptr, WAL::Entity *down = nullptr,
@@ -16,43 +16,43 @@ namespace BBM
}
CollisionComponent::CollisionComponent(WAL::Entity &entity,
const WAL::Callback<WAL::Entity &, const WAL::Entity &, CollidedAxis> &onCollide,
const WAL::Callback<WAL::Entity &, const WAL::Entity &, CollidedAxis> &onCollided,
Vector3f positionOffset,
Vector3f bound)
const WAL::Callback<WAL::Entity &, const WAL::Entity &, CollidedAxis> &onCollideCallback,
const WAL::Callback<WAL::Entity &, const WAL::Entity &, CollidedAxis> &onCollidedCallback,
Vector3f positionOffsetVector,
Vector3f boundVector)
: WAL::Component(entity),
onCollide(onCollide),
onCollided(onCollided),
bound(bound),
positionOffset(positionOffset)
onCollide(onCollideCallback),
onCollided(onCollidedCallback),
bound(boundVector),
positionOffset(positionOffsetVector)
{}
CollisionComponent::CollisionComponent(WAL::Entity &entity,
const WAL::Callback<WAL::Entity &, const WAL::Entity &, CollidedAxis> &onCollide,
const WAL::Callback<WAL::Entity &, const WAL::Entity &, CollidedAxis> &onCollided,
float positionOffset,
const WAL::Callback<WAL::Entity &, const WAL::Entity &, CollidedAxis> &onCollideCallback,
const WAL::Callback<WAL::Entity &, const WAL::Entity &, CollidedAxis> &onCollidedCallback,
float positionOffsetFloat,
float boundSize)
: WAL::Component(entity),
onCollide(onCollide),
onCollided(onCollided),
onCollide(onCollideCallback),
onCollided(onCollidedCallback),
bound({boundSize, boundSize, boundSize}),
positionOffset({positionOffset, positionOffset, positionOffset})
positionOffset({positionOffsetFloat, positionOffsetFloat, positionOffsetFloat})
{}
CollisionComponent::CollisionComponent(WAL::Entity &entity, Vector3f positionOffset, Vector3f bound)
CollisionComponent::CollisionComponent(WAL::Entity &entity, Vector3f positionOffsetVector, Vector3f boundVector)
: WAL::Component(entity),
onCollide(),
onCollided(),
bound(bound),
positionOffset(positionOffset)
bound(boundVector),
positionOffset(positionOffsetVector)
{}
CollisionComponent::CollisionComponent(WAL::Entity &entity, float positionOffset, float boundSize)
CollisionComponent::CollisionComponent(WAL::Entity &entity, float positionOffsetFloat, float boundSize)
: WAL::Component(entity),
onCollide(),
onCollided(),
bound({boundSize, boundSize, boundSize}),
positionOffset({positionOffset, positionOffset, positionOffset})
positionOffset({positionOffsetFloat, positionOffsetFloat, positionOffsetFloat})
{}
CollisionComponent::CollidedAxis operator|(CollisionComponent::CollidedAxis first,
+2 -2
View File
@@ -7,9 +7,9 @@
namespace BBM
{
ColorComponent::ColorComponent(WAL::Entity &entity, RAY::Color color)
ColorComponent::ColorComponent(WAL::Entity &entity, RAY::Color componentColor)
: Component(entity),
color(color)
color(componentColor)
{}
ColorComponent::ColorComponent(WAL::Entity &entity, unsigned char r, unsigned char g, unsigned char b, unsigned char a)
+1 -1
View File
@@ -20,7 +20,7 @@ namespace BBM
WAL::Component *clone(WAL::Entity &entity) const override;
//! @brief Create a new ColorComponent at a certain color
ColorComponent(WAL::Entity &entity, RAY::Color color);
ColorComponent(WAL::Entity &entity, RAY::Color componentColor);
//! @brief Create a new ColorComponent at a certain color
ColorComponent(WAL::Entity &entity, unsigned char r, unsigned char g, unsigned char b, unsigned char a);
//! @brief A color component is copy constructable
+2 -2
View File
@@ -10,10 +10,10 @@
namespace BBM
{
HealthComponent::HealthComponent(WAL::Entity &entity, unsigned int healthPoint, const WAL::Callback<WAL::Entity &, WAL::Wal &> &onDeath)
HealthComponent::HealthComponent(WAL::Entity &entity, unsigned int healthPoint, const WAL::Callback<WAL::Entity &, WAL::Wal &> &onDeathCallback)
: WAL::Component(entity),
_healthPoint(healthPoint),
onDeath(onDeath)
onDeath(onDeathCallback)
{}
WAL::Component *HealthComponent::clone(WAL::Entity &entity) const
+1 -1
View File
@@ -37,7 +37,7 @@ namespace BBM
WAL::Component *clone(WAL::Entity &entity) const override;
//! @brief Constructor
HealthComponent(WAL::Entity &entity, unsigned int healthPoint, const WAL::Callback<WAL::Entity &, WAL::Wal &> &onDeath = WAL::Callback<WAL::Entity &, WAL::Wal &>());
HealthComponent(WAL::Entity &entity, unsigned int healthPoint, const WAL::Callback<WAL::Entity &, WAL::Wal &> &onDeathCallback = WAL::Callback<WAL::Entity &, WAL::Wal &>());
//! @brief A Health component can't be instantiated, it should be derived.
HealthComponent(const HealthComponent &) = default;
@@ -8,8 +8,8 @@
namespace BBM
{
KeyboardComponent::KeyboardComponent(WAL::Entity &entity, ControllableComponent::Layout layout)
: WAL::Component(entity), layout(layout)
KeyboardComponent::KeyboardComponent(WAL::Entity &entity, ControllableComponent::Layout controllerLayout)
: WAL::Component(entity), layout(controllerLayout)
{
if (layout == ControllableComponent::KEYBOARD_0) {
this->keyUp = KEY_W;
@@ -40,7 +40,7 @@ namespace BBM
void onStart() override;
//! @brief Create a new keyboard component using custom keys.
explicit KeyboardComponent(WAL::Entity &entity, ControllableComponent::Layout layout = ControllableComponent::Layout::KEYBOARD_0);
explicit KeyboardComponent(WAL::Entity &entity, ControllableComponent::Layout controllerLayout = ControllableComponent::Layout::KEYBOARD_0);
//! @brief A Keyboard component is copy constructable.
KeyboardComponent(const KeyboardComponent &) = default;
@@ -11,9 +11,9 @@ namespace BBM
y()
{}
LevitateComponent::LevitateComponent(WAL::Entity &entity, float y)
LevitateComponent::LevitateComponent(WAL::Entity &entity, float entityY)
: WAL::Component(entity),
y(y)
y(entityY)
{}
WAL::Component *LevitateComponent::clone(WAL::Entity &entity) const
@@ -24,7 +24,7 @@ namespace BBM {
explicit LevitateComponent(WAL::Entity &entity);
//! @brief Create a new levitate component.
LevitateComponent(WAL::Entity &entity, float y);
LevitateComponent(WAL::Entity &entity, float entityY);
//! @brief A Levitate component is copy constructable.
LevitateComponent(const LevitateComponent &) = default;
+4 -4
View File
@@ -6,11 +6,11 @@
namespace BBM
{
LobbyComponent::LobbyComponent(WAL::Entity &entity, int playerID, WAL::Entity &readyButton, WAL::Entity &coloredTile)
LobbyComponent::LobbyComponent(WAL::Entity &entity, int playerNumber, WAL::Entity &button, WAL::Entity &tile)
: WAL::Component(entity),
playerID(playerID),
readyButton(readyButton),
coloredTile(coloredTile)
playerID(playerNumber),
readyButton(button),
coloredTile(tile)
{}
WAL::Component *LobbyComponent::clone(WAL::Entity &entity) const
+1 -1
View File
@@ -33,7 +33,7 @@ namespace BBM
Component *clone(WAL::Entity &entity) const override;
//! @brief Create a new lobby component.
explicit LobbyComponent(WAL::Entity &entity, int playerID, WAL::Entity &readyButton, WAL::Entity &coloredTile);
explicit LobbyComponent(WAL::Entity &entity, int playerNumber, WAL::Entity &button, WAL::Entity &tile);
//! @brief A lobby component is copyable.
LobbyComponent(const LobbyComponent &) = default;
//! @brief A default destructor
+2 -2
View File
@@ -11,8 +11,8 @@ namespace BBM
MusicComponent::MusicComponent(WAL::Entity &entity, const std::string &musicPath)
: WAL::Component(entity),
_musicPath(musicPath),
_music(RAY::Audio::Music(musicPath))
_music(RAY::Audio::Music(musicPath)),
_musicPath(musicPath)
{
}
@@ -6,9 +6,9 @@
namespace BBM
{
CameraComponent::CameraComponent(WAL::Entity &entity, Vector3f target)
CameraComponent::CameraComponent(WAL::Entity &entity, Vector3f cameraTarget)
: Component(entity),
target(target)
target(cameraTarget)
{}
WAL::Component *BBM::CameraComponent::clone(WAL::Entity &entity) const
@@ -21,7 +21,7 @@ namespace BBM
Component *clone(WAL::Entity &entity) const override;
//! @brief Ctor
explicit CameraComponent(WAL::Entity &, Vector3f target = Vector3f());
explicit CameraComponent(WAL::Entity &, Vector3f cameraTarget = Vector3f());
//! @brief A camera component is copy constructable.
CameraComponent(const CameraComponent &) = default;
//! @brief Default destructor.
@@ -21,26 +21,26 @@ namespace BBM
std::shared_ptr<RAY::Drawables::ADrawable2D> drawable;
//! @brief ctor
Drawable2DComponent(WAL::Entity &entity, std::shared_ptr<RAY::Drawables::ADrawable2D> drawable, bool drawBefore3D = false)
Drawable2DComponent(WAL::Entity &entity, std::shared_ptr<RAY::Drawables::ADrawable2D> drawable2D, bool drawBehind3D = false)
: WAL::Component(entity),
drawable(std::move(drawable)),
drawBefore3D(drawBefore3D)
drawBefore3D(drawBehind3D),
drawable(std::move(drawable2D))
{}
//! ctor
template<typename T, typename ...Params>
explicit Drawable2DComponent(WAL::Entity &entity, WAL::TypeHolder<T>, Params &&...params)
: WAL::Component(entity),
drawable(new T(std::forward<Params>(params)...)),
drawBefore3D(false)
drawBefore3D(false),
drawable(new T(std::forward<Params>(params)...))
{}
//! ctor
template<typename T, typename ...Params>
explicit Drawable2DComponent(WAL::Entity &entity, WAL::TypeHolder<T>, bool drawBefore3D, Params &&...params)
explicit Drawable2DComponent(WAL::Entity &entity, WAL::TypeHolder<T>, bool drawBehind3D, Params &&...params)
: WAL::Component(entity),
drawable(new T(std::forward<Params>(params)...)),
drawBefore3D(drawBefore3D)
drawBefore3D(drawBehind3D),
drawable(new T(std::forward<Params>(params)...))
{}
//! @brief Clone a component for another or the same entity.
@@ -18,9 +18,9 @@ namespace BBM
std::shared_ptr<RAY::Drawables::ADrawable3D> drawable;
//! @brief ctor
Drawable3DComponent(WAL::Entity &entity, std::shared_ptr<RAY::Drawables::ADrawable3D> drawable)
Drawable3DComponent(WAL::Entity &entity, std::shared_ptr<RAY::Drawables::ADrawable3D> drawable3D)
: WAL::Component(entity),
drawable(std::move(drawable))
drawable(std::move(drawable3D))
{}
//! ctor
+11 -11
View File
@@ -20,14 +20,14 @@ namespace BBM
}
ShaderComponent::ShaderComponent(WAL::Entity &entity,
const std::string &fragmentFilePath,
const std::string &vertexFilePath,
const std::string &fragmentPath,
const std::string &vertexPath,
const WAL::Callback<WAL::Entity &, WAL::Wal &, std::chrono::nanoseconds> &onFixedUpdate,
bool lonely)
: WAL::Component(entity),
shader(vertexFilePath, fragmentFilePath, lonely),
fragmentFilePath(fragmentFilePath),
vertexFilePath(vertexFilePath),
shader(vertexPath, fragmentPath, lonely),
fragmentFilePath(fragmentPath),
vertexFilePath(vertexPath),
update(onFixedUpdate)
{
}
@@ -43,11 +43,11 @@ namespace BBM
}
ShaderComponentModel::ShaderComponentModel(WAL::Entity &entity,
const std::string &fragmentFilePath,
const std::string &vertexFilePath,
const std::string &fragmentPath,
const std::string &vertexPath,
const WAL::Callback<WAL::Entity &, WAL::Wal &, std::chrono::nanoseconds> &onFixedUpdate,
bool lonely)
: ShaderComponent(entity, fragmentFilePath, vertexFilePath, onFixedUpdate, lonely)
: ShaderComponent(entity, fragmentPath, vertexPath, onFixedUpdate, lonely)
{
}
@@ -60,11 +60,11 @@ namespace BBM
}
ShaderComponentDrawable2D::ShaderComponentDrawable2D(WAL::Entity &entity,
const std::string &fragmentFilePath,
const std::string &vertexFilePath,
const std::string &fragmentPath,
const std::string &vertexPath,
const WAL::Callback<WAL::Entity &, WAL::Wal &, std::chrono::nanoseconds> &onFixedUpdate,
bool lonely)
: ShaderComponent(entity, fragmentFilePath, vertexFilePath, onFixedUpdate, lonely)
: ShaderComponent(entity, fragmentPath, vertexPath, onFixedUpdate, lonely)
{
}
}
+5 -5
View File
@@ -11,17 +11,17 @@ namespace BBM
float SoundComponent::volume = 0.75;
SoundComponent::SoundComponent(WAL::Entity &entity,
const std::map<SoundComponent::SoundIndex, std::string> &soundPath,
const std::map<SoundComponent::SoundIndex, std::string> &soundsPath,
bool isLonely)
: WAL::Component(entity),
_soundIndex(IDLE),
_soundPath(soundPath),
_isLonely(isLonely)
_isLonely(isLonely),
_soundPath(soundsPath),
_soundIndex(IDLE)
{
for (int i = 0; i <= DEATH; i++) {
this->_isSoundLoad[static_cast<SoundIndex>(i)] = false;
}
for (auto &soundPath : soundPath)
for (auto &soundPath : soundsPath)
{
this->_isSoundLoad[soundPath.first] = true;
this->_soundList[soundPath.first] = std::make_unique<RAY::Audio::Sound>(soundPath.second, this->_isLonely);
+3 -3
View File
@@ -13,10 +13,10 @@ namespace BBM
ringIn(delay)
{}
TimerComponent::TimerComponent(WAL::Entity &entity, std::chrono::nanoseconds delay, const WAL::Callback<WAL::Entity &, WAL::Wal &> &callback)
TimerComponent::TimerComponent(WAL::Entity &entity, std::chrono::nanoseconds delay, const WAL::Callback<WAL::Entity &, WAL::Wal &> &timerCallback)
: WAL::Component(entity),
ringIn(delay),
callback(callback)
callback(timerCallback),
ringIn(delay)
{}
WAL::Component *TimerComponent::clone(WAL::Entity &entity) const
+1 -1
View File
@@ -25,7 +25,7 @@ namespace BBM
//! @brief A default constructor
TimerComponent(WAL::Entity &entity, std::chrono::nanoseconds delay);
//! @brief Create a timer with a callback.
TimerComponent(WAL::Entity &entity, std::chrono::nanoseconds delay, const WAL::Callback<WAL::Entity &, WAL::Wal &> &callback);
TimerComponent(WAL::Entity &entity, std::chrono::nanoseconds delay, const WAL::Callback<WAL::Entity &, WAL::Wal &> &timerCallback);
//! @brief A timer component is copy constructable
TimerComponent(const TimerComponent &) = default;
//! @brief A default destructor