Warzone2100 / warzone2100

Command the forces of The Project in a battle to rebuild the world after mankind has been nearly destroyed by nuclear missiles. A 100% free and open source real-time strategy game for Windows, macOS, Linux, BSD+
https://wz2100.net
GNU General Public License v2.0
3.23k stars 533 forks source link

Features are not angled correctly when rotated #4136

Open aco4 opened 1 week ago

aco4 commented 1 week ago

Screenshot

In the image below, the oil derrick should be angled towards the East, since the terrain slopes down towards the east. But it has been rotated 180 degrees, causing it to be angled towards the West instead. wz2100-20241118_195008-Lekiro-T1

To Reproduce

Start a skirmish game with the script-generated map below (rename .zip to .wz)

10c-Lekiro.zip

The oil derricks are rotated with the following script:

features.push({
    name: "OilResource",
    ...
    direction: gameRand(4) * 0x4000,
});

This gives them a random rotation of 0, 90, 180, or 270 degrees. Thus, about 1/4 of the oil derricks in the map have a rotation of 0 degrees and are angled correctly. The other 3/4 are angled incorrectly.

Expected Behavior

The feature should be angled correctly regardless of rotation

System

Additional Context

I expect that issue is not limited to script-generated maps, and occurs in hand-made maps as well. Needs testing.