- 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* GrabBody();
DExhumedActor* GrabBodyGunSprite(); DExhumedActor* GrabBodyGunSprite();
void CreatePushBlock(int nSector); void CreatePushBlock(sectortype* pSector);
void FuncCreatureChunk(int a, int, int nRun); void FuncCreatureChunk(int a, int, int nRun);
DExhumedActor* FindPlayer(DExhumedActor* nSprite, int nDistance, bool dontengage = false); 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 FuncEnergyBlock(int, int, int, int);
void FuncSpark(int, int, int, int); void FuncSpark(int, int, int, int);
void SnapBobs(sectortype* nSectorA, sectortype* nSectorB); void SnapBobs(sectortype* nSectorA, sectortype* nSectorB);
DExhumedActor* FindWallSprites(int nSector); DExhumedActor* FindWallSprites(sectortype* nSector);
void AddMovingSector(int nSector, int edx, int ebx, int ecx); void AddMovingSector(sectortype* nSector, int edx, int ebx, int ecx);
void ProcessTrailSprite(DExhumedActor* nSprite, int nLotag, int nHitag); void ProcessTrailSprite(DExhumedActor* nSprite, int nLotag, int nHitag);
void AddSectorBob(sectortype* nSector, int nHitag, int bx); void AddSectorBob(sectortype* nSector, int nHitag, int bx);
DExhumedActor* BuildObject(DExhumedActor* nSprite, int nOjectType, int nHitag); DExhumedActor* BuildObject(DExhumedActor* nSprite, int nOjectType, int nHitag);
int BuildArrow(DExhumedActor* nSprite, int nVal); int BuildArrow(DExhumedActor* nSprite, int nVal);
int BuildFireBall(DExhumedActor*, int a, int b); int BuildFireBall(DExhumedActor*, int a, int b);
void BuildDrip(DExhumedActor* nSprite); 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 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 BuildElevF(int nChannel, sectortype* nSector, DExhumedActor* nWallSprite, int arg_4, int arg_5, int nCount, ...);
int BuildWallFace(int nChannel, walltype* pWall, int nCount, ...); int BuildWallFace(int nChannel, walltype* pWall, int nCount, ...);

View file

@ -804,39 +804,38 @@ int GrabPushBlock()
return nPushBlocks++; return nPushBlocks++;
} }
void CreatePushBlock(int nSector) void CreatePushBlock(sectortype* pSector)
{ {
auto sectp = &sector[nSector];
int nBlock = GrabPushBlock(); int nBlock = GrabPushBlock();
int xSum = 0; int xSum = 0;
int ySum = 0; int ySum = 0;
for (auto& wal : wallsofsector(sectp)) for (auto& wal : wallsofsector(pSector))
{ {
xSum += wal.x; xSum += wal.x;
ySum += wal.y; ySum += wal.y;
} }
int xAvg = xSum / sectp->wallnum; int xAvg = xSum / pSector->wallnum;
int yAvg = ySum / sectp->wallnum; int yAvg = ySum / pSector->wallnum;
sBlockInfo[nBlock].x = xAvg; sBlockInfo[nBlock].x = xAvg;
sBlockInfo[nBlock].y = yAvg; sBlockInfo[nBlock].y = yAvg;
auto pActor = insertActor(nSector, 0); auto pActor = insertActor(pSector, 0);
auto pSprite = &pActor->s(); auto pSprite = &pActor->s();
sBlockInfo[nBlock].pActor = pActor; sBlockInfo[nBlock].pActor = pActor;
pSprite->x = xAvg; pSprite->x = xAvg;
pSprite->y = yAvg; pSprite->y = yAvg;
pSprite->z = sectp->floorz - 256; pSprite->z = pSector->floorz - 256;
pSprite->cstat = 0x8000; pSprite->cstat = 0x8000;
int var_28 = 0; int var_28 = 0;
for (auto& wal : wallsofsector(sectp)) for (auto& wal : wallsofsector(pSector))
{ {
uint32_t xDiff = abs(xAvg - wal.x); uint32_t xDiff = abs(xAvg - wal.x);
uint32_t yDiff = abs(yAvg - wal.y); uint32_t yDiff = abs(yAvg - wal.y);
@ -858,7 +857,7 @@ void CreatePushBlock(int nSector)
sBlockInfo[nBlock].field_8 = var_28; sBlockInfo[nBlock].field_8 = var_28;
pSprite->clipdist = (var_28 & 0xFF) << 2; pSprite->clipdist = (var_28 & 0xFF) << 2;
sectp->extra = nBlock; pSector->extra = nBlock;
} }
void MoveSector(sectortype* pSector, int nAngle, int *nXVel, int *nYVel) 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? // 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(pSector);
CreatePushBlock(nSector);
setsectinterpolate(pSector); setsectinterpolate(pSector);
int nTrail = FindTrail(ebx); 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) case 40: // Moving sector(follows waypoints)
{ {
AddMovingSector(sectnum(pSector), nLotag, nHitag % 1000, 2); AddMovingSector(pSector, nLotag, nHitag % 1000, 2);
return; return;
} }
case 41: // Moving sector(follows waypoints) case 41: // Moving sector(follows waypoints)
{ {
AddMovingSector(sectnum(pSector), nLotag, nHitag % 1000, 18); AddMovingSector(pSector, nLotag, nHitag % 1000, 18);
return; return;
} }
case 42: // Moving sector(follows waypoints) case 42: // Moving sector(follows waypoints)
{ {
AddMovingSector(sectnum(pSector), nLotag, nHitag % 1000, 58); AddMovingSector(pSector, nLotag, nHitag % 1000, 58);
return; return;
} }
case 43: // Moving sector(follows waypoints) case 43: // Moving sector(follows waypoints)
{ {
AddMovingSector(sectnum(pSector), nLotag, nHitag % 1000, 122); AddMovingSector(pSector, nLotag, nHitag % 1000, 122);
return; return;
} }
case 44: // Moving sector(follows waypoints) case 44: // Moving sector(follows waypoints)
{ {
AddMovingSector(sectnum(pSector), nLotag, nHitag % 1000, 90); AddMovingSector(pSector, nLotag, nHitag % 1000, 90);
return; return;
} }
case 45: // Pushbox sector case 45: // Pushbox sector
{ {
CreatePushBlock(sectnum(pSector)); CreatePushBlock(pSector);
return; return;
} }