mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 01:58:19 +00:00
Merge #1933
1933: Fix two unintentional behavior changes of the stopper rewrite r=def- a=heinrich5991 Co-authored-by: heinrich5991 <heinrich5991@gmail.com>
This commit is contained in:
commit
4f63492dc9
|
@ -229,7 +229,7 @@ static int GetMoveRestrictions(int Direction, int Tile, int Flags)
|
|||
return Result&GetMoveRestrictionsMask(Direction);
|
||||
}
|
||||
|
||||
int CCollision::GetMoveRestrictions(CALLBACK_SWITCHACTIVE pfnSwitchActive, void *pUser, vec2 Pos, float Distance)
|
||||
int CCollision::GetMoveRestrictions(CALLBACK_SWITCHACTIVE pfnSwitchActive, void *pUser, vec2 Pos, float Distance, int OverrideCenterTileIndex)
|
||||
{
|
||||
static const vec2 DIRECTIONS[NUM_MR_DIRS] =
|
||||
{
|
||||
|
@ -245,6 +245,10 @@ int CCollision::GetMoveRestrictions(CALLBACK_SWITCHACTIVE pfnSwitchActive, void
|
|||
{
|
||||
vec2 ModPos = Pos + DIRECTIONS[d] * Distance;
|
||||
int ModMapIndex = GetPureMapIndex(ModPos);
|
||||
if(d == MR_DIR_HERE && OverrideCenterTileIndex >= 0)
|
||||
{
|
||||
ModMapIndex = OverrideCenterTileIndex;
|
||||
}
|
||||
for(int Front = 0; Front < 2; Front++)
|
||||
{
|
||||
int Tile;
|
||||
|
|
|
@ -60,7 +60,7 @@ public:
|
|||
int GetIndex(vec2 PrevPos, vec2 Pos);
|
||||
int GetFIndex(int x, int y);
|
||||
|
||||
int GetMoveRestrictions(CALLBACK_SWITCHACTIVE pfnSwitchActive, void *pUser, vec2 Pos, float Distance = 18.0f);
|
||||
int GetMoveRestrictions(CALLBACK_SWITCHACTIVE pfnSwitchActive, void *pUser, vec2 Pos, float Distance = 18.0f, int OverrideCenterTileIndex = -1);
|
||||
int GetMoveRestrictions(vec2 Pos, float Distance = 18.0f)
|
||||
{
|
||||
return GetMoveRestrictions(0, 0, Pos, Distance);
|
||||
|
|
|
@ -1364,7 +1364,7 @@ void CCharacter::HandleTiles(int Index)
|
|||
//int PureMapIndex = GameServer()->Collision()->GetPureMapIndex(m_Pos);
|
||||
m_TileIndex = GameServer()->Collision()->GetTileIndex(MapIndex);
|
||||
m_TileFIndex = GameServer()->Collision()->GetFTileIndex(MapIndex);
|
||||
m_MoveRestrictions = GameServer()->Collision()->GetMoveRestrictions(IsSwitchActiveCb, this, m_Pos);
|
||||
m_MoveRestrictions = GameServer()->Collision()->GetMoveRestrictions(IsSwitchActiveCb, this, m_Pos, 18.0f, MapIndex);
|
||||
//Sensitivity
|
||||
int S1 = GameServer()->Collision()->GetPureMapIndex(vec2(m_Pos.x + m_ProximityRadius / 3.f, m_Pos.y - m_ProximityRadius / 3.f));
|
||||
int S2 = GameServer()->Collision()->GetPureMapIndex(vec2(m_Pos.x + m_ProximityRadius / 3.f, m_Pos.y + m_ProximityRadius / 3.f));
|
||||
|
@ -1674,12 +1674,12 @@ void CCharacter::HandleTiles(int Index)
|
|||
}
|
||||
|
||||
// stopper
|
||||
m_Core.m_Vel = ClampVel(m_MoveRestrictions, m_Core.m_Vel);
|
||||
if(m_MoveRestrictions&CANTMOVE_DOWN)
|
||||
if(m_Core.m_Vel > 0 && (m_MoveRestrictions&CANTMOVE_DOWN))
|
||||
{
|
||||
m_Core.m_Jumped = 0;
|
||||
m_Core.m_JumpedTotal = 0;
|
||||
}
|
||||
m_Core.m_Vel = ClampVel(m_MoveRestrictions, m_Core.m_Vel);
|
||||
|
||||
// handle switch tiles
|
||||
if(GameServer()->Collision()->IsSwitch(MapIndex) == TILE_SWITCHOPEN && Team() != TEAM_SUPER && GameServer()->Collision()->GetSwitchNumber(MapIndex) > 0)
|
||||
|
|
Loading…
Reference in a new issue