From 2e926a10f435ccd31bd6a8c2fdbad68ff5897da1 Mon Sep 17 00:00:00 2001 From: Vectozavr <60608292+vectozavr@users.noreply.github.com> Date: Wed, 3 Nov 2021 22:06:41 +0700 Subject: [PATCH] bug fixed with respawn animation --- ShooterClient.cpp | 5 ++--- ShooterConsts.h | 2 +- Source.cpp | 4 ++-- engine/animation/AFunction.h | 2 +- 4 files changed, 6 insertions(+), 7 deletions(-) diff --git a/ShooterClient.cpp b/ShooterClient.cpp index 98402ac..a0bc027 100644 --- a/ShooterClient.cpp +++ b/ShooterClient.cpp @@ -123,9 +123,8 @@ void ShooterClient::processCustomPacket(sf::Packet &packet) { _player->unattach(ObjectNameTag("Camera")); _player->translateToPoint(Vec3D{10000}); - Vec2D cameraOrientation(camera->angleLeftUpLookAt().x(), _player->angle().y()); - camera->rotateLeft(-cameraOrientation.x()); - camera->transform(Matrix4x4::Rotation(Vec3D(-_player->angle()))); + camera->rotateLeft(-camera->angleLeftUpLookAt().x()); + camera->transform(Matrix4x4::Rotation(-_player->angle())); Timeline::animate(AnimationListTag("camera_anim"), std::make_shared(camera, Vec3D(-20, 30, -100))); Timeline::animate(AnimationListTag("camera_anim"), std::make_shared(camera, Vec3D(0), Vec3D{0, Consts::PI, 0}, 5, Animation::LoopOut::None, Animation::InterpolationType::Linear)); diff --git a/ShooterConsts.h b/ShooterConsts.h index c8ad50e..56e23f3 100644 --- a/ShooterConsts.h +++ b/ShooterConsts.h @@ -38,7 +38,7 @@ namespace ShooterConsts { const std::string SHOTGUN_RELOAD_SOUND = "sound/weapons/reload_shotgun.ogg"; const std::string CUBE_OBJ = "obj/cube.obj"; - const std::string MAP_OBJ = "maps/map.obj"; + const std::string MAP_OBJ = "maps/map2.obj"; const std::string MAIN_MENU_BACK = "textures/back.png"; const std::string MAIN_MENU_GUI = "textures/gui.png"; diff --git a/Source.cpp b/Source.cpp index a1662ce..372c41c 100644 --- a/Source.cpp +++ b/Source.cpp @@ -10,10 +10,10 @@ using namespace std; int main() { Shooter game; - //game.create(1280, 720, ShooterConsts::PROJECT_NAME); + game.create(1280, 720, ShooterConsts::PROJECT_NAME); //game.create(1920, 1080, ShooterConsts::PROJECT_NAME, true, Consts::BACKGROUND_COLOR, sf::Style::Fullscreen); - game.create(2048, 1152, ShooterConsts::PROJECT_NAME, true); + //game.create(2048, 1152, ShooterConsts::PROJECT_NAME, true); //game.create(3072, 1920, ShooterConsts::PROJECT_NAME, true, Consts::BACKGROUND_COLOR, sf::Style::Fullscreen); return 0; diff --git a/engine/animation/AFunction.h b/engine/animation/AFunction.h index 1523196..e282fcc 100644 --- a/engine/animation/AFunction.h +++ b/engine/animation/AFunction.h @@ -16,7 +16,7 @@ private: const std::function _callBack; void update() override { - if (_allCalls != 0 && progress() >= (double) (_callsCounter + 1) / (_allCalls + 1)) { + if (_allCalls != 0 && progress() > (double) _callsCounter / _allCalls) { _callsCounter++; _callBack(); }