From 31e5261c981d89b2e83191c01e57a252cd94f2ae Mon Sep 17 00:00:00 2001 From: Simon Howard Date: Thu, 28 Nov 2013 02:50:45 +0000 Subject: Fix Heretic demo desync caused by r1228 (thanks marineController). Subversion-branch: /branches/v2-branch Subversion-revision: 2755 --- src/heretic/p_pspr.c | 12 ++++++++++-- src/heretic/p_user.c | 11 +++++++++-- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/src/heretic/p_pspr.c b/src/heretic/p_pspr.c index c0abf559..66f50ef3 100644 --- a/src/heretic/p_pspr.c +++ b/src/heretic/p_pspr.c @@ -1070,9 +1070,17 @@ void A_FireMacePL1B(player_t * player, pspdef_t * psp) } player->ammo[am_mace] -= USE_MACE_AMMO_1; pmo = player->mo; + + // Vanilla bug here: + // Original code here looks like: + // (pmo->flags2 & MF2_FEETARECLIPPED != 0) + // C's operator precedence interprets this as: + // (pmo->flags2 & (MF2_FEETARECLIPPED != 0)) + // Which simplifies to: + // (pmo->flags2 & 1) ball = P_SpawnMobj(pmo->x, pmo->y, pmo->z + 28 * FRACUNIT - - FOOTCLIPSIZE * ((pmo->flags2 & MF2_FEETARECLIPPED) != - 0), MT_MACEFX2); + - FOOTCLIPSIZE * (pmo->flags2 & 1), MT_MACEFX2); + ball->momz = 2 * FRACUNIT + ((player->lookdir) << (FRACBITS - 5)); angle = pmo->angle; ball->target = pmo; diff --git a/src/heretic/p_user.c b/src/heretic/p_user.c index 79620630..4c9ae4c6 100644 --- a/src/heretic/p_user.c +++ b/src/heretic/p_user.c @@ -988,11 +988,18 @@ boolean P_UseArtifact(player_t * player, artitype_t arti) break; case arti_firebomb: angle = player->mo->angle >> ANGLETOFINESHIFT; + + // Vanilla bug here: + // Original code here looks like: + // (player->mo->flags2 & MF2_FEETARECLIPPED != 0), + // Which under C's operator precedence is: + // (player->mo->flags2 & (MF2_FEETARECLIPPED != 0)), + // Which simplifies to: + // (player->mo->flags2 & 1), mo = P_SpawnMobj(player->mo->x + 24 * finecosine[angle], player->mo->y + 24 * finesine[angle], player->mo->z - - 15 * FRACUNIT * - (player->mo->flags2 & MF2_FEETARECLIPPED) != 0, + 15 * FRACUNIT * (player->mo->flags2 & 1), MT_FIREBOMB); mo->target = player->mo; break; -- cgit v1.2.3