- replaced hi_sp with an actor pointer.

This commit is contained in:
Christoph Oelckers 2021-10-31 00:39:02 +02:00
parent c0c27dfd1a
commit 84b83ad9b8
11 changed files with 38 additions and 43 deletions

View file

@ -423,7 +423,7 @@ int DoActorDebris(DSWActor* actor)
u->lo_sectp = &sector[sp->sectnum];
u->hi_sectp = &sector[sp->sectnum];
u->lowActor = nullptr;
u->hi_sp = nullptr;
u->highActor = nullptr;
break;
}

View file

@ -1619,8 +1619,8 @@ int move_scan(DSWActor* actor, short ang, int dist, int *stopx, int *stopy, int
short sang,ss;
int x, y, z, loz, hiz;
SPRITEp hi_sp;
DSWActor *lowActor;
DSWActor* highActor;
DSWActor* lowActor;
SECTORp lo_sectp, hi_sectp;
@ -1634,7 +1634,7 @@ int move_scan(DSWActor* actor, short ang, int dist, int *stopx, int *stopy, int
loz = u->loz;
hiz = u->hiz;
lowActor = u->lowActor;
hi_sp = u->hi_sp;
highActor = u->highActor;
lo_sectp = u->lo_sectp;
hi_sectp = u->hi_sectp;
ss = sp->sectnum;
@ -1663,7 +1663,7 @@ int move_scan(DSWActor* actor, short ang, int dist, int *stopx, int *stopy, int
u->loz = loz;
u->hiz = hiz;
u->lowActor = lowActor;
u->hi_sp = hi_sp;
u->highActor = highActor;
u->lo_sectp = lo_sectp;
u->hi_sectp = hi_sectp;
changespritesect(u->SpriteNum, ss);

View file

@ -671,7 +671,7 @@ int DoCoolgMatchPlayerZ(DSWActor* actor)
}
// upper bound
if (u->hi_sp)
if (u->highActor)
bound = hiz + u->ceiling_dist;
else
bound = hiz + u->ceiling_dist + COOLG_BOB_AMT;

View file

@ -480,7 +480,7 @@ int DoEelMatchPlayerZ(DSWActor* actor)
loz -= Z(FixedToInt(SectUser[u->lo_sectp - sector]->depth_fixed)) - Z(8);
// lower bound
if (u->lowActor && u->tgt_sp() == u->hi_sp)
if (u->lowActor && u->targetActor == u->highActor) // this doesn't look right...
{
DISTANCE(sp->x, sp->y, u->lowActor->s().x, u->lowActor->s().y, dist, a, b, c);
if (dist <= 300)
@ -497,9 +497,9 @@ int DoEelMatchPlayerZ(DSWActor* actor)
}
// upper bound
if (u->hi_sp && u->tgt_sp() == u->hi_sp)
if (u->highActor && u->targetActor == u->highActor)
{
DISTANCE(sp->x, sp->y, u->hi_sp->x, u->hi_sp->y, dist, a, b, c);
DISTANCE(sp->x, sp->y, u->highActor->s().x, u->highActor->s().y, dist, a, b, c);
if (dist <= 300)
bound = u->sz;
else

View file

@ -775,8 +775,7 @@ struct PLAYERstruct
int hiz,loz;
int ceiling_dist,floor_dist;
SECTORp hi_sectp, lo_sectp;
SPRITEp hi_sp;
DSWActor* lowActor;
DSWActor* lowActor, *highActor;
SPRITEp last_camera_sp;
int circle_camera_dist;
@ -1132,8 +1131,7 @@ struct USER
int hiz,loz;
int zclip; // z height to move up for clipmove
SECTORp hi_sectp, lo_sectp;
SPRITEp hi_sp;
DSWActor* lowActor;
DSWActor* lowActor, *highActor;
int active_range;

View file

@ -397,7 +397,7 @@ int DoHornetMatchPlayerZ(short SpriteNum)
}
// upper bound
if (u->hi_sp)
if (u->highActor)
bound = hiz + u->ceiling_dist;
else
bound = hiz + u->ceiling_dist + HORNET_BOB_AMT;

View file

@ -1947,11 +1947,11 @@ DoPlayerZrange(PLAYERp pp)
pp->lo_sectp = pp->hi_sectp = nullptr;
pp->lowActor = nullptr;
pp->hi_sp = nullptr;
pp->highActor = nullptr;
if (TEST(ceilhit, 0xc000) == 49152)
{
pp->hi_sp = &sprite[ceilhit & 4095];
pp->highActor = &swActors[ceilhit & 4095];
}
else
{
@ -4764,10 +4764,10 @@ DoPlayerDive(PLAYERp pp)
else
{
// close to a warping sector - stop diveing with a warp to surface
// !JIM! FRANK - I added !pp->hi_sp so that you don't warp to surface when
// !JIM! FRANK - I added !pp->hiActor so that you don't warp to surface when
// there is a sprite above you since getzrange returns a hiz < ceiling height
// if you are clipping into a sprite and not the ceiling.
if (pp->posz < pp->hiz + Z(4) && !pp->hi_sp)
if (pp->posz < pp->hiz + Z(4) && !pp->highActor)
{
DoPlayerStopDive(pp);
return;
@ -6081,12 +6081,9 @@ DoPlayerDeathZrange(PLAYERp pp)
DoFindGround(pp->PlayerSprite);
// update player values with results from DoFindGround
// pp->hiz = u->hiz;
pp->loz = u->loz;
pp->lowActor = u->lowActor;
//pp->hi_sp = u->hi_sp;
pp->lo_sectp = u->lo_sectp;
//pp->hi_sectp = u->hi_sectp;
}
void DoPlayerDeathHurl(PLAYERp pp)

View file

@ -460,7 +460,7 @@ FSerializer& Serialize(FSerializer& arc, const char* keyname, PLAYERstruct& w, P
("floor_dist", w.floor_dist)
("hi_sectp", w.hi_sectp)
("lo_sectp", w.lo_sectp)
("hi_sp", w.hi_sp)
("hi_sp", w.highActor)
("lo_sp", w.lowActor)
("last_camera_sp", w.last_camera_sp)
("circle_camera_dist", w.circle_camera_dist)
@ -866,7 +866,7 @@ FSerializer& Serialize(FSerializer& arc, const char* keyname, USER& w, USER* def
("zclip", w.zclip, def->zclip)
("hi_sectp", w.hi_sectp, def->hi_sectp)
("lo_sectp", w.lo_sectp, def->lo_sectp)
("hi_sp", w.hi_sp, def->hi_sp)
("hi_sp", w.highActor, def->highActor)
("lo_sp", w.lowActor, def->lowActor)
("active_range", w.active_range, def->active_range)
("SpriteNum", w.SpriteNum, def->SpriteNum)

View file

@ -804,7 +804,7 @@ void KillSprite(int16_t SpriteNum)
{
if (u.Data())
{
if (u->hi_sp == sp) u->hi_sp = nullptr;
if (u->highActor == actor) u->highActor = nullptr;
if (u->lowActor == actor) u->lowActor = nullptr;
if (u->targetActor == actor) u->targetActor = nullptr;
}
@ -938,7 +938,7 @@ SpawnUser(short SpriteNum, short id, STATEp state)
u->loz = sector[sp->sectnum].floorz;
u->hiz = sector[sp->sectnum].ceilingz;
u->lowActor = nullptr;
u->hi_sp = nullptr;
u->highActor = nullptr;
u->lo_sectp = &sector[sp->sectnum];
u->hi_sectp = &sector[sp->sectnum];
#endif
@ -4941,13 +4941,13 @@ DoActorZrange(short SpriteNum)
SET(sp->cstat, save_cstat);
u->lo_sectp = u->hi_sectp = nullptr;
u->hi_sp = nullptr;
u->highActor = nullptr;
u->lowActor = nullptr;
switch (TEST(ceilhit, HIT_MASK))
{
case HIT_SPRITE:
u->hi_sp = &sprite[NORM_SPRITE(ceilhit)];
u->highActor = &swActors[NORM_SPRITE(ceilhit)];
break;
case HIT_SECTOR:
u->hi_sectp = &sector[NORM_SECTOR(ceilhit)];
@ -4983,13 +4983,13 @@ DoActorGlobZ(short SpriteNum)
u->hiz = globhiz;
u->lo_sectp = u->hi_sectp = nullptr;
u->hi_sp = nullptr;
u->highActor = nullptr;
u->lowActor = nullptr;
switch (TEST(globhihit, HIT_MASK))
{
case HIT_SPRITE:
u->hi_sp = &sprite[globhihit & 4095];
u->highActor = &swActors[globhihit & 4095];
break;
default:
u->hi_sectp = &sector[globhihit & 4095];
@ -5108,7 +5108,7 @@ int move_actor(DSWActor* actor, int xchange, int ychange, int zchange)
SPRITEp sp = &actor->s();
int x, y, z, loz, hiz;
SPRITEp hi_sp;
DSWActor* highActor;
DSWActor* lowActor;
SECTORp lo_sectp, hi_sectp;
short sectnum;
@ -5130,7 +5130,7 @@ int move_actor(DSWActor* actor, int xchange, int ychange, int zchange)
loz = u->loz;
hiz = u->hiz;
lowActor = u->lowActor;
hi_sp = u->hi_sp;
highActor = u->highActor;
lo_sectp = u->lo_sectp;
hi_sectp = u->hi_sectp;
sectnum = sp->sectnum;
@ -5153,7 +5153,7 @@ int move_actor(DSWActor* actor, int xchange, int ychange, int zchange)
u->loz = loz;
u->hiz = hiz;
u->lowActor = lowActor;
u->hi_sp = hi_sp;
u->highActor = highActor;
u->lo_sectp = lo_sectp;
u->hi_sectp = hi_sectp;
u->ret = -1;
@ -5172,7 +5172,7 @@ int move_actor(DSWActor* actor, int xchange, int ychange, int zchange)
u->loz = loz;
u->hiz = hiz;
u->lowActor = lowActor;
u->hi_sp = hi_sp;
u->highActor = highActor;
u->lo_sectp = lo_sectp;
u->hi_sectp = hi_sectp;
u->ret = -1;
@ -7382,7 +7382,7 @@ move_ground_missile(short spritenum, int xchange, int ychange, int ceildist, int
getzsofslope(sp->sectnum, sp->x, sp->y, &u->hiz, &u->loz);
u->hi_sectp = u->lo_sectp = &sector[sp->sectnum];
u->hi_sp = u->lowActor = nullptr;
u->highActor = u->lowActor = nullptr;
return retval;
}
else
@ -7409,7 +7409,7 @@ move_ground_missile(short spritenum, int xchange, int ychange, int ceildist, int
getzsofslope(sp->sectnum, sp->x, sp->y, &u->hiz, &u->loz);
u->hi_sectp = u->lo_sectp = &sector[sp->sectnum];
u->hi_sp = nullptr; u->lowActor = nullptr;
u->highActor = nullptr; u->lowActor = nullptr;
sp->z = u->loz - Z(8);
if (labs(u->hiz - u->loz) < Z(12))

View file

@ -4484,13 +4484,13 @@ WeaponMoveHit(short SpriteNum)
else
{
// hit a floor sprite
if (u->hi_sp)
if (u->highActor)
{
if (u->hi_sp->lotag == TAG_SPRITE_HIT_MATCH)
if (u->highActor->s().lotag == TAG_SPRITE_HIT_MATCH)
{
if (MissileHitMatch(SpriteNum, -1, short(u->hi_sp - sprite)))
if (MissileHitMatch(SpriteNum, -1, u->highActor->GetSpriteIndex()))
return true;
//DoMatchEverything(nullptr, u->hi_sp->hitag, -1);
//DoMatchEverything(nullptr, u->highActor->s().hitag, -1);
//return(true);
}
}
@ -8054,8 +8054,8 @@ DoStar(DSWActor* actor)
if (u->lowActor)
if (u->lowActor->s().lotag == TAG_SPRITE_HIT_MATCH)
break;
if (u->hi_sp)
if (u->hi_sp->lotag == TAG_SPRITE_HIT_MATCH)
if (u->highActor)
if (u->highActor->s().lotag == TAG_SPRITE_HIT_MATCH)
break;
ScaleSpriteVector(Weapon, 58000);

View file

@ -704,7 +704,7 @@ int NullZilla(DSWActor* actor)
u->lo_sectp = &sector[sp->sectnum];
u->hi_sectp = &sector[sp->sectnum];
u->lowActor = nullptr;
u->hi_sp = nullptr;
u->highActor = nullptr;
sp->z = u->loz;
DoActorSectorDamage(actor);
@ -789,7 +789,7 @@ int DoZillaDeathMelt(DSWActor* actor)
u->lo_sectp = &sector[sp->sectnum];
u->hi_sectp = &sector[sp->sectnum];
u->lowActor = nullptr;
u->hi_sp = nullptr;
u->highActor = nullptr;
sp->z = u->loz;
BossSpriteNum[2] = -2;