- Blood: Floatify PLAYER::zWeapon.

This commit is contained in:
Mitchell Richters 2022-09-11 23:19:19 +10:00 committed by Christoph Oelckers
parent 2d98c532eb
commit 0019b5ee02
8 changed files with 48 additions and 36 deletions

View file

@ -234,6 +234,10 @@ void actBurnSprite(DBloodActor* pSource, DBloodActor* pTarget, int nTime);
int actGetRespawnTime(DBloodActor *pSprite);
bool actCheckRespawn(DBloodActor *pSprite);
void actFireVector(DBloodActor *pShooter, int a2, int a3, int a4, int a5, int a6, VECTOR_TYPE vectorType);
inline void actFireVectorf(DBloodActor *pShooter, int a2, double a3, int a4, int a5, int a6, VECTOR_TYPE vectorType)
{
actFireVector(pShooter, a2, a3 * zworldtoint, a4, a5, a6, vectorType);
}
void actPostSprite(DBloodActor* actor, int status);
void actPostProcess(void);
void MakeSplash(DBloodActor *actor);

View file

@ -101,7 +101,15 @@ public:
void fxSpawnBlood(DBloodActor* pSprite, int a2);
void fxSpawnPodStuff(DBloodActor* pSprite, int a2);
void fxSpawnEjectingBrass(DBloodActor* pSprite, int z, int a3, int a4);
inline void fxSpawnEjectingBrassf(DBloodActor* pSprite, double z, int a3, int a4)
{
fxSpawnEjectingBrass(pSprite, z * zworldtoint, a3, a4);
}
void fxSpawnEjectingShell(DBloodActor* pSprite, int z, int a3, int a4);
inline void fxSpawnEjectingShellf(DBloodActor* pSprite, double z, int a3, int a4)
{
fxSpawnEjectingShell(pSprite, z * zworldtoint, a3, a4);
}
extern CFX gFX;

View file

@ -119,12 +119,12 @@ void hudDraw(PLAYER* pPlayer, sectortype* pSector, double bobx, double boby, dou
if (cl_hudinterpolation)
{
cX += (bobx / 256.);
cY += (boby / 256.) + (zDelta / 128.);
cY += (boby / 256.) + (zDelta * 2.);
}
else
{
cX += (int(bobx) >> 8);
cY += (int(boby) >> 8) + (int(zDelta) >> 7);
cY += (int(boby) >> 8) + int(zDelta * 2);
}
}
else
@ -173,7 +173,7 @@ void hudDraw(PLAYER* pPlayer, sectortype* pSector, double bobx, double boby, dou
drawElement(320, 237, 2358, 1, 1, 1, 1);
}
int zn = (int(pPlayer->zWeapon - pPlayer->zView * zworldtoint - (12 << 8)) >> 7) + 220;
int zn = int(((pPlayer->zWeapon - pPlayer->zView - 12) * 2.) + 220);
PLAYER* pPSprite = &gPlayer[pPlayer->actor->spr.type - kDudePlayer1];
if (pPlayer->actor->IsPlayerActor() && pPSprite->hand == 1)
{

View file

@ -714,7 +714,7 @@ 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->int_pos().Z - pPosture->weaponAboveZ;
pPlayer->zWeapon = pPlayer->actor->spr.pos.Z - pPosture->weaponAboveZ * zinttoworld;
viewBackupView(pPlayer->nPlayer);
}
@ -722,7 +722,7 @@ void playerCorrectInertia(PLAYER* pPlayer, const DVector3& oldpos)
{
auto zAdj = pPlayer->actor->spr.pos.Z - oldpos.Z;
pPlayer->zView += zAdj;
pPlayer->zWeapon += zAdj * zworldtoint;
pPlayer->zWeapon += zAdj;
pPlayer->actor->opos.XY() += pPlayer->actor->spr.pos.XY() - oldpos.XY();
pPlayer->ozView += zAdj;
}
@ -840,7 +840,7 @@ void playerStart(int nPlayer, int bNewLevel)
pPlayer->relAim.dy = 0;
pPlayer->relAim.dz = 0;
pPlayer->aimTarget = nullptr;
pPlayer->zViewVel = pPlayer->zWeaponVel * zinttoworld;
pPlayer->zViewVel = pPlayer->zWeaponVel;
if (!(gGameOptions.nGameType == 1 && gGameOptions.bKeepKeysOnRespawn && !bNewLevel))
for (int i = 0; i < 8; i++)
pPlayer->hasKey[i] = gGameOptions.nGameType >= 2;
@ -1872,12 +1872,12 @@ void playerProcess(PLAYER* pPlayer)
pPlayer->zViewVel += MulScaleF(dz << 8, 0x1800, 16) / 65536;
pPlayer->zView += pPlayer->zViewVel;
pPlayer->zWeaponVel = interpolatedvalue(pPlayer->zWeaponVel, actor->int_vel().Z, FixedToFloat(0x5000));
dz = pPlayer->actor->int_pos().Z - pPosture->weaponAboveZ - pPlayer->zWeapon;
dz = pPlayer->actor->int_pos().Z - pPosture->weaponAboveZ - pPlayer->zWeapon * zworldtoint;
if (dz > 0)
pPlayer->zWeaponVel += MulScale(dz << 8, 0x8000, 16);
else
pPlayer->zWeaponVel += MulScale(dz << 8, 0xc00, 16);
pPlayer->zWeapon += pPlayer->zWeaponVel >> 8;
pPlayer->zWeapon += FixedToFloat(pPlayer->zWeaponVel);
pPlayer->bobPhase = ClipLow(pPlayer->bobPhase - 4, 0);
nSpeed >>= FRACBITS;
if (pPlayer->posture == 1)
@ -1967,13 +1967,13 @@ void playerProcess(PLAYER* pPlayer)
DBloodActor* playerFireMissile(PLAYER* pPlayer, int a2, int a3, int a4, int a5, int a6)
{
return actFireMissile(pPlayer->actor, a2, pPlayer->zWeapon - pPlayer->actor->int_pos().Z, a3, a4, a5, a6);
return actFireMissile(pPlayer->actor, a2, pPlayer->zWeapon * zworldtoint - pPlayer->actor->int_pos().Z, a3, a4, a5, a6);
}
DBloodActor* playerFireThing(PLAYER* pPlayer, int a2, int a3, int thingType, int a5)
{
assert(thingType >= kThingBase && thingType < kThingMax);
return actFireThing(pPlayer->actor, a2, pPlayer->zWeapon - pPlayer->actor->int_pos().Z, pPlayer->slope + a3, thingType, a5);
return actFireThing(pPlayer->actor, a2, pPlayer->zWeapon * zworldtoint - pPlayer->actor->int_pos().Z, pPlayer->slope + a3, thingType, a5);
}
//---------------------------------------------------------------------------
@ -2328,7 +2328,7 @@ void voodooTarget(PLAYER* pPlayer)
{
DBloodActor* actor = pPlayer->actor;
int v4 = pPlayer->aim.dz;
int dz = pPlayer->zWeapon - pPlayer->actor->int_pos().Z;
double dz = pPlayer->zWeapon - pPlayer->actor->spr.pos.Z;
if (UseAmmo(pPlayer, 9, 0) < 8)
{
pPlayer->voodooTargets = 0;
@ -2337,9 +2337,9 @@ void voodooTarget(PLAYER* pPlayer)
for (int i = 0; i < 4; i++)
{
int ang1 = (pPlayer->voodooVar1 + pPlayer->vodooVar2) & 2047;
actFireVector(actor, 0, dz, bcos(ang1), bsin(ang1), v4, kVectorVoodoo10);
actFireVectorf(actor, 0, dz, bcos(ang1), bsin(ang1), v4, kVectorVoodoo10);
int ang2 = (pPlayer->voodooVar1 + 2048 - pPlayer->vodooVar2) & 2047;
actFireVector(actor, 0, dz, bcos(ang2), bsin(ang2), v4, kVectorVoodoo10);
actFireVectorf(actor, 0, dz, bcos(ang2), bsin(ang2), v4, kVectorVoodoo10);
}
pPlayer->voodooTargets = ClipLow(pPlayer->voodooTargets - 1, 0);
}

View file

@ -110,8 +110,8 @@ struct PLAYER
double zView;
double ozView;
double zViewVel;
int zWeapon;
int ozWeapon;
double zWeapon;
double ozWeapon;
int zWeaponVel;
int slope;
bool isUnderwater;

View file

@ -60,7 +60,7 @@ void viewBackupView(int nPlayer)
{
PLAYER* pPlayer = &gPlayer[nPlayer];
pPlayer->ozView = pPlayer->zView;
pPlayer->ozWeapon = pPlayer->zWeapon - pPlayer->zView * zworldtoint - 0xc00;
pPlayer->ozWeapon = pPlayer->zWeapon - pPlayer->zView - 12;
pPlayer->obobHeight = pPlayer->bobHeight;
pPlayer->obobWidth = pPlayer->bobWidth;
pPlayer->oswayHeight = pPlayer->swayHeight;
@ -492,7 +492,7 @@ static void SetupView(PLAYER* pPlayer, DVector3& cPos, DAngle& cA, fixedhoriz& c
{
cPos.XY() = pPlayer->actor->interpolatedpos(interpfrac).XY();
cPos.Z = interpolatedvalue(pPlayer->ozView, pPlayer->zView, interpfrac);
zDelta = interpolatedvalue<double>(pPlayer->ozWeapon, pPlayer->zWeapon - pPlayer->zView * zworldtoint - (12 << 8), interpfrac);
zDelta = interpolatedvalue(pPlayer->ozWeapon, pPlayer->zWeapon - pPlayer->zView - 12, interpfrac);
bobWidth = interpolatedvalue<double>(pPlayer->obobWidth, pPlayer->bobWidth, interpfrac);
bobHeight = interpolatedvalue<double>(pPlayer->obobHeight, pPlayer->bobHeight, interpfrac);
shakeX = interpolatedvalue<double>(pPlayer->oswayWidth, pPlayer->swayWidth, interpfrac);

View file

@ -248,17 +248,17 @@ 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;
int dz = pPlayer->zWeapon - (pPlayer->zWeapon - pPlayer->zView * zworldtoint) / 2;
fxSpawnEjectingBrass(pPlayer->actor, dz, a2, a3);
double dz = pPlayer->zWeapon - (pPlayer->zWeapon - pPlayer->zView) * 0.5;
fxSpawnEjectingBrassf(pPlayer->actor, dz, a2, 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;
int t = pPlayer->zWeapon - pPlayer->zView * zworldtoint;
int dz = pPlayer->zWeapon - t + (t >> 2);
fxSpawnEjectingShell(pPlayer->actor, dz, a2, a3);
double t = pPlayer->zWeapon - pPlayer->zView;
double dz = pPlayer->zWeapon - t + (t * 0.25);
fxSpawnEjectingShellf(pPlayer->actor, dz, a2, a3);
}
//---------------------------------------------------------------------------
@ -425,7 +425,7 @@ void UpdateAimVector(PLAYER* pPlayer)
auto plActor = pPlayer->actor;
int x = plActor->int_pos().X;
int y = plActor->int_pos().Y;
int z = pPlayer->zWeapon;
int z = pPlayer->zWeapon * zworldtoint;
Aim aim;
aim.dx = bcos(plActor->int_ang());
aim.dy = bsin(plActor->int_ang());
@ -1163,7 +1163,7 @@ void FirePitchfork(int, PLAYER* pPlayer)
int r2 = Random2(2000);
int r3 = Random2(2000);
for (int i = 0; i < 4; i++)
actFireVector(actor, (2 * i - 3) * 40, pPlayer->zWeapon - pPlayer->actor->int_pos().Z, aim->dx + r1, aim->dy + r2, aim->dz + r3, kVectorTine);
actFireVectorf(actor, (2 * i - 3) * 40, pPlayer->zWeapon - pPlayer->actor->spr.pos.Z, aim->dx + r1, aim->dy + r2, aim->dz + r3, kVectorTine);
}
//---------------------------------------------------------------------------
@ -1420,7 +1420,7 @@ void FireShotgun(int nTrigger, PLAYER* pPlayer)
r3 = Random3(1500);
nType = kVectorShellAP;
}
actFireVector(actor, 0, pPlayer->zWeapon - pPlayer->actor->int_pos().Z, pPlayer->aim.dx + r1, pPlayer->aim.dy + r2, pPlayer->aim.dz + r3, nType);
actFireVectorf(actor, 0, pPlayer->zWeapon - pPlayer->actor->spr.pos.Z, pPlayer->aim.dx + r1, pPlayer->aim.dy + r2, pPlayer->aim.dz + r3, nType);
}
UseAmmo(pPlayer, pPlayer->weaponAmmo, nTrigger);
pPlayer->flashEffect = 1;
@ -1450,7 +1450,7 @@ void FireTommy(int nTrigger, PLAYER* pPlayer)
int r1 = Random3(400);
int r2 = Random3(1200);
int r3 = Random3(1200);
actFireVector(actor, 0, pPlayer->zWeapon - pPlayer->actor->int_pos().Z, aim->dx + r3, aim->dy + r2, aim->dz + r1, kVectorTommyRegular);
actFireVectorf(actor, 0, pPlayer->zWeapon - pPlayer->actor->spr.pos.Z, aim->dx + r3, aim->dy + r2, aim->dz + r1, kVectorTommyRegular);
SpawnBulletEject(pPlayer, -15, -45);
pPlayer->visibility = 20;
break;
@ -1460,12 +1460,12 @@ void FireTommy(int nTrigger, PLAYER* pPlayer)
int r1 = Random3(400);
int r2 = Random3(1200);
int r3 = Random3(1200);
actFireVector(actor, -120, pPlayer->zWeapon - pPlayer->actor->int_pos().Z, aim->dx + r3, aim->dy + r2, aim->dz + r1, kVectorTommyRegular);
actFireVectorf(actor, -120, pPlayer->zWeapon - pPlayer->actor->spr.pos.Z, aim->dx + r3, aim->dy + r2, aim->dz + r1, kVectorTommyRegular);
SpawnBulletEject(pPlayer, -140, -45);
r1 = Random3(400);
r2 = Random3(1200);
r3 = Random3(1200);
actFireVector(actor, 120, pPlayer->zWeapon - pPlayer->actor->int_pos().Z, aim->dx + r3, aim->dy + r2, aim->dz + r1, kVectorTommyRegular);
actFireVectorf(actor, 120, pPlayer->zWeapon - pPlayer->actor->spr.pos.Z, aim->dx + r3, aim->dy + r2, aim->dz + r1, kVectorTommyRegular);
SpawnBulletEject(pPlayer, 140, 45);
pPlayer->visibility = 30;
break;
@ -1496,7 +1496,7 @@ void FireSpread(int nTrigger, PLAYER* pPlayer)
r1 = Random3(300);
r2 = Random3(600);
r3 = Random3(600);
actFireVector(actor, 0, pPlayer->zWeapon - pPlayer->actor->int_pos().Z, dx + r3, dy + r2, aim->dz + r1, kVectorTommyAP);
actFireVectorf(actor, 0, pPlayer->zWeapon - pPlayer->actor->spr.pos.Z, dx + r3, dy + r2, aim->dz + r1, kVectorTommyAP);
r1 = Random2(90);
r2 = Random2(30);
SpawnBulletEject(pPlayer, r2, r1);
@ -1524,14 +1524,14 @@ void AltFireSpread(int nTrigger, PLAYER* pPlayer)
r1 = Random3(300);
r2 = Random3(600);
r3 = Random3(600);
actFireVector(actor, -120, pPlayer->zWeapon - pPlayer->actor->int_pos().Z, dx + r3, dy + r2, aim->dz + r1, kVectorTommyAP);
actFireVectorf(actor, -120, pPlayer->zWeapon - pPlayer->actor->spr.pos.Z, dx + r3, dy + r2, aim->dz + r1, kVectorTommyAP);
r1 = Random2(45);
r2 = Random2(120);
SpawnBulletEject(pPlayer, r2, r1);
r1 = Random3(300);
r2 = Random3(600);
r3 = Random3(600);
actFireVector(actor, 120, pPlayer->zWeapon - pPlayer->actor->int_pos().Z, dx + r3, dy + r2, aim->dz + r1, kVectorTommyAP);
actFireVectorf(actor, 120, pPlayer->zWeapon - pPlayer->actor->spr.pos.Z, dx + r3, dy + r2, aim->dz + r1, kVectorTommyAP);
r1 = Random2(-45);
r2 = Random2(-120);
SpawnBulletEject(pPlayer, r2, r1);
@ -1562,14 +1562,14 @@ void AltFireSpread2(int nTrigger, PLAYER* pPlayer)
r1 = Random3(300);
r2 = Random3(600);
r3 = Random3(600);
actFireVector(actor, -120, pPlayer->zWeapon - pPlayer->actor->int_pos().Z, dx + r3, dy + r2, aim->dz + r1, kVectorTommyAP);
actFireVectorf(actor, -120, pPlayer->zWeapon - pPlayer->actor->spr.pos.Z, dx + r3, dy + r2, aim->dz + r1, kVectorTommyAP);
r1 = Random2(45);
r2 = Random2(120);
SpawnBulletEject(pPlayer, r2, r1);
r1 = Random3(300);
r2 = Random3(600);
r3 = Random3(600);
actFireVector(actor, 120, pPlayer->zWeapon - pPlayer->actor->int_pos().Z, dx + r3, dy + r2, aim->dz + r1, kVectorTommyAP);
actFireVectorf(actor, 120, pPlayer->zWeapon - pPlayer->actor->spr.pos.Z, dx + r3, dy + r2, aim->dz + r1, kVectorTommyAP);
r1 = Random2(-45);
r2 = Random2(-120);
SpawnBulletEject(pPlayer, r2, r1);
@ -1583,7 +1583,7 @@ void AltFireSpread2(int nTrigger, PLAYER* pPlayer)
r1 = Random3(300);
r2 = Random3(600);
r3 = Random3(600);
actFireVector(actor, 0, pPlayer->zWeapon - pPlayer->actor->int_pos().Z, dx + r3, dy + r2, aim->dz + r1, kVectorTommyAP);
actFireVectorf(actor, 0, pPlayer->zWeapon - pPlayer->actor->spr.pos.Z, dx + r3, dy + r2, aim->dz + r1, kVectorTommyAP);
r1 = Random2(90);
r2 = Random2(30);
SpawnBulletEject(pPlayer, r2, r1);
@ -2030,7 +2030,7 @@ void FireBeast(int, PLAYER* pPlayer)
int r1 = Random2(2000);
int r2 = Random2(2000);
int r3 = Random2(2000);
actFireVector(actor, 0, pPlayer->zWeapon - pPlayer->actor->int_pos().Z, pPlayer->aim.dx + r1, pPlayer->aim.dy + r2, pPlayer->aim.dz + r3, kVectorBeastSlash);
actFireVectorf(actor, 0, pPlayer->zWeapon - pPlayer->actor->spr.pos.Z, pPlayer->aim.dx + r1, pPlayer->aim.dy + r2, pPlayer->aim.dz + r3, kVectorBeastSlash);
}
//---------------------------------------------------------------------------

View file

@ -75,7 +75,7 @@ struct BloodPlayer native
native int lifeMode;
native double zView;
native double zViewVel;
native int zWeapon;
native double zWeapon;
native int zWeaponVel;
native int slope;
native bool isUnderwater;