mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2026-02-20 04:21:52 +00:00
Merge branch 'just-sound-code-things' into 'master'
Consolidate sound/music volume functions; kill HW3SOUND off the face of the game code See merge request KartKrew/Kart!1518
This commit is contained in:
commit
7dafacaf7d
8 changed files with 21 additions and 175 deletions
|
|
@ -92,10 +92,6 @@
|
|||
#include "hardware/hw_main.h" // 3D View Rendering
|
||||
#endif
|
||||
|
||||
#ifdef HW3SOUND
|
||||
#include "hardware/hw3sound.h"
|
||||
#endif
|
||||
|
||||
#include "lua_script.h"
|
||||
|
||||
/* Manually defined asset hashes
|
||||
|
|
@ -838,10 +834,6 @@ void D_SRB2Loop(void)
|
|||
interp = R_UsingFrameInterpolation() && !dedicated;
|
||||
doDisplay = false;
|
||||
|
||||
#ifdef HW3SOUND
|
||||
HW3S_BeginFrameUpdate();
|
||||
#endif
|
||||
|
||||
if (realtics > 0 || singletics)
|
||||
{
|
||||
// don't skip more than 10 frames at a time
|
||||
|
|
@ -932,10 +924,6 @@ void D_SRB2Loop(void)
|
|||
S_TickSoundTest();
|
||||
}
|
||||
|
||||
#ifdef HW3SOUND
|
||||
HW3S_EndFrameUpdate();
|
||||
#endif
|
||||
|
||||
LUA_Step();
|
||||
|
||||
#ifdef HAVE_DISCORDRPC
|
||||
|
|
@ -1671,8 +1659,8 @@ void D_SRB2Main(void)
|
|||
CONS_Printf("S_InitSfxChannels(): Setting up sound channels.\n");
|
||||
I_StartupSound();
|
||||
I_InitMusic();
|
||||
S_InitSfxChannels(cv_soundvolume.value);
|
||||
S_InitMusicVolume();
|
||||
S_InitSfxChannels();
|
||||
S_SetMusicVolume();
|
||||
}
|
||||
|
||||
Music_Init();
|
||||
|
|
|
|||
|
|
@ -15,46 +15,6 @@
|
|||
#ifndef __DOOMDEF__
|
||||
#define __DOOMDEF__
|
||||
|
||||
// Sound system select
|
||||
// This should actually be in the makefile,
|
||||
// but I can't stand that gibberish. D:
|
||||
#define SOUND_DUMMY 0
|
||||
#define SOUND_SDL 1
|
||||
#define SOUND_MIXER 2
|
||||
#define SOUND_FMOD 3
|
||||
|
||||
#ifndef SOUND
|
||||
#ifdef HAVE_SDL
|
||||
|
||||
// Use Mixer interface?
|
||||
#ifdef HAVE_MIXER
|
||||
#define SOUND SOUND_MIXER
|
||||
#ifdef HW3SOUND
|
||||
#undef HW3SOUND
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// Use generic SDL interface.
|
||||
#ifndef SOUND
|
||||
#define SOUND SOUND_SDL
|
||||
#endif
|
||||
|
||||
#else // No SDL.
|
||||
|
||||
// Use FMOD?
|
||||
#ifdef HAVE_FMOD
|
||||
#define SOUND SOUND_FMOD
|
||||
#ifdef HW3SOUND
|
||||
#undef HW3SOUND
|
||||
#endif
|
||||
#else
|
||||
// No more interfaces. :(
|
||||
#define SOUND SOUND_DUMMY
|
||||
#endif
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef _WIN32
|
||||
#define ASMCALL __cdecl
|
||||
#else
|
||||
|
|
|
|||
|
|
@ -36,10 +36,6 @@
|
|||
#include "k_objects.h"
|
||||
#include "k_roulette.h"
|
||||
|
||||
#ifdef HW3SOUND
|
||||
#include "hardware/hw3sound.h"
|
||||
#endif
|
||||
|
||||
boolean LUA_CallAction(enum actionnum actionnum, mobj_t *actor);
|
||||
|
||||
player_t *stplyr;
|
||||
|
|
|
|||
|
|
@ -48,10 +48,6 @@
|
|||
#include "k_terrain.h"
|
||||
#include "acs/interface.h"
|
||||
|
||||
#ifdef HW3SOUND
|
||||
#include "hardware/hw3sound.h"
|
||||
#endif
|
||||
|
||||
// Not sure if this is necessary, but it was in w_wad.c, so I'm putting it here too -Shadow Hog
|
||||
#include <errno.h>
|
||||
|
||||
|
|
|
|||
|
|
@ -67,10 +67,6 @@
|
|||
#include "music.h"
|
||||
#include "k_tally.h"
|
||||
|
||||
#ifdef HW3SOUND
|
||||
#include "hardware/hw3sound.h"
|
||||
#endif
|
||||
|
||||
#ifdef HWRENDER
|
||||
#include "hardware/hw_light.h"
|
||||
#include "hardware/hw_main.h"
|
||||
|
|
|
|||
116
src/s_sound.c
116
src/s_sound.c
|
|
@ -37,12 +37,7 @@
|
|||
#include "v_video.h" // V_ThinStringWidth
|
||||
#include "music.h"
|
||||
|
||||
#ifdef HW3SOUND
|
||||
// 3D Sound Interface
|
||||
#include "hardware/hw3sound.h"
|
||||
#else
|
||||
static boolean S_AdjustSoundParams(const mobj_t *listener, const mobj_t *source, INT32 *vol, INT32 *sep, INT32 *pitch, sfxinfo_t *sfxinfo);
|
||||
#endif
|
||||
|
||||
static void Command_Tunes_f(void);
|
||||
static void Command_RestartAudio_f(void);
|
||||
|
|
@ -213,13 +208,6 @@ void SetChannelsNum(void)
|
|||
if (cv_numChannels.value == 999999999) //Alam_GBC: OH MY ROD!(ROD rimmiced with GOD!)
|
||||
CV_StealthSet(&cv_numChannels,cv_numChannels.defaultvalue);
|
||||
|
||||
#ifdef HW3SOUND
|
||||
if (hws_mode != HWS_DEFAULT_MODE)
|
||||
{
|
||||
HW3S_SetSourcesNum();
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
if (cv_numChannels.value)
|
||||
channels = (channel_t *)Z_Calloc(cv_numChannels.value * sizeof (channel_t), PU_STATIC, NULL);
|
||||
numofchannels = (channels ? cv_numChannels.value : 0);
|
||||
|
|
@ -267,14 +255,6 @@ void S_StopSounds(void)
|
|||
{
|
||||
INT32 cnum;
|
||||
|
||||
#ifdef HW3SOUND
|
||||
if (hws_mode != HWS_DEFAULT_MODE)
|
||||
{
|
||||
HW3S_StopSounds();
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
// kill all playing sounds at start of level
|
||||
for (cnum = 0; cnum < numofchannels; cnum++)
|
||||
if (channels[cnum].sfxinfo)
|
||||
|
|
@ -294,13 +274,6 @@ void S_StopSoundByID(void *origin, sfxenum_t sfx_id)
|
|||
#if 0
|
||||
if (!origin)
|
||||
return;
|
||||
#endif
|
||||
#ifdef HW3SOUND
|
||||
if (hws_mode != HWS_DEFAULT_MODE)
|
||||
{
|
||||
HW3S_StopSoundByID(origin, sfx_id);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
for (cnum = 0; cnum < numofchannels; cnum++)
|
||||
{
|
||||
|
|
@ -315,13 +288,6 @@ void S_StopSoundByNum(sfxenum_t sfxnum)
|
|||
{
|
||||
INT32 cnum;
|
||||
|
||||
#ifdef HW3SOUND
|
||||
if (hws_mode != HWS_DEFAULT_MODE)
|
||||
{
|
||||
HW3S_StopSoundByNum(sfxnum);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
for (cnum = 0; cnum < numofchannels; cnum++)
|
||||
{
|
||||
if (channels[cnum].sfxinfo == &S_sfx[sfxnum])
|
||||
|
|
@ -484,14 +450,6 @@ void S_StartSoundAtVolume(const void *origin_p, sfxenum_t sfx_id, INT32 volume)
|
|||
}
|
||||
}
|
||||
|
||||
#ifdef HW3SOUND
|
||||
if (hws_mode != HWS_DEFAULT_MODE)
|
||||
{
|
||||
HW3S_StartSound(origin, sfx_id);
|
||||
return;
|
||||
};
|
||||
#endif
|
||||
|
||||
for (i = 0; i <= r_splitscreen; i++)
|
||||
{
|
||||
player_t *player = &players[displayplayers[i]];
|
||||
|
|
@ -649,12 +607,7 @@ void S_StartSound(const void *origin, sfxenum_t sfx_id)
|
|||
return;
|
||||
|
||||
// the volume is handled 8 bits
|
||||
#ifdef HW3SOUND
|
||||
if (hws_mode != HWS_DEFAULT_MODE)
|
||||
HW3S_StartSound(origin, sfx_id);
|
||||
else
|
||||
#endif
|
||||
S_StartSoundAtVolume(origin, sfx_id, 255);
|
||||
S_StartSoundAtVolume(origin, sfx_id, 255);
|
||||
}
|
||||
|
||||
void S_ReducedVFXSoundAtVolume(const void *origin, sfxenum_t sfx_id, INT32 volume, player_t *owner)
|
||||
|
|
@ -687,13 +640,6 @@ void S_StopSound(void *origin)
|
|||
if (!origin)
|
||||
return;
|
||||
|
||||
#ifdef HW3SOUND
|
||||
if (hws_mode != HWS_DEFAULT_MODE)
|
||||
{
|
||||
HW3S_StopSound(origin);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
for (cnum = 0; cnum < numofchannels; cnum++)
|
||||
{
|
||||
if (channels[cnum].sfxinfo && channels[cnum].origin == origin)
|
||||
|
|
@ -721,9 +667,9 @@ void S_UpdateSounds(void)
|
|||
|
||||
// Update sound/music volumes, if changed manually at console
|
||||
if (actualsfxvolume != cv_soundvolume.value)
|
||||
S_SetSfxVolume (cv_soundvolume.value);
|
||||
S_SetSfxVolume();
|
||||
if (actualdigmusicvolume != cv_digmusicvolume.value)
|
||||
S_SetDigMusicVolume (cv_digmusicvolume.value);
|
||||
S_SetMusicVolume();
|
||||
|
||||
// We're done now, if we're not in a level.
|
||||
if (gamestate != GS_LEVEL)
|
||||
|
|
@ -765,14 +711,6 @@ void S_UpdateSounds(void)
|
|||
I_UpdateMumble(players[consoleplayer].mo, listener[0]);
|
||||
#endif
|
||||
|
||||
#ifdef HW3SOUND
|
||||
if (hws_mode != HWS_DEFAULT_MODE)
|
||||
{
|
||||
HW3S_UpdateSources();
|
||||
goto notinlevel;
|
||||
}
|
||||
#endif
|
||||
|
||||
for (i = 0; i <= r_splitscreen; i++)
|
||||
{
|
||||
player_t *player = &players[displayplayers[i]];
|
||||
|
|
@ -914,17 +852,12 @@ void S_UpdateClosedCaptions(void)
|
|||
}
|
||||
}
|
||||
|
||||
void S_SetSfxVolume(INT32 volume)
|
||||
void S_SetSfxVolume(void)
|
||||
{
|
||||
//CV_SetValue(&cv_soundvolume, volume);
|
||||
actualsfxvolume = volume;
|
||||
actualsfxvolume = cv_soundvolume.value;
|
||||
|
||||
#ifdef HW3SOUND
|
||||
hws_mode == HWS_DEFAULT_MODE ? I_SetSfxVolume(volume&0x1F) : HW3S_SetSfxVolume(volume&0x1F);
|
||||
#else
|
||||
// now hardware volume
|
||||
I_SetSfxVolume(volume);
|
||||
#endif
|
||||
I_SetSfxVolume(actualsfxvolume);
|
||||
}
|
||||
|
||||
void S_ClearSfx(void)
|
||||
|
|
@ -1128,11 +1061,6 @@ INT32 S_OriginPlaying(void *origin)
|
|||
if (!origin)
|
||||
return false;
|
||||
|
||||
#ifdef HW3SOUND
|
||||
if (hws_mode != HWS_DEFAULT_MODE)
|
||||
return HW3S_OriginPlaying(origin);
|
||||
#endif
|
||||
|
||||
for (cnum = 0; cnum < numofchannels; cnum++)
|
||||
if (channels[cnum].origin == origin)
|
||||
return 1;
|
||||
|
|
@ -1145,11 +1073,6 @@ INT32 S_IdPlaying(sfxenum_t id)
|
|||
{
|
||||
INT32 cnum;
|
||||
|
||||
#ifdef HW3SOUND
|
||||
if (hws_mode != HWS_DEFAULT_MODE)
|
||||
return HW3S_IdPlaying(id);
|
||||
#endif
|
||||
|
||||
for (cnum = 0; cnum < numofchannels; cnum++)
|
||||
if ((size_t)(channels[cnum].sfxinfo - S_sfx) == (size_t)id)
|
||||
return 1;
|
||||
|
|
@ -1164,11 +1087,6 @@ INT32 S_SoundPlaying(void *origin, sfxenum_t id)
|
|||
if (!origin)
|
||||
return 0;
|
||||
|
||||
#ifdef HW3SOUND
|
||||
if (hws_mode != HWS_DEFAULT_MODE)
|
||||
return HW3S_SoundPlaying(origin, id);
|
||||
#endif
|
||||
|
||||
for (cnum = 0; cnum < numofchannels; cnum++)
|
||||
{
|
||||
if (channels[cnum].origin == origin
|
||||
|
|
@ -1230,7 +1148,7 @@ void S_StartSoundName(void *mo, const char *soundname)
|
|||
// Sets channels, SFX volume,
|
||||
// allocates channel buffer, sets S_sfx lookup.
|
||||
//
|
||||
void S_InitSfxChannels(INT32 sfxVolume)
|
||||
void S_InitSfxChannels(void)
|
||||
{
|
||||
extern consvar_t precachesound;
|
||||
|
||||
|
|
@ -1239,7 +1157,7 @@ void S_InitSfxChannels(INT32 sfxVolume)
|
|||
if (dedicated)
|
||||
return;
|
||||
|
||||
S_SetSfxVolume(sfxVolume);
|
||||
S_SetSfxVolume();
|
||||
|
||||
SetChannelsNum();
|
||||
|
||||
|
|
@ -2091,14 +2009,10 @@ void S_ResumeAudio(void)
|
|||
Music_UnPauseAll();
|
||||
}
|
||||
|
||||
void S_SetMusicVolume(INT32 digvolume)
|
||||
void S_SetMusicVolume(void)
|
||||
{
|
||||
if (digvolume < 0)
|
||||
digvolume = cv_digmusicvolume.value;
|
||||
|
||||
//CV_SetValue(&cv_digmusicvolume, digvolume);
|
||||
actualdigmusicvolume = digvolume;
|
||||
I_SetMusicVolume(digvolume);
|
||||
actualdigmusicvolume = cv_digmusicvolume.value;
|
||||
I_SetMusicVolume(actualdigmusicvolume);
|
||||
}
|
||||
|
||||
/// ------------------------
|
||||
|
|
@ -2219,8 +2133,8 @@ static void Command_RestartAudio_f(void)
|
|||
|
||||
// These must be called or no sound and music until manually set.
|
||||
|
||||
I_SetSfxVolume(cv_soundvolume.value);
|
||||
S_SetMusicVolume(cv_digmusicvolume.value);
|
||||
S_SetSfxVolume();
|
||||
S_SetMusicVolume();
|
||||
|
||||
S_StartSound(NULL, sfx_strpst);
|
||||
|
||||
|
|
@ -2392,7 +2306,7 @@ void GameSounds_OnChange(void)
|
|||
{
|
||||
sound_disabled = false;
|
||||
I_StartupSound(); // will return early if initialised
|
||||
S_InitSfxChannels(cv_soundvolume.value);
|
||||
S_InitSfxChannels();
|
||||
S_StartSound(NULL, sfx_strpst);
|
||||
}
|
||||
else
|
||||
|
|
@ -2431,7 +2345,7 @@ void PlayMusicIfUnfocused_OnChange(void)
|
|||
if (cv_playmusicifunfocused.value)
|
||||
I_SetMusicVolume(0);
|
||||
else
|
||||
S_InitMusicVolume();
|
||||
S_SetMusicVolume();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -98,7 +98,7 @@ void S_RegisterSoundStuff(void);
|
|||
// Initializes sound stuff, including volume
|
||||
// Sets channels, SFX, allocates channel buffer, sets S_sfx lookup.
|
||||
//
|
||||
void S_InitSfxChannels(INT32 sfxVolume);
|
||||
void S_InitSfxChannels(void);
|
||||
|
||||
//
|
||||
// Per level startup code.
|
||||
|
|
@ -237,10 +237,8 @@ FUNCMATH fixed_t S_CalculateSoundDistance(fixed_t px1, fixed_t py1, fixed_t pz1,
|
|||
|
||||
INT32 S_GetSoundVolume(sfxinfo_t *sfx, INT32 volume);
|
||||
|
||||
void S_SetSfxVolume(INT32 volume);
|
||||
void S_SetMusicVolume(INT32 digvolume);
|
||||
#define S_SetDigMusicVolume S_SetMusicVolume
|
||||
#define S_InitMusicVolume() S_SetMusicVolume(-1)
|
||||
void S_SetSfxVolume(void);
|
||||
void S_SetMusicVolume(void);
|
||||
|
||||
INT32 S_OriginPlaying(void *origin);
|
||||
INT32 S_IdPlaying(sfxenum_t id);
|
||||
|
|
@ -251,10 +249,8 @@ void S_StartSoundName(void *mo, const char *soundname);
|
|||
void S_StopSoundByID(void *origin, sfxenum_t sfx_id);
|
||||
void S_StopSoundByNum(sfxenum_t sfxnum);
|
||||
|
||||
#ifndef HW3SOUND
|
||||
#define S_StartAttackSound S_StartSound
|
||||
#define S_StartScreamSound S_StartSound
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
|
|
|
|||
|
|
@ -513,7 +513,7 @@ static void Impl_HandleWindowEvent(SDL_WindowEvent evt)
|
|||
// Tell game we got focus back, resume music if necessary
|
||||
window_notinfocus = false;
|
||||
|
||||
S_InitMusicVolume();
|
||||
S_SetMusicVolume();
|
||||
|
||||
if (!firsttimeonmouse)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue