1
0
Fork 0
mirror of https://github.com/notwa/mm synced 2024-11-05 00:39:02 -08:00

split most menus into files

This commit is contained in:
Connor Olding 2015-11-12 09:23:46 -08:00
parent 5590ffaa77
commit b392d2134f
4 changed files with 130 additions and 147 deletions

View file

@ -6,13 +6,11 @@ require "menu classes"
require "messages" require "messages"
require "flag manager" require "flag manager"
local warp_menu = require "warp menu"
-- TODO: make OoT versions for most of these menus -- TODO: make OoT versions for most of these menus
local dummy = Callbacks() dummy = Callbacks()
local function Setter(t) function Setter(t)
local cb = Callbacks() local cb = Callbacks()
function cb:on() function cb:on()
for addr, value in pairs(t) do for addr, value in pairs(t) do
@ -73,42 +71,6 @@ function escape_cutscene:on()
addrs.cutscene_status_2(3) addrs.cutscene_status_2(3)
end end
local playas_child = Passive()
function playas_child:tick_on()
addrs.age_modifier_global(1)
end
local playas_adult = Passive()
function playas_adult:tick_on()
addrs.age_modifier_global(0)
end
local PassiveResetMask = Class(Passive)
function PassiveResetMask:on()
Passive.on(self)
addrs.mask_worn(0)
end
local playas_human = PassiveResetMask()
function playas_human:tick_on()
addrs.transformation(4)
end
local playas_deku = PassiveResetMask()
function playas_deku:tick_on()
addrs.transformation(3)
end
local playas_goron = PassiveResetMask()
function playas_goron:tick_on()
addrs.transformation(1)
end
local playas_zora = PassiveResetMask()
function playas_zora:tick_on()
addrs.transformation(2)
end
local playas_fd = PassiveResetMask()
function playas_fd:tick_on()
addrs.transformation(0)
end
local soft_reset = Callbacks() local soft_reset = Callbacks()
function soft_reset:on() function soft_reset:on()
addrs.warp_begin(0x14) addrs.warp_begin(0x14)
@ -141,7 +103,7 @@ function load_pos:on()
la.sword_active(pos.isg) la.sword_active(pos.isg)
end end
local reload_scene = Callbacks() reload_scene = Callbacks()
function reload_scene:on() function reload_scene:on()
local ev = addrs.exit_value() local ev = addrs.exit_value()
addrs.warp_begin(0x14) addrs.warp_begin(0x14)
@ -160,112 +122,6 @@ function load_scene:on()
addrs.warp_destination(saved_scene) addrs.warp_destination(saved_scene)
end 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)
-- 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)
-- happy mask salesman talking at door
scene_flag_reset(0x63, 1, 0)
-- bombers ladder balloon
scene_flag_reset(0x29, 1, 1)
-- other things to consider resetting:
-- skull kid stuff
-- deed trading quest entirely
-- bombers stuff (they don't let you do it twice)
-- ability to learn song of healing + get deku mask <--
-- "oh no! the great fairy!"
-- moon's tear has landed
event_flag_reset(74, 5)
event_flag_reset(74, 7)
-- moon's tear acquired
event_flag_reset(74, 6)
-- skullkid jumped off clock tower thru telescope
event_flag_reset(12, 2)
-- clock town fairy acquired
event_flag_reset(8, 7)
-- deku merchant has landed)
event_flag_reset(73, 2)
-- Talked to Town Scrub once as Deku
event_flag_reset(86, 2)
-- similar to above?
event_flag_reset(17, 5)
-- Obtained Land Title Deed
event_flag_reset(17, 7)
-- Tatl talks about clock tower entrance
event_flag_reset(79, 4)
-- Clock Tower is open?
event_flag_reset( 8, 6)
-- Tatl telling Link to hurry at Clock Tower
event_flag_reset(88, 5)
end
local playas_group = {}
local playas_mm_group = {}
local playas_menu = oot and Menu{
Screen{
Text("Play as..."),
Radio("Default", playas_group, dummy),
Radio("Child Link", playas_group, playas_child),
Radio("Adult Link", playas_group, playas_adult),
Text(""),
Oneshot("Reload Scene", reload_scene),
Back(),
},
} or Menu{
Screen{
Text("Play as..."),
Radio("Default", playas_mm_group, dummy),
Radio("Human Link", playas_mm_group, playas_human),
Radio("Deku Link", playas_mm_group, playas_deku),
Radio("Goron Link", playas_mm_group, playas_goron),
Radio("Zora Link", playas_mm_group, playas_zora),
Radio("Fierce Deity", playas_mm_group, playas_fd),
Text(""),
Oneshot("Reload Scene", reload_scene),
Back(),
},
}
local progress_menu = Menu{
Screen{
Text("Progress Menu #1/1"),
Oneshot("Setup First Cycle", first_cycle),
Text(""),
Back(),
},
}
local function gen_set_day(x)
local cb = Callbacks()
function cb:on()
addrs.day(x)
addrs.days_elapsed(x)
end
return cb
end
local function gen_set_time(x)
local cb = Callbacks()
function cb:on()
addrs.time(x)
end
return cb
end
local time_menu = Menu{ local time_menu = Menu{
Screen{ Screen{
Text("Day/Time Menu #1/1"), Text("Day/Time Menu #1/1"),
@ -292,6 +148,10 @@ local time_menu = Menu{
}, },
} }
local warp_menu = require "menus.warp"
local progress_menu = require "menus.progress"
local playas_menu = require "menus.playas"
local main_menu = Menu{ local main_menu = Menu{
-- TODO: seperator item that's just a few underscores with half height -- TODO: seperator item that's just a few underscores with half height
Screen{ Screen{

62
Lua/menus/playas.lua Normal file
View file

@ -0,0 +1,62 @@
local playas_child = Passive()
function playas_child:tick_on()
addrs.age_modifier_global(1)
end
local playas_adult = Passive()
function playas_adult:tick_on()
addrs.age_modifier_global(0)
end
local PassiveResetMask = Class(Passive)
function PassiveResetMask:on()
Passive.on(self)
addrs.mask_worn(0)
end
local playas_human = PassiveResetMask()
function playas_human:tick_on()
addrs.transformation(4)
end
local playas_deku = PassiveResetMask()
function playas_deku:tick_on()
addrs.transformation(3)
end
local playas_goron = PassiveResetMask()
function playas_goron:tick_on()
addrs.transformation(1)
end
local playas_zora = PassiveResetMask()
function playas_zora:tick_on()
addrs.transformation(2)
end
local playas_fd = PassiveResetMask()
function playas_fd:tick_on()
addrs.transformation(0)
end
local playas_group = {}
local playas_mm_group = {}
return oot and Menu{
Screen{
Text("Play as..."),
Radio("Default", playas_group, dummy),
Radio("Child Link", playas_group, playas_child),
Radio("Adult Link", playas_group, playas_adult),
Text(""),
Oneshot("Reload Scene", reload_scene),
Back(),
},
} or Menu{
Screen{
Text("Play as..."),
Radio("Default", playas_mm_group, dummy),
Radio("Human Link", playas_mm_group, playas_human),
Radio("Deku Link", playas_mm_group, playas_deku),
Radio("Goron Link", playas_mm_group, playas_goron),
Radio("Zora Link", playas_mm_group, playas_zora),
Radio("Fierce Deity", playas_mm_group, playas_fd),
Text(""),
Oneshot("Reload Scene", reload_scene),
Back(),
},
}

61
Lua/menus/progress.lua Normal file
View file

@ -0,0 +1,61 @@
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)
-- 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)
-- happy mask salesman talking at door
scene_flag_reset(0x63, 1, 0)
-- bombers ladder balloon
scene_flag_reset(0x29, 1, 1)
-- other things to consider resetting:
-- skull kid stuff
-- deed trading quest entirely
-- bombers stuff (they don't let you do it twice)
-- ability to learn song of healing + get deku mask <--
-- "oh no! the great fairy!"
-- moon's tear has landed
event_flag_reset(74, 5)
event_flag_reset(74, 7)
-- moon's tear acquired
event_flag_reset(74, 6)
-- skullkid jumped off clock tower thru telescope
event_flag_reset(12, 2)
-- clock town fairy acquired
event_flag_reset(8, 7)
-- deku merchant has landed)
event_flag_reset(73, 2)
-- Talked to Town Scrub once as Deku
event_flag_reset(86, 2)
-- similar to above?
event_flag_reset(17, 5)
-- Obtained Land Title Deed
event_flag_reset(17, 7)
-- Tatl talks about clock tower entrance
event_flag_reset(79, 4)
-- Clock Tower is open?
event_flag_reset( 8, 6)
-- Tatl telling Link to hurry at Clock Tower
event_flag_reset(88, 5)
end
return Menu{
Screen{
Text("Progress Menu #1/1"),
Oneshot("Setup First Cycle", first_cycle),
Text(""),
Back(),
},
}