diff options
author | krzys-h <krzys_h@interia.pl> | 2014-07-01 12:15:38 +0200 |
---|---|---|
committer | krzys-h <krzys_h@interia.pl> | 2014-07-01 12:16:32 +0200 |
commit | d9fee8b2adad613cf8c10d153cd5cd7b261b7863 (patch) | |
tree | f6b71cc2daa719c10c1ce31cf738e1c6ec934a73 /src/object/task | |
parent | 0f2adf05fd2b2b38c2b84aa8d72b3fd756dcfcd4 (diff) | |
parent | 1835d2ae580525603308206f7b8e6b4552b3ca0f (diff) | |
download | colobot-d9fee8b2adad613cf8c10d153cd5cd7b261b7863.tar.gz colobot-d9fee8b2adad613cf8c10d153cd5cd7b261b7863.tar.bz2 colobot-d9fee8b2adad613cf8c10d153cd5cd7b261b7863.zip |
Release 0.1.3-alpha
Diffstat (limited to 'src/object/task')
-rw-r--r-- | src/object/task/taskbuild.cpp | 3 | ||||
-rw-r--r-- | src/object/task/taskgoto.cpp | 4 | ||||
-rw-r--r-- | src/object/task/taskgungoal.cpp | 24 | ||||
-rw-r--r-- | src/object/task/taskgungoal.h | 2 | ||||
-rw-r--r-- | src/object/task/taskrecover.cpp | 4 | ||||
-rw-r--r-- | src/object/task/taskterraform.cpp | 23 |
6 files changed, 31 insertions, 29 deletions
diff --git a/src/object/task/taskbuild.cpp b/src/object/task/taskbuild.cpp index 4a62a4a..4dfd6fb 100644 --- a/src/object/task/taskbuild.cpp +++ b/src/object/task/taskbuild.cpp @@ -100,6 +100,7 @@ bool CTaskBuild::CreateBuilding(Math::Vector pos, float angle) if ( m_type == OBJECT_PARA ) m_buildingHeight = 68.0f; if ( m_type == OBJECT_INFO ) m_buildingHeight = 19.0f; if ( m_type == OBJECT_DESTROYER) m_buildingHeight = 35.0f; + if ( m_type == OBJECT_HUSTON ) m_buildingHeight = 45.0f; m_buildingHeight *= 0.25f; m_buildingPos = m_building->GetPosition(0); @@ -574,7 +575,7 @@ Error CTaskBuild::FlatFloor() if ( m_type == OBJECT_PARA ) radius = 20.0f; if ( m_type == OBJECT_INFO ) radius = 5.0f; if ( m_type == OBJECT_DESTROYER) radius = 20.0f; - if ( radius == 0.0f ) return ERR_GENERIC; + //if ( radius == 0.0f ) return ERR_GENERIC; center = m_metal->GetPosition(0); angle = m_terrain->GetFineSlope(center); diff --git a/src/object/task/taskgoto.cpp b/src/object/task/taskgoto.cpp index 01ff38b..8070d13 100644 --- a/src/object/task/taskgoto.cpp +++ b/src/object/task/taskgoto.cpp @@ -1559,8 +1559,8 @@ void CTaskGoto::ComputeRepulse(Math::Point &dir) oType == OBJECT_BOMB || (oType >= OBJECT_PLANT0 && oType <= OBJECT_PLANT19 ) || - (oType >= OBJECT_MUSHROOM0 && - oType <= OBJECT_MUSHROOM9 ) ) continue; + (oType >= OBJECT_MUSHROOM1 && + oType <= OBJECT_MUSHROOM2 ) ) continue; } addi = add; diff --git a/src/object/task/taskgungoal.cpp b/src/object/task/taskgungoal.cpp index 3373610..c9c8d30 100644 --- a/src/object/task/taskgungoal.cpp +++ b/src/object/task/taskgungoal.cpp @@ -26,6 +26,7 @@ CTaskGunGoal::CTaskGunGoal(CObject* object) : CTask(object) { + m_aimImpossible = false; } // Object's destructor. @@ -116,6 +117,12 @@ Error CTaskGunGoal::Start(float dirV, float dirH) m_progress = 0.0f; + // direction was constrainted, hence resulting in impossible move + if (dirV != m_finalDirV || dirH != m_finalDirH) + { + m_aimImpossible = true; + } + return ERR_OK; } @@ -126,12 +133,25 @@ Error CTaskGunGoal::IsEnded() if ( m_engine->GetPause() ) return ERR_CONTINUE; if ( m_initialDirV == m_finalDirV && - m_initialDirH == m_finalDirH ) return ERR_STOP; - if ( m_progress < 1.0f ) return ERR_CONTINUE; + m_initialDirH == m_finalDirH ) + { + if ( m_aimImpossible ) + return ERR_AIM_IMPOSSIBLE; + else + return ERR_STOP; + } + + if ( m_progress < 1.0f ) return ERR_CONTINUE; m_object->SetGunGoalV(m_finalDirV); m_object->SetGunGoalH(m_finalDirH); Abort(); + + if ( m_aimImpossible ) + { + return ERR_AIM_IMPOSSIBLE; + } + return ERR_STOP; } diff --git a/src/object/task/taskgungoal.h b/src/object/task/taskgungoal.h index c6f010b..9fc509d 100644 --- a/src/object/task/taskgungoal.h +++ b/src/object/task/taskgungoal.h @@ -44,5 +44,7 @@ protected: float m_finalDirV; // direction to reach float m_initialDirH; // initial direction float m_finalDirH; // direction to reach + + bool m_aimImpossible; // set to true if impossible aim was set }; diff --git a/src/object/task/taskrecover.cpp b/src/object/task/taskrecover.cpp index af84099..d8bbafd 100644 --- a/src/object/task/taskrecover.cpp +++ b/src/object/task/taskrecover.cpp @@ -105,9 +105,11 @@ bool CTaskRecover::EventProcess(const Event &event) if ( power != 0 ) { energy = power->GetEnergy(); - power->SetEnergy(energy-ENERGY_RECOVER*event.rTime*m_speed); + energy -= event.rTime * ENERGY_RECOVER / power->GetCapacity() * m_speed; + power->SetEnergy(energy); } + speed.x = (Math::Rand()-0.5f)*0.1f*m_progress; speed.y = (Math::Rand()-0.5f)*0.1f*m_progress; speed.z = (Math::Rand()-0.5f)*0.1f*m_progress; diff --git a/src/object/task/taskterraform.cpp b/src/object/task/taskterraform.cpp index 096e5de..61ff045 100644 --- a/src/object/task/taskterraform.cpp +++ b/src/object/task/taskterraform.cpp @@ -76,15 +76,9 @@ bool CTaskTerraform::EventProcess(const Event &event) { if ( m_soundChannel == -1 ) { -#if _TEEN - m_soundChannel = m_sound->Play(SOUND_GGG, m_object->GetPosition(0), 1.0f, 0.5f, true); - m_sound->AddEnvelope(m_soundChannel, 1.0f, 2.0f, 1.5f, SOPER_CONTINUE); - m_sound->AddEnvelope(m_soundChannel, 0.0f, 0.5f, 0.5f, SOPER_STOP); -#else m_soundChannel = m_sound->Play(SOUND_GGG, m_object->GetPosition(0), 1.0f, 0.5f, true); m_sound->AddEnvelope(m_soundChannel, 1.0f, 2.0f, 4.0f, SOPER_CONTINUE); m_sound->AddEnvelope(m_soundChannel, 0.0f, 0.5f, 0.5f, SOPER_STOP); -#endif } dir.x = 0.0f; @@ -109,11 +103,7 @@ bool CTaskTerraform::EventProcess(const Event &event) if ( m_phase == TTP_DOWN ) { pos.x = 9.0f; -#if _TEEN - pos.y = 4.0f-m_progress*4.0f; -#else pos.y = 4.0f-m_progress*5.8f; -#endif pos.z = 0.0f; m_object->SetPosition(2, pos); } @@ -121,11 +111,7 @@ bool CTaskTerraform::EventProcess(const Event &event) if ( m_phase == TTP_UP ) { pos.x = 9.0f; -#if _TEEN - pos.y = 4.0f-(1.0f-m_progress)*4.0f; -#else pos.y = 4.0f-(1.0f-m_progress)*5.8f; -#endif pos.z = 0.0f; m_object->SetPosition(2, pos); } @@ -230,11 +216,7 @@ Error CTaskTerraform::Start() m_phase = TTP_CHARGE; m_progress = 0.0f; -#if _TEEN - m_speed = 1.0f/1.5f; -#else m_speed = 1.0f/4.0f; -#endif m_time = 0.0f; m_bError = false; // ok @@ -261,9 +243,6 @@ Error CTaskTerraform::IsEnded() if ( m_phase == TTP_CHARGE ) { -#if _TEEN - Terraform(); // changes the terrain. -#endif m_phase = TTP_DOWN; m_speed = 1.0f/0.2f; @@ -272,9 +251,7 @@ Error CTaskTerraform::IsEnded() if ( m_phase == TTP_DOWN ) { -#if !_TEEN Terraform(); // changes the terrain. -#endif m_object->SetCirVibration(Math::Vector(0.0f, 0.0f, 0.0f)); m_object->SetZoom(0, 1.0f); |