Did you set the player's race to zerg in the map that crashes?
Yes, exactly.
The crash seems to be from game trying to play invalid music. With campaign maps, the game selects starting music cycling on map id, e.g. 1st map plays terran1, 2nd terran2, 3rd terran3, 4th terran1 again.
Ah, the power of rock 'n roll - it can even crash programs.

Looks like the code isn't very robust if it allows such things to happen, innit? Then again, the creators of the game probably did not foresee that their creation would eventually be picked apart like a matchstick house and made to do some very odd things.

Ahem, yes, I was aware of the map id / music connection. It would have been kinda hard not to notice, given that I was tinkering with replacing built-in campaigns since, well, forever. But I was not aware of this bug (?) you described because I was mostly replacing Episode VI campaign with a mostly Terran set of missions (I chose ep6 because I needed something with 10 missions and a bonus one, instead of 8 with a fork at mission 5). When I did replace the Episode IV for another campaign I think I was setting the player race to Protoss regardless of what was on the map, even though the player only controlled the Protoss for the second half of the campaign only... So that means I narrowly avoided a fatal crash that would've been inexplicable for me back then (in 2002...)
But if the player's race is a race whose first campaign mission is normally later than the current map - so
Episode 1: Zerg/Protoss
Episode 2: Protoss
Episode 4: Terran/Zerg
Episode 5: Zerg
the game ends up cycling songs "1/0/-1".
For terran/protoss, the music id just underflows to other races and should work, but zerg tracks are ordered first in the internal data, and underflowing from there will actually crash the game.
I suppose everything related to music is hardcoded so there is really no way around except switching to using Terran / Zerg campaigns instead of Protoss / Terran? I'll only have about 18 maps' worth so it's not like I can't be flexible with placement. Short of that, I will (reluctantly) change the race of the player in that affected mission even though it really should be Zerg because the player has Zerg economy for the majority of the mission.
Thanks for the help! I was thinking of the cause for half the last evening / night and, suffice to say, was nowhere near discovering the true cause. Ah, the wonders of discovering hidden pitfalls in SC modding even 20 years after the game's release. So far the only caveat regarding the built-in campaigns that I was aware of was that the briefing interface was set to that campaign's race regardless of what the human player's race in the actual mission was, so for the entirety of my previous campaign, I was running mismatched sets of Zerg briefing room and Terran interface in the missions.
Post has been edited 1 time(s), last time on Jan 9 2019, 8:26 am by IlyaSnopchenko.
Trial and error... mostly error.