- NEAR_TAG_LIST, also deleted useless OperateWall code.

This commit is contained in:
Christoph Oelckers 2021-11-25 19:25:05 +01:00
parent b7cfb07245
commit 104e80e34a
10 changed files with 22 additions and 64 deletions

View file

@ -487,15 +487,6 @@ int DoActorOperate(DSWActor* actor)
}
}
if (nearwall >= 0 && nearhitdist < 1024)
{
if (OperateWall(nearwall, false))
{
u->WaitTics = 2 * 120;
NewStateGroup(actor, u->ActorActionSet->Stand);
}
}
return true;
}

View file

@ -2101,7 +2101,7 @@ int DoWallMoveMatch(short match); // wallmove.c
int DoWallMove(DSWActor* sp); // wallmove.c
bool CanSeeWallMove(SPRITEp wp,short match); // wallmove.c
void DoSpikeOperate(short sectnum); // spike.c
void DoSpikeOperate(sectortype* sect); // spike.c
void SetSpikeActive(DSWActor*); // spike.c
#define NTAG_SEARCH_LO 1

View file

@ -740,12 +740,6 @@ int OperateSector(sectortype* sect, short player_is_operating)
return false;
}
int
OperateWall(short wallnum, short player_is_operating)
{
return false;
}
enum
{
SWITCH_LEVER = 581,
@ -2130,8 +2124,8 @@ void NearTagList(NEAR_TAG_INFOp ntip, PLAYERp pp, int z, int dist, int type, int
save_hitag = ntsec->hitag;
ntip->dist = neartaghitdist;
ntip->sectnum = neartagsector;
ntip->wallnum = -1;
ntip->sectp = ntsec;
ntip->wallp = nullptr;
ntip->actor = nullptr;
nti_cnt++;
ntip++;
@ -2157,8 +2151,8 @@ void NearTagList(NEAR_TAG_INFOp ntip, PLAYERp pp, int z, int dist, int type, int
save_hitag = ntwall->hitag;
ntip->dist = neartaghitdist;
ntip->sectnum = -1;
ntip->wallnum = neartagwall;
ntip->sectp = nullptr;
ntip->wallp = ntwall;
ntip->actor = nullptr;
nti_cnt++;
ntip++;
@ -2185,8 +2179,8 @@ void NearTagList(NEAR_TAG_INFOp ntip, PLAYERp pp, int z, int dist, int type, int
save_hitag = sp->hitag;
ntip->dist = neartaghitdist;
ntip->sectnum = -1;
ntip->wallnum = -1;
ntip->sectp = nullptr;
ntip->wallp = nullptr;
ntip->actor = actor;
nti_cnt++;
ntip++;
@ -2207,8 +2201,8 @@ void NearTagList(NEAR_TAG_INFOp ntip, PLAYERp pp, int z, int dist, int type, int
else
{
ntip->dist = -1;
ntip->sectnum = -1;
ntip->wallnum = -1;
ntip->sectp = nullptr;
ntip->wallp = nullptr;
ntip->actor = nullptr;
nti_cnt++;
ntip++;
@ -2341,28 +2335,19 @@ void PlayerOperateEnv(PLAYERp pp)
{
int neartaghitdist;
short neartagsector, neartagwall;
sectortype* neartagsector;
neartaghitdist = nti[0].dist;
neartagsector = nti[0].sectnum;
neartagwall = nti[0].wallnum;
neartagsector = nti[0].sectp;
if (neartagsector >= 0 && neartaghitdist < 1024)
if (neartagsector != nullptr && neartaghitdist < 1024)
{
if (OperateSector(&sector[neartagsector], true))
if (OperateSector(neartagsector, true))
{
// Release the key
pp->KeyPressBits &= ~SB_OPEN;
}
}
if (neartagwall >= 0 && neartaghitdist < 1024)
{
if (OperateWall(neartagwall, true))
{
pp->KeyPressBits &= ~SB_OPEN;
}
}
}
//

View file

@ -60,7 +60,8 @@ enum SO_SCALE_TYPE
typedef struct
{
int dist;
short sectnum, wallnum;
sectortype* sectp;
walltype* wallp;
DSWActor* actor;
} NEAR_TAG_INFO, *NEAR_TAG_INFOp;
extern short nti_cnt;

View file

@ -1592,7 +1592,7 @@ void SpriteSetupPost(void)
if (jActor->hasU())
continue;
getzsofslope(ds->sectnum, ds->x, ds->y, &cz, &fz);
getzsofslopeptr(ds->sector(), ds->x, ds->y, &cz, &fz);
if (labs(ds->z - fz) > Z(4))
continue;
@ -3581,7 +3581,7 @@ bool ItemSpotClear(DSWActor* actor, short statnum, short id)
if (TEST_BOOL2(sip))
{
SWSectIterator it(sip->sectnum);
SWSectIterator it(sip->sector());
while (auto itActor = it.Next())
{
if (itActor->s().statnum == statnum && itActor->u()->ID == id)

View file

@ -838,7 +838,7 @@ void BossHealthMeter(void)
sp = &BossSpriteNum[i]->s();
u = BossSpriteNum[i]->u();
if (cansee(sp->x, sp->y, SPRITEp_TOS(sp), sp->sectnum, pp->posx, pp->posy, pp->posz - Z(40), pp->cursectnum))
if (cansee(sp->x, sp->y, SPRITEp_TOS(sp), sp->sector(), pp->posx, pp->posy, pp->posz - Z(40), pp->cursector()))
{
if (i == 0 && !bosswasseen[0])
{

View file

@ -1670,10 +1670,8 @@ void MovePoints(SECTOR_OBJECTp sop, short delta_ang, int nx, int ny)
sop->sp_child->s().x = sop->xmid;
sop->sp_child->s().y = sop->ymid;
//updatesector(sop->xmid, sop->ymid, &sop->sectnum);
// setting floorz if need be
//if (!TEST(sop->flags, SOBJ_SPRITE_OBJ))
if (TEST(sop->flags, SOBJ_ZMID_FLOOR))
sop->zmid = sop->mid_sector->floorz;
@ -3222,9 +3220,6 @@ bool ActorTrackDecide(TRACK_POINTp tpoint, DSWActor* actor)
sp->ang = tpoint->ang;
// //DSPRINTF(ds,"sp->x = %ld, sp->y = %ld, sp->sector = %d, tp->x = %ld, tp->y = %ld, tp->ang = %d\n",sp->x,sp->y,sp->sectnum,tpoint->x,tpoint->y,tpoint->ang);
// MONO_PRINT(ds);
z[0] = sp->z - SPRITEp_SIZE_Z(sp) + Z(5);
z[1] = sp->z - DIV2(SPRITEp_SIZE_Z(sp));
@ -3261,19 +3256,6 @@ bool ActorTrackDecide(TRACK_POINTp tpoint, DSWActor* actor)
}
}
if (nearwall >= 0 && nearhitdist < 1024)
{
if (OperateWall(nearwall, false))
{
if (!tpoint->tag_high)
u->WaitTics = 2 * 120;
else
u->WaitTics = tpoint->tag_high * 128;
NewStateGroup(actor, u->ActorActionSet->Stand);
}
}
break;
}

View file

@ -176,7 +176,7 @@ bool CanSeeWallMove(SPRITEp wp, short match)
{
found = true;
if (cansee(wp->x, wp->y, wp->z, wp->sectnum, sp->x, sp->y, sp->z, sp->sectnum))
if (cansee(wp->x, wp->y, wp->z, wp->sector(), sp->x, sp->y, sp->z, sp->sector()))
{
return true;
}

View file

@ -177,7 +177,7 @@ DSWActor* WarpToArea(DSWActor* sp_from, int32_t* x, int32_t* y, int32_t* z, int*
// exp: WARP_CEILING or WARP_CEILING_PLANE
if (spi->hitag == to_tag)
{
if (!validSectorIndex(spi->sectnum))
if (!spi->insector())
return nullptr;
// determine new x,y,z position

View file

@ -18585,7 +18585,7 @@ int QueueStar(DSWActor* actor)
// move old star to new stars place
osp = &StarQueue[StarQueueHead]->s();
osp->pos = sp->pos;
ChangeActorSect(StarQueue[StarQueueHead], sp->sectnum);
ChangeActorSect(StarQueue[StarQueueHead], sp->sector());
KillActor(actor);
actor = StarQueue[StarQueueHead];
}
@ -19101,11 +19101,10 @@ void QueueGeneric(DSWActor* actor, short pic)
{
// move old sprite to new sprite's place
osp = &GenericQueue[GenericQueueHead]->s();
//setspritez(GenericQueue[GenericQueueHead], &sp->pos);
osp->x = sp->x;
osp->y = sp->y;
osp->z = sp->z;
ChangeActorSect(GenericQueue[GenericQueueHead], sp->sectnum);
ChangeActorSect(GenericQueue[GenericQueueHead], sp->sector());
KillActor(actor);
actor = GenericQueue[GenericQueueHead];
ASSERT(actor->s().statnum != MAXSTATUS);