Fox, on 19 April 2014 - 04:28 PM, said:
Who says that? Acutally, I kind of agree that it ought to be invalid in a certain sense, but in point of fact, it's not. What matters is that all events in question are entered with screenpeek as the "current player" (the one that getplayer[THISACTOR] refers to). This is the case for both instances of EVENT_SOUND (from S_PlaySound() and S_PlaySound3D()), as well as DISPLAYMENU and DISPLAYMENUREST, even though the latter two aren't even active when the difficulty sound is requested to be played and thus aren't relevant to the question.
One could object to various circumstances. First, why is player[].gm a player member when it's more like a property of a running EDuke32 instance than that of a player? Also, what meaning is there to EVENT_SOUND always getting screenpeek as the current player? Personally, I consider that event local -- game state must not depend on it being executed. Anyhow, what matters in a single-player setting that the event receives a valid player index at all -- player[0] is guaranteed to be valid even when no game is running, though it may not make sense to examine the values of most of its members then.