splewis / get5

CS:GO Sourcemod plugin for competitive matches/scrims
GNU General Public License v3.0
557 stars 174 forks source link

Support SVG logos for get5 (API already does somewhat) #536

Closed tuudik closed 4 years ago

tuudik commented 4 years ago

Expected behavior

PR https://github.com/splewis/get5/pull/498 has made it possible to use SVG logos for team. get5 should check if SVG logo exists and use it or if it's missing it, download it.

Actual behavior

get5 works only with png (matchconfig.sp):

static void AddTeamLogoToDownloadTable(const char[] logoName) {
  if (StrEqual(logoName, ""))
    return;

  char logoPath[PLATFORM_MAX_PATH + 1];
  Format(logoPath, sizeof(logoPath), "resource/flash/econ/tournaments/teams/%s.png", logoName);
  LogDebug("Adding file %s to download table", logoName);
  AddFileToDownloadsTable(logoPath);
}

Sadly I'm very low experienced with SourcePawn, but I guess there should be same check as for API, if get5_use_svg is 1, it should check if SVG exists. I dont know how to share CVAR between two plugins. Separate question is then, where should the CVAR be located, which config.

tuudik commented 4 years ago

@MoritzLoewenstein Perhaps you have time to check this issue too?

MoritzLoewenstein commented 4 years ago

PR would look like this (cant try out right now):

#include "util.sp"
#define LOGO_PATH "materials/panorama/images/tournaments/teams/%s.png"
#define LEGACY_LOGO_PATH "resource/flash/econ/tournaments/teams/%s.svg"
[...after "char logoPath[PLATFORM_MAX_PATH + 1];"]
int useSvg = GetCvarIntSafe("get5_use_svg");
logoPath = useSvg == 1 ? LOGO_PATH : LEGACY_LOGO_PATH;
Format(logoPath, sizeof(logoPath), logoPath, logoName);
splewis commented 4 years ago

Should be resolved by #538 now.

MoritzLoewenstein commented 4 years ago

Unless I am missing something this does not get solved via #538, because the legacy logo path is hardcoded in the Format(...), but the svg logos are in the normal path.