This commit is contained in:
heinrich5991 2024-03-12 08:54:50 +01:00 committed by GitHub
commit 06b7ac90bb
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 28 additions and 8 deletions

View file

@ -822,9 +822,9 @@ bool CCollision::TileExists(int Index) const
if(Index < 0) if(Index < 0)
return false; return false;
if((m_pTiles[Index].m_Index >= TILE_FREEZE && m_pTiles[Index].m_Index <= TILE_TELE_LASER_DISABLE) || (m_pTiles[Index].m_Index >= TILE_LFREEZE && m_pTiles[Index].m_Index <= TILE_LUNFREEZE)) if(m_pTiles[Index].m_Index == TILE_DEATH || (m_pTiles[Index].m_Index >= TILE_FREEZE && m_pTiles[Index].m_Index <= TILE_TELE_LASER_DISABLE) || (m_pTiles[Index].m_Index >= TILE_LFREEZE && m_pTiles[Index].m_Index <= TILE_LUNFREEZE))
return true; return true;
if(m_pFront && ((m_pFront[Index].m_Index >= TILE_FREEZE && m_pFront[Index].m_Index <= TILE_TELE_LASER_DISABLE) || (m_pFront[Index].m_Index >= TILE_LFREEZE && m_pFront[Index].m_Index <= TILE_LUNFREEZE))) if(m_pFront && (m_pFront[Index].m_Index == TILE_DEATH || (m_pFront[Index].m_Index >= TILE_FREEZE && m_pFront[Index].m_Index <= TILE_TELE_LASER_DISABLE) || (m_pFront[Index].m_Index >= TILE_LFREEZE && m_pFront[Index].m_Index <= TILE_LUNFREEZE)))
return true; 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_TELECHECKINEVIL || m_pTele[Index].m_Type == TILE_TELECHECK || m_pTele[Index].m_Type == TILE_TELECHECKIN)) if(m_pTele && (m_pTele[Index].m_Type == TILE_TELEIN || m_pTele[Index].m_Type == TILE_TELEINEVIL || m_pTele[Index].m_Type == TILE_TELECHECKINEVIL || m_pTele[Index].m_Type == TILE_TELECHECK || m_pTele[Index].m_Type == TILE_TELECHECKIN))
return true; return true;

View file

@ -1458,13 +1458,14 @@ void CCharacter::SetTimeCheckpoint(int TimeCheckpoint)
} }
} }
void CCharacter::HandleTiles(int Index) void CCharacter::HandleTiles(int Index, bool *pStopProcessing)
{ {
int MapIndex = Index; int MapIndex = Index;
//int PureMapIndex = Collision()->GetPureMapIndex(m_Pos); //int PureMapIndex = Collision()->GetPureMapIndex(m_Pos);
m_TileIndex = Collision()->GetTileIndex(MapIndex); m_TileIndex = Collision()->GetTileIndex(MapIndex);
m_TileFIndex = Collision()->GetFTileIndex(MapIndex); m_TileFIndex = Collision()->GetFTileIndex(MapIndex);
m_MoveRestrictions = Collision()->GetMoveRestrictions(IsSwitchActiveCb, this, m_Pos, 18.0f, MapIndex); m_MoveRestrictions = Collision()->GetMoveRestrictions(IsSwitchActiveCb, this, m_Pos, 18.0f, MapIndex);
*pStopProcessing = false;
if(Index < 0) if(Index < 0)
{ {
m_LastRefillJumps = false; m_LastRefillJumps = false;
@ -1833,6 +1834,13 @@ void CCharacter::HandleTiles(int Index)
m_LastBonus = false; m_LastBonus = false;
} }
if((m_TileIndex == TILE_DEATH) || (m_TileFIndex == TILE_DEATH))
{
Die(m_pPlayer->GetCID(), WEAPON_WORLD);
*pStopProcessing = true;
return;
}
int z = Collision()->IsTeleport(MapIndex); int z = Collision()->IsTeleport(MapIndex);
if(!g_Config.m_SvOldTeleportHook && !g_Config.m_SvOldTeleportWeapons && z && !(*m_pTeleOuts)[z - 1].empty()) if(!g_Config.m_SvOldTeleportHook && !g_Config.m_SvOldTeleportWeapons && z && !(*m_pTeleOuts)[z - 1].empty())
{ {
@ -1840,6 +1848,7 @@ void CCharacter::HandleTiles(int Index)
return; return;
int TeleOut = GameWorld()->m_Core.RandomOr0((*m_pTeleOuts)[z - 1].size()); int TeleOut = GameWorld()->m_Core.RandomOr0((*m_pTeleOuts)[z - 1].size());
m_Core.m_Pos = (*m_pTeleOuts)[z - 1][TeleOut]; m_Core.m_Pos = (*m_pTeleOuts)[z - 1][TeleOut];
*pStopProcessing = true;
if(!g_Config.m_SvTeleportHoldHook) if(!g_Config.m_SvTeleportHoldHook)
{ {
ResetHook(); ResetHook();
@ -1855,6 +1864,7 @@ void CCharacter::HandleTiles(int Index)
return; return;
int TeleOut = GameWorld()->m_Core.RandomOr0((*m_pTeleOuts)[evilz - 1].size()); int TeleOut = GameWorld()->m_Core.RandomOr0((*m_pTeleOuts)[evilz - 1].size());
m_Core.m_Pos = (*m_pTeleOuts)[evilz - 1][TeleOut]; m_Core.m_Pos = (*m_pTeleOuts)[evilz - 1][TeleOut];
*pStopProcessing = true;
if(!g_Config.m_SvOldTeleportHook && !g_Config.m_SvOldTeleportWeapons) if(!g_Config.m_SvOldTeleportHook && !g_Config.m_SvOldTeleportWeapons)
{ {
m_Core.m_Vel = vec2(0, 0); m_Core.m_Vel = vec2(0, 0);
@ -1882,6 +1892,7 @@ void CCharacter::HandleTiles(int Index)
{ {
int TeleOut = GameWorld()->m_Core.RandomOr0((*m_pTeleCheckOuts)[k].size()); int TeleOut = GameWorld()->m_Core.RandomOr0((*m_pTeleCheckOuts)[k].size());
m_Core.m_Pos = (*m_pTeleCheckOuts)[k][TeleOut]; m_Core.m_Pos = (*m_pTeleCheckOuts)[k][TeleOut];
*pStopProcessing = true;
m_Core.m_Vel = vec2(0, 0); m_Core.m_Vel = vec2(0, 0);
if(!g_Config.m_SvTeleportHoldHook) if(!g_Config.m_SvTeleportHoldHook)
@ -1898,6 +1909,7 @@ void CCharacter::HandleTiles(int Index)
if(GameServer()->m_pController->CanSpawn(m_pPlayer->GetTeam(), &SpawnPos, GameServer()->GetDDRaceTeam(GetPlayer()->GetCid()))) if(GameServer()->m_pController->CanSpawn(m_pPlayer->GetTeam(), &SpawnPos, GameServer()->GetDDRaceTeam(GetPlayer()->GetCid())))
{ {
m_Core.m_Pos = SpawnPos; m_Core.m_Pos = SpawnPos;
*pStopProcessing = true;
m_Core.m_Vel = vec2(0, 0); m_Core.m_Vel = vec2(0, 0);
if(!g_Config.m_SvTeleportHoldHook) if(!g_Config.m_SvTeleportHoldHook)
@ -1919,6 +1931,7 @@ void CCharacter::HandleTiles(int Index)
{ {
int TeleOut = GameWorld()->m_Core.RandomOr0((*m_pTeleCheckOuts)[k].size()); int TeleOut = GameWorld()->m_Core.RandomOr0((*m_pTeleCheckOuts)[k].size());
m_Core.m_Pos = (*m_pTeleCheckOuts)[k][TeleOut]; m_Core.m_Pos = (*m_pTeleCheckOuts)[k][TeleOut];
*pStopProcessing = true;
if(!g_Config.m_SvTeleportHoldHook) if(!g_Config.m_SvTeleportHoldHook)
{ {
@ -1933,6 +1946,7 @@ void CCharacter::HandleTiles(int Index)
if(GameServer()->m_pController->CanSpawn(m_pPlayer->GetTeam(), &SpawnPos, GameServer()->GetDDRaceTeam(GetPlayer()->GetCid()))) if(GameServer()->m_pController->CanSpawn(m_pPlayer->GetTeam(), &SpawnPos, GameServer()->GetDDRaceTeam(GetPlayer()->GetCid())))
{ {
m_Core.m_Pos = SpawnPos; m_Core.m_Pos = SpawnPos;
*pStopProcessing = true;
if(!g_Config.m_SvTeleportHoldHook) if(!g_Config.m_SvTeleportHoldHook)
{ {
@ -2142,17 +2156,23 @@ void CCharacter::DDRacePostCoreTick()
{ {
for(int &Index : vIndices) for(int &Index : vIndices)
{ {
HandleTiles(Index); bool StopProcessing;
if(!m_Alive) HandleTiles(Index, &StopProcessing);
if(StopProcessing || !m_Alive)
{
return; return;
} }
} }
}
else else
{ {
HandleTiles(CurrentIndex); bool StopProcessing;
if(!m_Alive) HandleTiles(CurrentIndex, &StopProcessing);
if(StopProcessing || !m_Alive)
{
return; return;
} }
}
// teleport gun // teleport gun
if(m_TeleGunTeleport) if(m_TeleGunTeleport)

View file

@ -160,7 +160,7 @@ private:
void SnapCharacter(int SnappingClient, int Id); void SnapCharacter(int SnappingClient, int Id);
static bool IsSwitchActiveCb(int Number, void *pUser); static bool IsSwitchActiveCb(int Number, void *pUser);
void SetTimeCheckpoint(int TimeCheckpoint); void SetTimeCheckpoint(int TimeCheckpoint);
void HandleTiles(int Index); void HandleTiles(int Index, bool *pStopProcessing);
float m_Time; float m_Time;
int m_LastBroadcast; int m_LastBroadcast;
void DDRaceInit(); void DDRaceInit();