mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-19 06:28:19 +00:00
Fix unintentional behavior change with blockers
Could be seen on "Insane 3", on teleporter 37. Thanks to Zwelf for reporting.
This commit is contained in:
parent
ef32fc4bed
commit
eab0815ddc
|
@ -229,7 +229,7 @@ static int GetMoveRestrictions(int Direction, int Tile, int Flags)
|
||||||
return Result&GetMoveRestrictionsMask(Direction);
|
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] =
|
static const vec2 DIRECTIONS[NUM_MR_DIRS] =
|
||||||
{
|
{
|
||||||
|
@ -245,6 +245,10 @@ int CCollision::GetMoveRestrictions(CALLBACK_SWITCHACTIVE pfnSwitchActive, void
|
||||||
{
|
{
|
||||||
vec2 ModPos = Pos + DIRECTIONS[d] * Distance;
|
vec2 ModPos = Pos + DIRECTIONS[d] * Distance;
|
||||||
int ModMapIndex = GetPureMapIndex(ModPos);
|
int ModMapIndex = GetPureMapIndex(ModPos);
|
||||||
|
if(d == MR_DIR_HERE && OverrideCenterTileIndex >= 0)
|
||||||
|
{
|
||||||
|
ModMapIndex = OverrideCenterTileIndex;
|
||||||
|
}
|
||||||
for(int Front = 0; Front < 2; Front++)
|
for(int Front = 0; Front < 2; Front++)
|
||||||
{
|
{
|
||||||
int Tile;
|
int Tile;
|
||||||
|
|
|
@ -60,7 +60,7 @@ public:
|
||||||
int GetIndex(vec2 PrevPos, vec2 Pos);
|
int GetIndex(vec2 PrevPos, vec2 Pos);
|
||||||
int GetFIndex(int x, int y);
|
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)
|
int GetMoveRestrictions(vec2 Pos, float Distance = 18.0f)
|
||||||
{
|
{
|
||||||
return GetMoveRestrictions(0, 0, Pos, Distance);
|
return GetMoveRestrictions(0, 0, Pos, Distance);
|
||||||
|
|
|
@ -1364,7 +1364,7 @@ void CCharacter::HandleTiles(int Index)
|
||||||
//int PureMapIndex = GameServer()->Collision()->GetPureMapIndex(m_Pos);
|
//int PureMapIndex = GameServer()->Collision()->GetPureMapIndex(m_Pos);
|
||||||
m_TileIndex = GameServer()->Collision()->GetTileIndex(MapIndex);
|
m_TileIndex = GameServer()->Collision()->GetTileIndex(MapIndex);
|
||||||
m_TileFIndex = GameServer()->Collision()->GetFTileIndex(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
|
//Sensitivity
|
||||||
int S1 = GameServer()->Collision()->GetPureMapIndex(vec2(m_Pos.x + m_ProximityRadius / 3.f, m_Pos.y - m_ProximityRadius / 3.f));
|
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));
|
int S2 = GameServer()->Collision()->GetPureMapIndex(vec2(m_Pos.x + m_ProximityRadius / 3.f, m_Pos.y + m_ProximityRadius / 3.f));
|
||||||
|
|
Loading…
Reference in a new issue