- AddMovingSector/CheckPushBlock

This commit is contained in:
Christoph Oelckers 2021-11-23 00:03:18 +01:00
parent 63d66e95c5
commit 9b19845dfb
4 changed files with 20 additions and 22 deletions

View file

@ -227,7 +227,7 @@ inline DExhumedActor* insertActor(sectortype* s, int st)
}
DExhumedActor* GrabBody();
DExhumedActor* GrabBodyGunSprite();
void CreatePushBlock(int nSector);
void CreatePushBlock(sectortype* pSector);
void FuncCreatureChunk(int a, int, int nRun);
DExhumedActor* FindPlayer(DExhumedActor* nSprite, int nDistance, bool dontengage = false);
@ -286,15 +286,15 @@ void FuncTrap(int, int, int, int);
void FuncEnergyBlock(int, int, int, int);
void FuncSpark(int, int, int, int);
void SnapBobs(sectortype* nSectorA, sectortype* nSectorB);
DExhumedActor* FindWallSprites(int nSector);
void AddMovingSector(int nSector, int edx, int ebx, int ecx);
DExhumedActor* FindWallSprites(sectortype* nSector);
void AddMovingSector(sectortype* nSector, int edx, int ebx, int ecx);
void ProcessTrailSprite(DExhumedActor* nSprite, int nLotag, int nHitag);
void AddSectorBob(sectortype* nSector, int nHitag, int bx);
DExhumedActor* BuildObject(DExhumedActor* nSprite, int nOjectType, int nHitag);
int BuildArrow(DExhumedActor* nSprite, int nVal);
int BuildFireBall(DExhumedActor*, int a, int b);
void BuildDrip(DExhumedActor* nSprite);
DExhumedActor* BuildEnergyBlock(int nSector);
DExhumedActor* BuildEnergyBlock(sectortype* nSector);
int BuildElevC(int arg1, int nChannel, sectortype* nSector, DExhumedActor* nWallSprite, int arg5, int arg6, int nCount, ...);
int BuildElevF(int nChannel, sectortype* nSector, DExhumedActor* nWallSprite, int arg_4, int arg_5, int nCount, ...);
int BuildWallFace(int nChannel, walltype* pWall, int nCount, ...);

View file

@ -804,39 +804,38 @@ int GrabPushBlock()
return nPushBlocks++;
}
void CreatePushBlock(int nSector)
void CreatePushBlock(sectortype* pSector)
{
auto sectp = &sector[nSector];
int nBlock = GrabPushBlock();
int xSum = 0;
int ySum = 0;
for (auto& wal : wallsofsector(sectp))
for (auto& wal : wallsofsector(pSector))
{
xSum += wal.x;
ySum += wal.y;
}
int xAvg = xSum / sectp->wallnum;
int yAvg = ySum / sectp->wallnum;
int xAvg = xSum / pSector->wallnum;
int yAvg = ySum / pSector->wallnum;
sBlockInfo[nBlock].x = xAvg;
sBlockInfo[nBlock].y = yAvg;
auto pActor = insertActor(nSector, 0);
auto pActor = insertActor(pSector, 0);
auto pSprite = &pActor->s();
sBlockInfo[nBlock].pActor = pActor;
pSprite->x = xAvg;
pSprite->y = yAvg;
pSprite->z = sectp->floorz - 256;
pSprite->z = pSector->floorz - 256;
pSprite->cstat = 0x8000;
int var_28 = 0;
for (auto& wal : wallsofsector(sectp))
for (auto& wal : wallsofsector(pSector))
{
uint32_t xDiff = abs(xAvg - wal.x);
uint32_t yDiff = abs(yAvg - wal.y);
@ -858,7 +857,7 @@ void CreatePushBlock(int nSector)
sBlockInfo[nBlock].field_8 = var_28;
pSprite->clipdist = (var_28 & 0xFF) << 2;
sectp->extra = nBlock;
pSector->extra = nBlock;
}
void MoveSector(sectortype* pSector, int nAngle, int *nXVel, int *nYVel)

View file

@ -2298,10 +2298,9 @@ void ProcessTrailSprite(DExhumedActor* pActor, int nLotag, int nHitag)
}
// ok?
void AddMovingSector(int nSector, int edx, int ebx, int ecx)
void AddMovingSector(sectortype* pSector, int edx, int ebx, int ecx)
{
auto pSector = &sector[nSector];
CreatePushBlock(nSector);
CreatePushBlock(pSector);
setsectinterpolate(pSector);
int nTrail = FindTrail(ebx);

View file

@ -1168,37 +1168,37 @@ void runlist_ProcessSectorTag(sectortype* pSector, int nLotag, int nHitag)
case 40: // Moving sector(follows waypoints)
{
AddMovingSector(sectnum(pSector), nLotag, nHitag % 1000, 2);
AddMovingSector(pSector, nLotag, nHitag % 1000, 2);
return;
}
case 41: // Moving sector(follows waypoints)
{
AddMovingSector(sectnum(pSector), nLotag, nHitag % 1000, 18);
AddMovingSector(pSector, nLotag, nHitag % 1000, 18);
return;
}
case 42: // Moving sector(follows waypoints)
{
AddMovingSector(sectnum(pSector), nLotag, nHitag % 1000, 58);
AddMovingSector(pSector, nLotag, nHitag % 1000, 58);
return;
}
case 43: // Moving sector(follows waypoints)
{
AddMovingSector(sectnum(pSector), nLotag, nHitag % 1000, 122);
AddMovingSector(pSector, nLotag, nHitag % 1000, 122);
return;
}
case 44: // Moving sector(follows waypoints)
{
AddMovingSector(sectnum(pSector), nLotag, nHitag % 1000, 90);
AddMovingSector(pSector, nLotag, nHitag % 1000, 90);
return;
}
case 45: // Pushbox sector
{
CreatePushBlock(sectnum(pSector));
CreatePushBlock(pSector);
return;
}