replace all this crap with either stplyrnum or R_GetViewNumber
This commit is contained in:
1 parent
2ba291516e
commit
76460b9d9c
5 files changed
+34
-57
No files matched your search
@@ -3303,11 +3303,11 @@ static void HWR_DrawSpriteShadow(gl_vissprite_t *spr, GLPatch_t *gpatch)
|
||||
angle_t shadowdir;
|
||||
|
||||
// Set direction
|
||||
if (splitscreen && stplyr == &players[displayplayers[1]])
|
||||
if (splitscreen && R_GetViewNumber() == 1)
|
||||
shadowdir = localangle[1] + FixedAngle(cv_cam_rotate[1].value);
|
||||
else if (splitscreen > 1 && stplyr == &players[displayplayers[2]])
|
||||
else if (splitscreen > 1 && R_GetViewNumber() == 2)
|
||||
shadowdir = localangle[2] + FixedAngle(cv_cam_rotate[2].value);
|
||||
else if (splitscreen > 2 && stplyr == &players[displayplayers[3]])
|
||||
else if (splitscreen > 2 && R_GetViewNumber() == 3)
|
||||
shadowdir = localangle[3] + FixedAngle(cv_cam_rotate[3].value);
|
||||
else
|
||||
shadowdir = localangle[0] + FixedAngle(cv_cam_rotate[0].value);
|
||||
|
||||
+24
-35
@@ -7955,17 +7955,17 @@ INT32 K_calcSplitFlags(INT32 snapflags)
|
||||
if (splitscreen == 0)
|
||||
return snapflags;
|
||||
|
||||
if (stplyr != &players[displayplayers[0]])
|
||||
if (stplyrnum != 0)
|
||||
{
|
||||
if (splitscreen == 1 && stplyr == &players[displayplayers[1]])
|
||||
if (splitscreen == 1 && stplyrnum == 1)
|
||||
{
|
||||
splitflags |= V_SPLITSCREEN;
|
||||
}
|
||||
else if (splitscreen > 1)
|
||||
{
|
||||
if (stplyr == &players[displayplayers[2]] || (splitscreen == 3 && stplyr == &players[displayplayers[3]]))
|
||||
if (stplyrnum == 2 || (splitscreen == 3 && stplyrnum == 3))
|
||||
splitflags |= V_SPLITSCREEN;
|
||||
if (stplyr == &players[displayplayers[1]] || (splitscreen == 3 && stplyr == &players[displayplayers[3]]))
|
||||
if (stplyrnum == 1 || (splitscreen == 3 && stplyrnum == 3))
|
||||
splitflags |= V_HORZSCREEN;
|
||||
}
|
||||
}
|
||||
@@ -8085,7 +8085,7 @@ static void K_drawKartStats(void)
|
||||
|
||||
for (; splitnum < MAXSPLITSCREENPLAYERS; ++splitnum)
|
||||
{
|
||||
if (stplyr == &players[displayplayers[splitnum]])
|
||||
if (stplyrnum == splitnum)
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -8671,7 +8671,7 @@ static void K_DrawKartPositionNum(INT32 num)
|
||||
else if (splitscreen == 1) // for this splitscreen, we'll use case by case because it's a bit different.
|
||||
{
|
||||
fx = POSI_X;
|
||||
if (stplyr == &players[displayplayers[0]]) // for player 1: display this at the top right, above the minimap.
|
||||
if (stplyrnum == 0) // for player 1: display this at the top right, above the minimap.
|
||||
{
|
||||
fy = 30 + cv_posi_yoffset.value;
|
||||
fflags = V_SNAPTOTOP|V_SNAPTORIGHT;
|
||||
@@ -8686,11 +8686,11 @@ static void K_DrawKartPositionNum(INT32 num)
|
||||
}
|
||||
else
|
||||
{
|
||||
if (stplyr == &players[displayplayers[0]] || stplyr == &players[displayplayers[2]]) // If we are P1 or P3...
|
||||
if (!(stplyrnum & 1)) // If we are P1 or P3...
|
||||
{
|
||||
fx = POSI_X;
|
||||
fy = POSI_Y;
|
||||
fflags = V_SNAPTOLEFT|((stplyr == &players[displayplayers[2]]) ? V_SPLITSCREEN|V_SNAPTOBOTTOM : 0); // flip P3 to the bottom.
|
||||
fflags = V_SNAPTOLEFT|((stplyrnum == 2) ? V_SPLITSCREEN|V_SNAPTOBOTTOM : 0); // flip P3 to the bottom.
|
||||
flipdraw = true;
|
||||
if (num && num >= 10)
|
||||
fx += W; // this seems dumb, but we need to do this in order for positions above 10 going off screen.
|
||||
@@ -8699,7 +8699,7 @@ static void K_DrawKartPositionNum(INT32 num)
|
||||
{
|
||||
fx = POSI2_X;
|
||||
fy = POSI2_Y;
|
||||
fflags = V_SNAPTORIGHT|((stplyr == &players[displayplayers[3]]) ? V_SPLITSCREEN|V_SNAPTOBOTTOM : 0); // flip P4 to the bottom
|
||||
fflags = V_SNAPTORIGHT|((stplyrnum == 3) ? V_SPLITSCREEN|V_SNAPTOBOTTOM : 0); // flip P4 to the bottom
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9656,7 +9656,7 @@ static void K_drawDriftGauge(void)
|
||||
0, 31, 47, 63, 79, 95, 111, 119, 127, 143, 159, 175, 183, 191, 199, 207, 223, 247
|
||||
};
|
||||
|
||||
if (demo.playback && camera[R_GetViewNumber()].freecam)
|
||||
if (demo.playback && camera[stplyrnum].freecam)
|
||||
return;
|
||||
|
||||
if (P_MobjWasRemoved(stplyr->mo) || (!splitscreen && !camera->chase))
|
||||
@@ -9814,7 +9814,7 @@ static void K_drawKartWanted(void)
|
||||
UINT8 *colormap = NULL;
|
||||
INT32 basex = 0, basey = 0;
|
||||
|
||||
if (stplyr != &players[displayplayers[0]])
|
||||
if (stplyrnum != 0)
|
||||
return;
|
||||
|
||||
for (i = 0; i < 4; i++)
|
||||
@@ -10011,7 +10011,7 @@ static void K_drawKartMinimap(void)
|
||||
if (gamestate != GS_LEVEL)
|
||||
return;
|
||||
|
||||
if (stplyr != &players[displayplayers[0]])
|
||||
if (stplyrnum != 0)
|
||||
return;
|
||||
|
||||
if (minimapinfo.minimap_pic == NULL)
|
||||
@@ -10173,7 +10173,7 @@ static void K_drawKartFinish(void)
|
||||
xval = (SHORT(kp_racefinish[pnum]->width)<<FRACBITS);
|
||||
x = (FixedMul(((TICRATE - stplyr->kartstuff[k_cardanimation])<<FRACBITS) - R_GetHudUncap(), xval > x ? xval : x))/TICRATE;
|
||||
|
||||
if (splitscreen && stplyr == &players[displayplayers[1]])
|
||||
if (splitscreen && stplyrnum == 1)
|
||||
x = -x;
|
||||
|
||||
V_DrawFixedPatch(x + (STCD_X<<FRACBITS) - (xval>>1),
|
||||
@@ -10330,14 +10330,9 @@ static void K_drawKartFirstPerson(void)
|
||||
if (stplyr->spectator || !stplyr->mo || (stplyr->mo->flags2 & MF2_DONTDRAW))
|
||||
return;
|
||||
|
||||
if (stplyr == &players[displayplayers[1]] && splitscreen)
|
||||
{ pn = pnum[1]; tn = turn[1]; dr = drift[1]; }
|
||||
else if (stplyr == &players[displayplayers[2]] && splitscreen > 1)
|
||||
{ pn = pnum[2]; tn = turn[2]; dr = drift[2]; }
|
||||
else if (stplyr == &players[displayplayers[3]] && splitscreen > 2)
|
||||
{ pn = pnum[3]; tn = turn[3]; dr = drift[3]; }
|
||||
else
|
||||
{ pn = pnum[0]; tn = turn[0]; dr = drift[0]; }
|
||||
pn = pnum[stplyrnum];
|
||||
tn = turn[stplyrnum];
|
||||
dr = drift[stplyrnum];
|
||||
|
||||
if (splitscreen)
|
||||
{
|
||||
@@ -10459,14 +10454,9 @@ static void K_drawKartFirstPerson(void)
|
||||
|
||||
V_DrawFixedPatch(x, y, scale, splitflags, kp_fpview[target], colmap);
|
||||
|
||||
if (stplyr == &players[displayplayers[1]] && splitscreen)
|
||||
{ pnum[1] = pn; turn[1] = tn; drift[1] = dr; }
|
||||
else if (stplyr == &players[displayplayers[2]] && splitscreen > 1)
|
||||
{ pnum[2] = pn; turn[2] = tn; drift[2] = dr; }
|
||||
else if (stplyr == &players[displayplayers[3]] && splitscreen > 2)
|
||||
{ pnum[3] = pn; turn[3] = tn; drift[3] = dr; }
|
||||
else
|
||||
{ pnum[0] = pn; turn[0] = tn; drift[0] = dr; }
|
||||
pnum[stplyrnum] = pn;
|
||||
turn[stplyrnum] = tn;
|
||||
drift[stplyrnum] = dr;
|
||||
}
|
||||
|
||||
// doesn't need to ever support 4p
|
||||
@@ -10686,7 +10676,7 @@ static void K_drawDistributionDebugger(void)
|
||||
boolean dontforcespb = false;
|
||||
boolean spbrush = false;
|
||||
|
||||
if (stplyr != &players[displayplayers[0]]) // only for p1
|
||||
if (stplyrnum != 0) // only for p1
|
||||
return;
|
||||
|
||||
// The only code duplication from the Kart, just to avoid the actual item function from calculating pingame twice
|
||||
@@ -10750,7 +10740,7 @@ static void K_drawDistributionDebugger(void)
|
||||
|
||||
static void K_drawCheckpointDebugger(void)
|
||||
{
|
||||
if (stplyr != &players[displayplayers[0]]) // only for p1
|
||||
if (stplyrnum != 0) // only for p1
|
||||
return;
|
||||
|
||||
if (stplyr->starpostnum >= (numstarposts - (numstarposts/2)))
|
||||
@@ -10764,19 +10754,18 @@ void K_drawKartHUD(void)
|
||||
{
|
||||
boolean isfreeplay = false;
|
||||
boolean battlefullscreen = false;
|
||||
UINT8 viewnum = R_GetViewNumber();
|
||||
boolean freecam = camera[viewnum].freecam; //disable some hud elements w/ freecam
|
||||
boolean freecam = camera[stplyrnum].freecam; //disable some hud elements w/ freecam
|
||||
|
||||
// Define the X and Y for each drawn object
|
||||
// This is handled by console/menu values
|
||||
K_initKartHUD();
|
||||
|
||||
// Draw that fun first person HUD! Drawn ASAP so it looks more "real".
|
||||
if (!camera[viewnum].chase && !freecam)
|
||||
if (!camera[stplyrnum].chase && !freecam)
|
||||
K_drawKartFirstPerson();
|
||||
|
||||
// Draw full screen stuff that turns off the rest of the HUD
|
||||
if (mapreset && R_GetViewNumber() == 0)
|
||||
if (mapreset && stplyrnum == 0)
|
||||
{
|
||||
K_drawChallengerScreen();
|
||||
return;
|
||||
|
||||
+1
-1
@@ -649,7 +649,7 @@ static int libd_drawOnMinimap(lua_State *L)
|
||||
if (gamestate != GS_LEVEL)
|
||||
return 0;
|
||||
|
||||
if (stplyr != &players[displayplayers[0]])
|
||||
if (stplyrnum != 0)
|
||||
return 0;
|
||||
|
||||
AutomapPic = minimapinfo.minimap_pic;
|
||||
|
||||
+3
-13
@@ -263,21 +263,11 @@ sector_t *R_FakeFlat(sector_t *sec, sector_t *tempsec, INT32 *floorlightlevel,
|
||||
mobj_t *pviewmobj = viewplayer->mo;
|
||||
INT32 heightsec;
|
||||
boolean underwater;
|
||||
UINT8 i;
|
||||
|
||||
for (i = 0; i <= splitscreen; i++)
|
||||
{
|
||||
if (viewplayer != &players[displayplayers[i]])
|
||||
continue;
|
||||
|
||||
if (!camera[i].chase)
|
||||
continue;
|
||||
UINT8 i = R_GetViewNumber();
|
||||
|
||||
if (camera[i].chase)
|
||||
heightsec = R_PointInSubsector(camera[i].x, camera[i].y)->sector->heightsec;
|
||||
break;
|
||||
}
|
||||
|
||||
if (i > splitscreen && pviewmobj)
|
||||
else if (i > splitscreen && viewmobj)
|
||||
heightsec = R_PointInSubsector(pviewmobj->x, pviewmobj->y)->sector->heightsec;
|
||||
else
|
||||
return sec;
|
||||
|
||||
+3
-5
@@ -657,8 +657,6 @@ static void ST_drawLevelTitle(void)
|
||||
//
|
||||
static void ST_overlayDrawer(void)
|
||||
{
|
||||
const UINT8 viewnum = R_GetViewNumber();
|
||||
|
||||
//hu_showscores = auto hide score/time/rings when tab rankings are shown
|
||||
if (!(hu_showscores && (netgame || multiplayer)))
|
||||
{
|
||||
@@ -667,7 +665,7 @@ static void ST_overlayDrawer(void)
|
||||
|
||||
if (!hu_showscores) // hide the following if TAB is held
|
||||
{
|
||||
if (cv_showdirectorhud.value && !splitscreen && ((demo.playback && !camera[viewnum].freecam && (!demo.title || !modeattacking)) || !P_IsLocalPlayer(stplyr)) && !K_DirectorIsPlayerAlone())
|
||||
if (cv_showdirectorhud.value && !splitscreen && ((demo.playback && !camera[stplyrnum].freecam && (!demo.title || !modeattacking)) || !P_IsLocalPlayer(stplyr)) && !K_DirectorIsPlayerAlone())
|
||||
{
|
||||
char directortext[20] = {0};
|
||||
|
||||
@@ -707,7 +705,7 @@ static void ST_overlayDrawer(void)
|
||||
V_DrawCenteredString((BASEVIDWIDTH/2), BASEVIDHEIGHT-32, V_SNAPTOBOTTOM|V_HUDTRANS|V_ALLOWLOWERCASE, player_names[stplyr-players]);
|
||||
}
|
||||
}
|
||||
else if (!demo.title && !camera[viewnum].freecam)
|
||||
else if (!demo.title && !camera[stplyrnum].freecam)
|
||||
{
|
||||
if (!splitscreen)
|
||||
{
|
||||
@@ -718,7 +716,7 @@ static void ST_overlayDrawer(void)
|
||||
{
|
||||
char name[MAXPLAYERNAME+12];
|
||||
|
||||
INT32 y = (stplyr == &players[displayplayers[0]]) ? 4 : BASEVIDHEIGHT/2-12;
|
||||
INT32 y = (stplyrnum == 0) ? 4 : BASEVIDHEIGHT/2-12;
|
||||
sprintf(name, "VIEWPOINT: %s", player_names[stplyr-players]);
|
||||
V_DrawRightAlignedThinString(BASEVIDWIDTH-40, y, V_HUDTRANSHALF|V_ALLOWLOWERCASE|K_calcSplitFlags(V_SNAPTOTOP|V_SNAPTOBOTTOM|V_SNAPTORIGHT), name);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user