diff --git a/Source/controls/controller_motion.cpp b/Source/controls/controller_motion.cpp index 8eba8b2b8..f98eda242 100644 --- a/Source/controls/controller_motion.cpp +++ b/Source/controls/controller_motion.cpp @@ -76,16 +76,16 @@ bool SimulateRightStickWithDpad(ControllerButtonEvent ctrlEvent) return false; switch (ctrlEvent.button) { case ControllerButton_BUTTON_DPAD_LEFT: - rightStickX = ctrlEvent.up ? 0 : -1; + rightStickX = ctrlEvent.up ? 0.F : -1.F; break; case ControllerButton_BUTTON_DPAD_RIGHT: - rightStickX = ctrlEvent.up ? 0 : 1; + rightStickX = ctrlEvent.up ? 0.F : 1.F; break; case ControllerButton_BUTTON_DPAD_UP: - rightStickY = ctrlEvent.up ? 0 : 1; + rightStickY = ctrlEvent.up ? 0.F : 1.F; break; case ControllerButton_BUTTON_DPAD_DOWN: - rightStickY = ctrlEvent.up ? 0 : -1; + rightStickY = ctrlEvent.up ? 0.F : -1.F; break; default: return false; diff --git a/Source/engine/animationinfo.cpp b/Source/engine/animationinfo.cpp index 8174a261a..5d165afb2 100644 --- a/Source/engine/animationinfo.cpp +++ b/Source/engine/animationinfo.cpp @@ -61,15 +61,15 @@ float AnimationInfo::GetAnimationProgress() const if (RelevantFramesForDistributing <= 0) { // This logic is used if animation distrubtion is not active (see GetFrameToUseForRendering). // In this case the variables calculated with animation distribution are not initialized and we have to calculate them on the fly with the given information. - float ticksPerFrame = (TicksPerFrame + 1); - float totalTicksForCurrentAnimationSequence = GetProgressToNextGameTick() + (float)CurrentFrame + (TickCounterOfCurrentFrame / ticksPerFrame); - float fAnimationFraction = totalTicksForCurrentAnimationSequence / ((float)NumberOfFrames * ticksPerFrame); + float ticksPerFrame = TicksPerFrame + 1.F; + float totalTicksForCurrentAnimationSequence = GetProgressToNextGameTick() + CurrentFrame + (TickCounterOfCurrentFrame / ticksPerFrame); + float fAnimationFraction = totalTicksForCurrentAnimationSequence / (NumberOfFrames * ticksPerFrame); return fAnimationFraction; } - float totalTicksForCurrentAnimationSequence = GetProgressToNextGameTick() + (float)TicksSinceSequenceStarted; + float totalTicksForCurrentAnimationSequence = GetProgressToNextGameTick() + TicksSinceSequenceStarted; float fProgressInAnimationFrames = totalTicksForCurrentAnimationSequence * TickModifier; - float fAnimationFraction = fProgressInAnimationFrames / (float)NumberOfFrames; + float fAnimationFraction = fProgressInAnimationFrames / NumberOfFrames; return fAnimationFraction; } diff --git a/Source/options.cpp b/Source/options.cpp index 4364de5a8..384ff8121 100644 --- a/Source/options.cpp +++ b/Source/options.cpp @@ -207,7 +207,7 @@ void LoadOptions() GetIniValue("Controller", "Mapping", sgOptions.Controller.szMapping, sizeof(sgOptions.Controller.szMapping), ""); sgOptions.Controller.bSwapShoulderButtonMode = GetIniBool("Controller", "Swap Shoulder Button Mode", false); sgOptions.Controller.bDpadHotkeys = GetIniBool("Controller", "Dpad Hotkeys", false); - sgOptions.Controller.fDeadzone = GetIniFloat("Controller", "deadzone", 0.07); + sgOptions.Controller.fDeadzone = GetIniFloat("Controller", "deadzone", 0.07F); #ifdef __vita__ sgOptions.Controller.bRearTouch = GetIniBool("Controller", "Enable Rear Touchpad", true); #endif diff --git a/Source/player.cpp b/Source/player.cpp index 567288b5a..83957e5f4 100644 --- a/Source/player.cpp +++ b/Source/player.cpp @@ -1106,7 +1106,7 @@ void AddPlrExperience(int pnum, int lvl, int exp) } // Adjust xp based on difference in level between player and monster - exp *= 1 + ((double)lvl - player._pLevel) / 10; + exp = static_cast(exp * (1 + (lvl - player._pLevel) / 10.0)); if (exp < 0) { exp = 0; } diff --git a/Source/storm/storm_svid.cpp b/Source/storm/storm_svid.cpp index c6f2bcb28..74972274b 100644 --- a/Source/storm/storm_svid.cpp +++ b/Source/storm/storm_svid.cpp @@ -244,7 +244,7 @@ bool SVidPlayBegin(const char *filename, int flags) ErrSdl(); } - SVidFrameEnd = SDL_GetTicks() * 1000 + SVidFrameLength; + SVidFrameEnd = SDL_GetTicks() * 1000.0 + SVidFrameLength; SDL_FillRect(GetOutputSurface(), nullptr, 0x000000); return true; } @@ -275,7 +275,7 @@ bool SVidPlayContinue() } } - if (SDL_GetTicks() * 1000 >= SVidFrameEnd) { + if (SDL_GetTicks() * 1000.0 >= SVidFrameEnd) { return SVidLoadNextFrame(); // Skip video and audio if the system is to slow } @@ -291,7 +291,7 @@ bool SVidPlayContinue() } #endif - if (SDL_GetTicks() * 1000 >= SVidFrameEnd) { + if (SDL_GetTicks() * 1000.0 >= SVidFrameEnd) { return SVidLoadNextFrame(); // Skip video if the system is to slow } @@ -349,9 +349,9 @@ bool SVidPlayContinue() RenderPresent(); - double now = SDL_GetTicks() * 1000; + double now = SDL_GetTicks() * 1000.0; if (now < SVidFrameEnd) { - SDL_Delay((SVidFrameEnd - now) / 1000); // wait with next frame if the system is too fast + SDL_Delay(static_cast((SVidFrameEnd - now) / 1000.0)); // wait with next frame if the system is too fast } return SVidLoadNextFrame(); diff --git a/Source/utils/push_aulib_decoder.cpp b/Source/utils/push_aulib_decoder.cpp index fa3cf0e20..cea18553b 100644 --- a/Source/utils/push_aulib_decoder.cpp +++ b/Source/utils/push_aulib_decoder.cpp @@ -68,7 +68,7 @@ int PushAulibDecoder::doDecoding(float buf[], int len, bool &callAgain) callAgain = false; const auto writeFloats = [&buf](const std::int16_t *samples, unsigned count) { - constexpr float Scale = std::numeric_limits::max() + 1; + constexpr float Scale = std::numeric_limits::max() + 1.F; for (unsigned i = 0; i < count; ++i) { buf[i] = static_cast(samples[i]) / Scale; } diff --git a/Source/utils/soundsample.cpp b/Source/utils/soundsample.cpp index 7076d4771..1f1269daa 100644 --- a/Source/utils/soundsample.cpp +++ b/Source/utils/soundsample.cpp @@ -37,15 +37,15 @@ constexpr float VolumeScale = 3321.9281; * Min and max volume range, in millibel. * -100 dB (muted) to 0 dB (max. loudness). */ -constexpr float MillibelMin = -10000.0; -constexpr float MillibelMax = 0.0; +constexpr float MillibelMin = -10000.F; +constexpr float MillibelMax = 0.F; /** * Stereo separation factor for left/right speaker panning. Lower values increase separation, moving * sounds further left/right, while higher values will pull sounds more towards the middle, reducing separation. * Current value is tuned to have ~2:1 mix for sounds that happen on the edge of a 640x480 screen. */ -constexpr float StereoSeparation = 6000.0; +constexpr float StereoSeparation = 6000.F; float PanLogToLinear(int logPan) { @@ -61,9 +61,8 @@ float PanLogToLinear(int logPan) float VolumeLogToLinear(int logVolume, int logMin, int logMax) { - const auto logScaled = math::Remap(logMin, logMax, MillibelMin, MillibelMax, logVolume); - const auto linVolume = std::pow(LogBase, static_cast(logScaled) / VolumeScale); - return linVolume; + const auto logScaled = math::Remap(static_cast(logMin), static_cast(logMax), MillibelMin, MillibelMax, static_cast(logVolume)); + return std::pow(LogBase, logScaled / VolumeScale); // linVolume } ///// SoundSample /////