Merge branch 'newmenus' into 'master'

Better looking menus, nametags and much more. (Resolves #245 and #244 and #252)

Closes #245, #244, and #252

See merge request STJr/SRB2Internal!389
This commit is contained in:
MascaraSnake 2019-10-25 17:46:16 -04:00
commit 03c5b70fc5
20 changed files with 1054 additions and 214 deletions

View File

@ -359,7 +359,7 @@ static void D_Display(void)
// clean up border stuff // clean up border stuff
// see if the border needs to be initially drawn // see if the border needs to be initially drawn
if (gamestate == GS_LEVEL || (gamestate == GS_TITLESCREEN && titlemapinaction && curbghide)) if (gamestate == GS_LEVEL || (gamestate == GS_TITLESCREEN && titlemapinaction && curbghide && (!hidetitlemap)))
{ {
// draw the view directly // draw the view directly

View File

@ -313,7 +313,13 @@ static boolean findFreeSlot(INT32 *num)
if (*num >= MAXSKINS) if (*num >= MAXSKINS)
return false; return false;
description[*num].picname[0] = '\0'; // Redesign your logo. (See M_DrawSetupChoosePlayerMenu in m_menu.c...) // Redesign your logo. (See M_DrawSetupChoosePlayerMenu in m_menu.c...)
description[*num].picname[0] = '\0';
description[*num].nametag[0] = '\0';
description[*num].displayname[0] = '\0';
description[*num].oppositecolor = SKINCOLOR_NONE;
description[*num].tagtextcolor = SKINCOLOR_NONE;
description[*num].tagoutlinecolor = SKINCOLOR_NONE;
// Found one! ^_^ // Found one! ^_^
return (description[*num].used = true); return (description[*num].used = true);
@ -326,9 +332,16 @@ static void readPlayer(MYFILE *f, INT32 num)
char *s = Z_Malloc(MAXLINELEN, PU_STATIC, NULL); char *s = Z_Malloc(MAXLINELEN, PU_STATIC, NULL);
char *word; char *word;
char *word2; char *word2;
char *displayname = ZZ_Alloc(MAXLINELEN+1);
INT32 i; INT32 i;
boolean slotfound = false; boolean slotfound = false;
#define SLOTFOUND \
if (!slotfound && (slotfound = findFreeSlot(&num)) == false) \
goto done;
displayname[MAXLINELEN] = '\0';
do do
{ {
if (myfgets(s, MAXLINELEN, f)) if (myfgets(s, MAXLINELEN, f))
@ -336,6 +349,17 @@ static void readPlayer(MYFILE *f, INT32 num)
if (s[0] == '\n') if (s[0] == '\n')
break; break;
for (i = 0; i < MAXLINELEN-3; i++)
{
char *tmp;
if (s[i] == '=')
{
tmp = &s[i+2];
strncpy(displayname, tmp, SKINNAMESIZE);
break;
}
}
word = strtok(s, " "); word = strtok(s, " ");
if (word) if (word)
strupr(word); strupr(word);
@ -346,8 +370,7 @@ static void readPlayer(MYFILE *f, INT32 num)
{ {
char *playertext = NULL; char *playertext = NULL;
if (!slotfound && (slotfound = findFreeSlot(&num)) == false) SLOTFOUND
goto done;
for (i = 0; i < MAXLINELEN-3; i++) for (i = 0; i < MAXLINELEN-3; i++)
{ {
@ -395,11 +418,54 @@ static void readPlayer(MYFILE *f, INT32 num)
if (fastcmp(word, "PICNAME")) if (fastcmp(word, "PICNAME"))
{ {
if (!slotfound && (slotfound = findFreeSlot(&num)) == false) SLOTFOUND
goto done;
strncpy(description[num].picname, word2, 8); strncpy(description[num].picname, word2, 8);
} }
// new character select
else if (fastcmp(word, "DISPLAYNAME"))
{
SLOTFOUND
// replace '#' with line breaks
// (also remove any '\n')
{
char *cur = NULL;
// remove '\n'
cur = strchr(displayname, '\n');
if (cur)
*cur = '\0';
// turn '#' into '\n'
cur = strchr(displayname, '#');
while (cur)
{
*cur = '\n';
cur = strchr(cur, '#');
}
}
// copy final string
strncpy(description[num].displayname, displayname, SKINNAMESIZE);
}
else if (fastcmp(word, "OPPOSITECOLOR") || fastcmp(word, "OPPOSITECOLOUR"))
{
SLOTFOUND
description[num].oppositecolor = (UINT8)get_number(word2);
}
else if (fastcmp(word, "NAMETAG") || fastcmp(word, "TAGNAME"))
{
SLOTFOUND
strncpy(description[num].nametag, word2, 8);
}
else if (fastcmp(word, "TAGTEXTCOLOR") || fastcmp(word, "TAGTEXTCOLOUR"))
{
SLOTFOUND
description[num].tagtextcolor = (UINT8)get_number(word2);
}
else if (fastcmp(word, "TAGOUTLINECOLOR") || fastcmp(word, "TAGOUTLINECOLOUR"))
{
SLOTFOUND
description[num].tagoutlinecolor = (UINT8)get_number(word2);
}
else if (fastcmp(word, "STATUS")) else if (fastcmp(word, "STATUS"))
{ {
/* /*
@ -417,9 +483,7 @@ 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) SLOTFOUND
goto done;
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);
} }
@ -427,8 +491,9 @@ static void readPlayer(MYFILE *f, INT32 num)
deh_warning("readPlayer %d: unknown word '%s'", num, word); deh_warning("readPlayer %d: unknown word '%s'", num, word);
} }
} while (!myfeof(f)); // finish when the line is empty } while (!myfeof(f)); // finish when the line is empty
#undef SLOTFOUND
done: done:
Z_Free(displayname);
Z_Free(s); Z_Free(s);
} }
@ -9092,6 +9157,7 @@ struct {
{"V_OFFSET",V_OFFSET}, {"V_OFFSET",V_OFFSET},
{"V_ALLOWLOWERCASE",V_ALLOWLOWERCASE}, {"V_ALLOWLOWERCASE",V_ALLOWLOWERCASE},
{"V_FLIP",V_FLIP}, {"V_FLIP",V_FLIP},
{"V_CENTERNAMETAG",V_CENTERNAMETAG},
{"V_SNAPTOTOP",V_SNAPTOTOP}, {"V_SNAPTOTOP",V_SNAPTOTOP},
{"V_SNAPTOBOTTOM",V_SNAPTOBOTTOM}, {"V_SNAPTOBOTTOM",V_SNAPTOBOTTOM},
{"V_SNAPTOLEFT",V_SNAPTOLEFT}, {"V_SNAPTOLEFT",V_SNAPTOLEFT},

View File

@ -327,7 +327,7 @@ typedef struct
// Music stuff. // Music stuff.
UINT32 musinterfadeout; ///< Fade out level music on intermission screen in milliseconds UINT32 musinterfadeout; ///< Fade out level music on intermission screen in milliseconds
char musintername[7]; ///< Intermission screen music. char musintername[7]; ///< Intermission screen music.
char muspostbossname[7]; ///< Post-bossdeath music. char muspostbossname[7]; ///< Post-bossdeath music.
UINT16 muspostbosstrack; ///< Post-bossdeath track. UINT16 muspostbosstrack; ///< Post-bossdeath track.
UINT32 muspostbosspos; ///< Post-bossdeath position UINT32 muspostbosspos; ///< Post-bossdeath position
@ -433,6 +433,7 @@ typedef struct
tic_t time; ///< Time in which the level was finished. tic_t time; ///< Time in which the level was finished.
UINT32 score; ///< Score when the level was finished. UINT32 score; ///< Score when the level was finished.
UINT16 rings; ///< Rings when the level was finished. UINT16 rings; ///< Rings when the level was finished.
boolean gotperfect; ///< Got perfect bonus?
} recorddata_t; } recorddata_t;
/** Setup for one NiGHTS map. /** Setup for one NiGHTS map.

View File

@ -75,6 +75,7 @@ INT32 curbgcolor;
INT32 curbgxspeed; INT32 curbgxspeed;
INT32 curbgyspeed; INT32 curbgyspeed;
boolean curbghide; boolean curbghide;
boolean hidetitlemap; // WARNING: set to false by M_SetupNextMenu and M_ClearMenus
static UINT8 curDemo = 0; static UINT8 curDemo = 0;
static UINT32 demoDelayLeft; static UINT32 demoDelayLeft;
@ -1585,15 +1586,15 @@ void F_StartEnding(void)
UINT8 skinnum = players[consoleplayer].skin; UINT8 skinnum = players[consoleplayer].skin;
spritedef_t *sprdef; spritedef_t *sprdef;
spriteframe_t *sprframe; spriteframe_t *sprframe;
if (skins[skinnum].sprites[SPR2_XTRA].numframes >= 7) if (skins[skinnum].sprites[SPR2_XTRA].numframes >= (XTRA_ENDING+2)+1)
{ {
sprdef = &skins[skinnum].sprites[SPR2_XTRA]; sprdef = &skins[skinnum].sprites[SPR2_XTRA];
// character head, skin specific // character head, skin specific
sprframe = &sprdef->spriteframes[4]; sprframe = &sprdef->spriteframes[XTRA_ENDING];
endfwrk[0] = W_CachePatchNum(sprframe->lumppat[0], PU_LEVEL); endfwrk[0] = W_CachePatchNum(sprframe->lumppat[0], PU_LEVEL);
sprframe = &sprdef->spriteframes[5]; sprframe = &sprdef->spriteframes[XTRA_ENDING+1];
endfwrk[1] = W_CachePatchNum(sprframe->lumppat[0], PU_LEVEL); endfwrk[1] = W_CachePatchNum(sprframe->lumppat[0], PU_LEVEL);
sprframe = &sprdef->spriteframes[6]; sprframe = &sprdef->spriteframes[XTRA_ENDING+2];
endfwrk[2] = W_CachePatchNum(sprframe->lumppat[0], PU_LEVEL); endfwrk[2] = W_CachePatchNum(sprframe->lumppat[0], PU_LEVEL);
} }
else // Show a star if your character doesn't have an ending firework display. (Basically the MISSINGs for this) else // Show a star if your character doesn't have an ending firework display. (Basically the MISSINGs for this)
@ -2098,12 +2099,12 @@ void F_InitMenuPresValues(void)
curfadevalue = 16; curfadevalue = 16;
curhidepics = hidetitlepics; curhidepics = hidetitlepics;
curbgcolor = -1; curbgcolor = -1;
curbgxspeed = titlescrollxspeed; curbgxspeed = (gamestate == GS_TIMEATTACK) ? 0 : titlescrollxspeed;
curbgyspeed = titlescrollyspeed; curbgyspeed = (gamestate == GS_TIMEATTACK) ? 22 : titlescrollyspeed;
curbghide = true; curbghide = (gamestate == GS_TIMEATTACK) ? false : true;
// Find current presentation values // Find current presentation values
M_SetMenuCurBackground((gamestate == GS_TIMEATTACK) ? "SRB2BACK" : "TITLESKY"); M_SetMenuCurBackground((gamestate == GS_TIMEATTACK) ? "RECATTBG" : "TITLESKY");
M_SetMenuCurFadeValue(16); M_SetMenuCurFadeValue(16);
M_SetMenuCurHideTitlePics(); M_SetMenuCurHideTitlePics();
} }

View File

@ -94,6 +94,7 @@ extern INT32 curbgcolor;
extern INT32 curbgxspeed; extern INT32 curbgxspeed;
extern INT32 curbgyspeed; extern INT32 curbgyspeed;
extern boolean curbghide; extern boolean curbghide;
extern boolean hidetitlemap;
#define TITLEBACKGROUNDACTIVE (curfadevalue >= 0 || curbgname[0]) #define TITLEBACKGROUNDACTIVE (curfadevalue >= 0 || curbgname[0])

View File

@ -3343,6 +3343,7 @@ void G_LoadGameData(void)
UINT32 recscore; UINT32 recscore;
tic_t rectime; tic_t rectime;
UINT16 recrings; UINT16 recrings;
boolean gotperf;
UINT8 recmares; UINT8 recmares;
INT32 curmare; INT32 curmare;
@ -3435,6 +3436,7 @@ void G_LoadGameData(void)
recscore = READUINT32(save_p); recscore = READUINT32(save_p);
rectime = (tic_t)READUINT32(save_p); rectime = (tic_t)READUINT32(save_p);
recrings = READUINT16(save_p); recrings = READUINT16(save_p);
gotperf = (boolean)READUINT8(save_p);
if (recrings > 10000 || recscore > MAXSCORE) if (recrings > 10000 || recscore > MAXSCORE)
goto datacorrupt; goto datacorrupt;
@ -3446,6 +3448,9 @@ void G_LoadGameData(void)
mainrecords[i]->time = rectime; mainrecords[i]->time = rectime;
mainrecords[i]->rings = recrings; mainrecords[i]->rings = recrings;
} }
if (gotperf)
mainrecords[i]->gotperfect = gotperf;
} }
// Nights records // Nights records
@ -3577,12 +3582,14 @@ void G_SaveGameData(void)
WRITEUINT32(save_p, mainrecords[i]->score); WRITEUINT32(save_p, mainrecords[i]->score);
WRITEUINT32(save_p, mainrecords[i]->time); WRITEUINT32(save_p, mainrecords[i]->time);
WRITEUINT16(save_p, mainrecords[i]->rings); WRITEUINT16(save_p, mainrecords[i]->rings);
WRITEUINT8(save_p, mainrecords[i]->gotperfect);
} }
else else
{ {
WRITEUINT32(save_p, 0); WRITEUINT32(save_p, 0);
WRITEUINT32(save_p, 0); WRITEUINT32(save_p, 0);
WRITEUINT16(save_p, 0); WRITEUINT16(save_p, 0);
WRITEUINT8(save_p, 0);
} }
} }

View File

@ -71,6 +71,10 @@ patch_t *lt_font[LT_FONTSIZE];
patch_t *cred_font[CRED_FONTSIZE]; patch_t *cred_font[CRED_FONTSIZE];
patch_t *ttlnum[20]; // act numbers (0-19) patch_t *ttlnum[20]; // act numbers (0-19)
// Name tag fonts
patch_t *ntb_font[NT_FONTSIZE];
patch_t *nto_font[NT_FONTSIZE];
static player_t *plr; static player_t *plr;
boolean chat_on; // entering a chat message? boolean chat_on; // entering a chat message?
static char w_chat[HU_MAXMSGLEN]; static char w_chat[HU_MAXMSGLEN];
@ -246,6 +250,32 @@ void HU_LoadGraphics(void)
ttlnum[i] = (patch_t *)W_CachePatchName(buffer, PU_HUDGFX); ttlnum[i] = (patch_t *)W_CachePatchName(buffer, PU_HUDGFX);
} }
// cache the base name tag font for entire game execution
j = NT_FONTSTART;
for (i = 0; i < NT_FONTSIZE; i++)
{
sprintf(buffer, "NTFNT%.3d", j);
j++;
if (W_CheckNumForName(buffer) == LUMPERROR)
ntb_font[i] = NULL;
else
ntb_font[i] = (patch_t *)W_CachePatchName(buffer, PU_HUDGFX);
}
// cache the outline name tag font for entire game execution
j = NT_FONTSTART;
for (i = 0; i < NT_FONTSIZE; i++)
{
sprintf(buffer, "NTFNO%.3d", j);
j++;
if (W_CheckNumForName(buffer) == LUMPERROR)
nto_font[i] = NULL;
else
nto_font[i] = (patch_t *)W_CachePatchName(buffer, PU_HUDGFX);
}
// cache the crosshairs, don't bother to know which one is being used, // cache the crosshairs, don't bother to know which one is being used,
// just cache all 3, they're so small anyway. // just cache all 3, they're so small anyway.
for (i = 0; i < HU_CROSSHAIRS; i++) for (i = 0; i < HU_CROSSHAIRS; i++)

View File

@ -35,6 +35,12 @@
#define CRED_FONTEND 'Z' // the last font character #define CRED_FONTEND 'Z' // the last font character
#define CRED_FONTSIZE (CRED_FONTEND - CRED_FONTSTART + 1) #define CRED_FONTSIZE (CRED_FONTEND - CRED_FONTSTART + 1)
// Name tag font
// Used by base and outline font set
#define NT_FONTSTART '!' // the first font character
#define NT_FONTEND 'Z' // the last font character
#define NT_FONTSIZE (NT_FONTEND - NT_FONTSTART + 1)
#define HU_CROSSHAIRS 3 // maximum of 9 - see HU_Init(); #define HU_CROSSHAIRS 3 // maximum of 9 - see HU_Init();
extern char *shiftxform; // english translation shift table extern char *shiftxform; // english translation shift table
@ -77,6 +83,8 @@ extern patch_t *tallnum[10];
extern patch_t *nightsnum[10]; extern patch_t *nightsnum[10];
extern patch_t *lt_font[LT_FONTSIZE]; extern patch_t *lt_font[LT_FONTSIZE];
extern patch_t *cred_font[CRED_FONTSIZE]; extern patch_t *cred_font[CRED_FONTSIZE];
extern patch_t *ntb_font[NT_FONTSIZE];
extern patch_t *nto_font[NT_FONTSIZE];
extern patch_t *ttlnum[20]; extern patch_t *ttlnum[20];
extern patch_t *emeraldpics[3][8]; extern patch_t *emeraldpics[3][8];
extern patch_t *rflagico; extern patch_t *rflagico;

View File

@ -879,6 +879,12 @@ typedef enum playersprite
NUMPLAYERSPRITES NUMPLAYERSPRITES
} playersprite_t; } playersprite_t;
// SPR2_XTRA
#define XTRA_LIFEPIC 0 // Life icon patch
#define XTRA_CHARSEL 1 // Character select picture
#define XTRA_CONTINUE 2 // Continue icon
#define XTRA_ENDING 3 // Ending finale patches
typedef enum state typedef enum state
{ {
S_NULL, S_NULL,

View File

@ -637,6 +637,68 @@ static int libd_drawString(lua_State *L)
return 0; return 0;
} }
static int libd_drawNameTag(lua_State *L)
{
INT32 x;
INT32 y;
const char *str;
INT32 flags;
UINT8 basecolor;
UINT8 outlinecolor;
UINT8 *basecolormap = NULL;
UINT8 *outlinecolormap = NULL;
HUDONLY
x = luaL_checkinteger(L, 1);
y = luaL_checkinteger(L, 2);
str = luaL_checkstring(L, 3);
flags = luaL_optinteger(L, 4, 0);
basecolor = luaL_optinteger(L, 5, SKINCOLOR_BLUE);
outlinecolor = luaL_optinteger(L, 6, SKINCOLOR_ORANGE);
if (basecolor != SKINCOLOR_NONE)
basecolormap = R_GetTranslationColormap(TC_DEFAULT, basecolor, GTC_CACHE);
if (outlinecolor != SKINCOLOR_NONE)
outlinecolormap = R_GetTranslationColormap(TC_DEFAULT, outlinecolor, GTC_CACHE);
flags &= ~V_PARAMMASK; // Don't let crashes happen.
V_DrawNameTag(x, y, flags, FRACUNIT, basecolormap, outlinecolormap, str);
return 0;
}
static int libd_drawScaledNameTag(lua_State *L)
{
fixed_t x;
fixed_t y;
const char *str;
INT32 flags;
fixed_t scale;
UINT8 basecolor;
UINT8 outlinecolor;
UINT8 *basecolormap = NULL;
UINT8 *outlinecolormap = NULL;
HUDONLY
x = luaL_checkfixed(L, 1);
y = luaL_checkfixed(L, 2);
str = luaL_checkstring(L, 3);
flags = luaL_optinteger(L, 4, 0);
scale = luaL_optinteger(L, 5, FRACUNIT);
if (scale < 0)
return luaL_error(L, "negative scale");
basecolor = luaL_optinteger(L, 6, SKINCOLOR_BLUE);
outlinecolor = luaL_optinteger(L, 7, SKINCOLOR_ORANGE);
if (basecolor != SKINCOLOR_NONE)
basecolormap = R_GetTranslationColormap(TC_DEFAULT, basecolor, GTC_CACHE);
if (outlinecolor != SKINCOLOR_NONE)
outlinecolormap = R_GetTranslationColormap(TC_DEFAULT, outlinecolor, GTC_CACHE);
flags &= ~V_PARAMMASK; // Don't let crashes happen.
V_DrawNameTag(FixedInt(x), FixedInt(y), flags, scale, basecolormap, outlinecolormap, str);
return 0;
}
static int libd_stringWidth(lua_State *L) static int libd_stringWidth(lua_State *L)
{ {
const char *str = luaL_checkstring(L, 1); const char *str = luaL_checkstring(L, 1);
@ -659,6 +721,13 @@ static int libd_stringWidth(lua_State *L)
return 1; return 1;
} }
static int libd_nameTagWidth(lua_State *L)
{
HUDONLY
lua_pushinteger(L, V_NameTagWidth(luaL_checkstring(L, 1)));
return 1;
}
static int libd_getColormap(lua_State *L) static int libd_getColormap(lua_State *L)
{ {
INT32 skinnum = TC_DEFAULT; INT32 skinnum = TC_DEFAULT;
@ -837,9 +906,12 @@ static luaL_Reg lib_draw[] = {
{"drawPaddedNum", libd_drawPaddedNum}, {"drawPaddedNum", libd_drawPaddedNum},
{"drawFill", libd_drawFill}, {"drawFill", libd_drawFill},
{"drawString", libd_drawString}, {"drawString", libd_drawString},
{"drawNameTag", libd_drawNameTag},
{"drawScaledNameTag", libd_drawScaledNameTag},
{"fadeScreen", libd_fadeScreen}, {"fadeScreen", libd_fadeScreen},
// misc // misc
{"stringWidth", libd_stringWidth}, {"stringWidth", libd_stringWidth},
{"nameTagWidth", libd_nameTagWidth},
// m_random // m_random
{"RandomFixed",libd_RandomFixed}, {"RandomFixed",libd_RandomFixed},
{"RandomByte",libd_RandomByte}, {"RandomByte",libd_RandomByte},

View File

@ -528,12 +528,22 @@ skincolors_t M_GetEmblemColor(emblem_t *em)
return em->color; return em->color;
} }
const char *M_GetEmblemPatch(emblem_t *em) const char *M_GetEmblemPatch(emblem_t *em, boolean big)
{ {
static char pnamebuf[7] = "GOTITn"; static char pnamebuf[7];
if (!big)
strcpy(pnamebuf, "GOTITn");
else
strcpy(pnamebuf, "EMBMn0");
I_Assert(em->sprite >= 'A' && em->sprite <= 'Z'); I_Assert(em->sprite >= 'A' && em->sprite <= 'Z');
pnamebuf[5] = em->sprite;
if (!big)
pnamebuf[5] = em->sprite;
else
pnamebuf[4] = em->sprite;
return pnamebuf; return pnamebuf;
} }
@ -544,11 +554,21 @@ skincolors_t M_GetExtraEmblemColor(extraemblem_t *em)
return em->color; return em->color;
} }
const char *M_GetExtraEmblemPatch(extraemblem_t *em) const char *M_GetExtraEmblemPatch(extraemblem_t *em, boolean big)
{ {
static char pnamebuf[7] = "GOTITn"; static char pnamebuf[7];
if (!big)
strcpy(pnamebuf, "GOTITn");
else
strcpy(pnamebuf, "EMBMn0");
I_Assert(em->sprite >= 'A' && em->sprite <= 'Z'); I_Assert(em->sprite >= 'A' && em->sprite <= 'Z');
pnamebuf[5] = em->sprite;
if (!big)
pnamebuf[5] = em->sprite;
else
pnamebuf[4] = em->sprite;
return pnamebuf; return pnamebuf;
} }

View File

@ -171,9 +171,9 @@ INT32 M_CountEmblems(void);
// Emblem shit // Emblem shit
emblem_t *M_GetLevelEmblems(INT32 mapnum); emblem_t *M_GetLevelEmblems(INT32 mapnum);
skincolors_t M_GetEmblemColor(emblem_t *em); skincolors_t M_GetEmblemColor(emblem_t *em);
const char *M_GetEmblemPatch(emblem_t *em); const char *M_GetEmblemPatch(emblem_t *em, boolean big);
skincolors_t M_GetExtraEmblemColor(extraemblem_t *em); skincolors_t M_GetExtraEmblemColor(extraemblem_t *em);
const char *M_GetExtraEmblemPatch(extraemblem_t *em); const char *M_GetExtraEmblemPatch(extraemblem_t *em, boolean big);
// If you're looking to compare stats for unlocks or what not, use these // If you're looking to compare stats for unlocks or what not, use these
// They stop checking upon reaching the target number so they // They stop checking upon reaching the target number so they

File diff suppressed because it is too large Load Diff

View File

@ -63,6 +63,7 @@ typedef enum
MN_MP_CONNECT, MN_MP_CONNECT,
MN_MP_ROOM, MN_MP_ROOM,
MN_MP_PLAYERSETUP, // MP_PlayerSetupDef shared with SPLITSCREEN if #defined NONET MN_MP_PLAYERSETUP, // MP_PlayerSetupDef shared with SPLITSCREEN if #defined NONET
MN_MP_SERVER_OPTIONS,
// Options // Options
MN_OP_MAIN, MN_OP_MAIN,
@ -103,6 +104,7 @@ typedef enum
MN_SR_LEVELSELECT, MN_SR_LEVELSELECT,
MN_SR_UNLOCKCHECKLIST, MN_SR_UNLOCKCHECKLIST,
MN_SR_EMBLEMHINT, MN_SR_EMBLEMHINT,
MN_SR_PLAYER,
// Addons (Part of MISC, but let's make it our own) // Addons (Part of MISC, but let's make it our own)
MN_AD_MAIN, MN_AD_MAIN,
@ -323,9 +325,18 @@ 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
patch_t *pic; patch_t *charpic;
UINT8 prev; UINT8 prev;
UINT8 next; UINT8 next;
// new character select
char displayname[SKINNAMESIZE+1];
SINT8 skinnum[2];
UINT8 oppositecolor;
char nametag[8];
patch_t *namepic;
UINT8 tagtextcolor;
UINT8 tagoutlinecolor;
} description_t; } description_t;
// level select platter // level select platter

View File

@ -7758,7 +7758,7 @@ void P_MobjThinker(mobj_t *mobj)
actualwork = work = FixedHypot(mobj->x-players[i].mo->x, mobj->y-players[i].mo->y); actualwork = work = FixedHypot(mobj->x-players[i].mo->x, mobj->y-players[i].mo->y);
if (player) if (player)
{ {
if (players[i].skin == 0 || players[i].skin == 3) if (players[i].skin == 0 || players[i].skin == 5)
work = (2*work)/3; work = (2*work)/3;
if (work >= pdist) if (work >= pdist)
continue; continue;
@ -7796,7 +7796,7 @@ void P_MobjThinker(mobj_t *mobj)
if (mobj->target != player->mo) if (mobj->target != player->mo)
P_SetTarget(&mobj->target, player->mo); P_SetTarget(&mobj->target, player->mo);
targonground = (P_IsObjectOnGround(mobj->target) && (player->panim == PA_IDLE || player->panim == PA_WALK || player->panim == PA_RUN)); targonground = (P_IsObjectOnGround(mobj->target) && (player->panim == PA_IDLE || player->panim == PA_WALK || player->panim == PA_RUN));
love = (player->skin == 0 || player->skin == 3); love = (player->skin == 0 || player->skin == 5);
switch (stat) switch (stat)
{ {
@ -10401,13 +10401,13 @@ mobj_t *P_SpawnMobj(fixed_t x, fixed_t y, fixed_t z, mobjtype_t type)
break; break;
case MT_METALSONIC_BATTLE: case MT_METALSONIC_BATTLE:
case MT_METALSONIC_RACE: case MT_METALSONIC_RACE:
sc = 3; sc = 5;
break; break;
case MT_FANG: case MT_FANG:
sc = 4; sc = 4;
break; break;
case MT_ROSY: case MT_ROSY:
sc = 5; sc = 3;
break; break;
case MT_CORK: case MT_CORK:
mobj->flags2 |= MF2_SUPERFIRE; mobj->flags2 |= MF2_SUPERFIRE;
@ -11597,7 +11597,7 @@ You should think about modifying the deathmatch starts to take full advantage of
return; // she doesn't hang out here return; // she doesn't hang out here
else if (mariomode) else if (mariomode)
i = MT_TOAD; // don't remove on penalty of death i = MT_TOAD; // don't remove on penalty of death
else if (!(netgame || multiplayer) && players[consoleplayer].skin == 5) else if (!(netgame || multiplayer) && players[consoleplayer].skin == 3)
return; // no doubles return; // no doubles
} }

View File

@ -2606,7 +2606,6 @@ boolean P_SetupLevel(boolean skipprecip)
boolean loadedbm = false; boolean loadedbm = false;
sector_t *ss; sector_t *ss;
boolean chase; boolean chase;
levelloading = true; levelloading = true;
// This is needed. Don't touch. // This is needed. Don't touch.

View File

@ -351,7 +351,7 @@ void ST_LoadFaceGraphics(INT32 skinnum)
if (skins[skinnum].sprites[SPR2_XTRA].numframes) if (skins[skinnum].sprites[SPR2_XTRA].numframes)
{ {
spritedef_t *sprdef = &skins[skinnum].sprites[SPR2_XTRA]; spritedef_t *sprdef = &skins[skinnum].sprites[SPR2_XTRA];
spriteframe_t *sprframe = &sprdef->spriteframes[0]; spriteframe_t *sprframe = &sprdef->spriteframes[XTRA_LIFEPIC];
faceprefix[skinnum] = W_CachePatchNum(sprframe->lumppat[0], PU_HUDGFX); faceprefix[skinnum] = W_CachePatchNum(sprframe->lumppat[0], PU_HUDGFX);
if (skins[skinnum].sprites[(SPR2_XTRA|FF_SPR2SUPER)].numframes) if (skins[skinnum].sprites[(SPR2_XTRA|FF_SPR2SUPER)].numframes)
{ {

View File

@ -1074,7 +1074,7 @@ void V_DrawContinueIcon(INT32 x, INT32 y, INT32 flags, INT32 skinnum, UINT8 skin
if (skinnum >= 0 && skinnum < numskins && skins[skinnum].sprites[SPR2_XTRA].numframes >= 4) if (skinnum >= 0 && skinnum < numskins && skins[skinnum].sprites[SPR2_XTRA].numframes >= 4)
{ {
spritedef_t *sprdef = &skins[skinnum].sprites[SPR2_XTRA]; spritedef_t *sprdef = &skins[skinnum].sprites[SPR2_XTRA];
spriteframe_t *sprframe = &sprdef->spriteframes[3]; spriteframe_t *sprframe = &sprdef->spriteframes[XTRA_CONTINUE];
patch_t *patch = W_CachePatchNum(sprframe->lumppat[0], PU_LEVEL); patch_t *patch = W_CachePatchNum(sprframe->lumppat[0], PU_LEVEL);
const UINT8 *colormap = R_GetTranslationColormap(skinnum, skincolor, GTC_CACHE); const UINT8 *colormap = R_GetTranslationColormap(skinnum, skincolor, GTC_CACHE);
@ -2192,7 +2192,7 @@ void V_DrawString(INT32 x, INT32 y, INT32 option, const char *string)
w = SHORT(hu_font[c]->width) * dupx; w = SHORT(hu_font[c]->width) * dupx;
if (cx > scrwidth) if (cx > scrwidth)
break; continue;
if (cx+left + w < 0) //left boundary check if (cx+left + w < 0) //left boundary check
{ {
cx += w; cx += w;
@ -2306,7 +2306,7 @@ void V_DrawSmallString(INT32 x, INT32 y, INT32 option, const char *string)
w = SHORT(hu_font[c]->width) * dupx / 2; w = SHORT(hu_font[c]->width) * dupx / 2;
if (cx > scrwidth) if (cx > scrwidth)
break; continue;
if (cx+left + w < 0) //left boundary check if (cx+left + w < 0) //left boundary check
{ {
cx += w; cx += w;
@ -2411,7 +2411,7 @@ void V_DrawThinString(INT32 x, INT32 y, INT32 option, const char *string)
w = (SHORT(tny_font[c]->width) * dupx); w = (SHORT(tny_font[c]->width) * dupx);
if (cx > scrwidth) if (cx > scrwidth)
break; continue;
if (cx+left + w < 0) //left boundary check if (cx+left + w < 0) //left boundary check
{ {
cx += w; cx += w;
@ -2509,7 +2509,7 @@ void V_DrawStringAtFixed(fixed_t x, fixed_t y, INT32 option, const char *string)
w = SHORT(hu_font[c]->width) * dupx; w = SHORT(hu_font[c]->width) * dupx;
if ((cx>>FRACBITS) > scrwidth) if ((cx>>FRACBITS) > scrwidth)
break; continue;
if ((cx>>FRACBITS)+left + w < 0) //left boundary check if ((cx>>FRACBITS)+left + w < 0) //left boundary check
{ {
cx += w<<FRACBITS; cx += w<<FRACBITS;
@ -2621,13 +2621,210 @@ void V_DrawCreditString(fixed_t x, fixed_t y, INT32 option, const char *string)
w = SHORT(cred_font[c]->width) * dupx; w = SHORT(cred_font[c]->width) * dupx;
if ((cx>>FRACBITS) > scrwidth) if ((cx>>FRACBITS) > scrwidth)
break; continue;
V_DrawSciencePatch(cx, cy, option, cred_font[c], FRACUNIT); V_DrawSciencePatch(cx, cy, option, cred_font[c], FRACUNIT);
cx += w<<FRACBITS; cx += w<<FRACBITS;
} }
} }
// Draw a string using the nt_font
// Note that the outline is a seperate font set
static void V_DrawNameTagLine(INT32 x, INT32 y, INT32 option, fixed_t scale, UINT8 *basecolormap, UINT8 *outlinecolormap, const char *string)
{
fixed_t cx, cy, w;
INT32 c, dupx, dupy, scrwidth, left = 0;
const char *ch = string;
if (option & V_CENTERNAMETAG)
x -= FixedInt(FixedMul((V_NameTagWidth(string)/2)*FRACUNIT, scale));
option &= ~V_CENTERNAMETAG; // which is also shared with V_ALLOWLOWERCASE...
cx = x<<FRACBITS;
cy = y<<FRACBITS;
if (option & V_NOSCALESTART)
{
dupx = vid.dupx;
dupy = vid.dupy;
scrwidth = vid.width;
}
else
{
dupx = dupy = 1;
scrwidth = vid.width/vid.dupx;
left = (scrwidth - BASEVIDWIDTH)/2;
scrwidth -= left;
}
for (;;ch++)
{
if (!*ch)
break;
if (*ch == '\n')
{
cx = x<<FRACBITS;
cy += FixedMul((21*dupy)*FRACUNIT, scale);
continue;
}
c = toupper(*ch);
c -= NT_FONTSTART;
// character does not exist or is a space
if (c < 0 || c >= NT_FONTSIZE || !ntb_font[c] || !nto_font[c])
{
cx += FixedMul((4 * dupx)*FRACUNIT, scale);
continue;
}
w = FixedMul((SHORT(ntb_font[c]->width)+2 * dupx) * FRACUNIT, scale);
if (FixedInt(cx) > scrwidth)
continue;
if (cx+(left*FRACUNIT) + w < 0) // left boundary check
{
cx += w;
continue;
}
V_DrawFixedPatch(cx, cy, scale, option, nto_font[c], outlinecolormap);
V_DrawFixedPatch(cx, cy, scale, option, ntb_font[c], basecolormap);
cx += w;
}
}
// Looks familiar.
void V_DrawNameTag(INT32 x, INT32 y, INT32 option, fixed_t scale, UINT8 *basecolormap, UINT8 *outlinecolormap, const char *string)
{
const char *text = string;
const char *first_token = text;
char *last_token = strchr(text, '\n');
const INT32 lbreakheight = 21;
INT32 ntlines;
if (option & V_CENTERNAMETAG)
{
ntlines = V_CountNameTagLines(string);
y -= FixedInt(FixedMul(((lbreakheight/2) * (ntlines-1))*FRACUNIT, scale));
}
// No line breaks?
// Draw entire string
if (!last_token)
V_DrawNameTagLine(x, y, option, scale, basecolormap, outlinecolormap, string);
// Split string by the line break character
else
{
char *str = NULL;
INT32 len;
while (true)
{
// There are still lines left to draw
if (last_token)
{
size_t shift = 0;
// Free this line
if (str)
Z_Free(str);
// Find string length, do a malloc...
len = (last_token-first_token)+1;
str = ZZ_Alloc(len);
// Copy the line
strncpy(str, first_token, len-1);
str[len-1] = '\0';
// Don't leave a line break character
// at the start of the string!
if ((strlen(str) >= 2) && (string[0] == '\n') && (string[1] != '\n'))
shift++;
// Then draw it
V_DrawNameTagLine(x, y, option, scale, basecolormap, outlinecolormap, str+shift);
}
// No line break character was found
else
{
// Don't leave a line break character
// at the start of the string!
if ((strlen(first_token) >= 2) && (first_token[0] == '\n') && (first_token[1] != '\n'))
first_token++;
// Then draw it
V_DrawNameTagLine(x, y, option, scale, basecolormap, outlinecolormap, first_token);
break;
}
// Next line
y += FixedInt(FixedMul(lbreakheight*FRACUNIT, scale));
if ((last_token-text)+1 >= (signed)strlen(text))
last_token = NULL;
else
{
first_token = last_token;
last_token = strchr(first_token+1, '\n');
}
}
// Free this line
if (str)
Z_Free(str);
}
}
// Count the amount of lines in name tag string
INT32 V_CountNameTagLines(const char *string)
{
INT32 ntlines = 1;
const char *text = string;
const char *first_token = text;
char *last_token = strchr(text, '\n');
// No line breaks?
if (!last_token)
return ntlines;
// Split string by the line break character
else
{
while (true)
{
if (last_token)
ntlines++;
// No line break character was found
else
break;
// Next line
if ((last_token-text)+1 >= (signed)strlen(text))
last_token = NULL;
else
{
first_token = last_token;
last_token = strchr(first_token+1, '\n');
}
}
}
return ntlines;
}
INT32 V_NameTagWidth(const char *string)
{
INT32 c, w = 0;
size_t i;
// It's possible for string to be a null pointer
if (!string)
return 0;
for (i = 0; i < strlen(string); i++)
{
c = toupper(string[i]) - NT_FONTSTART;
if (c < 0 || c >= NT_FONTSIZE || !ntb_font[c] || !nto_font[c])
w += 4;
else
w += SHORT(ntb_font[c]->width)+2;
}
return w;
}
// Find string width from cred_font chars // Find string width from cred_font chars
// //
INT32 V_CreditStringWidth(const char *string) INT32 V_CreditStringWidth(const char *string)
@ -2703,7 +2900,7 @@ void V_DrawLevelTitle(INT32 x, INT32 y, INT32 option, const char *string)
w = SHORT(lt_font[c]->width) * dupx; w = SHORT(lt_font[c]->width) * dupx;
if (cx > scrwidth) if (cx > scrwidth)
break; continue;
if (cx+left + w < 0) //left boundary check if (cx+left + w < 0) //left boundary check
{ {
cx += w; cx += w;

View File

@ -112,6 +112,7 @@ extern RGBA_t *pMasterPalette;
#define V_OFFSET 0x00400000 // account for offsets in patches #define V_OFFSET 0x00400000 // account for offsets in patches
#define V_ALLOWLOWERCASE 0x00800000 // (strings only) allow fonts that have lowercase letters to use them #define V_ALLOWLOWERCASE 0x00800000 // (strings only) allow fonts that have lowercase letters to use them
#define V_FLIP 0x00800000 // (patches only) Horizontal flip #define V_FLIP 0x00800000 // (patches only) Horizontal flip
#define V_CENTERNAMETAG 0x00800000 // (nametag only) center nametag lines
#define V_SNAPTOTOP 0x01000000 // for centering #define V_SNAPTOTOP 0x01000000 // for centering
#define V_SNAPTOBOTTOM 0x02000000 // for centering #define V_SNAPTOBOTTOM 0x02000000 // for centering
@ -205,6 +206,11 @@ INT32 V_LevelActNumWidth(INT32 num); // act number width
void V_DrawCreditString(fixed_t x, fixed_t y, INT32 option, const char *string); void V_DrawCreditString(fixed_t x, fixed_t y, INT32 option, const char *string);
INT32 V_CreditStringWidth(const char *string); INT32 V_CreditStringWidth(const char *string);
// Draw a string using the nt_font
void V_DrawNameTag(INT32 x, INT32 y, INT32 option, fixed_t scale, UINT8 *basecolormap, UINT8 *outlinecolormap, const char *string);
INT32 V_CountNameTagLines(const char *string);
INT32 V_NameTagWidth(const char *string);
// Find string width from hu_font chars // Find string width from hu_font chars
INT32 V_StringWidth(const char *string, INT32 option); INT32 V_StringWidth(const char *string, INT32 option);
// Find string width from hu_font chars, 0.5x scale // Find string width from hu_font chars, 0.5x scale

View File

@ -1052,6 +1052,9 @@ static void Y_UpdateRecordReplays(void)
if ((UINT16)(players[consoleplayer].rings) > mainrecords[gamemap-1]->rings) if ((UINT16)(players[consoleplayer].rings) > mainrecords[gamemap-1]->rings)
mainrecords[gamemap-1]->rings = (UINT16)(players[consoleplayer].rings); mainrecords[gamemap-1]->rings = (UINT16)(players[consoleplayer].rings);
if (data.coop.gotperfbonus)
mainrecords[gamemap-1]->gotperfect = true;
// Save demo! // Save demo!
bestdemo[255] = '\0'; bestdemo[255] = '\0';
lastdemo[255] = '\0'; lastdemo[255] = '\0';