mirror of
https://github.com/ZDoom/Raze.git
synced 2025-02-20 18:42:26 +00:00
- Exhumed: Floatify nQuake[]
array.
This commit is contained in:
parent
953364b96b
commit
e84a0f3245
6 changed files with 17 additions and 35 deletions
|
@ -775,7 +775,7 @@ loc_flag:
|
|||
case kWeaponM60:
|
||||
{
|
||||
if (nWeapon == kWeaponM60) { // hack(?) to do fallthrough from kWeapon3 into kWeaponPistol without doing the nQuake[] change
|
||||
nQuake[nPlayer] = 128;
|
||||
nQuake[nPlayer] = 0.5;
|
||||
}
|
||||
// fall through
|
||||
[[fallthrough]];
|
||||
|
@ -812,7 +812,7 @@ loc_flag:
|
|||
case kWeaponStaff:
|
||||
{
|
||||
BuildSnake(nPlayer, nHeight);
|
||||
nQuake[nPlayer] = 512;
|
||||
nQuake[nPlayer] = 2.;
|
||||
|
||||
PlayerList[nPlayer].nDamage.X -= bcos(pPlayerActor->int_ang(), 9);
|
||||
PlayerList[nPlayer].nDamage.Y -= bsin(pPlayerActor->int_ang(), 9);
|
||||
|
|
|
@ -1047,39 +1047,20 @@ void MoveSector(sectortype* pSector, int nAngle, int *nXVel, int *nYVel)
|
|||
|
||||
void SetQuake(DExhumedActor* pActor, int nVal)
|
||||
{
|
||||
int x = pActor->int_pos().X;
|
||||
int y = pActor->int_pos().Y;
|
||||
|
||||
nVal *= 256;
|
||||
|
||||
for (int i = 0; i < nTotalPlayers; i++)
|
||||
{
|
||||
auto pPlayerActor = PlayerList[i].pActor;
|
||||
|
||||
|
||||
uint32_t xDiff = abs((int32_t)((pPlayerActor->int_pos().X - x) >> 8));
|
||||
uint32_t yDiff = abs((int32_t)((pPlayerActor->int_pos().Y - y) >> 8));
|
||||
|
||||
uint32_t sqrtNum = xDiff * xDiff + yDiff * yDiff;
|
||||
|
||||
if (sqrtNum > INT_MAX)
|
||||
{
|
||||
DPrintf(DMSG_WARNING, "%s %d: overflow\n", __func__, __LINE__);
|
||||
sqrtNum = INT_MAX;
|
||||
}
|
||||
|
||||
int nSqrt = ksqrt(sqrtNum);
|
||||
|
||||
int eax = nVal;
|
||||
auto nSqrt = ((PlayerList[i].pActor->spr.pos.XY() - pActor->spr.pos.XY()) * (1. / 16.)).Length();
|
||||
double eax = nVal;
|
||||
|
||||
if (nSqrt)
|
||||
{
|
||||
eax = eax / nSqrt;
|
||||
|
||||
if (eax >= 256)
|
||||
if (eax >= 1)
|
||||
{
|
||||
if (eax > 3840) {
|
||||
eax = 3840;
|
||||
if (eax > 15)
|
||||
{
|
||||
eax = 15;
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -1088,7 +1069,8 @@ void SetQuake(DExhumedActor* pActor, int nVal)
|
|||
}
|
||||
}
|
||||
|
||||
if (eax > nQuake[i]) {
|
||||
if (eax > nQuake[i])
|
||||
{
|
||||
nQuake[i] = eax;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1509,7 +1509,7 @@ void DoFinale()
|
|||
PlayFX2(StaticSound[kSound78] | 0x2000, pFinaleSpr);
|
||||
|
||||
for (int i = 0; i < nTotalPlayers; i++) {
|
||||
nQuake[i] = 1280;
|
||||
nQuake[i] = 5.;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -815,7 +815,7 @@ void AIPlayer::Tick(RunListEvent* ev)
|
|||
nQuake[nPlayer] = -nQuake[nPlayer];
|
||||
if (nQuake[nPlayer] > 0)
|
||||
{
|
||||
nQuake[nPlayer] -= 512;
|
||||
nQuake[nPlayer] -= 2.;
|
||||
if (nQuake[nPlayer] < 0)
|
||||
nQuake[nPlayer] = 0;
|
||||
}
|
||||
|
@ -1080,7 +1080,7 @@ sectdone:
|
|||
|
||||
auto pViewSect = pPlayerActor->sector();
|
||||
|
||||
double EyeZ = PlayerList[nPlayer].eyelevel + pPlayerActor->spr.pos.Z + nQuake[nPlayer] * zinttoworld;
|
||||
double EyeZ = PlayerList[nPlayer].eyelevel + pPlayerActor->spr.pos.Z + nQuake[nPlayer];
|
||||
|
||||
while (1)
|
||||
{
|
||||
|
|
|
@ -40,7 +40,7 @@ int16_t dVertPan[kMaxPlayers];
|
|||
DVector3 nCamerapos;
|
||||
bool bTouchFloor;
|
||||
|
||||
int16_t nQuake[kMaxPlayers] = { 0 };
|
||||
double nQuake[kMaxPlayers] = { 0 };
|
||||
|
||||
int nChunkTotal = 0;
|
||||
|
||||
|
@ -252,8 +252,8 @@ void DrawView(double interpfrac, bool sceneonly)
|
|||
}
|
||||
else
|
||||
{
|
||||
nCamerapos.Z = min(nCamerapos.Z + nQuake[nLocalPlayer] * zinttoworld, pPlayerActor->sector()->floorz);
|
||||
nCameraang += DAngle::fromBam((nQuake[nLocalPlayer] % 4095) << 14);
|
||||
nCamerapos.Z = min(nCamerapos.Z + nQuake[nLocalPlayer], pPlayerActor->sector()->floorz);
|
||||
nCameraang += DAngle::fromDeg(fmod(nQuake[nLocalPlayer], 16.) * (45. / 128.));
|
||||
|
||||
if (bCamera)
|
||||
{
|
||||
|
|
|
@ -32,7 +32,7 @@ void NoClip();
|
|||
void Clip();
|
||||
|
||||
extern int16_t dVertPan[];
|
||||
extern int16_t nQuake[];
|
||||
extern double nQuake[];
|
||||
extern DVector3 nCamerapos;
|
||||
extern bool bTouchFloor;
|
||||
extern int nChunkTotal;
|
||||
|
|
Loading…
Reference in a new issue