mirror of
https://github.com/coop-deluxe/sm64coopdx.git
synced 2026-02-20 12:31:09 +00:00
Some checks failed
Build coop / build-linux (push) Has been cancelled
Build coop / build-steamos (push) Has been cancelled
Build coop / build-windows-opengl (push) Has been cancelled
Build coop / build-windows-directx (push) Has been cancelled
Build coop / build-macos-arm (push) Has been cancelled
Build coop / build-macos-intel (push) Has been cancelled
* Replaces Extra Characters * Folder inside another folder fix
31 lines
No EOL
837 B
Lua
31 lines
No EOL
837 B
Lua
--- Misc Functions ---
|
|
|
|
--- @param m MarioState
|
|
--- @param name string
|
|
--- @param accel? number
|
|
--- Plays a custom animation for MarioState `m`
|
|
function play_custom_anim(m, name, accel)
|
|
accel = accel or 0x10000
|
|
|
|
m.marioObj.header.gfx.animInfo.animAccel = accel
|
|
|
|
if (smlua_anim_util_get_current_animation_name(m.marioObj) ~= name or m.marioObj.header.gfx.animInfo.animID ~= -1) then
|
|
m.marioObj.header.gfx.animInfo.animID = -1
|
|
set_anim_to_frame(m, 0)
|
|
end
|
|
|
|
smlua_anim_util_set_animation(m.marioObj, name)
|
|
end
|
|
|
|
--- @param str string
|
|
--- @param splitAt? string
|
|
function string.split(str, splitAt)
|
|
if splitAt == nil then
|
|
splitAt = " "
|
|
end
|
|
local result = {}
|
|
for match in str:gmatch(string.format("[^%s]+", splitAt)) do
|
|
table.insert(result, match)
|
|
end
|
|
return result
|
|
end |