Skip to content

Commit

Permalink
Fix SpaceShip sound
Browse files Browse the repository at this point in the history
  • Loading branch information
hexagonrecursion committed Dec 24, 2024
1 parent 8a40853 commit 0c7793c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 18 deletions.
25 changes: 8 additions & 17 deletions colobot-base/src/object/auto/autobase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -214,15 +214,14 @@ bool CAutoBase::EventProcess(const Event &event)
lookat.y += 300.0f+50.0f;

m_camera->SetScriptCamera(eye, lookat);
m_posSound = eye;

m_engine->SetFocus(2.0f);

m_engine->SetFogStart(0.9f);

if ( m_soundChannel == -1 )
{
m_soundChannel = m_sound->Play(SOUND_FLY, m_posSound, 0.3f, 2.0f, true);
m_soundChannel = m_sound->Play(SOUND_FLY, 0.3f, 2.0f, true);
m_sound->AddEnvelope(m_soundChannel, 1.0f, 0.5f, BASE_LAND_TIME, SOPER_CONTINUE);
m_sound->AddEnvelope(m_soundChannel, 0.0f, 0.5f, 2.0f, SOPER_STOP);
}
Expand Down Expand Up @@ -267,7 +266,6 @@ bool CAutoBase::EventProcess(const Event &event)
pos.x += 1000.0f;
pos.z -= 60.0f;
pos.y += 80.0f;
m_posSound = pos;
m_camera->SetScriptCamera(pos, glm::vec3(0.0f, 0.0f, 0.0f));
m_engine->SetFocus(1.0f);

Expand Down Expand Up @@ -304,7 +302,7 @@ bool CAutoBase::EventProcess(const Event &event)

if ( m_soundChannel == -1 )
{
m_soundChannel = m_sound->Play(SOUND_FLY, m_posSound, 0.0f, 1.2f, true);
m_soundChannel = m_sound->Play(SOUND_FLY, 0.0f, 1.2f, true);
m_sound->AddEnvelope(m_soundChannel, 1.0f, 1.0f, BASE_TRANSIT_TIME*0.55f, SOPER_CONTINUE);
m_sound->AddEnvelope(m_soundChannel, 0.3f, 0.8f, BASE_TRANSIT_TIME*0.45f, SOPER_STOP);
}
Expand Down Expand Up @@ -432,7 +430,7 @@ bool CAutoBase::EventProcess(const Event &event)
//? m_camera->StartEffect(CE_CRASH, m_pos, 1.0f);
m_camera->StartEffect(Gfx::CAM_EFFECT_EXPLO, m_pos, 2.0f);
m_engine->SetFocus(1.0f);
m_sound->Play(SOUND_BOUM, m_posSound, 0.6f, 0.5f);
m_sound->Play(SOUND_BOUM, 0.6f, 0.5f);

m_phase = ABP_OPENWAIT;
m_progress = 0.0f;
Expand Down Expand Up @@ -463,7 +461,7 @@ bool CAutoBase::EventProcess(const Event &event)
}
else
{
m_soundChannel = m_sound->Play(SOUND_MANIP, m_posSound, 0.0f, 0.3f, true);
m_soundChannel = m_sound->Play(SOUND_MANIP, 0.0f, 0.3f, true);
m_sound->AddEnvelope(m_soundChannel, 0.3f, 0.3f, 1.0f, SOPER_CONTINUE);
m_sound->AddEnvelope(m_soundChannel, 0.3f, 1.0f, BASE_DOOR_TIME-1.5f, SOPER_CONTINUE);
m_sound->AddEnvelope(m_soundChannel, 0.0f, 0.3f, 1.0f, SOPER_STOP);
Expand Down Expand Up @@ -523,7 +521,7 @@ bool CAutoBase::EventProcess(const Event &event)
m_particle->CreateParticle(pos, speed, dim, Gfx::PARTICRASH, time, 0.0f, 2.0f);
}

m_soundChannel = m_sound->Play(SOUND_MANIP, m_posSound, 0.3f, 1.5f, true);
m_soundChannel = m_sound->Play(SOUND_MANIP, 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);

Expand Down Expand Up @@ -640,7 +638,7 @@ bool CAutoBase::EventProcess(const Event &event)
m_object->SetPartRotationX(18+i, 0.0f);
}

m_soundChannel = m_sound->Play(SOUND_MANIP, m_posSound, 0.0f, 0.3f, true);
m_soundChannel = m_sound->Play(SOUND_MANIP, 0.0f, 0.3f, true);
m_sound->AddEnvelope(m_soundChannel, 0.3f, 0.3f, 1.0f, SOPER_CONTINUE);
m_sound->AddEnvelope(m_soundChannel, 0.3f, 1.0f, BASE_DOOR_TIME-1.5f, SOPER_CONTINUE);
m_sound->AddEnvelope(m_soundChannel, 0.0f, 0.3f, 1.0f, SOPER_STOP);
Expand Down Expand Up @@ -701,7 +699,7 @@ bool CAutoBase::EventProcess(const Event &event)
{
if ( m_soundChannel == -1 )
{
m_soundChannel = m_sound->Play(SOUND_FLY, m_posSound, 0.0f, 0.5f, true);
m_soundChannel = m_sound->Play(SOUND_FLY, 0.0f, 0.5f, true);
m_sound->AddEnvelope(m_soundChannel, 1.0f, 0.5f, 2.0f, SOPER_CONTINUE);
m_sound->AddEnvelope(m_soundChannel, 0.3f, 2.0f, BASE_TAKO_TIME, SOPER_STOP);
}
Expand Down Expand Up @@ -1048,12 +1046,6 @@ bool CAutoBase::EventProcess(const Event &event)
}
}

if ( m_soundChannel != -1 )
{
pos = m_engine->GetEyePt();
m_sound->Position(m_soundChannel, pos);
}

return true;
}

Expand Down Expand Up @@ -1402,11 +1394,10 @@ Error CAutoBase::TakeOff(bool printMsg)
lookat.y += 50.0f;

m_camera->SetScriptCameraAnimate(eye, lookat);
m_posSound = eye;

m_engine->SetFocus(1.0f);

m_soundChannel = m_sound->Play(SOUND_MANIP, m_posSound, 0.3f, 1.5f, true);
m_soundChannel = m_sound->Play(SOUND_MANIP, 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);

Expand Down
1 change: 0 additions & 1 deletion colobot-base/src/object/auto/autobase.h
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,6 @@ class CAutoBase : public CAuto
float m_fogStart = 0.0f;
float m_deepView = 0.0f;
glm::vec3 m_pos = { 0, 0, 0 };
glm::vec3 m_posSound = { 0, 0, 0 };
glm::vec3 m_finalPos = { 0, 0, 0 };
glm::vec3 m_lastPos = { 0, 0, 0 };
int m_param = 0;
Expand Down

0 comments on commit 0c7793c

Please sign in to comment.