- operateactivators and operatemasterswitches.

This commit is contained in:
Christoph Oelckers 2020-10-23 19:35:59 +02:00
parent 7635fc9ad6
commit 4236f800f6
7 changed files with 36 additions and 45 deletions

View file

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

View file

@ -279,11 +279,6 @@ inline int findplayer(spritetype* act, int* x)
return findplayer(&hittype[act - sprite], x);
}
inline void operatesectors(int s, DDukeActor* i)
{
operatesectors(s, i->GetIndex());
}
inline void detonate(int i, int explosion)
{
detonate(&hittype[i], explosion);

View file

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

View file

@ -2519,7 +2519,7 @@ int ParseState::parse(void)
break;
}
if (j == -1)
operatesectors(neartagsector, g_i);
operatesectors(neartagsector, g_ac);
}
}
break;

View file

@ -944,9 +944,8 @@ static void handle_st28(int sn, DDukeActor* actor)
//
//---------------------------------------------------------------------------
void operatesectors(int sn, int ii)
void operatesectors(int sn, DDukeActor *actor)
{
auto actor = &hittype[ii];
int j=0, startwall, endwall;
int i;
sectortype* sptr;
@ -1064,7 +1063,7 @@ void operatesectors(int sn, int ii)
//
//---------------------------------------------------------------------------
void operateactivators(int low, int snum)
void operateactivators(int low, int plnum)
{
int i, j, k;
short * p;
@ -1086,66 +1085,65 @@ void operateactivators(int low, int snum)
}
k = -1;
StatIterator it(STAT_ACTIVATOR);
while ((i = it.NextIndex()) >= 0)
DukeStatIterator it(STAT_ACTIVATOR);
while (auto act = it.Next())
{
auto si = &hittype[i].s;
if (si->lotag == low)
if (act->s.lotag == low)
{
if (si->picnum == ACTIVATORLOCKED)
if (act->s.picnum == ACTIVATORLOCKED)
{
sector[si->sectnum].lotag ^= 16384;
sector[act->s.sectnum].lotag ^= 16384;
if (snum >= 0)
if (plnum >= 0)
{
if (sector[si->sectnum].lotag & 16384)
FTA(4, &ps[snum]);
else FTA(8, &ps[snum]);
if (sector[act->s.sectnum].lotag & 16384)
FTA(4, &ps[plnum]);
else FTA(8, &ps[plnum]);
}
}
else
{
switch (si->hitag)
switch (act->s.hitag)
{
case 0:
break;
case 1:
if (sector[si->sectnum].floorz != sector[si->sectnum].ceilingz)
if (sector[act->s.sectnum].floorz != sector[act->s.sectnum].ceilingz)
{
continue;
}
break;
case 2:
if (sector[si->sectnum].floorz == sector[si->sectnum].ceilingz)
if (sector[act->s.sectnum].floorz == sector[act->s.sectnum].ceilingz)
{
continue;
}
break;
}
if (sector[si->sectnum].lotag < 3)
if (sector[act->s.sectnum].lotag < 3)
{
SectIterator it(si->sectnum);
while ((j = it.NextIndex()) >= 0)
DukeSectIterator it(act->s.sectnum);
while (auto a2 = it.Next())
{
if (sprite[j].statnum == 3) switch (sprite[j].lotag)
if (a2->s.statnum == 3) switch (a2->s.lotag)
{
case SE_18_INCREMENTAL_SECTOR_RISE_FALL:
if (isRRRA()) break;
case SE_36_PROJ_SHOOTER:
case SE_31_FLOOR_RISE_FALL:
case SE_32_CEILING_RISE_FALL:
hittype[j].temp_data[0] = 1 - hittype[j].temp_data[0];
callsound(si->sectnum, j);
a2->temp_data[0] = 1 - a2->temp_data[0];
callsound(act->s.sectnum, a2);
break;
}
}
}
if (k == -1 && (sector[si->sectnum].lotag & 0xff) == 22)
k = callsound(si->sectnum, i);
if (k == -1 && (sector[act->s.sectnum].lotag & 0xff) == 22)
k = callsound(act->s.sectnum, act);
operatesectors(si->sectnum, i);
operatesectors(act->s.sectnum, act);
}
}
}
@ -1161,13 +1159,11 @@ void operateactivators(int low, int snum)
void operatemasterswitches(int low)
{
int i;
StatIterator it(STAT_STANDABLE);
while ((i = it.NextIndex()) >= 0)
DukeStatIterator it(STAT_STANDABLE);
while (auto act2 = it.Next())
{
if (sprite[i].picnum == MASTERSWITCH && sprite[i].lotag == low && sprite[i].yvel == 0)
sprite[i].yvel = 1;
if (act2->s.picnum == MASTERSWITCH && act2->s.lotag == low && act2->s.yvel == 0)
act2->s.yvel = 1;
}
}

View file

@ -630,7 +630,7 @@ void activatebysector_d(int sect, int j)
}
if (didit == 0)
operatesectors(sect, j);
operatesectors(sect, &hittype[j]);
}
//---------------------------------------------------------------------------
@ -1775,7 +1775,7 @@ void checksectors_d(int snum)
if (sprite[i].picnum == ACTIVATOR || sprite[i].picnum == MASTERSWITCH)
return;
}
operatesectors(neartagsector, p->i);
operatesectors(neartagsector, p->GetActor());
}
else if ((sector[sprite[p->i].sectnum].lotag & 16384) == 0)
{
@ -1786,7 +1786,7 @@ void checksectors_d(int snum)
{
if (sprite[i].picnum == ACTIVATOR || sprite[i].picnum == MASTERSWITCH) return;
}
operatesectors(sprite[p->i].sectnum, p->i);
operatesectors(sprite[p->i].sectnum, p->GetActor());
}
else fi.checkhitswitch(snum, neartagwall, 0);
}

View file

@ -906,7 +906,7 @@ void activatebysector_r(int sect, int j)
}
if (sector[sect].lotag != 22)
operatesectors(sect, j);
operatesectors(sect, &hittype[j]);
}
@ -2723,7 +2723,7 @@ void checksectors_r(int snum)
return;
}
if (haskey(neartagsector, snum))
operatesectors(neartagsector, p->i);
operatesectors(neartagsector, p->GetActor());
else
{
if (hittype[neartagsprite].spriteextra > 3)
@ -2743,7 +2743,7 @@ void checksectors_r(int snum)
if (sprite[i].picnum == ACTIVATOR || sprite[i].picnum == MASTERSWITCH) return;
}
if (haskey(neartagsector, snum))
operatesectors(sprite[p->i].sectnum, p->i);
operatesectors(sprite[p->i].sectnum, p->GetActor());
else
{
if (hittype[neartagsprite].spriteextra > 3)