From c5968ad3ad36e5b8b0f3a67809f8a5e5368adc18 Mon Sep 17 00:00:00 2001 From: James R Date: Mon, 27 Nov 2023 05:00:14 -0800 Subject: [PATCH] Hardcode Ice Cap Blocks --- src/deh_tables.c | 7 +++++++ src/info.c | 33 +++++++++++++++++++++++++++++++++ src/info.h | 8 ++++++++ src/k_objects.h | 2 +- src/objects/crate.cpp | 15 +++++++++++++++ src/p_inter.c | 2 ++ src/p_map.c | 1 + src/p_mobj.c | 2 ++ 8 files changed, 69 insertions(+), 1 deletion(-) diff --git a/src/deh_tables.c b/src/deh_tables.c index 9f6d064f5..45bbd6955 100644 --- a/src/deh_tables.c +++ b/src/deh_tables.c @@ -4838,6 +4838,12 @@ const char *const STATE_LIST[] = { // array length left dynamic for sanity testi "S_SA2_CRATE_DEBRIS_G", "S_SA2_CRATE_DEBRIS_H", "S_SA2_CRATE_DEBRIS_METAL", + + "S_ICECAPBLOCK_DEBRIS", + "S_ICECAPBLOCK_DEBRIS_C", + "S_ICECAPBLOCK_DEBRIS_D", + "S_ICECAPBLOCK_DEBRIS_E", + "S_ICECAPBLOCK_DEBRIS_F", }; // RegEx to generate this from info.h: ^\tMT_([^,]+), --> \t"MT_\1", @@ -6068,6 +6074,7 @@ const char *const MOBJTYPE_LIST[] = { // array length left dynamic for sanity t "MT_BOX_SIDE", "MT_BOX_DEBRIS", "MT_SA2_CRATE", + "MT_ICECAPBLOCK", }; const char *const MOBJFLAG_LIST[] = { diff --git a/src/info.c b/src/info.c index d7a8d7152..26561f4eb 100644 --- a/src/info.c +++ b/src/info.c @@ -987,6 +987,7 @@ char sprnames[NUMSPRITES + 1][5] = "SFTR", "SABX", + "ICBL", // First person view sprites; this is a sprite so that it can be replaced by a specialized MD2 draw later "VIEW", @@ -5686,6 +5687,12 @@ state_t states[NUMSTATES] = {SPR_SABX, 6, 70, {NULL}, 0, 0, S_NULL}, // S_SA2_CRATE_DEBRIS_G {SPR_SABX, 7, 70, {NULL}, 0, 0, S_NULL}, // S_SA2_CRATE_DEBRIS_H {SPR_SABX, 12, 70, {NULL}, 0, 0, S_NULL}, // S_SA2_CRATE_DEBRIS_METAL + + {SPR_UNKN, FF_FULLBRIGHT, -1, {A_RandomStateRange}, S_ICECAPBLOCK_DEBRIS_C, S_ICECAPBLOCK_DEBRIS_F, S_NULL}, // S_ICECAPBLOCK_DEBRIS + {SPR_ICBL, 2, 70, {NULL}, 0, 0, S_NULL}, // S_ICECAPBLOCK_DEBRIS_C + {SPR_ICBL, 3, 70, {NULL}, 0, 0, S_NULL}, // S_ICECAPBLOCK_DEBRIS_D + {SPR_ICBL, 4, 70, {NULL}, 0, 0, S_NULL}, // S_ICECAPBLOCK_DEBRIS_E + {SPR_ICBL, 5, 70, {NULL}, 0, 0, S_NULL}, // S_ICECAPBLOCK_DEBRIS_F }; mobjinfo_t mobjinfo[NUMMOBJTYPES] = @@ -32287,6 +32294,32 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = MF_SPECIAL|MF_SOLID|MF_SHOOTABLE|MF_SCENERY|MF_DONTPUNT, // flags S_NULL // raisestate }, + { // MT_ICECAPBLOCK + 3750, // doomednum + S_INVISIBLE, // spawnstate + 1, // spawnhealth + S_NULL, // seestate + sfx_None, // seesound + 0, // reactiontime + sfx_None, // attacksound + S_NULL, // painstate + 0, // painchance + sfx_None, // painsound + S_NULL, // meleestate + S_NULL, // missilestate + S_NULL, // deathstate + S_NULL, // xdeathstate + sfx_None, // deathsound + 0, // speed + 40*FRACUNIT, // radius + 80*FRACUNIT, // height + 0, // dispoffset + 0, // mass + 0, // damage + sfx_None, // activesound + MF_SPECIAL|MF_SOLID|MF_SHOOTABLE|MF_SCENERY|MF_DONTPUNT, // flags + S_NULL // raisestate + }, }; diff --git a/src/info.h b/src/info.h index 4b134d91a..c623dcbca 100644 --- a/src/info.h +++ b/src/info.h @@ -1541,6 +1541,7 @@ typedef enum sprite SPR_SFTR, SPR_SABX, + SPR_ICBL, // First person view sprites; this is a sprite so that it can be replaced by a specialized MD2 draw later SPR_VIEW, @@ -6111,6 +6112,12 @@ typedef enum state S_SA2_CRATE_DEBRIS_H, S_SA2_CRATE_DEBRIS_METAL, + S_ICECAPBLOCK_DEBRIS, + S_ICECAPBLOCK_DEBRIS_C, + S_ICECAPBLOCK_DEBRIS_D, + S_ICECAPBLOCK_DEBRIS_E, + S_ICECAPBLOCK_DEBRIS_F, + S_FIRSTFREESLOT, S_LASTFREESLOT = S_FIRSTFREESLOT + NUMSTATEFREESLOTS - 1, NUMSTATES @@ -7360,6 +7367,7 @@ typedef enum mobj_type MT_BOX_SIDE, MT_BOX_DEBRIS, MT_SA2_CRATE, + MT_ICECAPBLOCK, MT_FIRSTFREESLOT, MT_LASTFREESLOT = MT_FIRSTFREESLOT + NUMMOBJFREESLOTS - 1, diff --git a/src/k_objects.h b/src/k_objects.h index 31195d855..803a0caa9 100644 --- a/src/k_objects.h +++ b/src/k_objects.h @@ -321,7 +321,7 @@ void Obj_PatrolIvoBallInit(mobj_t *mo); void Obj_PatrolIvoBallThink(mobj_t *mo); void Obj_PatrolIvoBallTouch(mobj_t *special, mobj_t *toucher); -/* SA2 Crates */ +/* SA2 Crates / Ice Cap Blocks */ void Obj_BoxSideThink(mobj_t *mo); void Obj_TryCrateInit(mobj_t *mo); boolean Obj_TryCrateThink(mobj_t *mo); diff --git a/src/objects/crate.cpp b/src/objects/crate.cpp index 4f877a5c4..7405b0b80 100644 --- a/src/objects/crate.cpp +++ b/src/objects/crate.cpp @@ -49,6 +49,13 @@ struct SA2CrateConfig static constexpr statenum_t kDefaultDebris = S_SA2_CRATE_DEBRIS; }; +struct IceCapBlockConfig +{ + static constexpr spritenum_t kSprite = SPR_ICBL; + static constexpr frame_layout kFrames = {6, 6, 0, 0, 0, 0}; + static constexpr statenum_t kDefaultDebris = S_ICECAPBLOCK_DEBRIS; +}; + struct Graphic : Mobj { void hnext() = delete; @@ -330,6 +337,10 @@ struct Crate : Box } }; +struct Ice : Box +{ +}; + template bool AnyBox::visit(F&& visitor) { @@ -339,6 +350,10 @@ bool AnyBox::visit(F&& visitor) visitor(static_cast(this)); break; + case MT_ICECAPBLOCK: + visitor(static_cast(this)); + break; + default: return false; } diff --git a/src/p_inter.c b/src/p_inter.c index d7634f6ea..05fb78b3d 100644 --- a/src/p_inter.c +++ b/src/p_inter.c @@ -989,6 +989,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck) } case MT_SA2_CRATE: + case MT_ICECAPBLOCK: { Obj_TryCrateTouch(special, toucher); return; @@ -2855,6 +2856,7 @@ boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 da return false; case MT_SA2_CRATE: + case MT_ICECAPBLOCK: Obj_TryCrateDamage(target, inflictor); return true; diff --git a/src/p_map.c b/src/p_map.c index 53ca852db..affb16159 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -1635,6 +1635,7 @@ static BlockItReturn_t PIT_CheckThing(mobj_t *thing) switch (tm.thing->type) { case MT_SA2_CRATE: + case MT_ICECAPBLOCK: // Let crates stack on top of solid objects (this // includes other crates). if (thing->flags & MF_SOLID) diff --git a/src/p_mobj.c b/src/p_mobj.c index a01c3173b..50bb15ac8 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -6837,6 +6837,7 @@ static void P_MobjSceneryThink(mobj_t *mobj) return; } case MT_SA2_CRATE: + case MT_ICECAPBLOCK: { if (!Obj_TryCrateThink(mobj)) { @@ -14490,6 +14491,7 @@ static boolean P_SetupSpawnedMapThing(mapthing_t *mthing, mobj_t *mobj) break; } case MT_SA2_CRATE: + case MT_ICECAPBLOCK: { Obj_TryCrateInit(mobj); break;