mirror of
https://github.com/ZDoom/Raze.git
synced 2025-02-07 15:31:11 +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);
|
void CheckSectorFloor(sectortype* pSector, double z, DVector2& xy);
|
||||||
int GetAngleToSprite(DExhumedActor* nSprite1, DExhumedActor* nSprite2);
|
int GetAngleToSprite(DExhumedActor* nSprite1, DExhumedActor* nSprite2);
|
||||||
int GetWallNormal(walltype* nWall);
|
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);
|
Collision AngleChase(DExhumedActor* nSprite, DExhumedActor* nSprite2, int ebx, int ecx, int push1);
|
||||||
void SetQuake(DExhumedActor* nSprite, int nVal);
|
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) {
|
if (pSector == nullptr) {
|
||||||
return;
|
return;
|
||||||
|
@ -696,7 +696,7 @@ void MoveSector(sectortype* pSector, DAngle nAngle, int *nXVel, int *nYVel)
|
||||||
|
|
||||||
if (nAngle < nullAngle)
|
if (nAngle < nullAngle)
|
||||||
{
|
{
|
||||||
nVect = { FixedToFloat<18>(*nXVel), FixedToFloat<18>(*nYVel) };
|
nVect = nVel;
|
||||||
nAngle = VecToAngle(nVect);
|
nAngle = VecToAngle(nVect);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -863,8 +863,7 @@ void MoveSector(sectortype* pSector, DAngle nAngle, int *nXVel, int *nYVel)
|
||||||
pSector->setfloorz(nZVal);
|
pSector->setfloorz(nZVal);
|
||||||
}
|
}
|
||||||
|
|
||||||
*nXVel = FloatToFixed<18>(vect.X);
|
nVel = vect;
|
||||||
*nYVel = FloatToFixed<18>(vect.Y);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Update player position variables, in case the player sprite was moved by a sector,
|
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:
|
// loc_2393A:
|
||||||
if (sMoveSect[i].pCurSector != nullptr)
|
if (sMoveSect[i].pCurSector != nullptr)
|
||||||
{
|
{
|
||||||
MoveSector(sMoveSect[i].pCurSector, -minAngle, &nXVel, &nYVel);
|
MoveSector(sMoveSect[i].pCurSector, -minAngle, vel);
|
||||||
}
|
}
|
||||||
int var_2C = nXVel;
|
auto ovel = vel;
|
||||||
int var_30 = nYVel;
|
|
||||||
|
|
||||||
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, ovel);
|
||||||
MoveSector(sMoveSect[i].pCurSector, -minAngle, &nXVel, &nYVel);
|
MoveSector(sMoveSect[i].pCurSector, -minAngle, vel);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -749,12 +749,11 @@ bool CheckMovingBlocks(int nPlayer, Collision& nMove, DVector3& spr_pos, sectort
|
||||||
{
|
{
|
||||||
PlayerList[nPlayer].pPlayerPushSect = sect;
|
PlayerList[nPlayer].pPlayerPushSect = sect;
|
||||||
|
|
||||||
int xvel = sPlayerInput[nPlayer].xVel;
|
DVector2 vel(FixedToFloat<18>(sPlayerInput[nPlayer].xVel), FixedToFloat<18>(sPlayerInput[nPlayer].yVel));
|
||||||
int yvel = sPlayerInput[nPlayer].yVel;
|
auto nMyAngle = VecToAngle(vel).Normalized360();
|
||||||
int nMyAngle = getangle(xvel, yvel) & 2047; // note: must be positive!
|
|
||||||
|
|
||||||
setsectinterpolate(sect);
|
setsectinterpolate(sect);
|
||||||
MoveSector(sect, DAngle::fromBuild(nMyAngle), &xvel, &yvel);
|
MoveSector(sect, nMyAngle, vel);
|
||||||
|
|
||||||
if (PlayerList[nPlayer].nPlayerPushSound <= -1)
|
if (PlayerList[nPlayer].nPlayerPushSound <= -1)
|
||||||
{
|
{
|
||||||
|
@ -770,7 +769,7 @@ bool CheckMovingBlocks(int nPlayer, Collision& nMove, DVector3& spr_pos, sectort
|
||||||
ChangeActorSect(pPlayerActor, spr_sect);
|
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;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue