- the rest of Blood's flags.

This commit is contained in:
Christoph Oelckers 2021-12-18 20:07:47 +01:00
parent 092cb1e5a3
commit 13186cec6d
6 changed files with 29 additions and 21 deletions

View file

@ -148,8 +148,11 @@ enum ESpriteBits // names mostly from SW.
CSTAT_SPRITE_BREAKABLE = CSTAT_SPRITE_BLOCK_HITSCAN|CSTAT_SPRITE_BLOCK_MISSILE, CSTAT_SPRITE_BREAKABLE = CSTAT_SPRITE_BLOCK_HITSCAN|CSTAT_SPRITE_BLOCK_MISSILE,
// Blood flags // Blood flags
CSTAT_SPRITE_BLOOD_BIT2 = 1024, CSTAT_SPRITE_BLOOD_BIT2 = 1024, // Both of these get set but not checked directly, so no idea what they mean...
CSTAT_SPRITE_BLOOD_BIT1 = 4096, CSTAT_SPRITE_BLOOD_BIT1 = 4096,
CSTAT_SPRITE_MOVE_FORWARD = 8192,
CSTAT_SPRITE_MOVE_REVERSE = 16384,
CSTAT_SPRITE_MOVE_MASK = CSTAT_SPRITE_MOVE_FORWARD | CSTAT_SPRITE_MOVE_REVERSE,
}; };
typedef TFlags<ESpriteBits, uint16_t> ESpriteFlags; typedef TFlags<ESpriteBits, uint16_t> ESpriteFlags;

View file

@ -135,7 +135,7 @@ RORHACK:
ror_status[i] = testgotpic(4080 + i); ror_status[i] = testgotpic(4080 + i);
fixed_t deliriumPitchI = interpolatedvalue(IntToFixed(deliriumPitchO), IntToFixed(deliriumPitch), gInterpolate); fixed_t deliriumPitchI = interpolatedvalue(IntToFixed(deliriumPitchO), IntToFixed(deliriumPitch), gInterpolate);
DrawMirrors(cX, cY, cZ, cA.asq16(), cH.asq16() + deliriumPitchI, int(gInterpolate), gViewIndex); DrawMirrors(cX, cY, cZ, cA.asq16(), cH.asq16() + deliriumPitchI, int(gInterpolate), gViewIndex);
int bakCstat = gView->pSprite->cstat; auto bakCstat = gView->pSprite->cstat;
if (gViewPos == 0) if (gViewPos == 0)
{ {
gView->pSprite->cstat |= CSTAT_SPRITE_INVISIBLE; gView->pSprite->cstat |= CSTAT_SPRITE_INVISIBLE;
@ -257,10 +257,10 @@ void DrawMirrors(int x, int y, int z, fixed_t a, fixed_t horiz, int smooth, int
{ {
r_rorphase = 1; r_rorphase = 1;
int nSector = mirror[i].link; int nSector = mirror[i].link;
int bakCstat = 0; ESpriteFlags bakCstat = 0;
if (viewPlayer >= 0) if (viewPlayer >= 0)
{ {
bakCstat = gPlayer[viewPlayer].pSprite->cstat; bakCstat = ESpriteFlags::FromInt(gPlayer[viewPlayer].pSprite->cstat);
if (gViewPos == 0) if (gViewPos == 0)
{ {
gPlayer[viewPlayer].pSprite->cstat |= CSTAT_SPRITE_INVISIBLE; gPlayer[viewPlayer].pSprite->cstat |= CSTAT_SPRITE_INVISIBLE;
@ -289,10 +289,10 @@ void DrawMirrors(int x, int y, int z, fixed_t a, fixed_t horiz, int smooth, int
{ {
r_rorphase = 1; r_rorphase = 1;
int nSector = mirror[i].link; int nSector = mirror[i].link;
int bakCstat = 0; ESpriteFlags bakCstat = 0;
if (viewPlayer >= 0) if (viewPlayer >= 0)
{ {
bakCstat = gPlayer[viewPlayer].pSprite->cstat; bakCstat = ESpriteFlags::FromInt(gPlayer[viewPlayer].pSprite->cstat);
if (gViewPos == 0) if (gViewPos == 0)
{ {
gPlayer[viewPlayer].pSprite->cstat |= CSTAT_SPRITE_INVISIBLE; gPlayer[viewPlayer].pSprite->cstat |= CSTAT_SPRITE_INVISIBLE;

View file

@ -413,14 +413,14 @@ int VectorScan(DBloodActor *actor, int nOffset, int nZOffset, int dx, int dy, in
spritetype *pOther = &gHitInfo.actor()->s(); spritetype *pOther = &gHitInfo.actor()->s();
if ((pOther->flags & 8) && !(ac & 1)) if ((pOther->flags & 8) && !(ac & 1))
return 3; return 3;
if ((pOther->cstat & 0x30) != 0) if ((pOther->cstat & CSTAT_SPRITE_ALIGNMENT_MASK) != 0)
return 3; return 3;
int nPicnum = pOther->picnum; int nPicnum = pOther->picnum;
if (tileWidth(nPicnum) == 0 || tileHeight(nPicnum) == 0) if (tileWidth(nPicnum) == 0 || tileHeight(nPicnum) == 0)
return 3; return 3;
int height = (tileHeight(nPicnum)*pOther->yrepeat)<<2; int height = (tileHeight(nPicnum)*pOther->yrepeat)<<2;
int otherZ = pOther->z; int otherZ = pOther->z;
if (pOther->cstat & 0x80) if (pOther->cstat & CSTAT_SPRITE_YCENTER)
otherZ += height / 2; otherZ += height / 2;
int nOffset = tileTopOffset(nPicnum); int nOffset = tileTopOffset(nPicnum);
if (nOffset) if (nOffset)

View file

@ -706,13 +706,14 @@ void nnExtInitModernStuff(TArray<DBloodActor*>& actors)
pXSprite->targetX = pXSprite->targetY = pXSprite->targetZ = pXSprite->sysData2 = -1; pXSprite->targetX = pXSprite->targetY = pXSprite->targetZ = pXSprite->sysData2 = -1;
actor->SetTarget(nullptr); actor->SetTarget(nullptr);
ChangeActorStat(actor, kStatModernCondition); ChangeActorStat(actor, kStatModernCondition);
int oldStat = pSprite->cstat; pSprite->cstat = 0x30; auto oldStat = pSprite->cstat;
pSprite->cstat = CSTAT_SPRITE_ALIGNMENT_SLOPE;
if (oldStat & CSTAT_SPRITE_BLOCK) if (oldStat & CSTAT_SPRITE_BLOCK)
pSprite->cstat |= CSTAT_SPRITE_BLOCK; pSprite->cstat |= CSTAT_SPRITE_BLOCK;
if (oldStat & 0x2000) pSprite->cstat |= 0x2000; if (oldStat & CSTAT_SPRITE_MOVE_FORWARD) pSprite->cstat |= CSTAT_SPRITE_MOVE_FORWARD;
else if (oldStat & 0x4000) pSprite->cstat |= 0x4000; else if (oldStat & CSTAT_SPRITE_MOVE_REVERSE) pSprite->cstat |= CSTAT_SPRITE_MOVE_REVERSE;
pSprite->cstat |= CSTAT_SPRITE_INVISIBLE; pSprite->cstat |= CSTAT_SPRITE_INVISIBLE;
break; break;
@ -1869,7 +1870,7 @@ void debrisMove(int listIndex)
else if (floorColl.type == kHitSprite) else if (floorColl.type == kHitSprite)
{ {
if ((floorColl.actor()->s().cstat & 0x30) == 0) if ((floorColl.actor()->s().cstat & CSTAT_SPRITE_ALIGNMENT_MASK) == 0)
{ {
actor->xvel += MulScale(4, pSprite->x - floorColl.actor()->s().x, 2); actor->xvel += MulScale(4, pSprite->x - floorColl.actor()->s().x, 2);
actor->yvel += MulScale(4, pSprite->y - floorColl.actor()->s().y, 2); actor->yvel += MulScale(4, pSprite->y - floorColl.actor()->s().y, 2);
@ -2805,16 +2806,19 @@ void usePropertiesChanger(DBloodActor* sourceactor, int objType, sectortype* pSe
// data4 = sprite cstat // data4 = sprite cstat
if (valueIsBetween(pXSource->data4, -1, 65535)) if (valueIsBetween(pXSource->data4, -1, 65535))
{ {
old = pSprite->cstat; auto old = pSprite->cstat;
// set new cstat // set new cstat
if ((pSource->flags & kModernTypeFlag1)) pSprite->cstat |= pXSource->data4; // relative if ((pSource->flags & kModernTypeFlag1)) pSprite->cstat |= pXSource->data4; // relative
else pSprite->cstat = pXSource->data4 & 0xffff; // absolute else pSprite->cstat = pXSource->data4 & 0xffff; // absolute
// and handle exceptions // and handle exceptions
if ((old & 0x1000) && !(pSprite->cstat & 0x1000)) pSprite->cstat |= 0x1000; //kSpritePushable if ((old & CSTAT_SPRITE_BLOOD_BIT1)) pSprite->cstat |= CSTAT_SPRITE_BLOOD_BIT1; //kSpritePushable
if ((old & CSTAT_SPRITE_YCENTER) && !(pSprite->cstat & CSTAT_SPRITE_YCENTER)) pSprite->cstat |= CSTAT_SPRITE_YCENTER; if ((old & CSTAT_SPRITE_YCENTER)) pSprite->cstat |= CSTAT_SPRITE_YCENTER;
pSprite->cstat |= (old & CSTAT_SPRITE_MOVE_MASK);
#if 0
// looks very broken.
if (old & 0x6000) if (old & 0x6000)
{ {
if (!(pSprite->cstat & 0x6000)) if (!(pSprite->cstat & 0x6000))
@ -2824,6 +2828,7 @@ void usePropertiesChanger(DBloodActor* sourceactor, int objType, sectortype* pSe
else if ((old & 0x2000) && !(pSprite->cstat & 0x2000)) pSprite->cstat |= 0x2000; // kSpriteMoveForward, kSpriteMoveFloor else if ((old & 0x2000) && !(pSprite->cstat & 0x2000)) pSprite->cstat |= 0x2000; // kSpriteMoveForward, kSpriteMoveFloor
else if ((old & 0x4000) && !(pSprite->cstat & 0x4000)) pSprite->cstat |= 0x4000; // kSpriteMoveReverse, kSpriteMoveCeiling else if ((old & 0x4000) && !(pSprite->cstat & 0x4000)) pSprite->cstat |= 0x4000; // kSpriteMoveReverse, kSpriteMoveCeiling
} }
#endif
} }
} }
break; break;
@ -3241,8 +3246,8 @@ void useSectorWindGen(DBloodActor* sourceactor, sectortype* pSector)
pSource->ang = nnExtRandom(-kAng360, kAng360) & 2047; pSource->ang = nnExtRandom(-kAng360, kAng360) & 2047;
} }
} }
else if (pSource->cstat & 0x2000) pSource->ang += pXSource->data4; else if (pSource->cstat & CSTAT_SPRITE_MOVE_FORWARD) pSource->ang += pXSource->data4;
else if (pSource->cstat & 0x4000) pSource->ang -= pXSource->data4; else if (pSource->cstat & CSTAT_SPRITE_MOVE_REVERSE) pSource->ang -= pXSource->data4;
else if (pXSource->sysData1 == 0) else if (pXSource->sysData1 == 0)
{ {
if ((ang += pXSource->data4) >= kAng180) pXSource->sysData1 = 1; if ((ang += pXSource->data4) >= kAng180) pXSource->sysData1 = 1;
@ -3323,7 +3328,7 @@ void useSpriteDamager(DBloodActor* sourceactor, int objType, sectortype* targSec
GetActorExtents(sourceactor, &top, &bottom); GetActorExtents(sourceactor, &top, &bottom);
floor = (bottom >= pSector->floorz); floor = (bottom >= pSector->floorz);
ceil = (top <= pSector->ceilingz); ceil = (top <= pSector->ceilingz);
wall = (pSource->cstat & 0x10); wall = (pSource->cstat & CSTAT_SPRITE_ALIGNMENT_WALL);
enter = (!floor && !ceil && !wall); enter = (!floor && !ceil && !wall);
BloodSectIterator it(targSect); BloodSectIterator it(targSect);
while (auto iactor = it.Next()) while (auto iactor = it.Next())

View file

@ -684,7 +684,7 @@ void playerStart(int nPlayer, int bNewLevel)
pXSprite->burnTime = 0; pXSprite->burnTime = 0;
actor->SetBurnSource(nullptr); actor->SetBurnSource(nullptr);
pPlayer->pXSprite->health = pDudeInfo->startHealth<<4; pPlayer->pXSprite->health = pDudeInfo->startHealth<<4;
pPlayer->pSprite->cstat &= (unsigned short)~32768; pPlayer->pSprite->cstat &= ~CSTAT_SPRITE_INVISIBLE;
pPlayer->bloodlust = 0; pPlayer->bloodlust = 0;
pPlayer->horizon.horiz = pPlayer->horizon.horizoff = q16horiz(0); pPlayer->horizon.horiz = pPlayer->horizon.horizoff = q16horiz(0);
pPlayer->slope = 0; pPlayer->slope = 0;

View file

@ -170,7 +170,7 @@ void CalcOtherPosition(spritetype *pSprite, int *pX, int *pY, int *pZ, sectortyp
int vY = MulScale(-Sin(nAng), 1280, 30); int vY = MulScale(-Sin(nAng), 1280, 30);
int vZ = FixedToInt(MulScale(zm, 1280, 3))-(16<<8); int vZ = FixedToInt(MulScale(zm, 1280, 3))-(16<<8);
int bakCstat = pSprite->cstat; int bakCstat = pSprite->cstat;
pSprite->cstat &= ~256; pSprite->cstat &= ~CSTAT_SPRITE_BLOCK_HITSCAN;
assert(validSectorIndex(*vsectnum)); assert(validSectorIndex(*vsectnum));
FindSector(*pX, *pY, *pZ, vsectnum); FindSector(*pX, *pY, *pZ, vsectnum);
int nHSector; int nHSector;
@ -669,7 +669,7 @@ void viewDrawScreen(bool sceneonly)
if (testnewrenderer) if (testnewrenderer)
{ {
fixedhoriz deliriumPitchI = q16horiz(interpolatedvalue(IntToFixed(deliriumPitchO), IntToFixed(deliriumPitch), gInterpolate)); fixedhoriz deliriumPitchI = q16horiz(interpolatedvalue(IntToFixed(deliriumPitchO), IntToFixed(deliriumPitch), gInterpolate));
int bakCstat = gView->pSprite->cstat; auto bakCstat = gView->pSprite->cstat;
gView->pSprite->cstat |= (gViewPos == 0) ? CSTAT_SPRITE_INVISIBLE : CSTAT_SPRITE_TRANSLUCENT | CSTAT_SPRITE_TRANS_FLIP; gView->pSprite->cstat |= (gViewPos == 0) ? CSTAT_SPRITE_INVISIBLE : CSTAT_SPRITE_TRANSLUCENT | CSTAT_SPRITE_TRANS_FLIP;
render_drawrooms(gView->pSprite, { cX, cY, cZ }, sectnum(pSector), cA, cH + deliriumPitchI, rotscrnang, gInterpolate); render_drawrooms(gView->pSprite, { cX, cY, cZ }, sectnum(pSector), cA, cH + deliriumPitchI, rotscrnang, gInterpolate);
gView->pSprite->cstat = bakCstat; gView->pSprite->cstat = bakCstat;