This is an automated email from the git hooks/post-receive script.

odyx pushed a commit to branch debian/master
in repository colobot.

commit bf69b86233206e6f458686bc9f929e5baf708607
Author: melex750 <melex...@users.noreply.github.com>
Date:   Tue Oct 17 02:33:05 2017 +0200

    Fixed shortcut not changing to normal state
---
 src/object/old_object.cpp    | 17 ++++++++++++-----
 src/object/old_object.h      |  1 +
 src/ui/controls/shortcut.cpp |  2 +-
 3 files changed, 14 insertions(+), 6 deletions(-)

diff --git a/src/object/old_object.cpp b/src/object/old_object.cpp
index cc0deff..602e509 100644
--- a/src/object/old_object.cpp
+++ b/src/object/old_object.cpp
@@ -390,7 +390,12 @@ bool COldObject::DamageObject(DamageType type, float 
force, CObject* killer)
             SetShield(shield);
 
             // Sending info about taking damage
-            SetDamaging(true);
+            if (!m_damaging)
+            {
+                SetDamaging(true);
+                m_main->UpdateShortcuts();
+            }
+            m_damageTime = m_time;
         }
         else
         {
@@ -429,10 +434,6 @@ bool COldObject::DamageObject(DamageType type, float 
force, CObject* killer)
     {
         m_engine->GetPyroManager()->Create(Gfx::PT_SHOTT, this, loss);
     }
-
-    /*if ( m_time < 2.0f && m_damaging == true )  SetDamaging(false);
-    m_time = 0.0f;*/ // TODO: Make DamageAlarm Icon Dissapear after 2 seconds
-
     return false;
 }
 
@@ -2157,6 +2158,12 @@ bool COldObject::EventFrame(const Event &event)
         SetShield(GetShield() + event.rTime*(1.0f/GetShieldFullRegenTime()));
     }
 
+    if (m_damaging && m_time - m_damageTime > 2.0f)
+    {
+        SetDamaging(false);
+        m_main->UpdateShortcuts();
+    }
+
     return true;
 }
 
diff --git a/src/object/old_object.h b/src/object/old_object.h
index da9df20..48b71ee 100644
--- a/src/object/old_object.h
+++ b/src/object/old_object.h
@@ -360,6 +360,7 @@ protected:
     bool        m_bCheckToken;          // object with audited tokens
     bool        m_underground;         // object active but undetectable
     bool        m_damaging;
+    float       m_damageTime;
     DeathType   m_dying;
     bool        m_bFlat;
     bool        m_bTrainer;         // drive vehicle (without remote)
diff --git a/src/ui/controls/shortcut.cpp b/src/ui/controls/shortcut.cpp
index fca8586..52cbcec 100644
--- a/src/ui/controls/shortcut.cpp
+++ b/src/ui/controls/shortcut.cpp
@@ -109,7 +109,7 @@ void CShortcut::Draw()
         zoom = 1.0f;
         mode = Gfx::ENG_RSTATE_NORMAL;
     }
-    if ( m_state & STATE_DAMAGE  )
+    if ( (m_state & STATE_DAMAGE) && Math::Mod(m_time, 0.7f) >= 0.3f )
     {
         icon = 59;
         zoom = 0.8f;

-- 
Alioth's /usr/local/bin/git-commit-notice on 
/srv/git.debian.org/git/pkg-games/colobot.git

_______________________________________________
Pkg-games-commits mailing list
Pkg-games-commits@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-games-commits

Reply via email to