mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-23 20:43:15 +00:00
- fixed friction logic for sectors.
Issues with the old code: * when calculating friction for a 3D-floor - swimmable or not - the 3D floor's top texture must be used. The previous version always checked the sector's floor texture, even though the top might as well come from the sector's ceiling. * 3D floors never checked for the SECF_FRICTION flag at all. According to Boom specs, sector-based friction must be ignored if this is the case. * Terrain based friction had a higher priority than the sector's own value. Changed the rules as follows: * if the sector's SECF_FRICTION flag is set (i.e. something explicitly changed the sector's friction), this value is used regardless of terrain settings. * if this flag is not set, the terrain's friction is used, if defined, using the proper plane for 3D-floors. * otherwise the default is used.
This commit is contained in:
parent
efaaccc030
commit
0b5e419593
1 changed files with 12 additions and 10 deletions
|
@ -529,16 +529,18 @@ void P_PlayerStartStomp(AActor *actor)
|
||||||
//
|
//
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
|
|
||||||
inline fixed_t secfriction(const sector_t *sec)
|
inline fixed_t secfriction(const sector_t *sec, int plane = sector_t::floor)
|
||||||
{
|
{
|
||||||
fixed_t friction = Terrains[TerrainTypes[sec->GetTexture(sector_t::floor)]].Friction;
|
if (sec->Flags & SECF_FRICTION) return sec->friction;
|
||||||
return friction != 0 ? friction : sec->friction;
|
fixed_t friction = Terrains[TerrainTypes[sec->GetTexture(plane)]].Friction;
|
||||||
|
return friction != 0 ? friction : ORIG_FRICTION;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline fixed_t secmovefac(const sector_t *sec)
|
inline fixed_t secmovefac(const sector_t *sec, int plane = sector_t::floor)
|
||||||
{
|
{
|
||||||
fixed_t movefactor = Terrains[TerrainTypes[sec->GetTexture(sector_t::floor)]].MoveFactor;
|
if (sec->Flags & SECF_FRICTION) return sec->friction;
|
||||||
return movefactor != 0 ? movefactor : sec->movefactor;
|
fixed_t movefactor = Terrains[TerrainTypes[sec->GetTexture(plane)]].MoveFactor;
|
||||||
|
return movefactor != 0 ? movefactor : ORIG_FRICTION_FACTOR;
|
||||||
}
|
}
|
||||||
|
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
|
@ -584,11 +586,11 @@ int P_GetFriction(const AActor *mo, int *frictionfactor)
|
||||||
mo->z < rover->bottom.plane->ZatPoint(mo->x, mo->y))
|
mo->z < rover->bottom.plane->ZatPoint(mo->x, mo->y))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
newfriction = secfriction(rover->model);
|
newfriction = secfriction(rover->model, rover->top.isceiling);
|
||||||
if (newfriction < friction || friction == ORIG_FRICTION)
|
if (newfriction < friction || friction == ORIG_FRICTION)
|
||||||
{
|
{
|
||||||
friction = newfriction;
|
friction = newfriction;
|
||||||
movefactor = secmovefac(rover->model) >> 1;
|
movefactor = secmovefac(rover->model, rover->top.isceiling) >> 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -622,11 +624,11 @@ int P_GetFriction(const AActor *mo, int *frictionfactor)
|
||||||
else
|
else
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
newfriction = secfriction(rover->model);
|
newfriction = secfriction(rover->model, rover->top.isceiling);
|
||||||
if (newfriction < friction || friction == ORIG_FRICTION)
|
if (newfriction < friction || friction == ORIG_FRICTION)
|
||||||
{
|
{
|
||||||
friction = newfriction;
|
friction = newfriction;
|
||||||
movefactor = secmovefac(rover->model);
|
movefactor = secmovefac(rover->model, rover->top.isceiling);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue