More clearly defined handling for replacing character select images. Specifically takes into account whether the hidden character was added in this file or a seperate one.
Also, removed some commented out code regarding character selects, and removed a useless case for R_SkinAvailable().
This commit is contained in:
parent
80a3d79d4d
commit
fcfe8c0132
|
@ -430,16 +430,20 @@ static void readAnimTex(MYFILE *f, INT32 num)
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static boolean findFreeSlot(INT32 *num)
|
static boolean findFreeSlot(INT32 *num, UINT16 wadnum)
|
||||||
{
|
{
|
||||||
// Send the character select entry to a free slot.
|
// Send the character select entry to a free slot.
|
||||||
while (*num < 32 && !(PlayerMenu[*num].status & IT_DISABLED)) // Will overwrite hidden characters, but it works out. You can't unlock if you're adding extra characters anyways.
|
while (*num < 32 && !(PlayerMenu[*num].status & IT_DISABLED && description[*num].wadnum != wadnum)) // Will kill hidden characters from other files, but that's okay.
|
||||||
*num = *num+1;
|
*num = *num+1;
|
||||||
|
|
||||||
// No more free slots. :(
|
// No more free slots. :(
|
||||||
if (*num >= 32)
|
if (*num >= 32)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
PlayerMenu[*num].status = IT_CALL;
|
||||||
|
description[*num].wadnum = wadnum;
|
||||||
|
description[*num].picname[0] = '\0'; // Redesign your logo. (See M_DrawSetupChoosePlayerMenu in m_menu.c...)
|
||||||
|
|
||||||
// Found one! ^_^
|
// Found one! ^_^
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -473,9 +477,8 @@ static void readPlayer(MYFILE *f, INT32 num)
|
||||||
{
|
{
|
||||||
char *playertext = NULL;
|
char *playertext = NULL;
|
||||||
|
|
||||||
if (!slotfound && (slotfound = findFreeSlot(&num)) == false)
|
if (!slotfound && (slotfound = findFreeSlot(&num, f->wad)) == false)
|
||||||
goto done;
|
goto done;
|
||||||
PlayerMenu[num].status = IT_CALL;
|
|
||||||
|
|
||||||
for (i = 0; i < MAXLINELEN-3; i++)
|
for (i = 0; i < MAXLINELEN-3; i++)
|
||||||
{
|
{
|
||||||
|
@ -521,34 +524,12 @@ static void readPlayer(MYFILE *f, INT32 num)
|
||||||
word2[strlen(word2)-1] = '\0';
|
word2[strlen(word2)-1] = '\0';
|
||||||
i = atoi(word2);
|
i = atoi(word2);
|
||||||
|
|
||||||
/*if (fastcmp(word, "PLAYERNAME"))
|
if (fastcmp(word, "PICNAME"))
|
||||||
{
|
{
|
||||||
if (!slotfound && (slotfound = findFreeSlot(&num)) == false)
|
if (!slotfound && (slotfound = findFreeSlot(&num, f->wad)) == false)
|
||||||
goto done;
|
|
||||||
DEH_WriteUndoline(word, description[num].text, UNDO_NONE);
|
|
||||||
strlcpy(description[num].text, word2, sizeof (description[num].text));
|
|
||||||
for (word2 = description[num].text; *word2; word2++)
|
|
||||||
if (*word2 == '_')
|
|
||||||
*word2 = ' ';
|
|
||||||
PlayerMenu[num].text = description[num].text;
|
|
||||||
}*/
|
|
||||||
/* else if (fastcmp(word, "MENUPOSITION"))
|
|
||||||
{ // Make sure you make MENUPOSITION the first thing under CHARACTER if you're using it!
|
|
||||||
// This is to manually choose a slot and overwrite existing characters! It is NOT necessary for most individual character wads!!
|
|
||||||
#ifdef DELFILE
|
|
||||||
if (disableundo)
|
|
||||||
#endif
|
|
||||||
{
|
|
||||||
slotfound = true;
|
|
||||||
num = i;
|
|
||||||
}
|
|
||||||
} */
|
|
||||||
/*else*/ if (fastcmp(word, "PICNAME"))
|
|
||||||
{
|
|
||||||
if (!slotfound && (slotfound = findFreeSlot(&num)) == false)
|
|
||||||
goto done;
|
goto done;
|
||||||
DEH_WriteUndoline(word, &description[num].picname[0], UNDO_NONE);
|
DEH_WriteUndoline(word, &description[num].picname[0], UNDO_NONE);
|
||||||
PlayerMenu[num].status = IT_CALL;
|
|
||||||
strncpy(description[num].picname, word2, 8);
|
strncpy(description[num].picname, word2, 8);
|
||||||
}
|
}
|
||||||
else if (fastcmp(word, "STATUS"))
|
else if (fastcmp(word, "STATUS"))
|
||||||
|
@ -565,11 +546,8 @@ static void readPlayer(MYFILE *f, INT32 num)
|
||||||
|
|
||||||
Because of this, you are allowed to edit any previous entries you like, but only if you
|
Because of this, you are allowed to edit any previous entries you like, but only if you
|
||||||
signal that you are purposely doing so by disabling and then reenabling the slot.
|
signal that you are purposely doing so by disabling and then reenabling the slot.
|
||||||
|
|
||||||
... Or use MENUPOSITION first, that works too. Hell, you could edit multiple character
|
|
||||||
slots in a single section that way, due to how SOC editing works.
|
|
||||||
*/
|
*/
|
||||||
if (i != IT_DISABLED && !slotfound && (slotfound = findFreeSlot(&num)) == false)
|
if (i != IT_DISABLED && !slotfound && (slotfound = findFreeSlot(&num, f->wad)) == false)
|
||||||
goto done;
|
goto done;
|
||||||
DEH_WriteUndoline(word, va("%d", PlayerMenu[num].status), UNDO_NONE);
|
DEH_WriteUndoline(word, va("%d", PlayerMenu[num].status), UNDO_NONE);
|
||||||
PlayerMenu[num].status = (INT16)i;
|
PlayerMenu[num].status = (INT16)i;
|
||||||
|
@ -577,15 +555,12 @@ static void readPlayer(MYFILE *f, INT32 num)
|
||||||
else if (fastcmp(word, "SKINNAME"))
|
else if (fastcmp(word, "SKINNAME"))
|
||||||
{
|
{
|
||||||
// Send to free slot.
|
// Send to free slot.
|
||||||
if (!slotfound && (slotfound = findFreeSlot(&num)) == false)
|
if (!slotfound && (slotfound = findFreeSlot(&num, f->wad)) == false)
|
||||||
goto done;
|
goto done;
|
||||||
DEH_WriteUndoline(word, description[num].skinname, UNDO_NONE);
|
DEH_WriteUndoline(word, description[num].skinname, UNDO_NONE);
|
||||||
PlayerMenu[num].status = IT_CALL;
|
|
||||||
|
|
||||||
strlcpy(description[num].skinname, word2, sizeof description[num].skinname);
|
strlcpy(description[num].skinname, word2, sizeof description[num].skinname);
|
||||||
strlwr(description[num].skinname);
|
strlwr(description[num].skinname);
|
||||||
|
|
||||||
description[num].picname[0] = '\0'; // Redesign your logo. (See M_DrawSetupChoosePlayerMenu in m_menu.c...)
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
deh_warning("readPlayer %d: unknown word '%s'", num, word);
|
deh_warning("readPlayer %d: unknown word '%s'", num, word);
|
||||||
|
|
|
@ -177,6 +177,7 @@ typedef struct
|
||||||
char notes[441];
|
char notes[441];
|
||||||
char picname[8];
|
char picname[8];
|
||||||
char skinname[SKINNAMESIZE*2+2]; // skin&skin\0
|
char skinname[SKINNAMESIZE*2+2]; // skin&skin\0
|
||||||
|
UINT16 wadnum; // for duplicate characters
|
||||||
} description_t;
|
} description_t;
|
||||||
|
|
||||||
// mode descriptions for video mode menu
|
// mode descriptions for video mode menu
|
||||||
|
|
|
@ -2355,9 +2355,6 @@ INT32 R_SkinAvailable(const char *name)
|
||||||
{
|
{
|
||||||
INT32 i;
|
INT32 i;
|
||||||
|
|
||||||
if (stricmp("NONE",name) == 0)
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
for (i = 0; i < numskins; i++)
|
for (i = 0; i < numskins; i++)
|
||||||
{
|
{
|
||||||
// search in the skin list
|
// search in the skin list
|
||||||
|
@ -2531,10 +2528,11 @@ void R_AddSkins(UINT16 wadnum)
|
||||||
|
|
||||||
if (!stricmp(stoken, "name"))
|
if (!stricmp(stoken, "name"))
|
||||||
{
|
{
|
||||||
|
INT32 skinnum = R_SkinAvailable(value);
|
||||||
// the skin name must uniquely identify a single skin
|
// the skin name must uniquely identify a single skin
|
||||||
// I'm lazy so if name is already used I leave the 'skin x'
|
// I'm lazy so if name is already used I leave the 'skin x'
|
||||||
// default skin name set in Sk_SetDefaultValue
|
// default skin name set in Sk_SetDefaultValue
|
||||||
if (R_SkinAvailable(value) == -1)
|
if (skinnum == -1)
|
||||||
{
|
{
|
||||||
STRBUFCPY(skin->name, value);
|
STRBUFCPY(skin->name, value);
|
||||||
strlwr(skin->name);
|
strlwr(skin->name);
|
||||||
|
@ -2639,7 +2637,15 @@ void R_AddSkins(UINT16 wadnum)
|
||||||
else if (!stricmp(stoken, "availability"))
|
else if (!stricmp(stoken, "availability"))
|
||||||
#ifdef DEVELOP
|
#ifdef DEVELOP
|
||||||
{
|
{
|
||||||
PlayerMenu[R_SkinAvailable(skin->name)].status = (IT_DISABLED|IT_CENTER);
|
char *name;
|
||||||
|
INT32 i;
|
||||||
|
for (i = 0; i < 32; i++)
|
||||||
|
{
|
||||||
|
name = strtok(Z_StrDup(description[i].skinname), "&");
|
||||||
|
if (name == skin->name && PlayerMenu[i].status != IT_DISABLED)
|
||||||
|
PlayerMenu[i].status = (IT_DISABLED|IT_CENTER);
|
||||||
|
Z_Free(name);
|
||||||
|
}
|
||||||
skin->availability = atoi(value);
|
skin->availability = atoi(value);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
|
|
Loading…
Reference in a new issue