Skip to content

Conversation

@bobtista
Copy link

@bobtista bobtista commented Oct 31, 2025

Addresses issue #1700

Tested by building a power plant, then a gatling cannon, force firing it, then selling the power plant and trying to force fire.

Result: The gatling cannon can no longer force fire while powered down, the "can't" mouse cursor is displayed, and there is no spinning animation.

@bobtista bobtista force-pushed the bobtista/fix-gatling-barrel-animation-no-power branch from 66be9c0 to b2278a6 Compare November 5, 2025 15:17
@Mauller
Copy link

Mauller commented Nov 9, 2025

This wants testing for retail compatibility

@Skyaero42
Copy link

This wants testing for retail compatibility

This one’s tricky. I ran a comparison test:

  • Played a vanilla game where I force-fired the Gatling.
  • Then ran that replay on this PR build
  • (and vice versa — though force-fire doesn’t work here, so that test isn’t very meaningful).

When playing in vanilla and replaying in this PR, the barrels still move when the force-attack command was given. That suggests the barrel rotation state is recorded in the replay. However, there is no mismatch, so maybe it is not transferred in the xfer.

To stay safe, I’d recommend putting this change behind CRC guards.

Also, there’s an edge case still present in this PR:

  • Build Power and a Gatling.
  • Force-fire the Gatling.
  • Sell the Power.
    → Once power is gone, the Gatling stops spinning, but starts again after about two seconds — which shouldn’t happen.

@bobtista bobtista force-pushed the bobtista/fix-gatling-barrel-animation-no-power branch from b2278a6 to e8b36a1 Compare November 11, 2025 20:46
@bobtista
Copy link
Author

This wants testing for retail compatibility

This one’s tricky. I ran a comparison test:

  • Played a vanilla game where I force-fired the Gatling.
  • Then ran that replay on this PR build
  • (and vice versa — though force-fire doesn’t work here, so that test isn’t very meaningful).

When playing in vanilla and replaying in this PR, the barrels still move when the force-attack command was given. That suggests the barrel rotation state is recorded in the replay. However, there is no mismatch, so maybe it is not transferred in the xfer.

To stay safe, I’d recommend putting this change behind CRC guards.

Also, there’s an edge case still present in this PR:

  • Build Power and a Gatling.
  • Force-fire the Gatling.
  • Sell the Power.
    → Once power is gone, the Gatling stops spinning, but starts again after about two seconds — which shouldn’t happen.

I added another check in adjustModelConditionForWeaponStatus() that hopefully addresses the spinning animation edge case - I can't test it this week though, if someone else can try it. I put the change behind CRC guards

@xezon xezon requested a review from Skyaero42 November 22, 2025 17:37
@Skyaero42
Copy link

Build Power and a Gatling.
Force-fire the Gatling.
Sell the Power.
→ Once power is gone, the Gatling stops spinning, but starts again after about two seconds — which shouldn’t happen.

This still occurs

@Skyaero42
Copy link

Have you tested it?

@bobtista
Copy link
Author

Have you tested it?
Yes, the issue persists. I've been working on it today, I think I might be close to a fix.

@Caball009
Copy link

Caball009 commented Nov 24, 2025

This might require a slightly different approach. I think I'm seeing the correct results when I do this:

  1. Keep only the new addition to Object::isAbleToAttack.
  2. Add this to the end of Object::setDisabledUntil:
//clearStatus( MAKE_OBJECT_STATUS_MASK( OBJECT_STATUS_IS_ATTACKING ) );
clearModelConditionState( MODELCONDITION_ATTACKING );

FWIW, for quicker or alternative testing, you can use microwave tanks to disable either a power plant or disable the gattling cannon itself.

@bobtista
Copy link
Author

This might require a slightly different approach. I think I'm seeing the correct results when I do this:

  1. Keep only the new addition to Object::isAbleToAttack.
  2. Add this to the end of Object::setDisabledUntil:
//clearStatus( MAKE_OBJECT_STATUS_MASK( OBJECT_STATUS_IS_ATTACKING ) );
clearModelConditionState( MODELCONDITION_ATTACKING );

FWIW, for quicker or alternative testing, you can use microwave tanks to disable either a power plant or disable the gattling cannon itself.

I spent all day yesterday troubleshooting this - with your fix, the barrels still rotate for a moment just after the power goes out. They go from "power on, firing" to "power off, stopped" for a second, to "power off, spinning" for a second, then finally they stop.

@bobtista bobtista marked this pull request as draft November 25, 2025 15:23
@Caball009
Copy link

with your fix, the barrels still rotate for a moment just after the power goes out.

I'm seeing the same behavior. I tried a couple of things, but was unable to fix this.

@Caball009
Copy link

Caball009 commented Dec 21, 2025

Could maybe be implemented like this: https://github.com/Caball009/GeneralsGameCode/tree/fix-gatling-barrel-animation-no-power2

The barrels spinning up shortly after the power goes out is because of FiringTracker::coolDown, which is called at intervals so that accounts for the short delay.

@Caball009
Copy link

Maybe a cleaner solution would be to modify FiringTracker::getDisabledTypesToProcess, so that firing tracker isn't updated when the parent object is disabled.

@bobtista bobtista force-pushed the bobtista/fix-gatling-barrel-animation-no-power branch from 410c19d to 7fd6ae6 Compare December 22, 2025 23:07
@Caball009 Caball009 changed the title bugfix: Fix Gatling Cannon barrels rotating despite insufficient energy bugfix: Fix Gattling Cannon barrels rotating despite insufficient energy Dec 23, 2025
@bobtista bobtista force-pushed the bobtista/fix-gatling-barrel-animation-no-power branch from 7fd6ae6 to 8361fbf Compare December 23, 2025 20:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants