Update builtin mods
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

This commit is contained in:
Agent X 2025-12-31 22:34:49 -05:00
parent 39d351d753
commit 6092488d1c
115 changed files with 5823 additions and 2338 deletions

View file

@ -0,0 +1,353 @@
--[[
Custom Font Handler v1 - By Squishy6094
This file adds custom font functionality, and does not need to be edited
Ensure this file is loaded before anything else (make the file name start with a or !)
Use djui_hud_add_font() to add fonts as shown in main.lua
]]
FONT_HANDLER_VERSION_MAJOR = 1
FONT_HANDLER_VERSION_MINOR = 0
FONT_HANDLER_VERSION = "v"..FONT_HANDLER_VERSION_MAJOR.."."..FONT_HANDLER_VERSION_MINOR
local djui_classic_hud_set_font = djui_hud_set_font
local djui_classic_hud_print_text = djui_hud_print_text
local djui_classic_hud_print_text_interpolated = djui_hud_print_text_interpolated
local djui_classic_hud_measure_text = djui_hud_measure_text
local customFont = false
local fontTable = {}
CUSTOM_FONT_COUNT = FONT_COUNT
local customFontType = FONT_NORMAL
local latinChars = {
[32] = " ", [33] = "!", [34] = "\"", [35] = "#", [36] = "$", [37] = "%", [38] = "&", [39] = "'",
[40] = "(", [41] = ")", [42] = "*", [43] = "+", [44] = ",", [45] = "-", [46] = ".", [47] = "/",
[48] = "0", [49] = "1", [50] = "2", [51] = "3", [52] = "4", [53] = "5", [54] = "6", [55] = "7",
[56] = "8", [57] = "9", [58] = ":", [59] = ";", [60] = "<", [61] = "=", [62] = ">", [63] = "?",
[64] = "@", [65] = "A", [66] = "B", [67] = "C", [68] = "D", [69] = "E", [70] = "F", [71] = "G",
[72] = "H", [73] = "I", [74] = "J", [75] = "K", [76] = "L", [77] = "M", [78] = "N", [79] = "O",
[80] = "P", [81] = "Q", [82] = "R", [83] = "S", [84] = "T", [85] = "U", [86] = "V", [87] = "W",
[88] = "X", [89] = "Y", [90] = "Z", [91] = "[", [92] = "\\", [93] = "]", [94] = "^", [95] = "_",
[96] = "`", [97] = "a", [98] = "b", [99] = "c", [100] = "d", [101] = "e", [102] = "f", [103] = "g",
[104] = "h", [105] = "i", [106] = "j", [107] = "k", [108] = "l", [109] = "m", [110] = "n", [111] = "o",
[112] = "p", [113] = "q", [114] = "r", [115] = "s", [116] = "t", [117] = "u", [118] = "v", [119] = "w",
[120] = "x", [121] = "y", [122] = "z", [123] = "{", [124] = "|", [125] = "}", [126] = "~",
-- Latin-1 Supplement
[160] = " ", [161] = "¡", [162] = "¢", [163] = "£", [164] = "¤", [165] = "¥", [166] = "¦", [167] = "§",
[168] = "¨", [169] = "©", [170] = "ª", [171] = "«", [172] = "¬", [173] = "­", [174] = "®", [175] = "¯",
[176] = "°", [177] = "±", [178] = "²", [179] = "³", [180] = "´", [181] = "µ", [182] = "", [183] = "·",
[184] = "¸", [185] = "¹", [186] = "º", [187] = "»", [188] = "¼", [189] = "½", [190] = "¾", [191] = "¿",
[192] = "À", [193] = "Á", [194] = "Â", [195] = "Ã", [196] = "Ä", [197] = "Å", [198] = "Æ", [199] = "Ç",
[200] = "È", [201] = "É", [202] = "Ê", [203] = "Ë", [204] = "Ì", [205] = "Í", [206] = "Î", [207] = "Ï",
[208] = "Ð", [209] = "Ñ", [210] = "Ò", [211] = "Ó", [212] = "Ô", [213] = "Õ", [214] = "Ö", [215] = "×",
[216] = "Ø", [217] = "Ù", [218] = "Ú", [219] = "Û", [220] = "Ü", [221] = "Ý", [222] = "Þ", [223] = "ß",
[224] = "à", [225] = "á", [226] = "â", [227] = "ã", [228] = "ä", [229] = "å", [230] = "æ", [231] = "ç",
[232] = "è", [233] = "é", [234] = "ê", [235] = "ë", [236] = "ì", [237] = "í", [238] = "î", [239] = "ï",
[240] = "ð", [241] = "ñ", [242] = "ò", [243] = "ó", [244] = "ô", [245] = "õ", [246] = "ö", [247] = "÷",
[248] = "ø", [249] = "ù", [250] = "ú", [251] = "û", [252] = "ü", [253] = "ý", [254] = "þ", [255] = "ÿ"
}
local HudAnimTimer = 0
local function convert_unicode_table_to_string_table(input)
local output = {}
for i = 1, #input do
local letter = input[i]
if letter ~= nil and latinChars[letter.id] ~= nil then
output[latinChars[letter.id]] = letter
end
end
return output
end
local function string_to_table(str)
local charArray = {};
local iStart = 0;
local strLen = str:len();
local function bit(b)
return 2 ^ (b - 1);
end
local function hasbit(w, b)
return w % (b + b) >= b
end
local checkMultiByte = function(i)
if (iStart ~= 0) then
charArray[#charArray + 1] = str:sub(iStart, i - 1)
iStart = 0
end
end
for i = 1, strLen do
local b = str:byte(i)
local multiStart = hasbit(b, bit(7)) and hasbit(b, bit(8))
local multiTrail = not hasbit(b, bit(7)) and hasbit(b, bit(8))
if (multiStart) then
checkMultiByte(i)
iStart = i
elseif (not multiTrail) then
checkMultiByte(i)
charArray[#charArray + 1] = str:sub(i, i)
end
end
return charArray
end
---@param texture TextureInfo
---@param info table
---@param spacing integer
---@param offset integer
---@param backup string
---@param scale integer
---@return DjuiFontType
function djui_hud_add_font(texture, info, spacing, offset, backup, scale)
if texture == nil then return FONT_NORMAL end
if info == nil then return FONT_NORMAL end
if spacing == nil then spacing = 1 end
if offset == nil then offset = 0 end
if backup == nil then backup = "x" end
if scale == nil then scale = 1 end
if info[1] ~= nil and info[1].id ~= nil then
info = convert_unicode_table_to_string_table(info)
end
CUSTOM_FONT_COUNT = CUSTOM_FONT_COUNT + 1
fontTable[CUSTOM_FONT_COUNT] = {
spritesheet = texture,
spacing = spacing,
offset = offset,
info = info,
backup = backup,
scale = scale,
}
return CUSTOM_FONT_COUNT
end
---@param fontType DjuiFontType
---@return nil
function djui_hud_set_font(fontType)
if fontType > FONT_COUNT then
customFont = true
customFontType = fontType
else
customFont = false
djui_classic_hud_set_font(fontType)
end
end
local textShake = 0
function djui_hud_effect_shake(intensity)
textShake = math.ceil(intensity*100)*0.01
end
local textWaveX = 0
local textWaveY = 0
local textWaveSpeed = 0
function djui_hud_effect_wave(x, y, speed)
textWaveX = x
textWaveY = y
textWaveSpeed = speed
end
---@param message string
---@param x number
---@param y number
---@param scale number
---@return nil
function djui_hud_print_text(message, x, y, scale)
if customFont then
if message == nil or message == "" then return end
local message = string_to_table(message)
local currFont = fontTable[customFontType]
y = y + currFont.offset
scale = scale*currFont.scale
for i = 1, #message do
local letter = message[i]
if letter and letter ~= " " then
if currFont.info[letter] == nil then
letter = currFont.backup
end
local scaleWidth = scale*(currFont.info[letter].height/currFont.info[letter].width)
djui_hud_render_texture_tile(currFont.spritesheet,
x + ((currFont.info[letter].xoffset or 0)*scale) + math.random(-textShake*100, textShake*100)*0.01 + math.sin((HudAnimTimer+i*2)*textWaveSpeed*0.1)*textWaveX,
y + ((currFont.info[letter].yoffset or 0)*scale) + math.random(-textShake*100, textShake*100)*0.01 + math.cos((HudAnimTimer+i*2)*textWaveSpeed*0.1)*textWaveY,
scaleWidth, scale,
currFont.info[letter].x,
currFont.info[letter].y,
currFont.info[letter].width,
currFont.info[letter].height)
else
letter = currFont.backup
end
x = x + (currFont.info[letter].width + currFont.spacing)*scale
end
else
djui_classic_hud_print_text(message, x, y, scale)
end
end
---@param message string
---@param prevX number
---@param prevY number
---@param prevScale number
---@param x number
---@param y number
---@param scale number
---@return nil
-- Custom Fonts do not currently support Interpolation due to lack of RESOLUTION_N64 support
function djui_hud_print_text_interpolated(message, prevX, prevY, prevScale, x, y, scale)
if customFont then
if message == nil or message == "" then return end
local message = string_to_table(message)
local currFont = fontTable[customFontType]
prevY = prevY + currFont.offset
y = y + currFont.offset
scale = scale*currFont.scale
for i = 1, #message do
local letter = message[i]
if letter and letter ~= " " then
if currFont.info[letter] == nil then
letter = currFont.backup
end
local prevScaleWidth = prevScale*(currFont.info[letter].height/currFont.info[letter].width)
local scaleWidth = scale*(currFont.info[letter].height/currFont.info[letter].width)
local xOffset = ((currFont.info[letter].xoffset or 0)*scale) + math.random(-textShake*100, textShake*100)*0.01 + math.sin((HudAnimTimer+i*2)*textWaveSpeed*0.1)*textWaveX
local yOffset = ((currFont.info[letter].yoffset or 0)*scale) + math.random(-textShake*100, textShake*100)*0.01 + math.cos((HudAnimTimer+i*2)*textWaveSpeed*0.1)*textWaveY
djui_hud_render_texture_tile_interpolated(currFont.spritesheet,
prevX + xOffset,
prevY + yOffset,
prevScaleWidth, prevScale,
x + xOffset,
y + yOffset,
scaleWidth, scale,
currFont.info[letter].x,
currFont.info[letter].y,
currFont.info[letter].width,
currFont.info[letter].height)
else
letter = currFont.backup
end
x = x + (currFont.info[letter].width + currFont.spacing)*scale
prevX = prevX + (currFont.info[letter].width + currFont.spacing)*prevScale
end
else
djui_classic_hud_print_text_interpolated(message, prevX, prevY, prevScale, x, y, scale)
end
end
---@param message string
---@return number
function djui_hud_measure_text(message)
if customFont then
if message == nil or message == "" then return end
local message = string_to_table(message)
local currFont = fontTable[customFontType]
local scale = 1
local x = 0
for i = 1, #message do
local letter = message[i]
if letter and letter ~= " " then
if currFont.info[letter] == nil then
letter = currFont.backup
end
else
letter = currFont.backup
end
x = x + (currFont.info[letter].width + currFont.spacing)*scale
end
return x
else
return djui_classic_hud_measure_text(message)
end
end
local function hud_update()
-- Reset Values Every Frame
textShake = 0
textWaveX = 0
textWaveY = 0
textWaveSpeed = 0
-- Update Basic Anim Timer
HudAnimTimer = HudAnimTimer + 1
end
hook_event(HOOK_ON_HUD_RENDER_BEHIND, hud_update)
-- Adding custom fonts here to prevent main clutter
fontdataCharacteristic = {
["A"] = {x = 0, y = 0, width = 26, height = 32},
["B"] = {x = 32, y = 0, width = 25, height = 32},
["C"] = {x = 32*2, y = 0, width = 25, height = 32},
["D"] = {x = 32*3, y = 0, width = 23, height = 32},
["E"] = {x = 32*4, y = 0, width = 24, height = 32},
["F"] = {x = 32*5, y = 0, width = 24, height = 32},
["G"] = {x = 32*6, y = 0, width = 26, height = 32},
["H"] = {x = 32*7, y = 0, width = 25, height = 32},
["I"] = {x = 0, y = 32, width = 15, height = 32},
["J"] = {x = 32, y = 32, width = 21, height = 32},
["K"] = {x = 32*2, y = 32, width = 25, height = 32},
["L"] = {x = 32*3, y = 32, width = 22, height = 32},
["M"] = {x = 32*4, y = 32, width = 29, height = 32},
["N"] = {x = 32*5, y = 32, width = 27, height = 32},
["Ñ"] = {x = 32*6, y = 32, width = 27, height = 32},
["O"] = {x = 32*7, y = 32, width = 26, height = 32},
["P"] = {x = 0, y = 32*2, width = 25, height = 32},
["Q"] = {x = 32, y = 32*2, width = 27, height = 32},
["R"] = {x = 32*2, y = 32*2, width = 25, height = 32},
["S"] = {x = 32*3, y = 32*2, width = 24, height = 32},
["T"] = {x = 32*4, y = 32*2, width = 28, height = 32},
["U"] = {x = 32*5, y = 32*2, width = 26, height = 32},
["V"] = {x = 32*6, y = 32*2, width = 27, height = 32},
["W"] = {x = 32*7, y = 32*2, width = 30, height = 32},
["X"] = {x = 0, y = 32*3, width = 28, height = 32},
["Y"] = {x = 32, y = 32*3, width = 27, height = 32},
["Z"] = {x = 32*2, y = 32*3, width = 27, height = 32},
["!"] = {x = 32*3, y = 32*3, width = 30, height = 32},
["?"] = {x = 32*4, y = 32*3, width = 27, height = 32},
["@"] = {x = 32*5, y = 32*3, width = 29, height = 32},
["#"] = {x = 32*6, y = 32*3, width = 29, height = 32},
["$"] = {x = 32*7, y = 32*3, width = 23, height = 32},
["%"] = {x = 0, y = 32*4, width = 27, height = 32},
["^"] = {x = 32, y = 32*4, width = 24, height = 32},
["&"] = {x = 32*2, y = 32*4, width = 29, height = 32},
["*"] = {x = 32*3, y = 32*4, width = 18, height = 32},
["("] = {x = 32*4, y = 32*4, width = 17, height = 32},
[")"] = {x = 32*5, y = 32*4, width = 17, height = 32},
["_"] = {x = 32*6, y = 32*4, width = 31, height = 32},
["-"] = {x = 32*7, y = 32*4, width = 23, height = 32},
["+"] = {x = 0, y = 32*5, width = 24, height = 32},
["="] = {x = 32, y = 32*5, width = 27, height = 32},
["<"] = {x = 32*2, y = 32*5, width = 23, height = 32},
[">"] = {x = 32*3, y = 32*5, width = 23, height = 32},
["."] = {x = 32*4, y = 32*5, width = 11, height = 32},
[","] = {x = 32*5, y = 32*5, width = 11, height = 32},
[":"] = {x = 32*6, y = 32*5, width = 11, height = 32},
[";"] = {x = 32*7, y = 32*5, width = 11, height = 32},
["/"] = {x = 0, y = 32*6, width = 28, height = 32},
["\\"] = {x = 32, y = 32*6, width = 28, height = 32},
['"'] = {x = 32*2, y = 32*6, width = 14, height = 32},
["'"] = {x = 32*3, y = 32*6, width = 9, height = 32},
["|"] = {x = 32*4, y = 32*6, width = 10, height = 32},
["~"] = {x = 32*5, y = 32*6, width = 23, height = 32},
["1"] = {x = 32*6, y = 32*6, width = 23, height = 32},
["2"] = {x = 32*7, y = 32*6, width = 26, height = 32},
["3"] = {x = 0, y = 32*7, width = 24, height = 32},
["4"] = {x = 32, y = 32*7, width = 24, height = 32},
["5"] = {x = 32*2, y = 32*7, width = 26, height = 32},
["6"] = {x = 32*3, y = 32*7, width = 26, height = 32},
["7"] = {x = 32*4, y = 32*7, width = 30, height = 32},
["8"] = {x = 32*5, y = 32*7, width = 22, height = 32},
["9"] = {x = 32*6, y = 32*7, width = 24, height = 32},
["0"] = {x = 32*7, y = 32*7, width = 24, height = 32},
}
FONT_CHARACTERISTIC = djui_hud_add_font(get_texture_info("char_select_font_characteristic"), fontdataCharacteristic, -5, 0, "X", 1)

View file

@ -1,3 +0,0 @@
GITHUB_COMMIT_TIME = '05/16/2025 07:27:43 PM PST'
GITHUB_COMMIT_ID = '115b65e'
GITHUB_REPO = 'Squishy6094/character-select-coop'

View file

@ -0,0 +1,15 @@
CREDIT_SUPPORTERS = {
"Saul",
"Ellie",
"Lyrae",
"Sophia",
"maemae",
"charity",
"FunkyLion",
"VioletArts",
"Nope208",
"Jack Black",
"GRAND DAD",
"Key's Artworks",
"Kale!",
}

View file

@ -1,68 +1,22 @@
-- localize functions to improve performance - a-utils.lua
local string_lower,string_format,table_insert,get_date_and_time = string.lower,string.format,table.insert,get_date_and_time
-- Version Data --
MOD_VERSION_API = 1
MOD_VERSION_MAJOR = 14
MOD_VERSION_MINOR = 1
MOD_VERSION_MAJOR = 16
MOD_VERSION_MINOR = 0
MOD_VERSION_INDEV = false
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_DEBUG = tostring(GITHUB_REPO) .. " | " .. tostring(GITHUB_COMMIT_ID) .. " | " .. tostring(GITHUB_COMMIT_TIME)
if VERSION_NUMBER < 38 then
djui_popup_create("\n\\#FFAAAA\\Character Select requires\n the latest version of CoopDX to use!\n\nYou can find CoopDX here:\n\\#6666FF\\https://sm64coopdx.com", 5)
incompatibleClient = true
return 0
end
local dependacyFiles = {
-- Required Lua File
--"a-github.lua",
"dialog.lua",
"main.lua",
"n-hud.lua",
"o-api.lua",
"z-moveset.lua",
"z-palettes.lua",
"z-voice.lua",
-- Required Actors
"actors/armature_geo.bin",
}
local legacyFiles = {
"voice.lua",
"palettes.lua",
"z-anims.lua",
}
local fileErrorList = {}
-- Check for Missing Files
for i = 1, #dependacyFiles do
if not mod_file_exists(dependacyFiles[i]) then
log_to_console("Character Select file missing: '" .. dependacyFiles[i] .. "'", CONSOLE_MESSAGE_WARNING)
table_insert(fileErrorList, "Missing File '" .. dependacyFiles[i] .. "'")
end
end
-- Check for Legacy Files
for i = 1, #legacyFiles do
if mod_file_exists(legacyFiles[i]) then
log_to_console("Character Select legacy file found: '" .. legacyFiles[i] .. "'", CONSOLE_MESSAGE_WARNING)
table_insert(fileErrorList, "Legacy File '" .. legacyFiles[i] .. "'")
end
end
if #fileErrorList > 0 then
-- Check CoopDX Version
VERSION_REQUIRED = 41
if VERSION_NUMBER < VERSION_REQUIRED then
incompatibleClient = true
local frameCount = 0
hook_event(HOOK_UPDATE, function ()
frameCount = frameCount + 1
if frameCount == 5 then
local errorString = "\\#FFAAAA\\Character Select File Issues:"
djui_popup_create("\\#FFAAAA\\Character Select is having\nfile issues and cannot load!\n\nErrors have been logged in chat!", 4)
for i = 1, #fileErrorList do
errorString = errorString .. "\n" .. fileErrorList[i]
end
errorString = errorString .. "\n\nThe best way to resolve these issues is to delete your current version of Character Select and then install the latest version!"
djui_popup_create("\n\\#FFAAAA\\Character Select requires\n the latest version of CoopDX to use!\n\nYou can find CoopDX here:\n\\#AAAAFF\\https://sm64coopdx.com", 5)
djui_chat_message_create("\\#FFAAAA\\Character Select Version Issue:\nVersion " .. tostring(VERSION_NUMBER) .. " < " .. tostring(VERSION_REQUIRED))
local errorString = "\\#FFAAAA\\The best way to resolve this issue is to reinstall SM64CoopDX from the Offical Site or Github Repo!\n\\#AAAAFF\\https://sm64coopdx.com/\nhttps://github.com/coop-deluxe/sm64coopdx/"
log_to_console(errorString)
djui_chat_message_create(errorString)
end
@ -70,6 +24,132 @@ if #fileErrorList > 0 then
return 0
end
log_to_console("Character Select "..MOD_VERSION_STRING)
local dependacyFiles = {
--- Required Lua Files
"a-font-handler.lua",
"anims.lua",
"dialog.lua",
"hud.lua",
"main.lua",
"moveset.lua",
"palettes.lua",
"voice.lua",
"z-api.lua",
-- Required Texture Files
"textures/char_select_album_back.tex",
"textures/char_select_album_front.tex",
"textures/char_select_album_overlay.tex",
"textures/char_select_category.tex",
"textures/char_select_caution_tape.tex",
"textures/char_select_cd_layer1.tex",
"textures/char_select_cd_layer2.tex",
"textures/char_select_cd_layer3.tex",
"textures/char_select_cd_layer4.tex",
"textures/char_select_custom_course_bottom.tex",
"textures/char_select_custom_course_top.tex",
"textures/char_select_custom_meter_left.tex",
"textures/char_select_custom_meter_pie1.tex",
"textures/char_select_custom_meter_pie2.tex",
"textures/char_select_custom_meter_pie3.tex",
"textures/char_select_custom_meter_pie4.tex",
"textures/char_select_custom_meter_pie5.tex",
"textures/char_select_custom_meter_pie6.tex",
"textures/char_select_custom_meter_pie7.tex",
"textures/char_select_custom_meter_pie8.tex",
"textures/char_select_custom_meter_right.tex",
"textures/char_select_font_brick.tex",
"textures/char_select_font_characteristic.tex",
"textures/char_select_gear.tex",
"textures/char_select_graffiti_default.tex",
"textures/char_select_graffiti_luigi.tex",
"textures/char_select_graffiti_mario.tex",
"textures/char_select_graffiti_toad.tex",
"textures/char_select_graffiti_waluigi.tex",
"textures/char_select_graffiti_wario.tex",
"textures/char_select_icon_signs.tex",
"textures/char_select_list_button.tex",
"textures/char_select_logo.tex",
"textures/char_select_luigi_meter_left.tex",
"textures/char_select_luigi_meter_right.tex",
"textures/char_select_nameplate.tex",
"textures/char_select_options_tv.tex",
"textures/char_select_palette_bucket.tex",
"textures/char_select_record.tex",
"textures/char_select_toad_meter_left.tex",
"textures/char_select_toad_meter_right.tex",
"textures/char_select_wall_left.tex",
"textures/char_select_wall_right.tex",
"textures/char_select_waluigi_meter_left.tex",
"textures/char_select_waluigi_meter_right.tex",
"textures/char_select_wario_meter_left.tex",
"textures/char_select_wario_meter_right.tex",
}
local legacyFiles = {
"z-anims.lua",
"n-hud.lua",
"o-api.lua",
"z-moveset.lua",
"z-palettes.lua",
"z-voice.lua",
}
local fileErrorList = {}
if network_is_server() then
-- Check for Missing Files
for i = 1, #dependacyFiles do
if not mod_file_exists(dependacyFiles[i]) then
log_to_console("Character Select file missing: '" .. dependacyFiles[i] .. "'", CONSOLE_MESSAGE_WARNING)
table.insert(fileErrorList, "Missing File '" .. dependacyFiles[i] .. "'")
end
end
-- Check for Legacy Files
for i = 1, #legacyFiles do
if mod_file_exists(legacyFiles[i]) then
log_to_console("Character Select legacy file found: '" .. legacyFiles[i] .. "'", CONSOLE_MESSAGE_WARNING)
table.insert(fileErrorList, "Legacy File '" .. legacyFiles[i] .. "'")
end
end
if #fileErrorList > 0 then
incompatibleClient = true
local frameCount = 0
hook_event(HOOK_UPDATE, function ()
frameCount = frameCount + 1
if frameCount == 5 then
local errorString = "\\#FFAAAA\\Character Select File Issues:"
djui_popup_create("\\#FFAAAA\\Character Select is having\nfile issues and cannot load!\n\nErrors have been logged in chat!", 4)
for i = 1, #fileErrorList do
errorString = errorString .. "\n" .. fileErrorList[i]
end
log_to_console(errorString)
djui_chat_message_create(errorString)
errorString = "\\#FFAAAA\\The best way to resolve these issues is to delete your current version of Character Select and then install the latest version from the Github Repo!\n\\#AAAAFF\\https://github.com/Squishy6094/character-select-coop/\\#FFAAAA\\"
log_to_console(errorString)
djui_chat_message_create(errorString)
end
end)
return 0
end
end
-- Failsafe printing nil text
local djui_hud_print_text_original = djui_hud_print_text
function djui_hud_print_text(string, x, y, scale)
djui_hud_print_text_original(tostring(string), x, y, scale)
end
local string_sub = string.sub
function djui_hud_print_monospace_text(string, x, y, scale, space)
space = space or 16
for i = 1, #string do
djui_hud_print_text(string_sub(string, i, i), x + space*(i - 1)*scale, y, scale)
end
end
ommActive = false
for i in pairs(gActiveMods) do
if gActiveMods[i].relativePath == "omm-coop" then
@ -78,8 +158,6 @@ for i in pairs(gActiveMods) do
end
end
E_MODEL_ARMATURE = smlua_model_util_get_id("armature_geo")
local saveableCharacters = {
["1"] = 1,
["2"] = 1,
@ -125,44 +203,44 @@ local saveableCharacters = {
[" "] = 0,
}
--- @param string string
---@param string string
--- Replaces underscores in the string with spaces
function string_underscore_to_space(string)
if string == nil then return "" end
return string:gsub("_", " ")
end
--- @param string string
---@param string string
--- Constructs a new string but only with characters from `saveableCharacters`
--- * Spaces are the notable character that gets turned into an underscore
function string_space_to_underscore(string)
local s = ''
for i = 1, #string do
local c = string:sub(i,i)
if saveableCharacters[string_lower(c)] == 1 then
if saveableCharacters[string.lower(c)] == 1 then
s = s .. c
elseif saveableCharacters[string_lower(c)] == 0 then
elseif saveableCharacters[string.lower(c)] == 0 then
s = s .. "_"
end
end
return s
end
--- @param string string
---@param string string
--- Splits a string into a table by spaces
function string_split(string, splitAt)
if splitAt == nil then
splitAt = " "
end
local result = {}
for match in string:gmatch(string_format("[^%s]+", splitAt)) do
table_insert(result, match)
for match in string:gmatch(string.format("[^%s]+", splitAt)) do
table.insert(result, match)
end
return result
end
--- @param param number
--- @param caseTable table
---@param param number
---@param caseTable table
--- Switch statement function
function switch(param, caseTable)
local case = caseTable[param]
@ -171,17 +249,52 @@ function switch(param, caseTable)
return def and def() or nil
end
function clamp(num, min, max)
return math.max(math.min(num, max), min)
---@param s string
---@param v any
--- Defines a global variable by name `s` with the value `v` and indexes it if it already exists
function define_valid_global(s, v)
local name = s
local index = 1
while _G[name] ~= nil do
name = s .. "_" .. index
index = index + 1
end
_G[name] = v
end
---@param n integer
---@return boolean
function num_power_of_two(n)
return n ~= 0 and (n & (n - 1)) == 0
end
function angle_from_2d_points(x1, y1, x2, y2)
return atan2s(y2 - y1, x2 - x1) - 0x4000
end
function hash(word)
local result = 5381
for i = 1, #word do
result = (result << 5) + result + word:byte(i)
end
return result
end
function lerp(a, b, t)
return a * (1 - t) + b * t
end
function num_wrap(num, min, max)
if num > max then num = min end
if num < min then num = max end
return num
end
allowMenu = {}
renderInMenuTable = {
hookTableRenderInMenu = {
front = {},
back = {},
}
@ -190,18 +303,13 @@ queueStorageFailsafe = false
charBeingSet = false
stopPalettes = false
for i in pairs(gActiveMods) do
if (gActiveMods[i].incompatible ~= nil and gActiveMods[i].incompatible:find("gamemode")) and not (gActiveMods[i].name:find("Personal Star Counter")) then
stopPalettes = true
end
end
stopMovesets = false
gGlobalSyncTable.charSelectRestrictPalettes = 0
gGlobalSyncTable.charSelectRestrictMovesets = 0
seasonalEvent = 0
SEASON_EVENT_BIRTHDAY = 1
SEASON_EVENT_CHRISTMAS = 2
SEASON_EVENT_FOOLS = 2
-- December
if get_date_and_time().month == 11 then
if get_date_and_time().day == 3 then
@ -211,6 +319,8 @@ if get_date_and_time().month == 11 then
-- Christmas
seasonalEvent = SEASON_EVENT_CHRISTMAS
end
elseif get_date_and_time().month == 4 and get_date_and_time().month == 1 then
seasonalEvent = SEASON_EVENT_FOOLS
end
-- Dedicated Networking Table for Character Select
@ -222,8 +332,9 @@ for i = 0, MAX_PLAYERS - 1 do
currAlt = 1,
presetPalette = 0,
offset = 0,
forceChar = 0,
baseChar = 0,
modelId = E_MODEL_MARIO,
prevModelId = E_MODEL_MARIO,
isUpdating = false,
movesetToggle = true,
modelEditOffset = 0,
@ -231,9 +342,24 @@ for i = 0, MAX_PLAYERS - 1 do
}
end
local stallFrame = 0
local stallComplete = 3
function startup_init_stall(framesBefore)
framesBefore = framesBefore or 0
return stallFrame == (stallComplete - framesBefore)
end
local stallPacket = 0
local function update()
stallPacket = (stallPacket+1)%3 -- refresh rate (to reduce stress)
local function network_update(m)
if m.playerIndex ~= 0 then return end
-- Initialization Update
if stallFrame < stallComplete then
stallFrame = stallFrame + 1
end
-- Packet Refresh Rate
stallPacket = (stallPacket+1)%3
if stallPacket == 0 then
network_send(false, gCSPlayers[0])
end
@ -245,4 +371,353 @@ local function on_packet_recieve(data)
end
hook_event(HOOK_ON_PACKET_RECEIVE, on_packet_recieve)
hook_event(HOOK_UPDATE, update)
hook_event(HOOK_MARIO_UPDATE, network_update)
-- Default Actions Check
local defaultActions = {
[ACT_UNINITIALIZED] = ACT_UNINITIALIZED,
[ACT_IDLE] = ACT_IDLE,
[ACT_START_SLEEPING] = ACT_START_SLEEPING,
[ACT_SLEEPING] = ACT_SLEEPING,
[ACT_WAKING_UP] = ACT_WAKING_UP,
[ACT_PANTING] = ACT_PANTING,
[ACT_HOLD_PANTING_UNUSED] = ACT_HOLD_PANTING_UNUSED,
[ACT_HOLD_IDLE] = ACT_HOLD_IDLE,
[ACT_HOLD_HEAVY_IDLE] = ACT_HOLD_HEAVY_IDLE,
[ACT_STANDING_AGAINST_WALL] = ACT_STANDING_AGAINST_WALL,
[ACT_COUGHING] = ACT_COUGHING,
[ACT_SHIVERING] = ACT_SHIVERING,
[ACT_IN_QUICKSAND] = ACT_IN_QUICKSAND,
[ACT_UNKNOWN_0002020E] = ACT_UNKNOWN_0002020E,
[ACT_CROUCHING] = ACT_CROUCHING,
[ACT_START_CROUCHING] = ACT_START_CROUCHING,
[ACT_STOP_CROUCHING] = ACT_STOP_CROUCHING,
[ACT_START_CRAWLING] = ACT_START_CRAWLING,
[ACT_STOP_CRAWLING] = ACT_STOP_CRAWLING,
[ACT_SLIDE_KICK_SLIDE_STOP] = ACT_SLIDE_KICK_SLIDE_STOP,
[ACT_SHOCKWAVE_BOUNCE] = ACT_SHOCKWAVE_BOUNCE,
[ACT_FIRST_PERSON] = ACT_FIRST_PERSON,
[ACT_BACKFLIP_LAND_STOP] = ACT_BACKFLIP_LAND_STOP,
[ACT_JUMP_LAND_STOP] = ACT_JUMP_LAND_STOP,
[ACT_DOUBLE_JUMP_LAND_STOP] = ACT_DOUBLE_JUMP_LAND_STOP,
[ACT_FREEFALL_LAND_STOP] = ACT_FREEFALL_LAND_STOP,
[ACT_SIDE_FLIP_LAND_STOP] = ACT_SIDE_FLIP_LAND_STOP,
[ACT_HOLD_JUMP_LAND_STOP] = ACT_HOLD_JUMP_LAND_STOP,
[ACT_HOLD_FREEFALL_LAND_STOP] = ACT_HOLD_FREEFALL_LAND_STOP,
[ACT_AIR_THROW_LAND] = ACT_AIR_THROW_LAND,
[ACT_TWIRL_LAND] = ACT_TWIRL_LAND,
[ACT_LAVA_BOOST_LAND] = ACT_LAVA_BOOST_LAND,
[ACT_TRIPLE_JUMP_LAND_STOP] = ACT_TRIPLE_JUMP_LAND_STOP,
[ACT_LONG_JUMP_LAND_STOP] = ACT_LONG_JUMP_LAND_STOP,
[ACT_GROUND_POUND_LAND] = ACT_GROUND_POUND_LAND,
[ACT_BRAKING_STOP] = ACT_BRAKING_STOP,
[ACT_BUTT_SLIDE_STOP] = ACT_BUTT_SLIDE_STOP,
[ACT_HOLD_BUTT_SLIDE_STOP] = ACT_HOLD_BUTT_SLIDE_STOP,
[ACT_WALKING] = ACT_WALKING,
[ACT_HOLD_WALKING] = ACT_HOLD_WALKING,
[ACT_TURNING_AROUND] = ACT_TURNING_AROUND,
[ACT_FINISH_TURNING_AROUND] = ACT_FINISH_TURNING_AROUND,
[ACT_BRAKING] = ACT_BRAKING,
[ACT_RIDING_SHELL_GROUND] = ACT_RIDING_SHELL_GROUND,
[ACT_HOLD_HEAVY_WALKING] = ACT_HOLD_HEAVY_WALKING,
[ACT_CRAWLING] = ACT_CRAWLING,
[ACT_BURNING_GROUND] = ACT_BURNING_GROUND,
[ACT_DECELERATING] = ACT_DECELERATING,
[ACT_HOLD_DECELERATING] = ACT_HOLD_DECELERATING,
[ACT_BEGIN_SLIDING] = ACT_BEGIN_SLIDING,
[ACT_HOLD_BEGIN_SLIDING] = ACT_HOLD_BEGIN_SLIDING,
[ACT_BUTT_SLIDE] = ACT_BUTT_SLIDE,
[ACT_STOMACH_SLIDE] = ACT_STOMACH_SLIDE,
[ACT_HOLD_BUTT_SLIDE] = ACT_HOLD_BUTT_SLIDE,
[ACT_HOLD_STOMACH_SLIDE] = ACT_HOLD_STOMACH_SLIDE,
[ACT_DIVE_SLIDE] = ACT_DIVE_SLIDE,
[ACT_MOVE_PUNCHING] = ACT_MOVE_PUNCHING,
[ACT_CROUCH_SLIDE] = ACT_CROUCH_SLIDE,
[ACT_SLIDE_KICK_SLIDE] = ACT_SLIDE_KICK_SLIDE,
[ACT_HARD_BACKWARD_GROUND_KB] = ACT_HARD_BACKWARD_GROUND_KB,
[ACT_HARD_FORWARD_GROUND_KB] = ACT_HARD_FORWARD_GROUND_KB,
[ACT_BACKWARD_GROUND_KB] = ACT_BACKWARD_GROUND_KB,
[ACT_FORWARD_GROUND_KB] = ACT_FORWARD_GROUND_KB,
[ACT_SOFT_BACKWARD_GROUND_KB] = ACT_SOFT_BACKWARD_GROUND_KB,
[ACT_SOFT_FORWARD_GROUND_KB] = ACT_SOFT_FORWARD_GROUND_KB,
[ACT_GROUND_BONK] = ACT_GROUND_BONK,
[ACT_DEATH_EXIT_LAND] = ACT_DEATH_EXIT_LAND,
[ACT_JUMP_LAND] = ACT_JUMP_LAND,
[ACT_FREEFALL_LAND] = ACT_FREEFALL_LAND,
[ACT_DOUBLE_JUMP_LAND] = ACT_DOUBLE_JUMP_LAND,
[ACT_SIDE_FLIP_LAND] = ACT_SIDE_FLIP_LAND,
[ACT_HOLD_JUMP_LAND] = ACT_HOLD_JUMP_LAND,
[ACT_HOLD_FREEFALL_LAND] = ACT_HOLD_FREEFALL_LAND,
[ACT_QUICKSAND_JUMP_LAND] = ACT_QUICKSAND_JUMP_LAND,
[ACT_HOLD_QUICKSAND_JUMP_LAND] = ACT_HOLD_QUICKSAND_JUMP_LAND,
[ACT_TRIPLE_JUMP_LAND] = ACT_TRIPLE_JUMP_LAND,
[ACT_LONG_JUMP_LAND] = ACT_LONG_JUMP_LAND,
[ACT_BACKFLIP_LAND] = ACT_BACKFLIP_LAND,
[ACT_JUMP] = ACT_JUMP,
[ACT_DOUBLE_JUMP] = ACT_DOUBLE_JUMP,
[ACT_TRIPLE_JUMP] = ACT_TRIPLE_JUMP,
[ACT_BACKFLIP] = ACT_BACKFLIP,
[ACT_STEEP_JUMP] = ACT_STEEP_JUMP,
[ACT_WALL_KICK_AIR] = ACT_WALL_KICK_AIR,
[ACT_SIDE_FLIP] = ACT_SIDE_FLIP,
[ACT_LONG_JUMP] = ACT_LONG_JUMP,
[ACT_WATER_JUMP] = ACT_WATER_JUMP,
[ACT_DIVE] = ACT_DIVE,
[ACT_FREEFALL] = ACT_FREEFALL,
[ACT_TOP_OF_POLE_JUMP] = ACT_TOP_OF_POLE_JUMP,
[ACT_BUTT_SLIDE_AIR] = ACT_BUTT_SLIDE_AIR,
[ACT_FLYING_TRIPLE_JUMP] = ACT_FLYING_TRIPLE_JUMP,
[ACT_SHOT_FROM_CANNON] = ACT_SHOT_FROM_CANNON,
[ACT_FLYING] = ACT_FLYING,
[ACT_RIDING_SHELL_JUMP] = ACT_RIDING_SHELL_JUMP,
[ACT_RIDING_SHELL_FALL] = ACT_RIDING_SHELL_FALL,
[ACT_VERTICAL_WIND] = ACT_VERTICAL_WIND,
[ACT_HOLD_JUMP] = ACT_HOLD_JUMP,
[ACT_HOLD_FREEFALL] = ACT_HOLD_FREEFALL,
[ACT_HOLD_BUTT_SLIDE_AIR] = ACT_HOLD_BUTT_SLIDE_AIR,
[ACT_HOLD_WATER_JUMP] = ACT_HOLD_WATER_JUMP,
[ACT_TWIRLING] = ACT_TWIRLING,
[ACT_FORWARD_ROLLOUT] = ACT_FORWARD_ROLLOUT,
[ACT_AIR_HIT_WALL] = ACT_AIR_HIT_WALL,
[ACT_RIDING_HOOT] = ACT_RIDING_HOOT,
[ACT_GROUND_POUND] = ACT_GROUND_POUND,
[ACT_SLIDE_KICK] = ACT_SLIDE_KICK,
[ACT_AIR_THROW] = ACT_AIR_THROW,
[ACT_JUMP_KICK] = ACT_JUMP_KICK,
[ACT_BACKWARD_ROLLOUT] = ACT_BACKWARD_ROLLOUT,
[ACT_CRAZY_BOX_BOUNCE] = ACT_CRAZY_BOX_BOUNCE,
[ACT_SPECIAL_TRIPLE_JUMP] = ACT_SPECIAL_TRIPLE_JUMP,
[ACT_BACKWARD_AIR_KB] = ACT_BACKWARD_AIR_KB,
[ACT_FORWARD_AIR_KB] = ACT_FORWARD_AIR_KB,
[ACT_HARD_FORWARD_AIR_KB] = ACT_HARD_FORWARD_AIR_KB,
[ACT_HARD_BACKWARD_AIR_KB] = ACT_HARD_BACKWARD_AIR_KB,
[ACT_BURNING_JUMP] = ACT_BURNING_JUMP,
[ACT_BURNING_FALL] = ACT_BURNING_FALL,
[ACT_SOFT_BONK] = ACT_SOFT_BONK,
[ACT_LAVA_BOOST] = ACT_LAVA_BOOST,
[ACT_GETTING_BLOWN] = ACT_GETTING_BLOWN,
[ACT_THROWN_FORWARD] = ACT_THROWN_FORWARD,
[ACT_THROWN_BACKWARD] = ACT_THROWN_BACKWARD,
[ACT_WATER_IDLE] = ACT_WATER_IDLE,
[ACT_HOLD_WATER_IDLE] = ACT_HOLD_WATER_IDLE,
[ACT_WATER_ACTION_END] = ACT_WATER_ACTION_END,
[ACT_HOLD_WATER_ACTION_END] = ACT_HOLD_WATER_ACTION_END,
[ACT_DROWNING] = ACT_DROWNING,
[ACT_BACKWARD_WATER_KB] = ACT_BACKWARD_WATER_KB,
[ACT_FORWARD_WATER_KB] = ACT_FORWARD_WATER_KB,
[ACT_WATER_DEATH] = ACT_WATER_DEATH,
[ACT_WATER_SHOCKED] = ACT_WATER_SHOCKED,
[ACT_BREASTSTROKE] = ACT_BREASTSTROKE,
[ACT_SWIMMING_END] = ACT_SWIMMING_END,
[ACT_FLUTTER_KICK] = ACT_FLUTTER_KICK,
[ACT_HOLD_BREASTSTROKE] = ACT_HOLD_BREASTSTROKE,
[ACT_HOLD_SWIMMING_END] = ACT_HOLD_SWIMMING_END,
[ACT_HOLD_FLUTTER_KICK] = ACT_HOLD_FLUTTER_KICK,
[ACT_WATER_SHELL_SWIMMING] = ACT_WATER_SHELL_SWIMMING,
[ACT_WATER_THROW] = ACT_WATER_THROW,
[ACT_WATER_PUNCH] = ACT_WATER_PUNCH,
[ACT_WATER_PLUNGE] = ACT_WATER_PLUNGE,
[ACT_CAUGHT_IN_WHIRLPOOL] = ACT_CAUGHT_IN_WHIRLPOOL,
[ACT_METAL_WATER_STANDING] = ACT_METAL_WATER_STANDING,
[ACT_HOLD_METAL_WATER_STANDING] = ACT_HOLD_METAL_WATER_STANDING,
[ACT_METAL_WATER_WALKING] = ACT_METAL_WATER_WALKING,
[ACT_HOLD_METAL_WATER_WALKING] = ACT_HOLD_METAL_WATER_WALKING,
[ACT_METAL_WATER_FALLING] = ACT_METAL_WATER_FALLING,
[ACT_HOLD_METAL_WATER_FALLING] = ACT_HOLD_METAL_WATER_FALLING,
[ACT_METAL_WATER_FALL_LAND] = ACT_METAL_WATER_FALL_LAND,
[ACT_HOLD_METAL_WATER_FALL_LAND] = ACT_HOLD_METAL_WATER_FALL_LAND,
[ACT_METAL_WATER_JUMP] = ACT_METAL_WATER_JUMP,
[ACT_HOLD_METAL_WATER_JUMP] = ACT_HOLD_METAL_WATER_JUMP,
[ACT_METAL_WATER_JUMP_LAND] = ACT_METAL_WATER_JUMP_LAND,
[ACT_HOLD_METAL_WATER_JUMP_LAND] = ACT_HOLD_METAL_WATER_JUMP_LAND,
[ACT_DISAPPEARED] = ACT_DISAPPEARED,
[ACT_INTRO_CUTSCENE] = ACT_INTRO_CUTSCENE,
[ACT_STAR_DANCE_EXIT] = ACT_STAR_DANCE_EXIT,
[ACT_STAR_DANCE_WATER] = ACT_STAR_DANCE_WATER,
[ACT_FALL_AFTER_STAR_GRAB] = ACT_FALL_AFTER_STAR_GRAB,
[ACT_READING_AUTOMATIC_DIALOG] = ACT_READING_AUTOMATIC_DIALOG,
[ACT_READING_NPC_DIALOG] = ACT_READING_NPC_DIALOG,
[ACT_STAR_DANCE_NO_EXIT] = ACT_STAR_DANCE_NO_EXIT,
[ACT_READING_SIGN] = ACT_READING_SIGN,
[ACT_JUMBO_STAR_CUTSCENE] = ACT_JUMBO_STAR_CUTSCENE,
[ACT_WAITING_FOR_DIALOG] = ACT_WAITING_FOR_DIALOG,
[ACT_DEBUG_FREE_MOVE] = ACT_DEBUG_FREE_MOVE,
[ACT_STANDING_DEATH] = ACT_STANDING_DEATH,
[ACT_QUICKSAND_DEATH] = ACT_QUICKSAND_DEATH,
[ACT_ELECTROCUTION] = ACT_ELECTROCUTION,
[ACT_SUFFOCATION] = ACT_SUFFOCATION,
[ACT_DEATH_ON_STOMACH] = ACT_DEATH_ON_STOMACH,
[ACT_DEATH_ON_BACK] = ACT_DEATH_ON_BACK,
[ACT_EATEN_BY_BUBBA] = ACT_EATEN_BY_BUBBA,
[ACT_END_PEACH_CUTSCENE] = ACT_END_PEACH_CUTSCENE,
[ACT_CREDITS_CUTSCENE] = ACT_CREDITS_CUTSCENE,
[ACT_END_WAVING_CUTSCENE] = ACT_END_WAVING_CUTSCENE,
[ACT_PULLING_DOOR] = ACT_PULLING_DOOR,
[ACT_PUSHING_DOOR] = ACT_PUSHING_DOOR,
[ACT_WARP_DOOR_SPAWN] = ACT_WARP_DOOR_SPAWN,
[ACT_EMERGE_FROM_PIPE] = ACT_EMERGE_FROM_PIPE,
[ACT_SPAWN_SPIN_AIRBORNE] = ACT_SPAWN_SPIN_AIRBORNE,
[ACT_SPAWN_SPIN_LANDING] = ACT_SPAWN_SPIN_LANDING,
[ACT_EXIT_AIRBORNE] = ACT_EXIT_AIRBORNE,
[ACT_EXIT_LAND_SAVE_DIALOG] = ACT_EXIT_LAND_SAVE_DIALOG,
[ACT_DEATH_EXIT] = ACT_DEATH_EXIT,
[ACT_UNUSED_DEATH_EXIT] = ACT_UNUSED_DEATH_EXIT,
[ACT_FALLING_DEATH_EXIT] = ACT_FALLING_DEATH_EXIT,
[ACT_SPECIAL_EXIT_AIRBORNE] = ACT_SPECIAL_EXIT_AIRBORNE,
[ACT_SPECIAL_DEATH_EXIT] = ACT_SPECIAL_DEATH_EXIT,
[ACT_FALLING_EXIT_AIRBORNE] = ACT_FALLING_EXIT_AIRBORNE,
[ACT_UNLOCKING_KEY_DOOR] = ACT_UNLOCKING_KEY_DOOR,
[ACT_UNLOCKING_STAR_DOOR] = ACT_UNLOCKING_STAR_DOOR,
[ACT_ENTERING_STAR_DOOR] = ACT_ENTERING_STAR_DOOR,
[ACT_SPAWN_NO_SPIN_AIRBORNE] = ACT_SPAWN_NO_SPIN_AIRBORNE,
[ACT_SPAWN_NO_SPIN_LANDING] = ACT_SPAWN_NO_SPIN_LANDING,
[ACT_BBH_ENTER_JUMP] = ACT_BBH_ENTER_JUMP,
[ACT_BBH_ENTER_SPIN] = ACT_BBH_ENTER_SPIN,
[ACT_TELEPORT_FADE_OUT] = ACT_TELEPORT_FADE_OUT,
[ACT_TELEPORT_FADE_IN] = ACT_TELEPORT_FADE_IN,
[ACT_SHOCKED] = ACT_SHOCKED,
[ACT_SQUISHED] = ACT_SQUISHED,
[ACT_HEAD_STUCK_IN_GROUND] = ACT_HEAD_STUCK_IN_GROUND,
[ACT_BUTT_STUCK_IN_GROUND] = ACT_BUTT_STUCK_IN_GROUND,
[ACT_FEET_STUCK_IN_GROUND] = ACT_FEET_STUCK_IN_GROUND,
[ACT_PUTTING_ON_CAP] = ACT_PUTTING_ON_CAP,
[ACT_HOLDING_POLE] = ACT_HOLDING_POLE,
[ACT_GRAB_POLE_SLOW] = ACT_GRAB_POLE_SLOW,
[ACT_GRAB_POLE_FAST] = ACT_GRAB_POLE_FAST,
[ACT_CLIMBING_POLE] = ACT_CLIMBING_POLE,
[ACT_TOP_OF_POLE_TRANSITION] = ACT_TOP_OF_POLE_TRANSITION,
[ACT_TOP_OF_POLE] = ACT_TOP_OF_POLE,
[ACT_START_HANGING] = ACT_START_HANGING,
[ACT_HANGING] = ACT_HANGING,
[ACT_HANG_MOVING] = ACT_HANG_MOVING,
[ACT_LEDGE_GRAB] = ACT_LEDGE_GRAB,
[ACT_LEDGE_CLIMB_SLOW_1] = ACT_LEDGE_CLIMB_SLOW_1,
[ACT_LEDGE_CLIMB_SLOW_2] = ACT_LEDGE_CLIMB_SLOW_2,
[ACT_LEDGE_CLIMB_DOWN] = ACT_LEDGE_CLIMB_DOWN,
[ACT_LEDGE_CLIMB_FAST] = ACT_LEDGE_CLIMB_FAST,
[ACT_GRABBED] = ACT_GRABBED,
[ACT_IN_CANNON] = ACT_IN_CANNON,
[ACT_TORNADO_TWIRLING] = ACT_TORNADO_TWIRLING,
[ACT_BUBBLED] = ACT_BUBBLED,
[ACT_PUNCHING] = ACT_PUNCHING,
[ACT_PICKING_UP] = ACT_PICKING_UP,
[ACT_DIVE_PICKING_UP] = ACT_DIVE_PICKING_UP,
[ACT_STOMACH_SLIDE_STOP] = ACT_STOMACH_SLIDE_STOP,
[ACT_PLACING_DOWN] = ACT_PLACING_DOWN,
[ACT_THROWING] = ACT_THROWING,
[ACT_HEAVY_THROW] = ACT_HEAVY_THROW,
[ACT_PICKING_UP_BOWSER] = ACT_PICKING_UP_BOWSER,
[ACT_HOLDING_BOWSER] = ACT_HOLDING_BOWSER,
[ACT_RELEASING_BOWSER] = ACT_RELEASING_BOWSER,
}
---@param m MarioState
function is_mario_in_vanilla_action(m)
return defaultActions[m.action] ~= nil
end
-- Lazy automation of interpolation on HUD elements
local interpTable = {}
function djui_set_interpolation(index, x, y, width, height)
interpTable[index] = {
x = x,
y = y,
width = width,
height = height
}
end
function djui_get_interpolation(index, backUpX, backUpY, backUpWidth, backUpHeight)
return interpTable[index] or {x = backUpX or 0, y = backUpY or 0, width = backUpWidth or 0, height = backUpHeight or 0}
end
function djui_hud_print_text_auto_interpolated(index, message, x, y, scale)
local interp = djui_get_interpolation(index, x, y, scale, nil)
djui_hud_print_text_interpolated(message, interp.x, interp.y, interp.width, x, y, scale)
djui_set_interpolation(index, x, y, scale, nil)
end
function djui_hud_render_texture_auto_interpolated(index, texture, x, y, width, height)
local interp = djui_get_interpolation(index, x, y, width, height)
djui_hud_render_texture_interpolated(texture, interp.x, interp.y, interp.width, interp.height, x, y, width, height)
djui_set_interpolation(index, x, y, width, height)
end
local hasBeenLogged = {}
---@param message string
---@param level ConsoleMessageLevel
function log_to_console_once(message, level)
if not hasBeenLogged[message] then
hasBeenLogged[message] = true
log_to_console("Character Select: "..message, level)
end
end
function is_power_of_two(n)
return (n & (n - 1)) == 0
end
---@param tex TextureInfo
function is_texture_valid(tex)
if tex ~= nil then
return is_power_of_two(tex.width) and is_power_of_two(tex.height)
else
return false
end
end
function run_func_or_get_var(x, ...)
if type(x) == "function" then
return x(...)
else
return x
end
end
---@param x integer
function mirror_mode_number(x)
if _G.mirrorMode ~= nil and _G.mirrorMode.is_mirrored() then
return x * -1
end
return x
end
---@param str1 string
---@param str2 string
local function levenshtein_distance(str1, str2)
local len1 = #str1
local len2 = #str2
local matrix = {}
for i = 0, len1 do
matrix[i] = {}
matrix[i][0] = i
end
for j = 0, len2 do
matrix[0][j] = j
end
for i = 1, len1 do
for j = 1, len2 do
local cost = (str1:sub(i, i) == str2:sub(j, j)) and 0 or 1
local del = matrix[i-1][j] + 1
local ins = matrix[i][j-1] + 1
local sub = matrix[i-1][j-1] + cost
matrix[i][j] = math.min(del, ins, sub)
end
end
return matrix[len1][len2]
end
---@param str1 string
---@param str2 string
-- Compares two strings and returns simularity (0-1)
function string_sim(str1, str2)
local distance = levenshtein_distance(str1, str2)
local maxLength = math.max(#str1, #str2)
if maxLength == 0 then return 1 end
return (distance / maxLength)
end

File diff suppressed because it is too large Load diff

View file

@ -1,222 +1,54 @@
if incompatibleClient then return 0 end
-- Original Made by EliteMasterEric along with CoopDX PR #321 to replace dialog depending on character --
-- https://github.com/coop-deluxe/sm64coopdx/pull/321 --
-- Eric's Original stuffs will be added as soon as there is some way to directly get dialog strings
DEFAULT_DIALOG_NAME = "Mario"
local dialogTable = {}
local function define_cs_dialog(dialogId, unused, linesPerBox, leftOffset, width, str)
dialogTable[dialogId] = {
unused = unused,
linesPerBox = linesPerBox,
leftOffset = leftOffset,
width = width,
str = str,
}
end
local ogDialog = {}
local real_dialog_replace = smlua_text_utils_dialog_replace
_G.smlua_text_utils_dialog_replace = define_cs_dialog
-- All Base SM64 Dialog added to the Dialog Table
define_cs_dialog(DIALOG_000, 1, 6, 30, 200, ("Wow! You're smack in the\nmiddle of the battlefield.\nYou'll find the Power\nStars that Bowser stole\ninside the painting\nworlds.\nFirst, talk to the\nBob-omb Buddy. (Press [B]\nto talk.) He'll certainly\nhelp you out, and so will\nhis comrades in other\nareas.\nTo read signs, stop, face\nthem and press [B]. Press [A]\nor [B] to scroll ahead. You\ncan talk to some other\ncharacters by facing them\nand pressing [B]."))
define_cs_dialog(DIALOG_001, 1, 4, 95, 200, ("Watch out! If you wander\naround here, you're liable\nto be plastered by a\nwater bomb!\nThose enemy Bob-ombs love\nto fight, and they're\nalways finding ways to\nattack.\nThis meadow has become\na battlefield ever since\nthe Big Bob-omb got his\npaws on the Power Star.\nCan you recover the Star\nfor us? Cross the bridge\nand go left up the path\nto find the Big Bob-omb.\nPlease come back to see\nme after you've retrieved\nthe Power Star!"))
define_cs_dialog(DIALOG_002, 1, 4, 95, 200, ("Hey, you! It's dangerous\nahead, so listen up! Take\nmy advice.\n\nCross the two\nbridges ahead, then\nwatch for falling\nwater bombs.\nThe Big Bob-omb at the\ntop of the mountain is\nvery powerful--don't let\nhim grab you!\nWe're Bob-omb Buddies,\nand we're on your side.\nYou can talk to us\nwhenever you'd like to!"))
define_cs_dialog(DIALOG_003, 1, 5, 95, 200, ("Thank you, Mario! The Big\nBob-omb is nothing but a\nbig dud now! But the\nbattle for the castle has\njust begun.\nOther enemies are holding\nthe other Power Stars. If\nyou recover more Stars,\nyou can open new doors\nthat lead to new worlds!\nMy Bob-omb Buddies are\nwaiting for you. Be sure\nto talk to them--they'll\nset up cannons for you."))
define_cs_dialog(DIALOG_004, 1, 3, 95, 200, ("We're peace-loving\nBob-ombs, so we don't use\ncannons.\nBut if you'd like\nto blast off, we don't\nmind. Help yourself.\nWe'll prepare all of the\ncannons in this course for\nyou to use. Bon Voyage!"))
define_cs_dialog(DIALOG_005, 1, 3, 30, 200, ("Hey, Mario! Is it true\nthat you beat the Big\nBob-omb? Cool!\nYou must be strong. And\npretty fast. So, how fast\nare you, anyway?\nFast enough to beat me...\nKoopa the Quick? I don't\nthink so. Just try me.\nHow about a race to the\nmountaintop, where the\nBig Bob-omb was?\nWhaddya say? When I say\n『Go,』 let the race begin!\n\nReady....\n\n//Go!////Don't Go"))
define_cs_dialog(DIALOG_006, 1, 3, 30, 200, ("Hey!!! Don't try to scam\nME. You've gotta run\nthe whole course.\nLater. Look me up when\nyou want to race for\nreal."))
define_cs_dialog(DIALOG_007, 1, 5, 30, 200, ("Hufff...fff...pufff...\nWhoa! You...really...are...\nfast! A human blur!\nHere you go--you've won\nit, fair and square!"))
define_cs_dialog(DIALOG_008, 1, 4, 30, 200, ("BEWARE OF CHAIN CHOMP\nExtreme Danger!\nGet close and press [C]▲\nfor a better look.\nScary, huh?\nSee the Red Coin on top\nof the stake?\n\nWhen you collect eight of\nthem, a Power Star will\nappear in the meadow\nacross the bridge."))
define_cs_dialog(DIALOG_009, 1, 5, 30, 200, ("Long time, no see! Wow,\nhave you gotten fast!\nHave you been training\non the sly, or is it the\npower of the Stars?\nI've been feeling down\nabout losing the last\nrace. This is my home\ncourse--how about a\nrematch?\nThe goal is in\nWindswept Valley.\nReady?\n\n//Go//// Don't Go"))
define_cs_dialog(DIALOG_010, 1, 4, 30, 200, ("You've stepped on the\nWing Cap Switch. Wearing\nthe Wing Cap, you can\nsoar through the sky.\nNow Wing Caps will pop\nout of all the red blocks\nyou find.\n\nWould you like to Save?\n\n//Yes////No"))
define_cs_dialog(DIALOG_011, 1, 4, 30, 200, ("You've just stepped on\nthe Metal Cap Switch!\nThe Metal Cap makes\nMario invincible.\nNow Metal Caps will\npop out of all of the\ngreen blocks you find.\n\nWould you like to Save?\n\n//Yes////No"))
define_cs_dialog(DIALOG_012, 1, 4, 30, 200, ("You've just stepped on\nthe Vanish Cap Switch.\nThe Vanish Cap makes\nMario disappear.\nNow Vanish Caps will pop\nfrom all of the blue\nblocks you find.\n\nWould you like to Save?\n\n//Yes////No"))
define_cs_dialog(DIALOG_013, 1, 5, 30, 200, ("You've collected 100\ncoins! Mario gains more\npower from the castle.\nDo you want to Save?\n//Yes////No"))
define_cs_dialog(DIALOG_014, 1, 4, 30, 200, ("Wow! Another Power Star!\nMario gains more courage\nfrom the power of the\ncastle.\nDo you want to Save?\n\n//You Bet//Not Now"))
define_cs_dialog(DIALOG_015, 1, 4, 30, 200, ("You can punch enemies to\nknock them down. Press [A]\nto jump, [B] to punch.\nPress [A] then [B] to Kick.\nTo pick something up,\npress [B], too. To throw\nsomething you're holding,\npress [B] again."))
define_cs_dialog(DIALOG_016, 1, 3, 30, 200, ("Hop on the shiny shell and\nride wherever you want to\ngo! Shred those enemies!"))
define_cs_dialog(DIALOG_017, 1, 4, 30, 200, ("I'm the Big Bob-omb, lord\nof all blasting matter,\nking of ka-booms the\nworld over!\nHow dare you scale my\nmountain? By what right\ndo you set foot on my\nimperial mountaintop?\nYou may have eluded my\nguards, but you'll never\nescape my grasp...\n\n...and you'll never take\naway my Power Star. I\nhereby challenge you,\nMario!\nIf you want the Star I\nhold, you must prove\nyourself in battle.\n\nCan you pick me up from\nthe back and hurl me to\nthis royal turf? I think\nthat you cannot!"))
define_cs_dialog(DIALOG_018, 1, 4, 30, 200, ("I'm sleeping because...\n...I'm sleepy. I don't\nlike being disturbed.\nPlease walk quietly."))
define_cs_dialog(DIALOG_019, 1, 2, 30, 200, ("Shhh! Please walk\nquietly in the hallway!"))
define_cs_dialog(DIALOG_020, 1, 6, 95, 150, ("Dear Mario:\nPlease come to the\ncastle. I've baked\na cake for you.\nYours truly--\nPrincess Toadstool"))
define_cs_dialog(DIALOG_021, 1, 5, 95, 200, ("Welcome.\nNo one's home!\nNow scram--\nand don't come back!\nGwa ha ha!"))
define_cs_dialog(DIALOG_022, 1, 2, 95, 200, ("You need a key to open\nthis door."))
define_cs_dialog(DIALOG_023, 1, 3, 95, 200, ("This key doesn't fit!\nMaybe it's for the\nbasement..."))
define_cs_dialog(DIALOG_024, 1, 5, 95, 200, ("You need Star power to\nopen this door. Recover a\nPower Star from an enemy\ninside one of the castle's\npaintings."))
define_cs_dialog(DIALOG_025, 1, 4, 95, 200, ("It takes the power of\n3 Stars to open this\ndoor. You need [%] more\nStars."))
define_cs_dialog(DIALOG_026, 1, 4, 95, 200, ("It takes the power of\n8 Stars to open this\ndoor. You need [%] more\nStars."))
define_cs_dialog(DIALOG_027, 1, 4, 95, 200, ("It takes the power of\n30 Stars to open this\ndoor. You need [%] more\nStars."))
define_cs_dialog(DIALOG_028, 1, 4, 95, 200, ("It takes the power of\n50 Stars to open this\ndoor. You need [%] more\nStars."))
define_cs_dialog(DIALOG_029, 1, 5, 95, 200, ("To open the door that\nleads to the 『endless』\nstairs, you need 70\nStars.\nBwa ha ha!"))
define_cs_dialog(DIALOG_030, 1, 6, 30, 200, ("Hello! The Lakitu Bros.,\ncutting in with a live\nupdate on Mario's\nprogress. He's about to\nlearn a technique for\nsneaking up on enemies.\nThe trick is this: He has\nto walk very slowly in\norder to walk quietly.\n\n\n\nAnd wrapping up filming\ntechniques reported on\nearlier, you can take a\nlook around using [C]▶ and\n[C]◀. Press [C]▼ to view the\naction from a distance.\nWhen you can't move the\ncamera any farther, the\nbuzzer will sound. This is\nthe Lakitu Bros.,\nsigning off."))
define_cs_dialog(DIALOG_031, 1, 5, 30, 200, ("No way! You beat me...\nagain!! And I just spent\nmy entire savings on\nthese new Koopa\nMach 1 Sprint shoes!\nHere, I guess I have to\nhand over this Star to\nthe winner of the race.\nCongrats, Mario!"))
define_cs_dialog(DIALOG_032, 1, 5, 30, 200, ("If you get the Wing Cap,\nyou can fly! Put the cap\non, then do a Triple\nJump--jump three times\nin a row--to take off.\nYou can fly even higher\nif you blast out of a\ncannon wearing the\nWing Cap!\n\nUse the [C] Buttons to look\naround while flying, and\npress [Z] to land."))
define_cs_dialog(DIALOG_033, 1, 6, 30, 200, ("Ciao! You've reached\nPrincess Toadstool's\ncastle via a warp pipe.\nUsing the controller is a\npiece of cake. Press [A] to\njump and [B] to attack.\nPress [B] to read signs,\ntoo. Use the Control Stick\nin the center of the\ncontroller to move Mario\naround. Now, head for\nthe castle."))
define_cs_dialog(DIALOG_034, 1, 6, 30, 200, ("Good afternoon. The\nLakitu Bros., here,\nreporting live from just\noutside the Princess's\ncastle.\n\nMario has just arrived\non the scene, and we'll\nbe filming the action live\nas he enters the castle\nand pursues the missing\nPower Stars.\nAs seasoned cameramen,\nwe'll be shooting from the\nrecommended angle, but\nyou can change the\ncamera angle by pressing\nthe [C] Buttons.\nIf we can't adjust the\nview any further, we'll\nbuzz. To take a look at\nthe surroundings, stop\nand press [C]▲.\n\nPress [A] to resume play.\nSwitch camera modes with\nthe [R] Button. Signs along\nthe way will review these\ninstructions.\n\nFor now, reporting live,\nthis has been the\nLakitu Bros."))
define_cs_dialog(DIALOG_035, 1, 5, 30, 200, ("There are four camera, or\n『[C],』 Buttons. Press [C]▲\nto look around using the\nControl Stick.\n\nYou'll usually see Mario\nthrough Lakitu's camera.\nIt is the camera\nrecommended for normal\nplay.\nYou can change angles by\npressing [C]▶. If you press\n[R], the view switches to\nMario's camera, which\nis directly behind him.\nPress [R] again to return\nto Lakitu's camera. Press\n[C]▼ to see Mario from\nafar, using either\nLakitu's or Mario's view."))
define_cs_dialog(DIALOG_036, 1, 5, 30, 200, ("OBSERVATION PLATFORM\nPress [C]▲ to take a look\naround. Don't miss\nanything!\n\nPress [R] to switch to\nMario's camera. It\nalways follows Mario.\nPress [R] again to switch\nto Lakitu's camera.\nPause the game and\nswitch the mode to 『fix』\nthe camera in place while\nholding [R]. Give it a try!"))
define_cs_dialog(DIALOG_037, 1, 2, 30, 200, ("I win! You lose!\nHa ha ha ha!\nYou're no slouch, but I'm\na better sledder!\nBetter luck next time!"))
define_cs_dialog(DIALOG_038, 1, 3, 95, 200, ("Reacting to the Star\npower, the door slowly\nopens."))
define_cs_dialog(DIALOG_039, 1, 4, 30, 200, ("No visitors allowed,\nby decree of\nthe Big Bob-omb\n\nI shall never surrender my\nStars, for they hold the\npower of the castle in\ntheir glow.\nThey were a gift from\nBowser, the Koopa King\nhimself, and they lie well\nhidden within my realm.\nNot a whisper of their\nwhereabouts shall leave\nmy lips. Oh, all right,\nperhaps one hint:\nHeed the Star names at\nthe beginning of the\ncourse.\n//--The Big Bob-omb"))
define_cs_dialog(DIALOG_040, 1, 3, 30, 200, ("Warning!\nCold, Cold Crevasse\nBelow!"))
define_cs_dialog(DIALOG_041, 1, 3, 30, 200, ("I win! You lose!\nHa ha ha!\n\nThat's what you get for\nmessin' with Koopa the\nQuick.\nBetter luck next time!"))
define_cs_dialog(DIALOG_042, 1, 4, 30, 200, ("Caution! Narrow Bridge!\nCross slowly!\n\n\nYou can jump to the edge\nof the cliff and hang on,\nand you can climb off the\nedge if you move slowly.\nWhen you want to let go,\neither press [Z] or press\nthe Control Stick in the\ndirection of Mario's back.\nTo climb up, press Up on\nthe Control Stick. To\nscurry up quickly, press\nthe [A] Button."))
define_cs_dialog(DIALOG_043, 1, 5, 30, 200, ("If you jump and hold the\n[A] Button, you can hang on\nto some objects overhead.\nIt's the same as grabbing\na flying bird!"))
define_cs_dialog(DIALOG_044, 1, 5, 95, 200, ("Whooo's there? Whooo\nwoke me up? It's still\ndaylight--I should be\nsleeping!\n\nHey, as long as I'm\nawake, why not take a\nshort flight with me?\nPress and hold [A] to grab\non. Release [A] to let go.\nI'll take you wherever\nyou want to go, as long\nas my wings hold out.\nWatch my shadow, and\ngrab on."))
define_cs_dialog(DIALOG_045, 1, 6, 95, 200, ("Whew! I'm just about\nflapped out. You should\nlay off the pasta, Mario!\nThat's it for now. Press\n[A] to let go. Okay,\nbye byyyyyyeeee!"))
define_cs_dialog(DIALOG_046, 1, 5, 30, 200, ("You have to master three\nimportant jumping\ntechniques.\nFirst try the Triple Jump.\n\nRun fast, then jump three\ntimes, one, two, three.\nIf you time the jumps\nright, you'll hop, skip,\nthen jump really high.\nNext, go for distance\nwith the Long Jump. Run,\npress [Z] to crouch then [A]\nto jump really far.\n\nTo do the Wall Kick, press\n[A] to jump at a wall, then\njump again when you hit\nthe wall.\n\nGot that? Triple Jump,\nLong Jump, Wall Kick.\nPractice, practice,\npractice. You don't stand\na chance without them."))
define_cs_dialog(DIALOG_047, 1, 2, 95, 200, ("Hi! I'll prepare the\ncannon for you!"))
define_cs_dialog(DIALOG_048, 1, 4, 30, 200, ("Snow Mountain Summit\nWatch for slippery\nconditions! Please enter\nthe cottage first."))
define_cs_dialog(DIALOG_049, 1, 5, 30, 200, ("Remember that tricky Wall\nKick jump? It's a\ntechnique you'll have to\nmaster in order to reach\nhigh places.\nUse it to jump from wall\nto wall. Press the\nControl Stick in the\ndirection you want to\nbounce to gain momentum.\nPractice makes perfect!"))
define_cs_dialog(DIALOG_050, 1, 4, 30, 200, ("Hold [Z] to crouch and\nslide down a slope.\nOr press [Z] while in the\nair to Pound the Ground!\nIf you stop, crouch, then\njump, you'll do a\nBackward Somersault!\nGot that?\nThere's more. Crouch and\nthen jump to do a\nLong Jump! Or crouch and\nwalk to...never mind."))
define_cs_dialog(DIALOG_051, 1, 6, 30, 200, ("Climbing's easy! When you\njump at trees, poles or\npillars, you'll grab them\nautomatically. Press [A] to\njump off backward.\n\nTo rotate around the\nobject, press Right or\nLeft on the Control Stick.\nWhen you reach the top,\npress Up to do a\nhandstand!\nJump off from the\nhandstand for a high,\nstylin' dismount."))
define_cs_dialog(DIALOG_052, 1, 5, 30, 200, ("Stop and press [Z] to\ncrouch, then press [A]\nto do a high, Backward\nSomersault!\n\nTo perform a Side\nSomersault, run, do a\nsharp U-turn and jump.\nYou can catch lots of\nair with both jumps."))
define_cs_dialog(DIALOG_053, 1, 5, 30, 200, ("Sometimes, if you pass\nthrough a coin ring or\nfind a secret point in a\ncourse, a red number will\nappear.\nIf you trigger five red\nnumbers, a secret Star\nwill show up."))
define_cs_dialog(DIALOG_054, 1, 5, 30, 200, ("Welcome to the snow\nslide! Hop on! To speed\nup, press forward on the\nControl Stick. To slow\ndown, pull back."))
define_cs_dialog(DIALOG_055, 1, 4, 30, 200, ("Hey-ey, Mario, buddy,\nhowzit goin'? Step right\nup. You look like a fast\nsleddin' kind of guy.\nI know speed when I see\nit, yes siree--I'm the\nworld champion sledder,\nyou know. Whaddya say?\nHow about a race?\nReady...\n\n//Go//// Don't Go"))
define_cs_dialog(DIALOG_056, 1, 6, 30, 200, ("You brrrr-oke my record!\nUnbelievable! I knew\nthat you were the coolest.\nNow you've proven\nthat you're also the\nfastest!\nI can't award you a gold\nmedal, but here, take this\nStar instead. You've\nearned it!"))
define_cs_dialog(DIALOG_057, 1, 4, 30, 200, ("Egad! My baby!! Have you\nseen my baby??? She's\nthe most precious baby in\nthe whole wide world.\n(They say she has my\nbeak...) I just can't\nremember where I left\nher.\nLet's see...I stopped\nfor herring and ice cubes,\nthen I...oohh! I just\ndon't know!"))
define_cs_dialog(DIALOG_058, 1, 4, 30, 200, ("You found my precious,\nprecious baby! Where\nhave you been? How can\nI ever thank you, Mario?\nOh, I do have this...\n...Star. Here, take it\nwith my eternal\ngratitude."))
define_cs_dialog(DIALOG_059, 1, 4, 30, 200, ("That's not my baby! She\nlooks nothing like me!\nHer parents must be\nworried sick!"))
define_cs_dialog(DIALOG_060, 1, 4, 30, 200, ("ATTENTION!\nRead Before Diving In!\n\n\nIf you stay under the\nwater for too long, you'll\nrun out of oxygen.\n\nReturn to the surface for\nair or find an air bubble\nor coins to breathe while\nunderwater.\nPress [A] to swim. Hold [A]\nto swim slow and steady.\nTap [A] with smooth timing\nto gain speed.\nPress Up on the\nControl Stick and press [A]\nto dive.\n\nPress Down on the Control\nStick and press [A] to\nreturn to the surface.\n\nHold Down and press [A]\nwhile on the surface near\nthe edge of the water to\njump out."))
define_cs_dialog(DIALOG_061, 1, 4, 30, 200, ("BRRR! Frostbite Danger!\nDo not swim here.\nI'm serious.\n/--The Penguin"))
define_cs_dialog(DIALOG_062, 1, 3, 30, 200, ("Hidden inside the green\nblock is the amazing\nMetal Cap.\nWearing it, you won't\ncatch fire or be hurt\nby enemy attacks.\nYou don't even have to\nbreathe while wearing it.\n\nThe only problem:\nYou can't swim in it."))
define_cs_dialog(DIALOG_063, 1, 5, 30, 200, ("The Vanish Cap is inside\nthe blue block. Mr. I.\nwill be surprised, since\nyou'll be invisible when\nyou wear it!\nEven the Big Boo will be\nfooled--and you can walk\nthrough secret walls, too."))
define_cs_dialog(DIALOG_064, 1, 5, 30, 200, ("When you put on the Wing\nCap that comes from a\nred block, do the Triple\nJump to soar high into\nthe sky.\nUse the Control Stick to\nguide Mario. Pull back to\nto fly up, press forward\nto nose down, and press [Z]\nto land."))
define_cs_dialog(DIALOG_065, 1, 6, 30, 200, ("Swimming Lessons!\nTap [A] to do the breast\nstroke. If you time the\ntaps right, you'll swim\nfast.\n\nPress and hold [A] to do a\nslow, steady flutter kick.\nPress Up on the Control\nStick to dive, and pull\nback on the stick to head\nfor the surface.\nTo jump out of the water,\nhold Down on the Control\nStick, then press [A].\nEasy as pie, right?\n\n\nBut remember:\nMario can't breathe under\nthe water! Return to the\nsurface for air when the\nPower Meter runs low.\n\nAnd one last thing: You\ncan't open doors that\nare underwater."))
define_cs_dialog(DIALOG_066, 1, 5, 30, 200, ("Mario, it's Peach!\nPlease be careful! Bowser\nis so wicked! He will try\nto burn you with his\nhorrible flame breath.\nRun around behind and\ngrab him by the tail with\nthe [B] Button. Once you\ngrab hold, swing him\naround in great circles.\nRotate the Control Stick\nto go faster and faster.\nThe faster you swing him,\nthe farther he'll fly.\n\nUse the [C] Buttons to look\naround, Mario. You have\nto throw Bowser into one\nof the bombs in the four\ncorners.\nAim well, then press [B]\nagain to launch Bowser.\nGood luck, Mario! Our\nfate is in your hands."))
define_cs_dialog(DIALOG_067, 1, 5, 30, 200, ("Tough luck, Mario!\nPrincess Toadstool isn't\nhere...Gwa ha ha!! Go\nahead--just try to grab\nme by the tail!\nYou'll never be able to\nswing ME around! A wimp\nlike you won't throw me\nout of here! Never! Ha!"))
define_cs_dialog(DIALOG_068, 1, 5, 30, 200, ("It's Lethal Lava Land!\nIf you catch fire or fall\ninto a pool of flames,\nyou'll be hopping mad, but\ndon't lose your cool.\nYou can still control\nMario--just try to keep\ncalm!"))
define_cs_dialog(DIALOG_069, 1, 6, 30, 200, ("Sometimes you'll bump into\ninvisible walls at the\nedges of the painting\nworlds. If you hit a wall\nwhile flying, you'll bounce\nback."))
define_cs_dialog(DIALOG_070, 1, 5, 30, 200, ("You can return to the\ncastle's main hall at any\ntime from the painting\nworlds where the enemies\nlive.\nJust stop, stand still,\npress Start to pause the\ngame, then select\n『Exit Course.』\n\nYou don't have to collect\nall Power Stars in one\ncourse before going on to\nthe next.\n\nReturn later, when you're\nmore experienced, to pick\nup difficult ones.\n\n\nWhenever you find a Star,\na hint for finding the\nnext one will appear on\nthe course's start screen.\n\nYou can, however, collect\nany of the remaining\nStars next. You don't\nhave to recover the one\ndescribed by the hint."))
define_cs_dialog(DIALOG_071, 1, 3, 30, 200, ("Danger Ahead!\nBeware of the strange\ncloud! Don't inhale!\nIf you feel faint, run for\nhigher ground and fresh\nair!\nCircle: Shelter\nArrow: Entrance-Exit"))
define_cs_dialog(DIALOG_072, 1, 5, 30, 200, ("High winds ahead!\nPull your Cap down tight.\nIf it blows off, you'll\nhave to find it on this\nmountain."))
define_cs_dialog(DIALOG_073, 1, 4, 95, 200, ("Aarrgh! Ahoy, matey. I\nhave sunken treasure,\nhere, I do.\n\nBut to pluck the plunder,\nyou must open the\nTreasure Chests in the\nright order.\nWhat order is that,\nye say?\n\n\nI'll never tell!\n\n//--The Cap'n"))
define_cs_dialog(DIALOG_074, 1, 5, 30, 200, ("You can grab on to the\nedge of a cliff or ledge\nwith your fingertips and\nhang down from it.\n\nTo drop from the edge,\neither press the Control\nStick in the direction of\nMario's back or press the\n[Z] Button.\nTo get up onto the ledge,\neither press Up on the\nControl Stick or press [A]\nas soon as you grab the\nledge to climb up quickly."))
define_cs_dialog(DIALOG_075, 1, 5, 30, 200, ("Mario!! My castle is in\ngreat peril. I know that\nBowser is the cause...and\nI know that only you can\nstop him!\nThe doors in the castle\nthat have been sealed by\nBowser can be opened only\nwith Star Power.\n\nBut there are secret\npaths in the castle,\npaths that Bowser hasn't\nfound.\n\nOne of those paths is in\nthis room, and it holds\none of the castle's Secret\nStars!\n\nFind that Secret Star,\nMario! It will help you\non your quest. Please,\nMario, you have to\nhelp us!\nRetrieve all of the\nPower Stars in the castle\nand free us from this\nawful prison!\nPlease!"))
define_cs_dialog(DIALOG_076, 1, 6, 30, 200, ("Thanks to the power of\nthe Stars, life is\nreturning to the castle.\nPlease, Mario, you have\nto give Bowser the boot!\n\nHere, let me tell you a\nlittle something about the\ncastle. In the room with\nthe mirrors, look carefully\nfor anything that's not\nreflected in the mirror.\nAnd when you go to the\nwater town, you can flood\nit with a high jump into\nthe painting. Oh, by the\nway, look what I found!"))
define_cs_dialog(DIALOG_077, 1, 2, 150, 200, ("It is decreed that one\nshall pound the pillars."))
define_cs_dialog(DIALOG_078, 1, 5, 30, 200, ("Break open the Blue Coin\nBlock by Pounding the\nGround with the [Z] Button.\nOne Blue Coin is worth\nfive Yellow Coins.\nBut you have to hurry!\nThe coins will disappear\nif you're not quick to\ncollect them! Too bad."))
define_cs_dialog(DIALOG_079, 1, 4, 30, 200, ("Owwwuu! Let me go!\nUukee-kee! I was only\nteasing! Can't you take\na joke?\nI'll tell you what, let's\ntrade. If you let me go,\nI'll give you something\nreally good.\nSo, how about it?\n\n//Free him/ Hold on"))
define_cs_dialog(DIALOG_080, 1, 1, 30, 200, ("Eeeh hee hee hee!"))
define_cs_dialog(DIALOG_081, 1, 4, 30, 200, ("The mystery is of Wet\nor Dry.\nAnd where does the\nsolution lie?\nThe city welcomes visitors\nwith the depth they bring\nas they enter."))
define_cs_dialog(DIALOG_082, 1, 4, 30, 200, ("Hold on to your hat! If\nyou lose it, you'll be\ninjured easily.\n\nIf you do lose your Cap,\nyou'll have to find it in\nthe course where you\nlost it.\nOh, boy, it's not looking\ngood for Peach. She's\nstill trapped somewhere\ninside the walls.\nPlease, Mario, you have\nto help her! Did you know\nthat there are enemy\nworlds inside the walls?\nYup. It's true. Bowser's\ntroops are there, too.\nOh, here, take this. I've\nbeen keeping it for you."))
define_cs_dialog(DIALOG_083, 1, 6, 30, 200, ("There's something strange\nabout that clock. As you\njump inside, watch the\nposition of the big hand.\nOh, look what I found!\nHere, Mario, catch!"))
define_cs_dialog(DIALOG_084, 1, 3, 30, 200, ("Yeeoww! Unhand me,\nbrute! I'm late, so late,\nI must make haste!\nThis shiny thing? Mine!\nIt's mine. Finders,\nkeepers, losers...\nLate, late, late...\nOuch! Take it then! A\ngift from Bowser, it was.\nNow let me be! I have a\ndate! I cannot be late\nfor tea!"))
define_cs_dialog(DIALOG_085, 1, 5, 30, 200, ("You don't stand a ghost\nof a chance in this house.\nIf you walk out of here,\nyou deserve...\n...a Ghoul Medal..."))
define_cs_dialog(DIALOG_086, 1, 3, 30, 200, ("Running around in circles\nmakes some bad guys roll\ntheir eyes."))
define_cs_dialog(DIALOG_087, 1, 4, 30, 200, ("Santa Claus isn't the only\none who can go down a\nchimney! Come on in!\n/--Cabin Proprietor"))
define_cs_dialog(DIALOG_088, 1, 5, 30, 200, ("Work Elevator\nFor those who get off\nhere: Grab the pole to the\nleft and slide carefully\ndown."))
define_cs_dialog(DIALOG_089, 1, 5, 95, 200, ("Both ways fraught with\ndanger! Watch your feet!\nThose who can't do the\nLong Jump, tsk, tsk. Make\nyour way to the right.\nRight: Work Elevator\n/// Cloudy Maze\nLeft: Black Hole\n///Underground Lake\n\nRed Circle: Elevator 2\n//// Underground Lake\nArrow: You are here"))
define_cs_dialog(DIALOG_090, 1, 6, 30, 200, ("Bwa ha ha ha!\nYou've stepped right into\nmy trap, just as I knew\nyou would! I warn you,\n" .. ' "Friend," ' .. "watch your\nstep!"))
define_cs_dialog(DIALOG_091, 2, 2, 30, 200, ("Danger!\nStrong Gusts!\nBut the wind makes a\ncomfy ride."))
define_cs_dialog(DIALOG_092, 1, 5, 30, 200, ("Pestering me again, are\nyou, Mario? Can't you see\nthat I'm having a merry\nlittle time, making\nmischief with my minions?\nNow, return those Stars!\nMy troops in the walls\nneed them! Bwa ha ha!"))
define_cs_dialog(DIALOG_093, 1, 5, 30, 200, ("Mario! You again! Well\nthat's just fine--I've\nbeen looking for something\nto fry with my fire\nbreath!\nYour Star Power is\nuseless against me!\nYour friends are all\ntrapped within the\nwalls...\nAnd you'll never see the\nPrincess again!\nBwa ha ha ha!"))
define_cs_dialog(DIALOG_094, 1, 4, 30, 200, ("Get a good run up the\nslope! Do you remember\nthe Long Jump? Run, press\n[Z], then jump!"))
define_cs_dialog(DIALOG_095, 1, 4, 30, 200, ("To read a sign, stand in\nfront of it and press [B],\nlike you did just now.\n\nWhen you want to talk to\na Koopa Troopa or other\nanimal, stand right in\nfront of it.\nPlease recover the Stars\nthat were stolen by\nBowser in this course."))
define_cs_dialog(DIALOG_096, 1, 4, 30, 200, ("The path is narrow here.\nEasy does it! No one is\nallowed on top of the\nmountain!\nAnd if you know what's\ngood for you, you won't\nwake anyone who's\nsleeping!\nMove slowly,\ntread lightly."))
define_cs_dialog(DIALOG_097, 1, 5, 30, 200, ("Don't be a pushover!\nIf anyone tries to shove\nyou around, push back!\nIt's one-on-one, with a\nfiery finish for the loser!"))
define_cs_dialog(DIALOG_098, 1, 2, 95, 200, ("Come on in here...\n...heh, heh, heh..."))
define_cs_dialog(DIALOG_099, 1, 5, 95, 200, ("Eh he he...\nYou're mine, now, hee hee!\nI'll pass right through\nthis wall. Can you do\nthat? Heh, heh, heh!")) -- unused
define_cs_dialog(DIALOG_100, 1, 3, 95, 200, ("Ukkiki...Wakkiki...kee kee!\nHa! I snagged it!\nIt's mine! Heeheeheeee!"))
define_cs_dialog(DIALOG_101, 1, 3, 95, 200, ("Ackk! Let...go...\nYou're...choking...me...\nCough...I've been framed!\nThis Cap? Oh, all right,\ntake it. It's a cool Cap,\nbut I'll give it back.\nI think it looks better on\nme than it does on you,\nthough! Eeeee! Kee keee!"))
define_cs_dialog(DIALOG_102, 1, 5, 30, 200, ("Pssst! The Boos are super\nshy. If you look them\nin the eyes, they fade\naway, but if you turn\nyour back, they reappear.\nIt's no use trying to hit\nthem when they're fading\naway. Instead, sneak up\nbehind them and punch."))
define_cs_dialog(DIALOG_103, 1, 4, 95, 200, ("Upon four towers\none must alight...\nThen at the peak\nshall shine the light..."))
define_cs_dialog(DIALOG_104, 1, 5, 30, 200, ("The shadowy star in front\nof you is a 『Star\nMarker.』 When you collect\nall 8 Red Coins, the Star\nwill appear here."))
define_cs_dialog(DIALOG_105, 1, 3, 95, 200, ("Ready for blastoff! Come\non, hop into the cannon!\n\nYou can reach the Star on\nthe floating island by\nusing the four cannons.\nUse the Control Stick to\naim, then press [A] to fire.\n\nIf you're handy, you can\ngrab on to trees or poles\nto land."))
define_cs_dialog(DIALOG_106, 1, 2, 95, 200, ("Ready for blastoff! Come\non, hop into the cannon!"))
define_cs_dialog(DIALOG_107, 1, 3, 95, 200, ("Ghosts...\n...don't...\n...DIE!\nHeh, heh, heh!\nCan you get out of here...\n...alive?"))
define_cs_dialog(DIALOG_108, 1, 2, 95, 200, ("Boooooo-m! Here comes\nthe master of mischief,\nthe tower of terror,\nthe Big Boo!\nKa ha ha ha..."))
define_cs_dialog(DIALOG_109, 1, 4, 95, 200, ("Ooooo Nooooo!\nTalk about out-of-body\nexperiences--my body\nhas melted away!\nHave you run in to any\nheadhunters lately??\nI could sure use a new\nbody!\nBrrr! My face might\nfreeze like this!"))
define_cs_dialog(DIALOG_110, 1, 5, 95, 200, ("I need a good head on my\nshoulders. Do you know of\nanybody in need of a good\nbody? Please! I'll follow\nyou if you do!"))
define_cs_dialog(DIALOG_111, 1, 4, 95, 200, ("Perfect! What a great\nnew body! Here--this is a\npresent for you. It's sure\nto warm you up."))
define_cs_dialog(DIALOG_112, 1, 4, 30, 200, ("Collect as many coins as\npossible! They'll refill\nyour Power Meter.\n\nYou can check to see how\nmany coins you've\ncollected in each of the\n15 enemy worlds.\nYou can also recover\npower by touching the\nSpinning Heart.\n\nThe faster you run\nthrough the heart, the\nmore power you'll recover."))
define_cs_dialog(DIALOG_113, 1, 6, 30, 200, ("There are special Caps in\nthe red, green and blue\nblocks. Step on the\nswitches in the hidden\ncourses to activate the\nCap Blocks."))
define_cs_dialog(DIALOG_114, 1, 5, 95, 200, ("It makes me so mad! We\nbuild your houses, your\ncastles. We pave your\nroads, and still you\nwalk all over us.\nDo you ever say thank\nyou? No! Well, you're not\ngoing to wipe your feet\non me! I think I'll crush\nyou just for fun!\nDo you have a problem\nwith that? Just try to\npound me, wimp! Ha!"))
define_cs_dialog(DIALOG_115, 1, 5, 95, 200, ("No! Crushed again!\nI'm just a stepping stone,\nafter all. I won't gravel,\ner, grovel. Here, you win.\nTake this with you!"))
define_cs_dialog(DIALOG_116, 1, 5, 95, 200, ("Whaaa....Whaaat?\nCan it be that a\npipsqueak like you has\ndefused the Bob-omb\nking????\nYou might be fast enough\nto ground me, but you'll\nhave to pick up the pace\nif you want to take King\nBowser by the tail.\nMethinks my troops could\nlearn a lesson from you!\nHere is your Star, as I\npromised, Mario.\n\nIf you want to see me\nagain, select this Star\nfrom the menu. For now,\nfarewell."))
define_cs_dialog(DIALOG_117, 1, 1, 95, 200, ("Who...walk...here?\nWho...break...seal?\nWake..ancient..ones?\nWe no like light...\nRrrrummbbble...\nWe no like...intruders!\nNow battle...\n...hand...\n...to...\n...hand!"))
define_cs_dialog(DIALOG_118, 1, 6, 95, 200, ("Grrrrumbbble!\nWhat...happen?\nWe...crushed like pebble.\nYou so strong!\nYou rule ancient pyramid!\nFor today...\nNow, take Star of Power.\nWe...sleep...darkness."))
define_cs_dialog(DIALOG_119, 1, 6, 30, 200, ("Grrr! I was a bit\ncareless. This is not as I\nhad planned...but I still\nhold the power of the\nStars, and I still have\nPeach.\nBwa ha ha! You'll get no\nmore Stars from me! I'm\nnot finished with you yet,\nbut I'll let you go for\nnow. You'll pay for this...\nlater!"))
define_cs_dialog(DIALOG_120, 1, 4, 30, 200, ("Ooowaah! Can it be that\nI've lost??? The power of\nthe Stars has failed me...\nthis time.\nConsider this a draw.\nNext time, I'll be in\nperfect condition.\n\nNow, if you want to see\nyour precious Princess,\ncome to the top of the\ntower.\nI'll be waiting!\nGwa ha ha ha!"))
define_cs_dialog(DIALOG_121, 1, 5, 30, 200, ("Nooo! It can't be!\nYou've really beaten me,\nMario?!! I gave those\ntroops power, but now\nit's fading away!\nArrgghh! I can see peace\nreturning to the world! I\ncan't stand it! Hmmm...\nIt's not over yet...\n\nC'mon troops! Let's watch\nthe ending together!\nBwa ha ha!"))
define_cs_dialog(DIALOG_122, 1, 4, 30, 200, ("The Black Hole\nRight: Work Elevator\n/// Cloudy Maze\nLeft: Underground Lake"))
define_cs_dialog(DIALOG_123, 1, 4, 30, 200, ("Metal Cavern\nRight: To Waterfall\nLeft: Metal Cap Switch"))
define_cs_dialog(DIALOG_124, 1, 4, 30, 200, ("Work Elevator\nDanger!!\nRead instructions\nthoroughly!\nElevator continues in the\ndirection of the arrow\nactivated."))
define_cs_dialog(DIALOG_125, 1, 3, 30, 200, ("Hazy Maze-Exit\nDanger! Closed.\nTurn back now."))
define_cs_dialog(DIALOG_126, 2, 3, 30, 200, ("Up: Black Hole\nRight: Work Elevator\n/// Hazy Maze"))
define_cs_dialog(DIALOG_127, 3, 4, 30, 200, ("Underground Lake\nRight: Metal Cave\nLeft: Abandoned Mine\n///(Closed)\nA gentle sea dragon lives\nhere. Pound on his back to\nmake him lower his head.\nDon't become his lunch."))
define_cs_dialog(DIALOG_128, 1, 4, 95, 200, ("You must fight with\nhonor! It is against the\nroyal rules to throw the\nking out of the ring!"))
define_cs_dialog(DIALOG_129, 1, 5, 30, 200, ("Welcome to the Vanish\nCap Switch Course! All of\nthe blue blocks you find\nwill become solid once you\nstep on the Cap Switch.\nYou'll disappear when you\nput on the Vanish Cap, so\nyou'll be able to elude\nenemies and walk through\nmany things. Try it out!"))
define_cs_dialog(DIALOG_130, 1, 5, 30, 200, ("Welcome to the Metal Cap\nSwitch Course! Once you\nstep on the Cap Switch,\nthe green blocks will\nbecome solid.\nWhen you turn your body\ninto metal with the Metal\nCap, you can walk\nunderwater! Try it!"))
define_cs_dialog(DIALOG_131, 1, 5, 30, 200, ("Welcome to the Wing Cap\nCourse! Step on the red\nswitch at the top of the\ntower, in the center of\nthe rainbow ring.\nWhen you trigger the\nswitch, all of the red\nblocks you find will\nbecome solid.\n\nTry out the Wing Cap! Do\nthe Triple Jump to take\noff and press [Z] to land.\n\n\nPull back on the Control\nStick to go up and push\nforward to nose down,\njust as you would when\nflying an airplane."))
define_cs_dialog(DIALOG_132, 1, 4, 30, 200, ("Whoa, Mario, pal, you\naren't trying to cheat,\nare you? Shortcuts aren't\nallowed.\nNow, I know that you\nknow better. You're\ndisqualified! Next time,\nplay fair!"))
define_cs_dialog(DIALOG_133, 1, 6, 30, 200, ("Am I glad to see you! The\nPrincess...and I...and,\nwell, everybody...we're all\ntrapped inside the castle\nwalls.\n\nBowser has stolen the\ncastle's Stars, and he's\nusing their power to\ncreate his own world in\nthe paintings and walls.\n\nPlease recover the Power\nStars! As you find them,\nyou can use their power\nto open the doors that\nBowser has sealed.\n\nThere are four rooms on\nthe first floor. Start in\nthe one with the painting\nof Bob-omb inside. It's\nthe only room that Bowser\nhasn't sealed.\nWhen you collect eight\nPower Stars, you'll be\nable to open the door\nwith the big star. The\nPrincess must be inside!"))
define_cs_dialog(DIALOG_134, 1, 5, 30, 200, ("The names of the Stars\nare also hints for\nfinding them. They are\ndisplayed at the beginning\nof each course.\nYou can collect the Stars\nin any order. You won't\nfind some Stars, enemies\nor items unless you select\na specific Star.\nAfter you collect some\nStars, you can try\nanother course.\nWe're all waiting for\nyour help!"))
define_cs_dialog(DIALOG_135, 1, 5, 30, 200, ("It was Bowser who stole\nthe Stars. I saw him with\nmy own eyes!\n\n\nHe's hidden six Stars in\neach course, but you\nwon't find all of them in\nsome courses until you\npress the Cap Switches.\nThe Stars you've found\nwill show on each course's\nstarting screen.\n\n\nIf you want to see some\nof the enemies you've\nalready defeated, select\nthe Stars you recovered\nfrom them."))
define_cs_dialog(DIALOG_136, 1, 6, 30, 200, ("Wow! You've already\nrecovered that many\nStars? Way to go, Mario!\nI'll bet you'll have us out\nof here in no time!\n\nBe careful, though.\nBowser and his band\nwrote the book on 『bad.』\nTake my advice: When you\nneed to recover from\ninjuries, collect coins.\nYellow Coins refill one\npiece of the Power Meter,\nRed Coins refill two\npieces, and Blue Coins\nrefill five.\n\nTo make Blue Coins\nappear, pound on Blue\nCoin Blocks.\n\n\n\nAlso, if you fall from\nhigh places, you'll\nminimize damage if you\nPound the Ground as you\nland."))
define_cs_dialog(DIALOG_137, 1, 6, 30, 200, ("Thanks, Mario! The castle\nis recovering its energy\nas you retrieve Power\nStars, and you've chased\nBowser right out of here,\non to some area ahead.\nOh, by the by, are you\ncollecting coins? Special\nStars appear when you\ncollect 100 coins in each\nof the 15 courses!"))
define_cs_dialog(DIALOG_138, 1, 3, 30, 200, ("Down: Underground Lake\nLeft: Black Hole\nRight: Hazy Maze (Closed)"))
define_cs_dialog(DIALOG_139, 1, 6, 30, 200, ("Above: Automatic Elevator\nElevator begins\nautomatically and follows\npre-set course.\nIt disappears\nautomatically, too."))
define_cs_dialog(DIALOG_140, 1, 6, 30, 200, ("Elevator Area\nRight: Hazy Maze\n/// Entrance\nLeft: Black Hole\n///Elevator 1\nArrow: You are here"))
define_cs_dialog(DIALOG_141, 1, 5, 150, 200, ("You've recovered one of\nthe stolen Power Stars!\nNow you can open some of\nthe sealed doors in the\ncastle.\nTry the Princess's room\non the second floor and\nthe room with the\npainting of Whomp's\nFortress on Floor 1.\nBowser's troops are still\ngaining power, so you\ncan't give up. Save us,\nMario! Keep searching for\nStars!"))
define_cs_dialog(DIALOG_142, 1, 5, 150, 200, ("You've recovered three\nPower Stars! Now you can\nopen any door with a 3\non its star.\n\nYou can come and go from\nthe open courses as you\nplease. The enemies ahead\nare even meaner, so be\ncareful!"))
define_cs_dialog(DIALOG_143, 1, 6, 150, 200, ("You've recovered eight of\nthe Power Stars! Now you\ncan open the door with\nthe big Star! But Bowser\nis just ahead...can you\nhear the Princess calling?"))
define_cs_dialog(DIALOG_144, 1, 6, 150, 200, ("You've recovered 30\nPower Stars! Now you can\nopen the door with the\nbig Star! But before you\nmove on, how's it going\notherwise?\nDid you pound the two\ncolumns down? You didn't\nlose your hat, did you?\nIf you did, you'll have to\nstomp on the condor to\nget it back!\nThey say that Bowser has\nsneaked out of the sea\nand into the underground.\nHave you finally\ncornered him?"))
define_cs_dialog(DIALOG_145, 1, 6, 150, 200, ("You've recovered 50\nPower Stars! Now you can\nopen the Star Door on the\nthird floor. Bowser's\nthere, you know.\n\nOh! You've found all of\nthe Cap Switches, haven't\nyou? Red, green and blue?\nThe Caps you get from the\ncolored blocks are really\nhelpful.\nHurry along, now. The\nthird floor is just ahead."))
define_cs_dialog(DIALOG_146, 1, 6, 150, 200, ("You've found 70 Power\nStars! The mystery of the\nendless stairs is solved,\nthanks to you--and is\nBowser ever upset! Now,\non to the final bout!"))
define_cs_dialog(DIALOG_147, 1, 5, 30, 200, ("Are you using the Cap\nBlocks? You really should,\nyou know.\n\n\nTo make them solid so you\ncan break them, you have\nto press the colored Cap\nSwitches in the castle's\nhidden courses.\nYou'll find the hidden\ncourses only after\nregaining some of the\nPower Stars.\n\nThe Cap Blocks are a big\nhelp! Red for the Wing\nCap, green for the Metal\nCap, blue for the Vanish\nCap."))
define_cs_dialog(DIALOG_148, 1, 6, 30, 200, ("Snowman Mountain ahead.\nKeep out! And don't try\nthe Triple Jump over the\nice block shooter.\n\n\nIf you fall into the\nfreezing pond, your power\ndecreases quickly, and\nyou won't recover\nautomatically.\n//--The Snowman"))
define_cs_dialog(DIALOG_149, 1, 3, 30, 200, ("Welcome to\nPrincess Toadstool's\nsecret slide!\nThere's a Star hidden\nhere that Bowser couldn't\nfind.\nWhen you slide, press\nforward to speed up,\npull back to slow down.\nIf you slide really\nfast, you'll win the Star!"))
define_cs_dialog(DIALOG_150, 1, 5, 30, 200, ("Waaaa! You've flooded my\nhouse! Wh-why?? Look at\nthis mess! What am I\ngoing to do now?\n\nThe ceiling's ruined, the\nfloor is soaked...what to\ndo, what to do? Huff...\nhuff...it makes me so...\nMAD!!!\nEverything's been going\nwrong ever since I got\nthis Star...It's so shiny,\nbut it makes me feel...\nstrange..."))
define_cs_dialog(DIALOG_151, 1, 4, 30, 200, ("I can't take this\nanymore! First you get\nme all wet, then you\nstomp on me!\nNow I'm really, really,\nREALLY mad!\nWaaaaaaaaaaaaaaaaa!!!"))
define_cs_dialog(DIALOG_152, 1, 3, 30, 200, ("Owwch! Uncle! Uncle!\nOkay, I give. Take this\nStar!\nWhew! I feel better now.\nI don't really need it\nanymore, anyway--\nI can see the stars\nthrough my ceiling at\nnight.\nThey make me feel...\n...peaceful. Please, come\nback and visit anytime."))
define_cs_dialog(DIALOG_153, 1, 4, 30, 200, ("Hey! Who's there?\nWhat's climbing on me?\nIs it an ice ant?\nA snow flea?\nWhatever it is, it's\nbugging me! I think I'll\nblow it away!"))
define_cs_dialog(DIALOG_154, 1, 5, 30, 200, ("Hold on to your hat! If\nyou lose it, you'll be\neasily injured. If you\nlose it, look for it in the\ncourse where you lost it.\nSpeaking of lost, the\nPrincess is still stuck in\nthe walls somewhere.\nPlease help, Mario!\n\nOh, you know that there\nare secret worlds in the\nwalls as well as in the\npaintings, right?"))
define_cs_dialog(DIALOG_155, 1, 6, 30, 200, ("Thanks to the power of\nthe Stars, life is\nreturning to the castle.\nPlease, Mario, you have\nto give Bowser the boot!\n\nHere, let me tell you a\nlittle something about the\ncastle. In the room with\nthe mirrors, look carefully\nfor anything that's not\nreflected in the mirror.\nAnd when you go to the\nwater town, you can flood\nit with a high jump into\nthe painting."))
define_cs_dialog(DIALOG_156, 1, 5, 30, 200, ("The world inside the\nclock is so strange!\nWhen you jump inside,\nwatch the position of\nthe big hand!"))
define_cs_dialog(DIALOG_157, 1, 5, 30, 200, ("Watch out! Don't let\nyourself be swallowed by\nquicksand.\n\n\nIf you sink into the sand,\nyou won't be able to\njump, and if your head\ngoes under, you'll be\nsmothered.\nThe dark areas are\nbottomless pits."))
define_cs_dialog(DIALOG_158, 1, 6, 30, 200, ("1. If you jump repeatedly\nand time it right, you'll\njump higher and higher.\nIf you run really fast and\ntime three jumps right,\nyou can do a Triple Jump.\n2. Jump into a solid wall,\nthen jump again when you\nhit the wall. You can\nbounce to a higher level\nusing this Wall Kick."))
define_cs_dialog(DIALOG_159, 1, 6, 30, 200, ("3. If you stop, press [Z]\nto crouch, then jump, you\ncan perform a Backward\nSomersault. To do a Long\nJump, run fast, press [Z],\nthen jump."))
define_cs_dialog(DIALOG_160, 1, 4, 30, 200, ("Press [B] while running\nfast to do a Body Slide\nattack. To stand while\nsliding, press [A] or [B]."))
define_cs_dialog(DIALOG_161, 1, 4, 30, 200, ("Mario!!!\nIt that really you???\nIt has been so long since\nour last adventure!\nThey told me that I might\nsee you if I waited here,\nbut I'd just about given\nup hope!\nIs it true? Have you\nreally beaten Bowser? And\nrestored the Stars to the\ncastle?\nAnd saved the Princess?\nI knew you could do it!\nNow I have a very special\nmessage for you.\nThanks for playing Super\nMario 64! This is the\nend of the game, but not\nthe end of the fun.\nWe want you to keep on\nplaying, so we have a\nlittle something for you.\nWe hope that you like it!\nEnjoy!!!\n\nThe Super Mario 64 Team"))
define_cs_dialog(DIALOG_162, 1, 4, 30, 200, ("No, no, no! Not you\nagain! I'm in a great\nhurry, can't you see?\n\nI've no time to squabble\nover Stars. Here, have it.\nI never meant to hide it\nfrom you...\nIt's just that I'm in such\na rush. That's it, that's\nall. Now, I must be off.\nOwww! Let me go!"))
define_cs_dialog(DIALOG_163, 1, 5, 30, 200, ("Noooo! You've really\nbeaten me this time,\nMario! I can't stand\nlosing to you!\n\nMy troops...worthless!\nThey've turned over all\nthe Power Stars! What?!\nThere are 120 in all???\n\nAmazing! There were some\nin the castle that I\nmissed??!!\n\n\nNow I see peace\nreturning to the world...\nOooo! I really hate that!\nI can't watch--\nI'm outta here!\nJust you wait until next\ntime. Until then, keep\nthat Control Stick\nsmokin'!\nBuwaa ha ha!"))
define_cs_dialog(DIALOG_164, 1, 4, 30, 200, ("Mario! What's up, pal?\nI haven't been on the\nslide lately, so I'm out\nof shape.\nStill, I'm always up for a\ngood race, especially\nagainst an old sleddin'\nbuddy.\nWhaddya say?\nReady...set...\n\n//Go//// Don't Go"))
define_cs_dialog(DIALOG_165, 1, 5, 30, 200, ("I take no responsibility\nwhatsoever for those who\nget dizzy and pass out\nfrom running around\nthis post."))
define_cs_dialog(DIALOG_166, 1, 4, 30, 200, ("I'll be back soon.\nI'm out training now,\nso come back later.\n//--Koopa the Quick"))
define_cs_dialog(DIALOG_167, 1, 4, 30, 200, ("Princess Toadstool's\ncastle is just ahead.\n\n\nPress [A] to jump, [Z] to\ncrouch, and [B] to punch,\nread a sign, or grab\nsomething.\nPress [B] again to throw\nsomething you're holding."))
define_cs_dialog(DIALOG_168, 1, 5, 30, 200, ("Hey! Knock it off! That's\nthe second time you've\nnailed me. Now you're\nasking for it, linguine\nbreath!"))
define_cs_dialog(DIALOG_169, 1, 4, 30, 200, ("Keep out!\nThat means you!\nArrgghh!\n\nAnyone entering this cave\nwithout permission will\nmeet certain disaster."))
local DIALOG_NAME = "Mario"
---@param name string
function dialog_set_replace_name(name)
DIALOG_NAME = name
end
local prevCharName = ""
local function dialog_swap(charName)
for i = DIALOG_000, #dialogTable do
if dialogTable[i] ~= nil then
local dialog = dialogTable[i]
charName = charName:gsub('"', "''")
local replaced_dialog = dialog.str:gsub(DIALOG_NAME, charName)
real_dialog_replace(i, dialog.unused, dialog.linesPerBox, dialog.leftOffset, dialog.width, replaced_dialog)
end
local function dialog_update(dialogId)
-- Save Original Dialog
if ogDialog[dialogId] == nil then
local dialog = smlua_text_utils_dialog_get(dialogId)
ogDialog[dialogId] = {
unused = dialog.unused,
linesPerBox = dialog.linesPerBox,
leftOffset = dialog.leftOffset,
width = dialog.width,
text = dialog.text
}
end
end
local function update()
-- Query Character Swapped
local charName = characterTable[currChar][characterTable[currChar].currAlt].name
if prevCharName ~= charName then
dialog_swap(charName)
prevCharName = charName
local dialog = ogDialog[dialogId]
local charName = characterTable[currChar].nickname
local charAuto = characterTable[currChar].autoDialog
-- Check for Override Dialog and use it instead
local colorDialog = false
if characterDialog[currChar] ~= nil and characterDialog[currChar][dialogId] ~= nil then
dialog = characterDialog[currChar][dialogId]
colorDialog = true
elseif charAuto then
dialog.text = dialog.text:gsub(DEFAULT_DIALOG_NAME, charName)
colorDialog = true
end
-- Set color if Dialog has Character's Name
reset_dialog_override_color()
if colorDialog then
local charColor = characterTable[currChar][characterTable[currChar].currAlt].color
set_dialog_override_color(charColor.r*0.3, charColor.g*0.3, charColor.b*0.3, 150, 255, 255, 255, 255)
end
-- Apply Text Changes
smlua_text_utils_dialog_replace(
dialogId,
dialog.unused,
dialog.linesPerBox,
dialog.leftOffset,
dialog.width,
dialog.text
)
-- Reminder to later change this to true, string
return true
end
hook_event(HOOK_UPDATE, update)
hook_event(HOOK_ON_DIALOG, dialog_update)

View file

@ -4,20 +4,14 @@
if incompatibleClient then return 0 end
-- localize functions to improve performance - n-hud.lua
local og_hud_get_value,og_hud_set_value,djui_hud_print_text,tostring,hud_set_flash,get_global_timer,hud_get_flash,djui_hud_get_screen_width,math_ceil,obj_get_first_with_behavior_id,get_behavior_from_id,count_objects_with_behavior,djui_hud_render_rect,djui_hud_set_resolution,djui_hud_get_screen_height,djui_hud_set_color,djui_hud_set_font,djui_hud_measure_text,djui_chat_message_create,hud_is_hidden,djui_is_playerlist_open = hud_get_value,hud_set_value,djui_hud_print_text,tostring,hud_set_flash,get_global_timer,hud_get_flash,djui_hud_get_screen_width,math.ceil,obj_get_first_with_behavior_id,get_behavior_from_id,count_objects_with_behavior,djui_hud_render_rect,djui_hud_set_resolution,djui_hud_get_screen_height,djui_hud_set_color,djui_hud_set_font,djui_hud_measure_text,djui_chat_message_create,hud_is_hidden,djui_is_playerlist_open
--[[
Some functions we need for the hud
Color hud code written by EmilyEmmi
Djui box code written by xLuigiGamerx (Use outside of character select is forbidden as these functions were made for another mod I'm planning to release)
]]
local og_hud_get_value = hud_get_value
local og_hud_set_value = hud_set_value
---@param text string
---@return nil, number, number, number, number
---@return number?, number?, number?, number?
local function convert_color(text)
if text:sub(2, 2) ~= "#" then
return nil
return
end
text = text:sub(3, -2)
local rstring, gstring, bstring = "", "", ""
@ -39,7 +33,7 @@ end
---@param text string
---@param get_color boolean|nil
---@return string, string, string, boolean
---@return string, string?, string?
local function remove_color(text, get_color)
local start = text:find("\\")
local next = 1
@ -137,12 +131,12 @@ local function djui_hud_print_text_with_color(text, x, y, scale, red, green, blu
while render ~= nil do
local r, g, b, a = convert_color(color)
if alpha then a = alpha end
djui_hud_print_text(render, x + space, y, scale);
djui_hud_print_text(render, x + space, y, scale)
if r then djui_hud_set_color(r, g, b, a) end
space = space + djui_hud_measure_text(render) * scale
text, color, render = remove_color(text, true)
end
djui_hud_print_text(text, x + space, y, scale);
djui_hud_print_text(text, x + space, y, scale)
end
---@param text string Message
@ -175,36 +169,39 @@ end
-- Real HUD Stuffs --
---------------------
-- Updates the Chracter Select hud flags along with the vanilla hud flags
local hiddenList = HUD_DISPLAY_FLAG_LIVES | HUD_DISPLAY_FLAG_STAR_COUNT | HUD_DISPLAY_FLAG_CAMERA | HUD_DISPLAY_FLAG_POWER
local sCharSelectHudDisplayFlags = og_hud_get_value(HUD_DISPLAY_FLAGS) | hiddenList -- Initializes custom hud flags
function flags_update()
sCharSelectHudDisplayFlags = sCharSelectHudDisplayFlags & (og_hud_get_value(HUD_DISPLAY_FLAGS) | hiddenList) -- Updated the custom flags
og_hud_set_value(HUD_DISPLAY_FLAGS, og_hud_get_value(HUD_DISPLAY_FLAGS) & ~(hiddenList)) -- Update the vanilla flags
end
hook_event(HOOK_ON_HUD_RENDER_BEHIND, flags_update)
-- Modified Vanilla Functions --
--[[
These are `_G` on their own to replace vanilla functions
]]
local sCharSelectHudDisplayFlags -- `local` because we aren't exposing this
-- Here to make sure the flags are at the default state
hook_event(HOOK_UPDATE, function ()
if not sCharSelectHudDisplayFlags or sCharSelectHudDisplayFlags == 0 then
sCharSelectHudDisplayFlags = og_hud_get_value(HUD_DISPLAY_FLAGS) | HUD_DISPLAY_DEFAULT
end
end)
--- @param type HudDisplayValue
--- @return integer
---@param type HudDisplayValue
---@return integer
function _G.hud_get_value(type)
if type == HUD_DISPLAY_FLAGS then
return sCharSelectHudDisplayFlags
return sCharSelectHudDisplayFlags | og_hud_get_value(HUD_DISPLAY_FLAGS)
else
return og_hud_get_value(type)
end
end
--- @param type HudDisplayValue
--- @param value integer
---@param type HudDisplayValue
---@param value integer
--- Sets a HUD display value
function _G.hud_set_value(type, value)
if type == HUD_DISPLAY_FLAGS then
sCharSelectHudDisplayFlags = value
og_hud_set_value(type, value & ~(hiddenList))
else
og_hud_set_value(type, value)
end
@ -215,7 +212,7 @@ end
---Hides the specified custom hud element
---@param hudElement HUDDisplayFlag
function hud_hide_element(hudElement)
--log_to_console("The `charSelect.hud_hide_element()` function is deprecated, please use normal vanilla functions as they have been modified to work with Character Select.", CONSOLE_MESSAGE_WARNING)
log_to_console_once("`charSelect.hud_hide_element` function is deprecated, please use 'hud_set_value'", CONSOLE_MESSAGE_WARNING)
hud_set_value(HUD_DISPLAY_FLAGS, hud_get_value(HUD_DISPLAY_FLAGS) & ~hudElement)
return true
end
@ -223,7 +220,7 @@ end
---Shows the specified custom hud element
---@param hudElement HUDDisplayFlag
function hud_show_element(hudElement)
--log_to_console("The `charSelect.hud_show_element()` function is deprecated, please use normal vanilla functions as they have been modified to work with Character Select.", CONSOLE_MESSAGE_WARNING)
log_to_console_once("`hud_show_element` function is deprecated, please use 'hud_set_value'", CONSOLE_MESSAGE_WARNING)
hud_set_value(HUD_DISPLAY_FLAGS, hud_get_value(HUD_DISPLAY_FLAGS) | hudElement)
return true
end
@ -232,26 +229,24 @@ end
---@param hudElement HUDDisplayFlag
---@return boolean
function hud_get_element(hudElement)
--log_to_console("The `charSelect.hud_get_element()` function is deprecated, please use normal vanilla functions as they have been modified to work with Character Select.", CONSOLE_MESSAGE_WARNING)
djui_chat_message_create(tostring(sCharSelectHudDisplayFlags))
log_to_console_once("`charSelect.hud_get_element` function is deprecated, please use 'hud_set_value'", CONSOLE_MESSAGE_WARNING)
return (hud_get_value(HUD_DISPLAY_FLAGS) & hudElement) ~= 0
end
local MATH_DIVIDE_16 = 1/16
local MATH_DIVIDE_32 = 1/32
local MATH_DIVIDE_64 = 1/64
local MATH_DIVIDE_HEALTH = 1/0x100
local FONT_USER = FONT_NORMAL
--- @param localIndex integer
--- @return string
---@param localIndex integer
---@return string
--- This assumes multiple characters will not have the same model,
--- Icons can only be seen by users who have the character avalible to them
function name_from_local_index(localIndex)
if localIndex == nil then localIndex = 0 end
local p = gCSPlayers[localIndex]
for i = 1, #characterTable do
for i = 0, #characterTable do
if characterTable[i].saveName == p.saveName then
return characterTable[i][(p.currAlt and p.currAlt or 1)].name
end
@ -259,14 +254,14 @@ function name_from_local_index(localIndex)
return "???"
end
--- @param localIndex integer
--- @return table
---@param localIndex integer
---@return table
--- This assumes multiple characters will not have the same model,
--- Icons can only be seen by users who have the character avalible to them
function color_from_local_index(localIndex)
if localIndex == nil then localIndex = 0 end
local p = gCSPlayers[localIndex]
for i = 1, #characterTable do
for i = 0, #characterTable do
if characterTable[i].saveName == p.saveName then
return characterTable[i][(p.currAlt and p.currAlt or 1)].color
end
@ -274,15 +269,15 @@ function color_from_local_index(localIndex)
return {r = 255, g = 255, b = 255}
end
--- @param localIndex integer
--- @return TextureInfo|string
---@param localIndex integer
---@return TextureInfo|string
--- This assumes multiple characters will not have the same model,
--- Icons can only be seen by users who have the character avalible to them.
--- This function can return nil. if this is the case, render `djui_hud_print_text("?", x, y, 1)`
function life_icon_from_local_index(localIndex)
if localIndex == nil then localIndex = 0 end
local p = gCSPlayers[localIndex]
for i = 1, #characterTable do
for i = 0, #characterTable do
local char = characterTable[i]
if char.saveName == p.saveName then
return char[(p.currAlt and p.currAlt or 1)].lifeIcon
@ -291,14 +286,14 @@ function life_icon_from_local_index(localIndex)
return "?"
end
--- @param localIndex integer
--- @return TextureInfo
---@param localIndex integer
---@return TextureInfo
--- This assumes multiple characters will not have the same model,
--- Icons can only be seen by users who have the character avalible to them
function star_icon_from_local_index(localIndex)
if localIndex == nil then localIndex = 0 end
local p = gCSPlayers[localIndex]
for i = 1, #characterTable do
for i = 0, #characterTable do
local char = characterTable[i]
if char.saveName == p.saveName then
return char[(p.currAlt and p.currAlt or 1)].starIcon
@ -308,10 +303,10 @@ function star_icon_from_local_index(localIndex)
end
local TYPE_STRING = "string"
--- @param localIndex integer
--- @param x integer
--- @param y integer
--- @param scale integer
---@param localIndex integer
---@param x integer
---@param y integer
---@param scale integer
function render_life_icon_from_local_index(localIndex, x, y, scale)
if localIndex == nil then localIndex = 0 end
local lifeIcon = life_icon_from_local_index(localIndex)
@ -331,13 +326,13 @@ function render_life_icon_from_local_index(localIndex, x, y, scale)
end
end
--- @param localIndex integer
--- @param prevX integer
--- @param prevY integer
--- @param prevScale integer
--- @param x integer
--- @param y integer
--- @param scale integer
---@param localIndex integer
---@param prevX integer
---@param prevY integer
---@param prevScale integer
---@param x integer
---@param y integer
---@param scale integer
function render_life_icon_from_local_index_interpolated(localIndex, prevX, prevY, prevScale, x, y, scale)
if localIndex == nil then localIndex = 0 end
local lifeIcon = life_icon_from_local_index(localIndex)
@ -357,20 +352,20 @@ function render_life_icon_from_local_index_interpolated(localIndex, prevX, prevY
end
end
--- @param localIndex integer
--- @param x integer
--- @param y integer
--- @param scale integer
---@param localIndex integer
---@param x integer
---@param y integer
---@param scale integer
function render_star_icon_from_local_index(localIndex, x, y, scale)
if localIndex == nil then localIndex = 0 end
local starIcon = star_icon_from_local_index(localIndex)
djui_hud_render_texture(starIcon, x, y, scale / (starIcon.width * MATH_DIVIDE_16), scale / (starIcon.height * MATH_DIVIDE_16))
end
--- @param localIndex integer
--- @param x integer
--- @param y integer
--- @param scale integer
---@param localIndex integer
---@param x integer
---@param y integer
---@param scale integer
function render_star_icon_from_local_index_interpolated(localIndex, prevX, prevY, prevScale, x, y, scale)
if localIndex == nil then localIndex = 0 end
local starIcon = star_icon_from_local_index(localIndex)
@ -378,7 +373,7 @@ function render_star_icon_from_local_index_interpolated(localIndex, prevX, prevY
end
-- Health Meter --
local TEXT_DEFAULT_METER_PREFIX = "char-select-custom-meter-"
local TEXT_DEFAULT_METER_PREFIX = "char_select_custom_meter_"
local TEX_DEFAULT_METER_LEFT = get_texture_info(TEXT_DEFAULT_METER_PREFIX.."left")
local TEX_DEFAULT_METER_RIGHT = get_texture_info(TEXT_DEFAULT_METER_PREFIX.."right")
local TEX_DEFAULT_METER_PIE1 = get_texture_info(TEXT_DEFAULT_METER_PREFIX.."pie1")
@ -389,7 +384,7 @@ local TEX_DEFAULT_METER_PIE5 = get_texture_info(TEXT_DEFAULT_METER_PREFIX.."pie5
local TEX_DEFAULT_METER_PIE6 = get_texture_info(TEXT_DEFAULT_METER_PREFIX.."pie6")
local TEX_DEFAULT_METER_PIE7 = get_texture_info(TEXT_DEFAULT_METER_PREFIX.."pie7")
local TEX_DEFAULT_METER_PIE8 = get_texture_info(TEXT_DEFAULT_METER_PREFIX.."pie8")
local defaultMeterInfo = {
defaultMeterInfo = {
label = {
left = TEX_DEFAULT_METER_LEFT,
right = TEX_DEFAULT_METER_RIGHT,
@ -406,85 +401,230 @@ local defaultMeterInfo = {
}
}
local TEXT_DEFAULT_COURSE_PREFIX = "char-select-custom-course-"
local TEX_DEFAULT_METER_LEFT = get_texture_info(TEXT_DEFAULT_COURSE_PREFIX.."top")
local TEX_DEFAULT_METER_RIGHT = get_texture_info(TEXT_DEFAULT_COURSE_PREFIX.."bottom")
local TEXT_DEFAULT_COURSE_PREFIX = "char_select_custom_course_"
local TEX_DEFAULT_COURSE_TOP = get_texture_info(TEXT_DEFAULT_COURSE_PREFIX.."top")
local TEX_DEFAULT_COURSE_BOTTOM = get_texture_info(TEXT_DEFAULT_COURSE_PREFIX.."bottom")
local defaultCourseInfo = {
top = TEX_DEFAULT_METER_LEFT,
bottom = TEX_DEFAULT_METER_RIGHT,
top = TEX_DEFAULT_COURSE_TOP,
bottom = TEX_DEFAULT_COURSE_BOTTOM,
}
--- @param localIndex integer
--- @return table
---@param localIndex integer
---@return table
--- This assumes multiple characters will not have the same model,
--- Icons can only be seen by users who have the character avalible to them
function health_meter_from_local_index(localIndex)
if localIndex == nil then localIndex = 0 end
localIndex = localIndex or 0
local p = gCSPlayers[localIndex]
for i = 1, #characterTable do
for i = 0, #characterTable do
local char = characterTable[i]
if char.saveName == p.saveName and char[(p.currAlt and p.currAlt or 1)].healthTexture ~= nil then
return char[(p.currAlt and p.currAlt or 1)].healthTexture
local healthMeter = (char[p.currAlt] and char[p.currAlt].healthMeter) or char[1].healthMeter
if char.saveName == p.saveName and healthMeter ~= nil then
return healthMeter
end
end
return defaultMeterInfo
end
--- @param localIndex integer
--- @param x integer
--- @param y integer
--- @param scaleX integer
--- @param scaleY integer
---@param localIndex integer
---@param health integer
---@param x integer
---@param y integer
---@param scaleX integer
---@param scaleY integer
function render_health_meter_from_local_index(localIndex, health, x, y, scaleX, scaleY)
if localIndex == nil then localIndex = 0 end
local health = math.floor(health*MATH_DIVIDE_HEALTH)
local textureTable = health_meter_from_local_index(localIndex)
local tex = textureTable.label.left
djui_hud_render_texture(tex, x, y, scaleX / (tex.width * MATH_DIVIDE_32) * MATH_DIVIDE_64, scaleY / (tex.height * MATH_DIVIDE_64) * MATH_DIVIDE_64)
local tex = textureTable.label.right
djui_hud_render_texture(tex, x + 31*scaleX*MATH_DIVIDE_64, y, scaleX / (tex.width * MATH_DIVIDE_32) * MATH_DIVIDE_64, scaleY / (tex.height * MATH_DIVIDE_64) * MATH_DIVIDE_64)
if health > 0 then
local tex = textureTable.pie[health]
djui_hud_render_texture(tex, x + 15*scaleX*MATH_DIVIDE_64, y + 16*scaleY*MATH_DIVIDE_64, scaleX / (tex.width * MATH_DIVIDE_32) * MATH_DIVIDE_64, scaleY / (tex.height * MATH_DIVIDE_32) * MATH_DIVIDE_64)
local color = djui_hud_get_color()
localIndex = localIndex or 0
local meter = health_meter_from_local_index(localIndex)
if type(meter) == "function" then
meter(localIndex, health, x, y, scaleX, scaleY, x, y, scaleX, scaleY)
else
health = health >> 8
local tex = meter.label.left
djui_hud_render_texture(tex, x, y, scaleX / (tex.width * MATH_DIVIDE_32) * MATH_DIVIDE_64, scaleY / (tex.height * MATH_DIVIDE_64) * MATH_DIVIDE_64)
tex = meter.label.right
djui_hud_render_texture(tex, x + 31*scaleX*MATH_DIVIDE_64, y, scaleX / (tex.width * MATH_DIVIDE_32) * MATH_DIVIDE_64, scaleY / (tex.height * MATH_DIVIDE_64) * MATH_DIVIDE_64)
if health > 0 then
tex = meter.pie[health]
djui_hud_render_texture(tex, x + 15*scaleX*MATH_DIVIDE_64, y + 16*scaleY*MATH_DIVIDE_64, scaleX / (tex.width * MATH_DIVIDE_32) * MATH_DIVIDE_64, scaleY / (tex.height * MATH_DIVIDE_32) * MATH_DIVIDE_64)
end
end
djui_hud_set_color(color.r, color.g, color.b, color.a)
end
---@param localIndex integer
---@param health integer
---@param prevX integer
---@param prevY integer
---@param prevScaleX integer
---@param prevScaleY integer
---@param x integer
---@param y integer
---@param scaleX integer
---@param scaleY integer
function render_health_meter_from_local_index_interpolated(localIndex, health, prevX, prevY, prevScaleX, prevScaleY, x, y, scaleX, scaleY)
local color = djui_hud_get_color()
localIndex = localIndex or 0
local meter = health_meter_from_local_index(localIndex)
if type(meter) == "function" then
meter(localIndex, health, prevX, prevY, prevScaleX, prevScaleY, x, y, scaleX, scaleY)
else
health = health >> 8
local tex = meter.label.left
djui_hud_render_texture_interpolated(tex, prevX, prevY, prevScaleX / (tex.width * MATH_DIVIDE_32) * MATH_DIVIDE_64, prevScaleY / (tex.height * MATH_DIVIDE_64) * MATH_DIVIDE_64, x, y, scaleX / (tex.width * MATH_DIVIDE_32) * MATH_DIVIDE_64, scaleY / (tex.height * MATH_DIVIDE_64) * MATH_DIVIDE_64)
tex = meter.label.right
djui_hud_render_texture_interpolated(tex, prevX + 31*prevScaleX*MATH_DIVIDE_64, prevY, prevScaleX / (tex.width * MATH_DIVIDE_32) * MATH_DIVIDE_64, prevScaleY / (tex.height * MATH_DIVIDE_64) * MATH_DIVIDE_64, x + 31*scaleX*MATH_DIVIDE_64, y, scaleX / (tex.width * MATH_DIVIDE_32) * MATH_DIVIDE_64, scaleY / (tex.height * MATH_DIVIDE_64) * MATH_DIVIDE_64)
if health > 0 then
tex = meter.pie[health]
djui_hud_render_texture_interpolated(tex, prevX + 15*prevScaleX*MATH_DIVIDE_64, prevY + 16*scaleY*MATH_DIVIDE_64, prevScaleX / (tex.width * MATH_DIVIDE_32) * MATH_DIVIDE_64, prevScaleY / (tex.height * MATH_DIVIDE_32) * MATH_DIVIDE_64, x + 15*scaleX*MATH_DIVIDE_64, y + 16*scaleY*MATH_DIVIDE_64, scaleX / (tex.width * MATH_DIVIDE_32) * MATH_DIVIDE_64, scaleY / (tex.height * MATH_DIVIDE_32) * MATH_DIVIDE_64)
end
end
djui_hud_set_color(color.r, color.g, color.b, color.a)
end
-- Force Default Health function to render CS' Meter
_G.hud_render_power_meter = function(health, x, y, scaleX, scaleY)
render_health_meter_from_local_index(0, health, x, y, scaleX, scaleY)
end
_G.hud_render_power_meter_interpolated = function(health, prevX, prevY, prevScaleX, prevScaleY, x, y, scaleX, scaleY)
render_health_meter_from_local_index_interpolated(0, health, prevX, prevY, prevScaleX, prevScaleY, x, y, scaleX, scaleY)
end
-- Health Meter Code
local POWER_METER_HIDDEN = 0
local POWER_METER_EMPHASIZED = 1
local POWER_METER_DEEMPHASIZING = 2
local POWER_METER_HIDING = 3
local POWER_METER_VISIBLE = 4
local sPowerMeterHUD = {
animation = POWER_METER_HIDDEN,
x = 140,
y = 166,
unused = 1.0,
};
local sPowerMeterVisibleTimer = 0
local sPowerMeterStoredHealth = 0
local function animate_power_meter_emphasized()
local hudDisplayFlags = hud_get_value(HUD_DISPLAY_FLAGS)
if ((hudDisplayFlags & HUD_DISPLAY_FLAG_EMPHASIZE_POWER) == 0) then
if (sPowerMeterVisibleTimer == 45.0) then
sPowerMeterHUD.animation = POWER_METER_DEEMPHASIZING;
end
else
sPowerMeterVisibleTimer = 0;
end
end
local pieTextureNames = {
"one_segments",
"two_segments",
"three_segments",
"four_segments",
"five_segments",
"six_segments",
"seven_segments",
"full",
}
local function render_hud_health()
if currChar == 1 and characterTable[1].currAlt == 1 then
texture_override_reset("texture_power_meter_left_side")
texture_override_reset("texture_power_meter_right_side")
for i = 1, 8 do
texture_override_reset("texture_power_meter_" .. pieTextureNames[i])
end
return
-- Power meter animation called after emphasized mode.
-- Moves power meter y pos speed until it's at 200 to be visible.
local function animate_power_meter_deemphasizing()
local speed = 5;
if (sPowerMeterHUD.y >= 181) then
speed = 3;
end
local textureTable = characterTable[currChar][characterTable[currChar].currAlt].healthTexture
if textureTable then -- sets health HUD to custom textures
if textureTable.label.left and textureTable.label.right then -- if left and right label textures exist. BOTH have to exist to be set!
texture_override_set("texture_power_meter_left_side", textureTable.label.left)
texture_override_set("texture_power_meter_right_side", textureTable.label.right)
end
for i = 1, 8 do
texture_override_set("texture_power_meter_" .. pieTextureNames[i], (textureTable.pie and textureTable.pie[i]) and textureTable.pie[i] or defaultMeterInfo.pie[i])
if (sPowerMeterHUD.y >= 191) then
speed = 2;
end
if (sPowerMeterHUD.y >= 196) then
speed = 1;
end
sPowerMeterHUD.y = sPowerMeterHUD.y + speed;
if (sPowerMeterHUD.y >= 201) then
sPowerMeterHUD.y = 200;
sPowerMeterPrevY = 200;
sPowerMeterHUD.animation = POWER_METER_VISIBLE;
end
end
-- Power meter animation called when there's 8 health segments.
-- Moves power meter y pos quickly until it's at 301 to be hidden.
local function animate_power_meter_hiding()
sPowerMeterHUD.y = sPowerMeterHUD.y + 20;
if (sPowerMeterHUD.y >= 301) then
sPowerMeterHUD.animation = POWER_METER_HIDDEN;
sPowerMeterVisibleTimer = 0;
end
end
-- Handles power meter actions depending of the health segments values.
local function handle_power_meter_actions(numHealthWedges)
local gPlayerCameraState = gMarioStates[0].statusForCamera
-- Show power meter if health is not full, less than 8
if (numHealthWedges < 8 and sPowerMeterStoredHealth == 8 and sPowerMeterHUD.animation == POWER_METER_HIDDEN) then
sPowerMeterHUD.animation = POWER_METER_EMPHASIZED;
sPowerMeterHUD.y = 166;
sPowerMeterPrevY = 166;
end
-- Show power meter if health is full, has 8
if (numHealthWedges == 8 and sPowerMeterStoredHealth == 7) then
sPowerMeterVisibleTimer = 0;
end
-- After health is full, hide power meter
if (numHealthWedges == 8 and sPowerMeterVisibleTimer > 45.0) then
sPowerMeterHUD.animation = POWER_METER_HIDING;
end
-- Update to match health value
sPowerMeterStoredHealth = numHealthWedges;
-- If Mario is swimming, keep power meter visible
if (gPlayerCameraState.action & ACT_FLAG_SWIMMING ~= 0) then
if (sPowerMeterHUD.animation == POWER_METER_HIDDEN
or sPowerMeterHUD.animation == POWER_METER_EMPHASIZED) then
sPowerMeterHUD.animation = POWER_METER_DEEMPHASIZING;
sPowerMeterHUD.y = 166;
sPowerMeterPrevY = 166;
end
else -- resets the health HUD
texture_override_set("texture_power_meter_left_side", defaultMeterInfo.label.left)
texture_override_set("texture_power_meter_right_side", defaultMeterInfo.label.right)
for i = 1, 8 do
texture_override_set("texture_power_meter_" .. pieTextureNames[i], defaultMeterInfo.pie[i])
end
end
sPowerMeterVisibleTimer = 0;
end
end
-- Renders the power meter that shows when Mario is in underwater
-- or has taken damage and has less than 8 health segments.
-- And calls a power meter animation function depending of the value defined.
local function render_hud_power_meter()
local shownHealthWedges = hud_get_value(HUD_DISPLAY_WEDGES);
sPowerMeterHUD.x = djui_hud_get_screen_width()*0.5 - 51
if (sPowerMeterHUD.animation ~= POWER_METER_HIDING) then
handle_power_meter_actions(shownHealthWedges);
end
if (sPowerMeterHUD.animation == POWER_METER_HIDDEN) then
return;
end
local powerMeterPrevY = sPowerMeterHUD.y
local anim = sPowerMeterHUD.animation
if anim == POWER_METER_EMPHASIZED then
animate_power_meter_emphasized();
elseif anim == POWER_METER_DEEMPHASIZING then
animate_power_meter_deemphasizing();
elseif anim == POWER_METER_HIDING then
animate_power_meter_hiding();
end
--render_dl_power_meter(shownHealthWedges);
render_health_meter_from_local_index_interpolated(0, gMarioStates[0].health, sPowerMeterHUD.x, 208 - powerMeterPrevY, 64, 64, sPowerMeterHUD.x, 208 - sPowerMeterHUD.y, 64, 64)
sPowerMeterVisibleTimer = sPowerMeterVisibleTimer + 1;
end
local function render_hud_act_select_course()
@ -506,8 +646,6 @@ local function render_hud_act_select_course()
end
local function render_hud_mario_lives()
og_hud_set_value(HUD_DISPLAY_FLAGS, og_hud_get_value(HUD_DISPLAY_FLAGS) & ~HUD_DISPLAY_FLAG_LIVES)
if (hud_get_value(HUD_DISPLAY_FLAGS) & HUD_DISPLAY_FLAG_LIVES) == 0 then return end
local x = 22
@ -518,8 +656,6 @@ local function render_hud_mario_lives()
end
local function render_hud_stars()
og_hud_set_value(HUD_DISPLAY_FLAGS, og_hud_get_value(HUD_DISPLAY_FLAGS) & ~HUD_DISPLAY_FLAG_STAR_COUNT)
if (hud_get_value(HUD_DISPLAY_FLAGS) & HUD_DISPLAY_FLAG_STAR_COUNT) == 0 then return end
if hud_get_flash ~= nil then
-- prevent star count from flashing outside of castle
@ -530,11 +666,11 @@ local function render_hud_stars()
end
end
local x = math_ceil(djui_hud_get_screen_width() - 76)
local x = math.ceil(djui_hud_get_screen_width() - 76)
if x % 2 ~= 0 then
x = x - 1
end
local y = math_ceil(240 - 209 - 16)
local y = math.ceil(240 - 209 - 16)
local showX = 0
local hudDisplayStars = hud_get_value(HUD_DISPLAY_STARS)
@ -548,15 +684,11 @@ local function render_hud_stars()
end
local function render_hud_camera_status()
if not HUD_DISPLAY_CAMERA_STATUS then return end
og_hud_set_value(HUD_DISPLAY_FLAGS, og_hud_get_value(HUD_DISPLAY_FLAGS) & ~HUD_DISPLAY_FLAG_CAMERA)
if (hud_get_value(HUD_DISPLAY_FLAGS) & HUD_DISPLAY_FLAG_CAMERA) == 0 then return end
if (hud_get_value(HUD_DISPLAY_FLAGS) & HUD_DISPLAY_FLAG_CAMERA) == 0 or (hud_get_value(HUD_DISPLAY_FLAGS) & HUD_DISPLAY_FLAG_CAMERA_AND_POWER) == 0 then return end
local x = djui_hud_get_screen_width() - 54
local y = 205
local cameraHudStatus = hud_get_value(HUD_DISPLAY_CAMERA_STATUS)
local cameraHudStatus = hud_get_value(HUD_DISPLAY_CAMERA_STATUS) -- doesn't show the status of freecam because it's currently bugged when we hide the hud camera -- TODO: keep nagging the coopers to "fix `hud_get_value(HUD_DISPLAY_CAMERA_STATUS)` when using freecam and hiding the hud camera" :trollface:
if cameraHudStatus == CAM_STATUS_NONE then return end
@ -585,24 +717,86 @@ local function render_hud_camera_status()
end
-- Act Select Hud --
local STAR_SELECTOR_NOT_SELECTED = 0
local STAR_SELECTOR_SELECTED = 1
local STAR_SELECTOR_100_COINS = 2
local sVisibleStars = 0
local function render_act_select_hud()
local course = gNetworkPlayers[0].currCourseNum
if gServerSettings.enablePlayersInLevelDisplay == 0 or course == 0 or obj_get_first_with_behavior_id(id_bhvActSelector) == nil or act_select_hud_is_hidden(ACT_SELECT_HUD_PLAYERS_IN_LEVEL) then return end
if course == 0 or not obj_get_first_with_behavior_id(id_bhvActSelector) then return end
local starBhvCount = count_objects_with_behavior(get_behavior_from_id(id_bhvActSelectorStarType))
local sVisibleStars = starBhvCount < 6 and starBhvCount or 6
if sVisibleStars == 0 then
local starObj = obj_get_first_with_behavior_id(id_bhvActSelectorStarType)
while starObj do
if starObj.oStarSelectorType ~= STAR_SELECTOR_100_COINS then
sVisibleStars = sVisibleStars + 1
end
starObj = obj_get_next_with_same_behavior_id(starObj)
end
end
for a = 1, sVisibleStars do
local x = (139 - sVisibleStars * 17 + a * 34) + (djui_hud_get_screen_width() / 2) - 160 + 0.5
for j = 1, MAX_PLAYERS - 1 do -- 0 is not needed due to the due to the fact that you are never supposed to see yourself in the act
for j = 1, MAX_PLAYERS - 1 do -- 0 is not needed, you're never supposed to see yourself in act select
local np = gNetworkPlayers[j]
if np and np.connected and np.currCourseNum == course and np.currActNum == a then
djui_hud_render_rect(x - 4, 17, 16, 16)
render_life_icon_from_local_index(j, x - 4, 17, 1)
break
end
end
end
local selectedStar = obj_get_first_with_behavior_id(id_bhvActSelectorStarType)
local starsList = {}
while selectedStar do
table.insert(starsList, selectedStar)
selectedStar = obj_get_next_with_same_behavior_id(selectedStar)
end
if (sVisibleStars > 0) then
local playersInAct = 0
local sSelectedActIndex = 0
for i = 1, #starsList do
local curStar = starsList[i]
if curStar.oStarSelectorType == STAR_SELECTOR_SELECTED then
sSelectedActIndex = i - 1
end
end
local gCurrCourseNum = gNetworkPlayers[0].currCourseNum
for j = 1, MAX_PLAYERS - 1 do
local np = gNetworkPlayers[j]
if not (np or np.connected) then goto continue end
if (np.currCourseNum ~= gCurrCourseNum) then goto continue end
if (np.currActNum ~= sSelectedActIndex + 1) then goto continue end
playersInAct = playersInAct + 1
::continue::
end
if (playersInAct > 0) then
local message = ""
if (playersInAct == 1) then
message = message .. " Join "
else
message = message .. string.format("%d Players", playersInAct)
end
djui_hud_set_font(FONT_NORMAL)
djui_hud_set_color(100, 100, 100, 255)
local textScale = .5
local textWidth = djui_hud_measure_text(message) * textScale
local xPos = ((sSelectedActIndex + 1) * 34 - sVisibleStars * 17 + 139 - (textWidth / 2) + 4) + (djui_hud_get_screen_width() / 2) - 160 + 2
local yPos = -1
if message:find("Players") then
message = string.format("%d Player", playersInAct)
end
djui_hud_print_text(message, xPos, yPos, textScale) -- Not fully accurate because the font in act select is stretched in a way unachievable with normal fonts, will revisit in the future
end
end
end
---@param table table
@ -670,10 +864,11 @@ function render_playerlist_and_modlist()
local entryY = y + 88 + ((entryHeight + 4) * (i-1))
djui_hud_render_rect(entryX, entryY, entryWidth, entryHeight)
local capColor = network_player_get_override_palette_color(np, CAP)
playerNameColor = {
r = 127 + network_player_get_override_palette_color_channel(np, CAP, 0) / 2,
g = 127 + network_player_get_override_palette_color_channel(np, CAP, 1) / 2,
b = 127 + network_player_get_override_palette_color_channel(np, CAP, 2) / 2
r = 127 + capColor.r/2,
g = 127 + capColor.g/2,
b = 127 + capColor.b/2
}
djui_hud_set_color(255, 255, 255, 255)
@ -733,7 +928,6 @@ function render_playerlist_and_modlist()
end
-- Yes the ending stuffs is hardcoded, no there's not much of a better way to do it
local DIALOG_ENDING_REPLACE_1 = "$CHARNAME!"
local DIALOG_ENDING_REPLACE_2 = "Thank you $CHARNAME!"
local DIALOG_ENDING_REPLACE_3 = "...for $CHARNAME..."
@ -751,7 +945,7 @@ local function render_hud_ending_dialog()
local width = djui_hud_get_screen_width()
local charName = characterTable[currChar][characterTable[currChar].currAlt].name
local charName = characterTable[currChar].nickname
local string = ""
local startTime = 0
local endTime = 0
@ -792,47 +986,184 @@ local function render_hud_ending_dialog()
end
end
-- Nametags Powermeter Hud --
local nametagsActionBlacklist = {
[ACT_START_CROUCHING] = true,
[ACT_CROUCHING] = true,
[ACT_STOP_CROUCHING] = true,
[ACT_START_CRAWLING] = true,
[ACT_CRAWLING] = true,
[ACT_STOP_CRAWLING] = true,
[ACT_IN_CANNON] = true,
[ACT_DISAPPEARED] = true,
}
local FADE_SCALE = 4.0
--- @class StateExtras
--- @field public prevPos Vec3f
--- @field public prevScale number
--- @field public inited boolean
--- @type StateExtras[]
local sStateExtras = {}
for i = 0, MAX_PLAYERS - 1 do
sStateExtras[i] = {}
local _ENV = setmetatable(sStateExtras[i], { __index = _G })
prevPos = gVec3fZero()
prevScale = 0.0
inited = false
end
local function render_nametag_powermeter()
local sGlobalTimer = get_global_timer()
for i = 1, MAX_PLAYERS - 1 do
local m = gMarioStates[i]
if is_player_active(m) == 0 then goto continue end
local np = gNetworkPlayers[i]
if not np.currAreaSyncValid then goto continue end
if nametagsActionBlacklist[m.action] then goto continue end
if (m.marioBodyState.mirrorMario or m.marioBodyState.updateHeadPosTime ~= sGlobalTimer) then goto continue end
local pos = gVec3fZero()
local out = gVec3fZero()
vec3f_copy(pos, m.marioBodyState.headPos)
pos.y = pos.y + 100
if not djui_hud_world_pos_to_screen_pos(pos, out) then
goto continue
end
local scale = -300 / out.z * djui_hud_get_fov_coeff()
out.y = out.y - 16 * scale
local alpha = (math.min(np.fadeOpacity << 3, 255)) * math.clamp(FADE_SCALE - scale, 0.0, 1.0)
local e = sStateExtras[i]
if not e.inited then
vec3f_copy(e.prevPos, out)
e.prevScale = scale
e.inited = true
end
if gNametagsSettings.showHealth then
djui_hud_set_color(255, 255, 255, alpha)
local healthScale = 90 * scale
local prevHealthScale = 90 * e.prevScale
render_health_meter_from_local_index_interpolated(i, m.health,
e.prevPos.x - (prevHealthScale * 0.5), e.prevPos.y - 72 * scale, prevHealthScale, prevHealthScale,
out.x - ( healthScale * 0.5), out.y - 72 * scale, healthScale, healthScale
)
end
vec3f_copy(e.prevPos, out)
e.prevScale = scale
::continue::
end
end
local function nametags_reset()
for i = 0, MAX_PLAYERS - 1 do
sStateExtras[i].inited = false
end
end
local function on_level_init()
nametags_reset()
end
hook_event(HOOK_ON_LEVEL_INIT, on_level_init)
local sServerSettings = gServerSettings
local sNametagsSettings = gNametagsSettings
_G.gServerSettings = {
enablePlayerList = sServerSettings.enablePlayerList,
enablePlayersInLevelDisplay = sServerSettings.enablePlayersInLevelDisplay,
}
_G.gNametagsSettings = {
showHealth = sNametagsSettings.showHealth,
}
local _ServerSettingsMetaTable = {
__index = function (t, k)
return rawget(t, k) or sServerSettings[k]
end,
__newindex = function (_, k, v)
sServerSettings[k] = v
end,
}
local _NametagsSettingsMetaTable = {
__index = function (t, k)
return rawget(t, k) or sNametagsSettings[k]
end,
__newindex = function (_, k, v)
sNametagsSettings[k] = v
end,
}
setmetatable(gServerSettings, _ServerSettingsMetaTable)
setmetatable(gNametagsSettings, _NametagsSettingsMetaTable)
function nametags_settings()
if sNametagsSettings.showHealth then
gNametagsSettings.showHealth = not gNametagsSettings.showHealth
end
sNametagsSettings.showHealth = false
end
hook_event(HOOK_ON_NAMETAGS_RENDER, nametags_settings)
local function on_hud_render_behind()
FONT_USER = djui_menu_get_font()
djui_hud_set_resolution(RESOLUTION_N64)
djui_hud_set_font(FONT_HUD)
render_nametag_powermeter() -- Render before setting the color, it sets its own
djui_hud_set_color(255, 255, 255, 255)
if gNetworkPlayers[0].currActNum == 99 or gMarioStates[0].action == ACT_INTRO_CUTSCENE or hud_is_hidden() then
return
end
if gNetworkPlayers[0].currActNum == 99 or gMarioStates[0].action == ACT_INTRO_CUTSCENE or hud_is_hidden() then return end
if obj_get_first_with_behavior_id(id_bhvActSelector) == nil then
sServerSettings.enablePlayersInLevelDisplay = 0 -- Disables the original playersInLevel Display
local enablePlayersInLevelDisplay = gServerSettings.enablePlayersInLevelDisplay
if not obj_get_first_with_behavior_id(id_bhvActSelector) then
render_hud_mario_lives()
render_hud_stars()
render_hud_camera_status()
render_hud_health()
render_hud_power_meter()
sVisibleStars = 0
else
if enablePlayersInLevelDisplay then
render_act_select_hud()
end
render_hud_act_select_course()
end
end
-- Can't name this charSelect due to o-api.lua overriding it, if I did so, using character select with no packs would make it nil
_G.gServerSettingsCS = {
enablePlayerList = true -- Set to false to disable the playerlist
}
local function on_hud_render()
djui_hud_set_resolution(RESOLUTION_N64)
djui_hud_set_font(FONT_HUD)
djui_hud_set_color(255, 255, 255, 255)
if obj_get_first_with_behavior_id(id_bhvActSelector) ~= nil then
render_act_select_hud()
end
if gNetworkPlayers[0].currActNum == 99 then
render_hud_ending_dialog()
end
gServerSettings.enablePlayerList = false -- Disables the original playerlist and modlist
sServerSettings.enablePlayerList = 0 -- Disables the original playerlist and modlist
local enablePlayerList = gServerSettingsCS.enablePlayerList -- gServerSettings.enablePlayerList but for the character select playerlist
local enablePlayerList = gServerSettings.enablePlayerList
djui_hud_set_resolution(RESOLUTION_DJUI)
if djui_attempting_to_open_playerlist() and enablePlayerList then

File diff suppressed because it is too large Load diff

View file

@ -2,173 +2,245 @@
if incompatibleClient then return 0 end
local function find_character_number(index)
if not startup_init_stall() then return 0 end
if index == nil then index = 0 end
for i = 1, #characterTable do
if characterTable[i].saveName == gCSPlayers[index].saveName then
return i
end
end
return 1
return 0
end
local function is_moveset_restricted()
return gGlobalSyncTable.charSelectRestrictMovesets > 0
end
local function mario_update(m)
if stopMovesets or not gCSPlayers[m.playerIndex].movesetToggle then return end
if is_moveset_restricted() or not gCSPlayers[m.playerIndex].movesetToggle then return end
local hook = HOOK_MARIO_UPDATE
local currMoveset = characterMovesets[find_character_number(m.playerIndex)]
if currMoveset == nil or currMoveset[hook] == nil then return end
return currMoveset[hook](m)
local returnVar = currMoveset[hook](m)
if returnVar ~= nil then
return returnVar
end
end
hook_event(HOOK_MARIO_UPDATE, mario_update)
local function before_mario_update(m)
if stopMovesets or not gCSPlayers[m.playerIndex].movesetToggle then return end
if is_moveset_restricted() or not gCSPlayers[m.playerIndex].movesetToggle then return end
local hook = HOOK_BEFORE_MARIO_UPDATE
local currMoveset = characterMovesets[find_character_number(m.playerIndex)]
if currMoveset == nil or currMoveset[hook] == nil then return end
return currMoveset[hook](m)
local returnVar = currMoveset[hook](m)
if returnVar ~= nil then
return returnVar
end
end
hook_event(HOOK_BEFORE_MARIO_UPDATE, before_mario_update)
local function before_phys_step(m, stepType)
if stopMovesets or not gCSPlayers[m.playerIndex].movesetToggle then return end
local function before_phys_step(m, stepType, stepArg)
if is_moveset_restricted() or not gCSPlayers[m.playerIndex].movesetToggle then return end
local hook = HOOK_BEFORE_PHYS_STEP
local currMoveset = characterMovesets[find_character_number(m.playerIndex)]
if currMoveset == nil or currMoveset[hook] == nil then return end
return currMoveset[hook](m, stepType)
local returnVar = currMoveset[hook](m, stepType, stepArg)
if returnVar ~= nil then
return returnVar
end
end
hook_event(HOOK_BEFORE_PHYS_STEP, before_phys_step)
local function allow_pvp_attack(attacker, victim, int)
if stopMovesets then return end
if is_moveset_restricted() then return end
local hook = HOOK_ALLOW_PVP_ATTACK
local attackerMoveset = characterMovesets[find_character_number(attacker.playerIndex)]
local victimMoveset = characterMovesets[find_character_number(victim.playerIndex)]
local returnVar
if gCSPlayers[attacker.playerIndex].movesetToggle then
if (attackerMoveset ~= nil and attackerMoveset[hook] ~= nil) then
attackerMoveset[hook](attacker, victim, int)
returnVar = attackerMoveset[hook](attacker, victim, int)
if returnVar ~= nil then
return returnVar
end
end
end
if gCSPlayers[victim.playerIndex].movesetToggle then
if (victimMoveset ~= nil and victimMoveset[hook] ~= nil) then
victimMoveset[hook](attacker, victim, int)
returnVar = victimMoveset[hook](attacker, victim, int)
if returnVar ~= nil then
return returnVar
end
end
end
end
hook_event(HOOK_ALLOW_PVP_ATTACK, allow_pvp_attack)
local function on_pvp_attack(attacker, victim, int)
if stopMovesets then return end
if is_moveset_restricted() then return end
local hook = HOOK_ON_PVP_ATTACK
local attackerMoveset = characterMovesets[find_character_number(attacker.playerIndex)]
local victimMoveset = characterMovesets[find_character_number(victim.playerIndex)]
if gCSPlayers[attacker.playerIndex].movesetToggle then
if (attackerMoveset ~= nil and attackerMoveset[hook] ~= nil) then
attackerMoveset[hook](attacker, victim, int)
local returnVar = attackerMoveset[hook](attacker, victim, int)
if returnVar ~= nil then
return returnVar
end
end
end
if gCSPlayers[victim.playerIndex].movesetToggle then
if (victimMoveset ~= nil and victimMoveset[hook] ~= nil) then
victimMoveset[hook](attacker, victim, int)
local returnVar = victimMoveset[hook](attacker, victim, int)
if returnVar ~= nil then
return returnVar
end
end
end
end
hook_event(HOOK_ON_PVP_ATTACK, on_pvp_attack)
local function on_interact(m, o, intType, intValue)
if stopMovesets or not gCSPlayers[m.playerIndex].movesetToggle then return end
if is_moveset_restricted() or not gCSPlayers[m.playerIndex].movesetToggle then return end
local hook = HOOK_ON_INTERACT
local currMoveset = characterMovesets[find_character_number(m.playerIndex)]
if currMoveset == nil or currMoveset[hook] == nil then return end
return currMoveset[hook](m, o, intType, intValue)
local returnVar = currMoveset[hook](m, o, intType, intValue)
if returnVar ~= nil then
return returnVar
end
end
hook_event(HOOK_ON_INTERACT, on_interact)
local function allow_interact(m, o, intType)
if stopMovesets or not gCSPlayers[m.playerIndex].movesetToggle then return end
if is_moveset_restricted() or not gCSPlayers[m.playerIndex].movesetToggle then return end
local hook = HOOK_ALLOW_INTERACT
local currMoveset = characterMovesets[find_character_number(m.playerIndex)]
if currMoveset == nil or currMoveset[hook] == nil then return end
return currMoveset[hook](m, o, intType)
local returnVar = currMoveset[hook](m, o, intType)
if returnVar ~= nil then
return returnVar
end
end
hook_event(HOOK_ALLOW_INTERACT, allow_interact)
local function on_set_mario_action(m)
if stopMovesets or not gCSPlayers[m.playerIndex].movesetToggle then return end
if is_moveset_restricted() or not gCSPlayers[m.playerIndex].movesetToggle then return end
local hook = HOOK_ON_SET_MARIO_ACTION
local currMoveset = characterMovesets[find_character_number(m.playerIndex)]
if currMoveset == nil or currMoveset[hook] == nil then return end
return currMoveset[hook](m)
local returnVar = currMoveset[hook](m)
if returnVar ~= nil then
return returnVar
end
end
hook_event(HOOK_ON_SET_MARIO_ACTION, on_set_mario_action)
local function before_set_mario_action(m, nextAct)
if stopMovesets or not gCSPlayers[m.playerIndex].movesetToggle then return end
local function before_set_mario_action(m, nextAct, actionArg)
if is_moveset_restricted() or not gCSPlayers[m.playerIndex].movesetToggle then return end
local hook = HOOK_BEFORE_SET_MARIO_ACTION
local currMoveset = characterMovesets[find_character_number(m.playerIndex)]
if currMoveset == nil or currMoveset[hook] == nil then return end
return currMoveset[hook](m, nextAct)
local returnVar = currMoveset[hook](m, nextAct, actionArg)
if returnVar ~= nil then
return returnVar
end
end
hook_event(HOOK_BEFORE_SET_MARIO_ACTION, before_set_mario_action)
local function on_death(m)
if stopMovesets or not gCSPlayers[m.playerIndex].movesetToggle then return end
if is_moveset_restricted() or not gCSPlayers[m.playerIndex].movesetToggle then return end
local hook = HOOK_ON_DEATH
local currMoveset = characterMovesets[find_character_number(m.playerIndex)]
if currMoveset == nil or currMoveset[hook] == nil then return end
return currMoveset[hook](m)
local returnVar = currMoveset[hook](m)
if returnVar ~= nil then
return returnVar
end
end
hook_event(HOOK_ON_DEATH, on_death)
local function hud_render()
if stopMovesets or not gCSPlayers[0].movesetToggle then return end
if is_moveset_restricted() or not gCSPlayers[0].movesetToggle then return end
local hook = HOOK_ON_HUD_RENDER
local currMoveset = characterMovesets[find_character_number(0)]
if currMoveset == nil or currMoveset[hook] == nil then return end
return currMoveset[hook]()
local returnVar = currMoveset[hook]()
if returnVar ~= nil then
return returnVar
end
end
hook_event(HOOK_ON_HUD_RENDER, hud_render)
local function hud_render_behind()
if stopMovesets or not gCSPlayers[0].movesetToggle then return end
if is_moveset_restricted() or not gCSPlayers[0].movesetToggle then return end
local hook = HOOK_ON_HUD_RENDER_BEHIND
local currMoveset = characterMovesets[find_character_number(0)]
if currMoveset == nil or currMoveset[hook] == nil then return end
return currMoveset[hook]()
local returnVar = currMoveset[hook]()
if returnVar ~= nil then
return returnVar
end
end
hook_event(HOOK_ON_HUD_RENDER_BEHIND, hud_render_behind)
local function level_init()
if stopMovesets or not gCSPlayers[0].movesetToggle then return end
local function level_init(type, levelNum, areaIdx, nodeId, arg)
if is_moveset_restricted() or not gCSPlayers[0].movesetToggle then return end
local hook = HOOK_ON_LEVEL_INIT
local currMoveset = characterMovesets[find_character_number(0)]
if currMoveset == nil or currMoveset[hook] == nil then return end
return currMoveset[hook]()
local returnVar = currMoveset[hook](type, levelNum, areaIdx, nodeId, arg)
if returnVar ~= nil then
return returnVar
end
end
hook_event(HOOK_ON_LEVEL_INIT, level_init)
local function sync_valid()
if stopMovesets or not gCSPlayers[0].movesetToggle then return end
if is_moveset_restricted() or not gCSPlayers[0].movesetToggle then return end
local hook = HOOK_ON_SYNC_VALID
local currMoveset = characterMovesets[find_character_number(0)]
if currMoveset == nil or currMoveset[hook] == nil then return end
return currMoveset[hook]()
local returnVar = currMoveset[hook]()
if returnVar ~= nil then
return returnVar
end
end
hook_event(HOOK_ON_SYNC_VALID, sync_valid)
local function object_render(obj)
if stopMovesets or not gCSPlayers[0].movesetToggle then return end
if is_moveset_restricted() or not gCSPlayers[0].movesetToggle then return end
local hook = HOOK_ON_OBJECT_RENDER
local currMoveset = characterMovesets[find_character_number(0)]
if currMoveset == nil or currMoveset[hook] == nil then return end
return currMoveset[hook](obj)
local returnVar = currMoveset[hook](obj)
if returnVar ~= nil then
return returnVar
end
end
hook_event(HOOK_ON_OBJECT_RENDER, object_render)
local function allow_water_action(m, water)
if stopMovesets or not gCSPlayers[0].movesetToggle then return end
if is_moveset_restricted() or not gCSPlayers[0].movesetToggle then return end
local hook = HOOK_ALLOW_FORCE_WATER_ACTION
local currMoveset = characterMovesets[find_character_number(0)]
if currMoveset == nil or currMoveset[hook] == nil then return end
return currMoveset[hook](m, water)
local returnVar = currMoveset[hook](m, water)
if returnVar ~= nil then
return returnVar
end
end
hook_event(HOOK_ALLOW_FORCE_WATER_ACTION, allow_water_action)
hook_event(HOOK_ALLOW_FORCE_WATER_ACTION, allow_water_action)
local function mario_override_floor_class(m, floorClass)
if is_moveset_restricted() or not gCSPlayers[0].movesetToggle then return end
local hook = HOOK_ALLOW_FORCE_WATER_ACTION
local currMoveset = characterMovesets[find_character_number(0)]
if currMoveset == nil or currMoveset[hook] == nil then return end
local returnVar = currMoveset[hook](m, floorClass)
if returnVar ~= nil then
return returnVar
end
end
hook_event(HOOK_MARIO_OVERRIDE_FLOOR_CLASS, mario_override_floor_class)

View file

@ -0,0 +1,391 @@
if incompatibleClient then return 0 end
-- localize functions to improve performance - z-palettes.lua
local network_player_set_override_palette_color,network_player_reset_override_palette = network_player_set_override_palette_color,network_player_reset_override_palette
characterColorPresets = {
[E_MODEL_MARIO] = {
currPalette = 1,
{
name = "Default",
[PANTS] = { r = 0x00, g = 0x00, b = 0xff },
[SHIRT] = { r = 0xff, g = 0x00, b = 0x00 },
[GLOVES] = { r = 0xff, g = 0xff, b = 0xff },
[SHOES] = { r = 0x72, g = 0x1c, b = 0x0e },
[HAIR] = { r = 0x73, g = 0x06, b = 0x00 },
[SKIN] = { r = 0xfe, g = 0xc1, b = 0x79 },
[CAP] = { r = 0xff, g = 0x00, b = 0x00 },
[EMBLEM] = { r = 0xff, g = 0x00, b = 0x00 },
},
{
name = "New Game +",
[PANTS] = { r = 0x19, g = 0x4b, b = 0xa3 },
[SHIRT] = { r = 0xff, g = 0x30, b = 0x33 },
[GLOVES] = { r = 0xdd, g = 0xdd, b = 0xdd },
[SHOES] = { r = 0x51, g = 0x28, b = 0x00 },
[HAIR] = { r = 0x58, g = 0x09, b = 0x00 },
[SKIN] = { r = 0xff, g = 0xaf, b = 0x8c },
[CAP] = { r = 0xff, g = 0x30, b = 0x33 },
[EMBLEM] = { r = 0xff, g = 0x30, b = 0x33 },
},
{
name = "Fire Flower",
[PANTS] = { r = 0xb2, g = 0x28, b = 0x18 },
[SHIRT] = { r = 0xff, g = 0xe0, b = 0xe0 },
[GLOVES] = { r = 0xff, g = 0xff, b = 0xff },
[SHOES] = { r = 0x72, g = 0x1c, b = 0x0e },
[HAIR] = { r = 0x73, g = 0x06, b = 0x00 },
[SKIN] = { r = 0xfe, g = 0xc1, b = 0x79 },
[CAP] = { r = 0xff, g = 0xe0, b = 0xe0 },
[EMBLEM] = { r = 0xff, g = 0x00, b = 0x00 },
},
{
name = "Burgundy",
[PANTS] = { r = 0x23, g = 0x11, b = 0x03 },
[SHIRT] = { r = 0x68, g = 0x0A, b = 0x17 },
[GLOVES] = { r = 0xFF, g = 0xFF, b = 0xFF },
[SHOES] = { r = 0x72, g = 0x1C, b = 0x0E },
[HAIR] = { r = 0x73, g = 0x06, b = 0x00 },
[SKIN] = { r = 0xFE, g = 0xC1, b = 0x79 },
[CAP] = { r = 0x68, g = 0x0A, b = 0x17 },
[EMBLEM] = { r = 0x68, g = 0x0A, b = 0x17 },
},
{
name = "Raspberry",
[PANTS] = { r = 0xD6, g = 0x35, b = 0x4D },
[SHIRT] = { r = 0x3B, g = 0x8F, b = 0xF7 },
[GLOVES] = { r = 0xFF, g = 0xFF, b = 0xFF },
[SHOES] = { r = 0x72, g = 0x1C, b = 0x0E },
[HAIR] = { r = 0x73, g = 0x06, b = 0x00 },
[SKIN] = { r = 0xFE, g = 0xC1, b = 0x79 },
[CAP] = { r = 0x3B, g = 0x8F, b = 0xF7 },
[EMBLEM] = { r = 0x3B, g = 0x8F, b = 0xF7 },
},
},
[E_MODEL_LUIGI] = {
currPalette = 1,
{
name = "Default",
[PANTS] = { r = 0x00, g = 0x00, b = 0xff },
[SHIRT] = { r = 0x00, g = 0xff, b = 0x00 },
[GLOVES] = { r = 0xff, g = 0xff, b = 0xff },
[SHOES] = { r = 0x72, g = 0x1c, b = 0x0e },
[HAIR] = { r = 0x73, g = 0x06, b = 0x00 },
[SKIN] = { r = 0xfe, g = 0xc1, b = 0x79 },
[CAP] = { r = 0x00, g = 0xff, b = 0x00 },
[EMBLEM] = { r = 0x00, g = 0xff, b = 0x00 },
},
{
name = "Mint",
[PANTS] = { r = 0x53, g = 0x39, b = 0x3D },
[SHIRT] = { r = 0x95, g = 0xD0, b = 0x8F },
[GLOVES] = { r = 0xFF, g = 0xFF, b = 0xFF },
[SHOES] = { r = 0x72, g = 0x1C, b = 0x0E },
[HAIR] = { r = 0x73, g = 0x06, b = 0x00 },
[SKIN] = { r = 0xFE, g = 0xC1, b = 0x79 },
[CAP] = { r = 0x95, g = 0xD0, b = 0x8F },
[EMBLEM] = { r = 0x95, g = 0xD0, b = 0x8F },
},
{
name = "Cold Crevase",
[PANTS] = { r = 0xD4, g = 0xDF, b = 0xE7 },
[SHIRT] = { r = 0x51, g = 0xA9, b = 0x9C },
[GLOVES] = { r = 0xFF, g = 0xFF, b = 0xFF },
[SHOES] = { r = 0x6B, g = 0x41, b = 0x00 },
[HAIR] = { r = 0x73, g = 0x06, b = 0x00 },
[SKIN] = { r = 0xFE, g = 0xC1, b = 0x79 },
[CAP] = { r = 0xD4, g = 0xDF, b = 0xE7 },
[EMBLEM] = { r = 0x51, g = 0xA9, b = 0x9C },
},
{
name = "Greedy",
[PANTS] = { r = 0x00, g = 0x48, b = 0x8a },
[SHIRT] = { r = 0xf7, g = 0xaf, b = 0x25 },
[GLOVES] = { r = 0xff, g = 0xff, b = 0xff },
[SHOES] = { r = 0xc0, g = 0x21, b = 0x00 },
[HAIR] = { r = 0x00, g = 0x00, b = 0x00 },
[SKIN] = { r = 0xfe, g = 0xc1, b = 0x79 },
[CAP] = { r = 0x00, g = 0x48, b = 0x8a },
[EMBLEM] = { r = 0x00, g = 0x00, b = 0x00 },
},
{
name = "Kindness",
[PANTS] = { r = 0xff, g = 0x44, b = 0xff },
[SHIRT] = { r = 0x93, g = 0x00, b = 0x90 },
[GLOVES] = { r = 0xff, g = 0x99, b = 0xff },
[SHOES] = { r = 0xaa, g = 0x2c, b = 0x66 },
[HAIR] = { r = 0xf3, g = 0x65, b = 0xda },
[SKIN] = { r = 0xc8, g = 0x6b, b = 0x9d },
[CAP] = { r = 0xef, g = 0x2b, b = 0xea },
[EMBLEM] = { r = 0xef, g = 0x2b, b = 0xea },
},
},
[E_MODEL_TOAD_PLAYER] = {
currPalette = 1,
{
name = "Default",
[PANTS] = { r = 0xff, g = 0xff, b = 0xff },
[SHIRT] = { r = 0x4c, g = 0x2c, b = 0xd3 },
[GLOVES] = { r = 0xff, g = 0xff, b = 0xff },
[SHOES] = { r = 0x68, g = 0x40, b = 0x1b },
[HAIR] = { r = 0x73, g = 0x06, b = 0x00 },
[SKIN] = { r = 0xfe, g = 0xd5, b = 0xa1 },
[CAP] = { r = 0xff, g = 0x00, b = 0x00 },
[EMBLEM] = { r = 0xff, g = 0x00, b = 0x00 },
},
{
name = "Bucken Berry",
[PANTS] = { r = 0xff, g = 0xff, b = 0xff },
[SHIRT] = { r = 0x00, g = 0x00, b = 0xff },
[GLOVES] = { r = 0xff, g = 0xff, b = 0xff },
[SHOES] = { r = 0x68, g = 0x40, b = 0x1b },
[HAIR] = { r = 0x73, g = 0x06, b = 0x00 },
[SKIN] = { r = 0xfe, g = 0xd5, b = 0xa1 },
[CAP] = { r = 0x00, g = 0x00, b = 0xff },
[EMBLEM] = { r = 0x00, g = 0x00, b = 0xff },
},
{
name = "Ala Gold",
[PANTS] = { r = 0xff, g = 0xff, b = 0xff },
[SHIRT] = { r = 0xff, g = 0xff, b = 0x00 },
[GLOVES] = { r = 0xff, g = 0xff, b = 0xff },
[SHOES] = { r = 0x68, g = 0x40, b = 0x1b },
[HAIR] = { r = 0x73, g = 0x06, b = 0x00 },
[SKIN] = { r = 0xfe, g = 0xd5, b = 0xa1 },
[CAP] = { r = 0xff, g = 0xff, b = 0x00 },
[EMBLEM] = { r = 0xff, g = 0xff, b = 0x00 },
},
{
name = "Jet Black",
[PANTS] = { r = 0x1A, g = 0x1A, b = 0x1A },
[SHIRT] = { r = 0x2C, g = 0x2C, b = 0x2C },
[GLOVES] = { r = 0x64, g = 0x64, b = 0x64 },
[SHOES] = { r = 0x64, g = 0x64, b = 0x64 },
[HAIR] = { r = 0x73, g = 0x06, b = 0x00 },
[SKIN] = { r = 0xFE, g = 0xC1, b = 0x79 },
[CAP] = { r = 0x1A, g = 0x1A, b = 0x1A },
[EMBLEM] = { r = 0x1A, g = 0x1A, b = 0x1A },
},
{
name = "Hot Pink",
[PANTS] = { r = 0x34, g = 0x16, b = 0x0D },
[SHIRT] = { r = 0xC1, g = 0x2C, b = 0x72 },
[GLOVES] = { r = 0xFF, g = 0xFF, b = 0xFF },
[SHOES] = { r = 0x72, g = 0x1C, b = 0x0E },
[HAIR] = { r = 0x73, g = 0x06, b = 0x00 },
[SKIN] = { r = 0xFE, g = 0xC1, b = 0x79 },
[CAP] = { r = 0xC1, g = 0x2C, b = 0x72 },
[EMBLEM] = { r = 0xC1, g = 0x2C, b = 0x72 },
},
{
name = "Goomba",
[PANTS] = { r = 0xC6, g = 0xB1, b = 0x32 },
[SHIRT] = { r = 0x95, g = 0x43, b = 0x01 },
[GLOVES] = { r = 0xFF, g = 0xFF, b = 0xFF },
[SHOES] = { r = 0x72, g = 0x1C, b = 0x0E },
[HAIR] = { r = 0x73, g = 0x06, b = 0x00 },
[SKIN] = { r = 0xFE, g = 0xC1, b = 0x79 },
[CAP] = { r = 0x95, g = 0x43, b = 0x01 },
[EMBLEM] = { r = 0x95, g = 0x43, b = 0x01 },
},
},
[E_MODEL_WALUIGI] = {
currPalette = 1,
{
name = "Default",
[PANTS] = { r = 0x16, g = 0x16, b = 0x27 },
[SHIRT] = { r = 0x61, g = 0x26, b = 0xb0 },
[GLOVES] = { r = 0xff, g = 0xff, b = 0xff },
[SHOES] = { r = 0xfe, g = 0x76, b = 0x00 },
[HAIR] = { r = 0x73, g = 0x53, b = 0x00 },
[SKIN] = { r = 0xfe, g = 0xc1, b = 0x79 },
[CAP] = { r = 0x61, g = 0x26, b = 0xb0 },
[EMBLEM] = { r = 0xff, g = 0xde, b = 0x00 },
},
{
name = "Cobalt",
[PANTS] = { r = 0x3F, g = 0x3F, b = 0xFF },
[SHIRT] = { r = 0x0A, g = 0x0A, b = 0x28 },
[GLOVES] = { r = 0xFF, g = 0xFF, b = 0xFF },
[SHOES] = { r = 0x39, g = 0x0E, b = 0x07 },
[HAIR] = { r = 0x73, g = 0x06, b = 0x00 },
[SKIN] = { r = 0xFE, g = 0xC1, b = 0x79 },
[CAP] = { r = 0x3F, g = 0x3F, b = 0xFF },
[EMBLEM] = { r = 0x3F, g = 0x3F, b = 0xFF },
},
{
name = "Clover",
[PANTS] = { r = 0x14, g = 0x19, b = 0x14 },
[SHIRT] = { r = 0x4C, g = 0x5F, b = 0x20 },
[GLOVES] = { r = 0xFF, g = 0xFF, b = 0xFF },
[SHOES] = { r = 0x72, g = 0x1C, b = 0x0E },
[HAIR] = { r = 0x73, g = 0x06, b = 0x00 },
[SKIN] = { r = 0xFE, g = 0xC1, b = 0x79 },
[CAP] = { r = 0x4C, g = 0x5F, b = 0x20 },
[EMBLEM] = { r = 0x4C, g = 0x5F, b = 0x20 },
},
{
name = "Blueberry Pie",
[PANTS] = { r = 0xEB, g = 0x8A, b = 0x4B },
[SHIRT] = { r = 0x10, g = 0x1B, b = 0x2E },
[GLOVES] = { r = 0xFF, g = 0xFF, b = 0xFF },
[SHOES] = { r = 0x72, g = 0x1C, b = 0x0E },
[HAIR] = { r = 0x73, g = 0x06, b = 0x00 },
[SKIN] = { r = 0xFE, g = 0xC1, b = 0x79 },
[CAP] = { r = 0x10, g = 0x1B, b = 0x2E },
[EMBLEM] = { r = 0x10, g = 0x1B, b = 0x2E },
},
{
name = "Tennis Loser",
[PANTS] = { r = 0x16, g = 0x16, b = 0x27 },
[SHIRT] = { r = 0x5A, g = 0x39, b = 0x21 },
[GLOVES] = { r = 0xFF, g = 0xFF, b = 0xFF },
[SHOES] = { r = 0x5A, g = 0x00, b = 0xCE },
[HAIR] = { r = 0x29, g = 0x10, b = 0x00 },
[SKIN] = { r = 0xE7, g = 0xB5, b = 0x94 },
[CAP] = { r = 0x5A, g = 0x39, b = 0x21 },
[EMBLEM] = { r = 0xFF, g = 0xDE, b = 0x00 },
},
{
name = "Sealed Away",
[PANTS] = { r = 0x00, g = 0x98, b = 0x00 },
[SHIRT] = { r = 0x47, g = 0xc5, b = 0xff },
[GLOVES] = { r = 0xff, g = 0xff, b = 0xff },
[SHOES] = { r = 0x72, g = 0x1c, b = 0x0e },
[HAIR] = { r = 0x73, g = 0x06, b = 0x00 },
[SKIN] = { r = 0xfe, g = 0xc1, b = 0x79 },
[CAP] = { r = 0x47, g = 0xc5, b = 0xff },
[EMBLEM] = { r = 0xff, g = 0xde, b = 0x00 },
},
},
[E_MODEL_WARIO] = {
currPalette = 1,
{
name = "Default",
[PANTS] = { r = 0x7f, g = 0x20, b = 0x7a },
[SHIRT] = { r = 0xff, g = 0xbd, b = 0x00 },
[GLOVES] = { r = 0xff, g = 0xff, b = 0xff },
[SHOES] = { r = 0x0e, g = 0x72, b = 0x1c },
[HAIR] = { r = 0x73, g = 0x53, b = 0x00 },
[SKIN] = { r = 0xfe, g = 0xc1, b = 0x79 },
[CAP] = { r = 0xff, g = 0xbd, b = 0x00 },
[EMBLEM] = { r = 0x00, g = 0x00, b = 0xff },
},
{
name = "Ruby",
[PANTS] = { r = 0xE1, g = 0x05, b = 0x31 },
[SHIRT] = { r = 0x28, g = 0x0A, b = 0x0A },
[GLOVES] = { r = 0xFF, g = 0xFF, b = 0xFF },
[SHOES] = { r = 0x39, g = 0x0E, b = 0x07 },
[HAIR] = { r = 0x73, g = 0x06, b = 0x00 },
[SKIN] = { r = 0xFE, g = 0xC1, b = 0x79 },
[CAP] = { r = 0xE1, g = 0x05, b = 0x31 },
[EMBLEM] = { r = 0xE1, g = 0x05, b = 0x31 },
},
{
name = "Eggplant",
[PANTS] = { r = 0xE6, g = 0xE3, b = 0xFF },
[SHIRT] = { r = 0x37, g = 0x32, b = 0x42 },
[GLOVES] = { r = 0xFF, g = 0xFF, b = 0xFF },
[SHOES] = { r = 0x72, g = 0x1C, b = 0x0E },
[HAIR] = { r = 0x73, g = 0x06, b = 0x00 },
[SKIN] = { r = 0xFE, g = 0xC1, b = 0x79 },
[CAP] = { r = 0x37, g = 0x32, b = 0x42 },
[EMBLEM] = { r = 0x37, g = 0x32, b = 0x42 },
},
{
name = "Battlements",
[PANTS] = { r = 0xF7, g = 0xC2, b = 0x45 },
[SHIRT] = { r = 0x55, g = 0x92, b = 0xB2 },
[GLOVES] = { r = 0xFF, g = 0xFF, b = 0xFF },
[SHOES] = { r = 0x72, g = 0x1C, b = 0x0E },
[HAIR] = { r = 0x73, g = 0x06, b = 0x00 },
[SKIN] = { r = 0xFE, g = 0xC1, b = 0x79 },
[CAP] = { r = 0x55, g = 0x92, b = 0xB2 },
[EMBLEM] = { r = 0x55, g = 0x92, b = 0xB2 },
},
{
name = "Cotten Candy",
[PANTS] = { r = 0x69, g = 0xa1, b = 0xff },
[SHIRT] = { r = 0xff, g = 0x7d, b = 0x89 },
[GLOVES] = { r = 0xff, g = 0xff, b = 0xff },
[SHOES] = { r = 0xb9, g = 0x48, b = 0xff },
[HAIR] = { r = 0x73, g = 0x53, b = 0x00 },
[SKIN] = { r = 0xfe, g = 0xc1, b = 0x79 },
[CAP] = { r = 0x69, g = 0xa1, b = 0xff },
[EMBLEM] = { r = 0xb9, g = 0x48, b = 0xff },
},
}
}
local paletteLoop = #characterColorPresets[E_MODEL_MARIO][1]
local function network_player_set_full_override_palette(networkPlayer, colorTable)
if colorTable == nil then return end
for i = 0, paletteLoop do
network_player_set_override_palette_color(networkPlayer, i, colorTable[i])
end
end
---@param np NetworkPlayer
function update_preset_palette(np)
local p = gCSPlayers[np.localIndex]
local modelId = p.modelId
if np.connected and gCSPlayers[0].presetPalette > 0 and characterColorPresets[modelId] and gGlobalSyncTable.charSelectRestrictPalettes == 0 then
network_player_set_full_override_palette(np, characterColorPresets[modelId][p.presetPalette])
end
end
local prevPresetPalette = {}
local prevModel = {}
local function mario_update(m)
local np = gNetworkPlayers[m.playerIndex]
local p = gCSPlayers[m.playerIndex]
if not startup_init_stall() then return end
if m.playerIndex == 0 and not p.isUpdating then
p.isUpdating = true
for i = 1, MAX_PLAYERS - 1 do
prevPresetPalette[i] = gCSPlayers[i].presetPalette
prevModel[i] = gCSPlayers[i].modelId
end
end
if m.playerIndex == 0 then
if gGlobalSyncTable.charSelectRestrictPalettes == 0 then
gCSPlayers[0].presetPalette = characterColorPresets[gCSPlayers[0].modelId] ~= nil and characterColorPresets[gCSPlayers[0].modelId].currPalette or 0
end
end
if np.connected then
if p.presetPalette == nil or characterColorPresets[p.modelId] == nil then
if p.presetPalette == nil then
prevPresetPalette[m.playerIndex] = 0
end
p.presetPalette = 0
end
if (prevPresetPalette[m.playerIndex] ~= p.presetPalette or prevModel[m.playerIndex] ~= p.modelId) then
if p.presetPalette == 0 or not characterColorPresets[p.modelId] then
network_player_reset_override_palette(np)
end
end
prevPresetPalette[m.playerIndex] = p.presetPalette
prevModel[m.playerIndex] = p.modelId
if p.presetPalette > 0 and characterColorPresets[p.modelId] and gGlobalSyncTable.charSelectRestrictPalettes == 0 then
network_player_set_full_override_palette(np, characterColorPresets[p.modelId][p.presetPalette])
end
else
if p.isUpdating then
p.isUpdating = false
end
end
end
hook_event(HOOK_MARIO_UPDATE, mario_update)

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.

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