make direct aiming slope range symmetrical, so it matches autoaim slope range (#1117)

This commit is contained in:
Fabian Greffrath 2023-06-26 06:22:31 +02:00 committed by GitHub
parent b131d5ff12
commit c86904de68
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 9 deletions

View File

@ -232,7 +232,7 @@ void P_MovePlayer (player_t* player)
if (!menuactive && !demoplayback)
{
player->lookdir = BETWEEN(-LOOKDIRMIN * MLOOKUNIT,
player->lookdir = BETWEEN(-LOOKDIRMAX * MLOOKUNIT,
LOOKDIRMAX * MLOOKUNIT,
player->lookdir + cmd->lookdir);
}

View File

@ -24,9 +24,8 @@
#include "r_defs.h"
#include "r_state.h"
#define LOOKDIRMIN 110 // [crispy] -110, actually
#define LOOKDIRMAX 90
#define LOOKDIRS (LOOKDIRMIN+1+LOOKDIRMAX) // [crispy] lookdir range: -110..0..90
#define LOOKDIRMAX 100
#define LOOKDIRS (2*LOOKDIRMAX+1) // [crispy] lookdir range: -100..100
#define MLOOKUNIT 8
// Retrieve column data for span blitting.

View File

@ -502,11 +502,11 @@ void R_ExecuteSetViewSize (void)
for (j = 0; j < LOOKDIRS; j++)
{
// [crispy] re-generate lookup-table for yslope[] whenever "viewheight" or "hires" change
fixed_t dy = abs(((i-viewheight/2-(j-LOOKDIRMIN)*viewblocks/10)<<FRACBITS)+FRACUNIT/2);
fixed_t dy = abs(((i-viewheight/2-(j-LOOKDIRMAX)*viewblocks/10)<<FRACBITS)+FRACUNIT/2);
yslopes[j][i] = FixedDiv(viewwidth_nonwide*(FRACUNIT/2), dy);
}
}
yslope = yslopes[LOOKDIRMIN];
yslope = yslopes[LOOKDIRMAX];
for (i=0 ; i<viewwidth ; i++)
{
@ -652,8 +652,8 @@ void R_SetupFrame (player_t *player)
if (pitch > LOOKDIRMAX)
pitch = LOOKDIRMAX;
else if (pitch < -LOOKDIRMIN)
pitch = -LOOKDIRMIN;
else if (pitch < -LOOKDIRMAX)
pitch = -LOOKDIRMAX;
// apply new yslope[] whenever "lookdir", "viewheight" or "hires" change
tempCentery = viewheight/2 + pitch * viewblocks / 10;
@ -661,7 +661,7 @@ void R_SetupFrame (player_t *player)
{
centery = tempCentery;
centeryfrac = centery << FRACBITS;
yslope = yslopes[LOOKDIRMIN + pitch];
yslope = yslopes[LOOKDIRMAX + pitch];
}
viewsin = finesine[viewangle>>ANGLETOFINESHIFT];