mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-19 14:38:18 +00:00
Remove DamageInd armor flag, add a type field in Damage to distinguish self damage
This commit is contained in:
parent
79fda7979a
commit
ce38aec2ec
|
@ -5,6 +5,7 @@ Emotes = Enum("EMOTE", ["NORMAL", "PAIN", "HAPPY", "SURPRISE", "ANGRY", "BLINK"]
|
||||||
Emoticons = Enum("EMOTICON", ["OOP", "EXCLAMATION", "HEARTS", "DROP", "DOTDOT", "MUSIC", "SORRY", "GHOST", "SUSHI", "SPLATTEE", "DEVILTEE", "ZOMG", "ZZZ", "WTF", "EYES", "QUESTION"])
|
Emoticons = Enum("EMOTICON", ["OOP", "EXCLAMATION", "HEARTS", "DROP", "DOTDOT", "MUSIC", "SORRY", "GHOST", "SUSHI", "SPLATTEE", "DEVILTEE", "ZOMG", "ZZZ", "WTF", "EYES", "QUESTION"])
|
||||||
Votes = Enum("VOTE", ["UNKNOWN", "START_OP", "START_KICK", "START_SPEC", "END_ABORT", "END_PASS", "END_FAIL"])
|
Votes = Enum("VOTE", ["UNKNOWN", "START_OP", "START_KICK", "START_SPEC", "END_ABORT", "END_PASS", "END_FAIL"])
|
||||||
ChatModes = Enum("CHAT", ["NONE", "ALL", "TEAM", "WHISPER"])
|
ChatModes = Enum("CHAT", ["NONE", "ALL", "TEAM", "WHISPER"])
|
||||||
|
DamageType = Enum("DAMAGE", ["NORMAL", "ARMOR", "SELF", "SELF_ARMOR"])
|
||||||
|
|
||||||
PlayerFlags = Flags("PLAYERFLAG", ["ADMIN", "CHATTING", "SCOREBOARD", "READY", "DEAD", "WATCHING"])
|
PlayerFlags = Flags("PLAYERFLAG", ["ADMIN", "CHATTING", "SCOREBOARD", "READY", "DEAD", "WATCHING"])
|
||||||
GameFlags = Flags("GAMEFLAG", ["TEAMS", "FLAGS", "SURVIVAL"])
|
GameFlags = Flags("GAMEFLAG", ["TEAMS", "FLAGS", "SURVIVAL"])
|
||||||
|
@ -57,6 +58,7 @@ Enums = [
|
||||||
Emoticons,
|
Emoticons,
|
||||||
Votes,
|
Votes,
|
||||||
ChatModes,
|
ChatModes,
|
||||||
|
DamageType,
|
||||||
GameMsgIDs,
|
GameMsgIDs,
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -233,14 +235,13 @@ Objects = [
|
||||||
|
|
||||||
NetEvent("DamageInd:Common", [
|
NetEvent("DamageInd:Common", [
|
||||||
NetIntAny("m_Angle"),
|
NetIntAny("m_Angle"),
|
||||||
NetBool("m_Armored"),
|
|
||||||
]),
|
]),
|
||||||
|
|
||||||
NetEvent("Damage:Common", [ # Unused yet
|
NetEvent("Damage:Common", [ # Unused yet
|
||||||
NetIntRange("m_ClientID", 0, 'MAX_CLIENTS-1'),
|
NetIntRange("m_ClientID", 0, 'MAX_CLIENTS-1'),
|
||||||
NetIntAny("m_Angle"),
|
NetIntAny("m_Angle"),
|
||||||
NetIntRange("m_Amount", 1, 9),
|
NetIntRange("m_Amount", 1, 9),
|
||||||
NetBool("m_Armored"),
|
NetEnum("m_Type", DamageType),
|
||||||
]),
|
]),
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
|
@ -722,14 +722,14 @@ bool CCharacter::TakeDamage(vec2 Force, vec2 Source, int Dmg, int From, int Weap
|
||||||
if(Server()->Tick() < m_DamageTakenTick+25)
|
if(Server()->Tick() < m_DamageTakenTick+25)
|
||||||
{
|
{
|
||||||
// make sure that the damage indicators doesn't group together
|
// make sure that the damage indicators doesn't group together
|
||||||
GameServer()->CreateDamageInd(m_Pos, m_DamageTaken*0.25f, OldHealth-m_Health, OldArmor-m_Armor);
|
GameServer()->CreateDamageInd(m_Pos, m_DamageTaken*0.25f, Dmg);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_DamageTaken = 0;
|
m_DamageTaken = 0;
|
||||||
GameServer()->CreateDamageInd(m_Pos, 0, OldHealth-m_Health, OldArmor-m_Armor);
|
GameServer()->CreateDamageInd(m_Pos, 0, Dmg);
|
||||||
}
|
}
|
||||||
GameServer()->CreateDamage(m_Pos, m_pPlayer->GetCID(), Source, OldHealth-m_Health, OldArmor-m_Armor);
|
GameServer()->CreateDamage(m_Pos, m_pPlayer->GetCID(), Source, OldHealth-m_Health, OldArmor-m_Armor, From == m_pPlayer->GetCID());
|
||||||
|
|
||||||
m_DamageTakenTick = Server()->Tick();
|
m_DamageTakenTick = Server()->Tick();
|
||||||
|
|
||||||
|
|
|
@ -93,35 +93,26 @@ class CCharacter *CGameContext::GetPlayerChar(int ClientID)
|
||||||
return m_apPlayers[ClientID]->GetCharacter();
|
return m_apPlayers[ClientID]->GetCharacter();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CGameContext::CreateDamageInd(vec2 Pos, float Angle, int HealthAmount, int ArmorAmount)
|
void CGameContext::CreateDamageInd(vec2 Pos, float Angle, int Amount)
|
||||||
{
|
{
|
||||||
int TotalAmount = HealthAmount+ArmorAmount;
|
|
||||||
float a = 3*pi/2 + Angle;
|
float a = 3*pi/2 + Angle;
|
||||||
//float a = get_angle(dir);
|
//float a = get_angle(dir);
|
||||||
float s = a-pi/3;
|
float s = a-pi/3;
|
||||||
float e = a+pi/3;
|
float e = a+pi/3;
|
||||||
for(int i = 0; i < TotalAmount; i++)
|
for(int i = 0; i < Amount; i++)
|
||||||
{
|
{
|
||||||
float f = mix(s, e, float(i+1)/float(TotalAmount+2));
|
float f = mix(s, e, float(i+1)/float(Amount+2));
|
||||||
CNetEvent_DamageInd *pEvent = (CNetEvent_DamageInd *)m_Events.Create(NETEVENTTYPE_DAMAGEIND, sizeof(CNetEvent_DamageInd));
|
CNetEvent_DamageInd *pEvent = (CNetEvent_DamageInd *)m_Events.Create(NETEVENTTYPE_DAMAGEIND, sizeof(CNetEvent_DamageInd));
|
||||||
if(pEvent)
|
if(pEvent)
|
||||||
{
|
{
|
||||||
pEvent->m_X = (int)Pos.x;
|
pEvent->m_X = (int)Pos.x;
|
||||||
pEvent->m_Y = (int)Pos.y;
|
pEvent->m_Y = (int)Pos.y;
|
||||||
pEvent->m_Angle = (int)(f*256.0f);
|
pEvent->m_Angle = (int)(f*256.0f);
|
||||||
if(ArmorAmount)
|
|
||||||
{
|
|
||||||
pEvent->m_Armored = true;
|
|
||||||
ArmorAmount--;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
pEvent->m_Armored = false;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CGameContext::CreateDamage(vec2 Pos, int Id, vec2 Source, int HealthAmount, int ArmorAmount)
|
void CGameContext::CreateDamage(vec2 Pos, int Id, vec2 Source, int HealthAmount, int ArmorAmount, bool Self)
|
||||||
{
|
{
|
||||||
for(int ArmorType = 0; ArmorType < 2; ArmorType++)
|
for(int ArmorType = 0; ArmorType < 2; ArmorType++)
|
||||||
{
|
{
|
||||||
|
@ -136,7 +127,10 @@ void CGameContext::CreateDamage(vec2 Pos, int Id, vec2 Source, int HealthAmount,
|
||||||
pEvent->m_ClientID = Id;
|
pEvent->m_ClientID = Id;
|
||||||
pEvent->m_Angle = (int)(f*256.0f);
|
pEvent->m_Angle = (int)(f*256.0f);
|
||||||
pEvent->m_Amount = ArmorType ? ArmorAmount : HealthAmount;
|
pEvent->m_Amount = ArmorType ? ArmorAmount : HealthAmount;
|
||||||
pEvent->m_Armored = ArmorType;
|
if(!Self)
|
||||||
|
pEvent->m_Type = ArmorType ? DAMAGE_ARMOR : DAMAGE_NORMAL;
|
||||||
|
else
|
||||||
|
pEvent->m_Type = ArmorType ? DAMAGE_SELF_ARMOR : DAMAGE_SELF;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -123,8 +123,8 @@ public:
|
||||||
CVoteOptionServer *m_pVoteOptionLast;
|
CVoteOptionServer *m_pVoteOptionLast;
|
||||||
|
|
||||||
// helper functions
|
// helper functions
|
||||||
void CreateDamageInd(vec2 Pos, float AngleMod, int HealthAmount, int ArmorAmount);
|
void CreateDamageInd(vec2 Pos, float AngleMod, int Amount);
|
||||||
void CreateDamage(vec2 Pos, int Id, vec2 Source, int HealthAmount, int ArmorAmount);
|
void CreateDamage(vec2 Pos, int Id, vec2 Source, int HealthAmount, int ArmorAmount, bool Self);
|
||||||
void CreateExplosion(vec2 Pos, int Owner, int Weapon, int MaxDamage);
|
void CreateExplosion(vec2 Pos, int Owner, int Weapon, int MaxDamage);
|
||||||
void CreateHammerHit(vec2 Pos);
|
void CreateHammerHit(vec2 Pos);
|
||||||
void CreatePlayerSpawn(vec2 Pos);
|
void CreatePlayerSpawn(vec2 Pos);
|
||||||
|
|
Loading…
Reference in a new issue