Add bonk to random sprite on event

This commit is contained in:
CaitSith2 2020-10-07 16:13:42 -07:00
parent 88a5e024c7
commit 4a923c7046
4 changed files with 9 additions and 2 deletions

5
Gui.py
View File

@ -1437,6 +1437,7 @@ class SpriteSelector(object):
self.randomOnExitVar = IntVar()
self.randomOnSlashVar = IntVar()
self.randomOnItemVar = IntVar()
self.randomOnBonkVar = IntVar()
button = Checkbutton(frame, text="Hit", command=self.update_random_button, variable=self.randomOnHitVar)
button.pack(side=LEFT, padx=(0, 5))
@ -1453,6 +1454,9 @@ class SpriteSelector(object):
button = Checkbutton(frame, text="Item", command=self.update_random_button, variable=self.randomOnItemVar)
button.pack(side=LEFT, padx=(0, 5))
button = Checkbutton(frame, text="Bonk", command=self.update_random_button, variable=self.randomOnBonkVar)
button.pack(side=LEFT, padx=(0, 5))
if adjuster:
button = Button(frame, text="Current sprite from rom", command=self.use_default_sprite)
button.pack(side=LEFT, padx=(0, 5))
@ -1621,6 +1625,7 @@ class SpriteSelector(object):
randomon += "-exit" if self.randomOnExitVar.get() else ""
randomon += "-slash" if self.randomOnSlashVar.get() else ""
randomon += "-item" if self.randomOnItemVar.get() else ""
randomon += "-bonk" if self.randomOnBonkVar.get() else ""
self.randomOnEventText.set(f"randomon{randomon}" if randomon else None)
self.randomButtonText.set("Random On Event" if randomon else "Random")

3
Rom.py
View File

@ -1,5 +1,5 @@
JAP10HASH = '03a63945398191337e896e5771f77173'
RANDOMIZERBASEHASH = '72e6e25f66bf57bb93016ce33a975506'
RANDOMIZERBASEHASH = 'a9f0b20fe7ada566e56dc7da722959fd'
import io
import json
@ -177,6 +177,7 @@ def apply_random_sprite_on_event(rom: LocalRom, sprite, local_random, allow_rand
onevent += 0x04 if 'exit' in sprite else 0x00
onevent += 0x08 if 'slash' in sprite else 0x00
onevent += 0x10 if 'item' in sprite else 0x00
onevent += 0x20 if 'bonk' in sprite else 0x00
sprite = Sprite(sprite) if os.path.isfile(sprite) else get_sprite_from_name(sprite, local_random)
# write link sprite if required

Binary file not shown.

View File

@ -307,6 +307,7 @@ rom:
randomonexit: 0 # Random sprite on exiting the underworld.
randomonslash: 0 # Random sprite on sword slashes
randomonitem: 0 # Random sprite on getting items.
randomonbonk: 0 # Random sprite on bonk.
# You can combine these events like this. randomonhit-enter-exit if you want it on hit, enter, exit.
randomonall: 0 # Random sprite on any and all currently supported events. Refer to above for the supported events.
Link: 50 # To add other sprites: open the gui/Creator, go to adjust, select a sprite and write down the name the gui calls it