- a few automatic replacements.

This commit is contained in:
Christoph Oelckers 2021-11-19 20:35:33 +01:00
parent 93f5a111bf
commit 28f7303af3
6 changed files with 20 additions and 18 deletions

View file

@ -2616,16 +2616,17 @@ int actWallBounceVector(int* x, int* y, int nWall, int a4)
int actFloorBounceVector(int* x, int* y, int* z, int nSector, int a5)
{
int t = 0x10000 - a5;
if (sector[nSector].floorheinum == 0)
auto pSector = &sector[nSector];
if (pSector->floorheinum == 0)
{
int t2 = MulScale(*z, t, 16);
*z = -(*z - t2);
return t2;
}
walltype* pWall = &wall[sector[nSector].wallptr];
walltype* pWall2 = &wall[pWall->point2];
walltype* pWall = pSector->firstWall();
walltype* pWall2 = pWall->point2Wall();
int angle = getangle(pWall2->x - pWall->x, pWall2->y - pWall->y) + 512;
int t2 = sector[nSector].floorheinum << 4;
int t2 = pSector->floorheinum << 4;
int t3 = approxDist(-0x10000, t2);
int t4 = DivScale(-0x10000, t3, 16);
int t5 = DivScale(t2, t3, 16);
@ -5019,11 +5020,11 @@ void MoveDude(DBloodActor* actor)
{
case kMarkerLowStack:
if (pPlayer == gView)
setgotpic(sector[pSprite->sectnum].floorpicnum);
setgotpic(pSprite->sector()->floorpicnum);
break;
case kMarkerUpStack:
if (pPlayer == gView)
setgotpic(sector[pSprite->sectnum].ceilingpicnum);
setgotpic(pSprite->sector()->ceilingpicnum);
break;
case kMarkerLowWater:
case kMarkerLowGoo:
@ -6895,13 +6896,14 @@ void actFireVector(DBloodActor* shooter, int a2, int a3, int a4, int a5, int a6,
{
int nWall = gHitInfo.hitwall;
assert(nWall >= 0 && nWall < kMaxWalls);
nSurf = surfType[wall[nWall].picnum];
auto pWall = &wall[nWall];
nSurf = surfType[pWall->picnum];
if (actCanSplatWall(nWall))
{
int x = gHitInfo.hitx - MulScale(a4, 16, 14);
int y = gHitInfo.hity - MulScale(a5, 16, 14);
int z = gHitInfo.hitz - MulScale(a6, 256, 14);
int nSurf = surfType[wall[nWall].picnum];
int nSurf = surfType[pWall->picnum];
assert(nSurf < kSurfMax);
if (pVectorData->surfHit[nSurf].fx1 >= 0)
{

View file

@ -2557,10 +2557,10 @@ bool genDudePrepare(DBloodActor* actor, int propId)
// make sure dudes aren't in the floor or ceiling
int zTop, zBot; GetSpriteExtents(pSprite, &zTop, &zBot);
if (!(sector[pSprite->sectnum].ceilingstat & 0x0001))
pSprite->z += ClipLow(sector[pSprite->sectnum].ceilingz - zTop, 0);
if (!(sector[pSprite->sectnum].floorstat & 0x0001))
pSprite->z += ClipHigh(sector[pSprite->sectnum].floorz - zBot, 0);
if (!(pSprite->sector()->ceilingstat & 0x0001))
pSprite->z += ClipLow(pSprite->sector()->ceilingz - zTop, 0);
if (!(pSprite->sector()->floorstat & 0x0001))
pSprite->z += ClipHigh(pSprite->sector()->floorz - zBot, 0);
pSprite->clipdist = ClipRange((pSprite->xrepeat + pSprite->yrepeat) >> 1, 4, 120);
if (propId) break;

View file

@ -205,7 +205,7 @@ void CFX::fxProcess(void)
pSprite->y += actor->yvel>>12;
pSprite->z += actor->zvel>>8;
// Weird...
if (actor->xvel || (actor->yvel && pSprite->z >= sector[pSprite->sectnum].floorz))
if (actor->xvel || (actor->yvel && pSprite->z >= pSprite->sector()->floorz))
{
updatesector(pSprite->x, pSprite->y, &nSector);
if (nSector == -1)

View file

@ -746,8 +746,8 @@ void nnExtInitModernStuff()
// very quick fix for floor sprites with Touch trigger flag if their Z is equals sector floorz / ceilgz
if (pSprite->sectnum >= 0 && pXSprite->Touch && (pSprite->cstat & CSTAT_SPRITE_ALIGNMENT_FLOOR)) {
if (pSprite->z == sector[pSprite->sectnum].floorz) pSprite->z--;
else if (pSprite->z == sector[pSprite->sectnum].ceilingz) pSprite->z++;
if (pSprite->z == pSprite->sector()->floorz) pSprite->z--;
else if (pSprite->z == pSprite->sector()->ceilingz) pSprite->z++;
}
// make Proximity flag work not just for dudes and things...
@ -3177,7 +3177,7 @@ void useEffectGen(DBloodActor* sourceactor, DBloodActor* actor)
case 3:
case 4:
if (!sectRangeIsFine(pSprite->sectnum)) pos = top;
else pos = (pXSource->data4 == 3) ? sector[pSprite->sectnum].floorz : sector[pSprite->sectnum].ceilingz;
else pos = (pXSource->data4 == 3) ? pSprite->sector()->floorz : pSprite->sector()->ceilingz;
break;
default:
pos = top;

View file

@ -1339,7 +1339,7 @@ void doslopetilting(PLAYER* pPlayer, double const scaleAdjust = 1)
auto* const pXSprite = pPlayer->pXSprite;
int const florhit = pPlayer->actor->hit.florhit.type;
bool const va = pXSprite->height < 16 && (florhit == kHitSector || florhit == 0) ? 1 : 0;
pPlayer->horizon.calcviewpitch(pSprite->pos.vec2, buildang(pSprite->ang), va, sector[pSprite->sectnum].floorstat & 2, pSprite->sectnum, scaleAdjust);
pPlayer->horizon.calcviewpitch(pSprite->pos.vec2, buildang(pSprite->ang), va, pSprite->sector()->floorstat & 2, pSprite->sectnum, scaleAdjust);
}
void ProcessInput(PLAYER *pPlayer)

View file

@ -356,7 +356,7 @@ void SEQINST::Update()
if (!VanillaMode() && pSequence->frames[frameIndex].surfaceSound && actor->zvel == 0 && actor->xvel != 0) {
if (getUpperLink(pSprite->sectnum)) break; // don't play surface sound for stacked sectors
int surf = tileGetSurfType(sector[pSprite->sectnum].floorpicnum);
int surf = tileGetSurfType(pSprite->sector()->floorpicnum);
if (!surf) break;
static int surfSfxMove[15][4] = {
/* {snd1, snd2, gameVolume, myVolume} */