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/auto | |
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/auto')
-rw-r--r-- | src/object/auto/auto.cpp | 2 | ||||
-rw-r--r-- | src/object/auto/autobase.cpp | 103 | ||||
-rw-r--r-- | src/object/auto/autobase.h | 2 |
3 files changed, 57 insertions, 50 deletions
diff --git a/src/object/auto/auto.cpp b/src/object/auto/auto.cpp index 0aeaa0a..9e593a9 100644 --- a/src/object/auto/auto.cpp +++ b/src/object/auto/auto.cpp @@ -175,7 +175,6 @@ bool CAuto::CreateInterface(bool bSelect) Ui::CWindow* pw; Math::Point pos, dim, ddim; float ox, oy, sx, sy; - char name[100]; pw = static_cast<Ui::CWindow*>(m_interface->SearchControl(EVENT_WINDOW0)); if ( pw != nullptr ) @@ -195,6 +194,7 @@ bool CAuto::CreateInterface(bool bSelect) pw = static_cast<Ui::CWindow*>(m_interface->SearchControl(EVENT_WINDOW0)); if ( pw == 0 ) return false; + std::string name; m_object->GetTooltipName(name); pos.x = 0.0f; pos.y = 64.0f/480.0f; diff --git a/src/object/auto/autobase.cpp b/src/object/auto/autobase.cpp index 6d61bc2..af6c6e0 100644 --- a/src/object/auto/autobase.cpp +++ b/src/object/auto/autobase.cpp @@ -121,7 +121,6 @@ bool CAutoBase::EventProcess(const Event &event) CObject* pObj; Math::Vector pos, speed, vibCir, iPos; Math::Point dim, p; - Error err; float angle, dist, time, h, len, vSpeed; int i, max; @@ -313,50 +312,7 @@ begin: if ( event.type == EVENT_OBJECT_BTAKEOFF ) { - err = CheckCloseDoor(); - if ( err != ERR_OK ) - { - m_main->DisplayError(err, m_object); - return false; - } - - err = m_main->CheckEndMission(false); - if ( err != ERR_OK ) - { - m_main->DisplayError(err, m_object); - return false; - } - - FreezeCargo(true); // freeze whole cargo - m_main->SetMovieLock(true); // blocks everything until the end - m_main->DeselectAll(); - - newEvent.type = EVENT_UPDINTERFACE; - m_eventQueue->AddEvent(newEvent); - - m_camera->SetType(Gfx::CAM_TYPE_SCRIPT); - - pos = m_pos; - pos.x -= 110.0f; - m_terrain->AdjustToFloor(pos); - pos.y += 10.0f; - m_camera->SetScriptEye(pos); - m_posSound = pos; - - pos = m_object->GetPosition(0); - pos.y += 50.0f; - m_camera->SetScriptLookat(pos); - - m_engine->SetFocus(1.0f); - - m_soundChannel = m_sound->Play(SOUND_MANIP, m_posSound, 0.3f, 1.5f, true); - m_sound->AddEnvelope(m_soundChannel, 0.3f, 1.5f, BASE_DOOR_TIME2, SOPER_CONTINUE); - m_sound->AddEnvelope(m_soundChannel, 0.0f, 1.5f, 0.5f, SOPER_STOP); - - m_phase = ABP_CLOSE2; - m_progress = 0.0f; - m_speed = 1.0f/BASE_DOOR_TIME2; - return true; + return TakeOff(true); } if ( event.type != EVENT_FRAME ) return true; @@ -1400,11 +1356,7 @@ void CAutoBase::BeginTransit() } else { -#if _DEMO - m_bgBack = "back46b.png"; // paintings -#else m_bgBack = "back46.png"; // paintings -#endif } m_engine->SetFogStart(0.9f); // hardly any fog @@ -1444,3 +1396,56 @@ void CAutoBase::EndTransit() m_main->StartMusic(); } +Error CAutoBase::TakeOff(bool printMsg) +{ + + Event newEvent; + Math::Vector pos; + Error err; + + err = CheckCloseDoor(); + if ( err != ERR_OK ) + { + if(printMsg) m_main->DisplayError(err, m_object); + return err; + } + + err = m_main->CheckEndMission(false); + if ( err != ERR_OK ) + { + if(printMsg) m_main->DisplayError(err, m_object); + return err; + } + + FreezeCargo(true); // freeze whole cargo + m_main->SetMovieLock(true); // blocks everything until the end + m_main->DeselectAll(); + + newEvent.type = EVENT_UPDINTERFACE; + m_eventQueue->AddEvent(newEvent); + + m_camera->SetType(Gfx::CAM_TYPE_SCRIPT); + + pos = m_pos; + pos.x -= 110.0f; + m_terrain->AdjustToFloor(pos); + pos.y += 10.0f; + m_camera->SetScriptEye(pos); + m_posSound = pos; + + pos = m_object->GetPosition(0); + pos.y += 50.0f; + m_camera->SetScriptLookat(pos); + + m_engine->SetFocus(1.0f); + + m_soundChannel = m_sound->Play(SOUND_MANIP, m_posSound, 0.3f, 1.5f, true); + m_sound->AddEnvelope(m_soundChannel, 0.3f, 1.5f, BASE_DOOR_TIME2, SOPER_CONTINUE); + m_sound->AddEnvelope(m_soundChannel, 0.0f, 1.5f, 0.5f, SOPER_STOP); + + m_phase = ABP_CLOSE2; + m_progress = 0.0f; + m_speed = 1.0f/BASE_DOOR_TIME2; + return ERR_OK; +} + diff --git a/src/object/auto/autobase.h b/src/object/auto/autobase.h index 422f340..967e43d 100644 --- a/src/object/auto/autobase.h +++ b/src/object/auto/autobase.h @@ -77,6 +77,8 @@ public: Error GetError(); bool CreateInterface(bool bSelect); + + Error TakeOff(bool printMsg); protected: void UpdateInterface(); |