mirror of
git://git.9front.org/plan9front/plan9front
synced 2025-01-12 11:10:06 +00:00
games/doom: don't crash on invalid music selection with idmus cheat
see also: https://doomwiki.org/wiki/IDMUS_requests_invalid_music
This commit is contained in:
parent
526f63106b
commit
140ca8fb11
1 changed files with 6 additions and 6 deletions
|
@ -600,21 +600,21 @@ ST_Responder (event_t* ev)
|
|||
|
||||
if (gamemode == commercial)
|
||||
{
|
||||
musnum = mus_runnin + (buf[0]-'0')*10 + buf[1]-'0' - 1;
|
||||
musnum = (buf[0]-'0')*10 + buf[1]-'0' - 1;
|
||||
|
||||
if (((buf[0]-'0')*10 + buf[1]-'0') > 35)
|
||||
if (musnum < 0 || musnum > 34)
|
||||
plyr->message = STSTR_NOMUS;
|
||||
else
|
||||
S_ChangeMusic(musnum, 1);
|
||||
S_ChangeMusic(mus_runnin + musnum, 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
musnum = mus_e1m1 + (buf[0]-'1')*9 + (buf[1]-'1');
|
||||
musnum = (buf[0]-'1')*9 + buf[1]-'1';
|
||||
|
||||
if (((buf[0]-'1')*9 + buf[1]-'1') > 31)
|
||||
if (musnum < 0 || musnum > 31)
|
||||
plyr->message = STSTR_NOMUS;
|
||||
else
|
||||
S_ChangeMusic(musnum, 1);
|
||||
S_ChangeMusic(mus_e1m1 + musnum, 1);
|
||||
}
|
||||
}
|
||||
// Simplified, accepting both "noclip" and "idspispopd".
|
||||
|
|
Loading…
Reference in a new issue