mirror of
https://gitlab.com/ryandwyer/perfect-dark
synced 2026-09-01 17:29:52 -04:00
Improve propsound
This commit is contained in:
+91
-24
@@ -1979,34 +1979,57 @@
|
||||
channel,
|
||||
|
||||
/**
|
||||
* Plays or stops a sound coming from the given object.
|
||||
* This command makes the sound originate from the given object's position.
|
||||
*
|
||||
* The channel argument should be a CHANNEL constant.
|
||||
* The bool argument should be TRUE to play or FALSE to stop.
|
||||
* If the channel was marked using assign_sound, the volchangetimer60 argument
|
||||
* is ignored and the sound will be started immediately at the appropriate
|
||||
* volume based on the player's distance from the object.
|
||||
*
|
||||
* If the channel is already playing, the volchangetimer60 argument will be used
|
||||
* to determine how long the transition takes to the new object's position.
|
||||
*/
|
||||
#define set_object_sound_playing(channel, object, bool) \
|
||||
#define bind_channel_to_object(channel, object, volchangetimer60) \
|
||||
mkshort(0x00cf), \
|
||||
channel, \
|
||||
object, \
|
||||
0x00, \
|
||||
bool,
|
||||
mkshort(volchangetimer60),
|
||||
|
||||
/**
|
||||
* Plays a sound coming from the given pad.
|
||||
* This command makes the sound originate from the given pad's position,
|
||||
* and makes the sound repeat indefinitely.
|
||||
*
|
||||
* If the channel was marked using assign_sound, the sound will be started
|
||||
* immediately at the appropriate volume based on the player's distance from
|
||||
* the pad.
|
||||
*/
|
||||
#define play_repeating_sound_from_pad(pad, sound) \
|
||||
#define bind_channel_to_pad_repeating(pad, sound) \
|
||||
mkshort(0x00d0), \
|
||||
0x00, \
|
||||
0, \
|
||||
mkshort(pad), \
|
||||
mkshort(sound),
|
||||
|
||||
#define set_object_sound_volume(channel, volume, volchangetimer60) \
|
||||
/**
|
||||
* Sets the target volume of a channel which is already playing.
|
||||
*
|
||||
* The volume will be changed gradually over a period of time,
|
||||
* specified by volchangetimer60.
|
||||
*/
|
||||
#define set_channel_volume(channel, volume, volchangetimer60) \
|
||||
mkshort(0x00d1), \
|
||||
channel, \
|
||||
mkshort(volume), \
|
||||
mkshort(volchangetimer60),
|
||||
|
||||
#define set_object_sound_volume_by_distance(channel, distance, volchangetimer60) \
|
||||
/**
|
||||
* Sets the target volume of a channel which is already playing.
|
||||
*
|
||||
* The target volume is automatically calculated based on the given distance,
|
||||
* as if the player is that distance from the source.
|
||||
*
|
||||
* The volume will be changed gradually over a period of time,
|
||||
* specified by volchangetimer60.
|
||||
*/
|
||||
#define set_channel_volume_by_distance(channel, distance, volchangetimer60) \
|
||||
mkshort(0x00d2), \
|
||||
channel, \
|
||||
mkshort(distance), \
|
||||
@@ -3336,11 +3359,25 @@
|
||||
label,
|
||||
|
||||
/**
|
||||
* Play a sound from the given object repeatedly.
|
||||
* This command makes the sound originate from the given object's position,
|
||||
* and makes the sound repeat indefinitely. It's typically used to make
|
||||
* terminals hum.
|
||||
*
|
||||
* Typically used to make terminals hum.
|
||||
* The dist2 parameter determines the distance at which the curved volume scale
|
||||
* transitions to a linear scale. This is typically when you're almost out of
|
||||
* earshot.
|
||||
*
|
||||
* The dist3 parameter determines the max distance that you can hear the object.
|
||||
* This should be bigger than dist2.
|
||||
*
|
||||
* If the channel was marked using assign_sound, the volchangetimer60 argument
|
||||
* is ignored and the sound will be started immediately at the appropriate
|
||||
* volume based on the player's distance from the object.
|
||||
*
|
||||
* If the channel is already playing, the volchangetimer60 argument will be used
|
||||
* to determine how long the transition takes to the new object's position.
|
||||
*/
|
||||
#define play_repeating_sound_from_object(channel, object, volchangetimer60, dist2, dist3) \
|
||||
#define bind_channel_to_object_repeating(channel, object, volchangetimer60, dist2, dist3) \
|
||||
mkshort(0x016b), \
|
||||
channel, \
|
||||
object, \
|
||||
@@ -3477,15 +3514,35 @@
|
||||
chr, \
|
||||
label,
|
||||
|
||||
#define play_sound_from_entity(channel, entity_id, u1, u2, attackflags) \
|
||||
/**
|
||||
* This command makes the sound originate from the given entity's position,
|
||||
* where the entity can be an object or a chr.
|
||||
*
|
||||
* The dist2 parameter determines the distance at which the curved volume scale
|
||||
* transitions to a linear scale. This is typically when you're almost out of
|
||||
* earshot.
|
||||
*
|
||||
* The dist3 parameter determines the max distance that you can hear the object.
|
||||
* This should be bigger than dist2.
|
||||
*
|
||||
* The command supports a volchangetimer60 parameter, but as this command is
|
||||
* always called with value 1, we omit it as a macro parameter for brevity.
|
||||
*
|
||||
* If the channel was marked using assign_sound, the volchangetimer60 argument
|
||||
* is ignored and the sound will be started immediately at the appropriate
|
||||
* volume based on the player's distance from the entity.
|
||||
*
|
||||
* If the channel is already playing, the volchangetimer60 argument will be used
|
||||
* to determine how long the transition takes to the new object's position.
|
||||
*/
|
||||
#define bind_channel_to_entity(channel, entity_id, dist2, dist3, is_chr) \
|
||||
mkshort(0x0179), \
|
||||
channel, \
|
||||
entity_id, \
|
||||
0x00, \
|
||||
0x01, \
|
||||
mkshort(u1), \
|
||||
mkshort(u2), \
|
||||
attackflags,
|
||||
mkshort(1), \
|
||||
mkshort(dist2), \
|
||||
mkshort(dist3), \
|
||||
is_chr,
|
||||
|
||||
/**
|
||||
* Checks if the chr can see their attack target, which should have been
|
||||
@@ -3508,6 +3565,9 @@
|
||||
|
||||
/**
|
||||
* Assigns a sound to the given channel. Does not play the sound.
|
||||
*
|
||||
* Doing this sets a marker on the channel, which affects the behaviour
|
||||
* of further audio commands.
|
||||
*/
|
||||
#define assign_sound(sound, channel) \
|
||||
mkshort(0x017c), \
|
||||
@@ -3782,7 +3842,7 @@
|
||||
* Each quip type + morale combination has up to three quips that may be said.
|
||||
* The quip used is random.
|
||||
*/
|
||||
#define play_cistaff_quip(ciquip, channel) \
|
||||
#define say_ciquip(ciquip, channel) \
|
||||
mkshort(0x01a2), \
|
||||
ciquip, \
|
||||
channel,
|
||||
@@ -4335,13 +4395,20 @@
|
||||
mkshort(distance / 10), \
|
||||
label,
|
||||
|
||||
#define play_sound_from_object2(channel, object, sound, type, flags) \
|
||||
/**
|
||||
* This command assigns and plays a sound, originating from the given object's
|
||||
* position.
|
||||
*
|
||||
* The type parameter should be a PSTYPE constant.
|
||||
*
|
||||
* The flags parameter should be a PSFLAG constant.
|
||||
*/
|
||||
#define play_sound_from_object(channel, object, sound, type, flags) \
|
||||
mkshort(0x01d9), \
|
||||
channel, \
|
||||
object, \
|
||||
mkshort(sound), \
|
||||
0xff, \
|
||||
0xff, \
|
||||
mkshort(0xffff), /*volume*/ \
|
||||
type, \
|
||||
mkshort(flags),
|
||||
|
||||
|
||||
@@ -316,7 +316,7 @@
|
||||
#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 AUDIOCONFIGFLAG_01 0x01
|
||||
#define AUDIOCONFIGFLAG_SPECIALPAN 0x01
|
||||
#define AUDIOCONFIGFLAG_RESPONDHELLO 0x04
|
||||
#define AUDIOCONFIGFLAG_08 0x08
|
||||
#define AUDIOCONFIGFLAG_OFFENSIVE 0x10
|
||||
@@ -408,10 +408,13 @@
|
||||
#define CHANNEL_5 5
|
||||
#define CHANNEL_6 6
|
||||
#define CHANNEL_7 7
|
||||
#define CHANNEL_8 8
|
||||
#define CHANNEL_9 9
|
||||
#define CHANNEL_DONTCARE 9
|
||||
#define CHANNEL_CUTSCENE 10
|
||||
|
||||
#define CHANNELCOUNT() (IS4MB() ? 30 : 40)
|
||||
#define CHANNEL_IS_AI(channel) (channel >= 0 && channel <= 7)
|
||||
#define CHANNEL_HEAP_FIRST 8
|
||||
|
||||
#define CHEAT_HURRICANEFISTS 0
|
||||
#define CHEAT_CLOAKINGDEVICE 1
|
||||
#define CHEAT_INVINCIBLE 2
|
||||
@@ -3506,8 +3509,8 @@
|
||||
#define PSFLAG_HASCONFIG 0x0040
|
||||
#define PSFLAG_CUTSCENE 0x0080
|
||||
#define PSFLAG_FORHUDMSG 0x0200
|
||||
#define PSFLAG_0400 0x0400
|
||||
#define PSFLAG_0800 0x0800
|
||||
#define PSFLAG_AMBIENT 0x0400
|
||||
#define PSFLAG_SPECIALPAN 0x0800
|
||||
#define PSFLAG_FIRSTTICK 0x1000
|
||||
#define PSFLAG_OUTOFRANGE 0x2000
|
||||
#define PSFLAG_CHANGINGPAN 0x4000
|
||||
@@ -3516,7 +3519,7 @@
|
||||
#define PSFLAG2_RESPONDHELLO 0x0001
|
||||
#define PSFLAG2_MPPAUSABLE 0x0002
|
||||
#define PSFLAG2_PRINTABLE 0x0004
|
||||
#define PSFLAG2_0010 0x0010
|
||||
#define PSFLAG2_AMBIENT 0x0010
|
||||
#define PSFLAG2_OFFENSIVE 0x0020
|
||||
#define PSFLAG2_0040 0x0040
|
||||
#define PSFLAG2_STOPPED 0x0080
|
||||
|
||||
@@ -210,10 +210,10 @@
|
||||
/*0x00cc*/ bool ai_show_hudmsg_top_middle(void);
|
||||
/*0x00cd*/ bool ai_speak(void);
|
||||
/*0x00ce*/ bool ai_play_sound(void);
|
||||
/*0x00cf*/ bool ai_set_object_sound_playing(void);
|
||||
/*0x00d0*/ bool ai_play_repeating_sound_from_pad(void);
|
||||
/*0x00d1*/ bool ai_set_object_sound_volume(void);
|
||||
/*0x00d2*/ bool ai_set_object_sound_volume_by_distance(void);
|
||||
/*0x00cf*/ bool ai_bind_channel_to_object(void);
|
||||
/*0x00d0*/ bool ai_bind_channel_to_pad_repeating(void);
|
||||
/*0x00d1*/ bool ai_set_channel_volume(void);
|
||||
/*0x00d2*/ bool ai_set_channel_volume_by_distance(void);
|
||||
/*0x00d3*/ bool ai_audio_mute_channel(void);
|
||||
/*0x00d4*/ bool ai_if_object_sound_volume_less_than(void);
|
||||
/*0x00d5*/ bool ai_hovercar_begin_path(void);
|
||||
@@ -341,7 +341,7 @@
|
||||
/*0x0168*/ bool ai_if_shield_damaged(void);
|
||||
/*0x0169*/ bool ai_if_natural_anim(void);
|
||||
/*0x016a*/ bool ai_if_y(void);
|
||||
/*0x016b*/ bool ai_play_repeating_sound_from_object(void);
|
||||
/*0x016b*/ bool ai_bind_channel_to_object_repeating(void);
|
||||
/*0x016c*/ bool ai_noop_016c(void);
|
||||
/*0x016d*/ bool ai_chr_adjust_motion_blur(void);
|
||||
/*0x016e*/ bool ai_damage_chr_by_amount(void);
|
||||
@@ -355,7 +355,7 @@
|
||||
/*0x0176*/ bool ai_if_bot_respawning(void);
|
||||
/*0x0177*/ bool ai_player_auto_walk(void);
|
||||
/*0x0178*/ bool ai_if_player_auto_walk_finished(void);
|
||||
/*0x0179*/ bool ai_play_sound_from_entity(void);
|
||||
/*0x0179*/ bool ai_bind_channel_to_entity(void);
|
||||
/*0x017a*/ bool ai_if_los_to_attack_target(void);
|
||||
/*0x017b*/ bool ai_if_chr_knocked_out(void);
|
||||
/*0x017c*/ bool ai_assign_sound(void);
|
||||
@@ -386,7 +386,7 @@
|
||||
/*0x019f*/ bool ai_set_obj_health(void);
|
||||
/*0x01a0*/ bool ai_set_chr_special_death_animation(void);
|
||||
/*0x01a1*/ bool ai_set_room_to_search(void);
|
||||
/*0x01a2*/ bool ai_say_ci_staff_quip(void);
|
||||
/*0x01a2*/ bool ai_say_ciquip(void);
|
||||
/*0x01a3*/ bool ai_do_preset_animation(void);
|
||||
/*0x01a4*/ bool ai_show_hudmsg_middle(void);
|
||||
/*0x01a5*/ bool ai_if_using_lift(void);
|
||||
@@ -437,7 +437,7 @@
|
||||
/*0x01d6*/ bool ai_configure_environment(void);
|
||||
/*0x01d7*/ bool ai_if_distance_to_target2_less_than(void);
|
||||
/*0x01d8*/ bool ai_if_distance_to_target2_greater_than(void);
|
||||
/*0x01d9*/ bool ai_play_sound_from_prop(void);
|
||||
/*0x01d9*/ bool ai_play_sound_from_object(void);
|
||||
/*0x01da*/ bool ai_play_temporary_primary_track(void);
|
||||
/*0x01db*/ bool ai_chr_kill(void);
|
||||
/*0x01dc*/ bool ai_remove_weapon_from_inventory(void);
|
||||
|
||||
@@ -18,7 +18,7 @@ void ps_tick(void);
|
||||
void ps_set_pitch(struct prop *prop, f32 targetpitch, s32 changespeed);
|
||||
void ps_set_volume(struct prop *prop, s32 vol);
|
||||
s16 ps_create(struct pschannel *channel, struct prop *prop, s16 soundnum, s16 padnum, s32 vol, u16 flags, u16 flags2, s32 type, struct coord *pos, f32 pitch, RoomNum *rooms, s32 room, f32 dist1, f32 dist2, f32 dist3);
|
||||
s32 ps_play_from_prop(s32 channelnum, s16 soundnum, s32 vol, struct prop *prop, s16 type, u16 flags);
|
||||
s32 ps_create_from_ai(s32 channelnum, s16 soundnum, s32 vol, struct prop *prop, s16 type, u16 flags);
|
||||
void ps_mute_channel(s32 channelnum);
|
||||
bool ps_is_channel_free(s32 channelnum);
|
||||
void ps_modify(s32 channelnum, s32 arg1, s16 padnum, struct prop *prop, s32 volchangetimer60, s32 dist2, s32 dist3, u16 flags);
|
||||
|
||||
+4
-4
@@ -5325,8 +5325,8 @@ struct pschannel {
|
||||
/*0x0a*/ s16 targetpan;
|
||||
/*0x0c*/ s16 targetfx;
|
||||
/*0x0e*/ s16 currentfx;
|
||||
/*0x10*/ s16 vol10;
|
||||
/*0x12*/ s16 vol12;
|
||||
/*0x10*/ s16 maxvol;
|
||||
/*0x12*/ s16 requestedvol;
|
||||
/*0x14*/ s16 degrees;
|
||||
/*0x16*/ s16 unk16;
|
||||
/*0x18*/ s16 volchangespeed;
|
||||
@@ -5334,10 +5334,10 @@ struct pschannel {
|
||||
/*0x1c*/ s32 volchangetimer60;
|
||||
/*0x20*/ s32 pitchchangespeed;
|
||||
/*0x24*/ s16 padnum;
|
||||
/*0x26*/ s16 soundnum26;
|
||||
/*0x26*/ s16 requestedsoundnum;
|
||||
/*0x28*/ s16 type;
|
||||
/*0x2a*/ u16 unk2a; // unused
|
||||
/*0x2c*/ s16 soundnum2c;
|
||||
/*0x2c*/ s16 resolvedsoundnum;
|
||||
/*0x2e*/ s16 channelnum;
|
||||
/*0x30*/ u16 flags;
|
||||
/*0x32*/ u16 flags2;
|
||||
|
||||
Reference in New Issue
Block a user