View Issue Details

IDProjectCategoryView StatusLast Update
0002452FSSCPsoundpublic2011-06-18 00:46
ReporterHalleck Assigned ToSushi_CW  
PrioritynormalSeverityfeatureReproducibilityalways
Status resolvedResolutionfixed 
Product Version3.6.13 
Summary0002452: Patch to add optional custom sounds for entering and exiting glide mode
DescriptionThis is a feature requested by Torc for Diaspora. Ability to swap out default throttle up/down sounds with custom sounds when entering and exiting glide mode. You can also make it have no sound by assigning a sound index set to "Empty".

These settings are optional; If not present, the default throttle up/down sounds will be used.

Settings are in ships.tbl, immediately after $EngineSnd. See below.

Patch is attached to ticket.
Additional Information$EngineSnd: 126 ;; Engine sound of ship
$GlideStartSnd: 49 ;;Override for sound to play at start of glide
$GlideEndSnd: 41 ;;Override for sound to play at start of glide
TagsNo tags attached.

Activities

2011-06-10 07:22

 

GlideSounds_v1.patch (3,179 bytes)   
Index: code/playerman/playercontrol.cpp
===================================================================
--- code/playerman/playercontrol.cpp    (revision 7237)
+++ code/playerman/playercontrol.cpp    (working copy)
@@ -771,7 +771,13 @@ void read_keyboard_controls( control_info * ci, float frame_time, physics_info *
 					savedspeed = ci->forward_cruise_percent;
 					ci->forward_cruise_percent = 0.0f;
 					override_analog_throttle = 1;
-					snd_play( &Snds[SND_THROTTLE_DOWN], 0.0f );
+					if (Ship_info[Player_ship->ship_info_index].glide_start_snd > 0) {
+						//If a custom glide start sound was specified, play it
+						snd_play( &Snds[Ship_info[Player_ship->ship_info_index].glide_start_snd], 0.0f );
+					} else {
+						//If glide_start_snd wasn't set (probably == 0), use the default throttle down sound
+						snd_play( &Snds[SND_THROTTLE_DOWN], 0.0f );
+					}
 				}
 			}
 		} else {
@@ -781,7 +787,13 @@ void read_keyboard_controls( control_info * ci, float frame_time, physics_info *
 				if ( object_get_gliding(Player_obj) && !object_glide_forced(Player_obj) ) {
 					object_set_gliding(Player_obj, false);
 					ci->forward_cruise_percent = savedspeed;
-					snd_play( &Snds[SND_THROTTLE_UP], 0.0f );
+					if (Ship_info[Player_ship->ship_info_index].glide_end_snd > 0) {
+						//If a custom glide end sound was specified, play it
+						snd_play( &Snds[Ship_info[Player_ship->ship_info_index].glide_end_snd], 0.0f );
+					} else {
+						//If glide_end_snd wasn't set (probably == 0), use the default throttle up sound
+						snd_play( &Snds[SND_THROTTLE_UP], 0.0f );
+					}
 				}
 			}
 		}
Index: code/ship/ship.cpp
===================================================================
--- code/ship/ship.cpp    (revision 7237)
+++ code/ship/ship.cpp    (working copy)
@@ -2632,6 +2632,12 @@ strcpy_s(parse_error_text, temp_error);
 	//Parse the engine sound
 	parse_sound("$EngineSnd:", &sip->engine_snd, sip->name);
 
+	//Parse optional sound to be used for beginning of a glide
+	parse_sound("$GlideStartSnd:", &sip->glide_start_snd, sip->name);
+
+	//Parse optional sound to be used for end of a glide
+	parse_sound("$GlideEndSnd:", &sip->glide_end_snd, sip->name);
+
 	if(optional_string("$Closeup_pos:"))
 	{
 		stuff_vector(&sip->closeup_pos);
Index: code/ship/ship.h
===================================================================
--- code/ship/ship.h    (revision 7237)
+++ code/ship/ship.h    (working copy)
@@ -1252,6 +1252,8 @@ typedef struct ship_info {
 	float	sup_subsys_repair_rate;
 
 	int engine_snd;							// handle to engine sound for ship (-1 if no engine sound)
+	int glide_start_snd;					// handle to sound to play at the beginning of a glide maneuver (default is 0 for regular throttle down sound)
+	int glide_end_snd;						// handle to sound to play at the end of a glide maneuver (default is 0 for regular throttle up sound)
 
 	vec3d	closeup_pos;					// position for camera when using ship in closeup view (eg briefing and hud target monitor)
 	float		closeup_zoom;					// zoom when using ship in closeup view (eg briefing and hud target monitor)
GlideSounds_v1.patch (3,179 bytes)   

Sushi_CW

2011-06-10 14:15

developer   ~0012709

Patch looks good to me, although I haven't had a chance to test it.

Sushi_CW

2011-06-18 00:46

developer   ~0012715

Committed 7255

Issue History

Date Modified Username Field Change
2011-06-10 07:22 Halleck New Issue
2011-06-10 07:22 Halleck File Added: GlideSounds_v1.patch
2011-06-10 14:15 Sushi_CW Note Added: 0012709
2011-06-18 00:46 Sushi_CW Note Added: 0012715
2011-06-18 00:46 Sushi_CW Status new => resolved
2011-06-18 00:46 Sushi_CW Resolution open => fixed
2011-06-18 00:46 Sushi_CW Assigned To => Sushi_CW