mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2026-04-27 04:21:47 +00:00
Fix sound handling in demo freecam
- Object sounds are audible from the location of the camera - Certain HUD sounds should no longer be audible - For instance, lap complete sfx
This commit is contained in:
parent
5a40f554d4
commit
dbca307ad4
4 changed files with 17 additions and 28 deletions
|
|
@ -4129,7 +4129,6 @@ void G_StopDemo(void)
|
||||||
demo.freecam = false;
|
demo.freecam = false;
|
||||||
// reset democam shit too:
|
// reset democam shit too:
|
||||||
democam.cam = NULL;
|
democam.cam = NULL;
|
||||||
democam.soundmobj = NULL;
|
|
||||||
democam.localangle = 0;
|
democam.localangle = 0;
|
||||||
democam.localaiming = 0;
|
democam.localaiming = 0;
|
||||||
democam.keyboardlook = false;
|
democam.keyboardlook = false;
|
||||||
|
|
|
||||||
|
|
@ -135,7 +135,6 @@ struct camera_t
|
||||||
struct demofreecam_s {
|
struct demofreecam_s {
|
||||||
|
|
||||||
camera_t *cam; // this is useful when the game is paused, notably
|
camera_t *cam; // this is useful when the game is paused, notably
|
||||||
mobj_t *soundmobj; // mobj to play sound from, used in s_sound
|
|
||||||
|
|
||||||
angle_t localangle; // keeps track of the cam angle for cmds
|
angle_t localangle; // keeps track of the cam angle for cmds
|
||||||
angle_t localaiming; // ditto with aiming
|
angle_t localaiming; // ditto with aiming
|
||||||
|
|
|
||||||
20
src/p_user.c
20
src/p_user.c
|
|
@ -1082,6 +1082,15 @@ boolean P_IsDisplayPlayer(player_t *player)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Freecam still techically has a player in
|
||||||
|
// displayplayers. But since the camera is detached, it
|
||||||
|
// would be weird if sounds were heard from that player's
|
||||||
|
// perspective.
|
||||||
|
if (demo.freecam)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
for (i = 0; i <= r_splitscreen; i++) // DON'T skip P1
|
for (i = 0; i <= r_splitscreen; i++) // DON'T skip P1
|
||||||
{
|
{
|
||||||
if (player == &players[displayplayers[i]])
|
if (player == &players[displayplayers[i]])
|
||||||
|
|
@ -3114,7 +3123,6 @@ void P_DemoCameraMovement(camera_t *cam)
|
||||||
{
|
{
|
||||||
ticcmd_t *cmd;
|
ticcmd_t *cmd;
|
||||||
angle_t thrustangle;
|
angle_t thrustangle;
|
||||||
mobj_t *awayviewmobj_hack;
|
|
||||||
player_t *lastp;
|
player_t *lastp;
|
||||||
|
|
||||||
// update democam stuff with what we got here:
|
// update democam stuff with what we got here:
|
||||||
|
|
@ -3163,14 +3171,6 @@ void P_DemoCameraMovement(camera_t *cam)
|
||||||
// besides freecam going inside walls sounds pretty cool on paper.
|
// besides freecam going inside walls sounds pretty cool on paper.
|
||||||
}
|
}
|
||||||
|
|
||||||
// awayviewmobj hack; this is to prevent us from hearing sounds from the player's perspective
|
|
||||||
|
|
||||||
awayviewmobj_hack = P_SpawnMobj(cam->x, cam->y, cam->z, MT_THOK);
|
|
||||||
awayviewmobj_hack->tics = 2;
|
|
||||||
awayviewmobj_hack->renderflags |= RF_DONTDRAW;
|
|
||||||
|
|
||||||
democam.soundmobj = awayviewmobj_hack;
|
|
||||||
|
|
||||||
// update subsector to avoid crashes;
|
// update subsector to avoid crashes;
|
||||||
cam->subsector = R_PointInSubsector(cam->x, cam->y);
|
cam->subsector = R_PointInSubsector(cam->x, cam->y);
|
||||||
}
|
}
|
||||||
|
|
@ -3239,8 +3239,6 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall
|
||||||
thiscam->old_angle = thiscam->angle;
|
thiscam->old_angle = thiscam->angle;
|
||||||
thiscam->old_aiming = thiscam->aiming;
|
thiscam->old_aiming = thiscam->aiming;
|
||||||
|
|
||||||
democam.soundmobj = NULL; // reset this each frame, we don't want the game crashing for stupid reasons now do we
|
|
||||||
|
|
||||||
// We probably shouldn't move the camera if there is no player or player mobj somehow
|
// We probably shouldn't move the camera if there is no player or player mobj somehow
|
||||||
if (!player || !player->mo)
|
if (!player || !player->mo)
|
||||||
return true;
|
return true;
|
||||||
|
|
|
||||||
|
|
@ -540,11 +540,6 @@ void S_StartSoundAtVolume(const void *origin_p, sfxenum_t sfx_id, INT32 volume)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (i == 0 && democam.soundmobj)
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (player->awayview.tics)
|
if (player->awayview.tics)
|
||||||
{
|
{
|
||||||
listenmobj[i] = player->awayview.mobj;
|
listenmobj[i] = player->awayview.mobj;
|
||||||
|
|
@ -554,7 +549,7 @@ 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])
|
if (origin && origin == listenmobj[i] && !demo.freecam)
|
||||||
{
|
{
|
||||||
itsUs = true;
|
itsUs = true;
|
||||||
}
|
}
|
||||||
|
|
@ -827,11 +822,6 @@ void S_UpdateSounds(void)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (i == 0 && democam.soundmobj)
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (player->awayview.tics)
|
if (player->awayview.tics)
|
||||||
{
|
{
|
||||||
listenmobj[i] = player->awayview.mobj;
|
listenmobj[i] = player->awayview.mobj;
|
||||||
|
|
@ -898,12 +888,15 @@ void S_UpdateSounds(void)
|
||||||
{
|
{
|
||||||
boolean itsUs = false;
|
boolean itsUs = false;
|
||||||
|
|
||||||
for (i = r_splitscreen; i >= 0; i--)
|
if (!demo.freecam)
|
||||||
{
|
{
|
||||||
if (c->origin != listenmobj[i])
|
for (i = r_splitscreen; i >= 0; i--)
|
||||||
continue;
|
{
|
||||||
|
if (c->origin != listenmobj[i])
|
||||||
|
continue;
|
||||||
|
|
||||||
itsUs = true;
|
itsUs = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (itsUs == false)
|
if (itsUs == false)
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue