- movetransports.

This commit is contained in:
Christoph Oelckers 2020-10-22 21:42:02 +02:00
parent 076dcef5d0
commit 9826ff54f9
2 changed files with 183 additions and 193 deletions

View file

@ -2001,42 +2001,36 @@ void moveweapons_d(void)
void movetransports_d(void) void movetransports_d(void)
{ {
int warpspriteto; int warpspriteto;
int ll, onfloorz, q; int ll;
int i, j;
StatIterator iti(STAT_TRANSPORT); DukeStatIterator iti(STAT_TRANSPORT);
while ((i = iti.NextIndex()) >= 0) while (auto act = iti.Next())
{ {
auto spri = &sprite[i]; auto spr = &act->s;
auto act1 = &hittype[i]; auto Owner = act->GetOwner();
auto spriowner = spri->owner < 0? nullptr : &sprite[spri->owner];
int sect = spri->sectnum; if (Owner == act)
int sectlotag = sector[sect].lotag;
if (spri->owner == i)
{ {
continue; continue;
} }
int sect = spr->sectnum;
int sectlotag = sector[sect].lotag;
int onfloorz = act->temp_data[4];
onfloorz = act1->temp_data[4]; if (act->temp_data[0] > 0) act->temp_data[0]--;
if (act1->temp_data[0] > 0) act1->temp_data[0]--; DukeSectIterator itj(sect);
while (auto act2 = itj.Next())
SectIterator itj(sect);
while ((j = itj.NextIndex()) >= 0)
{ {
auto spr2 = &sprite[j]; auto spr2 = &act2->s;
auto act2 = &hittype[j];
switch (spr2->statnum) switch (spr2->statnum)
{ {
case STAT_PLAYER: // Player case STAT_PLAYER: // Player
if (spr2->owner != -1) if (act2->GetOwner())
{ {
int p = spr2->yvel; int p = act2->PlayerIndex();
ps[p].on_warping_sector = 1; ps[p].on_warping_sector = 1;
@ -2044,38 +2038,38 @@ void movetransports_d(void)
{ {
if (ps[p].on_ground && sectlotag == 0 && onfloorz && ps[p].jetpack_on == 0) if (ps[p].on_ground && sectlotag == 0 && onfloorz && ps[p].jetpack_on == 0)
{ {
if (spri->pal == 0) if (spr->pal == 0)
{ {
fi.spawn(i, TRANSPORTERBEAM); spawn(act, TRANSPORTERBEAM);
S_PlayActorSound(TELEPORTER, i); S_PlayActorSound(TELEPORTER, act);
} }
for (int k = connecthead; k >= 0; k = connectpoint2[k]) for (int k = connecthead; k >= 0; k = connectpoint2[k])
if (ps[k].cursectnum == spriowner->sectnum) if (ps[k].cursectnum == Owner->s.sectnum)
{ {
ps[k].frag_ps = p; ps[k].frag_ps = p;
sprite[ps[k].i].extra = 0; ps[k].GetActor()->s.extra = 0;
} }
ps[p].angle.ang = buildang(spriowner->ang); ps[p].angle.ang = buildang(Owner->s.ang);
if (spriowner->owner != spri->owner) if (Owner->GetOwner() != Owner)
{ {
act1->temp_data[0] = 13; act->temp_data[0] = 13;
hittype[spri->owner].temp_data[0] = 13; Owner->temp_data[0] = 13;
ps[p].transporter_hold = 13; ps[p].transporter_hold = 13;
} }
ps[p].bobposx = ps[p].oposx = ps[p].posx = spriowner->x; ps[p].bobposx = ps[p].oposx = ps[p].posx = Owner->s.x;
ps[p].bobposy = ps[p].oposy = ps[p].posy = spriowner->y; ps[p].bobposy = ps[p].oposy = ps[p].posy = Owner->s.y;
ps[p].oposz = ps[p].posz = spriowner->z - PHEIGHT; ps[p].oposz = ps[p].posz = Owner->s.z - PHEIGHT;
changespritesect(j, spriowner->sectnum); changespritesect(act2, Owner->s.sectnum);
ps[p].cursectnum = spr2->sectnum; ps[p].cursectnum = spr2->sectnum;
if (spri->pal == 0) if (spr->pal == 0)
{ {
int k = fi.spawn(spri->owner, TRANSPORTERBEAM); auto k = spawn(Owner, TRANSPORTERBEAM);
S_PlayActorSound(TELEPORTER, k); S_PlayActorSound(TELEPORTER, k);
} }
@ -2084,24 +2078,25 @@ void movetransports_d(void)
} }
else if (!(sectlotag == 1 && ps[p].on_ground == 1)) break; else if (!(sectlotag == 1 && ps[p].on_ground == 1)) break;
if (onfloorz == 0 && abs(spri->z - ps[p].posz) < 6144) if (onfloorz == 0 && abs(spr->z - ps[p].posz) < 6144)
if ((ps[p].jetpack_on == 0) || (ps[p].jetpack_on && (PlayerInput(p, SB_JUMP))) || if ((ps[p].jetpack_on == 0) || (ps[p].jetpack_on && (PlayerInput(p, SB_JUMP))) ||
(ps[p].jetpack_on && (PlayerInput(p, SB_CROUCH) ^ !!ps[p].crouch_toggle))) (ps[p].jetpack_on && (PlayerInput(p, SB_CROUCH) ^ !!ps[p].crouch_toggle)))
{ {
ps[p].oposx = ps[p].posx += spriowner->x - spri->x; ps[p].oposx = ps[p].posx += Owner->s.x - spr->x;
ps[p].oposy = ps[p].posy += spriowner->y - spri->y; ps[p].oposy = ps[p].posy += Owner->s.y - spr->y;
if (ps[p].jetpack_on && (PlayerInput(p, SB_JUMP) || ps[p].jetpack_on < 11)) if (ps[p].jetpack_on && (PlayerInput(p, SB_JUMP) || ps[p].jetpack_on < 11))
ps[p].posz = spriowner->z - 6144; ps[p].posz = Owner->s.z - 6144;
else ps[p].posz = spriowner->z + 6144; else ps[p].posz = Owner->s.z + 6144;
ps[p].oposz = ps[p].posz; ps[p].oposz = ps[p].posz;
hittype[ps[p].i].bposx = ps[p].posx; auto pa = ps[p].GetActor();
hittype[ps[p].i].bposy = ps[p].posy; pa->bposx = ps[p].posx;
hittype[ps[p].i].bposz = ps[p].posz; pa->bposy = ps[p].posy;
pa->bposz = ps[p].posz;
changespritesect(j, spriowner->sectnum); changespritesect(act2, Owner->s.sectnum);
ps[p].cursectnum = spriowner->sectnum; ps[p].cursectnum = Owner->s.sectnum;
break; break;
} }
@ -2116,10 +2111,10 @@ void movetransports_d(void)
{ {
FX_StopAllSounds(); FX_StopAllSounds();
} }
if (sprite[ps[p].i].extra > 0) if (ps[p].GetActor()->s.extra > 0)
S_PlayActorSound(DUKE_UNDERWATER, j); S_PlayActorSound(DUKE_UNDERWATER, act2);
ps[p].oposz = ps[p].posz = ps[p].oposz = ps[p].posz =
sector[spriowner->sectnum].ceilingz + (7 << 8); sector[Owner->s.sectnum].ceilingz + (7 << 8);
ps[p].posxv = 4096 - (krand() & 8192); ps[p].posxv = 4096 - (krand() & 8192);
ps[p].posyv = 4096 - (krand() & 8192); ps[p].posyv = 4096 - (krand() & 8192);
@ -2129,15 +2124,15 @@ void movetransports_d(void)
if (onfloorz && sectlotag == ST_2_UNDERWATER && ps[p].posz < (sector[sect].ceilingz + (6 << 8))) if (onfloorz && sectlotag == ST_2_UNDERWATER && ps[p].posz < (sector[sect].ceilingz + (6 << 8)))
{ {
k = 1; k = 1;
// if( sprj->extra <= 0) break; // if( spr2->extra <= 0) break;
if (screenpeek == p) if (screenpeek == p)
{ {
FX_StopAllSounds(); FX_StopAllSounds();
} }
S_PlayActorSound(DUKE_GASP, j); S_PlayActorSound(DUKE_GASP, act2);
ps[p].oposz = ps[p].posz = ps[p].oposz = ps[p].posz =
sector[spriowner->sectnum].floorz - (7 << 8); sector[Owner->s.sectnum].floorz - (7 << 8);
ps[p].jumping_toggle = 1; ps[p].jumping_toggle = 1;
ps[p].jumping_counter = 0; ps[p].jumping_counter = 0;
@ -2145,26 +2140,26 @@ void movetransports_d(void)
if (k == 1) if (k == 1)
{ {
ps[p].oposx = ps[p].posx += spriowner->x - spri->x; ps[p].oposx = ps[p].posx += Owner->s.x - spr->x;
ps[p].oposy = ps[p].posy += spriowner->y - spri->y; ps[p].oposy = ps[p].posy += Owner->s.y - spr->y;
if (spriowner->owner != spri->owner) if (!Owner || Owner->GetOwner() != Owner)
ps[p].transporter_hold = -2; ps[p].transporter_hold = -2;
ps[p].cursectnum = spriowner->sectnum; ps[p].cursectnum = Owner->s.sectnum;
changespritesect(j, spriowner->sectnum); changespritesect(act2, Owner->s.sectnum);
setsprite(ps[p].i, ps[p].posx, ps[p].posy, ps[p].posz + PHEIGHT); setsprite(ps[p].GetActor(), ps[p].posx, ps[p].posy, ps[p].posz + PHEIGHT);
setpal(&ps[p]); setpal(&ps[p]);
if ((krand() & 255) < 32) if ((krand() & 255) < 32)
fi.spawn(j, WATERSPLASH2); spawn(act2, WATERSPLASH2);
if (sectlotag == 1) if (sectlotag == 1)
for (int l = 0; l < 9; l++) for (int l = 0; l < 9; l++)
{ {
q = fi.spawn(ps[p].i, WATERBUBBLE); auto q = spawn(ps[p].GetActor(), WATERBUBBLE);
sprite[q].z += krand() & 16383; q->s.z += krand() & 16383;
} }
} }
} }
@ -2202,11 +2197,11 @@ void movetransports_d(void)
if (ll && sectlotag == 1 && spr2->z > (sector[sect].floorz - ll)) if (ll && sectlotag == 1 && spr2->z > (sector[sect].floorz - ll))
warpspriteto = 1; warpspriteto = 1;
if (sectlotag == 0 && (onfloorz || abs(spr2->z - spri->z) < 4096)) if (sectlotag == 0 && (onfloorz || abs(spr2->z - spr->z) < 4096))
{ {
if (spriowner->owner != spri->owner && onfloorz && act1->temp_data[0] > 0 && spr2->statnum != 5) if ((!Owner || Owner->GetOwner() != Owner) && onfloorz && act->temp_data[0] > 0 && spr2->statnum != STAT_MISC)
{ {
act1->temp_data[0]++; act->temp_data[0]++;
goto BOLT; goto BOLT;
} }
warpspriteto = 1; warpspriteto = 1;
@ -2237,16 +2232,16 @@ void movetransports_d(void)
break; break;
case WATERBUBBLE: case WATERBUBBLE:
//if( rnd(192) && sprj->picnum == WATERBUBBLE) //if( rnd(192) && a2->s.picnum == WATERBUBBLE)
// break; // break;
if (sectlotag > 0) if (sectlotag > 0)
{ {
int k = fi.spawn(j, WATERSPLASH2); auto k = spawn(act2, WATERSPLASH2);
if (sectlotag == 1 && spr2->statnum == 4) if (sectlotag == 1 && spr2->statnum == 4)
{ {
sprite[k].xvel = spr2->xvel >> 1; k->s.xvel = spr2->xvel >> 1;
sprite[k].ang = spr2->ang; k->s.ang = spr2->ang;
ssp(k, CLIPMASK0); ssp(k, CLIPMASK0);
} }
} }
@ -2256,70 +2251,70 @@ void movetransports_d(void)
case 0: case 0:
if (onfloorz) if (onfloorz)
{ {
if (spr2->statnum == 4 || (checkcursectnums(sect) == -1 && checkcursectnums(spriowner->sectnum) == -1)) if (spr2->statnum == STAT_PROJECTILE || (checkcursectnums(sect) == -1 && checkcursectnums(Owner->s.sectnum) == -1))
{ {
spr2->x += (spriowner->x - spri->x); spr2->x += (Owner->s.x - spr->x);
spr2->y += (spriowner->y - spri->y); spr2->y += (Owner->s.y - spr->y);
spr2->z -= spri->z - sector[spriowner->sectnum].floorz; spr2->z -= spr->z - sector[Owner->s.sectnum].floorz;
spr2->ang = spriowner->ang; spr2->ang = Owner->s.ang;
act2->bposx = spr2->x; act2->bposx = spr2->x;
act2->bposy = spr2->y; act2->bposy = spr2->y;
act2->bposz = spr2->z; act2->bposz = spr2->z;
if (spri->pal == 0) if (spr->pal == 0)
{ {
int k = fi.spawn(i, TRANSPORTERBEAM); auto k = spawn(act, TRANSPORTERBEAM);
S_PlayActorSound(TELEPORTER, k); S_PlayActorSound(TELEPORTER, k);
k = fi.spawn(spri->owner, TRANSPORTERBEAM); k = spawn(Owner, TRANSPORTERBEAM);
S_PlayActorSound(TELEPORTER, k); S_PlayActorSound(TELEPORTER, k);
} }
if (spriowner->owner != spri->owner) if (Owner && Owner->GetOwner() == Owner)
{ {
act1->temp_data[0] = 13; act->temp_data[0] = 13;
hittype[spri->owner].temp_data[0] = 13; Owner->temp_data[0] = 13;
} }
changespritesect(j, spriowner->sectnum); changespritesect(act2, Owner->s.sectnum);
} }
} }
else else
{ {
spr2->x += (spriowner->x - spri->x); spr2->x += (Owner->s.x - spr->x);
spr2->y += (spriowner->y - spri->y); spr2->y += (Owner->s.y - spr->y);
spr2->z = spriowner->z + 4096; spr2->z = Owner->s.z + 4096;
act2->bposx = spr2->x; act2->bposx = spr2->x;
act2->bposy = spr2->y; act2->bposy = spr2->y;
act2->bposz = spr2->z; act2->bposz = spr2->z;
changespritesect(j, spriowner->sectnum); changespritesect(act2, Owner->s.sectnum);
} }
break; break;
case 1: case 1:
spr2->x += (spriowner->x - spri->x); spr2->x += (Owner->s.x - spr->x);
spr2->y += (spriowner->y - spri->y); spr2->y += (Owner->s.y - spr->y);
spr2->z = sector[spriowner->sectnum].ceilingz + ll; spr2->z = sector[Owner->s.sectnum].ceilingz + ll;
act2->bposx = spr2->x; act2->bposx = spr2->x;
act2->bposy = spr2->y; act2->bposy = spr2->y;
act2->bposz = spr2->z; act2->bposz = spr2->z;
changespritesect(j, spriowner->sectnum); changespritesect(act2, Owner->s.sectnum);
break; break;
case 2: case 2:
spr2->x += (spriowner->x - spri->x); spr2->x += (Owner->s.x - spr->x);
spr2->y += (spriowner->y - spri->y); spr2->y += (Owner->s.y - spr->y);
spr2->z = sector[spriowner->sectnum].floorz - ll; spr2->z = sector[Owner->s.sectnum].floorz - ll;
act2->bposx = spr2->x; act2->bposx = spr2->x;
act2->bposy = spr2->y; act2->bposy = spr2->y;
act2->bposz = spr2->z; act2->bposz = spr2->z;
changespritesect(j, spriowner->sectnum); changespritesect(act2, Owner->s.sectnum);
break; break;
} }

View file

@ -1581,23 +1581,20 @@ void movetransports_r(void)
{ {
char warpdir, warpspriteto; char warpdir, warpspriteto;
short k, p, sect, sectlotag; short k, p, sect, sectlotag;
int i, j, ll2, ll, onfloorz; int ll2, ll, onfloorz;
Collision coll;
//Transporters //Transporters
StatIterator iti(STAT_TRANSPORT); DukeStatIterator iti(STAT_TRANSPORT);
while ((i = iti.NextIndex()) >= 0) while (auto act = iti.Next())
{ {
auto spri = &sprite[i]; auto spr = &act->s;
auto act = &hittype[i]; sect = spr->sectnum;
auto spriowner = spri->owner < 0? nullptr : &sprite[spri->owner];
sect = spri->sectnum;
sectlotag = sector[sect].lotag; sectlotag = sector[sect].lotag;
auto& OW = spri->owner; auto Owner = act->GetOwner();
auto PN = spri->picnum; if (Owner == act || Owner == nullptr)
if (OW == i)
{ {
continue; continue;
} }
@ -1606,17 +1603,15 @@ void movetransports_r(void)
if (act->temp_data[0] > 0) act->temp_data[0]--; if (act->temp_data[0] > 0) act->temp_data[0]--;
SectIterator itj(sect); DukeSectIterator itj(sect);
while ((j = itj.NextIndex()) >= 0) while (auto act2 = itj.Next())
{ {
auto spr2 = &sprite[j]; auto spr2 = &act2->s;
auto act2 = &hittype[j];
switch (spr2->statnum) switch (spr2->statnum)
{ {
case STAT_PLAYER: // Player case STAT_PLAYER: // Player
if (spr2->owner != -1) if (act2->GetOwner())
{ {
p = spr2->yvel; p = spr2->yvel;
@ -1626,54 +1621,54 @@ void movetransports_r(void)
{ {
if (ps[p].on_ground && sectlotag == 0 && onfloorz && ps[p].jetpack_on == 0) if (ps[p].on_ground && sectlotag == 0 && onfloorz && ps[p].jetpack_on == 0)
{ {
fi.spawn(i, TRANSPORTERBEAM); spawn(act, TRANSPORTERBEAM);
S_PlayActorSound(TELEPORTER, i); S_PlayActorSound(TELEPORTER, act);
for (k = connecthead; k >= 0; k = connectpoint2[k])// connectpoinhittype[i].temp_data[1][k]) for (k = connecthead; k >= 0; k = connectpoint2[k])// connectpoinhittype[i].temp_data[1][k])
if (ps[k].cursectnum == spriowner->sectnum) if (ps[k].cursectnum == Owner->s.sectnum)
{ {
ps[k].frag_ps = p; ps[k].frag_ps = p;
sprite[ps[k].i].extra = 0; ps[k].GetActor()->s.extra = 0;
} }
ps[p].angle.ang = buildang(spriowner->ang); ps[p].angle.ang = buildang(Owner->s.ang);
if (spriowner->owner != OW) if (Owner->GetOwner() != Owner)
{ {
act->temp_data[0] = 13; act->temp_data[0] = 13;
hittype[OW].temp_data[0] = 13; Owner->temp_data[0] = 13;
ps[p].transporter_hold = 13; ps[p].transporter_hold = 13;
} }
ps[p].bobposx = ps[p].oposx = ps[p].posx = spriowner->x; ps[p].bobposx = ps[p].oposx = ps[p].posx = Owner->s.x;
ps[p].bobposy = ps[p].oposy = ps[p].posy = spriowner->y; ps[p].bobposy = ps[p].oposy = ps[p].posy = Owner->s.y;
ps[p].oposz = ps[p].posz = spriowner->z - (PHEIGHT - (4 << 8)); ps[p].oposz = ps[p].posz = Owner->s.z - (PHEIGHT - (4 << 8));
changespritesect(j, spriowner->sectnum); changespritesect(act2, Owner->s.sectnum);
ps[p].cursectnum = spr2->sectnum; ps[p].cursectnum = spr2->sectnum;
k = fi.spawn(OW, TRANSPORTERBEAM); auto beam = spawn(Owner, TRANSPORTERBEAM);
S_PlayActorSound(TELEPORTER, k); S_PlayActorSound(TELEPORTER, beam);
break; break;
} }
} }
else break; else break;
if (onfloorz == 0 && abs(spri->z - ps[p].posz) < 6144) if (onfloorz == 0 && abs(spr->z - ps[p].posz) < 6144)
if ((ps[p].jetpack_on == 0) || (ps[p].jetpack_on && PlayerInput(p, SB_JUMP)) || if ((ps[p].jetpack_on == 0) || (ps[p].jetpack_on && PlayerInput(p, SB_JUMP)) ||
(ps[p].jetpack_on && PlayerInput(p, SB_CROUCH))) (ps[p].jetpack_on && PlayerInput(p, SB_CROUCH)))
{ {
ps[p].oposx = ps[p].posx += spriowner->x - spri->x; ps[p].oposx = ps[p].posx += Owner->s.x - spr->x;
ps[p].oposy = ps[p].posy += spriowner->y - spri->y; ps[p].oposy = ps[p].posy += Owner->s.y - spr->y;
if (ps[p].jetpack_on && (PlayerInput(p, SB_JUMP) || ps[p].jetpack_on < 11)) if (ps[p].jetpack_on && (PlayerInput(p, SB_JUMP) || ps[p].jetpack_on < 11))
ps[p].posz = spriowner->z - 6144; ps[p].posz = Owner->s.z - 6144;
else ps[p].posz = spriowner->z + 6144; else ps[p].posz = Owner->s.z + 6144;
ps[p].oposz = ps[p].posz; ps[p].oposz = ps[p].posz;
changespritesect(j, spriowner->sectnum); changespritesect(act2, Owner->s.sectnum);
ps[p].cursectnum = spriowner->sectnum; ps[p].cursectnum = Owner->s.sectnum;
break; break;
} }
@ -1686,15 +1681,15 @@ void movetransports_r(void)
{ {
k = 2; k = 2;
ps[p].oposz = ps[p].posz = ps[p].oposz = ps[p].posz =
sector[spriowner->sectnum].ceilingz + (7 << 8); sector[Owner->s.sectnum].ceilingz + (7 << 8);
} }
if (onfloorz && sectlotag == 161 && ps[p].posz < (sector[sect].ceilingz + (6 << 8))) if (onfloorz && sectlotag == 161 && ps[p].posz < (sector[sect].ceilingz + (6 << 8)))
{ {
k = 2; k = 2;
if (sprite[ps[p].i].extra <= 0) break; if (ps[p].GetActor()->s.extra <= 0) break;
ps[p].oposz = ps[p].posz = ps[p].oposz = ps[p].posz =
sector[spriowner->sectnum].floorz - (49 << 8); sector[Owner->s.sectnum].floorz - (49 << 8);
} }
} }
@ -1707,9 +1702,9 @@ void movetransports_r(void)
{ {
FX_StopAllSounds(); FX_StopAllSounds();
} }
S_PlayActorSound(DUKE_UNDERWATER, ps[p].i); S_PlayActorSound(DUKE_UNDERWATER, ps[p].GetActor());
ps[p].oposz = ps[p].posz = ps[p].oposz = ps[p].posz =
sector[spriowner->sectnum].ceilingz + (7 << 8); sector[Owner->s.sectnum].ceilingz + (7 << 8);
if (ps[p].OnMotorcycle) if (ps[p].OnMotorcycle)
ps[p].moto_underwater = 1; ps[p].moto_underwater = 1;
} }
@ -1717,51 +1712,51 @@ void movetransports_r(void)
if (onfloorz && sectlotag == ST_2_UNDERWATER && ps[p].posz < (sector[sect].ceilingz + (6 << 8))) if (onfloorz && sectlotag == ST_2_UNDERWATER && ps[p].posz < (sector[sect].ceilingz + (6 << 8)))
{ {
k = 1; k = 1;
if (sprite[ps[p].i].extra <= 0) break; if (ps[p].GetActor()->s.extra <= 0) break;
if (screenpeek == p) if (screenpeek == p)
{ {
FX_StopAllSounds(); FX_StopAllSounds();
} }
S_PlayActorSound(DUKE_GASP, ps[p].i); S_PlayActorSound(DUKE_GASP, ps[p].GetActor());
ps[p].oposz = ps[p].posz = ps[p].oposz = ps[p].posz =
sector[spriowner->sectnum].floorz - (7 << 8); sector[Owner->s.sectnum].floorz - (7 << 8);
} }
if (k == 1) if (k == 1)
{ {
ps[p].oposx = ps[p].posx += spriowner->x - spri->x; ps[p].oposx = ps[p].posx += Owner->s.x - spr->x;
ps[p].oposy = ps[p].posy += spriowner->y - spri->y; ps[p].oposy = ps[p].posy += Owner->s.y - spr->y;
if (spriowner->owner != OW) if (Owner->GetOwner() != Owner)
ps[p].transporter_hold = -2; ps[p].transporter_hold = -2;
ps[p].cursectnum = spriowner->sectnum; ps[p].cursectnum = Owner->s.sectnum;
changespritesect(j, spriowner->sectnum); changespritesect(act2, Owner->s.sectnum);
setpal(&ps[p]); setpal(&ps[p]);
if ((krand() & 255) < 32) if ((krand() & 255) < 32)
fi.spawn(ps[p].i, WATERSPLASH2); spawn(ps[p].GetActor(), WATERSPLASH2);
} }
else if (isRRRA() && k == 2) else if (isRRRA() && k == 2)
{ {
ps[p].oposx = ps[p].posx += spriowner->x - spri->x; ps[p].oposx = ps[p].posx += Owner->s.x - spr->x;
ps[p].oposy = ps[p].posy += spriowner->y - spri->y; ps[p].oposy = ps[p].posy += Owner->s.y - spr->y;
if (spriowner->owner != OW) if (Owner->GetOwner() != Owner)
ps[p].transporter_hold = -2; ps[p].transporter_hold = -2;
ps[p].cursectnum = spriowner->sectnum; ps[p].cursectnum = Owner->s.sectnum;
changespritesect(j, spriowner->sectnum); changespritesect(act2, Owner->s.sectnum);
} }
} }
break; break;
case STAT_ACTOR: case STAT_ACTOR:
if (PN == SHARK || if (spr->picnum == SHARK ||
(isRRRA() && (PN == CHEERBOAT || PN == HULKBOAT || PN == MINIONBOAT || PN == UFO1_RRRA)) || (isRRRA() && (spr->picnum == CHEERBOAT || spr->picnum == HULKBOAT || spr->picnum == MINIONBOAT || spr->picnum == UFO1_RRRA)) ||
(!isRRRA() && (PN == UFO1_RR || PN == UFO2 || PN == UFO3 || PN == UFO4 || PN == UFO5))) continue; (!isRRRA() && (spr->picnum == UFO1_RR || spr->picnum == UFO2 || spr->picnum == UFO3 || spr->picnum == UFO4 || spr->picnum == UFO5))) continue;
case STAT_PROJECTILE: case STAT_PROJECTILE:
case STAT_MISC: case STAT_MISC:
case STAT_DUMMYPLAYER: case STAT_DUMMYPLAYER:
@ -1808,9 +1803,9 @@ void movetransports_r(void)
} }
} }
if (sectlotag == 0 && (onfloorz || abs(spr2->z - spri->z) < 4096)) if (sectlotag == 0 && (onfloorz || abs(spr2->z - spr->z) < 4096))
{ {
if (spriowner->owner != OW && onfloorz && act->temp_data[0] > 0 && spr2->statnum != 5) if (Owner->GetOwner() != Owner && onfloorz && act->temp_data[0] > 0 && spr2->statnum != 5)
{ {
act->temp_data[0]++; act->temp_data[0]++;
continue; continue;
@ -1844,11 +1839,11 @@ void movetransports_r(void)
if (sectlotag > 0) if (sectlotag > 0)
{ {
k = fi.spawn(j, WATERSPLASH2); auto k = spawn(act2, WATERSPLASH2);
if (sectlotag == 1 && spr2->statnum == 4) if (sectlotag == 1 && spr2->statnum == 4)
{ {
sprite[k].xvel = spr2->xvel >> 1; k->s.xvel = spr2->xvel >> 1;
sprite[k].ang = spr2->ang; k->s.ang = spr2->ang;
ssp(k, CLIPMASK0); ssp(k, CLIPMASK0);
} }
} }
@ -1858,100 +1853,100 @@ void movetransports_r(void)
case ST_0_NO_EFFECT: case ST_0_NO_EFFECT:
if (onfloorz) if (onfloorz)
{ {
if (checkcursectnums(sect) == -1 && checkcursectnums(spriowner->sectnum) == -1) if (checkcursectnums(sect) == -1 && checkcursectnums(Owner->s.sectnum) == -1)
{ {
spr2->x += (spriowner->x - spri->x); spr2->x += (Owner->s.x - spr->x);
spr2->y += (spriowner->y - spri->y); spr2->y += (Owner->s.y - spr->y);
spr2->z -= spri->z - sector[spriowner->sectnum].floorz; spr2->z -= spr->z - sector[Owner->s.sectnum].floorz;
spr2->ang = spriowner->ang; spr2->ang = Owner->s.ang;
act2->bposx = spr2->x; act2->bposx = spr2->x;
act2->bposy = spr2->y; act2->bposy = spr2->y;
act2->bposz = spr2->z; act2->bposz = spr2->z;
k = fi.spawn(i, TRANSPORTERBEAM); auto beam = spawn(act, TRANSPORTERBEAM);
S_PlayActorSound(TELEPORTER, k); S_PlayActorSound(TELEPORTER, beam);
k = fi.spawn(OW, TRANSPORTERBEAM); beam = spawn(Owner, TRANSPORTERBEAM);
S_PlayActorSound(TELEPORTER, k); S_PlayActorSound(TELEPORTER, beam);
if (spriowner->owner != OW) if (Owner->GetOwner() != Owner)
{ {
act->temp_data[0] = 13; act->temp_data[0] = 13;
hittype[OW].temp_data[0] = 13; Owner->temp_data[0] = 13;
} }
changespritesect(j, spriowner->sectnum); changespritesect(act2, Owner->s.sectnum);
} }
} }
else else
{ {
spr2->x += (spriowner->x - spri->x); spr2->x += (Owner->s.x - spr->x);
spr2->y += (spriowner->y - spri->y); spr2->y += (Owner->s.y - spr->y);
spr2->z = spriowner->z + 4096; spr2->z = Owner->s.z + 4096;
act2->bposx = spr2->x; act2->bposx = spr2->x;
act2->bposy = spr2->y; act2->bposy = spr2->y;
act2->bposz = spr2->z; act2->bposz = spr2->z;
changespritesect(j, spriowner->sectnum); changespritesect(act2, Owner->s.sectnum);
} }
break; break;
case ST_1_ABOVE_WATER: case ST_1_ABOVE_WATER:
spr2->x += (spriowner->x - spri->x); spr2->x += (Owner->s.x - spr->x);
spr2->y += (spriowner->y - spri->y); spr2->y += (Owner->s.y - spr->y);
spr2->z = sector[spriowner->sectnum].ceilingz + ll; spr2->z = sector[Owner->s.sectnum].ceilingz + ll;
act2->bposx = spr2->x; act2->bposx = spr2->x;
act2->bposy = spr2->y; act2->bposy = spr2->y;
act2->bposz = spr2->z; act2->bposz = spr2->z;
changespritesect(j, spriowner->sectnum); changespritesect(act2, Owner->s.sectnum);
break; break;
case ST_2_UNDERWATER: case ST_2_UNDERWATER:
spr2->x += (spriowner->x - spri->x); spr2->x += (Owner->s.x - spr->x);
spr2->y += (spriowner->y - spri->y); spr2->y += (Owner->s.y - spr->y);
spr2->z = sector[spriowner->sectnum].floorz - ll; spr2->z = sector[Owner->s.sectnum].floorz - ll;
act2->bposx = spr2->x; act2->bposx = spr2->x;
act2->bposy = spr2->y; act2->bposy = spr2->y;
act2->bposz = spr2->z; act2->bposz = spr2->z;
changespritesect(j, spriowner->sectnum); changespritesect(act2, Owner->s.sectnum);
break; break;
case 160: case 160:
if (!isRRRA()) break; if (!isRRRA()) break;
spr2->x += (spriowner->x - spri->x); spr2->x += (Owner->s.x - spr->x);
spr2->y += (spriowner->y - spri->y); spr2->y += (Owner->s.y - spr->y);
spr2->z = sector[spriowner->sectnum].ceilingz + ll2; spr2->z = sector[Owner->s.sectnum].ceilingz + ll2;
act2->bposx = spr2->x; act2->bposx = spr2->x;
act2->bposy = spr2->y; act2->bposy = spr2->y;
act2->bposz = spr2->z; act2->bposz = spr2->z;
changespritesect(j, spriowner->sectnum); changespritesect(act2, Owner->s.sectnum);
fi.movesprite(j, (spr2->xvel * sintable[(spr2->ang + 512) & 2047]) >> 14, movesprite_ex(act2, (spr2->xvel * sintable[(spr2->ang + 512) & 2047]) >> 14,
(spr2->xvel * sintable[spr2->ang & 2047]) >> 14, 0, CLIPMASK1); (spr2->xvel * sintable[spr2->ang & 2047]) >> 14, 0, CLIPMASK1, coll);
break; break;
case 161: case 161:
if (!isRRRA()) break; if (!isRRRA()) break;
spr2->x += (spriowner->x - spri->x); spr2->x += (Owner->s.x - spr->x);
spr2->y += (spriowner->y - spri->y); spr2->y += (Owner->s.y - spr->y);
spr2->z = sector[spriowner->sectnum].floorz - ll2; spr2->z = sector[Owner->s.sectnum].floorz - ll2;
act2->bposx = spr2->x; act2->bposx = spr2->x;
act2->bposy = spr2->y; act2->bposy = spr2->y;
act2->bposz = spr2->z; act2->bposz = spr2->z;
changespritesect(j, spriowner->sectnum); changespritesect(act2, Owner->s.sectnum);
fi.movesprite(j, (spr2->xvel * sintable[(spr2->ang + 512) & 2047]) >> 14, movesprite_ex(act2, (spr2->xvel * sintable[(spr2->ang + 512) & 2047]) >> 14,
(spr2->xvel * sintable[spr2->ang & 2047]) >> 14, 0, CLIPMASK1); (spr2->xvel * sintable[spr2->ang & 2047]) >> 14, 0, CLIPMASK1, coll);
break; break;
} }