Skip to content

Commit

Permalink
Add sound support for clear, cloudy and sunny weather (CleverRaven#53389
Browse files Browse the repository at this point in the history
)

* Add sound support for clear, cloudy and sunny weather

* add missing sound channels
  • Loading branch information
Fris0uman authored Jan 2, 2022
1 parent b49f934 commit acacbb1
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 2 deletions.
1 change: 1 addition & 0 deletions data/core/weather.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"precip": "none",
"rains": false,
"acidic": false,
"sound_category": "clear",
"sun_intensity": "normal"
},
{
Expand Down
2 changes: 2 additions & 0 deletions data/json/weather_type.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"rains": false,
"acidic": false,
"sun_intensity": "high",
"sound_category": "sunny",
"condition": {
"and": [
"is_day",
Expand All @@ -38,6 +39,7 @@
"precip": "none",
"rains": false,
"acidic": false,
"sound_category": "cloudy",
"sun_intensity": "light",
"condition": {
"and": [
Expand Down
2 changes: 1 addition & 1 deletion doc/SOUNDPACKS.md
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ Divided by sections for clarity.
* `environment thunder_near|thunder_far`
* `environment daytime|nighttime`
* `environment indoors|indoors_rain|underground`
* `environment <weather_type>` # examples: `WEATHER_DRIZZLE|WEATHER_RAINY|WEATHER_THUNDER|WEATHER_FLURRIES|WEATHER_SNOW|WEATHER_SNOWSTORM`
* `environment <weather_type>` # examples: `WEATHER_DRIZZLE|WEATHER_RAINY|WEATHER_THUNDER|WEATHER_FLURRIES|WEATHER_SNOW|WEATHER_SNOWSTORM|WEATHER_CLEAR|WEATHER_SUNNY|WEATHER_CLOUDY`
* `environment alarm|church_bells|police_siren`
* `environment deafness_shock|deafness_tone_start|deafness_tone_light|deafness_tone_medium|deafness_tone_heavy`

Expand Down
17 changes: 16 additions & 1 deletion src/sounds.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1115,7 +1115,10 @@ void sfx::do_ambient()
!is_channel_playing( channel::outdoors_thunderstorm_env ) &&
!is_channel_playing( channel::outdoors_rain_env ) &&
!is_channel_playing( channel::outdoors_drizzle_env ) &&
!is_channel_playing( channel::outdoor_blizzard ) )
!is_channel_playing( channel::outdoor_blizzard ) &&
!is_channel_playing( channel::outdoors_clear_env ) &&
!is_channel_playing( channel::outdoors_sunny_env ) &&
!is_channel_playing( channel::outdoors_cloudy_env ) )
|| ( !is_sheltered &&
weather_changed && !is_deaf ) ) {
fade_audio_group( group::weather, 1000 );
Expand Down Expand Up @@ -1151,6 +1154,18 @@ void sfx::do_ambient()
play_ambient_variant_sound( "environment", "WEATHER_PORTAL_STORM", seas_str, heard_volume,
channel::outdoors_portal_storm_env, 1000 );
break;
case weather_sound_category::clear:
play_ambient_variant_sound( "environment", "WEATHER_CLEAR", seas_str, heard_volume,
channel::outdoors_clear_env, 1000 );
break;
case weather_sound_category::sunny:
play_ambient_variant_sound( "environment", "WEATHER_SUNNY", seas_str, heard_volume,
channel::outdoors_sunny_env, 1000 );
break;
case weather_sound_category::cloudy:
play_ambient_variant_sound( "environment", "WEATHER_CLOUDY", seas_str, heard_volume,
channel::outdoors_cloudy_env, 1000 );
break;
case weather_sound_category::last:
debugmsg( "Invalid weather sound category." );
break;
Expand Down
3 changes: 3 additions & 0 deletions src/sounds.h
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,9 @@ enum class channel : int {
interior_engine_sound,
radio,
outdoors_portal_storm_env,
outdoors_clear_env,
outdoors_cloudy_env,
outdoors_sunny_env,
MAX_CHANNEL //the last reserved channel
};

Expand Down
6 changes: 6 additions & 0 deletions src/weather_type.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,12 @@ std::string enum_to_string<weather_sound_category>( weather_sound_category data
return "silent";
case weather_sound_category::portal_storm:
return "portal_storm";
case weather_sound_category::clear:
return "clear";
case weather_sound_category::sunny:
return "sunny";
case weather_sound_category::cloudy:
return "cloudy";
case weather_sound_category::last:
break;
}
Expand Down
3 changes: 3 additions & 0 deletions src/weather_type.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@ enum weather_sound_category : int {
snowstorm,
snow,
portal_storm,
clear,
sunny,
cloudy,
last
};

Expand Down

0 comments on commit acacbb1

Please sign in to comment.