mirror of
https://github.com/DrBeef/Raze.git
synced 2025-02-21 03:01:36 +00:00
- Improved crosshair drawing that factor's in look_ang better I've had stashed away for a little bit.
This commit is contained in:
parent
a012fd8f94
commit
ef52694365
7 changed files with 19 additions and 9 deletions
|
@ -1374,7 +1374,7 @@ void ST_LoadCrosshair(int num, bool alwaysload);
|
|||
CVAR(Int, crosshair, 0, CVAR_ARCHIVE)
|
||||
|
||||
|
||||
void DrawCrosshair(int deftile, int health, double xdelta, double ydelta, double scale, PalEntry color)
|
||||
void DrawCrosshair(int deftile, int health, double xdelta, double ydelta, double scale, DAngle angle, PalEntry color)
|
||||
{
|
||||
if (automapMode == am_off && cl_crosshair)
|
||||
{
|
||||
|
@ -1384,7 +1384,7 @@ void DrawCrosshair(int deftile, int health, double xdelta, double ydelta, double
|
|||
if (tile)
|
||||
{
|
||||
double crosshair_scale = crosshairscale * scale;
|
||||
DrawTexture(twod, tile, 160 + xdelta, 100 + ydelta, DTA_Color, color,
|
||||
DrawTexture(twod, tile, 160 + xdelta, 100 + ydelta, DTA_Color, color, DTA_Rotate, angle.Degrees(),
|
||||
DTA_FullscreenScale, FSMode_Fit320x200, DTA_ScaleX, crosshair_scale, DTA_ScaleY, crosshair_scale, DTA_CenterOffsetRel, true,
|
||||
DTA_ViewportX, viewport3d.Left(), DTA_ViewportY, viewport3d.Top(), DTA_ViewportWidth, viewport3d.Width(), DTA_ViewportHeight, viewport3d.Height(), TAG_DONE);
|
||||
|
||||
|
|
|
@ -40,7 +40,7 @@ void CONFIG_ReadCombatMacros();
|
|||
int GameMain();
|
||||
int GetAutomapZoom(int gZoom);
|
||||
|
||||
void DrawCrosshair(int deftile, int health, double xdelta, double ydelta, double scale, PalEntry color = 0xffffffff);
|
||||
void DrawCrosshair(int deftile, int health, double xdelta, double ydelta, double scale, DAngle angle, PalEntry color = 0xffffffff);
|
||||
void updatePauseStatus();
|
||||
void DeferredStartGame(MapRecord* map, int skill, bool nostopsound = false);
|
||||
void ChangeLevel(MapRecord* map, int skill, bool bossexit = false);
|
||||
|
|
|
@ -129,6 +129,7 @@ struct PlayerAngle
|
|||
DAngle interpolatedlookang(double const interpfrac) { return interpolatedvalue(olook_ang, look_ang, interpfrac); }
|
||||
DAngle interpolatedrotscrn(double const interpfrac) { return interpolatedvalue(orotscrnang, rotscrnang, interpfrac); }
|
||||
DAngle renderlookang(double const interpfrac) { return !SyncInput() ? look_ang : interpolatedlookang(interpfrac); }
|
||||
DAngle renderrotscrn(double const interpfrac) { return !SyncInput() ? rotscrnang : interpolatedrotscrn(interpfrac); }
|
||||
|
||||
// Ticrate playsim adjustment helpers.
|
||||
void resetadjustment() { adjustment = nullAngle; }
|
||||
|
@ -143,6 +144,12 @@ struct PlayerAngle
|
|||
double look_anghalf(double const interpfrac) { return renderlookang(interpfrac).Normalized180().Degrees() * (128. / 45.); }
|
||||
double looking_arc(double const interpfrac) { return fabs(renderlookang(interpfrac).Normalized180().Degrees() * (1024. / 1620.)); }
|
||||
|
||||
// Crosshair x/y offsets based on look_ang's tangent.
|
||||
DVector2 crosshairoffsets(const double interpfrac)
|
||||
{
|
||||
return DVector2(159.72, 145.5 * renderrotscrn(interpfrac).Sin()) * -renderlookang(interpfrac).Tan() * (1. / tan(r_fov * pi::pi() / 360.));
|
||||
}
|
||||
|
||||
// Ticrate playsim adjustment setters and processor.
|
||||
void addadjustment(const DAngle value)
|
||||
{
|
||||
|
|
|
@ -743,8 +743,8 @@ void viewDrawScreen(bool sceneonly)
|
|||
bDeliriumOld = bDelirium && gDeliriumBlur;
|
||||
|
||||
if (sceneonly) return;
|
||||
double look_anghalf = pPlayer->angle.look_anghalf(interpfrac);
|
||||
DrawCrosshair(kCrosshairTile, pPlayer->actor->xspr.health >> 4, -look_anghalf, 0, 2);
|
||||
auto offsets = pPlayer->angle.crosshairoffsets(interpfrac);
|
||||
DrawCrosshair(kCrosshairTile, pPlayer->actor->xspr.health >> 4, offsets.X, offsets.Y, 2, -pPlayer->angle.interpolatedrotscrn(interpfrac));
|
||||
#if 0 // This currently does not work. May have to be redone as a hardware effect.
|
||||
if (v4 && gNetPlayers > 1)
|
||||
{
|
||||
|
|
|
@ -289,7 +289,8 @@ void drawoverlays(double interpfrac)
|
|||
|
||||
if (ps[myconnectindex].newOwner == nullptr && ud.cameraactor == nullptr)
|
||||
{
|
||||
DrawCrosshair(TILE_CROSSHAIR, ps[screenpeek].last_extra, -pp->angle.look_anghalf(interpfrac), pp->over_shoulder_on ? 2.5 : 0, isRR() ? 0.5 : 1);
|
||||
auto offsets = pp->angle.crosshairoffsets(interpfrac);
|
||||
DrawCrosshair(TILE_CROSSHAIR, ps[screenpeek].last_extra, offsets.X, offsets.Y + (pp->over_shoulder_on ? 2.5 : 0), isRR() ? 0.5 : 1, -pp->angle.interpolatedrotscrn(interpfrac));
|
||||
}
|
||||
|
||||
if (paused == 2)
|
||||
|
|
|
@ -87,7 +87,8 @@ void GameInterface::Render()
|
|||
if (nFreeze != 2) // Hide when Ramses is talking.
|
||||
{
|
||||
DrawStatusBar();
|
||||
DrawCrosshair(kCrosshairTile, PlayerList[nLocalPlayer].nHealth >> 3, -PlayerList[nLocalPlayer].angle.look_anghalf(interpfrac), 0, 1);
|
||||
auto offsets = PlayerList[nLocalPlayer].angle.crosshairoffsets(interpfrac);
|
||||
DrawCrosshair(kCrosshairTile, PlayerList[nLocalPlayer].nHealth >> 3, offsets.X, offsets.Y, 1, -PlayerList[nLocalPlayer].angle.interpolatedrotscrn(interpfrac));
|
||||
|
||||
if (paused && !M_Active())
|
||||
{
|
||||
|
|
|
@ -1018,9 +1018,10 @@ void PrintSpriteInfo(PLAYER* pp)
|
|||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
static void DrawCrosshair(PLAYER* pp, const double inputfrac)
|
||||
static void DrawCrosshair(PLAYER* pp, const double interpfrac)
|
||||
{
|
||||
::DrawCrosshair(2326, pp->actor->user.Health, -pp->angle.look_anghalf(inputfrac), (pp->Flags & PF_VIEW_FROM_OUTSIDE) ? 5 : 0, 2, shadeToLight(10));
|
||||
auto offsets = pp->angle.crosshairoffsets(interpfrac);
|
||||
::DrawCrosshair(2326, pp->actor->user.Health, offsets.X, offsets.Y + ((pp->Flags & PF_VIEW_FROM_OUTSIDE) ? 5 : 0), 2, -pp->angle.interpolatedrotscrn(interpfrac), shadeToLight(10));
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
|
Loading…
Reference in a new issue