- LadderSector

This commit is contained in:
Christoph Oelckers 2021-11-24 21:39:35 +01:00
parent 991795df4b
commit c0496420ec
5 changed files with 15 additions and 22 deletions

View file

@ -805,7 +805,7 @@ struct PLAYERstruct
int16_t pnum; // carry along the player number
int16_t LadderSector;
sectortype* LadderSector;
int lx,ly; // ladder x and y
int16_t JumpDuration;
int16_t WadeDepth;

View file

@ -3284,9 +3284,8 @@ void DoPlayerClimb(PLAYERp pp)
DoPlayerZrange(pp);
if (!validSectorIndex(pp->LadderSector))
if (!pp->LadderSector)
{
Printf("Bad ladder sector %d!\n", pp->LadderSector);
return;
}
@ -3312,14 +3311,14 @@ void DoPlayerClimb(PLAYERp pp)
if (PlayerCeilingHit(pp, pp->hiz + Z(4)))
{
// put player at the ceiling
pp->posz = sector[pp->LadderSector].ceilingz + Z(4);
pp->posz = pp->LadderSector->ceilingz + Z(4);
NewStateGroup(pp->Actor(), sg_PlayerNinjaClimb);
}
// if floor is ABOVE you && your head goes above it, do a jump up to
// terrace
if (pp->posz < sector[pp->LadderSector].floorz - Z(6))
if (pp->posz < pp->LadderSector->floorz - Z(6))
{
pp->jump_speed = PLAYER_CLIMB_JUMP_AMT;
RESET(pp->Flags, PF_CLIMBING|PF_WEAPON_DOWN);
@ -3410,7 +3409,7 @@ void DoPlayerClimb(PLAYERp pp)
ny = MOVEy(100, lsp->ang);
// set ladder sector
pp->LadderSector = wp->twoSided()? wp->nextsector : wp->sector;
pp->LadderSector = wp->twoSided()? wp->nextSector() : wp->sectorp();
// set players "view" distance from the ladder - needs to be farther than
// the sprite
@ -3804,8 +3803,9 @@ bool PlayerOnLadder(PLAYERp pp)
nx = MOVEx(100, lsp->ang);
ny = MOVEy(100, lsp->ang);
pp->LadderSector = wall[wal].twoSided() ? wall[wal].nextsector : wall[wal].sector;
MONO_PRINT(ds);
auto wp = &wall[wal];
pp->LadderSector = wp->twoSided() ? wp->nextSector() : wp->sectorp();
// set players "view" distance from the ladder - needs to be farther than
// the sprite

View file

@ -653,22 +653,15 @@ void DoSpringBoardDown(void)
return;
}
short FindNextSectorByTag(short sectnum, int tag)
short FindNextSectorByTag(short sect, int tag)
{
short next_sectnum, startwall, endwall, j;
startwall = sector[sectnum].wallptr;
endwall = startwall + sector[sectnum].wallnum - 1;
for (j = startwall; j <= endwall; j++)
for(auto& wal : wallsofsector(sect))
{
next_sectnum = wall[j].nextsector;
if (next_sectnum >= 0)
if (wal.twoSided())
{
if (sector[next_sectnum].lotag == tag)
if (wal.nextSector()->lotag == tag)
{
return next_sectnum;
return sectnum(wal.nextSector());
}
}
}

View file

@ -3512,7 +3512,7 @@ bool ActorTrackDecide(TRACK_POINTp tpoint, DSWActor* actor)
auto wal = &wall[hit_wall];
#if DEBUG
if (wal->nextsector < 0)
if (!wal->twoSided())
{
I_Error("Take out white wall ladder x = %d, y = %d",wal->x, wal->y);
}

View file

@ -227,7 +227,7 @@ struct SWPlayer native
native int16 pnum; // carry along the player number
native int16 LadderSector;
//native int16 LadderSector;
native int lx,ly; // ladder x and y
native int16 JumpDuration;
native int16 WadeDepth;