- owners in spawn.cpp

This commit is contained in:
Christoph Oelckers 2020-11-02 22:26:32 +01:00
parent 90511a97e7
commit 15fc884909
2 changed files with 12 additions and 15 deletions

View file

@ -5216,7 +5216,7 @@ void alterang(int ang, DDukeActor* actor, int playernum)
{ {
auto holoduke = !isRR()? ps[playernum].holoduke_on : nullptr; auto holoduke = !isRR()? ps[playernum].holoduke_on : nullptr;
// NOTE: looks like 'owner' is set to target sprite ID... // NOTE: looks like 'Owner' is set to target sprite ID...
if (holoduke && cansee(holoduke->s.x, holoduke->s.y, holoduke->s.z, holoduke->s.sectnum, s->x, s->y, s->z, s->sectnum)) if (holoduke && cansee(holoduke->s.x, holoduke->s.y, holoduke->s.z, holoduke->s.sectnum, s->x, s->y, s->z, s->sectnum))
actor->SetOwner(holoduke); actor->SetOwner(holoduke);

View file

@ -661,7 +661,7 @@ void spawneffector(DDukeActor* actor)
changespritestat(actor, STAT_TRANSPORT); changespritestat(actor, STAT_TRANSPORT);
return; return;
case SE_1_PIVOT: case SE_1_PIVOT:
sp->owner = -1; actor->SetOwner(nullptr);
t[0] = 1; t[0] = 1;
break; break;
case SE_18_INCREMENTAL_SECTOR_RISE_FALL: case SE_18_INCREMENTAL_SECTOR_RISE_FALL:
@ -683,7 +683,7 @@ void spawneffector(DDukeActor* actor)
break; break;
case SE_19_EXPLOSION_LOWERS_CEILING: case SE_19_EXPLOSION_LOWERS_CEILING:
sp->owner = -1; actor->SetOwner(nullptr);
break; break;
case SE_25_PISTON: // Pistons case SE_25_PISTON: // Pistons
if (!isRR()) if (!isRR())
@ -717,17 +717,16 @@ void spawneffector(DDukeActor* actor)
break; break;
case SE_13_EXPLOSIVE: case SE_13_EXPLOSIVE:
{
t[0] = sector[sect].ceilingz; t[0] = sector[sect].ceilingz;
t[1] = sector[sect].floorz; t[1] = sector[sect].floorz;
if (abs(t[0] - sp->z) < abs(t[1] - sp->z)) bool ceiling = (abs(t[0] - sp->z) < abs(t[1] - sp->z));
sp->owner = 1; sp->owner = ceiling; // hijack
else sp->owner = 0;
if (sp->ang == 512) if (sp->ang == 512)
{ {
if (sp->owner) if (ceiling)
sector[sect].ceilingz = sp->z; sector[sect].ceilingz = sp->z;
else else
sector[sect].floorz = sp->z; sector[sect].floorz = sp->z;
@ -740,7 +739,7 @@ void spawneffector(DDukeActor* actor)
sector[sect].ceilingstat ^= 1; sector[sect].ceilingstat ^= 1;
t[3] = 1; t[3] = 1;
if (!sp->owner && sp->ang == 512) if (!ceiling && sp->ang == 512)
{ {
sector[sect].ceilingstat ^= 1; sector[sect].ceilingstat ^= 1;
t[3] = 0; t[3] = 0;
@ -770,7 +769,7 @@ void spawneffector(DDukeActor* actor)
} }
break; break;
}
case SE_17_WARP_ELEVATOR: case SE_17_WARP_ELEVATOR:
{ {
t[2] = sector[sect].floorz; //Stopping loc t[2] = sector[sect].floorz; //Stopping loc
@ -846,8 +845,7 @@ void spawneffector(DDukeActor* actor)
sector[sect].floorshade = sp->shade; sector[sect].floorshade = sp->shade;
sector[sect].ceilingshade = sp->shade; sector[sect].ceilingshade = sp->shade;
sp->owner = sector[sect].ceilingpal << 8; sp->owner = (sector[sect].ceilingpal << 8) | sector[sect].floorpal; // hijack
sp->owner |= sector[sect].floorpal;
//fix all the walls; //fix all the walls;
@ -899,8 +897,7 @@ void spawneffector(DDukeActor* actor)
startwall = sector[sect].wallptr; startwall = sector[sect].wallptr;
endwall = startwall + sector[sect].wallnum; endwall = startwall + sector[sect].wallnum;
sp->owner = sector[sect].ceilingpal << 8; sp->owner = (sector[sect].ceilingpal << 8) | sector[sect].floorpal; // hijack
sp->owner |= sector[sect].floorpal;
for (s = startwall; s < endwall; s++) for (s = startwall; s < endwall; s++)
if (wall[s].shade > t[3]) if (wall[s].shade > t[3])
@ -1040,7 +1037,7 @@ void spawneffector(DDukeActor* actor)
I_Error("Subway found no zero'd sectors with locators\nat (%d,%d).\n", sp->x, sp->y); I_Error("Subway found no zero'd sectors with locators\nat (%d,%d).\n", sp->x, sp->y);
} }
sp->owner = -1; actor->SetOwner(nullptr);
t[0] = s; t[0] = s;
if (sp->lotag != 30) if (sp->lotag != 30)