From 1df5e4dc5114c4b9855e1d4cf3c2a41348491a20 Mon Sep 17 00:00:00 2001 From: Ryan Dwyer Date: Sat, 3 Jun 2023 10:09:12 +1000 Subject: [PATCH] Document propsnd functions --- include/PR/libaudio.h | 17 +- src/game/bondbike.c | 28 +- src/game/bondeyespy.c | 20 +- src/game/bondgun.c | 81 +- src/game/bondmove.c | 2 +- src/game/bondwalk.c | 12 +- src/game/bot.c | 12 +- src/game/botact.c | 12 +- src/game/casingtick.c | 3 +- src/game/chr.c | 6 +- src/game/chraction.c | 72 +- src/game/chrai.c | 16 +- src/game/chraicommands.c | 124 +-- src/game/dlights.c | 4 +- src/game/explosions.c | 2 +- src/game/footstep.c | 12 +- src/game/hudmsg.c | 6 +- src/game/lv.c | 6 +- src/game/menu.c | 29 +- src/game/mplayer/scenarios/hackthatmac.inc | 14 +- src/game/nbomb.c | 23 +- src/game/player.c | 2 +- src/game/prop.c | 23 +- src/game/propobj.c | 150 +-- src/game/propsnd.c | 1142 ++++++++++---------- src/game/propsndreset.c | 10 +- src/game/propsndstop.c | 16 +- src/game/shards.c | 12 +- src/game/sight.c | 6 +- src/game/training.c | 28 +- src/game/weather.c | 3 +- src/include/commands.h | 40 +- src/include/constants.h | 93 +- src/include/data.h | 4 +- src/include/game/bondgun.h | 2 +- src/include/game/chraicommands.h | 16 +- src/include/game/propobj.h | 1 - src/include/game/propsnd.h | 55 +- src/include/lib/snd.h | 10 +- src/include/types.h | 62 +- src/lib/naudio/n_csplayer.c | 2 +- src/lib/naudio/n_seqplayer.c | 2 +- src/lib/naudio/n_sndplayer.c | 2 +- src/lib/snd.c | 193 ++-- src/setups/setupame.c | 42 +- src/setups/setupark.c | 14 +- src/setups/setupazt.c | 56 +- src/setups/setupcave.c | 140 +-- src/setups/setupdam.c | 98 +- src/setups/setupdepo.c | 32 +- src/setups/setupdish.c | 22 +- src/setups/setupear.c | 50 +- src/setups/setupeld.c | 28 +- src/setups/setupimp.c | 252 ++--- src/setups/setuplee.c | 176 +-- src/setups/setuplip.c | 152 +-- src/setups/setuplue.c | 60 +- src/setups/setuppam.c | 44 +- src/setups/setuppete.c | 16 +- src/setups/setuprit.c | 14 +- src/setups/setupsev.c | 12 +- src/setups/setupsho.c | 184 ++-- src/setups/setupstat.c | 12 +- src/setups/setuptra.c | 72 +- src/setups/setupwax.c | 12 +- 65 files changed, 1973 insertions(+), 1890 deletions(-) diff --git a/include/PR/libaudio.h b/include/PR/libaudio.h index d5c070a4d..428e9db0b 100644 --- a/include/PR/libaudio.h +++ b/include/PR/libaudio.h @@ -71,14 +71,15 @@ extern "C" { typedef s32 ALMicroTime; typedef u8 ALPan; -#define AL_PAN_CENTER 64 -#define AL_PAN_LEFT 0 -#define AL_PAN_RIGHT 127 -#define AL_VOL_FULL 127 -#define AL_KEY_MIN 0 -#define AL_KEY_MAX 127 -#define AL_DEFAULT_FXMIX 0 -#define AL_SUSTAIN 63 +#define AL_PAN_CENTER 64 +#define AL_PAN_LEFT 0 +#define AL_PAN_RIGHT 127 +#define _AL_VOL_FULL 127 /* SDK/internal value */ +#define AL_VOL_FULL 0x7fff /* But the game uses this mostly */ +#define AL_KEY_MIN 0 +#define AL_KEY_MAX 127 +#define AL_DEFAULT_FXMIX 0 +#define AL_SUSTAIN 63 /*********************************************************************** * Error handling diff --git a/src/game/bondbike.c b/src/game/bondbike.c index e77da21cc..5b33c3feb 100644 --- a/src/game/bondbike.c +++ b/src/game/bondbike.c @@ -84,10 +84,10 @@ void bbikeExit(void) rotation = bikeobj->w; objApplyMomentum(obj, &speed, rotation, false, false); - func0f0926bc(g_Vars.currentplayer->hoverbike, 1, 0xffff); - func0f0926bc(g_Vars.currentplayer->prop, 1, 0xffff); - propsnd0f0939f8(NULL, g_Vars.currentplayer->hoverbike, SFX_BIKE_PULSE, -1, - -1, 0, 0, 0, 0, -1, 0, -1, -1, -1, -1); + psStopSound(g_Vars.currentplayer->hoverbike, PSTYPE_GENERAL, 0xffff); + psStopSound(g_Vars.currentplayer->prop, PSTYPE_GENERAL, 0xffff); + psCreate(NULL, g_Vars.currentplayer->hoverbike, SFX_BIKE_PULSE, -1, + -1, 0, 0, PSTYPE_NONE, 0, -1, 0, -1, -1, -1, -1); obj->flags |= OBJFLAG_HOVERBIKE_MOVINGWHILEEMPTY; } @@ -878,9 +878,9 @@ void bbikeTick(void) sp200 *= 300.0f; - func0f093630(g_Vars.currentplayer->hoverbike, var80070f04, -1); - func0f093790(g_Vars.currentplayer->hoverbike, var80070f04 * 300.0f); - func0f093790(g_Vars.currentplayer->prop, sp200); + psSetPitch(g_Vars.currentplayer->hoverbike, var80070f04, -1); + psSetVolume(g_Vars.currentplayer->hoverbike, var80070f04 * 300.0f); + psSetVolume(g_Vars.currentplayer->prop, sp200); } if (1); @@ -968,16 +968,16 @@ void bbikeTick(void) if (g_Vars.currentplayer->bondentert >= 1.0f) { g_Vars.currentplayer->bondvehiclemode = VEHICLEMODE_ENGINESTART; - func0f0926bc(g_Vars.currentplayer->hoverbike, 1, 0xffff); + psStopSound(g_Vars.currentplayer->hoverbike, PSTYPE_GENERAL, 0xffff); - propsnd0f0939f8(NULL, g_Vars.currentplayer->prop, SFX_BIKE_TAKEOFF, -1, - -1, 0, 0, 0, NULL, -1, NULL, -1, -1, -1, -1); + psCreate(NULL, g_Vars.currentplayer->prop, SFX_BIKE_TAKEOFF, -1, + -1, 0, 0, PSTYPE_NONE, NULL, -1, NULL, -1, -1, -1, -1); - propsnd0f0939f8(NULL, g_Vars.currentplayer->prop, SFX_BIKE_PULSE, -1, - -1, 0, 0, 0, NULL, -1, NULL, -1, -1, -1, -1); + psCreate(NULL, g_Vars.currentplayer->prop, SFX_BIKE_PULSE, -1, + -1, 0, 0, PSTYPE_NONE, NULL, -1, NULL, -1, -1, -1, -1); - propsnd0f0939f8(NULL, g_Vars.currentplayer->hoverbike, SFX_BIKE_ENGINE, -1, - -1, 0, 0, 0, NULL, -1, NULL, -1, -1, -1, -1); + psCreate(NULL, g_Vars.currentplayer->hoverbike, SFX_BIKE_ENGINE, -1, + -1, 0, 0, PSTYPE_NONE, NULL, -1, NULL, -1, -1, -1, -1); } quaternion0f097044(&g_Vars.currentplayer->bondentermtx, spa4); diff --git a/src/game/bondeyespy.c b/src/game/bondeyespy.c index 96dd95937..7d4ace04e 100644 --- a/src/game/bondeyespy.c +++ b/src/game/bondeyespy.c @@ -664,11 +664,11 @@ bool eyespyTryLaunch(void) chr->chrflags &= ~CHRCFLAG_INVINCIBLE; #if VERSION >= VERSION_NTSC_1_0 - propsnd0f0939f8(NULL, g_Vars.currentplayer->eyespy->prop, SFX_EYESPY_RUNNING, -1, - -1, 2, 0, 0, 0, -1, 0, -1, -1, -1, -1); + psCreate(NULL, g_Vars.currentplayer->eyespy->prop, SFX_EYESPY_RUNNING, -1, + -1, PSFLAG_REPEATING, 0, PSTYPE_NONE, 0, -1, 0, -1, -1, -1, -1); #else - propsnd0f0939f8(NULL, g_Vars.currentplayer->eyespy->prop, SFX_EYESPY_RUNNING, -1, - -1, 0, 0, 0, 0, -1, 0, -1, -1, -1, -1); + psCreate(NULL, g_Vars.currentplayer->eyespy->prop, SFX_EYESPY_RUNNING, -1, + -1, 0, 0, PSTYPE_NONE, 0, -1, 0, -1, -1, -1, -1); #endif } @@ -1059,16 +1059,16 @@ void eyespyProcessInput(bool allowbuttons) switch (g_EyespyHit) { case EYESPYHIT_BG: - snd00010718(NULL, 0, 16000, 0x40, SFX_EYESPYHIT, 1, 1, -1, 1); + snd00010718(NULL, 0, 16000, AL_PAN_CENTER, SFX_EYESPYHIT, 1, 1, -1, 1); break; case EYESPYHIT_OBJ: - snd00010718(NULL, 0, 16000, 0x40, SFX_EYESPYHIT, 1, 1, -1, 1); + snd00010718(NULL, 0, 16000, AL_PAN_CENTER, SFX_EYESPYHIT, 1, 1, -1, 1); break; case EYESPYHIT_DOOR: - snd00010718(NULL, 0, 16000, 0x40, SFX_EYESPYHIT, 1, 1, -1, 1); + snd00010718(NULL, 0, 16000, AL_PAN_CENTER, SFX_EYESPYHIT, 1, 1, -1, 1); break; case EYESPYHIT_CHR: - snd00010718(NULL, 0, 16000, 0x40, SFX_EYESPYHIT, 1, 1, -1, 1); + snd00010718(NULL, 0, 16000, AL_PAN_CENTER, SFX_EYESPYHIT, 1, 1, -1, 1); break; case EYESPYHIT_DAMAGE: sndStart(var80095200, SFX_PICKUP_LASER, NULL, -1, -1, -1, -1, -1); @@ -1084,7 +1084,7 @@ void eyespyProcessInput(bool allowbuttons) } tmp = g_Vars.currentplayer->eyespy->speed / 1600.0f; - func0f093790(g_Vars.currentplayer->eyespy->prop, tmp * 400.0f); + psSetVolume(g_Vars.currentplayer->eyespy->prop, tmp * 400.0f); angle = 180 - g_Vars.currentplayer->eyespy->theta; @@ -1171,7 +1171,7 @@ void eyespyProcessInput(bool allowbuttons) weaponPlayPickupSound(WEAPON_EYESPY); currentPlayerQueuePickupWeaponHudmsg(WEAPON_EYESPY, false); - func0f0926bc(g_Vars.currentplayer->eyespy->prop, 1, 0xffff); + psStopSound(g_Vars.currentplayer->eyespy->prop, PSTYPE_GENERAL, 0xffff); chrClearReferences(g_Vars.currentplayer->eyespy->prop - g_Vars.props); } diff --git a/src/game/bondgun.c b/src/game/bondgun.c index 5782df75a..d32c7bef5 100644 --- a/src/game/bondgun.c +++ b/src/game/bondgun.c @@ -1,5 +1,6 @@ #include #include "constants.h" +#include "../lib/naudio/n_sndp.h" #include "game/bondmove.h" #include "game/cheats.h" #include "game/chraction.h" @@ -821,17 +822,17 @@ void bgun0f0981e8(struct hand *hand, struct modeldef *modeldef) case GUNCMD_PLAYSOUND: #if VERSION >= VERSION_NTSC_1_0 if (hasspeed) { - snd00010718(0, 0, 0x7fff, 0x40, cmd->unk04, speed, 1, -1, 1); + snd00010718(0, 0, AL_VOL_FULL, AL_PAN_CENTER, cmd->unk04, speed, 1, -1, 1); hasspeed = false; } else { - snd00010718(0, 0, 0x7fff, 0x40, cmd->unk04, 1.0f, 1, -1, 1); + snd00010718(0, 0, AL_VOL_FULL, AL_PAN_CENTER, cmd->unk04, 1.0f, 1, -1, 1); } #else audiohandle = sndStart(var80095200, cmd->unk04, NULL, -1, -1, -1, -1, -1); if (hasspeed && audiohandle) { hasspeed = false; - audioPostEvent(audiohandle, 16, *(s32 *)&speed); + audioPostEvent(audiohandle, AL_SNDP_PITCH_EVT, *(s32 *)&speed); } #endif break; @@ -1987,7 +1988,7 @@ void bgun0f09a6f8(struct handweaponinfo *info, s32 handnum, struct hand *hand, s tmp = 1.0f - frac * 0.4f; - audioPostEvent(handle, 16, *(s32 *) &tmp); + audioPostEvent(handle, AL_SNDP_PITCH_EVT, *(s32 *) &tmp); } } @@ -2605,7 +2606,7 @@ s32 bgunTickIncAttackEmpty(struct handweaponinfo *info, s32 handnum, struct hand handle = sndStart(var80095200, SFX_HIT_WATER, NULL, -1, -1, -1, -1, -1); if (handle) { - audioPostEvent(handle, 16, *(s32 *)&speed); + audioPostEvent(handle, AL_SNDP_PITCH_EVT, *(s32 *)&speed); } #if VERSION >= VERSION_NTSC_1_0 @@ -2631,7 +2632,7 @@ s32 bgunTickIncAttackEmpty(struct handweaponinfo *info, s32 handnum, struct hand handle = sndStart(var80095200, SFX_FIREEMPTY, NULL, -1, -1, -1, -1, -1); if (handle) { - audioPostEvent(handle, 16, *(s32 *)&speed); + audioPostEvent(handle, AL_SNDP_PITCH_EVT, *(s32 *)&speed); } #if VERSION >= VERSION_NTSC_1_0 @@ -3012,7 +3013,7 @@ s32 bgunTickIncChangeGun(struct handweaponinfo *info, s32 handnum, struct hand * handle1 = sndStart(var80095200, SFX_EQUIP_HORIZONSCANNER, 0, -1, -1, -1, -1, -1); if (handle1) { - audioPostEvent(handle1, 16, *(s32 *)&speed1); + audioPostEvent(handle1, AL_SNDP_PITCH_EVT, *(s32 *)&speed1); } #if VERSION >= VERSION_NTSC_1_0 @@ -3055,7 +3056,7 @@ s32 bgunTickIncChangeGun(struct handweaponinfo *info, s32 handnum, struct hand * handle2 = sndStart(var80095200, SFX_PICKUP_GUN, 0, -1, -1, -1, -1, -1); if (handle2) { - audioPostEvent(handle2, 16, *(s32 *)&speed2); + audioPostEvent(handle2, AL_SNDP_PITCH_EVT, *(s32 *)&speed2); } #if VERSION >= VERSION_NTSC_1_0 @@ -3073,7 +3074,7 @@ s32 bgunTickIncChangeGun(struct handweaponinfo *info, s32 handnum, struct hand * handle3 = sndStart(var80095200, SFX_PICKUP_GUN, 0, -1, -1, -1, -1, -1); if (handle3) { - audioPostEvent(handle3, 16, *(s32 *)&speed3); + audioPostEvent(handle3, AL_SNDP_PITCH_EVT, *(s32 *)&speed3); } #if VERSION >= VERSION_NTSC_1_0 @@ -4406,8 +4407,8 @@ struct defaultobj *bgunCreateThrownProjectile2(struct chrdata *chr, struct gset obj->projectile->unk08c = 0.1f; obj->projectile->pickuptimer240 = TICKS(240); - propsnd0f0939f8(NULL, obj->prop, SFX_THROW, -1, - -1, 0, 0, 0, NULL, -1, NULL, -1, -1, -1, -1); + psCreate(NULL, obj->prop, SFX_THROW, -1, + -1, 0, 0, PSTYPE_NONE, NULL, -1, NULL, -1, -1, -1, -1); } } @@ -4902,7 +4903,7 @@ void bgunCreateFiredProjectile(s32 handnum) weapon->base.projectile->unk098 = funcdef->unk50 * 1.6666666f; if (funcdef->soundnum > 0) { - propsnd0f0939f8(NULL, weapon->base.prop, funcdef->soundnum, -1, -1, 0, 0, 0, 0, -1.0f, 0, -1, -1.0f, -1.0f, -1.0f); + psCreate(NULL, weapon->base.prop, funcdef->soundnum, -1, -1, 0, 0, PSTYPE_NONE, 0, -1.0f, 0, -1, -1.0f, -1.0f, -1.0f); } if (funcdef->base.base.flags & FUNCFLAG_FLYBYWIRE) { @@ -4978,7 +4979,7 @@ void bgunCreateFiredProjectile(s32 handnum) weapon->base.projectile->unk098 = funcdef->unk50 * 1.6666666f; if (funcdef->soundnum > 0) { - propsnd0f0939f8(NULL, weapon->base.prop, funcdef->soundnum, -1, -1, 0, 0, 0, 0, -1.0f, 0, -1, -1.0f, -1.0f, -1.0f); + psCreate(NULL, weapon->base.prop, funcdef->soundnum, -1, -1, 0, 0, PSTYPE_NONE, 0, -1.0f, 0, -1, -1.0f, -1.0f, -1.0f); } if (funcdef->base.base.flags & FUNCFLAG_FLYBYWIRE) { @@ -6920,17 +6921,17 @@ void bgunUpdateReaper(struct hand *hand, struct modeldef *modeldef) if (hand->audiohandle != NULL) { f32 sp34 = hand->matmot3 / 0.50f + 0.4f; - s32 a2 = 0x7fff; + s32 volume = AL_VOL_FULL; if (hand->matmot3 < 0.1f) { audioStop(hand->audiohandle); } else { if (hand->matmot3 < 0.6f) { - a2 = (hand->matmot3 - 0.1f) * 32767.0f / 0.5f; + volume = (hand->matmot3 - 0.1f) * AL_VOL_FULL / 0.5f; } - audioPostEvent(hand->audiohandle, 8, a2); - audioPostEvent(hand->audiohandle, 0x10, *(s32 *)&sp34); + audioPostEvent(hand->audiohandle, AL_SNDP_VOL_EVT, volume); + audioPostEvent(hand->audiohandle, AL_SNDP_PITCH_EVT, *(s32 *)&sp34); } } @@ -8083,7 +8084,7 @@ void bgunTickMaulerCharge(void) if (hand->matmot1 < 0.1f || !charging) { audioStop(hand->audiohandle); } else { - audioPostEvent(hand->audiohandle, 16, *(s32 *)&speed); + audioPostEvent(hand->audiohandle, AL_SNDP_PITCH_EVT, *(s32 *)&speed); } } } @@ -11134,7 +11135,7 @@ void bgunPlayPropHitSound(struct gset *gset, struct prop *prop, s32 texturenum) || gset->weaponnum == WEAPON_TRACERBUG || gset->weaponnum == WEAPON_TARGETAMPLIFIER || gset->weaponnum == WEAPON_ECMMINE) { - propsnd0f0939f8(NULL, prop, SFX_80AA, -1, -1, 0, 0, 0, NULL, -1, NULL, -1, -1, -1, -1); + psCreate(NULL, prop, SFX_80AA, -1, -1, 0, 0, PSTYPE_NONE, NULL, -1, NULL, -1, -1, -1, -1); return; } @@ -11145,8 +11146,8 @@ void bgunPlayPropHitSound(struct gset *gset, struct prop *prop, s32 texturenum) struct chrdata *chr = prop->chr; s16 soundnum = -1; bool overridden = false; - s32 spac; - s32 spa8; + s32 vol; + s32 pan; if (chrGetShield(chr) > 0) { soundnum = SFX_SHIELD_DAMAGE; @@ -11170,13 +11171,13 @@ void bgunPlayPropHitSound(struct gset *gset, struct prop *prop, s32 texturenum) } if (soundnum != -1) { - propsnd0f094ef4(&prop->pos, prop->rooms, soundnum, &spac, &spa8); + psGetTheoreticalVolPan(&prop->pos, prop->rooms, soundnum, &vol, &pan); - if (spac) { + if (vol) { sndStart(var80095200, soundnum, handle, -1, -1, -1, -1, -1); if (*handle) { - sndAdjust(handle, 0, spac, spa8, soundnum, 1, 1, -1, 1); + sndAdjust(handle, 0, vol, pan, soundnum, 1, 1, -1, 1); } } } @@ -11187,8 +11188,8 @@ void bgunPlayPropHitSound(struct gset *gset, struct prop *prop, s32 texturenum) } else { s16 soundnum = -1; bool overridden = false; - s32 sp90; - s32 sp8c; + s32 vol; + s32 pan; u32 stack; if (texturenum == 10000) { @@ -11221,13 +11222,13 @@ void bgunPlayPropHitSound(struct gset *gset, struct prop *prop, s32 texturenum) } if (soundnum != -1) { - propsnd0f094ef4(&prop->pos, prop->rooms, soundnum, &sp90, &sp8c); + psGetTheoreticalVolPan(&prop->pos, prop->rooms, soundnum, &vol, &pan); - if (sp90) { + if (vol) { sndStart(var80095200, soundnum, handle, -1, -1, -1, -1, -1); if (*handle) { - sndAdjust(handle, 0, sp90, sp8c, soundnum, 1, 1, -1, 1); + sndAdjust(handle, 0, vol, pan, soundnum, 1, 1, -1, 1); } } } @@ -11254,7 +11255,7 @@ void bgunPlayPropHitSound(struct gset *gset, struct prop *prop, s32 texturenum) } if (*handle && soundnum != -1) { - func0f09505c(*handle, &prop->pos, 400, 2500, 3000, prop->rooms, soundnum, 0x7fff, 0); + psApplyVolPan(*handle, &prop->pos, 400, 2500, 3000, prop->rooms, soundnum, AL_VOL_FULL, 0); } } } @@ -11279,7 +11280,7 @@ void bgunPlayPropHitSound(struct gset *gset, struct prop *prop, s32 texturenum) || gset->weaponnum == WEAPON_TRACERBUG || gset->weaponnum == WEAPON_TARGETAMPLIFIER || gset->weaponnum == WEAPON_ECMMINE) { - propsnd0f0939f8(NULL, prop, SFX_80AA, -1, -1, 0, 0, 0, NULL, -1, NULL, -1, -1, -1, -1); + psCreate(NULL, prop, SFX_80AA, -1, -1, 0, 0, PSTYPE_NONE, NULL, -1, NULL, -1, -1, -1, -1); return; } @@ -11317,7 +11318,7 @@ void bgunPlayPropHitSound(struct gset *gset, struct prop *prop, s32 texturenum) } if (*handle) { - func0f09505c(*handle, &prop->pos, 400, 2500, 3000, prop->rooms, soundnum, 0x7fff, 0); + psApplyVolPan(*handle, &prop->pos, 400, 2500, 3000, prop->rooms, soundnum, AL_VOL_FULL, 0); } if (overridden) { @@ -11362,7 +11363,7 @@ void bgunPlayPropHitSound(struct gset *gset, struct prop *prop, s32 texturenum) } if (*handle) { - func0f09505c(*handle, &prop->pos, 400, 2500, 3000, prop->rooms, soundnum, 0x7fff, 0); + psApplyVolPan(*handle, &prop->pos, 400, 2500, 3000, prop->rooms, soundnum, AL_VOL_FULL, 0); } if (overridden) { @@ -11385,7 +11386,7 @@ void bgunPlayPropHitSound(struct gset *gset, struct prop *prop, s32 texturenum) } if (*handle) { - func0f09505c(*handle, &prop->pos, 400, 2500, 3000, prop->rooms, soundnum, 0x7fff, 0); + psApplyVolPan(*handle, &prop->pos, 400, 2500, 3000, prop->rooms, soundnum, AL_VOL_FULL, 0); } } } @@ -11401,13 +11402,13 @@ void bgunPlayGlassHitSound(struct coord *pos, s16 *rooms, s32 texturenum) sndStart(var80095200, SFX_HIT_GLASS, handle, -1, -1, -1, -1, -1); if (*handle) { - func0f09505c(*handle, pos, 400, 2500, 3000, rooms, SFX_HIT_GLASS, 0x7fff, 0); + psApplyVolPan(*handle, pos, 400, 2500, 3000, rooms, SFX_HIT_GLASS, AL_VOL_FULL, 0); } } } } -void bgunPlayBgHitSound(struct gset *gset, struct coord *arg1, s32 texturenum, s16 *arg3) +void bgunPlayBgHitSound(struct gset *gset, struct coord *hitpos, s32 texturenum, s16 *rooms) { #if VERSION >= VERSION_NTSC_1_0 struct sndstate **handle; @@ -11478,7 +11479,7 @@ void bgunPlayBgHitSound(struct gset *gset, struct coord *arg1, s32 texturenum, s } if (*handle != NULL) { - func0f09505c(*handle, arg1, 400, 2500, 3000, arg3, soundnum, 0x7fff, 0); + psApplyVolPan(*handle, hitpos, 400, 2500, 3000, rooms, soundnum, AL_VOL_FULL, 0); } if (overridden) { @@ -11503,7 +11504,7 @@ void bgunPlayBgHitSound(struct gset *gset, struct coord *arg1, s32 texturenum, s } if (*handle != NULL) { - func0f09505c(*handle, arg1, 400, 2500, 3000, arg3, soundnum, 0x7fff, 0); + psApplyVolPan(*handle, hitpos, 400, 2500, 3000, rooms, soundnum, AL_VOL_FULL, 0); } } } @@ -11571,7 +11572,7 @@ void bgunPlayBgHitSound(struct gset *gset, struct coord *arg1, s32 texturenum, s } if (*handle != NULL) { - func0f09505c(*handle, arg1, 400, 2500, 3000, arg3, soundnum, 0x7fff, 0); + psApplyVolPan(*handle, hitpos, 400, 2500, 3000, rooms, soundnum, AL_VOL_FULL, 0); } if (overridden) { @@ -11596,7 +11597,7 @@ void bgunPlayBgHitSound(struct gset *gset, struct coord *arg1, s32 texturenum, s } if (*handle != NULL) { - func0f09505c(*handle, arg1, 400, 2500, 3000, arg3, soundnum, 0x7fff, 0); + psApplyVolPan(*handle, hitpos, 400, 2500, 3000, rooms, soundnum, AL_VOL_FULL, 0); } } } diff --git a/src/game/bondmove.c b/src/game/bondmove.c index 3270b5f31..8e1c2893e 100644 --- a/src/game/bondmove.c +++ b/src/game/bondmove.c @@ -1965,7 +1965,7 @@ void bmoveTick(bool allowc1x, bool allowc1y, bool allowc1buttons, bool ignorec2) sound = footstepChooseSound(chr, distance > 10); if (sound != -1) { - snd00010718(0, 0, 0x7fff, 0x40, sound, 1, 1, -1, 1); + snd00010718(0, 0, AL_VOL_FULL, AL_PAN_CENTER, sound, 1, 1, -1, true); } } } diff --git a/src/game/bondwalk.c b/src/game/bondwalk.c index 5f004c1ca..545e7d779 100644 --- a/src/game/bondwalk.c +++ b/src/game/bondwalk.c @@ -1040,16 +1040,16 @@ void bwalkUpdateVertical(void) if (sound != -1) { if (sound != -1) { - propsnd0f0939f8(NULL, g_Vars.currentplayer->prop, sound, - -1, -1, 0x8400, 0, 0, 0, -1, NULL, -1, -1, -1, -1); + psCreate(NULL, g_Vars.currentplayer->prop, sound, + -1, -1, PSFLAG_0400 | PSFLAG_IGNOREROOMS, 0, PSTYPE_NONE, 0, -1, NULL, -1, -1, -1, -1); } chr->footstep = 2; sound = footstepChooseSound(chr, true); if (sound != -1) { - propsnd0f0939f8(NULL, g_Vars.currentplayer->prop, sound, - -1, -1, 0x8400, 0, 0, 0, -1, NULL, -1, -1, -1, -1); + psCreate(NULL, g_Vars.currentplayer->prop, sound, + -1, -1, PSFLAG_0400 | PSFLAG_IGNOREROOMS, 0, PSTYPE_NONE, 0, -1, NULL, -1, -1, -1, -1); } } @@ -1063,8 +1063,8 @@ void bwalkUpdateVertical(void) SFX_JO_LANDING_05B7 }; - propsnd0f0939f8(NULL, g_Vars.currentplayer->prop, sounds[random() % 3], - -1, -1, 0x8400, 0, 0, 0, -1, NULL, -1, -1, -1, -1); + psCreate(NULL, g_Vars.currentplayer->prop, sounds[random() % 3], + -1, -1, PSFLAG_0400 | PSFLAG_IGNOREROOMS, 0, PSTYPE_NONE, 0, -1, NULL, -1, -1, -1, -1); } } diff --git a/src/game/bot.c b/src/game/bot.c index caa3f3a0e..e62ee6c93 100644 --- a/src/game/bot.c +++ b/src/game/bot.c @@ -306,8 +306,8 @@ u32 botPickupProp(struct prop *prop, struct chrdata *chr) } // Pickup sound - propsnd0f0939f8(NULL, prop, SFX_PICKUP_AMMO, -1, - -1, 1024, 0, 0, 0, -1, 0, -1, -1, -1, -1); + psCreate(NULL, prop, SFX_PICKUP_AMMO, -1, + -1, PSFLAG_0400, 0, PSTYPE_NONE, 0, -1, 0, -1, -1, -1, -1); objFree(obj, false, obj->hidden2 & OBJH2FLAG_CANREGEN); @@ -357,8 +357,8 @@ u32 botPickupProp(struct prop *prop, struct chrdata *chr) } // Pickup sound - propsnd0f0939f8(NULL, prop, SFX_PICKUP_AMMO, -1, - -1, 1024, 0, 0, 0, -1, 0, -1, -1, -1, -1); + psCreate(NULL, prop, SFX_PICKUP_AMMO, -1, + -1, PSFLAG_0400, 0, PSTYPE_NONE, 0, -1, 0, -1, -1, -1, -1); objFree(obj, false, obj->hidden2 & OBJH2FLAG_CANREGEN); } @@ -410,8 +410,8 @@ u32 botPickupProp(struct prop *prop, struct chrdata *chr) { struct shieldobj *shield = (struct shieldobj *)prop->obj; - propsnd0f0939f8(NULL, prop, SFX_PICKUP_SHIELD, -1, - -1, 1024, 0, 0, 0, -1, 0, -1, -1, -1, -1); + psCreate(NULL, prop, SFX_PICKUP_SHIELD, -1, + -1, PSFLAG_0400, 0, PSTYPE_NONE, 0, -1, 0, -1, -1, -1, -1); chrSetShield(chr, shield->amount * 8); objFree(obj, false, obj->hidden2 & OBJH2FLAG_CANREGEN); diff --git a/src/game/botact.c b/src/game/botact.c index 134118884..9d9149442 100644 --- a/src/game/botact.c +++ b/src/game/botact.c @@ -64,11 +64,11 @@ void botactReload(struct chrdata *chr, s32 handnum, bool withsound) if (withsound) { if (aibot->weaponnum == WEAPON_FARSIGHT) { - propsnd0f0939f8(NULL, chr->prop, SFX_RELOAD_FARSIGHT, -1, - -1, 1024, 0, 0, 0, -1, 0, -1, -1, -1, -1); + psCreate(NULL, chr->prop, SFX_RELOAD_FARSIGHT, -1, + -1, PSFLAG_0400, 0, PSTYPE_NONE, 0, -1, 0, -1, -1, -1, -1); } else { - propsnd0f0939f8(NULL, chr->prop, SFX_RELOAD_DEFAULT, -1, - -1, 1024, 0, 0, 0, -1, 0, -1, -1, -1, -1); + psCreate(NULL, chr->prop, SFX_RELOAD_DEFAULT, -1, + -1, PSFLAG_0400, 0, PSTYPE_NONE, 0, -1, 0, -1, -1, -1, -1); } } } @@ -533,8 +533,8 @@ void botactCreateSlayerRocket(struct chrdata *chr) rocket->base.projectile->pickuptimer240 = 0x20000000; // Fire rocket sound - propsnd0f0939f8(NULL, rocket->base.prop, SFX_LAUNCH_ROCKET_8053, -1, - -1, 0, 0, 0, 0, -1, 0, -1, -1, -1, -1); + psCreate(NULL, rocket->base.prop, SFX_LAUNCH_ROCKET_8053, -1, + -1, 0, 0, PSTYPE_NONE, 0, -1, 0, -1, -1, -1, -1); if (!botactFindRocketRoute(chr, &chr->prop->pos, &target->pos, chr->prop->rooms, target->rooms, rocket->base.projectile)) { rocket->timer240 = 0; // blow up rocket diff --git a/src/game/casingtick.c b/src/game/casingtick.c index 0d22540ef..a70eb036c 100644 --- a/src/game/casingtick.c +++ b/src/game/casingtick.c @@ -1,5 +1,6 @@ #include #include "constants.h" +#include "../lib/naudio/n_sndp.h" #include "game/casing.h" #include "bss.h" #include "lib/snd.h" @@ -47,7 +48,7 @@ void casingTick(struct casing *casing) sndStart(var80095200, SFX_8051, &g_CasingAudioHandles[i], -1, -1, -1.0f, -1, -1); if (g_CasingAudioHandles[i]) { - audioPostEvent(g_CasingAudioHandles[i], 0x10, *(s32 *)&sp58); + audioPostEvent(g_CasingAudioHandles[i], AL_SNDP_PITCH_EVT, *(s32 *)&sp58); } } diff --git a/src/game/chr.c b/src/game/chr.c index a673a668b..d545b3d39 100644 --- a/src/game/chr.c +++ b/src/game/chr.c @@ -1381,7 +1381,7 @@ void chrRemove(struct prop *prop, bool free) } wallhitFadeSplatsForRemovedChr(prop); - func0f0926bc(prop, 1, 0xffff); + psStopSound(prop, PSTYPE_GENERAL, 0xffff); shieldhitsRemoveByProp(prop); modelFreeVertices(VTXSTORETYPE_CHRVTX, model); propDeregisterRooms(prop); @@ -2024,7 +2024,7 @@ void chrCloak(struct chrdata *chr, bool value) chr->hidden |= CHRHFLAG_CLOAKED; if (value) { - propsnd0f0939f8(0, chr->prop, SFX_CLOAK_ON, -1, -1, 0, 0, 0, 0, -1, 0, -1, -1, -1, -1); + psCreate(0, chr->prop, SFX_CLOAK_ON, -1, -1, 0, 0, PSTYPE_NONE, 0, -1, 0, -1, -1, -1, -1); } } } @@ -2035,7 +2035,7 @@ void chrUncloak(struct chrdata *chr, bool value) chr->hidden &= ~CHRHFLAG_CLOAKED; if (value) { - propsnd0f0939f8(0, chr->prop, SFX_CLOAK_OFF, -1, -1, 0, 0, 0, 0, -1, 0, -1, -1, -1, -1); + psCreate(0, chr->prop, SFX_CLOAK_OFF, -1, -1, 0, 0, PSTYPE_NONE, 0, -1, 0, -1, -1, -1, -1); } #if PIRACYCHECKS diff --git a/src/game/chraction.c b/src/game/chraction.c index e084f1acd..382835288 100644 --- a/src/game/chraction.c +++ b/src/game/chraction.c @@ -3046,7 +3046,7 @@ void chrBeginDeath(struct chrdata *chr, struct coord *dir, f32 relangle, s32 hit g_Vars.currentplayer->eyespy->prop->rooms, EXPLOSIONTYPE_EYESPY, 0); invRemoveItemByNum(WEAPON_EYESPY); - func0f0926bc(g_Vars.currentplayer->eyespy->prop, 1, 0xffff); + psStopSound(g_Vars.currentplayer->eyespy->prop, PSTYPE_GENERAL, 0xffff); g_Vars.currentplayer->eyespy = NULL; setCurrentPlayerNum(prevplayernum); @@ -4035,11 +4035,11 @@ void chrChoke(struct chrdata *chr, s32 choketype) sndStart(var80095200, soundnum, &g_Vars.players[playernum]->chokehandle, -1, -1, -1, -1, -1); } } else { - func0f0926bc(chr->prop, 9, 0); + psStopSound(chr->prop, PSTYPE_CHRTALK, 0); - if (!func0f092610(chr->prop, 13)) { - propsnd0f0939f8(NULL, chr->prop, soundnum, -1, - -1, 0, 0, 13, NULL, -1, NULL, -1, -1, -1, -1); + if (!psPropHasSoundWithContext(chr->prop, PSTYPE_CHRCHOKE)) { + psCreate(NULL, chr->prop, soundnum, -1, + -1, 0, 0, PSTYPE_CHRCHOKE, NULL, -1, NULL, -1, -1, -1, -1); } } } @@ -4579,8 +4579,8 @@ void chrDamage(struct chrdata *chr, f32 damage, struct coord *vector, struct gse u16 sounds[] = { SFX_HIT_METAL_807B, SFX_HIT_METAL_8079, SFX_HATHIT_807C }; damage = 0; - propsnd0f0939f8(NULL, chr->prop, sounds[random() % 3], -1, - -1, 0, 0, 0, NULL, -1, NULL, -1, -1, -1, -1); + psCreate(NULL, chr->prop, sounds[random() % 3], -1, + -1, 0, 0, PSTYPE_NONE, NULL, -1, NULL, -1, -1, -1, -1); } } @@ -4915,7 +4915,7 @@ void chrDamage(struct chrdata *chr, f32 damage, struct coord *vector, struct gse // Handle one-hit knockouts if (onehitko && chr->aibot == NULL && race == RACE_HUMAN) { chrKnockOut(chr, angle, hitpart, gset); - func0f0926bc(chr->prop, 9, 0); + psStopSound(chr->prop, PSTYPE_CHRTALK, 0); if (canchoke) { chrChoke(chr, choketype); @@ -8126,8 +8126,8 @@ void chrTickAnim(struct chrdata *chr) && modelGetCurAnimFrame(chr->model) >= 42 && (g_Vars.lvframenum % 2) == 0 && chrGetDistanceToCurrentPlayer(chr) < 800) { - propsnd0f0939f8(NULL, chr->prop, SFX_0037, -1, - -1, 0, 0, 0, 0, -1, 0, -1, -1, -1, -1); + psCreate(NULL, chr->prop, SFX_0037, -1, + -1, 0, 0, PSTYPE_NONE, 0, -1, 0, -1, -1, -1, -1); } if (chr->sleep <= 0 && chr->act_anim.slowupdate) { @@ -8347,7 +8347,7 @@ void chrTickDie(struct chrdata *chr) if (race == RACE_ROBOT) { struct prop *prop = chr->prop; - func0f0926bc(prop, 1, 0xffff); + psStopSound(prop, PSTYPE_GENERAL, 0xffff); explosionCreateSimple(prop, &prop->pos, prop->rooms, EXPLOSIONTYPE_8, g_Vars.currentplayernum); chr->hidden |= CHRHFLAG_DELETING; return; @@ -8367,8 +8367,8 @@ void chrTickDie(struct chrdata *chr) SFX_DRCAROLL_YOU_WERE_SUPPOSED, }; - propsnd0f0939f8(NULL, chr->prop, phrases[random() % 5], -1, - -1, 0, 0, 0, 0, -1, 0, -1, -1, -1, -1); + psCreate(NULL, chr->prop, phrases[random() % 5], -1, + -1, 0, 0, PSTYPE_NONE, 0, -1, 0, -1, -1, -1, -1); chr->voicebox = 0; } @@ -8383,15 +8383,15 @@ void chrTickDie(struct chrdata *chr) if (g_DrCarollDyingTimer > TICKS(310)) { // Explode - func0f0926bc(prop, 1, 0xffff); + psStopSound(prop, PSTYPE_GENERAL, 0xffff); explosionCreateSimple(prop, &prop->pos, prop->rooms, EXPLOSIONTYPE_8, g_Vars.currentplayernum); chrBeginDead(chr); } else if (chr->soundtimer > (s32)var80068080) { // Play shield damage sound chr->soundtimer = 0; var80068080 -= 5; - propsnd0f0939f8(NULL, prop, SFX_SHIELD_DAMAGE, -1, - -1, 1024, 0, 0, 0, -1, 0, -1, -1, -1, -1); + psCreate(NULL, prop, SFX_SHIELD_DAMAGE, -1, + -1, PSFLAG_0400, 0, PSTYPE_NONE, 0, -1, 0, -1, -1, -1, -1); sparksCreate(prop->rooms[0], prop, &prop->pos, NULL, 0, SPARKTYPE_ELECTRICAL); } @@ -8402,11 +8402,11 @@ void chrTickDie(struct chrdata *chr) // If due, play thud 1 sound if (chr->act_die.thudframe1 >= 0 && modelGetCurAnimFrame(model) >= chr->act_die.thudframe1) { if (chr->specialdie == 0) { - propsnd0f0939f8(NULL, chr->prop, thuds[thudindex], -1, - -1, 0, 0, 0, 0, -1, 0, -1, -1, -1, -1); + psCreate(NULL, chr->prop, thuds[thudindex], -1, + -1, 0, 0, PSTYPE_NONE, 0, -1, 0, -1, -1, -1, -1); } else if (chr->specialdie != SPECIALDIE_OVERRAILING) { - propsnd0f0939f8(NULL, chr->prop, specialdiesounds[chr->specialdie - 1], -1, - -1, 0, 0, 0, 0, -1, 0, -1, -1, -1, -1); + psCreate(NULL, chr->prop, specialdiesounds[chr->specialdie - 1], -1, + -1, 0, 0, PSTYPE_NONE, 0, -1, 0, -1, -1, -1, -1); } thudindex++; @@ -8421,11 +8421,11 @@ void chrTickDie(struct chrdata *chr) // If due, play thud 2 sound if (chr->act_die.thudframe2 >= 0 && modelGetCurAnimFrame(model) >= chr->act_die.thudframe2) { if (chr->specialdie < 5) { - propsnd0f0939f8(NULL, chr->prop, SFX_THUD_808E, -1, - -1, 0, 0, 0, 0, -1, 0, -1, -1, -1, -1); + psCreate(NULL, chr->prop, SFX_THUD_808E, -1, + -1, 0, 0, PSTYPE_NONE, 0, -1, 0, -1, -1, -1, -1); } else { - propsnd0f0939f8(NULL, chr->prop, thuds[thudindex], -1, - -1, 0, 0, 0, 0, -1, 0, -1, -1, -1, -1); + psCreate(NULL, chr->prop, thuds[thudindex], -1, + -1, 0, 0, PSTYPE_NONE, 0, -1, 0, -1, -1, -1, -1); } thudindex++; @@ -8549,8 +8549,8 @@ void chrTickDruggedDrop(struct chrdata *chr) // If due, play thud 1 sound if (chr->act_die.thudframe1 >= 0 && modelGetCurAnimFrame(model) >= chr->act_die.thudframe1) { - propsnd0f0939f8(NULL, chr->prop, thuds[thudindex], -1, - -1, 0, 0, 0, 0, -1, 0, -1, -1, -1, -1); + psCreate(NULL, chr->prop, thuds[thudindex], -1, + -1, 0, 0, PSTYPE_NONE, 0, -1, 0, -1, -1, -1, -1); thudindex++; @@ -8563,8 +8563,8 @@ void chrTickDruggedDrop(struct chrdata *chr) // If due, play thud 2 sound if (chr->act_die.thudframe2 >= 0 && modelGetCurAnimFrame(model) >= chr->act_die.thudframe2) { - propsnd0f0939f8(NULL, chr->prop, thuds[thudindex], -1, - -1, 0, 0, 0, 0, -1, 0, -1, -1, -1, -1); + psCreate(NULL, chr->prop, thuds[thudindex], -1, + -1, 0, 0, PSTYPE_NONE, 0, -1, 0, -1, -1, -1, -1); thudindex++; @@ -8807,11 +8807,13 @@ void chrUpdateFireslot(struct chrdata *chr, s32 handnum, bool withsound, bool wi if (playsound) { #if VERSION >= VERSION_NTSC_1_0 - propsnd0f0939f8(NULL, chr->prop, soundnum, -1, -1, 0x400, 4, 0x11, NULL, -1, NULL, -1, -1, -1, -1); + psCreate(NULL, chr->prop, soundnum, -1, -1, + PSFLAG_0400, PSFLAG2_PRINTABLE, PSTYPE_CHRSHOOT, NULL, -1, NULL, -1, -1, -1, -1); fireslot->endlvframe = (u32)g_Vars.lvframe60 + duration; chr->hidden2 |= CHRH2FLAG_FIRESOUNDDONE; #else - propsnd0f0939f8(NULL, chr->prop, soundnum, -1, -1, 0x400, 4, 0, NULL, -1, NULL, -1, -1, -1, -1); + psCreate(NULL, chr->prop, soundnum, -1, -1, + PSFLAG_0400, PSFLAG2_PRINTABLE, PSTYPE_NONE, NULL, -1, NULL, -1, -1, -1, -1); fireslot->endlvframe = (u32)g_Vars.lvframe60 + duration; chr->hidden |= CHRHFLAG_FIRESOUNDDONE; @@ -10235,8 +10237,8 @@ void chrTickShoot(struct chrdata *chr, s32 handnum) // Play sound if (func->soundnum > 0) { - propsnd0f0939f8(NULL, projectileobj->base.prop, func->soundnum, -1, - -1, 0, 0, 0, NULL, -1, NULL, -1, -1, -1, -1); + psCreate(NULL, projectileobj->base.prop, func->soundnum, -1, + -1, 0, 0, PSTYPE_NONE, NULL, -1, NULL, -1, -1, -1, -1); } } } @@ -13183,8 +13185,8 @@ void chrTickSkJump(struct chrdata *chr) SFX_SKEDAR_ROAR_0534, }; - propsnd0f0939f8(NULL, chr->prop, sounds[random() % 3], -1, - -1, 0, 0, 0, 0, -1, 0, -1, -1, -1, -1); + psCreate(NULL, chr->prop, sounds[random() % 3], -1, + -1, 0, 0, PSTYPE_NONE, 0, -1, 0, -1, -1, -1, -1); modelSetAnimation(chr->model, ANIM_SKEDAR_JUMPAIR, 0, 0, -1, 16); modelSetAnimSpeed(chr->model, 1, 0); } @@ -16237,7 +16239,7 @@ bool chrIsAvoiding(struct chrdata *chr) void chrDrCarollEmitSparks(struct chrdata *chr) { if (chr && chr->prop) { - propsnd0f0939f8(0, chr->prop, SFX_SHIELD_DAMAGE, -1, -1, 0, 0, 0, 0, -1, 0, -1, -1, -1, -1); + psCreate(0, chr->prop, SFX_SHIELD_DAMAGE, -1, -1, 0, 0, PSTYPE_NONE, 0, -1, 0, -1, -1, -1, -1); sparksCreate(chr->prop->rooms[0], chr->prop, &chr->prop->pos, NULL, 0, SPARKTYPE_ELECTRICAL); } } diff --git a/src/game/chrai.c b/src/game/chrai.c index 6249c567a..ea5294dc0 100644 --- a/src/game/chrai.c +++ b/src/game/chrai.c @@ -218,12 +218,12 @@ bool (*g_CommandPointers[])(void) = { /*0x00cc*/ aiShowHudmsgTopMiddle, /*0x00cd*/ aiSpeak, /*0x00ce*/ aiPlaySound, - /*0x00cf*/ ai00cf, - /*0x00d0*/ ai00d0, - /*0x00d1*/ ai00d1, - /*0x00d2*/ ai00d2, + /*0x00cf*/ aiSetObjectSoundPlaying, + /*0x00d0*/ aiPlayRepeatingSoundFromPad, + /*0x00d1*/ aiSetObjectSoundVolume, + /*0x00d2*/ aiSetObjectSoundVolumeByDistance, /*0x00d3*/ aiAudioMuteChannel, - /*0x00d4*/ ai00d4, + /*0x00d4*/ aiIfObjectSoundVolumeLessThan, /*0x00d5*/ aiHovercarBeginPath, /*0x00d6*/ aiSetVehicleSpeed, /*0x00d7*/ aiSetRotorSpeed, @@ -323,7 +323,7 @@ bool (*g_CommandPointers[])(void) = { /*0x0135*/ aiIfHasOrders, /*0x0136*/ aiRetreat, /*0x0137*/ aiIfChrInSquadronDoingAction, - /*0x0138*/ aiIfChannelIdle, + /*0x0138*/ aiIfChannelFree, /*0x0139*/ ai0139, /*0x013a*/ aiSetChrPresetToUnalertedTeammate, /*0x013b*/ aiSetSquadron, @@ -374,7 +374,7 @@ bool (*g_CommandPointers[])(void) = { /*0x0168*/ aiIfShieldDamaged, /*0x0169*/ aiIfNaturalAnim, /*0x016a*/ aiIfY, - /*0x016b*/ ai016b, + /*0x016b*/ aiPlayRepeatingSoundFromObject, /*0x016c*/ aiNoOp016c, /*0x016d*/ aiChrAdjustMotionBlur, /*0x016e*/ aiDamageChrByAmount, @@ -388,7 +388,7 @@ bool (*g_CommandPointers[])(void) = { /*0x0176*/ aiIfBotRespawning, /*0x0177*/ aiPlayerAutoWalk, /*0x0178*/ aiIfPlayerAutoWalkFinished, - /*0x0179*/ ai0179, + /*0x0179*/ aiPlaySoundFromEntity, /*0x017a*/ aiIfLosToAttackTarget, /*0x017b*/ aiIfChrKnockedOut, /*0x017c*/ aiAssignSound, diff --git a/src/game/chraicommands.c b/src/game/chraicommands.c index 0eb4662b6..f7aba6865 100644 --- a/src/game/chraicommands.c +++ b/src/game/chraicommands.c @@ -1,5 +1,5 @@ #include -#include "constants.h" +#include "../lib/naudio/n_sndp.h" #include "constants.h" #include "game/bondmove.h" #include "game/cheats.h" @@ -4435,13 +4435,13 @@ bool aiSpeak(void) setCurrentPlayerNum(playernum); if (text && cmd[2] != CHR_P1P2) { - func0f0926bc(g_Vars.chrdata->prop, 9, 0xffff); + psStopSound(g_Vars.chrdata->prop, PSTYPE_CHRTALK, 0xffff); } if (cmd[2] == CHR_P1P2) { - channelnum = audioPlayFromProp((s8)cmd[7], audio_id, 0, g_Vars.chrdata->prop, 0, 512); + channelnum = psPlayFromProp((s8)cmd[7], audio_id, 0, g_Vars.chrdata->prop, PSTYPE_NONE, PSFLAG_FORHUDMSG); } else { - channelnum = audioPlayFromProp((s8)cmd[7], audio_id, 0, g_Vars.chrdata->prop, 9, 512); + channelnum = psPlayFromProp((s8)cmd[7], audio_id, 0, g_Vars.chrdata->prop, PSTYPE_CHRTALK, PSFLAG_FORHUDMSG); } if (text && !sndIsFiltered(audio_id)) { @@ -4463,7 +4463,7 @@ bool aiPlaySound(void) u8 *cmd = g_Vars.ailist + g_Vars.aioffset; s16 audio_id = cmd[3] | (cmd[2] << 8); - audioPlayFromProp((s8)cmd[4], audio_id, 0, NULL, 0, 0); + psPlayFromProp((s8)cmd[4], audio_id, 0, NULL, PSTYPE_NONE, 0); g_Vars.aioffset += 5; @@ -4478,7 +4478,7 @@ bool aiAssignSound(void) u8 *cmd = g_Vars.ailist + g_Vars.aioffset; s16 audio_id = cmd[3] | (cmd[2] << 8); - audioPlayFromProp((s8)cmd[4], audio_id, -1, NULL, 11, 0); + psPlayFromProp((s8)cmd[4], audio_id, -1, NULL, PSTYPE_MARKER, 0); g_Vars.aioffset += 5; @@ -4493,7 +4493,7 @@ bool aiAudioMuteChannel(void) u8 *cmd = g_Vars.ailist + g_Vars.aioffset; s8 channel = (s8)cmd[2]; - audioMuteChannel(channel); + psMuteChannel(channel); g_Vars.aioffset += 3; return false; @@ -4502,12 +4502,12 @@ bool aiAudioMuteChannel(void) /** * @cmd 0138 */ -bool aiIfChannelIdle(void) +bool aiIfChannelFree(void) { u8 *cmd = g_Vars.ailist + g_Vars.aioffset; s8 channel = (s8) cmd[2]; - if (audioIsChannelIdle(channel)) { + if (psIsChannelFree(channel)) { g_Vars.aioffset = chraiGoToLabel(g_Vars.ailist, g_Vars.aioffset, cmd[3]); } else { g_Vars.aioffset += 4; @@ -4519,13 +4519,13 @@ bool aiIfChannelIdle(void) /** * @cmd 00d1 */ -bool ai00d1(void) +bool aiSetObjectSoundVolume(void) { u8 *cmd = g_Vars.ailist + g_Vars.aioffset; - s16 audio_id = cmd[4] | (cmd[3] << 8); - u16 thing = cmd[6] | (cmd[5] << 8); + s16 volume = cmd[4] | (cmd[3] << 8); + u16 volchangetimer60 = cmd[6] | (cmd[5] << 8); - audioPlayFromProp2((s8)cmd[2], audio_id, -1, NULL, thing, 2500, 3000, 0); + psModify((s8)cmd[2], volume, -1, NULL, volchangetimer60, 2500, 3000, 0); g_Vars.aioffset += 7; @@ -4535,14 +4535,14 @@ bool ai00d1(void) /** * @cmd 00d2 */ -bool ai00d2(void) +bool aiSetObjectSoundVolumeByDistance(void) { u8 *cmd = g_Vars.ailist + g_Vars.aioffset; - f32 thing1 = cmd[4] | (cmd[3] << 8); - u16 thing2 = cmd[6] | (cmd[5] << 8); - s32 audio_id = func0f0927d4(thing1, 400, 2500, 3000, 32767); + f32 playerdist = cmd[4] | (cmd[3] << 8); + u16 volchangetimer60 = cmd[6] | (cmd[5] << 8); + s32 volume = psCalculateVolumeFromDistance(playerdist, 400, 2500, 3000, AL_VOL_FULL); - audioPlayFromProp2((s8)cmd[2], audio_id, -1, NULL, thing2, 2500, 3000, 0); + psModify((s8)cmd[2], volume, -1, NULL, volchangetimer60, 2500, 3000, 0); g_Vars.aioffset += 7; @@ -4552,14 +4552,14 @@ bool ai00d2(void) /** * @cmd 00cf */ -bool ai00cf(void) +bool aiSetObjectSoundPlaying(void) { u8 *cmd = g_Vars.ailist + g_Vars.aioffset; struct defaultobj *obj = objFindByTagId(cmd[3]); - u16 thing = cmd[5] | (cmd[4] << 8); + u16 volchangetimer60 = cmd[5] | (cmd[4] << 8); if (obj && obj->prop) { - audioPlayFromProp2((s8)cmd[2], -1, -1, obj->prop, thing, 2500, 3000, 0); + psModify((s8)cmd[2], -1, -1, obj->prop, volchangetimer60, 2500, 3000, 0); } g_Vars.aioffset += 6; @@ -4570,24 +4570,24 @@ bool ai00cf(void) /** * @cmd 016b */ -bool ai016b(void) +bool aiPlayRepeatingSoundFromObject(void) { u8 *cmd = g_Vars.ailist + g_Vars.aioffset; struct defaultobj *obj = objFindByTagId(cmd[3]); u16 thing1 = cmd[5] | (cmd[4] << 8); - u16 thing2 = cmd[7] | (cmd[6] << 8); - u16 thing3 = cmd[9] | (cmd[8] << 8); + u16 dist2 = cmd[7] | (cmd[6] << 8); + u16 dist3 = cmd[9] | (cmd[8] << 8); if (obj && obj->prop) { - s32 thing1again; + s32 volchangetimer60; if (thing1 == 0) { - thing1again = -1; + volchangetimer60 = -1; } else { - thing1again = thing1; + volchangetimer60 = thing1; } - audioPlayFromProp2((s8)cmd[2], -1, -1, obj->prop, thing1again, thing2, thing3, 2); + psModify((s8)cmd[2], -1, -1, obj->prop, volchangetimer60, dist2, dist3, PSFLAG_REPEATING); } g_Vars.aioffset += 10; @@ -4598,24 +4598,24 @@ bool ai016b(void) /** * @cmd 0179 */ -bool ai0179(void) +bool aiPlaySoundFromEntity(void) { u8 *cmd = g_Vars.ailist + g_Vars.aioffset; - u16 thing1 = cmd[5] | (cmd[4] << 8); - u16 thing2 = cmd[7] | (cmd[6] << 8); - u16 thing3 = cmd[9] | (cmd[8] << 8); + u16 volchangetimer60 = cmd[5] | (cmd[4] << 8); + u16 dist2 = cmd[7] | (cmd[6] << 8); + u16 dist3 = cmd[9] | (cmd[8] << 8); if (cmd[10] == 0) { struct defaultobj *obj = objFindByTagId(cmd[3]); if (obj && obj->prop) { - audioPlayFromProp2((s8)cmd[2], -1, -1, obj->prop, thing1, thing2, thing3, 0); + psModify((s8)cmd[2], -1, -1, obj->prop, volchangetimer60, dist2, dist3, 0); } } else { struct chrdata *chr = chrFindById(g_Vars.chrdata, cmd[3]); if (chr && chr->prop) { - audioPlayFromProp2((s8)cmd[2], -1, -1, chr->prop, thing1, thing2, thing3, 0); + psModify((s8)cmd[2], -1, -1, chr->prop, volchangetimer60, dist2, dist3, 0); } } @@ -4627,13 +4627,13 @@ bool ai0179(void) /** * @cmd 00d0 */ -bool ai00d0(void) +bool aiPlayRepeatingSoundFromPad(void) { u8 *cmd = g_Vars.ailist + g_Vars.aioffset; s16 padnum = cmd[4] | (cmd[3] << 8); s16 sound = cmd[6] | (cmd[5] << 8); - propsnd0f0939f8(0, NULL, sound, padnum, -1, 2, 0, 0, 0, -1, 0, -1, -1, -1, -1); + psCreate(0, NULL, sound, padnum, -1, PSFLAG_REPEATING, 0, PSTYPE_NONE, 0, -1, 0, -1, -1, -1, -1); g_Vars.aioffset += 7; @@ -4643,12 +4643,12 @@ bool ai00d0(void) /** * @cmd 00d4 */ -bool ai00d4(void) +bool aiIfObjectSoundVolumeLessThan(void) { u8 *cmd = g_Vars.ailist + g_Vars.aioffset; - s16 thing = cmd[4] | (cmd[3] << 8); + s16 value = cmd[4] | (cmd[3] << 8); - if (channelGetUnk06((s8)cmd[2]) < thing) { + if (psGetVolume((s8)cmd[2]) < value) { g_Vars.aioffset = chraiGoToLabel(g_Vars.ailist, g_Vars.aioffset, cmd[5]); } else { g_Vars.aioffset += 6; @@ -5321,7 +5321,7 @@ bool aiSetDoorOpen(void) door->mode = 0; doorUpdateTiles(door); doorActivatePortal(door); - func0f0926bc(door->base.prop, 1, 0xffff); + psStopSound(door->base.prop, PSTYPE_GENERAL, 0xffff); } g_Vars.aioffset += 3; @@ -6991,16 +6991,16 @@ bool aiSayQuip(void) g_Vars.chrdata->propsoundcount++; if (!AUDIO_NEEDS_MOVEMENT(audioid)) { - func0f0926bc(g_Vars.chrdata->prop, 9, 0xffff); - propsnd0f0939f8(0, g_Vars.chrdata->prop, audioid, -1, - -1, 8, 0, 9, 0, -1, 0, -1, -1, -1, -1); + psStopSound(g_Vars.chrdata->prop, PSTYPE_CHRTALK, 0xffff); + psCreate(0, g_Vars.chrdata->prop, audioid, -1, + -1, PSFLAG_FORPROP, 0, PSTYPE_CHRTALK, 0, -1, 0, -1, -1, -1, -1); } else { distance = chrGetDistanceLostToTargetInLastSecond(g_Vars.chrdata); if (ABS(distance) > 50) { - func0f0926bc(g_Vars.chrdata->prop, 9, 0xffff); - propsnd0f0939f8(0, g_Vars.chrdata->prop, audioid, -1, - -1, 8, 0, 9, 0, -1, 0, -1, -1, -1, -1); + psStopSound(g_Vars.chrdata->prop, PSTYPE_CHRTALK, 0xffff); + psCreate(0, g_Vars.chrdata->prop, audioid, -1, + -1, PSFLAG_FORPROP, 0, PSTYPE_CHRTALK, 0, -1, 0, -1, -1, -1, -1); } } @@ -7054,16 +7054,16 @@ bool aiSayQuip(void) g_Vars.chrdata->propsoundcount++; if (!AUDIO_NEEDS_MOVEMENT(audioid)) { - func0f0926bc(g_Vars.chrdata->prop, 9, 0xffff); - propsnd0f0939f8(0, g_Vars.chrdata->prop, audioid, -1, - -1, 8, 0, 9, 0, -1, 0, -1, -1, -1, -1); + psStopSound(g_Vars.chrdata->prop, PSTYPE_CHRTALK, 0xffff); + psCreate(0, g_Vars.chrdata->prop, audioid, -1, + -1, PSFLAG_FORPROP, 0, PSTYPE_CHRTALK, 0, -1, 0, -1, -1, -1, -1); } else { distance = chrGetDistanceLostToTargetInLastSecond(g_Vars.chrdata); if (ABS(distance) > 50) { - func0f0926bc(g_Vars.chrdata->prop, 9, 0xffff); - propsnd0f0939f8(0, g_Vars.chrdata->prop, audioid, -1, - -1, 8, 0, 9, 0, -1, 0, -1, -1, -1, -1); + psStopSound(g_Vars.chrdata->prop, PSTYPE_CHRTALK, 0xffff); + psCreate(0, g_Vars.chrdata->prop, audioid, -1, + -1, PSFLAG_FORPROP, 0, PSTYPE_CHRTALK, 0, -1, 0, -1, -1, -1, -1); } } @@ -8740,22 +8740,22 @@ bool aiSayCiStaffQuip(void) if (cmd[2] == CIQUIP_GREETING) { quip = g_CiGreetingQuips[g_Vars.chrdata->morale][random() % 3]; - audioPlayFromProp((s8)cmd[3], quip, 0, g_Vars.chrdata->prop, 9, 0); + psPlayFromProp((s8)cmd[3], quip, 0, g_Vars.chrdata->prop, PSTYPE_CHRTALK, 0); } if (cmd[2] == CIQUIP_MAIN) { quip = g_CiMainQuips[g_Vars.chrdata->morale][random() % 3]; - audioPlayFromProp((s8)cmd[3], quip, 0, g_Vars.chrdata->prop, 9, 0); + psPlayFromProp((s8)cmd[3], quip, 0, g_Vars.chrdata->prop, PSTYPE_CHRTALK, 0); } if (cmd[2] == CIQUIP_ANNOYED) { quip = g_CiAnnoyedQuips[g_Vars.chrdata->morale][random() % 3]; - audioPlayFromProp((s8)cmd[3], quip, 0, g_Vars.chrdata->prop, 9, 0); + psPlayFromProp((s8)cmd[3], quip, 0, g_Vars.chrdata->prop, PSTYPE_CHRTALK, 0); } if (cmd[2] == CIQUIP_THANKS) { quip = g_CiThanksQuips[g_Vars.chrdata->morale]; - audioPlayFromProp((s8)cmd[3], quip, 0, g_Vars.chrdata->prop, 9, 0); + psPlayFromProp((s8)cmd[3], quip, 0, g_Vars.chrdata->prop, PSTYPE_CHRTALK, 0); } g_Vars.aioffset += 4; @@ -9273,7 +9273,7 @@ bool aiChrBeginOrEndTeleport(void) handle = sndStart(var80095200, SFX_RELOAD_FARSIGHT, NULL, -1, -1, -1, -1, -1); if (handle) { - audioPostEvent(handle, 16, *(u32 *)&fvalue); + audioPostEvent(handle, AL_SNDP_PITCH_EVT, *(u32 *)&fvalue); } #if VERSION >= VERSION_NTSC_1_0 @@ -9324,7 +9324,7 @@ bool aiIfChrTeleportFullWhite(void) handle = sndStart(var80095200, SFX_FIRE_SHOTGUN, NULL, -1, -1, -1, -1, -1); if (handle) { - audioPostEvent(handle, 16, *(u32 *)&fvalue); + audioPostEvent(handle, AL_SNDP_PITCH_EVT, *(u32 *)&fvalue); } #if VERSION >= VERSION_NTSC_1_0 @@ -9771,13 +9771,13 @@ bool aiPlaySoundFromProp(void) { u8 *cmd = g_Vars.ailist + g_Vars.aioffset; s16 audio_id = cmd[5] | (cmd[4] << 8); - s32 volumemaybe = cmd[7] | (cmd[6] << 8); - u16 unk1 = cmd[10] | (cmd[10] << 8); // @bug: Using 10 twice + s32 volume = cmd[7] | (cmd[6] << 8); + u16 flags = cmd[10] | (cmd[10] << 8); // @bug: Using 10 twice s32 channel = (s8)cmd[2]; - s16 unk2 = cmd[8]; + s16 type = cmd[8]; struct defaultobj *obj = objFindByTagId(cmd[3]); - audioPlayFromProp(channel, audio_id, volumemaybe, obj->prop, unk2, unk1); + psPlayFromProp(channel, audio_id, volume, obj->prop, type, flags); g_Vars.aioffset += 11; diff --git a/src/game/dlights.c b/src/game/dlights.c index 2c383f450..3def7eaf0 100644 --- a/src/game/dlights.c +++ b/src/game/dlights.c @@ -507,7 +507,7 @@ bool lightsHandleHit(struct coord *gunpos, struct coord *hitpos, s32 roomnum) soundpos.z = light->bbox[0].z; roomSetLightBroken(roomnum, i); - propsnd0f0939f8(0, 0, SFX_HIT_GLASS, -1, -1, 0x400, 0, 0, &soundpos, -1.0f, 0, roomnum, -1.0f, -1.0f, -1.0f); + psCreate(0, 0, SFX_HIT_GLASS, -1, -1, PSFLAG_0400, 0, PSTYPE_NONE, &soundpos, -1.0f, 0, roomnum, -1.0f, -1.0f, -1.0f); return true; } } @@ -1064,7 +1064,7 @@ bool lightTickBroken(s32 roomnum, s32 lightnum) } roomFlashLighting(roomnum, 64, 80); - propsnd0f0939f8(NULL, NULL, propsndGetRandomSparkSound(), -1, -1, 0x400, 0, 0x10, ¢re, -1.0f, 0, roomnum, -1.0f, -1.0f, -1.0f); + psCreate(NULL, NULL, psGetRandomSparkSound(), -1, -1, PSFLAG_0400, 0, PSTYPE_FOOTSTEP, ¢re, -1.0f, 0, roomnum, -1.0f, -1.0f, -1.0f); return true; } } else { diff --git a/src/game/explosions.c b/src/game/explosions.c index 5ec84b453..43a8a8e62 100644 --- a/src/game/explosions.c +++ b/src/game/explosions.c @@ -1170,7 +1170,7 @@ u32 explosionTick(struct prop *prop) // Play boom sound if this is the first frame if (exp->age == 0) { - propsnd0f0939f8(NULL, NULL, type->sound, -1, -1, 0, 0, 0, &exp->prop->pos, -1.0f, exp->prop->rooms, -1, -1.0f, -1.0f, -1.0f); + psCreate(NULL, NULL, type->sound, -1, -1, 0, 0, PSTYPE_NONE, &exp->prop->pos, -1.0f, exp->prop->rooms, -1, -1.0f, -1.0f, -1.0f); } for (k = 0; k < (s32)lvupdate; k++) { diff --git a/src/game/footstep.c b/src/game/footstep.c index 55e0b62af..c81ef8cc2 100644 --- a/src/game/footstep.c +++ b/src/game/footstep.c @@ -187,9 +187,9 @@ void footstepCheckDefault(struct chrdata *chr) if (soundnum != -1 && chr->footstep != 0) { #if VERSION >= VERSION_NTSC_1_0 - propsnd0f0939f8(NULL, chr->prop, soundnum, -1, -1, 1024, 0, 16, NULL, -1, NULL, -1, -1, -1, -1); + psCreate(NULL, chr->prop, soundnum, -1, -1, PSFLAG_0400, 0, PSTYPE_FOOTSTEP, NULL, -1, NULL, -1, -1, -1, -1); #else - propsnd0f0939f8(NULL, chr->prop, soundnum, -1, -1, 0, 0, 0, NULL, -1, NULL, -1, -1, -1, -1); + psCreate(NULL, chr->prop, soundnum, -1, -1, 0, 0, PSTYPE_NONE, NULL, -1, NULL, -1, -1, -1, -1); #endif } @@ -267,11 +267,11 @@ void footstepCheckMagic(struct chrdata *chr) if (soundnum != -1 && chr->footstep != 0) { #if VERSION >= VERSION_NTSC_1_0 - propsnd0f0939f8(NULL, chr->prop, soundnum, -1, - -1, 1024, 0, 16, NULL, -1, NULL, -1, -1, -1, -1); + psCreate(NULL, chr->prop, soundnum, -1, + -1, PSFLAG_0400, 0, PSTYPE_FOOTSTEP, NULL, -1, NULL, -1, -1, -1, -1); #else - propsnd0f0939f8(NULL, chr->prop, soundnum, -1, - -1, 0, 0, 0, NULL, -1, NULL, -1, -1, -1, -1); + psCreate(NULL, chr->prop, soundnum, -1, + -1, 0, 0, PSTYPE_NONE, NULL, -1, NULL, -1, -1, -1, -1); #endif } } diff --git a/src/game/hudmsg.c b/src/game/hudmsg.c index 3efcaab36..f9ac6d6c6 100644 --- a/src/game/hudmsg.c +++ b/src/game/hudmsg.c @@ -555,7 +555,7 @@ void hudmsgCreateAsSubtitle(char *srctext, s32 type, u8 colourindex, s32 audioch s32 audioduration60; struct hudmsgtype *config; - audioduration60 = propsndGetDuration60(audiochannelnum); + audioduration60 = psGetDuration60(audiochannelnum); if (type == HUDMSGTYPE_INGAMESUBTITLE) { if (g_Vars.tickmode == TICKMODE_CUTSCENE) { @@ -1161,7 +1161,7 @@ void hudmsgsTick(void) previd = msg->id; if (msg->channelnum >= 0) { - msg->opacity = propsndGetSubtitleOpacity(msg->channelnum); + msg->opacity = psGetSubtitleOpacity(msg->channelnum); } else { msg->opacity = 0xff; } @@ -1285,7 +1285,7 @@ void hudmsgsTick(void) // Subtitles have an audio channel number and are hidden when the audio stops if (msg->channelnum >= 0) { - if (audioIsChannelIdle(msg->channelnum)) { + if (psIsChannelFree(msg->channelnum)) { hide = true; } else if (msg->flags & HUDMSGFLAG_FORCEOFF) { msg->flags &= ~HUDMSGFLAG_FORCEOFF; diff --git a/src/game/lv.c b/src/game/lv.c index c33b852dd..083b60d31 100644 --- a/src/game/lv.c +++ b/src/game/lv.c @@ -367,7 +367,7 @@ void lvReset(s32 stagenum) objectivesReset(); vtxstoreReset(); modelmgrReset(); - propsndReset(); + psReset(); setupLoadFiles(stagenum); scenarioReset(); varsReset(); @@ -2207,7 +2207,7 @@ void lvTick(void) && g_MiscAudioHandle == NULL && !lvIsPaused() && nexttime < TICKS(g_MpTimeLimit60)) { - snd00010718(&g_MiscAudioHandle, 0, 0x7fff, 0x40, 163, 1, 1, -1, 1); + snd00010718(&g_MiscAudioHandle, 0, AL_VOL_FULL, AL_PAN_CENTER, SFX_ALARM_DEFAULT, 1, 1, -1, true); } } @@ -2397,7 +2397,7 @@ void lvStop(void) objectivesStop(); stub0f015260(); bgunStop(); - propsndStop(); + psStop(); musicStop(); hudmsgsStop(); diff --git a/src/game/menu.c b/src/game/menu.c index 069f86d68..91dcc951b 100644 --- a/src/game/menu.c +++ b/src/game/menu.c @@ -1,5 +1,6 @@ #include #include "constants.h" +#include "../lib/naudio/n_sndp.h" #include "game/camdraw.h" #include "game/game_006900.h" #include "game/body.h" @@ -132,9 +133,9 @@ s32 g_MpPlayerNum = 0; void menuPlaySound(s32 menusound) { s32 sound = -1; - s32 flag1 = false; - s32 flag2 = false; - f32 speed = 1; + s32 setpitch = false; + s32 setvol = false; + f32 pitch = 1; switch (menusound) { case MENUSOUND_SWIPE: @@ -150,9 +151,9 @@ void menuPlaySound(s32 menusound) sound = SFX_MENU_SELECT; break; case MENUSOUND_ERROR: - speed = 0.4f; + pitch = 0.4f; sound = SFX_MENU_ERROR; - flag1 = true; + setpitch = true; break; case MENUSOUND_EXPLOSION: sound = SFX_EXPLOSION_8098; @@ -168,14 +169,14 @@ void menuPlaySound(s32 menusound) break; case MENUSOUND_KEYBOARDFOCUS: sound = SFX_PICKUP_AMMO; - flag1 = true; - flag2 = true; - speed = 3.5f; + setpitch = true; + setvol = true; + pitch = 3.5f; break; case MENUSOUND_KEYBOARDCANCEL: sound = SFX_MENU_CANCEL; - flag1 = true; - speed = 0.41904801130295f; + setpitch = true; + pitch = 0.41904801130295f; break; } @@ -189,12 +190,12 @@ void menuPlaySound(s32 menusound) handle = sndStart(var80095200, sound, NULL, -1, -1, -1, -1, -1); - if (handle && flag1) { - audioPostEvent(handle, 16, *(s32 *)&speed); + if (handle && setpitch) { + audioPostEvent(handle, AL_SNDP_PITCH_EVT, *(s32 *)&pitch); } - if (handle && flag2) { - audioPostEvent(handle, 8, 0x4000); + if (handle && setvol) { + audioPostEvent(handle, AL_SNDP_VOL_EVT, 0x4000); } #if VERSION >= VERSION_NTSC_1_0 diff --git a/src/game/mplayer/scenarios/hackthatmac.inc b/src/game/mplayer/scenarios/hackthatmac.inc index 2c9a0cf1b..d065929ec 100644 --- a/src/game/mplayer/scenarios/hackthatmac.inc +++ b/src/game/mplayer/scenarios/hackthatmac.inc @@ -444,8 +444,8 @@ void htmTickChr(struct chrdata *chr) #else hudmsgCreateWithFlags(langGet(L_MPWEAPONS_018), HUDMSGTYPE_MPSCENARIO, HUDMSGFLAG_ONLYIFALIVE); // "Starting download." #endif - propsnd0f0939f8(NULL, data->terminals[data->dlterminalnum].prop, SFX_01BF, -1, - -1, 2, 2, 0, NULL, -1, NULL, -1, -1, -1, -1); + psCreate(NULL, data->terminals[data->dlterminalnum].prop, SFX_01BF, -1, + -1, PSFLAG_REPEATING, PSFLAG2_MPPAUSABLE, PSTYPE_NONE, NULL, -1, NULL, -1, -1, -1, -1); } } } else { @@ -455,7 +455,7 @@ void htmTickChr(struct chrdata *chr) #else hudmsgCreateWithFlags(langGet(L_MPWEAPONS_019), HUDMSGTYPE_MPSCENARIO, HUDMSGFLAG_ONLYIFALIVE); // "You need to use the Data Uplink." #endif - snd00010718(NULL, 0, 0x7fff, 0x40, SFX_01CC, 1, 1, -1, 1); + snd00010718(NULL, 0, AL_VOL_FULL, AL_PAN_CENTER, SFX_01CC, 1, 1, -1, 1); } } } @@ -528,8 +528,8 @@ void htmTickChr(struct chrdata *chr) #else hudmsgCreateWithFlags(langGet(L_MPWEAPONS_017), HUDMSGTYPE_MPSCENARIO, HUDMSGFLAG_ONLYIFALIVE); #endif - func0f0926bc(data->terminals[data->dlterminalnum].prop, 1, 0xffff); - snd00010718(NULL, 0, 0x7fff, 0x40, SFX_01CC, 1, 1, -1, 1); + psStopSound(data->terminals[data->dlterminalnum].prop, PSTYPE_GENERAL, 0xffff); + snd00010718(NULL, 0, AL_VOL_FULL, AL_PAN_CENTER, SFX_01CC, 1, 1, -1, 1); } data->dlterminalnum = -1; @@ -549,8 +549,8 @@ void htmTickChr(struct chrdata *chr) #else hudmsgCreateWithFlags(langGet(L_MPWEAPONS_016), HUDMSGTYPE_MPSCENARIO, HUDMSGFLAG_ONLYIFALIVE); #endif - func0f0926bc(data->terminals[data->dlterminalnum].prop, 1, 0xffff); - snd00010718(NULL, 0, 0x7fff, 0x40, SFX_01C1, 1, 1, -1, 1); + psStopSound(data->terminals[data->dlterminalnum].prop, PSTYPE_GENERAL, 0xffff); + snd00010718(NULL, 0, AL_VOL_FULL, AL_PAN_CENTER, SFX_01C1, 1, 1, -1, 1); } data->dlterminalnum = -1; diff --git a/src/game/nbomb.c b/src/game/nbomb.c index dbbeb2227..c38e0265d 100644 --- a/src/game/nbomb.c +++ b/src/game/nbomb.c @@ -1,5 +1,6 @@ #include #include "constants.h" +#include "../lib/naudio/n_sndp.h" #include "game/chraction.h" #include "game/dlights.h" #include "game/game_006900.h" @@ -567,7 +568,7 @@ void nbombsTick(void) { s32 i; s32 youngest240 = 20000; - s32 somevalue; + s32 volume; if (g_Vars.lvupdate240 != 0) { g_NbombsActive = false; @@ -585,7 +586,7 @@ void nbombsTick(void) } } - somevalue = 0; + volume = 0; if (youngest240 < TICKS(350)) { if (g_Vars.lvupdate240 != 0) { @@ -593,21 +594,21 @@ void nbombsTick(void) sndStart(var80095200, SFX_SHIP_HUM, &g_NbombAudioHandle, -1, -1, -1, -1, -1); } - somevalue = 32767; + volume = AL_VOL_FULL; if (g_NbombAudioHandle) { f32 speed = menuGetSinOscFrac(20) * 0.02f + 0.4f; if (youngest240 > TICKS(300)) { - somevalue = (1.0f - (f32)(youngest240 - TICKS(300)) / (PAL ? 41.0f : 50.0f)) * 32767.0f; + volume = (1.0f - (f32)(youngest240 - TICKS(300)) / (PAL ? 41.0f : 50.0f)) * AL_VOL_FULL; } if (youngest240 >= TICKS(350)) { - somevalue = 0; + volume = 0; } - audioPostEvent(g_NbombAudioHandle, 8, somevalue); - audioPostEvent(g_NbombAudioHandle, 16, *(s32 *)&speed); + audioPostEvent(g_NbombAudioHandle, AL_SNDP_VOL_EVT, volume); + audioPostEvent(g_NbombAudioHandle, AL_SNDP_PITCH_EVT, *(s32 *)&speed); } } else { if (g_NbombAudioHandle && sndGetState(g_NbombAudioHandle) != AL_STOPPED) { @@ -705,7 +706,7 @@ void nbombCreateStorm(struct coord *pos, struct prop *ownerprop) if (g_Nbombs[index].audiohandle20) { union audioparam param; param.f32 = 0.4f; - audioPostEvent(g_Nbombs[index].audiohandle20, 16, param.s32); + audioPostEvent(g_Nbombs[index].audiohandle20, AL_SNDP_PITCH_EVT, param.s32); } } @@ -715,7 +716,7 @@ void nbombCreateStorm(struct coord *pos, struct prop *ownerprop) if (g_Nbombs[index].audiohandle24) { union audioparam param; param.f32 = 0.4f; - audioPostEvent(g_Nbombs[index].audiohandle24, 16, param.s32); + audioPostEvent(g_Nbombs[index].audiohandle24, AL_SNDP_PITCH_EVT, param.s32); } } #else @@ -727,7 +728,7 @@ void nbombCreateStorm(struct coord *pos, struct prop *ownerprop) if (g_Nbombs[index].audiohandle20) { union audioparam param; param.f32 = 0.4f; - audioPostEvent(g_Nbombs[index].audiohandle20, 16, param.s32); + audioPostEvent(g_Nbombs[index].audiohandle20, AL_SNDP_PITCH_EVT, param.s32); } sndStart(var80095200, SFX_LAUNCH_ROCKET, &g_Nbombs[index].audiohandle24, -1, -1, -1, -1, -1); @@ -735,7 +736,7 @@ void nbombCreateStorm(struct coord *pos, struct prop *ownerprop) if (g_Nbombs[index].audiohandle24) { union audioparam param; param.f32 = 0.4f; - audioPostEvent(g_Nbombs[index].audiohandle24, 16, param.s32); + audioPostEvent(g_Nbombs[index].audiohandle24, AL_SNDP_PITCH_EVT, param.s32); } #endif } diff --git a/src/game/player.c b/src/game/player.c index f93ffe7db..78726ad39 100644 --- a/src/game/player.c +++ b/src/game/player.c @@ -3221,7 +3221,7 @@ void playerTick(bool arg0) eyespy->deployed = false; eyespy->held = true; eyespy->active = false; - func0f0926bc(eyespy->prop, 1, 0xffff); + psStopSound(eyespy->prop, PSTYPE_GENERAL, 0xffff); chr->chrflags |= CHRCFLAG_HIDDEN; chr->chrflags |= CHRCFLAG_INVINCIBLE; g_Vars.currentplayer->devicesactive &= ~DEVICE_EYESPY; diff --git a/src/game/prop.c b/src/game/prop.c index 4f2f6b585..12360bc08 100644 --- a/src/game/prop.c +++ b/src/game/prop.c @@ -1,5 +1,6 @@ #include #include "constants.h" +#include "../lib/naudio/n_sndp.h" #include "game/bondmove.h" #include "game/bondwalk.h" #include "game/chraction.h" @@ -475,7 +476,7 @@ void weaponPlayWhooshSound(s32 weaponnum, struct prop *prop) handle = sndStart(var80095200, soundnum, NULL, -1, -1, -1, -1, -1); if (handle) { - audioPostEvent(handle, 0x10, *(s32 *)&speed); + audioPostEvent(handle, AL_SNDP_PITCH_EVT, *(s32 *)&speed); } osSetThreadPri(0, prevpri); @@ -483,12 +484,12 @@ void weaponPlayWhooshSound(s32 weaponnum, struct prop *prop) handle = sndStart(var80095200, soundnum, NULL, -1, -1, -1, -1, -1); if (handle) { - audioPostEvent(handle, 0x10, *(s32 *)&speed); + audioPostEvent(handle, AL_SNDP_PITCH_EVT, *(s32 *)&speed); } #endif } else { - propsnd0f0939f8(NULL, prop, soundnum, -1, - -1, 0, 0, 0, NULL, speed, NULL, -1, -1, -1, -1); + psCreate(NULL, prop, soundnum, -1, + -1, 0, 0, PSTYPE_NONE, NULL, speed, NULL, -1, -1, -1, -1); } } } @@ -538,7 +539,7 @@ void func0f060bac(s32 weaponnum, struct prop *prop) handle = sndStart(var80095200, soundnum, 0, -1, -1, -1, -1, -1); if (handle) { - audioPostEvent(handle, 0x10, *(s32 *)&speed); + audioPostEvent(handle, AL_SNDP_PITCH_EVT, *(s32 *)&speed); } osSetThreadPri(0, prevpri); @@ -546,11 +547,11 @@ void func0f060bac(s32 weaponnum, struct prop *prop) handle = sndStart(var80095200, soundnum, 0, -1, -1, -1, -1, -1); if (handle) { - audioPostEvent(handle, 0x10, *(s32 *)&speed); + audioPostEvent(handle, AL_SNDP_PITCH_EVT, *(s32 *)&speed); } #endif } else { - propsnd0f0939f8(NULL, prop, soundnum, -1, -1, 0, 0, 0, NULL, speed, NULL, -1, -1, -1, -1); + psCreate(NULL, prop, soundnum, -1, -1, 0, 0, PSTYPE_NONE, NULL, speed, NULL, -1, -1, -1, -1); } } } @@ -2201,7 +2202,7 @@ void propsTickPlayer(bool islastplayer) if (islastplayer) { alarmTick(); - propsndTick(); + psTick(); propsDefragRoomProps(); } @@ -2239,19 +2240,19 @@ void propsTickPadEffects(void) if ((random() % 2048) <= 50) { sparksCreate(rooms[0], NULL, &pad.pos, &up, &pad.up, SPARKTYPE_ENVIRONMENTAL1); - propsnd0f0939f8(NULL, NULL, propsndGetRandomSparkSound(), -1, -1, 0, 0, 0, &pad.pos, -1, rooms, -1, -1, -1, -1); + psCreate(NULL, NULL, psGetRandomSparkSound(), -1, -1, 0, 0, PSTYPE_NONE, &pad.pos, -1, rooms, -1, -1, -1, -1); } if ((random() % 2048) <= 15) { sparksCreate(rooms[0], NULL, &pad.pos, &up, &pad.up, SPARKTYPE_ENVIRONMENTAL1); sparksCreate(rooms[0], NULL, &pad.pos, &up, &pad.up, SPARKTYPE_ENVIRONMENTAL2); - propsnd0f0939f8(NULL, NULL, propsndGetRandomSparkSound(), -1, -1, 0, 0, 0, &pad.pos, -1, rooms, -1, -1, -1, -1); + psCreate(NULL, NULL, psGetRandomSparkSound(), -1, -1, 0, 0, PSTYPE_NONE, &pad.pos, -1, rooms, -1, -1, -1, -1); } if ((random() % 2048) <= 5) { sparksCreate(rooms[0], NULL, &pad.pos, &up, &pad.up, SPARKTYPE_ENVIRONMENTAL1); sparksCreate(rooms[0], NULL, &pad.pos, &up, &pad.up, SPARKTYPE_ENVIRONMENTAL3); - propsnd0f0939f8(NULL, NULL, propsndGetRandomSparkSound(), -1, -1, 0, 0, 0, &pad.pos, -1, rooms, -1, -1, -1, -1); + psCreate(NULL, NULL, psGetRandomSparkSound(), -1, -1, 0, 0, PSTYPE_NONE, &pad.pos, -1, rooms, -1, -1, -1, -1); } break; case PADEFFECT_OUTROSMOKE: diff --git a/src/game/propobj.c b/src/game/propobj.c index b3a6915ec..198b84644 100644 --- a/src/game/propobj.c +++ b/src/game/propobj.c @@ -2512,7 +2512,7 @@ void objFree(struct defaultobj *obj, bool freeprop, bool canregen) } } - func0f0926bc(obj->prop, 1, 0xffff); + psStopSound(obj->prop, PSTYPE_GENERAL, 0xffff); shieldhitsRemoveByProp(obj->prop); chrClearReferences(obj->prop - g_Vars.props); @@ -3282,7 +3282,7 @@ s32 func0f06cd00(struct defaultobj *obj, struct coord *pos, struct coord *arg2, struct coord spa4 = {0, 0, 0}; s0 = false; sparksCreate(prop->rooms[0], prop, &hitthing.unk00, &spa4, &hitthing.unk0c, SPARKTYPE_DEEPWATER); - propsnd0f0939f8(0, prop, SFX_HIT_WATER, -1, -1, 1024, 0, 0, 0, -1.0f, 0, -1, -1.0f, -1.0f, -1.0f); + psCreate(0, prop, SFX_HIT_WATER, -1, -1, PSFLAG_0400, 0, PSTYPE_NONE, 0, -1.0f, 0, -1, -1.0f, -1.0f, -1.0f); obj->hidden |= OBJHFLAG_DELETING; } } @@ -3882,16 +3882,16 @@ void knifePlayWooshSound(struct defaultobj *obj) s32 index = random() % ARRAYCOUNT(soundnums); if (obj->projectile->lastwooshframe < g_Vars.lvframe60 - TICKS(6)) { - func0f0926bc(obj->prop, 1, 0xffff); + psStopSound(obj->prop, PSTYPE_GENERAL, 0xffff); if (!lvIsPaused()) { - propsnd0f0939f8(0, obj->prop, soundnums[index], -1, -1, 0, 0, 0, 0, -1.0f, 0, -1, -1.0f, -1.0f, -1.0f); + psCreate(0, obj->prop, soundnums[index], -1, -1, 0, 0, PSTYPE_NONE, 0, -1.0f, 0, -1, -1.0f, -1.0f, -1.0f); obj->projectile->lastwooshframe = g_Vars.lvframe60; } } } else { obj->hidden &= ~OBJHFLAG_THROWNKNIFE; - func0f0926bc(obj->prop, 1, 0xffff); + psStopSound(obj->prop, PSTYPE_GENERAL, 0xffff); } } } @@ -5302,7 +5302,7 @@ void hovTick(struct defaultobj *obj, struct hov *hov) hov->flags &= ~1; if (obj->type == OBJTYPE_HOVERBIKE) { - propsnd0f0939f8(NULL, obj->prop, SFX_BIKE_PULSE, -1, -1, 0, 0, 0, 0, -1.0f, 0, -1, -1.0f, -1.0f, -1.0f); + psCreate(NULL, obj->prop, SFX_BIKE_PULSE, -1, -1, 0, 0, PSTYPE_NONE, 0, -1.0f, 0, -1, -1.0f, -1.0f, -1.0f); } } @@ -7396,14 +7396,14 @@ s32 projectileTick(struct defaultobj *obj, bool *embedded) if (cdresult == CDRESULT_COLLISION) { if (projectile->unk0a4 < g_Vars.lvframenum - 2) { if (weapon->weaponnum == WEAPON_COMBATKNIFE || weapon->weaponnum == WEAPON_COMBATKNIFE) { - propsnd0f0939f8(0, prop, SFX_808B, -1, -1, 0, 0, 0, 0, -1.0f, 0, -1, -1.0f, -1.0f, -1.0f); + psCreate(0, prop, SFX_808B, -1, -1, 0, 0, PSTYPE_NONE, 0, -1.0f, 0, -1, -1.0f, -1.0f, -1.0f); } else if (weapon->weaponnum == WEAPON_GRENADE && weapon->gunfunc == FUNC_SECONDARY) { u16 sp100[] = {SFX_0027, SFX_0028, SFX_0029, SFX_002A}; - propsnd0f0939f8(0, prop, sp100[random() % 4], -1, -1, 0, 0, 0, 0, -1.0f, 0, -1, -1.0f, -1.0f, -1.0f); - propsnd0f0939f8(0, prop, SFX_EYESPYHIT, -1, -1, 0, 0, 0, 0, -1.0f, 0, -1, -1.0f, -1.0f, -1.0f); + psCreate(0, prop, sp100[random() % 4], -1, -1, 0, 0, PSTYPE_NONE, 0, -1.0f, 0, -1, -1.0f, -1.0f, -1.0f); + psCreate(0, prop, SFX_EYESPYHIT, -1, -1, 0, 0, PSTYPE_NONE, 0, -1.0f, 0, -1, -1.0f, -1.0f, -1.0f); } else { - propsnd0f0939f8(0, prop, SFX_EYESPYHIT, -1, -1, 0, 0, 0, 0, -1.0f, 0, -1, -1.0f, -1.0f, -1.0f); + psCreate(0, prop, SFX_EYESPYHIT, -1, -1, 0, 0, PSTYPE_NONE, 0, -1.0f, 0, -1, -1.0f, -1.0f, -1.0f); } } @@ -7667,14 +7667,14 @@ void doorTick(struct prop *doorprop) if (door->frac > soundpoint) { if (prevfrac <= soundpoint) { // frac increased past the soundpoint - propsnd0f0939f8(NULL, doorprop, SFX_DOOR_8014, -1, - -1, 0, 0, 12, 0, -1, 0, -1, -1, -1, -1); + psCreate(NULL, doorprop, SFX_DOOR_8014, -1, + -1, 0, 0, PSTYPE_DOOR, 0, -1, 0, -1, -1, -1, -1); } } else { if (prevfrac > soundpoint) { // frac decreased past the soundpoint - propsnd0f0939f8(NULL, doorprop, SFX_DOOR_8015, -1, - -1, 0, 0, 12, 0, -1, 0, -1, -1, -1, -1); + psCreate(NULL, doorprop, SFX_DOOR_8015, -1, + -1, 0, 0, PSTYPE_DOOR, 0, -1, 0, -1, -1, -1, -1); } } } @@ -9345,7 +9345,7 @@ void autogunTickShoot(struct prop *autogunprop) if (autogun->allowsoundframe < g_Vars.lvframe60) { s32 soundgap = 2; - func0f0926bc(autogunprop, 1, 0xffff); + psStopSound(autogunprop, PSTYPE_GENERAL, 0xffff); if (!friendly) { s32 soundnum = SFX_806F; @@ -9359,7 +9359,7 @@ void autogunTickShoot(struct prop *autogunprop) soundgap = 4; } - propsnd0f0939f8(NULL, autogunprop, soundnum, -1, -1, 0, 0, 0, 0, -1.0f, 0, -1, -1.0f, -1.0f, -1.0f); + psCreate(NULL, autogunprop, soundnum, -1, -1, 0, 0, PSTYPE_NONE, 0, -1.0f, 0, -1, -1.0f, -1.0f, -1.0f); } autogun->allowsoundframe = soundgap + g_Vars.lvframe60; @@ -9906,9 +9906,9 @@ void chopperIncrementMovement(struct prop *prop, f32 goalroty, f32 goalrotx, str if (chopper->power > 0.45f && !firing && (chopper->base.flags2 & OBJFLAG2_INVISIBLE) == 0 && objIsHealthy(&chopper->base)) { soundnum = g_Vars.stagenum == STAGE_EXTRACTION ? SFX_810D : SFX_8110; - propsnd0f09294c(prop, soundnum, 6); + psCreateIfNotDupe(prop, soundnum, PSTYPE_CHOPPERHUM2); } else { - func0f0926bc(prop, 6, 0xffff); + psStopSound(prop, PSTYPE_CHOPPERHUM2, 0xffff); } chopper->roty = curroty; @@ -9943,9 +9943,9 @@ void chopperIncrementMovement(struct prop *prop, f32 goalroty, f32 goalrotx, str if ((chopper->base.flags2 & OBJFLAG2_INVISIBLE) == 0 && objIsHealthy(&chopper->base)) { soundnum = g_Vars.stagenum == STAGE_EXTRACTION ? SFX_SHIP_HUM : SFX_810F; - propsnd0f09294c(prop, soundnum, 5); + psCreateIfNotDupe(prop, soundnum, PSTYPE_CHOPPERHUM1); } else { - func0f0926bc(prop, 5, 0xffff); + psStopSound(prop, PSTYPE_CHOPPERHUM1, 0xffff); } } @@ -10026,7 +10026,7 @@ void chopperTickFall(struct prop *chopperprop) // The Extraction chopper falls without any collision checks and is // reaped once it reaches the lower barrier if (chopperprop->pos.y < -30000) { - func0f0926bc(chopperprop, 1, 0xffff); + psStopSound(chopperprop, PSTYPE_GENERAL, 0xffff); obj->hidden |= OBJHFLAG_DELETING; } else { chopperIncrementMovement(chopperprop, goalroty, chopper->rotx < 0 ? M_PI : -M_PI, &speed, false); @@ -10110,7 +10110,7 @@ void chopperTickFall(struct prop *chopperprop) sp74.y = 1; sp74.z = 0; - func0f0926bc(chopperprop, 1, 0xffff); + psStopSound(chopperprop, PSTYPE_GENERAL, 0xffff); explosionCreate(NULL, &chopperprop->pos, chopperprop->rooms, EXPLOSIONTYPE_ROCKET, 0, true, &newpos, room, &sp74); @@ -10421,7 +10421,7 @@ void hovercarTick(struct prop *prop) sp1e4.y = hovercar->base.realrot[1][1] * ymin + prop->pos.y; sp1e4.z = hovercar->base.realrot[1][2] * ymin + prop->pos.z; - func0f0926bc(prop, 1, 0xffff); + psStopSound(prop, PSTYPE_GENERAL, 0xffff); explosionCreate(NULL, &prop->pos, prop->rooms, EXPLOSIONTYPE_7, g_Vars.currentplayernum, true, &sp1e4, sp1d6, &sp1d8); hovercar->base.hidden |= OBJHFLAG_DELETING; return; @@ -10435,7 +10435,7 @@ void hovercarTick(struct prop *prop) if (hovercar->sparkstimer60 < 0) { hovercar->sparkstimer60 = TICKS(50); - propsnd0f0939f8(NULL, prop, SFX_SHIELD_DAMAGE, -1, -1, 1024, 0, 0, 0, -1, 0, -1, -1, -1, -1); + psCreate(NULL, prop, SFX_SHIELD_DAMAGE, -1, -1, PSFLAG_0400, 0, PSTYPE_NONE, 0, -1, 0, -1, -1, -1, -1); sparksCreate(prop->rooms[0], prop, &prop->pos, NULL, 0, SPARKTYPE_DEFAULT); } @@ -10919,8 +10919,8 @@ u32 objTick(struct prop *prop) if (!silent) { // Play respawn sound - propsnd0f0939f8(NULL, prop, SFX_REGEN, -1, - -1, 0, 0, 0, 0, -1, 0, -1, -1, -1, -1); + psCreate(NULL, prop, SFX_REGEN, -1, + -1, 0, 0, PSTYPE_NONE, 0, -1, 0, -1, -1, -1, -1); } } } @@ -11247,7 +11247,7 @@ s32 objTickPlayer(struct prop *prop) } } } else { - func0f0926bc(prop, 1, 0xffff); + psStopSound(prop, PSTYPE_GENERAL, 0xffff); } } else if (obj->type == OBJTYPE_HOVERPROP) { hoverpropTick(prop, sp592); @@ -13847,7 +13847,7 @@ void objDeform(struct defaultobj *obj, s32 level) s32 axis; s32 chance; - func0f0926bc(obj->prop, 15, 0xffff); + psStopSound(obj->prop, PSTYPE_COMMHUB, 0xffff); salt = 0; @@ -16795,8 +16795,8 @@ s32 propPlayPickupSound(struct prop *prop, s32 weapon) sound = SFX_PICKUP_GUN; } - return propsnd0f0939f8(NULL, prop, sound, -1, - -1, 1024, 0, 0, 0, -1, 0, -1, -1, -1, -1); + return psCreate(NULL, prop, sound, -1, + -1, PSFLAG_0400, 0, PSTYPE_NONE, 0, -1, 0, -1, -1, -1, -1); } void weaponPlayPickupSound(s32 weaponnum) @@ -19381,7 +19381,7 @@ void doorPlayOpeningSound(s32 soundtype, struct prop *prop) s32 sound2 = 0; s32 sound3 = 0; - func0f0926bc(prop, 12, 0xffff); + psStopSound(prop, PSTYPE_DOOR, 0xffff); if (g_Vars.in_cutscene && (prop->type == PROPTYPE_OBJ || prop->type == PROPTYPE_DOOR) @@ -19430,22 +19430,22 @@ void doorPlayOpeningSound(s32 soundtype, struct prop *prop) if (sound1) { #if VERSION >= VERSION_NTSC_1_0 - propsnd0f0939f8(NULL, prop, sound1, -1, - -1, 1024, 0, 12, 0, -1, 0, -1, -1, -1, -1); + psCreate(NULL, prop, sound1, -1, + -1, PSFLAG_0400, 0, PSTYPE_DOOR, 0, -1, 0, -1, -1, -1, -1); #else - propsnd0f0939f8(NULL, prop, sound1, -1, - -1, 0, 0, 12, 0, -1, 0, -1, -1, -1, -1); + psCreate(NULL, prop, sound1, -1, + -1, 0, 0, PSTYPE_DOOR, 0, -1, 0, -1, -1, -1, -1); #endif } if (sound2) { - propsnd0f0939f8(NULL, prop, sound2, -1, - -1, 0, 0, 12, 0, -1, 0, -1, -1, -1, -1); + psCreate(NULL, prop, sound2, -1, + -1, 0, 0, PSTYPE_DOOR, 0, -1, 0, -1, -1, -1, -1); } if (sound3) { - propsnd0f0939f8(NULL, prop, sound3, -1, - -1, 0, 0, 12, 0, -1, 0, -1, -1, -1, -1); + psCreate(NULL, prop, sound3, -1, + -1, 0, 0, PSTYPE_DOOR, 0, -1, 0, -1, -1, -1, -1); } } @@ -19458,7 +19458,7 @@ void doorPlayClosingSound(s32 soundtype, struct prop *prop) s32 sound2 = 0; s32 sound3 = 0; - func0f0926bc(prop, 12, 0xffff); + psStopSound(prop, PSTYPE_DOOR, 0xffff); if (g_Vars.in_cutscene && (prop->type == PROPTYPE_OBJ || prop->type == PROPTYPE_DOOR) @@ -19494,22 +19494,22 @@ void doorPlayClosingSound(s32 soundtype, struct prop *prop) if (sound1) { #if VERSION >= VERSION_NTSC_1_0 - propsnd0f0939f8(NULL, prop, sound1, -1, - -1, 1024, 0, 12, 0, -1, 0, -1, -1, -1, -1); + psCreate(NULL, prop, sound1, -1, + -1, PSFLAG_0400, 0, PSTYPE_DOOR, 0, -1, 0, -1, -1, -1, -1); #else - propsnd0f0939f8(NULL, prop, sound1, -1, - -1, 0, 0, 12, 0, -1, 0, -1, -1, -1, -1); + psCreate(NULL, prop, sound1, -1, + -1, 0, 0, PSTYPE_DOOR, 0, -1, 0, -1, -1, -1, -1); #endif } if (sound2) { - propsnd0f0939f8(NULL, prop, sound2, -1, - -1, 0, 0, 12, 0, -1, 0, -1, -1, -1, -1); + psCreate(NULL, prop, sound2, -1, + -1, 0, 0, PSTYPE_DOOR, 0, -1, 0, -1, -1, -1, -1); } if (sound3) { - propsnd0f0939f8(NULL, prop, sound3, -1, - -1, 0, 0, 12, 0, -1, 0, -1, -1, -1, -1); + psCreate(NULL, prop, sound3, -1, + -1, 0, 0, PSTYPE_DOOR, 0, -1, 0, -1, -1, -1, -1); } } @@ -19517,7 +19517,7 @@ void doorPlayOpenedSound(s32 soundtype, struct prop *prop) { s32 sound = 0; - func0f0926bc(prop, 12, 0xffff); + psStopSound(prop, PSTYPE_DOOR, 0xffff); if (g_Vars.in_cutscene && (prop->type == PROPTYPE_OBJ || prop->type == PROPTYPE_DOOR) @@ -19557,11 +19557,11 @@ void doorPlayOpenedSound(s32 soundtype, struct prop *prop) if (sound) { #if VERSION >= VERSION_NTSC_1_0 - propsnd0f0939f8(NULL, prop, sound, -1, - -1, 1024, 0, 12, 0, -1, 0, -1, -1, -1, -1); + psCreate(NULL, prop, sound, -1, + -1, PSFLAG_0400, 0, PSTYPE_DOOR, 0, -1, 0, -1, -1, -1, -1); #else - propsnd0f0939f8(NULL, prop, sound, -1, - -1, 0, 0, 12, 0, -1, 0, -1, -1, -1, -1); + psCreate(NULL, prop, sound, -1, + -1, 0, 0, PSTYPE_DOOR, 0, -1, 0, -1, -1, -1, -1); #endif } } @@ -19570,7 +19570,7 @@ void doorPlayClosedSound(s32 soundtype, struct prop *prop) { s32 sound = 0; - func0f0926bc(prop, 12, 0xffff); + psStopSound(prop, PSTYPE_DOOR, 0xffff); if (g_Vars.in_cutscene && (prop->type == PROPTYPE_OBJ || prop->type == PROPTYPE_DOOR) @@ -19607,11 +19607,11 @@ void doorPlayClosedSound(s32 soundtype, struct prop *prop) if (sound) { #if VERSION >= VERSION_NTSC_1_0 - propsnd0f0939f8(NULL, prop, sound, -1, - -1, 1024, 0, 12, 0, -1, 0, -1, -1, -1, -1); + psCreate(NULL, prop, sound, -1, + -1, PSFLAG_0400, 0, PSTYPE_DOOR, 0, -1, 0, -1, -1, -1, -1); #else - propsnd0f0939f8(NULL, prop, sound, -1, - -1, 0, 0, 12, 0, -1, 0, -1, -1, -1, -1); + psCreate(NULL, prop, sound, -1, + -1, 0, 0, PSTYPE_DOOR, 0, -1, 0, -1, -1, -1, -1); #endif } } @@ -20001,11 +20001,11 @@ void doorCreateSparks(struct doorobj *door) sparksCreate(door->base.prop->rooms[0], door->base.prop, &sp88, &sp70, &pad.up, SPARKTYPE_ENVIRONMENTAL5); } - propsnd0f0939f8(NULL, door->base.prop, propsndGetRandomSparkSound(), -1, - -1, 0, 0, 0, &sp88, -1, door->base.prop->rooms, -1, -1, -1, -1); + psCreate(NULL, door->base.prop, psGetRandomSparkSound(), -1, + -1, 0, 0, PSTYPE_NONE, &sp88, -1, door->base.prop->rooms, -1, -1, -1, -1); - propsnd0f0939f8(NULL, door->base.prop, propsndGetRandomSparkSound(), -1, - -1, 0, 0, 0, &sp7c, -1, door->base.prop->rooms, -1, -1, -1, -1); + psCreate(NULL, door->base.prop, psGetRandomSparkSound(), -1, + -1, 0, 0, PSTYPE_NONE, &sp7c, -1, door->base.prop->rooms, -1, -1, -1, -1); for (i = 0; door->base.prop->rooms[i] != -1; i++) { roomFlashLighting(door->base.prop->rooms[i], 128, 200); @@ -20056,7 +20056,7 @@ bool doorCalcIntendedFrac(struct doorobj *door) if (random() % 2) { dothething = true; - func0f0926bc(door->base.prop, 12, 0xffff); + psStopSound(door->base.prop, PSTYPE_DOOR, 0xffff); door->mode = DOORMODE_IDLE; door->lastopen60 = g_Vars.lvframe60; } @@ -20069,7 +20069,7 @@ bool doorCalcIntendedFrac(struct doorobj *door) doorCreateSparks(loopdoor); if (dothething) { - func0f0926bc(loopdoor->base.prop, 12, 0xffff); + psStopSound(loopdoor->base.prop, PSTYPE_DOOR, 0xffff); loopdoor->mode = DOORMODE_IDLE; loopdoor->lastopen60 = g_Vars.lvframe60; } @@ -20800,7 +20800,7 @@ void gasTick(void) } if (g_GasAudioHandle) { - func0f09505c(g_GasAudioHandle, &g_GasPos, 400, 2500, 3000, g_Vars.currentplayer->prop->rooms, soundnum, 0x7fff, 0); + psApplyVolPan(g_GasAudioHandle, &g_GasPos, 400, 2500, 3000, g_Vars.currentplayer->prop->rooms, soundnum, AL_VOL_FULL, 0); } } else if (g_GasAudioHandle && sndGetState(g_GasAudioHandle)) { audioStop(g_GasAudioHandle); @@ -20974,7 +20974,7 @@ void alarmTick(void) g_AlarmSpeakerDirection *= -1; } - sndAdjust(&g_AlarmAudioHandle, 0, 0x7fff, g_AlarmSpeakerWeight, -1, -1, 0, -1, 1); + sndAdjust(&g_AlarmAudioHandle, 0, AL_VOL_FULL, g_AlarmSpeakerWeight, -1, -1, 0, -1, true); } else { // The alarm finished, or this is the first one. // Start the sound again. @@ -21145,23 +21145,23 @@ void projectileCreate(struct prop *fromprop, struct fireslotthing *arg1, struct if (arg1 && arg1->unk08 < g_Vars.lvframe60) { switch (weaponnum) { case WEAPON_CHOPPERGUN: - func0f0926bc(fromprop, 7, 0xffff); - propsnd0f0939f8(0, fromprop, SFX_810E, -1, -1, 0, 0, 7, 0, -1.0f, 0, -1, -1.0f, -1.0f, -1.0f); + psStopSound(fromprop, PSTYPE_CHOPPERGUN, 0xffff); + psCreate(0, fromprop, SFX_810E, -1, -1, 0, 0, PSTYPE_CHOPPERGUN, 0, -1.0f, 0, -1, -1.0f, -1.0f, -1.0f); arg1->unk08 = g_Vars.lvframe60 + 4; break; case WEAPON_RCP45: - func0f0926bc(fromprop, 1, 0xffff); - propsnd0f0939f8(0, fromprop, SFX_805A, -1, -1, 0, 0, 0, 0, -1.0f, 0, -1, -1.0f, -1.0f, -1.0f); + psStopSound(fromprop, PSTYPE_GENERAL, 0xffff); + psCreate(0, fromprop, SFX_805A, -1, -1, 0, 0, PSTYPE_NONE, 0, -1.0f, 0, -1, -1.0f, -1.0f, -1.0f); arg1->unk08 = g_Vars.lvframe60 + 2; break; case WEAPON_WATCHLASER: - func0f0926bc(fromprop, 1, 0xffff); - propsnd0f0939f8(0, fromprop, SFX_8043, -1, -1, 0, 0, 0, 0, -1.0f, 0, -1, -1.0f, -1.0f, -1.0f); + psStopSound(fromprop, PSTYPE_GENERAL, 0xffff); + psCreate(0, fromprop, SFX_8043, -1, -1, 0, 0, PSTYPE_NONE, 0, -1.0f, 0, -1, -1.0f, -1.0f, -1.0f); arg1->unk08 = g_Vars.lvframe60 + 8; break; default: - func0f0926bc(fromprop, 1, 0xffff); - propsnd0f0939f8(0, fromprop, SFX_8045, -1, -1, 0, 0, 0, 0, -1.0f, 0, -1, -1.0f, -1.0f, -1.0f); + psStopSound(fromprop, PSTYPE_GENERAL, 0xffff); + psCreate(0, fromprop, SFX_8045, -1, -1, 0, 0, PSTYPE_NONE, 0, -1.0f, 0, -1, -1.0f, -1.0f, -1.0f); arg1->unk08 = g_Vars.lvframe60 + 2; break; } @@ -21215,7 +21215,7 @@ void projectileCreate(struct prop *fromprop, struct fireslotthing *arg1, struct rocket->base.projectile->unk014 = sp120.y; rocket->base.projectile->unk018 = sp120.z; - propsnd0f0939f8(NULL, rocket->base.prop, SFX_LAUNCH_ROCKET_8053, -1, -1, 0, 0, 0, 0, -1.0f, 0, -1, -1.0f, -1.0f, -1.0f); + psCreate(NULL, rocket->base.prop, SFX_LAUNCH_ROCKET_8053, -1, -1, 0, 0, PSTYPE_NONE, 0, -1.0f, 0, -1, -1.0f, -1.0f, -1.0f); } } } diff --git a/src/game/propsnd.c b/src/game/propsnd.c index b89822a02..9e4b07fde 100644 --- a/src/game/propsnd.c +++ b/src/game/propsnd.c @@ -17,52 +17,10 @@ #include "data.h" #include "types.h" -#if VERSION < VERSION_NTSC_1_0 -const char var7f1a5720nb[] = "SND : Stop -> Prop=%x, Id=%d\n"; -#endif - -const char var7f1ab400[] = "Propsnd : USING TIME 60\n"; -const char var7f1ab41c[] = "PS_AUTO : Un-Pausing %d\n"; - -#if VERSION < VERSION_NTSC_1_0 -const char var7f1a5778nb[] = "PS_AUTO : Pausing %d\n"; -const char var7f1a5790nb[] = "SND : Propsound needs play : Id %d is flaged g\n"; -const char var7f1a57c0nb[] = "AISND : Channel %d - %s"; -const char var7f1a57d8nb[] = "FREE"; -const char var7f1a57e0nb[] = "IN USE"; -#endif - -const char var7f1ab438[] = "Propsnd : Using %d of %d (Peek = %d of %d)"; +struct pschannel *g_PsChannels = NULL; #if VERSION >= VERSION_NTSC_1_0 -const char var7f1ab464[] = "AISOUND: aisoundnewtypeflags - Channel %d -> Playing sound number id=%d(%x)\n"; -const char var7f1ab4b4[] = "AISOUND: PSTYPE_MARKER - Channel %d -> Playing sound number id=%d(%x)\n"; -const char var7f1ab4fc[] = "AISOUND: PSTYPE_MARKER - Channel %d -> Playing sound number id=%d(%x)\n"; -#else -const char var7f1a5814nb[] = "SND : Start -> Prop=%x, Id=%d, Vol=%d, Flags=%d, Type=%d\n"; -const char var7f1a5850nb[] = "AISOUND: Channel %d -> Playing sound number id=%d(%x))\n"; -#endif - -const char var7f1ab544[] = "AISOUND: CUTSCENE -> Playing sound number id=%d(%x))\n"; - -#if VERSION >= VERSION_NTSC_1_0 -const char var7f1ab57c[] = "AISOUND: Channel %d -> Playing sound number id=%d(%x), Prop=%x, Flags=%x, Type=%d, Zero=%d\n"; -const char var7f1ab5d8[] = "AISOUND: Channel %d -> Playing sound number id=%d(%x), Prop=%x, Flags=%x, Type=%d\n"; -#else -const char var7f1ab58c0nb[] = "AISOUND: DONTCARE -> Playing sound number id=%d(%x))\n"; -const char var7f1ab58f8nb[] = "AISOUND: Channel %d -> Playing sound number id=%d(%x), Prop=%x\n"; -const char var7f1ab5938nb[] = "SERIOUS: Existing ai sound number %d (Sound id=%d(%x)) : KILLING\n"; -#endif - -const char var7f1ab62c[] = "AISOUND: CUTSCENE -> Stopping all cutscene sounds\n"; -const char var7f1ab660[] = "AISOUND: Stop sound channel %d\n"; -const char var7f1ab680[] = "AISOUND: Channel %d -> Setting params : Vol=%d, Pad=%d, Prop=%x, Time=%d, Far=%d, Silence=%d, Flags=%u\n"; -const char var7f1ab6e8[] = "AISOUND : This channel has a marker -> Shall start and use ID = %d(%x)\n"; - -struct audiochannel *g_AudioChannels = NULL; - -#if VERSION >= VERSION_NTSC_1_0 -u32 g_AudioPrevUuid = 0x00000000; +u32 g_AudioPrevUuid = 0; #endif s8 var8006ae18 = 0; @@ -70,27 +28,31 @@ s8 var8006ae1c = 0; s8 var8006ae20 = 0; s8 var8006ae24 = 0; s8 var8006ae28 = 0; -u32 var8006ae2c = 0x00000000; -u32 var8006ae30 = 0x00000000; -u32 var8006ae34 = 0x00000000; -u32 var8006ae38 = 0x00000000; -bool g_PropsndPrintChannels = false; +u32 var8006ae2c = 0; +u32 var8006ae30 = 0; +u32 var8006ae34 = 0; +u32 var8006ae38 = 0; +bool g_PsPrintAll = false; -u32 var8006ae40 = 0x00000000; -bool var8006ae44 = false; -u32 var8006ae48 = 0x00000001; -u32 var8006ae4c = 0x00000000; +u32 var8006ae40 = 0; +bool g_PsPrintFlagged = false; +u32 var8006ae48 = 1; +u32 var8006ae4c = 0; s16 var8006ae50 = -1; -u32 var8006ae54 = 0x000003e7; +u32 var8006ae54 = 999; -bool func0f092610(struct prop *prop, s32 arg1) +#define CHANNELCOUNT() (IS4MB() ? 30 : 40) +#define CHANNEL_IS_AI(channel) (channel >= 0 && channel <= 7) +#define CHANNEL_HEAP_FIRST CHANNEL_8 + +bool psPropHasSoundWithContext(struct prop *prop, s32 type) { s32 i; - for (i = 0; i < (IS4MB() ? 30 : 40); i++) { - if ((g_AudioChannels[i].flags & AUDIOCHANNELFLAG_IDLE) == 0 - && prop == g_AudioChannels[i].prop - && (arg1 == g_AudioChannels[i].unk28 || arg1 == 1)) { + for (i = 0; i < CHANNELCOUNT(); i++) { + if ((g_PsChannels[i].flags & PSFLAG_FREE) == 0 + && g_PsChannels[i].prop == prop + && (g_PsChannels[i].type == type || type == PSTYPE_GENERAL)) { return true; } } @@ -98,53 +60,54 @@ bool func0f092610(struct prop *prop, s32 arg1) return false; } -void func0f0926bc(struct prop *prop, s32 arg1, u16 arg2) +void psStopSound(struct prop *prop, s32 type, u16 flags) { s32 i; - for (i = 0; i < (IS4MB() ? 30 : 40); i++) { - struct audiochannel *channel = &g_AudioChannels[i]; + for (i = 0; i < CHANNELCOUNT(); i++) { + struct pschannel *channel = &g_PsChannels[i]; - if ((channel->flags & AUDIOCHANNELFLAG_IDLE) == 0 && channel->prop == prop) { - if (!channel->flags || !arg2 || (arg2 & channel->flags)) { - if (channel->unk28 == arg1 || arg1 == 1) { - func0f092a98(i); + if ((channel->flags & PSFLAG_FREE) == 0 && channel->prop == prop) { + if (!channel->flags || !flags || (flags & channel->flags)) { + if (channel->type == type || type == PSTYPE_GENERAL) { + psStopChannel(i); } } } } } -s32 func0f0927d4(f32 arg0, f32 arg1, f32 arg2, f32 arg3, s32 arg4) +s32 psCalculateVolumeFromDistance(f32 playerdist, f32 dist1, f32 dist2, f32 dist3, s32 fullvolume) { s32 result = 0; - if (arg0 < arg3) { - if (arg1 > 5501) { - arg1 = 5501; + if (playerdist < dist3) { + if (dist1 > 5501) { + dist1 = 5501; } - if (arg2 > 5801) { - arg2 = 5801; + if (dist2 > 5801) { + dist2 = 5801; } - if (arg3 > 6000) { - arg3 = 6000; + if (dist3 > 6000) { + dist3 = 6000; } - if (arg1 > arg0) { - result = arg4; + if (playerdist < dist1) { + // Within dist1 -> vol full + result = fullvolume; + } else if (playerdist < dist2) { + // Range dist1 to dist2 -> scale down using curve + result = fullvolume - (s32) (sqrtf((playerdist - dist1) / (dist2 - dist1)) * (fullvolume - 1000.0f)); } else { - if (arg2 > arg0) { - result = arg4 - (s32)(sqrtf((arg0 - arg1) / (arg2 - arg1)) * (arg4 - 1000.0f)); - } else { - result = (((arg3 - arg0) * 1000.0f) / (arg3 - arg2)); - } + // Range dist2 to dist3 -> scale to zero linearly + result = (dist3 - playerdist) * 1000.0f / (dist3 - dist2); } } - if (result > 0x7fff) { - result = 0x7fff; + if (result > AL_VOL_FULL) { + result = AL_VOL_FULL; } #if VERSION >= VERSION_NTSC_1_0 @@ -156,57 +119,68 @@ s32 func0f0927d4(f32 arg0, f32 arg1, f32 arg2, f32 arg3, s32 arg4) return result; } -s32 channelGetUnk06(s32 channelnum) +s32 psGetVolume(s32 channelnum) { - return (channelnum >= 0 && channelnum <= 7) ? g_AudioChannels[channelnum].unk06 : 0; + return CHANNEL_IS_AI(channelnum) ? g_PsChannels[channelnum].currentvol : 0; } -void propsnd0f09294c(struct prop *prop, s16 soundnum, s32 arg2) +/** + * Play the given soundnum for the prop, provided the prop doesn't already have + * a sound playing with this type. + */ +void psCreateIfNotDupe(struct prop *prop, s16 soundnum, s32 type) { s32 i; - if (propsnd0f0946b0(&prop->pos, 400, 2500, 3000, prop->rooms, soundnum, 0x7fff, 0)) { - // Return if this prop is already playing a sound - for (i = 8; i < (IS4MB() ? 30 : 40); i++) { - if ((g_AudioChannels[i].flags & AUDIOCHANNELFLAG_IDLE) == 0 - && g_AudioChannels[i].prop == prop - && g_AudioChannels[i].unk28 == arg2) { + if (psCalculateVol(&prop->pos, 400, 2500, 3000, prop->rooms, soundnum, AL_VOL_FULL, 0) != 0) { + for (i = CHANNEL_HEAP_FIRST; i < CHANNELCOUNT(); i++) { + if ((g_PsChannels[i].flags & PSFLAG_FREE) == 0 + && g_PsChannels[i].prop == prop + && g_PsChannels[i].type == type) { return; } } - propsnd0f0939f8(NULL, prop, soundnum, -1, -1, 2, 0, arg2, 0, -1.0f, 0, -1, -1.0f, -1.0f, -1.0f); + psCreate(NULL, prop, soundnum, -1, -1, PSFLAG_REPEATING, 0, type, 0, -1.0f, 0, -1, -1.0f, -1.0f, -1.0f); } } -void func0f092a98(s32 channelnum) +/** + * Stop the sound that's playing in the given channel. + * The channel remains allocated and configured. + */ +void psStopChannel(s32 channelnum) { - struct audiochannel *channel = &g_AudioChannels[channelnum]; + struct pschannel *channel = &g_PsChannels[channelnum]; -#if VERSION >= VERSION_NTSC_1_0 - channel->flags2 |= 0x80; +#if VERSION < VERSION_NTSC_1_0 + osSyncPrintf("SND : Stop -> Prop=%x, Id=%d\n", channel->prop, channelnum); #endif - if (channel->flags & AUDIOCHANNELFLAG_FORHUDMSG) { +#if VERSION >= VERSION_NTSC_1_0 + channel->flags2 |= PSFLAG2_STOPPED; +#endif + + if (channel->flags & PSFLAG_FORHUDMSG) { hudmsgsHideByChannel(channelnum); } - if (channel->flags & AUDIOCHANNELFLAG_FORPROP) { + if (channel->flags & PSFLAG_FORPROP) { propDecrementSoundCount(channel->prop); } - if ((channel->flags & AUDIOCHANNELFLAG_ISMP3)) { - snd0000fbc4(channel->soundnum26); + if (channel->flags & PSFLAG_ISMP3) { + sndStopMp3(channel->soundnum26); } else if (channel->audiohandle && sndGetState(channel->audiohandle) != AL_STOPPED) { audioStop(channel->audiohandle); } #if VERSION < VERSION_NTSC_1_0 - channel->flags = AUDIOCHANNELFLAG_IDLE; + channel->flags = PSFLAG_FREE; #endif } -void propsndPrintChannel(struct audiochannel *channel) +void psPrintChannel(struct pschannel *channel) { s32 i; @@ -215,17 +189,17 @@ void propsndPrintChannel(struct audiochannel *channel) } } -s32 propsndGetSubtitleOpacity(s32 channelnum) +s32 psGetSubtitleOpacity(s32 channelnum) { if (channelnum == -1) { return 1; } - if ((g_AudioChannels[channelnum].flags & AUDIOCHANNELFLAG_IDLE) == 0) { - s32 value = g_AudioChannels[channelnum].unk06; + if ((g_PsChannels[channelnum].flags & PSFLAG_FREE) == 0) { + s32 value = g_PsChannels[channelnum].currentvol; if (value == -1 || value > 200) { - s32 tmp = g_AudioChannels[channelnum].unk06 - 200; + s32 tmp = g_PsChannels[channelnum].currentvol - 200; s32 opacity = tmp * 255 / 15800; if (opacity > 255) { @@ -239,30 +213,30 @@ s32 propsndGetSubtitleOpacity(s32 channelnum) return 0; } -void propsndTickChannel(s32 channelnum) +void psTickChannel(s32 channelnum) { - struct audiochannel *channel = &g_AudioChannels[channelnum]; + struct pschannel *channel = &g_PsChannels[channelnum]; #if VERSION >= VERSION_NTSC_1_0 - if ((channel->flags2 & AUDIOCHANNELFLAG2_0080) == 0 - && channel->unk28 != 11 + if ((channel->flags2 & PSFLAG2_STOPPED) == 0 + && channel->type != PSTYPE_MARKER && ((channel->audiohandle != NULL && sndGetState(channel->audiohandle) != AL_STOPPED) - || (channel->flags & AUDIOCHANNELFLAG_0002) - || (channel->flags & AUDIOCHANNELFLAG_1000) - || ((channel->flags & AUDIOCHANNELFLAG_ISMP3) && sndIsPlayingMp3()))) + || (channel->flags & PSFLAG_REPEATING) + || (channel->flags & PSFLAG_FIRSTTICK) + || ((channel->flags & PSFLAG_ISMP3) && sndIsPlayingMp3()))) #else if ((channel->audiohandle != NULL && sndGetState(channel->audiohandle) != AL_STOPPED) - || (channel->flags & AUDIOCHANNELFLAG_0002) - || (channel->flags & AUDIOCHANNELFLAG_1000) - || ((channel->flags & AUDIOCHANNELFLAG_ISMP3) && sndIsPlayingMp3())) + || (channel->flags & PSFLAG_REPEATING) + || (channel->flags & PSFLAG_FIRSTTICK) + || ((channel->flags & PSFLAG_ISMP3) && sndIsPlayingMp3())) #endif { struct coord *pos = NULL; s16 *rooms = NULL; - s32 sp48; - s32 sp44; - s32 sp40; - f32 sp3c; + s32 newvol; + s32 newpan; + s32 newfx; + f32 newpitch; if (channel->prop) { pos = &channel->prop->pos; @@ -277,11 +251,11 @@ void propsndTickChannel(s32 channelnum) if (1); - if (g_Vars.langfilteron && (channel->flags2 & AUDIOCHANNELFLAG2_OFFENSIVE)) { - channel->unk04 = 0; - } else if (channel->flags2 & AUDIOCHANNELFLAG2_0010) { - if (channel->flags & AUDIOCHANNELFLAG_1000) { - channel->unk04 = channel->unk10; + if (g_Vars.langfilteron && (channel->flags2 & PSFLAG2_OFFENSIVE)) { + channel->targetvol = 0; + } else if (channel->flags2 & PSFLAG2_0010) { + if (channel->flags & PSFLAG_FIRSTTICK) { + channel->targetvol = channel->vol10; } else { return; } @@ -289,62 +263,64 @@ void propsndTickChannel(s32 channelnum) if (pos && rooms) { s16 *tmprooms; - if (channel->flags & AUDIOCHANNELFLAG_8000) { + if (channel->flags & PSFLAG_IGNOREROOMS) { tmprooms = NULL; } else { tmprooms = rooms; } - var8006ae50 = channel->unk2c; + var8006ae50 = channel->soundnum2c; - channel->unk04 = propsnd0f0946b0(pos, channel->unk34, channel->unk38, channel->unk3c, - tmprooms, channel->soundnum26, channel->unk10, &channel->unk4c); + channel->targetvol = psCalculateVol(pos, channel->dist1, channel->dist2, channel->dist3, + tmprooms, channel->soundnum26, channel->vol10, &channel->distance); } - if ((channel->flags & AUDIOCHANNELFLAG_0020) == 0) { - channel->unk0a = propsnd0f094d78(pos, channel->unk34, channel->unk38, channel->unk3c, - channel->unk4c, channel->flags & AUDIOCHANNELFLAG_0800, channel); + if ((channel->flags & PSFLAG_HASCONFIGPAN) == 0) { + channel->targetpan = psCalculatePan(pos, channel->dist1, channel->dist2, channel->dist3, + channel->distance, channel->flags & PSFLAG_0800, channel); } } if (rooms != NULL && rooms[0] != -1) { - channel->unk0c = 0; - channel->unk1a = 1; + channel->targetfx = 0; + channel->fxbus = 1; } else { - channel->unk0c = 0; - channel->unk1a = 1; + channel->targetfx = 0; + channel->fxbus = 1; } - if (channel->audiohandle != NULL && channel->unk44 > 0.0f) { - if (channel->unk48 < 0.0f) { - sp3c = channel->unk44; - } else if (channel->unk20 > 0.0f) { - sp3c = channel->unk48 + (channel->unk44 - channel->unk48) * g_Vars.lvupdate240 / channel->unk20; + if (channel->audiohandle != NULL && channel->targetpitch > 0.0f) { + if (channel->currentpitch < 0.0f) { + newpitch = channel->targetpitch; + } else if (channel->pitchchangespeed > 0.0f) { + newpitch = channel->currentpitch + (channel->targetpitch - channel->currentpitch) * g_Vars.lvupdate240 / channel->pitchchangespeed; } else { - sp3c = channel->unk44; + newpitch = channel->targetpitch; } } else { - sp3c = -1.0f; + newpitch = -1.0f; } - sp44 = channel->unk0a; - sp48 = channel->unk06; - sp40 = channel->unk0c; + newpan = channel->targetpan; + newvol = channel->currentvol; + newfx = channel->targetfx; - if (channel->unk06 == -1) { - sp48 = channel->unk04; - } else if (channel->unk1c >= 0) { - if (channel->unk1c > g_Vars.lvupdate60) { - sp48 = channel->unk06 + (channel->unk04 - channel->unk06) * g_Vars.lvupdate60 / channel->unk1c; + if (channel->currentvol == -1) { + newvol = channel->targetvol; + } else if (channel->volchangetimer60 >= 0) { + osSyncPrintf("Propsnd : USING TIME 60\n"); + + if (channel->volchangetimer60 > g_Vars.lvupdate60) { + newvol = channel->currentvol + (channel->targetvol - channel->currentvol) * g_Vars.lvupdate60 / channel->volchangetimer60; } - channel->unk1c -= g_Vars.lvupdate60; - } else if (channel->unk18 && channel->unk06 != channel->unk04) { - f32 f12 = channel->unk04 - channel->unk06; + channel->volchangetimer60 -= g_Vars.lvupdate60; + } else if (channel->volchangespeed && channel->currentvol != channel->targetvol) { + f32 f12 = channel->targetvol - channel->currentvol; #if VERSION >= VERSION_PAL_BETA - f32 f14 = (1.0f / 6000.0f) * g_Vars.lvupdate60freal * channel->unk18; + f32 f14 = (1.0f / 6000.0f) * g_Vars.lvupdate60freal * channel->volchangespeed; #else - f32 f14 = (1.0f / 6000.0f) * g_Vars.lvupdate60 * channel->unk18; + f32 f14 = (1.0f / 6000.0f) * g_Vars.lvupdate60 * channel->volchangespeed; #endif if (ABS(f12) > 1.0f) { @@ -353,276 +329,303 @@ void propsndTickChannel(s32 channelnum) } if (ABS(f14 * f12) > 1.0f) { - sp48 = channel->unk06 + (s32) (f14 * f12); + newvol = channel->currentvol + (s32) (f14 * f12); } } } else { - sp48 = channel->unk04; + newvol = channel->targetvol; } if (lvIsPaused() - || (mpIsPaused() && (channel->flags2 & AUDIOCHANNELFLAG2_0002)) + || (mpIsPaused() && (channel->flags2 & PSFLAG2_MPPAUSABLE)) || (mpIsPaused() && PLAYERCOUNT() == 1)) { - channel->unk06 = -1; - sp48 = 0; + channel->currentvol = -1; + newvol = 0; } - if (sp48 != channel->unk06) { - channel->unk06 = sp48; + if (newvol != channel->currentvol) { + channel->currentvol = newvol; } else { - sp48 = -1; + newvol = -1; } #if VERSION >= VERSION_NTSC_1_0 - if (channel->unk0a != channel->unk08) { - if (channel->flags & AUDIOCHANNELFLAG_1000) { - channel->unk08 = channel->unk0a; - sp44 = channel->unk08; + if (channel->targetpan != channel->currentpan) { + if (channel->flags & PSFLAG_FIRSTTICK) { + channel->currentpan = channel->targetpan; + newpan = channel->currentpan; } else { - s32 diff = channel->unk0a - channel->unk08; + s32 diff = channel->targetpan - channel->currentpan; s32 lvupdate = g_Vars.lvupdate240 * 512 / 240; s32 dir = diff < 0 ? -1 : 1; s32 absdiff = ABS(diff); s32 amount = absdiff < lvupdate ? absdiff : lvupdate; - channel->unk08 += amount * dir; - sp44 = channel->unk08; + channel->currentpan += amount * dir; + newpan = channel->currentpan; } - channel->flags |= AUDIOCHANNELFLAG_4000; + channel->flags |= PSFLAG_CHANGINGPAN; } else { - sp44 = -1; + newpan = -1; } #else - if (sp44 != channel->unk08) { - channel->flags |= AUDIOCHANNELFLAG_4000; - channel->unk08 = sp44; + if (newpan != channel->currentpan) { + channel->flags |= PSFLAG_CHANGINGPAN; + channel->currentpan = newpan; } else { - sp44 = -1; + newpan = -1; } #endif - if (sp40 != channel->unk0e) { - channel->unk0e = sp40; + if (newfx != channel->currentfx) { + channel->currentfx = newfx; } else { - sp40 = -1; + newfx = -1; } - if (sp3c > 0.0f && ABS(sp3c - channel->unk48) > 0.01f) { - channel->unk48 = sp3c; + if (newpitch > 0.0f && ABS(newpitch - channel->currentpitch) > 0.01f) { + channel->currentpitch = newpitch; } else { - sp3c = -1.0f; + newpitch = -1.0f; } - if (channel->flags & AUDIOCHANNELFLAG_0002) { - if (channel->unk06 > 0) { - if (channel->flags & AUDIOCHANNELFLAG_2000) { - channel->flags &= ~AUDIOCHANNELFLAG_2000; - channel->flags |= AUDIOCHANNELFLAG_1000; + /** + * Channels which repeat (such as terminal hums) are stopped + * when out of range and resumed when range is re-entered. + */ + if (channel->flags & PSFLAG_REPEATING) { + if (channel->currentvol > 0) { + if (channel->flags & PSFLAG_OUTOFRANGE) { + osSyncPrintf("PS_AUTO : Un-Pausing %d\n", channelnum); + + channel->flags &= ~PSFLAG_OUTOFRANGE; + channel->flags |= PSFLAG_FIRSTTICK; } } else { - if ((channel->flags & AUDIOCHANNELFLAG_2000) == 0) { + if ((channel->flags & PSFLAG_OUTOFRANGE) == 0) { if (channel->audiohandle != NULL && sndGetState(channel->audiohandle) != AL_STOPPED) { +#if VERSION >= VERSION_NTSC_1_0 + audioStop(channel->audiohandle); +#else + osSyncPrintf("PS_AUTO : Pausing %d\n", channelnum); audioStop(channel->audiohandle); -#if VERSION < VERSION_NTSC_1_0 channel->audiohandle = NULL; #endif } - channel->flags |= AUDIOCHANNELFLAG_2000; + channel->flags |= PSFLAG_OUTOFRANGE; } #if VERSION >= VERSION_NTSC_1_0 - channel->flags &= ~AUDIOCHANNELFLAG_1000; + channel->flags &= ~PSFLAG_FIRSTTICK; #endif } } - if ((channel->flags & AUDIOCHANNELFLAG_2000) == 0) { - if (channel->flags & AUDIOCHANNELFLAG_1000) { - if (channel->flags & AUDIOCHANNELFLAG_ISMP3) { - sndStartMp3(channel->soundnum26, sp48, sp44, (channel->flags2 & AUDIOCHANNELFLAG2_0001) ? 1 : 0); + /** + * Handle starting, restarting or adjusting the audio. + */ + if ((channel->flags & PSFLAG_OUTOFRANGE) == 0) { + if (channel->flags & PSFLAG_FIRSTTICK) { +#if VERSION < VERSION_NTSC_1_0 + osSyncPrintf("SND : Propsound needs play : Id %d is flaged g\n", channelnum); +#endif + + + if (channel->flags & PSFLAG_ISMP3) { + sndStartMp3(channel->soundnum26, newvol, newpan, (channel->flags2 & PSFLAG2_RESPONDHELLO) ? 1 : 0); } else { #if VERSION >= VERSION_NTSC_1_0 - if (channel->flags & AUDIOCHANNELFLAG_0400) { - if (sp48) { - snd00010718(&channel->audiohandle, channel->flags & AUDIOCHANNELFLAG_ISMP3, sp48, sp44, - channel->soundnum26, sp3c, channel->unk1a, sp40, 1); + if (channel->flags & PSFLAG_0400) { + if (newvol) { + snd00010718(&channel->audiohandle, channel->flags & PSFLAG_ISMP3, newvol, newpan, + channel->soundnum26, newpitch, channel->fxbus, newfx, 1); } } else { - if (sp48) { - snd00010718(&channel->audiohandle, channel->flags & AUDIOCHANNELFLAG_ISMP3, sp48, sp44, - channel->soundnum26, sp3c, channel->unk1a, sp40, 1); + if (newvol) { + snd00010718(&channel->audiohandle, channel->flags & PSFLAG_ISMP3, newvol, newpan, + channel->soundnum26, newpitch, channel->fxbus, newfx, 1); } } #else - snd00010718(&channel->audiohandle, channel->flags & AUDIOCHANNELFLAG_ISMP3, sp48, sp44, - channel->soundnum26, sp3c, channel->unk1a, sp40, 1); + snd00010718(&channel->audiohandle, channel->flags & PSFLAG_ISMP3, newvol, newpan, + channel->soundnum26, newpitch, channel->fxbus, newfx, 1); #endif } - channel->flags &= ~AUDIOCHANNELFLAG_1000; + channel->flags &= ~PSFLAG_FIRSTTICK; } else { - sndAdjust(&channel->audiohandle, channel->flags & AUDIOCHANNELFLAG_ISMP3, sp48, sp44, - channel->soundnum26, sp3c, channel->unk1a, sp40, channel->flags & AUDIOCHANNELFLAG_4000); + sndAdjust(&channel->audiohandle, channel->flags & PSFLAG_ISMP3, newvol, newpan, + channel->soundnum26, newpitch, channel->fxbus, newfx, channel->flags & PSFLAG_CHANGINGPAN); } } } else { + /** + * The channel doesn't need to tick any more. + * If it's not marked, free it. + */ #if VERSION >= VERSION_NTSC_1_0 - if (channel->unk28 != 11) { - if (channel->flags & AUDIOCHANNELFLAG_ISMP3) { + if (channel->type != PSTYPE_MARKER) { + if (channel->flags & PSFLAG_ISMP3) { if (!sndIsPlayingMp3()) { - if (channel->flags & AUDIOCHANNELFLAG_FORPROP) { + if (channel->flags & PSFLAG_FORPROP) { propDecrementSoundCount(channel->prop); } - if (channel->flags & AUDIOCHANNELFLAG_FORHUDMSG) { + if (channel->flags & PSFLAG_FORHUDMSG) { hudmsgsHideByChannel(channelnum); } } - channel->flags = AUDIOCHANNELFLAG_IDLE; + channel->flags = PSFLAG_FREE; } else if (channel->audiohandle == NULL) { - if (channel->flags & AUDIOCHANNELFLAG_FORPROP) { + if (channel->flags & PSFLAG_FORPROP) { propDecrementSoundCount(channel->prop); } - channel->flags = AUDIOCHANNELFLAG_IDLE; + channel->flags = PSFLAG_FREE; } } #else - if (channel->flags & AUDIOCHANNELFLAG_ISMP3) { + if (channel->flags & PSFLAG_ISMP3) { if (!sndIsPlayingMp3()) { - if (channel->flags & AUDIOCHANNELFLAG_FORPROP) { + if (channel->flags & PSFLAG_FORPROP) { propDecrementSoundCount(channel->prop); } - if (channel->flags & AUDIOCHANNELFLAG_FORHUDMSG) { + if (channel->flags & PSFLAG_FORHUDMSG) { hudmsgsHideByChannel(channelnum); } } } else if (channel->audiohandle == NULL) { - if (channel->flags & AUDIOCHANNELFLAG_FORPROP) { + if (channel->flags & PSFLAG_FORPROP) { propDecrementSoundCount(channel->prop); } } - channel->flags = AUDIOCHANNELFLAG_IDLE; + channel->flags = PSFLAG_FREE; #endif } - if (var8006ae44 && (channel->flags2 & AUDIOCHANNELFLAG2_0004)) { - propsndPrintChannel(channel); + if (g_PsPrintFlagged && (channel->flags2 & PSFLAG2_PRINTABLE)) { + psPrintChannel(channel); } #if VERSION >= VERSION_NTSC_1_0 - channel->flags &= ~AUDIOCHANNELFLAG_1000; + channel->flags &= ~PSFLAG_FIRSTTICK; #endif - channel->flags &= ~AUDIOCHANNELFLAG_4000; + + channel->flags &= ~PSFLAG_CHANGINGPAN; } -void propsndTick(void) +void psTick(void) { - static s32 g_PropsndMaxActiveChannels = 0; + static s32 peakcount = 0; s32 count = 0; s32 i; - for (i = 0; i < (IS4MB() ? 30 : 40); i++) { - struct audiochannel *channel = &g_AudioChannels[i]; + for (i = 0; i < CHANNELCOUNT(); i++) { + struct pschannel *channel = &g_PsChannels[i]; - if ((channel->flags & AUDIOCHANNELFLAG_IDLE) == 0) { - propsndTickChannel(i); +#if VERSION < VERSION_NTSC_1_0 + // Doing a proper check for the free flag here causes a regalloc mismatch. + osSyncPrintf("AISND : Channel %d - %s", i, 1 ? "FREE" : "IN USE"); +#endif + + if ((channel->flags & PSFLAG_FREE) == 0) { + psTickChannel(i); count++; #if VERSION >= VERSION_NTSC_1_0 - if (g_PropsndPrintChannels) { - propsndPrintChannel(&g_AudioChannels[i]); + if (g_PsPrintAll) { + psPrintChannel(&g_PsChannels[i]); } #endif } } #if VERSION >= VERSION_NTSC_1_0 - if (g_PropsndPrintChannels) { - g_PropsndPrintChannels = false; + if (g_PsPrintAll) { + g_PsPrintAll = false; } - - if (IS4MB()); #endif - if (g_PropsndMaxActiveChannels < count) { - g_PropsndMaxActiveChannels = count; + if (count > peakcount) { + peakcount = count; } + + osSyncPrintf("Propsnd : Using %d of %d (Peek = %d of %d)", count, CHANNELCOUNT(), peakcount, CHANNELCOUNT()); } -void func0f093630(struct prop *prop, f32 arg1, s32 arg2) +void psSetPitch(struct prop *prop, f32 targetpitch, s32 changespeed) { OSPri prevpri; s32 i; - for (i = 0; i < (IS4MB() ? 30 : 40); i++) { - if ((g_AudioChannels[i].flags & AUDIOCHANNELFLAG_IDLE) == 0 && g_AudioChannels[i].prop == prop) { - g_AudioChannels[i].unk44 = arg1; + for (i = 0; i < CHANNELCOUNT(); i++) { + if ((g_PsChannels[i].flags & PSFLAG_FREE) == 0 && g_PsChannels[i].prop == prop) { + g_PsChannels[i].targetpitch = targetpitch; - if (arg2 > 0) { - g_AudioChannels[i].unk20 = arg2 * 4; + if (changespeed > 0) { + g_PsChannels[i].pitchchangespeed = changespeed * 4; } else { - g_AudioChannels[i].unk20 = -1; + g_PsChannels[i].pitchchangespeed = -1; } #if VERSION >= VERSION_NTSC_1_0 prevpri = osGetThreadPri(0); osSetThreadPri(0, osGetThreadPri(&g_AudioManager.thread) + 1); - propsndTickChannel(i); + psTickChannel(i); osSetThreadPri(0, prevpri); #else - propsndTickChannel(i); + psTickChannel(i); #endif } } } -void func0f093790(struct prop *prop, s32 arg1) +void psSetVolume(struct prop *prop, s32 volpercentage) { OSPri prevpri; s32 i; - for (i = 0; i < (IS4MB() ? 30 : 40); i++) { - if ((g_AudioChannels[i].flags & AUDIOCHANNELFLAG_IDLE) == 0 && prop == g_AudioChannels[i].prop) { + for (i = 0; i < CHANNELCOUNT(); i++) { + if ((g_PsChannels[i].flags & PSFLAG_FREE) == 0 && prop == g_PsChannels[i].prop) { #if VERSION >= VERSION_NTSC_1_0 - if (arg1 > 100) { - arg1 = 100; + if (volpercentage > 100) { + volpercentage = 100; } prevpri = osGetThreadPri(0); osSetThreadPri(0, osGetThreadPri(&g_AudioManager.thread) + 1); - g_AudioChannels[i].unk10 = arg1 * 32767 / 100; - propsndTickChannel(i); + g_PsChannels[i].vol10 = volpercentage * AL_VOL_FULL / 100; + psTickChannel(i); osSetThreadPri(0, prevpri); #else - g_AudioChannels[i].unk10 = arg1 * 32767 / 100; - propsndTickChannel(i); + g_PsChannels[i].vol10 = volpercentage * AL_VOL_FULL / 100; + psTickChannel(i); #endif } } } #if VERSION >= VERSION_NTSC_1_0 -void func0f0938ec(struct prop *prop) +void psStopOneShootChannel(struct prop *prop) { s32 lowestuuid = -1; s32 count = 0; s32 bestindex = -1; s32 i; - for (i = 0; i < (IS4MB() ? 30 : 40); i++) { - struct audiochannel *channel = &g_AudioChannels[i]; + for (i = 0; i < CHANNELCOUNT(); i++) { + struct pschannel *channel = &g_PsChannels[i]; - if ((channel->flags & AUDIOCHANNELFLAG_IDLE) == 0 - && (channel->flags2 & AUDIOCHANNELFLAG2_0080) == 0 + if ((channel->flags & PSFLAG_FREE) == 0 + && (channel->flags2 & PSFLAG2_STOPPED) == 0 && prop == channel->prop - && channel->unk28 == 0x11) { + && channel->type == PSTYPE_CHRSHOOT) { count++; if (channel->uuid < lowestuuid) { @@ -635,52 +638,42 @@ void func0f0938ec(struct prop *prop) if (1); if (count >= 2 && bestindex != -1) { - func0f092a98(bestindex); + psStopChannel(bestindex); } } #endif -s16 propsnd0f0939f8( - struct audiochannel *channel, - struct prop *prop, - s16 soundnum, - s16 padnum, - s32 arg4, - u16 flags, - u16 flags2, - s32 arg7, - struct coord *pos, - f32 arg9, - s16 *rooms, - s32 room, - f32 arg12, - f32 arg13, - f32 arg14) +s16 psCreate(struct pschannel *channel, struct prop *prop, s16 soundnum, s16 padnum, + s32 vol, u16 flags, u16 flags2, s32 type, + struct coord *pos, f32 pitch, s16 *rooms, s32 room, + f32 dist1, f32 dist2, f32 dist3) { union soundnumhack spac; OSPri prevpri; u32 stack[2]; - s32 tmp; + s32 pan; #if VERSION >= VERSION_NTSC_1_0 struct pad pad; s32 i; s32 j; - if (arg7 == 0x11) { - func0f0938ec(prop); + osSyncPrintf("AISOUND: aisoundnewtypeflags - Channel %d -> Playing sound number id=%d(%x)\n", channel, soundnum, soundnum); + + if (type == PSTYPE_CHRSHOOT) { + psStopOneShootChannel(prop); } spac.packed = soundnum; if (channel == NULL) { - if (arg7 != 16 && var8005ddd4 > 12) { + if (type != PSTYPE_FOOTSTEP && g_SndNumPlaying > 12) { return -1; } - for (i = 8; i < (IS4MB() ? 30 : 40); i++) { - if (g_AudioChannels[i].flags & AUDIOCHANNELFLAG_IDLE) { - channel = &g_AudioChannels[i]; + for (i = CHANNEL_HEAP_FIRST; i < CHANNELCOUNT(); i++) { + if (g_PsChannels[i].flags & PSFLAG_FREE) { + channel = &g_PsChannels[i]; channel->channelnum = i; break; } @@ -696,12 +689,12 @@ s16 propsnd0f0939f8( spac.packed = soundnum; if (channel == NULL) { - for (i = 8; i < (IS4MB() ? 30 : 40); i++) { - if (g_AudioChannels[i].flags & AUDIOCHANNELFLAG_IDLE) { - channel = &g_AudioChannels[i]; + for (i = CHANNEL_HEAP_FIRST; i < CHANNELCOUNT(); i++) { + if (g_PsChannels[i].flags & PSFLAG_FREE) { + channel = &g_PsChannels[i]; if (i); - if (arg7 != 16) { + if (type != PSTYPE_FOOTSTEP) { channel->channelnum = i; } else { t4 = i; @@ -709,19 +702,19 @@ s16 propsnd0f0939f8( break; } - if (arg7 == 16) { + if (type == PSTYPE_FOOTSTEP) { count++; } } } - if (arg7 == 16) { + if (type == PSTYPE_FOOTSTEP) { if (count >= 12) { return -1; } if (t4 != -1) { - channel = &g_AudioChannels[t4]; + channel = &g_PsChannels[t4]; channel->channelnum = t4; } else { return -1; @@ -751,27 +744,27 @@ s16 propsnd0f0939f8( channel->flags = flags; channel->flags2 = flags2; channel->audiohandle = NULL; - channel->unk06 = -1; - channel->unk08 = -1; - channel->unk0e = -1; - channel->unk04 = (arg4 != -1) ? arg4 : -1; - channel->unk0a = 64; - channel->unk0c = 0; - channel->unk10 = 0x7fff; - channel->unk1a = 1; - channel->unk44 = (arg9 > 0) ? arg9 : -1; - channel->unk48 = channel->unk44; - channel->unk20 = -1; - channel->unk1c = -1; + channel->currentvol = -1; + channel->currentpan = -1; + channel->currentfx = -1; + channel->targetvol = (vol != -1) ? vol : -1; + channel->targetpan = AL_PAN_CENTER; + channel->targetfx = 0; + channel->vol10 = AL_VOL_FULL; + channel->fxbus = 1; + channel->targetpitch = (pitch > 0) ? pitch : -1; + channel->currentpitch = channel->targetpitch; + channel->pitchchangespeed = -1; + channel->volchangetimer60 = -1; channel->padnum = padnum; channel->prop = prop; - channel->unk28 = arg7; - channel->unk12 = arg4; + channel->type = type; + channel->vol12 = vol; channel->unk40 = -1; - channel->unk34 = (arg12 > 0) ? arg12 : 400; - channel->unk38 = (arg13 > 0) ? arg13 : 2500; - channel->unk3c = (arg14 > 0) ? arg14 : 3000; - channel->unk18 = 0; + channel->dist1 = (dist1 > 0) ? dist1 : 400; + channel->dist2 = (dist2 > 0) ? dist2 : 2500; + channel->dist3 = (dist3 > 0) ? dist3 : 3000; + channel->volchangespeed = 0; #if VERSION >= VERSION_NTSC_1_0 channel->uuid = g_AudioPrevUuid; #endif @@ -781,57 +774,57 @@ s16 propsnd0f0939f8( s32 confignum = g_AudioRussMappings[id].audioconfig_index; s32 newid = g_AudioRussMappings[id].soundnum; - channel->unk34 = g_AudioConfigs[confignum].unk00; - channel->unk38 = g_AudioConfigs[confignum].unk04; - channel->unk3c = g_AudioConfigs[confignum].unk08; - channel->unk18 = g_AudioConfigs[confignum].unk18; + channel->dist1 = g_AudioConfigs[confignum].dist1; + channel->dist2 = g_AudioConfigs[confignum].dist2; + channel->dist3 = g_AudioConfigs[confignum].dist3; + channel->volchangespeed = g_AudioConfigs[confignum].volchangespeed; - if (g_AudioConfigs[confignum].unk10 != 100) { - channel->unk10 = g_AudioConfigs[confignum].unk10 * 327; + if (g_AudioConfigs[confignum].volpercentage != 100) { + channel->vol10 = g_AudioConfigs[confignum].volpercentage * (AL_VOL_FULL / 100); } - if (g_AudioConfigs[confignum].unk0c > 0) { - channel->unk44 = g_AudioConfigs[confignum].unk0c; + if (g_AudioConfigs[confignum].pitch > 0) { + channel->targetpitch = g_AudioConfigs[confignum].pitch; } - tmp = g_AudioConfigs[confignum].unk14; + pan = g_AudioConfigs[confignum].pan; - if (tmp != -1) { - channel->unk0a = tmp; - channel->flags |= AUDIOCHANNELFLAG_0020; + if (pan != -1) { + channel->targetpan = pan; + channel->flags |= PSFLAG_HASCONFIGPAN; } if (g_AudioConfigs[confignum].flags & AUDIOCONFIGFLAG_01) { - channel->flags |= AUDIOCHANNELFLAG_0800; + channel->flags |= PSFLAG_0800; } - if (g_AudioConfigs[confignum].flags & AUDIOCONFIGFLAG_04) { - channel->flags2 |= AUDIOCHANNELFLAG2_0001; + if (g_AudioConfigs[confignum].flags & AUDIOCONFIGFLAG_RESPONDHELLO) { + channel->flags2 |= PSFLAG2_RESPONDHELLO; } if (g_AudioConfigs[confignum].flags & AUDIOCONFIGFLAG_08) { - if (channel->unk04 == -1) { - channel->unk04 = channel->unk10; + if (channel->targetvol == -1) { + channel->targetvol = channel->vol10; } - channel->flags |= AUDIOCHANNELFLAG_8000; + channel->flags |= PSFLAG_IGNOREROOMS; } if (g_AudioConfigs[confignum].flags & AUDIOCONFIGFLAG_OFFENSIVE) { - channel->flags2 |= AUDIOCHANNELFLAG2_OFFENSIVE; + channel->flags2 |= PSFLAG2_OFFENSIVE; } if (g_AudioConfigs[confignum].flags & AUDIOCONFIGFLAG_20) { - channel->flags2 |= AUDIOCHANNELFLAG2_0010; + channel->flags2 |= PSFLAG2_0010; } #if VERSION >= VERSION_NTSC_1_0 if (g_AudioConfigs[confignum].flags & AUDIOCONFIGFLAG_40) { - channel->flags2 |= AUDIOCHANNELFLAG2_0040; + channel->flags2 |= PSFLAG2_0040; } #endif - channel->flags |= AUDIOCHANNELFLAG_0040; + channel->flags |= PSFLAG_HASCONFIG; spac.packed = newid; spac.hasconfig = false; @@ -839,28 +832,28 @@ s16 propsnd0f0939f8( } #if VERSION >= VERSION_NTSC_1_0 - if (channel->unk18) { - channel->flags |= AUDIOCHANNELFLAG_0002; + if (channel->volchangespeed) { + channel->flags |= PSFLAG_REPEATING; } #endif channel->soundnum26 = spac.packed; - channel->unk2c = spac.id; + channel->soundnum2c = spac.id; #if VERSION >= VERSION_NTSC_1_0 - if (sndIsFiltered(channel->unk2c)) { - channel->flags2 |= AUDIOCHANNELFLAG2_OFFENSIVE; + if (sndIsFiltered(channel->soundnum2c)) { + channel->flags2 |= PSFLAG2_OFFENSIVE; } #endif if (spac.unk02) { - channel->flags2 |= AUDIOCHANNELFLAG2_0010; + channel->flags2 |= PSFLAG2_0010; } #if VERSION < VERSION_NTSC_1_0 - if (channel->flags2 & AUDIOCHANNELFLAG2_0010) { - if (channel->unk04 == -1) { - channel->unk04 = channel->unk10; + if (channel->flags2 & PSFLAG2_0010) { + if (channel->targetvol == -1) { + channel->targetvol = channel->vol10; } } #endif @@ -890,103 +883,142 @@ s16 propsnd0f0939f8( #if VERSION >= VERSION_NTSC_1_0 if (!pos && !channel->prop) { - channel->flags2 |= AUDIOCHANNELFLAG2_0010; + channel->flags2 |= PSFLAG2_0010; } - if ((channel->flags2 & AUDIOCHANNELFLAG2_0010) && channel->unk04 == -1) { - channel->unk04 = channel->unk10; + if ((channel->flags2 & PSFLAG2_0010) && channel->targetvol == -1) { + channel->targetvol = channel->vol10; } #endif - channel->flags |= AUDIOCHANNELFLAG_1000; + channel->flags |= PSFLAG_FIRSTTICK; if (sndIsMp3(soundnum)) { - channel->flags |= AUDIOCHANNELFLAG_ISMP3; + channel->flags |= PSFLAG_ISMP3; #if VERSION >= VERSION_NTSC_1_0 prevpri = osGetThreadPri(0); osSetThreadPri(0, osGetThreadPri(&g_AudioManager.thread) + 1); - propsndTickChannel(channel->channelnum); + psTickChannel(channel->channelnum); osSetThreadPri(0, prevpri); #else - propsndTickChannel(channel->channelnum); + psTickChannel(channel->channelnum); #endif } else { prevpri = osGetThreadPri(0); osSetThreadPri(0, osGetThreadPri(&g_AudioManager.thread) + 1); - propsndTickChannel(channel->channelnum); + psTickChannel(channel->channelnum); osSetThreadPri(0, prevpri); } #if VERSION >= VERSION_NTSC_1_0 - if (channel->flags & AUDIOCHANNELFLAG_0400) { - channel->flags &= ~AUDIOCHANNELFLAG_0400; - channel->flags2 |= AUDIOCHANNELFLAG2_0010; + if (channel->flags & PSFLAG_0400) { + channel->flags &= ~PSFLAG_0400; + channel->flags2 |= PSFLAG2_0010; } - channel->flags &= ~AUDIOCHANNELFLAG_1000; + channel->flags &= ~PSFLAG_FIRSTTICK; #else - if (channel->flags & AUDIOCHANNELFLAG_0400) { - channel->flags = AUDIOCHANNELFLAG_IDLE; + if (channel->flags & PSFLAG_0400) { + channel->flags = PSFLAG_FREE; } else { - channel->flags &= ~AUDIOCHANNELFLAG_1000; + channel->flags &= ~PSFLAG_FIRSTTICK; } #endif return channel->channelnum; } -s32 audioPlayFromProp(s32 channelnum, s16 soundnum, s32 arg2, struct prop *prop, s16 arg4, u16 arg5) +s32 psPlayFromProp(s32 channelnum, s16 soundnum, s32 vol, struct prop *prop, s16 type, u16 flags) { s32 retchannelnum = -1; - if (arg4 == 11) { - if (channelnum >= 0 && channelnum <= 7) { +#if VERSION < VERSION_NTSC_1_0 + osSyncPrintf("SND : Start -> Prop=%x, Id=%d, Vol=%d, Flags=%d, Type=%d\n", prop, soundnum, vol, flags, type); +#endif + + if (type == PSTYPE_MARKER) { + if (CHANNEL_IS_AI(channelnum)) { #if VERSION >= VERSION_NTSC_1_0 - if (g_AudioChannels[channelnum].flags & AUDIOCHANNELFLAG_IDLE) { - g_AudioChannels[channelnum].soundnum26 = soundnum; - g_AudioChannels[channelnum].unk28 = 11; - g_AudioChannels[channelnum].flags &= ~AUDIOCHANNELFLAG_IDLE; + if (g_PsChannels[channelnum].flags & PSFLAG_FREE) { + osSyncPrintf("AISOUND: PSTYPE_MARKER - Channel %d -> Playing sound number id=%d(%x)\n", channelnum, soundnum, soundnum); + g_PsChannels[channelnum].soundnum26 = soundnum; + g_PsChannels[channelnum].type = PSTYPE_MARKER; + g_PsChannels[channelnum].flags &= ~PSFLAG_FREE; retchannelnum = channelnum; } else { - g_AudioChannels[channelnum].soundnum26 = soundnum; - g_AudioChannels[channelnum].unk28 = 11; - g_AudioChannels[channelnum].flags &= ~AUDIOCHANNELFLAG_IDLE; + osSyncPrintf("AISOUND: PSTYPE_MARKER - Channel %d -> Playing sound number id=%d(%x)\n", channelnum, soundnum, soundnum); + g_PsChannels[channelnum].soundnum26 = soundnum; + g_PsChannels[channelnum].type = PSTYPE_MARKER; + g_PsChannels[channelnum].flags &= ~PSFLAG_FREE; retchannelnum = channelnum; } #else - g_AudioChannels[channelnum].soundnum26 = soundnum; - g_AudioChannels[channelnum].unk28 = 11; - g_AudioChannels[channelnum].flags &= ~AUDIOCHANNELFLAG_IDLE; + osSyncPrintf("AISOUND: Channel %d -> Playing sound number id=%d(%x))\n", channelnum, soundnum, soundnum); + g_PsChannels[channelnum].soundnum26 = soundnum; + g_PsChannels[channelnum].type = PSTYPE_MARKER; + g_PsChannels[channelnum].flags &= ~PSFLAG_FREE; retchannelnum = channelnum; #endif } else { // empty } - } else if (channelnum == 10) { - retchannelnum = propsnd0f0939f8(NULL, prop, soundnum, -1, - (arg2 ? 0 : -1), arg5 | 0x0080, 0, arg4, 0, -1, 0, -1, -1, -1, -1); + } else if (channelnum == CHANNEL_CUTSCENE) { + /** + * An AI script has requested the AI multi channel. + * The multi channel is an abstraction for more channels. + * Let psCreate choose the real channel number from the heap area. + * The real channel number is returned but AI will ignore it. + * + * Flag PSFLAG_CUTSCENE is set so propsnd knows the channel + * was allocated as part of AIMULTI instead of via the game engine. + */ + osSyncPrintf("AISOUND: CUTSCENE -> Playing sound number id=%d(%x))\n", soundnum, soundnum); + + retchannelnum = psCreate(NULL, prop, soundnum, -1, + (vol ? 0 : -1), flags | PSFLAG_CUTSCENE, 0, type, 0, -1, 0, -1, -1, -1, -1); + } #if VERSION >= VERSION_NTSC_1_0 - } else if (channelnum < 0 || channelnum >= 8 || channelnum == 9) { - retchannelnum = propsnd0f0939f8(NULL, prop, soundnum, -1, - (arg2 ? 0 : -1), arg5, 0, arg4, 0, -1, 0, -1, -1, -1, -1); + else if (channelnum < 0 || channelnum >= 8 || channelnum == 9) { + /** + * This is a game engine sound. + * Allocate a channel automatically from the heap and return it. + */ + osSyncPrintf("AISOUND: Channel %d -> Playing sound number id=%d(%x), Prop=%x, Flags=%x, Type=%d, Zero=%d\n", + channelnum, soundnum, soundnum, prop, flags, type, 0); + osSyncPrintf("AISOUND: Channel %d -> Playing sound number id=%d(%x), Prop=%x, Flags=%x, Type=%d\n", + channelnum, soundnum, soundnum, prop, flags, type); + + retchannelnum = psCreate(NULL, prop, soundnum, -1, + (vol ? 0 : -1), flags, 0, type, 0, -1, 0, -1, -1, -1, -1); + } #else - } else if (channelnum == 9) { - retchannelnum = propsnd0f0939f8(NULL, prop, soundnum, -1, - (arg2 ? 0 : -1), arg5, 0, arg4, 0, -1, 0, -1, -1, -1, -1); + else if (channelnum == 9) { + osSyncPrintf("AISOUND: DONTCARE -> Playing sound number id=%d(%x))\n", soundnum, soundnum); + retchannelnum = psCreate(NULL, prop, soundnum, -1, (vol ? 0 : -1), flags, 0, type, 0, -1, 0, -1, -1, -1, -1); } else if (channelnum < 0 || channelnum >= 8) { - retchannelnum = propsnd0f0939f8(NULL, prop, soundnum, -1, - (arg2 ? 0 : -1), arg5, 0, arg4, 0, -1, 0, -1, -1, -1, -1); + osSyncPrintf("AISOUND: Channel %d -> Playing sound number id=%d(%x), Prop=%x\n", channelnum, soundnum, soundnum, prop); + retchannelnum = psCreate(NULL, prop, soundnum, -1, (vol ? 0 : -1), flags, 0, type, 0, -1, 0, -1, -1, -1, -1); + } #endif - } else { - if ((g_AudioChannels[channelnum].flags & AUDIOCHANNELFLAG_IDLE) == 0) { - func0f092a98(channelnum); + else { + /** + * An AI script has asked for a specific channel in range 0-9. + * Replace the channel if necessary. + */ + if ((g_PsChannels[channelnum].flags & PSFLAG_FREE) == 0) { +#if VERSION < VERSION_NTSC_1_0 + osSyncPrintf("SERIOUS: Existing ai sound number %d (Sound id=%d(%x)) : KILLING\n", + channelnum, g_PsChannels[channelnum].soundnum26, g_PsChannels[channelnum].soundnum26); +#endif + + psStopChannel(channelnum); } - g_AudioChannels[channelnum].channelnum = channelnum; + g_PsChannels[channelnum].channelnum = channelnum; - propsnd0f0939f8(&g_AudioChannels[channelnum], prop, soundnum, -1, - (arg2 ? 0 : -1), arg5, 0, arg4, 0, -1, 0, -1, -1, -1, -1); + psCreate(&g_PsChannels[channelnum], prop, soundnum, -1, + (vol ? 0 : -1), flags, 0, type, 0, -1, 0, -1, -1, -1, -1); retchannelnum = channelnum; } @@ -994,33 +1026,36 @@ s32 audioPlayFromProp(s32 channelnum, s16 soundnum, s32 arg2, struct prop *prop, return retchannelnum; } -void audioMuteChannel(s32 channelnum) +void psMuteChannel(s32 channelnum) { - if (channelnum == 10) { + if (channelnum == CHANNEL_CUTSCENE) { s32 i; - for (i = 8; i < (IS4MB() ? 30 : 40); i++) { - if ((g_AudioChannels[i].flags & AUDIOCHANNELFLAG_IDLE) == 0 - && (g_AudioChannels[i].flags & AUDIOCHANNELFLAG_0080)) { - func0f092a98(i); + osSyncPrintf("AISOUND: CUTSCENE -> Stopping all cutscene sounds\n"); + + for (i = CHANNEL_HEAP_FIRST; i < CHANNELCOUNT(); i++) { + if ((g_PsChannels[i].flags & PSFLAG_FREE) == 0 + && (g_PsChannels[i].flags & PSFLAG_CUTSCENE)) { + psStopChannel(i); } } - } else if (channelnum >= 0 && channelnum <= 7) { - func0f092a98(channelnum); + } else if (CHANNEL_IS_AI(channelnum)) { + osSyncPrintf("AISOUND: Stop sound channel %d\n", channelnum); + psStopChannel(channelnum); } } -bool audioIsChannelIdle(s32 channelnum) +bool psIsChannelFree(s32 channelnum) { - if (channelnum >= 0 && channelnum <= 7) { - return (g_AudioChannels[channelnum].flags & AUDIOCHANNELFLAG_IDLE) ? true : false; + if (CHANNEL_IS_AI(channelnum)) { + return (g_PsChannels[channelnum].flags & PSFLAG_FREE) ? true : false; } - if (channelnum == 10) { + if (channelnum == CHANNEL_CUTSCENE) { s32 i; - for (i = 8; i < (IS4MB() ? 30 : 40); i++) { - if (g_AudioChannels[i].flags & AUDIOCHANNELFLAG_0080) { + for (i = CHANNEL_HEAP_FIRST; i < CHANNELCOUNT(); i++) { + if (g_PsChannels[i].flags & PSFLAG_CUTSCENE) { return false; } } @@ -1029,25 +1064,30 @@ bool audioIsChannelIdle(s32 channelnum) return true; } -void audioPlayFromProp2(s32 channelnum, s32 arg1, s16 padnum, struct prop *prop, s32 arg4, s32 arg5, s32 arg6, u16 arg7) +void psModify(s32 channelnum, s32 volume, s16 padnum, struct prop *prop, s32 volchangetimer60, s32 dist2, s32 dist3, u16 flags) { - struct audiochannel *channel = &g_AudioChannels[channelnum]; - bool a1 = (arg4 >= 6) ? true : false; - bool a0 = (arg7 & 2) ? true : false; + struct pschannel *channel = &g_PsChannels[channelnum]; + bool hastimer = (volchangetimer60 >= 6) ? true : false; + bool repeating = (flags & PSFLAG_REPEATING) ? true : false; - if (channelnum >= 0 && channelnum <= 7) { - if (channel->unk28 == 11) { - g_AudioChannels[channelnum].channelnum = (u16)channelnum; + osSyncPrintf("AISOUND: Channel %d -> Setting params : Vol=%d, Pad=%d, Prop=%x, Time=%d, Far=%d, Silence=%d, Flags=%u\n", + channelnum, volume, padnum, prop, volchangetimer60, dist2, dist3, flags); - propsnd0f0939f8(&g_AudioChannels[channelnum], prop, channel->soundnum26, -1, - -1, arg7, 0, 0, 0, -1, 0, -1, 400, arg5, arg6); + if (CHANNEL_IS_AI(channelnum)) { + if (channel->type == PSTYPE_MARKER) { + osSyncPrintf("AISOUND : This channel has a marker -> Shall start and use ID = %d(%x)\n", channelnum, &g_PsChannels[channelnum]); + + g_PsChannels[channelnum].channelnum = (u16)channelnum; + + psCreate(&g_PsChannels[channelnum], prop, channel->soundnum26, -1, + -1, flags, 0, PSTYPE_NONE, 0, -1, 0, -1, 400, dist2, dist3); } else { - if ((channel->flags & AUDIOCHANNELFLAG_2000) == 0 && arg1 >= 0) { - channel->unk04 = arg1; + if ((channel->flags & PSFLAG_OUTOFRANGE) == 0 && volume >= 0) { + channel->targetvol = volume; } - if (a1) { - channel->unk1c = TICKS(arg4); + if (hastimer) { + channel->volchangetimer60 = TICKS(volchangetimer60); } if (padnum != -1) { @@ -1058,54 +1098,54 @@ void audioPlayFromProp2(s32 channelnum, s32 arg1, s16 padnum, struct prop *prop, channel->prop = prop; } - if (a0) { - channel->flags |= AUDIOCHANNELFLAG_0002; + if (repeating) { + channel->flags |= PSFLAG_REPEATING; } - if ((channel->flags & AUDIOCHANNELFLAG_0040) == 0) { - channel->unk34 = 400; - channel->unk38 = arg5; - channel->unk3c = arg6; - channel->unk18 = 0; + if ((channel->flags & PSFLAG_HASCONFIG) == 0) { + channel->dist1 = 400; + channel->dist2 = dist2; + channel->dist3 = dist3; + channel->volchangespeed = 0; } - if (!a1 || channel->unk1c == 0) { + if (!hastimer || channel->volchangetimer60 == 0) { #if VERSION >= VERSION_NTSC_1_0 OSPri prevpri = osGetThreadPri(0); osSetThreadPri(0, osGetThreadPri(&g_AudioManager.thread) + 1); - propsndTickChannel(channelnum); + psTickChannel(channelnum); osSetThreadPri(0, prevpri); #else - propsndTickChannel(channelnum); + psTickChannel(channelnum); #endif } } } } -s32 propsnd0f0946b0(struct coord *pos, f32 arg1, f32 arg2, f32 arg3, s16 *rooms, s16 soundnum, s32 arg6, f32 *arg7) +s32 psCalculateVol(struct coord *pos, f32 dist1, f32 dist2, f32 dist3, s16 *rooms, s16 soundnum, s32 arg6, f32 *playerdistptr) { union soundnumhack sp6c; union soundnumhack sp68; - f32 sp64; - s16 sp62; + f32 playerdist; + s16 roomnum; s32 s0; s32 i; - sp64 = arg3 + 10.0f; + playerdist = dist3 + 10.0f; if (rooms != NULL) { - sp62 = *rooms; + roomnum = *rooms; } else { - sp62 = -1; + roomnum = -1; } sp68.packed = soundnum; sp6c.packed = soundnum; #if VERSION < VERSION_NTSC_1_0 - if (g_PropsndPrintChannels) { - sp64 = 9999999; + if (g_PsPrintAll) { + playerdist = 9999999; } #endif @@ -1115,12 +1155,12 @@ s32 propsnd0f0946b0(struct coord *pos, f32 arg1, f32 arg2, f32 arg3, s16 *rooms, sp6c.packed = g_AudioRussMappings[confignum].soundnum; - arg1 = g_AudioConfigs[index].unk00; - arg2 = g_AudioConfigs[index].unk04; - arg3 = g_AudioConfigs[index].unk08; + dist1 = g_AudioConfigs[index].dist1; + dist2 = g_AudioConfigs[index].dist2; + dist3 = g_AudioConfigs[index].dist3; - if (arg3 < sp64) { - sp64 = arg3; + if (dist3 < playerdist) { + playerdist = dist3; } } @@ -1130,6 +1170,7 @@ s32 propsnd0f0946b0(struct coord *pos, f32 arg1, f32 arg2, f32 arg3, s16 *rooms, s0 = 0; } + // Figure out which player is closest and store their distance in playerdist for (i = 0; i < PLAYERCOUNT(); i++) { struct player *player = g_Vars.players[i]; s32 camroom; @@ -1140,17 +1181,17 @@ s32 propsnd0f0946b0(struct coord *pos, f32 arg1, f32 arg2, f32 arg3, s16 *rooms, camroom = -1; } - func0f0056f4(camroom, &player->cam_pos, sp62, pos, 0, &sp64, s0); + func0f0056f4(camroom, &player->cam_pos, roomnum, pos, 0, &playerdist, s0); } - if (arg7 != NULL) { - *arg7 = sp64; + if (playerdistptr != NULL) { + *playerdistptr = playerdist; } - return func0f0927d4(sp64, arg1, arg2, arg3, arg6); + return psCalculateVolumeFromDistance(playerdist, dist1, dist2, dist3, arg6); } -s32 propsnd0f094940(s32 degrees, f32 arg1, struct audiochannel *channel) +s32 psCalculatePan3(s32 degrees, f32 arg1, struct pschannel *channel) { s32 result; @@ -1197,29 +1238,49 @@ s32 propsnd0f094940(s32 degrees, f32 arg1, struct audiochannel *channel) break; } + /** + * At this point, in sound modes other than surround, degrees is: + * + * 0 if sound is in front + * 90 if sound is on the right + * 0 if sound is behind + * -90 if sound is to the left + * + * ...and scaled between those for angles between, so effectively a pan value. + * + * For surround mode, degrees is: + * + * 0 if sound is in front + * 90 if sound is 45 degrees to the right + * 180/-180 if sound is behind + * -90 if sound is 45 degrees to the left + * + * So an actual degrees value but with weighting towards the front. + */ + if (degrees >= -90 && degrees <= 90) { - result = degrees * 0.7f + 64.0f; + result = AL_PAN_CENTER + degrees * 0.7f; } else { s32 v0; s32 dir = degrees > 0 ? 1 : -1; s32 absdegrees = ABS(degrees); - result = (s32) ((180 - absdegrees) * dir * 0.7f + 64.0f) + 128; + result = 128 + (s32) (AL_PAN_CENTER + (180 - absdegrees) * dir * 0.7f); } if (channel != NULL) { - channel->unk14 = degrees; + channel->degrees = degrees; channel->unk16 = 100.0f * arg1; } return result; } -s32 propsnd0f094b1c(struct coord *pos, s32 arg1, f32 arg2, struct audiochannel *channel) +s32 psCalculatePan2(struct coord *pos, s32 arg1, f32 arg2, struct pschannel *channel) { - s32 result = 64; + s32 result = AL_PAN_CENTER; u32 stack[4]; - s32 a0; + s32 degrees; f32 f2; if (PLAYERCOUNT() < 2) { @@ -1237,78 +1298,78 @@ s32 propsnd0f094b1c(struct coord *pos, s32 arg1, f32 arg2, struct audiochannel * f2 = atan2f(ABSF(sp3c), ABSF(sp38)); - if (!(sp3c >= 0.0f) || !(sp38 >= 0.0f)) { - if (sp3c >= 0.0f) { - f2 = M_PI - f2; - } else if (sp38 >= 0.0f) { - f2 = -f2; - } else { - f2 = -(M_PI - f2); - } + if (sp3c >= 0.0f && sp38 >= 0.0f) { + // empty + } else if (sp3c >= 0.0f) { + f2 = M_PI - f2; + } else if (sp38 >= 0.0f) { + f2 = -f2; + } else { + f2 = -(M_PI - f2); } - a0 = (f2 * 57.295776f); + degrees = f2 * 57.295776f; } else { - a0 = f2; + degrees = f2; } if (channel != NULL) { - channel->unk14 = a0; + channel->degrees = degrees; channel->unk16 = 100.0f * arg2; } - result = propsnd0f094940(a0, arg2, channel); + result = psCalculatePan3(degrees, arg2, channel); } return result; } -s32 propsnd0f094d78(struct coord *pos, f32 arg1, f32 arg2, f32 arg3, f32 arg4, bool arg5, struct audiochannel *channel) +s32 psCalculatePan(struct coord *pos, f32 dist1, f32 dist2, f32 dist3, f32 playerdist, bool arg5, struct pschannel *channel) { - s32 result = 0x40; + s32 result = AL_PAN_CENTER; - if (pos != NULL && arg4 > 0) { - if (arg1 < 0) { - arg1 = 400; + if (pos != NULL && playerdist > 0) { + if (dist1 < 0) { + dist1 = 400; } - if (arg2 < 0) { - arg2 = 2500; + if (dist2 < 0) { + dist2 = 2500; } - if (arg3 < 0) { - arg3 = 3000; + if (dist3 < 0) { + dist3 = 3000; } - if (arg4 < arg3) { - if (arg1 > 5501) { - arg1 = 5501; + if (playerdist < dist3) { + if (dist1 > 5501) { + dist1 = 5501; } - if (arg2 > 5801) { - arg2 = 5801; + if (dist2 > 5801) { + dist2 = 5801; } - if (arg5 != 0) { - if (!(arg4 < arg1)) { - if (arg4 < arg2) { - f32 f2 = (arg4 - arg1) / (arg2 - arg1); + if (arg5) { + if (playerdist < dist1) { + // empty + } else if (playerdist < dist2) { + f32 frac = (playerdist - dist1) / (dist2 - dist1); - if (f2 < 0) { - f2 = 0; - } - - if (f2 > 1) { - f2 = 1; - } - - result = propsnd0f094b1c(pos, 0, f2, channel); - } else { - result = propsnd0f094b1c(pos, 0, -1, NULL); + if (frac < 0) { + frac = 0; } + + if (frac > 1) { + frac = 1; + } + + result = psCalculatePan2(pos, 0, frac, channel); + } else { + result = psCalculatePan2(pos, 0, -1, NULL); } } else { - result = propsnd0f094b1c(pos, 0, -1, channel); + result = psCalculatePan2(pos, 0, -1, channel); } } } @@ -1317,109 +1378,108 @@ s32 propsnd0f094d78(struct coord *pos, f32 arg1, f32 arg2, f32 arg3, f32 arg4, b } #if VERSION >= VERSION_NTSC_1_0 -void propsnd0f094ef4(struct coord *pos, s16 *rooms, s16 soundnum, s32 *arg3, s32 *arg4) +/** + * If the given soundnum were to play at the given world position, calculate the + * final volume and pan and write them to the vol and pan pointers. + */ +void psGetTheoreticalVolPan(struct coord *pos, s16 *rooms, s16 soundnum, s32 *vol, s32 *pan) { - f32 sp5c; - f32 sp58; - f32 sp54; + f32 dist1; + f32 dist2; + f32 dist3; struct audiorussmapping *russ; struct audioconfig *config; union soundnumhack sp48; union soundnumhack sp44; - f32 sp40; + f32 distance; bool sp3c; s32 index; s32 confignum; - s32 zero = 0; + f32 *distanceptr = &distance; + + dist1 = 400; + dist2 = 2500; + dist3 = 3000; - sp5c = 400; - sp58 = 2500; - sp54 = 3000; - if (1); sp44.packed = soundnum; - sp40 = 9999999; + distance = 9999999; sp3c = false; - // To make this match, sp40 must be reloaded from the stack rather than - // reuse its register. Calling a function invalidates the register, thus - // forcing the compiler to emit code that reloads it from stack. Then an - // optimisation pass in the compiler removes this branch and function call, - // leaving the reload from stack in place. - if (zero) { - random(); - } - if (sp44.hasconfig) { confignum = sp44.confignum; russ = &g_AudioRussMappings[confignum]; index = russ->audioconfig_index; config = &g_AudioConfigs[index]; - sp5c = config->unk00; - sp58 = config->unk04; - sp54 = config->unk08; + + dist1 = config->dist1; + dist2 = config->dist2; + dist3 = config->dist3; + sp48.packed = russ->soundnum; if (config->flags & AUDIOCONFIGFLAG_01) { sp3c = true; } - if (sp54 < sp40) { - sp40 = sp54; + if (dist3 < *distanceptr) { + *distanceptr = dist3; } sp48.hasconfig = false; soundnum = sp48.packed; } - *arg3 = propsnd0f0946b0(pos, sp5c, sp58, sp54, rooms, soundnum, 0x7fff, &sp40); - *arg4 = propsnd0f094d78(pos, sp5c, sp58, sp54, sp40, sp3c, 0); + *vol = psCalculateVol(pos, dist1, dist2, dist3, rooms, soundnum, AL_VOL_FULL, distanceptr); + *pan = psCalculatePan(pos, dist1, dist2, dist3, *distanceptr, sp3c, 0); } #endif -void func0f09505c(struct sndstate *handle, struct coord *pos, f32 arg2, f32 arg3, f32 arg4, s16 *rooms, s16 soundnum, s32 arg7, f32 *arg8) +void psApplyVolPan(struct sndstate *handle, struct coord *pos, f32 dist1, f32 dist2, f32 dist3, s16 *rooms, s16 soundnum, s32 arg7, f32 *distanceptr) { union soundnumhack sp5c; union soundnumhack sp58; - f32 sp54; + f32 distance; bool sp50; - s32 sp4c; + s32 vol; s32 pan; sp50 = false; - sp54 = 9999999; + distance = 9999999; sp58.packed = soundnum; - if (arg8 == NULL) { - arg8 = &sp54; + if (distanceptr == NULL) { + distanceptr = &distance; } if (sp58.hasconfig) { s32 confignum = sp58.confignum; s32 index = g_AudioRussMappings[confignum].audioconfig_index; - arg2 = g_AudioConfigs[index].unk00; - arg3 = g_AudioConfigs[index].unk04; - arg4 = g_AudioConfigs[index].unk08; + dist1 = g_AudioConfigs[index].dist1; + dist2 = g_AudioConfigs[index].dist2; + dist3 = g_AudioConfigs[index].dist3; + sp5c.packed = g_AudioRussMappings[confignum].soundnum; if (g_AudioConfigs[index].flags & AUDIOCONFIGFLAG_01) { sp50 = true; } - if (arg4 < *arg8) { - *arg8 = arg4; + if (dist3 < *distanceptr) { + *distanceptr = dist3; } sp5c.hasconfig = false; soundnum = sp5c.packed; } - sp4c = propsnd0f0946b0(pos, arg2, arg3, arg4, rooms, soundnum, arg7, arg8); - pan = propsnd0f094d78(pos, arg2, arg3, arg4, *arg8, sp50, 0); - sndAdjust(&handle, sndIsMp3(soundnum), sp4c, pan, soundnum, 1.0f, 1, -1, 1); + vol = psCalculateVol(pos, dist1, dist2, dist3, rooms, soundnum, arg7, distanceptr); + pan = psCalculatePan(pos, dist1, dist2, dist3, *distanceptr, sp50, 0); + + sndAdjust(&handle, sndIsMp3(soundnum), vol, pan, soundnum, 1.0f, 1, -1, 1); } -s32 propsndGetRandomSparkSound(void) +s32 psGetRandomSparkSound(void) { s32 index = random() % 6; @@ -1435,17 +1495,17 @@ s32 propsndGetRandomSparkSound(void) return sounds[index]; } -u32 propsnd0f095258(u32 arg0, u32 arg1) +u32 ps0f095258(u32 arg0, u32 arg1) { return arg0; } -u32 propsnd0f095264(u32 arg0, u32 arg1) +u32 ps0f095264(u32 arg0, u32 arg1) { return arg0; } -void propsnd0f095270(void) +void ps0f095270(void) { // empty } @@ -1456,13 +1516,13 @@ void propsnd0f095270(void) * All MP3 files are 24 kilobits per second * so this is just math based on the filesize. */ -s32 propsndGetDuration60(s32 channelnum) +s32 psGetDuration60(s32 channelnum) { - struct audiochannel *channel = &g_AudioChannels[channelnum]; + struct pschannel *channel = &g_PsChannels[channelnum]; - if (channelnum >= 0 && channelnum < (IS4MB() ? 30 : 40) - && (channel->flags & AUDIOCHANNELFLAG_IDLE) == 0 - && (channel->flags & AUDIOCHANNELFLAG_ISMP3)) { + if (channelnum >= 0 && channelnum < CHANNELCOUNT() + && (channel->flags & PSFLAG_FREE) == 0 + && (channel->flags & PSFLAG_ISMP3)) { union soundnumhack soundnum; soundnum.packed = channel->soundnum26; diff --git a/src/game/propsndreset.c b/src/game/propsndreset.c index 1c972edb0..5049e8d40 100644 --- a/src/game/propsndreset.c +++ b/src/game/propsndreset.c @@ -5,15 +5,15 @@ #include "data.h" #include "types.h" -void propsndReset(void) +void psReset(void) { s32 i; - g_AudioChannels = mempAlloc(ALIGN16((IS4MB() ? 30 : 40) * sizeof(struct audiochannel)), MEMPOOL_STAGE); + g_PsChannels = mempAlloc(ALIGN16((IS4MB() ? 30 : 40) * sizeof(struct pschannel)), MEMPOOL_STAGE); for (i = 0; i < (IS4MB() ? 30 : 40); i++) { - g_AudioChannels[i].flags = AUDIOCHANNELFLAG_IDLE; - g_AudioChannels[i].audiohandle = NULL; - g_AudioChannels[i].unk4c = -1; + g_PsChannels[i].flags = PSFLAG_FREE; + g_PsChannels[i].audiohandle = NULL; + g_PsChannels[i].distance = -1; } } diff --git a/src/game/propsndstop.c b/src/game/propsndstop.c index 9333c343d..93f2df6a1 100644 --- a/src/game/propsndstop.c +++ b/src/game/propsndstop.c @@ -6,18 +6,18 @@ #include "data.h" #include "types.h" -void propsndStop(void) +void psStop(void) { s32 i; for (i = 0; i < (IS4MB() ? 30 : 40); i++) { - if (g_AudioChannels[i].flags & AUDIOCHANNELFLAG_ISMP3) { - snd0000fbc4(g_AudioChannels[i].soundnum26); - g_AudioChannels[i].flags &= ~AUDIOCHANNELFLAG_ISMP3; - g_AudioChannels[i].flags &= ~AUDIOCHANNELFLAG_0002; - } else if (g_AudioChannels[i].audiohandle && sndGetState(g_AudioChannels[i].audiohandle) != AL_STOPPED) { - audioStop(g_AudioChannels[i].audiohandle); - g_AudioChannels[i].flags &= ~AUDIOCHANNELFLAG_0002; + if (g_PsChannels[i].flags & PSFLAG_ISMP3) { + sndStopMp3(g_PsChannels[i].soundnum26); + g_PsChannels[i].flags &= ~PSFLAG_ISMP3; + g_PsChannels[i].flags &= ~PSFLAG_REPEATING; + } else if (g_PsChannels[i].audiohandle && sndGetState(g_PsChannels[i].audiohandle) != AL_STOPPED) { + audioStop(g_PsChannels[i].audiohandle); + g_PsChannels[i].flags &= ~PSFLAG_REPEATING; } } } diff --git a/src/game/shards.c b/src/game/shards.c index 5f1fc6dd8..b3235a352 100644 --- a/src/game/shards.c +++ b/src/game/shards.c @@ -79,8 +79,8 @@ void shardsCreate(struct coord *pos, f32 *rotx, f32 *roty, f32 *rotz, f32 relxmi basepos.z = (pos->f[2] + (relxmin + (speci >> 1)) * spcc[2]) + spc0[2] * (relymin + (speci >> 1)); if (type == SHARDTYPE_GLASS) { - propsnd0f0939f8(NULL, NULL, SFX_GLASS_SHATTER, -1, - -1, 0, 0, 0, &prop->pos, -1.0f, prop->rooms, -1, -1.0f, -1.0f, -1.0f); + psCreate(NULL, NULL, SFX_GLASS_SHATTER, -1, + -1, 0, 0, PSTYPE_NONE, &prop->pos, -1.0f, prop->rooms, -1, -1.0f, -1.0f, -1.0f); } else if (type == SHARDTYPE_BOTTLE) { /** * @bug: This attempts to play one of two bottle breaking sounds @@ -88,11 +88,11 @@ void shardsCreate(struct coord *pos, f32 *rotx, f32 *roty, f32 *rotz, f32 relxmi * when you shoot the bottles, half of them don't play any breaking * sound effect. */ - propsnd0f0939f8(NULL, NULL, SFX_BOTTLE_BREAK + (random() % 2) * 2, -1, - -1, 0, 0, 0, &prop->pos, -1.0f, prop->rooms, -1, -1.0f, -1.0f, -1.0f); + psCreate(NULL, NULL, SFX_BOTTLE_BREAK + (random() % 2) * 2, -1, + -1, 0, 0, PSTYPE_NONE, &prop->pos, -1.0f, prop->rooms, -1, -1.0f, -1.0f, -1.0f); } else if (type == SHARDTYPE_WOOD) { - propsnd0f0939f8(NULL, NULL, SFX_WOOD_BREAK, -1, - -1, 0, 0, 0, &prop->pos, -1.0f, prop->rooms, -1, -1.0f, -1.0f, -1.0f); + psCreate(NULL, NULL, SFX_WOOD_BREAK, -1, + -1, 0, 0, PSTYPE_NONE, &prop->pos, -1.0f, prop->rooms, -1, -1.0f, -1.0f, -1.0f); } xmax = f20 / speci; diff --git a/src/game/sight.c b/src/game/sight.c index e79bd8ef9..2785ab160 100644 --- a/src/game/sight.c +++ b/src/game/sight.c @@ -240,7 +240,7 @@ void sightTick(bool sighton) if (g_Vars.currentplayer->lookingatprop.prop != g_Vars.currentplayer->trackedprops[0].prop) { struct sndstate *handle; - handle = snd00010718(&handle, 0, 0x7fff, 0x40, 7, 1, 1, -1, 1); + handle = snd00010718(&handle, 0, AL_VOL_FULL, AL_PAN_CENTER, SFX_0007, 1, 1, -1, true); trackedprop = &g_Vars.currentplayer->trackedprops[0]; @@ -266,7 +266,7 @@ void sightTick(bool sighton) if (index >= 0) { struct sndstate *handle; - handle = snd00010718(&handle, 0, 0x7fff, 0x40, 7, 1, 1, -1, 1); + handle = snd00010718(&handle, 0, AL_VOL_FULL, AL_PAN_CENTER, SFX_0007, 1, 1, -1, 1); trackedprop = &g_Vars.currentplayer->trackedprops[index]; @@ -289,7 +289,7 @@ void sightTick(bool sighton) if (index >= 0) { struct sndstate *handle; - handle = snd00010718(&handle, 0, 0x7fff, 0x40, 7, 1, 1, -1, 1); + handle = snd00010718(&handle, 0, AL_VOL_FULL, AL_PAN_CENTER, SFX_0007, 1, 1, -1, 1); trackedprop = &g_Vars.currentplayer->trackedprops[index]; diff --git a/src/game/training.c b/src/game/training.c index 78ebbdca2..451676d99 100644 --- a/src/game/training.c +++ b/src/game/training.c @@ -896,8 +896,8 @@ bool frExecuteTargetScript(s32 targetnum) } else { if (g_FrNumSounds < 3) { g_FrNumSounds++; - propsnd0f0939f8(NULL, g_FrData.targets[targetnum].prop, SFX_FR_CONVEYER, -1, - -1, 0, 0, 0, 0, -1, 0, -1, -1, -1, -1); + psCreate(NULL, g_FrData.targets[targetnum].prop, SFX_FR_CONVEYER, -1, + -1, 0, 0, PSTYPE_NONE, 0, -1, 0, -1, -1, -1, -1); } g_FrData.targets[targetnum].travelspeed = script[offset + 2] / 60.0f * g_FrData.speed; @@ -949,7 +949,7 @@ void frHideAllTargets(void) target->flags2 |= OBJFLAG2_INVISIBLE; - func0f0926bc(prop, 1, 0xffff); + psStopSound(prop, PSTYPE_GENERAL, 0xffff); } } @@ -1684,7 +1684,7 @@ void frTick(void) && g_FrData.targets[i].silent == false && g_FrData.targets[i].travelling) { g_FrData.targets[i].silent = true; - func0f0926bc(g_FrData.targets[i].prop, 1, 0xffff); + psStopSound(g_FrData.targets[i].prop, PSTYPE_GENERAL, 0xffff); } } @@ -1714,7 +1714,7 @@ void frTick(void) for (i = 0; i < ARRAYCOUNT(g_FrData.targets); i++) { if (g_FrData.targets[i].prop) { - func0f0926bc(g_FrData.targets[i].prop, 1, 0xffff); + psStopSound(g_FrData.targets[i].prop, PSTYPE_GENERAL, 0xffff); } } @@ -1749,7 +1749,7 @@ void frTick(void) && g_FrData.targets[i].silent == false && g_FrData.targets[i].travelling) { g_FrData.targets[i].silent = true; - func0f0926bc(g_FrData.targets[i].prop, 1, 0xffff); + psStopSound(g_FrData.targets[i].prop, PSTYPE_GENERAL, 0xffff); } } @@ -1777,7 +1777,7 @@ void frTick(void) && g_FrData.targets[i].silent == false && g_FrData.targets[i].travelling) { g_FrData.targets[i].silent = true; - func0f0926bc(g_FrData.targets[i].prop, 1, 0xffff); + psStopSound(g_FrData.targets[i].prop, PSTYPE_GENERAL, 0xffff); } } return; @@ -1874,8 +1874,8 @@ void frTick(void) if (g_FrData.targets[i].travelling && g_FrData.targets[i].silent && g_FrData.targets[i].travelspeed != -1) { g_FrData.targets[i].silent = false; - propsnd0f0939f8(NULL, g_FrData.targets[i].prop, SFX_FR_CONVEYER, -1, - -1, 0, 0, 0, 0, -1, 0, -1, -1, -1, -1); + psCreate(NULL, g_FrData.targets[i].prop, SFX_FR_CONVEYER, -1, + -1, 0, 0, PSTYPE_NONE, 0, -1, 0, -1, -1, -1, -1); } if (g_FrData.targets[i].angle > 2.2915925979614f && g_FrData.targets[i].angle < 3.9915928840637f) { @@ -1909,7 +1909,7 @@ void frTick(void) if (g_FrNumSounds && g_FrData.targets[i].travelling) { g_FrNumSounds--; - func0f0926bc(prop, 1, 0xffff); + psStopSound(prop, PSTYPE_GENERAL, 0xffff); } if (g_FrNumSounds); @@ -2054,9 +2054,9 @@ void frTick(void) g_FrNumSounds--; } - func0f0926bc(prop, 1, 0xffff); - propsnd0f0939f8(NULL, prop, SFX_FR_CONVEYER_STOP, -1, - -1, 1024, 0, 0, 0, -1, 0, -1, -1, -1, -1); + psStopSound(prop, PSTYPE_GENERAL, 0xffff); + psCreate(NULL, prop, SFX_FR_CONVEYER_STOP, -1, + -1, PSFLAG_0400, 0, PSTYPE_NONE, 0, -1, 0, -1, -1, -1, -1); if (g_FrNumSounds); } @@ -2763,7 +2763,7 @@ void dtRestorePlayer(void) chr->chrflags |= CHRCFLAG_HIDDEN; - func0f0926bc(g_Vars.currentplayer->eyespy->prop, 1, 0xffff); + psStopSound(g_Vars.currentplayer->eyespy->prop, PSTYPE_GENERAL, 0xffff); g_Vars.currentplayer->devicesactive &= ~DEVICE_EYESPY; } diff --git a/src/game/weather.c b/src/game/weather.c index 337a57eb4..49161bfe4 100644 --- a/src/game/weather.c +++ b/src/game/weather.c @@ -1,5 +1,6 @@ #include #include "constants.h" +#include "../lib/naudio/n_sndp.h" #include "game/dlights.h" #include "game/tex.h" #include "game/camera.h" @@ -2776,7 +2777,7 @@ Gfx *weatherRenderRain(Gfx *gdl, struct weatherdata *weather, s32 arg2) } sndAdjust(&weather->audiohandles[3], 0, a2, -1, weather->unkf8, 1, 1, -1, 1); - audioPostEvent(weather->audiohandles[3], 0x10, *(s32 *)&sp174); + audioPostEvent(weather->audiohandles[3], AL_SNDP_PITCH_EVT, *(s32 *)&sp174); } } } diff --git a/src/include/commands.h b/src/include/commands.h index 72645bccd..a7c6eab38 100644 --- a/src/include/commands.h +++ b/src/include/commands.h @@ -1971,7 +1971,7 @@ * The channel argument should be a CHANNEL constant. * The bool argument should be TRUE to play or FALSE to stop. */ -#define control_sound_from_object(channel, object, bool) \ +#define set_object_sound_playing(channel, object, bool) \ mkshort(0x00cf), \ channel, \ object, \ @@ -1981,23 +1981,23 @@ /** * Plays a sound coming from the given pad. */ -#define play_sound_from_pad(pad, sound) \ +#define play_repeating_sound_from_pad(pad, sound) \ mkshort(0x00d0), \ 0x00, \ mkshort(pad), \ mkshort(sound), -#define cmd00d1(channel, audio_id, u1) \ +#define set_object_sound_volume(channel, volume, volchangetimer60) \ mkshort(0x00d1), \ channel, \ - mkshort(audio_id), \ - mkshort(u1), + mkshort(volume), \ + mkshort(volchangetimer60), -#define cmd00d2(channel, audio_id, u1) \ +#define set_object_sound_volume_by_distance(channel, distance, volchangetimer60) \ mkshort(0x00d2), \ channel, \ - mkshort(audio_id), \ - mkshort(u1), + mkshort(distance), \ + mkshort(volchangetimer60), /** * Stops the given audio channel. @@ -2008,10 +2008,13 @@ mkshort(0x00d3), \ channel, -#define cmd00d4(channel, u2, label) \ +/** + * Follows the label if the object's volume is less than the given volume. + */ +#define if_object_sound_volume_less_than(channel, volume, label) \ mkshort(0x00d4), \ channel, \ - mkshort(u2), \ + mkshort(volume), \ label, /** @@ -3291,17 +3294,17 @@ label, /** - * Play a sound from the given object. + * Play a sound from the given object repeatedly. * * Typically used to make terminals hum. */ -#define play_sound_from_object(channel, object, u1, u2, u3) \ +#define play_repeating_sound_from_object(channel, object, volchangetimer60, dist2, dist3) \ mkshort(0x016b), \ channel, \ object, \ - mkshort(u1), \ - mkshort(u2), \ - mkshort(u3), + mkshort(volchangetimer60), \ + mkshort(dist2), \ + mkshort(dist3), #define noop016c \ mkshort(0x016c), @@ -4280,16 +4283,15 @@ mkshort(distance / 10), \ label, -#define play_sound_from_object2(channel, object, sound, u1, u2) \ +#define play_sound_from_object2(channel, object, sound, type, flags) \ mkshort(0x01d9), \ channel, \ object, \ mkshort(sound), \ 0xff, \ 0xff, \ - u1, \ - 0x00, \ - u2, + type, \ + mkshort(flags), /** * Unsure exactly how this works. I think it replaces the main level theme with diff --git a/src/include/constants.h b/src/include/constants.h index 8123f873d..483e849b6 100644 --- a/src/include/constants.h +++ b/src/include/constants.h @@ -310,35 +310,12 @@ #define ATTACKFLAG_NOVERTICAL 0x0100 // don't aim up/down #define ATTACKFLAG_AIMATTARGET 0x0200 // aim/shoot at whatever is in the chr's `target` field -#define AUDIOCHANNELFLAG_IDLE 0x0001 -#define AUDIOCHANNELFLAG_0002 0x0002 -#define AUDIOCHANNELFLAG_FORPROP 0x0008 -#define AUDIOCHANNELFLAG_ISMP3 0x0010 -#define AUDIOCHANNELFLAG_0020 0x0020 -#define AUDIOCHANNELFLAG_0040 0x0040 -#define AUDIOCHANNELFLAG_0080 0x0080 -#define AUDIOCHANNELFLAG_FORHUDMSG 0x0200 -#define AUDIOCHANNELFLAG_0400 0x0400 -#define AUDIOCHANNELFLAG_0800 0x0800 -#define AUDIOCHANNELFLAG_1000 0x1000 -#define AUDIOCHANNELFLAG_2000 0x2000 -#define AUDIOCHANNELFLAG_4000 0x4000 -#define AUDIOCHANNELFLAG_8000 0x8000 - -#define AUDIOCHANNELFLAG2_0001 0x0001 -#define AUDIOCHANNELFLAG2_0002 0x0002 -#define AUDIOCHANNELFLAG2_0004 0x0004 -#define AUDIOCHANNELFLAG2_0010 0x0010 -#define AUDIOCHANNELFLAG2_OFFENSIVE 0x0020 -#define AUDIOCHANNELFLAG2_0040 0x0040 -#define AUDIOCHANNELFLAG2_0080 0x0080 - -#define AUDIOCONFIGFLAG_01 0x01 -#define AUDIOCONFIGFLAG_04 0x04 -#define AUDIOCONFIGFLAG_08 0x08 -#define AUDIOCONFIGFLAG_OFFENSIVE 0x10 -#define AUDIOCONFIGFLAG_20 0x20 -#define AUDIOCONFIGFLAG_40 0x40 +#define AUDIOCONFIGFLAG_01 0x01 +#define AUDIOCONFIGFLAG_RESPONDHELLO 0x04 +#define AUDIOCONFIGFLAG_08 0x08 +#define AUDIOCONFIGFLAG_OFFENSIVE 0x10 +#define AUDIOCONFIGFLAG_20 0x20 +#define AUDIOCONFIGFLAG_40 0x40 #define AWARD_MOSTSUICIDAL 0x00000001 #define AWARD_WHONEEDSAMMO 0x00000002 @@ -417,17 +394,17 @@ #define CASING_RIFLE 2 #define CASING_SHOTGUN 3 -#define CHANNEL_0 0 -#define CHANNEL_1 1 -#define CHANNEL_2 2 -#define CHANNEL_3 3 -#define CHANNEL_4 4 -#define CHANNEL_5 5 -#define CHANNEL_6 6 -#define CHANNEL_7 7 -#define CHANNEL_8 8 -#define CHANNEL_9 9 -#define CHANNEL_10 10 +#define CHANNEL_0 0 +#define CHANNEL_1 1 +#define CHANNEL_2 2 +#define CHANNEL_3 3 +#define CHANNEL_4 4 +#define CHANNEL_5 5 +#define CHANNEL_6 6 +#define CHANNEL_7 7 +#define CHANNEL_8 8 +#define CHANNEL_9 9 +#define CHANNEL_CUTSCENE 10 #define CHEAT_HURRICANEFISTS 0 #define CHEAT_CLOAKINGDEVICE 1 @@ -3405,6 +3382,42 @@ #define PROPTYPE_EXPLOSION 7 #define PROPTYPE_SMOKE 8 +#define PSFLAG_FREE 0x0001 +#define PSFLAG_REPEATING 0x0002 +#define PSFLAG_FORPROP 0x0008 +#define PSFLAG_ISMP3 0x0010 +#define PSFLAG_HASCONFIGPAN 0x0020 +#define PSFLAG_HASCONFIG 0x0040 +#define PSFLAG_CUTSCENE 0x0080 +#define PSFLAG_FORHUDMSG 0x0200 +#define PSFLAG_0400 0x0400 +#define PSFLAG_0800 0x0800 +#define PSFLAG_FIRSTTICK 0x1000 +#define PSFLAG_OUTOFRANGE 0x2000 +#define PSFLAG_CHANGINGPAN 0x4000 +#define PSFLAG_IGNOREROOMS 0x8000 + +#define PSFLAG2_RESPONDHELLO 0x0001 +#define PSFLAG2_MPPAUSABLE 0x0002 +#define PSFLAG2_PRINTABLE 0x0004 +#define PSFLAG2_0010 0x0010 +#define PSFLAG2_OFFENSIVE 0x0020 +#define PSFLAG2_0040 0x0040 +#define PSFLAG2_STOPPED 0x0080 + +#define PSTYPE_NONE 0 +#define PSTYPE_GENERAL 1 +#define PSTYPE_CHOPPERHUM1 5 +#define PSTYPE_CHOPPERHUM2 6 +#define PSTYPE_CHOPPERGUN 7 +#define PSTYPE_CHRTALK 9 +#define PSTYPE_MARKER 11 +#define PSTYPE_DOOR 12 +#define PSTYPE_CHRCHOKE 13 +#define PSTYPE_COMMHUB 15 +#define PSTYPE_FOOTSTEP 16 +#define PSTYPE_CHRSHOOT 17 + #define QUADRANT_BACK 0x01 #define QUADRANT_SIDE1 0x02 #define QUADRANT_SIDE2 0x04 diff --git a/src/include/data.h b/src/include/data.h index 5378c4bc3..b7f2a7000 100644 --- a/src/include/data.h +++ b/src/include/data.h @@ -35,7 +35,7 @@ extern bool g_MainIsDebugMenuOpen; extern bool g_SndDisabled; extern u16 g_SfxVolume; extern s32 g_SoundMode; -extern s32 var8005ddd4; +extern s32 g_SndNumPlaying; extern struct audiorussmapping g_AudioRussMappings[]; extern struct audioconfig g_AudioConfigs[]; extern bool var8005eedc; @@ -226,7 +226,7 @@ extern struct prop *g_Lifts[10]; extern u32 g_TvCmdlist00[]; extern u32 var8006aaa0[]; extern u32 var8006aae4[]; -extern struct audiochannel *g_AudioChannels; +extern struct pschannel *g_PsChannels; extern s8 var8006ae18; extern s8 var8006ae1c; extern s8 var8006ae20; diff --git a/src/include/game/bondgun.h b/src/include/game/bondgun.h index 0398b0935..ef20e2aae 100644 --- a/src/include/game/bondgun.h +++ b/src/include/game/bondgun.h @@ -143,7 +143,7 @@ void bgunRender(Gfx **gdl); struct sndstate **bgunAllocateAudioHandle(void); void bgunPlayPropHitSound(struct gset *gset, struct prop *prop, s32 texturenum); void bgunPlayGlassHitSound(struct coord *pos, s16 *rooms, s32 texturenum); -void bgunPlayBgHitSound(struct gset *gset, struct coord *hitpos, s32 texturenum, s16 *arg3); +void bgunPlayBgHitSound(struct gset *gset, struct coord *hitpos, s32 texturenum, s16 *rooms); void bgunSetTriggerOn(s32 handnum, bool on); s32 bgunConsiderToggleGunFunction(s32 usedowntime, bool trigpressed, bool fromactivemenu); void bgun0f0a8c50(void); diff --git a/src/include/game/chraicommands.h b/src/include/game/chraicommands.h index 4e67a0d8e..5d3818680 100644 --- a/src/include/game/chraicommands.h +++ b/src/include/game/chraicommands.h @@ -210,12 +210,12 @@ /*0x00cc*/ bool aiShowHudmsgTopMiddle(void); /*0x00cd*/ bool aiSpeak(void); /*0x00ce*/ bool aiPlaySound(void); -/*0x00cf*/ bool ai00cf(void); -/*0x00d0*/ bool ai00d0(void); -/*0x00d1*/ bool ai00d1(void); -/*0x00d2*/ bool ai00d2(void); +/*0x00cf*/ bool aiSetObjectSoundPlaying(void); +/*0x00d0*/ bool aiPlayRepeatingSoundFromPad(void); +/*0x00d1*/ bool aiSetObjectSoundVolume(void); +/*0x00d2*/ bool aiSetObjectSoundVolumeByDistance(void); /*0x00d3*/ bool aiAudioMuteChannel(void); -/*0x00d4*/ bool ai00d4(void); +/*0x00d4*/ bool aiIfObjectSoundVolumeLessThan(void); /*0x00d5*/ bool aiHovercarBeginPath(void); /*0x00d6*/ bool aiSetVehicleSpeed(void); /*0x00d7*/ bool aiSetRotorSpeed(void); @@ -311,7 +311,7 @@ /*0x0135*/ bool aiIfHasOrders(void); /*0x0136*/ bool aiRetreat(void); /*0x0137*/ bool aiIfChrInSquadronDoingAction(void); -/*0x0138*/ bool aiIfChannelIdle(void); +/*0x0138*/ bool aiIfChannelFree(void); /*0x0139*/ bool ai0139(void); /*0x013a*/ bool aiSetChrPresetToUnalertedTeammate(void); /*0x013b*/ bool aiSetSquadron(void); @@ -341,7 +341,7 @@ /*0x0168*/ bool aiIfShieldDamaged(void); /*0x0169*/ bool aiIfNaturalAnim(void); /*0x016a*/ bool aiIfY(void); -/*0x016b*/ bool ai016b(void); +/*0x016b*/ bool aiPlayRepeatingSoundFromObject(void); /*0x016c*/ bool aiNoOp016c(void); /*0x016d*/ bool aiChrAdjustMotionBlur(void); /*0x016e*/ bool aiDamageChrByAmount(void); @@ -355,7 +355,7 @@ /*0x0176*/ bool aiIfBotRespawning(void); /*0x0177*/ bool aiPlayerAutoWalk(void); /*0x0178*/ bool aiIfPlayerAutoWalkFinished(void); -/*0x0179*/ bool ai0179(void); +/*0x0179*/ bool aiPlaySoundFromEntity(void); /*0x017a*/ bool aiIfLosToAttackTarget(void); /*0x017b*/ bool aiIfChrKnockedOut(void); /*0x017c*/ bool aiAssignSound(void); diff --git a/src/include/game/propobj.h b/src/include/game/propobj.h index 7b0c009c0..ba17e8f0f 100644 --- a/src/include/game/propobj.h +++ b/src/include/game/propobj.h @@ -18,7 +18,6 @@ extern struct beam *g_ThrownLaptopBeams; void alarmActivate(void); void alarmDeactivate(void); bool alarmIsActive(void); -s32 audioPlayFromProp(s32 channelnum, s16 soundnum, s32 arg2, struct prop *prop, s16 arg4, u16 arg5); f32 countdownTimerGetValue60(void); bool countdownTimerIsVisible(void); bool countdownTimerIsRunning(void); diff --git a/src/include/game/propsnd.h b/src/include/game/propsnd.h index 2e9a236c9..f08196bf5 100644 --- a/src/include/game/propsnd.h +++ b/src/include/game/propsnd.h @@ -4,34 +4,35 @@ #include "data.h" #include "types.h" -void propsndReset(void); +void psReset(void); -void propsndStop(void); +void psStop(void); -bool func0f092610(struct prop *prop, s32 arg1); -void func0f0926bc(struct prop *prop, s32 arg1, u16 arg2); -s32 func0f0927d4(f32 arg0, f32 arg1, f32 arg2, f32 arg3, s32 arg4); -s32 channelGetUnk06(s32 channelnum); -void propsnd0f09294c(struct prop *prop, s16 soundnum, s32 arg2); -void func0f092a98(s32 channelnum); -void propsndPrintChannel(struct audiochannel *channel); -s32 propsndGetSubtitleOpacity(s32 channelnum); -void propsndTickChannel(s32 channelnum); -void propsndTick(void); -void func0f093630(struct prop *prop, f32 arg1, s32 arg2); -void func0f093790(struct prop *prop, s32 arg1); -void func0f0938ec(struct prop *prop); -s16 propsnd0f0939f8(struct audiochannel *channel, struct prop *prop, s16 soundnum, s16 padnum, s32 arg4, u16 flags, u16 flags2, s32 arg7, struct coord *pos, f32 arg9, s16 *rooms, s32 room, f32 arg12, f32 arg13, f32 arg14); -void audioMuteChannel(s32 channelnum); -bool audioIsChannelIdle(s32 channelnum); -void audioPlayFromProp2(s32 channelnum, s32 arg1, s16 padnum, struct prop *prop, s32 arg4, s32 arg5, s32 arg6, u16 arg7); -s32 propsnd0f0946b0(struct coord *pos, f32 arg1, f32 arg2, f32 arg3, s16 *rooms, s16 soundnum, s32 arg6, f32 *arg7); -s32 propsnd0f094940(s32 degrees, f32 arg1, struct audiochannel *channel); -s32 propsnd0f094b1c(struct coord *pos, s32 arg1, f32 arg2, struct audiochannel *channel); -s32 propsnd0f094d78(struct coord *pos, f32 arg1, f32 arg2, f32 arg3, f32 arg4, bool arg5, struct audiochannel *channel); -void propsnd0f094ef4(struct coord *pos, s16 *rooms, s16 soundnum, s32 *arg3, s32 *arg4); -void func0f09505c(struct sndstate *handle, struct coord *pos, f32 arg2, f32 arg3, f32 arg4, s16 *rooms, s16 soundnum, s32 arg7, f32 *arg8); -s32 propsndGetRandomSparkSound(void); -s32 propsndGetDuration60(s32 channelnum); +bool psPropHasSoundWithContext(struct prop *prop, s32 type); +void psStopSound(struct prop *prop, s32 type, u16 flags); +s32 psCalculateVolumeFromDistance(f32 playerdist, f32 dist1, f32 dist2, f32 dist3, s32 fullvolume); +s32 psGetVolume(s32 channelnum); +void psCreateIfNotDupe(struct prop *prop, s16 soundnum, s32 type); +void psStopChannel(s32 channelnum); +void psPrintChannel(struct pschannel *channel); +s32 psGetSubtitleOpacity(s32 channelnum); +void psTickChannel(s32 channelnum); +void psTick(void); +void psSetPitch(struct prop *prop, f32 targetpitch, s32 changespeed); +void psSetVolume(struct prop *prop, s32 vol); +void psStopOneShootChannel(struct prop *prop); +s16 psCreate(struct pschannel *channel, struct prop *prop, s16 soundnum, s16 padnum, s32 vol, u16 flags, u16 flags2, s32 type, struct coord *pos, f32 pitch, s16 *rooms, s32 room, f32 dist1, f32 dist2, f32 dist3); +s32 psPlayFromProp(s32 channelnum, s16 soundnum, s32 vol, struct prop *prop, s16 type, u16 flags); +void psMuteChannel(s32 channelnum); +bool psIsChannelFree(s32 channelnum); +void psModify(s32 channelnum, s32 arg1, s16 padnum, struct prop *prop, s32 volchangetimer60, s32 dist2, s32 dist3, u16 flags); +s32 psCalculateVol(struct coord *pos, f32 arg1, f32 arg2, f32 arg3, s16 *rooms, s16 soundnum, s32 arg6, f32 *arg7); +s32 psCalculatePan3(s32 degrees, f32 arg1, struct pschannel *channel); +s32 psCalculatePan2(struct coord *pos, s32 arg1, f32 arg2, struct pschannel *channel); +s32 psCalculatePan(struct coord *pos, f32 dist1, f32 dist2, f32 dist3, f32 playerdist, bool arg5, struct pschannel *channel); +void psGetTheoreticalVolPan(struct coord *pos, s16 *rooms, s16 soundnum, s32 *vol, s32 *pan); +void psApplyVolPan(struct sndstate *handle, struct coord *pos, f32 dist1, f32 dist2, f32 dist3, s16 *rooms, s16 soundnum, s32 arg7, f32 *distanceptr); +s32 psGetRandomSparkSound(void); +s32 psGetDuration60(s32 channelnum); #endif diff --git a/src/include/lib/snd.h b/src/include/lib/snd.h index a2e6d2194..0b96846c3 100644 --- a/src/include/lib/snd.h +++ b/src/include/lib/snd.h @@ -22,7 +22,7 @@ ALSound *sndLoadSound(s16 soundnum); void seqInit(struct seqinstance *seq); void sndInit(void); bool sndIsMp3(s16 soundnum); -bool snd0000fbc4(s16 arg0); +bool sndStopMp3(s16 arg0); bool seqPlay(struct seqinstance *seq, s32 tracknum); u16 seqGetVolume(struct seqinstance *seq); void seqSetVolume(struct seqinstance *seq, u16 volume); @@ -32,10 +32,10 @@ void snd0000fe50(void); void sndTick(void); bool sndIsDisabled(void); void sndStartMp3ByFilenum(u32 filenum); -void sndAdjust(struct sndstate **handle, s32 arg1, s32 arg2, s32 pan, s32 soundnum, f32 arg5, s32 arg6, s32 arg7, s32 arg8); -struct sndstate *snd00010718(struct sndstate **handle, s32 arg1, s32 arg2, s32 arg3, s32 arg4, f32 arg5, s32 arg6, s32 arg7, s32 arg8); -struct sndstate *sndStart(s32 arg0, s16 sound, struct sndstate **handle, s32 arg3, s32 arg4, f32 arg5, s32 arg6, s32 arg7); -void sndStartMp3(s16 soundnum, s32 arg1, s32 arg2, s32 arg3); +void sndAdjust(struct sndstate **handle, bool ismp3, s32 vol, s32 pan, s32 soundnum, f32 pitch, s32 fxbus, s32 fxmix, bool forcefxmix); +struct sndstate *snd00010718(struct sndstate **handle, s32 flags, s32 volume, s32 pan, s32 soundnum, f32 pitch, s32 fxbus, s32 fxmix, bool forcefxmix); +struct sndstate *sndStart(s32 arg0, s16 sound, struct sndstate **handle, s32 volume, s32 pan, f32 pitch, s32 fxbus, s32 fxmix); +void sndStartMp3(s16 soundnum, s32 volume, s32 pan, s32 responseflags); void sndPlayNosedive(s32 seconds); void sndStopNosedive(void); void sndTickNosedive(void); diff --git a/src/include/types.h b/src/include/types.h index 9deda7216..55780499e 100644 --- a/src/include/types.h +++ b/src/include/types.h @@ -3445,13 +3445,13 @@ struct audiorussmapping { }; struct audioconfig { - f32 unk00; - f32 unk04; - f32 unk08; - f32 unk0c; - s32 unk10; - s32 unk14; - u32 unk18; + f32 dist1; // full volume within dist1 + f32 dist2; // dist1 to dist2 -> taper volume using curve + f32 dist3; // dist2 to dist3 -> scale volume linearly to zero + f32 pitch; + s32 volpercentage; + s32 pan; + s32 volchangespeed; u32 flags; }; @@ -5610,37 +5610,37 @@ struct shard { /*0x68*/ u8 type; }; -struct audiochannel { +struct pschannel { /*0x00*/ struct sndstate *audiohandle; - /*0x04*/ s16 unk04; - /*0x06*/ s16 unk06; - /*0x08*/ s16 unk08; - /*0x0a*/ s16 unk0a; - /*0x0c*/ s16 unk0c; - /*0x0e*/ s16 unk0e; - /*0x10*/ s16 unk10; - /*0x12*/ u16 unk12; - /*0x14*/ s16 unk14; + /*0x04*/ s16 targetvol; + /*0x06*/ s16 currentvol; + /*0x08*/ s16 currentpan; + /*0x0a*/ s16 targetpan; + /*0x0c*/ s16 targetfx; + /*0x0e*/ s16 currentfx; + /*0x10*/ s16 vol10; + /*0x12*/ s16 vol12; + /*0x14*/ s16 degrees; /*0x16*/ s16 unk16; - /*0x18*/ s16 unk18; - /*0x1a*/ u8 unk1a; - /*0x1c*/ s32 unk1c; - /*0x20*/ s32 unk20; + /*0x18*/ s16 volchangespeed; + /*0x1a*/ u8 fxbus; + /*0x1c*/ s32 volchangetimer60; + /*0x20*/ s32 pitchchangespeed; /*0x24*/ s16 padnum; /*0x26*/ s16 soundnum26; - /*0x28*/ s16 unk28; - /*0x2a*/ u16 unk2a; - /*0x2c*/ s16 unk2c; + /*0x28*/ s16 type; + /*0x2a*/ u16 unk2a; // unused + /*0x2c*/ s16 soundnum2c; /*0x2e*/ s16 channelnum; /*0x30*/ u16 flags; /*0x32*/ u16 flags2; - /*0x34*/ f32 unk34; - /*0x38*/ f32 unk38; - /*0x3c*/ f32 unk3c; - /*0x40*/ f32 unk40; - /*0x44*/ f32 unk44; - /*0x48*/ f32 unk48; - /*0x4c*/ f32 unk4c; + /*0x34*/ f32 dist1; // full volume within dist1 + /*0x38*/ f32 dist2; // dist1 to dist2 -> taper volume using curve + /*0x3c*/ f32 dist3; // dist2 to dist3 -> scale volume linearly to zero + /*0x40*/ f32 unk40; // unused + /*0x44*/ f32 targetpitch; + /*0x48*/ f32 currentpitch; + /*0x4c*/ f32 distance; /*0x50*/ struct prop *prop; /*0x54*/ struct coord *posptr; /*0x58*/ struct coord pos; diff --git a/src/lib/naudio/n_csplayer.c b/src/lib/naudio/n_csplayer.c index 9eaf4c694..cc534816d 100644 --- a/src/lib/naudio/n_csplayer.c +++ b/src/lib/naudio/n_csplayer.c @@ -609,7 +609,7 @@ void __n_CSPHandleMIDIMsg(N_ALCSPlayer *seqp, N_ALEvent *event) sp90 = inst->tremType; } - oscValue = (f32)AL_VOL_FULL; /* set this as a default */ + oscValue = (f32)_AL_VOL_FULL; /* set this as a default */ if (sp90) { if (seqp->initOsc) { diff --git a/src/lib/naudio/n_seqplayer.c b/src/lib/naudio/n_seqplayer.c index d4e816191..0e64567ed 100644 --- a/src/lib/naudio/n_seqplayer.c +++ b/src/lib/naudio/n_seqplayer.c @@ -302,7 +302,7 @@ void __n_resetPerfChanState(N_ALSeqPlayer *seqp, s32 chan) seqp->chanState[chan].fxId = AL_FX_NONE; seqp->chanState[chan].fxmix = AL_DEFAULT_FXMIX; seqp->chanState[chan].pan = AL_PAN_CENTER; - seqp->chanState[chan].vol = AL_VOL_FULL; + seqp->chanState[chan].vol = _AL_VOL_FULL; seqp->chanState[chan].priority = AL_DEFAULT_PRIORITY; seqp->chanState[chan].sustain = 0; seqp->chanState[chan].bendRange = 200; diff --git a/src/lib/naudio/n_sndplayer.c b/src/lib/naudio/n_sndplayer.c index 57a71e856..82f4fdbac 100644 --- a/src/lib/naudio/n_sndplayer.c +++ b/src/lib/naudio/n_sndplayer.c @@ -339,7 +339,7 @@ void _n_handleEvent(N_ALSndpEvent *event) if (state->state == AL_PLAYING) { tmppan = state->pan - AL_PAN_CENTER + sound->samplePan; - pan = MIN(MAX(tmppan, 0), 127); + pan = MIN(MAX(tmppan, AL_PAN_LEFT), AL_PAN_RIGHT); n_alSynSetPan(&state->voice, pan); } diff --git a/src/lib/snd.c b/src/lib/snd.c index 12e77e21c..edca566ea 100644 --- a/src/lib/snd.c +++ b/src/lib/snd.c @@ -5,6 +5,7 @@ #include "game/lv.h" #include "game/music.h" #include "bss.h" +#include "naudio/n_sndp.h" #include "lib/rzip.h" #include "lib/args.h" #include "lib/audiomgr.h" @@ -65,13 +66,13 @@ s32 g_SndUfoDuration240 = 0; struct sndstate *g_SndNosediveHandle = NULL; struct sndstate *g_SndUfoHandle = NULL; -u16 g_SfxVolume = 32767; +u16 g_SfxVolume = AL_VOL_FULL; s32 g_SoundMode = (VERSION >= VERSION_NTSC_1_0 ? SOUNDMODE_STEREO : SOUNDMODE_SURROUND); bool g_SndMp3Enabled = false; #if VERSION >= VERSION_NTSC_1_0 -s32 var8005ddd4 = 0; -s32 var8005ddd8 = 0; +s32 g_SndNumPlaying = 0; +s32 g_SndMostEverPlaying = 0; s32 var8005dddc = 0; #endif @@ -688,7 +689,7 @@ struct audioconfig g_AudioConfigs[] = { { /*57*/ 50, 180, 250, -1, 100, -1, 200, AUDIOCONFIGFLAG_01 }, { /*58*/ 100, 400, 600, -1, 100, -1, 200, AUDIOCONFIGFLAG_01 }, { /*59*/ 700, 1100, 1400, -1, 100, -1, 200, AUDIOCONFIGFLAG_01 }, - { /*60*/ 400, 2500, 3000, -1, 100, -1, 0, AUDIOCONFIGFLAG_04 }, + { /*60*/ 400, 2500, 3000, -1, 100, -1, 0, AUDIOCONFIGFLAG_RESPONDHELLO }, #if VERSION >= VERSION_NTSC_1_0 { /*61*/ 300, 900, 1100, -1, 100, -1, 0, 0 }, { /*62*/ 1000, 2500, 3000, -1, 100, -1, 0, AUDIOCONFIGFLAG_08 }, @@ -1563,7 +1564,7 @@ bool sndIsMp3(s16 soundnum) return tmp.mp3priority != 0; } -bool snd0000fbc4(s16 arg0) +bool sndStopMp3(s16 arg0) { if (!g_SndDisabled && g_SndMp3Enabled) { if (func00037ea4() && g_SndCurMp3.unk08 != 0) { @@ -1660,7 +1661,7 @@ bool seqPlay(struct seqinstance *seq, s32 tracknum) u16 seqGetVolume(struct seqinstance *seq) { - return g_SndDisabled ? 0x7fff : seq->volume; + return g_SndDisabled ? AL_VOL_FULL : seq->volume; } void seqSetVolume(struct seqinstance *seq, u16 volume) @@ -1671,8 +1672,8 @@ void seqSetVolume(struct seqinstance *seq, u16 volume) seq->volume = volume; - if (tmp > 0x7fff) { - tmp = 0x7fff; + if (tmp > AL_VOL_FULL) { + tmp = AL_VOL_FULL; } n_alCSPSetVol(seq->seqp, tmp); @@ -1719,7 +1720,7 @@ void sndTick(void) s32 stack; #if VERSION >= VERSION_NTSC_1_0 - static s32 var8005edec = -1; + static s32 g_SndMostEverPlaying2 = -1; sndIncrementAges(); @@ -1729,14 +1730,14 @@ void sndTick(void) curtime = sndpGetCurTime(); state = sndpGetHeadState(); - var8005ddd4 = 0; + g_SndNumPlaying = 0; i = 0; while (state) { stateptrs[i] = state; states[i] = *state; - var8005ddd4++; + g_SndNumPlaying++; if ((state->flags & SNDSTATEFLAG_02) == 0 && stateptrs[i]->state == AL_PLAYING @@ -1753,12 +1754,12 @@ void sndTick(void) osSetThreadPri(0, prevpri); - if (var8005ddd8 < var8005ddd4) { - var8005ddd8 = var8005ddd4; + if (g_SndNumPlaying > g_SndMostEverPlaying) { + g_SndMostEverPlaying = g_SndNumPlaying; } - if (var8005edec != var8005ddd8) { - var8005edec = var8005ddd8; + if (g_SndMostEverPlaying != g_SndMostEverPlaying2) { + g_SndMostEverPlaying2 = g_SndMostEverPlaying; } #endif @@ -1927,27 +1928,27 @@ bool sndIsFiltered(s32 audio_id) return false; } -void sndAdjust(struct sndstate **handle, s32 arg1, s32 arg2, s32 pan, s32 soundnum, f32 arg5, s32 arg6, s32 arg7, s32 arg8) +void sndAdjust(struct sndstate **handle, bool ismp3, s32 vol, s32 pan, s32 soundnum, f32 pitch, s32 fxbus, s32 fxmixarg, bool forcefxmix) { - s32 sp24 = -1; + s32 fxmix = -1; union soundnumhack sp20; union soundnumhack sp1c; struct audioconfig *config; - if (arg8 || arg7 != -1) { - if (arg7 != -1) { - sp24 = arg7; + if (forcefxmix || fxmixarg != -1) { + if (fxmixarg != -1) { + fxmix = fxmixarg; } else { - sp24 = 0; + fxmix = 0; } #if VERSION >= VERSION_NTSC_1_0 if (pan != -1 && g_SoundMode == SOUNDMODE_SURROUND && (pan & 0x80)) { - sp24 += 128; + fxmix += 128; } #else if (g_SoundMode == SOUNDMODE_SURROUND && (pan & 0x80)) { - sp24 += 128; + fxmix += 128; } #endif } @@ -1965,24 +1966,24 @@ void sndAdjust(struct sndstate **handle, s32 arg1, s32 arg2, s32 pan, s32 soundn config = &g_AudioConfigs[index]; - if (config->unk10 != 100) { - arg2 = arg2 * config->unk10 / 100; + if (config->volpercentage != 100) { + vol = vol * config->volpercentage / 100; } - if (config->unk14 != -1) { - pan = config->unk14; + if (config->pan != -1) { + pan = config->pan; } if (g_Vars.langfilteron && (config->flags & AUDIOCONFIGFLAG_OFFENSIVE)) { - arg2 = 0; + vol = 0; } } } - if (arg1 != 0) { - if (arg2 != -1) { - arg2 = arg2 * snd0000e9dc() / 32767; - func00037f08(arg2, true); + if (ismp3) { + if (vol != -1) { + vol = vol * snd0000e9dc() / AL_VOL_FULL; + func00037f08(vol, true); } if (pan != -1) { @@ -1991,28 +1992,28 @@ void sndAdjust(struct sndstate **handle, s32 arg1, s32 arg2, s32 pan, s32 soundn } if (*handle != NULL) { - if (arg2 != -1) { - audioPostEvent(*handle, 8, arg2); + if (vol != -1) { + audioPostEvent(*handle, AL_SNDP_VOL_EVT, vol); } if (pan != -1) { - audioPostEvent(*handle, 4, pan & 0x7f); + audioPostEvent(*handle, AL_SNDP_PAN_EVT, pan & 0x7f); } - if (arg5 != -1.0f) { - audioPostEvent(*handle, 0x10, *(s32 *)&arg5); + if (pitch != -1.0f) { + audioPostEvent(*handle, AL_SNDP_PITCH_EVT, *(s32 *)&pitch); } - if (sp24 != -1) { - audioPostEvent(*handle, 0x100, sp24); + if (fxmix != -1) { + audioPostEvent(*handle, AL_SNDP_FX_EVT, fxmix); } } } -struct sndstate *snd00010718(struct sndstate **handle, s32 arg1, s32 arg2, s32 arg3, s32 arg4, f32 arg5, s32 arg6, s32 arg7, s32 arg8) +struct sndstate *snd00010718(struct sndstate **handle, s32 flags, s32 volume, s32 pan, s32 soundnum, f32 pitch, s32 fxbus, s32 fxmixarg, bool forcefxmix) { OSPri prevpri = osGetThreadPri(NULL); - s32 t0 = -1; + s32 fxmix = -1; struct sndstate *state; union soundnumhack sp30; union soundnumhack sp2c; @@ -2020,26 +2021,26 @@ struct sndstate *snd00010718(struct sndstate **handle, s32 arg1, s32 arg2, s32 a osSetThreadPri(0, osGetThreadPri(&g_AudioManager.thread) + 1); - if (arg8 || arg7 != -1) { - if (arg7 != -1) { - t0 = arg7; + if (forcefxmix || fxmixarg != -1) { + if (fxmixarg != -1) { + fxmix = fxmixarg; } else { - t0 = 0; + fxmix = 0; } #if VERSION >= VERSION_NTSC_1_0 - if (arg3 != -1 && g_SoundMode == SOUNDMODE_SURROUND && (arg3 & 0x80)) { - t0 += 128; + if (pan != -1 && g_SoundMode == SOUNDMODE_SURROUND && (pan & 0x80)) { + fxmix += 128; } #else - if (g_SoundMode == SOUNDMODE_SURROUND && (arg3 & 0x80)) { - t0 += 128; + if (g_SoundMode == SOUNDMODE_SURROUND && (pan & 0x80)) { + fxmix += 128; } #endif } - if (arg4) { - sp30.packed = arg4; + if (soundnum) { + sp30.packed = soundnum; if (sp30.hasconfig) { s32 index = g_AudioRussMappings[sp30.confignum].audioconfig_index; @@ -2047,48 +2048,46 @@ struct sndstate *snd00010718(struct sndstate **handle, s32 arg1, s32 arg2, s32 a sp2c.packed = g_AudioRussMappings[sp30.confignum].soundnum; sp2c.hasconfig = false; - arg4 = sp2c.packed; + soundnum = sp2c.packed; config = &g_AudioConfigs[index]; - if (config->unk10 != 100) { - arg2 = arg2 * config->unk10 / 100; + if (config->volpercentage != 100) { + volume = volume * config->volpercentage / 100; } - if (config->unk14 != -1) { - arg3 = config->unk14; + if (config->pan != -1) { + pan = config->pan; } if (g_Vars.langfilteron && (config->flags & AUDIOCONFIGFLAG_OFFENSIVE)) { - arg2 = 0; + volume = 0; } } } - state = sndStart(var80095200, arg4, handle, arg2, arg3, arg5, arg6, t0); + state = sndStart(var80095200, soundnum, handle, volume, pan, pitch, fxbus, fxmix); osSetThreadPri(0, prevpri); return state; } -struct sndstate *sndStart(s32 arg0, s16 sound, struct sndstate **handle, s32 arg3, s32 arg4, f32 arg5, s32 arg6, s32 arg7) +struct sndstate *sndStart(s32 arg0, s16 sound, struct sndstate **handle, s32 volumearg, s32 panarg, f32 pitcharg, s32 fxbusarg, s32 fxmixarg) { union soundnumhack sp44; union soundnumhack sp40; - u8 sp3f; - u8 sp3e; - u8 sp3d; - u8 sp3c; - u16 sp3a; - u16 sp38; - f32 sp34; + u8 fxmix; + u8 fxbus; + u8 pan; + u16 volume; + f32 pitch; - sp3f = arg7 != -1 ? arg7 : 0; - sp3e = arg6 != -1 ? arg6 : 1; - sp3d = arg4 != -1 ? arg4 : 64; - sp3a = arg3 != -1 ? arg3 : 0x7fff; - sp34 = arg5 > 0.0f ? arg5 : 1.0f; + fxmix = fxmixarg != -1 ? fxmixarg : 0; + fxbus = fxbusarg != -1 ? fxbusarg : 1; + pan = panarg != -1 ? panarg : AL_PAN_CENTER; + volume = volumearg != -1 ? volumearg : AL_VOL_FULL; + pitch = pitcharg > 0.0f ? pitcharg : 1.0f; sp44.packed = sound; @@ -2103,7 +2102,7 @@ struct sndstate *sndStart(s32 arg0, s16 sound, struct sndstate **handle, s32 arg } if (sndIsMp3(sp40.packed)) { - sndStartMp3(sp40.packed, sp3a, sp3d, 0); + sndStartMp3(sp40.packed, volume, pan, 0); if (handle != NULL) { *handle = NULL; @@ -2114,12 +2113,12 @@ struct sndstate *sndStart(s32 arg0, s16 sound, struct sndstate **handle, s32 arg #if VERSION >= VERSION_NTSC_1_0 if (sp40.id < (u32)g_NumSounds) { - return func00033820(arg0, sp40.id, sp3a, sp3d & 0x7f, sp34, sp3f, IS4MB() ? 0 : sp3e, handle); + return func00033820(arg0, sp40.id, volume, pan & 0x7f, pitch, fxmix, IS4MB() ? 0 : fxbus, handle); } return NULL; #else - return func00033820(arg0, sp40.id, sp3a, sp3d & 0x7f, sp34, sp3f, IS4MB() ? 0 : sp3e, handle); + return func00033820(arg0, sp40.id, volume, pan & 0x7f, pitch, fxmix, IS4MB() ? 0 : fxbus, handle); #endif } @@ -2133,7 +2132,7 @@ const char var70053c10[] = "Snd_Play_Mpeg : SYSTEM IS DISABLED\n"; const char var70053c34[] = "Snd_Play_Mpeg : Lib called -> Adr=%x\n"; const char var70053c5c[] = "Snd_Play_Mpeg : Chunk size -> Adr=%x\n"; -void sndStartMp3(s16 soundnum, s32 arg1, s32 arg2, s32 arg3) +void sndStartMp3(s16 soundnum, s32 volume, s32 pan, s32 responseflags) { union soundnumhack sp24; union soundnumhack sp20; @@ -2152,36 +2151,36 @@ void sndStartMp3(s16 soundnum, s32 arg1, s32 arg2, s32 arg3) || ((sp20.mp3priority != 1 || g_SndCurMp3.sfxref.mp3priority != 1) && sp20.mp3priority <= g_SndCurMp3.sfxref.mp3priority)) { if (sp24.hasconfig) { - if (g_AudioConfigs[sp24.confignum].unk10 != -1) { - arg1 = g_AudioConfigs[sp24.confignum].unk10 * 32767 / 100; + if (g_AudioConfigs[sp24.confignum].volpercentage != -1) { + volume = g_AudioConfigs[sp24.confignum].volpercentage * AL_VOL_FULL / 100; } - if (g_AudioConfigs[sp24.confignum].unk14 != -1) { - arg2 = g_AudioConfigs[sp24.confignum].unk14; + if (g_AudioConfigs[sp24.confignum].pan != -1) { + pan = g_AudioConfigs[sp24.confignum].pan; } // This is the same thing again - if (g_AudioConfigs[sp24.confignum].unk14 != -1) { - arg2 = g_AudioConfigs[sp24.confignum].unk14; + if (g_AudioConfigs[sp24.confignum].pan != -1) { + pan = g_AudioConfigs[sp24.confignum].pan; } if (g_Vars.langfilteron && (g_AudioConfigs[sp24.confignum].flags & AUDIOCONFIGFLAG_OFFENSIVE)) { - arg1 = 0; + volume = 0; } } - arg1 = arg1 * snd0000e9dc() / 0x7fff; + volume = volume * snd0000e9dc() / AL_VOL_FULL; g_SndCurMp3.romaddr = fileGetRomAddress(sp20.id); g_SndCurMp3.romsize = fileGetRomSize(sp20.id); - func00037f08(arg1, true); - func00037f5c(arg2, true); + func00037f08(volume, true); + func00037f5c(pan, true); mp3PlayFile(g_SndCurMp3.romaddr, g_SndCurMp3.romsize); - func00037f08(arg1, true); - func00037f5c(arg2, true); + func00037f08(volume, true); + func00037f5c(pan, true); g_SndCurMp3.sfxref.packed = sp20.packed; g_SndCurMp3.playing = true; @@ -2194,7 +2193,7 @@ void sndStartMp3(s16 soundnum, s32 arg1, s32 arg2, s32 arg3) g_SndCurMp3.responsetype = MP3RESPONSETYPE_WHISPER; } - if ((sp24.hasconfig && (g_AudioConfigs[sp24.confignum].flags & AUDIOCONFIGFLAG_04)) || (arg3 & 1)) { + if ((sp24.hasconfig && (g_AudioConfigs[sp24.confignum].flags & AUDIOCONFIGFLAG_RESPONDHELLO)) || (responseflags & 1)) { g_SndCurMp3.responsetype = MP3RESPONSETYPE_GREETING; } } @@ -2239,7 +2238,7 @@ void sndTickNosedive(void) } if (g_SndNosediveVolume) { - sndAdjust(&g_SndNosediveHandle, 0, g_SndNosediveVolume, 64, -1, percentage, 0, -1, 1); + sndAdjust(&g_SndNosediveHandle, 0, g_SndNosediveVolume, AL_PAN_CENTER, -1, percentage, 0, -1, 1); } else if (g_SndNosediveHandle != NULL) { audioStop(g_SndNosediveHandle); g_SndNosediveHandle = NULL; @@ -2259,7 +2258,7 @@ void sndTickNosedive(void) } } - sndAdjust(&g_SndNosediveHandle, 0, g_SndNosediveVolume, 64, -1, percentage, 0, -1, 1); + sndAdjust(&g_SndNosediveHandle, 0, g_SndNosediveVolume, AL_PAN_CENTER, -1, percentage, 0, -1, 1); } } else { // Reached the configured fade out point @@ -2272,7 +2271,7 @@ void sndTickNosedive(void) } if (g_SndNosediveVolume) { - sndAdjust(&g_SndNosediveHandle, 0, g_SndNosediveVolume, 64, -1, -1, 0, -1, 1); + sndAdjust(&g_SndNosediveHandle, 0, g_SndNosediveVolume, AL_PAN_CENTER, -1, -1, 0, -1, 1); } else if (g_SndNosediveHandle != NULL) { audioStop(g_SndNosediveHandle); g_SndNosediveHandle = NULL; @@ -2323,7 +2322,7 @@ void sndTickUfo(void) } if (g_SndUfoVolume) { - sndAdjust(&g_SndUfoHandle, 0, g_SndUfoVolume, 64, -1, percentage, 0, -1, 1); + sndAdjust(&g_SndUfoHandle, 0, g_SndUfoVolume, AL_PAN_CENTER, -1, percentage, 0, -1, 1); } else if (g_SndUfoHandle != NULL) { audioStop(g_SndUfoHandle); g_SndUfoHandle = NULL; @@ -2335,15 +2334,15 @@ void sndTickUfo(void) } // Fade in over about 2.4 seconds - if (g_SndUfoVolume < 32767) { + if (g_SndUfoVolume < AL_VOL_FULL) { g_SndUfoVolume += g_Vars.diffframe240 * PALUP(40); - if (g_SndUfoVolume > 32767) { - g_SndUfoVolume = 32767; + if (g_SndUfoVolume > AL_VOL_FULL) { + g_SndUfoVolume = AL_VOL_FULL; } } - sndAdjust(&g_SndUfoHandle, 0, g_SndUfoVolume, 64, -1, percentage, 0, -1, 1); + sndAdjust(&g_SndUfoHandle, 0, g_SndUfoVolume, AL_PAN_CENTER, -1, percentage, 0, -1, 1); } } else { // Reached the configured fade out point @@ -2356,7 +2355,7 @@ void sndTickUfo(void) } if (g_SndUfoVolume) { - sndAdjust(&g_SndUfoHandle, 0, g_SndUfoVolume, 64, -1, -1, 0, -1, 1); + sndAdjust(&g_SndUfoHandle, 0, g_SndUfoVolume, AL_PAN_CENTER, -1, -1, 0, -1, 1); } else if (g_SndUfoHandle != NULL) { audioStop(g_SndUfoHandle); g_SndUfoHandle = NULL; diff --git a/src/setups/setupame.c b/src/setups/setupame.c index 6cb225899..887aa5aed 100644 --- a/src/setups/setupame.c +++ b/src/setups/setupame.c @@ -1614,7 +1614,7 @@ u8 func0414_programmer[] = { // Phone ringing label(0x06) #if VERSION >= VERSION_NTSC_1_0 - play_sound_from_object2(CHANNEL_4, OBJ_PCMONITOR, SFX_8109, 0x0f, 0x02) + play_sound_from_object2(CHANNEL_4, OBJ_PCMONITOR, SFX_8109, PSTYPE_COMMHUB, 0x02) #else speak(CHR_TARGET, -1, SFX_8109, CHANNEL_4, COLOR_00_GREEN) #endif @@ -2043,7 +2043,7 @@ u8 func100e_check_ecm_mines[] = { yield mute_channel(CHANNEL_0) assign_sound(SFX_8113, CHANNEL_0) - control_sound_from_object(CHANNEL_0, OBJ_SECURITYHUB, TRUE) + set_object_sound_playing(CHANNEL_0, OBJ_SECURITYHUB, TRUE) show_hudmsg(CHR_BOND, L_AME_076) // "Internal security system temporarily disabled." set_stage_flag(STAGEFLAG_SECURITYHUB_COMPLETE) reloop(0x00) @@ -2054,7 +2054,7 @@ u8 func100e_check_ecm_mines[] = { yield mute_channel(CHANNEL_1) assign_sound(SFX_8113, CHANNEL_1) - control_sound_from_object(CHANNEL_1, OBJ_EXTCOMMSHUB, TRUE) + set_object_sound_playing(CHANNEL_1, OBJ_EXTCOMMSHUB, TRUE) show_hudmsg(CHR_BOND, L_AME_077) // "External communications hub disabled." set_stage_flag(STAGEFLAG_EXTCOMMSHUB_COMPLETE) reloop(0x00) @@ -2261,7 +2261,7 @@ u8 func1007_uplinking[] = { restart_timer show_hudmsg(CHR_TARGET, L_AME_046) // "ACCESS DENIED - password needed." assign_sound(SFX_01C0, CHANNEL_7) - control_sound_from_object(CHANNEL_7, OBJ_PC, FALSE) + set_object_sound_playing(CHANNEL_7, OBJ_PC, FALSE) beginloop(0xaf) if_timer_gt(120, /*goto*/ 0x06) @@ -2274,7 +2274,7 @@ u8 func1007_uplinking[] = { label(0xae) show_hudmsg(CHR_TARGET, L_AME_044) // "File download initiated." assign_sound(SFX_01BF, CHANNEL_7) - control_sound_from_object(CHANNEL_7, OBJ_PC, TRUE) + set_object_sound_playing(CHANNEL_7, OBJ_PC, TRUE) restart_timer // @bug: Missing check for player still having uplink equipped @@ -2287,7 +2287,7 @@ u8 func1007_uplinking[] = { label(0xad) mute_channel(CHANNEL_7) assign_sound(SFX_01C1, CHANNEL_7) - control_sound_from_object(CHANNEL_7, OBJ_PC, TRUE) + set_object_sound_playing(CHANNEL_7, OBJ_PC, TRUE) show_hudmsg(CHR_TARGET, L_AME_045) // "File download completed." yield set_stage_flag(STAGEFLAG_DOWNLOAD_COMPLETE) @@ -2297,7 +2297,7 @@ u8 func1007_uplinking[] = { show_hudmsg(CHR_TARGET, L_AME_074) // "Datalink broken - connection terminated." mute_channel(CHANNEL_7) assign_sound(SFX_01C0, CHANNEL_6) - play_sound_from_object(CHANNEL_6, OBJ_PC, 1, 300, 400) + play_repeating_sound_from_object(CHANNEL_6, OBJ_PC, 1, 300, 400) restart_timer beginloop(0x11) @@ -2312,7 +2312,7 @@ u8 func1007_uplinking[] = { show_hudmsg(CHR_TARGET, L_AME_075) // "Datalink error - incomplete file download." mute_channel(CHANNEL_7) assign_sound(SFX_01C0, CHANNEL_6) - play_sound_from_object(CHANNEL_6, OBJ_PC, 1, 300, 400) + play_repeating_sound_from_object(CHANNEL_6, OBJ_PC, 1, 300, 400) restart_timer beginloop(0x13) @@ -2369,7 +2369,7 @@ u8 func1008_doorswitch[] = { label(0x06) assign_sound(SFX_043B, CHANNEL_7) - control_sound_from_object(CHANNEL_7, OBJ_OFFICEDOOR1, TRUE) + set_object_sound_playing(CHANNEL_7, OBJ_OFFICEDOOR1, TRUE) set_ailist(CHR_SELF, GAILIST_IDLE) endlist }; @@ -3228,7 +3228,7 @@ u8 func0416_outro[] = { endloop(0xb6) label(0x06) - play_sound(SFX_0165, CHANNEL_10) + play_sound(SFX_0165, CHANNEL_CUTSCENE) beginloop(0xb7) if_controller_button_pressed(/*goto*/ 0xbd) @@ -3236,7 +3236,7 @@ u8 func0416_outro[] = { endloop(0xb7) label(0x06) - play_sound(SFX_0167, CHANNEL_10) + play_sound(SFX_0167, CHANNEL_CUTSCENE) beginloop(0xb8) if_controller_button_pressed(/*goto*/ 0xbd) @@ -3244,7 +3244,7 @@ u8 func0416_outro[] = { endloop(0xb8) label(0x06) - play_sound(SFX_01DC, CHANNEL_10) + play_sound(SFX_01DC, CHANNEL_CUTSCENE) beginloop(0xb9) if_controller_button_pressed(/*goto*/ 0xbd) @@ -3252,7 +3252,7 @@ u8 func0416_outro[] = { endloop(0xb9) label(0x06) - play_sound(SFX_01D8, CHANNEL_10) + play_sound(SFX_01D8, CHANNEL_CUTSCENE) beginloop(0xba) if_controller_button_pressed(/*goto*/ 0xbd) @@ -3260,7 +3260,7 @@ u8 func0416_outro[] = { endloop(0xba) label(0x06) - play_sound(SFX_01DA, CHANNEL_10) + play_sound(SFX_01DA, CHANNEL_CUTSCENE) beginloop(0xbb) if_controller_button_pressed(/*goto*/ 0xbd) @@ -3268,7 +3268,7 @@ u8 func0416_outro[] = { endloop(0xbb) label(0x06) - play_sound(VERSION >= VERSION_NTSC_1_0 ? SFX_80F6 : SFX_01D9, CHANNEL_10) + play_sound(VERSION >= VERSION_NTSC_1_0 ? SFX_80F6 : SFX_01D9, CHANNEL_CUTSCENE) beginloop(0xbc) if_controller_button_pressed(/*goto*/ 0xbd) @@ -3276,7 +3276,7 @@ u8 func0416_outro[] = { endloop(0xbc) label(0x06) - play_sound(SFX_01DB, CHANNEL_10) + play_sound(SFX_01DB, CHANNEL_CUTSCENE) beginloop(0x08) if_camera_animating(/*goto*/ 0x2c) @@ -3293,7 +3293,7 @@ u8 func0416_outro[] = { endloop(0x08) label(0xbd) - mute_channel(CHANNEL_10) + mute_channel(CHANNEL_CUTSCENE) end_level set_ailist(CHR_SELF, GAILIST_IDLE) endlist @@ -3332,13 +3332,13 @@ u8 func1003_start_intro[] = { u8 func1010_start_hub_humms[] = { yield #if VERSION >= VERSION_NTSC_1_0 - play_sound_from_object2(CHANNEL_0, OBJ_SECURITYHUB, SFX_8111, 0x0f, 0x02) + play_sound_from_object2(CHANNEL_0, OBJ_SECURITYHUB, SFX_8111, PSTYPE_COMMHUB, 0x02) yield - play_sound_from_object2(CHANNEL_1, OBJ_EXTCOMMSHUB, SFX_8111, 0x0f, 0x02) + play_sound_from_object2(CHANNEL_1, OBJ_EXTCOMMSHUB, SFX_8111, PSTYPE_COMMHUB, 0x02) #else - play_sound_from_object2(CHANNEL_0, OBJ_SECURITYHUB, SFX_8111, 0x0f, 0x00) + play_sound_from_object2(CHANNEL_0, OBJ_SECURITYHUB, SFX_8111, PSTYPE_COMMHUB, 0x00) yield - play_sound_from_object2(CHANNEL_1, OBJ_SECURITYHUB, SFX_0004, 0x0f, 0x00) + play_sound_from_object2(CHANNEL_1, OBJ_SECURITYHUB, SFX_0004, PSTYPE_COMMHUB, 0x00) #endif set_ailist(CHR_SELF, GAILIST_IDLE) endlist diff --git a/src/setups/setupark.c b/src/setups/setupark.c index dddaa3c11..68611c0fd 100644 --- a/src/setups/setupark.c +++ b/src/setups/setupark.c @@ -1443,7 +1443,7 @@ u8 func1004_elevator_unlocking[] = { label(0x20) show_hudmsg(CHR_TARGET, L_ARK_014) // "Accessing elevator controls..." assign_sound(SFX_8116, CHANNEL_6) - control_sound_from_object(CHANNEL_6, 0x01, TRUE) + set_object_sound_playing(CHANNEL_6, 0x01, TRUE) restart_timer beginloop(0x22) @@ -2426,7 +2426,7 @@ u8 func100d_intro[] = { label(0x5d) set_stage_flag(STAGEFLAG_FOYER_LIGHTS_OFF) - mute_channel(CHANNEL_10) + mute_channel(CHANNEL_CUTSCENE) mute_channel(CHANNEL_7) unset_chr_chrflag(CHR_COOP, CHRCFLAG_HIDDEN) @@ -2604,10 +2604,10 @@ u8 func0412_outro[] = { play_sound(SFX_FOOTSTEP_80CB, -1) outro_wait_until(1505, 0x6e) - play_sound(SFX_FIRE_SHOTGUN, CHANNEL_10) + play_sound(SFX_FIRE_SHOTGUN, CHANNEL_CUTSCENE) outro_wait_until(1520, 0x6f) - play_sound(SFX_FIRE_SHOTGUN, CHANNEL_10) + play_sound(SFX_FIRE_SHOTGUN, CHANNEL_CUTSCENE) outro_wait_until(1526, 0x70) set_chr_shooting_in_cutscene(CHR_BOND, TRUE) @@ -2624,13 +2624,13 @@ u8 func0412_outro[] = { set_chr_shooting_in_cutscene(CHR_BOND, FALSE) outro_wait_until(1554, 0x71) - play_sound(SFX_ARGH_FEMALE_000D, CHANNEL_10) + play_sound(SFX_ARGH_FEMALE_000D, CHANNEL_CUTSCENE) outro_wait_until(1600, 0x74) - play_sound(SFX_ARGH_FEMALE_000E, CHANNEL_10) + play_sound(SFX_ARGH_FEMALE_000E, CHANNEL_CUTSCENE) outro_wait_until(1734, 0x72) - play_sound(SFX_THUD_808D, CHANNEL_10) + play_sound(SFX_THUD_808D, CHANNEL_CUTSCENE) outro_wait_until(1890, 0x75) play_sound(SFX_0425, -1) diff --git a/src/setups/setupazt.c b/src/setups/setupazt.c index 37befec22..91e7fe0e3 100644 --- a/src/setups/setupazt.c +++ b/src/setups/setupazt.c @@ -496,40 +496,40 @@ u8 func1002_intro[] = { label(0x08) wait_until(724, 0x69) - speak(CHR_BOND, L_AZT_032, MP3_0759, CHANNEL_10, COLOR_09_BLUE) // "Ahhh... uuhhhh..." + speak(CHR_BOND, L_AZT_032, MP3_0759, CHANNEL_CUTSCENE, COLOR_09_BLUE) // "Ahhh... uuhhhh..." wait_until(830, 0x6a) - speak(CHR_BOND, L_AZT_034, MP3_0457, CHANNEL_10, COLOR_06_WHITE) // "Agent Dark! Please report!" + speak(CHR_BOND, L_AZT_034, MP3_0457, CHANNEL_CUTSCENE, COLOR_06_WHITE) // "Agent Dark! Please report!" wait_until(980, 0x6b) - speak(CHR_BOND, L_AZT_033, MP3_075A, CHANNEL_10, COLOR_09_BLUE) // "Ahhh... uhh... owww..." + speak(CHR_BOND, L_AZT_033, MP3_075A, CHANNEL_CUTSCENE, COLOR_09_BLUE) // "Ahhh... uhh... owww..." wait_until(1030, 0x6c) - speak(CHR_BOND, L_AZT_035, MP3_0458, CHANNEL_10, COLOR_06_WHITE) // "Perfect Dark, come in!" + speak(CHR_BOND, L_AZT_035, MP3_0458, CHANNEL_CUTSCENE, COLOR_06_WHITE) // "Perfect Dark, come in!" wait_until(1152, 0x6e) - speak(CHR_BOND, L_AZT_036, MP3_0459, CHANNEL_10, COLOR_09_BLUE) // "A-agent Dark reporting in..." + speak(CHR_BOND, L_AZT_036, MP3_0459, CHANNEL_CUTSCENE, COLOR_09_BLUE) // "A-agent Dark reporting in..." wait_until(1372, 0x6f) - speak(CHR_BOND, L_AZT_037, MP3_045A, CHANNEL_10, COLOR_06_WHITE) // "Agent Dark! Please reply!" + speak(CHR_BOND, L_AZT_037, MP3_045A, CHANNEL_CUTSCENE, COLOR_06_WHITE) // "Agent Dark! Please reply!" wait_until(1610, 0x6d) - speak(CHR_BOND, L_AZT_038, MP3_045B, CHANNEL_10, COLOR_09_BLUE) // "Something's jamming my transmissions... It's comin..." + speak(CHR_BOND, L_AZT_038, MP3_045B, CHANNEL_CUTSCENE, COLOR_09_BLUE) // "Something's jamming my transmissions... It's comin..." wait_until(1875, 0x70) - speak(CHR_BOND, -1, SFX_FOOTSTEP_8189, CHANNEL_10, COLOR_00_GREEN) + speak(CHR_BOND, -1, SFX_FOOTSTEP_8189, CHANNEL_CUTSCENE, COLOR_00_GREEN) wait_until(1900, 0x71) - speak(CHR_BOND, -1, SFX_FOOTSTEP_818A, CHANNEL_10, COLOR_00_GREEN) + speak(CHR_BOND, -1, SFX_FOOTSTEP_818A, CHANNEL_CUTSCENE, COLOR_00_GREEN) wait_until(1926, 0x72) speak(CHR_BOND, -1, SFX_FOOTSTEP_8188, CHANNEL_7, COLOR_00_GREEN) wait_until(1958, 0x73) - speak(CHR_BOND, -1, SFX_FOOTSTEP_8189, CHANNEL_10, COLOR_00_GREEN) + speak(CHR_BOND, -1, SFX_FOOTSTEP_8189, CHANNEL_CUTSCENE, COLOR_00_GREEN) wait_until(2000, 0x74) - speak(CHR_BOND, L_AZT_039, MP3_045C, CHANNEL_10, COLOR_09_BLUE) // "I'd better find the jamming device and check that ..." + speak(CHR_BOND, L_AZT_039, MP3_045C, CHANNEL_CUTSCENE, COLOR_09_BLUE) // "I'd better find the jamming device and check that ..." wait_until(2116, 0x75) speak(CHR_BOND, -1, SFX_FOOTSTEP_8188, CHANNEL_7, COLOR_00_GREEN) @@ -576,7 +576,7 @@ u8 func1002_intro[] = { mute_channel(CHANNEL_7) mute_channel(CHANNEL_6) mute_channel(CHANNEL_5) - mute_channel(CHANNEL_10) + mute_channel(CHANNEL_CUTSCENE) unset_chr_chrflag(CHR_COOP, CHRCFLAG_HIDDEN) unset_chr_chrflag(CHR_ANTI, CHRCFLAG_HIDDEN) unset_chr_chrflag(CHR_BOND, CHRCFLAG_UNPLAYABLE) @@ -695,10 +695,10 @@ u8 func0402_outro[] = { play_sound(SFX_0595, CHANNEL_6) wait_until(248, 0x6b) - speak(CHR_BOND, L_AZT_040, MP3_045D, CHANNEL_10, COLOR_09_BLUE) // "How are you feeling, Mr. President?" + speak(CHR_BOND, L_AZT_040, MP3_045D, CHANNEL_CUTSCENE, COLOR_09_BLUE) // "How are you feeling, Mr. President?" wait_until(414, 0x6c) - speak(CHR_BOND, L_AZT_041, MP3_045E, CHANNEL_10, COLOR_08_RED) // "Better now, young lady. Today, I think, will take ..." + speak(CHR_BOND, L_AZT_041, MP3_045E, CHANNEL_CUTSCENE, COLOR_08_RED) // "Better now, young lady. Today, I think, will take ..." wait_until(490, 0x6e) play_sound(SFX_0596, CHANNEL_5) @@ -716,11 +716,11 @@ u8 func0402_outro[] = { play_sound(SFX_0597, CHANNEL_7) wait_until(1200, 0x70) - speak(CHR_BOND, L_AZT_042, MP3_045F, CHANNEL_10, COLOR_09_BLUE) // "Just one thing, sir? What is the Pelagic II that T..." + speak(CHR_BOND, L_AZT_042, MP3_045F, CHANNEL_CUTSCENE, COLOR_09_BLUE) // "Just one thing, sir? What is the Pelagic II that T..." wait_until(1474, 0x74) play_sound(SFX_ELVIS_HEHE, CHANNEL_5) - play_sound(SFX_00F8, CHANNEL_10) + play_sound(SFX_00F8, CHANNEL_CUTSCENE) wait_until(1490, 0x75) play_sound(SFX_0596, CHANNEL_7) @@ -729,10 +729,10 @@ u8 func0402_outro[] = { play_sound(SFX_0594, CHANNEL_6) wait_until(1556, 0x77) - play_sound(SFX_00F8, CHANNEL_10) + play_sound(SFX_00F8, CHANNEL_CUTSCENE) wait_until(1626, 0x73) - speak(CHR_BOND, L_AZT_043, MP3_0460, CHANNEL_10, COLOR_08_RED) // "It's a U.S. government deep sea research vessel, o..." + speak(CHR_BOND, L_AZT_043, MP3_0460, CHANNEL_CUTSCENE, COLOR_08_RED) // "It's a U.S. government deep sea research vessel, o..." wait_until(1807, 0x79) play_sound(SFX_0595, CHANNEL_7) @@ -762,16 +762,16 @@ u8 func0402_outro[] = { play_sound(SFX_FOOTSTEP_8188, CHANNEL_7) wait_until(2450, 0x7b) - speak(CHR_BOND, L_AZT_044, MP3_0461, CHANNEL_10, COLOR_09_BLUE) // "Trent has a lot to answer for, but I don't think w..." + speak(CHR_BOND, L_AZT_044, MP3_0461, CHANNEL_CUTSCENE, COLOR_09_BLUE) // "Trent has a lot to answer for, but I don't think w..." wait_until(3150, 0x83) - speak(CHR_BOND, L_AZT_045, MP3_0462, CHANNEL_10, COLOR_03_RED) // "You have failed, Easton. You are a flawed device, ..." + speak(CHR_BOND, L_AZT_045, MP3_0462, CHANNEL_CUTSCENE, COLOR_03_RED) // "You have failed, Easton. You are a flawed device, ..." wait_until(3380, 0x88) play_sound(SFX_FOOTSTEP_818A, CHANNEL_7) wait_until(3580, 0x87) - speak(CHR_BOND, L_AZT_046, MP3_0463, CHANNEL_10, COLOR_05_GREEN) // "Just try it, you Scandinavian freak!" + speak(CHR_BOND, L_AZT_046, MP3_0463, CHANNEL_CUTSCENE, COLOR_05_GREEN) // "Just try it, you Scandinavian freak!" wait_until(3747, 0x84) play_sound(SFX_FOOTSTEP_8189, CHANNEL_5) @@ -781,26 +781,26 @@ u8 func0402_outro[] = { wait_until(4054, 0x86) play_sound(SFX_05A0, CHANNEL_5) - play_sound(SFX_CLOAK_OFF, CHANNEL_10) + play_sound(SFX_CLOAK_OFF, CHANNEL_CUTSCENE) set_chr_hiddenflag(CHR_MRBLONDE, CHRHFLAG_CLOAKED) set_chr_hiddenflag(CHR_SKEDAR, CHRHFLAG_CLOAKED) wait_until(4100, 0x95) unset_chr_hiddenflag(CHR_SKEDAR, CHRHFLAG_CLOAKED) - play_sound(SFX_SKEDAR_ROAR_052A, CHANNEL_10) + play_sound(SFX_SKEDAR_ROAR_052A, CHANNEL_CUTSCENE) wait_until(4200, 0x78) - speak(CHR_BOND, L_AZT_047, MP3_0464, CHANNEL_10, COLOR_05_GREEN) // "Noooooooo!!!" + speak(CHR_BOND, L_AZT_047, MP3_0464, CHANNEL_CUTSCENE, COLOR_05_GREEN) // "Noooooooo!!!" wait_until(4240, 0x93) - play_sound(SFX_05C0, CHANNEL_10) + play_sound(SFX_05C0, CHANNEL_CUTSCENE) wait_until(4296, 0x89) play_sound(SFX_007D, CHANNEL_6) wait_until(4444, 0x8a) play_sound(SFX_05A0, CHANNEL_5) - play_sound(SFX_SKEDAR_ROAR_0530, CHANNEL_10) + play_sound(SFX_SKEDAR_ROAR_0530, CHANNEL_CUTSCENE) wait_until(4506, 0x8b) play_sound(SFX_05A1, CHANNEL_7) @@ -809,7 +809,7 @@ u8 func0402_outro[] = { set_chr_hiddenflag(CHR_SKEDAR, CHRHFLAG_CLOAKED) wait_until(4566, 0x8c) - play_sound(SFX_CLOAK_ON, CHANNEL_10) + play_sound(SFX_CLOAK_ON, CHANNEL_CUTSCENE) unset_chr_hiddenflag(CHR_MRBLONDE, CHRHFLAG_CLOAKED) wait_until(4576, 0x8d) @@ -1150,7 +1150,7 @@ u8 func1008_escapepod[] = { label(0x31) assign_sound(SFX_8115, CHANNEL_0) - play_sound_from_object(CHANNEL_0, OBJ_ESCAPEPOD, 1, 800, 1600) + play_repeating_sound_from_object(CHANNEL_0, OBJ_ESCAPEPOD, 1, 800, 1600) show_hudmsg(CHR_P1P2, L_AZT_014) // "Distress beacon has been activated." set_stage_flag(STAGEFLAG_BEACON_ACTIVATED) endloop(0x06) diff --git a/src/setups/setupcave.c b/src/setups/setupcave.c index a2e0bd17f..a227691ab 100644 --- a/src/setups/setupcave.c +++ b/src/setups/setupcave.c @@ -878,28 +878,28 @@ u8 func0425_outro[] = { label(0x02) wait_until(38, 0x92) - play_sound(SFX_FOOTSTEP_80C4, CHANNEL_10) + play_sound(SFX_FOOTSTEP_80C4, CHANNEL_CUTSCENE) wait_until(84, 0x93) - play_sound(SFX_FOOTSTEP_80C5, CHANNEL_10) + play_sound(SFX_FOOTSTEP_80C5, CHANNEL_CUTSCENE) wait_until(130, 0x94) - play_sound(SFX_FOOTSTEP_80C6, CHANNEL_10) + play_sound(SFX_FOOTSTEP_80C6, CHANNEL_CUTSCENE) wait_until(176, 0x95) - play_sound(SFX_FOOTSTEP_80C7, CHANNEL_10) + play_sound(SFX_FOOTSTEP_80C7, CHANNEL_CUTSCENE) wait_until(220, 0x96) - play_sound(SFX_FOOTSTEP_80C4, CHANNEL_10) + play_sound(SFX_FOOTSTEP_80C4, CHANNEL_CUTSCENE) wait_until(274, 0x97) - play_sound(SFX_FOOTSTEP_80C5, CHANNEL_10) + play_sound(SFX_FOOTSTEP_80C5, CHANNEL_CUTSCENE) wait_until(320, 0x98) - play_sound(SFX_FOOTSTEP_80C6, CHANNEL_10) + play_sound(SFX_FOOTSTEP_80C6, CHANNEL_CUTSCENE) wait_until(365, 0x99) - play_sound(SFX_FOOTSTEP_80C7, CHANNEL_10) + play_sound(SFX_FOOTSTEP_80C7, CHANNEL_CUTSCENE) beginloop(0x04) if_camera_animating(/*goto*/ 0x31) @@ -911,7 +911,7 @@ u8 func0425_outro[] = { endloop(0x04) label(0x48) - mute_channel(CHANNEL_10) + mute_channel(CHANNEL_CUTSCENE) label(0x02) unset_chr_chrflag(CHR_COOP, CHRCFLAG_HIDDEN) unset_chr_chrflag(CHR_ANTI, CHRCFLAG_HIDDEN) @@ -1741,7 +1741,7 @@ u8 func1007_console_activation[] = { show_hudmsg(CHR_P1P2, L_CAVE_035) // "System shutdown initiated..." mute_channel(CHANNEL_1) assign_sound(SFX_01B9, CHANNEL_1) - control_sound_from_object(CHANNEL_1, OBJ_CONSOLE, TRUE) + set_object_sound_playing(CHANNEL_1, OBJ_CONSOLE, TRUE) restart_timer beginloop(0x04) @@ -1756,7 +1756,7 @@ u8 func1007_console_activation[] = { set_object_image(OBJ_CONSOLE, 0, TVCMDLIST_14) mute_channel(CHANNEL_1) assign_sound(SFX_0479, CHANNEL_1) - control_sound_from_object(CHANNEL_1, OBJ_CONSOLE, TRUE) + set_object_sound_playing(CHANNEL_1, OBJ_CONSOLE, TRUE) show_hudmsg(CHR_P1P2, L_CAVE_036) // "Security systems have been shut down." set_stage_flag(STAGEFLAG_SECURITY_SHUT_DOWN) unset_chr_hiddenflag(CHR_BOND, CHRHFLAG_DISGUISED) @@ -2358,7 +2358,7 @@ u8 func100d_laser_panel[] = { label(0x04) assign_sound(SFX_043A, CHANNEL_7) - control_sound_from_object(CHANNEL_7, OBJ_LASER_PANEL, TRUE) + set_object_sound_playing(CHANNEL_7, OBJ_LASER_PANEL, TRUE) show_hudmsg(CHR_P1P2, L_CAVE_045) // "Laser grid access denied." endloop(0x00) @@ -2956,16 +2956,16 @@ u8 func0404_laser_guard[] = { u8 func1016_console_noises[] = { yield assign_sound(SFX_8141, CHANNEL_0) - play_sound_from_object(CHANNEL_0, 0x04, 1, 600, 800) + play_repeating_sound_from_object(CHANNEL_0, 0x04, 1, 600, 800) yield assign_sound(SFX_8143, CHANNEL_2) - play_sound_from_object(CHANNEL_2, 0x05, 1, 500, 1000) + play_repeating_sound_from_object(CHANNEL_2, 0x05, 1, 500, 1000) yield - play_sound_from_pad(PAD_CAVE_0114, SFX_81A7) + play_repeating_sound_from_pad(PAD_CAVE_0114, SFX_81A7) yield - play_sound_from_pad(PAD_CAVE_0115, SFX_81A7) + play_repeating_sound_from_pad(PAD_CAVE_0115, SFX_81A7) yield - play_sound_from_pad(PAD_CAVE_01AC, SFX_811B) + play_repeating_sound_from_pad(PAD_CAVE_01AC, SFX_811B) label(0x42) restart_timer @@ -3004,7 +3004,7 @@ u8 func1016_console_noises[] = { yield yield assign_sound(SFX_8112, CHANNEL_1) - play_sound_from_object(CHANNEL_1, OBJ_CONSOLE, 1, 600, 800) + play_repeating_sound_from_object(CHANNEL_1, OBJ_CONSOLE, 1, 600, 800) goto_first(0x42) // Rand 2 @@ -3020,7 +3020,7 @@ u8 func1016_console_noises[] = { yield yield assign_sound(SFX_813F, CHANNEL_1) - play_sound_from_object(CHANNEL_1, OBJ_CONSOLE, 1, 600, 800) + play_repeating_sound_from_object(CHANNEL_1, OBJ_CONSOLE, 1, 600, 800) goto_first(0x42) // Rand 3 @@ -3036,7 +3036,7 @@ u8 func1016_console_noises[] = { yield yield assign_sound(SFX_8140, CHANNEL_1) - play_sound_from_object(CHANNEL_1, OBJ_CONSOLE, 1, 600, 800) + play_repeating_sound_from_object(CHANNEL_1, OBJ_CONSOLE, 1, 600, 800) goto_first(0x42) label(0x09) @@ -3639,168 +3639,168 @@ u8 func1003_intro[] = { speak(CHR_BOND, L_CAVE_055, MP3_0447, CHANNEL_7, COLOR_09_BLUE) // "Agent Dark in position. I can see the main entranc..." wait_until(312, 0x89) - play_sound(SFX_0594, CHANNEL_10) + play_sound(SFX_0594, CHANNEL_CUTSCENE) wait_until(346, 0x8a) - play_sound(SFX_0595, CHANNEL_10) + play_sound(SFX_0595, CHANNEL_CUTSCENE) wait_until(580, 0x76) - speak(CHR_BOND, L_CAVE_056, MP3_0448, CHANNEL_10, COLOR_06_WHITE) // "Excellent, Joanna. That cable car is your way in....." + speak(CHR_BOND, L_CAVE_056, MP3_0448, CHANNEL_CUTSCENE, COLOR_06_WHITE) // "Excellent, Joanna. That cable car is your way in....." wait_until(968, 0x8b) - play_sound(SFX_0596, CHANNEL_10) + play_sound(SFX_0596, CHANNEL_CUTSCENE) wait_until(1315, 0x77) - speak(CHR_BOND, L_CAVE_057, MP3_07DB, CHANNEL_10, COLOR_09_BLUE) // "That they're probably innocent of any involvement ..." + speak(CHR_BOND, L_CAVE_057, MP3_07DB, CHANNEL_CUTSCENE, COLOR_09_BLUE) // "That they're probably innocent of any involvement ..." wait_until(1411, 0x8e) play_sound(SFX_04AF, CHANNEL_0) wait_until(1735, 0x85) mute_channel(CHANNEL_0) - play_sound(SFX_04EA, CHANNEL_10) + play_sound(SFX_04EA, CHANNEL_CUTSCENE) wait_until(1800, 0x86) - play_sound(SFX_04EB, CHANNEL_10) + play_sound(SFX_04EB, CHANNEL_CUTSCENE) wait_until(1890, 0x87) - play_sound(SFX_04EC, CHANNEL_10) + play_sound(SFX_04EC, CHANNEL_CUTSCENE) wait_until(1900, 0x78) speak(CHR_BOND, L_CAVE_058, MP3_0449, CHANNEL_5, COLOR_06_WHITE) // "I don't know how far the conspiracy has spread thr..." wait_until(1970, 0x8c) - play_sound(SFX_0171, CHANNEL_10) + play_sound(SFX_0171, CHANNEL_CUTSCENE) wait_until(1980, 0x88) wait_until(2013, 0x8d) - play_sound(SFX_0172, CHANNEL_10) + play_sound(SFX_0172, CHANNEL_CUTSCENE) wait_until(2048, 0x8f) - play_sound(SFX_0596, CHANNEL_10) + play_sound(SFX_0596, CHANNEL_CUTSCENE) wait_until(2076, 0x92) - play_sound(SFX_0161, CHANNEL_10) + play_sound(SFX_0161, CHANNEL_CUTSCENE) wait_until(2088, 0x93) - play_sound(SFX_0162, CHANNEL_10) + play_sound(SFX_0162, CHANNEL_CUTSCENE) wait_until(2116, 0x94) - play_sound(SFX_0163, CHANNEL_10) + play_sound(SFX_0163, CHANNEL_CUTSCENE) wait_until(2140, 0x95) - play_sound(SFX_0164, CHANNEL_10) + play_sound(SFX_0164, CHANNEL_CUTSCENE) wait_until(2154, 0x96) - play_sound(SFX_0165, CHANNEL_10) + play_sound(SFX_0165, CHANNEL_CUTSCENE) wait_until(2184, 0x97) - play_sound(SFX_0166, CHANNEL_10) + play_sound(SFX_0166, CHANNEL_CUTSCENE) wait_until(2202, 0x98) - play_sound(SFX_0167, CHANNEL_10) + play_sound(SFX_0167, CHANNEL_CUTSCENE) wait_until(2246, 0x99) - play_sound(SFX_0168, CHANNEL_10) + play_sound(SFX_0168, CHANNEL_CUTSCENE) wait_until(2296, 0x9a) - play_sound(SFX_0161, CHANNEL_10) + play_sound(SFX_0161, CHANNEL_CUTSCENE) wait_until(2332, 0x9b) - play_sound(SFX_0162, CHANNEL_10) + play_sound(SFX_0162, CHANNEL_CUTSCENE) wait_until(2376, 0x9c) - play_sound(SFX_0165, CHANNEL_10) + play_sound(SFX_0165, CHANNEL_CUTSCENE) wait_until(2418, 0x9d) - play_sound(SFX_0163, CHANNEL_10) + play_sound(SFX_0163, CHANNEL_CUTSCENE) wait_until(2446, 0x9e) - play_sound(SFX_0164, CHANNEL_10) + play_sound(SFX_0164, CHANNEL_CUTSCENE) wait_until(2486, 0x9f) - play_sound(SFX_0168, CHANNEL_10) + play_sound(SFX_0168, CHANNEL_CUTSCENE) wait_until(2526, 0xa0) - play_sound(SFX_0166, CHANNEL_10) + play_sound(SFX_0166, CHANNEL_CUTSCENE) wait_until(2558, 0xa1) - play_sound(SFX_0167, CHANNEL_10) + play_sound(SFX_0167, CHANNEL_CUTSCENE) wait_until(2674, 0xa2) - play_sound(SFX_0168, CHANNEL_10) + play_sound(SFX_0168, CHANNEL_CUTSCENE) wait_until(2700, 0x79) speak(CHR_BOND, L_CAVE_059, MP3_044A, CHANNEL_7, COLOR_09_BLUE) // "Yes, and protect him from his abductors. Do you ha..." wait_until(2704, 0xa3) - play_sound(SFX_0161, CHANNEL_10) + play_sound(SFX_0161, CHANNEL_CUTSCENE) wait_until(2720, 0xa4) - play_sound(SFX_0163, CHANNEL_10) + play_sound(SFX_0163, CHANNEL_CUTSCENE) wait_until(2770, 0xa5) - play_sound(SFX_0164, CHANNEL_10) + play_sound(SFX_0164, CHANNEL_CUTSCENE) wait_until(2796, 0xa6) - play_sound(SFX_0167, CHANNEL_10) + play_sound(SFX_0167, CHANNEL_CUTSCENE) wait_until(2812, 0xa7) - play_sound(SFX_0168, CHANNEL_10) + play_sound(SFX_0168, CHANNEL_CUTSCENE) wait_until(2830, 0xa8) - play_sound(SFX_0162, CHANNEL_10) + play_sound(SFX_0162, CHANNEL_CUTSCENE) wait_until(2846, 0xa9) - play_sound(SFX_0164, CHANNEL_10) + play_sound(SFX_0164, CHANNEL_CUTSCENE) wait_until(2856, 0xaa) - play_sound(SFX_0165, CHANNEL_10) + play_sound(SFX_0165, CHANNEL_CUTSCENE) wait_until(2890, 0xab) - play_sound(SFX_0166, CHANNEL_10) + play_sound(SFX_0166, CHANNEL_CUTSCENE) wait_until(2946, 0xac) - play_sound(SFX_0163, CHANNEL_10) + play_sound(SFX_0163, CHANNEL_CUTSCENE) wait_until(2976, 0xad) - play_sound(SFX_0164, CHANNEL_10) + play_sound(SFX_0164, CHANNEL_CUTSCENE) wait_until(3008, 0xae) - play_sound(SFX_0167, CHANNEL_10) + play_sound(SFX_0167, CHANNEL_CUTSCENE) wait_until(3116, 0xaf) - play_sound(SFX_0164, CHANNEL_10) + play_sound(SFX_0164, CHANNEL_CUTSCENE) wait_until(3154, 0xb0) - play_sound(SFX_0165, CHANNEL_10) + play_sound(SFX_0165, CHANNEL_CUTSCENE) wait_until(3188, 0xb1) - play_sound(SFX_0163, CHANNEL_10) + play_sound(SFX_0163, CHANNEL_CUTSCENE) wait_until(3230, 0xb2) - play_sound(SFX_0164, CHANNEL_10) + play_sound(SFX_0164, CHANNEL_CUTSCENE) wait_until(3250, 0x7a) speak(CHR_BOND, L_CAVE_060, MP3_044B, CHANNEL_5, COLOR_06_WHITE) // "Only vague suspicions, and I won't distract you wi..." wait_until(3387, 0xb3) - play_sound(SFX_0166, CHANNEL_10) + play_sound(SFX_0166, CHANNEL_CUTSCENE) wait_until(3427, 0xb4) - play_sound(SFX_0167, CHANNEL_10) + play_sound(SFX_0167, CHANNEL_CUTSCENE) wait_until(3448, 0xb5) - play_sound(SFX_0168, CHANNEL_10) + play_sound(SFX_0168, CHANNEL_CUTSCENE) wait_until(3656, 0xb6) - play_sound(SFX_0163, CHANNEL_10) + play_sound(SFX_0163, CHANNEL_CUTSCENE) wait_until(3723, 0x90) wait_until(3796, 0x91) - play_sound(SFX_04FC, CHANNEL_10) + play_sound(SFX_04FC, CHANNEL_CUTSCENE) beginloop(0x04) if_camera_animating(/*goto*/ 0x31) @@ -3817,7 +3817,7 @@ u8 func1003_intro[] = { mute_channel(CHANNEL_5) mute_channel(CHANNEL_4) mute_channel(CHANNEL_0) - mute_channel(CHANNEL_10) + mute_channel(CHANNEL_CUTSCENE) disable_object(0x22) disable_object(0x2f) label(0x02) diff --git a/src/setups/setupdam.c b/src/setups/setupdam.c index df22e5b8c..106cca99f 100644 --- a/src/setups/setupdam.c +++ b/src/setups/setupdam.c @@ -808,7 +808,7 @@ u8 func1002_intro[] = { endloop(0x0b) label(0x39) - mute_channel(CHANNEL_10) + mute_channel(CHANNEL_CUTSCENE) unset_chr_chrflag(CHR_COOP, CHRCFLAG_HIDDEN) unset_chr_chrflag(CHR_ANTI, CHRCFLAG_HIDDEN) unset_chr_chrflag(CHR_BOND, CHRCFLAG_UNPLAYABLE) @@ -884,113 +884,113 @@ u8 func0c01_outro[] = { restart_timer wait_until(46, 0x3c) - play_sound(SFX_0171, CHANNEL_10) + play_sound(SFX_0171, CHANNEL_CUTSCENE) wait_until(160, 0x3d) - play_sound(SFX_0172, CHANNEL_10) - play_sound_from_object2(0x0a, OBJ_OUTRO_SUBMARINE, SFX_042D, 0x00, 0x00) + play_sound(SFX_0172, CHANNEL_CUTSCENE) + play_sound_from_object2(0x0a, OBJ_OUTRO_SUBMARINE, SFX_042D, PSTYPE_NONE, 0) wait_until(180, 0x3b) - speak(CHR_BOND, L_DAM_039, MP3_0465, CHANNEL_10, COLOR_06_WHITE) // "Right. The diving operation has been disrupted on ..." + speak(CHR_BOND, L_DAM_039, MP3_0465, CHANNEL_CUTSCENE, COLOR_06_WHITE) // "Right. The diving operation has been disrupted on ..." wait_until(200, 0x48) - play_sound(SFX_0173, CHANNEL_10) + play_sound(SFX_0173, CHANNEL_CUTSCENE) wait_until(232, 0x49) - play_sound(SFX_0174, CHANNEL_10) + play_sound(SFX_0174, CHANNEL_CUTSCENE) wait_until(254, 0x4a) - play_sound(SFX_0172, CHANNEL_10) + play_sound(SFX_0172, CHANNEL_CUTSCENE) wait_until(272, 0x66) wait_until(374, 0x4b) - play_sound(SFX_0172, CHANNEL_10) + play_sound(SFX_0172, CHANNEL_CUTSCENE) wait_until(415, 0x4c) - play_sound(SFX_0173, CHANNEL_10) + play_sound(SFX_0173, CHANNEL_CUTSCENE) wait_until(454, 0x4d) - play_sound(SFX_0174, CHANNEL_10) + play_sound(SFX_0174, CHANNEL_CUTSCENE) wait_until(532, 0x4e) - play_sound(SFX_0171, CHANNEL_10) + play_sound(SFX_0171, CHANNEL_CUTSCENE) wait_until(570, 0x4f) - speak(CHR_BOND, L_DAM_040, MP3_0466, CHANNEL_10, COLOR_09_BLUE) // "I hope the government don't want to use this ship ..." + speak(CHR_BOND, L_DAM_040, MP3_0466, CHANNEL_CUTSCENE, COLOR_09_BLUE) // "I hope the government don't want to use this ship ..." wait_until(582, 0x50) - play_sound(SFX_0171, CHANNEL_10) + play_sound(SFX_0171, CHANNEL_CUTSCENE) wait_until(666, 0x51) - play_sound(SFX_0172, CHANNEL_10) + play_sound(SFX_0172, CHANNEL_CUTSCENE) wait_until(706, 0x52) - play_sound(SFX_0173, CHANNEL_10) + play_sound(SFX_0173, CHANNEL_CUTSCENE) wait_until(736, 0x64) - play_sound(SFX_05A8, CHANNEL_10) + play_sound(SFX_05A8, CHANNEL_CUTSCENE) wait_until(806, 0x53) - play_sound(SFX_809F, CHANNEL_10) + play_sound(SFX_809F, CHANNEL_CUTSCENE) wait_until(854, 0x54) - play_sound(SFX_0174, CHANNEL_10) + play_sound(SFX_0174, CHANNEL_CUTSCENE) wait_until(876, 0x55) - play_sound(SFX_0173, CHANNEL_10) + play_sound(SFX_0173, CHANNEL_CUTSCENE) wait_until(906, 0x56) - play_sound(SFX_0172, CHANNEL_10) + play_sound(SFX_0172, CHANNEL_CUTSCENE) wait_until(926, 0x57) - play_sound(SFX_80A2, CHANNEL_10) + play_sound(SFX_80A2, CHANNEL_CUTSCENE) wait_until(950, 0x58) - speak(CHR_BOND, L_DAM_041, MP3_0467, CHANNEL_10, COLOR_06_WHITE) // "Do you think we were a little heavy-handed?" + speak(CHR_BOND, L_DAM_041, MP3_0467, CHANNEL_CUTSCENE, COLOR_06_WHITE) // "Do you think we were a little heavy-handed?" wait_until(1088, 0x59) - play_sound(SFX_80A3, CHANNEL_10) + play_sound(SFX_80A3, CHANNEL_CUTSCENE) wait_until(1152, 0x5a) - play_sound(SFX_0176, CHANNEL_10) + play_sound(SFX_0176, CHANNEL_CUTSCENE) wait_until(1190, 0x5b) - speak(CHR_BOND, L_DAM_042, MP3_0468, CHANNEL_10, COLOR_09_BLUE) // "Naaahhhh." + speak(CHR_BOND, L_DAM_042, MP3_0468, CHANNEL_CUTSCENE, COLOR_09_BLUE) // "Naaahhhh." wait_until(1228, 0x5c) - play_sound(SFX_0174, CHANNEL_10) + play_sound(SFX_0174, CHANNEL_CUTSCENE) wait_until(1258, 0x5d) - play_sound(SFX_0172, CHANNEL_10) + play_sound(SFX_0172, CHANNEL_CUTSCENE) wait_until(1260, 0x5e) - play_sound(SFX_05B4, CHANNEL_10) + play_sound(SFX_05B4, CHANNEL_CUTSCENE) wait_until(1300, 0x5f) - play_sound(SFX_JO_LANDING_05B6, CHANNEL_10) - play_sound(SFX_0171, CHANNEL_10) + play_sound(SFX_JO_LANDING_05B6, CHANNEL_CUTSCENE) + play_sound(SFX_0171, CHANNEL_CUTSCENE) wait_until(1309, 0x65) - play_sound(SFX_0172, CHANNEL_10) + play_sound(SFX_0172, CHANNEL_CUTSCENE) wait_until(1358, 0x60) - play_sound(SFX_0171, CHANNEL_10) + play_sound(SFX_0171, CHANNEL_CUTSCENE) wait_until(1382, 0x61) - play_sound(SFX_EXPLOSION_8098, CHANNEL_10) + play_sound(SFX_EXPLOSION_8098, CHANNEL_CUTSCENE) wait_until(1480, 0x62) - play_sound(SFX_80A3, CHANNEL_10) + play_sound(SFX_80A3, CHANNEL_CUTSCENE) wait_until(1480, 0x63) - play_sound_from_object2(0x0a, OBJ_OUTRO_GRATE, SFX_00C1, 0x00, 0x00) + play_sound_from_object2(0x0a, OBJ_OUTRO_GRATE, SFX_00C1, PSTYPE_NONE, 0) wait_until(1500, 0x67) - play_sound_from_object2(0x0a, OBJ_OUTRO_SUBMARINE, SFX_042D, 0x00, 0x00) + play_sound_from_object2(0x0a, OBJ_OUTRO_SUBMARINE, SFX_042D, PSTYPE_NONE, 0) wait_until(1590, 0x68) - play_sound_from_object2(0x0a, OBJ_OUTRO_SUBMARINE, SFX_0434, 0x00, 0x00) + play_sound_from_object2(0x0a, OBJ_OUTRO_SUBMARINE, SFX_0434, PSTYPE_NONE, 0) beginloop(0x0b) if_camera_animating(/*goto*/ 0x07) @@ -1125,7 +1125,7 @@ u8 func100a_reactor_switch[] = { mute_channel(CHANNEL_0) mute_channel(CHANNEL_1) assign_sound(SFX_8147, CHANNEL_0) - control_sound_from_object(CHANNEL_0, OBJ_REACTOR_SWITCH, TRUE) + set_object_sound_playing(CHANNEL_0, OBJ_REACTOR_SWITCH, TRUE) set_lights_state(0x007f, LIGHTOP_TRANSITION, 255, 6, 120) set_object_image(OBJ_REACTOR_SWITCH, 0, TVCMDLIST_12) set_object_image(OBJ_REACTOR_SWITCH, 1, TVCMDLIST_12) @@ -2326,7 +2326,7 @@ u8 func1015_shuffle_hatchswitches[] = { \ label(0x07) \ assign_sound(SFX_043A, CHANNEL_7) \ - control_sound_from_object(CHANNEL_7, switch, TRUE) \ + set_object_sound_playing(CHANNEL_7, switch, TRUE) \ set_object_image(switch, 0, TVCMDLIST_14) \ set_stage_flag(flag) \ \ @@ -2381,40 +2381,40 @@ u8 func101a_badhatchswitches[] = { // 1 label(0x0b) assign_sound(SFX_043A, CHANNEL_7) - control_sound_from_object(CHANNEL_7, OBJ_BADHATCHSWITCH1, TRUE) + set_object_sound_playing(CHANNEL_7, OBJ_BADHATCHSWITCH1, TRUE) yield assign_sound(SFX_01C0, CHANNEL_6) - control_sound_from_object(CHANNEL_6, OBJ_BADHATCHSWITCH1, FALSE) + set_object_sound_playing(CHANNEL_6, OBJ_BADHATCHSWITCH1, FALSE) set_object_image(OBJ_BADHATCHSWITCH1, 0, TVCMDLIST_0F) goto_next(0x04) // 2 label(0x0c) assign_sound(SFX_043A, CHANNEL_7) - control_sound_from_object(CHANNEL_7, OBJ_BADHATCHSWITCH2, TRUE) + set_object_sound_playing(CHANNEL_7, OBJ_BADHATCHSWITCH2, TRUE) yield assign_sound(SFX_01C0, CHANNEL_6) - control_sound_from_object(CHANNEL_6, OBJ_BADHATCHSWITCH2, FALSE) + set_object_sound_playing(CHANNEL_6, OBJ_BADHATCHSWITCH2, FALSE) set_object_image(OBJ_BADHATCHSWITCH2, 0, TVCMDLIST_0F) goto_next(0x04) // 3 label(0x0d) assign_sound(SFX_043A, CHANNEL_7) - control_sound_from_object(CHANNEL_7, OBJ_BADHATCHSWITCH3, TRUE) + set_object_sound_playing(CHANNEL_7, OBJ_BADHATCHSWITCH3, TRUE) yield assign_sound(SFX_01C0, CHANNEL_6) - control_sound_from_object(CHANNEL_6, OBJ_BADHATCHSWITCH3, FALSE) + set_object_sound_playing(CHANNEL_6, OBJ_BADHATCHSWITCH3, FALSE) set_object_image(OBJ_BADHATCHSWITCH3, 0, TVCMDLIST_0F) goto_next(0x04) // 4 label(0x0e) assign_sound(SFX_043A, CHANNEL_7) - control_sound_from_object(CHANNEL_7, OBJ_BADHATCHSWITCH4, TRUE) + set_object_sound_playing(CHANNEL_7, OBJ_BADHATCHSWITCH4, TRUE) yield assign_sound(SFX_01C0, CHANNEL_6) - control_sound_from_object(CHANNEL_6, OBJ_BADHATCHSWITCH4, FALSE) + set_object_sound_playing(CHANNEL_6, OBJ_BADHATCHSWITCH4, FALSE) set_object_image(OBJ_BADHATCHSWITCH4, 0, TVCMDLIST_0F) goto_next(0x04) @@ -2442,7 +2442,7 @@ u8 func101a_badhatchswitches[] = { u8 func101b_reactor_hum[] = { yield assign_sound(SFX_8146, CHANNEL_1) - play_sound_from_object(CHANNEL_1, OBJ_REACTOR_SWITCH, 1, 2000, 3000) + play_repeating_sound_from_object(CHANNEL_1, OBJ_REACTOR_SWITCH, 1, 2000, 3000) set_ailist(CHR_SELF, GAILIST_IDLE) endlist }; diff --git a/src/setups/setupdepo.c b/src/setups/setupdepo.c index cc4f31489..a6b83e68b 100644 --- a/src/setups/setupdepo.c +++ b/src/setups/setupdepo.c @@ -592,7 +592,7 @@ u8 func1008_check_generator[] = { mute_channel(CHANNEL_4) mute_channel(CHANNEL_0) assign_sound(SFX_8147, CHANNEL_0) - control_sound_from_object(CHANNEL_0, OBJ_GENERATOR, TRUE) + set_object_sound_playing(CHANNEL_0, OBJ_GENERATOR, TRUE) show_hudmsg(CHR_P1P2, L_DEPO_025) // "Damping field generator shut down." set_stage_flag(STAGEFLAG_GENERATOR_SHUT_DOWN2) set_stage_flag(STAGEFLAG_GENERATOR_SHUT_DOWN) @@ -607,7 +607,7 @@ u8 func1008_check_generator[] = { u8 func1003_laser_switch_1[] = { assign_sound(SFX_8119, CHANNEL_0) - play_sound_from_object(CHANNEL_0, OBJ_LASER_1A, 1, 300, 400) + play_repeating_sound_from_object(CHANNEL_0, OBJ_LASER_1A, 1, 300, 400) beginloop(0x04) chr_toggle_p1p2(CHR_SELF) @@ -656,7 +656,7 @@ u8 func1003_laser_switch_1[] = { assign_sound(SFX_043F, CHANNEL_7) play_sound_from_entity(CHANNEL_7, OBJ_LASERSWITCH1, 0x012c, 0x0190, 0x00) assign_sound(SFX_8119, CHANNEL_0) - play_sound_from_object(CHANNEL_0, OBJ_LASER_1A, 1, 300, 400) + play_repeating_sound_from_object(CHANNEL_0, OBJ_LASER_1A, 1, 300, 400) goto_next(0x0a) label(0x0a) restart_timer @@ -673,7 +673,7 @@ u8 func1003_laser_switch_1[] = { u8 func1004_laser_switch_2[] = { assign_sound(SFX_8119, CHANNEL_1) - play_sound_from_object(CHANNEL_1, OBJ_LASER_2A, 1, 300, 400) + play_repeating_sound_from_object(CHANNEL_1, OBJ_LASER_2A, 1, 300, 400) beginloop(0x04) chr_toggle_p1p2(CHR_SELF) @@ -723,7 +723,7 @@ u8 func1004_laser_switch_2[] = { assign_sound(SFX_043F, CHANNEL_7) play_sound_from_entity(CHANNEL_7, OBJ_LASERSWITCH2, 0x012c, 0x0190, 0x00) assign_sound(SFX_8119, CHANNEL_1) - play_sound_from_object(CHANNEL_1, OBJ_LASER_2A, 1, 300, 400) + play_repeating_sound_from_object(CHANNEL_1, OBJ_LASER_2A, 1, 300, 400) goto_next(0x0a) label(0x0a) restart_timer @@ -740,7 +740,7 @@ u8 func1004_laser_switch_2[] = { u8 func1005_laser_switch_3[] = { assign_sound(SFX_8119, CHANNEL_2) - play_sound_from_object(CHANNEL_2, OBJ_LASER_3A, 1, 300, 400) + play_repeating_sound_from_object(CHANNEL_2, OBJ_LASER_3A, 1, 300, 400) beginloop(0x04) chr_toggle_p1p2(CHR_SELF) @@ -789,7 +789,7 @@ u8 func1005_laser_switch_3[] = { assign_sound(SFX_043F, CHANNEL_7) play_sound_from_entity(CHANNEL_7, OBJ_LASERSWITCH3, 0x012c, 0x0190, 0x00) assign_sound(SFX_8119, CHANNEL_2) - play_sound_from_object(CHANNEL_2, OBJ_LASER_3A, 1, 300, 400) + play_repeating_sound_from_object(CHANNEL_2, OBJ_LASER_3A, 1, 300, 400) goto_next(0x0a) label(0x0a) restart_timer @@ -806,7 +806,7 @@ u8 func1005_laser_switch_3[] = { u8 func1006_laser_switch_4[] = { assign_sound(SFX_811A, CHANNEL_3) - play_sound_from_object(CHANNEL_3, OBJ_LASER_4A, 1, 300, 400) + play_repeating_sound_from_object(CHANNEL_3, OBJ_LASER_4A, 1, 300, 400) beginloop(0x04) chr_toggle_p1p2(CHR_SELF) @@ -855,7 +855,7 @@ u8 func1006_laser_switch_4[] = { assign_sound(SFX_043F, CHANNEL_7) play_sound_from_entity(CHANNEL_7, OBJ_LASERSWITCH4, 0x012c, 0x0190, 0x00) assign_sound(SFX_811A, CHANNEL_3) - play_sound_from_object(CHANNEL_3, OBJ_LASER_4A, 1, 300, 400) + play_repeating_sound_from_object(CHANNEL_3, OBJ_LASER_4A, 1, 300, 400) goto_next(0x0a) label(0x0a) restart_timer @@ -1367,7 +1367,7 @@ u8 func1010_safe_cracking[] = { move_object_to_pad(OBJ_DECODER, PAD_DEPO_0075) set_stage_flag(STAGEFLAG_DECODER_ATTACHED) assign_sound(SFX_8144, CHANNEL_1) - play_sound_from_object(CHANNEL_1, OBJ_SAFEKEYPAD, 1, 300, 400) + play_repeating_sound_from_object(CHANNEL_1, OBJ_SAFEKEYPAD, 1, 300, 400) restart_timer beginloop(0x09) @@ -1406,7 +1406,7 @@ u8 func1010_safe_cracking[] = { label(0x06) mute_channel(CHANNEL_1) assign_sound(SFX_8145, CHANNEL_1) - control_sound_from_object(CHANNEL_1, OBJ_SAFEKEYPAD, TRUE) + set_object_sound_playing(CHANNEL_1, OBJ_SAFEKEYPAD, TRUE) show_hudmsg(CHR_P1P2, L_DEPO_037) // "Door Decoder finished - door unlocked." unlock_door(OBJ_SAFEDOOR, 0x40) unset_object_flag2(OBJ_SAFEDOOR, OBJFLAG2_AICANNOTUSE) @@ -1906,14 +1906,14 @@ u8 func040e_meeting_cutscene[] = { speak(CHR_BOND, L_DEPO_074, MP3_040E, CHANNEL_5, COLOR_04_ORANGE) // "No one could have predicted that! And I resent bei..." wait_until(1780, 0x5e) - play_sound_from_object2(CHANNEL_6, 0x3a, SFX_01D5, 0x00, 0x00) + play_sound_from_object2(CHANNEL_6, 0x3a, SFX_01D5, PSTYPE_NONE, 0) wait_until(2050, 0x60) - play_sound_from_object2(CHANNEL_7, 0x3a, SFX_00EC, 0x00, 0x00) + play_sound_from_object2(CHANNEL_7, 0x3a, SFX_00EC, PSTYPE_NONE, 0) wait_until(2070, 0x5f) open_door(0x3a) - play_sound_from_object2(0x0a, 0x3a, SFX_DOOR_81B0, 0x00, 0x00) + play_sound_from_object2(0x0a, 0x3a, SFX_DOOR_81B0, PSTYPE_NONE, 0) wait_until(2195, 0x61) play_sound(SFX_0171, CHANNEL_6) @@ -2064,7 +2064,7 @@ u8 func040e_meeting_cutscene[] = { stop_ambient_track enter_firstperson set_stage_flag(STAGEFLAG_MEETING_FINISHED) - mute_channel(CHANNEL_10) + mute_channel(CHANNEL_CUTSCENE) mute_channel(CHANNEL_7) mute_channel(CHANNEL_6) mute_channel(CHANNEL_5) @@ -2239,7 +2239,7 @@ u8 func1018_intro_from_menu[] = { u8 func1019_generator_hum[] = { yield assign_sound(SFX_8146, CHANNEL_4) - play_sound_from_object(CHANNEL_4, OBJ_GENERATOR, 1, 1600, 2200) + play_repeating_sound_from_object(CHANNEL_4, OBJ_GENERATOR, 1, 1600, 2200) set_ailist(CHR_SELF, GAILIST_IDLE) endlist }; diff --git a/src/setups/setupdish.c b/src/setups/setupdish.c index dfe7410c3..db4ee5005 100644 --- a/src/setups/setupdish.c +++ b/src/setups/setupdish.c @@ -1180,7 +1180,7 @@ u8 func1004_devicetraining_doordecoder[] = { show_hudmsg(CHR_BOND, L_DISH_027) // "Decoder attached. Initiating cracking routines..." unset_object_flag2(0x88, OBJFLAG2_INVISIBLE) assign_sound(SFX_8144, CHANNEL_1) - play_sound_from_object(CHANNEL_1, 0x35, 1, 300, 400) + play_repeating_sound_from_object(CHANNEL_1, 0x35, 1, 300, 400) restart_timer beginloop(0x0c) @@ -1199,7 +1199,7 @@ u8 func1004_devicetraining_doordecoder[] = { label(0x2f) mute_channel(CHANNEL_1) assign_sound(SFX_8145, CHANNEL_1) - control_sound_from_object(CHANNEL_1, 0x35, TRUE) + set_object_sound_playing(CHANNEL_1, 0x35, TRUE) remove_hudmsgs show_hudmsg(CHR_BOND, L_DISH_028) // "Decoding complete. Door has been unlocked." unlock_door(0x41, 0x40) @@ -2289,7 +2289,7 @@ u8 func100b_devicetraining_uplink[] = { set_stage_flag(STAGEFLAG_TRIGGER_CANNOTEXIT_MSG) label(0x59) assign_sound(SFX_01BF, CHANNEL_5) - control_sound_from_object(CHANNEL_5, 0x30, TRUE) + set_object_sound_playing(CHANNEL_5, 0x30, TRUE) label(0x14) yield if_stage_flag_eq(STAGEFLAG_DEVICE_ABORTING, TRUE, /*goto*/ 0x90) @@ -2313,7 +2313,7 @@ u8 func100b_devicetraining_uplink[] = { restart_timer mute_channel(CHANNEL_5) assign_sound(SFX_01C1, CHANNEL_7) - control_sound_from_object(CHANNEL_7, 0x30, TRUE) + set_object_sound_playing(CHANNEL_7, 0x30, TRUE) remove_hudmsgs show_hudmsg(CHR_TARGET, L_DISH_014) // "Terminal has been successfully hacked." @@ -2338,7 +2338,7 @@ u8 func100b_devicetraining_uplink[] = { show_hudmsg(CHR_BOND, L_DISH_015) // "Connection broken - too far from PC." mute_channel(CHANNEL_5) assign_sound(SFX_01C0, CHANNEL_6) - control_sound_from_object(CHANNEL_6, 0x30, TRUE) + set_object_sound_playing(CHANNEL_6, 0x30, TRUE) restart_timer beginloop(0x16) @@ -3737,7 +3737,7 @@ u8 func101c_holo1_main[] = { set_object_image(object, 0, TVCMDLIST_13) \ set_object_flag2(object, OBJFLAG2_INVHIDDEN) \ assign_sound(SFX_043A, CHANNEL_7) \ - control_sound_from_object(CHANNEL_7, object, TRUE) \ + set_object_sound_playing(CHANNEL_7, object, TRUE) \ set_returnlist(CHR_SELF, function) \ set_ailist(CHR_SELF, AILIST_HOLO1_CHECK_DONE) @@ -3777,7 +3777,7 @@ u8 func1020_holo1_monitor_switches[] = { set_object_image(0x4f, 0, TVCMDLIST_13) set_object_flag2(0x4f, OBJFLAG2_INVHIDDEN) assign_sound(SFX_043A, CHANNEL_7) - control_sound_from_object(CHANNEL_7, 0x4f, TRUE) + set_object_sound_playing(CHANNEL_7, 0x4f, TRUE) set_returnlist(CHR_SELF, AILIST_HOLO1_MONITOR_SWITCHES) set_ailist(CHR_SELF, AILIST_HOLO1_CHECK_DONE) endlist @@ -3816,7 +3816,7 @@ u8 func1020_holo1_monitor_switches[] = { remove_hudmsgs \ show_hudmsg(CHR_BOND, msg) \ assign_sound(SFX_DOOR_81B0, CHANNEL_7) \ - control_sound_from_object(CHANNEL_7, object1, TRUE) \ + set_object_sound_playing(CHANNEL_7, object1, TRUE) \ restart_timer \ \ beginloop(0x57) \ @@ -4078,7 +4078,7 @@ u8 func1022_holo2_main[] = { \ label(0x2f) \ assign_sound(SFX_043A, CHANNEL_7) \ - control_sound_from_object(CHANNEL_7, object, TRUE) \ + set_object_sound_playing(CHANNEL_7, object, TRUE) \ set_object_image(object, 0, TVCMDLIST_13) \ set_object_flag2(object, OBJFLAG2_IMMUNETOANTI) \ set_returnlist(CHR_SELF, function) \ @@ -4452,7 +4452,7 @@ u8 func102c_holo3_object1[] = { label(0x2f) assign_sound(SFX_043A, CHANNEL_7) - control_sound_from_object(CHANNEL_7, 0x65, TRUE) + set_object_sound_playing(CHANNEL_7, 0x65, TRUE) set_object_image(0x65, 0, TVCMDLIST_13) set_object_flag2(0x65, OBJFLAG2_IMMUNETOANTI) set_returnlist(CHR_SELF, AILIST_HOLO3_OBJECT1) @@ -4467,7 +4467,7 @@ u8 func102d_holo3_object2[] = { label(0x2f) assign_sound(SFX_043A, CHANNEL_7) - control_sound_from_object(CHANNEL_7, 0x65, TRUE) + set_object_sound_playing(CHANNEL_7, 0x65, TRUE) set_object_image(0x66, 0, TVCMDLIST_13) set_object_flag2(0x66, OBJFLAG2_IMMUNETOANTI) set_returnlist(CHR_SELF, AILIST_HOLO3_OBJECT2) diff --git a/src/setups/setupear.c b/src/setups/setupear.c index 0e211f6d9..c24a0f2c4 100644 --- a/src/setups/setupear.c +++ b/src/setups/setupear.c @@ -1110,7 +1110,7 @@ u8 func0404_scientist[] = { set_stage_flag(STAGEFLAG_SHUT_DOWN_EXPERIMENT3) say_quip(CHR_TARGET, 0x0d, 0xff, 0x00, 0xff, 0x81, 0x06, 0x08) assign_sound(SFX_01C3, CHANNEL_5) - control_sound_from_object(CHANNEL_5, OBJ_GOODTERM3, TRUE) + set_object_sound_playing(CHANNEL_5, OBJ_GOODTERM3, TRUE) goto_next(0x0f) label(0x06) @@ -1127,7 +1127,7 @@ u8 func0404_scientist[] = { set_stage_flag(STAGEFLAG_SHUT_DOWN_EXPERIMENT1) say_quip(CHR_TARGET, 0x0d, 0xff, 0x00, 0xff, 0x81, 0x06, 0x08) assign_sound(SFX_01C3, CHANNEL_5) - control_sound_from_object(CHANNEL_5, OBJ_GOODTERM1, TRUE) + set_object_sound_playing(CHANNEL_5, OBJ_GOODTERM1, TRUE) goto_next(0x0f) label(0x2f) @@ -1144,7 +1144,7 @@ u8 func0404_scientist[] = { set_stage_flag(STAGEFLAG_SHUT_DOWN_EXPERIMENT2) say_quip(CHR_TARGET, 0x0d, 0xff, 0x00, 0xff, 0x81, 0x06, 0x08) assign_sound(SFX_01C3, CHANNEL_5) - control_sound_from_object(CHANNEL_5, OBJ_GOODTERM2, TRUE) + set_object_sound_playing(CHANNEL_5, OBJ_GOODTERM2, TRUE) goto_next(0x0f) label(0x0f) @@ -1268,7 +1268,7 @@ u8 func0406_nasty_scientist[] = { label(0x30) set_stage_flag(STAGEFLAG_ALARM3_ACTIVE) assign_sound(SFX_TYPING_8118, CHANNEL_6) - control_sound_from_object(CHANNEL_6, OBJ_GOODTERM3, TRUE) + set_object_sound_playing(CHANNEL_6, OBJ_GOODTERM3, TRUE) goto_next(0x0f) label(0x06) @@ -1278,7 +1278,7 @@ u8 func0406_nasty_scientist[] = { label(0x30) set_stage_flag(STAGEFLAG_ALARM1_ACTIVE) assign_sound(SFX_TYPING_8118, CHANNEL_6) - control_sound_from_object(CHANNEL_6, OBJ_GOODTERM1, TRUE) + set_object_sound_playing(CHANNEL_6, OBJ_GOODTERM1, TRUE) goto_next(0x0f) label(0x2f) @@ -1288,7 +1288,7 @@ u8 func0406_nasty_scientist[] = { label(0x30) set_stage_flag(STAGEFLAG_ALARM2_ACTIVE) assign_sound(SFX_TYPING_8118, CHANNEL_6) - control_sound_from_object(CHANNEL_6, OBJ_GOODTERM2, TRUE) + set_object_sound_playing(CHANNEL_6, OBJ_GOODTERM2, TRUE) goto_next(0x0f) label(0x11) @@ -1328,7 +1328,7 @@ u8 func1009_weaponscache[] = { show_hudmsg(CHR_TARGET, L_EAR_098) // "Secret weapons compartment opened." play_sound(SFX_00F7, -1) assign_sound(SFX_043B, CHANNEL_5) - control_sound_from_object(CHANNEL_5, OBJ_CMP150_1, TRUE) + set_object_sound_playing(CHANNEL_5, OBJ_CMP150_1, TRUE) disable_object(OBJ_CACHEDOOR1) disable_object(OBJ_CACHEDOOR2) unset_object_flag(OBJ_CMP150_1, OBJFLAG_UNCOLLECTABLE) @@ -1379,7 +1379,7 @@ u8 func1002_bot_activation_terminal[] = { // Activating prior to reprogramming play_sound(SFX_01CA, -1) assign_sound(SFX_01C5, CHANNEL_3) - play_sound_from_object(CHANNEL_3, OBJ_PURPLEBOT, 1, 600, 800) + play_repeating_sound_from_object(CHANNEL_3, OBJ_PURPLEBOT, 1, 600, 800) show_hudmsg(CHR_TARGET, L_EAR_015) // "Maintenance robots activated." set_stage_flag(STAGEFLAG_BOT_ACTIVE) set_stage_flag(STAGEFLAG_BOT_ACTIVE_NOPROGRAM) @@ -1678,7 +1678,7 @@ u8 func1006_terminal_activation[] = { label(0x2f) show_hudmsg(CHR_TARGET, L_EAR_028) // "Powering down active systems." assign_sound(SFX_01C3, CHANNEL_5) - control_sound_from_object(CHANNEL_5, OBJ_GOODTERM1, TRUE) + set_object_sound_playing(CHANNEL_5, OBJ_GOODTERM1, TRUE) restart_timer beginloop(0x0a) @@ -1707,7 +1707,7 @@ u8 func1006_terminal_activation[] = { label(0x2f) show_hudmsg(CHR_TARGET, L_EAR_028) // "Powering down active systems." assign_sound(SFX_01C3, CHANNEL_5) - control_sound_from_object(CHANNEL_5, OBJ_GOODTERM2, TRUE) + set_object_sound_playing(CHANNEL_5, OBJ_GOODTERM2, TRUE) restart_timer beginloop(0x0e) @@ -1736,7 +1736,7 @@ u8 func1006_terminal_activation[] = { label(0x2f) show_hudmsg(CHR_TARGET, L_EAR_028) // "Powering down active systems." assign_sound(SFX_01C3, CHANNEL_5) - control_sound_from_object(CHANNEL_5, OBJ_GOODTERM3, TRUE) + set_object_sound_playing(CHANNEL_5, OBJ_GOODTERM3, TRUE) restart_timer beginloop(0x10) @@ -1854,7 +1854,7 @@ u8 func1007_uplink[] = { restart_timer set_stage_flag(STAGEFLAG_UPLINK_SEARCHING) assign_sound(SFX_01BF, CHANNEL_5) - control_sound_from_object(CHANNEL_5, OBJ_UPLINKPC, TRUE) + set_object_sound_playing(CHANNEL_5, OBJ_UPLINKPC, TRUE) beginloop(0x14) if_object_in_good_condition(OBJ_UPLINKPC, /*goto*/ 0x30) @@ -1871,7 +1871,7 @@ u8 func1007_uplink[] = { label(0x06) mute_channel(CHANNEL_5) assign_sound(SFX_01C1, CHANNEL_6) - control_sound_from_object(CHANNEL_6, OBJ_UPLINKPC, TRUE) + set_object_sound_playing(CHANNEL_6, OBJ_UPLINKPC, TRUE) show_hudmsg(CHR_TARGET, L_EAR_039) // "Password located - bypassing lock." yield show_hudmsg(CHR_TARGET, L_EAR_017) // "Security doors unlocked." @@ -1884,7 +1884,7 @@ u8 func1007_uplink[] = { label(0x06) assign_sound(SFX_043B, CHANNEL_6) - control_sound_from_object(CHANNEL_6, 0x22, TRUE) + set_object_sound_playing(CHANNEL_6, 0x22, TRUE) reloop(0x04) // Moved away from PC or switched weapon @@ -1893,7 +1893,7 @@ u8 func1007_uplink[] = { mute_channel(CHANNEL_5) mute_channel(CHANNEL_6) assign_sound(SFX_01C0, CHANNEL_6) - control_sound_from_object(CHANNEL_6, OBJ_UPLINKPC, TRUE) + set_object_sound_playing(CHANNEL_6, OBJ_UPLINKPC, TRUE) restart_timer beginloop(0x16) @@ -1916,7 +1916,7 @@ u8 func1007_uplink[] = { mute_channel(CHANNEL_5) mute_channel(CHANNEL_6) assign_sound(SFX_01C0, CHANNEL_6) - control_sound_from_object(CHANNEL_6, OBJ_UPLINKPC, TRUE) + set_object_sound_playing(CHANNEL_6, OBJ_UPLINKPC, TRUE) restart_timer beginloop(0x17) @@ -2274,16 +2274,16 @@ u8 func0416_intro[] = { play_sound(SFX_01D5, CHANNEL_7) wait_until(250, 0x57) - play_sound(SFX_00EC, CHANNEL_10) + play_sound(SFX_00EC, CHANNEL_CUTSCENE) wait_until(270, 0x58) - play_sound(SFX_0171, CHANNEL_10) + play_sound(SFX_0171, CHANNEL_CUTSCENE) wait_until(290, 0x59) - play_sound(SFX_0172, CHANNEL_10) + play_sound(SFX_0172, CHANNEL_CUTSCENE) wait_until(320, 0x5a) - play_sound(SFX_0174, CHANNEL_10) + play_sound(SFX_0174, CHANNEL_CUTSCENE) wait_until(380, 0x5b) open_door(0x24) @@ -2727,17 +2727,17 @@ u8 func1012_start_laser_sound[] = { label(0x04) yield assign_sound(SFX_8119, CHANNEL_0) - play_sound_from_object(CHANNEL_0, 0x28, 1, 300, 400) + play_repeating_sound_from_object(CHANNEL_0, 0x28, 1, 300, 400) label(0x2f) assign_sound(SFX_811A, CHANNEL_1) - play_sound_from_object(CHANNEL_1, 0x2d, 1, 300, 400) + play_repeating_sound_from_object(CHANNEL_1, 0x2d, 1, 300, 400) label(0x2f) assign_sound(SFX_8119, CHANNEL_2) - play_sound_from_object(CHANNEL_2, 0x32, 1, 300, 400) + play_repeating_sound_from_object(CHANNEL_2, 0x32, 1, 300, 400) assign_sound(SFX_01C5, CHANNEL_3) - play_sound_from_object(CHANNEL_3, 0x38, 1, 600, 800) + play_repeating_sound_from_object(CHANNEL_3, 0x38, 1, 600, 800) assign_sound(SFX_01C5, CHANNEL_4) - play_sound_from_object(CHANNEL_4, 0x37, 1, 600, 800) + play_repeating_sound_from_object(CHANNEL_4, 0x37, 1, 600, 800) set_ailist(CHR_SELF, GAILIST_IDLE) endlist }; diff --git a/src/setups/setupeld.c b/src/setups/setupeld.c index 641767d66..760548544 100644 --- a/src/setups/setupeld.c +++ b/src/setups/setupeld.c @@ -1970,12 +1970,12 @@ u8 func1007_cooling_switch[] = { label(0x06) assign_sound(SFX_043A, CHANNEL_7) - control_sound_from_object(CHANNEL_7, OBJ_COOLING_SWITCH, TRUE) + set_object_sound_playing(CHANNEL_7, OBJ_COOLING_SWITCH, TRUE) if_stage_flag_eq(STAGEFLAG_COOLING_ACTIVE, TRUE, /*goto*/ 0x06) show_hudmsg(CHR_P1P2, L_ELD_014) // "Cooling systems have been activated." set_stage_flag(STAGEFLAG_COOLING_ACTIVE) assign_sound(SFX_8148, CHANNEL_1) - control_sound_from_object(CHANNEL_1, OBJ_COOLING_SWITCH, TRUE) + set_object_sound_playing(CHANNEL_1, OBJ_COOLING_SWITCH, TRUE) restart_timer beginloop(0x08) @@ -1984,19 +1984,19 @@ u8 func1007_cooling_switch[] = { label(0x2d) assign_sound(SFX_811C, CHANNEL_1) - play_sound_from_object(CHANNEL_1, OBJ_COOLING_SWITCH, 1, 1200, 1600) + play_repeating_sound_from_object(CHANNEL_1, OBJ_COOLING_SWITCH, 1, 1200, 1600) reloop(0x04) label(0x06) mute_channel(CHANNEL_1) assign_sound(SFX_043A, CHANNEL_7) - control_sound_from_object(CHANNEL_7, OBJ_COOLING_SWITCH, TRUE) + set_object_sound_playing(CHANNEL_7, OBJ_COOLING_SWITCH, TRUE) if_stage_flag_eq(STAGEFLAG_WINDMILL_ACTIVATED, FALSE, /*goto*/ 0x2d) show_hudmsg(CHR_P1P2, L_ELD_048) // "Operation denied - windmill is active." goto_next(0x67) label(0x2d) assign_sound(SFX_8149, CHANNEL_1) - control_sound_from_object(CHANNEL_1, OBJ_COOLING_SWITCH, TRUE) + set_object_sound_playing(CHANNEL_1, OBJ_COOLING_SWITCH, TRUE) show_hudmsg(CHR_P1P2, L_ELD_015) // "Cooling systems have been deactivated." unset_stage_flag(STAGEFLAG_COOLING_ACTIVE) label(0x67) @@ -2020,12 +2020,12 @@ u8 func1008_power_switch[] = { label(0x06) assign_sound(SFX_043A, CHANNEL_7) - control_sound_from_object(CHANNEL_7, OBJ_POWER_SWITCH, TRUE) + set_object_sound_playing(CHANNEL_7, OBJ_POWER_SWITCH, TRUE) if_stage_flag_eq(STAGEFLAG_POWER_ACTIVE, TRUE, /*goto*/ 0x06) show_hudmsg(CHR_P1P2, L_ELD_016) // "Power systems have been activated." set_stage_flag(STAGEFLAG_POWER_ACTIVE) assign_sound(SFX_8148, CHANNEL_0) - control_sound_from_object(CHANNEL_0, OBJ_POWER_SWITCH, TRUE) + set_object_sound_playing(CHANNEL_0, OBJ_POWER_SWITCH, TRUE) restart_timer beginloop(0x08) @@ -2034,19 +2034,19 @@ u8 func1008_power_switch[] = { label(0x2d) assign_sound(SFX_8146, CHANNEL_0) - play_sound_from_object(CHANNEL_0, OBJ_POWER_SWITCH, 1, 1200, 1600) + play_repeating_sound_from_object(CHANNEL_0, OBJ_POWER_SWITCH, 1, 1200, 1600) reloop(0x04) label(0x06) mute_channel(CHANNEL_0) assign_sound(SFX_043A, CHANNEL_7) - control_sound_from_object(CHANNEL_7, OBJ_POWER_SWITCH, TRUE) + set_object_sound_playing(CHANNEL_7, OBJ_POWER_SWITCH, TRUE) if_stage_flag_eq(STAGEFLAG_WINDMILL_ACTIVATED, FALSE, /*goto*/ 0x2d) show_hudmsg(CHR_P1P2, L_ELD_048) // "Operation denied - windmill is active." goto_next(0x67) label(0x2d) assign_sound(SFX_8149, CHANNEL_0) - control_sound_from_object(CHANNEL_0, OBJ_POWER_SWITCH, TRUE) + set_object_sound_playing(CHANNEL_0, OBJ_POWER_SWITCH, TRUE) show_hudmsg(CHR_P1P2, L_ELD_017) // "Power systems have been deactivated." unset_stage_flag(STAGEFLAG_POWER_ACTIVE) label(0x67) @@ -2074,9 +2074,9 @@ u8 func1009_windmill_switch[] = { // Activating assign_sound(SFX_043A, CHANNEL_7) - control_sound_from_object(CHANNEL_7, OBJ_WINDMILL_SWITCH, TRUE) + set_object_sound_playing(CHANNEL_7, OBJ_WINDMILL_SWITCH, TRUE) assign_sound(SFX_8148, CHANNEL_2) - control_sound_from_object(CHANNEL_2, OBJ_WINDMILL_SWITCH, TRUE) + set_object_sound_playing(CHANNEL_2, OBJ_WINDMILL_SWITCH, TRUE) restart_timer beginloop(0x08) @@ -2085,7 +2085,7 @@ u8 func1009_windmill_switch[] = { label(0x2d) assign_sound(SFX_0438, CHANNEL_2) - play_sound_from_object(CHANNEL_2, OBJ_WINDMILL_SWITCH, 1, 1800, 2400) + play_repeating_sound_from_object(CHANNEL_2, OBJ_WINDMILL_SWITCH, 1, 1800, 2400) show_hudmsg(CHR_P1P2, L_ELD_018) // "Windmill has been reactivated." yield set_stage_flag(STAGEFLAG_WINDMILL_ACTIVATED) @@ -2097,7 +2097,7 @@ u8 func1009_windmill_switch[] = { // Cooling and power not active label(0x06) assign_sound(SFX_MENU_SUBFOCUS, CHANNEL_7) - control_sound_from_object(CHANNEL_7, OBJ_WINDMILL_SWITCH, TRUE) + set_object_sound_playing(CHANNEL_7, OBJ_WINDMILL_SWITCH, TRUE) restart_timer beginloop(0x09) diff --git a/src/setups/setupimp.c b/src/setups/setupimp.c index b0f11ec66..07906c047 100644 --- a/src/setups/setupimp.c +++ b/src/setups/setupimp.c @@ -917,19 +917,19 @@ u8 func0c01_outro[] = { label(0x08) wait_until(86, 0x73) - play_sound(SFX_0161, CHANNEL_10) + play_sound(SFX_0161, CHANNEL_CUTSCENE) wait_until(114, 0x74) - play_sound(SFX_0162, CHANNEL_10) + play_sound(SFX_0162, CHANNEL_CUTSCENE) wait_until(140, 0x75) - play_sound(SFX_0163, CHANNEL_10) + play_sound(SFX_0163, CHANNEL_CUTSCENE) wait_until(168, 0x76) - play_sound(SFX_0164, CHANNEL_10) + play_sound(SFX_0164, CHANNEL_CUTSCENE) wait_until(186, 0x77) - play_sound(SFX_0161, CHANNEL_10) + play_sound(SFX_0161, CHANNEL_CUTSCENE) beginloop(0x0a) if_camera_animating(/*goto*/ 0x2e) @@ -941,7 +941,7 @@ u8 func0c01_outro[] = { endloop(0x0a) label(0xb8) - mute_channel(CHANNEL_10) + mute_channel(CHANNEL_CUTSCENE) disable_object(0x0d) camera_movement(ANIM_CUT_IMP_OUTRO_CAM_02) unset_chr_chrflag(CHR_SKEDAR1, CHRCFLAG_HIDDEN) @@ -958,10 +958,10 @@ u8 func0c01_outro[] = { chr_do_animation(ANIM_CUT_IMP_OUTRO_SKEDAR2, -1, -1, CHRANIMFLAG_MOVEWHENINVIS | CHRANIMFLAG_PAUSEATEND, 0, CHR_SKEDAR2, 4) wait_until(16, 0x78) - play_sound(SFX_SKEDAR_ROAR_0530, CHANNEL_10) + play_sound(SFX_SKEDAR_ROAR_0530, CHANNEL_CUTSCENE) wait_until(56, 0x79) - play_sound(SFX_SKEDAR_ROAR_052B, CHANNEL_10) + play_sound(SFX_SKEDAR_ROAR_052B, CHANNEL_CUTSCENE) beginloop(0x0b) if_camera_animating(/*goto*/ 0x2e) @@ -973,7 +973,7 @@ u8 func0c01_outro[] = { endloop(0x0b) label(0xb8) - mute_channel(CHANNEL_10) + mute_channel(CHANNEL_CUTSCENE) camera_movement(ANIM_CUT_IMP_OUTRO_CAM_03) set_chr_chrflag(CHR_P1P2, CHRCFLAG_UNPLAYABLE) #if VERSION >= VERSION_NTSC_1_0 @@ -997,52 +997,52 @@ u8 func0c01_outro[] = { object_do_animation(ANIM_CUT_IMP_OUTRO_LASER1, 0x16, 0x02, 0xffff) wait_until(372, 0x7a) - play_sound(SFX_0506, CHANNEL_10) + play_sound(SFX_0506, CHANNEL_CUTSCENE) wait_until(382, 0x7b) - play_sound(SFX_0048, CHANNEL_10) + play_sound(SFX_0048, CHANNEL_CUTSCENE) wait_until(390, 0x7c) - play_sound(SFX_0506, CHANNEL_10) + play_sound(SFX_0506, CHANNEL_CUTSCENE) wait_until(400, 0x7d) - play_sound(SFX_0049, CHANNEL_10) + play_sound(SFX_0049, CHANNEL_CUTSCENE) wait_until(432, 0x7e) - play_sound(SFX_0506, CHANNEL_10) + play_sound(SFX_0506, CHANNEL_CUTSCENE) wait_until(442, 0x7f) - play_sound(SFX_00D0, CHANNEL_10) + play_sound(SFX_00D0, CHANNEL_CUTSCENE) wait_until(454, 0x80) - play_sound(SFX_0506, CHANNEL_10) + play_sound(SFX_0506, CHANNEL_CUTSCENE) wait_until(464, 0x81) - play_sound(SFX_0078, CHANNEL_10) + play_sound(SFX_0078, CHANNEL_CUTSCENE) wait_until(466, 0x82) - play_sound(SFX_0161, CHANNEL_10) + play_sound(SFX_0161, CHANNEL_CUTSCENE) wait_until(484, 0x83) - play_sound(SFX_0162, CHANNEL_10) + play_sound(SFX_0162, CHANNEL_CUTSCENE) wait_until(502, 0x84) - play_sound(SFX_0164, CHANNEL_10) + play_sound(SFX_0164, CHANNEL_CUTSCENE) wait_until(516, 0x85) - play_sound(SFX_0163, CHANNEL_10) + play_sound(SFX_0163, CHANNEL_CUTSCENE) wait_until(528, 0x86) - play_sound(SFX_0162, CHANNEL_10) + play_sound(SFX_0162, CHANNEL_CUTSCENE) wait_until(570, 0x71) - speak(CHR_BOND, L_IMP_049, MP3_047D, CHANNEL_10, COLOR_09_BLUE) // "Get clear! I'll hold them off... You can come back..." + speak(CHR_BOND, L_IMP_049, MP3_047D, CHANNEL_CUTSCENE, COLOR_09_BLUE) // "Get clear! I'll hold them off... You can come back..." wait_until(847, 0x87) - play_sound(SFX_0161, CHANNEL_10) + play_sound(SFX_0161, CHANNEL_CUTSCENE) wait_until(852, 0x88) - play_sound(SFX_0162, CHANNEL_10) + play_sound(SFX_0162, CHANNEL_CUTSCENE) wait_until(865, 0x72) set_chr_shooting_in_cutscene(CHR_BOND, TRUE) @@ -1064,7 +1064,7 @@ u8 func0c01_outro[] = { label(0x08) set_chr_shooting_in_cutscene(CHR_BOND, FALSE) - speak(CHR_BOND, L_IMP_050, MP3_047E, CHANNEL_10, COLOR_09_BLUE) // "At least, I hope you can." + speak(CHR_BOND, L_IMP_050, MP3_047E, CHANNEL_CUTSCENE, COLOR_09_BLUE) // "At least, I hope you can." wait_until(1018, 0x8c) set_chr_shooting_in_cutscene(CHR_BOND, TRUE) @@ -1088,7 +1088,7 @@ u8 func0c01_outro[] = { goto_first(0x0c) label(0xb8) - mute_channel(CHANNEL_10) + mute_channel(CHANNEL_CUTSCENE) camera_movement(ANIM_CUT_IMP_OUTRO_CAM_04) set_chr_chrflag(CHR_P1P2, CHRCFLAG_UNPLAYABLE) #if VERSION >= VERSION_NTSC_1_0 @@ -1111,23 +1111,23 @@ u8 func0c01_outro[] = { show_object_with_animation(0x14, ANIM_CUT_IMP_OUTRO_CRATE7_03) wait_until(1090, 0x95) - play_sound(SFX_SKEDAR_ROAR_0529, CHANNEL_10) + play_sound(SFX_SKEDAR_ROAR_0529, CHANNEL_CUTSCENE) wait_until(1100, 0x96) - play_sound(SFX_SKEDAR_ROAR_052A, CHANNEL_10) + play_sound(SFX_SKEDAR_ROAR_052A, CHANNEL_CUTSCENE) wait_until(1264, 0x97) - play_sound(SFX_00E3, CHANNEL_10) + play_sound(SFX_00E3, CHANNEL_CUTSCENE) wait_until(1280, 0x98) - play_sound(SFX_00E4, CHANNEL_10) + play_sound(SFX_00E4, CHANNEL_CUTSCENE) wait_until(1315, 0x99) - play_sound(MP3_07BA, CHANNEL_10) - play_sound(SFX_00EE, CHANNEL_10) + play_sound(MP3_07BA, CHANNEL_CUTSCENE) + play_sound(SFX_00EE, CHANNEL_CUTSCENE) wait_until(1330, 0x9a) - play_sound(SFX_00DF, CHANNEL_10) + play_sound(SFX_00DF, CHANNEL_CUTSCENE) wait_until(1350, 0x9b) set_chr_shooting_in_cutscene(CHR_BOND, TRUE) @@ -1137,8 +1137,8 @@ u8 func0c01_outro[] = { set_chr_shooting_in_cutscene(CHR_BOND, TRUE) yield set_chr_shooting_in_cutscene(CHR_BOND, FALSE) - play_sound(MP3_07BA, CHANNEL_10) - play_sound(SFX_00E4, CHANNEL_10) + play_sound(MP3_07BA, CHANNEL_CUTSCENE) + play_sound(SFX_00E4, CHANNEL_CUTSCENE) beginloop(0x0d) if_camera_animating(/*goto*/ 0x2e) @@ -1150,7 +1150,7 @@ u8 func0c01_outro[] = { endloop(0x0d) label(0xb8) - mute_channel(CHANNEL_10) + mute_channel(CHANNEL_CUTSCENE) stop_cutscene_track stop_ambient_track end_level @@ -1193,208 +1193,208 @@ u8 func1002_intro[] = { set_cutscene_weapon(0x1a, WEAPON_AR34, WEAPON_NONE) wait_until(4, 0x71) - speak(CHR_BOND, L_IMP_041, MP3_0475, CHANNEL_10, COLOR_06_WHITE) // "All ready, Joanna? We can't keep the Maian delegat..." + speak(CHR_BOND, L_IMP_041, MP3_0475, CHANNEL_CUTSCENE, COLOR_06_WHITE) // "All ready, Joanna? We can't keep the Maian delegat..." wait_until(72, 0x72) - play_sound(SFX_0161, CHANNEL_10) + play_sound(SFX_0161, CHANNEL_CUTSCENE) wait_until(104, 0x73) - play_sound(SFX_0162, CHANNEL_10) + play_sound(SFX_0162, CHANNEL_CUTSCENE) wait_until(450, 0x74) - speak(CHR_BOND, L_IMP_042, MP3_0476, CHANNEL_10, COLOR_09_BLUE) // "Am I ready? What do you mean? I was ready half an ..." + speak(CHR_BOND, L_IMP_042, MP3_0476, CHANNEL_CUTSCENE, COLOR_09_BLUE) // "Am I ready? What do you mean? I was ready half an ..." wait_until(688, 0x76) - play_sound(SFX_0163, CHANNEL_10) + play_sound(SFX_0163, CHANNEL_CUTSCENE) wait_until(754, 0x77) - play_sound(SFX_0164, CHANNEL_10) + play_sound(SFX_0164, CHANNEL_CUTSCENE) wait_until(800, 0x75) - speak(CHR_BOND, L_IMP_043, MP3_0477, CHANNEL_10, COLOR_06_WHITE) // "But you know how it is, Joanna... I had to make su..." + speak(CHR_BOND, L_IMP_043, MP3_0477, CHANNEL_CUTSCENE, COLOR_06_WHITE) // "But you know how it is, Joanna... I had to make su..." wait_until(822, 0x78) - play_sound(SFX_0165, CHANNEL_10) + play_sound(SFX_0165, CHANNEL_CUTSCENE) wait_until(850, 0x79) - play_sound(SFX_0166, CHANNEL_10) + play_sound(SFX_0166, CHANNEL_CUTSCENE) wait_until(866, 0x7a) - play_sound(SFX_0167, CHANNEL_10) + play_sound(SFX_0167, CHANNEL_CUTSCENE) wait_until(892, 0x7b) - play_sound(SFX_0168, CHANNEL_10) + play_sound(SFX_0168, CHANNEL_CUTSCENE) wait_until(926, 0x7c) - play_sound(SFX_0161, CHANNEL_10) + play_sound(SFX_0161, CHANNEL_CUTSCENE) wait_until(945, 0x7d) - play_sound(SFX_0162, CHANNEL_10) + play_sound(SFX_0162, CHANNEL_CUTSCENE) wait_until(976, 0x7e) - play_sound(SFX_0161, CHANNEL_10) + play_sound(SFX_0161, CHANNEL_CUTSCENE) wait_until(990, 0x7f) - play_sound(SFX_0163, CHANNEL_10) + play_sound(SFX_0163, CHANNEL_CUTSCENE) wait_until(1030, 0x80) - play_sound(SFX_0162, CHANNEL_10) + play_sound(SFX_0162, CHANNEL_CUTSCENE) wait_until(1048, 0x81) - play_sound(SFX_0168, CHANNEL_10) + play_sound(SFX_0168, CHANNEL_CUTSCENE) wait_until(1102, 0x83) - play_sound(SFX_0167, CHANNEL_10) + play_sound(SFX_0167, CHANNEL_CUTSCENE) wait_until(1110, 0x84) - play_sound(SFX_0164, CHANNEL_10) + play_sound(SFX_0164, CHANNEL_CUTSCENE) wait_until(1158, 0x85) - play_sound(SFX_0165, CHANNEL_10) + play_sound(SFX_0165, CHANNEL_CUTSCENE) wait_until(1160, 0x82) - speak(CHR_BOND, L_IMP_044, MP3_0478, CHANNEL_10, COLOR_09_BLUE) // "They should keep you away from mirrors. Nervous?" + speak(CHR_BOND, L_IMP_044, MP3_0478, CHANNEL_CUTSCENE, COLOR_09_BLUE) // "They should keep you away from mirrors. Nervous?" wait_until(1170, 0x86) - play_sound(SFX_0166, CHANNEL_10) + play_sound(SFX_0166, CHANNEL_CUTSCENE) wait_until(1224, 0x87) - play_sound(SFX_0167, CHANNEL_10) + play_sound(SFX_0167, CHANNEL_CUTSCENE) wait_until(1258, 0x88) - play_sound(SFX_0168, CHANNEL_10) + play_sound(SFX_0168, CHANNEL_CUTSCENE) wait_until(1440, 0x89) - speak(CHR_BOND, L_IMP_045, MP3_0479, CHANNEL_10, COLOR_06_WHITE) // "Very. I've waited for this moment for so many year..." + speak(CHR_BOND, L_IMP_045, MP3_0479, CHANNEL_CUTSCENE, COLOR_06_WHITE) // "Very. I've waited for this moment for so many year..." wait_until(1442, 0x8a) - play_sound(SFX_0162, CHANNEL_10) + play_sound(SFX_0162, CHANNEL_CUTSCENE) wait_until(1450, 0x8b) - play_sound(SFX_0161, CHANNEL_10) + play_sound(SFX_0161, CHANNEL_CUTSCENE) wait_until(1594, 0x8c) - play_sound(SFX_0163, CHANNEL_10) + play_sound(SFX_0163, CHANNEL_CUTSCENE) wait_until(1676, 0x8d) - play_sound(SFX_0164, CHANNEL_10) + play_sound(SFX_0164, CHANNEL_CUTSCENE) wait_until(1741, 0x8e) - play_sound(SFX_0165, CHANNEL_10) + play_sound(SFX_0165, CHANNEL_CUTSCENE) wait_until(2252, 0x8f) - play_sound(SFX_0166, CHANNEL_10) + play_sound(SFX_0166, CHANNEL_CUTSCENE) wait_until(2296, 0x90) - play_sound(SFX_0167, CHANNEL_10) + play_sound(SFX_0167, CHANNEL_CUTSCENE) wait_until(2326, 0x91) - play_sound(SFX_0164, CHANNEL_10) + play_sound(SFX_0164, CHANNEL_CUTSCENE) wait_until(2378, 0x92) - play_sound(SFX_0168, CHANNEL_10) + play_sound(SFX_0168, CHANNEL_CUTSCENE) wait_until(2383, 0x93) - play_sound(SFX_00B5, CHANNEL_10) + play_sound(SFX_00B5, CHANNEL_CUTSCENE) wait_until(2410, 0x94) - speak(CHR_BOND, L_IMP_046, MP3_047A, CHANNEL_10, COLOR_06_WHITE) // "Where did that come from?" + speak(CHR_BOND, L_IMP_046, MP3_047A, CHANNEL_CUTSCENE, COLOR_06_WHITE) // "Where did that come from?" wait_until(2416, 0x95) - play_sound(SFX_0165, CHANNEL_10) + play_sound(SFX_0165, CHANNEL_CUTSCENE) wait_until(2446, 0x96) - play_sound(SFX_0166, CHANNEL_10) + play_sound(SFX_0166, CHANNEL_CUTSCENE) wait_until(2510, 0x97) - play_sound(SFX_00AD, CHANNEL_10) + play_sound(SFX_00AD, CHANNEL_CUTSCENE) wait_until(2566, 0x98) - play_sound(SFX_0161, CHANNEL_10) + play_sound(SFX_0161, CHANNEL_CUTSCENE) wait_until(2582, 0x99) - play_sound(SFX_00B2, CHANNEL_10) + play_sound(SFX_00B2, CHANNEL_CUTSCENE) wait_until(2628, 0x9b) - speak(CHR_BOND, L_IMP_047, MP3_047B, CHANNEL_10, COLOR_09_BLUE) // "It was up on ground level..." + speak(CHR_BOND, L_IMP_047, MP3_047B, CHANNEL_CUTSCENE, COLOR_09_BLUE) // "It was up on ground level..." wait_until(2804, 0x9c) - play_sound(SFX_00B5, CHANNEL_10) + play_sound(SFX_00B5, CHANNEL_CUTSCENE) wait_until(2910, 0x9e) - play_sound(SFX_0165, CHANNEL_10) + play_sound(SFX_0165, CHANNEL_CUTSCENE) set_cutscene_weapon(0x1a, WEAPON_NONE, WEAPON_NONE) set_cutscene_weapon(CHR_BOND, WEAPON_AR34, WEAPON_NONE) wait_until(2940, 0x9f) - play_sound(SFX_M2_HEY, CHANNEL_10) + play_sound(SFX_M2_HEY, CHANNEL_CUTSCENE) wait_until(2965, 0xa0) - play_sound(SFX_0168, CHANNEL_10) + play_sound(SFX_0168, CHANNEL_CUTSCENE) wait_until(2970, 0x9d) - speak(CHR_BOND, L_IMP_048, MP3_047C, CHANNEL_10, COLOR_09_BLUE) // "Looks like someone doesn't know when to quit. We'v..." + speak(CHR_BOND, L_IMP_048, MP3_047C, CHANNEL_CUTSCENE, COLOR_09_BLUE) // "Looks like someone doesn't know when to quit. We'v..." wait_until(2984, 0xa1) - play_sound(SFX_0165, CHANNEL_10) + play_sound(SFX_0165, CHANNEL_CUTSCENE) wait_until(3000, 0xa2) - play_sound(SFX_0166, CHANNEL_10) + play_sound(SFX_0166, CHANNEL_CUTSCENE) wait_until(3106, 0xa3) - play_sound(SFX_0165, CHANNEL_10) + play_sound(SFX_0165, CHANNEL_CUTSCENE) wait_until(3125, 0xa4) - play_sound(SFX_0168, CHANNEL_10) + play_sound(SFX_0168, CHANNEL_CUTSCENE) wait_until(3142, 0xae) - play_sound(SFX_0167, CHANNEL_10) + play_sound(SFX_0167, CHANNEL_CUTSCENE) unset_object_flag2(0x0d, OBJFLAG2_CANFILLVIEWPORT) wait_until(3144, 0xa5) - play_sound(SFX_0166, CHANNEL_10) + play_sound(SFX_0166, CHANNEL_CUTSCENE) wait_until(3169, 0xa6) - play_sound(SFX_0167, CHANNEL_10) + play_sound(SFX_0167, CHANNEL_CUTSCENE) wait_until(3180, 0xaf) - play_sound(SFX_0165, CHANNEL_10) + play_sound(SFX_0165, CHANNEL_CUTSCENE) wait_until(3204, 0xb0) - play_sound(SFX_0168, CHANNEL_10) + play_sound(SFX_0168, CHANNEL_CUTSCENE) wait_until(3228, 0xa7) - play_sound(SFX_0166, CHANNEL_10) + play_sound(SFX_0166, CHANNEL_CUTSCENE) wait_until(3246, 0xa8) - play_sound(SFX_0165, CHANNEL_10) + play_sound(SFX_0165, CHANNEL_CUTSCENE) wait_until(3263, 0xa9) - play_sound(SFX_0168, CHANNEL_10) + play_sound(SFX_0168, CHANNEL_CUTSCENE) wait_until(3295, 0xaa) - play_sound(SFX_0166, CHANNEL_10) + play_sound(SFX_0166, CHANNEL_CUTSCENE) wait_until(3317, 0xab) - play_sound(SFX_0165, CHANNEL_10) + play_sound(SFX_0165, CHANNEL_CUTSCENE) wait_until(3342, 0xac) - play_sound(SFX_0168, CHANNEL_10) + play_sound(SFX_0168, CHANNEL_CUTSCENE) wait_until(3355, 0xb1) - play_sound(SFX_0166, CHANNEL_10) + play_sound(SFX_0166, CHANNEL_CUTSCENE) wait_until(3365, 0xad) - play_sound(SFX_0165, CHANNEL_10) + play_sound(SFX_0165, CHANNEL_CUTSCENE) wait_until(3472, 0xb2) - play_sound(SFX_0164, CHANNEL_10) + play_sound(SFX_0164, CHANNEL_CUTSCENE) wait_until(3498, 0xb3) - play_sound(SFX_0165, CHANNEL_10) + play_sound(SFX_0165, CHANNEL_CUTSCENE) wait_until(3520, 0xb4) - play_sound(SFX_0166, CHANNEL_10) + play_sound(SFX_0166, CHANNEL_CUTSCENE) beginloop(0x0a) if_camera_animating(/*goto*/ 0x2e) @@ -1406,7 +1406,7 @@ u8 func1002_intro[] = { endloop(0x0a) label(0xb8) - mute_channel(CHANNEL_10) + mute_channel(CHANNEL_CUTSCENE) camera_movement(ANIM_CUT_IMP_INTRO_CAM_02) cmd0175(60) unset_object_flag2(0x0d, OBJFLAG2_CANFILLVIEWPORT) @@ -1436,49 +1436,49 @@ u8 func1002_intro[] = { label(0x08) wait_until2(8, 0x62) - play_sound(SFX_SKEDAR_ROAR_052A, CHANNEL_10) + play_sound(SFX_SKEDAR_ROAR_052A, CHANNEL_CUTSCENE) wait_until2(26, 0x65) - play_sound(SFX_05A0, CHANNEL_10) + play_sound(SFX_05A0, CHANNEL_CUTSCENE) wait_until2(38, 0x63) - play_sound(SFX_00E3, CHANNEL_10) + play_sound(SFX_00E3, CHANNEL_CUTSCENE) wait_until2(43, 0x64) - play_sound(SFX_00E4, CHANNEL_10) + play_sound(SFX_00E4, CHANNEL_CUTSCENE) wait_until2(63, 0x66) - play_sound(SFX_05A1, CHANNEL_10) + play_sound(SFX_05A1, CHANNEL_CUTSCENE) wait_until2(160, 0x67) - play_sound(SFX_0161, CHANNEL_10) + play_sound(SFX_0161, CHANNEL_CUTSCENE) wait_until2(202, 0x68) - play_sound(SFX_0162, CHANNEL_10) + play_sound(SFX_0162, CHANNEL_CUTSCENE) wait_until2(238, 0x69) - play_sound(SFX_0163, CHANNEL_10) + play_sound(SFX_0163, CHANNEL_CUTSCENE) wait_until2(255, 0x6a) - play_sound(SFX_0164, CHANNEL_10) + play_sound(SFX_0164, CHANNEL_CUTSCENE) wait_until2(259, 0x6b) - play_sound(SFX_SKEDAR_ROAR_0530, CHANNEL_10) + play_sound(SFX_SKEDAR_ROAR_0530, CHANNEL_CUTSCENE) wait_until2(441, 0x6c) - play_sound(SFX_0163, CHANNEL_10) + play_sound(SFX_0163, CHANNEL_CUTSCENE) wait_until2(454, 0x6d) - play_sound(SFX_0164, CHANNEL_10) + play_sound(SFX_0164, CHANNEL_CUTSCENE) wait_until2(522, 0x6e) - play_sound(SFX_05C7, CHANNEL_10) + play_sound(SFX_05C7, CHANNEL_CUTSCENE) wait_until2(546, 0x6f) - play_sound(SFX_05C6, CHANNEL_10) + play_sound(SFX_05C6, CHANNEL_CUTSCENE) wait_until2(610, 0x70) - play_sound(SFX_05C5, CHANNEL_10) + play_sound(SFX_05C5, CHANNEL_CUTSCENE) beginloop(0x0b) if_camera_animating(/*goto*/ 0x2e) @@ -1493,7 +1493,7 @@ u8 func1002_intro[] = { mute_channel(CHANNEL_7) mute_channel(CHANNEL_6) mute_channel(CHANNEL_5) - mute_channel(CHANNEL_10) + mute_channel(CHANNEL_CUTSCENE) set_cutscene_weapon(CHR_BOND, WEAPON_AR34, WEAPON_NONE) unset_chr_chrflag(CHR_BOND, CHRCFLAG_UNPLAYABLE) set_chr_hiddenflag(CHR_BOND, CHRHFLAG_00020000) @@ -3301,7 +3301,7 @@ u8 func1022_skedar_shuttle[] = { stop_countdown_timer object_do_animation(ANIM_045B, OBJ_SKEDAR_SHUTTLE, 0x08, 0xffff) assign_sound(SFX_810A, CHANNEL_3) - play_sound_from_object(CHANNEL_3, OBJ_SKEDAR_SHUTTLE, 1, 1800, 3000) + play_repeating_sound_from_object(CHANNEL_3, OBJ_SKEDAR_SHUTTLE, 1, 1800, 3000) restart_timer beginloop(0x0b) @@ -3311,7 +3311,7 @@ u8 func1022_skedar_shuttle[] = { label(0x2e) assign_sound(SFX_810B, CHANNEL_4) - play_sound_from_object(CHANNEL_4, OBJ_SKEDAR_SHUTTLE, 1, 1800, 3000) + play_repeating_sound_from_object(CHANNEL_4, OBJ_SKEDAR_SHUTTLE, 1, 1800, 3000) beginloop(0x0d) dprint 'O','B','J','\n',0, @@ -3784,7 +3784,7 @@ u8 func1027_uplink[] = { show_hudmsg(CHR_TARGET, L_IMP_053) // "Bypassing security systems." restart_timer assign_sound(SFX_01BF, CHANNEL_5) - control_sound_from_object(CHANNEL_5, OBJ_SKEDAR_SHUTTLE, TRUE) + set_object_sound_playing(CHANNEL_5, OBJ_SKEDAR_SHUTTLE, TRUE) beginloop(0x13) if_object_in_good_condition(OBJ_SKEDAR_SHUTTLE, /*goto*/ 0x2f) @@ -3806,7 +3806,7 @@ u8 func1027_uplink[] = { label(0x08) mute_channel(CHANNEL_5) assign_sound(SFX_01C1, CHANNEL_6) - control_sound_from_object(CHANNEL_6, OBJ_SKEDAR_SHUTTLE, TRUE) + set_object_sound_playing(CHANNEL_6, OBJ_SKEDAR_SHUTTLE, TRUE) show_hudmsg(CHR_TARGET, L_IMP_054) // "Virus has been downloaded successfully." yield show_hudmsg(CHR_TARGET, L_IMP_055) // "Ship's engines have been activated." @@ -3825,7 +3825,7 @@ u8 func1027_uplink[] = { show_hudmsg(CHR_TARGET, L_IMP_056) // "Connection to ship has been broken." mute_channel(CHANNEL_5) assign_sound(SFX_01C0, CHANNEL_6) - control_sound_from_object(CHANNEL_6, OBJ_SKEDAR_SHUTTLE, TRUE) + set_object_sound_playing(CHANNEL_6, OBJ_SKEDAR_SHUTTLE, TRUE) restart_timer beginloop(0x15) diff --git a/src/setups/setuplee.c b/src/setups/setuplee.c index 6b06eac75..5768eb2c7 100644 --- a/src/setups/setuplee.c +++ b/src/setups/setuplee.c @@ -2714,111 +2714,111 @@ u8 func1003_intro[] = { label(0x06) wait_until(60, LABEL_9A) - play_sound(SFX_0171, CHANNEL_10) + play_sound(SFX_0171, CHANNEL_CUTSCENE) wait_until(120, LABEL_AC) - play_sound(MP3_075A, CHANNEL_10) + play_sound(MP3_075A, CHANNEL_CUTSCENE) wait_until(136, LABEL_9B) - play_sound(SFX_0172, CHANNEL_10) + play_sound(SFX_0172, CHANNEL_CUTSCENE) wait_until(186, LABEL_9C) - play_sound(SFX_0173, CHANNEL_10) + play_sound(SFX_0173, CHANNEL_CUTSCENE) wait_until(226, LABEL_9D) - play_sound(SFX_0174, CHANNEL_10) + play_sound(SFX_0174, CHANNEL_CUTSCENE) wait_until(320, LABEL_9E) - speak(CHR_BOND, L_LEE_032, MP3_047F, CHANNEL_10, COLOR_09_BLUE) // "Oohhh... I'd better not be where I think I am." + speak(CHR_BOND, L_LEE_032, MP3_047F, CHANNEL_CUTSCENE, COLOR_09_BLUE) // "Oohhh... I'd better not be where I think I am." wait_until(505, LABEL_9F) - play_sound(SFX_0427, CHANNEL_10) + play_sound(SFX_0427, CHANNEL_CUTSCENE) wait_until(600, LABEL_A0) - speak(CHR_BOND, L_LEE_033, MP3_0480, CHANNEL_10, COLOR_04_ORANGE) // "And it's worse than that, my dear. Just look who y..." + speak(CHR_BOND, L_LEE_033, MP3_0480, CHANNEL_CUTSCENE, COLOR_04_ORANGE) // "And it's worse than that, my dear. Just look who y..." wait_until(1000, LABEL_A1) - speak(CHR_BOND, L_LEE_034, MP3_0481, CHANNEL_10, COLOR_09_BLUE) // "You! I thought you'd managed to escape. We found n..." + speak(CHR_BOND, L_LEE_034, MP3_0481, CHANNEL_CUTSCENE, COLOR_09_BLUE) // "You! I thought you'd managed to escape. We found n..." wait_until(1018, LABEL_A2) - play_sound(SFX_0175, CHANNEL_10) + play_sound(SFX_0175, CHANNEL_CUTSCENE) wait_until(1142, LABEL_A3) - play_sound(SFX_0176, CHANNEL_10) + play_sound(SFX_0176, CHANNEL_CUTSCENE) wait_until(1168, LABEL_A4) - play_sound(SFX_0177, CHANNEL_10) + play_sound(SFX_0177, CHANNEL_CUTSCENE) wait_until(1210, LABEL_A5) - play_sound(SFX_0178, CHANNEL_10) + play_sound(SFX_0178, CHANNEL_CUTSCENE) wait_until(1260, LABEL_A6) - play_sound(SFX_0171, CHANNEL_10) + play_sound(SFX_0171, CHANNEL_CUTSCENE) wait_until(1298, LABEL_A7) - play_sound(SFX_0172, CHANNEL_10) + play_sound(SFX_0172, CHANNEL_CUTSCENE) wait_until(1358, LABEL_65) - play_sound(SFX_0173, CHANNEL_10) + play_sound(SFX_0173, CHANNEL_CUTSCENE) wait_until(1396, LABEL_66) - play_sound(SFX_0172, CHANNEL_10) + play_sound(SFX_0172, CHANNEL_CUTSCENE) wait_until(1400, LABEL_A8) - speak(CHR_BOND, L_LEE_035, MP3_0482, CHANNEL_10, COLOR_04_ORANGE) // "You couldn't find me. But there was no hiding from..." + speak(CHR_BOND, L_LEE_035, MP3_0482, CHANNEL_CUTSCENE, COLOR_04_ORANGE) // "You couldn't find me. But there was no hiding from..." wait_until(1520, LABEL_67) - play_sound(SFX_0176, CHANNEL_10) + play_sound(SFX_0176, CHANNEL_CUTSCENE) wait_until(1592, LABEL_68) - play_sound(SFX_0177, CHANNEL_10) + play_sound(SFX_0177, CHANNEL_CUTSCENE) wait_until(1600, LABEL_69) - play_sound(SFX_0174, CHANNEL_10) + play_sound(SFX_0174, CHANNEL_CUTSCENE) wait_until(1656, LABEL_6A) - play_sound(SFX_0175, CHANNEL_10) + play_sound(SFX_0175, CHANNEL_CUTSCENE) wait_until(1728, LABEL_6B) - play_sound(SFX_0178, CHANNEL_10) + play_sound(SFX_0178, CHANNEL_CUTSCENE) wait_until(1734, LABEL_6C) - play_sound(SFX_0172, CHANNEL_10) + play_sound(SFX_0172, CHANNEL_CUTSCENE) wait_until(1770, LABEL_6E) - play_sound(SFX_0173, CHANNEL_10) + play_sound(SFX_0173, CHANNEL_CUTSCENE) wait_until(1810, LABEL_61) open_door(0x17) - play_sound(SFX_DOOR_801E, CHANNEL_10) - play_sound(SFX_SKEDAR_ROAR_0530, CHANNEL_10) + play_sound(SFX_DOOR_801E, CHANNEL_CUTSCENE) + play_sound(SFX_SKEDAR_ROAR_0530, CHANNEL_CUTSCENE) wait_until(1870, LABEL_6F) - speak(CHR_BOND, L_LEE_036, MP3_0483, CHANNEL_10, COLOR_04_ORANGE) // "This is it. Wait there! I'll make a distraction; i..." + speak(CHR_BOND, L_LEE_036, MP3_0483, CHANNEL_CUTSCENE, COLOR_04_ORANGE) // "This is it. Wait there! I'll make a distraction; i..." wait_until(1874, LABEL_70) - play_sound(SFX_0174, CHANNEL_10) + play_sound(SFX_0174, CHANNEL_CUTSCENE) wait_until(1930, LABEL_71) - play_sound(SFX_0175, CHANNEL_10) + play_sound(SFX_0175, CHANNEL_CUTSCENE) wait_until(1986, LABEL_72) - play_sound(SFX_05A2, CHANNEL_10) + play_sound(SFX_05A2, CHANNEL_CUTSCENE) wait_until(2040, LABEL_73) - play_sound(SFX_05A3, CHANNEL_10) + play_sound(SFX_05A3, CHANNEL_CUTSCENE) wait_until(2108, LABEL_74) - play_sound(SFX_05A2, CHANNEL_10) + play_sound(SFX_05A2, CHANNEL_CUTSCENE) wait_until(2168, LABEL_75) - play_sound(SFX_05A3, CHANNEL_10) + play_sound(SFX_05A3, CHANNEL_CUTSCENE) wait_until(2226, LABEL_76) - play_sound(SFX_SKEDAR_ROAR_0531, CHANNEL_10) + play_sound(SFX_SKEDAR_ROAR_0531, CHANNEL_CUTSCENE) wait_until(2232, LABEL_77) - play_sound(SFX_05A2, CHANNEL_10) + play_sound(SFX_05A2, CHANNEL_CUTSCENE) wait_until(2300, LABEL_62) close_door(0x17) @@ -2826,73 +2826,73 @@ u8 func1003_intro[] = { wait_until(2346, LABEL_78) wait_until(2424, LABEL_79) - play_sound(SFX_05A3, CHANNEL_10) + play_sound(SFX_05A3, CHANNEL_CUTSCENE) wait_until(2468, LABEL_7A) - play_sound(SFX_SKEDAR_ROAR_0530, CHANNEL_10) + play_sound(SFX_SKEDAR_ROAR_0530, CHANNEL_CUTSCENE) wait_until(2474, LABEL_7B) - play_sound(SFX_05A2, CHANNEL_10) + play_sound(SFX_05A2, CHANNEL_CUTSCENE) wait_until(2560, LABEL_7C) - play_sound(SFX_0176, CHANNEL_10) + play_sound(SFX_0176, CHANNEL_CUTSCENE) wait_until(2580, LABEL_7D) - play_sound(SFX_0177, CHANNEL_10) + play_sound(SFX_0177, CHANNEL_CUTSCENE) wait_until(2581, LABEL_7E) - speak(CHR_BOND, L_LEE_037, MP3_0484, CHANNEL_10, COLOR_09_BLUE) // "Why are you doing this, Cassandra?" + speak(CHR_BOND, L_LEE_037, MP3_0484, CHANNEL_CUTSCENE, COLOR_09_BLUE) // "Why are you doing this, Cassandra?" wait_until(2614, LABEL_7F) - play_sound(SFX_0171, CHANNEL_10) + play_sound(SFX_0171, CHANNEL_CUTSCENE) wait_until(2648, LABEL_80) - play_sound(SFX_0178, CHANNEL_10) + play_sound(SFX_0178, CHANNEL_CUTSCENE) wait_until(2670, LABEL_81) - play_sound(SFX_0172, CHANNEL_10) + play_sound(SFX_0172, CHANNEL_CUTSCENE) wait_until(2708, LABEL_82) - play_sound(SFX_0173, CHANNEL_10) + play_sound(SFX_0173, CHANNEL_CUTSCENE) wait_until(2736, LABEL_83) - play_sound(SFX_0174, CHANNEL_10) + play_sound(SFX_0174, CHANNEL_CUTSCENE) wait_until(2780, LABEL_84) - play_sound(SFX_0175, CHANNEL_10) + play_sound(SFX_0175, CHANNEL_CUTSCENE) wait_until(2790, LABEL_85) - speak(CHR_BOND, L_LEE_038, MP3_0485, CHANNEL_10, COLOR_04_ORANGE) // "The Skedar used me, Joanna. You are my best chance..." + speak(CHR_BOND, L_LEE_038, MP3_0485, CHANNEL_CUTSCENE, COLOR_04_ORANGE) // "The Skedar used me, Joanna. You are my best chance..." wait_until(2792, LABEL_86) - play_sound(SFX_0172, CHANNEL_10) + play_sound(SFX_0172, CHANNEL_CUTSCENE) wait_until(2834, LABEL_87) - play_sound(SFX_0176, CHANNEL_10) + play_sound(SFX_0176, CHANNEL_CUTSCENE) wait_until(3016, LABEL_88) - play_sound(SFX_01DC, CHANNEL_10) + play_sound(SFX_01DC, CHANNEL_CUTSCENE) wait_until(3068, LABEL_89) - play_sound(SFX_043A, CHANNEL_10) - play_sound(SFX_043D, CHANNEL_10) + play_sound(SFX_043A, CHANNEL_CUTSCENE) + play_sound(SFX_043D, CHANNEL_CUTSCENE) wait_until(3186, LABEL_63) open_door(0x24) wait_until(3238, LABEL_8A) - play_sound(SFX_0177, CHANNEL_10) + play_sound(SFX_0177, CHANNEL_CUTSCENE) wait_until(3258, LABEL_8B) - play_sound(SFX_0172, CHANNEL_10) + play_sound(SFX_0172, CHANNEL_CUTSCENE) wait_until(3280, LABEL_8C) - play_sound(SFX_0173, CHANNEL_10) + play_sound(SFX_0173, CHANNEL_CUTSCENE) close_door(0x24) wait_until(3313, LABEL_8D) - play_sound(SFX_SKEDAR_ROAR_052A, CHANNEL_10) - speak(CHR_BOND, L_LEE_039, MP3_0486, CHANNEL_10, COLOR_04_ORANGE) // "Eeeeaaarrrrggghhh!!!" + play_sound(SFX_SKEDAR_ROAR_052A, CHANNEL_CUTSCENE) + speak(CHR_BOND, L_LEE_039, MP3_0486, CHANNEL_CUTSCENE, COLOR_04_ORANGE) // "Eeeeaaarrrrggghhh!!!" beginloop(0x08) if_camera_animating(/*goto*/ 0x2c) @@ -2907,7 +2907,7 @@ u8 func1003_intro[] = { label(0x06) set_stage_flag(STAGEFLAG_INTRO_FINISHED) open_door(0x17) - mute_channel(CHANNEL_10) + mute_channel(CHANNEL_CUTSCENE) unset_chr_chrflag(CHR_COOP, CHRCFLAG_HIDDEN) unset_chr_chrflag(CHR_ANTI, CHRCFLAG_HIDDEN) unset_chr_chrflag(CHR_BOND, CHRCFLAG_UNPLAYABLE) @@ -2980,75 +2980,75 @@ u8 func0c01_outro[] = { set_cutscene_weapon(CHR_ELVIS, WEAPON_NONE, WEAPON_NONE) wait_until(38, LABEL_65) - play_sound(SFX_00F9, CHANNEL_10) + play_sound(SFX_00F9, CHANNEL_CUTSCENE) wait_until(140, LABEL_66) - play_sound(SFX_00FD, CHANNEL_10) + play_sound(SFX_00FD, CHANNEL_CUTSCENE) wait_until(150, LABEL_A9) - speak(CHR_BOND, L_LEE_040, MP3_0487, CHANNEL_10, COLOR_09_BLUE) // "Wow. That's the first time I've seen another plane..." + speak(CHR_BOND, L_LEE_040, MP3_0487, CHANNEL_CUTSCENE, COLOR_09_BLUE) // "Wow. That's the first time I've seen another plane..." wait_until(368, LABEL_67) - play_sound(SFX_00FA, CHANNEL_10) - play_sound(SFX_00FB, CHANNEL_10) + play_sound(SFX_00FA, CHANNEL_CUTSCENE) + play_sound(SFX_00FB, CHANNEL_CUTSCENE) wait_until(540, LABEL_69) - play_sound(SFX_00FE, CHANNEL_10) + play_sound(SFX_00FE, CHANNEL_CUTSCENE) wait_until(550, LABEL_6B) - play_sound(SFX_00FC, CHANNEL_10) + play_sound(SFX_00FC, CHANNEL_CUTSCENE) wait_until(580, LABEL_6C) - play_sound(SFX_00F9, CHANNEL_10) - play_sound(SFX_00FB, CHANNEL_10) + play_sound(SFX_00F9, CHANNEL_CUTSCENE) + play_sound(SFX_00FB, CHANNEL_CUTSCENE) wait_until(690, LABEL_6E) - speak(CHR_BOND, L_LEE_041, MP3_0488, CHANNEL_10, COLOR_04_ORANGE) // "Hmmmm?" + speak(CHR_BOND, L_LEE_041, MP3_0488, CHANNEL_CUTSCENE, COLOR_04_ORANGE) // "Hmmmm?" wait_until(850, LABEL_6F) - speak(CHR_BOND, L_LEE_042, MP3_0489, CHANNEL_10, COLOR_04_ORANGE) // "I don't... I don't believe it!" + speak(CHR_BOND, L_LEE_042, MP3_0489, CHANNEL_CUTSCENE, COLOR_04_ORANGE) // "I don't... I don't believe it!" wait_until(963, LABEL_70) - play_sound(SFX_FOOTSTEP_80D4, CHANNEL_10) + play_sound(SFX_FOOTSTEP_80D4, CHANNEL_CUTSCENE) wait_until(972, LABEL_71) - play_sound(SFX_FOOTSTEP_80D8, CHANNEL_10) + play_sound(SFX_FOOTSTEP_80D8, CHANNEL_CUTSCENE) wait_until(988, LABEL_61) - play_sound(SFX_FOOTSTEP_80DB, CHANNEL_10) + play_sound(SFX_FOOTSTEP_80DB, CHANNEL_CUTSCENE) wait_until(1000, LABEL_72) - speak(CHR_BOND, L_LEE_043, MP3_048A, CHANNEL_10, COLOR_09_BLUE) // "Elvis? What is it?" + speak(CHR_BOND, L_LEE_043, MP3_048A, CHANNEL_CUTSCENE, COLOR_09_BLUE) // "Elvis? What is it?" wait_until(1030, LABEL_73) - play_sound(SFX_FOOTSTEP_80DA, CHANNEL_10) + play_sound(SFX_FOOTSTEP_80DA, CHANNEL_CUTSCENE) wait_until(1045, LABEL_74) - play_sound(SFX_FOOTSTEP_80D8, CHANNEL_10) + play_sound(SFX_FOOTSTEP_80D8, CHANNEL_CUTSCENE) wait_until(1065, LABEL_75) - play_sound(SFX_FOOTSTEP_80D9, CHANNEL_10) + play_sound(SFX_FOOTSTEP_80D9, CHANNEL_CUTSCENE) wait_until(1085, LABEL_76) - play_sound(SFX_FOOTSTEP_80DA, CHANNEL_10) + play_sound(SFX_FOOTSTEP_80DA, CHANNEL_CUTSCENE) wait_until(1200, LABEL_77) - speak(CHR_BOND, L_LEE_044, MP3_048B, CHANNEL_10, COLOR_09_BLUE) // "Where are you going?" + speak(CHR_BOND, L_LEE_044, MP3_048B, CHANNEL_CUTSCENE, COLOR_09_BLUE) // "Where are you going?" wait_until(1237, LABEL_78) - play_sound(SFX_FOOTSTEP_80DB, CHANNEL_10) + play_sound(SFX_FOOTSTEP_80DB, CHANNEL_CUTSCENE) wait_until(1260, LABEL_79) - play_sound(SFX_FOOTSTEP_80D8, CHANNEL_10) + play_sound(SFX_FOOTSTEP_80D8, CHANNEL_CUTSCENE) wait_until(1280, LABEL_7A) - play_sound(SFX_FOOTSTEP_80D9, CHANNEL_10) + play_sound(SFX_FOOTSTEP_80D9, CHANNEL_CUTSCENE) wait_until(1300, LABEL_7B) - play_sound(SFX_FOOTSTEP_80DA, CHANNEL_10) + play_sound(SFX_FOOTSTEP_80DA, CHANNEL_CUTSCENE) wait_until(1301, LABEL_62) - speak(CHR_BOND, L_LEE_045, MP3_048C, CHANNEL_10, COLOR_04_ORANGE) // "We have to get down to the surface! Follow me!" + speak(CHR_BOND, L_LEE_045, MP3_048C, CHANNEL_CUTSCENE, COLOR_04_ORANGE) // "We have to get down to the surface! Follow me!" open_door(OBJ_HANGARDOOR1) open_door(OBJ_HANGARDOOR2) open_door(OBJ_HANGARDOOR3) @@ -3068,7 +3068,7 @@ u8 func0c01_outro[] = { endloop(0x08) label(LABEL_B0) - mute_channel(CHANNEL_10) + mute_channel(CHANNEL_CUTSCENE) end_level set_ailist(CHR_SELF, GAILIST_IDLE) endlist @@ -3342,7 +3342,7 @@ u8 func0422_cass[] = { if_stage_flag_eq(STAGEFLAG_SHY_SKEDAR_READY, TRUE, /*goto*/ 0x2c) label(0x2c) - play_sound(MP3_0486, CHANNEL_10) + play_sound(MP3_0486, CHANNEL_CUTSCENE) set_stage_flag(STAGEFLAG_CASS_SCREAMING) beginloop(LABEL_C2) @@ -3686,7 +3686,7 @@ u8 func101f_enable_bridge_skedar[] = { u8 func1020_engine_hum_noise[] = { yield assign_sound(SFX_81A5, CHANNEL_0) - play_sound_from_object(CHANNEL_0, 0x1b, 1, 2000, 4000) + play_repeating_sound_from_object(CHANNEL_0, 0x1b, 1, 2000, 4000) set_ailist(CHR_SELF, GAILIST_IDLE) endlist }; diff --git a/src/setups/setuplip.c b/src/setups/setuplip.c index b17f6d3b3..8bbff85c9 100644 --- a/src/setups/setuplip.c +++ b/src/setups/setuplip.c @@ -1156,7 +1156,7 @@ u8 func1003_uplink_doors[] = { show_hudmsg(CHR_P1P2, L_LIP_049) // "Initiating virus download." restart_timer assign_sound(SFX_01BF, CHANNEL_5) - control_sound_from_object(CHANNEL_5, 0x02, TRUE) + set_object_sound_playing(CHANNEL_5, 0x02, TRUE) beginloop(0x11) if_timer_gt(400, /*goto*/ 0x06) @@ -1174,7 +1174,7 @@ u8 func1003_uplink_doors[] = { label(LABEL_2D) assign_sound(SFX_01C1, CHANNEL_5) - control_sound_from_object(CHANNEL_5, 0x02, TRUE) + set_object_sound_playing(CHANNEL_5, 0x02, TRUE) show_hudmsg(CHR_P1P2, L_LIP_023) // "Virus downloaded to console." yield set_stage_flag(STAGEFLAG_DOOR_VIRUS_DOWNLOADED) @@ -1184,7 +1184,7 @@ u8 func1003_uplink_doors[] = { show_hudmsg(CHR_P1P2, L_LIP_031) // "Data Uplink connection broken." mute_channel(CHANNEL_5) assign_sound(SFX_01C0, CHANNEL_6) - control_sound_from_object(CHANNEL_6, 0x02, TRUE) + set_object_sound_playing(CHANNEL_6, 0x02, TRUE) restart_timer beginloop(0x13) @@ -1233,7 +1233,7 @@ u8 func1004_uplink_lights[] = { show_hudmsg(CHR_P1P2, L_LIP_049) // "Initiating virus download." restart_timer assign_sound(SFX_01BF, CHANNEL_5) - control_sound_from_object(CHANNEL_5, 0x01, TRUE) + set_object_sound_playing(CHANNEL_5, 0x01, TRUE) beginloop(0x11) if_timer_gt(400, /*goto*/ 0x06) @@ -1251,7 +1251,7 @@ u8 func1004_uplink_lights[] = { label(LABEL_2D) assign_sound(SFX_01C1, CHANNEL_5) - control_sound_from_object(CHANNEL_5, 0x01, TRUE) + set_object_sound_playing(CHANNEL_5, 0x01, TRUE) show_hudmsg(CHR_P1P2, L_LIP_023) // "Virus downloaded to console." yield show_hudmsg(CHR_P1P2, L_LIP_088) // "Lighting systems overloaded." @@ -1275,7 +1275,7 @@ u8 func1004_uplink_lights[] = { show_hudmsg(CHR_P1P2, L_LIP_031) // "Data Uplink connection broken." mute_channel(CHANNEL_5) assign_sound(SFX_01C0, CHANNEL_6) - control_sound_from_object(CHANNEL_6, 0x01, TRUE) + set_object_sound_playing(CHANNEL_6, 0x01, TRUE) restart_timer beginloop(0x13) @@ -1324,7 +1324,7 @@ u8 func1005_uplink_autoguns[] = { show_hudmsg(CHR_P1P2, L_LIP_049) // "Initiating virus download." restart_timer assign_sound(SFX_01BF, CHANNEL_5) - control_sound_from_object(CHANNEL_5, 0x03, TRUE) + set_object_sound_playing(CHANNEL_5, 0x03, TRUE) beginloop(0x11) if_timer_gt(400, /*goto*/ 0x06) @@ -1341,7 +1341,7 @@ u8 func1005_uplink_autoguns[] = { set_ailist(CHR_SELF, GAILIST_IDLE) label(LABEL_2D) assign_sound(SFX_01C1, CHANNEL_5) - control_sound_from_object(CHANNEL_5, 0x00, TRUE) + set_object_sound_playing(CHANNEL_5, 0x00, TRUE) show_hudmsg(CHR_P1P2, L_LIP_023) // "Virus downloaded to console." yield show_hudmsg(CHR_P1P2, L_LIP_105) // "Automatic Defenses Disabled." @@ -1352,7 +1352,7 @@ u8 func1005_uplink_autoguns[] = { show_hudmsg(CHR_P1P2, L_LIP_031) // "Data Uplink connection broken." mute_channel(CHANNEL_5) assign_sound(SFX_01C0, CHANNEL_6) - control_sound_from_object(CHANNEL_6, 0x03, TRUE) + set_object_sound_playing(CHANNEL_6, 0x03, TRUE) restart_timer beginloop(0x13) @@ -3196,12 +3196,12 @@ u8 func0420_labtech_doors[] = { set_stage_flag(STAGEFLAG_AUTOGUN_ACTIVATED) if_self_flag_bankx_eq(CHRFLAG0_GP1, TRUE, BANK_0, /*goto*/ LABEL_75) assign_sound(SFX_043A, CHANNEL_7) - control_sound_from_object(CHANNEL_7, 0x3c, TRUE) + set_object_sound_playing(CHANNEL_7, 0x3c, TRUE) goto_next(LABEL_2D) label(LABEL_75) assign_sound(SFX_043A, CHANNEL_7) - control_sound_from_object(CHANNEL_7, 0x3d, TRUE) + set_object_sound_playing(CHANNEL_7, 0x3d, TRUE) label(LABEL_2D) endloop(LABEL_71) @@ -3425,9 +3425,9 @@ u8 func1018_disable_chambers[] = { \ /* Raising chamber */ \ assign_sound(SFX_DOOR_042B, CHANNEL_0) \ - control_sound_from_object(CHANNEL_0, chamber, TRUE) \ + set_object_sound_playing(CHANNEL_0, chamber, TRUE) \ assign_sound(SFX_043A, CHANNEL_7) \ - control_sound_from_object(CHANNEL_7, switch, TRUE) \ + set_object_sound_playing(CHANNEL_7, switch, TRUE) \ show_hudmsg(CHR_P1P2, 0x2a42) /* "Containment unit raised up." */ \ set_object_image(switch, 0, TVCMDLIST_13) \ unset_object_flag(chamber, OBJFLAG_DEACTIVATED) \ @@ -3441,7 +3441,7 @@ u8 func1018_disable_chambers[] = { label(0x06) \ mute_channel(CHANNEL_0) \ assign_sound(SFX_DOOR_042C, CHANNEL_0) \ - control_sound_from_object(CHANNEL_0, chamber, TRUE) \ + set_object_sound_playing(CHANNEL_0, chamber, TRUE) \ set_object_flag(chamber, OBJFLAG_DEACTIVATED) \ reloop(0x04) \ \ @@ -3449,9 +3449,9 @@ u8 func1018_disable_chambers[] = { label(LABEL_2D) \ mute_channel(CHANNEL_0) \ assign_sound(SFX_DOOR_042B, CHANNEL_0) \ - control_sound_from_object(CHANNEL_0, chamber, TRUE) \ + set_object_sound_playing(CHANNEL_0, chamber, TRUE) \ assign_sound(SFX_043A, CHANNEL_7) \ - control_sound_from_object(CHANNEL_7, switch, TRUE) \ + set_object_sound_playing(CHANNEL_7, switch, TRUE) \ show_hudmsg(CHR_P1P2, 0x2a43) /* "Containment unit lowered down." */ \ set_object_image(switch, 0, TVCMDLIST_12) \ unset_object_flag(chamber, OBJFLAG_DEACTIVATED) \ @@ -3465,7 +3465,7 @@ u8 func1018_disable_chambers[] = { label(0x06) \ mute_channel(CHANNEL_0) \ assign_sound(SFX_DOOR_042C, CHANNEL_0) \ - control_sound_from_object(CHANNEL_0, chamber, TRUE) \ + set_object_sound_playing(CHANNEL_0, chamber, TRUE) \ set_object_flag(chamber, OBJFLAG_DEACTIVATED) \ endloop(0x04) @@ -3485,9 +3485,9 @@ u8 func1019_chamber1[] = { // Raising chamber assign_sound(SFX_DOOR_042B, CHANNEL_0) - control_sound_from_object(CHANNEL_0, OBJ_CHAMBER1, TRUE) + set_object_sound_playing(CHANNEL_0, OBJ_CHAMBER1, TRUE) assign_sound(SFX_043A, CHANNEL_7) - control_sound_from_object(CHANNEL_7, OBJ_CHAMBER1_SWITCH, TRUE) + set_object_sound_playing(CHANNEL_7, OBJ_CHAMBER1_SWITCH, TRUE) set_object_image(OBJ_CHAMBER1_SWITCH, 0, TVCMDLIST_13) show_hudmsg(CHR_P1P2, L_LIP_066) // "Containment unit raised up." unset_object_flag(OBJ_CHAMBER1, OBJFLAG_DEACTIVATED) @@ -3501,7 +3501,7 @@ u8 func1019_chamber1[] = { label(0x06) mute_channel(CHANNEL_0) assign_sound(SFX_DOOR_042C, CHANNEL_0) - control_sound_from_object(CHANNEL_0, OBJ_CHAMBER1, TRUE) + set_object_sound_playing(CHANNEL_0, OBJ_CHAMBER1, TRUE) set_chr_hiddenflag(CHR_ALIEN, CHRHFLAG_WARPONSCREEN) beginloop(LABEL_64) @@ -3520,10 +3520,10 @@ u8 func1019_chamber1[] = { label(LABEL_2D) mute_channel(CHANNEL_0) assign_sound(SFX_DOOR_042B, CHANNEL_0) - control_sound_from_object(CHANNEL_0, OBJ_CHAMBER1, TRUE) + set_object_sound_playing(CHANNEL_0, OBJ_CHAMBER1, TRUE) set_chr_chrflag(CHR_ALIEN, CHRCFLAG_HIDDEN) assign_sound(SFX_043A, CHANNEL_7) - control_sound_from_object(CHANNEL_7, OBJ_CHAMBER1_SWITCH, TRUE) + set_object_sound_playing(CHANNEL_7, OBJ_CHAMBER1_SWITCH, TRUE) set_object_image(OBJ_CHAMBER1_SWITCH, 0, TVCMDLIST_12) show_hudmsg(CHR_P1P2, L_LIP_067) // "Containment unit lowered down." unset_object_flag(OBJ_CHAMBER1, OBJFLAG_DEACTIVATED) @@ -3537,7 +3537,7 @@ u8 func1019_chamber1[] = { label(0x06) mute_channel(CHANNEL_0) assign_sound(SFX_DOOR_042C, CHANNEL_0) - control_sound_from_object(CHANNEL_0, OBJ_CHAMBER1, TRUE) + set_object_sound_playing(CHANNEL_0, OBJ_CHAMBER1, TRUE) set_object_flag(OBJ_CHAMBER1, OBJFLAG_DEACTIVATED) endloop(0x04) endlist @@ -3556,9 +3556,9 @@ u8 func101a_chamber2[] = { // Raising chamber assign_sound(SFX_DOOR_042B, CHANNEL_0) - control_sound_from_object(CHANNEL_0, OBJ_CHAMBER2, TRUE) + set_object_sound_playing(CHANNEL_0, OBJ_CHAMBER2, TRUE) assign_sound(SFX_043A, CHANNEL_7) - control_sound_from_object(CHANNEL_7, OBJ_CHAMBER2_SWITCH, TRUE) + set_object_sound_playing(CHANNEL_7, OBJ_CHAMBER2_SWITCH, TRUE) set_object_image(OBJ_CHAMBER2_SWITCH, 0, TVCMDLIST_13) show_hudmsg(CHR_P1P2, L_LIP_066) // "Containment unit raised up." unset_object_flag(OBJ_CHAMBER2, OBJFLAG_DEACTIVATED) @@ -3572,7 +3572,7 @@ u8 func101a_chamber2[] = { label(0x06) mute_channel(CHANNEL_0) assign_sound(SFX_DOOR_042C, CHANNEL_0) - control_sound_from_object(CHANNEL_0, OBJ_CHAMBER2, TRUE) + set_object_sound_playing(CHANNEL_0, OBJ_CHAMBER2, TRUE) set_object_flag(OBJ_CHAMBER2, OBJFLAG_DEACTIVATED) reloop(0x04) @@ -3581,9 +3581,9 @@ u8 func101a_chamber2[] = { label(LABEL_2D) mute_channel(CHANNEL_0) assign_sound(SFX_DOOR_042B, CHANNEL_0) - control_sound_from_object(CHANNEL_0, OBJ_CHAMBER2, TRUE) + set_object_sound_playing(CHANNEL_0, OBJ_CHAMBER2, TRUE) assign_sound(SFX_043A, CHANNEL_7) - control_sound_from_object(CHANNEL_7, OBJ_CHAMBER2_SWITCH, TRUE) + set_object_sound_playing(CHANNEL_7, OBJ_CHAMBER2_SWITCH, TRUE) set_object_image(OBJ_CHAMBER2_SWITCH, 0, TVCMDLIST_12) show_hudmsg(CHR_P1P2, L_LIP_067) // "Containment unit lowered down." unset_object_flag(OBJ_CHAMBER2, OBJFLAG_DEACTIVATED) @@ -3597,7 +3597,7 @@ u8 func101a_chamber2[] = { label(0x06) mute_channel(CHANNEL_0) assign_sound(SFX_DOOR_042C, CHANNEL_0) - control_sound_from_object(CHANNEL_0, OBJ_CHAMBER2, TRUE) + set_object_sound_playing(CHANNEL_0, OBJ_CHAMBER2, TRUE) set_object_flag(OBJ_CHAMBER2, OBJFLAG_DEACTIVATED) endloop(0x04) endlist @@ -3643,9 +3643,9 @@ u8 func1020_chamber8[] = { // Raising chamber assign_sound(SFX_DOOR_042B, CHANNEL_0) - control_sound_from_object(CHANNEL_0, OBJ_CHAMBER8, TRUE) + set_object_sound_playing(CHANNEL_0, OBJ_CHAMBER8, TRUE) assign_sound(SFX_043A, CHANNEL_7) - control_sound_from_object(CHANNEL_7, OBJ_CHAMBER8_SWITCH, TRUE) + set_object_sound_playing(CHANNEL_7, OBJ_CHAMBER8_SWITCH, TRUE) show_hudmsg(CHR_P1P2, L_LIP_066) // "Containment unit raised up." set_object_image(OBJ_CHAMBER8_SWITCH, 0, TVCMDLIST_13) unset_object_flag(OBJ_CHAMBER8, OBJFLAG_DEACTIVATED) @@ -3659,7 +3659,7 @@ u8 func1020_chamber8[] = { label(0x06) mute_channel(CHANNEL_0) assign_sound(SFX_DOOR_042C, CHANNEL_0) - control_sound_from_object(CHANNEL_0, OBJ_CHAMBER8, TRUE) + set_object_sound_playing(CHANNEL_0, OBJ_CHAMBER8, TRUE) set_object_flag(OBJ_CHAMBER8, OBJFLAG_DEACTIVATED) reloop(0x04) @@ -3668,10 +3668,10 @@ u8 func1020_chamber8[] = { label(LABEL_2D) mute_channel(CHANNEL_0) assign_sound(SFX_DOOR_042B, CHANNEL_0) - control_sound_from_object(CHANNEL_0, OBJ_CHAMBER8, TRUE) + set_object_sound_playing(CHANNEL_0, OBJ_CHAMBER8, TRUE) assign_sound(SFX_043A, CHANNEL_7) - control_sound_from_object(CHANNEL_7, OBJ_CHAMBER8_SWITCH, TRUE) + set_object_sound_playing(CHANNEL_7, OBJ_CHAMBER8_SWITCH, TRUE) show_hudmsg(CHR_P1P2, L_LIP_067) // "Containment unit lowered down." set_object_image(OBJ_CHAMBER8_SWITCH, 0, TVCMDLIST_12) unset_object_flag(OBJ_CHAMBER8, OBJFLAG_DEACTIVATED) @@ -3685,7 +3685,7 @@ u8 func1020_chamber8[] = { label(0x06) mute_channel(CHANNEL_0) assign_sound(SFX_DOOR_042C, CHANNEL_0) - control_sound_from_object(CHANNEL_0, OBJ_CHAMBER8, TRUE) + set_object_sound_playing(CHANNEL_0, OBJ_CHAMBER8, TRUE) set_object_flag(OBJ_CHAMBER8, OBJFLAG_DEACTIVATED) endloop(0x04) endlist @@ -3943,45 +3943,45 @@ u8 func0c01_outro[] = { open_door(0x31) wait_until(344, LABEL_64) - play_sound(SFX_0161, CHANNEL_10) + play_sound(SFX_0161, CHANNEL_CUTSCENE) wait_until(380, LABEL_66) speak(CHR_P1P2, L_LIP_100, MP3_0433, CHANNEL_7, COLOR_09_BLUE) // "Put your hands up and step away from the alien." wait_until(390, LABEL_68) - play_sound(SFX_0162, CHANNEL_10) + play_sound(SFX_0162, CHANNEL_CUTSCENE) wait_until(460, LABEL_69) - play_sound(SFX_0163, CHANNEL_10) + play_sound(SFX_0163, CHANNEL_CUTSCENE) wait_until(500, LABEL_74) wait_until(514, LABEL_6A) - play_sound(SFX_0164, CHANNEL_10) + play_sound(SFX_0164, CHANNEL_CUTSCENE) wait_until(580, LABEL_6C) speak(CHR_P1P2, L_LIP_102, MP3_0435, CHANNEL_7, COLOR_09_BLUE) // "Don't make me tell you again, Doctor. And turn tha..." wait_until(588, LABEL_6B) - play_sound(SFX_0161, CHANNEL_10) + play_sound(SFX_0161, CHANNEL_CUTSCENE) wait_until(606, LABEL_6D) - play_sound(SFX_0163, CHANNEL_10) + play_sound(SFX_0163, CHANNEL_CUTSCENE) wait_until(612, LABEL_6E) - play_sound(SFX_0164, CHANNEL_10) + play_sound(SFX_0164, CHANNEL_CUTSCENE) wait_until(618, LABEL_6F) - play_sound(SFX_0162, CHANNEL_10) + play_sound(SFX_0162, CHANNEL_CUTSCENE) wait_until(656, LABEL_70) - play_sound(SFX_0163, CHANNEL_10) + play_sound(SFX_0163, CHANNEL_CUTSCENE) wait_until(720, LABEL_71) - play_sound(SFX_0164, CHANNEL_10) + play_sound(SFX_0164, CHANNEL_CUTSCENE) wait_until(786, LABEL_72) - play_sound(SFX_0163, CHANNEL_10) + play_sound(SFX_0163, CHANNEL_CUTSCENE) beginloop(0x08) if_camera_animating(/*goto*/ LABEL_2D) @@ -3993,7 +3993,7 @@ u8 func0c01_outro[] = { endloop(0x08) label(LABEL_8B) - mute_channel(CHANNEL_10) + mute_channel(CHANNEL_CUTSCENE) stop_cutscene_track stop_ambient_track end_level @@ -4034,22 +4034,22 @@ u8 func1002_intro[] = { set_cutscene_weapon(CHR_BOND, WEAPON_FALCON2_SILENCER, WEAPON_NONE) wait_until(62, LABEL_67) - play_sound(SFX_0161, CHANNEL_10) + play_sound(SFX_0161, CHANNEL_CUTSCENE) wait_until(90, LABEL_64) speak(CHR_BOND, L_LIP_090, MP3_0429, CHANNEL_5, COLOR_03_RED) // "The problem you have is that there is no way to sn..." wait_until(108, LABEL_66) - play_sound(SFX_0162, CHANNEL_10) + play_sound(SFX_0162, CHANNEL_CUTSCENE) wait_until(686, LABEL_68) - play_sound(SFX_0163, CHANNEL_10) + play_sound(SFX_0163, CHANNEL_CUTSCENE) wait_until(738, LABEL_69) - play_sound(SFX_0164, CHANNEL_10) + play_sound(SFX_0164, CHANNEL_CUTSCENE) wait_until(782, LABEL_6A) - play_sound(SFX_0161, CHANNEL_10) + play_sound(SFX_0161, CHANNEL_CUTSCENE) wait_until(810, LABEL_6B) speak(CHR_BOND, L_LIP_091, MP3_042A, CHANNEL_5, COLOR_09_BLUE) // "Doesn't sound like a problem to me. Where are thes..." @@ -4058,56 +4058,56 @@ u8 func1002_intro[] = { speak(CHR_BOND, L_LIP_092, MP3_042B, CHANNEL_5, COLOR_03_RED) // "In that crate." wait_until(1186, LABEL_6D) - play_sound(SFX_0162, CHANNEL_10) + play_sound(SFX_0162, CHANNEL_CUTSCENE) wait_until(1222, LABEL_6E) - play_sound(SFX_0163, CHANNEL_10) + play_sound(SFX_0163, CHANNEL_CUTSCENE) wait_until(1246, LABEL_6F) - play_sound(SFX_0163, CHANNEL_10) + play_sound(SFX_0163, CHANNEL_CUTSCENE) wait_until(1316, LABEL_70) - play_sound(SFX_01DC, CHANNEL_10) + play_sound(SFX_01DC, CHANNEL_CUTSCENE) wait_until(1346, LABEL_71) assign_sound(SFX_8169, CHANNEL_1) - control_sound_from_object(CHANNEL_1, OBJ_CRATE, TRUE) + set_object_sound_playing(CHANNEL_1, OBJ_CRATE, TRUE) wait_until(1390, LABEL_72) speak(CHR_BOND, L_LIP_093, MP3_042C, CHANNEL_5, COLOR_09_BLUE) // "Cute. Very cute." wait_until(1440, LABEL_73) - play_sound(SFX_0161, CHANNEL_10) + play_sound(SFX_0161, CHANNEL_CUTSCENE) wait_until(1492, LABEL_74) - play_sound(SFX_0162, CHANNEL_10) + play_sound(SFX_0162, CHANNEL_CUTSCENE) wait_until(1584, LABEL_75) - play_sound(SFX_0163, CHANNEL_10) + play_sound(SFX_0163, CHANNEL_CUTSCENE) wait_until(1597, LABEL_76) speak(CHR_BOND, L_LIP_094, MP3_042D, CHANNEL_5, COLOR_03_RED) // "By the way, the stores are crawling with guards. I..." wait_until(1628, LABEL_77) - play_sound(SFX_0161, CHANNEL_10) + play_sound(SFX_0161, CHANNEL_CUTSCENE) wait_until(1658, LABEL_78) - play_sound(SFX_0162, CHANNEL_10) + play_sound(SFX_0162, CHANNEL_CUTSCENE) wait_until(1724, LABEL_79) - play_sound(SFX_0163, CHANNEL_10) + play_sound(SFX_0163, CHANNEL_CUTSCENE) wait_until(1792, LABEL_7A) - play_sound(SFX_0164, CHANNEL_10) + play_sound(SFX_0164, CHANNEL_CUTSCENE) wait_until(1866, LABEL_7B) - play_sound(SFX_0163, CHANNEL_10) + play_sound(SFX_0163, CHANNEL_CUTSCENE) wait_until(1906, LABEL_7C) - play_sound(SFX_0161, CHANNEL_10) + play_sound(SFX_0161, CHANNEL_CUTSCENE) wait_until(2024, LABEL_7D) - play_sound(SFX_0162, CHANNEL_10) + play_sound(SFX_0162, CHANNEL_CUTSCENE) wait_until(2017, LABEL_7E) speak(CHR_BOND, L_LIP_095, MP3_042E, CHANNEL_5, COLOR_09_BLUE) // "Certainly. Any other pearls of wisdom?" @@ -4126,25 +4126,25 @@ u8 func1002_intro[] = { open_door(0x34) wait_until(2648, LABEL_82) - play_sound(SFX_0172, CHANNEL_10) + play_sound(SFX_0172, CHANNEL_CUTSCENE) wait_until(2680, LABEL_83) speak(CHR_BOND, L_LIP_099, MP3_0432, CHANNEL_5, COLOR_09_BLUE) // "Great. Now, if I can just fight the urge to report..." wait_until(2690, LABEL_84) - play_sound(SFX_0173, CHANNEL_10) + play_sound(SFX_0173, CHANNEL_CUTSCENE) wait_until(2986, LABEL_85) - play_sound(SFX_0161, CHANNEL_10) + play_sound(SFX_0161, CHANNEL_CUTSCENE) wait_until(3048, LABEL_86) - play_sound(SFX_0162, CHANNEL_10) + play_sound(SFX_0162, CHANNEL_CUTSCENE) wait_until(3104, LABEL_87) - play_sound(SFX_0163, CHANNEL_10) + play_sound(SFX_0163, CHANNEL_CUTSCENE) wait_until(3152, LABEL_88) - play_sound(SFX_0164, CHANNEL_10) + play_sound(SFX_0164, CHANNEL_CUTSCENE) beginloop(0x08) if_camera_animating(/*goto*/ LABEL_2D) @@ -4156,11 +4156,11 @@ u8 func1002_intro[] = { endloop(0x08) label(LABEL_8B) - mute_channel(CHANNEL_10) + mute_channel(CHANNEL_CUTSCENE) mute_channel(CHANNEL_5) mute_channel(CHANNEL_1) assign_sound(SFX_8169, CHANNEL_1) - control_sound_from_object(CHANNEL_1, OBJ_CRATE, TRUE) + set_object_sound_playing(CHANNEL_1, OBJ_CRATE, TRUE) unset_chr_chrflag(CHR_BOND, CHRCFLAG_UNPLAYABLE) set_chr_hiddenflag(CHR_BOND, CHRHFLAG_00020000) chr_do_animation(ANIM_CUT_LIP_INTRO_JO, -2, -1, CHRANIMFLAG_MOVEWHENINVIS | CHRANIMFLAG_PAUSEATEND, 0, CHR_BOND, 2) @@ -4172,7 +4172,7 @@ u8 func1002_intro[] = { set_chr_chrflag(CHR_INTRO_DEAD_GUARD, CHRCFLAG_INVINCIBLE) set_chr_hiddenflag(CHR_INTRO_DEAD_GUARD, CHRHFLAG_00020000) chr_do_animation(ANIM_CUT_LIP_INTRO_GUARD, -2, -1, CHRANIMFLAG_MOVEWHENINVIS | CHRANIMFLAG_PAUSEATEND, 0, CHR_INTRO_DEAD_GUARD, 2) - mute_channel(CHANNEL_10) + mute_channel(CHANNEL_CUTSCENE) unset_object_flag2(OBJ_CRATE, OBJFLAG2_CANFILLVIEWPORT) set_object_flag3(OBJ_CRATE, OBJFLAG3_00000010) object_do_animation(ANIM_CUT_LIP_INTRO_CRATE, OBJ_CRATE, 0x01, 0xfffe) diff --git a/src/setups/setuplue.c b/src/setups/setuplue.c index db7f8a060..d6c583a47 100644 --- a/src/setups/setuplue.c +++ b/src/setups/setuplue.c @@ -1142,11 +1142,11 @@ u8 func1405_antenna_switch[] = { label(0x2e) if_stage_flag_eq(STAGEFLAG_ANTENNA_LOWERED, TRUE, /*goto*/ 0x06) #if VERSION >= VERSION_NTSC_1_0 - play_sound_from_object2(CHANNEL_9, OBJ_ANTENNA_SWITCH, SFX_DOOR_801E, 0x00, 0x00) - play_sound_from_object2(CHANNEL_1, OBJ_ANTENNA, SFX_00CD, 0x00, 0x02) + play_sound_from_object2(CHANNEL_9, OBJ_ANTENNA_SWITCH, SFX_DOOR_801E, PSTYPE_NONE, 0) + play_sound_from_object2(CHANNEL_1, OBJ_ANTENNA, SFX_00CD, PSTYPE_NONE, PSFLAG_REPEATING) #else assign_sound(SFX_00CD, CHANNEL_1) - control_sound_from_object(CHANNEL_1, OBJ_ANTENNA_SWITCH, TRUE) + set_object_sound_playing(CHANNEL_1, OBJ_ANTENNA_SWITCH, TRUE) #endif set_object_image(OBJ_ANTENNA_SWITCH, 0, TVCMDLIST_12) unset_object_flag(OBJ_ANTENNA, OBJFLAG_DEACTIVATED) @@ -1171,18 +1171,18 @@ u8 func1405_antenna_switch[] = { label(0x2e) mute_channel(CHANNEL_1) #if VERSION >= VERSION_NTSC_1_0 - play_sound_from_object2(CHANNEL_9, OBJ_ANTENNA_SWITCH, SFX_DOOR_801F, 0x00, 0x00) + play_sound_from_object2(CHANNEL_9, OBJ_ANTENNA_SWITCH, SFX_DOOR_801F, PSTYPE_NONE, 0) #endif set_object_flag(OBJ_ANTENNA, OBJFLAG_DEACTIVATED) reloop(0x04) label(0x06) #if VERSION >= VERSION_NTSC_1_0 - play_sound_from_object2(CHANNEL_9, OBJ_ANTENNA_SWITCH, SFX_DOOR_801E, 0x00, 0x00) - play_sound_from_object2(CHANNEL_1, OBJ_ANTENNA, SFX_00CD, 0x00, 0x02) + play_sound_from_object2(CHANNEL_9, OBJ_ANTENNA_SWITCH, SFX_DOOR_801E, PSTYPE_NONE, 0) + play_sound_from_object2(CHANNEL_1, OBJ_ANTENNA, SFX_00CD, PSTYPE_NONE, PSFLAG_REPEATING) #else assign_sound(SFX_00CD, CHANNEL_1) - control_sound_from_object(CHANNEL_1, OBJ_ANTENNA_SWITCH, TRUE) + set_object_sound_playing(CHANNEL_1, OBJ_ANTENNA_SWITCH, TRUE) #endif set_object_image(OBJ_ANTENNA_SWITCH, 0, TVCMDLIST_13) unset_object_flag(OBJ_ANTENNA, OBJFLAG_DEACTIVATED) @@ -1207,7 +1207,7 @@ u8 func1405_antenna_switch[] = { label(0x2e) mute_channel(CHANNEL_1) #if VERSION >= VERSION_NTSC_1_0 - play_sound_from_object2(CHANNEL_9, OBJ_ANTENNA_SWITCH, SFX_DOOR_801F, 0x00, 0x00) + play_sound_from_object2(CHANNEL_9, OBJ_ANTENNA_SWITCH, SFX_DOOR_801F, PSTYPE_NONE, 0) #endif set_object_flag(OBJ_ANTENNA, OBJFLAG_DEACTIVATED) endloop(0x04) @@ -1876,13 +1876,13 @@ u8 func040e_outro[] = { set_chr_shooting_in_cutscene(CHR_JONATHAN, FALSE) wait_until(296, 0x79) - play_sound(SFX_HIT_CHR, CHANNEL_10) + play_sound(SFX_HIT_CHR, CHANNEL_CUTSCENE) wait_until(310, 0x7a) - play_sound(SFX_ARGH_MALE_0090, CHANNEL_10) + play_sound(SFX_ARGH_MALE_0090, CHANNEL_CUTSCENE) wait_until(392, 0x69) - play_sound(SFX_THUD_808E, CHANNEL_10) + play_sound(SFX_THUD_808E, CHANNEL_CUTSCENE) wait_until(406, 0x6c) speak(CHR_P1P2, L_LUE_069, MP3_0423, CHANNEL_5, COLOR_07_RED) // "If what?" @@ -1897,7 +1897,7 @@ u8 func040e_outro[] = { play_sound(SFX_0177, CHANNEL_7) wait_until(464, 0x6d) - play_sound(SFX_007D, CHANNEL_10) + play_sound(SFX_007D, CHANNEL_CUTSCENE) wait_until(472, 0x6e) speak(CHR_P1P2, L_LUE_070, MP3_0424, CHANNEL_5, COLOR_09_BLUE) // "If you'd been discovered yet. And frankly, if this..." @@ -2096,40 +2096,40 @@ u8 func0410_intro[] = { restart_timer wait_until(1, 0x69) - speak(CHR_BOND, L_LUE_066, MP3_0420, CHANNEL_10, COLOR_09_BLUE) // "Agent Dark Mission Log, 1028 hours. Against my bet..." + speak(CHR_BOND, L_LUE_066, MP3_0420, CHANNEL_CUTSCENE, COLOR_09_BLUE) // "Agent Dark Mission Log, 1028 hours. Against my bet..." wait_until(340, 0x6a) - play_sound(SFX_FOOTSTEP_80D5, CHANNEL_10) + play_sound(SFX_FOOTSTEP_80D5, CHANNEL_CUTSCENE) wait_until(364, 0x6b) - play_sound(SFX_04B0, CHANNEL_10) + play_sound(SFX_04B0, CHANNEL_CUTSCENE) wait_until(458, 0x6c) - play_sound(SFX_046E, CHANNEL_10) + play_sound(SFX_046E, CHANNEL_CUTSCENE) - play_sound(SFX_FOOTSTEP_80D5, CHANNEL_10) + play_sound(SFX_FOOTSTEP_80D5, CHANNEL_CUTSCENE) wait_until(496, 0x6d) - play_sound(SFX_FOOTSTEP_80CC, CHANNEL_10) + play_sound(SFX_FOOTSTEP_80CC, CHANNEL_CUTSCENE) - play_sound(SFX_FOOTSTEP_80CD, CHANNEL_10) + play_sound(SFX_FOOTSTEP_80CD, CHANNEL_CUTSCENE) wait_until(638, 0x6e) wait_until(688, 0x6f) - play_sound(SFX_JO_LANDING_046F, CHANNEL_10) - play_sound(SFX_FOOTSTEP_80CE, CHANNEL_10) - play_sound(SFX_FOOTSTEP_80CF, CHANNEL_10) + play_sound(SFX_JO_LANDING_046F, CHANNEL_CUTSCENE) + play_sound(SFX_FOOTSTEP_80CE, CHANNEL_CUTSCENE) + play_sound(SFX_FOOTSTEP_80CF, CHANNEL_CUTSCENE) wait_until(750, 0x70) - play_sound(SFX_016A, CHANNEL_10) + play_sound(SFX_016A, CHANNEL_CUTSCENE) wait_until(815, 0x71) - play_sound(SFX_016B, CHANNEL_10) + play_sound(SFX_016B, CHANNEL_CUTSCENE) wait_until(844, 0x72) - play_sound(SFX_016C, CHANNEL_10) + play_sound(SFX_016C, CHANNEL_CUTSCENE) wait_until(908, 0x73) - play_sound(SFX_0169, CHANNEL_10) + play_sound(SFX_0169, CHANNEL_CUTSCENE) wait_until(916, 0x74) @@ -2143,7 +2143,7 @@ u8 func0410_intro[] = { endloop(0x0c) label(0x54) - mute_channel(CHANNEL_10) + mute_channel(CHANNEL_CUTSCENE) mute_channel(CHANNEL_7) unset_chr_chrflag(CHR_COOP, CHRCFLAG_HIDDEN) unset_chr_chrflag(CHR_ANTI, CHRCFLAG_HIDDEN) @@ -2200,7 +2200,7 @@ u8 func1010_bunker_lighting[] = { mute_channel(CHANNEL_0) yield assign_sound(SFX_ALARM_INFILTRATION, CHANNEL_0) - play_sound_from_object(CHANNEL_0, 0x10, 1, 800, 1100) + play_repeating_sound_from_object(CHANNEL_0, 0x10, 1, 800, 1100) set_lights_state(0x0009, LIGHTOP_TRANSITION, 255, 50, 120) if_difficulty_lt(DIFF_SA, /*goto*/ 0x0e) restart_timer @@ -2478,7 +2478,7 @@ u8 func1011_bunker_explosives[] = { destroy_object(OBJ_RADAR_TERMINAL) mute_channel(CHANNEL_0) assign_sound(SFX_0479, CHANNEL_0) - control_sound_from_object(CHANNEL_0, OBJ_RADAR_TERMINAL, TRUE) + set_object_sound_playing(CHANNEL_0, OBJ_RADAR_TERMINAL, TRUE) restart_timer beginloop(0x0b) @@ -2601,7 +2601,7 @@ u8 func1016_trigger_interceptor[] = { u8 func1017_radar_terminal_noise[] = { yield assign_sound(SFX_8146, CHANNEL_0) - play_sound_from_object(CHANNEL_0, OBJ_RADAR_TERMINAL, 1, 800, 1100) + play_repeating_sound_from_object(CHANNEL_0, OBJ_RADAR_TERMINAL, 1, 800, 1100) set_ailist(CHR_SELF, GAILIST_IDLE) endlist }; diff --git a/src/setups/setuppam.c b/src/setups/setuppam.c index 1721d5ede..355e97d91 100644 --- a/src/setups/setuppam.c +++ b/src/setups/setuppam.c @@ -1536,7 +1536,7 @@ u8 func0c01_midcutscene[] = { label(0x06) wait_until(114, 0x63) - speak(CHR_BOND, L_PAM_035, MP3_046D, CHANNEL_10, COLOR_09_BLUE) // "Here goes. I just hope dataDyne haven't done anyth..." + speak(CHR_BOND, L_PAM_035, MP3_046D, CHANNEL_CUTSCENE, COLOR_09_BLUE) // "Here goes. I just hope dataDyne haven't done anyth..." wait_until(300, 0x64) play_sound(SFX_0171, CHANNEL_2) @@ -1548,10 +1548,10 @@ u8 func0c01_midcutscene[] = { play_sound(SFX_0423, CHANNEL_5) wait_until(440, 0x1a) - play_sound(SFX_04F7, CHANNEL_10) + play_sound(SFX_04F7, CHANNEL_CUTSCENE) wait_until(490, 0x6b) - speak(CHR_BOND, L_PAM_036, MP3_046E, CHANNEL_10, COLOR_04_ORANGE) // "Virus detected." + speak(CHR_BOND, L_PAM_036, MP3_046E, CHANNEL_CUTSCENE, COLOR_04_ORANGE) // "Virus detected." wait_until(570, 0x69) @@ -1566,7 +1566,7 @@ u8 func0c01_midcutscene[] = { label(0x06) set_drcaroll_images(CHR_DRCAROLL, DRCAROLLIMAGE_EYESFROWNING, DRCAROLLIMAGE_EYESFROWNING) - speak(CHR_BOND, L_PAM_037, MP3_046F, CHANNEL_10, COLOR_09_BLUE) // "Me and my big mouth." + speak(CHR_BOND, L_PAM_037, MP3_046F, CHANNEL_CUTSCENE, COLOR_09_BLUE) // "Me and my big mouth." wait_until(700, 0x6d) play_sound(SFX_0172, CHANNEL_6) @@ -1585,7 +1585,7 @@ u8 func0c01_midcutscene[] = { goto_first(0x71) label(0x06) - speak(CHR_BOND, L_PAM_038, MP3_0470, CHANNEL_10, COLOR_04_ORANGE) // "Commencing countermeasures. Commenc..... *** ooOOo..." + speak(CHR_BOND, L_PAM_038, MP3_0470, CHANNEL_CUTSCENE, COLOR_04_ORANGE) // "Commencing countermeasures. Commenc..... *** ooOOo..." wait_until_with_images(746, 0x73, DRCAROLLIMAGE_EYESFROWNING, DRCAROLLIMAGE_RANDOM) play_sound(SFX_0128, CHANNEL_5) @@ -1691,7 +1691,7 @@ u8 func0c01_midcutscene[] = { play_sound(SFX_0171, CHANNEL_3) wait_until_with_images(1500, 0xd4, DRCAROLLIMAGE_RANDOM, DRCAROLLIMAGE_EYESDEFAULT) - speak(CHR_BOND, L_PAM_039, MP3_0471, CHANNEL_10, COLOR_09_BLUE) // "Dr. Caroll? Are you in control again? Can you stop..." + speak(CHR_BOND, L_PAM_039, MP3_0471, CHANNEL_CUTSCENE, COLOR_09_BLUE) // "Dr. Caroll? Are you in control again? Can you stop..." set_drcaroll_images(CHR_DRCAROLL, DRCAROLLIMAGE_EYESDEFAULT, DRCAROLLIMAGE_EYESDEFAULT) wait_until(1534, 0xd6) @@ -1704,7 +1704,7 @@ u8 func0c01_midcutscene[] = { play_sound(SFX_0175, CHANNEL_5) wait_until(1810, 0xe3) - speak(CHR_BOND, L_PAM_040, MP3_0472, CHANNEL_10, COLOR_04_ORANGE) // "Yes, I'm back again, my dear. But the program has ..." + speak(CHR_BOND, L_PAM_040, MP3_0472, CHANNEL_CUTSCENE, COLOR_04_ORANGE) // "Yes, I'm back again, my dear. But the program has ..." wait_until(1810, 0xe5) play_sound(SFX_0177, CHANNEL_3) @@ -1714,10 +1714,10 @@ u8 func0c01_midcutscene[] = { wait_until(2378, 0xe9) mute_channel(CHANNEL_7) - speak(CHR_BOND, L_PAM_041, MP3_0473, CHANNEL_10, COLOR_09_BLUE) // "What do you mean?" + speak(CHR_BOND, L_PAM_041, MP3_0473, CHANNEL_CUTSCENE, COLOR_09_BLUE) // "What do you mean?" wait_until(2510, 0xea) - speak(CHR_BOND, L_PAM_042, MP3_0474, CHANNEL_10, COLOR_04_ORANGE) // "When the program has run, I will have control of a..." + speak(CHR_BOND, L_PAM_042, MP3_0474, CHANNEL_CUTSCENE, COLOR_04_ORANGE) // "When the program has run, I will have control of a..." wait_until(3126, 0xf5) play_sound(SFX_012B, CHANNEL_5) @@ -1806,7 +1806,7 @@ u8 func0c01_midcutscene[] = { endloop(0x08) label(0x57) - mute_channel(CHANNEL_10) + mute_channel(CHANNEL_CUTSCENE) mute_channel(CHANNEL_7) mute_channel(CHANNEL_6) mute_channel(CHANNEL_5) @@ -2050,27 +2050,27 @@ u8 func1002_intro[] = { set_cutscene_weapon(CHR_BOND, WEAPON_FALCON2_SCOPE, WEAPON_NONE) wait_until(0, 0x63) - play_sound_from_object2(CHANNEL_5, 0x07, SFX_DOOR_81AA, 0x00, 0x00) + play_sound_from_object2(CHANNEL_5, 0x07, SFX_DOOR_81AA, PSTYPE_NONE, 0) wait_until(260, 0x8a) - play_sound(SFX_FOOTSTEP_80D5, CHANNEL_10) + play_sound(SFX_FOOTSTEP_80D5, CHANNEL_CUTSCENE) wait_until(280, 0x8b) - play_sound(SFX_FOOTSTEP_80D4, CHANNEL_10) + play_sound(SFX_FOOTSTEP_80D4, CHANNEL_CUTSCENE) wait_until(300, 0x89) play_sound(SFX_CLOAK_ON, CHANNEL_7) set_chr_hiddenflag(0x40, CHRHFLAG_CLOAKED) - play_sound(SFX_FOOTSTEP_80D7, CHANNEL_10) + play_sound(SFX_FOOTSTEP_80D7, CHANNEL_CUTSCENE) wait_until(320, 0x8c) - play_sound(SFX_FOOTSTEP_80D6, CHANNEL_10) + play_sound(SFX_FOOTSTEP_80D6, CHANNEL_CUTSCENE) wait_until(852, 0x64) play_sound(SFX_0171, CHANNEL_7) wait_until(1210, 0x65) - speak(CHR_BOND, L_PAM_031, MP3_0469, CHANNEL_10, COLOR_04_ORANGE) // "This doesn't seem normal. No one's around." + speak(CHR_BOND, L_PAM_031, MP3_0469, CHANNEL_CUTSCENE, COLOR_04_ORANGE) // "This doesn't seem normal. No one's around." wait_until(1266, 0x66) play_sound(SFX_0172, CHANNEL_7) @@ -2080,10 +2080,10 @@ u8 func1002_intro[] = { wait_until(1430, 0x6b) mute_channel(CHANNEL_5) - play_sound_from_object2(CHANNEL_5, 0x07, SFX_81A9, 0x00, 0x00) + play_sound_from_object2(CHANNEL_5, 0x07, SFX_81A9, PSTYPE_NONE, 0) wait_until(1522, 0x6c) - speak(CHR_BOND, L_PAM_032, MP3_046A, CHANNEL_10, COLOR_09_BLUE) // "No signs of conflict. No spent ammo cases or bulle..." + speak(CHR_BOND, L_PAM_032, MP3_046A, CHANNEL_CUTSCENE, COLOR_09_BLUE) // "No signs of conflict. No spent ammo cases or bulle..." wait_until(1548, 0x6d) play_sound(SFX_0174, CHANNEL_7) @@ -2098,7 +2098,7 @@ u8 func1002_intro[] = { play_sound(SFX_0177, CHANNEL_7) wait_until(1945, 0x71) - speak(CHR_BOND, L_PAM_033, MP3_046B, CHANNEL_10, COLOR_04_ORANGE) // "But there ought to be a rear guard at least. It ma..." + speak(CHR_BOND, L_PAM_033, MP3_046B, CHANNEL_CUTSCENE, COLOR_04_ORANGE) // "But there ought to be a rear guard at least. It ma..." wait_until(1958, 0x72) play_sound(SFX_0178, CHANNEL_7) @@ -2128,7 +2128,7 @@ u8 func1002_intro[] = { play_sound(SFX_0178, CHANNEL_7) wait_until(2420, 0x7b) - speak(CHR_BOND, L_PAM_034, MP3_046C, CHANNEL_10, COLOR_09_BLUE) // "There has to be someone farther inside. Cover me." + speak(CHR_BOND, L_PAM_034, MP3_046C, CHANNEL_CUTSCENE, COLOR_09_BLUE) // "There has to be someone farther inside. Cover me." wait_until(2426, 0x7c) play_sound(SFX_0171, CHANNEL_7) @@ -2183,7 +2183,7 @@ u8 func1002_intro[] = { mute_channel(CHANNEL_6) mute_channel(CHANNEL_5) mute_channel(CHANNEL_4) - mute_channel(CHANNEL_10) + mute_channel(CHANNEL_CUTSCENE) remove_chr(0x40) unset_chr_chrflag(CHR_COOP, CHRCFLAG_HIDDEN) unset_chr_chrflag(CHR_ANTI, CHRCFLAG_HIDDEN) @@ -3662,7 +3662,7 @@ u8 func041e_init_sa_megaweapon_miniskedar[] = { \ label(0x06) \ assign_sound(SFX_8147, CHANNEL_7) \ - control_sound_from_object(CHANNEL_7, mine, TRUE) \ + set_object_sound_playing(CHANNEL_7, mine, TRUE) \ yield \ destroy_object(mine) \ destroy_object(glass1) \ diff --git a/src/setups/setuppete.c b/src/setups/setuppete.c index a648dd759..0fec5636c 100644 --- a/src/setups/setuppete.c +++ b/src/setups/setuppete.c @@ -818,7 +818,7 @@ u8 func1026_uplink[] = { label(0x03) show_hudmsg(CHR_P1P2, L_PETE_019) // "Accessing hovercab navigation systems." assign_sound(SFX_0456, CHANNEL_7) - control_sound_from_object(CHANNEL_7, OBJ_TAXI, TRUE) + set_object_sound_playing(CHANNEL_7, OBJ_TAXI, TRUE) restart_timer beginloop(0x05) @@ -832,7 +832,7 @@ u8 func1026_uplink[] = { show_hudmsg(CHR_P1P2, L_PETE_021) // "Hovercab navigation systems reprogrammed." mute_channel(CHANNEL_7) assign_sound(SFX_01C1, CHANNEL_7) - control_sound_from_object(CHANNEL_7, OBJ_TAXI, TRUE) + set_object_sound_playing(CHANNEL_7, OBJ_TAXI, TRUE) yield set_stage_flag(STAGEFLAG_TAXI_REPROGRAMMED) set_ailist(CHR_SELF, GAILIST_IDLE) @@ -845,7 +845,7 @@ u8 func1026_uplink[] = { yield yield assign_sound(SFX_0457, CHANNEL_4) - play_sound_from_object(CHANNEL_4, OBJ_TAXI, 1, 300, 400) + play_repeating_sound_from_object(CHANNEL_4, OBJ_TAXI, 1, 300, 400) restart_timer beginloop(0x1d) @@ -902,7 +902,7 @@ u8 func040d_limo[] = { object_do_animation(ANIM_02D6, OBJ_LIMO, 0x04, 0xffff) assign_sound(SFX_BIKE_ENGINE, CHANNEL_1) - play_sound_from_object(CHANNEL_1, OBJ_LIMO, 1, 2400, 3200) + play_repeating_sound_from_object(CHANNEL_1, OBJ_LIMO, 1, 2400, 3200) if_stage_flag_eq(STAGEFLAG_TRACERBUG_PLACED, TRUE, /*goto*/ 0x03) if_difficulty_lt(DIFF_PA, /*goto*/ 0x03) set_stage_flag(STAGEFLAG_LIMO_ESCAPED) @@ -941,7 +941,7 @@ u8 func040c_taxi[] = { // Take off label(0x03) assign_sound(SFX_8000, CHANNEL_0) - play_sound_from_object(CHANNEL_0, OBJ_TAXI, 1, 2400, 3200) + play_repeating_sound_from_object(CHANNEL_0, OBJ_TAXI, 1, 2400, 3200) object_do_animation(ANIM_0168, OBJ_TAXI, 0x04, 0xffff) set_object_flag2(OBJ_TAXI, OBJFLAG2_CANFILLVIEWPORT) @@ -2399,10 +2399,10 @@ u8 func040a_intro_from_gameplay[] = { u8 func101f_setup_robot_noise[] = { #if VERSION >= VERSION_NTSC_1_0 - play_sound_from_object2(CHANNEL_2, CHR_ROBOT, SFX_80B9, 0x00, 0x02) + play_sound_from_object2(CHANNEL_2, CHR_ROBOT, SFX_80B9, PSTYPE_NONE, PSFLAG_REPEATING) #else play_sound(SFX_80B9, CHANNEL_2) - play_sound_from_object(CHANNEL_2, CHR_ROBOT, 0, 900, 1500) + play_repeating_sound_from_object(CHANNEL_2, CHR_ROBOT, 0, 900, 1500) #endif set_ailist(CHR_SELF, GAILIST_IDLE) endlist @@ -2759,7 +2759,7 @@ u8 func040b_outro[] = { label(0x2e) mute_channel(CHANNEL_7) - mute_channel(CHANNEL_10) + mute_channel(CHANNEL_CUTSCENE) label(0x04) end_level set_ailist(CHR_SELF, GAILIST_IDLE) diff --git a/src/setups/setuprit.c b/src/setups/setuprit.c index 1b1aebf2c..fb01b9ea6 100644 --- a/src/setups/setuprit.c +++ b/src/setups/setuprit.c @@ -1161,7 +1161,7 @@ u8 func100a_autopilot_switch[] = { // Switch pressed label(0x06) assign_sound(SFX_043A, CHANNEL_7) - control_sound_from_object(CHANNEL_7, OBJ_AUTOPILOT_SWITCH, TRUE) + set_object_sound_playing(CHANNEL_7, OBJ_AUTOPILOT_SWITCH, TRUE) set_object_image(OBJ_AUTOPILOT_SWITCH, 0, TVCMDLIST_13) set_stage_flag(STAGEFLAG_PLANE_STABILIZED) yield @@ -2110,7 +2110,7 @@ u8 func1002_intro[] = { wait_until(2654, 0x7b) speak(CHR_BOND, L_RIT_078, MP3_0451, CHANNEL_7, COLOR_05_GREEN) // "My last chance? Ha! You fool. That was yours." close_door(0x15) - play_sound(SFX_DOOR_8008, CHANNEL_10) + play_sound(SFX_DOOR_8008, CHANNEL_CUTSCENE) wait_until(2680, 0x9f) @@ -2136,7 +2136,7 @@ u8 func1002_intro[] = { endloop(0x08) label(0x7d) - mute_channel(CHANNEL_10) + mute_channel(CHANNEL_CUTSCENE) set_chr_hiddenflag(CHR_BOND, CHRHFLAG_DISGUISED) if_chr_death_animation_finished(CHR_COOP, /*goto*/ 0x2d) set_chr_hiddenflag(CHR_COOP, CHRHFLAG_DISGUISED) @@ -3513,7 +3513,7 @@ u8 func0423_outro[] = { speak(CHR_BOND, L_RIT_080, MP3_0453, CHANNEL_7, COLOR_06_WHITE) // "Piece of cake, Joanna. Watch this!" outro_wait_until(1045, 0x65) - play_sound(SFX_0063, CHANNEL_10) + play_sound(SFX_0063, CHANNEL_CUTSCENE) outro_wait_until(1050, 0x78) speak(CHR_BOND, L_RIT_081, MP3_0454, CHANNEL_7, COLOR_06_WHITE) // "Uh-oh." @@ -3565,7 +3565,7 @@ u8 func0423_outro[] = { endloop(0x08) label(0x5f) - mute_channel(CHANNEL_10) + mute_channel(CHANNEL_CUTSCENE) label(0x06) stop_cutscene_track configure_environment(0x0000, AIENVCMD_STOPNOSEDIVE, 0) @@ -3665,7 +3665,7 @@ u8 func101a_equipment_switch[] = { open_door(0x1c) show_hudmsg(CHR_P1P2, L_RIT_061) // "Cargo bay has been raised." assign_sound(SFX_043A, CHANNEL_7) - control_sound_from_object(CHANNEL_7, OBJ_EQUIPMENT_SWITCH, TRUE) + set_object_sound_playing(CHANNEL_7, OBJ_EQUIPMENT_SWITCH, TRUE) unset_object_flag(0x1b, OBJFLAG_DEACTIVATED) yield yield @@ -3729,7 +3729,7 @@ u8 func101b_hoverbike_switch[] = { show_hudmsg(CHR_P1P2, L_RIT_060) // "Cargo bay has been lowered." set_savefile_flag(GAMEFILEFLAG_CRASHSITE_BIKE) assign_sound(SFX_043A, CHANNEL_7) - control_sound_from_object(CHANNEL_7, OBJ_HOVERBIKE_SWITCH, TRUE) + set_object_sound_playing(CHANNEL_7, OBJ_HOVERBIKE_SWITCH, TRUE) unset_object_flag(0x1f, OBJFLAG_DEACTIVATED) restart_timer diff --git a/src/setups/setupsev.c b/src/setups/setupsev.c index 19fef736b..413ce371f 100644 --- a/src/setups/setupsev.c +++ b/src/setups/setupsev.c @@ -1350,7 +1350,7 @@ u8 func1008_check_console[] = { label(0x2c) assign_sound(SFX_8111, CHANNEL_0) - play_sound_from_object(CHANNEL_0, OBJ_CONSOLE, 1, 300, 400) + play_repeating_sound_from_object(CHANNEL_0, OBJ_CONSOLE, 1, 300, 400) show_hudmsg(CHR_BOND, L_SEV_009) // "Distress signal has been sent." set_stage_flag(STAGEFLAG_CONSOLE_ACTIVATED) set_ailist(CHR_SELF, GAILIST_IDLE) @@ -1623,19 +1623,19 @@ u8 func041b_outro[] = { play_sound(SFX_0085, CHANNEL_6) wait_until(205, 0x6e) - play_sound(SFX_04F2, CHANNEL_10) + play_sound(SFX_04F2, CHANNEL_CUTSCENE) wait_until(210, 0x6f) - play_sound(SFX_0045, CHANNEL_10) + play_sound(SFX_0045, CHANNEL_CUTSCENE) wait_until(214, 0x70) - play_sound(SFX_ARGH_MAIAN_05E0, CHANNEL_10) + play_sound(SFX_ARGH_MAIAN_05E0, CHANNEL_CUTSCENE) wait_until(260, 0x71) - play_sound(SFX_007B, CHANNEL_10) + play_sound(SFX_007B, CHANNEL_CUTSCENE) wait_until(270, 0x72) - play_sound(SFX_M0_GRAB_A_BODY_BAG, CHANNEL_10) + play_sound(SFX_M0_GRAB_A_BODY_BAG, CHANNEL_CUTSCENE) beginloop(0x08) if_camera_animating(/*goto*/ 0x2c) diff --git a/src/setups/setupsho.c b/src/setups/setupsho.c index 46c0c5b56..c97581a50 100644 --- a/src/setups/setupsho.c +++ b/src/setups/setupsho.c @@ -1101,7 +1101,7 @@ u8 func1005_5e0c[] = { if_stage_flag_eq(STAGEFLAG_TRIGGER_BRIDGE, TRUE, /*goto*/ 0x2d) mute_channel(CHANNEL_5) assign_sound(SFX_0436, CHANNEL_5) - control_sound_from_object(CHANNEL_5, OBJ_PUZZLEROCK, TRUE) + set_object_sound_playing(CHANNEL_5, OBJ_PUZZLEROCK, TRUE) // Wait for a condition that would cause the bridge to retract label(0x2d) @@ -1138,7 +1138,7 @@ u8 func1005_5e0c[] = { // Switch no longer pressed mute_channel(CHANNEL_5) assign_sound(SFX_0437, CHANNEL_5) - control_sound_from_object(CHANNEL_5, OBJ_PUZZLEROCK, TRUE) + set_object_sound_playing(CHANNEL_5, OBJ_PUZZLEROCK, TRUE) goto_first(0x04) // Switch still pressed @@ -1159,7 +1159,7 @@ u8 func1006_bridge[] = { unset_object_flag(OBJ_BRIDGE, OBJFLAG_DEACTIVATED) mute_channel(CHANNEL_4) assign_sound(SFX_DOOR_8020, CHANNEL_4) - play_sound_from_object(CHANNEL_4, OBJ_BRIDGE, 1, 1200, 1600) + play_repeating_sound_from_object(CHANNEL_4, OBJ_BRIDGE, 1, 1200, 1600) yield beginloop(0x08) @@ -1169,7 +1169,7 @@ u8 func1006_bridge[] = { label(0x06) mute_channel(CHANNEL_4) assign_sound(SFX_DOOR_8027, CHANNEL_4) - control_sound_from_object(CHANNEL_4, OBJ_BRIDGE, TRUE) + set_object_sound_playing(CHANNEL_4, OBJ_BRIDGE, TRUE) set_object_flag(OBJ_BRIDGE, OBJFLAG_DEACTIVATED) set_stage_flag(STAGEFLAG_BRIDGE_EXTENDED) @@ -1187,7 +1187,7 @@ u8 func1006_bridge[] = { unset_object_flag(OBJ_BRIDGE, OBJFLAG_DEACTIVATED) mute_channel(CHANNEL_4) assign_sound(SFX_DOOR_8020, CHANNEL_4) - play_sound_from_object(CHANNEL_4, OBJ_BRIDGE, 1, 1200, 1600) + play_repeating_sound_from_object(CHANNEL_4, OBJ_BRIDGE, 1, 1200, 1600) yield beginloop(0x0b) @@ -1199,7 +1199,7 @@ u8 func1006_bridge[] = { set_object_flag(OBJ_BRIDGE, OBJFLAG_DEACTIVATED) mute_channel(CHANNEL_4) assign_sound(SFX_DOOR_8027, CHANNEL_4) - control_sound_from_object(CHANNEL_4, OBJ_BRIDGE, TRUE) + set_object_sound_playing(CHANNEL_4, OBJ_BRIDGE, TRUE) goto_first(0x04) endlist @@ -3249,134 +3249,134 @@ u8 func0c00_intro_sounds[] = { restart_timer wait_until_with_stageflag(100, 0x91) - speak(CHR_BOND, L_SHO_034, MP3_048D, CHANNEL_10, COLOR_04_ORANGE) // "This is the Skedar fanatics' most holy place. They..." + speak(CHR_BOND, L_SHO_034, MP3_048D, CHANNEL_CUTSCENE, COLOR_04_ORANGE) // "This is the Skedar fanatics' most holy place. They..." wait_until_with_stageflag(770, 0xa4) - play_sound(SFX_RELOAD_FARSIGHT, CHANNEL_10) + play_sound(SFX_RELOAD_FARSIGHT, CHANNEL_CUTSCENE) wait_until_with_stageflag(800, 0x92) - speak(CHR_BOND, L_SHO_035, MP3_048E, CHANNEL_10, COLOR_09_BLUE) // "So let me get this straight - it's holy. But there..." + speak(CHR_BOND, L_SHO_035, MP3_048E, CHANNEL_CUTSCENE, COLOR_09_BLUE) // "So let me get this straight - it's holy. But there..." wait_until_with_stageflag(1018, 0xa5) - play_sound(SFX_05A0, CHANNEL_10) + play_sound(SFX_05A0, CHANNEL_CUTSCENE) wait_until_with_stageflag(1090, 0xa6) - play_sound(SFX_05A1, CHANNEL_10) + play_sound(SFX_05A1, CHANNEL_CUTSCENE) wait_until_with_stageflag(1148, 0xa7) - play_sound(SFX_05A0, CHANNEL_10) + play_sound(SFX_05A0, CHANNEL_CUTSCENE) wait_until_with_stageflag(1210, 0x93) - speak(CHR_BOND, L_SHO_036, MP3_048F, CHANNEL_10, COLOR_04_ORANGE) // "Yes. In all of the time that we Maians fought the ..." + speak(CHR_BOND, L_SHO_036, MP3_048F, CHANNEL_CUTSCENE, COLOR_04_ORANGE) // "Yes. In all of the time that we Maians fought the ..." wait_until_with_stageflag(1230, 0xa8) - play_sound(SFX_05A1, CHANNEL_10) + play_sound(SFX_05A1, CHANNEL_CUTSCENE) wait_until(1270, 0xc5) - play_sound(SFX_SKEDAR_ROAR_0531, CHANNEL_10) + play_sound(SFX_SKEDAR_ROAR_0531, CHANNEL_CUTSCENE) wait_until_with_stageflag(1274, 0xa9) - play_sound(SFX_05A0, CHANNEL_10) + play_sound(SFX_05A0, CHANNEL_CUTSCENE) wait_until_with_stageflag(1330, 0xaa) - play_sound(SFX_05A1, CHANNEL_10) + play_sound(SFX_05A1, CHANNEL_CUTSCENE) wait_until_with_stageflag(1375, 0xab) - play_sound(SFX_05A0, CHANNEL_10) + play_sound(SFX_05A0, CHANNEL_CUTSCENE) wait_until_with_stageflag(1435, 0xac) - play_sound(SFX_05A1, CHANNEL_10) + play_sound(SFX_05A1, CHANNEL_CUTSCENE) wait_until_with_stageflag(1490, 0xad) - play_sound(SFX_05A0, CHANNEL_10) + play_sound(SFX_05A0, CHANNEL_CUTSCENE) wait_until_with_stageflag(1600, 0xc7) - play_sound(SFX_05C7, CHANNEL_10) + play_sound(SFX_05C7, CHANNEL_CUTSCENE) wait_until_with_stageflag(1670, 0xc8) - play_sound(SFX_05C6, CHANNEL_10) + play_sound(SFX_05C6, CHANNEL_CUTSCENE) wait_until_with_stageflag(1710, 0xae) - play_sound(SFX_05C5, CHANNEL_10) + play_sound(SFX_05C5, CHANNEL_CUTSCENE) wait_until_with_stageflag(1840, 0xaf) - play_sound(SFX_05CC, CHANNEL_10) + play_sound(SFX_05CC, CHANNEL_CUTSCENE) wait_until_with_stageflag(2040, 0xb7) - play_sound(SFX_05A0, CHANNEL_10) + play_sound(SFX_05A0, CHANNEL_CUTSCENE) wait_until_with_stageflag(2065, 0xb0) - play_sound(SFX_05A1, CHANNEL_10) + play_sound(SFX_05A1, CHANNEL_CUTSCENE) wait_until_with_stageflag(2090, 0xb8) - play_sound(SFX_05A0, CHANNEL_10) + play_sound(SFX_05A0, CHANNEL_CUTSCENE) wait_until_with_stageflag(2115, 0xb1) - play_sound(SFX_05A1, CHANNEL_10) + play_sound(SFX_05A1, CHANNEL_CUTSCENE) wait_until(2050, 0xc6) // time is out of order - play_sound(SFX_SKEDAR_ROAR_0530, CHANNEL_10) + play_sound(SFX_SKEDAR_ROAR_0530, CHANNEL_CUTSCENE) wait_until_with_stageflag(2140, 0xb9) - play_sound(SFX_05A0, CHANNEL_10) + play_sound(SFX_05A0, CHANNEL_CUTSCENE) wait_until_with_stageflag(2180, 0xb2) - play_sound(SFX_05A1, CHANNEL_10) + play_sound(SFX_05A1, CHANNEL_CUTSCENE) wait_until_with_stageflag(2220, 0xb3) - play_sound(SFX_05A0, CHANNEL_10) + play_sound(SFX_05A0, CHANNEL_CUTSCENE) wait_until_with_stageflag(2250, 0xb4) - play_sound(SFX_05A0, CHANNEL_10) + play_sound(SFX_05A0, CHANNEL_CUTSCENE) wait_until_with_stageflag(2290, 0xb5) - play_sound(SFX_05A0, CHANNEL_10) + play_sound(SFX_05A0, CHANNEL_CUTSCENE) wait_until_with_stageflag(2340, 0xb6) - play_sound(SFX_05A0, CHANNEL_10) + play_sound(SFX_05A0, CHANNEL_CUTSCENE) wait_until_with_stageflag(2650, 0x94) - speak(CHR_BOND, L_SHO_037, MP3_0490, CHANNEL_10, COLOR_09_BLUE) // "Then we have to be certain that no fanatics surviv..." + speak(CHR_BOND, L_SHO_037, MP3_0490, CHANNEL_CUTSCENE, COLOR_09_BLUE) // "Then we have to be certain that no fanatics surviv..." wait_until_with_stageflag(3250, 0x95) - speak(CHR_BOND, L_SHO_038, MP3_0491, CHANNEL_10, COLOR_04_ORANGE) // "If you're caught on the ground when the fleet gets..." + speak(CHR_BOND, L_SHO_038, MP3_0491, CHANNEL_CUTSCENE, COLOR_04_ORANGE) // "If you're caught on the ground when the fleet gets..." wait_until(3330, 0xc3) - play_sound(SFX_SKEDAR_ROAR_0530, CHANNEL_10) + play_sound(SFX_SKEDAR_ROAR_0530, CHANNEL_CUTSCENE) wait_until(3535, 0xc4) - play_sound(SFX_SKEDAR_ROAR_0531, CHANNEL_10) + play_sound(SFX_SKEDAR_ROAR_0531, CHANNEL_CUTSCENE) wait_until_with_stageflag(3600, 0x96) mute_channel(CHANNEL_7) - speak(CHR_BOND, L_SHO_039, MP3_0492, CHANNEL_10, COLOR_09_BLUE) // "That's a mistake I don't intend to make." + speak(CHR_BOND, L_SHO_039, MP3_0492, CHANNEL_CUTSCENE, COLOR_09_BLUE) // "That's a mistake I don't intend to make." wait_until(4040, 0xc0) - play_sound(SFX_05A0, CHANNEL_10) + play_sound(SFX_05A0, CHANNEL_CUTSCENE) wait_until(4158, 0xc1) - play_sound(SFX_05A1, CHANNEL_10) + play_sound(SFX_05A1, CHANNEL_CUTSCENE) wait_until(4236, 0xc2) - play_sound(SFX_SKEDAR_ROAR_0529, CHANNEL_10) + play_sound(SFX_SKEDAR_ROAR_0529, CHANNEL_CUTSCENE) wait_until(4580, 0xbc) - play_sound(SFX_01D8, CHANNEL_10) + play_sound(SFX_01D8, CHANNEL_CUTSCENE) wait_until(4610, 0xbd) - play_sound(SFX_01DA, CHANNEL_10) + play_sound(SFX_01DA, CHANNEL_CUTSCENE) wait_until(4630, 0xbe) - play_sound(VERSION >= VERSION_NTSC_1_0 ? SFX_80F6 : SFX_01D9, CHANNEL_10) + play_sound(VERSION >= VERSION_NTSC_1_0 ? SFX_80F6 : SFX_01D9, CHANNEL_CUTSCENE) wait_until(4678, 0xbf) - play_sound(SFX_01DB, CHANNEL_10) + play_sound(SFX_01DB, CHANNEL_CUTSCENE) wait_until_with_stageflag(4675, 0x97) - play_sound(SFX_0162, CHANNEL_10) + play_sound(SFX_0162, CHANNEL_CUTSCENE) wait_until_with_stageflag(4750, 0xbb) - play_sound(SFX_0161, CHANNEL_10) + play_sound(SFX_0161, CHANNEL_CUTSCENE) mute_channel(CHANNEL_0) mute_channel(CHANNEL_1) @@ -3387,7 +3387,7 @@ u8 func0c00_intro_sounds[] = { mute_channel(CHANNEL_6) mute_channel(CHANNEL_7) label(0x86) - mute_channel(CHANNEL_10) + mute_channel(CHANNEL_CUTSCENE) goto_first(0xda) endlist @@ -3431,69 +3431,69 @@ u8 func0414_outro_sounds[] = { restart_timer outro_wait_until_with_stageflag(40, 0xd5) - play_sound(SFX_0067, CHANNEL_10) + play_sound(SFX_0067, CHANNEL_CUTSCENE) outro_wait_until_with_stageflag(80, 0x9e) - play_sound(SFX_0067, CHANNEL_10) + play_sound(SFX_0067, CHANNEL_CUTSCENE) outro_wait_until_with_stageflag(120, 0x9f) - play_sound(SFX_0067, CHANNEL_10) + play_sound(SFX_0067, CHANNEL_CUTSCENE) outro_wait_until_with_stageflag(160, 0xa0) - play_sound(SFX_05C0, CHANNEL_10) + play_sound(SFX_05C0, CHANNEL_CUTSCENE) outro_wait_until_with_stageflag(180, 0xa1) - play_sound(SFX_SKEDAR_ROAR_052D, CHANNEL_10) + play_sound(SFX_SKEDAR_ROAR_052D, CHANNEL_CUTSCENE) outro_wait_until_with_stageflag(230, 0x9b) - speak(CHR_BOND, L_SHO_040, MP3_04DE, CHANNEL_10, COLOR_09_BLUE) // "Yesss..." + speak(CHR_BOND, L_SHO_040, MP3_04DE, CHANNEL_CUTSCENE, COLOR_09_BLUE) // "Yesss..." outro_wait_until_with_stageflag(470, 0xa9) - play_sound(SFX_8099, CHANNEL_10) + play_sound(SFX_8099, CHANNEL_CUTSCENE) outro_wait_until_with_stageflag(494, 0xa2) - play_sound(SFX_EXPLOSION_8098, CHANNEL_10) - play_sound(SFX_00F6, CHANNEL_10) + play_sound(SFX_EXPLOSION_8098, CHANNEL_CUTSCENE) + play_sound(SFX_00F6, CHANNEL_CUTSCENE) outro_wait_until_with_stageflag(520, 0xa8) - play_sound(SFX_809B, CHANNEL_10) + play_sound(SFX_809B, CHANNEL_CUTSCENE) outro_wait_until_with_stageflag(540, 0xa3) - play_sound(SFX_80A2, CHANNEL_10) - play_sound(SFX_00F6, CHANNEL_10) + play_sound(SFX_80A2, CHANNEL_CUTSCENE) + play_sound(SFX_00F6, CHANNEL_CUTSCENE) outro_wait_until_with_stageflag(550, 0xd6) - play_sound(MP3_07C8, CHANNEL_10) + play_sound(MP3_07C8, CHANNEL_CUTSCENE) outro_wait_until_with_stageflag(600, 0xaa) - play_sound(SFX_80A3, CHANNEL_10) + play_sound(SFX_80A3, CHANNEL_CUTSCENE) outro_wait_until_with_stageflag(616, 0xa4) - play_sound(SFX_809F, CHANNEL_10) - play_sound(SFX_00F6, CHANNEL_10) + play_sound(SFX_809F, CHANNEL_CUTSCENE) + play_sound(SFX_00F6, CHANNEL_CUTSCENE) outro_wait_until_with_stageflag(700, 0xa5) - play_sound(SFX_80A1, CHANNEL_10) - play_sound(SFX_00F6, CHANNEL_10) + play_sound(SFX_80A1, CHANNEL_CUTSCENE) + play_sound(SFX_00F6, CHANNEL_CUTSCENE) outro_wait_until_with_stageflag(760, 0xcd) - play_sound(SFX_80A3, CHANNEL_10) + play_sound(SFX_80A3, CHANNEL_CUTSCENE) outro_wait_until(780, 0xae) fade_to_color(0x000000ff, 80) outro_wait_until_with_stageflag(790, 0xa6) - play_sound(SFX_809C, CHANNEL_10) - play_sound(SFX_00F6, CHANNEL_10) + play_sound(SFX_809C, CHANNEL_CUTSCENE) + play_sound(SFX_00F6, CHANNEL_CUTSCENE) outro_wait_until_with_stageflag(820, 0xcc) - play_sound(SFX_80A2, CHANNEL_10) + play_sound(SFX_80A2, CHANNEL_CUTSCENE) outro_wait_until_with_stageflag(860, 0xa7) - play_sound(SFX_80A3, CHANNEL_10) + play_sound(SFX_80A3, CHANNEL_CUTSCENE) outro_wait_until_with_stageflag(880, 0xce) - play_sound(MP3_07DA, CHANNEL_10) + play_sound(MP3_07DA, CHANNEL_CUTSCENE) outro_wait_until(920, 0xaf) fade_to_color(0xffffffff, 0) @@ -3506,23 +3506,23 @@ u8 func0414_outro_sounds[] = { set_cutscene_weapon(CHR_ELVIS, WEAPON_NONE, WEAPON_NONE) outro_wait_until_with_stageflag(1680, 0x91) - mute_channel(CHANNEL_10) - speak(CHR_BOND, L_SHO_041, MP3_0493, CHANNEL_10, COLOR_04_ORANGE) // "Joanna! Joanna!" + mute_channel(CHANNEL_CUTSCENE) + speak(CHR_BOND, L_SHO_041, MP3_0493, CHANNEL_CUTSCENE, COLOR_04_ORANGE) // "Joanna! Joanna!" outro_wait_until_with_stageflag(2020, 0x9c) - speak(CHR_BOND, L_SHO_054, MP3_0755, CHANNEL_10, COLOR_04_ORANGE) // "Where are you? Are you hurt?" + speak(CHR_BOND, L_SHO_054, MP3_0755, CHANNEL_CUTSCENE, COLOR_04_ORANGE) // "Where are you? Are you hurt?" outro_wait_until_with_stageflag(2206, 0x92) - speak(CHR_BOND, L_SHO_042, MP3_0494, CHANNEL_10, COLOR_09_BLUE) // "Elvis! Elvis! Over here." + speak(CHR_BOND, L_SHO_042, MP3_0494, CHANNEL_CUTSCENE, COLOR_09_BLUE) // "Elvis! Elvis! Over here." outro_wait_until_with_stageflag(2625, 0x93) - speak(CHR_BOND, L_SHO_043, MP3_0495, CHANNEL_10, COLOR_04_ORANGE) // "No problem. Grab my arms - we'll get you out in no..." + speak(CHR_BOND, L_SHO_043, MP3_0495, CHANNEL_CUTSCENE, COLOR_04_ORANGE) // "No problem. Grab my arms - we'll get you out in no..." outro_wait_until_with_stageflag(2810, 0xd4) - play_sound(SFX_SKEDAR_ROAR_0531, CHANNEL_10) + play_sound(SFX_SKEDAR_ROAR_0531, CHANNEL_CUTSCENE) outro_wait_until_with_stageflag(2895, 0x94) - speak(CHR_BOND, L_SHO_044, MP3_0496, CHANNEL_10, COLOR_09_BLUE) // "No, quick! Give me your gun!" + speak(CHR_BOND, L_SHO_044, MP3_0496, CHANNEL_CUTSCENE, COLOR_09_BLUE) // "No, quick! Give me your gun!" outro_wait_until_with_stageflag(3160, 0xca) set_cutscene_weapon(CHR_ELVIS, WEAPON_NONE, WEAPON_NONE) @@ -3534,14 +3534,14 @@ u8 func0414_outro_sounds[] = { set_cutscene_weapon(CHR_ELVIS, WEAPON_NONE, WEAPON_NONE) outro_wait_until_with_stageflag(3290, 0x95) - speak(CHR_BOND, L_SHO_045, MP3_0497, CHANNEL_10, COLOR_09_BLUE) // "Will! You! Just! Let! Go!" + speak(CHR_BOND, L_SHO_045, MP3_0497, CHANNEL_CUTSCENE, COLOR_09_BLUE) // "Will! You! Just! Let! Go!" outro_wait_until_with_stageflag(3420, 0xcf) set_chr_shooting_in_cutscene(CHR_TARGET, TRUE) yield yield set_chr_shooting_in_cutscene(CHR_TARGET, FALSE) - play_sound(SFX_SKEDAR_ROAR_052E, CHANNEL_10) + play_sound(SFX_SKEDAR_ROAR_052E, CHANNEL_CUTSCENE) outro_wait_until_with_stageflag(3445, 0xd0) set_chr_shooting_in_cutscene(CHR_TARGET, TRUE) @@ -3566,34 +3566,34 @@ u8 func0414_outro_sounds[] = { yield yield set_chr_shooting_in_cutscene(CHR_TARGET, FALSE) - play_sound_from_object2(CHANNEL_6, 0x25, SFX_SKEDAR_ROAR_052D, 0x00, 0x00) + play_sound_from_object2(CHANNEL_6, 0x25, SFX_SKEDAR_ROAR_052D, PSTYPE_NONE, 0) outro_wait_until_with_stageflag(3600, 0xd7) - play_sound(MP3_07C9, CHANNEL_10) + play_sound(MP3_07C9, CHANNEL_CUTSCENE) outro_wait_until_with_stageflag(3880, 0xd8) - play_sound(SFX_0427, CHANNEL_10) + play_sound(SFX_0427, CHANNEL_CUTSCENE) outro_wait_until_with_stageflag(3990, 0x96) - speak(CHR_BOND, L_SHO_046, MP3_0498, CHANNEL_10, COLOR_04_ORANGE) // "I managed to get the fleet to stop the bombardment..." + speak(CHR_BOND, L_SHO_046, MP3_0498, CHANNEL_CUTSCENE, COLOR_04_ORANGE) // "I managed to get the fleet to stop the bombardment..." outro_wait_until_with_stageflag(4425, 0x97) - speak(CHR_BOND, L_SHO_047, MP3_0499, CHANNEL_10, COLOR_09_BLUE) // "I'd have got out in time if that one hadn't grabbe..." + speak(CHR_BOND, L_SHO_047, MP3_0499, CHANNEL_CUTSCENE, COLOR_09_BLUE) // "I'd have got out in time if that one hadn't grabbe..." outro_wait_until_with_stageflag(4650, 0x98) - speak(CHR_BOND, L_SHO_048, MP3_049A, CHANNEL_10, COLOR_04_ORANGE) // "Of course, Joanna, of course." + speak(CHR_BOND, L_SHO_048, MP3_049A, CHANNEL_CUTSCENE, COLOR_04_ORANGE) // "Of course, Joanna, of course." outro_wait_until_with_stageflag(4825, 0x99) - speak(CHR_BOND, L_SHO_049, MP3_049B, CHANNEL_10, COLOR_09_BLUE) // "No, I would have." + speak(CHR_BOND, L_SHO_049, MP3_049B, CHANNEL_CUTSCENE, COLOR_09_BLUE) // "No, I would have." outro_wait_until_with_stageflag(4960, 0x9a) - speak(CHR_BOND, L_SHO_050, MP3_049C, CHANNEL_10, COLOR_04_ORANGE) // "I believe you." + speak(CHR_BOND, L_SHO_050, MP3_049C, CHANNEL_CUTSCENE, COLOR_04_ORANGE) // "I believe you." outro_wait_until_with_stageflag(5560, 0x9d) play_sound(SFX_0161, CHANNEL_7) label(0x86) - mute_channel(CHANNEL_10) + mute_channel(CHANNEL_CUTSCENE) mute_channel(CHANNEL_7) mute_channel(CHANNEL_6) goto_first(0xda) diff --git a/src/setups/setupstat.c b/src/setups/setupstat.c index ebb8f8ded..8a860ed73 100644 --- a/src/setups/setupstat.c +++ b/src/setups/setupstat.c @@ -1117,7 +1117,7 @@ u8 func1002_intro[] = { // Timer expired - play a sound (explosion?) label(0x06) - play_sound(SFX_MAIAN_05E2, CHANNEL_10) + play_sound(SFX_MAIAN_05E2, CHANNEL_CUTSCENE) // Wait for camera to finish or button to be pressed beginloop(0x08) @@ -1130,7 +1130,7 @@ u8 func1002_intro[] = { // Outro done label(0x82) - mute_channel(CHANNEL_10) + mute_channel(CHANNEL_CUTSCENE) unset_chr_chrflag(CHR_COOP, CHRCFLAG_HIDDEN) unset_chr_chrflag(CHR_ANTI, CHRCFLAG_HIDDEN) set_chr_hiddenflag(CHR_ANTI, CHRHFLAG_00020000) @@ -1195,7 +1195,7 @@ u8 func040b_outro[] = { // Play sound label(0x06) - play_sound(SFX_MAIAN_05E3, CHANNEL_10) + play_sound(SFX_MAIAN_05E3, CHANNEL_CUTSCENE) // Wait 70 frames or for button press beginloop(0x97) @@ -1205,7 +1205,7 @@ u8 func040b_outro[] = { // Play sound label(0x06) - play_sound(SFX_MAIAN_05E5, CHANNEL_10) + play_sound(SFX_MAIAN_05E5, CHANNEL_CUTSCENE) // Wait 180 frames or for button press beginloop(0x98) @@ -1215,7 +1215,7 @@ u8 func040b_outro[] = { // Play sound label(0x06) - play_sound(SFX_MAIAN_05E7, CHANNEL_10) + play_sound(SFX_MAIAN_05E7, CHANNEL_CUTSCENE) // Wait for outro to finish beginloop(0x08) @@ -1228,7 +1228,7 @@ u8 func040b_outro[] = { label(0x82) label(0x06) - mute_channel(CHANNEL_10) + mute_channel(CHANNEL_CUTSCENE) end_level set_ailist(CHR_SELF, GAILIST_IDLE) endlist diff --git a/src/setups/setuptra.c b/src/setups/setuptra.c index bb9a4a13f..ad1b34bf9 100644 --- a/src/setups/setuptra.c +++ b/src/setups/setuptra.c @@ -1965,7 +1965,7 @@ u8 func100c_medpack_activation[] = { #else assign_sound(SFX_043C, CHANNEL_7) #endif - control_sound_from_object(CHANNEL_7, OBJ_HOVERBED, TRUE) + set_object_sound_playing(CHANNEL_7, OBJ_HOVERBED, TRUE) restart_timer beginloop(0x12) @@ -1978,7 +1978,7 @@ u8 func100c_medpack_activation[] = { #else assign_sound(SFX_047C, CHANNEL_7) #endif - control_sound_from_object(CHANNEL_7, OBJ_HOVERBED, TRUE) + set_object_sound_playing(CHANNEL_7, OBJ_HOVERBED, TRUE) restart_timer beginloop(0x08) @@ -1993,7 +1993,7 @@ u8 func100c_medpack_activation[] = { #else assign_sound(SFX_043D, CHANNEL_7) #endif - control_sound_from_object(CHANNEL_7, 0x00, TRUE) + set_object_sound_playing(CHANNEL_7, 0x00, TRUE) show_hudmsg(CHR_P1P2, L_TRA_035) // "Alien medpack has been administered." yield @@ -2113,7 +2113,7 @@ u8 func100f_terminals[] = { // Terminal 1 label(0x08) assign_sound(SFX_043A, CHANNEL_7) - control_sound_from_object(CHANNEL_7, OBJ_TERMINAL1, TRUE) + set_object_sound_playing(CHANNEL_7, OBJ_TERMINAL1, TRUE) if_stage_flag_eq(STAGEFLAG_HANGAR_X_MUSIC_STARTED, TRUE, /*goto*/ 0x32) show_hudmsg(CHR_P1P2, L_TRA_080) // "Console is not active." goto_next(0x0f) @@ -2134,7 +2134,7 @@ u8 func100f_terminals[] = { // Terminal 2 label(0x0a) assign_sound(SFX_043A, CHANNEL_7) - control_sound_from_object(CHANNEL_7, OBJ_TERMINAL2, TRUE) + set_object_sound_playing(CHANNEL_7, OBJ_TERMINAL2, TRUE) if_stage_flag_eq(STAGEFLAG_HANGAR_X_MUSIC_STARTED, TRUE, /*goto*/ 0x32) show_hudmsg(CHR_P1P2, L_TRA_080) // "Console is not active." goto_next(0x0f) @@ -2659,24 +2659,24 @@ u8 func1002_intro[] = { play_sound(SFX_01B9, CHANNEL_6) wait_until(1334, 0x80) - play_sound(SFX_00FB, CHANNEL_10) + play_sound(SFX_00FB, CHANNEL_CUTSCENE) wait_until(1342, 0x81) - play_sound(SFX_00FB, CHANNEL_10) + play_sound(SFX_00FB, CHANNEL_CUTSCENE) wait_until(1353, 0x82) - play_sound(SFX_00F9, CHANNEL_10) + play_sound(SFX_00F9, CHANNEL_CUTSCENE) wait_until(1362, 0x83) wait_until(1372, 0x84) - play_sound(SFX_00FA, CHANNEL_10) + play_sound(SFX_00FA, CHANNEL_CUTSCENE) wait_until(1388, 0x85) play_sound(SFX_01BA, CHANNEL_5) wait_until(1396, 0x86) - play_sound(SFX_00FC, CHANNEL_10) + play_sound(SFX_00FC, CHANNEL_CUTSCENE) wait_until(1432, 0xbf) open_door(0x10) @@ -2700,8 +2700,8 @@ u8 func1002_intro[] = { play_sound(SFX_01B9, CHANNEL_6) wait_until(1730, 0x95) - play_sound(SFX_00FE, CHANNEL_10) - play_sound(SFX_00FA, CHANNEL_10) + play_sound(SFX_00FE, CHANNEL_CUTSCENE) + play_sound(SFX_00FA, CHANNEL_CUTSCENE) wait_until(1736, 0x96) speak(CHR_BOND, L_TRA_063, MP3_0438, CHANNEL_7, COLOR_02_WHITE) // "Let's see how that overconfident thief deals with ..." @@ -2714,13 +2714,13 @@ u8 func1002_intro[] = { close_door(0x10) wait_until(1826, 0x9f) - play_sound(SFX_00FD, CHANNEL_10) + play_sound(SFX_00FD, CHANNEL_CUTSCENE) wait_until(1834, 0xa0) - play_sound(SFX_00FD, CHANNEL_10) + play_sound(SFX_00FD, CHANNEL_CUTSCENE) wait_until(1850, 0xa1) - play_sound(SFX_00FA, CHANNEL_10) + play_sound(SFX_00FA, CHANNEL_CUTSCENE) wait_until(1926, 0xa4) play_sound(SFX_0163, CHANNEL_5) @@ -2759,53 +2759,53 @@ u8 func1002_intro[] = { speak(CHR_BOND, L_TRA_065, MP3_043A, CHANNEL_7, COLOR_02_WHITE) // "Noooo, that wasn't meant to happen!" wait_until(2725, 0xb1) - play_sound(SFX_0429, CHANNEL_10) + play_sound(SFX_0429, CHANNEL_CUTSCENE) wait_until(2748, 0xb2) - play_sound(SFX_0429, CHANNEL_10) + play_sound(SFX_0429, CHANNEL_CUTSCENE) wait_until(2768, 0x97) - play_sound(SFX_0429, CHANNEL_10) + play_sound(SFX_0429, CHANNEL_CUTSCENE) wait_until(2810, 0x98) - play_sound(SFX_0429, CHANNEL_10) - play_sound(SFX_0429, CHANNEL_10) + play_sound(SFX_0429, CHANNEL_CUTSCENE) + play_sound(SFX_0429, CHANNEL_CUTSCENE) wait_until(2877, 0x99) - play_sound(SFX_0429, CHANNEL_10) - play_sound(SFX_0429, CHANNEL_10) + play_sound(SFX_0429, CHANNEL_CUTSCENE) + play_sound(SFX_0429, CHANNEL_CUTSCENE) wait_until(2904, 0xb3) - play_sound(SFX_0429, CHANNEL_10) - play_sound(SFX_0429, CHANNEL_10) + play_sound(SFX_0429, CHANNEL_CUTSCENE) + play_sound(SFX_0429, CHANNEL_CUTSCENE) wait_until(2924, 0xb5) - play_sound(SFX_0429, CHANNEL_10) - play_sound(SFX_0429, CHANNEL_10) + play_sound(SFX_0429, CHANNEL_CUTSCENE) + play_sound(SFX_0429, CHANNEL_CUTSCENE) wait_until(2930, 0xb4) - play_sound(SFX_COUGH_04AF, CHANNEL_10) + play_sound(SFX_COUGH_04AF, CHANNEL_CUTSCENE) wait_until(3024, 0x89) - play_sound(SFX_00FA, CHANNEL_10) - play_sound(SFX_00F9, CHANNEL_10) + play_sound(SFX_00FA, CHANNEL_CUTSCENE) + play_sound(SFX_00F9, CHANNEL_CUTSCENE) wait_until(3060, 0xb0) - play_sound(SFX_COUGH_04B0, CHANNEL_10) + play_sound(SFX_COUGH_04B0, CHANNEL_CUTSCENE) wait_until(3178, 0xb6) play_sound(SFX_007D, CHANNEL_6) wait_until(3242, 0xb7) play_sound(SFX_01DC, CHANNEL_6) - play_sound(SFX_00FC, CHANNEL_10) + play_sound(SFX_00FC, CHANNEL_CUTSCENE) wait_until(3290, 0xb8) play_sound(SFX_01DC, CHANNEL_6) - play_sound(SFX_00FD, CHANNEL_10) + play_sound(SFX_00FD, CHANNEL_CUTSCENE) wait_until(3334, 0xb9) - play_sound(SFX_00FA, CHANNEL_10) + play_sound(SFX_00FA, CHANNEL_CUTSCENE) wait_until(3894, 0xba) speak(CHR_BOND, L_TRA_067, MP3_043B, CHANNEL_7, COLOR_09_BLUE) // "You idiot! We'd better get out of here." @@ -2833,7 +2833,7 @@ u8 func1002_intro[] = { set_stage_flag(STAGEFLAG_GAS_ON) mute_channel(CHANNEL_7) mute_channel(CHANNEL_6) - mute_channel(CHANNEL_10) + mute_channel(CHANNEL_CUTSCENE) unset_chr_chrflag(CHR_COOP, CHRCFLAG_HIDDEN) unset_chr_chrflag(CHR_ANTI, CHRCFLAG_HIDDEN) unset_chr_chrflag(CHR_BOND, CHRCFLAG_UNPLAYABLE) @@ -3080,7 +3080,7 @@ u8 func101b_gas_sound[] = { label(0x04) yield assign_sound(SFX_816A, CHANNEL_0) - play_sound_from_object(CHANNEL_0, 0x2b, 1, 8000, 3000) + play_repeating_sound_from_object(CHANNEL_0, 0x2b, 1, 8000, 3000) set_ailist(CHR_SELF, GAILIST_IDLE) endlist }; @@ -3394,7 +3394,7 @@ u8 func101a_medpack_switch[] = { label(0x32) assign_sound(SFX_043A, CHANNEL_7) - control_sound_from_object(CHANNEL_7, OBJ_MEDPACK_SWITCH, TRUE) + set_object_sound_playing(CHANNEL_7, OBJ_MEDPACK_SWITCH, TRUE) show_hudmsg(CHR_P1P2, L_TRA_054) // "Medical containment doors unlocked." unlock_door(0x12, 0x40) unlock_door(0x13, 0x40) diff --git a/src/setups/setupwax.c b/src/setups/setupwax.c index 499ef50eb..16fdebe62 100644 --- a/src/setups/setupwax.c +++ b/src/setups/setupwax.c @@ -1696,7 +1696,7 @@ u8 func1007_bomb_logic[] = { disable_object(OBJ_BOND_BOMB) disable_object(OBJ_COOP_BOMB) assign_sound(SFX_8144, CHANNEL_1) - play_sound_from_object(CHANNEL_1, OBJ_PLANTED_BOMB, 1, 600, 1200) + play_repeating_sound_from_object(CHANNEL_1, OBJ_PLANTED_BOMB, 1, 600, 1200) unset_object_flag2(OBJ_PLANTED_BOMB, OBJFLAG2_INVISIBLE) set_object_image(OBJ_PLANTED_BOMB, 0, TVCMDLIST_0F) unset_object_flag(OBJ_PLANTED_BOMB, OBJFLAG_INVINCIBLE) @@ -2001,18 +2001,18 @@ u8 func0416_intro[] = { label(0x06) wait_until(106, 0xb1) - play_sound(SFX_0162, CHANNEL_10) - play_sound(SFX_047A, CHANNEL_10) + play_sound(SFX_0162, CHANNEL_CUTSCENE) + play_sound(SFX_047A, CHANNEL_CUTSCENE) wait_until(107, 0xb3) open_door(OBJ_LOBBYDOOR_LEFT) open_door(OBJ_LOBBYDOOR_RIGHT) wait_until(170, 0xb2) - play_sound(SFX_0163, CHANNEL_10) + play_sound(SFX_0163, CHANNEL_CUTSCENE) wait_until(246, 0xb6) - play_sound(SFX_0161, CHANNEL_10) + play_sound(SFX_0161, CHANNEL_CUTSCENE) wait_until(280, 0xb7) close_door(OBJ_LOBBYDOOR_LEFT) @@ -2036,7 +2036,7 @@ u8 func0416_intro[] = { unset_object_flag2(0x62, OBJFLAG2_INVISIBLE) set_object_flag(0x61, OBJFLAG_00000100) set_object_flag(0x62, OBJFLAG_00000100) - mute_channel(CHANNEL_10) + mute_channel(CHANNEL_CUTSCENE) unset_chr_chrflag(CHR_COOP, CHRCFLAG_HIDDEN) unset_chr_chrflag(CHR_ANTI, CHRCFLAG_HIDDEN) unset_chr_chrflag(CHR_BOND, CHRCFLAG_UNPLAYABLE)