merge conflict

This commit is contained in:
Frederic Leger
2023-12-15 15:40:13 -05:00
parent 77a982b1fa
commit 570bef266c
8 changed files with 169 additions and 181 deletions

View File

@@ -68,8 +68,8 @@ Vector3f Player::GetInput(bool front, bool back, bool left, bool right, bool jum
delta.x *= .6f;
delta.z *= .6f;
if ((jump || shoot ) && !m_airborne) {
delta.y += jump? .32f: shoot? .1f : 0.f;
if ((jump || shoot) && !m_airborne) {
delta.y += jump ? .32f : shoot ? .1f : 0.f;
m_airborne = true;
}
if (boostspeed)
@@ -84,7 +84,7 @@ Vector3f Player::GetInput(bool front, bool back, bool left, bool right, bool jum
return delta;
}
Player::Sound Player::ApplyPhysics(Vector3f input, World* world, float elapsedTime) {
Player::Sound Player::ApplyPhysics(Vector3f input, World* world, float elapsedTime, Booster booster_table[]) {
Player::Sound snd = Player::Sound::NOSOUND;
static float timing = 0.f;
/* Gestion de collisions */
@@ -198,37 +198,49 @@ Player::Sound Player::ApplyPhysics(Vector3f input, World* world, float elapsedTi
else isStep = false;
m_POV = m_position.y;
m_POV += m_airborne ? 0 : (sin(bobbingtime) - 0.5f) * (abs(m_velocity.x) + abs(m_velocity.z)) * .2f;
TakeBooster(booster_table);
RemoveBooster(elapsedTime);
return snd;
}
void Player::ApplyTransformation(Transformation& transformation, bool rel, bool rot) const {
transformation.ApplyRotation(-m_rotX, 1, 0, 0);
transformation.ApplyRotation(-m_rotY, 0, 1, 0);
if (rel) transformation.ApplyTranslation(-GetPOV());
}
void Player::GetBooster(Booster boosttype)
void Player::TakeBooster(Booster booster_table[])
{
if (boosttype == SPEED)
for (int i = 0; i < sizeof(booster_table); i++)
{
if (abs((m_position.x + m_position.y + m_position.z) - (booster_table[i].GetPosition().x + booster_table[i].GetPosition().y + booster_table[i].GetPosition().z)) <= 0.5f && booster_table[i].GetAvailability() == true)
{
GetBooster(booster_table[i].GetType());
booster_table[i].SetAvailability(false);
}
}
}
void Player::GetBooster(BOOST_TYPE boosttype)
{
if (boosttype == BTYPE_SPEED)
{
boostspeed = true;
timeboostspeed = 0;
}
if (boosttype == HEAL)
if (boosttype == BTYPE_HEAL)
{
m_hp = 100;
}
if (boosttype == DAMAGE)
if (boosttype == BTYPE_DAMAGE)
{
boostdamage = true;
timeboostdamage = 0;
}
if (boosttype == INVINCIBLE)
if (boosttype == BTYPE_INVINCIBLE)
{
boostinvincible = true;
boostinvincible = 0;