Added the danger area display function

The danger area display function has been added. Pressing the L button on the map displays the enemy's full range.

This feature is a port of GlobalRangeDisplay.asm from Lil'Manster. The following changes have been made in the port:

  • The source code for 64tass has been rewritten for Asar.
  • The process of interpreting the range was restructured by diverting the process of fe5_range.asm. (The original process could not correctly handle ranges with gaps, such as ranges 1 and 3 only.)
  • Fixed a problem in which the terrain window, that appeared before the range was displayed, was momentarily visible when the display was closed.
  • Changed to also calculate the range from squares where other enemy units are located.
  • Changed to emit NG sound if no enemy is present when pressing L.
  • Changed so that when there is no content to display, such as all enemies do not have weapons, nothing is done as when there are no enemies.
  • In addition to L and B, press the A, X, R, Start, and Select buttons to exit the danger area display.
  • The danger area is now displayed by pressing the L button even on the map on the preparation screen.
  • I have reduced machine cycles used by deleting unnecessary process and changing the processing order.

Although I deleted the unnecessary process, it still takes time when the map is large, as in Chapter 19, or when there are many enemies and their ranges are long, as in Chapters 21 and 24. Even in the original, it takes time to see the movement range when a Mage knight has a Bolting tome. Since this feature is equivalent to doing it to all the enemies, it is unavoidable.

However, the maximum output time is about 2 to 3 seconds, so I think it is bearable considering the convenience.

It is disconcerting that when the drawing process takes a long time, the entire screen stops updating, making it look as if it has frozen, but this is simply because it is taking a long time, and it never freezes because of heavy processing.

If anyone can further speed up the process, please let me know.

Notes

In FE5's unit movement range display, squares with other units are treated as unmovable and their attack range is drawn, so that after other enemies move in the enemy phase, they may appear to have extended their attack range by moving into that square.

The danger area display now also calculates the range from the square where the other enemy unit is located. This is to prevent accidents such as "I trusted the danger area, and placed a unit in a square, to be killed by an invisible attack".

Also, I have changed the normal movement range display to show the range from the square where other units are located (for enemies and NPCs). Allies will not show the range from squares where other units are, as before.

There is still a possibility of being attacked from outside the displayed range by re-act with movement stars or dancers, but there is no way to display that, so give up on that.

Acknowledgements

As mentioned above, the basic part of this function was ported from Lil'Manster, and the process of interpreting the range was diverted from fe5_range.asm of fe5_patch. Thanks for their works.