From e1cd619eeff2090f0543fbc1020f4348951dff6c Mon Sep 17 00:00:00 2001 From: Vectozavr <60608292+vectozavr@users.noreply.github.com> Date: Sun, 7 Nov 2021 14:47:24 +0700 Subject: [PATCH] add standard white & dark colors in ShooterConsts.h --- Shooter.cpp | 14 ++++++-------- ShooterClient.cpp | 12 ++++++------ ShooterConsts.h | 16 ++++++++++++++++ obj/man/head.obj | 2 +- 4 files changed, 29 insertions(+), 15 deletions(-) diff --git a/Shooter.cpp b/Shooter.cpp index 84348b8..45a180f 100644 --- a/Shooter.cpp +++ b/Shooter.cpp @@ -279,14 +279,12 @@ void Shooter::spawnPlayer(sf::Uint16 id) { Vec3D randColor1 = Vec3D::Random(); Vec3D randColor2 = Vec3D::Random(); - newPlayer->setColor({static_cast(randColor1.x() * 255), static_cast(randColor1.y() * 255), - static_cast(randColor1.z() * 255)}); - world->body(ObjectNameTag(name + "_foot_1"))->setColor( - {static_cast(randColor2.x() * 255), static_cast(randColor2.y() * 255), - static_cast(randColor2.z() * 255)}); - world->body(ObjectNameTag(name + "_foot_2"))->setColor( - {static_cast(randColor2.x() * 255), static_cast(randColor2.y() * 255), - static_cast(randColor2.z() * 255)}); + int colorBodyNum = (int) ((double) (rand()-1) / RAND_MAX * 5); + int colorFootNum = (int) ((double) (rand()-1) / RAND_MAX * 5); + + newPlayer->setColor(ShooterConsts::WHITE_COLORS[colorBodyNum]); + world->body(ObjectNameTag(name + "_foot_1"))->setColor(ShooterConsts::DARK_COLORS[colorFootNum]); + world->body(ObjectNameTag(name + "_foot_2"))->setColor(ShooterConsts::DARK_COLORS[colorFootNum]); changeEnemyWeapon("gun", id); } diff --git a/ShooterClient.cpp b/ShooterClient.cpp index 6340a24..a444683 100644 --- a/ShooterClient.cpp +++ b/ShooterClient.cpp @@ -76,17 +76,17 @@ void ShooterClient::processUpdate(sf::Packet &packet) { if(isAnimate) { if(foot1 != nullptr && foot2 != nullptr && !Timeline::isInAnimList(AnimationListTag(name + "_foot1_rotation"))) { - Timeline::animate(AnimationListTag(name + "_foot1_rotation"), std::make_shared(foot1, 0.4, 0.2, Animation::LoopOut::None, Animation::InterpolationType::Linear)); + Timeline::animate(AnimationListTag(name + "_foot1_rotation"), std::make_shared(foot1, 0.6, 0.2, Animation::LoopOut::None, Animation::InterpolationType::Linear)); Timeline::animate(AnimationListTag(name + "_foot1_rotation"), std::make_shared(0)); - Timeline::animate(AnimationListTag(name + "_foot1_rotation"), std::make_shared(foot1, -0.8, 0.2, Animation::LoopOut::None, Animation::InterpolationType::Linear)); + Timeline::animate(AnimationListTag(name + "_foot1_rotation"), std::make_shared(foot1, -1.2, 0.2, Animation::LoopOut::None, Animation::InterpolationType::Linear)); Timeline::animate(AnimationListTag(name + "_foot1_rotation"), std::make_shared(0)); - Timeline::animate(AnimationListTag(name + "_foot1_rotation"), std::make_shared(foot1, 0.4, 0.2, Animation::LoopOut::None, Animation::InterpolationType::Linear)); + Timeline::animate(AnimationListTag(name + "_foot1_rotation"), std::make_shared(foot1, 0.6, 0.2, Animation::LoopOut::None, Animation::InterpolationType::Linear)); - Timeline::animate(AnimationListTag(name + "_foot2_rotation"), std::make_shared(foot2, -0.4, 0.2, Animation::LoopOut::None, Animation::InterpolationType::Linear)); + Timeline::animate(AnimationListTag(name + "_foot2_rotation"), std::make_shared(foot2, -0.6, 0.2, Animation::LoopOut::None, Animation::InterpolationType::Linear)); Timeline::animate(AnimationListTag(name + "_foot2_rotation"), std::make_shared(0)); - Timeline::animate(AnimationListTag(name + "_foot2_rotation"), std::make_shared(foot2, 0.8, 0.2, Animation::LoopOut::None, Animation::InterpolationType::Linear)); + Timeline::animate(AnimationListTag(name + "_foot2_rotation"), std::make_shared(foot2, 1.2, 0.2, Animation::LoopOut::None, Animation::InterpolationType::Linear)); Timeline::animate(AnimationListTag(name + "_foot2_rotation"), std::make_shared(0)); - Timeline::animate(AnimationListTag(name + "_foot2_rotation"), std::make_shared(foot2, -0.4, 0.2, Animation::LoopOut::None, Animation::InterpolationType::Linear)); + Timeline::animate(AnimationListTag(name + "_foot2_rotation"), std::make_shared(foot2, -0.6, 0.2, Animation::LoopOut::None, Animation::InterpolationType::Linear)); } } diff --git a/ShooterConsts.h b/ShooterConsts.h index d796606..6c1626e 100644 --- a/ShooterConsts.h +++ b/ShooterConsts.h @@ -57,6 +57,22 @@ namespace ShooterConsts { const std::string SLOW_MO_SOUND = "sound/slow_mo.ogg"; const std::string UN_SLOW_MO_SOUND = "sound/unslow_mo.ogg"; const std::string NO_AMMO_SOUND = "sound/weapons/no_ammo.ogg"; + + const sf::Color WHITE_COLORS[] = { + sf::Color(137, 135, 222), // blue + sf::Color(195, 155, 209), // pink + sf::Color(201, 137, 137), // red + sf::Color(116, 204, 135), // green + sf::Color(201, 171, 137), // orange + }; + + const sf::Color DARK_COLORS[] = { + sf::Color(16, 18, 69), // blue + sf::Color(77, 0, 62), // pink + sf::Color(99, 20, 20), // red + sf::Color(12, 46, 9), // green + sf::Color(97, 70, 51), // orange + }; } #endif //SHOOTER_SHOOTERCONSTS_H diff --git a/obj/man/head.obj b/obj/man/head.obj index 2c3ffd1..11a40a4 100644 --- a/obj/man/head.obj +++ b/obj/man/head.obj @@ -1,6 +1,6 @@ m 000 255 213 196 255 m 001 43 64 59 255 -m 002 54 75 161 255 +m 002 160 158 255 255 m 003 166 101 103 255 m 004 205 157 154 255 o Cube