Update some things

This commit is contained in:
Agent X 2024-12-29 14:38:45 -05:00
parent 0627d6ab48
commit 8c8b7e91a3
6 changed files with 68 additions and 46 deletions

View file

@ -423,8 +423,8 @@ function get_exclamation_box_contents()
-- ... -- ...
end end
---@param node GraphNode | FnGraphNode --- @param node GraphNode | FnGraphNode
---@return GraphNode | GraphNodeAnimatedPart | GraphNodeBackground | GraphNodeBillboard | GraphNodeCamera | GraphNodeCullingRadius | GraphNodeDisplayList | GraphNodeGenerated | GraphNodeHeldObject | GraphNodeLevelOfDetail | GraphNodeMasterList | GraphNodeObject | GraphNodeObjectParent | GraphNodeOrthoProjection | GraphNodePerspective | GraphNodeRotation | GraphNodeScale | GraphNodeShadow | GraphNodeStart | GraphNodeSwitchCase | GraphNodeTranslation | GraphNodeTranslationRotation --- @return GraphNode | GraphNodeAnimatedPart | GraphNodeBackground | GraphNodeBillboard | GraphNodeCamera | GraphNodeCullingRadius | GraphNodeDisplayList | GraphNodeGenerated | GraphNodeHeldObject | GraphNodeLevelOfDetail | GraphNodeMasterList | GraphNodeObject | GraphNodeObjectParent | GraphNodeOrthoProjection | GraphNodePerspective | GraphNodeRotation | GraphNodeScale | GraphNodeShadow | GraphNodeStart | GraphNodeSwitchCase | GraphNodeTranslation | GraphNodeTranslationRotation
--- Returns the specific GraphNode(...) the node is part of. --- Returns the specific GraphNode(...) the node is part of.
--- Basically the reverse of `.node` or `.fnNode`. --- Basically the reverse of `.node` or `.fnNode`.
function cast_graph_node(node) function cast_graph_node(node)

View file

@ -134,11 +134,14 @@ The lua functions sent to `hook_event()` will be automatically called by SM64 wh
| HOOK_ON_OBJECT_LOAD | Called when an object is spawned in | [Object](../structs.md#Object) obj | | HOOK_ON_OBJECT_LOAD | Called when an object is spawned in | [Object](../structs.md#Object) obj |
| HOOK_ON_PLAY_SOUND | Called when a sound is going to play, return a `SOUND_*` constant or `NO_SOUND` to override the sound | `integer` soundBits, `Vec3f` pos | | HOOK_ON_PLAY_SOUND | Called when a sound is going to play, return a `SOUND_*` constant or `NO_SOUND` to override the sound | `integer` soundBits, `Vec3f` pos |
| HOOK_ON_SEQ_LOAD | Called when a sequence is going to play, return a `SEQ_*` constant to override the sequence. `SEQ_SOUND_PLAYER` (0) is silence. | `integer` player, `integer` seqID | | HOOK_ON_SEQ_LOAD | Called when a sequence is going to play, return a `SEQ_*` constant to override the sequence. `SEQ_SOUND_PLAYER` (0) is silence. | `integer` player, `integer` seqID |
| HOOK_ON_ATTACK_OBJECT | Called when a player attacks an object. May be double-fired in some cases, you'll need to write special code for this | [MarioState](structs.md#MarioState) attacker, [Object](structs.md#Object) victim, `integer` interactionId | | HOOK_ON_ATTACK_OBJECT | Called when a player attacks an object. May be double-fired in some cases, you'll need to write special code for this | [MarioState](../structs.md#MarioState) attacker, [Object](../structs.md#Object) victim, `integer` interactionId |
| HOOK_ON_LANGUAGE_CHANGED | Called when the language is changed | `string` language | | HOOK_ON_LANGUAGE_CHANGED | Called when the language is changed | `string` language |
| HOOK_ON_MODS_LOADED | Called directly after every mod file is loaded in by smlua | None | | HOOK_ON_MODS_LOADED | Called directly after every mod file is loaded in by smlua | None |
| HOOK_ON_NAMETAGS_RENDER | Called when nametags are rendered. Return a `string` to change what renders on the nametag, return an empty `string` to render nothing. | `string` playerIndex | | HOOK_ON_NAMETAGS_RENDER | Called when nametags are rendered. Return a `string` to change what renders on the nametag, return an empty `string` to render nothing. | `string` playerIndex |
| HOOK_ON_DJUI_THEME_CHANGED | Called when the DJUI theme is changed. Run `djui_menu_get_theme()` to get the new theme. | None | | HOOK_ON_DJUI_THEME_CHANGED | Called when the DJUI theme is changed. Run `djui_menu_get_theme()` to get the new theme. | None |
| HOOK_ON_GEO_PROCESS | Called when a GeoLayout is processed **Note:** You must set the `hookProcess` field of the graph node to a non-zero value | [GraphNode](../structs.md#GraphNode) graphNode, `integer` matStackIndex |
| HOOK_BEFORE_GEO_PROCESS | Called before a GeoLayout is processed **Note:** You must set the `hookProcess` field of the graph node to a non-zero value | [GraphNode](../structs.md#GraphNode) graphNode, `integer` matStackIndex |
| HOOK_ON_GEO_PROCESS_CHILDREN | Called when the children of a GeoLayout node is processed **Note:** You must set the `hookProcess` field of the parent graph node to a non-zero value | [GraphNode](../structs.md#GraphNode) graphNode, `integer` matStackIndex |
### Parameters ### Parameters

View file

@ -20,7 +20,8 @@ local dependacyFiles = {
} }
local legacyFiles = { local legacyFiles = {
"voice.lua", "voice.lua",
"palettes.lua" "palettes.lua",
"z-anims.lua",
} }
-- Check for Missing Files -- Check for Missing Files
@ -54,8 +55,8 @@ if foundLegacyFiles then
end end
MOD_VERSION_API = 1 MOD_VERSION_API = 1
MOD_VERSION_MAJOR = 11 MOD_VERSION_MAJOR = 12
MOD_VERSION_MINOR = 3 MOD_VERSION_MINOR = 0
MOD_VERSION_INDEV = true MOD_VERSION_INDEV = true
MOD_VERSION_STRING = tostring(MOD_VERSION_API) .. "." .. tostring(MOD_VERSION_MAJOR) .. (MOD_VERSION_MINOR > 0 and ("." .. tostring(MOD_VERSION_MINOR)) or "") .. (MOD_VERSION_INDEV and " (In-Dev)" or "") MOD_VERSION_STRING = tostring(MOD_VERSION_API) .. "." .. tostring(MOD_VERSION_MAJOR) .. (MOD_VERSION_MINOR > 0 and ("." .. tostring(MOD_VERSION_MINOR)) or "") .. (MOD_VERSION_INDEV and " (In-Dev)" or "")

View file

@ -1,5 +1,5 @@
-- name: Character Select -- name: Character Select
-- description:\\#ffff33\\-- Character Select Coop v1.11.3 --\n\n\\#dcdcdc\\A Library / API made to make adding and using Custom Characters as simple as possible!\nUse\\#ffff33\\ /char-select\\#dcdcdc\\ to get started!\n\nCreated by:\\#008800\\ Squishy6094\n\n\\#AAAAFF\\Updates can be found on\nCharacter Select's Github:\n\\#6666FF\\Squishy6094/character-select-coop -- description:\\#ffff33\\-- Character Select Coop v1.12 --\n\n\\#dcdcdc\\A Library / API made to make adding and using Custom Characters as simple as possible!\nUse\\#ffff33\\ /char-select\\#dcdcdc\\ to get started!\n\nCreated by:\\#008800\\ Squishy6094\n\n\\#AAAAFF\\Updates can be found on\nCharacter Select's Github:\n\\#6666FF\\Squishy6094/character-select-coop
-- pausable: false -- pausable: false
-- category: cs -- category: cs
@ -863,8 +863,9 @@ local TEXT_MOVESET_RESTRICTED = "Movesets are Restricted"
local TEXT_PALETTE_RESTRICTED = "Palettes are Restricted" local TEXT_PALETTE_RESTRICTED = "Palettes are Restricted"
local TEXT_MOVESET_AND_PALETTE_RESTRICTED = "Moveset and Palettes are Restricted" local TEXT_MOVESET_AND_PALETTE_RESTRICTED = "Moveset and Palettes are Restricted"
local TEXT_CHAR_LOCKED = "Locked" local TEXT_CHAR_LOCKED = "Locked"
-- Easter Egg if you get lucky loading the mod
-- Referencing the original sm64ex DynOS options by PeachyPeach >v<
if math_random(100) == 64 then if math_random(100) == 64 then
-- Easter Egg if you get lucky loading the mod Referencing the original sm64ex DynOS options by PeachyPeach >v<
TEXT_PAUSE_Z_OPEN = "Z - DynOS" TEXT_PAUSE_Z_OPEN = "Z - DynOS"
TEXT_PAUSE_CURR_CHAR = "Model: " TEXT_PAUSE_CURR_CHAR = "Model: "
end end
@ -1736,9 +1737,14 @@ local function chat_command(msg)
msg = string_lower(msg) msg = string_lower(msg)
-- Open Menu Check -- Open Menu Check
if msg == "" or msg == "menu" then if (msg == "" or msg == "menu") then
menu = not menu if menu_is_allowed(gMarioStates[0]) then
return true menu = not menu
return true
else
djui_chat_message_create(TEXT_PAUSE_UNAVALIBLE)
return true
end
end end
-- Help Prompt Check -- Help Prompt Check
@ -1798,3 +1804,16 @@ local function chat_command(msg)
end end
hook_chat_command("char-select", "- Opens the Character Select Menu", chat_command) hook_chat_command("char-select", "- Opens the Character Select Menu", chat_command)
--[[
local function mod_menu_open_cs()
local m = gMarioStates[0]
if menu_is_allowed(m) then
gMarioStates[0].controller.buttonPressed = START_BUTTON
menu = true
else
play_sound(SOUND_MENU_CAMERA_BUZZ, m.pos)
end
end
hook_mod_menu_button("Open Menu", mod_menu_open_cs)
]]

View file

@ -539,23 +539,31 @@ function zero_index_to_one_index(table)
return tableOne return tableOne
end end
local packFilterTotal = 0 local activeNonCSMods = {}
local nonCSModPosition = 0
local CSPacks = 0
for i = 0, #gActiveMods do for i = 0, #gActiveMods do
if remove_color(gActiveMods[i].name):sub(1, 4) == "[CS]" then if gActiveMods[i].name == "Character Select" then
packFilterTotal = packFilterTotal + 1 table.insert(activeNonCSMods, tostring(gActiveMods[i].name))
nonCSModPosition = #activeNonCSMods
elseif (remove_color(gActiveMods[i].name):sub(1, 4) ~= "[CS]" and gActiveMods[i].category ~= "cs") then
table.insert(activeNonCSMods, tostring(gActiveMods[i].name))
else
CSPacks = CSPacks + 1
end end
end end
activeNonCSMods[nonCSModPosition] = "Character Select (+"..CSPacks..")"
function render_playerlist_and_modlist() function render_playerlist_and_modlist()
-- DjuiTheme Data -- DjuiTheme Data
local sDjuiTheme = djui_menu_get_theme() local sDjuiTheme = djui_menu_get_theme()
local hudFont = sDjuiTheme.panels.hudFontHeader local hudFont = sDjuiTheme.panels.hudFontHeader
local rectColor = sDjuiTheme.threePanels.rectColor local rectColor = sDjuiTheme.threePanels.rectColor
local borderColor = sDjuiTheme.threePanels.borderColor local borderColor = sDjuiTheme.threePanels.borderColor
-- PlayerList -- PlayerList
playerListWidth = 710 playerListWidth = 710
playerListHeight = (16 * 32) + (16 - 1) * 4 + (32 + 16) + 32 + 32 playerListHeight = (16 * 32) + (16 - 1) * 4 + (32 + 16) + 32 + 32
local x = djui_hud_get_screen_width()/2 - playerListWidth/2 local x = djui_hud_get_screen_width()/2 - playerListWidth/2
@ -615,8 +623,7 @@ function render_playerlist_and_modlist()
-- ModList -- ModList
local modListWidth = 280 local modListWidth = 280
local modsCount = #gActiveMods - packFilterTotal local modListHeight = (#activeNonCSMods * 32) + (#activeNonCSMods - 1) * 4 + (32 + 16) + 32 + 32
local modListHeight = ((modsCount + 1) * 32) + ((modsCount + 1) - 1) * 4 + (32 + 16) + 32 + 32
local mX = djui_hud_get_screen_width()/2 + 363 local mX = djui_hud_get_screen_width()/2 + 363
local mY = djui_hud_get_screen_height()/2 - modListHeight/2 local mY = djui_hud_get_screen_height()/2 - modListHeight/2
@ -625,36 +632,27 @@ function render_playerlist_and_modlist()
djui_hud_render_header_box(modsString, 0, 0xff, 0xff, 0xff, 0xff, 1, mX, mY, modListWidth, modListHeight, rectColor, borderColor) djui_hud_render_header_box(modsString, 0, 0xff, 0xff, 0xff, 0xff, 1, mX, mY, modListWidth, modListHeight, rectColor, borderColor)
djui_hud_set_font(FONT_USER) djui_hud_set_font(FONT_USER)
local packFilter = 0 for i = 0, #activeNonCSMods - 1 do
for i = 0, #gActiveMods do --local i = i - packFilter
-- Filter CS Packs out of modlist v = (i % 2) ~= 0 and 16 or 32
if remove_color(gActiveMods[i].name):sub(1, 4) == "[CS]" then djui_hud_set_color(v, v, v, 128)
packFilter = packFilter + 1 local entryWidth = modListWidth - ((8 + listMargins) * 2)
else local entryHeight = 32
local i = i - packFilter local entryX = mX + 8 + listMargins
v = (i % 2) ~= 0 and 16 or 32 local entryY = mY + 124 + 0 + ((entryHeight + 4) * (i - 1))
djui_hud_set_color(v, v, v, 128) djui_hud_render_rect(entryX, entryY, entryWidth, entryHeight)
local entryWidth = modListWidth - ((8 + listMargins) * 2) local modName = activeNonCSMods[i + 1]
local entryHeight = 32 local stringSubCount = 23
local entryX = mX + 8 + listMargins local inColor = false
local entryY = mY + 124 + 0 + ((entryHeight + 4) * (i - 1)) for i = 1, #modName do
djui_hud_render_rect(entryX, entryY, entryWidth, entryHeight) if modName:sub(i, i) == "\\" then
local modName = gActiveMods[i].name inColor = not inColor
if modName == "Character Select" and packFilterTotal > 0 then
modName = modName.." (+"..packFilterTotal..")"
end end
local stringSubCount = 23 if inColor then
local inColor = false stringSubCount = stringSubCount + 1
for i = 1, #modName do
if modName:sub(i, i) == "\\" then
inColor = not inColor
end
if inColor then
stringSubCount = stringSubCount + 1
end
end end
djui_hud_print_text_with_color(modName:sub(1, stringSubCount), entryX, entryY, 1, 0xdc, 0xdc, 0xdc, 255)
end end
djui_hud_print_text_with_color(modName:sub(1, stringSubCount), entryX, entryY, 1, 0xdc, 0xdc, 0xdc, 255)
end end
end end

View file

@ -1494,6 +1494,7 @@ void geo_try_process_children(struct GraphNode *node) {
} }
} }
#define MAX_GRAPH_NODE_DEPTH 5000
/** /**
* Process a generic geo node and its siblings. * Process a generic geo node and its siblings.
* The first argument is the start node, and all its siblings will * The first argument is the start node, and all its siblings will
@ -1533,7 +1534,7 @@ void geo_process_node_and_siblings(struct GraphNode *firstNode) {
} }
// Break out of endless loops // Break out of endless loops
if (++depthSanity > 5000) { if (++depthSanity > MAX_GRAPH_NODE_DEPTH) {
LOG_ERROR("Graph Node too deep!"); LOG_ERROR("Graph Node too deep!");
break; break;
} }