Merge remote-tracking branch 'Base-Galaxy/Galaxy-Redux' into Glalxy
This commit is contained in:
commit
364f491b64
5 files changed
+336
-546
No files matched your search
+1
-1
@@ -256,7 +256,7 @@ consvar_t cv_ingamecap = {"ingamecap", "0", CV_NETVAR, ingamecap_cons_t, NULL, 0
|
||||
static CV_PossibleValue_t spectatorreentry_cons_t[] = {{0, "MIN"}, {10*60, "MAX"}, {0, NULL}};
|
||||
consvar_t cv_spectatorreentry = {"spectatorreentry", "30", CV_NETVAR, spectatorreentry_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
static CV_PossibleValue_t antigrief_cons_t[] = {{20, "MIN"}, {60, "MAX"}, {0, "Off"}, {0, NULL}};
|
||||
static CV_PossibleValue_t antigrief_cons_t[] = {{20, "MIN"}, {180, "MAX"}, {0, "Off"}, {0, NULL}};
|
||||
consvar_t cv_antigrief = {"antigrief", "30", CV_NETVAR, antigrief_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
consvar_t cv_startinglives = {"startinglives", "3", CV_NETVAR|CV_CHEAT|CV_NOSHOWHELP, startingliveslimit_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
+78
-24
@@ -94,10 +94,20 @@ typedef struct filetran_s
|
||||
{
|
||||
filetx_t *txlist; // Linked list of all files for the node
|
||||
UINT32 position; // The current position in the file
|
||||
FILE *currentfile; // The file currently being sent/received
|
||||
boolean init; // false if we want to reset position / open a new file
|
||||
} filetran_t;
|
||||
static filetran_t transfer[MAXNETNODES];
|
||||
|
||||
// The files currently being sent/received
|
||||
typedef struct fileused_s
|
||||
{
|
||||
FILE *file;
|
||||
UINT8 count;
|
||||
UINT32 position;
|
||||
} fileused_t;
|
||||
|
||||
static fileused_t transferFiles[UINT8_MAX + 1];
|
||||
|
||||
// Read time of file: stat _stmtime
|
||||
// Write time of file: utime
|
||||
|
||||
@@ -760,8 +770,19 @@ static void SV_EndFileSend(INT32 node)
|
||||
case SF_FILE: // It's a file, close it and free its filename
|
||||
if (cv_noticedownload.value)
|
||||
CONS_Printf("Ending file transfer (id %d) for node %d\n", p->fileid, node);
|
||||
if (transfer[node].currentfile)
|
||||
fclose(transfer[node].currentfile);
|
||||
if (transferFiles[p->fileid].file)
|
||||
{
|
||||
if (transferFiles[p->fileid].count > 0)
|
||||
{
|
||||
transferFiles[p->fileid].count--;
|
||||
}
|
||||
|
||||
if (transferFiles[p->fileid].count == 0)
|
||||
{
|
||||
fclose(transferFiles[p->fileid].file);
|
||||
transferFiles[p->fileid].file = NULL;
|
||||
}
|
||||
}
|
||||
free(p->id.filename);
|
||||
break;
|
||||
case SF_Z_RAM: // It's a memory block allocated with Z_Alloc or the likes, use Z_Free
|
||||
@@ -778,7 +799,7 @@ static void SV_EndFileSend(INT32 node)
|
||||
free(p);
|
||||
|
||||
// Indicate that the transmission is over
|
||||
transfer[node].currentfile = NULL;
|
||||
transfer[node].init = false;
|
||||
|
||||
filestosend--;
|
||||
}
|
||||
@@ -842,21 +863,31 @@ void SV_FileSendTicker(void)
|
||||
ram = f->ram;
|
||||
|
||||
// Open the file if it isn't open yet, or
|
||||
if (!transfer[i].currentfile)
|
||||
if (transfer[i].init == false)
|
||||
{
|
||||
if (!ram) // Sending a file
|
||||
{
|
||||
long filesize;
|
||||
|
||||
transfer[i].currentfile =
|
||||
fopen(f->id.filename, "rb");
|
||||
if (transferFiles[f->fileid].count == 0)
|
||||
{
|
||||
// It needs opened.
|
||||
transferFiles[f->fileid].file =
|
||||
fopen(f->id.filename, "rb");
|
||||
|
||||
if (!transfer[i].currentfile)
|
||||
I_Error("File %s does not exist",
|
||||
f->id.filename);
|
||||
if (!transferFiles[f->fileid].file)
|
||||
{
|
||||
I_Error("Can't open file %s: %s",
|
||||
f->id.filename, strerror(errno));
|
||||
}
|
||||
}
|
||||
|
||||
fseek(transfer[i].currentfile, 0, SEEK_END);
|
||||
filesize = ftell(transfer[i].currentfile);
|
||||
// Increment number of nodes using this file.
|
||||
I_Assert(transferFiles[f->fileid].count < UINT8_MAX);
|
||||
transferFiles[f->fileid].count++;
|
||||
|
||||
fseek(transferFiles[f->fileid].file, 0, SEEK_END);
|
||||
filesize = ftell(transferFiles[f->fileid].file);
|
||||
|
||||
// Nobody wants to transfer a file bigger
|
||||
// than 4GB!
|
||||
@@ -865,23 +896,43 @@ void SV_FileSendTicker(void)
|
||||
if (filesize == -1)
|
||||
I_Error("Error getting filesize of %s", f->id.filename);
|
||||
|
||||
f->size = (UINT32)filesize;
|
||||
fseek(transfer[i].currentfile, 0, SEEK_SET);
|
||||
f->size = transferFiles[f->fileid].position = (UINT32)filesize;
|
||||
}
|
||||
else // Sending RAM
|
||||
transfer[i].currentfile = (FILE *)1; // Set currentfile to a non-null value to indicate that it is open
|
||||
|
||||
transfer[i].position = 0;
|
||||
transfer[i].init = true; // Indicate that it is open
|
||||
}
|
||||
|
||||
if (!ram)
|
||||
{
|
||||
// Seek to the right position if we aren't already there.
|
||||
if (transferFiles[f->fileid].position != transfer[i].position)
|
||||
{
|
||||
fseek(transferFiles[f->fileid].file, transfer[i].position, SEEK_SET);
|
||||
}
|
||||
}
|
||||
|
||||
// Build a packet containing a file fragment
|
||||
p = &netbuffer->u.filetxpak;
|
||||
size = software_MAXPACKETLENGTH - (FILETXHEADER + BASEPACKETSIZE);
|
||||
if (f->size-transfer[i].position < size)
|
||||
size = f->size-transfer[i].position;
|
||||
|
||||
if (f->size - transfer[i].position < size)
|
||||
{
|
||||
size = f->size - transfer[i].position;
|
||||
}
|
||||
|
||||
if (ram)
|
||||
{
|
||||
M_Memcpy(p->data, &f->id.ram[transfer[i].position], size);
|
||||
else if (fread(p->data, 1, size, transfer[i].currentfile) != size)
|
||||
I_Error("SV_FileSendTicker: can't read %s byte on %s at %d because %s", sizeu1(size), f->id.filename, transfer[i].position, M_FileError(transfer[i].currentfile));
|
||||
}
|
||||
else if (fread(p->data, 1, size, transferFiles[f->fileid].file) != size)
|
||||
{
|
||||
I_Error("SV_FileSendTicker: can't read %s byte on %s at %d because %s",
|
||||
sizeu1(size), f->id.filename, transfer[i].position, M_FileError(transferFiles[f->fileid].file));
|
||||
|
||||
transferFiles[f->fileid].position = (UINT32)(transferFiles[f->fileid].position + size);
|
||||
}
|
||||
|
||||
p->position = LONG(transfer[i].position);
|
||||
// Put flag so receiver knows the total size
|
||||
if (transfer[i].position + size == f->size)
|
||||
@@ -891,15 +942,18 @@ void SV_FileSendTicker(void)
|
||||
|
||||
// Send the packet
|
||||
if (HSendPacket(i, true, 0, FILETXHEADER + size)) // Reliable SEND
|
||||
{ // Success
|
||||
{
|
||||
// Success
|
||||
transfer[i].position = (UINT32)(transfer[i].position + size);
|
||||
|
||||
if (transfer[i].position == f->size) // Finish?
|
||||
{
|
||||
SV_EndFileSend(i);
|
||||
}
|
||||
}
|
||||
else
|
||||
{ // Not sent for some odd reason, retry at next call
|
||||
if (!ram)
|
||||
fseek(transfer[i].currentfile,transfer[i].position, SEEK_SET);
|
||||
{
|
||||
// Not sent for some odd reason, retry at next call
|
||||
// Exit the while (can't send this one so why should i send the next?)
|
||||
break;
|
||||
}
|
||||
|
||||
+2
-2
@@ -149,8 +149,8 @@ extern char logfilename[1024];
|
||||
#else
|
||||
#define VERSION 1 // Game version
|
||||
#define SUBVERSION 6 // more precise version number
|
||||
#define VERSIONSTRING "Glalxy (1.6) #2"
|
||||
#define VERSIONSTRINGW L"Glalxy (1.6) #2"
|
||||
#define VERSIONSTRING "Glalxy (1.6) #3"
|
||||
#define VERSIONSTRINGW L"Glalxy (1.6) #3"
|
||||
// Hey! If you change this, add 1 to the MODVERSION below! Otherwise we can't force updates!
|
||||
// And change CMakeLists.txt (not src/, but in root), for CMake users!
|
||||
// AND appveyor.yml, for the build bots!
|
||||
|
||||
+8
-8
@@ -1301,29 +1301,29 @@ static menuitem_t OP_VideoOptionsMenu[] =
|
||||
{IT_HEADER, NULL, "Framerate", NULL, 55},
|
||||
|
||||
{IT_STRING | IT_CVAR, NULL, "Show FPS", &cv_ticrate, 60},
|
||||
{IT_STRING | IT_CVAR, NULL, "Vertical Sync", &cv_vidwait, 65},
|
||||
{IT_STRING | IT_CVAR, NULL, "FPS Cap", &cv_fpscap, 70},
|
||||
{IT_STRING | IT_CVAR, NULL, "Drift spark pulse size",&cv_driftsparkpulse, 75},
|
||||
{IT_STRING | IT_CVAR, NULL, "FPS Cap", &cv_fpscap, 65},
|
||||
{IT_STRING | IT_CVAR, NULL, "Drift spark pulse size",&cv_driftsparkpulse, 70},
|
||||
|
||||
#ifdef HWRENDER
|
||||
{IT_SUBMENU|IT_STRING, NULL, "OpenGL Options...", &OP_OpenGLOptionsDef, 85},
|
||||
{IT_SUBMENU|IT_STRING, NULL, "OpenGL Options...", &OP_OpenGLOptionsDef, 80},
|
||||
#endif
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
op_video_res = 0,
|
||||
op_video_header1 = 0,
|
||||
op_video_res,
|
||||
#if (defined (__unix__) && !defined (MSDOS)) || defined (UNIXCOMMON) || defined (HAVE_SDL)
|
||||
op_video_fullscreen,
|
||||
#endif
|
||||
op_video_gamma,
|
||||
op_video_vsync,
|
||||
op_video_header2,
|
||||
op_video_dd,
|
||||
op_video_wdd,
|
||||
//op_video_wd,
|
||||
op_video_skybox,
|
||||
op_video_fov,
|
||||
op_video_header3,
|
||||
op_video_fps,
|
||||
op_video_vsync,
|
||||
op_video_fpscap,
|
||||
op_video_driftsparkpulse,
|
||||
#ifdef HWRENDER
|
||||
|
||||
+247
-511
@@ -46,7 +46,7 @@ extern INT32 msg_id;
|
||||
// 3D Sound Interface
|
||||
#include "hardware/hw3sound.h"
|
||||
#else
|
||||
static INT32 S_AdjustSoundParams(const mobj_t *listener, const mobj_t *source, INT32 *vol, INT32 *sep, INT32 *pitch, sfxinfo_t *sfxinfo);
|
||||
static boolean S_AdjustSoundParams(const mobj_t *listener, const mobj_t *source, INT32 *vol, INT32 *sep, INT32 *pitch, sfxinfo_t *sfxinfo);
|
||||
#endif
|
||||
|
||||
CV_PossibleValue_t soundvolume_cons_t[] = {{0, "MIN"}, {31, "MAX"}, {0, NULL}};
|
||||
@@ -199,8 +199,6 @@ static INT32 S_getChannel(const void *origin, sfxinfo_t *sfxinfo)
|
||||
// channel number to use
|
||||
INT32 cnum;
|
||||
|
||||
channel_t *c;
|
||||
|
||||
// Find an open channel
|
||||
for (cnum = 0; cnum < numofchannels; cnum++)
|
||||
{
|
||||
@@ -212,7 +210,6 @@ static INT32 S_getChannel(const void *origin, sfxinfo_t *sfxinfo)
|
||||
else if (sfxinfo == channels[cnum].sfxinfo && (sfxinfo->pitch & SF_NOMULTIPLESOUND))
|
||||
{
|
||||
return -1;
|
||||
break;
|
||||
}
|
||||
else if (sfxinfo == channels[cnum].sfxinfo && sfxinfo->singularity == true)
|
||||
{
|
||||
@@ -256,12 +253,6 @@ static INT32 S_getChannel(const void *origin, sfxinfo_t *sfxinfo)
|
||||
}
|
||||
}
|
||||
|
||||
c = &channels[cnum];
|
||||
|
||||
// channel is decided to be cnum.
|
||||
c->sfxinfo = sfxinfo;
|
||||
c->origin = origin;
|
||||
|
||||
return cnum;
|
||||
}
|
||||
|
||||
@@ -420,7 +411,6 @@ void S_StopSoundByID(void *origin, sfxenum_t sfx_id)
|
||||
if (channels[cnum].sfxinfo == &S_sfx[sfx_id] && channels[cnum].origin == origin)
|
||||
{
|
||||
S_StopChannel(cnum);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -441,28 +431,42 @@ void S_StopSoundByNum(sfxenum_t sfxnum)
|
||||
if (channels[cnum].sfxinfo == &S_sfx[sfxnum])
|
||||
{
|
||||
S_StopChannel(cnum);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static INT32 S_ScaleVolumeWithSplitscreen(INT32 volume)
|
||||
{
|
||||
fixed_t root = INT32_MAX;
|
||||
|
||||
if (splitscreen == 0)
|
||||
{
|
||||
return volume;
|
||||
}
|
||||
|
||||
root = FixedSqrt((splitscreen + 1) * (FRACUNIT/3));
|
||||
|
||||
return FixedDiv(
|
||||
volume * FRACUNIT,
|
||||
root
|
||||
) / FRACUNIT;
|
||||
}
|
||||
|
||||
|
||||
void S_StartSoundAtVolume(const void *origin_p, sfxenum_t sfx_id, INT32 volume)
|
||||
{
|
||||
const INT32 initial_volume = volume;
|
||||
INT32 sep, pitch, priority, cnum;
|
||||
sfxinfo_t *sfx;
|
||||
const boolean reverse = (stereoreverse.value ^ encoremode);
|
||||
const mobj_t *origin = (const mobj_t *)origin_p;
|
||||
const boolean reverse = (stereoreverse.value ^ encoremode);
|
||||
const INT32 initial_volume = (origin ? S_ScaleVolumeWithSplitscreen(volume) : volume);
|
||||
|
||||
listener_t listener = {0,0,0,0};
|
||||
listener_t listener2 = {0,0,0,0};
|
||||
listener_t listener3 = {0,0,0,0};
|
||||
listener_t listener4 = {0,0,0,0};
|
||||
sfxinfo_t *sfx;
|
||||
INT32 sep, pitch, priority, cnum;
|
||||
boolean anyListeners = false;
|
||||
boolean itsUs = false;
|
||||
INT32 i;
|
||||
|
||||
mobj_t *listenmobj = democam.soundmobj ? : players[displayplayers[0]].mo;
|
||||
mobj_t *listenmobj2 = NULL;
|
||||
mobj_t *listenmobj3 = NULL;
|
||||
mobj_t *listenmobj4 = NULL;
|
||||
listener_t listener[MAXSPLITSCREENPLAYERS];
|
||||
mobj_t *listenmobj[MAXSPLITSCREENPLAYERS];
|
||||
|
||||
if (sound_disabled || !sound_started)
|
||||
return;
|
||||
@@ -471,27 +475,29 @@ void S_StartSoundAtVolume(const void *origin_p, sfxenum_t sfx_id, INT32 volume)
|
||||
if (sfx_id == sfx_None)
|
||||
return;
|
||||
|
||||
if (players[displayplayers[0]].awayviewtics)
|
||||
listenmobj = players[displayplayers[0]].awayviewmobj;
|
||||
|
||||
if (splitscreen)
|
||||
for (i = 0; i <= splitscreen; i++)
|
||||
{
|
||||
listenmobj2 = players[displayplayers[1]].mo;
|
||||
if (players[displayplayers[1]].awayviewtics)
|
||||
listenmobj2 = players[displayplayers[1]].awayviewmobj;
|
||||
player_t *player = &players[displayplayers[i]];
|
||||
|
||||
if (splitscreen > 1)
|
||||
memset(&listener[i], 0, sizeof (listener[i]));
|
||||
listenmobj[i] = NULL;
|
||||
|
||||
if (i == 0 && democam.soundmobj)
|
||||
{
|
||||
listenmobj3 = players[displayplayers[2]].mo;
|
||||
if (players[displayplayers[2]].awayviewtics)
|
||||
listenmobj3 = players[displayplayers[2]].awayviewmobj;
|
||||
listenmobj[i] = democam.soundmobj;
|
||||
}
|
||||
else if (player->awayviewtics)
|
||||
{
|
||||
listenmobj[i] = player->awayviewmobj;
|
||||
}
|
||||
else
|
||||
{
|
||||
listenmobj[i] = player->mo;
|
||||
}
|
||||
|
||||
if (splitscreen > 2)
|
||||
{
|
||||
listenmobj4 = players[displayplayers[3]].mo;
|
||||
if (players[displayplayers[3]].awayviewtics)
|
||||
listenmobj4 = players[displayplayers[3]].awayviewmobj;
|
||||
}
|
||||
if (origin && origin == listenmobj[i])
|
||||
{
|
||||
itsUs = true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -503,75 +509,32 @@ void S_StartSoundAtVolume(const void *origin_p, sfxenum_t sfx_id, INT32 volume)
|
||||
};
|
||||
#endif
|
||||
|
||||
if (camera[0].chase && !players[displayplayers[0]].awayviewtics)
|
||||
for (i = 0; i <= splitscreen; i++)
|
||||
{
|
||||
listener.x = camera[0].x;
|
||||
listener.y = camera[0].y;
|
||||
listener.z = camera[0].z;
|
||||
listener.angle = camera[0].angle;
|
||||
player_t *player = &players[displayplayers[i]];
|
||||
|
||||
if (camera[i].chase && !player->awayviewtics)
|
||||
{
|
||||
listener[i].x = camera[i].x;
|
||||
listener[i].y = camera[i].y;
|
||||
listener[i].z = camera[i].z;
|
||||
listener[i].angle = camera[i].angle;
|
||||
anyListeners = true;
|
||||
}
|
||||
else if (listenmobj[i])
|
||||
{
|
||||
listener[i].x = listenmobj[i]->x;
|
||||
listener[i].y = listenmobj[i]->y;
|
||||
listener[i].z = listenmobj[i]->z;
|
||||
listener[i].angle = listenmobj[i]->angle;
|
||||
anyListeners = true;
|
||||
}
|
||||
}
|
||||
else if (listenmobj)
|
||||
|
||||
if (origin && anyListeners == false)
|
||||
{
|
||||
listener.x = listenmobj->x;
|
||||
listener.y = listenmobj->y;
|
||||
listener.z = listenmobj->z;
|
||||
listener.angle = listenmobj->angle;
|
||||
}
|
||||
else if (origin)
|
||||
// If a mobj is trying to make a noise, and no one is around to hear it, does it make a sound?
|
||||
return;
|
||||
|
||||
if (listenmobj2)
|
||||
{
|
||||
if (camera[1].chase && !players[displayplayers[1]].awayviewtics)
|
||||
{
|
||||
listener2.x = camera[1].x;
|
||||
listener2.y = camera[1].y;
|
||||
listener2.z = camera[1].z;
|
||||
listener2.angle = camera[1].angle;
|
||||
}
|
||||
else
|
||||
{
|
||||
listener2.x = listenmobj2->x;
|
||||
listener2.y = listenmobj2->y;
|
||||
listener2.z = listenmobj2->z;
|
||||
listener2.angle = listenmobj2->angle;
|
||||
}
|
||||
}
|
||||
|
||||
if (listenmobj3)
|
||||
{
|
||||
if (camera[2].chase && !players[displayplayers[2]].awayviewtics)
|
||||
{
|
||||
listener3.x = camera[2].x;
|
||||
listener3.y = camera[2].y;
|
||||
listener3.z = camera[2].z;
|
||||
listener3.angle = camera[2].angle;
|
||||
}
|
||||
else
|
||||
{
|
||||
listener3.x = listenmobj3->x;
|
||||
listener3.y = listenmobj3->y;
|
||||
listener3.z = listenmobj3->z;
|
||||
listener3.angle = listenmobj3->angle;
|
||||
}
|
||||
}
|
||||
|
||||
if (listenmobj4)
|
||||
{
|
||||
if (camera[3].chase && !players[displayplayers[3]].awayviewtics)
|
||||
{
|
||||
listener4.x = camera[3].x;
|
||||
listener4.y = camera[3].y;
|
||||
listener4.z = camera[3].z;
|
||||
listener4.angle = camera[3].angle;
|
||||
}
|
||||
else
|
||||
{
|
||||
listener4.x = listenmobj4->x;
|
||||
listener4.y = listenmobj4->y;
|
||||
listener4.z = listenmobj4->z;
|
||||
listener4.angle = listenmobj4->angle;
|
||||
}
|
||||
}
|
||||
|
||||
// check for bogus sound #
|
||||
@@ -590,37 +553,51 @@ void S_StartSoundAtVolume(const void *origin_p, sfxenum_t sfx_id, INT32 volume)
|
||||
// Initialize sound parameters
|
||||
pitch = NORM_PITCH;
|
||||
priority = NORM_PRIORITY;
|
||||
sep = NORM_SEP;
|
||||
|
||||
if (splitscreen && origin)
|
||||
volume = FixedDiv(volume<<FRACBITS, FixedSqrt((splitscreen+1)<<FRACBITS))>>FRACBITS;
|
||||
i = 0; // sensible default
|
||||
|
||||
if (splitscreen && listenmobj2) // Copy the sound for the split player
|
||||
{
|
||||
// Check to see if it is audible, and if not, modify the params
|
||||
if (origin && origin != listenmobj2)
|
||||
if (origin && !itsUs)
|
||||
{
|
||||
INT32 rc;
|
||||
rc = S_AdjustSoundParams(listenmobj2, origin, &volume, &sep, &pitch, sfx);
|
||||
boolean audible = false;
|
||||
if (splitscreen > 0)
|
||||
{
|
||||
fixed_t recdist = INT32_MAX;
|
||||
UINT8 j = 0;
|
||||
|
||||
if (!rc)
|
||||
goto dontplay; // Maybe the other player can hear it...
|
||||
for (; j <= splitscreen; j++)
|
||||
{
|
||||
fixed_t thisdist = INT32_MAX;
|
||||
|
||||
if (origin->x == listener2.x && origin->y == listener2.y)
|
||||
sep = NORM_SEP;
|
||||
if (!listenmobj[j])
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
thisdist = P_AproxDistance(listener[j].x - origin->x, listener[j].y - origin->y);
|
||||
|
||||
if (thisdist >= recdist)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
recdist = thisdist;
|
||||
i = j;
|
||||
}
|
||||
}
|
||||
|
||||
if (listenmobj[i])
|
||||
{
|
||||
audible = S_AdjustSoundParams(listenmobj[i], origin, &volume, &sep, &pitch, sfx);
|
||||
}
|
||||
|
||||
if (!audible)
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
else if (!origin)
|
||||
// Do not play origin-less sounds for the second player.
|
||||
// The first player will be able to hear it just fine,
|
||||
// we really don't want it playing twice.
|
||||
goto dontplay;
|
||||
else
|
||||
sep = NORM_SEP;
|
||||
|
||||
// try to find a channel
|
||||
cnum = S_getChannel(origin, sfx);
|
||||
|
||||
if (cnum < 0)
|
||||
return; // If there's no free channels, it's not gonna be free for player 1, either.
|
||||
|
||||
// This is supposed to handle the loading/caching.
|
||||
// For some odd reason, the caching is done nearly
|
||||
@@ -629,185 +606,40 @@ void S_StartSoundAtVolume(const void *origin_p, sfxenum_t sfx_id, INT32 volume)
|
||||
// cache data if necessary
|
||||
// NOTE: set sfx->data NULL sfx->lump -1 to force a reload
|
||||
if (!sfx->data)
|
||||
{
|
||||
sfx->data = I_GetSfx(sfx);
|
||||
}
|
||||
|
||||
// increase the usefulness
|
||||
if (sfx->usefulness++ < 0)
|
||||
{
|
||||
sfx->usefulness = -1;
|
||||
}
|
||||
|
||||
// Avoid channel reverse if surround
|
||||
if (reverse
|
||||
#ifdef SURROUND
|
||||
&& sep != SURROUND_SEP
|
||||
#endif
|
||||
)
|
||||
sep = (~sep) & 255;
|
||||
|
||||
// Assigns the handle to one of the channels in the
|
||||
// mix/output buffer.
|
||||
channels[cnum].handle = I_StartSound(sfx_id, volume, sep, pitch, priority, cnum);
|
||||
}
|
||||
|
||||
dontplay:
|
||||
|
||||
if (splitscreen > 1 && listenmobj3) // Copy the sound for the third player
|
||||
{
|
||||
// Check to see if it is audible, and if not, modify the params
|
||||
if (origin && origin != listenmobj3)
|
||||
)
|
||||
{
|
||||
INT32 rc;
|
||||
rc = S_AdjustSoundParams(listenmobj3, origin, &volume, &sep, &pitch, sfx);
|
||||
|
||||
if (!rc)
|
||||
goto dontplay3; // Maybe the other player can hear it...
|
||||
|
||||
if (origin->x == listener3.x && origin->y == listener3.y)
|
||||
sep = NORM_SEP;
|
||||
sep = (~sep) & 255;
|
||||
}
|
||||
else if (!origin)
|
||||
// Do not play origin-less sounds for the second player.
|
||||
// The first player will be able to hear it just fine,
|
||||
// we really don't want it playing twice.
|
||||
goto dontplay3;
|
||||
else
|
||||
sep = NORM_SEP;
|
||||
|
||||
// try to find a channel
|
||||
// At this point it is determined that a sound can and should be played, so find a free channel to play it on
|
||||
cnum = S_getChannel(origin, sfx);
|
||||
|
||||
if (cnum < 0)
|
||||
return; // If there's no free channels, it's not gonna be free for player 1, either.
|
||||
|
||||
// This is supposed to handle the loading/caching.
|
||||
// For some odd reason, the caching is done nearly
|
||||
// each time the sound is needed?
|
||||
|
||||
// cache data if necessary
|
||||
// NOTE: set sfx->data NULL sfx->lump -1 to force a reload
|
||||
if (!sfx->data)
|
||||
sfx->data = I_GetSfx(sfx);
|
||||
|
||||
// increase the usefulness
|
||||
if (sfx->usefulness++ < 0)
|
||||
sfx->usefulness = -1;
|
||||
|
||||
// Avoid channel reverse if surround
|
||||
if (reverse
|
||||
#ifdef SURROUND
|
||||
&& sep != SURROUND_SEP
|
||||
#endif
|
||||
)
|
||||
sep = (~sep) & 255;
|
||||
|
||||
// Assigns the handle to one of the channels in the
|
||||
// mix/output buffer.
|
||||
channels[cnum].handle = I_StartSound(sfx_id, volume, sep, pitch, priority, cnum);
|
||||
}
|
||||
|
||||
dontplay3:
|
||||
|
||||
if (splitscreen > 2 && listenmobj4) // Copy the sound for the split player
|
||||
{
|
||||
// Check to see if it is audible, and if not, modify the params
|
||||
if (origin && origin != listenmobj4)
|
||||
{
|
||||
INT32 rc;
|
||||
rc = S_AdjustSoundParams(listenmobj4, origin, &volume, &sep, &pitch, sfx);
|
||||
|
||||
if (!rc)
|
||||
goto dontplay4; // Maybe the other player can hear it...
|
||||
|
||||
if (origin->x == listener4.x && origin->y == listener4.y)
|
||||
sep = NORM_SEP;
|
||||
return; // If there's no free channels, there won't be any for anymore players either
|
||||
}
|
||||
else if (!origin)
|
||||
// Do not play origin-less sounds for the second player.
|
||||
// The first player will be able to hear it just fine,
|
||||
// we really don't want it playing twice.
|
||||
goto dontplay4;
|
||||
else
|
||||
sep = NORM_SEP;
|
||||
|
||||
// try to find a channel
|
||||
cnum = S_getChannel(origin, sfx);
|
||||
|
||||
if (cnum < 0)
|
||||
return; // If there's no free channels, it's not gonna be free for player 1, either.
|
||||
|
||||
// This is supposed to handle the loading/caching.
|
||||
// For some odd reason, the caching is done nearly
|
||||
// each time the sound is needed?
|
||||
|
||||
// cache data if necessary
|
||||
// NOTE: set sfx->data NULL sfx->lump -1 to force a reload
|
||||
if (!sfx->data)
|
||||
sfx->data = I_GetSfx(sfx);
|
||||
|
||||
// increase the usefulness
|
||||
if (sfx->usefulness++ < 0)
|
||||
sfx->usefulness = -1;
|
||||
|
||||
// Avoid channel reverse if surround
|
||||
if (reverse
|
||||
#ifdef SURROUND
|
||||
&& sep != SURROUND_SEP
|
||||
#endif
|
||||
)
|
||||
sep = (~sep) & 255;
|
||||
|
||||
// Assigns the handle to one of the channels in the
|
||||
// mix/output buffer.
|
||||
// Now that we know we are going to play a sound, fill out this info
|
||||
channels[cnum].sfxinfo = sfx;
|
||||
channels[cnum].origin = origin;
|
||||
channels[cnum].volume = initial_volume;
|
||||
channels[cnum].handle = I_StartSound(sfx_id, volume, sep, pitch, priority, cnum);
|
||||
}
|
||||
|
||||
dontplay4:
|
||||
|
||||
// Check to see if it is audible, and if not, modify the params
|
||||
if (origin && origin != listenmobj)
|
||||
{
|
||||
INT32 rc;
|
||||
rc = S_AdjustSoundParams(listenmobj, origin, &volume, &sep, &pitch, sfx);
|
||||
|
||||
if (!rc)
|
||||
return;
|
||||
|
||||
if (origin->x == listener.x && origin->y == listener.y)
|
||||
sep = NORM_SEP;
|
||||
}
|
||||
else
|
||||
sep = NORM_SEP;
|
||||
|
||||
// try to find a channel
|
||||
cnum = S_getChannel(origin, sfx);
|
||||
|
||||
if (cnum < 0)
|
||||
return;
|
||||
|
||||
// This is supposed to handle the loading/caching.
|
||||
// For some odd reason, the caching is done nearly
|
||||
// each time the sound is needed?
|
||||
|
||||
// cache data if necessary
|
||||
// NOTE: set sfx->data NULL sfx->lump -1 to force a reload
|
||||
if (!sfx->data)
|
||||
sfx->data = I_GetSfx(sfx);
|
||||
|
||||
// increase the usefulness
|
||||
if (sfx->usefulness++ < 0)
|
||||
sfx->usefulness = -1;
|
||||
|
||||
// Avoid channel reverse if surround
|
||||
if (reverse
|
||||
#ifdef SURROUND
|
||||
&& sep != SURROUND_SEP
|
||||
#endif
|
||||
)
|
||||
sep = (~sep) & 255;
|
||||
|
||||
// Assigns the handle to one of the channels in the
|
||||
// mix/output buffer.
|
||||
channels[cnum].volume = initial_volume;
|
||||
channels[cnum].handle = I_StartSound(sfx_id, volume, sep, pitch, priority, cnum);
|
||||
}
|
||||
|
||||
void S_StartSound(const void *origin, sfxenum_t sfx_id)
|
||||
@@ -897,7 +729,6 @@ void S_StopSound(void *origin)
|
||||
if (channels[cnum].sfxinfo && channels[cnum].origin == origin)
|
||||
{
|
||||
S_StopChannel(cnum);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -913,23 +744,13 @@ static INT32 actualmidimusicvolume;
|
||||
|
||||
void S_UpdateSounds(void)
|
||||
{
|
||||
INT32 audible, cnum, volume, sep, pitch;
|
||||
INT32 cnum, volume, sep, pitch;
|
||||
boolean audible = false;
|
||||
channel_t *c;
|
||||
INT32 i;
|
||||
|
||||
listener_t listener;
|
||||
listener_t listener2;
|
||||
listener_t listener3;
|
||||
listener_t listener4;
|
||||
|
||||
mobj_t *listenmobj = democam.soundmobj ? : players[displayplayers[0]].mo;
|
||||
mobj_t *listenmobj2 = NULL;
|
||||
mobj_t *listenmobj3 = NULL;
|
||||
mobj_t *listenmobj4 = NULL;
|
||||
|
||||
memset(&listener, 0, sizeof(listener_t));
|
||||
memset(&listener2, 0, sizeof(listener_t));
|
||||
memset(&listener3, 0, sizeof(listener_t));
|
||||
memset(&listener4, 0, sizeof(listener_t));
|
||||
listener_t listener[MAXSPLITSCREENPLAYERS];
|
||||
mobj_t *listenmobj[MAXSPLITSCREENPLAYERS];
|
||||
|
||||
// Update sound/music volumes, if changed manually at console
|
||||
if (actualsfxvolume != cv_soundvolume.value)
|
||||
@@ -946,7 +767,7 @@ void S_UpdateSounds(void)
|
||||
{
|
||||
#ifndef NOMUMBLE
|
||||
// Stop Mumble cutting out. I'm sick of it.
|
||||
I_UpdateMumble(NULL, listener);
|
||||
I_UpdateMumble(NULL, listener[0]);
|
||||
#endif
|
||||
|
||||
// Stop cutting FMOD out. WE'RE sick of it.
|
||||
@@ -957,47 +778,31 @@ void S_UpdateSounds(void)
|
||||
if (dedicated || sound_disabled)
|
||||
return;
|
||||
|
||||
if (players[displayplayers[0]].awayviewtics)
|
||||
listenmobj = players[displayplayers[0]].awayviewmobj;
|
||||
|
||||
if (splitscreen)
|
||||
for (i = 0; i <= splitscreen; i++)
|
||||
{
|
||||
listenmobj2 = players[displayplayers[1]].mo;
|
||||
if (players[displayplayers[1]].awayviewtics)
|
||||
listenmobj2 = players[displayplayers[1]].awayviewmobj;
|
||||
player_t *player = &players[displayplayers[i]];
|
||||
|
||||
if (splitscreen > 1)
|
||||
memset(&listener[i], 0, sizeof (listener[i]));
|
||||
listenmobj[i] = NULL;
|
||||
|
||||
if (i == 0 && democam.soundmobj)
|
||||
{
|
||||
listenmobj3 = players[displayplayers[2]].mo;
|
||||
if (players[displayplayers[2]].awayviewtics)
|
||||
listenmobj3 = players[displayplayers[2]].awayviewmobj;
|
||||
listenmobj[i] = democam.soundmobj;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (splitscreen > 2)
|
||||
{
|
||||
listenmobj4 = players[displayplayers[3]].mo;
|
||||
if (players[displayplayers[3]].awayviewtics)
|
||||
listenmobj4 = players[displayplayers[3]].awayviewmobj;
|
||||
}
|
||||
if (player->awayviewtics)
|
||||
{
|
||||
listenmobj[i] = player->awayviewmobj;
|
||||
}
|
||||
else
|
||||
{
|
||||
listenmobj[i] = player->mo;
|
||||
}
|
||||
}
|
||||
|
||||
if (camera[0].chase && !players[displayplayers[0]].awayviewtics)
|
||||
{
|
||||
listener.x = camera[0].x;
|
||||
listener.y = camera[0].y;
|
||||
listener.z = camera[0].z;
|
||||
listener.angle = camera[0].angle;
|
||||
}
|
||||
else if (listenmobj)
|
||||
{
|
||||
listener.x = listenmobj->x;
|
||||
listener.y = listenmobj->y;
|
||||
listener.z = listenmobj->z;
|
||||
listener.angle = listenmobj->angle;
|
||||
}
|
||||
|
||||
#ifndef NOMUMBLE
|
||||
I_UpdateMumble(players[consoleplayer].mo, listener);
|
||||
I_UpdateMumble(players[consoleplayer].mo, listener[0]);
|
||||
#endif
|
||||
|
||||
#ifdef HW3SOUND
|
||||
@@ -1009,57 +814,23 @@ void S_UpdateSounds(void)
|
||||
}
|
||||
#endif
|
||||
|
||||
if (listenmobj2)
|
||||
for (i = 0; i <= splitscreen; i++)
|
||||
{
|
||||
if (camera[1].chase && !players[displayplayers[1]].awayviewtics)
|
||||
{
|
||||
listener2.x = camera[1].x;
|
||||
listener2.y = camera[1].y;
|
||||
listener2.z = camera[1].z;
|
||||
listener2.angle = camera[1].angle;
|
||||
}
|
||||
else
|
||||
{
|
||||
listener2.x = listenmobj2->x;
|
||||
listener2.y = listenmobj2->y;
|
||||
listener2.z = listenmobj2->z;
|
||||
listener2.angle = listenmobj2->angle;
|
||||
}
|
||||
}
|
||||
player_t *player = &players[displayplayers[i]];
|
||||
|
||||
if (listenmobj3)
|
||||
{
|
||||
if (camera[2].chase && !players[displayplayers[2]].awayviewtics)
|
||||
if (camera[i].chase && !player->awayviewtics)
|
||||
{
|
||||
listener3.x = camera[2].x;
|
||||
listener3.y = camera[2].y;
|
||||
listener3.z = camera[2].z;
|
||||
listener3.angle = camera[2].angle;
|
||||
listener[i].x = camera[i].x;
|
||||
listener[i].y = camera[i].y;
|
||||
listener[i].z = camera[i].z;
|
||||
listener[i].angle = camera[i].angle;
|
||||
}
|
||||
else
|
||||
else if (listenmobj[i])
|
||||
{
|
||||
listener3.x = listenmobj3->x;
|
||||
listener3.y = listenmobj3->y;
|
||||
listener3.z = listenmobj3->z;
|
||||
listener3.angle = listenmobj3->angle;
|
||||
}
|
||||
}
|
||||
|
||||
if (listenmobj4)
|
||||
{
|
||||
if (camera[3].chase && !players[displayplayers[3]].awayviewtics)
|
||||
{
|
||||
listener4.x = camera[3].x;
|
||||
listener4.y = camera[3].y;
|
||||
listener4.z = camera[3].z;
|
||||
listener4.angle = camera[3].angle;
|
||||
}
|
||||
else
|
||||
{
|
||||
listener4.x = listenmobj4->x;
|
||||
listener4.y = listenmobj4->y;
|
||||
listener4.z = listenmobj4->z;
|
||||
listener4.angle = listenmobj4->angle;
|
||||
listener[i].x = listenmobj[i]->x;
|
||||
listener[i].y = listenmobj[i]->y;
|
||||
listener[i].z = listenmobj[i]->z;
|
||||
listener[i].angle = listenmobj[i]->angle;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1076,83 +847,60 @@ void S_UpdateSounds(void)
|
||||
pitch = NORM_PITCH;
|
||||
sep = NORM_SEP;
|
||||
|
||||
if (splitscreen && c->origin)
|
||||
volume = FixedDiv(volume<<FRACBITS, FixedSqrt((splitscreen+1)<<FRACBITS))>>FRACBITS;
|
||||
|
||||
// check non-local sounds for distance clipping
|
||||
// or modify their params
|
||||
if (c->origin && ((c->origin != players[consoleplayer].mo)
|
||||
|| (splitscreen && c->origin != players[displayplayers[1]].mo)
|
||||
|| (splitscreen > 1 && c->origin != players[displayplayers[2]].mo)
|
||||
|| (splitscreen > 2 && c->origin != players[displayplayers[3]].mo)))
|
||||
if (c->origin)
|
||||
{
|
||||
// Whomever is closer gets the sound, but only in splitscreen.
|
||||
if (splitscreen)
|
||||
boolean itsUs = false;
|
||||
|
||||
for (i = splitscreen; i >= 0; i--)
|
||||
{
|
||||
const mobj_t *soundmobj = c->origin;
|
||||
fixed_t recdist = -1;
|
||||
INT32 i, p = -1;
|
||||
if (c->origin != listenmobj[i])
|
||||
continue;
|
||||
|
||||
for (i = 0; i <= splitscreen; i++)
|
||||
{
|
||||
fixed_t thisdist = -1;
|
||||
|
||||
if (i == 0 && listenmobj)
|
||||
thisdist = P_AproxDistance(listener.x-soundmobj->x, listener.y-soundmobj->y);
|
||||
else if (i == 1 && listenmobj2)
|
||||
thisdist = P_AproxDistance(listener2.x-soundmobj->x, listener2.y-soundmobj->y);
|
||||
else if (i == 2 && listenmobj3)
|
||||
thisdist = P_AproxDistance(listener3.x-soundmobj->x, listener3.y-soundmobj->y);
|
||||
else if (i == 3 && listenmobj4)
|
||||
thisdist = P_AproxDistance(listener4.x-soundmobj->x, listener4.y-soundmobj->y);
|
||||
else
|
||||
continue;
|
||||
|
||||
if (recdist == -1 || (thisdist != -1 && thisdist < recdist))
|
||||
{
|
||||
recdist = thisdist;
|
||||
p = i;
|
||||
}
|
||||
}
|
||||
|
||||
if (p != -1)
|
||||
{
|
||||
if (p == 1)
|
||||
{
|
||||
// Player 2 gets the sound
|
||||
audible = S_AdjustSoundParams(listenmobj2, c->origin, &volume, &sep, &pitch,
|
||||
c->sfxinfo);
|
||||
}
|
||||
else if (p == 2)
|
||||
{
|
||||
// Player 3 gets the sound
|
||||
audible = S_AdjustSoundParams(listenmobj3, c->origin, &volume, &sep, &pitch,
|
||||
c->sfxinfo);
|
||||
}
|
||||
else if (p == 3)
|
||||
{
|
||||
// Player 4 gets the sound
|
||||
audible = S_AdjustSoundParams(listenmobj4, c->origin, &volume, &sep, &pitch,
|
||||
c->sfxinfo);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Player 1 gets the sound
|
||||
audible = S_AdjustSoundParams(listenmobj, c->origin, &volume, &sep, &pitch,
|
||||
c->sfxinfo);
|
||||
}
|
||||
|
||||
if (audible)
|
||||
I_UpdateSoundParams(c->handle, volume, sep, pitch);
|
||||
else
|
||||
S_StopChannel(cnum);
|
||||
}
|
||||
itsUs = true;
|
||||
}
|
||||
else if (listenmobj && !splitscreen)
|
||||
|
||||
if (itsUs == false)
|
||||
{
|
||||
// In the case of a single player, he or she always should get updated sound.
|
||||
audible = S_AdjustSoundParams(listenmobj, c->origin, &volume, &sep, &pitch,
|
||||
c->sfxinfo);
|
||||
const mobj_t *origin = c->origin;
|
||||
|
||||
i = 0;
|
||||
|
||||
if (splitscreen > 0)
|
||||
{
|
||||
fixed_t recdist = INT32_MAX;
|
||||
UINT8 j = 0;
|
||||
|
||||
for (; j <= splitscreen; j++)
|
||||
{
|
||||
fixed_t thisdist = INT32_MAX;
|
||||
|
||||
if (!listenmobj[j])
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
thisdist = P_AproxDistance(listener[j].x - origin->x, listener[j].y - origin->y);
|
||||
|
||||
if (thisdist >= recdist)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
recdist = thisdist;
|
||||
i = j;
|
||||
}
|
||||
}
|
||||
|
||||
if (listenmobj[i])
|
||||
{
|
||||
audible = S_AdjustSoundParams(
|
||||
listenmobj[i], c->origin,
|
||||
&volume, &sep, &pitch,
|
||||
c->sfxinfo
|
||||
);
|
||||
}
|
||||
|
||||
if (audible)
|
||||
I_UpdateSoundParams(c->handle, volume, sep, pitch);
|
||||
@@ -1255,54 +1003,38 @@ fixed_t S_CalculateSoundDistance(fixed_t sx1, fixed_t sy1, fixed_t sz1, fixed_t
|
||||
// If the sound is not audible, returns a 0.
|
||||
// Otherwise, modifies parameters and returns 1.
|
||||
//
|
||||
INT32 S_AdjustSoundParams(const mobj_t *listener, const mobj_t *source, INT32 *vol, INT32 *sep, INT32 *pitch,
|
||||
boolean S_AdjustSoundParams(const mobj_t *listener, const mobj_t *source, INT32 *vol, INT32 *sep, INT32 *pitch,
|
||||
sfxinfo_t *sfxinfo)
|
||||
{
|
||||
fixed_t approx_dist;
|
||||
angle_t angle;
|
||||
|
||||
listener_t listensource;
|
||||
|
||||
const boolean reverse = (stereoreverse.value ^ encoremode);
|
||||
|
||||
fixed_t approx_dist;
|
||||
|
||||
listener_t listensource;
|
||||
INT32 i;
|
||||
|
||||
(void)pitch;
|
||||
|
||||
if (!listener)
|
||||
return false;
|
||||
|
||||
if (listener == players[displayplayers[0]].mo && camera[0].chase)
|
||||
// Init listensource with default listener
|
||||
listensource.x = listener->x;
|
||||
listensource.y = listener->y;
|
||||
listensource.z = listener->z;
|
||||
listensource.angle = listener->angle;
|
||||
|
||||
for (i = 0; i <= splitscreen; i++)
|
||||
{
|
||||
listensource.x = camera[0].x;
|
||||
listensource.y = camera[0].y;
|
||||
listensource.z = camera[0].z;
|
||||
listensource.angle = camera[0].angle;
|
||||
}
|
||||
else if (splitscreen && listener == players[displayplayers[1]].mo && camera[1].chase)
|
||||
{
|
||||
listensource.x = camera[1].x;
|
||||
listensource.y = camera[1].y;
|
||||
listensource.z = camera[1].z;
|
||||
listensource.angle = camera[1].angle;
|
||||
}
|
||||
else if (splitscreen > 1 && listener == players[displayplayers[2]].mo && camera[2].chase)
|
||||
{
|
||||
listensource.x = camera[2].x;
|
||||
listensource.y = camera[2].y;
|
||||
listensource.z = camera[2].z;
|
||||
listensource.angle = camera[2].angle;
|
||||
}
|
||||
else if (splitscreen > 2 && listener == players[displayplayers[3]].mo && camera[3].chase)
|
||||
{
|
||||
listensource.x = camera[3].x;
|
||||
listensource.y = camera[3].y;
|
||||
listensource.z = camera[3].z;
|
||||
listensource.angle = camera[3].angle;
|
||||
}
|
||||
else
|
||||
{
|
||||
listensource.x = listener->x;
|
||||
listensource.y = listener->y;
|
||||
listensource.z = listener->z;
|
||||
listensource.angle = listener->angle;
|
||||
// If listener is a chasecam player, use the camera instead
|
||||
if (listener == players[displayplayers[i]].mo && camera[i].chase)
|
||||
{
|
||||
listensource.x = camera[i].x;
|
||||
listensource.y = camera[i].y;
|
||||
listensource.z = camera[i].z;
|
||||
listensource.angle = camera[i].angle;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (sfxinfo->pitch & SF_OUTSIDESOUND) // Rain special case
|
||||
@@ -1352,30 +1084,37 @@ INT32 S_AdjustSoundParams(const mobj_t *listener, const mobj_t *source, INT32 *v
|
||||
approx_dist = FixedDiv(approx_dist,2*FRACUNIT);
|
||||
|
||||
if (approx_dist > S_CLIPPING_DIST)
|
||||
return 0;
|
||||
return false;
|
||||
|
||||
// angle of source to listener
|
||||
angle = R_PointToAngle2(listensource.x, listensource.y, source->x, source->y);
|
||||
|
||||
if (angle > listensource.angle)
|
||||
angle = angle - listensource.angle;
|
||||
if (source->x == listensource.x && source->y == listensource.y)
|
||||
{
|
||||
*sep = NORM_SEP;
|
||||
}
|
||||
else
|
||||
angle = angle + InvAngle(listensource.angle);
|
||||
{
|
||||
// angle of source to listener
|
||||
angle_t angle = R_PointToAngle2(listensource.x, listensource.y, source->x, source->y);
|
||||
|
||||
if (reverse)
|
||||
angle = InvAngle(angle);
|
||||
if (angle > listensource.angle)
|
||||
angle = angle - listensource.angle;
|
||||
else
|
||||
angle = angle + InvAngle(listensource.angle);
|
||||
|
||||
if (reverse)
|
||||
angle = InvAngle(angle);
|
||||
|
||||
#ifdef SURROUND
|
||||
// Produce a surround sound for angle from 105 till 255
|
||||
if (surround.value == 1 && (angle > ANG105 && angle < ANG255 ))
|
||||
*sep = SURROUND_SEP;
|
||||
else
|
||||
// Produce a surround sound for angle from 105 till 255
|
||||
if (surround.value == 1 && (angle > ANG105 && angle < ANG255 ))
|
||||
*sep = SURROUND_SEP;
|
||||
else
|
||||
#endif
|
||||
{
|
||||
angle >>= ANGLETOFINESHIFT;
|
||||
{
|
||||
angle >>= ANGLETOFINESHIFT;
|
||||
|
||||
// stereo separation
|
||||
*sep = 128 - (FixedMul(S_STEREO_SWING, FINESINE(angle))>>FRACBITS);
|
||||
// stereo separation
|
||||
*sep = 128 - (FixedMul(S_STEREO_SWING, FINESINE(angle))>>FRACBITS);
|
||||
}
|
||||
}
|
||||
|
||||
// volume calculation
|
||||
@@ -1387,9 +1126,6 @@ INT32 S_AdjustSoundParams(const mobj_t *listener, const mobj_t *source, INT32 *v
|
||||
*vol = FixedMul(*vol * FRACUNIT / 255, n) / S_ATTENUATOR;
|
||||
}
|
||||
|
||||
if (splitscreen)
|
||||
*vol = FixedDiv((*vol)<<FRACBITS, FixedSqrt((splitscreen+1)<<FRACBITS))>>FRACBITS;
|
||||
|
||||
return (*vol > 0);
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user