From c2f30de350d3ac1e12a60522c4e879babe966996 Mon Sep 17 00:00:00 2001 From: nukeykt Date: Mon, 28 Oct 2019 01:36:25 +0900 Subject: [PATCH] Use correct formula for bullet hitscan --- source/exhumed/src/bullet.cpp | 9 +++++++-- source/exhumed/src/exhumed.cpp | 2 ++ source/exhumed/src/exhumed.h | 2 ++ 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/source/exhumed/src/bullet.cpp b/source/exhumed/src/bullet.cpp index 50ba9ed75..3e0d29228 100644 --- a/source/exhumed/src/bullet.cpp +++ b/source/exhumed/src/bullet.cpp @@ -382,7 +382,12 @@ MOVEEND: { vec3_t startPos = { x, y, z }; hitdata_t hitData; - hitscan(&startPos, pSprite->sectnum, Cos(pSprite->ang), Sin(pSprite->ang), (-Sin(pBullet->field_C)) << 3, &hitData, CLIPMASK1); + int dz; + if (bVanilla) + dz = -Sin(pBullet->field_C) * 8; + else + dz = -pBullet->field_C * 512; + hitscan(&startPos, pSprite->sectnum, Cos(pSprite->ang), Sin(pSprite->ang), dz, &hitData, CLIPMASK1); x2 = hitData.pos.x; y2 = hitData.pos.y; z2 = hitData.pos.z; @@ -633,7 +638,7 @@ int BuildBullet(short nSprite, int nType, int ebx, int ecx, int val1, int nAngle sprite[nBulletSprite].cstat |= 0x8000; } - pBullet->field_C = val2 & 0x7FF; // TODO - anglemask? + pBullet->field_C = val2; pBullet->nType = nType; pBullet->nSprite = nBulletSprite; pBullet->field_6 = runlist_AddRunRec(sprite[nBulletSprite].lotag - 1, nBullet | 0xB0000); diff --git a/source/exhumed/src/exhumed.cpp b/source/exhumed/src/exhumed.cpp index 89445b1ab..bca4123b3 100644 --- a/source/exhumed/src/exhumed.cpp +++ b/source/exhumed/src/exhumed.cpp @@ -628,6 +628,8 @@ short scan_char = 0; int nStartLevel; int nTimeLimit; +int bVanilla = 0; + char debugBuffer[256]; short wConsoleNode; // TODO - move me into network file diff --git a/source/exhumed/src/exhumed.h b/source/exhumed/src/exhumed.h index 4145970f3..b0545006b 100644 --- a/source/exhumed/src/exhumed.h +++ b/source/exhumed/src/exhumed.h @@ -184,6 +184,8 @@ extern const char *gString[]; extern short bNoSound; +extern int bVanilla; + extern char g_modDir[BMAX_PATH]; enum { kPalNormal = 0,