- calcChaseCamPos(): Restore original algorithms for new position via GameInterface struct.

* Averaging out the values was a net negative for all games. Each games' original value is tuned to the specific games.
This commit is contained in:
Mitchell Richters 2021-02-16 21:48:59 +11:00
parent ba57429ac6
commit cff97c9cf3
5 changed files with 17 additions and 3 deletions

View file

@ -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;

View file

@ -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()
{

View file

@ -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;
};

View file

@ -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; }
};

View file

@ -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;