- floatified playerFireThing

This commit is contained in:
Christoph Oelckers 2022-09-29 12:53:11 +02:00
parent cab00d05dc
commit b176ceda38
3 changed files with 14 additions and 19 deletions

View file

@ -1917,12 +1917,9 @@ DBloodActor* playerFireMissile(PLAYER* pPlayer, double xyoff, const DVector3& dv
return actFireMissile(pPlayer->actor, xyoff, pPlayer->zWeapon - pPlayer->actor->spr.pos.Z, dv, nType); return actFireMissile(pPlayer->actor, xyoff, pPlayer->zWeapon - pPlayer->actor->spr.pos.Z, dv, nType);
} }
DBloodActor* playerFireThing(PLAYER* pPlayer, int xyoff_, int zvel_, int thingType, int nSpeed_) DBloodActor* playerFireThing(PLAYER* pPlayer, double xyoff, double zvel, int thingType, double nSpeed)
{ {
double xyoff = xyoff_ * inttoworld; return actFireThing(pPlayer->actor, xyoff, pPlayer->zWeapon - pPlayer->actor->spr.pos.Z, pPlayer->slope * 0.25 + zvel, thingType, nSpeed);
double zvel = FixedToFloat(pPlayer->int_slope() + zvel_);
double nSpeed = FixedToFloat(nSpeed_);
return actFireThing(pPlayer->actor, xyoff, pPlayer->zWeapon - pPlayer->actor->spr.pos.Z, zvel, thingType, nSpeed);
} }
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------

View file

@ -236,8 +236,7 @@ void CheckPickUp(PLAYER* pPlayer);
void ProcessInput(PLAYER* pPlayer); void ProcessInput(PLAYER* pPlayer);
void playerProcess(PLAYER* pPlayer); void playerProcess(PLAYER* pPlayer);
DBloodActor* playerFireMissile(PLAYER* pPlayer, double xyoff, const DVector3& vec, int nType); DBloodActor* playerFireMissile(PLAYER* pPlayer, double xyoff, const DVector3& vec, int nType);
DBloodActor* playerFireThing(PLAYER* pPlayer, double xyoff, double zvel, int thingType, double nSpeed);
DBloodActor* playerFireThing(PLAYER* pPlayer, int xyoff, int zvel, int thingType, int nSpeed);
void playerFrag(PLAYER* pKiller, PLAYER* pVictim); void playerFrag(PLAYER* pKiller, PLAYER* pVictim);
int playerDamageArmor(PLAYER* pPlayer, DAMAGE_TYPE nType, int nDamage); int playerDamageArmor(PLAYER* pPlayer, DAMAGE_TYPE nType, int nDamage);
int playerDamageSprite(DBloodActor* nSource, PLAYER* pPlayer, DAMAGE_TYPE nDamageType, int nDamage); int playerDamageSprite(DBloodActor* nSource, PLAYER* pPlayer, DAMAGE_TYPE nDamageType, int nDamage);

View file

@ -1179,9 +1179,9 @@ void FireSpray(int, PLAYER* pPlayer)
void ThrowCan(int, PLAYER* pPlayer) void ThrowCan(int, PLAYER* pPlayer)
{ {
sfxKill3DSound(pPlayer->actor, -1, 441); sfxKill3DSound(pPlayer->actor, -1, 441);
int nSpeed = MulScale(pPlayer->throwPower, 0x177777, 16) + 0x66666; double nSpeed = FixedToFloat(MulScale(pPlayer->throwPower, 0x177777, 16) + 0x66666); // deal with this later.
sfxPlay3DSound(pPlayer->actor, 455, 1, 0); sfxPlay3DSound(pPlayer->actor, 455, 1, 0);
auto spawned = playerFireThing(pPlayer, 0, -9460, kThingArmedSpray, nSpeed); auto spawned = playerFireThing(pPlayer, 0, -9460 / 65536., kThingArmedSpray, nSpeed);
if (spawned) if (spawned)
{ {
sfxPlay3DSound(spawned, 441, 0, 0); sfxPlay3DSound(spawned, 441, 0, 0);
@ -1239,9 +1239,9 @@ void ExplodeCan(int, PLAYER* pPlayer)
void ThrowBundle(int, PLAYER* pPlayer) void ThrowBundle(int, PLAYER* pPlayer)
{ {
sfxKill3DSound(pPlayer->actor, 16, -1); sfxKill3DSound(pPlayer->actor, 16, -1);
int nSpeed = MulScale(pPlayer->throwPower, 0x177777, 16) + 0x66666; double nSpeed = FixedToFloat(MulScale(pPlayer->throwPower, 0x177777, 16) + 0x66666); // deal with this later.
sfxPlay3DSound(pPlayer->actor, 455, 1, 0); sfxPlay3DSound(pPlayer->actor, 455, 1, 0);
auto spawned = playerFireThing(pPlayer, 0, -9460, kThingArmedTNTBundle, nSpeed); auto spawned = playerFireThing(pPlayer, 0, -9460 / 65536., kThingArmedTNTBundle, nSpeed);
if (spawned) if (spawned)
{ {
if (pPlayer->fuseTime < 0) if (pPlayer->fuseTime < 0)
@ -1298,9 +1298,9 @@ void ExplodeBundle(int, PLAYER* pPlayer)
void ThrowProx(int, PLAYER* pPlayer) void ThrowProx(int, PLAYER* pPlayer)
{ {
int nSpeed = MulScale(pPlayer->throwPower, 0x177777, 16) + 0x66666; double nSpeed = FixedToFloat(MulScale(pPlayer->throwPower, 0x177777, 16) + 0x66666); // deal with this later.
sfxPlay3DSound(pPlayer->actor, 455, 1, 0); sfxPlay3DSound(pPlayer->actor, 455, 1, 0);
auto spawned = playerFireThing(pPlayer, 0, -9460, kThingArmedProxBomb, nSpeed); auto spawned = playerFireThing(pPlayer, 0, -9460 / 65536., kThingArmedProxBomb, nSpeed);
if (spawned) if (spawned)
{ {
evPostActor(spawned, 240, kCmdOn, pPlayer->actor); evPostActor(spawned, 240, kCmdOn, pPlayer->actor);
@ -1333,9 +1333,9 @@ void DropProx(int, PLAYER* pPlayer)
void ThrowRemote(int, PLAYER* pPlayer) void ThrowRemote(int, PLAYER* pPlayer)
{ {
int nSpeed = MulScale(pPlayer->throwPower, 0x177777, 16) + 0x66666; double nSpeed = FixedToFloat(MulScale(pPlayer->throwPower, 0x177777, 16) + 0x66666); // deal with this later.
sfxPlay3DSound(pPlayer->actor, 455, 1, 0); sfxPlay3DSound(pPlayer->actor, 455, 1, 0);
auto spawned = playerFireThing(pPlayer, 0, -9460, kThingArmedRemoteBomb, nSpeed); auto spawned = playerFireThing(pPlayer, 0, -9460 / 65536., kThingArmedRemoteBomb, nSpeed);
if (spawned) if (spawned)
{ {
spawned->xspr.rxID = 90 + (pPlayer->actor->spr.type - kDudePlayer1); spawned->xspr.rxID = 90 + (pPlayer->actor->spr.type - kDudePlayer1);
@ -1799,7 +1799,7 @@ void AltFireVoodoo(int nTrigger, PLAYER* pPlayer)
void DropVoodoo(int, PLAYER* pPlayer) void DropVoodoo(int, PLAYER* pPlayer)
{ {
sfxPlay3DSound(pPlayer->actor, 455, 2, 0); sfxPlay3DSound(pPlayer->actor, 455, 2, 0);
auto spawned = playerFireThing(pPlayer, 0, -4730, kThingVoodooHead, 0xccccc); auto spawned = playerFireThing(pPlayer, 0, -4730 / 65536., kThingVoodooHead, 12.8);
if (spawned) if (spawned)
{ {
spawned->xspr.data1 = pPlayer->ammoCount[9]; spawned->xspr.data1 = pPlayer->ammoCount[9];
@ -1926,8 +1926,7 @@ void FireNapalm2(int, PLAYER* pPlayer)
void AltFireNapalm(int, PLAYER* pPlayer) void AltFireNapalm(int, PLAYER* pPlayer)
{ {
int nSpeed = MulScale(0x8000, 0x177777, 16) + 0x66666; auto missile = playerFireThing(pPlayer, 0, -4730 / 65536., kThingNapalmBall, 18.13333);
auto missile = playerFireThing(pPlayer, 0, -4730, kThingNapalmBall, nSpeed);
if (missile) if (missile)
{ {
missile->xspr.data4 = ClipHigh(pPlayer->ammoCount[4], 12); missile->xspr.data4 = ClipHigh(pPlayer->ammoCount[4], 12);
@ -1978,7 +1977,7 @@ void AltFireLifeLeech(int, PLAYER* pPlayer)
{ {
DBloodActor* actor = pPlayer->actor; DBloodActor* actor = pPlayer->actor;
sfxPlay3DSound(pPlayer->actor, 455, 2, 0); sfxPlay3DSound(pPlayer->actor, 455, 2, 0);
auto missile = playerFireThing(pPlayer, 0, -4730, kThingDroppedLifeLeech, 0x19999); auto missile = playerFireThing(pPlayer, 0, -4730 / 65536., kThingDroppedLifeLeech, 1.6);
if (missile) if (missile)
{ {
missile->spr.cstat |= CSTAT_SPRITE_BLOOD_BIT1; missile->spr.cstat |= CSTAT_SPRITE_BLOOD_BIT1;