mirror of
https://git.do.srb2.org/KartKrew/Kart-Public.git
synced 2024-11-16 09:42:33 +00:00
Better first person
turning and drifting is now taken into account in the x offsetting
This commit is contained in:
parent
e2a6d5ceb3
commit
13b16d4a8a
1 changed files with 27 additions and 18 deletions
45
src/k_kart.c
45
src/k_kart.c
|
@ -5481,8 +5481,9 @@ static void K_drawStartCountdown(void)
|
||||||
|
|
||||||
static void K_drawKartFirstPerson(void)
|
static void K_drawKartFirstPerson(void)
|
||||||
{
|
{
|
||||||
static INT32 pnum1 = 0, pnum2 = 0, pnum3 = 0, pnum4 = 0;
|
static INT32 pnum[4], turn[4], drift[4];
|
||||||
INT32 pn = 0, target = 0, splitflags = K_calcSplitFlags(V_SNAPTOBOTTOM);
|
INT32 pn = 0, tn = 0, dr = 0;
|
||||||
|
INT32 target = 0, splitflags = K_calcSplitFlags(V_SNAPTOBOTTOM);
|
||||||
INT32 x = BASEVIDWIDTH/2, y = BASEVIDHEIGHT;
|
INT32 x = BASEVIDWIDTH/2, y = BASEVIDHEIGHT;
|
||||||
fixed_t scale;
|
fixed_t scale;
|
||||||
UINT8 *colmap = NULL;
|
UINT8 *colmap = NULL;
|
||||||
|
@ -5492,13 +5493,13 @@ static void K_drawKartFirstPerson(void)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (stplyr == &players[secondarydisplayplayer] && splitscreen)
|
if (stplyr == &players[secondarydisplayplayer] && splitscreen)
|
||||||
pn = pnum2;
|
{ pn = pnum[1]; tn = turn[1]; dr = drift[1]; }
|
||||||
else if (stplyr == &players[thirddisplayplayer] && splitscreen > 1)
|
else if (stplyr == &players[thirddisplayplayer] && splitscreen > 1)
|
||||||
pn = pnum3;
|
{ pn = pnum[2]; tn = turn[2]; dr = drift[2]; }
|
||||||
else if (stplyr == &players[fourthdisplayplayer] && splitscreen > 2)
|
else if (stplyr == &players[fourthdisplayplayer] && splitscreen > 2)
|
||||||
pn = pnum4;
|
{ pn = pnum[3]; tn = turn[3]; dr = drift[3]; }
|
||||||
else
|
else
|
||||||
pn = pnum1;
|
{ pn = pnum[0]; tn = turn[0]; dr = drift[0]; }
|
||||||
|
|
||||||
if (splitscreen)
|
if (splitscreen)
|
||||||
{
|
{
|
||||||
|
@ -5543,6 +5544,12 @@ static void K_drawKartFirstPerson(void)
|
||||||
x <<= FRACBITS;
|
x <<= FRACBITS;
|
||||||
y <<= FRACBITS;
|
y <<= FRACBITS;
|
||||||
|
|
||||||
|
if (tn != cmd->driftturn/50)
|
||||||
|
tn -= (tn - (cmd->driftturn/50))/8;
|
||||||
|
|
||||||
|
if (dr != stplyr->kartstuff[k_drift]*16)
|
||||||
|
dr -= (dr - (stplyr->kartstuff[k_drift]*16))/8;
|
||||||
|
|
||||||
if (splitscreen == 1)
|
if (splitscreen == 1)
|
||||||
{
|
{
|
||||||
scale = (2*FRACUNIT)/3;
|
scale = (2*FRACUNIT)/3;
|
||||||
|
@ -5559,19 +5566,18 @@ static void K_drawKartFirstPerson(void)
|
||||||
fixed_t dstwo = dsone*2;
|
fixed_t dstwo = dsone*2;
|
||||||
|
|
||||||
#ifndef DONTLIKETOASTERSFPTWEAKS
|
#ifndef DONTLIKETOASTERSFPTWEAKS
|
||||||
if (stplyr->rmomx || stplyr->rmomy || stplyr->frameangle != stplyr->mo->angle) // an approximation of drifting!
|
|
||||||
{
|
{
|
||||||
const angle_t ang = ((stplyr->frameangle != stplyr->mo->angle)
|
const angle_t ang = R_PointToAngle2(0, 0, stplyr->rmomx, stplyr->rmomy) - stplyr->frameangle;
|
||||||
? stplyr->frameangle
|
// yes, the following is correct. no, you do not need to swap the x and y.
|
||||||
: R_PointToAngle2(0, 0, stplyr->rmomx, stplyr->rmomy))
|
fixed_t xoffs = -P_ReturnThrustY(stplyr->mo, ang, (BASEVIDWIDTH<<(FRACBITS-2))/2);
|
||||||
- stplyr->mo->angle;
|
fixed_t yoffs = -(P_ReturnThrustX(stplyr->mo, ang, 4*FRACUNIT) - 4*FRACUNIT);
|
||||||
// yes, the follwing is correct. no, you do not need to swap the x and y.
|
|
||||||
fixed_t xoffs = -P_ReturnThrustY(stplyr->mo, ang, BASEVIDWIDTH<<(FRACBITS-2));
|
|
||||||
fixed_t yoffs = (splitscreen ? 0 : -(P_ReturnThrustX(stplyr->mo, ang, 4*FRACUNIT) - 4*FRACUNIT));
|
|
||||||
|
|
||||||
if (splitscreen)
|
if (splitscreen)
|
||||||
xoffs = FixedMul(xoffs, scale);
|
xoffs = FixedMul(xoffs, scale);
|
||||||
|
|
||||||
|
xoffs -= (tn)*scale;
|
||||||
|
xoffs -= (dr)*scale;
|
||||||
|
|
||||||
if (stplyr->frameangle == stplyr->mo->angle)
|
if (stplyr->frameangle == stplyr->mo->angle)
|
||||||
{
|
{
|
||||||
const fixed_t mag = FixedDiv(stplyr->speed, 10*stplyr->mo->scale);
|
const fixed_t mag = FixedDiv(stplyr->speed, 10*stplyr->mo->scale);
|
||||||
|
@ -5584,6 +5590,9 @@ static void K_drawKartFirstPerson(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (stplyr->mo->momz > 0) // TO-DO: Draw more of the kart so we can remove this if!
|
||||||
|
yoffs += stplyr->mo->momz/3;
|
||||||
|
|
||||||
x += xoffs;
|
x += xoffs;
|
||||||
if (!splitscreen)
|
if (!splitscreen)
|
||||||
y += yoffs;
|
y += yoffs;
|
||||||
|
@ -5604,13 +5613,13 @@ static void K_drawKartFirstPerson(void)
|
||||||
V_DrawFixedPatch(x, y, scale, splitflags, kp_fpview[target], colmap);
|
V_DrawFixedPatch(x, y, scale, splitflags, kp_fpview[target], colmap);
|
||||||
|
|
||||||
if (stplyr == &players[secondarydisplayplayer] && splitscreen)
|
if (stplyr == &players[secondarydisplayplayer] && splitscreen)
|
||||||
pnum2 = pn;
|
{ pnum[1] = pn; turn[1] = tn; drift[1] = dr; }
|
||||||
else if (stplyr == &players[thirddisplayplayer] && splitscreen > 1)
|
else if (stplyr == &players[thirddisplayplayer] && splitscreen > 1)
|
||||||
pnum3 = pn;
|
{ pnum[2] = pn; turn[2] = tn; drift[2] = dr; }
|
||||||
else if (stplyr == &players[fourthdisplayplayer] && splitscreen > 2)
|
else if (stplyr == &players[fourthdisplayplayer] && splitscreen > 2)
|
||||||
pnum4 = pn;
|
{ pnum[3] = pn; turn[3] = tn; drift[3] = dr; }
|
||||||
else
|
else
|
||||||
pnum1 = pn;
|
{ pnum[0] = pn; turn[0] = tn; drift[0] = dr; }
|
||||||
}
|
}
|
||||||
|
|
||||||
// doesn't need to ever support 4p
|
// doesn't need to ever support 4p
|
||||||
|
|
Loading…
Reference in a new issue