Check supported skins by name instead of number, so we can have bonuschars images

This commit is contained in:
Sally Coolatta 2020-08-17 04:42:05 -04:00
parent 9f4ad1303e
commit a04361a151

View file

@ -287,13 +287,70 @@ void DRPC_UpdatePresence(void)
// Character info
if (Playing() && playeringame[consoleplayer] && !players[consoleplayer].spectator)
{
if (players[consoleplayer].skin < 5) // supported skins
// Supported skin names
static const char *supportedSkins[] = {
// base game
"sonic",
"tails",
"knuckles",
"eggman",
"metalsonic",
// bonus chars
"flicky",
"motobug",
"amy",
"mighty",
"ray",
"espio",
"vector",
"chao",
"gamma",
"chaos",
"shadow",
"rouge",
"herochao",
"darkchao",
"cream",
"omega",
"blaze",
"silver",
"wonderboy",
"arle",
"nights",
"sakura",
"ulala",
"beat",
"vyse",
"aiai",
"kiryu",
"aigis",
"miku",
"doom",
NULL
};
boolean customChar = true;
UINT8 checkSkin = 0;
// Character image
while (supportedSkins[checkSkin] != NULL)
{
snprintf(charimg, 21, "char%s", skins[players[consoleplayer].skin].name);
discordPresence.smallImageKey = charimg; // Character image
if (!strcmp(skins[players[consoleplayer].skin].name, supportedSkins[checkSkin]))
{
snprintf(charimg, 21, "char%s", supportedSkins[checkSkin]);
discordPresence.smallImageKey = charimg;
customChar = false;
break;
}
checkSkin++;
}
if (customChar == true)
{
// Use the custom character icon!
discordPresence.smallImageKey = "charcustom";
}
else
discordPresence.smallImageKey = "charnull"; // Just so that you can still see the name of custom chars
snprintf(charname, 28, "Character: %s", skins[players[consoleplayer].skin].realname);
discordPresence.smallImageText = charname; // Character name