mirror of
https://github.com/coop-deluxe/sm64coopdx.git
synced 2025-10-30 08:01:01 +00:00
Star Road code overhaul
This commit is contained in:
parent
183018cf3c
commit
44e32f8bf2
8 changed files with 363 additions and 428 deletions
|
|
@ -1,71 +1,79 @@
|
||||||
-- We use this instead of o->oHiddenStarLastInteractedObject.
|
E_MODEL_VCUTM_LIGHT = smlua_model_util_get_id("vcutm_light_geo")
|
||||||
oHiddenStarLastInteractedPlayer = nil
|
COL_WF_SMALL_BOMP = smlua_collision_util_get("wf_seg7_collision_small_bomp")
|
||||||
|
|
||||||
function bhv_custom_hidden_star_trigger_init(obj)
|
-- we use this instead of o->oHiddenStarLastInteractedObject
|
||||||
network_init_object(obj, true, { 'activeFlags', 'oInteractStatus' })
|
local oHiddenStarLastInteractedPlayer = nil
|
||||||
|
|
||||||
|
--- @param o Object
|
||||||
|
function bhv_custom_hidden_star_trigger_init(o)
|
||||||
|
network_init_object(o, true, { "activeFlags", "oInteractStatus" })
|
||||||
end
|
end
|
||||||
|
|
||||||
function bhv_custom_hidden_star_trigger_loop(obj)
|
--- @param o Object
|
||||||
if not ((obj.oInteractStatus & INT_STATUS_INTERACTED) == 0) or obj_check_if_collided_with_object(obj, gMarioStates[0].marioObj) == 1 then
|
function bhv_custom_hidden_star_trigger_loop(o)
|
||||||
local hiddenStar = obj_get_nearest_object_with_behavior_id(obj, bhvSMSRHiddenStar)
|
if (o.oInteractStatus & INT_STATUS_INTERACTED) ~= 0 or obj_check_if_collided_with_object(o, gMarioStates[0].marioObj) ~= 0 then
|
||||||
if not (hiddenStar == nil) then
|
local hiddenStar = obj_get_nearest_object_with_behavior_id(o, bhvSMSRHiddenStar)
|
||||||
local count = (obj_count_objects_with_behavior_id(bhvSMSRHiddenStarTrigger) - 1)
|
if hiddenStar ~= nil then
|
||||||
|
local count = obj_count_objects_with_behavior_id(bhvSMSRHiddenStarTrigger) - 1
|
||||||
hiddenStar.oHiddenStarTriggerCounter = 5 - count
|
hiddenStar.oHiddenStarTriggerCounter = 5 - count
|
||||||
|
|
||||||
if not (hiddenStar.oHiddenStarTriggerCounter == 5) then
|
if hiddenStar.oHiddenStarTriggerCounter ~= 5 then
|
||||||
spawn_orange_number(hiddenStar.oHiddenStarTriggerCounter, 0, 0, 0)
|
spawn_orange_number(hiddenStar.oHiddenStarTriggerCounter, 0, 0, 0)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Set the last person who interacted with a secret to the
|
-- set the last person who interacted with a secret to the parent so only they get the star cutscene
|
||||||
-- parent so only they get the star cutscene.
|
player = nearest_mario_state_to_object(o)
|
||||||
player = nearest_mario_state_to_object(obj)
|
if player ~= nil then
|
||||||
if not (player == nil) then
|
|
||||||
oHiddenStarLastInteractedPlayer = player
|
oHiddenStarLastInteractedPlayer = player
|
||||||
end
|
end
|
||||||
|
|
||||||
cur_obj_play_sound_2(SOUND_MENU_COLLECT_SECRET + ((hiddenStar.oHiddenStarTriggerCounter - 1) << 16))
|
cur_obj_play_sound_2(SOUND_MENU_COLLECT_SECRET + ((hiddenStar.oHiddenStarTriggerCounter - 1) << 16))
|
||||||
end
|
end
|
||||||
|
|
||||||
obj.activeFlags = ACTIVE_FLAG_DEACTIVATED
|
o.activeFlags = ACTIVE_FLAG_DEACTIVATED
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
--------------
|
--------------
|
||||||
|
|
||||||
function bhv_custom_hidden_star_init(obj)
|
--- @param o Object
|
||||||
|
function bhv_custom_hidden_star_init(o)
|
||||||
local count = obj_count_objects_with_behavior_id(bhvSMSRHiddenStarTrigger)
|
local count = obj_count_objects_with_behavior_id(bhvSMSRHiddenStarTrigger)
|
||||||
if count == 0 then
|
if count == 0 then
|
||||||
local star = spawn_object_abs_with_rot(obj, 0, E_MODEL_STAR, id_bhvStar, obj.oPosX, obj.oPosY, obj.oPosZ, 0, 0, 0)
|
local star = spawn_object_abs_with_rot(o, 0, E_MODEL_STAR, id_bhvStar, o.oPosX, o.oPosY, o.oPosZ, 0, 0, 0)
|
||||||
if not (star == nil) then
|
if star ~= nil then
|
||||||
star.oBehParams = obj.oBehParams
|
star.oBehParams = o.oBehParams
|
||||||
end
|
end
|
||||||
|
|
||||||
obj.activeFlags = ACTIVE_FLAG_DEACTIVATED
|
o.activeFlags = ACTIVE_FLAG_DEACTIVATED
|
||||||
end
|
end
|
||||||
|
|
||||||
obj.oHiddenStarTriggerCounter = 5 - count
|
o.oHiddenStarTriggerCounter = 5 - count
|
||||||
|
|
||||||
-- We haven't interacted with a player yet.
|
-- we haven't interacted with a player yet.
|
||||||
-- We also don't sync this as not only is it not required
|
-- We also don't sync this as not only is it not required
|
||||||
-- but it also is only set for an interaction.
|
-- but it also is only set for an interaction.
|
||||||
-- Therefore this object must already be loaded for it to be set
|
-- Therefore this object must already be loaded for it to be set
|
||||||
-- and if it wasn't. You couldn't of possibly been the one
|
-- and if it wasn't. You couldn't of possibly been the one
|
||||||
-- who last interacted to begin with.
|
-- who last interacted to begin with
|
||||||
|
--
|
||||||
|
-- coding™
|
||||||
oHiddenStarLastInteractedPlayer = nil
|
oHiddenStarLastInteractedPlayer = nil
|
||||||
|
|
||||||
network_init_object(obj, false, { 'oAction', 'oHiddenStarTriggerCounter', 'oPosX', 'oPosY', 'oPosZ', 'oTimer' })
|
network_init_object(o, false, { "oAction", "oHiddenStarTriggerCounter", "oPosX", "oPosY", "oPosZ", "oTimer" })
|
||||||
end
|
end
|
||||||
|
|
||||||
function bhv_custom_hidden_star_loop(obj)
|
--- @param o Object
|
||||||
switch(obj.oAction, {
|
function bhv_custom_hidden_star_loop(o)
|
||||||
[0] = function() -- for case 0
|
switch(o.oAction, {
|
||||||
if obj.oHiddenStarTriggerCounter == 5 then
|
[0] = function() -- for case 0
|
||||||
obj.oAction = 1
|
if o.oHiddenStarTriggerCounter == 5 then
|
||||||
|
o.oAction = 1
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
[1] = function() -- for case 1
|
[1] = function() -- for case 1
|
||||||
if obj.oTimer > 2 then
|
if o.oTimer > 2 then
|
||||||
star = spawn_red_coin_cutscene_star(obj.oPosX, obj.oPosY, obj.oPosZ)
|
star = spawn_red_coin_cutscene_star(o.oPosX, o.oPosY, o.oPosZ)
|
||||||
if not (star == nil) then
|
if not (star == nil) then
|
||||||
if oHiddenStarLastInteractedPlayer == gMarioStates[0] then
|
if oHiddenStarLastInteractedPlayer == gMarioStates[0] then
|
||||||
star.oStarSpawnExtCutsceneFlags = 1
|
star.oStarSpawnExtCutsceneFlags = 1
|
||||||
|
|
@ -74,7 +82,7 @@ function bhv_custom_hidden_star_loop(obj)
|
||||||
end
|
end
|
||||||
spawn_mist_particles()
|
spawn_mist_particles()
|
||||||
end
|
end
|
||||||
obj.activeFlags = ACTIVE_FLAG_DEACTIVATED
|
o.activeFlags = ACTIVE_FLAG_DEACTIVATED
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
@ -82,195 +90,217 @@ end
|
||||||
|
|
||||||
--------------
|
--------------
|
||||||
|
|
||||||
function bhv_breakable_rock_init(obj)
|
--- @param o Object
|
||||||
network_init_object(obj, false, nil)
|
function bhv_breakable_rock_init(o)
|
||||||
|
network_init_object(o, false, nil)
|
||||||
end
|
end
|
||||||
|
|
||||||
--------------
|
--------------
|
||||||
|
|
||||||
function bhv_breakable_window_init(obj)
|
--- @param o Object
|
||||||
obj.collisionData = smlua_collision_util_get("wf_seg7_collision_small_bomp")
|
function bhv_breakable_window_init(o)
|
||||||
network_init_object(obj, false, { 'oFlags', 'oInteractStatus' });
|
o.collisionData = COL_WF_SMALL_BOMP
|
||||||
|
network_init_object(o, false, { "oFlags", "oInteractStatus" })
|
||||||
end
|
end
|
||||||
|
|
||||||
function bhv_breakable_window_loop(obj)
|
--- @param o Object
|
||||||
if not (obj.oInteractStatus & INT_STATUS_INTERACTED) or not (obj.oInteractStatus & INT_STATUS_WAS_ATTACKED) then
|
function bhv_breakable_window_loop(o)
|
||||||
|
if (o.oInteractStatus & INT_STATUS_INTERACTED) == 0 or (o.oInteractStatus & INT_STATUS_WAS_ATTACKED) == 0 then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
if not (check_local_mario_attacking(obj) == 0) then
|
if check_local_mario_attacking(o) ~= 0 then
|
||||||
obj_explode_and_spawn_coins(80, 0)
|
obj_explode_and_spawn_coins(80, 0)
|
||||||
create_sound_spawner(obj, SOUND_GENERAL_WALL_EXPLOSION)
|
create_sound_spawner(SOUND_GENERAL_WALL_EXPLOSION)
|
||||||
|
|
||||||
obj.oInteractStatus = 0;
|
o.oInteractStatus = 0
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
--------------
|
--------------
|
||||||
|
|
||||||
function bhv_star_replica_init(obj)
|
--- @param o Object
|
||||||
despawn_if_stars_below_count(obj, 121) -- 121 star check
|
function bhv_star_replica_init(o)
|
||||||
|
despawn_if_stars_below_count(o, 121) -- 121 star check
|
||||||
end
|
end
|
||||||
|
|
||||||
--------------
|
--------------
|
||||||
|
|
||||||
function bhv_red_sinking_platform_init(obj)
|
--- @param o Object
|
||||||
|
function bhv_red_sinking_platform_init(o)
|
||||||
cur_obj_set_home_once()
|
cur_obj_set_home_once()
|
||||||
network_init_object(obj, true, { 'oSinkWhenSteppedOnUnk104', 'oGraphYOffset', 'oHomeY' })
|
network_init_object(o, true, { "oSinkWhenSteppedOnUnk104", "oGraphYOffset", "oHomeY" })
|
||||||
end
|
end
|
||||||
|
|
||||||
--------------
|
--------------
|
||||||
|
|
||||||
function bhv_star_door_wall_loop(obj)
|
--- @param o Object
|
||||||
|
function bhv_star_door_wall_loop(o)
|
||||||
if get_star_count() >= 30 then
|
if get_star_count() >= 30 then
|
||||||
obj.activeFlags = ACTIVE_FLAG_DEACTIVATED
|
o.activeFlags = ACTIVE_FLAG_DEACTIVATED
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
--------------
|
--------------
|
||||||
|
|
||||||
function bhv_special_breakable_box_init(obj)
|
--- @param o Object
|
||||||
despawn_if_stars_below_count(obj, 121) -- 121 star check
|
function bhv_special_breakable_box_init(o)
|
||||||
network_init_object(obj, false, nil);
|
despawn_if_stars_below_count(o, 121) -- 121 star check
|
||||||
|
network_init_object(o, false, nil)
|
||||||
end
|
end
|
||||||
|
|
||||||
--------------
|
--------------
|
||||||
|
|
||||||
function bhv_piranha_plant_wild_loop(obj)
|
-- why even make an init function
|
||||||
|
function bhv_piranha_plant_wild_loop()
|
||||||
end
|
end
|
||||||
|
|
||||||
--------------
|
--------------
|
||||||
|
|
||||||
function bhv_big_leaves_init(obj)
|
-- why even make an init function
|
||||||
|
function bhv_big_leaves_init()
|
||||||
end
|
end
|
||||||
|
|
||||||
--------------
|
--------------
|
||||||
|
|
||||||
function bhv_lily_pad_init(obj)
|
--- @param o Object
|
||||||
network_init_object(obj, true, { 'oSinkWhenSteppedOnUnk104', 'oGraphYOffset', 'oHomeY' })
|
function bhv_lily_pad_init(o)
|
||||||
|
network_init_object(o, true, { "oSinkWhenSteppedOnUnk104", "oGraphYOffset", "oHomeY" })
|
||||||
end
|
end
|
||||||
|
|
||||||
--------------
|
--------------
|
||||||
|
|
||||||
function bhv_tambourine_init(obj)
|
--- @param o Object
|
||||||
network_init_object(obj, false, nil);
|
function bhv_tambourine_init(o)
|
||||||
|
network_init_object(o, false, nil)
|
||||||
end
|
end
|
||||||
|
|
||||||
--------------
|
--------------
|
||||||
|
|
||||||
function bhv_small_bee_init(obj)
|
--- @param o Object
|
||||||
network_init_object(obj, false, nil);
|
function bhv_small_bee_init(o)
|
||||||
|
network_init_object(o, false, nil)
|
||||||
end
|
end
|
||||||
|
|
||||||
--------------
|
--------------
|
||||||
|
|
||||||
function bhv_star_moving_init(obj)
|
--- @param o Object
|
||||||
network_init_object(obj, false, nil);
|
function bhv_star_moving_init(o)
|
||||||
|
network_init_object(o, false, nil)
|
||||||
end
|
end
|
||||||
|
|
||||||
--------------
|
--------------
|
||||||
|
|
||||||
function bhv_falling_domino_init(obj)
|
--- @param o Object
|
||||||
network_init_object(obj, false, nil);
|
function bhv_falling_domino_init(o)
|
||||||
|
network_init_object(o, false, nil)
|
||||||
end
|
end
|
||||||
|
|
||||||
--------------
|
--------------
|
||||||
|
|
||||||
function bhv_lava_lift_init(obj)
|
--- @param o Object
|
||||||
network_init_object(obj, false, nil);
|
function bhv_lava_lift_init(o)
|
||||||
|
network_init_object(o, false, nil)
|
||||||
end
|
end
|
||||||
|
|
||||||
--------------
|
--------------
|
||||||
|
|
||||||
function bhv_rotating_lava_platform_init(obj)
|
--- @param o Object
|
||||||
network_init_object(obj, false, nil);
|
function bhv_rotating_lava_platform_init(o)
|
||||||
|
network_init_object(o, false, nil)
|
||||||
end
|
end
|
||||||
|
|
||||||
--------------
|
--------------
|
||||||
|
|
||||||
function bhv_sinking_donut_init(obj)
|
--- @param o Object
|
||||||
network_init_object(obj, true, { 'oSinkWhenSteppedOnUnk104', 'oGraphYOffset', 'oHomeY' })
|
function bhv_sinking_donut_init(o)
|
||||||
|
network_init_object(o, true, { "oSinkWhenSteppedOnUnk104", "oGraphYOffset", "oHomeY" })
|
||||||
end
|
end
|
||||||
|
|
||||||
function bhv_sinking_donut_loop(obj)
|
--- @param o Object
|
||||||
sinking_perform_sink_check(obj)
|
function bhv_sinking_donut_loop(o)
|
||||||
sinking_perform_sink_check(obj) -- called twice
|
sinking_perform_sink_check(o)
|
||||||
|
sinking_perform_sink_check(o) -- called twice
|
||||||
end
|
end
|
||||||
--------------
|
--------------
|
||||||
|
|
||||||
function bhv_floating_thwomp_init(obj)
|
--- @param o Object
|
||||||
network_init_object(obj, true, { 'oHomeX', 'oHomeY', 'oHomeZ', 'oAction', 'oPosX', 'oPosY', 'oPosZ', 'oVelX', 'oVelY', 'oVelZ' })
|
function bhv_floating_thwomp_init(o)
|
||||||
|
network_init_object(o, true, { "oHomeX", "oHomeY", "oHomeZ", "oAction", "oPosX", "oPosY", "oPosZ", "oVelX", "oVelY", "oVelZ" })
|
||||||
end
|
end
|
||||||
|
|
||||||
--------------
|
--------------
|
||||||
|
|
||||||
function bhv_toxic_waste_platform_init(obj)
|
--- @param o Object
|
||||||
network_init_object(obj, true, { 'oSinkWhenSteppedOnUnk104', 'oGraphYOffset', 'oHomeY' })
|
function bhv_toxic_waste_platform_init(o)
|
||||||
|
network_init_object(o, true, { "oSinkWhenSteppedOnUnk104", "oGraphYOffset", "oHomeY" })
|
||||||
end
|
end
|
||||||
|
|
||||||
function bhv_toxic_waste_platform_loop(obj)
|
--- @param o Object
|
||||||
sinking_perform_sink_check(obj)
|
function bhv_toxic_waste_platform_loop(o)
|
||||||
|
sinking_perform_sink_check(o)
|
||||||
end
|
end
|
||||||
|
|
||||||
--------------
|
--------------
|
||||||
|
|
||||||
function bhv_pushable_tomb_init(obj)
|
--- @param o Object
|
||||||
network_init_object(obj, true, { 'oPosX', 'oPosY', 'oPosZ' })
|
function bhv_pushable_tomb_init(o)
|
||||||
|
network_init_object(o, true, { "oPosX", "oPosY", "oPosZ" })
|
||||||
end
|
end
|
||||||
|
|
||||||
--------------
|
--------------
|
||||||
|
|
||||||
E_MODEL_VCUTM_LIGHT = smlua_model_util_get_id("vcutm_light_geo")
|
--- @param o Object
|
||||||
|
function bhv_lights_on_switch_init(o)
|
||||||
|
o.parentObj = cur_obj_nearest_object_with_behavior(get_behavior_from_id(id_bhvFloorSwitchAnimatesObject))
|
||||||
|
obj_set_model_extended(o, E_MODEL_VCUTM_LIGHT)
|
||||||
|
|
||||||
function bhv_lights_on_switch_init(obj)
|
network_init_object(o, true, { "oFloorSwitchPressAnimationUnkF4", "oFloorSwitchPressAnimationUnkF8", "oFloorSwitchPressAnimationUnkFC" })
|
||||||
obj.parentObj = cur_obj_nearest_object_with_behavior(get_behavior_from_id(id_bhvFloorSwitchAnimatesObject));
|
|
||||||
obj_set_model_extended(obj, E_MODEL_VCUTM_LIGHT)
|
|
||||||
|
|
||||||
network_init_object(obj, true, { 'oFloorSwitchPressAnimationUnkF4', 'oFloorSwitchPressAnimationUnkF8', 'oFloorSwitchPressAnimationUnkFC' })
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function bhv_lights_on_switch_loop(obj)
|
--- @param o Object
|
||||||
if obj.oFloorSwitchPressAnimationUnk100 ~= 0 then
|
function bhv_lights_on_switch_loop(o)
|
||||||
if obj.parentObj ~= nil and obj.parentObj.oAction ~= 2 then
|
if o.oFloorSwitchPressAnimationUnk100 ~= 0 then
|
||||||
obj.oFloorSwitchPressAnimationUnk100 = 0
|
if o.parentObj ~= nil and o.parentObj.oAction ~= 2 then
|
||||||
|
o.oFloorSwitchPressAnimationUnk100 = 0
|
||||||
end
|
end
|
||||||
|
|
||||||
if obj.oFloorSwitchPressAnimationUnkFC ~= 0 then
|
if o.oFloorSwitchPressAnimationUnkFC ~= 0 then
|
||||||
if obj.oBehParams2ndByte >= 0 and obj.oBehParams2ndByte <= 2 then
|
if o.oBehParams2ndByte >= 0 and o.oBehParams2ndByte <= 2 then
|
||||||
obj.oFloorSwitchPressAnimationUnkF4 = 200
|
o.oFloorSwitchPressAnimationUnkF4 = 200
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
obj.oFloorSwitchPressAnimationUnkF4 = 0
|
o.oFloorSwitchPressAnimationUnkF4 = 0
|
||||||
end
|
end
|
||||||
elseif obj.parentObj ~= nil and obj.parentObj.oAction == 2 then
|
elseif o.parentObj ~= nil and o.parentObj.oAction == 2 then
|
||||||
obj.oFloorSwitchPressAnimationUnkFC = obj.oFloorSwitchPressAnimationUnkFC ~ 1
|
o.oFloorSwitchPressAnimationUnkFC = o.oFloorSwitchPressAnimationUnkFC ~ 1
|
||||||
obj.oFloorSwitchPressAnimationUnk100 = 1
|
o.oFloorSwitchPressAnimationUnk100 = 1
|
||||||
end
|
end
|
||||||
|
|
||||||
if obj.oFloorSwitchPressAnimationUnkF4 ~= 0 then
|
if o.oFloorSwitchPressAnimationUnkF4 ~= 0 then
|
||||||
if obj.oFloorSwitchPressAnimationUnkF4 < 60 then
|
if o.oFloorSwitchPressAnimationUnkF4 < 60 then
|
||||||
cur_obj_play_sound_1(SOUND_GENERAL2_SWITCH_TICK_SLOW)
|
cur_obj_play_sound_1(SOUND_GENERAL2_SWITCH_TICK_SLOW)
|
||||||
else
|
else
|
||||||
cur_obj_play_sound_1(SOUND_GENERAL2_SWITCH_TICK_FAST)
|
cur_obj_play_sound_1(SOUND_GENERAL2_SWITCH_TICK_FAST)
|
||||||
end
|
end
|
||||||
|
|
||||||
obj.oFloorSwitchPressAnimationUnkF4 = obj.oFloorSwitchPressAnimationUnkF4 - 1
|
o.oFloorSwitchPressAnimationUnkF4 = o.oFloorSwitchPressAnimationUnkF4 - 1
|
||||||
if obj.oFloorSwitchPressAnimationUnkF4 == 0 then
|
if o.oFloorSwitchPressAnimationUnkF4 == 0 then
|
||||||
obj.oFloorSwitchPressAnimationUnkFC = 0
|
o.oFloorSwitchPressAnimationUnkFC = 0
|
||||||
end
|
end
|
||||||
|
|
||||||
if obj.oFloorSwitchPressAnimationUnkF8 < 9 then
|
if o.oFloorSwitchPressAnimationUnkF8 < 9 then
|
||||||
obj.oFloorSwitchPressAnimationUnkF8 = obj.oFloorSwitchPressAnimationUnkF8 + 1
|
o.oFloorSwitchPressAnimationUnkF8 = o.oFloorSwitchPressAnimationUnkF8 + 1
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
obj.oFloorSwitchPressAnimationUnkF8 = obj.oFloorSwitchPressAnimationUnkF8 - 2
|
o.oFloorSwitchPressAnimationUnkF8 = o.oFloorSwitchPressAnimationUnkF8 - 2
|
||||||
if obj.oFloorSwitchPressAnimationUnkF8 < 0 then
|
if o.oFloorSwitchPressAnimationUnkF8 < 0 then
|
||||||
obj.oFloorSwitchPressAnimationUnkF8 = 0
|
o.oFloorSwitchPressAnimationUnkF8 = 0
|
||||||
obj.oFloorSwitchPressAnimationUnkFC = 1
|
o.oFloorSwitchPressAnimationUnkFC = 1
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local fType = math.floor(obj.oFloorSwitchPressAnimationUnkF8 / 2)
|
local fType = math.floor(o.oFloorSwitchPressAnimationUnkF8 / 2)
|
||||||
if fType == 0 then
|
if fType == 0 then
|
||||||
cur_obj_hide()
|
cur_obj_hide()
|
||||||
else
|
else
|
||||||
|
|
|
||||||
|
|
@ -1,103 +1,119 @@
|
||||||
function bhv_custom_koopa_the_quick_loop(obj)
|
--- @param o Object
|
||||||
if obj.oKoopaMovementType >= KOOPA_BP_KOOPA_THE_QUICK_BASE then
|
local function bhv_custom_koopa_the_quick_loop(o)
|
||||||
|
if o.oKoopaMovementType >= KOOPA_BP_KOOPA_THE_QUICK_BASE then
|
||||||
if gNetworkPlayers[0].currLevelNum == 27 then
|
if gNetworkPlayers[0].currLevelNum == 27 then
|
||||||
obj.oKoopaTheQuickRaceIndex = 1
|
o.oKoopaTheQuickRaceIndex = 1
|
||||||
else
|
else
|
||||||
obj.oKoopaTheQuickRaceIndex = 0
|
o.oKoopaTheQuickRaceIndex = 0
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- hook the behavior
|
id_bhvKoopa = hook_behavior(id_bhvKoopa, OBJ_LIST_PUSHABLE, false, nil, bhv_custom_koopa_the_quick_loop, "bhvKoopa")
|
||||||
bhvKoopa = hook_behavior(id_bhvKoopa, OBJ_LIST_PUSHABLE, false, nil, bhv_custom_koopa_the_quick_loop)
|
|
||||||
|
|
||||||
---------------------------------------------------
|
---------------------------------------------------
|
||||||
|
|
||||||
function bhv_custom_castle_cannon_grate_init(obj)
|
--- @param o Object
|
||||||
obj.oFlags = (OBJ_FLAG_UPDATE_GFX_POS_AND_ANGLE)
|
local function bhv_custom_castle_cannon_grate_init(o)
|
||||||
obj.collisionData = smlua_collision_util_get("castle_grounds_seg7_collision_cannon_grill")
|
o.oFlags = (OBJ_FLAG_UPDATE_GFX_POS_AND_ANGLE)
|
||||||
obj.oCollisionDistance = 4000
|
o.collisionData = smlua_collision_util_get("castle_grounds_seg7_collision_cannon_grill")
|
||||||
|
o.oCollisionDistance = 4000
|
||||||
load_object_collision_model()
|
load_object_collision_model()
|
||||||
|
|
||||||
if get_star_count() > 64 then -- 65 star check
|
if get_star_count() >= 65 then -- 65 star check
|
||||||
obj.activeFlags = ACTIVE_FLAG_DEACTIVATED
|
o.activeFlags = ACTIVE_FLAG_DEACTIVATED
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function bhv_custom_castle_cannon_grate_loop(obj)
|
local function bhv_custom_castle_cannon_grate_loop()
|
||||||
load_object_collision_model()
|
load_object_collision_model()
|
||||||
end
|
end
|
||||||
|
|
||||||
-- hook the behavior
|
id_bhvSMSRHiddenAt120Stars = hook_behavior(id_bhvHiddenAt120Stars, OBJ_LIST_SURFACE, true, bhv_custom_castle_cannon_grate_init, bhv_custom_castle_cannon_grate_loop, "bhvSMSRHiddenAt120Stars")
|
||||||
bhvSMSRHiddenAt120Stars = hook_behavior(id_bhvHiddenAt120Stars, OBJ_LIST_SURFACE, true, bhv_custom_castle_cannon_grate_init, bhv_custom_castle_cannon_grate_loop)
|
|
||||||
|
|
||||||
---------------------------------------------------
|
---------------------------------------------------
|
||||||
|
|
||||||
function bully_custom_act_level_death(obj)
|
local function bully_custom_act_level_death(o)
|
||||||
if obj_lava_death() == 1 then
|
if obj_lava_death() == 1 then
|
||||||
spawn_mist_particles()
|
spawn_mist_particles()
|
||||||
local m = get_mario_from_global_index(obj.oBullyLastNetworkPlayerIndex)
|
local m = get_mario_from_global_index(o.oBullyLastNetworkPlayerIndex)
|
||||||
spawn_non_sync_object(id_bhvBowserKey, E_MODEL_BOWSER_KEY, m.pos.x, m.pos.y, m.pos.z, nil)
|
spawn_non_sync_object(
|
||||||
|
id_bhvBowserKey,
|
||||||
|
E_MODEL_BOWSER_KEY,
|
||||||
|
m.pos.x, m.pos.y, m.pos.z,
|
||||||
|
nil
|
||||||
|
)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function bhv_custom_big_bully_init(obj)
|
local function bhv_custom_big_bully_init(o)
|
||||||
obj.oFlags = (OBJ_FLAG_SET_FACE_YAW_TO_MOVE_YAW | OBJ_FLAG_UPDATE_GFX_POS_AND_ANGLE)
|
o.oFlags = (OBJ_FLAG_SET_FACE_YAW_TO_MOVE_YAW | OBJ_FLAG_UPDATE_GFX_POS_AND_ANGLE)
|
||||||
obj.oAnimations = gObjectAnimations.bully_seg5_anims_0500470C
|
o.oAnimations = gObjectAnimations.bully_seg5_anims_0500470C
|
||||||
object_drop_to_floor(obj)
|
object_drop_to_floor(o)
|
||||||
cur_obj_set_home_once()
|
cur_obj_set_home_once()
|
||||||
obj.oIntangibleTimer = 0
|
o.oIntangibleTimer = 0
|
||||||
|
|
||||||
cur_obj_init_animation(0)
|
cur_obj_init_animation(0)
|
||||||
bhv_big_bully_init()
|
bhv_big_bully_init()
|
||||||
end
|
end
|
||||||
|
|
||||||
function bhv_custom_bully_loop(obj)
|
local function bhv_custom_big_bully_loop(o)
|
||||||
if obj.oAction == BULLY_ACT_LAVA_DEATH then
|
if o.oAction == BULLY_ACT_LAVA_DEATH then
|
||||||
obj.oBullyPrevX = obj.oPosX
|
o.oBullyPrevX = o.oPosX
|
||||||
obj.oBullyPrevY = obj.oPosY
|
o.oBullyPrevY = o.oPosY
|
||||||
obj.oBullyPrevZ = obj.oPosZ
|
o.oBullyPrevZ = o.oPosZ
|
||||||
|
|
||||||
bully_custom_act_level_death(obj)
|
bully_custom_act_level_death(o)
|
||||||
|
|
||||||
set_object_visibility(obj, 3000)
|
set_object_visibility(o, 3000)
|
||||||
else
|
else
|
||||||
bhv_bully_loop()
|
bhv_bully_loop()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- hook the behavior
|
id_bhvBigBully = hook_behavior(id_bhvBigBully, OBJ_LIST_GENACTOR, true, bhv_custom_big_bully_init, bhv_custom_big_bully_loop, "bhvBigBully")
|
||||||
bhvBigBullyBoss = hook_behavior(id_bhvBigBully, OBJ_LIST_GENACTOR, true, bhv_custom_big_bully_init, bhv_custom_bully_loop)
|
|
||||||
|
|
||||||
---------------------------------------------------
|
---------------------------------------------------
|
||||||
|
|
||||||
function bhv_custom_bowser_loop(obj)
|
--- @param o Object
|
||||||
|
local function bhv_custom_bowser_loop(o)
|
||||||
local np = gNetworkPlayers[0]
|
local np = gNetworkPlayers[0]
|
||||||
if np.currAreaSyncValid and np.currLevelSyncValid and np.currLevelNum ~= LEVEL_BOWSER_3 then
|
if np.currAreaSyncValid and np.currLevelSyncValid and np.currLevelNum ~= LEVEL_BOWSER_3 then
|
||||||
-- force bowser into do nothing action when not displaying cutscene
|
-- force bowser into do nothing action when not displaying cutscene
|
||||||
if obj.oAction ~= 5 and obj.oAction ~= 6 and obj.oAction ~= 20 then
|
-- magic number hell
|
||||||
obj.oAction = 4
|
if o.oAction ~= 5 and o.oAction ~= 6 and o.oAction ~= 20 then
|
||||||
obj.oSubAction = 11
|
o.oAction = 4
|
||||||
|
o.oSubAction = 11
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- hook the behavior
|
id_bhvBowser = hook_behavior(id_bhvBowser, OBJ_LIST_GENACTOR, false, nil, bhv_custom_bowser_loop, "bhvBowser")
|
||||||
id_bhvBowserCustom = hook_behavior(id_bhvBowser, OBJ_LIST_GENACTOR, false, nil, bhv_custom_bowser_loop)
|
|
||||||
|
|
||||||
---------------------------------------------------
|
---------------------------------------------------
|
||||||
|
|
||||||
function bhv_custom_grand_star_init(obj)
|
--- @param o Object
|
||||||
obj.oFlags = OBJ_FLAG_UPDATE_GFX_POS_AND_ANGLE
|
local function bhv_custom_grand_star_init(o)
|
||||||
obj.oInteractType = INTERACT_WARP
|
o.oFlags = OBJ_FLAG_UPDATE_GFX_POS_AND_ANGLE
|
||||||
obj.oIntangibleTimer = 0
|
o.oInteractType = INTERACT_WARP
|
||||||
|
o.oIntangibleTimer = 0
|
||||||
cur_obj_set_home_once()
|
cur_obj_set_home_once()
|
||||||
end
|
end
|
||||||
|
|
||||||
function bhv_custom_grand_star_loop(obj)
|
local function bhv_custom_grand_star_loop()
|
||||||
bhv_warp_loop()
|
bhv_warp_loop()
|
||||||
bhv_grand_star_loop()
|
bhv_grand_star_loop()
|
||||||
end
|
end
|
||||||
|
|
||||||
-- hook the behavior
|
id_bhvGrandStar = hook_behavior(id_bhvGrandStar, OBJ_LIST_LEVEL, true, bhv_custom_grand_star_init, bhv_custom_grand_star_loop, "bhvGrandStar")
|
||||||
id_bhvGrandStar = hook_behavior(id_bhvGrandStar, OBJ_LIST_LEVEL, true, bhv_custom_grand_star_init, bhv_custom_grand_star_loop)
|
|
||||||
|
---------------------------------------------------
|
||||||
|
|
||||||
|
--- @param o Object
|
||||||
|
local function bhv_custom_racing_penguin_update(o)
|
||||||
|
if o.oRacingPenguinReachedBottom == 1 then
|
||||||
|
o.oRacingPenguinWeightedNewTargetSpeed = 10
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
id_bhvRacingPenguin = hook_behavior(id_bhvRacingPenguin, OBJ_LIST_GENACTOR, false, nil, bhv_custom_racing_penguin_update, "bhvRacingPenguin")
|
||||||
|
|
|
||||||
|
|
@ -27,9 +27,9 @@ smlua_text_utils_secret_star_replace(COURSE_CAKE_END, " SECRET STARS")
|
||||||
|
|
||||||
smlua_text_utils_castle_secret_stars_replace(" SECRET STARS")
|
smlua_text_utils_castle_secret_stars_replace(" SECRET STARS")
|
||||||
smlua_text_utils_extra_text_replace(0, "ONE OF THE SECRET STARS!")
|
smlua_text_utils_extra_text_replace(0, "ONE OF THE SECRET STARS!")
|
||||||
smlua_text_utils_extra_text_replace(1, "TEST")
|
smlua_text_utils_extra_text_replace(1, "")
|
||||||
smlua_text_utils_extra_text_replace(2, "")
|
smlua_text_utils_extra_text_replace(2, "")
|
||||||
smlua_text_utils_extra_text_replace(3, "")
|
smlua_text_utils_extra_text_replace(3, "")
|
||||||
smlua_text_utils_extra_text_replace(4, "")
|
smlua_text_utils_extra_text_replace(4, "")
|
||||||
smlua_text_utils_extra_text_replace(5, "")
|
smlua_text_utils_extra_text_replace(5, "")
|
||||||
smlua_text_utils_extra_text_replace(6, "")
|
smlua_text_utils_extra_text_replace(6, "")
|
||||||
|
|
@ -1,8 +1,3 @@
|
||||||
changed_dialogs = {}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
smlua_text_utils_dialog_replace(DIALOG_000, 1, 6, 30, 200, "--WARNING--\
|
smlua_text_utils_dialog_replace(DIALOG_000, 1, 6, 30, 200, "--WARNING--\
|
||||||
FLOOR UNSTABLE. DO NOT\
|
FLOOR UNSTABLE. DO NOT\
|
||||||
GROUND-POUND UNDER \
|
GROUND-POUND UNDER \
|
||||||
|
|
@ -1610,7 +1605,6 @@ their houses!")
|
||||||
smlua_text_utils_dialog_replace(DIALOG_168, 1, 5, 30, 200, "Ack! Stop it or I'll\
|
smlua_text_utils_dialog_replace(DIALOG_168, 1, 5, 30, 200, "Ack! Stop it or I'll\
|
||||||
make you stop!")
|
make you stop!")
|
||||||
|
|
||||||
changed_dialogs[169] = 1
|
|
||||||
smlua_text_utils_dialog_replace(DIALOG_169, 1, 6, 30, 200, "Psst! Looking for\
|
smlua_text_utils_dialog_replace(DIALOG_169, 1, 6, 30, 200, "Psst! Looking for\
|
||||||
a challenge? Try pressing\
|
a challenge? Try pressing\
|
||||||
[R] after pausing the\
|
[R] after pausing the\
|
||||||
|
|
@ -1621,14 +1615,11 @@ SMSR veterans, try holding\
|
||||||
the L Button before you\
|
the L Button before you\
|
||||||
host a lobby with 'Super\
|
host a lobby with 'Super\
|
||||||
Mario Star Road' as the\
|
Mario Star Road' as the\
|
||||||
active romhack! ")
|
active romhack!")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function dialog_replace()
|
function dialog_replace()
|
||||||
if gGlobalSyncTable.hardMode then
|
if gGlobalSyncTable.hardMode then
|
||||||
changed_dialogs[169] = 1 -- thank you Emmi for being so cool and having this in MarioHunt so I could remember how to change dialog this way
|
smlua_text_utils_dialog_replace(DIALOG_169, 1, 4, 30, 200, "Welcome to HARD MODE!\
|
||||||
smlua_text_utils_dialog_replace(DIALOG_169, 1, 4, 30, 200, "Welcome to HARD MODE!\
|
|
||||||
This challenge mode is an\
|
This challenge mode is an\
|
||||||
OHKO, which means that\
|
OHKO, which means that\
|
||||||
everything-- and I mean\
|
everything-- and I mean\
|
||||||
|
|
@ -1637,8 +1628,7 @@ one hit! Do you have what\
|
||||||
it takes to complete this\
|
it takes to complete this\
|
||||||
challenge?")
|
challenge?")
|
||||||
else
|
else
|
||||||
changed_dialogs[169] = 1
|
smlua_text_utils_dialog_replace(DIALOG_169, 1, 6, 30, 200, "Psst! Looking for\
|
||||||
smlua_text_utils_dialog_replace(DIALOG_169, 1, 6, 30, 200, "Psst! Looking for\
|
|
||||||
a challenge? Try pressing\
|
a challenge? Try pressing\
|
||||||
[R] after pausing the\
|
[R] after pausing the\
|
||||||
game, and select the\
|
game, and select the\
|
||||||
|
|
@ -1648,10 +1638,8 @@ SMSR veterans, try holding\
|
||||||
the L Button before you\
|
the L Button before you\
|
||||||
host a lobby with 'Super\
|
host a lobby with 'Super\
|
||||||
Mario Star Road' as the\
|
Mario Star Road' as the\
|
||||||
active romhack! ")
|
active romhack!")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
hook_event(HOOK_ON_DIALOG, dialog_replace)
|
||||||
|
|
||||||
hook_event(HOOK_ON_DIALOG, dialog_replace)
|
|
||||||
|
|
@ -21,6 +21,9 @@ gLevelValues.vanishCapDurationVcutm = 900
|
||||||
|
|
||||||
gLevelValues.wingCapLookUpReq = 120
|
gLevelValues.wingCapLookUpReq = 120
|
||||||
|
|
||||||
|
gLevelValues.fixCollisionBugs = true
|
||||||
|
gLevelValues.vanishCapSequence = 0x32
|
||||||
|
|
||||||
-- Replace Stars
|
-- Replace Stars
|
||||||
starPositions = gLevelValues.starPositions
|
starPositions = gLevelValues.starPositions
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,24 +1,14 @@
|
||||||
gGlobalSyncTable.hardMode = false
|
local sBurnActions = { --Accounting for when you are on fire since that type of damage is handled differently.
|
||||||
|
|
||||||
function on_level_init()
|
|
||||||
local m = gMarioStates[0]
|
|
||||||
local np = gNetworkPlayers[0]
|
|
||||||
if gGlobalSyncTable.hardMode then
|
|
||||||
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
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
burnActions = { --Accounting for when you are on fire since that type of damage is handled differently.
|
|
||||||
[ACT_BURNING_FALL] = true,
|
[ACT_BURNING_FALL] = true,
|
||||||
[ACT_BURNING_GROUND] = true,
|
[ACT_BURNING_GROUND] = true,
|
||||||
[ACT_BURNING_JUMP] = true
|
[ACT_BURNING_JUMP] = true
|
||||||
}
|
}
|
||||||
seenPopup = false
|
|
||||||
local frameCounter = 10
|
local frameCounter = 10
|
||||||
local function mario_update(m)
|
local seenPopup = false
|
||||||
if m.playerIndex ~= 0 then return end
|
|
||||||
|
--- @param m MarioState
|
||||||
|
function mario_update_hardmode(m)
|
||||||
if network_is_server() and frameCounter > 0 then
|
if network_is_server() and frameCounter > 0 then
|
||||||
if m.controller.buttonDown & L_TRIG ~= 0 then
|
if m.controller.buttonDown & L_TRIG ~= 0 then
|
||||||
gGlobalSyncTable.hardMode = true -- Starts up "Hard Mode" on Hack Boot. Hold the L button within 10 frames of loading Star Road to activate it.
|
gGlobalSyncTable.hardMode = true -- Starts up "Hard Mode" on Hack Boot. Hold the L button within 10 frames of loading Star Road to activate it.
|
||||||
|
|
@ -30,7 +20,9 @@ local function mario_update(m)
|
||||||
end
|
end
|
||||||
frameCounter = frameCounter - 1
|
frameCounter = frameCounter - 1
|
||||||
end
|
end
|
||||||
|
|
||||||
if not gGlobalSyncTable.hardMode then return end
|
if not gGlobalSyncTable.hardMode then return end
|
||||||
|
|
||||||
if not seenPopup and not network_is_server() then
|
if not seenPopup and not network_is_server() then
|
||||||
save_file_set_using_backup_slot(gGlobalSyncTable.hardMode)
|
save_file_set_using_backup_slot(gGlobalSyncTable.hardMode)
|
||||||
save_file_reload(1)
|
save_file_reload(1)
|
||||||
|
|
@ -38,60 +30,56 @@ local function mario_update(m)
|
||||||
play_sound(SOUND_MENU_MARIO_CASTLE_WARP + 1 << 0, { x = 0, y = 0, z = 0 })
|
play_sound(SOUND_MENU_MARIO_CASTLE_WARP + 1 << 0, { x = 0, y = 0, z = 0 })
|
||||||
seenPopup = true
|
seenPopup = true
|
||||||
end
|
end
|
||||||
if m.hurtCounter > 0 or burnActions[m.action] then
|
|
||||||
m.hurtCounter = 64 -- Damage Check. Hard Mode is a OHKO mode.
|
if m.hurtCounter > 0 or sBurnActions[m.action] then
|
||||||
m.healCounter = 0 -- Prevents you from healing from a coin or any health regen object via landing on one while dying.
|
m.hurtCounter = 64 -- Damage Check. Hard Mode is a OHKO mode
|
||||||
|
m.healCounter = 0 -- Prevents you from healing from a coin or any health regen object via landing on one while dying
|
||||||
end
|
end
|
||||||
if not gGlobalSyncTable.hardMode then return false end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
---@param m MarioState
|
---@param m MarioState
|
||||||
function air(m)
|
function before_mario_update_hardmode(m)
|
||||||
if gGlobalSyncTable.hardMode then
|
if not gGlobalSyncTable.hardMode then return end
|
||||||
if m.action & ACT_GROUP_MASK == ACT_GROUP_SUBMERGED and m.area.terrainType ~= TERRAIN_SNOW then
|
|
||||||
change = (m.pos.y < m.waterLevel - 140 and 1 or -0x1A)
|
if m.action & ACT_GROUP_MASK == ACT_GROUP_SUBMERGED and m.area.terrainType ~= TERRAIN_SNOW then
|
||||||
m.health = m.health + change
|
change = (m.pos.y < m.waterLevel - 140 and 1 or -0x1A)
|
||||||
end
|
m.health = m.health + change
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function hard_mode_menu(_, value)
|
function on_level_init_hardmode()
|
||||||
gGlobalSyncTable.hardMode = value
|
if gGlobalSyncTable.hardMode then
|
||||||
save_file_set_using_backup_slot(gGlobalSyncTable.hardMode)
|
gMarioStates[0].numStars = save_file_get_total_star_count(get_current_save_file_num() - 1, COURSE_MIN - 1,
|
||||||
save_file_reload(1)
|
COURSE_MAX - 1)
|
||||||
djui_popup_create(value and "\\#ff0000\\HARD MODE\\#dcdcdc\\ Activated" or "You are currently in NORMAL MODE.", 1)
|
gLevelValues.exitCastleArea = gNetworkPlayers[0].currAreaIndex
|
||||||
play_sound(SOUND_MENU_MARIO_CASTLE_WARP, { x = 0, y = 0, z = 0 })
|
end
|
||||||
warp_to_warpnode(LEVEL_CASTLE_GROUNDS, 1, 0, 128)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function dialog_box_colors(id)
|
function on_hud_render_hardmode()
|
||||||
if changed_dialogs[id] and gGlobalSyncTable.hardMode then -- red dialog box (Thank you again Emmi)
|
if not is_game_paused() or not gGlobalSyncTable.hardMode then return end
|
||||||
|
|
||||||
|
djui_hud_set_resolution(RESOLUTION_N64)
|
||||||
|
djui_hud_set_font(FONT_HUD)
|
||||||
|
|
||||||
|
djui_hud_set_color(255, 255, 255, 255)
|
||||||
|
local height = djui_hud_get_screen_height()
|
||||||
|
djui_hud_print_text("HARD MODE", 10, height - 30, 1)
|
||||||
|
end
|
||||||
|
|
||||||
|
function on_dialog_hardmode(dialogID)
|
||||||
|
if dialogID == DIALOG_169 and gGlobalSyncTable.hardMode then -- red dialog box (Thank you again Emmi)
|
||||||
set_dialog_override_color(255, 100, 100, 180, 255, 255, 255, 255)
|
set_dialog_override_color(255, 100, 100, 180, 255, 255, 255, 255)
|
||||||
else
|
else
|
||||||
reset_dialog_override_color()
|
reset_dialog_override_color()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if network_is_server() then
|
|
||||||
hook_mod_menu_checkbox("Hard Mode", gGlobalSyncTable.hardMode, hard_mode_menu)
|
|
||||||
end
|
|
||||||
|
|
||||||
local function menu_hud_render()
|
function hard_mode_menu(_, value)
|
||||||
if is_game_paused() and gGlobalSyncTable.hardMode then
|
gGlobalSyncTable.hardMode = value
|
||||||
djui_hud_set_font(FONT_CUSTOM_HUD)
|
save_file_set_using_backup_slot(gGlobalSyncTable.hardMode)
|
||||||
djui_hud_set_color(0xdc, 0xdc, 0xdc, 255)
|
save_file_reload(1)
|
||||||
local height = djui_hud_get_screen_height()
|
djui_popup_create(value and "\\#ff0000\\HARD MODE\\#dcdcdc\\ enabled." or "\\#ff0000\\HARD MODE\\#dcdcdc\\ disabled.", 1)
|
||||||
djui_hud_print_text("Hard Mode", 40, height - 130, 4)
|
play_sound(SOUND_MENU_MARIO_CASTLE_WARP, { x = 0, y = 0, z = 0 })
|
||||||
end
|
warp_to_start_level()
|
||||||
end
|
end
|
||||||
-- Main loop
|
|
||||||
local function hud_render()
|
|
||||||
djui_hud_set_resolution(RESOLUTION_DJUI)
|
|
||||||
menu_hud_render()
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
hook_event(HOOK_ON_HUD_RENDER, hud_render)
|
|
||||||
hook_event(HOOK_ON_DIALOG, dialog_box_colors)
|
|
||||||
hook_event(HOOK_ON_LEVEL_INIT, on_level_init)
|
|
||||||
hook_event(HOOK_MARIO_UPDATE, mario_update)
|
|
||||||
hook_event(HOOK_BEFORE_MARIO_UPDATE, air)
|
|
||||||
|
|
@ -1,16 +1,15 @@
|
||||||
_G.switch = function(param, case_table)
|
--- @param caseTable table
|
||||||
local case = case_table[param]
|
function switch(param, caseTable)
|
||||||
|
local case = caseTable[param]
|
||||||
if case then return case() end
|
if case then return case() end
|
||||||
local def = case_table['default']
|
local def = caseTable['default']
|
||||||
return def and def() or nil
|
return def and def() or nil
|
||||||
end
|
end
|
||||||
|
|
||||||
--------------
|
--------------
|
||||||
|
|
||||||
function get_star_count()
|
function get_star_count()
|
||||||
local courseMax = 25
|
return save_file_get_total_star_count(get_current_save_file_num() - 1, COURSE_MIN - 1, COURSE_MAX - 1)
|
||||||
local courseMin = 1
|
|
||||||
return save_file_get_total_star_count(get_current_save_file_num() - 1, courseMin - 1, courseMax - 1)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function despawn_if_stars_below_count(obj, count)
|
function despawn_if_stars_below_count(obj, count)
|
||||||
|
|
@ -27,13 +26,12 @@ function get_mario_from_global_index(index)
|
||||||
return marioState
|
return marioState
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
return gMarioStates[0]
|
return gMarioStates[0]
|
||||||
end
|
end
|
||||||
|
|
||||||
function check_mario_attacking(obj, mario)
|
function check_mario_attacking(obj, mario)
|
||||||
local marioObject = mario.marioObj
|
local marioObject = mario.marioObj
|
||||||
|
|
||||||
if not (obj_check_if_collided_with_object(obj, marioObject) == 0) then
|
if not (obj_check_if_collided_with_object(obj, marioObject) == 0) then
|
||||||
if abs_angle_diff(obj.oMoveAngleYaw, marioObject.oMoveAngleYaw) > 0x6000 then
|
if abs_angle_diff(obj.oMoveAngleYaw, marioObject.oMoveAngleYaw) > 0x6000 then
|
||||||
if mario.action == ACT_SLIDE_KICK then
|
if mario.action == ACT_SLIDE_KICK then
|
||||||
|
|
@ -68,7 +66,7 @@ end
|
||||||
|
|
||||||
-- Replacement for lll_octagonal_mesh_find_y_offset()
|
-- Replacement for lll_octagonal_mesh_find_y_offset()
|
||||||
function find_y_offset_for_sinking_platform(obj, sinkOffset, a3)
|
function find_y_offset_for_sinking_platform(obj, sinkOffset, a3)
|
||||||
if not (cur_obj_is_any_player_on_platform() == 0) then
|
if not (cur_obj_is_any_player_on_platform() == 0) then
|
||||||
if obj.oSinkWhenSteppedOnUnk104 < 0x4000 then
|
if obj.oSinkWhenSteppedOnUnk104 < 0x4000 then
|
||||||
obj.oSinkWhenSteppedOnUnk104 = obj.oSinkWhenSteppedOnUnk104 + sinkOffset
|
obj.oSinkWhenSteppedOnUnk104 = obj.oSinkWhenSteppedOnUnk104 + sinkOffset
|
||||||
else
|
else
|
||||||
|
|
@ -81,7 +79,7 @@ function find_y_offset_for_sinking_platform(obj, sinkOffset, a3)
|
||||||
obj.oSinkWhenSteppedOnUnk104 = 0
|
obj.oSinkWhenSteppedOnUnk104 = 0
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local yOffset = sins(obj.oSinkWhenSteppedOnUnk104) * a3
|
local yOffset = sins(obj.oSinkWhenSteppedOnUnk104) * a3
|
||||||
return yOffset
|
return yOffset
|
||||||
end
|
end
|
||||||
|
|
@ -89,105 +87,25 @@ end
|
||||||
-- Replacement for bhv_lll_sinking_rock_block_loop()
|
-- Replacement for bhv_lll_sinking_rock_block_loop()
|
||||||
function sinking_perform_sink_check(obj)
|
function sinking_perform_sink_check(obj)
|
||||||
local yOffset = find_y_offset_for_sinking_platform(obj, 124, -110)
|
local yOffset = find_y_offset_for_sinking_platform(obj, 124, -110)
|
||||||
|
|
||||||
obj.oGraphYOffset = 0
|
obj.oGraphYOffset = 0
|
||||||
obj.oPosY = obj.oHomeY + yOffset
|
obj.oPosY = obj.oHomeY + yOffset
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Replacement for native create_sound_spawner()
|
|
||||||
function create_sound_spawner(obj, soundId)
|
|
||||||
local soundObj = spawn_non_sync_object(id_bhvSoundSpawner, 0, 0, 0, 0, nil);
|
|
||||||
if soundObj == nil then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
obj_copy_pos_and_angle(soundObj, obj)
|
|
||||||
soundObj.oSoundEffectUnkF4 = soundId
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Replacement for spawn_object_abs_with_rot()
|
-- Replacement for spawn_object_abs_with_rot()
|
||||||
function spawn_object_abs_with_rot(parent, uselessArg, modelId, bhvId, x, y, z, rx, ry, rz)
|
function spawn_object_abs_with_rot(parent, _, modelId, bhvId, x, y, z, rx, ry, rz)
|
||||||
local childObj = spawn_non_sync_object(bhvId, modelId, 0, 0, 0, nil);
|
local childObj = spawn_non_sync_object(bhvId, modelId, 0, 0, 0, nil)
|
||||||
if childObj == nil then
|
if childObj == nil then
|
||||||
return nil
|
return nil
|
||||||
end
|
end
|
||||||
|
|
||||||
childObj.parentObj = parent
|
childObj.parentObj = parent
|
||||||
childObj.header.gfx.areaIndex = parent.header.gfx.areaIndex
|
childObj.header.gfx.areaIndex = parent.header.gfx.areaIndex
|
||||||
childObj.header.gfx.activeAreaIndex = parent.header.gfx.areaIndex
|
childObj.header.gfx.activeAreaIndex = parent.header.gfx.areaIndex
|
||||||
childObj.globalPlayerIndex = 0
|
childObj.globalPlayerIndex = 0
|
||||||
|
|
||||||
obj_set_pos(childObj, x, y, z);
|
obj_set_pos(childObj, x, y, z)
|
||||||
obj_set_angle(childObj, rx, ry, rz);
|
obj_set_angle(childObj, rx, ry, rz)
|
||||||
|
|
||||||
return childObj
|
return childObj
|
||||||
end
|
end
|
||||||
|
|
||||||
function spawn_sync_object_abs_with_rot(parent, uselessArg, modelId, bhvId, x, y, z, rx, ry, rz)
|
|
||||||
local childObj = spawn_sync_object(bhvId, modelId, 0, 0, 0, nil);
|
|
||||||
if childObj == nil then
|
|
||||||
return nil
|
|
||||||
end
|
|
||||||
|
|
||||||
childObj.parentObj = parent
|
|
||||||
childObj.header.gfx.areaIndex = parent.header.gfx.areaIndex
|
|
||||||
childObj.header.gfx.activeAreaIndex = parent.header.gfx.areaIndex
|
|
||||||
childObj.globalPlayerIndex = 0
|
|
||||||
|
|
||||||
obj_set_pos(childObj, x, y, z);
|
|
||||||
obj_set_angle(childObj, rx, ry, rz);
|
|
||||||
|
|
||||||
return childObj
|
|
||||||
end
|
|
||||||
|
|
||||||
--------------
|
|
||||||
|
|
||||||
-- Replacement for SET_HOME()
|
|
||||||
function object_set_home(obj)
|
|
||||||
obj.oHomeX = obj.oPosX;
|
|
||||||
obj.oHomeY = obj.oPosY;
|
|
||||||
obj.oHomeZ = obj.oPosZ;
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Replacement for SET_OBJ_PHYSICS()
|
|
||||||
function object_set_physics(obj, hitboxRadius, gravity, bounciness, dragStrength, friction, buoyancy)
|
|
||||||
obj.oWallHitboxRadius = hitboxRadius;
|
|
||||||
obj.oGravity = gravity / 100;
|
|
||||||
obj.oBounciness = bounciness / 100;
|
|
||||||
obj.oDragStrength = dragStrength / 100;
|
|
||||||
obj.oFriction = friction / 100;
|
|
||||||
obj.oBuoyancy = buoyancy / 100;
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Replacement for DROP_TO_FLOOR()
|
|
||||||
function object_drop_to_floor(obj)
|
|
||||||
local x = obj.oPosX;
|
|
||||||
local y = obj.oPosY;
|
|
||||||
local z = obj.oPosZ;
|
|
||||||
|
|
||||||
local floorHeight = find_floor_height(x, y + 200, z);
|
|
||||||
obj.oPosY = floorHeight;
|
|
||||||
obj.oMoveFlags = (obj.oMoveFlags | OBJ_MOVE_ON_GROUND);
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Replacement for SPAWN_CHILD_WITH_PARAM()
|
|
||||||
function spawn_child_with_param(obj, bhvParam, modelId, bhvId)
|
|
||||||
local childObj = spawn_non_sync_object(bhvId, modelId, 0, 0, 0, nil);
|
|
||||||
if childObj == nil then
|
|
||||||
--print("Failed to spawn child object with parameters.")
|
|
||||||
return nil
|
|
||||||
end
|
|
||||||
obj_copy_pos_and_angle(childObj, obj)
|
|
||||||
childObj.oBehParams2ndByte = bhvParam;
|
|
||||||
return childObj
|
|
||||||
end
|
|
||||||
|
|
||||||
function spawn_sync_child_with_param(obj, bhvParam, modelId, bhvId)
|
|
||||||
local childObj = spawn_sync_object(bhvId, modelId, 0, 0, 0, nil);
|
|
||||||
if childObj == nil then
|
|
||||||
--print("Failed to spawn synced child object with parameters.")
|
|
||||||
return nil
|
|
||||||
end
|
|
||||||
obj_copy_pos_and_angle(childObj, obj)
|
|
||||||
childObj.oBehParams2ndByte = bhvParam;
|
|
||||||
return childObj
|
|
||||||
end
|
|
||||||
|
|
@ -1,61 +1,93 @@
|
||||||
-- name: Star Road Dev
|
-- name: Star Road
|
||||||
-- description: Romhack created by \\#FFD700\\SKELUX\\#DCDCDC\\\n\nwww.youtube.com/c/Skelux\n\nThere are 23 custom levels, with a total of 130 stars.\n\nPorted to PC by AloXado320,\n\\#FFAAFF\\PeachyPeach\\#DCDCDC\\, and \\#8C4AC7\\PrinceFrizzy\\#DCDCDC\\\n\nPorted to coop by \\#093614\\djoslin0\\#DCDCDC\\,\n\\#8C4AC7\\PrinceFrizzy\\#DCDCDC\\, and \\#141699\\Isaac\\#DCDCDC\\.\n\nAdditional Fixes and "\\#FF0000\\Hard Mode\\#DCDCDC\\" addition by \\#2D851C\\Mr.Needlemouse\\#DCDCDC\\.
|
|
||||||
-- incompatible: romhack
|
-- incompatible: romhack
|
||||||
|
-- description: Star Road\nRomhack created by \\#ffd700\\SKELUX\\#dcdcdc\\\n\nwww.youtube.com/c/Skelux\n\nThere are 23 custom levels, with a total of 130 stars.\n\nPorted to PC by AloXado320,\n\\#ffaaff\\PeachyPeach\\#dcdcdc\\, and \\#8c4ac7\\PrinceFrizzy\\#dcdcdc\\\n\nPorted to coop by \\#093614\\djoslin0\\#dcdcdc\\,\n\\#8c4ac7\\PrinceFrizzy\\#dcdcdc\\, and \\#141699\\Isaac\\#dcdcdc\\.\n\nAdditional Fixes and "\\#ff0000\\Hard Mode\\#dcdcdc\\" addition by \\#2D851C\\Mr.Needlemouse\\#dcdcdc\\.
|
||||||
|
|
||||||
--------------
|
LEVEL_ZERO_LIFE = level_register("level_zerolife_entry", COURSE_NONE, "ZERO LIFE", "zl", 28000, 0x28, 0x28, 0x28)
|
||||||
-- movtexs --
|
|
||||||
--------------
|
|
||||||
|
|
||||||
movtexqc_register('bbh_1_Movtex_0', LEVEL_BBH, 1, 0)
|
gGlobalSyncTable.hardMode = false
|
||||||
movtexqc_register('ccm_1_Movtex_0', LEVEL_CCM, 1, 0)
|
|
||||||
movtexqc_register('hmc_1_Movtex_0', LEVEL_HMC, 1, 0)
|
|
||||||
movtexqc_register('ssl_1_Movtex_0', LEVEL_SSL, 1, 0)
|
|
||||||
movtexqc_register('bob_1_Movtex_0', LEVEL_BOB, 1, 0)
|
|
||||||
movtexqc_register('sl_1_Movtex_0', LEVEL_SL, 1, 0)
|
|
||||||
movtexqc_register('jrb_1_Movtex_0', LEVEL_JRB, 1, 0)
|
|
||||||
movtexqc_register('castle_grounds_1_Movtex_0', LEVEL_CASTLE_GROUNDS, 1, 0)
|
|
||||||
movtexqc_register('lll_1_Movtex_0', LEVEL_LLL, 1, 0)
|
|
||||||
movtexqc_register('wf_1_Movtex_0', LEVEL_WF, 1, 0)
|
|
||||||
movtexqc_register('ending_1_Movtex_0', LEVEL_ENDING, 1, 0)
|
|
||||||
movtexqc_register('castle_courtyard_1_Movtex_0', LEVEL_CASTLE_COURTYARD, 1, 0)
|
|
||||||
movtexqc_register('pss_1_Movtex_0', LEVEL_PSS, 1, 0)
|
|
||||||
movtexqc_register('cotmc_1_Movtex_0', LEVEL_COTMC, 1, 0)
|
|
||||||
movtexqc_register('totwc_1_Movtex_0', LEVEL_TOTWC, 1, 0)
|
|
||||||
movtexqc_register('wmotr_1_Movtex_0', LEVEL_WMOTR, 1, 0)
|
|
||||||
|
|
||||||
------------------
|
local startingLives = false
|
||||||
-- extra levels --
|
local zeroLife = false
|
||||||
------------------
|
|
||||||
|
|
||||||
LEVEL_ZERO_LIFE = level_register('level_zerolife_entry', COURSE_NONE, 'ZERO LIFE', 'zl', 28000, 0x28, 0x28, 0x28)
|
local function mario_update(m)
|
||||||
|
if m.playerIndex ~= 0 then return end
|
||||||
|
|
||||||
---------------------------
|
if not startingLives then
|
||||||
-- race character speed--
|
m.numLives = 3
|
||||||
---------------------------
|
startingLives = true
|
||||||
--- @param o Object
|
end
|
||||||
function bhv_tuxierace_init(o)
|
|
||||||
if o.oRacingPenguinReachedBottom == 1 then
|
if zeroLife then
|
||||||
o.oRacingPenguinWeightedNewTargetSpeed = 10
|
warp_to_level(LEVEL_ZERO_LIFE, 1, 0)
|
||||||
|
zeroLife = false
|
||||||
|
startingLives = true
|
||||||
|
end
|
||||||
|
|
||||||
|
mario_update_hardmode(m)
|
||||||
|
end
|
||||||
|
|
||||||
|
local function before_mario_update(m)
|
||||||
|
before_mario_update_hardmode(m)
|
||||||
|
end
|
||||||
|
|
||||||
|
local function on_hud_render()
|
||||||
|
on_hud_render_hardmode()
|
||||||
|
end
|
||||||
|
|
||||||
|
-- 130 stars castle grounds music
|
||||||
|
local function on_warp()
|
||||||
|
if get_star_count() >= 130 and gNetworkPlayers[0].currLevelNum == LEVEL_CASTLE_GROUNDS then
|
||||||
|
play_music(SEQ_PLAYER_LEVEL, 0x2F, 1)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
hook_behavior(id_bhvRacingPenguin, OBJ_LIST_GENACTOR, false, nil, bhv_tuxierace_init, "bhvRacingPenguin")
|
local function on_level_init()
|
||||||
|
on_warp()
|
||||||
|
on_level_init_hardmode()
|
||||||
|
end
|
||||||
|
|
||||||
---------------------------
|
local function on_death()
|
||||||
-- force server settings --
|
--- @type MarioState
|
||||||
---------------------------
|
local m = gMarioStates[0]
|
||||||
|
if m.numLives < 0 then
|
||||||
|
zeroLife = true
|
||||||
|
m.numLives = 3
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local function on_screen_transition(transitionType)
|
||||||
|
local m = gMarioStates[0]
|
||||||
|
if m.numLives < 0 and transitionType == WARP_TRANSITION_FADE_INTO_BOWSER then
|
||||||
|
zeroLife = true
|
||||||
|
m.numLives = 3
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local function on_dialog(dialogID)
|
||||||
|
on_dialog_hardmode(dialogID)
|
||||||
|
end
|
||||||
|
|
||||||
gLevelValues.fixCollisionBugs = true
|
|
||||||
gLevelValues.vanishCapSequence = 0x32
|
|
||||||
gServerSettings.skipIntro = 1
|
gServerSettings.skipIntro = 1
|
||||||
|
|
||||||
-----------
|
movtexqc_register('bbh_1_Movtex_0', LEVEL_BBH, 1, 0)
|
||||||
-- music --
|
movtexqc_register('ccm_1_Movtex_0', LEVEL_CCM, 1, 0)
|
||||||
-----------
|
movtexqc_register('hmc_1_Movtex_0', LEVEL_HMC, 1, 0)
|
||||||
|
movtexqc_register('ssl_1_Movtex_0', LEVEL_SSL, 1, 0)
|
||||||
-- These have a custom entry in the Star road sequences.json patch. But aren't actually ripped.
|
movtexqc_register('bob_1_Movtex_0', LEVEL_BOB, 1, 0)
|
||||||
--smlua_audio_utils_replace_sequence(0x01, 0x22, 80, "01_Seq_smsrdeluxe_custom") -- SEQ_EVENT_CUTSCENE_COLLECT_STAR
|
movtexqc_register('sl_1_Movtex_0', LEVEL_SL, 1, 0)
|
||||||
|
movtexqc_register('jrb_1_Movtex_0', LEVEL_JRB, 1, 0)
|
||||||
|
movtexqc_register('castle_grounds_1_Movtex_0', LEVEL_CASTLE_GROUNDS, 1, 0)
|
||||||
|
movtexqc_register('lll_1_Movtex_0', LEVEL_LLL, 1, 0)
|
||||||
|
movtexqc_register('wf_1_Movtex_0', LEVEL_WF, 1, 0)
|
||||||
|
movtexqc_register('ending_1_Movtex_0', LEVEL_ENDING, 1, 0)
|
||||||
|
movtexqc_register('castle_courtyard_1_Movtex_0', LEVEL_CASTLE_COURTYARD, 1, 0)
|
||||||
|
movtexqc_register('pss_1_Movtex_0', LEVEL_PSS, 1, 0)
|
||||||
|
movtexqc_register('cotmc_1_Movtex_0', LEVEL_COTMC, 1, 0)
|
||||||
|
movtexqc_register('totwc_1_Movtex_0', LEVEL_TOTWC, 1, 0)
|
||||||
|
movtexqc_register('wmotr_1_Movtex_0', LEVEL_WMOTR, 1, 0)
|
||||||
|
|
||||||
|
-- these have a custom entry in the Star road sequences.json patch. But aren't actually ripped
|
||||||
|
-- smlua_audio_utils_replace_sequence(0x01, 0x22, 80, "01_Seq_smsrdeluxe_custom") -- SEQ_EVENT_CUTSCENE_COLLECT_STAR
|
||||||
smlua_audio_utils_replace_sequence(0x02, 0x25, 80, "02_Seq_smsrdeluxe_custom") -- SEQ_MENU_TITLE_SCREEN
|
smlua_audio_utils_replace_sequence(0x02, 0x25, 80, "02_Seq_smsrdeluxe_custom") -- SEQ_MENU_TITLE_SCREEN
|
||||||
smlua_audio_utils_replace_sequence(0x03, 0x25, 75, "03_Seq_smsrdeluxe_custom") -- SEQ_LEVEL_GRASS
|
smlua_audio_utils_replace_sequence(0x03, 0x25, 75, "03_Seq_smsrdeluxe_custom") -- SEQ_LEVEL_GRASS
|
||||||
smlua_audio_utils_replace_sequence(0x04, 0x25, 70, "04_Seq_smsrdeluxe_custom") -- SEQ_LEVEL_INSIDE_CASTLE
|
smlua_audio_utils_replace_sequence(0x04, 0x25, 70, "04_Seq_smsrdeluxe_custom") -- SEQ_LEVEL_INSIDE_CASTLE
|
||||||
|
|
@ -88,8 +120,7 @@ smlua_audio_utils_replace_sequence(0x1F, 0x25, 80, "1F_Seq_smsrdeluxe_custom") -
|
||||||
smlua_audio_utils_replace_sequence(0x20, 0x25, 70, "20_Seq_smsrdeluxe_custom") -- SEQ_EVENT_CUTSCENE_ENDING
|
smlua_audio_utils_replace_sequence(0x20, 0x25, 70, "20_Seq_smsrdeluxe_custom") -- SEQ_EVENT_CUTSCENE_ENDING
|
||||||
smlua_audio_utils_replace_sequence(0x21, 0x25, 65, "21_Seq_smsrdeluxe_custom") -- SEQ_MENU_FILE_SELECT
|
smlua_audio_utils_replace_sequence(0x21, 0x25, 65, "21_Seq_smsrdeluxe_custom") -- SEQ_MENU_FILE_SELECT
|
||||||
smlua_audio_utils_replace_sequence(0x22, 0x11, 80, "22_Seq_smsrdeluxe_custom") -- SEQ_EVENT_CUTSCENE_LAKITU
|
smlua_audio_utils_replace_sequence(0x22, 0x11, 80, "22_Seq_smsrdeluxe_custom") -- SEQ_EVENT_CUTSCENE_LAKITU
|
||||||
|
-- TODO: See if we can figure out the original volumes for the things below this point
|
||||||
-- TODO: See if we can figure out the original volumes for the things below this point.
|
|
||||||
smlua_audio_utils_replace_sequence(0x23, 0x25, 80, "23_Seq_smsrdeluxe_custom")
|
smlua_audio_utils_replace_sequence(0x23, 0x25, 80, "23_Seq_smsrdeluxe_custom")
|
||||||
smlua_audio_utils_replace_sequence(0x24, 0x11, 70, "24_Seq_smsrdeluxe_custom")
|
smlua_audio_utils_replace_sequence(0x24, 0x11, 70, "24_Seq_smsrdeluxe_custom")
|
||||||
smlua_audio_utils_replace_sequence(0x25, 0x25, 85, "25_Seq_smsrdeluxe_custom")
|
smlua_audio_utils_replace_sequence(0x25, 0x25, 85, "25_Seq_smsrdeluxe_custom")
|
||||||
|
|
@ -100,8 +131,7 @@ smlua_audio_utils_replace_sequence(0x29, 0x25, 70, "29_Seq_smsrdeluxe_custom")
|
||||||
smlua_audio_utils_replace_sequence(0x2A, 0x11, 80, "2A_Seq_smsrdeluxe_custom")
|
smlua_audio_utils_replace_sequence(0x2A, 0x11, 80, "2A_Seq_smsrdeluxe_custom")
|
||||||
smlua_audio_utils_replace_sequence(0x2B, 0x1B, 80, "2B_Seq_smsrdeluxe_custom")
|
smlua_audio_utils_replace_sequence(0x2B, 0x1B, 80, "2B_Seq_smsrdeluxe_custom")
|
||||||
smlua_audio_utils_replace_sequence(0x2C, 0x25, 70, "2C_Seq_smsrdeluxe_custom")
|
smlua_audio_utils_replace_sequence(0x2C, 0x25, 70, "2C_Seq_smsrdeluxe_custom")
|
||||||
|
-- we don't know the correct instruments for these
|
||||||
-- We don't know the correct instruments for these.
|
|
||||||
smlua_audio_utils_replace_sequence(0x2D, 0x25, 75, "2D_Seq_smsrdeluxe_custom")
|
smlua_audio_utils_replace_sequence(0x2D, 0x25, 75, "2D_Seq_smsrdeluxe_custom")
|
||||||
smlua_audio_utils_replace_sequence(0x2E, 0x12, 80, "2E_Seq_smsrdeluxe_custom") -- Final Boss Music
|
smlua_audio_utils_replace_sequence(0x2E, 0x12, 80, "2E_Seq_smsrdeluxe_custom") -- Final Boss Music
|
||||||
smlua_audio_utils_replace_sequence(0x2F, 0x25, 70, "2F_Seq_smsrdeluxe_custom")
|
smlua_audio_utils_replace_sequence(0x2F, 0x25, 70, "2F_Seq_smsrdeluxe_custom")
|
||||||
|
|
@ -109,56 +139,18 @@ smlua_audio_utils_replace_sequence(0x30, 0x25, 65, "30_Seq_smsrdeluxe_custom") -
|
||||||
smlua_audio_utils_replace_sequence(0x31, 0x25, 80, "31_Seq_smsrdeluxe_custom")
|
smlua_audio_utils_replace_sequence(0x31, 0x25, 80, "31_Seq_smsrdeluxe_custom")
|
||||||
smlua_audio_utils_replace_sequence(0x32, 0x25, 80, "32_Seq_smsrdeluxe_custom")
|
smlua_audio_utils_replace_sequence(0x32, 0x25, 80, "32_Seq_smsrdeluxe_custom")
|
||||||
|
|
||||||
------------
|
|
||||||
-- camera --
|
|
||||||
------------
|
|
||||||
camera_set_romhack_override(RCO_ALL_EXCEPT_BOWSER)
|
camera_set_romhack_override(RCO_ALL_EXCEPT_BOWSER)
|
||||||
camera_set_use_course_specific_settings(false)
|
camera_set_use_course_specific_settings(false)
|
||||||
|
|
||||||
-------------------------
|
hook_event(HOOK_MARIO_UPDATE, mario_update)
|
||||||
-- zero life checks --
|
hook_event(HOOK_BEFORE_MARIO_UPDATE, before_mario_update)
|
||||||
-------------------------
|
hook_event(HOOK_ON_HUD_RENDER, on_hud_render)
|
||||||
|
hook_event(HOOK_ON_LEVEL_INIT, on_level_init)
|
||||||
|
hook_event(HOOK_ON_WARP, on_warp)
|
||||||
|
hook_event(HOOK_ON_DEATH, on_death)
|
||||||
|
hook_event(HOOK_ON_SCREEN_TRANSITION, on_screen_transition)
|
||||||
|
hook_event(HOOK_ON_DIALOG, on_dialog)
|
||||||
|
|
||||||
local zerolife = false
|
if network_is_server() then
|
||||||
function on_death(transitionType)
|
hook_mod_menu_checkbox("Hard Mode", gGlobalSyncTable.hardMode, hard_mode_menu)
|
||||||
local m = gMarioStates[0]
|
end
|
||||||
if m.numLives < 0 and transitionType == WARP_TRANSITION_FADE_INTO_BOWSER then
|
|
||||||
zerolife = true
|
|
||||||
m.numLives = 3
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
function void_death()
|
|
||||||
local m = gMarioStates[0]
|
|
||||||
if m.numLives < 0 then
|
|
||||||
zerolife = true
|
|
||||||
m.numLives = 3
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
local startingLives = true
|
|
||||||
local function lives(m)
|
|
||||||
if m.playerIndex ~= 0 then return end
|
|
||||||
if startingLives then
|
|
||||||
m.numLives = 3
|
|
||||||
startingLives = false
|
|
||||||
end
|
|
||||||
if zerolife then
|
|
||||||
warp_to_level(LEVEL_ZERO_LIFE, 1, 0)
|
|
||||||
zerolife = false
|
|
||||||
startingLives = true
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
function on_warp_and_init() -- 130 stars castle grounds music
|
|
||||||
local m = gMarioStates[0]
|
|
||||||
if m.numStars >= 130 and gNetworkPlayers[0].currLevelNum == LEVEL_CASTLE_GROUNDS then
|
|
||||||
play_music(0, 0x2F, 1)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
hook_event(HOOK_ON_SCREEN_TRANSITION, on_death)
|
|
||||||
hook_event(HOOK_ON_LEVEL_INIT, on_warp_and_init)
|
|
||||||
hook_event(HOOK_ON_WARP, on_warp_and_init)
|
|
||||||
hook_event(HOOK_MARIO_UPDATE, lives)
|
|
||||||
hook_event(HOOK_ON_DEATH, void_death)
|
|
||||||
Loading…
Add table
Reference in a new issue