mirror of
https://git.do.srb2.org/KartKrew/Kart-Public.git
synced 2024-12-27 04:41:23 +00:00
fix rewind, fix sound local sound playing in freecam
This commit is contained in:
parent
45b62aa8a4
commit
18c8f47f9a
7 changed files with 55 additions and 53 deletions
|
@ -6002,9 +6002,6 @@ void G_PreviewRewind(tic_t previewtime)
|
|||
players[i].kartstuff[j] = info->playerinfo[i].player.kartstuff[j];
|
||||
}
|
||||
|
||||
if (demo.freecam)
|
||||
return; // nope
|
||||
|
||||
for (i = splitscreen; i >= 0; i--)
|
||||
P_ResetCamera(&players[displayplayers[i]], &camera[i]);
|
||||
}
|
||||
|
|
|
@ -1062,7 +1062,7 @@ static void K_KartItemRoulette(player_t *player, ticcmd_t *cmd)
|
|||
}
|
||||
|
||||
// This makes the roulette produce the random noises.
|
||||
if ((player->kartstuff[k_itemroulette] % 3) == 1 && P_IsDisplayPlayer(player))
|
||||
if ((player->kartstuff[k_itemroulette] % 3) == 1 && P_IsDisplayPlayer(player) && !demo.freecam)
|
||||
{
|
||||
#define PLAYROULETTESND S_StartSound(NULL, sfx_itrol1 + ((player->kartstuff[k_itemroulette] / 3) % 8))
|
||||
for (i = 0; i <= splitscreen; i++)
|
||||
|
@ -1096,7 +1096,7 @@ static void K_KartItemRoulette(player_t *player, ticcmd_t *cmd)
|
|||
//player->kartstuff[k_itemblinkmode] = 1;
|
||||
player->kartstuff[k_itemroulette] = 0;
|
||||
player->kartstuff[k_roulettetype] = 0;
|
||||
if (P_IsDisplayPlayer(player))
|
||||
if (P_IsDisplayPlayer(player) && !demo.freecam)
|
||||
S_StartSound(NULL, sfx_itrole);
|
||||
return;
|
||||
}
|
||||
|
@ -1109,7 +1109,7 @@ static void K_KartItemRoulette(player_t *player, ticcmd_t *cmd)
|
|||
player->kartstuff[k_itemblinkmode] = 2;
|
||||
player->kartstuff[k_itemroulette] = 0;
|
||||
player->kartstuff[k_roulettetype] = 0;
|
||||
if (P_IsDisplayPlayer(player))
|
||||
if (P_IsDisplayPlayer(player) && !demo.freecam)
|
||||
S_StartSound(NULL, sfx_dbgsal);
|
||||
return;
|
||||
}
|
||||
|
@ -1141,7 +1141,7 @@ static void K_KartItemRoulette(player_t *player, ticcmd_t *cmd)
|
|||
player->kartstuff[k_itemamount] = 1;
|
||||
}
|
||||
|
||||
if (P_IsDisplayPlayer(player))
|
||||
if (P_IsDisplayPlayer(player) && !demo.freecam)
|
||||
S_StartSound(NULL, ((player->kartstuff[k_roulettetype] == 1) ? sfx_itrolk : (mashed ? sfx_itrolm : sfx_itrolf)));
|
||||
|
||||
player->kartstuff[k_itemblink] = TICRATE;
|
||||
|
|
|
@ -113,10 +113,7 @@ typedef struct camera_s
|
|||
struct demofreecam_s {
|
||||
|
||||
camera_t *cam; // this is useful when the game is paused, notably
|
||||
|
||||
fixed_t rewindx;
|
||||
fixed_t rewindy;
|
||||
fixed_t rewindz; // when rewinding, this is used to make sure the cam doesn't reset
|
||||
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
|
||||
|
|
|
@ -3201,8 +3201,9 @@ boolean P_SetupLevel(boolean skipprecip)
|
|||
|
||||
if (!dedicated)
|
||||
{
|
||||
for (i = 0; i <= splitscreen; i++)
|
||||
P_SetupCamera(displayplayers[i], &camera[i]);
|
||||
if (!demo.freecam)
|
||||
for (i = 0; i <= splitscreen; i++)
|
||||
P_SetupCamera(displayplayers[i], &camera[i]);
|
||||
|
||||
// Salt: CV_ClearChangedFlags() messes with your settings :(
|
||||
/*if (!cv_cam_height.changed)
|
||||
|
|
31
src/p_user.c
31
src/p_user.c
|
@ -7375,16 +7375,13 @@ void P_DemoCameraMovement(camera_t *cam)
|
|||
{
|
||||
ticcmd_t *cmd;
|
||||
angle_t thrustangle;
|
||||
mobj_t *awayviewmobj_hack;
|
||||
|
||||
// update democam stuff with what we got here:
|
||||
democam.cam = cam;
|
||||
democam.localangle = cam->angle;
|
||||
democam.localaiming = cam->aiming;
|
||||
|
||||
democam.rewindx = cam->x;
|
||||
democam.rewindy = cam->y;
|
||||
democam.rewindz = cam->z;
|
||||
|
||||
// first off we need to get button input
|
||||
cmd = P_CameraCmd(cam);
|
||||
|
||||
|
@ -7405,22 +7402,30 @@ void P_DemoCameraMovement(camera_t *cam)
|
|||
|
||||
thrustangle = cam->angle >> ANGLETOFINESHIFT;
|
||||
|
||||
cam->momx += FixedMul(cmd->forwardmove*mapobjectscale, FINECOSINE(thrustangle));
|
||||
cam->momy += FixedMul(cmd->forwardmove*mapobjectscale, FINESINE(thrustangle));
|
||||
cam->momz += FixedMul(cmd->forwardmove*mapobjectscale, AIMINGTOSLOPE(cam->aiming));
|
||||
|
||||
//funny thing cameras aren't mobjs so we gotta handle this ourselves;
|
||||
cam->x += cam->momx;
|
||||
cam->y += cam->momy;
|
||||
cam->z += cam->momz;
|
||||
cam->x += FixedMul(cmd->forwardmove*mapobjectscale, FINECOSINE(thrustangle));
|
||||
cam->y += FixedMul(cmd->forwardmove*mapobjectscale, FINESINE(thrustangle));
|
||||
cam->z += FixedMul(cmd->forwardmove*mapobjectscale, AIMINGTOSLOPE(cam->aiming));
|
||||
// momentums are useless here, directly add to the coordinates
|
||||
|
||||
// this.......... doesn't actually check for floors and walls and whatnot but the function to do that is a pure mess so fuck that.
|
||||
// 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->flags2 |= MF2_DONTDRAW;
|
||||
|
||||
democam.soundmobj = awayviewmobj_hack;
|
||||
}
|
||||
|
||||
void P_ResetCamera(player_t *player, camera_t *thiscam)
|
||||
{
|
||||
|
||||
if (demo.freecam)
|
||||
return; // do not reset the camera there.
|
||||
|
||||
tic_t tries = 0;
|
||||
fixed_t x, y, z;
|
||||
|
||||
|
@ -7478,6 +7483,8 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall
|
|||
subsector_t *newsubsec;
|
||||
#endif
|
||||
|
||||
democam.soundmobj = NULL; // reset this each frame, we don't want the game crashing for stupid reasons now do we
|
||||
|
||||
if (demo.freecam)
|
||||
{
|
||||
P_DemoCameraMovement(thiscam);
|
||||
|
|
|
@ -442,7 +442,7 @@ void S_StartSoundAtVolume(const void *origin_p, sfxenum_t sfx_id, INT32 volume)
|
|||
listener_t listener3 = {0,0,0,0};
|
||||
listener_t listener4 = {0,0,0,0};
|
||||
|
||||
mobj_t *listenmobj = players[displayplayers[0]].mo;
|
||||
mobj_t *listenmobj = democam.soundmobj ? : players[displayplayers[0]].mo;
|
||||
mobj_t *listenmobj2 = NULL;
|
||||
mobj_t *listenmobj3 = NULL;
|
||||
mobj_t *listenmobj4 = NULL;
|
||||
|
@ -903,7 +903,7 @@ void S_UpdateSounds(void)
|
|||
listener_t listener3;
|
||||
listener_t listener4;
|
||||
|
||||
mobj_t *listenmobj = players[displayplayers[0]].mo;
|
||||
mobj_t *listenmobj = democam.soundmobj ? : players[displayplayers[0]].mo;
|
||||
mobj_t *listenmobj2 = NULL;
|
||||
mobj_t *listenmobj3 = NULL;
|
||||
mobj_t *listenmobj4 = NULL;
|
||||
|
|
Loading…
Reference in a new issue