mirror of
https://github.com/ZDoom/Raze.git
synced 2025-01-18 22:51:50 +00:00
- floatified MoveSector's API.
This commit is contained in:
parent
03c183d827
commit
b777517789
4 changed files with 14 additions and 19 deletions
|
@ -230,7 +230,7 @@ int PlotCourseToSprite(DExhumedActor* nSprite1, DExhumedActor* nSprite2);
|
|||
void CheckSectorFloor(sectortype* pSector, double z, DVector2& xy);
|
||||
int GetAngleToSprite(DExhumedActor* nSprite1, DExhumedActor* nSprite2);
|
||||
int GetWallNormal(walltype* nWall);
|
||||
void MoveSector(sectortype* pSector, DAngle nAngle, int *nXVel, int *nYVel);
|
||||
void MoveSector(sectortype* pSector, DAngle nAngle, DVector2& vel);
|
||||
Collision AngleChase(DExhumedActor* nSprite, DExhumedActor* nSprite2, int ebx, int ecx, int push1);
|
||||
void SetQuake(DExhumedActor* nSprite, int nVal);
|
||||
|
||||
|
|
|
@ -686,7 +686,7 @@ void CreatePushBlock(sectortype* pSector)
|
|||
}
|
||||
|
||||
|
||||
void MoveSector(sectortype* pSector, DAngle nAngle, int *nXVel, int *nYVel)
|
||||
void MoveSector(sectortype* pSector, DAngle nAngle, DVector2& nVel)
|
||||
{
|
||||
if (pSector == nullptr) {
|
||||
return;
|
||||
|
@ -696,7 +696,7 @@ void MoveSector(sectortype* pSector, DAngle nAngle, int *nXVel, int *nYVel)
|
|||
|
||||
if (nAngle < nullAngle)
|
||||
{
|
||||
nVect = { FixedToFloat<18>(*nXVel), FixedToFloat<18>(*nYVel) };
|
||||
nVect = nVel;
|
||||
nAngle = VecToAngle(nVect);
|
||||
}
|
||||
else
|
||||
|
@ -863,8 +863,7 @@ void MoveSector(sectortype* pSector, DAngle nAngle, int *nXVel, int *nYVel)
|
|||
pSector->setfloorz(nZVal);
|
||||
}
|
||||
|
||||
*nXVel = FloatToFixed<18>(vect.X);
|
||||
*nYVel = FloatToFixed<18>(vect.Y);
|
||||
nVel = vect;
|
||||
|
||||
/*
|
||||
Update player position variables, in case the player sprite was moved by a sector,
|
||||
|
|
|
@ -2348,23 +2348,20 @@ void DoMovingSects()
|
|||
}
|
||||
}
|
||||
|
||||
int nXVel = FloatToFixed<18>(vel.X);
|
||||
int nYVel = FloatToFixed<18>(vel.Y);
|
||||
|
||||
// loc_2393A:
|
||||
if (sMoveSect[i].pCurSector != nullptr)
|
||||
{
|
||||
MoveSector(sMoveSect[i].pCurSector, -minAngle, &nXVel, &nYVel);
|
||||
MoveSector(sMoveSect[i].pCurSector, -minAngle, vel);
|
||||
}
|
||||
int var_2C = nXVel;
|
||||
int var_30 = nYVel;
|
||||
auto ovel = vel;
|
||||
|
||||
MoveSector(pSector, -minAngle, &nXVel, &nYVel);
|
||||
MoveSector(pSector, -minAngle, vel);
|
||||
|
||||
if (sMoveSect[i].pCurSector != nullptr && (nXVel != var_2C || nYVel != var_30))
|
||||
if (sMoveSect[i].pCurSector != nullptr && vel != ovel)
|
||||
{
|
||||
MoveSector(sMoveSect[i].pCurSector, -minAngle, &var_2C, &var_30);
|
||||
MoveSector(sMoveSect[i].pCurSector, -minAngle, &nXVel, &nYVel);
|
||||
MoveSector(sMoveSect[i].pCurSector, -minAngle, ovel);
|
||||
MoveSector(sMoveSect[i].pCurSector, -minAngle, vel);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -749,12 +749,11 @@ bool CheckMovingBlocks(int nPlayer, Collision& nMove, DVector3& spr_pos, sectort
|
|||
{
|
||||
PlayerList[nPlayer].pPlayerPushSect = sect;
|
||||
|
||||
int xvel = sPlayerInput[nPlayer].xVel;
|
||||
int yvel = sPlayerInput[nPlayer].yVel;
|
||||
int nMyAngle = getangle(xvel, yvel) & 2047; // note: must be positive!
|
||||
DVector2 vel(FixedToFloat<18>(sPlayerInput[nPlayer].xVel), FixedToFloat<18>(sPlayerInput[nPlayer].yVel));
|
||||
auto nMyAngle = VecToAngle(vel).Normalized360();
|
||||
|
||||
setsectinterpolate(sect);
|
||||
MoveSector(sect, DAngle::fromBuild(nMyAngle), &xvel, &yvel);
|
||||
MoveSector(sect, nMyAngle, vel);
|
||||
|
||||
if (PlayerList[nPlayer].nPlayerPushSound <= -1)
|
||||
{
|
||||
|
@ -770,7 +769,7 @@ bool CheckMovingBlocks(int nPlayer, Collision& nMove, DVector3& spr_pos, sectort
|
|||
ChangeActorSect(pPlayerActor, spr_sect);
|
||||
}
|
||||
|
||||
movesprite(pPlayerActor, xvel, yvel, z, 5120, -5120, CLIPMASK0);
|
||||
movesprite(pPlayerActor, FloatToFixed<18>(vel.X), FloatToFixed<18>(vel.Y), z, 5120, -5120, CLIPMASK0);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue