From 0975b4e28e2e2443de368df8ebf7a0eb865c9e84 Mon Sep 17 00:00:00 2001 From: MysterD Date: Thu, 22 Jun 2023 02:16:26 -0700 Subject: [PATCH] Remove vestigial romhack camera code from mods --- mods/arena/arena-player.lua | 2 -- mods/arena/camera.lua | 40 ------------------------------------- mods/sm74/camera.lua | 38 ----------------------------------- mods/sm74/main.lua | 12 +---------- mods/star-road/camera.lua | 38 ----------------------------------- mods/star-road/main.lua | 12 +---------- 6 files changed, 2 insertions(+), 140 deletions(-) delete mode 100644 mods/arena/camera.lua delete mode 100644 mods/sm74/camera.lua delete mode 100644 mods/star-road/camera.lua diff --git a/mods/arena/arena-player.lua b/mods/arena/arena-player.lua index 91b6d21a..c8bcf09c 100644 --- a/mods/arena/arena-player.lua +++ b/mods/arena/arena-player.lua @@ -329,8 +329,6 @@ function mario_local_update(m) local s = gPlayerSyncTable[m.playerIndex] local e = gMarioStateExtras[m.playerIndex] - override_camera() - -- decrease cooldown if e.attackCooldown > 0 then e.attackCooldown = e.attackCooldown - 1 diff --git a/mods/arena/camera.lua b/mods/arena/camera.lua deleted file mode 100644 index aeab34dc..00000000 --- a/mods/arena/camera.lua +++ /dev/null @@ -1,40 +0,0 @@ -camera_set_use_course_specific_settings(false) - -sOverrideCameraModes = { - [CAMERA_MODE_RADIAL] = true, - [CAMERA_MODE_OUTWARD_RADIAL] = true, - [CAMERA_MODE_CLOSE] = true, - [CAMERA_MODE_SLIDE_HOOT] = true, - [CAMERA_MODE_PARALLEL_TRACKING] = true, - [CAMERA_MODE_FIXED] = true, - [CAMERA_MODE_8_DIRECTIONS] = true, - [CAMERA_MODE_FREE_ROAM] = true, - [CAMERA_MODE_SPIRAL_STAIRS] = true, -} - -local m = gMarioStates[0] - -function override_camera() - local np = gNetworkPlayers[0] - - if sOverrideCameraModes[m.area.camera.mode] == nil or np.currLevelNum == LEVEL_BOWSER_1 or np.currLevelNum == LEVEL_BOWSER_2 or np.currLevelNum == LEVEL_BOWSER_3 then - return - end - - set_camera_mode(m.area.camera, CAMERA_MODE_ROM_HACK, 0) -end - -function on_set_camera_mode(c, mode, frames) - if sOverrideCameraModes[mode] ~= nil and mode ~= CAMERA_MODE_ROM_HACK then - -- do not allow change - set_camera_mode(c, CAMERA_MODE_ROM_HACK, frames) - return false - end -end - -hook_event(HOOK_ON_SET_CAMERA_MODE, on_set_camera_mode) -hook_event(HOOK_UPDATE, function() - if (m.controller.buttonPressed & L_TRIG) ~= 0 then - center_rom_hack_camera() - end -end) diff --git a/mods/sm74/camera.lua b/mods/sm74/camera.lua deleted file mode 100644 index eadffdc2..00000000 --- a/mods/sm74/camera.lua +++ /dev/null @@ -1,38 +0,0 @@ -sOverrideCameraModes = { - [CAMERA_MODE_RADIAL] = true, - [CAMERA_MODE_OUTWARD_RADIAL] = true, - [CAMERA_MODE_CLOSE] = true, - [CAMERA_MODE_SLIDE_HOOT] = true, - [CAMERA_MODE_PARALLEL_TRACKING] = true, - [CAMERA_MODE_FIXED] = true, - [CAMERA_MODE_8_DIRECTIONS] = true, - [CAMERA_MODE_FREE_ROAM] = true, - [CAMERA_MODE_SPIRAL_STAIRS] = true, -} - -local m = gMarioStates[0] - -function override_camera() - local np = gNetworkPlayers[0] - - if sOverrideCameraModes[m.area.camera.mode] == nil or np.currLevelNum == LEVEL_BOWSER_1 or np.currLevelNum == LEVEL_BOWSER_2 or np.currLevelNum == LEVEL_BOWSER_3 then - return - end - - set_camera_mode(m.area.camera, CAMERA_MODE_ROM_HACK, 0) -end - -function on_set_camera_mode(c, mode, frames) - if sOverrideCameraModes[mode] ~= nil and mode ~= CAMERA_MODE_ROM_HACK then - -- do not allow change - set_camera_mode(c, CAMERA_MODE_ROM_HACK, frames) - return false - end -end - -hook_event(HOOK_ON_SET_CAMERA_MODE, on_set_camera_mode) -hook_event(HOOK_UPDATE, function() - if (m.controller.buttonPressed & L_TRIG) ~= 0 then - center_rom_hack_camera() - end -end) diff --git a/mods/sm74/main.lua b/mods/sm74/main.lua index e7a7e98e..d47cfaf2 100644 --- a/mods/sm74/main.lua +++ b/mods/sm74/main.lua @@ -86,20 +86,11 @@ smlua_audio_utils_replace_sequence(0x31, 0x11, 80, "31_Seq_sm74EE_custom") ------------ -- camera -- ------------ +camera_set_romhack_override(RCO_ALL_EXCEPT_BOWSER) camera_set_use_course_specific_settings(false) ---------------------------------- -function mario_update_local(m) - override_camera() -end - -function mario_update(m) - if m.playerIndex == 0 then - mario_update_local(m) - end -end - function on_level_init() local m = gMarioStates[0] local np = gNetworkPlayers[0] @@ -129,7 +120,6 @@ function on_swap_command(msg) return true end -hook_event(HOOK_MARIO_UPDATE, mario_update) hook_event(HOOK_ON_LEVEL_INIT, on_level_init) hook_event(HOOK_GET_STAR_COLLECTION_DIALOG, get_star_collection_dialog) hook_chat_command('swap', "swap between Extreme Edition and normal", on_swap_command) diff --git a/mods/star-road/camera.lua b/mods/star-road/camera.lua deleted file mode 100644 index ed3e629d..00000000 --- a/mods/star-road/camera.lua +++ /dev/null @@ -1,38 +0,0 @@ -sOverrideCameraModes = { - [CAMERA_MODE_RADIAL] = true, - [CAMERA_MODE_OUTWARD_RADIAL] = true, - [CAMERA_MODE_CLOSE] = true, - [CAMERA_MODE_SLIDE_HOOT] = true, - [CAMERA_MODE_PARALLEL_TRACKING] = true, - [CAMERA_MODE_FIXED] = true, - [CAMERA_MODE_8_DIRECTIONS] = true, - [CAMERA_MODE_FREE_ROAM] = true, - [CAMERA_MODE_SPIRAL_STAIRS] = true, -} - -local m = gMarioStates[0] - -function override_camera() - local np = gNetworkPlayers[0] - - if sOverrideCameraModes[m.area.camera.mode] == nil or np.currLevelNum == LEVEL_BOWSER_1 or np.currLevelNum == LEVEL_BOWSER_2 or np.currLevelNum == LEVEL_BOWSER_3 then - return - end - - set_camera_mode(m.area.camera, CAMERA_MODE_ROM_HACK, 0) -end - -function on_set_camera_mode(c, mode, frames) - if sOverrideCameraModes[mode] ~= nil and mode ~= CAMERA_MODE_ROM_HACK then - -- do not allow change - set_camera_mode(c, CAMERA_MODE_ROM_HACK, frames) - return false - end -end - -hook_event(HOOK_ON_SET_CAMERA_MODE, on_set_camera_mode) -hook_event(HOOK_UPDATE, function() - if (m.controller.buttonPressed & L_TRIG) ~= 0 then - center_rom_hack_camera() - end -end) \ No newline at end of file diff --git a/mods/star-road/main.lua b/mods/star-road/main.lua index 16a04324..1b5089f8 100644 --- a/mods/star-road/main.lua +++ b/mods/star-road/main.lua @@ -101,20 +101,11 @@ smlua_audio_utils_replace_sequence(0x32, 0x25, 80, "32_Seq_smsrdeluxe_custom") ------------ -- camera -- ------------ +camera_set_romhack_override(RCO_ALL_EXCEPT_BOWSER) camera_set_use_course_specific_settings(false) ---------------------------------- -function mario_update_local(m) - override_camera() -end - -function mario_update(m) - if m.playerIndex == 0 then - mario_update_local(m) - end -end - function on_death() local m = gMarioStates[0] if m.numLives <= 0 then @@ -130,7 +121,6 @@ function on_warp_and_init() -- 130 stars castle grounds music end end -hook_event(HOOK_MARIO_UPDATE, mario_update) hook_event(HOOK_ON_DEATH, on_death) hook_event(HOOK_ON_LEVEL_INIT, on_warp_and_init) hook_event(HOOK_ON_WARP, on_warp_and_init) \ No newline at end of file