From 90702ae2f5b4db62ac5058f7c66630c4904a8ada Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sat, 10 Dec 2022 17:52:25 +0100 Subject: [PATCH] - 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. --- source/core/mainloop.cpp | 2 +- source/games/duke/src/actors.cpp | 2 +- source/games/duke/src/cheats.cpp | 2 +- source/games/duke/src/constants.h | 6 +- source/games/duke/src/dispatch.cpp | 8 -- source/games/duke/src/duke3d.h | 2 - source/games/duke/src/funct.h | 3 +- source/games/duke/src/gameloop.cpp | 2 +- source/games/duke/src/premap.cpp | 72 +++++++++- source/games/duke/src/premap_d.cpp | 129 +----------------- source/games/duke/src/premap_r.cpp | 68 --------- source/games/duke/src/savegame.cpp | 4 +- source/games/duke/src/sectors.cpp | 98 ++++++++++++- source/games/duke/src/sectors_d.cpp | 111 --------------- source/games/duke/src/sectors_r.cpp | 69 ---------- source/games/duke/src/types.h | 2 + source/games/duke/src/vmexports.cpp | 6 +- wadsrc/static/filter/dukeengine/constants.mi | 6 +- .../static/filter/dukelike/rmapinfo.texflags | 8 ++ .../redneck.ridesagain/rmapinfo.texflags | 2 +- .../static/filter/redneck/rmapinfo.texflags | 8 +- 21 files changed, 200 insertions(+), 410 deletions(-) diff --git a/source/core/mainloop.cpp b/source/core/mainloop.cpp index d1eef7f4c..8b8d67c49 100644 --- a/source/core/mainloop.cpp +++ b/source/core/mainloop.cpp @@ -462,7 +462,7 @@ void Display() if (!tex.isValid()) tex = tileGetTextureID(atoi(drawtile)); if (tex.isValid()) { - auto tx = TexMan.GetGameTexture(tex); + auto tx = TexMan.GetGameTexture(tex, true); if (tx) { int width = (int)tx->GetDisplayWidth(); diff --git a/source/games/duke/src/actors.cpp b/source/games/duke/src/actors.cpp index d05360e0d..e44f67105 100644 --- a/source/games/duke/src/actors.cpp +++ b/source/games/duke/src/actors.cpp @@ -1108,7 +1108,7 @@ void handle_se30(DDukeActor *actor, int JIBS6) actor->SetOwner(nullptr); actor->spr.Angles.Yaw += DAngle180; actor->temp_data[4] = 0; - fi.operateforcefields(actor, actor->spr.hitag); + operateforcefields(actor, actor->spr.hitag); } } } diff --git a/source/games/duke/src/cheats.cpp b/source/games/duke/src/cheats.cpp index 4b7a4bed7..3f12c6127 100644 --- a/source/games/duke/src/cheats.cpp +++ b/source/games/duke/src/cheats.cpp @@ -112,7 +112,7 @@ static const char* cheatUnlock() operatesectors(§, ps[myconnectindex].GetActor()); } } - fi.operateforcefields(ps[myconnectindex].GetActor(), -1); + operateforcefields(ps[myconnectindex].GetActor(), -1); return quoteMgr.GetQuote(QUOTE_CHEAT_UNLOCK); } diff --git a/source/games/duke/src/constants.h b/source/games/duke/src/constants.h index fe804e1d7..2169c3a2c 100644 --- a/source/games/duke/src/constants.h +++ b/source/games/duke/src/constants.h @@ -422,7 +422,11 @@ enum TFLAG_BLOCKDOOR = 1 << 4, TFLAG_NOBLOODSPLAT = 1 << 5, 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 diff --git a/source/games/duke/src/dispatch.cpp b/source/games/duke/src/dispatch.cpp index 73ccf5849..d015ed9b9 100644 --- a/source/games/duke/src/dispatch.cpp +++ b/source/games/duke/src/dispatch.cpp @@ -35,10 +35,6 @@ BEGIN_DUKE_NS void initactorflags_d(); 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_r(int snum, int pal, DDukeActor* act, walltype* w); void activatebysector_d(sectortype* sect, DDukeActor* j); @@ -99,8 +95,6 @@ void SetDispatcher() think_d, movetransports_d, initactorflags_d, - animatewalls_d, - operateforcefields_d, checkaccessswitch_d, activatebysector_d, checkhitsprite_d, @@ -135,8 +129,6 @@ void SetDispatcher() think_r, movetransports_r, initactorflags_r, - animatewalls_r, - operateforcefields_r, checkaccessswitch_r, activatebysector_r, checkhitsprite_r, diff --git a/source/games/duke/src/duke3d.h b/source/games/duke/src/duke3d.h index dbb08bbe2..0f1eb44d8 100644 --- a/source/games/duke/src/duke3d.h +++ b/source/games/duke/src/duke3d.h @@ -73,8 +73,6 @@ struct Dispatcher void (*think)(); void (*movetransports)(); void (*initactorflags)(); - void (*animatewalls)(); - void (*operateforcefields)(DDukeActor* act, int low); bool (*checkaccessswitch)(int snum, int switchpal, DDukeActor* act, walltype* w); void (*activatebysector)(sectortype* sect, DDukeActor* j); void (*checkhitsprite)(DDukeActor* i, DDukeActor* sn); diff --git a/source/games/duke/src/funct.h b/source/games/duke/src/funct.h index c32c47585..5dbf8bb5d 100644 --- a/source/games/duke/src/funct.h +++ b/source/games/duke/src/funct.h @@ -15,6 +15,7 @@ BEGIN_DUKE_NS // dumping ground for all external function prototypes to keep them out of the important headers. // This list is not sorted in any way. +void animatewalls(void); void lava_cleararrays(); 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); @@ -129,7 +130,7 @@ bool isablockdoor(int tileNum); bool activatewarpelevators(DDukeActor* s, int w); int check_activator_motion(int lotag); void operateactivators(int l, player_struct* w); -void operateforcefields_common(DDukeActor* s, int low, const std::initializer_list& tiles); +void operateforcefields(DDukeActor* s, int low); void operatemasterswitches(int lotag); void operatesectors(sectortype* s, DDukeActor* i); void hud_input(int playerNum); diff --git a/source/games/duke/src/gameloop.cpp b/source/games/duke/src/gameloop.cpp index fbb4a98d5..7edc0b63b 100644 --- a/source/games/duke/src/gameloop.cpp +++ b/source/games/duke/src/gameloop.cpp @@ -101,7 +101,7 @@ void GameInterface::Ticker() if ((everyothertime & 1) == 0) { - fi.animatewalls(); + animatewalls(); movecyclers(); } diff --git a/source/games/duke/src/premap.cpp b/source/games/duke/src/premap.cpp index 9d82f4adb..877974f8a 100644 --- a/source/games/duke/src/premap.cpp +++ b/source/games/duke/src/premap.cpp @@ -704,6 +704,69 @@ void prelevel_common(int g) 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(); resettimevars(); // Here we go setLevelStarted(mi); - if (isRRRA() && ps[screenpeek].sea_sick_stat == 1) + for (auto& wal : wall) { - for (auto& wal : wall) - { - if (tileflags(wal.walltexture()) & TFLAG_INTERPOLATEWALL) - StartInterpolation(&wal, Interp_Wall_PanX); - } + if (tileflags(wal.walltexture()) & TFLAG_SEASICKWALL) + StartInterpolation(&wal, Interp_Wall_PanX); } } diff --git a/source/games/duke/src/premap_d.cpp b/source/games/duke/src/premap_d.cpp index af1dcc761..90507c002 100644 --- a/source/games/duke/src/premap_d.cpp +++ b/source/games/duke/src/premap_d.cpp @@ -249,7 +249,7 @@ void spriteinit_d(DDukeActor* actor, TArray& actors) void prelevel_d(int g, TArray& actors) { - int i, j, lotaglist; + int j, lotaglist; TArray lotags; prelevel_common(g); @@ -307,133 +307,6 @@ void prelevel_d(int g, TArray& 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 diff --git a/source/games/duke/src/premap_r.cpp b/source/games/duke/src/premap_r.cpp index 4261931b2..fd1d42d2d 100644 --- a/source/games/duke/src/premap_r.cpp +++ b/source/games/duke/src/premap_r.cpp @@ -392,7 +392,6 @@ void spriteinit_r(DDukeActor* actor, TArray& actors) void prelevel_r(int g, TArray& actors) { player_struct* p; - int i; int j; int lotaglist; TArray lotags; @@ -606,73 +605,6 @@ void prelevel_r(int g, TArray& 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; } diff --git a/source/games/duke/src/savegame.cpp b/source/games/duke/src/savegame.cpp index 893c50fdb..b0836c790 100644 --- a/source/games/duke/src/savegame.cpp +++ b/source/games/duke/src/savegame.cpp @@ -53,7 +53,9 @@ FSerializer& Serialize(FSerializer& arc, const char* keyname, animwalltype& w, a { arc("wall", w.wall) ("tag", w.tag) - .EndObject(); + ("texid", w.origtex) + ("overpic", w.overpic) + .EndObject(); } return arc; } diff --git a/source/games/duke/src/sectors.cpp b/source/games/duke/src/sectors.cpp index 27e39a144..fa538fc9d 100644 --- a/source/games/duke/src/sectors.cpp +++ b/source/games/duke/src/sectors.cpp @@ -1241,14 +1241,14 @@ void operatemasterswitches(int low) // //--------------------------------------------------------------------------- -void operateforcefields_common(DDukeActor *effector, int low, const std::initializer_list &tiles) +void operateforcefields(DDukeActor *effector, int low) { for (int p = numanimwalls-1; p >= 0; p--) { auto wal = animwall[p].wall; if (low == wal->lotag || low == -1) - if (isIn(wal->overpicnum, tiles)) + if (tileflags(wal->overtexture()) & TFLAG_FORCEFIELD) { animwall[p].tag = 0; @@ -1746,7 +1746,7 @@ bool checkhitswitch(int snum, walltype* wwal, DDukeActor* act) } operateactivators(lotag, &ps[snum]); - fi.operateforcefields(ps[snum].GetActor(), lotag); + operateforcefields(ps[snum].GetActor(), lotag); operatemasterswitches(lotag); if (swdef.type == SwitchDef::Combo) return 1; @@ -1772,5 +1772,97 @@ bool checkhitswitch(int snum, walltype* wwal, DDukeActor* act) 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 diff --git a/source/games/duke/src/sectors_d.cpp b/source/games/duke/src/sectors_d.cpp index 856215c01..65ef00ca8 100644 --- a/source/games/duke/src/sectors_d.cpp +++ b/source/games/duke/src/sectors_d.cpp @@ -43,117 +43,6 @@ source as it is released. // PRIMITIVE 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 }); -} - //--------------------------------------------------------------------------- // // diff --git a/source/games/duke/src/sectors_r.cpp b/source/games/duke/src/sectors_r.cpp index 11cbe447f..423ab8e1a 100644 --- a/source/games/duke/src/sectors_r.cpp +++ b/source/games/duke/src/sectors_r.cpp @@ -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 }); -} - //--------------------------------------------------------------------------- // // diff --git a/source/games/duke/src/types.h b/source/games/duke/src/types.h index e5c05852f..4aa549d3b 100644 --- a/source/games/duke/src/types.h +++ b/source/games/duke/src/types.h @@ -141,6 +141,8 @@ struct animwalltype { walltype* wall; int tag; + FTextureID origtex; + bool overpic; }; // legacy CON baggage which needs to be refactored later. diff --git a/source/games/duke/src/vmexports.cpp b/source/games/duke/src/vmexports.cpp index 35e55ba30..59e414908 100644 --- a/source/games/duke/src/vmexports.cpp +++ b/source/games/duke/src/vmexports.cpp @@ -691,14 +691,14 @@ DEFINE_ACTION_FUNCTION_NATIVE(DDukeActor, insertspriteq, insertspriteq) void DukeActor_operateforcefields(DDukeActor* self, int tag) { - fi.operateforcefields(self, tag); + operateforcefields(self, tag); } DEFINE_ACTION_FUNCTION_NATIVE(DDukeActor, operateforcefields, DukeActor_operateforcefields) { PARAM_SELF_PROLOGUE(DDukeActor); PARAM_INT(tag); - fi.operateforcefields(self, tag); + operateforcefields(self, tag); return 0; } @@ -1122,7 +1122,7 @@ DEFINE_ACTION_FUNCTION(_DukePlayer, hitablockingwall) PARAM_SELF_STRUCT_PROLOGUE(player_struct); walltype* 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) diff --git a/wadsrc/static/filter/dukeengine/constants.mi b/wadsrc/static/filter/dukeengine/constants.mi index f3ce9f16b..2ac2dcd95 100644 --- a/wadsrc/static/filter/dukeengine/constants.mi +++ b/wadsrc/static/filter/dukeengine/constants.mi @@ -10,7 +10,11 @@ constants TFLAG_BLOCKDOOR = 16 TFLAG_NOBLOODSPLAT = 32 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 TSURF_NONE = 0 diff --git a/wadsrc/static/filter/dukelike/rmapinfo.texflags b/wadsrc/static/filter/dukelike/rmapinfo.texflags index d333502ad..671f2c18f 100644 --- a/wadsrc/static/filter/dukelike/rmapinfo.texflags +++ b/wadsrc/static/filter/dukelike/rmapinfo.texflags @@ -65,6 +65,14 @@ textureflags TFLAG_CLEARINVENTORY = HURTRAIL, FLOORSLIME, FLOORPLASMA 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 = DOORTILE1, diff --git a/wadsrc/static/filter/redneck.ridesagain/rmapinfo.texflags b/wadsrc/static/filter/redneck.ridesagain/rmapinfo.texflags index f68a0622f..f62b19aa3 100644 --- a/wadsrc/static/filter/redneck.ridesagain/rmapinfo.texflags +++ b/wadsrc/static/filter/redneck.ridesagain/rmapinfo.texflags @@ -24,7 +24,7 @@ textureflags RRTILE8565, RRTILE8605 - TFLAG_INTERPOLATEWALL = RRTILE7873, RRTILE7870 + TFLAG_SEASICKWALL = RRTILE7873, RRTILE7870 } surfacetypes diff --git a/wadsrc/static/filter/redneck/rmapinfo.texflags b/wadsrc/static/filter/redneck/rmapinfo.texflags index f06433236..7e71d2154 100644 --- a/wadsrc/static/filter/redneck/rmapinfo.texflags +++ b/wadsrc/static/filter/redneck/rmapinfo.texflags @@ -3,9 +3,11 @@ include "constants.mi" textureflags { - TFLAG_WALLSWITCH = - HANDPRINTSWITCH, - HANDPRINTSWITCHON + TFLAG_WALLSWITCH = HANDPRINTSWITCH, HANDPRINTSWITCHON + TFLAG_FORCEFIELD = BIGFORCE + + // animation hack. This is not usable for modding. Do not use! Do not change! + TFLAG_ANIMSCREENNOISE = SCREENBREAK6, SCREENBREAK7, SCREENBREAK8 TFLAG_DOORWALL = DOORTILE1,