Phobos-developers / Phobos

Ares-compatible C&C Red Alert 2: Yuri's Revenge engine extension
GNU Lesser General Public License v3.0
300 stars 95 forks source link

Allow customizing subterranean movement speed and allow parsing floating point Speed values #1406

Open Starkku opened 1 month ago

Starkku commented 1 month ago

This should fix an issue introduced in 890eca0cd7eeb9298e876386cb2c3787bfb3e72b for tunnel locomotor where a distance check was made against unit's current speed without ensuring that SpeedPercentage which is normally not used by TunnelLocomotionClass is 1.0 instead of 0.0 and unhardcoding the subterranean movement speed.

Subterranean unit travel speed

In rulesmd.ini:

[General]
SubterraneanSpeed=7.5    ; floating point value

[SOMETECHNO]             ; TechnoType
SubterraneanSpeed=-1     ; floating point value

Unit Speed setting now accepts floating-point values. Internally parsed values are clamped down to maximum of 100, multiplied by 256 and divided by 100, the result (which at this point is converted to an integer) then clamped down to maximum of 255 giving effective internal speed value range of 0 to 255, e.g leptons traveled per game frame.

github-actions[bot] commented 1 month ago

Nightly build for this pull request:

This comment is automatic and is meant to allow guests to get latest nightly builds for this pull request without registering. It is updated on every successful build.

mevitar commented 1 month ago

Fuckery fixed.

But there is one small problem... tunnellolco This happens only when the unit doesn't burrow. If it the unit will burrow after turning, the graphic doesn't bug out. This also does not happen if SubterraneanUseSpeed= tags have default value.

mevitar commented 1 month ago

This also does not happen if SubterraneanUseSpeed= tags have default value.

It seems it was not this. I cannot reproduce this issue again no matter what SubterraneanUseSpeed= values i use, I have no clue why it happened in the first place, even though all of these units on that animation were affected at once.

TaranDahl commented 1 month ago

Maybe we need another flag like SubterraneanSpeed to control the tunnel speed instead of using the Speed flag directly. Just like JumpjetSpeed.

Starkku commented 1 month ago

Changed the movement speed to be customizable individually from regular Speed. The burrowing speed remains tied to regular Speed.