More tweaking

- Getting wipeout bumped into offroad slows you down
- Orbinaut & Jawz are relative to your weight (Jawz is heavier), via new function K_GetMobjWeight
- Reorangized where K_KartBouncing is called so that wipeout changes don't affect Eggman Items
This commit is contained in:
TehRealSalt 2018-07-20 16:13:02 -04:00
parent b891ebe614
commit 584082882c
5 changed files with 71 additions and 31 deletions

View File

@ -925,6 +925,42 @@ static void K_KartItemRoulette(player_t *player, ticcmd_t *cmd)
//{ SRB2kart p_user.c Stuff
static fixed_t K_GetMobjWeight(mobj_t *mobj, mobj_t *against)
{
fixed_t weight = 5<<FRACBITS;
switch (mobj->type)
{
case MT_PLAYER:
if (!mobj->player)
break;
if (against->player && !against->player->kartstuff[k_spinouttimer] && mobj->player->kartstuff[k_spinouttimer])
weight = 0; // Do not bump
else
weight = (mobj->player->kartweight)<<FRACBITS;
break;
case MT_GREENITEM:
case MT_GREENSHIELD:
if (against->player)
weight = (against->player->kartweight)<<FRACBITS;
else
weight = 8<<FRACBITS;
break;
case MT_JAWZ:
case MT_JAWZ_DUD:
case MT_JAWZ_SHIELD:
if (against->player)
weight = (against->player->kartweight+3)<<FRACBITS;
else
weight = 11<<FRACBITS;
break;
default:
break;
}
return weight;
}
void K_KartBouncing(mobj_t *mobj1, mobj_t *mobj2, boolean bounce, boolean solid)
{
mobj_t *fx;
@ -959,25 +995,12 @@ void K_KartBouncing(mobj_t *mobj1, mobj_t *mobj2, boolean bounce, boolean solid)
return;
}
mass1 = mass2 = 5*FRACUNIT;
mass1 = K_GetMobjWeight(mobj1, mobj2);
if (mobj1->player)
{
if (mobj2->player && !mobj2->player->kartstuff[k_spinouttimer] && mobj1->player->kartstuff[k_spinouttimer])
mass1 = 0; // Do not bump
else
mass1 = (mobj1->player->kartweight)*FRACUNIT;
}
if (mobj2->player)
{
if (mobj1->player && !mobj1->player->kartstuff[k_spinouttimer] && mobj2->player->kartstuff[k_spinouttimer])
mass2 = 0; // Do not bump
else
mass2 = (mobj2->player->kartweight)*FRACUNIT;
}
else if (solid == true && mobj1->player)
mass2 = (mobj1->player->kartweight)*FRACUNIT;
if (solid == true && mass1 > 0)
mass2 = mass1;
else
mass2 = K_GetMobjWeight(mobj2, mobj1);
momdifx = mobj1->momx - mobj2->momx;
momdify = mobj1->momy - mobj2->momy;
@ -1589,7 +1612,7 @@ void K_SpinPlayer(player_t *player, mobj_t *source, INT32 type, boolean trapitem
S_StartSound(player->mo, sfx_slip);
}
else
player->kartstuff[k_spinouttimer] = (1*TICRATE)+20; // Wipeout
player->kartstuff[k_spinouttimer] = TICRATE+20; // Wipeout
player->powers[pw_flashing] = K_GetKartFlashing();
@ -3868,8 +3891,16 @@ void K_MoveKartPlayer(player_t *player, boolean onground)
if (player->mo->movefactor < 32)
player->mo->movefactor = 32;
}
if (player->kartstuff[k_wipeoutslow] == 1)
player->mo->friction -= 4912;
if (player->kartstuff[k_spinouttimer])
{
player->mo->friction = FRACUNIT;
if (player->kartstuff[k_wipeoutslow])
{
player->mo->friction -= FixedMul(1228, player->kartstuff[k_offroad]);
if (player->kartstuff[k_wipeoutslow] == 1)
player->mo->friction -= 4912;
}
}
K_KartDrift(player, onground);

View File

@ -3325,7 +3325,8 @@ boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 da
damage = player->mo->health - 1;
P_RingDamage(player, inflictor, source, damage);
P_PlayerRingBurst(player, 5);
K_KartBouncing(player->mo, inflictor, false, false);
if (inflictor->type == MT_FAKEITEM || inflictor->type == MT_FAKESHIELD)
player->mo->momx = player->mo->momy = 0;
if (P_IsLocalPlayer(player))
{
quake.intensity = 32*FRACUNIT;

View File

@ -694,6 +694,7 @@ static boolean PIT_CheckThing(mobj_t *thing)
{
// Player Damage
P_DamageMobj(thing, tmthing, tmthing->target, 1);
K_KartBouncing(thing, tmthing, false, false);
if (tmthing->type == MT_GREENITEM || tmthing->type == MT_JAWZ || tmthing->type == MT_JAWZ_DUD)
S_StartSound(thing, sfx_shelit);
@ -1126,6 +1127,9 @@ static boolean PIT_CheckThing(mobj_t *thing)
// Player Damage
P_DamageMobj(tmthing, thing, thing->target, 1);
if (thing->type != MT_FAKESHIELD && thing->type != MT_FAKEITEM)
K_KartBouncing(tmthing, thing, false, false);
if (thing->type == MT_GREENITEM || thing->type == MT_JAWZ || thing->type == MT_JAWZ_DUD)
S_StartSound(tmthing, sfx_shelit);

View File

@ -2003,7 +2003,7 @@ void P_XYMovement(mobj_t *mo)
if (mo->type == MT_GREENITEM || mo->type == MT_JAWZ_DUD || mo->type == MT_JAWZ || mo->type == MT_BALLHOG) //(mo->type == MT_JAWZ && !mo->tracer))
return;
if (mo->player && (mo->player->kartstuff[k_spinouttimer] && mo->player->kartstuff[k_wipeoutslow] != 1) && mo->player->speed <= mo->player->normalspeed/2)
if (mo->player && (mo->player->kartstuff[k_spinouttimer] && !mo->player->kartstuff[k_wipeoutslow]) && mo->player->speed <= mo->player->normalspeed/2)
return;
//}

View File

@ -852,15 +852,19 @@ void P_DoPlayerPain(player_t *player, mobj_t *source, mobj_t *inflictor)
angle_t ang;
fixed_t fallbackspeed;
if (player->mo->eflags & MFE_VERTICALFLIP)
player->mo->z--;
else
player->mo->z++;
if (inflictor && (inflictor->type != MT_PLAYER && inflictor->type != MT_GREENITEM && inflictor->type != MT_GREENSHIELD
&& inflictor->type != MT_JAWZ && inflictor->type != MT_JAWZ_DUD && inflictor->type != MT_JAWZ_SHIELD))
{
if (player->mo->eflags & MFE_VERTICALFLIP)
player->mo->z--;
else
player->mo->z++;
if (player->mo->eflags & MFE_UNDERWATER)
P_SetObjectMomZ(player->mo, FixedDiv(10511*FRACUNIT,2600*FRACUNIT), false);
else
P_SetObjectMomZ(player->mo, FixedDiv(69*FRACUNIT,10*FRACUNIT), false);
if (player->mo->eflags & MFE_UNDERWATER)
P_SetObjectMomZ(player->mo, FixedDiv(10511*FRACUNIT,2600*FRACUNIT), false);
else
P_SetObjectMomZ(player->mo, FixedDiv(69*FRACUNIT,10*FRACUNIT), false);
}
if (inflictor)
{