From 5bc8b1c2d314b2795dcdcaf7074de03bfc6c56d5 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Tue, 25 Jan 2022 22:26:53 +0100 Subject: [PATCH] - Duke: added two more flags to eliminate the references to the crane's tile numbers. --- source/games/duke/src/actors.cpp | 6 +++--- source/games/duke/src/actors_d.cpp | 2 +- source/games/duke/src/actors_r.cpp | 2 +- source/games/duke/src/animatesprites_d.cpp | 2 +- source/games/duke/src/animatesprites_r.cpp | 2 +- source/games/duke/src/constants.h | 2 ++ source/games/duke/src/flags_d.cpp | 2 ++ source/games/duke/src/flags_r.cpp | 3 +++ source/games/duke/src/funct.h | 2 +- source/games/duke/src/namelist_d.h | 2 ++ source/games/duke/src/namelist_r.h | 2 ++ source/games/duke/src/savegame.cpp | 1 + source/games/duke/src/types.h | 2 +- wadsrc/static/zscript/games/duke/dukeactor.zs | 2 ++ 14 files changed, 23 insertions(+), 9 deletions(-) diff --git a/source/games/duke/src/actors.cpp b/source/games/duke/src/actors.cpp index 829865161..3dc33704b 100644 --- a/source/games/duke/src/actors.cpp +++ b/source/games/duke/src/actors.cpp @@ -4379,7 +4379,7 @@ void handle_se27(DDukeActor* actor) // //--------------------------------------------------------------------------- -void handle_se24(DDukeActor *actor, const int16_t *list1, const int16_t *list2, bool scroll, int TRIPBOMB, int LASERLINE, int CRANE, int shift) +void handle_se24(DDukeActor *actor, const int16_t *list1, const int16_t *list2, bool scroll, int TRIPBOMB, int LASERLINE, int shift) { auto testlist = [](const int16_t* list, int val) { for (int i = 0; list[i] > 0; i++) if (list[i] == val) return true; return false; }; @@ -4416,7 +4416,7 @@ void handle_se24(DDukeActor *actor, const int16_t *list1, const int16_t *list2, wallswitchcheck(a2)) break; - if (!(a2->spr.picnum >= CRANE && a2->spr.picnum <= (CRANE + 3))) + if (!(gs.actorinfo[a2->spr.picnum].flags & SFLAG_SE24_NOFLOORCHECK)) { if (a2->spr.pos.Z > (a2->floorz - (16 << 8))) { @@ -4426,7 +4426,7 @@ void handle_se24(DDukeActor *actor, const int16_t *list1, const int16_t *list2, SetActor(a2, a2->spr.pos); if (a2->sector()->floorstat & CSTAT_SECTOR_SLOPE) - if (a2->spr.statnum == 2) + if (a2->spr.statnum == STAT_ZOMBIEACTOR) makeitfall(a2); } } diff --git a/source/games/duke/src/actors_d.cpp b/source/games/duke/src/actors_d.cpp index 3ec042ba4..53dcdf773 100644 --- a/source/games/duke/src/actors_d.cpp +++ b/source/games/duke/src/actors_d.cpp @@ -3446,7 +3446,7 @@ void moveeffectors_d(void) //STATNUM 3 { static const int16_t list1[] = { BLOODPOOL, PUKE, FOOTPRINTS, FOOTPRINTS2, FOOTPRINTS3, FOOTPRINTS4, BULLETHOLE, BLOODSPLAT1, BLOODSPLAT2, BLOODSPLAT3, BLOODSPLAT4, -1 }; static const int16_t list2[] = { BOLT1, BOLT1 + 1,BOLT1 + 2, BOLT1 + 3, SIDEBOLT1, SIDEBOLT1 + 1, SIDEBOLT1 + 2, SIDEBOLT1 + 3, -1 }; - handle_se24(act, list1, list2, true, TRIPBOMB, LASERLINE, CRANE, 2); + handle_se24(act, list1, list2, true, TRIPBOMB, LASERLINE, 2); break; } case SE_35: diff --git a/source/games/duke/src/actors_r.cpp b/source/games/duke/src/actors_r.cpp index 4fae538c1..9a85bb39b 100644 --- a/source/games/duke/src/actors_r.cpp +++ b/source/games/duke/src/actors_r.cpp @@ -3401,7 +3401,7 @@ void moveeffectors_r(void) //STATNUM 3 { static const int16_t list1[] = { BLOODPOOL, PUKE, FOOTPRINTS, FOOTPRINTS2, FOOTPRINTS3, -1 }; static const int16_t list2[] = { BOLT1, BOLT1 + 1,BOLT1 + 2, BOLT1 + 3, -1 }; - handle_se24(act, list1, list2, st != 156, BULLETHOLE, -1, CRANE, 1); + handle_se24(act, list1, list2, st != 156, BULLETHOLE, -1, 1); break; } diff --git a/source/games/duke/src/animatesprites_d.cpp b/source/games/duke/src/animatesprites_d.cpp index 6d7f04117..cad83958b 100644 --- a/source/games/duke/src/animatesprites_d.cpp +++ b/source/games/duke/src/animatesprites_d.cpp @@ -171,7 +171,7 @@ void animatesprites_d(tspritetype* tsprite, int& spritesortcnt, int x, int y, in t->pos.Z = interpolatedvalue(ps[h->spr.yvel].opos.Z, ps[h->spr.yvel].pos.Z, smoothratio); t->pos.Z += PHEIGHT_DUKE; } - else if (h->spr.picnum != CRANEPOLE) + else if (!(gs.actorinfo[h->spr.picnum].flags & SFLAG_NOINTERPOLATE)) { t->pos = h->interpolatedvec3(smoothratio); } diff --git a/source/games/duke/src/animatesprites_r.cpp b/source/games/duke/src/animatesprites_r.cpp index 9db2c3d5d..bf070520c 100644 --- a/source/games/duke/src/animatesprites_r.cpp +++ b/source/games/duke/src/animatesprites_r.cpp @@ -154,7 +154,7 @@ void animatesprites_r(tspritetype* tsprite, int& spritesortcnt, int x, int y, in h->spr.xrepeat = 24; h->spr.yrepeat = 17; } - else if (h->spr.picnum != CRANEPOLE) + else if (!(gs.actorinfo[h->spr.picnum].flags & SFLAG_NOINTERPOLATE)) { t->pos = h->interpolatedvec3(smoothratio); } diff --git a/source/games/duke/src/constants.h b/source/games/duke/src/constants.h index b08353380..483d97d0e 100644 --- a/source/games/duke/src/constants.h +++ b/source/games/duke/src/constants.h @@ -313,6 +313,8 @@ enum sflags_t SFLAG_MOVEFTA_WAKEUPCHECK = 0x00010000, SFLAG_MOVEFTA_CHECKSEEWITHPAL8 = 0x00020000, // let's hope this can be done better later. For now this was what blocked merging the Duke and RR variants of movefta SFLAG_NOSHADOW = 0x00040000, + SFLAG_SE24_NOFLOORCHECK = 0x00080000, + SFLAG_NOINTERPOLATE = 0x00100000, }; diff --git a/source/games/duke/src/flags_d.cpp b/source/games/duke/src/flags_d.cpp index 4238d8ba8..3097f5b71 100644 --- a/source/games/duke/src/flags_d.cpp +++ b/source/games/duke/src/flags_d.cpp @@ -198,6 +198,8 @@ void initactorflags_d() if (isWorldTour()) setflag(SFLAG_BOSS, { BOSS2STAYPUT, BOSS3STAYPUT, BOSS5, BOSS5STAYPUT }); setflag(SFLAG_NOWATERDIP, { OCTABRAIN, COMMANDER, DRONE }); setflag(SFLAG_GREENSLIMEFOOD, { LIZTROOP, LIZMAN, PIGCOP, NEWBEAST }); + setflag(SFLAG_SE24_NOFLOORCHECK, { CRANE, CRANE1, CRANE2, BARBROKE }); + setflag(SFLAG_NOINTERPOLATE, { CRANEPOLE }); if (isWorldTour()) { diff --git a/source/games/duke/src/flags_r.cpp b/source/games/duke/src/flags_r.cpp index 721c442bd..d79101dd3 100644 --- a/source/games/duke/src/flags_r.cpp +++ b/source/games/duke/src/flags_r.cpp @@ -228,6 +228,9 @@ void initactorflags_r() NUKEBARRELLEAKED }); + setflag(SFLAG_SE24_NOFLOORCHECK, { CRANE, CRANE1, CRANE2, BARBROKE }); + setflag(SFLAG_NOINTERPOLATE, { CRANEPOLE }); + // Animals were not supposed to have this, but due to a coding bug the logic was unconditional for everything in the game. for (auto& ainf : gs.actorinfo) { diff --git a/source/games/duke/src/funct.h b/source/games/duke/src/funct.h index b1f41e3f4..552b4f0d1 100644 --- a/source/games/duke/src/funct.h +++ b/source/games/duke/src/funct.h @@ -85,7 +85,7 @@ void handle_se19(DDukeActor* i, int BIGFORCE); void handle_se20(DDukeActor* i); void handle_se21(DDukeActor* i); void handle_se22(DDukeActor* i); -void handle_se24(DDukeActor* actor, const int16_t* list1, const int16_t* list2, bool scroll, int TRIPBOMB, int LASERLINE, int CRANE, int shift); +void handle_se24(DDukeActor* actor, const int16_t* list1, const int16_t* list2, bool scroll, int TRIPBOMB, int LASERLINE, int shift); void handle_se25(DDukeActor* a, int t_index, int snd1, int snd2); void handle_se26(DDukeActor* i); void handle_se27(DDukeActor* i); diff --git a/source/games/duke/src/namelist_d.h b/source/games/duke/src/namelist_d.h index d62867483..13b412945 100644 --- a/source/games/duke/src/namelist_d.h +++ b/source/games/duke/src/namelist_d.h @@ -323,6 +323,8 @@ x(COLAMACHINE, 1215) x(COLAMACHINEBROKE, 1217) x(CRANEPOLE, 1221) x(CRANE, 1222) +x(CRANE1, 1223) +x(CRANE2, 1224) x(BARBROKE, 1225) x(BLOODPOOL, 1226) x(NUKEBARREL, 1227) diff --git a/source/games/duke/src/namelist_r.h b/source/games/duke/src/namelist_r.h index f25032d67..c82444c58 100644 --- a/source/games/duke/src/namelist_r.h +++ b/source/games/duke/src/namelist_r.h @@ -390,6 +390,8 @@ x(COLAMACHINE, 1294) x(COLAMACHINEBROKE, 1296) x(CRANEPOLE, 1298) x(CRANE, 1299) +x(CRANE1, 1300) +x(CRANE2, 1301) x(BARBROKE, 1302) x(BLOODPOOL, 1303) x(NUKEBARREL, 1304) diff --git a/source/games/duke/src/savegame.cpp b/source/games/duke/src/savegame.cpp index e9eee63c4..17e84c8ac 100644 --- a/source/games/duke/src/savegame.cpp +++ b/source/games/duke/src/savegame.cpp @@ -305,6 +305,7 @@ void DDukeActor::Serialize(FSerializer& arc) ("tempang", tempang) ("actorstayput", actorstayput) ("dispicnum", dispicnum) + ("basepicnum", basepicnum) ("timetosleep", timetosleep) ("floorz", floorz) ("ceilingz", ceilingz) diff --git a/source/games/duke/src/types.h b/source/games/duke/src/types.h index 6ea849814..b9b33db5c 100644 --- a/source/games/duke/src/types.h +++ b/source/games/duke/src/types.h @@ -36,7 +36,7 @@ public: uint8_t cgg; uint8_t spriteextra; // moved here for easier maintenance. This was originally a hacked in field in the sprite structure called 'filler'. short attackertype, hitang, hitextra, movflag; - short tempang, dispicnum; + short tempang, dispicnum, basepicnum; short timetosleep; vec2_t ovel; int floorz, ceilingz; diff --git a/wadsrc/static/zscript/games/duke/dukeactor.zs b/wadsrc/static/zscript/games/duke/dukeactor.zs index ab6ca9da7..6f6932e87 100644 --- a/wadsrc/static/zscript/games/duke/dukeactor.zs +++ b/wadsrc/static/zscript/games/duke/dukeactor.zs @@ -36,5 +36,7 @@ class DukeActor : CoreActor native //flagdef MoveFTA_WakeupCheck: flags1, 16; // this one needs to be auto-set for RR, not for Duke, should not be exposed unless the feature becomes generally available. flagdef CheckSeeWithPal8: flags1, 17; flagdef NoShadow: flags1, 18; + flagdef SE24_NoFloorCheck: flags1, 19; + flagdef NoInterpolate: flags1, 20; }