mirror of
https://github.com/notwa/mm
synced 2024-11-05 02:59:03 -08:00
vastly improve race file generation
This commit is contained in:
parent
35b177081b
commit
f32a151d5a
3 changed files with 85 additions and 16 deletions
|
@ -30,6 +30,11 @@ return {
|
|||
AL(0x1383, 1),
|
||||
},
|
||||
|
||||
epona_scene = AL(0x1384, 2), -- this is where you left epona
|
||||
epona_x = AL(0x1386, 2), -- NOT where she currently is
|
||||
epona_y = AL(0x1388, 2),
|
||||
epona_z = AL(0x138A, 2),
|
||||
epona_angle = AL(0x138C, 2),
|
||||
checksum = AL(0x138E, 2),
|
||||
disable_pause = nil,
|
||||
hookshot_ba = nil,
|
||||
|
|
|
@ -147,7 +147,7 @@ return {
|
|||
fairies_gbt = AL(0xD6, 1),
|
||||
fairies_stt = AL(0xD7, 1),
|
||||
strange_string = AL(0xDE, 6),
|
||||
scene_flags_save = AL(0x470, 0x960),
|
||||
scene_flags_save = AL(0xF8, 0xD20), -- 0x1C per scene instead of 0x14!
|
||||
--clock_town_map = AL(0xEB2, 1),
|
||||
slulltula_count_wf = AL(0xEC0, 2),
|
||||
slulltula_count_gb = AL(0xEC2, 2),
|
||||
|
|
|
@ -5,30 +5,58 @@ local inv = a.inventory
|
|||
local masks = a.masks
|
||||
local quantities = a.quantities
|
||||
|
||||
if not mm then return end
|
||||
local early = version == "M JP10" or version == "M JP11"
|
||||
|
||||
local zelda3 = "ZELDA3"
|
||||
-- TODO: support (E) text format too
|
||||
local link_str = {0x15, 0x12, 0x17, 0x14, 0x3E, 0x3E, 0x3E, 0x3E}
|
||||
local lastsaveslot = 1
|
||||
local iv
|
||||
if version == "M JP10" or version == "M JP11" then
|
||||
if early then
|
||||
link_str = {0xB6, 0xB3, 0xB8, 0xB5, 0xDF, 0xDF, 0xDF, 0xDF}
|
||||
lastsaveslot = 2
|
||||
iv = require "data.item values early"
|
||||
elseif oot then
|
||||
iv = require "data.item values oot"
|
||||
else
|
||||
iv = require "data.item values"
|
||||
end
|
||||
|
||||
require "flag manager"
|
||||
|
||||
-- TODO: re-enable this once i stop it from breaking on (J).
|
||||
--for i=a.link.addr, a.link.addr + a.link.type - 1, 4 do W4(i, 0) end
|
||||
for i = a.link.addr, a.link.addr + a.link.type - 1, 4 do W4(i, 0) end
|
||||
|
||||
if a.current_save() == 0xFF then a.current_save(lastsaveslot) end
|
||||
|
||||
for i = 1, 6 do W1(a.ZELDA3.addr + i - 1, zelda3:sub(i, i):byte()) end
|
||||
AL(0x50, 4)(0x6CFFFFFF) -- goron C/B buttons
|
||||
AL(0x54, 4)(0x6CFFFFFF) -- zora C/B buttons
|
||||
AL(0x58, 4)(0x09FFFFFF) -- deku C/B buttons
|
||||
AL(0x60, 4)(0xFFFFFFFF) -- unknown
|
||||
AL(0x64, 4)(0xFFFFFFFF) -- unknown
|
||||
AL(0x68, 4)(0xFFFFFFFF) -- unknown
|
||||
|
||||
-- TODO: support (E) text format too
|
||||
if early then
|
||||
for i = 0, 7 do W1(a.name.addr + i, 0xDF) end
|
||||
W1(a.name.addr, 0)
|
||||
else
|
||||
for i = 0, 7 do W1(a.name.addr + i, 0x3E) end
|
||||
W1(a.name.addr, 0)
|
||||
end
|
||||
|
||||
-- new stuff
|
||||
if a.current_save() == 0xFF then a.current_save(2) end
|
||||
a.warp_begin(1)
|
||||
a.warp_destination(0xD800)
|
||||
a.cutscene_status_2(3)
|
||||
a.target_style(1)
|
||||
a.sot_count(1)
|
||||
--a.fade_timer(0x3C) -- doesn't help...
|
||||
-- TODO: force dialog after scene is loaded with SoT stored? could be nice
|
||||
|
||||
for i = 1, 8 do W1(a.link.addr + 0xDE + i - 1, link_str[i]) end
|
||||
for i = 1, 8 do W1(a.link.addr + 0xE6 + i - 1, link_str[i]) end
|
||||
for i = 1, 8 do W1(a.link.addr + 0xEE + i - 1, link_str[i]) end
|
||||
|
||||
AL(0xD2, 1)(0xFF) -- unused key counter
|
||||
|
||||
a.exit_value(0xD800)
|
||||
--a.mask_worn(0)
|
||||
a.intro_completed(1)
|
||||
|
@ -41,7 +69,7 @@ a.time(0x3FFF)
|
|||
a.transformation(4)
|
||||
a.have_tatl(1)
|
||||
--a.owl_save(0)
|
||||
--a.sot_count(2)
|
||||
a.sot_count(1)
|
||||
a.max_hearts(0x30)
|
||||
a.hearts(0x30)
|
||||
a.magic_level(1)
|
||||
|
@ -50,13 +78,16 @@ a.magic_max(0x30)
|
|||
--a.rupees(0)
|
||||
a.has_normal_magic(1)
|
||||
--a.has_double_magic(0)
|
||||
AL(0x44, 2)(0xFF00) -- unknown
|
||||
--a.owls_hit(0)
|
||||
AL(0x48, 2)(0xFF00) -- unknown
|
||||
AL(0x4A, 2)(0x0008) -- unknown
|
||||
for k, f in pairs(inv) do f(-1) end
|
||||
for k, f in pairs(masks) do f(-1) end
|
||||
inv.b_button_item(iv.kokiri_sword)
|
||||
inv.b_button_goron(iv.kokiri_sword)
|
||||
inv.b_button_zora(iv.kokiri_sword)
|
||||
inv.b_button_deku(iv.deku_nuts)
|
||||
inv.b_button_deku(iv.deku_nut)
|
||||
inv.c_left_item(iv.ocarina)
|
||||
inv.c_down_item(-1)
|
||||
inv.c_right_item(-1)
|
||||
|
@ -70,10 +101,7 @@ masks.deku(iv.deku)
|
|||
--for k, f in pairs(quantities) do f(0) end
|
||||
a.upgrades(0x00120000) -- deku nut 20 and deku stick 10
|
||||
a.quest_items(0x10003000)
|
||||
AL(0x3D7, 1)(5) -- unknown
|
||||
scene_flag_set(9, 0, 10)
|
||||
scene_flag_set(94, 2, 0)
|
||||
scene_flag_set(111, 4, 10)
|
||||
a.banked_rupees(101)
|
||||
AL(0xE6C, 4)(0x1D4C) -- unknown
|
||||
AL(0xE70, 4)(0x1D4C) -- unknown
|
||||
AL(0xE74, 4)(0x1DB0) -- unknown
|
||||
|
@ -112,4 +140,40 @@ a.epona_scene(53)
|
|||
a.epona_x(-1420)
|
||||
a.epona_y(257)
|
||||
a.epona_z(-1285)
|
||||
a.epona_angle(10922)
|
||||
a.epona_angle(10922) -- should actually be 35500? maybe?
|
||||
|
||||
local scene_count = 0x78
|
||||
|
||||
-- wipe all scene flags.
|
||||
for scene_id = 0, scene_count - 1 do
|
||||
local temp = a.scene_flags_ingame.addr + 0x14 * scene_id
|
||||
W4(temp + 0, 0)
|
||||
W4(temp + 1, 0)
|
||||
W4(temp + 2, 0)
|
||||
W4(temp + 3, 0)
|
||||
W4(temp + 4, 0)
|
||||
end
|
||||
|
||||
-- 0x1EFA44 should be 0x00000005
|
||||
scene_flag_set(26, 1, 0)
|
||||
scene_flag_set(26, 1, 2)
|
||||
-- 0x1EFB94 should be 0x00000400
|
||||
scene_flag_set(38, 1, 10)
|
||||
-- 0x1F0240 should be 0x00000001
|
||||
scene_flag_set(99, 1, 0)
|
||||
-- 0x1F039C should be 0x00000400
|
||||
scene_flag_set(111, 4, 10)
|
||||
|
||||
local src = a.scene_flags_ingame.addr
|
||||
local dst = a.scene_flags_save.addr
|
||||
for scene_id = 0, scene_count - 1 do
|
||||
local src_temp = src + scene_id * 0x14
|
||||
local dst_temp = dst + scene_id * 0x1C
|
||||
W4(dst_temp + 0, R4(src_temp + 0))
|
||||
W4(dst_temp + 4, R4(src_temp + 4))
|
||||
W4(dst_temp + 8, R4(src_temp + 8))
|
||||
W4(dst_temp + 12, R4(src_temp + 12))
|
||||
W4(dst_temp + 16, R4(src_temp + 16))
|
||||
W4(dst_temp + 20, 0)
|
||||
W4(dst_temp + 24, 0)
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue