- added map flags to enable RR's special sector types in Duke as well.

This commit is contained in:
Christoph Oelckers 2022-12-30 14:05:39 +01:00
parent c8853de0ef
commit 35a088ba04
16 changed files with 71 additions and 45 deletions

View file

@ -2197,13 +2197,13 @@ void handle_se10(DDukeActor* actor, const int* specialtags)
auto sc = actor->sector();
int sh = actor->spr.hitag;
if ((sc->lotag & 0xff) == 27 || (sc->floorz > sc->ceilingz && (sc->lotag & 0xff) != 23) || sc->lotag == 32791 - 65536)
if ((sc->lotag & 0xff) == ST_27_STRETCH_BRIDGE || (sc->floorz > sc->ceilingz && (sc->lotag & 0xff) != ST_23_SWINGING_DOOR) || sc->lotag == 32791 - 65536)
{
int j = 1;
if ((sc->lotag & 0xff) != 27)
if ((sc->lotag & 0xff) != ST_27_STRETCH_BRIDGE)
for (int p = connecthead; p >= 0; p = connectpoint2[p])
if (sc->lotag != 30 && sc->lotag != 31 && sc->lotag != 0)
if (sc->lotag != ST_30_ROTATE_RISE_BRIDGE && sc->lotag != ST_31_TWO_WAY_TRAIN && sc->lotag != ST_0_NO_EFFECT)
if (actor->sector() == ps[p].GetActor()->sector())
j = 0;
@ -4113,7 +4113,7 @@ void spawndebris(DDukeActor* g_ac, int dnum, int count)
void actoroperate(DDukeActor* g_ac)
{
if (g_ac->sector()->lotag == 0)
if (g_ac->sector()->lotag == ST_0_NO_EFFECT)
{
HitInfo hit{};
neartag(g_ac->spr.pos.plusZ(-32), g_ac->sector(), g_ac->spr.Angles.Yaw, hit, 48, NT_Lotag | NT_NoSpriteCheck);

View file

@ -295,7 +295,7 @@ void movetransports_d(void)
if (ps[p].transporter_hold == 0 && ps[p].jumping_counter == 0)
{
if (ps[p].on_ground && sectlotag == 0 && onfloorz && ps[p].jetpack_on == 0)
if (ps[p].on_ground && sectlotag == ST_0_NO_EFFECT && onfloorz && ps[p].jetpack_on == 0)
{
if (act->spr.pal == 0)
{
@ -440,7 +440,7 @@ void movetransports_d(void)
if (ll && sectlotag == 1 && act2->spr.pos.Z > (sectp->floorz - ll) && act2->vel.Z > 0)
warpspriteto = 1;
if (sectlotag == 0 && (onfloorz || abs(act2->spr.pos.Z - act->spr.pos.Z) < 16))
if (sectlotag == ST_0_NO_EFFECT && (onfloorz || abs(act2->spr.pos.Z - act->spr.pos.Z) < 16))
{
if ((!Owner || Owner->GetOwner() != Owner) && onfloorz && act->counter > 0 && act2->spr.statnum != STAT_MISC)
{

View file

@ -279,7 +279,7 @@ void movetransports_r(void)
if (ps[p].transporter_hold == 0 && ps[p].jumping_counter == 0)
{
if (ps[p].on_ground && sectlotag == 0 && onfloorz && ps[p].jetpack_on == 0)
if (ps[p].on_ground && sectlotag == ST_0_NO_EFFECT && onfloorz && ps[p].jetpack_on == 0)
{
spawn(act, DukeTransporterBeamClass);
S_PlayActorSound(TELEPORTER, act);
@ -335,7 +335,7 @@ void movetransports_r(void)
k = 0;
if (isRRRA())
if (ud.mapflags & MFLAG_ALLSECTORTYPES)
{
if (onfloorz && sectlotag == ST_160_FLOOR_TELEPORT && ps[p].GetActor()->getOffsetZ() > sectp->floorz - 48)
{
@ -434,7 +434,7 @@ void movetransports_r(void)
if (ll && sectlotag == ST_1_ABOVE_WATER && act2->spr.pos.Z > (sectp->floorz - ll))
warpspriteto = 1;
if (isRRRA())
if (ud.mapflags & MFLAG_ALLSECTORTYPES)
{
if (ll && sectlotag == ST_161_CEILING_TELEPORT && act2->spr.pos.Z < (sectp->ceilingz + ll) && warpdir == 1)
{
@ -458,7 +458,7 @@ void movetransports_r(void)
}
}
if (sectlotag == 0 && (onfloorz || abs(act2->spr.pos.Z - act->spr.pos.Z) < 16))
if (sectlotag == ST_0_NO_EFFECT && (onfloorz || abs(act2->spr.pos.Z - act->spr.pos.Z) < 16))
{
if (Owner->GetOwner() != Owner && onfloorz && act->counter > 0 && act2->spr.statnum != 5)
{
@ -481,7 +481,7 @@ void movetransports_r(void)
}
[[fallthrough]];
default:
if (act2->spr.statnum == 5 && !(sectlotag == ST_1_ABOVE_WATER || sectlotag == ST_2_UNDERWATER || (isRRRA() && (sectlotag == ST_160_FLOOR_TELEPORT || sectlotag == ST_161_CEILING_TELEPORT))))
if (act2->spr.statnum == STAT_MISC && !(sectlotag == ST_1_ABOVE_WATER || sectlotag == ST_2_UNDERWATER || ((ud.mapflags & MFLAG_ALLSECTORTYPES) && (sectlotag == ST_160_FLOOR_TELEPORT || sectlotag == ST_161_CEILING_TELEPORT))))
break;
[[fallthrough]];
@ -554,7 +554,7 @@ void movetransports_r(void)
break;
case ST_160_FLOOR_TELEPORT:
if (!isRRRA()) break;
if (!(ud.mapflags & MFLAG_ALLSECTORTYPES)) break;
act2->spr.pos.XY() += Owner->spr.pos.XY() - act->spr.pos.XY();
act2->spr.pos.Z = Owner->sector()->ceilingz + ll2;
act2->backupz();
@ -565,7 +565,7 @@ void movetransports_r(void)
break;
case ST_161_CEILING_TELEPORT:
if (!isRRRA()) break;
if (!(ud.mapflags & MFLAG_ALLSECTORTYPES)) break;
act2->spr.pos += Owner->spr.pos.XY() - act->spr.pos.XY();
act2->spr.pos.Z = Owner->sector()->floorz - ll;
act2->backupz();
@ -1034,9 +1034,9 @@ void fakebubbaspawn(DDukeActor *actor, player_struct* p)
static int fallspecial(DDukeActor *actor, int playernum)
{
int sphit = 0;
if (isRRRA())
if (ud.mapflags & MFLAG_ALLSECTORTYPES)
{
if (actor->sector()->lotag == 801)
if (actor->sector()->lotag == ST_801_ROCKY)
{
if (actor->spr.picnum == RTILE_ROCK)
{
@ -1046,7 +1046,7 @@ static int fallspecial(DDukeActor *actor, int playernum)
}
return 0;
}
else if (actor->sector()->lotag == 802)
else if (actor->sector()->lotag == ST_802_KILLBADGUYS)
{
if (!actor->isPlayer() && badguy(actor) && actor->spr.pos.Z == actor->floorz - FOURSLEIGHT_F)
{
@ -1056,38 +1056,41 @@ static int fallspecial(DDukeActor *actor, int playernum)
}
return 0;
}
else if (actor->sector()->lotag == 803)
else if (actor->sector()->lotag == ST_803_KILLROCKS)
{
if (actor->spr.picnum == RTILE_ROCK2)
addspritetodelete();
return 0;
}
}
if (actor->sector()->lotag == 800)
if (ud.mapflags & (MFLAG_ALLSECTORTYPES | MFLAG_SECTORTYPE800))
{
if (actor->spr.picnum == RTILE_AMMO)
if (actor->sector()->lotag == ST_800_KILLSTUFF)
{
addspritetodelete();
return 0;
}
if (!actor->isPlayer() && (badguy(actor) || actor->spr.picnum == RTILE_HEN || actor->spr.picnum == RTILE_COW || actor->spr.picnum == RTILE_PIG || actor->spr.picnum == RTILE_DOGRUN || actor->spr.picnum == RTILE_RABBIT) && (!isRRRA() || actor->spriteextra < 128))
{
actor->spr.pos.Z = actor->floorz - FOURSLEIGHT_F;
actor->vel.Z = 8000 / 256.;
actor->spr.extra = 0;
actor->spriteextra++;
sphit = 1;
}
else if (!actor->isPlayer())
{
if (!actor->spriteextra)
if (actor->spr.picnum == RTILE_AMMO)
{
addspritetodelete();
return 0;
return 0;
}
if (!actor->isPlayer() && (badguy(actor)) && (!isRRRA() || actor->spriteextra < 128))
{
actor->spr.pos.Z = actor->floorz - FOURSLEIGHT_F;
actor->vel.Z = 8000 / 256.;
actor->spr.extra = 0;
actor->spriteextra++;
sphit = 1;
}
else if (!actor->isPlayer())
{
if (!actor->spriteextra)
addspritetodelete();
return 0;
}
actor->attackertype = DukeShotSparkClass;
actor->hitextra = 1;
}
actor->attackertype = DukeShotSparkClass;
actor->hitextra = 1;
}
else if (tilesurface(actor->sector()->floortexture) == TSURF_MAGMA)
if (tilesurface(actor->sector()->floortexture) == TSURF_MAGMA)
{
if (actor->spr.picnum != RTILE_MINION && actor->spr.pal != 19)
{

View file

@ -140,6 +140,12 @@ enum
ST_160_FLOOR_TELEPORT = 160,
ST_161_CEILING_TELEPORT = 161,
ST_800_KILLSTUFF = 800,
ST_801_ROCKY = 801,
ST_802_KILLBADGUYS = 802,
ST_803_KILLROCKS = 803,
// left: ST 32767, 65534, 65535
};
@ -318,6 +324,12 @@ enum amoveflags_t
antifaceplayerslow = 32768
};
enum mapflags_t
{
MFLAG_SECTORTYPE800 = 1, // RR only needs 800 by default - this flag is purely internal. For new content ALLSECTORTYPES will do better.
MFLAG_ALLSECTORTYPES =2, // enables RRRA's sector types regardless of the game being played.
};
enum sflags_t
{
SFLAG_INVENTORY = 0x00000001,

View file

@ -491,7 +491,7 @@ void footprints(int snum)
if (j < 0)
{
p->footprintcount--;
if (p->cursector->lotag == 0 && p->cursector->hitag == 0)
if (p->cursector->lotag == ST_0_NO_EFFECT && p->cursector->hitag == 0)
{
DDukeActor* fprint = spawn(actor, DukeFootprintsClass);
if (fprint)

View file

@ -626,7 +626,7 @@ static void operateJetpack(int snum, ESyncBits actions, int psectlotag, double f
}
int k;
if (shrunk == 0 && (psectlotag == 0 || psectlotag == 2)) k = 32;
if (shrunk == 0 && (psectlotag == ST_0_NO_EFFECT || psectlotag == ST_2_UNDERWATER)) k = 32;
else k = 16;
if (psectlotag != 2 && p->scuba_on == 1)

View file

@ -2866,7 +2866,7 @@ HORIZONLY:
// RBG***
SetActor(pact, pact->spr.pos);
if (psectlotag == 800 && (!isRRRA() || !p->lotag800kill))
if (psectlotag == ST_800_KILLSTUFF && (!isRRRA() || !p->lotag800kill))
{
if (isRRRA()) p->lotag800kill = 1;
quickkill(p);

View file

@ -629,6 +629,8 @@ void lava_cleararrays();
void prelevel_common(int g)
{
if (isRRRA()) ud.mapflags = MFLAG_ALLSECTORTYPES;
else if (isRR()) ud.mapflags = MFLAG_SECTORTYPE800;
auto p = &ps[screenpeek];
p->sea_sick_stat = 0;
ud.ufospawnsminion = 0;

View file

@ -711,7 +711,7 @@ void spawneffector(DDukeActor* actor, TArray<DDukeActor*>* actors)
{
if (wal.twoSided() &&
wal.nextSector()->hitag == 0 &&
(wal.nextSector()->lotag < 3 || (isRRRA() && wal.nextSector()->lotag == ST_160_FLOOR_TELEPORT)))
(wal.nextSector()->lotag < 3 || ((ud.mapflags & MFLAG_ALLSECTORTYPES) && wal.nextSector()->lotag == ST_160_FLOOR_TELEPORT)))
{
s = wal.nextSector();
break;

View file

@ -179,6 +179,7 @@ struct animwalltype
struct user_defs
{
int mapflags;
uint8_t god, cashman, eog;
uint8_t clipping;
uint8_t user_pals[MAXPLAYERS];

View file

@ -1767,6 +1767,7 @@ DEFINE_FIELD_X(DukeGameInfo, DukeGameInfo, weaponsandammosprites);
DEFINE_GLOBAL_UNSIZED(gs)
DEFINE_FIELD_X(DukeUserDefs, user_defs, mapflags);
DEFINE_FIELD_X(DukeUserDefs, user_defs, god);
DEFINE_FIELD_X(DukeUserDefs, user_defs, cashman);
DEFINE_FIELD_X(DukeUserDefs, user_defs, eog);

View file

@ -83,7 +83,8 @@ extend class DukeActor
actor.cstat &= ~CSTAT_SPRITE_BLOCK_ALL;
Raze.hitscan(pos, sectp, (ang.ToVector() * vel, zvel * 64), hit, CLIPMASK1);
if (Raze.isRRRA() && hit.hitSector != nullptr && ((hit.hitSector.lotag == ST_160_FLOOR_TELEPORT && zvel > 0) || (hit.hitSector.lotag == ST_161_CEILING_TELEPORT && zvel < 0))
if ((ud.mapflags & MFLAG_ALLSECTORTYPES) && hit.hitSector != nullptr &&
((hit.hitSector.lotag == ST_160_FLOOR_TELEPORT && zvel > 0) || (hit.hitSector.lotag == ST_161_CEILING_TELEPORT && zvel < 0))
&& hit.hitActor == nullptr && hit.hitWall == nullptr)
{
DukeStatIterator its;

View file

@ -35,7 +35,8 @@ class DukeMeleeAttack : DukeActor
Raze.hitscan(pos, sectp, (ang.ToVector() * vel, zvel * 64), hit, CLIPMASK1);
if (Raze.isRRRA() && hit.hitSector != nullptr && ((hit.hitSector.lotag == ST_160_FLOOR_TELEPORT && zvel > 0) || (hit.hitSector.lotag == ST_161_CEILING_TELEPORT && zvel < 0))
if ((ud.mapflags & MFLAG_ALLSECTORTYPES) && hit.hitSector != nullptr &&
((hit.hitSector.lotag == ST_160_FLOOR_TELEPORT && zvel > 0) || (hit.hitSector.lotag == ST_161_CEILING_TELEPORT && zvel < 0))
&& hit.hitActor == nullptr && hit.hitWall == nullptr)
{
DukeStatIterator its;

View file

@ -70,7 +70,7 @@ class DukeMortar : DukeActor
self.makeitfall();
// Feature check later needs to be map controlled, not game controlled.
if (sectp.lotag != ST_1_ABOVE_WATER && (!Raze.isRRRA() || sectp.lotag != ST_160_FLOOR_TELEPORT) && self.pos.Z >= self.floorz - 1 && self.yint < 3)
if (sectp.lotag != ST_1_ABOVE_WATER && (!(ud.mapflags & MFLAG_ALLSECTORTYPES) || sectp.lotag != ST_160_FLOOR_TELEPORT) && self.pos.Z >= self.floorz - 1 && self.yint < 3)
{
if (self.yint > 0 || (self.yint == 0 && self.floorz == sectp.floorz))
{

View file

@ -14,7 +14,7 @@ class RedneckPowderKeg : DukeItemBase
override void Tick()
{
let sectp = self.sector;
if (sectp.lotag != ST_1_ABOVE_WATER && (!Raze.isRRRA() && sectp.lotag != ST_160_FLOOR_TELEPORT))
if (sectp.lotag != ST_1_ABOVE_WATER && (!(ud.mapflags & MFLAG_ALLSECTORTYPES) && sectp.lotag != ST_160_FLOOR_TELEPORT))
if (self.vel.X != 0)
{
movesprite((self.Angle.ToVector()* self.vel.X, self.vel.Z), CLIPMASK0);

View file

@ -494,9 +494,14 @@ struct DukeGameInfo native
}
enum mapflags_t
{
MFLAG_ALLSECTORTYPES =2, // enables RRRA's sector types regardless of the game being played.
};
struct DukeUserDefs native
{
native readonly int mapflags;
native uint8 god, cashman, eog;
native readonly uint8 clipping;
native readonly uint8 user_pals[MAXPLAYERS];