do not allow direct SSG switches in Vanilla demos (#1824)

Fixes desync in b109xm-00463.lmp
This commit is contained in:
Fabian Greffrath 2024-08-09 12:51:05 +02:00 committed by GitHub
parent 24bbf539b3
commit 012162d8ba
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 5 additions and 2 deletions

View File

@ -93,7 +93,7 @@ typedef enum
BT_CHANGE = 4,
// The 4bit weapon mask and shift, convenience.
//BT_WEAPONMASK = (8+16+32),
BT_WEAPONMASK_OLD = (8+16+32),
BT_WEAPONMASK = (8+16+32+64), // extended to pick up SSG // phares
BT_WEAPONSHIFT = 3,

View File

@ -100,8 +100,10 @@ static void TicToHudCmd(hud_cmd_t *hud_cmd, const ticcmd_t *cmd)
if (cmd->buttons & BT_CHANGE)
{
const int bt_weaponmask = demo_compatibility ?
BT_WEAPONMASK_OLD : BT_WEAPONMASK;
hud_cmd->change =
1 + ((cmd->buttons & BT_WEAPONMASK) >> BT_WEAPONSHIFT);
1 + ((cmd->buttons & bt_weaponmask) >> BT_WEAPONSHIFT);
}
else
{

View File

@ -482,6 +482,7 @@ void P_PlayerThink (player_t* player)
if (demo_compatibility)
{ // compatibility mode -- required for old demos -- killough
newweapon = (cmd->buttons & BT_WEAPONMASK_OLD) >> BT_WEAPONSHIFT;
if (newweapon == wp_fist && player->weaponowned[wp_chainsaw] &&
(player->readyweapon != wp_chainsaw ||
!player->powers[pw_strength]))