diff --git a/src/deh_tables.c b/src/deh_tables.c index 8a2713bad..5fe950e9e 100644 --- a/src/deh_tables.c +++ b/src/deh_tables.c @@ -3760,6 +3760,7 @@ const char *const STATE_LIST[] = { // array length left dynamic for sanity testi // Shrink "S_SHRINK_GUN", + "S_SHRINK_CHAIN", "S_SHRINK_LASER", "S_SHRINK_PARTICLE", diff --git a/src/info.c b/src/info.c index 4da0d27e1..186f04022 100644 --- a/src/info.c +++ b/src/info.c @@ -574,6 +574,7 @@ char sprnames[NUMSPRITES + 1][5] = "FLMF", // Flame Shield flash "HYUU", // Hyudoro "GRWP", // Grow + "POHB", // Shrink Poh-Bee "SHRG", // Shrink gun / laser "SINK", // Kitchen Sink "SITR", // Kitchen Sink Trail @@ -4319,6 +4320,7 @@ state_t states[NUMSTATES] = {SPR_GRWP, FF_FULLBRIGHT|FF_ANIMATE, 13, {NULL}, 7, 1, S_NULL}, // S_GROW_PARTICLE {SPR_SHRG, 0, -1, {NULL}, 0, 0, S_NULL}, // S_SHRINK_GUN + {SPR_POHB, 0, -1, {NULL}, 0, 0, S_NULL}, // S_SHRINK_CHAIN {SPR_SHRG, FF_FULLBRIGHT|1, -1, {NULL}, 0, 0, S_NULL}, // S_SHRINK_LASER {SPR_SHRG, FF_FULLBRIGHT|2, -1, {NULL}, 0, 0, S_NULL}, // S_SHRINK_PARTICLE @@ -24127,7 +24129,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = { // MT_SHRINK_CHAIN -1, // doomednum - S_SHRINK_GUN, // spawnstate + S_SHRINK_CHAIN, // spawnstate 1000, // spawnhealth S_NULL, // seestate sfx_None, // seesound @@ -24142,13 +24144,13 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = S_NULL, // xdeathstate sfx_None, // deathsound 0, // speed - 16*FRACUNIT, // radius - 120*FRACUNIT, // height + 26*FRACUNIT, // radius + 26*FRACUNIT, // height 0, // display offset 0, // mass 0, // damage sfx_None, // activesound - MF_NOTHINK|MF_NOCLIP|MF_NOCLIPTHING|MF_NOCLIPHEIGHT|MF_NOGRAVITY|MF_DONTENCOREMAP, // flags + MF_SCENERY|MF_NOCLIP|MF_NOCLIPTHING|MF_NOCLIPHEIGHT|MF_NOGRAVITY|MF_DONTENCOREMAP, // flags S_NULL // raisestate }, diff --git a/src/info.h b/src/info.h index ca7264dba..8acf73ba8 100644 --- a/src/info.h +++ b/src/info.h @@ -1120,6 +1120,7 @@ typedef enum sprite SPR_FLMF, // Flame Shield flash SPR_HYUU, // Hyudoro SPR_GRWP, // Grow + SPR_POHB, // Shrink Poh-Bee SPR_SHRG, // Shrink gun / laser SPR_SINK, // Kitchen Sink SPR_SITR, // Kitchen Sink Trail @@ -4752,6 +4753,7 @@ typedef enum state // Shrink S_SHRINK_GUN, + S_SHRINK_CHAIN, S_SHRINK_LASER, S_SHRINK_PARTICLE, diff --git a/src/objects/shrink.c b/src/objects/shrink.c index c76f3b0d3..2272c2909 100644 --- a/src/objects/shrink.c +++ b/src/objects/shrink.c @@ -31,7 +31,7 @@ #define GUN_SWING (ANGLE_90 - ANG10) #define GUN_SWINGTIME (4 * TICRATE) -#define CHAIN_SIZE (16) +#define CHAIN_SIZE (52) #define EXTRA_FOR_FIRST (7) @@ -58,6 +58,8 @@ enum #define gun_laser(o) ((o)->tracer) #define gun_chains(o) ((o)->hprev) +#define chain_index(o) ((o)->extravalue1) + enum { LASER_SHRINK, @@ -333,6 +335,34 @@ static void ShrinkLaserThinker(mobj_t *pohbee, mobj_t *gun, mobj_t *laser) } } +static void DoGunChains(mobj_t *gun, mobj_t *pohbee) +{ + const fixed_t gunZ = P_GetMobjHead(gun); + const fixed_t beeZ = P_GetMobjFeet(pohbee); + + const fixed_t offsetX = (pohbee->x - gun->x) / gun_numsegs(gun); + const fixed_t offsetY = (pohbee->y - gun->y) / gun_numsegs(gun); + const fixed_t offsetZ = (beeZ - gunZ) / gun_numsegs(gun); + + mobj_t *chain = NULL; + + fixed_t curX = gun->x + (offsetX / 2); + fixed_t curY = gun->y + (offsetY / 2); + fixed_t curZ = gunZ + (offsetZ / 2); + + chain = gun_chains(gun); + while (chain != NULL && P_MobjWasRemoved(chain) == false) + { + PohbeeMoveTo(chain, curX, curY, curZ); + + curX += offsetX; + curY += offsetY; + curZ += offsetZ; + + chain = gun_chains(chain); + } +} + static void ShrinkGunThinker(mobj_t *gun) { mobj_t *pohbee = gun_pohbee(gun); @@ -352,6 +382,8 @@ static void ShrinkGunThinker(mobj_t *gun) { ShrinkLaserThinker(pohbee, gun, gun_laser(gun)); } + + DoGunChains(gun, pohbee); } void Obj_PohbeeThinker(mobj_t *pohbee) @@ -612,7 +644,7 @@ static void CreatePohbee(player_t *owner, waypoint_t *start, waypoint_t *end, UI mobj_t *gun = P_SpawnMobjFromMobj(pohbee, 0, 0, 0, MT_SHRINK_GUN); mobj_t *laser = NULL; - //mobj_t *prevChain = NULL; + mobj_t *prevChain = NULL; P_SetTarget(&gun_pohbee(gun), pohbee); P_SetTarget(&pohbee_guns(prevGun), gun); @@ -623,16 +655,16 @@ static void CreatePohbee(player_t *owner, waypoint_t *start, waypoint_t *end, UI laser = P_SpawnMobjFromMobj(gun, 0, 0, 0, MT_SHRINK_LASER); P_SetTarget(&gun_laser(gun), laser); - /* prevChain = gun; for (j = 0; j < numSegs; j++) { mobj_t *chain = P_SpawnMobjFromMobj(gun, 0, 0, 0, MT_SHRINK_CHAIN); + P_SetTarget(&gun_chains(prevChain), chain); + chain_index(chain) = j; + prevChain = chain; } - */ - (void)j; prevGun = gun; }