From 23f9649fb9b03f07059f3fda3f514d23b313c407 Mon Sep 17 00:00:00 2001 From: Sally Coolatta Date: Sun, 9 Jan 2022 00:00:01 -0500 Subject: [PATCH 01/21] More extremely scaled grow & shrink players! - Grow is x2 instead of x1.5. - Shrink is x0.5 instead of x0.75. - Physics were left ALONE!! This is purely a HITBOX / VISUAL change!! Grow isn't any faster, and Shrink isn't any slower!! The only potential worry is low ceilings in maps!! --- src/k_kart.c | 81 ++++++++++++++++++++++++++++++++++++++++--------- src/k_kart.h | 7 +++++ src/k_respawn.c | 4 +-- src/p_mobj.c | 7 +++-- 4 files changed, 81 insertions(+), 18 deletions(-) diff --git a/src/k_kart.c b/src/k_kart.c index bd6924e12..04b65ac75 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -2903,6 +2903,30 @@ static void K_GetKartBoostPower(player_t *player) player->numboosts = numboosts; } +fixed_t K_GrowShrinkSpeedMul(player_t *player) +{ + fixed_t scaleDiff = player->mo->scale - mapobjectscale; + fixed_t physicsScale = mapobjectscale; + fixed_t speedMul = FRACUNIT; + + if (scaleDiff > 0) + { + // Grown + // Change x2 speed into x1.5 + physicsScale = FixedMul(GROW_PHYSICS_SCALE, mapobjectscale); + speedMul = FixedDiv(physicsScale, player->mo->scale); + } + else if (scaleDiff < 0) + { + // Shrunk + // Change x0.5 speed into x0.75 + physicsScale = FixedMul(SHRINK_PHYSICS_SCALE, mapobjectscale); + speedMul = FixedDiv(physicsScale, player->mo->scale); + } + + return speedMul; +} + // Returns kart speed from a stat. Boost power and scale are NOT taken into account, no player or object is necessary. fixed_t K_GetKartSpeedFromStat(UINT8 kartspeed) { @@ -2919,9 +2943,8 @@ fixed_t K_GetKartSpeedFromStat(UINT8 kartspeed) fixed_t K_GetKartSpeed(player_t *player, boolean doboostpower) { - fixed_t finalspeed; - - finalspeed = K_GetKartSpeedFromStat(player->kartspeed); + const boolean mobjValid = (player->mo != NULL && P_MobjWasRemoved(player->mo) == false); + fixed_t finalspeed = K_GetKartSpeedFromStat(player->kartspeed); if (player->spheres > 0) { @@ -2942,17 +2965,24 @@ fixed_t K_GetKartSpeed(player_t *player, boolean doboostpower) } } - if (player->mo && !P_MobjWasRemoved(player->mo)) + if (mobjValid == true) + { finalspeed = FixedMul(finalspeed, player->mo->scale); + finalspeed = FixedMul(finalspeed, K_GrowShrinkSpeedMul(player)); + } + else + { + finalspeed = FixedMul(finalspeed, mapobjectscale); + } - if (doboostpower) + if (doboostpower == true) { if (K_PlayerUsesBotMovement(player)) { finalspeed = FixedMul(finalspeed, K_BotTopSpeedRubberband(player)); } - return FixedMul(finalspeed, player->boostpower+player->speedboost); + finalspeed = FixedMul(finalspeed, player->boostpower + player->speedboost); } return finalspeed; @@ -3262,8 +3292,11 @@ static void K_RemoveGrowShrink(player_t *player) player->mo->scalespeed = mapobjectscale/TICRATE; player->mo->destscale = mapobjectscale; + if (cv_kartdebugshrink.value && !modeattacking && !player->bot) - player->mo->destscale = (6*player->mo->destscale)/8; + { + player->mo->destscale = FixedMul(player->mo->destscale, SHRINK_SCALE); + } } player->growshrinktimer = 0; @@ -5197,9 +5230,13 @@ static void K_DoShrink(player_t *user) if (players[i].mo && !P_MobjWasRemoved(players[i].mo)) { players[i].mo->scalespeed = mapobjectscale/TICRATE; - players[i].mo->destscale = (6*mapobjectscale)/8; + players[i].mo->destscale = FixedMul(mapobjectscale, SHRINK_SCALE); + if (cv_kartdebugshrink.value && !modeattacking && !players[i].bot) - players[i].mo->destscale = (6*players[i].mo->destscale)/8; + { + players[i].mo->destscale = FixedMul(players[i].mo->destscale, SHRINK_SCALE); + } + S_StartSound(players[i].mo, sfx_kc59); } } @@ -9036,23 +9073,39 @@ void K_MoveKartPlayer(player_t *player, boolean onground) case KITEM_GROW: if (ATTACK_IS_DOWN && !HOLDING_ITEM && NO_HYUDORO) { - if (player->growshrinktimer < 0) // If you're shrunk, then "grow" will just make you normal again. + if (player->growshrinktimer < 0) + { + // If you're shrunk, then "grow" will just make you normal again. K_RemoveGrowShrink(player); + } else { K_PlayPowerGloatSound(player->mo); + player->mo->scalespeed = mapobjectscale/TICRATE; - player->mo->destscale = (3*mapobjectscale)/2; + player->mo->destscale = FixedMul(mapobjectscale, GROW_SCALE); + if (cv_kartdebugshrink.value && !modeattacking && !player->bot) - player->mo->destscale = (6*player->mo->destscale)/8; + { + player->mo->destscale = FixedMul(player->mo->destscale, SHRINK_SCALE); + } + player->growshrinktimer = itemtime+(4*TICRATE); // 12 seconds - if (P_IsLocalPlayer(player)) + + if (P_IsLocalPlayer(player) == true) + { S_ChangeMusicSpecial("kgrow"); - if (! P_IsDisplayPlayer(player)) + } + + if (P_IsDisplayPlayer(player) == false) + { S_StartSound(player->mo, (cv_kartinvinsfx.value ? sfx_alarmg : sfx_kgrow)); + } + P_RestoreMusic(player); S_StartSound(player->mo, sfx_kc5a); } + player->itemamount--; } break; diff --git a/src/k_kart.h b/src/k_kart.h index 04d80fd05..c05620b74 100644 --- a/src/k_kart.h +++ b/src/k_kart.h @@ -22,6 +22,12 @@ Make sure this matches the actual number of states #define MAXHITLAGTICS 18 //12 #define HITLAGJITTERS (FRACUNIT / 20) +#define GROW_SCALE (2*FRACUNIT) +#define SHRINK_SCALE (FRACUNIT/2) + +#define GROW_PHYSICS_SCALE (3*FRACUNIT/2) +#define SHRINK_PHYSICS_SCALE (3*FRACUNIT/4) + player_t *K_GetItemBoxPlayer(mobj_t *mobj); angle_t K_ReflectAngle(angle_t angle, angle_t against, fixed_t maxspeed, fixed_t yourspeed); @@ -115,6 +121,7 @@ boolean K_WaterRun(player_t *player); void K_ApplyTripWire(player_t *player, tripwirestate_t state); INT16 K_GetSpindashChargeTime(player_t *player); fixed_t K_GetSpindashChargeSpeed(player_t *player); +fixed_t K_GrowShrinkSpeedMul(player_t *player); fixed_t K_GetKartSpeedFromStat(UINT8 kartspeed); fixed_t K_GetKartSpeed(player_t *player, boolean doboostpower); fixed_t K_GetKartAccel(player_t *player); diff --git a/src/k_respawn.c b/src/k_respawn.c index b79a5ca69..2146b2d48 100644 --- a/src/k_respawn.c +++ b/src/k_respawn.c @@ -672,11 +672,11 @@ static void K_HandleDropDash(player_t *player) if (player->growshrinktimer < 0) { player->mo->scalespeed = mapobjectscale/TICRATE; - player->mo->destscale = (6*mapobjectscale)/8; + player->mo->destscale = FixedMul(mapobjectscale, SHRINK_SCALE); if (cv_kartdebugshrink.value && !modeattacking && !player->bot) { - player->mo->destscale = (6*player->mo->destscale)/8; + player->mo->destscale = FixedMul(player->mo->destscale, SHRINK_SCALE); } } diff --git a/src/p_mobj.c b/src/p_mobj.c index f3d326862..31f4e2d08 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -10843,9 +10843,12 @@ void P_SpawnPlayer(INT32 playernum) P_SetTarget(&p->follower, NULL); // cleanse follower from existence - // set the scale to the mobj's destscale so settings get correctly set. if we don't, they sometimes don't. if (cv_kartdebugshrink.value && !modeattacking && !p->bot) - mobj->destscale = 6*mobj->destscale/8; + { + mobj->destscale = FixedMul(mobj->destscale, SHRINK_SCALE); + } + + // set the scale to the mobj's destscale so settings get correctly set. if we don't, they sometimes don't. P_SetScale(mobj, mobj->destscale); P_FlashPal(p, 0, 0); // Resets From 1ad82e7651fdb796caa395bfddafb30ec5b40d92 Mon Sep 17 00:00:00 2001 From: Sally Coolatta Date: Sun, 9 Jan 2022 00:10:14 -0500 Subject: [PATCH 02/21] Update how scaled speed is calculated This makes it so that the scaled speed shows up on the percentage speedometer. --- src/k_kart.c | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/src/k_kart.c b/src/k_kart.c index 04b65ac75..1085d0a76 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -2906,22 +2906,20 @@ static void K_GetKartBoostPower(player_t *player) fixed_t K_GrowShrinkSpeedMul(player_t *player) { fixed_t scaleDiff = player->mo->scale - mapobjectscale; - fixed_t physicsScale = mapobjectscale; + fixed_t playerScale = FixedDiv(player->mo->scale, mapobjectscale); fixed_t speedMul = FRACUNIT; if (scaleDiff > 0) { // Grown // Change x2 speed into x1.5 - physicsScale = FixedMul(GROW_PHYSICS_SCALE, mapobjectscale); - speedMul = FixedDiv(physicsScale, player->mo->scale); + speedMul = FixedDiv(FixedMul(playerScale, GROW_PHYSICS_SCALE), GROW_SCALE); } else if (scaleDiff < 0) { // Shrunk // Change x0.5 speed into x0.75 - physicsScale = FixedMul(SHRINK_PHYSICS_SCALE, mapobjectscale); - speedMul = FixedDiv(physicsScale, player->mo->scale); + speedMul = FixedDiv(FixedMul(playerScale, SHRINK_PHYSICS_SCALE), SHRINK_SCALE); } return speedMul; @@ -2965,18 +2963,16 @@ fixed_t K_GetKartSpeed(player_t *player, boolean doboostpower) } } - if (mobjValid == true) - { - finalspeed = FixedMul(finalspeed, player->mo->scale); - finalspeed = FixedMul(finalspeed, K_GrowShrinkSpeedMul(player)); - } - else - { - finalspeed = FixedMul(finalspeed, mapobjectscale); - } + finalspeed = FixedMul(finalspeed, mapobjectscale); if (doboostpower == true) { + if (mobjValid == true) + { + // Scale with the player. + finalspeed = FixedMul(finalspeed, K_GrowShrinkSpeedMul(player)); + } + if (K_PlayerUsesBotMovement(player)) { finalspeed = FixedMul(finalspeed, K_BotTopSpeedRubberband(player)); From 7e76366fe87af2c5e26067c5354eab64373a2deb Mon Sep 17 00:00:00 2001 From: Sally Coolatta Date: Sun, 9 Jan 2022 01:16:36 -0500 Subject: [PATCH 03/21] Keep your large items --- src/d_player.h | 5 ++ src/k_kart.c | 151 ++++++++++++++++++++++++++++++++++++++----------- src/k_kart.h | 4 ++ src/p_enemy.c | 2 +- 4 files changed, 129 insertions(+), 33 deletions(-) diff --git a/src/d_player.h b/src/d_player.h index 738f8240b..28a80791e 100644 --- a/src/d_player.h +++ b/src/d_player.h @@ -260,6 +260,10 @@ typedef enum // for kickstartaccel #define ACCEL_KICKSTART 35 +#define ITEMSCALE_NORMAL 0 +#define ITEMSCALE_GROW 1 +#define ITEMSCALE_SHRINK 2 + // player_t struct for all respawn variables typedef struct respawnvars_s { @@ -428,6 +432,7 @@ typedef struct player_s SINT8 itemtype; // KITEM_ constant for item number UINT8 itemamount; // Amount of said item SINT8 throwdir; // Held dir of controls; 1 = forward, 0 = none, -1 = backward (was "player->heldDir") + UINT8 itemscale; // Item scale value, from when an item was taken out. (0 for normal, 1 for grow, 2 for shrink.) UINT8 sadtimer; // How long you've been sad diff --git a/src/k_kart.c b/src/k_kart.c index 1085d0a76..9a0442549 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -3816,24 +3816,56 @@ void K_SpawnMineExplosion(mobj_t *source, UINT8 color) #undef MINEQUAKEDIST +fixed_t K_ItemScaleForPlayer(player_t *player) +{ + switch (player->itemscale) + { + case ITEMSCALE_GROW: + return FixedMul(GROW_SCALE, mapobjectscale); + + case ITEMSCALE_SHRINK: + return FixedMul(SHRINK_SCALE, mapobjectscale); + + default: + return mapobjectscale; + } +} + static mobj_t *K_SpawnKartMissile(mobj_t *source, mobjtype_t type, angle_t an, INT32 flags2, fixed_t speed) { mobj_t *th; fixed_t x, y, z; fixed_t finalspeed = speed; + fixed_t finalscale = mapobjectscale; mobj_t *throwmo; - if (source->player && source->player->speed > K_GetKartSpeed(source->player, false)) + if (source->player != NULL) { - angle_t input = source->angle - an; - boolean invert = (input > ANGLE_180); - if (invert) - input = InvAngle(input); + if (source->player->itemscale == ITEMSCALE_SHRINK) + { + // Nerf the base item speed a bit. + finalspeed = FixedMul(finalspeed, SHRINK_PHYSICS_SCALE); + } - finalspeed = max(speed, FixedMul(speed, FixedMul( - FixedDiv(source->player->speed, K_GetKartSpeed(source->player, false)), // Multiply speed to be proportional to your own, boosted maxspeed. - (((180<player->speed > K_GetKartSpeed(source->player, false)) + { + angle_t input = source->angle - an; + boolean invert = (input > ANGLE_180); + if (invert) + input = InvAngle(input); + + finalspeed = max(speed, FixedMul(speed, FixedMul( + FixedDiv(source->player->speed, K_GetKartSpeed(source->player, false)), // Multiply speed to be proportional to your own, boosted maxspeed. + (((180<player); + } + + if (type == MT_BUBBLESHIELDTRAP) + { + finalscale = source->scale; } x = source->x + source->momx + FixedMul(finalspeed, FINECOSINE(an>>ANGLETOFINESHIFT)); @@ -3852,8 +3884,8 @@ static mobj_t *K_SpawnKartMissile(mobj_t *source, mobjtype_t type, angle_t an, I P_SetTarget(&th->target, source); - P_SetScale(th, source->scale); - th->destscale = source->destscale; + P_SetScale(th, finalscale); + th->destscale = finalscale; if (P_IsObjectOnGround(source)) { @@ -3876,6 +3908,11 @@ static mobj_t *K_SpawnKartMissile(mobj_t *source, mobjtype_t type, angle_t an, I th->momy = FixedMul(finalspeed, FINESINE(an>>ANGLETOFINESHIFT)); th->momz = source->momz; + if (source->player != NULL) + { + th->cusval = source->player->itemscale; + } + switch (type) { case MT_ORBINAUT: @@ -4769,13 +4806,15 @@ mobj_t *K_ThrowKartItem(player_t *player, boolean missile, mobjtype_t mapthing, } else { + fixed_t finalscale = K_ItemScaleForPlayer(player); + player->bananadrag = 0; // RESET timer, for multiple bananas if (dir > 0) { // Shoot forward mo = P_SpawnMobj(player->mo->x, player->mo->y, player->mo->z + player->mo->height/2, mapthing); - //K_FlipFromObject(mo, player->mo); + // These are really weird so let's make it a very specific case to make SURE it works... if (player->mo->eflags & MFE_VERTICALFLIP) { @@ -4802,6 +4841,9 @@ mobj_t *K_ThrowKartItem(player_t *player, boolean missile, mobjtype_t mapthing, if (mo->eflags & MFE_UNDERWATER) mo->momz = (117 * mo->momz) / 200; + + P_SetScale(mo, finalscale); + mo->destscale = finalscale; } // this is the small graphic effect that plops in you when you throw an item: @@ -4816,6 +4858,9 @@ mobj_t *K_ThrowKartItem(player_t *player, boolean missile, mobjtype_t mapthing, } throwmo->movecount = 0; // above player + + P_SetScale(throwmo, finalscale); + throwmo->destscale = finalscale; } else { @@ -4853,8 +4898,8 @@ mobj_t *K_ThrowKartItem(player_t *player, boolean missile, mobjtype_t mapthing, mo->threshold = 10; P_SetTarget(&mo->target, player->mo); - P_SetScale(mo, player->mo->scale); - mo->destscale = player->mo->destscale; + P_SetScale(mo, finalscale); + mo->destscale = finalscale; if (P_IsObjectOnGround(player->mo)) { @@ -4924,6 +4969,10 @@ void K_PuntMine(mobj_t *origMine, mobj_t *punter) mine->floorz = origMine->floorz; mine->ceilingz = origMine->ceilingz; + P_SetScale(mine, origMine->scale); + mine->destscale = origMine->destscale; + mine->scalespeed = origMine->scalespeed; + // Copy interp data mine->old_angle = origMine->old_angle; mine->old_x = origMine->old_x; @@ -4932,8 +4981,7 @@ void K_PuntMine(mobj_t *origMine, mobj_t *punter) // Since we aren't using P_KillMobj, we need to clean up the hnext reference P_SetTarget(&mineOwner->hnext, NULL); - mineOwner->player->bananadrag = 0; - mineOwner->player->pflags &= ~PF_ITEMOUT; + K_UnsetItemOut(mineOwner->player); if (mineOwner->player->itemamount) { @@ -5090,7 +5138,7 @@ static void K_DoHyudoroSteal(player_t *player) player->itemtype = KITEM_KITCHENSINK; player->itemamount = 1; - player->pflags &= ~PF_ITEMOUT; + K_UnsetItemOut(player); return; } else if ((gametype == GT_RACE && player->position == 1) || numplayers == 0) // No-one can be stolen from? Oh well... @@ -5116,11 +5164,11 @@ static void K_DoHyudoroSteal(player_t *player) player->itemtype = players[stealplayer].itemtype; player->itemamount = players[stealplayer].itemamount; - player->pflags &= ~PF_ITEMOUT; + K_UnsetItemOut(player); players[stealplayer].itemtype = KITEM_NONE; players[stealplayer].itemamount = 0; - players[stealplayer].pflags &= ~PF_ITEMOUT; + K_UnsetItemOut(&players[stealplayer]); if (P_IsDisplayPlayer(&players[stealplayer]) && !r_splitscreen) S_StartSound(NULL, sfx_s3k92); @@ -5440,7 +5488,7 @@ void K_DropHnextList(player_t *player, boolean keepshields) player->curshield = KSHIELD_NONE; player->itemtype = KITEM_NONE; player->itemamount = 0; - player->pflags &= ~PF_ITEMOUT; + K_UnsetItemOut(player); } nextwork = work->hnext; @@ -5489,6 +5537,10 @@ void K_DropHnextList(player_t *player, boolean keepshields) dropwork->angle = work->angle; + P_SetScale(dropwork, work->scale); + dropwork->destscale = work->destscale; + dropwork->scalespeed = work->scalespeed; + dropwork->flags |= MF_NOCLIPTHING; dropwork->flags2 = work->flags2; dropwork->eflags = work->eflags; @@ -5578,7 +5630,7 @@ void K_DropHnextList(player_t *player, boolean keepshields) && (dropall || (--player->itemamount <= 0))) { player->itemamount = 0; - player->pflags &= ~PF_ITEMOUT; + K_UnsetItemOut(player); player->itemtype = KITEM_NONE; } } @@ -5953,6 +6005,8 @@ static void K_CalculateBananaSlope(mobj_t *mobj, fixed_t x, fixed_t y, fixed_t z // Move the hnext chain! static void K_MoveHeldObjects(player_t *player) { + fixed_t finalscale = INT32_MAX; + if (!player->mo) return; @@ -5964,7 +6018,7 @@ static void K_MoveHeldObjects(player_t *player) else if (player->pflags & PF_ITEMOUT) { player->itemamount = 0; - player->pflags &= ~PF_ITEMOUT; + K_UnsetItemOut(player); player->itemtype = KITEM_NONE; } return; @@ -5980,12 +6034,14 @@ static void K_MoveHeldObjects(player_t *player) else if (player->pflags & PF_ITEMOUT) { player->itemamount = 0; - player->pflags &= ~PF_ITEMOUT; + K_UnsetItemOut(player); player->itemtype = KITEM_NONE; } return; } + finalscale = K_ItemScaleForPlayer(player); + switch (player->mo->hnext->type) { case MT_ORBINAUT_SHIELD: // Kart orbit items @@ -6024,7 +6080,7 @@ static void K_MoveHeldObjects(player_t *player) cur->eflags &= ~MFE_VERTICALFLIP; // Shrink your items if the player shrunk too. - P_SetScale(cur, (cur->destscale = FixedMul(FixedDiv(cur->extravalue1, radius), player->mo->scale))); + P_SetScale(cur, (cur->destscale = FixedMul(FixedDiv(cur->extravalue1, radius), finalscale))); if (P_MobjFlip(cur) > 0) z = player->mo->z; @@ -6055,7 +6111,7 @@ static void K_MoveHeldObjects(player_t *player) } // Center it during the scale up animation - z += (FixedMul(mobjinfo[cur->type].height, player->mo->scale - cur->scale)>>1) * P_MobjFlip(cur); + z += (FixedMul(mobjinfo[cur->type].height, finalscale - cur->scale)>>1) * P_MobjFlip(cur); cur->z = z; cur->momx = cur->momy = 0; @@ -6117,7 +6173,7 @@ static void K_MoveHeldObjects(player_t *player) continue; // Shrink your items if the player shrunk too. - P_SetScale(cur, (cur->destscale = FixedMul(FixedDiv(cur->extravalue1, radius), player->mo->scale))); + P_SetScale(cur, (cur->destscale = FixedMul(FixedDiv(cur->extravalue1, radius), finalscale))); ang = targ->angle; targx = targ->x + P_ReturnThrustX(cur, ang + ANGLE_180, dist); @@ -8708,6 +8764,31 @@ static void K_trickPanelTimingVisual(player_t *player, fixed_t momz) #undef RADIUSSCALING #undef MINRADIUS +void K_SetItemOut(player_t *player) +{ + player->pflags |= PF_ITEMOUT; + + if (player->mo->scale >= FixedMul(GROW_PHYSICS_SCALE, mapobjectscale)) + { + player->itemscale = ITEMSCALE_GROW; + } + else if (player->mo->scale <= FixedMul(SHRINK_PHYSICS_SCALE, mapobjectscale)) + { + player->itemscale = ITEMSCALE_SHRINK; + } + else + { + player->itemscale = ITEMSCALE_NORMAL; + } +} + +void K_UnsetItemOut(player_t *player) +{ + player->pflags &= ~PF_ITEMOUT; + player->itemscale = ITEMSCALE_NORMAL; + player->bananadrag = 0; +} + // // K_MoveKartPlayer // @@ -8808,7 +8889,7 @@ void K_MoveKartPlayer(player_t *player, boolean onground) } else if (player->itemamount == 0) { - player->pflags &= ~PF_ITEMOUT; + K_UnsetItemOut(player); } else { @@ -8883,7 +8964,7 @@ void K_MoveKartPlayer(player_t *player, boolean onground) mobj_t *prev = player->mo; //K_PlayAttackTaunt(player->mo); - player->pflags |= PF_ITEMOUT; + K_SetItemOut(player); S_StartSound(player->mo, sfx_s254); for (moloop = 0; moloop < player->itemamount; moloop++) @@ -8898,6 +8979,7 @@ void K_MoveKartPlayer(player_t *player, boolean onground) mo->threshold = 10; mo->movecount = player->itemamount; mo->movedir = moloop+1; + mo->cusval = player->itemscale; P_SetTarget(&mo->target, player->mo); P_SetTarget(&mo->hprev, prev); P_SetTarget(&prev->hnext, mo); @@ -8927,6 +9009,7 @@ void K_MoveKartPlayer(player_t *player, boolean onground) mo->threshold = 10; mo->movecount = 1; mo->movedir = 1; + mo->cusval = player->itemscale; P_SetTarget(&mo->target, player->mo); P_SetTarget(&player->mo->hnext, mo); } @@ -8941,7 +9024,7 @@ void K_MoveKartPlayer(player_t *player, boolean onground) mobj_t *prev = player->mo; //K_PlayAttackTaunt(player->mo); - player->pflags |= PF_ITEMOUT; + K_SetItemOut(player); S_StartSound(player->mo, sfx_s3k3a); for (moloop = 0; moloop < player->itemamount; moloop++) @@ -8959,6 +9042,7 @@ void K_MoveKartPlayer(player_t *player, boolean onground) mo->movecount = player->itemamount; mo->movedir = mo->lastlook = moloop+1; mo->color = player->skincolor; + mo->cusval = player->itemscale; P_SetTarget(&mo->target, player->mo); P_SetTarget(&mo->hprev, prev); P_SetTarget(&prev->hnext, mo); @@ -8982,7 +9066,7 @@ void K_MoveKartPlayer(player_t *player, boolean onground) mobj_t *prev = player->mo; //K_PlayAttackTaunt(player->mo); - player->pflags |= PF_ITEMOUT; + K_SetItemOut(player); S_StartSound(player->mo, sfx_s3k3a); for (moloop = 0; moloop < player->itemamount; moloop++) @@ -8999,6 +9083,7 @@ void K_MoveKartPlayer(player_t *player, boolean onground) mo->threshold = 10; mo->movecount = player->itemamount; mo->movedir = mo->lastlook = moloop+1; + mo->cusval = player->itemscale; P_SetTarget(&mo->target, player->mo); P_SetTarget(&mo->hprev, prev); P_SetTarget(&prev->hnext, mo); @@ -9020,7 +9105,7 @@ void K_MoveKartPlayer(player_t *player, boolean onground) if (ATTACK_IS_DOWN && !HOLDING_ITEM && NO_HYUDORO) { mobj_t *mo; - player->pflags |= PF_ITEMOUT; + K_SetItemOut(player); S_StartSound(player->mo, sfx_s254); mo = P_SpawnMobj(player->mo->x, player->mo->y, player->mo->z, MT_SSMINE_SHIELD); if (mo) @@ -9029,6 +9114,7 @@ void K_MoveKartPlayer(player_t *player, boolean onground) mo->threshold = 10; mo->movecount = 1; mo->movedir = 1; + mo->cusval = player->itemscale; P_SetTarget(&mo->target, player->mo); P_SetTarget(&player->mo->hnext, mo); } @@ -9278,7 +9364,7 @@ void K_MoveKartPlayer(player_t *player, boolean onground) if (ATTACK_IS_DOWN && !HOLDING_ITEM && NO_HYUDORO) { mobj_t *mo; - player->pflags |= PF_ITEMOUT; + K_SetItemOut(player); S_StartSound(player->mo, sfx_s254); mo = P_SpawnMobj(player->mo->x, player->mo->y, player->mo->z, MT_SINK_SHIELD); if (mo) @@ -9287,6 +9373,7 @@ void K_MoveKartPlayer(player_t *player, boolean onground) mo->threshold = 10; mo->movecount = 1; mo->movedir = 1; + mo->cusval = player->itemscale; P_SetTarget(&mo->target, player->mo); P_SetTarget(&player->mo->hnext, mo); } diff --git a/src/k_kart.h b/src/k_kart.h index c05620b74..a8834397c 100644 --- a/src/k_kart.h +++ b/src/k_kart.h @@ -148,5 +148,9 @@ void K_PlayPainSound(mobj_t *source); void K_PlayHitEmSound(mobj_t *source); void K_PlayPowerGloatSound(mobj_t *source); +fixed_t K_ItemScaleForPlayer(player_t *player); +void K_SetItemOut(player_t *player); +void K_UnsetItemOut(player_t *player); + // ========================================================================= #endif // __K_KART__ diff --git a/src/p_enemy.c b/src/p_enemy.c index d9b1fd840..04e77bd8f 100644 --- a/src/p_enemy.c +++ b/src/p_enemy.c @@ -14107,7 +14107,7 @@ void A_SSMineExplode(mobj_t *actor) INT32 d; INT32 locvar1 = var1; mobjtype_t type; - explodedist = FixedMul((3*actor->info->painchance)/2, mapobjectscale); + explodedist = FixedMul((3*actor->info->painchance)/2, actor->scale); if (LUA_CallAction(A_SSMINEEXPLODE, actor)) return; From c606e1e96b4b4f03708a4b3863a2ba93886d0084 Mon Sep 17 00:00:00 2001 From: Sally Coolatta Date: Sun, 9 Jan 2022 04:08:26 -0500 Subject: [PATCH 04/21] Force shrink can be toggled individually online In preparation for a "make yourself small by default" cheat on the char select like SMK. --- src/d_netcmd.c | 23 +++++++++++++++---- src/d_netcmd.h | 2 +- src/d_player.h | 11 +++++---- src/deh_tables.c | 4 ++++ src/g_demo.c | 59 +++++++++++++++++++++++++++++++++++++----------- src/g_game.c | 34 ++++++++++++++++------------ src/g_game.h | 2 ++ src/k_kart.c | 35 ++++++++++++++++++++++++---- src/k_kart.h | 2 ++ src/k_respawn.c | 2 +- src/p_mobj.c | 2 +- src/p_setup.c | 1 + 12 files changed, 135 insertions(+), 42 deletions(-) diff --git a/src/d_netcmd.c b/src/d_netcmd.c index 7fa504e90..e17f5e826 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -423,7 +423,7 @@ consvar_t cv_kartallowgiveitem = CVAR_INIT ("kartallowgiveitem", #endif CV_NETVAR|CV_CHEAT|CV_NOSHOWHELP, CV_YesNo, NULL ); -consvar_t cv_kartdebugshrink = CVAR_INIT ("kartdebugshrink", "Off", CV_NETVAR|CV_CHEAT|CV_NOSHOWHELP, CV_OnOff, NULL); + consvar_t cv_kartdebugdistribution = CVAR_INIT ("kartdebugdistribution", "Off", CV_NETVAR|CV_CHEAT|CV_NOSHOWHELP, CV_OnOff, NULL); consvar_t cv_kartdebughuddrop = CVAR_INIT ("kartdebughuddrop", "Off", CV_NETVAR|CV_CHEAT|CV_NOSHOWHELP, CV_OnOff, NULL); static CV_PossibleValue_t kartdebugwaypoint_cons_t[] = {{0, "Off"}, {1, "Forwards"}, {2, "Backwards"}, {0, NULL}}; @@ -935,6 +935,7 @@ void D_RegisterClientCommands(void) for (i = 0; i < MAXSPLITSCREENPLAYERS; i++) { CV_RegisterVar(&cv_kickstartaccel[i]); + CV_RegisterVar(&cv_shrinkme[i]); CV_RegisterVar(&cv_turnaxis[i]); CV_RegisterVar(&cv_moveaxis[i]); CV_RegisterVar(&cv_brakeaxis[i]); @@ -1636,10 +1637,13 @@ void SendWeaponPref(UINT8 n) UINT8 buf[1]; buf[0] = 0; - // Player option cvars that need to be synched go HERE + if (cv_kickstartaccel[n].value) buf[0] |= 1; + if (cv_shrinkme[n].value) + buf[0] |= 2; + SendNetXCmdForPlayer(n, XD_WEAPONPREF, buf, 1); } @@ -1647,11 +1651,22 @@ static void Got_WeaponPref(UINT8 **cp,INT32 playernum) { UINT8 prefs = READUINT8(*cp); - // Player option cvars that need to be synched go HERE - players[playernum].pflags &= ~(PF_KICKSTARTACCEL); + players[playernum].pflags &= ~(PF_KICKSTARTACCEL|PF_SHRINKME); + if (prefs & 1) players[playernum].pflags |= PF_KICKSTARTACCEL; + if (prefs & 2) + players[playernum].pflags |= PF_SHRINKME; + + if (leveltime < 2) + { + // BAD HACK: No other place I tried to slot this in + // made it work for the host when they initally host, + // so this will have to do. + K_UpdateShrinkCheat(&players[playernum]); + } + // SEE ALSO g_demo.c demo_extradata[playernum] |= DXD_WEAPONPREF; } diff --git a/src/d_netcmd.h b/src/d_netcmd.h index 0e8ef25e2..e8d36e6f3 100644 --- a/src/d_netcmd.h +++ b/src/d_netcmd.h @@ -86,7 +86,7 @@ extern consvar_t cv_kartusepwrlv; extern consvar_t cv_votetime; -extern consvar_t cv_kartdebugitem, cv_kartdebugamount, cv_kartallowgiveitem, cv_kartdebugshrink, cv_kartdebugdistribution, cv_kartdebughuddrop; +extern consvar_t cv_kartdebugitem, cv_kartdebugamount, cv_kartallowgiveitem, cv_kartdebugdistribution, cv_kartdebughuddrop; extern consvar_t cv_kartdebugcheckpoint, cv_kartdebugnodes, cv_kartdebugcolorize; extern consvar_t cv_kartdebugwaypoints, cv_kartdebugbotpredict; diff --git a/src/d_player.h b/src/d_player.h index 28a80791e..30a9b4e3c 100644 --- a/src/d_player.h +++ b/src/d_player.h @@ -59,10 +59,10 @@ typedef enum typedef enum { // True if button down last tic. - PF_ATTACKDOWN = 1, - PF_ACCELDOWN = 1<<1, - PF_BRAKEDOWN = 1<<2, - PF_LOOKDOWN = 1<<3, + PF_ATTACKDOWN = 1, + PF_ACCELDOWN = 1<<1, + PF_BRAKEDOWN = 1<<2, + PF_LOOKDOWN = 1<<3, // Accessibility and cheats PF_KICKSTARTACCEL = 1<<4, // Is accelerate in kickstart mode? @@ -99,6 +99,9 @@ typedef enum PF_HITFINISHLINE = 1<<26, // Already hit the finish line this tic PF_WRONGWAY = 1<<27, // Moving the wrong way with respect to waypoints? + PF_SHRINKME = 1<<28, // "Shrink me" cheat preference + PF_SHRINKACTIVE = 1<<29, // "Shrink me" cheat is in effect. (Can't be disabled mid-race) + // up to 1<<31 is free } pflags_t; diff --git a/src/deh_tables.c b/src/deh_tables.c index d4626cf68..0c1ea90af 100644 --- a/src/deh_tables.c +++ b/src/deh_tables.c @@ -5912,6 +5912,10 @@ const char *const PLAYERFLAG_LIST[] = { "HITFINISHLINE", // Already hit the finish line this tic "WRONGWAY", // Moving the wrong way with respect to waypoints? + + "SHRINKME", + "SHRINKACTIVE", + NULL // stop loop here. }; diff --git a/src/g_demo.c b/src/g_demo.c index 2dd3cd277..f70350633 100644 --- a/src/g_demo.c +++ b/src/g_demo.c @@ -122,8 +122,9 @@ demoghost *ghosts = NULL; #define DF_ENCORE 0x40 #define DF_MULTIPLAYER 0x80 // This demo was recorded in multiplayer mode! -#define DEMO_SPECTATOR 0x40 -#define DEMO_KICKSTART 0x20 +#define DEMO_SPECTATOR 0x01 +#define DEMO_KICKSTART 0x02 +#define DEMO_SHRINKME 0x04 // For demos #define ZT_FWD 0x01 @@ -351,9 +352,20 @@ void G_ReadDemoExtraData(void) if (extradata & DXD_WEAPONPREF) { i = READUINT8(demo_p); - players[p].pflags &= ~(PF_KICKSTARTACCEL); + players[p].pflags &= ~(PF_KICKSTARTACCEL|PF_SHRINKME); if (i & 1) players[p].pflags |= PF_KICKSTARTACCEL; + if (i & 2) + players[p].pflags |= PF_SHRINKME; + + if (leveltime < 2) + { + // BAD HACK: No other place I tried to slot this in + // made it work for the host when they initally host, + // so this will have to do. + K_UpdateShrinkCheat(&players[p]); + } + //CONS_Printf("weaponpref is %d for player %d\n", i, p); } @@ -466,6 +478,8 @@ void G_WriteDemoExtraData(void) UINT8 prefs = 0; if (players[i].pflags & PF_KICKSTARTACCEL) prefs |= 1; + if (players[i].pflags & PF_SHRINKME) + prefs |= 2; WRITEUINT8(demo_p, prefs); } } @@ -2015,12 +2029,15 @@ void G_BeginRecording(void) for (p = 0; p < MAXPLAYERS; p++) { if (playeringame[p]) { player = &players[p]; + WRITEUINT8(demo_p, p); - i = p; - if (player->pflags & PF_KICKSTARTACCEL) - i |= DEMO_KICKSTART; + i = 0; if (player->spectator) i |= DEMO_SPECTATOR; + if (player->pflags & PF_KICKSTARTACCEL) + i |= DEMO_KICKSTART; + if (player->pflags & PF_SHRINKME) + i |= DEMO_SHRINKME; WRITEUINT8(demo_p, i); // Name @@ -2672,7 +2689,7 @@ void G_DoPlayDemo(char *defdemoname) UINT32 randseed; char msg[1024]; - boolean spectator, kickstart; + boolean spectator, kickstart, shrinkme; UINT8 slots[MAXPLAYERS], kartspeed[MAXPLAYERS], kartweight[MAXPLAYERS], numslots = 0; #if defined(SKIPERRORS) && !defined(DEVELOP) @@ -2943,9 +2960,13 @@ void G_DoPlayDemo(char *defdemoname) while (p != 0xFF) { - if ((spectator = !!(p & DEMO_SPECTATOR))) + UINT8 flags = READUINT8(demo_p); + + spectator = kickstart = shrinkme = false; + + if ((spectator = !!(flags & DEMO_SPECTATOR)) == true) { - p &= ~DEMO_SPECTATOR; + flags &= ~DEMO_SPECTATOR; if (modeattacking) { @@ -2960,10 +2981,14 @@ void G_DoPlayDemo(char *defdemoname) } } - if ((kickstart = (p & DEMO_KICKSTART))) - p &= ~DEMO_KICKSTART; + if ((kickstart = !!(flags & DEMO_KICKSTART)) == true) + flags &= ~DEMO_KICKSTART; - slots[numslots] = p; numslots++; + if ((shrinkme = !!(flags & DEMO_SHRINKME)) == true) + flags &= ~DEMO_SHRINKME; + + slots[numslots] = p; + numslots++; if (modeattacking && numslots > 1) { @@ -2982,11 +3007,19 @@ void G_DoPlayDemo(char *defdemoname) playeringame[p] = true; players[p].spectator = spectator; + if (kickstart) players[p].pflags |= PF_KICKSTARTACCEL; else players[p].pflags &= ~PF_KICKSTARTACCEL; + if (shrinkme) + players[p].pflags |= PF_SHRINKME; + else + players[p].pflags &= ~PF_SHRINKME; + + K_UpdateShrinkCheat(&players[p]); + // Name M_Memcpy(player_names[p],demo_p,16); demo_p += 16; @@ -3245,7 +3278,7 @@ void G_AddGhost(char *defdemoname) return; } - if ((READUINT8(p) & ~DEMO_KICKSTART) != 0) + if ((READUINT8(p) & ~(DEMO_KICKSTART|DEMO_SHRINKME)) != 0) { CONS_Alert(CONS_NOTICE, M_GetText("Failed to add ghost %s: Invalid player slot.\n"), pdemoname); Z_Free(pdemoname); diff --git a/src/g_game.c b/src/g_game.c index 2d927d158..9b10e1b03 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -342,10 +342,10 @@ INT16 prevmap, nextmap; static UINT8 *savebuffer; -static void kickstartaccel_OnChange(void); -static void kickstartaccel2_OnChange(void); -static void kickstartaccel3_OnChange(void); -static void kickstartaccel4_OnChange(void); +static void weaponPrefChange(void); +static void weaponPrefChange2(void); +static void weaponPrefChange3(void); +static void weaponPrefChange4(void); static CV_PossibleValue_t joyaxis_cons_t[] = {{0, "None"}, {1, "X-Axis"}, {2, "Y-Axis"}, {-1, "X-Axis-"}, {-2, "Y-Axis-"}, @@ -406,10 +406,17 @@ consvar_t cv_resetspecialmusic = CVAR_INIT ("resetspecialmusic", "Yes", CV_SAVE, consvar_t cv_resume = CVAR_INIT ("resume", "Yes", CV_SAVE, CV_YesNo, NULL); consvar_t cv_kickstartaccel[MAXSPLITSCREENPLAYERS] = { - CVAR_INIT ("kickstartaccel", "Off", CV_SAVE|CV_CALL, CV_OnOff, kickstartaccel_OnChange), - CVAR_INIT ("kickstartaccel2", "Off", CV_SAVE|CV_CALL, CV_OnOff, kickstartaccel2_OnChange), - CVAR_INIT ("kickstartaccel3", "Off", CV_SAVE|CV_CALL, CV_OnOff, kickstartaccel3_OnChange), - CVAR_INIT ("kickstartaccel4", "Off", CV_SAVE|CV_CALL, CV_OnOff, kickstartaccel4_OnChange) + CVAR_INIT ("kickstartaccel", "Off", CV_SAVE|CV_CALL, CV_OnOff, weaponPrefChange), + CVAR_INIT ("kickstartaccel2", "Off", CV_SAVE|CV_CALL, CV_OnOff, weaponPrefChange2), + CVAR_INIT ("kickstartaccel3", "Off", CV_SAVE|CV_CALL, CV_OnOff, weaponPrefChange3), + CVAR_INIT ("kickstartaccel4", "Off", CV_SAVE|CV_CALL, CV_OnOff, weaponPrefChange4) +}; + +consvar_t cv_shrinkme[MAXSPLITSCREENPLAYERS] = { + CVAR_INIT ("shrinkme", "Off", CV_CALL, CV_OnOff, weaponPrefChange), + CVAR_INIT ("shrinkme2", "Off", CV_CALL, CV_OnOff, weaponPrefChange2), + CVAR_INIT ("shrinkme3", "Off", CV_CALL, CV_OnOff, weaponPrefChange3), + CVAR_INIT ("shrinkme4", "Off", CV_CALL, CV_OnOff, weaponPrefChange4) }; consvar_t cv_turnaxis[MAXSPLITSCREENPLAYERS] = { @@ -1183,22 +1190,22 @@ ticcmd_t *G_MoveTiccmd(ticcmd_t* dest, const ticcmd_t* src, const size_t n) return dest; } -static void kickstartaccel_OnChange(void) +static void weaponPrefChange(void) { SendWeaponPref(0); } -static void kickstartaccel2_OnChange(void) +static void weaponPrefChange2(void) { SendWeaponPref(1); } -static void kickstartaccel3_OnChange(void) +static void weaponPrefChange3(void) { SendWeaponPref(2); } -static void kickstartaccel4_OnChange(void) +static void weaponPrefChange4(void) { SendWeaponPref(3); } @@ -2164,7 +2171,7 @@ void G_PlayerReborn(INT32 player, boolean betweenmaps) botdiffincrease = players[player].botvars.diffincrease; botrival = players[player].botvars.rival; - pflags = (players[player].pflags & (PF_WANTSTOJOIN|PF_KICKSTARTACCEL)); + pflags = (players[player].pflags & (PF_WANTSTOJOIN|PF_KICKSTARTACCEL|PF_SHRINKME|PF_SHRINKACTIVE)); // SRB2kart if (betweenmaps || leveltime < introtime) @@ -2235,7 +2242,6 @@ void G_PlayerReborn(INT32 player, boolean betweenmaps) if (!(netgame || multiplayer)) pflags |= (players[player].pflags & (PF_GODMODE|PF_NOCLIP)); - // Obliterate follower from existence P_SetTarget(&players[player].follower, NULL); diff --git a/src/g_game.h b/src/g_game.h index 9e4ef0159..7cf34917f 100644 --- a/src/g_game.h +++ b/src/g_game.h @@ -55,6 +55,8 @@ extern consvar_t cv_pauseifunfocused; extern consvar_t cv_invertmouse; extern consvar_t cv_kickstartaccel[MAXSPLITSCREENPLAYERS]; +extern consvar_t cv_shrinkme[MAXSPLITSCREENPLAYERS]; + extern consvar_t cv_turnaxis[MAXSPLITSCREENPLAYERS]; extern consvar_t cv_moveaxis[MAXSPLITSCREENPLAYERS]; extern consvar_t cv_brakeaxis[MAXSPLITSCREENPLAYERS]; diff --git a/src/k_kart.c b/src/k_kart.c index 9a0442549..11c0d3c27 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -250,7 +250,6 @@ void K_RegisterKartStuff(void) CV_RegisterVar(&cv_kartdebugitem); CV_RegisterVar(&cv_kartdebugamount); - CV_RegisterVar(&cv_kartdebugshrink); CV_RegisterVar(&cv_kartallowgiveitem); CV_RegisterVar(&cv_kartdebugdistribution); CV_RegisterVar(&cv_kartdebughuddrop); @@ -3018,6 +3017,34 @@ UINT16 K_GetKartFlashing(player_t *player) return tics; } +boolean K_PlayerShrinkCheat(player_t *player) +{ + return ( + (player->pflags & PF_SHRINKACTIVE) + && (player->bot == false) + && (modeattacking == false) // Anyone want to make another record attack category? + ); +} + +void K_UpdateShrinkCheat(player_t *player) +{ + const boolean mobjValid = (player->mo != NULL && P_MobjWasRemoved(player->mo) == false); + + if (player->pflags & PF_SHRINKME) + { + player->pflags |= PF_SHRINKACTIVE; + } + else + { + player->pflags &= ~PF_SHRINKACTIVE; + } + + if (mobjValid == true && K_PlayerShrinkCheat(player) == true) + { + player->mo->destscale = FixedMul(mapobjectscale, SHRINK_SCALE); + } +} + boolean K_KartKickstart(player_t *player) { return ((player->pflags & PF_KICKSTARTACCEL) @@ -3289,7 +3316,7 @@ static void K_RemoveGrowShrink(player_t *player) player->mo->scalespeed = mapobjectscale/TICRATE; player->mo->destscale = mapobjectscale; - if (cv_kartdebugshrink.value && !modeattacking && !player->bot) + if (K_PlayerShrinkCheat(player) == true) { player->mo->destscale = FixedMul(player->mo->destscale, SHRINK_SCALE); } @@ -5276,7 +5303,7 @@ static void K_DoShrink(player_t *user) players[i].mo->scalespeed = mapobjectscale/TICRATE; players[i].mo->destscale = FixedMul(mapobjectscale, SHRINK_SCALE); - if (cv_kartdebugshrink.value && !modeattacking && !players[i].bot) + if (K_PlayerShrinkCheat(&players[i]) == true) { players[i].mo->destscale = FixedMul(players[i].mo->destscale, SHRINK_SCALE); } @@ -9167,7 +9194,7 @@ void K_MoveKartPlayer(player_t *player, boolean onground) player->mo->scalespeed = mapobjectscale/TICRATE; player->mo->destscale = FixedMul(mapobjectscale, GROW_SCALE); - if (cv_kartdebugshrink.value && !modeattacking && !player->bot) + if (K_PlayerShrinkCheat(player) == true) { player->mo->destscale = FixedMul(player->mo->destscale, SHRINK_SCALE); } diff --git a/src/k_kart.h b/src/k_kart.h index a8834397c..91024488f 100644 --- a/src/k_kart.h +++ b/src/k_kart.h @@ -126,6 +126,8 @@ fixed_t K_GetKartSpeedFromStat(UINT8 kartspeed); fixed_t K_GetKartSpeed(player_t *player, boolean doboostpower); fixed_t K_GetKartAccel(player_t *player); UINT16 K_GetKartFlashing(player_t *player); +boolean K_PlayerShrinkCheat(player_t *player); +void K_UpdateShrinkCheat(player_t *player); boolean K_KartKickstart(player_t *player); UINT16 K_GetKartButtons(player_t *player); SINT8 K_GetForwardMove(player_t *player); diff --git a/src/k_respawn.c b/src/k_respawn.c index 2146b2d48..1576af681 100644 --- a/src/k_respawn.c +++ b/src/k_respawn.c @@ -674,7 +674,7 @@ static void K_HandleDropDash(player_t *player) player->mo->scalespeed = mapobjectscale/TICRATE; player->mo->destscale = FixedMul(mapobjectscale, SHRINK_SCALE); - if (cv_kartdebugshrink.value && !modeattacking && !player->bot) + if (K_PlayerShrinkCheat(player) == true) { player->mo->destscale = FixedMul(player->mo->destscale, SHRINK_SCALE); } diff --git a/src/p_mobj.c b/src/p_mobj.c index 31f4e2d08..24e372443 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -10843,7 +10843,7 @@ void P_SpawnPlayer(INT32 playernum) P_SetTarget(&p->follower, NULL); // cleanse follower from existence - if (cv_kartdebugshrink.value && !modeattacking && !p->bot) + if (K_PlayerShrinkCheat(p) == true) { mobj->destscale = FixedMul(mobj->destscale, SHRINK_SCALE); } diff --git a/src/p_setup.c b/src/p_setup.c index 6c5903483..c86917da5 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -3462,6 +3462,7 @@ static void P_InitLevelSettings(void) players[i].lives = 3; G_PlayerReborn(i, true); + K_UpdateShrinkCheat(&players[i]); } racecountdown = exitcountdown = exitfadestarted = 0; From 606eb2831488c797dfdc7a5da5d4951da43905e8 Mon Sep 17 00:00:00 2001 From: SteelT Date: Thu, 20 Jan 2022 03:20:53 -0500 Subject: [PATCH 05/21] Linedef type 460: Don't award rings while SPB-locked --- src/p_spec.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/p_spec.c b/src/p_spec.c index 61862df96..9f75cf135 100644 --- a/src/p_spec.c +++ b/src/p_spec.c @@ -3620,6 +3620,10 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec) INT32 delay = (sides[line->sidenum[0]].rowoffset>>FRACBITS); if (mo && mo->player) { + // Don't award rings while SPB is targetting you + if (mo->player->pflags & PF_RINGLOCK) + return; + if (delay <= 0 || !(leveltime % delay)) P_GivePlayerRings(mo->player, rings); } From ff70bd0d83c4622404c0ea0a49c5ec8252ad5eab Mon Sep 17 00:00:00 2001 From: James R Date: Thu, 20 Jan 2022 03:42:27 -0800 Subject: [PATCH 06/21] Fix opengl semibright Adds back 3d models semibright. --- src/hardware/hw_main.c | 38 ++++++++++++++++++++++---------------- src/hardware/hw_main.h | 1 + src/hardware/hw_md2.c | 10 ++++++---- 3 files changed, 29 insertions(+), 20 deletions(-) diff --git a/src/hardware/hw_main.c b/src/hardware/hw_main.c index 47ad59cb6..113b9588e 100644 --- a/src/hardware/hw_main.c +++ b/src/hardware/hw_main.c @@ -181,6 +181,18 @@ boolean gl_shadersavailable = true; // Lighting // ========================================================================== +boolean HWR_OverrideObjectLightLevel(mobj_t *thing, INT32 *lightlevel) +{ + if (R_ThingIsFullBright(thing)) + *lightlevel = 255; + else if (R_ThingIsFullDark(thing)) + *lightlevel = 0; + else + return false; + + return true; +} + void HWR_Lighting(FSurfaceInfo *Surface, INT32 light_level, extracolormap_t *colormap) { RGBA_t poly_color, tint_color, fade_color; @@ -3795,7 +3807,7 @@ static void HWR_SplitSprite(gl_vissprite_t *spr) patch_t *gpatch; FSurfaceInfo Surf; extracolormap_t *colormap = NULL; - FUINT lightlevel; + INT32 lightlevel; boolean lightset = true; FBITFIELD blend = 0; FBITFIELD occlusion; @@ -3931,12 +3943,7 @@ static void HWR_SplitSprite(gl_vissprite_t *spr) i = 0; temp = FLOAT_TO_FIXED(realtop); - if (R_ThingIsFullBright(spr->mobj)) - lightlevel = 255; - else if (R_ThingIsFullDark(spr->mobj)) - lightlevel = 0; - else - lightset = false; + lightset = HWR_OverrideObjectLightLevel(spr->mobj, &lightlevel); for (i = 1; i < sector->numlights; i++) { @@ -3963,7 +3970,13 @@ static void HWR_SplitSprite(gl_vissprite_t *spr) if (!(list[i].flags & FF_NOSHADE) && (list[i].flags & FF_CUTSPRITES)) { if (!lightset) + { lightlevel = *list[i].lightlevel > 255 ? 255 : *list[i].lightlevel; + + if (R_ThingIsSemiBright(spr->mobj)) + lightlevel = 128 + (lightlevel>>1); + } + if (!(spr->mobj->renderflags & RF_NOCOLORMAPS)) colormap = *list[i].extra_colormap; } @@ -4279,17 +4292,10 @@ static void HWR_DrawSprite(gl_vissprite_t *spr) // colormap test { sector_t *sector = spr->mobj->subsector->sector; - UINT8 lightlevel = 0; - boolean lightset = true; + INT32 lightlevel = 0; + boolean lightset = HWR_OverrideObjectLightLevel(spr->mobj, &lightlevel); extracolormap_t *colormap = NULL; - if (R_ThingIsFullBright(spr->mobj)) - lightlevel = 255; - else if (R_ThingIsFullDark(spr->mobj)) - lightlevel = 0; - else - lightset = false; - if (!(spr->mobj->renderflags & RF_NOCOLORMAPS)) colormap = sector->extra_colormap; diff --git a/src/hardware/hw_main.h b/src/hardware/hw_main.h index 4ff46ba6a..33101edb2 100644 --- a/src/hardware/hw_main.h +++ b/src/hardware/hw_main.h @@ -67,6 +67,7 @@ void HWR_MakeScreenFinalTexture(void); void HWR_DrawScreenFinalTexture(int width, int height); // This stuff is put here so models can use them +boolean HWR_OverrideObjectLightLevel(mobj_t *thing, INT32 *lightlevel); void HWR_Lighting(FSurfaceInfo *Surface, INT32 light_level, extracolormap_t *colormap); UINT8 HWR_FogBlockAlpha(INT32 light, extracolormap_t *colormap); // Let's see if this can work diff --git a/src/hardware/hw_md2.c b/src/hardware/hw_md2.c index cf9d0b5c8..c2b593f06 100644 --- a/src/hardware/hw_md2.c +++ b/src/hardware/hw_md2.c @@ -1324,7 +1324,8 @@ boolean HWR_DrawModel(gl_vissprite_t *spr) if (spr->mobj->subsector) { sector_t *sector = spr->mobj->subsector->sector; - UINT8 lightlevel = 255; + INT32 lightlevel = 255; + boolean lightset = HWR_OverrideObjectLightLevel(spr->mobj, &lightlevel); extracolormap_t *colormap = NULL; if (sector->numlights) @@ -1333,7 +1334,7 @@ boolean HWR_DrawModel(gl_vissprite_t *spr) light = R_GetPlaneLight(sector, spr->mobj->z + spr->mobj->height, false); // Always use the light at the top instead of whatever I was doing before - if (!R_ThingIsFullBright(spr->mobj)) + if (!lightset) lightlevel = *sector->lightlist[light].lightlevel > 255 ? 255 : *sector->lightlist[light].lightlevel; if (*sector->lightlist[light].extra_colormap) @@ -1341,14 +1342,15 @@ boolean HWR_DrawModel(gl_vissprite_t *spr) } else { - if (!R_ThingIsFullBright(spr->mobj)) + if (!lightset) lightlevel = sector->lightlevel > 255 ? 255 : sector->lightlevel; if (sector->extra_colormap) colormap = sector->extra_colormap; } - //lightlevel = 128 + (lightlevel>>1); + if (R_ThingIsSemiBright(spr->mobj)) + lightlevel = 128 + (lightlevel>>1); HWR_Lighting(&Surf, lightlevel, colormap); } From ecc3d031df33bfa7624d5b4308ae2c58437f15b5 Mon Sep 17 00:00:00 2001 From: James R Date: Thu, 20 Jan 2022 03:45:40 -0800 Subject: [PATCH 07/21] Ignore colormap when overriding thing brightness --- src/hardware/hw_main.c | 36 ++++++++++++++++++++---------------- src/hardware/hw_md2.c | 14 +++++++++----- src/r_things.c | 2 +- 3 files changed, 30 insertions(+), 22 deletions(-) diff --git a/src/hardware/hw_main.c b/src/hardware/hw_main.c index 113b9588e..b6a411e07 100644 --- a/src/hardware/hw_main.c +++ b/src/hardware/hw_main.c @@ -3945,21 +3945,26 @@ static void HWR_SplitSprite(gl_vissprite_t *spr) lightset = HWR_OverrideObjectLightLevel(spr->mobj, &lightlevel); - for (i = 1; i < sector->numlights; i++) + if (!lightset) { - fixed_t h = P_GetLightZAt(§or->lightlist[i], spr->mobj->x, spr->mobj->y); - if (h <= temp) + for (i = 1; i < sector->numlights; i++) { - if (!lightset) + fixed_t h = P_GetLightZAt(§or->lightlist[i], spr->mobj->x, spr->mobj->y); + if (h <= temp) + { lightlevel = *list[i-1].lightlevel > 255 ? 255 : *list[i-1].lightlevel; - if (!(spr->mobj->renderflags & RF_NOCOLORMAPS)) - colormap = *list[i-1].extra_colormap; - break; + if (!(spr->mobj->renderflags & RF_NOCOLORMAPS)) + colormap = *list[i-1].extra_colormap; + break; + } } } if (R_ThingIsSemiBright(spr->mobj)) + { lightlevel = 128 + (lightlevel>>1); + colormap = NULL; + } for (i = 0; i < sector->numlights; i++) { @@ -3967,17 +3972,13 @@ static void HWR_SplitSprite(gl_vissprite_t *spr) return; // even if we aren't changing colormap or lightlevel, we still need to continue drawing down the sprite - if (!(list[i].flags & FF_NOSHADE) && (list[i].flags & FF_CUTSPRITES)) + if (!lightset && !(list[i].flags & FF_NOSHADE) && (list[i].flags & FF_CUTSPRITES)) { - if (!lightset) - { - lightlevel = *list[i].lightlevel > 255 ? 255 : *list[i].lightlevel; + lightlevel = *list[i].lightlevel > 255 ? 255 : *list[i].lightlevel; - if (R_ThingIsSemiBright(spr->mobj)) - lightlevel = 128 + (lightlevel>>1); - } - - if (!(spr->mobj->renderflags & RF_NOCOLORMAPS)) + if (R_ThingIsSemiBright(spr->mobj)) + lightlevel = 128 + (lightlevel>>1); + else if (!(spr->mobj->renderflags & RF_NOCOLORMAPS)) colormap = *list[i].extra_colormap; } @@ -4313,7 +4314,10 @@ static void HWR_DrawSprite(gl_vissprite_t *spr) lightlevel = sector->lightlevel > 255 ? 255 : sector->lightlevel; if (R_ThingIsSemiBright(spr->mobj)) + { lightlevel = 128 + (lightlevel>>1); + colormap = NULL; + } HWR_Lighting(&Surf, lightlevel, colormap); } diff --git a/src/hardware/hw_md2.c b/src/hardware/hw_md2.c index c2b593f06..7d54af5b9 100644 --- a/src/hardware/hw_md2.c +++ b/src/hardware/hw_md2.c @@ -1335,22 +1335,26 @@ boolean HWR_DrawModel(gl_vissprite_t *spr) light = R_GetPlaneLight(sector, spr->mobj->z + spr->mobj->height, false); // Always use the light at the top instead of whatever I was doing before if (!lightset) + { lightlevel = *sector->lightlist[light].lightlevel > 255 ? 255 : *sector->lightlist[light].lightlevel; - if (*sector->lightlist[light].extra_colormap) - colormap = *sector->lightlist[light].extra_colormap; + if (*sector->lightlist[light].extra_colormap) + colormap = *sector->lightlist[light].extra_colormap; + } } - else + else if (!lightset) { - if (!lightset) - lightlevel = sector->lightlevel > 255 ? 255 : sector->lightlevel; + lightlevel = sector->lightlevel > 255 ? 255 : sector->lightlevel; if (sector->extra_colormap) colormap = sector->extra_colormap; } if (R_ThingIsSemiBright(spr->mobj)) + { lightlevel = 128 + (lightlevel>>1); + colormap = NULL; + } HWR_Lighting(&Surf, lightlevel, colormap); } diff --git a/src/r_things.c b/src/r_things.c index 4779e4df8..6ca07c3b3 100644 --- a/src/r_things.c +++ b/src/r_things.c @@ -861,7 +861,7 @@ static void R_DrawVisSprite(vissprite_t *vis) else if (vis->mobj->sprite == SPR_PLAY) // Looks like a player, but doesn't have a color? Get rid of green sonic syndrome. R_SetColumnFunc(COLDRAWFUNC_TRANS, false); - if (vis->extra_colormap && !(vis->renderflags & RF_NOCOLORMAPS)) + if (!(vis->cut & (SC_FULLBRIGHT|SC_SEMIBRIGHT)) && vis->extra_colormap && !(vis->renderflags & RF_NOCOLORMAPS)) { if (!dc_colormap) dc_colormap = vis->extra_colormap->colormap; From 26d231c43acce0519c555865efdf73c524b0f8b8 Mon Sep 17 00:00:00 2001 From: James R Date: Thu, 20 Jan 2022 05:09:39 -0800 Subject: [PATCH 08/21] Only ignore colormap for fullbright --- src/hardware/hw_main.c | 38 +++++++++++++++++--------------------- src/hardware/hw_md2.c | 9 ++------- 2 files changed, 19 insertions(+), 28 deletions(-) diff --git a/src/hardware/hw_main.c b/src/hardware/hw_main.c index b6a411e07..80fcbbfed 100644 --- a/src/hardware/hw_main.c +++ b/src/hardware/hw_main.c @@ -3945,26 +3945,21 @@ static void HWR_SplitSprite(gl_vissprite_t *spr) lightset = HWR_OverrideObjectLightLevel(spr->mobj, &lightlevel); - if (!lightset) + for (i = 1; i < sector->numlights; i++) { - for (i = 1; i < sector->numlights; i++) + fixed_t h = P_GetLightZAt(§or->lightlist[i], spr->mobj->x, spr->mobj->y); + if (h <= temp) { - fixed_t h = P_GetLightZAt(§or->lightlist[i], spr->mobj->x, spr->mobj->y); - if (h <= temp) - { + if (!lightset) lightlevel = *list[i-1].lightlevel > 255 ? 255 : *list[i-1].lightlevel; - if (!(spr->mobj->renderflags & RF_NOCOLORMAPS)) - colormap = *list[i-1].extra_colormap; - break; - } + if (!R_ThingIsFullBright(spr->mobj) && !(spr->mobj->renderflags & RF_NOCOLORMAPS)) + colormap = *list[i-1].extra_colormap; + break; } } if (R_ThingIsSemiBright(spr->mobj)) - { lightlevel = 128 + (lightlevel>>1); - colormap = NULL; - } for (i = 0; i < sector->numlights; i++) { @@ -3972,13 +3967,17 @@ static void HWR_SplitSprite(gl_vissprite_t *spr) return; // even if we aren't changing colormap or lightlevel, we still need to continue drawing down the sprite - if (!lightset && !(list[i].flags & FF_NOSHADE) && (list[i].flags & FF_CUTSPRITES)) + if (!(list[i].flags & FF_NOSHADE) && (list[i].flags & FF_CUTSPRITES)) { - lightlevel = *list[i].lightlevel > 255 ? 255 : *list[i].lightlevel; + if (!lightset) + { + lightlevel = *list[i].lightlevel > 255 ? 255 : *list[i].lightlevel; - if (R_ThingIsSemiBright(spr->mobj)) - lightlevel = 128 + (lightlevel>>1); - else if (!(spr->mobj->renderflags & RF_NOCOLORMAPS)) + if (R_ThingIsSemiBright(spr->mobj)) + lightlevel = 128 + (lightlevel>>1); + } + + if (!R_ThingIsFullBright(spr->mobj) && !(spr->mobj->renderflags & RF_NOCOLORMAPS)) colormap = *list[i].extra_colormap; } @@ -4307,17 +4306,14 @@ static void HWR_DrawSprite(gl_vissprite_t *spr) if (!lightset) lightlevel = *sector->lightlist[light].lightlevel > 255 ? 255 : *sector->lightlist[light].lightlevel; - if (*sector->lightlist[light].extra_colormap && !(spr->mobj->renderflags & RF_NOCOLORMAPS)) + if (!R_ThingIsFullBright(spr->mobj) && *sector->lightlist[light].extra_colormap && !(spr->mobj->renderflags & RF_NOCOLORMAPS)) colormap = *sector->lightlist[light].extra_colormap; } else if (!lightset) lightlevel = sector->lightlevel > 255 ? 255 : sector->lightlevel; if (R_ThingIsSemiBright(spr->mobj)) - { lightlevel = 128 + (lightlevel>>1); - colormap = NULL; - } HWR_Lighting(&Surf, lightlevel, colormap); } diff --git a/src/hardware/hw_md2.c b/src/hardware/hw_md2.c index 7d54af5b9..38b151d91 100644 --- a/src/hardware/hw_md2.c +++ b/src/hardware/hw_md2.c @@ -1335,12 +1335,10 @@ boolean HWR_DrawModel(gl_vissprite_t *spr) light = R_GetPlaneLight(sector, spr->mobj->z + spr->mobj->height, false); // Always use the light at the top instead of whatever I was doing before if (!lightset) - { lightlevel = *sector->lightlist[light].lightlevel > 255 ? 255 : *sector->lightlist[light].lightlevel; - if (*sector->lightlist[light].extra_colormap) - colormap = *sector->lightlist[light].extra_colormap; - } + if (!R_ThingIsFullBright(spr->mobj) && *sector->lightlist[light].extra_colormap) + colormap = *sector->lightlist[light].extra_colormap; } else if (!lightset) { @@ -1351,10 +1349,7 @@ boolean HWR_DrawModel(gl_vissprite_t *spr) } if (R_ThingIsSemiBright(spr->mobj)) - { lightlevel = 128 + (lightlevel>>1); - colormap = NULL; - } HWR_Lighting(&Surf, lightlevel, colormap); } From df1e808b6ea0ceaa476c2e63d99e762969125a92 Mon Sep 17 00:00:00 2001 From: toaster Date: Thu, 20 Jan 2022 19:14:44 +0000 Subject: [PATCH 09/21] Semibright has colormapping again --- src/r_things.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/r_things.c b/src/r_things.c index 6ca07c3b3..95482bc38 100644 --- a/src/r_things.c +++ b/src/r_things.c @@ -861,7 +861,7 @@ static void R_DrawVisSprite(vissprite_t *vis) else if (vis->mobj->sprite == SPR_PLAY) // Looks like a player, but doesn't have a color? Get rid of green sonic syndrome. R_SetColumnFunc(COLDRAWFUNC_TRANS, false); - if (!(vis->cut & (SC_FULLBRIGHT|SC_SEMIBRIGHT)) && vis->extra_colormap && !(vis->renderflags & RF_NOCOLORMAPS)) + if (vis->extra_colormap && !(vis->cut & SC_FULLBRIGHT) && !(vis->renderflags & RF_NOCOLORMAPS)) { if (!dc_colormap) dc_colormap = vis->extra_colormap->colormap; From 93dfbf382c756ef3e61cd8ca42b1dcddd70f8be7 Mon Sep 17 00:00:00 2001 From: toaster Date: Thu, 20 Jan 2022 19:27:02 +0000 Subject: [PATCH 10/21] The "free" changes from framezero - the crash fixes that have no complexity and therefore no negative consequence to introduce --- src/k_kart.c | 17 ++++++++++++----- src/p_map.c | 3 +++ src/p_mobj.c | 2 ++ 3 files changed, 17 insertions(+), 5 deletions(-) diff --git a/src/k_kart.c b/src/k_kart.c index b9fff95ba..9b7fde1fe 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -3811,7 +3811,7 @@ static mobj_t *K_SpawnKartMissile(mobj_t *source, mobjtype_t type, angle_t an, I y = source->y + source->momy + FixedMul(finalspeed, FINESINE(an>>ANGLETOFINESHIFT)); z = source->z; // spawn on the ground please - th = P_SpawnMobj(x, y, z, type); + th = P_SpawnMobj(x, y, z, type); // this will never return null because collision isn't processed here K_FlipFromObject(th, source); @@ -3830,7 +3830,10 @@ static mobj_t *K_SpawnKartMissile(mobj_t *source, mobjtype_t type, angle_t an, I { // floorz and ceilingz aren't properly set to account for FOFs and Polyobjects on spawn // This should set it for FOFs - P_SetOrigin(th, th->x, th->y, th->z); + P_SetOrigin(th, th->x, th->y, th->z); // however, THIS can fuck up your day. just absolutely ruin you. + if (P_MobjWasRemoved(th)) + return NULL; + // spawn on the ground if the player is on the ground if (P_MobjFlip(source) < 0) { @@ -3898,7 +3901,7 @@ static mobj_t *K_SpawnKartMissile(mobj_t *source, mobjtype_t type, angle_t an, I P_SetTarget(&throwmo->target, source); } - return NULL; + return th; } UINT16 K_DriftSparkColor(player_t *player, INT32 charge) @@ -4705,10 +4708,11 @@ mobj_t *K_ThrowKartItem(player_t *player, boolean missile, mobjtype_t mapthing, { if (mapthing == MT_BALLHOG) // Messy { + mo = NULL; // can't return multiple projectiles if (dir == -1) { // Shoot backward - mo = K_SpawnKartMissile(player->mo, mapthing, (player->mo->angle + ANGLE_180) - 0x06000000, 0, PROJSPEED/8); + K_SpawnKartMissile(player->mo, mapthing, (player->mo->angle + ANGLE_180) - 0x06000000, 0, PROJSPEED/8); K_SpawnKartMissile(player->mo, mapthing, (player->mo->angle + ANGLE_180) - 0x03000000, 0, PROJSPEED/8); K_SpawnKartMissile(player->mo, mapthing, player->mo->angle + ANGLE_180, 0, PROJSPEED/8); K_SpawnKartMissile(player->mo, mapthing, (player->mo->angle + ANGLE_180) + 0x03000000, 0, PROJSPEED/8); @@ -4717,7 +4721,7 @@ mobj_t *K_ThrowKartItem(player_t *player, boolean missile, mobjtype_t mapthing, else { // Shoot forward - mo = K_SpawnKartMissile(player->mo, mapthing, player->mo->angle - 0x06000000, 0, PROJSPEED); + K_SpawnKartMissile(player->mo, mapthing, player->mo->angle - 0x06000000, 0, PROJSPEED); K_SpawnKartMissile(player->mo, mapthing, player->mo->angle - 0x03000000, 0, PROJSPEED); K_SpawnKartMissile(player->mo, mapthing, player->mo->angle, 0, PROJSPEED); K_SpawnKartMissile(player->mo, mapthing, player->mo->angle + 0x03000000, 0, PROJSPEED); @@ -5329,6 +5333,9 @@ void K_KillBananaChain(mobj_t *banana, mobj_t *inflictor, mobj_t *source) mobj_t *cachenext; killnext: + if (P_MobjWasRemoved(banana)) + return; + cachenext = banana->hnext; if (banana->health) diff --git a/src/p_map.c b/src/p_map.c index fb79b6677..a0f4e3cfe 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -3496,6 +3496,9 @@ void P_SlideMove(mobj_t *mo) vertex_t v1, v2; // fake vertexes line_t junk; // fake linedef + if (P_MobjWasRemoved(mo)) + return; + if (tmhitthing && mo->z + mo->height > tmhitthing->z && mo->z < tmhitthing->z + tmhitthing->height) { // Don't mess with your momentum if it's a pushable object. Pushables do their own crazy things already. diff --git a/src/p_mobj.c b/src/p_mobj.c index 33de100be..ab6b30655 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -1689,6 +1689,8 @@ void P_XYMovement(mobj_t *mo) if (mo->flags & MF_SLIDEME) { P_SlideMove(mo); + if (P_MobjWasRemoved(mo)) + return; xmove = ymove = 0; } else From 6063a6eab897e6f4d28665163e0410f54a7eb9e5 Mon Sep 17 00:00:00 2001 From: James R Date: Thu, 20 Jan 2022 21:51:47 -0800 Subject: [PATCH 11/21] Check both front and backside for tripwire --- src/p_setup.c | 35 ++++++++++++++++++++++++++++------- 1 file changed, 28 insertions(+), 7 deletions(-) diff --git a/src/p_setup.c b/src/p_setup.c index 8c5f5d59b..3f6a57566 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -1939,6 +1939,30 @@ static void P_LoadTextmap(void) } } +static boolean P_CheckLineSideTripWire(line_t *ld, int p) +{ + INT32 n; + + side_t *sda; + side_t *sdb; + + terrain_t *terrain; + + boolean tripwire; + + n = ld->sidenum[p]; + + if (n == 0xffff) + return false; + + sda = &sides[n]; + + terrain = K_GetTerrainForTextureNum(sda->midtexture); + tripwire = terrain && (terrain->flags & TRF_TRIPWIRE); + + return tripwire; +} + static void P_ProcessLinedefsAfterSidedefs(void) { size_t i = numlines; @@ -1946,16 +1970,13 @@ static void P_ProcessLinedefsAfterSidedefs(void) for (; i--; ld++) { - INT32 midtexture = sides[ld->sidenum[0]].midtexture; - terrain_t *terrain = K_GetTerrainForTextureNum(midtexture); - ld->frontsector = sides[ld->sidenum[0]].sector; //e6y: Can't be -1 here ld->backsector = ld->sidenum[1] != 0xffff ? sides[ld->sidenum[1]].sector : 0; - if (terrain != NULL && (terrain->flags & TRF_TRIPWIRE)) - { - ld->tripwire = true; - } + // Check for tripwire on either side + ld->tripwire = + P_CheckLineSideTripWire(ld, 0) || + P_CheckLineSideTripWire(ld, 1); switch (ld->special) { From b23c4abb83f15430dc915a4524e237ff770ed998 Mon Sep 17 00:00:00 2001 From: James R Date: Thu, 20 Jan 2022 21:52:10 -0800 Subject: [PATCH 12/21] Copy tripwire texture to opposite side and automatically mirror texture alignment --- src/p_setup.c | 43 ++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 42 insertions(+), 1 deletion(-) diff --git a/src/p_setup.c b/src/p_setup.c index 3f6a57566..9c1288acc 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -1939,6 +1939,24 @@ static void P_LoadTextmap(void) } } +static fixed_t +P_MirrorTextureOffset +( fixed_t offset, + fixed_t source_width, + fixed_t actual_width) +{ + /* + Adjusting the horizontal alignment is a bit ASS... + Textures on the opposite side of the line will begin + drawing from the opposite end. + + Start with the texture width and subtract the seg + length to account for cropping/wrapping. Subtract the + offset to mirror the alignment. + */ + return source_width - actual_width - offset; +} + static boolean P_CheckLineSideTripWire(line_t *ld, int p) { INT32 n; @@ -1960,6 +1978,28 @@ static boolean P_CheckLineSideTripWire(line_t *ld, int p) terrain = K_GetTerrainForTextureNum(sda->midtexture); tripwire = terrain && (terrain->flags & TRF_TRIPWIRE); + if (tripwire) + { + // copy midtexture to other side + n = ld->sidenum[!p]; + + if (n != 0xffff) + { + fixed_t linelength = FixedHypot(ld->dx, ld->dy); + texture_t *tex = textures[sda->midtexture]; + + sdb = &sides[n]; + + sdb->midtexture = sda->midtexture; + sdb->rowoffset = sda->rowoffset; + + // mirror texture alignment + sdb->textureoffset = P_MirrorTextureOffset( + sda->textureoffset, tex->width * FRACUNIT, + linelength); + } + } + return tripwire; } @@ -1973,7 +2013,8 @@ static void P_ProcessLinedefsAfterSidedefs(void) ld->frontsector = sides[ld->sidenum[0]].sector; //e6y: Can't be -1 here ld->backsector = ld->sidenum[1] != 0xffff ? sides[ld->sidenum[1]].sector : 0; - // Check for tripwire on either side + // Check for tripwire, if either side matches then + // copy that (mid)texture to the other side. ld->tripwire = P_CheckLineSideTripWire(ld, 0) || P_CheckLineSideTripWire(ld, 1); From f10aa9645bfcd506c8cb39f8f5185283c0c9bee9 Mon Sep 17 00:00:00 2001 From: James R Date: Thu, 20 Jan 2022 23:39:58 -0800 Subject: [PATCH 13/21] Few more instances of fullbright colormap nullification --- src/hardware/hw_main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/hardware/hw_main.c b/src/hardware/hw_main.c index 80fcbbfed..9aa525c79 100644 --- a/src/hardware/hw_main.c +++ b/src/hardware/hw_main.c @@ -3937,7 +3937,7 @@ static void HWR_SplitSprite(gl_vissprite_t *spr) // Start with the lightlevel and colormap from the top of the sprite lightlevel = *list[sector->numlights - 1].lightlevel; - if (!(spr->mobj->renderflags & RF_NOCOLORMAPS)) + if (!R_ThingIsFullBright(spr->mobj) && !(spr->mobj->renderflags & RF_NOCOLORMAPS)) colormap = *list[sector->numlights - 1].extra_colormap; i = 0; @@ -4296,7 +4296,7 @@ static void HWR_DrawSprite(gl_vissprite_t *spr) boolean lightset = HWR_OverrideObjectLightLevel(spr->mobj, &lightlevel); extracolormap_t *colormap = NULL; - if (!(spr->mobj->renderflags & RF_NOCOLORMAPS)) + if (!R_ThingIsFullBright(spr->mobj) && !(spr->mobj->renderflags & RF_NOCOLORMAPS)) colormap = sector->extra_colormap; if (splat && sector->numlights) From ba9ef23b311006b730fed9c8bc317db2c1896d51 Mon Sep 17 00:00:00 2001 From: SinnamonLat Date: Sat, 22 Jan 2022 10:01:24 +0100 Subject: [PATCH 14/21] Add MF_NOHITLAGFORME and DMG_WOMBO --- src/deh_tables.c | 2 ++ src/k_kart.c | 2 +- src/p_inter.c | 14 +++++++++++++- src/p_local.h | 3 ++- src/p_mobj.h | 4 +++- 5 files changed, 21 insertions(+), 4 deletions(-) diff --git a/src/deh_tables.c b/src/deh_tables.c index d4626cf68..d1529cd8b 100644 --- a/src/deh_tables.c +++ b/src/deh_tables.c @@ -5809,6 +5809,7 @@ const char *const MOBJFLAG_LIST[] = { "DONTENCOREMAP", "PICKUPFROMBELOW", "NOSQUISH", + "NOHITLAGFORME", NULL }; @@ -6555,6 +6556,7 @@ struct int_const_s const INT_CONST[] = { //// Masks {"DMG_STEAL",DMG_CANTHURTSELF}, {"DMG_CANTHURTSELF",DMG_CANTHURTSELF}, + {"DMG_WOMBO", DMG_WOMBO}, {"DMG_DEATHMASK",DMG_DEATHMASK}, {"DMG_TYPEMASK",DMG_TYPEMASK}, diff --git a/src/k_kart.c b/src/k_kart.c index 9b7fde1fe..75def5e97 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -3098,7 +3098,7 @@ angle_t K_MomentumAngle(mobj_t *mo) void K_AddHitLag(mobj_t *mo, INT32 tics, boolean fromDamage) { - if (mo == NULL || P_MobjWasRemoved(mo)) + if (mo == NULL || P_MobjWasRemoved(mo) || mo->flags & MF_NOHITLAGFORME) { return; } diff --git a/src/p_inter.c b/src/p_inter.c index 8fb55c0ad..55d33c360 100644 --- a/src/p_inter.c +++ b/src/p_inter.c @@ -1929,7 +1929,19 @@ boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 da if (combo == false) { - if (player->mo->hitlag == 0 && player->flashing > 0) + // Check if we should allow wombo combos (DMG_WOMBO) + boolean allowcombo; + + // For MISSILE OBJECTS, allow combo BY DEFAULT. If DMG_WOMBO is set, do *NOT* allow it. + if (inflictor && !P_MobjWasRemoved(inflictor) && (inflictor->flags & MF_MISSILE)) + allowcombo = !(damagetype & DMG_WOMBO); + + // OTHERWISE, only allow combos IF DMG_WOMBO *IS* set. + else + allowcombo = (damagetype & DMG_WOMBO); + + + if ((player->mo->hitlag == 0 || !allowcombo) && player->flashing > 0) { // Post-hit invincibility K_DoInstashield(player); diff --git a/src/p_local.h b/src/p_local.h index 2cb291b11..1dd631ecb 100644 --- a/src/p_local.h +++ b/src/p_local.h @@ -123,7 +123,7 @@ struct demofreecam_s { camera_t *cam; // this is useful when the game is paused, notably mobj_t *soundmobj; // mobj to play sound from, used in s_sound - + angle_t localangle; // keeps track of the cam angle for cmds angle_t localaiming; // ditto with aiming boolean turnheld; // holding turn button for gradual turn speed @@ -488,6 +488,7 @@ typedef struct BasicFF_s // Masks #define DMG_STEAL 0x20 // Flag - can steal bumpers, will only deal damage to players, and will not deal damage outside Battle Mode. #define DMG_CANTHURTSELF 0x40 // Flag - cannot hurt your self or your team +#define DMG_WOMBO 0x80 // Flag - setting this flag allows objects to damage you if you're already in spinout. The effect is reversed on objects with MF_MISSILE (setting it prevents them from comboing in spinout) #define DMG_DEATHMASK DMG_INSTAKILL // if bit 7 is set, this is a death type instead of a damage type #define DMG_TYPEMASK 0x0F // Get type without any flags diff --git a/src/p_mobj.h b/src/p_mobj.h index 53614c5dd..c7ab1f364 100644 --- a/src/p_mobj.h +++ b/src/p_mobj.h @@ -161,7 +161,9 @@ typedef enum MF_PICKUPFROMBELOW = 1<<29, // Disable momentum-based squash and stretch. MF_NOSQUISH = 1<<30, - // free: to and including 1<<31 + // Disable hitlag for this object + MF_NOHITLAGFORME = 1<<31, + // no more free slots, next up I suppose we can get rid of shit like MF_BOXICON? } mobjflag_t; typedef enum From 191103fec159e679b818b827c43d9ecc7f34ef19 Mon Sep 17 00:00:00 2001 From: SinnamonLat Date: Sat, 22 Jan 2022 11:41:49 +0100 Subject: [PATCH 15/21] Fix a dumb mistake, add DMG_WOMBO to orbinauts, jawz and banana hits --- src/k_collide.c | 4 ++-- src/p_inter.c | 13 ++++++------- src/p_local.h | 2 +- 3 files changed, 9 insertions(+), 10 deletions(-) diff --git a/src/k_collide.c b/src/k_collide.c index 9b0463bfc..92b6c6e47 100644 --- a/src/k_collide.c +++ b/src/k_collide.c @@ -48,7 +48,7 @@ boolean K_OrbinautJawzCollide(mobj_t *t1, mobj_t *t2) else { // Player Damage - P_DamageMobj(t2, t1, t1->target, 1, DMG_WIPEOUT); + P_DamageMobj(t2, t1, t1->target, 1, DMG_WIPEOUT|DMG_WOMBO); K_KartBouncing(t2, t1); S_StartSound(t2, sfx_s3k7b); } @@ -143,7 +143,7 @@ boolean K_BananaBallhogCollide(mobj_t *t1, mobj_t *t2) } else { - P_DamageMobj(t2, t1, t1->target, 1, DMG_NORMAL); + P_DamageMobj(t2, t1, t1->target, 1, DMG_NORMAL|DMG_WOMBO); } damageitem = true; diff --git a/src/p_inter.c b/src/p_inter.c index 55d33c360..0b46bb3ad 100644 --- a/src/p_inter.c +++ b/src/p_inter.c @@ -1930,18 +1930,17 @@ boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 da if (combo == false) { // Check if we should allow wombo combos (DMG_WOMBO) - boolean allowcombo; + boolean allowcombo = false; // For MISSILE OBJECTS, allow combo BY DEFAULT. If DMG_WOMBO is set, do *NOT* allow it. - if (inflictor && !P_MobjWasRemoved(inflictor) && (inflictor->flags & MF_MISSILE)) - allowcombo = !(damagetype & DMG_WOMBO); + if (inflictor && !P_MobjWasRemoved(inflictor) && (inflictor->flags & MF_MISSILE) && !(damagetype & DMG_WOMBO)) + allowcombo = true; // OTHERWISE, only allow combos IF DMG_WOMBO *IS* set. - else - allowcombo = (damagetype & DMG_WOMBO); + else if (damagetype & DMG_WOMBO) + allowcombo = true; - - if ((player->mo->hitlag == 0 || !allowcombo) && player->flashing > 0) + if ((player->mo->hitlag == 0 || allowcombo == false) && player->flashing > 0) { // Post-hit invincibility K_DoInstashield(player); diff --git a/src/p_local.h b/src/p_local.h index 1dd631ecb..a3d5ecd74 100644 --- a/src/p_local.h +++ b/src/p_local.h @@ -486,9 +486,9 @@ typedef struct BasicFF_s #define DMG_SPECTATOR 0x83 #define DMG_TIMEOVER 0x84 // Masks +#define DMG_WOMBO 0x10 // Flag - setting this flag allows objects to damage you if you're already in spinout. The effect is reversed on objects with MF_MISSILE (setting it prevents them from comboing in spinout) #define DMG_STEAL 0x20 // Flag - can steal bumpers, will only deal damage to players, and will not deal damage outside Battle Mode. #define DMG_CANTHURTSELF 0x40 // Flag - cannot hurt your self or your team -#define DMG_WOMBO 0x80 // Flag - setting this flag allows objects to damage you if you're already in spinout. The effect is reversed on objects with MF_MISSILE (setting it prevents them from comboing in spinout) #define DMG_DEATHMASK DMG_INSTAKILL // if bit 7 is set, this is a death type instead of a damage type #define DMG_TYPEMASK 0x0F // Get type without any flags From b30ffea49a5b8e62bcc3be652168af5b29ea903c Mon Sep 17 00:00:00 2001 From: James R Date: Sat, 22 Jan 2022 03:18:06 -0800 Subject: [PATCH 16/21] Hash name lookup for textures and lumps --- src/doomdef.h | 16 ++++++++++++++++ src/r_textures.c | 12 ++++++++++-- src/r_textures.h | 1 + src/w_wad.c | 19 ++++++++++++++++--- src/w_wad.h | 1 + 5 files changed, 44 insertions(+), 5 deletions(-) diff --git a/src/doomdef.h b/src/doomdef.h index ff6d2c1e5..ee17fb689 100644 --- a/src/doomdef.h +++ b/src/doomdef.h @@ -550,6 +550,22 @@ extern boolean capslock; // i_system.c, replace getchar() once the keyboard has been appropriated INT32 I_GetKey(void); +/* http://www.cse.yorku.ca/~oz/hash.html */ +static inline +UINT32 quickncasehash (const char *p, size_t n) +{ + size_t i = 0; + UINT32 x = 5381; + + while (i < n && p[i]) + { + x = (x * 33) ^ tolower(p[i]); + i++; + } + + return x; +} + #ifndef min // Double-Check with WATTCP-32's cdefs.h #define min(x, y) (((x) < (y)) ? (x) : (y)) #endif diff --git a/src/r_textures.c b/src/r_textures.c index 9254cb91b..3b6e561b5 100644 --- a/src/r_textures.c +++ b/src/r_textures.c @@ -60,6 +60,7 @@ INT32 *texturebrightmaps; // Painfully simple texture id cacheing to make maps load faster. :3 static struct { char name[9]; + UINT32 hash; INT32 id; } *tidcache = NULL; static INT32 tidcachelen = 0; @@ -803,6 +804,7 @@ Rloadflats (INT32 i, INT32 w) // Set texture properties. M_Memcpy(texture->name, W_CheckNameForNumPwad(wadnum, lumpnum), sizeof(texture->name)); + texture->hash = quickncasehash(texture->name, 8); #ifndef NO_PNG_LUMPS if (Picture_IsLumpPNG(header, lumplength)) @@ -901,6 +903,7 @@ Rloadtextures (INT32 i, INT32 w) // Set texture properties. M_Memcpy(texture->name, W_CheckNameForNumPwad(wadnum, lumpnum), sizeof(texture->name)); + texture->hash = quickncasehash(texture->name, 8); #ifndef NO_PNG_LUMPS if (Picture_IsLumpPNG((UINT8 *)&patchlump, lumplength)) @@ -1389,6 +1392,7 @@ static texture_t *R_ParseTexture(boolean actuallyLoadTexture) // Allocate memory for a zero-patch texture. Obviously, we'll be adding patches momentarily. resultTexture = (texture_t *)Z_Calloc(sizeof(texture_t),PU_STATIC,NULL); M_Memcpy(resultTexture->name, newTextureName, 8); + resultTexture->hash = quickncasehash(newTextureName, 8); resultTexture->width = newTextureWidth; resultTexture->height = newTextureHeight; resultTexture->type = TEXTURETYPE_COMPOSITE; @@ -1614,25 +1618,29 @@ void R_ClearTextureNumCache(boolean btell) INT32 R_CheckTextureNumForName(const char *name) { INT32 i; + UINT32 hash; // "NoTexture" marker. if (name[0] == '-') return 0; + hash = quickncasehash(name, 8); + for (i = 0; i < tidcachelen; i++) - if (!strncasecmp(tidcache[i].name, name, 8)) + if (tidcache[i].hash == hash && !strncasecmp(tidcache[i].name, name, 8)) return tidcache[i].id; // Need to parse the list backwards, so textures loaded more recently are used in lieu of ones loaded earlier //for (i = 0; i < numtextures; i++) <- old for (i = (numtextures - 1); i >= 0; i--) // <- new - if (!strncasecmp(textures[i]->name, name, 8)) + if (textures[i]->hash == hash && !strncasecmp(textures[i]->name, name, 8)) { tidcachelen++; Z_Realloc(tidcache, tidcachelen * sizeof(*tidcache), PU_STATIC, &tidcache); strncpy(tidcache[tidcachelen-1].name, name, 8); tidcache[tidcachelen-1].name[8] = '\0'; CONS_Debug(DBG_SETUP, "texture #%s: %s\n", sizeu1(tidcachelen), tidcache[tidcachelen-1].name); + tidcache[tidcachelen-1].hash = hash; tidcache[tidcachelen-1].id = i; return i; } diff --git a/src/r_textures.h b/src/r_textures.h index dada043a6..bd5f6388e 100644 --- a/src/r_textures.h +++ b/src/r_textures.h @@ -54,6 +54,7 @@ typedef struct { // Keep name for switch changing, etc. char name[8]; + UINT32 hash; UINT8 type; // TEXTURETYPE_ INT16 width, height; boolean holes; diff --git a/src/w_wad.c b/src/w_wad.c index c2c4ed231..af1cd0244 100644 --- a/src/w_wad.c +++ b/src/w_wad.c @@ -356,6 +356,7 @@ static lumpinfo_t* ResGetLumpsStandalone (FILE* handle, UINT16* numlumps, const lumpinfo->size = ftell(handle); fseek(handle, 0, SEEK_SET); strcpy(lumpinfo->name, lumpname); + lumpinfo->hash = quickncasehash(lumpname, 8); // Allocate the lump's long name. lumpinfo->longname = Z_Malloc(9 * sizeof(char), PU_STATIC, NULL); @@ -453,6 +454,7 @@ static lumpinfo_t* ResGetLumpsWad (FILE* handle, UINT16* nlmp, const char* filen lump_p->compression = CM_NOCOMPRESSION; memset(lump_p->name, 0x00, 9); strncpy(lump_p->name, fileinfo->name, 8); + lump_p->hash = quickncasehash(lump_p->name, 8); // Allocate the lump's long name. lump_p->longname = Z_Malloc(9 * sizeof(char), PU_STATIC, NULL); @@ -627,6 +629,7 @@ static lumpinfo_t* ResGetLumpsZip (FILE* handle, UINT16* nlmp) memset(lump_p->name, '\0', 9); // Making sure they're initialized to 0. Is it necessary? strncpy(lump_p->name, trimname, min(8, dotpos - trimname)); + lump_p->hash = quickncasehash(lump_p->name, 8); lump_p->longname = Z_Calloc(dotpos - trimname + 1, PU_STATIC, NULL); strlcpy(lump_p->longname, trimname, dotpos - trimname + 1); @@ -978,12 +981,14 @@ UINT16 W_CheckNumForNamePwad(const char *name, UINT16 wad, UINT16 startlump) { UINT16 i; static char uname[8 + 1]; + UINT32 hash; if (!TestValidLump(wad,0)) return INT16_MAX; strlcpy(uname, name, sizeof uname); strupr(uname); + hash = quickncasehash(uname, 8); // // scan forward @@ -994,7 +999,7 @@ UINT16 W_CheckNumForNamePwad(const char *name, UINT16 wad, UINT16 startlump) { lumpinfo_t *lump_p = wadfiles[wad]->lumpinfo + startlump; for (i = startlump; i < wadfiles[wad]->numlumps; i++, lump_p++) - if (!strncmp(lump_p->name, uname, sizeof(uname) - 1)) + if (lump_p->hash == hash && !strncmp(lump_p->name, uname, sizeof(uname) - 1)) return i; } @@ -1197,15 +1202,20 @@ lumpnum_t W_CheckNumForLongName(const char *name) // TODO: Make it search through cache first, maybe...? lumpnum_t W_CheckNumForMap(const char *name) { + UINT32 hash = quickncasehash(name, 8); UINT16 lumpNum, end; UINT32 i; + lumpinfo_t *p; for (i = numwadfiles - 1; i < numwadfiles; i--) { if (wadfiles[i]->type == RET_WAD) { for (lumpNum = 0; lumpNum < wadfiles[i]->numlumps; lumpNum++) - if (!strncmp(name, (wadfiles[i]->lumpinfo + lumpNum)->name, 8)) + { + p = wadfiles[i]->lumpinfo + lumpNum; + if (p->hash == hash && !strncmp(name, p->name, 8)) return (i<<16) + lumpNum; + } } else if (wadfiles[i]->type == RET_PK3) { @@ -1216,8 +1226,11 @@ lumpnum_t W_CheckNumForMap(const char *name) continue; // Now look for the specified map. for (; lumpNum < end; lumpNum++) - if (!strnicmp(name, (wadfiles[i]->lumpinfo + lumpNum)->name, 8)) + { + p = wadfiles[i]->lumpinfo + lumpNum; + if (p->hash == hash && !strnicmp(name, p->name, 8)) return (i<<16) + lumpNum; + } } } return LUMPERROR; diff --git a/src/w_wad.h b/src/w_wad.h index b6bf94be8..55e3e0072 100644 --- a/src/w_wad.h +++ b/src/w_wad.h @@ -67,6 +67,7 @@ typedef struct unsigned long position; // filelump_t filepos unsigned long disksize; // filelump_t size char name[9]; // filelump_t name[] e.g. "LongEntr" + UINT32 hash; char *longname; // e.g. "LongEntryName" char *fullname; // e.g. "Folder/Subfolder/LongEntryName.extension" size_t size; // real (uncompressed) size From 6567219fec34555ea55c8249448a32d9a72de807 Mon Sep 17 00:00:00 2001 From: SinnamonLat Date: Sun, 23 Jan 2022 11:50:53 +0100 Subject: [PATCH 17/21] Add MF_NOHITLAGFORME to spikes and wallspikes --- src/info.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/info.c b/src/info.c index 062d1fbb2..2cd257839 100644 --- a/src/info.c +++ b/src/info.c @@ -9295,7 +9295,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = 4, // mass 0, // damage sfx_None, // activesound - MF_NOBLOCKMAP|MF_SCENERY|MF_NOCLIPHEIGHT, // flags + MF_NOBLOCKMAP|MF_SCENERY|MF_NOCLIPHEIGHT|MF_NOHITLAGFORME, // flags S_NULL // raisestate }, @@ -9322,7 +9322,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = 4, // mass 0, // damage sfx_None, // activesound - MF_NOBLOCKMAP|MF_NOGRAVITY|MF_SCENERY|MF_NOCLIPHEIGHT|MF_PAPERCOLLISION, // flags + MF_NOBLOCKMAP|MF_NOGRAVITY|MF_SCENERY|MF_NOCLIPHEIGHT|MF_PAPERCOLLISION|MF_NOHITLAGFORME, // flags S_NULL // raisestate }, @@ -9349,7 +9349,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = 4, // mass 0, // damage sfx_None, // activesound - MF_NOBLOCKMAP|MF_NOGRAVITY|MF_NOCLIP|MF_NOCLIPTHING, // flags + MF_NOBLOCKMAP|MF_NOGRAVITY|MF_NOCLIP|MF_NOCLIPTHING|MF_NOHITLAGFORME, // flags S_NULL // raisestate }, From 2bc6a72c56abdb587c387a489a7973aeef939682 Mon Sep 17 00:00:00 2001 From: SinnamonLat Date: Sun, 23 Jan 2022 13:57:11 +0100 Subject: [PATCH 18/21] MF_NOHITLAGFORME shouldn't work on MT_PLAYER --- src/k_kart.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/k_kart.c b/src/k_kart.c index 75def5e97..e58810075 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -3098,7 +3098,7 @@ angle_t K_MomentumAngle(mobj_t *mo) void K_AddHitLag(mobj_t *mo, INT32 tics, boolean fromDamage) { - if (mo == NULL || P_MobjWasRemoved(mo) || mo->flags & MF_NOHITLAGFORME) + if (mo == NULL || P_MobjWasRemoved(mo) || (mo->flags & MF_NOHITLAGFORME && mo->type != MT_PLAYER)) { return; } From d55e23d767164ea2208646e30c1dfbe8c53e40ee Mon Sep 17 00:00:00 2001 From: SinnamonLat Date: Sun, 23 Jan 2022 17:52:31 +0100 Subject: [PATCH 19/21] Add DMG_WOMBO to all player contact damage --- src/k_collide.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/k_collide.c b/src/k_collide.c index 92b6c6e47..482b67fa3 100644 --- a/src/k_collide.c +++ b/src/k_collide.c @@ -492,12 +492,12 @@ boolean K_PvPTouchDamage(mobj_t *t1, mobj_t *t2) if (t1Condition == true && t2Condition == false) { - P_DamageMobj(t2, t1, t1, 1, DMG_TUMBLE); + P_DamageMobj(t2, t1, t1, 1, DMG_TUMBLE|DMG_WOMBO); return true; } else if (t1Condition == false && t2Condition == true) { - P_DamageMobj(t1, t2, t2, 1, DMG_TUMBLE); + P_DamageMobj(t1, t2, t2, 1, DMG_TUMBLE|DMG_WOMBO); return true; } @@ -507,12 +507,12 @@ boolean K_PvPTouchDamage(mobj_t *t1, mobj_t *t2) if (t1Condition == true && t2Condition == false) { - P_DamageMobj(t2, t1, t1, 1, DMG_TUMBLE); + P_DamageMobj(t2, t1, t1, 1, DMG_TUMBLE|DMG_WOMBO); return true; } else if (t1Condition == false && t2Condition == true) { - P_DamageMobj(t1, t2, t2, 1, DMG_TUMBLE); + P_DamageMobj(t1, t2, t2, 1, DMG_TUMBLE|DMG_WOMBO); return true; } @@ -522,12 +522,12 @@ boolean K_PvPTouchDamage(mobj_t *t1, mobj_t *t2) if (t1Condition == true && t2Condition == false) { - P_DamageMobj(t2, t1, t1, 1, DMG_WIPEOUT); + P_DamageMobj(t2, t1, t1, 1, DMG_WIPEOUT|DMG_WOMBO); return true; } else if (t1Condition == false && t2Condition == true) { - P_DamageMobj(t1, t2, t2, 1, DMG_WIPEOUT); + P_DamageMobj(t1, t2, t2, 1, DMG_WIPEOUT|DMG_WOMBO); return true; } @@ -540,12 +540,12 @@ boolean K_PvPTouchDamage(mobj_t *t1, mobj_t *t2) if (t1Condition == true && t2Condition == false) { - P_DamageMobj(t2, t1, t1, 1, DMG_WIPEOUT|DMG_STEAL); + P_DamageMobj(t2, t1, t1, 1, DMG_WIPEOUT|DMG_STEAL|DMG_WOMBO); return true; } else if (t1Condition == false && t2Condition == true) { - P_DamageMobj(t1, t2, t2, 1, DMG_WIPEOUT|DMG_STEAL); + P_DamageMobj(t1, t2, t2, 1, DMG_WIPEOUT|DMG_STEAL|DMG_WOMBO); return true; } } @@ -558,7 +558,7 @@ boolean K_PvPTouchDamage(mobj_t *t1, mobj_t *t2) { if (t2->player->rings <= 0) { - P_DamageMobj(t2, t1, t1, 1, DMG_STING); + P_DamageMobj(t2, t1, t1, 1, DMG_STING|DMG_WOMBO); stungT2 = true; } @@ -569,7 +569,7 @@ boolean K_PvPTouchDamage(mobj_t *t1, mobj_t *t2) { if (t1->player->rings <= 0) { - P_DamageMobj(t1, t2, t2, 1, DMG_STING); + P_DamageMobj(t1, t2, t2, 1, DMG_STING|DMG_WOMBO); stungT1 = true; } From 14961f6127711c4641a56df4083d767445878c3f Mon Sep 17 00:00:00 2001 From: SinnamonLat Date: Sun, 23 Jan 2022 17:58:08 +0100 Subject: [PATCH 20/21] Let ThunderShield combo players --- src/p_user.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/p_user.c b/src/p_user.c index f96eb80ee..1e1269751 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -2464,8 +2464,10 @@ void P_NukeEnemies(mobj_t *inflictor, mobj_t *source, fixed_t radius) indirectitemcooldown = 0; } - if (mo->flags & MF_BOSS || mo->type == MT_PLAYER) //don't OHKO bosses nor players! + if (mo->flags & MF_BOSS) //don't OHKO bosses nor players! P_DamageMobj(mo, inflictor, source, 1, DMG_NORMAL|DMG_CANTHURTSELF); + else if (mo->type == MT_PLAYER) // Thunder shield: Combo players. + P_DamageMobj(mo, inflictor, source, 1, DMG_NORMAL|DMG_CANTHURTSELF|DMG_WOMBO); else P_DamageMobj(mo, inflictor, source, 1000, DMG_NORMAL|DMG_CANTHURTSELF); } From fafcf307d21868097a66282b8139668164773820 Mon Sep 17 00:00:00 2001 From: SinnamonLat Date: Sun, 23 Jan 2022 18:02:56 +0100 Subject: [PATCH 21/21] Add combo to bubble shield --- src/p_map.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/p_map.c b/src/p_map.c index a0f4e3cfe..a3902b159 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -782,7 +782,7 @@ static boolean PIT_CheckThing(mobj_t *thing) return true; // Player Damage - P_DamageMobj(tmthing, ((thing->type == MT_BUBBLESHIELD) ? thing->target : thing), thing, 1, DMG_NORMAL); + P_DamageMobj(tmthing, ((thing->type == MT_BUBBLESHIELD) ? thing->target : thing), thing, 1, DMG_NORMAL|DMG_WOMBO); S_StartSound(thing, sfx_s3k44); } else