diff --git a/src/k_hud.c b/src/k_hud.c index 6cef04fb2..839222cb0 100644 --- a/src/k_hud.c +++ b/src/k_hud.c @@ -3767,9 +3767,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; @@ -3781,8 +3779,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; @@ -3791,7 +3788,7 @@ static void K_drawBattleFullscreen(void) { if (stplyr->exiting) { - if (stplyr == &players[displayplayers[1]]) + if (stplyrnum & 1) x = BASEVIDWIDTH-96; else x = 96; @@ -3803,7 +3800,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) { @@ -3837,9 +3834,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 diff --git a/src/p_enemy.c b/src/p_enemy.c index 82cd7a726..1fb73e702 100644 --- a/src/p_enemy.c +++ b/src/p_enemy.c @@ -39,7 +39,6 @@ boolean LUA_CallAction(enum actionnum actionnum, mobj_t *actor); -player_t *stplyr; INT32 var1; INT32 var2; INT32 modulothing; diff --git a/src/p_local.h b/src/p_local.h index 2b89e602f..f91e1490b 100644 --- a/src/p_local.h +++ b/src/p_local.h @@ -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; diff --git a/src/st_stuff.c b/src/st_stuff.c index 28e0379cb..c83f3061c 100644 --- a/src/st_stuff.c +++ b/src/st_stuff.c @@ -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; @@ -912,6 +916,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); diff --git a/src/st_stuff.h b/src/st_stuff.h index 3cdf3a918..9efeaf406 100644 --- a/src/st_stuff.h +++ b/src/st_stuff.h @@ -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;