dxx-rebirth/similar/main
Kp d2640462cb Backport D2's Dont_start_sound_objects to D1
Descent 2 has a hack, present as far back as I can trace, that
suppresses starting sounds during level load.  The original reason was
not recorded, but this hack has the useful side effect that it avoids
using uninitialized data when set_sound_sources tries to use a Viewer
that has not been reset for the objects of the new level.

Descent 1 lacks this hack, so an invalid Viewer is used, which may
trigger a valptridx trap if the undefined data has an invalid segment
number, and could cause memory corruption in builds which do not
validate the segment index.  The valptridx trap:

```
terminate called after throwing an instance of 'valptridx<dcx::segment>::index_range_exception'
  what():  similar/main/digiobj.cpp:389: invalid index used in array subscript: base=(nil) size=9000 index=65021
```

The backtrace leading to the trap:
```
d1x::digi_link_sound_common (viewer=..., so=..., pos=..., forever=<optimized out>, max_volume=<optimized out>, max_distance=..., soundnum=42, segnum=...) at similar/main/digiobj.cpp:389
0x00005555555a4e2d in d1x::digi_link_sound_to_pos2 (vcobjptr=..., max_distance=..., max_volume=32768, forever=1, pos=..., sidenum=4, segnum=..., org_soundnum=121) at similar/main/digiobj.cpp:483
d1x::digi_link_sound_to_pos (soundnum=soundnum@entry=121, segnum=..., sidenum=sidenum@entry=4, pos=..., forever=forever@entry=1, max_volume=32768) at similar/main/digiobj.cpp:490
0x00005555555c140d in d1x::set_sound_sources (vcsegptridx=..., vcvertptr=...) at similar/main/gameseq.cpp:817
d1x::LoadLevel (level_num=<optimized out>, page_in_textures=1) at similar/main/gameseq.cpp:1022
0x00005555555c2654 in d1x::StartNewLevelSub (level_num=-1, page_in_textures=<optimized out>) at similar/main/gameseq.cpp:1865
```

Backport this hack into Descent 1.  Ultimately, the hack should go away
and data should be loaded in an order that does not access undefined
memory.

Reported-by: Spacecpp <https://github.com/dxx-rebirth/dxx-rebirth/issues/463>
2019-10-26 23:13:14 +00:00
..
ai.cpp Move Seismic_tremor_magnitude to d_level_unique_seismic_state 2019-08-06 02:59:41 +00:00
aipath.cpp Move Difficulty_level to GameUniqueState 2019-06-27 03:26:20 +00:00
automap.cpp Recompute automap subcanvas on window size change 2019-08-18 20:37:29 +00:00
bm.cpp Use xrange for loops with zero start and simple identifier end 2019-05-04 18:27:37 +00:00
bmread.cpp Use xrange for loops with zero start and simple identifier end 2019-05-04 18:27:37 +00:00
cntrlcen.cpp Move controlcen_death_silence to d_level_unique_control_center_state 2019-08-15 01:34:22 +00:00
collide.cpp Rework of the Descent 2 final boss fade-to-black effect introduced in 5b18219aac4dd535e2803de9310ba26dfa7acc28: In the original game the silent 2 second countdown would lapse before the screen faded to black. In restoration, it would fade to black as the countdown started. This rework fixes this discrepancy. 2019-09-17 21:49:18 +02:00
config.cpp Track chosen pilot name outside Players[] 2019-07-07 22:00:02 +00:00
console.cpp Enable -Wimplicit-fallthrough=5; fix resulting breaks 2019-04-04 04:29:03 +00:00
controls.cpp Move Seismic_tremor_magnitude to d_level_unique_seismic_state 2019-08-06 02:59:41 +00:00
credits.cpp Downgrade PCX failures from Error to CON_URGENT 2019-07-07 22:00:02 +00:00
digiobj.cpp Backport D2's Dont_start_sound_objects to D1 2019-10-26 23:13:14 +00:00
dumpmine.cpp Eliminate unnecessary Gamesave_current_filename 2019-08-06 02:59:40 +00:00
effects.cpp Move Control_center_destroyed to d_level_unique_control_center_state 2019-08-15 01:34:22 +00:00
endlevel.cpp Fix crash loading endlevel data with no exit side 2019-08-31 17:31:51 +00:00
fireball.cpp Move Control_center_destroyed to d_level_unique_control_center_state 2019-08-15 01:34:22 +00:00
fuelcen.cpp Move player::num_robots_total to d_game_unique_state 2019-07-16 04:00:50 +00:00
fvi.cpp Move Objects to d_level_unique_object_state 2019-03-03 00:31:08 +00:00
game.cpp Move Countdown_seconds_left to d_level_unique_control_center_state 2019-08-15 01:34:22 +00:00
gamecntl.cpp Make del+shift+b do fatal damage to every robot it explodes 2019-09-01 00:20:28 +00:00
gamefont.cpp Enforce separation of font X/Y scaling 2018-06-08 04:04:05 +00:00
gamemine.cpp Move Secret_return_orient to d_level_shared_segment_state 2019-08-06 02:59:41 +00:00
gamerend.cpp Move Countdown_seconds_left to d_level_unique_control_center_state 2019-08-15 01:34:22 +00:00
gamesave.cpp Move Reactor_strength to d_level_shared_control_center_state 2019-08-15 01:34:22 +00:00
gameseg.cpp Remove __attribute__((packed)) on shortpos for gcc-9 support 2019-05-11 20:18:29 +00:00
gameseq.cpp Backport D2's Dont_start_sound_objects to D1 2019-10-26 23:13:14 +00:00
gauges.cpp Hide lives-remaining count during demo playback 2019-08-24 18:14:16 +00:00
generate-kconfig-udlr.py Adapt to Python 3 strict bytes vs str rules 2018-04-30 05:31:16 +00:00
hostage.cpp Track headlights in d_level_unique_light_state 2019-04-13 18:00:07 +00:00
hud.cpp Rename ObjectState to LevelUniqueObjectState for consistency 2018-12-30 00:43:57 +00:00
iff.cpp Simplify test for corrupt IFF file 2018-04-03 03:20:08 +00:00
inferno.cpp Align capitalization of Data directory in instructions with the code 2019-08-25 17:06:34 +00:00
kconfig.cpp Added axis buttons 2019-09-01 13:11:14 -04:00
kconfig.ui-table.cpp Enable -Wimplicit-fallthrough=5; fix resulting breaks 2019-04-04 04:29:03 +00:00
kmatrix.cpp Move Countdown_seconds_left to d_level_unique_control_center_state 2019-08-15 01:34:22 +00:00
laser.cpp Whitelist Vertigo smelter's phoenix cannon 2019-10-21 03:45:29 +00:00
lighting.cpp Use xrange for render loops 2019-05-04 18:27:37 +00:00
menu.cpp do_new_game_menu: improve new game dialog text 2019-07-28 21:09:07 +00:00
mglobal.cpp Move transition_segnum to d_player_unique_endlevel_state 2019-08-15 01:34:22 +00:00
mission.cpp Make read_sndfile static for D1 2019-08-15 01:34:22 +00:00
morph.cpp Change object::signature to be a generation counter 2019-07-07 22:00:02 +00:00
multi.cpp Tighten checks on killer_obj type 2019-08-21 02:54:08 +00:00
multibot.cpp Move Boss_hit_time to d_level_unique_boss_state 2019-08-06 02:59:40 +00:00
net_udp.cpp Move Countdown_seconds_left to d_level_unique_control_center_state 2019-08-15 01:34:22 +00:00
newdemo.cpp Move Countdown_seconds_left to d_level_unique_control_center_state 2019-08-15 01:34:22 +00:00
newmenu.cpp Downgrade PCX failures from Error to CON_URGENT 2019-07-07 22:00:02 +00:00
object.cpp Prevent markers spinning in marker-camera-enabled games 2019-10-02 02:06:00 +00:00
paging.cpp Move Effects to d_level_unique_effects_clip_state 2019-03-03 00:31:09 +00:00
physics.cpp is_proximity_bomb_or_smart_mine*: s/smart/player_smart/g 2019-08-15 01:34:22 +00:00
piggy.cpp Make read_sndfile static for D1 2019-08-15 01:34:22 +00:00
player.cpp Add experimental support for guidebot in multiplayer 2019-06-27 03:26:20 +00:00
playsave.cpp Avoid reducing player's highest-level when replaying a non-MRU level 2019-08-24 04:32:24 +00:00
polyobj.cpp Fix Descent 1 laser color 2019-03-20 03:57:15 +00:00
powerup.cpp Move Difficulty_level to GameUniqueState 2019-06-27 03:26:20 +00:00
render.cpp Move Control_center_destroyed to d_level_unique_control_center_state 2019-08-15 01:34:22 +00:00
robot.cpp Move robot_create out of line 2019-03-03 00:31:09 +00:00
scores.cpp Set player name in Players[] at single-player game start 2019-08-25 17:53:57 +00:00
segment.cpp Switch most in-tree http:// links to https:// 2018-09-02 00:57:29 +00:00
slew.cpp Move Objects to d_level_unique_object_state 2019-03-03 00:31:08 +00:00
songs.cpp Refactor song loading 2019-08-25 16:43:17 +00:00
state.cpp Set player name in Players[] at single-player game load 2019-08-29 02:40:32 +00:00
switch.cpp Move Control_center_destroyed to d_level_unique_control_center_state 2019-08-15 01:34:22 +00:00
terrain.cpp Move exit_segnum to d_player_unique_endlevel_state 2019-08-15 01:34:22 +00:00
texmerge.cpp Make grs_bitmap::bm_flags private 2017-01-15 00:03:13 +00:00
text.cpp Move conditionally compiled code into namespace dsx 2016-08-25 04:05:32 +00:00
titles.cpp Avoid copying background to itself 2019-07-07 22:00:02 +00:00
vclip.cpp is_proximity_bomb_or_smart_mine*: s/smart/player_smart/g 2019-08-15 01:34:22 +00:00
vers_id.cpp Switch most in-tree http:// links to https:// 2018-09-02 00:57:29 +00:00
wall.cpp Remove exploding wall assertion 2019-06-20 04:02:27 +00:00
weapon.cpp Move Seismic_tremor_magnitude to d_level_unique_seismic_state 2019-08-06 02:59:41 +00:00