mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 01:58:19 +00:00
Add entities to start and stop: Player collisions, Hooking, Infinite jump
This commit is contained in:
parent
f8c9a89106
commit
111d5c7f10
Binary file not shown.
Before Width: | Height: | Size: 276 KiB After Width: | Height: | Size: 294 KiB |
Binary file not shown.
Before Width: | Height: | Size: 301 KiB After Width: | Height: | Size: 322 KiB |
Binary file not shown.
Before Width: | Height: | Size: 282 KiB After Width: | Height: | Size: 299 KiB |
|
@ -175,7 +175,7 @@ MACRO_CONFIG_STR(SvRulesLine9, sv_rules_line9, 40, "", CFGFLAG_SERVER, "Rules li
|
|||
MACRO_CONFIG_STR(SvRulesLine10, sv_rules_line10, 40, "", CFGFLAG_SERVER, "Rules line 10")
|
||||
|
||||
MACRO_CONFIG_INT(SvTeam, sv_team, 1, 0, 2, CFGFLAG_SERVER, "Teams configuration (0 = off, 1 = on but optional, 2 = must play only with teams)")
|
||||
MACRO_CONFIG_INT(SvTeamMaxSize, sv_team_max_size, 16, 2, 16, CFGFLAG_SERVER, "Maximum team size (from 2 to 16)")
|
||||
MACRO_CONFIG_INT(SvTeamMaxSize, sv_max_team_size, 16, 2, 16, CFGFLAG_SERVER, "Maximum team size (from 2 to 16)")
|
||||
|
||||
MACRO_CONFIG_STR(SvAnnouncementFileName, sv_announcement_filename, 24, "announcement.txt", CFGFLAG_SERVER, "file which will have the announcement, each one at a line")
|
||||
MACRO_CONFIG_INT(SvAnnouncementInterval, sv_announcement_interval, 300, 1, 9999, CFGFLAG_SERVER, "time(minutes) in which the announcement will be displayed from the announcement file")
|
||||
|
|
|
@ -75,7 +75,7 @@ void CCollision::Init(class CLayers *pLayers)
|
|||
|
||||
Index = m_pSwitch[i].m_Type;
|
||||
|
||||
if(Index <= TILE_NPH)
|
||||
if(Index <= TILE_NPH_END)
|
||||
{
|
||||
if(Index >= TILE_FREEZE && Index <= TILE_SWITCHCLOSE)
|
||||
m_pSwitch[i].m_Type = Index;
|
||||
|
@ -87,7 +87,7 @@ void CCollision::Init(class CLayers *pLayers)
|
|||
{
|
||||
Index = m_pFront[i].m_Index;
|
||||
|
||||
if(Index <= TILE_NPH)
|
||||
if(Index <= TILE_NPH_END)
|
||||
{
|
||||
switch(Index)
|
||||
{
|
||||
|
@ -108,12 +108,12 @@ void CCollision::Init(class CLayers *pLayers)
|
|||
}
|
||||
|
||||
// DDRace tiles
|
||||
if(Index == TILE_THROUGH || (Index >= TILE_FREEZE && Index <= TILE_UNFREEZE) || (Index >= TILE_SWITCHOPEN && Index <= TILE_TELECHECKIN) || (Index >= TILE_BEGIN && Index <= TILE_STOPA) || Index == TILE_CP || Index == TILE_CP_F || (Index >= TILE_OLDLASER && Index <= TILE_NPH) || (Index >= TILE_EHOOK_START && Index <= TILE_SOLO_END) || (Index >= TILE_DFREEZE && Index <= TILE_DUNFREEZE))
|
||||
if(Index == TILE_THROUGH || (Index >= TILE_FREEZE && Index <= TILE_UNFREEZE) || (Index >= TILE_SWITCHOPEN && Index <= TILE_TELECHECKIN) || (Index >= TILE_BEGIN && Index <= TILE_STOPA) || Index == TILE_CP || Index == TILE_CP_F || (Index >= TILE_OLDLASER && Index <= TILE_NPH_END) || (Index >= TILE_EHOOK_START && Index <= TILE_SOLO_END) || (Index >= TILE_DFREEZE && Index <= TILE_DUNFREEZE))
|
||||
m_pFront[i].m_Index = Index;
|
||||
}
|
||||
}
|
||||
Index = m_pTiles[i].m_Index;
|
||||
if(Index <= TILE_NPH)
|
||||
if(Index <= TILE_NPH_END)
|
||||
{
|
||||
switch(Index)
|
||||
{
|
||||
|
@ -134,7 +134,7 @@ void CCollision::Init(class CLayers *pLayers)
|
|||
}
|
||||
|
||||
// DDRace tiles
|
||||
if(Index == TILE_THROUGH || (Index >= TILE_FREEZE && Index <= TILE_UNFREEZE) || (Index >= TILE_SWITCHOPEN && Index <= TILE_TELECHECKIN) || (Index >= TILE_BEGIN && Index <= TILE_STOPA) || Index == TILE_CP || Index == TILE_CP_F || (Index >= TILE_OLDLASER && Index <= TILE_NPH) || (Index >= TILE_EHOOK_START && Index <= TILE_SOLO_END) || (Index >= TILE_DFREEZE && Index <= TILE_DUNFREEZE))
|
||||
if(Index == TILE_THROUGH || (Index >= TILE_FREEZE && Index <= TILE_UNFREEZE) || (Index >= TILE_SWITCHOPEN && Index <= TILE_TELECHECKIN) || (Index >= TILE_BEGIN && Index <= TILE_STOPA) || Index == TILE_CP || Index == TILE_CP_F || (Index >= TILE_OLDLASER && Index <= TILE_NPH_END) || (Index >= TILE_EHOOK_START && Index <= TILE_SOLO_END) || (Index >= TILE_DFREEZE && Index <= TILE_DUNFREEZE))
|
||||
m_pTiles[i].m_Index = Index;
|
||||
}
|
||||
}
|
||||
|
@ -588,9 +588,9 @@ bool CCollision::TileExists(int Index)
|
|||
if(Index < 0)
|
||||
return false;
|
||||
|
||||
if(m_pTiles[Index].m_Index >= TILE_FREEZE && m_pTiles[Index].m_Index <= TILE_NPH)
|
||||
if(m_pTiles[Index].m_Index >= TILE_FREEZE && m_pTiles[Index].m_Index <= TILE_NPH_END)
|
||||
return true;
|
||||
if(m_pFront && m_pFront[Index].m_Index >= TILE_FREEZE && m_pFront[Index].m_Index <= TILE_NPH)
|
||||
if(m_pFront && m_pFront[Index].m_Index >= TILE_FREEZE && m_pFront[Index].m_Index <= TILE_NPH_END)
|
||||
return true;
|
||||
if(m_pTele && (m_pTele[Index].m_Type == TILE_TELEIN || m_pTele[Index].m_Type == TILE_TELEINEVIL || m_pTele[Index].m_Type == TILE_TELECHECK || m_pTele[Index].m_Type == TILE_TELECHECKIN))
|
||||
return true;
|
||||
|
|
|
@ -273,7 +273,7 @@ void CCharacterCore::Tick(bool UseInput)
|
|||
}
|
||||
|
||||
// Check against other players first
|
||||
if(m_pWorld && m_pWorld->m_Tuning.m_PlayerHooking)
|
||||
if(this->m_Hook && m_pWorld && m_pWorld->m_Tuning.m_PlayerHooking)
|
||||
{
|
||||
float Distance = 0.0f;
|
||||
for(int i = 0; i < MAX_CLIENTS; i++)
|
||||
|
@ -399,7 +399,7 @@ void CCharacterCore::Tick(bool UseInput)
|
|||
// handle player <-> player collision
|
||||
float Distance = distance(m_Pos, pCharCore->m_Pos);
|
||||
vec2 Dir = normalize(m_Pos - pCharCore->m_Pos);
|
||||
if(m_pWorld->m_Tuning.m_PlayerCollision && Distance < PhysSize*1.25f && Distance > 0.0f)
|
||||
if(pCharCore->m_Collision && this->m_Collision && m_pWorld->m_Tuning.m_PlayerCollision && Distance < PhysSize*1.25f && Distance > 0.0f)
|
||||
{
|
||||
float a = (PhysSize*1.45f - Distance);
|
||||
float Velocity = 0.5f;
|
||||
|
@ -414,7 +414,7 @@ void CCharacterCore::Tick(bool UseInput)
|
|||
}
|
||||
|
||||
// handle hook influence
|
||||
if(m_HookedPlayer == i && m_pWorld->m_Tuning.m_PlayerHooking)
|
||||
if(m_Hook && m_HookedPlayer == i && m_pWorld->m_Tuning.m_PlayerHooking)
|
||||
{
|
||||
if(Distance > PhysSize*1.50f) // TODO: fix tweakable variable
|
||||
{
|
||||
|
@ -473,7 +473,7 @@ void CCharacterCore::Move()
|
|||
|
||||
m_Vel.x = m_Vel.x*(1.0f/RampValue);
|
||||
|
||||
if(m_pWorld && m_pWorld->m_Tuning.m_PlayerCollision)
|
||||
if(m_pWorld && m_pWorld->m_Tuning.m_PlayerCollision && this->m_Collision)
|
||||
{
|
||||
// check player collision
|
||||
float Distance = distance(m_Pos, NewPos);
|
||||
|
@ -486,7 +486,7 @@ void CCharacterCore::Move()
|
|||
for(int p = 0; p < MAX_CLIENTS; p++)
|
||||
{
|
||||
CCharacterCore *pCharCore = m_pWorld->m_apCharacters[p];
|
||||
if(!pCharCore || pCharCore == this || (m_Id != -1 && !m_pTeams->CanCollide(m_Id, p)))
|
||||
if(!pCharCore || pCharCore == this || (m_Id != -1 && !m_pTeams->CanCollide(m_Id, p)) || !pCharCore->m_Collision)
|
||||
continue;
|
||||
float D = distance(Pos, pCharCore->m_Pos);
|
||||
if(D < 28.0f && D > 0.0f)
|
||||
|
|
|
@ -187,6 +187,8 @@ class CCharacterCore
|
|||
public:
|
||||
vec2 m_Pos;
|
||||
vec2 m_Vel;
|
||||
bool m_Hook;
|
||||
bool m_Collision;
|
||||
|
||||
vec2 m_HookPos;
|
||||
vec2 m_HookDir;
|
||||
|
|
|
@ -126,7 +126,13 @@ enum
|
|||
TILE_NPC,
|
||||
TILE_EHOOK,
|
||||
TILE_NOHIT,
|
||||
TILE_NPH,//Remember to change this in collision.cpp if you add anymore tiles
|
||||
TILE_NPH,
|
||||
TILE_NPC_START = 88,
|
||||
TILE_SUPER_START,
|
||||
TILE_NPH_START = 91,
|
||||
TILE_NPC_END = 104,
|
||||
TILE_SUPER_END,
|
||||
TILE_NPH_END = 107,//Remember to change this in collision.cpp if you add anymore tiles
|
||||
//End of higher tiles
|
||||
//Layers
|
||||
LAYER_GAME=0,
|
||||
|
|
|
@ -1316,11 +1316,41 @@ void CCharacter::HandleTiles(int Index)
|
|||
GameServer()->SendChatTarget(GetPlayer()->GetCID(), "You can hit others");
|
||||
m_Hit = HIT_ALL;
|
||||
}
|
||||
else if(((m_TileIndex == TILE_NPC_START) || (m_TileFIndex == TILE_NPC_START)) && !m_Core.m_Collision)
|
||||
{
|
||||
GameServer()->SendChatTarget(GetPlayer()->GetCID(),"You can collide with others");
|
||||
m_Core.m_Collision = true;
|
||||
}
|
||||
else if(((m_TileIndex == TILE_SUPER_START) || (m_TileFIndex == TILE_SUPER_START)) && !m_SuperJump)
|
||||
{
|
||||
GameServer()->SendChatTarget(GetPlayer()->GetCID(),"You have infinite air jumps");
|
||||
m_SuperJump = true;
|
||||
}
|
||||
else if(((m_TileIndex == TILE_NPH_START) || (m_TileFIndex == TILE_NPH_START)) && !m_Core.m_Hook)
|
||||
{
|
||||
GameServer()->SendChatTarget(GetPlayer()->GetCID(),"You can hook others");
|
||||
m_Core.m_Hook = true;
|
||||
}
|
||||
else if(((m_TileIndex == TILE_HIT_END) || (m_TileFIndex == TILE_HIT_END)) && m_Hit != (DISABLE_HIT_GRENADE|DISABLE_HIT_HAMMER|DISABLE_HIT_RIFLE|DISABLE_HIT_SHOTGUN))
|
||||
{
|
||||
GameServer()->SendChatTarget(GetPlayer()->GetCID(), "You can't hit others");
|
||||
m_Hit = DISABLE_HIT_GRENADE|DISABLE_HIT_HAMMER|DISABLE_HIT_RIFLE|DISABLE_HIT_SHOTGUN;
|
||||
}
|
||||
else if(((m_TileIndex == TILE_NPC_END) || (m_TileFIndex == TILE_NPC_END)) && m_Core.m_Collision)
|
||||
{
|
||||
GameServer()->SendChatTarget(GetPlayer()->GetCID(), "You can't collide with others");
|
||||
m_Core.m_Collision = false;
|
||||
}
|
||||
else if(((m_TileIndex == TILE_SUPER_END) || (m_TileFIndex == TILE_SUPER_END)) && m_SuperJump)
|
||||
{
|
||||
GameServer()->SendChatTarget(GetPlayer()->GetCID(), "You don't have infinite air jumps");
|
||||
m_SuperJump = false;
|
||||
}
|
||||
else if(((m_TileIndex == TILE_NPH_END) || (m_TileFIndex == TILE_NPH_END)) && m_Core.m_Hook)
|
||||
{
|
||||
GameServer()->SendChatTarget(GetPlayer()->GetCID(), "You can't hook others");
|
||||
m_Core.m_Hook = false;
|
||||
}
|
||||
if(((m_TileIndex == TILE_SOLO_START) || (m_TileFIndex == TILE_SOLO_START)) && !Teams()->m_Core.GetSolo(m_pPlayer->GetCID()))
|
||||
{
|
||||
GameServer()->SendChatTarget(GetPlayer()->GetCID(), "You are now in a solo part.");
|
||||
|
@ -1333,7 +1363,7 @@ void CCharacter::HandleTiles(int Index)
|
|||
}
|
||||
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;
|
||||
|
@ -1543,7 +1573,7 @@ void CCharacter::DDRacePostCoreTick()
|
|||
if (m_DeepFreeze && !m_Super)
|
||||
Freeze();
|
||||
|
||||
if (m_Super && m_Core.m_Jumped > 1)
|
||||
if ((m_Super || m_SuperJump) && m_Core.m_Jumped > 1)
|
||||
m_Core.m_Jumped = 1;
|
||||
|
||||
int CurrentIndex = GameServer()->Collision()->GetMapIndex(m_Pos);
|
||||
|
@ -1653,4 +1683,7 @@ void CCharacter::DDRaceInit()
|
|||
m_TeleCheckpoint = 0;
|
||||
m_EndlessHook = g_Config.m_SvEndlessDrag;
|
||||
m_Hit = g_Config.m_SvHit ? HIT_ALL : DISABLE_HIT_GRENADE|DISABLE_HIT_HAMMER|DISABLE_HIT_RIFLE|DISABLE_HIT_SHOTGUN;
|
||||
m_Core.m_Collision = true;
|
||||
m_Core.m_Hook = true;
|
||||
m_SuperJump = false;
|
||||
}
|
||||
|
|
|
@ -157,6 +157,7 @@ public:
|
|||
bool CanCollide(int ClientID);
|
||||
bool SameTeam(int ClientID);
|
||||
bool m_Super;
|
||||
bool m_SuperJump;
|
||||
int m_TeamBeforeSuper;
|
||||
int m_FreezeTime;
|
||||
int m_FreezeTick;
|
||||
|
@ -171,6 +172,8 @@ public:
|
|||
DISABLE_HIT_RIFLE=8
|
||||
};
|
||||
int m_Hit;
|
||||
int m_Collision;
|
||||
int m_Hook;
|
||||
int m_PainSoundTimer;
|
||||
int m_LastMove;
|
||||
int m_StartTime;
|
||||
|
|
Loading…
Reference in a new issue