Talk:GSS
From DoomWiki.org
Code in Heretic and Strife[edit]
You may find the following interesting/educational because it indicates that Doom may have been meant to be able to use these originally. The following source code is from Heretic, where the relevant portions are commented out, but in the disassembly of STRIFE1.EXE those portions are not commented out and are live code. Some comments are added by me.
/* From I_SOUND.H */
typedef enum
{
snd_none,
snd_PC,
snd_Adlib, // note presence of AdLib as a distinct sound card
snd_SB,
snd_PAS,
snd_GUS,
snd_MPU, // note presence of MPU (MIDI devices) as sound cards
snd_MPU2,
snd_MPU3,
snd_AWE,
NUM_SCARDS
} cardenum_t;
/* From I_SOUND.C */
const char snd_prefixen[] = { 'P', 'P', 'A', 'S', 'S', 'S', 'M',
'M', 'M', 'S' };
int I_GetSfxLumpNum(sfxinfo_t *sound)
{
char namebuf[9];
if(sound->name == 0)
return 0;
if (sound->link) sound = sound->link;
// sprintf(namebuf, "d%c%s", snd_prefixen[snd_SfxDevice], sound->name);
return W_GetNumForName(sound->name);
}
The disassembly from Strife shows the code as being live and not commented out as it is in Heretic (which doesn't support PC speaker sound effects).
mov eax, snd_SfxDevice
loc_11657:
mov eax, dword ptr ds:byte_1155D[eax] ; This is a pointer 3 bytes before snd_prefixen[]
push edx
sar eax, 18h ; This is just optimizer non-sense for aligned reads (hence the pointer decrement)
push eax
push offset aDCS ; "d%c%s"
lea eax, [esp+1Ch+a1]
push eax ; a1
call sprintf_
mov eax, snd_SfxDevice
mov dl, ds:byte_11560[eax] ; Actual pointer to snd_prefixen[]
add esp, 10h
cmp dl, 'P'
jnz short loc_11697
mov eax, esp ; name
call W_CheckNumForName
cmp eax, 0FFFFFFFFh
jnz short loc_11697
mov eax, offset aDprifle ; "dprifle"
jmp short loc_11699
; ---------------------------------------------------------------------------
loc_11697:
mov eax, esp ; name
loc_11699:
call W_GetNumForName
