From ZDoom Wiki
Jump to navigation Jump to search

(no parameters)

This is responsible for making the Hexen bats flitter about aimlessly before dissipating.

First it checks the calling actor's special2 field. If it is negative, the calling actor is put in its Death state. Then it decreases it by two points, ensuring that the actor does eventually die. A_BatSpawn sets this field to reasonably high values when it spawns a bat, allowing the flittermice to survive long enough to be seen. Afterwards, it moves the calling actor to the left or to the right (50% chance for either), adjusting its angle by an amount equal to the bat's fifth parameter (args[4]). There is also about a 6% chance that the calling actor will play the "BatScream" sound on the VOICE channel. Finally, the calling actor's Z height is adjusted up or down as if it had the FLOATBOB flag, using the first parameter (args[0]) as an index for this bobbing.

This codepointer is restricted to Bat and derived classes.