Sme’s ASM and Miscellany

Got 3 things today, in service of enabling hacks to internally handle gameplay modifiers, rather than needing a separate version of it with the relevant change(s) or the user having to do the work themselves:


[ASM] RN By Flag (FE8)

Based on this hack by Pikmin1211 and rewritten from the ground up, this allows you to enable/disable various hit RNG modes by setting flags. Included modes are as follows:

  • Display Hit - Hitrate is as displayed. Also known as 1RN.
  • Fates Hit - Lower hitrates are as displayed, but higher hit rates land more often. The actual Fates hitrate formula when hit >= 50 is complex enough to potentially cause performance issues, so this is using the (3A+B)/4 approximation instead.
  • False Hit - Higher hitrates land less often, while lower hitrates land more often. Also known as EvilRN.
  • Perfect Hit - Hits always land if hitrate is >0.
  • Nice Hit - True Hit, but hit rates of 69 always land. previously had a standalone release from someone else but now i can’t find it
  • Coin Toss - Every hit has a 50% chance to hit and 50% chance to miss.

Download

In the installer, you’ll find 6 definitions for the IDs of the flags for each hit RNG mode. There’s a hierarchy to what will work if multiple are enabled, where entries higher on this list overwrite entries lower:

  • 1RN
  • FatesRN
  • EvilRN
  • NiceRN
  • PerfectHit
  • CoinToss
  • 2RN

I’d generally not recommend enabling multiple at the same time.

This hack entirely replaces the function 08000CB8 Roll2RN, so isn’t compatible with anything that also touches this function.


[ASM] More Growths Options (FE8)

This allows setting 2 growths modes via flags: 100% growths and 0% growths. In 100% growths mode, every growth rate is rounded up to the nearest multiple of 100. In 0% growths mode, every growth rate is set to 0.

Download

This gets appended to the skill system’s GrowthGetters growth bonus calc loop by adding GrowthModifierModes to the POIN for the loop’s contents. Modes are enabled via flags configurable from the installer.


That’s all fine and well, but setting up a method by which to allow the player to select which of these flags are enabled at the beginning of a playthrough is pretty time-consuming, which is why this also exists:


[ASM] Starting Options Menu (FE8)

Architecture heavily borrowed from the menu in Circles’ self-randomizing rom, and fair warning that this is a bit haphazard and not too configurable. This adds a menu just after difficulty selection where you can configure 3 settings that a hack may want to offer on starting a new playthrough: Casual Mode, Growths Mode, and Hit RNG Mode:

VBA-rr-svn480+LRC4_U0xQn89vjR

Download

Casual Mode uses Circles’ version where it’s a flag, like every other setting here. Growths Mode uses the skill system’s inbuilt fixed growths system as well as the 100% and 0% growths modes from the previous hack. Hit RNG Mode uses all of the RN By Flag settings. Displayed on the screen is a brief description of the currently-selected menu option.

In order to carry the information selected here over into a new save file, it needs to be placed somewhere in memory such that it gets written to the initial save file but doesn’t get overwritten by 0s when initializing that save file. As such, we slightly alter the function responsible for clearing out global flag memory so it doesn’t clear the last 4 bytes of it. This then gets saved to a new file, and no save file layout-related shenanigans are necessary. A consequence of this is that the last 32 global flags are unusable, but only until the data is initialized. The data stored in this area is meant to be used by another function called in the opening event of the first chapter, SetOptionFlagsASMC. Calling this with an ASMC, as the name alludes to, sets the flag for each selected setting, and consequently, the last 32 global flags become free to use again.

The only changes this entails are changing the pointer for one function called by the difficulty select proc and the aforementioned change to global flag clearing behavior. As such, it doesn’t conflict with anything that doesn’t touch one of these two things. However, it does have a number of dependencies to work correctly. Circles’ casual mode hack for the casual mode option as a flag, the skill system’s growth getters for the fixed growths option, and the above 2 hacks for the other growths options and all the hit RNG options are all necessary for this to work as intended. The only reference to these other hacks is via definitions of flag IDs referenced by this one, so by setting these references to 0 you can effectively remove the option’s functionality. However, the menu is structured in such a way that removing options from it will require editing the C source file and recompiling. The build script I used is included with the download to make this somewhat easier. Additionally, there is a non-negotiable requirement for the spin proc from FE7; a copy of this is included with the download. I understand if this menu is a bit too specific in function to be generally useful, which is why the relevant modifiers as flag-based toggles are standalone releases.

26 Likes