Make low friciton how it is in kart
This commit is contained in:
parent
24e2e06b1f
commit
84b7d363be
3 changed files with 33 additions and 84 deletions
|
|
@ -548,77 +548,6 @@ void K_ProcessTerrainEffect(mobj_t *mo)
|
|||
// (Offroad is handled elsewhere!)
|
||||
}
|
||||
|
||||
/*--------------------------------------------------
|
||||
void K_SetDefaultFriction(mobj_t *mo)
|
||||
|
||||
See header file for description.
|
||||
--------------------------------------------------*/
|
||||
void K_SetDefaultFriction(mobj_t *mo)
|
||||
{
|
||||
boolean isPlayer = false;
|
||||
|
||||
if (mo == NULL || P_MobjWasRemoved(mo) == true)
|
||||
{
|
||||
// Invalid object.
|
||||
return;
|
||||
}
|
||||
|
||||
isPlayer = (mo->player != NULL);
|
||||
|
||||
mo->friction = ORIG_FRICTION;
|
||||
|
||||
if (isPlayer == true)
|
||||
{
|
||||
mo->movefactor = FRACUNIT;
|
||||
}
|
||||
|
||||
if (mo->terrain != NULL)
|
||||
{
|
||||
fixed_t strength = mo->terrain->friction;
|
||||
|
||||
fixed_t newFriction = INT32_MAX;
|
||||
fixed_t newMovefactor = INT32_MAX;
|
||||
|
||||
if (strength > 0) // sludge
|
||||
{
|
||||
strength = strength * 2; // otherwise, the maximum sludginess value is +967...
|
||||
}
|
||||
|
||||
// The following might seem odd. At the time of movement,
|
||||
// the move distance is multiplied by 'friction/0x10000', so a
|
||||
// higher friction value actually means 'less friction'.
|
||||
newFriction = ORIG_FRICTION - FixedMul(0x1EB8, strength) / 0x80; // ORIG_FRICTION is 0xE800
|
||||
|
||||
if (newFriction > FRACUNIT)
|
||||
{
|
||||
newFriction = FRACUNIT;
|
||||
}
|
||||
|
||||
if (newFriction < 0)
|
||||
{
|
||||
newFriction = 0;
|
||||
}
|
||||
|
||||
mo->friction = newFriction;
|
||||
|
||||
if (isPlayer == true)
|
||||
{
|
||||
newMovefactor = FixedDiv(ORIG_FRICTION, newFriction);
|
||||
|
||||
if (newMovefactor < FRACUNIT)
|
||||
{
|
||||
newMovefactor = 19*newMovefactor - 18*FRACUNIT;
|
||||
}
|
||||
else
|
||||
{
|
||||
newMovefactor = FRACUNIT;
|
||||
}
|
||||
|
||||
mo->movefactor = newMovefactor;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*--------------------------------------------------
|
||||
static void K_SpawnSplashParticles(mobj_t *mo, t_splash_t *s, fixed_t impact)
|
||||
|
||||
|
|
|
|||
15
src/p_mobj.c
15
src/p_mobj.c
|
|
@ -1341,6 +1341,7 @@ static void P_SceneryXYFriction(mobj_t *mo, fixed_t oldx, fixed_t oldy)
|
|||
{
|
||||
// Stolen from P_SpawnFriction
|
||||
mo->friction = FRACUNIT - 0x100;
|
||||
//mo->movefactor = ((0x10092 - mo->friction)*(0x70))/0x158;
|
||||
}
|
||||
else
|
||||
mo->friction = ORIG_FRICTION;
|
||||
|
|
@ -1362,21 +1363,23 @@ static void P_XYFriction(mobj_t *mo, fixed_t oldx, fixed_t oldy)
|
|||
player = mo->player;
|
||||
if (player) // valid only if player avatar
|
||||
{
|
||||
if (FixedHypot(player->rmomx, player->rmomy) < FixedMul(STOPSPEED, mo->scale) && (K_GetForwardMove(player) == 0)
|
||||
&& !(player->mo->standingslope && (!(player->mo->standingslope->flags & SL_NOPHYSICS)) /*&& (abs(player->mo->standingslope->zdelta) >= FRACUNIT/2)*/))
|
||||
if (abs(player->rmomx) < FixedMul(STOPSPEED, mo->scale)
|
||||
&& abs(player->rmomy) < FixedMul(STOPSPEED, mo->scale)
|
||||
&& (!(player->cmd.forwardmove && !player->cmd.sidemove))
|
||||
&& !(player->mo->standingslope && (!(player->mo->standingslope->flags & SL_NOPHYSICS)) && (abs(player->mo->standingslope->zdelta) >= FRACUNIT/2))
|
||||
)
|
||||
{
|
||||
// if in a walking frame, stop moving
|
||||
if (player->panim == PA_SLOW)
|
||||
{
|
||||
P_SetPlayerMobjState(mo, S_KART_STILL);
|
||||
}
|
||||
|
||||
mo->momx = player->cmomx;
|
||||
mo->momy = player->cmomy;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (oldx == mo->x && oldy == mo->y)
|
||||
if (oldx == mo->x && oldy == mo->y) // didn't go anywhere
|
||||
{
|
||||
mo->momx = FixedMul(mo->momx, ORIG_FRICTION);
|
||||
mo->momy = FixedMul(mo->momy, ORIG_FRICTION);
|
||||
|
|
@ -1387,13 +1390,11 @@ static void P_XYFriction(mobj_t *mo, fixed_t oldx, fixed_t oldy)
|
|||
mo->momy = FixedMul(mo->momy, mo->friction);
|
||||
}
|
||||
|
||||
K_SetDefaultFriction(mo);
|
||||
mo->friction = ORIG_FRICTION;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
P_SceneryXYFriction(mo, oldx, oldy);
|
||||
}
|
||||
}
|
||||
|
||||
static void P_PushableCheckBustables(mobj_t *mo)
|
||||
|
|
|
|||
31
src/p_spec.c
31
src/p_spec.c
|
|
@ -8215,10 +8215,22 @@ void T_Friction(friction_t *f)
|
|||
|
||||
sec = sectors + f->affectee;
|
||||
|
||||
// Get FOF control sector
|
||||
// Get FOF control sector (was "Make sure the sector type hasn't changed")
|
||||
if (f->roverfriction)
|
||||
//{
|
||||
referrer = sectors + f->referrer;
|
||||
|
||||
/* if (!(GETSECSPECIAL(referrer->special, 3) == 1
|
||||
|| GETSECSPECIAL(referrer->special, 3) == 3))
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!(GETSECSPECIAL(sec->special, 3) == 1
|
||||
|| GETSECSPECIAL(sec->special, 3) == 3))
|
||||
return;
|
||||
}*/
|
||||
|
||||
// Assign the friction value to players on the floor, non-floating,
|
||||
// and clipped. Normally the object's friction value is kept at
|
||||
// ORIG_FRICTION and this thinker changes it for icy or muddy floors.
|
||||
|
|
@ -8234,8 +8246,7 @@ void T_Friction(friction_t *f)
|
|||
// apparently, all I had to do was comment out part of the next line and
|
||||
// friction works for all mobj's
|
||||
// (or at least MF_PUSHABLEs, which is all I care about anyway)
|
||||
// Readded v1 kart condition - Nep
|
||||
if (!(thing->flags & (MF_NOGRAVITY | MF_NOCLIP)) && thing->z == thing->floorz && (thing->player
|
||||
if ((!(thing->flags & (MF_NOGRAVITY | MF_NOCLIP)) && thing->z == thing->floorz) && (thing->player
|
||||
&& (thing->player->invincibilitytimer == 0 && thing->player->hyudorotimer == 0
|
||||
&& thing->player->sneakertimer == 0 && thing->player->growshrinktimer <= 0)))
|
||||
{
|
||||
|
|
@ -8277,7 +8288,7 @@ static void P_SpawnFriction(void)
|
|||
line_t *l = lines;
|
||||
mtag_t tag;
|
||||
register INT32 s;
|
||||
fixed_t strength; // frontside texture offset controls magnitude
|
||||
fixed_t strength; // frontside texture offset controls magnitude //fixed_t length; // line length controls magnitude
|
||||
fixed_t friction; // friction value to be applied during movement
|
||||
INT32 movefactor; // applied to each player move to simulate inertia
|
||||
|
||||
|
|
@ -8285,11 +8296,13 @@ static void P_SpawnFriction(void)
|
|||
if (l->special == 540)
|
||||
{
|
||||
tag = Tag_FGet(&l->tags);
|
||||
//length = P_AproxDistance(l->dx, l->dy)>>FRACBITS;
|
||||
//friction = (0x1EB8*length)/0x80 + 0xD000;
|
||||
strength = sides[l->sidenum[0]].textureoffset>>FRACBITS;
|
||||
if (strength > 0) // sludge
|
||||
strength = strength*2; // otherwise, the maximum sludginess value is +967...
|
||||
|
||||
// The following might seem odd. At the time of movement,
|
||||
// The following check might seem odd. At the time of movement,
|
||||
// the move distance is multiplied by 'friction/0x10000', so a
|
||||
// higher friction value actually means 'less friction'.
|
||||
friction = ORIG_FRICTION - (0x1EB8*strength)/0x80; // ORIG_FRICTION is 0xE800
|
||||
|
|
@ -8299,11 +8312,17 @@ static void P_SpawnFriction(void)
|
|||
if (friction < 0)
|
||||
friction = 0;
|
||||
|
||||
//if (friction > ORIG_FRICTION) // ice
|
||||
// movefactor = ((0x10092 - friction)*(0x70))/0x158;
|
||||
movefactor = FixedDiv(ORIG_FRICTION, friction);
|
||||
if (movefactor < FRACUNIT)
|
||||
movefactor = 19*movefactor - 18*FRACUNIT;
|
||||
else
|
||||
movefactor = FRACUNIT;
|
||||
movefactor = FRACUNIT; //movefactor = ((friction - 0xDB34)*(0xA))/0x80;
|
||||
|
||||
// killough 8/28/98: prevent odd situations
|
||||
if (movefactor < 32)
|
||||
movefactor = 32;
|
||||
|
||||
TAG_ITER_SECTORS(tag, s)
|
||||
Add_Friction(friction, movefactor, s, -1);
|
||||
|
|
|
|||
Loading…
Reference in a new issue