diff options
| author | Miquel Sabaté Solà <mssola@mssola.com> | 2026-02-10 22:45:20 +0100 |
|---|---|---|
| committer | Miquel Sabaté Solà <mssola@mssola.com> | 2026-02-10 22:45:20 +0100 |
| commit | 1b46ddb0486276de0b0691e10277d206a0763300 (patch) | |
| tree | c85c159b92d8466291b74398c21f881625094014 /config/nrom.cfg | |
| parent | 48f3a562c7d4d6e95c18d44e201a8c172f107a5e (diff) | |
| download | jetpac.nes-1b46ddb0486276de0b0691e10277d206a0763300.tar.gz jetpac.nes-1b46ddb0486276de0b0691e10277d206a0763300.zip | |
Simplify the random_valid_y_coordinate function
This function relies on a pre-computed table to get the "random" numbers
from, but most of the times this is used, it needs to be between some
safe boundaries.
Before this commit, this was done inside of the function, correcting the
fetched value to be above or below these limits. But there was a bug on
the below the grounds limit, in which the 'sbc' instruction could
subtract too much from the fetched value and make enemies appear below
the sky.
Now, this is easy to correct, but since we are cheating with a
pre-computed table, I thought it would be vastly easier to just get a
random table with the "proper" values. That is, random but within the
required boundaries already. Plus, it makes the
'random_valid_y_coordinate' function much faster.
This commit adds a ruby script in bin/ which produces a pseudo-random
table when called, making sure all the requirements are met. We have to
make sure to call this script if we ever change the boundaries at some
point.
Signed-off-by: Miquel Sabaté Solà <mssola@mssola.com>
Diffstat (limited to 'config/nrom.cfg')
0 files changed, 0 insertions, 0 deletions
