mirror of
https://github.com/ZDoom/Raze.git
synced 2025-01-18 22:51:50 +00:00
- Exhumed: Replace original chasecam code with calcChaseCamPos()
within game.
This commit is contained in:
parent
cff97c9cf3
commit
1d48ac537a
3 changed files with 36 additions and 34 deletions
|
@ -254,6 +254,9 @@ struct GameInterface : ::GameInterface
|
||||||
int playerKeyMove() override { return 6; }
|
int playerKeyMove() override { return 6; }
|
||||||
void WarpToCoords(int x, int y, int z, int a, int h) override;
|
void WarpToCoords(int x, int y, int z, int a, int h) override;
|
||||||
void ToggleThirdPerson() override;
|
void ToggleThirdPerson() override;
|
||||||
|
int chaseCamX(binangle ang) { return -ang.bcos() / 12; }
|
||||||
|
int chaseCamY(binangle ang) { return -ang.bsin() / 12; }
|
||||||
|
int chaseCamZ(fixedhoriz horiz) { return horiz.asq16() / 384; }
|
||||||
|
|
||||||
::GameStats getStats() override;
|
::GameStats getStats() override;
|
||||||
};
|
};
|
||||||
|
|
|
@ -30,6 +30,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
#include "input.h"
|
#include "input.h"
|
||||||
#include "cheathandler.h"
|
#include "cheathandler.h"
|
||||||
#include "gamestate.h"
|
#include "gamestate.h"
|
||||||
|
#include "gamefuncs.h"
|
||||||
#include "mmulti.h"
|
#include "mmulti.h"
|
||||||
|
|
||||||
BEGIN_PS_NS
|
BEGIN_PS_NS
|
||||||
|
@ -108,6 +109,8 @@ void GameInterface::ToggleThirdPerson()
|
||||||
if (bCamera)
|
if (bCamera)
|
||||||
{
|
{
|
||||||
GrabPalette();
|
GrabPalette();
|
||||||
|
cameradist = 0;
|
||||||
|
cameraclock = INT_MIN;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,6 +18,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
#include "ns.h"
|
#include "ns.h"
|
||||||
#include "compat.h"
|
#include "compat.h"
|
||||||
#include "engine.h"
|
#include "engine.h"
|
||||||
|
#include "gamefuncs.h"
|
||||||
#include "names.h"
|
#include "names.h"
|
||||||
#include "view.h"
|
#include "view.h"
|
||||||
#include "status.h"
|
#include "status.h"
|
||||||
|
@ -247,11 +248,13 @@ void DrawView(double smoothRatio, bool sceneonly)
|
||||||
|
|
||||||
if (!SyncInput())
|
if (!SyncInput())
|
||||||
{
|
{
|
||||||
|
pan = PlayerList[nLocalPlayer].horizon.sum();
|
||||||
nAngle = PlayerList[nLocalPlayer].angle.sum();
|
nAngle = PlayerList[nLocalPlayer].angle.sum();
|
||||||
rotscrnang = PlayerList[nLocalPlayer].angle.rotscrnang;
|
rotscrnang = PlayerList[nLocalPlayer].angle.rotscrnang;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
pan = PlayerList[nLocalPlayer].horizon.interpolatedsum(smoothRatio);
|
||||||
nAngle = PlayerList[nLocalPlayer].angle.interpolatedsum(smoothRatio);
|
nAngle = PlayerList[nLocalPlayer].angle.interpolatedsum(smoothRatio);
|
||||||
rotscrnang = PlayerList[nLocalPlayer].angle.interpolatedrotscrn(smoothRatio);
|
rotscrnang = PlayerList[nLocalPlayer].angle.interpolatedrotscrn(smoothRatio);
|
||||||
}
|
}
|
||||||
|
@ -261,51 +264,44 @@ void DrawView(double smoothRatio, bool sceneonly)
|
||||||
sprite[nPlayerSprite].cstat |= CSTAT_SPRITE_INVISIBLE;
|
sprite[nPlayerSprite].cstat |= CSTAT_SPRITE_INVISIBLE;
|
||||||
sprite[nDoppleSprite[nLocalPlayer]].cstat |= CSTAT_SPRITE_INVISIBLE;
|
sprite[nDoppleSprite[nLocalPlayer]].cstat |= CSTAT_SPRITE_INVISIBLE;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
sprite[nPlayerSprite].cstat |= CSTAT_SPRITE_TRANSLUCENT;
|
||||||
|
sprite[nDoppleSprite[nLocalPlayer]].cstat |= CSTAT_SPRITE_INVISIBLE;
|
||||||
|
}
|
||||||
|
|
||||||
renderSetRollAngle(rotscrnang.asbuildf());
|
renderSetRollAngle(rotscrnang.asbuildf());
|
||||||
|
|
||||||
|
pan = q16horiz(clamp(pan.asq16(), gi->playerHorizMin(), gi->playerHorizMax()));
|
||||||
}
|
}
|
||||||
|
|
||||||
nCameraa = nAngle;
|
nCameraa = nAngle;
|
||||||
|
|
||||||
if (!bCamera || nFreeze || sceneonly)
|
if (nSnakeCam >= 0 && !sceneonly)
|
||||||
{
|
{
|
||||||
if (nSnakeCam >= 0 && !sceneonly)
|
|
||||||
{
|
|
||||||
pan = q16horiz(0);
|
|
||||||
viewz = playerZ;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
viewz = playerZ + nQuake[nLocalPlayer];
|
|
||||||
int floorZ = sector[sprite[nPlayerSprite].sectnum].floorz;
|
|
||||||
|
|
||||||
if (!SyncInput())
|
|
||||||
{
|
|
||||||
pan = PlayerList[nLocalPlayer].horizon.sum();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
pan = PlayerList[nLocalPlayer].horizon.interpolatedsum(smoothRatio);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (viewz > floorZ)
|
|
||||||
viewz = floorZ;
|
|
||||||
|
|
||||||
nCameraa += buildang((nQuake[nLocalPlayer] >> 7) % 31);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
clipmove_old((int32_t*)&playerX, (int32_t*)&playerY, (int32_t*)&playerZ, &nSector,
|
|
||||||
-2000 * nAngle.bcos(),
|
|
||||||
-2000 * nAngle.bsin(),
|
|
||||||
4, 0, 0, CLIPMASK1);
|
|
||||||
|
|
||||||
pan = q16horiz(0);
|
pan = q16horiz(0);
|
||||||
viewz = playerZ;
|
viewz = playerZ;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
viewz = playerZ + nQuake[nLocalPlayer];
|
||||||
|
int floorZ = sector[sprite[nPlayerSprite].sectnum].floorz;
|
||||||
|
|
||||||
pan = q16horiz(clamp(pan.asq16(), gi->playerHorizMin(), gi->playerHorizMax()));
|
if (viewz > floorZ)
|
||||||
|
viewz = floorZ;
|
||||||
|
|
||||||
|
nCameraa += buildang((nQuake[nLocalPlayer] >> 7) % 31);
|
||||||
|
|
||||||
|
if (bCamera)
|
||||||
|
{
|
||||||
|
viewz -= 2560;
|
||||||
|
if (!calcChaseCamPos(&playerX, &playerY, &viewz, &sprite[nPlayerSprite], &nSector, nAngle, pan, smoothRatio))
|
||||||
|
{
|
||||||
|
viewz += 2560;
|
||||||
|
calcChaseCamPos(&playerX, &playerY, &viewz, &sprite[nPlayerSprite], &nSector, nAngle, pan, smoothRatio);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
nCamerax = playerX;
|
nCamerax = playerX;
|
||||||
nCameray = playerY;
|
nCameray = playerY;
|
||||||
|
|
Loading…
Reference in a new issue