- migrated Blood's other non-X sector properties.

This commit is contained in:
Christoph Oelckers 2021-11-20 19:10:02 +01:00
parent f7e61eeef7
commit 993821b75f
12 changed files with 42 additions and 47 deletions

View file

@ -91,6 +91,7 @@ struct sectortype
int numsections;
int* sections;
// Game specific extensions. Due to how sectors are used they need to be defined in the global class. :(
union
{
struct // DukeRR
@ -104,7 +105,7 @@ struct sectortype
BLD_NS::DBloodActor* upperLink, *lowerLink;
int baseFloor, baseCeil;
int velFloor, velCeil;
uint8_t q_filler;
uint8_t slopewallofs;
};
struct // Exhumed
{

View file

@ -548,7 +548,12 @@ FSerializer &Serialize(FSerializer &arc, const char *key, sectortype &c, sectort
else if (isBlood())
{
arc("upperlink", c.upperLink, def->upperLink)
("lowerlink", c.lowerLink, def->lowerLink);
("lowerlink", c.lowerLink, def->lowerLink)
("basefloor", c.baseFloor, def->baseFloor)
("baseCeil", c.baseCeil, def->baseCeil)
("velfloor", c.velFloor, def->velFloor)
("velCeil", c.velCeil, def->velCeil)
("slopwwallofs", c.slopewallofs, def->slopewallofs);
if (arc.isWriting())
{

View file

@ -4693,7 +4693,7 @@ static Collision MoveThing(DBloodActor* actor)
actor->hit.florhit = floorColl;
pSprite->z += floorZ - bottom;
int v20 = actor->zvel - velFloor[pSprite->sectnum];
int v20 = actor->zvel - pSprite->sector()->velFloor;
if (v20 > 0)
{
@ -4703,7 +4703,7 @@ static Collision MoveThing(DBloodActor* actor)
if (nDamage > 0) actDamageSprite(actor, actor, kDamageFall, nDamage);
actor->zvel = v20;
if (velFloor[pSprite->sectnum] == 0 && abs(actor->zvel) < 0x10000)
if (pSprite->sector()->velFloor == 0 && abs(actor->zvel) < 0x10000)
{
actor->zvel = 0;
pSprite->flags &= ~4;
@ -5188,7 +5188,7 @@ void MoveDude(DBloodActor* actor)
{
actor->hit.florhit = floorColl;
pSprite->z += floorZ - bottom;
int v30 = actor->zvel - velFloor[pSprite->sectnum];
int v30 = actor->zvel - pSprite->sector()->velFloor;
if (v30 > 0)
{
int vax = actFloorBounceVector((int*)&actor->xvel, (int*)&actor->yvel, (int*)&v30, pSprite->sectnum, 0);
@ -5208,7 +5208,7 @@ void MoveDude(DBloodActor* actor)
actor->zvel = v30;
if (abs(actor->zvel) < 0x10000)
{
actor->zvel = velFloor[pSprite->sectnum];
actor->zvel = pSprite->sector()->velFloor;
pSprite->flags &= ~4;
}
else
@ -5794,7 +5794,7 @@ static void actCheckThings()
actAirDrag(actor, 128);
if (((actor->GetIndex() >> 8) & 15) == (gFrameCount & 15) && (pSprite->flags & 2)) pSprite->flags |= 4;
if ((pSprite->flags & 4) || actor->xvel || actor->yvel || actor->zvel || velFloor[pSprite->sectnum] || velCeil[pSprite->sectnum])
if ((pSprite->flags & 4) || actor->xvel || actor->yvel || actor->zvel || pSprite->sector()->velFloor || pSprite->sector()->velCeil)
{
Collision hit = MoveThing(actor);
if (hit.type)
@ -6245,7 +6245,7 @@ static void actCheckDudes()
if (pXSector && pXSector->Underwater) actAirDrag(actor, 5376);
else actAirDrag(actor, 128);
if ((pSprite->flags & 4) || actor->xvel || actor->yvel || actor->zvel || velFloor[pSprite->sectnum] || velCeil[pSprite->sectnum])
if ((pSprite->flags & 4) || actor->xvel || actor->yvel || actor->zvel || pSprite->sector()->velFloor || pSprite->sector()->velCeil)
MoveDude(actor);
}
}

View file

@ -445,13 +445,13 @@ void fxBouncingSleeve(DBloodActor* actor, int) // 16
int top, bottom; GetSpriteExtents(pSprite, &top, &bottom);
pSprite->z += floorZ - bottom;
int zv = actor->zvel - velFloor[pSprite->sectnum];
int zv = actor->zvel - pSprite->sector()->velFloor;
if (actor->zvel == 0) sleeveStopBouncing(actor);
else if (zv > 0) {
actFloorBounceVector((int*)& actor->xvel, (int*)& actor->yvel, &zv, pSprite->sectnum, 0x9000);
actor->zvel = zv;
if (velFloor[pSprite->sectnum] == 0 && abs(actor->zvel) < 0x20000) {
if (pSprite->sector()->velFloor == 0 && abs(actor->zvel) < 0x20000) {
sleeveStopBouncing(actor);
return;
}

View file

@ -49,8 +49,6 @@ int XSectorsUsed;
uint8_t qsector_filler[kMaxSectors];
int gVisibility;
void dbCrypt(char *pPtr, int nLength, int nKey)
@ -570,7 +568,7 @@ void dbLoadMap(const char* pPath, int* pX, int* pY, int* pZ, short* pAngle, int*
pSector->floorxpan_ = load.floorxpanning;
pSector->floorypan_ = load.floorypanning;
pSector->visibility = load.visibility;
qsector_filler[i] = load.fogpal;
pSector->slopewallofs = load.fogpal;
pSector->dirty = 255;
pSector->exflags = 0;
pSector->fogpal = 0;

View file

@ -87,8 +87,6 @@ extern MAPHEADER2 byte_19AE44;
extern XSECTOR xsector[kMaxXSectors];
extern uint8_t qsector_filler[kMaxSectors];
extern int gVisibility;
extern int gMapRev, gMattId, gSkyCount;
extern const char *gItemText[];

View file

@ -34,10 +34,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
BEGIN_BLD_NS
POINT2D baseWall[kMaxWalls];
int baseFloor[kMaxSectors];
int baseCeil[kMaxSectors];
int velFloor[kMaxSectors];
int velCeil[kMaxSectors];
HITINFO gHitInfo;
bool FindSector(int nX, int nY, int nZ, int *nSector)

View file

@ -43,10 +43,6 @@ struct HITINFO {
};
extern POINT2D baseWall[kMaxWalls];
extern int baseFloor[kMaxSectors];
extern int baseCeil[kMaxSectors];
extern int velFloor[kMaxSectors];
extern int velCeil[kMaxSectors];
extern HITINFO gHitInfo;
enum {

View file

@ -707,15 +707,10 @@ void SerializeState(FSerializer& arc)
{
psky_t* pSky = tileSetupSky(DEFAULTPSKY);
arc.Array("sector_filler", qsector_filler, numsectors)
("visibility", gVisibility)
arc("visibility", gVisibility)
("frameclock", PlayClock)
("framecount", gFrameCount)
.Array("basewall", baseWall, numwalls)
.Array("basefloor", baseFloor, numsectors)
.Array("baseceil", baseCeil, numsectors)
.Array("velfloor", velFloor, numsectors)
.Array("velceil", velCeil, numsectors)
("hitinfo", gHitInfo)
.Array("statcount", gStatCount, kMaxStatus + 1)
("xsectorsused", XSectorsUsed)

View file

@ -1388,7 +1388,7 @@ void nnExtProcessSuperSprites()
}
if (pXDebris->physAttr & kPhysGravity) pXDebris->physAttr |= kPhysFalling;
if ((pXDebris->physAttr & kPhysFalling) || debrisactor->xvel || debrisactor->yvel || debrisactor->zvel || velFloor[pDebris->sectnum] || velCeil[pDebris->sectnum])
if ((pXDebris->physAttr & kPhysFalling) || debrisactor->xvel || debrisactor->yvel || debrisactor->zvel || pDebris->sector()->velFloor || pDebris->sector()->velCeil)
debrisMove(i);
if (debrisactor->xvel || debrisactor->yvel)
@ -1829,7 +1829,7 @@ void debrisMove(int listIndex)
if (floorZ <= bottom) {
actor->hit.florhit = floorColl;
int v30 = actor->zvel - velFloor[pSprite->sectnum];
int v30 = actor->zvel - pSprite->sector()->velFloor;
if (v30 > 0)
{
@ -1839,7 +1839,7 @@ void debrisMove(int listIndex)
if (abs(actor->zvel) < 0x10000)
{
actor->zvel = velFloor[pSprite->sectnum];
actor->zvel = pSprite->sector()->velFloor;
pXSprite->physAttr &= ~kPhysFalling;
}

View file

@ -502,14 +502,14 @@ static void fakeMoveDude(spritetype *pSprite)
{
predict.at75.florhit = floorColl;
predict.z += floorZ-bottom;
int var44 = predict.zvel-velFloor[predict.sectnum];
int var44 = predict.zvel-predict.sector()->velFloor;
if (var44 > 0)
{
actFloorBounceVector(&predict.xvel, &predict.yvel, &var44, predict.sectnum, 0);
predict.zvel = var44;
if (abs(predict.zvel) < 0x10000)
{
predict.zvel = velFloor[predict.sectnum];
predict.zvel = predict.sector()->velFloor;
predict.at73 &= ~4;
}
else
@ -566,6 +566,7 @@ static void fakeMoveDude(spritetype *pSprite)
static void fakeActAirDrag(spritetype *, int num)
{
#if 0
int xvec = 0;
int yvec = 0;
assert(validSectorIndex(predict.sectnum));
@ -585,10 +586,12 @@ static void fakeActAirDrag(spritetype *, int num)
predict.xvel += MulScale(xvec-predict.xvel, num, 16);
predict.yvel += MulScale(yvec-predict.yvel, num, 16);
predict.zvel -= MulScale(predict.zvel, num, 16);
#endif
}
void fakeActProcessSprites(void)
{
#if 0
spritetype *pSprite = gMe->pSprite;
if (pSprite->statnum == kStatDude)
{
@ -622,11 +625,12 @@ void fakeActProcessSprites(void)
else
fakeActAirDrag(pSprite, 128);
if ((predict.at73 & 4) != 0 || predict.xvel != 0 || predict.yvel != 0 || predict.zvel != 0 || velFloor[predict.sectnum] != 0 || velCeil[predict.sectnum] != 0)
if ((predict.at73 & 4) != 0 || predict.xvel != 0 || predict.yvel != 0 || predict.zvel != 0 || predict.sector()->velFloor != 0 || predict.sector()->velCeil != 0)
{
fakeMoveDude(pSprite);
}
}
#endif
}
void viewCorrectPrediction(void)

View file

@ -935,8 +935,8 @@ void ZTranslateSector(int nSector, XSECTOR *pXSector, int a3, int a4)
if (dz != 0)
{
int oldZ = pSector->floorz;
baseFloor[nSector] = pSector->floorz = pXSector->offFloorZ + MulScale(dz, GetWaveValue(a3, a4), 16);
velFloor[nSector] += (pSector->floorz-oldZ)<<8;
pSector->baseFloor = pSector->floorz = pXSector->offFloorZ + MulScale(dz, GetWaveValue(a3, a4), 16);
pSector->velFloor += (pSector->floorz-oldZ)<<8;
BloodSectIterator it(nSector);
while (auto actor = it.Next())
@ -964,8 +964,8 @@ void ZTranslateSector(int nSector, XSECTOR *pXSector, int a3, int a4)
if (dz != 0)
{
int oldZ = pSector->ceilingz;
baseCeil[nSector] = pSector->ceilingz = pXSector->offCeilZ + MulScale(dz, GetWaveValue(a3, a4), 16);
velCeil[nSector] += (pSector->ceilingz-oldZ)<<8;
pSector->baseCeil = pSector->ceilingz = pXSector->offCeilZ + MulScale(dz, GetWaveValue(a3, a4), 16);
pSector->velCeil += (pSector->ceilingz-oldZ)<<8;
BloodSectIterator it(nSector);
while (auto actor = it.Next())
@ -1878,7 +1878,7 @@ void ProcessMotion(void)
{
int floorZ = pSector->floorz;
viewInterpolateSector(nSector, pSector);
pSector->floorz = baseFloor[nSector]+vdi;
pSector->floorz = pSector->baseFloor + vdi;
BloodSectIterator it(nSector);
while (auto actor = it.Next())
@ -1902,7 +1902,7 @@ void ProcessMotion(void)
{
int ceilZ = pSector->ceilingz;
viewInterpolateSector(nSector, pSector);
pSector->ceilingz = baseCeil[nSector]+vdi;
pSector->ceilingz = pSector->baseCeil + vdi;
BloodSectIterator it(nSector);
while (auto actor = it.Next())
@ -1927,9 +1927,9 @@ void AlignSlopes(void)
int nSector;
for (pSector = &sector[0], nSector = 0; nSector < numsectors; nSector++, pSector++)
{
if (qsector_filler[nSector])
if (pSector->slopewallofs)
{
walltype *pWall = &wall[pSector->wallptr+qsector_filler[nSector]];
walltype *pWall = &wall[pSector->wallptr+pSector->slopewallofs];
walltype *pWall2 = &wall[pWall->point2];
int nNextSector = pWall->nextsector;
if (nNextSector >= 0)
@ -1958,8 +1958,10 @@ int(*gBusyProc[])(unsigned int, unsigned int) =
void trProcessBusy(void)
{
memset(velFloor, 0, sizeof(velFloor));
memset(velCeil, 0, sizeof(velCeil));
for (auto& sect : sectors())
{
sect.velCeil = sect.velFloor = 0;
}
for (int i = gBusyCount-1; i >= 0; i--)
{
int nStatus;
@ -2021,8 +2023,8 @@ void trInit(void)
for (int i = 0; i < numsectors; i++)
{
sectortype *pSector = &sector[i];
baseFloor[i] = pSector->floorz;
baseCeil[i] = pSector->ceilingz;
pSector->baseFloor = pSector->floorz;
pSector->baseCeil = pSector->ceilingz;
if (pSector->hasX())
{
XSECTOR *pXSector = &pSector->xs();