version 1.2 | | version 1.3 |
---|
| | |
#include "wall.h" | | #include "wall.h" |
#include "newdemo.h" | | #include "newdemo.h" |
#include "kconfig.h" | | #include "kconfig.h" |
| | #include "altsound.h" |
| | |
//edited 05/17/99 Matt Mueller - added ifndef NO_ASM | | //edited 05/17/99 Matt Mueller - added ifndef NO_ASM |
//added on 980905 by adb to add inline fixmul for mixer on i386 | | //added on 980905 by adb to add inline fixmul for mixer on i386 |
| | |
SDL_CloseAudio(); | | SDL_CloseAudio(); |
} | | } |
| | |
/* Find the sound which actually equates to a sound number */ | | |
int digi_xlat_sound(int soundno) | | |
{ | | |
if ( soundno < 0 ) return -1; | | |
| | |
if ( digi_lomem ) { | | |
soundno = AltSounds[soundno]; | | |
if ( soundno == 255 ) return -1; | | |
} | | |
return Sounds[soundno]; | | |
} | | |
| | |
static int get_free_slot() | | static int get_free_slot() |
{ | | { |
int i; | | int i; |
| | |
if (slot<0) return -1; | | if (slot<0) return -1; |
| | |
SoundSlots[slot].soundno = soundnum; | | SoundSlots[slot].soundno = soundnum; |
SoundSlots[slot].samples = GameSounds[soundnum].data; | | SoundSlots[slot].samples = Sounddat(soundnum)->data; |
SoundSlots[slot].length = GameSounds[soundnum].length; | | SoundSlots[slot].length = Sounddat(soundnum)->length; |
SoundSlots[slot].volume = fixmul(digi_volume, volume); | | SoundSlots[slot].volume = fixmul(digi_volume, volume); |
SoundSlots[slot].pan = pan; | | SoundSlots[slot].pan = pan; |
SoundSlots[slot].position = 0; | | SoundSlots[slot].position = 0; |
| | |
| | |
| | |
SoundSlots[slot].soundno = SoundObjects[obj].soundnum; | | SoundSlots[slot].soundno = SoundObjects[obj].soundnum; |
SoundSlots[slot].samples = GameSounds[SoundObjects[obj].soundnum].data; | | SoundSlots[slot].samples = Sounddat(SoundObjects[obj].soundnum)->data; |
SoundSlots[slot].length = GameSounds[SoundObjects[obj].soundnum].length; | | SoundSlots[slot].length = Sounddat(SoundObjects[obj].soundnum)->length; |
SoundSlots[slot].volume = fixmul(digi_volume, SoundObjects[obj].volume); | | SoundSlots[slot].volume = fixmul(digi_volume, SoundObjects[obj].volume); |
SoundSlots[slot].pan = SoundObjects[obj].pan; | | SoundSlots[slot].pan = SoundObjects[obj].pan; |
SoundSlots[slot].position = 0; | | SoundSlots[slot].position = 0; |
| | |
if ( Newdemo_state == ND_STATE_RECORDING ) | | if ( Newdemo_state == ND_STATE_RECORDING ) |
newdemo_record_sound( soundno ); | | newdemo_record_sound( soundno ); |
#endif | | #endif |
soundno = digi_xlat_sound(soundno); | | |
| | |
if (!digi_initialised) return; | | if (!digi_initialised) return; |
| | |
if (soundno < 0 ) return; | | if (digi_xlat_sound(soundno) < 0 ) return; |
| | |
digi_start_sound(soundno, max_volume, F0_5); | | digi_start_sound(soundno, max_volume, F0_5); |
} | | } |
| | |
if ( Newdemo_state == ND_STATE_RECORDING ) | | if ( Newdemo_state == ND_STATE_RECORDING ) |
newdemo_record_sound( soundno ); | | newdemo_record_sound( soundno ); |
#endif | | #endif |
soundno = digi_xlat_sound(soundno); | | |
| | |
if (!digi_initialised) return; | | if (!digi_initialised) return; |
| | |
if (soundno < 0 ) return; | | if (digi_xlat_sound(soundno) < 0 ) return; |
| | |
for (i=0; i < MAX_SOUND_SLOTS; i++) | | for (i=0; i < MAX_SOUND_SLOTS; i++) |
if (SoundSlots[i].soundno == soundno) | | if (SoundSlots[i].soundno == soundno) |
| | |
newdemo_record_sound_3d( soundno, angle, volume ); | | newdemo_record_sound_3d( soundno, angle, volume ); |
} | | } |
#endif | | #endif |
soundno = digi_xlat_sound(soundno); | | |
| | |
if (!digi_initialised) return; | | if (!digi_initialised) return; |
if (soundno < 0 ) return; | | if (digi_xlat_sound(soundno) < 0 ) return; |
| | |
if (volume < MIN_VOLUME ) return; | | if (volume < MIN_VOLUME ) return; |
digi_start_sound(soundno, volume, angle); | | digi_start_sound(soundno, volume, angle); |
| | |
} | | } |
} | | } |
| | |
int digi_link_sound_to_object2( int org_soundnum, short objnum, int forever, fix max_volume, fix max_distance ) | | int digi_link_sound_to_object2( intsoundnum, short objnum, int forever, fix max_volume, fix max_distance ) |
{ | | { |
int i,volume,pan; | | int i,volume,pan; |
object * objp; | | object * objp; |
int soundnum; | | |
| | |
soundnum = digi_xlat_sound(org_soundnum); | | |
| | |
if ( max_volume < 0 ) return -1; | | if ( max_volume < 0 ) return -1; |
// if ( max_volume > F1_0 ) max_volume = F1_0; | | // if ( max_volume > F1_0 ) max_volume = F1_0; |
| | |
if (!digi_initialised) return -1; | | if (!digi_initialised) return -1; |
if (soundnum < 0 ) return -1; | | if (soundnum < 0 ) return -1; |
if (GameSounds[soundnum].data==NULL) { | | if (Sounddat(soundnum)->data==NULL) { |
Int3(); | | Int3(); |
return -1; | | return -1; |
} | | } |
| | |
if ( !forever ) { | | if ( !forever ) { |
// Hack to keep sounds from building up... | | // Hack to keep sounds from building up... |
digi_get_sound_loc( &Viewer->orient, &Viewer->pos, Viewer->segnum, &Objects[objnum].pos, Objects[objnum].segnum, max_volume,&volume, &pan, max_distance ); | | digi_get_sound_loc( &Viewer->orient, &Viewer->pos, Viewer->segnum, &Objects[objnum].pos, Objects[objnum].segnum, max_volume,&volume, &pan, max_distance ); |
digi_play_sample_3d( org_soundnum, pan, volume, 0 ); | | digi_play_sample_3d(soundnum, pan, volume, 0 ); |
return -1; | | return -1; |
} | | } |
| | |
| | |
int digi_link_sound_to_object( int soundnum, short objnum, int forever, fix max_volume ) | | int digi_link_sound_to_object( int soundnum, short objnum, int forever, fix max_volume ) |
{ return digi_link_sound_to_object2( soundnum, objnum, forever, max_volume, 256*F1_0); } | | { return digi_link_sound_to_object2( soundnum, objnum, forever, max_volume, 256*F1_0); } |
| | |
int digi_link_sound_to_pos2( int org_soundnum, short segnum, short sidenum, vms_vector * pos, int forever, fix max_volume, fix max_distance ) | | int digi_link_sound_to_pos2( int soundnum, short segnum, short sidenum, vms_vector * pos, int forever, fix max_volume, fix max_distance ) |
{ | | { |
int i, volume, pan; | | int i, volume, pan; |
int soundnum; | | int soundnum; |
| | |
soundnum = digi_xlat_sound(org_soundnum); | | |
| | |
if ( max_volume < 0 ) return -1; | | if ( max_volume < 0 ) return -1; |
// if ( max_volume > F1_0 ) max_volume = F1_0; | | // if ( max_volume > F1_0 ) max_volume = F1_0; |
| | |
if (!digi_initialised) return -1; | | if (!digi_initialised) return -1; |
if (soundnum < 0 ) return -1; | | if (digi_xlat_sound(soundnum) < 0 ) return -1; |
if (GameSounds[soundnum].data==NULL) { | | if (Sounddat(soundnum)->data==NULL) { |
Int3(); | | Int3(); |
return -1; | | return -1; |
} | | } |
| | |
if ( !forever ) { | | if ( !forever ) { |
// Hack to keep sounds from building up... | | // Hack to keep sounds from building up... |
digi_get_sound_loc( &Viewer->orient, &Viewer->pos, Viewer->segnum, pos, segnum, max_volume, &volume, &pan, max_distance ); | | digi_get_sound_loc( &Viewer->orient, &Viewer->pos, Viewer->segnum, pos, segnum, max_volume, &volume, &pan, max_distance ); |
digi_play_sample_3d( org_soundnum, pan, volume, 0 ); | | digi_play_sample_3d( soundnum, pan, volume, 0 ); |
return -1; | | return -1; |
} | | } |
| | |
| | |
{ | | { |
int i,killed; | | int i,killed; |
| | |
soundnum = digi_xlat_sound(soundnum); | | |
| | |
if (!digi_initialised) return; | | if (!digi_initialised) return; |
| | |
killed = 0; | | killed = 0; |
| | |
int digi_is_sound_playing(int soundno) | | int digi_is_sound_playing(int soundno) |
{ | | { |
int i; | | int i; |
| | |
soundno = digi_xlat_sound(soundno); | | |
| | |
for (i = 0; i < MAX_SOUND_SLOTS; i++) | | for (i = 0; i < MAX_SOUND_SLOTS; i++) |
//changed on 980905 by adb: added SoundSlots[i].playing && | | //changed on 980905 by adb: added SoundSlots[i].playing && |