add "third person only" option to gr_shearing.

This commit is contained in:
Jaime Passos 2020-02-08 17:42:26 -03:00
parent 90eb6a6011
commit 11e6cf0ade
3 changed files with 39 additions and 10 deletions

View File

@ -144,7 +144,7 @@ static float gr_viewludsin, gr_viewludcos; // look up down kik test
static float gr_fovlud;
static angle_t gr_aimingangle;
static void HWR_SetTransformAiming(FTransform *trans);
static void HWR_SetTransformAiming(FTransform *trans, player_t *player, boolean skybox);
// ==========================================================================
// Lighting
@ -5425,7 +5425,7 @@ static void HWR_DrawSkyBackground(player_t *player)
//04/01/2000: Hurdler: added for T&L
// It should replace all other gr_viewxxx when finished
HWR_SetTransformAiming(&dometransform);
HWR_SetTransformAiming(&dometransform, player, false);
dometransform.angley = (float)((viewangle-ANGLE_270)>>ANGLETOFINESHIFT)*(360.0f/(float)FINEANGLES);
if (*type == postimg_flip)
@ -5590,9 +5590,11 @@ void HWR_SetViewSize(void)
// Set view aiming, for the sky dome, the skybox,
// and the normal view, all with a single function.
static void HWR_SetTransformAiming(FTransform *trans)
static void HWR_SetTransformAiming(FTransform *trans, player_t *player, boolean skybox)
{
if (cv_grshearing.value)
// 1 = always on
// 2 = chasecam only
if (cv_grshearing.value == 1 || (cv_grshearing.value == 2 && R_IsViewpointFirstPerson(player, skybox)))
{
fixed_t fixedaiming = AIMINGTODY(aimingangle);
trans->viewaiming = FIXED_TO_FLOAT(fixedaiming);
@ -5604,6 +5606,7 @@ static void HWR_SetTransformAiming(FTransform *trans)
trans->shearing = false;
gr_aimingangle = aimingangle;
}
trans->anglex = (float)(gr_aimingangle>>ANGLETOFINESHIFT)*(360.0f/(float)FINEANGLES);
}
@ -5663,7 +5666,7 @@ void HWR_RenderSkyboxView(INT32 viewnumber, player_t *player)
// It should replace all other gr_viewxxx when finished
memset(&atransform, 0x00, sizeof(FTransform));
HWR_SetTransformAiming(&atransform);
HWR_SetTransformAiming(&atransform, player, true);
atransform.angley = (float)(viewangle>>ANGLETOFINESHIFT)*(360.0f/(float)FINEANGLES);
gr_viewludsin = FIXED_TO_FLOAT(FINECOSINE(gr_aimingangle>>ANGLETOFINESHIFT));
@ -5864,7 +5867,7 @@ void HWR_RenderPlayerView(INT32 viewnumber, player_t *player)
// It should replace all other gr_viewxxx when finished
memset(&atransform, 0x00, sizeof(FTransform));
HWR_SetTransformAiming(&atransform);
HWR_SetTransformAiming(&atransform, player, false);
atransform.angley = (float)(viewangle>>ANGLETOFINESHIFT)*(360.0f/(float)FINEANGLES);
gr_viewludsin = FIXED_TO_FLOAT(FINECOSINE(gr_aimingangle>>ANGLETOFINESHIFT));
@ -5998,6 +6001,7 @@ void HWR_RenderPlayerView(INT32 viewnumber, player_t *player)
static CV_PossibleValue_t grmodelinterpolation_cons_t[] = {{0, "Off"}, {1, "Sometimes"}, {2, "Always"}, {0, NULL}};
static CV_PossibleValue_t grfakecontrast_cons_t[] = {{0, "Off"}, {1, "On"}, {2, "Smooth"}, {0, NULL}};
static CV_PossibleValue_t grshearing_cons_t[] = {{0, "Off"}, {1, "On"}, {2, "Third-person"}, {0, NULL}};
static void CV_grfiltermode_OnChange(void);
static void CV_granisotropic_OnChange(void);
@ -6024,7 +6028,7 @@ consvar_t cv_grmodels = {"gr_models", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, N
consvar_t cv_grmodelinterpolation = {"gr_modelinterpolation", "Sometimes", CV_SAVE, grmodelinterpolation_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_grmodellighting = {"gr_modellighting", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_grshearing = {"gr_shearing", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_grshearing = {"gr_shearing", "Third-person", CV_SAVE, grshearing_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_grspritebillboarding = {"gr_spritebillboarding", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_grskydome = {"gr_skydome", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_grfakecontrast = {"gr_fakecontrast", "Smooth", CV_SAVE, grfakecontrast_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};

View File

@ -1011,6 +1011,30 @@ void R_SkyboxFrame(player_t *player)
R_SetupFreelook();
}
boolean R_IsViewpointFirstPerson(player_t *player, boolean skybox)
{
boolean chasecam = false;
if (splitscreen && player == &players[secondarydisplayplayer] && player != &players[consoleplayer])
chasecam = (cv_chasecam2.value != 0);
else
chasecam = (cv_chasecam.value != 0);
if (player->climbing || (player->powers[pw_carry] == CR_NIGHTSMODE) || player->playerstate == PST_DEAD || gamestate == GS_TITLESCREEN || tutorialmode)
chasecam = true; // force chasecam on
else if (player->spectator) // no spectator chasecam
chasecam = false; // force chasecam off
// cut-away view stuff
if (player->awayviewtics || skybox)
return chasecam;
// use outside cam view
else if (!player->spectator && chasecam)
return true;
// use the player's eyes view
return false;
}
static void R_PortalFrame(portal_t *portal)
{
viewx = portal->viewx;

View File

@ -102,10 +102,11 @@ void R_SetViewSize(void);
// do it (sometimes explicitly called)
void R_ExecuteSetViewSize(void);
void R_SkyboxFrame(player_t *player);
void R_SetupFrame(player_t *player);
// Called by G_Drawer.
void R_SkyboxFrame(player_t *player);
boolean R_IsViewpointFirstPerson(player_t *player, boolean skybox);
// Called by D_Display.
void R_RenderPlayerView(player_t *player);
// add commands related to engine, at game startup