Skip to content
Permalink
Browse files

Don't precache files without name

  • Loading branch information...
Bara committed Mar 4, 2019
1 parent 3e724c5 commit bdbe881ed4b8f5a9f46471b44a18e52e1238b301
Showing with 84 additions and 42 deletions.
  1. +1 −1 addons/sourcemod/configs/ttt/time_overlays.ini
  2. +83 −41 addons/sourcemod/scripting/ttt/ttt_overlay.sp
@@ -4,5 +4,5 @@
// Second key is the overlay path+file. Which path/file you must set is the same as for the following convars (as examples):
// - ttt_overlay_detective, ttt_overlay_traitor, ttt_overlay_inno, ttt_overlay_detective_win, ttt_overlay_traitor_win or ttt_overlay_inno_win
"120" "path/to/your/overlay"
"120" "" // empty value = disabled
}
@@ -115,68 +115,107 @@ public void OnMapStart()
char sBuffer[PLATFORM_MAX_PATH];

g_coverlayTWin.GetString(sBuffer, sizeof(sBuffer));
Format(sBuffer, sizeof(sBuffer), "materials/%s.vmt", sBuffer);
AddFileToDownloadsTable(sBuffer);

if (strlen(sBuffer) > 2)
{
Format(sBuffer, sizeof(sBuffer), "materials/%s.vmt", sBuffer);
AddFileToDownloadsTable(sBuffer);
}

g_coverlayTWin.GetString(sBuffer, sizeof(sBuffer));
Format(sBuffer, sizeof(sBuffer), "materials/%s.vtf", sBuffer);
AddFileToDownloadsTable(sBuffer);

PrecacheDecal(sBuffer, true);

if (strlen(sBuffer) > 2)
{
Format(sBuffer, sizeof(sBuffer), "materials/%s.vtf", sBuffer);
AddFileToDownloadsTable(sBuffer);
PrecacheDecal(sBuffer, true);
}

g_coverlayIWin.GetString(sBuffer, sizeof(sBuffer));
Format(sBuffer, sizeof(sBuffer), "materials/%s.vmt", sBuffer);
AddFileToDownloadsTable(sBuffer);

if (strlen(sBuffer) > 2)
{
Format(sBuffer, sizeof(sBuffer), "materials/%s.vmt", sBuffer);
AddFileToDownloadsTable(sBuffer);
}

g_coverlayIWin.GetString(sBuffer, sizeof(sBuffer));
Format(sBuffer, sizeof(sBuffer), "materials/%s.vtf", sBuffer);
AddFileToDownloadsTable(sBuffer);

PrecacheDecal(sBuffer, true);

if (strlen(sBuffer) > 2)
{
Format(sBuffer, sizeof(sBuffer), "materials/%s.vtf", sBuffer);
AddFileToDownloadsTable(sBuffer);
PrecacheDecal(sBuffer, true);
}

g_coverlayDWin.GetString(sBuffer, sizeof(sBuffer));
Format(sBuffer, sizeof(sBuffer), "materials/%s.vmt", sBuffer);
AddFileToDownloadsTable(sBuffer);

if (strlen(sBuffer) > 2)
{
Format(sBuffer, sizeof(sBuffer), "materials/%s.vmt", sBuffer);
AddFileToDownloadsTable(sBuffer);
}

g_coverlayDWin.GetString(sBuffer, sizeof(sBuffer));
Format(sBuffer, sizeof(sBuffer), "materials/%s.vtf", sBuffer);
AddFileToDownloadsTable(sBuffer);

PrecacheDecal(sBuffer, true);

if (strlen(sBuffer) > 2)
{
Format(sBuffer, sizeof(sBuffer), "materials/%s.vtf", sBuffer);
AddFileToDownloadsTable(sBuffer);
PrecacheDecal(sBuffer, true);
}
g_cDetectiveIcon.GetString(sBuffer, sizeof(sBuffer));
Format(sBuffer, sizeof(sBuffer), "materials/%s.vmt", sBuffer);
AddFileToDownloadsTable(sBuffer);

if (strlen(sBuffer) > 2)
{
Format(sBuffer, sizeof(sBuffer), "materials/%s.vmt", sBuffer);
AddFileToDownloadsTable(sBuffer);
}

g_cDetectiveIcon.GetString(sBuffer, sizeof(sBuffer));
Format(sBuffer, sizeof(sBuffer), "materials/%s.vtf", sBuffer);
AddFileToDownloadsTable(sBuffer);

PrecacheDecal(sBuffer, true);
if (strlen(sBuffer) > 2)
{
Format(sBuffer, sizeof(sBuffer), "materials/%s.vtf", sBuffer);
AddFileToDownloadsTable(sBuffer);
PrecacheDecal(sBuffer, true);
}


g_cTraitorIcon.GetString(sBuffer, sizeof(sBuffer));
Format(sBuffer, sizeof(sBuffer), "materials/%s.vmt", sBuffer);
AddFileToDownloadsTable(sBuffer);

if (strlen(sBuffer) > 2)
{
Format(sBuffer, sizeof(sBuffer), "materials/%s.vmt", sBuffer);
AddFileToDownloadsTable(sBuffer);
}

g_cTraitorIcon.GetString(sBuffer, sizeof(sBuffer));
Format(sBuffer, sizeof(sBuffer), "materials/%s.vtf", sBuffer);
AddFileToDownloadsTable(sBuffer);

PrecacheDecal(sBuffer, true);
if (strlen(sBuffer) > 2)
{
Format(sBuffer, sizeof(sBuffer), "materials/%s.vtf", sBuffer);
AddFileToDownloadsTable(sBuffer);
PrecacheDecal(sBuffer, true);
}


g_cInnocentIcon.GetString(sBuffer, sizeof(sBuffer));
Format(sBuffer, sizeof(sBuffer), "materials/%s.vmt", sBuffer);
AddFileToDownloadsTable(sBuffer);

if (strlen(sBuffer) > 2)
{
Format(sBuffer, sizeof(sBuffer), "materials/%s.vmt", sBuffer);
AddFileToDownloadsTable(sBuffer);
}

g_cInnocentIcon.GetString(sBuffer, sizeof(sBuffer));
Format(sBuffer, sizeof(sBuffer), "materials/%s.vtf", sBuffer);
AddFileToDownloadsTable(sBuffer);

PrecacheDecal(sBuffer, true);
if (strlen(sBuffer) > 2)
{
Format(sBuffer, sizeof(sBuffer), "materials/%s.vtf", sBuffer);
AddFileToDownloadsTable(sBuffer);
PrecacheDecal(sBuffer, true);
}

g_iCTWin = 0;
g_iTWin = 0;
@@ -221,16 +260,19 @@ void PrecacheTimeOverlays()
kv.GetSectionName(sTime, sizeof(sTime));
kv.GetString(NULL_STRING, sOverlay, sizeof(sOverlay));

char sFullPath[PLATFORM_MAX_PATH];
Format(sFullPath, sizeof(sFullPath), "materials/%s.vmt", sOverlay);
AddFileToDownloadsTable(sFullPath);
Format(sFullPath, sizeof(sFullPath), "materials/%s.vtf", sOverlay);
AddFileToDownloadsTable(sFullPath);
PrecacheDecal(sFullPath, true);
if (strlen(sOverlay) > 2)
{
char sFullPath[PLATFORM_MAX_PATH];
Format(sFullPath, sizeof(sFullPath), "materials/%s.vmt", sOverlay);
AddFileToDownloadsTable(sFullPath);
Format(sFullPath, sizeof(sFullPath), "materials/%s.vtf", sOverlay);
AddFileToDownloadsTable(sFullPath);
PrecacheDecal(sFullPath, true);

g_smTimeOverlays.SetString(sTime, sOverlay);
g_smTimeOverlays.SetString(sTime, sOverlay);

LogMessage("[Time-Overlays] Time: %s, Overlay: %s", sTime, sOverlay);
LogMessage("[Time-Overlays] Time: %s, Overlay: %s", sTime, sOverlay);
}
}
while (kv.GotoNextKey(false));

0 comments on commit bdbe881

Please sign in to comment.
You can’t perform that action at this time.