mirror of
https://github.com/DrBeef/Raze.git
synced 2024-11-25 21:41:44 +00:00
- consolidated the animwall code by using texture flags.
This is way too hacky for generalization. For that newly defined control actors are surely a better option.
This commit is contained in:
parent
bfdfff7a42
commit
90702ae2f5
21 changed files with 200 additions and 410 deletions
|
@ -462,7 +462,7 @@ void Display()
|
||||||
if (!tex.isValid()) tex = tileGetTextureID(atoi(drawtile));
|
if (!tex.isValid()) tex = tileGetTextureID(atoi(drawtile));
|
||||||
if (tex.isValid())
|
if (tex.isValid())
|
||||||
{
|
{
|
||||||
auto tx = TexMan.GetGameTexture(tex);
|
auto tx = TexMan.GetGameTexture(tex, true);
|
||||||
if (tx)
|
if (tx)
|
||||||
{
|
{
|
||||||
int width = (int)tx->GetDisplayWidth();
|
int width = (int)tx->GetDisplayWidth();
|
||||||
|
|
|
@ -1108,7 +1108,7 @@ void handle_se30(DDukeActor *actor, int JIBS6)
|
||||||
actor->SetOwner(nullptr);
|
actor->SetOwner(nullptr);
|
||||||
actor->spr.Angles.Yaw += DAngle180;
|
actor->spr.Angles.Yaw += DAngle180;
|
||||||
actor->temp_data[4] = 0;
|
actor->temp_data[4] = 0;
|
||||||
fi.operateforcefields(actor, actor->spr.hitag);
|
operateforcefields(actor, actor->spr.hitag);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -112,7 +112,7 @@ static const char* cheatUnlock()
|
||||||
operatesectors(§, ps[myconnectindex].GetActor());
|
operatesectors(§, ps[myconnectindex].GetActor());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fi.operateforcefields(ps[myconnectindex].GetActor(), -1);
|
operateforcefields(ps[myconnectindex].GetActor(), -1);
|
||||||
return quoteMgr.GetQuote(QUOTE_CHEAT_UNLOCK);
|
return quoteMgr.GetQuote(QUOTE_CHEAT_UNLOCK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -422,7 +422,11 @@ enum
|
||||||
TFLAG_BLOCKDOOR = 1 << 4,
|
TFLAG_BLOCKDOOR = 1 << 4,
|
||||||
TFLAG_NOBLOODSPLAT = 1 << 5,
|
TFLAG_NOBLOODSPLAT = 1 << 5,
|
||||||
TFLAG_NOCIRCLEREFLECT = 1 << 6,
|
TFLAG_NOCIRCLEREFLECT = 1 << 6,
|
||||||
TFLAG_INTERPOLATEWALL = 1 << 7,
|
TFLAG_SEASICKWALL = 1 << 7,
|
||||||
|
TFLAG_FORCEFIELD = 1 << 8,
|
||||||
|
TFLAG_ANIMFORCEFIELD = 1 << 9,
|
||||||
|
TFLAG_ANIMSCREEN = 1 << 10,
|
||||||
|
TFLAG_ANIMSCREENNOISE = 1 << 11,
|
||||||
};
|
};
|
||||||
|
|
||||||
enum
|
enum
|
||||||
|
|
|
@ -35,10 +35,6 @@ BEGIN_DUKE_NS
|
||||||
void initactorflags_d();
|
void initactorflags_d();
|
||||||
void initactorflags_r();
|
void initactorflags_r();
|
||||||
|
|
||||||
void animatewalls_d(void);
|
|
||||||
void animatewalls_r(void);
|
|
||||||
void operateforcefields_r(DDukeActor* act, int low);
|
|
||||||
void operateforcefields_d(DDukeActor* act, int low);
|
|
||||||
bool checkaccessswitch_d(int snum, int pal, DDukeActor *act, walltype* w);
|
bool checkaccessswitch_d(int snum, int pal, DDukeActor *act, walltype* w);
|
||||||
bool checkaccessswitch_r(int snum, int pal, DDukeActor* act, walltype* w);
|
bool checkaccessswitch_r(int snum, int pal, DDukeActor* act, walltype* w);
|
||||||
void activatebysector_d(sectortype* sect, DDukeActor* j);
|
void activatebysector_d(sectortype* sect, DDukeActor* j);
|
||||||
|
@ -99,8 +95,6 @@ void SetDispatcher()
|
||||||
think_d,
|
think_d,
|
||||||
movetransports_d,
|
movetransports_d,
|
||||||
initactorflags_d,
|
initactorflags_d,
|
||||||
animatewalls_d,
|
|
||||||
operateforcefields_d,
|
|
||||||
checkaccessswitch_d,
|
checkaccessswitch_d,
|
||||||
activatebysector_d,
|
activatebysector_d,
|
||||||
checkhitsprite_d,
|
checkhitsprite_d,
|
||||||
|
@ -135,8 +129,6 @@ void SetDispatcher()
|
||||||
think_r,
|
think_r,
|
||||||
movetransports_r,
|
movetransports_r,
|
||||||
initactorflags_r,
|
initactorflags_r,
|
||||||
animatewalls_r,
|
|
||||||
operateforcefields_r,
|
|
||||||
checkaccessswitch_r,
|
checkaccessswitch_r,
|
||||||
activatebysector_r,
|
activatebysector_r,
|
||||||
checkhitsprite_r,
|
checkhitsprite_r,
|
||||||
|
|
|
@ -73,8 +73,6 @@ struct Dispatcher
|
||||||
void (*think)();
|
void (*think)();
|
||||||
void (*movetransports)();
|
void (*movetransports)();
|
||||||
void (*initactorflags)();
|
void (*initactorflags)();
|
||||||
void (*animatewalls)();
|
|
||||||
void (*operateforcefields)(DDukeActor* act, int low);
|
|
||||||
bool (*checkaccessswitch)(int snum, int switchpal, DDukeActor* act, walltype* w);
|
bool (*checkaccessswitch)(int snum, int switchpal, DDukeActor* act, walltype* w);
|
||||||
void (*activatebysector)(sectortype* sect, DDukeActor* j);
|
void (*activatebysector)(sectortype* sect, DDukeActor* j);
|
||||||
void (*checkhitsprite)(DDukeActor* i, DDukeActor* sn);
|
void (*checkhitsprite)(DDukeActor* i, DDukeActor* sn);
|
||||||
|
|
|
@ -15,6 +15,7 @@ BEGIN_DUKE_NS
|
||||||
// dumping ground for all external function prototypes to keep them out of the important headers.
|
// dumping ground for all external function prototypes to keep them out of the important headers.
|
||||||
// This list is not sorted in any way.
|
// This list is not sorted in any way.
|
||||||
|
|
||||||
|
void animatewalls(void);
|
||||||
void lava_cleararrays();
|
void lava_cleararrays();
|
||||||
void addjaildoor(int p1, int p2, int iht, int jlt, int p3, sectortype* h);
|
void addjaildoor(int p1, int p2, int iht, int jlt, int p3, sectortype* h);
|
||||||
void addminecart(int p1, int p2, sectortype* i, int iht, int p3, sectortype* childsectnum);
|
void addminecart(int p1, int p2, sectortype* i, int iht, int p3, sectortype* childsectnum);
|
||||||
|
@ -129,7 +130,7 @@ bool isablockdoor(int tileNum);
|
||||||
bool activatewarpelevators(DDukeActor* s, int w);
|
bool activatewarpelevators(DDukeActor* s, int w);
|
||||||
int check_activator_motion(int lotag);
|
int check_activator_motion(int lotag);
|
||||||
void operateactivators(int l, player_struct* w);
|
void operateactivators(int l, player_struct* w);
|
||||||
void operateforcefields_common(DDukeActor* s, int low, const std::initializer_list<int>& tiles);
|
void operateforcefields(DDukeActor* s, int low);
|
||||||
void operatemasterswitches(int lotag);
|
void operatemasterswitches(int lotag);
|
||||||
void operatesectors(sectortype* s, DDukeActor* i);
|
void operatesectors(sectortype* s, DDukeActor* i);
|
||||||
void hud_input(int playerNum);
|
void hud_input(int playerNum);
|
||||||
|
|
|
@ -101,7 +101,7 @@ void GameInterface::Ticker()
|
||||||
|
|
||||||
if ((everyothertime & 1) == 0)
|
if ((everyothertime & 1) == 0)
|
||||||
{
|
{
|
||||||
fi.animatewalls();
|
animatewalls();
|
||||||
movecyclers();
|
movecyclers();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -704,6 +704,69 @@ void prelevel_common(int g)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mirrorcnt = 0;
|
||||||
|
numanimwalls = 0;
|
||||||
|
for (auto& wal : wall)
|
||||||
|
{
|
||||||
|
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->ceilingtexture != mirrortex)
|
||||||
|
{
|
||||||
|
sectp->setceilingtexture(mirrortex);
|
||||||
|
sectp->setfloortexture(mirrortex);
|
||||||
|
mirrorwall[mirrorcnt] = &wal;
|
||||||
|
mirrorsector[mirrorcnt] = sectp;
|
||||||
|
mirrorcnt++;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (tileflags(wal.overtexture()) & (TFLAG_FORCEFIELD | TFLAG_ANIMFORCEFIELD))
|
||||||
|
{
|
||||||
|
animwall[numanimwalls].wall = &wal;
|
||||||
|
animwall[numanimwalls].tag = 0;
|
||||||
|
animwall[numanimwalls].origtex = wal.overtexture();
|
||||||
|
animwall[numanimwalls].overpic = true;
|
||||||
|
numanimwalls++;
|
||||||
|
|
||||||
|
if (tileflags(wal.overtexture()) & TFLAG_ANIMFORCEFIELD)
|
||||||
|
{
|
||||||
|
if (wal.shade > 31)
|
||||||
|
wal.cstat = 0;
|
||||||
|
else wal.cstat |= CSTAT_WALL_BLOCK | CSTAT_WALL_ALIGN_BOTTOM | CSTAT_WALL_MASKED | CSTAT_WALL_BLOCK_HITSCAN | CSTAT_WALL_YFLIP;
|
||||||
|
|
||||||
|
if (wal.lotag && wal.twoSided())
|
||||||
|
wal.nextWall()->lotag = wal.lotag;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (tileflags(wal.walltexture()) & (TFLAG_ANIMSCREEN | TFLAG_ANIMSCREENNOISE))
|
||||||
|
{
|
||||||
|
animwall[numanimwalls].wall = &wal;
|
||||||
|
animwall[numanimwalls].tag = -1;
|
||||||
|
animwall[numanimwalls].origtex = wal.walltexture();
|
||||||
|
animwall[numanimwalls].overpic = false;
|
||||||
|
numanimwalls++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (numanimwalls >= MAXANIMWALLS)
|
||||||
|
I_Error("Too many 'anim' walls (max 512.)");
|
||||||
|
}
|
||||||
|
|
||||||
|
//Invalidate textures in sector behind mirror
|
||||||
|
for (int i = 0; i < mirrorcnt; i++)
|
||||||
|
{
|
||||||
|
for (auto& wal : mirrorsector[i]->walls)
|
||||||
|
{
|
||||||
|
wal.setwalltexture(mirrortex);
|
||||||
|
wal.setovertexture(mirrortex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
thunder_brightness = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
@ -1082,13 +1145,10 @@ void enterlevel(MapRecord *mi, int gamemode)
|
||||||
clearfrags();
|
clearfrags();
|
||||||
resettimevars(); // Here we go
|
resettimevars(); // Here we go
|
||||||
setLevelStarted(mi);
|
setLevelStarted(mi);
|
||||||
if (isRRRA() && ps[screenpeek].sea_sick_stat == 1)
|
for (auto& wal : wall)
|
||||||
{
|
{
|
||||||
for (auto& wal : wall)
|
if (tileflags(wal.walltexture()) & TFLAG_SEASICKWALL)
|
||||||
{
|
StartInterpolation(&wal, Interp_Wall_PanX);
|
||||||
if (tileflags(wal.walltexture()) & TFLAG_INTERPOLATEWALL)
|
|
||||||
StartInterpolation(&wal, Interp_Wall_PanX);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -249,7 +249,7 @@ void spriteinit_d(DDukeActor* actor, TArray<DDukeActor*>& actors)
|
||||||
|
|
||||||
void prelevel_d(int g, TArray<DDukeActor*>& actors)
|
void prelevel_d(int g, TArray<DDukeActor*>& actors)
|
||||||
{
|
{
|
||||||
int i, j, lotaglist;
|
int j, lotaglist;
|
||||||
TArray<short> lotags;
|
TArray<short> lotags;
|
||||||
|
|
||||||
prelevel_common(g);
|
prelevel_common(g);
|
||||||
|
@ -307,133 +307,6 @@ void prelevel_d(int g, TArray<DDukeActor*>& actors)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
mirrorcnt = 0;
|
|
||||||
|
|
||||||
for (auto& wal : wall)
|
|
||||||
{
|
|
||||||
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->ceilingtexture != mirrortex)
|
|
||||||
{
|
|
||||||
sectp->setceilingtexture(mirrortex);
|
|
||||||
sectp->setfloortexture(mirrortex);
|
|
||||||
mirrorwall[mirrorcnt] = &wal;
|
|
||||||
mirrorsector[mirrorcnt] = sectp;
|
|
||||||
mirrorcnt++;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (numanimwalls >= MAXANIMWALLS)
|
|
||||||
I_Error("Too many 'anim' walls (max 512.)");
|
|
||||||
|
|
||||||
animwall[numanimwalls].tag = 0;
|
|
||||||
animwall[numanimwalls].wall = nullptr;
|
|
||||||
|
|
||||||
switch (wal.overpicnum)
|
|
||||||
{
|
|
||||||
case DTILE_FANSHADOW:
|
|
||||||
case DTILE_FANSPRITE:
|
|
||||||
//wal.cstat |= CSTAT_WALL_BLOCK | CSTAT_WALL_BLOCK_HITSCAN; Original code assigned this to 'wall', i.e. wall[0]
|
|
||||||
animwall[numanimwalls].wall = &wal;
|
|
||||||
numanimwalls++;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case DTILE_W_FORCEFIELD:
|
|
||||||
for (int jj = 0; jj < 3; jj++)
|
|
||||||
tloadtile(DTILE_W_FORCEFIELD + jj);
|
|
||||||
[[fallthrough]];
|
|
||||||
case DTILE_W_FORCEFIELD + 1:
|
|
||||||
case DTILE_W_FORCEFIELD + 2:
|
|
||||||
if (wal.shade > 31)
|
|
||||||
wal.cstat = 0;
|
|
||||||
else wal.cstat |= CSTAT_WALL_BLOCK | CSTAT_WALL_ALIGN_BOTTOM | CSTAT_WALL_MASKED | CSTAT_WALL_BLOCK_HITSCAN | CSTAT_WALL_YFLIP;
|
|
||||||
|
|
||||||
if (wal.lotag && wal.twoSided())
|
|
||||||
wal.nextWall()->lotag = wal.lotag;
|
|
||||||
[[fallthrough]];
|
|
||||||
|
|
||||||
case DTILE_BIGFORCE:
|
|
||||||
|
|
||||||
animwall[numanimwalls].wall = &wal;
|
|
||||||
numanimwalls++;
|
|
||||||
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
wal.extra = -1;
|
|
||||||
|
|
||||||
switch (wal.wallpicnum)
|
|
||||||
{
|
|
||||||
case DTILE_W_TECHWALL1:
|
|
||||||
case DTILE_W_TECHWALL2:
|
|
||||||
case DTILE_W_TECHWALL3:
|
|
||||||
case DTILE_W_TECHWALL4:
|
|
||||||
animwall[numanimwalls].wall = &wal;
|
|
||||||
// animwall[numanimwalls].tag = -1;
|
|
||||||
numanimwalls++;
|
|
||||||
break;
|
|
||||||
case DTILE_SCREENBREAK6:
|
|
||||||
case DTILE_SCREENBREAK7:
|
|
||||||
case DTILE_SCREENBREAK8:
|
|
||||||
for (int jj = DTILE_SCREENBREAK6; jj < DTILE_SCREENBREAK9; jj++)
|
|
||||||
tloadtile(jj);
|
|
||||||
animwall[numanimwalls].wall = &wal;
|
|
||||||
animwall[numanimwalls].tag = -1;
|
|
||||||
numanimwalls++;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case DTILE_FEMPIC1:
|
|
||||||
case DTILE_FEMPIC2:
|
|
||||||
case DTILE_FEMPIC3:
|
|
||||||
|
|
||||||
wal.extra = wal.wallpicnum;
|
|
||||||
animwall[numanimwalls].tag = -1;
|
|
||||||
|
|
||||||
animwall[numanimwalls].wall = &wal;
|
|
||||||
animwall[numanimwalls].tag = wal.wallpicnum;
|
|
||||||
numanimwalls++;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case DTILE_SCREENBREAK1:
|
|
||||||
case DTILE_SCREENBREAK2:
|
|
||||||
case DTILE_SCREENBREAK3:
|
|
||||||
case DTILE_SCREENBREAK4:
|
|
||||||
case DTILE_SCREENBREAK5:
|
|
||||||
|
|
||||||
case DTILE_SCREENBREAK9:
|
|
||||||
case DTILE_SCREENBREAK10:
|
|
||||||
case DTILE_SCREENBREAK11:
|
|
||||||
case DTILE_SCREENBREAK12:
|
|
||||||
case DTILE_SCREENBREAK13:
|
|
||||||
case DTILE_SCREENBREAK14:
|
|
||||||
case DTILE_SCREENBREAK15:
|
|
||||||
case DTILE_SCREENBREAK16:
|
|
||||||
case DTILE_SCREENBREAK17:
|
|
||||||
case DTILE_SCREENBREAK18:
|
|
||||||
case DTILE_SCREENBREAK19:
|
|
||||||
|
|
||||||
animwall[numanimwalls].wall = &wal;
|
|
||||||
animwall[numanimwalls].tag = wal.wallpicnum;
|
|
||||||
numanimwalls++;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//Invalidate textures in sector behind mirror
|
|
||||||
for (i = 0; i < mirrorcnt; i++)
|
|
||||||
{
|
|
||||||
for (auto& wal : mirrorsector[i]->walls)
|
|
||||||
{
|
|
||||||
wal.setwalltexture(mirrortex);
|
|
||||||
wal.setovertexture(mirrortex);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
END_DUKE_NS
|
END_DUKE_NS
|
||||||
|
|
|
@ -392,7 +392,6 @@ void spriteinit_r(DDukeActor* actor, TArray<DDukeActor*>& actors)
|
||||||
void prelevel_r(int g, TArray<DDukeActor*>& actors)
|
void prelevel_r(int g, TArray<DDukeActor*>& actors)
|
||||||
{
|
{
|
||||||
player_struct* p;
|
player_struct* p;
|
||||||
int i;
|
|
||||||
int j;
|
int j;
|
||||||
int lotaglist;
|
int lotaglist;
|
||||||
TArray<short> lotags;
|
TArray<short> lotags;
|
||||||
|
@ -606,73 +605,6 @@ void prelevel_r(int g, TArray<DDukeActor*>& actors)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
mirrorcnt = 0;
|
|
||||||
|
|
||||||
for (auto& wal : wall)
|
|
||||||
{
|
|
||||||
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->ceilingtexture != mirrortex)
|
|
||||||
{
|
|
||||||
sectp->setceilingtexture(mirrortex);
|
|
||||||
sectp->setfloortexture(mirrortex);
|
|
||||||
mirrorwall[mirrorcnt] = &wal;
|
|
||||||
mirrorsector[mirrorcnt] = sectp;
|
|
||||||
mirrorcnt++;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (numanimwalls >= MAXANIMWALLS)
|
|
||||||
I_Error("Too many 'anim' walls (max 512.)");
|
|
||||||
|
|
||||||
animwall[numanimwalls].tag = 0;
|
|
||||||
animwall[numanimwalls].wall = nullptr;
|
|
||||||
|
|
||||||
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;
|
|
||||||
numanimwalls++;
|
|
||||||
break;
|
|
||||||
case RTILE_BIGFORCE:
|
|
||||||
animwall[numanimwalls].wall = &wal;
|
|
||||||
numanimwalls++;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
wal.extra = -1;
|
|
||||||
|
|
||||||
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].tag = -1;
|
|
||||||
numanimwalls++;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//Invalidate textures in sector behind mirror
|
|
||||||
for (i = 0; i < mirrorcnt; i++)
|
|
||||||
{
|
|
||||||
for (auto& wal : mirrorsector[i]->walls)
|
|
||||||
{
|
|
||||||
wal.setwalltexture(mirrortex);
|
|
||||||
wal.setovertexture(mirrortex);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
thunder_brightness = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -53,7 +53,9 @@ FSerializer& Serialize(FSerializer& arc, const char* keyname, animwalltype& w, a
|
||||||
{
|
{
|
||||||
arc("wall", w.wall)
|
arc("wall", w.wall)
|
||||||
("tag", w.tag)
|
("tag", w.tag)
|
||||||
.EndObject();
|
("texid", w.origtex)
|
||||||
|
("overpic", w.overpic)
|
||||||
|
.EndObject();
|
||||||
}
|
}
|
||||||
return arc;
|
return arc;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1241,14 +1241,14 @@ void operatemasterswitches(int low)
|
||||||
//
|
//
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
void operateforcefields_common(DDukeActor *effector, int low, const std::initializer_list<int> &tiles)
|
void operateforcefields(DDukeActor *effector, int low)
|
||||||
{
|
{
|
||||||
for (int p = numanimwalls-1; p >= 0; p--)
|
for (int p = numanimwalls-1; p >= 0; p--)
|
||||||
{
|
{
|
||||||
auto wal = animwall[p].wall;
|
auto wal = animwall[p].wall;
|
||||||
|
|
||||||
if (low == wal->lotag || low == -1)
|
if (low == wal->lotag || low == -1)
|
||||||
if (isIn(wal->overpicnum, tiles))
|
if (tileflags(wal->overtexture()) & TFLAG_FORCEFIELD)
|
||||||
{
|
{
|
||||||
animwall[p].tag = 0;
|
animwall[p].tag = 0;
|
||||||
|
|
||||||
|
@ -1746,7 +1746,7 @@ bool checkhitswitch(int snum, walltype* wwal, DDukeActor* act)
|
||||||
}
|
}
|
||||||
|
|
||||||
operateactivators(lotag, &ps[snum]);
|
operateactivators(lotag, &ps[snum]);
|
||||||
fi.operateforcefields(ps[snum].GetActor(), lotag);
|
operateforcefields(ps[snum].GetActor(), lotag);
|
||||||
operatemasterswitches(lotag);
|
operatemasterswitches(lotag);
|
||||||
|
|
||||||
if (swdef.type == SwitchDef::Combo) return 1;
|
if (swdef.type == SwitchDef::Combo) return 1;
|
||||||
|
@ -1772,5 +1772,97 @@ bool checkhitswitch(int snum, walltype* wwal, DDukeActor* act)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
void animatewalls(void)
|
||||||
|
{
|
||||||
|
static FTextureID noise, ff1, ff2;
|
||||||
|
|
||||||
|
// all that was done here is to open the system up sufficiently to allow replacing the textures being used without having to use ART files.
|
||||||
|
// Custom animated textures are better done with newly written controller actors.
|
||||||
|
if (!noise.isValid()) noise = TexMan.CheckForTexture("SCREENBREAK6", ETextureType::Any);
|
||||||
|
if (!ff1.isValid()) ff1 = TexMan.CheckForTexture("W_FORCEFIELD", ETextureType::Any);
|
||||||
|
if (!ff2.isValid()) ff2 = TexMan.CheckForTexture("W_FORCEFIELD2", ETextureType::Any);
|
||||||
|
|
||||||
|
if (ps[screenpeek].sea_sick_stat == 1)
|
||||||
|
{
|
||||||
|
for (auto& wal : wall)
|
||||||
|
{
|
||||||
|
if (tileflags(wal.walltexture()) & TFLAG_SEASICKWALL)
|
||||||
|
wal.addxpan(6);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int t;
|
||||||
|
|
||||||
|
for (int p = 0; p < numanimwalls; p++)
|
||||||
|
{
|
||||||
|
auto wal = animwall[p].wall;
|
||||||
|
auto texid = wal->walltexture();
|
||||||
|
|
||||||
|
if (!animwall[p].overpic)
|
||||||
|
{
|
||||||
|
if (tileflags(wal->walltexture()) & TFLAG_ANIMSCREEN)
|
||||||
|
{
|
||||||
|
if ((krand() & 255) < 16)
|
||||||
|
{
|
||||||
|
wal->setwalltexture(noise);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (tileflags(wal->walltexture()) & TFLAG_ANIMSCREENNOISE)
|
||||||
|
{
|
||||||
|
if (animwall[p].origtex.isValid())
|
||||||
|
wal->setwalltexture(animwall[p].origtex);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
texid = texid + 1;
|
||||||
|
if (texid.GetIndex() > noise.GetIndex() + 3 || texid.GetIndex() < noise.GetIndex()) texid = noise;
|
||||||
|
wal->setwalltexture(texid);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (tileflags(wal->overtexture()) & TFLAG_ANIMFORCEFIELD && wal->cstat & CSTAT_WALL_MASKED)
|
||||||
|
{
|
||||||
|
|
||||||
|
t = animwall[p].tag;
|
||||||
|
|
||||||
|
if (wal->cstat & CSTAT_WALL_ANY_EXCEPT_BLOCK)
|
||||||
|
{
|
||||||
|
wal->addxpan(-t / 4096.f);
|
||||||
|
wal->addypan(-t / 4096.f);
|
||||||
|
|
||||||
|
if (wal->extra == 1)
|
||||||
|
{
|
||||||
|
wal->extra = 0;
|
||||||
|
animwall[p].tag = 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
animwall[p].tag += 128;
|
||||||
|
|
||||||
|
if (animwall[p].tag < (128 << 4))
|
||||||
|
{
|
||||||
|
if (animwall[p].tag & 128)
|
||||||
|
wal->setovertexture(ff1);
|
||||||
|
else wal->setovertexture(ff2);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if ((krand() & 255) < 32)
|
||||||
|
animwall[p].tag = 128 << (krand() & 3);
|
||||||
|
else wal->setovertexture(ff2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
END_DUKE_NS
|
END_DUKE_NS
|
||||||
|
|
|
@ -43,117 +43,6 @@ source as it is released.
|
||||||
// PRIMITIVE
|
// PRIMITIVE
|
||||||
BEGIN_DUKE_NS
|
BEGIN_DUKE_NS
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
|
||||||
//
|
|
||||||
//
|
|
||||||
//
|
|
||||||
//---------------------------------------------------------------------------
|
|
||||||
|
|
||||||
void animatewalls_d(void)
|
|
||||||
{
|
|
||||||
int t;
|
|
||||||
|
|
||||||
for (int p = 0; p < numanimwalls; p++)
|
|
||||||
{
|
|
||||||
auto wal = animwall[p].wall;
|
|
||||||
int j = wal->wallpicnum;
|
|
||||||
|
|
||||||
switch (j)
|
|
||||||
{
|
|
||||||
case DTILE_SCREENBREAK1:
|
|
||||||
case DTILE_SCREENBREAK2:
|
|
||||||
case DTILE_SCREENBREAK3:
|
|
||||||
case DTILE_SCREENBREAK4:
|
|
||||||
case DTILE_SCREENBREAK5:
|
|
||||||
|
|
||||||
case DTILE_SCREENBREAK9:
|
|
||||||
case DTILE_SCREENBREAK10:
|
|
||||||
case DTILE_SCREENBREAK11:
|
|
||||||
case DTILE_SCREENBREAK12:
|
|
||||||
case DTILE_SCREENBREAK13:
|
|
||||||
case DTILE_SCREENBREAK14:
|
|
||||||
case DTILE_SCREENBREAK15:
|
|
||||||
case DTILE_SCREENBREAK16:
|
|
||||||
case DTILE_SCREENBREAK17:
|
|
||||||
case DTILE_SCREENBREAK18:
|
|
||||||
case DTILE_SCREENBREAK19:
|
|
||||||
|
|
||||||
if ((krand() & 255) < 16)
|
|
||||||
{
|
|
||||||
animwall[p].tag = wal->wallpicnum;
|
|
||||||
wal->wallpicnum = DTILE_SCREENBREAK6;
|
|
||||||
}
|
|
||||||
|
|
||||||
continue;
|
|
||||||
|
|
||||||
case DTILE_SCREENBREAK6:
|
|
||||||
case DTILE_SCREENBREAK7:
|
|
||||||
case DTILE_SCREENBREAK8:
|
|
||||||
|
|
||||||
if (animwall[p].tag >= 0 && wal->extra != DTILE_FEMPIC2 && wal->extra != DTILE_FEMPIC3)
|
|
||||||
wal->wallpicnum = animwall[p].tag;
|
|
||||||
else
|
|
||||||
{
|
|
||||||
wal->wallpicnum++;
|
|
||||||
if (wal->wallpicnum == (DTILE_SCREENBREAK6 + 3))
|
|
||||||
wal->wallpicnum = DTILE_SCREENBREAK6;
|
|
||||||
}
|
|
||||||
continue;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
if (wal->cstat & CSTAT_WALL_MASKED)
|
|
||||||
switch (wal->overpicnum)
|
|
||||||
{
|
|
||||||
case DTILE_W_FORCEFIELD:
|
|
||||||
case DTILE_W_FORCEFIELD2:
|
|
||||||
case DTILE_W_FORCEFIELD3:
|
|
||||||
|
|
||||||
t = animwall[p].tag;
|
|
||||||
|
|
||||||
if (wal->cstat & CSTAT_WALL_ANY_EXCEPT_BLOCK)
|
|
||||||
{
|
|
||||||
wal->addxpan(-t / 4096.f);
|
|
||||||
wal->addypan(-t / 4096.f);
|
|
||||||
|
|
||||||
if (wal->extra == 1)
|
|
||||||
{
|
|
||||||
wal->extra = 0;
|
|
||||||
animwall[p].tag = 0;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
animwall[p].tag += 128;
|
|
||||||
|
|
||||||
if (animwall[p].tag < (128 << 4))
|
|
||||||
{
|
|
||||||
if (animwall[p].tag & 128)
|
|
||||||
wal->overpicnum = DTILE_W_FORCEFIELD;
|
|
||||||
else wal->overpicnum = DTILE_W_FORCEFIELD2;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if ((krand() & 255) < 32)
|
|
||||||
animwall[p].tag = 128 << (krand() & 3);
|
|
||||||
else wal->overpicnum = DTILE_W_FORCEFIELD2;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
|
||||||
//
|
|
||||||
//
|
|
||||||
//
|
|
||||||
//---------------------------------------------------------------------------
|
|
||||||
|
|
||||||
void operateforcefields_d(DDukeActor* act, int low)
|
|
||||||
{
|
|
||||||
operateforcefields_common(act, low, { DTILE_W_FORCEFIELD, DTILE_W_FORCEFIELD2, DTILE_W_FORCEFIELD3, DTILE_BIGFORCE });
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
|
|
|
@ -44,75 +44,6 @@ BEGIN_DUKE_NS
|
||||||
//
|
//
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
void animatewalls_r(void)
|
|
||||||
{
|
|
||||||
if (isRRRA() &&ps[screenpeek].sea_sick_stat == 1)
|
|
||||||
{
|
|
||||||
for (auto& wal : wall)
|
|
||||||
{
|
|
||||||
if (wal.wallpicnum == RTILE_RRTILE7873)
|
|
||||||
wal.addxpan(6);
|
|
||||||
else if (wal.wallpicnum == RTILE_RRTILE7870)
|
|
||||||
wal.addxpan(6);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for (int p = 0; p < numanimwalls; p++)
|
|
||||||
{
|
|
||||||
auto wal = animwall[p].wall;
|
|
||||||
int j = wal->wallpicnum;
|
|
||||||
|
|
||||||
switch (j)
|
|
||||||
{
|
|
||||||
case RTILE_SCREENBREAK1:
|
|
||||||
case RTILE_SCREENBREAK2:
|
|
||||||
case RTILE_SCREENBREAK3:
|
|
||||||
case RTILE_SCREENBREAK4:
|
|
||||||
case RTILE_SCREENBREAK5:
|
|
||||||
|
|
||||||
case RTILE_SCREENBREAK9:
|
|
||||||
case RTILE_SCREENBREAK10:
|
|
||||||
case RTILE_SCREENBREAK11:
|
|
||||||
case RTILE_SCREENBREAK12:
|
|
||||||
case RTILE_SCREENBREAK13:
|
|
||||||
|
|
||||||
if ((krand() & 255) < 16)
|
|
||||||
{
|
|
||||||
animwall[p].tag = wal->wallpicnum;
|
|
||||||
wal->wallpicnum = RTILE_SCREENBREAK6;
|
|
||||||
}
|
|
||||||
|
|
||||||
continue;
|
|
||||||
|
|
||||||
case RTILE_SCREENBREAK6:
|
|
||||||
case RTILE_SCREENBREAK7:
|
|
||||||
case RTILE_SCREENBREAK8:
|
|
||||||
|
|
||||||
if (animwall[p].tag >= 0)
|
|
||||||
wal->wallpicnum = animwall[p].tag;
|
|
||||||
else
|
|
||||||
{
|
|
||||||
wal->wallpicnum++;
|
|
||||||
if (wal->wallpicnum == (RTILE_SCREENBREAK6 + 3))
|
|
||||||
wal->wallpicnum = RTILE_SCREENBREAK6;
|
|
||||||
}
|
|
||||||
continue;
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
|
||||||
//
|
|
||||||
//
|
|
||||||
//
|
|
||||||
//---------------------------------------------------------------------------
|
|
||||||
|
|
||||||
void operateforcefields_r(DDukeActor* act, int low)
|
|
||||||
{
|
|
||||||
operateforcefields_common(act, low, { RTILE_BIGFORCE });
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
|
|
|
@ -141,6 +141,8 @@ struct animwalltype
|
||||||
{
|
{
|
||||||
walltype* wall;
|
walltype* wall;
|
||||||
int tag;
|
int tag;
|
||||||
|
FTextureID origtex;
|
||||||
|
bool overpic;
|
||||||
};
|
};
|
||||||
|
|
||||||
// legacy CON baggage which needs to be refactored later.
|
// legacy CON baggage which needs to be refactored later.
|
||||||
|
|
|
@ -691,14 +691,14 @@ DEFINE_ACTION_FUNCTION_NATIVE(DDukeActor, insertspriteq, insertspriteq)
|
||||||
|
|
||||||
void DukeActor_operateforcefields(DDukeActor* self, int tag)
|
void DukeActor_operateforcefields(DDukeActor* self, int tag)
|
||||||
{
|
{
|
||||||
fi.operateforcefields(self, tag);
|
operateforcefields(self, tag);
|
||||||
}
|
}
|
||||||
|
|
||||||
DEFINE_ACTION_FUNCTION_NATIVE(DDukeActor, operateforcefields, DukeActor_operateforcefields)
|
DEFINE_ACTION_FUNCTION_NATIVE(DDukeActor, operateforcefields, DukeActor_operateforcefields)
|
||||||
{
|
{
|
||||||
PARAM_SELF_PROLOGUE(DDukeActor);
|
PARAM_SELF_PROLOGUE(DDukeActor);
|
||||||
PARAM_INT(tag);
|
PARAM_INT(tag);
|
||||||
fi.operateforcefields(self, tag);
|
operateforcefields(self, tag);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1122,7 +1122,7 @@ DEFINE_ACTION_FUNCTION(_DukePlayer, hitablockingwall)
|
||||||
PARAM_SELF_STRUCT_PROLOGUE(player_struct);
|
PARAM_SELF_STRUCT_PROLOGUE(player_struct);
|
||||||
walltype* pwal;
|
walltype* pwal;
|
||||||
hitawall(self, &pwal);
|
hitawall(self, &pwal);
|
||||||
ACTION_RETURN_BOOL(pwal && pwal->overpicnum > 0);
|
ACTION_RETURN_BOOL(pwal && pwal->overtexture().isValid());
|
||||||
}
|
}
|
||||||
|
|
||||||
inline double DukePlayer_GetPitchwithView(player_struct* pl)
|
inline double DukePlayer_GetPitchwithView(player_struct* pl)
|
||||||
|
|
|
@ -10,7 +10,11 @@ constants
|
||||||
TFLAG_BLOCKDOOR = 16
|
TFLAG_BLOCKDOOR = 16
|
||||||
TFLAG_NOBLOODSPLAT = 32
|
TFLAG_NOBLOODSPLAT = 32
|
||||||
TFLAG_NOCIRCLEREFLECT = 64
|
TFLAG_NOCIRCLEREFLECT = 64
|
||||||
TFLAG_INTERPOLATEWALL = 128
|
TFLAG_SEASICKWALL = 128
|
||||||
|
TFLAG_FORCEFIELD = 256
|
||||||
|
TFLAG_ANIMFORCEFIELD = 512 // do not use in user data! These flags only exist to speed up internal lookups.
|
||||||
|
TFLAG_ANIMSCREEN = 1024 // ''
|
||||||
|
TFLAG_ANIMSCREENNOISE = 2048 // ''
|
||||||
|
|
||||||
// surface (terrain/environment) types
|
// surface (terrain/environment) types
|
||||||
TSURF_NONE = 0
|
TSURF_NONE = 0
|
||||||
|
|
|
@ -65,6 +65,14 @@ textureflags
|
||||||
|
|
||||||
TFLAG_CLEARINVENTORY = HURTRAIL, FLOORSLIME, FLOORPLASMA
|
TFLAG_CLEARINVENTORY = HURTRAIL, FLOORSLIME, FLOORPLASMA
|
||||||
TFLAG_NOBLOODSPLAT = BIGFORCE
|
TFLAG_NOBLOODSPLAT = BIGFORCE
|
||||||
|
TFLAG_FORCEFIELD = BIGFORCE
|
||||||
|
|
||||||
|
// animation hacks. This is not usable for modding. Do not use! Do not change!
|
||||||
|
TFLAG_ANIMFORCEFIELD = W_FORCEFIELD, W_FORCEFIELD2, W_FORCEFIELD3
|
||||||
|
TFLAG_ANIMSCREEN = SCREENBREAK1,SCREENBREAK2, SCREENBREAK3, SCREENBREAK4, SCREENBREAK5, SCREENBREAK9, SCREENBREAK10, SCREENBREAK11,
|
||||||
|
SCREENBREAK12, SCREENBREAK13, SCREENBREAK14, SCREENBREAK15, SCREENBREAK16, SCREENBREAK17, SCREENBREAK18, SCREENBREAK19
|
||||||
|
TFLAG_ANIMSCREENNOISE = SCREENBREAK6, SCREENBREAK7, SCREENBREAK8
|
||||||
|
|
||||||
|
|
||||||
TFLAG_DOORWALL =
|
TFLAG_DOORWALL =
|
||||||
DOORTILE1,
|
DOORTILE1,
|
||||||
|
|
|
@ -24,7 +24,7 @@ textureflags
|
||||||
RRTILE8565,
|
RRTILE8565,
|
||||||
RRTILE8605
|
RRTILE8605
|
||||||
|
|
||||||
TFLAG_INTERPOLATEWALL = RRTILE7873, RRTILE7870
|
TFLAG_SEASICKWALL = RRTILE7873, RRTILE7870
|
||||||
}
|
}
|
||||||
|
|
||||||
surfacetypes
|
surfacetypes
|
||||||
|
|
|
@ -3,9 +3,11 @@ include "constants.mi"
|
||||||
textureflags
|
textureflags
|
||||||
{
|
{
|
||||||
|
|
||||||
TFLAG_WALLSWITCH =
|
TFLAG_WALLSWITCH = HANDPRINTSWITCH, HANDPRINTSWITCHON
|
||||||
HANDPRINTSWITCH,
|
TFLAG_FORCEFIELD = BIGFORCE
|
||||||
HANDPRINTSWITCHON
|
|
||||||
|
// animation hack. This is not usable for modding. Do not use! Do not change!
|
||||||
|
TFLAG_ANIMSCREENNOISE = SCREENBREAK6, SCREENBREAK7, SCREENBREAK8
|
||||||
|
|
||||||
TFLAG_DOORWALL =
|
TFLAG_DOORWALL =
|
||||||
DOORTILE1,
|
DOORTILE1,
|
||||||
|
|
Loading…
Reference in a new issue