- moveeffectors.

This commit is contained in:
Christoph Oelckers 2020-10-22 23:17:51 +02:00
parent c438061b83
commit a6f9673403
2 changed files with 107 additions and 132 deletions

View File

@ -3621,122 +3621,107 @@ static void handle_se28(DDukeActor* actor)
void moveeffectors_d(void) //STATNUM 3 void moveeffectors_d(void) //STATNUM 3
{ {
int q = 0, l, x, st, j, * t; int l;
int p, sh;
short k;
spritetype* s;
sectortype* sc;
walltype* wal;
clearfriction(); clearfriction();
DukeStatIterator it(STAT_EFFECTOR);
StatIterator it(STAT_EFFECTOR); while (auto act = it.Next())
int i;
while ((i = it.NextIndex()) >= 0)
{ {
s = &sprite[i]; auto sc = &sector[act->s.sectnum];
switch (act->s.lotag)
sc = &sector[s->sectnum];
st = s->lotag;
sh = s->hitag;
t = &hittype[i].temp_data[0];
switch (st)
{ {
case SE_0_ROTATING_SECTOR: case SE_0_ROTATING_SECTOR:
handle_se00(&hittype[i], LASERLINE); handle_se00(act, LASERLINE);
break; break;
case SE_1_PIVOT: //Nothing for now used as the pivot case SE_1_PIVOT: //Nothing for now used as the pivot
handle_se01(&hittype[i]); handle_se01(act);
break; break;
case SE_6_SUBWAY: case SE_6_SUBWAY:
handle_se06_d(&hittype[i]); handle_se06_d(act);
break; break;
case SE_14_SUBWAY_CAR: case SE_14_SUBWAY_CAR:
handle_se14(&hittype[i], true, RPG, JIBS6); handle_se14(act, true, RPG, JIBS6);
break; break;
case SE_30_TWO_WAY_TRAIN: case SE_30_TWO_WAY_TRAIN:
handle_se30(&hittype[i], JIBS6); handle_se30(act, JIBS6);
break; break;
case SE_2_EARTHQUAKE: case SE_2_EARTHQUAKE:
handle_se02(&hittype[i]); handle_se02(act);
break; break;
//Flashing sector lights after reactor EXPLOSION2 //Flashing sector lights after reactor EXPLOSION2
case SE_3_RANDOM_LIGHTS_AFTER_SHOT_OUT: case SE_3_RANDOM_LIGHTS_AFTER_SHOT_OUT:
handle_se03(&hittype[i]); handle_se03(act);
break; break;
case SE_4_RANDOM_LIGHTS: case SE_4_RANDOM_LIGHTS:
handle_se04(&hittype[i]); handle_se04(act);
break; break;
//BOSS //BOSS
case SE_5_BOSS: case SE_5_BOSS:
handle_se05(&hittype[i], FIRELASER); handle_se05(act, FIRELASER);
break; break;
case SE_8_UP_OPEN_DOOR_LIGHTS: case SE_8_UP_OPEN_DOOR_LIGHTS:
case SE_9_DOWN_OPEN_DOOR_LIGHTS: case SE_9_DOWN_OPEN_DOOR_LIGHTS:
handle_se08(&hittype[i], false); handle_se08(act, false);
break; break;
case SE_10_DOOR_AUTO_CLOSE: case SE_10_DOOR_AUTO_CLOSE:
{ {
static const int tags[] = { 20, 21, 22, 26, 0}; static const int tags[] = { 20, 21, 22, 26, 0};
handle_se10(&hittype[i], tags); handle_se10(act, tags);
break; break;
} }
case SE_11_SWINGING_DOOR: case SE_11_SWINGING_DOOR:
handle_se11(&hittype[i]); handle_se11(act);
break; break;
case SE_12_LIGHT_SWITCH: case SE_12_LIGHT_SWITCH:
handle_se12(&hittype[i]); handle_se12(act);
break; break;
case SE_13_EXPLOSIVE: case SE_13_EXPLOSIVE:
handle_se13(&hittype[i]); handle_se13(act);
break; break;
case SE_15_SLIDING_DOOR: case SE_15_SLIDING_DOOR:
handle_se15(&hittype[i]); handle_se15(act);
break; break;
case SE_16_REACTOR: case SE_16_REACTOR:
handle_se16(&hittype[i], REACTOR, REACTOR2); handle_se16(act, REACTOR, REACTOR2);
break; break;
case SE_17_WARP_ELEVATOR: case SE_17_WARP_ELEVATOR:
handle_se17(&hittype[i]); handle_se17(act);
break; break;
case SE_18_INCREMENTAL_SECTOR_RISE_FALL: case SE_18_INCREMENTAL_SECTOR_RISE_FALL:
handle_se18(&hittype[i], true); handle_se18(act, true);
break; break;
case SE_19_EXPLOSION_LOWERS_CEILING: case SE_19_EXPLOSION_LOWERS_CEILING:
handle_se19(&hittype[i], BIGFORCE); handle_se19(act, BIGFORCE);
break; break;
case SE_20_STRETCH_BRIDGE: case SE_20_STRETCH_BRIDGE:
handle_se20(&hittype[i]); handle_se20(act);
break; break;
case SE_21_DROP_FLOOR: case SE_21_DROP_FLOOR:
handle_se21(&hittype[i]); handle_se21(act);
break; break;
case SE_22_TEETH_DOOR: case SE_22_TEETH_DOOR:
handle_se22(&hittype[i]); handle_se22(act);
break; break;
@ -3745,81 +3730,80 @@ void moveeffectors_d(void) //STATNUM 3
{ {
static int16_t list1[] = { BLOODPOOL, PUKE, FOOTPRINTS, FOOTPRINTS2, FOOTPRINTS3, FOOTPRINTS4, BULLETHOLE, BLOODSPLAT1, BLOODSPLAT2, BLOODSPLAT3, BLOODSPLAT4, -1 }; static int16_t list1[] = { BLOODPOOL, PUKE, FOOTPRINTS, FOOTPRINTS2, FOOTPRINTS3, FOOTPRINTS4, BULLETHOLE, BLOODSPLAT1, BLOODSPLAT2, BLOODSPLAT3, BLOODSPLAT4, -1 };
static int16_t list2[] = { BOLT1, BOLT1 + 1,BOLT1 + 2, BOLT1 + 3, SIDEBOLT1, SIDEBOLT1 + 1, SIDEBOLT1 + 2, SIDEBOLT1 + 3, -1 }; static int16_t list2[] = { BOLT1, BOLT1 + 1,BOLT1 + 2, BOLT1 + 3, SIDEBOLT1, SIDEBOLT1 + 1, SIDEBOLT1 + 2, SIDEBOLT1 + 3, -1 };
handle_se24(&hittype[i], list1, list2, TRIPBOMB, LASERLINE, CRANE, 2); handle_se24(act, list1, list2, TRIPBOMB, LASERLINE, CRANE, 2);
break; break;
} }
case 35: case 35:
handle_se35(&hittype[i], SMALLSMOKE, EXPLOSION2); handle_se35(act, SMALLSMOKE, EXPLOSION2);
break; break;
case 25: //PISTONS case 25: //PISTONS
if (hittype[i].temp_data[4] == 0) break; if (act->temp_data[4] == 0) break;
handle_se25(&hittype[i], 3, -1, -1); handle_se25(act, 3, -1, -1);
break; break;
case 26: case 26:
handle_se26(&hittype[i]); handle_se26(act);
break; break;
case SE_27_DEMO_CAM: case SE_27_DEMO_CAM:
handle_se27(&hittype[i]); handle_se27(act);
break; break;
case 28: case 28:
handle_se28(&hittype[i]); handle_se28(act);
break; break;
case 29: case 29:
s->hitag += 64; act->s.hitag += 64;
l = mulscale12((int)s->yvel, sintable[s->hitag & 2047]); l = mulscale12((int)act->s.yvel, sintable[act->s.hitag & 2047]);
sc->floorz = s->z + l; sc->floorz = act->s.z + l;
break; break;
case 31: // True Drop Floor case 31: // True Drop Floor
handle_se31(&hittype[i], true); handle_se31(act, true);
break; break;
case 32: // True Drop Ceiling case 32: // True Drop Ceiling
handle_se32(&hittype[i]); handle_se32(act);
break; break;
case 33: case 33:
if (earthquaketime > 0 && (krand() & 7) == 0) if (earthquaketime > 0 && (krand() & 7) == 0)
RANDOMSCRAP(s, i); RANDOMSCRAP(act);
break; break;
case 36: case 36:
if (t[0]) if (act->temp_data[0])
{ {
if (t[0] == 1) if (act->temp_data[0] == 1)
fi.shoot(i, sc->extra); fi.shoot(act->GetIndex(), sc->extra);
else if (t[0] == 26 * 5) else if (act->temp_data[0] == 26 * 5)
t[0] = 0; act->temp_data[0] = 0;
t[0]++; act->temp_data[0]++;
} }
break; break;
case 128: //SE to control glass breakage case 128: //SE to control glass breakage
handle_se128(&hittype[i]); handle_se128(act);
break; break;
case 130: case 130:
handle_se130(&hittype[i], 80, EXPLOSION2); handle_se130(act, 80, EXPLOSION2);
break; break;
case 131: case 131:
handle_se130(&hittype[i], 40, EXPLOSION2); handle_se130(act, 40, EXPLOSION2);
break; break;
} }
} }
//Sloped sin-wave floors! //Sloped sin-wave floors!
it.Reset(STAT_EFFECTOR); it.Reset(STAT_EFFECTOR);
while ((i = it.NextIndex()) >= 0) while (auto act = it.Next())
{ {
s = &sprite[i]; if (act->s.lotag != 29) continue;
if (s->lotag != 29) continue; auto sc = &sector[act->s.sectnum];
sc = &sector[s->sectnum];
if (sc->wallnum != 4) continue; if (sc->wallnum != 4) continue;
wal = &wall[sc->wallptr + 2]; auto wal = &wall[sc->wallptr + 2];
alignflorslope(s->sectnum, wal->x, wal->y, sector[wal->nextsector].floorz); alignflorslope(act->s.sectnum, wal->x, wal->y, sector[wal->nextsector].floorz);
} }
} }

View File

@ -3488,128 +3488,119 @@ void handle_se06_r(DDukeActor *actor)
void moveeffectors_r(void) //STATNUM 3 void moveeffectors_r(void) //STATNUM 3
{ {
int l, st, * t; int l;
int sh;
spritetype* s;
sectortype* sc;
walltype* wal;
clearfriction(); clearfriction();
DukeStatIterator it(STAT_EFFECTOR);
StatIterator it(STAT_EFFECTOR); while (auto act = it.Next())
int i;
while ((i = it.NextIndex()) >= 0)
{ {
s = &sprite[i]; auto sc = &sector[act->s.sectnum];
int st = act->s.lotag;
int sh = act->s.hitag;
sc = &sector[s->sectnum]; auto t = &act->temp_data[0];
st = s->lotag;
sh = s->hitag;
t = &hittype[i].temp_data[0];
switch (st) switch (st)
{ {
case SE_0_ROTATING_SECTOR: case SE_0_ROTATING_SECTOR:
handle_se00(&hittype[i], -1); handle_se00(act, -1);
break; break;
case SE_1_PIVOT: //Nothing for now used as the pivot case SE_1_PIVOT: //Nothing for now used as the pivot
handle_se01(&hittype[i]); handle_se01(act);
break; break;
case SE_6_SUBWAY: case SE_6_SUBWAY:
handle_se06_r(&hittype[i]); handle_se06_r(act);
case SE_14_SUBWAY_CAR: case SE_14_SUBWAY_CAR:
handle_se14(&hittype[i], false, RPG, JIBS6); handle_se14(act, false, RPG, JIBS6);
break; break;
case SE_30_TWO_WAY_TRAIN: case SE_30_TWO_WAY_TRAIN:
handle_se30(&hittype[i], JIBS6); handle_se30(act, JIBS6);
break; break;
case SE_2_EARTHQUAKE: case SE_2_EARTHQUAKE:
handle_se02(&hittype[i]); handle_se02(act);
break; break;
//Flashing sector lights after reactor EXPLOSION2 //Flashing sector lights after reactor EXPLOSION2
case SE_3_RANDOM_LIGHTS_AFTER_SHOT_OUT: case SE_3_RANDOM_LIGHTS_AFTER_SHOT_OUT:
handle_se03(&hittype[i]); handle_se03(act);
break; break;
case SE_4_RANDOM_LIGHTS: case SE_4_RANDOM_LIGHTS:
handle_se04(&hittype[i]); handle_se04(act);
break; break;
//BOSS //BOSS
case SE_5_BOSS: case SE_5_BOSS:
handle_se05(&hittype[i], FIRELASER); handle_se05(act, FIRELASER);
break; break;
case SE_8_UP_OPEN_DOOR_LIGHTS: case SE_8_UP_OPEN_DOOR_LIGHTS:
case SE_9_DOWN_OPEN_DOOR_LIGHTS: case SE_9_DOWN_OPEN_DOOR_LIGHTS:
handle_se08(&hittype[i], true); handle_se08(act, true);
break; break;
case SE_10_DOOR_AUTO_CLOSE: case SE_10_DOOR_AUTO_CLOSE:
handle_se10(act, nullptr);
handle_se10(&hittype[i], nullptr);
break; break;
case SE_11_SWINGING_DOOR: case SE_11_SWINGING_DOOR:
handle_se11(&hittype[i]); handle_se11(act);
break; break;
case SE_12_LIGHT_SWITCH: case SE_12_LIGHT_SWITCH:
handle_se12(&hittype[i]); handle_se12(act);
break; break;
case SE_47_LIGHT_SWITCH: case SE_47_LIGHT_SWITCH:
if (isRRRA()) handle_se12(&hittype[i], 1); if (isRRRA()) handle_se12(act, 1);
break; break;
case SE_48_LIGHT_SWITCH: case SE_48_LIGHT_SWITCH:
if (isRRRA()) handle_se12(&hittype[i], 2); if (isRRRA()) handle_se12(act, 2);
break; break;
case SE_13_EXPLOSIVE: case SE_13_EXPLOSIVE:
handle_se13(&hittype[i]); handle_se13(act);
break; break;
case SE_15_SLIDING_DOOR: case SE_15_SLIDING_DOOR:
handle_se15(&hittype[i]); handle_se15(act);
break; break;
case SE_16_REACTOR: case SE_16_REACTOR:
handle_se16(&hittype[i], REACTOR, REACTOR2); handle_se16(act, REACTOR, REACTOR2);
break; break;
case SE_17_WARP_ELEVATOR: case SE_17_WARP_ELEVATOR:
handle_se17(&hittype[i]); handle_se17(act);
break; break;
case SE_18_INCREMENTAL_SECTOR_RISE_FALL: case SE_18_INCREMENTAL_SECTOR_RISE_FALL:
handle_se18(&hittype[i], true); handle_se18(act, true);
break; break;
case SE_19_EXPLOSION_LOWERS_CEILING: case SE_19_EXPLOSION_LOWERS_CEILING:
handle_se19(&hittype[i], BIGFORCE); handle_se19(act, BIGFORCE);
break; break;
case SE_20_STRETCH_BRIDGE: case SE_20_STRETCH_BRIDGE:
handle_se20(&hittype[i]); handle_se20(act);
break; break;
case SE_21_DROP_FLOOR: case SE_21_DROP_FLOOR:
handle_se21(&hittype[i]); handle_se21(act);
break; break;
case SE_22_TEETH_DOOR: case SE_22_TEETH_DOOR:
handle_se22(&hittype[i]); handle_se22(act);
break; break;
case 156: case 156:
@ -3619,51 +3610,51 @@ void moveeffectors_r(void) //STATNUM 3
{ {
static int16_t list1[] = { BLOODPOOL, PUKE, FOOTPRINTS, FOOTPRINTS2, FOOTPRINTS3, -1 }; static int16_t list1[] = { BLOODPOOL, PUKE, FOOTPRINTS, FOOTPRINTS2, FOOTPRINTS3, -1 };
static int16_t list2[] = { BOLT1, BOLT1 + 1,BOLT1 + 2, BOLT1 + 3, -1 }; static int16_t list2[] = { BOLT1, BOLT1 + 1,BOLT1 + 2, BOLT1 + 3, -1 };
handle_se24(&hittype[i], list1, list2, BULLETHOLE, -1, CRANE, 1); handle_se24(act, list1, list2, BULLETHOLE, -1, CRANE, 1);
break; break;
} }
case 35: case 35:
handle_se35(&hittype[i], SMALLSMOKE, EXPLOSION2); handle_se35(act, SMALLSMOKE, EXPLOSION2);
break; break;
case 25: //PISTONS case 25: //PISTONS
if (t[4] == 0) break; if (t[4] == 0) break;
handle_se25(&hittype[i], 4, isRRRA() ? 371 : -1, isRRRA() ? 167 : -1); handle_se25(act, 4, isRRRA() ? 371 : -1, isRRRA() ? 167 : -1);
break; break;
case 26: case 26:
handle_se26(&hittype[i]); handle_se26(act);
break; break;
case SE_27_DEMO_CAM: case SE_27_DEMO_CAM:
handle_se27(&hittype[i]); handle_se27(act);
break; break;
case 29: case 29:
s->hitag += 64; act->s.hitag += 64;
l = mulscale12((int)s->yvel, sintable[s->hitag & 2047]); l = mulscale12((int)act->s.yvel, sintable[act->s.hitag & 2047]);
sc->floorz = s->z + l; sc->floorz = act->s.z + l;
break; break;
case 31: // True Drop Floor case 31: // True Drop Floor
handle_se31(&hittype[i], false); handle_se31(act, false);
break; break;
case 32: // True Drop Ceiling case 32: // True Drop Ceiling
handle_se32(&hittype[i]); handle_se32(act);
break; break;
case 33: case 33:
if (earthquaketime > 0 && (krand() & 7) == 0) if (earthquaketime > 0 && (krand() & 7) == 0)
RANDOMSCRAP(s, i); RANDOMSCRAP(act);
break; break;
case 36: case 36:
if (t[0]) if (t[0])
{ {
if (t[0] == 1) if (t[0] == 1)
fi.shoot(i, sc->extra); fi.shoot(act->GetIndex(), sc->extra);
else if (t[0] == 26 * 5) else if (t[0] == 26 * 5)
t[0] = 0; t[0] = 0;
t[0]++; t[0]++;
@ -3671,28 +3662,28 @@ void moveeffectors_r(void) //STATNUM 3
break; break;
case 128: //SE to control glass breakage case 128: //SE to control glass breakage
handle_se128(&hittype[i]); handle_se128(act);
break; break;
case 130: case 130:
handle_se130(&hittype[i], 80, EXPLOSION2); handle_se130(act, 80, EXPLOSION2);
break; break;
case 131: case 131:
handle_se130(&hittype[i], 40, EXPLOSION2); handle_se130(act, 40, EXPLOSION2);
break; break;
} }
} }
//Sloped sin-wave floors! //Sloped sin-wave floors!
it.Reset(STAT_EFFECTOR); it.Reset(STAT_EFFECTOR);
while ((i = it.NextIndex()) >= 0) while (auto act = it.Next())
{ {
s = &sprite[i]; auto s = &act->s;
if (s->lotag != 29) continue; if (act->s.lotag != 29) continue;
sc = &sector[s->sectnum]; auto sc = &sector[act->s.sectnum];
if (sc->wallnum != 4) continue; if (sc->wallnum != 4) continue;
wal = &wall[sc->wallptr + 2]; auto wal = &wall[sc->wallptr + 2];
alignflorslope(s->sectnum, wal->x, wal->y, sector[wal->nextsector].floorz); alignflorslope(act->s.sectnum, wal->x, wal->y, sector[wal->nextsector].floorz);
} }
} }