Skip to content

Commit

Permalink
File Network for Boss Downloads (#190)
Browse files Browse the repository at this point in the history
Adds support for using [File Network](https://github.com/Batfoxkid/File-Network) as an alternative
for boss downloads, especially sound files. This will help in some cases
where you may need to reduce entry downloads or things that may be
optional like alternative music or catch phrases. Any file is supported
but models are not handled by FF2 or anything that does not play from
FF2. A new native `FF2R_ClientHasFile` is available for these cases.
  • Loading branch information
Batfoxkid committed Apr 7, 2024
1 parent e27bd4d commit 1732a8d
Show file tree
Hide file tree
Showing 23 changed files with 793 additions and 283 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ Recommended:
Supported:

- [SteamWorks](https://github.com/ExperimentFailed/SteamWorks)
- [File Network](https://github.com/Batfoxkid/File-Network)
- [SM-TFUtils](https://github.com/nosoop/SM-TFUtils)
- [SM-TFCustomWeaponsX](https://github.com/nosoop/SM-TFCustomWeaponsX)
- [Goomba](https://github.com/Flyflo/SM-Goomba-Stomp-Addons)
Expand Down
13 changes: 12 additions & 1 deletion addons/sourcemod/scripting/freak_fortress_2.sp
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,8 @@ enum SectionType
Section_Precache, // precache
Section_Download, // download
Section_Model, // mod_download
Section_Material // mat_download
Section_Material, // mat_download
Section_FileNet // filenetwork
};

enum struct SoundEnum
Expand All @@ -138,13 +139,16 @@ enum struct SoundEnum

char Overlay[PLATFORM_MAX_PATH];
float Duration;
int OverlayFileNet;

int Entity;
int Channel;
int Level;
int Flags;
float Volume;
int Pitch;

int FileNet;

void Default()
{
Expand Down Expand Up @@ -236,6 +240,7 @@ Handle ThisPlugin;
#include "freak_fortress_2/dhooks.sp"
#include "freak_fortress_2/econdata.sp"
#include "freak_fortress_2/events.sp"
#include "freak_fortress_2/filenetwork.sp"
#include "freak_fortress_2/formula_parser.sp"
#include "freak_fortress_2/forwards.sp"
#include "freak_fortress_2/forwards_old.sp"
Expand Down Expand Up @@ -297,6 +302,7 @@ public void OnPluginStart()
Database_PluginStart();
DHook_Setup();
Events_PluginStart();
FileNet_PluginStart();
Gamemode_PluginStart();
Menu_PluginStart();
Music_PluginStart();
Expand Down Expand Up @@ -354,6 +360,7 @@ public void OnConfigsExecuted()
public void OnMapEnd()
{
Bosses_MapEnd();
FileNet_MapEnd();
Gamemode_MapEnd();
Preference_MapEnd();
}
Expand All @@ -370,6 +377,7 @@ public void OnPluginEnd()

public void OnLibraryAdded(const char[] name)
{
FileNet_LibraryAdded(name);
SDKHook_LibraryAdded(name);
SteamWorks_LibraryAdded(name);
TF2U_LibraryAdded(name);
Expand All @@ -379,6 +387,7 @@ public void OnLibraryAdded(const char[] name)

public void OnLibraryRemoved(const char[] name)
{
FileNet_LibraryRemoved(name);
SDKHook_LibraryRemoved(name);
SteamWorks_LibraryRemoved(name);
TF2U_LibraryRemoved(name);
Expand All @@ -389,6 +398,7 @@ public void OnLibraryRemoved(const char[] name)
public void OnClientPutInServer(int client)
{
DHook_HookClient(client);
FileNet_ClientPutInServer(client);
SDKHook_HookClient(client);
}

Expand All @@ -402,6 +412,7 @@ public void OnClientDisconnect(int client)
Bosses_ClientDisconnect(client);
Database_ClientDisconnect(client);
Events_CheckAlivePlayers(client);
FileNet_ClientDisconnect(client);
Preference_ClientDisconnect(client);

Client(client).ResetByAll();
Expand Down
8 changes: 4 additions & 4 deletions addons/sourcemod/scripting/freak_fortress_2/attributes.sp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ void Attributes_PluginStart()
HookUserMessage(GetUserMessageId("PlayerJarated"), Attributes_OnJarateBoss);
}

public Action Attributes_OnJarateBoss(UserMsg msg_id, BfRead bf, const int[] players, int playersNum, bool reliable, bool init)
static Action Attributes_OnJarateBoss(UserMsg msg_id, BfRead bf, const int[] players, int playersNum, bool reliable, bool init)
{
int attacker = bf.ReadByte();
int victim = bf.ReadByte();
Expand Down Expand Up @@ -63,7 +63,7 @@ public Action Attributes_OnJarateBoss(UserMsg msg_id, BfRead bf, const int[] pla
return Plugin_Continue;
}

public void ReapplyMilk(DataPack pack)
static void ReapplyMilk(DataPack pack)
{
pack.Reset();

Expand Down Expand Up @@ -183,7 +183,7 @@ bool Attributes_OnBackstabBoss(int attacker, int victim, float &damage, int weap
return silent;
}

public void Attributes_RedisguiseFrame(DataPack pack)
static void Attributes_RedisguiseFrame(DataPack pack)
{
pack.Reset();

Expand Down Expand Up @@ -756,7 +756,7 @@ bool Attributes_GetByDefIndex(int entity, int index, float &value)
return false;
}

public Action Attributes_BoostDrainStack(Handle timer, DataPack pack)
static Action Attributes_BoostDrainStack(Handle timer, DataPack pack)
{
pack.Reset();
int client = GetClientOfUserId(pack.ReadCell());
Expand Down
Loading

0 comments on commit 1732a8d

Please sign in to comment.