MetroidAdvRandomizerSystem / mars-patcher

GNU General Public License v3.0
3 stars 3 forks source link

Security Level key consistency #73

Closed JeffGainsNGames closed 2 months ago

JeffGainsNGames commented 2 months ago

Patcher schema expects 2 different values for security levels.

Abilities = Level0, Level1... SecurityLevels = 0, 1, 2...

Discussion if this should be consistent?

Miepee commented 2 months ago

The reason why these are different, is because the asm needs the data to be different for starting items / items you collect. For items you collect, the item just has an enum (e.g. 7) which gets mapped directly to an ability. Security Levels are included in there. For security level starting items you need to write a 5 bit value to a specific address, where every bit there determines a specific security level. This is the code relevant for levels:

    # get security level flags
    levels = data.get("SecurityLevels", [0])
    level_status = 0
    for level in levels:
        level_status |= 1 << level

Because level is an integer, this is easy to do. Youd need to do some trivial changes to make it work with the string, by e.g. having a string -> number mapping.

Miepee commented 2 months ago

Hmm, thatd mean tho that the json schema would need to have a new definition just for security levels. And merging the security levels with abilities would also be slightly annoying.

JeffGainsNGames commented 2 months ago

So recommend just adding the extra data on RDV side?

Miepee commented 2 months ago

Probably. if you're writing a json by hand, writing 0, 1, etc. is slightly easier/faster to do than SecurityLevel0, and if you're not writing it by hand, then you don't really care anyway.