- All Games: Allow for HUD interpolation to be disabled.

* Requested by users, really don't know why...
* Interpolation values are guarded by the CVAR.
* For Blood, integer truncation is employed just like original game.
* For all games where more precise sine/cosine math has been utilised, no changes have been made.
This commit is contained in:
Mitchell Richters 2021-04-15 13:35:42 +10:00
parent 92d1d7fbde
commit a4895cb270
12 changed files with 137 additions and 94 deletions

View file

@ -81,6 +81,7 @@ CVARD(Bool, cl_smoothsway, false, CVAR_ARCHIVE, "move SW weapon left and right s
CVARD(Bool, cl_showmagamt, false, CVAR_ARCHIVE, "show the amount of rounds left in the magazine of your weapon on the modern HUD")
CVARD(Bool, cl_nomeleeblur, false, CVAR_ARCHIVE, "enable/disable blur effect with melee weapons in SW")
CVARD(Bool, cl_exhumedoldturn, false, CVAR_ARCHIVE, "enable/disable legacy turning speed for Powerslave/Exhumed")
CVARD(Bool, cl_hudinterpolation, true, CVAR_ARCHIVE, "enable/disable HUD (weapon drawer) interpolation")
CUSTOM_CVARD(Int, cl_autoaim, 1, CVAR_ARCHIVE|CVAR_USERINFO, "enable/disable weapon autoaim")

View file

@ -26,6 +26,7 @@ EXTERN_CVAR(Bool, cl_smoothsway)
EXTERN_CVAR(Bool, cl_showmagamt)
EXTERN_CVAR(Bool, cl_nomeleeblur)
EXTERN_CVAR(Bool, cl_exhumedoldturn)
EXTERN_CVAR(Bool, cl_hudinterpolation)
EXTERN_CVAR(Bool, demorec_seeds_cvar)
EXTERN_CVAR(Bool, demoplay_diffs)

View file

@ -94,6 +94,11 @@ struct PlayerHorizon
return q16horiz(interpolatedvalue(osum().asq16(), sum().asq16(), smoothratio));
}
double horizsumfrac(bool const precise, double const smoothratio)
{
return !precise ? sum().asq16() >> 20 : (!SyncInput() ? sum() : interpolatedsum(smoothratio)).asbuildf() * (1. / 16.); // Used within draw code for Duke.
}
private:
fixedhoriz target;
double adjustment;
@ -221,9 +226,14 @@ struct PlayerAngle
return interpolatedangle(orotscrnang, rotscrnang, smoothratio);
}
double look_anghalf(double const smoothratio)
double look_anghalf(bool const precise, double const smoothratio)
{
return (!SyncInput() ? look_ang : interpolatedlookang(smoothratio)).signedbuildf() * 0.5; // Used within draw code for weapon and crosshair when looking left/right.
return !precise ? look_ang.signedbam() >> 22 : (!SyncInput() ? look_ang : interpolatedlookang(smoothratio)).signedbuildf() * 0.5; // Used within draw code for weapon and crosshair when looking left/right.
}
double looking_arc(bool const precise, double const smoothratio)
{
return !precise ? abs(look_ang.signedbuild()) / 9 : fabs((!SyncInput() ? look_ang : interpolatedlookang(smoothratio)).signedbuildf()) * (1. / 9.); // Used within draw code for weapon and crosshair when looking left/right.
}
private:

View file

@ -91,20 +91,28 @@ static void viewBurnTime(int gScale)
void hudDraw(PLAYER *gView, int nSectnum, double bobx, double boby, double zDelta, int basepal, double smoothratio)
{
double look_anghalf = gView->angle.look_anghalf(smoothratio);
double look_anghalf = gView->angle.look_anghalf(cl_hudinterpolation, smoothratio);
DrawCrosshair(kCrosshairTile, gView->pXSprite->health >> 4, -look_anghalf, 0, 2);
if (gViewPos == 0)
{
double looking_arc = fabs(look_anghalf) / 4.5;
double looking_arc = gView->angle.looking_arc(cl_hudinterpolation, smoothratio);
double cX = 160 - look_anghalf;
double cY = 220 + looking_arc;
if (cl_weaponsway)
{
cX += (bobx / 256.);
cY += (boby / 256.) + (zDelta / 128.);
if (cl_hudinterpolation)
{
cX += (bobx / 256.);
cY += (boby / 256.) + (zDelta / 128.);
}
else
{
cX += (int(bobx) >> 8);
cY += (int(boby) >> 8) + (int(zDelta) >> 7);
}
}
else
{

View file

@ -293,7 +293,7 @@ void drawoverlays(double smoothratio)
if (ps[myconnectindex].newOwner == nullptr && ud.cameraactor == nullptr)
{
DrawCrosshair(TILE_CROSSHAIR, ps[screenpeek].last_extra, -pp->angle.look_anghalf(smoothratio), pp->over_shoulder_on ? 2.5 : 0, isRR() ? 0.5 : 1);
DrawCrosshair(TILE_CROSSHAIR, ps[screenpeek].last_extra, -pp->angle.look_anghalf(cl_hudinterpolation, smoothratio), pp->over_shoulder_on ? 2.5 : 0, isRR() ? 0.5 : 1);
}
if (paused == 2)

View file

@ -39,9 +39,9 @@ source as it is released.
BEGIN_DUKE_NS
double getavel(int snum)
inline static double getavel(int snum)
{
return FixedToFloat(PlayerInputAngVel(screenpeek));
return PlayerInputAngVel(screenpeek) * (2048. / 360.);
}
//---------------------------------------------------------------------------
@ -87,18 +87,16 @@ void displayloogie(short snum)
//
//---------------------------------------------------------------------------
int animatefist(int gs, int snum, double look_anghalf)
int animatefist(int gs, int snum, double look_anghalf, double looking_arc, double plravel)
{
short fisti, fistpal;
int fistzoom;
double looking_arc, fistz;
double fistz;
fisti = ps[snum].fist_incs;
if (fisti > 32) fisti = 32;
if (fisti <= 0) return 0;
looking_arc = fabs(look_anghalf) / 4.5;
fistzoom = 65536L - bcosf(fisti << 6, 2);
if (fistzoom > 90612L)
fistzoom = 90612L;
@ -112,7 +110,7 @@ int animatefist(int gs, int snum, double look_anghalf)
fistpal = sector[ps[snum].cursectnum].floorpal;
hud_drawsprite(
(-fisti + 222 + (getavel(snum) / 16.)),
(-fisti + 222 + plravel),
(looking_arc + fistz),
fistzoom, 0, FIST, gs, fistpal, 2);
@ -125,17 +123,14 @@ int animatefist(int gs, int snum, double look_anghalf)
//
//---------------------------------------------------------------------------
int animateknee(int gs, int snum, double hard_landing, double look_anghalf, double horiz16th)
int animateknee(int gs, int snum, double look_anghalf, double looking_arc, double horiz16th, double plravel)
{
static const short knee_y[] = { 0,-8,-16,-32,-64,-84,-108,-108,-108,-72,-32,-8 };
short pal;
double looking_arc;
if (ps[snum].knee_incs > 11 || ps[snum].knee_incs == 0 || ps[snum].GetActor()->s.extra <= 0) return 0;
looking_arc = knee_y[ps[snum].knee_incs] + (fabs(look_anghalf) / 4.5);
looking_arc -= hard_landing * 8.;
looking_arc += knee_y[ps[snum].knee_incs];
if (ps[snum].GetActor()->s.pal == 1)
pal = 1;
@ -146,7 +141,7 @@ int animateknee(int gs, int snum, double hard_landing, double look_anghalf, doub
pal = ps[snum].palookup;
}
hud_drawpal(105 + (getavel(snum) / 16.) - look_anghalf + (knee_y[ps[snum].knee_incs] >> 2), looking_arc + 280 - horiz16th, KNEE, gs, 4, pal);
hud_drawpal(105 + plravel - look_anghalf + (knee_y[ps[snum].knee_incs] >> 2), looking_arc + 280 - horiz16th, KNEE, gs, 4, pal);
return 1;
}
@ -157,24 +152,19 @@ int animateknee(int gs, int snum, double hard_landing, double look_anghalf, doub
//
//---------------------------------------------------------------------------
int animateknuckles(int gs, int snum, double hard_landing, double look_anghalf, double horiz16th)
int animateknuckles(int gs, int snum, double look_anghalf, double looking_arc, double horiz16th, double plravel)
{
static const short knuckle_frames[] = { 0,1,2,2,3,3,3,2,2,1,0 };
short pal;
double looking_arc;
if (isWW2GI() || ps[snum].over_shoulder_on != 0 || ps[snum].knuckle_incs == 0 || ps[snum].GetActor()->s.extra <= 0) return 0;
looking_arc = fabs(look_anghalf) / 4.5;
looking_arc -= hard_landing * 8.;
if (ps[snum].GetActor()->s.pal == 1)
pal = 1;
else
pal = sector[ps[snum].cursectnum].floorpal;
hud_drawpal(160 + (getavel(snum) / 16.) - look_anghalf, looking_arc + 180 - horiz16th, CRACKKNUCKLES + knuckle_frames[ps[snum].knuckle_incs >> 1], gs, 4, pal);
hud_drawpal(160 + plravel - look_anghalf, looking_arc + 180 - horiz16th, CRACKKNUCKLES + knuckle_frames[ps[snum].knuckle_incs >> 1], gs, 4, pal);
return 1;
}
@ -209,23 +199,19 @@ void displaymasks_d(int snum, double)
//
//---------------------------------------------------------------------------
static int animatetip(int gs, int snum, double hard_landing, double look_anghalf, double horiz16th)
static int animatetip(int gs, int snum, double look_anghalf, double looking_arc, double horiz16th, double plravel)
{
int p;
double looking_arc;
static const short tip_y[] = { 0,-8,-16,-32,-64,-84,-108,-108,-108,-108,-108,-108,-108,-108,-108,-108,-96,-72,-64,-32,-16 };
if (ps[snum].tipincs == 0) return 0;
looking_arc = fabs(look_anghalf) / 4.5;
looking_arc -= hard_landing * 8.;
if (ps[snum].GetActor()->s.pal == 1)
p = 1;
else
p = sector[ps[snum].cursectnum].floorpal;
hud_drawpal(170 + (getavel(snum) / 16.) - look_anghalf,
hud_drawpal(170 + plravel - look_anghalf,
(tip_y[ps[snum].tipincs] >> 1) + looking_arc + 240 - horiz16th, TIP + ((26 - ps[snum].tipincs) >> 4), gs, 0, p);
return 1;
@ -237,25 +223,23 @@ static int animatetip(int gs, int snum, double hard_landing, double look_anghalf
//
//---------------------------------------------------------------------------
int animateaccess(int gs,int snum,double hard_landing,double look_anghalf,double horiz16th)
int animateaccess(int gs, int snum, double look_anghalf, double looking_arc, double horiz16th, double plravel)
{
static const short access_y[] = {0,-8,-16,-32,-64,-84,-108,-108,-108,-108,-108,-108,-108,-108,-108,-108,-96,-72,-64,-32,-16};
double looking_arc;
char p;
if(ps[snum].access_incs == 0 || ps[snum].GetActor()->s.extra <= 0) return 0;
looking_arc = access_y[ps[snum].access_incs] + (fabs(look_anghalf) / 4.5);
looking_arc -= hard_landing * 8.;
looking_arc += access_y[ps[snum].access_incs];
if(ps[snum].access_spritenum != nullptr)
p = ps[snum].access_spritenum->s.pal;
else p = 0;
if((ps[snum].access_incs-3) > 0 && (ps[snum].access_incs-3)>>3)
hud_drawpal(170+(getavel(snum)/16.)-look_anghalf+(access_y[ps[snum].access_incs]>>2),looking_arc+266-horiz16th,HANDHOLDINGLASER+(ps[snum].access_incs>>3),gs,0,p);
hud_drawpal(170 + plravel - look_anghalf + (access_y[ps[snum].access_incs] >> 2), looking_arc + 266 - horiz16th, HANDHOLDINGLASER + (ps[snum].access_incs >> 3), gs, 0, p);
else
hud_drawpal(170+(getavel(snum)/16.)-look_anghalf+(access_y[ps[snum].access_incs]>>2),looking_arc+266-horiz16th,HANDHOLDINGACCESS,gs,4,p);
hud_drawpal(170 + plravel - look_anghalf + (access_y[ps[snum].access_incs] >> 2), looking_arc + 266 - horiz16th, HANDHOLDINGACCESS, gs, 4, p);
return 1;
}
@ -271,7 +255,7 @@ void displayweapon_d(int snum, double smoothratio)
int cw;
int i, j;
int o,pal;
double weapon_sway, weapon_xoffset, gun_pos, looking_arc, kickback_pic, random_club_frame, hard_landing, look_anghalf, horiz16th;
double weapon_sway, weapon_xoffset, gun_pos, looking_arc, kickback_pic, random_club_frame, hard_landing, look_anghalf, horiz16th, plravel;
signed char shade;
struct player_struct *p;
@ -281,36 +265,48 @@ void displayweapon_d(int snum, double smoothratio)
o = 0;
horiz16th = get16thOfHoriz(snum, SyncInput(), smoothratio);
look_anghalf = p->angle.look_anghalf(smoothratio);
looking_arc = fabs(look_anghalf) / 4.5;
weapon_sway = interpolatedvaluef(p->oweapon_sway, p->weapon_sway, smoothratio);
kickback_pic = interpolatedvaluef(p->okickback_pic, p->kickback_pic, smoothratio);
random_club_frame = interpolatedvaluef(p->orandom_club_frame, p->random_club_frame, smoothratio);
hard_landing = interpolatedvaluef(p->ohard_landing, p->hard_landing, smoothratio);
if (cl_hudinterpolation)
{
weapon_sway = interpolatedvaluef(p->oweapon_sway, p->weapon_sway, smoothratio);
kickback_pic = interpolatedvaluef(p->okickback_pic, p->kickback_pic, smoothratio);
random_club_frame = interpolatedvaluef(p->orandom_club_frame, p->random_club_frame, smoothratio);
hard_landing = interpolatedvaluef(p->ohard_landing, p->hard_landing, smoothratio);
gun_pos = 80 - interpolatedvaluef(p->oweapon_pos * p->oweapon_pos, p->weapon_pos * p->weapon_pos, smoothratio);
}
else
{
weapon_sway = p->weapon_sway;
kickback_pic = p->kickback_pic;
random_club_frame = p->random_club_frame;
hard_landing = p->hard_landing;
gun_pos = 80 - (p->weapon_pos * p->weapon_pos);
}
plravel = getavel(snum) * (1. / 16.);
horiz16th = p->horizon.horizsumfrac(cl_hudinterpolation, smoothratio);
look_anghalf = p->angle.look_anghalf(cl_hudinterpolation, smoothratio);
looking_arc = p->angle.looking_arc(cl_hudinterpolation, smoothratio);
hard_landing *= 8.;
gun_pos -= fabs(p->GetActor()->s.xrepeat < 32 ? bsinf(weapon_sway * 4., -9) : bsinf(weapon_sway * 0.5, -10));
gun_pos -= hard_landing;
weapon_xoffset = (160)-90;
weapon_xoffset -= bcosf(weapon_sway * 0.5) * (1. / 1536.);
weapon_xoffset -= 58 + p->weapon_ang;
shade = p->GetActor()->s.shade;
if(shade > 24) shade = 24;
auto adjusted_arc = looking_arc - hard_landing;
bool playerVars = p->newOwner != nullptr || ud.cameraactor != nullptr || p->over_shoulder_on > 0 || (p->GetActor()->s.pal != 1 && p->GetActor()->s.extra <= 0);
bool playerAnims = animatefist(shade,snum,look_anghalf) || animateknuckles(shade,snum,hard_landing,look_anghalf,horiz16th) ||
animatetip(shade,snum,hard_landing,look_anghalf,horiz16th) || animateaccess(shade,snum,hard_landing,look_anghalf,horiz16th);
bool playerAnims = animatefist(shade, snum, look_anghalf, looking_arc, plravel) || animateknuckles(shade, snum, look_anghalf, adjusted_arc, horiz16th, plravel) ||
animatetip(shade, snum, look_anghalf, adjusted_arc, horiz16th, plravel) || animateaccess(shade, snum, look_anghalf, adjusted_arc, horiz16th, plravel);
if(playerVars || playerAnims)
return;
animateknee(shade,snum,hard_landing,look_anghalf,horiz16th);
gun_pos = 80 - interpolatedvaluef(p->oweapon_pos * p->oweapon_pos, p->weapon_pos * p->weapon_pos, smoothratio);
weapon_xoffset = (160)-90;
weapon_xoffset -= bcosf(weapon_sway * 0.5) * (1. / 1536.);
weapon_xoffset -= 58 + p->weapon_ang;
if( p->GetActor()->s.xrepeat < 32 )
gun_pos -= fabs(bsinf(weapon_sway * 4., -9));
else gun_pos -= fabs(bsinf(weapon_sway * 0.5, -10));
gun_pos -= hard_landing * 8.;
animateknee(shade, snum, look_anghalf, adjusted_arc, horiz16th, plravel);
if (isWW2GI())
{

View file

@ -116,7 +116,7 @@ void displayweapon_r(int snum, double smoothratio)
{
int cw;
int i, j;
double weapon_sway, weapon_xoffset, gun_pos, looking_arc, look_anghalf, TiltStatus;
double weapon_sway, weapon_xoffset, gun_pos, looking_arc, look_anghalf, hard_landing, TiltStatus;
char o,pal;
signed char shade;
@ -125,10 +125,31 @@ void displayweapon_r(int snum, double smoothratio)
o = 0;
look_anghalf = p->angle.look_anghalf(smoothratio);
looking_arc = fabs(look_anghalf) / 4.5;
weapon_sway = interpolatedvaluef(p->oweapon_sway, p->weapon_sway, smoothratio);
TiltStatus = !SyncInput() ? p->TiltStatus : interpolatedvaluef(p->oTiltStatus, p->TiltStatus, smoothratio);
if (cl_hudinterpolation)
{
weapon_sway = interpolatedvaluef(p->oweapon_sway, p->weapon_sway, smoothratio);
hard_landing = interpolatedvaluef(p->ohard_landing, p->hard_landing, smoothratio);
gun_pos = 80 - interpolatedvaluef(p->oweapon_pos * p->oweapon_pos, p->weapon_pos * p->weapon_pos, smoothratio);
TiltStatus = !SyncInput() ? p->TiltStatus : interpolatedvaluef(p->oTiltStatus, p->TiltStatus, smoothratio);
}
else
{
weapon_sway = p->weapon_sway;
hard_landing = p->hard_landing;
gun_pos = 80 - (p->weapon_pos * p->weapon_pos);
TiltStatus = p->TiltStatus;
}
look_anghalf = p->angle.look_anghalf(cl_hudinterpolation, smoothratio);
looking_arc = p->angle.looking_arc(cl_hudinterpolation, smoothratio);
hard_landing *= 8.;
gun_pos -= fabs(p->GetActor()->s.xrepeat < 8 ? bsinf(weapon_sway * 4., -9) : bsinf(weapon_sway * 0.5, -10));
gun_pos -= hard_landing;
weapon_xoffset = (160)-90;
weapon_xoffset -= bcosf(weapon_sway * 0.5) * (1. / 1536.);
weapon_xoffset -= 58 + p->weapon_ang;
if (shadedsector[p->cursectnum] == 1)
shade = 16;
@ -139,17 +160,6 @@ void displayweapon_r(int snum, double smoothratio)
if(p->newOwner != nullptr || ud.cameraactor != nullptr || p->over_shoulder_on > 0 || (p->GetActor()->s.pal != 1 && p->GetActor()->s.extra <= 0))
return;
gun_pos = 80 - interpolatedvaluef(p->oweapon_pos * p->oweapon_pos, p->weapon_pos * p->weapon_pos, smoothratio);
weapon_xoffset = (160)-90;
weapon_xoffset -= bcosf(weapon_sway * 0.5) * (1. / 1536.);
weapon_xoffset -= 58 + p->weapon_ang;
if( p->GetActor()->s.xrepeat < 8 )
gun_pos -= fabs(bsinf(weapon_sway * 4., -9));
else gun_pos -= fabs(bsinf(weapon_sway * 0.5, -10));
gun_pos -= interpolatedvaluef(p->ohard_landing, p->hard_landing, smoothratio) * 8.;
if(p->last_weapon >= 0)
cw = p->last_weapon;
else cw = p->curr_weapon;

View file

@ -187,12 +187,6 @@ inline bool playrunning()
return (paused == 0 || (paused == 1 && (ud.recstat == 2 || ud.multimode > 1)));
}
// the weapon display code uses this.
inline double get16thOfHoriz(int const snum, bool const interpolate, double const smoothratio)
{
return (!interpolate ? ps[snum].horizon.sum() : ps[snum].horizon.interpolatedsum(smoothratio)).asq16() * (0.0625 / FRACUNIT);
}
inline void doslopetilting(player_struct* p, double const scaleAdjust = 1)
{
bool const canslopetilt = p->on_ground && sector[p->cursectnum].lotag != ST_2_UNDERWATER && (sector[p->cursectnum].floorstat & 2);

View file

@ -93,7 +93,7 @@ void GameInterface::Render()
DrawView(smoothratio);
DrawStatusBar();
DrawCrosshair(MAXTILES, PlayerList[nLocalPlayer].nHealth >> 3, -PlayerList[nLocalPlayer].angle.look_anghalf(smoothratio), 0, 1);
DrawCrosshair(MAXTILES, PlayerList[nLocalPlayer].nHealth >> 3, -PlayerList[nLocalPlayer].angle.look_anghalf(cl_hudinterpolation, smoothratio), 0, 1);
if (paused && !M_Active())
{

View file

@ -964,9 +964,19 @@ void DrawWeapons(double smooth)
if (cl_weaponsway)
{
// CHECKME - not & 0x7FF?
double nBobAngle = interpolatedangle(buildang(obobangle), buildang(bobangle), smooth).asbuildf();
double nVal = interpolatedvaluef(ototalvel[nLocalPlayer], totalvel[nLocalPlayer], smooth, 17);
double nBobAngle, nVal;
if (cl_hudinterpolation)
{
nBobAngle = interpolatedangle(buildang(obobangle), buildang(bobangle), smooth).asbuildf();
nVal = interpolatedvaluef(ototalvel[nLocalPlayer], totalvel[nLocalPlayer], smooth, 17);
}
else
{
nBobAngle = bobangle;
nVal = totalvel[nLocalPlayer];
}
yOffset = MulScaleF(nVal, bsinf(fmod(nBobAngle, 1024.), -8), 9);
if (var_34 == 1)
@ -987,8 +997,8 @@ void DrawWeapons(double smooth)
nShade = sprite[PlayerList[nLocalPlayer].nSprite].shade;
}
double const look_anghalf = PlayerList[nLocalPlayer].angle.look_anghalf(smooth);
double const looking_arc = fabs(look_anghalf) / 4.5;
double const look_anghalf = PlayerList[nLocalPlayer].angle.look_anghalf(cl_hudinterpolation, smooth);
double const looking_arc = PlayerList[nLocalPlayer].angle.looking_arc(cl_hudinterpolation, smooth);
xOffset -= look_anghalf;
yOffset += looking_arc;

View file

@ -1100,7 +1100,7 @@ void DrawCrosshair(PLAYERp pp)
if (!(CameraTestMode))
{
USERp u = User[pp->PlayerSprite];
::DrawCrosshair(2326, u->Health, -pp->angle.look_anghalf(smoothratio), TEST(pp->Flags, PF_VIEW_FROM_OUTSIDE) ? 5 : 0, 2, shadeToLight(10));
::DrawCrosshair(2326, u->Health, -pp->angle.look_anghalf(cl_hudinterpolation, smoothratio), TEST(pp->Flags, PF_VIEW_FROM_OUTSIDE) ? 5 : 0, 2, shadeToLight(10));
}
}

View file

@ -6897,16 +6897,29 @@ pDisplaySprites(PLAYERp pp, double smoothratio)
short ang;
int flags;
double const look_anghalf = pp->angle.look_anghalf(smoothratio);
double const looking_arc = fabs(look_anghalf) / 4.5;
double const look_anghalf = pp->angle.look_anghalf(cl_hudinterpolation, smoothratio);
double const looking_arc = pp->angle.looking_arc(cl_hudinterpolation, smoothratio);
TRAVERSE(&pp->PanelSpriteList, psp, next)
{
ang = psp->rotate_ang;
shade = 0;
flags = 0;
x = interpolatedvaluef(psp->ox, psp->x, smoothratio) - look_anghalf;
y = interpolatedvaluef(psp->oy, psp->y, smoothratio) + looking_arc;
if (cl_hudinterpolation)
{
x = interpolatedvaluef(psp->ox, psp->x, smoothratio);
y = interpolatedvaluef(psp->oy, psp->y, smoothratio);
}
else
{
x = psp->x;
y = psp->y;
}
x -= look_anghalf;
y += looking_arc;
// initilize pal here - jack with it below
pal = psp->pal;