Add BONUS tile, opposite of PENALTY (for Saavik's new map)

This commit is contained in:
def 2015-03-10 22:57:40 +01:00
parent b46001ca5a
commit 05970cc2e2
8 changed files with 43 additions and 3 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 314 KiB

After

Width:  |  Height:  |  Size: 315 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 180 KiB

After

Width:  |  Height:  |  Size: 182 KiB

View file

@ -100,7 +100,7 @@ void CCollision::Init(class CLayers *pLayers)
if(Index <= TILE_NPH_START)
{
if(Index >= TILE_JUMP && Index <= TILE_PENALTY)
if(Index >= TILE_JUMP && Index <= TILE_BONUS)
m_pSwitch[i].m_Type = Index;
else
m_pSwitch[i].m_Type = 0;

View file

@ -991,6 +991,11 @@ int CEditorMap::Load(class IStorage *pStorage, const char *pFileName, int Storag
((CLayerTiles*)pTiles)->m_pTiles[i].m_Index = TILE_PENALTY;
((CLayerTiles*)pTiles)->m_pTiles[i].m_Flags = ((CLayerSwitch*)pTiles)->m_pSwitchTile[i].m_Flags;
}
else if(((CLayerSwitch*)pTiles)->m_pSwitchTile[i].m_Type == TILE_BONUS)
{
((CLayerTiles*)pTiles)->m_pTiles[i].m_Index = TILE_BONUS;
((CLayerTiles*)pTiles)->m_pTiles[i].m_Flags = ((CLayerSwitch*)pTiles)->m_pSwitchTile[i].m_Flags;
}
}
}
DataFile.UnloadData(pTilemapItem->m_Switch);

View file

@ -243,7 +243,7 @@ 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)
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)
{
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;
@ -1421,7 +1421,7 @@ 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)
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(m_pEditor->m_SwitchNum != l->m_SwitchNumber || m_pEditor->m_SwitchDelay != l->m_SwitchDelay)
{

View file

@ -144,6 +144,7 @@ enum
TILE_SUPER_END,
TILE_JETPACK_END,
TILE_NPH_END,
TILE_BONUS = 95,
TILE_NPC_START = 104,
TILE_SUPER_START,
TILE_JETPACK_START,

View file

@ -41,6 +41,7 @@ bool CCharacter::Spawn(CPlayer *pPlayer, vec2 Pos)
m_QueuedWeapon = -1;
m_LastRefillJumps = false;
m_LastPenalty = false;
m_LastBonus = false;
m_pPlayer = pPlayer;
m_Pos = Pos;
@ -1360,6 +1361,7 @@ void CCharacter::HandleTiles(int Index)
{
m_LastRefillJumps = false;
m_LastPenalty = false;
m_LastBonus = false;
return;
}
int cp = GameServer()->Collision()->IsCheckpoint(MapIndex);
@ -1755,12 +1757,43 @@ void CCharacter::HandleTiles(int Index)
m_LastPenalty = true;
}
else if(GameServer()->Collision()->IsSwitch(MapIndex) == TILE_BONUS && !m_LastBonus)
{
int min = GameServer()->Collision()->GetSwitchDelay(MapIndex);
int sec = GameServer()->Collision()->GetSwitchNumber(MapIndex);
int Team = Teams()->m_Core.Team(m_Core.m_Id);
m_StartTime += (min * 60 + sec) * Server()->TickSpeed();
if (m_StartTime > Server()->Tick())
m_StartTime = Server()->Tick();
if (Team != TEAM_FLOCK && Team != TEAM_SUPER)
{
for (int i = 0; i < MAX_CLIENTS; i++)
{
if(Teams()->m_Core.Team(i) == Team && i != m_Core.m_Id && GameServer()->m_apPlayers[i])
{
CCharacter* pChar = GameServer()->m_apPlayers[i]->GetCharacter();
if (pChar)
pChar->m_StartTime = m_StartTime;
}
}
}
m_LastBonus = true;
}
if(GameServer()->Collision()->IsSwitch(MapIndex) != TILE_PENALTY)
{
m_LastPenalty = false;
}
if(GameServer()->Collision()->IsSwitch(MapIndex) != TILE_BONUS)
{
m_LastBonus = false;
}
int z = GameServer()->Collision()->IsTeleport(MapIndex);
if(!g_Config.m_SvOldTeleportHook && !g_Config.m_SvOldTeleportWeapons && z && Controller->m_TeleOuts[z-1].size())
{

View file

@ -240,6 +240,7 @@ public:
int64 m_LastStartWarning;
bool m_LastRefillJumps;
bool m_LastPenalty;
bool m_LastBonus;
// Setters/Getters because i don't want to modify vanilla vars access modifiers
int GetLastWeapon() { return m_LastWeapon; };