Skip to content

Commit

Permalink
Replace Win7 option with GameFps option
Browse files Browse the repository at this point in the history
  • Loading branch information
fhelwanger committed Apr 19, 2021
1 parent 209adcc commit b6bd1d8
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 7 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ Instead of editing the source code directly, the settings can be changed by edit
"AcceptDelayFrame": 3, // Number of frames after selecting "Play" that RNG additions stop
"Prompt": "> ", // The prompt string to display
"Interactive": false, // If should prompt for parameters in case they're not supplied
"Win7": false // If should apply some settings to work better on Win7
"GameFps": 60 // 61 for Windows 7
}
```

Expand Down
2 changes: 1 addition & 1 deletion settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@
"AcceptDelayFrame": 3,
"Prompt": "> ",
"Interactive": false,
"Win7": false
"GameFps": 60
}
2 changes: 1 addition & 1 deletion src/Options.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public class Options
public int AcceptDelayFrame { get; set; } = 3;
public string Prompt { get; set; } = "> ";
public bool Interactive { get; set; } = false;
public bool Win7 { get; set; } = false;
public float GameFps { get; set; } = 60;

public enum TOrder
{
Expand Down
7 changes: 3 additions & 4 deletions src/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -218,10 +218,10 @@ static uint RareTimer(uint state, Player player)
var fps = _options.ConsoleFps;

var start = DateTime.Now.SecondsSinceEpoch();
var delay = _options.DelayFrame / 60f;
var delay = _options.DelayFrame / _options.GameFps;

var incr = 0U;
var incrStart = delay - (_options.ForcedIncr / 60f);
var incrStart = delay - (_options.ForcedIncr / _options.GameFps);
var timerWidth = 8;
var width = Math.Min(Console.WindowWidth - 1 - timerWidth, 60);

Expand All @@ -234,8 +234,7 @@ static uint RareTimer(uint state, Player player)
var duration = DateTime.Now.SecondsSinceEpoch() - start;

incr = (uint)Math.Max(
// jester reported that it works better as 63 on Win7
Math.Round((duration - incrStart) * (_options.Win7 ? 63 : 60)),
Math.Round((duration - incrStart) * _options.GameFps),
_options.ForcedIncr + _options.AcceptDelayFrame
);

Expand Down

0 comments on commit b6bd1d8

Please sign in to comment.