2015-05-26 06:40:47 -07:00
|
|
|
require = require "depend"
|
2015-03-04 21:38:30 -08:00
|
|
|
require "boilerplate"
|
2015-05-03 16:46:09 -07:00
|
|
|
require "addrs.init"
|
|
|
|
require "classes"
|
|
|
|
require "menu classes"
|
2015-05-07 15:27:26 -07:00
|
|
|
require "messages"
|
2015-03-04 21:38:30 -08:00
|
|
|
|
2015-11-10 05:59:03 -08:00
|
|
|
local warp_menu = require "warp menu"
|
|
|
|
|
2015-05-26 07:01:37 -07:00
|
|
|
local dummy = Callbacks()
|
|
|
|
|
2015-05-03 16:46:09 -07:00
|
|
|
local passives = {}
|
2015-03-04 21:38:30 -08:00
|
|
|
|
2015-05-03 16:46:09 -07:00
|
|
|
Passive = Class(Callbacks)
|
|
|
|
function Passive:init(...)
|
|
|
|
Callbacks.init(self, ...)
|
|
|
|
table.insert(passives, self)
|
2015-03-04 21:38:30 -08:00
|
|
|
end
|
2015-05-03 16:46:09 -07:00
|
|
|
function Passive:tick()
|
2015-05-26 10:44:34 -07:00
|
|
|
if self.state then self:tick_on() end
|
|
|
|
end
|
|
|
|
function Passive:tick_on()
|
2015-03-04 21:38:30 -08:00
|
|
|
end
|
|
|
|
|
2015-05-03 16:46:09 -07:00
|
|
|
local levitate = Passive()
|
2015-05-26 10:44:34 -07:00
|
|
|
function levitate:tick_on()
|
|
|
|
if bit.band(addrs.buttons(), 0x20) > 0 then
|
|
|
|
self:hold()
|
2015-03-04 21:38:30 -08:00
|
|
|
end
|
|
|
|
end
|
2015-05-03 16:46:09 -07:00
|
|
|
function levitate:hold()
|
|
|
|
addrs.link_actor.y_vel(10)
|
|
|
|
end
|
2015-03-04 21:38:30 -08:00
|
|
|
|
2015-05-13 11:16:02 -07:00
|
|
|
local supersonic = Passive()
|
2015-05-26 10:44:34 -07:00
|
|
|
function supersonic:tick_on()
|
|
|
|
if bit.band(addrs.buttons(), 0x8000) > 0 then
|
|
|
|
self:hold()
|
2015-05-13 11:16:02 -07:00
|
|
|
end
|
|
|
|
end
|
|
|
|
function supersonic:hold()
|
|
|
|
addrs.link_actor.lin_vel(20)
|
|
|
|
end
|
|
|
|
|
2015-05-03 16:46:09 -07:00
|
|
|
local everything = Callbacks()
|
|
|
|
function everything:on()
|
|
|
|
dofile("oneshot.lua")
|
|
|
|
end
|
2015-03-04 21:38:30 -08:00
|
|
|
|
2015-11-10 05:59:03 -08:00
|
|
|
local escape_cutscene = Callbacks()
|
|
|
|
function escape_cutscene:on()
|
|
|
|
addrs.cutscene_status_2(3)
|
|
|
|
end
|
|
|
|
|
2015-05-03 16:46:09 -07:00
|
|
|
local self_destruct = Callbacks()
|
|
|
|
function self_destruct:on()
|
|
|
|
addrs.hearts(0)
|
|
|
|
end
|
2015-03-04 21:38:30 -08:00
|
|
|
|
2015-05-26 07:01:37 -07:00
|
|
|
local playas_child = Passive()
|
2015-05-26 10:44:34 -07:00
|
|
|
function playas_child:tick_on()
|
|
|
|
addrs.age_modifier_global(1)
|
2015-05-26 06:40:47 -07:00
|
|
|
end
|
2015-05-26 07:01:37 -07:00
|
|
|
local playas_adult = Passive()
|
2015-05-26 10:44:34 -07:00
|
|
|
function playas_adult:tick_on()
|
|
|
|
addrs.age_modifier_global(0)
|
2015-05-26 06:40:47 -07:00
|
|
|
end
|
|
|
|
|
2015-05-26 10:44:34 -07:00
|
|
|
local PassiveResetMask = Class(Passive)
|
|
|
|
function PassiveResetMask:on()
|
|
|
|
Passive.on(self)
|
2015-05-26 06:40:47 -07:00
|
|
|
addrs.mask_worn(0)
|
2015-05-26 10:44:34 -07:00
|
|
|
end
|
|
|
|
|
|
|
|
local playas_human = PassiveResetMask()
|
|
|
|
function playas_human:tick_on()
|
2015-05-26 06:40:47 -07:00
|
|
|
addrs.transformation(4)
|
|
|
|
end
|
2015-05-26 10:44:34 -07:00
|
|
|
local playas_deku = PassiveResetMask()
|
|
|
|
function playas_deku:tick_on()
|
2015-05-26 06:40:47 -07:00
|
|
|
addrs.transformation(3)
|
|
|
|
end
|
2015-05-26 10:44:34 -07:00
|
|
|
local playas_goron = PassiveResetMask()
|
|
|
|
function playas_goron:tick_on()
|
2015-05-26 06:40:47 -07:00
|
|
|
addrs.transformation(1)
|
|
|
|
end
|
2015-05-26 10:44:34 -07:00
|
|
|
local playas_zora = PassiveResetMask()
|
|
|
|
function playas_zora:tick_on()
|
2015-05-26 06:40:47 -07:00
|
|
|
addrs.transformation(2)
|
|
|
|
end
|
2015-05-26 10:44:34 -07:00
|
|
|
local playas_fd = PassiveResetMask()
|
|
|
|
function playas_fd:tick_on()
|
2015-05-26 06:40:47 -07:00
|
|
|
addrs.transformation(0)
|
|
|
|
end
|
|
|
|
|
2015-05-26 07:01:37 -07:00
|
|
|
local playas_group = {}
|
2015-05-26 10:44:34 -07:00
|
|
|
local playas_mm_group = {}
|
2015-05-26 07:01:37 -07:00
|
|
|
|
2015-05-26 06:40:47 -07:00
|
|
|
local playas_menu = oot and Menu{
|
|
|
|
Screen{
|
|
|
|
Text("Play as..."),
|
2015-05-26 07:01:37 -07:00
|
|
|
Radio("Default", playas_group, dummy),
|
|
|
|
Radio("Child Link", playas_group, playas_child),
|
|
|
|
Radio("Adult Link", playas_group, playas_adult),
|
2015-05-26 06:40:47 -07:00
|
|
|
Back(),
|
|
|
|
},
|
|
|
|
} or Menu{
|
|
|
|
Screen{
|
|
|
|
Text("Play as..."),
|
2015-05-26 10:44:34 -07:00
|
|
|
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),
|
2015-05-26 06:40:47 -07:00
|
|
|
Back(),
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
2015-11-10 05:59:03 -08:00
|
|
|
|
2015-05-03 16:46:09 -07:00
|
|
|
local main_menu = Menu{
|
|
|
|
Screen{
|
2015-05-26 08:43:23 -07:00
|
|
|
Text("Main Menu #1/2"),
|
2015-11-10 05:59:03 -08:00
|
|
|
--Toggle("L to Levitate", levitate),
|
2015-05-13 11:16:02 -07:00
|
|
|
Toggle("A to Run Fast", supersonic),
|
2015-05-03 16:46:09 -07:00
|
|
|
Hold("Levitate", levitate),
|
|
|
|
Oneshot("100%", everything),
|
2015-11-10 05:59:03 -08:00
|
|
|
Oneshot("Escape Cutscene", escape_cutscene),
|
|
|
|
LinkTo("Play as...", playas_menu),
|
|
|
|
LinkTo("Warp to...", warp_menu),
|
2015-05-03 16:46:09 -07:00
|
|
|
Back(),
|
|
|
|
},
|
|
|
|
Screen{
|
2015-05-26 08:43:23 -07:00
|
|
|
Text("Main Menu #2/2"),
|
2015-05-03 16:46:09 -07:00
|
|
|
Oneshot("Kill Link", self_destruct),
|
|
|
|
Flags("some flags"),
|
|
|
|
Text("k"),
|
|
|
|
Back(),
|
|
|
|
},
|
|
|
|
}
|
2015-03-04 21:38:30 -08:00
|
|
|
|
2015-05-03 16:46:09 -07:00
|
|
|
local input = InputHandler{
|
|
|
|
enter = "P1 L",
|
|
|
|
up = "P1 DPad U",
|
|
|
|
down = "P1 DPad D",
|
|
|
|
left = "P1 DPad L",
|
|
|
|
right = "P1 DPad R",
|
|
|
|
}
|
2015-03-04 21:38:30 -08:00
|
|
|
|
2015-05-26 08:43:23 -07:00
|
|
|
local handle = MenuHandler(main_menu, T_TL)
|
2015-03-04 21:38:30 -08:00
|
|
|
|
2015-05-03 16:46:09 -07:00
|
|
|
while mm or oot do
|
|
|
|
local ctrl, pressed = input:update()
|
2015-05-26 08:15:36 -07:00
|
|
|
handle:update(ctrl, pressed)
|
2015-03-04 21:38:30 -08:00
|
|
|
|
2015-05-03 16:46:09 -07:00
|
|
|
for i, passive in ipairs(passives) do
|
|
|
|
passive:tick()
|
2015-03-04 21:38:30 -08:00
|
|
|
end
|
|
|
|
|
2015-05-03 16:46:09 -07:00
|
|
|
emu.frameadvance()
|
2015-03-04 21:38:30 -08:00
|
|
|
end
|