From 4a1f0ce91c658608cd0682a60d9d2385d0cb1c1a Mon Sep 17 00:00:00 2001 From: Yukita Mayako Date: Wed, 27 May 2015 05:24:31 -0400 Subject: [PATCH 001/172] New attract shield active Homing attack when activating the attract shield while jumping. --- src/dehacked.c | 1 + src/info.c | 3 ++- src/info.h | 1 + src/lua_baselib.c | 3 ++- src/p_local.h | 2 +- src/p_mobj.c | 7 ++++++- src/p_user.c | 41 +++++++++++++++++++++++++++++++++++------ 7 files changed, 48 insertions(+), 10 deletions(-) diff --git a/src/dehacked.c b/src/dehacked.c index 227c48b69..31fb571c1 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -5375,6 +5375,7 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit "S_MAGN10", "S_MAGN11", "S_MAGN12", + "S_MAGN13", "S_FORC1", "S_FORC2", diff --git a/src/info.c b/src/info.c index 775996092..58a652f82 100644 --- a/src/info.c +++ b/src/info.c @@ -1757,6 +1757,7 @@ state_t states[NUMSTATES] = {SPR_MAGN, FF_FULLBRIGHT|FF_TRANS40| 9, 2, {NULL}, 0, 0, S_MAGN11}, // S_MAGN10 {SPR_MAGN, FF_FULLBRIGHT|FF_TRANS40|10, 2, {NULL}, 0, 0, S_MAGN12}, // S_MAGN11 {SPR_MAGN, FF_FULLBRIGHT|FF_TRANS40|11, 2, {NULL}, 0, 0, S_MAGN1 }, // S_MAGN12 + {SPR_MAGN, FF_FULLBRIGHT|FF_TRANS10|12, 2, {NULL}, 0, 0, S_MAGN1 }, // S_MAGN13 {SPR_FORC, FF_TRANS50 , 3, {NULL}, 0, 0, S_FORC2 }, // S_FORC1 {SPR_FORC, FF_TRANS50|1, 3, {NULL}, 0, 0, S_FORC3 }, // S_FORC2 @@ -10365,7 +10366,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = sfx_None, // seesound 8, // reactiontime sfx_None, // attacksound - S_NULL, // painstate + S_MAGN13, // painstate SKINCOLOR_NONE, // painchance sfx_None, // painsound S_NULL, // meleestate diff --git a/src/info.h b/src/info.h index 44a3dd012..a6d5dbd3f 100644 --- a/src/info.h +++ b/src/info.h @@ -2262,6 +2262,7 @@ typedef enum state S_MAGN10, S_MAGN11, S_MAGN12, + S_MAGN13, S_FORC1, S_FORC2, diff --git a/src/lua_baselib.c b/src/lua_baselib.c index 9b0a34f17..9c09e726e 100644 --- a/src/lua_baselib.c +++ b/src/lua_baselib.c @@ -791,10 +791,11 @@ static int lib_pReturnThrustY(lua_State *L) static int lib_pLookForEnemies(lua_State *L) { player_t *player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER)); + boolean nonenemies = lua_opttrueboolean(L, 2); NOHUD if (!player) return LUA_ErrInvalid(L, "player_t"); - lua_pushboolean(L, P_LookForEnemies(player)); + lua_pushboolean(L, P_LookForEnemies(player, nonenemies)); return 1; } diff --git a/src/p_local.h b/src/p_local.h index 1e0a9e2eb..db10cdb1c 100644 --- a/src/p_local.h +++ b/src/p_local.h @@ -164,7 +164,7 @@ fixed_t P_ReturnThrustX(mobj_t *mo, angle_t angle, fixed_t move); fixed_t P_ReturnThrustY(mobj_t *mo, angle_t angle, fixed_t move); void P_InstaThrustEvenIn2D(mobj_t *mo, angle_t angle, fixed_t move); -boolean P_LookForEnemies(player_t *player); +boolean P_LookForEnemies(player_t *player, boolean nonenemies); void P_NukeEnemies(mobj_t *inflictor, mobj_t *source, fixed_t radius); void P_HomingAttack(mobj_t *source, mobj_t *enemy); /// \todo doesn't belong in p_user boolean P_SuperReady(player_t *player); diff --git a/src/p_mobj.c b/src/p_mobj.c index 9565648c2..b79350092 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -5608,12 +5608,17 @@ void P_MobjThinker(mobj_t *mobj) case MT_BLACKORB: case MT_WHITEORB: case MT_GREENORB: - case MT_YELLOWORB: case MT_BLUEORB: case MT_PITYORB: if (!P_AddShield(mobj)) return; break; + case MT_YELLOWORB: + if (!P_AddShield(mobj)) + return; + if (mobj->target->player->homing) + P_SetMobjState(mobj, mobj->info->painstate); + break; case MT_WATERDROP: P_SceneryCheckWater(mobj); if ((mobj->z <= mobj->floorz || mobj->z <= mobj->watertop) diff --git a/src/p_user.c b/src/p_user.c index 32dc8733f..ad0b7b76a 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -3971,7 +3971,7 @@ static void P_DoJumpStuff(player_t *player, ticcmd_t *cmd) if (player->charability == CA_HOMINGTHOK && !player->homing) { - if (P_LookForEnemies(player)) + if (P_LookForEnemies(player, true)) { if (player->mo->tracer) player->homing = 3*TICRATE; @@ -6792,6 +6792,17 @@ static void P_MovePlayer(player_t *player) if (!(player->powers[pw_super] || player->powers[pw_invulnerability])) P_BlackOw(player); } + // Attract shield activation + if ((player->powers[pw_shield] & SH_NOSTACK) == SH_ATTRACT) + { + if (!(player->pflags & PF_THOKKED)) + { + player->pflags |= PF_THOKKED; + player->homing = 2; + if (P_LookForEnemies(player, false) && player->mo->tracer) + player->homing = 3*TICRATE; + } + } } // Super Sonic move if (player->charflags & SF_SUPER && player->powers[pw_super] && player->speed > FixedMul(5<mo->scale) @@ -6807,8 +6818,20 @@ static void P_MovePlayer(player_t *player) } } + if ((player->powers[pw_shield] & SH_NOSTACK) == SH_ATTRACT) + { + if (player->homing && player->mo->tracer) + { + if (!(player->pflags & PF_JUMPED) + || player->mo->tracer->health <= 0 + || player->mo->tracer->flags2 & MF2_FRET) + player->homing = 0; + else + P_HomingAttack(player->mo, player->mo->tracer); + } + } // HOMING option. - if (player->charability == CA_HOMINGTHOK) + else if (player->charability == CA_HOMINGTHOK) { // If you've got a target, chase after it! if (player->homing && player->mo->tracer) @@ -7410,9 +7433,9 @@ void P_NukeEnemies(mobj_t *inflictor, mobj_t *source, fixed_t radius) // // P_LookForEnemies // Looks for something you can hit - Used for homing attack -// Includes monitors and springs! +// If nonenemies is true, includes monitors and springs! // -boolean P_LookForEnemies(player_t *player) +boolean P_LookForEnemies(player_t *player, boolean nonenemies) { mobj_t *mo; thinker_t *think; @@ -7425,7 +7448,8 @@ boolean P_LookForEnemies(player_t *player) continue; // not a mobj thinker mo = (mobj_t *)think; - if (!(mo->flags & (MF_ENEMY|MF_BOSS|MF_MONITOR|MF_SPRING))) + if ((nonenemies && !(mo->flags & (MF_ENEMY|MF_BOSS|MF_MONITOR|MF_SPRING))) + || (!nonenemies && !(mo->flags & (MF_ENEMY|MF_BOSS)))) continue; // not a valid enemy if (mo->health <= 0) // dead @@ -7524,7 +7548,12 @@ void P_HomingAttack(mobj_t *source, mobj_t *enemy) // Home in on your target ns = FixedMul(source->info->speed, source->scale); } else if (source->player) - ns = FixedDiv(FixedMul(source->player->actionspd, source->scale), 3*FRACUNIT/2); + { + if (source->player->charability == CA_HOMINGTHOK) + ns = FixedDiv(FixedMul(source->player->actionspd, source->scale), 3*FRACUNIT/2); + else //if ((player->powers[pw_shield] & SH_NOSTACK) == SH_ATTRACT) + ns = FixedMul(80*FRACUNIT, source->scale); + } source->momx = FixedMul(FixedDiv(enemy->x - source->x, dist), ns); source->momy = FixedMul(FixedDiv(enemy->y - source->y, dist), ns); From 65f2d4b80f857d25aab7961968c6fdfa1c8d3cd4 Mon Sep 17 00:00:00 2001 From: Yukita Mayako Date: Wed, 27 May 2015 05:59:42 -0400 Subject: [PATCH 002/172] Add PF_SHIELDABILITY This flag is used as a distinction between the character ability CA_HOMINGTHOK and the attract shield's active ability. --- src/d_player.h | 3 +-- src/p_map.c | 4 ++-- src/p_mobj.c | 2 +- src/p_user.c | 30 ++++++++++-------------------- 4 files changed, 14 insertions(+), 25 deletions(-) diff --git a/src/d_player.h b/src/d_player.h index b9fcdef75..5ef19c9ac 100644 --- a/src/d_player.h +++ b/src/d_player.h @@ -152,8 +152,7 @@ typedef enum /*** misc ***/ PF_FORCESTRAFE = 1<<29, // Turning inputs are translated into strafing inputs PF_ANALOGMODE = 1<<30, // Analog mode? - - // free: 1<<30 and 1<<31 + PF_SHIELDABILITY = 1<<31 // Thokked with shield ability } pflags_t; typedef enum diff --git a/src/p_map.c b/src/p_map.c index 46e32e385..ab2b1662c 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -121,7 +121,7 @@ void P_DoSpring(mobj_t *spring, mobj_t *object) /*Someone want to make these work like bumpers?*/ return; } - + object->eflags |= MFE_SPRUNG; // apply this flag asap! spring->flags &= ~(MF_SOLID|MF_SPECIAL); // De-solidify @@ -188,7 +188,7 @@ void P_DoSpring(mobj_t *spring, mobj_t *object) localangle2 = spring->angle; } - pflags = object->player->pflags & (PF_JUMPED|PF_SPINNING|PF_THOKKED); // I still need these. + pflags = object->player->pflags & (PF_JUMPED|PF_SPINNING|PF_THOKKED|PF_SHIELDABILITY); // I still need these. P_ResetPlayer(object->player); if (P_MobjFlip(object)*vertispeed > 0) diff --git a/src/p_mobj.c b/src/p_mobj.c index b79350092..26ff7b92b 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -2183,7 +2183,7 @@ static void P_PlayerZMovement(mobj_t *mo) if (!(mo->player->pflags & PF_GLIDING)) mo->player->pflags &= ~PF_JUMPED; - mo->player->pflags &= ~PF_THOKKED; + mo->player->pflags &= ~(PF_THOKKED|PF_SHIELDABILITY); //mo->player->pflags &= ~PF_GLIDING; mo->player->jumping = 0; mo->player->secondjump = 0; diff --git a/src/p_user.c b/src/p_user.c index ad0b7b76a..089c0dc9b 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -661,7 +661,7 @@ void P_NightserizePlayer(player_t *player, INT32 nighttime) player->mo->height = player->mo->tracer->height; } - player->pflags &= ~(PF_USEDOWN|PF_JUMPDOWN|PF_ATTACKDOWN|PF_STARTDASH|PF_GLIDING|PF_JUMPED|PF_THOKKED|PF_SPINNING|PF_DRILLING); + player->pflags &= ~(PF_USEDOWN|PF_JUMPDOWN|PF_ATTACKDOWN|PF_STARTDASH|PF_GLIDING|PF_JUMPED|PF_THOKKED|PF_SHIELDABILITY|PF_SPINNING|PF_DRILLING); player->homing = 0; player->mo->fuse = 0; player->speed = 0; @@ -874,7 +874,7 @@ void P_DoPlayerPain(player_t *player, mobj_t *source, mobj_t *inflictor) // Useful when you want to kill everything the player is doing. void P_ResetPlayer(player_t *player) { - player->pflags &= ~(PF_ROPEHANG|PF_ITEMHANG|PF_MACESPIN|PF_SPINNING|PF_JUMPED|PF_GLIDING|PF_THOKKED|PF_CARRIED); + player->pflags &= ~(PF_ROPEHANG|PF_ITEMHANG|PF_MACESPIN|PF_SPINNING|PF_JUMPED|PF_GLIDING|PF_THOKKED|PF_SHIELDABILITY|PF_CARRIED); player->jumping = 0; player->secondjump = 0; player->glidetime = 0; @@ -6797,7 +6797,7 @@ static void P_MovePlayer(player_t *player) { if (!(player->pflags & PF_THOKKED)) { - player->pflags |= PF_THOKKED; + player->pflags |= PF_THOKKED|PF_SHIELDABILITY; player->homing = 2; if (P_LookForEnemies(player, false) && player->mo->tracer) player->homing = 3*TICRATE; @@ -6818,25 +6818,15 @@ static void P_MovePlayer(player_t *player) } } - if ((player->powers[pw_shield] & SH_NOSTACK) == SH_ATTRACT) - { - if (player->homing && player->mo->tracer) - { - if (!(player->pflags & PF_JUMPED) - || player->mo->tracer->health <= 0 - || player->mo->tracer->flags2 & MF2_FRET) - player->homing = 0; - else - P_HomingAttack(player->mo, player->mo->tracer); - } - } // HOMING option. - else if (player->charability == CA_HOMINGTHOK) + if (player->charability == CA_HOMINGTHOK + || (player->powers[pw_shield] & SH_NOSTACK) == SH_ATTRACT) { // If you've got a target, chase after it! if (player->homing && player->mo->tracer) { - P_SpawnThokMobj(player); + if (!(player->pflags & PF_SHIELDABILITY)) + P_SpawnThokMobj(player); P_HomingAttack(player->mo, player->mo->tracer); // But if you don't, then stop homing. @@ -6852,7 +6842,7 @@ static void P_MovePlayer(player_t *player) if (player->mo->tracer->flags2 & MF2_FRET) P_InstaThrust(player->mo, player->mo->angle, -(player->speed>>3)); - if (!(player->mo->tracer->flags & MF_BOSS)) + if (!(player->pflags & PF_SHIELDABILITY) && !(player->mo->tracer->flags & MF_BOSS)) player->pflags &= ~PF_THOKKED; } } @@ -7549,9 +7539,9 @@ void P_HomingAttack(mobj_t *source, mobj_t *enemy) // Home in on your target } else if (source->player) { - if (source->player->charability == CA_HOMINGTHOK) + if (source->player->charability == CA_HOMINGTHOK && !(source->player->pflags & PF_SHIELDABILITY)) ns = FixedDiv(FixedMul(source->player->actionspd, source->scale), 3*FRACUNIT/2); - else //if ((player->powers[pw_shield] & SH_NOSTACK) == SH_ATTRACT) + else ns = FixedMul(80*FRACUNIT, source->scale); } From 18920e486d1de6c43716d80b469171ab85df0d94 Mon Sep 17 00:00:00 2001 From: Yukita Mayako Date: Wed, 27 May 2015 06:07:38 -0400 Subject: [PATCH 003/172] Add sfx to Attract shield dash. Because it seemed really weird for a sudden shift of momentum to be unaccompanied. --- src/p_user.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/p_user.c b/src/p_user.c index 089c0dc9b..dcb05e8ee 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -6799,6 +6799,7 @@ static void P_MovePlayer(player_t *player) { player->pflags |= PF_THOKKED|PF_SHIELDABILITY; player->homing = 2; + S_StartSound(player->mo, sfx_spdpad); if (P_LookForEnemies(player, false) && player->mo->tracer) player->homing = 3*TICRATE; } From ecd867ab3552ad310f0edd0d006e3c14ec514f29 Mon Sep 17 00:00:00 2001 From: Yukita Mayako Date: Wed, 27 May 2015 21:08:30 -0400 Subject: [PATCH 004/172] Change A_BombShield to add P_BlackOw. Now when you obtain an Armageddon Shield, and you already HAVE one, the first one explodes _while_ applying the second. --- src/p_enemy.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/p_enemy.c b/src/p_enemy.c index ef9ff5dda..7d94e105d 100644 --- a/src/p_enemy.c +++ b/src/p_enemy.c @@ -3200,12 +3200,13 @@ void A_BombShield(mobj_t *actor) player = actor->target->player; - if ((player->powers[pw_shield] & SH_NOSTACK) != SH_BOMB) - { - player->powers[pw_shield] = SH_BOMB|(player->powers[pw_shield] & SH_STACK); - P_SpawnShieldOrb(player); - } + // If you already have a bomb shield, use it! + if ((player->powers[pw_shield] & SH_NOSTACK) == SH_BOMB) + P_BlackOw(player); + // Now we know for certain that we don't have a bomb shield, so add one. :3 + player->powers[pw_shield] = SH_BOMB|(player->powers[pw_shield] & SH_STACK); + P_SpawnShieldOrb(player); S_StartSound(player->mo, actor->info->seesound); } From 8a1411b1222eddeaf1a6a4493351de040ffb2e55 Mon Sep 17 00:00:00 2001 From: Yukita Mayako Date: Wed, 27 May 2015 22:06:27 -0400 Subject: [PATCH 005/172] Attraction homing tweaks. Lower homing speed. Retain velocity after hitting your target. --- src/p_user.c | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/src/p_user.c b/src/p_user.c index dcb05e8ee..6206b5d4c 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -6820,8 +6820,21 @@ static void P_MovePlayer(player_t *player) } // HOMING option. - if (player->charability == CA_HOMINGTHOK - || (player->powers[pw_shield] & SH_NOSTACK) == SH_ATTRACT) + if ((player->powers[pw_shield] & SH_NOSTACK) == SH_ATTRACT + && player->pflags & PF_SHIELDABILITY) + { + if (player->homing && player->mo->tracer) + { + P_HomingAttack(player->mo, player->mo->tracer); + if (player->mo->tracer->health <= 0 || (player->mo->tracer->flags2 & MF2_FRET)) + player->homing = 0; + } + + // If you're not jumping, then you obviously wouldn't be homing. + if (!(player->pflags & PF_JUMPED)) + player->homing = 0; + } + else if (player->charability == CA_HOMINGTHOK) { // If you've got a target, chase after it! if (player->homing && player->mo->tracer) @@ -7543,7 +7556,7 @@ void P_HomingAttack(mobj_t *source, mobj_t *enemy) // Home in on your target if (source->player->charability == CA_HOMINGTHOK && !(source->player->pflags & PF_SHIELDABILITY)) ns = FixedDiv(FixedMul(source->player->actionspd, source->scale), 3*FRACUNIT/2); else - ns = FixedMul(80*FRACUNIT, source->scale); + ns = FixedMul(45*FRACUNIT, source->scale); } source->momx = FixedMul(FixedDiv(enemy->x - source->x, dist), ns); From 406d809bc2d05048f374bf2a4602f302c5275159 Mon Sep 17 00:00:00 2001 From: Yukita Mayako Date: Wed, 27 May 2015 22:57:11 -0400 Subject: [PATCH 006/172] Change attract homing thok to negate Z. Do not keep Z momentum from homing. It is a bad idea. --- src/p_user.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/p_user.c b/src/p_user.c index 6206b5d4c..ea4d83938 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -6827,7 +6827,12 @@ static void P_MovePlayer(player_t *player) { P_HomingAttack(player->mo, player->mo->tracer); if (player->mo->tracer->health <= 0 || (player->mo->tracer->flags2 & MF2_FRET)) + { + P_SetObjectMomZ(player->mo, 6*FRACUNIT, false); + if (player->mo->eflags & MFE_UNDERWATER) + player->mo->momz = FixedMul(player->mo->momz, FRACUNIT/3); player->homing = 0; + } } // If you're not jumping, then you obviously wouldn't be homing. @@ -6839,8 +6844,7 @@ static void P_MovePlayer(player_t *player) // If you've got a target, chase after it! if (player->homing && player->mo->tracer) { - if (!(player->pflags & PF_SHIELDABILITY)) - P_SpawnThokMobj(player); + P_SpawnThokMobj(player); P_HomingAttack(player->mo, player->mo->tracer); // But if you don't, then stop homing. @@ -6856,7 +6860,7 @@ static void P_MovePlayer(player_t *player) if (player->mo->tracer->flags2 & MF2_FRET) P_InstaThrust(player->mo, player->mo->angle, -(player->speed>>3)); - if (!(player->pflags & PF_SHIELDABILITY) && !(player->mo->tracer->flags & MF_BOSS)) + if (!(player->mo->tracer->flags & MF_BOSS)) player->pflags &= ~PF_THOKKED; } } From 2d141739680dbc7802269596f89a3bb1590a663e Mon Sep 17 00:00:00 2001 From: Yukita Mayako Date: Fri, 29 May 2015 02:35:24 -0400 Subject: [PATCH 007/172] Allow spin button Jump Shield normally. If you walk off a cliff with a jump shield, you can now press EITHER the jump or spin buttons to activate it and double jump. --- src/p_user.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/p_user.c b/src/p_user.c index ea4d83938..613fbe68d 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -3832,11 +3832,13 @@ static void P_DoJumpStuff(player_t *player, ticcmd_t *cmd) if (cmd->buttons & BT_USE && !(player->pflags & PF_JUMPDOWN) && !player->exiting && !P_PlayerInPain(player)) { - if (onground || player->climbing || player->pflags & (PF_CARRIED|PF_ITEMHANG|PF_ROPEHANG)) - {} - else if (player->pflags & PF_MACESPIN && player->mo->tracer) - {} - else if (!(player->pflags & PF_SLIDING) && ((gametype != GT_CTF) || (!player->gotflag))) + if (onground || player->climbing || player->pflags & (PF_CARRIED|PF_ITEMHANG|PF_ROPEHANG|PF_SLIDING) + || (player->pflags & PF_MACESPIN && player->mo->tracer)) + ; + else if ((player->powers[pw_shield] & SH_NOSTACK) == SH_JUMP + && !(player->pflags & PF_JUMPED)) + P_DoJumpShield(player); + else if (gametype != GT_CTF || !player->gotflag) { #ifdef HAVE_BLUA if (!LUAh_JumpSpinSpecial(player)) From 99066429de332494f76d6da177a5793840f225ee Mon Sep 17 00:00:00 2001 From: Yukita Mayako Date: Fri, 29 May 2015 15:47:54 -0400 Subject: [PATCH 008/172] Add PF_SHIELDABILITY to dehacked. --- src/dehacked.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/dehacked.c b/src/dehacked.c index 31fb571c1..7b6606b5d 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -7267,6 +7267,7 @@ static const char *const PLAYERFLAG_LIST[] = { /*** misc ***/ "FORCESTRAFE", // Translate turn inputs into strafe inputs "ANALOGMODE", // Analog mode? + "SHIELDABILITY", // Thokked with shield ability NULL // stop loop here. }; From f8dd9b64abfa69a4af52bfe3923204b07b68f2c7 Mon Sep 17 00:00:00 2001 From: toasterbabe Date: Fri, 8 Jul 2016 21:55:17 +0100 Subject: [PATCH 009/172] Elemental shield ability now coded. REQUIRES NEW PATCH.DTA FROM THE FTP. - Press spin in midair to stomp directly downwards (losing horizontal momentum), creating a flickering fireball around you. - No bouncing on enemies, item boxes, etc - just go straight through. - Hurts other players on touch whilst you're stomping. - Spawns a bunch of flames around you when you hit the ground. Also: - Electric shield's ability now uses different sounds, because I'm picky. --- src/dehacked.c | 14 ++++++- src/info.c | 75 +++++++++++++++++++++++++--------- src/info.h | 15 ++++++- src/lua_baselib.c | 3 +- src/p_inter.c | 12 ++++-- src/p_local.h | 2 +- src/p_map.c | 8 ++-- src/p_mobj.c | 22 ++++++++++ src/p_user.c | 100 ++++++++++++++++++++++++++++++++-------------- 9 files changed, 191 insertions(+), 60 deletions(-) diff --git a/src/dehacked.c b/src/dehacked.c index f5d3b55cb..1afa5f0cf 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -4782,7 +4782,8 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit "S_SPIKEBALL7", "S_SPIKEBALL8", - // Fire Shield's Spawn + // Elemental Shield's Spawn + "S_SPINFIRE0", "S_SPINFIRE1", "S_SPINFIRE2", "S_SPINFIRE3", @@ -4790,6 +4791,15 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit "S_SPINFIRE5", "S_SPINFIRE6", + // Elemental Shield's FLYING Spawn + "S_AIRSPINFIRE_FLY1", + "S_AIRSPINFIRE_FLY2", + "S_AIRSPINFIRE_FLY3", + "S_AIRSPINFIRE_FLY4", + "S_AIRSPINFIRE_FLY5", + "S_AIRSPINFIRE_FLY6", + "S_AIRSPINFIRE_DIE", + // Spikes "S_SPIKE1", "S_SPIKE2", @@ -5399,6 +5409,8 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit "S_ELEMF6", "S_ELEMF7", "S_ELEMF8", + "S_ELEMF9", + "S_ELEMF10", "S_PITY1", "S_PITY2", diff --git a/src/info.c b/src/info.c index 5e6528c01..f946e72e8 100644 --- a/src/info.c +++ b/src/info.c @@ -1123,13 +1123,23 @@ state_t states[NUMSTATES] = {SPR_SPIK, 6, 1, {A_RotateSpikeBall}, 0, 0, S_SPIKEBALL8}, // S_SPIKEBALL7 {SPR_SPIK, 7, 1, {A_RotateSpikeBall}, 0, 0, S_SPIKEBALL1}, // S_SPIKEBALL8 - // Red Shield's Spawn - {SPR_SFLM, FF_FULLBRIGHT, 2, {NULL}, 0, 0, S_SPINFIRE2}, // S_SPINFIRE1 - {SPR_SFLM, FF_FULLBRIGHT|1, 2, {NULL}, 0, 0, S_SPINFIRE3}, // S_SPINFIRE2 - {SPR_SFLM, FF_FULLBRIGHT|2, 2, {NULL}, 0, 0, S_SPINFIRE4}, // S_SPINFIRE3 - {SPR_SFLM, FF_FULLBRIGHT|3, 2, {NULL}, 0, 0, S_SPINFIRE5}, // S_SPINFIRE4 - {SPR_SFLM, FF_FULLBRIGHT|4, 2, {NULL}, 0, 0, S_SPINFIRE6}, // S_SPINFIRE5 - {SPR_SFLM, FF_FULLBRIGHT|5, 2, {NULL}, 0, 0, S_SPINFIRE1}, // S_SPINFIRE6 + // Elemental Shield's Spawn + {SPR_SFLM, FF_FULLBRIGHT|5, 2, {A_SetFuse}, 6*TICRATE, 0, S_SPINFIRE1}, // S_SPINFIRE0 + {SPR_SFLM, FF_FULLBRIGHT, 2, {NULL}, 0, 0, S_SPINFIRE2}, // S_SPINFIRE1 + {SPR_SFLM, FF_FULLBRIGHT|1, 2, {NULL}, 0, 0, S_SPINFIRE3}, // S_SPINFIRE2 + {SPR_SFLM, FF_FULLBRIGHT|2, 2, {NULL}, 0, 0, S_SPINFIRE4}, // S_SPINFIRE3 + {SPR_SFLM, FF_FULLBRIGHT|3, 2, {NULL}, 0, 0, S_SPINFIRE5}, // S_SPINFIRE4 + {SPR_SFLM, FF_FULLBRIGHT|4, 2, {NULL}, 0, 0, S_SPINFIRE6}, // S_SPINFIRE5 + {SPR_SFLM, FF_FULLBRIGHT|5, 2, {NULL}, 0, 0, S_SPINFIRE1}, // S_SPINFIRE6 + + // Elemental Shield's FLYING Spawn + {SPR_SFLM, FF_FULLBRIGHT, 2, {NULL}, 0, 0, S_AIRSPINFIRE_FLY2}, //S_AIRSPINFIRE_FLY1, + {SPR_SFLM, FF_FULLBRIGHT|1, 2, {NULL}, 0, 0, S_AIRSPINFIRE_FLY3}, //S_AIRSPINFIRE_FLY2, + {SPR_SFLM, FF_FULLBRIGHT|2, 2, {NULL}, 0, 0, S_AIRSPINFIRE_FLY4}, //S_AIRSPINFIRE_FLY3, + {SPR_SFLM, FF_FULLBRIGHT|3, 2, {NULL}, 0, 0, S_AIRSPINFIRE_FLY5}, //S_AIRSPINFIRE_FLY4, + {SPR_SFLM, FF_FULLBRIGHT|4, 2, {NULL}, 0, 0, S_AIRSPINFIRE_FLY6}, //S_AIRSPINFIRE_FLY5, + {SPR_SFLM, FF_FULLBRIGHT|5, 2, {NULL}, 0, 0, S_AIRSPINFIRE_FLY1}, //S_AIRSPINFIRE_FLY6, + {SPR_SFLM, FF_FULLBRIGHT, 0, {A_SpawnObjectRelative}, 0, MT_SPINFIRE, S_NULL}, //S_AIRSPINFIRE_DIE, // Floor Spike {SPR_USPK, 0,-1, {A_SpikeRetract}, 1, 0, S_SPIKE2}, // S_SPIKE1 -- Fully extended @@ -1742,14 +1752,16 @@ state_t states[NUMSTATES] = {SPR_ELEM, FF_TRANS50|10, 4, {NULL}, 0, 0, S_ELEM12}, // S_ELEM11 {SPR_ELEM, FF_TRANS50|11, 4, {NULL}, 0, 0, S_ELEM1 }, // S_ELEM12 - {SPR_ELEM, FF_FULLBRIGHT|12, 3, {NULL}, 0, 0, S_ELEMF2}, // S_ELEMF1 - {SPR_ELEM, FF_FULLBRIGHT|13, 3, {NULL}, 0, 0, S_ELEMF3}, // S_ELEMF2 - {SPR_ELEM, FF_FULLBRIGHT|14, 3, {NULL}, 0, 0, S_ELEMF4}, // S_ELEMF3 - {SPR_ELEM, FF_FULLBRIGHT|15, 3, {NULL}, 0, 0, S_ELEMF5}, // S_ELEMF4 - {SPR_ELEM, FF_FULLBRIGHT|16, 3, {NULL}, 0, 0, S_ELEMF6}, // S_ELEMF5 - {SPR_ELEM, FF_FULLBRIGHT|17, 3, {NULL}, 0, 0, S_ELEMF7}, // S_ELEMF6 - {SPR_ELEM, FF_FULLBRIGHT|18, 3, {NULL}, 0, 0, S_ELEMF8}, // S_ELEMF7 - {SPR_ELEM, FF_FULLBRIGHT|19, 3, {NULL}, 0, 0, S_ELEMF1}, // S_ELEMF8 + {SPR_ELEM, FF_FULLBRIGHT|12, 3, {NULL}, 0, 0, S_ELEMF2 }, // S_ELEMF1 + {SPR_ELEM, FF_FULLBRIGHT|13, 3, {NULL}, 0, 0, S_ELEMF3 }, // S_ELEMF2 + {SPR_ELEM, FF_FULLBRIGHT|14, 3, {NULL}, 0, 0, S_ELEMF4 }, // S_ELEMF3 + {SPR_ELEM, FF_FULLBRIGHT|15, 3, {NULL}, 0, 0, S_ELEMF5 }, // S_ELEMF4 + {SPR_ELEM, FF_FULLBRIGHT|16, 3, {NULL}, 0, 0, S_ELEMF6 }, // S_ELEMF5 + {SPR_ELEM, FF_FULLBRIGHT|17, 3, {NULL}, 0, 0, S_ELEMF7 }, // S_ELEMF6 + {SPR_ELEM, FF_FULLBRIGHT|18, 3, {NULL}, 0, 0, S_ELEMF8 }, // S_ELEMF7 + {SPR_ELEM, FF_FULLBRIGHT|19, 3, {NULL}, 0, 0, S_ELEMF1 }, // S_ELEMF8 + {SPR_ELEM, FF_FULLBRIGHT|20, 1, {NULL}, 0, 0, S_ELEMF10}, // S_ELEMF9 + {SPR_NULL, 0, 1, {NULL}, 0, 0, S_ELEMF1 }, // S_ELEMF10 {SPR_PITY, FF_TRANS20 , 1, {NULL}, 0, 0, S_PITY2 }, // S_PITY1 {SPR_PITY, FF_TRANS20|1, 1, {NULL}, 0, 0, S_PITY3 }, // S_PITY2 @@ -5392,7 +5404,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = { // MT_SPINFIRE -1, // doomednum - S_SPINFIRE1, // spawnstate + S_SPINFIRE0, // spawnstate 1, // spawnhealth S_NULL, // seestate sfx_None, // seesound @@ -5413,7 +5425,34 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = 100, // mass 1, // damage sfx_None, // activesound - MF_NOBLOCKMAP|MF_MISSILE|MF_NOGRAVITY|MF_FIRE, // flags + MF_NOBLOCKMAP|MF_MISSILE|MF_NOGRAVITY|MF_FIRE|MF_RUNSPAWNFUNC, // flags + S_NULL // raisestate + }, + + { // MT_AIRSPINFIRE + -1, // doomednum + S_AIRSPINFIRE_FLY1, // 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_AIRSPINFIRE_DIE, // deathstate + S_NULL, // xdeathstate + sfx_None, // deathsound + 10*FRACUNIT, // speed + 8*FRACUNIT, // radius + 14*FRACUNIT, // height + 0, // display offset + 100, // mass + 1, // damage + sfx_None, // activesound + MF_NOBLOCKMAP|MF_MISSILE|MF_FIRE, // flags S_NULL // raisestate }, @@ -9833,7 +9872,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = sfx_None, // seesound 0, // reactiontime sfx_None, // attacksound - S_NULL, // painstate + S_ELEMF9, // painstate SKINCOLOR_NONE, // painchance sfx_None, // painsound S_NULL, // meleestate diff --git a/src/info.h b/src/info.h index f49a56baa..8a56ef77e 100644 --- a/src/info.h +++ b/src/info.h @@ -1633,7 +1633,8 @@ typedef enum state S_SPIKEBALL7, S_SPIKEBALL8, - // Fire Shield's Spawn + // Elemental Shield's Spawn + S_SPINFIRE0, S_SPINFIRE1, S_SPINFIRE2, S_SPINFIRE3, @@ -1641,6 +1642,15 @@ typedef enum state S_SPINFIRE5, S_SPINFIRE6, + // Elemental Shield's FLYING Spawn + S_AIRSPINFIRE_FLY1, + S_AIRSPINFIRE_FLY2, + S_AIRSPINFIRE_FLY3, + S_AIRSPINFIRE_FLY4, + S_AIRSPINFIRE_FLY5, + S_AIRSPINFIRE_FLY6, + S_AIRSPINFIRE_DIE, + // Spikes S_SPIKE1, S_SPIKE2, @@ -2250,6 +2260,8 @@ typedef enum state S_ELEMF6, S_ELEMF7, S_ELEMF8, + S_ELEMF9, + S_ELEMF10, S_PITY1, S_PITY2, @@ -3131,6 +3143,7 @@ typedef enum mobj_type MT_SPIKEBALL, // Spike Ball MT_SPECIALSPIKEBALL, MT_SPINFIRE, + MT_AIRSPINFIRE, // Elemental flame flying through the air MT_SPIKE, MT_STARPOST, MT_BIGMINE, diff --git a/src/lua_baselib.c b/src/lua_baselib.c index b478a8cf6..8846e2403 100644 --- a/src/lua_baselib.c +++ b/src/lua_baselib.c @@ -780,10 +780,11 @@ static int lib_pBlackOw(lua_State *L) static int lib_pElementalFireTrail(lua_State *L) { player_t *player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER)); + boolean cropcircle = lua_opttrueboolean(L, 2); NOHUD if (!player) return LUA_ErrInvalid(L, "player_t"); - P_ElementalFireTrail(player); + P_ElementalFireTrail(player, cropcircle); return 0; } diff --git a/src/p_inter.c b/src/p_inter.c index 9d6230cb2..c2e8561a2 100644 --- a/src/p_inter.c +++ b/src/p_inter.c @@ -237,6 +237,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck) { player_t *player; INT32 i; + boolean elementalpierce; if (objectplacing) return; @@ -291,6 +292,8 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck) return; #endif + elementalpierce = (((player->powers[pw_shield] & SH_NOSTACK) == SH_ELEMENTAL) && (player->pflags & PF_SHIELDABILITY)); + if (special->flags & MF_BOSS) { if (special->type == MT_BLACKEGGMAN) @@ -301,9 +304,10 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck) if (((player->pflags & PF_NIGHTSMODE) && (player->pflags & PF_DRILLING)) || (player->pflags & (PF_JUMPED|PF_SPINNING|PF_GLIDING)) - || player->powers[pw_invulnerability] || player->powers[pw_super]) // Do you possess the ability to subdue the object? + || player->powers[pw_invulnerability] || player->powers[pw_super] + || elementalpierce) // Do you possess the ability to subdue the object? { - if (P_MobjFlip(toucher)*toucher->momz < 0) + if ((P_MobjFlip(toucher)*toucher->momz < 0) && !elementalpierce) toucher->momz = -toucher->momz; toucher->momx = -toucher->momx; toucher->momy = -toucher->momy; @@ -330,7 +334,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck) /////ENEMIES!!////////////////////////////////////////// //////////////////////////////////////////////////////// if (special->type == MT_GSNAPPER && !(((player->pflags & PF_NIGHTSMODE) && (player->pflags & PF_DRILLING)) - || player->powers[pw_invulnerability] || player->powers[pw_super]) + || player->powers[pw_invulnerability] || player->powers[pw_super] || elementalpierce) && toucher->z < special->z + special->height && toucher->z + toucher->height > special->z) { // Can only hit snapper from above @@ -346,7 +350,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck) || (player->pflags & (PF_JUMPED|PF_SPINNING|PF_GLIDING)) || player->powers[pw_invulnerability] || player->powers[pw_super]) // Do you possess the ability to subdue the object? { - if (P_MobjFlip(toucher)*toucher->momz < 0) + if ((P_MobjFlip(toucher)*toucher->momz < 0) && !elementalpierce) toucher->momz = -toucher->momz; P_DamageMobj(special, toucher, toucher, 1, 0); diff --git a/src/p_local.h b/src/p_local.h index 0f21b317e..26369d899 100644 --- a/src/p_local.h +++ b/src/p_local.h @@ -151,7 +151,7 @@ boolean P_AutoPause(void); void P_DoJumpShield(player_t *player); void P_BlackOw(player_t *player); -void P_ElementalFireTrail(player_t *player); +void P_ElementalFireTrail(player_t *player, boolean cropcircle); void P_DoPityCheck(player_t *player); void P_PlayerThink(player_t *player); diff --git a/src/p_map.c b/src/p_map.c index af7c4667e..468b46ea3 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -855,10 +855,10 @@ static boolean PIT_CheckThing(mobj_t *thing) { if (G_RingSlingerGametype() && (!G_GametypeHasTeams() || tmthing->player->ctfteam != thing->player->ctfteam)) { - if ((tmthing->player->powers[pw_invulnerability] || tmthing->player->powers[pw_super]) + if ((tmthing->player->powers[pw_invulnerability] || tmthing->player->powers[pw_super] || (((tmthing->player->powers[pw_shield] & SH_NOSTACK) == SH_ELEMENTAL) && (tmthing->player->pflags & PF_SHIELDABILITY))) && !thing->player->powers[pw_super]) P_DamageMobj(thing, tmthing, tmthing, 1, 0); - else if ((thing->player->powers[pw_invulnerability] || thing->player->powers[pw_super]) + else if ((thing->player->powers[pw_invulnerability] || thing->player->powers[pw_super] || (((thing->player->powers[pw_shield] & SH_NOSTACK) == SH_ELEMENTAL) && (thing->player->pflags & PF_SHIELDABILITY))) && !tmthing->player->powers[pw_super]) P_DamageMobj(tmthing, thing, thing, 1, 0); } @@ -942,11 +942,13 @@ static boolean PIT_CheckThing(mobj_t *thing) { SINT8 flipval = P_MobjFlip(thing); // Save this value in case monitor gets removed. fixed_t *momz = &tmthing->momz; // tmthing gets changed by P_DamageMobj, so we need a new pointer?! X_x;; + boolean elementalpierce = (((tmthing->player->powers[pw_shield] & SH_NOSTACK) == SH_ELEMENTAL) && (tmthing->player->pflags & PF_SHIELDABILITY)); P_DamageMobj(thing, tmthing, tmthing, 1, 0); // break the monitor // Going down? Then bounce back up. if ((P_MobjWasRemoved(thing) // Monitor was removed || !thing->health) // or otherwise popped - && (flipval*(*momz) < 0)) // monitor is on the floor and you're going down, or on the ceiling and you're going up + && (flipval*(*momz) < 0) // monitor is on the floor and you're going down, or on the ceiling and you're going up + && !elementalpierce) // you're not piercing through the monitor... *momz = -*momz; // Therefore, you should be thrust in the opposite direction, vertically. return false; } diff --git a/src/p_mobj.c b/src/p_mobj.c index 9b9fdea24..ab8071904 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -2980,7 +2980,19 @@ static void P_PlayerZMovement(mobj_t *mo) if (!(mo->player->pflags & PF_GLIDING)) mo->player->pflags &= ~PF_JUMPED; + + if (((mo->player->powers[pw_shield] & SH_NOSTACK) == SH_ELEMENTAL) && (mo->player->pflags & PF_SHIELDABILITY)) // Elemental pierce attack. + { + if (mo->eflags & (MFE_UNDERWATER|MFE_TOUCHWATER)) // play a blunt sound + S_StartSound(mo, sfx_s3k4c); + else // create a fire pattern on the ground + { + S_StartSound(mo, sfx_s3k47); + P_ElementalFireTrail(mo->player, true); + } + } mo->player->pflags &= ~(PF_THOKKED|PF_SHIELDABILITY); + //mo->player->pflags &= ~PF_GLIDING; mo->player->jumping = 0; mo->player->secondjump = 0; @@ -6456,6 +6468,16 @@ void P_MobjThinker(mobj_t *mobj) } else P_AddOverlay(mobj); + if ((mobj->target->type == MT_GREENORB) + && (mobj->target->target) + && (mobj->target->target->player) + && ((mobj->target->target->player->powers[pw_shield] & SH_NOSTACK) == SH_ELEMENTAL) + && (mobj->target->target->player->pflags & PF_SHIELDABILITY) + && (mobj->state->nextstate < mobj->target->info->painstate)) // Special casing for elemental shield piercing attack. + { + P_SetMobjState(mobj, mobj->target->info->painstate); + mobj->tics++; + } break; case MT_BLACKORB: case MT_WHITEORB: diff --git a/src/p_user.c b/src/p_user.c index 84eea16a0..e1a44cfd0 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -1347,6 +1347,8 @@ void P_SpawnShieldOrb(player_t *player) I_Error("P_SpawnShieldOrb: player->mo is NULL!\n"); #endif + player->pflags &= ~PF_SHIELDABILITY; // Prevent edge cases when switching shields. + if (player->powers[pw_shield] & SH_FORCE) orbtype = MT_BLUEORB; else switch (player->powers[pw_shield] & SH_NOSTACK) @@ -6198,7 +6200,7 @@ void P_BlackOw(player_t *player) player->powers[pw_shield] = player->powers[pw_shield] & SH_STACK; } -void P_ElementalFireTrail(player_t *player) +void P_ElementalFireTrail(player_t *player, boolean cropcircle) { fixed_t newx; fixed_t newy; @@ -6216,40 +6218,61 @@ void P_ElementalFireTrail(player_t *player) else ground = player->mo->floorz; - travelangle = R_PointToAngle2(0, 0, player->rmomx, player->rmomy); - - for (i = 0; i < 2; i++) + if (cropcircle) { - newx = player->mo->x + P_ReturnThrustX(player->mo, travelangle + ((i&1) ? -1 : 1)*ANGLE_135, FixedMul(24*FRACUNIT, player->mo->scale)); - newy = player->mo->y + P_ReturnThrustY(player->mo, travelangle + ((i&1) ? -1 : 1)*ANGLE_135, FixedMul(24*FRACUNIT, player->mo->scale)); -#ifdef ESLOPE - if (player->mo->standingslope) + travelangle = player->mo->angle + P_RandomRange(-ANGLE_45, ANGLE_45); +#define numangles 8 + for (i = 0; i < 8; i++) { - ground = P_GetZAt(player->mo->standingslope, newx, newy); - if (player->mo->eflags & MFE_VERTICALFLIP) - ground -= FixedMul(mobjinfo[MT_SPINFIRE].height, player->mo->scale); + flame = P_SpawnMobj(player->mo->x, player->mo->y, ground, MT_AIRSPINFIRE); + P_SetTarget(&flame->target, player->mo); + flame->angle = travelangle + i*(ANGLE_MAX/numangles); + flame->destscale = player->mo->scale; + P_SetScale(flame, player->mo->scale); + flame->eflags = (flame->eflags & ~MFE_VERTICALFLIP)|(player->mo->eflags & MFE_VERTICALFLIP); + P_InstaThrust(flame, flame->angle, FixedMul(3*FRACUNIT, flame->scale)); + P_SetObjectMomZ(flame, 3*FRACUNIT, false); } -#endif - flame = P_SpawnMobj(newx, newy, ground, MT_SPINFIRE); - P_SetTarget(&flame->target, player->mo); - flame->angle = travelangle; - flame->fuse = TICRATE*6; - flame->destscale = player->mo->scale; - P_SetScale(flame, player->mo->scale); - flame->eflags = (flame->eflags & ~MFE_VERTICALFLIP)|(player->mo->eflags & MFE_VERTICALFLIP); - - flame->momx = 8; - P_XYMovement(flame); - if (P_MobjWasRemoved(flame)) - continue; - - if (player->mo->eflags & MFE_VERTICALFLIP) +#undef numangles + } + else + { + travelangle = R_PointToAngle2(0, 0, player->rmomx, player->rmomy); + for (i = 0; i < 2; i++) { - if (flame->z + flame->height < flame->ceilingz) + + newx = player->mo->x + P_ReturnThrustX(player->mo, (travelangle + ((i&1) ? -1 : 1)*ANGLE_135), FixedMul(24*FRACUNIT, player->mo->scale)); + newy = player->mo->y + P_ReturnThrustY(player->mo, (travelangle + ((i&1) ? -1 : 1)*ANGLE_135), FixedMul(24*FRACUNIT, player->mo->scale)); + +#ifdef ESLOPE + if (player->mo->standingslope) + { + ground = P_GetZAt(player->mo->standingslope, newx, newy); + if (player->mo->eflags & MFE_VERTICALFLIP) + ground -= FixedMul(mobjinfo[MT_SPINFIRE].height, player->mo->scale); + } +#endif + flame = P_SpawnMobj(newx, newy, ground, MT_SPINFIRE); + P_SetTarget(&flame->target, player->mo); + flame->angle = travelangle; + // flame->fuse = TICRATE*6; // now done in spawnstate + flame->destscale = player->mo->scale; + P_SetScale(flame, player->mo->scale); + flame->eflags = (flame->eflags & ~MFE_VERTICALFLIP)|(player->mo->eflags & MFE_VERTICALFLIP); + + flame->momx = 8; + P_XYMovement(flame); + if (P_MobjWasRemoved(flame)) + continue; + + if (player->mo->eflags & MFE_VERTICALFLIP) + { + if (flame->z + flame->height < flame->ceilingz) + P_RemoveMobj(flame); + } + else if (flame->z > flame->floorz) P_RemoveMobj(flame); } - else if (flame->z > flame->floorz) - P_RemoveMobj(flame); } } @@ -6789,7 +6812,7 @@ static void P_MovePlayer(player_t *player) if ((player->powers[pw_shield] & SH_NOSTACK) == SH_ELEMENTAL && (player->pflags & PF_SPINNING) && player->speed > FixedMul(4<mo->scale) && onground && (leveltime & 1) && !(player->mo->eflags & (MFE_UNDERWATER|MFE_TOUCHWATER))) - P_ElementalFireTrail(player); + P_ElementalFireTrail(player, false); P_DoSpinDash(player, cmd); @@ -6897,9 +6920,24 @@ static void P_MovePlayer(player_t *player) { player->pflags |= PF_THOKKED|PF_SHIELDABILITY; player->homing = 2; - S_StartSound(player->mo, sfx_spdpad); if (P_LookForEnemies(player, false) && player->mo->tracer) + { + S_StartSound(player->mo, sfx_s3k40); player->homing = 3*TICRATE; + } + else + S_StartSound(player->mo, sfx_s3k41); + } + } + // Elemental shield activation + if ((player->powers[pw_shield] & SH_NOSTACK) == SH_ELEMENTAL) + { + if (!(player->pflags & PF_THOKKED)) + { + player->pflags |= PF_THOKKED|PF_SHIELDABILITY; + S_StartSound(player->mo, sfx_s3k43); + player->mo->momx = player->mo->momy = 0; + P_SetObjectMomZ(player->mo, -24*FRACUNIT, false); } } } From ec85357643952742365bd661ff25c6684a088fa7 Mon Sep 17 00:00:00 2001 From: toasterbabe Date: Fri, 8 Jul 2016 22:05:13 +0100 Subject: [PATCH 010/172] Didn't properly use the #defined numangles constant. --- src/p_user.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/p_user.c b/src/p_user.c index e1a44cfd0..5579178d1 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -6222,7 +6222,7 @@ void P_ElementalFireTrail(player_t *player, boolean cropcircle) { travelangle = player->mo->angle + P_RandomRange(-ANGLE_45, ANGLE_45); #define numangles 8 - for (i = 0; i < 8; i++) + for (i = 0; i < numangles; i++) { flame = P_SpawnMobj(player->mo->x, player->mo->y, ground, MT_AIRSPINFIRE); P_SetTarget(&flame->target, player->mo); From 940a58b5cad6e40c714e46527746fdf9d0ce2661 Mon Sep 17 00:00:00 2001 From: toasterbabe Date: Fri, 8 Jul 2016 22:52:49 +0100 Subject: [PATCH 011/172] Shouldn't be true by default, WOOPS --- src/lua_baselib.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lua_baselib.c b/src/lua_baselib.c index 8846e2403..d34e319cb 100644 --- a/src/lua_baselib.c +++ b/src/lua_baselib.c @@ -780,7 +780,7 @@ static int lib_pBlackOw(lua_State *L) static int lib_pElementalFireTrail(lua_State *L) { player_t *player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER)); - boolean cropcircle = lua_opttrueboolean(L, 2); + boolean cropcircle = lua_optboolean(L, 2); NOHUD if (!player) return LUA_ErrInvalid(L, "player_t"); From 0fefd86d1e0874dbe16b03da3515b82a9236a294 Mon Sep 17 00:00:00 2001 From: toasterbabe Date: Fri, 8 Jul 2016 22:56:17 +0100 Subject: [PATCH 012/172] More generic name for P_ElementalFireTrail upon MI's request --- src/lua_baselib.c | 6 +++--- src/p_local.h | 2 +- src/p_mobj.c | 2 +- src/p_user.c | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/lua_baselib.c b/src/lua_baselib.c index d34e319cb..745c9dcd3 100644 --- a/src/lua_baselib.c +++ b/src/lua_baselib.c @@ -777,14 +777,14 @@ static int lib_pBlackOw(lua_State *L) return 0; } -static int lib_pElementalFireTrail(lua_State *L) +static int lib_pElementalFire(lua_State *L) { player_t *player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER)); boolean cropcircle = lua_optboolean(L, 2); NOHUD if (!player) return LUA_ErrInvalid(L, "player_t"); - P_ElementalFireTrail(player, cropcircle); + P_ElementalFire(player, cropcircle); return 0; } @@ -2038,7 +2038,7 @@ static luaL_Reg lib[] = { {"P_ResetScore",lib_pResetScore}, {"P_DoJumpShield",lib_pDoJumpShield}, {"P_BlackOw",lib_pBlackOw}, - {"P_ElementalFireTrail",lib_pElementalFireTrail}, + {"P_ElementalFire",lib_pElementalFire}, {"P_DoPlayerExit",lib_pDoPlayerExit}, {"P_InstaThrust",lib_pInstaThrust}, {"P_ReturnThrustX",lib_pReturnThrustX}, diff --git a/src/p_local.h b/src/p_local.h index 26369d899..05d1a4823 100644 --- a/src/p_local.h +++ b/src/p_local.h @@ -151,7 +151,7 @@ boolean P_AutoPause(void); void P_DoJumpShield(player_t *player); void P_BlackOw(player_t *player); -void P_ElementalFireTrail(player_t *player, boolean cropcircle); +void P_ElementalFire(player_t *player, boolean cropcircle); void P_DoPityCheck(player_t *player); void P_PlayerThink(player_t *player); diff --git a/src/p_mobj.c b/src/p_mobj.c index ab8071904..13dd15d21 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -2988,7 +2988,7 @@ static void P_PlayerZMovement(mobj_t *mo) else // create a fire pattern on the ground { S_StartSound(mo, sfx_s3k47); - P_ElementalFireTrail(mo->player, true); + P_ElementalFire(mo->player, true); } } mo->player->pflags &= ~(PF_THOKKED|PF_SHIELDABILITY); diff --git a/src/p_user.c b/src/p_user.c index 5579178d1..75c70135a 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -6200,7 +6200,7 @@ void P_BlackOw(player_t *player) player->powers[pw_shield] = player->powers[pw_shield] & SH_STACK; } -void P_ElementalFireTrail(player_t *player, boolean cropcircle) +void P_ElementalFire(player_t *player, boolean cropcircle) { fixed_t newx; fixed_t newy; @@ -6812,7 +6812,7 @@ static void P_MovePlayer(player_t *player) if ((player->powers[pw_shield] & SH_NOSTACK) == SH_ELEMENTAL && (player->pflags & PF_SPINNING) && player->speed > FixedMul(4<mo->scale) && onground && (leveltime & 1) && !(player->mo->eflags & (MFE_UNDERWATER|MFE_TOUCHWATER))) - P_ElementalFireTrail(player, false); + P_ElementalFire(player, false); P_DoSpinDash(player, cmd); From ad03bb52786fbfe1661976a3bd75bc29ae61d77d Mon Sep 17 00:00:00 2001 From: toasterbabe Date: Sat, 23 Jul 2016 18:25:51 +0100 Subject: [PATCH 013/172] Force Shield's air ability is now the Drop Dash (thanks, Sonic Mania, for making me like the momentum redirection idea by recontextualising it to collision with the ground only!) * Press spin in midair to make the shield flash solid repeatedly and make a number of ding noises. * When the player with a flashing, dinging shield hits the ground, they are sent off in spinning form at the maximum of 2*abs(momz) VS the 3D hypotenuse of momx, momy, and momz. --- src/p_mobj.c | 43 +++++++++++++++++++++++++++++++++++-------- src/p_user.c | 9 +++++++++ 2 files changed, 44 insertions(+), 8 deletions(-) diff --git a/src/p_mobj.c b/src/p_mobj.c index 13dd15d21..fd4583891 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -2981,14 +2981,25 @@ static void P_PlayerZMovement(mobj_t *mo) if (!(mo->player->pflags & PF_GLIDING)) mo->player->pflags &= ~PF_JUMPED; - if (((mo->player->powers[pw_shield] & SH_NOSTACK) == SH_ELEMENTAL) && (mo->player->pflags & PF_SHIELDABILITY)) // Elemental pierce attack. + if (mo->player->pflags & PF_SHIELDABILITY) { - if (mo->eflags & (MFE_UNDERWATER|MFE_TOUCHWATER)) // play a blunt sound - S_StartSound(mo, sfx_s3k4c); - else // create a fire pattern on the ground + if ((mo->player->powers[pw_shield] & SH_NOSTACK) == SH_ELEMENTAL) // Elemental shield's stomp attack. { - S_StartSound(mo, sfx_s3k47); - P_ElementalFire(mo->player, true); + if (mo->eflags & (MFE_UNDERWATER|MFE_TOUCHWATER)) // play a blunt sound + S_StartSound(mo, sfx_s3k4c); + else // create a fire pattern on the ground + { + S_StartSound(mo, sfx_s3k47); + P_ElementalFire(mo->player, true); + } + } + if ((mo->player->powers[pw_shield] & SH_FORCE) == SH_FORCE) // Force Shield's drop dash. + { + fixed_t magnitude = max(FixedHypot((FixedHypot(mo->momx, mo->momy)), mo->momz), abs(mo->momz)*2); // vertical momentum is amplified here, since otherwise this was kind of weak. + P_InstaThrust(mo, mo->angle, magnitude); + S_StartSound(mo, sfx_zoom); + mo->player->pflags |= PF_SPINNING; + P_SetPlayerMobjState(mo, S_PLAY_SPIN); } } mo->player->pflags &= ~(PF_THOKKED|PF_SHIELDABILITY); @@ -6482,7 +6493,6 @@ void P_MobjThinker(mobj_t *mobj) case MT_BLACKORB: case MT_WHITEORB: case MT_GREENORB: - case MT_BLUEORB: case MT_PITYORB: if (!P_AddShield(mobj)) return; @@ -6490,9 +6500,26 @@ void P_MobjThinker(mobj_t *mobj) case MT_YELLOWORB: if (!P_AddShield(mobj)) return; - if (mobj->target->player->homing) + if ((mobj->target) + && (mobj->target->player) + && (mobj->target->player->homing)) P_SetMobjState(mobj, mobj->info->painstate); break; + case MT_BLUEORB: + if (!P_AddShield(mobj)) + return; + if ((mobj->target) + && (mobj->target->player) + && (mobj->target->player->pflags & PF_SHIELDABILITY)) + { + mobj->frame &= ~FF_TRANSMASK; + if (!(leveltime & 15)) + { + S_StopSound(mobj->target); + S_StartSound(mobj->target, sfx_ding); + } + } + break; case MT_WATERDROP: P_SceneryCheckWater(mobj); if ((mobj->z <= mobj->floorz || mobj->z <= mobj->watertop) diff --git a/src/p_user.c b/src/p_user.c index 75c70135a..2d957aec3 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -6940,6 +6940,15 @@ static void P_MovePlayer(player_t *player) P_SetObjectMomZ(player->mo, -24*FRACUNIT, false); } } + // Force shield activation + if ((player->powers[pw_shield] & SH_FORCE) == SH_FORCE) + { + if (!(player->pflags & PF_THOKKED)) + { + player->pflags |= PF_THOKKED|PF_SHIELDABILITY; + S_StartSound(player->mo, sfx_ding); + } + } } // Super Sonic move if (player->skin == 0 && player->powers[pw_super] && player->speed > FixedMul(5<mo->scale) From d0bb7293bd73c8a0ea4653fad3fb2ed2e6768a11 Mon Sep 17 00:00:00 2001 From: toasterbabe Date: Sat, 23 Jul 2016 21:01:40 +0100 Subject: [PATCH 014/172] Maximum Drop Dash speed of 75*FRACUNIT. --- src/p_mobj.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/p_mobj.c b/src/p_mobj.c index fd4583891..86ff3259a 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -2995,7 +2995,7 @@ static void P_PlayerZMovement(mobj_t *mo) } if ((mo->player->powers[pw_shield] & SH_FORCE) == SH_FORCE) // Force Shield's drop dash. { - fixed_t magnitude = max(FixedHypot((FixedHypot(mo->momx, mo->momy)), mo->momz), abs(mo->momz)*2); // vertical momentum is amplified here, since otherwise this was kind of weak. + fixed_t magnitude = min(max(FixedHypot((FixedHypot(mo->momx, mo->momy)), mo->momz), abs(mo->momz)*2), 75<angle, magnitude); S_StartSound(mo, sfx_zoom); mo->player->pflags |= PF_SPINNING; From 436dfbb24f6eb41586641f90f3c4a355c480c6a3 Mon Sep 17 00:00:00 2001 From: toasterbabe Date: Sat, 23 Jul 2016 21:37:32 +0100 Subject: [PATCH 015/172] Crashed in THZ1 when testing going down the long section at the end, EIP blames this line, wasn't really necessary in the first place... fair enough. --- src/p_mobj.c | 1 - 1 file changed, 1 deletion(-) diff --git a/src/p_mobj.c b/src/p_mobj.c index 86ff3259a..138455604 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -6515,7 +6515,6 @@ void P_MobjThinker(mobj_t *mobj) mobj->frame &= ~FF_TRANSMASK; if (!(leveltime & 15)) { - S_StopSound(mobj->target); S_StartSound(mobj->target, sfx_ding); } } From f34a28e80e71cd783648d00463dfc9a74ef3508a Mon Sep 17 00:00:00 2001 From: toasterbabe Date: Sun, 21 Aug 2016 13:55:16 +0100 Subject: [PATCH 016/172] Removed a hack that caused the groundpound spinfire to hurt you if you lost your shield. --- src/dehacked.c | 10 ---------- src/doomdef.h | 2 +- src/info.c | 39 +-------------------------------------- src/info.h | 11 ----------- src/p_mobj.c | 24 ++++++++++++++++++++---- src/p_user.c | 6 ++++-- 6 files changed, 26 insertions(+), 66 deletions(-) diff --git a/src/dehacked.c b/src/dehacked.c index 1afa5f0cf..8fb0e8df7 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -4783,7 +4783,6 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit "S_SPIKEBALL8", // Elemental Shield's Spawn - "S_SPINFIRE0", "S_SPINFIRE1", "S_SPINFIRE2", "S_SPINFIRE3", @@ -4791,15 +4790,6 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit "S_SPINFIRE5", "S_SPINFIRE6", - // Elemental Shield's FLYING Spawn - "S_AIRSPINFIRE_FLY1", - "S_AIRSPINFIRE_FLY2", - "S_AIRSPINFIRE_FLY3", - "S_AIRSPINFIRE_FLY4", - "S_AIRSPINFIRE_FLY5", - "S_AIRSPINFIRE_FLY6", - "S_AIRSPINFIRE_DIE", - // Spikes "S_SPIKE1", "S_SPIKE2", diff --git a/src/doomdef.h b/src/doomdef.h index 70ec8c0d1..77c0a9800 100644 --- a/src/doomdef.h +++ b/src/doomdef.h @@ -158,7 +158,7 @@ extern FILE *logstream; // Does this version require an added patch file? // Comment or uncomment this as necessary. -//#define USE_PATCH_DTA +#define USE_PATCH_DTA // Modification options // If you want to take advantage of the Master Server's ability to force clients to update diff --git a/src/info.c b/src/info.c index f946e72e8..484ab321d 100644 --- a/src/info.c +++ b/src/info.c @@ -1124,7 +1124,6 @@ state_t states[NUMSTATES] = {SPR_SPIK, 7, 1, {A_RotateSpikeBall}, 0, 0, S_SPIKEBALL1}, // S_SPIKEBALL8 // Elemental Shield's Spawn - {SPR_SFLM, FF_FULLBRIGHT|5, 2, {A_SetFuse}, 6*TICRATE, 0, S_SPINFIRE1}, // S_SPINFIRE0 {SPR_SFLM, FF_FULLBRIGHT, 2, {NULL}, 0, 0, S_SPINFIRE2}, // S_SPINFIRE1 {SPR_SFLM, FF_FULLBRIGHT|1, 2, {NULL}, 0, 0, S_SPINFIRE3}, // S_SPINFIRE2 {SPR_SFLM, FF_FULLBRIGHT|2, 2, {NULL}, 0, 0, S_SPINFIRE4}, // S_SPINFIRE3 @@ -1132,15 +1131,6 @@ state_t states[NUMSTATES] = {SPR_SFLM, FF_FULLBRIGHT|4, 2, {NULL}, 0, 0, S_SPINFIRE6}, // S_SPINFIRE5 {SPR_SFLM, FF_FULLBRIGHT|5, 2, {NULL}, 0, 0, S_SPINFIRE1}, // S_SPINFIRE6 - // Elemental Shield's FLYING Spawn - {SPR_SFLM, FF_FULLBRIGHT, 2, {NULL}, 0, 0, S_AIRSPINFIRE_FLY2}, //S_AIRSPINFIRE_FLY1, - {SPR_SFLM, FF_FULLBRIGHT|1, 2, {NULL}, 0, 0, S_AIRSPINFIRE_FLY3}, //S_AIRSPINFIRE_FLY2, - {SPR_SFLM, FF_FULLBRIGHT|2, 2, {NULL}, 0, 0, S_AIRSPINFIRE_FLY4}, //S_AIRSPINFIRE_FLY3, - {SPR_SFLM, FF_FULLBRIGHT|3, 2, {NULL}, 0, 0, S_AIRSPINFIRE_FLY5}, //S_AIRSPINFIRE_FLY4, - {SPR_SFLM, FF_FULLBRIGHT|4, 2, {NULL}, 0, 0, S_AIRSPINFIRE_FLY6}, //S_AIRSPINFIRE_FLY5, - {SPR_SFLM, FF_FULLBRIGHT|5, 2, {NULL}, 0, 0, S_AIRSPINFIRE_FLY1}, //S_AIRSPINFIRE_FLY6, - {SPR_SFLM, FF_FULLBRIGHT, 0, {A_SpawnObjectRelative}, 0, MT_SPINFIRE, S_NULL}, //S_AIRSPINFIRE_DIE, - // Floor Spike {SPR_USPK, 0,-1, {A_SpikeRetract}, 1, 0, S_SPIKE2}, // S_SPIKE1 -- Fully extended {SPR_USPK, 5, 2, {A_Pain}, 0, 0, S_SPIKE3}, // S_SPIKE2 @@ -5404,7 +5394,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = { // MT_SPINFIRE -1, // doomednum - S_SPINFIRE0, // spawnstate + S_SPINFIRE1, // spawnstate 1, // spawnhealth S_NULL, // seestate sfx_None, // seesound @@ -5429,33 +5419,6 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = S_NULL // raisestate }, - { // MT_AIRSPINFIRE - -1, // doomednum - S_AIRSPINFIRE_FLY1, // 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_AIRSPINFIRE_DIE, // deathstate - S_NULL, // xdeathstate - sfx_None, // deathsound - 10*FRACUNIT, // speed - 8*FRACUNIT, // radius - 14*FRACUNIT, // height - 0, // display offset - 100, // mass - 1, // damage - sfx_None, // activesound - MF_NOBLOCKMAP|MF_MISSILE|MF_FIRE, // flags - S_NULL // raisestate - }, - { // MT_SPIKE 523, // doomednum S_SPIKE1, // spawnstate diff --git a/src/info.h b/src/info.h index 8a56ef77e..2460f6fbc 100644 --- a/src/info.h +++ b/src/info.h @@ -1634,7 +1634,6 @@ typedef enum state S_SPIKEBALL8, // Elemental Shield's Spawn - S_SPINFIRE0, S_SPINFIRE1, S_SPINFIRE2, S_SPINFIRE3, @@ -1642,15 +1641,6 @@ typedef enum state S_SPINFIRE5, S_SPINFIRE6, - // Elemental Shield's FLYING Spawn - S_AIRSPINFIRE_FLY1, - S_AIRSPINFIRE_FLY2, - S_AIRSPINFIRE_FLY3, - S_AIRSPINFIRE_FLY4, - S_AIRSPINFIRE_FLY5, - S_AIRSPINFIRE_FLY6, - S_AIRSPINFIRE_DIE, - // Spikes S_SPIKE1, S_SPIKE2, @@ -3143,7 +3133,6 @@ typedef enum mobj_type MT_SPIKEBALL, // Spike Ball MT_SPECIALSPIKEBALL, MT_SPINFIRE, - MT_AIRSPINFIRE, // Elemental flame flying through the air MT_SPIKE, MT_STARPOST, MT_BIGMINE, diff --git a/src/p_mobj.c b/src/p_mobj.c index 138455604..5ce06f90b 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -2377,6 +2377,19 @@ static boolean P_ZMovement(mobj_t *mo) mo->flags |= MF_NOGRAVITY; } break; + case MT_SPINFIRE: + if (P_CheckDeathPitCollide(mo)) + { + P_RemoveMobj(mo); + return false; + } + if (mo->z <= mo->floorz && mo->momz) + { + mo->flags |= MF_NOGRAVITY; + mo->momx = mo->momy = mo->momz = 0; + mo->z = mo->floorz; + } + break; case MT_GOOP: if (P_CheckDeathPitCollide(mo)) { @@ -7338,10 +7351,13 @@ void P_MobjThinker(mobj_t *mobj) #endif break; case MT_SPINFIRE: - if (mobj->eflags & MFE_VERTICALFLIP) - mobj->z = mobj->ceilingz - mobj->height; - else - mobj->z = mobj->floorz; + if (mobj->flags & MF_NOGRAVITY) + { + if (mobj->eflags & MFE_VERTICALFLIP) + mobj->z = mobj->ceilingz - mobj->height; + else + mobj->z = mobj->floorz; + } // THERE IS NO BREAK HERE ON PURPOSE default: // check mobj against possible water content, before movement code diff --git a/src/p_user.c b/src/p_user.c index 2d957aec3..99eef15ae 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -6224,9 +6224,11 @@ void P_ElementalFire(player_t *player, boolean cropcircle) #define numangles 8 for (i = 0; i < numangles; i++) { - flame = P_SpawnMobj(player->mo->x, player->mo->y, ground, MT_AIRSPINFIRE); + flame = P_SpawnMobj(player->mo->x, player->mo->y, ground, MT_SPINFIRE); + flame->flags &= ~MF_NOGRAVITY; P_SetTarget(&flame->target, player->mo); flame->angle = travelangle + i*(ANGLE_MAX/numangles); + flame->fuse = TICRATE*7; // takes about an extra second to hit the ground flame->destscale = player->mo->scale; P_SetScale(flame, player->mo->scale); flame->eflags = (flame->eflags & ~MFE_VERTICALFLIP)|(player->mo->eflags & MFE_VERTICALFLIP); @@ -6255,7 +6257,7 @@ void P_ElementalFire(player_t *player, boolean cropcircle) flame = P_SpawnMobj(newx, newy, ground, MT_SPINFIRE); P_SetTarget(&flame->target, player->mo); flame->angle = travelangle; - // flame->fuse = TICRATE*6; // now done in spawnstate + flame->fuse = TICRATE*6; flame->destscale = player->mo->scale; P_SetScale(flame, player->mo->scale); flame->eflags = (flame->eflags & ~MFE_VERTICALFLIP)|(player->mo->eflags & MFE_VERTICALFLIP); From dc3be7b8a199019ed29c0b0164c89e0d2dde1bfa Mon Sep 17 00:00:00 2001 From: toasterbabe Date: Sun, 21 Aug 2016 15:42:09 +0100 Subject: [PATCH 017/172] Removing now-irrelevant whitespace and cleaning up the last of the hack. --- src/info.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/info.c b/src/info.c index 484ab321d..cc635c038 100644 --- a/src/info.c +++ b/src/info.c @@ -1124,12 +1124,12 @@ state_t states[NUMSTATES] = {SPR_SPIK, 7, 1, {A_RotateSpikeBall}, 0, 0, S_SPIKEBALL1}, // S_SPIKEBALL8 // Elemental Shield's Spawn - {SPR_SFLM, FF_FULLBRIGHT, 2, {NULL}, 0, 0, S_SPINFIRE2}, // S_SPINFIRE1 - {SPR_SFLM, FF_FULLBRIGHT|1, 2, {NULL}, 0, 0, S_SPINFIRE3}, // S_SPINFIRE2 - {SPR_SFLM, FF_FULLBRIGHT|2, 2, {NULL}, 0, 0, S_SPINFIRE4}, // S_SPINFIRE3 - {SPR_SFLM, FF_FULLBRIGHT|3, 2, {NULL}, 0, 0, S_SPINFIRE5}, // S_SPINFIRE4 - {SPR_SFLM, FF_FULLBRIGHT|4, 2, {NULL}, 0, 0, S_SPINFIRE6}, // S_SPINFIRE5 - {SPR_SFLM, FF_FULLBRIGHT|5, 2, {NULL}, 0, 0, S_SPINFIRE1}, // S_SPINFIRE6 + {SPR_SFLM, FF_FULLBRIGHT, 2, {NULL}, 0, 0, S_SPINFIRE2}, // S_SPINFIRE1 + {SPR_SFLM, FF_FULLBRIGHT|1, 2, {NULL}, 0, 0, S_SPINFIRE3}, // S_SPINFIRE2 + {SPR_SFLM, FF_FULLBRIGHT|2, 2, {NULL}, 0, 0, S_SPINFIRE4}, // S_SPINFIRE3 + {SPR_SFLM, FF_FULLBRIGHT|3, 2, {NULL}, 0, 0, S_SPINFIRE5}, // S_SPINFIRE4 + {SPR_SFLM, FF_FULLBRIGHT|4, 2, {NULL}, 0, 0, S_SPINFIRE6}, // S_SPINFIRE5 + {SPR_SFLM, FF_FULLBRIGHT|5, 2, {NULL}, 0, 0, S_SPINFIRE1}, // S_SPINFIRE6 // Floor Spike {SPR_USPK, 0,-1, {A_SpikeRetract}, 1, 0, S_SPIKE2}, // S_SPIKE1 -- Fully extended @@ -5415,7 +5415,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = 100, // mass 1, // damage sfx_None, // activesound - MF_NOBLOCKMAP|MF_MISSILE|MF_NOGRAVITY|MF_FIRE|MF_RUNSPAWNFUNC, // flags + MF_NOBLOCKMAP|MF_MISSILE|MF_NOGRAVITY|MF_FIRE, // flags S_NULL // raisestate }, From c9aebc6f81837faa09183c10de3f048e4bdb936e Mon Sep 17 00:00:00 2001 From: Alam Ed Arias Date: Fri, 9 Sep 2016 17:41:30 -0400 Subject: [PATCH 018/172] libz pkgconfig --- src/Makefile | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/Makefile b/src/Makefile index ce4b569ee..b83b201e6 100644 --- a/src/Makefile +++ b/src/Makefile @@ -179,6 +179,9 @@ endif ifdef LINUX UNIXCOMMON=1 +ifndef NOGME +HAVE_LIBGME=1 +endif endif ifdef SOLARIS @@ -318,6 +321,13 @@ endif ifdef HAVE_LIBGME OPTS+=-DHAVE_LIBGME +ZLIB_PKGCONFIG?=zlib +ZLIB_CFLAGS?=$(shell $(PKG_CONFIG) $(ZLIB_PKGCONFIG) --cflags) +ZLIB_LDFLAGS?=$(shell $(PKG_CONFIG) $(ZLIB_PKGCONFIG) --libs) + +LIBS+=$(ZLIB_LDFLAGS) +CFLAGS+=$(ZLIB_CFLAGS) + LIBGME_PKGCONFIG?=libgme LIBGME_CFLAGS?=$(shell $(PKG_CONFIG) $(LIBGME_PKGCONFIG) --cflags) LIBGME_LDFLAGS?=$(shell $(PKG_CONFIG) $(LIBGME_PKGCONFIG) --libs) From 9a2dd50e4dee99515d6b1e37ee3085214aa4f2f2 Mon Sep 17 00:00:00 2001 From: toasterbabe Date: Tue, 27 Sep 2016 19:03:57 +0100 Subject: [PATCH 019/172] ...I should really check what I'm doing more thoroughly, sorry. --- src/p_mobj.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/p_mobj.c b/src/p_mobj.c index 0f0a7e570..37b684016 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -3223,7 +3223,7 @@ static void P_PlayerZMovement(mobj_t *mo) P_SetPlayerMobjState(mo, S_PLAY_SPIN); } } - mo->player->pflags &= ~(PF_THOKKED|PF_CANCARRY/*|PF_GLIDING*/); + mo->player->pflags &= ~(PF_THOKKED|PF_CANCARRY|PF_SHIELDABILITY/*|PF_GLIDING*/); mo->player->jumping = 0; mo->player->secondjump = 0; mo->player->glidetime = 0; From 35dda1cd72a17d35ee29ee91e6646b3399da4660 Mon Sep 17 00:00:00 2001 From: toasterbabe Date: Thu, 29 Sep 2016 20:02:58 +0100 Subject: [PATCH 020/172] Replaced the Force Shield's shitty drop dash I coded with a much more interesting and experimental ability. * The Dodge Dash * Allows you to dash - no control, no falling, no key response - for 2 + (number of extra shield hitpoints) tics. * If you're holding movement keys down, you dash in the direction you're holding - otherwise, you dash directly forward. * You're spinning (spindash spin, not jump spin) until your dash is over, then your momentum is cut down significantly and you end up in falling frames. * It may not necessarily be super useful for Sonic, but it helps the other characters. * http://gfycat.com/BogusFailingFritillarybutterfly * http://gfycat.com/PoliticalIdealisticBallpython (outdated speed, shows any direction) --- src/p_mobj.c | 24 +++--------------------- src/p_user.c | 52 ++++++++++++++++++++++++++++++++++++++++++++++------ 2 files changed, 49 insertions(+), 27 deletions(-) diff --git a/src/p_mobj.c b/src/p_mobj.c index 37b684016..7092e7d81 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -3214,14 +3214,6 @@ static void P_PlayerZMovement(mobj_t *mo) P_ElementalFire(mo->player, true); } } - else if ((mo->player->powers[pw_shield] & SH_FORCE) == SH_FORCE) // Force Shield's drop dash. - { - fixed_t magnitude = min(max(FixedHypot((FixedHypot(mo->momx, mo->momy)), mo->momz), abs(mo->momz)*2), 75<angle, magnitude); - S_StartSound(mo, sfx_zoom); - mo->player->pflags |= PF_SPINNING; - P_SetPlayerMobjState(mo, S_PLAY_SPIN); - } } mo->player->pflags &= ~(PF_THOKKED|PF_CANCARRY|PF_SHIELDABILITY/*|PF_GLIDING*/); mo->player->jumping = 0; @@ -6713,6 +6705,7 @@ void P_MobjThinker(mobj_t *mobj) case MT_BLACKORB: case MT_WHITEORB: case MT_GREENORB: + case MT_BLUEORB: case MT_PITYORB: if (!P_AddShield(mobj)) return; @@ -6723,20 +6716,9 @@ void P_MobjThinker(mobj_t *mobj) if ((mobj->target) && (mobj->target->player) && (mobj->target->player->homing)) - P_SetMobjState(mobj, mobj->info->painstate); - break; - case MT_BLUEORB: - if (!P_AddShield(mobj)) - return; - if ((mobj->target) - && (mobj->target->player) - && (mobj->target->player->pflags & PF_SHIELDABILITY)) { - mobj->frame &= ~FF_TRANSMASK; - if (!(leveltime & 15)) - { - S_StartSound(mobj->target, sfx_ding); - } + P_SetMobjState(mobj, mobj->info->painstate); + mobj->tics++; } break; case MT_WATERDROP: diff --git a/src/p_user.c b/src/p_user.c index 405fa67b6..409ee9b45 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -867,6 +867,15 @@ void P_DoPlayerPain(player_t *player, mobj_t *source, mobj_t *inflictor) // Useful when you want to kill everything the player is doing. void P_ResetPlayer(player_t *player) { + if (player->mo + && (player->powers[pw_shield] & SH_FORCE) == SH_FORCE // Dash. + && player->pflags & PF_SHIELDABILITY) + { + P_SetPlayerMobjState(player->mo, S_PLAY_FALL); + player->mo->flags &= ~MF_NOGRAVITY; + player->pflags &= ~PF_FULLSTASIS; + } + player->pflags &= ~(PF_SPINNING|PF_STARTDASH|PF_JUMPED|PF_GLIDING|PF_THOKKED|PF_CANCARRY|PF_SHIELDABILITY); player->powers[pw_carry] = CR_NONE; player->jumping = 0; @@ -3835,7 +3844,7 @@ void P_DoJumpShield(player_t *player) player->pflags &= ~PF_JUMPED; player->secondjump = 0; player->jumping = 0; - player->pflags |= PF_THOKKED; + player->pflags |= PF_THOKKED|PF_SHIELDABILITY; player->pflags &= ~PF_SPINNING; P_SetPlayerMobjState(player->mo, S_PLAY_FALL); S_StartSound(player->mo, sfx_wdjump); @@ -6930,8 +6939,21 @@ static void P_MovePlayer(player_t *player) { if (!(player->pflags & PF_THOKKED)) { - player->pflags |= PF_THOKKED|PF_SHIELDABILITY; - S_StartSound(player->mo, sfx_ding); + angle_t dashangle = player->mo->angle; + if (player->cmd.forwardmove || player->cmd.sidemove) + { + dashangle += R_PointToAngle2(0, 0, player->cmd.forwardmove<cmd.sidemove<homing = 2; + if ((player->powers[pw_shield] & SH_NOSTACK) - SH_FORCE) + player->homing++; + S_StartSound(player->mo, sfx_s3k47); + P_SetPlayerMobjState(player->mo, S_PLAY_SPIN); + player->pflags |= PF_SPINNING|PF_THOKKED|PF_SHIELDABILITY; + player->mo->flags |= MF_NOGRAVITY; + P_InstaThrust(player->mo, dashangle, 64*FRACUNIT); + player->mo->momz = 0; } } } @@ -6950,7 +6972,25 @@ static void P_MovePlayer(player_t *player) } // HOMING option. - if ((player->powers[pw_shield] & SH_NOSTACK) == SH_ATTRACT + if ((player->powers[pw_shield] & SH_FORCE) == SH_FORCE // Dash. + && player->pflags & PF_SHIELDABILITY) + { + if (player->homing) + { + player->pflags |= PF_FULLSTASIS; + player->mo->momz = 0; + if (!(player->pflags & PF_SPINNING)) + player->homing = 0; + } + + if (player->homing == 0) + { + P_ResetPlayer(player); + player->mo->momx >>= 3; + player->mo->momy >>= 3; + } + } + else if ((player->powers[pw_shield] & SH_NOSTACK) == SH_ATTRACT // Sonic 3D Blast. && player->pflags & PF_SHIELDABILITY) { if (player->homing && player->mo->tracer) @@ -6969,7 +7009,7 @@ static void P_MovePlayer(player_t *player) if (!(player->pflags & PF_JUMPED)) player->homing = 0; } - else if (player->charability == CA_HOMINGTHOK) + else if (player->charability == CA_HOMINGTHOK) // Sonic Adventure. { // If you've got a target, chase after it! if (player->homing && player->mo->tracer) @@ -9185,7 +9225,7 @@ void P_PlayerThink(player_t *player) player->losstime--; // Flash player after being hit. - if (player->powers[pw_flashing] > 0 && player->powers[pw_flashing] < flashingtics && (leveltime & 1)) + if ((player->powers[pw_flashing] > 0 && player->powers[pw_flashing] < flashingtics && (leveltime & 1)) || ((player->powers[pw_shield] & SH_FORCE) == SH_FORCE && player->pflags & PF_SHIELDABILITY)) player->mo->flags2 |= MF2_DONTDRAW; else player->mo->flags2 &= ~MF2_DONTDRAW; From accd8bc5bd7f1e58f343b1945155de9e69728be2 Mon Sep 17 00:00:00 2001 From: toasterbabe Date: Thu, 29 Sep 2016 20:36:08 +0100 Subject: [PATCH 021/172] Minor fixes. Notably - no longer "deletes gravity" when hitting a slope mid-dash. --- src/p_mobj.c | 5 +++++ src/p_user.c | 4 +--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/p_mobj.c b/src/p_mobj.c index 7092e7d81..dcc2ff18b 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -3214,6 +3214,11 @@ static void P_PlayerZMovement(mobj_t *mo) P_ElementalFire(mo->player, true); } } + else if ((mo->player->powers[pw_shield] & SH_FORCE) == SH_FORCE) // Force shield's dodge dash. + { + mo->flags &= ~MF_NOGRAVITY; + mo->player->pflags &= ~PF_FULLSTASIS; + } } mo->player->pflags &= ~(PF_THOKKED|PF_CANCARRY|PF_SHIELDABILITY/*|PF_GLIDING*/); mo->player->jumping = 0; diff --git a/src/p_user.c b/src/p_user.c index 409ee9b45..a00c76b79 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -6945,9 +6945,7 @@ static void P_MovePlayer(player_t *player) dashangle += R_PointToAngle2(0, 0, player->cmd.forwardmove<cmd.sidemove<homing = 2; - if ((player->powers[pw_shield] & SH_NOSTACK) - SH_FORCE) - player->homing++; + player->homing = 2 + ((player->powers[pw_shield] & SH_NOSTACK) - SH_FORCE); S_StartSound(player->mo, sfx_s3k47); P_SetPlayerMobjState(player->mo, S_PLAY_SPIN); player->pflags |= PF_SPINNING|PF_THOKKED|PF_SHIELDABILITY; From 34d56561e46ab7715fddbf43da86cb50d2567b9a Mon Sep 17 00:00:00 2001 From: toasterbabe Date: Thu, 29 Sep 2016 20:44:05 +0100 Subject: [PATCH 022/172] Fixed MORE problems with landing on slopes. --- src/p_mobj.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/p_mobj.c b/src/p_mobj.c index dcc2ff18b..dcc18587d 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -3216,8 +3216,11 @@ static void P_PlayerZMovement(mobj_t *mo) } else if ((mo->player->powers[pw_shield] & SH_FORCE) == SH_FORCE) // Force shield's dodge dash. { + P_SetPlayerMobjState(mo, S_PLAY_WALK); mo->flags &= ~MF_NOGRAVITY; - mo->player->pflags &= ~PF_FULLSTASIS; + mo->player->pflags &= ~(PF_FULLSTASIS|PF_SPINNING); + mo->momx >>= 3; + mo->momy >>= 3; } } mo->player->pflags &= ~(PF_THOKKED|PF_CANCARRY|PF_SHIELDABILITY/*|PF_GLIDING*/); From 3eb3caacd54432df4140465ebeac94a2374825f0 Mon Sep 17 00:00:00 2001 From: toasterbabe Date: Thu, 29 Sep 2016 21:25:15 +0100 Subject: [PATCH 023/172] Tweaked the elemental shield's piercing ability. Specifically: * The spinfire ring is now capable of damaging enemies. (god, what a terrible hack this is) * When ground pounding, you now bounce off the floor a little bit to make the ability less spammable. --- src/p_mobj.c | 28 ++++++++++++++++++++-------- src/p_user.c | 2 +- 2 files changed, 21 insertions(+), 9 deletions(-) diff --git a/src/p_mobj.c b/src/p_mobj.c index dcc18587d..ede8b4b63 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -2579,11 +2579,15 @@ static boolean P_ZMovement(mobj_t *mo) P_RemoveMobj(mo); return false; } - if (mo->z <= mo->floorz && mo->momz) + if (mo->momz + && !(mo->flags & MF_NOGRAVITY) + && ((!(mo->eflags & MFE_VERTICALFLIP) && mo->z <= mo->floorz) + || ((mo->eflags & MFE_VERTICALFLIP) && mo->z+mo->height >= mo->ceilingz))) { mo->flags |= MF_NOGRAVITY; - mo->momx = mo->momy = mo->momz = 0; - mo->z = mo->floorz; + mo->momx = 8; // this is a hack which is used to ensure it still behaves as a missile and can damage others + mo->momy = mo->momz = 0; + mo->z = ((mo->eflags & MFE_VERTICALFLIP) ? mo->ceilingz-mo->height : mo->floorz); } break; case MT_GOOP: @@ -3071,6 +3075,8 @@ static void P_PlayerZMovement(mobj_t *mo) if (P_MobjFlip(mo)*mo->momz < 0) // falling { + boolean clipmomz = true; + mo->pmomz = 0; // We're on a new floor, don't keep doing platform movement. // Squat down. Decrease viewheight for a moment after hitting the ground (hard), @@ -3213,6 +3219,9 @@ static void P_PlayerZMovement(mobj_t *mo) S_StartSound(mo, sfx_s3k47); P_ElementalFire(mo->player, true); } + P_SetObjectMomZ(mo, 5*FRACUNIT/2, false); + P_SetPlayerMobjState(mo, S_PLAY_FALL); + clipmomz = false; } else if ((mo->player->powers[pw_shield] & SH_FORCE) == SH_FORCE) // Force shield's dodge dash. { @@ -3234,11 +3243,14 @@ static void P_PlayerZMovement(mobj_t *mo) if (!(mo->player->pflags & PF_SPINNING)) mo->player->pflags &= ~PF_STARTDASH; - if (tmfloorthing && (tmfloorthing->flags & (MF_PUSHABLE|MF_MONITOR) - || tmfloorthing->flags2 & MF2_STANDONME || tmfloorthing->type == MT_PLAYER)) - mo->momz = tmfloorthing->momz; - else if (!tmfloorthing) - mo->momz = 0; + if (clipmomz) + { + if (tmfloorthing && (tmfloorthing->flags & (MF_PUSHABLE|MF_MONITOR) + || tmfloorthing->flags2 & MF2_STANDONME || tmfloorthing->type == MT_PLAYER)) + mo->momz = tmfloorthing->momz; + else if (!tmfloorthing) + mo->momz = 0; + } } else if (tmfloorthing && (tmfloorthing->flags & (MF_PUSHABLE|MF_MONITOR) || tmfloorthing->flags2 & MF2_STANDONME || tmfloorthing->type == MT_PLAYER)) diff --git a/src/p_user.c b/src/p_user.c index a00c76b79..58af55fe5 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -6244,7 +6244,7 @@ void P_ElementalFire(player_t *player, boolean cropcircle) P_SetScale(flame, player->mo->scale); flame->eflags = (flame->eflags & ~MFE_VERTICALFLIP)|(player->mo->eflags & MFE_VERTICALFLIP); - flame->momx = 8; + flame->momx = 8; // this is a hack which is used to ensure it still behaves as a missile and can damage others P_XYMovement(flame); if (P_MobjWasRemoved(flame)) continue; From d6a404e1efdd1f187b1d801af32093843712036c Mon Sep 17 00:00:00 2001 From: toasterbabe Date: Fri, 30 Sep 2016 00:34:17 +0100 Subject: [PATCH 024/172] * On Mystic's reccomendation - an alternate method which has the direction to shoot off based on the direction you're moving, not the direction you're holding. * When not pressing any direction, you now go backwards by default - to emphasise that this is primarily for defensive, not offensive, purposes. * The camera can now handle the player going backwards without them going completely off-screen. * Fixed some overzealous checks. --- src/p_mobj.c | 2 +- src/p_user.c | 24 ++++++++++++++++-------- 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/src/p_mobj.c b/src/p_mobj.c index ede8b4b63..1df1541e9 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -3223,7 +3223,7 @@ static void P_PlayerZMovement(mobj_t *mo) P_SetPlayerMobjState(mo, S_PLAY_FALL); clipmomz = false; } - else if ((mo->player->powers[pw_shield] & SH_FORCE) == SH_FORCE) // Force shield's dodge dash. + else if (mo->player->powers[pw_shield] & SH_FORCE) // Force shield's dodge dash. { P_SetPlayerMobjState(mo, S_PLAY_WALK); mo->flags &= ~MF_NOGRAVITY; diff --git a/src/p_user.c b/src/p_user.c index 58af55fe5..369e6112e 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -868,7 +868,7 @@ void P_DoPlayerPain(player_t *player, mobj_t *source, mobj_t *inflictor) void P_ResetPlayer(player_t *player) { if (player->mo - && (player->powers[pw_shield] & SH_FORCE) == SH_FORCE // Dash. + && player->powers[pw_shield] & SH_FORCE // Dash. && player->pflags & PF_SHIELDABILITY) { P_SetPlayerMobjState(player->mo, S_PLAY_FALL); @@ -6935,17 +6935,22 @@ static void P_MovePlayer(player_t *player) } } // Force shield activation - if ((player->powers[pw_shield] & SH_FORCE) == SH_FORCE) + if (player->powers[pw_shield] & SH_FORCE) { if (!(player->pflags & PF_THOKKED)) { angle_t dashangle = player->mo->angle; - if (player->cmd.forwardmove || player->cmd.sidemove) - { +#if 1 // shadow.wad style redirection - hold down directional keys to set your path, go backwards by default + if (!(player->pflags & PF_ANALOGMODE) && (player->cmd.forwardmove || player->cmd.sidemove)) dashangle += R_PointToAngle2(0, 0, player->cmd.forwardmove<cmd.sidemove<mo->momx || player->mo->momy) + dashangle = R_PointToAngle2(0, 0, player->mo->momx, player->mo->momy); +#endif + dashangle += ANGLE_180; P_ResetPlayer(player); - player->homing = 2 + ((player->powers[pw_shield] & SH_NOSTACK) - SH_FORCE); + player->homing = 2 + ((player->powers[pw_shield] & SH_NOSTACK) - SH_FORCE); // might get ridiculous with 256 hitpoints, don't you think? S_StartSound(player->mo, sfx_s3k47); P_SetPlayerMobjState(player->mo, S_PLAY_SPIN); player->pflags |= PF_SPINNING|PF_THOKKED|PF_SHIELDABILITY; @@ -6970,7 +6975,7 @@ static void P_MovePlayer(player_t *player) } // HOMING option. - if ((player->powers[pw_shield] & SH_FORCE) == SH_FORCE // Dash. + if (player->powers[pw_shield] & SH_FORCE // Dash. && player->pflags & PF_SHIELDABILITY) { if (player->homing) @@ -8073,6 +8078,9 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall camheight = FixedMul(cv_cam2_height.value, FixedMul(player->camerascale, mo->scale)); } + if (player->powers[pw_shield] & SH_FORCE && player->pflags & PF_SHIELDABILITY) + camspeed <<= 1; + #ifdef REDSANALOG if (P_AnalogMove(player) && (player->cmd.buttons & (BT_CAMLEFT|BT_CAMRIGHT)) == (BT_CAMLEFT|BT_CAMRIGHT)) { camstill = true; @@ -9223,7 +9231,7 @@ void P_PlayerThink(player_t *player) player->losstime--; // Flash player after being hit. - if ((player->powers[pw_flashing] > 0 && player->powers[pw_flashing] < flashingtics && (leveltime & 1)) || ((player->powers[pw_shield] & SH_FORCE) == SH_FORCE && player->pflags & PF_SHIELDABILITY)) + if (player->powers[pw_flashing] > 0 && player->powers[pw_flashing] < flashingtics && (leveltime & 1)) player->mo->flags2 |= MF2_DONTDRAW; else player->mo->flags2 &= ~MF2_DONTDRAW; From 011af0daff10856faa6aeccb533377c46a010e19 Mon Sep 17 00:00:00 2001 From: toasterbabe Date: Fri, 30 Sep 2016 12:15:22 +0100 Subject: [PATCH 025/172] Tweaks to some sections of the code that recognise what shields the player has. Specifically: * introducing the new friend, SH_FORCEHP (which is used as a bitmask to get the extra hitpoints of a force-shield user) * P_DamageMobj now considers the unimplemented shield constants as well as the implemented ones. --- src/d_player.h | 1 + src/p_inter.c | 14 +++++++++++--- src/p_mobj.c | 4 ++-- src/p_user.c | 4 ++-- src/st_stuff.c | 2 +- 5 files changed, 17 insertions(+), 8 deletions(-) diff --git a/src/d_player.h b/src/d_player.h index e80ac387c..c24990eb5 100644 --- a/src/d_player.h +++ b/src/d_player.h @@ -196,6 +196,7 @@ typedef enum SH_FIREFLOWER = 0x100, // The force shield uses the lower 8 bits to count how many hits are left. SH_FORCE = 0x200, + SH_FORCEHP = 0xFF, // to be used as a bitmask only SH_STACK = SH_FIREFLOWER, SH_NOSTACK = ~SH_STACK diff --git a/src/p_inter.c b/src/p_inter.c index ece8f25e1..c6f7bb310 100644 --- a/src/p_inter.c +++ b/src/p_inter.c @@ -2972,20 +2972,28 @@ boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 da if (!(target->player->pflags & (PF_NIGHTSMODE|PF_NIGHTSFALL)) && (maptol & TOL_NIGHTS)) return false; +#define shieldtype (player->powers[pw_shield] & SH_NOSTACK) switch (damagetype) { case DMG_WATER: + if (shieldtype == SH_BUBBLEWRAP + || shieldtype == SH_ELEMENTAL) + return false; // Invincible to water damage + break; case DMG_FIRE: - if ((player->powers[pw_shield] & SH_NOSTACK) == SH_ELEMENTAL) - return false; // Invincible to water/fire damage + if (shieldtype == SH_FLAMEAURA + || shieldtype == SH_ELEMENTAL) + return false; // Invincible to fire damage break; case DMG_ELECTRIC: - if ((player->powers[pw_shield] & SH_NOSTACK) == SH_ATTRACT) + if (shieldtype == SH_ATTRACT + || shieldtype == SH_THUNDERCOIN) return false; // Invincible to electric damage break; default: break; } +#undef shieldtype } if (player->pflags & PF_NIGHTSMODE) // NiGHTS damage handling diff --git a/src/p_mobj.c b/src/p_mobj.c index 1df1541e9..e40fce499 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -6326,9 +6326,9 @@ static boolean P_ShieldLook(mobj_t *thing, shieldtype_t shield) return false; } - if (shield == SH_FORCE && thing->movecount != (thing->target->player->powers[pw_shield] & 0xFF)) + if (shield == SH_FORCE && thing->movecount != (thing->target->player->powers[pw_shield] & SH_FORCEHP)) { - thing->movecount = (thing->target->player->powers[pw_shield] & 0xFF); + thing->movecount = (thing->target->player->powers[pw_shield] & SH_FORCEHP); if (thing->movecount < 1) { if (thing->info->painstate) diff --git a/src/p_user.c b/src/p_user.c index 369e6112e..ca6bb9632 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -1392,7 +1392,7 @@ void P_SpawnShieldOrb(player_t *player) if (player->powers[pw_shield] & SH_FORCE) { //Copy and pasted from P_ShieldLook in p_mobj.c - shieldobj->movecount = (player->powers[pw_shield] & 0xFF); + shieldobj->movecount = (player->powers[pw_shield] & SH_FORCEHP); if (shieldobj->movecount < 1) { if (shieldobj->info->painstate) @@ -6950,7 +6950,7 @@ static void P_MovePlayer(player_t *player) #endif dashangle += ANGLE_180; P_ResetPlayer(player); - player->homing = 2 + ((player->powers[pw_shield] & SH_NOSTACK) - SH_FORCE); // might get ridiculous with 256 hitpoints, don't you think? + player->homing = 2 + (player->powers[pw_shield] & SH_FORCEHP); // might get ridiculous with 256 hitpoints, don't you think? S_StartSound(player->mo, sfx_s3k47); P_SetPlayerMobjState(player->mo, S_PLAY_SPIN); player->pflags |= PF_SPINNING|PF_THOKKED|PF_SHIELDABILITY; diff --git a/src/st_stuff.c b/src/st_stuff.c index 43d2bd176..8f36d5128 100644 --- a/src/st_stuff.c +++ b/src/st_stuff.c @@ -800,7 +800,7 @@ static void ST_drawFirstPersonHUD(void) // Graue 06-18-2004: no V_NOSCALESTART, no SCX, no SCY, snap to right if (player->powers[pw_shield] & SH_FORCE) { - if ((player->powers[pw_shield] & 0xFF) > 0 || leveltime & 1) + if ((player->powers[pw_shield] & SH_FORCEHP) > 0 || leveltime & 1) p = forceshield; } else switch (player->powers[pw_shield] & SH_NOSTACK) From f1fb276e5ac9f91efdd65a7db245aaad83780ca8 Mon Sep 17 00:00:00 2001 From: toasterbabe Date: Fri, 30 Sep 2016 13:48:33 +0100 Subject: [PATCH 026/172] Fixed a bug where using your shield ability just before your shield changed got you stuck in whatever state it left you. To do that, P_SwitchShield was born! Don't use with Force. --- src/p_enemy.c | 37 +++++++++++++++---------------------- src/p_local.h | 1 + src/p_user.c | 24 ++++++++++++++++++++++++ 3 files changed, 40 insertions(+), 22 deletions(-) diff --git a/src/p_enemy.c b/src/p_enemy.c index 4c4fa5857..bbdc22116 100644 --- a/src/p_enemy.c +++ b/src/p_enemy.c @@ -3058,11 +3058,7 @@ void A_JumpShield(mobj_t *actor) player = actor->target->player; - if ((player->powers[pw_shield] & SH_NOSTACK) != SH_JUMP) - { - player->powers[pw_shield] = SH_JUMP|(player->powers[pw_shield] & SH_STACK); - P_SpawnShieldOrb(player); - } + P_SwitchShield(player, SH_JUMP); S_StartSound(player->mo, actor->info->seesound); } @@ -3090,11 +3086,7 @@ void A_RingShield(mobj_t *actor) player = actor->target->player; - if ((player->powers[pw_shield] & SH_NOSTACK) != SH_ATTRACT) - { - player->powers[pw_shield] = SH_ATTRACT|(player->powers[pw_shield] & SH_STACK); - P_SpawnShieldOrb(player); - } + P_SwitchShield(player, SH_ATTRACT); S_StartSound(player->mo, actor->info->seesound); } @@ -3296,8 +3288,8 @@ void A_BombShield(mobj_t *actor) P_BlackOw(player); // Now we know for certain that we don't have a bomb shield, so add one. :3 - player->powers[pw_shield] = SH_BOMB|(player->powers[pw_shield] & SH_STACK); - P_SpawnShieldOrb(player); + P_SwitchShield(player, SH_BOMB); + S_StartSound(player->mo, actor->info->seesound); } @@ -3324,11 +3316,7 @@ void A_WaterShield(mobj_t *actor) player = actor->target->player; - if ((player->powers[pw_shield] & SH_NOSTACK) != SH_ELEMENTAL) - { - player->powers[pw_shield] = SH_ELEMENTAL|(player->powers[pw_shield] & SH_STACK); - P_SpawnShieldOrb(player); - } + P_SwitchShield(player, SH_ELEMENTAL); if (player->powers[pw_underwater] && player->powers[pw_underwater] <= 12*TICRATE + 1) P_RestoreMusic(player); @@ -3366,8 +3354,17 @@ void A_ForceShield(mobj_t *actor) player = actor->target->player; + //can't use P_SwitchShield(player, SH_FORCE) - special case + if (!(player->powers[pw_shield] & SH_FORCE)) { + // Just in case. + if (player->pflags & PF_SHIELDABILITY) + { + player->pflags &= ~PF_SHIELDABILITY; + player->homing = 0; + } + player->powers[pw_shield] = SH_FORCE|(player->powers[pw_shield] & SH_STACK)|0x01; P_SpawnShieldOrb(player); } @@ -3404,11 +3401,7 @@ void A_PityShield(mobj_t *actor) player = actor->target->player; - if ((player->powers[pw_shield] & SH_NOSTACK) != SH_PITY) - { - player->powers[pw_shield] = SH_PITY+(player->powers[pw_shield] & SH_STACK); - P_SpawnShieldOrb(player); - } + P_SwitchShield(player, SH_PITY); S_StartSound(player->mo, actor->info->seesound); } diff --git a/src/p_local.h b/src/p_local.h index 3541a3fb0..e64a8dd43 100644 --- a/src/p_local.h +++ b/src/p_local.h @@ -142,6 +142,7 @@ boolean P_InQuicksand(mobj_t *mo); void P_SetObjectMomZ(mobj_t *mo, fixed_t value, boolean relative); void P_RestoreMusic(player_t *player); void P_SpawnShieldOrb(player_t *player); +void P_SwitchShield(player_t *player, UINT16 shieldtype); mobj_t *P_SpawnGhostMobj(mobj_t *mobj); void P_GivePlayerRings(player_t *player, INT32 num_rings); void P_GivePlayerLives(player_t *player, INT32 numlives); diff --git a/src/p_user.c b/src/p_user.c index 3f7610add..47e59c211 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -1403,6 +1403,30 @@ void P_SpawnShieldOrb(player_t *player) } } +void P_SwitchShield(player_t *player, UINT16 shieldtype) +{ + if ((player->powers[pw_shield] & SH_NOSTACK) != shieldtype) + { + // Just in case. + if (player->pflags & PF_SHIELDABILITY) + { + player->pflags &= ~PF_SPINNING|PF_SHIELDABILITY; // They'll still have PF_THOKKED... + player->homing = 0; + if (player->powers[pw_shield] & SH_FORCE) // Dash. + { + P_SetPlayerMobjState(player->mo, S_PLAY_FALL); + player->mo->flags &= ~MF_NOGRAVITY; + player->pflags &= ~PF_FULLSTASIS; + player->mo->momx >>= 3; + player->mo->momy >>= 3; + } + } + + player->powers[pw_shield] = shieldtype|(player->powers[pw_shield] & SH_STACK); + P_SpawnShieldOrb(player); + } +} + // // P_SpawnGhostMobj // From cbe703478cc484357f84d7a6dfff2384cd6ec559 Mon Sep 17 00:00:00 2001 From: toasterbabe Date: Fri, 30 Sep 2016 13:56:19 +0100 Subject: [PATCH 027/172] Fixed another bug where you were able to use the whirlwind shield ability after using the force shield's dodge dash. --- src/p_user.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/p_user.c b/src/p_user.c index 47e59c211..2deeaf029 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -867,6 +867,8 @@ void P_DoPlayerPain(player_t *player, mobj_t *source, mobj_t *inflictor) // Useful when you want to kill everything the player is doing. void P_ResetPlayer(player_t *player) { + pflags_t removelist = (PF_SPINNING|PF_STARTDASH|PF_JUMPED|PF_GLIDING|PF_THOKKED|PF_CANCARRY|PF_SHIELDABILITY); + if (player->mo && player->powers[pw_shield] & SH_FORCE // Dash. && player->pflags & PF_SHIELDABILITY) @@ -874,9 +876,10 @@ void P_ResetPlayer(player_t *player) P_SetPlayerMobjState(player->mo, S_PLAY_FALL); player->mo->flags &= ~MF_NOGRAVITY; player->pflags &= ~PF_FULLSTASIS; + removelist &= ~PF_THOKKED; } - player->pflags &= ~(PF_SPINNING|PF_STARTDASH|PF_JUMPED|PF_GLIDING|PF_THOKKED|PF_CANCARRY|PF_SHIELDABILITY); + player->pflags &= ~removelist; player->powers[pw_carry] = CR_NONE; player->jumping = 0; player->secondjump = 0; From dc57a34213cb8eb6d63778e1092e93943fb99d92 Mon Sep 17 00:00:00 2001 From: toasterbabe Date: Fri, 30 Sep 2016 14:06:53 +0100 Subject: [PATCH 028/172] Revert "Fixed another bug where you were able to use the whirlwind shield ability after using the force shield's dodge dash." This reverts commit cbe703478cc484357f84d7a6dfff2384cd6ec559. --- src/p_user.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/p_user.c b/src/p_user.c index 2deeaf029..47e59c211 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -867,8 +867,6 @@ void P_DoPlayerPain(player_t *player, mobj_t *source, mobj_t *inflictor) // Useful when you want to kill everything the player is doing. void P_ResetPlayer(player_t *player) { - pflags_t removelist = (PF_SPINNING|PF_STARTDASH|PF_JUMPED|PF_GLIDING|PF_THOKKED|PF_CANCARRY|PF_SHIELDABILITY); - if (player->mo && player->powers[pw_shield] & SH_FORCE // Dash. && player->pflags & PF_SHIELDABILITY) @@ -876,10 +874,9 @@ void P_ResetPlayer(player_t *player) P_SetPlayerMobjState(player->mo, S_PLAY_FALL); player->mo->flags &= ~MF_NOGRAVITY; player->pflags &= ~PF_FULLSTASIS; - removelist &= ~PF_THOKKED; } - player->pflags &= ~removelist; + player->pflags &= ~(PF_SPINNING|PF_STARTDASH|PF_JUMPED|PF_GLIDING|PF_THOKKED|PF_CANCARRY|PF_SHIELDABILITY); player->powers[pw_carry] = CR_NONE; player->jumping = 0; player->secondjump = 0; From 4f79157a50404fc0ad4ca5b6738963fc56bdb6ba Mon Sep 17 00:00:00 2001 From: toasterbabe Date: Fri, 30 Sep 2016 14:12:26 +0100 Subject: [PATCH 029/172] Fixed that bug the wrong way, THIS is a much better solution for what I wanted to tweak. --- src/p_user.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/p_user.c b/src/p_user.c index 47e59c211..280b0d489 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -7013,6 +7013,7 @@ static void P_MovePlayer(player_t *player) if (player->homing == 0) { P_ResetPlayer(player); + player->pflags |= PF_THOKKED; // silly silly player->mo->momx >>= 3; player->mo->momy >>= 3; } From aa4fca0339252d60cc9d22d54caf9e6ceb74a482 Mon Sep 17 00:00:00 2001 From: toasterbabe Date: Fri, 30 Sep 2016 14:18:13 +0100 Subject: [PATCH 030/172] Added description to P_SwitchShield. --- src/p_user.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/p_user.c b/src/p_user.c index 280b0d489..4ff39a181 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -1403,6 +1403,15 @@ void P_SpawnShieldOrb(player_t *player) } } +// +// P_SwitchShield +// +// Handles the possibility of switching +// between shields thoroughly, then +// adds the desired one. +// +// Not for use if shieldtype would be SH_FORCE. +// void P_SwitchShield(player_t *player, UINT16 shieldtype) { if ((player->powers[pw_shield] & SH_NOSTACK) != shieldtype) From a694ebc348eea2f8bae33ce42d0827c9ce916530 Mon Sep 17 00:00:00 2001 From: toasterbabe Date: Fri, 30 Sep 2016 14:33:15 +0100 Subject: [PATCH 031/172] Fixed issue where holding spin when going into a non-horizontal spring would use your whirlwind shield ability immediately. --- src/p_user.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/p_user.c b/src/p_user.c index 4ff39a181..3659b1e92 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -3952,7 +3952,8 @@ static void P_DoJumpStuff(player_t *player, ticcmd_t *cmd) else if (onground || player->climbing || (player->mo->tracer && player->powers[pw_carry])) {} else if ((player->powers[pw_shield] & SH_NOSTACK) == SH_JUMP - && !(player->pflags & PF_JUMPED)) + && !(player->pflags & PF_JUMPED) + && !(player->pflags & PF_USEDOWN)) P_DoJumpShield(player); else if (!(player->pflags & PF_SLIDING) && ((gametype != GT_CTF) || (!player->gotflag))) { From 1c23a84aa531b02a1f62b6ea65f1896e249d904a Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Sun, 9 Oct 2016 20:55:04 +0100 Subject: [PATCH 032/172] set floorcenterz/ceilingcenterz for all of R_Subsector to use, not just FOF planes --- src/r_bsp.c | 47 ++++++++++++++++++++--------------------------- 1 file changed, 20 insertions(+), 27 deletions(-) diff --git a/src/r_bsp.c b/src/r_bsp.c index 69aa7be29..11159db3e 100644 --- a/src/r_bsp.c +++ b/src/r_bsp.c @@ -859,6 +859,7 @@ static void R_Subsector(size_t num) static sector_t tempsec; // Deep water hack extracolormap_t *floorcolormap; extracolormap_t *ceilingcolormap; + fixed_t floorcenterz, ceilingcenterz; #ifdef RANGECHECK if (num >= numsubsectors) @@ -879,6 +880,18 @@ static void R_Subsector(size_t num) floorcolormap = ceilingcolormap = frontsector->extra_colormap; + floorcenterz = +#ifdef ESLOPE + frontsector->f_slope ? P_GetZAt(frontsector->f_slope, frontsector->soundorg.x, frontsector->soundorg.y) : +#endif + frontsector->floorheight; + + ceilingcenterz = +#ifdef ESLOPE + frontsector->c_slope ? P_GetZAt(frontsector->c_slope, frontsector->soundorg.x, frontsector->soundorg.y) : +#endif + frontsector->ceilingheight; + // Check and prep all 3D floors. Set the sector floor/ceiling light levels and colormaps. if (frontsector->ffloors) { @@ -891,19 +904,11 @@ static void R_Subsector(size_t num) sub->sector->moved = frontsector->moved = false; } - light = R_GetPlaneLight(frontsector, -#ifdef ESLOPE - frontsector->f_slope ? P_GetZAt(frontsector->f_slope, frontsector->soundorg.x, frontsector->soundorg.y) : -#endif - frontsector->floorheight, false); + light = R_GetPlaneLight(frontsector, floorcenterz, false); if (frontsector->floorlightsec == -1) floorlightlevel = *frontsector->lightlist[light].lightlevel; floorcolormap = frontsector->lightlist[light].extra_colormap; - light = R_GetPlaneLight(frontsector, -#ifdef ESLOPE - frontsector->c_slope ? P_GetZAt(frontsector->c_slope, frontsector->soundorg.x, frontsector->soundorg.y) : -#endif - frontsector->ceilingheight, false); + light = R_GetPlaneLight(frontsector, ceilingcenterz, false); if (frontsector->ceilinglightsec == -1) ceilinglightlevel = *frontsector->lightlist[light].lightlevel; ceilingcolormap = frontsector->lightlist[light].extra_colormap; @@ -956,7 +961,7 @@ static void R_Subsector(size_t num) if (frontsector->ffloors) { ffloor_t *rover; - fixed_t heightcheck, planecenterz, floorcenterz, ceilingcenterz; + fixed_t heightcheck, planecenterz; for (rover = frontsector->ffloors; rover && numffloors < MAXFFLOORS; rover = rover->next) { @@ -975,18 +980,6 @@ static void R_Subsector(size_t num) ffloor[numffloors].plane = NULL; ffloor[numffloors].polyobj = NULL; - floorcenterz = -#ifdef ESLOPE - frontsector->f_slope ? P_GetZAt(frontsector->f_slope, frontsector->soundorg.x, frontsector->soundorg.y) : -#endif - frontsector->floorheight; - - ceilingcenterz = -#ifdef ESLOPE - frontsector->c_slope ? P_GetZAt(frontsector->c_slope, frontsector->soundorg.x, frontsector->soundorg.y) : -#endif - frontsector->ceilingheight; - heightcheck = #ifdef ESLOPE *rover->b_slope ? P_GetZAt(*rover->b_slope, viewx, viewy) : @@ -1093,8 +1086,8 @@ static void R_Subsector(size_t num) polysec = po->lines[0]->backsector; ffloor[numffloors].plane = NULL; - if (polysec->floorheight <= frontsector->ceilingheight - && polysec->floorheight >= frontsector->floorheight + if (polysec->floorheight <= ceilingcenterz + && polysec->floorheight >= floorcenterz && (viewz < polysec->floorheight)) { fixed_t xoff, yoff; @@ -1139,8 +1132,8 @@ static void R_Subsector(size_t num) ffloor[numffloors].plane = NULL; - if (polysec->ceilingheight >= frontsector->floorheight - && polysec->ceilingheight <= frontsector->ceilingheight + if (polysec->ceilingheight >= floorcenterz + && polysec->ceilingheight <= ceilingcenterz && (viewz > polysec->ceilingheight)) { fixed_t xoff, yoff; From b66925e467ca6cebbaa78fd21eb3e96898d2c8d2 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Sun, 9 Oct 2016 21:48:25 +0100 Subject: [PATCH 033/172] R_FindPlane now has a polyobj argument, R_DrawPlanes now skips polyobj planes, like it does with FOF planes --- src/r_bsp.c | 20 ++++++++++++++++++-- src/r_plane.c | 13 +++++++++++-- src/r_plane.h | 3 +++ 3 files changed, 32 insertions(+), 4 deletions(-) diff --git a/src/r_bsp.c b/src/r_bsp.c index 11159db3e..2562cff66 100644 --- a/src/r_bsp.c +++ b/src/r_bsp.c @@ -925,6 +925,9 @@ static void R_Subsector(size_t num) { floorplane = R_FindPlane(frontsector->floorheight, frontsector->floorpic, floorlightlevel, frontsector->floor_xoffs, frontsector->floor_yoffs, frontsector->floorpic_angle, floorcolormap, NULL +#ifdef POLYOBJECTS_PLANES + , NULL +#endif #ifdef ESLOPE , frontsector->f_slope #endif @@ -944,6 +947,9 @@ static void R_Subsector(size_t num) ceilingplane = R_FindPlane(frontsector->ceilingheight, frontsector->ceilingpic, ceilinglightlevel, frontsector->ceiling_xoffs, frontsector->ceiling_yoffs, frontsector->ceilingpic_angle, ceilingcolormap, NULL +#ifdef POLYOBJECTS_PLANES + , NULL +#endif #ifdef ESLOPE , frontsector->c_slope #endif @@ -1002,6 +1008,9 @@ static void R_Subsector(size_t num) ffloor[numffloors].plane = R_FindPlane(*rover->bottomheight, *rover->bottompic, *frontsector->lightlist[light].lightlevel, *rover->bottomxoffs, *rover->bottomyoffs, *rover->bottomangle, frontsector->lightlist[light].extra_colormap, rover +#ifdef POLYOBJECTS_PLANES + , NULL +#endif #ifdef ESLOPE , *rover->b_slope #endif @@ -1045,6 +1054,9 @@ static void R_Subsector(size_t num) ffloor[numffloors].plane = R_FindPlane(*rover->topheight, *rover->toppic, *frontsector->lightlist[light].lightlevel, *rover->topxoffs, *rover->topyoffs, *rover->topangle, frontsector->lightlist[light].extra_colormap, rover +#ifdef POLYOBJECTS_PLANES + , NULL +#endif #ifdef ESLOPE , *rover->t_slope #endif @@ -1111,11 +1123,13 @@ static void R_Subsector(size_t num) polysec->floorpic_angle-po->angle, NULL, NULL +#ifdef POLYOBJECTS_PLANES + , po +#endif #ifdef ESLOPE , NULL // will ffloors be slopable eventually? #endif ); - //ffloor[numffloors].plane->polyobj = po; ffloor[numffloors].height = polysec->floorheight; ffloor[numffloors].polyobj = po; @@ -1155,11 +1169,13 @@ static void R_Subsector(size_t num) ffloor[numffloors].plane = R_FindPlane(polysec->ceilingheight, polysec->ceilingpic, polysec->lightlevel, xoff, yoff, polysec->ceilingpic_angle-po->angle, NULL, NULL +#ifdef POLYOBJECTS_PLANES + , po +#endif #ifdef ESLOPE , NULL // will ffloors be slopable eventually? #endif ); - //ffloor[numffloors].plane->polyobj = po; ffloor[numffloors].polyobj = po; ffloor[numffloors].height = polysec->ceilingheight; diff --git a/src/r_plane.c b/src/r_plane.c index 19007d88f..b7b9eaff3 100644 --- a/src/r_plane.c +++ b/src/r_plane.c @@ -431,6 +431,9 @@ static visplane_t *new_visplane(unsigned hash) visplane_t *R_FindPlane(fixed_t height, INT32 picnum, INT32 lightlevel, fixed_t xoff, fixed_t yoff, angle_t plangle, extracolormap_t *planecolormap, ffloor_t *pfloor +#ifdef POLYOBJECTS_PLANES + , polyobj_t *polyobj +#endif #ifdef ESLOPE , pslope_t *slope #endif @@ -470,6 +473,8 @@ visplane_t *R_FindPlane(fixed_t height, INT32 picnum, INT32 lightlevel, #ifdef POLYOBJECTS_PLANES if (check->polyobj && pfloor) continue; + if (polyobj != check->polyobj) + continue; #endif if (height == check->height && picnum == check->picnum && lightlevel == check->lightlevel @@ -504,7 +509,7 @@ visplane_t *R_FindPlane(fixed_t height, INT32 picnum, INT32 lightlevel, check->viewangle = viewangle; check->plangle = plangle; #ifdef POLYOBJECTS_PLANES - check->polyobj = NULL; + check->polyobj = polyobj; #endif #ifdef ESLOPE check->slope = slope; @@ -719,7 +724,11 @@ void R_DrawPlanes(void) continue; } - if (pl->ffloor != NULL) + if (pl->ffloor != NULL +#ifdef POLYOBJECTS_PLANES + || pl->polyobj != NULL +#endif + ) continue; R_DrawSinglePlane(pl); diff --git a/src/r_plane.h b/src/r_plane.h index ec1940716..16c8c12a4 100644 --- a/src/r_plane.h +++ b/src/r_plane.h @@ -97,6 +97,9 @@ void R_MakeSpans(INT32 x, INT32 t1, INT32 b1, INT32 t2, INT32 b2); void R_DrawPlanes(void); visplane_t *R_FindPlane(fixed_t height, INT32 picnum, INT32 lightlevel, fixed_t xoff, fixed_t yoff, angle_t plangle, extracolormap_t *planecolormap, ffloor_t *ffloor +#ifdef POLYOBJECTS_PLANES + , polyobj_t *polyobj +#endif #ifdef ESLOPE , pslope_t *slope #endif From ff0b1d1dface10ab11357eee5a0a1fe66ad23403 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Tue, 11 Oct 2016 22:35:46 +0100 Subject: [PATCH 034/172] Split polyobj plane drawnode-creating code from ds->maskedtexturecol code, and add plane bounds checking --- src/r_things.c | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/src/r_things.c b/src/r_things.c index 22551a02d..ed1ddeab9 100644 --- a/src/r_things.c +++ b/src/r_things.c @@ -1699,21 +1699,25 @@ static void R_CreateDrawNodes(void) entry->ffloor = ds->thicksides[i]; } } +#ifdef POLYOBJECTS_PLANES + // Check for a polyobject plane, but only if this is a front line + if (ds->curline->polyseg && ds->curline->polyseg->visplane && !ds->curline->side) { + plane = ds->curline->polyseg->visplane; + R_PlaneBounds(plane); + + if (plane->low < con_clipviewtop || plane->high > vid.height || plane->high > plane->low) + ; + else { + // Put it in! + entry = R_CreateDrawNode(&nodehead); + entry->plane = plane; + entry->seg = ds; + } + ds->curline->polyseg->visplane = NULL; + } +#endif if (ds->maskedtexturecol) { -#ifdef POLYOBJECTS_PLANES - // Check for a polyobject plane, but only if this is a front line - if (ds->curline->polyseg && ds->curline->polyseg->visplane && !ds->curline->side) { - // Put it in! - - entry = R_CreateDrawNode(&nodehead); - entry->plane = ds->curline->polyseg->visplane; - entry->seg = ds; - ds->curline->polyseg->visplane->polyobj = ds->curline->polyseg; - ds->curline->polyseg->visplane = NULL; - } -#endif - entry = R_CreateDrawNode(&nodehead); entry->seg = ds; } From 64a1fa54219c9fa2e2fa61fb2b2b68e4fe67f6ce Mon Sep 17 00:00:00 2001 From: toasterbabe Date: Tue, 11 Oct 2016 23:35:31 +0100 Subject: [PATCH 035/172] Players are half height in Mario mode when they don't have any shields, the Mario mode pity shield is invisible, and Mario mode players immediately get a pity shield when they lose any other type of shield. So basically that's a Red Mushroom, right? https://gfycat.com/ThoughtfulAcademicChrysalis --- src/d_player.h | 10 +++++----- src/p_enemy.c | 28 ++++++++++++++++------------ src/p_inter.c | 5 ++++- src/p_local.h | 8 +++++--- src/p_user.c | 6 ++++-- src/r_things.c | 13 ++++++++++++- 6 files changed, 46 insertions(+), 24 deletions(-) diff --git a/src/d_player.h b/src/d_player.h index c24990eb5..91520293d 100644 --- a/src/d_player.h +++ b/src/d_player.h @@ -192,12 +192,12 @@ typedef enum SH_FLAMEAURA, // Pity shield: the world's most basic shield ever, given to players who suck at Match SH_PITY, - // The fireflower is special, it combines with other shields. - SH_FIREFLOWER = 0x100, - // The force shield uses the lower 8 bits to count how many hits are left. - SH_FORCE = 0x200, + // The force shield uses the lower 8 bits to count how many extra hits are left. + SH_FORCE = 0x100, SH_FORCEHP = 0xFF, // to be used as a bitmask only - + // The fireflower is special... + SH_FIREFLOWER = 0x200, + // ...it can combine with other shields. SH_STACK = SH_FIREFLOWER, SH_NOSTACK = ~SH_STACK } shieldtype_t; // pw_shield diff --git a/src/p_enemy.c b/src/p_enemy.c index 5ab83b4a8..80372ce5f 100644 --- a/src/p_enemy.c +++ b/src/p_enemy.c @@ -3058,9 +3058,9 @@ void A_JumpShield(mobj_t *actor) player = actor->target->player; - P_SwitchShield(player, SH_JUMP); - S_StartSound(player->mo, actor->info->seesound); + + P_SwitchShield(player, SH_JUMP); } // Function: A_RingShield @@ -3086,9 +3086,9 @@ void A_RingShield(mobj_t *actor) player = actor->target->player; - P_SwitchShield(player, SH_ATTRACT); - S_StartSound(player->mo, actor->info->seesound); + + P_SwitchShield(player, SH_ATTRACT); } // Function: A_RingBox @@ -3287,10 +3287,10 @@ void A_BombShield(mobj_t *actor) if ((player->powers[pw_shield] & SH_NOSTACK) == SH_BOMB) P_BlackOw(player); + S_StartSound(player->mo, actor->info->seesound); + // Now we know for certain that we don't have a bomb shield, so add one. :3 P_SwitchShield(player, SH_BOMB); - - S_StartSound(player->mo, actor->info->seesound); } // Function: A_WaterShield @@ -3316,6 +3316,8 @@ void A_WaterShield(mobj_t *actor) player = actor->target->player; + S_StartSound(player->mo, actor->info->seesound); + P_SwitchShield(player, SH_ELEMENTAL); if (player->powers[pw_underwater] && player->powers[pw_underwater] <= 12*TICRATE + 1) @@ -3328,7 +3330,6 @@ void A_WaterShield(mobj_t *actor) player->powers[pw_spacetime] = 0; P_RestoreMusic(player); } - S_StartSound(player->mo, actor->info->seesound); } // Function: A_ForceShield @@ -3354,6 +3355,8 @@ void A_ForceShield(mobj_t *actor) player = actor->target->player; + S_StartSound(player->mo, actor->info->seesound); + //can't use P_SwitchShield(player, SH_FORCE) - special case if (!(player->powers[pw_shield] & SH_FORCE)) @@ -3370,8 +3373,6 @@ void A_ForceShield(mobj_t *actor) } else player->powers[pw_shield] = SH_FORCE|(player->powers[pw_shield] & SH_STACK)|0x01; - - S_StartSound(player->mo, actor->info->seesound); } // Function: A_PityShield @@ -3401,9 +3402,11 @@ void A_PityShield(mobj_t *actor) player = actor->target->player; - P_SwitchShield(player, SH_PITY); - S_StartSound(player->mo, actor->info->seesound); + + if (player->powers[pw_shield] && mariomode) return; + + P_SwitchShield(player, SH_PITY); } @@ -3429,9 +3432,10 @@ void A_GravityBox(mobj_t *actor) } player = actor->target->player; - player->powers[pw_gravityboots] = (UINT16)(actor->info->reactiontime + 1); S_StartSound(player, actor->info->activesound); + + player->powers[pw_gravityboots] = (UINT16)(actor->info->reactiontime + 1); } // Function: A_ScoreRise diff --git a/src/p_inter.c b/src/p_inter.c index 992141fb0..8ae97b831 100644 --- a/src/p_inter.c +++ b/src/p_inter.c @@ -2735,9 +2735,10 @@ static inline void P_SuperDamage(player_t *player, mobj_t *inflictor, mobj_t *so void P_RemoveShield(player_t *player) { + boolean willbetallmario = (mariomode && ((player->powers[pw_shield] & SH_NOSTACK) != SH_PITY)); if (player->powers[pw_shield] & SH_FORCE) { // Multi-hit - if ((player->powers[pw_shield] & 0xFF) == 0) + if ((player->powers[pw_shield] & SH_FORCEHP) == 0) player->powers[pw_shield] &= ~SH_FORCE; else player->powers[pw_shield]--; @@ -2759,6 +2760,8 @@ void P_RemoveShield(player_t *player) } else player->powers[pw_shield] = player->powers[pw_shield] & SH_STACK; + if (willbetallmario && !player->powers[pw_shield]) + player->powers[pw_shield] |= SH_PITY; } static void P_ShieldDamage(player_t *player, mobj_t *inflictor, mobj_t *source, INT32 damage) diff --git a/src/p_local.h b/src/p_local.h index e64a8dd43..09848aa51 100644 --- a/src/p_local.h +++ b/src/p_local.h @@ -59,11 +59,13 @@ #define AIMINGTOSLOPE(aiming) FINESINE((aiming>>ANGLETOFINESHIFT) & FINEMASK) -#define mariomode (maptol & TOL_MARIO) #define twodlevel (maptol & TOL_2D) -#define P_GetPlayerHeight(player) FixedMul(player->height, player->mo->scale) -#define P_GetPlayerSpinHeight(player) FixedMul(player->spinheight, player->mo->scale) +#define mariomode (maptol & TOL_MARIO) +#define shortmario(player) ((player && mariomode && !player->powers[pw_shield]) ? 1 : 0) + +#define P_GetPlayerHeight(player) (FixedMul(player->height, player->mo->scale) >> shortmario(player)) +#define P_GetPlayerSpinHeight(player) (FixedMul(player->spinheight, player->mo->scale) >> shortmario(player)) // // P_TICK diff --git a/src/p_user.c b/src/p_user.c index 177b8a2a7..2f076f59b 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -1367,6 +1367,8 @@ void P_SpawnShieldOrb(player_t *player) P_RemoveMobj(shieldobj); //kill the old one(s) } + if (orbtype == MT_PITYORB && mariomode) return; + shieldobj = P_SpawnMobj(player->mo->x, player->mo->y, player->mo->z, orbtype); P_SetTarget(&shieldobj->target, player->mo); shieldobj->color = (UINT8)shieldobj->info->painchance; @@ -8102,7 +8104,7 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall camstill = cv_cam_still.value; camrotate = cv_cam_rotate.value; camdist = FixedMul(cv_cam_dist.value, FixedMul(player->camerascale, mo->scale)); - camheight = FixedMul(cv_cam_height.value, FixedMul(player->camerascale, mo->scale)); + camheight = FixedMul(cv_cam_height.value, FixedMul(player->camerascale >> shortmario(player), mo->scale)); } else // Camera 2 { @@ -8110,7 +8112,7 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall camstill = cv_cam2_still.value; camrotate = cv_cam2_rotate.value; camdist = FixedMul(cv_cam2_dist.value, FixedMul(player->camerascale, mo->scale)); - camheight = FixedMul(cv_cam2_height.value, FixedMul(player->camerascale, mo->scale)); + camheight = FixedMul(cv_cam2_height.value, FixedMul(player->camerascale >> shortmario(player), mo->scale)); } if (player->powers[pw_shield] & SH_FORCE && player->pflags & PF_SHIELDABILITY) diff --git a/src/r_things.c b/src/r_things.c index e8aa2956f..18ec1570c 100644 --- a/src/r_things.c +++ b/src/r_things.c @@ -1128,6 +1128,8 @@ static void R_ProjectSprite(mobj_t *thing) fixed_t offset, offset2; boolean papersprite = !!(thing->frame & FF_PAPERSPRITE); + fixed_t shortmarioshift = shortmario(thing->player); + INT32 dispoffset = thing->info->dispoffset; //SoM: 3/17/2000 @@ -1317,6 +1319,12 @@ static void R_ProjectSprite(mobj_t *thing) xscale = FixedMul(xscale, ang_scale); + if (shortmarioshift) + { + yscale >>= shortmarioshift; + this_scale /= 2; + } + if ((thing->flags2 & MF2_LINKDRAW) && thing->tracer) // toast 16/09/16 (SYMMETRY) { fixed_t linkscale; @@ -1377,6 +1385,9 @@ static void R_ProjectSprite(mobj_t *thing) gz = gzt - FixedMul(spritecachedinfo[lump].height, this_scale); } + if (shortmarioshift) + this_scale *= 2; + if (thing->subsector->sector->cullheight) { if (R_DoCulling(thing->subsector->sector->cullheight, viewsector->cullheight, viewz, gz, gzt)) @@ -1442,7 +1453,7 @@ static void R_ProjectSprite(mobj_t *thing) vis->thingheight = thing->height; vis->pz = thing->z; vis->pzt = vis->pz + vis->thingheight; - vis->texturemid = vis->gzt - viewz; + vis->texturemid = (vis->gzt - viewz) << shortmarioshift; vis->scalestep = scalestep; vis->mobj = thing; // Easy access! Tails 06-07-2002 From a842d96a48c6f979d6c89027ffb38c4474f7e299 Mon Sep 17 00:00:00 2001 From: toasterbabe Date: Tue, 11 Oct 2016 23:35:31 +0100 Subject: [PATCH 036/172] Forgot to commit this change when moving everything over to shortmarioshifts. --- src/r_things.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/r_things.c b/src/r_things.c index 18ec1570c..13688740d 100644 --- a/src/r_things.c +++ b/src/r_things.c @@ -1322,7 +1322,7 @@ static void R_ProjectSprite(mobj_t *thing) if (shortmarioshift) { yscale >>= shortmarioshift; - this_scale /= 2; + this_scale >>= shortmarioshift; } if ((thing->flags2 & MF2_LINKDRAW) && thing->tracer) // toast 16/09/16 (SYMMETRY) @@ -1386,7 +1386,7 @@ static void R_ProjectSprite(mobj_t *thing) } if (shortmarioshift) - this_scale *= 2; + this_scale <<= shortmarioshift; if (thing->subsector->sector->cullheight) { From d4f0afa0d1689d91dccc1a85552ac73613c3d034 Mon Sep 17 00:00:00 2001 From: toasterbabe Date: Wed, 12 Oct 2016 17:55:07 +0100 Subject: [PATCH 037/172] A Heckloada Mario Stuff https://gfycat.com/MasculineSatisfiedAfricanwilddog and https://gfycat.com/PastCompetentGypsymoth describe this all in varying states of completion --- src/d_player.h | 1 + src/p_enemy.c | 6 +++ src/p_inter.c | 27 ++++++++-- src/p_local.h | 2 + src/p_mobj.c | 43 +++++++++++++++- src/p_user.c | 130 +++++++++++++++++++++++++++---------------------- src/r_things.c | 14 +++--- 7 files changed, 154 insertions(+), 69 deletions(-) diff --git a/src/d_player.h b/src/d_player.h index 91520293d..1fa101e12 100644 --- a/src/d_player.h +++ b/src/d_player.h @@ -227,6 +227,7 @@ typedef enum pw_underwater, // underwater timer pw_spacetime, // In space, no one can hear you spin! pw_extralife, // Extra Life timer + pw_marioflashing, // Getting/losing powerup pw_super, // Are you super? pw_gravityboots, // gravity boots diff --git a/src/p_enemy.c b/src/p_enemy.c index 80372ce5f..104e53f1e 100644 --- a/src/p_enemy.c +++ b/src/p_enemy.c @@ -3359,6 +3359,12 @@ void A_ForceShield(mobj_t *actor) //can't use P_SwitchShield(player, SH_FORCE) - special case + if (mariomode && player->mo) + { + player->mo->movecount = player->powers[pw_shield]; + player->powers[pw_marioflashing] = MARIOFLASHINGTICS; + } + if (!(player->powers[pw_shield] & SH_FORCE)) { // Just in case. diff --git a/src/p_inter.c b/src/p_inter.c index 8ae97b831..9c8885411 100644 --- a/src/p_inter.c +++ b/src/p_inter.c @@ -142,7 +142,7 @@ boolean P_CanPickupItem(player_t *player, boolean weapon) if (player->bot && weapon) return false; - if (player->powers[pw_flashing] > (flashingtics/4)*3 && player->powers[pw_flashing] <= flashingtics) + if (player->powers[pw_flashing] > (flashingtics/4)*3 && player->powers[pw_flashing] < UINT16_MAX) return false; return true; @@ -1138,6 +1138,13 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck) case MT_FIREFLOWER: if (player->bot) return; + if (mariomode) + { + toucher->movecount = player->powers[pw_shield]; + player->powers[pw_marioflashing] = MARIOFLASHINGTICS; + if ((player->powers[pw_shield] & SH_NOSTACK) == SH_PITY) + player->powers[pw_shield] &= SH_NOSTACK; + } player->powers[pw_shield] |= SH_FIREFLOWER; toucher->color = SKINCOLOR_WHITE; G_GhostAddColor(GHC_FIREFLOWER); @@ -1204,6 +1211,15 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck) S_StartSound(toucher, special->info->painsound); + if (mariomode && !player->powers[pw_shield]) + { + S_StartSound(toucher, sfx_mario3); + player->mo->movecount = player->powers[pw_shield]; + player->powers[pw_marioflashing] = MARIOFLASHINGTICS; + player->powers[pw_shield] = SH_PITY; + P_SpawnShieldOrb(player); + } + if (!(netgame && circuitmap && player != &players[consoleplayer])) P_SetMobjState(special, special->info->painstate); return; @@ -1997,6 +2013,9 @@ void P_KillMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, UINT8 damaget } target->flags2 &= ~MF2_DONTDRAW; + + if (mariomode) + target->player->powers[pw_marioflashing] = MARIOFLASHINGTICS; } // if killed by a player @@ -2773,7 +2792,9 @@ static void P_ShieldDamage(player_t *player, mobj_t *inflictor, mobj_t *source, P_ForceFeed(player, 40, 10, TICRATE, 40 + min(damage, 100)*2); - if (source && (source->type == MT_SPIKE || (source->type == MT_NULL && source->threshold == 43))) // spikes + if (mariomode) + S_StartSound(player->mo, sfx_mario8); + else if (source && (source->type == MT_SPIKE || (source->type == MT_NULL && source->threshold == 43))) // spikes S_StartSound(player->mo, sfx_spkdth); else S_StartSound (player->mo, sfx_shldls); // Ba-Dum! Shield loss. @@ -3134,7 +3155,7 @@ boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 da else { player->health -= damage; // mirror mobj health here - target->player->powers[pw_flashing] = flashingtics; + //target->player->powers[pw_flashing] = flashingtics; if (damage > 0) // don't spill emeralds/ammo/panels for shield damage P_PlayerRingBurst(player, damage); } diff --git a/src/p_local.h b/src/p_local.h index 09848aa51..041a2150d 100644 --- a/src/p_local.h +++ b/src/p_local.h @@ -64,6 +64,8 @@ #define mariomode (maptol & TOL_MARIO) #define shortmario(player) ((player && mariomode && !player->powers[pw_shield]) ? 1 : 0) +#define MARIOFLASHINGTICS 19 + #define P_GetPlayerHeight(player) (FixedMul(player->height, player->mo->scale) >> shortmario(player)) #define P_GetPlayerSpinHeight(player) (FixedMul(player->spinheight, player->mo->scale) >> shortmario(player)) diff --git a/src/p_mobj.c b/src/p_mobj.c index 1ae64bc60..95403995b 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -4061,6 +4061,40 @@ static void P_PlayerMobjThinker(mobj_t *mobj) I_Assert(mobj->player != NULL); I_Assert(!P_MobjWasRemoved(mobj)); + if (mobj->player->powers[pw_marioflashing]) + { + if (!mobj->player->powers[pw_nocontrol]++) + mobj->player->powers[pw_nocontrol]++; + + if (!(mobj->player->powers[pw_marioflashing] % 4)) + { + UINT16 shieldswitch = mobj->player->powers[pw_shield]; + mobj->player->powers[pw_shield] = mobj->movecount; + mobj->movecount = shieldswitch; + if ((mobj->player->powers[pw_shield] & SH_FIREFLOWER) != (mobj->movecount & SH_FIREFLOWER)) + { + if (mobj->player->powers[pw_shield] & SH_FIREFLOWER) + { + mobj->color = SKINCOLOR_WHITE; + G_GhostAddColor(GHC_FIREFLOWER); + } + else + { + mobj->color = mobj->player->skincolor; + G_GhostAddColor(GHC_NORMAL); + } + } + if (mobj->player->powers[pw_shield] & SH_NOSTACK && (mobj->player->powers[pw_shield] & SH_NOSTACK) != (mobj->movecount & SH_NOSTACK)) + P_SpawnShieldOrb(mobj->player); + } + + mobj->player->powers[pw_marioflashing]--; + if (mobj->player->powers[pw_flashing] && mobj->player->powers[pw_flashing] < UINT16_MAX && mobj->player->powers[pw_flashing] > flashingtics) + if (--(mobj->player->powers[pw_flashing]) == flashingtics) + mobj->player->powers[pw_flashing]--; + return; + } + P_MobjCheckWater(mobj); #ifdef ESLOPE @@ -6380,9 +6414,9 @@ static boolean P_ShieldLook(mobj_t *thing, shieldtype_t shield) thing->x = thing->target->x; thing->y = thing->target->y; if (thing->eflags & MFE_VERTICALFLIP) - thing->z = thing->target->z + thing->target->height - thing->height + FixedDiv(P_GetPlayerHeight(thing->target->player) - thing->target->height, 3*FRACUNIT) - FixedMul(2*FRACUNIT, thing->target->scale); + thing->z = thing->target->z + ((thing->target->height - thing->height + FixedDiv(P_GetPlayerHeight(thing->target->player) - thing->target->height, 3*FRACUNIT)) << shortmario(thing->target->player)) - FixedMul(2*FRACUNIT, thing->target->scale); else - thing->z = thing->target->z - FixedDiv(P_GetPlayerHeight(thing->target->player) - thing->target->height, 3*FRACUNIT) + FixedMul(2*FRACUNIT, thing->target->scale); + thing->z = thing->target->z - ((FixedDiv(P_GetPlayerHeight(thing->target->player) - thing->target->height, 3*FRACUNIT)) << shortmario(thing->target->player)) + FixedMul(2*FRACUNIT, thing->target->scale); P_SetThingPosition(thing); P_CheckPosition(thing, thing->x, thing->y); @@ -7091,6 +7125,11 @@ void P_MobjThinker(mobj_t *mobj) break; case MT_PLAYER: /// \todo Have the player's dead body completely finish its animation even if they've already respawned. + if (mobj->player && mobj->player->powers[pw_marioflashing]) + { + mobj->player->powers[pw_marioflashing]--; + return; // don't do any momz + } if (!(mobj->flags2 & MF2_DONTDRAW)) { if (!mobj->fuse) diff --git a/src/p_user.c b/src/p_user.c index 2f076f59b..1589d308a 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -790,59 +790,65 @@ boolean P_PlayerInPain(player_t *player) // void P_DoPlayerPain(player_t *player, mobj_t *source, mobj_t *inflictor) { - angle_t ang; - fixed_t fallbackspeed; - - if (player->mo->eflags & MFE_VERTICALFLIP) - player->mo->z--; - else - player->mo->z++; - - if (player->mo->eflags & MFE_UNDERWATER) - P_SetObjectMomZ(player->mo, FixedDiv(10511*FRACUNIT,2600*FRACUNIT), false); - else - P_SetObjectMomZ(player->mo, FixedDiv(69*FRACUNIT,10*FRACUNIT), false); - - if (inflictor) - { - ang = R_PointToAngle2(inflictor->x-inflictor->momx, inflictor->y - inflictor->momy, player->mo->x - player->mo->momx, player->mo->y - player->mo->momy); - - // explosion and rail rings send you farther back, making it more difficult - // to recover - if ((inflictor->flags2 & MF2_SCATTER) && source) - { - fixed_t dist = P_AproxDistance(P_AproxDistance(source->x-player->mo->x, source->y-player->mo->y), source->z-player->mo->z); - - dist = FixedMul(128*FRACUNIT, inflictor->scale) - dist/4; - - if (dist < FixedMul(4*FRACUNIT, inflictor->scale)) - dist = FixedMul(4*FRACUNIT, inflictor->scale); - - fallbackspeed = dist; - } - else if (inflictor->flags2 & MF2_EXPLOSION) - { - if (inflictor->flags2 & MF2_RAILRING) - fallbackspeed = FixedMul(38*FRACUNIT, inflictor->scale); // 7x - else - fallbackspeed = FixedMul(30*FRACUNIT, inflictor->scale); // 5x - } - else if (inflictor->flags2 & MF2_RAILRING) - fallbackspeed = FixedMul(45*FRACUNIT, inflictor->scale); // 4x - else - fallbackspeed = FixedMul(4*FRACUNIT, inflictor->scale); // the usual amount of force - } - else - { - ang = R_PointToAngle2(player->mo->momx, player->mo->momy, 0, 0); - fallbackspeed = FixedMul(4*FRACUNIT, player->mo->scale); - } - - P_InstaThrust(player->mo, ang, fallbackspeed); - if (player->powers[pw_carry] == CR_ROPEHANG) P_SetTarget(&player->mo->tracer, NULL); + if (!mariomode) + { + angle_t ang; + fixed_t fallbackspeed; + + P_ResetPlayer(player); + P_SetPlayerMobjState(player->mo, player->mo->info->painstate); + + if (player->mo->eflags & MFE_VERTICALFLIP) + player->mo->z--; + else + player->mo->z++; + + if (player->mo->eflags & MFE_UNDERWATER) + P_SetObjectMomZ(player->mo, FixedDiv(10511*FRACUNIT,2600*FRACUNIT), false); + else + P_SetObjectMomZ(player->mo, FixedDiv(69*FRACUNIT,10*FRACUNIT), false); + + if (inflictor) + { + ang = R_PointToAngle2(inflictor->x-inflictor->momx, inflictor->y - inflictor->momy, player->mo->x - player->mo->momx, player->mo->y - player->mo->momy); + + // explosion and rail rings send you farther back, making it more difficult + // to recover + if ((inflictor->flags2 & MF2_SCATTER) && source) + { + fixed_t dist = P_AproxDistance(P_AproxDistance(source->x-player->mo->x, source->y-player->mo->y), source->z-player->mo->z); + + dist = FixedMul(128*FRACUNIT, inflictor->scale) - dist/4; + + if (dist < FixedMul(4*FRACUNIT, inflictor->scale)) + dist = FixedMul(4*FRACUNIT, inflictor->scale); + + fallbackspeed = dist; + } + else if (inflictor->flags2 & MF2_EXPLOSION) + { + if (inflictor->flags2 & MF2_RAILRING) + fallbackspeed = FixedMul(38*FRACUNIT, inflictor->scale); // 7x + else + fallbackspeed = FixedMul(30*FRACUNIT, inflictor->scale); // 5x + } + else if (inflictor->flags2 & MF2_RAILRING) + fallbackspeed = FixedMul(45*FRACUNIT, inflictor->scale); // 4x + else + fallbackspeed = FixedMul(4*FRACUNIT, inflictor->scale); // the usual amount of force + } + else + { + ang = R_PointToAngle2(player->mo->momx, player->mo->momy, 0, 0); + fallbackspeed = FixedMul(4*FRACUNIT, player->mo->scale); + } + + P_InstaThrust(player->mo, ang, fallbackspeed); + } + // Point penalty for hitting a hazard during tag. // Discourages players from intentionally hurting themselves to avoid being tagged. if (gametype == GT_TAG && (!(player->pflags & PF_TAGGED) && !(player->pflags & PF_TAGIT))) @@ -853,9 +859,13 @@ void P_DoPlayerPain(player_t *player, mobj_t *source, mobj_t *inflictor) player->score = 0; } - P_ResetPlayer(player); - P_SetPlayerMobjState(player->mo, player->mo->info->painstate); player->powers[pw_flashing] = flashingtics; + if (mariomode) + { + player->powers[pw_marioflashing] = MARIOFLASHINGTICS; + player->powers[pw_flashing] += MARIOFLASHINGTICS; + player->mo->movecount = player->powers[pw_shield]; + } if (player->timeshit != UINT8_MAX) ++player->timeshit; @@ -1416,6 +1426,12 @@ void P_SpawnShieldOrb(player_t *player) // void P_SwitchShield(player_t *player, UINT16 shieldtype) { + if (mariomode && player->mo) + { + player->mo->movecount = player->powers[pw_shield]; + player->powers[pw_marioflashing] = MARIOFLASHINGTICS; + player->powers[pw_nocontrol] += MARIOFLASHINGTICS; + } if ((player->powers[pw_shield] & SH_NOSTACK) != shieldtype) { // Just in case. @@ -8104,7 +8120,7 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall camstill = cv_cam_still.value; camrotate = cv_cam_rotate.value; camdist = FixedMul(cv_cam_dist.value, FixedMul(player->camerascale, mo->scale)); - camheight = FixedMul(cv_cam_height.value, FixedMul(player->camerascale >> shortmario(player), mo->scale)); + camheight = FixedMul(cv_cam_height.value, FixedMul(player->camerascale, mo->scale)); } else // Camera 2 { @@ -8112,7 +8128,7 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall camstill = cv_cam2_still.value; camrotate = cv_cam2_rotate.value; camdist = FixedMul(cv_cam2_dist.value, FixedMul(player->camerascale, mo->scale)); - camheight = FixedMul(cv_cam2_height.value, FixedMul(player->camerascale >> shortmario(player), mo->scale)); + camheight = FixedMul(cv_cam2_height.value, FixedMul(player->camerascale, mo->scale)); } if (player->powers[pw_shield] & SH_FORCE && player->pflags & PF_SHIELDABILITY) @@ -8532,9 +8548,9 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall dist = FixedHypot(f1, f2); if (mo->eflags & MFE_VERTICALFLIP) - angle = R_PointToAngle2(0, thiscam->z + thiscam->height, dist, mo->z + mo->height - P_GetPlayerHeight(player)); + angle = R_PointToAngle2(0, thiscam->z + thiscam->height, dist, mo->z + mo->height - (P_GetPlayerHeight(player) << shortmario(player))); else - angle = R_PointToAngle2(0, thiscam->z, dist, mo->z + P_GetPlayerHeight(player)); + angle = R_PointToAngle2(0, thiscam->z, dist, mo->z + (P_GetPlayerHeight(player) << shortmario(player))); if (player->playerstate != PST_DEAD) angle += (focusaiming < ANGLE_180 ? focusaiming/2 : InvAngle(InvAngle(focusaiming)/2)); // overcomplicated version of '((signed)focusaiming)/2;' @@ -9268,7 +9284,7 @@ void P_PlayerThink(player_t *player) player->losstime--; // Flash player after being hit. - if (player->powers[pw_flashing] > 0 && player->powers[pw_flashing] < flashingtics && (leveltime & 1)) + if (player->powers[pw_flashing] > 0 && player->powers[pw_flashing] < flashingtics && (leveltime & 1) && !player->powers[pw_marioflashing]) player->mo->flags2 |= MF2_DONTDRAW; else player->mo->flags2 &= ~MF2_DONTDRAW; diff --git a/src/r_things.c b/src/r_things.c index 13688740d..823dda3ac 100644 --- a/src/r_things.c +++ b/src/r_things.c @@ -1319,12 +1319,6 @@ static void R_ProjectSprite(mobj_t *thing) xscale = FixedMul(xscale, ang_scale); - if (shortmarioshift) - { - yscale >>= shortmarioshift; - this_scale >>= shortmarioshift; - } - if ((thing->flags2 & MF2_LINKDRAW) && thing->tracer) // toast 16/09/16 (SYMMETRY) { fixed_t linkscale; @@ -1370,6 +1364,12 @@ static void R_ProjectSprite(mobj_t *thing) return; } + if (shortmarioshift) // squish mario + { + yscale >>= shortmarioshift; + this_scale >>= shortmarioshift; + } + //SoM: 3/17/2000: Disregard sprites that are out of view.. if (vflip) { @@ -1385,7 +1385,7 @@ static void R_ProjectSprite(mobj_t *thing) gz = gzt - FixedMul(spritecachedinfo[lump].height, this_scale); } - if (shortmarioshift) + if (shortmarioshift) // unsquish the x component this_scale <<= shortmarioshift; if (thing->subsector->sector->cullheight) From 71b7db4e0dfc017b6407a71ba73abd21983e2d09 Mon Sep 17 00:00:00 2001 From: toasterbabe Date: Wed, 12 Oct 2016 22:06:12 +0100 Subject: [PATCH 038/172] Refinements to flashing. --- src/p_local.h | 2 +- src/p_mobj.c | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/p_local.h b/src/p_local.h index 041a2150d..b1c9366c5 100644 --- a/src/p_local.h +++ b/src/p_local.h @@ -64,7 +64,7 @@ #define mariomode (maptol & TOL_MARIO) #define shortmario(player) ((player && mariomode && !player->powers[pw_shield]) ? 1 : 0) -#define MARIOFLASHINGTICS 19 +#define MARIOFLASHINGTICS 21 #define P_GetPlayerHeight(player) (FixedMul(player->height, player->mo->scale) >> shortmario(player)) #define P_GetPlayerSpinHeight(player) (FixedMul(player->spinheight, player->mo->scale) >> shortmario(player)) diff --git a/src/p_mobj.c b/src/p_mobj.c index 95403995b..de544362c 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -4066,7 +4066,7 @@ static void P_PlayerMobjThinker(mobj_t *mobj) if (!mobj->player->powers[pw_nocontrol]++) mobj->player->powers[pw_nocontrol]++; - if (!(mobj->player->powers[pw_marioflashing] % 4)) + if (!((--mobj->player->powers[pw_marioflashing] - 1) % 5)) { UINT16 shieldswitch = mobj->player->powers[pw_shield]; mobj->player->powers[pw_shield] = mobj->movecount; @@ -4088,7 +4088,6 @@ static void P_PlayerMobjThinker(mobj_t *mobj) P_SpawnShieldOrb(mobj->player); } - mobj->player->powers[pw_marioflashing]--; if (mobj->player->powers[pw_flashing] && mobj->player->powers[pw_flashing] < UINT16_MAX && mobj->player->powers[pw_flashing] > flashingtics) if (--(mobj->player->powers[pw_flashing]) == flashingtics) mobj->player->powers[pw_flashing]--; From dff9209bd2260a29bece503235764095b8cd7a3e Mon Sep 17 00:00:00 2001 From: toasterbabe Date: Wed, 12 Oct 2016 22:06:40 +0100 Subject: [PATCH 039/172] A fix for the thing where you can get stuck inside a Mario block that has a monitor in it. --- src/p_floor.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/p_floor.c b/src/p_floor.c index 8f51698cc..220b87572 100644 --- a/src/p_floor.c +++ b/src/p_floor.c @@ -1782,8 +1782,8 @@ static mobj_t *SearchMarioNode(msecnode_t *node) break; } // Ignore popped monitors, too. - if (node->m_thing->flags & MF_MONITOR - && node->m_thing->threshold == 68) + if (node->m_thing->health == 0 // this only really applies for monitors + || (!(node->m_thing->flags & MF_MONITOR) && (mobjinfo[node->m_thing->type].flags & MF_MONITOR))) // gold monitor support continue; // Okay, we found something valid. if (!thing // take either the first thing @@ -3156,15 +3156,15 @@ INT32 EV_MarioBlock(sector_t *sec, sector_t *roversector, fixed_t topheight, mob S_StartSound(puncher, sfx_mario9); // Puncher is "close enough" } - if (itsamonitor) + if (itsamonitor && thing) { - P_UnsetThingPosition(tmthing); - tmthing->x = oldx; - tmthing->y = oldy; - tmthing->z = oldz; - tmthing->momx = 1; - tmthing->momy = 1; - P_SetThingPosition(tmthing); + P_UnsetThingPosition(thing); + thing->x = oldx; + thing->y = oldy; + thing->z = oldz; + thing->momx = 1; + thing->momy = 1; + P_SetThingPosition(thing); } } else From a36912baef77220d62c88cbfd114c993ff594765 Mon Sep 17 00:00:00 2001 From: toasterbabe Date: Wed, 12 Oct 2016 23:47:18 +0100 Subject: [PATCH 040/172] In Mario mode... * shields give you 1000 points * redundant shields don't make you puase * checkpoints give you 2000 points * falling down a deathpit is just falling, not bouncing --- src/info.c | 2 +- src/p_enemy.c | 55 +++++++++++++++++++++------------ src/p_inter.c | 85 +++++++++++++++++++++++++++++++++------------------ src/p_local.h | 4 +-- src/p_mobj.c | 2 +- src/p_user.c | 21 ++++++++++--- 6 files changed, 111 insertions(+), 58 deletions(-) diff --git a/src/info.c b/src/info.c index f7ff3f13d..c27a606fb 100644 --- a/src/info.c +++ b/src/info.c @@ -12236,7 +12236,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = S_NULL, // missilestate S_NULL, // deathstate S_NULL, // xdeathstate - sfx_mario3, // deathsound + sfx_None, // deathsound 0, // speed 16*FRACUNIT, // radius 32*FRACUNIT, // height diff --git a/src/p_enemy.c b/src/p_enemy.c index 104e53f1e..dccc6a8ea 100644 --- a/src/p_enemy.c +++ b/src/p_enemy.c @@ -3058,9 +3058,10 @@ void A_JumpShield(mobj_t *actor) player = actor->target->player; - S_StartSound(player->mo, actor->info->seesound); - - P_SwitchShield(player, SH_JUMP); + if (P_SwitchShield(player, SH_JUMP)) + S_StartSound(player->mo, actor->info->seesound); + else if (mariomode) + S_StartSound(player->mo, sfx_itemup); } // Function: A_RingShield @@ -3086,9 +3087,10 @@ void A_RingShield(mobj_t *actor) player = actor->target->player; - S_StartSound(player->mo, actor->info->seesound); - - P_SwitchShield(player, SH_ATTRACT); + if (P_SwitchShield(player, SH_ATTRACT)) + S_StartSound(player->mo, actor->info->seesound); + else if (mariomode) + S_StartSound(player->mo, sfx_itemup); } // Function: A_RingBox @@ -3287,10 +3289,9 @@ void A_BombShield(mobj_t *actor) if ((player->powers[pw_shield] & SH_NOSTACK) == SH_BOMB) P_BlackOw(player); - S_StartSound(player->mo, actor->info->seesound); - // Now we know for certain that we don't have a bomb shield, so add one. :3 - P_SwitchShield(player, SH_BOMB); + P_SwitchShield(player, SH_BOMB); // will never return false, so no need for sound test + S_StartSound(player->mo, actor->info->seesound); } // Function: A_WaterShield @@ -3316,9 +3317,10 @@ void A_WaterShield(mobj_t *actor) player = actor->target->player; - S_StartSound(player->mo, actor->info->seesound); - - P_SwitchShield(player, SH_ELEMENTAL); + if (P_SwitchShield(player, SH_ELEMENTAL)) + S_StartSound(player->mo, actor->info->seesound); + else if (mariomode) + S_StartSound(player->mo, sfx_itemup); if (player->powers[pw_underwater] && player->powers[pw_underwater] <= 12*TICRATE + 1) P_RestoreMusic(player); @@ -3355,18 +3357,23 @@ void A_ForceShield(mobj_t *actor) player = actor->target->player; - S_StartSound(player->mo, actor->info->seesound); - //can't use P_SwitchShield(player, SH_FORCE) - special case - if (mariomode && player->mo) + if (mariomode) { - player->mo->movecount = player->powers[pw_shield]; - player->powers[pw_marioflashing] = MARIOFLASHINGTICS; + mobj_t *scoremobj = P_SpawnMobj(player->mo->x, player->mo->y, player->mo->z + (player->mo->height / 2), MT_SCORE); + P_SetMobjState(scoremobj, mobjinfo[MT_SCORE].spawnstate+3); // 1000 + P_AddPlayerScore(player, 1000); } if (!(player->powers[pw_shield] & SH_FORCE)) { + if (mariomode) + { + player->mo->movecount = player->powers[pw_shield]; + player->powers[pw_marioflashing] = MARIOFLASHINGTICS; + } + // Just in case. if (player->pflags & PF_SHIELDABILITY) { @@ -3376,9 +3383,14 @@ void A_ForceShield(mobj_t *actor) player->powers[pw_shield] = SH_FORCE|(player->powers[pw_shield] & SH_STACK)|0x01; P_SpawnShieldOrb(player); + S_StartSound(player->mo, actor->info->seesound); } else + { player->powers[pw_shield] = SH_FORCE|(player->powers[pw_shield] & SH_STACK)|0x01; + if (mariomode) + S_StartSound(player->mo, sfx_itemup); + } } // Function: A_PityShield @@ -3408,11 +3420,14 @@ void A_PityShield(mobj_t *actor) player = actor->target->player; - S_StartSound(player->mo, actor->info->seesound); - - if (player->powers[pw_shield] && mariomode) return; + if (player->powers[pw_shield] && mariomode) + { + S_StartSound(player->mo, sfx_itemup); + return; + } P_SwitchShield(player, SH_PITY); + S_StartSound(player->mo, actor->info->seesound); } diff --git a/src/p_inter.c b/src/p_inter.c index 9c8885411..05f8b3d4e 100644 --- a/src/p_inter.c +++ b/src/p_inter.c @@ -1138,6 +1138,20 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck) case MT_FIREFLOWER: if (player->bot) return; + { + mobj_t *scoremobj = P_SpawnMobj(toucher->x, toucher->y, toucher->z + (toucher->height / 2), MT_SCORE); + P_SetMobjState(scoremobj, mobjinfo[MT_SCORE].spawnstate+3); // 1000 + P_AddPlayerScore(player, 1000); + } + + if ((player->powers[pw_shield] & SH_NOSTACK) == SH_FIREFLOWER) + { + S_StartSound(toucher, sfx_itemup); + break; + } + else + S_StartSound(toucher, sfx_mario3); + if (mariomode) { toucher->movecount = player->powers[pw_shield]; @@ -1145,9 +1159,10 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck) if ((player->powers[pw_shield] & SH_NOSTACK) == SH_PITY) player->powers[pw_shield] &= SH_NOSTACK; } - player->powers[pw_shield] |= SH_FIREFLOWER; + player->powers[pw_shield] |= SH_FIREFLOWER; //= (player->powers[pw_shield] & SH_NOSTACK)|SH_FIREFLOWER; -- perfect implementation, not worth it whilst we only have one stack power toucher->color = SKINCOLOR_WHITE; G_GhostAddColor(GHC_FIREFLOWER); + break; // *************** // @@ -1211,13 +1226,18 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck) S_StartSound(toucher, special->info->painsound); - if (mariomode && !player->powers[pw_shield]) + if (mariomode) { - S_StartSound(toucher, sfx_mario3); - player->mo->movecount = player->powers[pw_shield]; - player->powers[pw_marioflashing] = MARIOFLASHINGTICS; - player->powers[pw_shield] = SH_PITY; - P_SpawnShieldOrb(player); + mobj_t *scoremobj = P_SpawnMobj(toucher->x, toucher->y, toucher->z + (toucher->height / 2), MT_SCORE); + P_SetMobjState(scoremobj, mobjinfo[MT_SCORE].spawnstate+7); // 2000 + P_AddPlayerScore(player, 2000); + if (!player->powers[pw_shield]) + { + S_StartSound(toucher, sfx_mario3); + player->mo->movecount = player->powers[pw_shield]; + player->powers[pw_shield] = SH_PITY; + P_SpawnShieldOrb(player); + } } if (!(netgame && circuitmap && player != &players[consoleplayer])) @@ -2013,9 +2033,6 @@ void P_KillMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, UINT8 damaget } target->flags2 &= ~MF2_DONTDRAW; - - if (mariomode) - target->player->powers[pw_marioflashing] = MARIOFLASHINGTICS; } // if killed by a player @@ -2281,24 +2298,32 @@ void P_KillMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, UINT8 damaget break; case MT_PLAYER: - target->fuse = TICRATE*3; // timer before mobj disappears from view (even if not an actual player) - target->momx = target->momy = target->momz = 0; - if (damagetype == DMG_DROWNED) // drowned { - target->movedir = damagetype; // we're MOVING the Damage Into anotheR function... Okay, this is a bit of a hack. - if (target->player->charflags & SF_MACHINE) - S_StartSound(target, sfx_fizzle); + boolean mariodeathpit = (mariomode && damagetype == DMG_DEATHPIT); + target->fuse = TICRATE*3; // timer before mobj disappears from view (even if not an actual player) + if (!mariodeathpit) + { + target->player->powers[pw_marioflashing] = MARIOFLASHINGTICS; + target->momx = target->momy = target->momz = 0; + } + if (damagetype == DMG_DROWNED) // drowned + { + target->movedir = damagetype; // we're MOVING the Damage Into anotheR function... Okay, this is a bit of a hack. + if (target->player->charflags & SF_MACHINE) + S_StartSound(target, sfx_fizzle); + else + S_StartSound(target, sfx_drown); + // Don't jump up when drowning + } else - S_StartSound(target, sfx_drown); - // Don't jump up when drowning - } - else - { - P_SetObjectMomZ(target, 14*FRACUNIT, false); - if ((source && source->type == MT_SPIKE) || damagetype == DMG_SPIKE) // Spikes - S_StartSound(target, sfx_spkdth); - else - P_PlayDeathSound(target); + { + if (!mariodeathpit) + P_SetObjectMomZ(target, 14*FRACUNIT, false); + if ((source && source->type == MT_SPIKE) || damagetype == DMG_SPIKE) // Spikes + S_StartSound(target, sfx_spkdth); + else + P_PlayDeathSound(target); + } } break; default: @@ -2656,9 +2681,11 @@ static void P_KillPlayer(player_t *player, mobj_t *source, INT32 damage) P_PlayerEmeraldBurst(player, false); } - // Get rid of shield - player->powers[pw_shield] = SH_NONE; - player->mo->color = player->skincolor; + if (!mariomode) // Get rid of shield + { + player->powers[pw_shield] = SH_NONE; + player->mo->color = player->skincolor; + } // Get rid of emeralds player->powers[pw_emeralds] = 0; diff --git a/src/p_local.h b/src/p_local.h index b1c9366c5..f10ac2a4d 100644 --- a/src/p_local.h +++ b/src/p_local.h @@ -62,7 +62,7 @@ #define twodlevel (maptol & TOL_2D) #define mariomode (maptol & TOL_MARIO) -#define shortmario(player) ((player && mariomode && !player->powers[pw_shield]) ? 1 : 0) +#define shortmario(player) ((player && mariomode && !player->powers[pw_shield] && !objectplacing) ? 1 : 0) #define MARIOFLASHINGTICS 21 @@ -146,7 +146,7 @@ boolean P_InQuicksand(mobj_t *mo); void P_SetObjectMomZ(mobj_t *mo, fixed_t value, boolean relative); void P_RestoreMusic(player_t *player); void P_SpawnShieldOrb(player_t *player); -void P_SwitchShield(player_t *player, UINT16 shieldtype); +boolean P_SwitchShield(player_t *player, UINT16 shieldtype); mobj_t *P_SpawnGhostMobj(mobj_t *mobj); void P_GivePlayerRings(player_t *player, INT32 num_rings); void P_GivePlayerLives(player_t *player, INT32 numlives); diff --git a/src/p_mobj.c b/src/p_mobj.c index de544362c..72b2eaf1d 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -3102,7 +3102,7 @@ static void P_PlayerZMovement(mobj_t *mo) if (P_MobjFlip(mo)*mo->momz < 0) // falling { - boolean clipmomz = true; + boolean clipmomz = !(P_CheckDeathPitCollide(mo)); mo->pmomz = 0; // We're on a new floor, don't keep doing platform movement. diff --git a/src/p_user.c b/src/p_user.c index 1589d308a..d81c9e19f 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -1424,16 +1424,23 @@ void P_SpawnShieldOrb(player_t *player) // // Not for use if shieldtype would be SH_FORCE. // -void P_SwitchShield(player_t *player, UINT16 shieldtype) +boolean P_SwitchShield(player_t *player, UINT16 shieldtype) { - if (mariomode && player->mo) + if (mariomode) { - player->mo->movecount = player->powers[pw_shield]; - player->powers[pw_marioflashing] = MARIOFLASHINGTICS; - player->powers[pw_nocontrol] += MARIOFLASHINGTICS; + mobj_t *scoremobj = P_SpawnMobj(player->mo->x, player->mo->y, player->mo->z + (player->mo->height / 2), MT_SCORE); + P_SetMobjState(scoremobj, mobjinfo[MT_SCORE].spawnstate+3); // 1000 + P_AddPlayerScore(player, 1000); } + if ((player->powers[pw_shield] & SH_NOSTACK) != shieldtype) { + if (mariomode) + { + player->mo->movecount = player->powers[pw_shield]; + player->powers[pw_marioflashing] = MARIOFLASHINGTICS; + } + // Just in case. if (player->pflags & PF_SHIELDABILITY) { @@ -1451,7 +1458,9 @@ void P_SwitchShield(player_t *player, UINT16 shieldtype) player->powers[pw_shield] = shieldtype|(player->powers[pw_shield] & SH_STACK); P_SpawnShieldOrb(player); + return true; } + return false; } // @@ -6232,6 +6241,8 @@ void P_BlackOw(player_t *player) P_NukeEnemies(player->mo, player->mo, 1536*FRACUNIT); // Search for all nearby enemies and nuke their pants off! player->powers[pw_shield] = player->powers[pw_shield] & SH_STACK; + if (mariomode && !player->powers[pw_shield]) + player->powers[pw_shield] = SH_PITY; } void P_ElementalFire(player_t *player, boolean cropcircle) From 4997564d303213ffe25fa9170c26461edbd82519 Mon Sep 17 00:00:00 2001 From: toasterbabe Date: Wed, 12 Oct 2016 23:55:16 +0100 Subject: [PATCH 041/172] I like this timing more. --- src/p_local.h | 2 +- src/p_mobj.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/p_local.h b/src/p_local.h index f10ac2a4d..4568fe4d8 100644 --- a/src/p_local.h +++ b/src/p_local.h @@ -64,7 +64,7 @@ #define mariomode (maptol & TOL_MARIO) #define shortmario(player) ((player && mariomode && !player->powers[pw_shield] && !objectplacing) ? 1 : 0) -#define MARIOFLASHINGTICS 21 +#define MARIOFLASHINGTICS TICRATE/2 #define P_GetPlayerHeight(player) (FixedMul(player->height, player->mo->scale) >> shortmario(player)) #define P_GetPlayerSpinHeight(player) (FixedMul(player->spinheight, player->mo->scale) >> shortmario(player)) diff --git a/src/p_mobj.c b/src/p_mobj.c index 72b2eaf1d..50a80ebea 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -4066,7 +4066,7 @@ static void P_PlayerMobjThinker(mobj_t *mobj) if (!mobj->player->powers[pw_nocontrol]++) mobj->player->powers[pw_nocontrol]++; - if (!((--mobj->player->powers[pw_marioflashing] - 1) % 5)) + if (!(--mobj->player->powers[pw_marioflashing] % 4)) { UINT16 shieldswitch = mobj->player->powers[pw_shield]; mobj->player->powers[pw_shield] = mobj->movecount; From 80300ac476d08d478fc609c80451d4ca99f56480 Mon Sep 17 00:00:00 2001 From: toasterbabe Date: Thu, 13 Oct 2016 15:13:33 +0100 Subject: [PATCH 042/172] Fireflower is now on same level as all other shields, as opposed to being an additional stack layer. (MID LECTURE COMMIT STRATS YO) --- src/d_player.h | 7 +++---- src/dehacked.c | 2 +- src/p_enemy.c | 7 +++++++ src/p_inter.c | 20 +++++++++----------- src/p_local.h | 4 ++-- src/p_mobj.c | 19 ++++++------------- src/p_user.c | 24 ++++++++++++++++++------ src/r_things.c | 2 +- 8 files changed, 47 insertions(+), 38 deletions(-) diff --git a/src/d_player.h b/src/d_player.h index 1fa101e12..4bdfb9581 100644 --- a/src/d_player.h +++ b/src/d_player.h @@ -192,13 +192,12 @@ typedef enum SH_FLAMEAURA, // Pity shield: the world's most basic shield ever, given to players who suck at Match SH_PITY, + // The fireflower used to be stackable with other shields. Not anymore. + SH_FIREFLOWER, // The force shield uses the lower 8 bits to count how many extra hits are left. SH_FORCE = 0x100, SH_FORCEHP = 0xFF, // to be used as a bitmask only - // The fireflower is special... - SH_FIREFLOWER = 0x200, - // ...it can combine with other shields. - SH_STACK = SH_FIREFLOWER, + SH_STACK = 0, //SH_FIREFLOWER, SH_NOSTACK = ~SH_STACK } shieldtype_t; // pw_shield diff --git a/src/dehacked.c b/src/dehacked.c index b6076f872..7e50f1d8d 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -7092,8 +7092,8 @@ struct { {"SH_THUNDERCOIN",SH_THUNDERCOIN}, {"SH_FLAMEAURA",SH_FLAMEAURA}, {"SH_PITY",SH_PITY}, + {"SH_FIREFLOWER",SH_FIREFLOWER}, // These ones are special and use the upper bits - {"SH_FIREFLOWER",SH_FIREFLOWER}, // Lower bits are a normal shield stacked on top of the fire flower {"SH_FORCE",SH_FORCE}, // Lower bits are how many hits left, 0 is the last hit // Stack masks {"SH_STACK",SH_STACK}, diff --git a/src/p_enemy.c b/src/p_enemy.c index dccc6a8ea..a519563de 100644 --- a/src/p_enemy.c +++ b/src/p_enemy.c @@ -3381,6 +3381,13 @@ void A_ForceShield(mobj_t *actor) player->homing = 0; } + if ((player->powers[pw_shield] & SH_NOSTACK) == SH_FIREFLOWER + && !(player->powers[pw_super] || (mariomode && player->powers[pw_invulnerability]))) + { + player->mo->color = player->skincolor; + G_GhostAddColor(GHC_NORMAL); + } + player->powers[pw_shield] = SH_FORCE|(player->powers[pw_shield] & SH_STACK)|0x01; P_SpawnShieldOrb(player); S_StartSound(player->mo, actor->info->seesound); diff --git a/src/p_inter.c b/src/p_inter.c index 05f8b3d4e..4d34de374 100644 --- a/src/p_inter.c +++ b/src/p_inter.c @@ -1156,12 +1156,9 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck) { toucher->movecount = player->powers[pw_shield]; player->powers[pw_marioflashing] = MARIOFLASHINGTICS; - if ((player->powers[pw_shield] & SH_NOSTACK) == SH_PITY) - player->powers[pw_shield] &= SH_NOSTACK; } - player->powers[pw_shield] |= SH_FIREFLOWER; //= (player->powers[pw_shield] & SH_NOSTACK)|SH_FIREFLOWER; -- perfect implementation, not worth it whilst we only have one stack power - toucher->color = SKINCOLOR_WHITE; - G_GhostAddColor(GHC_FIREFLOWER); + player->powers[pw_shield] = (player->powers[pw_shield] & SH_STACK)|SH_FIREFLOWER; + P_SpawnShieldOrb(player); break; @@ -1235,6 +1232,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck) { S_StartSound(toucher, sfx_mario3); player->mo->movecount = player->powers[pw_shield]; + player->powers[pw_marioflashing] = MARIOFLASHINGTICS; player->powers[pw_shield] = SH_PITY; P_SpawnShieldOrb(player); } @@ -2782,6 +2780,7 @@ static inline void P_SuperDamage(player_t *player, mobj_t *inflictor, mobj_t *so void P_RemoveShield(player_t *player) { boolean willbetallmario = (mariomode && ((player->powers[pw_shield] & SH_NOSTACK) != SH_PITY)); + boolean fireflower = ((player->powers[pw_shield] & SH_NOSTACK) == SH_FIREFLOWER); if (player->powers[pw_shield] & SH_FORCE) { // Multi-hit if ((player->powers[pw_shield] & SH_FORCEHP) == 0) @@ -2792,12 +2791,6 @@ void P_RemoveShield(player_t *player) else if ((player->powers[pw_shield] & SH_NOSTACK) == SH_NONE) { // Second layer shields player->powers[pw_shield] = SH_NONE; - // Reset fireflower - if (!player->powers[pw_super]) - { - player->mo->color = player->skincolor; - G_GhostAddColor(GHC_NORMAL); - } } else if ((player->powers[pw_shield] & SH_NOSTACK) == SH_BOMB) // Give them what's coming to them! { @@ -2808,6 +2801,11 @@ void P_RemoveShield(player_t *player) player->powers[pw_shield] = player->powers[pw_shield] & SH_STACK; if (willbetallmario && !player->powers[pw_shield]) player->powers[pw_shield] |= SH_PITY; + if (fireflower && !(player->powers[pw_super] || (mariomode && player->powers[pw_invulnerability]))) + { + player->mo->color = player->skincolor; + G_GhostAddColor(GHC_NORMAL); + } } static void P_ShieldDamage(player_t *player, mobj_t *inflictor, mobj_t *source, INT32 damage) diff --git a/src/p_local.h b/src/p_local.h index 4568fe4d8..7107432ef 100644 --- a/src/p_local.h +++ b/src/p_local.h @@ -62,9 +62,9 @@ #define twodlevel (maptol & TOL_2D) #define mariomode (maptol & TOL_MARIO) -#define shortmario(player) ((player && mariomode && !player->powers[pw_shield] && !objectplacing) ? 1 : 0) +#define shortmario(player) ((player && mariomode && !player->powers[pw_shield]) ? 1 : 0) -#define MARIOFLASHINGTICS TICRATE/2 +#define MARIOFLASHINGTICS 21 #define P_GetPlayerHeight(player) (FixedMul(player->height, player->mo->scale) >> shortmario(player)) #define P_GetPlayerSpinHeight(player) (FixedMul(player->spinheight, player->mo->scale) >> shortmario(player)) diff --git a/src/p_mobj.c b/src/p_mobj.c index 50a80ebea..822f2ef85 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -4071,21 +4071,14 @@ static void P_PlayerMobjThinker(mobj_t *mobj) UINT16 shieldswitch = mobj->player->powers[pw_shield]; mobj->player->powers[pw_shield] = mobj->movecount; mobj->movecount = shieldswitch; - if ((mobj->player->powers[pw_shield] & SH_FIREFLOWER) != (mobj->movecount & SH_FIREFLOWER)) - { - if (mobj->player->powers[pw_shield] & SH_FIREFLOWER) - { - mobj->color = SKINCOLOR_WHITE; - G_GhostAddColor(GHC_FIREFLOWER); - } - else - { - mobj->color = mobj->player->skincolor; - G_GhostAddColor(GHC_NORMAL); - } - } if (mobj->player->powers[pw_shield] & SH_NOSTACK && (mobj->player->powers[pw_shield] & SH_NOSTACK) != (mobj->movecount & SH_NOSTACK)) P_SpawnShieldOrb(mobj->player); + if ((mobj->player->powers[pw_shield] & SH_NOSTACK) != SH_FIREFLOWER && (mobj->movecount & SH_NOSTACK) == SH_FIREFLOWER + && !(mobj->player->powers[pw_super] || (mariomode && mobj->player->powers[pw_invulnerability]))) + { + mobj->color = mobj->player->skincolor; + G_GhostAddColor(GHC_NORMAL); + } } if (mobj->player->powers[pw_flashing] && mobj->player->powers[pw_flashing] < UINT16_MAX && mobj->player->powers[pw_flashing] > flashingtics) diff --git a/src/p_user.c b/src/p_user.c index d81c9e19f..ffbff5ed4 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -1340,8 +1340,6 @@ void P_SpawnShieldOrb(player_t *player) I_Error("P_SpawnShieldOrb: player->mo is NULL!\n"); #endif - player->pflags &= ~PF_SHIELDABILITY; // Prevent edge cases when switching shields. - if (player->powers[pw_shield] & SH_FORCE) orbtype = MT_BLUEORB; else switch (player->powers[pw_shield] & SH_NOSTACK) @@ -1361,6 +1359,13 @@ void P_SpawnShieldOrb(player_t *player) case SH_PITY: orbtype = MT_PITYORB; break; + case SH_FIREFLOWER: + if (!(player->powers[pw_super] || (mariomode && player->powers[pw_invulnerability]))) + { + player->mo->color = SKINCOLOR_WHITE; + G_GhostAddColor(GHC_FIREFLOWER); + } + return; default: return; } @@ -1456,6 +1461,13 @@ boolean P_SwitchShield(player_t *player, UINT16 shieldtype) } } + if ((player->powers[pw_shield] & SH_NOSTACK) == SH_FIREFLOWER // it's implicit that the new shield isn't a fireflower + && !(player->powers[pw_super] || (mariomode && player->powers[pw_invulnerability]))) + { + player->mo->color = player->skincolor; + G_GhostAddColor(GHC_NORMAL); + } + player->powers[pw_shield] = shieldtype|(player->powers[pw_shield] & SH_STACK); P_SpawnShieldOrb(player); return true; @@ -2164,7 +2176,7 @@ static void P_CheckInvincibilityTimer(player_t *player) { if (mariomode) { - if (player->powers[pw_shield] & SH_FIREFLOWER) + if ((player->powers[pw_shield] & SH_NOSTACK) == SH_FIREFLOWER) { player->mo->color = SKINCOLOR_WHITE; G_GhostAddColor(GHC_FIREFLOWER); @@ -3188,7 +3200,7 @@ static void P_DoFiring(player_t *player, ticcmd_t *cmd) if (cmd->buttons & BT_ATTACK || cmd->buttons & BT_FIRENORMAL) { - if (!(player->pflags & PF_ATTACKDOWN) && player->powers[pw_shield] & SH_FIREFLOWER && !player->climbing) + if (!(player->pflags & PF_ATTACKDOWN) && (player->powers[pw_shield] & SH_NOSTACK) == SH_FIREFLOWER && !player->climbing) { player->pflags |= PF_ATTACKDOWN; P_SpawnPlayerMissile(player->mo, MT_FIREBALL, 0); @@ -3423,7 +3435,7 @@ static void P_DoSuperStuff(player_t *player) P_SpawnShieldOrb(player); // Restore color - if (player->powers[pw_shield] & SH_FIREFLOWER) + if ((player->powers[pw_shield] & SH_NOSTACK) == SH_FIREFLOWER) { player->mo->color = SKINCOLOR_WHITE; G_GhostAddColor(GHC_FIREFLOWER); @@ -3473,7 +3485,7 @@ static void P_DoSuperStuff(player_t *player) player->powers[pw_super] = 0; // Restore color - if (player->powers[pw_shield] & SH_FIREFLOWER) + if ((player->powers[pw_shield] & SH_NOSTACK) == SH_FIREFLOWER) { player->mo->color = SKINCOLOR_WHITE; G_GhostAddColor(GHC_FIREFLOWER); diff --git a/src/r_things.c b/src/r_things.c index 823dda3ac..eb1a3cb25 100644 --- a/src/r_things.c +++ b/src/r_things.c @@ -1128,7 +1128,7 @@ static void R_ProjectSprite(mobj_t *thing) fixed_t offset, offset2; boolean papersprite = !!(thing->frame & FF_PAPERSPRITE); - fixed_t shortmarioshift = shortmario(thing->player); + fixed_t shortmarioshift = (objectplacing ? 0 : shortmario(thing->player)); INT32 dispoffset = thing->info->dispoffset; From a119db3a8581ca22b7fffbe93cb0b6a6c0913db7 Mon Sep 17 00:00:00 2001 From: toasterbabe Date: Thu, 13 Oct 2016 15:13:33 +0100 Subject: [PATCH 043/172] Coins are no defense now! (This lecture is boring.) --- src/p_inter.c | 7 ++++++- src/p_user.c | 8 +++++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/p_inter.c b/src/p_inter.c index 4d34de374..a8a826fdf 100644 --- a/src/p_inter.c +++ b/src/p_inter.c @@ -145,6 +145,9 @@ boolean P_CanPickupItem(player_t *player, boolean weapon) if (player->powers[pw_flashing] > (flashingtics/4)*3 && player->powers[pw_flashing] < UINT16_MAX) return false; + if (player->mo && player->mo->health <= 0) + return false; + return true; } @@ -3135,7 +3138,7 @@ boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 da P_ShieldDamage(player, inflictor, source, damage); damage = 0; } - else if (player->mo->health > 1) // No shield but have rings. + else if (!mariomode && player->mo->health > 1) // No shield but have rings. { damage = player->mo->health - 1; P_RingDamage(player, inflictor, source, damage, damagetype); @@ -3297,6 +3300,8 @@ void P_PlayerRingBurst(player_t *player, INT32 num_rings) // Spill the ammo P_PlayerWeaponAmmoBurst(player); + if (mariomode) return; + for (i = 0; i < num_rings; i++) { INT32 objType = mobjinfo[MT_RING].reactiontime; diff --git a/src/p_user.c b/src/p_user.c index ffbff5ed4..219b82529 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -937,7 +937,7 @@ void P_GivePlayerRings(player_t *player, INT32 num_rings) { INT32 gainlives = 0; - while (player->xtralife < maxXtraLife && player->health > 100 * (player->xtralife+1)) + while ((mariomode || player->xtralife < maxXtraLife) && player->health > 100 * (player->xtralife+1)) { ++gainlives; ++player->xtralife; @@ -949,6 +949,12 @@ void P_GivePlayerRings(player_t *player, INT32 num_rings) P_PlayLivesJingle(player); } } + + if (mariomode && player->health > 100) + { + player->mo->health = 1; + player->health = 1; + } } // From 8f1493e1359a40941a5323d1a7df39a5c7ec20ad Mon Sep 17 00:00:00 2001 From: toasterbabe Date: Thu, 13 Oct 2016 15:13:33 +0100 Subject: [PATCH 044/172] Start big. (He's been on the same powerpoint slide for 30 minutes now.) --- src/g_game.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/g_game.c b/src/g_game.c index 5e45921b7..d90439152 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -2196,6 +2196,9 @@ void G_PlayerReborn(INT32 player) p->health = 1; // 0 rings p->panim = PA_IDLE; // standing animation + if (mariomode) + p->powers[pw_shield] = SH_PITY; // start big + if ((netgame || multiplayer) && !p->spectator) p->powers[pw_flashing] = flashingtics-1; // Babysitting deterrent From 5e92ca1a4a613498b2c220d5a6b9c4c2e9da6829 Mon Sep 17 00:00:00 2001 From: toasterbabe Date: Thu, 13 Oct 2016 15:13:33 +0100 Subject: [PATCH 045/172] Okay, made the Mushroom a seperate shield instead of a hacked pity shield. This is a lot nicer in general. --- src/d_player.h | 4 +++- src/dehacked.c | 1 + src/g_game.c | 2 +- src/p_enemy.c | 10 +++------- src/p_inter.c | 7 ++----- src/p_user.c | 6 +----- 6 files changed, 11 insertions(+), 19 deletions(-) diff --git a/src/d_player.h b/src/d_player.h index 4bdfb9581..8e3f4c904 100644 --- a/src/d_player.h +++ b/src/d_player.h @@ -197,7 +197,9 @@ typedef enum // The force shield uses the lower 8 bits to count how many extra hits are left. SH_FORCE = 0x100, SH_FORCEHP = 0xFF, // to be used as a bitmask only - SH_STACK = 0, //SH_FIREFLOWER, + // The mushroom CAN stack with other shields. + SH_MUSHROOM = 0x200, + SH_STACK = SH_MUSHROOM, //|SH_FIREFLOWER, SH_NOSTACK = ~SH_STACK } shieldtype_t; // pw_shield diff --git a/src/dehacked.c b/src/dehacked.c index 7e50f1d8d..3d3a887a7 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -7095,6 +7095,7 @@ struct { {"SH_FIREFLOWER",SH_FIREFLOWER}, // These ones are special and use the upper bits {"SH_FORCE",SH_FORCE}, // Lower bits are how many hits left, 0 is the last hit + {"SH_MUSHROOM", SH_MUSHROOM}, // Can stack with other shields // Stack masks {"SH_STACK",SH_STACK}, {"SH_NOSTACK",SH_NOSTACK}, diff --git a/src/g_game.c b/src/g_game.c index d90439152..200a0f45b 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -2197,7 +2197,7 @@ void G_PlayerReborn(INT32 player) p->panim = PA_IDLE; // standing animation if (mariomode) - p->powers[pw_shield] = SH_PITY; // start big + p->powers[pw_shield] = SH_MUSHROOM; // start big if ((netgame || multiplayer) && !p->spectator) p->powers[pw_flashing] = flashingtics-1; // Babysitting deterrent diff --git a/src/p_enemy.c b/src/p_enemy.c index a519563de..a2fcd314b 100644 --- a/src/p_enemy.c +++ b/src/p_enemy.c @@ -3427,14 +3427,10 @@ void A_PityShield(mobj_t *actor) player = actor->target->player; - if (player->powers[pw_shield] && mariomode) - { + if (P_SwitchShield(player, SH_PITY)) + S_StartSound(player->mo, actor->info->seesound); + else if (mariomode) S_StartSound(player->mo, sfx_itemup); - return; - } - - P_SwitchShield(player, SH_PITY); - S_StartSound(player->mo, actor->info->seesound); } diff --git a/src/p_inter.c b/src/p_inter.c index a8a826fdf..1baeb6baf 100644 --- a/src/p_inter.c +++ b/src/p_inter.c @@ -1160,7 +1160,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck) toucher->movecount = player->powers[pw_shield]; player->powers[pw_marioflashing] = MARIOFLASHINGTICS; } - player->powers[pw_shield] = (player->powers[pw_shield] & SH_STACK)|SH_FIREFLOWER; + player->powers[pw_shield] = (mariomode ? SH_MUSHROOM : player->powers[pw_shield] & SH_STACK)|SH_FIREFLOWER; P_SpawnShieldOrb(player); break; @@ -1236,7 +1236,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck) S_StartSound(toucher, sfx_mario3); player->mo->movecount = player->powers[pw_shield]; player->powers[pw_marioflashing] = MARIOFLASHINGTICS; - player->powers[pw_shield] = SH_PITY; + player->powers[pw_shield] = SH_MUSHROOM; P_SpawnShieldOrb(player); } } @@ -2782,7 +2782,6 @@ static inline void P_SuperDamage(player_t *player, mobj_t *inflictor, mobj_t *so void P_RemoveShield(player_t *player) { - boolean willbetallmario = (mariomode && ((player->powers[pw_shield] & SH_NOSTACK) != SH_PITY)); boolean fireflower = ((player->powers[pw_shield] & SH_NOSTACK) == SH_FIREFLOWER); if (player->powers[pw_shield] & SH_FORCE) { // Multi-hit @@ -2802,8 +2801,6 @@ void P_RemoveShield(player_t *player) } else player->powers[pw_shield] = player->powers[pw_shield] & SH_STACK; - if (willbetallmario && !player->powers[pw_shield]) - player->powers[pw_shield] |= SH_PITY; if (fireflower && !(player->powers[pw_super] || (mariomode && player->powers[pw_invulnerability]))) { player->mo->color = player->skincolor; diff --git a/src/p_user.c b/src/p_user.c index 219b82529..d199c86f7 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -1388,8 +1388,6 @@ void P_SpawnShieldOrb(player_t *player) P_RemoveMobj(shieldobj); //kill the old one(s) } - if (orbtype == MT_PITYORB && mariomode) return; - shieldobj = P_SpawnMobj(player->mo->x, player->mo->y, player->mo->z, orbtype); P_SetTarget(&shieldobj->target, player->mo); shieldobj->color = (UINT8)shieldobj->info->painchance; @@ -1474,7 +1472,7 @@ boolean P_SwitchShield(player_t *player, UINT16 shieldtype) G_GhostAddColor(GHC_NORMAL); } - player->powers[pw_shield] = shieldtype|(player->powers[pw_shield] & SH_STACK); + player->powers[pw_shield] = shieldtype|(mariomode ? SH_MUSHROOM : player->powers[pw_shield] & SH_STACK); P_SpawnShieldOrb(player); return true; } @@ -6259,8 +6257,6 @@ void P_BlackOw(player_t *player) P_NukeEnemies(player->mo, player->mo, 1536*FRACUNIT); // Search for all nearby enemies and nuke their pants off! player->powers[pw_shield] = player->powers[pw_shield] & SH_STACK; - if (mariomode && !player->powers[pw_shield]) - player->powers[pw_shield] = SH_PITY; } void P_ElementalFire(player_t *player, boolean cropcircle) From 2903180dee45d7d3e0b51f5552e32db110fd8bf7 Mon Sep 17 00:00:00 2001 From: toasterbabe Date: Thu, 13 Oct 2016 15:13:33 +0100 Subject: [PATCH 046/172] Treat the loss of the mushroom as a weapon-ring-spilling event in Mario-themed ringslinger, based on comments MI made on IRC about how different mariomode ringslinger would be. --- src/p_inter.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/p_inter.c b/src/p_inter.c index 1baeb6baf..811e32afe 100644 --- a/src/p_inter.c +++ b/src/p_inter.c @@ -2677,10 +2677,7 @@ static void P_KillPlayer(player_t *player, mobj_t *source, INT32 damage) // Burst weapons and emeralds in Match/CTF only if (source && (gametype == GT_MATCH || gametype == GT_TEAMMATCH || gametype == GT_CTF)) - { P_PlayerRingBurst(player, player->health - 1); - P_PlayerEmeraldBurst(player, false); - } if (!mariomode) // Get rid of shield { @@ -2818,7 +2815,12 @@ static void P_ShieldDamage(player_t *player, mobj_t *inflictor, mobj_t *source, P_ForceFeed(player, 40, 10, TICRATE, 40 + min(damage, 100)*2); if (mariomode) + { S_StartSound(player->mo, sfx_mario8); + // Burst weapons and emeralds in Match/CTF only + if (!player->powers[pw_shield] && (gametype == GT_MATCH || gametype == GT_TEAMMATCH || gametype == GT_CTF)) + P_PlayerRingBurst(player, 0); + } else if (source && (source->type == MT_SPIKE || (source->type == MT_NULL && source->threshold == 43))) // spikes S_StartSound(player->mo, sfx_spkdth); else From 91f9770cafa28b9dcc09b36119e10196d507a298 Mon Sep 17 00:00:00 2001 From: toasterbabe Date: Thu, 13 Oct 2016 15:13:33 +0100 Subject: [PATCH 047/172] Fixed up the coin-looping. --- src/p_user.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/p_user.c b/src/p_user.c index d199c86f7..7a91f5012 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -950,10 +950,11 @@ void P_GivePlayerRings(player_t *player, INT32 num_rings) } } - if (mariomode && player->health > 100) + if (mariomode && player->health > 100 && !G_RingSlingerGametype() && !G_TagGametype()) { - player->mo->health = 1; - player->health = 1; + player->mo->health = 1 + (player->health - 1) % 100; + player->health = player->mo->health; + player->xtralife = 0; } } From 2d85b146ea3feffc1416669e7d748a72f5fad77c Mon Sep 17 00:00:00 2001 From: toasterbabe Date: Thu, 13 Oct 2016 15:13:33 +0100 Subject: [PATCH 048/172] Messed up the force shield stuff when implementing SH_MUSHROOM. --- src/p_enemy.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/p_enemy.c b/src/p_enemy.c index a2fcd314b..6b3793d32 100644 --- a/src/p_enemy.c +++ b/src/p_enemy.c @@ -3368,12 +3368,6 @@ void A_ForceShield(mobj_t *actor) if (!(player->powers[pw_shield] & SH_FORCE)) { - if (mariomode) - { - player->mo->movecount = player->powers[pw_shield]; - player->powers[pw_marioflashing] = MARIOFLASHINGTICS; - } - // Just in case. if (player->pflags & PF_SHIELDABILITY) { @@ -3388,16 +3382,22 @@ void A_ForceShield(mobj_t *actor) G_GhostAddColor(GHC_NORMAL); } - player->powers[pw_shield] = SH_FORCE|(player->powers[pw_shield] & SH_STACK)|0x01; - P_SpawnShieldOrb(player); S_StartSound(player->mo, actor->info->seesound); } - else + else if (mariomode) + S_StartSound(player->mo, sfx_itemup); + + if ((player->powers[pw_shield] & SH_FORCE) && (player->powers[pw_shield] & SH_FORCEHP)) + return; // if you have a force shield with at least 2hp already, let's not go any further. + + if (mariomode) { - player->powers[pw_shield] = SH_FORCE|(player->powers[pw_shield] & SH_STACK)|0x01; - if (mariomode) - S_StartSound(player->mo, sfx_itemup); + player->mo->movecount = player->powers[pw_shield]; + player->powers[pw_marioflashing] = MARIOFLASHINGTICS; } + + player->powers[pw_shield] = SH_FORCE|(mariomode ? SH_MUSHROOM : player->powers[pw_shield] & SH_STACK)|0x01; + P_SpawnShieldOrb(player); } // Function: A_PityShield From 05aefc3edeab94a950597cc9f4901b2623715260 Mon Sep 17 00:00:00 2001 From: toasterbabe Date: Thu, 13 Oct 2016 15:13:33 +0100 Subject: [PATCH 049/172] Removed bit of code that'd never run. --- src/p_inter.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/p_inter.c b/src/p_inter.c index 811e32afe..0b2262ab7 100644 --- a/src/p_inter.c +++ b/src/p_inter.c @@ -3304,8 +3304,6 @@ void P_PlayerRingBurst(player_t *player, INT32 num_rings) for (i = 0; i < num_rings; i++) { INT32 objType = mobjinfo[MT_RING].reactiontime; - if (mariomode) - objType = mobjinfo[MT_COIN].reactiontime; z = player->mo->z; if (player->mo->eflags & MFE_VERTICALFLIP) From 6e47a07a04835e462ead5f84842265292fd301f4 Mon Sep 17 00:00:00 2001 From: toasterbabe Date: Thu, 13 Oct 2016 15:13:33 +0100 Subject: [PATCH 050/172] Fixed monitors not making sounds if you had that monitor already and it wasn't mariomode. --- src/p_enemy.c | 12 +++++++----- src/p_user.c | 10 ++++++---- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/src/p_enemy.c b/src/p_enemy.c index 6b3793d32..d3434a828 100644 --- a/src/p_enemy.c +++ b/src/p_enemy.c @@ -3060,7 +3060,7 @@ void A_JumpShield(mobj_t *actor) if (P_SwitchShield(player, SH_JUMP)) S_StartSound(player->mo, actor->info->seesound); - else if (mariomode) + else S_StartSound(player->mo, sfx_itemup); } @@ -3089,7 +3089,7 @@ void A_RingShield(mobj_t *actor) if (P_SwitchShield(player, SH_ATTRACT)) S_StartSound(player->mo, actor->info->seesound); - else if (mariomode) + else S_StartSound(player->mo, sfx_itemup); } @@ -3319,7 +3319,7 @@ void A_WaterShield(mobj_t *actor) if (P_SwitchShield(player, SH_ELEMENTAL)) S_StartSound(player->mo, actor->info->seesound); - else if (mariomode) + else S_StartSound(player->mo, sfx_itemup); if (player->powers[pw_underwater] && player->powers[pw_underwater] <= 12*TICRATE + 1) @@ -3384,7 +3384,9 @@ void A_ForceShield(mobj_t *actor) S_StartSound(player->mo, actor->info->seesound); } - else if (mariomode) + else if (!mariomode) + S_StartSound(player->mo, actor->info->seesound); + else S_StartSound(player->mo, sfx_itemup); if ((player->powers[pw_shield] & SH_FORCE) && (player->powers[pw_shield] & SH_FORCEHP)) @@ -3429,7 +3431,7 @@ void A_PityShield(mobj_t *actor) if (P_SwitchShield(player, SH_PITY)) S_StartSound(player->mo, actor->info->seesound); - else if (mariomode) + else S_StartSound(player->mo, sfx_itemup); } diff --git a/src/p_user.c b/src/p_user.c index 7a91f5012..6ae507f0c 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -1428,9 +1428,11 @@ void P_SpawnShieldOrb(player_t *player) // // P_SwitchShield // -// Handles the possibility of switching -// between shields thoroughly, then -// adds the desired one. +// Handles the possibility of switching between +// the non-stack layer of shields thoroughly, +// then adds the desired one. +// +// Returns whether to play a normal sound or an itemup. // // Not for use if shieldtype would be SH_FORCE. // @@ -1477,7 +1479,7 @@ boolean P_SwitchShield(player_t *player, UINT16 shieldtype) P_SpawnShieldOrb(player); return true; } - return false; + return (!mariomode); } // From 3aa9d2a1b17ef18552773d9c9c15c5d2d942a0e7 Mon Sep 17 00:00:00 2001 From: toasterbabe Date: Thu, 13 Oct 2016 15:13:33 +0100 Subject: [PATCH 051/172] Sonic 3 shields implemented at a basic visual/functional level - no abilities yet. --- src/d_player.h | 8 +- src/dehacked.c | 104 +++++++++- src/hardware/hw_light.c | 6 + src/info.c | 433 ++++++++++++++++++++++++++++++++++++++-- src/info.h | 110 +++++++++- src/p_enemy.c | 90 +++++++++ src/p_floor.c | 15 +- src/p_mobj.c | 17 +- src/p_user.c | 21 +- src/st_stuff.c | 37 ++-- 10 files changed, 779 insertions(+), 62 deletions(-) diff --git a/src/d_player.h b/src/d_player.h index 8e3f4c904..77ad34dab 100644 --- a/src/d_player.h +++ b/src/d_player.h @@ -186,12 +186,12 @@ typedef enum SH_ATTRACT, SH_ELEMENTAL, SH_BOMB, - // Stupid useless unimplimented Sonic 3 shields - SH_BUBBLEWRAP, - SH_THUNDERCOIN, - SH_FLAMEAURA, // Pity shield: the world's most basic shield ever, given to players who suck at Match SH_PITY, + // Sonic 3 shields + SH_FLAMEAURA, + SH_BUBBLEWRAP, + SH_THUNDERCOIN, // The fireflower used to be stackable with other shields. Not anymore. SH_FIREFLOWER, // The force shield uses the lower 8 bits to count how many extra hits are left. diff --git a/src/dehacked.c b/src/dehacked.c index 3d3a887a7..bd3f8455f 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -1687,6 +1687,9 @@ static actionpointer_t actionpointers[] = {{A_WaterShield}, "A_WATERSHIELD"}, {{A_ForceShield}, "A_FORCESHIELD"}, {{A_PityShield}, "A_PITYSHIELD"}, + {{A_FlameShield}, "A_FLAMESHIELD"}, + {{A_BubbleShield}, "A_BUBBLESHIELD"}, + {{A_ThunderShield}, "A_THUNDERSHIELD"}, {{A_GravityBox}, "A_GRAVITYBOX"}, {{A_ScoreRise}, "A_SCORERISE"}, {{A_ParticleSpawn}, "A_PARTICLESPAWN"}, @@ -4908,6 +4911,9 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit "S_RECYCLER_BOX", "S_SCORE1K_BOX", "S_SCORE10K_BOX", + "S_FLAMEAURA_BOX", + "S_BUBBLEWRAP_BOX", + "S_THUNDERCOIN_BOX", // Gold Repeat Monitor States (one per box) "S_PITY_GOLDBOX", @@ -4920,6 +4926,9 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit "S_INVULN_GOLDBOX", "S_EGGMAN_GOLDBOX", "S_GRAVITY_GOLDBOX", + "S_FLAMEAURA_GOLDBOX", + "S_BUBBLEWRAP_GOLDBOX", + "S_THUNDERCOIN_GOLDBOX", // Team Ring Boxes (these are special) "S_RING_REDBOX1", @@ -4981,6 +4990,15 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit "S_SCORE10K_ICON1", "S_SCORE10K_ICON2", + "S_FLAMEAURA_ICON1", + "S_FLAMEAURA_ICON2", + + "S_BUBBLEWRAP_ICON1", + "S_BUBBLEWRAP_ICON2", + + "S_THUNDERCOIN_ICON1", + "S_THUNDERCOIN_ICON2", + "S_ROCKET", "S_LASER", @@ -5409,6 +5427,68 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit "S_PITY9", "S_PITY10", + "S_FIRS1", + "S_FIRS2", + "S_FIRS3", + "S_FIRS4", + "S_FIRS5", + "S_FIRS6", + "S_FIRS7", + "S_FIRS8", + "S_FIRS9", + + "S_FIRSB1", + "S_FIRSB2", + "S_FIRSB3", + "S_FIRSB4", + "S_FIRSB5", + "S_FIRSB6", + "S_FIRSB7", + "S_FIRSB8", + "S_FIRSB9", + + "S_BUBS1", + "S_BUBS2", + "S_BUBS3", + "S_BUBS4", + "S_BUBS5", + "S_BUBS6", + "S_BUBS7", + "S_BUBS8", + "S_BUBS9", + + "S_BUBSB1", + "S_BUBSB2", + + "S_ZAPS1", + "S_ZAPS2", + "S_ZAPS3", + "S_ZAPS4", + "S_ZAPS5", + "S_ZAPS6", + "S_ZAPS7", + "S_ZAPS8", + "S_ZAPS9", + "S_ZAPS10", + "S_ZAPS11", + "S_ZAPS12", + "S_ZAPS13", // blank frame + "S_ZAPS14", + "S_ZAPS15", + "S_ZAPS16", + + "S_ZAPSB1", // blank frame + "S_ZAPSB2", + "S_ZAPSB3", + "S_ZAPSB4", + "S_ZAPSB5", + "S_ZAPSB6", + "S_ZAPSB7", + "S_ZAPSB8", + "S_ZAPSB9", + "S_ZAPSB10", + "S_ZAPSB11", // blank frame + // Invincibility Sparkles "S_IVSP", @@ -6231,6 +6311,9 @@ static const char *const MOBJTYPE_LIST[] = { // array length left dynamic for s "MT_RECYCLER_BOX", "MT_SCORE1K_BOX", "MT_SCORE10K_BOX", + "MT_FLAMEAURA_BOX", + "MT_BUBBLEWRAP_BOX", + "MT_THUNDERCOIN_BOX", // Monitor boxes -- repeating (big) boxes "MT_PITY_GOLDBOX", @@ -6243,6 +6326,9 @@ static const char *const MOBJTYPE_LIST[] = { // array length left dynamic for s "MT_INVULN_GOLDBOX", "MT_EGGMAN_GOLDBOX", "MT_GRAVITY_GOLDBOX", + "MT_FLAMEAURA_GOLDBOX", + "MT_BUBBLEWRAP_GOLDBOX", + "MT_THUNDERCOIN_GOLDBOX", // Monitor boxes -- special "MT_RING_REDBOX", @@ -6265,6 +6351,9 @@ static const char *const MOBJTYPE_LIST[] = { // array length left dynamic for s "MT_RECYCLER_ICON", "MT_SCORE1K_ICON", "MT_SCORE10K_ICON", + "MT_FLAMEAURA_ICON", + "MT_BUBBLEWRAP_ICON", + "MT_THUNDERCOIN_ICON", // Projectiles "MT_ROCKET", @@ -6417,12 +6506,15 @@ static const char *const MOBJTYPE_LIST[] = { // array length left dynamic for s "MT_EGGSTATUE2", // Powerup Indicators - "MT_GREENORB", // Elemental shield mobj - "MT_YELLOWORB", // Attract shield mobj - "MT_BLUEORB", // Force shield mobj - "MT_BLACKORB", // Armageddon shield mobj - "MT_WHITEORB", // Whirlwind shield mobj - "MT_PITYORB", // Pity shield mobj + "MT_ELEMENTAL_ORB", // Elemental shield mobj + "MT_ATTRACT_ORB", // Attract shield mobj + "MT_FORCE_ORB", // Force shield mobj + "MT_BOMB_ORB", // Armageddon shield mobj + "MT_JUMP_ORB", // Whirlwind shield mobj + "MT_PITY_ORB", // Pity shield mobj + "MT_FLAMEAURA_ORB", // Flame shield mobj + "MT_BUBBLEWRAP_ORB", // Bubble shield mobj + "MT_THUNDERCOIN_ORB", // Thunder shield mobj "MT_IVSP", // invincibility sparkles "MT_SUPERSPARK", // Super Sonic Spark diff --git a/src/hardware/hw_light.c b/src/hardware/hw_light.c index e79aba735..a73a3462c 100644 --- a/src/hardware/hw_light.c +++ b/src/hardware/hw_light.c @@ -271,6 +271,9 @@ light_t *t_lspr[NUMSPRITES] = &lspr[NOLIGHT], // SPR_TVRC &lspr[NOLIGHT], // SPR_TV1K &lspr[NOLIGHT], // SPR_TVTK + &lspr[NOLIGHT], // SPR_TVFL + &lspr[NOLIGHT], // SPR_TVBB + &lspr[NOLIGHT], // SPR_TVZP // Projectiles &lspr[NOLIGHT], // SPR_MISL @@ -359,6 +362,9 @@ light_t *t_lspr[NUMSPRITES] = &lspr[NOLIGHT], // SPR_ELEM &lspr[NOLIGHT], // SPR_FORC &lspr[NOLIGHT], // SPR_PITY + &lspr[NOLIGHT], // SPR_FIRS + &lspr[NOLIGHT], // SPR_BUBS + &lspr[NOLIGHT], // SPR_ZAPS &lspr[INVINCIBLE_L], // SPR_IVSP &lspr[SUPERSPARK_L], // SPR_SSPK diff --git a/src/info.c b/src/info.c index c27a606fb..85a9589c9 100644 --- a/src/info.c +++ b/src/info.c @@ -159,6 +159,9 @@ char sprnames[NUMSPRITES + 1][5] = "TVRC", // ReCycler "TV1K", // 1,000 points (1 K) "TVTK", // 10,000 points (Ten K) + "TVFL", // FLame shield + "TVBB", // BuBble shield + "TVZP", // Thunder shield (ZaP) // Projectiles "MISL", @@ -243,6 +246,9 @@ char sprnames[NUMSPRITES + 1][5] = "ELEM", // Elemental Shield Orb and Fire "FORC", // Force Shield Orb "PITY", // Pity Shield Orb + "FIRS", // Flame Shield Orb + "BUBS", // Bubble Shield Orb + "ZAPS", // Thunder Shield Orb "IVSP", // invincibility sparkles "SSPK", // Super Sonic Spark @@ -1623,6 +1629,9 @@ state_t states[NUMSTATES] = {SPR_TVRC, 0, 2, {NULL}, 0, 0, S_BOX_FLICKER}, // S_RECYCLER_BOX {SPR_TV1K, 0, 2, {NULL}, 0, 0, S_BOX_FLICKER}, // S_SCORE1K_BOX {SPR_TVTK, 0, 2, {NULL}, 0, 0, S_BOX_FLICKER}, // S_SCORE10K_BOX + {SPR_TVFL, 0, 2, {NULL}, 0, 0, S_BOX_FLICKER}, // S_FLAMEAURA_BOX + {SPR_TVBB, 0, 2, {NULL}, 0, 0, S_BOX_FLICKER}, // S_BUBBLEWRAP_BOX + {SPR_TVZP, 0, 2, {NULL}, 0, 0, S_BOX_FLICKER}, // S_THUNDERCOIN_BOX // Gold Repeat Monitor States (one per box) {SPR_TVPI, 1, 2, {A_GoldMonitorSparkle}, 0, 0, S_GOLDBOX_FLICKER}, // S_PITY_GOLDBOX @@ -1635,6 +1644,9 @@ state_t states[NUMSTATES] = {SPR_TVIV, 1, 2, {A_GoldMonitorSparkle}, 0, 0, S_GOLDBOX_FLICKER}, // S_INVULN_GOLDBOX {SPR_TVEG, 1, 2, {A_GoldMonitorSparkle}, 0, 0, S_GOLDBOX_FLICKER}, // S_EGGMAN_GOLDBOX {SPR_TVGV, 1, 2, {A_GoldMonitorSparkle}, 0, 0, S_GOLDBOX_FLICKER}, // S_GRAVITY_GOLDBOX + {SPR_TVFL, 1, 2, {A_GoldMonitorSparkle}, 0, 0, S_GOLDBOX_FLICKER}, // S_FLAMEAURA_GOLDBOX + {SPR_TVBB, 1, 2, {A_GoldMonitorSparkle}, 0, 0, S_GOLDBOX_FLICKER}, // S_BUBBLEWRAP_GOLDBOX + {SPR_TVZP, 1, 2, {A_GoldMonitorSparkle}, 0, 0, S_GOLDBOX_FLICKER}, // S_THUNDERCOIN_GOLDBOX // Team Ring Boxes (these are special) {SPR_TRRI, 0, 2, {NULL}, 0, 0, S_RING_REDBOX2}, // S_RING_REDBOX1 @@ -1696,6 +1708,15 @@ state_t states[NUMSTATES] = {SPR_TVTK, FF_ANIMATE|2, 18, {NULL}, 3, 4, S_SCORE10K_ICON2}, // S_SCORE10K_ICON1 {SPR_TVTK, 2, 18, {A_AwardScore}, 0, 0, S_NULL}, // S_SCORE10K_ICON2 + {SPR_TVFL, FF_ANIMATE|2, 18, {NULL}, 3, 4, S_FLAMEAURA_ICON2}, // S_FLAMEAURA_ICON1 + {SPR_TVFL, 2, 18, {A_FlameShield}, 0, 0, S_NULL}, // S_FLAMEAURA_ICON2 + + {SPR_TVBB, FF_ANIMATE|2, 18, {NULL}, 3, 4, S_BUBBLEWRAP_ICON2}, // S_BUBBLEWRAP_ICON1 + {SPR_TVBB, 2, 18, {A_BubbleShield}, 0, 0, S_NULL}, // S_BUBBLERWAP_ICON2 + + {SPR_TVZP, FF_ANIMATE|2, 18, {NULL}, 3, 4, S_THUNDERCOIN_ICON2}, // S_THUNDERCOIN_ICON1 + {SPR_TVZP, 2, 18, {A_ThunderShield}, 0, 0, S_NULL}, // S_THUNDERCOIN_ICON2 + // --- {SPR_MISL, FF_FULLBRIGHT, 1, {A_SmokeTrailer}, MT_SMOKE, 0, S_ROCKET}, // S_ROCKET @@ -2134,6 +2155,68 @@ state_t states[NUMSTATES] = {SPR_PITY, FF_TRANS20 , 1, {NULL}, 0, 0, S_PITY10}, // S_PITY9 {SPR_PITY, FF_TRANS20|5, 1, {NULL}, 0, 0, S_PITY1 }, // S_PITY10 + {SPR_FIRS, FF_FULLBRIGHT|FF_TRANS40 , 2, {NULL}, 0, 0, S_FIRS2}, // S_FIRS1 + {SPR_FIRS, FF_FULLBRIGHT|FF_TRANS40|1, 2, {NULL}, 0, 0, S_FIRS3}, // S_FIRS2 + {SPR_FIRS, FF_FULLBRIGHT|FF_TRANS40|2, 2, {NULL}, 0, 0, S_FIRS4}, // S_FIRS3 + {SPR_FIRS, FF_FULLBRIGHT|FF_TRANS40|3, 2, {NULL}, 0, 0, S_FIRS5}, // S_FIRS4 + {SPR_FIRS, FF_FULLBRIGHT|FF_TRANS40|4, 2, {NULL}, 0, 0, S_FIRS6}, // S_FIRS5 + {SPR_FIRS, FF_FULLBRIGHT|FF_TRANS40|5, 2, {NULL}, 0, 0, S_FIRS7}, // S_FIRS6 + {SPR_FIRS, FF_FULLBRIGHT|FF_TRANS40|6, 2, {NULL}, 0, 0, S_FIRS8}, // S_FIRS7 + {SPR_FIRS, FF_FULLBRIGHT|FF_TRANS40|7, 2, {NULL}, 0, 0, S_FIRS9}, // S_FIRS8 + {SPR_FIRS, FF_FULLBRIGHT|FF_TRANS40|8, 2, {NULL}, 0, 0, S_FIRS1}, // S_FIRS9 + + {SPR_FIRS, FF_FULLBRIGHT|FF_TRANS40| 9, 2, {NULL}, 0, 0, S_FIRSB2}, // S_FIRSB1 + {SPR_FIRS, FF_FULLBRIGHT|FF_TRANS40|10, 2, {NULL}, 0, 0, S_FIRSB3}, // S_FIRSB2 + {SPR_FIRS, FF_FULLBRIGHT|FF_TRANS40|11, 2, {NULL}, 0, 0, S_FIRSB4}, // S_FIRSB3 + {SPR_FIRS, FF_FULLBRIGHT|FF_TRANS40|12, 2, {NULL}, 0, 0, S_FIRSB5}, // S_FIRSB4 + {SPR_FIRS, FF_FULLBRIGHT|FF_TRANS40|13, 2, {NULL}, 0, 0, S_FIRSB6}, // S_FIRSB5 + {SPR_FIRS, FF_FULLBRIGHT|FF_TRANS40|14, 2, {NULL}, 0, 0, S_FIRSB7}, // S_FIRSB6 + {SPR_FIRS, FF_FULLBRIGHT|FF_TRANS40|15, 2, {NULL}, 0, 0, S_FIRSB8}, // S_FIRSB7 + {SPR_FIRS, FF_FULLBRIGHT|FF_TRANS40|16, 2, {NULL}, 0, 0, S_FIRSB9}, // S_FIRSB8 + {SPR_FIRS, FF_FULLBRIGHT|FF_TRANS40|17, 2, {NULL}, 0, 0, S_FIRSB1}, // S_FIRSB9 + + {SPR_BUBS, FF_TRANS30| 2, 2, {NULL}, 0, 0, S_BUBS2}, // S_BUBS1 + {SPR_BUBS, FF_TRANS30| 3, 2, {NULL}, 0, 0, S_BUBS3}, // S_BUBS2 + {SPR_BUBS, FF_TRANS30| 4, 2, {NULL}, 0, 0, S_BUBS4}, // S_BUBS3 + {SPR_BUBS, FF_TRANS30| 5, 2, {NULL}, 0, 0, S_BUBS5}, // S_BUBS4 + {SPR_BUBS, FF_TRANS30| 6, 2, {NULL}, 0, 0, S_BUBS6}, // S_BUBS5 + {SPR_BUBS, FF_TRANS30| 7, 2, {NULL}, 0, 0, S_BUBS7}, // S_BUBS6 + {SPR_BUBS, FF_TRANS30| 8, 2, {NULL}, 0, 0, S_BUBS8}, // S_BUBS7 + {SPR_BUBS, FF_TRANS30| 9, 2, {NULL}, 0, 0, S_BUBS9}, // S_BUBS8 + {SPR_BUBS, FF_TRANS30|10, 2, {NULL}, 0, 0, S_BUBS1}, // S_BUBS9 + + {SPR_BUBS, FF_TRANS30 , 2, {NULL}, 0, 0, S_BUBSB2}, // S_BUBSB1 + {SPR_BUBS, FF_TRANS30|1, 2, {NULL}, 0, 0, S_BUBSB1}, // S_BUBSB2 + + {SPR_ZAPS, FF_FULLBRIGHT|FF_TRANS20 , 2, {NULL}, 0, 0, S_ZAPS2 }, // S_ZAPS1 + {SPR_ZAPS, FF_FULLBRIGHT|FF_TRANS20| 1, 2, {NULL}, 0, 0, S_ZAPS3 }, // S_ZAPS2 + {SPR_ZAPS, FF_FULLBRIGHT|FF_TRANS20| 2, 2, {NULL}, 0, 0, S_ZAPS4 }, // S_ZAPS3 + {SPR_ZAPS, FF_FULLBRIGHT|FF_TRANS20| 3, 2, {NULL}, 0, 0, S_ZAPS5 }, // S_ZAPS4 + {SPR_ZAPS, FF_FULLBRIGHT|FF_TRANS20| 4, 2, {NULL}, 0, 0, S_ZAPS6 }, // S_ZAPS5 + {SPR_ZAPS, FF_FULLBRIGHT|FF_TRANS20| 5, 2, {NULL}, 0, 0, S_ZAPS7 }, // S_ZAPS6 + {SPR_ZAPS, FF_FULLBRIGHT|FF_TRANS20| 6, 2, {NULL}, 0, 0, S_ZAPS8 }, // S_ZAPS7 + {SPR_ZAPS, FF_FULLBRIGHT|FF_TRANS20| 7, 2, {NULL}, 0, 0, S_ZAPS9 }, // S_ZAPS8 + {SPR_ZAPS, FF_FULLBRIGHT|FF_TRANS20| 8, 2, {NULL}, 0, 0, S_ZAPS10}, // S_ZAPS9 + {SPR_ZAPS, FF_FULLBRIGHT|FF_TRANS20| 9, 2, {NULL}, 0, 0, S_ZAPS11}, // S_ZAPS10 + {SPR_ZAPS, FF_FULLBRIGHT|FF_TRANS20|10, 2, {NULL}, 0, 0, S_ZAPS12}, // S_ZAPS11 + {SPR_ZAPS, FF_FULLBRIGHT|FF_TRANS20|11, 2, {NULL}, 0, 0, S_ZAPS13}, // S_ZAPS12 + {SPR_NULL, 0, 9*2, {NULL}, 0, 0, S_ZAPS14}, // S_ZAPS13 + {SPR_ZAPS, FF_FULLBRIGHT|FF_TRANS20| 9, 2, {NULL}, 0, 0, S_ZAPS15}, // S_ZAPS14 + {SPR_ZAPS, FF_FULLBRIGHT|FF_TRANS20|10, 2, {NULL}, 0, 0, S_ZAPS16}, // S_ZAPS15 + {SPR_ZAPS, FF_FULLBRIGHT|FF_TRANS20|11, 2, {NULL}, 0, 0, S_ZAPS1 }, // S_ZAPS16 + + {SPR_NULL, 0, 12*2, {NULL}, 0, 0, S_ZAPSB2 }, // S_ZAPSB1 + {SPR_ZAPS, FF_FULLBRIGHT|FF_TRANS20| 8, 2, {NULL}, 0, 0, S_ZAPSB3 }, // S_ZAPSB2 + {SPR_ZAPS, FF_FULLBRIGHT|FF_TRANS20| 7, 2, {NULL}, 0, 0, S_ZAPSB4 }, // S_ZAPSB3 + {SPR_ZAPS, FF_FULLBRIGHT|FF_TRANS20| 6, 2, {NULL}, 0, 0, S_ZAPSB5 }, // S_ZAPSB4 + {SPR_ZAPS, FF_FULLBRIGHT|FF_TRANS20| 5, 2, {NULL}, 0, 0, S_ZAPSB6 }, // S_ZAPSB5 + {SPR_ZAPS, FF_FULLBRIGHT|FF_TRANS20| 4, 2, {NULL}, 0, 0, S_ZAPSB7 }, // S_ZAPSB6 + {SPR_ZAPS, FF_FULLBRIGHT|FF_TRANS20| 3, 2, {NULL}, 0, 0, S_ZAPSB8 }, // S_ZAPSB7 + {SPR_ZAPS, FF_FULLBRIGHT|FF_TRANS20| 2, 2, {NULL}, 0, 0, S_ZAPSB9 }, // S_ZAPSB8 + {SPR_ZAPS, FF_FULLBRIGHT|FF_TRANS20| 1, 2, {NULL}, 0, 0, S_ZAPSB10}, // S_ZAPSB9 + {SPR_ZAPS, FF_FULLBRIGHT|FF_TRANS20 , 2, {NULL}, 0, 0, S_ZAPSB11}, // S_ZAPSB10 + {SPR_NULL, 0, 15*2, {NULL}, 0, 0, S_ZAPSB2 }, // S_ZAPSB11 + // Invincibility Sparkles {SPR_IVSP, FF_ANIMATE, 32, {NULL}, 31, 1, S_NULL}, // S_IVSP @@ -6429,6 +6512,87 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = S_NULL // raisestate }, + { // MT_FLAMEAURA_BOX + 420, // doomednum + S_FLAMEAURA_BOX, // spawnstate + 1, // spawnhealth + S_NULL, // seestate + sfx_None, // seesound + 8, // reactiontime + sfx_None, // attacksound + S_FLAMEAURA_BOX, // painstate + 0, // painchance + sfx_None, // painsound + S_NULL, // meleestate + S_NULL, // missilestate + S_BOX_POP1, // deathstate + S_NULL, // xdeathstate + sfx_pop, // deathsound + 1, // speed + 16*FRACUNIT, // radius + 32*FRACUNIT, // height + 0, // display offset + 100, // mass + MT_FLAMEAURA_ICON, // damage + sfx_None, // activesound + MF_SOLID|MF_SHOOTABLE|MF_MONITOR, // flags + S_NULL // raisestate + }, + + { // MT_BUBBLEWRAP_BOX + 421, // doomednum + S_BUBBLEWRAP_BOX, // spawnstate + 1, // spawnhealth + S_NULL, // seestate + sfx_None, // seesound + 8, // reactiontime + sfx_None, // attacksound + S_BUBBLEWRAP_BOX, // painstate + 0, // painchance + sfx_None, // painsound + S_NULL, // meleestate + S_NULL, // missilestate + S_BOX_POP1, // deathstate + S_NULL, // xdeathstate + sfx_pop, // deathsound + 1, // speed + 16*FRACUNIT, // radius + 32*FRACUNIT, // height + 0, // display offset + 100, // mass + MT_BUBBLEWRAP_ICON, // damage + sfx_None, // activesound + MF_SOLID|MF_SHOOTABLE|MF_MONITOR, // flags + S_NULL // raisestate + }, + + { // MT_THUNDERCOIN_BOX + 422, // doomednum + S_THUNDERCOIN_BOX, // spawnstate + 1, // spawnhealth + S_NULL, // seestate + sfx_None, // seesound + 8, // reactiontime + sfx_None, // attacksound + S_THUNDERCOIN_BOX, // painstate + 0, // painchance + sfx_None, // painsound + S_NULL, // meleestate + S_NULL, // missilestate + S_BOX_POP1, // deathstate + S_NULL, // xdeathstate + sfx_pop, // deathsound + 1, // speed + 16*FRACUNIT, // radius + 32*FRACUNIT, // height + 0, // display offset + 100, // mass + MT_THUNDERCOIN_ICON, // damage + sfx_None, // activesound + MF_SOLID|MF_SHOOTABLE|MF_MONITOR, // flags + S_NULL // raisestate + }, + { // MT_PITY_GOLDBOX 431, // doomednum S_PITY_GOLDBOX, // spawnstate @@ -6699,6 +6863,87 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = S_NULL // raisestate }, + { // MT_FLAMEAURA_GOLDBOX + 450, // doomednum + S_FLAMEAURA_GOLDBOX, // spawnstate + 1, // spawnhealth + S_NULL, // seestate + sfx_None, // seesound + 8, // reactiontime + sfx_monton, // attacksound + S_FLAMEAURA_GOLDBOX, // painstate + 0, // painchance + sfx_None, // painsound + S_NULL, // meleestate + S_NULL, // missilestate + S_GOLDBOX_OFF1, // deathstate + S_NULL, // xdeathstate + sfx_pop, // deathsound + 0, // speed + 16*FRACUNIT, // radius + 36*FRACUNIT, // height + 0, // display offset + 100, // mass + MT_FLAMEAURA_ICON, // damage + sfx_None, // activesound + MF_SOLID|MF_SHOOTABLE|MF_MONITOR|MF_GRENADEBOUNCE, // flags + S_NULL // raisestate + }, + + { // MT_BUBBLEWRAP_GOLDBOX + 451, // doomednum + S_BUBBLEWRAP_GOLDBOX, // spawnstate + 1, // spawnhealth + S_NULL, // seestate + sfx_None, // seesound + 8, // reactiontime + sfx_monton, // attacksound + S_BUBBLEWRAP_GOLDBOX, // painstate + 0, // painchance + sfx_None, // painsound + S_NULL, // meleestate + S_NULL, // missilestate + S_GOLDBOX_OFF1, // deathstate + S_NULL, // xdeathstate + sfx_pop, // deathsound + 0, // speed + 16*FRACUNIT, // radius + 36*FRACUNIT, // height + 0, // display offset + 100, // mass + MT_BUBBLEWRAP_ICON, // damage + sfx_None, // activesound + MF_SOLID|MF_SHOOTABLE|MF_MONITOR|MF_GRENADEBOUNCE, // flags + S_NULL // raisestate + }, + + { // MT_THUNDERCOIN_GOLDBOX + 452, // doomednum + S_THUNDERCOIN_GOLDBOX, // spawnstate + 1, // spawnhealth + S_NULL, // seestate + sfx_None, // seesound + 8, // reactiontime + sfx_monton, // attacksound + S_THUNDERCOIN_GOLDBOX, // painstate + 0, // painchance + sfx_None, // painsound + S_NULL, // meleestate + S_NULL, // missilestate + S_GOLDBOX_OFF1, // deathstate + S_NULL, // xdeathstate + sfx_pop, // deathsound + 0, // speed + 16*FRACUNIT, // radius + 36*FRACUNIT, // height + 0, // display offset + 100, // mass + MT_THUNDERCOIN_ICON, // damage + sfx_None, // activesound + MF_SOLID|MF_SHOOTABLE|MF_MONITOR|MF_GRENADEBOUNCE, // flags + S_NULL // raisestate + }, + { // MT_RING_REDBOX 414, // doomednum S_RING_REDBOX1, // spawnstate @@ -7185,6 +7430,87 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = S_NULL // raisestate }, + { // MT_FLAMEAURA_ICON + -1, // doomednum + S_FLAMEAURA_ICON1, // spawnstate + 1, // spawnhealth + S_NULL, // seestate + sfx_shield, // 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 + 2*FRACUNIT, // speed + 8*FRACUNIT, // radius + 14*FRACUNIT, // height + 0, // display offset + 100, // mass + 62*FRACUNIT, // damage + sfx_None, // activesound + MF_NOBLOCKMAP|MF_NOCLIP|MF_SCENERY|MF_NOGRAVITY|MF_BOXICON, // flags + S_NULL // raisestate + }, + + { // MT_BUBBLEWRAP_ICON + -1, // doomednum + S_BUBBLEWRAP_ICON1, // spawnstate + 1, // spawnhealth + S_NULL, // seestate + sfx_shield, // 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 + 2*FRACUNIT, // speed + 8*FRACUNIT, // radius + 14*FRACUNIT, // height + 0, // display offset + 100, // mass + 62*FRACUNIT, // damage + sfx_None, // activesound + MF_NOBLOCKMAP|MF_NOCLIP|MF_SCENERY|MF_NOGRAVITY|MF_BOXICON, // flags + S_NULL // raisestate + }, + + { // MT_THUNDERCOIN_ICON + -1, // doomednum + S_THUNDERCOIN_ICON1, // spawnstate + 1, // spawnhealth + S_NULL, // seestate + sfx_shield, // 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 + 2*FRACUNIT, // speed + 8*FRACUNIT, // radius + 14*FRACUNIT, // height + 0, // display offset + 100, // mass + 62*FRACUNIT, // damage + sfx_None, // activesound + MF_NOBLOCKMAP|MF_NOCLIP|MF_SCENERY|MF_NOGRAVITY|MF_BOXICON, // flags + S_NULL // raisestate + }, + { // MT_ROCKET -1, // doomednum S_ROCKET, // spawnstate @@ -10428,7 +10754,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = S_NULL // raisestate }, - { // MT_GREENORB + { // MT_ELEMENTAL_ORB -1, // doomednum S_ELEM1, // spawnstate 1000, // spawnhealth @@ -10447,7 +10773,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = SH_ELEMENTAL, // speed 64*FRACUNIT, // radius 64*FRACUNIT, // height - 1, // display offset + 2, // display offset 16, // mass 0, // damage sfx_None, // activesound @@ -10455,7 +10781,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = S_NULL // raisestate }, - { // MT_YELLOWORB + { // MT_ATTRACT_ORB -1, // doomednum S_MAGN1, // spawnstate 1000, // spawnhealth @@ -10474,7 +10800,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = SH_ATTRACT, // speed 64*FRACUNIT, // radius 64*FRACUNIT, // height - 1, // display offset + 2, // display offset 16, // mass 0, // damage sfx_None, // activesound @@ -10482,7 +10808,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = S_NULL // raisestate }, - { // MT_BLUEORB + { // MT_FORCE_ORB -1, // doomednum S_FORC1, // spawnstate 1000, // spawnhealth @@ -10501,7 +10827,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = SH_FORCE, // speed 64*FRACUNIT, // radius 64*FRACUNIT, // height - 1, // display offset + 2, // display offset 16, // mass 0, // damage sfx_None, // activesound @@ -10509,7 +10835,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = S_NULL // raisestate }, - { // MT_BLACKORB + { // MT_BOMB_ORB -1, // doomednum S_ARMA1, // spawnstate 1000, // spawnhealth @@ -10528,7 +10854,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = SH_BOMB, // speed 64*FRACUNIT, // radius 64*FRACUNIT, // height - 1, // display offset + 2, // display offset 16, // mass 0, // damage sfx_None, // activesound @@ -10536,7 +10862,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = S_NULL // raisestate }, - { // MT_WHITEORB + { // MT_JUMP_ORB -1, // doomednum S_WIND1, // spawnstate 1000, // spawnhealth @@ -10555,7 +10881,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = SH_JUMP, // speed 64*FRACUNIT, // radius 64*FRACUNIT, // height - 1, // display offset + 2, // display offset 16, // mass 0, // damage sfx_None, // activesound @@ -10563,7 +10889,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = S_NULL // raisestate }, - { // MT_PITYORB + { // MT_PITY_ORB -1, // doomednum S_PITY1, // spawnstate 1000, // spawnhealth @@ -10582,7 +10908,88 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = SH_PITY, // speed 64*FRACUNIT, // radius 64*FRACUNIT, // height - 1, // display offset + 2, // display offset + 16, // mass + 0, // damage + sfx_None, // activesound + MF_NOBLOCKMAP|MF_NOCLIP|MF_NOCLIPHEIGHT|MF_NOGRAVITY|MF_SCENERY, // flags + S_NULL // raisestate + }, + + { // MT_FLAMEAURA_ORB + -1, // doomednum + S_FIRSB1, // spawnstate + 1000, // spawnhealth + S_FIRS1, // seestate + sfx_None, // seesound + 8, // reactiontime + sfx_None, // attacksound + S_NULL, // painstate + SKINCOLOR_NONE, // painchance + sfx_None, // painsound + S_NULL, // meleestate + S_NULL, // missilestate + S_NULL, // deathstate + S_NULL, // xdeathstate + sfx_None, // deathsound + SH_FLAMEAURA, // speed + 64*FRACUNIT, // radius + 64*FRACUNIT, // height + -2, // display offset + 16, // mass + 0, // damage + sfx_None, // activesound + MF_NOBLOCKMAP|MF_NOCLIP|MF_NOCLIPHEIGHT|MF_NOGRAVITY|MF_SCENERY, // flags + S_NULL // raisestate + }, + + { // MT_BUBBLEWRAP_ORB + -1, // doomednum + S_BUBSB1, // spawnstate + 1000, // spawnhealth + S_BUBS1, // seestate + sfx_None, // seesound + 8, // reactiontime + sfx_None, // attacksound + S_NULL, // painstate + SKINCOLOR_NONE, // painchance + sfx_None, // painsound + S_NULL, // meleestate + S_NULL, // missilestate + S_NULL, // deathstate + S_NULL, // xdeathstate + sfx_None, // deathsound + SH_BUBBLEWRAP, // speed + 64*FRACUNIT, // radius + 64*FRACUNIT, // height + -2, // display offset + 16, // mass + 0, // damage + sfx_None, // activesound + MF_NOBLOCKMAP|MF_NOCLIP|MF_NOCLIPHEIGHT|MF_NOGRAVITY|MF_SCENERY, // flags + S_NULL // raisestate + }, + + { // MT_THUNDERCOIN_ORB + -1, // doomednum + S_ZAPSB1, // spawnstate + 1000, // spawnhealth + S_ZAPS1, // seestate + sfx_None, // seesound + 8, // reactiontime + sfx_None, // attacksound + S_NULL, // painstate + SKINCOLOR_NONE, // painchance + sfx_None, // painsound + S_NULL, // meleestate + S_NULL, // missilestate + S_NULL, // deathstate + S_NULL, // xdeathstate + sfx_None, // deathsound + SH_THUNDERCOIN, // speed + 64*FRACUNIT, // radius + 64*FRACUNIT, // height + -2, // display offset 16, // mass 0, // damage sfx_None, // activesound @@ -10609,7 +11016,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = 8, // speed 64*FRACUNIT, // radius 64*FRACUNIT, // height - 2, // display offset + 3, // display offset 16, // mass 0, // damage sfx_None, // activesound diff --git a/src/info.h b/src/info.h index 16666ed96..638657226 100644 --- a/src/info.h +++ b/src/info.h @@ -56,6 +56,9 @@ void A_BombShield(); // Obtained Bomb Shield void A_WaterShield(); // Obtained Water Shield void A_ForceShield(); // Obtained Force Shield void A_PityShield(); // Obtained Pity Shield. We're... sorry. +void A_FlameShield(); // Obtained Flame Shield +void A_BubbleShield(); // Obtained Bubble Shield +void A_ThunderShield(); // Obtained Thunder Shield void A_GravityBox(); void A_ScoreRise(); // Rise the score logo void A_ParticleSpawn(); @@ -351,6 +354,9 @@ typedef enum sprite SPR_TVRC, // ReCycler SPR_TV1K, // 1,000 points (1 K) SPR_TVTK, // 10,000 points (Ten K) + SPR_TVFL, // FLame shield + SPR_TVBB, // BuBble shield + SPR_TVZP, // Thunder shield (ZaP) // Projectiles SPR_MISL, @@ -435,6 +441,9 @@ typedef enum sprite SPR_ELEM, // Elemental Shield Orb and Fire SPR_FORC, // Force Shield Orb SPR_PITY, // Pity Shield Orb + SPR_FIRS, // Flame Shield Orb + SPR_BUBS, // Bubble Shield Orb + SPR_ZAPS, // Thunder Shield Orb SPR_IVSP, // invincibility sparkles SPR_SSPK, // Super Sonic Spark @@ -1814,6 +1823,9 @@ typedef enum state S_RECYCLER_BOX, S_SCORE1K_BOX, S_SCORE10K_BOX, + S_FLAMEAURA_BOX, + S_BUBBLEWRAP_BOX, + S_THUNDERCOIN_BOX, // Gold Repeat Monitor States (one per box) S_PITY_GOLDBOX, @@ -1826,6 +1838,9 @@ typedef enum state S_INVULN_GOLDBOX, S_EGGMAN_GOLDBOX, S_GRAVITY_GOLDBOX, + S_FLAMEAURA_GOLDBOX, + S_BUBBLEWRAP_GOLDBOX, + S_THUNDERCOIN_GOLDBOX, // Team Ring Boxes (these are special) S_RING_REDBOX1, @@ -1887,6 +1902,15 @@ typedef enum state S_SCORE10K_ICON1, S_SCORE10K_ICON2, + S_FLAMEAURA_ICON1, + S_FLAMEAURA_ICON2, + + S_BUBBLEWRAP_ICON1, + S_BUBBLEWRAP_ICON2, + + S_THUNDERCOIN_ICON1, + S_THUNDERCOIN_ICON2, + // --- S_ROCKET, @@ -2317,6 +2341,68 @@ typedef enum state S_PITY9, S_PITY10, + S_FIRS1, + S_FIRS2, + S_FIRS3, + S_FIRS4, + S_FIRS5, + S_FIRS6, + S_FIRS7, + S_FIRS8, + S_FIRS9, + + S_FIRSB1, + S_FIRSB2, + S_FIRSB3, + S_FIRSB4, + S_FIRSB5, + S_FIRSB6, + S_FIRSB7, + S_FIRSB8, + S_FIRSB9, + + S_BUBS1, + S_BUBS2, + S_BUBS3, + S_BUBS4, + S_BUBS5, + S_BUBS6, + S_BUBS7, + S_BUBS8, + S_BUBS9, + + S_BUBSB1, + S_BUBSB2, + + S_ZAPS1, + S_ZAPS2, + S_ZAPS3, + S_ZAPS4, + S_ZAPS5, + S_ZAPS6, + S_ZAPS7, + S_ZAPS8, + S_ZAPS9, + S_ZAPS10, + S_ZAPS11, + S_ZAPS12, + S_ZAPS13, // blank frame + S_ZAPS14, + S_ZAPS15, + S_ZAPS16, + + S_ZAPSB1, // blank frame + S_ZAPSB2, + S_ZAPSB3, + S_ZAPSB4, + S_ZAPSB5, + S_ZAPSB6, + S_ZAPSB7, + S_ZAPSB8, + S_ZAPSB9, + S_ZAPSB10, + S_ZAPSB11, // blank frame + // Invincibility Sparkles S_IVSP, @@ -3158,6 +3244,9 @@ typedef enum mobj_type MT_RECYCLER_BOX, MT_SCORE1K_BOX, MT_SCORE10K_BOX, + MT_FLAMEAURA_BOX, + MT_BUBBLEWRAP_BOX, + MT_THUNDERCOIN_BOX, // Monitor boxes -- repeating (big) boxes MT_PITY_GOLDBOX, @@ -3170,6 +3259,9 @@ typedef enum mobj_type MT_INVULN_GOLDBOX, MT_EGGMAN_GOLDBOX, MT_GRAVITY_GOLDBOX, + MT_FLAMEAURA_GOLDBOX, + MT_BUBBLEWRAP_GOLDBOX, + MT_THUNDERCOIN_GOLDBOX, // Monitor boxes -- special MT_RING_REDBOX, @@ -3192,6 +3284,9 @@ typedef enum mobj_type MT_RECYCLER_ICON, MT_SCORE1K_ICON, MT_SCORE10K_ICON, + MT_FLAMEAURA_ICON, + MT_BUBBLEWRAP_ICON, + MT_THUNDERCOIN_ICON, // Projectiles MT_ROCKET, @@ -3344,12 +3439,15 @@ typedef enum mobj_type MT_EGGSTATUE2, // Powerup Indicators - MT_GREENORB, // Elemental shield mobj - MT_YELLOWORB, // Attract shield mobj - MT_BLUEORB, // Force shield mobj - MT_BLACKORB, // Armageddon shield mobj - MT_WHITEORB, // Whirlwind shield mobj - MT_PITYORB, // Pity shield mobj + MT_ELEMENTAL_ORB, // Elemental shield mobj + MT_ATTRACT_ORB, // Attract shield mobj + MT_FORCE_ORB, // Force shield mobj + MT_BOMB_ORB, // Armageddon shield mobj + MT_JUMP_ORB, // Whirlwind shield mobj + MT_PITY_ORB, // Pity shield mobj + MT_FLAMEAURA_ORB, // Flame shield mobj + MT_BUBBLEWRAP_ORB, // Bubble shield mobj + MT_THUNDERCOIN_ORB, // Thunder shield mobj MT_IVSP, // invincibility sparkles MT_SUPERSPARK, // Super Sonic Spark diff --git a/src/p_enemy.c b/src/p_enemy.c index d3434a828..7ef87ac44 100644 --- a/src/p_enemy.c +++ b/src/p_enemy.c @@ -104,6 +104,9 @@ void A_BombShield(mobj_t *actor); void A_WaterShield(mobj_t *actor); void A_ForceShield(mobj_t *actor); void A_PityShield(mobj_t *actor); +void A_FlameShield(mobj_t *actor); +void A_BubbleShield(mobj_t *actor); +void A_ThunderShield(mobj_t *actor); void A_GravityBox(mobj_t *actor); void A_ScoreRise(mobj_t *actor); void A_ParticleSpawn(mobj_t *actor); @@ -3435,6 +3438,93 @@ void A_PityShield(mobj_t *actor) S_StartSound(player->mo, sfx_itemup); } +// Function: A_FlameShield +// +// Description: Awards the player a flame shield. +// +// var1 = unused +// var2 = unused +// +void A_FlameShield(mobj_t *actor) +{ + player_t *player; + +#ifdef HAVE_BLUA + if (LUA_CallAction("A_FlameShield", actor)) + return; +#endif + if (!actor->target || !actor->target->player) + { + CONS_Debug(DBG_GAMELOGIC, "Powerup has no target.\n"); + return; + } + + player = actor->target->player; + + if (P_SwitchShield(player, SH_FLAMEAURA)) + S_StartSound(player->mo, actor->info->seesound); + else + S_StartSound(player->mo, sfx_itemup); +} + +// Function: A_BubbleShield +// +// Description: Awards the player a bubble shield. +// +// var1 = unused +// var2 = unused +// +void A_BubbleShield(mobj_t *actor) +{ + player_t *player; + +#ifdef HAVE_BLUA + if (LUA_CallAction("A_BubbleShield", actor)) + return; +#endif + if (!actor->target || !actor->target->player) + { + CONS_Debug(DBG_GAMELOGIC, "Powerup has no target.\n"); + return; + } + + player = actor->target->player; + + if (P_SwitchShield(player, SH_BUBBLEWRAP)) + S_StartSound(player->mo, actor->info->seesound); + else + S_StartSound(player->mo, sfx_itemup); +} + +// Function: A_ThunderShield +// +// Description: Awards the player a thunder shield. +// +// var1 = unused +// var2 = unused +// +void A_ThunderShield(mobj_t *actor) +{ + player_t *player; + +#ifdef HAVE_BLUA + if (LUA_CallAction("A_ThunderShield", actor)) + return; +#endif + if (!actor->target || !actor->target->player) + { + CONS_Debug(DBG_GAMELOGIC, "Powerup has no target.\n"); + return; + } + + player = actor->target->player; + + if (P_SwitchShield(player, SH_THUNDERCOIN)) + S_StartSound(player->mo, actor->info->seesound); + else + S_StartSound(player->mo, sfx_itemup); +} + // Function: A_GravityBox // diff --git a/src/p_floor.c b/src/p_floor.c index 220b87572..3d18cc3bd 100644 --- a/src/p_floor.c +++ b/src/p_floor.c @@ -1748,12 +1748,15 @@ static mobj_t *SearchMarioNode(msecnode_t *node) case MT_GHOST: case MT_OVERLAY: case MT_EMERALDSPAWN: - case MT_GREENORB: - case MT_YELLOWORB: - case MT_BLUEORB: - case MT_BLACKORB: - case MT_WHITEORB: - case MT_PITYORB: + case MT_ELEMENTAL_ORB: + case MT_ATTRACT_ORB: + case MT_FORCE_ORB: + case MT_BOMB_ORB: + case MT_JUMP_ORB: + case MT_PITY_ORB: + case MT_FLAMEAURA_ORB: + case MT_BUBBLEWRAP_ORB: + case MT_THUNDERCOIN_ORB: case MT_IVSP: case MT_SUPERSPARK: case MT_RAIN: diff --git a/src/p_mobj.c b/src/p_mobj.c index 822f2ef85..2cd6b7d77 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -6764,7 +6764,7 @@ void P_MobjThinker(mobj_t *mobj) } else P_AddOverlay(mobj); - if ((mobj->target->type == MT_GREENORB) + if ((mobj->target->type == MT_ELEMENTAL_ORB) && (mobj->target->target) && (mobj->target->target->player) && ((mobj->target->target->player->powers[pw_shield] & SH_NOSTACK) == SH_ELEMENTAL) @@ -6775,15 +6775,18 @@ void P_MobjThinker(mobj_t *mobj) mobj->tics++; } break; - case MT_BLACKORB: - case MT_WHITEORB: - case MT_GREENORB: - case MT_BLUEORB: - case MT_PITYORB: + case MT_BOMB_ORB: + case MT_JUMP_ORB: + case MT_ELEMENTAL_ORB: + case MT_FORCE_ORB: + case MT_PITY_ORB: + case MT_FLAMEAURA_ORB: + case MT_BUBBLEWRAP_ORB: + case MT_THUNDERCOIN_ORB: if (!P_AddShield(mobj)) return; break; - case MT_YELLOWORB: + case MT_ATTRACT_ORB: if (!P_AddShield(mobj)) return; if ((mobj->target) diff --git a/src/p_user.c b/src/p_user.c index 6ae507f0c..df28806b6 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -1348,23 +1348,32 @@ void P_SpawnShieldOrb(player_t *player) #endif if (player->powers[pw_shield] & SH_FORCE) - orbtype = MT_BLUEORB; + orbtype = MT_FORCE_ORB; else switch (player->powers[pw_shield] & SH_NOSTACK) { case SH_JUMP: - orbtype = MT_WHITEORB; + orbtype = MT_JUMP_ORB; break; case SH_ATTRACT: - orbtype = MT_YELLOWORB; + orbtype = MT_ATTRACT_ORB; break; case SH_ELEMENTAL: - orbtype = MT_GREENORB; + orbtype = MT_ELEMENTAL_ORB; break; case SH_BOMB: - orbtype = MT_BLACKORB; + orbtype = MT_BOMB_ORB; break; case SH_PITY: - orbtype = MT_PITYORB; + orbtype = MT_PITY_ORB; + break; + case SH_FLAMEAURA: + orbtype = MT_FLAMEAURA_ORB; + break; + case SH_BUBBLEWRAP: + orbtype = MT_BUBBLEWRAP_ORB; + break; + case SH_THUNDERCOIN: + orbtype = MT_THUNDERCOIN_ORB; break; case SH_FIREFLOWER: if (!(player->powers[pw_super] || (mariomode && player->powers[pw_invulnerability]))) diff --git a/src/st_stuff.c b/src/st_stuff.c index 8f36d5128..08d4204af 100644 --- a/src/st_stuff.c +++ b/src/st_stuff.c @@ -99,6 +99,9 @@ static patch_t *ringshield; static patch_t *watershield; static patch_t *bombshield; static patch_t *pityshield; +static patch_t *flameshield; +static patch_t *bubbleshield; +static patch_t *thundershield; static patch_t *invincibility; static patch_t *sneakers; static patch_t *gravboots; @@ -288,15 +291,18 @@ void ST_LoadGraphics(void) scatterring = W_CachePatchName("SCATIND", PU_HUDGFX); grenadering = W_CachePatchName("GRENIND", PU_HUDGFX); railring = W_CachePatchName("RAILIND", PU_HUDGFX); - jumpshield = W_CachePatchName("WHTVB0", PU_HUDGFX); - forceshield = W_CachePatchName("BLTVB0", PU_HUDGFX); - ringshield = W_CachePatchName("YLTVB0", PU_HUDGFX); - watershield = W_CachePatchName("ELTVB0", PU_HUDGFX); - bombshield = W_CachePatchName("BKTVB0", PU_HUDGFX); - pityshield = W_CachePatchName("GRTVB0", PU_HUDGFX); - invincibility = W_CachePatchName("PINVB0", PU_HUDGFX); - sneakers = W_CachePatchName("SHTVB0", PU_HUDGFX); - gravboots = W_CachePatchName("GBTVB0", PU_HUDGFX); + jumpshield = W_CachePatchName("TVWWC0", PU_HUDGFX); + forceshield = W_CachePatchName("TVFOC0", PU_HUDGFX); + ringshield = W_CachePatchName("TVATC0", PU_HUDGFX); + watershield = W_CachePatchName("TVELC0", PU_HUDGFX); + bombshield = W_CachePatchName("TVARC0", PU_HUDGFX); + pityshield = W_CachePatchName("TVPIC0", PU_HUDGFX); + flameshield = W_CachePatchName("TVFLC0", PU_HUDGFX); + bubbleshield = W_CachePatchName("TVBBC0", PU_HUDGFX); + thundershield = W_CachePatchName("TVZPC0", PU_HUDGFX); + invincibility = W_CachePatchName("TVIVC0", PU_HUDGFX); + sneakers = W_CachePatchName("TVSSC0", PU_HUDGFX); + gravboots = W_CachePatchName("TVGVC0", PU_HUDGFX); tagico = W_CachePatchName("TAGICO", PU_HUDGFX); rflagico = W_CachePatchName("RFLAGICO", PU_HUDGFX); @@ -805,11 +811,14 @@ static void ST_drawFirstPersonHUD(void) } else switch (player->powers[pw_shield] & SH_NOSTACK) { - case SH_JUMP: p = jumpshield; break; - case SH_ELEMENTAL: p = watershield; break; - case SH_BOMB: p = bombshield; break; - case SH_ATTRACT: p = ringshield; break; - case SH_PITY: p = pityshield; break; + case SH_JUMP: p = jumpshield; break; + case SH_ELEMENTAL: p = watershield; break; + case SH_BOMB: p = bombshield; break; + case SH_ATTRACT: p = ringshield; break; + case SH_PITY: p = pityshield; break; + case SH_FLAMEAURA: p = flameshield; break; + case SH_BUBBLEWRAP: p = bubbleshield; break; + case SH_THUNDERCOIN: p = thundershield; break; default: break; } From aa8a454ea9ed28524907686315ee3ec515f9e011 Mon Sep 17 00:00:00 2001 From: toasterbabe Date: Thu, 13 Oct 2016 15:13:33 +0100 Subject: [PATCH 052/172] Turning some shield attributes into flags means that environmental protection and ring-pulling can be more elegantly handled. As a consequence, the S3 shields now have all their passives, and are just waiting on me to give them actives (two of which don't have the necessary sprites for...) --- src/d_player.h | 34 ++++++++++++++++++++++------------ src/dehacked.c | 25 ++++++++++++++++--------- src/p_enemy.c | 10 +++++----- src/p_inter.c | 15 +++++---------- src/p_mobj.c | 11 ++++++++--- src/p_spec.c | 2 +- src/p_user.c | 6 +++--- 7 files changed, 60 insertions(+), 43 deletions(-) diff --git a/src/d_player.h b/src/d_player.h index 77ad34dab..a7b19439d 100644 --- a/src/d_player.h +++ b/src/d_player.h @@ -181,25 +181,35 @@ typedef enum typedef enum { SH_NONE = 0, - // Standard shields + + // Shield flags + SH_PROTECTFIRE = 0x400, + SH_PROTECTWATER = 0x800, + SH_PROTECTELECTRICITY = 0x1000, + + // Indivisible shields + SH_PITY = 1, SH_JUMP, - SH_ATTRACT, - SH_ELEMENTAL, SH_BOMB, - // Pity shield: the world's most basic shield ever, given to players who suck at Match - SH_PITY, - // Sonic 3 shields - SH_FLAMEAURA, - SH_BUBBLEWRAP, - SH_THUNDERCOIN, - // The fireflower used to be stackable with other shields. Not anymore. SH_FIREFLOWER, + + // normal shields that use flags + SH_ATTRACT = SH_PROTECTELECTRICITY, + SH_ELEMENTAL = SH_PROTECTFIRE|SH_PROTECTWATER, + + // Sonic 3 shields + SH_FLAMEAURA = SH_PROTECTFIRE, + SH_BUBBLEWRAP = SH_PROTECTWATER, + SH_THUNDERCOIN = SH_JUMP|SH_PROTECTELECTRICITY, + // The force shield uses the lower 8 bits to count how many extra hits are left. SH_FORCE = 0x100, SH_FORCEHP = 0xFF, // to be used as a bitmask only - // The mushroom CAN stack with other shields. + + // Mostly for use with Mario mode. SH_MUSHROOM = 0x200, - SH_STACK = SH_MUSHROOM, //|SH_FIREFLOWER, + + SH_STACK = SH_MUSHROOM, // second-layer shields SH_NOSTACK = ~SH_STACK } shieldtype_t; // pw_shield diff --git a/src/dehacked.c b/src/dehacked.c index bd3f8455f..20dce51d4 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -7174,21 +7174,28 @@ struct { {"PRECIP_STORM_NOSTRIKES",PRECIP_STORM_NOSTRIKES}, // Shields - // These ones use the lower 8 bits {"SH_NONE",SH_NONE}, + // Shield flags + {"SH_PROTECTFIRE",SH_PROTECTFIRE}, + {"SH_PROTECTWATER",SH_PROTECTWATER}, + {"SH_PROTECTELECTRICITY",SH_PROTECTELECTRICITY}, + // Indivisible shields + {"SH_PITY",SH_PITY}, {"SH_JUMP",SH_JUMP}, + {"SH_BOMB",SH_BOMB}, + {"SH_FIREFLOWER",SH_FIREFLOWER}, + // normal shields that use flags {"SH_ATTRACT",SH_ATTRACT}, {"SH_ELEMENTAL",SH_ELEMENTAL}, - {"SH_BOMB",SH_BOMB}, + // Sonic 3 shields + {"SH_FLAMEAURA",SH_FLAMEAURA}, {"SH_BUBBLEWRAP",SH_BUBBLEWRAP}, {"SH_THUNDERCOIN",SH_THUNDERCOIN}, - {"SH_FLAMEAURA",SH_FLAMEAURA}, - {"SH_PITY",SH_PITY}, - {"SH_FIREFLOWER",SH_FIREFLOWER}, - // These ones are special and use the upper bits - {"SH_FORCE",SH_FORCE}, // Lower bits are how many hits left, 0 is the last hit - {"SH_MUSHROOM", SH_MUSHROOM}, // Can stack with other shields - // Stack masks + // The force shield uses the lower 8 bits to count how many extra hits are left. + {"SH_FORCE",SH_FORCE}, + {"SH_FORCEHP",SH_FORCEHP}, // to be used as a bitmask only + // Mostly for use with Mario mode. + {"SH_MUSHROOM", SH_MUSHROOM}, {"SH_STACK",SH_STACK}, {"SH_NOSTACK",SH_NOSTACK}, diff --git a/src/p_enemy.c b/src/p_enemy.c index 7ef87ac44..6345a89c4 100644 --- a/src/p_enemy.c +++ b/src/p_enemy.c @@ -741,7 +741,7 @@ static boolean P_LookForShield(mobj_t *actor) (actor->type == MT_BLUETEAMRING && player->ctfteam != 2)) continue; - if ((player->powers[pw_shield] & SH_NOSTACK) == SH_ATTRACT + if ((player->powers[pw_shield] & SH_PROTECTELECTRICITY) && (P_AproxDistance(P_AproxDistance(actor->x-player->mo->x, actor->y-player->mo->y), actor->z-player->mo->z) < FixedMul(RING_DIST, player->mo->scale))) { P_SetTarget(&actor->tracer, player->mo); @@ -3817,7 +3817,7 @@ void A_AttractChase(mobj_t *actor) // Turn flingrings back into regular rings if attracted. if (actor->tracer && actor->tracer->player - && (actor->tracer->player->powers[pw_shield] & SH_NOSTACK) != SH_ATTRACT && actor->info->reactiontime && actor->type != (mobjtype_t)actor->info->reactiontime) + && !(actor->tracer->player->powers[pw_shield] & SH_PROTECTELECTRICITY) && actor->info->reactiontime && actor->type != (mobjtype_t)actor->info->reactiontime) { mobj_t *newring; newring = P_SpawnMobj(actor->x, actor->y, actor->z, actor->info->reactiontime); @@ -4022,7 +4022,7 @@ void A_ThrownRing(mobj_t *actor) // A non-homing ring getting attracted by a // magnetic player. If he gets too far away, make // sure to stop the attraction! - if ((!actor->tracer->health) || (actor->tracer->player && (actor->tracer->player->powers[pw_shield] & SH_NOSTACK) == SH_ATTRACT + if ((!actor->tracer->health) || (actor->tracer->player && (actor->tracer->player->powers[pw_shield] & SH_PROTECTELECTRICITY) && P_AproxDistance(P_AproxDistance(actor->tracer->x-actor->x, actor->tracer->y-actor->y), actor->tracer->z-actor->z) > FixedMul(RING_DIST/4, actor->tracer->scale))) { @@ -4030,7 +4030,7 @@ void A_ThrownRing(mobj_t *actor) } if (actor->tracer && (actor->tracer->health) - && (actor->tracer->player->powers[pw_shield] & SH_NOSTACK) == SH_ATTRACT)// Already found someone to follow. + && (actor->tracer->player->powers[pw_shield] & SH_PROTECTELECTRICITY))// Already found someone to follow. { const INT32 temp = actor->threshold; actor->threshold = 32000; @@ -4098,7 +4098,7 @@ void A_ThrownRing(mobj_t *actor) if (!P_CheckSight(actor, player->mo)) continue; // out of sight - if ((player->powers[pw_shield] & SH_NOSTACK) == SH_ATTRACT + if ((player->powers[pw_shield] & SH_PROTECTELECTRICITY) && dist < FixedMul(RING_DIST/4, player->mo->scale)) P_SetTarget(&actor->tracer, player->mo); return; diff --git a/src/p_inter.c b/src/p_inter.c index 0b2262ab7..c5938c90e 100644 --- a/src/p_inter.c +++ b/src/p_inter.c @@ -1459,7 +1459,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck) return; case MT_EXTRALARGEBUBBLE: - if ((player->powers[pw_shield] & SH_NOSTACK) == SH_ELEMENTAL) + if (player->powers[pw_shield] & SH_PROTECTWATER) return; if (maptol & TOL_NIGHTS) return; @@ -3022,28 +3022,23 @@ boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 da if (!(target->player->pflags & (PF_NIGHTSMODE|PF_NIGHTSFALL)) && (maptol & TOL_NIGHTS)) return false; -#define shieldtype (player->powers[pw_shield] & SH_NOSTACK) switch (damagetype) { case DMG_WATER: - if (shieldtype == SH_BUBBLEWRAP - || shieldtype == SH_ELEMENTAL) + if (player->powers[pw_shield] & SH_PROTECTWATER) return false; // Invincible to water damage break; case DMG_FIRE: - if (shieldtype == SH_FLAMEAURA - || shieldtype == SH_ELEMENTAL) + if (player->powers[pw_shield] & SH_PROTECTFIRE) return false; // Invincible to fire damage break; case DMG_ELECTRIC: - if (shieldtype == SH_ATTRACT - || shieldtype == SH_THUNDERCOIN) + if (player->powers[pw_shield] & SH_PROTECTELECTRICITY) return false; // Invincible to electric damage break; default: break; } -#undef shieldtype } if (player->pflags & PF_NIGHTSMODE) // NiGHTS damage handling @@ -3067,7 +3062,7 @@ boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 da if (!force && inflictor && inflictor->flags & MF_FIRE) { - if ((player->powers[pw_shield] & SH_NOSTACK) == SH_ELEMENTAL) + if (player->powers[pw_shield] & SH_PROTECTFIRE) return false; // Invincible to fire objects if (G_PlatformGametype() && inflictor && source && source->player) diff --git a/src/p_mobj.c b/src/p_mobj.c index 2cd6b7d77..d87e3cc20 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -3619,15 +3619,20 @@ void P_MobjCheckWater(mobj_t *mobj) { if (!((p->powers[pw_super]) || (p->powers[pw_invulnerability]))) { - if ((p->powers[pw_shield] & SH_NOSTACK) == SH_ATTRACT) - { // Water removes attract shield. + if (p->powers[pw_shield] & SH_PROTECTELECTRICITY) + { // Water removes electric shields... p->powers[pw_shield] = p->powers[pw_shield] & SH_STACK; P_FlashPal(p, PAL_WHITE, 1); } + else if ((p->powers[pw_shield] & SH_PROTECTFIRE) && !(p->powers[pw_shield] & SH_PROTECTWATER)) + { // ...and fire-only shields. + p->powers[pw_shield] = p->powers[pw_shield] & SH_STACK; + P_FlashPal(p, PAL_NUKE, 1); + } } // Drown timer setting - if ((p->powers[pw_shield] & SH_NOSTACK) == SH_ELEMENTAL // Has elemental + if ((p->powers[pw_shield] & SH_PROTECTWATER) // Has water protection || (p->exiting) // Or exiting || (maptol & TOL_NIGHTS) // Or in NiGHTS mode || (mariomode)) // Or in Mario mode... diff --git a/src/p_spec.c b/src/p_spec.c index ed2ff055c..0119664aa 100644 --- a/src/p_spec.c +++ b/src/p_spec.c @@ -3562,7 +3562,7 @@ void P_ProcessSpecialSector(player_t *player, sector_t *sector, sector_t *rovers P_PlayerFlagBurst(player, false); break; case 12: // Space Countdown - if ((player->powers[pw_shield] & SH_NOSTACK) != SH_ELEMENTAL && !player->powers[pw_spacetime]) + if (!(player->powers[pw_shield] & SH_PROTECTWATER) && !player->powers[pw_spacetime]) player->powers[pw_spacetime] = spacetimetics + 1; break; case 13: // Ramp Sector (Increase step-up/down) diff --git a/src/p_user.c b/src/p_user.c index df28806b6..8ceef8d6e 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -2229,7 +2229,7 @@ static void P_DoBubbleBreath(player_t *player) fixed_t z = player->mo->z; mobj_t *bubble = NULL; - if (!(player->mo->eflags & MFE_UNDERWATER) || ((player->powers[pw_shield] & SH_NOSTACK) == SH_ELEMENTAL && !(player->pflags & PF_NIGHTSMODE)) || player->spectator) + if (!(player->mo->eflags & MFE_UNDERWATER) || ((player->powers[pw_shield] & SH_PROTECTWATER) && !(player->pflags & PF_NIGHTSMODE)) || player->spectator) return; if (player->charflags & SF_MACHINE) @@ -9242,7 +9242,7 @@ void P_PlayerThink(player_t *player) if (player->powers[pw_tailsfly] && player->powers[pw_tailsfly] < UINT16_MAX && player->charability != CA_SWIM && !(player->powers[pw_super] && ALL7EMERALDS(player->powers[pw_emeralds]))) // tails fly counter player->powers[pw_tailsfly]--; - if (player->powers[pw_underwater] && (player->pflags & PF_GODMODE || (player->powers[pw_shield] & SH_NOSTACK) == SH_ELEMENTAL)) + if (player->powers[pw_underwater] && (player->pflags & PF_GODMODE || (player->powers[pw_shield] & SH_PROTECTWATER))) { if (player->powers[pw_underwater] <= 12*TICRATE+1) P_RestoreMusic(player); //incase they were about to drown @@ -9252,7 +9252,7 @@ void P_PlayerThink(player_t *player) else if (player->powers[pw_underwater] && !(maptol & TOL_NIGHTS) && !((netgame || multiplayer) && player->spectator)) // underwater timer player->powers[pw_underwater]--; - if (player->powers[pw_spacetime] && (player->pflags & PF_GODMODE || (player->powers[pw_shield] & SH_NOSTACK) == SH_ELEMENTAL)) + if (player->powers[pw_spacetime] && (player->pflags & PF_GODMODE || (player->powers[pw_shield] & SH_PROTECTWATER))) player->powers[pw_spacetime] = 0; else if (player->powers[pw_spacetime] && !(maptol & TOL_NIGHTS) && !((netgame || multiplayer) && player->spectator)) // underwater timer player->powers[pw_spacetime]--; From 2acfc72d86dde21e77ae813e0d6b8d502c58f7d3 Mon Sep 17 00:00:00 2001 From: toasterbabe Date: Thu, 13 Oct 2016 15:13:33 +0100 Subject: [PATCH 053/172] Made P_SwitchShield take into account the force shield, then made A_ForceShield take the number of bonus hitpoints as its var1. (Also, drowning timer is properly reset by ALL protectwater shields, not just elemental.) --- src/info.c | 2 +- src/p_enemy.c | 61 ++++++++------------------------------------------- src/p_user.c | 30 ++++++++++++++++++++----- 3 files changed, 35 insertions(+), 58 deletions(-) diff --git a/src/info.c b/src/info.c index 85a9589c9..b991e6825 100644 --- a/src/info.c +++ b/src/info.c @@ -1670,7 +1670,7 @@ state_t states[NUMSTATES] = {SPR_TVAT, 2, 18, {A_RingShield},0, 0, S_NULL}, // S_ATTRACT_ICON2 {SPR_TVFO, FF_ANIMATE|2, 18, {NULL}, 3, 4, S_FORCE_ICON2}, // S_FORCE_ICON1 - {SPR_TVFO, 2, 18, {A_ForceShield}, 0, 0, S_NULL}, // S_FORCE_ICON2 + {SPR_TVFO, 2, 18, {A_ForceShield}, 1, 0, S_NULL}, // S_FORCE_ICON2 {SPR_TVAR, FF_ANIMATE|2, 18, {NULL}, 3, 4, S_ARMAGEDDON_ICON2}, // S_ARMAGEDDON_ICON1 {SPR_TVAR, 2, 18, {A_BombShield}, 0, 0, S_NULL}, // S_ARMAGEDDON_ICON2 diff --git a/src/p_enemy.c b/src/p_enemy.c index 6345a89c4..900547ccb 100644 --- a/src/p_enemy.c +++ b/src/p_enemy.c @@ -3324,29 +3324,19 @@ void A_WaterShield(mobj_t *actor) S_StartSound(player->mo, actor->info->seesound); else S_StartSound(player->mo, sfx_itemup); - - if (player->powers[pw_underwater] && player->powers[pw_underwater] <= 12*TICRATE + 1) - P_RestoreMusic(player); - - player->powers[pw_underwater] = 0; - - if (player->powers[pw_spacetime] > 1) - { - player->powers[pw_spacetime] = 0; - P_RestoreMusic(player); - } } // Function: A_ForceShield // // Description: Awards the player a force shield. // -// var1 = unused +// var1 = Number of additional hitpoints to give // var2 = unused // void A_ForceShield(mobj_t *actor) { player_t *player; + INT32 locvar1 = var1; #ifdef HAVE_BLUA if (LUA_CallAction("A_ForceShield", actor)) @@ -3358,51 +3348,18 @@ void A_ForceShield(mobj_t *actor) return; } + if (locvar1 < 0 || locvar1 > SH_FORCEHP) + { + CONS_Debug(DBG_GAMELOGIC, "Invalid number of additional hitpoints.\n"); + return; + } + player = actor->target->player; - //can't use P_SwitchShield(player, SH_FORCE) - special case - - if (mariomode) - { - mobj_t *scoremobj = P_SpawnMobj(player->mo->x, player->mo->y, player->mo->z + (player->mo->height / 2), MT_SCORE); - P_SetMobjState(scoremobj, mobjinfo[MT_SCORE].spawnstate+3); // 1000 - P_AddPlayerScore(player, 1000); - } - - if (!(player->powers[pw_shield] & SH_FORCE)) - { - // Just in case. - if (player->pflags & PF_SHIELDABILITY) - { - player->pflags &= ~PF_SHIELDABILITY; - player->homing = 0; - } - - if ((player->powers[pw_shield] & SH_NOSTACK) == SH_FIREFLOWER - && !(player->powers[pw_super] || (mariomode && player->powers[pw_invulnerability]))) - { - player->mo->color = player->skincolor; - G_GhostAddColor(GHC_NORMAL); - } - - S_StartSound(player->mo, actor->info->seesound); - } - else if (!mariomode) + if (P_SwitchShield(player, SH_FORCE|locvar1)) S_StartSound(player->mo, actor->info->seesound); else S_StartSound(player->mo, sfx_itemup); - - if ((player->powers[pw_shield] & SH_FORCE) && (player->powers[pw_shield] & SH_FORCEHP)) - return; // if you have a force shield with at least 2hp already, let's not go any further. - - if (mariomode) - { - player->mo->movecount = player->powers[pw_shield]; - player->powers[pw_marioflashing] = MARIOFLASHINGTICS; - } - - player->powers[pw_shield] = SH_FORCE|(mariomode ? SH_MUSHROOM : player->powers[pw_shield] & SH_STACK)|0x01; - P_SpawnShieldOrb(player); } // Function: A_PityShield diff --git a/src/p_user.c b/src/p_user.c index 8ceef8d6e..589e5e3c7 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -1443,10 +1443,16 @@ void P_SpawnShieldOrb(player_t *player) // // Returns whether to play a normal sound or an itemup. // -// Not for use if shieldtype would be SH_FORCE. -// boolean P_SwitchShield(player_t *player, UINT16 shieldtype) { + boolean donthavealready = (shieldtype & SH_FORCE) + ? (!(player->powers[pw_shield] & SH_FORCE) || (player->powers[pw_shield] & SH_FORCEHP) < (shieldtype & ~SH_FORCE)) + : ((player->powers[pw_shield] & SH_NOSTACK) != shieldtype); + + boolean stopshieldability = (shieldtype & SH_FORCE) + ? (!(player->powers[pw_shield] & SH_FORCE)) + : true; + if (mariomode) { mobj_t *scoremobj = P_SpawnMobj(player->mo->x, player->mo->y, player->mo->z + (player->mo->height / 2), MT_SCORE); @@ -1454,7 +1460,7 @@ boolean P_SwitchShield(player_t *player, UINT16 shieldtype) P_AddPlayerScore(player, 1000); } - if ((player->powers[pw_shield] & SH_NOSTACK) != shieldtype) + if (donthavealready) { if (mariomode) { @@ -1463,9 +1469,9 @@ boolean P_SwitchShield(player_t *player, UINT16 shieldtype) } // Just in case. - if (player->pflags & PF_SHIELDABILITY) + if (stopshieldability && player->pflags & PF_SHIELDABILITY) { - player->pflags &= ~PF_SPINNING|PF_SHIELDABILITY; // They'll still have PF_THOKKED... + player->pflags &= ~(PF_SPINNING|PF_SHIELDABILITY); // They'll still have PF_THOKKED... player->homing = 0; if (player->powers[pw_shield] & SH_FORCE) // Dash. { @@ -1486,6 +1492,20 @@ boolean P_SwitchShield(player_t *player, UINT16 shieldtype) player->powers[pw_shield] = shieldtype|(mariomode ? SH_MUSHROOM : player->powers[pw_shield] & SH_STACK); P_SpawnShieldOrb(player); + + if (shieldtype & SH_PROTECTWATER) + { + if (player->powers[pw_underwater] && player->powers[pw_underwater] <= 12*TICRATE + 1) + P_RestoreMusic(player); + + player->powers[pw_underwater] = 0; + + if (player->powers[pw_spacetime] > 1) + { + player->powers[pw_spacetime] = 0; + P_RestoreMusic(player); + } + } return true; } return (!mariomode); From 5ff507213bea4a9a0f987ff564a445684f9b5821 Mon Sep 17 00:00:00 2001 From: toasterbabe Date: Thu, 13 Oct 2016 15:13:33 +0100 Subject: [PATCH 054/172] * Some shield constants renamed. * Some shield sounds swapped (can be reverted later). * Partial implementation of S3K shield abilities. * The ability to elemental-groundpound onto gold monitors without going straight through them. * Force shield ability removed because nobody could agree on it, we'll keep it blank until another idea can get through the disagreement juggernaut. --- src/d_player.h | 10 +-- src/dehacked.c | 12 ++-- src/info.c | 52 +++++++------- src/info.h | 6 +- src/p_enemy.c | 16 ++--- src/p_floor.c | 4 +- src/p_inter.c | 6 +- src/p_map.c | 12 +++- src/p_mobj.c | 29 ++++---- src/p_user.c | 182 ++++++++++++++++++------------------------------- src/st_stuff.c | 4 +- 11 files changed, 150 insertions(+), 183 deletions(-) diff --git a/src/d_player.h b/src/d_player.h index a7b19439d..54960115f 100644 --- a/src/d_player.h +++ b/src/d_player.h @@ -185,22 +185,22 @@ typedef enum // Shield flags SH_PROTECTFIRE = 0x400, SH_PROTECTWATER = 0x800, - SH_PROTECTELECTRICITY = 0x1000, + SH_PROTECTELECTRIC = 0x1000, // Indivisible shields SH_PITY = 1, - SH_JUMP, - SH_BOMB, + SH_WHIRLWIND, + SH_ARMAGEDDON, SH_FIREFLOWER, // normal shields that use flags - SH_ATTRACT = SH_PROTECTELECTRICITY, + SH_ATTRACT = SH_PROTECTELECTRIC, SH_ELEMENTAL = SH_PROTECTFIRE|SH_PROTECTWATER, // Sonic 3 shields SH_FLAMEAURA = SH_PROTECTFIRE, SH_BUBBLEWRAP = SH_PROTECTWATER, - SH_THUNDERCOIN = SH_JUMP|SH_PROTECTELECTRICITY, + SH_THUNDERCOIN = SH_WHIRLWIND|SH_PROTECTELECTRIC, // The force shield uses the lower 8 bits to count how many extra hits are left. SH_FORCE = 0x100, diff --git a/src/dehacked.c b/src/dehacked.c index 20dce51d4..cfaa7b526 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -5459,6 +5459,8 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit "S_BUBSB1", "S_BUBSB2", + "S_BUBSB3", + "S_BUBSB4", "S_ZAPS1", "S_ZAPS2", @@ -6509,8 +6511,8 @@ static const char *const MOBJTYPE_LIST[] = { // array length left dynamic for s "MT_ELEMENTAL_ORB", // Elemental shield mobj "MT_ATTRACT_ORB", // Attract shield mobj "MT_FORCE_ORB", // Force shield mobj - "MT_BOMB_ORB", // Armageddon shield mobj - "MT_JUMP_ORB", // Whirlwind shield mobj + "MT_ARMAGEDDON_ORB", // Armageddon shield mobj + "MT_WHIRLWIND_ORB", // Whirlwind shield mobj "MT_PITY_ORB", // Pity shield mobj "MT_FLAMEAURA_ORB", // Flame shield mobj "MT_BUBBLEWRAP_ORB", // Bubble shield mobj @@ -7178,11 +7180,11 @@ struct { // Shield flags {"SH_PROTECTFIRE",SH_PROTECTFIRE}, {"SH_PROTECTWATER",SH_PROTECTWATER}, - {"SH_PROTECTELECTRICITY",SH_PROTECTELECTRICITY}, + {"SH_PROTECTELECTRIC",SH_PROTECTELECTRIC}, // Indivisible shields {"SH_PITY",SH_PITY}, - {"SH_JUMP",SH_JUMP}, - {"SH_BOMB",SH_BOMB}, + {"SH_WHIRLWIND",SH_WHIRLWIND}, + {"SH_ARMAGEDDON",SH_ARMAGEDDON}, {"SH_FIREFLOWER",SH_FIREFLOWER}, // normal shields that use flags {"SH_ATTRACT",SH_ATTRACT}, diff --git a/src/info.c b/src/info.c index b991e6825..56edd0b85 100644 --- a/src/info.c +++ b/src/info.c @@ -2175,18 +2175,20 @@ state_t states[NUMSTATES] = {SPR_FIRS, FF_FULLBRIGHT|FF_TRANS40|16, 2, {NULL}, 0, 0, S_FIRSB9}, // S_FIRSB8 {SPR_FIRS, FF_FULLBRIGHT|FF_TRANS40|17, 2, {NULL}, 0, 0, S_FIRSB1}, // S_FIRSB9 - {SPR_BUBS, FF_TRANS30| 2, 2, {NULL}, 0, 0, S_BUBS2}, // S_BUBS1 - {SPR_BUBS, FF_TRANS30| 3, 2, {NULL}, 0, 0, S_BUBS3}, // S_BUBS2 - {SPR_BUBS, FF_TRANS30| 4, 2, {NULL}, 0, 0, S_BUBS4}, // S_BUBS3 - {SPR_BUBS, FF_TRANS30| 5, 2, {NULL}, 0, 0, S_BUBS5}, // S_BUBS4 - {SPR_BUBS, FF_TRANS30| 6, 2, {NULL}, 0, 0, S_BUBS6}, // S_BUBS5 - {SPR_BUBS, FF_TRANS30| 7, 2, {NULL}, 0, 0, S_BUBS7}, // S_BUBS6 - {SPR_BUBS, FF_TRANS30| 8, 2, {NULL}, 0, 0, S_BUBS8}, // S_BUBS7 - {SPR_BUBS, FF_TRANS30| 9, 2, {NULL}, 0, 0, S_BUBS9}, // S_BUBS8 - {SPR_BUBS, FF_TRANS30|10, 2, {NULL}, 0, 0, S_BUBS1}, // S_BUBS9 + {SPR_BUBS, FF_TRANS30 , 2, {NULL}, 0, 0, S_BUBS2}, // S_BUBS1 + {SPR_BUBS, FF_TRANS30|1, 2, {NULL}, 0, 0, S_BUBS3}, // S_BUBS2 + {SPR_BUBS, FF_TRANS30|2, 2, {NULL}, 0, 0, S_BUBS4}, // S_BUBS3 + {SPR_BUBS, FF_TRANS30|3, 2, {NULL}, 0, 0, S_BUBS5}, // S_BUBS4 + {SPR_BUBS, FF_TRANS30|4, 2, {NULL}, 0, 0, S_BUBS6}, // S_BUBS5 + {SPR_BUBS, FF_TRANS30|5, 2, {NULL}, 0, 0, S_BUBS7}, // S_BUBS6 + {SPR_BUBS, FF_TRANS30|6, 2, {NULL}, 0, 0, S_BUBS8}, // S_BUBS7 + {SPR_BUBS, FF_TRANS30|7, 2, {NULL}, 0, 0, S_BUBS9}, // S_BUBS8 + {SPR_BUBS, FF_TRANS30|8, 2, {NULL}, 0, 0, S_BUBS1}, // S_BUBS9 - {SPR_BUBS, FF_TRANS30 , 2, {NULL}, 0, 0, S_BUBSB2}, // S_BUBSB1 - {SPR_BUBS, FF_TRANS30|1, 2, {NULL}, 0, 0, S_BUBSB1}, // S_BUBSB2 + {SPR_BUBS, FF_TRANS30| 9, 2, {NULL}, 0, 0, S_BUBSB2}, // S_BUBSB1 + {SPR_BUBS, FF_TRANS30|10, 2, {NULL}, 0, 0, S_BUBSB3}, // S_BUBSB2 + {SPR_BUBS, FF_TRANS30|11, 2, {NULL}, 0, 0, S_BUBSB4}, // S_BUBSB3 + {SPR_BUBS, FF_TRANS30|10, 2, {NULL}, 0, 0, S_BUBSB1}, // S_BUBSB4 {SPR_ZAPS, FF_FULLBRIGHT|FF_TRANS20 , 2, {NULL}, 0, 0, S_ZAPS2 }, // S_ZAPS1 {SPR_ZAPS, FF_FULLBRIGHT|FF_TRANS20| 1, 2, {NULL}, 0, 0, S_ZAPS3 }, // S_ZAPS2 @@ -7057,7 +7059,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = S_ATTRACT_ICON1, // spawnstate 1, // spawnhealth S_NULL, // seestate - sfx_shield, // seesound + sfx_s3k41, // seesound 8, // reactiontime sfx_None, // attacksound S_NULL, // painstate @@ -7111,7 +7113,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = S_ARMAGEDDON_ICON1, // spawnstate 1, // spawnhealth S_NULL, // seestate - sfx_shield, // seesound + sfx_s3k3e, // seesound 8, // reactiontime sfx_None, // attacksound S_NULL, // painstate @@ -7165,7 +7167,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = S_ELEMENTAL_ICON1, // spawnstate 1, // spawnhealth S_NULL, // seestate - sfx_shield, // seesound + sfx_s3k3f, // seesound 8, // reactiontime sfx_None, // attacksound S_NULL, // painstate @@ -7435,7 +7437,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = S_FLAMEAURA_ICON1, // spawnstate 1, // spawnhealth S_NULL, // seestate - sfx_shield, // seesound + sfx_s3k3e, // seesound 8, // reactiontime sfx_None, // attacksound S_NULL, // painstate @@ -7462,7 +7464,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = S_BUBBLEWRAP_ICON1, // spawnstate 1, // spawnhealth S_NULL, // seestate - sfx_shield, // seesound + sfx_s3k3f, // seesound 8, // reactiontime sfx_None, // attacksound S_NULL, // painstate @@ -7489,7 +7491,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = S_THUNDERCOIN_ICON1, // spawnstate 1, // spawnhealth S_NULL, // seestate - sfx_shield, // seesound + sfx_s3k41, // seesound 8, // reactiontime sfx_None, // attacksound S_NULL, // painstate @@ -10762,7 +10764,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = sfx_None, // seesound 0, // reactiontime sfx_None, // attacksound - S_ELEMF9, // painstate + S_NULL, // painstate SKINCOLOR_NONE, // painchance sfx_None, // painsound S_NULL, // meleestate @@ -10778,7 +10780,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = 0, // damage sfx_None, // activesound MF_NOBLOCKMAP|MF_NOCLIP|MF_NOCLIPHEIGHT|MF_NOGRAVITY|MF_SCENERY, // flags - S_NULL // raisestate + S_ELEMF9 // raisestate }, { // MT_ATTRACT_ORB @@ -10835,7 +10837,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = S_NULL // raisestate }, - { // MT_BOMB_ORB + { // MT_ARMAGEDDON_ORB -1, // doomednum S_ARMA1, // spawnstate 1000, // spawnhealth @@ -10851,7 +10853,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = S_NULL, // deathstate S_NULL, // xdeathstate sfx_None, // deathsound - SH_BOMB, // speed + SH_ARMAGEDDON, // speed 64*FRACUNIT, // radius 64*FRACUNIT, // height 2, // display offset @@ -10862,7 +10864,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = S_NULL // raisestate }, - { // MT_JUMP_ORB + { // MT_WHIRLWIND_ORB -1, // doomednum S_WIND1, // spawnstate 1000, // spawnhealth @@ -10878,7 +10880,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = S_NULL, // deathstate S_NULL, // xdeathstate sfx_None, // deathsound - SH_JUMP, // speed + SH_WHIRLWIND, // speed 64*FRACUNIT, // radius 64*FRACUNIT, // height 2, // display offset @@ -10978,7 +10980,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = sfx_None, // seesound 8, // reactiontime sfx_None, // attacksound - S_NULL, // painstate + S_ZAPSB11, // painstate SKINCOLOR_NONE, // painchance sfx_None, // painsound S_NULL, // meleestate @@ -10994,7 +10996,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = 0, // damage sfx_None, // activesound MF_NOBLOCKMAP|MF_NOCLIP|MF_NOCLIPHEIGHT|MF_NOGRAVITY|MF_SCENERY, // flags - S_NULL // raisestate + S_ZAPS14 // raisestate }, { // MT_IVSP diff --git a/src/info.h b/src/info.h index 638657226..a18a374d9 100644 --- a/src/info.h +++ b/src/info.h @@ -2373,6 +2373,8 @@ typedef enum state S_BUBSB1, S_BUBSB2, + S_BUBSB3, + S_BUBSB4, S_ZAPS1, S_ZAPS2, @@ -3442,8 +3444,8 @@ typedef enum mobj_type MT_ELEMENTAL_ORB, // Elemental shield mobj MT_ATTRACT_ORB, // Attract shield mobj MT_FORCE_ORB, // Force shield mobj - MT_BOMB_ORB, // Armageddon shield mobj - MT_JUMP_ORB, // Whirlwind shield mobj + MT_ARMAGEDDON_ORB, // Armageddon shield mobj + MT_WHIRLWIND_ORB, // Whirlwind shield mobj MT_PITY_ORB, // Pity shield mobj MT_FLAMEAURA_ORB, // Flame shield mobj MT_BUBBLEWRAP_ORB, // Bubble shield mobj diff --git a/src/p_enemy.c b/src/p_enemy.c index 900547ccb..cde3f6310 100644 --- a/src/p_enemy.c +++ b/src/p_enemy.c @@ -741,7 +741,7 @@ static boolean P_LookForShield(mobj_t *actor) (actor->type == MT_BLUETEAMRING && player->ctfteam != 2)) continue; - if ((player->powers[pw_shield] & SH_PROTECTELECTRICITY) + if ((player->powers[pw_shield] & SH_PROTECTELECTRIC) && (P_AproxDistance(P_AproxDistance(actor->x-player->mo->x, actor->y-player->mo->y), actor->z-player->mo->z) < FixedMul(RING_DIST, player->mo->scale))) { P_SetTarget(&actor->tracer, player->mo); @@ -3061,7 +3061,7 @@ void A_JumpShield(mobj_t *actor) player = actor->target->player; - if (P_SwitchShield(player, SH_JUMP)) + if (P_SwitchShield(player, SH_WHIRLWIND)) S_StartSound(player->mo, actor->info->seesound); else S_StartSound(player->mo, sfx_itemup); @@ -3289,11 +3289,11 @@ void A_BombShield(mobj_t *actor) player = actor->target->player; // If you already have a bomb shield, use it! - if ((player->powers[pw_shield] & SH_NOSTACK) == SH_BOMB) + if ((player->powers[pw_shield] & SH_NOSTACK) == SH_ARMAGEDDON) P_BlackOw(player); // Now we know for certain that we don't have a bomb shield, so add one. :3 - P_SwitchShield(player, SH_BOMB); // will never return false, so no need for sound test + P_SwitchShield(player, SH_ARMAGEDDON); // will never return false, so no need for sound test S_StartSound(player->mo, actor->info->seesound); } @@ -3774,7 +3774,7 @@ void A_AttractChase(mobj_t *actor) // Turn flingrings back into regular rings if attracted. if (actor->tracer && actor->tracer->player - && !(actor->tracer->player->powers[pw_shield] & SH_PROTECTELECTRICITY) && actor->info->reactiontime && actor->type != (mobjtype_t)actor->info->reactiontime) + && !(actor->tracer->player->powers[pw_shield] & SH_PROTECTELECTRIC) && actor->info->reactiontime && actor->type != (mobjtype_t)actor->info->reactiontime) { mobj_t *newring; newring = P_SpawnMobj(actor->x, actor->y, actor->z, actor->info->reactiontime); @@ -3979,7 +3979,7 @@ void A_ThrownRing(mobj_t *actor) // A non-homing ring getting attracted by a // magnetic player. If he gets too far away, make // sure to stop the attraction! - if ((!actor->tracer->health) || (actor->tracer->player && (actor->tracer->player->powers[pw_shield] & SH_PROTECTELECTRICITY) + if ((!actor->tracer->health) || (actor->tracer->player && (actor->tracer->player->powers[pw_shield] & SH_PROTECTELECTRIC) && P_AproxDistance(P_AproxDistance(actor->tracer->x-actor->x, actor->tracer->y-actor->y), actor->tracer->z-actor->z) > FixedMul(RING_DIST/4, actor->tracer->scale))) { @@ -3987,7 +3987,7 @@ void A_ThrownRing(mobj_t *actor) } if (actor->tracer && (actor->tracer->health) - && (actor->tracer->player->powers[pw_shield] & SH_PROTECTELECTRICITY))// Already found someone to follow. + && (actor->tracer->player->powers[pw_shield] & SH_PROTECTELECTRIC))// Already found someone to follow. { const INT32 temp = actor->threshold; actor->threshold = 32000; @@ -4055,7 +4055,7 @@ void A_ThrownRing(mobj_t *actor) if (!P_CheckSight(actor, player->mo)) continue; // out of sight - if ((player->powers[pw_shield] & SH_PROTECTELECTRICITY) + if ((player->powers[pw_shield] & SH_PROTECTELECTRIC) && dist < FixedMul(RING_DIST/4, player->mo->scale)) P_SetTarget(&actor->tracer, player->mo); return; diff --git a/src/p_floor.c b/src/p_floor.c index 3d18cc3bd..96d854a10 100644 --- a/src/p_floor.c +++ b/src/p_floor.c @@ -1751,8 +1751,8 @@ static mobj_t *SearchMarioNode(msecnode_t *node) case MT_ELEMENTAL_ORB: case MT_ATTRACT_ORB: case MT_FORCE_ORB: - case MT_BOMB_ORB: - case MT_JUMP_ORB: + case MT_ARMAGEDDON_ORB: + case MT_WHIRLWIND_ORB: case MT_PITY_ORB: case MT_FLAMEAURA_ORB: case MT_BUBBLEWRAP_ORB: diff --git a/src/p_inter.c b/src/p_inter.c index c5938c90e..822602fd8 100644 --- a/src/p_inter.c +++ b/src/p_inter.c @@ -1582,7 +1582,7 @@ static void P_HitDeathMessages(player_t *player, mobj_t *inflictor, mobj_t *sour else switch (inflictor->type) { case MT_PLAYER: - if ((inflictor->player->powers[pw_shield] & SH_NOSTACK) == SH_BOMB) + if ((inflictor->player->powers[pw_shield] & SH_NOSTACK) == SH_ARMAGEDDON) str = M_GetText("%s%s's armageddon blast %s %s.\n"); else if (inflictor->player->powers[pw_invulnerability]) str = M_GetText("%s%s's invincibility aura %s %s.\n"); @@ -2791,7 +2791,7 @@ void P_RemoveShield(player_t *player) { // Second layer shields player->powers[pw_shield] = SH_NONE; } - else if ((player->powers[pw_shield] & SH_NOSTACK) == SH_BOMB) // Give them what's coming to them! + else if ((player->powers[pw_shield] & SH_NOSTACK) == SH_ARMAGEDDON) // Give them what's coming to them! { P_BlackOw(player); // BAM! player->pflags |= PF_JUMPDOWN; @@ -3033,7 +3033,7 @@ boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 da return false; // Invincible to fire damage break; case DMG_ELECTRIC: - if (player->powers[pw_shield] & SH_PROTECTELECTRICITY) + if (player->powers[pw_shield] & SH_PROTECTELECTRIC) return false; // Invincible to electric damage break; default: diff --git a/src/p_map.c b/src/p_map.c index b3ad9b74f..bb904cc3d 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -1052,6 +1052,8 @@ static boolean PIT_CheckThing(mobj_t *thing) else if (thing->z - FixedMul(FRACUNIT, thing->scale) <= tmthing->z + tmthing->height && thing->z + thing->height + FixedMul(FRACUNIT, thing->scale) >= tmthing->z) { + boolean elementalpierce = (((tmthing->player->powers[pw_shield] & SH_NOSTACK) == SH_ELEMENTAL) + && (tmthing->player->pflags & PF_SHIELDABILITY)); if (thing->flags & MF_MONITOR && (tmthing->player->pflags & (PF_SPINNING|PF_GLIDING) || ((tmthing->player->pflags & PF_JUMPED) @@ -1059,11 +1061,12 @@ static boolean PIT_CheckThing(mobj_t *thing) && !(tmthing->player->charability == CA_TWINSPIN && tmthing->player->panim == PA_ABILITY))) || (tmthing->player->charability2 == CA2_MELEE && tmthing->player->panim == PA_ABILITY2) || ((tmthing->player->charflags & SF_STOMPDAMAGE) - && (P_MobjFlip(tmthing)*(tmthing->z - (thing->z + thing->height/2)) > 0) && (P_MobjFlip(tmthing)*tmthing->momz < 0)))) + && (P_MobjFlip(tmthing)*(tmthing->z - (thing->z + thing->height/2)) > 0) && (P_MobjFlip(tmthing)*tmthing->momz < 0)) + || elementalpierce)) { SINT8 flipval = P_MobjFlip(thing); // Save this value in case monitor gets removed. fixed_t *momz = &tmthing->momz; // tmthing gets changed by P_DamageMobj, so we need a new pointer?! X_x;; - boolean elementalpierce = (((tmthing->player->powers[pw_shield] & SH_NOSTACK) == SH_ELEMENTAL) && (tmthing->player->pflags & PF_SHIELDABILITY)); + fixed_t *z = &tmthing->z; // aau. P_DamageMobj(thing, tmthing, tmthing, 1, 0); // break the monitor // Going down? Then bounce back up. if ((P_MobjWasRemoved(thing) // Monitor was removed @@ -1071,7 +1074,10 @@ static boolean PIT_CheckThing(mobj_t *thing) && (flipval*(*momz) < 0) // monitor is on the floor and you're going down, or on the ceiling and you're going up && !elementalpierce) // you're not piercing through the monitor... *momz = -*momz; // Therefore, you should be thrust in the opposite direction, vertically. - return false; + if (!(elementalpierce && thing->flags & MF_GRENADEBOUNCE)) // prevent gold monitor clipthrough. + return false; + else + *z -= *momz; // to ensure proper collision. } } } diff --git a/src/p_mobj.c b/src/p_mobj.c index d87e3cc20..840d4aa49 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -3250,14 +3250,6 @@ static void P_PlayerZMovement(mobj_t *mo) P_SetPlayerMobjState(mo, S_PLAY_FALL); clipmomz = false; } - else if (mo->player->powers[pw_shield] & SH_FORCE) // Force shield's dodge dash. - { - P_SetPlayerMobjState(mo, S_PLAY_WALK); - mo->flags &= ~MF_NOGRAVITY; - mo->player->pflags &= ~(PF_FULLSTASIS|PF_SPINNING); - mo->momx >>= 3; - mo->momy >>= 3; - } } mo->player->pflags &= ~(PF_THOKKED|PF_CANCARRY|PF_SHIELDABILITY/*|PF_GLIDING*/); mo->player->jumping = 0; @@ -3619,7 +3611,7 @@ void P_MobjCheckWater(mobj_t *mobj) { if (!((p->powers[pw_super]) || (p->powers[pw_invulnerability]))) { - if (p->powers[pw_shield] & SH_PROTECTELECTRICITY) + if (p->powers[pw_shield] & SH_PROTECTELECTRIC) { // Water removes electric shields... p->powers[pw_shield] = p->powers[pw_shield] & SH_STACK; P_FlashPal(p, PAL_WHITE, 1); @@ -6774,14 +6766,25 @@ void P_MobjThinker(mobj_t *mobj) && (mobj->target->target->player) && ((mobj->target->target->player->powers[pw_shield] & SH_NOSTACK) == SH_ELEMENTAL) && (mobj->target->target->player->pflags & PF_SHIELDABILITY) - && (mobj->state->nextstate < mobj->target->info->painstate)) // Special casing for elemental shield piercing attack. + && (mobj->state->nextstate < mobj->target->info->raisestate)) // Special casing for elemental shield piercing attack. { - P_SetMobjState(mobj, mobj->target->info->painstate); + P_SetMobjState(mobj, mobj->target->info->raisestate); + mobj->tics++; + } + else if ((mobj->target->type == MT_THUNDERCOIN_ORB) + && (mobj->target->target) + && (mobj->target->target->player) + && ((mobj->target->target->player->powers[pw_shield] & SH_NOSTACK) == SH_THUNDERCOIN) + && (mobj->target->target->player->pflags & PF_SHIELDABILITY)) // Special casing for thundercoin shield jump.. + { + P_SetMobjState(mobj, mobj->target->info->raisestate); + P_SetMobjState(mobj->target, mobj->target->info->painstate); + mobj->target->target->player->pflags &= ~PF_SHIELDABILITY; mobj->tics++; } break; - case MT_BOMB_ORB: - case MT_JUMP_ORB: + case MT_ARMAGEDDON_ORB: + case MT_WHIRLWIND_ORB: case MT_ELEMENTAL_ORB: case MT_FORCE_ORB: case MT_PITY_ORB: diff --git a/src/p_user.c b/src/p_user.c index 589e5e3c7..85f640108 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -877,15 +877,6 @@ void P_DoPlayerPain(player_t *player, mobj_t *source, mobj_t *inflictor) // Useful when you want to kill everything the player is doing. void P_ResetPlayer(player_t *player) { - if (player->mo - && player->powers[pw_shield] & SH_FORCE // Dash. - && player->pflags & PF_SHIELDABILITY) - { - P_SetPlayerMobjState(player->mo, S_PLAY_FALL); - player->mo->flags &= ~MF_NOGRAVITY; - player->pflags &= ~PF_FULLSTASIS; - } - player->pflags &= ~(PF_SPINNING|PF_STARTDASH|PF_JUMPED|PF_GLIDING|PF_THOKKED|PF_CANCARRY|PF_SHIELDABILITY); player->powers[pw_carry] = CR_NONE; player->jumping = 0; @@ -1351,8 +1342,8 @@ void P_SpawnShieldOrb(player_t *player) orbtype = MT_FORCE_ORB; else switch (player->powers[pw_shield] & SH_NOSTACK) { - case SH_JUMP: - orbtype = MT_JUMP_ORB; + case SH_WHIRLWIND: + orbtype = MT_WHIRLWIND_ORB; break; case SH_ATTRACT: orbtype = MT_ATTRACT_ORB; @@ -1360,8 +1351,8 @@ void P_SpawnShieldOrb(player_t *player) case SH_ELEMENTAL: orbtype = MT_ELEMENTAL_ORB; break; - case SH_BOMB: - orbtype = MT_BOMB_ORB; + case SH_ARMAGEDDON: + orbtype = MT_ARMAGEDDON_ORB; break; case SH_PITY: orbtype = MT_PITY_ORB; @@ -1473,14 +1464,6 @@ boolean P_SwitchShield(player_t *player, UINT16 shieldtype) { player->pflags &= ~(PF_SPINNING|PF_SHIELDABILITY); // They'll still have PF_THOKKED... player->homing = 0; - if (player->powers[pw_shield] & SH_FORCE) // Dash. - { - P_SetPlayerMobjState(player->mo, S_PLAY_FALL); - player->mo->flags &= ~MF_NOGRAVITY; - player->pflags &= ~PF_FULLSTASIS; - player->mo->momx >>= 3; - player->mo->momy >>= 3; - } } if ((player->powers[pw_shield] & SH_NOSTACK) == SH_FIREFLOWER // it's implicit that the new shield isn't a fireflower @@ -3944,18 +3927,27 @@ static void P_DoSpinAbility(player_t *player, ticcmd_t *cmd) // void P_DoJumpShield(player_t *player) { + boolean electric = ((player->powers[pw_shield] & SH_PROTECTELECTRIC) == SH_PROTECTELECTRIC); + if (player->pflags & PF_THOKKED) return; player->pflags &= ~PF_JUMPED; P_DoJump(player, false); - player->pflags &= ~PF_JUMPED; - player->secondjump = 0; player->jumping = 0; + player->secondjump = 0; player->pflags |= PF_THOKKED|PF_SHIELDABILITY; player->pflags &= ~PF_SPINNING; - P_SetPlayerMobjState(player->mo, S_PLAY_FALL); - S_StartSound(player->mo, sfx_wdjump); + if (electric) + { + S_StartSound(player->mo, sfx_s3k45); + } + else + { + player->pflags &= ~PF_JUMPED; + P_SetPlayerMobjState(player->mo, S_PLAY_FALL); + S_StartSound(player->mo, sfx_wdjump); + } } // @@ -4026,7 +4018,7 @@ static void P_DoJumpStuff(player_t *player, ticcmd_t *cmd) {} else if (onground || player->climbing || (player->mo->tracer && player->powers[pw_carry])) {} - else if ((player->powers[pw_shield] & SH_NOSTACK) == SH_JUMP + else if ((player->powers[pw_shield] & SH_NOSTACK) == SH_WHIRLWIND && !(player->pflags & PF_JUMPED) && !(player->pflags & PF_USEDOWN)) P_DoJumpShield(player); @@ -4307,7 +4299,7 @@ static void P_DoJumpStuff(player_t *player, ticcmd_t *cmd) break; } } - else if ((player->powers[pw_shield] & SH_NOSTACK) == SH_JUMP && !player->powers[pw_super]) + else if ((player->powers[pw_shield] & SH_NOSTACK) == SH_WHIRLWIND && !player->powers[pw_super]) P_DoJumpShield(player); } @@ -6993,79 +6985,58 @@ static void P_MovePlayer(player_t *player) { if (player->pflags & PF_JUMPED) // If the player is jumping { - if (!(player->pflags & PF_USEDOWN)) // If the player is not holding down BT_USE + pflags_t check = (PF_USEDOWN|PF_GLIDING|PF_SLIDING|PF_THOKKED); + if (!(player->pflags & check)) // If the player is not holding down BT_USE, or having used an ability previously { - // Jump shield activation - if (!P_PlayerInPain(player) // If the player is not in pain - && !player->climbing // If the player is not climbing - && !(player->pflags & (PF_GLIDING|PF_SLIDING|PF_THOKKED)) // If the player is not gliding or sliding and hasn't used their ability - && !onground) // If the player isn't on the ground - { - if ((player->powers[pw_shield] & SH_NOSTACK) == SH_JUMP && !player->powers[pw_super]) - P_DoJumpShield(player); - else if (player->powers[pw_super] && ALL7EMERALDS(player->powers[pw_emeralds]) && player->charability == CA_FLY) - { - P_DoJumpShield(player); - player->mo->momz *= 2; - } - } - // Bomb shield activation - if ((player->powers[pw_shield] & SH_NOSTACK) == SH_BOMB) - { - // Don't let Super Sonic or invincibility use it - if (!(player->powers[pw_super] || player->powers[pw_invulnerability])) - P_BlackOw(player); - } - // Attract shield activation - if ((player->powers[pw_shield] & SH_NOSTACK) == SH_ATTRACT) - { - if (!(player->pflags & PF_THOKKED)) - { - player->pflags |= PF_THOKKED|PF_SHIELDABILITY; - player->homing = 2; - if (P_LookForEnemies(player, false) && player->mo->tracer) - { - S_StartSound(player->mo, sfx_s3k40); - player->homing = 3*TICRATE; - } - else - S_StartSound(player->mo, sfx_s3k41); - } - } - // Elemental shield activation - if ((player->powers[pw_shield] & SH_NOSTACK) == SH_ELEMENTAL) - { - if (!(player->pflags & PF_THOKKED)) - { - player->pflags |= PF_THOKKED|PF_SHIELDABILITY; - S_StartSound(player->mo, sfx_s3k43); - player->mo->momx = player->mo->momy = 0; - P_SetObjectMomZ(player->mo, -24*FRACUNIT, false); - } - } // Force shield activation if (player->powers[pw_shield] & SH_FORCE) + ; // TODO + else { - if (!(player->pflags & PF_THOKKED)) + switch (player->powers[pw_shield] & SH_NOSTACK) { - angle_t dashangle = player->mo->angle; -#if 1 // shadow.wad style redirection - hold down directional keys to set your path, go backwards by default - if (!(player->pflags & PF_ANALOGMODE) && (player->cmd.forwardmove || player->cmd.sidemove)) - dashangle += R_PointToAngle2(0, 0, player->cmd.forwardmove<cmd.sidemove<mo->momx || player->mo->momy) - dashangle = R_PointToAngle2(0, 0, player->mo->momx, player->mo->momy); -#endif - dashangle += ANGLE_180; - P_ResetPlayer(player); - player->homing = 2 + (player->powers[pw_shield] & SH_FORCEHP); // might get ridiculous with 256 hitpoints, don't you think? - S_StartSound(player->mo, sfx_s3k47); - P_SetPlayerMobjState(player->mo, S_PLAY_SPIN); - player->pflags |= PF_SPINNING|PF_THOKKED|PF_SHIELDABILITY; - player->mo->flags |= MF_NOGRAVITY; - P_InstaThrust(player->mo, dashangle, 64*FRACUNIT); - player->mo->momz = 0; + // Whirlwind/Thundercoin shield activation + case SH_WHIRLWIND: + case SH_THUNDERCOIN: + if (!player->powers[pw_super]) + P_DoJumpShield(player); + break; + // Armageddon shield activation + case SH_ARMAGEDDON: + // Don't let Super Sonic or invincibility use it + if (!(player->powers[pw_super] || player->powers[pw_invulnerability])) + P_BlackOw(player); + break; + // Attract shield activation + case SH_ATTRACT: + player->pflags |= PF_THOKKED|PF_SHIELDABILITY; + player->homing = 2; + if (P_LookForEnemies(player, false) && player->mo->tracer) + { + S_StartSound(player->mo, sfx_s3k40); + player->homing = 3*TICRATE; + } + else + S_StartSound(player->mo, sfx_s3k45); + break; + // Elemental/Bubblewrap shield activation + case SH_ELEMENTAL: + case SH_BUBBLEWRAP: + player->pflags |= PF_THOKKED|PF_SHIELDABILITY; + player->mo->momx = player->mo->momy = 0; + P_SetObjectMomZ(player->mo, -24*FRACUNIT, false); + S_StartSound(player->mo, + ((player->powers[pw_shield] & SH_NOSTACK) == SH_ELEMENTAL) + ? sfx_s3k43 + : sfx_s3k44); + break; + // Flame shield activation + case SH_FLAMEAURA: + player->pflags |= PF_THOKKED|PF_SHIELDABILITY; + P_Thrust(player->mo, player->mo->angle, 30*player->mo->scale - FixedMul(FixedSqrt(player->speed), FixedSqrt(player->mo->scale))); + S_StartSound(player->mo, sfx_s3k43); + default: + break; } } } @@ -7084,26 +7055,7 @@ static void P_MovePlayer(player_t *player) } // HOMING option. - if (player->powers[pw_shield] & SH_FORCE // Dash. - && player->pflags & PF_SHIELDABILITY) - { - if (player->homing) - { - player->pflags |= PF_FULLSTASIS; - player->mo->momz = 0; - if (!(player->pflags & PF_SPINNING)) - player->homing = 0; - } - - if (player->homing == 0) - { - P_ResetPlayer(player); - player->pflags |= PF_THOKKED; // silly silly - player->mo->momx >>= 3; - player->mo->momy >>= 3; - } - } - else if ((player->powers[pw_shield] & SH_NOSTACK) == SH_ATTRACT // Sonic 3D Blast. + if ((player->powers[pw_shield] & SH_NOSTACK) == SH_ATTRACT // Sonic 3D Blast. && player->pflags & PF_SHIELDABILITY) { if (player->homing && player->mo->tracer) diff --git a/src/st_stuff.c b/src/st_stuff.c index 08d4204af..14c879c3e 100644 --- a/src/st_stuff.c +++ b/src/st_stuff.c @@ -811,9 +811,9 @@ static void ST_drawFirstPersonHUD(void) } else switch (player->powers[pw_shield] & SH_NOSTACK) { - case SH_JUMP: p = jumpshield; break; + case SH_WHIRLWIND: p = jumpshield; break; case SH_ELEMENTAL: p = watershield; break; - case SH_BOMB: p = bombshield; break; + case SH_ARMAGEDDON: p = bombshield; break; case SH_ATTRACT: p = ringshield; break; case SH_PITY: p = pityshield; break; case SH_FLAMEAURA: p = flameshield; break; From 76700241f675f900194e507a2a41feaf9ac6cc8b Mon Sep 17 00:00:00 2001 From: toasterbabe Date: Thu, 13 Oct 2016 15:13:33 +0100 Subject: [PATCH 055/172] Leaky Mario mode bug fixed. --- src/p_inter.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/p_inter.c b/src/p_inter.c index 822602fd8..3b8707e62 100644 --- a/src/p_inter.c +++ b/src/p_inter.c @@ -2304,7 +2304,8 @@ void P_KillMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, UINT8 damaget target->fuse = TICRATE*3; // timer before mobj disappears from view (even if not an actual player) if (!mariodeathpit) { - target->player->powers[pw_marioflashing] = MARIOFLASHINGTICS; + if (mariomode) + target->player->powers[pw_marioflashing] = MARIOFLASHINGTICS; target->momx = target->momy = target->momz = 0; } if (damagetype == DMG_DROWNED) // drowned From 76b30df52808bec5dff031b07527359b935d1f61 Mon Sep 17 00:00:00 2001 From: toasterbabe Date: Thu, 13 Oct 2016 15:13:33 +0100 Subject: [PATCH 056/172] * Slower Bubblewrap animation. * Corrected bounce height for Elemental underwater. * Using Elemental ability in goo is cancelled. * Different Attract failure sound. --- src/info.c | 18 +++++++++--------- src/p_mobj.c | 9 ++++++++- src/p_user.c | 2 +- 3 files changed, 18 insertions(+), 11 deletions(-) diff --git a/src/info.c b/src/info.c index 56edd0b85..9aea3b3df 100644 --- a/src/info.c +++ b/src/info.c @@ -2175,15 +2175,15 @@ state_t states[NUMSTATES] = {SPR_FIRS, FF_FULLBRIGHT|FF_TRANS40|16, 2, {NULL}, 0, 0, S_FIRSB9}, // S_FIRSB8 {SPR_FIRS, FF_FULLBRIGHT|FF_TRANS40|17, 2, {NULL}, 0, 0, S_FIRSB1}, // S_FIRSB9 - {SPR_BUBS, FF_TRANS30 , 2, {NULL}, 0, 0, S_BUBS2}, // S_BUBS1 - {SPR_BUBS, FF_TRANS30|1, 2, {NULL}, 0, 0, S_BUBS3}, // S_BUBS2 - {SPR_BUBS, FF_TRANS30|2, 2, {NULL}, 0, 0, S_BUBS4}, // S_BUBS3 - {SPR_BUBS, FF_TRANS30|3, 2, {NULL}, 0, 0, S_BUBS5}, // S_BUBS4 - {SPR_BUBS, FF_TRANS30|4, 2, {NULL}, 0, 0, S_BUBS6}, // S_BUBS5 - {SPR_BUBS, FF_TRANS30|5, 2, {NULL}, 0, 0, S_BUBS7}, // S_BUBS6 - {SPR_BUBS, FF_TRANS30|6, 2, {NULL}, 0, 0, S_BUBS8}, // S_BUBS7 - {SPR_BUBS, FF_TRANS30|7, 2, {NULL}, 0, 0, S_BUBS9}, // S_BUBS8 - {SPR_BUBS, FF_TRANS30|8, 2, {NULL}, 0, 0, S_BUBS1}, // S_BUBS9 + {SPR_BUBS, FF_TRANS30 , 3, {NULL}, 0, 0, S_BUBS2}, // S_BUBS1 + {SPR_BUBS, FF_TRANS30|1, 3, {NULL}, 0, 0, S_BUBS3}, // S_BUBS2 + {SPR_BUBS, FF_TRANS30|2, 3, {NULL}, 0, 0, S_BUBS4}, // S_BUBS3 + {SPR_BUBS, FF_TRANS30|3, 3, {NULL}, 0, 0, S_BUBS5}, // S_BUBS4 + {SPR_BUBS, FF_TRANS30|4, 3, {NULL}, 0, 0, S_BUBS6}, // S_BUBS5 + {SPR_BUBS, FF_TRANS30|5, 3, {NULL}, 0, 0, S_BUBS7}, // S_BUBS6 + {SPR_BUBS, FF_TRANS30|6, 3, {NULL}, 0, 0, S_BUBS8}, // S_BUBS7 + {SPR_BUBS, FF_TRANS30|7, 3, {NULL}, 0, 0, S_BUBS9}, // S_BUBS8 + {SPR_BUBS, FF_TRANS30|8, 3, {NULL}, 0, 0, S_BUBS1}, // S_BUBS9 {SPR_BUBS, FF_TRANS30| 9, 2, {NULL}, 0, 0, S_BUBSB2}, // S_BUBSB1 {SPR_BUBS, FF_TRANS30|10, 2, {NULL}, 0, 0, S_BUBSB3}, // S_BUBSB2 diff --git a/src/p_mobj.c b/src/p_mobj.c index 840d4aa49..8da0a2360 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -3246,7 +3246,11 @@ static void P_PlayerZMovement(mobj_t *mo) S_StartSound(mo, sfx_s3k47); P_ElementalFire(mo->player, true); } - P_SetObjectMomZ(mo, 5*FRACUNIT/2, false); + P_SetObjectMomZ(mo, + (mo->eflags & MFE_UNDERWATER) + ? 6*FRACUNIT/5 + : 5*FRACUNIT/2, + false); P_SetPlayerMobjState(mo, S_PLAY_FALL); clipmomz = false; } @@ -3637,6 +3641,9 @@ void P_MobjCheckWater(mobj_t *mobj) // Then we'll set it! p->powers[pw_underwater] = underwatertics + 1; } + + if ((mobj->eflags & MFE_GOOWATER) && (p->powers[pw_shield] & SH_NOSTACK) == SH_ELEMENTAL && (p->pflags & PF_SHIELDABILITY)) + p->pflags &= ~PF_SHIELDABILITY; } // The rest of this code only executes on a water state change. diff --git a/src/p_user.c b/src/p_user.c index 85f640108..adaacfaba 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -7017,7 +7017,7 @@ static void P_MovePlayer(player_t *player) player->homing = 3*TICRATE; } else - S_StartSound(player->mo, sfx_s3k45); + S_StartSound(player->mo, sfx_s3ka6); break; // Elemental/Bubblewrap shield activation case SH_ELEMENTAL: From c693af96b16bb1bdaf1e78b87d18e867fb7bcd13 Mon Sep 17 00:00:00 2001 From: toasterbabe Date: Mon, 17 Oct 2016 14:03:32 +0100 Subject: [PATCH 057/172] * Bubble bounce completed (minus graphics). * Flame burst fixed with respect to scale. --- src/p_inter.c | 2 +- src/p_map.c | 3 ++- src/p_mobj.c | 10 +++++++++- src/p_user.c | 2 +- 4 files changed, 13 insertions(+), 4 deletions(-) diff --git a/src/p_inter.c b/src/p_inter.c index 3b8707e62..ce5209a41 100644 --- a/src/p_inter.c +++ b/src/p_inter.c @@ -295,7 +295,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck) return; #endif - elementalpierce = (((player->powers[pw_shield] & SH_NOSTACK) == SH_ELEMENTAL) && (player->pflags & PF_SHIELDABILITY)); + elementalpierce = (((player->powers[pw_shield] & SH_NOSTACK) == SH_ELEMENTAL || (player->powers[pw_shield] & SH_NOSTACK) == SH_BUBBLEWRAP) && (player->pflags & PF_SHIELDABILITY)); if (special->flags & MF_BOSS) { diff --git a/src/p_map.c b/src/p_map.c index bb904cc3d..6c4ea979a 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -1052,7 +1052,8 @@ static boolean PIT_CheckThing(mobj_t *thing) else if (thing->z - FixedMul(FRACUNIT, thing->scale) <= tmthing->z + tmthing->height && thing->z + thing->height + FixedMul(FRACUNIT, thing->scale) >= tmthing->z) { - boolean elementalpierce = (((tmthing->player->powers[pw_shield] & SH_NOSTACK) == SH_ELEMENTAL) + boolean elementalpierce = (((tmthing->player->powers[pw_shield] & SH_NOSTACK) == SH_ELEMENTAL + || (tmthing->player->powers[pw_shield] & SH_NOSTACK) == SH_BUBBLEWRAP) && (tmthing->player->pflags & PF_SHIELDABILITY)); if (thing->flags & MF_MONITOR && (tmthing->player->pflags & (PF_SPINNING|PF_GLIDING) diff --git a/src/p_mobj.c b/src/p_mobj.c index 8da0a2360..87f40b2fc 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -3252,6 +3252,14 @@ static void P_PlayerZMovement(mobj_t *mo) : 5*FRACUNIT/2, false); P_SetPlayerMobjState(mo, S_PLAY_FALL); + mo->momx = mo->momy = 0; + clipmomz = false; + } + else if ((mo->player->powers[pw_shield] & SH_NOSTACK) == SH_BUBBLEWRAP) // Bubble shield's bounce attack. + { + S_StartSound(mo, sfx_s3k44); + P_DoJump(mo->player, false); + mo->momz = FixedMul(mo->momz, 5*FRACUNIT/4); clipmomz = false; } } @@ -3642,7 +3650,7 @@ void P_MobjCheckWater(mobj_t *mobj) p->powers[pw_underwater] = underwatertics + 1; } - if ((mobj->eflags & MFE_GOOWATER) && (p->powers[pw_shield] & SH_NOSTACK) == SH_ELEMENTAL && (p->pflags & PF_SHIELDABILITY)) + if ((mobj->eflags & MFE_GOOWATER) && ((p->powers[pw_shield] & SH_NOSTACK) == SH_ELEMENTAL || (p->powers[pw_shield] & SH_NOSTACK) == SH_BUBBLEWRAP) && (p->pflags & PF_SHIELDABILITY)) p->pflags &= ~PF_SHIELDABILITY; } diff --git a/src/p_user.c b/src/p_user.c index adaacfaba..93823542d 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -7033,7 +7033,7 @@ static void P_MovePlayer(player_t *player) // Flame shield activation case SH_FLAMEAURA: player->pflags |= PF_THOKKED|PF_SHIELDABILITY; - P_Thrust(player->mo, player->mo->angle, 30*player->mo->scale - FixedMul(FixedSqrt(player->speed), FixedSqrt(player->mo->scale))); + P_Thrust(player->mo, player->mo->angle, FixedMul(30*FRACUNIT - FixedSqrt(FixedDiv(player->speed, player->mo->scale)), player->mo->scale)); S_StartSound(player->mo, sfx_s3k43); default: break; From 366e282495ecec867b640fab0b8f705563adee66 Mon Sep 17 00:00:00 2001 From: toasterbabe Date: Mon, 17 Oct 2016 14:39:32 +0100 Subject: [PATCH 058/172] Cleaned up the shield-ability stuff to be cleaner (and reduce MT_OVERLAY thinking). --- src/p_mobj.c | 63 +++++++++++++++++++++++++++++----------------------- src/p_user.c | 1 + 2 files changed, 36 insertions(+), 28 deletions(-) diff --git a/src/p_mobj.c b/src/p_mobj.c index 87f40b2fc..ba6e7cd41 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -6776,50 +6776,57 @@ void P_MobjThinker(mobj_t *mobj) } else P_AddOverlay(mobj); - if ((mobj->target->type == MT_ELEMENTAL_ORB) - && (mobj->target->target) - && (mobj->target->target->player) - && ((mobj->target->target->player->powers[pw_shield] & SH_NOSTACK) == SH_ELEMENTAL) - && (mobj->target->target->player->pflags & PF_SHIELDABILITY) - && (mobj->state->nextstate < mobj->target->info->raisestate)) // Special casing for elemental shield piercing attack. - { - P_SetMobjState(mobj, mobj->target->info->raisestate); - mobj->tics++; - } - else if ((mobj->target->type == MT_THUNDERCOIN_ORB) - && (mobj->target->target) - && (mobj->target->target->player) - && ((mobj->target->target->player->powers[pw_shield] & SH_NOSTACK) == SH_THUNDERCOIN) - && (mobj->target->target->player->pflags & PF_SHIELDABILITY)) // Special casing for thundercoin shield jump.. - { - P_SetMobjState(mobj, mobj->target->info->raisestate); - P_SetMobjState(mobj->target, mobj->target->info->painstate); - mobj->target->target->player->pflags &= ~PF_SHIELDABILITY; - mobj->tics++; - } break; - case MT_ARMAGEDDON_ORB: - case MT_WHIRLWIND_ORB: - case MT_ELEMENTAL_ORB: - case MT_FORCE_ORB: case MT_PITY_ORB: + case MT_WHIRLWIND_ORB: + case MT_ARMAGEDDON_ORB: + case MT_FORCE_ORB: case MT_FLAMEAURA_ORB: case MT_BUBBLEWRAP_ORB: - case MT_THUNDERCOIN_ORB: if (!P_AddShield(mobj)) return; break; case MT_ATTRACT_ORB: if (!P_AddShield(mobj)) return; - if ((mobj->target) + if (/*(mobj->target) -- the following is implicit by P_AddShield && (mobj->target->player) - && (mobj->target->player->homing)) + &&*/ (mobj->target->player->homing)) { P_SetMobjState(mobj, mobj->info->painstate); mobj->tics++; } break; + case MT_ELEMENTAL_ORB: + if (!P_AddShield(mobj)) + return; + if (mobj->tracer + /* && mobj->target -- the following is implicit by P_AddShield + && mobj->target->player + && (mobj->target->player->powers[pw_shield] & SH_NOSTACK) == SH_ELEMENTAL*/ + && (mobj->target->player->pflags & PF_SHIELDABILITY) + && (mobj->tracer->state->nextstate < mobj->info->raisestate)) + { + P_SetMobjState(mobj->tracer, mobj->info->raisestate); + mobj->tracer->tics++; + } + break; + case MT_THUNDERCOIN_ORB: + if (!P_AddShield(mobj)) + return; + if (mobj->tracer + /* && mobj->target -- the following is implicit by P_AddShield + && mobj->target->player + && (mobj->target->player->powers[pw_shield] & SH_NOSTACK) == SH_THUNDERCOIN*/ + && (mobj->target->player->pflags & PF_SHIELDABILITY)) + { + P_SetMobjState(mobj, mobj->info->painstate); + mobj->tics++; + P_SetMobjState(mobj->tracer, mobj->info->raisestate); + mobj->tracer->tics++; + mobj->target->player->pflags &= ~PF_SHIELDABILITY; // prevent eternal spark + } + break; case MT_WATERDROP: P_SceneryCheckWater(mobj); if ((mobj->z <= mobj->floorz || mobj->z <= mobj->watertop) diff --git a/src/p_user.c b/src/p_user.c index 93823542d..28ddd364b 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -1398,6 +1398,7 @@ void P_SpawnShieldOrb(player_t *player) ov = P_SpawnMobj(shieldobj->x, shieldobj->y, shieldobj->z, MT_OVERLAY); P_SetTarget(&ov->target, shieldobj); P_SetMobjState(ov, shieldobj->info->seestate); + P_SetTarget(&shieldobj->tracer, ov); } if (shieldobj->info->meleestate) { From e107fe498b3c1384b1a02776b652caad3dcfefce Mon Sep 17 00:00:00 2001 From: toasterbabe Date: Mon, 17 Oct 2016 18:01:43 +0100 Subject: [PATCH 059/172] Adding new sounds for SRB2 shields. --- src/info.c | 10 +++++----- src/sounds.c | 9 +++++++-- src/sounds.h | 5 +++++ 3 files changed, 17 insertions(+), 7 deletions(-) diff --git a/src/info.c b/src/info.c index 9aea3b3df..097b288fa 100644 --- a/src/info.c +++ b/src/info.c @@ -7086,7 +7086,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = S_FORCE_ICON1, // spawnstate 1, // spawnhealth S_NULL, // seestate - sfx_shield, // seesound + sfx_forcsg, // seesound 8, // reactiontime sfx_None, // attacksound S_NULL, // painstate @@ -7113,7 +7113,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = S_ARMAGEDDON_ICON1, // spawnstate 1, // spawnhealth S_NULL, // seestate - sfx_s3k3e, // seesound + sfx_armasg, // seesound 8, // reactiontime sfx_None, // attacksound S_NULL, // painstate @@ -7140,7 +7140,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = S_WHIRLWIND_ICON1, // spawnstate 1, // spawnhealth S_NULL, // seestate - sfx_shield, // seesound + sfx_wirlsg, // seesound 8, // reactiontime sfx_None, // attacksound S_NULL, // painstate @@ -7167,7 +7167,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = S_ELEMENTAL_ICON1, // spawnstate 1, // spawnhealth S_NULL, // seestate - sfx_s3k3f, // seesound + sfx_elemsg, // seesound 8, // reactiontime sfx_None, // attacksound S_NULL, // painstate @@ -10853,7 +10853,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = S_NULL, // deathstate S_NULL, // xdeathstate sfx_None, // deathsound - SH_ARMAGEDDON, // speed + SH_ARMAGEDDON, // speed 64*FRACUNIT, // radius 64*FRACUNIT, // height 2, // display offset diff --git a/src/sounds.c b/src/sounds.c index 75ee1358c..b551b73b5 100644 --- a/src/sounds.c +++ b/src/sounds.c @@ -165,8 +165,12 @@ sfxinfo_t S_sfx[NUMSFX] = {"rail1", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR}, {"rail2", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR}, {"rlaunc", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR}, - {"shield", false, 60, 0, -1, NULL, 0, -1, -1, LUMPERROR}, - {"shldls", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR}, + {"shield", false, 60, 0, -1, NULL, 0, -1, -1, LUMPERROR}, // generic GET! + {"wirlsg", false, 60, 0, -1, NULL, 0, -1, -1, LUMPERROR}, // Whirlwind GET! + {"forcsg", false, 60, 0, -1, NULL, 0, -1, -1, LUMPERROR}, // Force GET! + {"elemsg", false, 60, 0, -1, NULL, 0, -1, -1, LUMPERROR}, // Elemental GET! + {"armasg", false, 60, 0, -1, NULL, 0, -1, -1, LUMPERROR}, // Armaggeddon GET! + {"shldls", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR}, // You LOSE! {"spdpad", false, 127, 0, -1, NULL, 0, -1, -1, LUMPERROR}, {"spkdth", false, 127, 0, -1, NULL, 0, -1, -1, LUMPERROR}, {"spring", false, 112, 0, -1, NULL, 0, -1, -1, LUMPERROR}, @@ -183,6 +187,7 @@ sfxinfo_t S_sfx[NUMSFX] = {"wdjump", false, 60, 0, -1, NULL, 0, -1, -1, LUMPERROR}, {"mswarp", false, 60, 16, -1, NULL, 0, -1, -1, LUMPERROR}, {"mspogo", false, 60, 8, -1, NULL, 0, -1, -1, LUMPERROR}, + {"boingf", false, 60, 0, -1, NULL, 0, -1, -1, LUMPERROR}, // Menu, interface {"chchng", false, 120, 0, -1, NULL, 0, -1, -1, LUMPERROR}, diff --git a/src/sounds.h b/src/sounds.h index 532c61da6..42fa4c308 100644 --- a/src/sounds.h +++ b/src/sounds.h @@ -229,6 +229,10 @@ typedef enum sfx_rail2, sfx_rlaunc, sfx_shield, + sfx_wirlsg, + sfx_forcsg, + sfx_elemsg, + sfx_armasg, sfx_shldls, sfx_spdpad, sfx_spkdth, @@ -246,6 +250,7 @@ typedef enum sfx_wdjump, sfx_mswarp, sfx_mspogo, + sfx_boingf, // Menu, interface sfx_chchng, From beecd72a220c6dd967648e3620077ef6e43b4c9c Mon Sep 17 00:00:00 2001 From: toasterbabe Date: Mon, 17 Oct 2016 20:39:22 +0100 Subject: [PATCH 060/172] BUBBLE BOUNCE ANIMATION --- src/dehacked.c | 6 ++++++ src/info.c | 22 +++++++++++++++------- src/info.h | 6 ++++++ src/p_mobj.c | 40 ++++++++++++++++++++++++++++++++++------ 4 files changed, 61 insertions(+), 13 deletions(-) diff --git a/src/dehacked.c b/src/dehacked.c index cfaa7b526..239e1fe42 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -5457,11 +5457,17 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit "S_BUBS8", "S_BUBS9", + "S_BUBS10", + "S_BUBS11", + "S_BUBSB1", "S_BUBSB2", "S_BUBSB3", "S_BUBSB4", + "S_BUBSB5", + "S_BUBSB6", + "S_ZAPS1", "S_ZAPS2", "S_ZAPS3", diff --git a/src/info.c b/src/info.c index 097b288fa..92d02a0a0 100644 --- a/src/info.c +++ b/src/info.c @@ -2096,6 +2096,7 @@ state_t states[NUMSTATES] = {SPR_MAGN, FF_FULLBRIGHT|FF_TRANS40| 9, 2, {NULL}, 0, 0, S_MAGN11}, // S_MAGN10 {SPR_MAGN, FF_FULLBRIGHT|FF_TRANS40|10, 2, {NULL}, 0, 0, S_MAGN12}, // S_MAGN11 {SPR_MAGN, FF_FULLBRIGHT|FF_TRANS40|11, 2, {NULL}, 0, 0, S_MAGN1 }, // S_MAGN12 + {SPR_MAGN, FF_FULLBRIGHT|FF_TRANS10|12, 2, {NULL}, 0, 0, S_MAGN1 }, // S_MAGN13 {SPR_FORC, FF_TRANS50 , 3, {NULL}, 0, 0, S_FORC2 }, // S_FORC1 @@ -2141,6 +2142,7 @@ state_t states[NUMSTATES] = {SPR_ELEM, FF_FULLBRIGHT|17, 3, {NULL}, 0, 0, S_ELEMF7 }, // S_ELEMF6 {SPR_ELEM, FF_FULLBRIGHT|18, 3, {NULL}, 0, 0, S_ELEMF8 }, // S_ELEMF7 {SPR_ELEM, FF_FULLBRIGHT|19, 3, {NULL}, 0, 0, S_ELEMF1 }, // S_ELEMF8 + {SPR_ELEM, FF_FULLBRIGHT|20, 1, {NULL}, 0, 0, S_ELEMF10}, // S_ELEMF9 {SPR_NULL, 0, 1, {NULL}, 0, 0, S_ELEMF1 }, // S_ELEMF10 @@ -2185,10 +2187,16 @@ state_t states[NUMSTATES] = {SPR_BUBS, FF_TRANS30|7, 3, {NULL}, 0, 0, S_BUBS9}, // S_BUBS8 {SPR_BUBS, FF_TRANS30|8, 3, {NULL}, 0, 0, S_BUBS1}, // S_BUBS9 - {SPR_BUBS, FF_TRANS30| 9, 2, {NULL}, 0, 0, S_BUBSB2}, // S_BUBSB1 - {SPR_BUBS, FF_TRANS30|10, 2, {NULL}, 0, 0, S_BUBSB3}, // S_BUBSB2 - {SPR_BUBS, FF_TRANS30|11, 2, {NULL}, 0, 0, S_BUBSB4}, // S_BUBSB3 - {SPR_BUBS, FF_TRANS30|10, 2, {NULL}, 0, 0, S_BUBSB1}, // S_BUBSB4 + {SPR_NULL, 0, 3, {NULL}, 0, 0, S_BUBS1}, // S_BUBS10 + {SPR_NULL, 0, 4*3, {NULL}, 0, 0, S_BUBS1}, // S_BUBS11 + + {SPR_BUBS, FF_TRANS30| 9, 3, {NULL}, 0, 0, S_BUBSB2}, // S_BUBSB1 + {SPR_BUBS, FF_TRANS30|10, 3, {NULL}, 0, 0, S_BUBSB3}, // S_BUBSB2 + {SPR_BUBS, FF_TRANS30|11, 3, {NULL}, 0, 0, S_BUBSB4}, // S_BUBSB3 + {SPR_BUBS, FF_TRANS30|10, 3, {NULL}, 0, 0, S_BUBSB1}, // S_BUBSB4 + + {SPR_BUBS, FF_TRANS30|12, 3, {NULL}, 0, 0, S_BUBSB3}, // S_BUBSB5 + {SPR_BUBS, FF_TRANS30|13, 3, {NULL}, 0, 0, S_BUBSB5}, // S_BUBSB6 {SPR_ZAPS, FF_FULLBRIGHT|FF_TRANS20 , 2, {NULL}, 0, 0, S_ZAPS2 }, // S_ZAPS1 {SPR_ZAPS, FF_FULLBRIGHT|FF_TRANS20| 1, 2, {NULL}, 0, 0, S_ZAPS3 }, // S_ZAPS2 @@ -10953,7 +10961,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = sfx_None, // seesound 8, // reactiontime sfx_None, // attacksound - S_NULL, // painstate + S_BUBSB5, // painstate SKINCOLOR_NONE, // painchance sfx_None, // painsound S_NULL, // meleestate @@ -10964,12 +10972,12 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = SH_BUBBLEWRAP, // speed 64*FRACUNIT, // radius 64*FRACUNIT, // height - -2, // display offset + 2, // display offset 16, // mass 0, // damage sfx_None, // activesound MF_NOBLOCKMAP|MF_NOCLIP|MF_NOCLIPHEIGHT|MF_NOGRAVITY|MF_SCENERY, // flags - S_NULL // raisestate + S_BUBS10 // raisestate }, { // MT_THUNDERCOIN_ORB diff --git a/src/info.h b/src/info.h index a18a374d9..2ae93f4c1 100644 --- a/src/info.h +++ b/src/info.h @@ -2371,11 +2371,17 @@ typedef enum state S_BUBS8, S_BUBS9, + S_BUBS10, + S_BUBS11, + S_BUBSB1, S_BUBSB2, S_BUBSB3, S_BUBSB4, + S_BUBSB5, + S_BUBSB6, + S_ZAPS1, S_ZAPS2, S_ZAPS3, diff --git a/src/p_mobj.c b/src/p_mobj.c index ba6e7cd41..e929b8426 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -6782,7 +6782,6 @@ void P_MobjThinker(mobj_t *mobj) case MT_ARMAGEDDON_ORB: case MT_FORCE_ORB: case MT_FLAMEAURA_ORB: - case MT_BUBBLEWRAP_ORB: if (!P_AddShield(mobj)) return; break; @@ -6791,7 +6790,7 @@ void P_MobjThinker(mobj_t *mobj) return; if (/*(mobj->target) -- the following is implicit by P_AddShield && (mobj->target->player) - &&*/ (mobj->target->player->homing)) + && */ (mobj->target->player->homing)) { P_SetMobjState(mobj, mobj->info->painstate); mobj->tics++; @@ -6803,21 +6802,50 @@ void P_MobjThinker(mobj_t *mobj) if (mobj->tracer /* && mobj->target -- the following is implicit by P_AddShield && mobj->target->player - && (mobj->target->player->powers[pw_shield] & SH_NOSTACK) == SH_ELEMENTAL*/ - && (mobj->target->player->pflags & PF_SHIELDABILITY) - && (mobj->tracer->state->nextstate < mobj->info->raisestate)) + && (mobj->target->player->powers[pw_shield] & SH_NOSTACK) == SH_ELEMENTAL */ + && mobj->target->player->pflags & PF_SHIELDABILITY + && ((statenum_t)(mobj->tracer->state-states) < mobj->info->raisestate + || (mobj->tracer->state->nextstate < mobj->info->raisestate && mobj->tracer->tics == 1))) { P_SetMobjState(mobj->tracer, mobj->info->raisestate); mobj->tracer->tics++; } break; + case MT_BUBBLEWRAP_ORB: + if (!P_AddShield(mobj)) + return; + if (mobj->tracer + /* && mobj->target -- the following is implicit by P_AddShield + && mobj->target->player + && (mobj->target->player->powers[pw_shield] & SH_NOSTACK) == SH_BUBBLEWRAP */ + ) + { + if (mobj->target->player->pflags & PF_SHIELDABILITY + && ((statenum_t)(mobj->state-states) < mobj->info->painstate + || (mobj->state->nextstate < mobj->info->painstate && mobj->tics == 1))) + { + P_SetMobjState(mobj, mobj->info->painstate); + mobj->tics++; + P_SetMobjState(mobj->tracer, mobj->info->raisestate); + mobj->tracer->tics++; + } + else if (mobj->target->eflags & MFE_JUSTHITFLOOR + && (statenum_t)(mobj->state-states) == mobj->info->painstate) + { + P_SetMobjState(mobj, mobj->info->painstate+1); + mobj->tics++; + P_SetMobjState(mobj->tracer, mobj->info->raisestate+1); + mobj->tracer->tics++; + } + } + break; case MT_THUNDERCOIN_ORB: if (!P_AddShield(mobj)) return; if (mobj->tracer /* && mobj->target -- the following is implicit by P_AddShield && mobj->target->player - && (mobj->target->player->powers[pw_shield] & SH_NOSTACK) == SH_THUNDERCOIN*/ + && (mobj->target->player->powers[pw_shield] & SH_NOSTACK) == SH_THUNDERCOIN */ && (mobj->target->player->pflags & PF_SHIELDABILITY)) { P_SetMobjState(mobj, mobj->info->painstate); From 51ffa6d5eaa50aee99a4953933da4052c4d9d45c Mon Sep 17 00:00:00 2001 From: toasterbabe Date: Mon, 17 Oct 2016 21:23:58 +0100 Subject: [PATCH 061/172] Kill an overlay if the target is removed between P_AddOverlay and P_RunOverlays. --- src/p_mobj.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/p_mobj.c b/src/p_mobj.c index e929b8426..1541ea79c 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -6499,6 +6499,13 @@ void P_RunOverlays(void) if (!mo->target) continue; + + if (P_MobjWasRemoved(mo->target)) + { + P_RemoveMobj(mo); + continue; + } + if (!splitscreen /*&& rendermode != render_soft*/) { angle_t viewingangle; From 0e73924ebbb52f5e19560bcde265c3c39c5db676 Mon Sep 17 00:00:00 2001 From: toasterbabe Date: Mon, 17 Oct 2016 21:24:10 +0100 Subject: [PATCH 062/172] Changed the pity shield sound to one with a higher volume. --- src/info.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/info.c b/src/info.c index 92d02a0a0..b563c71fd 100644 --- a/src/info.c +++ b/src/info.c @@ -7040,7 +7040,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = S_PITY_ICON1, // spawnstate 1, // spawnhealth S_NULL, // seestate - sfx_shield, // seesound + sfx_s3k3a, // seesound 8, // reactiontime sfx_None, // attacksound S_NULL, // painstate From 9b4c81ed0bbd4cd4115c796604b286f27c4e5d49 Mon Sep 17 00:00:00 2001 From: toasterbabe Date: Mon, 17 Oct 2016 23:22:04 +0100 Subject: [PATCH 063/172] Thundercoin shield complete. --- src/dehacked.c | 6 +++++- src/info.c | 30 ++++++++++++++++++++++++++++++ src/info.h | 6 +++++- src/p_user.c | 18 +++++++++++++++++- 4 files changed, 57 insertions(+), 3 deletions(-) diff --git a/src/dehacked.c b/src/dehacked.c index 239e1fe42..8c6147424 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -5497,6 +5497,9 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit "S_ZAPSB10", "S_ZAPSB11", // blank frame + // Thunder spark + "S_THUNDERCOIN_SPARK", + // Invincibility Sparkles "S_IVSP", @@ -6523,7 +6526,8 @@ static const char *const MOBJTYPE_LIST[] = { // array length left dynamic for s "MT_FLAMEAURA_ORB", // Flame shield mobj "MT_BUBBLEWRAP_ORB", // Bubble shield mobj "MT_THUNDERCOIN_ORB", // Thunder shield mobj - "MT_IVSP", // invincibility sparkles + "MT_THUNDERCOIN_SPARK", // Thunder spark + "MT_IVSP", // Invincibility sparkles "MT_SUPERSPARK", // Super Sonic Spark // Freed Animals diff --git a/src/info.c b/src/info.c index b563c71fd..85630766a 100644 --- a/src/info.c +++ b/src/info.c @@ -2227,6 +2227,9 @@ state_t states[NUMSTATES] = {SPR_ZAPS, FF_FULLBRIGHT|FF_TRANS20 , 2, {NULL}, 0, 0, S_ZAPSB11}, // S_ZAPSB10 {SPR_NULL, 0, 15*2, {NULL}, 0, 0, S_ZAPSB2 }, // S_ZAPSB11 + // Thunder spark + {SPR_SSPK, FF_ANIMATE, 18, {NULL}, 1, 2, S_NULL}, // S_THUNDERCOIN_SPARK + // Invincibility Sparkles {SPR_IVSP, FF_ANIMATE, 32, {NULL}, 31, 1, S_NULL}, // S_IVSP @@ -11007,6 +11010,33 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = S_ZAPS14 // raisestate }, + { // MT_THUNDERCOIN_SPARK + -1, // doomednum + S_THUNDERCOIN_SPARK, // spawnstate + 1, // 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 + 4*FRACUNIT, // radius + 4*FRACUNIT, // height + 0, // display offset + 100, // mass + 0, // damage + sfx_None, // activesound + MF_NOBLOCKMAP|MF_NOCLIP|MF_NOCLIPHEIGHT|MF_NOGRAVITY|MF_SCENERY, // flags + S_NULL // raisestate + }, + { // MT_IVSP -1, // doomednum S_IVSP, // spawnstate diff --git a/src/info.h b/src/info.h index 2ae93f4c1..618e848c5 100644 --- a/src/info.h +++ b/src/info.h @@ -2411,6 +2411,9 @@ typedef enum state S_ZAPSB10, S_ZAPSB11, // blank frame + //Thunder spark + S_THUNDERCOIN_SPARK, + // Invincibility Sparkles S_IVSP, @@ -3456,7 +3459,8 @@ typedef enum mobj_type MT_FLAMEAURA_ORB, // Flame shield mobj MT_BUBBLEWRAP_ORB, // Bubble shield mobj MT_THUNDERCOIN_ORB, // Thunder shield mobj - MT_IVSP, // invincibility sparkles + MT_THUNDERCOIN_SPARK, // Thunder spark + MT_IVSP, // Invincibility sparkles MT_SUPERSPARK, // Super Sonic Spark // Freed Animals diff --git a/src/p_user.c b/src/p_user.c index 28ddd364b..2deda6d60 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -3941,6 +3941,20 @@ void P_DoJumpShield(player_t *player) player->pflags &= ~PF_SPINNING; if (electric) { + mobj_t *spark; + INT32 i; +#define numangles 6 +#define limitangle (360/numangles) + angle_t travelangle = player->mo->angle + P_RandomRange(-limitangle, limitangle)*ANG1; + for (i = 0; i < numangles; i++) + { + spark = P_SpawnMobjFromMobj(player->mo, 0, 0, 0, MT_THUNDERCOIN_SPARK); + P_InstaThrust(spark, travelangle + i*(ANGLE_MAX/numangles), FixedMul(4*FRACUNIT, spark->scale)); + if (i % 2) + P_SetObjectMomZ(spark, -4*FRACUNIT, false); + } +#undef limitangle +#undef numangles S_StartSound(player->mo, sfx_s3k45); } else @@ -6304,8 +6318,9 @@ void P_ElementalFire(player_t *player, boolean cropcircle) if (cropcircle) { - travelangle = player->mo->angle + P_RandomRange(-ANGLE_45, ANGLE_45); #define numangles 8 +#define limitangle (180/numangles) + travelangle = player->mo->angle + P_RandomRange(-limitangle, limitangle)*ANG1; for (i = 0; i < numangles; i++) { flame = P_SpawnMobj(player->mo->x, player->mo->y, ground, MT_SPINFIRE); @@ -6319,6 +6334,7 @@ void P_ElementalFire(player_t *player, boolean cropcircle) P_InstaThrust(flame, flame->angle, FixedMul(3*FRACUNIT, flame->scale)); P_SetObjectMomZ(flame, 3*FRACUNIT, false); } +#undef limitangle #undef numangles } else From 8fe932b0e7656ce3541713d77aa9ea6373961b65 Mon Sep 17 00:00:00 2001 From: toasterbabe Date: Thu, 20 Oct 2016 00:33:12 +0100 Subject: [PATCH 064/172] * Force shield force stop completed * Bubblewrap shield bounce now no longer allows thokking post-bounce, but still allows bouncing * plus a bunch of tiny changes to clean up code around the place. --- src/d_player.h | 6 ++--- src/p_enemy.c | 2 +- src/p_inter.c | 2 +- src/p_mobj.c | 63 +++++++++++++++++++++++++++++++++++++------------- src/p_user.c | 17 +++++++++++--- 5 files changed, 66 insertions(+), 24 deletions(-) diff --git a/src/d_player.h b/src/d_player.h index 54960115f..e5e296f17 100644 --- a/src/d_player.h +++ b/src/d_player.h @@ -188,7 +188,7 @@ typedef enum SH_PROTECTELECTRIC = 0x1000, // Indivisible shields - SH_PITY = 1, + SH_PITY = 1, // the world's most basic shield ever, given to players who suck at Match SH_WHIRLWIND, SH_ARMAGEDDON, SH_FIREFLOWER, @@ -377,8 +377,8 @@ typedef struct player_s UINT8 gotcontinue; // Got continue from this stage? fixed_t speed; // Player's speed (distance formula of MOMX and MOMY values) - UINT8 jumping; // Jump counter - UINT8 secondjump; + UINT8 jumping; // Holding down jump button + UINT8 secondjump; // Jump counter UINT8 fly1; // Tails flying UINT8 scoreadd; // Used for multiple enemy attack bonus diff --git a/src/p_enemy.c b/src/p_enemy.c index cde3f6310..e94a936a2 100644 --- a/src/p_enemy.c +++ b/src/p_enemy.c @@ -3348,7 +3348,7 @@ void A_ForceShield(mobj_t *actor) return; } - if (locvar1 < 0 || locvar1 > SH_FORCEHP) + if (locvar1 & ~SH_FORCEHP) { CONS_Debug(DBG_GAMELOGIC, "Invalid number of additional hitpoints.\n"); return; diff --git a/src/p_inter.c b/src/p_inter.c index ce5209a41..e3523d29d 100644 --- a/src/p_inter.c +++ b/src/p_inter.c @@ -2784,7 +2784,7 @@ void P_RemoveShield(player_t *player) if (player->powers[pw_shield] & SH_FORCE) { // Multi-hit if ((player->powers[pw_shield] & SH_FORCEHP) == 0) - player->powers[pw_shield] &= ~SH_FORCE; + player->powers[pw_shield] &= SH_STACK; else player->powers[pw_shield]--; } diff --git a/src/p_mobj.c b/src/p_mobj.c index 1541ea79c..5af16f0ff 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -3235,8 +3235,16 @@ static void P_PlayerZMovement(mobj_t *mo) if (!(mo->player->pflags & PF_GLIDING)) mo->player->pflags &= ~PF_JUMPED; + mo->player->pflags &= ~(PF_THOKKED|PF_CANCARRY/*|PF_GLIDING*/); + mo->player->secondjump = 0; + mo->player->glidetime = 0; + mo->player->climbing = 0; + mo->player->powers[pw_tailsfly] = 0; + if (mo->player->pflags & PF_SHIELDABILITY) { + mo->player->pflags &= ~PF_SHIELDABILITY; + if ((mo->player->powers[pw_shield] & SH_NOSTACK) == SH_ELEMENTAL) // Elemental shield's stomp attack. { if (mo->eflags & (MFE_UNDERWATER|MFE_TOUCHWATER)) // play a blunt sound @@ -3259,16 +3267,14 @@ static void P_PlayerZMovement(mobj_t *mo) { S_StartSound(mo, sfx_s3k44); P_DoJump(mo->player, false); + mo->player->pflags |= PF_THOKKED; + mo->player->secondjump = UINT8_MAX; mo->momz = FixedMul(mo->momz, 5*FRACUNIT/4); clipmomz = false; } } - mo->player->pflags &= ~(PF_THOKKED|PF_CANCARRY|PF_SHIELDABILITY/*|PF_GLIDING*/); - mo->player->jumping = 0; - mo->player->secondjump = 0; - mo->player->glidetime = 0; - mo->player->climbing = 0; - mo->player->powers[pw_tailsfly] = 0; + + mo->player->jumping = 0; // done down here because of bubblewrap } } if (!(mo->player->pflags & PF_SPINNING)) @@ -3623,15 +3629,19 @@ void P_MobjCheckWater(mobj_t *mobj) { if (!((p->powers[pw_super]) || (p->powers[pw_invulnerability]))) { - if (p->powers[pw_shield] & SH_PROTECTELECTRIC) - { // Water removes electric shields... + boolean electric = !!(p->powers[pw_shield] & SH_PROTECTELECTRIC); +#define SH_OP (SH_PROTECTFIRE|SH_PROTECTWATER|SH_PROTECTELECTRIC) + if ((p->powers[pw_shield] & SH_OP) == SH_OP) // No. + P_KillMobj(mobj, NULL, NULL, DMG_INSTAKILL); +#undef SH_OP + else if (electric || ((p->powers[pw_shield] & SH_PROTECTFIRE) && !(p->powers[pw_shield] & SH_PROTECTWATER))) + { // Water removes electric and non-water fire shields... + P_FlashPal(p, + electric + ? PAL_WHITE + : PAL_NUKE, + 1); p->powers[pw_shield] = p->powers[pw_shield] & SH_STACK; - P_FlashPal(p, PAL_WHITE, 1); - } - else if ((p->powers[pw_shield] & SH_PROTECTFIRE) && !(p->powers[pw_shield] & SH_PROTECTWATER)) - { // ...and fire-only shields. - p->powers[pw_shield] = p->powers[pw_shield] & SH_STACK; - P_FlashPal(p, PAL_NUKE, 1); } } @@ -3651,7 +3661,10 @@ void P_MobjCheckWater(mobj_t *mobj) } if ((mobj->eflags & MFE_GOOWATER) && ((p->powers[pw_shield] & SH_NOSTACK) == SH_ELEMENTAL || (p->powers[pw_shield] & SH_NOSTACK) == SH_BUBBLEWRAP) && (p->pflags & PF_SHIELDABILITY)) + { p->pflags &= ~PF_SHIELDABILITY; + mobj->momz >>= 1; + } } // The rest of this code only executes on a water state change. @@ -6683,7 +6696,7 @@ void P_MobjThinker(mobj_t *mobj) fixed_t oldheight = mobj->height; UINT8 correctionType = 0; // Don't correct Z position, just gain height - if (mobj->z > mobj->floorz && mobj->z + mobj->height < mobj->ceilingz + if ((mobj->flags & MF_NOCLIPHEIGHT || (mobj->z > mobj->floorz && mobj->z + mobj->height < mobj->ceilingz)) && mobj->type != MT_EGGMOBILE_FIRE) correctionType = 1; // Correct Z position by centering else if (mobj->eflags & MFE_VERTICALFLIP) @@ -6787,7 +6800,6 @@ void P_MobjThinker(mobj_t *mobj) case MT_PITY_ORB: case MT_WHIRLWIND_ORB: case MT_ARMAGEDDON_ORB: - case MT_FORCE_ORB: case MT_FLAMEAURA_ORB: if (!P_AddShield(mobj)) return; @@ -6818,6 +6830,25 @@ void P_MobjThinker(mobj_t *mobj) mobj->tracer->tics++; } break; + case MT_FORCE_ORB: + if (!P_AddShield(mobj)) + return; + if (/* + && mobj->target -- the following is implicit by P_AddShield + && mobj->target->player + && (mobj->target->player->powers[pw_shield] & SH_FORCE) + && */ (mobj->target->player->pflags & PF_SHIELDABILITY)) + { + mobj_t *whoosh = P_SpawnMobjFromMobj(mobj, 0, 0, 0, MT_GHOST); + whoosh->sprite = SPR_FORC; + whoosh->frame = 20|(tr_trans50<destscale = whoosh->scale<<1; + whoosh->fuse = 10; + whoosh->tics = -1; + whoosh->flags |= MF_NOCLIPHEIGHT; + whoosh->height = 42*FRACUNIT; + mobj->target->player->pflags &= ~PF_SHIELDABILITY; // prevent eternal whoosh + } case MT_BUBBLEWRAP_ORB: if (!P_AddShield(mobj)) return; diff --git a/src/p_user.c b/src/p_user.c index 2deda6d60..18f804a9e 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -7002,12 +7002,22 @@ static void P_MovePlayer(player_t *player) { if (player->pflags & PF_JUMPED) // If the player is jumping { - pflags_t check = (PF_USEDOWN|PF_GLIDING|PF_SLIDING|PF_THOKKED); - if (!(player->pflags & check)) // If the player is not holding down BT_USE, or having used an ability previously + if (!(player->pflags & (PF_USEDOWN|PF_GLIDING|PF_SLIDING|PF_SHIELDABILITY)) // If the player is not holding down BT_USE, or having used an ability previously + && (!(player->pflags & PF_THOKKED) || ((player->powers[pw_shield] & SH_NOSTACK) == SH_BUBBLEWRAP && player->secondjump == UINT8_MAX))) // thokked is optional if you're bubblewrapped { // Force shield activation if (player->powers[pw_shield] & SH_FORCE) - ; // TODO + { +//#define PERFECTFORCESTOP + player->pflags |= PF_THOKKED|PF_SHIELDABILITY; + player->mo->momx = player->mo->momy = 0; +#if 1 // almost imperceptible hop for the purposes of aligning with the aura for as long as possible + P_SetObjectMomZ(player->mo, -4*P_GetMobjGravity(player->mo), false); +#else + player->mo->momz = 0; +#endif + S_StartSound(player->mo, sfx_ngskid); + } else { switch (player->powers[pw_shield] & SH_NOSTACK) @@ -7040,6 +7050,7 @@ static void P_MovePlayer(player_t *player) case SH_ELEMENTAL: case SH_BUBBLEWRAP: player->pflags |= PF_THOKKED|PF_SHIELDABILITY; + player->secondjump = 0; player->mo->momx = player->mo->momy = 0; P_SetObjectMomZ(player->mo, -24*FRACUNIT, false); S_StartSound(player->mo, From c1a8dd9a371816374c03a0029502313785b3bbc4 Mon Sep 17 00:00:00 2001 From: toasterbabe Date: Thu, 20 Oct 2016 13:44:03 +0100 Subject: [PATCH 065/172] Minor refactor of what I did last night - as a modifiable state instead of hardcoded references. --- src/dehacked.c | 2 ++ src/info.c | 4 +++- src/info.h | 2 ++ src/p_mobj.c | 6 ++---- src/p_user.c | 5 ++--- 5 files changed, 11 insertions(+), 8 deletions(-) diff --git a/src/dehacked.c b/src/dehacked.c index 8c6147424..e8f29e03e 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -5392,6 +5392,8 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit "S_FORC19", "S_FORC20", + "S_FORC21", + "S_ELEM1", "S_ELEM2", "S_ELEM3", diff --git a/src/info.c b/src/info.c index 85630766a..42706cc8d 100644 --- a/src/info.c +++ b/src/info.c @@ -2121,6 +2121,8 @@ state_t states[NUMSTATES] = {SPR_FORC, FF_TRANS50|18, 3, {NULL}, 0, 0, S_FORC20}, // S_FORC19 {SPR_FORC, FF_TRANS50|19, 3, {NULL}, 0, 0, S_FORC11}, // S_FORC20 + {SPR_FORC, FF_TRANS50|20, -1, {NULL}, 0, 0, S_NULL}, // S_FORC21 + {SPR_ELEM, FF_TRANS50 , 4, {NULL}, 0, 0, S_ELEM2 }, // S_ELEM1 {SPR_ELEM, FF_TRANS50| 1, 4, {NULL}, 0, 0, S_ELEM3 }, // S_ELEM2 {SPR_ELEM, FF_TRANS50| 2, 4, {NULL}, 0, 0, S_ELEM4 }, // S_ELEM3 @@ -10845,7 +10847,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = 0, // damage sfx_None, // activesound MF_NOBLOCKMAP|MF_NOCLIP|MF_NOCLIPHEIGHT|MF_NOGRAVITY|MF_SCENERY, // flags - S_NULL // raisestate + S_FORC21 // raisestate }, { // MT_ARMAGEDDON_ORB diff --git a/src/info.h b/src/info.h index 618e848c5..8624f13a0 100644 --- a/src/info.h +++ b/src/info.h @@ -2306,6 +2306,8 @@ typedef enum state S_FORC19, S_FORC20, + S_FORC21, + S_ELEM1, S_ELEM2, S_ELEM3, diff --git a/src/p_mobj.c b/src/p_mobj.c index 5af16f0ff..77952c269 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -6839,12 +6839,10 @@ void P_MobjThinker(mobj_t *mobj) && (mobj->target->player->powers[pw_shield] & SH_FORCE) && */ (mobj->target->player->pflags & PF_SHIELDABILITY)) { - mobj_t *whoosh = P_SpawnMobjFromMobj(mobj, 0, 0, 0, MT_GHOST); - whoosh->sprite = SPR_FORC; - whoosh->frame = 20|(tr_trans50<info->raisestate); whoosh->destscale = whoosh->scale<<1; whoosh->fuse = 10; - whoosh->tics = -1; whoosh->flags |= MF_NOCLIPHEIGHT; whoosh->height = 42*FRACUNIT; mobj->target->player->pflags &= ~PF_SHIELDABILITY; // prevent eternal whoosh diff --git a/src/p_user.c b/src/p_user.c index 18f804a9e..8b871f72b 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -7008,14 +7008,13 @@ static void P_MovePlayer(player_t *player) // Force shield activation if (player->powers[pw_shield] & SH_FORCE) { -//#define PERFECTFORCESTOP player->pflags |= PF_THOKKED|PF_SHIELDABILITY; - player->mo->momx = player->mo->momy = 0; #if 1 // almost imperceptible hop for the purposes of aligning with the aura for as long as possible P_SetObjectMomZ(player->mo, -4*P_GetMobjGravity(player->mo), false); #else - player->mo->momz = 0; + player->mo->momz = // intentionally carries to post-endif line as multiple-assignment #endif + player->mo->momx = player->mo->momy = 0; S_StartSound(player->mo, sfx_ngskid); } else From 59fccab8e50aa4cc2227952e6af35357dd625d3d Mon Sep 17 00:00:00 2001 From: toasterbabe Date: Thu, 20 Oct 2016 20:55:15 +0100 Subject: [PATCH 066/172] Restructured things so nojumpdamage characters can use the elemental, bubblewrap and attract shields. --- src/d_player.h | 5 ++++- src/lua_hook.h | 2 ++ src/lua_hooklib.c | 1 + src/p_inter.c | 6 +++--- src/p_map.c | 8 ++++---- src/p_mobj.c | 4 +++- src/p_user.c | 14 ++++++++++++-- 7 files changed, 29 insertions(+), 11 deletions(-) diff --git a/src/d_player.h b/src/d_player.h index e5e296f17..4f9833fa0 100644 --- a/src/d_player.h +++ b/src/d_player.h @@ -154,7 +154,10 @@ typedef enum PF_CANCARRY = 1<<27, // Used shield ability - PF_SHIELDABILITY = 1<<28 + PF_SHIELDABILITY = 1<<28, + + // Do jump damage? + PF_JUMPDAMAGE = 1<<29 // free up to and including 1<<31 } pflags_t; diff --git a/src/lua_hook.h b/src/lua_hook.h index bed32edac..e0f08d175 100644 --- a/src/lua_hook.h +++ b/src/lua_hook.h @@ -43,6 +43,7 @@ enum hook { hook_PlayerMsg, hook_HurtMsg, hook_PlayerSpawn, + hook_ShieldSpawn, hook_MAX // last hook }; @@ -77,5 +78,6 @@ boolean LUAh_LinedefExecute(line_t *line, mobj_t *mo, sector_t *sector); // Hook boolean LUAh_PlayerMsg(int source, int target, int flags, char *msg); // Hook for chat messages boolean LUAh_HurtMsg(player_t *player, mobj_t *inflictor, mobj_t *source); // Hook for hurt messages #define LUAh_PlayerSpawn(player) LUAh_PlayerHook(player, hook_PlayerSpawn) // Hook for G_SpawnPlayer +#define LUAh_ShieldSpawn(player) LUAh_PlayerHook(player, hook_ShieldSpawn) // Hook for P_SpawnShieldOrb #endif diff --git a/src/lua_hooklib.c b/src/lua_hooklib.c index 1b9652571..1065f193a 100644 --- a/src/lua_hooklib.c +++ b/src/lua_hooklib.c @@ -54,6 +54,7 @@ const char *const hookNames[hook_MAX+1] = { "PlayerMsg", "HurtMsg", "PlayerSpawn", + "ShieldSpawn", NULL }; diff --git a/src/p_inter.c b/src/p_inter.c index e3523d29d..ddbac5ed3 100644 --- a/src/p_inter.c +++ b/src/p_inter.c @@ -306,7 +306,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck) } if (((player->pflags & PF_NIGHTSMODE) && (player->pflags & PF_DRILLING)) - || ((player->pflags & PF_JUMPED) && !(player->charflags & SF_NOJUMPDAMAGE && !(player->charability == CA_TWINSPIN && player->panim == PA_ABILITY))) + || ((player->pflags & PF_JUMPED) && (player->pflags & PF_JUMPDAMAGE || (player->charability == CA_TWINSPIN && player->panim == PA_ABILITY))) || (player->pflags & (PF_SPINNING|PF_GLIDING)) || (player->charability2 == CA2_MELEE && player->panim == PA_ABILITY2) || ((player->charflags & SF_STOMPDAMAGE) && (P_MobjFlip(toucher)*(toucher->z - (special->z + special->height/2)) > 0) && (P_MobjFlip(toucher)*toucher->momz < 0)) @@ -353,7 +353,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck) P_DamageMobj(toucher, special, special, 1, 0); } else if (((player->pflags & PF_NIGHTSMODE) && (player->pflags & PF_DRILLING)) - || ((player->pflags & PF_JUMPED) && !(player->charflags & SF_NOJUMPDAMAGE && !(player->charability == CA_TWINSPIN && player->panim == PA_ABILITY))) + || ((player->pflags & PF_JUMPED) && (player->pflags & PF_JUMPDAMAGE || (player->charability == CA_TWINSPIN && player->panim == PA_ABILITY))) || (player->pflags & (PF_SPINNING|PF_GLIDING)) || (player->charability2 == CA2_MELEE && player->panim == PA_ABILITY2) || ((player->charflags & SF_STOMPDAMAGE) && (P_MobjFlip(toucher)*(toucher->z - (special->z + special->height/2)) > 0) && (P_MobjFlip(toucher)*toucher->momz < 0)) @@ -1346,7 +1346,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck) return; } else if (((player->pflags & PF_NIGHTSMODE) && (player->pflags & PF_DRILLING)) - || ((player->pflags & PF_JUMPED) && !(player->charflags & SF_NOJUMPDAMAGE)) + || ((player->pflags & PF_JUMPED) && (player->pflags & PF_JUMPDAMAGE || (player->charability == CA_TWINSPIN && player->panim == PA_ABILITY))) || ((player->charflags & SF_STOMPDAMAGE) && (P_MobjFlip(toucher)*(toucher->z - (special->z + special->height/2)) > 0) && (P_MobjFlip(toucher)*toucher->momz < 0)) || (player->pflags & (PF_SPINNING|PF_GLIDING)) || player->powers[pw_invulnerability] || player->powers[pw_super]) // Do you possess the ability to subdue the object? diff --git a/src/p_map.c b/src/p_map.c index 6c4ea979a..d924ad564 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -1058,8 +1058,8 @@ static boolean PIT_CheckThing(mobj_t *thing) if (thing->flags & MF_MONITOR && (tmthing->player->pflags & (PF_SPINNING|PF_GLIDING) || ((tmthing->player->pflags & PF_JUMPED) - && !(tmthing->player->charflags & SF_NOJUMPDAMAGE - && !(tmthing->player->charability == CA_TWINSPIN && tmthing->player->panim == PA_ABILITY))) + && (tmthing->player->pflags & PF_JUMPDAMAGE + || (tmthing->player->charability == CA_TWINSPIN && tmthing->player->panim == PA_ABILITY))) || (tmthing->player->charability2 == CA2_MELEE && tmthing->player->panim == PA_ABILITY2) || ((tmthing->player->charflags & SF_STOMPDAMAGE) && (P_MobjFlip(tmthing)*(tmthing->z - (thing->z + thing->height/2)) > 0) && (P_MobjFlip(tmthing)*tmthing->momz < 0)) @@ -1093,8 +1093,8 @@ static boolean PIT_CheckThing(mobj_t *thing) else if (thing->flags & MF_MONITOR && tmthing->player && (tmthing->player->pflags & (PF_SPINNING|PF_GLIDING) || ((tmthing->player->pflags & PF_JUMPED) - && !(tmthing->player->charflags & SF_NOJUMPDAMAGE - && !(tmthing->player->charability == CA_TWINSPIN && tmthing->player->panim == PA_ABILITY))) + && (tmthing->player->pflags & PF_JUMPDAMAGE + || (tmthing->player->charability == CA_TWINSPIN && tmthing->player->panim == PA_ABILITY))) || (tmthing->player->charability2 == CA2_MELEE && tmthing->player->panim == PA_ABILITY2) || ((tmthing->player->charflags & SF_STOMPDAMAGE) && (P_MobjFlip(tmthing)*(tmthing->z - (thing->z + thing->height/2)) > 0) && (P_MobjFlip(tmthing)*tmthing->momz < 0))) diff --git a/src/p_mobj.c b/src/p_mobj.c index 77952c269..40683a991 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -3233,7 +3233,7 @@ static void P_PlayerZMovement(mobj_t *mo) mo->player->pflags &= ~PF_SPINNING; if (!(mo->player->pflags & PF_GLIDING)) - mo->player->pflags &= ~PF_JUMPED; + mo->player->pflags &= ~(PF_JUMPED|PF_JUMPDAMAGE); mo->player->pflags &= ~(PF_THOKKED|PF_CANCARRY/*|PF_GLIDING*/); mo->player->secondjump = 0; @@ -3267,6 +3267,8 @@ static void P_PlayerZMovement(mobj_t *mo) { S_StartSound(mo, sfx_s3k44); P_DoJump(mo->player, false); + if (mo->player->charflags & SF_NOJUMPSPIN) + P_SetPlayerMobjState(mo, S_PLAY_FALL); mo->player->pflags |= PF_THOKKED; mo->player->secondjump = UINT8_MAX; mo->momz = FixedMul(mo->momz, 5*FRACUNIT/4); diff --git a/src/p_user.c b/src/p_user.c index 8b871f72b..1ddb7a25c 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -877,7 +877,7 @@ void P_DoPlayerPain(player_t *player, mobj_t *source, mobj_t *inflictor) // Useful when you want to kill everything the player is doing. void P_ResetPlayer(player_t *player) { - player->pflags &= ~(PF_SPINNING|PF_STARTDASH|PF_JUMPED|PF_GLIDING|PF_THOKKED|PF_CANCARRY|PF_SHIELDABILITY); + player->pflags &= ~(PF_SPINNING|PF_STARTDASH|PF_JUMPED|PF_JUMPDAMAGE|PF_GLIDING|PF_THOKKED|PF_CANCARRY|PF_SHIELDABILITY); player->powers[pw_carry] = CR_NONE; player->jumping = 0; player->secondjump = 0; @@ -1338,6 +1338,11 @@ void P_SpawnShieldOrb(player_t *player) I_Error("P_SpawnShieldOrb: player->mo is NULL!\n"); #endif +#ifdef HAVE_BLUA + if (LUAh_ShieldSpawn(player)) + return; +#endif + if (player->powers[pw_shield] & SH_FORCE) orbtype = MT_FORCE_ORB; else switch (player->powers[pw_shield] & SH_NOSTACK) @@ -3761,6 +3766,8 @@ void P_DoJump(player_t *player, boolean soundandstate) player->mo->eflags &= ~MFE_APPLYPMOMZ; player->pflags |= PF_JUMPED; + if (!(player->charflags & SF_NOJUMPDAMAGE)) + player->pflags |= PF_JUMPDAMAGE; if (soundandstate) { @@ -7039,6 +7046,8 @@ static void P_MovePlayer(player_t *player) player->homing = 2; if (P_LookForEnemies(player, false) && player->mo->tracer) { + player->pflags |= PF_JUMPDAMAGE; + P_SetPlayerMobjState(player->mo, S_PLAY_SPIN); S_StartSound(player->mo, sfx_s3k40); player->homing = 3*TICRATE; } @@ -7048,7 +7057,8 @@ static void P_MovePlayer(player_t *player) // Elemental/Bubblewrap shield activation case SH_ELEMENTAL: case SH_BUBBLEWRAP: - player->pflags |= PF_THOKKED|PF_SHIELDABILITY; + player->pflags |= PF_JUMPDAMAGE|PF_THOKKED|PF_SHIELDABILITY; + P_SetPlayerMobjState(player->mo, S_PLAY_SPIN); player->secondjump = 0; player->mo->momx = player->mo->momy = 0; P_SetObjectMomZ(player->mo, -24*FRACUNIT, false); From 769962c884e025f1ad1aaf7ed325f2cfc8eb0cdf Mon Sep 17 00:00:00 2001 From: toasterbabe Date: Thu, 20 Oct 2016 21:15:41 +0100 Subject: [PATCH 067/172] Minor cleanup. --- src/p_user.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/src/p_user.c b/src/p_user.c index 1ddb7a25c..c4b810414 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -1446,10 +1446,6 @@ boolean P_SwitchShield(player_t *player, UINT16 shieldtype) ? (!(player->powers[pw_shield] & SH_FORCE) || (player->powers[pw_shield] & SH_FORCEHP) < (shieldtype & ~SH_FORCE)) : ((player->powers[pw_shield] & SH_NOSTACK) != shieldtype); - boolean stopshieldability = (shieldtype & SH_FORCE) - ? (!(player->powers[pw_shield] & SH_FORCE)) - : true; - if (mariomode) { mobj_t *scoremobj = P_SpawnMobj(player->mo->x, player->mo->y, player->mo->z + (player->mo->height / 2), MT_SCORE); @@ -1459,6 +1455,10 @@ boolean P_SwitchShield(player_t *player, UINT16 shieldtype) if (donthavealready) { + boolean stopshieldability = (shieldtype & SH_FORCE) + ? (!(player->powers[pw_shield] & SH_FORCE)) + : true; + if (mariomode) { player->mo->movecount = player->powers[pw_shield]; @@ -7013,7 +7013,7 @@ static void P_MovePlayer(player_t *player) && (!(player->pflags & PF_THOKKED) || ((player->powers[pw_shield] & SH_NOSTACK) == SH_BUBBLEWRAP && player->secondjump == UINT8_MAX))) // thokked is optional if you're bubblewrapped { // Force shield activation - if (player->powers[pw_shield] & SH_FORCE) + if ((player->powers[pw_shield] & SH_NOSTACK) == SH_FORCE) { player->pflags |= PF_THOKKED|PF_SHIELDABILITY; #if 1 // almost imperceptible hop for the purposes of aligning with the aura for as long as possible @@ -8177,9 +8177,6 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall camheight = FixedMul(cv_cam2_height.value, FixedMul(player->camerascale, mo->scale)); } - if (player->powers[pw_shield] & SH_FORCE && player->pflags & PF_SHIELDABILITY) - camspeed <<= 1; - #ifdef REDSANALOG if (P_AnalogMove(player) && (player->cmd.buttons & (BT_CAMLEFT|BT_CAMRIGHT)) == (BT_CAMLEFT|BT_CAMRIGHT)) { camstill = true; From f145898ca4c60cf9ad7c18c16979b4e6c8bb9648 Mon Sep 17 00:00:00 2001 From: toasterbabe Date: Thu, 20 Oct 2016 21:39:58 +0100 Subject: [PATCH 068/172] Woops. --- src/p_user.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/p_user.c b/src/p_user.c index c4b810414..c2115ff7d 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -7013,7 +7013,7 @@ static void P_MovePlayer(player_t *player) && (!(player->pflags & PF_THOKKED) || ((player->powers[pw_shield] & SH_NOSTACK) == SH_BUBBLEWRAP && player->secondjump == UINT8_MAX))) // thokked is optional if you're bubblewrapped { // Force shield activation - if ((player->powers[pw_shield] & SH_NOSTACK) == SH_FORCE) + if ((player->powers[pw_shield] & ~(SH_FORCEHP|SH_STACK)) == SH_FORCE) { player->pflags |= PF_THOKKED|PF_SHIELDABILITY; #if 1 // almost imperceptible hop for the purposes of aligning with the aura for as long as possible From a053b117e18bb806753632551c4c82b13728cc48 Mon Sep 17 00:00:00 2001 From: toasterbabe Date: Fri, 21 Oct 2016 11:08:32 +0100 Subject: [PATCH 069/172] Moved the Super Sonic hover over to holding down the jump button (which conveniently links it pretty closely to the thok, which could be called the Float Thok or something I dunno.) Also, only one shield ability is selectively blocked by being Super now, and that's because Invincibility does it too and therefore I assume that's a match balance thing instead of a keyboard clash. --- src/p_user.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/p_user.c b/src/p_user.c index c2115ff7d..794f2b5a8 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -4361,10 +4361,10 @@ static void P_DoJumpStuff(player_t *player, ticcmd_t *cmd) player->secondjump = 2; - // If letting go of the jump button while still on ascent, cut the jump height. - if (player->pflags & PF_JUMPED && P_MobjFlip(player->mo)*player->mo->momz > 0 && player->jumping == 1) + if (player->pflags & PF_JUMPED && player->jumping == 1) { - player->mo->momz >>= 1; + if (P_MobjFlip(player->mo)*player->mo->momz > 0) + player->mo->momz >>= 1; // If letting go of the jump button while still on ascent, cut the jump height. player->jumping = 0; } } @@ -7005,9 +7005,9 @@ static void P_MovePlayer(player_t *player) //STUFF! // /////////////////////////// - if (cmd->buttons & BT_USE) // Spin button effects + if (player->pflags & PF_JUMPED) { - if (player->pflags & PF_JUMPED) // If the player is jumping + if (cmd->buttons & BT_USE) // Spin button effects { if (!(player->pflags & (PF_USEDOWN|PF_GLIDING|PF_SLIDING|PF_SHIELDABILITY)) // If the player is not holding down BT_USE, or having used an ability previously && (!(player->pflags & PF_THOKKED) || ((player->powers[pw_shield] & SH_NOSTACK) == SH_BUBBLEWRAP && player->secondjump == UINT8_MAX))) // thokked is optional if you're bubblewrapped @@ -7031,8 +7031,7 @@ static void P_MovePlayer(player_t *player) // Whirlwind/Thundercoin shield activation case SH_WHIRLWIND: case SH_THUNDERCOIN: - if (!player->powers[pw_super]) - P_DoJumpShield(player); + P_DoJumpShield(player); break; // Armageddon shield activation case SH_ARMAGEDDON: @@ -7077,7 +7076,9 @@ static void P_MovePlayer(player_t *player) } } } - // Super Sonic move + } + else if (cmd->buttons & BT_JUMP && !player->jumping) // Super Sonic move + { if (player->skin == 0 && player->powers[pw_super] && player->speed > FixedMul(5<mo->scale) && P_MobjFlip(player->mo)*player->mo->momz <= 0) { From b34dc93a18c6fa3f3aeda4474a2dd855089ebd88 Mon Sep 17 00:00:00 2001 From: toasterbabe Date: Fri, 21 Oct 2016 11:31:44 +0100 Subject: [PATCH 070/172] Fix to the previous commit to basically do what I wanted it to do as opposed to accidentially altering behaviour of jumping on crawlas. --- src/p_user.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/p_user.c b/src/p_user.c index 794f2b5a8..b7e847619 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -4361,10 +4361,10 @@ static void P_DoJumpStuff(player_t *player, ticcmd_t *cmd) player->secondjump = 2; - if (player->pflags & PF_JUMPED && player->jumping == 1) + // If letting go of the jump button while still on ascent, cut the jump height. + if (player->pflags & PF_JUMPED && P_MobjFlip(player->mo)*player->mo->momz > 0 && player->jumping == 1) { - if (P_MobjFlip(player->mo)*player->mo->momz > 0) - player->mo->momz >>= 1; // If letting go of the jump button while still on ascent, cut the jump height. + player->mo->momz >>= 1; player->jumping = 0; } } @@ -7077,7 +7077,7 @@ static void P_MovePlayer(player_t *player) } } } - else if (cmd->buttons & BT_JUMP && !player->jumping) // Super Sonic move + else if ((cmd->buttons & BT_JUMP) && (player->pflags & PF_THOKKED)) // Super Sonic move { if (player->skin == 0 && player->powers[pw_super] && player->speed > FixedMul(5<mo->scale) && P_MobjFlip(player->mo)*player->mo->momz <= 0) From 4c0ef9f0a35c6c799c03d09a65e215072d396c3c Mon Sep 17 00:00:00 2001 From: toasterbabe Date: Fri, 21 Oct 2016 11:48:41 +0100 Subject: [PATCH 071/172] * No ridiculously-fast float animation. * No falling when you accidentially press spin. --- src/p_user.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/p_user.c b/src/p_user.c index b7e847619..71e6ad021 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -7077,12 +7077,13 @@ static void P_MovePlayer(player_t *player) } } } - else if ((cmd->buttons & BT_JUMP) && (player->pflags & PF_THOKKED)) // Super Sonic move + + if ((cmd->buttons & BT_JUMP) && (player->pflags & PF_THOKKED)) // Super Sonic move { if (player->skin == 0 && player->powers[pw_super] && player->speed > FixedMul(5<mo->scale) && P_MobjFlip(player->mo)*player->mo->momz <= 0) { - if (player->panim == PA_ROLL || player->panim == PA_JUMP || player->mo->state-states == S_PLAY_PAIN || player->panim == PA_WALK) + if (player->panim == PA_JUMP || player->panim == PA_FALL) P_SetPlayerMobjState(player->mo, S_PLAY_SUPER_FLOAT); player->mo->momz = 0; From bda630ce41b1791e271e132160028e575d64abc5 Mon Sep 17 00:00:00 2001 From: toasterbabe Date: Fri, 21 Oct 2016 11:57:59 +0100 Subject: [PATCH 072/172] I could do better than the previous commit. --- src/p_user.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/p_user.c b/src/p_user.c index 71e6ad021..705a797c2 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -7083,7 +7083,8 @@ static void P_MovePlayer(player_t *player) if (player->skin == 0 && player->powers[pw_super] && player->speed > FixedMul(5<mo->scale) && P_MobjFlip(player->mo)*player->mo->momz <= 0) { - if (player->panim == PA_JUMP || player->panim == PA_FALL) + if (player->mo->state-states == S_PLAY_PAIN || player->panim == PA_JUMP || player->panim == PA_FALL + || (player->panim == PA_WALK && player->mo->state-states != S_PLAY_SUPER_FLOAT)) P_SetPlayerMobjState(player->mo, S_PLAY_SUPER_FLOAT); player->mo->momz = 0; From 6abd4d20d3a724c661118b734b6606b89d883f08 Mon Sep 17 00:00:00 2001 From: toasterbabe Date: Fri, 21 Oct 2016 12:31:06 +0100 Subject: [PATCH 073/172] Further tightening. --- src/p_user.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/p_user.c b/src/p_user.c index 705a797c2..10476a5d3 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -7078,7 +7078,7 @@ static void P_MovePlayer(player_t *player) } } - if ((cmd->buttons & BT_JUMP) && (player->pflags & PF_THOKKED)) // Super Sonic move + if ((cmd->buttons & BT_JUMP) && (player->pflags & PF_THOKKED) && !player->homing) // Super Sonic move { if (player->skin == 0 && player->powers[pw_super] && player->speed > FixedMul(5<mo->scale) && P_MobjFlip(player->mo)*player->mo->momz <= 0) @@ -7088,7 +7088,7 @@ static void P_MovePlayer(player_t *player) P_SetPlayerMobjState(player->mo, S_PLAY_SUPER_FLOAT); player->mo->momz = 0; - player->pflags &= ~PF_SPINNING; + player->pflags &= ~(PF_SPINNING|PF_SHIELDABILITY); player->jumping = 0; // don't cut jump height after bouncing off something } } From 5ad7fc8495da56b6566b4195644ad496189b8904 Mon Sep 17 00:00:00 2001 From: toasterbabe Date: Fri, 21 Oct 2016 12:34:16 +0100 Subject: [PATCH 074/172] A better check than for skin==0. --- src/p_user.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/p_user.c b/src/p_user.c index 10476a5d3..6bf5b80b2 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -7080,7 +7080,7 @@ static void P_MovePlayer(player_t *player) if ((cmd->buttons & BT_JUMP) && (player->pflags & PF_THOKKED) && !player->homing) // Super Sonic move { - if (player->skin == 0 && player->powers[pw_super] && player->speed > FixedMul(5<mo->scale) + if ((player->charability == CA_THOK) && player->powers[pw_super] && player->speed > FixedMul(5<mo->scale) && P_MobjFlip(player->mo)*player->mo->momz <= 0) { if (player->mo->state-states == S_PLAY_PAIN || player->panim == PA_JUMP || player->panim == PA_FALL From 587c0079e263b9c404865ce2c22ba9f02e5305f5 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Sat, 22 Oct 2016 23:19:24 +0100 Subject: [PATCH 075/172] Started work on FLIPX/FLIPY support for patches. Doesn't do anything yet, but the parser should know how to look for them now Note: I had to create M_UnGetToken in order to avoid problems with looking for patch parameters (marked by { and }) but not finding anything --- src/dehacked.c | 2 +- src/doomdef.h | 1 + src/m_misc.c | 21 ++++++++++++++++++--- src/r_data.c | 43 +++++++++++++++++++++++++++++++++++++++++++ src/r_data.h | 1 + 5 files changed, 64 insertions(+), 4 deletions(-) diff --git a/src/dehacked.c b/src/dehacked.c index 20f835981..920e5eec3 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -2778,7 +2778,7 @@ static void readpatch(MYFILE *f, const char *name, UINT16 wad) char *word2; char *tmp; INT32 i = 0, j = 0, value; - texpatch_t patch = {0, 0, UINT16_MAX, UINT16_MAX}; + texpatch_t patch = {0, 0, UINT16_MAX, UINT16_MAX, 0}; // Jump to the texture this patch belongs to, which, // coincidentally, is always the last one on the buffer cache. diff --git a/src/doomdef.h b/src/doomdef.h index 410e740fa..d0ac3a676 100644 --- a/src/doomdef.h +++ b/src/doomdef.h @@ -407,6 +407,7 @@ void M_StartupLocale(void); extern void *(*M_Memcpy)(void* dest, const void* src, size_t n) FUNCNONNULL; char *va(const char *format, ...) FUNCPRINTF; char *M_GetToken(const char *inputString); +void M_UnGetToken(void); char *sizeu1(size_t num); char *sizeu2(size_t num); char *sizeu3(size_t num); diff --git a/src/m_misc.c b/src/m_misc.c index cfe73d88f..d6ab40196 100644 --- a/src/m_misc.c +++ b/src/m_misc.c @@ -1617,6 +1617,11 @@ INT32 axtoi(const char *hexStg) return intValue; } +// Token parser variables + +static UINT32 oldendPos = 0; // old value of endPos, used by M_UnGetToken +static UINT32 endPos = 0; // now external to M_GetToken, but still static + /** Token parser for TEXTURES, ANIMDEFS, and potentially other lumps later down the line. * Was originally R_GetTexturesToken when I was coding up the TEXTURES parser, until I realized I needed it for ANIMDEFS too. * Parses up to the next whitespace character or comma. When finding the start of the next token, whitespace is skipped. @@ -1631,7 +1636,7 @@ char *M_GetToken(const char *inputString) { static const char *stringToUse = NULL; // Populated if inputString != NULL; used otherwise static UINT32 startPos = 0; - static UINT32 endPos = 0; +// static UINT32 endPos = 0; static UINT32 stringLength = 0; static UINT8 inComment = 0; // 0 = not in comment, 1 = // Single-line, 2 = /* Multi-line */ char *texturesToken = NULL; @@ -1641,12 +1646,12 @@ char *M_GetToken(const char *inputString) { stringToUse = inputString; startPos = 0; - endPos = 0; + oldendPos = endPos = 0; stringLength = strlen(inputString); } else { - startPos = endPos; + startPos = oldendPos = endPos; } if (stringToUse == NULL) return NULL; @@ -1777,6 +1782,16 @@ char *M_GetToken(const char *inputString) return texturesToken; } +/** Undoes the last M_GetToken call + * The current position along the string being parsed is reset to the last saved position. + * This exists mostly because of R_ParseTexture/R_ParsePatch honestly, but could be useful elsewhere? + * -Monster Iestyn (22/10/16) + */ +void M_UnGetToken(void) +{ + endPos = oldendPos; +} + /** Count bits in a number. */ UINT8 M_CountBits(UINT32 num, UINT8 size) diff --git a/src/r_data.c b/src/r_data.c index cb5cf3591..5c3d06649 100644 --- a/src/r_data.c +++ b/src/r_data.c @@ -502,6 +502,7 @@ static texpatch_t *R_ParsePatch(boolean actuallyLoadPatch) char *patchName = NULL; INT16 patchXPos; INT16 patchYPos; + UINT8 flip = 0; texpatch_t *resultPatch = NULL; lumpnum_t patchLumpNum; @@ -598,6 +599,47 @@ static texpatch_t *R_ParsePatch(boolean actuallyLoadPatch) } Z_Free(texturesToken); + // Patch parameters block (OPTIONAL) + // added by Monster Iestyn (22/10/16) + + // Left Curly Brace + texturesToken = M_GetToken(NULL); + if (texturesToken == NULL) + ; // move on and ignore, R_ParseTextures will deal with this + else + { + if (strcmp(texturesToken,"{")==0) + { + Z_Free(texturesToken); + texturesToken = M_GetToken(NULL); + if (texturesToken == NULL) + { + I_Error("Error parsing TEXTURES lump: Unexpected end of file where patch \"%s\"'s parameters should be",patchName); + } + while (strcmp(texturesToken,"}")!=0) + { + if (stricmp(texturesToken, "FLIPX")==0) + flip |= 1; + else if (stricmp(texturesToken, "FLIPY")==0) + flip |= 2; + Z_Free(texturesToken); + + texturesToken = M_GetToken(NULL); + if (texturesToken == NULL) + { + I_Error("Error parsing TEXTURES lump: Unexpected end of file where patch \"%s\"'s parameters or right curly brace should be",patchName); + } + } + } + else + { + // this is not what we wanted... + // undo last read so R_ParseTextures can re-get the token for its own purposes + M_UnGetToken(); + } + Z_Free(texturesToken); + } + if (actuallyLoadPatch == true) { // Check lump exists @@ -608,6 +650,7 @@ static texpatch_t *R_ParsePatch(boolean actuallyLoadPatch) resultPatch->originy = patchYPos; resultPatch->lump = patchLumpNum & 65535; resultPatch->wad = patchLumpNum>>16; + resultPatch->flip = flip; // Clean up a little after ourselves Z_Free(patchName); // Then return it diff --git a/src/r_data.h b/src/r_data.h index 69a2882af..1384ecac0 100644 --- a/src/r_data.h +++ b/src/r_data.h @@ -31,6 +31,7 @@ typedef struct // Block origin (always UL), which has already accounted for the internal origin of the patch. INT16 originx, originy; UINT16 wad, lump; + UINT8 flip; // 1 = flipx, 2 = flipy, 3 = both } texpatch_t; // A maptexturedef_t describes a rectangular texture, From 8720252059542523a895a22a207d157925cb965f Mon Sep 17 00:00:00 2001 From: toasterbabe Date: Sun, 23 Oct 2016 14:42:37 +0100 Subject: [PATCH 076/172] Thorough jumpdamage setting. --- src/p_map.c | 4 +++- src/p_spec.c | 4 ++++ src/p_user.c | 35 +++++++++++++++++++++++++++++++---- 3 files changed, 38 insertions(+), 5 deletions(-) diff --git a/src/p_map.c b/src/p_map.c index d924ad564..fe9cecdba 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -203,7 +203,7 @@ boolean P_DoSpring(mobj_t *spring, mobj_t *object) } } - pflags = object->player->pflags & (PF_JUMPED|PF_SPINNING|PF_THOKKED|PF_SHIELDABILITY); // I still need these. + pflags = object->player->pflags & (PF_JUMPED|PF_JUMPDAMAGE|PF_SPINNING|PF_THOKKED|PF_SHIELDABILITY); // I still need these. jumping = object->player->jumping; secondjump = object->player->secondjump; P_ResetPlayer(object->player); @@ -211,6 +211,8 @@ boolean P_DoSpring(mobj_t *spring, mobj_t *object) if (spring->info->painchance) { object->player->pflags |= PF_JUMPED; + if (!(object->player->charflags & SF_NOJUMPDAMAGE)) + object->player->pflags |= PF_JUMPDAMAGE; P_SetPlayerMobjState(object, S_PLAY_JUMP); } else if (P_MobjFlip(object)*vertispeed > 0) diff --git a/src/p_spec.c b/src/p_spec.c index 617bc6abe..2284fdadf 100644 --- a/src/p_spec.c +++ b/src/p_spec.c @@ -7533,7 +7533,11 @@ void T_Pusher(pusher_t *p) P_ResetPlayer (thing->player); if (jumped) + { thing->player->pflags |= PF_JUMPED; + if (!(thing->player->charflags & SF_NOJUMPDAMAGE)) + thing->player->pflags |= PF_JUMPDAMAGE; + } thing->player->pflags |= PF_SLIDING; P_SetPlayerMobjState (thing, thing->info->painstate); // Whee! diff --git a/src/p_user.c b/src/p_user.c index 6bf5b80b2..4c0b23aca 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -577,7 +577,7 @@ static void P_DeNightserizePlayer(player_t *player) player->pflags &= ~PF_NIGHTSMODE; player->powers[pw_underwater] = 0; - player->pflags &= ~(PF_USEDOWN|PF_JUMPDOWN|PF_ATTACKDOWN|PF_STARTDASH|PF_GLIDING|PF_JUMPED|PF_THOKKED|PF_SPINNING|PF_DRILLING|PF_TRANSFERTOCLOSEST); + player->pflags &= ~(PF_USEDOWN|PF_JUMPDOWN|PF_ATTACKDOWN|PF_STARTDASH|PF_GLIDING|PF_JUMPED|PF_JUMPDAMAGE|PF_THOKKED|PF_SPINNING|PF_DRILLING|PF_TRANSFERTOCLOSEST); player->secondjump = 0; player->jumping = 0; player->homing = 0; @@ -650,7 +650,7 @@ void P_NightserizePlayer(player_t *player, INT32 nighttime) if (!(player->pflags & PF_NIGHTSMODE)) player->mo->height = P_GetPlayerHeight(player); // Just to make sure jumping into the drone doesn't result in a squashed hitbox. - player->pflags &= ~(PF_USEDOWN|PF_JUMPDOWN|PF_ATTACKDOWN|PF_STARTDASH|PF_GLIDING|PF_JUMPED|PF_THOKKED|PF_SHIELDABILITY|PF_SPINNING|PF_DRILLING); + player->pflags &= ~(PF_USEDOWN|PF_JUMPDOWN|PF_ATTACKDOWN|PF_STARTDASH|PF_GLIDING|PF_JUMPED|PF_JUMPDAMAGE|PF_THOKKED|PF_SHIELDABILITY|PF_SPINNING|PF_DRILLING); player->homing = 0; player->mo->fuse = 0; player->speed = 0; @@ -1677,6 +1677,8 @@ void P_DoPlayerExit(player_t *player) { player->climbing = 0; player->pflags |= PF_JUMPED; + if (!(player->charflags & SF_NOJUMPDAMAGE)) + player->pflags |= PF_JUMPDAMAGE; P_SetPlayerMobjState(player->mo, S_PLAY_JUMP); } player->powers[pw_underwater] = 0; @@ -1997,6 +1999,8 @@ static void P_CheckBouncySectors(player_t *player) { player->pflags &= ~PF_SPINNING; player->pflags |= PF_JUMPED; + if (!(player->charflags & SF_NOJUMPDAMAGE)) + player->pflags |= PF_JUMPDAMAGE; player->pflags |= PF_THOKKED; } } @@ -2008,8 +2012,9 @@ static void P_CheckBouncySectors(player_t *player) if (player->pflags & PF_SPINNING) { player->pflags &= ~PF_SPINNING; - player->pflags |= PF_JUMPED; - player->pflags |= PF_THOKKED; + player->pflags |= (PF_JUMPED|PF_THOKKED); + if (!(player->charflags & SF_NOJUMPDAMAGE)) + player->pflags |= PF_JUMPDAMAGE; } } @@ -2017,6 +2022,8 @@ static void P_CheckBouncySectors(player_t *player) { player->pflags &= ~PF_SPINNING; player->pflags |= PF_JUMPED; + if (!(player->charflags & SF_NOJUMPDAMAGE)) + player->pflags |= PF_JUMPDAMAGE; } goto bouncydone; @@ -2760,6 +2767,8 @@ static void P_DoClimbing(player_t *player) player->climbing = 0; player->pflags |= PF_JUMPED; + if (!(player->charflags & SF_NOJUMPDAMAGE)) + player->pflags |= PF_JUMPDAMAGE; P_SetPlayerMobjState(player->mo, S_PLAY_JUMP); } @@ -2767,6 +2776,8 @@ static void P_DoClimbing(player_t *player) { player->climbing = 0; player->pflags |= PF_JUMPED; + if (!(player->charflags & SF_NOJUMPDAMAGE)) + player->pflags |= PF_JUMPDAMAGE; P_SetPlayerMobjState(player->mo, S_PLAY_JUMP); } } @@ -2774,6 +2785,8 @@ static void P_DoClimbing(player_t *player) { player->climbing = 0; player->pflags |= PF_JUMPED; + if (!(player->charflags & SF_NOJUMPDAMAGE)) + player->pflags |= PF_JUMPDAMAGE; P_SetPlayerMobjState(player->mo, S_PLAY_JUMP); } @@ -2792,6 +2805,8 @@ static void P_DoClimbing(player_t *player) { player->climbing = 0; player->pflags |= PF_JUMPED; + if (!(player->charflags & SF_NOJUMPDAMAGE)) + player->pflags |= PF_JUMPDAMAGE; P_SetPlayerMobjState(player->mo, S_PLAY_JUMP); P_SetObjectMomZ(player->mo, 4*FRACUNIT, false); P_InstaThrust(player->mo, player->mo->angle, FixedMul(-4*FRACUNIT, player->mo->scale)); @@ -6712,6 +6727,8 @@ static void P_MovePlayer(player_t *player) else { player->pflags |= PF_JUMPED; + if (!(player->charflags & SF_NOJUMPDAMAGE)) + player->pflags |= PF_JUMPDAMAGE; P_SetPlayerMobjState(player->mo, S_PLAY_JUMP); } player->pflags &= ~PF_GLIDING; @@ -6769,6 +6786,8 @@ static void P_MovePlayer(player_t *player) || (player->powers[pw_super] && ALL7EMERALDS(player->powers[pw_emeralds]) && player->charability == CA_GLIDEANDCLIMB)) { player->pflags |= PF_JUMPED; + if (!(player->charflags & SF_NOJUMPDAMAGE)) + player->pflags |= PF_JUMPDAMAGE; P_SetPlayerMobjState(player->mo, S_PLAY_JUMP); } else @@ -6839,6 +6858,8 @@ static void P_MovePlayer(player_t *player) else { player->pflags |= PF_JUMPED; + if (!(player->charflags & SF_NOJUMPDAMAGE)) + player->pflags |= PF_JUMPDAMAGE; P_SetPlayerMobjState(player->mo, S_PLAY_JUMP); } } @@ -7488,6 +7509,8 @@ static void P_DoRopeHang(player_t *player) P_SetTarget(&player->mo->tracer, NULL); player->pflags |= PF_JUMPED; + if (!(player->charflags & SF_NOJUMPDAMAGE)) + player->pflags |= PF_JUMPDAMAGE; player->powers[pw_carry] = CR_NONE; if (!(player->pflags & PF_SLIDING) && (player->pflags & PF_JUMPED) @@ -7586,6 +7609,8 @@ static void P_DoRopeHang(player_t *player) if (player->mo->tracer->flags & MF_SLIDEME) { player->pflags |= PF_JUMPED; + if (!(player->charflags & SF_NOJUMPDAMAGE)) + player->pflags |= PF_JUMPDAMAGE; if (!(player->pflags & PF_SLIDING) && (player->pflags & PF_JUMPED) && !(player->panim == PA_JUMP)) @@ -9681,6 +9706,8 @@ void P_PlayerAfterThink(player_t *player) player->mo->momz = (player->mo->tracer->z - (player->mo->height-player->mo->tracer->height/2) - player->mo->z)*2; P_TeleportMove(player->mo, player->mo->tracer->x, player->mo->tracer->y, player->mo->tracer->z - (player->mo->height-player->mo->tracer->height/2)); player->pflags |= PF_JUMPED; + if (!(player->charflags & SF_NOJUMPDAMAGE)) + player->pflags |= PF_JUMPDAMAGE; player->secondjump = 0; player->pflags &= ~PF_THOKKED; From 76ff26e6fb4aa71c88c6841d0e0f42851f295685 Mon Sep 17 00:00:00 2001 From: toasterbabe Date: Sun, 23 Oct 2016 15:53:12 +0100 Subject: [PATCH 077/172] Revert "Thorough jumpdamage setting." This reverts commit 8720252059542523a895a22a207d157925cb965f. --- src/p_map.c | 4 +--- src/p_spec.c | 4 ---- src/p_user.c | 35 ++++------------------------------- 3 files changed, 5 insertions(+), 38 deletions(-) diff --git a/src/p_map.c b/src/p_map.c index fe9cecdba..d924ad564 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -203,7 +203,7 @@ boolean P_DoSpring(mobj_t *spring, mobj_t *object) } } - pflags = object->player->pflags & (PF_JUMPED|PF_JUMPDAMAGE|PF_SPINNING|PF_THOKKED|PF_SHIELDABILITY); // I still need these. + pflags = object->player->pflags & (PF_JUMPED|PF_SPINNING|PF_THOKKED|PF_SHIELDABILITY); // I still need these. jumping = object->player->jumping; secondjump = object->player->secondjump; P_ResetPlayer(object->player); @@ -211,8 +211,6 @@ boolean P_DoSpring(mobj_t *spring, mobj_t *object) if (spring->info->painchance) { object->player->pflags |= PF_JUMPED; - if (!(object->player->charflags & SF_NOJUMPDAMAGE)) - object->player->pflags |= PF_JUMPDAMAGE; P_SetPlayerMobjState(object, S_PLAY_JUMP); } else if (P_MobjFlip(object)*vertispeed > 0) diff --git a/src/p_spec.c b/src/p_spec.c index a52e63104..d0c268c86 100644 --- a/src/p_spec.c +++ b/src/p_spec.c @@ -7508,11 +7508,7 @@ void T_Pusher(pusher_t *p) P_ResetPlayer (thing->player); if (jumped) - { thing->player->pflags |= PF_JUMPED; - if (!(thing->player->charflags & SF_NOJUMPDAMAGE)) - thing->player->pflags |= PF_JUMPDAMAGE; - } thing->player->pflags |= PF_SLIDING; P_SetPlayerMobjState (thing, thing->info->painstate); // Whee! diff --git a/src/p_user.c b/src/p_user.c index afd193066..5533ed619 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -577,7 +577,7 @@ static void P_DeNightserizePlayer(player_t *player) player->pflags &= ~PF_NIGHTSMODE; player->powers[pw_underwater] = 0; - player->pflags &= ~(PF_USEDOWN|PF_JUMPDOWN|PF_ATTACKDOWN|PF_STARTDASH|PF_GLIDING|PF_JUMPED|PF_JUMPDAMAGE|PF_THOKKED|PF_SPINNING|PF_DRILLING|PF_TRANSFERTOCLOSEST); + player->pflags &= ~(PF_USEDOWN|PF_JUMPDOWN|PF_ATTACKDOWN|PF_STARTDASH|PF_GLIDING|PF_JUMPED|PF_THOKKED|PF_SPINNING|PF_DRILLING|PF_TRANSFERTOCLOSEST); player->secondjump = 0; player->jumping = 0; player->homing = 0; @@ -650,7 +650,7 @@ void P_NightserizePlayer(player_t *player, INT32 nighttime) if (!(player->pflags & PF_NIGHTSMODE)) player->mo->height = P_GetPlayerHeight(player); // Just to make sure jumping into the drone doesn't result in a squashed hitbox. - player->pflags &= ~(PF_USEDOWN|PF_JUMPDOWN|PF_ATTACKDOWN|PF_STARTDASH|PF_GLIDING|PF_JUMPED|PF_JUMPDAMAGE|PF_THOKKED|PF_SHIELDABILITY|PF_SPINNING|PF_DRILLING); + player->pflags &= ~(PF_USEDOWN|PF_JUMPDOWN|PF_ATTACKDOWN|PF_STARTDASH|PF_GLIDING|PF_JUMPED|PF_THOKKED|PF_SHIELDABILITY|PF_SPINNING|PF_DRILLING); player->homing = 0; player->mo->fuse = 0; player->speed = 0; @@ -1677,8 +1677,6 @@ void P_DoPlayerExit(player_t *player) { player->climbing = 0; player->pflags |= PF_JUMPED; - if (!(player->charflags & SF_NOJUMPDAMAGE)) - player->pflags |= PF_JUMPDAMAGE; P_SetPlayerMobjState(player->mo, S_PLAY_JUMP); } player->powers[pw_underwater] = 0; @@ -1999,8 +1997,6 @@ static void P_CheckBouncySectors(player_t *player) { player->pflags &= ~PF_SPINNING; player->pflags |= PF_JUMPED; - if (!(player->charflags & SF_NOJUMPDAMAGE)) - player->pflags |= PF_JUMPDAMAGE; player->pflags |= PF_THOKKED; } } @@ -2012,9 +2008,8 @@ static void P_CheckBouncySectors(player_t *player) if (player->pflags & PF_SPINNING) { player->pflags &= ~PF_SPINNING; - player->pflags |= (PF_JUMPED|PF_THOKKED); - if (!(player->charflags & SF_NOJUMPDAMAGE)) - player->pflags |= PF_JUMPDAMAGE; + player->pflags |= PF_JUMPED; + player->pflags |= PF_THOKKED; } } @@ -2022,8 +2017,6 @@ static void P_CheckBouncySectors(player_t *player) { player->pflags &= ~PF_SPINNING; player->pflags |= PF_JUMPED; - if (!(player->charflags & SF_NOJUMPDAMAGE)) - player->pflags |= PF_JUMPDAMAGE; } goto bouncydone; @@ -2767,8 +2760,6 @@ static void P_DoClimbing(player_t *player) player->climbing = 0; player->pflags |= PF_JUMPED; - if (!(player->charflags & SF_NOJUMPDAMAGE)) - player->pflags |= PF_JUMPDAMAGE; P_SetPlayerMobjState(player->mo, S_PLAY_JUMP); } @@ -2776,8 +2767,6 @@ static void P_DoClimbing(player_t *player) { player->climbing = 0; player->pflags |= PF_JUMPED; - if (!(player->charflags & SF_NOJUMPDAMAGE)) - player->pflags |= PF_JUMPDAMAGE; P_SetPlayerMobjState(player->mo, S_PLAY_JUMP); } } @@ -2785,8 +2774,6 @@ static void P_DoClimbing(player_t *player) { player->climbing = 0; player->pflags |= PF_JUMPED; - if (!(player->charflags & SF_NOJUMPDAMAGE)) - player->pflags |= PF_JUMPDAMAGE; P_SetPlayerMobjState(player->mo, S_PLAY_JUMP); } @@ -2805,8 +2792,6 @@ static void P_DoClimbing(player_t *player) { player->climbing = 0; player->pflags |= PF_JUMPED; - if (!(player->charflags & SF_NOJUMPDAMAGE)) - player->pflags |= PF_JUMPDAMAGE; P_SetPlayerMobjState(player->mo, S_PLAY_JUMP); P_SetObjectMomZ(player->mo, 4*FRACUNIT, false); P_InstaThrust(player->mo, player->mo->angle, FixedMul(-4*FRACUNIT, player->mo->scale)); @@ -6727,8 +6712,6 @@ static void P_MovePlayer(player_t *player) else { player->pflags |= PF_JUMPED; - if (!(player->charflags & SF_NOJUMPDAMAGE)) - player->pflags |= PF_JUMPDAMAGE; P_SetPlayerMobjState(player->mo, S_PLAY_JUMP); } player->pflags &= ~PF_GLIDING; @@ -6786,8 +6769,6 @@ static void P_MovePlayer(player_t *player) || (player->powers[pw_super] && ALL7EMERALDS(player->powers[pw_emeralds]) && player->charability == CA_GLIDEANDCLIMB)) { player->pflags |= PF_JUMPED; - if (!(player->charflags & SF_NOJUMPDAMAGE)) - player->pflags |= PF_JUMPDAMAGE; P_SetPlayerMobjState(player->mo, S_PLAY_JUMP); } else @@ -6858,8 +6839,6 @@ static void P_MovePlayer(player_t *player) else { player->pflags |= PF_JUMPED; - if (!(player->charflags & SF_NOJUMPDAMAGE)) - player->pflags |= PF_JUMPDAMAGE; P_SetPlayerMobjState(player->mo, S_PLAY_JUMP); } } @@ -7509,8 +7488,6 @@ static void P_DoRopeHang(player_t *player) P_SetTarget(&player->mo->tracer, NULL); player->pflags |= PF_JUMPED; - if (!(player->charflags & SF_NOJUMPDAMAGE)) - player->pflags |= PF_JUMPDAMAGE; player->powers[pw_carry] = CR_NONE; if (!(player->pflags & PF_SLIDING) && (player->pflags & PF_JUMPED) @@ -7609,8 +7586,6 @@ static void P_DoRopeHang(player_t *player) if (player->mo->tracer->flags & MF_SLIDEME) { player->pflags |= PF_JUMPED; - if (!(player->charflags & SF_NOJUMPDAMAGE)) - player->pflags |= PF_JUMPDAMAGE; if (!(player->pflags & PF_SLIDING) && (player->pflags & PF_JUMPED) && !(player->panim == PA_JUMP)) @@ -9706,8 +9681,6 @@ void P_PlayerAfterThink(player_t *player) player->mo->momz = (player->mo->tracer->z - (player->mo->height-player->mo->tracer->height/2) - player->mo->z)*2; P_TeleportMove(player->mo, player->mo->tracer->x, player->mo->tracer->y, player->mo->tracer->z - (player->mo->height-player->mo->tracer->height/2)); player->pflags |= PF_JUMPED; - if (!(player->charflags & SF_NOJUMPDAMAGE)) - player->pflags |= PF_JUMPDAMAGE; player->secondjump = 0; player->pflags &= ~PF_THOKKED; From c54d62851cad7f2e4a042397d8dab3205d0048ee Mon Sep 17 00:00:00 2001 From: toasterbabe Date: Sun, 23 Oct 2016 16:04:02 +0100 Subject: [PATCH 078/172] Okay, this is a MUCH better solution than PF_JUMPDAMAGE. --- src/d_player.h | 4 ++-- src/p_inter.c | 6 +++--- src/p_map.c | 6 ++++-- src/p_mobj.c | 2 +- src/p_user.c | 8 +++----- 5 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/d_player.h b/src/d_player.h index 4f9833fa0..4f3e37e59 100644 --- a/src/d_player.h +++ b/src/d_player.h @@ -156,8 +156,8 @@ typedef enum // Used shield ability PF_SHIELDABILITY = 1<<28, - // Do jump damage? - PF_JUMPDAMAGE = 1<<29 + // Force jump damage? + PF_FORCEJUMPDAMAGE = 1<<29 // free up to and including 1<<31 } pflags_t; diff --git a/src/p_inter.c b/src/p_inter.c index 8c66d35a0..4bf600c51 100644 --- a/src/p_inter.c +++ b/src/p_inter.c @@ -306,7 +306,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck) } if (((player->pflags & PF_NIGHTSMODE) && (player->pflags & PF_DRILLING)) - || ((player->pflags & PF_JUMPED) && (player->pflags & PF_JUMPDAMAGE || (player->charability == CA_TWINSPIN && player->panim == PA_ABILITY))) + || ((player->pflags & PF_JUMPED) && (player->pflags & PF_FORCEJUMPDAMAGE || !(player->charflags & SF_NOJUMPSPIN) || (player->charability == CA_TWINSPIN && player->panim == PA_ABILITY))) || (player->pflags & (PF_SPINNING|PF_GLIDING)) || (player->charability2 == CA2_MELEE && player->panim == PA_ABILITY2) || ((player->charflags & SF_STOMPDAMAGE) && (P_MobjFlip(toucher)*(toucher->z - (special->z + special->height/2)) > 0) && (P_MobjFlip(toucher)*toucher->momz < 0)) @@ -353,7 +353,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck) P_DamageMobj(toucher, special, special, 1, 0); } else if (((player->pflags & PF_NIGHTSMODE) && (player->pflags & PF_DRILLING)) - || ((player->pflags & PF_JUMPED) && (player->pflags & PF_JUMPDAMAGE || (player->charability == CA_TWINSPIN && player->panim == PA_ABILITY))) + || ((player->pflags & PF_JUMPED) && (player->pflags & PF_FORCEJUMPDAMAGE || !(player->charflags & SF_NOJUMPSPIN) || (player->charability == CA_TWINSPIN && player->panim == PA_ABILITY))) || (player->pflags & (PF_SPINNING|PF_GLIDING)) || (player->charability2 == CA2_MELEE && player->panim == PA_ABILITY2) || ((player->charflags & SF_STOMPDAMAGE) && (P_MobjFlip(toucher)*(toucher->z - (special->z + special->height/2)) > 0) && (P_MobjFlip(toucher)*toucher->momz < 0)) @@ -1346,7 +1346,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck) return; } else if (((player->pflags & PF_NIGHTSMODE) && (player->pflags & PF_DRILLING)) - || ((player->pflags & PF_JUMPED) && (player->pflags & PF_JUMPDAMAGE || (player->charability == CA_TWINSPIN && player->panim == PA_ABILITY))) + || ((player->pflags & PF_JUMPED) && (player->pflags & PF_FORCEJUMPDAMAGE || !(player->charflags & SF_NOJUMPSPIN) || (player->charability == CA_TWINSPIN && player->panim == PA_ABILITY))) || ((player->charflags & SF_STOMPDAMAGE) && (P_MobjFlip(toucher)*(toucher->z - (special->z + special->height/2)) > 0) && (P_MobjFlip(toucher)*toucher->momz < 0)) || (player->pflags & (PF_SPINNING|PF_GLIDING)) || player->powers[pw_invulnerability] || player->powers[pw_super]) // Do you possess the ability to subdue the object? diff --git a/src/p_map.c b/src/p_map.c index d924ad564..72668e478 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -1058,7 +1058,8 @@ static boolean PIT_CheckThing(mobj_t *thing) if (thing->flags & MF_MONITOR && (tmthing->player->pflags & (PF_SPINNING|PF_GLIDING) || ((tmthing->player->pflags & PF_JUMPED) - && (tmthing->player->pflags & PF_JUMPDAMAGE + && (tmthing->player->pflags & PF_FORCEJUMPDAMAGE + || !(tmthing->player->charflags & SF_NOJUMPSPIN) || (tmthing->player->charability == CA_TWINSPIN && tmthing->player->panim == PA_ABILITY))) || (tmthing->player->charability2 == CA2_MELEE && tmthing->player->panim == PA_ABILITY2) || ((tmthing->player->charflags & SF_STOMPDAMAGE) @@ -1093,7 +1094,8 @@ static boolean PIT_CheckThing(mobj_t *thing) else if (thing->flags & MF_MONITOR && tmthing->player && (tmthing->player->pflags & (PF_SPINNING|PF_GLIDING) || ((tmthing->player->pflags & PF_JUMPED) - && (tmthing->player->pflags & PF_JUMPDAMAGE + && (tmthing->player->pflags & PF_FORCEJUMPDAMAGE + || !(tmthing->player->charflags & SF_NOJUMPSPIN) || (tmthing->player->charability == CA_TWINSPIN && tmthing->player->panim == PA_ABILITY))) || (tmthing->player->charability2 == CA2_MELEE && tmthing->player->panim == PA_ABILITY2) || ((tmthing->player->charflags & SF_STOMPDAMAGE) diff --git a/src/p_mobj.c b/src/p_mobj.c index e15fe26cd..ecf0133f1 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -3233,7 +3233,7 @@ static void P_PlayerZMovement(mobj_t *mo) mo->player->pflags &= ~PF_SPINNING; if (!(mo->player->pflags & PF_GLIDING)) - mo->player->pflags &= ~(PF_JUMPED|PF_JUMPDAMAGE); + mo->player->pflags &= ~(PF_JUMPED|PF_FORCEJUMPDAMAGE); mo->player->pflags &= ~(PF_THOKKED|PF_CANCARRY/*|PF_GLIDING*/); mo->player->secondjump = 0; diff --git a/src/p_user.c b/src/p_user.c index 5533ed619..fc7ea2159 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -877,7 +877,7 @@ void P_DoPlayerPain(player_t *player, mobj_t *source, mobj_t *inflictor) // Useful when you want to kill everything the player is doing. void P_ResetPlayer(player_t *player) { - player->pflags &= ~(PF_SPINNING|PF_STARTDASH|PF_JUMPED|PF_JUMPDAMAGE|PF_GLIDING|PF_THOKKED|PF_CANCARRY|PF_SHIELDABILITY); + player->pflags &= ~(PF_SPINNING|PF_STARTDASH|PF_JUMPED|PF_FORCEJUMPDAMAGE|PF_GLIDING|PF_THOKKED|PF_CANCARRY|PF_SHIELDABILITY); player->powers[pw_carry] = CR_NONE; player->jumping = 0; player->secondjump = 0; @@ -3766,8 +3766,6 @@ void P_DoJump(player_t *player, boolean soundandstate) player->mo->eflags &= ~MFE_APPLYPMOMZ; player->pflags |= PF_JUMPED; - if (!(player->charflags & SF_NOJUMPDAMAGE)) - player->pflags |= PF_JUMPDAMAGE; if (soundandstate) { @@ -7045,7 +7043,7 @@ static void P_MovePlayer(player_t *player) player->homing = 2; if (P_LookForEnemies(player, false) && player->mo->tracer) { - player->pflags |= PF_JUMPDAMAGE; + player->pflags |= PF_FORCEJUMPDAMAGE; P_SetPlayerMobjState(player->mo, S_PLAY_SPIN); S_StartSound(player->mo, sfx_s3k40); player->homing = 3*TICRATE; @@ -7056,7 +7054,7 @@ static void P_MovePlayer(player_t *player) // Elemental/Bubblewrap shield activation case SH_ELEMENTAL: case SH_BUBBLEWRAP: - player->pflags |= PF_JUMPDAMAGE|PF_THOKKED|PF_SHIELDABILITY; + player->pflags |= PF_FORCEJUMPDAMAGE|PF_THOKKED|PF_SHIELDABILITY; P_SetPlayerMobjState(player->mo, S_PLAY_SPIN); player->secondjump = 0; player->mo->momx = player->mo->momy = 0; From 956a8358c274f912b6817cf454a914abfdba8296 Mon Sep 17 00:00:00 2001 From: toasterbabe Date: Sun, 23 Oct 2016 16:26:36 +0100 Subject: [PATCH 079/172] Important component for nojumpspin characters. --- src/p_user.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/p_user.c b/src/p_user.c index fc7ea2159..03f91a7cd 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -9678,7 +9678,7 @@ void P_PlayerAfterThink(player_t *player) player->mo->momy = (player->mo->tracer->y - player->mo->y)*2; player->mo->momz = (player->mo->tracer->z - (player->mo->height-player->mo->tracer->height/2) - player->mo->z)*2; P_TeleportMove(player->mo, player->mo->tracer->x, player->mo->tracer->y, player->mo->tracer->z - (player->mo->height-player->mo->tracer->height/2)); - player->pflags |= PF_JUMPED; + player->pflags |= PF_JUMPED|PF_FORCEJUMPDAMAGE; player->secondjump = 0; player->pflags &= ~PF_THOKKED; From cfc9302bd32ebd5ecc6cc6738ad19f6ad063c861 Mon Sep 17 00:00:00 2001 From: toasterbabe Date: Sun, 23 Oct 2016 17:05:17 +0100 Subject: [PATCH 080/172] Minor fix to ensure PF_FORCEJUMPDAMAGE is always known. --- src/p_user.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/p_user.c b/src/p_user.c index 03f91a7cd..8cb1b7607 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -6673,7 +6673,7 @@ static void P_MovePlayer(player_t *player) P_SetPlayerMobjState(player->mo, S_PLAY_WALK); } - // If Springing (or nojumpspinning), but travelling DOWNWARD, change back! (nojumpspin also turns to fall once PF_THOKKED is added.) + // If Springing (or nojumpspinning), but travelling DOWNWARD, change back! if ((player->panim == PA_SPRING && P_MobjFlip(player->mo)*player->mo->momz < 0) || ((((player->charflags & SF_NOJUMPSPIN) && (player->pflags & PF_JUMPED) && player->panim == PA_JUMP)) && (P_MobjFlip(player->mo)*player->mo->momz < 0))) @@ -8929,8 +8929,13 @@ void P_PlayerThink(player_t *player) if (player->panim != PA_ABILITY) P_SetPlayerMobjState(player->mo, S_PLAY_GLIDE); } - else if ((player->pflags & PF_JUMPED) && !player->powers[pw_super] && player->panim != PA_JUMP && !(player->charflags & SF_NOJUMPSPIN)) - P_SetPlayerMobjState(player->mo, S_PLAY_JUMP); + else if ((player->pflags & PF_JUMPED) && !player->powers[pw_super] && ((player->charflags & SF_NOJUMPSPIN && player->pflags & PF_FORCEJUMPDAMAGE && player->panim != PA_ROLL) || (!(player->charflags & SF_NOJUMPSPIN) && player->panim != PA_JUMP))) + { + if (!(player->charflags & SF_NOJUMPSPIN)) + P_SetPlayerMobjState(player->mo, S_PLAY_JUMP); + else if (player->pflags & PF_FORCEJUMPDAMAGE) + P_SetPlayerMobjState(player->mo, S_PLAY_SPIN); + } if (player->flashcount) player->flashcount--; From 45d32b7f7cd3e54a1d6fd1df8f7adcc54f000c27 Mon Sep 17 00:00:00 2001 From: toasterbabe Date: Sun, 23 Oct 2016 20:34:43 +0100 Subject: [PATCH 081/172] * Flameaura shield now has boosh sprites. * MF2_SHIELD calls shield thinker (P_AddShield/P_ShieldLook). * Multiple types of force shields now handled. --- src/dehacked.c | 67 ++++++++++++++++++++++++++++---------------------- src/info.c | 14 ++++++++--- src/info.h | 8 ++++++ src/p_mobj.c | 48 +++++++++++++++++++++++++++--------- src/p_mobj.h | 1 + src/p_user.c | 2 ++ 6 files changed, 96 insertions(+), 44 deletions(-) diff --git a/src/dehacked.c b/src/dehacked.c index a0eee8229..224b4393d 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -5407,6 +5407,9 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit "S_ELEM11", "S_ELEM12", + "S_ELEM13", + "S_ELEM14", + "S_ELEMF1", "S_ELEMF2", "S_ELEMF3", @@ -5439,6 +5442,9 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit "S_FIRS8", "S_FIRS9", + "S_FIRS10", + "S_FIRS11", + "S_FIRSB1", "S_FIRSB2", "S_FIRSB3", @@ -5449,6 +5455,8 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit "S_FIRSB8", "S_FIRSB9", + "S_FIRSB10", + "S_BUBS1", "S_BUBS2", "S_BUBS3", @@ -6653,35 +6661,36 @@ static const char *const MOBJFLAG_LIST[] = { // \tMF2_(\S+).*// (.+) --> \t"\1", // \2 static const char *const MOBJFLAG2_LIST[] = { - "AXIS", // It's a NiGHTS axis! (For faster checking) - "TWOD", // Moves like it's in a 2D level - "DONTRESPAWN", // Don't respawn this object! - "DONTDRAW", // Don't generate a vissprite - "AUTOMATIC", // Thrown ring has automatic properties - "RAILRING", // Thrown ring has rail properties - "BOUNCERING", // Thrown ring has bounce properties - "EXPLOSION", // Thrown ring has explosive properties - "SCATTER", // Thrown ring has scatter properties - "BEYONDTHEGRAVE",// Source of this missile has died and has since respawned. - "SLIDEPUSH", // MF_PUSHABLE that pushes continuously. - "CLASSICPUSH", // Drops straight down when object has negative Z. - "STANDONME", // While not pushable, stand on me anyway. - "INFLOAT", // Floating to a height for a move, don't auto float to target's height. - "DEBRIS", // Splash ring from explosion ring - "NIGHTSPULL", // Attracted from a paraloop - "JUSTATTACKED", // can be pushed by other moving mobjs - "FIRING", // turret fire - "SUPERFIRE", // Firing something with Super Sonic-stopping properties. Or, if mobj has MF_MISSILE, this is the actual fire from it. - "SHADOW", // Fuzzy draw, makes targeting harder. - "STRONGBOX", // Flag used for "strong" random monitors. - "OBJECTFLIP", // Flag for objects that always have flipped gravity. - "SKULLFLY", // Special handling: skull in flight. - "FRET", // Flashing from a previous hit - "BOSSNOTRAP", // No Egg Trap after boss - "BOSSFLEE", // Boss is fleeing! - "BOSSDEAD", // Boss is dead! (Not necessarily fleeing, if a fleeing point doesn't exist.) - "AMBUSH", // Alternate behaviour typically set by MTF_AMBUSH - "LINKDRAW", // Draw vissprite of mobj immediately before/after tracer's vissprite (dependent on dispoffset and position) + "AXIS", // It's a NiGHTS axis! (For faster checking) + "TWOD", // Moves like it's in a 2D level + "DONTRESPAWN", // Don't respawn this object! + "DONTDRAW", // Don't generate a vissprite + "AUTOMATIC", // Thrown ring has automatic properties + "RAILRING", // Thrown ring has rail properties + "BOUNCERING", // Thrown ring has bounce properties + "EXPLOSION", // Thrown ring has explosive properties + "SCATTER", // Thrown ring has scatter properties + "BEYONDTHEGRAVE", // Source of this missile has died and has since respawned. + "SLIDEPUSH", // MF_PUSHABLE that pushes continuously. + "CLASSICPUSH", // Drops straight down when object has negative Z. + "STANDONME", // While not pushable, stand on me anyway. + "INFLOAT", // Floating to a height for a move, don't auto float to target's height. + "DEBRIS", // Splash ring from explosion ring + "NIGHTSPULL", // Attracted from a paraloop + "JUSTATTACKED", // can be pushed by other moving mobjs + "FIRING", // turret fire + "SUPERFIRE", // Firing something with Super Sonic-stopping properties. Or, if mobj has MF_MISSILE, this is the actual fire from it. + "SHADOW", // Fuzzy draw, makes targeting harder. + "STRONGBOX", // Flag used for "strong" random monitors. + "OBJECTFLIP", // Flag for objects that always have flipped gravity. + "SKULLFLY", // Special handling: skull in flight. + "FRET", // Flashing from a previous hit + "BOSSNOTRAP", // No Egg Trap after boss + "BOSSFLEE", // Boss is fleeing! + "BOSSDEAD", // Boss is dead! (Not necessarily fleeing, if a fleeing point doesn't exist.) + "AMBUSH", // Alternate behaviour typically set by MTF_AMBUSH + "LINKDRAW", // Draw vissprite of mobj immediately before/after tracer's vissprite (dependent on dispoffset and position) + "SHIELD", // Thinker calls P_AddShield/P_ShieldLook (must be partnered with MF_SCENERY to use) NULL }; diff --git a/src/info.c b/src/info.c index 2c0514634..802f90f26 100644 --- a/src/info.c +++ b/src/info.c @@ -2119,6 +2119,9 @@ state_t states[NUMSTATES] = {SPR_ELEM, FF_TRANS50|10, 4, {NULL}, 0, 0, S_ELEM12}, // S_ELEM11 {SPR_ELEM, FF_TRANS50|11, 4, {NULL}, 0, 0, S_ELEM1 }, // S_ELEM12 + {SPR_NULL, 0, 1, {NULL}, 0, 0, S_ELEM14}, // S_ELEM13 + {SPR_ELEM, FF_TRANS50|11, 1, {NULL}, 0, 0, S_ELEM1 }, // S_ELEM14 + {SPR_ELEM, FF_FULLBRIGHT|12, 3, {NULL}, 0, 0, S_ELEMF2 }, // S_ELEMF1 {SPR_ELEM, FF_FULLBRIGHT|13, 3, {NULL}, 0, 0, S_ELEMF3 }, // S_ELEMF2 {SPR_ELEM, FF_FULLBRIGHT|14, 3, {NULL}, 0, 0, S_ELEMF4 }, // S_ELEMF3 @@ -2152,6 +2155,9 @@ state_t states[NUMSTATES] = {SPR_FIRS, FF_FULLBRIGHT|FF_TRANS40|7, 2, {NULL}, 0, 0, S_FIRS9}, // S_FIRS8 {SPR_FIRS, FF_FULLBRIGHT|FF_TRANS40|8, 2, {NULL}, 0, 0, S_FIRS1}, // S_FIRS9 + {SPR_FIRS, FF_FULLBRIGHT|FF_TRANS40|18, 1, {NULL}, 0, 0, S_FIRS11}, // S_FIRS10 + {SPR_NULL, 0, 1, {NULL}, 0, 0, S_FIRS1 }, // S_FIRS11 + {SPR_FIRS, FF_FULLBRIGHT|FF_TRANS40| 9, 2, {NULL}, 0, 0, S_FIRSB2}, // S_FIRSB1 {SPR_FIRS, FF_FULLBRIGHT|FF_TRANS40|10, 2, {NULL}, 0, 0, S_FIRSB3}, // S_FIRSB2 {SPR_FIRS, FF_FULLBRIGHT|FF_TRANS40|11, 2, {NULL}, 0, 0, S_FIRSB4}, // S_FIRSB3 @@ -2162,6 +2168,8 @@ state_t states[NUMSTATES] = {SPR_FIRS, FF_FULLBRIGHT|FF_TRANS40|16, 2, {NULL}, 0, 0, S_FIRSB9}, // S_FIRSB8 {SPR_FIRS, FF_FULLBRIGHT|FF_TRANS40|17, 2, {NULL}, 0, 0, S_FIRSB1}, // S_FIRSB9 + {SPR_NULL, 0, 2, {NULL}, 0, 0, S_FIRSB1 }, // S_FIRSB10 + {SPR_BUBS, FF_TRANS30 , 3, {NULL}, 0, 0, S_BUBS2}, // S_BUBS1 {SPR_BUBS, FF_TRANS30|1, 3, {NULL}, 0, 0, S_BUBS3}, // S_BUBS2 {SPR_BUBS, FF_TRANS30|2, 3, {NULL}, 0, 0, S_BUBS4}, // S_BUBS3 @@ -10697,7 +10705,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = sfx_None, // seesound 0, // reactiontime sfx_None, // attacksound - S_NULL, // painstate + S_ELEM13, // painstate SKINCOLOR_NONE, // painchance sfx_None, // painsound S_NULL, // meleestate @@ -10859,7 +10867,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = sfx_None, // seesound 8, // reactiontime sfx_None, // attacksound - S_NULL, // painstate + S_FIRSB10, // painstate SKINCOLOR_NONE, // painchance sfx_None, // painsound S_NULL, // meleestate @@ -10875,7 +10883,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = 0, // damage sfx_None, // activesound MF_NOBLOCKMAP|MF_NOCLIP|MF_NOCLIPHEIGHT|MF_NOGRAVITY|MF_SCENERY, // flags - S_NULL // raisestate + S_FIRS10 // raisestate }, { // MT_BUBBLEWRAP_ORB diff --git a/src/info.h b/src/info.h index 914d04d16..b9dc034bf 100644 --- a/src/info.h +++ b/src/info.h @@ -2304,6 +2304,9 @@ typedef enum state S_ELEM11, S_ELEM12, + S_ELEM13, + S_ELEM14, + S_ELEMF1, S_ELEMF2, S_ELEMF3, @@ -2336,6 +2339,9 @@ typedef enum state S_FIRS8, S_FIRS9, + S_FIRS10, + S_FIRS11, + S_FIRSB1, S_FIRSB2, S_FIRSB3, @@ -2346,6 +2352,8 @@ typedef enum state S_FIRSB8, S_FIRSB9, + S_FIRSB10, + S_BUBS1, S_BUBS2, S_BUBS3, diff --git a/src/p_mobj.c b/src/p_mobj.c index ecf0133f1..e49c3e797 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -6392,7 +6392,7 @@ static boolean P_ShieldLook(mobj_t *thing, shieldtype_t shield) // TODO: Make an MT_SHIELDORB which changes color/states to always match the appropriate shield, // instead of having completely seperate mobjtypes. - if (shield != SH_FORCE) + if (!(shield & SH_FORCE)) { // Regular shields check for themselves only if ((shieldtype_t)(thing->target->player->powers[pw_shield] & SH_NOSTACK) != shield) { @@ -6406,7 +6406,7 @@ static boolean P_ShieldLook(mobj_t *thing, shieldtype_t shield) return false; } - if (shield == SH_FORCE && thing->movecount != (thing->target->player->powers[pw_shield] & SH_FORCEHP)) + if (shield & SH_FORCE && thing->movecount != (thing->target->player->powers[pw_shield] & SH_FORCEHP)) { thing->movecount = (thing->target->player->powers[pw_shield] & SH_FORCEHP); if (thing->movecount < 1) @@ -6458,7 +6458,7 @@ void P_RunShields(void) // run shields for (i = 0; i < numshields; i++) { - P_ShieldLook(shields[i], shields[i]->info->speed); + P_ShieldLook(shields[i], shields[i]->threshold); P_SetTarget(&shields[i], NULL); } numshields = 0; @@ -6466,7 +6466,7 @@ void P_RunShields(void) static boolean P_AddShield(mobj_t *thing) { - shieldtype_t shield = thing->info->speed; + shieldtype_t shield = thing->threshold; if (!thing->target || thing->target->health <= 0 || !thing->target->player || (thing->target->player->powers[pw_shield] & SH_NOSTACK) == SH_NONE || thing->target->player->powers[pw_super] @@ -6476,7 +6476,7 @@ static boolean P_AddShield(mobj_t *thing) return false; } - if (shield != SH_FORCE) + if (!(shield & SH_FORCE)) { // Regular shields check for themselves only if ((shieldtype_t)(thing->target->player->powers[pw_shield] & SH_NOSTACK) != shield) { @@ -6743,6 +6743,11 @@ void P_MobjThinker(mobj_t *mobj) if (P_MobjWasRemoved(mobj)) return; #endif + + if (mobj->flags2 & MF2_SHIELD) + if (!P_AddShield(mobj)) + return; + switch (mobj->type) { case MT_HOOP: @@ -6802,12 +6807,11 @@ void P_MobjThinker(mobj_t *mobj) case MT_PITY_ORB: case MT_WHIRLWIND_ORB: case MT_ARMAGEDDON_ORB: - case MT_FLAMEAURA_ORB: - if (!P_AddShield(mobj)) + if (!(mobj->flags2 & MF2_SHIELD)) return; break; case MT_ATTRACT_ORB: - if (!P_AddShield(mobj)) + if (!(mobj->flags2 & MF2_SHIELD)) return; if (/*(mobj->target) -- the following is implicit by P_AddShield && (mobj->target->player) @@ -6818,7 +6822,7 @@ void P_MobjThinker(mobj_t *mobj) } break; case MT_ELEMENTAL_ORB: - if (!P_AddShield(mobj)) + if (!(mobj->flags2 & MF2_SHIELD)) return; if (mobj->tracer /* && mobj->target -- the following is implicit by P_AddShield @@ -6828,12 +6832,14 @@ void P_MobjThinker(mobj_t *mobj) && ((statenum_t)(mobj->tracer->state-states) < mobj->info->raisestate || (mobj->tracer->state->nextstate < mobj->info->raisestate && mobj->tracer->tics == 1))) { + P_SetMobjState(mobj, mobj->info->painstate); + mobj->tics++; P_SetMobjState(mobj->tracer, mobj->info->raisestate); mobj->tracer->tics++; } break; case MT_FORCE_ORB: - if (!P_AddShield(mobj)) + if (!(mobj->flags2 & MF2_SHIELD)) return; if (/* && mobj->target -- the following is implicit by P_AddShield @@ -6849,8 +6855,26 @@ void P_MobjThinker(mobj_t *mobj) whoosh->height = 42*FRACUNIT; mobj->target->player->pflags &= ~PF_SHIELDABILITY; // prevent eternal whoosh } + case MT_FLAMEAURA_ORB: + if (!(mobj->flags2 & MF2_SHIELD)) + return; + mobj->angle = mobj->target->angle; // implicitly okay because of P_AddShield + if (mobj->tracer + /* && mobj->target -- the following is implicit by P_AddShield + && mobj->target->player + && (mobj->target->player->powers[pw_shield] & SH_NOSTACK) == SH_FLAMEAURA */ + && mobj->target->player->pflags & PF_SHIELDABILITY + && ((statenum_t)(mobj->tracer->state-states) < mobj->info->raisestate + || (mobj->tracer->state->nextstate < mobj->info->raisestate && mobj->tracer->tics == 1))) + { + P_SetMobjState(mobj, mobj->info->painstate); + mobj->tics++; + P_SetMobjState(mobj->tracer, mobj->info->raisestate); + mobj->tracer->tics++; + } + break; case MT_BUBBLEWRAP_ORB: - if (!P_AddShield(mobj)) + if (!(mobj->flags2 & MF2_SHIELD)) return; if (mobj->tracer /* && mobj->target -- the following is implicit by P_AddShield @@ -6878,7 +6902,7 @@ void P_MobjThinker(mobj_t *mobj) } break; case MT_THUNDERCOIN_ORB: - if (!P_AddShield(mobj)) + if (!(mobj->flags2 & MF2_SHIELD)) return; if (mobj->tracer /* && mobj->target -- the following is implicit by P_AddShield diff --git a/src/p_mobj.h b/src/p_mobj.h index 69e0e11aa..40d5a732e 100644 --- a/src/p_mobj.h +++ b/src/p_mobj.h @@ -193,6 +193,7 @@ typedef enum MF2_BOSSDEAD = 1<<26, // Boss is dead! (Not necessarily fleeing, if a fleeing point doesn't exist.) MF2_AMBUSH = 1<<27, // Alternate behaviour typically set by MTF_AMBUSH MF2_LINKDRAW = 1<<28, // Draw vissprite of mobj immediately before/after tracer's vissprite (dependent on dispoffset and position) + MF2_SHIELD = 1<<29, // Thinker calls P_AddShield/P_ShieldLook (must be partnered with MF_SCENERY to use) // free: to and including 1<<31 } mobjflag2_t; diff --git a/src/p_user.c b/src/p_user.c index 8cb1b7607..c5490abe0 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -1395,8 +1395,10 @@ void P_SpawnShieldOrb(player_t *player) } shieldobj = P_SpawnMobj(player->mo->x, player->mo->y, player->mo->z, orbtype); + shieldobj->flags2 |= MF2_SHIELD; P_SetTarget(&shieldobj->target, player->mo); shieldobj->color = (UINT8)shieldobj->info->painchance; + shieldobj->threshold = (player->powers[pw_shield] & SH_FORCE) ? SH_FORCE : (player->powers[pw_shield] & SH_NOSTACK); if (shieldobj->info->seestate) { From a5a6ceff7149b1b768e868d4ec3b391fe8aba592 Mon Sep 17 00:00:00 2001 From: toasterbabe Date: Sun, 23 Oct 2016 22:21:42 +0100 Subject: [PATCH 082/172] More thorough Mario soundification for new shield sounds. --- src/s_sound.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/s_sound.c b/src/s_sound.c index 47a955561..971961897 100644 --- a/src/s_sound.c +++ b/src/s_sound.c @@ -607,6 +607,13 @@ void S_StartSound(const void *origin, sfxenum_t sfx_id) sfx_id = sfx_mario6; break; case sfx_shield: + case sfx_wirlsg: + case sfx_forcsg: + case sfx_elemsg: + case sfx_armasg: + case sfx_s3k3e: + case sfx_s3k3f: + case sfx_s3k41: sfx_id = sfx_mario3; break; case sfx_itemup: From 3ce411b62a7a3df42a95dcf71d6a20291b1107cb Mon Sep 17 00:00:00 2001 From: toasterbabe Date: Mon, 24 Oct 2016 12:35:40 +0100 Subject: [PATCH 083/172] Mario mode is boring again. (I'm going to revert this commit as soon as possible, but shield_actions needs to be clean of Mario stuff for now.) --- src/d_player.h | 6 ++-- src/dehacked.c | 3 +- src/g_game.c | 3 -- src/p_enemy.c | 59 +++++++++++++++------------------ src/p_inter.c | 89 +++++++++++++------------------------------------- src/p_local.h | 9 ++--- src/p_mobj.c | 35 ++------------------ src/p_user.c | 61 +++++----------------------------- src/r_things.c | 13 +------- 9 files changed, 66 insertions(+), 212 deletions(-) diff --git a/src/d_player.h b/src/d_player.h index 4f3e37e59..13729eebe 100644 --- a/src/d_player.h +++ b/src/d_player.h @@ -194,7 +194,6 @@ typedef enum SH_PITY = 1, // the world's most basic shield ever, given to players who suck at Match SH_WHIRLWIND, SH_ARMAGEDDON, - SH_FIREFLOWER, // normal shields that use flags SH_ATTRACT = SH_PROTECTELECTRIC, @@ -210,9 +209,9 @@ typedef enum SH_FORCEHP = 0xFF, // to be used as a bitmask only // Mostly for use with Mario mode. - SH_MUSHROOM = 0x200, + SH_FIREFLOWER = 0x200, - SH_STACK = SH_MUSHROOM, // second-layer shields + SH_STACK = SH_FIREFLOWER, // second-layer shields SH_NOSTACK = ~SH_STACK } shieldtype_t; // pw_shield @@ -241,7 +240,6 @@ typedef enum pw_underwater, // underwater timer pw_spacetime, // In space, no one can hear you spin! pw_extralife, // Extra Life timer - pw_marioflashing, // Getting/losing powerup pw_super, // Are you super? pw_gravityboots, // gravity boots diff --git a/src/dehacked.c b/src/dehacked.c index 224b4393d..7667ead82 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -7126,7 +7126,6 @@ struct { {"SH_PITY",SH_PITY}, {"SH_WHIRLWIND",SH_WHIRLWIND}, {"SH_ARMAGEDDON",SH_ARMAGEDDON}, - {"SH_FIREFLOWER",SH_FIREFLOWER}, // normal shields that use flags {"SH_ATTRACT",SH_ATTRACT}, {"SH_ELEMENTAL",SH_ELEMENTAL}, @@ -7138,7 +7137,7 @@ struct { {"SH_FORCE",SH_FORCE}, {"SH_FORCEHP",SH_FORCEHP}, // to be used as a bitmask only // Mostly for use with Mario mode. - {"SH_MUSHROOM", SH_MUSHROOM}, + {"SH_FIREFLOWER", SH_FIREFLOWER}, {"SH_STACK",SH_STACK}, {"SH_NOSTACK",SH_NOSTACK}, diff --git a/src/g_game.c b/src/g_game.c index 200a0f45b..5e45921b7 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -2196,9 +2196,6 @@ void G_PlayerReborn(INT32 player) p->health = 1; // 0 rings p->panim = PA_IDLE; // standing animation - if (mariomode) - p->powers[pw_shield] = SH_MUSHROOM; // start big - if ((netgame || multiplayer) && !p->spectator) p->powers[pw_flashing] = flashingtics-1; // Babysitting deterrent diff --git a/src/p_enemy.c b/src/p_enemy.c index 7212bd8c8..fb0e41903 100644 --- a/src/p_enemy.c +++ b/src/p_enemy.c @@ -3061,10 +3061,9 @@ void A_JumpShield(mobj_t *actor) player = actor->target->player; - if (P_SwitchShield(player, SH_WHIRLWIND)) - S_StartSound(player->mo, actor->info->seesound); - else - S_StartSound(player->mo, sfx_itemup); + P_SwitchShield(player, SH_WHIRLWIND); + + S_StartSound(player->mo, actor->info->seesound); } // Function: A_RingShield @@ -3090,10 +3089,9 @@ void A_RingShield(mobj_t *actor) player = actor->target->player; - if (P_SwitchShield(player, SH_ATTRACT)) - S_StartSound(player->mo, actor->info->seesound); - else - S_StartSound(player->mo, sfx_itemup); + P_SwitchShield(player, SH_ATTRACT); + + S_StartSound(player->mo, actor->info->seesound); } // Function: A_RingBox @@ -3293,7 +3291,8 @@ void A_BombShield(mobj_t *actor) P_BlackOw(player); // Now we know for certain that we don't have a bomb shield, so add one. :3 - P_SwitchShield(player, SH_ARMAGEDDON); // will never return false, so no need for sound test + P_SwitchShield(player, SH_ARMAGEDDON); + S_StartSound(player->mo, actor->info->seesound); } @@ -3320,10 +3319,9 @@ void A_WaterShield(mobj_t *actor) player = actor->target->player; - if (P_SwitchShield(player, SH_ELEMENTAL)) - S_StartSound(player->mo, actor->info->seesound); - else - S_StartSound(player->mo, sfx_itemup); + P_SwitchShield(player, SH_ELEMENTAL); + + S_StartSound(player->mo, actor->info->seesound); } // Function: A_ForceShield @@ -3356,10 +3354,9 @@ void A_ForceShield(mobj_t *actor) player = actor->target->player; - if (P_SwitchShield(player, SH_FORCE|locvar1)) - S_StartSound(player->mo, actor->info->seesound); - else - S_StartSound(player->mo, sfx_itemup); + P_SwitchShield(player, SH_FORCE|locvar1); + + S_StartSound(player->mo, actor->info->seesound); } // Function: A_PityShield @@ -3389,10 +3386,9 @@ void A_PityShield(mobj_t *actor) player = actor->target->player; - if (P_SwitchShield(player, SH_PITY)) - S_StartSound(player->mo, actor->info->seesound); - else - S_StartSound(player->mo, sfx_itemup); + P_SwitchShield(player, SH_PITY); + + S_StartSound(player->mo, actor->info->seesound); } // Function: A_FlameShield @@ -3418,10 +3414,9 @@ void A_FlameShield(mobj_t *actor) player = actor->target->player; - if (P_SwitchShield(player, SH_FLAMEAURA)) - S_StartSound(player->mo, actor->info->seesound); - else - S_StartSound(player->mo, sfx_itemup); + P_SwitchShield(player, SH_FLAMEAURA); + + S_StartSound(player->mo, actor->info->seesound); } // Function: A_BubbleShield @@ -3447,10 +3442,9 @@ void A_BubbleShield(mobj_t *actor) player = actor->target->player; - if (P_SwitchShield(player, SH_BUBBLEWRAP)) - S_StartSound(player->mo, actor->info->seesound); - else - S_StartSound(player->mo, sfx_itemup); + P_SwitchShield(player, SH_BUBBLEWRAP); + + S_StartSound(player->mo, actor->info->seesound); } // Function: A_ThunderShield @@ -3476,10 +3470,9 @@ void A_ThunderShield(mobj_t *actor) player = actor->target->player; - if (P_SwitchShield(player, SH_THUNDERCOIN)) - S_StartSound(player->mo, actor->info->seesound); - else - S_StartSound(player->mo, sfx_itemup); + P_SwitchShield(player, SH_THUNDERCOIN); + + S_StartSound(player->mo, actor->info->seesound); } diff --git a/src/p_inter.c b/src/p_inter.c index 4bf600c51..d038677db 100644 --- a/src/p_inter.c +++ b/src/p_inter.c @@ -1141,27 +1141,16 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck) case MT_FIREFLOWER: if (player->bot) return; - { - mobj_t *scoremobj = P_SpawnMobj(toucher->x, toucher->y, toucher->z + (toucher->height / 2), MT_SCORE); - P_SetMobjState(scoremobj, mobjinfo[MT_SCORE].spawnstate+3); // 1000 - P_AddPlayerScore(player, 1000); - } - if ((player->powers[pw_shield] & SH_NOSTACK) == SH_FIREFLOWER) - { - S_StartSound(toucher, sfx_itemup); - break; - } - else - S_StartSound(toucher, sfx_mario3); + S_StartSound(toucher, sfx_mario3); - if (mariomode) + player->powers[pw_shield] = (player->powers[pw_shield] & SH_NOSTACK)|SH_FIREFLOWER; + + if (!(player->powers[pw_super] || (mariomode && player->powers[pw_invulnerability]))) { - toucher->movecount = player->powers[pw_shield]; - player->powers[pw_marioflashing] = MARIOFLASHINGTICS; + player->mo->color = SKINCOLOR_WHITE; + G_GhostAddColor(GHC_FIREFLOWER); } - player->powers[pw_shield] = (mariomode ? SH_MUSHROOM : player->powers[pw_shield] & SH_STACK)|SH_FIREFLOWER; - P_SpawnShieldOrb(player); break; @@ -1226,21 +1215,6 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck) S_StartSound(toucher, special->info->painsound); - if (mariomode) - { - mobj_t *scoremobj = P_SpawnMobj(toucher->x, toucher->y, toucher->z + (toucher->height / 2), MT_SCORE); - P_SetMobjState(scoremobj, mobjinfo[MT_SCORE].spawnstate+7); // 2000 - P_AddPlayerScore(player, 2000); - if (!player->powers[pw_shield]) - { - S_StartSound(toucher, sfx_mario3); - player->mo->movecount = player->powers[pw_shield]; - player->powers[pw_marioflashing] = MARIOFLASHINGTICS; - player->powers[pw_shield] = SH_MUSHROOM; - P_SpawnShieldOrb(player); - } - } - if (!(netgame && circuitmap && player != &players[consoleplayer])) P_SetMobjState(special, special->info->painstate); return; @@ -2300,14 +2274,9 @@ void P_KillMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, UINT8 damaget case MT_PLAYER: { - boolean mariodeathpit = (mariomode && damagetype == DMG_DEATHPIT); target->fuse = TICRATE*3; // timer before mobj disappears from view (even if not an actual player) - if (!mariodeathpit) - { - if (mariomode) - target->player->powers[pw_marioflashing] = MARIOFLASHINGTICS; - target->momx = target->momy = target->momz = 0; - } + target->momx = target->momy = target->momz = 0; + if (damagetype == DMG_DROWNED) // drowned { target->movedir = damagetype; // we're MOVING the Damage Into anotheR function... Okay, this is a bit of a hack. @@ -2319,8 +2288,7 @@ void P_KillMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, UINT8 damaget } else { - if (!mariodeathpit) - P_SetObjectMomZ(target, 14*FRACUNIT, false); + P_SetObjectMomZ(target, 14*FRACUNIT, false); if ((source && source->type == MT_SPIKE) || damagetype == DMG_SPIKE) // Spikes S_StartSound(target, sfx_spkdth); else @@ -2680,11 +2648,8 @@ static void P_KillPlayer(player_t *player, mobj_t *source, INT32 damage) if (source && (gametype == GT_MATCH || gametype == GT_TEAMMATCH || gametype == GT_CTF)) P_PlayerRingBurst(player, player->health - 1); - if (!mariomode) // Get rid of shield - { - player->powers[pw_shield] = SH_NONE; - player->mo->color = player->skincolor; - } + player->powers[pw_shield] = SH_NONE; + player->mo->color = player->skincolor; // Get rid of emeralds player->powers[pw_emeralds] = 0; @@ -2780,16 +2745,20 @@ static inline void P_SuperDamage(player_t *player, mobj_t *inflictor, mobj_t *so void P_RemoveShield(player_t *player) { - boolean fireflower = ((player->powers[pw_shield] & SH_NOSTACK) == SH_FIREFLOWER); if (player->powers[pw_shield] & SH_FORCE) { // Multi-hit - if ((player->powers[pw_shield] & SH_FORCEHP) == 0) - player->powers[pw_shield] &= SH_STACK; - else + if (player->powers[pw_shield] & SH_FORCEHP) player->powers[pw_shield]--; + else + player->powers[pw_shield] &= SH_STACK; } else if ((player->powers[pw_shield] & SH_NOSTACK) == SH_NONE) { // Second layer shields + if (((player->powers[pw_shield] & SH_STACK) == SH_FIREFLOWER) && !(player->powers[pw_super] || (mariomode && player->powers[pw_invulnerability]))) + { + player->mo->color = player->skincolor; + G_GhostAddColor(GHC_NORMAL); + } player->powers[pw_shield] = SH_NONE; } else if ((player->powers[pw_shield] & SH_NOSTACK) == SH_ARMAGEDDON) // Give them what's coming to them! @@ -2799,11 +2768,6 @@ void P_RemoveShield(player_t *player) } else player->powers[pw_shield] = player->powers[pw_shield] & SH_STACK; - if (fireflower && !(player->powers[pw_super] || (mariomode && player->powers[pw_invulnerability]))) - { - player->mo->color = player->skincolor; - G_GhostAddColor(GHC_NORMAL); - } } static void P_ShieldDamage(player_t *player, mobj_t *inflictor, mobj_t *source, INT32 damage) @@ -2815,14 +2779,7 @@ static void P_ShieldDamage(player_t *player, mobj_t *inflictor, mobj_t *source, P_ForceFeed(player, 40, 10, TICRATE, 40 + min(damage, 100)*2); - if (mariomode) - { - S_StartSound(player->mo, sfx_mario8); - // Burst weapons and emeralds in Match/CTF only - if (!player->powers[pw_shield] && (gametype == GT_MATCH || gametype == GT_TEAMMATCH || gametype == GT_CTF)) - P_PlayerRingBurst(player, 0); - } - else if (source && (source->type == MT_SPIKE || (source->type == MT_NULL && source->threshold == 43))) // spikes + if (source && (source->type == MT_SPIKE || (source->type == MT_NULL && source->threshold == 43))) // spikes S_StartSound(player->mo, sfx_spkdth); else S_StartSound (player->mo, sfx_shldls); // Ba-Dum! Shield loss. @@ -3133,7 +3090,7 @@ boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 da P_ShieldDamage(player, inflictor, source, damage); damage = 0; } - else if (!mariomode && player->mo->health > 1) // No shield but have rings. + else if (player->mo->health > 1) // No shield but have rings. { damage = player->mo->health - 1; P_RingDamage(player, inflictor, source, damage, damagetype); @@ -3295,11 +3252,11 @@ void P_PlayerRingBurst(player_t *player, INT32 num_rings) // Spill the ammo P_PlayerWeaponAmmoBurst(player); - if (mariomode) return; - for (i = 0; i < num_rings; i++) { INT32 objType = mobjinfo[MT_RING].reactiontime; + if (mariomode) + objType = mobjinfo[MT_COIN].reactiontime; z = player->mo->z; if (player->mo->eflags & MFE_VERTICALFLIP) diff --git a/src/p_local.h b/src/p_local.h index 7107432ef..ee61d3389 100644 --- a/src/p_local.h +++ b/src/p_local.h @@ -62,12 +62,9 @@ #define twodlevel (maptol & TOL_2D) #define mariomode (maptol & TOL_MARIO) -#define shortmario(player) ((player && mariomode && !player->powers[pw_shield]) ? 1 : 0) -#define MARIOFLASHINGTICS 21 - -#define P_GetPlayerHeight(player) (FixedMul(player->height, player->mo->scale) >> shortmario(player)) -#define P_GetPlayerSpinHeight(player) (FixedMul(player->spinheight, player->mo->scale) >> shortmario(player)) +#define P_GetPlayerHeight(player) FixedMul(player->height, player->mo->scale) +#define P_GetPlayerSpinHeight(player) FixedMul(player->spinheight, player->mo->scale) // // P_TICK @@ -146,7 +143,7 @@ boolean P_InQuicksand(mobj_t *mo); void P_SetObjectMomZ(mobj_t *mo, fixed_t value, boolean relative); void P_RestoreMusic(player_t *player); void P_SpawnShieldOrb(player_t *player); -boolean P_SwitchShield(player_t *player, UINT16 shieldtype); +void P_SwitchShield(player_t *player, UINT16 shieldtype); mobj_t *P_SpawnGhostMobj(mobj_t *mobj); void P_GivePlayerRings(player_t *player, INT32 num_rings); void P_GivePlayerLives(player_t *player, INT32 numlives); diff --git a/src/p_mobj.c b/src/p_mobj.c index e49c3e797..c94587ab4 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -4088,32 +4088,6 @@ static void P_PlayerMobjThinker(mobj_t *mobj) I_Assert(mobj->player != NULL); I_Assert(!P_MobjWasRemoved(mobj)); - if (mobj->player->powers[pw_marioflashing]) - { - if (!mobj->player->powers[pw_nocontrol]++) - mobj->player->powers[pw_nocontrol]++; - - if (!(--mobj->player->powers[pw_marioflashing] % 4)) - { - UINT16 shieldswitch = mobj->player->powers[pw_shield]; - mobj->player->powers[pw_shield] = mobj->movecount; - mobj->movecount = shieldswitch; - if (mobj->player->powers[pw_shield] & SH_NOSTACK && (mobj->player->powers[pw_shield] & SH_NOSTACK) != (mobj->movecount & SH_NOSTACK)) - P_SpawnShieldOrb(mobj->player); - if ((mobj->player->powers[pw_shield] & SH_NOSTACK) != SH_FIREFLOWER && (mobj->movecount & SH_NOSTACK) == SH_FIREFLOWER - && !(mobj->player->powers[pw_super] || (mariomode && mobj->player->powers[pw_invulnerability]))) - { - mobj->color = mobj->player->skincolor; - G_GhostAddColor(GHC_NORMAL); - } - } - - if (mobj->player->powers[pw_flashing] && mobj->player->powers[pw_flashing] < UINT16_MAX && mobj->player->powers[pw_flashing] > flashingtics) - if (--(mobj->player->powers[pw_flashing]) == flashingtics) - mobj->player->powers[pw_flashing]--; - return; - } - P_MobjCheckWater(mobj); #ifdef ESLOPE @@ -6433,9 +6407,9 @@ static boolean P_ShieldLook(mobj_t *thing, shieldtype_t shield) thing->x = thing->target->x; thing->y = thing->target->y; if (thing->eflags & MFE_VERTICALFLIP) - thing->z = thing->target->z + ((thing->target->height - thing->height + FixedDiv(P_GetPlayerHeight(thing->target->player) - thing->target->height, 3*FRACUNIT)) << shortmario(thing->target->player)) - FixedMul(2*FRACUNIT, thing->target->scale); + thing->z = thing->target->z + (thing->target->height - thing->height + FixedDiv(P_GetPlayerHeight(thing->target->player) - thing->target->height, 3*FRACUNIT)) - FixedMul(2*FRACUNIT, thing->target->scale); else - thing->z = thing->target->z - ((FixedDiv(P_GetPlayerHeight(thing->target->player) - thing->target->height, 3*FRACUNIT)) << shortmario(thing->target->player)) + FixedMul(2*FRACUNIT, thing->target->scale); + thing->z = thing->target->z - (FixedDiv(P_GetPlayerHeight(thing->target->player) - thing->target->height, 3*FRACUNIT)) + FixedMul(2*FRACUNIT, thing->target->scale); P_SetThingPosition(thing); P_CheckPosition(thing, thing->x, thing->y); @@ -7240,11 +7214,6 @@ void P_MobjThinker(mobj_t *mobj) break; case MT_PLAYER: /// \todo Have the player's dead body completely finish its animation even if they've already respawned. - if (mobj->player && mobj->player->powers[pw_marioflashing]) - { - mobj->player->powers[pw_marioflashing]--; - return; // don't do any momz - } if (!(mobj->flags2 & MF2_DONTDRAW)) { if (!mobj->fuse) diff --git a/src/p_user.c b/src/p_user.c index c5490abe0..3754623de 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -793,7 +793,6 @@ void P_DoPlayerPain(player_t *player, mobj_t *source, mobj_t *inflictor) if (player->powers[pw_carry] == CR_ROPEHANG) P_SetTarget(&player->mo->tracer, NULL); - if (!mariomode) { angle_t ang; fixed_t fallbackspeed; @@ -860,12 +859,6 @@ void P_DoPlayerPain(player_t *player, mobj_t *source, mobj_t *inflictor) } player->powers[pw_flashing] = flashingtics; - if (mariomode) - { - player->powers[pw_marioflashing] = MARIOFLASHINGTICS; - player->powers[pw_flashing] += MARIOFLASHINGTICS; - player->mo->movecount = player->powers[pw_shield]; - } if (player->timeshit != UINT8_MAX) ++player->timeshit; @@ -928,7 +921,7 @@ void P_GivePlayerRings(player_t *player, INT32 num_rings) { INT32 gainlives = 0; - while ((mariomode || player->xtralife < maxXtraLife) && player->health > 100 * (player->xtralife+1)) + while (player->xtralife < maxXtraLife && player->health > 100 * (player->xtralife+1)) { ++gainlives; ++player->xtralife; @@ -940,13 +933,6 @@ void P_GivePlayerRings(player_t *player, INT32 num_rings) P_PlayLivesJingle(player); } } - - if (mariomode && player->health > 100 && !G_RingSlingerGametype() && !G_TagGametype()) - { - player->mo->health = 1 + (player->health - 1) % 100; - player->health = player->mo->health; - player->xtralife = 0; - } } // @@ -1371,13 +1357,6 @@ void P_SpawnShieldOrb(player_t *player) case SH_THUNDERCOIN: orbtype = MT_THUNDERCOIN_ORB; break; - case SH_FIREFLOWER: - if (!(player->powers[pw_super] || (mariomode && player->powers[pw_invulnerability]))) - { - player->mo->color = SKINCOLOR_WHITE; - G_GhostAddColor(GHC_FIREFLOWER); - } - return; default: return; } @@ -1440,33 +1419,18 @@ void P_SpawnShieldOrb(player_t *player) // the non-stack layer of shields thoroughly, // then adds the desired one. // -// Returns whether to play a normal sound or an itemup. -// -boolean P_SwitchShield(player_t *player, UINT16 shieldtype) +void P_SwitchShield(player_t *player, UINT16 shieldtype) { boolean donthavealready = (shieldtype & SH_FORCE) ? (!(player->powers[pw_shield] & SH_FORCE) || (player->powers[pw_shield] & SH_FORCEHP) < (shieldtype & ~SH_FORCE)) : ((player->powers[pw_shield] & SH_NOSTACK) != shieldtype); - if (mariomode) - { - mobj_t *scoremobj = P_SpawnMobj(player->mo->x, player->mo->y, player->mo->z + (player->mo->height / 2), MT_SCORE); - P_SetMobjState(scoremobj, mobjinfo[MT_SCORE].spawnstate+3); // 1000 - P_AddPlayerScore(player, 1000); - } - if (donthavealready) { boolean stopshieldability = (shieldtype & SH_FORCE) ? (!(player->powers[pw_shield] & SH_FORCE)) : true; - if (mariomode) - { - player->mo->movecount = player->powers[pw_shield]; - player->powers[pw_marioflashing] = MARIOFLASHINGTICS; - } - // Just in case. if (stopshieldability && player->pflags & PF_SHIELDABILITY) { @@ -1474,14 +1438,7 @@ boolean P_SwitchShield(player_t *player, UINT16 shieldtype) player->homing = 0; } - if ((player->powers[pw_shield] & SH_NOSTACK) == SH_FIREFLOWER // it's implicit that the new shield isn't a fireflower - && !(player->powers[pw_super] || (mariomode && player->powers[pw_invulnerability]))) - { - player->mo->color = player->skincolor; - G_GhostAddColor(GHC_NORMAL); - } - - player->powers[pw_shield] = shieldtype|(mariomode ? SH_MUSHROOM : player->powers[pw_shield] & SH_STACK); + player->powers[pw_shield] = shieldtype|(player->powers[pw_shield] & SH_STACK); P_SpawnShieldOrb(player); if (shieldtype & SH_PROTECTWATER) @@ -1497,9 +1454,7 @@ boolean P_SwitchShield(player_t *player, UINT16 shieldtype) P_RestoreMusic(player); } } - return true; } - return (!mariomode); } // @@ -2203,7 +2158,7 @@ static void P_CheckInvincibilityTimer(player_t *player) { if (mariomode) { - if ((player->powers[pw_shield] & SH_NOSTACK) == SH_FIREFLOWER) + if ((player->powers[pw_shield] & SH_STACK) == SH_FIREFLOWER) { player->mo->color = SKINCOLOR_WHITE; G_GhostAddColor(GHC_FIREFLOWER); @@ -3227,7 +3182,7 @@ static void P_DoFiring(player_t *player, ticcmd_t *cmd) if (cmd->buttons & BT_ATTACK || cmd->buttons & BT_FIRENORMAL) { - if (!(player->pflags & PF_ATTACKDOWN) && (player->powers[pw_shield] & SH_NOSTACK) == SH_FIREFLOWER && !player->climbing) + if (!(player->pflags & PF_ATTACKDOWN) && (player->powers[pw_shield] & SH_STACK) == SH_FIREFLOWER && !player->climbing) { player->pflags |= PF_ATTACKDOWN; P_SpawnPlayerMissile(player->mo, MT_FIREBALL, 0); @@ -8594,9 +8549,9 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall dist = FixedHypot(f1, f2); if (mo->eflags & MFE_VERTICALFLIP) - angle = R_PointToAngle2(0, thiscam->z + thiscam->height, dist, mo->z + mo->height - (P_GetPlayerHeight(player) << shortmario(player))); + angle = R_PointToAngle2(0, thiscam->z + thiscam->height, dist, mo->z + mo->height - P_GetPlayerHeight(player)); else - angle = R_PointToAngle2(0, thiscam->z, dist, mo->z + (P_GetPlayerHeight(player) << shortmario(player))); + angle = R_PointToAngle2(0, thiscam->z, dist, mo->z + P_GetPlayerHeight(player)); if (player->playerstate != PST_DEAD) angle += (focusaiming < ANGLE_180 ? focusaiming/2 : InvAngle(InvAngle(focusaiming)/2)); // overcomplicated version of '((signed)focusaiming)/2;' @@ -9335,7 +9290,7 @@ void P_PlayerThink(player_t *player) player->losstime--; // Flash player after being hit. - if (player->powers[pw_flashing] > 0 && player->powers[pw_flashing] < flashingtics && (leveltime & 1) && !player->powers[pw_marioflashing]) + if (player->powers[pw_flashing] > 0 && player->powers[pw_flashing] < flashingtics && (leveltime & 1)) player->mo->flags2 |= MF2_DONTDRAW; else player->mo->flags2 &= ~MF2_DONTDRAW; diff --git a/src/r_things.c b/src/r_things.c index eb1a3cb25..e8aa2956f 100644 --- a/src/r_things.c +++ b/src/r_things.c @@ -1128,8 +1128,6 @@ static void R_ProjectSprite(mobj_t *thing) fixed_t offset, offset2; boolean papersprite = !!(thing->frame & FF_PAPERSPRITE); - fixed_t shortmarioshift = (objectplacing ? 0 : shortmario(thing->player)); - INT32 dispoffset = thing->info->dispoffset; //SoM: 3/17/2000 @@ -1364,12 +1362,6 @@ static void R_ProjectSprite(mobj_t *thing) return; } - if (shortmarioshift) // squish mario - { - yscale >>= shortmarioshift; - this_scale >>= shortmarioshift; - } - //SoM: 3/17/2000: Disregard sprites that are out of view.. if (vflip) { @@ -1385,9 +1377,6 @@ static void R_ProjectSprite(mobj_t *thing) gz = gzt - FixedMul(spritecachedinfo[lump].height, this_scale); } - if (shortmarioshift) // unsquish the x component - this_scale <<= shortmarioshift; - if (thing->subsector->sector->cullheight) { if (R_DoCulling(thing->subsector->sector->cullheight, viewsector->cullheight, viewz, gz, gzt)) @@ -1453,7 +1442,7 @@ static void R_ProjectSprite(mobj_t *thing) vis->thingheight = thing->height; vis->pz = thing->z; vis->pzt = vis->pz + vis->thingheight; - vis->texturemid = (vis->gzt - viewz) << shortmarioshift; + vis->texturemid = vis->gzt - viewz; vis->scalestep = scalestep; vis->mobj = thing; // Easy access! Tails 06-07-2002 From 0ccf6fe6a95ff651fc02f672a4f06ebccb3fa01e Mon Sep 17 00:00:00 2001 From: toasterbabe Date: Mon, 24 Oct 2016 12:43:54 +0100 Subject: [PATCH 084/172] I commented out this line a while ago because it didn't seem to be important, and flashingtics seems to be thoroughly set elsewhere. Here's an actual removal so it stands out on the git diff. --- src/p_inter.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/p_inter.c b/src/p_inter.c index d038677db..3abb9aaca 100644 --- a/src/p_inter.c +++ b/src/p_inter.c @@ -3135,7 +3135,7 @@ boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 da else { player->health -= damage; // mirror mobj health here - //target->player->powers[pw_flashing] = flashingtics; + if (damage > 0) // don't spill emeralds/ammo/panels for shield damage P_PlayerRingBurst(player, damage); } From 162c04c37066d937193811e1f1020645590820ac Mon Sep 17 00:00:00 2001 From: toasterbabe Date: Mon, 24 Oct 2016 13:33:10 +0100 Subject: [PATCH 085/172] Bubblewrap shield now bounces on enemies and monitors instead of piercing through them. --- src/lua_baselib.c | 11 +++++++++++ src/p_inter.c | 25 +++++++++++++++++++------ src/p_local.h | 1 + src/p_map.c | 19 +++++++++++++------ src/p_mobj.c | 11 ++--------- src/p_user.c | 18 ++++++++++++++++++ 6 files changed, 64 insertions(+), 21 deletions(-) diff --git a/src/lua_baselib.c b/src/lua_baselib.c index fca8050a9..33e54123d 100644 --- a/src/lua_baselib.c +++ b/src/lua_baselib.c @@ -777,6 +777,16 @@ static int lib_pDoJumpShield(lua_State *L) return 0; } +static int lib_pDoBubbleBounce(lua_State *L) +{ + player_t *player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER)); + NOHUD + if (!player) + return LUA_ErrInvalid(L, "player_t"); + P_DoBubbleBounce(player); + return 0; +} + static int lib_pBlackOw(lua_State *L) { player_t *player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER)); @@ -2048,6 +2058,7 @@ static luaL_Reg lib[] = { {"P_GivePlayerLives",lib_pGivePlayerLives}, {"P_ResetScore",lib_pResetScore}, {"P_DoJumpShield",lib_pDoJumpShield}, + {"P_DoBubbleBounce",lib_pDoBubbleBounce}, {"P_BlackOw",lib_pBlackOw}, {"P_ElementalFire",lib_pElementalFire}, {"P_DoPlayerExit",lib_pDoPlayerExit}, diff --git a/src/p_inter.c b/src/p_inter.c index 3abb9aaca..56e730017 100644 --- a/src/p_inter.c +++ b/src/p_inter.c @@ -240,7 +240,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck) { player_t *player; INT32 i; - boolean elementalpierce; + UINT8 elementalpierce; if (objectplacing) return; @@ -295,7 +295,10 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck) return; #endif - elementalpierce = (((player->powers[pw_shield] & SH_NOSTACK) == SH_ELEMENTAL || (player->powers[pw_shield] & SH_NOSTACK) == SH_BUBBLEWRAP) && (player->pflags & PF_SHIELDABILITY)); + // 0 = none, 1 = elemental pierce, 2 = bubble bounce + elementalpierce = (((player->powers[pw_shield] & SH_NOSTACK) == SH_ELEMENTAL || (player->powers[pw_shield] & SH_NOSTACK) == SH_BUBBLEWRAP) && (player->pflags & PF_SHIELDABILITY) + ? (((player->powers[pw_shield] & SH_NOSTACK) == SH_ELEMENTAL) ? 1 : 2) + : 0); if (special->flags & MF_BOSS) { @@ -313,8 +316,13 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck) || player->powers[pw_invulnerability] || player->powers[pw_super] || elementalpierce) // Do you possess the ability to subdue the object? { - if ((P_MobjFlip(toucher)*toucher->momz < 0) && !elementalpierce) - toucher->momz = -toucher->momz; + if ((P_MobjFlip(toucher)*toucher->momz < 0) && (elementalpierce != 1)) + { + if (elementalpierce == 2) + P_DoBubbleBounce(player); + else + toucher->momz = -toucher->momz; + } toucher->momx = -toucher->momx; toucher->momy = -toucher->momy; P_DamageMobj(special, toucher, toucher, 1, 0); @@ -359,8 +367,13 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck) || ((player->charflags & SF_STOMPDAMAGE) && (P_MobjFlip(toucher)*(toucher->z - (special->z + special->height/2)) > 0) && (P_MobjFlip(toucher)*toucher->momz < 0)) || player->powers[pw_invulnerability] || player->powers[pw_super]) // Do you possess the ability to subdue the object? { - if ((P_MobjFlip(toucher)*toucher->momz < 0) && !elementalpierce) - toucher->momz = -toucher->momz; + if ((P_MobjFlip(toucher)*toucher->momz < 0) && (elementalpierce != 1)) + { + if (elementalpierce == 2) + P_DoBubbleBounce(player); + else + toucher->momz = -toucher->momz; + } P_DamageMobj(special, toucher, toucher, 1, 0); } diff --git a/src/p_local.h b/src/p_local.h index ee61d3389..322675f03 100644 --- a/src/p_local.h +++ b/src/p_local.h @@ -153,6 +153,7 @@ void P_ResetScore(player_t *player); boolean P_AutoPause(void); void P_DoJumpShield(player_t *player); +void P_DoBubbleBounce(player_t *player); void P_BlackOw(player_t *player); void P_ElementalFire(player_t *player, boolean cropcircle); diff --git a/src/p_map.c b/src/p_map.c index 72668e478..54eecac7a 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -1052,9 +1052,10 @@ static boolean PIT_CheckThing(mobj_t *thing) else if (thing->z - FixedMul(FRACUNIT, thing->scale) <= tmthing->z + tmthing->height && thing->z + thing->height + FixedMul(FRACUNIT, thing->scale) >= tmthing->z) { - boolean elementalpierce = (((tmthing->player->powers[pw_shield] & SH_NOSTACK) == SH_ELEMENTAL - || (tmthing->player->powers[pw_shield] & SH_NOSTACK) == SH_BUBBLEWRAP) - && (tmthing->player->pflags & PF_SHIELDABILITY)); + // 0 = none, 1 = elemental pierce, 2 = bubble bounce + UINT8 elementalpierce = (((tmthing->player->powers[pw_shield] & SH_NOSTACK) == SH_ELEMENTAL || (tmthing->player->powers[pw_shield] & SH_NOSTACK) == SH_BUBBLEWRAP) && (tmthing->player->pflags & PF_SHIELDABILITY) + ? (((tmthing->player->powers[pw_shield] & SH_NOSTACK) == SH_ELEMENTAL) ? 1 : 2) + : 0); if (thing->flags & MF_MONITOR && (tmthing->player->pflags & (PF_SPINNING|PF_GLIDING) || ((tmthing->player->pflags & PF_JUMPED) @@ -1066,6 +1067,7 @@ static boolean PIT_CheckThing(mobj_t *thing) && (P_MobjFlip(tmthing)*(tmthing->z - (thing->z + thing->height/2)) > 0) && (P_MobjFlip(tmthing)*tmthing->momz < 0)) || elementalpierce)) { + player_t *player = tmthing->player; SINT8 flipval = P_MobjFlip(thing); // Save this value in case monitor gets removed. fixed_t *momz = &tmthing->momz; // tmthing gets changed by P_DamageMobj, so we need a new pointer?! X_x;; fixed_t *z = &tmthing->z; // aau. @@ -1074,9 +1076,14 @@ static boolean PIT_CheckThing(mobj_t *thing) if ((P_MobjWasRemoved(thing) // Monitor was removed || !thing->health) // or otherwise popped && (flipval*(*momz) < 0) // monitor is on the floor and you're going down, or on the ceiling and you're going up - && !elementalpierce) // you're not piercing through the monitor... - *momz = -*momz; // Therefore, you should be thrust in the opposite direction, vertically. - if (!(elementalpierce && thing->flags & MF_GRENADEBOUNCE)) // prevent gold monitor clipthrough. + && (elementalpierce != 1)) // you're not piercing through the monitor... + { + if (elementalpierce == 2) + P_DoBubbleBounce(player); + else + *momz = -*momz; // Therefore, you should be thrust in the opposite direction, vertically. + } + if (!(elementalpierce == 1 && thing->flags & MF_GRENADEBOUNCE)) // prevent gold monitor clipthrough. return false; else *z -= *momz; // to ensure proper collision. diff --git a/src/p_mobj.c b/src/p_mobj.c index c94587ab4..31e0d477c 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -3236,6 +3236,7 @@ static void P_PlayerZMovement(mobj_t *mo) mo->player->pflags &= ~(PF_JUMPED|PF_FORCEJUMPDAMAGE); mo->player->pflags &= ~(PF_THOKKED|PF_CANCARRY/*|PF_GLIDING*/); + mo->player->jumping = 0; mo->player->secondjump = 0; mo->player->glidetime = 0; mo->player->climbing = 0; @@ -3265,18 +3266,10 @@ static void P_PlayerZMovement(mobj_t *mo) } else if ((mo->player->powers[pw_shield] & SH_NOSTACK) == SH_BUBBLEWRAP) // Bubble shield's bounce attack. { - S_StartSound(mo, sfx_s3k44); - P_DoJump(mo->player, false); - if (mo->player->charflags & SF_NOJUMPSPIN) - P_SetPlayerMobjState(mo, S_PLAY_FALL); - mo->player->pflags |= PF_THOKKED; - mo->player->secondjump = UINT8_MAX; - mo->momz = FixedMul(mo->momz, 5*FRACUNIT/4); + P_DoBubbleBounce(mo->player); clipmomz = false; } } - - mo->player->jumping = 0; // done down here because of bubblewrap } } if (!(mo->player->pflags & PF_SPINNING)) diff --git a/src/p_user.c b/src/p_user.c index 3754623de..5aa50458e 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -3927,6 +3927,24 @@ void P_DoJumpShield(player_t *player) } } +// +// P_DoBubbleBounce +// +// Bubblewrap shield landing handling +// +void P_DoBubbleBounce(player_t *player) +{ + player->pflags &= ~(PF_JUMPED|PF_SHIELDABILITY); + S_StartSound(player->mo, sfx_s3k44); + P_DoJump(player, false); + if (player->charflags & SF_NOJUMPSPIN) + P_SetPlayerMobjState(player->mo, S_PLAY_FALL); + player->pflags |= PF_THOKKED; + player->jumping = 0; + player->secondjump = UINT8_MAX; + player->mo->momz = FixedMul(player->mo->momz, 5*FRACUNIT/4); +} + // // P_Telekinesis // From 0ee2937392a8f4072937d725643374d7744c4c34 Mon Sep 17 00:00:00 2001 From: toasterbabe Date: Mon, 24 Oct 2016 13:52:36 +0100 Subject: [PATCH 086/172] Adding ShieldSpecial hook. (Activates under different circumstances to the JumpSpinSpecial hook, and can be used to cancel existing shield actions.) --- src/lua_hook.h | 2 ++ src/lua_hooklib.c | 1 + src/p_user.c | 6 +++++- 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/lua_hook.h b/src/lua_hook.h index e0f08d175..cbeaa6868 100644 --- a/src/lua_hook.h +++ b/src/lua_hook.h @@ -44,6 +44,7 @@ enum hook { hook_HurtMsg, hook_PlayerSpawn, hook_ShieldSpawn, + hook_ShieldSpecial, hook_MAX // last hook }; @@ -79,5 +80,6 @@ boolean LUAh_PlayerMsg(int source, int target, int flags, char *msg); // Hook fo boolean LUAh_HurtMsg(player_t *player, mobj_t *inflictor, mobj_t *source); // Hook for hurt messages #define LUAh_PlayerSpawn(player) LUAh_PlayerHook(player, hook_PlayerSpawn) // Hook for G_SpawnPlayer #define LUAh_ShieldSpawn(player) LUAh_PlayerHook(player, hook_ShieldSpawn) // Hook for P_SpawnShieldOrb +#define LUAh_ShieldSpecial(player) LUAh_PlayerHook(player, hook_ShieldSpecial) // Hook for shield abilities #endif diff --git a/src/lua_hooklib.c b/src/lua_hooklib.c index 1065f193a..ac0e555f7 100644 --- a/src/lua_hooklib.c +++ b/src/lua_hooklib.c @@ -55,6 +55,7 @@ const char *const hookNames[hook_MAX+1] = { "HurtMsg", "PlayerSpawn", "ShieldSpawn", + "ShieldSpecial", NULL }; diff --git a/src/p_user.c b/src/p_user.c index 5aa50458e..55d2ad544 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -6978,10 +6978,14 @@ static void P_MovePlayer(player_t *player) //STUFF! // /////////////////////////// - if (player->pflags & PF_JUMPED) + if (player->pflags & PF_JUMPED && !player->exiting && player->mo->health) { if (cmd->buttons & BT_USE) // Spin button effects { +#ifdef HAVE_BLUA + if (LUAh_ShieldSpecial(player)) + return; +#endif if (!(player->pflags & (PF_USEDOWN|PF_GLIDING|PF_SLIDING|PF_SHIELDABILITY)) // If the player is not holding down BT_USE, or having used an ability previously && (!(player->pflags & PF_THOKKED) || ((player->powers[pw_shield] & SH_NOSTACK) == SH_BUBBLEWRAP && player->secondjump == UINT8_MAX))) // thokked is optional if you're bubblewrapped { From ea30450180e46be303b58f8a65adcea2268f0fcc Mon Sep 17 00:00:00 2001 From: toasterbabe Date: Mon, 24 Oct 2016 13:52:36 +0100 Subject: [PATCH 087/172] Minor correction to force-hud conditional. --- src/st_stuff.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/st_stuff.c b/src/st_stuff.c index 7670f577b..49872c68c 100644 --- a/src/st_stuff.c +++ b/src/st_stuff.c @@ -812,7 +812,7 @@ static void ST_drawFirstPersonHUD(void) return; // Graue 06-18-2004: no V_NOSCALESTART, no SCX, no SCY, snap to right - if (player->powers[pw_shield] & SH_FORCE) + if ((player->powers[pw_shield] & SH_NOSTACK & ~SH_FORCEHP) == SH_FORCE) { if ((player->powers[pw_shield] & SH_FORCEHP) > 0 || leveltime & 1) p = forceshield; From bf873f8a9bbf15a46e566448cd54644afda8e3d5 Mon Sep 17 00:00:00 2001 From: toasterbabe Date: Mon, 24 Oct 2016 13:52:36 +0100 Subject: [PATCH 088/172] Fixed a heinous modding bug with not properly updating dehacked.c, and added pf_SHieldability to debug. --- src/dehacked.c | 2 ++ src/st_stuff.c | 13 +++++++------ 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/dehacked.c b/src/dehacked.c index 7667ead82..eb7badd10 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -6772,7 +6772,9 @@ static const char *const PLAYERFLAG_LIST[] = { /*** misc ***/ "FORCESTRAFE", // Translate turn inputs into strafe inputs "ANALOGMODE", // Analog mode? + "CANCARRY", // Can carry? "SHIELDABILITY", // Thokked with shield ability + "FORCEJUMPDAMAGE", // Force jump damage NULL // stop loop here. }; diff --git a/src/st_stuff.c b/src/st_stuff.c index 49872c68c..fb90bfe80 100644 --- a/src/st_stuff.c +++ b/src/st_stuff.c @@ -582,12 +582,13 @@ static void ST_drawDebugInfo(void) V_DrawRightAlignedString(320, height - 80, V_MONOSPACE, va("AIR: %4d, %3d", stplyr->powers[pw_underwater], stplyr->powers[pw_spacetime])); // Flags - V_DrawRightAlignedString(304-74, height - 72, V_MONOSPACE, "PF:"); - V_DrawString(304-72, height - 72, (stplyr->jumping) ? V_GREENMAP : V_REDMAP, "JM"); - V_DrawString(304-54, height - 72, (stplyr->pflags & PF_JUMPED) ? V_GREENMAP : V_REDMAP, "JD"); - V_DrawString(304-36, height - 72, (stplyr->pflags & PF_SPINNING) ? V_GREENMAP : V_REDMAP, "SP"); - V_DrawString(304-18, height - 72, (stplyr->pflags & PF_STARTDASH) ? V_GREENMAP : V_REDMAP, "ST"); - V_DrawString(304, height - 72, (stplyr->pflags & PF_THOKKED) ? V_GREENMAP : V_REDMAP, "TH"); + V_DrawRightAlignedString(304-92, height - 72, V_MONOSPACE, "PF:"); + V_DrawString(304-90, height - 72, (stplyr->jumping) ? V_GREENMAP : V_REDMAP, "JM"); + V_DrawString(304-72, height - 72, (stplyr->pflags & PF_JUMPED) ? V_GREENMAP : V_REDMAP, "JD"); + V_DrawString(304-54, height - 72, (stplyr->pflags & PF_SPINNING) ? V_GREENMAP : V_REDMAP, "SP"); + V_DrawString(304-36, height - 72, (stplyr->pflags & PF_STARTDASH) ? V_GREENMAP : V_REDMAP, "ST"); + V_DrawString(304-18, height - 72, (stplyr->pflags & PF_THOKKED) ? V_GREENMAP : V_REDMAP, "TH"); + V_DrawString(304, height - 72, (stplyr->pflags & PF_SHIELDABILITY) ? V_GREENMAP : V_REDMAP, "SH"); V_DrawRightAlignedString(320, height - 64, V_MONOSPACE, va("CEILZ: %6d", stplyr->mo->ceilingz>>FRACBITS)); V_DrawRightAlignedString(320, height - 56, V_MONOSPACE, va("FLOORZ: %6d", stplyr->mo->floorz>>FRACBITS)); From cc4d780371e81a8668292b61c538e0ca49b49d01 Mon Sep 17 00:00:00 2001 From: toasterbabe Date: Mon, 24 Oct 2016 13:52:36 +0100 Subject: [PATCH 089/172] Making things more scale-friendly (but it's not perfect...) --- src/p_mobj.c | 1 - src/p_user.c | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/src/p_mobj.c b/src/p_mobj.c index 31e0d477c..5d1af9c45 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -6819,7 +6819,6 @@ void P_MobjThinker(mobj_t *mobj) whoosh->destscale = whoosh->scale<<1; whoosh->fuse = 10; whoosh->flags |= MF_NOCLIPHEIGHT; - whoosh->height = 42*FRACUNIT; mobj->target->player->pflags &= ~PF_SHIELDABILITY; // prevent eternal whoosh } case MT_FLAMEAURA_ORB: diff --git a/src/p_user.c b/src/p_user.c index 55d2ad544..1514fdef6 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -6994,7 +6994,7 @@ static void P_MovePlayer(player_t *player) { player->pflags |= PF_THOKKED|PF_SHIELDABILITY; #if 1 // almost imperceptible hop for the purposes of aligning with the aura for as long as possible - P_SetObjectMomZ(player->mo, -4*P_GetMobjGravity(player->mo), false); + P_SetObjectMomZ(player->mo, FixedDiv(-4*P_GetMobjGravity(player->mo), player->mo->scale), false); #else player->mo->momz = // intentionally carries to post-endif line as multiple-assignment #endif From a533701d859a8f44acaaebeb8a2136b2988f8f08 Mon Sep 17 00:00:00 2001 From: toasterbabe Date: Mon, 24 Oct 2016 13:52:36 +0100 Subject: [PATCH 090/172] You know what, let's make this less hacky. --- src/p_user.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/p_user.c b/src/p_user.c index 1514fdef6..eddd0d9b8 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -6993,10 +6993,9 @@ static void P_MovePlayer(player_t *player) if ((player->powers[pw_shield] & ~(SH_FORCEHP|SH_STACK)) == SH_FORCE) { player->pflags |= PF_THOKKED|PF_SHIELDABILITY; + player->mo->momz = // would intentionally carry to post-endif line as multiple-assignment #if 1 // almost imperceptible hop for the purposes of aligning with the aura for as long as possible - P_SetObjectMomZ(player->mo, FixedDiv(-4*P_GetMobjGravity(player->mo), player->mo->scale), false); -#else - player->mo->momz = // intentionally carries to post-endif line as multiple-assignment + -4*P_GetMobjGravity(player->mo); #endif player->mo->momx = player->mo->momy = 0; S_StartSound(player->mo, sfx_ngskid); From bfdaf5ee90ba81ab3b5659269883737093675cd1 Mon Sep 17 00:00:00 2001 From: toasterbabe Date: Mon, 24 Oct 2016 13:52:36 +0100 Subject: [PATCH 091/172] Fixed the Force stop's scaling properly. Woo! Branch is basically done now. --- src/p_mobj.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/p_mobj.c b/src/p_mobj.c index 5d1af9c45..804b73372 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -6396,6 +6396,7 @@ static boolean P_ShieldLook(mobj_t *thing, shieldtype_t shield) thing->eflags = (thing->eflags & ~MFE_VERTICALFLIP)|(thing->target->eflags & MFE_VERTICALFLIP); P_SetScale(thing, FixedMul(thing->target->scale, thing->target->player->shieldscale)); + thing->destscale = thing->scale; P_UnsetThingPosition(thing); thing->x = thing->target->x; thing->y = thing->target->y; @@ -6817,6 +6818,8 @@ void P_MobjThinker(mobj_t *mobj) mobj_t *whoosh = P_SpawnMobjFromMobj(mobj, 0, 0, 0, MT_GHOST); // done here so the offset is correct P_SetMobjState(whoosh, mobj->info->raisestate); whoosh->destscale = whoosh->scale<<1; + whoosh->scalespeed = FixedMul(whoosh->scalespeed, whoosh->scale); + whoosh->height = 38*whoosh->scale; whoosh->fuse = 10; whoosh->flags |= MF_NOCLIPHEIGHT; mobj->target->player->pflags &= ~PF_SHIELDABILITY; // prevent eternal whoosh From 31d569a15b002d2555ac16940bae118e3096f0af Mon Sep 17 00:00:00 2001 From: toasterbabe Date: Sat, 29 Oct 2016 18:12:41 +0100 Subject: [PATCH 092/172] No more changing skins when you're in singleplayer and manage to enter a hole in the gamestate defenses! --- src/d_netcmd.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/d_netcmd.c b/src/d_netcmd.c index 4f73a2564..7fd10d081 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -4062,8 +4062,7 @@ static void Skin_OnChange(void) if (!Playing()) return; // do whatever you want - if (!(cv_debug || devparm) && !(multiplayer || netgame) // In single player. - && (gamestate == GS_LEVEL || gamestate == GS_INTERMISSION || gamestate == GS_CONTINUING)) + if (!(cv_debug || devparm) && !(multiplayer || netgame)) // In single player. { CV_StealthSet(&cv_skin, skins[players[consoleplayer].skin].name); return; From 08a4fc8382d80c0e76df24090ae4c497b5b7f4d3 Mon Sep 17 00:00:00 2001 From: toasterbabe Date: Sun, 30 Oct 2016 14:01:56 +0000 Subject: [PATCH 093/172] Tweaks to the way the force whoosh is handled so it stays centered AND doesn't allow an infinitesimal jump. --- src/p_mobj.c | 1 + src/p_user.c | 6 +----- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/src/p_mobj.c b/src/p_mobj.c index 2965fb7cc..10ebe9c5c 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -6824,6 +6824,7 @@ void P_MobjThinker(mobj_t *mobj) whoosh->height = 38*whoosh->scale; whoosh->fuse = 10; whoosh->flags |= MF_NOCLIPHEIGHT; + whoosh->momz = mobj->target->momz; // Stay reasonably centered for a few frames mobj->target->player->pflags &= ~PF_SHIELDABILITY; // prevent eternal whoosh } case MT_FLAMEAURA_ORB: diff --git a/src/p_user.c b/src/p_user.c index d34309855..f5e813274 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -6992,11 +6992,7 @@ static void P_MovePlayer(player_t *player) if ((player->powers[pw_shield] & ~(SH_FORCEHP|SH_STACK)) == SH_FORCE) { player->pflags |= PF_THOKKED|PF_SHIELDABILITY; - player->mo->momz = // would intentionally carry to post-endif line as multiple-assignment -#if 1 // almost imperceptible hop for the purposes of aligning with the aura for as long as possible - -4*P_GetMobjGravity(player->mo); -#endif - player->mo->momx = player->mo->momy = 0; + player->mo->momx = player->mo->momy = player->mo->momz = 0; S_StartSound(player->mo, sfx_ngskid); } else From 6570912b1a5b6ceb72cf58649092cbc7727e96c8 Mon Sep 17 00:00:00 2001 From: toasterbabe Date: Sun, 30 Oct 2016 14:09:51 +0000 Subject: [PATCH 094/172] Fixed gold monitor collision (which relied upon the shitty old collision blocking in order to not destroy your momentum) to work with my slopes_n_objects fixes from public next. --- src/p_map.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/p_map.c b/src/p_map.c index d4c9df5d1..7afd266fd 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -1142,6 +1142,9 @@ static boolean PIT_CheckThing(mobj_t *thing) if (tmthing->player && tmthing->z + tmthing->height > topz && tmthing->z + tmthing->height < tmthing->ceilingz) { + if (thing->flags & MF_GRENADEBOUNCE && (thing->flags & MF_MONITOR || thing->flags2 & MF2_STANDONME)) // Gold monitor hack... + return false; + tmfloorz = tmceilingz = INT32_MIN; // block while in air #ifdef ESLOPE tmceilingslope = NULL; @@ -1185,6 +1188,9 @@ static boolean PIT_CheckThing(mobj_t *thing) if (tmthing->player && tmthing->z < topz && tmthing->z > tmthing->floorz) { + if (thing->flags & MF_GRENADEBOUNCE && (thing->flags & MF_MONITOR || thing->flags2 & MF2_STANDONME)) // Gold monitor hack... + return false; + tmfloorz = tmceilingz = INT32_MAX; // block while in air #ifdef ESLOPE tmfloorslope = NULL; From f77c3444a3c98304d563d0bc478e58a93c19bf9a Mon Sep 17 00:00:00 2001 From: toasterbabe Date: Sun, 30 Oct 2016 14:23:53 +0000 Subject: [PATCH 095/172] Don't use shield abilities after the armageddon's used up! --- src/p_user.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/p_user.c b/src/p_user.c index f5e813274..69334fe45 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -7008,7 +7008,10 @@ static void P_MovePlayer(player_t *player) case SH_ARMAGEDDON: // Don't let Super Sonic or invincibility use it if (!(player->powers[pw_super] || player->powers[pw_invulnerability])) + { + player->pflags |= PF_THOKKED|PF_SHIELDABILITY; P_BlackOw(player); + } break; // Attract shield activation case SH_ATTRACT: From 6f4699fb7766a21d729b9af5a0f812694a16c4e3 Mon Sep 17 00:00:00 2001 From: Louis-Antoine Date: Fri, 4 Nov 2016 18:56:25 +0100 Subject: [PATCH 096/172] MobjThinker, MobjCollide and MobjMoveCollide hooks are now directly linked to the mobjtype they belong to, so you no longer iterate through all existing hooks. --- src/lua_hooklib.c | 118 +++++++++++++++++++++++++++++++++++++++------- 1 file changed, 102 insertions(+), 16 deletions(-) diff --git a/src/lua_hooklib.c b/src/lua_hooklib.c index 1b9652571..5d9c50623 100644 --- a/src/lua_hooklib.c +++ b/src/lua_hooklib.c @@ -74,12 +74,21 @@ typedef struct hook_s* hook_p; #define FMT_HOOKID "hook_%d" +// For each mobj type, a linked list to its thinker and collision hooks. +// That way, we don't have to iterate through all the hooks. +// We could do that with all other mobj hooks, but it would probably just be +// a waste of memory since they are only called occasionally. Probably... +static hook_p mobjthinkerhooks[NUMMOBJTYPES]; +static hook_p mobjcollidehooks[NUMMOBJTYPES]; + +// For other hooks, a unique linked list hook_p roothook; // Takes hook, function, and additional arguments (mobj type to act on, etc.) static int lib_addHook(lua_State *L) { static struct hook_s hook = {NULL, 0, 0, {0}, false}; + static UINT32 nextid; hook_p hookp, *lastp; hook.type = luaL_checkoption(L, 1, NULL, hookNames); @@ -109,6 +118,7 @@ static int lib_addHook(lua_State *L) hook.s.mt = MT_NULL; if (lua_isnumber(L, 2)) hook.s.mt = lua_tonumber(L, 2); + luaL_argcheck(L, hook.s.mt < NUMMOBJTYPES, 2, "invalid mobjtype_t"); break; case hook_BotAI: hook.s.skinname = NULL; @@ -141,18 +151,21 @@ static int lib_addHook(lua_State *L) hooksAvailable[hook.type/8] |= 1<<(hook.type%8); - // iterate the hook metadata structs // set hook.id to the highest id + 1 - // set lastp to the last hook struct's "next" pointer. - lastp = &roothook; - hook.id = 0; - for (hookp = roothook; hookp; hookp = hookp->next) - { - if (hookp->id >= hook.id) - hook.id = hookp->id+1; - lastp = &hookp->next; - } + hook.id = nextid++; + // Special cases for mobj thinker and collision hooks (see the comments above mobjthinkerhooks declaration) + if (hook.type == hook_MobjThinker) + lastp = &mobjthinkerhooks[hook.s.mt]; + else if (hook.type == hook_MobjCollide || hook.type == hook_MobjMoveCollide) + lastp = &mobjcollidehooks[hook.s.mt]; + else + lastp = &roothook; + + // iterate the hook metadata structs + // set lastp to the last hook struct's "next" pointer. + for (hookp = *lastp; hookp; hookp = hookp->next) + lastp = &hookp->next; // allocate a permanent memory struct to stuff hook. hookp = ZZ_Alloc(sizeof(struct hook_s)); memcpy(hookp, &hook, sizeof(struct hook_s)); @@ -183,9 +196,9 @@ boolean LUAh_MobjHook(mobj_t *mo, enum hook which) lua_settop(gL, 0); - for (hookp = roothook; hookp; hookp = hookp->next) - if (hookp->type == which - && (hookp->s.mt == MT_NULL || hookp->s.mt == mo->type)) + if (which == hook_MobjThinker) // Alternate list for mobj thinkers + { + for (hookp = mobjthinkerhooks[mo->type]; hookp; hookp = hookp->next) { if (lua_gettop(gL) == 0) LUA_PushUserdata(gL, mo, META_MOBJ); @@ -204,6 +217,50 @@ boolean LUAh_MobjHook(mobj_t *mo, enum hook which) lua_pop(gL, 1); } + // Look for all generic mobj thinker hooks + for (hookp = mobjthinkerhooks[MT_NULL]; hookp; hookp = hookp->next) + { + if (lua_gettop(gL) == 0) + LUA_PushUserdata(gL, mo, META_MOBJ); + lua_pushfstring(gL, FMT_HOOKID, hookp->id); + lua_gettable(gL, LUA_REGISTRYINDEX); + lua_pushvalue(gL, -2); + if (lua_pcall(gL, 1, 1, 0)) { + if (!hookp->error || cv_debug & DBG_LUA) + CONS_Alert(CONS_WARNING,"%s\n",lua_tostring(gL, -1)); + lua_pop(gL, 1); + hookp->error = true; + continue; + } + if (lua_toboolean(gL, -1)) + hooked = true; + lua_pop(gL, 1); + } + } + else + { + for (hookp = roothook; hookp; hookp = hookp->next) + if (hookp->type == which + && (hookp->s.mt == MT_NULL || hookp->s.mt == mo->type)) + { + if (lua_gettop(gL) == 0) + LUA_PushUserdata(gL, mo, META_MOBJ); + lua_pushfstring(gL, FMT_HOOKID, hookp->id); + lua_gettable(gL, LUA_REGISTRYINDEX); + lua_pushvalue(gL, -2); + if (lua_pcall(gL, 1, 1, 0)) { + if (!hookp->error || cv_debug & DBG_LUA) + CONS_Alert(CONS_WARNING,"%s\n",lua_tostring(gL, -1)); + lua_pop(gL, 1); + hookp->error = true; + continue; + } + if (lua_toboolean(gL, -1)) + hooked = true; + lua_pop(gL, 1); + } + } + lua_settop(gL, 0); return hooked; } @@ -338,9 +395,38 @@ UINT8 LUAh_MobjCollideHook(mobj_t *thing1, mobj_t *thing2, enum hook which) lua_settop(gL, 0); - for (hookp = roothook; hookp; hookp = hookp->next) - if (hookp->type == which - && (hookp->s.mt == MT_NULL || hookp->s.mt == thing1->type)) + for (hookp = mobjcollidehooks[thing1->type]; hookp; hookp = hookp->next) + if (hookp->type == which) + { + if (lua_gettop(gL) == 0) + { + LUA_PushUserdata(gL, thing1, META_MOBJ); + LUA_PushUserdata(gL, thing2, META_MOBJ); + } + lua_pushfstring(gL, FMT_HOOKID, hookp->id); + lua_gettable(gL, LUA_REGISTRYINDEX); + lua_pushvalue(gL, -3); + lua_pushvalue(gL, -3); + if (lua_pcall(gL, 2, 1, 0)) { + if (!hookp->error || cv_debug & DBG_LUA) + CONS_Alert(CONS_WARNING,"%s\n",lua_tostring(gL, -1)); + lua_pop(gL, 1); + hookp->error = true; + continue; + } + if (!lua_isnil(gL, -1)) + { // if nil, leave shouldCollide = 0. + if (lua_toboolean(gL, -1)) + shouldCollide = 1; // Force yes + else + shouldCollide = 2; // Force no + } + lua_pop(gL, 1); + } + + // Look for all generic mobj collision hooks + for (hookp = mobjcollidehooks[MT_NULL]; hookp; hookp = hookp->next) + if (hookp->type == which) { if (lua_gettop(gL) == 0) { From 93c9841360c38c5cee4665aa418a34e5cdabf642 Mon Sep 17 00:00:00 2001 From: Alam Ed Arias Date: Sun, 6 Nov 2016 15:11:02 -0500 Subject: [PATCH 097/172] move Windows zlib options out of PNG to ZLIB --- src/win32/Makefile.cfg | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/win32/Makefile.cfg b/src/win32/Makefile.cfg index f309f7db1..99b8bc9b2 100644 --- a/src/win32/Makefile.cfg +++ b/src/win32/Makefile.cfg @@ -85,13 +85,21 @@ endif OBJS=$(OBJDIR)/dx_error.o $(OBJDIR)/fabdxlib.o $(OBJDIR)/win_vid.o $(OBJDIR)/win_dll.o endif + +ZLIB_CFLAGS?=-I../libs/zlib +ifdef MINGW64 +ZLIB_LDFLAGS?=-L../libs/zlib/win32 -lz64 +else +ZLIB_LDFLAGS?=-L../libs/zlib/win32 -lz32 +endif + ifndef NOPNG ifndef PNG_CONFIG - PNG_CFLAGS?=-I../libs/libpng-src -I../libs/zlib + PNG_CFLAGS?=-I../libs/libpng-src ifdef MINGW64 - PNG_LDFLAGS?=-L../libs/libpng-src/projects -lpng64 -L../libs/zlib/win32 -lz64 + PNG_LDFLAGS?=-L../libs/libpng-src/projects -lpng64 else - PNG_LDFLAGS?=-L../libs/libpng-src/projects -lpng32 -L../libs/zlib/win32 -lz32 + PNG_LDFLAGS?=-L../libs/libpng-src/projects -lpng32 endif #MINGW64 endif #PNG_CONFIG endif #NOPNG From ce97c1e98644e660bc77b03b51920099f4cf95dc Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Thu, 10 Nov 2016 17:51:10 +0000 Subject: [PATCH 098/172] Added basic spindash dust Also cleaned up some of the code in P_DoSpinAbility while I was at it --- src/dehacked.c | 7 ++ src/info.c | 35 +++++++++ src/info.h | 8 +++ src/p_mobj.c | 5 ++ src/p_user.c | 189 ++++++++++++++++++++++++++++++------------------- 5 files changed, 170 insertions(+), 74 deletions(-) diff --git a/src/dehacked.c b/src/dehacked.c index c3b606fe0..3ef8b0d29 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -5566,6 +5566,12 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit "S_WATERZAP", + // Spindash dust + "S_SPINDUST1", + "S_SPINDUST2", + "S_SPINDUST3", + "S_SPINDUST4", + "S_FOG1", "S_FOG2", "S_FOG3", @@ -6376,6 +6382,7 @@ static const char *const MOBJTYPE_LIST[] = { // array length left dynamic for s "MT_MEDIUMBUBBLE", // medium bubble "MT_EXTRALARGEBUBBLE", // extra large bubble "MT_WATERZAP", + "MT_SPINDUST", // Spindash dust "MT_TFOG", "MT_SEED", "MT_PARTICLE", diff --git a/src/info.c b/src/info.c index 9fb442883..459238917 100644 --- a/src/info.c +++ b/src/info.c @@ -274,6 +274,7 @@ char sprnames[NUMSPRITES + 1][5] = "SMOK", "BUBL", // Bubble "WZAP", + "DUST", // Spindash dust "TFOG", // Teleport Fog "SEED", // Sonic CD flower seed "PRTL", // Particle (for fans, etc.) @@ -2279,6 +2280,13 @@ state_t states[NUMSTATES] = {SPR_WZAP, FF_TRANS10|FF_ANIMATE|FF_RANDOMANIM, 4, {NULL}, 3, 2, S_NULL}, // S_WATERZAP + // Spindash dust + // TODO: other spin dust types + {SPR_DUST, 0, 7, {NULL}, 0, 0, S_SPINDUST2}, // S_SPINDUST1 + {SPR_DUST, 1, 6, {NULL}, 0, 0, S_SPINDUST3}, // S_SPINDUST2 + {SPR_DUST, FF_TRANS30|2, 4, {NULL}, 0, 0, S_SPINDUST4}, // S_SPINDUST3 + {SPR_DUST, FF_TRANS60|3, 3, {NULL}, 0, 0, S_NULL}, // S_SPINDUST4 + {SPR_TFOG, FF_FULLBRIGHT|FF_TRANS50, 2, {NULL}, 0, 0, S_FOG2}, // S_FOG1 {SPR_TFOG, FF_FULLBRIGHT|FF_TRANS50|1, 2, {NULL}, 0, 0, S_FOG3}, // S_FOG2 {SPR_TFOG, FF_FULLBRIGHT|FF_TRANS50|2, 2, {NULL}, 0, 0, S_FOG4}, // S_FOG3 @@ -10940,6 +10948,33 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = S_NULL // raisestate }, + { // MT_SPINDUST + -1, // doomednum + S_SPINDUST1, // 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 + 4*FRACUNIT, // speed + 4*FRACUNIT, // radius + 4*FRACUNIT, // height + 0, // display offset + 4, // mass + 0, // damage + sfx_None, // activesound + MF_NOBLOCKMAP|MF_NOGRAVITY|MF_NOCLIPHEIGHT|MF_NOCLIP, // flags + S_NULL // raisestate + }, + { // MT_TFOG -1, // doomednum S_FOG1, // spawnstate diff --git a/src/info.h b/src/info.h index b0683c172..fc5012d29 100644 --- a/src/info.h +++ b/src/info.h @@ -466,6 +466,7 @@ typedef enum sprite SPR_SMOK, SPR_BUBL, // Bubble SPR_WZAP, + SPR_DUST, // Spindash dust SPR_TFOG, // Teleport Fog SPR_SEED, // Sonic CD flower seed SPR_PRTL, // Particle (for fans, etc.) @@ -2457,6 +2458,12 @@ typedef enum state S_WATERZAP, + // Spindash dust + S_SPINDUST1, + S_SPINDUST2, + S_SPINDUST3, + S_SPINDUST4, + S_FOG1, S_FOG2, S_FOG3, @@ -3286,6 +3293,7 @@ typedef enum mobj_type MT_MEDIUMBUBBLE, // medium bubble MT_EXTRALARGEBUBBLE, // extra large bubble MT_WATERZAP, + MT_SPINDUST, // Spindash dust MT_TFOG, MT_SEED, MT_PARTICLE, diff --git a/src/p_mobj.c b/src/p_mobj.c index e9bcd193a..abe7849f2 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -7537,6 +7537,11 @@ void P_MobjThinker(mobj_t *mobj) mobj->tracer->y, mobj->tracer->floorz, SPLATDRAWMODE_SHADE); #endif break; + case MT_SPINDUST: // Spindash dust + mobj->momx = FixedMul(mobj->momx, (3*FRACUNIT)/4); // originally 50000 + mobj->momy = FixedMul(mobj->momy, (3*FRACUNIT)/4); // same + //mobj->momz = mobj->momz+P_MobjFlip(mobj)/3; // no meaningful change in value to be frank + break; case MT_SPINFIRE: if (mobj->eflags & MFE_VERTICALFLIP) mobj->z = mobj->ceilingz - mobj->height; diff --git a/src/p_user.c b/src/p_user.c index 697f42e4d..02ab2044c 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -3667,6 +3667,40 @@ void P_DoJump(player_t *player, boolean soundandstate) } } +static void P_DoSpinDashDust(player_t *player) +{ + UINT32 i; + mobj_t *particle; + UINT32 prandom[3]; + for (i = 0; i <= (leveltime%7)/2; i++) { // 1, 2, 3 or 4 particles + particle = P_SpawnMobjFromMobj(player->mo, 0, 0, 0, MT_SPINDUST); + + if (player->powers[pw_shield] == SH_ELEMENTAL && !(player->mo->eflags & (MFE_TOUCHWATER|MFE_UNDERWATER))) { + //P_SetMobjState(particle, S_FIREDUST1); + //particle->bubble = false; + } else if (player->mo->eflags & (MFE_TOUCHWATER|MFE_UNDERWATER)) { + //P_SetMobjState(particle, S_BUBBLEDUST1); + //particle->bubble = true; + } else { + //P_SetMobjState(particle, S_SPINDUST1); + //particle->bubble = false; + } + P_SetTarget(&particle->target, player->mo); + particle->destscale = (2*player->mo->scale)/3; + P_SetScale(particle, particle->destscale); + if (player->mo->eflags & MFE_VERTICALFLIP) // readjust z position if needed + particle->z = player->mo->z + player->mo->height - particle->height; + prandom[0] = P_RandomFixed()<<2; // P_RandomByte()<<10 + prandom[1] = P_RandomRange(-30, 30); // P_RandomRange(-ANG30/FRACUNIT, ANG30/FRACUNIT)*FRACUNIT + prandom[2] = P_RandomFixed()<<3; // P_RandomByte()<<11 + P_SetObjectMomZ(particle, player->dashspeed/50 + prandom[0], false); + P_InstaThrust(particle, + player->mo->angle + (prandom[1]*ANG1), + -FixedMul(player->dashspeed/12 + FRACUNIT + prandom[2], player->mo->scale)); + P_TryMove(particle, particle->x+particle->momx, particle->y+particle->momy, true); + } +} + // // P_DoSpinAbility // @@ -3674,6 +3708,7 @@ void P_DoJump(player_t *player, boolean soundandstate) // static void P_DoSpinAbility(player_t *player, ticcmd_t *cmd) { + boolean canstand = true; // can we stand on the ground? (mostly relevant for slopes) if (player->pflags & PF_STASIS) return; @@ -3685,69 +3720,92 @@ static void P_DoSpinAbility(player_t *player, ticcmd_t *cmd) } #endif - // Spinning and Spindashing - if ((player->charability2 == CA2_SPINDASH) && !(player->pflags & PF_SLIDING) && !player->exiting - && !P_PlayerInPain(player)) // subsequent revs - { - if ((cmd->buttons & BT_USE) && player->speed < FixedMul(5<mo->scale) && !player->mo->momz && onground && !(player->pflags & PF_USEDOWN) && !(player->pflags & PF_SPINNING) #ifdef ESLOPE - && (!player->mo->standingslope || (player->mo->standingslope->flags & SL_NOPHYSICS) || abs(player->mo->standingslope->zdelta) < FRACUNIT/2) + canstand = (!player->mo->standingslope || (player->mo->standingslope->flags & SL_NOPHYSICS) || abs(player->mo->standingslope->zdelta) < FRACUNIT/2); #endif - ) - { - player->mo->momx = player->cmomx; - player->mo->momy = player->cmomy; - player->pflags |= PF_STARTDASH|PF_SPINNING; - player->dashspeed = player->mindash; - P_SetPlayerMobjState(player->mo, S_PLAY_DASH); - player->pflags |= PF_USEDOWN; - if (!player->spectator) - S_StartSound(player->mo, sfx_s3kab); // Make the rev sound! Previously sfx_spndsh. - } - else if ((cmd->buttons & BT_USE) && (player->pflags & PF_STARTDASH)) - { - if (player->dashspeed < player->maxdash) - { -#define chargecalculation (6*(player->dashspeed - player->mindash))/(player->maxdash - player->mindash) - fixed_t soundcalculation = chargecalculation; - player->dashspeed += FRACUNIT; - if (!player->spectator && soundcalculation != chargecalculation) - S_StartSound(player->mo, sfx_s3kab); // Make the rev sound! Previously sfx_spndsh. -#undef chargecalculation - } - if (player->revitem && !(leveltime % 5)) // Now spawn the color thok circle. - { - P_SpawnSpinMobj(player, player->revitem); - if (demorecording) - G_GhostAddRev(); - } - } - // If not moving up or down, and travelling faster than a speed of four while not holding - // down the spin button and not spinning. - // AKA Just go into a spin on the ground, you idiot. ;) - else if ((cmd->buttons & BT_USE || ((twodlevel || (player->mo->flags2 & MF2_TWOD)) && cmd->forwardmove < -20)) - && !player->climbing && !player->mo->momz && onground && (player->speed > FixedMul(5<mo->scale) -#ifdef ESLOPE - || (player->mo->standingslope && (!(player->mo->standingslope->flags & SL_NOPHYSICS)) && abs(player->mo->standingslope->zdelta) >= FRACUNIT/2) -#endif - ) && !(player->pflags & PF_USEDOWN) && !(player->pflags & PF_SPINNING)) + /////////////////////////////// + // ability-specific behavior // + /////////////////////////////// + if (!(player->pflags & PF_SLIDING) && !player->exiting && !P_PlayerInPain(player)) + { + switch (player->charability2) { - player->pflags |= PF_SPINNING; - P_SetPlayerMobjState(player->mo, S_PLAY_SPIN); - if (!player->spectator) - S_StartSound(player->mo, sfx_spin); - player->pflags |= PF_USEDOWN; + case CA2_SPINDASH: // Spinning and Spindashing + // Start revving + if ((cmd->buttons & BT_USE) && player->speed < FixedMul(5<mo->scale) + && !player->mo->momz && onground && !(player->pflags & (PF_USEDOWN|PF_SPINNING)) + && canstand) + { + player->mo->momx = player->cmomx; + player->mo->momy = player->cmomy; + player->pflags |= PF_STARTDASH|PF_SPINNING; + player->dashspeed = player->mindash; + P_SetPlayerMobjState(player->mo, S_PLAY_DASH); + player->pflags |= PF_USEDOWN; + if (!player->spectator) + S_StartSound(player->mo, sfx_s3kab); // Make the rev sound! Previously sfx_spndsh. + } + // Revving + else if ((cmd->buttons & BT_USE) && (player->pflags & PF_STARTDASH)) + { + if (player->dashspeed < player->maxdash) + { +#define chargecalculation (6*(player->dashspeed - player->mindash))/(player->maxdash - player->mindash) + fixed_t soundcalculation = chargecalculation; + player->dashspeed += FRACUNIT; + if (!player->spectator && soundcalculation != chargecalculation) + S_StartSound(player->mo, sfx_s3kab); // Make the rev sound! Previously sfx_spndsh. +#undef chargecalculation + } + if (player->revitem && !(leveltime % 5)) // Now spawn the color thok circle. + { + P_SpawnSpinMobj(player, player->revitem); + if (demorecording) + G_GhostAddRev(); + } + } + + // If not moving up or down, and travelling faster than a speed of four while not holding + // down the spin button and not spinning. + // AKA Just go into a spin on the ground, you idiot. ;) + else if ((cmd->buttons & BT_USE || ((twodlevel || (player->mo->flags2 & MF2_TWOD)) && cmd->forwardmove < -20)) + && !player->climbing && !player->mo->momz && onground && (player->speed > FixedMul(5<mo->scale) + || !canstand) && !(player->pflags & (PF_USEDOWN|PF_SPINNING))) + { + player->pflags |= PF_SPINNING; + P_SetPlayerMobjState(player->mo, S_PLAY_SPIN); + if (!player->spectator) + S_StartSound(player->mo, sfx_spin); + player->pflags |= PF_USEDOWN; + } + break; + case CA2_MELEE: // Melee attack + if (!(player->panim == PA_ABILITY2) && (cmd->buttons & BT_USE) && player->speed < FixedMul(10<mo->scale) + && !player->mo->momz && onground && !(player->pflags & PF_USEDOWN) + && canstand) + { + P_ResetPlayer(player); + player->mo->z += P_MobjFlip(player->mo); + player->mo->momx = player->cmomx = 0; + player->mo->momy = player->cmomy = 0; + P_SetObjectMomZ(player->mo, player->mindash, false); + P_InstaThrust(player->mo, player->mo->angle, FixedMul(player->maxdash, player->mo->scale)); + P_SetPlayerMobjState(player->mo, S_PLAY_MELEE); + player->pflags |= PF_USEDOWN; + S_StartSound(player->mo, sfx_s3k8b); + } + break; } } + /////////////////////////////// + // general spinning behavior // + /////////////////////////////// + // Rolling normally if (onground && player->pflags & PF_SPINNING && !(player->pflags & PF_STARTDASH) - && player->speed < FixedMul(5*FRACUNIT,player->mo->scale) -#ifdef ESLOPE - && (!player->mo->standingslope || (player->mo->standingslope->flags & SL_NOPHYSICS) || abs(player->mo->standingslope->zdelta) < FRACUNIT/2) -#endif - ) + && player->speed < FixedMul(5*FRACUNIT,player->mo->scale) && canstand) { if (GETSECSPECIAL(player->mo->subsector->sector->special, 4) == 7 || (player->mo->ceilingz - player->mo->floorz < P_GetPlayerHeight(player))) P_InstaThrust(player->mo, player->mo->angle, FixedMul(10*FRACUNIT, player->mo->scale)); @@ -3792,29 +3850,12 @@ static void P_DoSpinAbility(player_t *player, ticcmd_t *cmd) { if (player->mo->state-states != S_PLAY_DASH) P_SetPlayerMobjState(player->mo, S_PLAY_DASH); + // Spawn spin dash dust + if (!(player->mo->eflags & MFE_GOOWATER)) + P_DoSpinDashDust(player); } else if (onground && player->pflags & PF_SPINNING && !(player->panim == PA_ROLL)) P_SetPlayerMobjState(player->mo, S_PLAY_SPIN); - - // Melee attack - if ((player->charability2 == CA2_MELEE) && !(player->panim == PA_ABILITY2) && !player->exiting - && !P_PlayerInPain(player) && (cmd->buttons & BT_USE) && player->speed < FixedMul(10<mo->scale) - && !player->mo->momz && onground && !(player->pflags & PF_USEDOWN) -#ifdef ESLOPE - && (!player->mo->standingslope || (player->mo->standingslope->flags & SL_NOPHYSICS) || abs(player->mo->standingslope->zdelta) < FRACUNIT/2) -#endif - ) - { - P_ResetPlayer(player); - player->mo->z += P_MobjFlip(player->mo); - player->mo->momx = player->cmomx = 0; - player->mo->momy = player->cmomy = 0; - P_SetObjectMomZ(player->mo, player->mindash, false); - P_InstaThrust(player->mo, player->mo->angle, FixedMul(player->maxdash, player->mo->scale)); - P_SetPlayerMobjState(player->mo, S_PLAY_MELEE); - player->pflags |= PF_USEDOWN; - S_StartSound(player->mo, sfx_s3k8b); - } } // From 47c67472ff3ce02ae646c342ec36f5e834ace232 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Thu, 10 Nov 2016 21:09:05 +0000 Subject: [PATCH 099/172] Added bubble form of spin dust --- src/dehacked.c | 4 ++++ src/info.c | 5 ++++- src/info.h | 4 ++++ src/p_mobj.c | 7 +++++++ src/p_user.c | 15 +++++---------- 5 files changed, 24 insertions(+), 11 deletions(-) diff --git a/src/dehacked.c b/src/dehacked.c index 3ef8b0d29..487ef8cd9 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -5571,6 +5571,10 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit "S_SPINDUST2", "S_SPINDUST3", "S_SPINDUST4", + "S_SPINDUST_BUBBLE1", + "S_SPINDUST_BUBBLE2", + "S_SPINDUST_BUBBLE3", + "S_SPINDUST_BUBBLE4", "S_FOG1", "S_FOG2", diff --git a/src/info.c b/src/info.c index 459238917..d9bf9b463 100644 --- a/src/info.c +++ b/src/info.c @@ -2281,11 +2281,14 @@ state_t states[NUMSTATES] = {SPR_WZAP, FF_TRANS10|FF_ANIMATE|FF_RANDOMANIM, 4, {NULL}, 3, 2, S_NULL}, // S_WATERZAP // Spindash dust - // TODO: other spin dust types {SPR_DUST, 0, 7, {NULL}, 0, 0, S_SPINDUST2}, // S_SPINDUST1 {SPR_DUST, 1, 6, {NULL}, 0, 0, S_SPINDUST3}, // S_SPINDUST2 {SPR_DUST, FF_TRANS30|2, 4, {NULL}, 0, 0, S_SPINDUST4}, // S_SPINDUST3 {SPR_DUST, FF_TRANS60|3, 3, {NULL}, 0, 0, S_NULL}, // S_SPINDUST4 + {SPR_BUBL, 0, 7, {NULL}, 0, 0, S_SPINDUST_BUBBLE2}, // S_SPINDUST_BUBBLE1 + {SPR_BUBL, 0, 6, {NULL}, 0, 0, S_SPINDUST_BUBBLE3}, // S_SPINDUST_BUBBLE2 + {SPR_BUBL, FF_TRANS30|0, 4, {NULL}, 0, 0, S_SPINDUST_BUBBLE4}, // S_SPINDUST_BUBBLE3 + {SPR_BUBL, FF_TRANS60|0, 3, {NULL}, 0, 0, S_NULL}, // S_SPINDUST_BUBBLE4 {SPR_TFOG, FF_FULLBRIGHT|FF_TRANS50, 2, {NULL}, 0, 0, S_FOG2}, // S_FOG1 {SPR_TFOG, FF_FULLBRIGHT|FF_TRANS50|1, 2, {NULL}, 0, 0, S_FOG3}, // S_FOG2 diff --git a/src/info.h b/src/info.h index fc5012d29..4545bbbd6 100644 --- a/src/info.h +++ b/src/info.h @@ -2463,6 +2463,10 @@ typedef enum state S_SPINDUST2, S_SPINDUST3, S_SPINDUST4, + S_SPINDUST_BUBBLE1, + S_SPINDUST_BUBBLE2, + S_SPINDUST_BUBBLE3, + S_SPINDUST_BUBBLE4, S_FOG1, S_FOG2, diff --git a/src/p_mobj.c b/src/p_mobj.c index abe7849f2..827d24f3c 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -7541,6 +7541,13 @@ void P_MobjThinker(mobj_t *mobj) mobj->momx = FixedMul(mobj->momx, (3*FRACUNIT)/4); // originally 50000 mobj->momy = FixedMul(mobj->momy, (3*FRACUNIT)/4); // same //mobj->momz = mobj->momz+P_MobjFlip(mobj)/3; // no meaningful change in value to be frank + if (mobj->state >= &states[S_SPINDUST_BUBBLE1] && mobj->state <= &states[S_SPINDUST_BUBBLE4]) // bubble dust! + { + P_MobjCheckWater(mobj); + if (mobj->watertop != mobj->subsector->sector->floorheight - 1000*FRACUNIT + && mobj->z+mobj->height >= mobj->watertop - 5*FRACUNIT) + mobj->flags2 |= MF2_DONTDRAW; + } break; case MT_SPINFIRE: if (mobj->eflags & MFE_VERTICALFLIP) diff --git a/src/p_user.c b/src/p_user.c index 02ab2044c..7fe015a39 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -3671,19 +3671,14 @@ static void P_DoSpinDashDust(player_t *player) { UINT32 i; mobj_t *particle; - UINT32 prandom[3]; + INT32 prandom[3]; for (i = 0; i <= (leveltime%7)/2; i++) { // 1, 2, 3 or 4 particles particle = P_SpawnMobjFromMobj(player->mo, 0, 0, 0, MT_SPINDUST); - if (player->powers[pw_shield] == SH_ELEMENTAL && !(player->mo->eflags & (MFE_TOUCHWATER|MFE_UNDERWATER))) { - //P_SetMobjState(particle, S_FIREDUST1); - //particle->bubble = false; - } else if (player->mo->eflags & (MFE_TOUCHWATER|MFE_UNDERWATER)) { - //P_SetMobjState(particle, S_BUBBLEDUST1); - //particle->bubble = true; - } else { - //P_SetMobjState(particle, S_SPINDUST1); - //particle->bubble = false; + /*if (player->powers[pw_shield] == SH_ELEMENTAL && !(player->mo->eflags & (MFE_TOUCHWATER|MFE_UNDERWATER))) { + P_SetMobjState(particle, S_SPINDUST_FIRE; + } else */if (player->mo->eflags & (MFE_TOUCHWATER|MFE_UNDERWATER)) { + P_SetMobjState(particle, S_SPINDUST_BUBBLE1); } P_SetTarget(&particle->target, player->mo); particle->destscale = (2*player->mo->scale)/3; From 286a8b0289c8c0c40190f66f2473b287788806f1 Mon Sep 17 00:00:00 2001 From: toasterbabe Date: Sat, 12 Nov 2016 14:08:27 +0000 Subject: [PATCH 100/172] Nev3r wants to make barrels which are both shootable and die when you break them like you break monitors. To that end, I've made MF_MONITOR *without* MF_SHOOTABLE act like MF_MONITOR does, and MF_SHOOTABLE allow for both missiles AND players to destroy. This has had the side effect of allowing MF_ENEMY and MF_BOSS to use MF_MONITOR as a substitute for MF_SHOOTABLE that doesn't allow missiles to cause them damage, which might be useful for Jetty-syns. --- src/info.c | 70 +++++++++++++++++++++++++-------------------------- src/p_enemy.c | 2 +- src/p_inter.c | 4 +-- src/p_map.c | 3 --- 4 files changed, 38 insertions(+), 41 deletions(-) diff --git a/src/info.c b/src/info.c index 802f90f26..585d3e286 100644 --- a/src/info.c +++ b/src/info.c @@ -6019,7 +6019,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = 100, // mass MT_RING_ICON, // damage sfx_None, // activesound - MF_SOLID|MF_SHOOTABLE|MF_MONITOR, // flags + MF_SOLID|MF_MONITOR, // flags S_NULL // raisestate }, @@ -6046,7 +6046,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = 100, // mass MT_PITY_ICON, // damage sfx_None, // activesound - MF_SOLID|MF_SHOOTABLE|MF_MONITOR, // flags + MF_SOLID|MF_MONITOR, // flags S_NULL // raisestate }, @@ -6073,7 +6073,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = 100, // mass MT_ATTRACT_ICON,// damage sfx_None, // activesound - MF_SOLID|MF_SHOOTABLE|MF_MONITOR, // flags + MF_SOLID|MF_MONITOR, // flags S_NULL // raisestate }, @@ -6100,7 +6100,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = 100, // mass MT_FORCE_ICON, // damage sfx_None, // activesound - MF_SOLID|MF_SHOOTABLE|MF_MONITOR, // flags + MF_SOLID|MF_MONITOR, // flags S_NULL // raisestate }, @@ -6127,7 +6127,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = 100, // mass MT_ARMAGEDDON_ICON, // damage sfx_None, // activesound - MF_SOLID|MF_SHOOTABLE|MF_MONITOR, // flags + MF_SOLID|MF_MONITOR, // flags S_NULL // raisestate }, @@ -6154,7 +6154,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = 100, // mass MT_WHIRLWIND_ICON, // damage sfx_None, // activesound - MF_SOLID|MF_SHOOTABLE|MF_MONITOR, // flags + MF_SOLID|MF_MONITOR, // flags S_NULL // raisestate }, @@ -6181,7 +6181,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = 100, // mass MT_ELEMENTAL_ICON, // damage sfx_None, // activesound - MF_SOLID|MF_SHOOTABLE|MF_MONITOR, // flags + MF_SOLID|MF_MONITOR, // flags S_NULL // raisestate }, @@ -6208,7 +6208,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = 100, // mass MT_SNEAKERS_ICON, // damage sfx_None, // activesound - MF_SOLID|MF_SHOOTABLE|MF_MONITOR, // flags + MF_SOLID|MF_MONITOR, // flags S_NULL // raisestate }, @@ -6235,7 +6235,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = 100, // mass MT_INVULN_ICON, // damage sfx_None, // activesound - MF_SOLID|MF_SHOOTABLE|MF_MONITOR, // flags + MF_SOLID|MF_MONITOR, // flags S_NULL // raisestate }, @@ -6262,7 +6262,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = 100, // mass MT_1UP_ICON, // damage sfx_None, // activesound - MF_SOLID|MF_SHOOTABLE|MF_MONITOR, // flags + MF_SOLID|MF_MONITOR, // flags S_NULL // raisestate }, @@ -6289,7 +6289,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = 100, // mass MT_EGGMAN_ICON, // damage sfx_None, // activesound - MF_SOLID|MF_SHOOTABLE|MF_MONITOR, // flags + MF_SOLID|MF_MONITOR, // flags S_NULL // raisestate }, @@ -6316,7 +6316,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = 100, // mass MT_MIXUP_ICON, // damage sfx_None, // activesound - MF_SOLID|MF_SHOOTABLE|MF_MONITOR, // flags + MF_SOLID|MF_MONITOR, // flags S_NULL // raisestate }, @@ -6343,7 +6343,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = 100, // mass MT_UNKNOWN, // damage sfx_None, // activesound - MF_SOLID|MF_SHOOTABLE|MF_MONITOR, // flags + MF_SOLID|MF_MONITOR, // flags S_NULL // raisestate }, @@ -6370,7 +6370,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = 100, // mass MT_GRAVITY_ICON, // damage sfx_None, // activesound - MF_SOLID|MF_SHOOTABLE|MF_MONITOR, // flags + MF_SOLID|MF_MONITOR, // flags S_NULL // raisestate }, @@ -6397,7 +6397,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = 100, // mass MT_RECYCLER_ICON, // damage sfx_None, // activesound - MF_SOLID|MF_SHOOTABLE|MF_MONITOR, // flags + MF_SOLID|MF_MONITOR, // flags S_NULL // raisestate }, @@ -6424,7 +6424,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = 100, // mass MT_SCORE1K_ICON, // damage sfx_None, // activesound - MF_SOLID|MF_SHOOTABLE|MF_MONITOR, // flags + MF_SOLID|MF_MONITOR, // flags S_NULL // raisestate }, @@ -6451,7 +6451,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = 100, // mass MT_SCORE10K_ICON, // damage sfx_None, // activesound - MF_SOLID|MF_SHOOTABLE|MF_MONITOR, // flags + MF_SOLID|MF_MONITOR, // flags S_NULL // raisestate }, @@ -6478,7 +6478,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = 100, // mass MT_FLAMEAURA_ICON, // damage sfx_None, // activesound - MF_SOLID|MF_SHOOTABLE|MF_MONITOR, // flags + MF_SOLID|MF_MONITOR, // flags S_NULL // raisestate }, @@ -6505,7 +6505,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = 100, // mass MT_BUBBLEWRAP_ICON, // damage sfx_None, // activesound - MF_SOLID|MF_SHOOTABLE|MF_MONITOR, // flags + MF_SOLID|MF_MONITOR, // flags S_NULL // raisestate }, @@ -6532,7 +6532,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = 100, // mass MT_THUNDERCOIN_ICON, // damage sfx_None, // activesound - MF_SOLID|MF_SHOOTABLE|MF_MONITOR, // flags + MF_SOLID|MF_MONITOR, // flags S_NULL // raisestate }, @@ -6559,7 +6559,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = 100, // mass MT_PITY_ICON, // damage sfx_None, // activesound - MF_SOLID|MF_SHOOTABLE|MF_MONITOR|MF_GRENADEBOUNCE, // flags + MF_SOLID|MF_MONITOR|MF_GRENADEBOUNCE, // flags S_NULL // raisestate }, @@ -6586,7 +6586,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = 100, // mass MT_ATTRACT_ICON,// damage sfx_None, // activesound - MF_SOLID|MF_SHOOTABLE|MF_MONITOR|MF_GRENADEBOUNCE, // flags + MF_SOLID|MF_MONITOR|MF_GRENADEBOUNCE, // flags S_NULL // raisestate }, @@ -6613,7 +6613,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = 100, // mass MT_FORCE_ICON, // damage sfx_None, // activesound - MF_SOLID|MF_SHOOTABLE|MF_MONITOR|MF_GRENADEBOUNCE, // flags + MF_SOLID|MF_MONITOR|MF_GRENADEBOUNCE, // flags S_NULL // raisestate }, @@ -6640,7 +6640,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = 100, // mass MT_ARMAGEDDON_ICON, // damage sfx_None, // activesound - MF_SOLID|MF_SHOOTABLE|MF_MONITOR|MF_GRENADEBOUNCE, // flags + MF_SOLID|MF_MONITOR|MF_GRENADEBOUNCE, // flags S_NULL // raisestate }, @@ -6667,7 +6667,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = 100, // mass MT_WHIRLWIND_ICON, // damage sfx_None, // activesound - MF_SOLID|MF_SHOOTABLE|MF_MONITOR|MF_GRENADEBOUNCE, // flags + MF_SOLID|MF_MONITOR|MF_GRENADEBOUNCE, // flags S_NULL // raisestate }, @@ -6694,7 +6694,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = 100, // mass MT_ELEMENTAL_ICON, // damage sfx_None, // activesound - MF_SOLID|MF_SHOOTABLE|MF_MONITOR|MF_GRENADEBOUNCE, // flags + MF_SOLID|MF_MONITOR|MF_GRENADEBOUNCE, // flags S_NULL // raisestate }, @@ -6721,7 +6721,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = 100, // mass MT_SNEAKERS_ICON, // damage sfx_None, // activesound - MF_SOLID|MF_SHOOTABLE|MF_MONITOR|MF_GRENADEBOUNCE, // flags + MF_SOLID|MF_MONITOR|MF_GRENADEBOUNCE, // flags S_NULL // raisestate }, @@ -6748,7 +6748,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = 100, // mass MT_INVULN_ICON, // damage sfx_None, // activesound - MF_SOLID|MF_SHOOTABLE|MF_MONITOR|MF_GRENADEBOUNCE, // flags + MF_SOLID|MF_MONITOR|MF_GRENADEBOUNCE, // flags S_NULL // raisestate }, @@ -6775,7 +6775,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = 100, // mass MT_EGGMAN_ICON, // damage sfx_None, // activesound - MF_SOLID|MF_SHOOTABLE|MF_MONITOR|MF_GRENADEBOUNCE, // flags + MF_SOLID|MF_MONITOR|MF_GRENADEBOUNCE, // flags S_NULL // raisestate }, @@ -6802,7 +6802,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = 100, // mass MT_GRAVITY_ICON, // damage sfx_None, // activesound - MF_SOLID|MF_SHOOTABLE|MF_MONITOR|MF_GRENADEBOUNCE, // flags + MF_SOLID|MF_MONITOR|MF_GRENADEBOUNCE, // flags S_NULL // raisestate }, @@ -6829,7 +6829,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = 100, // mass MT_FLAMEAURA_ICON, // damage sfx_None, // activesound - MF_SOLID|MF_SHOOTABLE|MF_MONITOR|MF_GRENADEBOUNCE, // flags + MF_SOLID|MF_MONITOR|MF_GRENADEBOUNCE, // flags S_NULL // raisestate }, @@ -6856,7 +6856,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = 100, // mass MT_BUBBLEWRAP_ICON, // damage sfx_None, // activesound - MF_SOLID|MF_SHOOTABLE|MF_MONITOR|MF_GRENADEBOUNCE, // flags + MF_SOLID|MF_MONITOR|MF_GRENADEBOUNCE, // flags S_NULL // raisestate }, @@ -6883,7 +6883,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = 100, // mass MT_THUNDERCOIN_ICON, // damage sfx_None, // activesound - MF_SOLID|MF_SHOOTABLE|MF_MONITOR|MF_GRENADEBOUNCE, // flags + MF_SOLID|MF_MONITOR|MF_GRENADEBOUNCE, // flags S_NULL // raisestate }, @@ -6910,7 +6910,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = 100, // mass MT_RING_ICON, // damage sfx_None, // activesound - MF_SOLID|MF_SHOOTABLE|MF_MONITOR, // flags + MF_SOLID|MF_MONITOR, // flags S_NULL // raisestate }, @@ -6937,7 +6937,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = 100, // mass MT_RING_ICON, // damage sfx_None, // activesound - MF_SOLID|MF_SHOOTABLE|MF_MONITOR, // flags + MF_SOLID|MF_MONITOR, // flags S_NULL // raisestate }, diff --git a/src/p_enemy.c b/src/p_enemy.c index fb0e41903..a9f340c98 100644 --- a/src/p_enemy.c +++ b/src/p_enemy.c @@ -2744,7 +2744,7 @@ void A_GoldMonitorRestore(mobj_t *actor) return; #endif - actor->flags |= MF_MONITOR|MF_SHOOTABLE; + actor->flags |= MF_MONITOR|(mobjinfo[actor->type].flags & MF_SHOOTABLE); actor->flags2 &= ~MF2_STANDONME; actor->health = 1; // Just in case. } diff --git a/src/p_inter.c b/src/p_inter.c index 56e730017..2dba46592 100644 --- a/src/p_inter.c +++ b/src/p_inter.c @@ -2907,14 +2907,14 @@ boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 da if (!force) { - if (!(target->flags & MF_SHOOTABLE)) + if (!(target->flags & (MF_SHOOTABLE|MF_MONITOR))) return false; // shouldn't happen... if (target->type == MT_BLACKEGGMAN) return false; // Make sure that boxes cannot be popped by enemies, red rings, etc. - if (target->flags & MF_MONITOR && ((!source || !source->player || source->player->bot) || (inflictor && !inflictor->player))) + if (!(target->flags & MF_SHOOTABLE) && ((!source || !source->player || source->player->bot) || (inflictor && !inflictor->player))) return false; } diff --git a/src/p_map.c b/src/p_map.c index 7afd266fd..9223da730 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -3357,9 +3357,6 @@ static boolean PIT_RadiusAttack(mobj_t *thing) if (thing->flags & MF_BOSS) return true; - if (thing->flags & MF_MONITOR) - return true; - dx = abs(thing->x - bombspot->x); dy = abs(thing->y - bombspot->y); dz = abs(thing->z + (thing->height>>1) - bombspot->z); From a88b21f70301e2dcc652ff4d4ddc9c4a67fe26e2 Mon Sep 17 00:00:00 2001 From: toasterbabe Date: Sat, 12 Nov 2016 14:34:25 +0000 Subject: [PATCH 101/172] Correction of some other relevant places to the previous commit. --- src/p_map.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/p_map.c b/src/p_map.c index 9223da730..d80e1ff41 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -434,7 +434,7 @@ static boolean PIT_CheckThing(mobj_t *thing) if (tmthing->type == MT_METALSONIC_RACE && (thing->flags & (MF_MISSILE|MF_ENEMY|MF_BOSS) || thing->type == MT_SPIKE)) { - if ((thing->flags & (MF_ENEMY|MF_BOSS)) && (thing->health <= 0 || !(thing->flags & MF_SHOOTABLE))) + if ((thing->flags & (MF_ENEMY|MF_BOSS)) && (thing->health <= 0 || !(thing->flags & (MF_SHOOTABLE|MF_MONITOR)))) return true; blockdist = thing->radius + tmthing->radius; if (abs(thing->x - tmx) >= blockdist || abs(thing->y - tmy) >= blockdist) @@ -463,12 +463,12 @@ static boolean PIT_CheckThing(mobj_t *thing) // CA_DASHMODE users destroy spikes and monitors, CA_TWINSPIN users and CA2_MELEE users destroy spikes. if ((tmthing->player) && (((tmthing->player->charability == CA_DASHMODE) && (tmthing->player->dashmode >= 3*TICRATE) - && (thing->flags & (MF_MONITOR) || thing->type == MT_SPIKE)) + && (thing->flags & MF_MONITOR || thing->type == MT_SPIKE)) || ((((tmthing->player->charability == CA_TWINSPIN) && (tmthing->player->panim == PA_ABILITY)) || (tmthing->player->charability2 == CA2_MELEE && tmthing->player->panim == PA_ABILITY2)) && (thing->type == MT_SPIKE)))) { - if ((thing->flags & (MF_MONITOR)) && (thing->health <= 0 || !(thing->flags & MF_SHOOTABLE))) + if ((thing->flags & (MF_MONITOR)) && (thing->health <= 0)) return true; blockdist = thing->radius + tmthing->radius; if (abs(thing->x - tmx) >= blockdist || abs(thing->y - tmy) >= blockdist) From 0cca852eb6cf665510a2f9cf00a0026b6228cde1 Mon Sep 17 00:00:00 2001 From: toasterbabe Date: Sat, 12 Nov 2016 15:39:42 +0000 Subject: [PATCH 102/172] Revert "Correction of some other relevant places to the previous commit." This reverts commit a88b21f70301e2dcc652ff4d4ddc9c4a67fe26e2. --- src/p_map.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/p_map.c b/src/p_map.c index d80e1ff41..9223da730 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -434,7 +434,7 @@ static boolean PIT_CheckThing(mobj_t *thing) if (tmthing->type == MT_METALSONIC_RACE && (thing->flags & (MF_MISSILE|MF_ENEMY|MF_BOSS) || thing->type == MT_SPIKE)) { - if ((thing->flags & (MF_ENEMY|MF_BOSS)) && (thing->health <= 0 || !(thing->flags & (MF_SHOOTABLE|MF_MONITOR)))) + if ((thing->flags & (MF_ENEMY|MF_BOSS)) && (thing->health <= 0 || !(thing->flags & MF_SHOOTABLE))) return true; blockdist = thing->radius + tmthing->radius; if (abs(thing->x - tmx) >= blockdist || abs(thing->y - tmy) >= blockdist) @@ -463,12 +463,12 @@ static boolean PIT_CheckThing(mobj_t *thing) // CA_DASHMODE users destroy spikes and monitors, CA_TWINSPIN users and CA2_MELEE users destroy spikes. if ((tmthing->player) && (((tmthing->player->charability == CA_DASHMODE) && (tmthing->player->dashmode >= 3*TICRATE) - && (thing->flags & MF_MONITOR || thing->type == MT_SPIKE)) + && (thing->flags & (MF_MONITOR) || thing->type == MT_SPIKE)) || ((((tmthing->player->charability == CA_TWINSPIN) && (tmthing->player->panim == PA_ABILITY)) || (tmthing->player->charability2 == CA2_MELEE && tmthing->player->panim == PA_ABILITY2)) && (thing->type == MT_SPIKE)))) { - if ((thing->flags & (MF_MONITOR)) && (thing->health <= 0)) + if ((thing->flags & (MF_MONITOR)) && (thing->health <= 0 || !(thing->flags & MF_SHOOTABLE))) return true; blockdist = thing->radius + tmthing->radius; if (abs(thing->x - tmx) >= blockdist || abs(thing->y - tmy) >= blockdist) From b7298a55742c7e249beb5cd6e34baff8fcb17360 Mon Sep 17 00:00:00 2001 From: toasterbabe Date: Sat, 12 Nov 2016 15:39:47 +0000 Subject: [PATCH 103/172] Revert "Nev3r wants to make barrels which are both shootable and die when you break them like you break monitors." This reverts commit 286a8b0289c8c0c40190f66f2473b287788806f1. --- src/info.c | 70 +++++++++++++++++++++++++-------------------------- src/p_enemy.c | 2 +- src/p_inter.c | 4 +-- src/p_map.c | 3 +++ 4 files changed, 41 insertions(+), 38 deletions(-) diff --git a/src/info.c b/src/info.c index 585d3e286..802f90f26 100644 --- a/src/info.c +++ b/src/info.c @@ -6019,7 +6019,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = 100, // mass MT_RING_ICON, // damage sfx_None, // activesound - MF_SOLID|MF_MONITOR, // flags + MF_SOLID|MF_SHOOTABLE|MF_MONITOR, // flags S_NULL // raisestate }, @@ -6046,7 +6046,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = 100, // mass MT_PITY_ICON, // damage sfx_None, // activesound - MF_SOLID|MF_MONITOR, // flags + MF_SOLID|MF_SHOOTABLE|MF_MONITOR, // flags S_NULL // raisestate }, @@ -6073,7 +6073,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = 100, // mass MT_ATTRACT_ICON,// damage sfx_None, // activesound - MF_SOLID|MF_MONITOR, // flags + MF_SOLID|MF_SHOOTABLE|MF_MONITOR, // flags S_NULL // raisestate }, @@ -6100,7 +6100,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = 100, // mass MT_FORCE_ICON, // damage sfx_None, // activesound - MF_SOLID|MF_MONITOR, // flags + MF_SOLID|MF_SHOOTABLE|MF_MONITOR, // flags S_NULL // raisestate }, @@ -6127,7 +6127,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = 100, // mass MT_ARMAGEDDON_ICON, // damage sfx_None, // activesound - MF_SOLID|MF_MONITOR, // flags + MF_SOLID|MF_SHOOTABLE|MF_MONITOR, // flags S_NULL // raisestate }, @@ -6154,7 +6154,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = 100, // mass MT_WHIRLWIND_ICON, // damage sfx_None, // activesound - MF_SOLID|MF_MONITOR, // flags + MF_SOLID|MF_SHOOTABLE|MF_MONITOR, // flags S_NULL // raisestate }, @@ -6181,7 +6181,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = 100, // mass MT_ELEMENTAL_ICON, // damage sfx_None, // activesound - MF_SOLID|MF_MONITOR, // flags + MF_SOLID|MF_SHOOTABLE|MF_MONITOR, // flags S_NULL // raisestate }, @@ -6208,7 +6208,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = 100, // mass MT_SNEAKERS_ICON, // damage sfx_None, // activesound - MF_SOLID|MF_MONITOR, // flags + MF_SOLID|MF_SHOOTABLE|MF_MONITOR, // flags S_NULL // raisestate }, @@ -6235,7 +6235,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = 100, // mass MT_INVULN_ICON, // damage sfx_None, // activesound - MF_SOLID|MF_MONITOR, // flags + MF_SOLID|MF_SHOOTABLE|MF_MONITOR, // flags S_NULL // raisestate }, @@ -6262,7 +6262,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = 100, // mass MT_1UP_ICON, // damage sfx_None, // activesound - MF_SOLID|MF_MONITOR, // flags + MF_SOLID|MF_SHOOTABLE|MF_MONITOR, // flags S_NULL // raisestate }, @@ -6289,7 +6289,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = 100, // mass MT_EGGMAN_ICON, // damage sfx_None, // activesound - MF_SOLID|MF_MONITOR, // flags + MF_SOLID|MF_SHOOTABLE|MF_MONITOR, // flags S_NULL // raisestate }, @@ -6316,7 +6316,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = 100, // mass MT_MIXUP_ICON, // damage sfx_None, // activesound - MF_SOLID|MF_MONITOR, // flags + MF_SOLID|MF_SHOOTABLE|MF_MONITOR, // flags S_NULL // raisestate }, @@ -6343,7 +6343,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = 100, // mass MT_UNKNOWN, // damage sfx_None, // activesound - MF_SOLID|MF_MONITOR, // flags + MF_SOLID|MF_SHOOTABLE|MF_MONITOR, // flags S_NULL // raisestate }, @@ -6370,7 +6370,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = 100, // mass MT_GRAVITY_ICON, // damage sfx_None, // activesound - MF_SOLID|MF_MONITOR, // flags + MF_SOLID|MF_SHOOTABLE|MF_MONITOR, // flags S_NULL // raisestate }, @@ -6397,7 +6397,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = 100, // mass MT_RECYCLER_ICON, // damage sfx_None, // activesound - MF_SOLID|MF_MONITOR, // flags + MF_SOLID|MF_SHOOTABLE|MF_MONITOR, // flags S_NULL // raisestate }, @@ -6424,7 +6424,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = 100, // mass MT_SCORE1K_ICON, // damage sfx_None, // activesound - MF_SOLID|MF_MONITOR, // flags + MF_SOLID|MF_SHOOTABLE|MF_MONITOR, // flags S_NULL // raisestate }, @@ -6451,7 +6451,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = 100, // mass MT_SCORE10K_ICON, // damage sfx_None, // activesound - MF_SOLID|MF_MONITOR, // flags + MF_SOLID|MF_SHOOTABLE|MF_MONITOR, // flags S_NULL // raisestate }, @@ -6478,7 +6478,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = 100, // mass MT_FLAMEAURA_ICON, // damage sfx_None, // activesound - MF_SOLID|MF_MONITOR, // flags + MF_SOLID|MF_SHOOTABLE|MF_MONITOR, // flags S_NULL // raisestate }, @@ -6505,7 +6505,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = 100, // mass MT_BUBBLEWRAP_ICON, // damage sfx_None, // activesound - MF_SOLID|MF_MONITOR, // flags + MF_SOLID|MF_SHOOTABLE|MF_MONITOR, // flags S_NULL // raisestate }, @@ -6532,7 +6532,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = 100, // mass MT_THUNDERCOIN_ICON, // damage sfx_None, // activesound - MF_SOLID|MF_MONITOR, // flags + MF_SOLID|MF_SHOOTABLE|MF_MONITOR, // flags S_NULL // raisestate }, @@ -6559,7 +6559,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = 100, // mass MT_PITY_ICON, // damage sfx_None, // activesound - MF_SOLID|MF_MONITOR|MF_GRENADEBOUNCE, // flags + MF_SOLID|MF_SHOOTABLE|MF_MONITOR|MF_GRENADEBOUNCE, // flags S_NULL // raisestate }, @@ -6586,7 +6586,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = 100, // mass MT_ATTRACT_ICON,// damage sfx_None, // activesound - MF_SOLID|MF_MONITOR|MF_GRENADEBOUNCE, // flags + MF_SOLID|MF_SHOOTABLE|MF_MONITOR|MF_GRENADEBOUNCE, // flags S_NULL // raisestate }, @@ -6613,7 +6613,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = 100, // mass MT_FORCE_ICON, // damage sfx_None, // activesound - MF_SOLID|MF_MONITOR|MF_GRENADEBOUNCE, // flags + MF_SOLID|MF_SHOOTABLE|MF_MONITOR|MF_GRENADEBOUNCE, // flags S_NULL // raisestate }, @@ -6640,7 +6640,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = 100, // mass MT_ARMAGEDDON_ICON, // damage sfx_None, // activesound - MF_SOLID|MF_MONITOR|MF_GRENADEBOUNCE, // flags + MF_SOLID|MF_SHOOTABLE|MF_MONITOR|MF_GRENADEBOUNCE, // flags S_NULL // raisestate }, @@ -6667,7 +6667,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = 100, // mass MT_WHIRLWIND_ICON, // damage sfx_None, // activesound - MF_SOLID|MF_MONITOR|MF_GRENADEBOUNCE, // flags + MF_SOLID|MF_SHOOTABLE|MF_MONITOR|MF_GRENADEBOUNCE, // flags S_NULL // raisestate }, @@ -6694,7 +6694,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = 100, // mass MT_ELEMENTAL_ICON, // damage sfx_None, // activesound - MF_SOLID|MF_MONITOR|MF_GRENADEBOUNCE, // flags + MF_SOLID|MF_SHOOTABLE|MF_MONITOR|MF_GRENADEBOUNCE, // flags S_NULL // raisestate }, @@ -6721,7 +6721,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = 100, // mass MT_SNEAKERS_ICON, // damage sfx_None, // activesound - MF_SOLID|MF_MONITOR|MF_GRENADEBOUNCE, // flags + MF_SOLID|MF_SHOOTABLE|MF_MONITOR|MF_GRENADEBOUNCE, // flags S_NULL // raisestate }, @@ -6748,7 +6748,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = 100, // mass MT_INVULN_ICON, // damage sfx_None, // activesound - MF_SOLID|MF_MONITOR|MF_GRENADEBOUNCE, // flags + MF_SOLID|MF_SHOOTABLE|MF_MONITOR|MF_GRENADEBOUNCE, // flags S_NULL // raisestate }, @@ -6775,7 +6775,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = 100, // mass MT_EGGMAN_ICON, // damage sfx_None, // activesound - MF_SOLID|MF_MONITOR|MF_GRENADEBOUNCE, // flags + MF_SOLID|MF_SHOOTABLE|MF_MONITOR|MF_GRENADEBOUNCE, // flags S_NULL // raisestate }, @@ -6802,7 +6802,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = 100, // mass MT_GRAVITY_ICON, // damage sfx_None, // activesound - MF_SOLID|MF_MONITOR|MF_GRENADEBOUNCE, // flags + MF_SOLID|MF_SHOOTABLE|MF_MONITOR|MF_GRENADEBOUNCE, // flags S_NULL // raisestate }, @@ -6829,7 +6829,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = 100, // mass MT_FLAMEAURA_ICON, // damage sfx_None, // activesound - MF_SOLID|MF_MONITOR|MF_GRENADEBOUNCE, // flags + MF_SOLID|MF_SHOOTABLE|MF_MONITOR|MF_GRENADEBOUNCE, // flags S_NULL // raisestate }, @@ -6856,7 +6856,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = 100, // mass MT_BUBBLEWRAP_ICON, // damage sfx_None, // activesound - MF_SOLID|MF_MONITOR|MF_GRENADEBOUNCE, // flags + MF_SOLID|MF_SHOOTABLE|MF_MONITOR|MF_GRENADEBOUNCE, // flags S_NULL // raisestate }, @@ -6883,7 +6883,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = 100, // mass MT_THUNDERCOIN_ICON, // damage sfx_None, // activesound - MF_SOLID|MF_MONITOR|MF_GRENADEBOUNCE, // flags + MF_SOLID|MF_SHOOTABLE|MF_MONITOR|MF_GRENADEBOUNCE, // flags S_NULL // raisestate }, @@ -6910,7 +6910,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = 100, // mass MT_RING_ICON, // damage sfx_None, // activesound - MF_SOLID|MF_MONITOR, // flags + MF_SOLID|MF_SHOOTABLE|MF_MONITOR, // flags S_NULL // raisestate }, @@ -6937,7 +6937,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = 100, // mass MT_RING_ICON, // damage sfx_None, // activesound - MF_SOLID|MF_MONITOR, // flags + MF_SOLID|MF_SHOOTABLE|MF_MONITOR, // flags S_NULL // raisestate }, diff --git a/src/p_enemy.c b/src/p_enemy.c index a9f340c98..fb0e41903 100644 --- a/src/p_enemy.c +++ b/src/p_enemy.c @@ -2744,7 +2744,7 @@ void A_GoldMonitorRestore(mobj_t *actor) return; #endif - actor->flags |= MF_MONITOR|(mobjinfo[actor->type].flags & MF_SHOOTABLE); + actor->flags |= MF_MONITOR|MF_SHOOTABLE; actor->flags2 &= ~MF2_STANDONME; actor->health = 1; // Just in case. } diff --git a/src/p_inter.c b/src/p_inter.c index 2dba46592..56e730017 100644 --- a/src/p_inter.c +++ b/src/p_inter.c @@ -2907,14 +2907,14 @@ boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 da if (!force) { - if (!(target->flags & (MF_SHOOTABLE|MF_MONITOR))) + if (!(target->flags & MF_SHOOTABLE)) return false; // shouldn't happen... if (target->type == MT_BLACKEGGMAN) return false; // Make sure that boxes cannot be popped by enemies, red rings, etc. - if (!(target->flags & MF_SHOOTABLE) && ((!source || !source->player || source->player->bot) || (inflictor && !inflictor->player))) + if (target->flags & MF_MONITOR && ((!source || !source->player || source->player->bot) || (inflictor && !inflictor->player))) return false; } diff --git a/src/p_map.c b/src/p_map.c index 9223da730..7afd266fd 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -3357,6 +3357,9 @@ static boolean PIT_RadiusAttack(mobj_t *thing) if (thing->flags & MF_BOSS) return true; + if (thing->flags & MF_MONITOR) + return true; + dx = abs(thing->x - bombspot->x); dy = abs(thing->y - bombspot->y); dz = abs(thing->z + (thing->height>>1) - bombspot->z); From c81665b9af3b901b449d9e932f0ffa8f452b755b Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Sun, 13 Nov 2016 22:02:29 +0000 Subject: [PATCH 104/172] Added flame version --- src/dehacked.c | 4 ++++ src/info.c | 6 ++++++ src/info.h | 5 +++++ src/p_user.c | 8 ++++---- 4 files changed, 19 insertions(+), 4 deletions(-) diff --git a/src/dehacked.c b/src/dehacked.c index 487ef8cd9..25429dba3 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -5575,6 +5575,10 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit "S_SPINDUST_BUBBLE2", "S_SPINDUST_BUBBLE3", "S_SPINDUST_BUBBLE4", + "S_SPINDUST_FIRE1", + "S_SPINDUST_FIRE2", + "S_SPINDUST_FIRE3", + "S_SPINDUST_FIRE4", "S_FOG1", "S_FOG2", diff --git a/src/info.c b/src/info.c index d9bf9b463..fb8291f4f 100644 --- a/src/info.c +++ b/src/info.c @@ -275,6 +275,7 @@ char sprnames[NUMSPRITES + 1][5] = "BUBL", // Bubble "WZAP", "DUST", // Spindash dust + "FPRT", // Spindash dust (flame) "TFOG", // Teleport Fog "SEED", // Sonic CD flower seed "PRTL", // Particle (for fans, etc.) @@ -2289,6 +2290,11 @@ state_t states[NUMSTATES] = {SPR_BUBL, 0, 6, {NULL}, 0, 0, S_SPINDUST_BUBBLE3}, // S_SPINDUST_BUBBLE2 {SPR_BUBL, FF_TRANS30|0, 4, {NULL}, 0, 0, S_SPINDUST_BUBBLE4}, // S_SPINDUST_BUBBLE3 {SPR_BUBL, FF_TRANS60|0, 3, {NULL}, 0, 0, S_NULL}, // S_SPINDUST_BUBBLE4 + {SPR_FPRT, 0, 7, {NULL}, 0, 0, S_SPINDUST_FIRE2}, // S_SPINDUST_FIRE1 + {SPR_FPRT, 0, 6, {NULL}, 0, 0, S_SPINDUST_FIRE3}, // S_SPINDUST_FIRE2 + {SPR_FPRT, FF_TRANS30|0, 4, {NULL}, 0, 0, S_SPINDUST_FIRE4}, // S_SPINDUST_FIRE3 + {SPR_FPRT, FF_TRANS60|0, 3, {NULL}, 0, 0, S_NULL}, // S_SPINDUST_FIRE4 + {SPR_TFOG, FF_FULLBRIGHT|FF_TRANS50, 2, {NULL}, 0, 0, S_FOG2}, // S_FOG1 {SPR_TFOG, FF_FULLBRIGHT|FF_TRANS50|1, 2, {NULL}, 0, 0, S_FOG3}, // S_FOG2 diff --git a/src/info.h b/src/info.h index 4545bbbd6..d3f4ad55a 100644 --- a/src/info.h +++ b/src/info.h @@ -467,6 +467,7 @@ typedef enum sprite SPR_BUBL, // Bubble SPR_WZAP, SPR_DUST, // Spindash dust + SPR_FPRT, // Spindash dust (flame) SPR_TFOG, // Teleport Fog SPR_SEED, // Sonic CD flower seed SPR_PRTL, // Particle (for fans, etc.) @@ -2467,6 +2468,10 @@ typedef enum state S_SPINDUST_BUBBLE2, S_SPINDUST_BUBBLE3, S_SPINDUST_BUBBLE4, + S_SPINDUST_FIRE1, + S_SPINDUST_FIRE2, + S_SPINDUST_FIRE3, + S_SPINDUST_FIRE4, S_FOG1, S_FOG2, diff --git a/src/p_user.c b/src/p_user.c index 7fe015a39..69fdc56b0 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -3675,11 +3675,11 @@ static void P_DoSpinDashDust(player_t *player) for (i = 0; i <= (leveltime%7)/2; i++) { // 1, 2, 3 or 4 particles particle = P_SpawnMobjFromMobj(player->mo, 0, 0, 0, MT_SPINDUST); - /*if (player->powers[pw_shield] == SH_ELEMENTAL && !(player->mo->eflags & (MFE_TOUCHWATER|MFE_UNDERWATER))) { - P_SetMobjState(particle, S_SPINDUST_FIRE; - } else */if (player->mo->eflags & (MFE_TOUCHWATER|MFE_UNDERWATER)) { + if (player->mo->eflags & (MFE_TOUCHWATER|MFE_UNDERWATER)) // overrides fire version P_SetMobjState(particle, S_SPINDUST_BUBBLE1); - } + else if (player->powers[pw_shield] == SH_ELEMENTAL) + P_SetMobjState(particle, S_SPINDUST_FIRE1); + P_SetTarget(&particle->target, player->mo); particle->destscale = (2*player->mo->scale)/3; P_SetScale(particle, particle->destscale); From 6e70acc82d60a7551a8e02f8c0315f9bdea572d4 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Sun, 13 Nov 2016 22:33:57 +0000 Subject: [PATCH 105/172] Added SF_NOSPINDASHDUST to disable spindash dust --- src/d_player.h | 1 + src/dehacked.c | 1 + src/p_user.c | 2 +- src/r_things.c | 1 + 4 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/d_player.h b/src/d_player.h index bd553d9fa..a39b058e2 100644 --- a/src/d_player.h +++ b/src/d_player.h @@ -44,6 +44,7 @@ typedef enum SF_STOMPDAMAGE = 1<<9, // Always damage enemies, etc by landing on them, no matter your vunerability? SF_MARIODAMAGE = SF_NOJUMPDAMAGE|SF_STOMPDAMAGE, // The Mario method of being able to damage enemies, etc. SF_MACHINE = 1<<10, // Beep boop. Are you a robot? + SF_NOSPINDASHDUST = 1<<11, // Don't spawn dust particles when charging a spindash // free up to and including 1<<31 } skinflags_t; diff --git a/src/dehacked.c b/src/dehacked.c index 25429dba3..3a8a42129 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -7060,6 +7060,7 @@ struct { {"SF_STOMPDAMAGE",SF_STOMPDAMAGE}, {"SF_MARIODAMAGE",SF_MARIODAMAGE}, {"SF_MACHINE",SF_MACHINE}, + {"SF_NOSPINDASHDUST",SF_NOSPINDASHDUST}, // Character abilities! // Primary diff --git a/src/p_user.c b/src/p_user.c index 69fdc56b0..9cab4c2cd 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -3846,7 +3846,7 @@ static void P_DoSpinAbility(player_t *player, ticcmd_t *cmd) if (player->mo->state-states != S_PLAY_DASH) P_SetPlayerMobjState(player->mo, S_PLAY_DASH); // Spawn spin dash dust - if (!(player->mo->eflags & MFE_GOOWATER)) + if (!(player->charflags & SF_NOSPINDASHDUST) && !(player->mo->eflags & MFE_GOOWATER)) P_DoSpinDashDust(player); } else if (onground && player->pflags & PF_SPINNING && !(player->panim == PA_ROLL)) diff --git a/src/r_things.c b/src/r_things.c index 9f6cad529..a55bc8582 100644 --- a/src/r_things.c +++ b/src/r_things.c @@ -2880,6 +2880,7 @@ void R_AddSkins(UINT16 wadnum) GETFLAG(STOMPDAMAGE) GETFLAG(MARIODAMAGE) GETFLAG(MACHINE) + GETFLAG(NOSPINDASHDUST) #undef GETFLAG else // let's check if it's a sound, otherwise error out From b9b5d203003ee2301f0ed2fc3919437cac4ef1b3 Mon Sep 17 00:00:00 2001 From: Alam Ed Arias Date: Sun, 13 Nov 2016 17:34:53 -0500 Subject: [PATCH 106/172] Makefile: move ZLIB flags outside of GME check --- src/Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Makefile b/src/Makefile index b83b201e6..493796820 100644 --- a/src/Makefile +++ b/src/Makefile @@ -318,9 +318,6 @@ LIBS+=$(PNG_LDFLAGS) CFLAGS+=$(PNG_CFLAGS) endif -ifdef HAVE_LIBGME -OPTS+=-DHAVE_LIBGME - ZLIB_PKGCONFIG?=zlib ZLIB_CFLAGS?=$(shell $(PKG_CONFIG) $(ZLIB_PKGCONFIG) --cflags) ZLIB_LDFLAGS?=$(shell $(PKG_CONFIG) $(ZLIB_PKGCONFIG) --libs) @@ -328,6 +325,9 @@ ZLIB_LDFLAGS?=$(shell $(PKG_CONFIG) $(ZLIB_PKGCONFIG) --libs) LIBS+=$(ZLIB_LDFLAGS) CFLAGS+=$(ZLIB_CFLAGS) +ifdef HAVE_LIBGME +OPTS+=-DHAVE_LIBGME + LIBGME_PKGCONFIG?=libgme LIBGME_CFLAGS?=$(shell $(PKG_CONFIG) $(LIBGME_PKGCONFIG) --cflags) LIBGME_LDFLAGS?=$(shell $(PKG_CONFIG) $(LIBGME_PKGCONFIG) --libs) From f5f25428499698d70adaa2f31ff8a471216e1e3f Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Wed, 16 Nov 2016 17:50:44 +0000 Subject: [PATCH 107/172] Go through all the polyobjects to find leftover polyobj planes to add to the draw nodes list I'm convinced there's going to be some stupid side effects from doing this, but it's the quickest way I can fix the polyobj planes not all appearing anyway --- src/r_things.c | 36 +++++++++++++++++++++++++++++++----- 1 file changed, 31 insertions(+), 5 deletions(-) diff --git a/src/r_things.c b/src/r_things.c index ed1ddeab9..927217c5c 100644 --- a/src/r_things.c +++ b/src/r_things.c @@ -1760,6 +1760,29 @@ static void R_CreateDrawNodes(void) } } +#ifdef POLYOBJECTS_PLANES + // find all the remaining polyobject planes and add them on the end of the list + // probably this is a terrible idea if we wanted them to be sorted properly + // but it works getting them in for now + for (i = 0; i < numPolyObjects; i++) + { + if (!PolyObjects[i].visplane) + continue; + plane = PolyObjects[i].visplane; + R_PlaneBounds(plane); + + if (plane->low < con_clipviewtop || plane->high > vid.height || plane->high > plane->low) + { + PolyObjects[i].visplane = NULL; + continue; + } + entry = R_CreateDrawNode(&nodehead); + entry->plane = plane; + // note: no seg is set, for what should be obvious reasons + PolyObjects[i].visplane = NULL; + } +#endif + if (visspritecount == 0) return; @@ -1816,13 +1839,16 @@ static void R_CreateDrawNodes(void) if (x1 < r2->plane->minx) x1 = r2->plane->minx; if (x2 > r2->plane->maxx) x2 = r2->plane->maxx; - for (i = x1; i <= x2; i++) + if (r2->seg) // if no seg set, assume the whole thing is in front or something stupid { - if (r2->seg->frontscale[i] > rover->scale) - break; + for (i = x1; i <= x2; i++) + { + if (r2->seg->frontscale[i] > rover->scale) + break; + } + if (i > x2) + continue; } - if (i > x2) - continue; entry = R_CreateDrawNode(NULL); (entry->prev = r2->prev)->next = entry; From 2941521806bdcb09612dab0aaf476ca64e1edbf0 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Wed, 16 Nov 2016 18:43:25 +0000 Subject: [PATCH 108/172] Add R_Draw2sMultiPatchTranslucentColumn_8, for columns of multi-patch textures used as midtextures on two-sided linedefs with both transparency AND translucency ...that was a mouthful --- src/r_draw.h | 1 + src/r_draw8.c | 97 +++++++++++++++++++++++++++++++++++++++++++++++++++ src/r_segs.c | 2 ++ src/screen.c | 2 ++ src/screen.h | 1 + 5 files changed, 103 insertions(+) diff --git a/src/r_draw.h b/src/r_draw.h index 60c3c9db6..4a105b5b0 100644 --- a/src/r_draw.h +++ b/src/r_draw.h @@ -162,6 +162,7 @@ void R_DrawSplat_8(void); void R_DrawTranslucentSplat_8(void); void R_DrawTranslucentSpan_8(void); void R_Draw2sMultiPatchColumn_8(void); +void R_Draw2sMultiPatchTranslucentColumn_8(void); void R_DrawFogSpan_8(void); void R_DrawFogColumn_8(void); void R_DrawColumnShadowed_8(void); diff --git a/src/r_draw8.c b/src/r_draw8.c index c1b7da11b..9340b61c6 100644 --- a/src/r_draw8.c +++ b/src/r_draw8.c @@ -203,6 +203,103 @@ void R_Draw2sMultiPatchColumn_8(void) } } +void R_Draw2sMultiPatchTranslucentColumn_8(void) +{ + INT32 count; + register UINT8 *dest; + register fixed_t frac; + fixed_t fracstep; + + count = dc_yh - dc_yl; + + if (count < 0) // Zero length, column does not exceed a pixel. + return; + +#ifdef RANGECHECK + if ((unsigned)dc_x >= (unsigned)vid.width || dc_yl < 0 || dc_yh >= vid.height) + return; +#endif + + // Framebuffer destination address. + // Use ylookup LUT to avoid multiply with ScreenWidth. + // Use columnofs LUT for subwindows? + + //dest = ylookup[dc_yl] + columnofs[dc_x]; + dest = &topleft[dc_yl*vid.width + dc_x]; + + count++; + + // Determine scaling, which is the only mapping to be done. + fracstep = dc_iscale; + //frac = dc_texturemid + (dc_yl - centery)*fracstep; + frac = (dc_texturemid + FixedMul((dc_yl << FRACBITS) - centeryfrac, fracstep))*(!dc_hires); + + // Inner loop that does the actual texture mapping, e.g. a DDA-like scaling. + // This is as fast as it gets. + { + register const UINT8 *source = dc_source; + register const UINT8 *transmap = dc_transmap; + register const lighttable_t *colormap = dc_colormap; + register INT32 heightmask = dc_texheight-1; + register UINT8 val; + if (dc_texheight & heightmask) // not a power of 2 -- killough + { + heightmask++; + heightmask <<= FRACBITS; + + if (frac < 0) + while ((frac += heightmask) < 0); + else + while (frac >= heightmask) + frac -= heightmask; + + do + { + // Re-map color indices from wall texture column + // using a lighting/special effects LUT. + // heightmask is the Tutti-Frutti fix + val = source[frac>>FRACBITS]; + + if (val != TRANSPARENTPIXEL) + *dest = colormap[*(transmap + (val<<8) + (*dest))]; + + dest += vid.width; + + // Avoid overflow. + if (fracstep > 0x7FFFFFFF - frac) + frac += fracstep - heightmask; + else + frac += fracstep; + + while (frac >= heightmask) + frac -= heightmask; + } while (--count); + } + else + { + while ((count -= 2) >= 0) // texture height is a power of 2 + { + val = source[(frac>>FRACBITS) & heightmask]; + if (val != TRANSPARENTPIXEL) + *dest = colormap[*(transmap + (val<<8) + (*dest))]; + dest += vid.width; + frac += fracstep; + val = source[(frac>>FRACBITS) & heightmask]; + if (val != TRANSPARENTPIXEL) + *dest = colormap[*(transmap + (val<<8) + (*dest))]; + dest += vid.width; + frac += fracstep; + } + if (count & 1) + { + val = source[(frac>>FRACBITS) & heightmask]; + if (val != TRANSPARENTPIXEL) + *dest = colormap[*(transmap + (val<<8) + (*dest))]; + } + } + } +} + /** \brief The R_DrawShadeColumn_8 function Experiment to make software go faster. Taken from the Boom source */ diff --git a/src/r_segs.c b/src/r_segs.c index 257be2989..3bd8b94c1 100644 --- a/src/r_segs.c +++ b/src/r_segs.c @@ -271,6 +271,8 @@ static void R_Render2sidedMultiPatchColumn(column_t *column) if (colfunc == wallcolfunc) twosmultipatchfunc(); + else if (colfunc == fuzzcolfunc) + twosmultipatchtransfunc(); else colfunc(); } diff --git a/src/screen.c b/src/screen.c index d00155785..97c865a97 100644 --- a/src/screen.c +++ b/src/screen.c @@ -49,6 +49,7 @@ void (*splatfunc)(void); // span drawer w/ transparency void (*basespanfunc)(void); // default span func for color mode void (*transtransfunc)(void); // translucent translated column drawer void (*twosmultipatchfunc)(void); // for cols with transparent pixels +void (*twosmultipatchtransfunc)(void); // for cols with transparent pixels AND translucency // ------------------ // global video state @@ -127,6 +128,7 @@ void SCR_SetMode(void) fuzzcolfunc = R_DrawTranslucentColumn_8; walldrawerfunc = R_DrawWallColumn_8; twosmultipatchfunc = R_Draw2sMultiPatchColumn_8; + twosmultipatchtransfunc = R_Draw2sMultiPatchTranslucentColumn_8; #ifdef RUSEASM if (R_ASM) { diff --git a/src/screen.h b/src/screen.h index 2dff4590e..a61de7f92 100644 --- a/src/screen.h +++ b/src/screen.h @@ -136,6 +136,7 @@ extern void (*basespanfunc)(void); extern void (*splatfunc)(void); extern void (*transtransfunc)(void); extern void (*twosmultipatchfunc)(void); +extern void (*twosmultipatchtransfunc)(void); // ----- // CPUID From f4705b01f4be780d877314a170f661c26ad327d8 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Mon, 21 Nov 2016 19:42:39 +0000 Subject: [PATCH 109/172] Don't call SDLESSet Turns out sdl12's version of this function only did stuff for DC/GP2X ports; support for them have been cut out for SDL2, so for now let's just not use the function at all --- src/sdl/i_video.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/sdl/i_video.c b/src/sdl/i_video.c index 71baca510..95d2a0ab2 100644 --- a/src/sdl/i_video.c +++ b/src/sdl/i_video.c @@ -1494,10 +1494,12 @@ void VID_PrepareModeList(void) #endif } +#if 0 static inline void SDLESSet(void) { SDL2STUB(); } +#endif INT32 VID_SetMode(INT32 modeNum) { @@ -1718,7 +1720,7 @@ void I_StartupGraphics(void) borderlesswindow = M_CheckParm("-borderless"); //SDL_EnableKeyRepeat(SDL_DEFAULT_REPEAT_DELAY>>1,SDL_DEFAULT_REPEAT_INTERVAL<<2); - SDLESSet(); + //SDLESSet(); // unused VID_Command_ModeList_f(); #ifdef HWRENDER if (M_CheckParm("-opengl") || rendermode == render_opengl) From 168f8d5c5eb9d2ff517169632289265bbbb29a70 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Mon, 21 Nov 2016 20:40:02 +0000 Subject: [PATCH 110/172] Un-stub Surfaceinfo and just print the parts that still work in SDL2 This means the console command vid_info also works properly too now (well, it does nothing in OpenGL mind) --- src/sdl/i_video.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/src/sdl/i_video.c b/src/sdl/i_video.c index 95d2a0ab2..70396e0c8 100644 --- a/src/sdl/i_video.c +++ b/src/sdl/i_video.c @@ -434,13 +434,8 @@ static void VID_Command_NumModes_f (void) static void SurfaceInfo(const SDL_Surface *infoSurface, const char *SurfaceText) { -#if 1 - (void)infoSurface; - (void)SurfaceText; - SDL2STUB(); -#else INT32 vfBPP; - const SDL_Surface *VidSur = SDL_GetVideoSurface(); + //const SDL_Surface *VidSur = SDL_GetVideoSurface(); // SDL2 doesn't have this if (!infoSurface) return; @@ -453,15 +448,16 @@ static void SurfaceInfo(const SDL_Surface *infoSurface, const char *SurfaceText) CONS_Printf("\x82" "%s\n", SurfaceText); CONS_Printf(M_GetText(" %ix%i at %i bit color\n"), infoSurface->w, infoSurface->h, vfBPP); + /* if (infoSurface->flags&SDL_HWSURFACE) CONS_Printf("%s", M_GetText(" Stored in video memory\n")); else if (infoSurface->flags&SDL_OPENGL) CONS_Printf("%s", M_GetText(" Stored in an OpenGL context\n")); - else if (infoSurface->flags&SDL_PREALLOC) + else */if (infoSurface->flags&SDL_PREALLOC) CONS_Printf("%s", M_GetText(" Uses preallocated memory\n")); else CONS_Printf("%s", M_GetText(" Stored in system memory\n")); - +/* if (infoSurface->flags&SDL_ASYNCBLIT) CONS_Printf("%s", M_GetText(" Uses asynchronous blits if possible\n")); else @@ -491,11 +487,13 @@ static void SurfaceInfo(const SDL_Surface *infoSurface, const char *SurfaceText) CONS_Printf("%s", M_GetText(" Uses hardware acceleration blit\n")); if (infoSurface->flags&SDL_SRCCOLORKEY) CONS_Printf("%s", M_GetText(" Use colorkey blitting\n")); +*/ if (infoSurface->flags&SDL_RLEACCEL) CONS_Printf("%s", M_GetText(" Colorkey RLE acceleration blit\n")); +/* if (infoSurface->flags&SDL_SRCALPHA) CONS_Printf("%s", M_GetText(" Use alpha blending acceleration blit\n")); -#endif +*/ } static void VID_Command_Info_f (void) From 208546165baf2b28803ff0114f22f676c806ddfc Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Mon, 21 Nov 2016 20:59:44 +0000 Subject: [PATCH 111/172] Comment out SDL2STUB from Impl_SetWindowIcon --- src/sdl/i_video.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sdl/i_video.c b/src/sdl/i_video.c index 70396e0c8..6ddfc391c 100644 --- a/src/sdl/i_video.c +++ b/src/sdl/i_video.c @@ -1620,7 +1620,7 @@ static void Impl_SetWindowIcon(void) { return; } - SDL2STUB(); + //SDL2STUB(); // Monster Iestyn: why is this stubbed? SDL_SetWindowIcon(window, icoSurface); } From 1606a45b186d340b7d800322dcd83a1e0531e433 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Mon, 21 Nov 2016 22:07:05 +0000 Subject: [PATCH 112/172] Some cleanup/reorganisation in SDLSetMode and Impl_CreateWindow --- src/sdl/i_video.c | 67 +++++++++++++++++++++++++++-------------------- 1 file changed, 39 insertions(+), 28 deletions(-) diff --git a/src/sdl/i_video.c b/src/sdl/i_video.c index 6ddfc391c..791d07524 100644 --- a/src/sdl/i_video.c +++ b/src/sdl/i_video.c @@ -189,14 +189,14 @@ static void SDLSetMode(INT32 width, INT32 height, SDL_bool fullscreen) wasfullscreen = SDL_TRUE; SDL_SetWindowFullscreen(window, SDL_WINDOW_FULLSCREEN_DESKTOP); } - else if (!fullscreen && wasfullscreen) + else if (wasfullscreen) { wasfullscreen = SDL_FALSE; SDL_SetWindowFullscreen(window, 0); SDL_SetWindowSize(window, width, height); SDL_SetWindowPosition(window, SDL_WINDOWPOS_CENTERED_DISPLAY(1), SDL_WINDOWPOS_CENTERED_DISPLAY(1)); } - else if (!wasfullscreen) + else { // Reposition window only in windowed mode SDL_SetWindowSize(window, width, height); @@ -1550,6 +1550,12 @@ INT32 VID_SetMode(INT32 modeNum) static SDL_bool Impl_CreateWindow(SDL_bool fullscreen) { int flags = 0; + + if (rendermode == render_none) // dedicated + { + return SDL_TRUE; // Monster Iestyn -- not sure if it really matters what we return here tbh + } + if (window != NULL) { return SDL_FALSE; @@ -1568,38 +1574,43 @@ static SDL_bool Impl_CreateWindow(SDL_bool fullscreen) #ifdef HWRENDER if (rendermode == render_opengl) { - window = SDL_CreateWindow("SRB2 "VERSIONSTRING, SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, - realwidth, realheight, flags | SDL_WINDOW_OPENGL); - if (window != NULL) - { - sdlglcontext = SDL_GL_CreateContext(window); - if (sdlglcontext == NULL) - { - SDL_DestroyWindow(window); - I_Error("Failed to create a GL context: %s\n", SDL_GetError()); - } - else - { - SDL_GL_MakeCurrent(window, sdlglcontext); - } - } - else return SDL_FALSE; + flags |= SDL_WINDOW_OPENGL; } #endif + + // Create a window + window = SDL_CreateWindow("SRB2 "VERSIONSTRING, SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, + realwidth, realheight, flags); + + if (window == NULL) + { + CONS_Printf(M_GetText("Couldn't create window: %s\n"), SDL_GetError()); + return SDL_FALSE; + } + + // Renderer-specific stuff +#ifdef HWRENDER + if (rendermode == render_opengl) + { + sdlglcontext = SDL_GL_CreateContext(window); + if (sdlglcontext == NULL) + { + SDL_DestroyWindow(window); + I_Error("Failed to create a GL context: %s\n", SDL_GetError()); + } + SDL_GL_MakeCurrent(window, sdlglcontext); + } + else +#endif if (rendermode == render_soft) { - window = SDL_CreateWindow("SRB2 "VERSIONSTRING, SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, - realwidth, realheight, flags); - if (window != NULL) + renderer = SDL_CreateRenderer(window, -1, (usesdl2soft ? SDL_RENDERER_SOFTWARE : 0) | (cv_vidwait.value && !usesdl2soft ? SDL_RENDERER_PRESENTVSYNC : 0)); + if (renderer == NULL) { - renderer = SDL_CreateRenderer(window, -1, (usesdl2soft ? SDL_RENDERER_SOFTWARE : 0) | (cv_vidwait.value && !usesdl2soft ? SDL_RENDERER_PRESENTVSYNC : 0)); - if (renderer != NULL) - { - SDL_RenderSetLogicalSize(renderer, BASEVIDWIDTH, BASEVIDHEIGHT); - } - else return SDL_FALSE; + CONS_Printf(M_GetText("Couldn't create rendering context: %s\n"), SDL_GetError()); + return SDL_FALSE; } - else return SDL_FALSE; + SDL_RenderSetLogicalSize(renderer, BASEVIDWIDTH, BASEVIDHEIGHT); } return SDL_TRUE; From 153ba39f1983a20cc3ae17e5828e7702be321e34 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Tue, 22 Nov 2016 22:41:02 +0000 Subject: [PATCH 113/172] Remove remnants of SDLK_ stuff, we use scancodes now not keycodes (Apparently SDLK_LMETA/SDLK_RMETA don't exist anymore in SDL2 anyway?) --- src/sdl/i_video.c | 8 -------- 1 file changed, 8 deletions(-) diff --git a/src/sdl/i_video.c b/src/sdl/i_video.c index 791d07524..a7a6ed151 100644 --- a/src/sdl/i_video.c +++ b/src/sdl/i_video.c @@ -33,14 +33,6 @@ #pragma warning(default : 4214 4244) #endif -#if SDL_VERSION_ATLEAST(1,3,0) -#define SDLK_EQUALS SDLK_KP_EQUALSAS400 -#define SDLK_LMETA SDLK_LGUI -#define SDLK_RMETA SDLK_RGUI -#else -#define HAVE_SDLMETAKEYS -#endif - #ifdef HAVE_TTF #include "i_ttf.h" #endif From 5cf4767aed86e25ec401e33cc7a35e6f5a10148b Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Wed, 23 Nov 2016 16:51:37 +0000 Subject: [PATCH 114/172] Clearing away lots of disabled code (some of it would no longer work on SDL2 anyway) --- src/sdl/i_video.c | 281 +--------------------------------------------- 1 file changed, 2 insertions(+), 279 deletions(-) diff --git a/src/sdl/i_video.c b/src/sdl/i_video.c index a7a6ed151..5b83a8814 100644 --- a/src/sdl/i_video.c +++ b/src/sdl/i_video.c @@ -424,10 +424,10 @@ static void VID_Command_NumModes_f (void) CONS_Printf(M_GetText("%d video mode(s) available(s)\n"), VID_NumModes()); } +// SDL2 doesn't have SDL_GetVideoSurface or a lot of the SDL_Surface flags that SDL 1.2 had static void SurfaceInfo(const SDL_Surface *infoSurface, const char *SurfaceText) { INT32 vfBPP; - //const SDL_Surface *VidSur = SDL_GetVideoSurface(); // SDL2 doesn't have this if (!infoSurface) return; @@ -440,52 +440,12 @@ static void SurfaceInfo(const SDL_Surface *infoSurface, const char *SurfaceText) CONS_Printf("\x82" "%s\n", SurfaceText); CONS_Printf(M_GetText(" %ix%i at %i bit color\n"), infoSurface->w, infoSurface->h, vfBPP); - /* - if (infoSurface->flags&SDL_HWSURFACE) - CONS_Printf("%s", M_GetText(" Stored in video memory\n")); - else if (infoSurface->flags&SDL_OPENGL) - CONS_Printf("%s", M_GetText(" Stored in an OpenGL context\n")); - else */if (infoSurface->flags&SDL_PREALLOC) + if (infoSurface->flags&SDL_PREALLOC) CONS_Printf("%s", M_GetText(" Uses preallocated memory\n")); else CONS_Printf("%s", M_GetText(" Stored in system memory\n")); -/* - if (infoSurface->flags&SDL_ASYNCBLIT) - CONS_Printf("%s", M_GetText(" Uses asynchronous blits if possible\n")); - else - CONS_Printf("%s", M_GetText(" Uses synchronous blits if possible\n")); - - if (infoSurface->flags&SDL_ANYFORMAT) - CONS_Printf("%s", M_GetText(" Allows any pixel-format\n")); - - if (infoSurface->flags&SDL_HWPALETTE) - CONS_Printf("%s", M_GetText(" Has exclusive palette access\n")); - else if (VidSur == infoSurface) - CONS_Printf("%s", M_GetText(" Has nonexclusive palette access\n")); - - if (infoSurface->flags&SDL_DOUBLEBUF) - CONS_Printf("%s", M_GetText(" Double buffered\n")); - else if (VidSur == infoSurface) - CONS_Printf("%s", M_GetText(" No hardware flipping\n")); - - if (infoSurface->flags&SDL_FULLSCREEN) - CONS_Printf("%s", M_GetText(" Full screen\n")); - else if (infoSurface->flags&SDL_RESIZABLE) - CONS_Printf("%s", M_GetText(" Resizable window\n")); - else if (VidSur == infoSurface) - CONS_Printf("%s", M_GetText(" Nonresizable window\n")); - - if (infoSurface->flags&SDL_HWACCEL) - CONS_Printf("%s", M_GetText(" Uses hardware acceleration blit\n")); - if (infoSurface->flags&SDL_SRCCOLORKEY) - CONS_Printf("%s", M_GetText(" Use colorkey blitting\n")); -*/ if (infoSurface->flags&SDL_RLEACCEL) CONS_Printf("%s", M_GetText(" Colorkey RLE acceleration blit\n")); -/* - if (infoSurface->flags&SDL_SRCALPHA) - CONS_Printf("%s", M_GetText(" Use alpha blending acceleration blit\n")); -*/ } static void VID_Command_Info_f (void) @@ -569,23 +529,6 @@ static void VID_Command_Mode_f (void) setmodeneeded = modenum+1; // request vid mode change } -#if 0 -#if defined(RPC_NO_WINDOWS_H) -static VOID MainWndproc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) -{ - UNREFERENCED_PARAMETER(hWnd); - UNREFERENCED_PARAMETER(message); - UNREFERENCED_PARAMETER(wParam); - switch (message) - { - case WM_SETTEXT: - COM_BufAddText((LPCSTR)lParam); - break; - } -} -#endif -#endif - static inline void SDLJoyRemap(event_t *event) { (void)event; @@ -944,218 +887,6 @@ void I_GetEvent(void) // In order to make wheels act like buttons, we have to set their state to Up. // This is because wheel messages don't have an up/down state. gamekeydown[KEY_MOUSEWHEELDOWN] = gamekeydown[KEY_MOUSEWHEELUP] = 0; - -#if 0 - SDL_Event inputEvent; - static SDL_bool sdlquit = SDL_FALSE; //Alam: once, just once - event_t event; - - if (!graphics_started) - return; - - memset(&inputEvent, 0x00, sizeof(inputEvent)); - while (SDL_PollEvent(&inputEvent)) - { - memset(&event,0x00,sizeof (event_t)); - switch (inputEvent.type) - { - case SDL_ACTIVEEVENT: - if (inputEvent.active.state & (SDL_APPACTIVE|SDL_APPINPUTFOCUS)) - { - // pause music when alt-tab - if (inputEvent.active.gain /*&& !paused */) - { - static SDL_bool firsttimeonmouse = SDL_TRUE; - if (!firsttimeonmouse) - { - if (cv_usemouse.value) I_StartupMouse(); - } - else firsttimeonmouse = SDL_FALSE; - //if (!netgame && !con_destlines) paused = false; - if (gamestate == GS_LEVEL) - if (!paused) I_ResumeSong(0); //resume it - } - else /*if (!paused)*/ - { - if (!disable_mouse) - SDLforceUngrabMouse(); - if (!netgame && gamestate == GS_LEVEL) paused = true; - memset(gamekeydown, 0, NUMKEYS); - //S_PauseSound(); - if (gamestate == GS_LEVEL) - I_PauseSong(0); //pause it - } - } - if (MOUSE_MENU) - { - SDLdoUngrabMouse(); - break; - } - if ((SDL_APPMOUSEFOCUS&inputEvent.active.state) && USE_MOUSEINPUT && inputEvent.active.gain) - HalfWarpMouse(realwidth, realheight); - break; - case SDL_KEYDOWN: - case SDL_KEYUP: - /// \todo inputEvent.key.which? - if (inputEvent.type == SDL_KEYUP) - event.type = ev_keyup; - else if (inputEvent.type == SDL_KEYDOWN) - event.type = ev_keydown; - else break; - event.data1 = SDLatekey(inputEvent.key.keysym.sym); - if (event.data1) D_PostEvent(&event); - break; - case SDL_MOUSEMOTION: - /// \todo inputEvent.motion.which - if (MOUSE_MENU) - { - SDLdoUngrabMouse(); - break; - } - //if (USE_MOUSEINPUT) TODO SDL2 stub - { - // If the event is from warping the pointer back to middle - // of the screen then ignore it. - if ((inputEvent.motion.x == realwidth/2) && - (inputEvent.motion.y == realheight/2)) - { - break; - } - else - { - event.data2 = +inputEvent.motion.xrel; - event.data3 = -inputEvent.motion.yrel; - } - event.type = ev_mouse; - D_PostEvent(&event); - // Warp the pointer back to the middle of the window - // or we cannot move any further if it's at a border. - if ((inputEvent.motion.x < (realwidth/2 )-(realwidth/4 )) || - (inputEvent.motion.y < (realheight/2)-(realheight/4)) || - (inputEvent.motion.x > (realwidth/2 )+(realwidth/4 )) || - (inputEvent.motion.y > (realheight/2)+(realheight/4) ) ) - { - //if (SDL_GRAB_ON == SDL_WM_GrabInput(SDL_GRAB_QUERY) || !mousegrabok) - HalfWarpMouse(realwidth, realheight); - } - } - break; - case SDL_MOUSEBUTTONDOWN: - case SDL_MOUSEBUTTONUP: - /// \todo inputEvent.button.which - if (USE_MOUSEINPUT) - { - if (inputEvent.type == SDL_MOUSEBUTTONUP) - event.type = ev_keyup; - else if (inputEvent.type == SDL_MOUSEBUTTONDOWN) - event.type = ev_keydown; - else break; - if (inputEvent.button.button==SDL_BUTTON_WHEELUP || inputEvent.button.button==SDL_BUTTON_WHEELDOWN) - { - if (inputEvent.type == SDL_MOUSEBUTTONUP) - event.data1 = 0; //Alam: dumb! this could be a real button with some mice - else - event.data1 = KEY_MOUSEWHEELUP + inputEvent.button.button - SDL_BUTTON_WHEELUP; - } - else if (inputEvent.button.button == SDL_BUTTON_MIDDLE) - event.data1 = KEY_MOUSE1+2; - else if (inputEvent.button.button == SDL_BUTTON_RIGHT) - event.data1 = KEY_MOUSE1+1; - else if (inputEvent.button.button <= MOUSEBUTTONS) - event.data1 = KEY_MOUSE1 + inputEvent.button.button - SDL_BUTTON_LEFT; - if (event.data1) D_PostEvent(&event); - } - break; - case SDL_JOYAXISMOTION: - inputEvent.jaxis.which++; - inputEvent.jaxis.axis++; - event.data1 = event.data2 = event.data3 = INT32_MAX; - if (cv_usejoystick.value == inputEvent.jaxis.which) - { - event.type = ev_joystick; - } - else if (cv_usejoystick.value == inputEvent.jaxis.which) - { - event.type = ev_joystick2; - } - else break; - //axis - if (inputEvent.jaxis.axis > JOYAXISSET*2) - break; - //vaule - if (inputEvent.jaxis.axis%2) - { - event.data1 = inputEvent.jaxis.axis / 2; - event.data2 = SDLJoyAxis(inputEvent.jaxis.value, event.type); - } - else - { - inputEvent.jaxis.axis--; - event.data1 = inputEvent.jaxis.axis / 2; - event.data3 = SDLJoyAxis(inputEvent.jaxis.value, event.type); - } - D_PostEvent(&event); - break; - case SDL_JOYBALLMOTION: - case SDL_JOYHATMOTION: - break; //NONE - case SDL_JOYBUTTONDOWN: - case SDL_JOYBUTTONUP: - inputEvent.jbutton.which++; - if (cv_usejoystick.value == inputEvent.jbutton.which) - event.data1 = KEY_JOY1; - else if (cv_usejoystick.value == inputEvent.jbutton.which) - event.data1 = KEY_2JOY1; - else break; - if (inputEvent.type == SDL_JOYBUTTONUP) - event.type = ev_keyup; - else if (inputEvent.type == SDL_JOYBUTTONDOWN) - event.type = ev_keydown; - else break; - if (inputEvent.jbutton.button < JOYBUTTONS) - event.data1 += inputEvent.jbutton.button; - else - break; - SDLJoyRemap(&event); - if (event.type != ev_console) D_PostEvent(&event); - break; - case SDL_QUIT: - if (!sdlquit) - { - sdlquit = SDL_TRUE; - M_QuitResponse('y'); - } - break; -#if defined(RPC_NO_WINDOWS_H) - case SDL_SYSWMEVENT: - MainWndproc(inputEvent.syswm.msg->hwnd, - inputEvent.syswm.msg->msg, - inputEvent.syswm.msg->wParam, - inputEvent.syswm.msg->lParam); - break; -#endif - case SDL_VIDEORESIZE: - if (gamestate == GS_LEVEL || gamestate == GS_TITLESCREEN || gamestate == GS_EVALUATION) - setmodeneeded = VID_GetModeForSize(inputEvent.resize.w,inputEvent.resize.h)+1; - if (render_soft == rendermode) - { - SDLSetMode(realwidth, realheight, vid.bpp*8, surfaceFlagsW); - if (vidSurface) SDL_SetColors(vidSurface, localPalette, 0, 256); - } - else - SDLSetMode(realwidth, realheight, vid.bpp*8, surfaceFlagsW); - if (!vidSurface) - I_Error("Could not reset vidmode: %s\n",SDL_GetError()); - break; - case SDL_VIDEOEXPOSE: - exposevideo = SDL_TRUE; - break; - default: - break; - } - } - //reset wheel like in win32, I don't understand it but works -#endif } void I_StartupMouse(void) @@ -1484,13 +1215,6 @@ void VID_PrepareModeList(void) #endif } -#if 0 -static inline void SDLESSet(void) -{ - SDL2STUB(); -} -#endif - INT32 VID_SetMode(INT32 modeNum) { SDLdoUngrabMouse(); @@ -1721,7 +1445,6 @@ void I_StartupGraphics(void) borderlesswindow = M_CheckParm("-borderless"); //SDL_EnableKeyRepeat(SDL_DEFAULT_REPEAT_DELAY>>1,SDL_DEFAULT_REPEAT_INTERVAL<<2); - //SDLESSet(); // unused VID_Command_ModeList_f(); #ifdef HWRENDER if (M_CheckParm("-opengl") || rendermode == render_opengl) From 8bbbeff2a9910fb5b57750a35a65d8e24b1cc387 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Wed, 23 Nov 2016 17:08:37 +0000 Subject: [PATCH 115/172] Make Impl_SDL_Scancode_To_Keycode look a bit neater This way it's easier by eye to see from the list which SDL scancode maps to which SRB2 key code --- src/sdl/i_video.c | 181 ++++++++++++++++------------------------------ 1 file changed, 61 insertions(+), 120 deletions(-) diff --git a/src/sdl/i_video.c b/src/sdl/i_video.c index 5b83a8814..aa572e6e0 100644 --- a/src/sdl/i_video.c +++ b/src/sdl/i_video.c @@ -274,129 +274,70 @@ static INT32 Impl_SDL_Scancode_To_Keycode(SDL_Scancode code) } switch (code) { - case SDL_SCANCODE_F11: // F11 and F12 are - return KEY_F11; // separated from the - case SDL_SCANCODE_F12: // rest of the function - return KEY_F12; // keys + // F11 and F12 are separated from the rest of the function keys + case SDL_SCANCODE_F11: return KEY_F11; + case SDL_SCANCODE_F12: return KEY_F12; - case SDL_SCANCODE_KP_0: - return KEY_KEYPAD0; - case SDL_SCANCODE_KP_1: - return KEY_KEYPAD1; - case SDL_SCANCODE_KP_2: - return KEY_KEYPAD2; - case SDL_SCANCODE_KP_3: - return KEY_KEYPAD3; - case SDL_SCANCODE_KP_4: - return KEY_KEYPAD4; - case SDL_SCANCODE_KP_5: - return KEY_KEYPAD5; - case SDL_SCANCODE_KP_6: - return KEY_KEYPAD6; - case SDL_SCANCODE_KP_7: - return KEY_KEYPAD7; - case SDL_SCANCODE_KP_8: - return KEY_KEYPAD8; - case SDL_SCANCODE_KP_9: - return KEY_KEYPAD9; + case SDL_SCANCODE_KP_0: return KEY_KEYPAD0; + case SDL_SCANCODE_KP_1: return KEY_KEYPAD1; + case SDL_SCANCODE_KP_2: return KEY_KEYPAD2; + case SDL_SCANCODE_KP_3: return KEY_KEYPAD3; + case SDL_SCANCODE_KP_4: return KEY_KEYPAD4; + case SDL_SCANCODE_KP_5: return KEY_KEYPAD5; + case SDL_SCANCODE_KP_6: return KEY_KEYPAD6; + case SDL_SCANCODE_KP_7: return KEY_KEYPAD7; + case SDL_SCANCODE_KP_8: return KEY_KEYPAD8; + case SDL_SCANCODE_KP_9: return KEY_KEYPAD9; - case SDL_SCANCODE_RETURN: - return KEY_ENTER; - case SDL_SCANCODE_ESCAPE: - return KEY_ESCAPE; - case SDL_SCANCODE_BACKSPACE: - return KEY_BACKSPACE; - case SDL_SCANCODE_TAB: - return KEY_TAB; - case SDL_SCANCODE_SPACE: - return KEY_SPACE; - case SDL_SCANCODE_MINUS: - return KEY_MINUS; - case SDL_SCANCODE_EQUALS: - return KEY_EQUALS; - case SDL_SCANCODE_LEFTBRACKET: - return '['; - case SDL_SCANCODE_RIGHTBRACKET: - return ']'; - case SDL_SCANCODE_BACKSLASH: - return '\\'; - case SDL_SCANCODE_NONUSHASH: - return '#'; - case SDL_SCANCODE_SEMICOLON: - return ';'; - case SDL_SCANCODE_APOSTROPHE: - return '\''; - case SDL_SCANCODE_GRAVE: - return '`'; - case SDL_SCANCODE_COMMA: - return ','; - case SDL_SCANCODE_PERIOD: - return '.'; - case SDL_SCANCODE_SLASH: - return '/'; - case SDL_SCANCODE_CAPSLOCK: - return KEY_CAPSLOCK; - case SDL_SCANCODE_PRINTSCREEN: - return 0; // undefined? - case SDL_SCANCODE_SCROLLLOCK: - return KEY_SCROLLLOCK; - case SDL_SCANCODE_PAUSE: - return KEY_PAUSE; - case SDL_SCANCODE_INSERT: - return KEY_INS; - case SDL_SCANCODE_HOME: - return KEY_HOME; - case SDL_SCANCODE_PAGEUP: - return KEY_PGUP; - case SDL_SCANCODE_DELETE: - return KEY_DEL; - case SDL_SCANCODE_END: - return KEY_END; - case SDL_SCANCODE_PAGEDOWN: - return KEY_PGDN; - case SDL_SCANCODE_RIGHT: - return KEY_RIGHTARROW; - case SDL_SCANCODE_LEFT: - return KEY_LEFTARROW; - case SDL_SCANCODE_DOWN: - return KEY_DOWNARROW; - case SDL_SCANCODE_UP: - return KEY_UPARROW; - case SDL_SCANCODE_NUMLOCKCLEAR: - return KEY_NUMLOCK; - case SDL_SCANCODE_KP_DIVIDE: - return KEY_KPADSLASH; - case SDL_SCANCODE_KP_MULTIPLY: - return '*'; // undefined? - case SDL_SCANCODE_KP_MINUS: - return KEY_MINUSPAD; - case SDL_SCANCODE_KP_PLUS: - return KEY_PLUSPAD; - case SDL_SCANCODE_KP_ENTER: - return KEY_ENTER; - case SDL_SCANCODE_KP_PERIOD: - return KEY_KPADDEL; - case SDL_SCANCODE_NONUSBACKSLASH: - return '\\'; + case SDL_SCANCODE_RETURN: return KEY_ENTER; + case SDL_SCANCODE_ESCAPE: return KEY_ESCAPE; + case SDL_SCANCODE_BACKSPACE: return KEY_BACKSPACE; + case SDL_SCANCODE_TAB: return KEY_TAB; + case SDL_SCANCODE_SPACE: return KEY_SPACE; + case SDL_SCANCODE_MINUS: return KEY_MINUS; + case SDL_SCANCODE_EQUALS: return KEY_EQUALS; + case SDL_SCANCODE_LEFTBRACKET: return '['; + case SDL_SCANCODE_RIGHTBRACKET: return ']'; + case SDL_SCANCODE_BACKSLASH: return '\\'; + case SDL_SCANCODE_NONUSHASH: return '#'; + case SDL_SCANCODE_SEMICOLON: return ';'; + case SDL_SCANCODE_APOSTROPHE: return '\''; + case SDL_SCANCODE_GRAVE: return '`'; + case SDL_SCANCODE_COMMA: return ','; + case SDL_SCANCODE_PERIOD: return '.'; + case SDL_SCANCODE_SLASH: return '/'; + case SDL_SCANCODE_CAPSLOCK: return KEY_CAPSLOCK; + case SDL_SCANCODE_PRINTSCREEN: return 0; // undefined? + case SDL_SCANCODE_SCROLLLOCK: return KEY_SCROLLLOCK; + case SDL_SCANCODE_PAUSE: return KEY_PAUSE; + case SDL_SCANCODE_INSERT: return KEY_INS; + case SDL_SCANCODE_HOME: return KEY_HOME; + case SDL_SCANCODE_PAGEUP: return KEY_PGUP; + case SDL_SCANCODE_DELETE: return KEY_DEL; + case SDL_SCANCODE_END: return KEY_END; + case SDL_SCANCODE_PAGEDOWN: return KEY_PGDN; + case SDL_SCANCODE_RIGHT: return KEY_RIGHTARROW; + case SDL_SCANCODE_LEFT: return KEY_LEFTARROW; + case SDL_SCANCODE_DOWN: return KEY_DOWNARROW; + case SDL_SCANCODE_UP: return KEY_UPARROW; + case SDL_SCANCODE_NUMLOCKCLEAR: return KEY_NUMLOCK; + case SDL_SCANCODE_KP_DIVIDE: return KEY_KPADSLASH; + case SDL_SCANCODE_KP_MULTIPLY: return '*'; // undefined? + case SDL_SCANCODE_KP_MINUS: return KEY_MINUSPAD; + case SDL_SCANCODE_KP_PLUS: return KEY_PLUSPAD; + case SDL_SCANCODE_KP_ENTER: return KEY_ENTER; + case SDL_SCANCODE_KP_PERIOD: return KEY_KPADDEL; + case SDL_SCANCODE_NONUSBACKSLASH: return '\\'; - case SDL_SCANCODE_LSHIFT: - return KEY_LSHIFT; - case SDL_SCANCODE_RSHIFT: - return KEY_RSHIFT; - case SDL_SCANCODE_LCTRL: - return KEY_LCTRL; - case SDL_SCANCODE_RCTRL: - return KEY_RCTRL; - case SDL_SCANCODE_LALT: - return KEY_LALT; - case SDL_SCANCODE_RALT: - return KEY_RALT; - case SDL_SCANCODE_LGUI: - return KEY_LEFTWIN; - case SDL_SCANCODE_RGUI: - return KEY_RIGHTWIN; - default: - break; + case SDL_SCANCODE_LSHIFT: return KEY_LSHIFT; + case SDL_SCANCODE_RSHIFT: return KEY_RSHIFT; + case SDL_SCANCODE_LCTRL: return KEY_LCTRL; + case SDL_SCANCODE_RCTRL: return KEY_RCTRL; + case SDL_SCANCODE_LALT: return KEY_LALT; + case SDL_SCANCODE_RALT: return KEY_RALT; + case SDL_SCANCODE_LGUI: return KEY_LEFTWIN; + case SDL_SCANCODE_RGUI: return KEY_RIGHTWIN; + default: break; } #ifdef HWRENDER DBG_Printf("Unknown incoming scancode: %d, represented %c\n", From 1424c3f6cd0be5460a51033803ed4cdacfd1c59c Mon Sep 17 00:00:00 2001 From: toasterbabe Date: Wed, 23 Nov 2016 22:20:47 +0000 Subject: [PATCH 116/172] Regardless of what I'm doing next, this removal of limits in this place still should've been done a while ago. --- src/p_user.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/p_user.c b/src/p_user.c index 7acb37093..94e565214 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -6982,12 +6982,8 @@ static void P_MovePlayer(player_t *player) break; // Armageddon shield activation case SH_ARMAGEDDON: - // Don't let Super Sonic or invincibility use it - if (!(player->powers[pw_super] || player->powers[pw_invulnerability])) - { - player->pflags |= PF_THOKKED|PF_SHIELDABILITY; - P_BlackOw(player); - } + player->pflags |= PF_THOKKED|PF_SHIELDABILITY; + P_BlackOw(player); break; // Attract shield activation case SH_ATTRACT: From 095a438e9e180f462bbe41e6ec584405ffa5350e Mon Sep 17 00:00:00 2001 From: toasterbabe Date: Thu, 24 Nov 2016 14:29:29 +0000 Subject: [PATCH 117/172] * Super float now back on spin button, again takes precedence over shield actives. * Fixed BIG mistake where ShieldSpecial hook bailed out of the entire function instead of just the shield section. --- src/p_user.c | 159 ++++++++++++++++++++++++++------------------------- 1 file changed, 80 insertions(+), 79 deletions(-) diff --git a/src/p_user.c b/src/p_user.c index 94e565214..b6645edac 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -6947,95 +6947,96 @@ static void P_MovePlayer(player_t *player) localangle2 = player->mo->angle; } - /////////////////////////// - //BOMB SHIELD ACTIVATION,// - //HOMING, AND OTHER COOL // - //STUFF! // - /////////////////////////// + ////////////////// + //SHIELD ACTIVES// + //& SUPER FLOAT!// + ////////////////// if (player->pflags & PF_JUMPED && !player->exiting && player->mo->health) { if (cmd->buttons & BT_USE) // Spin button effects { -#ifdef HAVE_BLUA - if (LUAh_ShieldSpecial(player)) - return; -#endif - if (!(player->pflags & (PF_USEDOWN|PF_GLIDING|PF_SLIDING|PF_SHIELDABILITY)) // If the player is not holding down BT_USE, or having used an ability previously - && (!(player->pflags & PF_THOKKED) || ((player->powers[pw_shield] & SH_NOSTACK) == SH_BUBBLEWRAP && player->secondjump == UINT8_MAX))) // thokked is optional if you're bubblewrapped + if (player->powers[pw_super]) // Super can't use shield actives, only passives { - // Force shield activation - if ((player->powers[pw_shield] & ~(SH_FORCEHP|SH_STACK)) == SH_FORCE) + if ((player->charability == CA_THOK) // Super Sonic float + && (player->speed > 5*player->mo->scale) // FixedMul(5<mo->scale), but scale is FRACUNIT-based + && (P_MobjFlip(player->mo)*player->mo->momz <= 0)) { - player->pflags |= PF_THOKKED|PF_SHIELDABILITY; - player->mo->momx = player->mo->momy = player->mo->momz = 0; - S_StartSound(player->mo, sfx_ngskid); - } - else - { - switch (player->powers[pw_shield] & SH_NOSTACK) - { - // Whirlwind/Thundercoin shield activation - case SH_WHIRLWIND: - case SH_THUNDERCOIN: - P_DoJumpShield(player); - break; - // Armageddon shield activation - case SH_ARMAGEDDON: - player->pflags |= PF_THOKKED|PF_SHIELDABILITY; - P_BlackOw(player); - break; - // Attract shield activation - case SH_ATTRACT: - player->pflags |= PF_THOKKED|PF_SHIELDABILITY; - player->homing = 2; - if (P_LookForEnemies(player, false) && player->mo->tracer) - { - player->pflags |= PF_FORCEJUMPDAMAGE; - P_SetPlayerMobjState(player->mo, S_PLAY_SPIN); - S_StartSound(player->mo, sfx_s3k40); - player->homing = 3*TICRATE; - } - else - S_StartSound(player->mo, sfx_s3ka6); - break; - // Elemental/Bubblewrap shield activation - case SH_ELEMENTAL: - case SH_BUBBLEWRAP: - player->pflags |= PF_FORCEJUMPDAMAGE|PF_THOKKED|PF_SHIELDABILITY; - P_SetPlayerMobjState(player->mo, S_PLAY_SPIN); - player->secondjump = 0; - player->mo->momx = player->mo->momy = 0; - P_SetObjectMomZ(player->mo, -24*FRACUNIT, false); - S_StartSound(player->mo, - ((player->powers[pw_shield] & SH_NOSTACK) == SH_ELEMENTAL) - ? sfx_s3k43 - : sfx_s3k44); - break; - // Flame shield activation - case SH_FLAMEAURA: - player->pflags |= PF_THOKKED|PF_SHIELDABILITY; - P_Thrust(player->mo, player->mo->angle, FixedMul(30*FRACUNIT - FixedSqrt(FixedDiv(player->speed, player->mo->scale)), player->mo->scale)); - S_StartSound(player->mo, sfx_s3k43); - default: - break; - } + if (player->panim == PA_PAIN || player->panim == PA_JUMP || player->panim == PA_FALL + || (player->panim == PA_WALK && player->mo->state-states != S_PLAY_SUPER_FLOAT)) + P_SetPlayerMobjState(player->mo, S_PLAY_SUPER_FLOAT); + + player->mo->momz = 0; + player->pflags &= ~PF_SPINNING; + player->jumping = 0; // don't cut jump height after bouncing off something } } - } - - if ((cmd->buttons & BT_JUMP) && (player->pflags & PF_THOKKED) && !player->homing) // Super Sonic move - { - if ((player->charability == CA_THOK) && player->powers[pw_super] && player->speed > FixedMul(5<mo->scale) - && P_MobjFlip(player->mo)*player->mo->momz <= 0) + else +#ifdef HAVE_BLUA + if (!LUAh_ShieldSpecial(player)) +#endif { - if (player->mo->state-states == S_PLAY_PAIN || player->panim == PA_JUMP || player->panim == PA_FALL - || (player->panim == PA_WALK && player->mo->state-states != S_PLAY_SUPER_FLOAT)) - P_SetPlayerMobjState(player->mo, S_PLAY_SUPER_FLOAT); - - player->mo->momz = 0; - player->pflags &= ~(PF_SPINNING|PF_SHIELDABILITY); - player->jumping = 0; // don't cut jump height after bouncing off something + if (!(player->pflags & (PF_USEDOWN|PF_GLIDING|PF_SLIDING|PF_SHIELDABILITY)) // If the player is not holding down BT_USE, or having used an ability previously + && (!(player->pflags & PF_THOKKED) || ((player->powers[pw_shield] & SH_NOSTACK) == SH_BUBBLEWRAP && player->secondjump == UINT8_MAX))) // thokked is optional if you're bubblewrapped + { + // Force shield activation + if ((player->powers[pw_shield] & ~(SH_FORCEHP|SH_STACK)) == SH_FORCE) + { + player->pflags |= PF_THOKKED|PF_SHIELDABILITY; + player->mo->momx = player->mo->momy = player->mo->momz = 0; + S_StartSound(player->mo, sfx_ngskid); + } + else + { + switch (player->powers[pw_shield] & SH_NOSTACK) + { + // Whirlwind/Thundercoin shield activation + case SH_WHIRLWIND: + case SH_THUNDERCOIN: + P_DoJumpShield(player); + break; + // Armageddon shield activation + case SH_ARMAGEDDON: + player->pflags |= PF_THOKKED|PF_SHIELDABILITY; + P_BlackOw(player); + break; + // Attract shield activation + case SH_ATTRACT: + player->pflags |= PF_THOKKED|PF_SHIELDABILITY; + player->homing = 2; + if (P_LookForEnemies(player, false) && player->mo->tracer) + { + player->pflags |= PF_FORCEJUMPDAMAGE; + P_SetPlayerMobjState(player->mo, S_PLAY_SPIN); + S_StartSound(player->mo, sfx_s3k40); + player->homing = 3*TICRATE; + } + else + S_StartSound(player->mo, sfx_s3ka6); + break; + // Elemental/Bubblewrap shield activation + case SH_ELEMENTAL: + case SH_BUBBLEWRAP: + player->pflags |= PF_FORCEJUMPDAMAGE|PF_THOKKED|PF_SHIELDABILITY; + P_SetPlayerMobjState(player->mo, S_PLAY_SPIN); + player->secondjump = 0; + player->mo->momx = player->mo->momy = 0; + P_SetObjectMomZ(player->mo, -24*FRACUNIT, false); + S_StartSound(player->mo, + ((player->powers[pw_shield] & SH_NOSTACK) == SH_ELEMENTAL) + ? sfx_s3k43 + : sfx_s3k44); + break; + // Flame shield activation + case SH_FLAMEAURA: + player->pflags |= PF_THOKKED|PF_SHIELDABILITY; + P_Thrust(player->mo, player->mo->angle, FixedMul(30*FRACUNIT - FixedSqrt(FixedDiv(player->speed, player->mo->scale)), player->mo->scale)); + S_StartSound(player->mo, sfx_s3k43); + default: + break; + } + } + } } } } From 347b5318811db5a57108f0a1cca9addc6a046910 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Fri, 25 Nov 2016 21:13:39 +0000 Subject: [PATCH 118/172] (Messiness warning) attempt to start using SDL_SetRelativeMouseMode instead of the old hacks of making the mouse do movement without leaving the window and be hidden Seems to work so far though --- src/sdl/i_video.c | 66 +++++++++++++++++++++++++++++++++++++---------- 1 file changed, 52 insertions(+), 14 deletions(-) diff --git a/src/sdl/i_video.c b/src/sdl/i_video.c index aa572e6e0..b0b3d256f 100644 --- a/src/sdl/i_video.c +++ b/src/sdl/i_video.c @@ -527,7 +527,7 @@ static INT32 SDLJoyAxis(const Sint16 axis, evtype_t which) static void Impl_HandleWindowEvent(SDL_WindowEvent evt) { - static SDL_bool firsttimeonmouse = SDL_TRUE; + //static SDL_bool firsttimeonmouse = SDL_TRUE; static SDL_bool mousefocus = SDL_TRUE; static SDL_bool kbfocus = SDL_TRUE; @@ -535,17 +535,21 @@ static void Impl_HandleWindowEvent(SDL_WindowEvent evt) { case SDL_WINDOWEVENT_ENTER: mousefocus = SDL_TRUE; + //CONS_Printf("Window gained mouse focus!\n"); break; case SDL_WINDOWEVENT_LEAVE: mousefocus = SDL_FALSE; + //CONS_Printf("Window lost mouse focus!\n"); break; case SDL_WINDOWEVENT_FOCUS_GAINED: kbfocus = SDL_TRUE; mousefocus = SDL_TRUE; + //CONS_Printf("Window gained keyboard focus!\n"); break; case SDL_WINDOWEVENT_FOCUS_LOST: kbfocus = SDL_FALSE; mousefocus = SDL_FALSE; + //CONS_Printf("Window lost keyboard focus!\n"); break; case SDL_WINDOWEVENT_MAXIMIZED: break; @@ -558,11 +562,14 @@ static void Impl_HandleWindowEvent(SDL_WindowEvent evt) if (!paused) I_ResumeSong(0); //resume it - if (!firsttimeonmouse) + /*if (!firsttimeonmouse) { if (cv_usemouse.value) I_StartupMouse(); } //else firsttimeonmouse = SDL_FALSE; + + if (!disable_mouse && cv_usemouse.value) + SDL_SetRelativeMouseMode(SDL_TRUE);*/ } else if (!mousefocus && !kbfocus) { @@ -570,15 +577,34 @@ static void Impl_HandleWindowEvent(SDL_WindowEvent evt) window_notinfocus = true; I_PauseSong(0); - if (!disable_mouse) + /*if (!disable_mouse) { SDLforceUngrabMouse(); - } + SDL_SetRelativeMouseMode(SDL_FALSE); + HalfWarpMouse(realwidth, realheight); // warp to center + }*/ memset(gamekeydown, 0, NUMKEYS); // TODO this is a scary memset - if (MOUSE_MENU) + /*if (MOUSE_MENU) { SDLdoUngrabMouse(); + }*/ + } + + if (!disable_mouse) + { + if (mousefocus) + { + //if (cv_usemouse.value) + //SDL_SetRelativeMouseMode(SDL_TRUE); + } + else + { + if (SDL_GetRelativeMouseMode() == SDL_TRUE) + { + SDL_SetRelativeMouseMode(SDL_FALSE); + HalfWarpMouse(realwidth, realheight); // warp to center + } } } @@ -614,15 +640,15 @@ static void Impl_HandleMouseMotionEvent(SDL_MouseMotionEvent evt) if ((SDL_GetMouseFocus() != window && SDL_GetKeyboardFocus() != window)) { - SDLdoUngrabMouse(); + //SDLdoUngrabMouse(); return; } - if ((evt.x == realwidth/2) && (evt.y == realheight/2)) + /*if ((evt.x == realwidth/2) && (evt.y == realheight/2)) { return; } - else + else*/ { event.data2 = (INT32)lround((evt.xrel) * ((float)wwidth / (float)realwidth)); event.data3 = (INT32)lround(-evt.yrel * ((float)wheight / (float)realheight)); @@ -632,9 +658,13 @@ static void Impl_HandleMouseMotionEvent(SDL_MouseMotionEvent evt) if (SDL_GetMouseFocus() == window && SDL_GetKeyboardFocus() == window) { - D_PostEvent(&event); - SDL_SetWindowGrab(window, SDL_TRUE); - HalfWarpMouse(wwidth, wheight); + if (SDL_GetRelativeMouseMode() == SDL_FALSE) + SDL_SetRelativeMouseMode(SDL_TRUE); + else + D_PostEvent(&event); + //SDL_SetRelativeMouseMode(SDL_TRUE); + //SDL_SetWindowGrab(window, SDL_TRUE); + //HalfWarpMouse(wwidth, wheight); } } } @@ -832,11 +862,18 @@ void I_GetEvent(void) void I_StartupMouse(void) { - static SDL_bool firsttimeonmouse = SDL_TRUE; + //static SDL_bool firsttimeonmouse = SDL_TRUE; if (disable_mouse) return; - + if (cv_usemouse.value) + SDL_SetRelativeMouseMode(SDL_TRUE); + else if (SDL_GetRelativeMouseMode() == SDL_TRUE) { + SDLdoUngrabMouse(); + SDL_SetRelativeMouseMode(SDL_FALSE); + HalfWarpMouse(realwidth, realheight); // warp to center + } +/* if (!firsttimeonmouse) HalfWarpMouse(realwidth, realheight); // warp to center else @@ -845,6 +882,7 @@ void I_StartupMouse(void) return; else SDLdoUngrabMouse(); +*/ } // @@ -1470,7 +1508,7 @@ void I_StartupGraphics(void) realheight = (Uint16)vid.height; VID_Command_Info_f(); - if (!disable_mouse) SDL_ShowCursor(SDL_DISABLE); + if (!disable_mouse) SDL_SetRelativeMouseMode(SDL_TRUE); SDLdoUngrabMouse(); graphics_started = true; From 410b55ebcd6d8688eba09873ba1f46ec3d150828 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Mon, 28 Nov 2016 22:21:54 +0000 Subject: [PATCH 119/172] Work on FLIPX/FLIPX support: *Added FLIPX/FLIPY support for multi-patch textures and single-patch textures without holes *Added FLIPY support for single-patch textures with holes; I'll sort FLIPX support out later --- src/r_data.c | 57 ++++++++++++++++++++++++++++++++++++++++++++++---- src/r_data.h | 1 + src/r_segs.c | 35 +++++++++++++++++++++++++++++-- src/r_things.c | 2 +- src/r_things.h | 1 + 5 files changed, 89 insertions(+), 7 deletions(-) diff --git a/src/r_data.c b/src/r_data.c index b39ede58c..f4910fa00 100644 --- a/src/r_data.c +++ b/src/r_data.c @@ -173,6 +173,43 @@ static inline void R_DrawColumnInCache(column_t *patch, UINT8 *cache, INT32 orig } } +static inline void R_DrawFlippedColumnInCache(column_t *patch, UINT8 *cache, INT32 originy, INT32 cacheheight, INT32 patchheight) +{ + INT32 count, position; + UINT8 *source, *dest; + INT32 topdelta, prevdelta = -1; + + while (patch->topdelta != 0xff) + { + topdelta = patch->topdelta; + if (topdelta <= prevdelta) + topdelta += prevdelta; + prevdelta = topdelta; + topdelta = patchheight-patch->length-topdelta; + source = (UINT8 *)patch + 2 + patch->length; // patch + 3 + (patch->length-1) + count = patch->length; + position = originy + topdelta; + + if (position < 0) + { + count += position; + position = 0; + } + + if (position + count > cacheheight) + count = cacheheight - position; + + dest = cache + position; + if (count > 0) + { + for (; dest < cache + position + count; --source) + *dest++ = *source; + } + + patch = (column_t *)((UINT8 *)patch + patch->length + 4); + } +} + // // R_GenerateTexture // @@ -191,7 +228,7 @@ static UINT8 *R_GenerateTexture(size_t texnum) texture_t *texture; texpatch_t *patch; patch_t *realpatch; - int x, x1, x2, i; + int x, x1, x2, i, width, height; size_t blocksize; column_t *patchcol; UINT32 *colofs; @@ -239,6 +276,7 @@ static UINT8 *R_GenerateTexture(size_t texnum) if (holey) { texture->holes = true; + texture->flip = patch->flip; blocksize = W_LumpLengthPwad(patch->wad, patch->lump); block = Z_Calloc(blocksize, PU_STATIC, // will change tag at end of this function &texturecache[texnum]); @@ -259,6 +297,7 @@ static UINT8 *R_GenerateTexture(size_t texnum) // multi-patch textures (or 'composite') texture->holes = false; + texture->flip = 0; blocksize = (texture->width * 4) + (texture->width * texture->height); texturememory += blocksize; block = Z_Malloc(blocksize+1, PU_STATIC, &texturecache[texnum]); @@ -277,7 +316,9 @@ static UINT8 *R_GenerateTexture(size_t texnum) { realpatch = W_CacheLumpNumPwad(patch->wad, patch->lump, PU_CACHE); x1 = patch->originx; - x2 = x1 + SHORT(realpatch->width); + width = SHORT(realpatch->width); + height = SHORT(realpatch->height); + x2 = x1 + width; if (x1 < 0) x = 0; @@ -289,11 +330,17 @@ static UINT8 *R_GenerateTexture(size_t texnum) for (; x < x2; x++) { - patchcol = (column_t *)((UINT8 *)realpatch + LONG(realpatch->columnofs[x-x1])); + if (patch->flip & 1) + patchcol = (column_t *)((UINT8 *)realpatch + LONG(realpatch->columnofs[(x1+width-1)-x])); + else + patchcol = (column_t *)((UINT8 *)realpatch + LONG(realpatch->columnofs[x-x1])); // generate column ofset lookup colofs[x] = LONG((x * texture->height) + (texture->width*4)); - R_DrawColumnInCache(patchcol, block + LONG(colofs[x]), patch->originy, texture->height); + if (patch->flip & 2) + R_DrawFlippedColumnInCache(patchcol, block + LONG(colofs[x]), patch->originy, texture->height, height); + else + R_DrawColumnInCache(patchcol, block + LONG(colofs[x]), patch->originy, texture->height); } } @@ -469,6 +516,7 @@ void R_LoadTextures(void) texture->height = SHORT(patchlump->height)*patchcount; texture->patchcount = patchcount; texture->holes = false; + texture->flip = 0; // Allocate information for the texture's patches. for (k = 0; k < patchcount; k++) @@ -479,6 +527,7 @@ void R_LoadTextures(void) patch->originy = (INT16)(k*patchlump->height); patch->wad = (UINT16)w; patch->lump = texstart + j; + patch->flip = 0; } Z_Unlock(patchlump); diff --git a/src/r_data.h b/src/r_data.h index 1384ecac0..72054da5d 100644 --- a/src/r_data.h +++ b/src/r_data.h @@ -43,6 +43,7 @@ typedef struct char name[8]; INT16 width, height; boolean holes; + UINT8 flip; // 1 = flipx, 2 = flipy, 3 = both // All the patches[patchcount] are drawn back to front into the cached texture. INT16 patchcount; diff --git a/src/r_segs.c b/src/r_segs.c index 257be2989..91fb0e5bd 100644 --- a/src/r_segs.c +++ b/src/r_segs.c @@ -276,6 +276,13 @@ static void R_Render2sidedMultiPatchColumn(column_t *column) } } +// quick wrapper for R_DrawFlippedMaskedColumn so it can be set as a colfunc_2s value +// uses column2s_length for texture->height as above +static void R_DrawFlippedMaskedSegColumn(column_t *column) +{ + R_DrawFlippedMaskedColumn(column, column2s_length); +} + void R_RenderMaskedSegRange(drawseg_t *ds, INT32 x1, INT32 x2) { size_t pindex; @@ -347,7 +354,15 @@ void R_RenderMaskedSegRange(drawseg_t *ds, INT32 x1, INT32 x2) // handle case where multipatch texture is drawn on a 2sided wall, multi-patch textures // are not stored per-column with post info in SRB2 if (textures[texnum]->holes) - colfunc_2s = R_DrawMaskedColumn; // render the usual 2sided single-patch packed texture + { + if (textures[texnum]->flip & 2) // vertically flipped? + { + colfunc_2s = R_DrawFlippedMaskedSegColumn; + column2s_length = textures[texnum]->height; + } + else + colfunc_2s = R_DrawMaskedColumn; // render the usual 2sided single-patch packed texture + } else { colfunc_2s = R_Render2sidedMultiPatchColumn; // render multipatch with no holes (no post_t info) @@ -700,6 +715,14 @@ static void R_DrawRepeatMaskedColumn(column_t *col) } while (sprtopscreen < sprbotscreen); } +static void R_DrawRepeatFlippedMaskedColumn(column_t *col) +{ + do { + R_DrawFlippedMaskedColumn(col, column2s_length); + sprtopscreen += dc_texheight*spryscale; + } while (sprtopscreen < sprbotscreen); +} + // // R_RenderThickSideRange // Renders all the thick sides in the given range. @@ -1027,7 +1050,15 @@ void R_RenderThickSideRange(drawseg_t *ds, INT32 x1, INT32 x2, ffloor_t *pfloor) //faB: handle case where multipatch texture is drawn on a 2sided wall, multi-patch textures // are not stored per-column with post info anymore in Doom Legacy if (textures[texnum]->holes) - colfunc_2s = R_DrawRepeatMaskedColumn; //render the usual 2sided single-patch packed texture + { + if (textures[texnum]->flip & 2) // vertically flipped? + { + colfunc_2s = R_DrawRepeatFlippedMaskedColumn; + column2s_length = textures[texnum]->height; + } + else + colfunc_2s = R_DrawRepeatMaskedColumn; // render the usual 2sided single-patch packed texture + } else { colfunc_2s = R_Render2sidedMultiPatchColumn; //render multipatch with no holes (no post_t info) diff --git a/src/r_things.c b/src/r_things.c index 9f6cad529..5d560b53d 100644 --- a/src/r_things.c +++ b/src/r_things.c @@ -712,7 +712,7 @@ void R_DrawMaskedColumn(column_t *column) dc_texturemid = basetexturemid; } -static void R_DrawFlippedMaskedColumn(column_t *column, INT32 texheight) +void R_DrawFlippedMaskedColumn(column_t *column, INT32 texheight) { INT32 topscreen; INT32 bottomscreen; diff --git a/src/r_things.h b/src/r_things.h index 20dd25abf..572884d21 100644 --- a/src/r_things.h +++ b/src/r_things.h @@ -46,6 +46,7 @@ extern fixed_t windowtop; extern fixed_t windowbottom; void R_DrawMaskedColumn(column_t *column); +void R_DrawFlippedMaskedColumn(column_t *column, INT32 texheight); void R_SortVisSprites(void); //faB: find sprites in wadfile, replace existing, add new ones From ae3e11369e828acc3ae352cfab10bb068274f8ce Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Wed, 30 Nov 2016 17:21:28 +0000 Subject: [PATCH 120/172] Revert "(Messiness warning) attempt to start using SDL_SetRelativeMouseMode instead of the old hacks of making the mouse do movement without leaving the window and be hidden" This reverts commit 347b5318811db5a57108f0a1cca9addc6a046910. (Too experimental, may end up adding new bugs; let's just keep it to clean up for now) --- src/sdl/i_video.c | 66 ++++++++++------------------------------------- 1 file changed, 14 insertions(+), 52 deletions(-) diff --git a/src/sdl/i_video.c b/src/sdl/i_video.c index b0b3d256f..aa572e6e0 100644 --- a/src/sdl/i_video.c +++ b/src/sdl/i_video.c @@ -527,7 +527,7 @@ static INT32 SDLJoyAxis(const Sint16 axis, evtype_t which) static void Impl_HandleWindowEvent(SDL_WindowEvent evt) { - //static SDL_bool firsttimeonmouse = SDL_TRUE; + static SDL_bool firsttimeonmouse = SDL_TRUE; static SDL_bool mousefocus = SDL_TRUE; static SDL_bool kbfocus = SDL_TRUE; @@ -535,21 +535,17 @@ static void Impl_HandleWindowEvent(SDL_WindowEvent evt) { case SDL_WINDOWEVENT_ENTER: mousefocus = SDL_TRUE; - //CONS_Printf("Window gained mouse focus!\n"); break; case SDL_WINDOWEVENT_LEAVE: mousefocus = SDL_FALSE; - //CONS_Printf("Window lost mouse focus!\n"); break; case SDL_WINDOWEVENT_FOCUS_GAINED: kbfocus = SDL_TRUE; mousefocus = SDL_TRUE; - //CONS_Printf("Window gained keyboard focus!\n"); break; case SDL_WINDOWEVENT_FOCUS_LOST: kbfocus = SDL_FALSE; mousefocus = SDL_FALSE; - //CONS_Printf("Window lost keyboard focus!\n"); break; case SDL_WINDOWEVENT_MAXIMIZED: break; @@ -562,14 +558,11 @@ static void Impl_HandleWindowEvent(SDL_WindowEvent evt) if (!paused) I_ResumeSong(0); //resume it - /*if (!firsttimeonmouse) + if (!firsttimeonmouse) { if (cv_usemouse.value) I_StartupMouse(); } //else firsttimeonmouse = SDL_FALSE; - - if (!disable_mouse && cv_usemouse.value) - SDL_SetRelativeMouseMode(SDL_TRUE);*/ } else if (!mousefocus && !kbfocus) { @@ -577,34 +570,15 @@ static void Impl_HandleWindowEvent(SDL_WindowEvent evt) window_notinfocus = true; I_PauseSong(0); - /*if (!disable_mouse) + if (!disable_mouse) { SDLforceUngrabMouse(); - SDL_SetRelativeMouseMode(SDL_FALSE); - HalfWarpMouse(realwidth, realheight); // warp to center - }*/ + } memset(gamekeydown, 0, NUMKEYS); // TODO this is a scary memset - /*if (MOUSE_MENU) + if (MOUSE_MENU) { SDLdoUngrabMouse(); - }*/ - } - - if (!disable_mouse) - { - if (mousefocus) - { - //if (cv_usemouse.value) - //SDL_SetRelativeMouseMode(SDL_TRUE); - } - else - { - if (SDL_GetRelativeMouseMode() == SDL_TRUE) - { - SDL_SetRelativeMouseMode(SDL_FALSE); - HalfWarpMouse(realwidth, realheight); // warp to center - } } } @@ -640,15 +614,15 @@ static void Impl_HandleMouseMotionEvent(SDL_MouseMotionEvent evt) if ((SDL_GetMouseFocus() != window && SDL_GetKeyboardFocus() != window)) { - //SDLdoUngrabMouse(); + SDLdoUngrabMouse(); return; } - /*if ((evt.x == realwidth/2) && (evt.y == realheight/2)) + if ((evt.x == realwidth/2) && (evt.y == realheight/2)) { return; } - else*/ + else { event.data2 = (INT32)lround((evt.xrel) * ((float)wwidth / (float)realwidth)); event.data3 = (INT32)lround(-evt.yrel * ((float)wheight / (float)realheight)); @@ -658,13 +632,9 @@ static void Impl_HandleMouseMotionEvent(SDL_MouseMotionEvent evt) if (SDL_GetMouseFocus() == window && SDL_GetKeyboardFocus() == window) { - if (SDL_GetRelativeMouseMode() == SDL_FALSE) - SDL_SetRelativeMouseMode(SDL_TRUE); - else - D_PostEvent(&event); - //SDL_SetRelativeMouseMode(SDL_TRUE); - //SDL_SetWindowGrab(window, SDL_TRUE); - //HalfWarpMouse(wwidth, wheight); + D_PostEvent(&event); + SDL_SetWindowGrab(window, SDL_TRUE); + HalfWarpMouse(wwidth, wheight); } } } @@ -862,18 +832,11 @@ void I_GetEvent(void) void I_StartupMouse(void) { - //static SDL_bool firsttimeonmouse = SDL_TRUE; + static SDL_bool firsttimeonmouse = SDL_TRUE; if (disable_mouse) return; - if (cv_usemouse.value) - SDL_SetRelativeMouseMode(SDL_TRUE); - else if (SDL_GetRelativeMouseMode() == SDL_TRUE) { - SDLdoUngrabMouse(); - SDL_SetRelativeMouseMode(SDL_FALSE); - HalfWarpMouse(realwidth, realheight); // warp to center - } -/* + if (!firsttimeonmouse) HalfWarpMouse(realwidth, realheight); // warp to center else @@ -882,7 +845,6 @@ void I_StartupMouse(void) return; else SDLdoUngrabMouse(); -*/ } // @@ -1508,7 +1470,7 @@ void I_StartupGraphics(void) realheight = (Uint16)vid.height; VID_Command_Info_f(); - if (!disable_mouse) SDL_SetRelativeMouseMode(SDL_TRUE); + if (!disable_mouse) SDL_ShowCursor(SDL_DISABLE); SDLdoUngrabMouse(); graphics_started = true; From 02d78b355bf9dacd3e740d3535921541d9c6b70d Mon Sep 17 00:00:00 2001 From: toasterbabe Date: Thu, 1 Dec 2016 14:33:44 +0000 Subject: [PATCH 121/172] Smoother ropes and zoom tubes ported from internal. --- src/p_user.c | 82 ++++++++++++++++++++-------------------------------- 1 file changed, 31 insertions(+), 51 deletions(-) diff --git a/src/p_user.c b/src/p_user.c index f8dc942c0..cb5235854 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -7057,7 +7057,6 @@ static void P_DoZoomTube(player_t *player) mobj_t *waypoint = NULL; fixed_t dist; boolean reverse; - fixed_t speedx,speedy,speedz; player->mo->height = P_GetPlayerSpinHeight(player); @@ -7078,17 +7077,17 @@ static void P_DoZoomTube(player_t *player) if (dist < 1) dist = 1; - speedx = FixedMul(FixedDiv(player->mo->tracer->x - player->mo->x, dist), (speed)); - speedy = FixedMul(FixedDiv(player->mo->tracer->y - player->mo->y, dist), (speed)); - speedz = FixedMul(FixedDiv(player->mo->tracer->z - player->mo->z, dist), (speed)); + player->mo->momx = FixedMul(FixedDiv(player->mo->tracer->x - player->mo->x, dist), (speed)); + player->mo->momy = FixedMul(FixedDiv(player->mo->tracer->y - player->mo->y, dist), (speed)); + player->mo->momz = FixedMul(FixedDiv(player->mo->tracer->z - player->mo->z, dist), (speed)); // Calculate the distance between the player and the waypoint // 'dist' already equals this. - // Will the player be FURTHER away if the momx/momy/momz is added to - // his current coordinates, or closer? (shift down to fracunits to avoid approximation errors) - if (dist>>FRACBITS <= P_AproxDistance(P_AproxDistance(player->mo->tracer->x - player->mo->x - speedx, player->mo->tracer->y - player->mo->y - speedy), player->mo->tracer->z - player->mo->z - speedz)>>FRACBITS) + // Will the player go past the waypoint? + if (speed > dist) { + speed -= dist; // If further away, set XYZ of player to waypoint location P_UnsetThingPosition(player->mo); player->mo->x = player->mo->tracer->x; @@ -7128,14 +7127,9 @@ static void P_DoZoomTube(player_t *player) { CONS_Debug(DBG_GAMELOGIC, "Found waypoint (sequence %d, number %d).\n", waypoint->threshold, waypoint->health); - // calculate MOMX/MOMY/MOMZ for next waypoint - // change angle - player->mo->angle = R_PointToAngle2(player->mo->x, player->mo->y, player->mo->tracer->x, player->mo->tracer->y); + P_SetTarget(&player->mo->tracer, waypoint); - if (player == &players[consoleplayer]) - localangle = player->mo->angle; - else if (player == &players[secondarydisplayplayer]) - localangle2 = player->mo->angle; + // calculate MOMX/MOMY/MOMZ for next waypoint // change slope dist = P_AproxDistance(P_AproxDistance(player->mo->tracer->x - player->mo->x, player->mo->tracer->y - player->mo->y), player->mo->tracer->z - player->mo->z); @@ -7146,22 +7140,14 @@ static void P_DoZoomTube(player_t *player) player->mo->momx = FixedMul(FixedDiv(player->mo->tracer->x - player->mo->x, dist), (speed)); player->mo->momy = FixedMul(FixedDiv(player->mo->tracer->y - player->mo->y, dist), (speed)); player->mo->momz = FixedMul(FixedDiv(player->mo->tracer->z - player->mo->z, dist), (speed)); - - P_SetTarget(&player->mo->tracer, waypoint); } else { - P_SetTarget(&player->mo->tracer, NULL); // Else, we just let him fly. + P_SetTarget(&player->mo->tracer, NULL); // Else, we just let them fly. CONS_Debug(DBG_GAMELOGIC, "Next waypoint not found, releasing from track...\n"); } } - else - { - player->mo->momx = speedx; - player->mo->momy = speedy; - player->mo->momz = speedz; - } // change angle if (player->mo->tracer) @@ -7189,24 +7175,10 @@ static void P_DoRopeHang(player_t *player) mobj_t *mo2; mobj_t *waypoint = NULL; fixed_t dist; - fixed_t speedx,speedy,speedz; fixed_t playerz; player->mo->height = P_GetPlayerHeight(player); - if (player->cmd.buttons & BT_USE && !(player->pflags & PF_STASIS)) // Drop off of the rope - { - P_SetTarget(&player->mo->tracer, NULL); - - player->pflags |= PF_JUMPED; - player->pflags &= ~PF_ROPEHANG; - - if (!(player->pflags & PF_SLIDING) && (player->pflags & PF_JUMPED) - && !(player->panim == PA_ROLL) && player->charability2 == CA2_SPINDASH) - P_SetPlayerMobjState(player->mo, S_PLAY_ATK1); - return; - } - // Play the 'clink' sound only if the player is moving. if (!(leveltime & 7) && player->speed) S_StartSound(player->mo, sfx_s3k55); @@ -7223,9 +7195,22 @@ static void P_DoRopeHang(player_t *player) if (dist < 1) dist = 1; - speedx = FixedMul(FixedDiv(player->mo->tracer->x - player->mo->x, dist), (speed)); - speedy = FixedMul(FixedDiv(player->mo->tracer->y - player->mo->y, dist), (speed)); - speedz = FixedMul(FixedDiv(player->mo->tracer->z - playerz, dist), (speed)); + player->mo->momx = FixedMul(FixedDiv(player->mo->tracer->x - player->mo->x, dist), (speed)); + player->mo->momy = FixedMul(FixedDiv(player->mo->tracer->y - player->mo->y, dist), (speed)); + player->mo->momz = FixedMul(FixedDiv(player->mo->tracer->z - playerz, dist), (speed)); + + if (player->cmd.buttons & BT_USE && !(player->pflags & PF_STASIS)) // Drop off of the rope + { + P_SetTarget(&player->mo->tracer, NULL); + + player->pflags |= PF_JUMPED; + player->pflags &= ~PF_ROPEHANG; + + if (!(player->pflags & PF_SLIDING) && (player->pflags & PF_JUMPED) + && !(player->panim == PA_ROLL) && player->charability2 == CA2_SPINDASH) + P_SetPlayerMobjState(player->mo, S_PLAY_ATK1); + return; + } // If not allowed to move, we're done here. if (!speed) @@ -7234,15 +7219,16 @@ static void P_DoRopeHang(player_t *player) // Calculate the distance between the player and the waypoint // 'dist' already equals this. - // Will the player be FURTHER away if the momx/momy/momz is added to - // his current coordinates, or closer? (shift down to fracunits to avoid approximation errors) - if (dist>>FRACBITS <= P_AproxDistance(P_AproxDistance(player->mo->tracer->x - player->mo->x - speedx, player->mo->tracer->y - player->mo->y - speedy), player->mo->tracer->z - playerz - speedz)>>FRACBITS) + // Will the player go past the waypoint? + if (speed > dist) { + speed -= dist; // If further away, set XYZ of player to waypoint location P_UnsetThingPosition(player->mo); player->mo->x = player->mo->tracer->x; player->mo->y = player->mo->tracer->y; player->mo->z = player->mo->tracer->z - player->mo->height; + playerz = player->mo->tracer->z; P_SetThingPosition(player->mo); CONS_Debug(DBG_GAMELOGIC, "Looking for next waypoint...\n"); @@ -7298,6 +7284,8 @@ static void P_DoRopeHang(player_t *player) { CONS_Debug(DBG_GAMELOGIC, "Found waypoint (sequence %d, number %d).\n", waypoint->threshold, waypoint->health); + P_SetTarget(&player->mo->tracer, waypoint); + // calculate MOMX/MOMY/MOMZ for next waypoint // change slope dist = P_AproxDistance(P_AproxDistance(player->mo->tracer->x - player->mo->x, player->mo->tracer->y - player->mo->y), player->mo->tracer->z - playerz); @@ -7308,8 +7296,6 @@ static void P_DoRopeHang(player_t *player) player->mo->momx = FixedMul(FixedDiv(player->mo->tracer->x - player->mo->x, dist), (speed)); player->mo->momy = FixedMul(FixedDiv(player->mo->tracer->y - player->mo->y, dist), (speed)); player->mo->momz = FixedMul(FixedDiv(player->mo->tracer->z - playerz, dist), (speed)); - - P_SetTarget(&player->mo->tracer, waypoint); } else { @@ -7328,12 +7314,6 @@ static void P_DoRopeHang(player_t *player) CONS_Debug(DBG_GAMELOGIC, "Next waypoint not found!\n"); } } - else - { - player->mo->momx = speedx; - player->mo->momy = speedy; - player->mo->momz = speedz; - } } #if 0 From c833497d39ecf9f2b1ae9a869c3c39ba71e5117b Mon Sep 17 00:00:00 2001 From: toasterbabe Date: Thu, 1 Dec 2016 14:40:58 +0000 Subject: [PATCH 122/172] Correcting slip-up I made when originally improving zoom tubes. --- src/p_user.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/src/p_user.c b/src/p_user.c index 45a55d76b..524d50fb0 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -7159,13 +7159,6 @@ static void P_DoZoomTube(player_t *player) P_SetTarget(&player->mo->tracer, waypoint); // calculate MOMX/MOMY/MOMZ for next waypoint - // change angle - player->mo->angle = R_PointToAngle2(player->mo->x, player->mo->y, player->mo->tracer->x, player->mo->tracer->y); - - if (player == &players[consoleplayer]) - localangle = player->mo->angle; - else if (player == &players[secondarydisplayplayer]) - localangle2 = player->mo->angle; // change slope dist = P_AproxDistance(P_AproxDistance(player->mo->tracer->x - player->mo->x, player->mo->tracer->y - player->mo->y), player->mo->tracer->z - player->mo->z); @@ -7185,6 +7178,17 @@ static void P_DoZoomTube(player_t *player) CONS_Debug(DBG_GAMELOGIC, "Next waypoint not found, releasing from track...\n"); } } + + // change angle + if (player->mo->tracer) + { + player->mo->angle = R_PointToAngle2(player->mo->x, player->mo->y, player->mo->tracer->x, player->mo->tracer->y); + + if (player == &players[consoleplayer]) + localangle = player->mo->angle; + else if (player == &players[secondarydisplayplayer]) + localangle2 = player->mo->angle; + } } // From 52a84cf3091b2bfd26b8e5505f7c39d0fad3941a Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Thu, 1 Dec 2016 21:43:27 +0000 Subject: [PATCH 123/172] Fix negative y offsets for both normal and y-flipped patches --- src/r_data.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/r_data.c b/src/r_data.c index f4910fa00..3e28b8ca2 100644 --- a/src/r_data.c +++ b/src/r_data.c @@ -160,6 +160,7 @@ static inline void R_DrawColumnInCache(column_t *patch, UINT8 *cache, INT32 orig if (position < 0) { count += position; + source -= position; // start further down the column position = 0; } @@ -193,6 +194,7 @@ static inline void R_DrawFlippedColumnInCache(column_t *patch, UINT8 *cache, INT if (position < 0) { count += position; + source += position; // start further UP the column position = 0; } From 84f3102ad08788e4142c9020e0fabb225ea5abcf Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Thu, 1 Dec 2016 22:37:33 +0000 Subject: [PATCH 124/172] Added FLIPX support for single patch textures with holes This completes FLIPX/FLIPY support for all textures --- src/r_data.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/r_data.c b/src/r_data.c index 3e28b8ca2..350bd4175 100644 --- a/src/r_data.c +++ b/src/r_data.c @@ -289,6 +289,14 @@ static UINT8 *R_GenerateTexture(size_t texnum) colofs = (UINT32 *)(void *)(block + 8); texturecolumnofs[texnum] = colofs; blocktex = block; + if (patch->flip & 1) // flip the patch horizontally + { + UINT32 *realcolofs = (UINT32 *)realpatch->columnofs; + for (x = 0; x < texture->width; x++) + colofs[x] = realcolofs[texture->width-1-x]; // swap with the offset of the other side of the texture + } + // we can't as easily flip the patch vertically sadly though, + // we have wait until the texture itself is drawn to do that for (x = 0; x < texture->width; x++) colofs[x] = LONG(LONG(colofs[x]) + 3); goto done; From 7c07f39019723c0784a6bea2f8df61f5e7432c47 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Mon, 5 Dec 2016 22:07:16 +0000 Subject: [PATCH 125/172] Make sure flipped things placed directly on ceiling get MFE_ONGROUND This fixes ceiling springs apparently flying down with you in various scenarios --- src/p_mobj.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/p_mobj.c b/src/p_mobj.c index e7ec2f8b8..6a3ac9ee3 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -7685,6 +7685,10 @@ mobj_t *P_SpawnMobj(fixed_t x, fixed_t y, fixed_t z, mobjtype_t type) if (mobj->type == MT_UNIDUS) mobj->z -= FixedMul(mobj->info->mass, mobj->scale); + + // defaults onground + if (mobj->z + mobj->height == mobj->ceilingz) + mobj->eflags |= MFE_ONGROUND; } else mobj->z = z; From d294c9d15c3d91354edb9ea7db27b52fc6d3ede0 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Thu, 8 Dec 2016 21:45:25 +0000 Subject: [PATCH 126/172] P_NetUnArchiveWorld now uses P_AddLevelFlatRuntime instead of P_AddLevelFlat. Also created P_CheckLevelFlat to just return the flat # from a name, since that's all P_NetArchiveWorld really needed from P_AddLevelFlat anyway --- src/lua_maplib.c | 40 ------------------------------ src/p_saveg.c | 9 +++---- src/p_setup.c | 63 ++++++++++++++++++++++++++++++++++++++++++++++++ src/p_setup.h | 2 ++ 4 files changed, 69 insertions(+), 45 deletions(-) diff --git a/src/lua_maplib.c b/src/lua_maplib.c index c512bf3c5..54614c4ea 100644 --- a/src/lua_maplib.c +++ b/src/lua_maplib.c @@ -400,46 +400,6 @@ static int sector_get(lua_State *L) return 0; } -// help function for P_LoadSectors, find a flat in the active wad files, -// allocate an id for it, and set the levelflat (to speedup search) -// -static INT32 P_AddLevelFlatRuntime(const char *flatname) -{ - size_t i; - levelflat_t *levelflat = levelflats; - - // - // first scan through the already found flats - // - for (i = 0; i < numlevelflats; i++, levelflat++) - if (strnicmp(levelflat->name,flatname,8)==0) - break; - - // that flat was already found in the level, return the id - if (i == numlevelflats) - { - // allocate new flat memory - levelflats = Z_Realloc(levelflats, (numlevelflats + 1) * sizeof(*levelflats), PU_LEVEL, NULL); - levelflat = levelflats+i; - - // store the name - strlcpy(levelflat->name, flatname, sizeof (levelflat->name)); - strupr(levelflat->name); - - // store the flat lump number - levelflat->lumpnum = R_GetFlatNumForName(flatname); - -#ifndef ZDEBUG - CONS_Debug(DBG_SETUP, "flat #%03d: %s\n", atoi(sizeu1(numlevelflats)), levelflat->name); -#endif - - numlevelflats++; - } - - // level flat id - return (INT32)i; -} - static int sector_set(lua_State *L) { sector_t *sector = *((sector_t **)luaL_checkudata(L, 1, META_SECTOR)); diff --git a/src/p_saveg.c b/src/p_saveg.c index 5e457ca3a..2144a3f9b 100644 --- a/src/p_saveg.c +++ b/src/p_saveg.c @@ -509,10 +509,9 @@ static void P_NetArchiveWorld(void) // // flats // - // P_AddLevelFlat should not add but just return the number - if (ss->floorpic != P_AddLevelFlat(ms->floorpic, levelflats)) + if (ss->floorpic != P_CheckLevelFlat(ms->floorpic)) diff |= SD_FLOORPIC; - if (ss->ceilingpic != P_AddLevelFlat(ms->ceilingpic, levelflats)) + if (ss->ceilingpic != P_CheckLevelFlat(ms->ceilingpic)) diff |= SD_CEILPIC; if (ss->lightlevel != SHORT(ms->lightlevel)) @@ -752,12 +751,12 @@ static void P_NetUnArchiveWorld(void) sectors[i].ceilingheight = READFIXED(get); if (diff & SD_FLOORPIC) { - sectors[i].floorpic = P_AddLevelFlat((char *)get, levelflats); + sectors[i].floorpic = P_AddLevelFlatRuntime((char *)get); get += 8; } if (diff & SD_CEILPIC) { - sectors[i].ceilingpic = P_AddLevelFlat((char *)get, levelflats); + sectors[i].ceilingpic = P_AddLevelFlatRuntime((char *)get); get += 8; } if (diff & SD_LIGHT) diff --git a/src/p_setup.c b/src/p_setup.c index d65637355..ae6aa153c 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -574,6 +574,69 @@ INT32 P_AddLevelFlat(const char *flatname, levelflat_t *levelflat) return (INT32)i; } +// help function for Lua and $$$.sav reading +// same as P_AddLevelFlat, except this is not setup so we must realloc levelflats to fit in the new flat +// no longer a static func in lua_maplib.c because p_saveg.c also needs it +// +INT32 P_AddLevelFlatRuntime(const char *flatname) +{ + size_t i; + levelflat_t *levelflat = levelflats; + + // + // first scan through the already found flats + // + for (i = 0; i < numlevelflats; i++, levelflat++) + if (strnicmp(levelflat->name,flatname,8)==0) + break; + + // that flat was already found in the level, return the id + if (i == numlevelflats) + { + // allocate new flat memory + levelflats = Z_Realloc(levelflats, (numlevelflats + 1) * sizeof(*levelflats), PU_LEVEL, NULL); + levelflat = levelflats+i; + + // store the name + strlcpy(levelflat->name, flatname, sizeof (levelflat->name)); + strupr(levelflat->name); + + // store the flat lump number + levelflat->lumpnum = R_GetFlatNumForName(flatname); + +#ifndef ZDEBUG + CONS_Debug(DBG_SETUP, "flat #%03d: %s\n", atoi(sizeu1(numlevelflats)), levelflat->name); +#endif + + numlevelflats++; + } + + // level flat id + return (INT32)i; +} + +// help function for $$$.sav checking +// this simply returns the flat # for the name given +// +INT32 P_CheckLevelFlat(const char *flatname) +{ + size_t i; + levelflat_t *levelflat = levelflats; + + // + // scan through the already found flats + // + for (i = 0; i < numlevelflats; i++, levelflat++) + if (strnicmp(levelflat->name,flatname,8)==0) + break; + + if (i == numlevelflats) + return 0; // ??? flat was not found, this should not happen! + + // level flat id + return (INT32)i; +} + static void P_LoadSectors(lumpnum_t lumpnum) { UINT8 *data; diff --git a/src/p_setup.h b/src/p_setup.h index 0d735fd71..3bca11047 100644 --- a/src/p_setup.h +++ b/src/p_setup.h @@ -47,6 +47,8 @@ typedef struct extern size_t numlevelflats; extern levelflat_t *levelflats; INT32 P_AddLevelFlat(const char *flatname, levelflat_t *levelflat); +INT32 P_AddLevelFlatRuntime(const char *flatname); +INT32 P_CheckLevelFlat(const char *flatname); extern size_t nummapthings; extern mapthing_t *mapthings; From ab423f99c6abf7cddb88e4e2dbf5475d7545d114 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Fri, 9 Dec 2016 21:18:06 +0000 Subject: [PATCH 127/172] Optimising retrieval of sector_floorpic/ceilingpic As LJSonic has pointed out, there's no need for a for loop in either case; just use sector->floorpic/ceilingpic as a levelflats index directly (Besides, if that was to stop any out-of-bounds indexes being used, that's hardly the way to do it anyway) --- src/lua_maplib.c | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/src/lua_maplib.c b/src/lua_maplib.c index 54614c4ea..208aebe37 100644 --- a/src/lua_maplib.c +++ b/src/lua_maplib.c @@ -348,22 +348,12 @@ static int sector_get(lua_State *L) case sector_ceilingheight: lua_pushfixed(L, sector->ceilingheight); return 1; - case sector_floorpic: { // floorpic - levelflat_t *levelflat; - INT16 i; - for (i = 0, levelflat = levelflats; i != sector->floorpic; i++, levelflat++) - ; - lua_pushlstring(L, levelflat->name, 8); + case sector_floorpic: // floorpic + lua_pushlstring(L, levelflats[sector->floorpic].name, 8); return 1; - } - case sector_ceilingpic: { // ceilingpic - levelflat_t *levelflat; - INT16 i; - for (i = 0, levelflat = levelflats; i != sector->ceilingpic; i++, levelflat++) - ; - lua_pushlstring(L, levelflat->name, 8); + case sector_ceilingpic: // ceilingpic + lua_pushlstring(L, levelflats[sector->ceilingpic].name, 8); return 1; - } case sector_lightlevel: lua_pushinteger(L, sector->lightlevel); return 1; From 93901847d3e6d35577e97d2d7026e8ae586cefb5 Mon Sep 17 00:00:00 2001 From: Sryder Date: Mon, 12 Dec 2016 00:06:48 +0000 Subject: [PATCH 128/172] Fix the Fixed Rounding functions --- src/m_fixed.h | 28 ++++++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 deletions(-) diff --git a/src/m_fixed.h b/src/m_fixed.h index 70402f27a..d7db9bf2e 100644 --- a/src/m_fixed.h +++ b/src/m_fixed.h @@ -283,9 +283,16 @@ FUNCMATH FUNCINLINE static ATTRINLINE fixed_t FixedFloor(fixed_t x) { const fixed_t a = abs(x); //absolute of x const fixed_t i = (a>>FRACBITS)< 0) + return x-f; + else + return x-(FRACUNIT-f); + } return INT32_MIN; } @@ -301,7 +308,7 @@ FUNCMATH FUNCINLINE static ATTRINLINE fixed_t FixedTrunc(fixed_t x) { const fixed_t a = abs(x); //absolute of x const fixed_t i = (a>>FRACBITS)< 0) @@ -324,11 +331,18 @@ FUNCMATH FUNCINLINE static ATTRINLINE fixed_t FixedCeil(fixed_t x) { const fixed_t a = abs(x); //absolute of x const fixed_t i = (a>>FRACBITS)< 0) + return x+(FRACUNIT-f); + else + return x+f; + } return INT32_MAX; } @@ -344,7 +358,9 @@ FUNCMATH FUNCINLINE static ATTRINLINE fixed_t FixedRound(fixed_t x) { const fixed_t a = abs(x); //absolute of x const fixed_t i = (a>>FRACBITS)< Date: Tue, 13 Dec 2016 21:48:16 +0000 Subject: [PATCH 129/172] Reduced momentum killing of groundpound into slime per Mystic's request. --- src/p_mobj.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/p_mobj.c b/src/p_mobj.c index d19d8e5fa..81d6de61f 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -3590,6 +3590,7 @@ void P_MobjCheckWater(mobj_t *mobj) ffloor_t *rover; player_t *p = mobj->player; // Will just be null if not a player. fixed_t height = (p ? P_GetPlayerHeight(p) : mobj->height); // for players, calculation height does not necessarily match actual height for gameplay reasons (spin, etc) + boolean wasgroundpounding = (p && (mobj->eflags & MFE_GOOWATER) && ((p->powers[pw_shield] & SH_NOSTACK) == SH_ELEMENTAL || (p->powers[pw_shield] & SH_NOSTACK) == SH_BUBBLEWRAP) && (p->pflags & PF_SHIELDABILITY)); // Default if no water exists. mobj->watertop = mobj->waterbottom = mobj->z - 1000*FRACUNIT; @@ -3691,7 +3692,7 @@ void P_MobjCheckWater(mobj_t *mobj) p->powers[pw_underwater] = underwatertics + 1; } - if ((mobj->eflags & MFE_GOOWATER) && ((p->powers[pw_shield] & SH_NOSTACK) == SH_ELEMENTAL || (p->powers[pw_shield] & SH_NOSTACK) == SH_BUBBLEWRAP) && (p->pflags & PF_SHIELDABILITY)) + if (wasgroundpounding) { p->pflags &= ~PF_SHIELDABILITY; mobj->momz >>= 1; @@ -3713,7 +3714,7 @@ void P_MobjCheckWater(mobj_t *mobj) || ((mobj->eflags & MFE_VERTICALFLIP) && mobj->ceilingz-mobj->waterbottom <= height>>1)) return; - if ((mobj->eflags & MFE_GOOWATER || wasingoo)) { // Decide what happens to your momentum when you enter/leave goopy water. + if (!wasgroundpounding && (mobj->eflags & MFE_GOOWATER || wasingoo)) { // Decide what happens to your momentum when you enter/leave goopy water. if (P_MobjFlip(mobj)*mobj->momz < 0) // You are entering the goo? mobj->momz = FixedMul(mobj->momz, FixedDiv(2*FRACUNIT, 5*FRACUNIT)); // kill momentum significantly, to make the goo feel thick. } From 78f5dd15b5eea2c4f6fcad3a57e888a5dbaa280b Mon Sep 17 00:00:00 2001 From: "Michael T. DeGuzis" Date: Wed, 14 Dec 2016 15:07:48 -0500 Subject: [PATCH 130/172] readme.txt dupilcated, also incorrect readme.txt should be README.md --- debian/docs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/debian/docs b/debian/docs index f3d4ef20e..b43bf86b5 100644 --- a/debian/docs +++ b/debian/docs @@ -1,2 +1 @@ -readme.txt -readme.txt +README.md From db20bfb3c302b3b4e3dfb8486d8c8ac284bc529b Mon Sep 17 00:00:00 2001 From: Louis-Antoine Date: Thu, 15 Dec 2016 21:05:54 +0100 Subject: [PATCH 131/172] Generic mobj hooks are now run before mobjtype-specific mobj hooks, and player/linedef executor hooks now have their own lists --- src/lua_hook.h | 2 +- src/lua_hooklib.c | 280 +++++++++++++++++++++++++++++++++++++--------- 2 files changed, 229 insertions(+), 53 deletions(-) diff --git a/src/lua_hook.h b/src/lua_hook.h index 804d99e12..53e0a7d8e 100644 --- a/src/lua_hook.h +++ b/src/lua_hook.h @@ -60,7 +60,7 @@ UINT8 LUAh_MobjCollideHook(mobj_t *thing1, mobj_t *thing2, enum hook which); #define LUAh_MobjMoveCollide(thing1, thing2) LUAh_MobjCollideHook(thing1, thing2, hook_MobjMoveCollide) // Hook for PIT_CheckThing by (tmthing) mobj type boolean LUAh_TouchSpecial(mobj_t *special, mobj_t *toucher); // Hook for P_TouchSpecialThing by mobj type #define LUAh_MobjFuse(mo) LUAh_MobjHook(mo, hook_MobjFuse) // Hook for mobj->fuse == 0 by mobj type -#define LUAh_MobjThinker(mo) LUAh_MobjHook(mo, hook_MobjThinker) // Hook for P_MobjThinker or P_SceneryThinker by mobj type +boolean LUAh_MobjThinker(mobj_t *mo); // Hook for P_MobjThinker or P_SceneryThinker by mobj type #define LUAh_BossThinker(mo) LUAh_MobjHook(mo, hook_BossThinker) // Hook for P_GenericBossThinker by mobj type UINT8 LUAh_ShouldDamage(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 damage); // Hook for P_DamageMobj by mobj type (Should mobj take damage?) boolean LUAh_MobjDamage(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 damage); // Hook for P_DamageMobj by mobj type (Mobj actually takes damage!) diff --git a/src/lua_hooklib.c b/src/lua_hooklib.c index 5d9c50623..a24473bad 100644 --- a/src/lua_hooklib.c +++ b/src/lua_hooklib.c @@ -81,6 +81,15 @@ typedef struct hook_s* hook_p; static hook_p mobjthinkerhooks[NUMMOBJTYPES]; static hook_p mobjcollidehooks[NUMMOBJTYPES]; +// For each mobj type, a linked list for other mobj hooks +static hook_p mobjhooks[NUMMOBJTYPES]; + +// A linked list for player hooks +static hook_p playerhooks; + +// A linked list for linedef executor hooks +static hook_p linedefexecutorhooks; + // For other hooks, a unique linked list hook_p roothook; @@ -154,13 +163,41 @@ static int lib_addHook(lua_State *L) // set hook.id to the highest id + 1 hook.id = nextid++; - // Special cases for mobj thinker and collision hooks (see the comments above mobjthinkerhooks declaration) - if (hook.type == hook_MobjThinker) + // Special cases for some hook types (see the comments above mobjthinkerhooks declaration) + switch(hook.type) + { + case hook_MobjThinker: lastp = &mobjthinkerhooks[hook.s.mt]; - else if (hook.type == hook_MobjCollide || hook.type == hook_MobjMoveCollide) + break; + case hook_MobjCollide: + case hook_MobjMoveCollide: lastp = &mobjcollidehooks[hook.s.mt]; - else + break; + case hook_MobjSpawn: + case hook_TouchSpecial: + case hook_MobjFuse: + case hook_BossThinker: + case hook_ShouldDamage: + case hook_MobjDamage: + case hook_MobjDeath: + case hook_BossDeath: + case hook_MobjRemoved: + lastp = &mobjhooks[hook.s.mt]; + break; + case hook_JumpSpecial: + case hook_AbilitySpecial: + case hook_SpinSpecial: + case hook_JumpSpinSpecial: + case hook_PlayerSpawn: + lastp = &playerhooks; + break; + case hook_LinedefExecute: + lastp = &linedefexecutorhooks; + break; + default: lastp = &roothook; + break; + } // iterate the hook metadata structs // set lastp to the last hook struct's "next" pointer. @@ -196,9 +233,9 @@ boolean LUAh_MobjHook(mobj_t *mo, enum hook which) lua_settop(gL, 0); - if (which == hook_MobjThinker) // Alternate list for mobj thinkers - { - for (hookp = mobjthinkerhooks[mo->type]; hookp; hookp = hookp->next) + // Look for all generic mobj hooks + for (hookp = mobjhooks[MT_NULL]; hookp; hookp = hookp->next) + if (hookp->type == which) { if (lua_gettop(gL) == 0) LUA_PushUserdata(gL, mo, META_MOBJ); @@ -217,8 +254,8 @@ boolean LUAh_MobjHook(mobj_t *mo, enum hook which) lua_pop(gL, 1); } - // Look for all generic mobj thinker hooks - for (hookp = mobjthinkerhooks[MT_NULL]; hookp; hookp = hookp->next) + for (hookp = mobjhooks[mo->type]; hookp; hookp = hookp->next) + if (hookp->type == which) { if (lua_gettop(gL) == 0) LUA_PushUserdata(gL, mo, META_MOBJ); @@ -236,30 +273,6 @@ boolean LUAh_MobjHook(mobj_t *mo, enum hook which) hooked = true; lua_pop(gL, 1); } - } - else - { - for (hookp = roothook; hookp; hookp = hookp->next) - if (hookp->type == which - && (hookp->s.mt == MT_NULL || hookp->s.mt == mo->type)) - { - if (lua_gettop(gL) == 0) - LUA_PushUserdata(gL, mo, META_MOBJ); - lua_pushfstring(gL, FMT_HOOKID, hookp->id); - lua_gettable(gL, LUA_REGISTRYINDEX); - lua_pushvalue(gL, -2); - if (lua_pcall(gL, 1, 1, 0)) { - if (!hookp->error || cv_debug & DBG_LUA) - CONS_Alert(CONS_WARNING,"%s\n",lua_tostring(gL, -1)); - lua_pop(gL, 1); - hookp->error = true; - continue; - } - if (lua_toboolean(gL, -1)) - hooked = true; - lua_pop(gL, 1); - } - } lua_settop(gL, 0); return hooked; @@ -274,7 +287,7 @@ boolean LUAh_PlayerHook(player_t *plr, enum hook which) lua_settop(gL, 0); - for (hookp = roothook; hookp; hookp = hookp->next) + for (hookp = playerhooks; hookp; hookp = hookp->next) if (hookp->type == which) { if (lua_gettop(gL) == 0) @@ -395,7 +408,8 @@ UINT8 LUAh_MobjCollideHook(mobj_t *thing1, mobj_t *thing2, enum hook which) lua_settop(gL, 0); - for (hookp = mobjcollidehooks[thing1->type]; hookp; hookp = hookp->next) + // Look for all generic mobj collision hooks + for (hookp = mobjcollidehooks[MT_NULL]; hookp; hookp = hookp->next) if (hookp->type == which) { if (lua_gettop(gL) == 0) @@ -424,8 +438,7 @@ UINT8 LUAh_MobjCollideHook(mobj_t *thing1, mobj_t *thing2, enum hook which) lua_pop(gL, 1); } - // Look for all generic mobj collision hooks - for (hookp = mobjcollidehooks[MT_NULL]; hookp; hookp = hookp->next) + for (hookp = mobjcollidehooks[thing1->type]; hookp; hookp = hookp->next) if (hookp->type == which) { if (lua_gettop(gL) == 0) @@ -458,6 +471,59 @@ UINT8 LUAh_MobjCollideHook(mobj_t *thing1, mobj_t *thing2, enum hook which) return shouldCollide; } +// Hook for mobj thinkers +boolean LUAh_MobjThinker(mobj_t *mo) +{ + hook_p hookp; + boolean hooked = false; + if (!gL || !(hooksAvailable[hook_MobjThinker/8] & (1<<(hook_MobjThinker%8)))) + return false; + + lua_settop(gL, 0); + + // Look for all generic mobj thinker hooks + for (hookp = mobjthinkerhooks[MT_NULL]; hookp; hookp = hookp->next) + { + if (lua_gettop(gL) == 0) + LUA_PushUserdata(gL, mo, META_MOBJ); + lua_pushfstring(gL, FMT_HOOKID, hookp->id); + lua_gettable(gL, LUA_REGISTRYINDEX); + lua_pushvalue(gL, -2); + if (lua_pcall(gL, 1, 1, 0)) { + if (!hookp->error || cv_debug & DBG_LUA) + CONS_Alert(CONS_WARNING,"%s\n",lua_tostring(gL, -1)); + lua_pop(gL, 1); + hookp->error = true; + continue; + } + if (lua_toboolean(gL, -1)) + hooked = true; + lua_pop(gL, 1); + } + + for (hookp = mobjthinkerhooks[mo->type]; hookp; hookp = hookp->next) + { + if (lua_gettop(gL) == 0) + LUA_PushUserdata(gL, mo, META_MOBJ); + lua_pushfstring(gL, FMT_HOOKID, hookp->id); + lua_gettable(gL, LUA_REGISTRYINDEX); + lua_pushvalue(gL, -2); + if (lua_pcall(gL, 1, 1, 0)) { + if (!hookp->error || cv_debug & DBG_LUA) + CONS_Alert(CONS_WARNING,"%s\n",lua_tostring(gL, -1)); + lua_pop(gL, 1); + hookp->error = true; + continue; + } + if (lua_toboolean(gL, -1)) + hooked = true; + lua_pop(gL, 1); + } + + lua_settop(gL, 0); + return hooked; +} + // Hook for P_TouchSpecialThing by mobj type boolean LUAh_TouchSpecial(mobj_t *special, mobj_t *toucher) { @@ -468,9 +534,33 @@ boolean LUAh_TouchSpecial(mobj_t *special, mobj_t *toucher) lua_settop(gL, 0); - for (hookp = roothook; hookp; hookp = hookp->next) - if (hookp->type == hook_TouchSpecial - && (hookp->s.mt == MT_NULL || hookp->s.mt == special->type)) + // Look for all generic touch special hooks + for (hookp = mobjhooks[MT_NULL]; hookp; hookp = hookp->next) + if (hookp->type == hook_TouchSpecial) + { + if (lua_gettop(gL) == 0) + { + LUA_PushUserdata(gL, special, META_MOBJ); + LUA_PushUserdata(gL, toucher, META_MOBJ); + } + lua_pushfstring(gL, FMT_HOOKID, hookp->id); + lua_gettable(gL, LUA_REGISTRYINDEX); + lua_pushvalue(gL, -3); + lua_pushvalue(gL, -3); + if (lua_pcall(gL, 2, 1, 0)) { + if (!hookp->error || cv_debug & DBG_LUA) + CONS_Alert(CONS_WARNING,"%s\n",lua_tostring(gL, -1)); + lua_pop(gL, 1); + hookp->error = true; + continue; + } + if (lua_toboolean(gL, -1)) + hooked = true; + lua_pop(gL, 1); + } + + for (hookp = mobjhooks[special->type]; hookp; hookp = hookp->next) + if (hookp->type == hook_TouchSpecial) { if (lua_gettop(gL) == 0) { @@ -507,9 +597,42 @@ UINT8 LUAh_ShouldDamage(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 lua_settop(gL, 0); - for (hookp = roothook; hookp; hookp = hookp->next) - if (hookp->type == hook_ShouldDamage - && (hookp->s.mt == MT_NULL || hookp->s.mt == target->type)) + // Look for all generic should damage hooks + for (hookp = mobjhooks[MT_NULL]; hookp; hookp = hookp->next) + if (hookp->type == hook_ShouldDamage) + { + if (lua_gettop(gL) == 0) + { + LUA_PushUserdata(gL, target, META_MOBJ); + LUA_PushUserdata(gL, inflictor, META_MOBJ); + LUA_PushUserdata(gL, source, META_MOBJ); + lua_pushinteger(gL, damage); + } + lua_pushfstring(gL, FMT_HOOKID, hookp->id); + lua_gettable(gL, LUA_REGISTRYINDEX); + lua_pushvalue(gL, -5); + lua_pushvalue(gL, -5); + lua_pushvalue(gL, -5); + lua_pushvalue(gL, -5); + if (lua_pcall(gL, 4, 1, 0)) { + if (!hookp->error || cv_debug & DBG_LUA) + CONS_Alert(CONS_WARNING,"%s\n",lua_tostring(gL, -1)); + lua_pop(gL, 1); + hookp->error = true; + continue; + } + if (!lua_isnil(gL, -1)) + { + if (lua_toboolean(gL, -1)) + shouldDamage = 1; // Force yes + else + shouldDamage = 2; // Force no + } + lua_pop(gL, 1); + } + + for (hookp = mobjhooks[target->type]; hookp; hookp = hookp->next) + if (hookp->type == hook_ShouldDamage) { if (lua_gettop(gL) == 0) { @@ -555,9 +678,37 @@ boolean LUAh_MobjDamage(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 lua_settop(gL, 0); - for (hookp = roothook; hookp; hookp = hookp->next) - if (hookp->type == hook_MobjDamage - && (hookp->s.mt == MT_NULL || hookp->s.mt == target->type)) + // Look for all generic mobj damage hooks + for (hookp = mobjhooks[MT_NULL]; hookp; hookp = hookp->next) + if (hookp->type == hook_MobjDamage) + { + if (lua_gettop(gL) == 0) + { + LUA_PushUserdata(gL, target, META_MOBJ); + LUA_PushUserdata(gL, inflictor, META_MOBJ); + LUA_PushUserdata(gL, source, META_MOBJ); + lua_pushinteger(gL, damage); + } + lua_pushfstring(gL, FMT_HOOKID, hookp->id); + lua_gettable(gL, LUA_REGISTRYINDEX); + lua_pushvalue(gL, -5); + lua_pushvalue(gL, -5); + lua_pushvalue(gL, -5); + lua_pushvalue(gL, -5); + if (lua_pcall(gL, 4, 1, 0)) { + if (!hookp->error || cv_debug & DBG_LUA) + CONS_Alert(CONS_WARNING,"%s\n",lua_tostring(gL, -1)); + lua_pop(gL, 1); + hookp->error = true; + continue; + } + if (lua_toboolean(gL, -1)) + hooked = true; + lua_pop(gL, 1); + } + + for (hookp = mobjhooks[target->type]; hookp; hookp = hookp->next) + if (hookp->type == hook_MobjDamage) { if (lua_gettop(gL) == 0) { @@ -598,9 +749,35 @@ boolean LUAh_MobjDeath(mobj_t *target, mobj_t *inflictor, mobj_t *source) lua_settop(gL, 0); - for (hookp = roothook; hookp; hookp = hookp->next) - if (hookp->type == hook_MobjDeath - && (hookp->s.mt == MT_NULL || hookp->s.mt == target->type)) + // Look for all generic mobj death hooks + for (hookp = mobjhooks[MT_NULL]; hookp; hookp = hookp->next) + if (hookp->type == hook_MobjDeath) + { + if (lua_gettop(gL) == 0) + { + LUA_PushUserdata(gL, target, META_MOBJ); + LUA_PushUserdata(gL, inflictor, META_MOBJ); + LUA_PushUserdata(gL, source, META_MOBJ); + } + lua_pushfstring(gL, FMT_HOOKID, hookp->id); + lua_gettable(gL, LUA_REGISTRYINDEX); + lua_pushvalue(gL, -4); + lua_pushvalue(gL, -4); + lua_pushvalue(gL, -4); + if (lua_pcall(gL, 3, 1, 0)) { + if (!hookp->error || cv_debug & DBG_LUA) + CONS_Alert(CONS_WARNING,"%s\n",lua_tostring(gL, -1)); + lua_pop(gL, 1); + hookp->error = true; + continue; + } + if (lua_toboolean(gL, -1)) + hooked = true; + lua_pop(gL, 1); + } + + for (hookp = mobjhooks[target->type]; hookp; hookp = hookp->next) + if (hookp->type == hook_MobjDeath) { if (lua_gettop(gL) == 0) { @@ -738,9 +915,8 @@ boolean LUAh_LinedefExecute(line_t *line, mobj_t *mo, sector_t *sector) lua_settop(gL, 0); - for (hookp = roothook; hookp; hookp = hookp->next) - if (hookp->type == hook_LinedefExecute - && !strcmp(hookp->s.funcname, line->text)) + for (hookp = linedefexecutorhooks; hookp; hookp = hookp->next) + if (!strcmp(hookp->s.funcname, line->text)) { if (lua_gettop(gL) == 0) { From a9cfd12e049ddaaee3fc6646fa8234418e8352cb Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Fri, 16 Dec 2016 21:38:53 +0000 Subject: [PATCH 132/172] Created R_GetTextureNum to make sure top/bottom/midtexture texture ids are always valid in rendering code for both software and OpenGL (and also for the Solid Midtexture effect physics code) --- src/hardware/hw_main.c | 36 ++++++++------ src/p_maputl.c | 77 +++++++++++++++-------------- src/r_data.c | 14 ++++++ src/r_data.h | 2 + src/r_segs.c | 108 ++++++++++++++++------------------------- 5 files changed, 118 insertions(+), 119 deletions(-) diff --git a/src/hardware/hw_main.c b/src/hardware/hw_main.c index 5251e0b30..948965db1 100644 --- a/src/hardware/hw_main.c +++ b/src/hardware/hw_main.c @@ -1558,6 +1558,7 @@ static void HWR_StoreWallRange(double startfrac, double endfrac) if (gr_backsector) { + INT32 gr_toptexture, gr_bottomtexture; // two sided line if (gr_backsector->heightsec != -1) { @@ -1608,19 +1609,22 @@ static void HWR_StoreWallRange(double startfrac, double endfrac) #endif } + gr_toptexture = R_GetTextureNum(gr_sidedef->toptexture); + gr_bottomtexture = R_GetTextureNum(gr_sidedef->bottomtexture); + // check TOP TEXTURE if (( #ifdef ESLOPE worldhighslope < worldtopslope || #endif worldhigh < worldtop - ) && texturetranslation[gr_sidedef->toptexture]) + ) && gr_toptexture) { if (drawtextured) { fixed_t texturevpegtop; // top - grTex = HWR_GetTexture(texturetranslation[gr_sidedef->toptexture]); + grTex = HWR_GetTexture(gr_toptexture); // PEGGING if (gr_linedef->flags & ML_DONTPEGTOP) @@ -1638,7 +1642,7 @@ static void HWR_StoreWallRange(double startfrac, double endfrac) texturevpegtop += gr_sidedef->rowoffset; // This is so that it doesn't overflow and screw up the wall, it doesn't need to go higher than the texture's height anyway - texturevpegtop %= SHORT(textures[texturetranslation[gr_sidedef->toptexture]]->height)<height)<scaleY; wallVerts[0].t = wallVerts[1].t = (texturevpegtop + gr_frontsector->ceilingheight - gr_backsector->ceilingheight) * grTex->scaleY; @@ -1683,9 +1687,9 @@ static void HWR_StoreWallRange(double startfrac, double endfrac) #endif if (gr_frontsector->numlights) - HWR_SplitWall(gr_frontsector, wallVerts, texturetranslation[gr_sidedef->toptexture], &Surf, FF_CUTSOLIDS); + HWR_SplitWall(gr_frontsector, wallVerts, gr_toptexture, &Surf, FF_CUTSOLIDS); else if (grTex->mipmap.flags & TF_TRANSPARENT) - HWR_AddTransparentWall(wallVerts, &Surf, texturetranslation[gr_sidedef->toptexture], PF_Environment, false, lightnum, colormap); + HWR_AddTransparentWall(wallVerts, &Surf, gr_toptexture, PF_Environment, false, lightnum, colormap); else HWR_ProjectWall(wallVerts, &Surf, PF_Masked, lightnum, colormap); } @@ -1695,13 +1699,13 @@ static void HWR_StoreWallRange(double startfrac, double endfrac) #ifdef ESLOPE worldlowslope > worldbottomslope || #endif - worldlow > worldbottom) && texturetranslation[gr_sidedef->bottomtexture]) //only if VISIBLE!!! + worldlow > worldbottom) && gr_bottomtexture) //only if VISIBLE!!! { if (drawtextured) { fixed_t texturevpegbottom = 0; // bottom - grTex = HWR_GetTexture(texturetranslation[gr_sidedef->bottomtexture]); + grTex = HWR_GetTexture(gr_bottomtexture); // PEGGING #ifdef ESLOPE @@ -1721,7 +1725,7 @@ static void HWR_StoreWallRange(double startfrac, double endfrac) texturevpegbottom += gr_sidedef->rowoffset; // This is so that it doesn't overflow and screw up the wall, it doesn't need to go higher than the texture's height anyway - texturevpegbottom %= SHORT(textures[texturetranslation[gr_sidedef->bottomtexture]]->height)<height)<scaleY; wallVerts[0].t = wallVerts[1].t = (texturevpegbottom + gr_backsector->floorheight - gr_frontsector->floorheight) * grTex->scaleY; @@ -1766,13 +1770,13 @@ static void HWR_StoreWallRange(double startfrac, double endfrac) #endif if (gr_frontsector->numlights) - HWR_SplitWall(gr_frontsector, wallVerts, texturetranslation[gr_sidedef->bottomtexture], &Surf, FF_CUTSOLIDS); + HWR_SplitWall(gr_frontsector, wallVerts, gr_bottomtexture, &Surf, FF_CUTSOLIDS); else if (grTex->mipmap.flags & TF_TRANSPARENT) - HWR_AddTransparentWall(wallVerts, &Surf, texturetranslation[gr_sidedef->bottomtexture], PF_Environment, false, lightnum, colormap); + HWR_AddTransparentWall(wallVerts, &Surf, gr_bottomtexture, PF_Environment, false, lightnum, colormap); else HWR_ProjectWall(wallVerts, &Surf, PF_Masked, lightnum, colormap); } - gr_midtexture = texturetranslation[gr_sidedef->midtexture]; + gr_midtexture = R_GetTextureNum(gr_sidedef->midtexture); if (gr_midtexture) { FBITFIELD blendmode; @@ -2134,7 +2138,7 @@ static void HWR_StoreWallRange(double startfrac, double endfrac) else { // Single sided line... Deal only with the middletexture (if one exists) - gr_midtexture = texturetranslation[gr_sidedef->midtexture]; + gr_midtexture = R_GetTextureNum(gr_sidedef->midtexture); if (gr_midtexture) { if (drawtextured) @@ -2232,13 +2236,13 @@ static void HWR_StoreWallRange(double startfrac, double endfrac) if (*rover->topheight < lowcut || *rover->bottomheight > highcut) continue; - texnum = texturetranslation[sides[rover->master->sidenum[0]].midtexture]; + texnum = R_GetTextureNum(sides[rover->master->sidenum[0]].midtexture); if (rover->master->flags & ML_TFERLINE) { size_t linenum = gr_curline->linedef-gr_backsector->lines[0]; newline = rover->master->frontsector->lines[0] + linenum; - texnum = texturetranslation[sides[newline->sidenum[0]].midtexture]; + texnum = R_GetTextureNum(sides[newline->sidenum[0]].midtexture); } #ifdef ESLOPE @@ -2366,13 +2370,13 @@ static void HWR_StoreWallRange(double startfrac, double endfrac) if (*rover->topheight < lowcut || *rover->bottomheight > highcut) continue; - texnum = texturetranslation[sides[rover->master->sidenum[0]].midtexture]; + texnum = R_GetTextureNum(sides[rover->master->sidenum[0]].midtexture); if (rover->master->flags & ML_TFERLINE) { size_t linenum = gr_curline->linedef-gr_backsector->lines[0]; newline = rover->master->frontsector->lines[0] + linenum; - texnum = texturetranslation[sides[newline->sidenum[0]].midtexture]; + texnum = R_GetTextureNum(sides[newline->sidenum[0]].midtexture); } #ifdef ESLOPE //backsides h = *rover->t_slope ? P_GetZAt(*rover->t_slope, v1x, v1y) : *rover->topheight; diff --git a/src/p_maputl.c b/src/p_maputl.c index fea8530a1..46b033386 100644 --- a/src/p_maputl.c +++ b/src/p_maputl.c @@ -572,51 +572,54 @@ void P_LineOpening(line_t *linedef, mobj_t *mobj) side_t *side = &sides[linedef->sidenum[0]]; fixed_t textop, texbottom, texheight; fixed_t texmid, delta1, delta2; + INT32 texnum = R_GetTextureNum(side->midtexture); // make sure the texture is actually valid - // Get the midtexture's height - texheight = textures[texturetranslation[side->midtexture]]->height << FRACBITS; + if (texnum) { + // Get the midtexture's height + texheight = textures[texnum]->height << FRACBITS; - // Set texbottom and textop to the Z coordinates of the texture's boundaries + // Set texbottom and textop to the Z coordinates of the texture's boundaries #if 0 // #ifdef POLYOBJECTS - // don't remove this code unless solid midtextures - // on non-solid polyobjects should NEVER happen in the future - if (linedef->polyobj && (linedef->polyobj->flags & POF_TESTHEIGHT)) { - if (linedef->flags & ML_EFFECT5 && !side->repeatcnt) { // "infinite" repeat - texbottom = back->floorheight + side->rowoffset; - textop = back->ceilingheight + side->rowoffset; - } else if (!!(linedef->flags & ML_DONTPEGBOTTOM) ^ !!(linedef->flags & ML_EFFECT3)) { - texbottom = back->floorheight + side->rowoffset; - textop = texbottom + texheight*(side->repeatcnt+1); - } else { - textop = back->ceilingheight + side->rowoffset; - texbottom = textop - texheight*(side->repeatcnt+1); - } - } else + // don't remove this code unless solid midtextures + // on non-solid polyobjects should NEVER happen in the future + if (linedef->polyobj && (linedef->polyobj->flags & POF_TESTHEIGHT)) { + if (linedef->flags & ML_EFFECT5 && !side->repeatcnt) { // "infinite" repeat + texbottom = back->floorheight + side->rowoffset; + textop = back->ceilingheight + side->rowoffset; + } else if (!!(linedef->flags & ML_DONTPEGBOTTOM) ^ !!(linedef->flags & ML_EFFECT3)) { + texbottom = back->floorheight + side->rowoffset; + textop = texbottom + texheight*(side->repeatcnt+1); + } else { + textop = back->ceilingheight + side->rowoffset; + texbottom = textop - texheight*(side->repeatcnt+1); + } + } else #endif - { - if (linedef->flags & ML_EFFECT5 && !side->repeatcnt) { // "infinite" repeat - texbottom = openbottom + side->rowoffset; - textop = opentop + side->rowoffset; - } else if (!!(linedef->flags & ML_DONTPEGBOTTOM) ^ !!(linedef->flags & ML_EFFECT3)) { - texbottom = openbottom + side->rowoffset; - textop = texbottom + texheight*(side->repeatcnt+1); - } else { - textop = opentop + side->rowoffset; - texbottom = textop - texheight*(side->repeatcnt+1); + { + if (linedef->flags & ML_EFFECT5 && !side->repeatcnt) { // "infinite" repeat + texbottom = openbottom + side->rowoffset; + textop = opentop + side->rowoffset; + } else if (!!(linedef->flags & ML_DONTPEGBOTTOM) ^ !!(linedef->flags & ML_EFFECT3)) { + texbottom = openbottom + side->rowoffset; + textop = texbottom + texheight*(side->repeatcnt+1); + } else { + textop = opentop + side->rowoffset; + texbottom = textop - texheight*(side->repeatcnt+1); + } } - } - texmid = texbottom+(textop-texbottom)/2; + texmid = texbottom+(textop-texbottom)/2; - delta1 = abs(mobj->z - texmid); - delta2 = abs(thingtop - texmid); + delta1 = abs(mobj->z - texmid); + delta2 = abs(thingtop - texmid); - if (delta1 > delta2) { // Below - if (opentop > texbottom) - opentop = texbottom; - } else { // Above - if (openbottom < textop) - openbottom = textop; + if (delta1 > delta2) { // Below + if (opentop > texbottom) + opentop = texbottom; + } else { // Above + if (openbottom < textop) + openbottom = textop; + } } } diff --git a/src/r_data.c b/src/r_data.c index cb5cf3591..c24cca91b 100644 --- a/src/r_data.c +++ b/src/r_data.c @@ -303,6 +303,20 @@ done: return blocktex; } +// +// R_GetTextureNum +// +// Returns the actual texture id that we should use. +// This can either be texnum, the current frame for texnum's anim (if animated), +// or 0 if not valid. +// +INT32 R_GetTextureNum(INT32 texnum) +{ + if (texnum < 0 || texnum >= numtextures) + return 0; + return texturetranslation[texnum]; +} + // // R_GetColumn // diff --git a/src/r_data.h b/src/r_data.h index 69a2882af..68af0325f 100644 --- a/src/r_data.h +++ b/src/r_data.h @@ -65,6 +65,8 @@ extern CV_PossibleValue_t Color_cons_t[]; void R_LoadTextures(void); void R_FlushTextureCache(void); +INT32 R_GetTextureNum(INT32 texnum); + // Retrieve column data for span blitting. UINT8 *R_GetColumn(fixed_t tex, INT32 col); diff --git a/src/r_segs.c b/src/r_segs.c index cb78743b6..e0a081374 100644 --- a/src/r_segs.c +++ b/src/r_segs.c @@ -300,7 +300,7 @@ void R_RenderMaskedSegRange(drawseg_t *ds, INT32 x1, INT32 x2) curline = ds->curline; frontsector = curline->frontsector; backsector = curline->backsector; - texnum = texturetranslation[curline->sidedef->midtexture]; + texnum = R_GetTextureNum(curline->sidedef->midtexture); windowbottom = windowtop = sprbotscreen = INT32_MAX; // hack translucent linedef types (900-909 for transtables 1-9) @@ -740,7 +740,7 @@ void R_RenderThickSideRange(drawseg_t *ds, INT32 x1, INT32 x2, ffloor_t *pfloor) curline = ds->curline; backsector = pfloor->target; frontsector = curline->frontsector == pfloor->target ? curline->backsector : curline->frontsector; - texnum = texturetranslation[sides[pfloor->master->sidenum[0]].midtexture]; + texnum = R_GetTextureNum(sides[pfloor->master->sidenum[0]].midtexture); colfunc = wallcolfunc; @@ -748,7 +748,7 @@ void R_RenderThickSideRange(drawseg_t *ds, INT32 x1, INT32 x2, ffloor_t *pfloor) { size_t linenum = curline->linedef-backsector->lines[0]; newline = pfloor->master->frontsector->lines[0] + linenum; - texnum = texturetranslation[sides[newline->sidenum[0]].midtexture]; + texnum = R_GetTextureNum(sides[newline->sidenum[0]].midtexture); } if (pfloor->flags & FF_TRANSLUCENT) @@ -1878,14 +1878,16 @@ void R_StoreWallRange(INT32 start, INT32 stop) if (!backsector) { + fixed_t texheight; // single sided line - midtexture = texturetranslation[sidedef->midtexture]; + midtexture = R_GetTextureNum(sidedef->midtexture); + texheight = textureheight[midtexture]; // a single sided line is terminal, so it must mark ends markfloor = markceiling = true; #ifdef ESLOPE if (linedef->flags & ML_EFFECT2) { if (linedef->flags & ML_DONTPEGBOTTOM) - rw_midtexturemid = frontsector->floorheight + textureheight[sidedef->midtexture] - viewz; + rw_midtexturemid = frontsector->floorheight + texheight - viewz; else rw_midtexturemid = frontsector->ceilingheight - viewz; } @@ -1894,10 +1896,10 @@ void R_StoreWallRange(INT32 start, INT32 stop) if (linedef->flags & ML_DONTPEGBOTTOM) { #ifdef ESLOPE - rw_midtexturemid = worldbottom + textureheight[sidedef->midtexture]; + rw_midtexturemid = worldbottom + texheight; rw_midtextureslide = floorfrontslide; #else - vtop = frontsector->floorheight + textureheight[sidedef->midtexture]; + vtop = frontsector->floorheight + texheight; // bottom of texture at bottom rw_midtexturemid = vtop - viewz; #endif @@ -2129,76 +2131,50 @@ void R_StoreWallRange(INT32 start, INT32 stop) #endif ) { + fixed_t texheight; // top texture if ((linedef->flags & (ML_DONTPEGTOP) && (linedef->flags & ML_DONTPEGBOTTOM)) && linedef->sidenum[1] != 0xffff) { // Special case... use offsets from 2nd side but only if it has a texture. side_t *def = &sides[linedef->sidenum[1]]; - toptexture = texturetranslation[def->toptexture]; + toptexture = R_GetTextureNum(def->toptexture); if (!toptexture) //Second side has no texture, use the first side's instead. - toptexture = texturetranslation[sidedef->toptexture]; - -#ifdef ESLOPE - if (!(linedef->flags & ML_EFFECT1)) { // Ignore slopes for lower/upper textures unless flag is checked - if (linedef->flags & ML_DONTPEGTOP) - rw_toptexturemid = frontsector->ceilingheight - viewz; - else - rw_toptexturemid = backsector->ceilingheight - viewz; - } else -#endif - if (linedef->flags & ML_DONTPEGTOP) - { - // top of texture at top - rw_toptexturemid = worldtop; -#ifdef ESLOPE - rw_toptextureslide = ceilingfrontslide; -#endif - } - else - { -#ifdef ESLOPE - rw_toptexturemid = worldhigh + textureheight[def->toptexture]; - rw_toptextureslide = ceilingbackslide; -#else - vtop = backsector->ceilingheight + textureheight[def->toptexture]; - // bottom of texture - rw_toptexturemid = vtop - viewz; -#endif - } + toptexture = R_GetTextureNum(sidedef->toptexture); + texheight = textureheight[toptexture]; } else { - toptexture = texturetranslation[sidedef->toptexture]; - + toptexture = R_GetTextureNum(sidedef->toptexture); + texheight = textureheight[toptexture]; + } #ifdef ESLOPE - if (!(linedef->flags & ML_EFFECT1)) { // Ignore slopes for lower/upper textures unless flag is checked - if (linedef->flags & ML_DONTPEGTOP) - rw_toptexturemid = frontsector->ceilingheight - viewz; - else - rw_toptexturemid = backsector->ceilingheight - viewz; - } else -#endif + if (!(linedef->flags & ML_EFFECT1)) { // Ignore slopes for lower/upper textures unless flag is checked if (linedef->flags & ML_DONTPEGTOP) - { - // top of texture at top - rw_toptexturemid = worldtop; -#ifdef ESLOPE - rw_toptextureslide = ceilingfrontslide; -#endif - } + rw_toptexturemid = frontsector->ceilingheight - viewz; else - { -#ifdef ESLOPE - rw_toptexturemid = worldhigh + textureheight[sidedef->toptexture]; - rw_toptextureslide = ceilingbackslide; -#else - vtop = backsector->ceilingheight + textureheight[sidedef->toptexture]; - // bottom of texture - rw_toptexturemid = vtop - viewz; + rw_toptexturemid = backsector->ceilingheight - viewz; + } else +#endif + if (linedef->flags & ML_DONTPEGTOP) + { + // top of texture at top + rw_toptexturemid = worldtop; +#ifdef ESLOPE + rw_toptextureslide = ceilingfrontslide; +#endif + } + else + { +#ifdef ESLOPE + rw_toptexturemid = worldhigh + texheight; + rw_toptextureslide = ceilingbackslide; +#else + vtop = backsector->ceilingheight + texheight; + // bottom of texture + rw_toptexturemid = vtop - viewz; #endif - } } } // check BOTTOM TEXTURE @@ -2209,7 +2185,7 @@ void R_StoreWallRange(INT32 start, INT32 stop) ) //seulement si VISIBLE!!! { // bottom texture - bottomtexture = texturetranslation[sidedef->bottomtexture]; + bottomtexture = R_GetTextureNum(sidedef->bottomtexture); #ifdef ESLOPE if (!(linedef->flags & ML_EFFECT1)) { // Ignore slopes for lower/upper textures unless flag is checked @@ -2494,7 +2470,7 @@ void R_StoreWallRange(INT32 start, INT32 stop) ds_p->numthicksides = numthicksides = i; } - if (sidedef->midtexture) + if (sidedef->midtexture > 0 && sidedef->midtexture < numtextures) { // masked midtexture if (!ds_p->thicksidecol) @@ -3101,12 +3077,12 @@ void R_StoreWallRange(INT32 start, INT32 stop) if (maskedtexture && !(ds_p->silhouette & SIL_TOP)) { ds_p->silhouette |= SIL_TOP; - ds_p->tsilheight = sidedef->midtexture ? INT32_MIN: INT32_MAX; + ds_p->tsilheight = (sidedef->midtexture > 0 && sidedef->midtexture < numtextures) ? INT32_MIN: INT32_MAX; } if (maskedtexture && !(ds_p->silhouette & SIL_BOTTOM)) { ds_p->silhouette |= SIL_BOTTOM; - ds_p->bsilheight = sidedef->midtexture ? INT32_MAX: INT32_MIN; + ds_p->bsilheight = (sidedef->midtexture > 0 && sidedef->midtexture < numtextures) ? INT32_MAX: INT32_MIN; } ds_p++; } From 8e56582728e02176b32890c89fc105df2a0bd0f3 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Sat, 17 Dec 2016 19:59:54 +0000 Subject: [PATCH 133/172] Created R_CheckTextureCache to make sure midtexture/FOF walls cache their textures before choosing colfunc_2s, for software mode --- src/r_data.c | 12 ++++++++++++ src/r_data.h | 1 + src/r_segs.c | 6 ++++++ 3 files changed, 19 insertions(+) diff --git a/src/r_data.c b/src/r_data.c index c24cca91b..bb12f916f 100644 --- a/src/r_data.c +++ b/src/r_data.c @@ -317,6 +317,18 @@ INT32 R_GetTextureNum(INT32 texnum) return texturetranslation[texnum]; } +// +// R_CheckTextureCache +// +// Use this if you need to make sure the texture is cached before R_GetColumn calls +// e.g.: midtextures and FOF walls +// +void R_CheckTextureCache(INT32 tex) +{ + if (!texturecache[tex]) + R_GenerateTexture(tex); +} + // // R_GetColumn // diff --git a/src/r_data.h b/src/r_data.h index 68af0325f..1e9e0eb5e 100644 --- a/src/r_data.h +++ b/src/r_data.h @@ -66,6 +66,7 @@ void R_LoadTextures(void); void R_FlushTextureCache(void); INT32 R_GetTextureNum(INT32 texnum); +void R_CheckTextureCache(INT32 tex); // Retrieve column data for span blitting. UINT8 *R_GetColumn(fixed_t tex, INT32 col); diff --git a/src/r_segs.c b/src/r_segs.c index e0a081374..ab5010824 100644 --- a/src/r_segs.c +++ b/src/r_segs.c @@ -344,6 +344,9 @@ void R_RenderMaskedSegRange(drawseg_t *ds, INT32 x1, INT32 x2) rw_scalestep = ds->scalestep; spryscale = ds->scale1 + (x1 - ds->x1)*rw_scalestep; + // Texture must be cached before setting colfunc_2s, + // otherwise texture[texnum]->holes may be false when it shouldn't be + R_CheckTextureCache(texnum); // handle case where multipatch texture is drawn on a 2sided wall, multi-patch textures // are not stored per-column with post info in SRB2 if (textures[texnum]->holes) @@ -968,6 +971,9 @@ void R_RenderThickSideRange(drawseg_t *ds, INT32 x1, INT32 x2, ffloor_t *pfloor) dc_texturemid += offsetvalue; + // Texture must be cached before setting colfunc_2s, + // otherwise texture[texnum]->holes may be false when it shouldn't be + R_CheckTextureCache(texnum); //faB: handle case where multipatch texture is drawn on a 2sided wall, multi-patch textures // are not stored per-column with post info anymore in Doom Legacy if (textures[texnum]->holes) From 5c295d5733e9fed37ecd8fe7d4815e5c2105f2d7 Mon Sep 17 00:00:00 2001 From: Alam Ed Arias Date: Thu, 22 Dec 2016 18:59:18 -0500 Subject: [PATCH 134/172] Codeblock: fixup sdl2 to sdl --- SRB2.cbp | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/SRB2.cbp b/SRB2.cbp index 99a712264..17ca0b561 100644 --- a/SRB2.cbp +++ b/SRB2.cbp @@ -4157,7 +4157,7 @@ HW3SOUND for 3D hardware sound support