mirror of
https://github.com/DrBeef/Raze.git
synced 2025-02-08 00:32:28 +00:00
- handle lasthit in Exhumed
This commit is contained in:
parent
424a58f91b
commit
de18371e06
5 changed files with 15 additions and 35 deletions
|
@ -68,9 +68,7 @@ extern bulletInfo BulletInfo[];
|
||||||
|
|
||||||
extern int nRadialBullet;
|
extern int nRadialBullet;
|
||||||
extern sectortype* lasthitsect;
|
extern sectortype* lasthitsect;
|
||||||
extern int lasthitz;
|
extern DVector3 lasthit;
|
||||||
extern int lasthitx;
|
|
||||||
extern int lasthity;
|
|
||||||
extern TArray<DExhumedActor*> EnergyBlocks;
|
extern TArray<DExhumedActor*> EnergyBlocks;
|
||||||
|
|
||||||
void InitBullets();
|
void InitBullets();
|
||||||
|
|
|
@ -234,7 +234,7 @@ void BuildExplosion(DExhumedActor* pActor)
|
||||||
{
|
{
|
||||||
edx = 75;
|
edx = 75;
|
||||||
}
|
}
|
||||||
else if (pActor->int_pos().Z == pActor->sector()->int_floorz())
|
else if (pActor->spr.pos.Z == pActor->sector()->floorz)
|
||||||
{
|
{
|
||||||
edx = 34;
|
edx = 34;
|
||||||
}
|
}
|
||||||
|
|
|
@ -91,7 +91,7 @@ void AIBubble::Tick(RunListEvent* ev)
|
||||||
|
|
||||||
auto pSector = pActor->sector();
|
auto pSector = pActor->sector();
|
||||||
|
|
||||||
if (pActor->int_pos().Z <= pSector->int_ceilingz())
|
if (pActor->spr.pos.Z <= pSector->ceilingz)
|
||||||
{
|
{
|
||||||
auto pSectAbove = pSector->pAbove;
|
auto pSectAbove = pSector->pAbove;
|
||||||
|
|
||||||
|
|
|
@ -53,7 +53,7 @@ struct Bullet
|
||||||
};
|
};
|
||||||
|
|
||||||
FreeListArray<Bullet, kMaxBullets> BulletList;
|
FreeListArray<Bullet, kMaxBullets> BulletList;
|
||||||
int lasthitz, lasthitx, lasthity;
|
DVector3 lasthit;
|
||||||
sectortype* lasthitsect;
|
sectortype* lasthitsect;
|
||||||
|
|
||||||
size_t MarkBullets()
|
size_t MarkBullets()
|
||||||
|
@ -103,9 +103,7 @@ void SerializeBullet(FSerializer& arc)
|
||||||
if (arc.BeginObject("bullets"))
|
if (arc.BeginObject("bullets"))
|
||||||
{
|
{
|
||||||
arc ("list", BulletList)
|
arc ("list", BulletList)
|
||||||
("lasthitx", lasthitx)
|
("lasthit", lasthit)
|
||||||
("lasthity", lasthity)
|
|
||||||
("lasthitz", lasthitz)
|
|
||||||
("lasthitsect", lasthitsect)
|
("lasthitsect", lasthitsect)
|
||||||
("radialbullet", nRadialBullet)
|
("radialbullet", nRadialBullet)
|
||||||
.EndObject();
|
.EndObject();
|
||||||
|
@ -311,12 +309,9 @@ int MoveBullet(int nBullet)
|
||||||
|
|
||||||
DExhumedActor* pActor = BulletList[nBullet].pActor;
|
DExhumedActor* pActor = BulletList[nBullet].pActor;
|
||||||
|
|
||||||
int x = pActor->int_pos().X;
|
auto apos = pActor->spr.pos;
|
||||||
int y = pActor->int_pos().Y;
|
|
||||||
int z = pActor->int_pos().Z; // ebx
|
|
||||||
int nSectFlag = pActor->sector()->Flag;
|
int nSectFlag = pActor->sector()->Flag;
|
||||||
|
|
||||||
int x2, y2, z2;
|
|
||||||
DVector3 pos;
|
DVector3 pos;
|
||||||
|
|
||||||
int nVal = 0;
|
int nVal = 0;
|
||||||
|
@ -371,9 +366,6 @@ MOVEEND:
|
||||||
if (coll.type || coll.exbits)
|
if (coll.type || coll.exbits)
|
||||||
{
|
{
|
||||||
nVal = 1;
|
nVal = 1;
|
||||||
x2 = pActor->int_pos().X;
|
|
||||||
y2 = pActor->int_pos().Y;
|
|
||||||
z2 = pActor->int_pos().Z;
|
|
||||||
pos = pActor->spr.pos;
|
pos = pActor->spr.pos;
|
||||||
pHitSect = pActor->sector();
|
pHitSect = pActor->sector();
|
||||||
|
|
||||||
|
@ -422,33 +414,22 @@ MOVEEND:
|
||||||
if (BulletList[nBullet].pEnemy)
|
if (BulletList[nBullet].pEnemy)
|
||||||
{
|
{
|
||||||
hitactor = BulletList[nBullet].pEnemy;
|
hitactor = BulletList[nBullet].pEnemy;
|
||||||
x2 = hitactor->int_pos().X;
|
pos = hitactor->spr.pos.plusZ(-GetActorHeightF(hitactor) * 0.5);
|
||||||
y2 = hitactor->int_pos().Y;
|
|
||||||
z2 = hitactor->int_pos().Z - (GetActorHeight(hitactor) >> 1);
|
|
||||||
pHitSect = hitactor->sector();
|
pHitSect = hitactor->sector();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
vec3_t startPos = { x, y, z };
|
|
||||||
HitInfo hit{};
|
HitInfo hit{};
|
||||||
int dz;
|
double dz = -pBullet->nPitch *2;
|
||||||
if (bVanilla)
|
hitscan(apos, pActor->sector(), DVector3(pActor->spr.angle.ToVector() * 1024, dz), hit, CLIPMASK1);
|
||||||
dz = -bsin(pBullet->nPitch, 3);
|
pos = hit.hitpos;
|
||||||
else
|
|
||||||
dz = -pBullet->nPitch * 512;
|
|
||||||
hitscan(startPos, pActor->sector(), { bcos(pActor->int_ang()), bsin(pActor->int_ang()), dz }, hit, CLIPMASK1);
|
|
||||||
x2 = hit.int_hitpos().X;
|
|
||||||
y2 = hit.int_hitpos().Y;
|
|
||||||
z2 = hit.int_hitpos().Z;
|
|
||||||
hitactor = hit.actor();
|
hitactor = hit.actor();
|
||||||
pHitSect = hit.hitSector;
|
pHitSect = hit.hitSector;
|
||||||
pHitWall = hit.hitWall;
|
pHitWall = hit.hitWall;
|
||||||
}
|
}
|
||||||
pos = {x2 * inttoworld, y2 * inttoworld, z2 * zinttoworld};
|
|
||||||
|
|
||||||
lasthitx = x2;
|
lasthit = pos;
|
||||||
lasthity = y2;
|
|
||||||
lasthitz = z2;
|
|
||||||
lasthitsect = pHitSect;
|
lasthitsect = pHitSect;
|
||||||
|
|
||||||
if (hitactor)
|
if (hitactor)
|
||||||
|
@ -505,7 +486,8 @@ HITSPRITE:
|
||||||
{
|
{
|
||||||
if (pHitWall != nullptr)
|
if (pHitWall != nullptr)
|
||||||
{
|
{
|
||||||
BackUpBullet(&x2, &y2, pActor->int_ang());
|
pos.X -= pActor->spr.angle.Cos() * 0.5;
|
||||||
|
pos.Y -= pActor->spr.angle.Sin() * 0.5;
|
||||||
|
|
||||||
if (nType != 3 || RandomSize(2) == 0)
|
if (nType != 3 || RandomSize(2) == 0)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1742,7 +1742,7 @@ void AIEnergyBlock::Damage(RunListEvent* ev)
|
||||||
auto pActor2 = insertActor(lasthitsect, 0);
|
auto pActor2 = insertActor(lasthitsect, 0);
|
||||||
|
|
||||||
pActor2->set_int_ang(ev->nParam);
|
pActor2->set_int_ang(ev->nParam);
|
||||||
pActor2->set_int_pos({ lasthitx, lasthity, lasthitz });
|
pActor2->spr.pos = lasthit;
|
||||||
|
|
||||||
BuildSpark(pActor2, 0); // shoot out blue orb when damaged
|
BuildSpark(pActor2, 0); // shoot out blue orb when damaged
|
||||||
DeleteActor(pActor2);
|
DeleteActor(pActor2);
|
||||||
|
|
Loading…
Reference in a new issue