Skip to content

Commit

Permalink
switch to floats for FPS
Browse files Browse the repository at this point in the history
  • Loading branch information
xan1242 committed Feb 19, 2023
1 parent cceec45 commit 305a1b6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions NFSMW_XenonEffects.ini
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@ LimitSparkRate = 1
; Min = 0, Max = target game FPS (by default it's 60, this is the same value as SimRate in Widescreen Fix)
; Closer the value is to 0, the effects will have less density
[Limits]
ContrailTargetFPS = 30
SparkTargetFPS = 30
ContrailTargetFPS = 30.0
SparkTargetFPS = 30.0
12 changes: 6 additions & 6 deletions dllmain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ bool bContrails = true;
bool bLimitContrailRate = true;
bool bLimitSparkRate = true;
bool bNISContrails = false;
uint32_t ContrailTargetFPS = 30;
uint32_t SparkTargetFPS = 30;
float ContrailTargetFPS = 30.0f;
float SparkTargetFPS = 30.0f;
float ContrailSpeed = 44.0f;

uint32_t ContrailFrameDelay = 1;
Expand Down Expand Up @@ -2817,15 +2817,15 @@ void InitConfig()
bLimitContrailRate = inireader.ReadInteger("MAIN", "LimitContrailRate", 1) != 0;
bLimitSparkRate = inireader.ReadInteger("MAIN", "LimitSparkRate", 1) != 0;

ContrailTargetFPS = inireader.ReadInteger("Limits", "ContrailTargetFPS", 30);
SparkTargetFPS = inireader.ReadInteger("Limits", "SparkTargetFPS", 30);
ContrailTargetFPS = inireader.ReadFloat("Limits", "ContrailTargetFPS", 30.0f);
SparkTargetFPS = inireader.ReadFloat("Limits", "SparkTargetFPS", 30.0f);

static float fGameTargetFPS = 1.0f / GetTargetFrametime();

static float fContrailFrameDelay = (fGameTargetFPS / (float)ContrailTargetFPS);
static float fContrailFrameDelay = (fGameTargetFPS / ContrailTargetFPS);
ContrailFrameDelay = (uint32_t)round(fContrailFrameDelay);

static float fSparkFrameDelay = (fGameTargetFPS / (float)SparkTargetFPS);
static float fSparkFrameDelay = (fGameTargetFPS / SparkTargetFPS);
SparkFrameDelay = (uint32_t)round(fSparkFrameDelay);
}

Expand Down

0 comments on commit 305a1b6

Please sign in to comment.