From 6d7d4975b60619a45d8913c3805dde608a50008d Mon Sep 17 00:00:00 2001 From: Connor Olding Date: Wed, 18 Mar 2015 21:50:35 -0700 Subject: [PATCH] use arrays for actor types --- Lua/A O US10.lua | 55 ++++++++++++++++++++++++-------------------- Lua/A common.lua | 55 +++++++++++++++++++++++++------------------- Lua/actor lister.lua | 7 +++--- 3 files changed, 64 insertions(+), 53 deletions(-) diff --git a/Lua/A O US10.lua b/Lua/A O US10.lua index dfd7dd0..1818d6f 100644 --- a/Lua/A O US10.lua +++ b/Lua/A O US10.lua @@ -151,32 +151,37 @@ local common = { }, camera_target = AG(0x270, 4), + actor_count = AG(0x1C2C, 1), - -- TODO: use array here instead of individual keys - actor_count_0 = AG(0x1C30, 4), - actor_first_0 = AG(0x1C34, 4), - actor_count_1 = AG(0x1C38, 4), - actor_first_1 = AG(0x1C3C, 4), - actor_count_2 = AG(0x1C40, 4), - actor_first_2 = AG(0x1C44, 4), - actor_count_3 = AG(0x1C48, 4), - actor_first_3 = AG(0x1C4C, 4), - actor_count_4 = AG(0x1C50, 4), - actor_first_4 = AG(0x1C54, 4), - actor_count_5 = AG(0x1C58, 4), - actor_first_5 = AG(0x1C5C, 4), - actor_count_6 = AG(0x1C60, 4), - actor_first_6 = AG(0x1C64, 4), - actor_count_7 = AG(0x1C68, 4), - actor_first_7 = AG(0x1C6C, 4), - actor_count_8 = AG(0x1C70, 4), - actor_first_8 = AG(0x1C74, 4), - actor_count_9 = AG(0x1C78, 4), - actor_first_9 = AG(0x1C7C, 4), - actor_count_10 = AG(0x1C80, 4), - actor_first_10 = AG(0x1C84, 4), - actor_count_11 = AG(0x1C88, 4), - actor_first_11 = AG(0x1C8C, 4), + actor_counts = { + [0]=AG(0x1C30, 4), + AG(0x1C38, 4), + AG(0x1C40, 4), + AG(0x1C48, 4), + AG(0x1C50, 4), + AG(0x1C58, 4), + AG(0x1C60, 4), + AG(0x1C68, 4), + AG(0x1C70, 4), + AG(0x1C78, 4), + AG(0x1C80, 4), + AG(0x1C88, 4), + }, + actor_firsts = { + [0]=AG(0x1C34, 4), + AG(0x1C3C, 4), + AG(0x1C44, 4), + AG(0x1C4C, 4), + AG(0x1C54, 4), + AG(0x1C5C, 4), + AG(0x1C64, 4), + AG(0x1C6C, 4), + AG(0x1C74, 4), + AG(0x1C7C, 4), + AG(0x1C84, 4), + AG(0x1C8C, 4), + }, + z_cursor_actor = AG(0x1CC8, 4), z_target_actor = AG(0x1CCC, 4), } diff --git a/Lua/A common.lua b/Lua/A common.lua index f2985ef..b0ea65d 100755 --- a/Lua/A common.lua +++ b/Lua/A common.lua @@ -205,30 +205,37 @@ return { 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), + + actor_count = AG(0x1CAE, 1), + actor_counts = { + [0]=AG(0x1CB0, 4), + AG(0x1CBC, 4), + AG(0x1CC8, 4), + AG(0x1CD4, 4), + AG(0x1CE0, 4), + AG(0x1CEC, 4), + AG(0x1CF8, 4), + AG(0x1D04, 4), + AG(0x1D10, 4), + AG(0x1D1C, 4), + AG(0x1D28, 4), + AG(0x1D34, 4), + }, + actor_firsts = { + [0]=AG(0x1CB4, 4), + AG(0x1CC0, 4), + AG(0x1CCC, 4), + AG(0x1CD8, 4), + AG(0x1CE4, 4), + AG(0x1CF0, 4), + AG(0x1CFC, 4), + AG(0x1D08, 4), + AG(0x1D14, 4), + AG(0x1D20, 4), + AG(0x1D2C, 4), + AG(0x1D38, 4), + }, + bomb_counter = AG(0x1CD4, 1), z_cursor_actor = AG(0x1DF8, 4), z_target_actor = AG(0x1DFC, 4), diff --git a/Lua/actor lister.lua b/Lua/actor lister.lua index 420dbd0..050d967 100755 --- a/Lua/actor lister.lua +++ b/Lua/actor lister.lua @@ -7,7 +7,6 @@ require "addrs" local actor_t = Actor(0) local oot = version:sub(1, 2) == "O " -local al_next = addrs.actor_count_1.addr - addrs.actor_count_0.addr local actor_names, damage_names if oot then @@ -34,11 +33,11 @@ function pmask(p) end function get_actor_count(i) - return R4(addrs.actor_count_0.addr + i*al_next) + return R4(addrs.actor_counts[i].addr) end function get_first_actor(i) - return pmask(R4(addrs.actor_first_0.addr + i*al_next)) + return pmask(R4(addrs.actor_firsts[i].addr)) end function get_next_actor(addr) @@ -112,7 +111,7 @@ local focus_at = 2 local focus_ai = 0 -- hack to avoid N64 logo spitting errors -local stupid = addrs.actor_count_0.addr - 0x8 +local stupid = addrs.actor_counts[0].addr - 0x8 while true do local any = 0