summaryrefslogtreecommitdiffstats
path: root/src/object/auto/autoflag.cpp
diff options
context:
space:
mode:
authorPiotr Dziwinski <piotrdz@gmail.com>2012-06-26 22:23:05 +0200
committerPiotr Dziwinski <piotrdz@gmail.com>2012-06-26 22:23:05 +0200
commitebed57aa22b772211387a5561f995eee8f5faed1 (patch)
tree9a0b08371df54c125957e63c7ecff81c001d4eaf /src/object/auto/autoflag.cpp
parentfc5389d18816799ba2698914384cd099ba8a7a6c (diff)
downloadcolobot-ebed57aa22b772211387a5561f995eee8f5faed1.tar.gz
colobot-ebed57aa22b772211387a5561f995eee8f5faed1.tar.bz2
colobot-ebed57aa22b772211387a5561f995eee8f5faed1.zip
Whitespace and language change
- changed tabs to spaces and DOS line endings to Unix (except in CBot and metafile) - changed language to English - fixed #include <d3d.h> in d3dengine.h
Diffstat (limited to 'src/object/auto/autoflag.cpp')
-rw-r--r--src/object/auto/autoflag.cpp324
1 files changed, 162 insertions, 162 deletions
diff --git a/src/object/auto/autoflag.cpp b/src/object/auto/autoflag.cpp
index 2c9ebdc..ea74b17 100644
--- a/src/object/auto/autoflag.cpp
+++ b/src/object/auto/autoflag.cpp
@@ -1,162 +1,162 @@
-// * This file is part of the COLOBOT source code
-// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch
-// *
-// * This program is free software: you can redistribute it and/or modify
-// * it under the terms of the GNU General Public License as published by
-// * the Free Software Foundation, either version 3 of the License, or
-// * (at your option) any later version.
-// *
-// * This program is distributed in the hope that it will be useful,
-// * but WITHOUT ANY WARRANTY; without even the implied warranty of
-// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// * GNU General Public License for more details.
-// *
-// * You should have received a copy of the GNU General Public License
-// * along with this program. If not, see http://www.gnu.org/licenses/.
-
-
-#include <stdio.h>
-
-#include "object/auto/autoflag.h"
-
-#include "math/geometry.h"
-#include "old/terrain.h"
-
-
-
-#define ADJUST_ANGLE false // true -> adjusts the angles of the members
-
-
-#if ADJUST_ANGLE
-static float g_flag1 = 6.00f;
-static float g_flag2 = 0.10f;
-static float g_flag3 = 2.00f;
-#endif
-
-
-// Object's constructor.
-
-CAutoFlag::CAutoFlag(CInstanceManager* iMan, CObject* object)
- : CAuto(iMan, object)
-{
- Init();
-}
-
-// Object's destructor.
-
-CAutoFlag::~CAutoFlag()
-{
-}
-
-
-// Destroys the object.
-
-void CAutoFlag::DeleteObject(bool bAll)
-{
- CAuto::DeleteObject(bAll);
-}
-
-
-// Initialize the object.
-
-void CAutoFlag::Init()
-{
- Math::Vector wind;
- float angle;
-
- m_time = 0.0f;
- m_param = 0;
- m_progress = 0.0f;
-
- wind = m_terrain->RetWind();
- angle = Math::RotateAngle(wind.x, -wind.z);
- m_object->SetAngleY(0, angle); // directs the flag in the wind
-
- m_strong = wind.Length();
-}
-
-
-// Beginning of an action (1 = shakes).
-
-void CAutoFlag::Start(int param)
-{
- if ( m_param == 0 )
- {
- m_param = param;
- m_progress = 0.0f;
- }
-}
-
-
-// Management of an event.
-
-bool CAutoFlag::EventProcess(const Event &event)
-{
- float angle;
- int i;
-
- CAuto::EventProcess(event);
-
-#if ADJUST_ANGLE
- if ( event.event == EVENT_KEYDOWN )
- {
- if ( event.param == 'E' ) g_flag1 += 0.1f;
- if ( event.param == 'D' ) g_flag1 -= 0.1f;
- if ( event.param == 'R' ) g_flag2 += 0.1f;
- if ( event.param == 'F' ) g_flag2 -= 0.1f;
- if ( event.param == 'T' ) g_flag3 += 0.1f;
- if ( event.param == 'G' ) g_flag3 -= 0.1f;
- }
-#endif
-
- if ( m_engine->RetPause() ) return true;
- if ( event.event != EVENT_FRAME ) return true;
-
- if ( m_param == 1 ) // shakes?
- {
- m_progress += event.rTime*(1.0f/2.0f);
- if ( m_progress < 1.0f )
- {
- angle = sinf(m_progress*Math::PI*8.0f)*0.3f*(1.0f-m_progress);
- m_object->SetAngleX(0, angle);
- angle = sinf(m_progress*Math::PI*4.0f)*0.3f*(1.0f-m_progress);
- m_object->SetAngleZ(0, angle);
- }
- else
- {
- m_object->SetAngleX(0, 0.0f);
- m_object->SetAngleZ(0, 0.0f);
- m_param = 0;
- m_progress = 0.0f;
- }
- }
-
- if ( m_strong == 0.0f ) return true; // no wind?
-
- for ( i=0 ; i<4 ; i++ )
- {
-#if ADJUST_ANGLE
- angle = sinf(m_time*g_flag1+i*2.0f)*((i+g_flag3)*g_flag2);
-#else
- angle = sinf(m_time*6.0f+i*2.0f)*((i+2.0f)*0.1f);
-#endif
- m_object->SetAngleY(1+i, angle);
- }
-
-#if ADJUST_ANGLE
- char s[100];
- sprintf(s, "a=%.2f b=%.2f c=%.2f", g_flag1, g_flag2, g_flag3);
- m_engine->SetInfoText(4, s);
-#endif
- return true;
-}
-
-
-// Returns an error due the state of the automation
-
-Error CAutoFlag::RetError()
-{
- return ERR_OK;
-}
-
-
+// * This file is part of the COLOBOT source code
+// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch
+// *
+// * This program is free software: you can redistribute it and/or modify
+// * it under the terms of the GNU General Public License as published by
+// * the Free Software Foundation, either version 3 of the License, or
+// * (at your option) any later version.
+// *
+// * This program is distributed in the hope that it will be useful,
+// * but WITHOUT ANY WARRANTY; without even the implied warranty of
+// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// * GNU General Public License for more details.
+// *
+// * You should have received a copy of the GNU General Public License
+// * along with this program. If not, see http://www.gnu.org/licenses/.
+
+
+#include <stdio.h>
+
+#include "object/auto/autoflag.h"
+
+#include "math/geometry.h"
+#include "old/terrain.h"
+
+
+
+#define ADJUST_ANGLE false // true -> adjusts the angles of the members
+
+
+#if ADJUST_ANGLE
+static float g_flag1 = 6.00f;
+static float g_flag2 = 0.10f;
+static float g_flag3 = 2.00f;
+#endif
+
+
+// Object's constructor.
+
+CAutoFlag::CAutoFlag(CInstanceManager* iMan, CObject* object)
+ : CAuto(iMan, object)
+{
+ Init();
+}
+
+// Object's destructor.
+
+CAutoFlag::~CAutoFlag()
+{
+}
+
+
+// Destroys the object.
+
+void CAutoFlag::DeleteObject(bool bAll)
+{
+ CAuto::DeleteObject(bAll);
+}
+
+
+// Initialize the object.
+
+void CAutoFlag::Init()
+{
+ Math::Vector wind;
+ float angle;
+
+ m_time = 0.0f;
+ m_param = 0;
+ m_progress = 0.0f;
+
+ wind = m_terrain->RetWind();
+ angle = Math::RotateAngle(wind.x, -wind.z);
+ m_object->SetAngleY(0, angle); // directs the flag in the wind
+
+ m_strong = wind.Length();
+}
+
+
+// Beginning of an action (1 = shakes).
+
+void CAutoFlag::Start(int param)
+{
+ if ( m_param == 0 )
+ {
+ m_param = param;
+ m_progress = 0.0f;
+ }
+}
+
+
+// Management of an event.
+
+bool CAutoFlag::EventProcess(const Event &event)
+{
+ float angle;
+ int i;
+
+ CAuto::EventProcess(event);
+
+#if ADJUST_ANGLE
+ if ( event.event == EVENT_KEYDOWN )
+ {
+ if ( event.param == 'E' ) g_flag1 += 0.1f;
+ if ( event.param == 'D' ) g_flag1 -= 0.1f;
+ if ( event.param == 'R' ) g_flag2 += 0.1f;
+ if ( event.param == 'F' ) g_flag2 -= 0.1f;
+ if ( event.param == 'T' ) g_flag3 += 0.1f;
+ if ( event.param == 'G' ) g_flag3 -= 0.1f;
+ }
+#endif
+
+ if ( m_engine->RetPause() ) return true;
+ if ( event.event != EVENT_FRAME ) return true;
+
+ if ( m_param == 1 ) // shakes?
+ {
+ m_progress += event.rTime*(1.0f/2.0f);
+ if ( m_progress < 1.0f )
+ {
+ angle = sinf(m_progress*Math::PI*8.0f)*0.3f*(1.0f-m_progress);
+ m_object->SetAngleX(0, angle);
+ angle = sinf(m_progress*Math::PI*4.0f)*0.3f*(1.0f-m_progress);
+ m_object->SetAngleZ(0, angle);
+ }
+ else
+ {
+ m_object->SetAngleX(0, 0.0f);
+ m_object->SetAngleZ(0, 0.0f);
+ m_param = 0;
+ m_progress = 0.0f;
+ }
+ }
+
+ if ( m_strong == 0.0f ) return true; // no wind?
+
+ for ( i=0 ; i<4 ; i++ )
+ {
+#if ADJUST_ANGLE
+ angle = sinf(m_time*g_flag1+i*2.0f)*((i+g_flag3)*g_flag2);
+#else
+ angle = sinf(m_time*6.0f+i*2.0f)*((i+2.0f)*0.1f);
+#endif
+ m_object->SetAngleY(1+i, angle);
+ }
+
+#if ADJUST_ANGLE
+ char s[100];
+ sprintf(s, "a=%.2f b=%.2f c=%.2f", g_flag1, g_flag2, g_flag3);
+ m_engine->SetInfoText(4, s);
+#endif
+ return true;
+}
+
+
+// Returns an error due the state of the automation
+
+Error CAutoFlag::RetError()
+{
+ return ERR_OK;
+}
+
+