mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-14 03:58:18 +00:00
Merge
This commit is contained in:
commit
b0d8bfca03
Binary file not shown.
Before Width: | Height: | Size: 272 KiB After Width: | Height: | Size: 282 KiB |
Binary file not shown.
Before Width: | Height: | Size: 276 KiB After Width: | Height: | Size: 282 KiB |
Binary file not shown.
|
@ -40,7 +40,7 @@ void CCollision::Init(class CLayers *pLayers)
|
||||||
for(int i = 0; i < m_Width*m_Height; i++)
|
for(int i = 0; i < m_Width*m_Height; i++)
|
||||||
{
|
{
|
||||||
int Index = m_pFront[i].m_Index;
|
int Index = m_pFront[i].m_Index;
|
||||||
if(Index > 191)
|
if(Index > TILE_NPH)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
switch(Index)
|
switch(Index)
|
||||||
|
@ -49,10 +49,10 @@ void CCollision::Init(class CLayers *pLayers)
|
||||||
m_pFront[i].m_Index = COLFLAG_DEATH;
|
m_pFront[i].m_Index = COLFLAG_DEATH;
|
||||||
break;
|
break;
|
||||||
case TILE_SOLID:
|
case TILE_SOLID:
|
||||||
m_pFront[i].m_Index = COLFLAG_SOLID;
|
m_pFront[i].m_Index = 0;
|
||||||
break;
|
break;
|
||||||
case TILE_NOHOOK:
|
case TILE_NOHOOK:
|
||||||
m_pFront[i].m_Index = COLFLAG_SOLID|COLFLAG_NOHOOK;
|
m_pFront[i].m_Index = 0;
|
||||||
break;
|
break;
|
||||||
case TILE_NOLASER:
|
case TILE_NOLASER:
|
||||||
m_pFront[i].m_Index = COLFLAG_NOLASER;
|
m_pFront[i].m_Index = COLFLAG_NOLASER;
|
||||||
|
@ -62,7 +62,7 @@ void CCollision::Init(class CLayers *pLayers)
|
||||||
}
|
}
|
||||||
|
|
||||||
// DDRace tiles
|
// DDRace tiles
|
||||||
if(Index >= 5 && Index<=191)
|
if(Index >= 6 && Index<=TILE_NPH)
|
||||||
m_pFront[i].m_Index = Index;
|
m_pFront[i].m_Index = Index;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -70,7 +70,7 @@ void CCollision::Init(class CLayers *pLayers)
|
||||||
for(int i = 0; i < m_Width*m_Height; i++)
|
for(int i = 0; i < m_Width*m_Height; i++)
|
||||||
{
|
{
|
||||||
int Index = m_pTiles[i].m_Index;
|
int Index = m_pTiles[i].m_Index;
|
||||||
if(Index > 191)
|
if(Index > TILE_NPH)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
switch(Index)
|
switch(Index)
|
||||||
|
@ -92,7 +92,7 @@ void CCollision::Init(class CLayers *pLayers)
|
||||||
}
|
}
|
||||||
|
|
||||||
// DDRace tiles
|
// DDRace tiles
|
||||||
if(Index >= 5 && Index<=191)
|
if(Index >= 6 && Index<=TILE_NPH)
|
||||||
m_pTiles[i].m_Index = Index;
|
m_pTiles[i].m_Index = Index;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -191,9 +191,7 @@ int CCollision::GetFTile(int x, int y)
|
||||||
int nx = clamp(x/32, 0, m_Width-1);
|
int nx = clamp(x/32, 0, m_Width-1);
|
||||||
int ny = clamp(y/32, 0, m_Height-1);
|
int ny = clamp(y/32, 0, m_Height-1);
|
||||||
/*dbg_msg("GetFTile","m_Index %d",m_pFront[ny*m_Width+nx].m_Index);//Remove */
|
/*dbg_msg("GetFTile","m_Index %d",m_pFront[ny*m_Width+nx].m_Index);//Remove */
|
||||||
if(m_pFront[ny*m_Width+nx].m_Index == COLFLAG_SOLID
|
if(m_pFront[ny*m_Width+nx].m_Index == COLFLAG_DEATH
|
||||||
|| m_pFront[ny*m_Width+nx].m_Index == (COLFLAG_SOLID|COLFLAG_NOHOOK)
|
|
||||||
|| m_pFront[ny*m_Width+nx].m_Index == COLFLAG_DEATH
|
|
||||||
|| m_pFront[ny*m_Width+nx].m_Index == COLFLAG_NOLASER)
|
|| m_pFront[ny*m_Width+nx].m_Index == COLFLAG_NOLASER)
|
||||||
return m_pFront[ny*m_Width+nx].m_Index;
|
return m_pFront[ny*m_Width+nx].m_Index;
|
||||||
else
|
else
|
||||||
|
@ -265,14 +263,13 @@ int CCollision::IntersectLine(vec2 Pos0, vec2 Pos1, vec2 *pOutCollision, vec2 *p
|
||||||
vec2 Pos = mix(Pos0, Pos1, a);
|
vec2 Pos = mix(Pos0, Pos1, a);
|
||||||
ix = round(Pos.x);
|
ix = round(Pos.x);
|
||||||
iy = round(Pos.y);
|
iy = round(Pos.y);
|
||||||
if((CheckPoint(ix, iy) || FCheckPoint(ix, iy)) && !(AllowThrough && IsThrough(ix + dx, iy + dy)))
|
if(CheckPoint(ix, iy) && !(AllowThrough && IsThrough(ix + dx, iy + dy)))
|
||||||
{
|
{
|
||||||
if(pOutCollision)
|
if(pOutCollision)
|
||||||
*pOutCollision = Pos;
|
*pOutCollision = Pos;
|
||||||
if(pOutBeforeCollision)
|
if(pOutBeforeCollision)
|
||||||
*pOutBeforeCollision = Last;
|
*pOutBeforeCollision = Last;
|
||||||
if (CheckPoint(ix, iy)) return GetCollisionAt(ix, iy);
|
return GetCollisionAt(ix, iy);
|
||||||
else return GetFCollisionAt(ix, iy);
|
|
||||||
}
|
}
|
||||||
Last = Pos;
|
Last = Pos;
|
||||||
}
|
}
|
||||||
|
@ -292,14 +289,14 @@ int CCollision::IntersectNoLaser(vec2 Pos0, vec2 Pos1, vec2 *pOutCollision, vec2
|
||||||
{
|
{
|
||||||
float a = f/d;
|
float a = f/d;
|
||||||
vec2 Pos = mix(Pos0, Pos1, a);
|
vec2 Pos = mix(Pos0, Pos1, a);
|
||||||
if(IsSolid(round(Pos.x), round(Pos.y)) || IsFSolid(round(Pos.x), round(Pos.y)) || (IsNoLaser(round(Pos.x), round(Pos.y)) || IsFNoLaser(round(Pos.x), round(Pos.y))))
|
if(IsSolid(round(Pos.x), round(Pos.y)) || (IsNoLaser(round(Pos.x), round(Pos.y)) || IsFNoLaser(round(Pos.x), round(Pos.y))))
|
||||||
{
|
{
|
||||||
if(pOutCollision)
|
if(pOutCollision)
|
||||||
*pOutCollision = Pos;
|
*pOutCollision = Pos;
|
||||||
if(pOutBeforeCollision)
|
if(pOutBeforeCollision)
|
||||||
*pOutBeforeCollision = Last;
|
*pOutBeforeCollision = Last;
|
||||||
if (IsSolid(round(Pos.x), round(Pos.y)) || IsNoLaser(round(Pos.x), round(Pos.y))) return GetCollisionAt(Pos.x, Pos.y);
|
if (IsFNoLaser(round(Pos.x), round(Pos.y))) return GetFCollisionAt(Pos.x, Pos.y);
|
||||||
else return GetFCollisionAt(Pos.x, Pos.y);
|
else return GetCollisionAt(Pos.x, Pos.y);
|
||||||
|
|
||||||
}
|
}
|
||||||
Last = Pos;
|
Last = Pos;
|
||||||
|
@ -376,10 +373,10 @@ void CCollision::MovePoint(vec2 *pInoutPos, vec2 *pInoutVel, float Elasticity, i
|
||||||
|
|
||||||
vec2 Pos = *pInoutPos;
|
vec2 Pos = *pInoutPos;
|
||||||
vec2 Vel = *pInoutVel;
|
vec2 Vel = *pInoutVel;
|
||||||
if(CheckPoint(Pos + Vel) || FCheckPoint(Pos + Vel))
|
if(CheckPoint(Pos + Vel))
|
||||||
{
|
{
|
||||||
int Affected = 0;
|
int Affected = 0;
|
||||||
if(CheckPoint(Pos.x + Vel.x, Pos.y) || FCheckPoint(Pos.x + Vel.x, Pos.y))
|
if(CheckPoint(Pos.x + Vel.x, Pos.y))
|
||||||
{
|
{
|
||||||
pInoutVel->x *= -Elasticity;
|
pInoutVel->x *= -Elasticity;
|
||||||
if(pBounces)
|
if(pBounces)
|
||||||
|
@ -387,7 +384,7 @@ void CCollision::MovePoint(vec2 *pInoutPos, vec2 *pInoutVel, float Elasticity, i
|
||||||
Affected++;
|
Affected++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(CheckPoint(Pos.x, Pos.y + Vel.y) || FCheckPoint(Pos.x, Pos.y + Vel.y))
|
if(CheckPoint(Pos.x, Pos.y + Vel.y))
|
||||||
{
|
{
|
||||||
pInoutVel->y *= -Elasticity;
|
pInoutVel->y *= -Elasticity;
|
||||||
if(pBounces)
|
if(pBounces)
|
||||||
|
@ -468,13 +465,13 @@ void CCollision::MoveBox(vec2 *pInoutPos, vec2 *pInoutVel, vec2 Size, float Elas
|
||||||
bool CCollision::TestBox(vec2 Pos, vec2 Size)
|
bool CCollision::TestBox(vec2 Pos, vec2 Size)
|
||||||
{
|
{
|
||||||
Size *= 0.5f;
|
Size *= 0.5f;
|
||||||
if(CheckPoint(Pos.x-Size.x, Pos.y-Size.y) || FCheckPoint(Pos.x-Size.x, Pos.y-Size.y))
|
if(CheckPoint(Pos.x-Size.x, Pos.y-Size.y))
|
||||||
return true;
|
return true;
|
||||||
if(CheckPoint(Pos.x+Size.x, Pos.y-Size.y) || FCheckPoint(Pos.x+Size.x, Pos.y-Size.y))
|
if(CheckPoint(Pos.x+Size.x, Pos.y-Size.y))
|
||||||
return true;
|
return true;
|
||||||
if(CheckPoint(Pos.x-Size.x, Pos.y+Size.y) || FCheckPoint(Pos.x-Size.x, Pos.y+Size.y))
|
if(CheckPoint(Pos.x-Size.x, Pos.y+Size.y))
|
||||||
return true;
|
return true;
|
||||||
if(CheckPoint(Pos.x+Size.x, Pos.y+Size.y) || FCheckPoint(Pos.x+Size.x, Pos.y+Size.y))
|
if(CheckPoint(Pos.x+Size.x, Pos.y+Size.y))
|
||||||
return true;
|
return true;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -484,11 +481,6 @@ int CCollision::IsSolid(int x, int y)
|
||||||
return (GetTile(x,y)&COLFLAG_SOLID);
|
return (GetTile(x,y)&COLFLAG_SOLID);
|
||||||
}
|
}
|
||||||
|
|
||||||
int CCollision::IsFSolid(int x, int y)
|
|
||||||
{
|
|
||||||
return (GetFTile(x,y)&COLFLAG_SOLID);
|
|
||||||
}
|
|
||||||
|
|
||||||
int CCollision::IsThrough(int x, int y)
|
int CCollision::IsThrough(int x, int y)
|
||||||
{
|
{
|
||||||
int nx = clamp(x/32, 0, m_Width-1);
|
int nx = clamp(x/32, 0, m_Width-1);
|
||||||
|
|
|
@ -27,8 +27,6 @@ public:
|
||||||
void Init(class CLayers *pLayers);
|
void Init(class CLayers *pLayers);
|
||||||
bool CheckPoint(float x, float y) { return IsSolid(round(x), round(y)); }
|
bool CheckPoint(float x, float y) { return IsSolid(round(x), round(y)); }
|
||||||
bool CheckPoint(vec2 p) { return CheckPoint(p.x, p.y); }
|
bool CheckPoint(vec2 p) { return CheckPoint(p.x, p.y); }
|
||||||
bool FCheckPoint(float x, float y) { return IsFSolid(round(x), round(y)); }
|
|
||||||
bool FCheckPoint(vec2 p) { return FCheckPoint(p.x, p.y); }
|
|
||||||
void SetCollisionAt(float x, float y, int flag);
|
void SetCollisionAt(float x, float y, int flag);
|
||||||
int GetCollisionAt(float x, float y) { return GetTile(round(x), round(y)); }
|
int GetCollisionAt(float x, float y) { return GetTile(round(x), round(y)); }
|
||||||
int GetFCollisionAt(float x, float y) { return GetFTile(round(x), round(y)); }
|
int GetFCollisionAt(float x, float y) { return GetFTile(round(x), round(y)); }
|
||||||
|
@ -55,7 +53,6 @@ public:
|
||||||
void GetSpeedup(int x, int y, vec2 *Dir, int *Force);
|
void GetSpeedup(int x, int y, vec2 *Dir, int *Force);
|
||||||
|
|
||||||
int IsSolid(int x, int y);
|
int IsSolid(int x, int y);
|
||||||
int IsFSolid(int x, int y);
|
|
||||||
int IsThrough(int x, int y);
|
int IsThrough(int x, int y);
|
||||||
int IsNoLaser(int x, int y);
|
int IsNoLaser(int x, int y);
|
||||||
int IsFNoLaser(int x, int y);
|
int IsFNoLaser(int x, int y);
|
||||||
|
|
|
@ -712,7 +712,7 @@ void CLayerFront::BrushDraw(CLayer *pBrush, float wx, float wy)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// dont allow tele in and out tiles... same with speedup tile in front
|
// dont allow tele in and out tiles... same with speedup tile in front
|
||||||
if(m_pEditor->GetSelectedLayer(0) == m_pEditor->m_Map.m_pFrontLayer && (l->m_pTiles[y*l->m_Width+x].m_Index == TILE_TELEIN || l->m_pTiles[y*l->m_Width+x].m_Index == TILE_TELEOUT || l->m_pTiles[y*l->m_Width+x].m_Index == TILE_BOOST || l->m_pTiles[y*l->m_Width+x].m_Index == (ENTITY_TRIGGER + ENTITY_OFFSET)|| l->m_pTiles[y*l->m_Width+x].m_Index == (ENTITY_DOOR + ENTITY_OFFSET)))
|
if(m_pEditor->GetSelectedLayer(0) == m_pEditor->m_Map.m_pFrontLayer && (l->m_pTiles[y*l->m_Width+x].m_Index == TILE_TELEIN || l->m_pTiles[y*l->m_Width+x].m_Index == TILE_TELEOUT || l->m_pTiles[y*l->m_Width+x].m_Index == TILE_BOOST || l->m_pTiles[y*l->m_Width+x].m_Index == (ENTITY_TRIGGER + ENTITY_OFFSET) || l->m_pTiles[y*l->m_Width+x].m_Index == (ENTITY_DOOR + ENTITY_OFFSET)) || l->m_pTiles[y*l->m_Width+x].m_Index == (TILE_SOLID) || l->m_pTiles[y*l->m_Width+x].m_Index == (TILE_NOHOOK))
|
||||||
continue;
|
continue;
|
||||||
m_pTiles[fy*m_Width+fx] = l->m_pTiles[y*l->m_Width+x];
|
m_pTiles[fy*m_Width+fx] = l->m_pTiles[y*l->m_Width+x];
|
||||||
}
|
}
|
||||||
|
|
|
@ -81,9 +81,9 @@ void CCharacterCore::Tick(bool UseInput)
|
||||||
|
|
||||||
// get ground state
|
// get ground state
|
||||||
bool Grounded = false;
|
bool Grounded = false;
|
||||||
if(m_pCollision->CheckPoint(m_Pos.x+PhysSize/2, m_Pos.y+PhysSize/2+5) || m_pCollision->FCheckPoint(m_Pos.x+PhysSize/2, m_Pos.y+PhysSize/2+5))
|
if(m_pCollision->CheckPoint(m_Pos.x+PhysSize/2, m_Pos.y+PhysSize/2+5))
|
||||||
Grounded = true;
|
Grounded = true;
|
||||||
if(m_pCollision->CheckPoint(m_Pos.x-PhysSize/2, m_Pos.y+PhysSize/2+5) || m_pCollision->FCheckPoint(m_Pos.x-PhysSize/2, m_Pos.y+PhysSize/2+5))
|
if(m_pCollision->CheckPoint(m_Pos.x-PhysSize/2, m_Pos.y+PhysSize/2+5))
|
||||||
Grounded = true;
|
Grounded = true;
|
||||||
|
|
||||||
vec2 TargetDirection = normalize(vec2(m_Input.m_TargetX, m_Input.m_TargetY));
|
vec2 TargetDirection = normalize(vec2(m_Input.m_TargetX, m_Input.m_TargetY));
|
||||||
|
|
|
@ -128,7 +128,7 @@ enum
|
||||||
TILE_NPC,
|
TILE_NPC,
|
||||||
TILE_EHOOK,
|
TILE_EHOOK,
|
||||||
TILE_NOHIT,
|
TILE_NOHIT,
|
||||||
TILE_NPH,
|
TILE_NPH,//Remeber to change this in collision.cpp if you add anymore tiles
|
||||||
//End of higher tiles
|
//End of higher tiles
|
||||||
//Untouchable Elements
|
//Untouchable Elements
|
||||||
TILEFLAG_VFLIP=1,
|
TILEFLAG_VFLIP=1,
|
||||||
|
|
|
@ -113,9 +113,9 @@ void CCharacter::SetWeapon(int W)
|
||||||
|
|
||||||
bool CCharacter::IsGrounded()
|
bool CCharacter::IsGrounded()
|
||||||
{
|
{
|
||||||
if(GameServer()->Collision()->CheckPoint(m_Pos.x+m_ProximityRadius/2, m_Pos.y+m_ProximityRadius/2+5) || GameServer()->Collision()->FCheckPoint(m_Pos.x+m_ProximityRadius/2, m_Pos.y+m_ProximityRadius/2+5))
|
if(GameServer()->Collision()->CheckPoint(m_Pos.x+m_ProximityRadius/2, m_Pos.y+m_ProximityRadius/2+5))
|
||||||
return true;
|
return true;
|
||||||
if(GameServer()->Collision()->CheckPoint(m_Pos.x-m_ProximityRadius/2, m_Pos.y+m_ProximityRadius/2+5) || GameServer()->Collision()->FCheckPoint(m_Pos.x-m_ProximityRadius/2, m_Pos.y+m_ProximityRadius/2+5))
|
if(GameServer()->Collision()->CheckPoint(m_Pos.x-m_ProximityRadius/2, m_Pos.y+m_ProximityRadius/2+5))
|
||||||
return true;
|
return true;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -336,16 +336,20 @@ void CCharacter::FireWeapon()
|
||||||
|
|
||||||
case WEAPON_GUN:
|
case WEAPON_GUN:
|
||||||
{
|
{
|
||||||
CProjectile *Proj = new CProjectile(GameWorld(), WEAPON_GUN,
|
CProjectile *Proj = new CProjectile
|
||||||
m_pPlayer->GetCID(),
|
(
|
||||||
ProjStartPos,
|
GameWorld(),
|
||||||
Direction,
|
WEAPON_GUN,//Type
|
||||||
(int)(Server()->TickSpeed()*GameServer()->Tuning()->m_GunLifetime),
|
m_pPlayer->GetCID(),//Owner
|
||||||
0,
|
ProjStartPos,//Pos
|
||||||
0,
|
Direction,//Dir
|
||||||
0,
|
(int)(Server()->TickSpeed()*GameServer()->Tuning()->m_GunLifetime),//Span
|
||||||
-1,
|
0,//Freeze
|
||||||
WEAPON_GUN);
|
0,//Explosive
|
||||||
|
0,//Force
|
||||||
|
-1,//SoundImpact
|
||||||
|
WEAPON_GUN//Weapon
|
||||||
|
);
|
||||||
|
|
||||||
// pack the Projectile and send it to the client Directly
|
// pack the Projectile and send it to the client Directly
|
||||||
CNetObj_Projectile p;
|
CNetObj_Projectile p;
|
||||||
|
@ -399,15 +403,20 @@ void CCharacter::FireWeapon()
|
||||||
|
|
||||||
case WEAPON_GRENADE:
|
case WEAPON_GRENADE:
|
||||||
{
|
{
|
||||||
CProjectile *Proj = new CProjectile(GameWorld(), WEAPON_GRENADE,
|
CProjectile *Proj = new CProjectile
|
||||||
m_pPlayer->GetCID(),
|
(
|
||||||
ProjStartPos,
|
GameWorld(),
|
||||||
Direction,
|
WEAPON_GRENADE,//Type
|
||||||
(int)(Server()->TickSpeed()*GameServer()->Tuning()->m_GrenadeLifetime),
|
m_pPlayer->GetCID(),//Owner
|
||||||
0,
|
ProjStartPos,//Pos
|
||||||
true,
|
Direction,//Dir
|
||||||
0,
|
(int)(Server()->TickSpeed()*GameServer()->Tuning()->m_GrenadeLifetime),//Span
|
||||||
SOUND_GRENADE_EXPLODE, WEAPON_GRENADE);
|
0,//Freeze
|
||||||
|
true,//Explosive
|
||||||
|
0,//Force
|
||||||
|
SOUND_GRENADE_EXPLODE,//SoundImpact
|
||||||
|
WEAPON_GRENADE//Weapon
|
||||||
|
);//SoundImpact
|
||||||
|
|
||||||
// pack the Projectile and send it to the client Directly
|
// pack the Projectile and send it to the client Directly
|
||||||
CNetObj_Projectile p;
|
CNetObj_Projectile p;
|
||||||
|
@ -635,8 +644,22 @@ void CCharacter::Tick()
|
||||||
{
|
{
|
||||||
CGameControllerDDRace* Controller = (CGameControllerDDRace*)GameServer()->m_pController;
|
CGameControllerDDRace* Controller = (CGameControllerDDRace*)GameServer()->m_pController;
|
||||||
int MapIndex = GameServer()->Collision()->GetMapIndex(m_PrevPos, m_Pos);
|
int MapIndex = GameServer()->Collision()->GetMapIndex(m_PrevPos, m_Pos);
|
||||||
int TileIndex1 = GameServer()->Collision()->GetCollisionDDRace(MapIndex);
|
int TileIndex = GameServer()->Collision()->GetCollisionDDRace(MapIndex);
|
||||||
int TileIndex2 = GameServer()->Collision()->GetFCollisionDDRace(MapIndex);
|
int TileFIndex = GameServer()->Collision()->GetFCollisionDDRace(MapIndex);
|
||||||
|
int MapIndexL = GameServer()->Collision()->GetMapIndex(m_PrevPos, vec2(m_Pos.x + m_ProximityRadius/2,m_Pos.y));
|
||||||
|
int MapIndexR = GameServer()->Collision()->GetMapIndex(m_PrevPos, vec2(m_Pos.x - m_ProximityRadius/2,m_Pos.y));
|
||||||
|
int MapIndexT = GameServer()->Collision()->GetMapIndex(m_PrevPos, vec2(m_Pos.x,m_Pos.y + m_ProximityRadius/2+5));
|
||||||
|
int MapIndexB = GameServer()->Collision()->GetMapIndex(m_PrevPos, vec2(m_Pos.x,m_Pos.y - m_ProximityRadius/2-5));
|
||||||
|
int TileIndexL = GameServer()->Collision()->GetCollisionDDRace(MapIndexL);
|
||||||
|
int TileFIndexL = GameServer()->Collision()->GetFCollisionDDRace(MapIndexL);
|
||||||
|
int TileIndexR = GameServer()->Collision()->GetCollisionDDRace(MapIndexR);
|
||||||
|
int TileFIndexR = GameServer()->Collision()->GetFCollisionDDRace(MapIndexR);
|
||||||
|
int TileIndexT = GameServer()->Collision()->GetCollisionDDRace(MapIndexT);
|
||||||
|
int TileFIndexT = GameServer()->Collision()->GetFCollisionDDRace(MapIndexT);
|
||||||
|
int TileIndexB = GameServer()->Collision()->GetCollisionDDRace(MapIndexB);
|
||||||
|
int TileFIndexB = GameServer()->Collision()->GetFCollisionDDRace(MapIndexB);
|
||||||
|
m_CurrentTile = TileIndex;
|
||||||
|
m_CurrentFTile = TileFIndex;
|
||||||
|
|
||||||
if(m_pPlayer->m_ForceBalanced)
|
if(m_pPlayer->m_ForceBalanced)
|
||||||
{
|
{
|
||||||
|
@ -679,7 +702,7 @@ void CCharacter::Tick()
|
||||||
m_Core.m_Jumped = 1;
|
m_Core.m_Jumped = 1;
|
||||||
if (m_Super && g_Config.m_SvEndlessSuperHook)
|
if (m_Super && g_Config.m_SvEndlessSuperHook)
|
||||||
m_Core.m_HookTick = 0;
|
m_Core.m_HookTick = 0;
|
||||||
/*dbg_msg("character","TileIndex1=%d , TileIndex2=%d",TileIndex1,TileIndex2); //REMOVE*/
|
/*dbg_msg("character","TileIndex=%d , TileFIndex=%d",TileIndex,TileFIndex); //REMOVE*/
|
||||||
//DDRace
|
//DDRace
|
||||||
char aBuftime[128];
|
char aBuftime[128];
|
||||||
float time = (float)(Server()->Tick() - m_StartTime) / ((float)Server()->TickSpeed());
|
float time = (float)(Server()->Tick() - m_StartTime) / ((float)Server()->TickSpeed());
|
||||||
|
@ -754,156 +777,157 @@ void CCharacter::Tick()
|
||||||
m_CpCurrent[cp] = time;
|
m_CpCurrent[cp] = time;
|
||||||
m_CpTick = Server()->Tick() + Server()->TickSpeed()*2;
|
m_CpTick = Server()->Tick() + Server()->TickSpeed()*2;
|
||||||
}
|
}
|
||||||
if(((TileIndex1 == TILE_BEGIN) || (TileIndex2 == TILE_BEGIN)) && m_RaceState == RACE_NONE)
|
if(((TileIndex == TILE_BEGIN) || (TileFIndex == TILE_BEGIN)) && (m_RaceState == RACE_NONE))
|
||||||
{
|
{
|
||||||
Controller->m_Teams.OnCharacterStart(m_pPlayer->GetCID());
|
Controller->m_Teams.OnCharacterStart(m_pPlayer->GetCID());
|
||||||
}
|
}
|
||||||
|
|
||||||
if(((TileIndex1 == TILE_END) || (TileIndex2 == TILE_END)) && m_RaceState == RACE_STARTED)
|
if(((TileIndex == TILE_END) || (TileFIndex == TILE_END)) && m_RaceState == RACE_STARTED)
|
||||||
{
|
{
|
||||||
Controller->m_Teams.OnCharacterFinish(m_pPlayer->GetCID());
|
Controller->m_Teams.OnCharacterFinish(m_pPlayer->GetCID());
|
||||||
}
|
}
|
||||||
if(((TileIndex1 == TILE_FREEZE) || (TileIndex2 == TILE_FREEZE)) && !m_Super)
|
if(((TileIndex == TILE_FREEZE) || (TileFIndex == TILE_FREEZE)) && !m_Super)
|
||||||
{
|
{
|
||||||
Freeze(Server()->TickSpeed()*3);
|
Freeze(Server()->TickSpeed()*3);
|
||||||
}
|
}
|
||||||
else if((TileIndex1 == TILE_UNFREEZE) || (TileIndex2 == TILE_UNFREEZE))
|
else if((TileIndex == TILE_UNFREEZE) || (TileFIndex == TILE_UNFREEZE))
|
||||||
{
|
{
|
||||||
UnFreeze();
|
UnFreeze();
|
||||||
}
|
}
|
||||||
if(TileIndex1 == TILE_STOPL)
|
|
||||||
|
if(TileIndex == TILE_STOPL || TileIndexL == TILE_STOPL)
|
||||||
{
|
{
|
||||||
if(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)
|
if((int)GameServer()->Collision()->GetPos(TileIndex).x < (int)m_Core.m_Pos.x)
|
||||||
m_Core.m_Pos.x = m_PrevPos.x;
|
m_Core.m_Pos.x = m_PrevPos.x;
|
||||||
m_Core.m_Vel.x = 0;
|
m_Core.m_Vel.x = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(TileIndex2 == TILE_STOPL)
|
if(TileFIndex == TILE_STOPL || TileFIndexL == TILE_STOPL)
|
||||||
{
|
{
|
||||||
if(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)
|
if((int)GameServer()->Collision()->GetPos(TileFIndex).x < (int)m_Core.m_Pos.x)
|
||||||
m_Core.m_Pos.x = m_PrevPos.x;
|
m_Core.m_Pos.x = m_PrevPos.x;
|
||||||
m_Core.m_Vel.x = 0;
|
m_Core.m_Vel.x = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(TileIndex1 == TILE_STOPR)
|
if(TileIndex == TILE_STOPR || TileIndexR == TILE_STOPR)
|
||||||
{
|
{
|
||||||
if(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)
|
if((int)GameServer()->Collision()->GetPos(TileIndex).x > (int)m_Core.m_Pos.x)
|
||||||
m_Core.m_Pos.x = m_PrevPos.x;
|
m_Core.m_Pos.x = m_PrevPos.x;
|
||||||
m_Core.m_Vel.x = 0;
|
m_Core.m_Vel.x = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(TileIndex2 == TILE_STOPR)
|
if(TileFIndex == TILE_STOPR || TileFIndexR == TILE_STOPR)
|
||||||
{
|
{
|
||||||
if(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)
|
if((int)GameServer()->Collision()->GetPos(TileFIndex).x > (int)m_Core.m_Pos.x)
|
||||||
m_Core.m_Pos.x = m_PrevPos.x;
|
m_Core.m_Pos.x = m_PrevPos.x;
|
||||||
m_Core.m_Vel.x = 0;
|
m_Core.m_Vel.x = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(TileIndex1 == TILE_STOPB)
|
if(TileIndex == TILE_STOPB || TileIndexB == TILE_STOPB)
|
||||||
{
|
{
|
||||||
if(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)
|
if((int)GameServer()->Collision()->GetPos(TileIndex).y > (int)m_Core.m_Pos.y)
|
||||||
m_Core.m_Pos.y = m_PrevPos.y;
|
m_Core.m_Pos.y = m_PrevPos.y;
|
||||||
m_Core.m_Vel.y = 0;
|
m_Core.m_Vel.y = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(TileIndex2 == TILE_STOPB)
|
if(TileFIndex == TILE_STOPB || TileFIndexB == TILE_STOPB)
|
||||||
{
|
{
|
||||||
if(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)
|
if((int)GameServer()->Collision()->GetPos(TileFIndex).y > (int)m_Core.m_Pos.y)
|
||||||
m_Core.m_Pos.y = m_PrevPos.y;
|
m_Core.m_Pos.y = m_PrevPos.y;
|
||||||
m_Core.m_Vel.y = 0;
|
m_Core.m_Vel.y = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(TileIndex1 == TILE_STOPT)
|
if(TileIndex == TILE_STOPT || TileIndexT == TILE_STOPT)
|
||||||
{
|
{
|
||||||
if(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)
|
if((int)GameServer()->Collision()->GetPos(TileIndex).y < (int)m_Core.m_Pos.y)
|
||||||
m_Core.m_Pos.y = m_PrevPos.y;
|
m_Core.m_Pos.y = m_PrevPos.y;
|
||||||
m_Core.m_Jumped = 0;
|
m_Core.m_Jumped = 0;
|
||||||
//m_Jumped = 1;
|
//m_Jumped = 1;
|
||||||
m_Core.m_Vel.y = 0;
|
m_Core.m_Vel.y = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(TileIndex2 == TILE_STOPT)
|
if(TileFIndex == TILE_STOPT || TileFIndexT == TILE_STOPT)
|
||||||
{
|
{
|
||||||
if(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)
|
if((int)GameServer()->Collision()->GetPos(TileFIndex).y < (int)m_Core.m_Pos.y)
|
||||||
m_Core.m_Pos.y = m_PrevPos.y;
|
m_Core.m_Pos.y = m_PrevPos.y;
|
||||||
m_Core.m_Jumped = 0;
|
m_Core.m_Jumped = 0;
|
||||||
m_Core.m_Vel.y = 0;
|
m_Core.m_Vel.y = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (TileIndex1 == TILE_BOOST_L || TileIndex2 == TILE_BOOST_L)
|
if (TileIndex == TILE_BOOST_L || TileFIndex == TILE_BOOST_L)
|
||||||
{
|
{
|
||||||
if(m_PrevPos.x-m_Pos.x<0)
|
if(m_PrevPos.x-m_Pos.x<0)
|
||||||
m_Core.m_Vel.x += m_Core.m_Vel.x *-0.5;
|
m_Core.m_Vel.x += m_Core.m_Vel.x *-0.5;
|
||||||
else if(m_LastBooster != TileIndex1 || m_LastFBooster != TileIndex2)
|
else if(m_LastBooster != TileIndex || m_LastFBooster != TileFIndex)
|
||||||
m_Core.m_Vel.x += m_Core.m_Vel.x*0.5;
|
m_Core.m_Vel.x += m_Core.m_Vel.x*0.5;
|
||||||
}
|
}
|
||||||
if (TileIndex1 == TILE_BOOST_R || TileIndex2 == TILE_BOOST_R)
|
if (TileIndex == TILE_BOOST_R || TileFIndex == TILE_BOOST_R)
|
||||||
{
|
{
|
||||||
if(m_PrevPos.x-m_Pos.x>0)
|
if(m_PrevPos.x-m_Pos.x>0)
|
||||||
m_Core.m_Vel.x += m_Core.m_Vel.x *-0.5;
|
m_Core.m_Vel.x += m_Core.m_Vel.x *-0.5;
|
||||||
else if(m_LastBooster != TileIndex1 || m_LastFBooster != TileIndex2)
|
else if(m_LastBooster != TileIndex || m_LastFBooster != TileFIndex)
|
||||||
m_Core.m_Vel.x += m_Core.m_Vel.x*0.5;
|
m_Core.m_Vel.x += m_Core.m_Vel.x*0.5;
|
||||||
}
|
}
|
||||||
if (TileIndex1 == TILE_BOOST_D || TileIndex2 == TILE_BOOST_D)
|
if (TileIndex == TILE_BOOST_D || TileFIndex == TILE_BOOST_D)
|
||||||
{
|
{
|
||||||
if(m_PrevPos.y-m_Pos.y>0)
|
if(m_PrevPos.y-m_Pos.y>0)
|
||||||
m_Core.m_Vel.y += m_Core.m_Vel.y *-0.5;
|
m_Core.m_Vel.y += m_Core.m_Vel.y *-0.5;
|
||||||
else if(m_LastBooster != TileIndex1 || m_LastFBooster != TileIndex2)
|
else if(m_LastBooster != TileIndex || m_LastFBooster != TileFIndex)
|
||||||
m_Core.m_Vel.y += m_Core.m_Vel.y*0.5;
|
m_Core.m_Vel.y += m_Core.m_Vel.y*0.5;
|
||||||
}
|
}
|
||||||
if (TileIndex1 == TILE_BOOST_U || TileIndex2 == TILE_BOOST_U)
|
if (TileIndex == TILE_BOOST_U || TileFIndex == TILE_BOOST_U)
|
||||||
{
|
{
|
||||||
if(m_PrevPos.y-m_Pos.y<0)
|
if(m_PrevPos.y-m_Pos.y<0)
|
||||||
m_Core.m_Vel.y += m_Core.m_Vel.y *-0.5;
|
m_Core.m_Vel.y += m_Core.m_Vel.y *-0.5;
|
||||||
else if(m_LastBooster != TileIndex1 || m_LastFBooster != TileIndex2)
|
else if(m_LastBooster != TileIndex || m_LastFBooster != TileFIndex)
|
||||||
m_Core.m_Vel.y += m_Core.m_Vel.y*0.5;
|
m_Core.m_Vel.y += m_Core.m_Vel.y*0.5;
|
||||||
}
|
}
|
||||||
if ((TileIndex1 == TILE_BOOST_L2 || TileIndex2 == TILE_BOOST_L2) && (m_LastBooster != TileIndex1 || m_LastFBooster != TileIndex2))
|
if ((TileIndex == TILE_BOOST_L2 || TileFIndex == TILE_BOOST_L2) && (m_LastBooster != TileIndex || m_LastFBooster != TileFIndex))
|
||||||
{
|
{
|
||||||
if(m_PrevPos.x-m_Pos.x<0)
|
if(m_PrevPos.x-m_Pos.x<0)
|
||||||
m_Core.m_Vel.x = m_Core.m_Vel.x *-1.1;
|
m_Core.m_Vel.x = m_Core.m_Vel.x *-1.1;
|
||||||
else
|
else
|
||||||
m_Core.m_Vel.x += m_Core.m_Vel.x*1.1;
|
m_Core.m_Vel.x += m_Core.m_Vel.x*1.1;
|
||||||
}
|
}
|
||||||
if ((TileIndex1 == TILE_BOOST_R2|| TileIndex2 == TILE_BOOST_R2) && (m_LastBooster != TileIndex1 || m_LastFBooster != TileIndex2))
|
if ((TileIndex == TILE_BOOST_R2|| TileFIndex == TILE_BOOST_R2) && (m_LastBooster != TileIndex || m_LastFBooster != TileFIndex))
|
||||||
{
|
{
|
||||||
if(m_PrevPos.x-m_Pos.x>0)
|
if(m_Core.m_Vel.x < 0)
|
||||||
m_Core.m_Vel.x = m_Core.m_Vel.x *-1.1;
|
m_Core.m_Vel.x = m_Core.m_Vel.x *-1.1;
|
||||||
else
|
else
|
||||||
m_Core.m_Vel.x += m_Core.m_Vel.x*1.1;
|
m_Core.m_Vel.x += m_Core.m_Vel.x*1.1;
|
||||||
}
|
}
|
||||||
if ((TileIndex1 == TILE_BOOST_D2 || TileIndex2 == TILE_BOOST_D2) && (m_LastBooster != TileIndex1 || m_LastFBooster != TileIndex2))
|
if ((TileIndex == TILE_BOOST_D2 || TileFIndex == TILE_BOOST_D2) && (m_LastBooster != TileIndex || m_LastFBooster != TileFIndex))
|
||||||
{
|
{
|
||||||
if(m_PrevPos.y-m_Pos.y>0)
|
if(m_PrevPos.y-m_Pos.y>0)
|
||||||
m_Core.m_Vel.y = m_Core.m_Vel.y *-1.1;
|
m_Core.m_Vel.y = m_Core.m_Vel.y *-1.1;
|
||||||
else
|
else
|
||||||
m_Core.m_Vel.y += m_Core.m_Vel.y*1.1;
|
m_Core.m_Vel.y += m_Core.m_Vel.y*1.1;
|
||||||
}
|
}
|
||||||
if ((TileIndex1 == TILE_BOOST_U2 || TileIndex2 == TILE_BOOST_U2) && (m_LastBooster != TileIndex1 || m_LastFBooster != TileIndex2))
|
if ((TileIndex == TILE_BOOST_U2 || TileFIndex == TILE_BOOST_U2) && (m_LastBooster != TileIndex || m_LastFBooster != TileFIndex))
|
||||||
{
|
{
|
||||||
if(m_PrevPos.y-m_Pos.y<0)
|
if(m_PrevPos.y-m_Pos.y<0)
|
||||||
m_Core.m_Vel.y = m_Core.m_Vel.y *-1.1;
|
m_Core.m_Vel.y = m_Core.m_Vel.y *-1.1;
|
||||||
else
|
else
|
||||||
m_Core.m_Vel.y += m_Core.m_Vel.y*1.1;
|
m_Core.m_Vel.y += m_Core.m_Vel.y*1.1;
|
||||||
}
|
}
|
||||||
m_LastBooster = TileIndex1;
|
m_LastBooster = TileIndex;
|
||||||
m_LastFBooster = TileIndex2;
|
m_LastFBooster = TileFIndex;
|
||||||
// handle speedup tiles
|
// handle speedup tiles
|
||||||
if(GameServer()->Collision()->IsSpeedup((int)m_Core.m_Pos.x, (int)m_Core.m_Pos.y))
|
if(GameServer()->Collision()->IsSpeedup((int)m_Core.m_Pos.x, (int)m_Core.m_Pos.y))
|
||||||
{
|
{
|
||||||
|
|
|
@ -175,6 +175,8 @@ public:
|
||||||
int m_BroadTime;
|
int m_BroadTime;
|
||||||
int m_BroadCast;
|
int m_BroadCast;
|
||||||
|
|
||||||
|
int m_CurrentTile;
|
||||||
|
int m_CurrentFTile;
|
||||||
|
|
||||||
|
|
||||||
// info for dead reckoning
|
// info for dead reckoning
|
||||||
|
|
|
@ -75,9 +75,8 @@ void CDragger::drag()
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
if (length(m_Pos-target->m_Pos)>28)
|
if (length(m_Pos-target->m_Pos)>28)
|
||||||
{
|
if(!((target->m_CurrentTile >= TILE_STOPL && target->m_CurrentTile <= TILE_STOPT) || (target->m_CurrentFTile >= TILE_STOPL && target->m_CurrentFTile <= TILE_STOPT)))
|
||||||
target->m_Core.m_Vel+=normalize(m_Pos-target->m_Pos)*strength;
|
target->m_Core.m_Vel+=normalize(m_Pos-target->m_Pos)*strength;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -31,8 +31,8 @@ bool CPlasma::HitCharacter()
|
||||||
return false;
|
return false;
|
||||||
if(m_Freeze)
|
if(m_Freeze)
|
||||||
Hit->Freeze(Server()->TickSpeed()*3);
|
Hit->Freeze(Server()->TickSpeed()*3);
|
||||||
else
|
if(!m_Freeze || (m_Freeze && m_Explosive))
|
||||||
GameServer()->CreateExplosion(m_Pos, -1, WEAPON_GRENADE, false);
|
GameServer()->CreateExplosion(m_Pos, -1, WEAPON_GRENADE, true);
|
||||||
GameServer()->m_World.DestroyEntity(this);
|
GameServer()->m_World.DestroyEntity(this);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -64,7 +64,7 @@ void CPlasma::Tick()
|
||||||
if(Res)
|
if(Res)
|
||||||
{
|
{
|
||||||
if(m_Explosive)
|
if(m_Explosive)
|
||||||
GameServer()->CreateExplosion(m_Pos, -1, WEAPON_GRENADE, false);
|
GameServer()->CreateExplosion(m_Pos, -1, WEAPON_GRENADE, true);
|
||||||
Reset();
|
Reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -99,11 +99,11 @@ void CProjectile::Tick()
|
||||||
if(m_LifeSpan > -1)
|
if(m_LifeSpan > -1)
|
||||||
m_LifeSpan--;
|
m_LifeSpan--;
|
||||||
|
|
||||||
if( (TargetChr && (g_Config.m_SvHit || TargetChr == OwnerChar)) || Collide)//TODO:TEAM
|
if( (TargetChr && ((g_Config.m_SvHit || m_Owner == -1) || TargetChr == OwnerChar)) || Collide)//TODO:TEAM
|
||||||
{
|
{
|
||||||
if(m_Explosive/*??*/ && (!TargetChr || (TargetChr && !m_Freeze)))
|
if(m_Explosive/*??*/ && (!TargetChr || (TargetChr && !m_Freeze)))
|
||||||
{
|
{
|
||||||
GameServer()->CreateExplosion(ColPos, m_Owner, m_Weapon, false);
|
GameServer()->CreateExplosion(ColPos, m_Owner, m_Weapon, (m_Owner == -1)?true:false);
|
||||||
GameServer()->CreateSound(ColPos, m_SoundImpact);
|
GameServer()->CreateSound(ColPos, m_SoundImpact);
|
||||||
}
|
}
|
||||||
else if(TargetChr && m_Freeze)
|
else if(TargetChr && m_Freeze)
|
||||||
|
|
|
@ -127,8 +127,8 @@ void CGameContext::CreateExplosion(vec2 p, int Owner, int Weapon, bool NoDamage)
|
||||||
ev->m_Y = (int)p.y;
|
ev->m_Y = (int)p.y;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!NoDamage)
|
/*if (!NoDamage)
|
||||||
{
|
{*/
|
||||||
// deal damage
|
// deal damage
|
||||||
CCharacter *apEnts[64];
|
CCharacter *apEnts[64];
|
||||||
float Radius = 135.0f;
|
float Radius = 135.0f;
|
||||||
|
@ -144,13 +144,14 @@ void CGameContext::CreateExplosion(vec2 p, int Owner, int Weapon, bool NoDamage)
|
||||||
l = 1-clamp((l-InnerRadius)/(Radius-InnerRadius), 0.0f, 1.0f);
|
l = 1-clamp((l-InnerRadius)/(Radius-InnerRadius), 0.0f, 1.0f);
|
||||||
float Dmg = 6 * l;
|
float Dmg = 6 * l;
|
||||||
if((int)Dmg)//TODO:TEAM
|
if((int)Dmg)//TODO:TEAM
|
||||||
if(g_Config.m_SvHit || Owner == apEnts[i]->m_pPlayer->GetCID()) {
|
if((g_Config.m_SvHit||NoDamage) || Owner == apEnts[i]->m_pPlayer->GetCID())
|
||||||
|
{
|
||||||
apEnts[i]->TakeDamage(ForceDir*Dmg*2, (int)Dmg, Owner, Weapon);
|
apEnts[i]->TakeDamage(ForceDir*Dmg*2, (int)Dmg, Owner, Weapon);
|
||||||
if(!g_Config.m_SvHit) break;
|
if(!g_Config.m_SvHit||NoDamage) break;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
//}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -1340,7 +1341,7 @@ void CGameContext::ConGoLeft(IConsole::IResult *pResult, void *pUserData, int ci
|
||||||
CCharacter* chr = pSelf->GetPlayerChar(cid);
|
CCharacter* chr = pSelf->GetPlayerChar(cid);
|
||||||
if(chr)
|
if(chr)
|
||||||
{
|
{
|
||||||
chr->m_Core.m_Pos.x -= 32;
|
chr->m_Core.m_Pos.x -= 16;
|
||||||
if(!g_Config.m_SvCheatTime)
|
if(!g_Config.m_SvCheatTime)
|
||||||
chr->m_RaceState = RACE_CHEAT;
|
chr->m_RaceState = RACE_CHEAT;
|
||||||
}
|
}
|
||||||
|
@ -1352,7 +1353,7 @@ void CGameContext::ConGoRight(IConsole::IResult *pResult, void *pUserData, int
|
||||||
CCharacter* chr = pSelf->GetPlayerChar(cid);
|
CCharacter* chr = pSelf->GetPlayerChar(cid);
|
||||||
if(chr)
|
if(chr)
|
||||||
{
|
{
|
||||||
chr->m_Core.m_Pos.x += 32;
|
chr->m_Core.m_Pos.x += 16;
|
||||||
if(!g_Config.m_SvCheatTime)
|
if(!g_Config.m_SvCheatTime)
|
||||||
chr->m_RaceState = RACE_CHEAT;
|
chr->m_RaceState = RACE_CHEAT;
|
||||||
}
|
}
|
||||||
|
@ -1364,7 +1365,7 @@ void CGameContext::ConGoUp(IConsole::IResult *pResult, void *pUserData, int cid
|
||||||
CCharacter* chr = pSelf->GetPlayerChar(cid);
|
CCharacter* chr = pSelf->GetPlayerChar(cid);
|
||||||
if(chr)
|
if(chr)
|
||||||
{
|
{
|
||||||
chr->m_Core.m_Pos.y -= 32;
|
chr->m_Core.m_Pos.y -= 16;
|
||||||
if(!g_Config.m_SvCheatTime)
|
if(!g_Config.m_SvCheatTime)
|
||||||
chr->m_RaceState = RACE_CHEAT;
|
chr->m_RaceState = RACE_CHEAT;
|
||||||
}
|
}
|
||||||
|
@ -1376,7 +1377,7 @@ void CGameContext::ConGoDown(IConsole::IResult *pResult, void *pUserData, int c
|
||||||
CCharacter* chr = pSelf->GetPlayerChar(cid);
|
CCharacter* chr = pSelf->GetPlayerChar(cid);
|
||||||
if(chr)
|
if(chr)
|
||||||
{
|
{
|
||||||
chr->m_Core.m_Pos.y += 32;
|
chr->m_Core.m_Pos.y += 16;
|
||||||
if(!g_Config.m_SvCheatTime)
|
if(!g_Config.m_SvCheatTime)
|
||||||
chr->m_RaceState = RACE_CHEAT;
|
chr->m_RaceState = RACE_CHEAT;
|
||||||
}
|
}
|
||||||
|
@ -1980,9 +1981,30 @@ void CGameContext::OnInit(/*class IKernel *pKernel*/)
|
||||||
if (pSwitch)
|
if (pSwitch)
|
||||||
{
|
{
|
||||||
if(Collision()->Layers()->SwitchLayer())
|
if(Collision()->Layers()->SwitchLayer())
|
||||||
for(int i = 0; i < Collision()->Layers()->SwitchLayer()->m_Width * Collision()->Layers()->SwitchLayer()->m_Height; i++)
|
for(int y = 0; y < pTileMap->m_Height; y++)
|
||||||
if(Collision()->SwitchLayer()[i].m_Type == (ENTITY_DOOR + ENTITY_OFFSET))
|
for(int x = 0; x < pTileMap->m_Width; x++)
|
||||||
m_Size++;
|
{
|
||||||
|
int sides[8][2];
|
||||||
|
sides[0][0]=pSwitch[(x)+pTileMap->m_Width*(y+1)].m_Type - ENTITY_OFFSET;
|
||||||
|
sides[1][0]=pSwitch[(x+1)+pTileMap->m_Width*(y+1)].m_Type - ENTITY_OFFSET;
|
||||||
|
sides[2][0]=pSwitch[(x+1)+pTileMap->m_Width*(y)].m_Type - ENTITY_OFFSET;
|
||||||
|
sides[3][0]=pSwitch[(x+1)+pTileMap->m_Width*(y-1)].m_Type - ENTITY_OFFSET;
|
||||||
|
sides[4][0]=pSwitch[(x)+pTileMap->m_Width*(y-1)].m_Type - ENTITY_OFFSET;
|
||||||
|
sides[5][0]=pSwitch[(x-1)+pTileMap->m_Width*(y-1)].m_Type - ENTITY_OFFSET;
|
||||||
|
sides[6][0]=pSwitch[(x-1)+pTileMap->m_Width*(y)].m_Type - ENTITY_OFFSET;
|
||||||
|
sides[7][0]=pSwitch[(x-1)+pTileMap->m_Width*(y+1)].m_Type - ENTITY_OFFSET;
|
||||||
|
sides[0][1]=pSwitch[(x)+pTileMap->m_Width*(y+1)].m_Number;
|
||||||
|
sides[1][1]=pSwitch[(x+1)+pTileMap->m_Width*(y+1)].m_Number;
|
||||||
|
sides[2][1]=pSwitch[(x+1)+pTileMap->m_Width*(y)].m_Number;
|
||||||
|
sides[3][1]=pSwitch[(x+1)+pTileMap->m_Width*(y-1)].m_Number;
|
||||||
|
sides[4][1]=pSwitch[(x)+pTileMap->m_Width*(y-1)].m_Number;
|
||||||
|
sides[5][1]=pSwitch[(x-1)+pTileMap->m_Width*(y-1)].m_Number;
|
||||||
|
sides[6][1]=pSwitch[(x-1)+pTileMap->m_Width*(y)].m_Number;
|
||||||
|
sides[7][1]=pSwitch[(x-1)+pTileMap->m_Width*(y+1)].m_Number;
|
||||||
|
for(int i=0; i<8;i++)
|
||||||
|
if ((sides[i][0] >= ENTITY_LASER_SHORT && sides[i][0] <= ENTITY_LASER_LONG) && Collision()->SwitchLayer()[y*pTileMap->m_Width+x].m_Number == sides[i][1])
|
||||||
|
m_Size++;
|
||||||
|
}
|
||||||
if(m_Size)
|
if(m_Size)
|
||||||
{
|
{
|
||||||
m_SDoors = new SDoors[m_Size];
|
m_SDoors = new SDoors[m_Size];
|
||||||
|
|
|
@ -163,7 +163,9 @@ bool IGameController::OnEntity(int Index, vec2 Pos, bool Front)
|
||||||
if (Index - ENTITY_CRAZY_SHOTGUN_U_EX == i)
|
if (Index - ENTITY_CRAZY_SHOTGUN_U_EX == i)
|
||||||
{
|
{
|
||||||
float Deg = i*(pi/2);
|
float Deg = i*(pi/2);
|
||||||
CProjectile *bullet = new CProjectile(&GameServer()->m_World,
|
CProjectile *bullet = new CProjectile
|
||||||
|
(
|
||||||
|
&GameServer()->m_World,
|
||||||
WEAPON_SHOTGUN, //Type
|
WEAPON_SHOTGUN, //Type
|
||||||
-1, //Owner
|
-1, //Owner
|
||||||
Pos, //Pos
|
Pos, //Pos
|
||||||
|
@ -171,9 +173,10 @@ bool IGameController::OnEntity(int Index, vec2 Pos, bool Front)
|
||||||
-2, //Span
|
-2, //Span
|
||||||
true, //Freeze
|
true, //Freeze
|
||||||
true, //Explosive
|
true, //Explosive
|
||||||
0,
|
0,//Force
|
||||||
(g_Config.m_SvShotgunBulletSound)?SOUND_GRENADE_EXPLODE:-1,
|
(g_Config.m_SvShotgunBulletSound)?SOUND_GRENADE_EXPLODE:-1,//SoundImpact
|
||||||
WEAPON_SHOTGUN);
|
WEAPON_SHOTGUN//Weapon
|
||||||
|
);
|
||||||
bullet->SetBouncing(2 - (i % 2));
|
bullet->SetBouncing(2 - (i % 2));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue