mirror of
https://github.com/ZDoom/Raze.git
synced 2025-02-21 11:01:01 +00:00
- Exhumed: Convert draw code to floating point.
This commit is contained in:
parent
7d5040f560
commit
36ed1ac1de
1 changed files with 15 additions and 32 deletions
|
@ -49,7 +49,6 @@ fixedhoriz nCamerapan;
|
||||||
int nViewTop;
|
int nViewTop;
|
||||||
bool bCamera = false;
|
bool bCamera = false;
|
||||||
|
|
||||||
int viewz;
|
|
||||||
|
|
||||||
|
|
||||||
// We cannot drag these through the entire event system... :(
|
// We cannot drag these through the entire event system... :(
|
||||||
|
@ -181,9 +180,6 @@ void DrawView(double smoothRatio, bool sceneonly)
|
||||||
{
|
{
|
||||||
DExhumedActor* pEnemy = nullptr;
|
DExhumedActor* pEnemy = nullptr;
|
||||||
int nEnemyPal = -1;
|
int nEnemyPal = -1;
|
||||||
int playerX;
|
|
||||||
int playerY;
|
|
||||||
int playerZ;
|
|
||||||
sectortype* pSector = nullptr;
|
sectortype* pSector = nullptr;
|
||||||
DAngle nAngle, rotscrnang;
|
DAngle nAngle, rotscrnang;
|
||||||
fixedhoriz pan = {};
|
fixedhoriz pan = {};
|
||||||
|
@ -199,9 +195,7 @@ void DrawView(double smoothRatio, bool sceneonly)
|
||||||
{
|
{
|
||||||
DExhumedActor* pActor = SnakeList[nSnakeCam].pSprites[0];
|
DExhumedActor* pActor = SnakeList[nSnakeCam].pSprites[0];
|
||||||
|
|
||||||
playerX = pActor->int_pos().X;
|
nCamera = pActor->spr.pos;
|
||||||
playerY = pActor->int_pos().Y;
|
|
||||||
playerZ = pActor->int_pos().Z;
|
|
||||||
pSector = pActor->sector();
|
pSector = pActor->sector();
|
||||||
nAngle = pActor->spr.angle;
|
nAngle = pActor->spr.angle;
|
||||||
rotscrnang = nullAngle;
|
rotscrnang = nullAngle;
|
||||||
|
@ -222,12 +216,10 @@ void DrawView(double smoothRatio, bool sceneonly)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
playerX = pPlayerActor->__interpolatedx(smoothRatio);
|
nCamera = pPlayerActor->interpolatedvec3(smoothRatio * (1. / MaxSmoothRatio)).plusZ(interpolatedvaluef(PlayerList[nLocalPlayer].oeyelevel, PlayerList[nLocalPlayer].eyelevel, smoothRatio) * zinttoworld);
|
||||||
playerY = pPlayerActor->__interpolatedy(smoothRatio);
|
|
||||||
playerZ = pPlayerActor->__interpolatedz(smoothRatio) + interpolatedvalue(PlayerList[nLocalPlayer].oeyelevel, PlayerList[nLocalPlayer].eyelevel, smoothRatio);
|
|
||||||
|
|
||||||
pSector = PlayerList[nLocalPlayer].pPlayerViewSect;
|
pSector = PlayerList[nLocalPlayer].pPlayerViewSect;
|
||||||
updatesector(playerX, playerY, &pSector);
|
updatesector(nCamera, &pSector);
|
||||||
if (pSector == nullptr) pSector = PlayerList[nLocalPlayer].pPlayerViewSect;
|
if (pSector == nullptr) pSector = PlayerList[nLocalPlayer].pPlayerViewSect;
|
||||||
|
|
||||||
if (!SyncInput())
|
if (!SyncInput())
|
||||||
|
@ -261,42 +253,35 @@ void DrawView(double smoothRatio, bool sceneonly)
|
||||||
if (nSnakeCam >= 0 && !sceneonly)
|
if (nSnakeCam >= 0 && !sceneonly)
|
||||||
{
|
{
|
||||||
pan = q16horiz(0);
|
pan = q16horiz(0);
|
||||||
viewz = playerZ;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
viewz = playerZ + nQuake[nLocalPlayer];
|
nCamera.Z = min(nCamera.Z + nQuake[nLocalPlayer] * zinttoworld, pPlayerActor->sector()->floorz);
|
||||||
int floorZ = pPlayerActor->sector()->int_floorz();
|
|
||||||
|
|
||||||
if (viewz > floorZ)
|
|
||||||
viewz = floorZ;
|
|
||||||
|
|
||||||
nCameraa += DAngle::fromBuild((nQuake[nLocalPlayer] >> 7) % 31);
|
nCameraa += DAngle::fromBuild((nQuake[nLocalPlayer] >> 7) % 31);
|
||||||
|
|
||||||
if (bCamera)
|
if (bCamera)
|
||||||
{
|
{
|
||||||
viewz -= 2560;
|
nCamera.Z -= 10;
|
||||||
if (!calcChaseCamPos(&playerX, &playerY, &viewz, pPlayerActor, &pSector, nAngle, pan, smoothRatio))
|
if (!calcChaseCamPos(nCamera, pPlayerActor, &pSector, nAngle, pan, smoothRatio))
|
||||||
{
|
{
|
||||||
viewz += 2560;
|
nCamera.Z += 10;
|
||||||
calcChaseCamPos(&playerX, &playerY, &viewz, pPlayerActor, &pSector, nAngle, pan, smoothRatio);
|
calcChaseCamPos(nCamera, pPlayerActor, &pSector, nAngle, pan, smoothRatio);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
nCamera = DVector3(playerX * inttoworld, playerY * inttoworld, playerZ * zinttoworld);
|
|
||||||
|
|
||||||
if (pSector != nullptr)
|
if (pSector != nullptr)
|
||||||
{
|
{
|
||||||
int Z = pSector->int_ceilingz() + 256;
|
double Z = pSector->ceilingz + 1;
|
||||||
if (Z <= viewz)
|
if (Z <= nCamera.Z)
|
||||||
{
|
{
|
||||||
Z = pSector->int_floorz() - 256;
|
Z = pSector->floorz - 1;
|
||||||
|
|
||||||
if (Z < viewz)
|
if (Z < nCamera.Z)
|
||||||
viewz = Z;
|
nCamera.Z = Z;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
viewz = Z;
|
nCamera.Z = Z;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -305,7 +290,6 @@ void DrawView(double smoothRatio, bool sceneonly)
|
||||||
if (nFreeze == 2 || nFreeze == 1)
|
if (nFreeze == 2 || nFreeze == 1)
|
||||||
{
|
{
|
||||||
nSnakeCam = -1;
|
nSnakeCam = -1;
|
||||||
//???
|
|
||||||
viewport3d = { 0, 0, screen->GetWidth(), screen->GetHeight() };
|
viewport3d = { 0, 0, screen->GetWidth(), screen->GetHeight() };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -336,7 +320,7 @@ void DrawView(double smoothRatio, bool sceneonly)
|
||||||
|
|
||||||
if (!nFreeze && !sceneonly)
|
if (!nFreeze && !sceneonly)
|
||||||
DrawWeapons(smoothRatio);
|
DrawWeapons(smoothRatio);
|
||||||
render_drawrooms(nullptr, vec3_t( int(nCamera.X * worldtoint), int(nCamera.Y * worldtoint), viewz ), sectnum(pSector), nCameraa, nCamerapan, rotscrnang, smoothRatio);
|
render_drawrooms(nullptr, nCamera, sectnum(pSector), nCameraa, nCamerapan, rotscrnang, smoothRatio);
|
||||||
|
|
||||||
if (HavePLURemap())
|
if (HavePLURemap())
|
||||||
{
|
{
|
||||||
|
@ -456,7 +440,6 @@ void SerializeView(FSerializer& arc)
|
||||||
("cameraa", nCameraa)
|
("cameraa", nCameraa)
|
||||||
("camerapan", nCamerapan)
|
("camerapan", nCamerapan)
|
||||||
("camera", bCamera)
|
("camera", bCamera)
|
||||||
("viewz", viewz)
|
|
||||||
.Array("vertpan", dVertPan, countof(dVertPan))
|
.Array("vertpan", dVertPan, countof(dVertPan))
|
||||||
.Array("quake", nQuake, countof(nQuake))
|
.Array("quake", nQuake, countof(nQuake))
|
||||||
.EndObject();
|
.EndObject();
|
||||||
|
|
Loading…
Reference in a new issue