Added star road

This commit is contained in:
MysterD 2022-08-05 21:13:47 -07:00
parent 165a7dd68a
commit 50d2946bcc
224 changed files with 2865 additions and 0 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,651 @@
-- We use this instead of o->oHiddenStarLastInteractedObject.
oHiddenStarLastInteractedPlayer = nil
function bhv_custom_hidden_star_trigger_init(obj)
--obj.oFlags = (OBJ_FLAG_UPDATE_GFX_POS_AND_ANGLE)
--obj.hitboxRadius = 200
--obj.hitboxHeight = 200
--obj.oIntangibleTimer = 0
network_init_object(obj, true, { 'activeFlags', 'oInteractStatus' })
end
function bhv_custom_hidden_star_trigger_loop(obj)
if not ((obj.oInteractStatus & INT_STATUS_INTERACTED) == 0) or obj_check_if_collided_with_object(obj, gMarioStates[0].marioObj) == 1 then
local hiddenStar = obj_get_nearest_object_with_behavior_id(obj, bhvSMSRHiddenStar)
if not (hiddenStar == nil) then
local count = (obj_count_objects_with_behavior_id(bhvSMSRHiddenStarTrigger) - 1)
hiddenStar.oHiddenStarTriggerCounter = 5 - count
if not (hiddenStar.oHiddenStarTriggerCounter == 5) then
spawn_orange_number(hiddenStar.oHiddenStarTriggerCounter, 0, 0, 0)
end
-- Set the last person who interacted with a secret to the
-- parent so only they get the star cutscene.
player = nearest_mario_state_to_object(obj)
if not (player == nil) then
oHiddenStarLastInteractedPlayer = player
end
cur_obj_play_sound_2(SOUND_MENU_COLLECT_SECRET + ((hiddenStar.oHiddenStarTriggerCounter - 1) << 16))
end
obj.activeFlags = ACTIVE_FLAG_DEACTIVATED
end
end
--bhvSMSRHiddenStarTrigger = hook_behavior(nil, OBJ_LIST_LEVEL, true, bhv_custom_hidden_star_trigger_init, bhv_custom_hidden_star_trigger_loop)
--------------
function bhv_custom_hidden_star_init(obj)
--obj.oFlags = (OBJ_FLAG_PERSISTENT_RESPAWN | OBJ_FLAG_UPDATE_GFX_POS_AND_ANGLE)
local count = obj_count_objects_with_behavior_id(bhvSMSRHiddenStarTrigger)
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)
if not (star == nil) then
star.oBehParams = obj.oBehParams
end
obj.activeFlags = ACTIVE_FLAG_DEACTIVATED
end
obj.oHiddenStarTriggerCounter = 5 - count
-- We haven't interacted with a player yet.
-- We also don't sync this as not only is it not required
-- but it also is only set for an interaction.
-- 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
-- who last interacted to begin with.
oHiddenStarLastInteractedPlayer = nil
network_init_object(obj, false, { 'oAction', 'oHiddenStarTriggerCounter', 'oPosX', 'oPosY', 'oPosZ', 'oTimer' })
end
function bhv_custom_hidden_star_loop(obj)
switch(obj.oAction, {
[0] = function() -- for case 0
if obj.oHiddenStarTriggerCounter == 5 then
obj.oAction = 1
end
end,
[1] = function() -- for case 1
if obj.oTimer > 2 then
star = spawn_red_coin_cutscene_star(obj.oPosX, obj.oPosY, obj.oPosZ)
if not (star == nil) then
if oHiddenStarLastInteractedPlayer == gMarioStates[0] then
star.oStarSpawnExtCutsceneFlags = 1
else
star.oStarSpawnExtCutsceneFlags = 0
end
spawn_mist_particles()
end
obj.activeFlags = ACTIVE_FLAG_DEACTIVATED
end
end,
})
end
--bhvSMSRHiddenStar = hook_behavior(nil, OBJ_LIST_LEVEL, true, bhv_custom_hidden_star_init, bhv_custom_hidden_star_loop)
--------------
function bhv_breakable_rock_init(obj)
--obj.oFlags = OBJ_FLAG_UPDATE_GFX_POS_AND_ANGLE
--obj.collisionData = smlua_collision_util_get("col_hmc_geo_000530_0x7020308")
--obj.oCollisionDistance = 500
--bhv_init_room()
network_init_object(obj, false, nil)
end
--[[
function bhv_breakable_rock_loop(obj)
bhv_breakable_box_loop()
load_object_collision_model()
end
bhvSMSRBreakableRock = hook_behavior(nil, OBJ_LIST_SURFACE, true, bhv_breakable_rock_init, bhv_breakable_rock_loop)
--]]
--------------
function bhv_breakable_window_init(obj)
obj.oFlags = (OBJ_FLAG_ACTIVE_FROM_AFAR | OBJ_FLAG_COMPUTE_DIST_TO_MARIO | OBJ_FLAG_UPDATE_GFX_POS_AND_ANGLE)
obj.collisionData = smlua_collision_util_get("wf_seg7_collision_small_bomp")
obj.oIntangibleTimer = 0
obj.hitboxRadius = 200
obj.hitboxHeight = 200
--obj.oMoveAngleYaw = obj.oMoveAngleYaw - 0x4000
network_init_object(obj, false, { 'oInteractStatus' });
end
function bhv_breakable_window_loop(obj)
if not (obj.oInteractStatus & INT_STATUS_INTERACTED) or not (obj.oInteractStatus & INT_STATUS_WAS_ATTACKED) then
return
end
if not (check_local_mario_attacking(obj) == 0) then
obj_explode_and_spawn_coins(80, 0)
create_sound_spawner(obj, SOUND_GENERAL_WALL_EXPLOSION)
obj.oInteractStatus = 0;
end
end
---bhvSMSRBreakableWindow = hook_behavior(nil, OBJ_LIST_SURFACE, true, bhv_breakable_window_init, bhv_breakable_window_loop)
--------------
function bhv_star_replica_init(obj)
--obj.oFlags = (OBJ_FLAG_HOLDABLE | OBJ_FLAG_SET_FACE_YAW_TO_MOVE_YAW | OBJ_FLAG_UPDATE_GFX_POS_AND_ANGLE)
--bhv_init_room()
--bhv_collect_star_init()
despawn_if_stars_below_count(obj, 121) -- 121 star check
end
--[[
function bhv_star_replica_loop(obj)
bhv_collect_star_loop()
end
--]]
--bhvSMSRStarReplica = hook_behavior(nil, OBJ_LIST_LEVEL, true, bhv_star_replica_init, bhv_star_replica_loop)
--------------
function bhv_red_sinking_platform_init(obj)
--obj.oFlags = OBJ_FLAG_UPDATE_GFX_POS_AND_ANGLE
--obj.collisionData = smlua_collision_util_get("col_rr_geo_0008C0_0x701ae78")
--obj.oPosY = obj.oPosY - 306
cur_obj_set_home_once()
network_init_object(obj, true, { 'oSinkWhenSteppedOnUnk104', 'oGraphYOffset', 'oHomeY' })
end
--[[
function bhv_red_sinking_platform_loop(obj)
sinking_perform_sink_check(obj)
sinking_perform_sink_check(obj) -- called twice
load_object_collision_model()
end
bhvSMSRRedSinkingPlatform = hook_behavior(nil, OBJ_LIST_SURFACE, true, bhv_red_sinking_platform_init, bhv_red_sinking_platform_loop)
--]]
--------------
--[[
function bhv_star_door_wall_init(obj)
obj.oFlags = OBJ_FLAG_UPDATE_GFX_POS_AND_ANGLE
obj.collisionData = smlua_collision_util_get("custom_collision_door_30_stars")
obj.oCollisionDistance = 4000
end
--]]
function bhv_star_door_wall_loop(obj)
if get_star_count() >= 30 then
obj.activeFlags = ACTIVE_FLAG_DEACTIVATED
end
--load_object_collision_model()
end
--bhvSMSR30StarDoorWall = hook_behavior(nil, OBJ_LIST_SURFACE, true, bhv_star_door_wall_init, bhv_star_door_wall_loop)
--------------
function bhv_special_breakable_box_init(obj)
--obj.oFlags = OBJ_FLAG_UPDATE_GFX_POS_AND_ANGLE
--obj.collisionData = smlua_collision_util_get("breakable_box_seg8_collision_08012D70")
--obj.oCollisionDistance = 500
--bhv_init_room()
despawn_if_stars_below_count(obj, 121) -- 121 star check
end
--[[
function bhv_special_breakable_box_loop(obj)
bhv_breakable_box_loop()
load_object_collision_model()
end
bhvSMSRSpecialBreakeableBox = hook_behavior(nil, OBJ_LIST_SURFACE, true, bhv_special_breakable_box_init, bhv_special_breakable_box_loop)
--]]
--------------
--[[
function bhv_piranha_plant_wild_init(obj)
obj.oFlags = (OBJ_FLAG_COMPUTE_ANGLE_TO_MARIO | OBJ_FLAG_COMPUTE_DIST_TO_MARIO | OBJ_FLAG_SET_FACE_YAW_TO_MOVE_YAW | OBJ_FLAG_UPDATE_GFX_POS_AND_ANGLE)
obj.oAnimations = gObjectAnimations.piranha_plant_seg6_anims_0601C31C
cur_obj_init_animation(0)
obj.oInteractType = INTERACT_MR_BLIZZARD
obj.hitboxRadius = 400
obj.hitboxHeight = 400
end
--]]
function bhv_piranha_plant_wild_loop(obj)
end
--bhvSMSRPiranhaPlantWild = hook_behavior(nil, OBJ_LIST_GENACTOR, true, bhv_piranha_plant_wild_init, bhv_piranha_plant_wild_loop)
--------------
function bhv_big_leaves_init(obj)
obj.header.gfx.node.flags = obj.header.gfx.node.flags | GRAPH_RENDER_CYLBOARD
end
--------------
function bhv_lily_pad_init(obj)
network_init_object(obj, true, { 'oSinkWhenSteppedOnUnk104', 'oGraphYOffset', 'oHomeY' })
end
--------------
function bhv_tambourine_init(obj)
obj.oFlags = OBJ_FLAG_UPDATE_GFX_POS_AND_ANGLE
obj.collisionData = smlua_collision_util_get("col_ddd_geo_0004A0_0x700cbf0")
end
function bhv_tambourine_loop(obj)
bhv_ttc_spinner_update()
load_object_collision_model()
end
bhvSMSRTambourine = hook_behavior(nil, OBJ_LIST_SURFACE, true, bhv_tambourine_init, bhv_tambourine_loop)
--------------
function bhv_small_bee_init(obj)
obj.oFlags = (OBJ_FLAG_COMPUTE_ANGLE_TO_MARIO | OBJ_FLAG_COMPUTE_DIST_TO_MARIO | OBJ_FLAG_UPDATE_GFX_POS_AND_ANGLE)
obj.header.gfx.node.flags = obj.header.gfx.node.flags | GRAPH_RENDER_BILLBOARD
cur_obj_set_home_once()
bhv_init_room()
cur_obj_scale(150 / 100.0)
end
function bhv_small_bee_loop(obj)
bhv_fly_guy_update()
bhv_fly_guy_update() -- called twice
obj.oAnimState = obj.oAnimState + 1
end
bhvSMSRSmallBee = hook_behavior(nil, OBJ_LIST_GENACTOR, true, bhv_small_bee_init, bhv_small_bee_loop)
--------------
function bhv_drum_stick_init(obj)
obj.oFlags = (OBJ_FLAG_SET_FACE_ANGLE_TO_MOVE_ANGLE | OBJ_FLAG_UPDATE_GFX_POS_AND_ANGLE)
obj.collisionData = smlua_collision_util_get("col_ddd_geo_000478_0x7000540")
bhv_ssl_moving_pyramid_wall_init()
end
function bhv_drum_stick_loop(obj)
bhv_ssl_moving_pyramid_wall_loop()
load_object_collision_model()
end
bhvSMSRDrumStick = hook_behavior(nil, OBJ_LIST_SURFACE, true, bhv_drum_stick_init, bhv_drum_stick_loop)
--------------
function bhv_star_moving_init(obj)
obj.oFlags = OBJ_FLAG_UPDATE_GFX_POS_AND_ANGLE
bhv_init_room()
bhv_collect_star_init()
end
function bhv_star_moving_loop(obj)
bhv_collect_star_loop()
bhv_ssl_moving_pyramid_wall_loop()
end
bhvSMSRStarMoving = hook_behavior(nil, OBJ_LIST_LEVEL, true, bhv_star_moving_init, bhv_star_moving_loop)
--------------
function bhv_falling_domino_init(obj)
obj.oFlags = OBJ_FLAG_UPDATE_GFX_POS_AND_ANGLE
obj.collisionData = smlua_collision_util_get("col_ttm_geo_000DF4_0x702b870")
cur_obj_set_home_once()
end
function bhv_falling_domino_loop(obj)
bhv_volcano_trap_loop()
load_object_collision_model()
end
bhvSMSRFallingDomino = hook_behavior(nil, OBJ_LIST_SURFACE, true, bhv_falling_domino_init, bhv_falling_domino_loop)
--------------
function bhv_lava_lift_init(obj)
obj.oFlags = (OBJ_FLAG_COMPUTE_DIST_TO_MARIO | OBJ_FLAG_UPDATE_GFX_POS_AND_ANGLE)
obj.oPosY = obj.oPosY + -50
obj.collisionData = smlua_collision_util_get("col_ttm_geo_000920_0x700a710")
end
function bhv_lava_lift_loop(obj)
bhv_lll_moving_octagonal_mesh_platform_loop()
load_object_collision_model()
end
bhvSMSRLavaLift = hook_behavior(nil, OBJ_LIST_SURFACE, true, bhv_lava_lift_init, bhv_lava_lift_loop)
--------------
function bhv_rotating_lava_platform_init(obj)
obj.oFlags = (OBJ_FLAG_SET_FACE_YAW_TO_MOVE_YAW | OBJ_FLAG_UPDATE_GFX_POS_AND_ANGLE)
obj.collisionData = smlua_collision_util_get("col_lll_geo_000A78_0x701d68c")
cur_obj_set_home_once()
end
function bhv_rotating_lava_platform_loop(obj)
obj.oAngleVelYaw = 256
obj.oMoveAngleYaw = obj.oMoveAngleYaw + 256
load_object_collision_model()
end
bhvSMSRRotatingLavaPlatform = hook_behavior(nil, OBJ_LIST_SURFACE, true, bhv_rotating_lava_platform_init, bhv_rotating_lava_platform_loop)
--------------
function bhv_small_swing_platform_init(obj)
obj.collisionData = smlua_collision_util_get("rr_seg7_collision_pendulum")
obj.oFlags = OBJ_FLAG_UPDATE_GFX_POS_AND_ANGLE
obj.oCollisionDistance = 2000
cur_obj_scale(160 / 100.0)
bhv_swing_platform_init()
end
function bhv_small_swing_platform_loop(obj)
bhv_swing_platform_update()
load_object_collision_model()
end
bhvSMSRSmallSwingPlatform = hook_behavior(nil, OBJ_LIST_SURFACE, true, bhv_small_swing_platform_init, bhv_small_swing_platform_loop)
--------------
function bhv_sinking_donut_init(obj)
obj.oFlags = OBJ_FLAG_UPDATE_GFX_POS_AND_ANGLE
obj.collisionData = smlua_collision_util_get("col_rr_geo_000920_0x70295ec")
obj.oPosY = obj.oPosY - 306
cur_obj_set_home_once()
network_init_object(obj, true, { 'oSinkWhenSteppedOnUnk104', 'oGraphYOffset', 'oHomeY' })
end
function bhv_sinking_donut_loop(obj)
sinking_perform_sink_check(obj)
sinking_perform_sink_check(obj) -- called twice
load_object_collision_model()
end
bhvSMSRSinkingDonut = hook_behavior(nil, OBJ_LIST_SURFACE, true, bhv_sinking_donut_init, bhv_sinking_donut_loop)
--------------
function bhv_floating_thwomp_init(obj)
obj.collisionData = smlua_collision_util_get("thwomp_seg5_collision_0500B7D0")
obj.oFlags = (OBJ_FLAG_COMPUTE_DIST_TO_MARIO | OBJ_FLAG_SET_FACE_YAW_TO_MOVE_YAW | OBJ_FLAG_UPDATE_GFX_POS_AND_ANGLE)
obj.oGraphYOffset = 5
bhv_butterfly_init()
end
function bhv_floating_thwomp_loop(obj)
bhv_butterfly_loop()
load_object_collision_model()
end
bhvSMSRFloatingThwomp = hook_behavior(nil, OBJ_LIST_SURFACE, true, bhv_floating_thwomp_init, bhv_floating_thwomp_loop)
--------------
function bhv_tilting_pyramid_init(obj)
obj.oFlags = (OBJ_FLAG_COMPUTE_DIST_TO_MARIO | OBJ_FLAG_SET_FACE_YAW_TO_MOVE_YAW | OBJ_FLAG_UPDATE_GFX_POS_AND_ANGLE)
obj.collisionData = smlua_collision_util_get("col_geo_bbh_0005F8_0x701fba8")
cur_obj_set_home_once()
bhv_platform_normals_init()
end
function bhv_tilting_pyramid_loop(obj)
bhv_tilting_inverted_pyramid_loop()
load_object_collision_model()
end
bhvSMSRTiltingPyramid = hook_behavior(nil, OBJ_LIST_SURFACE, true, bhv_tilting_pyramid_init, bhv_tilting_pyramid_loop)
--------------
function bhv_platform_lift_init(obj)
obj.oFlags = OBJ_FLAG_UPDATE_GFX_POS_AND_ANGLE
obj.collisionData = smlua_collision_util_get("col_geo_bbh_0005C8_0x701f700")
obj.oArrowLiftUnk100 = 1
end
function bhv_platform_lift_loop(obj)
bhv_arrow_lift_loop()
load_object_collision_model()
end
bhvSMSRPlatformLift = hook_behavior(nil, OBJ_LIST_SURFACE, true, bhv_platform_lift_init, bhv_platform_lift_loop)
--------------
function bhv_rising_lava_init(obj)
obj.oFlags = (OBJ_FLAG_SET_FACE_ANGLE_TO_MOVE_ANGLE | OBJ_FLAG_UPDATE_GFX_POS_AND_ANGLE)
obj.collisionData = smlua_collision_util_get("col_geo_bbh_0005B0_0x701f2d8")
bhv_ssl_moving_pyramid_wall_init()
end
function bhv_rising_lava_loop(obj)
bhv_ssl_moving_pyramid_wall_loop()
load_object_collision_model()
end
bhvSMSRRisingLava = hook_behavior(nil, OBJ_LIST_SURFACE, true, bhv_rising_lava_init, bhv_rising_lava_loop)
--------------
function bhv_rising_tall_platform_init(obj)
obj.oFlags = (OBJ_FLAG_SET_FACE_ANGLE_TO_MOVE_ANGLE | OBJ_FLAG_UPDATE_GFX_POS_AND_ANGLE)
obj.collisionData = smlua_collision_util_get("col_geo_bbh_000628_0x70200f0")
bhv_ssl_moving_pyramid_wall_init()
end
function bhv_rising_tall_platform_loop(obj)
bhv_ssl_moving_pyramid_wall_loop()
load_object_collision_model()
end
bhvSMSRRisingTallPlatform = hook_behavior(nil, OBJ_LIST_SURFACE, true, bhv_rising_tall_platform_init, bhv_rising_tall_platform_loop)
--------------
function bhv_sinking_platform_init(obj)
obj.oFlags = (OBJ_FLAG_COMPUTE_DIST_TO_MARIO | OBJ_FLAG_SET_FACE_YAW_TO_MOVE_YAW | OBJ_FLAG_UPDATE_GFX_POS_AND_ANGLE)
obj.collisionData = smlua_collision_util_get("col_geo_bbh_000640_0x600d758")
obj.oPosY = obj.oPosY + 5
obj.oCollisionDistance = 2000
end
function bhv_sinking_platform_loop(obj)
bhv_lll_sinking_square_platforms_loop()
bhv_lll_sinking_square_platforms_loop() -- called twice
load_object_collision_model()
end
bhvSMSRSinkingPlatform = hook_behavior(nil, OBJ_LIST_SURFACE, true, bhv_sinking_platform_init, bhv_sinking_platform_loop)
--------------
function bhv_toxic_waste_platform_init(obj)
obj.oFlags = (OBJ_FLAG_SET_FACE_YAW_TO_MOVE_YAW | OBJ_FLAG_UPDATE_GFX_POS_AND_ANGLE)
obj.collisionData = smlua_collision_util_get("col_hmc_geo_000548_0x7023478")
obj.oPosY = obj.oPosY - 50
cur_obj_set_home_once()
network_init_object(obj, true, { 'oSinkWhenSteppedOnUnk104', 'oGraphYOffset', 'oHomeY' })
end
function bhv_toxic_waste_platform_loop(obj)
sinking_perform_sink_check(obj)
load_object_collision_model()
end
bhvSMSRToxicWastePlatform = hook_behavior(nil, OBJ_LIST_SURFACE, true, bhv_toxic_waste_platform_init, bhv_toxic_waste_platform_loop)
--------------
function bhv_attracted_space_box_init(obj)
obj.oFlags = (OBJ_FLAG_HOLDABLE | OBJ_FLAG_COMPUTE_DIST_TO_MARIO | OBJ_FLAG_SET_FACE_YAW_TO_MOVE_YAW | OBJ_FLAG_UPDATE_GFX_POS_AND_ANGLE)
obj.collisionData = smlua_collision_util_get("ssl_seg7_collision_tox_box")
obj.oPosY = obj.oPosY + 256
cur_obj_set_home_once()
end
function bhv_attracted_space_box_loop(obj)
bhv_chuckya_loop()
bhv_spindrift_loop()
cur_obj_scale(64 / 100.0)
load_object_collision_model()
end
bhvSMSRAttractedSpaceBox = hook_behavior(nil, OBJ_LIST_SURFACE, true, bhv_attracted_space_box_init, bhv_attracted_space_box_loop)
--------------
function bhv_space_box_init(obj)
obj.oFlags = (OBJ_FLAG_HOLDABLE | OBJ_FLAG_COMPUTE_DIST_TO_MARIO | OBJ_FLAG_SET_FACE_YAW_TO_MOVE_YAW | OBJ_FLAG_UPDATE_GFX_POS_AND_ANGLE)
obj.collisionData = smlua_collision_util_get("ssl_seg7_collision_tox_box")
obj.oPosY = obj.oPosY + 256
end
function bhv_space_box_loop(obj)
bhv_spindrift_loop()
cur_obj_scale(64 / 100.0)
load_object_collision_model()
end
bhvSMSRSpaceBox = hook_behavior(nil, OBJ_LIST_SURFACE, true, bhv_space_box_init, bhv_space_box_loop)
--------------
function bhv_space_octagon_platform_init(obj)
obj.collisionData = smlua_collision_util_get("ssl_seg7_collision_spindel")
obj.oFlags = (OBJ_FLAG_COMPUTE_DIST_TO_MARIO | OBJ_FLAG_UPDATE_GFX_POS_AND_ANGLE)
cur_obj_set_home_once()
bhv_ttc_moving_bar_init()
end
function bhv_space_octagon_platform_loop(obj)
bhv_ttc_moving_bar_update()
load_object_collision_model()
end
bhvSMSRSpaceOctagonPlatform = hook_behavior(nil, OBJ_LIST_SURFACE, true, bhv_space_octagon_platform_init, bhv_space_octagon_platform_loop)
--------------
function bhv_space_red_platform_init(obj)
obj.collisionData = smlua_collision_util_get("ssl_seg7_collision_grindel")
obj.oFlags = OBJ_FLAG_UPDATE_GFX_POS_AND_ANGLE
cur_obj_set_home_once()
cur_obj_scale(91 / 100.0)
bhv_horizontal_grindel_init()
end
function bhv_space_red_platform_loop(obj)
bhv_squishable_platform_loop()
bhv_squishable_platform_loop() -- called twice
load_object_collision_model()
end
bhvSMSRSpaceRedPlatform = hook_behavior(nil, OBJ_LIST_SURFACE, true, bhv_space_red_platform_init, bhv_space_red_platform_loop)
--------------
function bhv_bullet_mine_init(obj)
obj.oFlags = (OBJ_FLAG_COMPUTE_ANGLE_TO_MARIO | OBJ_FLAG_COMPUTE_DIST_TO_MARIO | OBJ_FLAG_SET_FACE_YAW_TO_MOVE_YAW | OBJ_FLAG_MOVE_XZ_USING_FVEL | OBJ_FLAG_UPDATE_GFX_POS_AND_ANGLE)
cur_obj_set_home_once()
obj.hitboxRadius = 50
obj.hitboxHeight = 50
obj.hitboxDownOffset = 50
obj.oInteractType = INTERACT_DAMAGE
obj.oDamageOrCoinValue = 3
cur_obj_scale(256 / 100.0)
obj.oIntangibleTimer = 0
bhv_bullet_bill_init()
end
function bhv_bullet_mine_loop(obj)
bhv_bullet_bill_loop()
end
bhvSMSRBulletMine = hook_behavior(nil, OBJ_LIST_GENACTOR, true, bhv_bullet_mine_init, bhv_bullet_mine_loop)
--------------
E_MODEL_VCUTM_LIGHT = smlua_model_util_get_id("vcutm_light_geo")
function bhv_lights_on_switch_init(obj)
--obj.oFlags = (OBJ_FLAG_COMPUTE_DIST_TO_MARIO | OBJ_FLAG_UPDATE_GFX_POS_AND_ANGLE)
--obj.oCollisionDistance = 8000
obj.parentObj = cur_obj_nearest_object_with_behavior(get_behavior_from_id(id_bhvFloorSwitchAnimatesObject));
obj_set_model_extended(obj, E_MODEL_VCUTM_LIGHT)
end
function bhv_lights_on_switch_loop(obj)
if obj.oFloorSwitchPressAnimationUnk100 ~= 0 then
if obj.parentObj ~= nil and obj.parentObj.oAction ~= 2 then
obj.oFloorSwitchPressAnimationUnk100 = 0
end
if obj.oFloorSwitchPressAnimationUnkFC ~= 0 then
if obj.oBehParams2ndByte >= 0 and obj.oBehParams2ndByte <= 2 then
obj.oFloorSwitchPressAnimationUnkF4 = 200
end
else
obj.oFloorSwitchPressAnimationUnkF4 = 0
end
elseif obj.parentObj ~= nil and obj.parentObj.oAction == 2 then
obj.oFloorSwitchPressAnimationUnkFC = obj.oFloorSwitchPressAnimationUnkFC ~ 1
obj.oFloorSwitchPressAnimationUnk100 = 1
end
if obj.oFloorSwitchPressAnimationUnkF4 ~= 0 then
if obj.oFloorSwitchPressAnimationUnkF4 < 60 then
cur_obj_play_sound_1(SOUND_GENERAL2_SWITCH_TICK_SLOW)
else
cur_obj_play_sound_1(SOUND_GENERAL2_SWITCH_TICK_FAST)
end
obj.oFloorSwitchPressAnimationUnkF4 = obj.oFloorSwitchPressAnimationUnkF4 - 1
if obj.oFloorSwitchPressAnimationUnkF4 == 0 then
obj.oFloorSwitchPressAnimationUnkFC = 0
end
if obj.oFloorSwitchPressAnimationUnkF8 < 9 then
obj.oFloorSwitchPressAnimationUnkF8 = obj.oFloorSwitchPressAnimationUnkF8 + 1
end
else
obj.oFloorSwitchPressAnimationUnkF8 = obj.oFloorSwitchPressAnimationUnkF8 - 2
if obj.oFloorSwitchPressAnimationUnkF8 < 0 then
obj.oFloorSwitchPressAnimationUnkF8 = 0
obj.oFloorSwitchPressAnimationUnkFC = 1
end
end
local fType = math.floor(obj.oFloorSwitchPressAnimationUnkF8 / 2)
if fType == 0 then
cur_obj_hide()
else
cur_obj_unhide()
end
end
--bhvSMSRLightsOnSwitch = hook_behavior(nil, OBJ_LIST_SURFACE, true, bhv_lights_on_switch_init, bhv_lights_on_switch_loop)

View File

@ -0,0 +1,103 @@
function bhv_custom_koopa_the_quick_loop(obj)
if obj.oKoopaMovementType >= KOOPA_BP_KOOPA_THE_QUICK_BASE then
if gNetworkPlayers[0].currLevelNum == 27 then
obj.oKoopaTheQuickRaceIndex = 1
else
obj.oKoopaTheQuickRaceIndex = 0
end
end
end
-- hook the behavior
bhvKoopa = hook_behavior(id_bhvKoopa, OBJ_LIST_PUSHABLE, false, nil, bhv_custom_koopa_the_quick_loop)
---------------------------------------------------
function bhv_custom_castle_cannon_grate_init(obj)
obj.oFlags = (OBJ_FLAG_UPDATE_GFX_POS_AND_ANGLE)
obj.collisionData = smlua_collision_util_get("castle_grounds_seg7_collision_cannon_grill")
obj.oCollisionDistance = 4000
load_object_collision_model()
if get_star_count() > 64 then -- 65 star check
obj.activeFlags = ACTIVE_FLAG_DEACTIVATED
end
end
function bhv_custom_castle_cannon_grate_loop(obj)
load_object_collision_model()
end
-- hook the behavior
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)
if obj_lava_death() == 1 then
spawn_mist_particles()
local m = get_mario_from_global_index(obj.oBullyLastNetworkPlayerIndex)
spawn_non_sync_object(id_bhvBowserKey, E_MODEL_BOWSER_KEY, m.pos.x, m.pos.y, m.pos.z, nil)
end
end
function bhv_custom_big_bully_init(obj)
obj.oFlags = (OBJ_FLAG_SET_FACE_YAW_TO_MOVE_YAW | OBJ_FLAG_UPDATE_GFX_POS_AND_ANGLE)
obj.oAnimations = gObjectAnimations.bully_seg5_anims_0500470C
object_drop_to_floor(obj)
cur_obj_set_home_once()
obj.oIntangibleTimer = 0
cur_obj_init_animation(0)
bhv_big_bully_init()
end
function bhv_custom_bully_loop(obj)
if obj.oAction == BULLY_ACT_LAVA_DEATH then
obj.oBullyPrevX = obj.oPosX
obj.oBullyPrevY = obj.oPosY
obj.oBullyPrevZ = obj.oPosZ
bully_custom_act_level_death(obj)
set_object_visibility(obj, 3000)
else
bhv_bully_loop()
end
end
-- hook the behavior
bhvBigBullyBoss = hook_behavior(id_bhvBigBully, OBJ_LIST_GENACTOR, true, bhv_custom_big_bully_init, bhv_custom_bully_loop)
---------------------------------------------------
function bhv_custom_bowser_loop(obj)
local np = gNetworkPlayers[0]
if np.currAreaSyncValid and np.currLevelSyncValid and np.currLevelNum ~= LEVEL_BOWSER_3 then
-- force bowser into do nothing action when not displaying cutscene
if obj.oAction ~= 5 and obj.oAction ~= 6 and obj.oAction ~= 20 then
obj.oAction = 4
obj.oSubAction = 11
end
end
end
-- hook the behavior
id_bhvBowserCustom = hook_behavior(id_bhvBowser, OBJ_LIST_GENACTOR, false, nil, bhv_custom_bowser_loop)
---------------------------------------------------
function bhv_custom_grand_star_init(obj)
obj.oFlags = OBJ_FLAG_UPDATE_GFX_POS_AND_ANGLE
obj.oInteractType = INTERACT_WARP
obj.oIntangibleTimer = 0
cur_obj_set_home_once()
end
function bhv_custom_grand_star_loop(obj)
bhv_warp_loop()
bhv_grand_star_loop()
end
-- hook the behavior
id_bhvGrandStar = hook_behavior(id_bhvGrandStar, OBJ_LIST_LEVEL, true, bhv_custom_grand_star_init, bhv_custom_grand_star_loop)

53
mods/star-road/camera.lua Normal file
View File

@ -0,0 +1,53 @@
sOverrideCameraModes = {
[CAMERA_MODE_RADIAL] = true,
[CAMERA_MODE_OUTWARD_RADIAL] = true,
[CAMERA_MODE_BEHIND_MARIO] = true,
[CAMERA_MODE_CLOSE] = true,
--[CAMERA_MODE_C_UP] = true,
[CAMERA_MODE_WATER_SURFACE] = true,
[CAMERA_MODE_SLIDE_HOOT] = true,
--[CAMERA_MODE_INSIDE_CANNON] = true,
--[CAMERA_MODE_BOSS_FIGHT] = 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,
}
function override_camera()
local m = gMarioStates[0]
local np = gNetworkPlayers[0]
if sOverrideCameraModes[m.area.camera.mode] == nil then
return
end
if (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)
local m = gMarioStates[0]
if mode == CAMERA_MODE_ROM_HACK then
return true
end
if sOverrideCameraModes[mode] ~= nil then
-- do not allow change
if mode ~= CAMERA_MODE_ROM_HACK then
set_camera_mode(c, CAMERA_MODE_ROM_HACK, frames)
return false
end
return false
end
-- allow camera change
return true
end
hook_event(HOOK_ON_SET_CAMERA_MODE, on_set_camera_mode)

35
mods/star-road/course.lua Normal file
View File

@ -0,0 +1,35 @@
smlua_text_utils_course_acts_replace(COURSE_BOB, " 1 BOB-OMB ISLANDS", "BIG BOB-OMB'S SKY FORT", "TOP OF THE SUNKEN SHIP", "IN THE SIDE OF THE MOUNTAIN", "FIND THE 8 RED COINS", "DEEP DIVE IN THE CAGE", "SMASH THE CHAIN CHOMP'S ROCKS")
smlua_text_utils_course_acts_replace(COURSE_WF, " 2 SKY LAND RESORT", "THE NEW WHOMP KING", "CLIMB THE WINDMILL", "THE FLYING STEPPING STONES", "FINDING THE PURPLE SWITCH", "RED COINS OF THE SKY", "BEHIND THE UNDERWATER GATE")
smlua_text_utils_course_acts_replace(COURSE_JRB, " 3 PIRANHA PLANT POND", "CLIMB THE RUINS", "THE FLOODED CAVE", "8 RED COINS OF THE POND", "SHOOT TO THE TOWER TOP", "UNDERWATER METAL DASH", "THE OWL'S DINNER TIME")
smlua_text_utils_course_acts_replace(COURSE_CCM, " 4 CHUCKYA HARBOR", "CLIMB TO THE HIGHEST POLE", "SWIM INTO THE FLOODED CAGE", "THE UNDERWATER MAZE", "BREAK INTO THE BUILDING", "THE CHUCKYA'S RED COINS", "THE OTHER ENTRANCE")
smlua_text_utils_course_acts_replace(COURSE_BBH, " 5 GLOOMY GARDEN", "BIG BOO'S TOWER", "TOP OF THE RISKY WALKWAY", "THE SECRET TUNNEL", "THE LONE TREE", "HAUNTED RIDE FOR RED COINS", "CALM THE ANGRY EYE")
smlua_text_utils_course_acts_replace(COURSE_HMC, " 6 COLORFUL CORAL CAVERNS", "DEEP DIVE THROUGH THE CORAL", "BOAT RIDE AMONG THE ROCKS", "BREAK THROUGH THE FLOOR", "PRECISION SWIMMING", "RED COINS OF THE DEEP", "THE 'X' MARKS THE SPOT")
smlua_text_utils_course_acts_replace(COURSE_LLL, " 7 KOOPA CANYON", "THE ANGRY SUN'S PYRAMID CLIMB", "SANDY RACE WITH KOOPA THE QUICK", "ANCIENT TREASURE INSIDE THE PYRAMID", "8 ROCKY RED COINS", "GLIDE FROM THE QUICKSAND TORNADO", "SINKY SPIRAL CAVE")
smlua_text_utils_course_acts_replace(COURSE_SSL, " 8 LARGE LEAF FOREST", "A BIG BUG PROBLEM", "SHINING DOWN FROM THE TREE TOPS", "QUICK LILY PAD HOP", "THE BEE'S TREASURE", "VINE-CLIMBING FOR 8 RED COINS", "THE MISSING STAR")
smlua_text_utils_course_acts_replace(COURSE_DDD, " 9 MAD MUSICAL MESS", "THE PIANO-PLAYING THWOMPS", "MOUTH OF THE GIANT FLUTE", "TRICKY TAMBOURINE TRICK", "CRAZY NOTE CLIMB", "THE 8 MUSICAL RED COINS", "TO STRUM THE GUITAR...")
smlua_text_utils_course_acts_replace(COURSE_SL, "10 MELTING SNOW PEAKS", "CHILLY LOOKOUT FIGHT", "THE SNOWMAN'S DEN", "ICY SHELL RIDE", "THE LOST PENGUIN", "CLIFF JUMPING FOR RED COINS", "GLIDE TO THE HIDDEN LEDGE")
smlua_text_utils_course_acts_replace(COURSE_WDW, "11 COLOSSAL CANDY CLUTTER", "TUXIE RACE DOWN THE SLIDE", "TOP OF THE TOY TOWER", "DOOR-KNOCKING", "MOVING TARGET", "POLE-JUMPING", "PLAYFUL RED COINS")
smlua_text_utils_course_acts_replace(COURSE_TTM, "12 CLOUDRAIL STATION", "SWINGING THROUGH THE CLOUDS", "PLATFORM RIDE TO THE CAGE", "FLUFFY CASTLE CLIMB", "THE FROZEN CLOUD", "THE GIANT THWOMP'S TREASURE", "AIRBORNE RED COINS")
smlua_text_utils_course_acts_replace(COURSE_THI, "13 FATAL FLAME FALLS", "DEEP IN THE FLAMING CAVERNS", "CROSS THE LAVA LAKE", "METAL MARIO MELTDOWN", "CLIMB THE CENTRAL LOOKOUT", "BURNING RED COINS", "RISKY RIDE INTO THE VOLCANO")
smlua_text_utils_course_acts_replace(COURSE_TTC, "14 BOB-OMB BATTLE FACTORY", "TOP OF THE FACTORY", "WALL KICK UP THE TOWER", "CAREFUL CRANE CLAMBER", "SWIRLY SUCTION WALL", "THE RUSTY RED COINS", "THE ENGINE LEAK")
smlua_text_utils_course_acts_replace(COURSE_RR, "15 STARLIGHT RUNWAY", "FOLLOW THE GLITTERING PATH", "CLIMB THROUGH THE MACHINERY", "SHUTDOWN THE HANDROID", "AIM THE TURRET", "RED COINS IN THE CRATER", "IN THE CAGE")
smlua_text_utils_secret_star_replace(COURSE_BITDW, " BOWSER'S SLIPPERY SWAMP")
smlua_text_utils_secret_star_replace(COURSE_BITFS, " RETRO REMIX CASTLE")
smlua_text_utils_secret_star_replace(COURSE_BITS, " BOWSER'S RAINBOW RUMBLE")
smlua_text_utils_secret_star_replace(COURSE_PSS, " MUSHROOM MOUNTAIN TOWN")
smlua_text_utils_secret_star_replace(COURSE_COTMC, " CREEPY CAP CAVE")
smlua_text_utils_secret_star_replace(COURSE_TOTWC, " WINDY WING CAP WELL")
smlua_text_utils_secret_star_replace(COURSE_VCUTM, " PUZZLE OF THE VANISH CAP")
smlua_text_utils_secret_star_replace(COURSE_WMOTR, " HIDDEN PALACE FINALE")
smlua_text_utils_secret_star_replace(COURSE_SA, " SANDY SLIDE SECRET")
smlua_text_utils_secret_star_replace(COURSE_CAKE_END, " 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(1, "TEST")
smlua_text_utils_extra_text_replace(2, "")
smlua_text_utils_extra_text_replace(3, "")
smlua_text_utils_extra_text_replace(4, "")
smlua_text_utils_extra_text_replace(5, "")
smlua_text_utils_extra_text_replace(6, "")

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

1622
mods/star-road/dialog.lua Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,82 @@
------------------
-- Level Values --
------------------
gLevelValues.entryLevel = LEVEL_CASTLE_GROUNDS
gLevelValues.exitCastleLevel = LEVEL_CASTLE_GROUNDS
gLevelValues.exitCastleWarpNode = 128
gLevelValues.skipCreditsAt = LEVEL_CASTLE_GROUNDS
gLevelValues.pssSlideStarTime = 540
-- Cap Times
gLevelValues.wingCapDuration = 2700
gLevelValues.metalCapDuration = 900
gLevelValues.vanishCapDuration = 900
gLevelValues.wingCapDurationTotwc = 1800
gLevelValues.metalCapDurationCotmc = 900
gLevelValues.vanishCapDurationVcutm = 900
-- Replace Stars
starPositions = gLevelValues.starPositions
vec3f_set(starPositions.KoopaBobStarPos, -2977.0, 1590.0, 3018.0)
vec3f_set(starPositions.KoopaThiStarPos, -3438.0, 5559.0, 2656.0)
vec3f_set(starPositions.KingBobombStarPos, 4792.0, 1882.0, 3985.0)
vec3f_set(starPositions.KingWhompStarPos, 478.0, 2761.0, -2220.0)
vec3f_set(starPositions.EyerockStarPos, 3156.0, -5550.0, -6841.0)
vec3f_set(starPositions.BigBullyStarPos, -48.0, 2145.0, 2235.0)
vec3f_set(starPositions.ChillBullyStarPos, 4513.0, 3964.0, 3332.0)
vec3f_set(starPositions.BigPiranhasStarPos, -946.0, -677.0, -1069.0)
vec3f_set(starPositions.TuxieMotherStarPos, 5775.0, 2500.0, -5160.0)
vec3f_set(starPositions.WigglerStarPos, 4250.0, 390.0, 424.0)
vec3f_set(starPositions.PssSlideStarPos, 5668.0, -5772.0, -5226.0)
vec3f_set(starPositions.RacingPenguinStarPos, 2476.0, 1302.0, -6029.0)
vec3f_set(starPositions.TreasureChestStarPos, -1800.0, -2500.0, -1700.0)
vec3f_set(starPositions.GhostHuntBooStarPos, 4399.0, 2892.0, -4541.0)
vec3f_set(starPositions.KleptoStarPos, 4399.0, 2892.0, -4541.0)
vec3f_set(starPositions.MerryGoRoundStarPos, -1600.0, -2100.0, 205.0)
vec3f_set(starPositions.MrIStarPos, -3173.0, -1638.0, 1809.0)
vec3f_set(starPositions.BalconyBooStarPos, 4398.0, 2892.0, -4532.0)
vec3f_set(starPositions.BigBullyTrioStarPos, 3700.0, 600.0, -5500.0)
---------------------
-- Behavior Values --
---------------------
gBehaviorValues.ToadStar1Requirement = 0
gBehaviorValues.ToadStar2Requirement = 0
gBehaviorValues.ToadStar3Requirement = 0
gBehaviorValues.dialogs.ToadStar1Dialog = DIALOG_082
gBehaviorValues.dialogs.ToadStar2Dialog = DIALOG_076
gBehaviorValues.dialogs.ToadStar3Dialog = DIALOG_083
gBehaviorValues.dialogs.ToadStar1AfterDialog = DIALOG_154
gBehaviorValues.dialogs.ToadStar2AfterDialog = DIALOG_155
gBehaviorValues.dialogs.ToadStar3AfterDialog = DIALOG_156
gBehaviorValues.KingBobombHealth = 4
gBehaviorValues.KoopaBobAgility = 4.0
gBehaviorValues.KoopaCatchupAgility = 8.0
gBehaviorValues.KoopaThiAgility = 6.0
gBehaviorValues.MipsStar1Requirement = 0
gBehaviorValues.MipsStar2Requirement = 255
gBehaviorValues.GrateStarRequirement = 65
gBehaviorValues.trajectories.KoopaBobTrajectory = get_trajectory('KoopaBoB_path')
gBehaviorValues.trajectories.KoopaThiTrajectory = get_trajectory('KoopaTHI_path')
gBehaviorValues.trajectories.PlatformRrTrajectory = get_trajectory('rr_seg7_trajectory_0702EC3C_RM2C_path')
gBehaviorValues.trajectories.PlatformRr2Trajectory = get_trajectory('rr_seg7_trajectory_0702ECC0_RM2C_path')
gBehaviorValues.trajectories.PlatformCcmTrajectory = get_trajectory('ccm_seg7_trajectory_0701669C_RM2C_path')
gBehaviorValues.trajectories.PlatformBitfsTrajectory = get_trajectory('bitfs_seg7_trajectory_070159AC_RM2C_path')
gBehaviorValues.trajectories.PlatformHmcTrajectory = get_trajectory('hmc_seg7_trajectory_0702B86C_RM2C_path')
gBehaviorValues.trajectories.PlatformLllTrajectory = get_trajectory('lll_seg7_trajectory_0702856C_RM2C_path')
gBehaviorValues.trajectories.PlatformLll2Trajectory = get_trajectory('lll_seg7_trajectory_07028660_RM2C_path')
gBehaviorValues.trajectories.PlatformRr3Trajectory = get_trajectory('rr_seg7_trajectory_0702ED9C_RM2C_path')
gBehaviorValues.trajectories.PlatformRr4Trajectory = get_trajectory('rr_seg7_trajectory_0702EEE0_RM2C_path')
gBehaviorValues.trajectories.RacingPenguinTrajectory = get_trajectory('ccm_seg7_trajectory_penguin_race_RM2C_path')
gBehaviorValues.trajectories.BowlingBallBobTrajectory = get_trajectory('ttc_bowling_ball_path')
gBehaviorValues.trajectories.BowlingBallThiLargeTrajectory = get_trajectory('rr_bowling_ball_path')

193
mods/star-road/helpers.lua Normal file
View File

@ -0,0 +1,193 @@
_G.switch = function(param, case_table)
local case = case_table[param]
if case then return case() end
local def = case_table['default']
return def and def() or nil
end
--------------
function get_star_count()
local courseMax = 25
local courseMin = 1
return save_file_get_total_star_count(get_current_save_file_num() - 1, courseMin - 1, courseMax - 1)
end
function despawn_if_stars_below_count(obj, count)
if get_star_count() < count then
obj_mark_for_deletion(obj)
end
end
function get_mario_from_global_index(index)
local marioState = nil
for i = 0, (MAX_PLAYERS - 1) do
marioState = gMarioStates[i]
if gNetworkPlayers[i].globalIndex == index then
return marioState
end
end
return gMarioStates[0]
end
function check_mario_attacking(obj, mario)
local marioObject = mario.marioObj
if not (obj_check_if_collided_with_object(obj, marioObject) == 0) then
if abs_angle_diff(obj.oMoveAngleYaw, marioObject.oMoveAngleYaw) > 0x6000 then
if mario.action == ACT_SLIDE_KICK then
return 1
end
if mario.action == ACT_PUNCHING then
return 1
end
if mario.action == ACT_MOVE_PUNCHING then
return 1
end
if mario.action == ACT_SLIDE_KICK_SLIDE then
return 1
end
if mario.action == ACT_JUMP_KICK then
return 2
end
if mario.action == ACT_WALL_KICK_AIR then
return 2
end
end
end
return 0
end
function check_local_mario_attacking(obj)
return check_mario_attacking(obj, gMarioStates[0])
end
--------------
-- Replacement for lll_octagonal_mesh_find_y_offset()
function find_y_offset_for_sinking_platform(obj, sinkOffset, a3)
if not (cur_obj_is_any_player_on_platform() == 0) then
if obj.oSinkWhenSteppedOnUnk104 < 0x4000 then
obj.oSinkWhenSteppedOnUnk104 = obj.oSinkWhenSteppedOnUnk104 + sinkOffset
else
obj.oSinkWhenSteppedOnUnk104 = 0x4000
end
else
if obj.oSinkWhenSteppedOnUnk104 > 0 then
obj.oSinkWhenSteppedOnUnk104 = obj.oSinkWhenSteppedOnUnk104 - sinkOffset
else
obj.oSinkWhenSteppedOnUnk104 = 0
end
end
local yOffset = sins(obj.oSinkWhenSteppedOnUnk104) * a3
return yOffset
end
-- Replacement for bhv_lll_sinking_rock_block_loop()
function sinking_perform_sink_check(obj)
local yOffset = find_y_offset_for_sinking_platform(obj, 124, -110)
obj.oGraphYOffset = 0
obj.oPosY = obj.oHomeY + yOffset
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()
function spawn_object_abs_with_rot(parent, uselessArg, modelId, bhvId, x, y, z, rx, ry, rz)
local childObj = spawn_non_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
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

Binary file not shown.

Binary file not shown.

Binary file not shown.

Some files were not shown because too many files have changed in this diff Show More