Closed UCyborg closed 8 years ago
@mittorn do you mind taking another look at this? Reopening, as you decided to put the code that executes "cd loop" command back to SV_PutClientInServer.
This code doesn't seem to belong there, because when the level transition happens, client is already on the server so it never executes, which is not how GoldSrc behaves.
Put the following commands in console, one by one: map c1a0e changelevel2 c1a0c hazardcourse
As you can see, second command will transfer to the map right after the accident, where the music would start when playing with regular GoldSrc, but it doesn't, instead, it will start when we start a new game on Hazard Course, because the variable that holds the track number wasn't used and cleared during the transition, like it normally would be.
If you bypass a check in GoldSrc that prevents executing of changelevel2 from console, you will see that it behaves correctly, the music starts on transition. Heck, you don't even need to hack it, just play the game to the point where everything goes boom, since the server does changelevel2 anyway to get us to a new map.
If SV_New_f is not the most appropriate place, fine, but that small bit of code doesn't seem to be serving its purpose well where it is now. Or am I missing something else here? Because if it has to be there for some other reason, it breaks compatibility with GoldSrc in that regard.
Fixed.
This is seen right after the level transition after Resonance Cascade (c1a0e -> c1a0c). It can be reproduced very easily by using changelevel2 command to transition to any map which plays music at start, eg. you can go from the second map (c0a0a) to the first map and the same thing happens.
What's more, if another map is started normally (map or changelevel) AFTER changelevel2 to the map that has music at start has been issued, that music track that was supposed to play on previous map starts playing on the new map, but it's not always the case, eg. I can go right from the start of Unforeseen Consenquences chapter to the Hazard Course and the music will start, but if I go from Unforeseen Consequences to the second map when Gordon is still on the train, no music will be heard.
Possible solution: 707f07657c6df212b119cdb3a8c6167135b3d17f - look at sv_client.c