mirror of
https://github.com/DrBeef/Raze.git
synced 2024-11-15 00:41:55 +00:00
- Duke: change all checks for mirrors to texture IDs
This commit is contained in:
parent
5b8dd84361
commit
1a98f9b478
20 changed files with 55 additions and 44 deletions
|
@ -1704,7 +1704,7 @@ void move_d(DDukeActor *actor, int playernum, int xvel)
|
|||
actor->spr.shade += (actor->sector()->ceilingshade - actor->spr.shade) >> 1;
|
||||
else actor->spr.shade += (actor->sector()->floorshade - actor->spr.shade) >> 1;
|
||||
|
||||
if (actor->sector()->floorpicnum == DTILE_MIRROR)
|
||||
if (actor->sector()->floortexture() == mirrortex)
|
||||
actor->Destroy();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1697,7 +1697,7 @@ void move_r(DDukeActor *actor, int pnum, int xvel)
|
|||
}
|
||||
else actor->spr.shade += (actor->sector()->floorshade - actor->spr.shade) >> 1;
|
||||
|
||||
if (actor->sector()->floorpicnum == RTILE_MIRROR)
|
||||
if (actor->sector()->floortexture() == mirrortex)
|
||||
actor->Destroy();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -352,7 +352,7 @@ void animatesprites_d(tspriteArray& tsprites, const DVector2& viewVec, DAngle vi
|
|||
}
|
||||
|
||||
h->dispicnum = t->picnum;
|
||||
if (t->sectp->floorpicnum == DTILE_MIRROR)
|
||||
if (t->sectp->floortexture() == mirrortex)
|
||||
t->scale = DVector2(0, 0);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -425,7 +425,7 @@ void animatesprites_r(tspriteArray& tsprites, const DVector2& viewVec, DAngle vi
|
|||
}
|
||||
|
||||
h->dispicnum = t->picnum;
|
||||
if (t->sectp->floorpicnum == RTILE_MIRROR)
|
||||
if (t->sectp->floortexture() == mirrortex)
|
||||
t->scale = DVector2(0, 0);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,6 +25,8 @@ enum
|
|||
RESPAWN = 9,
|
||||
GPSPEED = 10,
|
||||
FOF = 13,
|
||||
MIRROR_DUKE = 560,
|
||||
MIRROR_RR = 1089,
|
||||
|
||||
// hack alert! CYCLER is free for use here as all items of this type get destroyed right on map spawn and this value never gets checked anywhere else.
|
||||
// This avoids overallocation of empty tile slots as a high value slightly below the tile limit would do.
|
||||
|
|
|
@ -188,7 +188,6 @@ int TILE_CLOUDYSKIES;
|
|||
int TILE_ACCESSSWITCH;
|
||||
int TILE_ACCESSSWITCH2;
|
||||
int TILE_HEN;
|
||||
int TILE_MIRROR;
|
||||
int TILE_MIRRORBROKE;
|
||||
int TILE_LOADSCREEN;
|
||||
int TILE_CROSSHAIR;
|
||||
|
|
|
@ -127,6 +127,7 @@ void CallPlayFTASound(DDukeActor* actor);
|
|||
void CallStandingOn(DDukeActor* actor, player_struct* p);
|
||||
void CallRunState(DDukeActor* actor);
|
||||
|
||||
extern FTextureID mirrortex, foftex;
|
||||
|
||||
END_DUKE_NS
|
||||
|
||||
|
|
|
@ -293,7 +293,6 @@ void initactorflags_d()
|
|||
TILE_CLOUDYSKIES = DTILE_CLOUDYSKIES;
|
||||
TILE_ACCESSSWITCH = DTILE_ACCESSSWITCH;
|
||||
TILE_ACCESSSWITCH2 = DTILE_ACCESSSWITCH2;
|
||||
TILE_MIRROR = DTILE_MIRROR;
|
||||
TILE_MIRRORBROKE = DTILE_MIRRORBROKE;
|
||||
TILE_LOADSCREEN = DTILE_LOADSCREEN;
|
||||
TILE_CROSSHAIR = DTILE_CROSSHAIR;
|
||||
|
|
|
@ -293,7 +293,6 @@ void initactorflags_r()
|
|||
TILE_CLOUDYSKIES = RTILE_CLOUDYSKIES;
|
||||
TILE_ACCESSSWITCH = RTILE_ACCESSSWITCH;
|
||||
TILE_ACCESSSWITCH2 = RTILE_ACCESSSWITCH2;
|
||||
TILE_MIRROR = RTILE_MIRROR;
|
||||
TILE_MIRRORBROKE = RTILE_MIRRORBROKE;
|
||||
TILE_HEN = RTILE_HEN;
|
||||
TILE_LOADSCREEN = RTILE_LOADSCREEN;
|
||||
|
|
|
@ -51,6 +51,8 @@ void SetDispatcher();
|
|||
void InitCheats();
|
||||
int registerosdcommands(void);
|
||||
|
||||
FTextureID mirrortex, foftex;
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
// DObject stuff - everything GC related.
|
||||
|
@ -309,12 +311,12 @@ void GameInterface::SetupSpecialTextures(TilesetBuildInfo& info)
|
|||
FImageSource* viewscreen;
|
||||
if (!isRR())
|
||||
{
|
||||
info.Delete(560); // the mirror tile.
|
||||
info.Delete(MIRROR_DUKE); // the mirror tile.
|
||||
viewscreen = info.tile[502].tileimage;
|
||||
}
|
||||
else
|
||||
{
|
||||
info.Delete(1089); // the mirror tile.
|
||||
info.Delete(MIRROR_RR); // the mirror tile.
|
||||
info.Delete(0); // RR uses this as an empty texture
|
||||
info.MakeWritable(2025); // bowling lane pin displays
|
||||
info.MakeWritable(2026);
|
||||
|
@ -338,6 +340,18 @@ int GameInterface::GetCurrentSkill()
|
|||
return ud.player_skill - 1;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
// IDs for non-textures that need direct checking
|
||||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void setTextureIDs()
|
||||
{
|
||||
mirrortex = tileGetTextureID(isRR() ? MIRROR_RR : MIRROR_DUKE);
|
||||
foftex = tileGetTextureID(FOF);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
// set up the game module's state
|
||||
|
@ -382,6 +396,7 @@ void GameInterface::app_init()
|
|||
|
||||
loadcons();
|
||||
fi.initactorflags();
|
||||
setTextureIDs(); // sets a few texture IDs needed for map checking.
|
||||
duke_menufont->Callback(); // depends on the .CON files so it must be after loadcons
|
||||
|
||||
OnEvent(EVENT_INIT);
|
||||
|
|
|
@ -21,7 +21,6 @@ extern int TILE_CLOUDYSKIES;
|
|||
extern int TILE_ACCESSSWITCH;
|
||||
extern int TILE_ACCESSSWITCH2;
|
||||
extern int TILE_HEN;
|
||||
extern int TILE_MIRROR;
|
||||
extern int TILE_MIRRORBROKE;
|
||||
extern int TILE_LOADSCREEN;
|
||||
extern int TILE_CROSSHAIR;
|
||||
|
|
|
@ -2844,7 +2844,7 @@ void processinput_d(int snum)
|
|||
pact->vel.X = clamp((p->GetActor()->spr.pos.XY() - p->bobpos).Length(), 0., 32.);
|
||||
if (p->on_ground) p->bobcounter += int(p->GetActor()->vel.X * 8);
|
||||
|
||||
p->backuppos(ud.clipping == 0 && ((p->insector() && p->cursector->floorpicnum == DTILE_MIRROR) || !p->insector()));
|
||||
p->backuppos(ud.clipping == 0 && ((p->insector() && p->cursector->floortexture() == mirrortex) || !p->insector()));
|
||||
|
||||
// Shrinking code
|
||||
|
||||
|
|
|
@ -3441,7 +3441,7 @@ void processinput_r(int snum)
|
|||
pact->vel.X = clamp((p->GetActor()->spr.pos.XY() - p->bobpos).Length(), 0., 32.);
|
||||
if (p->on_ground) p->bobcounter += int(p->GetActor()->vel.X * 8);
|
||||
|
||||
p->backuppos(ud.clipping == 0 && ((p->insector() && p->cursector->floorpicnum == RTILE_MIRROR) || !p->insector()));
|
||||
p->backuppos(ud.clipping == 0 && ((p->insector() && p->cursector->floortexture() == mirrortex) || !p->insector()));
|
||||
|
||||
// Shrinking code
|
||||
|
||||
|
|
|
@ -805,7 +805,7 @@ static void SpawnPortals()
|
|||
{
|
||||
for (auto& wal : wall)
|
||||
{
|
||||
if (wal.overpicnum == TILE_MIRROR && (wal.cstat & CSTAT_WALL_1WAY)) wal.portalflags |= PORTAL_WALL_MIRROR;
|
||||
if (wal.overtexture() == mirrortex && (wal.cstat & CSTAT_WALL_1WAY)) wal.portalflags |= PORTAL_WALL_MIRROR;
|
||||
}
|
||||
|
||||
portalClear();
|
||||
|
@ -887,7 +887,7 @@ static void SpawnPortals()
|
|||
}
|
||||
}
|
||||
}
|
||||
else if (sectp->ceilingpicnum == FOF && sectp->portalflags != PORTAL_SECTOR_CEILING)
|
||||
else if (sectp->ceilingtexture() == foftex && sectp->portalflags != PORTAL_SECTOR_CEILING)
|
||||
{
|
||||
for (auto& pt : allPortals)
|
||||
{
|
||||
|
|
|
@ -325,16 +325,16 @@ void prelevel_d(int g, TArray<DDukeActor*>& actors)
|
|||
|
||||
for (auto& wal : wall)
|
||||
{
|
||||
if (wal.overpicnum == DTILE_MIRROR && (wal.cstat & CSTAT_WALL_1WAY) != 0)
|
||||
if (wal.overtexture() == mirrortex && (wal.cstat & CSTAT_WALL_1WAY) != 0)
|
||||
{
|
||||
auto sectp = wal.nextSector();
|
||||
|
||||
if (mirrorcnt > 63)
|
||||
I_Error("Too many mirrors (64 max.)");
|
||||
if (sectp && sectp->ceilingpicnum != DTILE_MIRROR)
|
||||
if (sectp && sectp->ceilingtexture() != mirrortex)
|
||||
{
|
||||
sectp->ceilingpicnum = DTILE_MIRROR;
|
||||
sectp->floorpicnum = DTILE_MIRROR;
|
||||
sectp->setceilingtexture(mirrortex);
|
||||
sectp->setfloortexture(mirrortex);
|
||||
mirrorwall[mirrorcnt] = &wal;
|
||||
mirrorsector[mirrorcnt] = sectp;
|
||||
mirrorcnt++;
|
||||
|
@ -443,8 +443,8 @@ void prelevel_d(int g, TArray<DDukeActor*>& actors)
|
|||
{
|
||||
for (auto& wal : mirrorsector[i]->walls)
|
||||
{
|
||||
wal.wallpicnum = DTILE_MIRROR;
|
||||
wal.overpicnum = DTILE_MIRROR;
|
||||
wal.setwalltexture(mirrortex);
|
||||
wal.setovertexture(mirrortex);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -634,22 +634,19 @@ void prelevel_r(int g, TArray<DDukeActor*>& actors)
|
|||
|
||||
mirrorcnt = 0;
|
||||
|
||||
for (auto& wl : wall)
|
||||
for (auto& wal : wall)
|
||||
{
|
||||
walltype* wal = &wl;
|
||||
|
||||
|
||||
if (wal->overpicnum == RTILE_MIRROR && (wal->cstat & CSTAT_WALL_1WAY) != 0)
|
||||
if (wal.overtexture() == mirrortex && (wal.cstat & CSTAT_WALL_1WAY) != 0)
|
||||
{
|
||||
auto sectp = wal->nextSector();
|
||||
auto sectp = wal.nextSector();
|
||||
|
||||
if (mirrorcnt > 63)
|
||||
I_Error("Too many mirrors (64 max.)");
|
||||
if (sectp && sectp->ceilingpicnum != RTILE_MIRROR)
|
||||
if (sectp && sectp->ceilingtexture() != mirrortex)
|
||||
{
|
||||
sectp->ceilingpicnum = RTILE_MIRROR;
|
||||
sectp->floorpicnum = RTILE_MIRROR;
|
||||
mirrorwall[mirrorcnt] = wal;
|
||||
sectp->setceilingtexture(mirrortex);
|
||||
sectp->setfloortexture(mirrortex);
|
||||
mirrorwall[mirrorcnt] = &wal;
|
||||
mirrorsector[mirrorcnt] = sectp;
|
||||
mirrorcnt++;
|
||||
continue;
|
||||
|
@ -662,29 +659,29 @@ void prelevel_r(int g, TArray<DDukeActor*>& actors)
|
|||
animwall[numanimwalls].tag = 0;
|
||||
animwall[numanimwalls].wall = nullptr;
|
||||
|
||||
switch (wal->overpicnum)
|
||||
switch (wal.overpicnum)
|
||||
{
|
||||
case RTILE_FANSPRITE:
|
||||
//wal.cstat |= CSTAT_WALL_BLOCK | CSTAT_WALL_BLOCK_HITSCAN; Original code assigned this to 'wall', i.e. wall[0]
|
||||
animwall[numanimwalls].wall = wal;
|
||||
animwall[numanimwalls].wall = &wal;
|
||||
numanimwalls++;
|
||||
break;
|
||||
case RTILE_BIGFORCE:
|
||||
animwall[numanimwalls].wall = wal;
|
||||
animwall[numanimwalls].wall = &wal;
|
||||
numanimwalls++;
|
||||
continue;
|
||||
}
|
||||
|
||||
wal->extra = -1;
|
||||
wal.extra = -1;
|
||||
|
||||
switch (wal->wallpicnum)
|
||||
switch (wal.wallpicnum)
|
||||
{
|
||||
case RTILE_SCREENBREAK6:
|
||||
case RTILE_SCREENBREAK7:
|
||||
case RTILE_SCREENBREAK8:
|
||||
for (j = RTILE_SCREENBREAK6; j <= RTILE_SCREENBREAK8; j++)
|
||||
tloadtile(j);
|
||||
animwall[numanimwalls].wall = wal;
|
||||
animwall[numanimwalls].wall = &wal;
|
||||
animwall[numanimwalls].tag = -1;
|
||||
numanimwalls++;
|
||||
break;
|
||||
|
@ -694,10 +691,10 @@ void prelevel_r(int g, TArray<DDukeActor*>& actors)
|
|||
//Invalidate textures in sector behind mirror
|
||||
for (i = 0; i < mirrorcnt; i++)
|
||||
{
|
||||
for (auto& mwal : mirrorsector[i]->walls)
|
||||
for (auto& wal : mirrorsector[i]->walls)
|
||||
{
|
||||
mwal.wallpicnum = RTILE_MIRROR;
|
||||
mwal.overpicnum = RTILE_MIRROR;
|
||||
wal.setwalltexture(mirrortex);
|
||||
wal.setovertexture(mirrortex);
|
||||
}
|
||||
}
|
||||
thunder_brightness = 0;
|
||||
|
|
|
@ -1273,7 +1273,7 @@ void operateforcefields_common(DDukeActor *effector, int low, const std::initial
|
|||
|
||||
void checkhitwall(DDukeActor* spr, walltype* wal, const DVector3& pos)
|
||||
{
|
||||
if (wal->overpicnum == TILE_MIRROR && actorflag(spr, SFLAG2_BREAKMIRRORS))
|
||||
if (wal->overtexture() == mirrortex && actorflag(spr, SFLAG2_BREAKMIRRORS))
|
||||
{
|
||||
lotsofglass(spr, wal, 70);
|
||||
wal->cstat &= ~CSTAT_WALL_MASKED;
|
||||
|
|
|
@ -832,7 +832,7 @@ void checksectors_d(int snum)
|
|||
|
||||
if (hitscanwall != nullptr)
|
||||
{
|
||||
if (dist < 80 && hitscanwall->overpicnum == DTILE_MIRROR)
|
||||
if (dist < 80 && hitscanwall->overtexture() == mirrortex)
|
||||
if (hitscanwall->lotag > 0 && S_CheckSoundPlaying(hitscanwall->lotag) == 0 && snum == screenpeek)
|
||||
{
|
||||
S_PlayActorSound(hitscanwall->lotag, pact);
|
||||
|
|
|
@ -901,7 +901,7 @@ void checksectors_r(int snum)
|
|||
{
|
||||
if (isRRRA())
|
||||
{
|
||||
if (hitscanwall->overpicnum == RTILE_MIRROR && snum == screenpeek)
|
||||
if (hitscanwall->overtexture() == mirrortex && snum == screenpeek)
|
||||
if (numplayers == 1)
|
||||
{
|
||||
if (S_CheckActorSoundPlaying(pact, 27) == 0 && S_CheckActorSoundPlaying(pact, 28) == 0 && S_CheckActorSoundPlaying(pact, 29) == 0
|
||||
|
@ -924,7 +924,7 @@ void checksectors_r(int snum)
|
|||
}
|
||||
else
|
||||
{
|
||||
if (hitscanwall->overpicnum == RTILE_MIRROR)
|
||||
if (hitscanwall->overtexture() == mirrortex)
|
||||
if (hitscanwall->lotag > 0 && S_CheckActorSoundPlaying(pact, hitscanwall->lotag) == 0 && snum == screenpeek)
|
||||
{
|
||||
S_PlayActorSound(hitscanwall->lotag, pact);
|
||||
|
|
|
@ -1323,7 +1323,7 @@ DEFINE_ACTION_FUNCTION_NATIVE(_DukeLevel, wallflags, duke_wallflags)
|
|||
|
||||
int duke_ismirror(walltype* wal)
|
||||
{
|
||||
return wal->wallpicnum == TILE_MIRROR || wal->overpicnum == TILE_MIRROR;
|
||||
return wal->walltexture() == mirrortex || wal->overtexture() == mirrortex;
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION_NATIVE(_DukeLevel, ismirror, duke_ismirror)
|
||||
|
|
Loading…
Reference in a new issue