diff --git a/ChaosMod/ChaosMod.vcxproj b/ChaosMod/ChaosMod.vcxproj index c6cc7cdf9..b83c7c830 100644 --- a/ChaosMod/ChaosMod.vcxproj +++ b/ChaosMod/ChaosMod.vcxproj @@ -155,6 +155,7 @@ + diff --git a/ChaosMod/Effects/db/Player/PlayerMobileRadio.cpp b/ChaosMod/Effects/db/Player/PlayerMobileRadio.cpp new file mode 100644 index 000000000..4e73c631b --- /dev/null +++ b/ChaosMod/Effects/db/Player/PlayerMobileRadio.cpp @@ -0,0 +1,33 @@ +#include + +static void OnStart() +{ + SET_RADIO_TO_STATION_INDEX(g_Random.GetRandomInt(0, 18)); +} + +static void OnStop() +{ + ENABLE_CONTROL_ACTION(2, 85, true); + + SET_MOBILE_PHONE_RADIO_STATE(false); + SET_AUDIO_FLAG("MobileRadioInGame", false); + SET_AUDIO_FLAG("AllowRadioDuringSwitch", false); +} + +static void OnTick() +{ + DISABLE_CONTROL_ACTION(2, 85, true); + + SET_MOBILE_PHONE_RADIO_STATE(true); + SET_AUDIO_FLAG("MobileRadioInGame", true); + SET_AUDIO_FLAG("AllowRadioDuringSwitch", true); +} + +// clang-format off +REGISTER_EFFECT(OnStart, OnStop, OnTick, EffectInfo + { + .Name = "Satellite Radio", + .Id = "mobile_radio", + .IsTimed = true + } +); \ No newline at end of file diff --git a/ConfigApp/Effects.cs b/ConfigApp/Effects.cs index e045e76e7..d362bacca 100644 --- a/ConfigApp/Effects.cs +++ b/ConfigApp/Effects.cs @@ -372,6 +372,7 @@ public enum EffectTimedType { "screen_colorfulworld", new EffectInfo("Colorful World", EffectCategory.Screen, true) }, { "screen_arc", new EffectInfo("Arced Screen", EffectCategory.Screen, true, true) }, { "world_blackhole", new EffectInfo("Black Hole", EffectCategory.Misc, true, true) }, + { "mobile_radio", new EffectInfo("Satellite Radio", EffectCategory.Player, true) }, }; } }