- the remaining sector[] stuff in Duke/RR.

What remains is either engine interface code or not easily replaced.
This commit is contained in:
Christoph Oelckers 2021-11-18 20:17:47 +01:00
parent 5e66a3331d
commit 4a81d45630
9 changed files with 30 additions and 34 deletions

View file

@ -315,7 +315,7 @@ void movecyclers(void)
for (int q = numcyclers - 1; q >= 0; q--)
{
Cycler* c = &cyclers[q];
auto sect = c->sector();
auto sect = c->sector;
int t = c->shade2;
int j = t + bsin(c->lotag, -10);

View file

@ -38,10 +38,10 @@ void dojaildoor();
void moveminecart();
void ballreturn(DDukeActor* spr);
void pinsectorresetdown(int sect);
int pinsectorresetup(int sect);
int checkpins(int sect);
void resetpins(int sect);
void pinsectorresetdown(sectortype* sect);
int pinsectorresetup(sectortype* sect);
int checkpins(sectortype* sect);
void resetpins(sectortype* sect);
void resetlanepics(void);
@ -2433,13 +2433,13 @@ void rr_specialstats()
if (s->picnum == BOWLINGPINSPOT)
if (s->lotag == 100)
{
auto pst = pinsectorresetup(s->sectnum);
auto pst = pinsectorresetup(s->sector());
if (pst)
{
s->lotag = 0;
if (s->extra == 1)
{
pst = checkpins(s->sectnum);
pst = checkpins(s->sector());
if (!pst)
{
s->extra = 2;
@ -2448,7 +2448,7 @@ void rr_specialstats()
if (s->extra == 2)
{
s->extra = 0;
resetpins(s->sectnum);
resetpins(s->sector());
}
}
}
@ -4097,7 +4097,7 @@ void destroyit(DDukeActor *actor)
DukeStatIterator it(STAT_DESTRUCT);
while (auto a2 = it.Next())
{
int it_sect = a2->s->sectnum;
auto it_sect = a2->s->sector();
if (hitag && hitag == a2->s->hitag)
{
DukeSectIterator its(it_sect);
@ -4110,13 +4110,13 @@ void destroyit(DDukeActor *actor)
}
}
}
if (spr && spr->s->sectnum != it_sect)
if (spr && spr->s->sector() != it_sect)
if (lotag == a2->s->lotag)
{
sectnum = spr->s->sectnum;
auto destsect = spr->getSector();
auto srcsect = &sector[it_sect];
auto srcsect = it_sect;
auto destwal = destsect->firstWall();
auto srcwal = srcsect->firstWall();
@ -4152,7 +4152,7 @@ void destroyit(DDukeActor *actor)
destsect->floorxpan_ = srcsect->floorxpan_;
destsect->floorypan_ = srcsect->floorypan_;
destsect->visibility = srcsect->visibility;
sectorextra[sectnum] = sectorextra[it_sect]; // TRANSITIONAL: at least rename this.
sectorextra[sectnum] = sectorextra[::sectnum(it_sect)]; // TRANSITIONAL: at least rename this.
destsect->lotag = srcsect->lotag;
destsect->hitag = srcsect->hitag;
destsect->extra = srcsect->extra;

View file

@ -50,16 +50,15 @@ void ballreturn(DDukeActor *ball)
{
act2->s->lotag = 100;
act2->s->extra++;
pinsectorresetdown(act2->s->sectnum);
pinsectorresetdown(act2->getSector());
}
}
}
}
}
void pinsectorresetdown(int sect)
void pinsectorresetdown(sectortype* sec)
{
auto sec = &sector[sect];
int j = getanimationgoal(anim_ceilingz, sec);
if (j == -1)
@ -69,9 +68,8 @@ void pinsectorresetdown(int sect)
}
}
int pinsectorresetup(int sect)
int pinsectorresetup(sectortype* sec)
{
auto sec = &sector[sect];
int j = getanimationgoal(anim_ceilingz, sec);
if (j == -1)
@ -83,7 +81,7 @@ int pinsectorresetup(int sect)
return 0;
}
int checkpins(int sect)
int checkpins(sectortype* sect)
{
int x, y;
bool pins[10] = {};
@ -165,7 +163,7 @@ int checkpins(int sect)
return pin;
}
void resetpins(int sect)
void resetpins(sectortype* sect)
{
int i, tag = 0;
int x, y;

View file

@ -2674,12 +2674,12 @@ static void fireweapon(int snum)
//
//---------------------------------------------------------------------------
static void operateweapon(int snum, ESyncBits actions, int psect)
static void operateweapon(int snum, ESyncBits actions, sectortype* psectp)
{
auto p = &ps[snum];
auto pact = p->GetActor();
int i, k;
int psectlotag = sector[psect].lotag;
int psectlotag = psectp->lotag;
if (!isRRRA() && p->curr_weapon >= MOTORCYCLE_WEAPON) return;
switch (p->curr_weapon)
@ -3266,7 +3266,7 @@ static void operateweapon(int snum, ESyncBits actions, int psect)
//
//---------------------------------------------------------------------------
static void processweapon(int snum, ESyncBits actions, int psect)
static void processweapon(int snum, ESyncBits actions, sectortype* psectp)
{
auto p = &ps[snum];
auto pact = p->GetActor();
@ -3312,7 +3312,7 @@ static void processweapon(int snum, ESyncBits actions, int psect)
}
else if (p->kickback_pic)
{
operateweapon(snum, actions, psect);
operateweapon(snum, actions, psectp);
}
}
@ -3543,7 +3543,7 @@ void processinput_r(int snum)
fi.doincrements(p);
if (p->curr_weapon == THROWINGDYNAMITE_WEAPON) processweapon(snum, actions, psect);
if (p->curr_weapon == THROWINGDYNAMITE_WEAPON) processweapon(snum, actions, psectp);
return;
}
@ -3887,7 +3887,7 @@ HORIZONLY:
if (psectlotag < 3)
{
psect = s->sectnum;
psectp = &sector[psect];
psectp = s->sector();
if (ud.clipping == 0 && psectp->lotag == ST_31_TWO_WAY_TRAIN)
{
auto act = ScriptIndexToActor(psectp->hitag);
@ -4007,7 +4007,7 @@ HORIZONLY:
else p->weapon_pos--;
}
processweapon(snum, actions, psect);
processweapon(snum, actions, psectp);
}
//---------------------------------------------------------------------------

View file

@ -298,7 +298,7 @@ void prelevel_d(int g)
case CYCLER:
if (numcyclers >= MAXCYCLERS)
I_Error("Too many cycling sectors.");
cyclers[numcyclers].sectnum = si->sectnum;
cyclers[numcyclers].sector = si->sector();
cyclers[numcyclers].lotag = si->lotag;
cyclers[numcyclers].shade1 = si->shade;
cyclers[numcyclers].shade2 = si->sector()->floorshade;

View file

@ -549,7 +549,7 @@ void prelevel_r(int g)
case CYCLER:
if (numcyclers >= MAXCYCLERS)
I_Error("Too many cycling sectors.");
cyclers[numcyclers].sectnum = si->sectnum;
cyclers[numcyclers].sector = si->sector();
cyclers[numcyclers].lotag = si->lotag;
cyclers[numcyclers].shade1 = si->shade;
cyclers[numcyclers].shade2 = si->sector()->floorshade;

View file

@ -339,7 +339,7 @@ FSerializer& Serialize(FSerializer& arc, const char* keyname, Cycler& w, Cycler*
if (!def) def = &nul;
if (arc.BeginObject(keyname))
{
arc("sector", w.sectnum, def->sectnum)
arc("sector", w.sector, def->sector)
("lotag", w.lotag, def->lotag)
("hitag", w.hitag, def->hitag)
("shade1", w.shade1, def->shade1)

View file

@ -1086,7 +1086,7 @@ void operateactivators(int low, int plnum)
if (p->hitag == low)
{
auto sect = p->sector();
auto sect = p->sector;
p->state = !p->state;
sect->floorshade = sect->ceilingshade = (int8_t)p->shade2;

View file

@ -97,7 +97,7 @@ struct DDukeActor
sectortype* getSector() const
{
return &sector[s->sectnum];
return s->sector();
}
@ -318,14 +318,12 @@ struct player_struct
struct Cycler
{
int sectnum;
sectortype* sector;
int16_t lotag;
int16_t hitag;
int16_t shade1;
int16_t shade2;
bool state;
sectortype* sector() const { return &::sector[sectnum]; }
};
// Wrapper around the insane collision info mess from Build.