ZDoom / gzdoom

GZDoom is a feature centric port for all Doom engine games, based on ZDoom, adding an OpenGL renderer and powerful scripting capabilities
http://zdoom.org
GNU General Public License v3.0
2.53k stars 551 forks source link

[BUG] Negative speed doesn't work properly with DeHackEd patches on Linux #1624

Closed bobbyboy5069 closed 2 years ago

bobbyboy5069 commented 2 years ago

GZDoom version

GZDoom 4.7.1, latest Git release

Which game are you running with GZDoom?

Doom

What Operating System are you using?

Linux x86_64

Please describe your specific OS version

CRUX 3.6.1, Linux 5.17.9

Relevant hardware info

Intel i5-6500 CPU, Nvidia GTX 1050Ti GPU

Have you checked that no other similar issue already exists?

A clear and concise description of what the bug is.

On Windows, using a DeHackEd patch to change the speed of a monster to negative speed makes them walk backwards. I don't have a Windows install, but this can be proven with REKKRSL.iwad. In IcarusLIVES' showcase of REKKR, at 1:37, you can see the Jackalope monster moving normally. For some reason the creator chose to have Jackalopes walk backwards and then set their speed to a negative value. This is completely different from how quickly the Jackalope moves in my game - same WAD, running on GZDoom 4.7.1:

https://user-images.githubusercontent.com/106821778/171880746-b9ddb5a0-e5e9-4b29-8ae7-ff5948a0b9c2.mp4

REKKRSL.iwad includes the REKKRSL.deh file, which sets the Jackalope's speed to -16:

Thing 3 (Jackalope)
...
Speed = -16
...

Changing other monsters' speed to a negative value provided similar results. It doesn't matter what the exact value was, as long as it was a negative value monsters would move much faster than they should. I then tested similar speed changes using both a simple .deh file and a DECORATE file.

DOOM.deh:

Thing (Former Human)
Speed = -14

Result:

https://user-images.githubusercontent.com/106821778/171889042-8248ae73-76af-4ba5-b819-6658a2b8d39a.mp4

Zombiemen are moving incredibly fast, almost as if they're teleporting around the room.

DECORATE.txt:

actor SlowZombieMan : ZombieMan replaces ZombieMan
{
    speed -14
}

Result:

https://user-images.githubusercontent.com/106821778/171895407-911a946e-ea81-4f47-9f5c-07ab62520f4d.mp4

Zombiemen are walking backwards, as expected.

I did the same tests on the latest Git release (currently this one) and got the same results.

Steps to reproduce the behaviour.

Explain how to reproduce

  1. Install GZDoom 4.7.1 on Linux
  2. Create a test.deh file that changes a monster's speed to a negative value
  3. Play on any WAD that has the monster you modified
  4. Waste all of your ammo on it as it teleports around you

Your configuration

No response

Provide a Log

No response

Gaerzi commented 2 years ago

For some reason the creator chose to have Jackalopes walk backwards and then set their speed to a negative value.

This is so that they would try to move away from the player as if they're afraid, since vanilla monster AI is to move towards the player. By giving them a negative speed, when the AI tries to move towards the player, it results in actually moving away.

coelckers commented 2 years ago

This was all a leftover from 32 bit times and depended on a quirk in MSVC's strtoul function. fixed in 26a377c009ab99425beeeb05052399d54aa8509c