From 8f0e020e2151fdac17a1557fa4e71662908a21ab Mon Sep 17 00:00:00 2001 From: Mitchell Richters Date: Sun, 11 Sep 2022 23:33:14 +1000 Subject: [PATCH] - Blood: Floatify `POSTURE::eyeAboveZ` and `POSTURE::weaponAboveZ`. --- source/games/blood/src/player.cpp | 40 +++++++++++++++---------------- source/games/blood/src/player.h | 4 ++-- source/games/blood/src/weapon.cpp | 4 ++-- 3 files changed, 24 insertions(+), 24 deletions(-) diff --git a/source/games/blood/src/player.cpp b/source/games/blood/src/player.cpp index bd020de8c..1ba22b3b1 100644 --- a/source/games/blood/src/player.cpp +++ b/source/games/blood/src/player.cpp @@ -102,30 +102,30 @@ POSTURE gPostureDefaults[kModeMax][kPostureMax] = { // normal human { - { 0x4000, 0x4000, 0x4000, 14, 17, 24, 16, 32, 80, 0x1600, 0x1200, 0xc00, 0x90, -0xbaaaa, -0x175555 }, - { 0x1200, 0x1200, 0x1200, 14, 17, 24, 16, 32, 80, 0x1400, 0x1000, -0x600, 0xb0, 0x5b05, 0 }, - { 0x2000, 0x2000, 0x2000, 22, 28, 24, 16, 16, 40, 0x800, 0x600, -0x600, 0xb0, 0, 0 }, + { 0x4000, 0x4000, 0x4000, 14, 17, 24, 16, 32, 80, 22, 18, 0xc00, 0x90, -0xbaaaa, -0x175555 }, + { 0x1200, 0x1200, 0x1200, 14, 17, 24, 16, 32, 80, 20, 16, -0x600, 0xb0, 0x5b05, 0 }, + { 0x2000, 0x2000, 0x2000, 22, 28, 24, 16, 16, 40, 8, 6, -0x600, 0xb0, 0, 0 }, }, // normal beast { - { 0x4000, 0x4000, 0x4000, 14, 17, 24, 16, 32, 80, 0x1600, 0x1200, 0xc00, 0x90, -0xbaaaa, -0x175555 }, - { 0x1200, 0x1200, 0x1200, 14, 17, 24, 16, 32, 80, 0x1400, 0x1000, -0x600, 0xb0, 0x5b05, 0 }, - { 0x2000, 0x2000, 0x2000, 22, 28, 24, 16, 16, 40, 0x800, 0x600, -0x600, 0xb0, 0, 0 }, + { 0x4000, 0x4000, 0x4000, 14, 17, 24, 16, 32, 80, 22, 18, 0xc00, 0x90, -0xbaaaa, -0x175555 }, + { 0x1200, 0x1200, 0x1200, 14, 17, 24, 16, 32, 80, 20, 16, -0x600, 0xb0, 0x5b05, 0 }, + { 0x2000, 0x2000, 0x2000, 22, 28, 24, 16, 16, 40, 8, 6, -0x600, 0xb0, 0, 0 }, }, // shrink human { - { 10384, 10384, 10384, 14, 17, 24, 16, 32, 80, 5632, 4608, 3072, 144, -564586, -1329173 }, - { 2108, 2108, 2108, 14, 17, 24, 16, 32, 80, 5120, 4096, -1536, 176, 0x5b05, 0 }, - { 2192, 2192, 2192, 22, 28, 24, 16, 16, 40, 2048, 1536, -1536, 176, 0, 0 }, + { 10384, 10384, 10384, 14, 17, 24, 16, 32, 80, 22, 18, 3072, 144, -564586, -1329173 }, + { 2108, 2108, 2108, 14, 17, 24, 16, 32, 80, 20, 16, -1536, 176, 0x5b05, 0 }, + { 2192, 2192, 2192, 22, 28, 24, 16, 16, 40, 8, 6, -1536, 176, 0, 0 }, }, // grown human { - { 19384, 19384, 19384, 14, 17, 24, 16, 32, 80, 5632, 4608, 3072, 144, -1014586, -1779173 }, - { 5608, 5608, 5608, 14, 17, 24, 16, 32, 80, 5120, 4096, -1536, 176, 0x5b05, 0 }, - { 11192, 11192, 11192, 22, 28, 24, 16, 16, 40, 2048, 1536, -1536, 176, 0, 0 }, + { 19384, 19384, 19384, 14, 17, 24, 16, 32, 80, 22, 18, 3072, 144, -1014586, -1779173 }, + { 5608, 5608, 5608, 14, 17, 24, 16, 32, 80, 20, 16, -1536, 176, 0x5b05, 0 }, + { 11192, 11192, 11192, 22, 28, 24, 16, 16, 40, 8, 6, -1536, 176, 0, 0 }, }, }; @@ -713,8 +713,8 @@ void playerSetGodMode(PLAYER* pPlayer, bool bGodMode) void playerResetInertia(PLAYER* pPlayer) { POSTURE* pPosture = &pPlayer->pPosture[pPlayer->lifeMode][pPlayer->posture]; - pPlayer->zView = pPlayer->actor->spr.pos.Z - pPosture->eyeAboveZ * zinttoworld; - pPlayer->zWeapon = pPlayer->actor->spr.pos.Z - pPosture->weaponAboveZ * zinttoworld; + pPlayer->zView = pPlayer->actor->spr.pos.Z - pPosture->eyeAboveZ; + pPlayer->zWeapon = pPlayer->actor->spr.pos.Z - pPosture->weaponAboveZ; viewBackupView(pPlayer->nPlayer); } @@ -1865,18 +1865,18 @@ void playerProcess(PLAYER* pPlayer) ProcessInput(pPlayer); int nSpeed = approxDist(actor->int_vel().X, actor->int_vel().Y); pPlayer->zViewVel = interpolatedvalue(pPlayer->zViewVel, actor->vel.Z, FixedToFloat(0x7000)); - int dz = pPlayer->actor->int_pos().Z - pPosture->eyeAboveZ - pPlayer->zView * zworldtoint; + double dz = pPlayer->actor->spr.pos.Z - pPosture->eyeAboveZ - pPlayer->zView; if (dz > 0) - pPlayer->zViewVel += MulScaleF(dz << 8, 0xa000, 16) / 65536; + pPlayer->zViewVel += dz * FixedToFloat(0xa000); else - pPlayer->zViewVel += MulScaleF(dz << 8, 0x1800, 16) / 65536; + pPlayer->zViewVel += dz * FixedToFloat(0x1800); pPlayer->zView += pPlayer->zViewVel; pPlayer->zWeaponVel = interpolatedvalue(pPlayer->zWeaponVel, actor->vel.Z, FixedToFloat(0x5000)); - dz = pPlayer->actor->int_pos().Z - pPosture->weaponAboveZ - pPlayer->zWeapon * zworldtoint; + dz = pPlayer->actor->spr.pos.Z - pPosture->weaponAboveZ - pPlayer->zWeapon; if (dz > 0) - pPlayer->zWeaponVel += MulScaleF(dz << 8, 0x8000, 16) / 65536; + pPlayer->zWeaponVel += dz * FixedToFloat(0x8000); else - pPlayer->zWeaponVel += MulScaleF(dz << 8, 0xc00, 16) / 65536; + pPlayer->zWeaponVel += dz * FixedToFloat(0xc00); pPlayer->zWeapon += pPlayer->zWeaponVel; pPlayer->bobPhase = ClipLow(pPlayer->bobPhase - 4, 0); nSpeed >>= FRACBITS; diff --git a/source/games/blood/src/player.h b/source/games/blood/src/player.h index 5ce2690c1..683283cd5 100644 --- a/source/games/blood/src/player.h +++ b/source/games/blood/src/player.h @@ -68,8 +68,8 @@ struct POSTURE int bobH; int swayV; int swayH; - int eyeAboveZ; - int weaponAboveZ; + double eyeAboveZ; + double weaponAboveZ; int xOffset; int zOffset; int normalJumpZ; diff --git a/source/games/blood/src/weapon.cpp b/source/games/blood/src/weapon.cpp index 6686d00e1..81b3e579c 100644 --- a/source/games/blood/src/weapon.cpp +++ b/source/games/blood/src/weapon.cpp @@ -247,7 +247,7 @@ static bool checkAmmo2(const PLAYER* pPlayer, int ammotype, int amount) void SpawnBulletEject(PLAYER* pPlayer, int a2, int a3) { POSTURE* pPosture = &pPlayer->pPosture[pPlayer->lifeMode][pPlayer->posture]; - pPlayer->zView = pPlayer->actor->spr.pos.Z - pPosture->eyeAboveZ * zinttoworld; + pPlayer->zView = pPlayer->actor->spr.pos.Z - pPosture->eyeAboveZ; double dz = pPlayer->zWeapon - (pPlayer->zWeapon - pPlayer->zView) * 0.5; fxSpawnEjectingBrassf(pPlayer->actor, dz, a2, a3); } @@ -255,7 +255,7 @@ void SpawnBulletEject(PLAYER* pPlayer, int a2, int a3) void SpawnShellEject(PLAYER* pPlayer, int a2, int a3) { POSTURE* pPosture = &pPlayer->pPosture[pPlayer->lifeMode][pPlayer->posture]; - pPlayer->zView = pPlayer->actor->spr.pos.Z - pPosture->eyeAboveZ * zinttoworld; + pPlayer->zView = pPlayer->actor->spr.pos.Z - pPosture->eyeAboveZ; double t = pPlayer->zWeapon - pPlayer->zView; double dz = pPlayer->zWeapon - t + (t * 0.25); fxSpawnEjectingShellf(pPlayer->actor, dz, a2, a3);