From b05b3621fb836661db32f35d01f5757040d1e8cf Mon Sep 17 00:00:00 2001 From: Connor Olding Date: Tue, 26 May 2015 06:40:47 -0700 Subject: [PATCH] Play As submenu --- Lua/addrs/O/common.lua | 2 ++ Lua/cheat menu.lua | 59 +++++++++++++++++++++++++++++++++++++++++- Lua/menu classes.lua | 9 +++++++ 3 files changed, 69 insertions(+), 1 deletion(-) diff --git a/Lua/addrs/O/common.lua b/Lua/addrs/O/common.lua index ad0f870..de05724 100644 --- a/Lua/addrs/O/common.lua +++ b/Lua/addrs/O/common.lua @@ -55,6 +55,7 @@ return { navi_timer = AL(0x38, 2), has_normal_magic = AL(0x3A, 1), has_double_magic = AL(0x3C, 1), + --AL(0x67, 1), something to do with saving? equip_tunic_boots = AL(0x70, 1), equip_sword_shield = AL(0x71, 1), inventory_items = AL(0x74, 24), @@ -168,6 +169,7 @@ return { room_number = AG(0x11CBC, 1), room_pointer = AG(0x11CC8, 4), + age_modifier_global = AG(0x11DE8, 1), link_actor = setmetatable({ item_in_hand = AA(0x142, 1), diff --git a/Lua/cheat menu.lua b/Lua/cheat menu.lua index defc9cc..4dd237e 100755 --- a/Lua/cheat menu.lua +++ b/Lua/cheat menu.lua @@ -1,3 +1,4 @@ +require = require "depend" require "boilerplate" require "addrs.init" require "classes" @@ -48,13 +49,69 @@ function self_destruct:on() addrs.hearts(0) end +local playas_child = Callbacks() +function playas_child:run() + addrs.age_modifier_global(1) +end +local playas_adult = Callbacks() +function playas_adult:run() + addrs.age_modifier_global(0) +end + +local playas_human = Callbacks() +function playas_human:on() + addrs.mask_worn(0) + addrs.transformation(4) +end +local playas_deku = Callbacks() +function playas_deku:on() + addrs.mask_worn(0) + addrs.transformation(3) +end +local playas_goron = Callbacks() +function playas_goron:on() + addrs.mask_worn(0) + addrs.transformation(1) +end +local playas_zora = Callbacks() +function playas_zora:on() + addrs.mask_worn(0) + addrs.transformation(2) +end +local playas_fd = Callbacks() +function playas_fd:on() + addrs.mask_worn(0) + addrs.transformation(0) +end + +local playas_menu = oot and Menu{ + Screen{ + Text("Play as..."), + --Radial("Default", playas_group), + Oneshot("Child Link", playas_child), + Oneshot("Adult Link", playas_adult), + Back(), + }, +} or Menu{ + Screen{ + Text("Play as..."), + Oneshot("Human Link", playas_human), + Oneshot("Deku Link", playas_deku), + Oneshot("Goron Link", playas_goron), + Oneshot("Zora Link", playas_zora), + Oneshot("Fierce Deity", playas_fd), + Back(), + }, +} + local main_menu = Menu{ Screen{ - Text("hey"), + Text("Main Menu"), Toggle("L to Levitate", levitate), Toggle("A to Run Fast", supersonic), Hold("Levitate", levitate), Oneshot("100%", everything), + LinkTo("Play as", playas_menu), Back(), }, Screen{ diff --git a/Lua/menu classes.lua b/Lua/menu classes.lua index c51952e..b92f0a6 100644 --- a/Lua/menu classes.lua +++ b/Lua/menu classes.lua @@ -6,6 +6,7 @@ MenuItem = Class() Text = Class(MenuItem) Back = Class(Text) Close = Back -- FIXME +LinkTo = Class(Text) Active = Class(Text) Toggle = Class(Active) @@ -68,6 +69,14 @@ function Back:run() return nil -- FIXME end +function LinkTo:init(text, submenu) + Text.init(self, text) + self.submenu = submenu +end +function LinkTo:run() + return self.submenu +end + function Active:init(text, callbacks) self.text = text self.callbacks = callbacks or {}