[colobot] 105/390: add option to disable blood

Didier Raboud odyx at moszumanska.debian.org
Fri Jun 12 14:21:34 UTC 2015


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

odyx pushed a commit to branch upstream/latest
in repository colobot.

commit d019a4990f2e2da71555daf085a3e09c92085fa5
Author: Victor Vieux <victorvieux at gmail.com>
Date:   Tue Oct 21 21:44:17 2014 -0700

    add option to disable blood
---
 src/common/event.h             |  1 +
 src/common/restext.cpp         |  1 +
 src/graphics/engine/camera.cpp | 10 ++++++++++
 src/graphics/engine/camera.h   |  4 ++++
 src/graphics/engine/pyro.cpp   |  6 +++---
 src/ui/maindialog.cpp          | 23 +++++++++++++++++++++++
 src/ui/maindialog.h            |  1 +
 7 files changed, 43 insertions(+), 3 deletions(-)

diff --git a/src/common/event.h b/src/common/event.h
index c5eb615..1df675e 100644
--- a/src/common/event.h
+++ b/src/common/event.h
@@ -239,6 +239,7 @@ enum EventType
     EVENT_INTERFACE_EDITMODE= 476,
     EVENT_INTERFACE_EDITVALUE= 477,
     EVENT_INTERFACE_SOLUCE4 = 478,
+    EVENT_INTERFACE_BLOOD   = 479,
 
     EVENT_INTERFACE_KINFO1  = 500,
     EVENT_INTERFACE_KINFO2  = 501,
diff --git a/src/common/restext.cpp b/src/common/restext.cpp
index b63160d..bc488b8 100644
--- a/src/common/restext.cpp
+++ b/src/common/restext.cpp
@@ -199,6 +199,7 @@ void InitializeRestext()
     stringsEvent[EVENT_INTERFACE_EDITMODE]  = "Automatic indent\\When program editing";
     stringsEvent[EVENT_INTERFACE_EDITVALUE] = "Big indent\\Indent 2 or 4 spaces per level defined by braces";
     stringsEvent[EVENT_INTERFACE_SOLUCE4]   = "Access to solutions\\Show program \"4: Solution\" in the exercises";
+    stringsEvent[EVENT_INTERFACE_BLOOD]     = "Blood\\Display blood when the astronaut or the alien queen is hit";
 
     stringsEvent[EVENT_INTERFACE_KDEF]      = "Standard controls\\Standard key functions";
     stringsEvent[EVENT_INTERFACE_KLEFT]     = "Turn left\\turns the bot to the left";
diff --git a/src/graphics/engine/camera.cpp b/src/graphics/engine/camera.cpp
index fedc70a..c37ed39 100644
--- a/src/graphics/engine/camera.cpp
+++ b/src/graphics/engine/camera.cpp
@@ -137,6 +137,7 @@ CCamera::CCamera()
     m_scriptLookat = Math::Vector(0.0f, 0.0f, 0.0f);
 
     m_effect        = true;
+    m_blood         = true;
     m_cameraScroll  = true;
     m_cameraInvertX = false;
     m_cameraInvertY = false;
@@ -151,6 +152,15 @@ void CCamera::SetEffect(bool enable)
     m_effect = enable;
 }
 
+void CCamera::SetBlood(bool enable)
+{
+    m_blood = enable;
+}
+
+bool CCamera::GetBlood() {
+    return m_blood;
+}
+
 void CCamera::SetCameraScroll(bool scroll)
 {
     m_cameraScroll = scroll;
diff --git a/src/graphics/engine/camera.h b/src/graphics/engine/camera.h
index 6d94dad..699593c 100644
--- a/src/graphics/engine/camera.h
+++ b/src/graphics/engine/camera.h
@@ -198,6 +198,8 @@ public:
     void        SetScriptLookat(Math::Vector lookat);
 
     void        SetEffect(bool enable);
+    void        SetBlood(bool enable);
+    bool        GetBlood();
     void        SetCameraScroll(bool scroll);
     void        SetCameraInvertX(bool invert);
     void        SetCameraInvertY(bool invert);
@@ -379,6 +381,8 @@ protected:
 
     //! Shocks if explosion?
     bool        m_effect;
+    //! Blood?
+    bool        m_blood;
     //! Scroll in the edges?
     bool        m_cameraScroll;
     //! X inversion in the edges?
diff --git a/src/graphics/engine/pyro.cpp b/src/graphics/engine/pyro.cpp
index d3e0405..d7edf51 100644
--- a/src/graphics/engine/pyro.cpp
+++ b/src/graphics/engine/pyro.cpp
@@ -312,7 +312,7 @@ bool CPyro::Create(PyroType type, CObject* obj, float force)
     }
     if ( m_type == PT_SHOTH )
     {
-        if ( m_object->GetSelect() )
+        if ( m_camera->GetBlood() && m_object->GetSelect() )
         {
             m_camera->StartOver(CAM_OVER_EFFECT_BLOOD, m_pos, force);
         }
@@ -672,7 +672,7 @@ bool CPyro::EventProcess(const Event &event)
         }
     }
 
-    if ( m_type == PT_SHOTH &&
+    if ( m_camera->GetBlood() && m_type == PT_SHOTH &&
          m_lastParticle+m_engine->ParticleAdapt(0.05f) <= m_time )
     {
         m_lastParticle = m_time;
@@ -694,7 +694,7 @@ bool CPyro::EventProcess(const Event &event)
         }
     }
 
-    if ( m_type == PT_SHOTM &&
+    if ( m_camera->GetBlood() && m_type == PT_SHOTM &&
          m_lastParticle+m_engine->ParticleAdapt(0.05f) <= m_time )
     {
         m_lastParticle = m_time;
diff --git a/src/ui/maindialog.cpp b/src/ui/maindialog.cpp
index 11f8f4a..f63d22e 100644
--- a/src/ui/maindialog.cpp
+++ b/src/ui/maindialog.cpp
@@ -162,6 +162,7 @@ CMainDialog::CMainDialog()
     m_bCameraInvertX = false;
     m_bCameraInvertY = false;
     m_bEffect        = true;
+    m_bBlood         = true;
     m_shotDelay      = 0;
 
     m_glintMouse = Math::Point(0.0f, 0.0f);
@@ -1223,6 +1224,9 @@ void CMainDialog::ChangePhase(Phase phase)
         pos.y -= 0.048f;
         pc = pw->CreateCheck(pos, ddim, -1, EVENT_INTERFACE_EFFECT);
         pc->SetState(STATE_SHADOW);
+        pos.y -= 0.048f;
+        pc = pw->CreateCheck(pos, ddim, -1, EVENT_INTERFACE_BLOOD);
+        pc->SetState(STATE_SHADOW);
         //?     pos.y -= 0.048f;
         //?     pc = pw->CreateCheck(pos, ddim, -1, EVENT_INTERFACE_NICERST);
         //?     pc->SetState(STATE_SHADOW);
@@ -2554,6 +2558,13 @@ bool CMainDialog::EventProcess(const Event &event)
                 UpdateSetupButtons();
                 break;
 
+            case EVENT_INTERFACE_BLOOD:
+                m_bBlood = !m_bBlood;
+                m_camera->SetBlood(m_bBlood);
+                ChangeSetupButtons();
+                UpdateSetupButtons();
+                break;
+
             default:
                 break;
         }
@@ -5011,6 +5022,12 @@ void CMainDialog::UpdateSetupButtons()
         pc->SetState(STATE_CHECK, m_bEffect);
     }
 
+    pc = static_cast<CCheck*>(pw->SearchControl(EVENT_INTERFACE_BLOOD));
+    if ( pc != 0 )
+    {
+        pc->SetState(STATE_CHECK, m_bBlood);
+    }
+
     pc = static_cast<CCheck*>(pw->SearchControl(EVENT_INTERFACE_SHADOW));
     if ( pc != 0 )
     {
@@ -5198,6 +5215,7 @@ void CMainDialog::SetupMemorize()
     GetProfile().SetLocalProfileInt("Setup", "CameraInvertX", m_bCameraInvertX);
     GetProfile().SetLocalProfileInt("Setup", "CameraInvertY", m_bCameraInvertY);
     GetProfile().SetLocalProfileInt("Setup", "InterfaceEffect", m_bEffect);
+    GetProfile().SetLocalProfileInt("Setup", "Blood", m_bBlood);
     GetProfile().SetLocalProfileInt("Setup", "GroundShadow", m_engine->GetShadow());
     GetProfile().SetLocalProfileInt("Setup", "GroundSpot", m_engine->GetGroundSpot());
     GetProfile().SetLocalProfileInt("Setup", "ObjectDirty", m_engine->GetDirty());
@@ -5356,6 +5374,11 @@ void CMainDialog::SetupRecall()
         m_bEffect = iValue;
     }
 
+    if ( GetProfile().GetLocalProfileInt("Setup", "Blood", iValue) )
+    {
+        m_bBlood = iValue;
+    }
+
     if ( GetProfile().GetLocalProfileInt("Setup", "GroundShadow", iValue) )
     {
         m_engine->SetShadow(iValue);
diff --git a/src/ui/maindialog.h b/src/ui/maindialog.h
index 444a568..0ab7897 100644
--- a/src/ui/maindialog.h
+++ b/src/ui/maindialog.h
@@ -244,6 +244,7 @@ protected:
     bool            m_bCameraInvertX;       // for CCamera
     bool            m_bCameraInvertY;       // for CCamera
     bool            m_bEffect;          // for CCamera
+    bool            m_bBlood;          // for CCamera
 
     Math::Point          m_glintMouse;
     float                m_glintTime;

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



More information about the Pkg-games-commits mailing list