I would like to submit the following patch for review. This features would allow modders to assign an alarm sound to be played when SSM strikes are being called, on a strike-type basis. The idea is to give the player an audio cue A) that a strike is inbound and B) what kind of strike is inbound.
It adds an optional "+Alarm Sound:" entry in ssm.tbl, which takes a sound index from the sound table.
Thoughts? Comments? Suggestions?
Attached files:
-the .patch file (identical to what's in code below)
-a small mod including table files and a simplistic test mission (using FS2 retail data)
-FSO & FRED builds
Index: hudartillery.cpp
===================================================================
--- hudartillery.cpp (revision 9788)
+++ hudartillery.cpp (working copy)
@@ -22,8 +22,9 @@
#include "globalincs/alphacolors.h"
#include "network/multi.h"
#include "hud/hudmessage.h"
+#include "sound/sound.h"
+#include "gamesnd/gamesnd.h"
-
// -----------------------------------------------------------------------------------------------------------------------
// ARTILLERY DEFINES/VARS
//
@@ -116,6 +117,10 @@
stuff_string(s->message, F_NAME, NAME_LENGTH);
s->use_custom_message = true;
}
+ if (optional_string("+Alarm Sound:"))
+ stuff_sound(&s->sound_index);
+ else
+ s->sound_index = -1;
// see if we have a valid weapon
s->weapon_info_index = -1;
@@ -239,6 +244,9 @@
else
HUD_printf(Ssm_info[ssm_index].message);
}
+ if (Ssm_info[ssm_index].sound_index >= 0) {
+ snd_play(&Snds[Ssm_info[ssm_index].sound_index]);
+ }
}
// delete a finished ssm effect
Index: hudartillery.h
===================================================================
--- hudartillery.h (revision 9788)
+++ hudartillery.h (working copy)
@@ -34,6 +34,7 @@
char message[NAME_LENGTH];
bool use_custom_message;
bool send_message;
+ int sound_index;
} ssm_info;
// creation info for the strike (useful for multiplayer)
EDIT - changed entry name from "+Custom Sound:" to "+Alarm Sound:"
EDIT 2 - patch committed, updated thread title