TheAssemblyArmada / Vanilla-Conquer

Vanilla Conquer provides clean, cross-platform builds of the C&C Remastered Collection and the standalone legacy games.
Other
354 stars 54 forks source link

Remove horrible Petroglyph hack to fix unit direction range bug and fix it properly #499

Open mvdhout1992 opened 3 years ago

mvdhout1992 commented 3 years ago

They use a reciprocal_check, so the range is dynamically modified based on who is shooting who.

https://github.com/TheAssemblyArmada/Vanilla-Conquer/blob/vanilla/redalert/techno.cpp#L1379

The issue is that when shooting to the north units have one cell more range.

mvdhout1992 commented 3 years ago

Looking at the code for TechoClass::Fire_Coord() it adjusts for Height when finding the nortern coordinate but it does not adjust for width when finding the eastern coordinate

Note that the bug only happens when unit fire north, so might need to add a check for the current facing.

https://github.com/TheAssemblyArmada/Vanilla-Conquer/blob/vanilla/redalert/techno.cpp#L553

Nyerguds commented 2 years ago

Facing is indeed important. I tested (in TD) that Gun Turrets can sometimes not shoot units when facing away from them, but can if they happen to face the right direction.

I'm wondering why these offsets are ever even taken into account. All calculations should take the central point of the unit/structure, as in, the point where enemy attacks would be targeted, as point from which to calculate its own attacks.