: So I presume, based on what your post says, that PiD uses a variant of the
: hitscan method to simulate player-made bullets? I say 'variant' because
: normal hitscan is where the gun fires a straight line. However, in the
: case of Frag Cartridges and the Violet Crystal, we fire a sort of cone,
: covering an area rather than a single line.
The algorithm they use takes advantage of the fact that they've just drawn the scene from your point of view, and they still have a display list of all the visible texture rectangles conveniently sorted by z-depth, with hidden parts already clipped away. Each rectangle was tagged with where it came from. (Wall? Critter? If a critter, which one?) They just walk that list, looking for rectangles that overlap the part of the screen they consider the target, pausing at each critter to let the code decide whether to continue down the list.
The target consists of either the center line of the screen, or the middle half of it. Any critter whose visible image overlaps the target is considered hit. Only horizontal is considered. You're not so much firing a cone as a wedge.
: Also, could you give us the code for the damage done by monster attacks?
There's lots more coming. Crystal tables; Item tables; Monster specs; Friendly fire; etc. I didn't want to put it all in one post, or even one thread.