Document propsnd functions

This commit is contained in:
Ryan Dwyer
2023-06-03 10:09:12 +10:00
parent e9a6e9849b
commit 1df5e4dc51
65 changed files with 1973 additions and 1890 deletions
+21 -19
View File
@@ -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
+53 -40
View File
@@ -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
+2 -2
View File
@@ -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;
+1 -1
View File
@@ -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);
+8 -8
View File
@@ -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);
-1
View File
@@ -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);
+28 -27
View File
@@ -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
+5 -5
View File
@@ -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);
+31 -31
View File
@@ -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;