mirror of
https://git.do.srb2.org/KartKrew/Kart-Public.git
synced 2025-01-30 04:50:55 +00:00
Add field-of-view support in software mode
This commit is contained in:
parent
d6b9a75230
commit
4143c31176
2 changed files with 12 additions and 20 deletions
15
src/p_user.c
15
src/p_user.c
|
@ -8295,9 +8295,6 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall
|
||||||
if (mo->eflags & MFE_VERTICALFLIP)
|
if (mo->eflags & MFE_VERTICALFLIP)
|
||||||
camheight += thiscam->height;
|
camheight += thiscam->height;
|
||||||
|
|
||||||
if (splitscreen == 1)
|
|
||||||
camspeed = (3*camspeed)/4;
|
|
||||||
|
|
||||||
if (camspeed > FRACUNIT)
|
if (camspeed > FRACUNIT)
|
||||||
camspeed = FRACUNIT;
|
camspeed = FRACUNIT;
|
||||||
|
|
||||||
|
@ -8351,13 +8348,6 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall
|
||||||
height -= FixedMul(height, player->kartstuff[k_boostcam]);
|
height -= FixedMul(height, player->kartstuff[k_boostcam]);
|
||||||
}
|
}
|
||||||
|
|
||||||
// in splitscreen modes, mess with the camera distances to make it feel proportional to how it feels normally
|
|
||||||
if (splitscreen == 1) // widescreen splits should get x1.5 distance
|
|
||||||
{
|
|
||||||
dist = FixedMul(dist, 3*FRACUNIT/2);
|
|
||||||
height = FixedMul(height, 3*FRACUNIT/2);
|
|
||||||
}
|
|
||||||
|
|
||||||
x = mo->x - FixedMul(FINECOSINE((angle>>ANGLETOFINESHIFT) & FINEMASK), dist);
|
x = mo->x - FixedMul(FINECOSINE((angle>>ANGLETOFINESHIFT) & FINEMASK), dist);
|
||||||
y = mo->y - FixedMul(FINESINE((angle>>ANGLETOFINESHIFT) & FINEMASK), dist);
|
y = mo->y - FixedMul(FINESINE((angle>>ANGLETOFINESHIFT) & FINEMASK), dist);
|
||||||
|
|
||||||
|
@ -8623,10 +8613,7 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall
|
||||||
{
|
{
|
||||||
thiscam->momx = x - thiscam->x;
|
thiscam->momx = x - thiscam->x;
|
||||||
thiscam->momy = y - thiscam->y;
|
thiscam->momy = y - thiscam->y;
|
||||||
if (splitscreen == 1) // Wide-screen needs to follow faster, due to a smaller vertical:horizontal ratio of screen space
|
thiscam->momz = FixedMul(z - thiscam->z, camspeed/2);
|
||||||
thiscam->momz = FixedMul(z - thiscam->z, (3*camspeed)/4);
|
|
||||||
else
|
|
||||||
thiscam->momz = FixedMul(z - thiscam->z, camspeed/2);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
thiscam->pan = pan;
|
thiscam->pan = pan;
|
||||||
|
|
17
src/r_main.c
17
src/r_main.c
|
@ -56,6 +56,7 @@ INT32 centerx, centery;
|
||||||
fixed_t centerxfrac, centeryfrac;
|
fixed_t centerxfrac, centeryfrac;
|
||||||
fixed_t projection;
|
fixed_t projection;
|
||||||
fixed_t projectiony; // aspect ratio
|
fixed_t projectiony; // aspect ratio
|
||||||
|
fixed_t fovtan; // field of view
|
||||||
|
|
||||||
// just for profiling purposes
|
// just for profiling purposes
|
||||||
size_t framecount;
|
size_t framecount;
|
||||||
|
@ -529,7 +530,7 @@ static void R_InitTextureMapping(void)
|
||||||
//
|
//
|
||||||
// Calc focallength
|
// Calc focallength
|
||||||
// so FIELDOFVIEW angles covers SCREENWIDTH.
|
// so FIELDOFVIEW angles covers SCREENWIDTH.
|
||||||
focallength = FixedDiv(centerxfrac,
|
focallength = FixedDiv(projection,
|
||||||
FINETANGENT(FINEANGLES/4+/*cv_fov.value*/ FIELDOFVIEW/2));
|
FINETANGENT(FINEANGLES/4+/*cv_fov.value*/ FIELDOFVIEW/2));
|
||||||
|
|
||||||
#ifdef ESLOPE
|
#ifdef ESLOPE
|
||||||
|
@ -644,6 +645,7 @@ void R_ExecuteSetViewSize(void)
|
||||||
INT32 j;
|
INT32 j;
|
||||||
INT32 level;
|
INT32 level;
|
||||||
INT32 startmapl;
|
INT32 startmapl;
|
||||||
|
angle_t fov;
|
||||||
|
|
||||||
setsizeneeded = false;
|
setsizeneeded = false;
|
||||||
|
|
||||||
|
@ -672,9 +674,12 @@ void R_ExecuteSetViewSize(void)
|
||||||
centerxfrac = centerx<<FRACBITS;
|
centerxfrac = centerx<<FRACBITS;
|
||||||
centeryfrac = centery<<FRACBITS;
|
centeryfrac = centery<<FRACBITS;
|
||||||
|
|
||||||
projection = centerxfrac;
|
fov = FixedAngle(cv_fov.value/2) + ANGLE_90;
|
||||||
//projectiony = (((vid.height*centerx*BASEVIDWIDTH)/BASEVIDHEIGHT)/vid.width)<<FRACBITS;
|
fovtan = FINETANGENT(fov >> ANGLETOFINESHIFT);
|
||||||
projectiony = centerxfrac;
|
if (splitscreen == 1) // Splitscreen FOV should be adjusted to maintain expected vertical view
|
||||||
|
fovtan *= 2;
|
||||||
|
|
||||||
|
projection = projectiony = FixedDiv(centerxfrac, fovtan);
|
||||||
|
|
||||||
R_InitViewBuffer(scaledviewwidth, viewheight);
|
R_InitViewBuffer(scaledviewwidth, viewheight);
|
||||||
|
|
||||||
|
@ -700,7 +705,7 @@ void R_ExecuteSetViewSize(void)
|
||||||
for (i = 0; i < j; i++)
|
for (i = 0; i < j; i++)
|
||||||
{
|
{
|
||||||
dy = ((i - viewheight*8)<<FRACBITS) + FRACUNIT/2;
|
dy = ((i - viewheight*8)<<FRACBITS) + FRACUNIT/2;
|
||||||
dy = abs(dy);
|
dy = FixedMul(abs(dy), fovtan);
|
||||||
yslopetab[i] = FixedDiv(centerx*FRACUNIT, dy);
|
yslopetab[i] = FixedDiv(centerx*FRACUNIT, dy);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -815,7 +820,7 @@ subsector_t *R_IsPointInSubsector(fixed_t x, fixed_t y)
|
||||||
static mobj_t *viewmobj;
|
static mobj_t *viewmobj;
|
||||||
|
|
||||||
// WARNING: a should be unsigned but to add with 2048, it isn't!
|
// WARNING: a should be unsigned but to add with 2048, it isn't!
|
||||||
#define AIMINGTODY(a) ((FINETANGENT((2048+(((INT32)a)>>ANGLETOFINESHIFT)) & FINEMASK)*160)>>FRACBITS)
|
#define AIMINGTODY(a) FixedDiv((FINETANGENT((2048+(((INT32)a)>>ANGLETOFINESHIFT)) & FINEMASK)*160)>>FRACBITS, fovtan)
|
||||||
|
|
||||||
// recalc necessary stuff for mouseaiming
|
// recalc necessary stuff for mouseaiming
|
||||||
// slopes are already calculated for the full possible view (which is 4*viewheight).
|
// slopes are already calculated for the full possible view (which is 4*viewheight).
|
||||||
|
|
Loading…
Reference in a new issue