diff --git a/src/game/collision.cpp b/src/game/collision.cpp index cf6ca8e17..2f86ef831 100644 --- a/src/game/collision.cpp +++ b/src/game/collision.cpp @@ -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); diff --git a/src/game/collision.h b/src/game/collision.h index cf4854ecc..e106a0468 100644 --- a/src/game/collision.h +++ b/src/game/collision.h @@ -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: diff --git a/src/game/mapitems.h b/src/game/mapitems.h index 7a10f5f35..8edfe4c29 100644 --- a/src/game/mapitems.h +++ b/src/game/mapitems.h @@ -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, diff --git a/src/game/server/entities/character.cpp b/src/game/server/entities/character.cpp index a76ed6f18..d7699cd06 100644 --- a/src/game/server/entities/character.cpp +++ b/src/game/server/entities/character.cpp @@ -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()) {