spritetype::setsector

This commit is contained in:
Christoph Oelckers 2021-11-21 09:15:21 +01:00
parent c2613d9720
commit 38d64fc437
5 changed files with 11 additions and 5 deletions

View file

@ -717,6 +717,12 @@ inline sectortype* spritetype::sector() const
return !validSectorIndex(sectnum)? nullptr : &::sector[sectnum];
}
inline void spritetype::setsector(sectortype* sect)
{
// place for asserts.
sectnum = sect? ::sector.IndexOf(sect) : -1;
}
inline bool spritetype::insector() const
{
return validSectorIndex(sectnum);

View file

@ -451,6 +451,7 @@ struct spritetype
sectortype* sector() const;
bool insector() const;
void setsector(sectortype*);
};
using tspritetype = spritetype;

View file

@ -1504,12 +1504,12 @@ bool queball(DDukeActor *actor, int pocket, int queball, int stripeball)
}
Collision coll;
int sect = s->sectnum;
auto sect = s->sector();
int j = clipmove_ex(&s->pos, &sect,
(MulScale(s->xvel, bcos(s->ang), 14) * TICSPERFRAME) << 11,
(MulScale(s->xvel, bsin(s->ang), 14) * TICSPERFRAME) << 11,
24L, (4 << 8), (4 << 8), CLIPMASK1, coll);
s->sectnum = sect;
s->setsector(sect);
if (j == kHitWall)
{

View file

@ -204,7 +204,7 @@ static void shootflamethrowerflame(DDukeActor* actor, int p, int sx, int sy, int
spawned->s->x = sx + bsin(sa + 630) / 448;
spawned->s->y = sy + bsin(sa + 112) / 448;
spawned->s->z = sz - 256;
spawned->s->sectnum = s->sectnum;
spawned->s->setsector(s->sector());
spawned->s->cstat = 0x80;
spawned->s->ang = sa;
spawned->s->xrepeat = 2;
@ -1101,7 +1101,7 @@ void shoot_d(DDukeActor* actor, int atwith)
auto k = spawn(actor, atwith);
if (k)
{
k->s->sectnum = sectnum(sect);
k->s->setsector(sect);
k->s->x = sx;
k->s->y = sy;
k->s->z = sz;

View file

@ -391,7 +391,6 @@ void prelevel_d(int g)
I_Error("Too many mirrors (64 max.)");
if (sectp && sectp->ceilingpicnum != MIRROR)
{
assert(wallnum(&wal) > 0);
sectp->ceilingpicnum = MIRROR;
sectp->floorpicnum = MIRROR;
mirrorwall[mirrorcnt] = &wal;