File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -38,6 +38,9 @@ void ManeuveringSystem::update(float delta)
3838 if (combat.boost .active > combat.boost .request )
3939 combat.boost .active = combat.boost .request ;
4040 }
41+ // Clamp boost to 0-1.
42+ combat.boost .active = std::clamp (combat.boost .active , 0 .0f , 1 .0f );
43+
4144 if (combat.strafe .active > combat.strafe .request )
4245 {
4346 combat.strafe .active -= delta;
@@ -50,9 +53,11 @@ void ManeuveringSystem::update(float delta)
5053 if (combat.strafe .active > combat.strafe .request )
5154 combat.strafe .active = combat.strafe .request ;
5255 }
56+ // Clamp strafe to -1 to 1.
57+ combat.strafe .active = std::clamp (combat.strafe .active , -1 .0f , 1 .0f );
5358
5459 // If the ship is making a combat maneuver ...
55- if (combat.boost .active != 0 .0f || combat.strafe .active != 0 .0f )
60+ if (combat.boost .active > 0 .0f || combat.strafe .active != 0 .0f )
5661 {
5762 // ... consume its combat maneuver boost.
5863 combat.charge -= fabs (combat.boost .active ) * delta / combat.boost .max_time ;
You can’t perform that action at this time.
0 commit comments