mirror of
https://github.com/coop-deluxe/sm64coopdx.git
synced 2025-10-30 08:01:01 +00:00
* Star Road Fixes + Hard Mode Update 12-09-2024 - You now get sent to Zero Life after dying with a life count below Zero instead of at Zero - Tuxie (Race Penguin) No longer clips through geometry when finishing the race in Colossal Candy Clutter - Set Number of lives from 4 to 3 to be more accurate - Implemented a fully functional Hard Mode as the original hack also had one (Hold L within 10 frames of Hosting a lobby to activate it, uses Backup Slot) - Koopa the Quick in both Koopa Canyon and Mushroom Mountain Town no longer softlocks himself - Added a signpost in Castle Grounds hinting at Hard Mode - Fixed a strange warp node in Zero Life to warp you to the start warp - Moved a Goomba farther from the Warp Pipe in Hidden Palace Finale to prevent him from hitting you immediately (Also makes Hard Mode Possible) * Star Road Fixes 12/14/2024 - Updated SMSRSpaceBox's behavior so that it has a home, as it constantly snapped to origin before, which was why there were Pushable Metal Boxes in their place in Starlight Runway Act 2 - Added "Hard Mode" as it was part of the original hack. Either hold L Trig then Host with Star Road, or enable it in the mod menu. Hard Mode uses the backup save feature so that normal files wont be affected. * Needle's Star Road Fixes 12/15/2024 Fixed a faulty Warp Node in Piranha Plant Pond that caused the player to sometimes enter the level origin instead of the level's correct entry warp * Peachy's Requests (idk) A bit nitpicky but that's my opinion. Maybe I'm just having an off day or something. Anyways, changes were made. I didn't provide the changes to the bhv and lvl files mainly since they already weren't there (probably to save on space?) I can probably add Star Road's but I have no clue about 74's. * All Current Star Road Fixes This is basically every change so far but in one commit - You now get sent to Zero Life after dying with a life count below Zero instead of at Zero - Tuxie (Race Penguin) No longer clips through geometry when finishing the race in Colossal Candy Clutter - Set Number of lives from 4 to 3 to be more accurate - Implemented a fully functional Hard Mode as the original hack also had one (Hold L and Host a lobby OR select "Hard Mode" in the mod menu to activate it, uses Backup Slot) - Koopa the Quick in both Koopa Canyon and Mushroom Mountain Town no longer softlocks himself - Added a signpost in Castle Grounds hinting at Hard Mode - Fixed a strange warp node in Zero Life to warp you to the start warp - Moved a Goomba farther from the Warp Pipe in Hidden Palace Finale to prevent him from hitting you immediately (Also makes Hard Mode Possible) - Fixed a faulty warp in Piranha Plant Pont Pond - Added name coloring to the mod description for easier readability for credits - Altered the "SMSRSpaceBox" object's behavior to have a home using SET_HOME() so that Star 2, "Climb Through the Machinery", in Starlight Runway was casually possible (was previously just metal boxes with a different model) * File Removal Removing Level folders and behaviordata.c via request * Update bhv_overrides.lua
97 lines
3.7 KiB
Lua
97 lines
3.7 KiB
Lua
gGlobalSyncTable.hardMode = false
|
|
|
|
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_GROUND] = true,
|
|
[ACT_BURNING_JUMP] = true
|
|
}
|
|
seenPopup = false
|
|
local frameCounter = 10
|
|
local function mario_update(m)
|
|
if m.playerIndex ~= 0 then return end
|
|
if network_is_server() and frameCounter > 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.
|
|
frameCounter = 0
|
|
save_file_set_using_backup_slot(gGlobalSyncTable.hardMode)
|
|
save_file_reload(1)
|
|
djui_popup_create("\\#ff0000\\HARD MODE\\#dcdcdc\\ Activated", 1)
|
|
play_sound(SOUND_MENU_MARIO_CASTLE_WARP + 1 << 0, { x = 0, y = 0, z = 0 })
|
|
end
|
|
frameCounter = frameCounter - 1
|
|
end
|
|
if not gGlobalSyncTable.hardMode then return end
|
|
if not seenPopup and not network_is_server() then
|
|
save_file_set_using_backup_slot(gGlobalSyncTable.hardMode)
|
|
save_file_reload(1)
|
|
djui_popup_create("You have joined a \\#ff0000\\HARD MODE\\#dcdcdc\\ lobby.", 3)
|
|
play_sound(SOUND_MENU_MARIO_CASTLE_WARP + 1 << 0, { x = 0, y = 0, z = 0 })
|
|
seenPopup = true
|
|
end
|
|
if m.hurtCounter > 0 or burnActions[m.action] then
|
|
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
|
|
if not gGlobalSyncTable.hardMode then return false end
|
|
end
|
|
---@param m MarioState
|
|
function air(m)
|
|
if gGlobalSyncTable.hardMode then
|
|
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)
|
|
m.health = m.health + change
|
|
end
|
|
end
|
|
end
|
|
|
|
function hard_mode_menu(_, value)
|
|
gGlobalSyncTable.hardMode = value
|
|
save_file_set_using_backup_slot(gGlobalSyncTable.hardMode)
|
|
save_file_reload(1)
|
|
djui_popup_create(value and "\\#ff0000\\HARD MODE\\#dcdcdc\\ Activated" or "You are currently in NORMAL MODE.", 1)
|
|
play_sound(SOUND_MENU_MARIO_CASTLE_WARP, { x = 0, y = 0, z = 0 })
|
|
warp_to_warpnode(LEVEL_CASTLE_GROUNDS, 1, 0, 128)
|
|
end
|
|
|
|
function dialog_box_colors(id)
|
|
if changed_dialogs[id] and gGlobalSyncTable.hardMode then -- red dialog box (Thank you again Emmi)
|
|
set_dialog_override_color(255, 100, 100, 180, 255, 255, 255, 255)
|
|
else
|
|
reset_dialog_override_color()
|
|
end
|
|
end
|
|
|
|
if network_is_server() then
|
|
hook_mod_menu_checkbox("Hard Mode", gGlobalSyncTable.hardMode, hard_mode_menu)
|
|
end
|
|
|
|
local function menu_hud_render()
|
|
if is_game_paused() and gGlobalSyncTable.hardMode then
|
|
djui_hud_set_font(FONT_CUSTOM_HUD)
|
|
djui_hud_set_color(0xdc, 0xdc, 0xdc, 255)
|
|
local height = djui_hud_get_screen_height()
|
|
djui_hud_print_text("Hard Mode", 40, height - 130, 4)
|
|
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)
|