mirror of
https://github.com/DrBeef/Raze.git
synced 2024-11-15 17:01:51 +00:00
- floatified player input velocity.
This commit is contained in:
parent
b14ab1bde3
commit
f16f9b302f
6 changed files with 15 additions and 27 deletions
|
@ -374,10 +374,9 @@ void GameInterface::Ticker()
|
||||||
for (int i = 0; i < 4; i++)
|
for (int i = 0; i < 4; i++)
|
||||||
{
|
{
|
||||||
// Velocities are stored as Q14.18
|
// Velocities are stored as Q14.18
|
||||||
lPlayerXVel += int((localInput.fvel * inita.Cos() + localInput.svel * inita.Sin()) * 16384);
|
lPlayerVel.X += (localInput.fvel * inita.Cos() + localInput.svel * inita.Sin()) / 16.;
|
||||||
lPlayerYVel += int((localInput.fvel * inita.Sin() - localInput.svel * inita.Cos()) * 16384);
|
lPlayerVel.Y += (localInput.fvel * inita.Sin() - localInput.svel * inita.Cos()) / 16.;
|
||||||
lPlayerXVel -= (lPlayerXVel >> 5) + (lPlayerXVel >> 6);
|
lPlayerVel *= 0.953125;
|
||||||
lPlayerYVel -= (lPlayerYVel >> 5) + (lPlayerYVel >> 6);
|
|
||||||
}
|
}
|
||||||
UpdateInterpolations();
|
UpdateInterpolations();
|
||||||
|
|
||||||
|
@ -473,8 +472,7 @@ void GameInterface::Ticker()
|
||||||
sPlayerInput[nLocalPlayer].actions = localInput.actions;
|
sPlayerInput[nLocalPlayer].actions = localInput.actions;
|
||||||
if (oldactions & SB_CENTERVIEW) sPlayerInput[nLocalPlayer].actions |= SB_CENTERVIEW;
|
if (oldactions & SB_CENTERVIEW) sPlayerInput[nLocalPlayer].actions |= SB_CENTERVIEW;
|
||||||
|
|
||||||
sPlayerInput[nLocalPlayer].xVel = lPlayerXVel;
|
sPlayerInput[nLocalPlayer].vel = lPlayerVel;
|
||||||
sPlayerInput[nLocalPlayer].yVel = lPlayerYVel;
|
|
||||||
sPlayerInput[nLocalPlayer].buttons = lLocalCodes;
|
sPlayerInput[nLocalPlayer].buttons = lLocalCodes;
|
||||||
sPlayerInput[nLocalPlayer].pTarget = bestTarget;
|
sPlayerInput[nLocalPlayer].pTarget = bestTarget;
|
||||||
sPlayerInput[nLocalPlayer].nAngle = localInput.avel;
|
sPlayerInput[nLocalPlayer].nAngle = localInput.avel;
|
||||||
|
|
|
@ -191,8 +191,7 @@ void InitLevel(MapRecord* map)
|
||||||
ResetEngine();
|
ResetEngine();
|
||||||
totalmoves = 0;
|
totalmoves = 0;
|
||||||
GrabPalette();
|
GrabPalette();
|
||||||
lPlayerXVel = 0;
|
lPlayerVel.Zero();
|
||||||
lPlayerYVel = 0;
|
|
||||||
|
|
||||||
if (!mus_redbook && map->music.IsNotEmpty()) Mus_Play(map->music, true); // Allow non-CD music if defined for the current level
|
if (!mus_redbook && map->music.IsNotEmpty()) Mus_Play(map->music, true); // Allow non-CD music if defined for the current level
|
||||||
playCDtrack(map->cdSongId, true);
|
playCDtrack(map->cdSongId, true);
|
||||||
|
|
|
@ -79,8 +79,7 @@ void GameInterface::GetInput(ControlInfo* const hidInput, double const scaleAdju
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
lPlayerYVel = 0;
|
lPlayerVel.Zero();
|
||||||
lPlayerXVel = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!SyncInput())
|
if (!SyncInput())
|
||||||
|
|
|
@ -33,8 +33,7 @@ enum {
|
||||||
struct PlayerInput
|
struct PlayerInput
|
||||||
{
|
{
|
||||||
TObjPtr<DExhumedActor*> pTarget;
|
TObjPtr<DExhumedActor*> pTarget;
|
||||||
int xVel;
|
DVector2 vel;
|
||||||
int yVel;
|
|
||||||
uint16_t buttons;
|
uint16_t buttons;
|
||||||
float nAngle;
|
float nAngle;
|
||||||
float pan;
|
float pan;
|
||||||
|
|
|
@ -42,8 +42,7 @@ BEGIN_PS_NS
|
||||||
|
|
||||||
extern int nStatusSeqOffset;
|
extern int nStatusSeqOffset;
|
||||||
|
|
||||||
int lPlayerXVel = 0;
|
DVector2 lPlayerVel;
|
||||||
int lPlayerYVel = 0;
|
|
||||||
int obobangle = 0, bobangle = 0;
|
int obobangle = 0, bobangle = 0;
|
||||||
|
|
||||||
static actionSeq PlayerSeq[] = {
|
static actionSeq PlayerSeq[] = {
|
||||||
|
@ -858,7 +857,7 @@ bool CheckMovingBlocks(int nPlayer, Collision& nMove, DVector3& spr_pos, sectort
|
||||||
{
|
{
|
||||||
PlayerList[nPlayer].pPlayerPushSect = sect;
|
PlayerList[nPlayer].pPlayerPushSect = sect;
|
||||||
|
|
||||||
DVector2 vel(FixedToFloat<18>(sPlayerInput[nPlayer].xVel), FixedToFloat<18>(sPlayerInput[nPlayer].yVel));
|
DVector2 vel = sPlayerInput[nPlayer].vel;
|
||||||
auto nMyAngle = VecToAngle(vel).Normalized360();
|
auto nMyAngle = VecToAngle(vel).Normalized360();
|
||||||
|
|
||||||
setsectinterpolate(sect);
|
setsectinterpolate(sect);
|
||||||
|
@ -915,8 +914,7 @@ void AIPlayer::Tick(RunListEvent* ev)
|
||||||
PlayerList[nPlayer].horizon.resetadjustment();
|
PlayerList[nPlayer].horizon.resetadjustment();
|
||||||
PlayerList[nPlayer].oeyelevel = PlayerList[nPlayer].eyelevel;
|
PlayerList[nPlayer].oeyelevel = PlayerList[nPlayer].eyelevel;
|
||||||
|
|
||||||
pPlayerActor->vel.X = FixedToFloat<18>(sPlayerInput[nPlayer].xVel);
|
pPlayerActor->vel.XY() = sPlayerInput[nPlayer].vel;
|
||||||
pPlayerActor->vel.Y = FixedToFloat<18>(sPlayerInput[nPlayer].yVel);
|
|
||||||
|
|
||||||
if (sPlayerInput[nPlayer].nItem > -1)
|
if (sPlayerInput[nPlayer].nItem > -1)
|
||||||
{
|
{
|
||||||
|
@ -1013,7 +1011,7 @@ void AIPlayer::Tick(RunListEvent* ev)
|
||||||
|
|
||||||
auto playerPos = pPlayerActor->spr.pos.XY();
|
auto playerPos = pPlayerActor->spr.pos.XY();
|
||||||
|
|
||||||
DVector2 vect(FixedToFloat<18>(sPlayerInput[nPlayer].xVel), FixedToFloat<18>(sPlayerInput[nPlayer].yVel));
|
DVector2 vect = sPlayerInput[nPlayer].vel;
|
||||||
double zz = pPlayerActor->vel.Z;
|
double zz = pPlayerActor->vel.Z;
|
||||||
|
|
||||||
if (pPlayerActor->vel.Z > 32)
|
if (pPlayerActor->vel.Z > 32)
|
||||||
|
@ -1084,12 +1082,9 @@ void AIPlayer::Tick(RunListEvent* ev)
|
||||||
|
|
||||||
PlayerList[nPlayer].horizon.settarget(buildhoriz(0), true);
|
PlayerList[nPlayer].horizon.settarget(buildhoriz(0), true);
|
||||||
|
|
||||||
lPlayerXVel = 0;
|
lPlayerVel.Zero();
|
||||||
lPlayerYVel = 0;
|
|
||||||
|
|
||||||
pPlayerActor->vel.X = 0;
|
pPlayerActor->vel.Zero();
|
||||||
pPlayerActor->vel.Y = 0;
|
|
||||||
pPlayerActor->vel.Z = 0;
|
|
||||||
|
|
||||||
if (nFreeze < 1)
|
if (nFreeze < 1)
|
||||||
{
|
{
|
||||||
|
@ -2753,8 +2748,7 @@ void SerializePlayer(FSerializer& arc)
|
||||||
{
|
{
|
||||||
if (arc.BeginObject("player"))
|
if (arc.BeginObject("player"))
|
||||||
{
|
{
|
||||||
arc("lxvel", lPlayerXVel)
|
arc("lvel", lPlayerVel)
|
||||||
("lyvel", lPlayerYVel)
|
|
||||||
("bobangle", bobangle)
|
("bobangle", bobangle)
|
||||||
("standheight", nStandHeight)
|
("standheight", nStandHeight)
|
||||||
("playercount", PlayerCount)
|
("playercount", PlayerCount)
|
||||||
|
|
|
@ -40,8 +40,7 @@ enum
|
||||||
|
|
||||||
extern int nLocalPlayer;
|
extern int nLocalPlayer;
|
||||||
|
|
||||||
extern int lPlayerXVel;
|
extern DVector2 lPlayerVel;
|
||||||
extern int lPlayerYVel;
|
|
||||||
|
|
||||||
struct PlayerSave
|
struct PlayerSave
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue