- the final ones before moving to the backend.

This commit is contained in:
Christoph Oelckers 2021-11-25 19:36:44 +01:00
parent 33d2d80c42
commit 7dd2f79676
2 changed files with 12 additions and 12 deletions

View file

@ -4,7 +4,7 @@ bool FindCeilingView(int match, int* x, int* y, int z, sectortype** sectnum);
bool FindFloorView(int match, int* x, int* y, int z, sectortype** sectnum); bool FindFloorView(int match, int* x, int* y, int z, sectortype** sectnum);
int ViewSectorInScene(int cursectnum, int level) int ViewSectorInScene(sectortype* cursect, int level)
{ {
SWStatIterator it(STAT_FAF); SWStatIterator it(STAT_FAF);
while (auto actor = it.Next()) while (auto actor = it.Next())
@ -13,7 +13,7 @@ int ViewSectorInScene(int cursectnum, int level)
if (sp->hitag == level) if (sp->hitag == level)
{ {
if (cursectnum == sp->sectnum) if (cursect == sp->sector())
{ {
// ignore case if sprite is pointing up // ignore case if sprite is pointing up
if (sp->ang == 1536) if (sp->ang == 1536)
@ -40,7 +40,7 @@ void DrawOverlapRoom(int tx, int ty, int tz, fixed_t tq16ang, fixed_t tq16horiz,
{ {
save.zcount = 0; save.zcount = 0;
int match = ViewSectorInScene(sectnum(tsect), VIEW_LEVEL1); int match = ViewSectorInScene(tsect, VIEW_LEVEL1);
if (match != -1) if (match != -1)
{ {
FindCeilingView(match, &tx, &ty, tz, &tsect); FindCeilingView(match, &tx, &ty, tz, &tsect);
@ -65,7 +65,7 @@ void DrawOverlapRoom(int tx, int ty, int tz, fixed_t tq16ang, fixed_t tq16horiz,
} }
else else
{ {
int match = ViewSectorInScene(sectnum(tsect), VIEW_LEVEL2); int match = ViewSectorInScene(tsect, VIEW_LEVEL2);
if (match != -1) if (match != -1)
{ {
FindFloorView(match, &tx, &ty, tz, &tsect); FindFloorView(match, &tx, &ty, tz, &tsect);

View file

@ -1995,7 +1995,7 @@ void PlayerSectorBound(PLAYERp pp, int amt)
// called from DoPlayerMove() but can be called // called from DoPlayerMove() but can be called
// from anywhere it is needed // from anywhere it is needed
getzsofslope(pp->cursectnum, pp->posx, pp->posy, &cz, &fz); getzsofslopeptr(pp->cursector(), pp->posx, pp->posy, &cz, &fz);
if (pp->posz > fz - amt) if (pp->posz > fz - amt)
pp->posz = fz - amt; pp->posz = fz - amt;
@ -2160,7 +2160,7 @@ void DoPlayerMove(PLAYERp pp)
DoPlayerHorizon(pp, pp->input.horz, 1); DoPlayerHorizon(pp, pp->input.horz, 1);
} }
if (pp->cursectnum >= 0 && TEST(pp->cursector()->extra, SECTFX_DYNAMIC_AREA)) if (pp->insector() && TEST(pp->cursector()->extra, SECTFX_DYNAMIC_AREA))
{ {
if (TEST(pp->Flags, PF_FLYING|PF_JUMPING|PF_FALLING)) if (TEST(pp->Flags, PF_FLYING|PF_JUMPING|PF_FALLING))
{ {
@ -3564,7 +3564,7 @@ void DoPlayerCrawl(PLAYERp pp)
return; return;
} }
if (pp->cursectnum >= 0 && TEST(pp->cursector()->extra, SECTFX_DYNAMIC_AREA)) if (pp->insector() && TEST(pp->cursector()->extra, SECTFX_DYNAMIC_AREA))
{ {
pp->posz = pp->loz - PLAYER_CRAWL_HEIGHT; pp->posz = pp->loz - PLAYER_CRAWL_HEIGHT;
} }
@ -5002,7 +5002,7 @@ void DoPlayerBeginOperate(PLAYERp pp)
pp->posx = sop->xmid; pp->posx = sop->xmid;
pp->posy = sop->ymid; pp->posy = sop->ymid;
updatesector(pp->posx, pp->posy, &pp->cursectnum); updatesector(pp->posx, pp->posy, &pp->cursectnum);
getzsofslope(pp->cursectnum, pp->posx, pp->posy, &cz, &fz); getzsofslopeptr(pp->cursector(), pp->posx, pp->posy, &cz, &fz);
pp->posz = fz - PLAYER_HEIGHT; pp->posz = fz - PLAYER_HEIGHT;
RESET(pp->Flags, PF_CRAWLING|PF_JUMPING|PF_FALLING|PF_LOCK_CRAWL); RESET(pp->Flags, PF_CRAWLING|PF_JUMPING|PF_FALLING|PF_LOCK_CRAWL);
@ -5087,7 +5087,7 @@ void DoPlayerBeginRemoteOperate(PLAYERp pp, SECTOR_OBJECTp sop)
pp->posx = sop->xmid; pp->posx = sop->xmid;
pp->posy = sop->ymid; pp->posy = sop->ymid;
updatesector(pp->posx, pp->posy, &pp->cursectnum); updatesector(pp->posx, pp->posy, &pp->cursectnum);
getzsofslope(pp->cursectnum, pp->posx, pp->posy, &cz, &fz); getzsofslopeptr(pp->cursector(), pp->posx, pp->posy, &cz, &fz);
pp->posz = fz - PLAYER_HEIGHT; pp->posz = fz - PLAYER_HEIGHT;
RESET(pp->Flags, PF_CRAWLING|PF_JUMPING|PF_FALLING|PF_LOCK_CRAWL); RESET(pp->Flags, PF_CRAWLING|PF_JUMPING|PF_FALLING|PF_LOCK_CRAWL);
@ -6345,7 +6345,7 @@ void DoPlayerRun(PLAYERp pp)
{ {
if (pp->input.actions & SB_OPEN) if (pp->input.actions & SB_OPEN)
{ {
if ((pp->KeyPressBits & SB_OPEN) && pp->cursectnum >= 0) if ((pp->KeyPressBits & SB_OPEN) && pp->insector())
{ {
if (TEST(pp->cursector()->extra, SECTFX_OPERATIONAL)) if (TEST(pp->cursector()->extra, SECTFX_OPERATIONAL))
{ {
@ -6998,7 +6998,7 @@ void PlayerSpawnPosition(PLAYERp pp)
pp->angle.ang = pp->angle.oang = buildang(sp->ang); pp->angle.ang = pp->angle.oang = buildang(sp->ang);
pp->setcursector(sp->sector()); pp->setcursector(sp->sector());
getzsofslope(pp->cursectnum, pp->posx, pp->posy, &cz, &fz); getzsofslopeptr(pp->cursector(), pp->posx, pp->posy, &cz, &fz);
// if too close to the floor - stand up // if too close to the floor - stand up
if (pp->posz > fz - PLAYER_HEIGHT) if (pp->posz > fz - PLAYER_HEIGHT)
{ {
@ -7094,7 +7094,7 @@ int DoFootPrints(DSWActor* actor)
if (u->PlayerP) if (u->PlayerP)
{ {
if (u->PlayerP->cursectnum < 0) if (!u->PlayerP->insector())
return 0; return 0;
if (FAF_ConnectArea(u->PlayerP->cursector())) if (FAF_ConnectArea(u->PlayerP->cursector()))