Implement stplyrnum and refactor K_drawBattleFullscreen to use it

Thanks Saturn and GHG as per usual
This commit is contained in:
NepDisk 2025-02-09 11:58:06 -05:00
parent beba12acde
commit a5f4a85ce0
5 changed files with 12 additions and 14 deletions

View file

@ -3768,9 +3768,7 @@ static void K_drawBattleFullscreen(void)
if (r_splitscreen)
{
if ((r_splitscreen == 1 && stplyr == &players[displayplayers[1]])
|| (r_splitscreen > 1 && (stplyr == &players[displayplayers[2]]
|| (stplyr == &players[displayplayers[3]] && r_splitscreen > 2))))
if ((splitscreen == 1 && stplyrnum == 1) || (splitscreen > 1 && stplyrnum & 2))
{
y = 232-(stplyr->karthud[khud_cardanimation]/2);
splitflags = V_SNAPTOBOTTOM;
@ -3782,8 +3780,7 @@ static void K_drawBattleFullscreen(void)
{
scale /= 2;
if (stplyr == &players[displayplayers[1]]
|| (stplyr == &players[displayplayers[3]] && r_splitscreen > 2))
if (stplyrnum & 1)
x = 3*BASEVIDWIDTH/4;
else
x = BASEVIDWIDTH/4;
@ -3792,7 +3789,7 @@ static void K_drawBattleFullscreen(void)
{
if (stplyr->exiting)
{
if (stplyr == &players[displayplayers[1]])
if (stplyrnum & 1)
x = BASEVIDWIDTH-96;
else
x = 96;
@ -3804,7 +3801,7 @@ static void K_drawBattleFullscreen(void)
if (stplyr->exiting)
{
if (stplyr == &players[displayplayers[0]])
if (stplyrnum == 0)
V_DrawFadeScreen(0xFF00, 16);
if (stplyr->exiting < 6*TICRATE && !stplyr->spectator)
{
@ -3838,9 +3835,7 @@ static void K_drawBattleFullscreen(void)
{
if (r_splitscreen > 1)
ty = (BASEVIDHEIGHT/4)+33;
if ((r_splitscreen == 1 && stplyr == &players[displayplayers[1]])
|| (stplyr == &players[displayplayers[2]] && r_splitscreen > 1)
|| (stplyr == &players[displayplayers[3]] && r_splitscreen > 2))
if ((splitscreen == 1 && stplyrnum == 1) || (splitscreen > 1 && stplyrnum & 2))
ty += (BASEVIDHEIGHT/2);
}
else

View file

@ -39,7 +39,6 @@
boolean LUA_CallAction(enum actionnum actionnum, mobj_t *actor);
player_t *stplyr;
INT32 var1;
INT32 var2;
INT32 modulothing;

View file

@ -370,9 +370,6 @@ void P_FlashPal(player_t *pl, UINT16 type, UINT16 duration);
// P_ENEMY
//
// main player in game
extern player_t *stplyr; // for splitscreen correct palette changes and overlay
// Is there a better place for these?
extern INT32 var1;
extern INT32 var2;

View file

@ -83,6 +83,10 @@ static patch_t *hud_tv2;
static patch_t *envelope;
#endif
// current player for overlay drawing
player_t *stplyr;
UINT8 stplyrnum;
static huddrawlist_h luahuddrawlist_game[MAXSPLITSCREENPLAYERS];
static huddrawlist_h luahuddrawlist_titlecard;
@ -882,6 +886,7 @@ void ST_Drawer(void)
for (i = 0; i <= r_splitscreen; i++)
{
stplyr = &players[displayplayers[i]];
stplyrnum = i;
R_SetViewContext(VIEWCONTEXT_PLAYER1 + i);
R_InterpolateView(rendertimefrac); // to assist with object tracking
ST_overlayDrawer(i);

View file

@ -81,6 +81,8 @@ boolean ST_SameTeam(player_t *a, player_t *b);
extern boolean st_overlay; // sb overlay on or off when fullscreen
extern INT32 st_palette; // 0 is default, any others are special palettes.
extern player_t *stplyr; // for splitscreen correct palette changes and overlay
extern UINT8 stplyrnum;
extern UINT32 st_translucency;
extern lumpnum_t st_borderpatchnum;