mirror of
https://github.com/DrBeef/Raze.git
synced 2025-02-01 05:20:43 +00:00
- got rid of CGibPosition
This commit is contained in:
parent
3d29c8f3ad
commit
54cf1aea6f
5 changed files with 32 additions and 33 deletions
|
@ -290,19 +290,23 @@ int getflorzofslopeptr(const sectortype* sec, int dax, int day);
|
|||
void getzsofslopeptr(const sectortype* sec, int dax, int day, int* ceilz, int* florz);
|
||||
void getzsofslopeptr(const sectortype* sec, double dax, double day, double* ceilz, double* florz);
|
||||
|
||||
inline int getceilzofslopeptr(const sectortype* sec, const DVector3& pos)
|
||||
template<class Vector>
|
||||
inline int getceilzofslopeptr(const sectortype* sec, const Vector& pos)
|
||||
{
|
||||
return getceilzofslopeptr(sec, pos.X * worldtoint, pos.Y * worldtoint);
|
||||
}
|
||||
inline int getflorzofslopeptr(const sectortype* sec, const DVector3& pos)
|
||||
template<class Vector>
|
||||
inline int getflorzofslopeptr(const sectortype* sec, const Vector& pos)
|
||||
{
|
||||
return getflorzofslopeptr(sec, pos.X * worldtoint, pos.Y * worldtoint);
|
||||
}
|
||||
inline void getzsofslopeptr(const sectortype* sec, const DVector3& pos, int* ceilz, int* florz)
|
||||
template<class Vector>
|
||||
inline void getzsofslopeptr(const sectortype* sec, const Vector& pos, int* ceilz, int* florz)
|
||||
{
|
||||
getzsofslopeptr(sec, int(pos.X * worldtoint), int(pos.Y * worldtoint), ceilz, florz);
|
||||
}
|
||||
inline void getzsofslopeptr(const sectortype* sec, const DVector3& pos, double* ceilz, double* florz)
|
||||
template<class Vector>
|
||||
inline void getzsofslopeptr(const sectortype* sec, const Vector& pos, double* ceilz, double* florz)
|
||||
{
|
||||
getzsofslopeptr(sec, pos.X, pos.Y, ceilz, florz);
|
||||
}
|
||||
|
|
|
@ -2974,9 +2974,9 @@ static bool actKillModernDude(DBloodActor* actor, DAMAGE_TYPE damageType)
|
|||
else if (Chance(0x2000)) nGibType = GIBTYPE_5;
|
||||
else nGibType = GIBTYPE_17;
|
||||
|
||||
int top, bottom;
|
||||
double top, bottom;
|
||||
GetActorExtents(actor, &top, &bottom);
|
||||
CGibPosition gibPos(actor->int_pos().X, actor->int_pos().Y, top);
|
||||
DVector3 gibPos(actor->spr.pos.XY(), top);
|
||||
CGibVelocity gibVel(actor->vel.X >> 1, actor->vel.Y >> 1, -0xccccc);
|
||||
GibSprite(actor, nGibType, &gibPos, &gibVel);
|
||||
}
|
||||
|
@ -3212,9 +3212,9 @@ static int checkDamageType(DBloodActor* actor, DAMAGE_TYPE damageType)
|
|||
|
||||
static void spawnGibs(DBloodActor* actor, int type, int velz)
|
||||
{
|
||||
int top, bottom;
|
||||
double top, bottom;
|
||||
GetActorExtents(actor, &top, &bottom);
|
||||
CGibPosition gibPos(actor->int_pos().X, actor->int_pos().Y, top);
|
||||
DVector3 gibPos(actor->spr.pos.XY(), top);
|
||||
CGibVelocity gibVel(actor->vel.X >> 1, actor->vel.Y >> 1, velz);
|
||||
GibSprite(actor, GIBTYPE_27, &gibPos, &gibVel);
|
||||
}
|
||||
|
|
|
@ -269,31 +269,31 @@ int ChanceToCount(int a1, int a2)
|
|||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void GibFX(DBloodActor* actor, GIBFX* pGFX, CGibPosition* pPos, CGibVelocity* pVel)
|
||||
void GibFX(DBloodActor* actor, GIBFX* pGFX, DVector3* pPos, CGibVelocity* pVel)
|
||||
{
|
||||
auto pSector = actor->sector();
|
||||
if (adult_lockout && gGameOptions.nGameType == 0 && pGFX->fxId == FX_13)
|
||||
return;
|
||||
CGibPosition gPos(actor->int_pos().X, actor->int_pos().Y, actor->int_pos().Z);
|
||||
if (pPos)
|
||||
gPos = *pPos;
|
||||
|
||||
auto gPos = pPos? *pPos : actor->spr.pos;
|
||||
|
||||
int32_t ceilZ, floorZ;
|
||||
getzsofslopeptr(pSector, gPos.x, gPos.y, &ceilZ, &floorZ);
|
||||
getzsofslopeptr(pSector, gPos.XY(), &ceilZ, &floorZ);
|
||||
int nCount = ChanceToCount(pGFX->chance, pGFX->at9);
|
||||
int dz1 = floorZ - gPos.z;
|
||||
int dz2 = gPos.z - ceilZ;
|
||||
int top, bottom;
|
||||
int dz1 = floorZ - gPos.Z * worldtoint;
|
||||
int dz2 = gPos.Z * worldtoint - ceilZ;
|
||||
double top, bottom;
|
||||
GetActorExtents(actor, &top, &bottom);
|
||||
for (int i = 0; i < nCount; i++)
|
||||
{
|
||||
if (!pPos && (actor->spr.cstat & CSTAT_SPRITE_ALIGNMENT_MASK) == 0)
|
||||
{
|
||||
int nAngle = Random(2048);
|
||||
gPos.x = actor->int_pos().X + MulScale(actor->spr.clipdist << 2, Cos(nAngle), 30);
|
||||
gPos.y = actor->int_pos().Y + MulScale(actor->spr.clipdist << 2, Sin(nAngle), 30);
|
||||
gPos.z = bottom - Random(bottom - top);
|
||||
gPos.X = actor->spr.pos.X + MulScale(actor->spr.clipdist << 2, Cos(nAngle), 30) * inttoworld;
|
||||
gPos.Y = actor->spr.pos.Y + MulScale(actor->spr.clipdist << 2, Sin(nAngle), 30) * inttoworld;
|
||||
gPos.Z = bottom - Random(bottom - top);
|
||||
}
|
||||
auto pFX = gFX.fxSpawnActor(pGFX->fxId, pSector, gPos.x, gPos.y, gPos.z, 0);
|
||||
auto pFX = gFX.fxSpawnActor(pGFX->fxId, pSector, gPos, 0);
|
||||
if (pFX)
|
||||
{
|
||||
if (pGFX->at1 < 0)
|
||||
|
@ -342,7 +342,7 @@ void GibFX(DBloodActor* actor, GIBFX* pGFX, CGibPosition* pPos, CGibVelocity* pV
|
|||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void GibThing(DBloodActor* actor, GIBTHING* pGThing, CGibPosition* pPos, CGibVelocity* pVel)
|
||||
void GibThing(DBloodActor* actor, GIBTHING* pGThing, DVector3* pPos, CGibVelocity* pVel)
|
||||
{
|
||||
if (adult_lockout && gGameOptions.nGameType <= 0)
|
||||
switch (pGThing->type) {
|
||||
|
@ -366,9 +366,9 @@ void GibThing(DBloodActor* actor, GIBTHING* pGThing, CGibPosition* pPos, CGibVel
|
|||
}
|
||||
else
|
||||
{
|
||||
x = pPos->x;
|
||||
y = pPos->y;
|
||||
z = pPos->z;
|
||||
x = pPos->X * worldtoint;
|
||||
y = pPos->Y * worldtoint;
|
||||
z = pPos->Z * zworldtoint;
|
||||
}
|
||||
int32_t ceilZ, floorZ;
|
||||
getzsofslopeptr(pSector, x, y, &ceilZ, &floorZ);
|
||||
|
@ -419,7 +419,7 @@ void GibThing(DBloodActor* actor, GIBTHING* pGThing, CGibPosition* pPos, CGibVel
|
|||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void GibSprite(DBloodActor* actor, GIBTYPE nGibType, CGibPosition* pPos, CGibVelocity* pVel)
|
||||
void GibSprite(DBloodActor* actor, GIBTYPE nGibType, DVector3* pPos, CGibVelocity* pVel)
|
||||
{
|
||||
assert(actor != NULL);
|
||||
assert(nGibType >= 0 && nGibType < kGibMax);
|
||||
|
|
|
@ -59,11 +59,6 @@ enum GIBTYPE {
|
|||
kGibMax
|
||||
};
|
||||
|
||||
class CGibPosition {
|
||||
public:
|
||||
int x, y, z;
|
||||
CGibPosition(int _x, int _y, int _z) : x(_x), y(_y), z(_z) {}
|
||||
};
|
||||
|
||||
class CGibVelocity {
|
||||
public:
|
||||
|
@ -71,6 +66,6 @@ public:
|
|||
CGibVelocity(int _vx, int _vy, int _vz) : vx(_vx), vy(_vy), vz(_vz) {}
|
||||
};
|
||||
|
||||
void GibSprite(DBloodActor* pSprite, GIBTYPE nGibType, CGibPosition* pPos, CGibVelocity* pVel);
|
||||
void GibSprite(DBloodActor* pSprite, GIBTYPE nGibType, DVector3* pPos, CGibVelocity* pVel);
|
||||
void GibWall(walltype* pWall, GIBTYPE nGibType, CGibVelocity* pVel);
|
||||
END_BLD_NS
|
||||
|
|
|
@ -2170,9 +2170,9 @@ int playerDamageSprite(DBloodActor* source, PLAYER* pPlayer, DAMAGE_TYPE nDamage
|
|||
break;
|
||||
default:
|
||||
{
|
||||
int top, bottom;
|
||||
double top, bottom;
|
||||
GetActorExtents(pActor, &top, &bottom);
|
||||
CGibPosition gibPos(pActor->int_pos().X, pActor->int_pos().Y, top);
|
||||
DVector3 gibPos(pActor->spr.pos.XY(), top);
|
||||
CGibVelocity gibVel(pActor->vel.X >> 1, pActor->vel.Y >> 1, -0xccccc);
|
||||
GibSprite(pActor, GIBTYPE_27, &gibPos, &gibVel);
|
||||
GibSprite(pActor, GIBTYPE_7, NULL, NULL);
|
||||
|
|
Loading…
Reference in a new issue