- detonate and movemasterswitch.

# Conflicts:
#	source/games/duke/src/actors.cpp
This commit is contained in:
Christoph Oelckers 2020-10-21 21:57:18 +02:00
parent 89d750c94f
commit 81717b54ee
3 changed files with 39 additions and 29 deletions

View file

@ -927,20 +927,17 @@ void moveflammable(DDukeActor* actor, int tire, int box, int pool)
// //
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
void detonate(int i, int explosion) void detonate(DDukeActor *actor, int explosion)
{ {
auto spri = &sprite[i]; auto spri = &actor->s;
auto actor = &hittype[i]; int* t = &actor->temp_data[0];
auto t = &hittype[i].temp_data[0];
earthquaketime = 16; earthquaketime = 16;
int j; DukeStatIterator itj(STAT_EFFECTOR);
StatIterator itj(STAT_EFFECTOR); while (auto effector = itj.Next())
while ((j = itj.NextIndex()) >= 0)
{ {
auto sj = &sprite[j]; auto sj = &effector->s;
auto effector = &hittype[j]; if (actor->s.hitag == sj->hitag)
if (spri->hitag == sj->hitag)
{ {
if (sj->lotag == SE_13_EXPLOSIVE) if (sj->lotag == SE_13_EXPLOSIVE)
{ {
@ -964,15 +961,15 @@ void detonate(int i, int explosion)
if ((t[3] == 1 && spri->xrepeat) || spri->lotag == -99) if ((t[3] == 1 && spri->xrepeat) || spri->lotag == -99)
{ {
int x = spri->extra; int x = spri->extra;
fi.spawn(i, explosion); spawn(actor, explosion);
fi.hitradius(i, seenineblastradius, x >> 2, x - (x >> 1), x - (x >> 2), x); fi.hitradius(actor->GetIndex(), seenineblastradius, x >> 2, x - (x >> 1), x - (x >> 2), x);
S_PlayActorSound(PIPEBOMB_EXPLODE, i); S_PlayActorSound(PIPEBOMB_EXPLODE, actor);
} }
if (spri->xrepeat) if (spri->xrepeat)
for (int x = 0; x < 8; x++) RANDOMSCRAP(spri, i); for (int x = 0; x < 8; x++) RANDOMSCRAP(actor);
deletesprite(i); deletesprite(actor);
} }
@ -982,23 +979,21 @@ void detonate(int i, int explosion)
// //
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
void movemasterswitch(int i, int spectype1, int spectype2) void movemasterswitch(DDukeActor *actor, int spectype1, int spectype2)
{ {
auto spri = &sprite[i]; auto spri = &actor->s;
auto t = &hittype[i].temp_data[0];
if (spri->yvel == 1) if (spri->yvel == 1)
{ {
spri->hitag--; spri->hitag--;
if (spri->hitag <= 0) if (spri->hitag <= 0)
{ {
operatesectors(spri->sectnum, i); operatesectors(spri->sectnum, actor);
SectIterator it(spri->sectnum); DukeSectIterator it(spri->sectnum);
int j; while (auto effector = it.Next())
while ((j = it.NextIndex()) >= 0)
{ {
auto sj = &sprite[j]; auto sj = &effector->s;
if (sj->statnum == 3) if (sj->statnum == STAT_EFFECTOR)
{ {
switch (sj->lotag) switch (sj->lotag)
{ {
@ -1007,10 +1002,10 @@ void movemasterswitch(int i, int spectype1, int spectype2)
case SE_31_FLOOR_RISE_FALL: case SE_31_FLOOR_RISE_FALL:
case SE_32_CEILING_RISE_FALL: case SE_32_CEILING_RISE_FALL:
case SE_36_PROJ_SHOOTER: case SE_36_PROJ_SHOOTER:
hittype[j].temp_data[0] = 1; effector->temp_data[0] = 1;
break; break;
case SE_3_RANDOM_LIGHTS_AFTER_SHOT_OUT: case SE_3_RANDOM_LIGHTS_AFTER_SHOT_OUT:
hittype[j].temp_data[4] = 1; effector->temp_data[4] = 1;
break; break;
} }
} }
@ -1022,7 +1017,7 @@ void movemasterswitch(int i, int spectype1, int spectype2)
} }
} }
} }
deletesprite(i); deletesprite(actor);
} }
} }
} }

View file

@ -260,4 +260,19 @@ inline int findplayer(DDukeActor* act, int* x)
return findplayer(&act->s, x); return findplayer(&act->s, x);
} }
inline void operatesectors(int s, DDukeActor* i)
{
operatesectors(s, i->GetIndex());
}
inline void detonate(int i, int explosion)
{
detonate(&hittype[i], explosion);
}
inline void movemasterswitch(int i, int spectype1, int spectype2)
{
movemasterswitch(&hittype[i], spectype1, spectype2);
}
END_DUKE_NS END_DUKE_NS

View file

@ -33,8 +33,8 @@ void ms(DDukeActor* i);
void movecrane(DDukeActor* i, int crane); void movecrane(DDukeActor* i, int crane);
void movefountain(DDukeActor* i, int fountain); void movefountain(DDukeActor* i, int fountain);
void moveflammable(DDukeActor* i, int tire, int box, int pool); void moveflammable(DDukeActor* i, int tire, int box, int pool);
void detonate(int i, int explosion); void detonate(DDukeActor* i, int explosion);
void movemasterswitch(int i, int spectype1, int spectype2); void movemasterswitch(DDukeActor* i, int spectype1, int spectype2);
void movetrash(int i); void movetrash(int i);
void movewaterdrip(int i, int drip); void movewaterdrip(int i, int drip);
void movedoorshock(int i); void movedoorshock(int i);