mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 18:18:18 +00:00
Merge branch 'master' of http://github.com/GreYFoXGTi/DDRace-Server
This commit is contained in:
commit
d1f5bd4431
|
@ -933,14 +933,14 @@ void CServer::ProcessClientPacket(CNetChunk *pPacket)
|
|||
}
|
||||
if(level != -1)
|
||||
{
|
||||
char buf[128]="Authentication successful. Remote console access granted, with level=%d";
|
||||
char buf[128]="Authentication successful. Remote console access grantedfor cid=%d with level=%d";
|
||||
CMsgPacker Msg(NETMSG_RCON_AUTH_STATUS);
|
||||
Msg.AddInt(1);
|
||||
SendMsgEx(&Msg, MSGFLAG_VITAL, ClientId, true);
|
||||
|
||||
m_aClients[ClientId].m_Authed = level;
|
||||
GameServer()->OnSetAuthed(ClientId, m_aClients[ClientId].m_Authed);
|
||||
str_format(buf,sizeof(buf),buf,level);
|
||||
str_format(buf,sizeof(buf),buf,ClientId,level);
|
||||
SendRconLine(ClientId, buf);
|
||||
dbg_msg("server", "ClientId=%d authed with Level=%d", ClientId, level);
|
||||
m_aClients[ClientId].m_PwTries = 0;
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
//===============================
|
||||
/* DDRace */
|
||||
//MACRO_CONFIG_STR(SvEntities, sv_entities, 64, "Latest", CFGFLAG_SERVER, "The type of entities used") still need to think of a way
|
||||
MACRO_CONFIG_INT(SvShotgunBulletSound, sv_shotgun_bullet_sound, 1, 0, 1, CFGFLAG_SERVER, "Annoying Shotgun sound on/off")
|
||||
MACRO_CONFIG_INT(SvEndlessSuperHook, sv_endless_super_hook, 0, 0, 1, CFGFLAG_SERVER, "Endless hook for super players on/off")
|
||||
MACRO_CONFIG_INT(SvEmotionalTees, sv_emotional_tees, 1, 0, 1, CFGFLAG_SERVER, "Emotional Tees on/off")
|
||||
MACRO_CONFIG_INT(SvOldShotgun, sv_old_shotgun, 0, 0, 1, CFGFLAG_SERVER, "Makes Shotgun laser pull towards the shooter, rather than the last bounce origin")
|
||||
|
|
|
@ -83,7 +83,7 @@ bool CCharacter::Spawn(CPlayer *pPlayer, vec2 Pos)
|
|||
|
||||
GameServer()->m_World.InsertEntity(this);
|
||||
m_Alive = true;
|
||||
|
||||
if(m_pPlayer->m_RconFreeze) Freeze(-1);
|
||||
GameServer()->m_pController->OnCharacterSpawn(this);
|
||||
|
||||
return true;
|
||||
|
@ -497,7 +497,7 @@ bool CCharacter::GiveWeapon(int Weapon, int Ammo)
|
|||
if(m_aWeapons[Weapon].m_Ammo < g_pData->m_Weapons.m_aId[Weapon].m_Maxammo || !m_aWeapons[Weapon].m_Got)
|
||||
{
|
||||
m_aWeapons[Weapon].m_Got = true;
|
||||
m_aWeapons[Weapon].m_Ammo = min(g_pData->m_Weapons.m_aId[Weapon].m_Maxammo, Ammo);
|
||||
if(!m_FreezeTime) m_aWeapons[Weapon].m_Ammo = min(g_pData->m_Weapons.m_aId[Weapon].m_Maxammo, Ammo);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
@ -509,7 +509,7 @@ void CCharacter::GiveNinja()
|
|||
GameServer()->CreateSound(m_Pos, SOUND_PICKUP_NINJA);
|
||||
m_Ninja.m_ActivationTick = Server()->Tick();
|
||||
m_aWeapons[WEAPON_NINJA].m_Got = true;
|
||||
m_aWeapons[WEAPON_NINJA].m_Ammo = -1;
|
||||
if (!m_FreezeTime) m_aWeapons[WEAPON_NINJA].m_Ammo = -1;
|
||||
m_LastWeapon = m_ActiveWeapon;
|
||||
m_ActiveWeapon = WEAPON_NINJA;
|
||||
}
|
||||
|
@ -563,19 +563,24 @@ void CCharacter::Tick()
|
|||
|
||||
m_pPlayer->m_ForceBalanced = false;
|
||||
}
|
||||
m_Armor=10-(m_FreezeTime/15);
|
||||
m_Armor=(m_FreezeTime != -1)?10-(m_FreezeTime/15):0;
|
||||
if(m_Input.m_Direction != 0 || m_Input.m_Jump != 0)
|
||||
m_LastMove = Server()->Tick();
|
||||
|
||||
if(m_FreezeTime > 0) {
|
||||
if (m_FreezeTime % Server()->TickSpeed() == 0)
|
||||
if(m_FreezeTime > 0 || m_FreezeTime == -1)
|
||||
{
|
||||
if (m_FreezeTime % Server()->TickSpeed() == 0 || m_FreezeTime == -1)
|
||||
{
|
||||
GameServer()->CreateDamageInd(m_Pos, 0, m_FreezeTime / Server()->TickSpeed());
|
||||
}
|
||||
if(m_FreezeTime != -1)
|
||||
m_FreezeTime--;
|
||||
else
|
||||
m_Ninja.m_ActivationTick = Server()->Tick();
|
||||
m_Input.m_Direction = 0;
|
||||
m_Input.m_Jump = 0;
|
||||
m_Input.m_Hook = 0;
|
||||
|
||||
//m_Input.m_Fire = 0;
|
||||
if (m_FreezeTime == 1) {
|
||||
UnFreeze();
|
||||
|
@ -819,58 +824,61 @@ void CCharacter::Tick()
|
|||
{
|
||||
if(m_PrevPos.x-m_Pos.x<0)
|
||||
m_Core.m_Vel.x += m_Core.m_Vel.x *-0.5;
|
||||
else
|
||||
else if(m_LastBooster != TileIndex1 || m_LastFBooster != TileIndex2)
|
||||
m_Core.m_Vel.x += m_Core.m_Vel.x*0.5;
|
||||
}
|
||||
if (TileIndex1 == TILE_BOOST_R || TileIndex2 == TILE_BOOST_R)
|
||||
{
|
||||
if(m_PrevPos.x-m_Pos.x>0)
|
||||
m_Core.m_Vel.x += m_Core.m_Vel.x *-0.5;
|
||||
else
|
||||
else if(m_LastBooster != TileIndex1 || m_LastFBooster != TileIndex2)
|
||||
m_Core.m_Vel.x += m_Core.m_Vel.x*0.5;
|
||||
}
|
||||
if (TileIndex1 == TILE_BOOST_D || TileIndex2 == TILE_BOOST_D)
|
||||
{
|
||||
if(m_PrevPos.y-m_Pos.y>0)
|
||||
m_Core.m_Vel.y += m_Core.m_Vel.y *-0.5;
|
||||
else
|
||||
else if(m_LastBooster != TileIndex1 || m_LastFBooster != TileIndex2)
|
||||
m_Core.m_Vel.y += m_Core.m_Vel.y*0.5;
|
||||
}
|
||||
if (TileIndex1 == TILE_BOOST_U || TileIndex2 == TILE_BOOST_U)
|
||||
{
|
||||
if(m_PrevPos.y-m_Pos.y<0)
|
||||
m_Core.m_Vel.y += m_Core.m_Vel.y *-0.5;
|
||||
else
|
||||
else if(m_LastBooster != TileIndex1 || m_LastFBooster != TileIndex2)
|
||||
m_Core.m_Vel.y += m_Core.m_Vel.y*0.5;
|
||||
}
|
||||
if (TileIndex1 == TILE_BOOST_L2 || TileIndex2 == TILE_BOOST_L2)
|
||||
if ((TileIndex1 == TILE_BOOST_L2 || TileIndex2 == TILE_BOOST_L2) && (m_LastBooster != TileIndex1 || m_LastFBooster != TileIndex2))
|
||||
{
|
||||
if(m_PrevPos.x-m_Pos.x<0)
|
||||
m_Core.m_Vel.x = m_Core.m_Vel.x *-1.1;
|
||||
else
|
||||
m_Core.m_Vel.x += m_Core.m_Vel.x*1.1;
|
||||
}
|
||||
if (TileIndex1 == TILE_BOOST_R2|| TileIndex2 == TILE_BOOST_R2)
|
||||
if ((TileIndex1 == TILE_BOOST_R2|| TileIndex2 == TILE_BOOST_R2) && (m_LastBooster != TileIndex1 || m_LastFBooster != TileIndex2))
|
||||
{
|
||||
if(m_PrevPos.x-m_Pos.x>0)
|
||||
m_Core.m_Vel.x = m_Core.m_Vel.x *-1.1;
|
||||
else
|
||||
m_Core.m_Vel.x += m_Core.m_Vel.x*1.1;
|
||||
}
|
||||
if (TileIndex1 == TILE_BOOST_D2 || TileIndex2 == TILE_BOOST_D2)
|
||||
if ((TileIndex1 == TILE_BOOST_D2 || TileIndex2 == TILE_BOOST_D2) && (m_LastBooster != TileIndex1 || m_LastFBooster != TileIndex2))
|
||||
{
|
||||
if(m_PrevPos.y-m_Pos.y>0)
|
||||
m_Core.m_Vel.y = m_Core.m_Vel.y *-1.1;
|
||||
else
|
||||
m_Core.m_Vel.y += m_Core.m_Vel.y*1.1;
|
||||
}
|
||||
if (TileIndex1 == TILE_BOOST_U2 || TileIndex2 == TILE_BOOST_U2)
|
||||
if ((TileIndex1 == TILE_BOOST_U2 || TileIndex2 == TILE_BOOST_U2) && (m_LastBooster != TileIndex1 || m_LastFBooster != TileIndex2))
|
||||
{
|
||||
if(m_PrevPos.y-m_Pos.y<0)
|
||||
m_Core.m_Vel.y = m_Core.m_Vel.y *-1.1;
|
||||
else
|
||||
m_Core.m_Vel.y += m_Core.m_Vel.y*1.1;
|
||||
}
|
||||
m_LastBooster = TileIndex1;
|
||||
m_LastFBooster = TileIndex2;
|
||||
// handle speedup tiles
|
||||
if(GameServer()->Collision()->IsSpeedup((int)m_Core.m_Pos.x, (int)m_Core.m_Pos.y))
|
||||
{
|
||||
vec2 Direction;
|
||||
|
@ -1040,18 +1048,18 @@ void CCharacter::TickDefered()
|
|||
|
||||
bool CCharacter::Freeze(int Time)
|
||||
{
|
||||
if (Time <= 1 || m_Super)
|
||||
if ((Time <= 1 || m_Super || m_FreezeTime == -1) && Time != -1)
|
||||
return false;
|
||||
if (m_FreezeTick < Server()->Tick() - Server()->TickSpeed())
|
||||
{
|
||||
for(int i=0;i<NUM_WEAPONS;i++)
|
||||
if(m_aWeapons[i].m_Got)
|
||||
{
|
||||
m_aWeapons[i].m_Ammo = 0;
|
||||
}
|
||||
m_Armor=0;
|
||||
m_Ninja.m_ActivationTick = Server()->Tick();
|
||||
m_aWeapons[WEAPON_NINJA].m_Got = true;
|
||||
m_aWeapons[WEAPON_NINJA].m_Ammo = 0;
|
||||
m_LastWeapon = m_ActiveWeapon;
|
||||
m_ActiveWeapon = WEAPON_NINJA;
|
||||
m_FreezeTick=Server()->Tick();
|
||||
m_FreezeTime=Time;
|
||||
m_FreezeTick=Server()->Tick();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
@ -1060,18 +1068,19 @@ bool CCharacter::Freeze(int Time)
|
|||
bool CCharacter::Freeze()
|
||||
{
|
||||
int Time = Server()->TickSpeed()*3;
|
||||
if (Time <= 1 || m_Super)
|
||||
if (Time <= 1 || m_Super || m_FreezeTime == -1)
|
||||
return false;
|
||||
if (m_FreezeTick < Server()->Tick() - Server()->TickSpeed())
|
||||
{
|
||||
for(int i=0;i<NUM_WEAPONS;i++)
|
||||
if(m_aWeapons[i].m_Got)
|
||||
{
|
||||
m_aWeapons[i].m_Ammo = 0;
|
||||
}
|
||||
m_Armor=0;
|
||||
m_Ninja.m_ActivationTick = Server()->Tick();
|
||||
m_aWeapons[WEAPON_NINJA].m_Got = true;
|
||||
m_aWeapons[WEAPON_NINJA].m_Ammo = 0;
|
||||
m_LastWeapon = m_ActiveWeapon;
|
||||
m_ActiveWeapon = WEAPON_NINJA;
|
||||
m_FreezeTick=Server()->Tick();
|
||||
m_FreezeTime=Time;
|
||||
m_FreezeTick=Server()->Tick();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
@ -1082,23 +1091,13 @@ bool CCharacter::UnFreeze()
|
|||
if (m_FreezeTime>0)
|
||||
{
|
||||
m_Armor=10;
|
||||
m_FreezeTick=0;
|
||||
m_FreezeTime=0;
|
||||
m_aWeapons[WEAPON_NINJA].m_Got = false;
|
||||
m_ActiveWeapon = m_LastWeapon;
|
||||
if(m_ActiveWeapon == WEAPON_NINJA)
|
||||
m_ActiveWeapon = WEAPON_GUN;
|
||||
SetWeapon(m_ActiveWeapon);
|
||||
m_Ninja.m_ActivationDir=vec2(0,0);
|
||||
m_Ninja.m_ActivationTick=0;
|
||||
m_Ninja.m_CurrentMoveTime=0;
|
||||
for(int i=0;i<WEAPON_NINJA;i++)
|
||||
{
|
||||
if (m_aWeapons[i].m_Got)
|
||||
for(int i=0;i<NUM_WEAPONS;i++)
|
||||
if(m_aWeapons[i].m_Got)
|
||||
{
|
||||
m_aWeapons[i].m_Ammo = -1;
|
||||
}
|
||||
}
|
||||
if(!m_aWeapons[m_ActiveWeapon].m_Got) m_ActiveWeapon=WEAPON_GUN;
|
||||
m_FreezeTime=0;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
@ -1109,7 +1108,7 @@ void CCharacter::GiveAllWeapons()
|
|||
for(int i=1;i<NUM_WEAPONS-1;i++)
|
||||
{
|
||||
m_aWeapons[i].m_Got = true;
|
||||
m_aWeapons[i].m_Ammo = -1;
|
||||
if(!m_FreezeTime) m_aWeapons[i].m_Ammo = -1;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
@ -1288,10 +1287,11 @@ void CCharacter::Snap(int SnappingClient)
|
|||
Character->m_Health = 0;
|
||||
Character->m_Armor = 0;
|
||||
|
||||
if (m_FreezeTime > 0)
|
||||
if (m_FreezeTime > 0 || m_FreezeTime == -1)
|
||||
{
|
||||
Character->m_Emote = EMOTE_PAIN;
|
||||
Character->m_Weapon = WEAPON_NINJA;
|
||||
Character->m_AmmoCount = 0;
|
||||
}
|
||||
else
|
||||
Character->m_Weapon = m_ActiveWeapon;
|
||||
|
@ -1304,7 +1304,7 @@ void CCharacter::Snap(int SnappingClient)
|
|||
Character->m_Health = m_Health;
|
||||
Character->m_Armor = m_Armor;
|
||||
if(m_aWeapons[m_ActiveWeapon].m_Ammo > 0)
|
||||
Character->m_AmmoCount = m_aWeapons[m_ActiveWeapon].m_Ammo;
|
||||
Character->m_AmmoCount = (!m_FreezeTime)?m_aWeapons[m_ActiveWeapon].m_Ammo:0;
|
||||
}
|
||||
|
||||
if (Character->m_Emote == EMOTE_NORMAL)
|
||||
|
|
|
@ -161,7 +161,8 @@ public:
|
|||
int m_StartTime;
|
||||
int m_RefreshTime;
|
||||
|
||||
int m_LastSpeedup;
|
||||
int m_LastBooster;
|
||||
int m_LastFBooster;
|
||||
vec2 m_PrevPos;
|
||||
|
||||
// checkpoints
|
||||
|
|
|
@ -71,31 +71,29 @@ void CPickup::Tick()
|
|||
for(int i=WEAPON_SHOTGUN;i<NUM_WEAPONS;i++)
|
||||
{
|
||||
if (pChr->m_aWeapons[i].m_Got)
|
||||
{
|
||||
if(!(pChr->m_FreezeTime && i == WEAPON_NINJA))
|
||||
{
|
||||
pChr->m_aWeapons[i].m_Got = false;
|
||||
pChr->m_aWeapons[i].m_Ammo = 0;
|
||||
sound = true;
|
||||
}
|
||||
if(pChr->m_FreezeTime)
|
||||
{
|
||||
pChr->m_aWeapons[WEAPON_GUN].m_Ammo = 0;
|
||||
pChr->m_aWeapons[WEAPON_HAMMER].m_Ammo =0;
|
||||
}
|
||||
}
|
||||
pChr->m_Ninja.m_ActivationDir=vec2(0,0);
|
||||
pChr->m_Ninja.m_ActivationTick=0;
|
||||
pChr->m_Ninja.m_ActivationTick=-500;
|
||||
pChr->m_Ninja.m_CurrentMoveTime=0;
|
||||
}
|
||||
if (sound)
|
||||
{
|
||||
pChr->m_LastWeapon = WEAPON_GUN;
|
||||
GameServer()->CreateSound(m_Pos, SOUND_PICKUP_ARMOR);
|
||||
}
|
||||
pChr->m_ActiveWeapon = WEAPON_HAMMER;
|
||||
if(!pChr->m_FreezeTime) pChr->m_ActiveWeapon = WEAPON_HAMMER;
|
||||
break;
|
||||
|
||||
case POWERUP_WEAPON:
|
||||
|
||||
if(m_Subtype >= 0 && m_Subtype < NUM_WEAPONS && (!pChr->m_aWeapons[m_Subtype].m_Got || pChr->m_aWeapons[m_Subtype].m_Ammo != -1))
|
||||
if(m_Subtype >= 0 && m_Subtype < NUM_WEAPONS && (!pChr->m_aWeapons[m_Subtype].m_Got || (pChr->m_aWeapons[m_Subtype].m_Ammo != -1 && !pChr->m_FreezeTime)))
|
||||
{
|
||||
if(pChr->GiveWeapon(m_Subtype, -1))
|
||||
{
|
||||
|
@ -117,7 +115,7 @@ void CPickup::Tick()
|
|||
case POWERUP_NINJA:
|
||||
{
|
||||
// activate ninja on target player
|
||||
pChr->GiveNinja();
|
||||
if(!pChr->m_FreezeTime) pChr->GiveNinja();
|
||||
//RespawnTime = g_pData->m_aPickups[m_Type].m_Respawntime;
|
||||
|
||||
break;
|
||||
|
|
|
@ -3,8 +3,18 @@
|
|||
#include <engine/shared/config.h>
|
||||
#include "projectile.h"
|
||||
|
||||
CProjectile::CProjectile(CGameWorld *pGameWorld, int Type, int Owner, vec2 Pos, vec2 Dir, int Span,
|
||||
bool Freeze, bool Explosive, float Force, int SoundImpact, int Weapon)
|
||||
CProjectile::CProjectile(
|
||||
CGameWorld *pGameWorld,
|
||||
int Type,
|
||||
int Owner,
|
||||
vec2 Pos,
|
||||
vec2 Dir,
|
||||
int Span,
|
||||
bool Freeze,
|
||||
bool Explosive,
|
||||
float Force,
|
||||
int SoundImpact,
|
||||
int Weapon)
|
||||
: CEntity(pGameWorld, NETOBJTYPE_PROJECTILE)
|
||||
{
|
||||
m_Type = Type;
|
||||
|
@ -19,6 +29,11 @@ CProjectile::CProjectile(CGameWorld *pGameWorld, int Type, int Owner, vec2 Pos,
|
|||
m_Weapon = Weapon;
|
||||
m_StartTick = Server()->Tick();
|
||||
m_Explosive = Explosive;
|
||||
m_BouncePos=vec2(0,0);
|
||||
m_ReBouncePos=vec2(0,0);
|
||||
m_AvgPos=vec2(0,0);
|
||||
m_LastBounce=vec2(0,0);
|
||||
m_PrevLastBounce=vec2(0,0);
|
||||
|
||||
GameWorld()->InsertEntity(this);
|
||||
}
|
||||
|
@ -55,7 +70,8 @@ vec2 CProjectile::GetPos(float Time)
|
|||
return CalcPos(m_Pos, m_Direction, Curvature, Speed, Time);
|
||||
}
|
||||
|
||||
void CProjectile::SetBouncing(int Value) {
|
||||
void CProjectile::SetBouncing(int Value)
|
||||
{
|
||||
m_Bouncing = Value;
|
||||
}
|
||||
|
||||
|
@ -96,9 +112,62 @@ void CProjectile::Tick()
|
|||
m_StartTick = Server()->Tick();
|
||||
m_Pos = NewPos;
|
||||
if (m_Bouncing == 1)
|
||||
m_Direction.x = -m_Direction.x;
|
||||
{
|
||||
m_PrevLastBounce.x = m_LastBounce.x;
|
||||
m_LastBounce.x = m_Pos.x;
|
||||
if(!m_BouncePos.x)
|
||||
m_BouncePos.x=m_Pos.x;
|
||||
else if (!m_ReBouncePos.x)
|
||||
m_ReBouncePos.x=m_Pos.x;
|
||||
else if(!m_AvgPos.x)
|
||||
m_AvgPos = vec2((m_BouncePos.x+m_ReBouncePos.x)/2,(m_BouncePos.y+m_ReBouncePos.y)/2);
|
||||
if (m_AvgPos.x)
|
||||
if(!((m_PrevLastBounce.x+1 == m_BouncePos.x || m_PrevLastBounce.x-1 == m_BouncePos.x || m_PrevLastBounce.x == m_BouncePos.x) && (m_LastBounce.x == m_ReBouncePos.x || m_LastBounce.x+1 == m_ReBouncePos.x || m_LastBounce.x-1 == m_ReBouncePos.x)) && !((m_LastBounce.x == m_BouncePos.x || m_LastBounce.x+1 == m_BouncePos.x || m_LastBounce.x-1 == m_BouncePos.x) && (m_PrevLastBounce.x+1 == m_ReBouncePos.x || m_PrevLastBounce.x-1 == m_ReBouncePos.x || m_PrevLastBounce.x == m_ReBouncePos.x)))
|
||||
{
|
||||
/*int bx=(int)m_BouncePos.x;
|
||||
int rbx=(int)m_ReBouncePos.x;
|
||||
int lbx=(int)m_LastBounce.x;
|
||||
int plbx=(int)m_PrevLastBounce.x;
|
||||
dbg_msg("m_BouncePos","%d",bx);
|
||||
dbg_msg("m_ReBouncePos","%d",rbx);
|
||||
dbg_msg("m_LastBounce","%d",lbx);
|
||||
dbg_msg("m_PrevLastBounce","%d",plbx);
|
||||
m_Pos.x=m_AvgPos.x;*/
|
||||
dbg_msg("CrazyShotgun","Warning Horizontal Crazy Shotgun Out of bounds");
|
||||
/*int x=(int)m_Pos.x;
|
||||
dbg_msg("RePos","%d",x);*/
|
||||
}
|
||||
m_Direction.x =- m_Direction.x;
|
||||
}
|
||||
else if (m_Bouncing == 2)
|
||||
{
|
||||
m_PrevLastBounce.y = m_LastBounce.y;
|
||||
m_LastBounce.y = m_Pos.y;
|
||||
if(!m_BouncePos.y)
|
||||
m_BouncePos.y=m_Pos.y;
|
||||
else if (!m_ReBouncePos.y)
|
||||
m_ReBouncePos.y=m_Pos.y;
|
||||
else if(!m_AvgPos.y)
|
||||
m_AvgPos = vec2((m_BouncePos.x+m_ReBouncePos.x)/2,(m_BouncePos.y+m_ReBouncePos.y)/2);
|
||||
m_Direction.y =- m_Direction.y;
|
||||
if (m_AvgPos.y)
|
||||
if(!((m_PrevLastBounce.y+1 == m_BouncePos.y || m_PrevLastBounce.y-1 == m_BouncePos.y || m_PrevLastBounce.y == m_BouncePos.y) && (m_LastBounce.y == m_ReBouncePos.y || m_LastBounce.y+1 == m_ReBouncePos.y || m_LastBounce.y-1 == m_ReBouncePos.y)) && !((m_LastBounce.y == m_BouncePos.y || m_LastBounce.y+1 == m_BouncePos.y || m_LastBounce.y-1 == m_BouncePos.y) && (m_PrevLastBounce.y+1 == m_ReBouncePos.y || m_PrevLastBounce.y-1 == m_ReBouncePos.y || m_PrevLastBounce.y == m_ReBouncePos.y)))
|
||||
{
|
||||
/*int by=(int)m_BouncePos.y;
|
||||
int rby=(int)m_ReBouncePos.y;
|
||||
int lby=(int)m_LastBounce.y;
|
||||
int plby=(int)m_PrevLastBounce.y;
|
||||
dbg_msg("m_BouncePos","%d",by);
|
||||
dbg_msg("m_ReBouncePos","%d",rby);
|
||||
dbg_msg("m_LastBounce","%d",lby);
|
||||
dbg_msg("m_PrevLastBounce","%d",plby);*/
|
||||
m_Pos=m_AvgPos;
|
||||
dbg_msg("CrazyShotgun","Warning Vertical Crazy Shotgun Out of bounds");
|
||||
/*int y=(int)m_Pos.y;
|
||||
dbg_msg("RePos","%d",y);*/
|
||||
|
||||
}
|
||||
}
|
||||
m_Pos += m_Direction;
|
||||
}
|
||||
else if (m_Weapon == WEAPON_GUN)
|
||||
|
@ -114,6 +183,9 @@ void CProjectile::Tick()
|
|||
{
|
||||
GameServer()->m_World.DestroyEntity(this);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
void CProjectile::FillInfo(CNetObj_Projectile *pProj)
|
||||
|
|
|
@ -29,6 +29,11 @@ private:
|
|||
int m_Bouncing;
|
||||
bool m_Freeze;
|
||||
bool m_Collised;
|
||||
vec2 m_AvgPos;
|
||||
vec2 m_BouncePos;
|
||||
vec2 m_ReBouncePos;
|
||||
vec2 m_LastBounce;
|
||||
vec2 m_PrevLastBounce;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1374,7 +1374,7 @@ void CGameContext::ConSetlvl(IConsole::IResult *pResult, void *pUserData, int c
|
|||
int cid1 = clamp(pResult->GetInteger(0), 0, (int)MAX_CLIENTS-1);
|
||||
int level = clamp(pResult->GetInteger(1), 0, 3);
|
||||
|
||||
if (pSelf->m_apPlayers[cid1] && (pSelf->m_apPlayers[cid1]->m_Authed > level) && (compare_players(pSelf->m_apPlayers[cid],pSelf->m_apPlayers[cid1])))
|
||||
if (pSelf->m_apPlayers[cid1] && (pSelf->m_apPlayers[cid1]->m_Authed > level) && (compare_players(pSelf->m_apPlayers[cid],pSelf->m_apPlayers[cid1]) || cid == cid1))
|
||||
{
|
||||
pSelf->m_apPlayers[cid1]->m_Authed = level;
|
||||
}
|
||||
|
@ -1412,11 +1412,15 @@ void CGameContext::ConNinja(IConsole::IResult *pResult, void *pUserData, int cid
|
|||
if(!pSelf->CheatsAvailable(cid)) return;
|
||||
int cid1 = clamp(pResult->GetInteger(0), 0, (int)MAX_CLIENTS-1);
|
||||
CCharacter* chr = pSelf->GetPlayerChar(cid1);
|
||||
if(chr) {
|
||||
if(chr)
|
||||
{
|
||||
if (pSelf->m_apPlayers[cid1] && compare_players(pSelf->m_apPlayers[cid],pSelf->m_apPlayers[cid1]))
|
||||
{
|
||||
chr->GiveNinja();
|
||||
if(!g_Config.m_SvCheatTime)
|
||||
chr->m_RaceState = RACE_CHEAT;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -1437,6 +1441,8 @@ void CGameContext::ConHammer(IConsole::IResult *pResult, void *pUserData, int ci
|
|||
serv->SendRconLine(cid, "Select hammer between 0 and 3");
|
||||
}
|
||||
else
|
||||
{
|
||||
if (pSelf->m_apPlayers[cid1] && compare_players(pSelf->m_apPlayers[cid],pSelf->m_apPlayers[cid1]))
|
||||
{
|
||||
chr->m_HammerType = type;
|
||||
if(!g_Config.m_SvCheatTime)
|
||||
|
@ -1444,6 +1450,7 @@ void CGameContext::ConHammer(IConsole::IResult *pResult, void *pUserData, int ci
|
|||
str_format(buf, sizeof(buf), "Hammer of cid=%d setted to %d",cid1,type);
|
||||
serv->SendRconLine(cid1, buf);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CGameContext::ConHammerMe(IConsole::IResult *pResult, void *pUserData, int cid)
|
||||
|
@ -1482,6 +1489,7 @@ void CGameContext::ConSuper(IConsole::IResult *pResult, void *pUserData, int cid
|
|||
if(chr)
|
||||
{
|
||||
chr->m_Super = true;
|
||||
chr->UnFreeze();
|
||||
if(!g_Config.m_SvCheatTime)
|
||||
chr->m_RaceState = RACE_CHEAT;
|
||||
}
|
||||
|
@ -1513,6 +1521,7 @@ void CGameContext::ConSuperMe(IConsole::IResult *pResult, void *pUserData, int c
|
|||
if(chr)
|
||||
{
|
||||
chr->m_Super = true;
|
||||
chr->UnFreeze();
|
||||
if(!g_Config.m_SvCheatTime)
|
||||
chr->m_RaceState = RACE_CHEAT;
|
||||
}
|
||||
|
@ -1597,10 +1606,13 @@ void CGameContext::ConTimerStop(IConsole::IResult *pResult, void *pUserData, int
|
|||
CCharacter* chr = pSelf->GetPlayerChar(cid1);
|
||||
if (!chr)
|
||||
return;
|
||||
if (pSelf->m_apPlayers[cid1] && compare_players(pSelf->m_apPlayers[cid],pSelf->m_apPlayers[cid1]))
|
||||
{
|
||||
chr->m_RaceState=RACE_CHEAT;
|
||||
str_format(buf, sizeof(buf), "Cid=%d Hasn't time now (Timer Stopped)",cid1);
|
||||
serv->SendRconLine(cid1, buf);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
|
@ -1620,10 +1632,13 @@ void CGameContext::ConTimerStart(IConsole::IResult *pResult, void *pUserData, in
|
|||
CCharacter* chr = pSelf->GetPlayerChar(cid1);
|
||||
if (!chr)
|
||||
return;
|
||||
if (pSelf->m_apPlayers[cid1] && compare_players(pSelf->m_apPlayers[cid],pSelf->m_apPlayers[cid1]))
|
||||
{
|
||||
chr->m_RaceState = RACE_STARTED;
|
||||
str_format(buf, sizeof(buf), "Cid=%d Has time now (Timer Started)",cid1);
|
||||
serv->SendRconLine(cid1, buf);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
|
@ -1642,12 +1657,15 @@ void CGameContext::ConTimerZero(IConsole::IResult *pResult, void *pUserData, int
|
|||
CCharacter* chr = pSelf->GetPlayerChar(cid1);
|
||||
if (!chr)
|
||||
return;
|
||||
if (pSelf->m_apPlayers[cid1] && compare_players(pSelf->m_apPlayers[cid],pSelf->m_apPlayers[cid1]))
|
||||
{
|
||||
chr->m_StartTime = pSelf->Server()->Tick();
|
||||
chr->m_RefreshTime = pSelf->Server()->Tick();
|
||||
chr->m_RaceState=RACE_CHEAT;
|
||||
str_format(buf, sizeof(buf), "Cid=%d time has been reset & stopped.",cid1);
|
||||
CServer* serv = (CServer*)pSelf->Server();
|
||||
serv->SendRconLine(cid1, buf);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@ -1662,12 +1680,55 @@ void CGameContext::ConTimerReStart(IConsole::IResult *pResult, void *pUserData,
|
|||
CCharacter* chr = pSelf->GetPlayerChar(cid1);
|
||||
if (!chr)
|
||||
return;
|
||||
if (pSelf->m_apPlayers[cid1] && compare_players(pSelf->m_apPlayers[cid],pSelf->m_apPlayers[cid1]))
|
||||
{
|
||||
chr->m_StartTime = pSelf->Server()->Tick();
|
||||
chr->m_RefreshTime = pSelf->Server()->Tick();
|
||||
chr->m_RaceState=RACE_STARTED;
|
||||
str_format(buf, sizeof(buf), "Cid=%d time has been reset & stopped.",cid1);
|
||||
CServer* serv = (CServer*)pSelf->Server();
|
||||
serv->SendRconLine(cid1, buf);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void CGameContext::ConFreeze(IConsole::IResult *pResult, void *pUserData, int cid)
|
||||
{
|
||||
CGameContext *pSelf = (CGameContext *)pUserData;
|
||||
//if(!pSelf->CheatsAvailable(cid)) return;
|
||||
char buf[128];
|
||||
int time=-1;
|
||||
int cid1 = clamp(pResult->GetInteger(0), 0, (int)MAX_CLIENTS-1);
|
||||
if(pResult->NumArguments()>1)
|
||||
time = clamp(pResult->GetInteger(1), -1, 29999);
|
||||
CCharacter* chr = pSelf->GetPlayerChar(cid1);
|
||||
if (!chr)
|
||||
return;
|
||||
if (pSelf->m_apPlayers[cid1] && compare_players(pSelf->m_apPlayers[cid],pSelf->m_apPlayers[cid1]))
|
||||
{
|
||||
chr->Freeze(((time!=0&&time!=-1)?(pSelf->Server()->TickSpeed()*time):(-1)));
|
||||
chr->m_pPlayer->m_RconFreeze = true;
|
||||
str_format(buf, sizeof(buf), "Cid=%d has been Frozen.",cid1);
|
||||
CServer* serv = (CServer*)pSelf->Server();
|
||||
serv->SendRconLine(cid1, buf);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void CGameContext::ConUnFreeze(IConsole::IResult *pResult, void *pUserData, int cid)
|
||||
{
|
||||
CGameContext *pSelf = (CGameContext *)pUserData;
|
||||
//if(!pSelf->CheatsAvailable(cid)) return;
|
||||
char buf[128];
|
||||
int cid1 = clamp(pResult->GetInteger(0), 0, (int)MAX_CLIENTS-1);
|
||||
CCharacter* chr = pSelf->GetPlayerChar(cid1);
|
||||
if (!chr)
|
||||
return;
|
||||
chr->m_FreezeTime=2;
|
||||
chr->m_pPlayer->m_RconFreeze = false;
|
||||
str_format(buf, sizeof(buf), "Cid=%d has been UnFreezed.",cid1);
|
||||
CServer* serv = (CServer*)pSelf->Server();
|
||||
serv->SendRconLine(cid1, buf);
|
||||
|
||||
}
|
||||
|
||||
|
@ -1675,7 +1736,8 @@ void CGameContext::OnConsoleInit()
|
|||
{
|
||||
m_pServer = Kernel()->RequestInterface<IServer>();
|
||||
m_pConsole = Kernel()->RequestInterface<IConsole>();
|
||||
|
||||
Console()->Register("freeze", "i?i", CFGFLAG_SERVER, ConFreeze, this, "Freezes Player i1 for i2 seconds Default Infinity",2);
|
||||
Console()->Register("unfreeze", "i", CFGFLAG_SERVER, ConUnFreeze, this, "UnFreezes Player i",2);
|
||||
Console()->Register("timerstop", "i", CFGFLAG_SERVER, ConTimerStop, this, "Stops The Timer of Player i",2);
|
||||
Console()->Register("timerstart", "i", CFGFLAG_SERVER, ConTimerStart, this, "Starts The Timer of Player i",2);
|
||||
Console()->Register("timerrestart", "i", CFGFLAG_SERVER, ConTimerReStart, this, "Starts The Timer of Player i with the time of 00:00:00",2);
|
||||
|
|
|
@ -70,6 +70,8 @@ class CGameContext : public IGameServer
|
|||
|
||||
static void ConPhook(IConsole::IResult *pResult, void *pUserData, int cid);
|
||||
|
||||
static void ConFreeze(IConsole::IResult *pResult, void *pUserData, int cid);
|
||||
static void ConUnFreeze(IConsole::IResult *pResult, void *pUserData, int cid);
|
||||
static void ConTimerStop(IConsole::IResult *pResult, void *pUserData, int cid);
|
||||
static void ConTimerStart(IConsole::IResult *pResult, void *pUserData, int cid);
|
||||
static void ConTimerReStart(IConsole::IResult *pResult, void *pUserData, int cid);
|
||||
|
|
|
@ -179,7 +179,7 @@ bool IGameController::OnEntity(int Index, vec2 Pos, bool Front)
|
|||
true, //Freeze
|
||||
true, //Explosive
|
||||
0,
|
||||
SOUND_GRENADE_EXPLODE,
|
||||
(g_Config.m_SvShotgunBulletSound)?SOUND_GRENADE_EXPLODE:-1,
|
||||
WEAPON_SHOTGUN);
|
||||
bullet->SetBouncing(2 - (i % 2));
|
||||
|
||||
|
|
|
@ -265,7 +265,6 @@ void CPlayer::LoadCharacter() {
|
|||
Character->m_Armor = m_PauseInfo.m_Armor;
|
||||
Character->m_PlayerState = m_PauseInfo.m_PlayerState;
|
||||
Character->m_LastMove = m_PauseInfo.m_LastMove;
|
||||
Character->m_LastSpeedup = m_PauseInfo.m_LastSpeedup;
|
||||
Character->m_PrevPos = m_PauseInfo.m_PrevPos;
|
||||
Character->m_ActiveWeapon = m_PauseInfo.m_ActiveWeapon;
|
||||
Character->m_LastWeapon = m_PauseInfo.m_LastWeapon;
|
||||
|
@ -293,7 +292,6 @@ void CPlayer::SaveCharacter()
|
|||
m_PauseInfo.m_Armor = Character->m_Armor;
|
||||
m_PauseInfo.m_PlayerState = Character->m_PlayerState;
|
||||
m_PauseInfo.m_LastMove = Character->m_LastMove;
|
||||
m_PauseInfo.m_LastSpeedup = Character->m_LastSpeedup;
|
||||
m_PauseInfo.m_PrevPos = Character->m_PrevPos;
|
||||
m_PauseInfo.m_ActiveWeapon = Character->m_ActiveWeapon;
|
||||
m_PauseInfo.m_LastWeapon = Character->m_LastWeapon;
|
||||
|
|
|
@ -47,7 +47,6 @@ public:
|
|||
int m_Armor;
|
||||
int m_PlayerState;
|
||||
int m_LastMove;
|
||||
int m_LastSpeedup;
|
||||
vec2 m_PrevPos;
|
||||
int m_ActiveWeapon;
|
||||
int m_LastWeapon;
|
||||
|
@ -127,7 +126,7 @@ public:
|
|||
int m_SentAfkWarning; // afk timer's 1st warning after 50% of sv_max_afk_time
|
||||
int m_SentAfkWarning2; // afk timer's 2nd warning after 90% of sv_max_afk_time
|
||||
char m_pAfkMsg[160];
|
||||
|
||||
bool m_RconFreeze;
|
||||
private:
|
||||
CCharacter *Character;
|
||||
CGameContext *m_pGameServer;
|
||||
|
|
|
@ -1,155 +0,0 @@
|
|||
/* copyright (c) 2008 rajh and gregwar. Score stuff */
|
||||
|
||||
#include "score.h"
|
||||
#include "gamecontext.h"
|
||||
#include <string.h>
|
||||
#include <sstream>
|
||||
#include <fstream>
|
||||
#include <list>
|
||||
#include <engine/config.h>
|
||||
#include <engine/shared/config.h>
|
||||
#include <engine/storage.h>
|
||||
#include <engine/server/server.h>
|
||||
#include <engine/server.h>
|
||||
|
||||
CPlayerScore::CPlayerScore(const char *name, float score)
|
||||
{
|
||||
str_copy(this->name, name, sizeof(this->name));
|
||||
this->m_Score = score;
|
||||
}
|
||||
|
||||
std::list<CPlayerScore> top;
|
||||
|
||||
CScore::CScore(class CGameContext *pGameServer)
|
||||
{
|
||||
m_pGameServer = pGameServer;
|
||||
Load();
|
||||
}
|
||||
|
||||
CScore::CScore()
|
||||
{
|
||||
Load();
|
||||
}
|
||||
|
||||
std::string CScore::SaveFile()
|
||||
{
|
||||
std::ostringstream oss;
|
||||
if(!g_Config.m_SvExternalRecords) {
|
||||
oss << g_Config.m_SvMap << "_record.dtb";
|
||||
} else {
|
||||
char buf[512];
|
||||
CServer* server = static_cast<CServer*>(m_pGameServer->Server());
|
||||
oss << server->Storage()->ApplicationSavePath() << "/records/" << g_Config.m_SvMap << "_record.dtb";
|
||||
}
|
||||
return oss.str();
|
||||
}
|
||||
|
||||
void CScore::Save()
|
||||
{
|
||||
|
||||
std::fstream f;
|
||||
f.open(SaveFile().c_str(), std::ios::out);
|
||||
if(!f.fail()) {
|
||||
for(std::list<CPlayerScore>::iterator i=top.begin(); i!=top.end(); i++)
|
||||
{
|
||||
f << i->name << std::endl << i->m_Score << std::endl;
|
||||
}
|
||||
}
|
||||
f.close();
|
||||
}
|
||||
|
||||
void CScore::Load()
|
||||
{
|
||||
std::fstream f;
|
||||
f.open(SaveFile().c_str(), std::ios::in);
|
||||
top.clear();
|
||||
while (!f.eof() && !f.fail())
|
||||
{
|
||||
std::string tmpname, tmpscore;
|
||||
std::getline(f, tmpname);
|
||||
if(!f.eof() && tmpname != "")
|
||||
{
|
||||
std::getline(f, tmpscore);
|
||||
top.push_back(*new CPlayerScore(tmpname.c_str(), atof(tmpscore.c_str())));
|
||||
}
|
||||
}
|
||||
f.close();
|
||||
}
|
||||
|
||||
CPlayerScore *CScore::SearchName(const char *name, int &pos)
|
||||
{
|
||||
pos=0;
|
||||
for (std::list<CPlayerScore>::iterator i = top.begin(); i!=top.end(); i++)
|
||||
{
|
||||
pos++;
|
||||
if (!strcmp(i->name, name))
|
||||
{
|
||||
return & (*i);
|
||||
}
|
||||
}
|
||||
pos=-1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
CPlayerScore *CScore::SearchName(const char *name)
|
||||
{
|
||||
for (std::list<CPlayerScore>::iterator i = top.begin(); i!=top.end(); i++)
|
||||
{
|
||||
if (!strcmp(i->name, name))
|
||||
{
|
||||
return & (*i);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
void CScore::ParsePlayer(const char *name, float score)
|
||||
{
|
||||
CPlayerScore *player = SearchName(name);
|
||||
if (player)
|
||||
{
|
||||
if (player->m_Score > score)
|
||||
{
|
||||
player->m_Score = score;
|
||||
top.sort();
|
||||
Save();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
top.push_back(*new CPlayerScore(name, score));
|
||||
top.sort();
|
||||
Save();
|
||||
}
|
||||
}
|
||||
|
||||
std::list<std::string> CScore::Top5Draw(int id, int debut) //Thanks nevi
|
||||
{
|
||||
std::list<std::string> res;
|
||||
int pos = 1;
|
||||
//char buf[512];
|
||||
|
||||
res.push_back("----------- Top 5 -----------");
|
||||
for (std::list<CPlayerScore>::iterator i = top.begin(); i != top.end() && pos <= 5+debut; i++)
|
||||
{
|
||||
if(i->m_Score < 0)
|
||||
continue;
|
||||
|
||||
if(pos >= debut)
|
||||
{
|
||||
std::ostringstream oss;
|
||||
oss << pos << ". " << i->name << " Time: ";
|
||||
|
||||
if ((int)(i->m_Score)/60 != 0)
|
||||
oss << (int)(i->m_Score)/60 << ":";
|
||||
if (i->m_Score-((int)i->m_Score/60)*60 != 0)
|
||||
oss << i->m_Score-((int)i->m_Score/60)*60 <<" ";
|
||||
|
||||
res.push_back(oss.str());
|
||||
}
|
||||
pos++;
|
||||
}
|
||||
res.push_back("-----------------------------");
|
||||
return res;
|
||||
}
|
Loading…
Reference in a new issue