Fix player appearance sound truncation
The player appearance sound was tied to the player appearance vclip, but this is wrong because the vclip has a shorter lifetime than the sound. This mistake was previously hidden by the hack that caused non-permanent sounds to be routed off to a separate queue that lost the association between object and sound. Commit4a98e79
eliminated that hack because it complicated the work of that commit. However, without the hack, object sound effects cannot outlive their host object. Fix this by binding the sound to the position of the appearance effect, not to the appearance object. This works since the appearance effect cannot move, so there was no value to binding the sound to the object. This solution could not be used for objects that move and terminate before their associated sound effect. Reported-by: Ryusei117 <https://github.com/dxx-rebirth/dxx-rebirth/issues/88#issuecomment-390054173> Fixes:4a98e796ab
("Prevent stacking weapon rotation sounds")
This commit is contained in:
parent
9ea09107d1
commit
5d74fd48b5
|
@ -641,13 +641,15 @@ void create_player_appearance_effect(const object_base &player_obj)
|
|||
? vm_vec_scale_add(player_obj.pos, player_obj.orient.fvec, fixmul(player_obj.size, flash_dist))
|
||||
: player_obj.pos;
|
||||
|
||||
const auto &&effect_obj = object_create_explosion(vmsegptridx(player_obj.segnum), pos, player_obj.size, VCLIP_PLAYER_APPEARANCE);
|
||||
const auto &&seg = vmsegptridx(player_obj.segnum);
|
||||
const auto &&effect_obj = object_create_explosion(seg, pos, player_obj.size, VCLIP_PLAYER_APPEARANCE);
|
||||
|
||||
if (effect_obj) {
|
||||
effect_obj->orient = player_obj.orient;
|
||||
|
||||
if ( Vclip[VCLIP_PLAYER_APPEARANCE].sound_num > -1 )
|
||||
digi_link_sound_to_object(Vclip[VCLIP_PLAYER_APPEARANCE].sound_num, effect_obj, 0, F1_0, sound_stack::allow_stacking);
|
||||
const auto sound_num = Vclip[VCLIP_PLAYER_APPEARANCE].sound_num;
|
||||
if (sound_num > -1)
|
||||
digi_link_sound_to_pos(sound_num, seg, 0, effect_obj->pos, 0, F1_0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue