1
0
Fork 0
mirror of https://github.com/notwa/mm synced 2024-06-28 21:07:12 -07:00
mm/Lua/A common.lua

250 lines
9.1 KiB
Lua
Raw Normal View History

-- version-agnostic addresses
2015-03-07 15:53:37 -08:00
A = require "boilerplate"
function merge(t1, t2)
for k, v in pairs(t1) do
t2[k] = v
end
return t2
end
function Actor(addr)
local function AA(a, s) return A(addr+a, s) end
return {
2015-03-07 07:38:16 -08:00
num = AA(0x0, 2),
type = AA(0x2, 1),
flags = AA(0x4, 4),
x_copy = AA(0x8, 'f'),
y_copy = AA(0xC, 'f'),
z_copy = AA(0x10, 'f'),
2015-03-07 07:38:16 -08:00
var = AA(0x1C, 2),
x = AA(0x24, 'f'),
y = AA(0x28, 'f'),
z = AA(0x2C, 'f'),
angle_old = AA(0x4A, 2),
x_scale = AA(0x58, 'f'),
y_scale = AA(0x5C, 'f'),
z_scale = AA(0x60, 'f'),
x_vel = AA(0x64, 'f'),
y_vel = AA(0x68, 'f'),
z_vel = AA(0x6C, 'f'),
lin_vel_old = AA(0x70, 'f'),
ground_y = AA(0x88, 'f'),
2015-03-07 07:38:16 -08:00
damage_table = AA(0xA0, 4),
hp = AA(0xB7, 1),
angle = AA(0xBA, 2),
2015-03-18 17:50:55 -07:00
foot_left_x = AA(0xD4, 'f'), -- tested on Link, may be other things
foot_left_y = AA(0xD8, 'f'),
foot_left_z = AA(0xDC, 'f'),
2015-03-18 17:50:55 -07:00
foot_right_x = AA(0xE0, 'f'), -- tested on Link, may be other things
foot_right_y = AA(0xE4, 'f'),
foot_right_z = AA(0xE8, 'f'),
camera_rel_x = AA(0xEC, 'f'),
camera_rel_y = AA(0xF0, 'f'),
camera_rel_z = AA(0xF4, 'f'),
unknown_z = AA(0xF8, 'f'),
x_old = AA(0x108, 'f'),
y_old = AA(0x10C, 'f'),
z_old = AA(0x108, 'f'),
prev = AA(0x128, 4),
next = AA(0x12C, 4),
}
end
return {
link = A(link, 0x4000),
2015-03-08 09:38:43 -07:00
exit_value = AL(0x02, 2),
2015-03-07 15:53:37 -08:00
intro_completed = AL(0x05, 1),
cutscene_status = AL(0x0A, 2),
time = AL(0x0C, 2),
2015-03-07 15:53:37 -08:00
owl_id = AL(0x0E, 2),
day_night = AL(0x10, 4),
time_speed = AL(0x14, 4),
day = AL(0x18, 4),
day_again = AL(0x1C, 4),
transformation = AL(0x20, 1),
2015-03-08 09:38:43 -07:00
owl_save = AL(0x23, 1), -- "zeroth day" effect
2015-03-07 15:53:37 -08:00
ZELDA3 = AL(0x24, 6),
sot_count = AL(0x2A, 2),
name = AL(0x2C, 8),
max_hearts = AL(0x34, 2),
hearts = AL(0x36, 2),
2015-03-07 15:53:37 -08:00
has_magic = AL(0x38, 1), -- ?
magic = AL(0x39, 1),
rupees = AL(0x3A, 2),
2015-03-07 15:53:37 -08:00
has_normal_magic = AL(0x40, 1),
has_double_magic = AL(0x41, 1),
owls_hit = AL(0x46, 2),
sword_shield = AL(0x6D, 1),
inventory_items = AL(0x70, 24),
inventory_masks = AL(0x88, 24),
2015-03-18 17:50:55 -07:00
inventory_quantities= AL(0xA0, 24),
2015-03-07 15:53:37 -08:00
wallet_size = AL(0xBA, 1), -- 0, 16, 32, unused 48
quiver_bag = AL(0xBB, 1),
2015-03-07 15:53:37 -08:00
quest_items = AL(0xBC, 4),
items_wft = AL(0xC0, 1),
items_sht = AL(0xC1, 1),
items_gbt = AL(0xC2, 1),
items_stt = AL(0xC3, 1),
keys_wft = AL(0xCA, 1),
keys_sht = AL(0xCB, 1),
keys_gbt = AL(0xCC, 1),
keys_stt = AL(0xCD, 1),
2015-03-08 09:38:43 -07:00
doubled_hearts = AL(0xD3, 1), -- set to 20 by the game
2015-03-07 15:53:37 -08:00
fairies_wft = AL(0xD4, 1),
fairies_sht = AL(0xD5, 1),
fairies_gbt = AL(0xD6, 1),
fairies_stt = AL(0xD7, 1),
strange_string = AL(0xDE, 6),
scene_flags_save = AL(0x470, 0x960),
2015-03-07 15:53:37 -08:00
--clock_town_map = AL(0xEB2, 1),
2015-03-08 09:38:43 -07:00
slulltula_count_wf = AL(0xEC0, 2),
slulltula_count_gb = AL(0xEC2, 2),
banked_rupees = AL(0xEDE, 2),
archery = AL(0xF00, 1),
2015-03-07 15:53:37 -08:00
chateau_romani = AL(0xF06, 1), -- 8
disable_c_buttons = AL(0xF4A, 1), -- 8
sword_disable_c = AL(0xF52, 1), -- 32
map_visited = AL(0xF5E, 2),
map_visible = AL(0xF62, 2),
2015-03-07 15:53:37 -08:00
bombers_caught = AL(0xFE6, 1),
bombers_order_1 = AL(0xFE7, 1),
bombers_order_2 = AL(0xFE8, 1),
bombers_order_3 = AL(0xFE9, 1),
bombers_order_4 = AL(0xFEA, 1),
bombers_order_5 = AL(0xFEB, 1),
lottery_code_1 = AL(0xFEC, 3),
lottery_code_2 = AL(0xFEF, 3),
lottery_code_3 = AL(0xFF2, 3),
spider_mask_color_1 = AL(0xFF5, 1), -- 0: red; 1: blue; 2: green; 3: yellow
spider_mask_color_2 = AL(0xFF6, 1),
spider_mask_color_3 = AL(0xFF7, 1),
spider_mask_color_4 = AL(0xFF8, 1),
spider_mask_color_5 = AL(0xFF9, 1),
bombers_code_1 = AL(0xFFB, 1),
bombers_code_2 = AL(0xFFC, 1),
bombers_code_3 = AL(0xFFD, 1),
bombers_code_4 = AL(0xFFE, 1),
bombers_code_5 = AL(0xFFF, 1),
inventory = {
2015-03-18 17:50:55 -07:00
b_button_item = AL(0x4C, 1),
2015-03-07 15:53:37 -08:00
c_left_item = AL(0x4D, 1),
c_down_item = AL(0x4E, 1),
c_right_item = AL(0x4F, 1),
b_button_goron = AL(0x50, 1),
b_button_zora = AL(0x54, 1),
b_button_deku = AL(0x58, 1),
b_button_slot = AL(0x5C, 1), -- unused?
c_left_slot = AL(0x5D, 1),
c_down_slot = AL(0x5E, 1),
c_right_slot = AL(0x5F, 1),
ocarina = AL(0x70, 1),
bow = AL(0x71, 1),
fire_arrows = AL(0x72, 1),
ice_arrows = AL(0x73, 1),
light_arrows = AL(0x74, 1),
event_1 = AL(0x75, 1),
bombs = AL(0x76, 1),
bombchu = AL(0x77, 1),
deku_stick = AL(0x78, 1),
deku_nut = AL(0x79, 1),
magic_beans = AL(0x7A, 1),
event_2 = AL(0x7B, 1),
powder_keg = AL(0x7C, 1),
pictograph = AL(0x7D, 1),
lens_of_truth = AL(0x7E, 1),
hookshot = AL(0x7F, 1),
fairy_sword = AL(0x80, 1),
event_3 = AL(0x81, 1),
bottle_1 = AL(0x82, 1),
bottle_2 = AL(0x83, 1),
bottle_3 = AL(0x84, 1),
bottle_4 = AL(0x85, 1),
bottle_5 = AL(0x86, 1),
bottle_6 = AL(0x87, 1),
},
masks = {
postman = AL(0x88, 1),
all_night = AL(0x89, 1),
blast = AL(0x8A, 1),
stone = AL(0x8B, 1),
great_fairy = AL(0x8C, 1),
deku = AL(0x8D, 1),
keaton = AL(0x8E, 1),
bremen = AL(0x8F, 1),
bunny = AL(0x90, 1),
don_gero = AL(0x91, 1),
scents = AL(0x92, 1),
goron = AL(0x93, 1),
romani = AL(0x94, 1),
troupe_leader = AL(0x95, 1),
kafei = AL(0x96, 1),
couples = AL(0x97, 1),
truth = AL(0x98, 1),
zora = AL(0x99, 1),
kamaro = AL(0x9A, 1),
gibdo = AL(0x9B, 1),
garos = AL(0x9C, 1),
captains = AL(0x9D, 1),
giants = AL(0x9E, 1),
fierce_deity = AL(0x9F, 1),
},
2015-03-08 09:38:43 -07:00
quantities = {
arrows = AL(0xA1, 1),
bombs = AL(0xA6, 1),
bombchu = AL(0xA7, 1),
sticks = AL(0xA8, 1),
nuts = AL(0xA9, 1),
beans = AL(0xAA, 1),
kegs = AL(0xAC, 1),
},
buttons_1 = AG(0x1A, 1),
buttons_2 = AG(0x1B, 1),
framerate_limiter = AG(0xA2, 1),
camera_target = AG(0x2B0, 4),
actor_count_0 = AG(0x1CB0, 4),
actor_first_0 = AG(0x1CB4, 4),
actor_count_1 = AG(0x1CBC, 4),
actor_first_1 = AG(0x1CC0, 4),
actor_count_2 = AG(0x1CC8, 4),
actor_first_2 = AG(0x1CCC, 4),
actor_count_3 = AG(0x1CD4, 4),
actor_first_3 = AG(0x1CD8, 4),
actor_count_4 = AG(0x1CE0, 4),
actor_first_4 = AG(0x1CE4, 4),
actor_count_5 = AG(0x1CEC, 4),
actor_first_5 = AG(0x1CF0, 4),
actor_count_6 = AG(0x1CF8, 4),
actor_first_6 = AG(0x1CFC, 4),
actor_count_7 = AG(0x1D04, 4),
actor_first_7 = AG(0x1D08, 4),
actor_count_8 = AG(0x1D10, 4),
actor_first_8 = AG(0x1D14, 4),
actor_count_9 = AG(0x1D1C, 4),
actor_first_9 = AG(0x1D20, 4),
actor_count_10 = AG(0x1D28, 4),
actor_first_10 = AG(0x1D2C, 4),
actor_count_11 = AG(0x1D34, 4),
actor_first_11 = AG(0x1D38, 4),
bomb_counter = AG(0x1CD4, 1),
z_cursor_actor = AG(0x1DF8, 4),
z_target_actor = AG(0x1DFC, 4),
2015-03-13 12:13:56 -07:00
current_scene_flags_2 = AG(0x1E58, 4), -- note: I use SRAM ordering here
current_scene_flags_3 = AG(0x1E5C, 4),
current_scene_flags_1 = AG(0x1E68, 4),
current_scene_flags_4 = AG(0x1E6C, 4),
current_scene_flags_5 = AG(0x1E74, 4),
link_actor = merge(Actor(AA(0,0).addr), {
item_in_hand = AA(0x148, 1),
animation_id = AA(0x24A, 2),
link_flags = AA(0xA6C, 0xC),
lin_vel = AA(0xAD0, 'f'),
movement_angle = AA(0xAD4, 2),
active_sword = AA(0xADB, 1),
}),
}