V_PERPLAYER. (Hooh boy.)

* Completely redid how splitscreen works, with eventual support for quads. Squish per-player stuff automatically into the right places! Works in GL, associated flag kills V_SPLITSCREEN.
* Seriously update the lives-drawing function for all gametypes, with strings that replace the lives number whenever it's missing (deprecates SKINNAMEPADDING).
* Improved how the nosshack works, alongside many other refactorings.
This commit is contained in:
toasterbabe 2018-01-20 22:14:24 +00:00
parent 336a26602d
commit 2141754e54
9 changed files with 463 additions and 523 deletions

View File

@ -6799,32 +6799,22 @@ static const char *const POWERS_LIST[] = {
}; };
static const char *const HUDITEMS_LIST[] = { static const char *const HUDITEMS_LIST[] = {
"LIVESNAME", "LIVES",
"LIVESPIC",
"LIVESNUM",
"LIVESX",
"RINGS", "RINGS",
"RINGSSPLIT",
"RINGSNUM", "RINGSNUM",
"RINGSNUMSPLIT",
"SCORE", "SCORE",
"SCORENUM", "SCORENUM",
"TIME", "TIME",
"TIMESPLIT",
"MINUTES", "MINUTES",
"MINUTESSPLIT",
"TIMECOLON", "TIMECOLON",
"TIMECOLONSPLIT",
"SECONDS", "SECONDS",
"SECONDSSPLIT",
"TIMETICCOLON", "TIMETICCOLON",
"TICS", "TICS",
"SS_TOTALRINGS", "SS_TOTALRINGS",
"SS_TOTALRINGS_SPLIT",
"GETRINGS", "GETRINGS",
"GETRINGSNUM", "GETRINGSNUM",
@ -7353,7 +7343,7 @@ struct {
{"V_WRAPX",V_WRAPX}, {"V_WRAPX",V_WRAPX},
{"V_WRAPY",V_WRAPY}, {"V_WRAPY",V_WRAPY},
{"V_NOSCALESTART",V_NOSCALESTART}, {"V_NOSCALESTART",V_NOSCALESTART},
{"V_SPLITSCREEN",V_SPLITSCREEN}, {"V_PERPLAYER",V_PERPLAYER},
{"V_PARAMMASK",V_PARAMMASK}, {"V_PARAMMASK",V_PARAMMASK},
{"V_SCALEPATCHMASK",V_SCALEPATCHMASK}, {"V_SCALEPATCHMASK",V_SCALEPATCHMASK},
@ -7503,7 +7493,7 @@ static hudnum_t get_huditem(const char *word)
if (fastcmp(word, HUDITEMS_LIST[i])) if (fastcmp(word, HUDITEMS_LIST[i]))
return i; return i;
deh_warning("Couldn't find huditem named 'HUD_%s'",word); deh_warning("Couldn't find huditem named 'HUD_%s'",word);
return HUD_LIVESNAME; return HUD_LIVES;
} }
#ifndef HAVE_BLUA #ifndef HAVE_BLUA

View File

@ -560,9 +560,6 @@ extern const char *compdate, *comptime, *comprevision, *compbranch;
/// Experimental attempts at preventing MF_PAPERCOLLISION objects from getting stuck in walls. /// Experimental attempts at preventing MF_PAPERCOLLISION objects from getting stuck in walls.
//#define PAPER_COLLISIONCORRECTION //#define PAPER_COLLISIONCORRECTION
/// Hudname padding.
#define SKINNAMEPADDING
/// FINALLY some real clipping that doesn't make walls dissappear AND speeds the game up /// FINALLY some real clipping that doesn't make walls dissappear AND speeds the game up
/// (that was the original comment from SRB2CB, sadly it is a lie and actually slows game down) /// (that was the original comment from SRB2CB, sadly it is a lie and actually slows game down)
/// on the bright side it fixes some weird issues with translucent walls /// on the bright side it fixes some weird issues with translucent walls

View File

@ -33,6 +33,8 @@
#include "../z_zone.h" #include "../z_zone.h"
#include "../v_video.h" #include "../v_video.h"
#include "../st_stuff.h" #include "../st_stuff.h"
#include "../p_local.h" // stplyr
#include "../g_game.h" // players
#include <fcntl.h> #include <fcntl.h>
#include "../i_video.h" // for rendermode != render_glide #include "../i_video.h" // for rendermode != render_glide
@ -181,8 +183,49 @@ void HWR_DrawFixedPatch(GLPatch_t *gpatch, fixed_t x, fixed_t y, fixed_t pscale,
if (option & V_NOSCALESTART) if (option & V_NOSCALESTART)
sdupx = sdupy = 2.0f; sdupx = sdupy = 2.0f;
if (option & V_SPLITSCREEN) if (splitscreen && (option & V_PERPLAYER))
sdupy /= 2.0f; {
float adjusty = ((option & V_NOSCALESTART) ? vid.height : BASEVIDHEIGHT)/2.0f;
pdupy /= 2;
cy /= 2;
#ifdef QUADS
if (splitscreen > 1) // 3 or 4 players
{
float adjustx = ((option & V_NOSCALESTART) ? vid.width : BASEVIDWIDTH)/2.0f;
pdupx /= 2;
cx /= 2;
if (stplyr == &players[displayplayer])
option &= ~V_SNAPTOBOTTOM|V_SNAPTORIGHT;
else if (stplyr == &players[secondarydisplayplayer])
{
cx += adjustx;
option &= ~V_SNAPTOBOTTOM|V_SNAPTOLEFT;
}
else if (stplyr == &players[thirddisplayplayer])
{
cy += adjusty;
option &= ~V_SNAPTOTOP|V_SNAPTORIGHT;
}
else //if (stplyr == &players[fourthdisplayplayer])
{
cx += adjustx;
cy += adjusty;
option &= ~V_SNAPTOTOP|V_SNAPTOLEFT;
}
}
else
#endif
// 2 players
{
if (stplyr == &players[displayplayer])
option &= ~V_SNAPTOBOTTOM;
else //if (stplyr == &players[secondarydisplayplayer])
{
cy += adjusty;
option &= ~V_SNAPTOTOP;
}
}
}
if (option & V_FLIP) // Need to flip both this and sow if (option & V_FLIP) // Need to flip both this and sow
{ {

View File

@ -2497,11 +2497,7 @@ static void Sk_SetDefaultValue(skin_t *skin)
skin->flags = 0; skin->flags = 0;
strcpy(skin->realname, "Someone"); strcpy(skin->realname, "Someone");
#ifdef SKINNAMEPADDING
strcpy(skin->hudname, " ???");
#else
strcpy(skin->hudname, "???"); strcpy(skin->hudname, "???");
#endif
strncpy(skin->charsel, "CHRSONIC", 8); strncpy(skin->charsel, "CHRSONIC", 8);
strncpy(skin->face, "MISSING", 8); strncpy(skin->face, "MISSING", 8);
strncpy(skin->superface, "MISSING", 8); strncpy(skin->superface, "MISSING", 8);
@ -2733,11 +2729,7 @@ static UINT16 W_CheckForSkinMarkerInPwad(UINT16 wadid, UINT16 startlump)
return INT16_MAX; // not found return INT16_MAX; // not found
} }
#ifdef SKINNAMEPADDING
#define HUDNAMEWRITE(value) snprintf(skin->hudname, sizeof(skin->hudname), "%5s", value)
#else
#define HUDNAMEWRITE(value) STRBUFCPY(skin->hudname, value) #define HUDNAMEWRITE(value) STRBUFCPY(skin->hudname, value)
#endif
// turn _ into spaces and . into katana dot // turn _ into spaces and . into katana dot
#define SYMBOLCONVERT(name) for (value = name; *value; value++)\ #define SYMBOLCONVERT(name) for (value = name; *value; value++)\

File diff suppressed because it is too large Load Diff

View File

@ -77,33 +77,23 @@ typedef struct
typedef enum typedef enum
{ {
HUD_LIVESNAME, HUD_LIVES,
HUD_LIVESPIC,
HUD_LIVESNUM,
HUD_LIVESX,
HUD_RINGS, HUD_RINGS,
HUD_RINGSSPLIT,
HUD_RINGSNUM, HUD_RINGSNUM,
HUD_RINGSNUMSPLIT,
HUD_RINGSNUMTICS, HUD_RINGSNUMTICS,
HUD_SCORE, HUD_SCORE,
HUD_SCORENUM, HUD_SCORENUM,
HUD_TIME, HUD_TIME,
HUD_TIMESPLIT,
HUD_MINUTES, HUD_MINUTES,
HUD_MINUTESSPLIT,
HUD_TIMECOLON, HUD_TIMECOLON,
HUD_TIMECOLONSPLIT,
HUD_SECONDS, HUD_SECONDS,
HUD_SECONDSSPLIT,
HUD_TIMETICCOLON, HUD_TIMETICCOLON,
HUD_TICS, HUD_TICS,
HUD_SS_TOTALRINGS, HUD_SS_TOTALRINGS,
HUD_SS_TOTALRINGS_SPLIT,
HUD_GETRINGS, HUD_GETRINGS,
HUD_GETRINGSNUM, HUD_GETRINGSNUM,

View File

@ -15,6 +15,8 @@
#include "doomdef.h" #include "doomdef.h"
#include "r_local.h" #include "r_local.h"
#include "p_local.h" // stplyr
#include "g_game.h" // players
#include "v_video.h" #include "v_video.h"
#include "hu_stuff.h" #include "hu_stuff.h"
#include "r_draw.h" #include "r_draw.h"
@ -624,8 +626,50 @@ void V_DrawFixedPatch(fixed_t x, fixed_t y, fixed_t pscale, INT32 scrn, patch_t
x -= FixedMul(SHORT(patch->leftoffset)<<FRACBITS, pscale); x -= FixedMul(SHORT(patch->leftoffset)<<FRACBITS, pscale);
} }
if (scrn & V_SPLITSCREEN) if (splitscreen && (scrn & V_PERPLAYER))
y>>=1; {
fixed_t adjusty = ((scrn & V_NOSCALESTART) ? vid.height : BASEVIDHEIGHT)<<(FRACBITS-1);
fdup >>= 1;
rowfrac <<= 1;
y >>= 1;
#ifdef QUADS
if (splitscreen > 1) // 3 or 4 players
{
fixed_t adjustx = ((scrn & V_NOSCALESTART) ? vid.height : BASEVIDHEIGHT)<<(FRACBITS-1));
colfrac <<= 1;
x >>= 1;
if (stplyr == &players[displayplayer])
scrn &= ~V_SNAPTOBOTTOM|V_SNAPTORIGHT;
else if (stplyr == &players[secondarydisplayplayer])
{
x += adjustx;
scrn &= ~V_SNAPTOBOTTOM|V_SNAPTOLEFT;
}
else if (stplyr == &players[thirddisplayplayer])
{
y += adjusty;
scrn &= ~V_SNAPTOTOP|V_SNAPTORIGHT;
}
else //if (stplyr == &players[fourthdisplayplayer])
{
x += adjustx;
y += adjusty;
scrn &= ~V_SNAPTOTOP|V_SNAPTOLEFT;
}
}
else
#endif
// 2 players
{
if (stplyr == &players[displayplayer])
scrn &= ~V_SNAPTOBOTTOM;
else //if (stplyr == &players[secondarydisplayplayer])
{
y += adjusty;
scrn &= ~V_SNAPTOTOP;
}
}
}
desttop = screens[scrn&V_PARAMMASK]; desttop = screens[scrn&V_PARAMMASK];
@ -670,9 +714,9 @@ void V_DrawFixedPatch(fixed_t x, fixed_t y, fixed_t pscale, INT32 scrn, patch_t
if (vid.height != BASEVIDHEIGHT * dupy) if (vid.height != BASEVIDHEIGHT * dupy)
{ {
// same thing here // same thing here
if ((scrn & (V_SPLITSCREEN|V_SNAPTOBOTTOM)) == (V_SPLITSCREEN|V_SNAPTOBOTTOM)) /*if ((scrn & (V_PERPLAYER|V_SNAPTOBOTTOM)) == (V_PERPLAYER|V_SNAPTOBOTTOM))
y += (vid.height/2 - (BASEVIDHEIGHT/2 * dupy)); y += (vid.height/2 - (BASEVIDHEIGHT/2 * dupy));
else if (scrn & V_SNAPTOBOTTOM) else */if (scrn & V_SNAPTOBOTTOM)
y += (vid.height - (BASEVIDHEIGHT * dupy)); y += (vid.height - (BASEVIDHEIGHT * dupy));
else if (!(scrn & V_SNAPTOTOP)) else if (!(scrn & V_SNAPTOTOP))
y += (vid.height - (BASEVIDHEIGHT * dupy)) / 2; y += (vid.height - (BASEVIDHEIGHT * dupy)) / 2;
@ -835,7 +879,7 @@ void V_DrawCroppedPatch(fixed_t x, fixed_t y, fixed_t pscale, INT32 scrn, patch_
if (vid.height != BASEVIDHEIGHT * dupy) if (vid.height != BASEVIDHEIGHT * dupy)
{ {
// same thing here // same thing here
if ((scrn & (V_SPLITSCREEN|V_SNAPTOBOTTOM)) == (V_SPLITSCREEN|V_SNAPTOBOTTOM)) if ((scrn & (V_PERPLAYER|V_SNAPTOBOTTOM)) == (V_PERPLAYER|V_SNAPTOBOTTOM))
y += (vid.height/2 - (BASEVIDHEIGHT/2 * dupy)); y += (vid.height/2 - (BASEVIDHEIGHT/2 * dupy));
else if (scrn & V_SNAPTOBOTTOM) else if (scrn & V_SNAPTOBOTTOM)
y += (vid.height - (BASEVIDHEIGHT * dupy)); y += (vid.height - (BASEVIDHEIGHT * dupy));

View File

@ -113,7 +113,7 @@ extern RGBA_t *pMasterPalette;
#define V_WRAPY 0x20000000 // Don't clamp texture on Y (for HW mode) #define V_WRAPY 0x20000000 // Don't clamp texture on Y (for HW mode)
#define V_NOSCALESTART 0x40000000 // don't scale x, y, start coords #define V_NOSCALESTART 0x40000000 // don't scale x, y, start coords
#define V_SPLITSCREEN 0x80000000 #define V_PERPLAYER 0x80000000
// defines for old functions // defines for old functions
#define V_DrawPatch(x,y,s,p) V_DrawFixedPatch((x)<<FRACBITS, (y)<<FRACBITS, FRACUNIT, s|V_NOSCALESTART|V_NOSCALEPATCH, p, NULL) #define V_DrawPatch(x,y,s,p) V_DrawFixedPatch((x)<<FRACBITS, (y)<<FRACBITS, FRACUNIT, s|V_NOSCALESTART|V_NOSCALEPATCH, p, NULL)

View File

@ -161,18 +161,9 @@ static void Y_FollowIntermission(void);
static void Y_UnloadData(void); static void Y_UnloadData(void);
// Stuff copy+pasted from st_stuff.c // Stuff copy+pasted from st_stuff.c
static INT32 SCX(INT32 x) #define ST_DrawNumFromHud(h,n) V_DrawTallNum(hudinfo[h].x, hudinfo[h].y, V_SNAPTOTOP|V_SNAPTOLEFT, n)
{ #define ST_DrawPadNumFromHud(h,n,q) V_DrawPaddedTallNum(hudinfo[h].x, hudinfo[h].y, V_SNAPTOTOP|V_SNAPTOLEFT, n, q)
return FixedInt(FixedMul(x<<FRACBITS, vid.fdupx)); #define ST_DrawPatchFromHud(h,p) V_DrawScaledPatch(hudinfo[h].x, hudinfo[h].y, V_SNAPTOTOP|V_SNAPTOLEFT, p)
}
static INT32 SCY(INT32 z)
{
return FixedInt(FixedMul(z<<FRACBITS, vid.fdupy));
}
#define ST_DrawNumFromHud(h,n) V_DrawTallNum(SCX(hudinfo[h].x), SCY(hudinfo[h].y), V_NOSCALESTART, n)
#define ST_DrawPadNumFromHud(h,n,q) V_DrawPaddedTallNum(SCX(hudinfo[h].x), SCY(hudinfo[h].y), V_NOSCALESTART, n, q)
#define ST_DrawPatchFromHud(h,p) V_DrawScaledPatch(SCX(hudinfo[h].x), SCY(hudinfo[h].y), V_NOSCALESTART, p)
static void Y_IntermissionTokenDrawer(void) static void Y_IntermissionTokenDrawer(void)
{ {
@ -266,31 +257,34 @@ void Y_IntermissionDrawer(void)
if (gottoken) // first to be behind everything else if (gottoken) // first to be behind everything else
Y_IntermissionTokenDrawer(); Y_IntermissionTokenDrawer();
// draw score if (!splitscreen)
ST_DrawPatchFromHud(HUD_SCORE, sboscore);
ST_DrawNumFromHud(HUD_SCORENUM, data.coop.score);
// draw time
ST_DrawPatchFromHud(HUD_TIME, sbotime);
if (cv_timetic.value == 1)
ST_DrawNumFromHud(HUD_SECONDS, data.coop.tics);
else
{ {
INT32 seconds, minutes, tictrn; // draw score
ST_DrawPatchFromHud(HUD_SCORE, sboscore);
ST_DrawNumFromHud(HUD_SCORENUM, data.coop.score);
seconds = G_TicsToSeconds(data.coop.tics); // draw time
minutes = G_TicsToMinutes(data.coop.tics, true); ST_DrawPatchFromHud(HUD_TIME, sbotime);
tictrn = G_TicsToCentiseconds(data.coop.tics); if (cv_timetic.value == 1)
ST_DrawNumFromHud(HUD_SECONDS, data.coop.tics);
ST_DrawNumFromHud(HUD_MINUTES, minutes); // Minutes else
ST_DrawPatchFromHud(HUD_TIMECOLON, sbocolon); // Colon
ST_DrawPadNumFromHud(HUD_SECONDS, seconds, 2); // Seconds
// we should show centiseconds on the intermission screen too, if the conditions are right.
if (modeattacking || cv_timetic.value == 2)
{ {
ST_DrawPatchFromHud(HUD_TIMETICCOLON, sboperiod); // Period INT32 seconds, minutes, tictrn;
ST_DrawPadNumFromHud(HUD_TICS, tictrn, 2); // Tics
seconds = G_TicsToSeconds(data.coop.tics);
minutes = G_TicsToMinutes(data.coop.tics, true);
tictrn = G_TicsToCentiseconds(data.coop.tics);
ST_DrawNumFromHud(HUD_MINUTES, minutes); // Minutes
ST_DrawPatchFromHud(HUD_TIMECOLON, sbocolon); // Colon
ST_DrawPadNumFromHud(HUD_SECONDS, seconds, 2); // Seconds
// we should show centiseconds on the intermission screen too, if the conditions are right.
if (modeattacking || cv_timetic.value == 2)
{
ST_DrawPatchFromHud(HUD_TIMETICCOLON, sboperiod); // Period
ST_DrawPadNumFromHud(HUD_TICS, tictrn, 2); // Tics
}
} }
} }