mirror of https://github.com/AxioDL/metaforce.git
CScriptMidi: Brace conditionals where applicable
This commit is contained in:
parent
510778b7cd
commit
c3d6324ea1
|
@ -17,16 +17,18 @@ CScriptMidi::CScriptMidi(TUniqueId id, const CEntityInfo& info, std::string_view
|
||||||
}
|
}
|
||||||
|
|
||||||
void CScriptMidi::StopInternal(float fadeTime) {
|
void CScriptMidi::StopInternal(float fadeTime) {
|
||||||
if (x3c_handle) {
|
if (!x3c_handle) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
CMidiManager::Stop(x3c_handle, fadeTime);
|
CMidiManager::Stop(x3c_handle, fadeTime);
|
||||||
x3c_handle.reset();
|
x3c_handle.reset();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CScriptMidi::Stop(CStateManager& mgr, float fadeTime) {
|
void CScriptMidi::Stop(CStateManager& mgr, float fadeTime) {
|
||||||
const CWorld* wld = mgr.GetWorld();
|
const CWorld* wld = mgr.GetWorld();
|
||||||
const CGameArea* area = wld->GetAreaAlways(x4_areaId);
|
const CGameArea* area = wld->GetAreaAlways(x4_areaId);
|
||||||
std::string twkName =
|
const std::string twkName =
|
||||||
CInGameTweakManagerBase::GetIdentifierForMidiEvent(wld->IGetWorldAssetId(), area->GetAreaAssetId(), x10_name);
|
CInGameTweakManagerBase::GetIdentifierForMidiEvent(wld->IGetWorldAssetId(), area->GetAreaAssetId(), x10_name);
|
||||||
if (g_TweakManager->HasTweakValue(twkName)) {
|
if (g_TweakManager->HasTweakValue(twkName)) {
|
||||||
const CTweakValue::Audio& audio = g_TweakManager->GetTweakValue(twkName)->GetAudio();
|
const CTweakValue::Audio& audio = g_TweakManager->GetTweakValue(twkName)->GetAudio();
|
||||||
|
@ -40,7 +42,7 @@ void CScriptMidi::Play(CStateManager& mgr, float fadeTime) {
|
||||||
u32 volume = x48_volume;
|
u32 volume = x48_volume;
|
||||||
const CWorld* wld = mgr.GetWorld();
|
const CWorld* wld = mgr.GetWorld();
|
||||||
const CGameArea* area = wld->GetAreaAlways(x4_areaId);
|
const CGameArea* area = wld->GetAreaAlways(x4_areaId);
|
||||||
std::string twkName =
|
const std::string twkName =
|
||||||
CInGameTweakManagerBase::GetIdentifierForMidiEvent(wld->IGetWorldAssetId(), area->GetAreaAssetId(), x10_name);
|
CInGameTweakManagerBase::GetIdentifierForMidiEvent(wld->IGetWorldAssetId(), area->GetAreaAssetId(), x10_name);
|
||||||
if (g_TweakManager->HasTweakValue(twkName)) {
|
if (g_TweakManager->HasTweakValue(twkName)) {
|
||||||
const CTweakValue::Audio& audio = g_TweakManager->GetTweakValue(twkName)->GetAudio();
|
const CTweakValue::Audio& audio = g_TweakManager->GetTweakValue(twkName)->GetAudio();
|
||||||
|
@ -58,12 +60,14 @@ void CScriptMidi::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId objId, CSt
|
||||||
CEntity::AcceptScriptMsg(msg, objId, stateMgr);
|
CEntity::AcceptScriptMsg(msg, objId, stateMgr);
|
||||||
switch (msg) {
|
switch (msg) {
|
||||||
case EScriptObjectMessage::Play:
|
case EScriptObjectMessage::Play:
|
||||||
if (GetActive())
|
if (GetActive()) {
|
||||||
Play(stateMgr, x40_fadeInTime);
|
Play(stateMgr, x40_fadeInTime);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case EScriptObjectMessage::Stop:
|
case EScriptObjectMessage::Stop:
|
||||||
if (GetActive())
|
if (GetActive()) {
|
||||||
Stop(stateMgr, x44_fadeOutTime);
|
Stop(stateMgr, x44_fadeOutTime);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case EScriptObjectMessage::Deactivate:
|
case EScriptObjectMessage::Deactivate:
|
||||||
StopInternal(0.f);
|
StopInternal(0.f);
|
||||||
|
|
Loading…
Reference in New Issue