Skip to content

Commit

Permalink
Fix Warnings & Memory Leak [M]
Browse files Browse the repository at this point in the history
- Fixes #212
- Fixes #226
  • Loading branch information
Batfoxkid committed Nov 12, 2024
1 parent c2a36a9 commit 6d8ad5d
Show file tree
Hide file tree
Showing 26 changed files with 25 additions and 382 deletions.
52 changes: 24 additions & 28 deletions addons/sourcemod/scripting/freak_fortress_2/attributes.sp
Original file line number Diff line number Diff line change
@@ -1,13 +1,3 @@
/*
void Attributes_PluginStart()
bool Attributes_OnBackstabBoss(int attacker, int victim, float &damage, int weapon, bool killfeed)
void Attributes_OnHitBossPre(int attacker, int victim, int &damagetype, int weapon)
void Attributes_OnHitBoss(int attacker, int victim, int inflictor, float fdamage, int weapon, int damagecustom)
float Attributes_FindOnPlayer(int client, int index, bool multi = false, float defaul = 0.0)
float Attributes_FindOnWeapon(int client, int entity, int index, bool multi = false, float defaul = 0.0)
bool Attributes_GetByDefIndex(int entity, int index, float &value)
*/

#pragma semicolon 1
#pragma newdecls required

Expand Down Expand Up @@ -304,21 +294,28 @@ void Attributes_OnHitBoss(int attacker, int victim, int inflictor, float fdamage

SetEntPropFloat(attacker, Prop_Send, "m_flRageMeter", rage);
}

if(Attributes_FindOnPlayer(attacker, 418) > 0.0) // boost on damage

int i;
int entity = -1;
while(TF2_GetItem(attacker, entity, i))
{
DataPack pack = new DataPack();
if(Enabled)
{
CreateDataTimer(0.1, Attributes_BoostDrainStack, pack, TIMER_FLAG_NO_MAPCHANGE|TIMER_REPEAT);
pack.WriteCell(GetClientUserId(attacker));
pack.WriteFloat(fdamage / 1000.0 * Weapons_GetCustAttrFloat(weapon, "boost on damage drain multi", 1.0));
}
else
if(Attributes_GetByDefIndex(entity, 418, value) && value > 0.0) // boost on damage
{
CreateDataTimer(0.5, Attributes_BoostDrainStack, pack, TIMER_FLAG_NO_MAPCHANGE);
pack.WriteCell(GetClientUserId(attacker));
pack.WriteFloat(fdamage / 2.0);
DataPack pack;
if(Enabled)
{
CreateDataTimer(0.1, Attributes_BoostDrainStack, pack, TIMER_FLAG_NO_MAPCHANGE|TIMER_REPEAT);
pack.WriteCell(GetClientUserId(attacker));
pack.WriteFloat(fdamage / 1000.0 * Weapons_GetCustAttrFloat(entity, "boost on damage drain multi", 1.0));
}
else
{
CreateDataTimer(0.5, Attributes_BoostDrainStack, pack, TIMER_FLAG_NO_MAPCHANGE);
pack.WriteCell(GetClientUserId(attacker));
pack.WriteFloat(fdamage / 2.0);
}

break;
}
}

Expand All @@ -339,7 +336,6 @@ void Attributes_OnHitBoss(int attacker, int victim, int inflictor, float fdamage
{
if(Attributes_FindOnWeapon(attacker, weapon, 30)) // fists have radial buff
{
int entity;
int team = GetClientTeam(attacker);
float pos1[3], pos2[3];
GetClientAbsOrigin(attacker, pos1);
Expand Down Expand Up @@ -371,7 +367,7 @@ void Attributes_OnHitBoss(int attacker, int victim, int inflictor, float fdamage
Client(attacker).Assist += 50;
Client(attacker).RefreshAt = 0.0;

int i;
i = 0;
while(TF2_GetItem(target, entity, i))
{
SetEntProp(entity, Prop_Send, "m_iAccountID", 0);
Expand Down Expand Up @@ -566,7 +562,7 @@ void Attributes_OnHitBoss(int attacker, int victim, int inflictor, float fdamage
SetEntProp(attacker, Prop_Send, "m_nStreaks", streak, _, slot);

int total = streak;
for(int i; i < 4; i++)
for(i = 0; i < 4; i++)
{
if(i != slot)
total += GetEntProp(attacker, Prop_Send, "m_nStreaks", _, i);
Expand All @@ -593,7 +589,7 @@ void Attributes_OnHitBoss(int attacker, int victim, int inflictor, float fdamage
}

int team = GetClientTeam(attacker);
for(int i = 1; i <= MaxClients; i++)
for(i = 1; i <= MaxClients; i++)
{
if(i == attacker || (IsClientInGame(i) && !IsFakeClient(i) && GetClientTeam(i)==team))
event.FireToClient(i);
Expand Down Expand Up @@ -715,7 +711,7 @@ float Attributes_FindOnWeapon(int client, int entity, int index, bool multi = fa
return total;
}

bool Attributes_GetByDefIndex(int entity, int index, float &value)
bool Attributes_GetByDefIndex(int entity, int index, float &value = 0.0)
{
Address attrib = TF2Attrib_GetByDefIndex(entity, index);
if(attrib != Address_Null)
Expand Down
36 changes: 0 additions & 36 deletions addons/sourcemod/scripting/freak_fortress_2/bosses.sp
Original file line number Diff line number Diff line change
@@ -1,39 +1,3 @@
/*
void Bosses_PluginStart()
void Bosses_BuildPacks(int &charset, const char[] mapname)
void Bosses_MapEnd()
void Bosses_PluginEnd()
int Bosses_GetCharset(int charset, char[] buffer, int length)
int Bosses_GetCharsetLength()
ConfigMap Bosses_GetConfig(int special)
int Bosses_GetConfigLength()
int Bosses_GetByName(const char[] name, bool exact = true, bool enabled = true, int lang = -1, const char[] string = "name")
bool Bosses_CanAccessBoss(int client, int special, bool playing = false, int team = -1, bool enabled = true, bool &preview = false)
bool Bosses_GetBossName(int special, char[] buffer, int length, int lang = -1, const char[] string = "name")
bool Bosses_GetBossNameCfg(ConfigMap cfg, char[] buffer, int length, int lang = -1, const char[] string = "name")
void Bosses_CreateFromSpecial(int client, int special, int team, int leader = 0)
void Bosses_CreateFromConfig(int client, ConfigMap cfg, int team, int leader = 0)
void Bosses_SetHealth(int client, int players)
void Bosses_Equip(int client)
void Bosses_UpdateHealth(int client)
void Bosses_SetSpeed(int client)
void Bosses_ClientDisconnect(int client)
void Bosses_Remove(int client)
int Bosses_GetBossTeam()
void Bosses_PlayerRunCmd(int client, int buttons)
void Bosses_UseSlot(int client, int low, int high)
void Bosses_UseAbility(int client, const char[] plugin = NULL_STRING, const char[] ability, int slot, int buttonmode = 0)
int Bosses_GetArgInt(int client, const char[] ability, const char[] argument, int &value, int base = 10)
int Bosses_GetArgFloat(int client, const char[] ability, const char[] argument, float &value)
int Bosses_GetArgString(int client, const char[] ability, const char[] argument, char[] value, int length)
int Bosses_GetRandomSound(int client, const char[] key, SoundEnum sound, const char[] required = NULL_STRING)
int Bosses_GetRandomSoundCfg(ConfigMap cfg, const char[] key, SoundEnum sound, const char[] required = NULL_STRING)
int Bosses_GetSpecificSoundCfg(ConfigMap cfg, const char[] section, char[] key, int length, SoundEnum sound)
bool Bosses_PlaySound(int boss, const int[] clients, int numClients, const char[] key, const char[] required = NULL_STRING, int entity = SOUND_FROM_PLAYER, int channel = SNDCHAN_AUTO, int level = SNDLEVEL_NORMAL, int flags = SND_NOFLAGS, float volume = SNDVOL_NORMAL, int pitch = SNDPITCH_NORMAL, int speakerentity = -1, const float origin[3]=NULL_VECTOR, const float dir[3]=NULL_VECTOR, bool updatePos = true, float soundtime = 0.0)
bool Bosses_PlaySoundToClient(int boss, int client, const char[] key, const char[] required = NULL_STRING, int entity = SOUND_FROM_PLAYER, int channel = SNDCHAN_AUTO, int level = SNDLEVEL_NORMAL, int flags = SND_NOFLAGS, float volume = SNDVOL_NORMAL, int pitch = SNDPITCH_NORMAL, int speakerentity = -1, const float origin[3]=NULL_VECTOR, const float dir[3]=NULL_VECTOR, bool updatePos = true, float soundtime = 0.0)
bool Bosses_PlaySoundToAll(int boss, const char[] key, const char[] required = NULL_STRING, int entity = SOUND_FROM_PLAYER, int channel = SNDCHAN_AUTO, int level = SNDLEVEL_NORMAL, int flags = SND_NOFLAGS, float volume = SNDVOL_NORMAL, int pitch = SNDPITCH_NORMAL, int speakerentity = -1, const float origin[3]=NULL_VECTOR, const float dir[3]=NULL_VECTOR, bool updatePos = true, float soundtime = 0.0)
*/

#pragma semicolon 1
#pragma newdecls required

Expand Down
56 changes: 0 additions & 56 deletions addons/sourcemod/scripting/freak_fortress_2/client.sp
Original file line number Diff line number Diff line change
@@ -1,59 +1,3 @@
/*
bool IsBoss
ConfigMap Cfg
int Queue
bool NoMusic
bool MusicShuffle
bool NoVoice
bool NoChanges
bool NoDmgHud
bool NoHud
int GetLastPlayed(char[] buffer, int length)
void SetLastPlayed(const char[] buffer)
bool Minion
bool Glowing
float GlowFor
float OverlayFor
float RefreshAt
int Damage
int TotalDamage
int Healing
int Assist
int TotalAssist
int Stabs
int Index
int GetDamage(int slot)
void SetDamage(int slot, int damage)
int Lives
int MaxLives
int MaxHealth
int Health
float RageDamage
float RageMin
float RageMax
int RageMode
bool BlockVo
bool Crits
bool Triple
int Knockback
int Pickups
float LastStabTime
float LastTriggerDamage
float LastTriggerTime
int KillSpree
float LastKillTime
float PassiveAt
bool Speaking
int RPSHit
int RPSDamage
float RageDebuff
float GetCharge(int slot)
void SetCharge(int slot, float value)
void ResetByDeath()
void ResetByRound()
void ResetByAll()
*/

#pragma semicolon 1
#pragma newdecls required

Expand Down
4 changes: 0 additions & 4 deletions addons/sourcemod/scripting/freak_fortress_2/commands.sp
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
/*
void Command_PluginStart()
*/

#pragma semicolon 1
#pragma newdecls required

Expand Down
6 changes: 0 additions & 6 deletions addons/sourcemod/scripting/freak_fortress_2/configs.sp
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
/*
void Configs_AllPluginsLoaded()
void Configs_MapStart()
bool Configs_CheckMap(const char[] mapname)
*/

#pragma semicolon 1
#pragma newdecls required

Expand Down
7 changes: 0 additions & 7 deletions addons/sourcemod/scripting/freak_fortress_2/convars.sp
Original file line number Diff line number Diff line change
@@ -1,10 +1,3 @@
/*
void ConVar_PluginStart()
void ConVar_ConfigsExecuted()
void ConVar_Enable()
void ConVar_Disable()
*/

#pragma semicolon 1
#pragma newdecls required

Expand Down
7 changes: 0 additions & 7 deletions addons/sourcemod/scripting/freak_fortress_2/database.sp
Original file line number Diff line number Diff line change
@@ -1,10 +1,3 @@
/*
void Database_PluginStart()
void Database_PluginEnd()
void Database_ClientPostAdminCheck(int client)
void Database_ClientDisconnect(int client, DBPriority prioity = DBPrio_Normal)
*/

#pragma semicolon 1
#pragma newdecls required

Expand Down
15 changes: 0 additions & 15 deletions addons/sourcemod/scripting/freak_fortress_2/dhooks.sp
Original file line number Diff line number Diff line change
@@ -1,18 +1,3 @@
/*
void DHook_Setup()
void DHook_MapStart()
void DHook_HookClient(int client)
void DHook_HookBoss(int client)
void DHook_EntityCreated(int entity, const char[] classname)
void DHook_EntityDestoryed()
void DHook_HookStripWeapon()
void DHook_PluginEnd()
void DHook_UnhookClient(int client)
void DHook_UnhookBoss(int client)
Address DHook_GetGameStats()
Address DHook_GetLagCompensationManager()
*/

#pragma semicolon 1
#pragma newdecls required

Expand Down
11 changes: 0 additions & 11 deletions addons/sourcemod/scripting/freak_fortress_2/econdata.sp
Original file line number Diff line number Diff line change
@@ -1,14 +1,3 @@
/*
void TFED_PluginLoad()
void TFED_PluginStart()
void TFED_LibraryAdded(const char[] name)
void TFED_LibraryRemoved(const char[] name)
bool TFED_GetItemDefinitionString(int itemdef, const char[] key, char[] buffer, int maxlen, const char[] defaultValue = NULL_STRING)
bool TF2ED_GetLocalizedItemName(int itemdef, char[] name, int maxlen, const char[] classname = NULL_STRING)
bool TF2ED_GetAttributeDefinitionString(int attrdef, const char[] key, char[] buffer, int maxlen, const char[] defaultValue = NULL_STRING)
int TF2ED_TranslateAttributeNameToDefinitionIndex(const char[] name)
*/

#tryinclude <tf_econ_data>

#pragma semicolon 1
Expand Down
6 changes: 0 additions & 6 deletions addons/sourcemod/scripting/freak_fortress_2/events.sp
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
/*
void Events_PluginStart()
void Events_RoundSetup()
void Events_CheckAlivePlayers(int exclude = 0, bool alive = true, bool resetMax = false)
*/

#pragma semicolon 1
#pragma newdecls required

Expand Down
11 changes: 0 additions & 11 deletions addons/sourcemod/scripting/freak_fortress_2/filenetwork.sp
Original file line number Diff line number Diff line change
@@ -1,14 +1,3 @@
/*
void TFED_PluginLoad()
void TFED_PluginStart()
void TFED_LibraryAdded(const char[] name)
void TFED_LibraryRemoved(const char[] name)
bool TFED_GetItemDefinitionString(int itemdef, const char[] key, char[] buffer, int maxlen, const char[] defaultValue = NULL_STRING)
bool TF2ED_GetLocalizedItemName(int itemdef, char[] name, int maxlen, const char[] classname = NULL_STRING)
bool TF2ED_GetAttributeDefinitionString(int attrdef, const char[] key, char[] buffer, int maxlen, const char[] defaultValue = NULL_STRING)
int TF2ED_TranslateAttributeNameToDefinitionIndex(const char[] name)
*/

#tryinclude <filenetwork>

#pragma semicolon 1
Expand Down
14 changes: 0 additions & 14 deletions addons/sourcemod/scripting/freak_fortress_2/forwards.sp
Original file line number Diff line number Diff line change
@@ -1,17 +1,3 @@
/*
void Forward_PluginLoad()
void Forward_OnBossCreated(int client, ConfigMap cfg)
void Forward_OnBossRemoved(int client)
bool Forward_OnAbilityPre(int client, const char[] ability, ConfigMap cfg, bool &result)
void Forward_OnAbility(int client, const char[] ability, ConfigMap cfg, const char[] plugin)
void Forward_OnAbilityPost(int client, const char[] ability, ConfigMap cfg)
Action Forward_OnAliveChange()
Action Forward_OnBossPrecache(ConfigMap cfg, bool &precache)
void Forward_OnBossPrecached(ConfigMap cfg, bool precache, int index)
Action Forward_OnPickupDroppedWeapon(int client, int weapon)
void Forward_OnBossEquipped(int client, bool weapons)
*/

#pragma semicolon 1
#pragma newdecls required

Expand Down
15 changes: 0 additions & 15 deletions addons/sourcemod/scripting/freak_fortress_2/forwards_old.sp
Original file line number Diff line number Diff line change
@@ -1,18 +1,3 @@
/*
void ForwardOld_Setup()
bool ForwardOld_PreAbility(int client, const char[] plugin, const char[] ability, int slot)
void ForwardOld_OnAbility(int client, const char[] plugin, const char[] ability)
bool ForwardOld_OnMusic(char[] path, float &time, char[] name, char[] artist, int client)
Action ForwardOld_OnTriggerHurt(int client, int entity, float &damage)
bool ForwardOld_OnSpecialSelected(int client, int &special, char name[64], bool preset)
bool ForwardOld_OnAddQueuePoints(int[] points, int size)
bool ForwardOld_OnLoadCharacterSet(int &charset, char name[64])
bool ForwardOld_OnLoseLife(int client)
void ForwardOld_OnAlivePlayersChanged(int red, int blu)
Action ForwardOld_OnBackstabbed(int client, int attacker)
bool ForwardOld_OnMusicPerBoss(int client)
*/

#pragma semicolon 1
#pragma newdecls required

Expand Down
18 changes: 0 additions & 18 deletions addons/sourcemod/scripting/freak_fortress_2/gamemode.sp
Original file line number Diff line number Diff line change
@@ -1,21 +1,3 @@
/*
void Gamemode_PluginStart()
void Gamemode_PluginEnd()
void Gamemode_MapInit()
void Gamemode_MapStart()
void Gamemode_MapEnd()
void Gamemode_RoundSetup()
void Gamemode_RoundStart()
void Gamemode_CheckPointUnlock(int alive, bool notice)
void Gamemode_OverrideWinner(int team = -1)
void Gamemode_RoundEnd(int winteam)
void Gamemode_UpdateHUD(int team, bool healing = false, bool nobar = false)
void Gamemode_SetClientGlow(int client, float duration)void Gamemode_SetClientGlow(int client, float duration)
void Gamemode_PlayerRunCmd(int client)
void Gamemode_ConditionAdded(int client, TFCond cond)
void Gamemode_ConditionRemoved(int client, TFCond cond)
*/

#pragma semicolon 1
#pragma newdecls required

Expand Down
5 changes: 0 additions & 5 deletions addons/sourcemod/scripting/freak_fortress_2/goomba.sp
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
/*
void Goomba_RoundSetup()
void Goomba_BossCreated(ConfigMap cfg)
*/

#tryinclude <goomba>

#pragma semicolon 1
Expand Down
7 changes: 0 additions & 7 deletions addons/sourcemod/scripting/freak_fortress_2/menu.sp
Original file line number Diff line number Diff line change
@@ -1,10 +1,3 @@
/*
void Menu_PluginStart()
void Menu_Command(int client)
bool Menu_BackButton(int client)
void Menu_MainMenu(int client)
*/

#pragma semicolon 1
#pragma newdecls required

Expand Down
14 changes: 0 additions & 14 deletions addons/sourcemod/scripting/freak_fortress_2/music.sp
Original file line number Diff line number Diff line change
@@ -1,17 +1,3 @@
/*
void Music_PluginStart()
void Music_ClearPlaylist()
void Music_AddSong(int special, const char[] section, const char[] key)
void Music_RoundStart()
void Music_RoundEnd(int[] clients, int amount, int winner)
void Music_PlayerRunCmd(int client)
void Music_PlayNextSong(int client = 0)
void Music_PlaySong(int[] clients, int numClients, const char[] sample = NULL_STRING, int source = 0, const char[] name = NULL_STRING, const char[] artist = NULL_STRING, float duration = 0.0, float volume = 1.0, int pitch = SNDPITCH_NORMAL)
void Music_PlaySongToClient(int client, const char[] sample = NULL_STRING, int source = 0, const char[] name = NULL_STRING, const char[] artist = NULL_STRING, float duration = 0.0, float volume = 1.0, int pitch = SNDPITCH_NORMAL)
void Music_PlaySongToAll(const char[] sample = NULL_STRING, int source = 0, const char[] name = NULL_STRING, const char[] artist = NULL_STRING, float duration = 0.0, float volume = 1.0, int pitch = SNDPITCH_NORMAL)
void Music_MainMenu(int client)
*/

#pragma semicolon 1
#pragma newdecls required

Expand Down
Loading

0 comments on commit 6d8ad5d

Please sign in to comment.