mirror of
https://github.com/ZDoom/Raze.git
synced 2024-11-16 01:11:44 +00:00
- Exhumed: floatified most of CreatePushBlock
This commit is contained in:
parent
32dab95c8d
commit
70d0b2ea93
1 changed files with 17 additions and 24 deletions
|
@ -775,52 +775,45 @@ void CreatePushBlock(sectortype* pSector)
|
||||||
{
|
{
|
||||||
int nBlock = GrabPushBlock();
|
int nBlock = GrabPushBlock();
|
||||||
|
|
||||||
int xSum = 0;
|
double xSumm = 0;
|
||||||
int ySum = 0;
|
double ySumm = 0;
|
||||||
|
|
||||||
for (auto& wal : wallsofsector(pSector))
|
for (auto& wal : wallsofsector(pSector))
|
||||||
{
|
{
|
||||||
xSum += wal.wall_int_pos().X;
|
xSumm += wal.pos.X;
|
||||||
ySum += wal.wall_int_pos().Y;
|
ySumm += wal.pos.Y;
|
||||||
}
|
}
|
||||||
|
|
||||||
int xAvg = xSum / pSector->wallnum;
|
double xAvgg = xSumm / pSector->wallnum;
|
||||||
int yAvg = ySum / pSector->wallnum;
|
double yAvgg = ySumm / pSector->wallnum;
|
||||||
|
|
||||||
sBlockInfo[nBlock].x = xAvg;
|
sBlockInfo[nBlock].x = xAvgg * worldtoint;
|
||||||
sBlockInfo[nBlock].y = yAvg;
|
sBlockInfo[nBlock].y = yAvgg * worldtoint;
|
||||||
|
|
||||||
auto pActor = insertActor(pSector, 0);
|
auto pActor = insertActor(pSector, 0);
|
||||||
|
|
||||||
sBlockInfo[nBlock].pActor = pActor;
|
sBlockInfo[nBlock].pActor = pActor;
|
||||||
|
|
||||||
pActor->set_int_pos({ xAvg, yAvg, pSector->int_floorz() - 256 });
|
pActor->spr.pos = { xAvgg, yAvgg, pSector->floorz- 1 };
|
||||||
pActor->spr.cstat = CSTAT_SPRITE_INVISIBLE;
|
pActor->spr.cstat = CSTAT_SPRITE_INVISIBLE;
|
||||||
|
|
||||||
int var_28 = 0;
|
double mindist = 0;
|
||||||
|
|
||||||
for (auto& wal : wallsofsector(pSector))
|
for (auto& wal : wallsofsector(pSector))
|
||||||
{
|
{
|
||||||
uint32_t xDiff = abs(xAvg - wal.wall_int_pos().X);
|
double xDiff = abs(xAvgg - wal.pos.X);
|
||||||
uint32_t yDiff = abs(yAvg - wal.wall_int_pos().Y);
|
double yDiff = abs(yAvgg - wal.pos.Y);
|
||||||
|
|
||||||
uint32_t sqrtNum = xDiff * xDiff + yDiff * yDiff;
|
double nSqrt = g_sqrt(xDiff * xDiff + yDiff * yDiff);
|
||||||
|
|
||||||
if (sqrtNum > INT_MAX)
|
if (nSqrt > mindist) {
|
||||||
{
|
mindist = nSqrt;
|
||||||
DPrintf(DMSG_WARNING, "%s %d: overflow\n", __func__, __LINE__);
|
|
||||||
sqrtNum = INT_MAX;
|
|
||||||
}
|
|
||||||
|
|
||||||
int nSqrt = ksqrt(sqrtNum);
|
|
||||||
if (nSqrt > var_28) {
|
|
||||||
var_28 = nSqrt;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
sBlockInfo[nBlock].field_8 = var_28;
|
sBlockInfo[nBlock].field_8 = mindist * worldtoint;
|
||||||
|
|
||||||
pActor->spr.clipdist = (var_28 & 0xFF) << 2;
|
pActor->spr.clipdist = (int(mindist * worldtoint) & 0xFF) << 2;
|
||||||
pSector->extra = nBlock;
|
pSector->extra = nBlock;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue