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:
heinrich5991 2019-10-06 13:51:16 +02:00
parent ef32fc4bed
commit eab0815ddc
3 changed files with 7 additions and 3 deletions

View file

@ -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;

View file

@ -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);

View file

@ -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));