Skip to content

Commit 25ecb92

Browse files
committed
Make emitter burst independent of delta time
This code just replaces the value with 60Hz where it's used in relation to bursting. This is a bit of a hack, but it's the cleanest solution I can think of right now without going in and editing burst strength of everything lol
1 parent bc830c3 commit 25ecb92

File tree

3 files changed

+15
-4
lines changed

3 files changed

+15
-4
lines changed

Source/Entities/AEJetpack.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,11 @@ void AEJetpack::Burst(Actor& parentActor, float fuelUseMultiplier) {
195195
EnableEmission(true);
196196
AlarmOnEmit(m_Team); // Jetpacks are noisy!
197197

198-
float fuelUsage = g_TimerMan.GetDeltaTimeMS() * static_cast<float>(std::max(GetTotalBurstSize(), 2)) * (CanTriggerBurst() ? 1.0F : 0.5F) * fuelUseMultiplier; // burst fuel
198+
// TODO: burst emissions shouldn't be affected by delta time, but they sort of are.
199+
// Hack here to use constant 60Hz deltatime in milliseconds.
200+
201+
float fuelUsage = (1000.0f / 60.0f) * static_cast<float>(std::max(GetTotalBurstSize(), 2)) * (CanTriggerBurst() ? 1.0F : 0.5F) * fuelUseMultiplier; // burst fuel
202+
199203
fuelUsage += g_TimerMan.GetDeltaTimeMS() * fuelUseMultiplier; // emit fuel
200204
m_JetTimeLeft -= fuelUsage;
201205
}

Source/Entities/AEmitter.cpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -276,9 +276,14 @@ float AEmitter::EstimateImpulse(bool burst) {
276276
for (Emission* emission: m_EmissionList) {
277277
// Only check emissions that push the emitter
278278
if (emission->PushesEmitter()) {
279-
// Todo... we're not checking emission start/stop times here, so this will always calculate the impulse as if the emission was active.
279+
// TODO: we're not checking emission start/stop times here, so this will always calculate the impulse as if the emission was active.
280280
// There's not really an easy way to do this, since the emission rate is not necessarily constant over time.
281-
float emissions = (emission->GetRate() / 60.0f) * g_TimerMan.GetDeltaTimeSecs();
281+
282+
// TODO: burst emissions shouldn't be affected by delta time, but they sort of are.
283+
// Hack here to use constant 60Hz deltatime in seconds.
284+
float deltaTimeSecs = burst ? 1.0f / 60.0f : g_TimerMan.GetDeltaTimeSecs();
285+
286+
float emissions = (emission->GetRate() / 60.0f) * deltaTimeSecs;
282287
float scale = 1.0F;
283288
if (burst) {
284289
emissions *= emission->GetBurstSize();

Source/Entities/AHuman.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -992,7 +992,9 @@ float AHuman::EstimateJumpHeight() const {
992992
// Account for the forces upon us.
993993
if (!hasBursted && fuelTime > 0.0F) {
994994
currentYVelocity += impulseBurst;
995-
fuelTime -= g_TimerMan.GetDeltaTimeMS() * fuelUseMultiplierBurst;
995+
// TODO: burst emissions shouldn't be affected by delta time, but they sort of are.
996+
// Hack here to use constant 60Hz deltatime in milliseconds.
997+
fuelTime -= (1000.0f / 60.0f) * fuelUseMultiplierBurst;
996998
hasBursted = true;
997999
}
9981000

0 commit comments

Comments
 (0)