Add supername parameter to S_SKIN: displays a custom super name on the GOT THEM ALL screen

This commit is contained in:
katsy 2023-08-20 17:29:03 +00:00 committed by sphere
parent ff57a983d7
commit 1a0d9eab79
3 changed files with 46 additions and 11 deletions

View file

@ -113,6 +113,7 @@ static void Sk_SetDefaultValue(skin_t *skin)
strcpy(skin->realname, "Someone"); strcpy(skin->realname, "Someone");
strcpy(skin->hudname, "???"); strcpy(skin->hudname, "???");
strcpy(skin->supername, "Someone super");
skin->starttranscolor = 96; skin->starttranscolor = 96;
skin->prefcolor = SKINCOLOR_GREEN; skin->prefcolor = SKINCOLOR_GREEN;
@ -680,7 +681,7 @@ void R_AddSkins(UINT16 wadnum, boolean mainfile)
char *value; char *value;
size_t size; size_t size;
skin_t *skin; skin_t *skin;
boolean hudname, realname; boolean hudname, realname, supername;
// //
// search for all skin markers in pwad // search for all skin markers in pwad
@ -710,7 +711,7 @@ void R_AddSkins(UINT16 wadnum, boolean mainfile)
skin = &skins[numskins]; skin = &skins[numskins];
Sk_SetDefaultValue(skin); Sk_SetDefaultValue(skin);
skin->wadnum = wadnum; skin->wadnum = wadnum;
hudname = realname = false; hudname = realname = supername = false;
// parse // parse
stoken = strtok (buf2, "\r\n= "); stoken = strtok (buf2, "\r\n= ");
while (stoken) while (stoken)
@ -753,7 +754,7 @@ void R_AddSkins(UINT16 wadnum, boolean mainfile)
Z_Free(value2); Z_Free(value2);
} }
// copy to hudname and fullname as a default. // copy to hudname, realname, and supername as a default.
if (!realname) if (!realname)
{ {
STRBUFCPY(skin->realname, skin->name); STRBUFCPY(skin->realname, skin->name);
@ -769,6 +770,19 @@ void R_AddSkins(UINT16 wadnum, boolean mainfile)
strupr(skin->hudname); strupr(skin->hudname);
SYMBOLCONVERT(skin->hudname) SYMBOLCONVERT(skin->hudname)
} }
else if (!supername)
{
char super[7], someone[SKINNAMESIZE+1];
strcpy(super, "Super ");
strcpy(someone, skin->realname);
STRBUFCPY(skin->supername, strcat(super, someone));
}
}
else if (!stricmp(stoken, "supername"))
{ // Super name (eg. "Super Knuckles")
supername = true;
STRBUFCPY(skin->supername, value);
SYMBOLCONVERT(skin->supername)
} }
else if (!stricmp(stoken, "realname")) else if (!stricmp(stoken, "realname"))
{ // Display name (eg. "Knuckles") { // Display name (eg. "Knuckles")
@ -777,6 +791,13 @@ void R_AddSkins(UINT16 wadnum, boolean mainfile)
SYMBOLCONVERT(skin->realname) SYMBOLCONVERT(skin->realname)
if (!hudname) if (!hudname)
HUDNAMEWRITE(skin->realname); HUDNAMEWRITE(skin->realname);
if (!supername) //copy over default to capitalise the name
{
char super[7], someone[SKINNAMESIZE+1];
strcpy(super, "Super ");
strcpy(someone, skin->realname);
STRBUFCPY(skin->supername, strcat(super, someone));
}
} }
else if (!stricmp(stoken, "hudname")) else if (!stricmp(stoken, "hudname"))
{ // Life icon name (eg. "K.T.E") { // Life icon name (eg. "K.T.E")
@ -829,7 +850,7 @@ void R_PatchSkins(UINT16 wadnum, boolean mainfile)
char *value; char *value;
size_t size; size_t size;
skin_t *skin; skin_t *skin;
boolean noskincomplain, realname, hudname; boolean noskincomplain, realname, hudname, supername;
// //
// search for all skin patch markers in pwad // search for all skin patch markers in pwad
@ -853,7 +874,7 @@ void R_PatchSkins(UINT16 wadnum, boolean mainfile)
buf2[size] = '\0'; buf2[size] = '\0';
skin = NULL; skin = NULL;
noskincomplain = realname = hudname = false; noskincomplain = realname = hudname = supername = false;
/* /*
Parse. Has more phases than the parser in R_AddSkins because it needs to have the patching name first (no default skin name is acceptible for patching, unlike skin creation) Parse. Has more phases than the parser in R_AddSkins because it needs to have the patching name first (no default skin name is acceptible for patching, unlike skin creation)
@ -892,13 +913,26 @@ void R_PatchSkins(UINT16 wadnum, boolean mainfile)
else // Get the properties! else // Get the properties!
{ {
// Some of these can't go in R_ProcessPatchableFields because they have side effects for future lines. // Some of these can't go in R_ProcessPatchableFields because they have side effects for future lines.
if (!stricmp(stoken, "realname")) if (!stricmp(stoken, "supername"))
{ // Super name (eg. "Super Knuckles")
supername = true;
STRBUFCPY(skin->supername, value);
SYMBOLCONVERT(skin->supername)
}
else if (!stricmp(stoken, "realname"))
{ // Display name (eg. "Knuckles") { // Display name (eg. "Knuckles")
realname = true; realname = true;
STRBUFCPY(skin->realname, value); STRBUFCPY(skin->realname, value);
SYMBOLCONVERT(skin->realname) SYMBOLCONVERT(skin->realname)
if (!hudname) if (!hudname)
HUDNAMEWRITE(skin->realname); HUDNAMEWRITE(skin->realname);
if (!supername) //copy over default to capitalise the name
{
char super[7], someone[SKINNAMESIZE+1];
strcpy(super, "Super ");
strcpy(someone, skin->realname);
STRBUFCPY(skin->supername, strcat(super, someone));
}
} }
else if (!stricmp(stoken, "hudname")) else if (!stricmp(stoken, "hudname"))
{ // Life icon name (eg. "K.T.E") { // Life icon name (eg. "K.T.E")

View file

@ -35,8 +35,9 @@ typedef struct
UINT16 wadnum; UINT16 wadnum;
skinflags_t flags; skinflags_t flags;
char realname[SKINNAMESIZE+1]; // Display name for level completion. char realname[SKINNAMESIZE+1]; // Display name for level completion
char hudname[SKINNAMESIZE+1]; // HUD name to display (officially exactly 5 characters long) char hudname[SKINNAMESIZE+1]; // HUD name to display (officially exactly 5 characters long)
char supername[SKINNAMESIZE+7]; // Super name to display when collecting all emeralds
UINT8 ability; // ability definition UINT8 ability; // ability definition
UINT8 ability2; // secondary ability definition UINT8 ability2; // secondary ability definition

View file

@ -1451,10 +1451,10 @@ void Y_StartIntermission(void)
if (players[consoleplayer].charflags & SF_SUPER) if (players[consoleplayer].charflags & SF_SUPER)
{ {
strcpy(data.spec.passed3, "can now become"); strcpy(data.spec.passed3, "can now become");
snprintf(data.spec.passed4, if (strlen(skins[players[consoleplayer].skin].supername) > 20) //too long, use generic
sizeof data.spec.passed4, "Super %s", strcpy(data.spec.passed4, "their super form");
skins[players[consoleplayer].skin].realname); else
data.spec.passed4[sizeof data.spec.passed4 - 1] = '\0'; strcpy(data.spec.passed4, skins[players[consoleplayer].skin].supername);
} }
} }
else else