mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 01:58:19 +00:00
Try wall jumps
This commit is contained in:
parent
7430af00eb
commit
d768eb4908
|
@ -131,7 +131,7 @@ void CCollision::Init(class CLayers *pLayers)
|
|||
}
|
||||
|
||||
// DDRace tiles
|
||||
if(Index == TILE_THROUGH || (Index >= TILE_FREEZE && Index <= TILE_UNFREEZE) || (Index >= TILE_SWITCHOPEN && Index <= TILE_TELECHECKIN) || (Index >= TILE_BEGIN && Index <= TILE_STOPA) || Index == TILE_CP || Index == TILE_CP_F || (Index >= TILE_OLDLASER && Index <= TILE_NPH_START) || (Index >= TILE_EHOOK_START && Index <= TILE_SOLO_END) || (Index >= TILE_DFREEZE && Index <= TILE_DUNFREEZE))
|
||||
if(Index == TILE_THROUGH || Index == TILE_WALLJUMP || (Index >= TILE_FREEZE && Index <= TILE_UNFREEZE) || (Index >= TILE_SWITCHOPEN && Index <= TILE_TELECHECKIN) || (Index >= TILE_BEGIN && Index <= TILE_STOPA) || Index == TILE_CP || Index == TILE_CP_F || (Index >= TILE_OLDLASER && Index <= TILE_NPH_START) || (Index >= TILE_EHOOK_START && Index <= TILE_SOLO_END) || (Index >= TILE_DFREEZE && Index <= TILE_DUNFREEZE))
|
||||
m_pFront[i].m_Index = Index;
|
||||
}
|
||||
}
|
||||
|
@ -157,7 +157,7 @@ void CCollision::Init(class CLayers *pLayers)
|
|||
}
|
||||
|
||||
// DDRace tiles
|
||||
if(Index == TILE_THROUGH || (Index >= TILE_FREEZE && Index <= TILE_UNFREEZE) || (Index >= TILE_SWITCHOPEN && Index <= TILE_TELECHECKIN) || (Index >= TILE_BEGIN && Index <= TILE_STOPA) || Index == TILE_CP || Index == TILE_CP_F || (Index >= TILE_OLDLASER && Index <= TILE_NPH_START) || (Index >= TILE_EHOOK_START && Index <= TILE_SOLO_END) || (Index >= TILE_DFREEZE && Index <= TILE_DUNFREEZE))
|
||||
if(Index == TILE_THROUGH || Index == TILE_WALLJUMP || (Index >= TILE_FREEZE && Index <= TILE_UNFREEZE) || (Index >= TILE_SWITCHOPEN && Index <= TILE_TELECHECKIN) || (Index >= TILE_BEGIN && Index <= TILE_STOPA) || Index == TILE_CP || Index == TILE_CP_F || (Index >= TILE_OLDLASER && Index <= TILE_NPH_START) || (Index >= TILE_EHOOK_START && Index <= TILE_SOLO_END) || (Index >= TILE_DFREEZE && Index <= TILE_DUNFREEZE))
|
||||
m_pTiles[i].m_Index = Index;
|
||||
}
|
||||
}
|
||||
|
@ -410,6 +410,8 @@ void CCollision::MoveBox(vec2 *pInoutPos, vec2 *pInoutVel, vec2 Size, float Elas
|
|||
|
||||
vec2 NewPos = Pos + Vel*Fraction; // TODO: this row is not nice
|
||||
|
||||
m_Colliding = 0;
|
||||
|
||||
if(TestBox(vec2(NewPos.x, NewPos.y), Size))
|
||||
{
|
||||
int Hits = 0;
|
||||
|
@ -423,6 +425,10 @@ void CCollision::MoveBox(vec2 *pInoutPos, vec2 *pInoutVel, vec2 Size, float Elas
|
|||
|
||||
if(TestBox(vec2(NewPos.x, Pos.y), Size))
|
||||
{
|
||||
if(NewPos.x > Pos.x)
|
||||
m_Colliding = 1;
|
||||
else if(NewPos.x < Pos.x)
|
||||
m_Colliding = 2;
|
||||
NewPos.x = Pos.x;
|
||||
Vel.x *= -Elasticity;
|
||||
Hits++;
|
||||
|
@ -436,6 +442,10 @@ void CCollision::MoveBox(vec2 *pInoutPos, vec2 *pInoutVel, vec2 Size, float Elas
|
|||
Vel.y *= -Elasticity;
|
||||
NewPos.x = Pos.x;
|
||||
Vel.x *= -Elasticity;
|
||||
if(NewPos.x > Pos.x)
|
||||
m_Colliding = 1;
|
||||
else if(NewPos.x < Pos.x)
|
||||
m_Colliding = 2;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -488,6 +498,14 @@ int CCollision::IsThrough(int x, int y)
|
|||
return 0;
|
||||
}
|
||||
|
||||
int CCollision::IsWallJump(int Index)
|
||||
{
|
||||
if(Index < 0)
|
||||
return 0;
|
||||
|
||||
return m_pTiles[Index].m_Index == TILE_WALLJUMP;
|
||||
}
|
||||
|
||||
int CCollision::IsNoLaser(int x, int y)
|
||||
{
|
||||
return (CCollision::GetTile(x,y) & COLFLAG_NOLASER);
|
||||
|
|
|
@ -92,6 +92,7 @@ public:
|
|||
|
||||
int IsSolid(int x, int y);
|
||||
int IsThrough(int x, int y);
|
||||
int IsWallJump(int Index);
|
||||
int IsNoLaser(int x, int y);
|
||||
int IsFNoLaser(int x, int y);
|
||||
|
||||
|
@ -107,6 +108,7 @@ public:
|
|||
class CTuneTile *TuneLayer() { return m_pTune; }
|
||||
class CLayers *Layers() { return m_pLayers; }
|
||||
int m_NumSwitchers;
|
||||
int m_Colliding;
|
||||
|
||||
private:
|
||||
|
||||
|
|
|
@ -103,7 +103,8 @@ enum
|
|||
TILE_DUNFREEZE,
|
||||
TILE_TELEINWEAPON,
|
||||
TILE_TELEINHOOK,
|
||||
TILE_EHOOK_START = 17,
|
||||
TILE_WALLJUMP = 16,
|
||||
TILE_EHOOK_START,
|
||||
TILE_EHOOK_END,
|
||||
TILE_HIT_START,
|
||||
TILE_HIT_END,
|
||||
|
|
|
@ -1699,6 +1699,14 @@ void CCharacter::HandleTiles(int Index)
|
|||
m_LastPenalty = false;
|
||||
}
|
||||
|
||||
if((m_Jumped & 1) && m_Core.m_Vel.x > 0
|
||||
&& ((GameServer()->Collision()->IsWallJump(MapIndex-1) && GameServer()->Collision()->m_Colliding & 1)
|
||||
|| (GameServer()->Collision()->IsWallJump(MapIndex+1) && GameServer()->Collision()->m_Colliding & 2)))
|
||||
{
|
||||
m_Core.m_JumpedTotal++;
|
||||
m_Core.m_Jumped |= 3;
|
||||
}
|
||||
|
||||
int z = GameServer()->Collision()->IsTeleport(MapIndex);
|
||||
if(!g_Config.m_SvOldTeleportHook && !g_Config.m_SvOldTeleportWeapons && z && Controller->m_TeleOuts[z-1].size())
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue