mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 01:58:19 +00:00
Rotation
FTW
This commit is contained in:
parent
9bf4e05f5e
commit
e43bcd80db
Binary file not shown.
Before Width: | Height: | Size: 313 KiB After Width: | Height: | Size: 242 KiB |
Binary file not shown.
Before Width: | Height: | Size: 313 KiB After Width: | Height: | Size: 242 KiB |
|
@ -84,7 +84,7 @@ void CCollision::Init(class CLayers *pLayers)
|
|||
}
|
||||
|
||||
// DDRace tiles
|
||||
if(Index == TILE_THROUGH || (Index >= TILE_FREEZE && Index<=TILE_BOOSTS) || (Index >= TILE_TELEIN && Index<=TILE_STOPA) || (Index >= TILE_CP_D && Index<=TILE_NPH))
|
||||
if(Index == TILE_THROUGH || (Index >= TILE_FREEZE && Index <= TILE_BOOSTS) || (Index >= TILE_TELEIN && Index<=TILE_BOOST) || (Index >= TILE_BEGIN && Index <= TILE_STOPA) || Index == TILE_CP || Index == TILE_CP_F || (Index >= TILE_NPC && Index <= TILE_NPH))
|
||||
m_pFront[i].m_Index = Index;
|
||||
}
|
||||
}
|
||||
|
@ -114,7 +114,7 @@ void CCollision::Init(class CLayers *pLayers)
|
|||
}
|
||||
|
||||
// DDRace tiles
|
||||
if(Index == TILE_THROUGH || Index >= TILE_FREEZE && Index<=TILE_BOOSTS || Index >= TILE_TELEIN && Index<=TILE_STOPA || Index >= TILE_CP_D && Index<=TILE_NPH)
|
||||
if(Index == TILE_THROUGH || (Index >= TILE_FREEZE && Index <= TILE_BOOSTS) || (Index >= TILE_TELEIN && Index<=TILE_BOOST) || (Index >= TILE_BEGIN && Index <= TILE_STOPA) || Index == TILE_CP || Index == TILE_CP_F || (Index >= TILE_NPC && Index <= TILE_NPH))
|
||||
m_pTiles[i].m_Index = Index;
|
||||
}
|
||||
}
|
||||
|
@ -215,6 +215,23 @@ int CCollision::GetFTileIndex(int Index)
|
|||
return m_pFront[Index].m_Index;
|
||||
}
|
||||
|
||||
int CCollision::GetTileFlags(int Index)
|
||||
{
|
||||
/*dbg_msg("GetTileIndex","m_pTiles[%d].m_Index = %d",Index,m_pTiles[Index].m_Index);//Remove*/
|
||||
if(Index < 0)
|
||||
return 0;
|
||||
return m_pTiles[Index].m_Flags;
|
||||
}
|
||||
|
||||
int CCollision::GetFTileFlags(int Index)
|
||||
{
|
||||
/*dbg_msg("GetFTileIndex","m_pFront[%d].m_Index = %d",Index,m_pFront[Index].m_Index);//Remove*/
|
||||
|
||||
if(Index < 0 || !m_pFront)
|
||||
return 0;
|
||||
return m_pFront[Index].m_Flags;
|
||||
}
|
||||
|
||||
int CCollision::GetTile(int x, int y)
|
||||
{
|
||||
int nx = clamp(x/32, 0, m_Width-1);
|
||||
|
@ -280,14 +297,15 @@ void CCollision::SetDTile(float x, float y, int Team, bool State)
|
|||
m_pDoor[ny * m_Width + nx].m_Team[Team] = State;
|
||||
}
|
||||
|
||||
void CCollision::SetDCollisionAt(float x, float y, int Flag, int Team)
|
||||
void CCollision::SetDCollisionAt(float x, float y, int Type, int Team, int Flags)
|
||||
{
|
||||
if(!m_pDoor || ((Team < 0 || Team > (MAX_CLIENTS - 1)) && Team !=99))
|
||||
return;
|
||||
int nx = clamp(round(x)/32, 0, m_Width-1);
|
||||
int ny = clamp(round(y)/32, 0, m_Height-1);
|
||||
|
||||
m_pDoor[ny * m_Width + nx].m_Index = Flag;
|
||||
m_pDoor[ny * m_Width + nx].m_Index = Type;
|
||||
m_pDoor[ny * m_Width + nx].m_Flags = Flags;// currently only doors in all sides use this so no need for rotation
|
||||
if(Team == 99)
|
||||
{
|
||||
for (int i = 0; i < (MAX_CLIENTS - 1); ++i)
|
||||
|
@ -309,6 +327,16 @@ int CCollision::GetDTileIndex(int Index,int Team)
|
|||
return 0;
|
||||
}
|
||||
|
||||
int CCollision::GetDTileFlags(int Index,int Team)
|
||||
{
|
||||
if(!m_pDoor || Index < 0 || !m_pDoor[Index].m_Index || ((Team < 0 || Team > (MAX_CLIENTS - 1)) && Team !=99))
|
||||
return 0;
|
||||
|
||||
if(m_pDoor[Index].m_Team[Team])
|
||||
return m_pDoor[Index].m_Flags;
|
||||
return 0;
|
||||
}
|
||||
|
||||
// TODO: rewrite this smarter!
|
||||
void ThroughOffset(vec2 Pos0, vec2 Pos1, int *Ox, int *Oy)
|
||||
{
|
||||
|
@ -658,14 +686,15 @@ void CCollision::GetSpeedup(int Index, vec2 *Dir, int *Force, int *MaxSpeed)
|
|||
*MaxSpeed = m_pSpeedup[Index].m_MaxSpeed;
|
||||
}
|
||||
|
||||
int CCollision::IsCp(int x, int y)
|
||||
int CCollision::IsCp(int x, int y, int* Flags)
|
||||
{
|
||||
int nx = clamp(x/32, 0, m_Width-1);
|
||||
int ny = clamp(y/32, 0, m_Height-1);
|
||||
int Index = m_pTiles[ny*m_Width+nx].m_Index;
|
||||
*Flags = m_pTiles[ny*m_Width+nx].m_Flags;
|
||||
if(Index < 0)
|
||||
return 0;
|
||||
if (Index >= TILE_CP_D && Index <= TILE_CP_L_F)
|
||||
if (Index == TILE_CP || Index == TILE_CP_F)
|
||||
return Index;
|
||||
else
|
||||
return 0;
|
||||
|
@ -693,39 +722,35 @@ int CCollision::IsFCheckpoint(int Index)
|
|||
return -1;
|
||||
}
|
||||
|
||||
vec2 CCollision::CpSpeed(int Index)
|
||||
vec2 CCollision::CpSpeed(int Index, int Flags)
|
||||
{
|
||||
if(Index < 0)
|
||||
return vec2(0,0);
|
||||
vec2 target;
|
||||
|
||||
switch(Index)
|
||||
{
|
||||
case TILE_CP_U:
|
||||
case TILE_CP_U_F:
|
||||
target.x=0;
|
||||
target.y=-4;
|
||||
break;
|
||||
case TILE_CP_R:
|
||||
case TILE_CP_R_F:
|
||||
target.x=4;
|
||||
target.y=0;
|
||||
break;
|
||||
case TILE_CP_D:
|
||||
case TILE_CP_D_F:
|
||||
target.x=0;
|
||||
target.y=4;
|
||||
break;
|
||||
case TILE_CP_L:
|
||||
case TILE_CP_L_F:
|
||||
target.x=-4;
|
||||
target.y=0;
|
||||
break;
|
||||
default:
|
||||
target=vec2(0,0);
|
||||
break;
|
||||
}
|
||||
if (Index>=TILE_CP_D_F && Index<=TILE_CP_L_F)
|
||||
if(Index == TILE_CP || Index == TILE_CP_F)
|
||||
switch(Flags)
|
||||
{
|
||||
case ROTATION_0:
|
||||
target.x=0;
|
||||
target.y=-4;
|
||||
break;
|
||||
case ROTATION_90:
|
||||
target.x=4;
|
||||
target.y=0;
|
||||
break;
|
||||
case ROTATION_180:
|
||||
target.x=0;
|
||||
target.y=4;
|
||||
break;
|
||||
case ROTATION_270:
|
||||
target.x=-4;
|
||||
target.y=0;
|
||||
break;
|
||||
default:
|
||||
target=vec2(0,0);
|
||||
break;
|
||||
}
|
||||
if (Index == TILE_CP_F)
|
||||
target*=4;
|
||||
return target;
|
||||
|
||||
|
|
|
@ -32,8 +32,9 @@ public:
|
|||
bool CheckPoint(vec2 p) { return CheckPoint(p.x, p.y); }
|
||||
void SetCollisionAt(float x, float y, int Flag);
|
||||
void SetDTile(float x, float y, int Team, bool State);
|
||||
void SetDCollisionAt(float x, float y, int Flag, int Team);
|
||||
void SetDCollisionAt(float x, float y, int Type, int Team, int Flags = 0);
|
||||
int GetDTileIndex(int Index,int Team);
|
||||
int GetDTileFlags(int Index,int Team);
|
||||
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 GetWidth() { return m_Width; };
|
||||
|
@ -54,6 +55,8 @@ public:
|
|||
vec2 GetPos(int Index);
|
||||
int GetTileIndex(int Index);
|
||||
int GetFTileIndex(int Index);
|
||||
int GetTileFlags(int Index);
|
||||
int GetFTileFlags(int Index);
|
||||
int IsTeleport(int Index);
|
||||
int IsEvilTeleport(int Index);
|
||||
//int IsCheckpoint(int Index);
|
||||
|
@ -68,9 +71,9 @@ public:
|
|||
int IsCheckpoint(int Index);
|
||||
int IsFCheckpoint(int Index);
|
||||
|
||||
int IsCp(int x, int y);
|
||||
int IsCp(int x, int y, int* Flags);
|
||||
|
||||
vec2 CpSpeed(int index);
|
||||
vec2 CpSpeed(int index, int Flags = 0);
|
||||
|
||||
class CTeleTile *TeleLayer() { return m_pTele; }
|
||||
//class CSpeedupTile *SpeedupLayer() { return m_pSpeedup; }
|
||||
|
|
|
@ -924,7 +924,7 @@ void CLayerFront::BrushDraw(CLayer *pBrush, float wx, float wy)
|
|||
continue;
|
||||
|
||||
// dont allow tele in and out tiles... same with speedup tile and alot more 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_TELEINEVIL || 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 == TILE_BOOSTS || l->m_pTiles[y*l->m_Width+x].m_Index == TILE_BOOSTS || 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) || (l->m_pTiles[y*l->m_Width+x].m_Index >=TILE_CP_D && l->m_pTiles[y*l->m_Width+x].m_Index <=TILE_CP_L_F))
|
||||
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_TELEINEVIL || 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 == TILE_BOOSTS || l->m_pTiles[y*l->m_Width+x].m_Index == TILE_BOOSTS || 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) || l->m_pTiles[y*l->m_Width+x].m_Index ==TILE_CP || l->m_pTiles[y*l->m_Width+x].m_Index ==TILE_CP_F)
|
||||
continue;
|
||||
m_pTiles[fy*m_Width+fx] = l->m_pTiles[y*l->m_Width+x];
|
||||
}
|
||||
|
|
|
@ -91,20 +91,35 @@ void CCharacterCore::Tick(bool UseInput)
|
|||
int MapIndexB = m_pCollision->GetPureMapIndex(vec2(m_Pos.x,m_Pos.y - (28/2)-4));
|
||||
//dbg_msg("","N%d L%d R%d B%d T%d",MapIndex,MapIndexL,MapIndexR,MapIndexB,MapIndexT);
|
||||
m_TileIndex = m_pCollision->GetTileIndex(MapIndex);
|
||||
m_TileFlags = m_pCollision->GetTileFlags(MapIndex);
|
||||
m_TileIndexL = m_pCollision->GetTileIndex(MapIndexL);
|
||||
m_TileFlagsL = m_pCollision->GetTileFlags(MapIndexL);
|
||||
m_TileIndexR = m_pCollision->GetTileIndex(MapIndexR);
|
||||
m_TileFlagsR = m_pCollision->GetTileFlags(MapIndexR);
|
||||
m_TileIndexB = m_pCollision->GetTileIndex(MapIndexB);
|
||||
m_TileFlagsB = m_pCollision->GetTileFlags(MapIndexB);
|
||||
m_TileIndexT = m_pCollision->GetTileIndex(MapIndexT);
|
||||
m_TileFlagsT = m_pCollision->GetTileFlags(MapIndexT);
|
||||
m_TileFIndex = m_pCollision->GetFTileIndex(MapIndex);
|
||||
m_TileFFlags = m_pCollision->GetFTileFlags(MapIndex);
|
||||
m_TileFIndexL = m_pCollision->GetFTileIndex(MapIndexL);
|
||||
m_TileFFlagsL = m_pCollision->GetFTileFlags(MapIndexL);
|
||||
m_TileFIndexR = m_pCollision->GetFTileIndex(MapIndexR);
|
||||
m_TileFFlagsR = m_pCollision->GetFTileFlags(MapIndexR);
|
||||
m_TileFIndexB = m_pCollision->GetFTileIndex(MapIndexB);
|
||||
m_TileFFlagsB = m_pCollision->GetFTileFlags(MapIndexB);
|
||||
m_TileFIndexT = m_pCollision->GetFTileIndex(MapIndexT);
|
||||
m_TileFFlagsT = m_pCollision->GetFTileFlags(MapIndexT);
|
||||
m_TileSIndex = m_pCollision->GetDTileIndex(MapIndex, m_pTeams->Team(m_Id));
|
||||
m_TileSFlags = m_pCollision->GetDTileFlags(MapIndex, m_pTeams->Team(m_Id));
|
||||
m_TileSIndexL = m_pCollision->GetDTileIndex(MapIndexL, m_pTeams->Team(m_Id));
|
||||
m_TileSFlagsL = m_pCollision->GetDTileFlags(MapIndexL, m_pTeams->Team(m_Id));
|
||||
m_TileSIndexR = m_pCollision->GetDTileIndex(MapIndexR, m_pTeams->Team(m_Id));
|
||||
m_TileSFlagsR = m_pCollision->GetDTileFlags(MapIndexR, m_pTeams->Team(m_Id));
|
||||
m_TileSIndexB = m_pCollision->GetDTileIndex(MapIndexB, m_pTeams->Team(m_Id));
|
||||
m_TileSFlagsB = m_pCollision->GetDTileFlags(MapIndexB, m_pTeams->Team(m_Id));
|
||||
m_TileSIndexT = m_pCollision->GetDTileIndex(MapIndexT, m_pTeams->Team(m_Id));
|
||||
m_TileSFlagsT = m_pCollision->GetDTileFlags(MapIndexT, m_pTeams->Team(m_Id));
|
||||
m_TriggeredEvents = 0;
|
||||
|
||||
// get ground state
|
||||
|
@ -377,26 +392,26 @@ void CCharacterCore::Tick(bool UseInput)
|
|||
vec2 Temp = p->m_Vel;
|
||||
Temp.x = SaturatedAdd(-DragSpeed, DragSpeed, p->m_Vel.x, Accel*Dir.x*1.5f);
|
||||
Temp.y = SaturatedAdd(-DragSpeed, DragSpeed, p->m_Vel.y, Accel*Dir.y*1.5f);
|
||||
if(Temp.x > 0 && (p->m_TileIndex == TILE_STOPL || p->m_TileIndexL == TILE_STOPL || p->m_TileIndexL == TILE_STOPH || p->m_TileIndexL == TILE_STOPA || p->m_TileFIndex == TILE_STOPL || p->m_TileFIndexL == TILE_STOPL || p->m_TileFIndexL == TILE_STOPH || p->m_TileFIndexL == TILE_STOPA || p->m_TileSIndex == TILE_STOPL || p->m_TileSIndexL == TILE_STOPL || p->m_TileSIndexL == TILE_STOPH || p->m_TileSIndexL == TILE_STOPA))
|
||||
if(Temp.x > 0 && ((p->m_TileIndex == TILE_STOP && p->m_TileFlags == ROTATION_270) || (p->m_TileIndexL == TILE_STOP && p->m_TileFlagsL == ROTATION_270) || (p->m_TileIndexL == TILE_STOPS && (p->m_TileFlagsL == ROTATION_90 || p->m_TileFlagsL ==ROTATION_270)) || (p->m_TileIndexL == TILE_STOPA) || (p->m_TileFIndex == TILE_STOP && p->m_TileFFlags == ROTATION_270) || (p->m_TileFIndexL == TILE_STOP && p->m_TileFFlagsL == ROTATION_270) || (p->m_TileFIndexL == TILE_STOPS && (p->m_TileFFlagsL == ROTATION_90 || p->m_TileFFlagsL == ROTATION_270)) || (p->m_TileFIndexL == TILE_STOPA) || (p->m_TileSIndex == TILE_STOP && p->m_TileSFlags == ROTATION_270) || (p->m_TileSIndexL == TILE_STOP && p->m_TileSFlagsL == ROTATION_270) || (p->m_TileSIndexL == TILE_STOPS && (p->m_TileSFlagsL == ROTATION_90 || p->m_TileSFlagsL == ROTATION_270)) || (p->m_TileSIndexL == TILE_STOPA)))
|
||||
Temp.x = 0;
|
||||
if(Temp.x < 0 && (p->m_TileIndex == TILE_STOPR || p->m_TileIndexR == TILE_STOPR || p->m_TileIndexR == TILE_STOPH || p->m_TileIndexR == TILE_STOPA || p->m_TileFIndex == TILE_STOPR || p->m_TileFIndexR == TILE_STOPR || p->m_TileFIndexR == TILE_STOPH || p->m_TileFIndexR == TILE_STOPA || p->m_TileSIndex == TILE_STOPR || p->m_TileSIndexR == TILE_STOPR || p->m_TileSIndexR == TILE_STOPH || p->m_TileSIndexR == TILE_STOPA))
|
||||
if(Temp.x < 0 && ((p->m_TileIndex == TILE_STOP && p->m_TileFlags == ROTATION_90) || (p->m_TileIndexR == TILE_STOP && p->m_TileFlagsR == ROTATION_90) || (p->m_TileIndexR == TILE_STOPS && (p->m_TileFlagsR == ROTATION_90 || p->m_TileFlagsR == ROTATION_270)) || (p->m_TileIndexR == TILE_STOPA) || (p->m_TileFIndex == TILE_STOP && p->m_TileFFlags == ROTATION_90) || (p->m_TileFIndexR == TILE_STOP && p->m_TileFFlagsR == ROTATION_90) || (p->m_TileFIndexR == TILE_STOPS && (p->m_TileFFlagsR == ROTATION_90 || p->m_TileFFlagsR == ROTATION_270)) || (p->m_TileFIndexR == TILE_STOPA) || (p->m_TileSIndex == TILE_STOP && p->m_TileSFlags == ROTATION_90) || (p->m_TileSIndexR == TILE_STOP && p->m_TileSFlagsR == ROTATION_90) || (p->m_TileSIndexR == TILE_STOPS && (p->m_TileSFlagsR == ROTATION_90 || p->m_TileSFlagsR == ROTATION_270)) || (p->m_TileSIndexR == TILE_STOPA)))
|
||||
Temp.x = 0;
|
||||
if(Temp.y < 0 && (p->m_TileIndex == TILE_STOPB || p->m_TileIndexB == TILE_STOPB || p->m_TileIndexB == TILE_STOPV || p->m_TileIndexB == TILE_STOPA || p->m_TileFIndex == TILE_STOPB || p->m_TileFIndexB == TILE_STOPB || p->m_TileFIndexB == TILE_STOPV || p->m_TileFIndexB == TILE_STOPA || p->m_TileSIndex == TILE_STOPB || p->m_TileSIndexB == TILE_STOPB || p->m_TileSIndexB == TILE_STOPV || p->m_TileSIndexB == TILE_STOPA))
|
||||
if(Temp.y < 0 && ((p->m_TileIndex == TILE_STOP && p->m_TileFlags == ROTATION_180) || (p->m_TileIndexB == TILE_STOP && p->m_TileFlagsB == ROTATION_180) || (p->m_TileIndexB == TILE_STOPS && (p->m_TileFlagsB == ROTATION_0 || p->m_TileFlagsB == ROTATION_180)) || (p->m_TileIndexB == TILE_STOPA) || (p->m_TileFIndex == TILE_STOP && p->m_TileFFlags == ROTATION_180) || (p->m_TileFIndexB == TILE_STOP && p->m_TileFFlagsB == ROTATION_180) || (p->m_TileFIndexB == TILE_STOPS && (p->m_TileFFlagsB == ROTATION_0 || p->m_TileFFlagsB == ROTATION_180)) || (p->m_TileFIndexB == TILE_STOPA) || (p->m_TileSIndex == TILE_STOP && p->m_TileSFlags == ROTATION_180) || (p->m_TileSIndexB == TILE_STOP && p->m_TileSFlagsB == ROTATION_180) || (p->m_TileSIndexB == TILE_STOPS && (p->m_TileSFlagsB == ROTATION_0 || p->m_TileSFlagsB == ROTATION_180)) || (p->m_TileSIndexB == TILE_STOPA)))
|
||||
Temp.y = 0;
|
||||
if(Temp.y > 0 && (p->m_TileIndex == TILE_STOPT || p->m_TileIndexT == TILE_STOPT || p->m_TileIndexT == TILE_STOPV || p->m_TileIndexT == TILE_STOPA || p->m_TileFIndex == TILE_STOPT || p->m_TileFIndexT == TILE_STOPT || p->m_TileFIndexT == TILE_STOPV || p->m_TileFIndexT == TILE_STOPA || p->m_TileSIndex == TILE_STOPT || p->m_TileSIndexT == TILE_STOPT || p->m_TileSIndexT == TILE_STOPV || p->m_TileSIndexT == TILE_STOPA))
|
||||
if(Temp.y > 0 && ((p->m_TileIndex == TILE_STOP && p->m_TileFlags == ROTATION_0) || (p->m_TileIndexT == TILE_STOP && p->m_TileFlagsT == ROTATION_0) || (p->m_TileIndexT == TILE_STOPS && (p->m_TileFlagsT == ROTATION_0 || p->m_TileFlagsT == ROTATION_180)) || (p->m_TileIndexT == TILE_STOPA) || (p->m_TileFIndex == TILE_STOP && p->m_TileFFlags == ROTATION_0) || (p->m_TileFIndexT == TILE_STOP && p->m_TileFFlagsT == ROTATION_0) || (p->m_TileFIndexT == TILE_STOPS && (p->m_TileFFlagsT == ROTATION_0 || p->m_TileFFlagsT == ROTATION_180)) || (p->m_TileFIndexT == TILE_STOPA) || (p->m_TileSIndex == TILE_STOP && p->m_TileSFlags == ROTATION_0) || (p->m_TileSIndexT == TILE_STOP && p->m_TileSFlagsT == ROTATION_0) || (p->m_TileSIndexT == TILE_STOPS && (p->m_TileSFlagsT == ROTATION_0 || p->m_TileSFlagsT == ROTATION_180)) || (p->m_TileSIndexT == TILE_STOPA)))
|
||||
Temp.y = 0;
|
||||
|
||||
// add force to the hooked player
|
||||
p->m_Vel = Temp;
|
||||
Temp.x = SaturatedAdd(-DragSpeed, DragSpeed, m_Vel.x, -Accel*Dir.x*0.25f);
|
||||
Temp.y = SaturatedAdd(-DragSpeed, DragSpeed, m_Vel.y, -Accel*Dir.y*0.25f);
|
||||
if(Temp.x > 0 && (m_TileIndex == TILE_STOPL || m_TileIndexL == TILE_STOPL || m_TileIndexL == TILE_STOPH || m_TileIndexL == TILE_STOPA || m_TileFIndex == TILE_STOPL || m_TileFIndexL == TILE_STOPL || m_TileFIndexL == TILE_STOPH || m_TileFIndexL == TILE_STOPA || m_TileSIndex == TILE_STOPL || m_TileSIndexL == TILE_STOPL || m_TileSIndexL == TILE_STOPH || m_TileSIndexL == TILE_STOPA))
|
||||
if(Temp.x > 0 && ((m_TileIndex == TILE_STOP && m_TileFlags == ROTATION_270) || (m_TileIndexL == TILE_STOP && m_TileFlagsL == ROTATION_270) || (m_TileIndexL == TILE_STOPS && (m_TileFlagsL == ROTATION_90 || m_TileFlagsL ==ROTATION_270)) || (m_TileIndexL == TILE_STOPA) || (m_TileFIndex == TILE_STOP && m_TileFFlags == ROTATION_270) || (m_TileFIndexL == TILE_STOP && m_TileFFlagsL == ROTATION_270) || (m_TileFIndexL == TILE_STOPS && (m_TileFFlagsL == ROTATION_90 || m_TileFFlagsL == ROTATION_270)) || (m_TileFIndexL == TILE_STOPA) || (m_TileSIndex == TILE_STOP && m_TileSFlags == ROTATION_270) || (m_TileSIndexL == TILE_STOP && m_TileSFlagsL == ROTATION_270) || (m_TileSIndexL == TILE_STOPS && (m_TileSFlagsL == ROTATION_90 || m_TileSFlagsL == ROTATION_270)) || (m_TileSIndexL == TILE_STOPA)))
|
||||
Temp.x = 0;
|
||||
if(Temp.x < 0 && (m_TileIndex == TILE_STOPR || m_TileIndexR == TILE_STOPR || m_TileIndexR == TILE_STOPH || m_TileIndexR == TILE_STOPA || m_TileFIndex == TILE_STOPR || m_TileFIndexR == TILE_STOPR || m_TileFIndexR == TILE_STOPH || m_TileFIndexR == TILE_STOPA || m_TileSIndex == TILE_STOPR || m_TileSIndexR == TILE_STOPR || m_TileSIndexR == TILE_STOPH || m_TileSIndexR == TILE_STOPA))
|
||||
if(Temp.x < 0 && ((m_TileIndex == TILE_STOP && m_TileFlags == ROTATION_90) || (m_TileIndexR == TILE_STOP && m_TileFlagsR == ROTATION_90) || (m_TileIndexR == TILE_STOPS && (m_TileFlagsR == ROTATION_90 || m_TileFlagsR == ROTATION_270)) || (m_TileIndexR == TILE_STOPA) || (m_TileFIndex == TILE_STOP && m_TileFFlags == ROTATION_90) || (m_TileFIndexR == TILE_STOP && m_TileFFlagsR == ROTATION_90) || (m_TileFIndexR == TILE_STOPS && (m_TileFFlagsR == ROTATION_90 || m_TileFFlagsR == ROTATION_270)) || (m_TileFIndexR == TILE_STOPA) || (m_TileSIndex == TILE_STOP && m_TileSFlags == ROTATION_90) || (m_TileSIndexR == TILE_STOP && m_TileSFlagsR == ROTATION_90) || (m_TileSIndexR == TILE_STOPS && (m_TileSFlagsR == ROTATION_90 || m_TileSFlagsR == ROTATION_270)) || (m_TileSIndexR == TILE_STOPA)))
|
||||
Temp.x = 0;
|
||||
if(Temp.y < 0 && (m_TileIndex == TILE_STOPB || m_TileIndexB == TILE_STOPB || m_TileIndexB == TILE_STOPV || m_TileIndexB == TILE_STOPA || m_TileFIndex == TILE_STOPB || m_TileFIndexB == TILE_STOPB || m_TileFIndexB == TILE_STOPV || m_TileFIndexB == TILE_STOPA || m_TileSIndex == TILE_STOPB || m_TileSIndexB == TILE_STOPB || m_TileSIndexB == TILE_STOPV || m_TileSIndexB == TILE_STOPA))
|
||||
if(Temp.y < 0 && ((m_TileIndex == TILE_STOP && m_TileFlags == ROTATION_180) || (m_TileIndexB == TILE_STOP && m_TileFlagsB == ROTATION_180) || (m_TileIndexB == TILE_STOPS && (m_TileFlagsB == ROTATION_0 || m_TileFlagsB == ROTATION_180)) || (m_TileIndexB == TILE_STOPA) || (m_TileFIndex == TILE_STOP && m_TileFFlags == ROTATION_180) || (m_TileFIndexB == TILE_STOP && m_TileFFlagsB == ROTATION_180) || (m_TileFIndexB == TILE_STOPS && (m_TileFFlagsB == ROTATION_0 || m_TileFFlagsB == ROTATION_180)) || (m_TileFIndexB == TILE_STOPA) || (m_TileSIndex == TILE_STOP && m_TileSFlags == ROTATION_180) || (m_TileSIndexB == TILE_STOP && m_TileSFlagsB == ROTATION_180) || (m_TileSIndexB == TILE_STOPS && (m_TileSFlagsB == ROTATION_0 || m_TileSFlagsB == ROTATION_180)) || (m_TileSIndexB == TILE_STOPA)))
|
||||
Temp.y = 0;
|
||||
if(Temp.y > 0 && (m_TileIndex == TILE_STOPT || m_TileIndexT == TILE_STOPT || m_TileIndexT == TILE_STOPV || m_TileIndexT == TILE_STOPA || m_TileFIndex == TILE_STOPT || m_TileFIndexT == TILE_STOPT || m_TileFIndexT == TILE_STOPV || m_TileFIndexT == TILE_STOPA || m_TileSIndex == TILE_STOPT || m_TileSIndexT == TILE_STOPT || m_TileSIndexT == TILE_STOPV || m_TileSIndexT == TILE_STOPA))
|
||||
if(Temp.y > 0 && ((m_TileIndex == TILE_STOP && m_TileFlags == ROTATION_0) || (m_TileIndexT == TILE_STOP && m_TileFlagsT == ROTATION_0) || (m_TileIndexT == TILE_STOPS && (m_TileFlagsT == ROTATION_0 || m_TileFlagsT == ROTATION_180)) || (m_TileIndexT == TILE_STOPA) || (m_TileFIndex == TILE_STOP && m_TileFFlags == ROTATION_0) || (m_TileFIndexT == TILE_STOP && m_TileFFlagsT == ROTATION_0) || (m_TileFIndexT == TILE_STOPS && (m_TileFFlagsT == ROTATION_0 || m_TileFFlagsT == ROTATION_180)) || (m_TileFIndexT == TILE_STOPA) || (m_TileSIndex == TILE_STOP && m_TileSFlags == ROTATION_0) || (m_TileSIndexT == TILE_STOP && m_TileSFlagsT == ROTATION_0) || (m_TileSIndexT == TILE_STOPS && (m_TileSFlagsT == ROTATION_0 || m_TileSFlagsT == ROTATION_180)) || (m_TileSIndexT == TILE_STOPA)))
|
||||
Temp.y = 0;
|
||||
// add a little bit force to the guy who has the grip
|
||||
m_Vel = Temp;
|
||||
|
|
|
@ -179,20 +179,35 @@ class CCharacterCore
|
|||
CTeamsCore* m_pTeams;
|
||||
|
||||
int m_TileIndex;
|
||||
int m_TileFlags;
|
||||
int m_TileFIndex;
|
||||
int m_TileFFlags;
|
||||
int m_TileSIndex;
|
||||
int m_TileSFlags;
|
||||
int m_TileIndexL;
|
||||
int m_TileFlagsL;
|
||||
int m_TileFIndexL;
|
||||
int m_TileFFlagsL;
|
||||
int m_TileSIndexL;
|
||||
int m_TileSFlagsL;
|
||||
int m_TileIndexR;
|
||||
int m_TileFlagsR;
|
||||
int m_TileFIndexR;
|
||||
int m_TileFFlagsR;
|
||||
int m_TileSIndexR;
|
||||
int m_TileSFlagsR;
|
||||
int m_TileIndexT;
|
||||
int m_TileFlagsT;
|
||||
int m_TileFIndexT;
|
||||
int m_TileFFlagsT;
|
||||
int m_TileSIndexT;
|
||||
int m_TileSFlagsT;
|
||||
int m_TileIndexB;
|
||||
int m_TileFlagsB;
|
||||
int m_TileFIndexB;
|
||||
int m_TileFFlagsB;
|
||||
int m_TileSIndexB;
|
||||
int m_TileSFlagsB;
|
||||
|
||||
|
||||
public:
|
||||
|
|
|
@ -63,14 +63,8 @@ enum
|
|||
ENTITY_PLASMA,
|
||||
ENTITY_PLASMAU,
|
||||
//DDRace - Shotgun
|
||||
ENTITY_CRAZY_SHOTGUN_U_EX,
|
||||
ENTITY_CRAZY_SHOTGUN_R_EX,
|
||||
ENTITY_CRAZY_SHOTGUN_D_EX,
|
||||
ENTITY_CRAZY_SHOTGUN_L_EX,
|
||||
ENTITY_CRAZY_SHOTGUN_U,
|
||||
ENTITY_CRAZY_SHOTGUN_R,
|
||||
ENTITY_CRAZY_SHOTGUN_D,
|
||||
ENTITY_CRAZY_SHOTGUN_L,
|
||||
ENTITY_CRAZY_SHOTGUN_EX,
|
||||
ENTITY_CRAZY_SHOTGUN,
|
||||
//DDRace - Draggers
|
||||
ENTITY_DRAGGER_WEAK=42,
|
||||
ENTITY_DRAGGER_NORMAL,
|
||||
|
@ -99,32 +93,22 @@ enum
|
|||
TILE_DEATH,
|
||||
TILE_NOHOOK,
|
||||
TILE_NOLASER,
|
||||
TILE_THROUGH=6,
|
||||
TILE_FREEZE=9,
|
||||
TILE_THROUGH = 6,
|
||||
TILE_FREEZE = 9,
|
||||
TILE_TELEINEVIL,
|
||||
TILE_UNFREEZE,
|
||||
TILE_BOOSTS,
|
||||
TILE_TELEIN=26,
|
||||
TILE_TELEOUT,
|
||||
TILE_BOOST,
|
||||
TILE_STOPL,
|
||||
TILE_STOPR,
|
||||
TILE_STOPB,
|
||||
TILE_STOPT,
|
||||
TILE_BEGIN,
|
||||
TILE_BEGIN = 33,
|
||||
TILE_END,
|
||||
TILE_STOPH=60,
|
||||
TILE_STOPV,
|
||||
TILE_STOP = 60,
|
||||
TILE_STOPS,
|
||||
TILE_STOPA,
|
||||
TILE_CP_D=64,
|
||||
TILE_CP_U,
|
||||
TILE_CP_R,
|
||||
TILE_CP_L,
|
||||
TILE_CP_D_F,
|
||||
TILE_CP_U_F,
|
||||
TILE_CP_R_F,
|
||||
TILE_CP_L_F,
|
||||
TILE_NPC,
|
||||
TILE_CP = 64,
|
||||
TILE_CP_F,
|
||||
TILE_NPC = 72,
|
||||
TILE_EHOOK,
|
||||
TILE_NOHIT,
|
||||
TILE_NPH,//Remember to change this in collision.cpp if you add anymore tiles
|
||||
|
@ -140,6 +124,14 @@ enum
|
|||
ENTITY_OFFSET=255-16*4,
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
ROTATION_0,
|
||||
ROTATION_90 = TILEFLAG_ROTATE,
|
||||
ROTATION_180 = (TILEFLAG_VFLIP|TILEFLAG_HFLIP),
|
||||
ROTATION_270 = (TILEFLAG_VFLIP|TILEFLAG_HFLIP|TILEFLAG_ROTATE)
|
||||
};
|
||||
|
||||
struct CPoint
|
||||
{
|
||||
int x, y; // 22.10 fixed point
|
||||
|
@ -202,6 +194,7 @@ class CDoorTile
|
|||
{
|
||||
public:
|
||||
unsigned char m_Index;
|
||||
unsigned char m_Flags;
|
||||
bool m_Team[MAX_CLIENTS];
|
||||
};
|
||||
|
||||
|
|
|
@ -859,20 +859,35 @@ void CCharacter::HandleTiles(int Index)
|
|||
int MapIndexB = GameServer()->Collision()->GetPureMapIndex(vec2(m_Pos.x,m_Pos.y - (m_ProximityRadius/2)-4));
|
||||
//dbg_msg("","N%d L%d R%d B%d T%d",MapIndex,MapIndexL,MapIndexR,MapIndexB,MapIndexT);
|
||||
m_TileIndex = GameServer()->Collision()->GetTileIndex(MapIndex);
|
||||
m_TileFlags = GameServer()->Collision()->GetTileFlags(MapIndex);
|
||||
m_TileIndexL = GameServer()->Collision()->GetTileIndex(MapIndexL);
|
||||
m_TileFlagsL = GameServer()->Collision()->GetTileFlags(MapIndexL);
|
||||
m_TileIndexR = GameServer()->Collision()->GetTileIndex(MapIndexR);
|
||||
m_TileFlagsR = GameServer()->Collision()->GetTileFlags(MapIndexR);
|
||||
m_TileIndexB = GameServer()->Collision()->GetTileIndex(MapIndexB);
|
||||
m_TileFlagsB = GameServer()->Collision()->GetTileFlags(MapIndexB);
|
||||
m_TileIndexT = GameServer()->Collision()->GetTileIndex(MapIndexT);
|
||||
m_TileFlagsT = GameServer()->Collision()->GetTileFlags(MapIndexT);
|
||||
m_TileFIndex = GameServer()->Collision()->GetFTileIndex(MapIndex);
|
||||
m_TileFFlags = GameServer()->Collision()->GetFTileFlags(MapIndex);
|
||||
m_TileFIndexL = GameServer()->Collision()->GetFTileIndex(MapIndexL);
|
||||
m_TileFFlagsL = GameServer()->Collision()->GetFTileFlags(MapIndexL);
|
||||
m_TileFIndexR = GameServer()->Collision()->GetFTileIndex(MapIndexR);
|
||||
m_TileFFlagsR = GameServer()->Collision()->GetFTileFlags(MapIndexR);
|
||||
m_TileFIndexB = GameServer()->Collision()->GetFTileIndex(MapIndexB);
|
||||
m_TileFFlagsB = GameServer()->Collision()->GetFTileFlags(MapIndexB);
|
||||
m_TileFIndexT = GameServer()->Collision()->GetFTileIndex(MapIndexT);
|
||||
m_TileFFlagsT = GameServer()->Collision()->GetFTileFlags(MapIndexT);
|
||||
m_TileSIndex = GameServer()->Collision()->GetDTileIndex(MapIndex, Team());
|
||||
m_TileSFlags = GameServer()->Collision()->GetDTileFlags(MapIndex, Team());
|
||||
m_TileSIndexL = GameServer()->Collision()->GetDTileIndex(MapIndexL, Team());
|
||||
m_TileSFlagsL = GameServer()->Collision()->GetDTileFlags(MapIndexL, Team());
|
||||
m_TileSIndexR = GameServer()->Collision()->GetDTileIndex(MapIndexR, Team());
|
||||
m_TileSFlagsR = GameServer()->Collision()->GetDTileFlags(MapIndexR, Team());
|
||||
m_TileSIndexB = GameServer()->Collision()->GetDTileIndex(MapIndexB, Team());
|
||||
m_TileSFlagsB = GameServer()->Collision()->GetDTileFlags(MapIndexB, Team());
|
||||
m_TileSIndexT = GameServer()->Collision()->GetDTileIndex(MapIndexT, Team());
|
||||
m_TileSFlagsT = GameServer()->Collision()->GetDTileFlags(MapIndexT, Team());
|
||||
//dbg_msg("","N%d L%d R%d B%d T%d",m_TileIndex,m_TileIndexL,m_TileIndexR,m_TileIndexB,m_TileIndexT);
|
||||
//dbg_msg("","N%d L%d R%d B%d T%d",m_TileFIndex,m_TileFIndexL,m_TileFIndexR,m_TileFIndexB,m_TileFIndexT);
|
||||
|
||||
|
@ -908,28 +923,28 @@ void CCharacter::HandleTiles(int Index)
|
|||
{
|
||||
UnFreeze();
|
||||
}
|
||||
if((m_TileIndex == TILE_STOPL || m_TileIndexL == TILE_STOPL || m_TileIndexL == TILE_STOPH || m_TileIndexL == TILE_STOPA || m_TileFIndex == TILE_STOPL || m_TileFIndexL == TILE_STOPL || m_TileFIndexL == TILE_STOPH || m_TileFIndexL == TILE_STOPA || m_TileSIndex == TILE_STOPL || m_TileSIndexL == TILE_STOPL || m_TileSIndexL == TILE_STOPH || m_TileSIndexL == TILE_STOPA) && m_Core.m_Vel.x > 0)
|
||||
if(((m_TileIndex == TILE_STOP && m_TileFlags == ROTATION_270) || (m_TileIndexL == TILE_STOP && m_TileFlagsL == ROTATION_270) || (m_TileIndexL == TILE_STOPS && (m_TileFlagsL == ROTATION_90 || m_TileFlagsL ==ROTATION_270)) || (m_TileIndexL == TILE_STOPA) || (m_TileFIndex == TILE_STOP && m_TileFFlags == ROTATION_270) || (m_TileFIndexL == TILE_STOP && m_TileFFlagsL == ROTATION_270) || (m_TileFIndexL == TILE_STOPS && (m_TileFFlagsL == ROTATION_90 || m_TileFFlagsL == ROTATION_270)) || (m_TileFIndexL == TILE_STOPA) || (m_TileSIndex == TILE_STOP && m_TileSFlags == ROTATION_270) || (m_TileSIndexL == TILE_STOP && m_TileSFlagsL == ROTATION_270) || (m_TileSIndexL == TILE_STOPS && (m_TileSFlagsL == ROTATION_90 || m_TileSFlagsL == ROTATION_270)) || (m_TileSIndexL == TILE_STOPA)) && m_Core.m_Vel.x > 0)
|
||||
{
|
||||
if((int)GameServer()->Collision()->GetPos(MapIndexL).x)
|
||||
if((int)GameServer()->Collision()->GetPos(MapIndexL).x < (int)m_Core.m_Pos.x)
|
||||
m_Core.m_Pos = m_PrevPos;
|
||||
m_Core.m_Vel.x = 0;
|
||||
}
|
||||
if((m_TileIndex == TILE_STOPR || m_TileIndexR == TILE_STOPR || m_TileIndexR == TILE_STOPH || m_TileIndexR == TILE_STOPA || m_TileFIndex == TILE_STOPR || m_TileFIndexR == TILE_STOPR || m_TileFIndexR == TILE_STOPH || m_TileFIndexR == TILE_STOPA || m_TileSIndex == TILE_STOPR || m_TileSIndexR == TILE_STOPR || m_TileSIndexR == TILE_STOPH || m_TileSIndexR == TILE_STOPA) && m_Core.m_Vel.x < 0)
|
||||
if(((m_TileIndex == TILE_STOP && m_TileFlags == ROTATION_90) || (m_TileIndexR == TILE_STOP && m_TileFlagsR == ROTATION_90) || (m_TileIndexR == TILE_STOPS && (m_TileFlagsR == ROTATION_90 || m_TileFlagsR == ROTATION_270)) || (m_TileIndexR == TILE_STOPA) || (m_TileFIndex == TILE_STOP && m_TileFFlags == ROTATION_90) || (m_TileFIndexR == TILE_STOP && m_TileFFlagsR == ROTATION_90) || (m_TileFIndexR == TILE_STOPS && (m_TileFFlagsR == ROTATION_90 || m_TileFFlagsR == ROTATION_270)) || (m_TileFIndexR == TILE_STOPA) || (m_TileSIndex == TILE_STOP && m_TileSFlags == ROTATION_90) || (m_TileSIndexR == TILE_STOP && m_TileSFlagsR == ROTATION_90) || (m_TileSIndexR == TILE_STOPS && (m_TileSFlagsR == ROTATION_90 || m_TileSFlagsR == ROTATION_270)) || (m_TileSIndexR == TILE_STOPA)) && m_Core.m_Vel.x < 0)
|
||||
{
|
||||
if((int)GameServer()->Collision()->GetPos(MapIndexR).x)
|
||||
if((int)GameServer()->Collision()->GetPos(MapIndexR).x > (int)m_Core.m_Pos.x)
|
||||
m_Core.m_Pos = m_PrevPos;
|
||||
m_Core.m_Vel.x = 0;
|
||||
}
|
||||
if((m_TileIndex == TILE_STOPB || m_TileIndexB == TILE_STOPB || m_TileIndexB == TILE_STOPV || m_TileIndexB == TILE_STOPA || m_TileFIndex == TILE_STOPB || m_TileFIndexB == TILE_STOPB || m_TileFIndexB == TILE_STOPV || m_TileFIndexB == TILE_STOPA || m_TileSIndex == TILE_STOPB || m_TileSIndexB == TILE_STOPB || m_TileSIndexB == TILE_STOPV || m_TileSIndexB == TILE_STOPA) && m_Core.m_Vel.y < 0)
|
||||
if(((m_TileIndex == TILE_STOP && m_TileFlags == ROTATION_180) || (m_TileIndexB == TILE_STOP && m_TileFlagsB == ROTATION_180) || (m_TileIndexB == TILE_STOPS && (m_TileFlagsB == ROTATION_0 || m_TileFlagsB == ROTATION_180)) || (m_TileIndexB == TILE_STOPA) || (m_TileFIndex == TILE_STOP && m_TileFFlags == ROTATION_180) || (m_TileFIndexB == TILE_STOP && m_TileFFlagsB == ROTATION_180) || (m_TileFIndexB == TILE_STOPS && (m_TileFFlagsB == ROTATION_0 || m_TileFFlagsB == ROTATION_180)) || (m_TileFIndexB == TILE_STOPA) || (m_TileSIndex == TILE_STOP && m_TileSFlags == ROTATION_180) || (m_TileSIndexB == TILE_STOP && m_TileSFlagsB == ROTATION_180) || (m_TileSIndexB == TILE_STOPS && (m_TileSFlagsB == ROTATION_0 || m_TileSFlagsB == ROTATION_180)) || (m_TileSIndexB == TILE_STOPA)) && m_Core.m_Vel.y < 0)
|
||||
{
|
||||
if((int)GameServer()->Collision()->GetPos(MapIndexB).y)
|
||||
if((int)GameServer()->Collision()->GetPos(MapIndexB).y > (int)m_Core.m_Pos.y)
|
||||
m_Core.m_Pos = m_PrevPos;
|
||||
m_Core.m_Vel.y = 0;
|
||||
}
|
||||
if((m_TileIndex == TILE_STOPT || m_TileIndexT == TILE_STOPT || m_TileIndexT == TILE_STOPV || m_TileIndexT == TILE_STOPA || m_TileFIndex == TILE_STOPT || m_TileFIndexT == TILE_STOPT || m_TileFIndexT == TILE_STOPV || m_TileFIndexT == TILE_STOPA || m_TileSIndex == TILE_STOPT || m_TileSIndexT == TILE_STOPT || m_TileSIndexT == TILE_STOPV || m_TileSIndexT == TILE_STOPA) && m_Core.m_Vel.y > 0)
|
||||
if(((m_TileIndex == TILE_STOP && m_TileFlags == ROTATION_0) || (m_TileIndexT == TILE_STOP && m_TileFlagsT == ROTATION_0) || (m_TileIndexT == TILE_STOPS && (m_TileFlagsT == ROTATION_0 || m_TileFlagsT == ROTATION_180)) || (m_TileIndexT == TILE_STOPA) || (m_TileFIndex == TILE_STOP && m_TileFFlags == ROTATION_0) || (m_TileFIndexT == TILE_STOP && m_TileFFlagsT == ROTATION_0) || (m_TileFIndexT == TILE_STOPS && (m_TileFFlagsT == ROTATION_0 || m_TileFFlagsT == ROTATION_180)) || (m_TileFIndexT == TILE_STOPA) || (m_TileSIndex == TILE_STOP && m_TileSFlags == ROTATION_0) || (m_TileSIndexT == TILE_STOP && m_TileSFlagsT == ROTATION_0) || (m_TileSIndexT == TILE_STOPS && (m_TileSFlagsT == ROTATION_0 || m_TileSFlagsT == ROTATION_180)) || (m_TileSIndexT == TILE_STOPA)) && m_Core.m_Vel.y > 0)
|
||||
{
|
||||
//dbg_msg("","%f %f",GameServer()->Collision()->GetPos(MapIndex).y,m_Core.m_Pos.y);
|
||||
if((int)GameServer()->Collision()->GetPos(MapIndexT).y)
|
||||
|
|
|
@ -188,20 +188,35 @@ public:
|
|||
/*int m_CurrentTile;
|
||||
int m_CurrentFTile;*/
|
||||
int m_TileIndex;
|
||||
int m_TileFlags;
|
||||
int m_TileFIndex;
|
||||
int m_TileFFlags;
|
||||
int m_TileSIndex;
|
||||
int m_TileSFlags;
|
||||
int m_TileIndexL;
|
||||
int m_TileFlagsL;
|
||||
int m_TileFIndexL;
|
||||
int m_TileFFlagsL;
|
||||
int m_TileSIndexL;
|
||||
int m_TileSFlagsL;
|
||||
int m_TileIndexR;
|
||||
int m_TileFlagsR;
|
||||
int m_TileFIndexR;
|
||||
int m_TileFFlagsR;
|
||||
int m_TileSIndexR;
|
||||
int m_TileSFlagsR;
|
||||
int m_TileIndexT;
|
||||
int m_TileFlagsT;
|
||||
int m_TileFIndexT;
|
||||
int m_TileFFlagsT;
|
||||
int m_TileSIndexT;
|
||||
int m_TileSFlagsT;
|
||||
int m_TileIndexB;
|
||||
int m_TileFlagsB;
|
||||
int m_TileFIndexB;
|
||||
int m_TileFFlagsB;
|
||||
int m_TileSIndexB;
|
||||
int m_TileSFlagsB;
|
||||
|
||||
vec2 m_Intersection;
|
||||
bool m_EyeEmote;
|
||||
|
|
|
@ -68,13 +68,13 @@ void CDragger::Drag()
|
|||
if (length(m_Pos-m_Target->m_Pos)>28)
|
||||
{
|
||||
vec2 Temp = m_Target->m_Core.m_Vel +(normalize(m_Pos-m_Target->m_Pos)*m_Strength);
|
||||
if(Temp.x > 0 && (m_Target->m_TileIndex == TILE_STOPL || m_Target->m_TileIndexL == TILE_STOPL || m_Target->m_TileIndexL == TILE_STOPH || m_Target->m_TileIndexL == TILE_STOPA || m_Target->m_TileFIndex == TILE_STOPL || m_Target->m_TileFIndexL == TILE_STOPL || m_Target->m_TileFIndexL == TILE_STOPH || m_Target->m_TileFIndexL == TILE_STOPA || m_Target->m_TileSIndex == TILE_STOPL || m_Target->m_TileSIndexL == TILE_STOPL || m_Target->m_TileSIndexL == TILE_STOPH || m_Target->m_TileSIndexL == TILE_STOPA))
|
||||
if(Temp.x > 0 && ((m_Target->m_TileIndex == TILE_STOP && m_Target->m_TileFlags == ROTATION_270) || (m_Target->m_TileIndexL == TILE_STOP && m_Target->m_TileFlagsL == ROTATION_270) || (m_Target->m_TileIndexL == TILE_STOPS && (m_Target->m_TileFlagsL == ROTATION_90 || m_Target->m_TileFlagsL ==ROTATION_270)) || (m_Target->m_TileIndexL == TILE_STOPA) || (m_Target->m_TileFIndex == TILE_STOP && m_Target->m_TileFFlags == ROTATION_270) || (m_Target->m_TileFIndexL == TILE_STOP && m_Target->m_TileFFlagsL == ROTATION_270) || (m_Target->m_TileFIndexL == TILE_STOPS && (m_Target->m_TileFFlagsL == ROTATION_90 || m_Target->m_TileFFlagsL == ROTATION_270)) || (m_Target->m_TileFIndexL == TILE_STOPA) || (m_Target->m_TileSIndex == TILE_STOP && m_Target->m_TileSFlags == ROTATION_270) || (m_Target->m_TileSIndexL == TILE_STOP && m_Target->m_TileSFlagsL == ROTATION_270) || (m_Target->m_TileSIndexL == TILE_STOPS && (m_Target->m_TileSFlagsL == ROTATION_90 || m_Target->m_TileSFlagsL == ROTATION_270)) || (m_Target->m_TileSIndexL == TILE_STOPA)))
|
||||
Temp.x = 0;
|
||||
if(Temp.x < 0 && (m_Target->m_TileIndex == TILE_STOPR || m_Target->m_TileIndexR == TILE_STOPR || m_Target->m_TileIndexR == TILE_STOPH || m_Target->m_TileIndexR == TILE_STOPA || m_Target->m_TileFIndex == TILE_STOPR || m_Target->m_TileFIndexR == TILE_STOPR || m_Target->m_TileFIndexR == TILE_STOPH || m_Target->m_TileFIndexR == TILE_STOPA || m_Target->m_TileSIndex == TILE_STOPR || m_Target->m_TileSIndexR == TILE_STOPR || m_Target->m_TileSIndexR == TILE_STOPH || m_Target->m_TileSIndexR == TILE_STOPA))
|
||||
if(Temp.x < 0 && ((m_Target->m_TileIndex == TILE_STOP && m_Target->m_TileFlags == ROTATION_90) || (m_Target->m_TileIndexR == TILE_STOP && m_Target->m_TileFlagsR == ROTATION_90) || (m_Target->m_TileIndexR == TILE_STOPS && (m_Target->m_TileFlagsR == ROTATION_90 || m_Target->m_TileFlagsR == ROTATION_270)) || (m_Target->m_TileIndexR == TILE_STOPA) || (m_Target->m_TileFIndex == TILE_STOP && m_Target->m_TileFFlags == ROTATION_90) || (m_Target->m_TileFIndexR == TILE_STOP && m_Target->m_TileFFlagsR == ROTATION_90) || (m_Target->m_TileFIndexR == TILE_STOPS && (m_Target->m_TileFFlagsR == ROTATION_90 || m_Target->m_TileFFlagsR == ROTATION_270)) || (m_Target->m_TileFIndexR == TILE_STOPA) || (m_Target->m_TileSIndex == TILE_STOP && m_Target->m_TileSFlags == ROTATION_90) || (m_Target->m_TileSIndexR == TILE_STOP && m_Target->m_TileSFlagsR == ROTATION_90) || (m_Target->m_TileSIndexR == TILE_STOPS && (m_Target->m_TileSFlagsR == ROTATION_90 || m_Target->m_TileSFlagsR == ROTATION_270)) || (m_Target->m_TileSIndexR == TILE_STOPA)))
|
||||
Temp.x = 0;
|
||||
if(Temp.y < 0 && (m_Target->m_TileIndex == TILE_STOPB || m_Target->m_TileIndexB == TILE_STOPB || m_Target->m_TileIndexB == TILE_STOPV || m_Target->m_TileIndexB == TILE_STOPA || m_Target->m_TileFIndex == TILE_STOPB || m_Target->m_TileFIndexB == TILE_STOPB || m_Target->m_TileFIndexB == TILE_STOPV || m_Target->m_TileFIndexB == TILE_STOPA || m_Target->m_TileSIndex == TILE_STOPB || m_Target->m_TileSIndexB == TILE_STOPB || m_Target->m_TileSIndexB == TILE_STOPV || m_Target->m_TileSIndexB == TILE_STOPA))
|
||||
if(Temp.y < 0 && ((m_Target->m_TileIndex == TILE_STOP && m_Target->m_TileFlags == ROTATION_180) || (m_Target->m_TileIndexB == TILE_STOP && m_Target->m_TileFlagsB == ROTATION_180) || (m_Target->m_TileIndexB == TILE_STOPS && (m_Target->m_TileFlagsB == ROTATION_0 || m_Target->m_TileFlagsB == ROTATION_180)) || (m_Target->m_TileIndexB == TILE_STOPA) || (m_Target->m_TileFIndex == TILE_STOP && m_Target->m_TileFFlags == ROTATION_180) || (m_Target->m_TileFIndexB == TILE_STOP && m_Target->m_TileFFlagsB == ROTATION_180) || (m_Target->m_TileFIndexB == TILE_STOPS && (m_Target->m_TileFFlagsB == ROTATION_0 || m_Target->m_TileFFlagsB == ROTATION_180)) || (m_Target->m_TileFIndexB == TILE_STOPA) || (m_Target->m_TileSIndex == TILE_STOP && m_Target->m_TileSFlags == ROTATION_180) || (m_Target->m_TileSIndexB == TILE_STOP && m_Target->m_TileSFlagsB == ROTATION_180) || (m_Target->m_TileSIndexB == TILE_STOPS && (m_Target->m_TileSFlagsB == ROTATION_0 || m_Target->m_TileSFlagsB == ROTATION_180)) || (m_Target->m_TileSIndexB == TILE_STOPA)))
|
||||
Temp.y = 0;
|
||||
if(Temp.y > 0 && (m_Target->m_TileIndex == TILE_STOPT || m_Target->m_TileIndexT == TILE_STOPT || m_Target->m_TileIndexT == TILE_STOPV || m_Target->m_TileIndexT == TILE_STOPA || m_Target->m_TileFIndex == TILE_STOPT || m_Target->m_TileFIndexT == TILE_STOPT || m_Target->m_TileFIndexT == TILE_STOPV || m_Target->m_TileFIndexT == TILE_STOPA || m_Target->m_TileSIndex == TILE_STOPT || m_Target->m_TileSIndexT == TILE_STOPT || m_Target->m_TileSIndexT == TILE_STOPV || m_Target->m_TileSIndexT == TILE_STOPA))
|
||||
if(Temp.y > 0 && ((m_Target->m_TileIndex == TILE_STOP && m_Target->m_TileFlags == ROTATION_0) || (m_Target->m_TileIndexT == TILE_STOP && m_Target->m_TileFlagsT == ROTATION_0) || (m_Target->m_TileIndexT == TILE_STOPS && (m_Target->m_TileFlagsT == ROTATION_0 || m_Target->m_TileFlagsT == ROTATION_180)) || (m_Target->m_TileIndexT == TILE_STOPA) || (m_Target->m_TileFIndex == TILE_STOP && m_Target->m_TileFFlags == ROTATION_0) || (m_Target->m_TileFIndexT == TILE_STOP && m_Target->m_TileFFlagsT == ROTATION_0) || (m_Target->m_TileFIndexT == TILE_STOPS && (m_Target->m_TileFFlagsT == ROTATION_0 || m_Target->m_TileFFlagsT == ROTATION_180)) || (m_Target->m_TileFIndexT == TILE_STOPA) || (m_Target->m_TileSIndex == TILE_STOP && m_Target->m_TileSFlags == ROTATION_0) || (m_Target->m_TileSIndexT == TILE_STOP && m_Target->m_TileSFlagsT == ROTATION_0) || (m_Target->m_TileSIndexT == TILE_STOPS && (m_Target->m_TileSFlagsT == ROTATION_0 || m_Target->m_TileSFlagsT == ROTATION_180)) || (m_Target->m_TileSIndexT == TILE_STOPA)))
|
||||
Temp.y = 0;
|
||||
m_Target->m_Core.m_Vel = Temp;
|
||||
}
|
||||
|
@ -90,11 +90,12 @@ void CDragger::Tick()
|
|||
{
|
||||
if (Server()->Tick()%int(Server()->TickSpeed()*0.15f)==0)
|
||||
{
|
||||
int Flags;
|
||||
m_EvalTick=Server()->Tick();
|
||||
int Index = GameServer()->Collision()->IsCp(m_Pos.x, m_Pos.y);
|
||||
if (Index)
|
||||
int index = GameServer()->Collision()->IsCp(m_Pos.x,m_Pos.y, &Flags);
|
||||
if (index)
|
||||
{
|
||||
m_Core=GameServer()->Collision()->CpSpeed(Index);
|
||||
m_Core=GameServer()->Collision()->CpSpeed(index, Flags);
|
||||
}
|
||||
m_Pos+=m_Core;
|
||||
Move();
|
||||
|
|
|
@ -72,11 +72,12 @@ void CGun::Tick()
|
|||
{
|
||||
if (Server()->Tick()%int(Server()->TickSpeed()*0.15f)==0)
|
||||
{
|
||||
int Flags;
|
||||
m_EvalTick=Server()->Tick();
|
||||
int Index = GameServer()->Collision()->IsCp(m_Pos.x,m_Pos.y);
|
||||
if (Index)
|
||||
int index = GameServer()->Collision()->IsCp(m_Pos.x,m_Pos.y, &Flags);
|
||||
if (index)
|
||||
{
|
||||
m_Core=GameServer()->Collision()->CpSpeed(Index);
|
||||
m_Core=GameServer()->Collision()->CpSpeed(index, Flags);
|
||||
}
|
||||
m_Pos+=m_Core;
|
||||
Fire();
|
||||
|
|
|
@ -81,11 +81,12 @@ void CLight::Tick()
|
|||
|
||||
if (Server()->Tick()%int(Server()->TickSpeed()*0.15f)==0)
|
||||
{
|
||||
int Flags;
|
||||
m_EvalTick=Server()->Tick();
|
||||
int index = GameServer()->Collision()->IsCp(m_Pos.x,m_Pos.y);
|
||||
int index = GameServer()->Collision()->IsCp(m_Pos.x,m_Pos.y, &Flags);
|
||||
if (index)
|
||||
{
|
||||
m_Core=GameServer()->Collision()->CpSpeed(index);
|
||||
m_Core=GameServer()->Collision()->CpSpeed(index, Flags);
|
||||
}
|
||||
m_Pos+=m_Core;
|
||||
Step();
|
||||
|
|
|
@ -28,11 +28,12 @@ void CPickup::Move()
|
|||
{
|
||||
if (Server()->Tick()%int(Server()->TickSpeed() * 0.15f) == 0)
|
||||
{
|
||||
int index = GameServer()->Collision()->IsCp(m_Pos.x, m_Pos.y);
|
||||
if (index)
|
||||
{
|
||||
m_Core = GameServer()->Collision()->CpSpeed(index);
|
||||
}
|
||||
int Flags;
|
||||
int index = GameServer()->Collision()->IsCp(m_Pos.x,m_Pos.y, &Flags);
|
||||
if (index)
|
||||
{
|
||||
m_Core=GameServer()->Collision()->CpSpeed(index, Flags);
|
||||
}
|
||||
m_Pos += m_Core;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2533,7 +2533,7 @@ void CGameContext::OnInit(/*class IKernel *pKernel*/)
|
|||
if(Index >= ENTITY_OFFSET)
|
||||
{
|
||||
vec2 Pos(x*32.0f+16.0f, y*32.0f+16.0f);
|
||||
m_pController->OnEntity(Index-ENTITY_OFFSET, Pos,false);
|
||||
m_pController->OnEntity(Index-ENTITY_OFFSET, Pos, false, pTiles[y*pTileMap->m_Width+x].m_Flags);
|
||||
}
|
||||
if(pFront)
|
||||
{
|
||||
|
@ -2549,7 +2549,7 @@ void CGameContext::OnInit(/*class IKernel *pKernel*/)
|
|||
if(Index >= ENTITY_OFFSET)
|
||||
{
|
||||
vec2 Pos(x*32.0f+16.0f, y*32.0f+16.0f);
|
||||
m_pController->OnEntity(Index-ENTITY_OFFSET, Pos,true);
|
||||
m_pController->OnEntity(Index-ENTITY_OFFSET, Pos, true, pFront[y*pTileMap->m_Width+x].m_Flags);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -123,7 +123,7 @@ bool IGameController::CanSpawn(CPlayer *pPlayer, vec2 *pOutPos)
|
|||
return Eval.m_Got;
|
||||
}
|
||||
|
||||
bool IGameController::OnEntity(int Index, vec2 Pos, bool Front)
|
||||
bool IGameController::OnEntity(int Index, vec2 Pos, bool Front, int Flags)
|
||||
{
|
||||
if (Index<0)
|
||||
return false;
|
||||
|
@ -153,53 +153,59 @@ bool IGameController::OnEntity(int Index, vec2 Pos, bool Front)
|
|||
else if(Index == ENTITY_SPAWN_BLUE)
|
||||
m_aaSpawnPoints[2][m_aNumSpawnPoints[2]++] = Pos;
|
||||
|
||||
else if(Index >= ENTITY_CRAZY_SHOTGUN_U_EX && Index <= ENTITY_CRAZY_SHOTGUN_L_EX)
|
||||
else if(Index == ENTITY_CRAZY_SHOTGUN_EX/* && Index <= ENTITY_CRAZY_SHOTGUN_L_EX*/)
|
||||
{
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
if (Index - ENTITY_CRAZY_SHOTGUN_U_EX == i)
|
||||
{
|
||||
float Deg = i*(pi/2);
|
||||
CProjectile *bullet = new CProjectile
|
||||
(
|
||||
&GameServer()->m_World,
|
||||
WEAPON_SHOTGUN, //Type
|
||||
-1, //Owner
|
||||
Pos, //Pos
|
||||
vec2(sin(Deg),cos(Deg)), //Dir
|
||||
-2, //Span
|
||||
true, //Freeze
|
||||
true, //Explosive
|
||||
0,//Force
|
||||
(g_Config.m_SvShotgunBulletSound)?SOUND_GRENADE_EXPLODE:-1,//SoundImpact
|
||||
WEAPON_SHOTGUN//Weapon
|
||||
);
|
||||
bullet->SetBouncing(2 - (i % 2));
|
||||
|
||||
}
|
||||
}
|
||||
dbg_msg("","Flags %d",Flags);
|
||||
int Dir;
|
||||
if(!Flags)
|
||||
Dir = 0;
|
||||
else if(Flags == ROTATION_90)
|
||||
Dir = 1;
|
||||
else if(Flags == ROTATION_180)
|
||||
Dir = 2;
|
||||
else
|
||||
Dir = 3;
|
||||
float Deg = Dir*(pi/2);
|
||||
CProjectile *bullet = new CProjectile
|
||||
(
|
||||
&GameServer()->m_World,
|
||||
WEAPON_SHOTGUN, //Type
|
||||
-1, //Owner
|
||||
Pos, //Pos
|
||||
vec2(sin(Deg),cos(Deg)), //Dir
|
||||
-2, //Span
|
||||
true, //Freeze
|
||||
true, //Explosive
|
||||
0,//Force
|
||||
(g_Config.m_SvShotgunBulletSound)?SOUND_GRENADE_EXPLODE:-1,//SoundImpact
|
||||
WEAPON_SHOTGUN//Weapon
|
||||
);
|
||||
bullet->SetBouncing(2 - (Dir % 2));
|
||||
}
|
||||
else if(Index >= ENTITY_CRAZY_SHOTGUN_U && Index <= ENTITY_CRAZY_SHOTGUN_L)
|
||||
else if(Index == ENTITY_CRAZY_SHOTGUN)
|
||||
{
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
if (Index - ENTITY_CRAZY_SHOTGUN_U == i)
|
||||
{
|
||||
float Deg = i*(pi/2);
|
||||
CProjectile *bullet = new CProjectile(&GameServer()->m_World,
|
||||
WEAPON_SHOTGUN, //Type
|
||||
-1, //Owner
|
||||
Pos, //Pos
|
||||
vec2(sin(Deg),cos(Deg)), //Dir
|
||||
-2, //Span
|
||||
true, //Freeze
|
||||
false, //Explosive
|
||||
0,
|
||||
SOUND_GRENADE_EXPLODE,
|
||||
WEAPON_SHOTGUN);
|
||||
bullet->SetBouncing(2 - (i % 2));
|
||||
}
|
||||
}
|
||||
int Dir;
|
||||
if(!Flags)
|
||||
Dir=0;
|
||||
else if(Flags == (TILEFLAG_ROTATE))
|
||||
Dir = 1;
|
||||
else if(Flags == (TILEFLAG_VFLIP|TILEFLAG_HFLIP))
|
||||
Dir = 2;
|
||||
else
|
||||
Dir = 3;
|
||||
float Deg = Dir*(pi/2);
|
||||
CProjectile *bullet = new CProjectile(&GameServer()->m_World,
|
||||
WEAPON_SHOTGUN, //Type
|
||||
-1, //Owner
|
||||
Pos, //Pos
|
||||
vec2(sin(Deg),cos(Deg)), //Dir
|
||||
-2, //Span
|
||||
true, //Freeze
|
||||
false, //Explosive
|
||||
0,
|
||||
SOUND_GRENADE_EXPLODE,
|
||||
WEAPON_SHOTGUN);
|
||||
bullet->SetBouncing(2 - (Dir % 2));
|
||||
}
|
||||
|
||||
if(Index == ENTITY_ARMOR_1)
|
||||
|
|
|
@ -106,7 +106,7 @@ public:
|
|||
Returns:
|
||||
bool?
|
||||
*/
|
||||
virtual bool OnEntity(int Index, vec2 Pos, bool Front);
|
||||
virtual bool OnEntity(int Index, vec2 Pos, bool Front, int Flags);
|
||||
|
||||
|
||||
/*
|
||||
|
|
Loading…
Reference in a new issue