mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 01:58:19 +00:00
Add penalty tile
This commit is contained in:
parent
67ede77105
commit
42ed2807cb
Binary file not shown.
Before Width: | Height: | Size: 274 KiB After Width: | Height: | Size: 275 KiB |
Binary file not shown.
Before Width: | Height: | Size: 170 KiB After Width: | Height: | Size: 161 KiB |
|
@ -92,7 +92,7 @@ void CCollision::Init(class CLayers *pLayers)
|
|||
|
||||
if(Index <= TILE_NPH_START)
|
||||
{
|
||||
if(Index >= TILE_JUMP && Index <= TILE_SWITCHCLOSE)
|
||||
if(Index >= TILE_JUMP && Index <= TILE_PENALTY)
|
||||
m_pSwitch[i].m_Type = Index;
|
||||
else
|
||||
m_pSwitch[i].m_Type = 0;
|
||||
|
|
|
@ -819,6 +819,11 @@ int CEditorMap::Load(class IStorage *pStorage, const char *pFileName, int Storag
|
|||
((CLayerTiles*)pTiles)->m_pTiles[i].m_Index = TILE_JUMP;
|
||||
((CLayerTiles*)pTiles)->m_pTiles[i].m_Flags = ((CLayerSwitch*)pTiles)->m_pSwitchTile[i].m_Flags;
|
||||
}
|
||||
else if(((CLayerSwitch*)pTiles)->m_pSwitchTile[i].m_Type == TILE_PENALTY)
|
||||
{
|
||||
((CLayerTiles*)pTiles)->m_pTiles[i].m_Index = TILE_PENALTY;
|
||||
((CLayerTiles*)pTiles)->m_pTiles[i].m_Flags = ((CLayerSwitch*)pTiles)->m_pSwitchTile[i].m_Flags;
|
||||
}
|
||||
}
|
||||
}
|
||||
DataFile.UnloadData(pTilemapItem->m_Switch);
|
||||
|
|
|
@ -240,7 +240,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)
|
||||
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)
|
||||
{
|
||||
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;
|
||||
|
@ -1331,7 +1331,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)
|
||||
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(m_pEditor->m_SwitchNum != l->m_SwitchNumber || m_pEditor->m_SwitchDelay != l->m_SwitchDelay)
|
||||
{
|
||||
|
|
|
@ -123,6 +123,7 @@ enum
|
|||
TILE_STOP = 60,
|
||||
TILE_STOPS,
|
||||
TILE_STOPA,
|
||||
TILE_PENALTY,
|
||||
TILE_TELECHECKINEVIL = 63,
|
||||
TILE_CP = 64,
|
||||
TILE_CP_F,
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
/* (c) Magnus Auvinen. See licence.txt in the root of the distribution for more information. */
|
||||
#include <iostream>
|
||||
/* If you are missing that file, acquire a complete release at teeworlds.com. */
|
||||
#include <new>
|
||||
#include <engine/shared/config.h>
|
||||
|
@ -67,6 +68,7 @@ bool CCharacter::Spawn(CPlayer *pPlayer, vec2 Pos)
|
|||
m_ActiveWeapon = WEAPON_GUN;
|
||||
m_LastWeapon = WEAPON_HAMMER;
|
||||
m_QueuedWeapon = -1;
|
||||
m_LastPenalty = false;
|
||||
|
||||
m_pPlayer = pPlayer;
|
||||
m_Pos = Pos;
|
||||
|
@ -1263,7 +1265,10 @@ void CCharacter::HandleTiles(int Index)
|
|||
//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);
|
||||
if(Index < 0)
|
||||
{
|
||||
m_LastPenalty = false;
|
||||
return;
|
||||
}
|
||||
int cp = GameServer()->Collision()->IsCheckpoint(MapIndex);
|
||||
if(cp != -1 && m_DDRaceState == DDRACE_STARTED && cp > m_CpActive)
|
||||
{
|
||||
|
@ -1551,6 +1556,19 @@ void CCharacter::HandleTiles(int Index)
|
|||
m_Core.m_Jumps = newJumps;
|
||||
}
|
||||
}
|
||||
else if(GameServer()->Collision()->IsSwitch(MapIndex) == TILE_PENALTY && !m_LastPenalty)
|
||||
{
|
||||
int min = GameServer()->Collision()->GetSwitchDelay(MapIndex);
|
||||
int sec = GameServer()->Collision()->GetSwitchNumber(MapIndex);
|
||||
m_StartTime -= (min * 60 + sec) * Server()->TickSpeed();
|
||||
m_LastPenalty = true;
|
||||
}
|
||||
|
||||
if(GameServer()->Collision()->IsSwitch(MapIndex) != TILE_PENALTY)
|
||||
{
|
||||
std::cout << "a" << std::endl;
|
||||
m_LastPenalty = false;
|
||||
}
|
||||
|
||||
int z = GameServer()->Collision()->IsTeleport(MapIndex);
|
||||
if(!g_Config.m_SvOldTeleportHook && !g_Config.m_SvOldTeleportWeapons && z && Controller->m_TeleOuts[z-1].size())
|
||||
|
|
|
@ -220,6 +220,8 @@ public:
|
|||
int m_TileSFlagsB;
|
||||
vec2 m_Intersection;
|
||||
int64 m_LastStartWarning;
|
||||
bool m_LastPenalty;
|
||||
|
||||
// Setters/Getters because i don't want to modify vanilla vars access modifiers
|
||||
int GetLastWeapon() { return m_LastWeapon; };
|
||||
void SetLastWeapon(int LastWeap) {m_LastWeapon = LastWeap; };
|
||||
|
|
Loading…
Reference in a new issue