CnC_Remastered_Collection

Command and Conquer: Red Alert
Log | Files | Refs | README | LICENSE

AUDIO.CPP (43498B)


      1 //
      2 // Copyright 2020 Electronic Arts Inc.
      3 //
      4 // TiberianDawn.DLL and RedAlert.dll and corresponding source code is free 
      5 // software: you can redistribute it and/or modify it under the terms of 
      6 // the GNU General Public License as published by the Free Software Foundation, 
      7 // either version 3 of the License, or (at your option) any later version.
      8 
      9 // TiberianDawn.DLL and RedAlert.dll and corresponding source code is distributed 
     10 // in the hope that it will be useful, but with permitted additional restrictions 
     11 // under Section 7 of the GPL. See the GNU General Public License in LICENSE.TXT 
     12 // distributed with this program. You should have received a copy of the 
     13 // GNU General Public License along with permitted additional restrictions 
     14 // with this program. If not, see https://github.com/electronicarts/CnC_Remastered_Collection
     15 
     16 /* $Header: /CounterStrike/AUDIO.CPP 1     3/03/97 10:24a Joe_bostic $ */
     17 /***********************************************************************************************
     18  ***              C O N F I D E N T I A L  ---  W E S T W O O D  S T U D I O S               ***
     19  ***********************************************************************************************
     20  *                                                                                             *
     21  *                 Project Name : Command & Conquer                                            *
     22  *                                                                                             *
     23  *                    File Name : AUDIO.CPP                                                    *
     24  *                                                                                             *
     25  *                   Programmer : Joe L. Bostic                                                *
     26  *                                                                                             *
     27  *                   Start Date : September 10, 1993                                           *
     28  *                                                                                             *
     29  *                  Last Update : November 1, 1996 [JLB]                                       *
     30  *                                                                                             *
     31  *---------------------------------------------------------------------------------------------*
     32  * Functions:                                                                                  *
     33  *   Is_Speaking -- Checks to see if the eva voice is still playing.                           *
     34  *   Sound_Effect -- General purpose sound player.                                             *
     35  *   Sound_Effect -- Plays a sound effect in the tactical map.                                 *
     36  *   Speak -- Computer speaks to the player.                                                   *
     37  *   Speak_AI -- Handles starting the EVA voices.                                              *
     38  *   Speech_Name -- Fetches the name for the voice specified.                                  *
     39  *   Stop_Speaking -- Forces the EVA voice to stop talking.                                    *
     40  *   Voc_From_Name -- Fetch VocType from ASCII name specified.                                 *
     41  *   Voc_Name -- Fetches the name for the sound effect.                                        *
     42  * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
     43 
     44 #include	"function.h"
     45  /*
     46  **
     47  **
     48  ** Win32lib stubs
     49  **
     50  **
     51  **
     52  */
     53 
     54 
     55 SFX_Type					SoundType;
     56 Sample_Type				SampleType;
     57 
     58 int File_Stream_Sample(char const *filename, BOOL real_time_start) { return 1; };
     59 int File_Stream_Sample_Vol(char const *filename, int volume, BOOL real_time_start) { return 1; };
     60 void __cdecl Sound_Callback(void) {};
     61 void __cdecl far maintenance_callback(void) {};
     62 void *Load_Sample(char const *filename) { return NULL; };
     63 long Load_Sample_Into_Buffer(char const *filename, void *buffer, long size) { return 0; }
     64 long Sample_Read(int fh, void *buffer, long size) { return 0; };
     65 void Free_Sample(void const *sample) {};
     66 BOOL Audio_Init(HWND window, int bits_per_sample, BOOL stereo, int rate, int reverse_channels) { return 0; };
     67 void Sound_End(void) {};
     68 void Stop_Sample(int handle) {};
     69 BOOL Sample_Status(int handle) { return 0; };
     70 BOOL Is_Sample_Playing(void const * sample) { return 0; };
     71 void Stop_Sample_Playing(void const * sample) {};
     72 int Play_Sample(void const *sample, int priority, int volume, signed short panloc) { return 1; };
     73 int Play_Sample_Handle(void const *sample, int priority, int volume, signed short panloc, int id) { return 1; };
     74 int Set_Sound_Vol(int volume) { return 0; };
     75 int Set_Score_Vol(int volume) { return 0; };
     76 void Fade_Sample(int handle, int ticks) {};
     77 int Get_Free_Sample_Handle(int priority) { return 1; };
     78 int Get_Digi_Handle(void) { return 1; }
     79 long Sample_Length(void const *sample) { return 0; };
     80 void Restore_Sound_Buffers(void) {};
     81 BOOL Set_Primary_Buffer_Format(void) { return 0; };
     82 BOOL Start_Primary_Sound_Buffer(BOOL forced) { return 0; };
     83 void Stop_Primary_Sound_Buffer(void) {};
     84 
     85 
     86 /***************************************************************************
     87 **	Controls what special effects may occur on the sound effect.
     88 */
     89 typedef enum {
     90 	IN_NOVAR,			// No variation or alterations allowed.
     91 	IN_VAR				// Infantry variance response modification.
     92 } ContextType;
     93 
     94 // static struct { // MBL 02.21.2019
     95 // Had to name the struct for VS 2017 distributed build. ST - 4/10/2019 3:59PM
     96 struct SoundEffectNameStruct {
     97 	char const *	Name;		// Digitized voice file name.
     98 	int				Priority;	// Playback priority of this sample.
     99 	ContextType		Where;		// In what game context does this sample exist.
    100 } SoundEffectName[VOC_COUNT] = {
    101 
    102 	/*
    103 	**	Civilian voices (technicians too).
    104 	*/
    105 	{"GIRLOKAY",	20,	IN_NOVAR},		//	VOC_GIRL_OKAY
    106 	{"GIRLYEAH",	20,	IN_NOVAR},		//	VOC_GIRL_YEAH
    107 	{"GUYOKAY1",	20,	IN_NOVAR},		//	VOC_GUY_OKAY
    108 	{"GUYYEAH1",	20,	IN_NOVAR},		//	VOC_GUY_YEAH
    109 
    110 	{"MINELAY1",	5,		IN_VAR},			// VOC_MINELAY1
    111 
    112 	/*
    113 	**	Infantry and vehicle responses.
    114 	*/
    115 	{"ACKNO",		20,	IN_VAR},	//	VOC_ACKNOWL			"acknowledged"
    116 	{"AFFIRM1",		20,	IN_VAR},	//	VOC_AFFIRM			"affirmative"
    117 	{"AWAIT1",		20,	IN_VAR},	//	VOC_AWAIT1			"awaiting orders"
    118 	{"EAFFIRM1",	20,	IN_NOVAR},	// VOC_ENG_AFFIRM	Engineer: "affirmative"
    119 	{"EENGIN1",		20,	IN_NOVAR},	//	VOC_ENG_ENG			Engineer: "engineering"
    120 	{"NOPROB",		20,	IN_VAR},	// VOC_NO_PROB			"not a problem"
    121 	{"READY",		20,	IN_VAR},	// VOC_READY			"ready and waiting"
    122 	{"REPORT1",		20,	IN_VAR},	//	VOC_REPORT			"reporting"
    123 	{"RITAWAY",		20,	IN_VAR},	// VOC_RIGHT_AWAY		"right away sir"
    124 	{"ROGER",		20,	IN_VAR},	// VOC_ROGER			"roger"
    125 	{"UGOTIT",		20,	IN_VAR},	// VOC_UGOTIT			"you got it"
    126 	{"VEHIC1",		20,	IN_VAR},	//	VOC_VEHIC1			"vehicle reporting"
    127 	{"YESSIR1",		20,	IN_VAR},	//	VOC_YESSIR			"yes sir"
    128 
    129 	{"DEDMAN1", 	10,	IN_NOVAR},	// VOC_SCREAM1			short infantry scream
    130 	{"DEDMAN2", 	10,	IN_NOVAR},	// VOC_SCREAM3			short infantry scream
    131 	{"DEDMAN3", 	10,	IN_NOVAR},	// VOC_SCREAM4			short infantry scream
    132 	{"DEDMAN4", 	10,	IN_NOVAR},	// VOC_SCREAM5			short infantry scream
    133 	{"DEDMAN5", 	10,	IN_NOVAR},	// VOC_SCREAM6			short infantry scream
    134 	{"DEDMAN6", 	10,	IN_NOVAR},	// VOC_SCREAM7			short infantry scream
    135 	{"DEDMAN7", 	10,	IN_NOVAR},	// VOC_SCREAM10		short infantry scream
    136 	{"DEDMAN8", 	10,	IN_NOVAR},	// VOC_SCREAM11		short infantry scream
    137 	{"DEDMAN10", 	10,	IN_NOVAR},	// VOC_YELL1			long infantry scream
    138 
    139 	{"CHRONO2",		5,		IN_NOVAR},	//	VOC_CHRONO			Chronosphere sound
    140 	{"CANNON1",		1,		IN_NOVAR},	//	VOC_CANNON1			Cannon sound (medium).
    141 	{"CANNON2",		1,		IN_NOVAR},	//	VOC_CANNON2			Cannon sound (short).
    142 	{"IRONCUR9",	10,	IN_NOVAR},	// VOC_IRON1
    143 	{"EMOVOUT1",	20,	IN_NOVAR},	//	VOC_ENG_MOVEOUT	Engineer: "movin' out"
    144 	{"SONPULSE",	10,	IN_NOVAR},	//	VOC_SONAR
    145 	{"SANDBAG2",	5,		IN_NOVAR},	// VOC_SANDBAG			sand bag crunch
    146 	{"MINEBLO1",	5,		IN_NOVAR},	// VOC_MINEBLOW		weird mine explosion
    147 	{"CHUTE1",		1,		IN_NOVAR},	//	VOC_CHUTE1			Wind swoosh sound.
    148 	{"DOGY1",		5,		IN_NOVAR},	//	VOC_DOG_BARK		Dog bark.
    149 	{"DOGW5",		10,	IN_NOVAR},	//	VOC_DOG_WHINE		Dog whine.
    150 	{"DOGG5P",		10,	IN_NOVAR},	//	VOC_DOG_GROWL2		Strong dog growl.
    151 	{"FIREBL3",		1,		IN_NOVAR},	//	VOC_FIRE_LAUNCH	Fireball launch sound.
    152 	{"FIRETRT1",	1,		IN_NOVAR},	//	VOC_FIRE_EXPLODE	Fireball explode sound.
    153 	{"GRENADE1",	1,		IN_NOVAR},	//	VOC_GRENADE_TOSS	Grenade toss.
    154 	{"GUN11",		1,		IN_NOVAR},	//	VOC_GUN_5			5 round gun burst (slow).
    155 	{"GUN13",		1,		IN_NOVAR},	//	VOC_GUN_7			7 round gun burst (fast).
    156 	{"EYESSIR1",	20,	IN_NOVAR},	//	VOC_ENG_YES,		Engineer: "yes sir"
    157 	{"GUN27",		1,		IN_NOVAR},	//	VOC_GUN_RIFLE		Rifle shot.
    158 	{"HEAL2",		1,		IN_NOVAR},	//	VOC_HEAL				Healing effect.
    159 	{"HYDROD1",		1,		IN_NOVAR},	//	VOC_DOOR				Hyrdrolic door.
    160 	{"INVUL2",		1,		IN_NOVAR},	//	VOC_INVULNERABLE	Invulnerability effect.
    161 	{"KABOOM1",		1,		IN_NOVAR},	//	VOC_KABOOM1			Long explosion (muffled).
    162 	{"KABOOM12",	1,		IN_NOVAR},	//	VOC_KABOOM12		Very long explosion (muffled).
    163 	{"KABOOM15",	1,		IN_NOVAR},	//	VOC_KABOOM15		Very long explosion (muffled).
    164 	{"SPLASH9",		5,		IN_NOVAR},	// VOC_SPLASH			water splash
    165 	{"KABOOM22",	1,		IN_NOVAR},	//	VOC_KABOOM22		Long explosion (sharp).
    166 	{"AACANON3",	1,		IN_NOVAR},
    167 	{"TANDETH1",	10,	IN_NOVAR},
    168 	{"MGUNINF1",	1,		IN_NOVAR},	//	VOC_GUN_5F			5 round gun burst (fast).
    169 	{"MISSILE1",	1,		IN_NOVAR},	//	VOC_MISSILE_1		Missile with high tech effect.
    170 	{"MISSILE6",	1,		IN_NOVAR},	//	VOC_MISSILE_2		Long missile launch.
    171 	{"MISSILE7",	1,		IN_NOVAR},	//	VOC_MISSILE_3		Short missile launch.
    172 	{"x",				1,		IN_NOVAR},
    173 	{"PILLBOX1",	1,		IN_NOVAR},	//	VOC_GUN_5R			5 round gun burst (rattles).
    174 	{"RABEEP1",		1,		IN_NOVAR},	//	VOC_BEEP				Generic beep sound.
    175 	{"RAMENU1",		1,		IN_NOVAR},	//	VOC_CLICK			Generic click sound.
    176 	{"SILENCER",	1,		IN_NOVAR},	//	VOC_SILENCER		Silencer.
    177 	{"TANK5",		1,		IN_NOVAR},	//	VOC_CANNON6			Long muffled cannon shot.
    178 	{"TANK6",		1,		IN_NOVAR},	//	VOC_CANNON7			Sharp mechanical cannon fire.
    179 	{"TORPEDO1",	1,		IN_NOVAR},	//	VOC_TORPEDO			Torpedo launch.
    180 	{"TURRET1",		1,		IN_NOVAR},	//	VOC_CANNON8			Sharp cannon fire.
    181 	{"TSLACHG2",	10,	IN_NOVAR},	//	VOC_TESLA_POWER_UP	Hum charge up.
    182 	{"TESLA1",		10,	IN_NOVAR},	//	VOC_TESLA_ZAP		Tesla zap effect.
    183 	{"SQUISHY2",	10,	IN_NOVAR},	//	VOC_SQUISH			Squish effect.
    184 	{"SCOLDY1",		10,	IN_NOVAR},	//	VOC_SCOLD			Scold bleep.
    185 	{"RADARON2",	20,	IN_NOVAR},	//	VOC_RADAR_ON		Powering up electronics.
    186 	{"RADARDN1",	10,	IN_NOVAR},	//	VOC_RADAR_OFF		B movie power down effect.
    187 	{"PLACBLDG",	10,	IN_NOVAR},	//	VOC_PLACE_BUILDING_DOWN	Building slam down sound.
    188 	{"KABOOM30",	1,		IN_NOVAR},	//	VOC_KABOOM30		Short explosion (HE).
    189 	{"KABOOM25",	10,	IN_NOVAR},	//	VOC_KABOOM25		Short growling explosion.
    190 	{"x",				10,	IN_NOVAR},
    191 	{"DOGW7",		10,	IN_NOVAR},	//	VOC_DOG_HURT		Dog whine (loud).
    192 	{"DOGW3PX",		10,	IN_NOVAR},	//	VOC_DOG_YES			Dog 'yes sir'.
    193 	{"CRMBLE2",		10,	IN_NOVAR},	//	VOC_CRUMBLE			Building crumble.
    194 	{"CASHUP1",		10,	IN_NOVAR},	//	VOC_MONEY_UP		Rising money tick.
    195 	{"CASHDN1",		10,	IN_NOVAR},	//	VOC_MONEY_DOWN		Falling money tick.
    196 	{"BUILD5",		10,	IN_NOVAR},	//	VOC_CONSTRUCTION	Building construction sound.
    197 	{"BLEEP9",		10,	IN_NOVAR},	//	VOC_GAME_CLOSED	Long bleep.
    198 	{"BLEEP6",		10,	IN_NOVAR},	//	VOC_INCOMING_MESSAGE	Soft happy warble.
    199 	{"BLEEP5",		10,	IN_NOVAR},	//	VOC_SYS_ERROR		Sharp soft warble.
    200 	{"BLEEP17",		10,	IN_NOVAR},	//	VOC_OPTIONS_CHANGED	Mid range soft warble.
    201 	{"BLEEP13",		10,	IN_NOVAR},	//	VOC_GAME_FORMING	Long warble.
    202 	{"BLEEP12",		10,	IN_NOVAR},	//	VOC_PLAYER_LEFT	Chirp sequence.
    203 	{"BLEEP11",		10,	IN_NOVAR},	//	VOC_PLAYER_JOINED	Reverse chirp sequence.
    204 	{"H2OBOMB2",	10,	IN_NOVAR},	//	VOC_DEPTH_CHARGE	Distant explosion sound.
    205 	{"CASHTURN",	10,	IN_NOVAR},	//	VOC_CASHTURN		Airbrake.
    206 	{"TUFFGUY1",	20,	IN_NOVAR},	//	VOC_TANYA_CHEW			Tanya: "Chew on this"
    207 	{"ROKROLL1",	20,	IN_NOVAR},	//	VOC_TANYA_ROCK			Tanya: "Let's rock"
    208 	{"LAUGH1",		20,	IN_NOVAR},	//	VOC_TANYA_LAUGH		Tanya: "ha ha ha"
    209 	{"CMON1",		20,	IN_NOVAR},	//	VOC_TANYA_SHAKE		Tanya: "Shake it baby"
    210 	{"BOMBIT1",		20,	IN_NOVAR},	//	VOC_TANYA_CHING		Tanya: "Cha Ching"
    211 	{"GOTIT1",		20,	IN_NOVAR},	//	VOC_TANYA_GOT			Tanya: "That's all you got"
    212 	{"KEEPEM1",		20,	IN_NOVAR},	//	VOC_TANYA_KISS			Tanya: "Kiss it bye bye"
    213 	{"ONIT1",		20,	IN_NOVAR},	//	VOC_TANYA_THERE		Tanya: "I'm there"
    214 	{"LEFTY1",		20,	IN_NOVAR},	//	VOC_TANYA_GIVE			Tanya: "Give it to me"
    215 	{"YEAH1",		20,	IN_NOVAR},	//	VOC_TANYA_YEA			Tanya: "Yea?"
    216 	{"YES1",			20,	IN_NOVAR},	//	VOC_TANYA_YES			Tanya: "Yes sir?"
    217 	{"YO1",			20,	IN_NOVAR},	//	VOC_TANYA_WHATS		Tanya: "What's up."
    218 	{"WALLKIL2",	5,		IN_NOVAR},	//	VOC_WALLKILL2			Crushing wall sound.
    219 	{"x",				10,	IN_NOVAR},
    220 	{"GUN5",			5,		IN_NOVAR},	//	VOC_TRIPLE_SHOT		Three quick shots in succession.
    221 	{"SUBSHOW1",	5,		IN_NOVAR},	//	VOC_SUBSHOW				Submarine surface sound.
    222 	{"EINAH1",		20,	IN_NOVAR},	//	VOC_E_AH,				Einstien "ah"
    223 	{"EINOK1",		20,	IN_NOVAR},	//	VOC_E_OK,				Einstien "ok"
    224 	{"EINYES1",		20,	IN_NOVAR},	//	VOC_E_YES,				Einstien "yes"
    225 	{"MINE1",		10,	IN_NOVAR},	//	VOC_TRIP_MINE			mine explosion sound
    226 
    227 	{"SCOMND1",		20,	IN_NOVAR},	//	VOC_SPY_COMMANDER		Spy: "commander?"
    228 	{"SYESSIR1",	20,	IN_NOVAR},	//	VOC_SPY_YESSIR			Spy: "yes sir"
    229 	{"SINDEED1",	20,	IN_NOVAR},	//	VOC_SPY_INDEED			Spy: "indeed"
    230 	{"SONWAY1",		20,	IN_NOVAR},	//	VOC_SPY_ONWAY			Spy: "on my way"
    231 	{"SKING1",		20,	IN_NOVAR},	//	VOC_SPY_KING			Spy: "for king and country"
    232 	{"MRESPON1",	20,	IN_NOVAR},	//	VOC_MED_REPORTING		Medic: "reporting"
    233 	{"MYESSIR1",	20,	IN_NOVAR},	//	VOC_MED_YESSIR			Medic: "yes sir"
    234 	{"MAFFIRM1",	20,	IN_NOVAR},	//	VOC_MED_AFFIRM			Medic: "affirmative"
    235 	{"MMOVOUT1",	20,	IN_NOVAR},	//	VOC_MED_MOVEOUT		Medic: "movin' out"
    236 	{"BEEPSLCT",	10,	IN_NOVAR},	//	VOC_BEEP_SELECT		map selection beep
    237 
    238 	{"SYEAH1",		20,	IN_NOVAR},	//	VOC_THIEF_YEA			Thief: "yea?"
    239 	{"ANTDIE",		20,	IN_NOVAR},	//	VOC_ANTDIE
    240 	{"ANTBITE",		20,	IN_NOVAR},	//	VOC_ANTBITE
    241 	{"SMOUT1",		20,	IN_NOVAR},	//	VOC_THIEF_MOVEOUT		Thief: "movin' out"
    242 	{"SOKAY1",		20,	IN_NOVAR},	//	VOC_THIEF_OKAY			Thief: "ok"
    243 	{"x",				20,	IN_NOVAR},
    244 	{"SWHAT1",		20,	IN_NOVAR},	//	VOC_THIEF_WHAT			Thief: "what"
    245 	{"SAFFIRM1",	20,	IN_NOVAR},	//	VOC_THIEF_AFFIRM		Thief: "affirmative"
    246 //ADDED VG 2/24/97
    247 	{"STAVCMDR",	20,	IN_NOVAR},	
    248 	{"STAVCRSE",	20,	IN_NOVAR},	
    249 	{"STAVYES",		20,	IN_NOVAR},	
    250 	{"STAVMOV",		20,	IN_NOVAR},	
    251 	{"BUZZY1",		20,	IN_NOVAR},	
    252 	{"RAMBO1",     20,   IN_NOVAR},			
    253 	{"RAMBO2", 		20,   IN_NOVAR}, 
    254 	{"RAMBO3",     20,   IN_NOVAR},
    255 #ifdef FIXIT_CSII	//	checked - ajw 9/28/98
    256 	{"MYES1",		20,	IN_NOVAR},	// VOC_MECHYES1			Mechanic: "Yes sir!"
    257 	{"MHOWDY1",		20,	IN_NOVAR},	// VOC_MECHHOWDY1			Mechanic: "Howdy!"
    258 	{"MRISE1",		20,	IN_NOVAR},	// VOC_MECHRISE1			Mechanic: "Rise 'n shine!"
    259 	{"MHUH1",		20,	IN_NOVAR},	// VOC_MECHHUH1			Mechanic: "Huh?"
    260 	{"MHEAR1",		20,	IN_NOVAR},	// VOC_MECHHEAR1			Mechanic: "I Hear Ya!"
    261 	{"MLAFF1",		20,	IN_NOVAR},	// VOC_MECHLAFF1			Mechanic: guffaw
    262 	{"MBOSS1",		20,	IN_NOVAR},	// VOC_MECHBOSS1			Mechanic: "Sure Thing, Boss!"
    263 	{"MYEEHAW1",	20,	IN_NOVAR},	// VOC_MECHYEEHAW1		Mechanic: "Yee Haw!"
    264 	{"MHOTDIG1",	20,	IN_NOVAR},	// VOC_MECHHOTDIG1		Mechanic: "Hot Diggity Dog!"
    265 	{"MWRENCH1",	20,	IN_NOVAR},	// VOC_MECHWRENCH1		Mechanic: "I'll get my wrench."
    266 
    267 	{"JBURN1",		20,	IN_NOVAR},	//	VOC_STBURN1				Shock Trooper: "Burn baby burn!"
    268 	{"JCHRGE1",		20,	IN_NOVAR},	//	VOC_STCHRGE1			Shock Trooper: "Fully charged!"
    269 	{"JCRISP1",		20,	IN_NOVAR},	//	VOC_STCRISP1			Shock Trooper: "Extra Crispy!"
    270 	{"JDANCE1",		20,	IN_NOVAR},	//	VOC_STDANCE1			Shock Trooper: "Let's Dance!"
    271 	{"JJUICE1",		20,	IN_NOVAR},	//	VOC_STJUICE1			Shock Trooper: "Got juice?"
    272 	{"JJUMP1",		20,	IN_NOVAR},	//	VOC_STJUMP1				Shock Trooper: "Need a jump?"
    273 	{"JLIGHT1",		20,	IN_NOVAR},	//	VOC_STLIGHT1			Shock Trooper: "Lights out!"
    274 	{"JPOWER1",		20,	IN_NOVAR},	//	VOC_STPOWER1			Shock Trooper: "Power on!"
    275 	{"JSHOCK1",		20,	IN_NOVAR},	//	VOC_STSHOCK1			Shock Trooper: "Shocking!"
    276 	{"JYES1",		20,	IN_NOVAR},	//	VOC_STYES1				Shock Trooper: "Yesssss!"
    277 
    278 	{"CHROTNK1",	20,	IN_NOVAR},	// VOC_CHRONOTANK1		Chrono tank teleport
    279 	{"FIXIT1",		20,	IN_NOVAR},	// VOC_MECH_FIXIT1		Mechanic fixes something
    280 	{"MADCHRG2",	20,	IN_NOVAR},	// VOC_MAD_CHARGE			MAD tank charges up
    281 	{"MADEXPLO",	20,	IN_NOVAR},	// VOC_MAD_EXPLODE		MAD tank explodes
    282 	{"SHKTROP1",	20,	IN_NOVAR},	// VOC_SHOCK_TROOP1		Shock Trooper fires
    283 
    284 	{"BEACON", 		10,	IN_NOVAR},	// VOC_BEACON			Beacon sound.
    285 
    286 #endif
    287 };
    288 
    289 
    290 //
    291 // External handlers. MBL 06.17.2019
    292 //
    293 extern void On_Sound_Effect(int sound_index, int variation, COORDINATE coord, int house);
    294 // extern void On_Speech(int speech_index); MBL 02.06.2020
    295 extern void On_Speech(int speech_index, HouseClass *house);
    296 extern void On_Ping(const HouseClass* player_ptr, COORDINATE coord);
    297 
    298 
    299 
    300 /***********************************************************************************************
    301  * Voc_From_Name -- Fetch VocType from ASCII name specified.                                   *
    302  *                                                                                             *
    303  *    This will find the corresponding VocType from the ASCII string specified. It does this   *
    304  *    by finding a root filename that matches the string.                                      *
    305  *                                                                                             *
    306  * INPUT:   name  -- Pointer to the ASCII string that will be converted into a VocType.        *
    307  *                                                                                             *
    308  * OUTPUT:  Returns with the VocType that matches the string specified. If no match could be   *
    309  *          found, then VOC_NONE is returned.                                                  *
    310  *                                                                                             *
    311  * WARNINGS:   none                                                                            *
    312  *                                                                                             *
    313  * HISTORY:                                                                                    *
    314  *   07/06/1996 JLB : Created.                                                                 *
    315  *=============================================================================================*/
    316 VocType Voc_From_Name(char const * name)
    317 {
    318 	if (name == NULL) return(VOC_NONE);
    319 
    320 	for (VocType voc = VOC_FIRST; voc < VOC_COUNT; voc++) {
    321 		if (stricmp(name, SoundEffectName[voc].Name) == 0) {
    322 			return(voc);
    323 		}
    324 	}
    325 
    326 	return(VOC_NONE);
    327 }
    328 
    329 
    330 /***********************************************************************************************
    331  * Voc_Name -- Fetches the name for the sound effect.                                          *
    332  *                                                                                             *
    333  *    This routine returns the descriptive name of the sound effect. Currently, this is just   *
    334  *    the root of the file name.                                                               *
    335  *                                                                                             *
    336  * INPUT:   voc   -- The VocType that the corresponding name is requested.                     *
    337  *                                                                                             *
    338  * OUTPUT:  Returns with a pointer to the text string the represents the sound effect.         *
    339  *                                                                                             *
    340  * WARNINGS:   none                                                                            *
    341  *                                                                                             *
    342  * HISTORY:                                                                                    *
    343  *   05/06/1996 JLB : Created.                                                                 *
    344  *=============================================================================================*/
    345 char const * Voc_Name(VocType voc)
    346 {
    347 	if (voc == VOC_NONE) return("none");
    348 	return(SoundEffectName[voc].Name);
    349 }
    350 
    351 
    352 /***********************************************************************************************
    353  * Sound_Effect -- Plays a sound effect in the tactical map.                                   *
    354  *                                                                                             *
    355  *    This routine is used when a sound effect occurs in the game world. It handles fading     *
    356  *    the sound according to distance.                                                         *
    357  *                                                                                             *
    358  * INPUT:   voc   -- The sound effect number to play.                                          *
    359  *                                                                                             *
    360  *          coord -- The world location that the sound originates from.                        *
    361  *                                                                                             *
    362  *          variation   -- This is the optional variation number to use when playing special   *
    363  *                         sound effects that have variations. For normal sound effects, this  *
    364  *                         parameter is ignored.                                               *
    365  *                                                                                             *
    366  *          house -- This specifies the optional house override value to use when playing      *
    367  *                   sound effects that have a variation. If not specified, then the current   *
    368  *                   player is examined for the house variation to use.                        *
    369  *                                                                                             *
    370  * OUTPUT:  none                                                                               *
    371  *                                                                                             *
    372  * WARNINGS:   none                                                                            *
    373  *                                                                                             *
    374  * HISTORY:                                                                                    *
    375  *   11/12/1994 JLB : Created.                                                                 *
    376  *   01/05/1995 JLB : Reduces sound more dramatically when off screen.                         *
    377  *   09/15/1996 JLB : Revamped volume logic.                                                   *
    378  *   11/01/1996 JLB : House override control.                                                  *
    379  *=============================================================================================*/
    380 void Sound_Effect(VocType voc, COORDINATE coord, int variation, HousesType house)
    381 {
    382 	//
    383 	// Intercept sound effect calls. MBL 06.17.2019
    384 	//
    385 	On_Sound_Effect((int)voc, variation, coord, (int)house);
    386 
    387 #if 0
    388 	CELL cell_pos = 0;
    389 	int pan_value;
    390 
    391 	if (Debug_Quiet || Options.Volume == 0 || voc == VOC_NONE || !SoundOn || SampleType == SAMPLE_NONE) {
    392 		return;
    393 	}
    394 	if (coord) {
    395 		cell_pos = Coord_Cell(coord);
    396 	}
    397 
    398 	fixed volume = 1;
    399 	pan_value = 0;
    400 	if (coord && !Map.In_View(cell_pos)) {
    401 		int distance = Distance(coord, Map.TacticalCoord) / CELL_LEPTON_W;
    402 		fixed dfixed = fixed(distance, 128+64);
    403 		dfixed.Sub_Saturate(1);
    404 		volume = fixed(1) - dfixed;
    405 
    406 		pan_value  = Cell_X(cell_pos);
    407 		pan_value -= Coord_XCell(Map.TacticalCoord) + (Lepton_To_Cell(Map.TacLeptonWidth) / 2);
    408 		if (ABS(pan_value) > Lepton_To_Cell(Map.TacLeptonWidth / 2)) {
    409 			pan_value *= 0x8000;
    410 			pan_value /= (MAP_CELL_W >> 2);
    411 			pan_value = Bound(pan_value, -0x7FFF, 0x7FFF);
    412 		} else {
    413 			pan_value  = 0;
    414 		}
    415 	}
    416 
    417 	Sound_Effect(voc, volume, variation, pan_value, house);
    418 #endif
    419 }
    420 
    421 
    422 /***********************************************************************************************
    423  * Sound_Effect -- General purpose sound player.                                               *
    424  *                                                                                             *
    425  *    This is used for general purpose sound effects. These are sounds that occur outside      *
    426  *    of the game world. They do not have a corresponding game world location as their source. *
    427  *                                                                                             *
    428  * INPUT:   voc      -- The sound effect number to play.                                       *
    429  *                                                                                             *
    430  *          volume   -- The volume to assign to this sound effect.                             *
    431  *                                                                                             *
    432  *          variation   -- This is the optional variation number to use when playing special   *
    433  *                         sound effects that have variations. For normal sound effects, this  *
    434  *                         parameter is ignored.                                               *
    435  *                                                                                             *
    436  *          house -- This specifies the optional house override value to use when playing      *
    437  *                   sound effects that have a variation. If not specified, then the current   *
    438  *                   player is examined for the house variation to use.                        *
    439  *                                                                                             *
    440  * OUTPUT:  Returns with the sound handle (-1 if no sound was played).                         *
    441  *                                                                                             *
    442  * WARNINGS:   none                                                                            *
    443  *                                                                                             *
    444  * HISTORY:                                                                                    *
    445  *   11/12/1994 JLB : Created.                                                                 *
    446  *   11/12/1994 JLB : Handles cache logic.                                                     *
    447  *   05/04/1995 JLB : Variation adjustments.                                                   *
    448  *   11/01/1996 JLB : House override control.                                                  *
    449  *=============================================================================================*/
    450 int Sound_Effect(VocType voc, fixed volume, int variation, signed short pan_value, HousesType house)
    451 {
    452 	//
    453 	// Intercept sound effect calls. MBL 06.17.2019
    454 	//
    455 	pan_value;
    456 	COORDINATE coord = 0;
    457 	On_Sound_Effect((int)voc, variation, coord, (int)house);
    458 
    459 #if 0
    460 	char name[_MAX_FNAME+_MAX_EXT];				// Working filename of sound effect.
    461 
    462 	if (Debug_Quiet || Options.Volume == 0 || voc == VOC_NONE || !SoundOn || SampleType == SAMPLE_NONE) {
    463 		return(-1);
    464 	}
    465 
    466 	/*
    467 	**	Alter the volume according to the game volume setting.
    468 	*/
    469 	volume = volume * Options.Volume;
    470 
    471 	/*
    472 	**	Fetch a pointer to the sound effect data. Modify the sound as appropriate and desired.
    473 	*/
    474 	char const * ext = ".AUD";
    475 	if (SoundEffectName[voc].Where == IN_VAR) {
    476 
    477 		/*
    478 		**	If there is no forced house, then use the current player
    479 		**	act like house.
    480 		*/
    481 		if (house == HOUSE_NONE) {
    482 			house = PlayerPtr->ActLike;
    483 		}
    484 
    485 		/*
    486 		**	Change the extension based on the variation and house accent requested.
    487 		*/
    488 		if (((1 << house) & HOUSEF_ALLIES) != 0) {
    489 
    490 			/*
    491 			**	For infantry, use a variation on the response. For vehicles, always
    492 			**	use the vehicle response table.
    493 			*/
    494 			if (variation < 0) {
    495 				if (ABS(variation) % 2) {
    496 					ext = ".V00";
    497 				} else {
    498 					ext = ".V02";
    499 				}
    500 			} else {
    501 				if (variation % 2) {
    502 					ext = ".V01";
    503 				} else {
    504 					ext = ".V03";
    505 				}
    506 			}
    507 		} else {
    508 			if (variation < 0) {
    509 				if (ABS(variation) % 2) {
    510 					ext = ".R00";
    511 				} else {
    512 					ext = ".R02";
    513 				}
    514 			} else {
    515 				if (variation % 2) {
    516 					ext = ".R01";
    517 				} else {
    518 					ext = ".R03";
    519 				}
    520 			}
    521 		}
    522 	}
    523 	_makepath(name, NULL, NULL, SoundEffectName[voc].Name, ext);
    524 	void const * ptr = MFCD::Retrieve(name);
    525 
    526 	/*
    527 	**	If the sound data pointer is not null, then presume that it is valid.
    528 	*/
    529 	if (ptr != NULL) {
    530 		volume.Sub_Saturate(1);
    531 		return(Play_Sample(ptr, SoundEffectName[voc].Priority * volume, volume*256, pan_value));
    532 	}
    533 #endif 
    534 
    535 	return(-1);
    536 }
    537 
    538 
    539 /*
    540 **	This elaborates all the EVA speech voices.
    541 */
    542 /*static PG*/ char const * Speech[VOX_COUNT] =  {
    543 	"MISNWON1",		//	VOX_ACCOMPLISHED					mission accomplished
    544 	"MISNLST1",		//	VOX_FAIL								your mission has failed
    545 	"PROGRES1",		//	VOX_NO_FACTORY						unable to comply, building in progress
    546 	"CONSCMP1",		//	VOX_CONSTRUCTION					construction complete
    547 	"UNITRDY1",		//	VOX_UNIT_READY						unit ready
    548 	"NEWOPT1",		//	VOX_NEW_CONSTRUCT					new construction options
    549 	"NODEPLY1",		//	VOX_DEPLOY							cannot deploy here
    550 	"STRCKIL1",		//	VOX_STRUCTURE_DESTROYED,		structure destroyed
    551 	"NOPOWR1",		//	VOX_INSUFFICIENT_POWER,			insufficient power
    552 	"NOFUNDS1",		//	VOX_NO_CASH							insufficient funds
    553 	"BCT1",			//	VOX_CONTROL_EXIT					battle control terminated
    554 	"REINFOR1",		//	VOX_REINFORCEMENTS				reinforcements have arrived
    555 	"CANCLD1",		//	VOX_CANCELED						canceled
    556 	"ABLDGIN1",		//	VOX_BUILDING						building
    557 	"LOPOWER1",		//	VOX_LOW_POWER						low power
    558 	"NOFUNDS1",		//	VOX_NEED_MO_MONEY					insufficent funds
    559 	"BASEATK1",		//	VOX_BASE_UNDER_ATTACK			our base is under attack
    560 	"NOBUILD1",		//	VOX_UNABLE_TO_BUILD				unable to build more
    561 	"PRIBLDG1",		//	VOX_PRIMARY_SELECTED				primary building selected
    562 #ifdef FIXIT_CSII	//	checked - ajw 9/28/98
    563 #ifdef ENGLISH
    564 	"TANK01",		// VOX_MADTANK_DEPLOYED				M.A.D. Tank Deployed
    565 #else
    566 	"none",
    567 #endif
    568 #else
    569 	"none",
    570 #endif
    571 	"none",			//	VOX_SOVIET_CAPTURED				Allied building captured
    572 	"UNITLST1",		// VOX_UNIT_LOST						unit lost
    573 	"SLCTTGT1",		// VOX_SELECT_TARGET					select target
    574 	"ENMYAPP1",		//	VOX_PREPARE							enemy approaching
    575 	"SILOND1",		//	VOX_NEED_MO_CAPACITY				silos needed
    576 	"ONHOLD1",		//	VOX_SUSPENDED						on hold
    577 	"REPAIR1",		//	VOX_REPAIRING						repairing
    578 	"none",
    579 	"none",
    580 	"AUNITL1",		//	VOX_AIRCRAFT_LOST					airborne unit lost
    581 	"none",
    582 	"AAPPRO1",		//	VOX_ALLIED_FORCES_APPROACHING	allied forces approaching
    583 	"AARRIVE1",		// VOX_ALLIED_APPROACHING			allied reinforcements have arrived
    584 	"none",
    585 	"none",
    586 	"BLDGINF1",		// VOX_BUILDING_INFILTRATED		building infiltrated
    587 	"CHROCHR1",		// VOX_CHRONO_CHARGING				chronosphere charging
    588 	"CHRORDY1",		// VOX_CHRONO_READY					chronosphere ready
    589 	"CHROYES1",		// VOX_CHRONO_TEST					chronosphere test successful
    590 	"CMDCNTR1",		//	VOX_HQ_UNDER_ATTACK				command center under attack
    591 	"CNTLDED1",		//	VOX_CENTER_DEACTIVATED			control center deactivated
    592 	"CONVYAP1",		//	VOX_CONVOY_APPROACHING			convoy approaching
    593 	"CONVLST1",		// VOX_CONVOY_UNIT_LOST				convoy unit lost
    594 	"XPLOPLC1",		//	VOX_EXPLOSIVE_PLACED				explosive charge placed
    595 	"CREDIT1",		// VOX_MONEY_STOLEN					credits stolen
    596 	"NAVYLST1",		// VOX_SHIP_LOST						naval unit lost
    597 	"SATLNCH1",		//	VOX_SATALITE_LAUNCHED			satalite launched
    598 	"PULSE1",		//	VOX_SONAR_AVAILABLE				sonar pulse available
    599 	"none",
    600 	"SOVFAPP1",		//	VOX_SOVIET_FORCES_APPROACHING	soviet forces approaching
    601 	"SOVREIN1",		// VOX_SOVIET_REINFROCEMENTS		soviet reinforcements have arrived
    602 	"TRAIN1",		//	VOX_TRAINING						training
    603 	"AREADY1",		//	VOX_ABOMB_READY
    604 	"ALAUNCH1",		//	VOX_ABOMB_LAUNCH
    605 	"AARRIVN1",		//	VOX_ALLIES_N
    606 	"AARRIVS1",		//	VOX_ALLIES_S
    607 	"AARIVE1",		//	VOX_ALLIES_E
    608 	"AARRIVW1",		//	VOX_ALLIES_W
    609 	"1OBJMET1",		//	VOX_OBJECTIVE1
    610 	"2OBJMET1",		//	VOX_OBJECTIVE2
    611 	"3OBJMET1",		//	VOX_OBJECTIVE3
    612 	"IRONCHG1",		//	VOX_IRON_CHARGING
    613 	"IRONRDY1",		//	VOX_IRON_READY
    614 	"KOSYRES1",		//	VOX_RESCUED
    615 	"OBJNMET1",		//	VOX_OBJECTIVE_NOT
    616 	"FLAREN1",		//	VOX_SIGNAL_N
    617 	"FLARES1",		//	VOX_SIGNAL_S
    618 	"FLAREE1",		//	VOX_SIGNAL_E
    619 	"FLAREW1",		//	VOX_SIGNAL_W
    620 	"SPYPLN1",		//	VOX_SPY_PLANE
    621 	"TANYAF1",		//	VOX_FREED
    622 	"ARMORUP1",		//	VOX_UPGRADE_ARMOR
    623 	"FIREPO1",		//	VOX_UPGRADE_FIREPOWER
    624 	"UNITSPD1",		//	VOX_UPGRADE_SPEED
    625 	"MTIMEIN1",		//	VOX_MISSION_TIMER
    626 	"UNITFUL1",		//	VOX_UNIT_FULL
    627 	"UNITREP1",		//	VOX_UNIT_REPAIRED
    628 	"40MINR",		//	VOX_TIME_40
    629 	"30MINR",		//	VOX_TIME_30
    630 	"20MINR",		//	VOX_TIME_20
    631 	"10MINR",		//	VOX_TIME_10
    632 	"5MINR",			//	VOX_TIME_5
    633 	"4MINR",			//	VOX_TIME_4
    634 	"3MINR",			//	VOX_TIME_3
    635 	"2MINR",			//	VOX_TIME_2
    636 	"1MINR",			//	VOX_TIME_1
    637 	"TIMERNO1",		//	VOX_TIME_STOP
    638 	"UNITSLD1",		//	VOX_UNIT_SOLD
    639 	"TIMERGO1",		//	VOX_TIMER_STARTED
    640 	"TARGRES1",		//	VOX_TARGET_RESCUED
    641 	"TARGFRE1",		//	VOX_TARGET_FREED
    642 	"TANYAR1",		//	VOX_TANYA_RESCUED
    643 	"STRUSLD1",		//	VOX_STRUCTURE_SOLD
    644 	"SOVFORC1",		//	VOX_SOVIET_FORCES_FALLEN
    645 	"SOVEMP1",		//	VOX_SOVIET_SELECTED
    646 	"SOVEFAL1",		//	VOX_SOVIET_EMPIRE_FALLEN
    647 	"OPTERM1",		//	VOX_OPERATION_TERMINATED
    648 	"OBJRCH1",		//	VOX_OBJECTIVE_REACHED
    649 	"OBJNRCH1",		//	VOX_OBJECTIVE_NOT_REACHED
    650 	"OBJMET1",		//	VOX_OBJECTIVE_MET
    651 	"MERCR1",		//	VOX_MERCENARY_RESCUED
    652 	"MERCF1",		//	VOX_MERCENARY_FREED
    653 	"KOSYFRE1",		//	VOX_KOSOYGEN_FREED
    654 	"FLARE1",		//	VOX_FLARE_DETECTED
    655 	"COMNDOR1",		//	VOX_COMMANDO_RESCUED
    656 	"COMNDOF1",		//	VOX_COMMANDO_FREED
    657 	"BLDGPRG1",		//	VOX_BUILDING_IN_PROGRESS
    658 	"ATPREP1",		//	VOX_ATOM_PREPPING
    659 	"ASELECT1",		//	VOX_ALLIED_SELECTED
    660 	"APREP1",		//	VOX_ABOMB_PREPPING
    661 	"ATLNCH1",		//	VOX_ATOM_LAUNCHED
    662 	"AFALLEN1",		//	VOX_ALLIED_FORCES_FALLEN
    663 	"AAVAIL1",		//	VOX_ABOMB_AVAILABLE
    664 	"AARRIVE1",		//	VOX_ALLIED_REINFORCEMENTS
    665 	"SAVE1",			//	VOX_MISSION_SAVED
    666 	"LOAD1"			//	VOX_MISSION_LOADED
    667 };
    668 
    669 
    670 static VoxType CurrentVoice = VOX_NONE;
    671 
    672 
    673 /***********************************************************************************************
    674  * Speech_Name -- Fetches the name for the voice specified.                                    *
    675  *                                                                                             *
    676  *    Use this routine to fetch the ASCII name of the speech id specified. Typical use of this *
    677  *    would be to build a displayable list of the speech types. The trigger system uses this   *
    678  *    so that a speech type can be selected.                                                   *
    679  *                                                                                             *
    680  * INPUT:   speech   -- The speech type id to convert to ASCII string.                         *
    681  *                                                                                             *
    682  * OUTPUT:  Returns with a pointer to the speech ASCII representation of the speech id type.   *
    683  *                                                                                             *
    684  * WARNINGS:   none                                                                            *
    685  *                                                                                             *
    686  * HISTORY:                                                                                    *
    687  *   06/01/1996 JLB : Created.                                                                 *
    688  *=============================================================================================*/
    689 char const * Speech_Name(VoxType speech)
    690 {
    691 	if (speech == VOX_NONE) return("none");
    692 	return(Speech[speech]);
    693 }
    694 
    695 
    696 /***********************************************************************************************
    697  * Speak -- Computer speaks to the player.                                                     *
    698  *                                                                                             *
    699  *    This routine is used to have the game computer (EVA) speak to the player.                *
    700  *                                                                                             *
    701  * INPUT:   voice -- The voice number to speak (see defines.h).                                *
    702  *                                                                                             *
    703  * OUTPUT:  Returns with the handle of the playing speech (-1 if no voice started).            *
    704  *                                                                                             *
    705  * WARNINGS:   none                                                                            *
    706  *                                                                                             *
    707  * HISTORY:                                                                                    *
    708  *   11/12/1994 JLB : Created.                                                                 *
    709  *=============================================================================================*/
    710 // void Speak(VoxType voice) // MBL 02.06.2020
    711 void Speak(VoxType voice, HouseClass *house, COORDINATE coord)
    712 {
    713 	// MBL 06.17.2019
    714 	if (voice == VOX_NONE)
    715 	{
    716 		return;
    717 	}
    718 
    719 	//
    720 	// Intercept speech calls. MBL 06.17.2019
    721 	//
    722 
    723 	// On_Speech((int)voice); // MBL 02.06.2020
    724 	On_Speech((int)voice, house);
    725 	if (coord) {
    726 		On_Ping(house, coord);
    727 	}
    728 
    729 #if 0
    730 	if (!Debug_Quiet && Options.Volume != 0 && SampleType != 0 && voice != VOX_NONE && voice != SpeakQueue && voice != CurrentVoice && SpeakQueue == VOX_NONE) {
    731 		SpeakQueue = voice;
    732 		Speak_AI();
    733 	}
    734 #endif
    735 }
    736 
    737 
    738 /***********************************************************************************************
    739  * Speak_AI -- Handles starting the EVA voices.                                                *
    740  *                                                                                             *
    741  *    This starts the EVA voice talking as well. If there is any speech request in the queue,  *
    742  *    it will be started when the current voice is finished. Call this routine as often as     *
    743  *    possible (once per game tick is sufficient).                                             *
    744  *                                                                                             *
    745  * INPUT:   none                                                                               *
    746  *                                                                                             *
    747  * OUTPUT:  none                                                                               *
    748  *                                                                                             *
    749  * WARNINGS:   none                                                                            *
    750  *                                                                                             *
    751  * HISTORY:                                                                                    *
    752  *   12/27/1994 JLB : Created.                                                                 *
    753  *   10/11/1996 JLB : Handles multiple speech buffers.                                         *
    754  *=============================================================================================*/
    755 void Speak_AI(void)
    756 {
    757 // MBL 06.17.2019 KO
    758 #if 0
    759 	static int _index = 0;
    760 	if (Debug_Quiet || SampleType == 0) return;
    761 
    762 	if (!Is_Sample_Playing(SpeechBuffer[_index])) {
    763 		CurrentVoice = VOX_NONE;
    764 		if (SpeakQueue != VOX_NONE) {
    765 
    766 			/*
    767 			**	Try to find a previously loaded copy of the EVA speech in one of the
    768 			**	speech buffers.
    769 			*/
    770 			void const * speech = NULL;
    771 			for (int index = 0; index < ARRAY_SIZE(SpeechRecord); index++) {
    772 				if (SpeechRecord[index] == SpeakQueue) break;
    773 			}
    774 
    775 			/*
    776 			**	If a previous copy could not be located, then load the requested
    777 			**	voice into the oldest buffer available.
    778 			*/
    779 			if (speech == NULL) {
    780 				_index = (_index + 1) % ARRAY_SIZE(SpeechRecord);
    781 
    782 				char name[_MAX_FNAME+_MAX_EXT];
    783 
    784 				_makepath(name, NULL, NULL, Speech[SpeakQueue], ".AUD");
    785 				CCFileClass file(name);
    786 				if (file.Is_Available() && file.Read(SpeechBuffer[_index], SPEECH_BUFFER_SIZE)) {
    787 					speech = SpeechBuffer[_index];
    788 					SpeechRecord[_index] = SpeakQueue;
    789 				}
    790 			}
    791 
    792 			/*
    793 			**	Since the speech file was loaded, play it.
    794 			*/
    795 			if (speech != NULL) {
    796 				Play_Sample(speech, 254, Options.Volume * 256);
    797 				CurrentVoice = SpeakQueue;
    798 			}
    799 
    800 			SpeakQueue = VOX_NONE;
    801 		}
    802 	}
    803 #endif
    804 
    805 	// MBL 06.18.2019
    806 	if (SpeakQueue != VOX_NONE) 
    807 	{
    808 		// On_Speech((int)SpeakQueue); // MBL 02.06.2020
    809 		On_Speech((int)SpeakQueue, NULL);
    810 		SpeakQueue = VOX_NONE;
    811 	}
    812 }
    813 
    814 
    815 /***********************************************************************************************
    816  * Stop_Speaking -- Forces the EVA voice to stop talking.                                      *
    817  *                                                                                             *
    818  *    Use this routine to immediately stop the EVA voice from speaking. It also clears out     *
    819  *    the pending voice queue.                                                                 *
    820  *                                                                                             *
    821  * INPUT:   none                                                                               *
    822  *                                                                                             *
    823  * OUTPUT:  none                                                                               *
    824  *                                                                                             *
    825  * WARNINGS:   none                                                                            *
    826  *                                                                                             *
    827  * HISTORY:                                                                                    *
    828  *   12/27/1994 JLB : Created.                                                                 *
    829  *=============================================================================================*/
    830 void Stop_Speaking(void)
    831 {
    832 	SpeakQueue = VOX_NONE;
    833 	Stop_Sample_Playing(SpeechBuffer);
    834 }
    835 
    836 
    837 /***********************************************************************************************
    838  * Is_Speaking -- Checks to see if the eva voice is still playing.                             *
    839  *                                                                                             *
    840  *    Call this routine when the EVA voice being played needs to be checked. A typical use     *
    841  *    of this would be when some action needs to be delayed until the voice has finished --    *
    842  *    say the end of the game.                                                                 *
    843  *                                                                                             *
    844  * INPUT:   none                                                                               *
    845  *                                                                                             *
    846  * OUTPUT:  bool; Is the EVA voice still playing?                                              *
    847  *                                                                                             *
    848  * WARNINGS:   none                                                                            *
    849  *                                                                                             *
    850  * HISTORY:                                                                                    *
    851  *   03/12/1995 JLB : Created.                                                                 *
    852  *=============================================================================================*/
    853 bool Is_Speaking(void)
    854 {
    855 	Speak_AI();
    856 	if (!Debug_Quiet && SampleType != 0 && (SpeakQueue != VOX_NONE || Is_Sample_Playing(SpeechBuffer))) {
    857 		return(true);
    858 	}
    859 	return(false);
    860 }