From 37743466422e89493f4547ab2ee7129226fefa84 Mon Sep 17 00:00:00 2001 From: James R Date: Mon, 20 Feb 2023 20:52:11 -0800 Subject: [PATCH 1/3] Add Gacha Bom sprites --- src/deh_tables.c | 2 ++ src/info.c | 8 ++++++-- src/info.h | 4 ++++ 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/deh_tables.c b/src/deh_tables.c index 16134fe68..07c69f687 100644 --- a/src/deh_tables.c +++ b/src/deh_tables.c @@ -4557,6 +4557,8 @@ const char *const STATE_LIST[] = { // array length left dynamic for sanity testi "S_SPECIAL_UFO_OVERLAY", "S_SPECIAL_UFO_ARM", "S_SPECIAL_UFO_STEM", + + "S_GACHABOM", }; // RegEx to generate this from info.h: ^\tMT_([^,]+), --> \t"MT_\1", diff --git a/src/info.c b/src/info.c index 037fcc535..2c22b4bf4 100644 --- a/src/info.c +++ b/src/info.c @@ -795,6 +795,8 @@ char sprnames[NUMSPRITES + 1][5] = "UQMK", + "GBOM", + // First person view sprites; this is a sprite so that it can be replaced by a specialized MD2 draw later "VIEW", }; @@ -5180,6 +5182,8 @@ state_t states[NUMSTATES] = {SPR_UFOB, 1|FF_FULLBRIGHT|FF_ANIMATE, -1, {NULL}, 1, 1, S_NULL}, // S_SPECIAL_UFO_OVERLAY {SPR_UFOA, FF_PAPERSPRITE, -1, {NULL}, 0, 0, S_NULL}, // S_SPECIAL_UFO_ARM {SPR_UFOS, 0, -1, {NULL}, 0, 0, S_NULL}, // S_SPECIAL_UFO_STEM + + {SPR_GBOM, FF_ANIMATE, -1, {NULL}, 3, 1, S_NULL}, // S_GACHABOM }; mobjinfo_t mobjinfo[NUMMOBJTYPES] = @@ -24364,7 +24368,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = { // MT_GACHABOM -1, // doomednum - S_ORBINAUT1, // spawnstate + S_GACHABOM, // spawnstate 7, // spawnhealth S_NULL, // seestate sfx_tossed, // seesound @@ -24375,7 +24379,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = sfx_None, // painsound S_NULL, // meleestate S_NULL, // missilestate - S_ORBINAUT_DEAD,// deathstate + S_GACHABOM, // deathstate S_NULL, // xdeathstate sfx_s3k5d, // deathsound 64*FRACUNIT, // speed diff --git a/src/info.h b/src/info.h index f4771bd9c..1bac859b1 100644 --- a/src/info.h +++ b/src/info.h @@ -1346,6 +1346,8 @@ typedef enum sprite SPR_UQMK, + SPR_GBOM, + // First person view sprites; this is a sprite so that it can be replaced by a specialized MD2 draw later SPR_VIEW, @@ -5607,6 +5609,8 @@ typedef enum state S_SPECIAL_UFO_ARM, S_SPECIAL_UFO_STEM, + S_GACHABOM, + S_FIRSTFREESLOT, S_LASTFREESLOT = S_FIRSTFREESLOT + NUMSTATEFREESLOTS - 1, NUMSTATES From 1f496e05eccca87d5684c73254807be2630a0fdf Mon Sep 17 00:00:00 2001 From: James R Date: Mon, 20 Feb 2023 20:55:17 -0800 Subject: [PATCH 2/3] Refactor objects/orbinaut.c for Gacha Bom - Add flags variable to toggle much of Orbinaut behavior. - Don't spawn afterimages for Gacha Bom. - Animate facing angle of Gacha Bom when thrown backward. - Let tossed Gacha Bom drive forward after landing. --- src/k_kart.c | 11 ++++----- src/k_objects.h | 2 ++ src/objects/orbinaut.c | 54 ++++++++++++++++++++++++++++++++++++++---- src/p_mobj.c | 36 ++-------------------------- 4 files changed, 57 insertions(+), 46 deletions(-) diff --git a/src/k_kart.c b/src/k_kart.c index 0f9dafcca..5a73a74bc 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -4552,7 +4552,6 @@ static mobj_t *K_SpawnKartMissile(mobj_t *source, mobjtype_t type, angle_t an, I switch (type) { case MT_ORBINAUT: - case MT_GACHABOM: Obj_OrbinautThrown(th, finalspeed, dir); break; case MT_JAWZ: @@ -4575,6 +4574,9 @@ static mobj_t *K_SpawnKartMissile(mobj_t *source, mobjtype_t type, angle_t an, I case MT_GARDENTOP: th->movefactor = finalspeed; break; + case MT_GACHABOM: + Obj_GachaBomThrown(th, finalspeed, dir); + break; default: break; } @@ -5475,12 +5477,7 @@ mobj_t *K_ThrowKartItem(player_t *player, boolean missile, mobjtype_t mapthing, if (mapthing == MT_GACHABOM) { - // Set dropped flag - mo->flags2 |= MF2_AMBUSH; - mo->movecount = 2; - P_SetMobjState(mo, mo->info->deathstate); - mo->tics = -1; - mo->color = player->skincolor; + Obj_GachaBomThrown(mo, mo->radius, dir); } // this is the small graphic effect that plops in you when you throw an item: diff --git a/src/k_objects.h b/src/k_objects.h index be73d4949..05debb889 100644 --- a/src/k_objects.h +++ b/src/k_objects.h @@ -47,7 +47,9 @@ mobj_t *Obj_MantaRingCreate(mobj_t *spb, mobj_t *owner, mobj_t *chase); void Obj_OrbinautThink(mobj_t *th); boolean Obj_OrbinautJawzCollide(mobj_t *t1, mobj_t *t2); void Obj_OrbinautThrown(mobj_t *th, fixed_t finalSpeed, SINT8 dir); +void Obj_GachaBomThrown(mobj_t *th, fixed_t finalSpeed, SINT8 dir); void Obj_OrbinautJawzMoveHeld(player_t *player); +boolean Obj_GachaBomWasTossed(mobj_t *th); /* Jawz */ void Obj_JawzThink(mobj_t *th); diff --git a/src/objects/orbinaut.c b/src/objects/orbinaut.c index 0e8bf7d24..27e3fe742 100644 --- a/src/objects/orbinaut.c +++ b/src/objects/orbinaut.c @@ -30,7 +30,6 @@ #define orbinaut_speed(o) ((o)->movefactor) #define orbinaut_selfdelay(o) ((o)->threshold) -#define orbinaut_dropped(o) ((o)->flags2 & MF2_AMBUSH) #define orbinaut_droptime(o) ((o)->movecount) #define orbinaut_turn(o) ((o)->extravalue1) @@ -39,17 +38,26 @@ #define orbinaut_shield_dist(o) ((o)->extravalue1) +enum { + ORBI_DROPPED = 0x01, // stationary hazard + ORBI_TOSSED = 0x02, // Gacha Bom tossed forward + ORBI_TRAIL = 0x04, // spawn afterimages + ORBI_SPIN = 0x08, // animate facing angle +}; + +#define orbinaut_flags(o) ((o)->movedir) +#define orbinaut_spin(o) ((o)->extravalue2) + void Obj_OrbinautThink(mobj_t *th) { boolean grounded = P_IsObjectOnGround(th); - mobj_t *ghost = NULL; if (th->fuse > 0 && th->fuse <= TICRATE) { th->renderflags ^= RF_DONTDRAW; } - if (orbinaut_dropped(th)) + if (orbinaut_flags(th) & ORBI_DROPPED) { if (grounded && (th->flags & MF_NOCLIPTHING)) { @@ -72,8 +80,13 @@ void Obj_OrbinautThink(mobj_t *th) return; } - ghost = P_SpawnGhostMobj(th); - ghost->colorized = true; // already has color! + if (orbinaut_flags(th) & ORBI_TRAIL) + { + mobj_t *ghost = NULL; + + ghost = P_SpawnGhostMobj(th); + ghost->colorized = true; // already has color! + } th->angle = K_MomentumAngle(th); if (orbinaut_turn(th) != 0) @@ -124,6 +137,12 @@ void Obj_OrbinautThink(mobj_t *th) P_Thrust(th, th->angle, thrustamount); } + if (orbinaut_flags(th) & ORBI_SPIN) + { + th->angle = orbinaut_spin(th); + orbinaut_spin(th) += ANGLE_22h; + } + /* todo: UDMFify if (P_MobjTouchingSectorSpecialFlag(th, ?)) { @@ -281,6 +300,8 @@ void Obj_OrbinautThrown(mobj_t *th, fixed_t finalSpeed, SINT8 dir) th->fuse = RR_PROJECTILE_FUSE; orbinaut_speed(th) = finalSpeed; + orbinaut_flags(th) = ORBI_TRAIL; + if (dir == -1) { // Thrown backwards, init orbiting in place @@ -292,6 +313,24 @@ void Obj_OrbinautThrown(mobj_t *th, fixed_t finalSpeed, SINT8 dir) } } +void Obj_GachaBomThrown(mobj_t *th, fixed_t finalSpeed, SINT8 dir) +{ + Obj_OrbinautThrown(th, finalSpeed, dir); + + orbinaut_flags(th) &= ~(ORBI_TRAIL); + + switch (dir) + { + case -1: + orbinaut_flags(th) |= ORBI_SPIN; + break; + + case 1: + orbinaut_flags(th) |= ORBI_TOSSED; + break; + } +} + void Obj_OrbinautJawzMoveHeld(player_t *player) { fixed_t finalscale = K_ItemScaleForPlayer(player); @@ -391,3 +430,8 @@ void Obj_OrbinautJawzMoveHeld(player_t *player) cur = cur->hnext; } } + +boolean Obj_GachaBomWasTossed(mobj_t *th) +{ + return (orbinaut_flags(th) & ORBI_TOSSED) == ORBI_TOSSED; +} diff --git a/src/p_mobj.c b/src/p_mobj.c index 3ac878bb5..7382ec5d6 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -1196,9 +1196,9 @@ fixed_t P_GetMobjGravity(mobj_t *mo) gravityadd /= 2; break; case MT_GACHABOM: - if (!(mo->flags2 & MF2_AMBUSH)) + // Use normal gravity, unless if it was tossed. + if (!Obj_GachaBomWasTossed(mo)) { - // Use normal gravity, unless if it was tossed. break; } /*FALLTHRU*/ @@ -7177,38 +7177,6 @@ static boolean P_MobjRegularThink(mobj_t *mobj) } break; case MT_GACHABOM: - { - if (mobj->flags2 & MF2_AMBUSH) - { - mobj->friction = ORIG_FRICTION/4; - - if (mobj->momx || mobj->momy) - { - mobj_t *ghost = P_SpawnGhostMobj(mobj); - - if (mobj->target && !P_MobjWasRemoved(mobj->target) && mobj->target->player) - { - ghost->color = mobj->target->player->skincolor; - ghost->colorized = true; - } - } - - if (P_IsObjectOnGround(mobj)) - { - if (mobj->movecount > 1) - { - S_StartSound(mobj, mobj->info->activesound); - mobj->momx = mobj->momy = 0; - mobj->movecount = 1; - } - } - - if (mobj->threshold > 0) - mobj->threshold--; - break; - } - } - /* FALLTHRU */ case MT_ORBINAUT: { Obj_OrbinautThink(mobj); From 93f335c636883f3962c2bbeb9e8791711a5dc08c Mon Sep 17 00:00:00 2001 From: James R Date: Mon, 20 Feb 2023 21:25:38 -0800 Subject: [PATCH 3/3] Add Gacha Bom item HUD graphics --- src/k_hud.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/k_hud.c b/src/k_hud.c index 668de1d52..598d379e6 100644 --- a/src/k_hud.c +++ b/src/k_hud.c @@ -133,6 +133,7 @@ static patch_t *kp_superring[2]; static patch_t *kp_kitchensink[2]; static patch_t *kp_droptarget[2]; static patch_t *kp_gardentop[2]; +static patch_t *kp_gachabom[2]; static patch_t *kp_check[6]; @@ -439,6 +440,7 @@ void K_LoadKartHUDGraphics(void) HU_UpdatePatch(&kp_kitchensink[0], "K_ITSINK"); HU_UpdatePatch(&kp_droptarget[0], "K_ITDTRG"); HU_UpdatePatch(&kp_gardentop[0], "K_ITGTOP"); + HU_UpdatePatch(&kp_gachabom[0], "K_ITGBOM"); sprintf(buffer, "FSMFGxxx"); for (i = 0; i < 104; i++) @@ -491,6 +493,7 @@ void K_LoadKartHUDGraphics(void) HU_UpdatePatch(&kp_kitchensink[1], "K_ISSINK"); HU_UpdatePatch(&kp_droptarget[1], "K_ISDTRG"); HU_UpdatePatch(&kp_gardentop[1], "K_ISGTOP"); + HU_UpdatePatch(&kp_gachabom[1], "K_ISGBOM"); sprintf(buffer, "FSMFSxxx"); for (i = 0; i < 104; i++) @@ -737,9 +740,9 @@ const char *K_GetItemPatch(UINT8 item, boolean tiny) return (tiny ? "K_ISDTRG" : "K_ITDTRG"); case KITEM_GARDENTOP: return (tiny ? "K_ISGTOP" : "K_ITGTOP"); - case KITEM_GACHABOM: // temp - case KRITEM_TRIPLEGACHABOM: // temp - return (tiny ? "K_ISSINK" : "K_ITSINK"); + case KITEM_GACHABOM: + case KRITEM_TRIPLEGACHABOM: + return (tiny ? "K_ISGBOM" : "K_ITGBOM"); case KRITEM_TRIPLEORBINAUT: return (tiny ? "K_ISORBN" : "K_ITORB3"); case KRITEM_QUADORBINAUT: @@ -776,7 +779,7 @@ static patch_t *K_GetCachedItemPatch(INT32 item, UINT8 offset) kp_kitchensink, kp_droptarget, kp_gardentop, - kp_kitchensink, // temp + kp_gachabom, }; if (item == KITEM_SAD || (item > KITEM_NONE && item < NUMKARTITEMS))