port: net: don't play death music, pain and pickup sounds from other players

This commit is contained in:
fgsfds committed 2023-12-30 14:32:35 +01:00
1 parent 7f92551d5a
commit 2c0a0a1337
6 files changed
+32 -12

No files matched your search

+1 -1
View File
@@ -4042,7 +4042,7 @@ void chrChoke(struct chrdata *chr, s32 choketype)
if (soundnum >= 0) { if (soundnum >= 0) {
if (chr->prop->type == PROPTYPE_PLAYER) { if (chr->prop->type == PROPTYPE_PLAYER) {
if (g_Vars.players[playernum]->chokehandle == NULL) { if (g_Vars.players[playernum]->chokehandle == NULL) {
sndStart(var80095200, soundnum, &g_Vars.players[playernum]->chokehandle, -1, -1, -1, -1, -1); playerSndStart(var80095200, soundnum, &g_Vars.players[playernum]->chokehandle, playernum, -1, -1, -1);
} }
} else { } else {
psStopSound(chr->prop, PSTYPE_CHRTALK, 0); psStopSound(chr->prop, PSTYPE_CHRTALK, 0);
+1 -1
View File
@@ -521,7 +521,7 @@ void _musicStartMpDeath(f32 arg0)
void musicStartMpDeath(void) void musicStartMpDeath(void)
{ {
#ifndef PLATFORM_N64 #ifndef PLATFORM_N64
if (g_MusicDisableMpDeath) { if (g_MusicDisableMpDeath || (g_NetMode && g_Vars.currentplayernum != 0)) {
return; return;
} }
#endif #endif
+14
View File
@@ -5848,6 +5848,20 @@ void player0f0c3320(Mtxf *matrices, s32 count)
} }
} }
struct sndstate *playerSndStart(s32 arg0, s16 sound, struct sndstate **handle, s32 playernum, f32 pitch, s32 fxbus, s32 fxmix)
{
s32 vol = -1;
s32 pan = -1;
#ifndef PLATFORM_N64
const struct player *pl = g_Vars.players[playernum];
if (g_NetMode && playernum != 0 && pl && pl->prop) {
// auto attenuate sounds for remote players
psGetTheoreticalVolPan(&pl->prop->pos, pl->prop->rooms, sound, &vol, &pan);
}
#endif
return sndStart(arg0, sound, handle, vol, pan, pitch, fxbus, fxmix);
}
#if MAX_PLAYERS > 4 #if MAX_PLAYERS > 4
s32 playerGetCount(void) s32 playerGetCount(void)
+8 -8
View File
@@ -16890,7 +16890,7 @@ void ammotypePlayPickupSound(u32 ammotype)
case AMMOTYPE_CLOAK: case AMMOTYPE_CLOAK:
case AMMOTYPE_BOOST: case AMMOTYPE_BOOST:
case AMMOTYPE_TOKEN: case AMMOTYPE_TOKEN:
sndStart(var80095200, SFX_PICKUP_AMMO, NULL, -1, -1, -1, -1, -1); playerSndStart(var80095200, SFX_PICKUP_AMMO, NULL, g_Vars.currentplayernum, -1, -1, -1);
break; break;
case AMMOTYPE_REMOTE_MINE: case AMMOTYPE_REMOTE_MINE:
case AMMOTYPE_PROXY_MINE: case AMMOTYPE_PROXY_MINE:
@@ -16899,10 +16899,10 @@ void ammotypePlayPickupSound(u32 ammotype)
case AMMOTYPE_MICROCAMERA: case AMMOTYPE_MICROCAMERA:
case AMMOTYPE_PLASTIQUE: case AMMOTYPE_PLASTIQUE:
case AMMOTYPE_ECM_MINE: case AMMOTYPE_ECM_MINE:
sndStart(var80095200, SFX_PICKUP_MINE, NULL, -1, -1, -1, -1, -1); playerSndStart(var80095200, SFX_PICKUP_MINE, NULL, g_Vars.currentplayernum, -1, -1, -1);
break; break;
case AMMOTYPE_KNIFE: case AMMOTYPE_KNIFE:
sndStart(var80095200, SFX_PICKUP_KNIFE, NULL, -1, -1, -1, -1, -1); playerSndStart(var80095200, SFX_PICKUP_KNIFE, NULL, g_Vars.currentplayernum, -1, -1, -1);
break; break;
} }
} }
@@ -16967,7 +16967,7 @@ void weaponPlayPickupSound(s32 weaponnum)
sound = SFX_PICKUP_GUN; sound = SFX_PICKUP_GUN;
} }
sndStart(var80095200, sound, NULL, -1, -1, -1, -1, -1); playerSndStart(var80095200, sound, NULL, g_Vars.currentplayernum, -1, -1, -1);
} }
void ammotypeGetPickupMessage(char *dst, s32 ammotype, s32 qty) void ammotypeGetPickupMessage(char *dst, s32 ammotype, s32 qty)
@@ -17280,7 +17280,7 @@ s32 propPickupByPlayer(struct prop *prop, bool showhudmsg)
switch (obj->type) { switch (obj->type) {
case OBJTYPE_KEY: case OBJTYPE_KEY:
if (g_Vars.in_cutscene == false) { if (g_Vars.in_cutscene == false) {
sndStart(var80095200, SFX_PICKUP_KEYCARD, NULL, -1, -1, -1, -1, -1); playerSndStart(var80095200, SFX_PICKUP_KEYCARD, NULL, g_Vars.currentplayernum, -1, -1, -1);
} }
if (showhudmsg) { if (showhudmsg) {
@@ -17320,7 +17320,7 @@ s32 propPickupByPlayer(struct prop *prop, bool showhudmsg)
} }
if (g_Vars.in_cutscene == false) { if (g_Vars.in_cutscene == false) {
sndStart(var80095200, SFX_PICKUP_AMMO, NULL, -1, -1, -1, -1, -1); playerSndStart(var80095200, SFX_PICKUP_AMMO, NULL, g_Vars.currentplayernum, -1, -1, -1);
} }
result = TICKOP_FREE; result = TICKOP_FREE;
@@ -17473,7 +17473,7 @@ s32 propPickupByPlayer(struct prop *prop, bool showhudmsg)
playerSetShieldFrac(((struct shieldobj *) prop->obj)->amount); playerSetShieldFrac(((struct shieldobj *) prop->obj)->amount);
if (!g_Vars.in_cutscene) { if (!g_Vars.in_cutscene) {
sndStart(var80095200, SFX_PICKUP_SHIELD, NULL, -1, -1, -1, -1, -1); playerSndStart(var80095200, SFX_PICKUP_SHIELD, NULL, g_Vars.currentplayernum, -1, -1, -1);
} }
if (showhudmsg) { if (showhudmsg) {
@@ -17510,7 +17510,7 @@ s32 propPickupByPlayer(struct prop *prop, bool showhudmsg)
case OBJTYPE_TINTEDGLASS: case OBJTYPE_TINTEDGLASS:
default: default:
if (g_Vars.in_cutscene == false) { if (g_Vars.in_cutscene == false) {
sndStart(var80095200, SFX_PICKUP_KEYCARD, NULL, -1, -1, -1, -1, -1); playerSndStart(var80095200, SFX_PICKUP_KEYCARD, NULL, g_Vars.currentplayernum, -1, -1, -1);
} }
if (showhudmsg) { if (showhudmsg) {
+7 -2
View File
@@ -1284,11 +1284,16 @@ s32 psCalculatePan2(struct coord *pos, s32 arg1, f32 arg2, struct pschannel *cha
f32 f2; f32 f2;
if (LOCALPLAYERCOUNT() < 2) { if (LOCALPLAYERCOUNT() < 2) {
struct coord *campos = &g_Vars.currentplayer->cam_pos; #ifdef PLATFORM_N64
struct player *player = g_Vars.currentplayer;
#else
struct player *player = g_Vars.players[0] ? g_Vars.players[0] : g_Vars.currentplayer;
#endif
struct coord *campos = &player->cam_pos;
f32 sp3c; f32 sp3c;
f32 sp38; f32 sp38;
f2 = -(atan2f(pos->x - campos->x, pos->z - campos->z) * 180.0f / M_PI + g_Vars.currentplayer->vv_theta); f2 = -(atan2f(pos->x - campos->x, pos->z - campos->z) * 180.0f / M_PI + player->vv_theta);
if (arg2 >= 0.0f) { if (arg2 >= 0.0f) {
sp3c = sinf(0.017453292f * f2); sp3c = sinf(0.017453292f * f2);
+1
View File
@@ -107,5 +107,6 @@ void playerSetCamPropertiesWithoutRoom(struct coord *pos, struct coord *up, stru
void playerSetCamProperties(struct coord *pos, struct coord *up, struct coord *look, s32 room); void playerSetCamProperties(struct coord *pos, struct coord *up, struct coord *look, s32 room);
void playerClearMemCamRoom(void); void playerClearMemCamRoom(void);
s32 playerGetCount(void); s32 playerGetCount(void);
struct sndstate *playerSndStart(s32 arg0, s16 sound, struct sndstate **handle, s32 playernum, f32 pitch, s32 fxbus, s32 fxmix);
#endif #endif