- got rid of set_int_z in Blood.

This commit is contained in:
Christoph Oelckers 2022-09-14 00:42:59 +02:00
parent def2b9d483
commit 6310b06118
4 changed files with 32 additions and 23 deletions

View file

@ -120,7 +120,7 @@ static tspritetype* viewAddEffect(tspriteArray& tsprites, int nTSprite, VIEW_EFF
int perc = (100 * owneractor->xspr.data3) / kMaxPatrolSpotValue;
int width = (94 * owneractor->xspr.data3) / kMaxPatrolSpotValue;
int top, bottom;
double top, bottom;
GetSpriteExtents(pTSprite, &top, &bottom);
auto pNSprite2 = viewInsertTSprite(tsprites, pTSprite->sectp, 32767, pTSprite);
@ -135,7 +135,7 @@ static tspritetype* viewAddEffect(tspriteArray& tsprites, int nTSprite, VIEW_EFF
if (perc >= 75) pNSprite2->pal = 0;
else if (perc >= 50) pNSprite2->pal = 6;
pNSprite2->set_int_z(top - 2048);
pNSprite2->pos.Z = (top - 8);
pNSprite2->shade = -128;
break;
}
@ -168,7 +168,7 @@ static tspritetype* viewAddEffect(tspriteArray& tsprites, int nTSprite, VIEW_EFF
case kViewEffectFlag:
case kViewEffectBigFlag:
{
int top, bottom;
double top, bottom;
GetSpriteExtents(pTSprite, &top, &bottom);
auto pNSprite = viewInsertTSprite(tsprites, pTSprite->sectp, 32767, pTSprite);
if (!pNSprite)
@ -176,7 +176,7 @@ static tspritetype* viewAddEffect(tspriteArray& tsprites, int nTSprite, VIEW_EFF
pNSprite->shade = -128;
pNSprite->pal = 0;
pNSprite->set_int_z(top);
pNSprite->pos.Z = top;
if (nViewEffect == kViewEffectFlag)
pNSprite->xrepeat = pNSprite->yrepeat = 24;
else
@ -229,14 +229,14 @@ static tspritetype* viewAddEffect(tspriteArray& tsprites, int nTSprite, VIEW_EFF
if (!pNSprite)
break;
int top, bottom;
double top, bottom;
GetSpriteExtents(pTSprite, &top, &bottom);
pNSprite->pos.Z = top;
pNSprite->shade = 26;
pNSprite->pal = 0;
pNSprite->cstat |= CSTAT_SPRITE_TRANSLUCENT;
pNSprite->xrepeat = pNSprite->yrepeat = 24;
pNSprite->picnum = 626;
pNSprite->set_int_z(top);
break;
}
case kViewEffectTrail:
@ -296,9 +296,9 @@ static tspritetype* viewAddEffect(tspriteArray& tsprites, int nTSprite, VIEW_EFF
if (!pNSprite)
break;
int top, bottom;
double top, bottom;
GetSpriteExtents(pTSprite, &top, &bottom);
pNSprite->set_int_z(top);
pNSprite->pos.Z = top;
if (IsDudeSprite(pTSprite))
pNSprite->picnum = 672;
else
@ -315,9 +315,9 @@ static tspritetype* viewAddEffect(tspriteArray& tsprites, int nTSprite, VIEW_EFF
if (!pNSprite)
break;
int top, bottom;
double top, bottom;
GetSpriteExtents(pTSprite, &top, &bottom);
pNSprite->set_int_z(bottom);
pNSprite->pos.Z = bottom;
if (pTSprite->type >= kDudeBase && pTSprite->type < kDudeMax)
pNSprite->picnum = 672;
else
@ -334,9 +334,9 @@ static tspritetype* viewAddEffect(tspriteArray& tsprites, int nTSprite, VIEW_EFF
if (!pNSprite)
break;
int top, bottom;
double top, bottom;
GetSpriteExtents(pTSprite, &top, &bottom);
pNSprite->set_int_z(top);
pNSprite->pos.Z = top;
pNSprite->picnum = 2101;
pNSprite->shade = -128;
pNSprite->xrepeat = pNSprite->yrepeat = (tileWidth(pTSprite->picnum) * pTSprite->xrepeat) / 32;
@ -348,9 +348,9 @@ static tspritetype* viewAddEffect(tspriteArray& tsprites, int nTSprite, VIEW_EFF
if (!pNSprite)
break;
int top, bottom;
double top, bottom;
GetSpriteExtents(pTSprite, &top, &bottom);
pNSprite->set_int_z(bottom);
pNSprite->pos.Z = bottom;
pNSprite->picnum = 2101;
pNSprite->shade = -128;
pNSprite->xrepeat = pNSprite->yrepeat = (tileWidth(pTSprite->picnum) * pTSprite->xrepeat) / 32;
@ -361,7 +361,7 @@ static tspritetype* viewAddEffect(tspriteArray& tsprites, int nTSprite, VIEW_EFF
auto pNSprite = viewInsertTSprite(tsprites, pTSprite->sectp, 32767, pTSprite);
if (!pNSprite)
break;
pNSprite->set_int_z(getflorzofslopeptr(pTSprite->sectp, pNSprite->int_pos().X, pNSprite->int_pos().Y));
pNSprite->pos.Z = getflorzofslopeptrf(pTSprite->sectp, pNSprite->pos);
if ((pNSprite->sectp->floorpicnum >= 4080) && (pNSprite->sectp->floorpicnum <= 4095) && !VanillaMode()) // if floor has ror, find actual floor
{
DVector3 cPos = pNSprite->pos;

View file

@ -92,6 +92,14 @@ void GetSpriteExtents(spritetypebase const* const pSprite, int* top, int* bottom
}
}
inline void GetSpriteExtents(spritetypebase const* const actor, double* top, double* bottom)
{
int t, b;
GetSpriteExtents(actor, &t, &b);
*top = t * zinttoworld;
*bottom = b * zinttoworld;
}
struct BloodSpawnSpriteDef : public SpawnSpriteDef
{
TArray<XSPRITE> xspr;

View file

@ -3191,9 +3191,9 @@ void useTeleportTarget(DBloodActor* sourceactor, DBloodActor* actor)
ChangeActorSect(actor, sourceactor->sector());
actor->spr.pos.XY() =sourceactor->spr.pos.XY();
int zTop, zBot;
double zTop, zBot;
GetActorExtents(sourceactor, &zTop, &zBot);
actor->set_int_z(zBot);
actor->spr.pos.Z = zBot;
clampSprite(actor, 0x01);
@ -6689,22 +6689,23 @@ void useIncDecGen(DBloodActor* sourceactor, int objType, sectortype* destSect, w
void sprite2sectorSlope(DBloodActor* actor, sectortype* pSector, int rel, bool forcez)
{
int slope = 0, z = 0;
int slope = 0;
double z = 0;
switch (rel) {
default:
z = getflorzofslopeptr(actor->sector(), actor->spr.pos);
z = getflorzofslopeptrf(actor->sector(), actor->spr.pos);
if ((actor->spr.cstat & CSTAT_SPRITE_ALIGNMENT_FLOOR) && actor->hasX() && actor->xspr.Touch) z--;
slope = pSector->floorheinum;
break;
case 1:
z = getceilzofslopeptr(actor->sector(), actor->spr.pos);
z = getceilzofslopeptrf(actor->sector(), actor->spr.pos);
if ((actor->spr.cstat & CSTAT_SPRITE_ALIGNMENT_FLOOR) && actor->hasX() && actor->xspr.Touch) z++;
slope = pSector->ceilingheinum;
break;
}
spriteSetSlope(actor, slope);
if (forcez) actor->set_int_z(z);
if (forcez) actor->spr.pos.Z = z;
}
//---------------------------------------------------------------------------

View file

@ -139,7 +139,7 @@ void warpInit(TArray<DBloodActor*>& actors)
actor->sector()->upperLink = actor;
actor->spr.cstat |= CSTAT_SPRITE_INVISIBLE;
actor->spr.cstat &= ~CSTAT_SPRITE_BLOCK_ALL;
actor->set_int_z(getflorzofslopeptr(actor->sector(), actor->spr.pos));
actor->spr.pos.Z = getflorzofslopeptrf(actor->sector(), actor->spr.pos);
break;
case kMarkerLowWater:
case kMarkerLowStack:
@ -147,7 +147,7 @@ void warpInit(TArray<DBloodActor*>& actors)
actor->sector()->lowerLink = actor;
actor->spr.cstat |= CSTAT_SPRITE_INVISIBLE;
actor->spr.cstat &= ~CSTAT_SPRITE_BLOCK_ALL;
actor->set_int_z(getceilzofslopeptr(actor->sector(), actor->spr.pos));
actor->spr.pos.Z = getceilzofslopeptrf(actor->sector(), actor->spr.pos);
break;
}
}