mirror of
https://github.com/DrBeef/Raze.git
synced 2025-01-20 08:00:56 +00:00
- floatified BuildBullet
This commit is contained in:
parent
f4df9a25da
commit
48b34ad84d
10 changed files with 24 additions and 32 deletions
|
@ -76,11 +76,10 @@ int GrabBullet();
|
|||
void DestroyBullet(int nRun);
|
||||
int MoveBullet(int nBullet);
|
||||
void SetBulletEnemy(int nBullet, DExhumedActor* nEnemy);
|
||||
DExhumedActor* BuildBullet(DExhumedActor* pActor, int nType, int val1, DAngle nAngle, DExhumedActor* pTarget, int val3, int horiz = 0);
|
||||
DExhumedActor* BuildBullet(DExhumedActor* pActor, int nType, double zofs, DAngle nAngle, DExhumedActor* pTarget, int val3, int horiz = 0);
|
||||
|
||||
void IgniteSprite(DExhumedActor* nSprite);
|
||||
void FuncBullet(int, int, int, int);
|
||||
void BackUpBullet(int *x, int *y, int nAngle);
|
||||
|
||||
// fish
|
||||
|
||||
|
|
|
@ -262,7 +262,7 @@ void AIAnubis::Tick(RunListEvent* ev)
|
|||
// loc_25718:
|
||||
if (nFlag & 0x80)
|
||||
{
|
||||
BuildBullet(ap, 8, -1, ap->spr.angle, pTarget, 1);
|
||||
BuildBullet(ap, 8, INT_MAX, ap->spr.angle, pTarget, 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -280,12 +280,6 @@ void BulletHitsSprite(Bullet *pBullet, DExhumedActor* pBulletActor, DExhumedActo
|
|||
}
|
||||
|
||||
|
||||
void BackUpBullet(int *x, int *y, int nAngle)
|
||||
{
|
||||
*x -= bcos(nAngle, -11);
|
||||
*y -= bsin(nAngle, -11);
|
||||
}
|
||||
|
||||
int MoveBullet(int nBullet)
|
||||
{
|
||||
|
||||
|
@ -524,7 +518,7 @@ void SetBulletEnemy(int nBullet, DExhumedActor* pEnemy)
|
|||
}
|
||||
}
|
||||
|
||||
DExhumedActor* BuildBullet(DExhumedActor* pActor, int nType, int nZOffset, DAngle nAngle, DExhumedActor* pTarget, int nDoubleDamage, int nPitch)
|
||||
DExhumedActor* BuildBullet(DExhumedActor* pActor, int nType, double fZOffset, DAngle nAngle, DExhumedActor* pTarget, int nDoubleDamage, int nPitch)
|
||||
{
|
||||
Bullet sBullet;
|
||||
bulletInfo *pBulletInfo = &BulletInfo[nType];
|
||||
|
@ -573,11 +567,10 @@ DExhumedActor* BuildBullet(DExhumedActor* pActor, int nType, int nZOffset, DAngl
|
|||
}
|
||||
|
||||
auto pBulletActor = insertActor(pSector, 200);
|
||||
int nHeight = GetActorHeight(pActor);
|
||||
nHeight = nHeight - (nHeight >> 2);
|
||||
double fHeight = GetActorHeightF(pActor) * 0.75;
|
||||
|
||||
if (nZOffset == -1) {
|
||||
nZOffset = -nHeight;
|
||||
if (fZOffset == INT_MAX) {
|
||||
fZOffset = -fHeight;
|
||||
}
|
||||
|
||||
pBulletActor->spr.pos = pActor->spr.pos;
|
||||
|
@ -650,10 +643,10 @@ DExhumedActor* BuildBullet(DExhumedActor* pActor, int nType, int nZOffset, DAngl
|
|||
pBullet->nRunRec = runlist_AddRunRec(pBulletActor->spr.lotag - 1, nBullet, 0xB0000);
|
||||
pBullet->nRunRec2 = runlist_AddRunRec(NewRun, nBullet, 0xB0000);
|
||||
pBullet->nDoubleDamage = nDoubleDamage;
|
||||
pBulletActor->add_int_z(nZOffset);
|
||||
pBulletActor->spr.pos.Z += fZOffset;
|
||||
pBulletActor->backuppos();
|
||||
|
||||
int var_18 = 0;
|
||||
double nVertVel = 0;
|
||||
|
||||
pSector = pBulletActor->sector();
|
||||
|
||||
|
@ -671,7 +664,7 @@ DExhumedActor* BuildBullet(DExhumedActor* pActor, int nType, int nZOffset, DAngl
|
|||
|
||||
if (pTarget == nullptr)
|
||||
{
|
||||
var_18 = (-bsin(nPitch) * pBulletInfo->field_4) >> 11;
|
||||
nVertVel = (-DAngle::fromBuild(nPitch).Sin() * 8 * pBulletInfo->field_4);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -681,18 +674,18 @@ DExhumedActor* BuildBullet(DExhumedActor* pActor, int nType, int nZOffset, DAngl
|
|||
}
|
||||
else
|
||||
{
|
||||
nHeight = GetActorHeight(pTarget);
|
||||
fHeight = GetActorHeightF(pTarget);
|
||||
|
||||
if (pTarget->spr.statnum == 100)
|
||||
{
|
||||
nHeight -= nHeight >> 2;
|
||||
fHeight *= 0.75;
|
||||
}
|
||||
else
|
||||
{
|
||||
nHeight -= nHeight >> 1;
|
||||
fHeight *= 0.5;
|
||||
}
|
||||
|
||||
int var_20 = pTarget->int_pos().Z - nHeight;
|
||||
double fTop = pTarget->spr.pos.Z - fHeight;
|
||||
|
||||
DVector2 xy;
|
||||
|
||||
|
@ -725,14 +718,14 @@ DExhumedActor* BuildBullet(DExhumedActor* pActor, int nType, int nZOffset, DAngl
|
|||
xy = pTarget->spr.pos.XY() - pBulletActor->spr.pos.XY();
|
||||
}
|
||||
|
||||
int nSqrt = (xy * worldtoint).Length();
|
||||
double nSqrt = xy.Length();
|
||||
if (nSqrt > 0)
|
||||
{
|
||||
var_18 = ((var_20 - pBulletActor->int_pos().Z) * pBulletInfo->field_4) / nSqrt;
|
||||
nVertVel = ((fTop - pBulletActor->spr.pos.Z) * pBulletInfo->field_4) / nSqrt;
|
||||
}
|
||||
else
|
||||
{
|
||||
var_18 = 0;
|
||||
nVertVel = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -750,7 +743,7 @@ DExhumedActor* BuildBullet(DExhumedActor* pActor, int nType, int nZOffset, DAngl
|
|||
{
|
||||
pBullet->field_10 = pBulletInfo->field_4;
|
||||
pBullet->vect.XY() = nAngle.ToVector() * pBulletInfo->field_4 * 128;
|
||||
pBullet->vect.Z = (var_18 >> 3) * zinttoworld;
|
||||
pBullet->vect.Z = nVertVel * 0.125 * zmaptoworld;
|
||||
}
|
||||
|
||||
return pBulletActor;
|
||||
|
|
|
@ -800,7 +800,7 @@ loc_flag:
|
|||
}
|
||||
}
|
||||
|
||||
BuildBullet(pPlayerActor, nAmmoType, nHeight, nAngle, target, var_1C, h);
|
||||
BuildBullet(pPlayerActor, nAmmoType, nHeight * zinttoworld, nAngle, target, var_1C, h);
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
@ -344,7 +344,7 @@ void AILavaDude::Tick(RunListEvent* ev)
|
|||
{
|
||||
if ((nFlag & 0x80) && pTarget)
|
||||
{
|
||||
BuildBullet(pActor, 10, -1, pActor->spr.angle, pTarget, 1);
|
||||
BuildBullet(pActor, 10, INT_MAX, pActor->spr.angle, pTarget, 1);
|
||||
}
|
||||
else if (var_1C)
|
||||
{
|
||||
|
|
|
@ -320,7 +320,7 @@ void AIMummy::Tick(RunListEvent* ev)
|
|||
SetQuake(pActor, 100);
|
||||
|
||||
// low 16 bits of returned var contains the sprite index, the high 16 the bullet number
|
||||
auto pBullet = BuildBullet(pActor, 9, -15360, pActor->spr.angle, pTarget, 1);
|
||||
auto pBullet = BuildBullet(pActor, 9, -60, pActor->spr.angle, pTarget, 1);
|
||||
CheckMummyRevive(pActor);
|
||||
|
||||
if (pBullet)
|
||||
|
|
|
@ -1307,7 +1307,7 @@ void AIQueen::Tick(RunListEvent* ev)
|
|||
|
||||
if (!si)
|
||||
{
|
||||
BuildBullet(pActor, 12, -1, pActor->spr.angle, pTarget, 1);
|
||||
BuildBullet(pActor, 12, INT_MAX, pActor->spr.angle, pTarget, 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -337,7 +337,7 @@ void AIRoach::Tick(RunListEvent* ev)
|
|||
{
|
||||
if (nFlag & 0x80)
|
||||
{
|
||||
BuildBullet(pActor, 13, -1, pActor->spr.angle, pTarget, 1);
|
||||
BuildBullet(pActor, 13, INT_MAX, pActor->spr.angle, pTarget, 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -312,7 +312,7 @@ void AIScorp::Tick(RunListEvent* ev)
|
|||
return;
|
||||
}
|
||||
|
||||
auto nBulletSprite = BuildBullet(pActor, 16, -1, pActor->spr.angle, pTarget, 1);
|
||||
auto nBulletSprite = BuildBullet(pActor, 16, INT_MAX, pActor->spr.angle, pTarget, 1);
|
||||
if (nBulletSprite)
|
||||
{
|
||||
PlotCourseToSprite(nBulletSprite, pTarget);
|
||||
|
|
|
@ -488,7 +488,7 @@ void AISet::Tick(RunListEvent* ev)
|
|||
{
|
||||
if (nFlag & 0x80)
|
||||
{
|
||||
auto pBullet = BuildBullet(pActor, 11, -1, pActor->spr.angle, pTarget, 1);
|
||||
auto pBullet = BuildBullet(pActor, 11, INT_MAX, pActor->spr.angle, pTarget, 1);
|
||||
if (pBullet)
|
||||
SetBulletEnemy(pBullet->nPhase, pTarget);
|
||||
|
||||
|
|
Loading…
Reference in a new issue