From 0dc2c43a672b6199ac2904c2afee9e9793d40ba3 Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Wed, 25 Jul 2018 12:49:30 -0400 Subject: [PATCH] Banana drag touches - Banana drag timer resets when placing one, for x3 & x10 bananas - Banana dragging spawns transulcent dust - Dragging bananas make them twitch up & down --- src/k_kart.c | 31 +++++++++++++++++++++++++------ src/k_kart.h | 2 +- src/lua_baselib.c | 3 ++- src/p_user.c | 2 +- 4 files changed, 29 insertions(+), 9 deletions(-) diff --git a/src/k_kart.c b/src/k_kart.c index 464c4869..d2ded697 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -2154,7 +2154,7 @@ void K_SpawnSparkleTrail(mobj_t *mo) } } -void K_SpawnWipeoutTrail(mobj_t *mo) +void K_SpawnWipeoutTrail(mobj_t *mo, boolean translucent) { mobj_t *dust; @@ -2168,6 +2168,9 @@ void K_SpawnWipeoutTrail(mobj_t *mo) dust->destscale = mo->scale; P_SetScale(dust, mo->scale); dust->eflags = (dust->eflags & ~MFE_VERTICALFLIP)|(mo->eflags & MFE_VERTICALFLIP); + + if (translucent) + dust->flags2 |= MF2_SHADOW; } // K_DriftDustHandling @@ -2280,8 +2283,7 @@ static mobj_t *K_ThrowKartItem(player_t *player, boolean missile, mobjtype_t map mobj_t *mo; INT32 dir, PROJSPEED; angle_t newangle; - fixed_t newx; - fixed_t newy; + fixed_t newx, newy, newz; mobj_t *throwmo; if (!player) @@ -2393,10 +2395,13 @@ static mobj_t *K_ThrowKartItem(player_t *player, boolean missile, mobjtype_t map { mobj_t *lasttrail = K_FindLastTrailMobj(player); + player->kartstuff[k_bananadrag] = 0; // RESET timer, for multiple bananas + if (lasttrail) { newx = lasttrail->x; newy = lasttrail->y; + newz = lasttrail->z; } else { @@ -2407,9 +2412,10 @@ static mobj_t *K_ThrowKartItem(player_t *player, boolean missile, mobjtype_t map newx = player->mo->x + P_ReturnThrustX(player->mo, newangle + ANGLE_180, dropradius); newy = player->mo->y + P_ReturnThrustY(player->mo, newangle + ANGLE_180, dropradius); + newz = player->mo->z; } - mo = P_SpawnMobj(newx, newy, player->mo->z, mapthing); + mo = P_SpawnMobj(newx, newy, newz, mapthing); if (P_MobjFlip(player->mo) < 0) mo->z = player->mo->z + player->mo->height - mo->height; @@ -2785,8 +2791,12 @@ static void K_MoveHeldObjects(player_t *player) if (P_IsObjectOnGround(player->mo) && player->speed > 0) { player->kartstuff[k_bananadrag]++; - if (player->kartstuff[k_bananadrag] > TICRATE && leveltime % 7 == 0) - S_StartSound(player->mo, sfx_cdfm70); + if (player->kartstuff[k_bananadrag] > TICRATE) + { + K_SpawnWipeoutTrail(player->mo, true); + if (leveltime % 6 == 0) + S_StartSound(player->mo, sfx_cdfm70); + } } while (cur && !P_MobjWasRemoved(cur)) @@ -2824,6 +2834,15 @@ static void K_MoveHeldObjects(player_t *player) cur->angle = R_PointToAngle2(cur->x, cur->y, targx, targy); + if (P_IsObjectOnGround(player->mo) && player->speed > 0 && player->kartstuff[k_bananadrag] > TICRATE + && P_RandomChance(min(FRACUNIT/2, FixedDiv(player->speed, K_GetKartSpeed(player, false))/2))) + { + if (leveltime & 1) + targz += 8*(2*FRACUNIT)/7; + else + targz -= 8*(2*FRACUNIT)/7; + } + if (speed > dist) P_InstaThrust(cur, cur->angle, speed-dist); diff --git a/src/k_kart.h b/src/k_kart.h index 4a6a7e1a..9b3bdc1a 100644 --- a/src/k_kart.h +++ b/src/k_kart.h @@ -33,7 +33,7 @@ void K_SpawnKartExplosion(fixed_t x, fixed_t y, fixed_t z, fixed_t radius, INT32 void K_SpawnMineExplosion(mobj_t *source, UINT8 color); void K_SpawnBoostTrail(player_t *player); void K_SpawnSparkleTrail(mobj_t *mo); -void K_SpawnWipeoutTrail(mobj_t *mo); +void K_SpawnWipeoutTrail(mobj_t *mo, boolean translucent); void K_DriftDustHandling(mobj_t *spawner); void K_DoSneaker(player_t *player, boolean doPFlag); void K_DoPogoSpring(mobj_t *mo, fixed_t vertispeed, boolean mute); diff --git a/src/lua_baselib.c b/src/lua_baselib.c index d86315c0..30285e0e 100644 --- a/src/lua_baselib.c +++ b/src/lua_baselib.c @@ -2135,10 +2135,11 @@ static int lib_kSpawnSparkleTrail(lua_State *L) static int lib_kSpawnWipeoutTrail(lua_State *L) { mobj_t *mo = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ)); + boolean translucent = luaL_checkboolean(L, 2); NOHUD if (!mo) return LUA_ErrInvalid(L, "mobj_t"); - K_SpawnWipeoutTrail(mo); + K_SpawnWipeoutTrail(mo, translucent); return 0; } diff --git a/src/p_user.c b/src/p_user.c index f612e81d..106b3645 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -6938,7 +6938,7 @@ static void P_MovePlayer(player_t *player) K_SpawnSparkleTrail(player->mo); if (player->kartstuff[k_wipeoutslow] > 1 && (leveltime & 1)) - K_SpawnWipeoutTrail(player->mo); + K_SpawnWipeoutTrail(player->mo, false); K_DriftDustHandling(player->mo);