- migrated Blood's portal links into sectortype.

This commit is contained in:
Christoph Oelckers 2021-11-20 18:42:19 +01:00
parent cc41f4e7c6
commit f7e61eeef7
6 changed files with 27 additions and 33 deletions

View file

@ -101,11 +101,10 @@ struct sectortype
struct // Blood
{
BLD_NS::XSECTOR* _xs;
uint8_t q_filler;
BLD_NS::DBloodActor* upperLink, *lowerLink;
int baseFloor, baseCeil;
int velFloor, velCeil;
BLD_NS::DBloodActor* upperLink;
BLD_NS::DBloodActor* lowerLink;
uint8_t q_filler;
};
struct // Exhumed
{
@ -121,16 +120,16 @@ struct sectortype
struct // SW
{
// No need to allocate this on demand as it is smaller than what Blood needs.
bool defined;
int dist, flags;
int depth_fixed;
short stag, // ST? tag number - for certain things it helps to know it
ang,
height,
speed,
damage,
number; // usually used for matching number
uint8_t flags2;
short stag; // ST? tag number - for certain things it helps to know it
short ang;
short height;
short speed;
short damage;
short number; // usually used for matching number
bool defined;
uint8_t flags2;
};

View file

@ -83,6 +83,7 @@ BEGIN_BLD_NS
FSerializer& Serialize(FSerializer& arc, const char* keyname, XWALL& w, XWALL* def);
FSerializer& Serialize(FSerializer& arc, const char* keyname, XSECTOR& w, XSECTOR* def);
FSerializer& Serialize(FSerializer& arc, const char* keyname, DBloodActor*& w, DBloodActor** def);
END_BLD_NS
@ -546,6 +547,9 @@ FSerializer &Serialize(FSerializer &arc, const char *key, sectortype &c, sectort
}
else if (isBlood())
{
arc("upperlink", c.upperLink, def->upperLink)
("lowerlink", c.lowerLink, def->lowerLink);
if (arc.isWriting())
{
if (c.hasX())

View file

@ -361,12 +361,14 @@ inline void GetActorExtents(DBloodActor* actor, int* top, int* bottom)
inline DBloodActor* getUpperLink(int sect)
{
return gUpperLink[sect];
auto pSect = &sector[sect];
return pSect->upperLink;
}
inline DBloodActor* getLowerLink(int sect)
{
return gLowerLink[sect];
auto pSect = &sector[sect];
return pSect->lowerLink;
}
inline void sfxPlay3DSound(DBloodActor* pSprite, int soundId, int a3 = -1, int a4 = 0)

View file

@ -38,8 +38,6 @@ int baseFloor[kMaxSectors];
int baseCeil[kMaxSectors];
int velFloor[kMaxSectors];
int velCeil[kMaxSectors];
DBloodActor* gUpperLink[kMaxSectors];
DBloodActor* gLowerLink[kMaxSectors];
HITINFO gHitInfo;
bool FindSector(int nX, int nY, int nZ, int *nSector)

View file

@ -47,8 +47,6 @@ extern int baseFloor[kMaxSectors];
extern int baseCeil[kMaxSectors];
extern int velFloor[kMaxSectors];
extern int velCeil[kMaxSectors];
extern DBloodActor* gUpperLink[kMaxSectors];
extern DBloodActor* gLowerLink[kMaxSectors];
extern HITINFO gHitInfo;
enum {

View file

@ -41,15 +41,15 @@ void validateLinks()
for (auto& sect : sectors())
{
if (getUpperLink(snum) && !getUpperLink(snum)->GetOwner())
if (sect.upperLink && !sect.upperLink->GetOwner())
{
Printf(PRINT_HIGH, "Unpartnered upper link in sector %d\n", snum);
gUpperLink[snum] = nullptr;
sect.upperLink = nullptr;
}
if (getLowerLink(snum) && !getLowerLink(snum)->GetOwner())
if (sect.upperLink && !sect.upperLink->GetOwner())
{
Printf(PRINT_HIGH, "Unpartnered upper link in sector %d\n", snum);
gLowerLink[snum] = nullptr;
Printf(PRINT_HIGH, "Unpartnered lower link in sector %d\n", snum);
sect.lowerLink = nullptr;
}
snum++;
}
@ -57,11 +57,6 @@ void validateLinks()
void warpInit(void)
{
for (int i = 0; i < kMaxSectors; i++)
{
gUpperLink[i] = nullptr;
gLowerLink[i] = nullptr;
}
#ifdef NOONE_EXTENSIONS
int team1 = 0; int team2 = 0; gTeamsSpawnUsed = false; // increment if team start positions specified.
#endif
@ -123,19 +118,19 @@ void warpInit(void)
}
break;
case kMarkerUpLink:
gUpperLink[pSprite->sectnum] = actor;
pSprite->sector()->upperLink = actor;
pSprite->cstat |= 32768;
pSprite->cstat &= ~257;
break;
case kMarkerLowLink:
gLowerLink[pSprite->sectnum] = actor;
pSprite->sector()->lowerLink = actor;
pSprite->cstat |= 32768;
pSprite->cstat &= ~257;
break;
case kMarkerUpWater:
case kMarkerUpStack:
case kMarkerUpGoo:
gUpperLink[pSprite->sectnum] = actor;
pSprite->sector()->upperLink = actor;
pSprite->cstat |= 32768;
pSprite->cstat &= ~257;
pSprite->z = getflorzofslope(pSprite->sectnum, pSprite->x, pSprite->y);
@ -143,7 +138,7 @@ void warpInit(void)
case kMarkerLowWater:
case kMarkerLowStack:
case kMarkerLowGoo:
gLowerLink[pSprite->sectnum] = actor;
pSprite->sector()->lowerLink = actor;
pSprite->cstat |= 32768;
pSprite->cstat &= ~257;
pSprite->z = getceilzofslope(pSprite->sectnum, pSprite->x, pSprite->y);
@ -337,8 +332,6 @@ void SerializeWarp(FSerializer& arc)
if (arc.BeginObject("warp"))
{
arc.Array("startzone", gStartZone, kMaxPlayers)
.Array("upperlink", gUpperLink, numsectors)
.Array("lowerlink", gLowerLink, numsectors)
.EndObject();
}
}