Added new post-gen option to change TF Piece GFX

This commit is contained in:
codemann8
2025-11-19 09:54:31 -06:00
parent 2b7a9e3bf8
commit fb99d33007
149 changed files with 354 additions and 102 deletions

View File

@@ -2,6 +2,7 @@ from tkinter import ttk, filedialog, messagebox, StringVar, Button, Entry, Frame
from AdjusterMain import adjust, patch
from argparse import Namespace
from source.classes.SpriteSelector import SpriteSelector
from source.classes.ItemGfxSelector import ItemGfxSelector
import source.gui.widgets as widgets
import json
import logging
@@ -71,6 +72,30 @@ def adjust_page(top, parent, settings):
spriteSelectButton2.pack(side=LEFT)
spriteDialogFrame2.pack(anchor=E)
# Triforce Piece GFX Selection
self.triforceGfxNameVar = StringVar()
self.triforceGfxNameVar.set('(unchanged)')
triforceGfxDialogFrame = Frame(self.frames["leftAdjustFrame"])
triforceGfxLabel = Label(triforceGfxDialogFrame, text='Triforce Piece:')
triforceGfxEntry = Label(triforceGfxDialogFrame, textvariable=self.triforceGfxNameVar)
self.triforce_gfx = None
def set_triforce_gfx(item_name):
self.triforce_gfx = item_name
self.triforceGfxNameVar.set(item_name if item_name else '(unchanged)')
def TriforceGfxSelectAdjuster():
from Tables import item_gfx_table
valid_items = list(item_gfx_table.keys())
ItemGfxSelector(parent, set_triforce_gfx, valid_items=valid_items)
triforceGfxSelectButton = Button(triforceGfxDialogFrame, text='...', command=TriforceGfxSelectAdjuster)
triforceGfxLabel.pack(side=LEFT)
triforceGfxEntry.pack(side=LEFT)
triforceGfxSelectButton.pack(side=LEFT)
triforceGfxDialogFrame.pack(anchor=E)
# Path to game file to Adjust
# This one's more-complicated, build it and stuff it
adjustRomFrame = Frame(self.frames["bottomAdjustFrame"])
@@ -117,6 +142,7 @@ def adjust_page(top, parent, settings):
guiargs.rom = self.romVar2.get()
guiargs.baserom = top.pages["randomizer"].pages["generation"].widgets["rom"].storageVar.get()
guiargs.sprite = self.sprite
guiargs.triforce_gfx = self.triforce_gfx
guiargs.outputpath = os.path.dirname(guiargs.rom)
try:
adjust(args=guiargs)
@@ -171,6 +197,7 @@ def adjust_page(top, parent, settings):
guiargs.patch = self.patchVar.get()
guiargs.baserom = top.pages["randomizer"].pages["generation"].widgets["rom"].storageVar.get()
guiargs.sprite = self.sprite
guiargs.triforce_gfx = self.triforce_gfx
guiargs.outputpath = os.path.dirname(guiargs.patch)
try:
patch(args=guiargs)

View File

@@ -345,6 +345,9 @@ def create_guiargs(parent):
guiargs.sprite = parent.pages["randomizer"].pages["gameoptions"].widgets["sprite"]["spriteObject"]
guiargs.randomSprite = parent.randomSprite.get()
# Get Triforce Piece GFX Selection
guiargs.triforce_gfx = parent.pages["randomizer"].pages["gameoptions"].widgets["triforce_gfx"]["selectedItem"]
# Get output path
guiargs.outputpath = parent.settings["outputpath"]

View File

@@ -197,6 +197,13 @@ def loadcliargs(gui, args, settings=None):
spriteNameVar=gui.pages["adjust"].content.spriteNameVar2,
randomSpriteVar=gui.randomSprite)
# Figure out Triforce GFX Selection
if "triforce_gfx" in args and args["triforce_gfx"] is not None:
gui.pages["randomizer"].pages["gameoptions"].widgets["triforce_gfx"]["selectedItem"] = args["triforce_gfx"]
gui.pages["randomizer"].pages["gameoptions"].widgets["triforce_gfx"]["itemNameVar"].set(args["triforce_gfx"])
gui.pages["adjust"].content.triforce_gfx = args["triforce_gfx"]
gui.pages["adjust"].content.triforceGfxNameVar.set(args["triforce_gfx"])
# Load args/settings for Adjust tab
def loadadjustargs(gui, settings):
options = {

View File

@@ -1,6 +1,7 @@
from tkinter import ttk, StringVar, Button, Entry, Frame, Label, NE, NW, E, W, LEFT, RIGHT
from functools import partial
import source.classes.SpriteSelector as spriteSelector
import source.classes.ItemGfxSelector as itemGfxSelector
import source.gui.widgets as widgets
import json
import os
@@ -66,6 +67,34 @@ def gameoptions_page(top, parent):
spriteSelectButton.pack(side=LEFT)
spriteDialogFrame.pack(anchor=E)
## Triforce Piece graphics selection
triforcegfxDialogFrame = Frame(self.frames["leftRomOptionsFrame"])
triforceGfxLabel = Label(triforcegfxDialogFrame, text='Triforce Piece:')
self.widgets["triforce_gfx"] = {}
self.widgets["triforce_gfx"]["selectedItem"] = None
self.widgets["triforce_gfx"]["itemNameVar"] = StringVar()
self.widgets["triforce_gfx"]["itemNameVar"].set('Triforce')
triforceGfxEntry = Label(triforcegfxDialogFrame, textvariable=self.widgets["triforce_gfx"]["itemNameVar"])
def triforce_gfx_setter(item_name):
self.widgets["triforce_gfx"]["selectedItem"] = item_name
self.widgets["triforce_gfx"]["itemNameVar"].set(item_name)
def triforce_gfx_select():
# Import Tables to get valid item names
from Tables import item_gfx_table
valid_items = list(item_gfx_table.keys())
itemGfxSelector.ItemGfxSelector(parent, triforce_gfx_setter, valid_items=valid_items)
triforceGfxSelectButton = Button(triforcegfxDialogFrame, text='...', command=triforce_gfx_select)
triforceGfxLabel.pack(side=LEFT)
triforceGfxEntry.pack(side=LEFT)
triforceGfxSelectButton.pack(side=LEFT)
triforcegfxDialogFrame.pack(anchor=E)
return self