From 50a2dc7b4d332afde8161712e943cad0e5eceb87 Mon Sep 17 00:00:00 2001 From: Wolfy Date: Sun, 17 Dec 2017 00:09:32 -0600 Subject: [PATCH 1/2] player views 4p still crashes for some reason --- src/d_main.c | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++- src/r_draw.c | 10 ++++++++++ src/r_draw.h | 2 ++ src/r_main.c | 4 ++-- 4 files changed, 66 insertions(+), 3 deletions(-) diff --git a/src/d_main.c b/src/d_main.c index 367bd0129..5173f0b74 100644 --- a/src/d_main.c +++ b/src/d_main.c @@ -401,7 +401,7 @@ static void D_Display(void) } // render the second screen - if (splitscreen && players[secondarydisplayplayer].mo) + if ((splitscreen || splitscreen3 || splitscreen4) && players[secondarydisplayplayer].mo) { #ifdef HWRENDER if (rendermode != render_soft) @@ -410,6 +410,9 @@ static void D_Display(void) #endif if (rendermode != render_none) { + if (splitscreen3 || splitscreen4) + viewwindowx = vid.width / 2; + viewwindowy = vid.height / 2; M_Memcpy(ylookup, ylookup2, viewheight*sizeof (ylookup[0])); @@ -422,11 +425,59 @@ static void D_Display(void) } } + if ((splitscreen3 || splitscreen4) && players[thirddisplayplayer].mo) + { +#ifdef HWRENDER + if (rendermode != render_soft) + HWR_RenderPlayerView(2, &players[thirddisplayplayer]); + else +#endif + if (rendermode != render_none) + { + viewwindowx = vid.width / 2; + viewwindowy = vid.height / 2; + M_Memcpy(ylookup2, ylookup3, viewheight*sizeof (ylookup[0])); + + topleft = screens[0] + viewwindowy*vid.width + viewwindowx; + + R_RenderPlayerView(&players[thirddisplayplayer]); + + viewwindowy = 0; + M_Memcpy(ylookup, ylookup1, viewheight*sizeof (ylookup[0])); + } + } + + if (splitscreen4 && players[fourthdisplayplayer].mo) + { +#ifdef HWRENDER + if (rendermode != render_soft) + HWR_RenderPlayerView(3, &players[fourthdisplayplayer]); + else +#endif + if (rendermode != render_none) + { + viewwindowx = vid.width / 2; + viewwindowy = vid.height / 2; + M_Memcpy(ylookup3, ylookup4, viewheight*sizeof (ylookup[0])); + + topleft = screens[0] + viewwindowy*vid.width + viewwindowx; + + R_RenderPlayerView(&players[fourthdisplayplayer]); + + viewwindowy = 0; + M_Memcpy(ylookup, ylookup1, viewheight*sizeof (ylookup[0])); + } + } + // Image postprocessing effect if (postimgtype) V_DoPostProcessor(0, postimgtype, postimgparam); if (postimgtype2) V_DoPostProcessor(1, postimgtype2, postimgparam2); + if (postimgtype3) + V_DoPostProcessor(2, postimgtype3, postimgparam3); + if (postimgtype4) + V_DoPostProcessor(3, postimgtype4, postimgparam4); } if (lastdraw) diff --git a/src/r_draw.c b/src/r_draw.c index ac7d263dc..7ec919288 100644 --- a/src/r_draw.c +++ b/src/r_draw.c @@ -51,6 +51,14 @@ UINT8 *ylookup1[MAXVIDHEIGHT*4]; */ UINT8 *ylookup2[MAXVIDHEIGHT*4]; +/** \brief pointer to the start of each line of the screen, for view3 (splitscreen) +*/ +UINT8 *ylookup3[MAXVIDHEIGHT*4]; + +/** \brief pointer to the start of each line of the screen, for view4 (splitscreen) +*/ +UINT8 *ylookup4[MAXVIDHEIGHT*4]; + /** \brief x byte offset for columns inside the viewwindow, so the first column starts at (SCRWIDTH - VIEWWIDTH)/2 */ @@ -632,6 +640,8 @@ void R_InitViewBuffer(INT32 width, INT32 height) { ylookup[i] = ylookup1[i] = screens[0] + (i+viewwindowy)*vid.width*bytesperpixel; ylookup2[i] = screens[0] + (i+(vid.height>>1))*vid.width*bytesperpixel; // for splitscreen + ylookup3[i] = screens[0] + (i+(vid.height>>1))*vid.width*bytesperpixel; + ylookup3[i] = screens[0] + (i+(vid.height>>1))*vid.width*bytesperpixel; } } diff --git a/src/r_draw.h b/src/r_draw.h index 419586c65..ae70cd8a3 100644 --- a/src/r_draw.h +++ b/src/r_draw.h @@ -22,6 +22,8 @@ extern UINT8 *ylookup[MAXVIDHEIGHT*4]; extern UINT8 *ylookup1[MAXVIDHEIGHT*4]; extern UINT8 *ylookup2[MAXVIDHEIGHT*4]; +extern UINT8 *ylookup3[MAXVIDHEIGHT*4]; +extern UINT8 *ylookup4[MAXVIDHEIGHT*4]; extern INT32 columnofs[MAXVIDWIDTH*4]; extern UINT8 *topleft; diff --git a/src/r_main.c b/src/r_main.c index 66869145f..b494f86b9 100644 --- a/src/r_main.c +++ b/src/r_main.c @@ -660,11 +660,11 @@ void R_ExecuteSetViewSize(void) if (splitscreen || splitscreen3 || splitscreen4) viewheight >>= 1; + viewwidth = scaledviewwidth; + if (splitscreen3 || splitscreen4) viewwidth >>= 1; - viewwidth = scaledviewwidth; - centerx = viewwidth/2; centery = viewheight/2; centerxfrac = centerx< Date: Sun, 17 Dec 2017 20:23:11 -0600 Subject: [PATCH 2/2] more stuff nothing too special here --- src/d_netcmd.c | 16 ++++++++++++++++ src/g_game.c | 4 ++-- src/p_user.c | 28 ++++++++++++++++++++++++++-- src/r_main.c | 2 ++ 4 files changed, 46 insertions(+), 4 deletions(-) diff --git a/src/d_netcmd.c b/src/d_netcmd.c index 6a454f46f..df48a37f0 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -772,16 +772,28 @@ void D_RegisterClientCommands(void) // g_input.c CV_RegisterVar(&cv_sideaxis); CV_RegisterVar(&cv_sideaxis2); + CV_RegisterVar(&cv_sideaxis3); + CV_RegisterVar(&cv_sideaxis4); CV_RegisterVar(&cv_turnaxis); CV_RegisterVar(&cv_turnaxis2); + CV_RegisterVar(&cv_turnaxis3); + CV_RegisterVar(&cv_turnaxis4); CV_RegisterVar(&cv_moveaxis); CV_RegisterVar(&cv_moveaxis2); + CV_RegisterVar(&cv_moveaxis3); + CV_RegisterVar(&cv_moveaxis4); CV_RegisterVar(&cv_lookaxis); CV_RegisterVar(&cv_lookaxis2); + CV_RegisterVar(&cv_lookaxis3); + CV_RegisterVar(&cv_lookaxis4); CV_RegisterVar(&cv_fireaxis); CV_RegisterVar(&cv_fireaxis2); + CV_RegisterVar(&cv_fireaxis3); + CV_RegisterVar(&cv_fireaxis4); CV_RegisterVar(&cv_firenaxis); CV_RegisterVar(&cv_firenaxis2); + CV_RegisterVar(&cv_firenaxis3); + CV_RegisterVar(&cv_firenaxis4); // WARNING: the order is important when initialising mouse2 // we need the mouse2port @@ -818,8 +830,12 @@ void D_RegisterClientCommands(void) // Analog Control CV_RegisterVar(&cv_analog); CV_RegisterVar(&cv_analog2); + CV_RegisterVar(&cv_analog3); + CV_RegisterVar(&cv_analog4); CV_RegisterVar(&cv_useranalog); CV_RegisterVar(&cv_useranalog2); + CV_RegisterVar(&cv_useranalog3); + CV_RegisterVar(&cv_useranalog4); // s_sound.c CV_RegisterVar(&cv_soundvolume); diff --git a/src/g_game.c b/src/g_game.c index 65f801095..d700f7804 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -1200,8 +1200,8 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer) { player = &players[fourthdisplayplayer]; thiscam = &camera4; - lang = localangle3; - laim = localaiming3; + lang = localangle4; + laim = localaiming4; th = turnheld4; kbl = keyboard_look4; G_CopyTiccmd(cmd, I_BaseTiccmd4(), 1); diff --git a/src/p_user.c b/src/p_user.c index 67a893604..a3253482e 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -8354,7 +8354,7 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall camdist = FixedMul(cv_cam_dist.value, mo->scale); camheight = FixedMul(cv_cam_height.value, mo->scale); } - else // Camera 2 + else if (thiscam == &camera2) // Camera 2 { camspeed = cv_cam2_speed.value; camstill = cv_cam2_still.value; @@ -8362,6 +8362,22 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall camdist = FixedMul(cv_cam2_dist.value, mo->scale); camheight = FixedMul(cv_cam2_height.value, mo->scale); } + else if (thiscam == &camera3) // Camera 3 + { + camspeed = cv_cam3_speed.value; + camstill = cv_cam3_still.value; + camrotate = cv_cam3_rotate.value; + camdist = FixedMul(cv_cam3_dist.value, mo->scale); + camheight = FixedMul(cv_cam3_height.value, mo->scale); + } + else // Camera 4 + { + camspeed = cv_cam4_speed.value; + camstill = cv_cam4_still.value; + camrotate = cv_cam4_rotate.value; + camdist = FixedMul(cv_cam4_dist.value, mo->scale); + camheight = FixedMul(cv_cam4_height.value, mo->scale); + } #ifdef REDSANALOG if (P_AnalogMove(player) && (player->cmd.buttons & (BT_FORWARD|BT_BACKWARD)) == (BT_FORWARD|BT_BACKWARD)) { @@ -8430,10 +8446,18 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall { CV_SetValue(&cv_cam_rotate, camrotate + 180); } - else + else if (thiscam == &camera2) { CV_SetValue(&cv_cam2_rotate, camrotate + 180); } + else if (thiscam == &camera3) + { + CV_SetValue(&cv_cam3_rotate, camrotate + 180); + } + else + { + CV_SetValue(&cv_cam3_rotate, camrotate + 180); + } player->kartstuff[k_camspin] = 2; } if (player->kartstuff[k_camspin] == -1) diff --git a/src/r_main.c b/src/r_main.c index 1c9e87447..b65bc7c71 100644 --- a/src/r_main.c +++ b/src/r_main.c @@ -1482,6 +1482,8 @@ void R_RegisterEngineStuff(void) CV_RegisterVar(&cv_homremoval); CV_RegisterVar(&cv_flipcam); CV_RegisterVar(&cv_flipcam2); + CV_RegisterVar(&cv_flipcam3); + CV_RegisterVar(&cv_flipcam4); // Enough for dedicated server if (dedicated)