mirror of
https://github.com/ZDoom/Raze.git
synced 2024-11-15 00:42:08 +00:00
- Move PlayerAngles
class directly into DCorePlayer
.
* No refactoring around it yet. * The #includes could use some cleaning up...
This commit is contained in:
parent
7230ceebaf
commit
531c95c7ca
44 changed files with 549 additions and 554 deletions
|
@ -949,6 +949,7 @@ set (PCH_SOURCES
|
|||
core/automap.cpp
|
||||
core/cheats.cpp
|
||||
core/cheathandler.cpp
|
||||
core/coreplayer.cpp
|
||||
core/rts.cpp
|
||||
core/ct_chat.cpp
|
||||
core/d_net.cpp
|
||||
|
|
273
source/core/coreplayer.cpp
Normal file
273
source/core/coreplayer.cpp
Normal file
|
@ -0,0 +1,273 @@
|
|||
//-------------------------------------------------------------------------
|
||||
/*
|
||||
Copyright (C) 2023 Christoph Oelckers
|
||||
Copyright (C) 2023 Mitchell Richters
|
||||
|
||||
This is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
as published by the Free Software Foundation; either version 2
|
||||
of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
See the GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
*/
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
#include "gameinput.h"
|
||||
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
// Input constants used throughout associated functions.
|
||||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
static constexpr double ROLL_TILTAVELSCALE = (1966426. / 12000000.);
|
||||
static constexpr DAngle ROLL_TILTAVELMAX = DAngle::fromDeg(90. / 32. * 1.5);
|
||||
static constexpr double ROLL_TILTRETURN = 15.;
|
||||
static constexpr double YAW_LOOKINGSPEED = 801.5625;
|
||||
static constexpr double YAW_ROTATESPEED = 63.28125;
|
||||
static constexpr double YAW_LOOKRETURN = 7.5;
|
||||
static constexpr double YAW_SPINSTAND = 675.;
|
||||
static constexpr double YAW_SPINCROUCH = YAW_SPINSTAND * 0.5;
|
||||
static constexpr double PITCH_LOOKSPEED = (269426662. / 1209103.);
|
||||
static constexpr double PITCH_AIMSPEED = PITCH_LOOKSPEED * 0.5;
|
||||
static constexpr double PITCH_CENTERSPEED = 10.7375;
|
||||
static constexpr double PITCH_HORIZOFFSPEED = 4.375;
|
||||
static constexpr DAngle PITCH_CNTRSINEOFFSET = DAngle90 / 8.;
|
||||
static constexpr DAngle PITCH_HORIZOFFCLIMB = DAngle::fromDeg(-127076387. / 3344227.);
|
||||
static constexpr DAngle PITCH_HORIZOFFPUSH = DAngle::fromDeg(14115687. / 31535389.);
|
||||
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
// CVARs to control view rolling.
|
||||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
EXTERN_CVAR(Int, vr_mode)
|
||||
CVAR(Float, cl_viewtiltscale, 1.f, CVAR_GLOBALCONFIG | CVAR_ARCHIVE);
|
||||
CUSTOM_CVAR(Int, cl_viewtilting, 0, CVAR_GLOBALCONFIG | CVAR_ARCHIVE)
|
||||
{
|
||||
if (self < 0) self = 0;
|
||||
else if (self > 3) self = 3;
|
||||
}
|
||||
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
// Adjust player's pitch by way of keyboard input.
|
||||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void DCorePlayer::doPitchInput(InputPacket* const input)
|
||||
{
|
||||
// Add player's mouse/device input.
|
||||
if (input->ang.Pitch.Degrees())
|
||||
{
|
||||
actor->spr.Angles.Pitch += input->ang.Pitch * gameInput.SyncInput();
|
||||
input->actions &= ~SB_CENTERVIEW;
|
||||
}
|
||||
|
||||
// Set up a myriad of bools.
|
||||
const auto aimingUp = (input->actions & SB_LOOK_UP) == SB_AIM_UP;
|
||||
const auto aimingDown = (input->actions & SB_LOOK_DOWN) == SB_AIM_DOWN;
|
||||
const auto lookingUp = (input->actions & SB_LOOK_UP) == SB_LOOK_UP;
|
||||
const auto lookingDown = (input->actions & SB_LOOK_DOWN) == SB_LOOK_DOWN;
|
||||
|
||||
// Process keyboard input.
|
||||
if (const auto aiming = aimingDown - aimingUp)
|
||||
{
|
||||
actor->spr.Angles.Pitch += getTicrateAngle(PITCH_AIMSPEED * aiming);
|
||||
input->actions &= ~SB_CENTERVIEW;
|
||||
}
|
||||
if (const auto looking = lookingDown - lookingUp)
|
||||
{
|
||||
actor->spr.Angles.Pitch += getTicrateAngle(PITCH_LOOKSPEED * looking);
|
||||
input->actions |= SB_CENTERVIEW;
|
||||
}
|
||||
|
||||
// Do return to centre.
|
||||
if ((input->actions & SB_CENTERVIEW) && !(lookingUp || lookingDown))
|
||||
{
|
||||
const auto pitch = abs(actor->spr.Angles.Pitch);
|
||||
const auto scale = pitch > PITCH_CNTRSINEOFFSET ? (pitch - PITCH_CNTRSINEOFFSET).Cos() : 1.;
|
||||
if (scaletozero(actor->spr.Angles.Pitch, PITCH_CENTERSPEED * scale))
|
||||
input->actions &= ~SB_CENTERVIEW;
|
||||
}
|
||||
|
||||
// clamp before we finish, factoring in the player's view pitch offset.
|
||||
const auto maximum = GetMaxPitch() - ViewAngles.Pitch * (ViewAngles.Pitch < nullAngle);
|
||||
const auto minimum = GetMinPitch() - ViewAngles.Pitch * (ViewAngles.Pitch > nullAngle);
|
||||
actor->spr.Angles.Pitch = clamp(actor->spr.Angles.Pitch, maximum, minimum);
|
||||
}
|
||||
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
// Adjust player's yaw by way of keyboard input.
|
||||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void DCorePlayer::doYawInput(InputPacket* const input)
|
||||
{
|
||||
// Add player's mouse/device input.
|
||||
actor->spr.Angles.Yaw += input->ang.Yaw * gameInput.SyncInput();
|
||||
|
||||
if (input->actions & SB_TURNAROUND)
|
||||
{
|
||||
if (YawSpin == nullAngle)
|
||||
{
|
||||
// currently not spinning, so start a spin
|
||||
YawSpin = -DAngle180;
|
||||
}
|
||||
input->actions &= ~SB_TURNAROUND;
|
||||
}
|
||||
|
||||
if (YawSpin < nullAngle)
|
||||
{
|
||||
// return spin to 0
|
||||
DAngle add = getTicrateAngle(!(input->actions & SB_CROUCH) ? YAW_SPINSTAND : YAW_SPINCROUCH);
|
||||
YawSpin += add;
|
||||
if (YawSpin > nullAngle)
|
||||
{
|
||||
// Don't overshoot our target. With variable factor this is possible.
|
||||
add -= YawSpin;
|
||||
YawSpin = nullAngle;
|
||||
}
|
||||
actor->spr.Angles.Yaw += add;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
// Player's slope tilt when playing without a mouse and on a slope.
|
||||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void DCorePlayer::doViewPitch(const bool canslopetilt, const bool climbing)
|
||||
{
|
||||
if (cl_slopetilting && canslopetilt)
|
||||
{
|
||||
const auto actorsect = actor->sector();
|
||||
if (actorsect && (actorsect->floorstat & CSTAT_SECTOR_SLOPE)) // If the floor is sloped
|
||||
{
|
||||
// Get a point, 512 (64 for Blood) units ahead of player's position
|
||||
const auto rotpt = actor->spr.pos.XY() + actor->spr.Angles.Yaw.ToVector() * (!isBlood() ? 32 : 4);
|
||||
auto tempsect = actorsect;
|
||||
updatesector(rotpt, &tempsect);
|
||||
|
||||
if (tempsect != nullptr) // If the new point is inside a valid sector...
|
||||
{
|
||||
// Get the floorz as if the new (x,y) point was still in
|
||||
// your sector, unless it's Blood.
|
||||
const double j = getflorzofslopeptr(actorsect, actor->spr.pos.XY());
|
||||
const double k = getflorzofslopeptr(!isBlood() ? actorsect : tempsect, rotpt);
|
||||
|
||||
// If extended point is in same sector as you or the slopes
|
||||
// of the sector of the extended point and your sector match
|
||||
// closely (to avoid accidently looking straight out when
|
||||
// you're at the edge of a sector line) then adjust horizon
|
||||
// accordingly
|
||||
if (actorsect == tempsect || (!isBlood() && abs(getflorzofslopeptr(tempsect, rotpt) - k) <= 4))
|
||||
{
|
||||
ViewAngles.Pitch -= maphoriz((j - k) * (!isBlood() ? 0.625 : 5.5));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (cl_slopetilting && climbing)
|
||||
{
|
||||
// tilt when climbing but you can't even really tell it.
|
||||
if (ViewAngles.Pitch > PITCH_HORIZOFFCLIMB)
|
||||
ViewAngles.Pitch += getscaledangle(deltaangle(ViewAngles.Pitch, PITCH_HORIZOFFCLIMB), PITCH_HORIZOFFSPEED, PITCH_HORIZOFFPUSH);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Make horizoff grow towards 0 since horizoff is not modified when you're not on a slope.
|
||||
scaletozero(ViewAngles.Pitch, PITCH_HORIZOFFSPEED, PITCH_HORIZOFFPUSH);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
// Player's look left/right key angle handler.
|
||||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void DCorePlayer::doViewYaw(InputPacket* const input)
|
||||
{
|
||||
// Process angle return to zeros.
|
||||
scaletozero(ViewAngles.Yaw, YAW_LOOKRETURN);
|
||||
scaletozero(ViewAngles.Roll, YAW_LOOKRETURN);
|
||||
|
||||
// Process keyboard input.
|
||||
if (const auto looking = !!(input->actions & SB_LOOK_RIGHT) - !!(input->actions & SB_LOOK_LEFT))
|
||||
{
|
||||
ViewAngles.Yaw += getTicrateAngle(YAW_LOOKINGSPEED * looking);
|
||||
ViewAngles.Roll += getTicrateAngle(YAW_ROTATESPEED * looking);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
// View tilting effects, mostly for Exhumed to enhance its gameplay feel.
|
||||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void DCorePlayer::doRollInput(InputPacket* const input, const DVector2& nVelVect, const double nMaxVel, const bool bUnderwater)
|
||||
{
|
||||
// Allow viewtilting if we're not in a VR mode.
|
||||
if (!vr_mode)
|
||||
{
|
||||
// Scale/attenuate tilting based on player actions.
|
||||
const auto rollAmp = cl_viewtiltscale / (1 + bUnderwater);
|
||||
const auto runScale = 1. / (1 + !(input->actions & SB_RUN));
|
||||
const auto strafeScale = 1 + !!input->vel.Y;
|
||||
|
||||
if (cl_viewtilting == 1)
|
||||
{
|
||||
// Console-like yaw rolling. Adjustment == ~(90/32) for keyboard turning. Clamp is 1.5x this value.
|
||||
const auto rollAdj = input->ang.Yaw * ROLL_TILTAVELSCALE * rollAmp;
|
||||
const auto rollMax = ROLL_TILTAVELMAX * cl_viewtiltscale;
|
||||
scaletozero(actor->spr.Angles.Roll, ROLL_TILTRETURN);
|
||||
actor->spr.Angles.Roll = clamp(actor->spr.Angles.Roll + rollAdj, -rollMax, rollMax);
|
||||
}
|
||||
else if (cl_viewtilting == 2)
|
||||
{
|
||||
// Quake-like strafe rolling. Adjustment == (90/48) for running keyboard strafe.
|
||||
const auto rollAdj = StrafeVel * strafeScale * rollAmp;
|
||||
const auto rollMax = nMaxVel * runScale * cl_viewtiltscale;
|
||||
actor->spr.Angles.Roll = DAngle::fromDeg(clamp(rollAdj, -rollMax, rollMax) * (1.875 / nMaxVel));
|
||||
}
|
||||
else if (cl_viewtilting == 3)
|
||||
{
|
||||
// Movement rolling from player's velocity. Adjustment == (90/48) for running keyboard strafe.
|
||||
const auto rollAdj = nVelVect.Rotated(-actor->spr.Angles.Yaw).Y * strafeScale * rollAmp;
|
||||
const auto rollMax = nMaxVel * runScale * cl_viewtiltscale;
|
||||
actor->spr.Angles.Roll = DAngle::fromDeg(clamp(rollAdj, -rollMax, rollMax) * (1.875 / nMaxVel));
|
||||
}
|
||||
else
|
||||
{
|
||||
// Always reset roll if we're not tilting at all.
|
||||
actor->spr.Angles.Roll = nullAngle;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Add player's device input.
|
||||
actor->spr.Angles.Roll += input->ang.Roll * gameInput.SyncInput();
|
||||
}
|
||||
}
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
#include "d_net.h"
|
||||
#include "packet.h"
|
||||
#include "gameinput.h"
|
||||
#include "gamefuncs.h"
|
||||
|
||||
class DCorePlayer : public DObject
|
||||
{
|
||||
|
@ -12,23 +12,97 @@ protected:
|
|||
DCorePlayer() = default;
|
||||
void Clear()
|
||||
{
|
||||
CameraAngles = PrevLerpAngles = PrevViewAngles = ViewAngles = {};
|
||||
PrevStrafeVel = StrafeVel = 0;
|
||||
YawSpin = nullAngle;
|
||||
memset(&lastcmd, 0, sizeof(lastcmd));
|
||||
memset(&cmd, 0, sizeof(cmd));
|
||||
memset(&Angles, 0, sizeof(Angles));
|
||||
actor = nullptr;
|
||||
pnum = 0;
|
||||
}
|
||||
|
||||
public:
|
||||
DRotator PrevLerpAngles, CameraAngles;
|
||||
DRotator PrevViewAngles, ViewAngles;
|
||||
double PrevStrafeVel, StrafeVel;
|
||||
DAngle YawSpin;
|
||||
ticcmd_t lastcmd, cmd;
|
||||
PlayerAngles Angles;
|
||||
DCoreActor* actor;
|
||||
uint8_t pnum;
|
||||
|
||||
DCorePlayer(uint8_t p) : pnum(p) {}
|
||||
void OnDestroy() override { if (actor) actor->Destroy(); actor = nullptr; }
|
||||
virtual DCoreActor* GetActor() = 0;
|
||||
void Serialize(FSerializer& arc) override;
|
||||
|
||||
// All overridable methods.
|
||||
virtual DCoreActor* GetActor() = 0;
|
||||
|
||||
// Angle prototypes.
|
||||
void doPitchInput(InputPacket* const input);
|
||||
void doYawInput(InputPacket* const input);
|
||||
void doViewPitch(const bool canslopetilt, const bool climbing = false);
|
||||
void doViewYaw(InputPacket* const input);
|
||||
void doRollInput(InputPacket* const input, const DVector2& nVelVect, const double nMaxVel, const bool bUnderwater);
|
||||
|
||||
// Angle methods.
|
||||
void InitAngles(const DAngle viewyaw = nullAngle)
|
||||
{
|
||||
PrevLerpAngles = CameraAngles = actor->spr.Angles;
|
||||
PrevViewAngles = ViewAngles = { nullAngle, viewyaw, nullAngle };
|
||||
PrevStrafeVel = StrafeVel = 0;
|
||||
YawSpin = nullAngle;
|
||||
}
|
||||
|
||||
DAngle getPitchWithView()
|
||||
{
|
||||
return ClampViewPitch(actor->spr.Angles.Pitch + ViewAngles.Pitch);
|
||||
}
|
||||
|
||||
DRotator getRenderAngles(const double interpfrac)
|
||||
{
|
||||
// Get angles and return with clamped off pitch.
|
||||
auto angles = CameraAngles + interpolatedvalue(PrevViewAngles, ViewAngles, interpfrac);
|
||||
angles.Pitch = ClampViewPitch(angles.Pitch);
|
||||
return angles;
|
||||
}
|
||||
|
||||
const DRotator& getCameraAngles() const
|
||||
{
|
||||
return CameraAngles;
|
||||
}
|
||||
|
||||
void updateCameraAngles(const double interpfrac)
|
||||
{
|
||||
// Apply the current interpolated angle state to the render angles.
|
||||
const auto lerpAngles = interpolatedvalue(actor->PrevAngles, actor->spr.Angles, interpfrac);
|
||||
CameraAngles += lerpAngles - PrevLerpAngles;
|
||||
PrevLerpAngles = lerpAngles;
|
||||
}
|
||||
|
||||
void resetCameraAngles()
|
||||
{
|
||||
if (actor != nullptr)
|
||||
{
|
||||
// Apply any last remaining ticrate angle updates and reset variables.
|
||||
CameraAngles += actor->spr.Angles - PrevLerpAngles;
|
||||
PrevLerpAngles = actor->spr.Angles = CameraAngles;
|
||||
PrevViewAngles = ViewAngles;
|
||||
}
|
||||
}
|
||||
|
||||
// Draw code helpers.
|
||||
auto getCrosshairOffsets(const double interpfrac)
|
||||
{
|
||||
// Set up angles and return as pair with roll as the 2nd object since all callers inevitably need it.
|
||||
const auto viewAngles = interpolatedvalue(PrevViewAngles, ViewAngles, interpfrac);
|
||||
return std::make_pair(DVector2(160, 120 * -viewAngles.Roll.Tan()) * -viewAngles.Yaw.Tan() / tan(r_fov * pi::pi() / 360.), viewAngles.Roll);
|
||||
}
|
||||
auto getWeaponOffsets(const double interpfrac)
|
||||
{
|
||||
// Push the Y down a bit since the weapon is at the edge of the screen. Also null roll for now.
|
||||
auto offsets = getCrosshairOffsets(interpfrac); offsets.first.Y *= 4.; offsets.second = nullAngle;
|
||||
return offsets;
|
||||
}
|
||||
};
|
||||
|
||||
extern DCorePlayer* PlayerArray[MAXPLAYERS];
|
||||
|
@ -37,3 +111,30 @@ inline ESyncBits GetPersistentActions()
|
|||
{
|
||||
return PlayerArray[myconnectindex]->cmd.ucmd.actions & SB_CENTERVIEW;
|
||||
}
|
||||
|
||||
inline double getTicrateScale(const double value)
|
||||
{
|
||||
return value / GameTicRate;
|
||||
}
|
||||
|
||||
inline DAngle getTicrateAngle(const double value)
|
||||
{
|
||||
return DAngle::fromDeg(getTicrateScale(value));
|
||||
}
|
||||
|
||||
inline DAngle getscaledangle(const DAngle angle, const double scale, const DAngle push)
|
||||
{
|
||||
return (angle.Normalized180() * getTicrateScale(scale)) + push;
|
||||
}
|
||||
|
||||
inline bool scaletozero(DAngle& angle, const double scale, const DAngle push = DAngle::fromDeg(7646143. / 110386328.))
|
||||
{
|
||||
const auto sgn = angle.Sgn();
|
||||
|
||||
if (!sgn || sgn != (angle -= getscaledangle(angle, scale, push * sgn)).Sgn())
|
||||
{
|
||||
angle = nullAngle;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -84,7 +84,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|||
#include "hw_material.h"
|
||||
#include "tiletexture.h"
|
||||
#include "tilesetbuilder.h"
|
||||
#include "coreplayer.h"
|
||||
#include "gameinput.h"
|
||||
|
||||
#include "buildtiles.h"
|
||||
|
||||
|
|
|
@ -261,9 +261,9 @@ ADD_STAT(coord)
|
|||
out.AppendFormat("Yaw: %.4f ", pActor->spr.Angles.Yaw.Degrees());
|
||||
out.AppendFormat("Pitch: %.4f ", pActor->spr.Angles.Pitch.Degrees());
|
||||
out.AppendFormat("Roll: %.4f\n", pActor->spr.Angles.Roll.Degrees());
|
||||
out.AppendFormat("View Yaw: %.4f ", p->Angles.ViewAngles.Yaw.Degrees());
|
||||
out.AppendFormat("View Pitch: %.4f ", p->Angles.ViewAngles.Pitch.Degrees());
|
||||
out.AppendFormat("View Roll: %.4f\n", p->Angles.ViewAngles.Roll.Degrees());
|
||||
out.AppendFormat("View Yaw: %.4f ", p->ViewAngles.Yaw.Degrees());
|
||||
out.AppendFormat("View Pitch: %.4f ", p->ViewAngles.Pitch.Degrees());
|
||||
out.AppendFormat("View Roll: %.4f\n", p->ViewAngles.Roll.Degrees());
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
|
|
@ -33,18 +33,11 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
EXTERN_CVAR(Int, vr_mode)
|
||||
CVAR(Bool, cl_noturnscaling, false, CVAR_GLOBALCONFIG | CVAR_ARCHIVE);
|
||||
CVAR(Float, m_pitch, 1.f, CVAR_GLOBALCONFIG | CVAR_ARCHIVE)
|
||||
CVAR(Float, m_yaw, 1.f, CVAR_GLOBALCONFIG | CVAR_ARCHIVE)
|
||||
CVAR(Float, m_forward, 1.f, CVAR_GLOBALCONFIG | CVAR_ARCHIVE)
|
||||
CVAR(Float, m_side, 1.f, CVAR_GLOBALCONFIG | CVAR_ARCHIVE)
|
||||
CVAR(Float, cl_viewtiltscale, 1.f, CVAR_GLOBALCONFIG | CVAR_ARCHIVE);
|
||||
CUSTOM_CVAR(Int, cl_viewtilting, 0, CVAR_GLOBALCONFIG | CVAR_ARCHIVE)
|
||||
{
|
||||
if (self < 0) self = 0;
|
||||
else if (self > 3) self = 3;
|
||||
}
|
||||
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
@ -57,35 +50,6 @@ GameInput gameInput{};
|
|||
bool crouch_toggle = false;
|
||||
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
// Input helper functions.
|
||||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
static inline DAngle getTicrateAngle(const double value)
|
||||
{
|
||||
return DAngle::fromDeg(getTicrateScale(value));
|
||||
}
|
||||
|
||||
static inline DAngle getscaledangle(const DAngle angle, const double scale, const DAngle push)
|
||||
{
|
||||
return (angle.Normalized180() * getTicrateScale(scale)) + push;
|
||||
}
|
||||
|
||||
bool scaletozero(DAngle& angle, const double scale, const DAngle push)
|
||||
{
|
||||
const auto sgn = angle.Sgn();
|
||||
|
||||
if (!sgn || sgn != (angle -= getscaledangle(angle, scale, push * sgn)).Sgn())
|
||||
{
|
||||
angle = nullAngle;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
// Clears crouch toggle state for new games.
|
||||
|
@ -143,8 +107,8 @@ void GameInput::processMovement(const double turnscale, const bool allowstrafe,
|
|||
if (!(buttonMap.ButtonDown(gamefunc_Strafe) && allowstrafe))
|
||||
{
|
||||
const double turndir = clamp(turning + strafing * !allowstrafe, -1., 1.);
|
||||
const double tttscale = 1. / (1 + !(cl_noturnscaling || isTurboTurnTime()) * 2.8);
|
||||
const DAngle turnspeed = getTicrateAngle(YAW_TURNSPEEDS[keymove]) * tttscale;
|
||||
const double tttscale = (cl_noturnscaling || isTurboTurnTime()) ? 1 : (5. / 19.);
|
||||
const DAngle turnspeed = getTicrateAngle(YAW_TURNSPEEDS[keymove] * tttscale);
|
||||
thisInput.ang.Yaw += MOUSE_SCALE * mouseInput.X * m_yaw;
|
||||
thisInput.ang.Yaw -= hidspeed * joyAxes[JOYAXIS_Yaw] * scaleAdjust;
|
||||
thisInput.ang.Yaw += turnspeed * turndir * scaleAdjust;
|
||||
|
@ -189,7 +153,7 @@ void GameInput::processMovement(const double turnscale, const bool allowstrafe,
|
|||
// directly update player angles if we can.
|
||||
if (scaleAdjust < 1)
|
||||
{
|
||||
PlayerArray[myconnectindex]->Angles.CameraAngles += thisInput.ang;
|
||||
PlayerArray[myconnectindex]->CameraAngles += thisInput.ang;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -252,7 +216,7 @@ void GameInput::processVehicle(const double baseVel, const double velScale, cons
|
|||
// directly update player angles if we can.
|
||||
if (scaleAdjust < 1)
|
||||
{
|
||||
PlayerArray[myconnectindex]->Angles.CameraAngles += thisInput.ang;
|
||||
PlayerArray[myconnectindex]->CameraAngles += thisInput.ang;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -386,236 +350,6 @@ void GameInput::getInput(InputPacket* packet)
|
|||
}
|
||||
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
// Adjust player's pitch by way of keyboard input.
|
||||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void PlayerAngles::doPitchInput(InputPacket* const input)
|
||||
{
|
||||
// Add player's mouse/device input.
|
||||
if (input->ang.Pitch.Degrees())
|
||||
{
|
||||
pActor->spr.Angles.Pitch += input->ang.Pitch * gameInput.SyncInput();
|
||||
input->actions &= ~SB_CENTERVIEW;
|
||||
}
|
||||
|
||||
// Set up a myriad of bools.
|
||||
const auto aimingUp = (input->actions & SB_LOOK_UP) == SB_AIM_UP;
|
||||
const auto aimingDown = (input->actions & SB_LOOK_DOWN) == SB_AIM_DOWN;
|
||||
const auto lookingUp = (input->actions & SB_LOOK_UP) == SB_LOOK_UP;
|
||||
const auto lookingDown = (input->actions & SB_LOOK_DOWN) == SB_LOOK_DOWN;
|
||||
|
||||
// Process keyboard input.
|
||||
if (const auto aiming = aimingDown - aimingUp)
|
||||
{
|
||||
pActor->spr.Angles.Pitch += getTicrateAngle(PITCH_AIMSPEED) * aiming;
|
||||
input->actions &= ~SB_CENTERVIEW;
|
||||
}
|
||||
if (const auto looking = lookingDown - lookingUp)
|
||||
{
|
||||
pActor->spr.Angles.Pitch += getTicrateAngle(PITCH_LOOKSPEED) * looking;
|
||||
input->actions |= SB_CENTERVIEW;
|
||||
}
|
||||
|
||||
// Do return to centre.
|
||||
if ((input->actions & SB_CENTERVIEW) && !(lookingUp || lookingDown))
|
||||
{
|
||||
const auto pitch = abs(pActor->spr.Angles.Pitch);
|
||||
const auto scale = pitch > PITCH_CNTRSINEOFFSET ? (pitch - PITCH_CNTRSINEOFFSET).Cos() : 1.;
|
||||
if (scaletozero(pActor->spr.Angles.Pitch, PITCH_CENTERSPEED * scale))
|
||||
input->actions &= ~SB_CENTERVIEW;
|
||||
}
|
||||
|
||||
// clamp before we finish, factoring in the player's view pitch offset.
|
||||
const auto maximum = GetMaxPitch() - ViewAngles.Pitch * (ViewAngles.Pitch < nullAngle);
|
||||
const auto minimum = GetMinPitch() - ViewAngles.Pitch * (ViewAngles.Pitch > nullAngle);
|
||||
pActor->spr.Angles.Pitch = clamp(pActor->spr.Angles.Pitch, maximum, minimum);
|
||||
}
|
||||
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
// Adjust player's yaw by way of keyboard input.
|
||||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void PlayerAngles::doYawInput(InputPacket* const input)
|
||||
{
|
||||
// Add player's mouse/device input.
|
||||
pActor->spr.Angles.Yaw += input->ang.Yaw * gameInput.SyncInput();
|
||||
|
||||
if (input->actions & SB_TURNAROUND)
|
||||
{
|
||||
if (YawSpin == nullAngle)
|
||||
{
|
||||
// currently not spinning, so start a spin
|
||||
YawSpin = -DAngle180;
|
||||
}
|
||||
input->actions &= ~SB_TURNAROUND;
|
||||
}
|
||||
|
||||
if (YawSpin < nullAngle)
|
||||
{
|
||||
// return spin to 0
|
||||
DAngle add = getTicrateAngle(!(input->actions & SB_CROUCH) ? YAW_SPINSTAND : YAW_SPINCROUCH);
|
||||
YawSpin += add;
|
||||
if (YawSpin > nullAngle)
|
||||
{
|
||||
// Don't overshoot our target. With variable factor this is possible.
|
||||
add -= YawSpin;
|
||||
YawSpin = nullAngle;
|
||||
}
|
||||
pActor->spr.Angles.Yaw += add;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
// Player's slope tilt when playing without a mouse and on a slope.
|
||||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void PlayerAngles::doViewPitch(const bool canslopetilt, const bool climbing)
|
||||
{
|
||||
if (cl_slopetilting && canslopetilt)
|
||||
{
|
||||
const auto actorsect = pActor->sector();
|
||||
if (actorsect && (actorsect->floorstat & CSTAT_SECTOR_SLOPE)) // If the floor is sloped
|
||||
{
|
||||
// Get a point, 512 (64 for Blood) units ahead of player's position
|
||||
const auto rotpt = pActor->spr.pos.XY() + pActor->spr.Angles.Yaw.ToVector() * (!isBlood() ? 32 : 4);
|
||||
auto tempsect = actorsect;
|
||||
updatesector(rotpt, &tempsect);
|
||||
|
||||
if (tempsect != nullptr) // If the new point is inside a valid sector...
|
||||
{
|
||||
// Get the floorz as if the new (x,y) point was still in
|
||||
// your sector, unless it's Blood.
|
||||
const double j = getflorzofslopeptr(actorsect, pActor->spr.pos.XY());
|
||||
const double k = getflorzofslopeptr(!isBlood() ? actorsect : tempsect, rotpt);
|
||||
|
||||
// If extended point is in same sector as you or the slopes
|
||||
// of the sector of the extended point and your sector match
|
||||
// closely (to avoid accidently looking straight out when
|
||||
// you're at the edge of a sector line) then adjust horizon
|
||||
// accordingly
|
||||
if (actorsect == tempsect || (!isBlood() && abs(getflorzofslopeptr(tempsect, rotpt) - k) <= 4))
|
||||
{
|
||||
ViewAngles.Pitch -= maphoriz((j - k) * (!isBlood() ? 0.625 : 5.5));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (cl_slopetilting && climbing)
|
||||
{
|
||||
// tilt when climbing but you can't even really tell it.
|
||||
if (ViewAngles.Pitch > PITCH_HORIZOFFCLIMB)
|
||||
ViewAngles.Pitch += getscaledangle(deltaangle(ViewAngles.Pitch, PITCH_HORIZOFFCLIMB), PITCH_HORIZOFFSPEED, PITCH_HORIZOFFPUSH);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Make horizoff grow towards 0 since horizoff is not modified when you're not on a slope.
|
||||
scaletozero(ViewAngles.Pitch, PITCH_HORIZOFFSPEED, PITCH_HORIZOFFPUSH);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
// Player's look left/right key angle handler.
|
||||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void PlayerAngles::doViewYaw(InputPacket* const input)
|
||||
{
|
||||
// Process angle return to zeros.
|
||||
scaletozero(ViewAngles.Yaw, YAW_LOOKRETURN);
|
||||
scaletozero(ViewAngles.Roll, YAW_LOOKRETURN);
|
||||
|
||||
// Process keyboard input.
|
||||
if (const auto looking = !!(input->actions & SB_LOOK_RIGHT) - !!(input->actions & SB_LOOK_LEFT))
|
||||
{
|
||||
ViewAngles.Yaw += getTicrateAngle(YAW_LOOKINGSPEED) * looking;
|
||||
ViewAngles.Roll += getTicrateAngle(YAW_ROTATESPEED) * looking;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
// View tilting effects, mostly for Exhumed to enhance its gameplay feel.
|
||||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void PlayerAngles::doRollInput(InputPacket* const input, const DVector2& nVelVect, const double nMaxVel, const bool bUnderwater)
|
||||
{
|
||||
// Allow viewtilting if we're not in a VR mode.
|
||||
if (!vr_mode)
|
||||
{
|
||||
// Scale/attenuate tilting based on player actions.
|
||||
const auto rollAmp = cl_viewtiltscale / (bUnderwater + 1);
|
||||
const auto runScale = 1. / (!(input->actions & SB_RUN) + 1);
|
||||
const auto strafeScale = !!input->vel.Y + 1;
|
||||
|
||||
if (cl_viewtilting == 1)
|
||||
{
|
||||
// Console-like yaw rolling. Adjustment == ~(90/32) for keyboard turning. Clamp is 1.5x this value.
|
||||
const auto rollAdj = input->ang.Yaw * ROLL_TILTAVELSCALE * rollAmp;
|
||||
const auto rollMax = ROLL_TILTAVELMAX * cl_viewtiltscale;
|
||||
scaletozero(pActor->spr.Angles.Roll, ROLL_TILTRETURN);
|
||||
pActor->spr.Angles.Roll = clamp(pActor->spr.Angles.Roll + rollAdj, -rollMax, rollMax);
|
||||
}
|
||||
else if (cl_viewtilting == 2)
|
||||
{
|
||||
// Quake-like strafe rolling. Adjustment == (90/48) for running keyboard strafe.
|
||||
const auto rollAdj = StrafeVel * strafeScale * rollAmp;
|
||||
const auto rollMax = nMaxVel * runScale * cl_viewtiltscale;
|
||||
pActor->spr.Angles.Roll = DAngle::fromDeg(clamp(rollAdj, -rollMax, rollMax) * (1.875 / nMaxVel));
|
||||
}
|
||||
else if (cl_viewtilting == 3)
|
||||
{
|
||||
// Movement rolling from player's velocity. Adjustment == (90/48) for running keyboard strafe.
|
||||
const auto rollAdj = nVelVect.Rotated(-pActor->spr.Angles.Yaw).Y * strafeScale * rollAmp;
|
||||
const auto rollMax = nMaxVel * runScale * cl_viewtiltscale;
|
||||
pActor->spr.Angles.Roll = DAngle::fromDeg(clamp(rollAdj, -rollMax, rollMax) * (1.875 / nMaxVel));
|
||||
}
|
||||
else
|
||||
{
|
||||
// Always reset roll if we're not tilting at all.
|
||||
pActor->spr.Angles.Roll = nullAngle;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Add player's device input.
|
||||
pActor->spr.Angles.Roll += input->ang.Roll * gameInput.SyncInput();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
//
|
||||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
FSerializer& Serialize(FSerializer& arc, const char* keyname, PlayerAngles& w, PlayerAngles* def)
|
||||
{
|
||||
if (arc.BeginObject(keyname))
|
||||
{
|
||||
arc("viewangles", w.ViewAngles)
|
||||
("spin", w.YawSpin)
|
||||
("actor", w.pActor)
|
||||
.EndObject();
|
||||
}
|
||||
return arc;
|
||||
}
|
||||
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
//
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#pragma once
|
||||
|
||||
#include "serializer.h"
|
||||
#include "gamefuncs.h"
|
||||
#include "coreplayer.h"
|
||||
#include "d_net.h"
|
||||
|
||||
enum : unsigned
|
||||
|
@ -17,11 +17,6 @@ enum : unsigned
|
|||
VEH_SCALETURN = 4,
|
||||
};
|
||||
|
||||
inline double getTicrateScale(const double value)
|
||||
{
|
||||
return value / GameTicRate;
|
||||
}
|
||||
|
||||
class GameInput
|
||||
{
|
||||
enum
|
||||
|
@ -52,7 +47,7 @@ class GameInput
|
|||
// Turn speed doubling after x amount of tics.
|
||||
void updateTurnHeldAmt()
|
||||
{
|
||||
turnheldtime += getTicrateScale(BUILDTICRATE) * scaleAdjust;
|
||||
turnheldtime += getTicrateScale(BUILDTICRATE * scaleAdjust);
|
||||
}
|
||||
bool isTurboTurnTime()
|
||||
{
|
||||
|
@ -117,110 +112,4 @@ public:
|
|||
void resetCrouchToggle();
|
||||
};
|
||||
|
||||
struct PlayerAngles
|
||||
{
|
||||
// Player viewing angles, separate from the camera.
|
||||
DRotator PrevViewAngles, ViewAngles;
|
||||
|
||||
// Strafe roll counter, to be incremented/managed by the game's velocity handler.
|
||||
double PrevStrafeVel, StrafeVel;
|
||||
|
||||
// Holder of current yaw spin state for the 180 degree turn.
|
||||
DAngle YawSpin;
|
||||
|
||||
friend FSerializer& Serialize(FSerializer& arc, const char* keyname, PlayerAngles& w, PlayerAngles* def);
|
||||
friend void GameInput::processMovement(const double turnscale, const bool allowstrafe, const int drink_amt);
|
||||
friend void GameInput::processVehicle(const double baseVel, const double velScale, const unsigned flags);
|
||||
|
||||
// Prototypes.
|
||||
void doPitchInput(InputPacket* const input);
|
||||
void doYawInput(InputPacket* const input);
|
||||
void doViewPitch(const bool canslopetilt, const bool climbing = false);
|
||||
void doViewYaw(InputPacket* const input);
|
||||
void doRollInput(InputPacket* const input, const DVector2& nVelVect, const double nMaxVel, const bool bUnderwater);
|
||||
|
||||
// General methods.
|
||||
void initialize(DCoreActor* const actor, const DAngle viewyaw = nullAngle)
|
||||
{
|
||||
memset(this, 0, sizeof(*this));
|
||||
pActor = actor;
|
||||
CameraAngles = PrevLerpAngles = pActor->spr.Angles;
|
||||
PrevViewAngles.Yaw = ViewAngles.Yaw = viewyaw;
|
||||
}
|
||||
DAngle getPitchWithView()
|
||||
{
|
||||
return ClampViewPitch(pActor->spr.Angles.Pitch + ViewAngles.Pitch);
|
||||
}
|
||||
|
||||
// Render angle functions.
|
||||
const DRotator& getCameraAngles() const
|
||||
{
|
||||
return CameraAngles;
|
||||
}
|
||||
DRotator getRenderAngles(const double interpfrac)
|
||||
{
|
||||
// Get angles and return with clamped off pitch.
|
||||
auto angles = CameraAngles + interpolatedvalue(PrevViewAngles, ViewAngles, interpfrac);
|
||||
angles.Pitch = ClampViewPitch(angles.Pitch);
|
||||
return angles;
|
||||
}
|
||||
void updateCameraAngles(const double interpfrac)
|
||||
{
|
||||
// Apply the current interpolated angle state to the render angles.
|
||||
const auto lerpAngles = interpolatedvalue(pActor->PrevAngles, pActor->spr.Angles, interpfrac);
|
||||
CameraAngles += lerpAngles - PrevLerpAngles;
|
||||
PrevLerpAngles = lerpAngles;
|
||||
}
|
||||
void resetCameraAngles()
|
||||
{
|
||||
if (pActor != nullptr)
|
||||
{
|
||||
// Apply any last remaining ticrate angle updates and reset variables.
|
||||
CameraAngles += pActor->spr.Angles - PrevLerpAngles;
|
||||
PrevLerpAngles = pActor->spr.Angles = CameraAngles;
|
||||
PrevViewAngles = ViewAngles;
|
||||
}
|
||||
}
|
||||
|
||||
// Draw code helpers.
|
||||
auto getCrosshairOffsets(const double interpfrac)
|
||||
{
|
||||
// Set up angles and return as pair with roll as the 2nd object since all callers inevitably need it.
|
||||
const auto viewAngles = interpolatedvalue(PrevViewAngles, ViewAngles, interpfrac);
|
||||
return std::make_pair(DVector2(160, 120 * -viewAngles.Roll.Tan()) * -viewAngles.Yaw.Tan() / tan(r_fov * pi::pi() / 360.), viewAngles.Roll);
|
||||
}
|
||||
auto getWeaponOffsets(const double interpfrac)
|
||||
{
|
||||
// Push the Y down a bit since the weapon is at the edge of the screen. Also null roll for now.
|
||||
auto offsets = getCrosshairOffsets(interpfrac); offsets.first.Y *= 4.; offsets.second = nullAngle;
|
||||
return offsets;
|
||||
}
|
||||
|
||||
private:
|
||||
// Private data which should never be accessed publicly.
|
||||
DRotator PrevLerpAngles, CameraAngles;
|
||||
DCoreActor* pActor;
|
||||
|
||||
// Constants used throughout input functions.
|
||||
static constexpr double ROLL_TILTAVELSCALE = (1966426. / 12000000.);
|
||||
static constexpr DAngle ROLL_TILTAVELMAX = DAngle::fromDeg(90. / 32. * 1.5);
|
||||
static constexpr double ROLL_TILTRETURN = 15.;
|
||||
static constexpr double YAW_LOOKINGSPEED = 801.5625;
|
||||
static constexpr double YAW_ROTATESPEED = 63.28125;
|
||||
static constexpr double YAW_LOOKRETURN = 7.5;
|
||||
static constexpr double YAW_SPINSTAND = 675.;
|
||||
static constexpr double YAW_SPINCROUCH = YAW_SPINSTAND * 0.5;
|
||||
static constexpr double PITCH_LOOKSPEED = (269426662. / 1209103.);
|
||||
static constexpr double PITCH_AIMSPEED = PITCH_LOOKSPEED * 0.5;
|
||||
static constexpr double PITCH_CENTERSPEED = 10.7375;
|
||||
static constexpr double PITCH_HORIZOFFSPEED = 4.375;
|
||||
static constexpr DAngle PITCH_CNTRSINEOFFSET = DAngle90 / 8.;
|
||||
static constexpr DAngle PITCH_HORIZOFFCLIMB = DAngle::fromDeg(-127076387. / 3344227.);
|
||||
static constexpr DAngle PITCH_HORIZOFFPUSH = DAngle::fromDeg(14115687. / 31535389.);
|
||||
};
|
||||
|
||||
extern GameInput gameInput;
|
||||
|
||||
class FSerializer;
|
||||
FSerializer& Serialize(FSerializer& arc, const char* keyname, PlayerAngles& w, PlayerAngles* def);
|
||||
bool scaletozero(DAngle& angle, const double scale, const DAngle push = DAngle::fromDeg(7646143. / 110386328.));
|
||||
|
|
|
@ -90,7 +90,7 @@
|
|||
#include "i_interface.h"
|
||||
#include "texinfo.h"
|
||||
#include "texturemanager.h"
|
||||
#include "coreplayer.h"
|
||||
#include "gameinput.h"
|
||||
|
||||
CVAR(Bool, vid_activeinbackground, false, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
|
||||
CVAR(Bool, r_ticstability, true, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
|
||||
|
|
|
@ -177,7 +177,7 @@ bool ReadSavegame(const char* name)
|
|||
// this can only be done after the load is complete
|
||||
for (auto pl : PlayerArray)
|
||||
{
|
||||
pl->Angles.resetCameraAngles();
|
||||
pl->resetCameraAngles();
|
||||
}
|
||||
ResetStatusBar();
|
||||
return true;
|
||||
|
@ -630,8 +630,9 @@ void DCorePlayer::Serialize(FSerializer& arc)
|
|||
Super::Serialize(arc);
|
||||
arc("pnum", pnum)
|
||||
("actor", actor)
|
||||
("angles", Angles)
|
||||
("actions", cmd.ucmd.actions)
|
||||
("viewangles", ViewAngles)
|
||||
("yawspin", YawSpin)
|
||||
//("cmd", cmd)
|
||||
//("lastcmd", lastcmd)
|
||||
;
|
||||
|
|
|
@ -6055,8 +6055,8 @@ static void actCheckDudes()
|
|||
nDrag -= Scale(nDrag, (double)actor->xspr.height, 256.);
|
||||
|
||||
constexpr auto maxVel = (36211. / 3000.);
|
||||
pPlayer->Angles.doRollInput(&pPlayer->cmd.ucmd, actor->vel.XY(), maxVel, false);
|
||||
pPlayer->Angles.StrafeVel -= pPlayer->Angles.StrafeVel * nDrag;
|
||||
pPlayer->doRollInput(&pPlayer->cmd.ucmd, actor->vel.XY(), maxVel, false);
|
||||
pPlayer->StrafeVel -= pPlayer->StrafeVel * nDrag;
|
||||
}
|
||||
|
||||
if ((actor->spr.flags & 4) || !actor->vel.isZero() || actor->sector()->velFloor || actor->sector()->velCeil)
|
||||
|
|
|
@ -435,7 +435,7 @@ void GameInterface::Ticker()
|
|||
|
||||
for (int i = connecthead; i >= 0; i = connectpoint2[i])
|
||||
{
|
||||
getPlayer(i)->Angles.resetCameraAngles();
|
||||
getPlayer(i)->resetCameraAngles();
|
||||
viewBackupView(i);
|
||||
playerProcess(getPlayer(i));
|
||||
}
|
||||
|
|
|
@ -107,7 +107,7 @@ void hudDraw(DBloodPlayer* pPlayer, sectortype* pSector, double bobx, double bob
|
|||
// Nullify incoming roll angle for now as it doesn't draw weapons made up of parts correctly.
|
||||
angle = nullAngle;
|
||||
|
||||
auto cXY = DVector2(160, 220) + pPlayer->Angles.getWeaponOffsets(interpfrac).first;
|
||||
auto cXY = DVector2(160, 220) + pPlayer->getWeaponOffsets(interpfrac).first;
|
||||
|
||||
if (cl_weaponsway)
|
||||
{
|
||||
|
|
|
@ -801,7 +801,7 @@ void playerStart(int nPlayer, int bNewLevel)
|
|||
auto actor = actSpawnSprite(pStartZone->sector, pStartZone->pos, 6, 1);
|
||||
assert(actor->hasX());
|
||||
pPlayer->actor = actor;
|
||||
pPlayer->Angles.initialize(pPlayer->GetActor());
|
||||
pPlayer->InitAngles();
|
||||
DUDEINFO* pDudeInfo = &dudeInfo[kDudePlayer1 + nPlayer - kDudeBase];
|
||||
pPlayer->pDudeInfo = pDudeInfo;
|
||||
playerSetRace(pPlayer, kModeHuman);
|
||||
|
@ -821,7 +821,7 @@ void playerStart(int nPlayer, int bNewLevel)
|
|||
actor->SetBurnSource(nullptr);
|
||||
pPlayer->GetActor()->xspr.health = pDudeInfo->startHealth << 4;
|
||||
pPlayer->GetActor()->spr.cstat &= ~CSTAT_SPRITE_INVISIBLE;
|
||||
pPlayer->GetActor()->spr.Angles.Pitch = pPlayer->Angles.ViewAngles.Pitch = nullAngle;
|
||||
pPlayer->GetActor()->spr.Angles.Pitch = pPlayer->ViewAngles.Pitch = nullAngle;
|
||||
pPlayer->slope = 0;
|
||||
pPlayer->fragger = nullptr;
|
||||
pPlayer->underwaterTime = 1200;
|
||||
|
@ -829,7 +829,7 @@ void playerStart(int nPlayer, int bNewLevel)
|
|||
pPlayer->restTime = 0;
|
||||
pPlayer->kickPower = 0;
|
||||
pPlayer->laughCount = 0;
|
||||
pPlayer->Angles.YawSpin = nullAngle;
|
||||
pPlayer->YawSpin = nullAngle;
|
||||
pPlayer->posture = 0;
|
||||
pPlayer->voodooTarget = nullptr;
|
||||
pPlayer->voodooTargets = 0;
|
||||
|
@ -1578,11 +1578,11 @@ void ProcessInput(DBloodPlayer* pPlayer)
|
|||
const double fvAccel = pInput->vel.X > 0 ? pPosture->frontAccel : pPosture->backAccel;
|
||||
const double svAccel = pPosture->sideAccel;
|
||||
actor->vel.XY() += DVector2(pInput->vel.X * fvAccel, pInput->vel.Y * svAccel).Rotated(actor->spr.Angles.Yaw) * speed;
|
||||
pPlayer->Angles.StrafeVel += pInput->vel.Y * svAccel * speed;
|
||||
pPlayer->StrafeVel += pInput->vel.Y * svAccel * speed;
|
||||
}
|
||||
|
||||
pPlayer->Angles.doViewYaw(pInput);
|
||||
pPlayer->Angles.doYawInput(pInput);
|
||||
pPlayer->doViewYaw(pInput);
|
||||
pPlayer->doYawInput(pInput);
|
||||
|
||||
if (!(pInput->actions & SB_JUMP))
|
||||
pPlayer->cantJump = 0;
|
||||
|
@ -1706,8 +1706,8 @@ void ProcessInput(DBloodPlayer* pPlayer)
|
|||
}
|
||||
|
||||
const int florhit = pPlayer->GetActor()->hit.florhit.type;
|
||||
pPlayer->Angles.doViewPitch(actor->xspr.height < 16 && (florhit == kHitSector || florhit == 0));
|
||||
pPlayer->Angles.doPitchInput(pInput);
|
||||
pPlayer->doViewPitch(actor->xspr.height < 16 && (florhit == kHitSector || florhit == 0));
|
||||
pPlayer->doPitchInput(pInput);
|
||||
|
||||
pPlayer->slope = pPlayer->GetActor()->spr.Angles.Pitch.Tan();
|
||||
if (pInput->actions & SB_INVPREV)
|
||||
|
|
|
@ -29,7 +29,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|||
#include "dude.h"
|
||||
#include "levels.h"
|
||||
#include "qav.h"
|
||||
#include "coreplayer.h"
|
||||
#include "gameinput.h"
|
||||
|
||||
BEGIN_BLD_NS
|
||||
|
||||
|
|
|
@ -412,7 +412,7 @@ static void DrawMap(DBloodPlayer* pPlayer, const double interpfrac)
|
|||
setViewport(Hud_Stbar);
|
||||
tm = 1;
|
||||
}
|
||||
DrawOverheadMap(pPlayer->GetActor()->interpolatedpos(interpfrac).XY(), pPlayer->Angles.getRenderAngles(interpfrac).Yaw, interpfrac);
|
||||
DrawOverheadMap(pPlayer->GetActor()->interpolatedpos(interpfrac).XY(), pPlayer->getRenderAngles(interpfrac).Yaw, interpfrac);
|
||||
if (tm)
|
||||
setViewport(hud_size);
|
||||
}
|
||||
|
@ -458,7 +458,7 @@ static void SetupView(DBloodPlayer* pPlayer, DVector3& cPos, DRotator& cAngles,
|
|||
#endif
|
||||
{
|
||||
cPos = pPlayer->GetActor()->getRenderPos(interpfrac);
|
||||
cAngles = pPlayer->Angles.getRenderAngles(interpfrac);
|
||||
cAngles = pPlayer->getRenderAngles(interpfrac);
|
||||
zDelta = interpolatedvalue(pPlayer->ozWeapon, pPlayer->zWeapon - pPlayer->zView - 12, interpfrac);
|
||||
bobWidth = interpolatedvalue(pPlayer->obobWidth, pPlayer->bobWidth, interpfrac);
|
||||
bobHeight = interpolatedvalue(pPlayer->obobHeight, pPlayer->bobHeight, interpfrac);
|
||||
|
@ -571,7 +571,7 @@ void viewDrawScreen(bool sceneonly)
|
|||
else interpfrac = 1.;
|
||||
|
||||
// update render angles.
|
||||
pPlayer->Angles.updateCameraAngles(interpfrac);
|
||||
pPlayer->updateCameraAngles(interpfrac);
|
||||
|
||||
if (cl_interpolate)
|
||||
{
|
||||
|
@ -692,7 +692,7 @@ void viewDrawScreen(bool sceneonly)
|
|||
bDeliriumOld = bDelirium && gDeliriumBlur;
|
||||
|
||||
if (sceneonly) return;
|
||||
auto offsets = pPlayer->Angles.getCrosshairOffsets(interpfrac);
|
||||
auto offsets = pPlayer->getCrosshairOffsets(interpfrac);
|
||||
DrawCrosshair(pPlayer->GetActor()->xspr.health >> 4, offsets.first.X, offsets.first.Y, 2, offsets.second);
|
||||
#if 0 // This currently does not work. May have to be redone as a hardware effect.
|
||||
if (v4 && gNetPlayers > 1)
|
||||
|
|
|
@ -256,7 +256,7 @@ void drawoverlays(double interpfrac)
|
|||
else
|
||||
{
|
||||
cposxy = pact->interpolatedpos(interpfrac).XY();
|
||||
cang = pp->Angles.getRenderAngles(interpfrac).Yaw;
|
||||
cang = pp->getRenderAngles(interpfrac).Yaw;
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -274,7 +274,7 @@ void drawoverlays(double interpfrac)
|
|||
|
||||
if (spp->newOwner == nullptr && ud.cameraactor == nullptr)
|
||||
{
|
||||
auto offsets = pp->Angles.getCrosshairOffsets(interpfrac);
|
||||
auto offsets = pp->getCrosshairOffsets(interpfrac);
|
||||
DrawCrosshair(pp->last_extra, offsets.first.X, offsets.first.Y + (pp->over_shoulder_on ? 2.5 : 0), isRR() ? 0.5 : 1, offsets.second);
|
||||
}
|
||||
|
||||
|
@ -421,7 +421,7 @@ bool GameInterface::DrawAutomapPlayer(const DVector2& mxy, const DVector2& cpos,
|
|||
double j = clamp(czoom * act->spr.scale.Y + abs(pp->truefz - act->getOffsetZ()) * REPEAT_SCALE, (1. / 3.), 2.);
|
||||
|
||||
auto const vec = OutAutomapVector(mxy - cpos, cangvect, czoom, xydim);
|
||||
auto const daang = -(pp->Angles.getCameraAngles().Yaw - cang).Normalized360().Degrees();
|
||||
auto const daang = -(pp->getCameraAngles().Yaw - cang).Normalized360().Degrees();
|
||||
|
||||
DrawTexture(twod, basetex, false, vec.X, vec.Y, DTA_TranslationIndex, TRANSLATION(Translation_Remap + setpal(pp), act->spr.pal), DTA_CenterOffset, true,
|
||||
DTA_Rotate, daang, DTA_Color, shadeToLight(act->spr.shade), DTA_ScaleX, j, DTA_ScaleY, j, TAG_DONE);
|
||||
|
|
|
@ -343,12 +343,12 @@ void DoPlayer(bool bSet, int lVar1, int lLabelID, int lVar2, DDukeActor* sActor,
|
|||
break;
|
||||
|
||||
case PLAYER_HORIZOFF:
|
||||
if (bSet) p->Angles.ViewAngles.Pitch = maphoriz(-lValue);
|
||||
else SetGameVarID(lVar2, int(p->Angles.ViewAngles.Pitch.Tan() * -128.), sActor, sPlayer);
|
||||
if (bSet) p->ViewAngles.Pitch = maphoriz(-lValue);
|
||||
else SetGameVarID(lVar2, int(p->ViewAngles.Pitch.Tan() * -128.), sActor, sPlayer);
|
||||
break;
|
||||
|
||||
case PLAYER_OHORIZOFF:
|
||||
if (!bSet) SetGameVarID(lVar2, int(p->Angles.PrevViewAngles.Pitch.Tan() * -128.), sActor, sPlayer);
|
||||
if (!bSet) SetGameVarID(lVar2, int(p->PrevViewAngles.Pitch.Tan() * -128.), sActor, sPlayer);
|
||||
break;
|
||||
|
||||
case PLAYER_INVDISPTIME:
|
||||
|
@ -479,8 +479,8 @@ void DoPlayer(bool bSet, int lVar1, int lLabelID, int lVar2, DDukeActor* sActor,
|
|||
break;
|
||||
|
||||
case PLAYER_LOOK_ANG:
|
||||
if (bSet) p->Angles.ViewAngles.Yaw = mapangle(lValue);
|
||||
else SetGameVarID(lVar2, p->Angles.ViewAngles.Yaw.Buildang(), sActor, sPlayer);
|
||||
if (bSet) p->ViewAngles.Yaw = mapangle(lValue);
|
||||
else SetGameVarID(lVar2, p->ViewAngles.Yaw.Buildang(), sActor, sPlayer);
|
||||
break;
|
||||
|
||||
case PLAYER_LAST_EXTRA:
|
||||
|
@ -639,8 +639,8 @@ void DoPlayer(bool bSet, int lVar1, int lLabelID, int lVar2, DDukeActor* sActor,
|
|||
break;
|
||||
|
||||
case PLAYER_ONE_EIGHTY_COUNT:
|
||||
if (bSet) p->Angles.YawSpin = mapangle(lValue);
|
||||
else SetGameVarID(lVar2, p->Angles.YawSpin.Buildang(), sActor, sPlayer);
|
||||
if (bSet) p->YawSpin = mapangle(lValue);
|
||||
else SetGameVarID(lVar2, p->YawSpin.Buildang(), sActor, sPlayer);
|
||||
break;
|
||||
|
||||
case PLAYER_CHEAT_PHASE:
|
||||
|
@ -689,8 +689,8 @@ void DoPlayer(bool bSet, int lVar1, int lLabelID, int lVar2, DDukeActor* sActor,
|
|||
break;
|
||||
|
||||
case PLAYER_ROTSCRNANG:
|
||||
if (bSet) p->Angles.PrevViewAngles.Roll = p->Angles.ViewAngles.Roll = -mapangle(lValue);
|
||||
else SetGameVarID(lVar2, -p->Angles.ViewAngles.Roll.Buildang(), sActor, sPlayer);
|
||||
if (bSet) p->PrevViewAngles.Roll = p->ViewAngles.Roll = -mapangle(lValue);
|
||||
else SetGameVarID(lVar2, -p->ViewAngles.Roll.Buildang(), sActor, sPlayer);
|
||||
break;
|
||||
|
||||
case PLAYER_DEAD_FLAG:
|
||||
|
|
|
@ -64,7 +64,7 @@ void GameInterface::Ticker()
|
|||
// this must be done before the view is backed up.
|
||||
for (int i = connecthead; i >= 0; i = connectpoint2[i])
|
||||
{
|
||||
getPlayer(i)->Angles.resetCameraAngles();
|
||||
getPlayer(i)->resetCameraAngles();
|
||||
}
|
||||
|
||||
// disable synchronised input if set by game.
|
||||
|
|
|
@ -249,9 +249,9 @@ void displayweapon_d(DDukePlayer* const p, double interpfrac)
|
|||
hard_landing *= 8.;
|
||||
gun_pos -= fabs(pact->spr.scale.X < 0.5 ? BobVal(weapon_sway * 4.) * 32 : BobVal(weapon_sway * 0.5) * 16) + hard_landing;
|
||||
|
||||
auto offpair = p->Angles.getWeaponOffsets(interpfrac);
|
||||
auto offpair = p->getWeaponOffsets(interpfrac);
|
||||
auto offsets = offpair.first;
|
||||
auto pitchoffset = 16. * (p->Angles.getRenderAngles(interpfrac).Pitch / DAngle90);
|
||||
auto pitchoffset = 16. * (p->getRenderAngles(interpfrac).Pitch / DAngle90);
|
||||
auto yawinput = getavel(p, interpfrac) * (1. / 16.);
|
||||
auto angle = offpair.second;
|
||||
auto weapon_xoffset = 160 - 90 - (BobVal(512 + weapon_sway * 0.5) * (16384. / 1536.)) - 58 - p->weapon_ang;
|
||||
|
|
|
@ -238,7 +238,7 @@ void displayweapon_r(DDukePlayer* const p, double interpfrac)
|
|||
hard_landing *= 8.;
|
||||
gun_pos -= fabs(pact->spr.scale.X < 0.125 ? BobVal(weapon_sway * 4.) * 32 : BobVal(weapon_sway * 0.5) * 16) + hard_landing;
|
||||
|
||||
auto offpair = p->Angles.getWeaponOffsets(interpfrac);
|
||||
auto offpair = p->getWeaponOffsets(interpfrac);
|
||||
auto offsets = offpair.first;
|
||||
auto angle = offpair.second;
|
||||
auto weapon_xoffset = 160 - 90 - (BobVal(512 + weapon_sway * 0.5) * (16384. / 1536.)) - 58 - p->weapon_ang;
|
||||
|
|
|
@ -474,7 +474,7 @@ void hud_input(DDukePlayer* const p)
|
|||
}
|
||||
}
|
||||
|
||||
if (!!(p->cmd.ucmd.actions & SB_TURNAROUND) && p->Angles.YawSpin == nullAngle && p->on_crane == nullptr)
|
||||
if (!!(p->cmd.ucmd.actions & SB_TURNAROUND) && p->YawSpin == nullAngle && p->on_crane == nullptr)
|
||||
{
|
||||
SetGameVarID(g_iReturnVarID, 0, nullptr, p->pnum);
|
||||
OnEvent(EVENT_TURNAROUND, p->pnum, nullptr, -1);
|
||||
|
|
|
@ -124,8 +124,8 @@ void forceplayerangle(DDukePlayer* p)
|
|||
|
||||
p->GetActor()->spr.Angles.Pitch -= DAngle::fromDeg(26.566);
|
||||
p->cmd.ucmd.actions |= SB_CENTERVIEW;
|
||||
p->Angles.ViewAngles.Yaw = ang;
|
||||
p->Angles.ViewAngles.Roll = -ang;
|
||||
p->ViewAngles.Yaw = ang;
|
||||
p->ViewAngles.Roll = -ang;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
@ -220,7 +220,7 @@ DDukeActor* aim(DDukeActor* actor, int abase, bool force, bool* b)
|
|||
if (!ww2gipistol && (autoaim || otherpistol))
|
||||
{
|
||||
double vel = 1024, zvel = 0;
|
||||
setFreeAimVelocity(vel, zvel, plr->Angles.getPitchWithView(), 16.);
|
||||
setFreeAimVelocity(vel, zvel, plr->getPitchWithView(), 16.);
|
||||
|
||||
HitInfo hit{};
|
||||
hitscan(actor->getPosWithOffsetZ().plusZ(4), actor->sector(), DVector3(actor->spr.Angles.Yaw.ToVector() * vel, zvel * 64), hit, CLIPMASK1);
|
||||
|
@ -324,7 +324,7 @@ DDukeActor* aim(DDukeActor* actor, int abase, bool force, bool* b)
|
|||
if (actor->isPlayer())
|
||||
{
|
||||
double checkval = (act->spr.pos.Z - actor->spr.pos.Z) * 1.25 / sdist;
|
||||
double horiz = getPlayer(actor->PlayerIndex())->Angles.getPitchWithView().Tan();
|
||||
double horiz = getPlayer(actor->PlayerIndex())->getPitchWithView().Tan();
|
||||
check = abs(checkval - horiz) < 0.78125;
|
||||
}
|
||||
else check = 1;
|
||||
|
@ -597,14 +597,14 @@ void playerisdead(DDukePlayer* const p, int psectlotag, double floorz, double ce
|
|||
|
||||
actor->backuploc();
|
||||
|
||||
p->Angles.ViewAngles.Pitch = actor->spr.Angles.Pitch = nullAngle;
|
||||
p->ViewAngles.Pitch = actor->spr.Angles.Pitch = nullAngle;
|
||||
|
||||
updatesector(actor->getPosWithOffsetZ(), &p->cursector);
|
||||
|
||||
pushmove(actor->spr.pos.XY(), actor->getOffsetZ(), &p->cursector, 8, 4, 20, CLIPMASK0);
|
||||
|
||||
if (floorz > ceilingz + 16 && actor->spr.pal != 1)
|
||||
p->Angles.ViewAngles.Roll = DAngle::fromBuild(-(p->dead_flag + ((floorz + actor->getOffsetZ()) * 2)));
|
||||
p->ViewAngles.Roll = DAngle::fromBuild(-(p->dead_flag + ((floorz + actor->getOffsetZ()) * 2)));
|
||||
|
||||
p->on_warping_sector = 0;
|
||||
|
||||
|
@ -714,16 +714,16 @@ void DDukePlayer::apply_seasick()
|
|||
static constexpr DAngle adjustment = DAngle::fromDeg(4.21875);
|
||||
|
||||
if (SeaSick >= 180)
|
||||
Angles.ViewAngles.Roll -= adjustment;
|
||||
ViewAngles.Roll -= adjustment;
|
||||
else if (SeaSick >= 130)
|
||||
Angles.ViewAngles.Roll += adjustment;
|
||||
ViewAngles.Roll += adjustment;
|
||||
else if (SeaSick >= 70)
|
||||
Angles.ViewAngles.Roll -= adjustment;
|
||||
ViewAngles.Roll -= adjustment;
|
||||
else if (SeaSick >= 20)
|
||||
Angles.ViewAngles.Roll += adjustment;
|
||||
ViewAngles.Roll += adjustment;
|
||||
}
|
||||
if (SeaSick < 250)
|
||||
Angles.ViewAngles.Yaw = DAngle::fromDeg(krandf(45) - 22.5);
|
||||
ViewAngles.Yaw = DAngle::fromDeg(krandf(45) - 22.5);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1517,7 +1517,7 @@ void playerreset(DDukePlayer* p, DDukeActor* g_ac)
|
|||
pact->PrevAngles.Pitch = pact->spr.Angles.Pitch = nullAngle;
|
||||
p->on_crane = nullptr;
|
||||
p->frag_ps = p->pnum;
|
||||
p->Angles.PrevViewAngles.Pitch = p->Angles.ViewAngles.Pitch = nullAngle;
|
||||
p->PrevViewAngles.Pitch = p->ViewAngles.Pitch = nullAngle;
|
||||
p->opyoff = 0;
|
||||
p->wackedbyactor = nullptr;
|
||||
p->shield_amount = gs.max_armour_amount;
|
||||
|
@ -1527,7 +1527,7 @@ void playerreset(DDukePlayer* p, DDukeActor* g_ac)
|
|||
p->weapreccnt = 0;
|
||||
p->ftq = 0;
|
||||
p->vel.X = p->vel.Y = 0;
|
||||
if (!isRR()) p->Angles.PrevViewAngles.Roll = p->Angles.ViewAngles.Roll = nullAngle;
|
||||
if (!isRR()) p->PrevViewAngles.Roll = p->ViewAngles.Roll = nullAngle;
|
||||
|
||||
p->falling_counter = 0;
|
||||
|
||||
|
|
|
@ -830,7 +830,7 @@ int operateTripbomb(DDukePlayer* const p)
|
|||
const auto pact = p->GetActor();
|
||||
HitInfo hit{};
|
||||
double vel = 1024, zvel = 0;
|
||||
setFreeAimVelocity(vel, zvel, p->Angles.getPitchWithView(), 16.);
|
||||
setFreeAimVelocity(vel, zvel, p->getPitchWithView(), 16.);
|
||||
|
||||
hitscan(pact->getPosWithOffsetZ(), p->cursector, DVector3(pact->spr.Angles.Yaw.ToVector() * vel, zvel), hit, CLIPMASK1);
|
||||
|
||||
|
@ -1018,12 +1018,12 @@ static void operateweapon(DDukePlayer* const p, ESyncBits actions)
|
|||
if (p->on_ground && (actions & SB_CROUCH))
|
||||
{
|
||||
vel = 15/16.;
|
||||
zvel = p->Angles.getPitchWithView().Sin() * 10.;
|
||||
zvel = p->getPitchWithView().Sin() * 10.;
|
||||
}
|
||||
else
|
||||
{
|
||||
vel = 140/16.;
|
||||
setFreeAimVelocity(vel, zvel, p->Angles.getPitchWithView(), 10.);
|
||||
setFreeAimVelocity(vel, zvel, p->getPitchWithView(), 10.);
|
||||
zvel -= 4;
|
||||
}
|
||||
|
||||
|
@ -1665,7 +1665,7 @@ void processinput_d(DDukePlayer* const p)
|
|||
doubvel = TICSPERFRAME;
|
||||
|
||||
checklook(p, actions);
|
||||
p->Angles.doViewYaw(&p->cmd.ucmd);
|
||||
p->doViewYaw(&p->cmd.ucmd);
|
||||
|
||||
p->updatecentering();
|
||||
|
||||
|
@ -1708,7 +1708,7 @@ void processinput_d(DDukePlayer* const p)
|
|||
gameInput.ForceInputSync(p->pnum);
|
||||
}
|
||||
|
||||
p->Angles.doYawInput(&p->cmd.ucmd);
|
||||
p->doYawInput(&p->cmd.ucmd);
|
||||
|
||||
purplelavacheck(p);
|
||||
|
||||
|
@ -1774,7 +1774,7 @@ void processinput_d(DDukePlayer* const p)
|
|||
doubvel <<= 1;
|
||||
|
||||
p->vel.XY() += p->cmd.ucmd.vel.XY() * doubvel * (5. / 16.);
|
||||
p->Angles.StrafeVel += strafeVel * doubvel * (5. / 16.);
|
||||
p->StrafeVel += strafeVel * doubvel * (5. / 16.);
|
||||
|
||||
bool check;
|
||||
|
||||
|
@ -1783,36 +1783,36 @@ void processinput_d(DDukePlayer* const p)
|
|||
if (check)
|
||||
{
|
||||
p->vel.XY() *= gs.playerfriction - 0.125;
|
||||
p->Angles.StrafeVel *= gs.playerfriction - 0.125;
|
||||
p->StrafeVel *= gs.playerfriction - 0.125;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (psectlotag == ST_2_UNDERWATER)
|
||||
{
|
||||
p->vel.XY() *= gs.playerfriction - FixedToFloat(0x1400);
|
||||
p->Angles.StrafeVel *= gs.playerfriction - FixedToFloat(0x1400);
|
||||
p->StrafeVel *= gs.playerfriction - FixedToFloat(0x1400);
|
||||
}
|
||||
else
|
||||
{
|
||||
p->vel.XY() *= gs.playerfriction;
|
||||
p->Angles.StrafeVel *= gs.playerfriction;
|
||||
p->StrafeVel *= gs.playerfriction;
|
||||
}
|
||||
}
|
||||
|
||||
if (abs(p->vel.X) < 1/128. && abs(p->vel.Y) < 1 / 128.)
|
||||
{
|
||||
p->vel.X = p->vel.Y = 0;
|
||||
p->Angles.StrafeVel = 0;
|
||||
p->StrafeVel = 0;
|
||||
}
|
||||
|
||||
if (shrunk)
|
||||
{
|
||||
p->vel.XY() *= gs.playerfriction * 0.75;
|
||||
p->Angles.StrafeVel *= gs.playerfriction * 0.75;
|
||||
p->StrafeVel *= gs.playerfriction * 0.75;
|
||||
}
|
||||
}
|
||||
|
||||
p->Angles.doRollInput(&p->cmd.ucmd, p->vel.XY(), maxVel, (psectlotag == 1) || (psectlotag == 2));
|
||||
p->doRollInput(&p->cmd.ucmd, p->vel.XY(), maxVel, (psectlotag == 1) || (psectlotag == 2));
|
||||
|
||||
HORIZONLY:
|
||||
|
||||
|
@ -1928,7 +1928,7 @@ HORIZONLY:
|
|||
playerAimDown(p, actions);
|
||||
}
|
||||
|
||||
p->Angles.doPitchInput(&p->cmd.ucmd);
|
||||
p->doPitchInput(&p->cmd.ucmd);
|
||||
|
||||
p->checkhardlanding();
|
||||
|
||||
|
|
|
@ -1693,12 +1693,12 @@ static void operateweapon(DDukePlayer* const p, ESyncBits actions, sectortype* p
|
|||
if (p->on_ground && (actions & SB_CROUCH))
|
||||
{
|
||||
vel = 15 / 16.;
|
||||
zvel = p->Angles.getPitchWithView().Sin() * 10.;
|
||||
zvel = p->getPitchWithView().Sin() * 10.;
|
||||
}
|
||||
else
|
||||
{
|
||||
vel = 140 / 16.;
|
||||
setFreeAimVelocity(vel, zvel, p->Angles.getPitchWithView(), 10.);
|
||||
setFreeAimVelocity(vel, zvel, p->getPitchWithView(), 10.);
|
||||
zvel -= 4;
|
||||
}
|
||||
|
||||
|
@ -2085,12 +2085,12 @@ static void operateweapon(DDukePlayer* const p, ESyncBits actions, sectortype* p
|
|||
if (p->on_ground && (actions & SB_CROUCH) && !p->OnMotorcycle)
|
||||
{
|
||||
vel = 15 / 16.;
|
||||
setFreeAimVelocity(vel, zvel, p->Angles.getPitchWithView(), 10.);
|
||||
setFreeAimVelocity(vel, zvel, p->getPitchWithView(), 10.);
|
||||
}
|
||||
else
|
||||
{
|
||||
vel = 2.;
|
||||
setFreeAimVelocity(vel, zvel, p->Angles.getPitchWithView(), 10.);
|
||||
setFreeAimVelocity(vel, zvel, p->getPitchWithView(), 10.);
|
||||
zvel -= 4;
|
||||
}
|
||||
|
||||
|
@ -2486,7 +2486,7 @@ void processinput_r(DDukePlayer* const p)
|
|||
doubvel = TICSPERFRAME;
|
||||
|
||||
checklook(p, actions);
|
||||
p->Angles.doViewYaw(&p->cmd.ucmd);
|
||||
p->doViewYaw(&p->cmd.ucmd);
|
||||
p->apply_seasick();
|
||||
|
||||
p->updatecentering();
|
||||
|
@ -2545,7 +2545,7 @@ void processinput_r(DDukePlayer* const p)
|
|||
gameInput.ForceInputSync(p->pnum);
|
||||
}
|
||||
|
||||
p->Angles.doYawInput(&p->cmd.ucmd);
|
||||
p->doYawInput(&p->cmd.ucmd);
|
||||
|
||||
purplelavacheck(p);
|
||||
|
||||
|
@ -2626,24 +2626,24 @@ void processinput_r(DDukePlayer* const p)
|
|||
doubvel <<= 1;
|
||||
|
||||
p->vel.XY() += p->cmd.ucmd.vel.XY() * doubvel * (5. / 16.);
|
||||
p->Angles.StrafeVel += strafeVel * doubvel * (5. / 16.);
|
||||
p->StrafeVel += strafeVel * doubvel * (5. / 16.);
|
||||
|
||||
if (!isRRRA() && ((p->curr_weapon == KNEE_WEAPON && p->kickback_pic > 10 && p->on_ground) || (p->on_ground && (actions & SB_CROUCH))))
|
||||
{
|
||||
p->vel.XY() *= gs.playerfriction - 0.125;
|
||||
p->Angles.StrafeVel *= gs.playerfriction - 0.125;
|
||||
p->StrafeVel *= gs.playerfriction - 0.125;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (psectlotag == 2)
|
||||
{
|
||||
p->vel.XY() *= gs.playerfriction - FixedToFloat(0x1400);
|
||||
p->Angles.StrafeVel *= gs.playerfriction - FixedToFloat(0x1400);
|
||||
p->StrafeVel *= gs.playerfriction - FixedToFloat(0x1400);
|
||||
}
|
||||
else
|
||||
{
|
||||
p->vel.XY() *= gs.playerfriction;
|
||||
p->Angles.StrafeVel *= gs.playerfriction;
|
||||
p->StrafeVel *= gs.playerfriction;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2665,7 +2665,7 @@ void processinput_r(DDukePlayer* const p)
|
|||
else
|
||||
{
|
||||
p->vel.XY() *= gs.playerfriction;
|
||||
p->Angles.StrafeVel *= gs.playerfriction;
|
||||
p->StrafeVel *= gs.playerfriction;
|
||||
}
|
||||
}
|
||||
else if (tilesurface(psectp->floortexture) == TSURF_MUDDY)
|
||||
|
@ -2675,7 +2675,7 @@ void processinput_r(DDukePlayer* const p)
|
|||
if (p->on_ground)
|
||||
{
|
||||
p->vel.XY() *= gs.playerfriction - FixedToFloat(0x1800);
|
||||
p->Angles.StrafeVel *= gs.playerfriction - FixedToFloat(0x1800);
|
||||
p->StrafeVel *= gs.playerfriction - FixedToFloat(0x1800);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -2684,26 +2684,26 @@ void processinput_r(DDukePlayer* const p)
|
|||
else
|
||||
{
|
||||
p->vel.XY() *= gs.playerfriction - FixedToFloat(0x1800);
|
||||
p->Angles.StrafeVel *= gs.playerfriction - FixedToFloat(0x1800);
|
||||
p->StrafeVel *= gs.playerfriction - FixedToFloat(0x1800);
|
||||
}
|
||||
}
|
||||
|
||||
if (abs(p->vel.X) < 1 / 128. && abs(p->vel.Y) < 1 / 128.)
|
||||
{
|
||||
p->vel.X = p->vel.Y = 0;
|
||||
p->Angles.StrafeVel = 0;
|
||||
p->StrafeVel = 0;
|
||||
}
|
||||
|
||||
if (shrunk)
|
||||
{
|
||||
p->vel.XY() *= gs.playerfriction * 0.75;
|
||||
p->Angles.StrafeVel *= gs.playerfriction * 0.75;
|
||||
p->StrafeVel *= gs.playerfriction * 0.75;
|
||||
}
|
||||
}
|
||||
|
||||
if (!p->OnMotorcycle && !p->OnBoat)
|
||||
{
|
||||
p->Angles.doRollInput(&p->cmd.ucmd, p->vel.XY(), maxVel, (psectlotag == 1) || (psectlotag == 2));
|
||||
p->doRollInput(&p->cmd.ucmd, p->vel.XY(), maxVel, (psectlotag == 1) || (psectlotag == 2));
|
||||
}
|
||||
|
||||
HORIZONLY:
|
||||
|
@ -2895,7 +2895,7 @@ HORIZONLY:
|
|||
pact->spr.Angles.Pitch += maphoriz(d);
|
||||
}
|
||||
|
||||
p->Angles.doPitchInput(&p->cmd.ucmd);
|
||||
p->doPitchInput(&p->cmd.ucmd);
|
||||
|
||||
p->checkhardlanding();
|
||||
|
||||
|
|
|
@ -330,12 +330,12 @@ void operateweapon_ww(DDukePlayer* const p, ESyncBits actions)
|
|||
if (p->on_ground && (actions & SB_CROUCH))
|
||||
{
|
||||
vel = 15 / 16.;
|
||||
setFreeAimVelocity(vel, zvel, p->Angles.getPitchWithView(), 10.);
|
||||
setFreeAimVelocity(vel, zvel, p->getPitchWithView(), 10.);
|
||||
}
|
||||
else
|
||||
{
|
||||
vel = 140 / 16.;
|
||||
setFreeAimVelocity(vel, zvel, p->Angles.getPitchWithView(), 10.);
|
||||
setFreeAimVelocity(vel, zvel, p->getPitchWithView(), 10.);
|
||||
zvel -= 4;
|
||||
}
|
||||
|
||||
|
|
|
@ -57,7 +57,7 @@ void resetmys()
|
|||
myxvel = myyvel = myzvel = 0;
|
||||
myang = pact->spr.Angles.Yaw;
|
||||
myhoriz = omyhoriz = pact->spr.Angles.Pitch;
|
||||
myhorizoff = omyhorizoff = p->Angles.ViewAngles.Pitch;
|
||||
myhorizoff = omyhorizoff = p->ViewAngles.Pitch;
|
||||
mycursectnum = sectindex(p->cursector);
|
||||
myjumpingcounter = p->jumping_counter;
|
||||
myjumpingtoggle = p->jumping_toggle;
|
||||
|
|
|
@ -590,7 +590,7 @@ void resetpspritevars(int g, const DVector3& startpos, const DAngle startang)
|
|||
act->spr.pal = p->palookup = ud.user_pals[j];
|
||||
|
||||
p->actor = act;
|
||||
p->Angles.initialize(act, (currentLevel->levelNumber & 1)? DAngle90 : -DAngle90);
|
||||
p->InitAngles((currentLevel->levelNumber & 1)? DAngle90 : -DAngle90);
|
||||
p->frag_ps = j;
|
||||
act->SetOwner(act);
|
||||
|
||||
|
|
|
@ -221,7 +221,7 @@ void displayrooms(int snum, double interpfrac, bool sceneonly)
|
|||
DDukePlayer* p = getPlayer(snum);
|
||||
|
||||
// update render angles.
|
||||
p->Angles.updateCameraAngles(interpfrac);
|
||||
p->updateCameraAngles(interpfrac);
|
||||
|
||||
if (automapMode == am_full || !p->insector())
|
||||
return;
|
||||
|
@ -281,7 +281,7 @@ void displayrooms(int snum, double interpfrac, bool sceneonly)
|
|||
else
|
||||
{
|
||||
cpos = viewer->getRenderPos(interpfrac);
|
||||
cangles = p->Angles.getRenderAngles(interpfrac);
|
||||
cangles = p->getRenderAngles(interpfrac);
|
||||
}
|
||||
|
||||
if (p->newOwner != nullptr)
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#include "names.h"
|
||||
#include "packet.h"
|
||||
#include "d_net.h"
|
||||
#include "coreplayer.h"
|
||||
#include "gameinput.h"
|
||||
#include "texturemanager.h"
|
||||
|
||||
BEGIN_DUKE_NS
|
||||
|
@ -397,7 +397,7 @@ public:
|
|||
|
||||
inline void doslopetilting()
|
||||
{
|
||||
Angles.doViewPitch(aim_mode == 0 && on_ground && cursector->lotag != ST_2_UNDERWATER);
|
||||
doViewPitch(aim_mode == 0 && on_ground && cursector->lotag != ST_2_UNDERWATER);
|
||||
}
|
||||
|
||||
inline bool itemUsed(int num)
|
||||
|
|
|
@ -1322,7 +1322,7 @@ DEFINE_ACTION_FUNCTION(_DukePlayer, hitablockingwall)
|
|||
|
||||
inline double DukePlayer_GetPitchwithView(DDukePlayer* pl)
|
||||
{
|
||||
return pl->Angles.getPitchWithView().Degrees();
|
||||
return pl->getPitchWithView().Degrees();
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION_NATIVE(_DukePlayer, GetPitchwithView, DukePlayer_GetPitchwithView)
|
||||
|
|
|
@ -332,7 +332,7 @@ void GameInterface::Ticker()
|
|||
for (int i = connecthead; i >= 0; i = connectpoint2[i])
|
||||
{
|
||||
const auto pPlayer = getPlayer(i);
|
||||
pPlayer->Angles.resetCameraAngles();
|
||||
pPlayer->resetCameraAngles();
|
||||
updatePlayerTarget(pPlayer);
|
||||
}
|
||||
|
||||
|
|
|
@ -80,7 +80,7 @@ void GameInterface::Render()
|
|||
{
|
||||
const auto pPlayer = getPlayer(nLocalPlayer);
|
||||
DrawStatusBar();
|
||||
auto offsets = pPlayer->Angles.getCrosshairOffsets(interpfrac);
|
||||
auto offsets = pPlayer->getCrosshairOffsets(interpfrac);
|
||||
DrawCrosshair(pPlayer->nHealth >> 3, offsets.first.X, offsets.first.Y, 1, offsets.second);
|
||||
|
||||
if (paused && !M_Active())
|
||||
|
|
|
@ -924,7 +924,7 @@ void DrawWeapons(DExhumedPlayer* const pPlayer, double interpfrac)
|
|||
|
||||
nPal = RemapPLU(nPal);
|
||||
|
||||
const auto weaponOffsets = pPlayer->Angles.getWeaponOffsets(interpfrac);
|
||||
const auto weaponOffsets = pPlayer->getWeaponOffsets(interpfrac);
|
||||
const auto nAngle = weaponOffsets.second;
|
||||
double xPos = 160 + weaponOffsets.first.X;
|
||||
double yPos = 100 + weaponOffsets.first.Y;
|
||||
|
|
|
@ -113,7 +113,6 @@ void InitPlayer()
|
|||
const auto pPlayer = getPlayer(i);
|
||||
|
||||
pPlayer->actor = nullptr;
|
||||
pPlayer->Angles = {};
|
||||
pPlayer->pPlayerPushSect = nullptr;
|
||||
pPlayer->pPlayerViewSect = nullptr;
|
||||
}
|
||||
|
@ -140,7 +139,6 @@ void InitPlayerInventory(DExhumedPlayer* const pPlayer)
|
|||
pPlayer->nPlayerSwear = 4;
|
||||
pPlayer->nLives = kDefaultLives;
|
||||
pPlayer->actor = nullptr;
|
||||
pPlayer->Angles = {};
|
||||
pPlayer->nRun = -1;
|
||||
pPlayer->nPistolClip = 6;
|
||||
pPlayer->nPlayerClip = 0;
|
||||
|
@ -189,7 +187,6 @@ void RestartPlayer(DExhumedPlayer* const pPlayer)
|
|||
ChangeActorStat(pPlayerActor, 0);
|
||||
|
||||
pPlayer->actor = nullptr;
|
||||
pPlayer->Angles = {};
|
||||
|
||||
if (pFloorSprite)
|
||||
DeleteActor(pFloorSprite);
|
||||
|
@ -271,7 +268,7 @@ void RestartPlayer(DExhumedPlayer* const pPlayer)
|
|||
pPlayer->pPlayerFloorSprite = pFloorSprite;
|
||||
pPlayer->pPlayerViewSect = pPlayer->sPlayerSave.pSector;
|
||||
pPlayer->nHealth = 800; // TODO - define
|
||||
pPlayer->Angles.initialize(pPlayerActor);
|
||||
pPlayer->InitAngles();
|
||||
pPlayer->bIsMummified = false;
|
||||
pPlayer->nTorch = 0;
|
||||
pPlayer->nMaskAmount = 0;
|
||||
|
@ -1097,8 +1094,8 @@ static void updatePlayerVelocity(DExhumedPlayer* const pPlayer)
|
|||
{
|
||||
pPlayerActor->vel.XY() += inputvect;
|
||||
pPlayerActor->vel.XY() *= 0.953125;
|
||||
pPlayer->Angles.StrafeVel += pInput->vel.Y * 0.375;
|
||||
pPlayer->Angles.StrafeVel *= 0.953125;
|
||||
pPlayer->StrafeVel += pInput->vel.Y * 0.375;
|
||||
pPlayer->StrafeVel *= 0.953125;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1106,7 +1103,7 @@ static void updatePlayerVelocity(DExhumedPlayer* const pPlayer)
|
|||
{
|
||||
pPlayerActor->vel.XY().Zero();
|
||||
pPlayer->nIdxBobZ = 0;
|
||||
pPlayer->Angles.StrafeVel = 0;
|
||||
pPlayer->StrafeVel = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1558,7 +1555,7 @@ static void doPlayerCameraEffects(DExhumedPlayer* const pPlayer, const double nD
|
|||
doPlayerVertPanning(pPlayer, nDestVertPan * cl_slopetilting);
|
||||
|
||||
// Roll tilting effect, either console or Quake-style.
|
||||
pPlayer->Angles.doRollInput(&pPlayer->cmd.ucmd, pPlayerActor->vel.XY(), maxVel, nUnderwater);
|
||||
pPlayer->doRollInput(&pPlayer->cmd.ucmd, pPlayerActor->vel.XY(), maxVel, nUnderwater);
|
||||
|
||||
// Update Z bobbing.
|
||||
if (cl_viewbob)
|
||||
|
@ -1817,9 +1814,9 @@ static bool doPlayerInput(DExhumedPlayer* const pPlayer)
|
|||
|
||||
// update player yaw here as per the original workflow.
|
||||
const auto pInput = &pPlayer->cmd.ucmd;
|
||||
pPlayer->Angles.doViewYaw(pInput);
|
||||
pPlayer->Angles.doYawInput(pInput);
|
||||
pPlayer->Angles.doPitchInput(pInput);
|
||||
pPlayer->doViewYaw(pInput);
|
||||
pPlayer->doYawInput(pInput);
|
||||
pPlayer->doPitchInput(pInput);
|
||||
|
||||
if (nMove.type || nMove.exbits)
|
||||
{
|
||||
|
|
|
@ -19,7 +19,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|||
#pragma once
|
||||
|
||||
#include "gamecontrol.h"
|
||||
#include "coreplayer.h"
|
||||
#include "gameinput.h"
|
||||
|
||||
BEGIN_PS_NS
|
||||
|
||||
|
@ -145,8 +145,8 @@ void updatePlayerTarget(DExhumedPlayer* const pPlayer);
|
|||
|
||||
inline void doPlayerVertPanning(DExhumedPlayer* const pPlayer, const double nDestVertPan)
|
||||
{
|
||||
const auto nVertPan = (nDestVertPan - pPlayer->Angles.ViewAngles.Pitch.Tan() * 128) * 0.25;
|
||||
pPlayer->Angles.ViewAngles.Pitch += maphoriz(abs(nVertPan) >= 4 ? Sgn(nVertPan) * 4. : nVertPan * 2.);
|
||||
const auto nVertPan = (nDestVertPan - pPlayer->ViewAngles.Pitch.Tan() * 128) * 0.25;
|
||||
pPlayer->ViewAngles.Pitch += maphoriz(abs(nVertPan) >= 4 ? Sgn(nVertPan) * 4. : nVertPan * 2.);
|
||||
}
|
||||
|
||||
END_PS_NS
|
||||
|
|
|
@ -79,7 +79,7 @@ void DrawView(double interpfrac, bool sceneonly)
|
|||
auto nDoppleOldCstat = pDop->spr.cstat;
|
||||
|
||||
// update render angles.
|
||||
pPlayer->Angles.updateCameraAngles(interpfrac);
|
||||
pPlayer->updateCameraAngles(interpfrac);
|
||||
|
||||
if (nSnakeCam >= 0 && !sceneonly)
|
||||
{
|
||||
|
@ -111,7 +111,7 @@ void DrawView(double interpfrac, bool sceneonly)
|
|||
updatesector(nCamerapos, &pSector);
|
||||
if (pSector == nullptr) pSector = pPlayer->pPlayerViewSect;
|
||||
|
||||
nCameraangles = pPlayer->Angles.getRenderAngles(interpfrac);
|
||||
nCameraangles = pPlayer->getRenderAngles(interpfrac);
|
||||
|
||||
if (!bCamera)
|
||||
{
|
||||
|
|
|
@ -802,7 +802,7 @@ static void analyzesprites(tspriteArray& tsprites, const DVector3& viewpos, doub
|
|||
}
|
||||
|
||||
tsp->pos = pos;
|
||||
tsp->Angles.Yaw = pp->Angles.getCameraAngles().Yaw;
|
||||
tsp->Angles.Yaw = pp->getCameraAngles().Yaw;
|
||||
//continue;
|
||||
}
|
||||
else
|
||||
|
@ -1012,7 +1012,7 @@ void PrintSpriteInfo(DSWPlayer* pp)
|
|||
|
||||
static void DrawCrosshair(DSWPlayer* pp, const double interpfrac)
|
||||
{
|
||||
auto offsets = pp->Angles.getCrosshairOffsets(interpfrac);
|
||||
auto offsets = pp->getCrosshairOffsets(interpfrac);
|
||||
::DrawCrosshair(pp->GetActor()->user.Health, offsets.first.X, offsets.first.Y + ((pp->Flags & PF_VIEW_FROM_OUTSIDE) ? 5 : 0), 2, offsets.second, shadeToLight(10));
|
||||
}
|
||||
|
||||
|
@ -1232,12 +1232,12 @@ void drawscreen(DSWPlayer* pp, double interpfrac, bool sceneonly)
|
|||
}
|
||||
|
||||
// update render angles.
|
||||
pp->Angles.updateCameraAngles(interpfrac);
|
||||
pp->updateCameraAngles(interpfrac);
|
||||
|
||||
// Get initial player position, interpolating if required.
|
||||
DVector3 tpos = camerapp->GetActor()->getRenderPos(interpfrac);
|
||||
DVector2 ampos = tpos.XY();
|
||||
DRotator tangles = camerapp->Angles.getRenderAngles(interpfrac);
|
||||
DRotator tangles = camerapp->getRenderAngles(interpfrac);
|
||||
sectortype* tsect = camerapp->cursector;
|
||||
|
||||
updatesector(tpos, &tsect);
|
||||
|
@ -1448,7 +1448,7 @@ bool GameInterface::DrawAutomapPlayer(const DVector2& mxy, const DVector2& cpos,
|
|||
|
||||
if (spnum >= 0)
|
||||
{
|
||||
const auto daang = -(pp->Angles.getCameraAngles().Yaw - cang).Normalized360().Degrees();
|
||||
const auto daang = -(pp->getCameraAngles().Yaw - cang).Normalized360().Degrees();
|
||||
auto vect = OutAutomapVector(mxy - cpos, cangvect, czoom, xydim);
|
||||
|
||||
// This repeat scale is correct.
|
||||
|
|
|
@ -628,7 +628,6 @@ void TerminateLevel(void)
|
|||
pp->DoPlayerAction = nullptr;
|
||||
|
||||
pp->actor = nullptr;
|
||||
pp->Angles = {};
|
||||
|
||||
pp->PlayerUnderActor = nullptr;
|
||||
|
||||
|
|
|
@ -45,7 +45,7 @@ Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms
|
|||
#include "gamecontrol.h"
|
||||
#include "gamestruct.h"
|
||||
#include "packet.h"
|
||||
#include "coreplayer.h"
|
||||
#include "gameinput.h"
|
||||
#include "serialize_obj.h"
|
||||
#include "texturemanager.h"
|
||||
#include "states.h"
|
||||
|
|
|
@ -1269,7 +1269,7 @@ int PlayerInitChemBomb(DSWPlayer* pp)
|
|||
if (pp->Flags & (PF_DIVING) || SpriteInUnderwaterArea(actorNew))
|
||||
actorNew->user.Flags |= (SPR_UNDERWATER);
|
||||
|
||||
setFreeAimVelocity(actorNew->vel.X, actorNew->vel.Z, pp->Angles.getPitchWithView(), HORIZ_MULTF);
|
||||
setFreeAimVelocity(actorNew->vel.X, actorNew->vel.Z, pp->getPitchWithView(), HORIZ_MULTF);
|
||||
|
||||
double oclipdist = plActor->clipdist;
|
||||
plActor->clipdist = 0;
|
||||
|
@ -1639,7 +1639,7 @@ int PlayerInitCaltrops(DSWPlayer* pp)
|
|||
if (pp->Flags & (PF_DIVING) || SpriteInUnderwaterArea(actorNew))
|
||||
actorNew->user.Flags |= (SPR_UNDERWATER);
|
||||
|
||||
setFreeAimVelocity(actorNew->vel.X, actorNew->vel.Z, pp->Angles.getPitchWithView(), HORIZ_MULTF);
|
||||
setFreeAimVelocity(actorNew->vel.X, actorNew->vel.Z, pp->getPitchWithView(), HORIZ_MULTF);
|
||||
|
||||
double oclipdist = plActor->clipdist;
|
||||
plActor->clipdist = 0;
|
||||
|
|
|
@ -2341,7 +2341,7 @@ void InitPlayerSprite(DSWPlayer* pp, const DVector3& spawnpos, const DAngle star
|
|||
pp->actor = actor;
|
||||
pp->pnum = pnum;
|
||||
|
||||
pp->Angles.initialize(pp->GetActor());
|
||||
pp->InitAngles();
|
||||
|
||||
actor->spr.cstat |= (CSTAT_SPRITE_BLOCK | CSTAT_SPRITE_BLOCK_HITSCAN);
|
||||
actor->spr.extra |= (SPRX_PLAYER_OR_ENEMY);
|
||||
|
|
|
@ -7375,7 +7375,7 @@ void pDisplaySprites(DSWPlayer* pp, double interpfrac)
|
|||
uint8_t pal = 0;
|
||||
int flags;
|
||||
|
||||
const auto offpair = pp->Angles.getWeaponOffsets(interpfrac);
|
||||
const auto offpair = pp->getWeaponOffsets(interpfrac);
|
||||
const auto offsets = offpair.first;
|
||||
|
||||
auto list = pp->GetPanelSpriteList();
|
||||
|
|
|
@ -1490,7 +1490,7 @@ void SlipSlope(DSWPlayer* pp)
|
|||
void DoPlayerSlopeTilting(DSWPlayer* pp)
|
||||
{
|
||||
const bool canslopetilt = (pp->cmd.ucmd.actions & SB_AIMMODE) && !(pp->Flags & (PF_FLYING|PF_SWIMMING|PF_DIVING|PF_CLIMBING|PF_JUMPING|PF_FALLING));
|
||||
pp->Angles.doViewPitch(canslopetilt, pp->Flags & PF_CLIMBING);
|
||||
pp->doViewPitch(canslopetilt, pp->Flags & PF_CLIMBING);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
@ -1850,8 +1850,8 @@ void DoPlayerMove(DSWPlayer* pp)
|
|||
|
||||
SlipSlope(pp);
|
||||
|
||||
pp->Angles.doViewYaw(&pp->cmd.ucmd);
|
||||
pp->Angles.doYawInput(&pp->cmd.ucmd);
|
||||
pp->doViewYaw(&pp->cmd.ucmd);
|
||||
pp->doYawInput(&pp->cmd.ucmd);
|
||||
UpdatePlayerSpriteAngle(pp);
|
||||
|
||||
pp->lastcursector = pp->cursector;
|
||||
|
@ -1864,10 +1864,10 @@ void DoPlayerMove(DSWPlayer* pp)
|
|||
DoPlayerSlide(pp);
|
||||
|
||||
pp->ovect = pp->vect;
|
||||
pp->Angles.PrevStrafeVel = pp->Angles.StrafeVel;
|
||||
pp->PrevStrafeVel = pp->StrafeVel;
|
||||
|
||||
pp->vect += pp->cmd.ucmd.vel.XY() * INPUT_SCALE;
|
||||
pp->Angles.StrafeVel += pp->svel * INPUT_SCALE;
|
||||
pp->StrafeVel += pp->svel * INPUT_SCALE;
|
||||
|
||||
friction = pp->friction;
|
||||
if (!(pp->Flags & PF_SWIMMING) && pp->WadeDepth)
|
||||
|
@ -1876,31 +1876,31 @@ void DoPlayerMove(DSWPlayer* pp)
|
|||
}
|
||||
|
||||
pp->vect *= FixedToFloat(friction);
|
||||
pp->Angles.StrafeVel *= FixedToFloat(friction);
|
||||
pp->StrafeVel *= FixedToFloat(friction);
|
||||
|
||||
if (pp->Flags & (PF_FLYING))
|
||||
{
|
||||
// do a bit of weighted averaging
|
||||
pp->vect = (pp->vect + (pp->ovect*1))/2;
|
||||
pp->Angles.StrafeVel = (pp->Angles.StrafeVel + (pp->Angles.PrevStrafeVel*1))/2;
|
||||
pp->StrafeVel = (pp->StrafeVel + (pp->PrevStrafeVel*1))/2;
|
||||
}
|
||||
else if (pp->Flags & (PF_DIVING))
|
||||
{
|
||||
// do a bit of weighted averaging
|
||||
pp->vect = (pp->vect + (pp->ovect*2))/3;
|
||||
pp->Angles.StrafeVel = (pp->Angles.StrafeVel + (pp->Angles.PrevStrafeVel*2))/3;
|
||||
pp->StrafeVel = (pp->StrafeVel + (pp->PrevStrafeVel*2))/3;
|
||||
}
|
||||
|
||||
if (abs(pp->vect.X) < 0.05 && abs(pp->vect.Y) < 0.05)
|
||||
{
|
||||
pp->vect.Zero();
|
||||
pp->Angles.StrafeVel = 0;
|
||||
pp->StrafeVel = 0;
|
||||
}
|
||||
|
||||
actor->vel.X = pp->vect.Length();
|
||||
|
||||
constexpr auto maxVel = (380401538. / 36022361.);
|
||||
pp->Angles.doRollInput(&pp->cmd.ucmd, pp->vect, maxVel, pp->Flags & (PF_SWIMMING|PF_DIVING));
|
||||
pp->doRollInput(&pp->cmd.ucmd, pp->vect, maxVel, pp->Flags & (PF_SWIMMING|PF_DIVING));
|
||||
|
||||
if (pp->Flags & (PF_CLIP_CHEAT))
|
||||
{
|
||||
|
@ -1981,7 +1981,7 @@ void DoPlayerMove(DSWPlayer* pp)
|
|||
DoPlayerSetWadeDepth(pp);
|
||||
|
||||
DoPlayerSlopeTilting(pp);
|
||||
pp->Angles.doPitchInput(&pp->cmd.ucmd);
|
||||
pp->doPitchInput(&pp->cmd.ucmd);
|
||||
|
||||
if (pp->insector() && (pp->cursector->extra & SECTFX_DYNAMIC_AREA))
|
||||
{
|
||||
|
@ -2567,7 +2567,7 @@ void DoPlayerMoveVehicle(DSWPlayer* pp)
|
|||
pp->cursector = save_sect; // for speed
|
||||
|
||||
DoPlayerSlopeTilting(pp);
|
||||
pp->Angles.doPitchInput(&pp->cmd.ucmd);
|
||||
pp->doPitchInput(&pp->cmd.ucmd);
|
||||
|
||||
DoTankTreads(pp);
|
||||
}
|
||||
|
@ -2623,7 +2623,7 @@ void DoPlayerMoveTurret(DSWPlayer* pp)
|
|||
pp->Flags |= (PF_PLAYER_MOVED);
|
||||
|
||||
DoPlayerSlopeTilting(pp);
|
||||
pp->Angles.doPitchInput(&pp->cmd.ucmd);
|
||||
pp->doPitchInput(&pp->cmd.ucmd);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
@ -3208,7 +3208,7 @@ void DoPlayerClimb(DSWPlayer* pp)
|
|||
ChangeActorSect(pp->GetActor(), pp->cursector);
|
||||
|
||||
DoPlayerSlopeTilting(pp);
|
||||
pp->Angles.doPitchInput(&pp->cmd.ucmd);
|
||||
pp->doPitchInput(&pp->cmd.ucmd);
|
||||
|
||||
if (FAF_ConnectArea(pp->cursector))
|
||||
{
|
||||
|
@ -6490,7 +6490,7 @@ void MoveSkipSavePos(void)
|
|||
{
|
||||
pp = getPlayer(pnum);
|
||||
|
||||
pp->Angles.resetCameraAngles();
|
||||
pp->resetCameraAngles();
|
||||
pp->GetActor()->backuploc();
|
||||
pp->obob_z = pp->bob_z;
|
||||
pp->opbob_amt = pp->pbob_amt;
|
||||
|
|
|
@ -11281,7 +11281,7 @@ int DoRing(DSWActor* actor)
|
|||
|
||||
// put it out there
|
||||
actor->spr.pos += actor->spr.Angles.Yaw.ToVector() * actor->user.Dist;
|
||||
if (pp) actor->spr.pos.Z -= actor->user.Dist * pp->Angles.getPitchWithView().Tan() * 2.; // horizon math sucks...
|
||||
if (pp) actor->spr.pos.Z -= actor->user.Dist * pp->getPitchWithView().Tan() * 2.; // horizon math sucks...
|
||||
|
||||
SetActor(actor, actor->spr.pos);
|
||||
|
||||
|
@ -11359,7 +11359,7 @@ void InitSpellRing(DSWPlayer* pp)
|
|||
|
||||
// put it out there
|
||||
actorNew->spr.pos += actorNew->spr.Angles.Yaw.ToVector() * actorNew->user.Dist;
|
||||
actorNew->spr.pos.Z += pp->GetActor()->getOffsetZ() + 20 - (actorNew->user.Dist * pp->Angles.getPitchWithView().Tan() * 2.); // horizon math sucks...
|
||||
actorNew->spr.pos.Z += pp->GetActor()->getOffsetZ() + 20 - (actorNew->user.Dist * pp->getPitchWithView().Tan() * 2.); // horizon math sucks...
|
||||
|
||||
actorNew->spr.Angles.Yaw += DAngle90;
|
||||
|
||||
|
@ -11731,7 +11731,7 @@ void InitSpellNapalm(DSWPlayer* pp)
|
|||
actor->spr.shade = -40;
|
||||
actor->spr.scale = DVector2(0.5, 0.5);
|
||||
actor->clipdist = 0;
|
||||
setFreeAimVelocity(actor->vel.X, actor->vel.Z, pp->Angles.getPitchWithView(), HORIZ_MULTF);
|
||||
setFreeAimVelocity(actor->vel.X, actor->vel.Z, pp->getPitchWithView(), HORIZ_MULTF);
|
||||
actor->spr.cstat |= (CSTAT_SPRITE_TRANSLUCENT | CSTAT_SPRITE_YCENTER);
|
||||
actor->spr.cstat &= ~(CSTAT_SPRITE_BLOCK | CSTAT_SPRITE_BLOCK_HITSCAN);
|
||||
actor->user.Flags2 |= (SPR2_BLUR_TAPER_FAST);
|
||||
|
@ -11861,7 +11861,7 @@ int InitSpellMirv(DSWPlayer* pp)
|
|||
actorNew->spr.shade = -40;
|
||||
actorNew->spr.scale = DVector2(1.125, 1.125);
|
||||
actorNew->clipdist = 2;
|
||||
setFreeAimVelocity(actorNew->vel.X, actorNew->vel.Z, pp->Angles.getPitchWithView(), HORIZ_MULTF);
|
||||
setFreeAimVelocity(actorNew->vel.X, actorNew->vel.Z, pp->getPitchWithView(), HORIZ_MULTF);
|
||||
actorNew->spr.cstat |= (CSTAT_SPRITE_TRANSLUCENT | CSTAT_SPRITE_YCENTER);
|
||||
actorNew->spr.cstat &= ~(CSTAT_SPRITE_BLOCK | CSTAT_SPRITE_BLOCK_HITSCAN);
|
||||
|
||||
|
@ -11996,7 +11996,7 @@ int InitSwordAttack(DSWPlayer* pp)
|
|||
|
||||
double dax = 1024., daz = 0;
|
||||
DAngle daang = pp->GetActor()->spr.Angles.Yaw;
|
||||
setFreeAimVelocity(dax, daz, pp->Angles.getPitchWithView(), 1000. - (RandomRangeF(24000 / 256.) - 12000 / 256.));
|
||||
setFreeAimVelocity(dax, daz, pp->getPitchWithView(), 1000. - (RandomRangeF(24000 / 256.) - 12000 / 256.));
|
||||
FAFhitscan(pp->GetActor()->getPosWithOffsetZ(), pp->cursector, DVector3(pp->GetActor()->spr.Angles.Yaw.ToVector() * dax, daz), hit, CLIPMASK_MISSILE);
|
||||
|
||||
if (hit.hitSector == nullptr)
|
||||
|
@ -12174,7 +12174,7 @@ int InitFistAttack(DSWPlayer* pp)
|
|||
HitInfo hit{};
|
||||
double dax = 1024., daz = 0;
|
||||
auto daang = pp->GetActor()->spr.Angles.Yaw;
|
||||
setFreeAimVelocity(dax, daz, pp->Angles.getPitchWithView(), 1000. - (RandomRangeF(24000 / 256.) - 12000 / 256.));
|
||||
setFreeAimVelocity(dax, daz, pp->getPitchWithView(), 1000. - (RandomRangeF(24000 / 256.) - 12000 / 256.));
|
||||
FAFhitscan(pp->GetActor()->getPosWithOffsetZ(), pp->cursector, DVector3(pp->GetActor()->spr.Angles.Yaw.ToVector() * dax, daz), hit, CLIPMASK_MISSILE);
|
||||
|
||||
if (hit.hitSector == nullptr)
|
||||
|
@ -12735,7 +12735,7 @@ int InitStar(DSWPlayer* pp)
|
|||
actorNew->clipdist = 2;
|
||||
// zvel was overflowing with this calculation - had to move to a local long var
|
||||
double zvel = 0;
|
||||
setFreeAimVelocity(actorNew->vel.X, zvel, pp->Angles.getPitchWithView(), (HORIZ_MULT + STAR_HORIZ_ADJ) * 0.5);
|
||||
setFreeAimVelocity(actorNew->vel.X, zvel, pp->getPitchWithView(), (HORIZ_MULT + STAR_HORIZ_ADJ) * 0.5);
|
||||
|
||||
actorNew->user.ceiling_dist = (1);
|
||||
actorNew->user.floor_dist = (1);
|
||||
|
@ -12835,7 +12835,7 @@ void InitHeartAttack(DSWPlayer* pp)
|
|||
actorNew->spr.shade = -10;
|
||||
actorNew->spr.scale = DVector2(0.8125, 0.8125);
|
||||
actorNew->clipdist = 0;
|
||||
setFreeAimVelocity(actorNew->vel.X, actorNew->vel.Z, pp->Angles.getPitchWithView(), HORIZ_MULTF);
|
||||
setFreeAimVelocity(actorNew->vel.X, actorNew->vel.Z, pp->getPitchWithView(), HORIZ_MULTF);
|
||||
actorNew->spr.cstat &= ~(CSTAT_SPRITE_BLOCK | CSTAT_SPRITE_BLOCK_HITSCAN);
|
||||
actorNew->user.Flags2 |= (SPR2_DONT_TARGET_OWNER);
|
||||
actorNew->spr.cstat |= (CSTAT_SPRITE_INVISIBLE);
|
||||
|
@ -12977,7 +12977,7 @@ int InitShotgun(DSWPlayer* pp)
|
|||
DAngle daang = DAngle22_5 * 0.5;
|
||||
if (WeaponAutoAimHitscan(pp->GetActor(), &daz, &daang, false) == nullptr)
|
||||
{
|
||||
setFreeAimVelocity(dax, daz, pp->Angles.getPitchWithView(), 1000.);
|
||||
setFreeAimVelocity(dax, daz, pp->getPitchWithView(), 1000.);
|
||||
daang = pp->GetActor()->spr.Angles.Yaw;
|
||||
}
|
||||
|
||||
|
@ -13139,7 +13139,7 @@ int InitLaser(DSWPlayer* pp)
|
|||
actorNew->clipdist = 4;
|
||||
|
||||
// the slower the missile travels the less of a zvel it needs
|
||||
setFreeAimVelocity(actorNew->vel.X, actorNew->vel.Z, pp->Angles.getPitchWithView(), 16.);
|
||||
setFreeAimVelocity(actorNew->vel.X, actorNew->vel.Z, pp->getPitchWithView(), 16.);
|
||||
|
||||
actorNew->user.WeaponNum = actor->user.WeaponNum;
|
||||
actorNew->user.Radius = 200;
|
||||
|
@ -13234,7 +13234,7 @@ int InitRail(DSWPlayer* pp)
|
|||
SetOwner(pp->GetActor(), actorNew);
|
||||
actorNew->spr.scale = DVector2(0.8125, 0.8125);
|
||||
actorNew->spr.shade = -15;
|
||||
setFreeAimVelocity(actorNew->vel.X, zvel, pp->Angles.getPitchWithView(), (HORIZ_MULT + 17) * 0.5);
|
||||
setFreeAimVelocity(actorNew->vel.X, zvel, pp->getPitchWithView(), (HORIZ_MULT + 17) * 0.5);
|
||||
|
||||
actorNew->user.__legacyState.RotNum = 5;
|
||||
NewStateGroup(actorNew, &sg_Rail[0]);
|
||||
|
@ -13398,7 +13398,7 @@ int InitRocket(DSWPlayer* pp)
|
|||
SetOwner(pp->GetActor(), actorNew);
|
||||
actorNew->spr.scale = DVector2(1.40626, 1.40625);
|
||||
actorNew->spr.shade = -15;
|
||||
setFreeAimVelocity(actorNew->vel.X, zvel, pp->Angles.getPitchWithView(), (HORIZ_MULT + 35) * 0.5);
|
||||
setFreeAimVelocity(actorNew->vel.X, zvel, pp->getPitchWithView(), (HORIZ_MULT + 35) * 0.5);
|
||||
|
||||
actorNew->clipdist = 4;
|
||||
|
||||
|
@ -13505,7 +13505,7 @@ int InitBunnyRocket(DSWPlayer* pp)
|
|||
SetOwner(pp->GetActor(), actorNew);
|
||||
actorNew->spr.scale = DVector2(1, 1);
|
||||
actorNew->spr.shade = -15;
|
||||
setFreeAimVelocity(actorNew->vel.X, zvel, pp->Angles.getPitchWithView(), (HORIZ_MULT + 35) * 0.5);
|
||||
setFreeAimVelocity(actorNew->vel.X, zvel, pp->getPitchWithView(), (HORIZ_MULT + 35) * 0.5);
|
||||
|
||||
actorNew->clipdist = 4;
|
||||
|
||||
|
@ -13607,7 +13607,7 @@ int InitNuke(DSWPlayer* pp)
|
|||
SetOwner(pp->GetActor(), actorNew);
|
||||
actorNew->spr.scale = DVector2(2, 2);
|
||||
actorNew->spr.shade = -15;
|
||||
setFreeAimVelocity(actorNew->vel.X, zvel, pp->Angles.getPitchWithView(), (HORIZ_MULT + 36) * 0.5);
|
||||
setFreeAimVelocity(actorNew->vel.X, zvel, pp->getPitchWithView(), (HORIZ_MULT + 36) * 0.5);
|
||||
actorNew->clipdist = 4;
|
||||
|
||||
// Set to red palette
|
||||
|
@ -13763,7 +13763,7 @@ int InitMicro(DSWPlayer* pp)
|
|||
return 0;
|
||||
|
||||
double vel = 75., zvel = 0;
|
||||
setFreeAimVelocity(vel, zvel, pp->Angles.getPitchWithView(), HORIZ_MULTF);
|
||||
setFreeAimVelocity(vel, zvel, pp->getPitchWithView(), HORIZ_MULTF);
|
||||
|
||||
for (i = 0; i < MAX_MICRO; i++)
|
||||
{
|
||||
|
@ -14968,7 +14968,7 @@ int InitTracerUzi(DSWPlayer* pp)
|
|||
|
||||
static const short lat_dist[] = {800,-800};
|
||||
|
||||
double nz = 8 + (pp->Angles.getPitchWithView().Tan() * 36.);
|
||||
double nz = 8 + (pp->getPitchWithView().Tan() * 36.);
|
||||
|
||||
// Spawn a shot
|
||||
// Inserting and setting up variables
|
||||
|
@ -15007,7 +15007,7 @@ int InitTracerUzi(DSWPlayer* pp)
|
|||
return 0;
|
||||
}
|
||||
|
||||
setFreeAimVelocity(actorNew->vel.X, actorNew->vel.Z, pp->Angles.getPitchWithView(), actorNew->vel.X);
|
||||
setFreeAimVelocity(actorNew->vel.X, actorNew->vel.Z, pp->getPitchWithView(), actorNew->vel.X);
|
||||
|
||||
plActor->clipdist = oclipdist;
|
||||
|
||||
|
@ -15272,7 +15272,7 @@ int InitUzi(DSWPlayer* pp)
|
|||
else
|
||||
{
|
||||
daang = pp->GetActor()->spr.Angles.Yaw + mapangle(RandomRange(24) - 12);
|
||||
setFreeAimVelocity(dax, daz, pp->Angles.getPitchWithView(), 1000. - (RandomRangeF(24000/256.) - 12000/256.));
|
||||
setFreeAimVelocity(dax, daz, pp->getPitchWithView(), 1000. - (RandomRangeF(24000/256.) - 12000/256.));
|
||||
}
|
||||
|
||||
DVector3 vect(daang.ToVector() * dax, daz);
|
||||
|
@ -15444,7 +15444,7 @@ int InitTankShell(DSWActor* actor, DSWPlayer* pp)
|
|||
actorNew->spr.cstat |= (CSTAT_SPRITE_YCENTER);
|
||||
actorNew->spr.cstat |= (CSTAT_SPRITE_INVISIBLE);
|
||||
|
||||
setFreeAimVelocity(actorNew->vel.X, actorNew->vel.Z, pp->Angles.getPitchWithView(), actorNew->vel.X);
|
||||
setFreeAimVelocity(actorNew->vel.X, actorNew->vel.Z, pp->getPitchWithView(), actorNew->vel.X);
|
||||
|
||||
WeaponAutoAim(actor, actorNew, DAngle22_5 / 2, false);
|
||||
// a bit of randomness
|
||||
|
@ -15512,7 +15512,7 @@ int InitTurretMicro(DSWActor* actor, DSWPlayer* pp)
|
|||
SetOwner(plActor, actorNew);
|
||||
actorNew->spr.scale = DVector2(0.375, 0.375);
|
||||
actorNew->spr.shade = -15;
|
||||
setFreeAimVelocity(actorNew->vel.X, actorNew->vel.Z, pp->Angles.getPitchWithView(), HORIZ_MULTF - RandomRangeF(8) + 5);
|
||||
setFreeAimVelocity(actorNew->vel.X, actorNew->vel.Z, pp->getPitchWithView(), HORIZ_MULTF - RandomRangeF(8) + 5);
|
||||
actorNew->clipdist = 4;
|
||||
|
||||
|
||||
|
@ -15581,7 +15581,7 @@ int InitTurretRocket(DSWActor* actor, DSWPlayer* pp)
|
|||
actorNew->user.Flags2 |= (SPR2_SO_MISSILE);
|
||||
actorNew->spr.cstat |= (CSTAT_SPRITE_YCENTER);
|
||||
|
||||
setFreeAimVelocity(actorNew->vel.X, actorNew->vel.Z, pp->Angles.getPitchWithView(), actorNew->vel.X);
|
||||
setFreeAimVelocity(actorNew->vel.X, actorNew->vel.Z, pp->getPitchWithView(), actorNew->vel.X);
|
||||
|
||||
WeaponAutoAim(actor, actorNew, DAngle22_5 / 2, false);
|
||||
// a bit of randomness
|
||||
|
@ -15620,7 +15620,7 @@ int InitTurretFireball(DSWActor* actor, DSWPlayer* pp)
|
|||
actorNew->user.Flags2 |= (SPR2_SO_MISSILE);
|
||||
actorNew->spr.cstat |= (CSTAT_SPRITE_YCENTER);
|
||||
|
||||
setFreeAimVelocity(actorNew->vel.X, actorNew->vel.Z, pp->Angles.getPitchWithView(), actorNew->vel.X);
|
||||
setFreeAimVelocity(actorNew->vel.X, actorNew->vel.Z, pp->getPitchWithView(), actorNew->vel.X);
|
||||
|
||||
WeaponAutoAim(actor, actorNew, DAngle22_5 / 2, false);
|
||||
// a bit of randomness
|
||||
|
@ -15657,7 +15657,7 @@ int InitTurretRail(DSWActor* actor, DSWPlayer* pp)
|
|||
SetOwner(pp->GetActor(), actorNew);
|
||||
actorNew->spr.scale = DVector2(0.8125, 0.8125);
|
||||
actorNew->spr.shade = -15;
|
||||
setFreeAimVelocity(actorNew->vel.X, actorNew->vel.Z, pp->Angles.getPitchWithView(), HORIZ_MULTF);
|
||||
setFreeAimVelocity(actorNew->vel.X, actorNew->vel.Z, pp->getPitchWithView(), HORIZ_MULTF);
|
||||
|
||||
actorNew->user.__legacyState.RotNum = 5;
|
||||
NewStateGroup(actorNew, &sg_Rail[0]);
|
||||
|
@ -15704,7 +15704,7 @@ int InitTurretLaser(DSWActor* actor, DSWPlayer* pp)
|
|||
actorNew->spr.shade = -15;
|
||||
|
||||
// the slower the missile travels the less of a zvel it needs
|
||||
setFreeAimVelocity(actorNew->vel.X, actorNew->vel.Z, pp->Angles.getPitchWithView(), 16.);
|
||||
setFreeAimVelocity(actorNew->vel.X, actorNew->vel.Z, pp->getPitchWithView(), 16.);
|
||||
|
||||
actorNew->user.Radius = 200;
|
||||
actorNew->user.ceiling_dist = (1);
|
||||
|
@ -15743,7 +15743,7 @@ int InitSobjMachineGun(DSWActor* actor, DSWPlayer* pp)
|
|||
double daz = npos.Z;
|
||||
|
||||
if (RANDOM_P2(1024) < 200)
|
||||
InitTracerTurret(actor, pp->GetActor(), pp->Angles.getPitchWithView());
|
||||
InitTracerTurret(actor, pp->GetActor(), pp->getPitchWithView());
|
||||
|
||||
DAngle daang = DAngle22_5 / 2;
|
||||
if (WeaponAutoAimHitscan(actor, &daz, &daang, false) != nullptr)
|
||||
|
@ -15752,7 +15752,7 @@ int InitSobjMachineGun(DSWActor* actor, DSWPlayer* pp)
|
|||
}
|
||||
else
|
||||
{
|
||||
setFreeAimVelocity(dax, daz, DAngle::fromDeg(min(pp->Angles.getPitchWithView().Degrees(), 11.0515)), 1000 - RandomRangeF(80) + 40);
|
||||
setFreeAimVelocity(dax, daz, DAngle::fromDeg(min(pp->getPitchWithView().Degrees(), 11.0515)), 1000 - RandomRangeF(80) + 40);
|
||||
daang = actor->spr.Angles.Yaw;
|
||||
}
|
||||
|
||||
|
@ -16442,7 +16442,7 @@ int InitGrenade(DSWPlayer* pp)
|
|||
if (pp->Flags & (PF_DIVING) || SpriteInUnderwaterArea(actorNew))
|
||||
actorNew->user.Flags |= (SPR_UNDERWATER);
|
||||
|
||||
setFreeAimVelocity(actorNew->vel.X, actorNew->vel.Z, pp->Angles.getPitchWithView(), HORIZ_MULTF);
|
||||
setFreeAimVelocity(actorNew->vel.X, actorNew->vel.Z, pp->getPitchWithView(), HORIZ_MULTF);
|
||||
|
||||
auto oclipdist = actor->clipdist;
|
||||
actor->clipdist = 0;
|
||||
|
@ -16558,7 +16558,7 @@ int InitMine(DSWPlayer* pp)
|
|||
actorNew->spr.scale = DVector2(0.5, 0.5);
|
||||
actorNew->spr.shade = -15;
|
||||
actorNew->clipdist = 8;
|
||||
setFreeAimVelocity(actorNew->vel.X, actorNew->vel.Z, pp->Angles.getPitchWithView(), HORIZ_MULTF);
|
||||
setFreeAimVelocity(actorNew->vel.X, actorNew->vel.Z, pp->getPitchWithView(), HORIZ_MULTF);
|
||||
actorNew->user.WeaponNum = actor->user.WeaponNum;
|
||||
actorNew->user.Radius = 200;
|
||||
actorNew->user.ceiling_dist = (5);
|
||||
|
@ -16693,7 +16693,7 @@ int InitFireball(DSWPlayer* pp)
|
|||
actorNew->user.ceiling_dist = (6);
|
||||
actorNew->user.floor_dist = (6);
|
||||
double zvel = 0.;
|
||||
setFreeAimVelocity(actorNew->vel.X, zvel, pp->Angles.getPitchWithView(), 120.);
|
||||
setFreeAimVelocity(actorNew->vel.X, zvel, pp->getPitchWithView(), 120.);
|
||||
|
||||
// at certain angles the clipping box was big enough to block the
|
||||
// initial positioning of the fireball.
|
||||
|
|
Loading…
Reference in a new issue