diff --git a/src/g_demo.c b/src/g_demo.c index d7f240f38..f0f7dca3f 100644 --- a/src/g_demo.c +++ b/src/g_demo.c @@ -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; diff --git a/src/p_local.h b/src/p_local.h index 20ad1d5d2..5b46de49a 100644 --- a/src/p_local.h +++ b/src/p_local.h @@ -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 diff --git a/src/p_user.c b/src/p_user.c index d2f148283..991440d4b 100644 --- a/src/p_user.c +++ b/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; diff --git a/src/s_sound.c b/src/s_sound.c index a9e5a4656..eb6c9a2e1 100644 --- a/src/s_sound.c +++ b/src/s_sound.c @@ -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)