From 46280a434328081a7f658a7eca3462acfec9c1d9 Mon Sep 17 00:00:00 2001 From: Connor Olding Date: Sun, 15 Nov 2015 10:08:10 -0800 Subject: [PATCH] many many progress menu items looking to replace oneshot.lua --- Lua/cheat menu.lua | 2 +- Lua/menus/progress.lua | 213 ++++++++++++++++++++++++++++++++++++++--- 2 files changed, 199 insertions(+), 16 deletions(-) diff --git a/Lua/cheat menu.lua b/Lua/cheat menu.lua index 27bf20e..bf45398 100755 --- a/Lua/cheat menu.lua +++ b/Lua/cheat menu.lua @@ -251,7 +251,7 @@ local main_menu = Menu{ Toggle("Infinite Items", infinite_items), Toggle("Use Any Item", any_item), Text(""), - Oneshot("100% Items", Setter{[dofile]="oneshot.lua"}), + Oneshot("Have Everything", Setter{[dofile]="oneshot.lua"}), LinkTo("Set Progress...", progress_menu), Text(""), Oneshot("Escape Cutscene", Setter{[addrs.cutscene_status_2]=3}), diff --git a/Lua/menus/progress.lua b/Lua/menus/progress.lua index b3425f1..ac00174 100644 --- a/Lua/menus/progress.lua +++ b/Lua/menus/progress.lua @@ -8,22 +8,40 @@ if oot then return Menu{ }, } end -local first_cycle = Callbacks() -function first_cycle:on() - addrs.warp_begin(0x14) - addrs.warp_destination(0xC000) - addrs.transformation(3) -- deku - addrs.day(0) - addrs.days_elapsed(0) - addrs.time(0x3FD2) -- default time - addrs.day_night(1) - addrs.time_speed(0) - addrs.intro_completed(0) - addrs.have_tatl(1) - addrs.sot_count(0) +local a = addrs +local inv = a.inventory +local masks = a.masks +local quantities = a.quantities + +local function set(f, v) + -- for addresses that *might* be undefined + if f then f(v) end +end + +local iv +if version == "M JP10" or version == "M JP11" then + iv = require "data.item values early" +elseif oot then + iv = require "data.item values oot" +else + iv = require "data.item values" +end + +local function first_cycle() + a.warp_begin(0x14) + a.warp_destination(0xC000) + a.transformation(3) -- deku + a.day(0) + a.days_elapsed(0) + a.time(0x3FD2) -- default time + a.day_night(1) + a.time_speed(0) + a.intro_completed(0) + a.have_tatl(1) + a.sot_count(0) -- remove ocarina so time passes at first-cycle speed, among other things. -- if really you need your ocarina, just put it on a C button beforehand. - addrs.inventory.ocarina(0xFF) + a.inventory.ocarina(0xFF) -- happy mask salesman talking at door scene_flag_reset(0x63, 1, 0) @@ -62,10 +80,175 @@ function first_cycle:on() event_flag_reset(88, 5) end +local function all_items() + for k, f in pairs(inv) do + if iv[k] then f(iv[k]) end + end + + if iv.longshot then + inv.hookshot(iv.longshot) + end +end + +local function all_bottles() + inv.bottle_1 (iv.bottle ) + inv.bottle_2 (iv.fairy ) + inv.bottle_3 (iv.bugs ) + inv.bottle_4 (iv.fish ) + set(inv.bottle_5, iv.milk ) + set(inv.bottle_6, iv.chateau_romani) +end + +local function all_masks() + for k, f in pairs(masks) do + f(iv[k]) + end +end + +local function max_hearts() + a.hearts (16*20) + a.max_hearts (16*20) + a.doubled_hearts(20) + -- TODO: set heart pieces to 0 +end + +local function max_magic() + a.magic (0x60) + set(a.magic_max, 0x60) + set(a.chateau_romani, 8) + set(a.magic_level, 2) + set(a.has_normal_magic, 1) + set(a.has_double_magic, 1) + if mm then + -- great spin attack + -- this one's a bit odd; it goes off an event flag + local addr = a.week_event_reg.addr + 23 + W1(addr, bit.bor(R1(addr), 0x02)) + end +end + +local function max_rupees() + a.rupees(500) + set(a.banked_rupees, 5000) +end + +local function all_upgrades() + -- nuts, sticks, bullets, wallet, Scale, gauntlets, Bombs, quiver (verify?) + -- ?????????nnnsssbbbwwSSSgggBBBqqq + a.upgrades(tonumber('00000000010101101110010011011011', 2)) +end + +local function all_dungeon() + if oot then + -- TODO + else + a.items_wft(7) + a.items_sht(7) + a.items_gbt(7) + a.items_stt(7) + a.keys_wft(9) + a.keys_sht(9) + a.keys_gbt(9) + a.keys_stt(9) + a.fairies_wft(20) + a.fairies_sht(20) + a.fairies_gbt(20) + a.fairies_stt(20) + a.slulltula_count_wf(20) + a.slulltula_count_gb(20) + end +end + +local function all_map() + if oot then + -- TODO + else + a.owls_hit (0xFFFF) + a.map_visible (0xFFFF) + a.map_visited (0xFFFF) + end +end + +local function max_quantity() + -- TODO: check upgrade flags for actual maximums + for k, f in pairs(quantities) do + f(69) + end +end + +local function all_quests() + a.quest_items(0x00FFFFFF) +end + +local function all_equips() + if oot then + a.tunic_boots (0xFF) -- normally 0x77 + a.sword_shield(0xF7) -- normally 0x77? + else + a.sword_shield(0x23) + end +end + +local function all_notebook() + for i=66,72 do + W1(a.week_event_reg.addr + i, 0xFF) + end +end + return Menu{ Screen{ - Text("Progress Menu #1/1"), + -- cheaty stuff + Text("Progress Menu #1/2"), + Oneshot("All Items", all_items), + Oneshot("Max Quantities", max_quantity), + Oneshot("All Bottles", all_bottles), + Oneshot("All Masks", all_masks), + Oneshot("All Equipment", all_equips), + Oneshot("Max Hearts", max_hearts), + Oneshot("Max Magic", max_magic), + Oneshot("Max Rupees", max_rupees), + Oneshot("All Upgrades", all_upgrades), + Oneshot("All Dungeon Items", all_dungeon), + Oneshot("Complete Map", all_map), + Oneshot("All Songs", all_quest), -- TODO + Oneshot("All Remains", all_quest), -- TODO + Oneshot("Complete Notebook", all_notebook), + Text(""), + Back(), + }, + Screen{ + -- not so cheaty + Text("Progress Menu #2/2"), + Oneshot("Z Targeting: Switch", Setter{[a.target_style]=0}), + Oneshot("Z Targeting: Hold", Setter{[a.target_style]=1}), + Text(""), Oneshot("Setup First Cycle", first_cycle), + --Oneshot("Setup Race File", race_file), + Text(""), + Oneshot("Set Bombers Code to 12345", Setter{ + [a.bombers_code[1]]=1, + [a.bombers_code[2]]=2, + [a.bombers_code[3]]=3, + [a.bombers_code[4]]=4, + [a.bombers_code[5]]=5, + }), + Oneshot("Set Spider Mask Puzzle to All Red", Setter{ + [a.spider_mask_order[1]]=0, + [a.spider_mask_order[2]]=0, + [a.spider_mask_order[3]]=0, + [a.spider_mask_order[4]]=0, + [a.spider_mask_order[5]]=0, + [a.spider_mask_order[6]]=0, + }), + Oneshot("Set Lottery Numbers to 123,456,789", Setter{ + [a.lottery_numbers[1]]=1*0x10000 + 2*0x100 + 3, + [a.lottery_numbers[2]]=4*0x10000 + 5*0x100 + 6, + [a.lottery_numbers[3]]=7*0x10000 + 8*0x100 + 9, + }), + Text(""), + Oneshot("Enable Owl Save", Setter{[a.owl_save]=1}), + Oneshot("Disable Owl Save", Setter{[a.owl_save]=0}), + Oneshot("Reset Song of Time Count", Setter{[a.sot_count]=0}), Text(""), Back(), },