From 867f7ecfcaee37266254a100f5bdcbee63f4e8db Mon Sep 17 00:00:00 2001 From: toaster Date: Mon, 8 Jul 2019 13:26:40 +0100 Subject: [PATCH] ha ha ha how can i possibly describe this commit Just wait for the MR, it won't be far behind. --- src/dehacked.c | 28 ++-- src/hardware/hw_light.c | 1 + src/info.c | 96 +++++++++--- src/info.h | 29 ++-- src/p_enemy.c | 58 +++++-- src/p_inter.c | 44 +++++- src/p_mobj.c | 324 +++++++++++++++++++++++++++++++--------- src/p_user.c | 3 + src/sounds.c | 7 +- src/sounds.h | 1 + 10 files changed, 465 insertions(+), 126 deletions(-) diff --git a/src/dehacked.c b/src/dehacked.c index 6014add3a..97af54f8b 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -4750,15 +4750,8 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit "S_EGGMOBILE4_RATK6", "S_EGGMOBILE4_RAISE1", "S_EGGMOBILE4_RAISE2", - "S_EGGMOBILE4_RAISE3", - "S_EGGMOBILE4_RAISE4", - "S_EGGMOBILE4_RAISE5", - "S_EGGMOBILE4_RAISE6", - "S_EGGMOBILE4_RAISE7", - "S_EGGMOBILE4_RAISE8", - "S_EGGMOBILE4_RAISE9", - "S_EGGMOBILE4_RAISE10", - "S_EGGMOBILE4_PAIN", + "S_EGGMOBILE4_PAIN1", + "S_EGGMOBILE4_PAIN2", "S_EGGMOBILE4_DIE1", "S_EGGMOBILE4_DIE2", "S_EGGMOBILE4_DIE3", @@ -4776,10 +4769,21 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit "S_EGGMOBILE4_FLEE1", "S_EGGMOBILE4_FLEE2", "S_EGGMOBILE4_MACE", + "S_EGGMOBILE4_MACE_DIE1", + "S_EGGMOBILE4_MACE_DIE2", + "S_EGGMOBILE4_MACE_DIE3", // Boss 4 jet flame - "S_JETFLAME1", - "S_JETFLAME2", + "S_JETFLAME", + + // Boss 4 Spectator Eggrobo + "S_EGGROBO1_IDLE", + "S_EGGROBO1_BSLAP1", + "S_EGGROBO2_BSLAP2", + "S_EGGROBO1_PISSED", + + // Boss 4 Spectator Eggrobo jet flame + "S_EGGROBOJET", // Boss 5 "S_FANG_IDLE1", @@ -7262,6 +7266,8 @@ static const char *const MOBJTYPE_LIST[] = { // array length left dynamic for s "MT_EGGMOBILE4", "MT_EGGMOBILE4_MACE", "MT_JETFLAME", + "MT_EGGROBO1", + "MT_EGGROBO1JET", // Boss 5 "MT_FANG", diff --git a/src/hardware/hw_light.c b/src/hardware/hw_light.c index 949f38064..8147681f9 100644 --- a/src/hardware/hw_light.c +++ b/src/hardware/hw_light.c @@ -202,6 +202,7 @@ light_t *t_lspr[NUMSPRITES] = // Boss 4 (Castle Eggman) &lspr[NOLIGHT], // SPR_EGGP &lspr[REDBALL_L], // SPR_EFIR + &lspr[NOLIGHT], // SPR_EGR1 // Boss 5 (Arid Canyon) &lspr[NOLIGHT], //SPR_FANG // replaces EGGQ diff --git a/src/info.c b/src/info.c index 51d41806b..1da0922a4 100644 --- a/src/info.c +++ b/src/info.c @@ -90,6 +90,7 @@ char sprnames[NUMSPRITES + 1][5] = // Boss 4 (Castle Eggman) "EGGP", "EFIR", // Boss 4 jet flame + "EGR1", // Boss 4 Spectator Eggrobo // Boss 5 (Arid Canyon) "FANG", // replaces EGGQ @@ -1351,17 +1352,9 @@ state_t states[NUMSTATES] = {SPR_EGGP, 9,150, {A_Boss4SpeedUp}, sfx_mswing, 0, S_EGGMOBILE4_RATK6}, // S_EGGMOBILE4_RATK5 {SPR_EGGP,10, 2, {NULL}, 0, 0, S_EGGMOBILE4_STND}, // S_EGGMOBILE4_RATK6 {SPR_EGGP, 0, 20, {A_Boss4Raise}, sfx_doord1, 0, S_EGGMOBILE4_RAISE2}, // S_EGGMOBILE4_RAISE1 - {SPR_EGGP,13, 10, {NULL}, 0, 0, S_EGGMOBILE4_RAISE3}, // S_EGGMOBILE4_RAISE2 - {SPR_EGGP,14, 10, {NULL}, 0, 0, S_EGGMOBILE4_RAISE2}, // S_EGGMOBILE4_RAISE3 - {SPR_EGGP,13, 10, {NULL}, 0, 0, S_EGGMOBILE4_RAISE5}, // S_EGGMOBILE4_RAISE4 - {SPR_EGGP,14, 10, {NULL}, 0, 0, S_EGGMOBILE4_RAISE6}, // S_EGGMOBILE4_RAISE5 - {SPR_EGGP,13, 10, {NULL}, 0, 0, S_EGGMOBILE4_RAISE7}, // S_EGGMOBILE4_RAISE6 - {SPR_EGGP,14, 10, {NULL}, 0, 0, S_EGGMOBILE4_RAISE8}, // S_EGGMOBILE4_RAISE7 - {SPR_EGGP,13, 10, {NULL}, 0, 0, S_EGGMOBILE4_RAISE9}, // S_EGGMOBILE4_RAISE8 - {SPR_EGGP,14, 10, {NULL}, 0, 0, S_EGGMOBILE4_RAISE10},// S_EGGMOBILE4_RAISE9 - // rename eventually - {SPR_EGGP,11, 0, {A_Boss4Reverse}, sfx_mswing, 0, S_EGGMOBILE4_PAIN}, // S_EGGMOBILE4_RAISE10 - {SPR_EGGP,11, 24, {A_Pain}, 0, 0, S_EGGMOBILE4_STND}, // S_EGGMOBILE4_PAIN + {SPR_EGGP,13|FF_ANIMATE, -1, {NULL}, 1, 10, S_NULL}, // S_EGGMOBILE4_RAISE2 + {SPR_EGGP,11, 0, {A_Boss4Reverse}, sfx_alarm, sfx_s3k60, S_EGGMOBILE4_PAIN2}, // S_EGGMOBILE4_PAIN1 + {SPR_EGGP,11, 24, {A_Pain}, 0, 0, S_EGGMOBILE4_STND}, // S_EGGMOBILE4_PAIN2 {SPR_EGGP,12, 8, {A_Fall}, 0, 0, S_EGGMOBILE4_DIE2}, // S_EGGMOBILE4_DIE1 {SPR_EGGP,12, 8, {A_BossScream}, 0, 0, S_EGGMOBILE4_DIE3}, // S_EGGMOBILE4_DIE2 {SPR_EGGP,12, 8, {A_BossScream}, 0, 0, S_EGGMOBILE4_DIE4}, // S_EGGMOBILE4_DIE3 @@ -1379,10 +1372,21 @@ state_t states[NUMSTATES] = {SPR_EGGP,13, 5, {NULL}, 0, 0, S_EGGMOBILE4_FLEE2}, // S_EGGMOBILE4_FLEE1 {SPR_EGGP,14, 5, {NULL}, 0, 0, S_EGGMOBILE4_FLEE1}, // S_EGGMOBILE4_FLEE2 {SPR_BMCE, 0, -1, {NULL}, 0, 0, S_NULL}, // S_EGGMOBILE4_MACE + {SPR_BMCE, 0, 2, {A_BossScream}, 1, MT_SONIC3KBOSSEXPLODE, S_EGGMOBILE4_MACE_DIE2}, // S_EGGMOBILE4_MACE_DIE1 + {SPR_NULL, 0, 2, {A_BossScream}, 1, MT_SONIC3KBOSSEXPLODE, S_EGGMOBILE4_MACE_DIE3}, // S_EGGMOBILE4_MACE_DIE2 + {SPR_NULL, 0, 0, {A_Repeat}, 7, S_EGGMOBILE4_MACE_DIE1, S_BOSSEXPLODE}, // S_EGGMOBILE4_MACE_DIE3 - // Boss 4 Jet flame - {SPR_EFIR, FF_FULLBRIGHT, 1, {NULL}, 0, 0, S_JETFLAME2}, // S_JETFLAME1 - {SPR_EFIR, FF_FULLBRIGHT|1, 1, {NULL}, 0, 0, S_JETFLAME1}, // S_JETFLAME2 + // Boss 4 jet flame + {SPR_EFIR, FF_FULLBRIGHT|FF_ANIMATE, -1, {NULL}, 1, 1, S_NULL}, // S_JETFLAME + + // Boss 4 Spectator Eggrobo + {SPR_EGR1, 0, -1, {NULL}, 0, 0, S_NULL}, // S_EGGROBO1_STND + {SPR_EGR1, 5, 2, {NULL}, 0, 0, S_EGGROBO1_BSLAP2}, // S_EGGROBO1_BSLAP1 + {SPR_EGR1, FF_ANIMATE|6, 35, {NULL}, 1, 2, S_EGGROBO1_STND}, // S_EGGROBO1_BSLAP2 + {SPR_EGR1, FF_ANIMATE|3, -1, {NULL}, 1, 2, S_NULL}, // S_EGGROBO1_PISSED + + // Boss 4 Spectator Eggrobo jet flame + {SPR_EFIR, FF_FULLBRIGHT|2, -1, {NULL}, 0, 0, S_NULL}, // S_EGGROBOJET // Boss 5 {SPR_FANG, 2, 16, {A_Look}, 1, 0, S_FANG_IDLE2}, // S_FANG_IDLE1 @@ -5585,7 +5589,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = sfx_None, // seesound 0, // reactiontime sfx_None, // attacksound - S_EGGMOBILE4_RAISE10, // painstate + S_EGGMOBILE4_PAIN1,// painstate 0, // painchance sfx_dmpain, // painsound S_EGGMOBILE4_LATK1,// meleestate @@ -5617,9 +5621,9 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = sfx_None, // painsound S_NULL, // meleestate S_NULL, // missilestate - S_BOSSEXPLODE, // deathstate + S_EGGMOBILE4_MACE_DIE1, // deathstate S_NULL, // xdeathstate - sfx_cybdth, // deathsound + sfx_None, // deathsound 48*FRACUNIT, // speed 34*FRACUNIT, // radius 68*FRACUNIT, // height @@ -5633,7 +5637,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = { // MT_JETFLAME -1, // doomednum - S_JETFLAME1, // spawnstate + S_JETFLAME, // spawnstate 1000, // spawnhealth S_NULL, // seestate sfx_None, // seesound @@ -5654,7 +5658,61 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = DMG_FIRE, // mass 0, // damage sfx_None, // activesound - MF_NOGRAVITY|MF_PAIN|MF_FIRE, // flags + MF_NOBLOCKMAP|MF_NOCLIP|MF_NOCLIPHEIGHT|MF_NOGRAVITY, // flags + S_NULL // raisestate + }, + + { // MT_EGGROBO1 + 1127, // doomednum + S_EGGROBO1_STND,// spawnstate + 1000, // spawnhealth + S_NULL, // seestate + sfx_s3ka0, // seesound + 8, // reactiontime + sfx_bsnipe, // attacksound + S_NULL, // painstate + 0, // painchance + sfx_None, // painsound + S_EGGROBO1_BSLAP1, // meleestate + S_NULL, // missilestate + S_EGGROBO1_PISSED, // deathstate + S_NULL, // xdeathstate + sfx_s3ka0, // deathsound + 12*FRACUNIT, // speed + 20*FRACUNIT, // radius + 72*FRACUNIT, // height + 0, // display offset + 0, // mass + 0, // damage + sfx_None, // activesound + MF_SPECIAL|MF_NOGRAVITY|MF_NOCLIPHEIGHT, // flags + S_NULL // raisestate + }, + + { // MT_EGGROBOJET + -1, // doomednum + S_EGGROBOJET, // 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 + 1, // speed + 10*FRACUNIT, // radius + 28*FRACUNIT, // height + 0, // display offset + 0, // mass + 0, // damage + sfx_None, // activesound + MF_NOBLOCKMAP|MF_NOCLIP|MF_NOCLIPHEIGHT|MF_NOGRAVITY, // flags S_NULL // raisestate }, diff --git a/src/info.h b/src/info.h index 75091ce1e..6034dfc7e 100644 --- a/src/info.h +++ b/src/info.h @@ -335,6 +335,7 @@ typedef enum sprite // Boss 4 (Castle Eggman) SPR_EGGP, SPR_EFIR, // Boss 4 jet flame + SPR_EGR1, // Boss 4 Spectator Eggrobo // Boss 5 (Arid Canyon) SPR_FANG, // replaces EGGQ @@ -1505,15 +1506,8 @@ typedef enum state S_EGGMOBILE4_RATK6, S_EGGMOBILE4_RAISE1, S_EGGMOBILE4_RAISE2, - S_EGGMOBILE4_RAISE3, - S_EGGMOBILE4_RAISE4, - S_EGGMOBILE4_RAISE5, - S_EGGMOBILE4_RAISE6, - S_EGGMOBILE4_RAISE7, - S_EGGMOBILE4_RAISE8, - S_EGGMOBILE4_RAISE9, - S_EGGMOBILE4_RAISE10, - S_EGGMOBILE4_PAIN, + S_EGGMOBILE4_PAIN1, + S_EGGMOBILE4_PAIN2, S_EGGMOBILE4_DIE1, S_EGGMOBILE4_DIE2, S_EGGMOBILE4_DIE3, @@ -1531,10 +1525,21 @@ typedef enum state S_EGGMOBILE4_FLEE1, S_EGGMOBILE4_FLEE2, S_EGGMOBILE4_MACE, + S_EGGMOBILE4_MACE_DIE1, + S_EGGMOBILE4_MACE_DIE2, + S_EGGMOBILE4_MACE_DIE3, // Boss 4 jet flame - S_JETFLAME1, - S_JETFLAME2, + S_JETFLAME, + + // Boss 4 Spectator Eggrobo + S_EGGROBO1_STND, + S_EGGROBO1_BSLAP1, + S_EGGROBO1_BSLAP2, + S_EGGROBO1_PISSED, + + // Boss 4 Spectator Eggrobo jet flame + S_EGGROBOJET, // Boss 5 S_FANG_IDLE1, @@ -4037,6 +4042,8 @@ typedef enum mobj_type MT_EGGMOBILE4, MT_EGGMOBILE4_MACE, MT_JETFLAME, + MT_EGGROBO1, + MT_EGGROBO1JET, // Boss 5 MT_FANG, diff --git a/src/p_enemy.c b/src/p_enemy.c index fa6e5e1b0..175431df5 100644 --- a/src/p_enemy.c +++ b/src/p_enemy.c @@ -3154,25 +3154,35 @@ void A_FocusTarget(mobj_t *actor) // Description: Reverse arms direction. // // var1 = sfx to play -// var2 = unused +// var2 = sfx to play in pinch // void A_Boss4Reverse(mobj_t *actor) { sfxenum_t locvar1 = (sfxenum_t)var1; + sfxenum_t locvar2 = (sfxenum_t)var2; #ifdef HAVE_BLUA if (LUA_CallAction("A_Boss4Reverse", actor)) return; #endif - S_StartSound(NULL, locvar1); actor->reactiontime = 0; - if (actor->movedir == 1) - actor->movedir = 2; - else if (actor->movedir == 2) - actor->movedir = 1; - else if (actor->movedir == 4) - actor->movedir = 5; + if (actor->movedir < 3) + { + S_StartSound(NULL, locvar1); + if (actor->movedir == 1) + actor->movedir = 2; + else + actor->movedir = 1; + } else - actor->movedir = 4; + { + S_StartSound(NULL, locvar2); + if (actor->movedir == 4) + actor->movedir = 5; + else + actor->movedir = 4; + actor->angle += ANGLE_180; + actor->movefactor = -actor->movefactor; + } } // Function: A_Boss4SpeedUp @@ -8670,8 +8680,8 @@ void A_BossJetFume(mobj_t *actor) { fixed_t jetx, jety, jetz; - jetx = actor->x + P_ReturnThrustX(actor, actor->angle, -FixedMul(60*FRACUNIT, actor->scale)); - jety = actor->y + P_ReturnThrustY(actor, actor->angle, -FixedMul(60*FRACUNIT, actor->scale)); + jetx = actor->x + P_ReturnThrustX(actor, actor->angle, -60*actor->scale); + jety = actor->y + P_ReturnThrustY(actor, actor->angle, -60*actor->scale); if (actor->eflags & MFE_VERTICALFLIP) jetz = actor->z + actor->height - FixedMul(17*FRACUNIT + mobjinfo[MT_PROPELLER].height, actor->scale); else @@ -8704,7 +8714,7 @@ void A_BossJetFume(mobj_t *actor) if (actor->eflags & MFE_VERTICALFLIP) jetz = actor->z + actor->height + FixedMul(50*FRACUNIT - mobjinfo[MT_JETFLAME].height, actor->scale); else - jetz = actor->z - FixedMul(50*FRACUNIT, actor->scale); + jetz = actor->z - 50*actor->scale; filler = P_SpawnMobj(actor->x, actor->y, jetz, MT_JETFLAME); P_SetTarget(&filler->target, actor); // Boss 4 already uses its tracer for other things @@ -8713,6 +8723,30 @@ void A_BossJetFume(mobj_t *actor) if (actor->eflags & MFE_VERTICALFLIP) filler->flags2 |= MF2_OBJECTFLIP; } + else if (locvar1 == 4) // Boss 4 Spectator Eggrobo jet flame + { + fixed_t jetx, jety, jetz, movefactor = 12; + + jetz = actor->z; + if (actor->eflags & MFE_VERTICALFLIP) + jetz += (actor->height - FixedMul(mobjinfo[MT_EGGROBO1JET].height, actor->scale)); + + while (true) + { + jetx = actor->x + P_ReturnThrustX(actor, actor->angle+ANGLE_90, movefactor*actor->scale) - P_ReturnThrustX(actor, actor->angle, 19*actor->scale); + jety = actor->y + P_ReturnThrustY(actor, actor->angle+ANGLE_90, movefactor*actor->scale) - P_ReturnThrustY(actor, actor->angle, 19*actor->scale); + filler = P_SpawnMobj(jetx, jety, jetz, MT_EGGROBO1JET); + filler->movefactor = movefactor; + P_SetTarget(&filler->target, actor); + filler->destscale = actor->scale; + P_SetScale(filler, filler->destscale); + if (actor->eflags & MFE_VERTICALFLIP) + filler->flags2 |= MF2_OBJECTFLIP; + if (movefactor <= 0) + break; + movefactor = -movefactor; + } + } } // Function: A_RandomState diff --git a/src/p_inter.c b/src/p_inter.c index b6bb3ba49..3e1b74e56 100644 --- a/src/p_inter.c +++ b/src/p_inter.c @@ -315,6 +315,8 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck) // Can happen with a sliding player corpse. if (toucher->health <= 0) return; + if (special->health <= 0) + return; if (heightcheck) { @@ -340,9 +342,6 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck) } } - if (special->health <= 0) - return; - player = toucher->player; I_Assert(player != NULL); // Only players can touch stuff! @@ -1557,6 +1556,45 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck) } return; + case MT_EGGROBO1: + if (special->state == &states[special->info->deathstate]) + return; + if (P_PlayerInPain(player)) + return; + + P_SetMobjState(special, special->info->meleestate); + special->angle = special->movedir; + special->momx = special->momy = 0; + + // Buenos Dias Mandy + P_SetPlayerMobjState(toucher, S_PLAY_STUN); + player->pflags &= ~PF_APPLYAUTOBRAKE; + player->drawangle = special->angle + ANGLE_180; + P_InstaThrust(toucher, special->angle, FixedMul(3*special->info->speed, special->scale/2)); + toucher->z += P_MobjFlip(toucher); + if (toucher->eflags & MFE_UNDERWATER) // unlikely. + P_SetObjectMomZ(toucher, FixedDiv(10511*FRACUNIT,2600*FRACUNIT), false); + else + P_SetObjectMomZ(toucher, FixedDiv(69*FRACUNIT,10*FRACUNIT), false); + if (P_IsLocalPlayer(player)) + { + quake.intensity = 9*FRACUNIT; + quake.time = TICRATE/2; + quake.epicenter = NULL; + } + +#if 0 // camera redirection - deemed unnecessary + toucher->angle = special->angle; + if (player == &players[consoleplayer]) + localangle = toucher->angle; + else if (player == &players[secondarydisplayplayer]) + localangle2 = toucher->angle; +#endif + + S_StartSound(toucher, special->info->attacksound); // home run + + return; + case MT_BIGTUMBLEWEED: case MT_LITTLETUMBLEWEED: if (toucher->momx || toucher->momy) diff --git a/src/p_mobj.c b/src/p_mobj.c index df3081bdf..dd7479060 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -4780,9 +4780,11 @@ static void P_Boss4PopSpikeballs(mobj_t *mobj) // static void P_Boss4Thinker(mobj_t *mobj) { + fixed_t movespeed = 0; + if ((statenum_t)(mobj->state-states) == mobj->info->spawnstate) { - if (mobj->flags2 & MF2_FRET && (mobj->health > mobj->info->damage || mobj->movedir == 4)) + if (mobj->flags2 & MF2_FRET && (mobj->health > mobj->info->damage)) mobj->flags2 &= ~MF2_FRET; mobj->reactiontime = 0; // Drop the cage immediately. } @@ -4798,6 +4800,44 @@ static void P_Boss4Thinker(mobj_t *mobj) return; } + if (mobj->movedir) // only not during init + { + INT32 oldmovecount = mobj->movecount; + if (mobj->movedir == 3) // pinch start + movespeed = -210<<(FRACBITS>>1); + else if (mobj->movedir > 3) // pinch + { + movespeed = 420<<(FRACBITS>>1); + movespeed += (420*(mobj->info->damage-mobj->health)<<(FRACBITS>>1)); + if (mobj->movedir == 4) + movespeed = -movespeed; + } + else // normal + { + movespeed = 170<<(FRACBITS>>1); + movespeed += ((50*(mobj->info->spawnhealth-mobj->health))<<(FRACBITS>>1)); + if (mobj->movedir == 2) + movespeed = -movespeed; + if (mobj->movefactor) + movespeed /= 2; + else if (mobj->threshold) + { + // 1 -> 1.5 second timer + INT32 maxtimer = TICRATE+(TICRATE*(mobj->info->spawnhealth-mobj->health)/10); + if (maxtimer < 1) + maxtimer = 1; + maxtimer = ((mobj->threshold*movespeed)/(2*maxtimer)); + movespeed -= maxtimer; + } + } + + mobj->movecount += movespeed + 360*FRACUNIT; + mobj->movecount %= 360*FRACUNIT; + + if (((oldmovecount>>FRACBITS)%120 >= 60) && !((mobj->movecount>>FRACBITS)%120 >= 60)) + S_StartSound(NULL, sfx_mswing); + } + // movedir == battle stage: // 0: initialization // 1: phase 1 forward @@ -4819,7 +4859,6 @@ static void P_Boss4Thinker(mobj_t *mobj) mobj_t *seg, *base = mobj; // First frame init, spawn all the things. mobj->watertop = mobj->z; - mobj->flags2 |= MF2_STRONGBOX; // don't perform the linedef executor at start z = mobj->z + mobj->height/2 - mobjinfo[MT_EGGMOBILE4_MACE].height/2; for (arm = 0; arm <3 ; arm++) { @@ -4851,22 +4890,13 @@ static void P_Boss4Thinker(mobj_t *mobj) fixed_t oldz = mobj->movecount; mobj->threshold -= 5*FRACUNIT; mobj->movecount += mobj->threshold; - if (mobj->movecount < 0) - mobj->movecount = 0; - P_Boss4MoveCage(mobj, mobj->movecount - oldz); - P_Boss4MoveSpikeballs(mobj, 0, mobj->movecount); - if (mobj->movecount == 0) + if (mobj->movecount <= 0) { - //mobj->threshold = 3*TICRATE; - mobj->extravalue1 = 1; - //P_LinedefExecute(LE_BOSS4DROP + (mobj->spawnpoint ? mobj->spawnpoint->extrainfo*LE_PARAMWIDTH : 0), mobj, NULL); -- oh no you don't - S_StartSound(NULL, sfx_doorc2); - quake.intensity = 10<movecount = 0; mobj->movedir++; // Initialization complete, next phase! } + P_Boss4MoveCage(mobj, mobj->movecount - oldz); + P_Boss4MoveSpikeballs(mobj, 0, mobj->movecount); } return; } @@ -4880,15 +4910,16 @@ static void P_Boss4Thinker(mobj_t *mobj) case 3: { fixed_t z; - if (mobj->z < mobj->watertop+(512<z < mobj->watertop+(400<momz = 8*FRACUNIT; else { - mobj->momz = 0; + mobj->momz = mobj->movefactor = 0; + mobj->threshold = 1110<movedir++; } - mobj->movecount -= 210<<(FRACBITS>>1); - mobj->movecount %= 360*FRACUNIT; + z = mobj->z - mobj->watertop - mobjinfo[MT_EGGMOBILE4_MACE].height - mobj->height/2; if (z < (8<movecount), 0); // So don't pull the spikeballs along yet. @@ -4900,23 +4931,30 @@ static void P_Boss4Thinker(mobj_t *mobj) case 4: case 5: { - fixed_t movespeed = 420<<(FRACBITS>>1); - movespeed += (420*(mobj->info->damage-mobj->health)<<(FRACBITS>>1)); - if (mobj->movedir == 4) - mobj->movecount -= movespeed; - else - mobj->movecount += movespeed; + mobj->angle -= FixedAngle(movespeed/8); + + if (mobj->movefactor != mobj->threshold) + { + if (mobj->threshold - mobj->movefactor < FRACUNIT) + { + mobj->movefactor = mobj->threshold; + mobj->flags2 &= ~MF2_FRET; + } + else + mobj->movefactor += (mobj->threshold - mobj->movefactor)/8; + } + + if (mobj->spawnpoint) + P_TryMove(mobj, + (mobj->spawnpoint->x<angle, mobj->movefactor), + (mobj->spawnpoint->y<angle, mobj->movefactor), + true); - if (mobj->z < (mobj->watertop + ((512+128*(mobj->info->damage-mobj->health))<momz = 8*FRACUNIT; - else - mobj->momz = 0; - mobj->movecount %= 360*FRACUNIT; P_Boss4PinchSpikeballs(mobj, FixedAngle(mobj->movecount), mobj->z - mobj->watertop - mobjinfo[MT_EGGMOBILE4_MACE].height - mobj->height/2); if (!mobj->target || !mobj->target->health) P_SupermanLook4Players(mobj); - A_FaceTarget(mobj); + //A_FaceTarget(mobj); return; } @@ -4936,18 +4974,21 @@ static void P_Boss4Thinker(mobj_t *mobj) if (mobj->reactiontime == 1) { fixed_t oldz = mobj->movefactor; - if (mobj->movefactor < 128*FRACUNIT) + if (mobj->movefactor != 128*FRACUNIT) { - mobj->movefactor += 8*FRACUNIT; - P_Boss4MoveCage(mobj, mobj->movefactor - oldz); - // 5 -> 2.5 second timer - mobj->threshold = 5*TICRATE-(TICRATE/2)*(mobj->info->spawnhealth-mobj->health); - if (mobj->threshold < 1) - mobj->threshold = 1; - } - else if (mobj->movefactor > 128*FRACUNIT) - { - mobj->movefactor = 128*FRACUNIT; + if (mobj->movefactor < 128*FRACUNIT) + { + mobj->movefactor += 8*FRACUNIT; + if (!oldz) + { + // 5 -> 2.5 second timer + mobj->threshold = 5*TICRATE-(TICRATE*(mobj->info->spawnhealth-mobj->health)/2); + if (mobj->threshold < 1) + mobj->threshold = 1; + } + } + else + mobj->movefactor = 128*FRACUNIT; P_Boss4MoveCage(mobj, mobj->movefactor - oldz); } } @@ -4959,37 +5000,26 @@ static void P_Boss4Thinker(mobj_t *mobj) if (mobj->movefactor < 0) mobj->movefactor = 0; P_Boss4MoveCage(mobj, mobj->movefactor - oldz); - if (mobj->flags2 & MF2_STRONGBOX) - mobj->flags2 &= ~MF2_STRONGBOX; - else if (!mobj->movefactor) + if (!mobj->movefactor) { if (mobj->health <= mobj->info->damage) { // Proceed to pinch phase! P_Boss4DestroyCage(mobj); mobj->movedir = 3; P_LinedefExecute(LE_PINCHPHASE + (mobj->spawnpoint ? mobj->spawnpoint->extrainfo*LE_PARAMWIDTH : 0), mobj, NULL); + P_Boss4MoveSpikeballs(mobj, FixedAngle(mobj->movecount), 0); + var1 = 3; + A_BossJetFume(mobj); return; } P_LinedefExecute(LE_BOSS4DROP - (mobj->info->spawnhealth-mobj->health) + (mobj->spawnpoint ? mobj->spawnpoint->extrainfo*LE_PARAMWIDTH : 0), mobj, NULL); - S_StartSound(NULL, sfx_doorc2); - quake.intensity = 10< 1.5 second timer + mobj->threshold = TICRATE+(TICRATE*(mobj->info->spawnhealth-mobj->health)/10); + if (mobj->threshold < 1) + mobj->threshold = 1; } } - { - fixed_t movespeed = 170<<(FRACBITS>>1); - movespeed += ((50*(mobj->info->spawnhealth-mobj->health))<<(FRACBITS>>1)); - if (mobj->movefactor) - movespeed /= 2; - if (mobj->movedir == 2) - mobj->movecount -= movespeed; - else - mobj->movecount += movespeed; - } - mobj->movecount %= 360*FRACUNIT; P_Boss4MoveSpikeballs(mobj, FixedAngle(mobj->movecount), mobj->movefactor); // Check for attacks, always tick the timer even while animating!! @@ -5013,12 +5043,10 @@ static void P_Boss4Thinker(mobj_t *mobj) if (mobj->health <= mobj->info->damage) { // Proceed to pinch phase! P_Boss4DestroyCage(mobj); - // spawn jet's flame now you're flying upwards - // tracer is already used, so if this ever gets reached again we've got problems - var1 = 3; - A_BossJetFume(mobj); mobj->movedir = 3; P_LinedefExecute(LE_PINCHPHASE + (mobj->spawnpoint ? mobj->spawnpoint->extrainfo*LE_PARAMWIDTH : 0), mobj, NULL); + var1 = 3; + A_BossJetFume(mobj); return; } @@ -8097,7 +8125,166 @@ void P_MobjThinker(mobj_t *mobj) P_UnsetThingPosition(mobj); mobj->x = mobj->target->x; mobj->y = mobj->target->y; - mobj->z = mobj->target->z - FixedMul(50*FRACUNIT, mobj->target->scale); + mobj->z = mobj->target->z - 50*mobj->target->scale; + mobj->floorz = mobj->z; + mobj->ceilingz = mobj->z+mobj->height; + P_SetThingPosition(mobj); + } + break; + case MT_EGGROBO1: +#define SPECTATORRADIUS (96*mobj->scale) + { + if (!(mobj->flags2 & MF2_STRONGBOX)) + { + mobj->cusval = mobj->x; // eat my SOCs, p_mobj.h warning, we have lua now + mobj->cvmem = mobj->y; // ditto + mobj->movedir = mobj->angle; + mobj->threshold = P_MobjFlip(mobj)*10*mobj->scale; + if (mobj->threshold < 0) + mobj->threshold += (mobj->ceilingz - mobj->height); + else + mobj->threshold += mobj->floorz; + var1 = 4; + A_BossJetFume(mobj); + mobj->flags2 |= MF2_STRONGBOX; + } + + if (mobj->state == &states[mobj->info->deathstate]) // todo: make map actually set health to 0 for these + { + if (mobj->movecount) + { + if (!(--mobj->movecount)) + S_StartSound(mobj, mobj->info->deathsound); + } + else + { + mobj->momz += P_MobjFlip(mobj)*mobj->scale; + if (mobj->momz > 0) + { + if (mobj->z + mobj->momz > mobj->ceilingz + (1000<z + mobj->height + mobj->momz < mobj->floorz - (1000<z = mobj->threshold + FixedMul(FINESINE(((leveltime + mobj->movecount)*ANG2>>(ANGLETOFINESHIFT-2)) & FINEMASK), 8*mobj->scale); + if (mobj->state != &states[mobj->info->meleestate]) + { + boolean didmove = false; + + if (mobj->state == &states[mobj->info->spawnstate]) + { + UINT8 i; + fixed_t dist = INT32_MAX; + + for (i = 0; i < MAXPLAYERS; i++) + { + fixed_t compdist; + if (!playeringame[i]) + continue; + if (players[i].spectator) + continue; + if (!players[i].mo) + continue; + if (!players[i].mo->health) + continue; + if (P_PlayerInPain(&players[i])) + continue; + if (players[i].mo->z > mobj->z + mobj->height + 8*mobj->scale) + continue; + if (players[i].mo->z + players[i].mo->height < mobj->z - 8*mobj->scale) + continue; + compdist = P_AproxDistance( + players[i].mo->x + players[i].mo->momx - mobj->cusval, + players[i].mo->y + players[i].mo->momy - mobj->cvmem); + if (compdist >= dist) + continue; + dist = compdist; + P_SetTarget(&mobj->target, players[i].mo); + } + + if (dist < (SPECTATORRADIUS<<1)) + { + didmove = true; + mobj->frame = 3 + ((leveltime & 2)>>1); + mobj->angle = R_PointToAngle2(mobj->x, mobj->y, mobj->target->x, mobj->target->y); + + if (P_AproxDistance( + mobj->x - mobj->cusval, + mobj->y - mobj->cvmem) + < mobj->scale) + S_StartSound(mobj, mobj->info->seesound); + + P_TeleportMove(mobj, + (15*(mobj->x>>4)) + (mobj->cusval>>4) + P_ReturnThrustX(mobj, mobj->angle, SPECTATORRADIUS>>4), + (15*(mobj->y>>4)) + (mobj->cvmem>>4) + P_ReturnThrustY(mobj, mobj->angle, SPECTATORRADIUS>>4), + mobj->z); + } + else + { + angle_t diff = (mobj->movedir - mobj->angle); + if (diff > ANGLE_180) + diff = InvAngle(InvAngle(diff)/8); + else + diff /= 8; + mobj->angle += diff; + + dist = FINECOSINE(((leveltime + mobj->movecount)*ANG2>>(ANGLETOFINESHIFT-2)) & FINEMASK); + + if (abs(dist) < FRACUNIT/2) + mobj->frame = 0; + else + mobj->frame = (dist > 0) ? 1 : 2; + } + } + + if (!didmove) + { + if (P_AproxDistance( + mobj->x - mobj->cusval, + mobj->y - mobj->cvmem) + < mobj->scale) + P_TeleportMove(mobj, + mobj->cusval, + mobj->cvmem, + mobj->z); + else + P_TeleportMove(mobj, + (15*(mobj->x>>4)) + (mobj->cusval>>4), + (15*(mobj->y>>4)) + (mobj->cvmem>>4), + mobj->z); + } + } + } + } + break; +#undef SPECTATORRADIUS + case MT_EGGROBO1JET: + { + if (!mobj->target || P_MobjWasRemoved(mobj->target) // if you have no target + || (mobj->target->health <= 0)) // or your target isn't a boss and it's popped now + { // then remove yourself as well! + P_RemoveMobj(mobj); + return; + } + + mobj->flags2 ^= MF2_DONTDRAW; + + P_UnsetThingPosition(mobj); + mobj->x = mobj->target->x + P_ReturnThrustX(mobj, mobj->target->angle+ANGLE_90, mobj->movefactor*mobj->target->scale) - P_ReturnThrustX(mobj, mobj->target->angle, 19*mobj->target->scale); + mobj->y = mobj->target->y + P_ReturnThrustY(mobj, mobj->target->angle+ANGLE_90, mobj->movefactor*mobj->target->scale) - P_ReturnThrustY(mobj, mobj->target->angle, 19*mobj->target->scale); + mobj->z = mobj->target->z; + if (mobj->target->eflags & MFE_VERTICALFLIP) + mobj->z += (mobj->target->height - mobj->height); mobj->floorz = mobj->z; mobj->ceilingz = mobj->z+mobj->height; P_SetThingPosition(mobj); @@ -9300,6 +9487,9 @@ mobj_t *P_SpawnMobj(fixed_t x, fixed_t y, fixed_t z, mobjtype_t type) case MT_BALLOON: mobj->color = SKINCOLOR_RED; break; + case MT_EGGROBO1: + mobj->movecount = P_RandomKey(13); + mobj->color = SKINCOLOR_RUBY + P_RandomKey(MAXSKINCOLORS - SKINCOLOR_RUBY); case MT_HIVEELEMENTAL: mobj->extravalue1 = 5; break; @@ -10126,7 +10316,7 @@ void P_MovePlayerToSpawn(INT32 playernum, mapthing_t *mthing) { x = mthing->x << FRACBITS; y = mthing->y << FRACBITS; - angle = FixedAngle(mthing->angle*FRACUNIT); + angle = FixedAngle(mthing->angle<pflags & PF_SLIDING) && player->mo->state == &states[player->mo->info->painstate] && player->powers[pw_flashing]) return true; + if (player->mo->state == &states[S_PLAY_STUN]) + return true; + return false; } diff --git a/src/sounds.c b/src/sounds.c index 56de4a9c5..de043493a 100644 --- a/src/sounds.c +++ b/src/sounds.c @@ -197,6 +197,7 @@ sfxinfo_t S_sfx[NUMSFX] = {"corkh", false, 32, 0, -1, NULL, 0, -1, -1, LUMPERROR, "Cork hit"}, {"bowl", false, 32, 0, -1, NULL, 0, -1, -1, LUMPERROR, "Bowling"}, {"chuchu", false, 32, 0, -1, NULL, 0, -1, -1, LUMPERROR, "Train horn"}, + {"bsnipe", false, 200, 0, -1, NULL, 0, -1, -1, LUMPERROR, "Home-run smash"}, // Menu, interface {"chchng", false, 120, 0, -1, NULL, 0, -1, -1, LUMPERROR, "Score"}, @@ -334,7 +335,7 @@ sfxinfo_t S_sfx[NUMSFX] = {"s3k5d", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR, "Heavy hit"}, {"s3k5e", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR, "Firing laser"}, {"s3k5f", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR, "Crusher stomp"}, - {"s3k60", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR, "Flying away"}, + {"s3k60", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR, "Accelerating"}, {"s3k61", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR, "Drilling"}, {"s3k62", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR, "Jump"}, {"s3k63", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR, "Starpost"}, @@ -430,8 +431,8 @@ sfxinfo_t S_sfx[NUMSFX] = {"s3kbcl", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR, ""}, // long version of previous {"s3kbds", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR, "Flying fortress"}, {"s3kbdl", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR, "Flying fortress"}, // ditto - {"s3kbes", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR, "Flying away"}, - {"s3kbel", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR, "Flying away"}, // ditto + {"s3kbes", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR, "Flying"}, + {"s3kbel", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR, "Flying"}, // ditto {"s3kbfs", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR, "Turbine"}, {"s3kbfl", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR, "Turbine"}, // ditto {"s3kc0s", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR, "Turbine"}, diff --git a/src/sounds.h b/src/sounds.h index 475309121..a9f28ffb2 100644 --- a/src/sounds.h +++ b/src/sounds.h @@ -263,6 +263,7 @@ typedef enum sfx_corkh, sfx_bowl, sfx_chuchu, + sfx_bsnipe, // Menu, interface sfx_chchng,