mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2026-04-28 04:51:42 +00:00
Merge branch 'split-somethings' into 'master'
Split Somethings Closes #237 and #233 See merge request KartKrew/Kart!572
This commit is contained in:
commit
346a93475d
2 changed files with 84 additions and 49 deletions
|
|
@ -921,8 +921,8 @@ void R_DrawSinglePlane(visplane_t *pl)
|
||||||
|
|
||||||
if (top < 0)
|
if (top < 0)
|
||||||
top = 0;
|
top = 0;
|
||||||
if (bottom > vid.height)
|
if (bottom > viewheight)
|
||||||
bottom = vid.height;
|
bottom = viewheight;
|
||||||
|
|
||||||
// Only copy the part of the screen we need
|
// Only copy the part of the screen we need
|
||||||
for (i = 0; i <= r_splitscreen; i++)
|
for (i = 0; i <= r_splitscreen; i++)
|
||||||
|
|
@ -956,9 +956,10 @@ void R_DrawSinglePlane(visplane_t *pl)
|
||||||
offset = (scry*vid.width) + scrx;
|
offset = (scry*vid.width) + scrx;
|
||||||
|
|
||||||
// No idea if this works
|
// No idea if this works
|
||||||
VID_BlitLinearScreen(screens[0] + offset, screens[1] + offset,
|
VID_BlitLinearScreen(screens[0] + offset,
|
||||||
viewwidth, bottom-top,
|
screens[1] + (top*vid.width), // intentionally not +offset
|
||||||
vid.width, vid.width);
|
viewwidth, bottom-top,
|
||||||
|
vid.width, vid.width);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
122
src/s_sound.c
122
src/s_sound.c
|
|
@ -520,6 +520,7 @@ void S_StartSoundAtVolume(const void *origin_p, sfxenum_t sfx_id, INT32 volume)
|
||||||
sfxinfo_t *sfx;
|
sfxinfo_t *sfx;
|
||||||
INT32 sep, pitch, priority, cnum;
|
INT32 sep, pitch, priority, cnum;
|
||||||
boolean anyListeners = false;
|
boolean anyListeners = false;
|
||||||
|
boolean itsUs = false;
|
||||||
INT32 i;
|
INT32 i;
|
||||||
|
|
||||||
listener_t listener[MAXSPLITSCREENPLAYERS];
|
listener_t listener[MAXSPLITSCREENPLAYERS];
|
||||||
|
|
@ -557,6 +558,11 @@ void S_StartSoundAtVolume(const void *origin_p, sfxenum_t sfx_id, INT32 volume)
|
||||||
{
|
{
|
||||||
listenmobj[i] = player->mo;
|
listenmobj[i] = player->mo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (origin && origin == listenmobj[i])
|
||||||
|
{
|
||||||
|
itsUs = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HW3SOUND
|
#ifdef HW3SOUND
|
||||||
|
|
@ -616,40 +622,56 @@ void S_StartSoundAtVolume(const void *origin_p, sfxenum_t sfx_id, INT32 volume)
|
||||||
// Initialize sound parameters
|
// Initialize sound parameters
|
||||||
pitch = NORM_PITCH;
|
pitch = NORM_PITCH;
|
||||||
priority = NORM_PRIORITY;
|
priority = NORM_PRIORITY;
|
||||||
|
sep = NORM_SEP;
|
||||||
|
|
||||||
|
i = 0; // sensible default
|
||||||
|
|
||||||
for (i = r_splitscreen; i >= 0; i--)
|
|
||||||
{
|
{
|
||||||
// Copy the sound for the splitscreen players!
|
|
||||||
if (listenmobj[i] == NULL && i != 0)
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check to see if it is audible, and if not, modify the params
|
// Check to see if it is audible, and if not, modify the params
|
||||||
if (origin && origin != listenmobj[i])
|
if (origin && !itsUs)
|
||||||
{
|
{
|
||||||
boolean rc = S_AdjustSoundParams(listenmobj[i], origin, &volume, &sep, &pitch, sfx);
|
boolean audible = false;
|
||||||
|
|
||||||
if (!rc)
|
if (r_splitscreen > 0)
|
||||||
{
|
{
|
||||||
continue; // Maybe the other player can hear it...
|
fixed_t recdist = INT32_MAX;
|
||||||
|
UINT8 j = 0;
|
||||||
|
|
||||||
|
for (; j <= r_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 (origin->x == listener[i].x && origin->y == listener[i].y)
|
if (listenmobj[i])
|
||||||
{
|
{
|
||||||
sep = NORM_SEP;
|
audible = S_AdjustSoundParams(listenmobj[i], origin, &volume, &sep, &pitch, sfx);
|
||||||
|
|
||||||
|
if (origin->x == listener[i].x && origin->y == listener[i].y)
|
||||||
|
{
|
||||||
|
sep = NORM_SEP;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!audible)
|
||||||
|
{
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else if (i > 0 && !origin)
|
|
||||||
{
|
|
||||||
// Do not play origin-less sounds for the splitscreen players.
|
|
||||||
// The first player will be able to hear it just fine,
|
|
||||||
// we really don't want it playing twice.
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
sep = NORM_SEP;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// This is supposed to handle the loading/caching.
|
// This is supposed to handle the loading/caching.
|
||||||
|
|
@ -857,46 +879,58 @@ void S_UpdateSounds(void)
|
||||||
{
|
{
|
||||||
boolean itsUs = false;
|
boolean itsUs = false;
|
||||||
|
|
||||||
for (i = 0; i <= r_splitscreen; i++)
|
for (i = r_splitscreen; i >= 0; i--)
|
||||||
{
|
{
|
||||||
if (c->origin == players[displayplayers[i]].mo)
|
if (c->origin != listenmobj[i])
|
||||||
{
|
continue;
|
||||||
itsUs = true;
|
|
||||||
break;
|
itsUs = true;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (itsUs == false)
|
if (itsUs == false)
|
||||||
{
|
{
|
||||||
const mobj_t *soundmobj = c->origin;
|
const mobj_t *origin = c->origin;
|
||||||
fixed_t recdist = INT32_MAX;
|
|
||||||
UINT8 p = 0;
|
|
||||||
|
|
||||||
for (i = 0; i <= r_splitscreen; i++)
|
i = 0;
|
||||||
|
|
||||||
|
if (r_splitscreen > 0)
|
||||||
{
|
{
|
||||||
fixed_t thisdist = INT32_MAX;
|
fixed_t recdist = INT32_MAX;
|
||||||
|
UINT8 j = 0;
|
||||||
|
|
||||||
if (!listenmobj[i])
|
for (; j <= r_splitscreen; j++)
|
||||||
{
|
{
|
||||||
continue;
|
fixed_t thisdist = INT32_MAX;
|
||||||
}
|
|
||||||
|
|
||||||
thisdist = P_AproxDistance(listener[i].x - soundmobj->x, listener[i].y - soundmobj->y);
|
if (!listenmobj[j])
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
thisdist = P_AproxDistance(listener[j].x - origin->x, listener[j].y - origin->y);
|
||||||
|
|
||||||
|
if (thisdist >= recdist)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (thisdist < recdist)
|
|
||||||
{
|
|
||||||
recdist = thisdist;
|
recdist = thisdist;
|
||||||
p = i;
|
i = j;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (listenmobj[p])
|
if (listenmobj[i])
|
||||||
{
|
{
|
||||||
audible = S_AdjustSoundParams(
|
audible = S_AdjustSoundParams(
|
||||||
listenmobj[p], c->origin,
|
listenmobj[i], c->origin,
|
||||||
&volume, &sep, &pitch,
|
&volume, &sep, &pitch,
|
||||||
c->sfxinfo
|
c->sfxinfo
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if (origin->x == listener[i].x && origin->y == listener[i].y)
|
||||||
|
{
|
||||||
|
sep = NORM_SEP;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (audible)
|
if (audible)
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue