mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-19 14:38:18 +00:00
add tele-activator to the switch layer
This commit is contained in:
parent
c831b5e0c1
commit
ddf2e6af36
|
@ -104,7 +104,7 @@ void CCollision::Init(class CLayers *pLayers)
|
|||
|
||||
if(Index <= TILE_NPH_START)
|
||||
{
|
||||
if(Index >= TILE_JUMP && Index <= TILE_BONUS)
|
||||
if((Index >= TILE_JUMP && Index <= TILE_BONUS) || Index == TILE_ALLOW_TELE_GUN)
|
||||
m_pSwitch[i].m_Type = Index;
|
||||
else
|
||||
m_pSwitch[i].m_Type = 0;
|
||||
|
|
|
@ -953,7 +953,8 @@ int CEditorMap::Load(class IStorage *pStorage, const char *pFileName, int Storag
|
|||
TILE_HIT_END,
|
||||
TILE_JUMP,
|
||||
TILE_PENALTY,
|
||||
TILE_BONUS
|
||||
TILE_BONUS,
|
||||
TILE_ALLOW_TELE_GUN
|
||||
};
|
||||
CSwitchTile *pLayerSwitchTiles = ((CLayerSwitch *)pTiles)->m_pSwitchTile;
|
||||
mem_copy(((CLayerSwitch *)pTiles)->m_pSwitchTile, pSwitchData, pTiles->m_Width*pTiles->m_Height*sizeof(CSwitchTile));
|
||||
|
|
|
@ -271,7 +271,20 @@ int CLayerTiles::BrushGrab(CLayerGroup *pBrush, CUIRect Rect)
|
|||
for(int x = 0; x < r.w; x++)
|
||||
{
|
||||
pGrabbed->m_pSwitchTile[y*pGrabbed->m_Width+x] = ((CLayerSwitch*)this)->m_pSwitchTile[(r.y+y)*m_Width+(r.x+x)];
|
||||
if(pGrabbed->m_pSwitchTile[y*pGrabbed->m_Width+x].m_Type == ENTITY_DOOR + ENTITY_OFFSET || pGrabbed->m_pSwitchTile[y*pGrabbed->m_Width+x].m_Type == TILE_HIT_START || pGrabbed->m_pSwitchTile[y*pGrabbed->m_Width+x].m_Type == TILE_HIT_END || pGrabbed->m_pSwitchTile[y*pGrabbed->m_Width+x].m_Type == TILE_SWITCHOPEN || pGrabbed->m_pSwitchTile[y*pGrabbed->m_Width+x].m_Type == TILE_SWITCHCLOSE || pGrabbed->m_pSwitchTile[y*pGrabbed->m_Width+x].m_Type == TILE_SWITCHTIMEDOPEN || pGrabbed->m_pSwitchTile[y*pGrabbed->m_Width+x].m_Type == TILE_SWITCHTIMEDCLOSE || pGrabbed->m_pSwitchTile[y*pGrabbed->m_Width+x].m_Type == ENTITY_LASER_LONG + ENTITY_OFFSET || pGrabbed->m_pSwitchTile[y*pGrabbed->m_Width+x].m_Type == ENTITY_LASER_MEDIUM + ENTITY_OFFSET || pGrabbed->m_pSwitchTile[y*pGrabbed->m_Width+x].m_Type == ENTITY_LASER_SHORT + ENTITY_OFFSET || pGrabbed->m_pSwitchTile[y*pGrabbed->m_Width+x].m_Type == TILE_JUMP || pGrabbed->m_pSwitchTile[y*pGrabbed->m_Width+x].m_Type == TILE_PENALTY || pGrabbed->m_pSwitchTile[y*pGrabbed->m_Width+x].m_Type == TILE_BONUS)
|
||||
if(pGrabbed->m_pSwitchTile[y*pGrabbed->m_Width+x].m_Type == ENTITY_DOOR + ENTITY_OFFSET
|
||||
|| pGrabbed->m_pSwitchTile[y*pGrabbed->m_Width+x].m_Type == TILE_HIT_START
|
||||
|| pGrabbed->m_pSwitchTile[y*pGrabbed->m_Width+x].m_Type == TILE_HIT_END
|
||||
|| pGrabbed->m_pSwitchTile[y*pGrabbed->m_Width+x].m_Type == TILE_SWITCHOPEN
|
||||
|| pGrabbed->m_pSwitchTile[y*pGrabbed->m_Width+x].m_Type == TILE_SWITCHCLOSE
|
||||
|| pGrabbed->m_pSwitchTile[y*pGrabbed->m_Width+x].m_Type == TILE_SWITCHTIMEDOPEN
|
||||
|| pGrabbed->m_pSwitchTile[y*pGrabbed->m_Width+x].m_Type == TILE_SWITCHTIMEDCLOSE
|
||||
|| pGrabbed->m_pSwitchTile[y*pGrabbed->m_Width+x].m_Type == ENTITY_LASER_LONG + ENTITY_OFFSET
|
||||
|| pGrabbed->m_pSwitchTile[y*pGrabbed->m_Width+x].m_Type == ENTITY_LASER_MEDIUM + ENTITY_OFFSET
|
||||
|| pGrabbed->m_pSwitchTile[y*pGrabbed->m_Width+x].m_Type == ENTITY_LASER_SHORT + ENTITY_OFFSET
|
||||
|| pGrabbed->m_pSwitchTile[y*pGrabbed->m_Width+x].m_Type == TILE_JUMP
|
||||
|| pGrabbed->m_pSwitchTile[y*pGrabbed->m_Width+x].m_Type == TILE_PENALTY
|
||||
|| pGrabbed->m_pSwitchTile[y*pGrabbed->m_Width+x].m_Type == TILE_BONUS
|
||||
|| pGrabbed->m_pSwitchTile[y*pGrabbed->m_Width+x].m_Type == TILE_ALLOW_TELE_GUN)
|
||||
{
|
||||
m_pEditor->m_SwitchNum = pGrabbed->m_pSwitchTile[y*pGrabbed->m_Width+x].m_Number;
|
||||
m_pEditor->m_SwitchDelay = pGrabbed->m_pSwitchTile[y*pGrabbed->m_Width+x].m_Delay;
|
||||
|
@ -1509,7 +1522,20 @@ void CLayerSwitch::BrushDraw(CLayer *pBrush, float wx, float wy)
|
|||
if(fx<0 || fx >= m_Width || fy < 0 || fy >= m_Height)
|
||||
continue;
|
||||
|
||||
if((l->m_pTiles[y*l->m_Width+x].m_Index >= (ENTITY_ARMOR_1 + 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_HIT_START || l->m_pTiles[y*l->m_Width+x].m_Index == TILE_HIT_END || l->m_pTiles[y*l->m_Width+x].m_Index == TILE_SWITCHOPEN || l->m_pTiles[y*l->m_Width+x].m_Index == TILE_SWITCHCLOSE || l->m_pTiles[y*l->m_Width+x].m_Index == TILE_SWITCHTIMEDOPEN || l->m_pTiles[y*l->m_Width+x].m_Index == TILE_SWITCHTIMEDCLOSE || l->m_pTiles[y*l->m_Width+x].m_Index == TILE_FREEZE || l->m_pTiles[y*l->m_Width+x].m_Index == TILE_DFREEZE || l->m_pTiles[y*l->m_Width+x].m_Index == TILE_DUNFREEZE || l->m_pTiles[y*l->m_Width+x].m_Index == TILE_JUMP || l->m_pTiles[y*l->m_Width+x].m_Index == TILE_PENALTY || l->m_pTiles[y*l->m_Width+x].m_Index == TILE_BONUS)
|
||||
if((l->m_pTiles[y*l->m_Width+x].m_Index >= (ENTITY_ARMOR_1 + 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_HIT_START
|
||||
|| l->m_pTiles[y*l->m_Width+x].m_Index == TILE_HIT_END
|
||||
|| l->m_pTiles[y*l->m_Width+x].m_Index == TILE_SWITCHOPEN
|
||||
|| l->m_pTiles[y*l->m_Width+x].m_Index == TILE_SWITCHCLOSE
|
||||
|| l->m_pTiles[y*l->m_Width+x].m_Index == TILE_SWITCHTIMEDOPEN
|
||||
|| l->m_pTiles[y*l->m_Width+x].m_Index == TILE_SWITCHTIMEDCLOSE
|
||||
|| l->m_pTiles[y*l->m_Width+x].m_Index == TILE_FREEZE
|
||||
|| l->m_pTiles[y*l->m_Width+x].m_Index == TILE_DFREEZE
|
||||
|| l->m_pTiles[y*l->m_Width+x].m_Index == TILE_DUNFREEZE
|
||||
|| l->m_pTiles[y*l->m_Width+x].m_Index == TILE_JUMP
|
||||
|| l->m_pTiles[y*l->m_Width+x].m_Index == TILE_PENALTY
|
||||
|| l->m_pTiles[y*l->m_Width+x].m_Index == TILE_BONUS
|
||||
|| l->m_pTiles[y*l->m_Width+x].m_Index == TILE_ALLOW_TELE_GUN)
|
||||
{
|
||||
if(m_pEditor->m_SwitchNum != l->m_SwitchNumber || m_pEditor->m_SwitchDelay != l->m_SwitchDelay)
|
||||
{
|
||||
|
|
|
@ -75,6 +75,7 @@ bool IsValidSwitchTile(int Index)
|
|||
|| (Index >= TILE_SWITCHTIMEDOPEN && Index <= TILE_SWITCHCLOSE)
|
||||
|| Index == TILE_PENALTY
|
||||
|| Index == TILE_BONUS
|
||||
|| Index == TILE_ALLOW_TELE_GUN
|
||||
|| IsValidEntity(Index)
|
||||
);
|
||||
}
|
||||
|
|
|
@ -198,11 +198,12 @@ void CLaser::DoBounce()
|
|||
int MapIndex = GameServer()->Collision()->GetPureMapIndex(Coltile);
|
||||
int TileIndex = GameServer()->Collision()->GetTileIndex(MapIndex);
|
||||
int TileFIndex = GameServer()->Collision()->GetFTileIndex(MapIndex);
|
||||
bool IsSwitchTeleGun = GameServer()->Collision()->IsSwitch(MapIndex) == TILE_ALLOW_TELE_GUN;
|
||||
|
||||
// Teleport is canceled if the last bounce tile is not a TILE_ALLOW_TELE_GUN.
|
||||
// Teleport also works if laser didn't bounce.
|
||||
m_TeleportCancelled =
|
||||
m_Type == WEAPON_RIFLE && (TileIndex != TILE_ALLOW_TELE_GUN && TileFIndex != TILE_ALLOW_TELE_GUN);
|
||||
m_Type == WEAPON_RIFLE && (TileIndex != TILE_ALLOW_TELE_GUN && TileFIndex != TILE_ALLOW_TELE_GUN && !IsSwitchTeleGun);
|
||||
}
|
||||
|
||||
//m_Owner = -1;
|
||||
|
|
|
@ -177,8 +177,12 @@ void CProjectile::Tick()
|
|||
int MapIndex = GameServer()->Collision()->GetPureMapIndex(pTargetChr ? pTargetChr->m_Pos : ColPos);
|
||||
int TileIndex = GameServer()->Collision()->GetTileIndex(MapIndex);
|
||||
int TileFIndex = GameServer()->Collision()->GetFTileIndex(MapIndex);
|
||||
bool IsSwitchTeleGun = GameServer()->Collision()->IsSwitch(MapIndex) == TILE_ALLOW_TELE_GUN;
|
||||
|
||||
if (TileIndex == TILE_ALLOW_TELE_GUN || TileFIndex == TILE_ALLOW_TELE_GUN || pTargetChr)
|
||||
if (TileIndex == TILE_ALLOW_TELE_GUN
|
||||
|| TileFIndex == TILE_ALLOW_TELE_GUN
|
||||
|| IsSwitchTeleGun
|
||||
|| pTargetChr)
|
||||
{
|
||||
bool Found;
|
||||
vec2 PossiblePos;
|
||||
|
|
Loading…
Reference in a new issue