diff --git a/mods/sm74/bhv-overrides.lua b/mods/sm74/bhv-overrides.lua index 99161d91e..02f83601d 100644 --- a/mods/sm74/bhv-overrides.lua +++ b/mods/sm74/bhv-overrides.lua @@ -1,52 +1,61 @@ -function bhv_custom_koopa_the_quick_loop(obj) - if obj.oKoopaMovementType >= KOOPA_BP_KOOPA_THE_QUICK_BASE then - obj.oKoopaTheQuickRaceIndex = (gNetworkPlayers[0].currAreaIndex - 1) +local COL_BOB_GATE = smlua_collision_util_get("bob_seg7_collision_gate") +local COL_GRATE_DOOR = smlua_collision_util_get("grate_door_col") +local COL_INSIDE_CASTLE_STAR_DOOR = smlua_collision_util_get("inside_castle_seg7_collision_star_door") +local COL_STAR_DOOR = smlua_collision_util_get("collision_star_door") +local COL_LLL_FLOATING_BLOCK = smlua_collision_util_get("lll_seg7_collision_floating_block") +local COL_LLL_SINKING_ROCK = smlua_collision_util_get("lll_sinking_rock_col") +local COL_LLL_ROTATING_FIRE_BARS = smlua_collision_util_get("lll_seg7_collision_rotating_fire_bars") +local COL_LLL_ROTATE_FIRE_BARS = smlua_collision_util_get("lll_col_rotate_firebars") + +--- @param o Object +local function bhv_custom_koopa_the_quick_loop(o) + if o.oKoopaMovementType >= KOOPA_BP_KOOPA_THE_QUICK_BASE then + o.oKoopaTheQuickRaceIndex = (gNetworkPlayers[0].currAreaIndex - 1) end end --- hook the behavior -id_bhvCustomKoopa = hook_behavior(id_bhvKoopa, OBJ_LIST_PUSHABLE, false, nil, bhv_custom_koopa_the_quick_loop) +id_bhvKoopa = hook_behavior(id_bhvKoopa, OBJ_LIST_PUSHABLE, false, nil, bhv_custom_koopa_the_quick_loop, "bhvKoopa") --------------------------------------------------- -function bhv_custom_cage_door_loop(obj) - if obj.collisionData == smlua_collision_util_get("bob_seg7_collision_gate") then - obj.collisionData = smlua_collision_util_get("grate_door_col") +--- @param o Object +local function bhv_custom_cage_door_loop(o) + if o.collisionData == COL_BOB_GATE then + o.collisionData = COL_GRATE_DOOR end end --- hook the behavior -id_bhvCustomOpenableCageDoor = hook_behavior(id_bhvOpenableCageDoor, OBJ_LIST_SURFACE, false, nil, bhv_custom_cage_door_loop) +id_bhvOpenableCageDoor = hook_behavior(id_bhvOpenableCageDoor, OBJ_LIST_SURFACE, false, nil, bhv_custom_cage_door_loop, "bhvOpenableCageDoor") --------------------------------------------------- -function bhv_custom_star_door_loop(obj) - if obj.collisionData == smlua_collision_util_get("inside_castle_seg7_collision_star_door") then - obj.collisionData = smlua_collision_util_get("collision_star_door") +--- @param o Object +local function bhv_custom_star_door_loop(o) + if o.collisionData == COL_INSIDE_CASTLE_STAR_DOOR then + o.collisionData = COL_STAR_DOOR end end --- hook the behavior -id_bhvCustomStarDoor = hook_behavior(id_bhvStarDoor, OBJ_LIST_SURFACE, false, nil, bhv_custom_star_door_loop) +id_bhvStarDoor = hook_behavior(id_bhvStarDoor, OBJ_LIST_SURFACE, false, nil, bhv_custom_star_door_loop, "bhvStarDoor") --------------------------------------------------- -function bhv_custom_lll_sinking_rock_block_loop(obj) - if obj.collisionData == smlua_collision_util_get("lll_seg7_collision_floating_block") then - obj.collisionData = smlua_collision_util_get("lll_sinking_rock_col") +--- @param o Object +local function bhv_custom_lll_sinking_rock_block_loop(o) + if o.collisionData == COL_LLL_FLOATING_BLOCK then + o.collisionData = COL_LLL_SINKING_ROCK end end --- hook the behavior -id_bhvCustomLllSinkingRockBlock = hook_behavior(id_bhvLllSinkingRockBlock, OBJ_LIST_SURFACE, false, nil, bhv_custom_lll_sinking_rock_block_loop) +id_bhvLllSinkingRockBlock = hook_behavior(id_bhvLllSinkingRockBlock, OBJ_LIST_SURFACE, false, nil, bhv_custom_lll_sinking_rock_block_loop, "bhvLllSinkingRockBlock") --------------------------------------------------- -function bhv_custom_rotating_block_with_fire_bars_loop(obj) - if obj.collisionData == smlua_collision_util_get("lll_seg7_collision_rotating_fire_bars") then - obj.collisionData = smlua_collision_util_get("lll_col_rotate_firebars") +--- @param o Object +local function bhv_custom_rotating_block_with_fire_bars_loop(o) + if o.collisionData == COL_LLL_ROTATING_FIRE_BARS then + o.collisionData = COL_LLL_ROTATE_FIRE_BARS end end --- hook the behavior -id_bhvCustomRotatingBlockWithFireBars = hook_behavior(id_bhvLllRotatingBlockWithFireBars, OBJ_LIST_SURFACE, false, nil, bhv_custom_rotating_block_with_fire_bars_loop) +id_bhvRotatingBlockWithFireBars = hook_behavior(id_bhvLllRotatingBlockWithFireBars, OBJ_LIST_SURFACE, false, nil, bhv_custom_rotating_block_with_fire_bars_loop, "bhvRotatingBlockWithFireBars") diff --git a/mods/sm74/course.lua b/mods/sm74/course.lua index 37376a2a8..96d2f3026 100644 --- a/mods/sm74/course.lua +++ b/mods/sm74/course.lua @@ -1,6 +1,6 @@ sCourseNamesEE = false -function course_names_swap_sm74() +local function course_names_swap_sm74() if not sCourseNamesEE then return end smlua_text_utils_course_acts_replace(COURSE_BOB, " 1 DICE-FORTRESS", "WALLJUMPING LESSON", "CONQUER THE PILLARS", "THE OBSERVATION TOWER", "COLLECT 8 RED COINS", "SECRETS OF THE SKY", "THE BOX'S TREASURE") smlua_text_utils_course_acts_replace(COURSE_WF, " 2 SKYWARD SLOPES", "TO THE TOP OF THE TOWER", "8 DANGEROUS RED COINS", "THE OUTER WALL", "NO TIME TO WASTE", "FLOATATION TECHNOLOGY BOX", "MASTER OF JUMPING") @@ -39,7 +39,7 @@ function course_names_swap_sm74() smlua_text_utils_extra_text_replace(6, "") end -function course_names_swap_sm74ee() +local function course_names_swap_sm74ee() if sCourseNamesEE then return end smlua_text_utils_course_acts_replace(COURSE_BOB, " 1 DEVIL'S DICE", "LITTLE WARM-UP", "LET'S-A-GO!", "SCALE THE TOWER", "FUNDAMENTAL TUNNEL PROBLEMS", "FIRST RED KATASTROPHE", "YOU WON'T FIND ME!") smlua_text_utils_course_acts_replace(COURSE_WF, " 2 VIRUSVINE VERANDA", "THE VINE'S TREASURE", "TIME PRESSURE TRAVEL", "ON TOP OF THAT WALL!", "JUMPING-PARCOUR 1", "JUMPING-PARCOUR 2", "LIGHT RED COINS") diff --git a/mods/sm74/dialog.lua b/mods/sm74/dialog.lua index 1f1e58d91..e0951db9b 100644 --- a/mods/sm74/dialog.lua +++ b/mods/sm74/dialog.lua @@ -4,7 +4,7 @@ sDialogsEE = false -- sm74 -- ---------- -function dialog_swap_sm74() +local function dialog_swap_sm74() if not sDialogsEE then return end smlua_text_utils_dialog_replace(DIALOG_000,1,6,30,200, "Welcome to a new world!") @@ -1516,7 +1516,7 @@ end -- sm74ee -- ------------ -function dialog_swap_sm74ee() +local function dialog_swap_sm74ee() if sDialogsEE then return end smlua_text_utils_dialog_replace(DIALOG_000,1,6,30,200, "Welcome to another\ devilish level.") @@ -2885,6 +2885,7 @@ Ready...set...\ \ //Go//// Don't Go") +-- weird smlua_text_utils_dialog_replace(DIALOG_165,1,5,30,200, "165") smlua_text_utils_dialog_replace(DIALOG_166,1,4,30,200, "166") diff --git a/mods/sm74/main.lua b/mods/sm74/main.lua index 10f9af604..493f086a7 100644 --- a/mods/sm74/main.lua +++ b/mods/sm74/main.lua @@ -1,20 +1,42 @@ -- name: Super Mario 74 (+EE) --- description: This is two romhacks in one.\n\nSuper Mario 74 and Super Mario 74 Extreme Edition.\n\nThere are 60 custom levels, with a total of 308 stars.\n\nUse the chat command '/swap' to swap between EE and normal.\n\nCreated by Lugmillord\n\nPorted to PC by PeachyPeach and jesusyoshi54\n\nPorted to coop by djoslin0 -- incompatible: romhack +-- description: This is two romhacks in one.\n\nSuper Mario 74 and Super Mario 74 Extreme Edition.\n\nThere are 60 custom levels, with a total of 308 stars.\n\nUse the chat command '/swap' to swap between EE and normal.\n\nCreated by Lugmillord\n\nPorted to PC by PeachyPeach and jesusyoshi54\n\nPorted to coop by djoslin0 + +local function on_level_init() + local np = gNetworkPlayers[0] + + save_file_set_using_backup_slot(np.currAreaIndex ~= 1) + gMarioStates[0].numStars = save_file_get_total_star_count(get_current_save_file_num()-1,COURSE_MIN-1,COURSE_MAX-1) + gLevelValues.exitCastleArea = gNetworkPlayers[0].currAreaIndex + + star_areas_replace() + course_names_swap() + dialog_swap() + +end + +local function get_star_collection_dialog() + return 0 +end + + +local function on_swap_command() + local np = gNetworkPlayers[0] + if np.currAreaIndex == 1 then + djui_chat_message_create("Swapping to Extreme Edition") + else + djui_chat_message_create("Swapping to normal edition") + end + warp_to_level(np.currLevelNum, np.currAreaIndex ~ 3, np.currActNum) + return true +end ------------------- --- level values -- ------------------- gLevelValues.entryLevel = LEVEL_CASTLE_COURTYARD gLevelValues.exitCastleLevel = LEVEL_CASTLE_COURTYARD gLevelValues.exitCastleWarpNode = 0x40 gLevelValues.skipCreditsAt = LEVEL_BOB ---------------------- --- behavior values -- ---------------------- - gBehaviorValues.KoopaBobAgility = 6.0 gBehaviorValues.KoopaThiAgility = 6.0 gBehaviorValues.trajectories.KoopaBobTrajectory = get_trajectory('KoopaTHI_path') @@ -27,10 +49,6 @@ gBehaviorValues.dialogs.KoopaQuickThiWinDialog = DIALOG_031 gLevelValues.fixCollisionBugs = 1 --------------- --- movtexs -- --------------- - movtexqc_register('bbh_2_Movtex_0', 0 + 4, 2, 0) movtexqc_register('ccm_1_Movtex_0', 1 + 4, 1, 0) movtexqc_register('hmc_1_Movtex_0', 3 + 4, 1, 0) @@ -47,10 +65,6 @@ movtexqc_register('castle_courtyard_1_Movtex_0', 22 + 4, 1, 0) movtexqc_register('cotmc_1_Movtex_0', 24 + 4, 1, 0) movtexqc_register('wmotr_2_Movtex_0', 27 + 4, 2, 0) ------------ --- music -- ------------ - smlua_audio_utils_replace_sequence(0x02, 0x11, 80, "02_Seq_sm74_custom") smlua_audio_utils_replace_sequence(0x03, 0x1E, 75, "03_Seq_sm74_custom") smlua_audio_utils_replace_sequence(0x04, 0x25, 70, "04_Seq_sm74_custom") @@ -82,43 +96,9 @@ smlua_audio_utils_replace_sequence(0x2F, 0x1D, 70, "2F_Seq_sm74EE_custom") smlua_audio_utils_replace_sequence(0x30, 0x23, 65, "30_Seq_sm74EE_custom") 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 on_level_init() - local m = gMarioStates[0] - local np = gNetworkPlayers[0] - - save_file_set_using_backup_slot(np.currAreaIndex ~= 1) - gMarioStates[0].numStars = save_file_get_total_star_count(get_current_save_file_num()-1,COURSE_MIN-1,COURSE_MAX-1) - gLevelValues.exitCastleArea = gNetworkPlayers[0].currAreaIndex - - star_areas_replace() - course_names_swap() - dialog_swap() - -end - -function get_star_collection_dialog() - return 0 -end - -function on_swap_command(msg) - local np = gNetworkPlayers[0] - if np.currAreaIndex == 1 then - djui_chat_message_create('Swapping to Extreme Edition') - else - djui_chat_message_create('Swapping to normal edition') - end - warp_to_level(np.currLevelNum, np.currAreaIndex ~ 3, np.currActNum) - return true -end - 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/bhv_dupes.lua b/mods/star-road/bhv_dupes.lua index 03b6afd7d..bc71dc92b 100644 --- a/mods/star-road/bhv_dupes.lua +++ b/mods/star-road/bhv_dupes.lua @@ -1,5 +1,5 @@ -E_MODEL_VCUTM_LIGHT = smlua_model_util_get_id("vcutm_light_geo") -COL_WF_SMALL_BOMP = smlua_collision_util_get("wf_seg7_collision_small_bomp") +local E_MODEL_VCUTM_LIGHT = smlua_model_util_get_id("vcutm_light_geo") +local COL_WF_SMALL_BOMP = smlua_collision_util_get("wf_seg7_collision_small_bomp") -- we use this instead of o->oHiddenStarLastInteractedObject local oHiddenStarLastInteractedPlayer = nil