- operatesectors and activatebysector.

This commit is contained in:
Christoph Oelckers 2021-11-18 18:51:19 +01:00
parent c57c007010
commit 876d1dbe1f
11 changed files with 32 additions and 35 deletions

View file

@ -973,7 +973,7 @@ void movemasterswitch(DDukeActor *actor, int spectype1, int spectype2)
spri->hitag--;
if (spri->hitag <= 0)
{
operatesectors(spri->sectnum, actor);
operatesectors(spri->sector(), actor);
DukeSectIterator it(spri->sectnum);
while (auto effector = it.Next())
@ -3597,7 +3597,7 @@ void handle_se10(DDukeActor* actor, const int* specialtags)
return;
}
}
fi.activatebysector(s->sectnum, actor);
fi.activatebysector(s->sector(), actor);
t[0] = 0;
}
else t[0]++;

View file

@ -109,7 +109,7 @@ static const char* cheatUnlock()
{
if (j & (0xffff - 16384))
sect.lotag &= (0xffff - 16384);
operatesectors(sectnum(&sect), ps[myconnectindex].GetActor());
operatesectors(&sect, ps[myconnectindex].GetActor());
}
}
fi.operateforcefields(ps[myconnectindex].GetActor(), -1);

View file

@ -45,8 +45,8 @@ void operateforcefields_r(DDukeActor* act, int low);
void operateforcefields_d(DDukeActor* act, int low);
bool checkhitswitch_d(int snum, walltype* w, DDukeActor *act);
bool checkhitswitch_r(int snum, walltype* w, DDukeActor* act);
void activatebysector_d(int sect, DDukeActor* j);
void activatebysector_r(int sect, DDukeActor* j);
void activatebysector_d(sectortype* sect, DDukeActor* j);
void activatebysector_r(sectortype* sect, DDukeActor* j);
void checkhitwall_d(DDukeActor* spr, walltype* dawall, int x, int y, int z, int atwith);
void checkhitwall_r(DDukeActor* spr, walltype* dawall, int x, int y, int z, int atwith);
bool checkhitceiling_d(sectortype* sn);

View file

@ -83,7 +83,7 @@ struct Dispatcher
void (*operaterespawns)(int low);
void (*operateforcefields)(DDukeActor* act, int low);
bool (*checkhitswitch)(int snum, walltype* w, DDukeActor* act);
void (*activatebysector)(int sect, DDukeActor* j);
void (*activatebysector)(sectortype* sect, DDukeActor* j);
void (*checkhitwall)(DDukeActor* spr, walltype* dawall, int x, int y, int z, int atwith);
bool (*checkhitceiling)(sectortype* sn);
void (*checkhitsprite)(DDukeActor* i, DDukeActor* sn);

View file

@ -148,7 +148,7 @@ int check_activator_motion(int lotag);
void operateactivators(int l, int w);
void operateforcefields_common(DDukeActor* s, int low, const std::initializer_list<int>& tiles);
void operatemasterswitches(int lotag);
void operatesectors(int s, DDukeActor* i);
void operatesectors(sectortype* s, DDukeActor* i);
void hud_input(int playerNum);
int getanimationgoal(int animtype, int animindex);
bool isanearoperator(int lotag);

View file

@ -2495,7 +2495,7 @@ int ParseState::parse(void)
break;
}
if (a2 == nullptr)
operatesectors(sectnum(sectp), g_ac);
operatesectors(sectp, g_ac);
}
}
}

View file

@ -3092,7 +3092,7 @@ HORIZONLY:
{
if (!(s->sector()->lotag & 0x8000) && (isanunderoperator(s->sector()->lotag) ||
isanearoperator(s->sector()->lotag)))
fi.activatebysector(s->sectnum, pact);
fi.activatebysector(s->sector(), pact);
if (j)
{
quickkill(p);
@ -3100,7 +3100,7 @@ HORIZONLY:
}
}
else if (abs(fz - cz) < (32 << 8) && isanunderoperator(psectp->lotag))
fi.activatebysector(psect, pact);
fi.activatebysector(psectp, pact);
}
// center_view

View file

@ -3923,7 +3923,7 @@ HORIZONLY:
{
if (!(s->sector()->lotag & 0x8000) && (isanunderoperator(s->sector()->lotag) ||
isanearoperator(s->sector()->lotag)))
fi.activatebysector(s->sectnum, pact);
fi.activatebysector(s->sector(), pact);
if (j)
{
quickkill(p);
@ -3931,7 +3931,7 @@ HORIZONLY:
}
}
else if (abs(fz - cz) < (32 << 8) && isanunderoperator(psectp->lotag))
fi.activatebysector(psect, pact);
fi.activatebysector(psectp, pact);
}
if (ud.clipping == 0 && p->cursector()->ceilingz > (p->cursector()->floorz - (12 << 8)))

View file

@ -967,13 +967,10 @@ static void handle_st28(sectortype* sptr, DDukeActor* actor)
//
//---------------------------------------------------------------------------
void operatesectors(int sn, DDukeActor *actor)
void operatesectors(sectortype* sptr, DDukeActor *actor)
{
int j=0;
int i;
sectortype* sptr;
sptr = &sector[sn];
switch (sptr->lotag & (0x3fff))
{
@ -986,8 +983,8 @@ void operatesectors(int sn, DDukeActor *actor)
if (!isRR()) break;
for (auto& wal : wallsofsector(sptr))
{
setanimation(sn, anim_vertexx, &wal, wal.x + 1024, 4);
if (wal.nextwall >= 0) setanimation(sn, anim_vertexx, wal.nextwall, wal.nextWall()->x + 1024, 4);
setanimation(sptr, anim_vertexx, &wal, wal.x + 1024, 4);
if (wal.nextwall >= 0) setanimation(sptr, anim_vertexx, wal.nextWall(), wal.nextWall()->x + 1024, 4);
}
break;
@ -995,7 +992,7 @@ void operatesectors(int sn, DDukeActor *actor)
{
auto act = ScriptIndexToActor(sptr->hitag);
if (!act) break;
if (act->tempang == 0 || act->tempang == 256) callsound(sn, actor);
if (act->tempang == 0 || act->tempang == 256) callsound(sptr, actor);
if (act->s->extra == 1) act->s->extra = 3;
else act->s->extra = 1;
break;
@ -1008,20 +1005,20 @@ void operatesectors(int sn, DDukeActor *actor)
if (act->temp_data[4] == 0)
act->temp_data[4] = 1;
callsound(sn, actor);
callsound(sptr, actor);
break;
}
case ST_26_SPLITTING_ST_DOOR: //The split doors
i = getanimationgoal(anim_ceilingz, sn);
i = getanimationgoal(anim_ceilingz, sectnum(sptr));
if (i == -1) //if the door has stopped
{
haltsoundhack = 1;
sptr->lotag &= 0xff00;
sptr->lotag |= ST_22_SPLITTING_DOOR;
operatesectors(sn, actor);
operatesectors(sptr, actor);
sptr->lotag &= 0xff00;
sptr->lotag |= ST_9_SLIDING_ST_DOOR;
operatesectors(sn, actor);
operatesectors(sptr, actor);
sptr->lotag &= 0xff00;
sptr->lotag |= ST_26_SPLITTING_ST_DOOR;
}
@ -1169,7 +1166,7 @@ void operateactivators(int low, int plnum)
if (k == -1 && (act->getSector()->lotag & 0xff) == 22)
k = callsound(act->s->sectnum, act);
operatesectors(act->s->sectnum, act);
operatesectors(act->s->sector(), act);
}
}
}

View file

@ -613,7 +613,7 @@ bool checkhitswitch_d(int snum, walltype* wwal, DDukeActor *act)
//
//---------------------------------------------------------------------------
void activatebysector_d(int sect, DDukeActor* activator)
void activatebysector_d(sectortype* sect, DDukeActor* activator)
{
int didit = 0;
@ -1801,7 +1801,7 @@ void checksectors_d(int snum)
if (act->s->picnum == ACTIVATOR || act->s->picnum == MASTERSWITCH)
return;
}
operatesectors(sectnum(ntsector), p->GetActor());
operatesectors(ntsector, p->GetActor());
}
else if ((p->GetActor()->getSector()->lotag & 16384) == 0)
{
@ -1812,7 +1812,7 @@ void checksectors_d(int snum)
{
if (act->s->picnum == ACTIVATOR || act->s->picnum == MASTERSWITCH) return;
}
operatesectors(p->GetActor()->s->sectnum, p->GetActor());
operatesectors(p->GetActor()->s->sector(), p->GetActor());
}
else fi.checkhitswitch(snum, ntwall, nullptr);
}

View file

@ -900,7 +900,7 @@ bool checkhitswitch_r(int snum, walltype* wwal, DDukeActor* act)
//
//---------------------------------------------------------------------------
void activatebysector_r(int sect, DDukeActor* activator)
void activatebysector_r(sectortype* sect, DDukeActor* activator)
{
DukeSectIterator it(sect);
while (auto act = it.Next())
@ -912,7 +912,7 @@ void activatebysector_r(int sect, DDukeActor* activator)
}
}
if (sector[sect].lotag != 22)
if (sect->lotag != 22)
operatesectors(sect, activator);
}
@ -926,9 +926,9 @@ void activatebysector_r(int sect, DDukeActor* activator)
static void lotsofpopcorn(DDukeActor *actor, walltype* wal, int n)
{
int j, z;
int sect, a;
int a;
sect = -1;
sectortype* sect = nullptr;
auto sp = actor->s;
if (wal == nullptr)
@ -960,9 +960,9 @@ static void lotsofpopcorn(DDukeActor *actor, walltype* wal, int n)
y1 += delta.y;
updatesector(x1, y1, &sect);
if (sect >= 0)
if (sect)
{
z = sector[sect].floorz - (krand() & (abs(sector[sect].ceilingz - sector[sect].floorz)));
z = sect->floorz - (krand() & (abs(sect->ceilingz - sect->floorz)));
if (z < -(32 << 8) || z >(32 << 8))
z = sp->z - (32 << 8) + (krand() & ((64 << 8) - 1));
a = sp->ang - 1024;
@ -2746,7 +2746,7 @@ void checksectors_r(int snum)
return;
}
if (haskey(sectnum(ntsector), snum))
operatesectors(sectnum(ntsector), p->GetActor());
operatesectors(ntsector, p->GetActor());
else
{
if (neartagsprite && neartagsprite->spriteextra > 3)
@ -2767,7 +2767,7 @@ void checksectors_r(int snum)
return;
}
if (haskey(sectnum(ntsector), snum))
operatesectors(p->GetActor()->s->sectnum, p->GetActor());
operatesectors(p->GetActor()->s->sector(), p->GetActor());
else
{
if (neartagsprite && neartagsprite->spriteextra > 3)