Added some tiles

tried to make the others work but i get stuck!

Signed-off-by: GreYFoXGTi <GreYFoXGTi@GMaiL.CoM>
This commit is contained in:
GreYFoXGTi 2010-08-22 00:57:42 +02:00
parent 5c880c88a4
commit 2cdd2d4421
4 changed files with 242 additions and 54 deletions

View file

@ -60,7 +60,7 @@ void CCollision::Init(class CLayers *pLayers)
}
// DDRace tiles
if(Index >= 5 && Index <= 59 || Index>=64 && Index<=191)
if(Index >= 5 && Index <= 59 || Index>=TILE_STOPH && Index<=191)
m_pFront[i].m_Index = Index;
}
}
@ -90,7 +90,7 @@ void CCollision::Init(class CLayers *pLayers)
}
// DDRace tiles
if(Index >= 5 && Index <= 59 || Index>=64 && Index<=191)
if(Index >= 5 && Index <= 59 || Index>=TILE_STOPH && Index<=191)
m_pTiles[i].m_Index = Index;
}
}
@ -610,26 +610,3 @@ vec2 CCollision::CpSpeed(int Index)
return target;
}
vec2 CCollision::BoostAccelerator(int Index)
{
if (Index==TILE_BOOST_L)
return vec2(-3,0);
else if(Index==TILE_BOOST_R)
return vec2(3,0);
else if(Index==TILE_BOOST_D)
return vec2(0,2);
else if(Index==TILE_BOOST_U)
return vec2(0,-2);
else if(Index==TILE_BOOST_L2)
return vec2(-15,0);
else if(Index==TILE_BOOST_R2)
return vec2(15,0);
else if(Index==TILE_BOOST_D2)
return vec2(0,15);
else if(Index==TILE_BOOST_U2)
return vec2(0,-15);
return vec2(0,0);
}

View file

@ -57,7 +57,6 @@ public:
int IsFNoLaser(int x, int y);
int IsCp(int x, int y);
vec2 BoostAccelerator(int Index);
vec2 CpSpeed(int index);
class CTeleTile *m_pTele;

View file

@ -658,16 +658,6 @@ void CCharacter::Tick()
{
UnFreeze();
}
if (((TileIndex1 >= TILE_BOOST_L && TileIndex1 <= TILE_BOOST_U) || (TileIndex1 >= TILE_BOOST_L2 && TileIndex1 <= TILE_BOOST_U2)))
{
int booster = TileIndex1;
m_Core.m_Vel += GameServer()->Collision()->BoostAccelerator(booster);
}
if ((TileIndex2 >= TILE_BOOST_L && TileIndex2 <= TILE_BOOST_U) || (TileIndex2 >= TILE_BOOST_L2 && TileIndex2 <= TILE_BOOST_U2))
{
int booster = TileIndex2;
m_Core.m_Vel += GameServer()->Collision()->BoostAccelerator(booster);
}
if(TileIndex1 == TILE_STOPL)
{
if(m_Core.m_Vel.x > 0)
@ -695,6 +685,15 @@ void CCharacter::Tick()
m_Core.m_Vel.x = 0;
}
}
if(TileIndex2 == TILE_STOPR)
{
if(m_Core.m_Vel.x < 0)
{
if((int)GameServer()->Collision()->GetPos(TileIndex2).x > (int)m_Core.m_Pos.x)
m_Core.m_Pos.x = m_PrevPos.x;
m_Core.m_Vel.x = 0;
}
}
if(TileIndex1 == TILE_STOPB)
{
if(m_Core.m_Vel.y < 0)
@ -704,6 +703,15 @@ void CCharacter::Tick()
m_Core.m_Vel.y = 0;
}
}
if(TileIndex2 == TILE_STOPB)
{
if(m_Core.m_Vel.y < 0)
{
if((int)GameServer()->Collision()->GetPos(TileIndex2).y > (int)m_Core.m_Pos.y)
m_Core.m_Pos.y = m_PrevPos.y;
m_Core.m_Vel.y = 0;
}
}
if(TileIndex1 == TILE_STOPT)
{
if(m_Core.m_Vel.y > 0)
@ -715,24 +723,6 @@ void CCharacter::Tick()
m_Core.m_Vel.y = 0;
}
}
if(TileIndex2 == TILE_STOPR)
{
if(m_Core.m_Vel.x < 0)
{
if((int)GameServer()->Collision()->GetPos(TileIndex2).x > (int)m_Core.m_Pos.x)
m_Core.m_Pos.x = m_PrevPos.x;
m_Core.m_Vel.x = 0;
}
}
if(TileIndex2 == TILE_STOPB)
{
if(m_Core.m_Vel.y < 0)
{
if((int)GameServer()->Collision()->GetPos(TileIndex2).y > (int)m_Core.m_Pos.y)
m_Core.m_Pos.y = m_PrevPos.y;
m_Core.m_Vel.y = 0;
}
}
if(TileIndex2 == TILE_STOPT)
{
if(m_Core.m_Vel.y > 0)
@ -744,6 +734,226 @@ void CCharacter::Tick()
m_Core.m_Vel.y = 0;
}
}
/*if(TileIndex1 == TILE_STOPH)// Itries and failed
{
if(m_Core.m_Vel.x > 0)
{
if((int)GameServer()->Collision()->GetPos(TileIndex1).x < (int)m_Core.m_Pos.x)
m_Core.m_Pos.x = m_PrevPrevPos.x;
m_Core.m_Vel.x = 0;
}
if(m_Core.m_Vel.x < 0)
{
if((int)GameServer()->Collision()->GetPos(TileIndex1).x > (int)m_Core.m_Pos.x)
m_Core.m_Pos.x = m_PrevPrevPos.x;
m_Core.m_Vel.x = 0;
}
}
if(TileIndex2 == TILE_STOPH)
{
if(m_Core.m_Vel.x > 0)
{
if((int)GameServer()->Collision()->GetPos(TileIndex2).x < (int)m_Core.m_Pos.x)
m_Core.m_Pos.x = m_PrevPrevPos.x;
m_Core.m_Vel.x = 0;
}
if(m_Core.m_Vel.x < 0)
{
if((int)GameServer()->Collision()->GetPos(TileIndex2).x > (int)m_Core.m_Pos.x)
m_Core.m_Pos.x = m_PrevPrevPos.x;
m_Core.m_Vel.x = 0;
}
}
if(TileIndex1 == TILE_STOPV)
{
if(m_Core.m_Vel.y < 0)
{
if((int)GameServer()->Collision()->GetPos(TileIndex1).y > (int)m_Core.m_Pos.y)
m_Core.m_Pos.y = m_PrevPrevPos.y;
m_Core.m_Vel.y = 0;
}
if(m_Core.m_Vel.y > 0)
{
if((int)GameServer()->Collision()->GetPos(TileIndex1).y < (int)m_Core.m_Pos.y)
m_Core.m_Pos.y = m_PrevPrevPos.y;
if(m_Jumped&3 && m_Core.m_Jumped != m_Jumped) // check double jump
m_Core.m_Jumped = m_Jumped;
m_Core.m_Vel.y = 0;
}
}
if(TileIndex2 == TILE_STOPV)
{
if(m_Core.m_Vel.y < 0)
{
if((int)GameServer()->Collision()->GetPos(TileIndex2).y > (int)m_Core.m_Pos.y)
m_Core.m_Pos.y = m_PrevPrevPos.y;
m_Core.m_Vel.y = 0;
}
if(m_Core.m_Vel.y > 0)
{
if((int)GameServer()->Collision()->GetPos(TileIndex2).y < (int)m_Core.m_Pos.y)
m_Core.m_Pos.y = m_PrevPrevPos.y;
if(m_Jumped&3 && m_Core.m_Jumped != m_Jumped) // check double jump
m_Core.m_Jumped = m_Jumped;
m_Core.m_Vel.y = 0;
}
}
if(TileIndex1 == TILE_STOPA)
{
if(m_Core.m_Vel.x > 0)
{
if((int)GameServer()->Collision()->GetPos(TileIndex1).x < (int)m_Core.m_Pos.x)
m_Core.m_Pos.x = m_PrevPrevPos.x;
m_Core.m_Vel.x = 0;
}
if(m_Core.m_Vel.x < 0)
{
if((int)GameServer()->Collision()->GetPos(TileIndex1).x > (int)m_Core.m_Pos.x)
m_Core.m_Pos.x = m_PrevPrevPos.x;
m_Core.m_Vel.x = 0;
}
if(m_Core.m_Vel.y < 0)
{
if((int)GameServer()->Collision()->GetPos(TileIndex1).y > (int)m_Core.m_Pos.y)
m_Core.m_Pos.y = m_PrevPrevPos.y;
m_Core.m_Vel.y = 0;
}
if(m_Core.m_Vel.y > 0)
{
if((int)GameServer()->Collision()->GetPos(TileIndex1).y < (int)m_Core.m_Pos.y)
m_Core.m_Pos.y = m_PrevPrevPos.y;
if(m_Jumped&3 && m_Core.m_Jumped != m_Jumped) // check double jump
m_Core.m_Jumped = m_Jumped;
m_Core.m_Vel.y = 0;
}
}
if(TileIndex2 == TILE_STOPA)
{
if(m_Core.m_Vel.x > 0)
{
if((int)GameServer()->Collision()->GetPos(TileIndex2).x < (int)m_Core.m_Pos.x)
m_Core.m_Pos.x = m_PrevPrevPos.x;
m_Core.m_Vel.x = 0;
}
if(m_Core.m_Vel.x < 0)
{
if((int)GameServer()->Collision()->GetPos(TileIndex2).x > (int)m_Core.m_Pos.x)
m_Core.m_Pos.x = m_PrevPrevPos.x;
m_Core.m_Vel.x = 0;
}
if(m_Core.m_Vel.y < 0)
{
if((int)GameServer()->Collision()->GetPos(TileIndex2).y > (int)m_Core.m_Pos.y)
m_Core.m_Pos.y = m_PrevPrevPos.y;
m_Core.m_Vel.y = 0;
}
if(m_Core.m_Vel.y > 0)
{
if((int)GameServer()->Collision()->GetPos(TileIndex2).y < (int)m_Core.m_Pos.y)
m_Core.m_Pos.y = m_PrevPrevPos.y;
if(m_Jumped&3 && m_Core.m_Jumped != m_Jumped) // check double jump
m_Core.m_Jumped = m_Jumped;
m_Core.m_Vel.y = 0;
}
}*/
if (TileIndex1 == TILE_BOOST_L || TileIndex2 == TILE_BOOST_L)
{
if(m_PrevPos.x-m_Pos.x<0)
m_Core.m_Vel.x += m_Core.m_Vel.x *-0.5;
else
m_Core.m_Vel.x += m_Core.m_Vel.x*0.5;
}
if (TileIndex1 == TILE_BOOST_R || TileIndex2 == TILE_BOOST_R)
{
if(m_PrevPos.x-m_Pos.x>0)
m_Core.m_Vel.x += m_Core.m_Vel.x *-0.5;
else
m_Core.m_Vel.x += m_Core.m_Vel.x*0.5;
}
if (TileIndex1 == TILE_BOOST_D || TileIndex2 == TILE_BOOST_D)
{
if(m_PrevPos.y-m_Pos.y>0)
m_Core.m_Vel.y += m_Core.m_Vel.y *-0.5;
else
m_Core.m_Vel.y += m_Core.m_Vel.y*0.5;
}
if (TileIndex1 == TILE_BOOST_U || TileIndex2 == TILE_BOOST_U)
{
if(m_PrevPos.y-m_Pos.y<0)
m_Core.m_Vel.y += m_Core.m_Vel.y *-0.5;
else
m_Core.m_Vel.y += m_Core.m_Vel.y*0.5;
}
if(TileIndex1 == TILE_BOOSTH || TileIndex2 == TILE_BOOSTH)
{
m_Core.m_Vel.x += m_Core.m_Vel.x *-0.5;
}
if(TileIndex1 == TILE_BOOSTV || TileIndex2 == TILE_BOOSTV)
{
m_Core.m_Vel.y += m_Core.m_Vel.y *-0.5;
}
if(TileIndex1 == TILE_BOOSTA || TileIndex2 == TILE_BOOSTA)
{
m_Core.m_Vel.y += m_Core.m_Vel.y *-0.5;
m_Core.m_Vel.x += m_Core.m_Vel.x *-0.5;
}
if (TileIndex1 == TILE_BOOST_L2 || TileIndex2 == TILE_BOOST_L2)
{
if(m_PrevPos.x-m_Pos.x<0)
m_Core.m_Vel.x = m_Core.m_Vel.x *-1.1;
else
m_Core.m_Vel.x += m_Core.m_Vel.x*1.1;
}
if (TileIndex1 == TILE_BOOST_R2|| TileIndex2 == TILE_BOOST_R2)
{
if(m_PrevPos.x-m_Pos.x>0)
m_Core.m_Vel.x = m_Core.m_Vel.x *-1.1;
else
m_Core.m_Vel.x += m_Core.m_Vel.x*1.1;
}
if (TileIndex1 == TILE_BOOST_D2 || TileIndex2 == TILE_BOOST_D2)
{
if(m_PrevPos.y-m_Pos.y>0)
m_Core.m_Vel.y = m_Core.m_Vel.y *-1.1;
else
m_Core.m_Vel.y += m_Core.m_Vel.y*1.1;
}
if (TileIndex1 == TILE_BOOST_U2 || TileIndex2 == TILE_BOOST_U2)
{
if(m_PrevPos.y-m_Pos.y<0)
m_Core.m_Vel.y = m_Core.m_Vel.y *-1.1;
else
m_Core.m_Vel.y += m_Core.m_Vel.y*1.1;
}
if(TileIndex1 == TILE_BOOSTH2 || TileIndex2 == TILE_BOOSTH2)
{
if(m_PrevPos.x-m_Pos.x>0)
m_Core.m_Pos.x = m_PrevPrevPos.x;
else if(m_PrevPos.x-m_Pos.x<0)
m_Core.m_Pos.x = m_PrevPrevPos.x;
m_Core.m_Vel.x = m_Core.m_Vel.x *-1.1;
}
if(TileIndex1 == TILE_BOOSTV2 || TileIndex2 == TILE_BOOSTV2)
{
if(m_PrevPos.y-m_Pos.y>0)
m_Core.m_Pos.y = m_PrevPrevPos.y;
else if(m_PrevPos.y-m_Pos.y<0)
m_Core.m_Pos.y = m_PrevPrevPos.y;
m_Core.m_Vel.y = m_Core.m_Vel.y *-1.1;
}
if(TileIndex1 == TILE_BOOSTA2 || TileIndex2 == TILE_BOOSTA2)
{
if(m_PrevPos.y-m_Pos.y>0)
m_Core.m_Pos.y = m_PrevPrevPos.y;
else if(m_PrevPos.y-m_Pos.y<0)
m_Core.m_Pos.y = m_PrevPos.y;
if(m_PrevPos.x-m_Pos.x>0)
m_Core.m_Pos.x = m_PrevPrevPos.x;
else if(m_PrevPos.x-m_Pos.x<0)
m_Core.m_Pos.x = m_PrevPrevPos.x;
m_Core.m_Vel.y = m_Core.m_Vel.y *-1.1;
m_Core.m_Vel.x = m_Core.m_Vel.x *-1.1;
}
if(GameServer()->Collision()->IsSpeedup((int)m_Core.m_Pos.x, (int)m_Core.m_Pos.y))
{
vec2 Direction;
@ -795,6 +1005,7 @@ void CCharacter::Tick()
m_OlderPos = m_OldPos;
m_OldPos = m_Core.m_Pos;
}
m_PrevPrevPos = m_PrevPos;
m_PrevPos = m_Core.m_Pos;
return;
}

View file

@ -163,6 +163,7 @@ public:
int m_LastSpeedup;
vec2 m_PrevPos;
vec2 m_PrevPrevPos;
// checkpoints
int m_CpTick;