From e57b9f3f77b2505ca6a80c83e7d7bfe9f23e061a Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Tue, 2 Jan 2018 13:06:49 -0500 Subject: [PATCH 1/8] Minimum wall bump speed copied from K_KartBouncing --- src/p_map.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/p_map.c b/src/p_map.c index 2d503a4f..c6eddadb 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -3948,6 +3948,28 @@ bounceback: tmymove = FixedMul(mmomy, (FRACUNIT - (FRACUNIT>>2) - (FRACUNIT>>3))); } + if (mo->player) + { + mobj_t *fx = P_SpawnMobj(mo->x, mo->y, mo->z, MT_BUMP); + if (mo->eflags & MFE_VERTICALFLIP) + fx->eflags |= MFE_VERTICALFLIP; + else + fx->eflags &= ~MFE_VERTICALFLIP; + fx->scale = mo->scale; + + if (cv_collidesounds.value == 1) + S_StartSound(mo, cv_collidesoundnum.value); + + if (P_AproxDistance(tmxmove, tmymove) < 25*FRACUNIT) + { + fixed_t momdiflength = P_AproxDistance(tmxmove, tmymove); + fixed_t normalisedx = FixedDiv(tmxmove, momdiflength); + fixed_t normalisedy = FixedDiv(tmymove, momdiflength); + tmxmove = FixedMul(25*FRACUNIT, normalisedx); + tmymove = FixedMul(25*FRACUNIT, normalisedy); + } + } + P_HitBounceLine(bestslideline); // clip the moves mo->momx = tmxmove; From f303dec437707d7b413a9340072a393660ee7fca Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Wed, 3 Jan 2018 20:20:27 -0500 Subject: [PATCH 2/8] You know what? Let's just, try removing the weird hacky bounceback stuff :V Might be better? (I had trouble reproducing the weird bounces before, so I can't tell if it's completely fixed) --- src/p_map.c | 62 +++++++++++++++++++++++++++-------------------------- 1 file changed, 32 insertions(+), 30 deletions(-) diff --git a/src/p_map.c b/src/p_map.c index c6eddadb..b7bae5c7 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -3823,7 +3823,7 @@ void P_BounceMove(mobj_t *mo) { fixed_t leadx, leady; fixed_t trailx, traily; - fixed_t newx, newy; + //fixed_t newx, newy; INT32 hitcount; fixed_t mmomx = 0, mmomy = 0; @@ -3831,8 +3831,8 @@ void P_BounceMove(mobj_t *mo) hitcount = 0; retry: - if (++hitcount == 3) - goto bounceback; // don't loop forever + if (++hitcount == 3) // don't loop forever + return; //goto bounceback; if (mo->player) { @@ -3881,7 +3881,7 @@ retry: P_PathTraverse(leadx, traily, leadx + mmomx, traily + mmomy, PT_ADDLINES, PTR_SlideTraverse); // move up to the wall - if (bestslidefrac == FRACUNIT + 1) + /*if (bestslidefrac == FRACUNIT + 1) { // the move must have hit the middle, so bounce straight back bounceback: @@ -3903,18 +3903,18 @@ bounceback: } } return; - } + }*/ // fudge a bit to make sure it doesn't hit bestslidefrac -= 0x800; - if (bestslidefrac > 0) + /*if (bestslidefrac > 0) { newx = FixedMul(mmomx, bestslidefrac); newy = FixedMul(mmomy, bestslidefrac); if (!P_TryMove(mo, mo->x + newx, mo->y + newy, true)) goto bounceback; - } + }*/ // Now continue along the wall. // First calculate remainder. @@ -3926,7 +3926,31 @@ bounceback: if (bestslidefrac <= 0) return; - if (mo->type == MT_SHELL) + if (mo->player) + { + mobj_t *fx = P_SpawnMobj(mo->x, mo->y, mo->z, MT_BUMP); + if (mo->eflags & MFE_VERTICALFLIP) + fx->eflags |= MFE_VERTICALFLIP; + else + fx->eflags &= ~MFE_VERTICALFLIP; + fx->scale = mo->scale; + + if (cv_collidesounds.value == 1) + S_StartSound(mo, cv_collidesoundnum.value); + + tmxmove = FixedMul(mmomx, (FRACUNIT - (FRACUNIT>>2) - (FRACUNIT>>3))); + tmymove = FixedMul(mmomy, (FRACUNIT - (FRACUNIT>>2) - (FRACUNIT>>3))); + + if (P_AproxDistance(tmxmove, tmymove) < 25*FRACUNIT) + { + fixed_t momdiflength = P_AproxDistance(tmxmove, tmymove); + fixed_t normalisedx = FixedDiv(tmxmove, momdiflength); + fixed_t normalisedy = FixedDiv(tmymove, momdiflength); + tmxmove = FixedMul(25*FRACUNIT, normalisedx); + tmymove = FixedMul(25*FRACUNIT, normalisedy); + } + } + else if (mo->type == MT_SHELL) { tmxmove = mmomx; tmymove = mmomy; @@ -3948,28 +3972,6 @@ bounceback: tmymove = FixedMul(mmomy, (FRACUNIT - (FRACUNIT>>2) - (FRACUNIT>>3))); } - if (mo->player) - { - mobj_t *fx = P_SpawnMobj(mo->x, mo->y, mo->z, MT_BUMP); - if (mo->eflags & MFE_VERTICALFLIP) - fx->eflags |= MFE_VERTICALFLIP; - else - fx->eflags &= ~MFE_VERTICALFLIP; - fx->scale = mo->scale; - - if (cv_collidesounds.value == 1) - S_StartSound(mo, cv_collidesoundnum.value); - - if (P_AproxDistance(tmxmove, tmymove) < 25*FRACUNIT) - { - fixed_t momdiflength = P_AproxDistance(tmxmove, tmymove); - fixed_t normalisedx = FixedDiv(tmxmove, momdiflength); - fixed_t normalisedy = FixedDiv(tmymove, momdiflength); - tmxmove = FixedMul(25*FRACUNIT, normalisedx); - tmymove = FixedMul(25*FRACUNIT, normalisedy); - } - } - P_HitBounceLine(bestslideline); // clip the moves mo->momx = tmxmove; From 28384f465d8a9962e0e852b7b60e02b4631ab902 Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Thu, 4 Jan 2018 01:49:34 -0500 Subject: [PATCH 3/8] Rewrote P_HitBounceLine Instead of reflecting momentum (iirc), it thrusts you away prependicular from the wall. --- src/p_map.c | 52 ++++++++++++++++++---------------------------------- 1 file changed, 18 insertions(+), 34 deletions(-) diff --git a/src/p_map.c b/src/p_map.c index b7bae5c7..58479df7 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -3163,38 +3163,21 @@ static void P_HitSlideLine(line_t *ld) // static void P_HitBounceLine(line_t *ld) { - angle_t lineangle, moveangle, deltaangle; + INT32 side; + angle_t lineangle; fixed_t movelen; - if (ld->slopetype == ST_HORIZONTAL) - { - tmymove = -tmymove; - return; - } - - if (ld->slopetype == ST_VERTICAL) - { - tmxmove = -tmxmove; - return; - } - - lineangle = R_PointToAngle2(0, 0, ld->dx, ld->dy); - - if (lineangle >= ANGLE_180) - lineangle -= ANGLE_180; - - moveangle = R_PointToAngle2(0, 0, tmxmove, tmymove); - deltaangle = moveangle + 2*(lineangle - moveangle); + side = P_PointOnLineSide(slidemo->x, slidemo->y, ld); + lineangle = R_PointToAngle2(0, 0, ld->dx, ld->dy)-ANGLE_90; + if (side == 1) + lineangle += ANGLE_180; lineangle >>= ANGLETOFINESHIFT; - deltaangle >>= ANGLETOFINESHIFT; movelen = P_AproxDistance(tmxmove, tmymove); - tmxmove = FixedMul(movelen, FINECOSINE(deltaangle)); - tmymove = FixedMul(movelen, FINESINE(deltaangle)); - - deltaangle = R_PointToAngle2(0, 0, tmxmove, tmymove); + tmxmove += FixedMul(movelen, FINECOSINE(lineangle)); + tmymove += FixedMul(movelen, FINESINE(lineangle)); } // @@ -3824,15 +3807,15 @@ void P_BounceMove(mobj_t *mo) fixed_t leadx, leady; fixed_t trailx, traily; //fixed_t newx, newy; - INT32 hitcount; + //INT32 hitcount; fixed_t mmomx = 0, mmomy = 0; slidemo = mo; - hitcount = 0; + //hitcount = 0; -retry: - if (++hitcount == 3) // don't loop forever - return; //goto bounceback; +/*retry: + if (++hitcount == 3) + goto bounceback; // don't loop forever*/ if (mo->player) { @@ -3906,8 +3889,8 @@ bounceback: }*/ // fudge a bit to make sure it doesn't hit - bestslidefrac -= 0x800; - /*if (bestslidefrac > 0) + /*bestslidefrac -= 0x800; + if (bestslidefrac > 0) { newx = FixedMul(mmomx, bestslidefrac); newy = FixedMul(mmomy, bestslidefrac); @@ -3983,8 +3966,9 @@ bounceback: mo->player->cmomy = tmymove; } - if (!P_TryMove(mo, mo->x + tmxmove, mo->y + tmymove, true)) - goto retry; + /*if (!P_TryMove(mo, mo->x + tmxmove, mo->y + tmymove, true)) + goto retry;*/ + P_TryMove(mo, mo->x + tmxmove, mo->y + tmymove, true); } // From a1b84e8641c45177e61fafbd242f70974f9fff73 Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Thu, 4 Jan 2018 16:39:29 -0500 Subject: [PATCH 4/8] Rearranging some things Player minimum bounce is set in P_HitBounceLine instead of P_BounceMove, which is simpler and appears to give even more consistent results --- src/p_map.c | 42 +++++++++++++++++------------------------- 1 file changed, 17 insertions(+), 25 deletions(-) diff --git a/src/p_map.c b/src/p_map.c index 58479df7..d3dd9995 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -3169,6 +3169,7 @@ static void P_HitBounceLine(line_t *ld) side = P_PointOnLineSide(slidemo->x, slidemo->y, ld); lineangle = R_PointToAngle2(0, 0, ld->dx, ld->dy)-ANGLE_90; + if (side == 1) lineangle += ANGLE_180; @@ -3176,6 +3177,9 @@ static void P_HitBounceLine(line_t *ld) movelen = P_AproxDistance(tmxmove, tmymove); + if (slidemo->player && movelen < 25*FRACUNIT) + movelen = 25*FRACUNIT; + tmxmove += FixedMul(movelen, FINECOSINE(lineangle)); tmymove += FixedMul(movelen, FINESINE(lineangle)); } @@ -3909,31 +3913,7 @@ bounceback: if (bestslidefrac <= 0) return; - if (mo->player) - { - mobj_t *fx = P_SpawnMobj(mo->x, mo->y, mo->z, MT_BUMP); - if (mo->eflags & MFE_VERTICALFLIP) - fx->eflags |= MFE_VERTICALFLIP; - else - fx->eflags &= ~MFE_VERTICALFLIP; - fx->scale = mo->scale; - - if (cv_collidesounds.value == 1) - S_StartSound(mo, cv_collidesoundnum.value); - - tmxmove = FixedMul(mmomx, (FRACUNIT - (FRACUNIT>>2) - (FRACUNIT>>3))); - tmymove = FixedMul(mmomy, (FRACUNIT - (FRACUNIT>>2) - (FRACUNIT>>3))); - - if (P_AproxDistance(tmxmove, tmymove) < 25*FRACUNIT) - { - fixed_t momdiflength = P_AproxDistance(tmxmove, tmymove); - fixed_t normalisedx = FixedDiv(tmxmove, momdiflength); - fixed_t normalisedy = FixedDiv(tmymove, momdiflength); - tmxmove = FixedMul(25*FRACUNIT, normalisedx); - tmymove = FixedMul(25*FRACUNIT, normalisedy); - } - } - else if (mo->type == MT_SHELL) + if (mo->type == MT_SHELL) { tmxmove = mmomx; tmymove = mmomy; @@ -3953,6 +3933,18 @@ bounceback: { tmxmove = FixedMul(mmomx, (FRACUNIT - (FRACUNIT>>2) - (FRACUNIT>>3))); tmymove = FixedMul(mmomy, (FRACUNIT - (FRACUNIT>>2) - (FRACUNIT>>3))); + if (mo->player) + { + mobj_t *fx = P_SpawnMobj(mo->x, mo->y, mo->z, MT_BUMP); + if (mo->eflags & MFE_VERTICALFLIP) + fx->eflags |= MFE_VERTICALFLIP; + else + fx->eflags &= ~MFE_VERTICALFLIP; + fx->scale = mo->scale; + + if (cv_collidesounds.value == 1) + S_StartSound(mo, cv_collidesoundnum.value); + } } P_HitBounceLine(bestslideline); // clip the moves From 990833998948955333a017b1b13b3182bd519cfc Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Mon, 8 Jan 2018 15:48:19 -0500 Subject: [PATCH 5/8] A bunch of little things - Minimum wall bounce speed decreased from 25*FRACUNIT to 15*FRACUNIT - Solid objects now bump players instead of stop them - Bounce pad strength scales with object scale - Fixed Boo stealing being inconsistent and sometimes not stealing anything --- src/d_player.h | 1 + src/k_kart.c | 80 +++++++++++++++++++++++++++++++---------------- src/k_kart.h | 2 +- src/lua_baselib.c | 3 +- src/p_map.c | 27 ++++++++++++---- 5 files changed, 78 insertions(+), 35 deletions(-) diff --git a/src/d_player.h b/src/d_player.h index f4128e13..ccb428e1 100644 --- a/src/d_player.h +++ b/src/d_player.h @@ -282,6 +282,7 @@ typedef enum k_comebacktimer, // Battle mode, how long before you become a bomb after death // Each item needs its own power slot, for the HUD and held use + // *** ADDING A NEW ITEM? ADD IT TO K_DoBooSteal PLEASE!! -Salt *** k_magnet, // 0x1 = Magnet in inventory k_boo, // 0x1 = Boo in inventory k_mushroom, // 0x1 = 1 Mushroom in inventory, 0x2 = 2 Mushrooms in inventory diff --git a/src/k_kart.c b/src/k_kart.c index 7bd27ae9..5ba24f7d 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -1131,7 +1131,7 @@ static void K_KartItemRouletteByDistance(player_t *player, ticcmd_t *cmd) //{ SRB2kart p_user.c Stuff -void K_KartBouncing(mobj_t *mobj1, mobj_t *mobj2, boolean bounce) +void K_KartBouncing(mobj_t *mobj1, mobj_t *mobj2, boolean bounce, boolean solid) { mobj_t *fx; fixed_t momdifx, momdify; @@ -1176,14 +1176,19 @@ void K_KartBouncing(mobj_t *mobj1, mobj_t *mobj2, boolean bounce) { fixed_t newz = mobj1->momz; mobj1->momz = mobj2->momz; - mobj2->momz = newz; + if (solid == false) + mobj2->momz = newz; } mass1 = mass2 = 5*FRACUNIT; + if (mobj1->player) mass1 = (mobj1->player->kartweight)*FRACUNIT; + if (mobj2->player) mass2 = (mobj2->player->kartweight)*FRACUNIT; + else if (solid == true) + mass2 = mass1; momdifx = mobj1->momx - mobj2->momx; momdify = mobj1->momy - mobj2->momy; @@ -1220,8 +1225,11 @@ void K_KartBouncing(mobj_t *mobj1, mobj_t *mobj2, boolean bounce) mobj1->momx = mobj1->momx - FixedMul(FixedMul(FixedDiv(2*mass2, mass1 + mass2), p), distx); mobj1->momy = mobj1->momy - FixedMul(FixedMul(FixedDiv(2*mass2, mass1 + mass2), p), disty); - mobj2->momx = mobj2->momx - FixedMul(FixedMul(FixedDiv(2*mass1, mass1 + mass2), p), -distx); - mobj2->momy = mobj2->momy - FixedMul(FixedMul(FixedDiv(2*mass1, mass1 + mass2), p), -disty); + if (solid == false) + { + mobj2->momx = mobj2->momx - FixedMul(FixedMul(FixedDiv(2*mass1, mass1 + mass2), p), -distx); + mobj2->momy = mobj2->momy - FixedMul(FixedMul(FixedDiv(2*mass1, mass1 + mass2), p), -disty); + } // Because this is done during collision now, rmomx and rmomy need to be recalculated // so that friction doesn't immediately decide to stop the player if they're at a standstill @@ -2448,36 +2456,46 @@ static void K_DoBooSteal(player_t *player) { INT32 i, numplayers = 0; INT32 playerswappable[MAXPLAYERS]; - INT32 stealplayer = 0; // The player that's getting stolen from + INT32 stealplayer = -1; // The player that's getting stolen from INT32 prandom = 0; - if (gametype == GT_MATCH && player->kartstuff[k_balloon] <= 0) - return; - for (i = 0; i < MAXPLAYERS; i++) { if (playeringame[i] && players[i].mo && players[i].mo->health > 0 && players[i].playerstate == PST_LIVE - && player != &players[i] && !players[i].exiting && !(players[i].spectator) + && player != &players[i] && !players[i].exiting && !players[i].spectator // Player in-game + + // Can steal from this player && ((gametype == GT_RACE && players[i].kartstuff[k_position] < player->kartstuff[k_position]) || (gametype != GT_RACE && players[i].kartstuff[k_balloon] > 0)) - && (players[i].kartstuff[k_star] || players[i].kartstuff[k_mushroom] || players[i].kartstuff[k_goldshroom] - || players[i].kartstuff[k_megashroom] || players[i].kartstuff[k_lightning] || players[i].kartstuff[k_blueshell] - || players[i].kartstuff[k_greenshell] & 2 || players[i].kartstuff[k_triplegreenshell] & 8 - || players[i].kartstuff[k_redshell] & 2 || players[i].kartstuff[k_tripleredshell] & 8 - || players[i].kartstuff[k_banana] & 2 || players[i].kartstuff[k_triplebanana] & 8 - || players[i].kartstuff[k_fakeitem] & 2 || players[i].kartstuff[k_bobomb] & 2 + // Has an item + && (players[i].kartstuff[k_magnet] + || players[i].kartstuff[k_mushroom] + || players[i].kartstuff[k_megashroom] + || players[i].kartstuff[k_goldshroom] + || players[i].kartstuff[k_star] + || players[i].kartstuff[k_banana] & 2 + || players[i].kartstuff[k_triplebanana] & 8 + || players[i].kartstuff[k_fakeitem] & 2 + || players[i].kartstuff[k_greenshell] & 2 + || players[i].kartstuff[k_triplegreenshell] & 8 + || players[i].kartstuff[k_redshell] & 2 + || players[i].kartstuff[k_tripleredshell] & 8 + || players[i].kartstuff[k_bobomb] & 2 + || players[i].kartstuff[k_lightning] + || players[i].kartstuff[k_blueshell] + || players[i].kartstuff[k_fireflower] || players[i].kartstuff[k_feather] & 1 || players[i].kartstuff[k_boo])) // Stealing boos with boos? sounds like fun { - playerswappable[numplayers] = i+1; + playerswappable[numplayers] = i; numplayers++; } } prandom = P_RandomFixed(); - if (player->kartstuff[k_position] == 1 || numplayers < 1 || !multiplayer) // No-one can be stolen from? Get longer invisibility for nothing + if ((gametype == GT_RACE && player->kartstuff[k_position] == 1) || numplayers == 0) // No-one can be stolen from? Get longer invisibility for nothing { player->kartstuff[k_bootimer] = bootime; player->kartstuff[k_bootaketimer] = boostealtime; @@ -2486,17 +2504,15 @@ static void K_DoBooSteal(player_t *player) } else if (numplayers == 1) // With just 2 players, we just need to set the other player to be the one to steal from { - stealplayer = playerswappable[numplayers - 1]; + stealplayer = playerswappable[numplayers-1]; } else if (numplayers > 1) // We need to choose between the available candidates for the 2nd player { stealplayer = playerswappable[prandom%(numplayers-1)]; } - if (stealplayer) // Now here's where we do the stealing, has to be done here because we still know the player we're stealing from + if (stealplayer > -1) // Now here's where we do the stealing, has to be done here because we still know the player we're stealing from { - stealplayer -= 1; // stealplayer is +1 so we know if it found there actually WAS a player - player->kartstuff[k_bootimer] = bootime; player->kartstuff[k_bootaketimer] = boostealtime; player->kartstuff[k_boo] = 0; @@ -2572,12 +2588,22 @@ static void K_DoBooSteal(player_t *player) player->kartstuff[k_bobomb] |= 2; players[stealplayer].kartstuff[k_bobomb] &= ~2; } + else if (players[stealplayer].kartstuff[k_magnet]) + { + player->kartstuff[k_magnet] = players[stealplayer].kartstuff[k_magnet]; + players[stealplayer].kartstuff[k_magnet] = 0; + } + else if (players[stealplayer].kartstuff[k_fireflower]) + { + player->kartstuff[k_fireflower] = players[stealplayer].kartstuff[k_fireflower]; + players[stealplayer].kartstuff[k_fireflower] = 0; + } else if (players[stealplayer].kartstuff[k_feather] & 1) { player->kartstuff[k_feather] |= 1; players[stealplayer].kartstuff[k_feather] &= ~1; } - if (players[stealplayer].kartstuff[k_boo]) + else if (players[stealplayer].kartstuff[k_boo]) { player->kartstuff[k_boo] = players[stealplayer].kartstuff[k_boo]; players[stealplayer].kartstuff[k_boo] = 0; @@ -2672,16 +2698,16 @@ void K_DoBouncePad(mobj_t *mo, fixed_t vertispeed) thrust = FixedMul(thrust, 5*FRACUNIT/4); else if (mo->player->kartstuff[k_startimer]) thrust = FixedMul(thrust, 9*FRACUNIT/8); - mo->momz = FixedMul(FINESINE(ANGLE_22h>>ANGLETOFINESHIFT), thrust); + mo->momz = FixedMul(FINESINE(ANGLE_22h>>ANGLETOFINESHIFT), FixedMul(thrust, mo->scale)); } else { thrust = P_AproxDistance(mo->momx,mo->momy); - if (thrust < 4< 8<momz = FixedMul(FINESINE(ANGLE_22h>>ANGLETOFINESHIFT), thrust); + if (thrust > 16<momz = FixedMul(FINESINE(ANGLE_22h>>ANGLETOFINESHIFT), FixedMul(thrust, mo->scale)); } } else diff --git a/src/k_kart.h b/src/k_kart.h index d174a0af..163d8424 100644 --- a/src/k_kart.h +++ b/src/k_kart.h @@ -18,7 +18,7 @@ UINT8 K_GetKartColorByName(const char *name); void K_RegisterKartStuff(void); UINT8 K_GetKartCC(void); -void K_KartBouncing(mobj_t *mobj1, mobj_t *mobj2, boolean bounce); +void K_KartBouncing(mobj_t *mobj1, mobj_t *mobj2, boolean bounce, boolean solid); void K_LakituChecker(player_t *player); void K_KartMoveAnimation(player_t *player); void K_KartPlayerThink(player_t *player, ticcmd_t *cmd); diff --git a/src/lua_baselib.c b/src/lua_baselib.c index 4f5af50d..1435f224 100644 --- a/src/lua_baselib.c +++ b/src/lua_baselib.c @@ -2005,12 +2005,13 @@ static int lib_kKartBouncing(lua_State *L) mobj_t *mobj1 = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ)); mobj_t *mobj2 = *((mobj_t **)luaL_checkudata(L, 2, META_MOBJ)); boolean bounce = luaL_checkboolean(L, 3); + boolean solid = luaL_checkboolean(L, 4); NOHUD if (!mobj1) return LUA_ErrInvalid(L, "mobj_t"); if (!mobj2) return LUA_ErrInvalid(L, "mobj_t"); - K_KartBouncing(mobj1, mobj2, bounce); + K_KartBouncing(mobj1, mobj2, bounce, solid); return 0; } diff --git a/src/p_map.c b/src/p_map.c index d3dd9995..2a5ee710 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -1232,7 +1232,7 @@ static boolean PIT_CheckThing(mobj_t *thing) return true; // overhead if (tmthing->z + tmthing->height < thing->z) return true; // underneath - K_KartBouncing(thing, tmthing, false); + K_KartBouncing(thing, tmthing, false, false); } if ((thing->type == MT_SPRINGSHELL || thing->type == MT_YELLOWSHELL) && thing->health > 0 @@ -1679,7 +1679,7 @@ static boolean PIT_CheckThing(mobj_t *thing) if (P_IsObjectOnGround(thing) && tmthing->momz < 0) { - K_KartBouncing(tmthing, thing, true); + K_KartBouncing(tmthing, thing, true, false); if (gametype != GT_RACE && tmthing->player->kartstuff[k_feather] & 2) { K_StealBalloon(tmthing->player, thing->player, false); @@ -1688,7 +1688,7 @@ static boolean PIT_CheckThing(mobj_t *thing) } else if (P_IsObjectOnGround(tmthing) && thing->momz < 0) { - K_KartBouncing(thing, tmthing, true); + K_KartBouncing(thing, tmthing, true, false); if (gametype != GT_RACE && thing->player->kartstuff[k_feather] & 2) { K_StealBalloon(thing->player, tmthing->player, false); @@ -1696,7 +1696,7 @@ static boolean PIT_CheckThing(mobj_t *thing) } } else - K_KartBouncing(tmthing, thing, false); + K_KartBouncing(tmthing, thing, false, false); if (gametype != GT_RACE) { @@ -1714,6 +1714,21 @@ static boolean PIT_CheckThing(mobj_t *thing) return true; } + else if (thing->flags & MF_SOLID) + { + // see if it went over / under + if (tmthing->z > thing->z + thing->height) + return true; // overhead + if (tmthing->z + tmthing->height < thing->z) + return true; // underneath + + if (P_IsObjectOnGround(thing) && tmthing->momz < 0) + K_KartBouncing(tmthing, thing, true, true); + else + K_KartBouncing(tmthing, thing, false, true); + + return true; + } // Are you touching the side of the object you're interacting with? else if (thing->z - FixedMul(FRACUNIT, thing->scale) <= tmthing->z + tmthing->height && thing->z + thing->height + FixedMul(FRACUNIT, thing->scale) >= tmthing->z) @@ -3177,8 +3192,8 @@ static void P_HitBounceLine(line_t *ld) movelen = P_AproxDistance(tmxmove, tmymove); - if (slidemo->player && movelen < 25*FRACUNIT) - movelen = 25*FRACUNIT; + if (slidemo->player && movelen < 15*FRACUNIT) + movelen = 15*FRACUNIT; tmxmove += FixedMul(movelen, FINECOSINE(lineangle)); tmymove += FixedMul(movelen, FINESINE(lineangle)); From 6b1b7155020371a65e7ece8164e08440f2b2bf38 Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Mon, 8 Jan 2018 16:51:38 -0500 Subject: [PATCH 6/8] Switched Gold 'shroom and Star's chances Doesn't really belong in this branch, but it's also an experimental change that needs a decent-sized netgame to test to make sure it doesn't hurt anything. Done because Gold 'shroom is a lot harder to use as a catch-up item now that it reduces timer whenever you use it --- src/k_kart.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/k_kart.c b/src/k_kart.c index 5ba24f7d..9c27a856 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -700,8 +700,8 @@ static INT32 K_KartItemOddsDistance_Retro[NUMKARTITEMS][9] = /*Mushroom*/ { 1, 0, 0, 3, 7, 5, 0, 0, 0 }, // Mushroom /*Triple Mushroom*/ { 0, 0, 0, 0, 3,10, 6, 4, 0 }, // Triple Mushroom /*Mega Mushroom*/ { 0, 0, 0, 0, 0, 1, 1, 0, 0 }, // Mega Mushroom - /*Gold Mushroom*/ { 0, 0, 0, 0, 0, 1, 6, 8,12 }, // Gold Mushroom - /*Star*/ { 0, 0, 0, 0, 0, 0, 4, 6, 8 }, // Star + /*Gold Mushroom*/ { 0, 0, 0, 0, 0, 0, 4, 6, 8 }, // Gold Mushroom + /*Star*/ { 0, 0, 0, 0, 0, 1, 6, 8,12 }, // Star /*Triple Banana*/ { 0, 0, 1, 1, 0, 0, 0, 0, 0 }, // Triple Banana /*Fake Item*/ { 0, 4, 2, 1, 0, 0, 0, 0, 0 }, // Fake Item From 3f1b312c77e1af0086bfa52b5fe4ea07112bad40 Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Sat, 13 Jan 2018 14:24:02 -0500 Subject: [PATCH 7/8] Title screen --- src/f_finale.c | 61 ++++++-------------------------------------------- src/k_kart.c | 2 +- 2 files changed, 8 insertions(+), 55 deletions(-) diff --git a/src/f_finale.c b/src/f_finale.c index 83699768..c93613cc 100644 --- a/src/f_finale.c +++ b/src/f_finale.c @@ -52,7 +52,7 @@ static UINT8 curDemo = 0; static UINT32 demoDelayLeft; static UINT32 demoIdleLeft; -static patch_t *ttbanner; // white banner with "robo blast" and "2" +/*static patch_t *ttbanner; // white banner with "robo blast" and "2" static patch_t *ttwing; // wing background static patch_t *ttsonic; // "SONIC" static patch_t *ttswave1; // Title Sonics @@ -66,7 +66,9 @@ static patch_t *ttspop3; static patch_t *ttspop4; static patch_t *ttspop5; static patch_t *ttspop6; -static patch_t *ttspop7; +static patch_t *ttspop7;*/ + +static patch_t *kartttl; // SONIC ROBO BLAST 2 KART static void F_SkyScroll(INT32 scrollspeed); @@ -932,21 +934,7 @@ void F_StartTitleScreen(void) demoDelayLeft = demoDelayTime; demoIdleLeft = demoIdleTime; - ttbanner = W_CachePatchName("TTBANNER", PU_LEVEL); - ttwing = W_CachePatchName("TTWING", PU_LEVEL); - ttsonic = W_CachePatchName("TTSONIC", PU_LEVEL); - ttswave1 = W_CachePatchName("TTSWAVE1", PU_LEVEL); - ttswave2 = W_CachePatchName("TTSWAVE2", PU_LEVEL); - ttswip1 = W_CachePatchName("TTSWIP1", PU_LEVEL); - ttsprep1 = W_CachePatchName("TTSPREP1", PU_LEVEL); - ttsprep2 = W_CachePatchName("TTSPREP2", PU_LEVEL); - ttspop1 = W_CachePatchName("TTSPOP1", PU_LEVEL); - ttspop2 = W_CachePatchName("TTSPOP2", PU_LEVEL); - ttspop3 = W_CachePatchName("TTSPOP3", PU_LEVEL); - ttspop4 = W_CachePatchName("TTSPOP4", PU_LEVEL); - ttspop5 = W_CachePatchName("TTSPOP5", PU_LEVEL); - ttspop6 = W_CachePatchName("TTSPOP6", PU_LEVEL); - ttspop7 = W_CachePatchName("TTSPOP7", PU_LEVEL); + kartttl = W_CachePatchName("KARTTTL", PU_LEVEL); } // (no longer) De-Demo'd Title Screen @@ -959,45 +947,10 @@ void F_TitleScreenDrawer(void) F_SkyScroll(titlescrollspeed); // Don't draw outside of the title screewn, or if the patch isn't there. - if (!ttwing || (gamestate != GS_TITLESCREEN && gamestate != GS_WAITINGPLAYERS)) + if (!kartttl || (gamestate != GS_TITLESCREEN && gamestate != GS_WAITINGPLAYERS)) return; - V_DrawScaledPatch(30, 14, 0, ttwing); - - if (finalecount < 57) - { - if (finalecount == 35) - V_DrawScaledPatch(115, 15, 0, ttspop1); - else if (finalecount == 36) - V_DrawScaledPatch(114, 15, 0,ttspop2); - else if (finalecount == 37) - V_DrawScaledPatch(113, 15, 0,ttspop3); - else if (finalecount == 38) - V_DrawScaledPatch(112, 15, 0,ttspop4); - else if (finalecount == 39) - V_DrawScaledPatch(111, 15, 0,ttspop5); - else if (finalecount == 40) - V_DrawScaledPatch(110, 15, 0, ttspop6); - else if (finalecount >= 41 && finalecount <= 44) - V_DrawScaledPatch(109, 15, 0, ttspop7); - else if (finalecount >= 45 && finalecount <= 48) - V_DrawScaledPatch(108, 12, 0, ttsprep1); - else if (finalecount >= 49 && finalecount <= 52) - V_DrawScaledPatch(107, 9, 0, ttsprep2); - else if (finalecount >= 53 && finalecount <= 56) - V_DrawScaledPatch(106, 6, 0, ttswip1); - V_DrawScaledPatch(93, 106, 0, ttsonic); - } - else - { - V_DrawScaledPatch(93, 106, 0,ttsonic); - if (finalecount/5 & 1) - V_DrawScaledPatch(100, 3, 0,ttswave1); - else - V_DrawScaledPatch(100,3, 0,ttswave2); - } - - V_DrawScaledPatch(48, 142, 0,ttbanner); + V_DrawScaledPatch(84, 36, 0, kartttl); } // (no longer) De-Demo'd Title Screen diff --git a/src/k_kart.c b/src/k_kart.c index 9c27a856..52b4cc64 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -1062,7 +1062,7 @@ static void K_KartItemRouletteByDistance(player_t *player, ticcmd_t *cmd) if (cv_kartfrantic.value) // Frantic items { pdis = (13*pdis/12); // make the distances between everyone artifically higher... - pdis += distvar; // and set everyone back another place! + //pdis += distvar; // and set everyone back another place! } if (pingame == 1) useodds = 0; // Record Attack, or just alone From 61a4ea6962a913a3139bcb932db4dd0b5c5a2368 Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Mon, 15 Jan 2018 16:14:45 -0500 Subject: [PATCH 8/8] Mobj scale fixes - MAXSTEPMOVE is affected by mobjscale - Minimum bump speeds (both wall & object) are affected by mobjscale - Minimum speed required for drifting is affected by player scale - Speedometer speeds are proportional to mobjscale - Camera no longer scales with player scale, to make the fact that you're either Lightning'd or Mega'd more obvious :V - Sevvvvvv go work on Dimension Heist --- src/k_kart.c | 18 +++++++++--------- src/p_map.c | 6 +++--- src/p_user.c | 28 ++++++++-------------------- 3 files changed, 20 insertions(+), 32 deletions(-) diff --git a/src/k_kart.c b/src/k_kart.c index 52b4cc64..4ceb8b72 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -1194,13 +1194,13 @@ void K_KartBouncing(mobj_t *mobj1, mobj_t *mobj2, boolean bounce, boolean solid) momdify = mobj1->momy - mobj2->momy; // if the speed difference is less than this let's assume they're going proportionately faster from each other - if (P_AproxDistance(momdifx, momdify) < 25*FRACUNIT) + if (P_AproxDistance(momdifx, momdify) < (25*mapheaderinfo[gamemap-1]->mobj_scale)) { fixed_t momdiflength = P_AproxDistance(momdifx, momdify); fixed_t normalisedx = FixedDiv(momdifx, momdiflength); fixed_t normalisedy = FixedDiv(momdify, momdiflength); - momdifx = FixedMul(25*FRACUNIT, normalisedx); - momdify = FixedMul(25*FRACUNIT, normalisedy); + momdifx = FixedMul((25*mapheaderinfo[gamemap-1]->mobj_scale), normalisedx); + momdify = FixedMul((25*mapheaderinfo[gamemap-1]->mobj_scale), normalisedy); } distx = mobj1->x - mobj2->x; @@ -2836,7 +2836,7 @@ static void K_KartDrift(player_t *player, boolean onground) } // Drifting: left or right? - if ((player->cmd.buttons & BT_DRIFTLEFT) && player->speed > (10<<16) && player->kartstuff[k_jmp] == 1 + if ((player->cmd.buttons & BT_DRIFTLEFT) && player->speed > FixedMul(10<<16, player->mo->scale) && player->kartstuff[k_jmp] == 1 && (player->kartstuff[k_drift] == 0 || player->kartstuff[k_driftend] == 1)) // && player->kartstuff[k_drift] != 1) { // Starting left drift @@ -2844,7 +2844,7 @@ static void K_KartDrift(player_t *player, boolean onground) player->kartstuff[k_driftend] = 0; player->kartstuff[k_driftcharge] = 0; } - else if ((player->cmd.buttons & BT_DRIFTRIGHT) && player->speed > (10<<16) && player->kartstuff[k_jmp] == 1 + else if ((player->cmd.buttons & BT_DRIFTRIGHT) && player->speed > FixedMul(10<<16, player->mo->scale) && player->kartstuff[k_jmp] == 1 && (player->kartstuff[k_drift] == 0 || player->kartstuff[k_driftend] == 1)) // && player->kartstuff[k_drift] != -1) { // Starting right drift @@ -2908,7 +2908,7 @@ static void K_KartDrift(player_t *player, boolean onground) // Stop drifting if (player->kartstuff[k_spinouttimer] > 0 // banana peel - || player->speed < (10<<16)) // you're too slow! + || player->speed < FixedMul(10<<16, player->mo->scale)) // you're too slow! { player->kartstuff[k_drift] = 0; player->kartstuff[k_driftcharge] = 0; @@ -4822,17 +4822,17 @@ static void K_drawKartSpeedometer(void) if (cv_speedometer.value == 1) { - convSpeed = FixedMul(stplyr->speed, 142371)/FRACUNIT; // 2.172409058 + convSpeed = FixedDiv(FixedMul(stplyr->speed, 142371), mapheaderinfo[gamemap-1]->mobj_scale)/FRACUNIT; // 2.172409058 V_DrawKartString(SPDM_X, SPDM_Y, V_HUDTRANS|splitflags, va("%3d km/h", convSpeed)); } else if (cv_speedometer.value == 2) { - convSpeed = FixedMul(stplyr->speed, 88465)/FRACUNIT; // 1.349868774 + convSpeed = FixedDiv(FixedMul(stplyr->speed, 88465), mapheaderinfo[gamemap-1]->mobj_scale)/FRACUNIT; // 1.349868774 V_DrawKartString(SPDM_X, SPDM_Y, V_HUDTRANS|splitflags, va("%3d mph", convSpeed)); } else if (cv_speedometer.value == 3) { - convSpeed = stplyr->speed/FRACUNIT; + convSpeed = FixedDiv(stplyr->speed, mapheaderinfo[gamemap-1]->mobj_scale)/FRACUNIT; V_DrawKartString(SPDM_X, SPDM_Y, V_HUDTRANS|splitflags, va("%3d fu/s", convSpeed)); } } diff --git a/src/p_map.c b/src/p_map.c index 2a5ee710..0a52d6fb 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -2754,7 +2754,7 @@ boolean P_TryMove(mobj_t *thing, fixed_t x, fixed_t y, boolean allowdropoff) if (!(thing->flags & MF_NOCLIP)) { //All things are affected by their scale. - fixed_t maxstep = MAXSTEPMOVE; //FixedMul(MAXSTEPMOVE, thing->scale); + fixed_t maxstep = FixedMul(MAXSTEPMOVE, mapheaderinfo[gamemap-1]->mobj_scale); if (thing->player) { @@ -3192,8 +3192,8 @@ static void P_HitBounceLine(line_t *ld) movelen = P_AproxDistance(tmxmove, tmymove); - if (slidemo->player && movelen < 15*FRACUNIT) - movelen = 15*FRACUNIT; + if (slidemo->player && movelen < (15*mapheaderinfo[gamemap-1]->mobj_scale)) + movelen = (15*mapheaderinfo[gamemap-1]->mobj_scale); tmxmove += FixedMul(movelen, FINECOSINE(lineangle)); tmymove += FixedMul(movelen, FINESINE(lineangle)); diff --git a/src/p_user.c b/src/p_user.c index 75a34559..467a5057 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -8351,32 +8351,32 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall camspeed = cv_cam_speed.value; camstill = cv_cam_still.value; camrotate = cv_cam_rotate.value; - camdist = FixedMul(cv_cam_dist.value, mo->scale); - camheight = FixedMul(cv_cam_height.value, mo->scale); + camdist = FixedMul(cv_cam_dist.value, mapheaderinfo[gamemap-1]->mobj_scale); + camheight = FixedMul(cv_cam_height.value, mapheaderinfo[gamemap-1]->mobj_scale); } else if (thiscam == &camera2) // Camera 2 { camspeed = cv_cam2_speed.value; camstill = cv_cam2_still.value; camrotate = cv_cam2_rotate.value; - camdist = FixedMul(cv_cam2_dist.value, mo->scale); - camheight = FixedMul(cv_cam2_height.value, mo->scale); + camdist = FixedMul(cv_cam2_dist.value, mapheaderinfo[gamemap-1]->mobj_scale); + camheight = FixedMul(cv_cam2_height.value, mapheaderinfo[gamemap-1]->mobj_scale); } else if (thiscam == &camera3) // Camera 3 { camspeed = cv_cam3_speed.value; camstill = cv_cam3_still.value; camrotate = cv_cam3_rotate.value; - camdist = FixedMul(cv_cam3_dist.value, mo->scale); - camheight = FixedMul(cv_cam3_height.value, mo->scale); + camdist = FixedMul(cv_cam3_dist.value, mapheaderinfo[gamemap-1]->mobj_scale); + camheight = FixedMul(cv_cam3_height.value, mapheaderinfo[gamemap-1]->mobj_scale); } else // Camera 4 { camspeed = cv_cam4_speed.value; camstill = cv_cam4_still.value; camrotate = cv_cam4_rotate.value; - camdist = FixedMul(cv_cam4_dist.value, mo->scale); - camheight = FixedMul(cv_cam4_height.value, mo->scale); + camdist = FixedMul(cv_cam4_dist.value, mapheaderinfo[gamemap-1]->mobj_scale); + camheight = FixedMul(cv_cam4_height.value, mapheaderinfo[gamemap-1]->mobj_scale); } #ifdef REDSANALOG @@ -8536,18 +8536,6 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall dist = FixedMul(dist, 3*FRACUNIT/2); height = FixedMul(height, 3*FRACUNIT/2); } - else if (splitscreen > 1) // smallscreen splits should get 7/8 distance (shorter feels better, oddly enough) - { - dist = FixedMul(dist, 7*FRACUNIT/8); - height = FixedMul(height, 7*FRACUNIT/8); - } - - // x1.2 dist for analog - /*if (P_AnalogMove(player)) - { - dist = FixedMul(dist, 6*FRACUNIT/5); - height = FixedMul(height, 6*FRACUNIT/5); - }*/ if (player->climbing || player->exiting || player->playerstate == PST_DEAD || (player->pflags & (PF_MACESPIN|PF_ITEMHANG|PF_ROPEHANG))) dist <<= 1;