mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2025-10-30 08:01:28 +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;
|
||||
// reset democam shit too:
|
||||
democam.cam = NULL;
|
||||
democam.soundmobj = NULL;
|
||||
democam.localangle = 0;
|
||||
democam.localaiming = 0;
|
||||
democam.keyboardlook = false;
|
||||
|
|
|
|||
|
|
@ -135,7 +135,6 @@ struct camera_t
|
|||
struct demofreecam_s {
|
||||
|
||||
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 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;
|
||||
}
|
||||
|
||||
// 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
|
||||
{
|
||||
if (player == &players[displayplayers[i]])
|
||||
|
|
@ -3114,7 +3123,6 @@ void P_DemoCameraMovement(camera_t *cam)
|
|||
{
|
||||
ticcmd_t *cmd;
|
||||
angle_t thrustangle;
|
||||
mobj_t *awayviewmobj_hack;
|
||||
player_t *lastp;
|
||||
|
||||
// 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.
|
||||
}
|
||||
|
||||
// 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;
|
||||
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_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
|
||||
if (!player || !player->mo)
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -540,11 +540,6 @@ void S_StartSoundAtVolume(const void *origin_p, sfxenum_t sfx_id, INT32 volume)
|
|||
continue;
|
||||
}
|
||||
|
||||
if (i == 0 && democam.soundmobj)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (player->awayview.tics)
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
||||
if (origin && origin == listenmobj[i])
|
||||
if (origin && origin == listenmobj[i] && !demo.freecam)
|
||||
{
|
||||
itsUs = true;
|
||||
}
|
||||
|
|
@ -827,11 +822,6 @@ void S_UpdateSounds(void)
|
|||
continue;
|
||||
}
|
||||
|
||||
if (i == 0 && democam.soundmobj)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (player->awayview.tics)
|
||||
{
|
||||
listenmobj[i] = player->awayview.mobj;
|
||||
|
|
@ -898,12 +888,15 @@ void S_UpdateSounds(void)
|
|||
{
|
||||
boolean itsUs = false;
|
||||
|
||||
for (i = r_splitscreen; i >= 0; i--)
|
||||
if (!demo.freecam)
|
||||
{
|
||||
if (c->origin != listenmobj[i])
|
||||
continue;
|
||||
for (i = r_splitscreen; i >= 0; i--)
|
||||
{
|
||||
if (c->origin != listenmobj[i])
|
||||
continue;
|
||||
|
||||
itsUs = true;
|
||||
itsUs = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (itsUs == false)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue