From 64939816fb6aa9a1e2d36a7a8355b219d970ef85 Mon Sep 17 00:00:00 2001 From: Jaime Passos Date: Sun, 17 Nov 2019 21:25:17 -0300 Subject: [PATCH 1/2] Fireball --- src/dehacked.c | 11 ++++------ src/info.c | 57 +++++++++++++++++++++++++++++++++++--------------- src/info.h | 11 ++++------ src/p_map.c | 5 +++++ src/p_mobj.c | 7 +++++++ src/p_user.c | 4 ++-- src/sounds.c | 2 ++ src/sounds.h | 2 ++ 8 files changed, 66 insertions(+), 33 deletions(-) diff --git a/src/dehacked.c b/src/dehacked.c index fff9dbee8..aed796625 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -7322,13 +7322,9 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit "S_FIREFLOWER2", "S_FIREFLOWER3", "S_FIREFLOWER4", - "S_FIREBALL1", - "S_FIREBALL2", - "S_FIREBALL3", - "S_FIREBALL4", - "S_FIREBALLEXP1", - "S_FIREBALLEXP2", - "S_FIREBALLEXP3", + "S_FIREBALL", + "S_FIREBALLTRAIL1", + "S_FIREBALLTRAIL2", "S_SHELL", "S_PUMA_START1", "S_PUMA_START2", @@ -8317,6 +8313,7 @@ static const char *const MOBJTYPE_LIST[] = { // array length left dynamic for s "MT_BLUEGOOMBA", "MT_FIREFLOWER", "MT_FIREBALL", + "MT_FIREBALLTRAIL", "MT_SHELL", "MT_PUMA", "MT_PUMATRAIL", diff --git a/src/info.c b/src/info.c index ed29fe2bf..3acdf2e47 100644 --- a/src/info.c +++ b/src/info.c @@ -3527,13 +3527,9 @@ state_t states[NUMSTATES] = {SPR_FFWR, 3, 3, {NULL}, 0, 0, S_FIREFLOWER1}, // S_FIREFLOWER4 // Thrown Mario Fireball - {SPR_FBLL, FF_FULLBRIGHT, 3, {NULL}, 0, 0, S_FIREBALL2}, // S_FIREBALL1 - {SPR_FBLL, FF_FULLBRIGHT|1, 3, {NULL}, 0, 0, S_FIREBALL3}, // S_FIREBALL2 - {SPR_FBLL, FF_FULLBRIGHT|2, 3, {NULL}, 0, 0, S_FIREBALL4}, // S_FIREBALL3 - {SPR_FBLL, FF_FULLBRIGHT|3, 3, {NULL}, 0, 0, S_FIREBALL1}, // S_FIREBALL4 - {SPR_FBLL, FF_FULLBRIGHT|4, 3, {NULL}, 0, 0, S_FIREBALLEXP2}, // S_FIREBALLEXP1 - {SPR_FBLL, FF_FULLBRIGHT|5, 3, {NULL}, 0, 0, S_FIREBALLEXP3}, // S_FIREBALLEXP2 - {SPR_FBLL, FF_FULLBRIGHT|6, 3, {NULL}, 0, 0, S_NULL}, // S_FIREBALLEXP3 + {SPR_FBLL, FF_FULLBRIGHT, 1, {A_SpawnObjectRelative}, 0, MT_FIREBALLTRAIL, S_FIREBALL}, // S_FIREBALL + {SPR_FBLL, 1|FF_FULLBRIGHT|FF_TRANS50, 1, {A_SetScale}, FRACUNIT*3/4, 0, S_FIREBALLTRAIL2}, // S_FIREBALLTRAIL1 + {SPR_FBLL, 1|FF_FULLBRIGHT|FF_TRANS50, 8, {A_SetScale}, FRACUNIT/6, 1, S_NULL}, // S_FIREBALLTRAIL2 // Turtle Shell {SPR_SHLL, 0, -1, {NULL}, 0, 0, S_NULL}, // S_SHELL @@ -18910,31 +18906,58 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = { // MT_FIREBALL -1, // doomednum - S_FIREBALL1, // spawnstate + S_FIREBALL, // spawnstate 1000, // spawnhealth - S_FIREBALLEXP1, // seestate - sfx_None, // seesound + S_NULL, // seestate + sfx_fbll, // seesound 8, // reactiontime sfx_None, // attacksound S_NULL, // painstate 0, // painchance sfx_None, // painsound - S_FIREBALLEXP1, // meleestate - S_FIREBALLEXP1, // missilestate - S_FIREBALLEXP1, // deathstate - S_FIREBALLEXP1, // xdeathstate - sfx_mario1, // deathsound - 10*FRACUNIT, // speed + S_NULL, // meleestate + S_NULL, // missilestate + S_NULL, // deathstate + S_NULL, // xdeathstate + sfx_fblldi, // deathsound + 40*FRACUNIT, // speed 4*FRACUNIT, // radius 8*FRACUNIT, // height 0, // display offset DMG_FIRE, // mass 1, // damage sfx_None, // activesound - MF_NOBLOCKMAP|MF_FIRE|MF_MISSILE, // flags + MF_FIRE|MF_BOUNCE|MF_MISSILE, // flags S_NULL // raisestate }, + { // MT_FIREBALLTRAIL + -1, // doomednum + S_FIREBALLTRAIL1, // spawnstate + 1000, // spawnhealth + S_NULL, // seestate + sfx_None, // seesound + 8, // 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 + 16*FRACUNIT, // radius + 16*FRACUNIT, // height + 0, // display offset + 0, // mass + 1, // damage + sfx_None, // activesound + MF_NOBLOCKMAP|MF_NOGRAVITY|MF_NOCLIP|MF_RUNSPAWNFUNC, // flags + S_NULL // raisestate + }, + { // MT_SHELL 1804, // doomednum S_SHELL, // spawnstate diff --git a/src/info.h b/src/info.h index bbb6a21fc..a0c793adc 100644 --- a/src/info.h +++ b/src/info.h @@ -3637,13 +3637,9 @@ typedef enum state S_FIREFLOWER2, S_FIREFLOWER3, S_FIREFLOWER4, - S_FIREBALL1, - S_FIREBALL2, - S_FIREBALL3, - S_FIREBALL4, - S_FIREBALLEXP1, - S_FIREBALLEXP2, - S_FIREBALLEXP3, + S_FIREBALL, + S_FIREBALLTRAIL1, + S_FIREBALLTRAIL2, S_SHELL, S_PUMA_START1, S_PUMA_START2, @@ -4654,6 +4650,7 @@ typedef enum mobj_type MT_BLUEGOOMBA, MT_FIREFLOWER, MT_FIREBALL, + MT_FIREBALLTRAIL, MT_SHELL, MT_PUMA, MT_PUMATRAIL, diff --git a/src/p_map.c b/src/p_map.c index bb56a50b1..70fd58f06 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -1301,6 +1301,11 @@ static boolean PIT_CheckThing(mobj_t *thing) return false; } + // Fireball touched an enemy + // Don't bounce though, just despawn right there + if ((tmthing->type == MT_FIREBALL) && (thing->flags & MF_ENEMY)) + P_KillMobj(tmthing, NULL, NULL, 0); + // damage / explode if (tmthing->flags & MF_ENEMY) // An actual ENEMY! (Like the deton, for example) P_DamageMobj(thing, tmthing, tmthing, 1, 0); diff --git a/src/p_mobj.c b/src/p_mobj.c index 5d6a8a10f..431592a06 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -8690,6 +8690,13 @@ void P_MobjThinker(mobj_t *mobj) case MT_KOOPA: P_KoopaThinker(mobj); break; + case MT_FIREBALL: + if (P_AproxDistance(mobj->momx, mobj->momy) <= 16*FRACUNIT) // Once fireballs lose enough speed, kill them + { + P_KillMobj(mobj, NULL, NULL, 0); + return; + } + break; case MT_REDRING: if (((mobj->z < mobj->floorz) || (mobj->z + mobj->height > mobj->ceilingz)) && mobj->flags & MF_MISSILE) diff --git a/src/p_user.c b/src/p_user.c index 3c481e7e2..9f85c5905 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -3993,12 +3993,12 @@ static void P_DoFiring(player_t *player, ticcmd_t *cmd) if (player->pflags & PF_ATTACKDOWN || player->climbing || (G_TagGametype() && !(player->pflags & PF_TAGIT))) return; - if ((player->powers[pw_shield] & SH_STACK) == SH_FIREFLOWER) + if (((player->powers[pw_shield] & SH_STACK) == SH_FIREFLOWER) && !(player->weapondelay)) { player->pflags |= PF_ATTACKDOWN; mo = P_SpawnPlayerMissile(player->mo, MT_FIREBALL, 0); P_InstaThrust(mo, player->mo->angle, ((mo->info->speed>>FRACBITS)*player->mo->scale) + player->speed); - S_StartSound(player->mo, sfx_mario7); + P_SetWeaponDelay(player, TICRATE); // Short delay between fireballs so you can't spam them everywhere return; } diff --git a/src/sounds.c b/src/sounds.c index b067903b1..4fa2089a5 100644 --- a/src/sounds.c +++ b/src/sounds.c @@ -277,6 +277,8 @@ sfxinfo_t S_sfx[NUMSFX] = {"mario9", true, 120, 0, -1, NULL, 0, -1, -1, LUMPERROR, "Emerging power-up"}, {"marioa", true, 192, 0, -1, NULL, 0, -1, -1, LUMPERROR, "One-up"}, {"thwomp", true, 127, 8, -1, NULL, 0, -1, -1, LUMPERROR, "Thwomp"}, + {"fbll", false, 32, 0, -1, NULL, 0, -1, -1, LUMPERROR, "Fireball throw"}, + {"fblldi", false, 60, 0, -1, NULL, 0, -1, -1, LUMPERROR, "Fireball hit"}, // Black Eggman {"bebomb", false, 64, 64, -1, NULL, 0, -1, -1, LUMPERROR, "Big explosion"}, diff --git a/src/sounds.h b/src/sounds.h index d48deb540..7859dfb18 100644 --- a/src/sounds.h +++ b/src/sounds.h @@ -326,6 +326,8 @@ typedef enum sfx_mario9, sfx_marioa, sfx_thwomp, + sfx_fbll, + sfx_fblldi, // Black Eggman sfx_bebomb, From 635e121bfcd9740e0f01449295413788d53234cb Mon Sep 17 00:00:00 2001 From: Jaime Passos Date: Sun, 17 Nov 2019 21:33:59 -0300 Subject: [PATCH 2/2] Restore old sound effect --- src/info.c | 4 ++-- src/p_user.c | 1 + src/sounds.c | 2 -- src/sounds.h | 2 -- 4 files changed, 3 insertions(+), 6 deletions(-) diff --git a/src/info.c b/src/info.c index 3acdf2e47..50980a9c3 100644 --- a/src/info.c +++ b/src/info.c @@ -18909,7 +18909,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = S_FIREBALL, // spawnstate 1000, // spawnhealth S_NULL, // seestate - sfx_fbll, // seesound + sfx_None, // seesound 8, // reactiontime sfx_None, // attacksound S_NULL, // painstate @@ -18919,7 +18919,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = S_NULL, // missilestate S_NULL, // deathstate S_NULL, // xdeathstate - sfx_fblldi, // deathsound + sfx_None, // deathsound 40*FRACUNIT, // speed 4*FRACUNIT, // radius 8*FRACUNIT, // height diff --git a/src/p_user.c b/src/p_user.c index 9f85c5905..ffcf1e074 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -3998,6 +3998,7 @@ static void P_DoFiring(player_t *player, ticcmd_t *cmd) player->pflags |= PF_ATTACKDOWN; mo = P_SpawnPlayerMissile(player->mo, MT_FIREBALL, 0); P_InstaThrust(mo, player->mo->angle, ((mo->info->speed>>FRACBITS)*player->mo->scale) + player->speed); + S_StartSound(player->mo, sfx_mario7); P_SetWeaponDelay(player, TICRATE); // Short delay between fireballs so you can't spam them everywhere return; } diff --git a/src/sounds.c b/src/sounds.c index 4fa2089a5..b067903b1 100644 --- a/src/sounds.c +++ b/src/sounds.c @@ -277,8 +277,6 @@ sfxinfo_t S_sfx[NUMSFX] = {"mario9", true, 120, 0, -1, NULL, 0, -1, -1, LUMPERROR, "Emerging power-up"}, {"marioa", true, 192, 0, -1, NULL, 0, -1, -1, LUMPERROR, "One-up"}, {"thwomp", true, 127, 8, -1, NULL, 0, -1, -1, LUMPERROR, "Thwomp"}, - {"fbll", false, 32, 0, -1, NULL, 0, -1, -1, LUMPERROR, "Fireball throw"}, - {"fblldi", false, 60, 0, -1, NULL, 0, -1, -1, LUMPERROR, "Fireball hit"}, // Black Eggman {"bebomb", false, 64, 64, -1, NULL, 0, -1, -1, LUMPERROR, "Big explosion"}, diff --git a/src/sounds.h b/src/sounds.h index 7859dfb18..d48deb540 100644 --- a/src/sounds.h +++ b/src/sounds.h @@ -326,8 +326,6 @@ typedef enum sfx_mario9, sfx_marioa, sfx_thwomp, - sfx_fbll, - sfx_fblldi, // Black Eggman sfx_bebomb,