diff --git a/d2common/d2fileformats/d2cof/helpers.go b/d2common/d2fileformats/d2cof/helpers.go new file mode 100644 index 00000000..0cc7f73b --- /dev/null +++ b/d2common/d2fileformats/d2cof/helpers.go @@ -0,0 +1,16 @@ +package d2cof + +// SpeedToFPS returns FPS value basing on cof's speed +func (c *COF) SpeedToFPS() float64 { + const ( + baseFPS = 25 + speedDivisor = 256 + ) + + fps := baseFPS * (float64(c.Speed) / speedDivisor) + if fps == 0 { + fps = baseFPS + } + + return fps +}