Skip to content

Commit

Permalink
Didn't realize these macros all existed in ninja.h :V
Browse files Browse the repository at this point in the history
  • Loading branch information
michael-fadely committed Oct 27, 2015
1 parent f6821a3 commit 65b0314
Showing 1 changed file with 6 additions and 16 deletions.
22 changes: 6 additions & 16 deletions SADXModLoader/FixFOV.cpp
@@ -1,7 +1,5 @@
#include "stdafx.h"

#include <d3dx8math.h> // for D3DX_PI

#include "include/d3d8types.h"
#include "SADXModLoader.h"

Expand All @@ -14,20 +12,12 @@ DataPointer(float, ClippingRelated, 0x03D0F9E0);
DataPointer(int, HorizontalFOV_BAMS, 0x03AB98EC);
DataPointer(int, LastHorizontalFOV_BAMS, 0x03B2CBB4);

#define BAMS2DEG(bams) (bams / (65536.0 / 360.0))
#define BAMS2RAD(bams) (bams * 0.000095873802)
#define DEG2BAMS(deg) ((int)(deg * (65536.0 / 360.0)))
#define DEG2RAD(deg) (deg * (D3DX_PI / 180.0))
#define RAD2BAMS(rad) ((int)(rad * (65536.0 / (D3DX_PI * 2))))
#define RAD2DEG(rad) (rad * (180.0 / D3DX_PI))

const int bams_default = 12743;

int fov_bams;
int last_bams = bams_default;
static const int bams_default = 12743;
static int last_bams = bams_default;
static int fov_bams;

double fov_rads;
double fov_scale = 1.0;
static double fov_rads;
static double fov_scale = 1.0;

static void __cdecl SetClippingRelatedThing_hook(int bams)
{
Expand Down Expand Up @@ -114,7 +104,7 @@ void ConfigureFOV()
return;

fov_rads = 0.96712852; // 55.412382 degrees
fov_bams = RAD2BAMS(fov_rads);
fov_bams = NJM_RAD_ANG(fov_rads);

WriteJump(SetHorizontalFOV_BAMS, SetHorizontalFOV_BAMS_hook);
WriteJump(GetHorizontalFOV_BAMS, GetHorizontalFOV_BAMS_hook);
Expand Down

0 comments on commit 65b0314

Please sign in to comment.