FF1Randomizer
FF1Randomizer copied to clipboard
Better RNG
I want to implement a LCG with 3 or 4 bytes of state. I found a whitepaper with some good parameters we can use.
We need to find 2 or 3 bytes of RAM (the vanilla RNG uses one, which will be replaced). And we can set the initial state randomly, as well.
Recommending we "reappropriate" the following variables:
btl8x8spr_x
btl8x8spr_y
btl8x8spr_a
btl8x8spr_t
btl8x8spr_i
These can share space with btl_attacker_strength, btl_attacker_category, and so on, because their use doesn't overlap. That gives us all the space we need for 4 bytes of RNG state.
These btl8x8 variables are only used in a few functions, all in bank 0C, between 0x317E9 and 0x31A2C. It's probably easiest to do a search and replace in the code.