Fix up more stuff

Now in a mergable state
This commit is contained in:
TehRealSalt 2019-04-18 12:20:13 -04:00
parent 1f61397545
commit a187656a8f
15 changed files with 98 additions and 148 deletions

View file

@ -436,6 +436,8 @@ static void D_Display(void)
objectsdrawn = 0; objectsdrawn = 0;
} }
viewssnum = i;
#ifdef HWRENDER #ifdef HWRENDER
if (rendermode != render_soft) if (rendermode != render_soft)
HWR_RenderPlayerView(i, &players[displayplayers[i]]); HWR_RenderPlayerView(i, &players[displayplayers[i]]);

View file

@ -21,7 +21,6 @@
// Max computers in a game // Max computers in a game
#define MAXNETNODES (MAXPLAYERS+4) #define MAXNETNODES (MAXPLAYERS+4)
#define BROADCASTADDR MAXNETNODES #define BROADCASTADDR MAXNETNODES
#define MAXSPLITSCREENPLAYERS 4 // Max number of players on a single computer
#define NETSPLITSCREEN // Kart's splitscreen netgame feature #define NETSPLITSCREEN // Kart's splitscreen netgame feature
#define STATLENGTH (TICRATE*2) #define STATLENGTH (TICRATE*2)

View file

@ -77,7 +77,10 @@ extern boolean addedtogame; // true after the server has added you
extern boolean multiplayer; extern boolean multiplayer;
extern INT16 gametype; extern INT16 gametype;
#define MAXSPLITSCREENPLAYERS 4 // Max number of players on a single computer
extern UINT8 splitscreen; extern UINT8 splitscreen;
extern boolean circuitmap; // Does this level have 'circuit mode'? extern boolean circuitmap; // Does this level have 'circuit mode'?
extern boolean fromlevelselect; extern boolean fromlevelselect;
extern boolean forceresetplayers, deferencoremode; extern boolean forceresetplayers, deferencoremode;

View file

@ -7397,7 +7397,7 @@ void G_DoPlayDemo(char *defdemoname)
// Load players that were in-game when the map started // Load players that were in-game when the map started
p = READUINT8(demo_p); p = READUINT8(demo_p);
for (i = 1; i < MAXSPLITSCREENPLAYERS; i++); for (i = 1; i < MAXSPLITSCREENPLAYERS; i++)
displayplayers[i] = INT32_MAX; displayplayers[i] = INT32_MAX;
while (p != 0xFF) while (p != 0xFF)

View file

@ -296,7 +296,7 @@ static void HW3S_FillSourceParameters
data->max_distance = MAX_DISTANCE; data->max_distance = MAX_DISTANCE;
data->min_distance = MIN_DISTANCE; data->min_distance = MIN_DISTANCE;
if (origin && origin != players[displayplayer].mo) if (origin && origin != players[displayplayers[0]].mo)
{ {
data->head_relative = false; data->head_relative = false;
@ -356,10 +356,10 @@ INT32 HW3S_I_StartSound(const void *origin_p, source3D_data_t *source_parm, chan
source3D_data_t source3d_data; source3D_data_t source3d_data;
INT32 s_num = 0; INT32 s_num = 0;
source_t *source = NULL; source_t *source = NULL;
mobj_t *listenmobj = players[displayplayer].mo; mobj_t *listenmobj = players[displayplayers[0]].mo; // TODO: Kart 4P does not support sounds properly here
mobj_t *listenmobj2 = NULL; mobj_t *listenmobj2 = NULL;
if (splitscreen) listenmobj2 = players[secondarydisplayplayer].mo; if (splitscreen) listenmobj2 = players[displayplayers[1]].mo;
if (sound_disabled) if (sound_disabled)
return -1; return -1;
@ -876,12 +876,12 @@ static void HW3S_Update3DSource(source_t *src)
void HW3S_UpdateSources(void) void HW3S_UpdateSources(void)
{ {
mobj_t *listener = players[displayplayer].mo; mobj_t *listener = players[displayplayers[0]].mo;
mobj_t *listener2 = NULL; mobj_t *listener2 = NULL;
source_t *src; source_t *src;
INT32 audible, snum, volume, sep, pitch; INT32 audible, snum, volume, sep, pitch;
if (splitscreen) listener2 = players[secondarydisplayplayer].mo; if (splitscreen) listener2 = players[displayplayers[1]].mo;
HW3S_UpdateListener2(listener2); HW3S_UpdateListener2(listener2);
HW3S_UpdateListener(listener); HW3S_UpdateListener(listener);

View file

@ -63,7 +63,7 @@ struct hwdriver_s hwdriver;
// ========================================================================== // ==========================================================================
static void HWR_AddSprites(sector_t *sec, UINT8 ssplayer); static void HWR_AddSprites(sector_t *sec);
static void HWR_ProjectSprite(mobj_t *thing); static void HWR_ProjectSprite(mobj_t *thing);
#ifdef HWPRECIP #ifdef HWPRECIP
static void HWR_ProjectPrecipitationSprite(precipmobj_t *thing); static void HWR_ProjectPrecipitationSprite(precipmobj_t *thing);
@ -3389,7 +3389,7 @@ static void HWR_AddPolyObjectPlanes(void)
// : Draw one or more line segments. // : Draw one or more line segments.
// Notes : Sets gr_cursectorlight to the light of the parent sector, to modulate wall textures // Notes : Sets gr_cursectorlight to the light of the parent sector, to modulate wall textures
// -----------------+ // -----------------+
static void HWR_Subsector(size_t num, UINT8 ssplayer) static void HWR_Subsector(size_t num)
{ {
INT16 count; INT16 count;
seg_t *line; seg_t *line;
@ -3754,7 +3754,7 @@ static void HWR_Subsector(size_t num, UINT8 ssplayer)
{ {
// draw sprites first, coz they are clipped to the solidsegs of // draw sprites first, coz they are clipped to the solidsegs of
// subsectors more 'in front' // subsectors more 'in front'
HWR_AddSprites(gr_frontsector, ssplayer); HWR_AddSprites(gr_frontsector);
//Hurdler: at this point validcount must be the same, but is not because //Hurdler: at this point validcount must be the same, but is not because
// gr_frontsector doesn't point anymore to sub->sector due to // gr_frontsector doesn't point anymore to sub->sector due to
@ -3806,7 +3806,7 @@ static boolean HWR_CheckHackBBox(fixed_t *bb)
// BP: big hack for a test in lighning ref : 1249753487AB // BP: big hack for a test in lighning ref : 1249753487AB
fixed_t *hwbbox; fixed_t *hwbbox;
static void HWR_RenderBSPNode(INT32 bspnum, UINT8 ssplayer) static void HWR_RenderBSPNode(INT32 bspnum)
{ {
/*//GZDoom code /*//GZDoom code
if(bspnum == -1) if(bspnum == -1)
@ -3846,12 +3846,12 @@ static void HWR_RenderBSPNode(INT32 bspnum, UINT8 ssplayer)
if (bspnum == -1) if (bspnum == -1)
{ {
//*(gr_drawsubsector_p++) = 0; //*(gr_drawsubsector_p++) = 0;
HWR_Subsector(0, ssplayer); HWR_Subsector(0);
} }
else else
{ {
//*(gr_drawsubsector_p++) = bspnum&(~NF_SUBSECTOR); //*(gr_drawsubsector_p++) = bspnum&(~NF_SUBSECTOR);
HWR_Subsector(bspnum&(~NF_SUBSECTOR), ssplayer); HWR_Subsector(bspnum&(~NF_SUBSECTOR));
} }
return; return;
} }
@ -3863,14 +3863,14 @@ static void HWR_RenderBSPNode(INT32 bspnum, UINT8 ssplayer)
hwbbox = bsp->bbox[side]; hwbbox = bsp->bbox[side];
// Recursively divide front space. // Recursively divide front space.
HWR_RenderBSPNode(bsp->children[side], ssplayer); HWR_RenderBSPNode(bsp->children[side]);
// Possibly divide back space. // Possibly divide back space.
if (HWR_CheckBBox(bsp->bbox[side^1])) if (HWR_CheckBBox(bsp->bbox[side^1]))
{ {
// BP: big hack for a test in lighning ref : 1249753487AB // BP: big hack for a test in lighning ref : 1249753487AB
hwbbox = bsp->bbox[side^1]; hwbbox = bsp->bbox[side^1];
HWR_RenderBSPNode(bsp->children[side^1], ssplayer); HWR_RenderBSPNode(bsp->children[side^1]);
} }
} }
@ -4097,14 +4097,14 @@ static void HWR_DrawSpriteShadow(gr_vissprite_t *spr, GLPatch_t *gpatch, float t
angle_t shadowdir; angle_t shadowdir;
// Set direction // Set direction
if (splitscreen && stplyr == &players[secondarydisplayplayer]) if (splitscreen && stplyr == &players[displayplayers[1]])
shadowdir = localangle2 + FixedAngle(cv_cam2_rotate.value); shadowdir = localangle[1] + FixedAngle(cv_cam2_rotate.value);
else if (splitscreen > 1 && stplyr == &players[thirddisplayplayer]) else if (splitscreen > 1 && stplyr == &players[displayplayers[2]])
shadowdir = localangle3 + FixedAngle(cv_cam3_rotate.value); shadowdir = localangle[2] + FixedAngle(cv_cam3_rotate.value);
else if (splitscreen > 2 && stplyr == &players[fourthdisplayplayer]) else if (splitscreen > 2 && stplyr == &players[displayplayers[3]])
shadowdir = localangle4 + FixedAngle(cv_cam4_rotate.value); shadowdir = localangle[3] + FixedAngle(cv_cam4_rotate.value);
else else
shadowdir = localangle + FixedAngle(cv_cam_rotate.value); shadowdir = localangle[0] + FixedAngle(cv_cam_rotate.value);
// Find floorheight // Find floorheight
floorheight = HWR_OpaqueFloorAtPos( floorheight = HWR_OpaqueFloorAtPos(
@ -5283,7 +5283,7 @@ static void HWR_DrawSprites(void)
// During BSP traversal, this adds sprites by sector. // During BSP traversal, this adds sprites by sector.
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
static UINT8 sectorlight; static UINT8 sectorlight;
static void HWR_AddSprites(sector_t *sec, UINT8 ssplayer) static void HWR_AddSprites(sector_t *sec)
{ {
mobj_t *thing; mobj_t *thing;
#ifdef HWPRECIP #ifdef HWPRECIP
@ -5316,19 +5316,19 @@ static void HWR_AddSprites(sector_t *sec, UINT8 ssplayer)
if (splitscreen) if (splitscreen)
{ {
if (thing->eflags & MFE_DRAWONLYFORP1) if (thing->eflags & MFE_DRAWONLYFORP1)
if (ssplayer != 1) if (viewssnum != 0)
continue; continue;
if (thing->eflags & MFE_DRAWONLYFORP2) if (thing->eflags & MFE_DRAWONLYFORP2)
if (ssplayer != 2) if (viewssnum != 1)
continue; continue;
if (thing->eflags & MFE_DRAWONLYFORP3 && splitscreen > 1) if (thing->eflags & MFE_DRAWONLYFORP3 && splitscreen > 1)
if (ssplayer != 3) if (viewssnum != 2)
continue; continue;
if (thing->eflags & MFE_DRAWONLYFORP4 && splitscreen > 2) if (thing->eflags & MFE_DRAWONLYFORP4 && splitscreen > 2)
if (ssplayer != 4) if (viewssnum != 3)
continue; continue;
} }
@ -5351,19 +5351,19 @@ static void HWR_AddSprites(sector_t *sec, UINT8 ssplayer)
if (splitscreen) if (splitscreen)
{ {
if (thing->eflags & MFE_DRAWONLYFORP1) if (thing->eflags & MFE_DRAWONLYFORP1)
if (ssplayer != 1) if (viewssnum != 0)
continue; continue;
if (thing->eflags & MFE_DRAWONLYFORP2) if (thing->eflags & MFE_DRAWONLYFORP2)
if (ssplayer != 2) if (viewssnum != 1)
continue; continue;
if (thing->eflags & MFE_DRAWONLYFORP3 && splitscreen > 1) if (thing->eflags & MFE_DRAWONLYFORP3 && splitscreen > 1)
if (ssplayer != 3) if (viewssnum != 2)
continue; continue;
if (thing->eflags & MFE_DRAWONLYFORP4 && splitscreen > 2) if (thing->eflags & MFE_DRAWONLYFORP4 && splitscreen > 2)
if (ssplayer != 4) if (viewssnum != 3)
continue; continue;
} }
@ -5906,33 +5906,8 @@ void HWR_RenderSkyboxView(INT32 viewnumber, player_t *player)
{ {
const float fpov = FIXED_TO_FLOAT(cv_fov.value+player->fovadd); const float fpov = FIXED_TO_FLOAT(cv_fov.value+player->fovadd);
postimg_t *type; postimg_t *type;
UINT8 ssplayer = 0;
if (splitscreen) type = &postimgtype[viewnumber];
{
if (player == &players[secondarydisplayplayer])
{
type = &postimgtype2;
ssplayer = 2;
}
else if (splitscreen > 1 && player == &players[thirddisplayplayer])
{
type = &postimgtype3;
ssplayer = 3;
}
else if (splitscreen > 2 && player == &players[fourthdisplayplayer])
{
type = &postimgtype4;
ssplayer = 4;
}
else
{
type = &postimgtype;
ssplayer = 1;
}
}
else
type = &postimgtype;
{ {
// do we really need to save player (is it not the same)? // do we really need to save player (is it not the same)?
@ -6056,36 +6031,36 @@ if (0)
validcount++; validcount++;
HWR_RenderBSPNode((INT32)numnodes-1, ssplayer); HWR_RenderBSPNode((INT32)numnodes-1);
#ifndef NEWCLIP #ifndef NEWCLIP
// Make a viewangle int so we can render things based on mouselook // Make a viewangle int so we can render things based on mouselook
if (player == &players[consoleplayer]) if (player == &players[consoleplayer])
viewangle = localaiming; viewangle = localaiming[0];
else if (splitscreen && player == &players[secondarydisplayplayer]) else if (splitscreen && player == &players[displayplayers[1]])
viewangle = localaiming2; viewangle = localaiming[1];
else if (splitscreen > 1 && player == &players[thirddisplayplayer]) else if (splitscreen > 1 && player == &players[displayplayers[2]])
viewangle = localaiming3; viewangle = localaiming[2];
else if (splitscreen > 2 && player == &players[fourthdisplayplayer]) else if (splitscreen > 2 && player == &players[displayplayers[3]])
viewangle = localaiming4; viewangle = localaiming[3];
// Handle stuff when you are looking farther up or down. // Handle stuff when you are looking farther up or down.
if ((aimingangle || cv_fov.value+player->fovadd > 90*FRACUNIT)) if ((aimingangle || cv_fov.value+player->fovadd > 90*FRACUNIT))
{ {
dup_viewangle += ANGLE_90; dup_viewangle += ANGLE_90;
HWR_ClearClipSegs(); HWR_ClearClipSegs();
HWR_RenderBSPNode((INT32)numnodes-1, ssplayer); //left HWR_RenderBSPNode((INT32)numnodes-1); //left
dup_viewangle += ANGLE_90; dup_viewangle += ANGLE_90;
if (((INT32)aimingangle > ANGLE_45 || (INT32)aimingangle<-ANGLE_45)) if (((INT32)aimingangle > ANGLE_45 || (INT32)aimingangle<-ANGLE_45))
{ {
HWR_ClearClipSegs(); HWR_ClearClipSegs();
HWR_RenderBSPNode((INT32)numnodes-1, ssplayer); //back HWR_RenderBSPNode((INT32)numnodes-1); //back
} }
dup_viewangle += ANGLE_90; dup_viewangle += ANGLE_90;
HWR_ClearClipSegs(); HWR_ClearClipSegs();
HWR_RenderBSPNode((INT32)numnodes-1, ssplayer); //right HWR_RenderBSPNode((INT32)numnodes-1); //right
dup_viewangle += ANGLE_90; dup_viewangle += ANGLE_90;
} }
@ -6149,38 +6124,13 @@ if (0)
void HWR_RenderPlayerView(INT32 viewnumber, player_t *player) void HWR_RenderPlayerView(INT32 viewnumber, player_t *player)
{ {
const float fpov = FIXED_TO_FLOAT(cv_fov.value+player->fovadd); const float fpov = FIXED_TO_FLOAT(cv_fov.value+player->fovadd);
postimg_t *type; postimg_t *type = &postimgtype[viewnumber];
UINT8 ssplayer = 0;
const boolean skybox = (skyboxmo[0] && cv_skybox.value); // True if there's a skybox object and skyboxes are on const boolean skybox = (skyboxmo[0] && cv_skybox.value); // True if there's a skybox object and skyboxes are on
FRGBAFloat ClearColor; FRGBAFloat ClearColor;
if (splitscreen) type = &postimgtype[viewnumber];
{
if (player == &players[secondarydisplayplayer])
{
type = &postimgtype2;
ssplayer = 2;
}
else if (splitscreen > 1 && player == &players[thirddisplayplayer])
{
type = &postimgtype3;
ssplayer = 3;
}
else if (splitscreen > 2 && player == &players[fourthdisplayplayer])
{
type = &postimgtype4;
ssplayer = 4;
}
else
{
type = &postimgtype;
ssplayer = 1;
}
}
else
type = &postimgtype;
ClearColor.red = 0.0f; ClearColor.red = 0.0f;
ClearColor.green = 0.0f; ClearColor.green = 0.0f;
@ -6315,36 +6265,36 @@ if (0)
validcount++; validcount++;
HWR_RenderBSPNode((INT32)numnodes-1, ssplayer); HWR_RenderBSPNode((INT32)numnodes-1);
#ifndef NEWCLIP #ifndef NEWCLIP
// Make a viewangle int so we can render things based on mouselook // Make a viewangle int so we can render things based on mouselook
if (player == &players[consoleplayer]) if (player == &players[consoleplayer])
viewangle = localaiming; viewangle = localaiming[0];
else if (splitscreen && player == &players[secondarydisplayplayer]) else if (splitscreen && player == &players[displayplayers[1]])
viewangle = localaiming2; viewangle = localaiming[1];
else if (splitscreen > 1 && player == &players[thirddisplayplayer]) else if (splitscreen > 1 && player == &players[displayplayers[2]])
viewangle = localaiming3; viewangle = localaiming[2];
else if (splitscreen > 2 && player == &players[fourthdisplayplayer]) else if (splitscreen > 2 && player == &players[displayplayers[3]])
viewangle = localaiming4; viewangle = localaiming[3];
// Handle stuff when you are looking farther up or down. // Handle stuff when you are looking farther up or down.
if ((aimingangle || cv_fov.value+player->fovadd > 90*FRACUNIT)) if ((aimingangle || cv_fov.value+player->fovadd > 90*FRACUNIT))
{ {
dup_viewangle += ANGLE_90; dup_viewangle += ANGLE_90;
HWR_ClearClipSegs(); HWR_ClearClipSegs();
HWR_RenderBSPNode((INT32)numnodes-1, ssplayer); //left HWR_RenderBSPNode((INT32)numnodes-1); //left
dup_viewangle += ANGLE_90; dup_viewangle += ANGLE_90;
if (((INT32)aimingangle > ANGLE_45 || (INT32)aimingangle<-ANGLE_45)) if (((INT32)aimingangle > ANGLE_45 || (INT32)aimingangle<-ANGLE_45))
{ {
HWR_ClearClipSegs(); HWR_ClearClipSegs();
HWR_RenderBSPNode((INT32)numnodes-1, ssplayer); //back HWR_RenderBSPNode((INT32)numnodes-1); //back
} }
dup_viewangle += ANGLE_90; dup_viewangle += ANGLE_90;
HWR_ClearClipSegs(); HWR_ClearClipSegs();
HWR_RenderBSPNode((INT32)numnodes-1, ssplayer); //right HWR_RenderBSPNode((INT32)numnodes-1); //right
dup_viewangle += ANGLE_90; dup_viewangle += ANGLE_90;
} }
@ -6807,16 +6757,17 @@ INT32 HWR_GetTextureUsed(void)
void HWR_DoPostProcessor(player_t *player) void HWR_DoPostProcessor(player_t *player)
{ {
postimg_t *type; postimg_t *type = &postimgtype[0];
UINT8 i;
if (splitscreen > 2 && player == &players[fourthdisplayplayer]) for (i = splitscreen; i > 0; i--)
type = &postimgtype4; {
else if (splitscreen > 1 && player == &players[thirddisplayplayer]) if (player == &players[displayplayers[i]])
type = &postimgtype3; {
else if (splitscreen && player == &players[secondarydisplayplayer]) type = &postimgtype[i];
type = &postimgtype2; break;
else }
type = &postimgtype; }
// Armageddon Blast Flash! // Armageddon Blast Flash!
// Could this even be considered postprocessor? // Could this even be considered postprocessor?

View file

@ -8224,7 +8224,7 @@ static void K_drawBattleFullscreen(void)
// check to see if there's anyone else at all // check to see if there's anyone else at all
for (i = 0; i < MAXPLAYERS; i++) for (i = 0; i < MAXPLAYERS; i++)
{ {
if (i == displayplayer) if (i == displayplayers[0])
continue; continue;
if (playeringame[i] && !stplyr->spectator) if (playeringame[i] && !stplyr->spectator)
return; return;

View file

@ -22,6 +22,7 @@
#include "p_tick.h" #include "p_tick.h"
#include "r_defs.h" #include "r_defs.h"
#include "p_maputl.h" #include "p_maputl.h"
#include "doomstat.h" // MAXSPLITSCREENPLAYERS
#define FLOATSPEED (FRACUNIT*4) #define FLOATSPEED (FRACUNIT*4)
@ -137,6 +138,7 @@ boolean P_PlayerInPain(player_t *player);
void P_DoPlayerPain(player_t *player, mobj_t *source, mobj_t *inflictor); void P_DoPlayerPain(player_t *player, mobj_t *source, mobj_t *inflictor);
void P_ResetPlayer(player_t *player); void P_ResetPlayer(player_t *player);
boolean P_IsLocalPlayer(player_t *player); boolean P_IsLocalPlayer(player_t *player);
boolean P_IsDisplayPlayer(player_t *player);
boolean P_SpectatorJoinGame(player_t *player); boolean P_SpectatorJoinGame(player_t *player);
boolean P_IsObjectInGoop(mobj_t *mo); boolean P_IsObjectInGoop(mobj_t *mo);

View file

@ -1135,6 +1135,8 @@ static void P_PlayerFlip(mobj_t *mo)
} }
else if (mo->player->pflags & PF_FLIPCAM) else if (mo->player->pflags & PF_FLIPCAM)
{ {
UINT8 i;
mo->player->aiming = InvAngle(mo->player->aiming); mo->player->aiming = InvAngle(mo->player->aiming);
for (i = 0; i <= splitscreen; i++) for (i = 0; i <= splitscreen; i++)

View file

@ -2381,6 +2381,8 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec)
if (mo->player) if (mo->player)
{ {
UINT8 i;
if (bot) // This might put poor Tails in a wall if he's too far behind! D: But okay, whatever! >:3 if (bot) // This might put poor Tails in a wall if he's too far behind! D: But okay, whatever! >:3
P_TeleportMove(bot, bot->x + x, bot->y + y, bot->z + z); P_TeleportMove(bot, bot->x + x, bot->y + y, bot->z + z);

View file

@ -7944,13 +7944,13 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall
else else
focusangle = mo->angle; focusangle = mo->angle;
if (thiscam == &camera) if (thiscam == &camera[0])
camrotate = cv_cam_rotate.value; camrotate = cv_cam_rotate.value;
else if (thiscam == &camera2) else if (thiscam == &camera[1])
camrotate = cv_cam2_rotate.value; camrotate = cv_cam2_rotate.value;
else if (thiscam == &camera3) else if (thiscam == &camera[2])
camrotate = cv_cam3_rotate.value; camrotate = cv_cam3_rotate.value;
else if (thiscam == &camera4) else if (thiscam == &camera[3])
camrotate = cv_cam4_rotate.value; camrotate = cv_cam4_rotate.value;
else else
camrotate = 0; camrotate = 0;
@ -8542,7 +8542,7 @@ boolean P_SpectatorJoinGame(player_t *player)
static void P_CalcPostImg(player_t *player) static void P_CalcPostImg(player_t *player)
{ {
sector_t *sector = player->mo->subsector->sector; sector_t *sector = player->mo->subsector->sector;
postimg_t *type; postimg_t *type = postimg_none;
INT32 *param; INT32 *param;
fixed_t pviewheight; fixed_t pviewheight;
UINT8 i; UINT8 i;

View file

@ -30,6 +30,7 @@
#include "p_spec.h" // skyboxmo #include "p_spec.h" // skyboxmo
#include "z_zone.h" #include "z_zone.h"
#include "m_random.h" // quake camera shake #include "m_random.h" // quake camera shake
#include "doomstat.h" // MAXSPLITSCREENPLAYERS
#ifdef HWRENDER #ifdef HWRENDER
#include "hardware/hw_main.h" #include "hardware/hw_main.h"
@ -65,7 +66,7 @@ size_t loopcount;
fixed_t viewx, viewy, viewz; fixed_t viewx, viewy, viewz;
angle_t viewangle, aimingangle; angle_t viewangle, aimingangle;
UINT8 viewnumber; UINT8 viewssnum;
fixed_t viewcos, viewsin; fixed_t viewcos, viewsin;
boolean viewsky, skyVisible; boolean viewsky, skyVisible;
boolean skyVisiblePerPlayer[MAXSPLITSCREENPLAYERS]; // saved values of skyVisible for each splitscreen player boolean skyVisiblePerPlayer[MAXSPLITSCREENPLAYERS]; // saved values of skyVisible for each splitscreen player
@ -1151,6 +1152,7 @@ void R_SetupFrame(player_t *player, boolean skybox)
} }
else if (splitscreen) else if (splitscreen)
{ {
UINT8 i;
for (i = 1; i <= splitscreen; i++) for (i = 1; i <= splitscreen; i++)
{ {
if (player == &players[displayplayers[i]]) if (player == &players[displayplayers[i]])
@ -1323,20 +1325,6 @@ void R_RenderPlayerView(player_t *player)
const boolean skybox = (skyboxmo[0] && cv_skybox.value); const boolean skybox = (skyboxmo[0] && cv_skybox.value);
UINT8 i; UINT8 i;
viewnumber = 0; // default
if (splitscreen)
{
for (i = 1; i <= splitscreen; i++)
{
if (player == &players[i])
{
viewnumber = i;
break;
}
}
}
// if this is display player 1 // if this is display player 1
if (cv_homremoval.value && player == &players[displayplayers[0]]) if (cv_homremoval.value && player == &players[displayplayers[0]])
{ {
@ -1367,7 +1355,7 @@ void R_RenderPlayerView(player_t *player)
// load previous saved value of skyVisible for the player // load previous saved value of skyVisible for the player
for (i = 0; i <= splitscreen; i++) for (i = 0; i <= splitscreen; i++)
{ {
if (player == &players[displayplayers[i]] if (player == &players[displayplayers[i]])
{ {
skyVisible = skyVisiblePerPlayer[i]; skyVisible = skyVisiblePerPlayer[i];
break; break;

View file

@ -17,6 +17,7 @@
// Need data structure definitions. // Need data structure definitions.
#include "d_player.h" #include "d_player.h"
#include "r_data.h" #include "r_data.h"
#include "doomstat.h" // MAXSPLITSCREENPLAYERS
#ifdef __GNUG__ #ifdef __GNUG__
#pragma interface #pragma interface
@ -88,7 +89,7 @@ extern side_t *sides;
// //
extern fixed_t viewx, viewy, viewz; extern fixed_t viewx, viewy, viewz;
extern angle_t viewangle, aimingangle; extern angle_t viewangle, aimingangle;
extern UINT8 viewnumber; // splitscreen view number extern UINT8 viewssnum; // splitscreen view number
extern boolean viewsky, skyVisible; extern boolean viewsky, skyVisible;
extern boolean skyVisiblePerPlayer[MAXSPLITSCREENPLAYERS]; // saved values of skyVisible of each splitscreen player extern boolean skyVisiblePerPlayer[MAXSPLITSCREENPLAYERS]; // saved values of skyVisible of each splitscreen player
extern sector_t *viewsector; extern sector_t *viewsector;

View file

@ -1748,19 +1748,19 @@ void R_AddSprites(sector_t *sec, INT32 lightlevel)
if (splitscreen) if (splitscreen)
{ {
if (thing->eflags & MFE_DRAWONLYFORP1) if (thing->eflags & MFE_DRAWONLYFORP1)
if (viewnumber != 0) if (viewssnum != 0)
continue; continue;
if (thing->eflags & MFE_DRAWONLYFORP2) if (thing->eflags & MFE_DRAWONLYFORP2)
if (viewnumber != 1) if (viewssnum != 1)
continue; continue;
if (thing->eflags & MFE_DRAWONLYFORP3 && splitscreen > 1) if (thing->eflags & MFE_DRAWONLYFORP3 && splitscreen > 1)
if (viewnumber != 2) if (viewssnum != 2)
continue; continue;
if (thing->eflags & MFE_DRAWONLYFORP4 && splitscreen > 2) if (thing->eflags & MFE_DRAWONLYFORP4 && splitscreen > 2)
if (viewnumber != 3) if (viewssnum != 3)
continue; continue;
} }
@ -1783,19 +1783,19 @@ void R_AddSprites(sector_t *sec, INT32 lightlevel)
if (splitscreen) if (splitscreen)
{ {
if (thing->eflags & MFE_DRAWONLYFORP1) if (thing->eflags & MFE_DRAWONLYFORP1)
if (viewnumber != 0) if (viewssnum != 0)
continue; continue;
if (thing->eflags & MFE_DRAWONLYFORP2) if (thing->eflags & MFE_DRAWONLYFORP2)
if (viewnumber != 1) if (viewssnum != 1)
continue; continue;
if (thing->eflags & MFE_DRAWONLYFORP3 && splitscreen > 1) if (thing->eflags & MFE_DRAWONLYFORP3 && splitscreen > 1)
if (viewnumber != 2) if (viewssnum != 2)
continue; continue;
if (thing->eflags & MFE_DRAWONLYFORP4 && splitscreen > 2) if (thing->eflags & MFE_DRAWONLYFORP4 && splitscreen > 2)
if (viewnumber != 3) if (viewssnum != 3)
continue; continue;
} }

View file

@ -935,8 +935,8 @@ void S_UpdateSounds(void)
if (dedicated || sound_disabled) if (dedicated || sound_disabled)
return; return;
if (players[displayplayer].awayviewtics) if (players[displayplayers[0]].awayviewtics)
listenmobj = players[displayplayer].awayviewmobj; listenmobj = players[displayplayers[0]].awayviewmobj;
if (splitscreen) if (splitscreen)
{ {