From 64a1fa54219c9fa2e2fa61fb2b2b68e4fe67f6ce Mon Sep 17 00:00:00 2001 From: toasterbabe Date: Tue, 11 Oct 2016 23:35:31 +0100 Subject: [PATCH] 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