mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 10:08:18 +00:00
Merge branch 'master' of github.com:btd/DDRace
This commit is contained in:
commit
e3fb77f444
|
@ -93,7 +93,9 @@ bool CCharacter::Spawn(CPlayer *pPlayer, vec2 Pos)
|
||||||
if(m_pPlayer->m_RconFreeze) Freeze(-1);
|
if(m_pPlayer->m_RconFreeze) Freeze(-1);
|
||||||
GameServer()->m_pController->OnCharacterSpawn(this);
|
GameServer()->m_pController->OnCharacterSpawn(this);
|
||||||
|
|
||||||
|
if(GetPlayer()->m_IsUsingDDRaceClient) {
|
||||||
|
Controller->m_Teams.SendTeamsState(GetPlayer()->GetCID());
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -102,6 +104,7 @@ void CCharacter::Destroy()
|
||||||
{
|
{
|
||||||
GameServer()->m_World.m_Core.m_apCharacters[m_pPlayer->GetCID()] = 0;
|
GameServer()->m_World.m_Core.m_apCharacters[m_pPlayer->GetCID()] = 0;
|
||||||
m_Alive = false;
|
m_Alive = false;
|
||||||
|
CEntity::Destroy();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CCharacter::SetWeapon(int W)
|
void CCharacter::SetWeapon(int W)
|
||||||
|
@ -1368,7 +1371,7 @@ void CCharacter::Die(int Killer, int Weapon)
|
||||||
m_pPlayer->m_DieTick = Server()->Tick();
|
m_pPlayer->m_DieTick = Server()->Tick();
|
||||||
|
|
||||||
m_Alive = false;
|
m_Alive = false;
|
||||||
GameServer()->m_World.RemoveEntity(this);
|
MarkDestroy();
|
||||||
GameServer()->m_World.m_Core.m_apCharacters[m_pPlayer->GetCID()] = 0;
|
GameServer()->m_World.m_Core.m_apCharacters[m_pPlayer->GetCID()] = 0;
|
||||||
GameServer()->CreateDeath(m_Pos, m_pPlayer->GetCID());
|
GameServer()->CreateDeath(m_Pos, m_pPlayer->GetCID());
|
||||||
|
|
||||||
|
|
|
@ -24,9 +24,10 @@ CDoor::CDoor(CGameWorld *pGameWorld, vec2 Pos, float Rotation, int Length, bool
|
||||||
void CDoor::Open(int Tick, bool ActivatedTeam[])
|
void CDoor::Open(int Tick, bool ActivatedTeam[])
|
||||||
{
|
{
|
||||||
for (int i = 0; i < MAX_CLIENTS; ++i) {
|
for (int i = 0; i < MAX_CLIENTS; ++i) {
|
||||||
if(ActivatedTeam[i]) m_EvalTick[i] = Tick;
|
if(ActivatedTeam[i]) {
|
||||||
m_Opened[i] = ActivatedTeam[i];
|
m_EvalTick[i] = Tick;
|
||||||
if(ActivatedTeam[i]) Open(i);
|
Open(i);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -62,7 +63,7 @@ void CDoor::Close(int Team)
|
||||||
void CDoor::Reset()
|
void CDoor::Reset()
|
||||||
{
|
{
|
||||||
for (int i = 0; i < MAX_CLIENTS; ++i) {
|
for (int i = 0; i < MAX_CLIENTS; ++i) {
|
||||||
m_Opened[i] = false;
|
//m_Opened[i] = false;
|
||||||
Close(i);
|
Close(i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,7 +36,7 @@ bool CPlasma::HitCharacter()
|
||||||
if(Hit->Team() != m_ResponsibleTeam) return false;
|
if(Hit->Team() != m_ResponsibleTeam) return false;
|
||||||
m_Freeze ? Hit->Freeze(Server()->TickSpeed()*3) : Hit->UnFreeze();
|
m_Freeze ? Hit->Freeze(Server()->TickSpeed()*3) : Hit->UnFreeze();
|
||||||
if(m_Explosive)
|
if(m_Explosive)
|
||||||
GameServer()->CreateExplosion(m_Pos, -1, WEAPON_GRENADE, true, Hit->Teams()->TeamMask(m_ResponsibleTeam));
|
GameServer()->CreateExplosion(m_Pos, -1, WEAPON_GRENADE, true, m_ResponsibleTeam, Hit->Teams()->TeamMask(m_ResponsibleTeam));
|
||||||
GameServer()->m_World.DestroyEntity(this);
|
GameServer()->m_World.DestroyEntity(this);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -68,7 +68,7 @@ void CPlasma::Tick()
|
||||||
if(Res)
|
if(Res)
|
||||||
{
|
{
|
||||||
if(m_Explosive)
|
if(m_Explosive)
|
||||||
GameServer()->CreateExplosion(m_Pos, -1, WEAPON_GRENADE, true);
|
GameServer()->CreateExplosion(m_Pos, -1, WEAPON_GRENADE, true, m_ResponsibleTeam, -1);//TODO: Fix mask
|
||||||
Reset();
|
Reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -118,7 +118,7 @@ void CProjectile::Tick()
|
||||||
{
|
{
|
||||||
if(m_Explosive/*??*/ && (!TargetChr || (TargetChr && !m_Freeze)))
|
if(m_Explosive/*??*/ && (!TargetChr || (TargetChr && !m_Freeze)))
|
||||||
{
|
{
|
||||||
GameServer()->CreateExplosion(ColPos, m_Owner, m_Weapon, m_Owner == -1,
|
GameServer()->CreateExplosion(ColPos, m_Owner, m_Weapon, m_Owner == -1, TargetChr->Team(),
|
||||||
(m_Owner != -1)? TeamMask : -1);
|
(m_Owner != -1)? TeamMask : -1);
|
||||||
GameServer()->CreateSound(ColPos, m_SoundImpact,
|
GameServer()->CreateSound(ColPos, m_SoundImpact,
|
||||||
(m_Owner != -1)? TeamMask : -1);
|
(m_Owner != -1)? TeamMask : -1);
|
||||||
|
|
|
@ -76,6 +76,10 @@ public:
|
||||||
class CGameContext *GameServer() { return GameWorld()->GameServer(); }
|
class CGameContext *GameServer() { return GameWorld()->GameServer(); }
|
||||||
class IServer *Server() { return GameWorld()->Server(); }
|
class IServer *Server() { return GameWorld()->Server(); }
|
||||||
|
|
||||||
|
void MarkDestroy() {
|
||||||
|
m_MarkedForDestroy = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
CEntity *TypeNext() { return m_pNextTypeEntity; }
|
CEntity *TypeNext() { return m_pNextTypeEntity; }
|
||||||
CEntity *TypePrev() { return m_pPrevTypeEntity; }
|
CEntity *TypePrev() { return m_pPrevTypeEntity; }
|
||||||
|
|
|
@ -120,7 +120,7 @@ void CGameContext::CreateHammerHit(vec2 P, int Mask)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void CGameContext::CreateExplosion(vec2 P, int Owner, int Weapon, bool NoDamage, int Mask)
|
void CGameContext::CreateExplosion(vec2 P, int Owner, int Weapon, bool NoDamage, int ActivatedTeam,int Mask)
|
||||||
{
|
{
|
||||||
// create the event
|
// create the event
|
||||||
NETEVENT_EXPLOSION *ev = (NETEVENT_EXPLOSION *)m_Events.Create(NETEVENTTYPE_EXPLOSION, sizeof(NETEVENT_EXPLOSION), Mask);
|
NETEVENT_EXPLOSION *ev = (NETEVENT_EXPLOSION *)m_Events.Create(NETEVENTTYPE_EXPLOSION, sizeof(NETEVENT_EXPLOSION), Mask);
|
||||||
|
@ -150,6 +150,7 @@ void CGameContext::CreateExplosion(vec2 P, int Owner, int Weapon, bool NoDamage,
|
||||||
if((g_Config.m_SvHit||NoDamage) || Owner == apEnts[i]->m_pPlayer->GetCID())
|
if((g_Config.m_SvHit||NoDamage) || Owner == apEnts[i]->m_pPlayer->GetCID())
|
||||||
{
|
{
|
||||||
if(Owner != -1 && apEnts[i]->m_Alive && !apEnts[i]->CanCollide(Owner)) continue;
|
if(Owner != -1 && apEnts[i]->m_Alive && !apEnts[i]->CanCollide(Owner)) continue;
|
||||||
|
if(Owner == -1 && apEnts[i]->m_Alive && apEnts[i]->Team() != ActivatedTeam) continue;
|
||||||
apEnts[i]->TakeDamage(ForceDir*Dmg*2, (int)Dmg, Owner, Weapon);
|
apEnts[i]->TakeDamage(ForceDir*Dmg*2, (int)Dmg, Owner, Weapon);
|
||||||
if(!g_Config.m_SvHit||NoDamage) break;
|
if(!g_Config.m_SvHit||NoDamage) break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -190,7 +190,7 @@ public:
|
||||||
|
|
||||||
// helper functions
|
// helper functions
|
||||||
void CreateDamageInd(vec2 Pos, float AngleMod, int Amount, int Mask=-1);
|
void CreateDamageInd(vec2 Pos, float AngleMod, int Amount, int Mask=-1);
|
||||||
void CreateExplosion(vec2 Pos, int Owner, int Weapon, bool NoDamage, int Mask=-1);
|
void CreateExplosion(vec2 Pos, int Owner, int Weapon, bool NoDamage, int ActivatedTeam, int Mask);
|
||||||
void CreateSmoke(vec2 Pos, int Mask=-1);
|
void CreateSmoke(vec2 Pos, int Mask=-1);
|
||||||
void CreateHammerHit(vec2 Pos, int Mask=-1);
|
void CreateHammerHit(vec2 Pos, int Mask=-1);
|
||||||
void CreatePlayerSpawn(vec2 Pos, int Mask=-1);
|
void CreatePlayerSpawn(vec2 Pos, int Mask=-1);
|
||||||
|
|
|
@ -35,8 +35,7 @@ CPlayer::CPlayer(CGameContext *pGameServer, int CID, int Team)
|
||||||
|
|
||||||
CPlayer::~CPlayer()
|
CPlayer::~CPlayer()
|
||||||
{
|
{
|
||||||
delete Character;
|
if(Character) Character->Destroy();
|
||||||
Character = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CPlayer::Tick()
|
void CPlayer::Tick()
|
||||||
|
@ -80,7 +79,7 @@ void CPlayer::Tick()
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
delete Character;
|
Character->MarkDestroy();
|
||||||
Character = 0;
|
Character = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -179,7 +178,7 @@ void CPlayer::KillCharacter(int Weapon)
|
||||||
if(Character)
|
if(Character)
|
||||||
{
|
{
|
||||||
Character->Die(m_ClientID, Weapon);
|
Character->Die(m_ClientID, Weapon);
|
||||||
delete Character;
|
//delete Character;
|
||||||
Character = 0;
|
Character = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -207,8 +206,8 @@ void CPlayer::SetTeam(int Team)
|
||||||
m_LastActionTick = Server()->Tick();
|
m_LastActionTick = Server()->Tick();
|
||||||
// we got to wait 0.5 secs before respawning
|
// we got to wait 0.5 secs before respawning
|
||||||
m_RespawnTick = Server()->Tick()+Server()->TickSpeed()/2;
|
m_RespawnTick = Server()->Tick()+Server()->TickSpeed()/2;
|
||||||
str_format(aBuf, sizeof(aBuf), "team_join player='%d:%s' m_Team=%d", m_ClientID, Server()->ClientName(m_ClientID), m_Team);
|
//str_format(aBuf, sizeof(aBuf), "team_join player='%d:%s' m_Team=%d", m_ClientID, Server()->ClientName(m_ClientID), m_Team);
|
||||||
GameServer()->Console()->Print(IConsole::OUTPUT_LEVEL_DEBUG, "game", aBuf);
|
//GameServer()->Console()->Print(IConsole::OUTPUT_LEVEL_DEBUG, "game", aBuf);
|
||||||
|
|
||||||
//GameServer()->m_pController->OnPlayerInfoChange(GameServer()->m_apPlayers[m_ClientID]);
|
//GameServer()->m_pController->OnPlayerInfoChange(GameServer()->m_apPlayers[m_ClientID]);
|
||||||
}
|
}
|
||||||
|
|
|
@ -89,11 +89,7 @@ bool CGameTeams::SetCharacterTeam(int id, int Team) {
|
||||||
}
|
}
|
||||||
SetForceCharacterTeam(id, Team);
|
SetForceCharacterTeam(id, Team);
|
||||||
|
|
||||||
dbg_msg1("Teams", "Id = %d Team = %d", id, Team);
|
|
||||||
|
|
||||||
if(Character(id) && Character(id)->GetPlayer()->m_IsUsingDDRaceClient) {
|
|
||||||
SendTeamsState(id);
|
|
||||||
}
|
|
||||||
//GameServer()->CreatePlayerSpawn(Character(id)->m_Core.m_Pos, TeamMask());
|
//GameServer()->CreatePlayerSpawn(Character(id)->m_Core.m_Pos, TeamMask());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -120,6 +116,11 @@ void CGameTeams::SetForceCharacterTeam(int id, int Team) {
|
||||||
if(Team != TEAM_SUPER && m_TeamState[Team] == EMPTY) {
|
if(Team != TEAM_SUPER && m_TeamState[Team] == EMPTY) {
|
||||||
ChangeTeamState(Team, OPEN);
|
ChangeTeamState(Team, OPEN);
|
||||||
}
|
}
|
||||||
|
dbg_msg1("Teams", "Id = %d Team = %d", id, Team);
|
||||||
|
|
||||||
|
if(Character(id) && Character(id)->GetPlayer()->m_IsUsingDDRaceClient) {
|
||||||
|
SendTeamsState(id);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int CGameTeams::Count(int Team) const{
|
int CGameTeams::Count(int Team) const{
|
||||||
|
|
Loading…
Reference in a new issue