diff --git a/source/core/gamefuncs.cpp b/source/core/gamefuncs.cpp index 884968943..ac81b680f 100644 --- a/source/core/gamefuncs.cpp +++ b/source/core/gamefuncs.cpp @@ -21,6 +21,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. //------------------------------------------------------------------------- #include "gamefuncs.h" +#include "gamestruct.h" //--------------------------------------------------------------------------- @@ -41,9 +42,9 @@ bool calcChaseCamPos(int* px, int* py, int* pz, spritetype* pspr, short *psectnu assert(*psectnum >= 0 && *psectnum < MAXSECTORS); // Calculate new pos to shoot backwards, using averaged values from the big three. - int nx = xs_CRoundToInt(-ang.fcos() * (4352. / 3.)); - int ny = xs_CRoundToInt(-ang.fsin() * (4352. / 3.)); - int nz = xs_CRoundToInt(horiz.asq16() * (17. / 6144.)); + int nx = gi->chaseCamX(ang); + int ny = gi->chaseCamY(ang); + int nz = gi->chaseCamZ(horiz); vec3_t pvect = { *px, *py, *pz }; bakcstat = pspr->cstat; diff --git a/source/core/gamestruct.h b/source/core/gamestruct.h index b52257b4c..66359440e 100644 --- a/source/core/gamestruct.h +++ b/source/core/gamestruct.h @@ -7,6 +7,7 @@ bool System_WantGuiCapture(); // During playing this tells us whether the game m #include "engineerrors.h" #include "stats.h" #include "packet.h" +#include "binaryangle.h" #include "inputstate.h" class FSerializer; @@ -97,6 +98,9 @@ struct GameInterface virtual void ToggleThirdPerson() { } virtual void SwitchCoopView() { Printf("Unsupported command\n"); } virtual void ToggleShowWeapon() { Printf("Unsupported command\n"); } + virtual int chaseCamX(binangle ang) { return 0; } + virtual int chaseCamY(binangle ang) { return 0; } + virtual int chaseCamZ(fixedhoriz horiz) { return 0; } virtual FString statFPS() { diff --git a/source/games/blood/src/blood.h b/source/games/blood/src/blood.h index 5892dd8ac..2154cbf29 100644 --- a/source/games/blood/src/blood.h +++ b/source/games/blood/src/blood.h @@ -131,6 +131,9 @@ struct GameInterface : ::GameInterface void ToggleThirdPerson() override; void SwitchCoopView() override; void ToggleShowWeapon() override; + int chaseCamX(binangle ang) { return MulScale(-Cos(ang.asbuild()), 1280, 30); } + int chaseCamY(binangle ang) { return MulScale(-Sin(ang.asbuild()), 1280, 30); } + int chaseCamZ(fixedhoriz horiz) { return FixedToInt(MulScale(horiz.asq16(), 1280, 3)) - (16 << 8); } GameStats getStats() override; }; diff --git a/source/games/duke/src/duke3d.h b/source/games/duke/src/duke3d.h index 20af59207..d117348d0 100644 --- a/source/games/duke/src/duke3d.h +++ b/source/games/duke/src/duke3d.h @@ -62,6 +62,9 @@ struct GameInterface : public ::GameInterface void ToggleThirdPerson() override; void SwitchCoopView() override; void ToggleShowWeapon() override; + int chaseCamX(binangle ang) { return -ang.bcos(-4); } + int chaseCamY(binangle ang) { return -ang.bsin(-4); } + int chaseCamZ(fixedhoriz horiz) { return horiz.asq16() >> 9; } }; diff --git a/source/games/sw/src/game.h b/source/games/sw/src/game.h index d0f8051ce..125f6f3ad 100644 --- a/source/games/sw/src/game.h +++ b/source/games/sw/src/game.h @@ -2251,6 +2251,9 @@ struct GameInterface : ::GameInterface void WarpToCoords(int x, int y, int z, int a, int h) override; void ToggleThirdPerson() override; void SwitchCoopView() override; + int chaseCamX(binangle ang) { return -ang.bcos(-3); } + int chaseCamY(binangle ang) { return -ang.bsin(-3); } + int chaseCamZ(fixedhoriz horiz) { return horiz.asq16() >> 8; } GameStats getStats() override;