Initial commit.

This commit is contained in:
Max 2022-10-13 03:53:17 -05:00
parent 54df585889
commit 585d94d2b2
45 changed files with 11194 additions and 0 deletions

2
.gitignore vendored Normal file
View file

@ -0,0 +1,2 @@
sourcemap.json

6
.vscode/settings.json vendored Normal file
View file

@ -0,0 +1,6 @@
{
"[lua]": {
"editor.defaultFormatter": "JohnnyMorganz.stylua",
"editor.formatOnSave": true
}
}

2
aftman.toml Normal file
View file

@ -0,0 +1,2 @@
[tools]
rojo = "rojo-rbx/rojo@7.2.1"

53
default.project.json Normal file
View file

@ -0,0 +1,53 @@
{
"name": "Super Mario 64",
"tree": {
"$className": "DataModel",
"$ignoreUnknownInstances": true,
"ReplicatedFirst": {
"$className": "ReplicatedFirst",
"$ignoreUnknownInstances": true,
"SM64": {
"$path": "SM64",
"$ignoreUnknownInstances": true
}
},
"ServerScriptService": {
"$className": "ServerScriptService",
"$ignoreUnknownInstances": true,
"LazyNetworking": {
"$path": "rbx/LazyNetworking.server.lua"
}
},
"StarterPlayer": {
"$className": "StarterPlayer",
"$ignoreUnknownInstances": true,
"StarterCharacterScripts": {
"$className": "StarterCharacterScripts",
"$ignoreUnknownInstances": true,
"Animate": {
"$className": "Hole"
},
"Sound": {
"$className": "Hole"
},
"Health": {
"$className": "Hole"
},
"Character": {
"$path": "rbx/Character.server.lua"
}
}
}
}
}

97
rbx/Character.server.lua Normal file
View file

@ -0,0 +1,97 @@
--!strict
local Players = game:GetService("Players")
local character: any = script.Parent
local player = Players:GetPlayerFromCharacter(character)
if not player then
return
end
local userId = player.UserId
local hDesc: HumanoidDescription?
local function patchCollision(desc: Instance)
if desc:IsA("BasePart") and desc.CollisionGroupId ~= 1 then
local canCollide = desc:GetPropertyChangedSignal("CanCollide")
desc.CollisionGroup = "Player"
desc.CanQuery = false
desc.CanTouch = false
desc.Massless = true
canCollide:Connect(function()
desc.CanCollide = false
end)
desc.CanCollide = false
end
end
local function patchAllCollision()
for i, desc in character:GetDescendants() do
task.spawn(patchCollision, desc)
end
end
task.spawn(patchAllCollision)
character.DescendantAdded:Connect(patchCollision)
local function reload()
for retry = 1, 10 do
local success, result = pcall(function()
return Players:GetHumanoidDescriptionFromUserId(userId)
end)
if success then
hDesc = result
break
else
task.wait(retry / 2)
end
end
if hDesc then
hDesc.HeadScale = 1.8
hDesc.WidthScale = 1.3
hDesc.DepthScale = 1.4
hDesc.HeightScale = 1.2
hDesc.BodyTypeScale = 0
hDesc.ProportionScale = 0
else
return
end
local humanoid = character:WaitForChild("Humanoid")
assert(hDesc)
if humanoid:IsA("Humanoid") then
while not humanoid.RootPart do
humanoid.Changed:Wait()
end
local rootPart = humanoid.RootPart
assert(rootPart, "No HumanoidRootPart??")
local particles = rootPart:FindFirstChild("Particles")
humanoid:ApplyDescription(hDesc)
if particles and particles:IsA("Attachment") then
local floorDec = humanoid.HipHeight + (rootPart.Size.Y / 2)
local pos = Vector3.new(0, -floorDec, 0)
rootPart.PivotOffset = CFrame.new(pos)
particles.Position = pos
end
end
end
local reset = Instance.new("RemoteEvent")
reset.Parent = character
reset.Name = "Reset"
reset.OnServerEvent:Connect(function(player)
if player == Players:GetPlayerFromCharacter(character) then
reload()
end
end)
task.spawn(reload)

View file

@ -0,0 +1,60 @@
--!strict
local Validators: { [string]: (Player, ...any) -> boolean } = {}
type Echo = () -> ()
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local ReplicatedFirst = game:GetService("ReplicatedFirst")
local PhysicsService = game:GetService("PhysicsService")
local Sounds = require(ReplicatedFirst.SM64.Sounds)
local lazy = Instance.new("RemoteEvent")
lazy.Parent = ReplicatedStorage
lazy.Name = "LazyNetwork"
function Validators.PlaySound(player: Player, name: string)
local sound: Instance? = Sounds[name]
if sound and sound:IsA("Sound") then
return true
end
return false
end
function Validators.SetParticle(player: Player, name: string, set: boolean?)
if typeof(name) ~= "string" then
return false
end
local character = player.Character
local rootPart = if character then character.PrimaryPart else nil
if rootPart then
local particles = rootPart:FindFirstChild("Particles")
local particle = if particles then particles:FindFirstChild(name) else nil
if particle then
return true
end
end
return false
end
function Validators.SetAngle(player: Player, angle: Vector3int16)
return typeof(angle) == "Vector3int16"
end
local function onNetworkReceive(player: Player, cmd: string, ...)
local validate = Validators[cmd]
if validate and validate(player, ...) then
lazy:FireAllClients(player, cmd, ...)
end
end
lazy.OnServerEvent:Connect(onNetworkReceive)
PhysicsService:CreateCollisionGroup("Player")
PhysicsService:CollisionGroupSetCollidable("Default", "Player", false)

1
selene.toml Normal file
View file

@ -0,0 +1 @@
std = "roblox"

229
sm64/Animations.lua Normal file
View file

@ -0,0 +1,229 @@
--!strict
local System = script.Parent
local Assets = System.Assets
local Anims = Assets.Animations
local Data = table.freeze({
SLOW_LEDGE_GRAB = Anims.SLOW_LEDGE_GRAB,
FALL_OVER_BACKWARDS = Anims.FALL_OVER_BACKWARDS,
BACKWARD_AIR_KB = Anims.BACKWARD_AIR_KB,
DYING_ON_BACK = Anims.DYING_ON_BACK,
BACKFLIP = Anims.BACKFLIP,
CLIMB_UP_POLE = Anims.CLIMB_UP_POLE,
GRAB_POLE_SHORT = Anims.GRAB_POLE_SHORT,
GRAB_POLE_SWING_PART1 = Anims.GRAB_POLE_SWING_PART1,
GRAB_POLE_SWING_PART2 = Anims.GRAB_POLE_SWING_PART2,
HANDSTAND_IDLE = Anims.HANDSTAND_IDLE,
HANDSTAND_JUMP = Anims.HANDSTAND_JUMP,
START_HANDSTAND = Anims.START_HANDSTAND,
RETURN_FROM_HANDSTAND = Anims.RETURN_FROM_HANDSTAND,
IDLE_ON_POLE = Anims.IDLE_ON_POLE,
A_POSE = Anims.A_POSE,
SKID_ON_GROUND = Anims.SKID_ON_GROUND,
STOP_SKID = Anims.STOP_SKID,
CROUCH_FROM_FAST_LONGJUMP = Anims.CROUCH_FROM_FAST_LONGJUMP,
CROUCH_FROM_SLOW_LONGJUMP = Anims.CROUCH_FROM_SLOW_LONGJUMP,
FAST_LONGJUMP = Anims.FAST_LONGJUMP,
SLOW_LONGJUMP = Anims.SLOW_LONGJUMP,
AIRBORNE_ON_STOMACH = Anims.AIRBORNE_ON_STOMACH,
WALK_WITH_LIGHT_OBJ = Anims.WALK_WITH_LIGHT_OBJ,
RUN_WITH_LIGHT_OBJ = Anims.RUN_WITH_LIGHT_OBJ,
SLOW_WALK_WITH_LIGHT_OBJ = Anims.SLOW_WALK_WITH_LIGHT_OBJ,
SHIVERING_WARMING_HAND = Anims.SHIVERING_WARMING_HAND,
SHIVERING_RETURN_TO_IDLE = Anims.SHIVERING_RETURN_TO_IDLE,
SHIVERING = Anims.SHIVERING,
CLIMB_DOWN_LEDGE = Anims.CLIMB_DOWN_LEDGE,
CREDITS_WAVING = Anims.CREDITS_WAVING,
CREDITS_LOOK_UP = Anims.CREDITS_LOOK_UP,
CREDITS_RETURN_FROM_LOOK_UP = Anims.CREDITS_RETURN_FROM_LOOK_UP,
CREDITS_RAISE_HAND = Anims.CREDITS_RAISE_HAND,
CREDITS_LOWER_HAND = Anims.CREDITS_LOWER_HAND,
CREDITS_TAKE_OFF_CAP = Anims.CREDITS_TAKE_OFF_CAP,
CREDITS_START_WALK_LOOK_UP = Anims.CREDITS_START_WALK_LOOK_UP,
CREDITS_LOOK_BACK_THEN_RUN = Anims.CREDITS_LOOK_BACK_THEN_RUN,
-- FINAL_BOWSER_RAISE_HAND_SPIN = Anims.FINAL_BOWSER_RAISE_HAND_SPIN;
-- FINAL_BOWSER_WING_CAP_TAKE_OFF = Anims.FINAL_BOWSER_WING_CAP_TAKE_OFF;
CREDITS_PEACE_SIGN = Anims.CREDITS_PEACE_SIGN,
STAND_UP_FROM_LAVA_BOOST = Anims.STAND_UP_FROM_LAVA_BOOST,
FIRE_LAVA_BURN = Anims.FIRE_LAVA_BURN,
WING_CAP_FLY = Anims.WING_CAP_FLY,
HANG_ON_OWL = Anims.HANG_ON_OWL,
LAND_ON_STOMACH = Anims.LAND_ON_STOMACH,
FORWARD_AIR_KB = Anims.FORWARD_AIR_KB,
DYING_ON_STOMACH = Anims.DYING_ON_STOMACH,
SUFFOCATING = Anims.SUFFOCATING,
COUGHING = Anims.COUGHING,
THROW_CATCH_KEY = Anims.THROW_CATCH_KEY,
DYING_FALL_OVER = Anims.DYING_FALL_OVER,
IDLE_ON_LEDGE = Anims.IDLE_ON_LEDGE,
FAST_LEDGE_GRAB = Anims.FAST_LEDGE_GRAB,
HANG_ON_CEILING = Anims.HANG_ON_CEILING,
PUT_CAP_ON = Anims.PUT_CAP_ON,
TAKE_CAP_OFF_THEN_ON = Anims.TAKE_CAP_OFF_THEN_ON,
QUICKLY_PUT_CAP_ON = Anims.QUICKLY_PUT_CAP_ON, -- unused
HEAD_STUCK_IN_GROUND = Anims.HEAD_STUCK_IN_GROUND,
GROUND_POUND_LANDING = Anims.GROUND_POUND_LANDING,
TRIPLE_JUMP_GROUND_POUND = Anims.TRIPLE_JUMP_GROUND_POUND,
START_GROUND_POUND = Anims.START_GROUND_POUND,
GROUND_POUND = Anims.GROUND_POUND,
BOTTOM_STUCK_IN_GROUND = Anims.BOTTOM_STUCK_IN_GROUND,
IDLE_WITH_LIGHT_OBJ = Anims.IDLE_WITH_LIGHT_OBJ,
JUMP_LAND_WITH_LIGHT_OBJ = Anims.JUMP_LAND_WITH_LIGHT_OBJ,
JUMP_WITH_LIGHT_OBJ = Anims.JUMP_WITH_LIGHT_OBJ,
FALL_LAND_WITH_LIGHT_OBJ = Anims.FALL_LAND_WITH_LIGHT_OBJ,
FALL_WITH_LIGHT_OBJ = Anims.FALL_WITH_LIGHT_OBJ,
FALL_FROM_SLIDING_WITH_LIGHT_OBJ = Anims.FALL_FROM_SLIDING_WITH_LIGHT_OBJ,
SLIDING_ON_BOTTOM_WITH_LIGHT_OBJ = Anims.SLIDING_ON_BOTTOM_WITH_LIGHT_OBJ,
STAND_UP_FROM_SLIDING_WITH_LIGHT_OBJ = Anims.STAND_UP_FROM_SLIDING_WITH_LIGHT_OBJ,
RIDING_SHELL = Anims.RIDING_SHELL,
WALKING = Anims.WALKING,
FORWARD_FLIP = Anims.FORWARD_FLIP, -- unused
JUMP_RIDING_SHELL = Anims.JUMP_RIDING_SHELL,
LAND_FROM_DOUBLE_JUMP = Anims.LAND_FROM_DOUBLE_JUMP,
DOUBLE_JUMP_FALL = Anims.DOUBLE_JUMP_FALL,
SINGLE_JUMP = Anims.SINGLE_JUMP,
LAND_FROM_SINGLE_JUMP = Anims.LAND_FROM_SINGLE_JUMP,
AIR_KICK = Anims.AIR_KICK,
DOUBLE_JUMP_RISE = Anims.DOUBLE_JUMP_RISE,
START_FORWARD_SPINNING = Anims.START_FORWARD_SPINNING, -- unused
THROW_LIGHT_OBJECT = Anims.THROW_LIGHT_OBJECT,
FALL_FROM_SLIDE_KICK = Anims.FALL_FROM_SLIDE_KICK,
BEND_KNESS_RIDING_SHELL = Anims.BEND_KNESS_RIDING_SHELL, -- unused
LEGS_STUCK_IN_GROUND = Anims.LEGS_STUCK_IN_GROUND,
GENERAL_FALL = Anims.GENERAL_FALL,
GENERAL_LAND = Anims.GENERAL_LAND,
BEING_GRABBED = Anims.BEING_GRABBED,
GRAB_HEAVY_OBJECT = Anims.GRAB_HEAVY_OBJECT,
SLOW_LAND_FROM_DIVE = Anims.SLOW_LAND_FROM_DIVE,
FLY_FROM_CANNON = Anims.FLY_FROM_CANNON,
MOVE_ON_WIRE_NET_RIGHT = Anims.MOVE_ON_WIRE_NET_RIGHT,
MOVE_ON_WIRE_NET_LEFT = Anims.MOVE_ON_WIRE_NET_LEFT,
MISSING_CAP = Anims.MISSING_CAP,
PULL_DOOR_WALK_IN = Anims.PULL_DOOR_WALK_IN,
PUSH_DOOR_WALK_IN = Anims.PUSH_DOOR_WALK_IN,
UNLOCK_DOOR = Anims.UNLOCK_DOOR,
START_REACH_POCKET = Anims.START_REACH_POCKET, -- unused, reaching keys maybe?
REACH_POCKET = Anims.REACH_POCKET, -- unused
STOP_REACH_POCKET = Anims.STOP_REACH_POCKET, -- unused
GROUND_THROW = Anims.GROUND_THROW,
GROUND_KICK = Anims.GROUND_KICK,
FIRST_PUNCH = Anims.FIRST_PUNCH,
SECOND_PUNCH = Anims.SECOND_PUNCH,
FIRST_PUNCH_FAST = Anims.FIRST_PUNCH_FAST,
SECOND_PUNCH_FAST = Anims.SECOND_PUNCH_FAST,
PICK_UP_LIGHT_OBJ = Anims.PICK_UP_LIGHT_OBJ,
PUSHING = Anims.PUSHING,
START_RIDING_SHELL = Anims.START_RIDING_SHELL,
PLACE_LIGHT_OBJ = Anims.PLACE_LIGHT_OBJ,
FORWARD_SPINNING = Anims.FORWARD_SPINNING,
BACKWARD_SPINNING = Anims.BACKWARD_SPINNING,
BREAKDANCE = Anims.BREAKDANCE,
RUNNING = Anims.RUNNING,
RUNNING_UNUSED = Anims.RUNNING_UNUSED, -- unused duplicate, originally part 2?
SOFT_BACK_KB = Anims.SOFT_BACK_KB,
SOFT_FRONT_KB = Anims.SOFT_FRONT_KB,
DYING_IN_QUICKSAND = Anims.DYING_IN_QUICKSAND,
IDLE_IN_QUICKSAND = Anims.IDLE_IN_QUICKSAND,
MOVE_IN_QUICKSAND = Anims.MOVE_IN_QUICKSAND,
ELECTROCUTION = Anims.ELECTROCUTION,
SHOCKED = Anims.SHOCKED,
BACKWARD_KB = Anims.BACKWARD_KB,
FORWARD_KB = Anims.FORWARD_KB,
IDLE_HEAVY_OBJ = Anims.IDLE_HEAVY_OBJ,
-- STAND_AGAINST_WALL = Anims.STAND_AGAINST_WALL;
SIDESTEP_LEFT = Anims.SIDESTEP_LEFT,
SIDESTEP_RIGHT = Anims.SIDESTEP_RIGHT,
START_SLEEP_IDLE = Anims.START_SLEEP_IDLE,
START_SLEEP_SCRATCH = Anims.START_SLEEP_SCRATCH,
START_SLEEP_YAWN = Anims.START_SLEEP_YAWN,
START_SLEEP_SITTING = Anims.START_SLEEP_SITTING,
SLEEP_IDLE = Anims.SLEEP_IDLE,
SLEEP_START_LYING = Anims.SLEEP_START_LYING,
SLEEP_LYING = Anims.SLEEP_LYING,
DIVE = Anims.DIVE,
SLIDE_DIVE = Anims.SLIDE_DIVE,
GROUND_BONK = Anims.GROUND_BONK,
STOP_SLIDE_LIGHT_OBJ = Anims.STOP_SLIDE_LIGHT_OBJ,
SLIDE_KICK = Anims.SLIDE_KICK,
CROUCH_FROM_SLIDE_KICK = Anims.CROUCH_FROM_SLIDE_KICK,
SLIDE_MOTIONLESS = Anims.SLIDE_MOTIONLESS, -- unused
STOP_SLIDE = Anims.STOP_SLIDE,
FALL_FROM_SLIDE = Anims.FALL_FROM_SLIDE,
SLIDE = Anims.SLIDE,
TIPTOE = Anims.TIPTOE,
TWIRL_LAND = Anims.TWIRL_LAND,
TWIRL = Anims.TWIRL,
START_TWIRL = Anims.START_TWIRL,
STOP_CROUCHING = Anims.STOP_CROUCHING,
START_CROUCHING = Anims.START_CROUCHING,
CROUCHING = Anims.CROUCHING,
CRAWLING = Anims.CRAWLING,
STOP_CRAWLING = Anims.STOP_CRAWLING,
START_CRAWLING = Anims.START_CRAWLING,
SUMMON_STAR = Anims.SUMMON_STAR,
RETURN_STAR_APPROACH_DOOR = Anims.RETURN_STAR_APPROACH_DOOR,
BACKWARDS_WATER_KB = Anims.BACKWARDS_WATER_KB,
SWIM_WITH_OBJ_PART1 = Anims.SWIM_WITH_OBJ_PART1,
SWIM_WITH_OBJ_PART2 = Anims.SWIM_WITH_OBJ_PART2,
FLUTTERKICK_WITH_OBJ = Anims.FLUTTERKICK_WITH_OBJ,
WATER_ACTION_END_WITH_OBJ = Anims.WATER_ACTION_END_WITH_OBJ, -- either swimming or flutterkicking
STOP_GRAB_OBJ_WATER = Anims.STOP_GRAB_OBJ_WATER,
WATER_IDLE_WITH_OBJ = Anims.WATER_IDLE_WITH_OBJ,
DROWNING_PART1 = Anims.DROWNING_PART1,
DROWNING_PART2 = Anims.DROWNING_PART2,
WATER_DYING = Anims.WATER_DYING,
WATER_FORWARD_KB = Anims.WATER_FORWARD_KB,
FALL_FROM_WATER = Anims.FALL_FROM_WATER,
SWIM_PART1 = Anims.SWIM_PART1,
SWIM_PART2 = Anims.SWIM_PART2,
FLUTTERKICK = Anims.FLUTTERKICK,
WATER_ACTION_END = Anims.WATER_ACTION_END, -- either swimming or flutterkicking
WATER_PICK_UP_OBJ = Anims.WATER_PICK_UP_OBJ,
WATER_GRAB_OBJ_PART2 = Anims.WATER_GRAB_OBJ_PART2,
WATER_GRAB_OBJ_PART1 = Anims.WATER_GRAB_OBJ_PART1,
WATER_THROW_OBJ = Anims.WATER_THROW_OBJ,
WATER_IDLE = Anims.WATER_IDLE,
WATER_STAR_DANCE = Anims.WATER_STAR_DANCE,
RETURN_FROM_WATER_STAR_DANCE = Anims.RETURN_FROM_WATER_STAR_DANCE,
-- GRAB_BOWSER = Anims.GRAB_BOWSER;
-- SWINGING_BOWSER = Anims.SWINGING_BOWSER;
-- RELEASE_BOWSER = Anims.RELEASE_BOWSER;
-- HOLDING_BOWSER = Anims.HOLDING_BOWSER;
HEAVY_THROW = Anims.HEAVY_THROW,
WALK_PANTING = Anims.WALK_PANTING,
WALK_WITH_HEAVY_OBJ = Anims.WALK_WITH_HEAVY_OBJ,
TURNING_PART1 = Anims.TURNING_PART1,
TURNING_PART2 = Anims.TURNING_PART2,
SLIDEFLIP_LAND = Anims.SLIDEFLIP_LAND,
SLIDEFLIP = Anims.SLIDEFLIP,
TRIPLE_JUMP_LAND = Anims.TRIPLE_JUMP_LAND,
TRIPLE_JUMP = Anims.TRIPLE_JUMP,
FIRST_PERSON = Anims.FIRST_PERSON,
IDLE_HEAD_LEFT = Anims.IDLE_HEAD_LEFT,
IDLE_HEAD_RIGHT = Anims.IDLE_HEAD_RIGHT,
IDLE_HEAD_CENTER = Anims.IDLE_HEAD_CENTER,
HANDSTAND_LEFT = Anims.HANDSTAND_LEFT,
HANDSTAND_RIGHT = Anims.HANDSTAND_RIGHT,
WAKE_FROM_SLEEP = Anims.WAKE_FROM_SLEEP,
WAKE_FROM_LYING = Anims.WAKE_FROM_LYING,
START_TIPTOE = Anims.START_TIPTOE,
SLIDEJUMP = Anims.SLIDEJUMP, -- pole jump and wall kick
START_WALLKICK = Anims.START_WALLKICK,
STAR_DANCE = Anims.STAR_DANCE,
RETURN_FROM_STAR_DANCE = Anims.RETURN_FROM_STAR_DANCE,
FORWARD_SPINNING_FLIP = Anims.FORWARD_SPINNING_FLIP,
TRIPLE_JUMP_FLY = Anims.TRIPLE_JUMP_FLY,
})
task.spawn(function()
local ContentProvider = game:GetService("ContentProvider")
local preload = {}
for name, anim in pairs(Data) do
table.insert(preload, anim)
end
ContentProvider:PreloadAsync(preload)
end)
return Data

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,502 @@
{
"className": "Folder",
"children": [
{
"className": "Sound",
"properties": {
"SoundId": ""
},
"name": "ACTION_BONK"
},
{
"className": "Sound",
"properties": {
"SoundId": ""
},
"name": "ACTION_FLYING_FAST"
},
{
"className": "Sound",
"properties": {
"SoundId": ""
},
"name": "ACTION_HEAVY_LANDING"
},
{
"className": "Sound",
"properties": {
"SoundId": ""
},
"name": "ACTION_HIT"
},
{
"className": "Sound",
"properties": {
"SoundId": ""
},
"name": "ACTION_METAL_BONK"
},
{
"className": "Sound",
"properties": {
"SoundId": ""
},
"name": "ACTION_METAL_HEAVY_LANDING"
},
{
"className": "Sound",
"properties": {
"SoundId": ""
},
"name": "ACTION_METAL_LANDING"
},
{
"className": "Sound",
"properties": {
"SoundId": ""
},
"name": "ACTION_METAL_STEP"
},
{
"className": "Sound",
"properties": {
"SoundId": ""
},
"name": "ACTION_PAT_BACK"
},
{
"className": "Sound",
"properties": {
"SoundId": ""
},
"name": "ACTION_SIDE_FLIP"
},
{
"className": "Sound",
"properties": {
"SoundId": ""
},
"name": "ACTION_SPIN"
},
{
"className": "Sound",
"properties": {
"SoundId": ""
},
"name": "ACTION_TERRAIN_BODY_HIT_GROUND"
},
{
"className": "Sound",
"properties": {
"SoundId": ""
},
"name": "ACTION_TERRAIN_LANDING_DEFAULT"
},
{
"className": "Sound",
"properties": {
"SoundId": ""
},
"name": "ACTION_TERRAIN_LANDING_GRASS"
},
{
"className": "Sound",
"properties": {
"SoundId": ""
},
"name": "ACTION_TERRAIN_LANDING_ICE"
},
{
"className": "Sound",
"properties": {
"SoundId": ""
},
"name": "ACTION_TERRAIN_LANDING_METAL"
},
{
"className": "Sound",
"properties": {
"SoundId": ""
},
"name": "ACTION_TERRAIN_LANDING_SAND"
},
{
"className": "Sound",
"properties": {
"SoundId": ""
},
"name": "ACTION_TERRAIN_LANDING_SNOW"
},
{
"className": "Sound",
"properties": {
"SoundId": ""
},
"name": "ACTION_TERRAIN_LANDING_SPOOKY"
},
{
"className": "Sound",
"properties": {
"SoundId": ""
},
"name": "ACTION_TERRAIN_LANDING_STONE"
},
{
"className": "Sound",
"properties": {
"SoundId": ""
},
"name": "ACTION_TERRAIN_LANDING_WATER"
},
{
"className": "Sound",
"properties": {
"SoundId": ""
},
"name": "ACTION_TERRAIN_STEP_DEFAULT"
},
{
"className": "Sound",
"properties": {
"SoundId": ""
},
"name": "ACTION_TERRAIN_STEP_GRASS"
},
{
"className": "Sound",
"properties": {
"SoundId": ""
},
"name": "ACTION_TERRAIN_STEP_ICE"
},
{
"className": "Sound",
"properties": {
"SoundId": ""
},
"name": "ACTION_TERRAIN_STEP_METAL"
},
{
"className": "Sound",
"properties": {
"SoundId": ""
},
"name": "ACTION_TERRAIN_STEP_SAND"
},
{
"className": "Sound",
"properties": {
"SoundId": ""
},
"name": "ACTION_TERRAIN_STEP_SNOW"
},
{
"className": "Sound",
"properties": {
"SoundId": ""
},
"name": "ACTION_TERRAIN_STEP_SPOOKY"
},
{
"className": "Sound",
"properties": {
"SoundId": ""
},
"name": "ACTION_TERRAIN_STEP_STONE"
},
{
"className": "Sound",
"properties": {
"SoundId": ""
},
"name": "ACTION_TERRAIN_STEP_WATER"
},
{
"className": "Sound",
"properties": {
"SoundId": ""
},
"name": "ACTION_THROW"
},
{
"className": "Sound",
"properties": {
"SoundId": ""
},
"name": "ACTION_TWIRL"
},
{
"className": "Sound",
"properties": {
"SoundId": ""
},
"name": "MARIO_ATTACKED"
},
{
"className": "Sound",
"properties": {
"SoundId": ""
},
"name": "MARIO_DIE"
},
{
"className": "Sound",
"properties": {
"SoundId": ""
},
"name": "MARIO_DOH"
},
{
"className": "Sound",
"properties": {
"SoundId": ""
},
"name": "MARIO_GROUND_POUND_WAH"
},
{
"className": "Sound",
"properties": {
"SoundId": ""
},
"name": "MARIO_HAHA"
},
{
"className": "Sound",
"properties": {
"SoundId": ""
},
"name": "MARIO_HOO"
},
{
"className": "Sound",
"properties": {
"SoundId": ""
},
"name": "MARIO_HOOHOO"
},
{
"className": "Sound",
"properties": {
"SoundId": ""
},
"name": "MARIO_IMA_TIRED"
},
{
"className": "Sound",
"properties": {
"SoundId": ""
},
"name": "MARIO_JUMP_HOO"
},
{
"className": "Sound",
"properties": {
"SoundId": ""
},
"name": "MARIO_JUMP_WAH"
},
{
"className": "Sound",
"properties": {
"SoundId": ""
},
"name": "MARIO_MAMA_MIA"
},
{
"className": "Sound",
"properties": {
"SoundId": ""
},
"name": "MARIO_ON_FIRE"
},
{
"className": "Sound",
"properties": {
"SoundId": ""
},
"name": "MARIO_OOOF"
},
{
"className": "Sound",
"properties": {
"SoundId": ""
},
"name": "MARIO_PANTING"
},
{
"className": "Sound",
"properties": {
"SoundId": ""
},
"name": "MARIO_PUNCH_HOO"
},
{
"className": "Sound",
"properties": {
"SoundId": ""
},
"name": "MARIO_PUNCH_WAH"
},
{
"className": "Sound",
"properties": {
"SoundId": ""
},
"name": "MARIO_PUNCH_YAH"
},
{
"className": "Sound",
"properties": {
"SoundId": ""
},
"name": "MARIO_SNORING1"
},
{
"className": "Sound",
"properties": {
"SoundId": ""
},
"name": "MARIO_SNORING2"
},
{
"className": "Sound",
"properties": {
"SoundId": ""
},
"name": "MARIO_SNORING3"
},
{
"className": "Sound",
"properties": {
"SoundId": ""
},
"name": "MARIO_THROW_YAH"
},
{
"className": "Sound",
"properties": {
"SoundId": ""
},
"name": "MARIO_UH"
},
{
"className": "Sound",
"properties": {
"SoundId": ""
},
"name": "MARIO_UH2"
},
{
"className": "Sound",
"properties": {
"SoundId": ""
},
"name": "MARIO_WAAAOOOW"
},
{
"className": "Sound",
"properties": {
"SoundId": ""
},
"name": "MARIO_WAH"
},
{
"className": "Sound",
"properties": {
"SoundId": ""
},
"name": "MARIO_WAHA"
},
{
"className": "Sound",
"properties": {
"SoundId": ""
},
"name": "MARIO_WHOA"
},
{
"className": "Sound",
"properties": {
"SoundId": ""
},
"name": "MARIO_YAH"
},
{
"className": "Sound",
"properties": {
"SoundId": ""
},
"name": "MARIO_YAHOO"
},
{
"className": "Sound",
"properties": {
"SoundId": ""
},
"name": "MARIO_YAWNING"
},
{
"className": "Sound",
"properties": {
"SoundId": ""
},
"name": "MARIO_YIPPEE"
},
{
"className": "Sound",
"properties": {
"SoundId": ""
},
"name": "MOVING_FLYING"
},
{
"className": "Sound",
"properties": {
"SoundId": ""
},
"name": "MOVING_LAVA_BURN"
},
{
"className": "Sound",
"properties": {
"SoundId": ""
},
"name": "MOVING_TERRAIN_SLIDE"
},
{
"className": "Configuration",
"name": "ACTION_TERRAIN_JUMP"
},
{
"className": "Configuration",
"name": "ACTION_TERRAIN_LANDING"
},
{
"className": "Configuration",
"name": "ACTION_TERRAIN_STEP"
},
{
"className": "Configuration",
"name": "MARIO_JUMP"
},
{
"className": "Configuration",
"attributes": {
"MARIO_WAHA": 1,
"MARIO_YAHOO": 3,
"MARIO_YIPPEE": 1
},
"name": "MARIO_YAHOO_WAHA_YIPPEE"
},
{
"className": "Configuration",
"attributes": {
"MARIO_YAH": 1,
"MARIO_HOO": 1,
"MARIO_WAH": 1
},
"name": "MARIO_YAH_WAH_HOO"
}
]
}

View file

@ -0,0 +1,26 @@
--!strict
return {
STATIONARY = bit32.lshift(1, 9),
MOVING = bit32.lshift(1, 10),
AIR = bit32.lshift(1, 11),
INTANGIBLE = bit32.lshift(1, 12),
SWIMMING = bit32.lshift(1, 13),
METAL_WATER = bit32.lshift(1, 14),
SHORT_HITBOX = bit32.lshift(1, 15),
RIDING_SHELL = bit32.lshift(1, 16),
INVULNERABLE = bit32.lshift(1, 17),
BUTT_OR_STOMACH_SLIDE = bit32.lshift(1, 18),
DIVING = bit32.lshift(1, 19),
ON_POLE = bit32.lshift(1, 20),
HANGING = bit32.lshift(1, 21),
IDLE = bit32.lshift(1, 22),
ATTACKING = bit32.lshift(1, 23),
ALLOW_VERTICAL_WIND_ACTION = bit32.lshift(1, 24),
CONTROL_JUMP_HEIGHT = bit32.lshift(1, 25),
ALLOW_FIRST_PERSON = bit32.lshift(1, 26),
PAUSE_EXIT = bit32.lshift(1, 27),
SWIMMING_OR_FLYING = bit32.lshift(1, 28),
WATER_OR_TEXT = bit32.lshift(1, 29),
THROWING = bit32.lshift(1, 31),
}

View file

@ -0,0 +1,15 @@
--!strict
return {
-- Group Flags
STATIONARY = bit32.lshift(0, 6),
MOVING = bit32.lshift(1, 6),
AIRBORNE = bit32.lshift(2, 6),
SUBMERGED = bit32.lshift(3, 6),
CUTSCENE = bit32.lshift(4, 6),
AUTOMATIC = bit32.lshift(5, 6),
OBJECT = bit32.lshift(6, 6),
-- Mask for capturing these Flags
GROUP_MASK = 0b_000000111000000,
}

250
sm64/Enums/Action/init.lua Normal file
View file

@ -0,0 +1,250 @@
--!strict
return {
UNINITIALIZED = 0x00000000, -- (0x000)
-- group 0x000: stationary actions
IDLE = 0x0C400201, -- (0x001 | FLAG_STATIONARY | FLAG_IDLE | FLAG_ALLOW_FIRST_PERSON | FLAG_PAUSE_EXIT)
START_SLEEPING = 0x0C400202, -- (0x002 | FLAG_STATIONARY | FLAG_IDLE | FLAG_ALLOW_FIRST_PERSON | FLAG_PAUSE_EXIT)
SLEEPING = 0x0C000203, -- (0x003 | FLAG_STATIONARY | FLAG_ALLOW_FIRST_PERSON | FLAG_PAUSE_EXIT)
WAKING_UP = 0x0C000204, -- (0x004 | FLAG_STATIONARY | FLAG_ALLOW_FIRST_PERSON | FLAG_PAUSE_EXIT)
PANTING = 0x0C400205, -- (0x005 | FLAG_STATIONARY | FLAG_IDLE | FLAG_ALLOW_FIRST_PERSON | FLAG_PAUSE_EXIT)
HOLD_PANTING_UNUSED = 0x08000206, -- (0x006 | FLAG_STATIONARY | FLAG_PAUSE_EXIT)
HOLD_IDLE = 0x08000207, -- (0x007 | FLAG_STATIONARY | FLAG_PAUSE_EXIT)
HOLD_HEAVY_IDLE = 0x08000208, -- (0x008 | FLAG_STATIONARY | FLAG_PAUSE_EXIT)
STANDING_AGAINST_WALL = 0x0C400209, -- (0x009 | FLAG_STATIONARY | FLAG_IDLE | FLAG_ALLOW_FIRST_PERSON | FLAG_PAUSE_EXIT)
COUGHING = 0x0C40020A, -- (0x00A | FLAG_STATIONARY | FLAG_IDLE | FLAG_ALLOW_FIRST_PERSON | FLAG_PAUSE_EXIT)
SHIVERING = 0x0C40020B, -- (0x00B | FLAG_STATIONARY | FLAG_IDLE | FLAG_ALLOW_FIRST_PERSON | FLAG_PAUSE_EXIT)
IN_QUICKSAND = 0x0002020D, -- (0x00D | FLAG_STATIONARY | FLAG_INVULNERABLE)
UNKNOWN_0002020E = 0x0002020E, -- (0x00E | FLAG_STATIONARY | FLAG_INVULNERABLE)
CROUCHING = 0x0C008220, -- (0x020 | FLAG_STATIONARY | FLAG_SHORT_HITBOX | FLAG_ALLOW_FIRST_PERSON | FLAG_PAUSE_EXIT)
START_CROUCHING = 0x0C008221, -- (0x021 | FLAG_STATIONARY | FLAG_SHORT_HITBOX | FLAG_ALLOW_FIRST_PERSON | FLAG_PAUSE_EXIT)
STOP_CROUCHING = 0x0C008222, -- (0x022 | FLAG_STATIONARY | FLAG_SHORT_HITBOX | FLAG_ALLOW_FIRST_PERSON | FLAG_PAUSE_EXIT)
START_CRAWLING = 0x0C008223, -- (0x023 | FLAG_STATIONARY | FLAG_SHORT_HITBOX | FLAG_ALLOW_FIRST_PERSON | FLAG_PAUSE_EXIT)
STOP_CRAWLING = 0x0C008224, -- (0x024 | FLAG_STATIONARY | FLAG_SHORT_HITBOX | FLAG_ALLOW_FIRST_PERSON | FLAG_PAUSE_EXIT)
SLIDE_KICK_SLIDE_STOP = 0x08000225, -- (0x025 | FLAG_STATIONARY | FLAG_PAUSE_EXIT)
SHOCKWAVE_BOUNCE = 0x00020226, -- (0x026 | FLAG_STATIONARY | FLAG_INVULNERABLE)
FIRST_PERSON = 0x0C000227, -- (0x027 | FLAG_STATIONARY | FLAG_ALLOW_FIRST_PERSON | FLAG_PAUSE_EXIT)
BACKFLIP_LAND_STOP = 0x0800022F, -- (0x02F | FLAG_STATIONARY | FLAG_PAUSE_EXIT)
JUMP_LAND_STOP = 0x0C000230, -- (0x030 | FLAG_STATIONARY | FLAG_ALLOW_FIRST_PERSON | FLAG_PAUSE_EXIT)
DOUBLE_JUMP_LAND_STOP = 0x0C000231, -- (0x031 | FLAG_STATIONARY | FLAG_ALLOW_FIRST_PERSON | FLAG_PAUSE_EXIT)
FREEFALL_LAND_STOP = 0x0C000232, -- (0x032 | FLAG_STATIONARY | FLAG_ALLOW_FIRST_PERSON | FLAG_PAUSE_EXIT)
SIDE_FLIP_LAND_STOP = 0x0C000233, -- (0x033 | FLAG_STATIONARY | FLAG_ALLOW_FIRST_PERSON | FLAG_PAUSE_EXIT)
HOLD_JUMP_LAND_STOP = 0x08000234, -- (0x034 | FLAG_STATIONARY | FLAG_PAUSE_EXIT)
HOLD_FREEFALL_LAND_STOP = 0x08000235, -- (0x035 | FLAG_STATIONARY | FLAG_PAUSE_EXIT)
AIR_THROW_LAND = 0x80000A36, -- (0x036 | FLAG_STATIONARY | FLAG_AIR | FLAG_THROWING)
TWIRL_LAND = 0x18800238, -- (0x038 | FLAG_STATIONARY | FLAG_ATTACKING | FLAG_PAUSE_EXIT | FLAG_SWIMMING_OR_FLYING)
LAVA_BOOST_LAND = 0x08000239, -- (0x039 | FLAG_STATIONARY | FLAG_PAUSE_EXIT)
TRIPLE_JUMP_LAND_STOP = 0x0800023A, -- (0x03A | FLAG_STATIONARY | FLAG_PAUSE_EXIT)
LONG_JUMP_LAND_STOP = 0x0800023B, -- (0x03B | FLAG_STATIONARY | FLAG_PAUSE_EXIT)
GROUND_POUND_LAND = 0x0080023C, -- (0x03C | FLAG_STATIONARY | FLAG_ATTACKING)
BRAKING_STOP = 0x0C00023D, -- (0x03D | FLAG_STATIONARY | FLAG_ALLOW_FIRST_PERSON | FLAG_PAUSE_EXIT)
BUTT_SLIDE_STOP = 0x0C00023E, -- (0x03E | FLAG_STATIONARY | FLAG_ALLOW_FIRST_PERSON | FLAG_PAUSE_EXIT)
HOLD_BUTT_SLIDE_STOP = 0x0800043F, -- (0x03F | FLAG_MOVING | FLAG_PAUSE_EXIT)
-- group 0x040: moving (ground) actions
WALKING = 0x04000440, -- (0x040 | FLAG_MOVING | FLAG_ALLOW_FIRST_PERSON)
HOLD_WALKING = 0x00000442, -- (0x042 | FLAG_MOVING)
TURNING_AROUND = 0x00000443, -- (0x043 | FLAG_MOVING)
FINISH_TURNING_AROUND = 0x00000444, -- (0x044 | FLAG_MOVING)
BRAKING = 0x04000445, -- (0x045 | FLAG_MOVING | FLAG_ALLOW_FIRST_PERSON)
RIDING_SHELL_GROUND = 0x20810446, -- (0x046 | FLAG_MOVING | FLAG_RIDING_SHELL | FLAG_ATTACKING | FLAG_WATER_OR_TEXT)
HOLD_HEAVY_WALKING = 0x00000447, -- (0x047 | FLAG_MOVING)
CRAWLING = 0x04008448, -- (0x048 | FLAG_MOVING | FLAG_SHORT_HITBOX | FLAG_ALLOW_FIRST_PERSON)
BURNING_GROUND = 0x00020449, -- (0x049 | FLAG_MOVING | FLAG_INVULNERABLE)
DECELERATING = 0x0400044A, -- (0x04A | FLAG_MOVING | FLAG_ALLOW_FIRST_PERSON)
HOLD_DECELERATING = 0x0000044B, -- (0x04B | FLAG_MOVING)
BEGIN_SLIDING = 0x00000050, -- (0x050)
HOLD_BEGIN_SLIDING = 0x00000051, -- (0x051)
BUTT_SLIDE = 0x00840452, -- (0x052 | FLAG_MOVING | FLAG_BUTT_OR_STOMACH_SLIDE | FLAG_ATTACKING)
STOMACH_SLIDE = 0x008C0453, -- (0x053 | FLAG_MOVING | FLAG_BUTT_OR_STOMACH_SLIDE | FLAG_DIVING | FLAG_ATTACKING)
HOLD_BUTT_SLIDE = 0x00840454, -- (0x054 | FLAG_MOVING | FLAG_BUTT_OR_STOMACH_SLIDE | FLAG_ATTACKING)
HOLD_STOMACH_SLIDE = 0x008C0455, -- (0x055 | FLAG_MOVING | FLAG_BUTT_OR_STOMACH_SLIDE | FLAG_DIVING | FLAG_ATTACKING)
DIVE_SLIDE = 0x00880456, -- (0x056 | FLAG_MOVING | FLAG_DIVING | FLAG_ATTACKING)
MOVE_PUNCHING = 0x00800457, -- (0x057 | FLAG_MOVING | FLAG_ATTACKING)
CROUCH_SLIDE = 0x04808459, -- (0x059 | FLAG_MOVING | FLAG_SHORT_HITBOX | FLAG_ATTACKING | FLAG_ALLOW_FIRST_PERSON)
SLIDE_KICK_SLIDE = 0x0080045A, -- (0x05A | FLAG_MOVING | FLAG_ATTACKING)
HARD_BACKWARD_GROUND_KB = 0x00020460, -- (0x060 | FLAG_MOVING | FLAG_INVULNERABLE)
HARD_FORWARD_GROUND_KB = 0x00020461, -- (0x061 | FLAG_MOVING | FLAG_INVULNERABLE)
BACKWARD_GROUND_KB = 0x00020462, -- (0x062 | FLAG_MOVING | FLAG_INVULNERABLE)
FORWARD_GROUND_KB = 0x00020463, -- (0x063 | FLAG_MOVING | FLAG_INVULNERABLE)
SOFT_BACKWARD_GROUND_KB = 0x00020464, -- (0x064 | FLAG_MOVING | FLAG_INVULNERABLE)
SOFT_FORWARD_GROUND_KB = 0x00020465, -- (0x065 | FLAG_MOVING | FLAG_INVULNERABLE)
GROUND_BONK = 0x00020466, -- (0x066 | FLAG_MOVING | FLAG_INVULNERABLE)
DEATH_EXIT_LAND = 0x00020467, -- (0x067 | FLAG_MOVING | FLAG_INVULNERABLE)
JUMP_LAND = 0x04000470, -- (0x070 | FLAG_MOVING | FLAG_ALLOW_FIRST_PERSON)
FREEFALL_LAND = 0x04000471, -- (0x071 | FLAG_MOVING | FLAG_ALLOW_FIRST_PERSON)
DOUBLE_JUMP_LAND = 0x04000472, -- (0x072 | FLAG_MOVING | FLAG_ALLOW_FIRST_PERSON)
SIDE_FLIP_LAND = 0x04000473, -- (0x073 | FLAG_MOVING | FLAG_ALLOW_FIRST_PERSON)
HOLD_JUMP_LAND = 0x00000474, -- (0x074 | FLAG_MOVING)
HOLD_FREEFALL_LAND = 0x00000475, -- (0x075 | FLAG_MOVING)
QUICKSAND_JUMP_LAND = 0x00000476, -- (0x076 | FLAG_MOVING)
HOLD_QUICKSAND_JUMP_LAND = 0x00000477, -- (0x077 | FLAG_MOVING)
TRIPLE_JUMP_LAND = 0x04000478, -- (0x078 | FLAG_MOVING | FLAG_ALLOW_FIRST_PERSON)
LONG_JUMP_LAND = 0x00000479, -- (0x079 | FLAG_MOVING)
BACKFLIP_LAND = 0x0400047A, -- (0x07A | FLAG_MOVING | FLAG_ALLOW_FIRST_PERSON)
-- group 0x080: airborne actions
JUMP = 0x03000880, -- (0x080 | FLAG_AIR | FLAG_ALLOW_VERTICAL_WIND_ACTION | FLAG_CONTROL_JUMP_HEIGHT)
DOUBLE_JUMP = 0x03000881, -- (0x081 | FLAG_AIR | FLAG_ALLOW_VERTICAL_WIND_ACTION | FLAG_CONTROL_JUMP_HEIGHT)
TRIPLE_JUMP = 0x01000882, -- (0x082 | FLAG_AIR | FLAG_ALLOW_VERTICAL_WIND_ACTION)
BACKFLIP = 0x01000883, -- (0x083 | FLAG_AIR | FLAG_ALLOW_VERTICAL_WIND_ACTION)
STEEP_JUMP = 0x03000885, -- (0x085 | FLAG_AIR | FLAG_ALLOW_VERTICAL_WIND_ACTION | FLAG_CONTROL_JUMP_HEIGHT)
WALL_KICK_AIR = 0x03000886, -- (0x086 | FLAG_AIR | FLAG_ALLOW_VERTICAL_WIND_ACTION | FLAG_CONTROL_JUMP_HEIGHT)
SIDE_FLIP = 0x01000887, -- (0x087 | FLAG_AIR | FLAG_ALLOW_VERTICAL_WIND_ACTION)
LONG_JUMP = 0x03000888, -- (0x088 | FLAG_AIR | FLAG_ALLOW_VERTICAL_WIND_ACTION | FLAG_CONTROL_JUMP_HEIGHT)
WATER_JUMP = 0x01000889, -- (0x089 | FLAG_AIR | FLAG_ALLOW_VERTICAL_WIND_ACTION)
DIVE = 0x0188088A, -- (0x08A | FLAG_AIR | FLAG_DIVING | FLAG_ATTACKING | FLAG_ALLOW_VERTICAL_WIND_ACTION)
FREEFALL = 0x0100088C, -- (0x08C | FLAG_AIR | FLAG_ALLOW_VERTICAL_WIND_ACTION)
TOP_OF_POLE_JUMP = 0x0300088D, -- (0x08D | FLAG_AIR | FLAG_ALLOW_VERTICAL_WIND_ACTION | FLAG_CONTROL_JUMP_HEIGHT)
BUTT_SLIDE_AIR = 0x0300088E, -- (0x08E | FLAG_AIR | FLAG_ALLOW_VERTICAL_WIND_ACTION | FLAG_CONTROL_JUMP_HEIGHT)
FLYING_TRIPLE_JUMP = 0x03000894, -- (0x094 | FLAG_AIR | FLAG_ALLOW_VERTICAL_WIND_ACTION | FLAG_CONTROL_JUMP_HEIGHT)
SHOT_FROM_CANNON = 0x00880898, -- (0x098 | FLAG_AIR | FLAG_DIVING | FLAG_ATTACKING)
FLYING = 0x10880899, -- (0x099 | FLAG_AIR | FLAG_DIVING | FLAG_ATTACKING | FLAG_SWIMMING_OR_FLYING)
RIDING_SHELL_JUMP = 0x0281089A, -- (0x09A | FLAG_AIR | FLAG_RIDING_SHELL | FLAG_ATTACKING | FLAG_CONTROL_JUMP_HEIGHT)
RIDING_SHELL_FALL = 0x0081089B, -- (0x09B | FLAG_AIR | FLAG_RIDING_SHELL | FLAG_ATTACKING)
VERTICAL_WIND = 0x1008089C, -- (0x09C | FLAG_AIR | FLAG_DIVING | FLAG_SWIMMING_OR_FLYING)
HOLD_JUMP = 0x030008A0, -- (0x0A0 | FLAG_AIR | FLAG_ALLOW_VERTICAL_WIND_ACTION | FLAG_CONTROL_JUMP_HEIGHT)
HOLD_FREEFALL = 0x010008A1, -- (0x0A1 | FLAG_AIR | FLAG_ALLOW_VERTICAL_WIND_ACTION)
HOLD_BUTT_SLIDE_AIR = 0x010008A2, -- (0x0A2 | FLAG_AIR | FLAG_ALLOW_VERTICAL_WIND_ACTION)
HOLD_WATER_JUMP = 0x010008A3, -- (0x0A3 | FLAG_AIR | FLAG_ALLOW_VERTICAL_WIND_ACTION)
TWIRLING = 0x108008A4, -- (0x0A4 | FLAG_AIR | FLAG_ATTACKING | FLAG_SWIMMING_OR_FLYING)
FORWARD_ROLLOUT = 0x010008A6, -- (0x0A6 | FLAG_AIR | FLAG_ALLOW_VERTICAL_WIND_ACTION)
AIR_HIT_WALL = 0x000008A7, -- (0x0A7 | FLAG_AIR)
RIDING_HOOT = 0x000004A8, -- (0x0A8 | FLAG_MOVING)
GROUND_POUND = 0x008008A9, -- (0x0A9 | FLAG_AIR | FLAG_ATTACKING)
SLIDE_KICK = 0x018008AA, -- (0x0AA | FLAG_AIR | FLAG_ATTACKING | FLAG_ALLOW_VERTICAL_WIND_ACTION)
AIR_THROW = 0x830008AB, -- (0x0AB | FLAG_AIR | FLAG_ALLOW_VERTICAL_WIND_ACTION | FLAG_CONTROL_JUMP_HEIGHT | FLAG_THROWING)
JUMP_KICK = 0x018008AC, -- (0x0AC | FLAG_AIR | FLAG_ATTACKING | FLAG_ALLOW_VERTICAL_WIND_ACTION)
BACKWARD_ROLLOUT = 0x010008AD, -- (0x0AD | FLAG_AIR | FLAG_ALLOW_VERTICAL_WIND_ACTION)
CRAZY_BOX_BOUNCE = 0x000008AE, -- (0x0AE | FLAG_AIR)
SPECIAL_TRIPLE_JUMP = 0x030008AF, -- (0x0AF | FLAG_AIR | FLAG_ALLOW_VERTICAL_WIND_ACTION | FLAG_CONTROL_JUMP_HEIGHT)
BACKWARD_AIR_KB = 0x010208B0, -- (0x0B0 | FLAG_AIR | FLAG_INVULNERABLE | FLAG_ALLOW_VERTICAL_WIND_ACTION)
FORWARD_AIR_KB = 0x010208B1, -- (0x0B1 | FLAG_AIR | FLAG_INVULNERABLE | FLAG_ALLOW_VERTICAL_WIND_ACTION)
HARD_FORWARD_AIR_KB = 0x010208B2, -- (0x0B2 | FLAG_AIR | FLAG_INVULNERABLE | FLAG_ALLOW_VERTICAL_WIND_ACTION)
HARD_BACKWARD_AIR_KB = 0x010208B3, -- (0x0B3 | FLAG_AIR | FLAG_INVULNERABLE | FLAG_ALLOW_VERTICAL_WIND_ACTION)
BURNING_JUMP = 0x010208B4, -- (0x0B4 | FLAG_AIR | FLAG_INVULNERABLE | FLAG_ALLOW_VERTICAL_WIND_ACTION)
BURNING_FALL = 0x010208B5, -- (0x0B5 | FLAG_AIR | FLAG_INVULNERABLE | FLAG_ALLOW_VERTICAL_WIND_ACTION)
SOFT_BONK = 0x010208B6, -- (0x0B6 | FLAG_AIR | FLAG_INVULNERABLE | FLAG_ALLOW_VERTICAL_WIND_ACTION)
LAVA_BOOST = 0x010208B7, -- (0x0B7 | FLAG_AIR | FLAG_INVULNERABLE | FLAG_ALLOW_VERTICAL_WIND_ACTION)
GETTING_BLOWN = 0x010208B8, -- (0x0B8 | FLAG_AIR | FLAG_INVULNERABLE | FLAG_ALLOW_VERTICAL_WIND_ACTION)
THROWN_FORWARD = 0x010208BD, -- (0x0BD | FLAG_AIR | FLAG_INVULNERABLE | FLAG_ALLOW_VERTICAL_WIND_ACTION)
THROWN_BACKWARD = 0x010208BE, -- (0x0BE | FLAG_AIR | FLAG_INVULNERABLE | FLAG_ALLOW_VERTICAL_WIND_ACTION)
-- group 0x0C0: submerged actions
WATER_IDLE = 0x380022C0, -- (0x0C0 | FLAG_STATIONARY | FLAG_SWIMMING | FLAG_PAUSE_EXIT | FLAG_SWIMMING_OR_FLYING | FLAG_WATER_OR_TEXT)
HOLD_WATER_IDLE = 0x380022C1, -- (0x0C1 | FLAG_STATIONARY | FLAG_SWIMMING | FLAG_PAUSE_EXIT | FLAG_SWIMMING_OR_FLYING | FLAG_WATER_OR_TEXT)
WATER_ACTION_END = 0x300022C2, -- (0x0C2 | FLAG_STATIONARY | FLAG_SWIMMING | FLAG_SWIMMING_OR_FLYING | FLAG_WATER_OR_TEXT)
HOLD_WATER_ACTION_END = 0x300022C3, -- (0x0C3 | FLAG_STATIONARY | FLAG_SWIMMING | FLAG_SWIMMING_OR_FLYING | FLAG_WATER_OR_TEXT)
DROWNING = 0x300032C4, -- (0x0C4 | FLAG_STATIONARY | FLAG_INTANGIBLE | FLAG_SWIMMING | FLAG_SWIMMING_OR_FLYING | FLAG_WATER_OR_TEXT)
BACKWARD_WATER_KB = 0x300222C5, -- (0x0C5 | FLAG_STATIONARY | FLAG_SWIMMING | FLAG_INVULNERABLE | FLAG_SWIMMING_OR_FLYING | FLAG_WATER_OR_TEXT)
FORWARD_WATER_KB = 0x300222C6, -- (0x0C6 | FLAG_STATIONARY | FLAG_SWIMMING | FLAG_INVULNERABLE | FLAG_SWIMMING_OR_FLYING | FLAG_WATER_OR_TEXT)
WATER_DEATH = 0x300032C7, -- (0x0C7 | FLAG_STATIONARY | FLAG_INTANGIBLE | FLAG_SWIMMING | FLAG_SWIMMING_OR_FLYING | FLAG_WATER_OR_TEXT)
WATER_SHOCKED = 0x300222C8, -- (0x0C8 | FLAG_STATIONARY | FLAG_SWIMMING | FLAG_INVULNERABLE | FLAG_SWIMMING_OR_FLYING | FLAG_WATER_OR_TEXT)
BREASTSTROKE = 0x300024D0, -- (0x0D0 | FLAG_MOVING | FLAG_SWIMMING | FLAG_SWIMMING_OR_FLYING | FLAG_WATER_OR_TEXT)
SWIMMING_END = 0x300024D1, -- (0x0D1 | FLAG_MOVING | FLAG_SWIMMING | FLAG_SWIMMING_OR_FLYING | FLAG_WATER_OR_TEXT)
FLUTTER_KICK = 0x300024D2, -- (0x0D2 | FLAG_MOVING | FLAG_SWIMMING | FLAG_SWIMMING_OR_FLYING | FLAG_WATER_OR_TEXT)
HOLD_BREASTSTROKE = 0x300024D3, -- (0x0D3 | FLAG_MOVING | FLAG_SWIMMING | FLAG_SWIMMING_OR_FLYING | FLAG_WATER_OR_TEXT)
HOLD_SWIMMING_END = 0x300024D4, -- (0x0D4 | FLAG_MOVING | FLAG_SWIMMING | FLAG_SWIMMING_OR_FLYING | FLAG_WATER_OR_TEXT)
HOLD_FLUTTER_KICK = 0x300024D5, -- (0x0D5 | FLAG_MOVING | FLAG_SWIMMING | FLAG_SWIMMING_OR_FLYING | FLAG_WATER_OR_TEXT)
WATER_SHELL_SWIMMING = 0x300024D6, -- (0x0D6 | FLAG_MOVING | FLAG_SWIMMING | FLAG_SWIMMING_OR_FLYING | FLAG_WATER_OR_TEXT)
WATER_THROW = 0x300024E0, -- (0x0E0 | FLAG_MOVING | FLAG_SWIMMING | FLAG_SWIMMING_OR_FLYING | FLAG_WATER_OR_TEXT)
WATER_PUNCH = 0x300024E1, -- (0x0E1 | FLAG_MOVING | FLAG_SWIMMING | FLAG_SWIMMING_OR_FLYING | FLAG_WATER_OR_TEXT)
WATER_PLUNGE = 0x300022E2, -- (0x0E2 | FLAG_STATIONARY | FLAG_SWIMMING | FLAG_SWIMMING_OR_FLYING | FLAG_WATER_OR_TEXT)
CAUGHT_IN_WHIRLPOOL = 0x300222E3, -- (0x0E3 | FLAG_STATIONARY | FLAG_SWIMMING | FLAG_INVULNERABLE | FLAG_SWIMMING_OR_FLYING | FLAG_WATER_OR_TEXT)
METAL_WATER_STANDING = 0x080042F0, -- (0x0F0 | FLAG_STATIONARY | FLAG_METAL_WATER | FLAG_PAUSE_EXIT)
HOLD_METAL_WATER_STANDING = 0x080042F1, -- (0x0F1 | FLAG_STATIONARY | FLAG_METAL_WATER | FLAG_PAUSE_EXIT)
METAL_WATER_WALKING = 0x000044F2, -- (0x0F2 | FLAG_MOVING | FLAG_METAL_WATER)
HOLD_METAL_WATER_WALKING = 0x000044F3, -- (0x0F3 | FLAG_MOVING | FLAG_METAL_WATER)
METAL_WATER_FALLING = 0x000042F4, -- (0x0F4 | FLAG_STATIONARY | FLAG_METAL_WATER)
HOLD_METAL_WATER_FALLING = 0x000042F5, -- (0x0F5 | FLAG_STATIONARY | FLAG_METAL_WATER)
METAL_WATER_FALL_LAND = 0x000042F6, -- (0x0F6 | FLAG_STATIONARY | FLAG_METAL_WATER)
HOLD_METAL_WATER_FALL_LAND = 0x000042F7, -- (0x0F7 | FLAG_STATIONARY | FLAG_METAL_WATER)
METAL_WATER_JUMP = 0x000044F8, -- (0x0F8 | FLAG_MOVING | FLAG_METAL_WATER)
HOLD_METAL_WATER_JUMP = 0x000044F9, -- (0x0F9 | FLAG_MOVING | FLAG_METAL_WATER)
METAL_WATER_JUMP_LAND = 0x000044FA, -- (0x0FA | FLAG_MOVING | FLAG_METAL_WATER)
HOLD_METAL_WATER_JUMP_LAND = 0x000044FB, -- (0x0FB | FLAG_MOVING | FLAG_METAL_WATER)
-- group 0x100: cutscene actions
DISAPPEARED = 0x00001300, -- (0x100 | FLAG_STATIONARY | FLAG_INTANGIBLE)
INTRO_CUTSCENE = 0x04001301, -- (0x101 | FLAG_STATIONARY | FLAG_INTANGIBLE | FLAG_ALLOW_FIRST_PERSON)
STAR_DANCE_EXIT = 0x00001302, -- (0x102 | FLAG_STATIONARY | FLAG_INTANGIBLE)
STAR_DANCE_WATER = 0x00001303, -- (0x103 | FLAG_STATIONARY | FLAG_INTANGIBLE)
FALL_AFTER_STAR_GRAB = 0x00001904, -- (0x104 | FLAG_AIR | FLAG_INTANGIBLE)
READING_AUTOMATIC_DIALOG = 0x20001305, -- (0x105 | FLAG_STATIONARY | FLAG_INTANGIBLE | FLAG_WATER_OR_TEXT)
READING_NPC_DIALOG = 0x20001306, -- (0x106 | FLAG_STATIONARY | FLAG_INTANGIBLE | FLAG_WATER_OR_TEXT)
STAR_DANCE_NO_EXIT = 0x00001307, -- (0x107 | FLAG_STATIONARY | FLAG_INTANGIBLE)
READING_SIGN = 0x00001308, -- (0x108 | FLAG_STATIONARY | FLAG_INTANGIBLE)
JUMBO_STAR_CUTSCENE = 0x00001909, -- (0x109 | FLAG_AIR | FLAG_INTANGIBLE)
WAITING_FOR_DIALOG = 0x0000130A, -- (0x10A | FLAG_STATIONARY | FLAG_INTANGIBLE)
DEBUG_FREE_MOVE = 0x0000130F, -- (0x10F | FLAG_STATIONARY | FLAG_INTANGIBLE)
STANDING_DEATH = 0x00021311, -- (0x111 | FLAG_STATIONARY | FLAG_INTANGIBLE | FLAG_INVULNERABLE)
QUICKSAND_DEATH = 0x00021312, -- (0x112 | FLAG_STATIONARY | FLAG_INTANGIBLE | FLAG_INVULNERABLE)
ELECTROCUTION = 0x00021313, -- (0x113 | FLAG_STATIONARY | FLAG_INTANGIBLE | FLAG_INVULNERABLE)
SUFFOCATION = 0x00021314, -- (0x114 | FLAG_STATIONARY | FLAG_INTANGIBLE | FLAG_INVULNERABLE)
DEATH_ON_STOMACH = 0x00021315, -- (0x115 | FLAG_STATIONARY | FLAG_INTANGIBLE | FLAG_INVULNERABLE)
DEATH_ON_BACK = 0x00021316, -- (0x116 | FLAG_STATIONARY | FLAG_INTANGIBLE | FLAG_INVULNERABLE)
EATEN_BY_BUBBA = 0x00021317, -- (0x117 | FLAG_STATIONARY | FLAG_INTANGIBLE | FLAG_INVULNERABLE)
END_PEACH_CUTSCENE = 0x00001918, -- (0x118 | FLAG_AIR | FLAG_INTANGIBLE)
CREDITS_CUTSCENE = 0x00001319, -- (0x119 | FLAG_STATIONARY | FLAG_INTANGIBLE)
END_WAVING_CUTSCENE = 0x0000131A, -- (0x11A | FLAG_STATIONARY | FLAG_INTANGIBLE)
PULLING_DOOR = 0x00001320, -- (0x120 | FLAG_STATIONARY | FLAG_INTANGIBLE)
PUSHING_DOOR = 0x00001321, -- (0x121 | FLAG_STATIONARY | FLAG_INTANGIBLE)
WARP_DOOR_SPAWN = 0x00001322, -- (0x122 | FLAG_STATIONARY | FLAG_INTANGIBLE)
EMERGE_FROM_PIPE = 0x00001923, -- (0x123 | FLAG_AIR | FLAG_INTANGIBLE)
SPAWN_SPIN_AIRBORNE = 0x00001924, -- (0x124 | FLAG_AIR | FLAG_INTANGIBLE)
SPAWN_SPIN_LANDING = 0x00001325, -- (0x125 | FLAG_STATIONARY | FLAG_INTANGIBLE)
EXIT_AIRBORNE = 0x00001926, -- (0x126 | FLAG_AIR | FLAG_INTANGIBLE)
EXIT_LAND_SAVE_DIALOG = 0x00001327, -- (0x127 | FLAG_STATIONARY | FLAG_INTANGIBLE)
DEATH_EXIT = 0x00001928, -- (0x128 | FLAG_AIR | FLAG_INTANGIBLE)
UNUSED_DEATH_EXIT = 0x00001929, -- (0x129 | FLAG_AIR | FLAG_INTANGIBLE)
FALLING_DEATH_EXIT = 0x0000192A, -- (0x12A | FLAG_AIR | FLAG_INTANGIBLE)
SPECIAL_EXIT_AIRBORNE = 0x0000192B, -- (0x12B | FLAG_AIR | FLAG_INTANGIBLE)
SPECIAL_DEATH_EXIT = 0x0000192C, -- (0x12C | FLAG_AIR | FLAG_INTANGIBLE)
FALLING_EXIT_AIRBORNE = 0x0000192D, -- (0x12D | FLAG_AIR | FLAG_INTANGIBLE)
UNLOCKING_KEY_DOOR = 0x0000132E, -- (0x12E | FLAG_STATIONARY | FLAG_INTANGIBLE)
UNLOCKING_STAR_DOOR = 0x0000132F, -- (0x12F | FLAG_STATIONARY | FLAG_INTANGIBLE)
ENTERING_STAR_DOOR = 0x00001331, -- (0x131 | FLAG_STATIONARY | FLAG_INTANGIBLE)
SPAWN_NO_SPIN_AIRBORNE = 0x00001932, -- (0x132 | FLAG_AIR | FLAG_INTANGIBLE)
SPAWN_NO_SPIN_LANDING = 0x00001333, -- (0x133 | FLAG_STATIONARY | FLAG_INTANGIBLE)
BBH_ENTER_JUMP = 0x00001934, -- (0x134 | FLAG_AIR | FLAG_INTANGIBLE)
BBH_ENTER_SPIN = 0x00001535, -- (0x135 | FLAG_MOVING | FLAG_INTANGIBLE)
TELEPORT_FADE_OUT = 0x00001336, -- (0x136 | FLAG_STATIONARY | FLAG_INTANGIBLE)
TELEPORT_FADE_IN = 0x00001337, -- (0x137 | FLAG_STATIONARY | FLAG_INTANGIBLE)
SHOCKED = 0x00020338, -- (0x138 | FLAG_STATIONARY | FLAG_INVULNERABLE)
SQUISHED = 0x00020339, -- (0x139 | FLAG_STATIONARY | FLAG_INVULNERABLE)
HEAD_STUCK_IN_GROUND = 0x0002033A, -- (0x13A | FLAG_STATIONARY | FLAG_INVULNERABLE)
BUTT_STUCK_IN_GROUND = 0x0002033B, -- (0x13B | FLAG_STATIONARY | FLAG_INVULNERABLE)
FEET_STUCK_IN_GROUND = 0x0002033C, -- (0x13C | FLAG_STATIONARY | FLAG_INVULNERABLE)
PUTTING_ON_CAP = 0x0000133D, -- (0x13D | FLAG_STATIONARY | FLAG_INTANGIBLE)
-- group 0x140: "automatic" actions
HOLDING_POLE = 0x08100340, -- (0x140 | FLAG_STATIONARY | FLAG_ON_POLE | FLAG_PAUSE_EXIT)
GRAB_POLE_SLOW = 0x00100341, -- (0x141 | FLAG_STATIONARY | FLAG_ON_POLE)
GRAB_POLE_FAST = 0x00100342, -- (0x142 | FLAG_STATIONARY | FLAG_ON_POLE)
CLIMBING_POLE = 0x00100343, -- (0x143 | FLAG_STATIONARY | FLAG_ON_POLE)
TOP_OF_POLE_TRANSITION = 0x00100344, -- (0x144 | FLAG_STATIONARY | FLAG_ON_POLE)
TOP_OF_POLE = 0x00100345, -- (0x145 | FLAG_STATIONARY | FLAG_ON_POLE)
START_HANGING = 0x08200348, -- (0x148 | FLAG_STATIONARY | FLAG_HANGING | FLAG_PAUSE_EXIT)
HANGING = 0x00200349, -- (0x149 | FLAG_STATIONARY | FLAG_HANGING)
HANG_MOVING = 0x0020054A, -- (0x14A | FLAG_MOVING | FLAG_HANGING)
LEDGE_GRAB = 0x0800034B, -- (0x14B | FLAG_STATIONARY | FLAG_PAUSE_EXIT)
LEDGE_CLIMB_SLOW = 0x0000054C, -- (0x14C | FLAG_MOVING)
LEDGE_CLIMB_DOWN = 0x0000054D, -- (0x14D | FLAG_MOVING)
LEDGE_CLIMB_FAST = 0x0000054E, -- (0x14E | FLAG_MOVING)
GRABBED = 0x00020370, -- (0x170 | FLAG_STATIONARY | FLAG_INVULNERABLE)
IN_CANNON = 0x00001371, -- (0x171 | FLAG_STATIONARY | FLAG_INTANGIBLE)
TORNADO_TWIRLING = 0x10020372, -- (0x172 | FLAG_STATIONARY | FLAG_INVULNERABLE | FLAG_SWIMMING_OR_FLYING)
-- group 0x180: object actions
PUNCHING = 0x00800380, -- (0x180 | FLAG_STATIONARY | FLAG_ATTACKING)
PICKING_UP = 0x00000383, -- (0x183 | FLAG_STATIONARY)
DIVE_PICKING_UP = 0x00000385, -- (0x185 | FLAG_STATIONARY)
STOMACH_SLIDE_STOP = 0x00000386, -- (0x186 | FLAG_STATIONARY)
PLACING_DOWN = 0x00000387, -- (0x187 | FLAG_STATIONARY)
THROWING = 0x80000588, -- (0x188 | FLAG_MOVING | FLAG_THROWING)
HEAVY_THROW = 0x80000589, -- (0x189 | FLAG_MOVING | FLAG_THROWING)
PICKING_UP_BOWSER = 0x00000390, -- (0x190 | FLAG_STATIONARY)
HOLDING_BOWSER = 0x00000391, -- (0x191 | FLAG_STATIONARY)
RELEASING_BOWSER = 0x00000392, -- (0x192 | FLAG_STATIONARY)
}

18
sm64/Enums/Buttons.lua Normal file
View file

@ -0,0 +1,18 @@
--!strict
return {
A_BUTTON = 0x8000,
B_BUTTON = 0x4000,
L_TRIG = 0x0020,
R_TRIG = 0x0010,
Z_TRIG = 0x2000,
START_BUTTON = 0x1000,
U_JPAD = 0x0800,
L_JPAD = 0x0200,
R_JPAD = 0x0100,
D_JPAD = 0x0400,
U_CBUTTONS = 0x0008,
L_CBUTTONS = 0x0002,
R_CBUTTONS = 0x0001,
D_CBUTTONS = 0x0004,
}

20
sm64/Enums/FloorType.lua Normal file
View file

@ -0,0 +1,20 @@
--!strict
return {
NONZERO_ANALOG = 0x0001,
A_PRESSED = 0x0002,
OFF_FLOOR = 0x0004,
ABOVE_SLIDE = 0x0008,
FIRST_PERSON = 0x0010,
UNKNOWN_5 = 0x0020,
SQUISHED = 0x0040,
A_DOWN = 0x0080,
IN_POISON_GAS = 0x0100,
IN_WATER = 0x0200,
STOMPED = 0x0400,
INTERACT_OBJ_GRABBABLE = 0x0800,
UNKNOWN_12 = 0x1000,
B_PRESSED = 0x2000,
Z_DOWN = 0x4000,
Z_PRESSED = 0x8000,
}

20
sm64/Enums/InputFlags.lua Normal file
View file

@ -0,0 +1,20 @@
--!strict
return {
NONZERO_ANALOG = 0x0001,
A_PRESSED = 0x0002,
OFF_FLOOR = 0x0004,
ABOVE_SLIDE = 0x0008,
FIRST_PERSON = 0x0010,
UNKNOWN_5 = 0x0020,
SQUISHED = 0x0040,
A_DOWN = 0x0080,
IN_POISON_GAS = 0x0100,
IN_WATER = 0x0200,
STOMPED = 0x0400,
INTERACT_OBJ_GRABBABLE = 0x0800,
UNKNOWN_12 = 0x1000,
B_PRESSED = 0x2000,
Z_DOWN = 0x4000,
Z_PRESSED = 0x8000,
}

9
sm64/Enums/Mario/Cap.lua Normal file
View file

@ -0,0 +1,9 @@
--!strict
return {
DEFAULT_CAP_ON = 0,
DEFAULT_CAP_OFF = 1,
WING_CAP_ON = 2,
WING_CAP_OFF = 3,
}

11
sm64/Enums/Mario/Eyes.lua Normal file
View file

@ -0,0 +1,11 @@
--!strict
return {
BLINK = 0,
OPEN = 1,
HALF_CLOSED = 2,
CLOSED = 3,
DEAD = 4,
}

View file

@ -0,0 +1,24 @@
--!strict
local MarioFlags = {
NORMAL_CAP = 0x00000001,
VANISH_CAP = 0x00000002,
METAL_CAP = 0x00000004,
WING_CAP = 0x00000008,
CAP_ON_HEAD = 0x00000010,
CAP_IN_HAND = 0x00000020,
METAL_SHOCK = 0x00000040,
TELEPORTING = 0x00000080,
MOVING_UP_IN_AIR = 0x00000100,
ACTION_SOUND_PLAYED = 0x00010000,
MARIO_SOUND_PLAYED = 0x00020000,
FALLING_FAR = 0x00040000,
PUNCHING = 0x00100000,
KICKING = 0x00200000,
TRIPPING = 0x00400000,
}
MarioFlags.SPECIAL_CAPS = MarioFlags.VANISH_CAP + MarioFlags.METAL_CAP + MarioFlags.WING_CAP
MarioFlags.CAPS = MarioFlags.NORMAL_CAP + MarioFlags.SPECIAL_CAPS
return MarioFlags

View file

@ -0,0 +1,10 @@
--!strict
return {
FISTS = 0,
OPEN = 1,
PEACE_SIGN = 2,
HOLDING_CAP = 3,
HOLDING_WING_CAP = 4,
RIGHT_OPEN = 5,
}

View file

@ -0,0 +1,19 @@
--!strict
return {
NONZERO_ANALOG = 0x0001,
A_PRESSED = 0x0002,
OFF_FLOOR = 0x0004,
ABOVE_SLIDE = 0x0008,
FIRST_PERSON = 0x0010,
UNKNOWN_5 = 0x0020,
SQUISHED = 0x0040,
A_DOWN = 0x0080,
IN_POISON_GAS = 0x0100,
IN_WATER = 0x0200,
STOMPED = 0x0400,
INTERACT_OBJ_GRABBABLE = 0x0800,
B_PRESSED = 0x2000,
Z_DOWN = 0x4000,
Z_PRESSED = 0x8000,
}

View file

@ -0,0 +1,7 @@
--!strict
return {
METAL = 0x1,
INVISIBLE = 0x2,
NOISE_ALPHA = 0x4,
}

View file

@ -0,0 +1,22 @@
--!strict
return {
DUST = bit32.lshift(1, 0),
VERTICAL_STAR = bit32.lshift(1, 1),
SPARKLES = bit32.lshift(1, 3),
HORIZONTAL_STAR = bit32.lshift(1, 4),
BUBBLE = bit32.lshift(1, 5),
WATER_SPLASH = bit32.lshift(1, 6),
IDLE_WATER_WAVE = bit32.lshift(1, 7),
SHALLOW_WATER_WAVE = bit32.lshift(1, 8),
PLUNGE_BUBBLE = bit32.lshift(1, 9),
WAVE_TRAIL = bit32.lshift(1, 10),
FIRE = bit32.lshift(1, 11),
SHALLOW_WATER_SPLASH = bit32.lshift(1, 12),
LEAF = bit32.lshift(1, 13),
SNOW = bit32.lshift(1, 14),
DIRT = bit32.lshift(1, 15),
MIST_CIRCLE = bit32.lshift(1, 16),
BREATH = bit32.lshift(1, 17),
TRIANGLE = bit32.lshift(1, 18),
}

13
sm64/Enums/Steps/Air.lua Normal file
View file

@ -0,0 +1,13 @@
--!strict
return {
NONE = 0,
LANDED = 1,
HIT_WALL = 2,
GRABBED_LEDGE = 3,
GRABBED_CEILING = 4,
HIT_LAVA_WALL = 6,
CHECK_LEDGE_GRAB = 1,
CHECK_HANG = 2,
}

View file

@ -0,0 +1,9 @@
--!strict
return {
LEFT_GROUND = 0,
NONE = 1,
HIT_WALL = 2,
HIT_WALL_STOP_QSTEPS = 3,
HIT_WALL_CONTINUE_QSTEPS = 4,
}

View file

@ -0,0 +1,9 @@
--!strict
return {
NONE = 0,
HIT_FLOOR = 1,
HIT_CEILING = 2,
CANCELLED = 3,
HIT_WALL = 4,
}

View file

@ -0,0 +1,8 @@
--!strict
return {
DEFAULT = 0x0000,
VERY_SLIPPERY = 0x0013,
SLIPPERY = 0x0014,
NOT_SLIPPERY = 0x0015,
}

View file

@ -0,0 +1,50 @@
--!strict
local TerrainType = {
DEFAULT = 0,
GRASS = 1,
WATER = 2,
STONE = 3,
SPOOKY = 4,
SNOW = 5,
ICE = 6,
SAND = 7,
METAL = 8,
}
TerrainType.FROM_MATERIAL = {
[Enum.Material.Mud] = TerrainType.GRASS,
[Enum.Material.Grass] = TerrainType.GRASS,
[Enum.Material.Ground] = TerrainType.GRASS,
[Enum.Material.LeafyGrass] = TerrainType.GRASS,
[Enum.Material.Ice] = TerrainType.ICE,
[Enum.Material.Marble] = TerrainType.ICE,
[Enum.Material.Glacier] = TerrainType.ICE,
[Enum.Material.Wood] = TerrainType.SPOOKY,
[Enum.Material.WoodPlanks] = TerrainType.SPOOKY,
[Enum.Material.Foil] = TerrainType.METAL,
[Enum.Material.Metal] = TerrainType.METAL,
[Enum.Material.DiamondPlate] = TerrainType.METAL,
[Enum.Material.CorrodedMetal] = TerrainType.METAL,
[Enum.Material.Rock] = TerrainType.STONE,
[Enum.Material.Salt] = TerrainType.STONE,
[Enum.Material.Brick] = TerrainType.STONE,
[Enum.Material.Slate] = TerrainType.STONE,
[Enum.Material.Basalt] = TerrainType.STONE,
[Enum.Material.Pebble] = TerrainType.STONE,
[Enum.Material.Granite] = TerrainType.STONE,
[Enum.Material.Sandstone] = TerrainType.STONE,
[Enum.Material.Cobblestone] = TerrainType.STONE,
[Enum.Material.CrackedLava] = TerrainType.STONE,
[Enum.Material.Snow] = TerrainType.SNOW,
[Enum.Material.Sand] = TerrainType.SAND,
[Enum.Material.Water] = TerrainType.WATER,
[Enum.Material.Fabric] = TerrainType.SNOW,
}
return TerrainType

42
sm64/Enums/init.lua Normal file
View file

@ -0,0 +1,42 @@
--!strict
local Enums = {
Action = require(script.Action),
Buttons = require(script.Buttons),
ActionFlags = require(script.Action.Flags),
ActionGroups = require(script.Action.Groups),
MarioCap = require(script.Mario.Cap),
MarioEyes = require(script.Mario.Eyes),
MarioFlags = require(script.Mario.Flags),
MarioHands = require(script.Mario.Hands),
MarioInput = require(script.Mario.Input),
AirStep = require(script.Steps.Air),
WaterStep = require(script.Steps.Water),
GroundStep = require(script.Steps.Ground),
InputFlags = require(script.InputFlags),
ModelFlags = require(script.ModelFlags),
SurfaceClass = require(script.SurfaceClass),
TerrainType = require(script.TerrainType),
ParticleFlags = require(script.ParticleFlags),
}
local nameIndex: { [any]: { [number]: string } } = {}
function Enums.GetName(map, value): string
if not nameIndex[map] then
local index = {}
for name, value in pairs(map) do
index[value] = name
end
nameIndex[map] = index
end
return nameIndex[map][value]
end
return table.freeze(Enums)

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,169 @@
--!strict
local System = require(script.Parent)
local Animations = System.Animations
local Sounds = System.Sounds
local Enums = System.Enums
local Util = System.Util
local Action = Enums.Action
local ActionFlags = Enums.ActionFlags
local ActionGroup = Enums.ActionGroups
local AirStep = Enums.AirStep
local MarioEyes = Enums.MarioEyes
local InputFlags = Enums.InputFlags
local MarioFlags = Enums.MarioFlags
local ParticleFlags = Enums.ParticleFlags
type Mario = System.Mario
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
-- Helpers
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
local function letGoOfLedge(m: Mario)
local floorHeight
m.Velocity *= Vector3.new(1, 0, 1)
m.ForwardVel = -8
local x = 60 * Util.Sins(m.FaceAngle.Y)
local z = 60 * Util.Coss(m.FaceAngle.Y)
m.Position -= Vector3.new(x, 0, z)
floorHeight = Util.FindFloor(m.Position)
if floorHeight < m.Position.Y - 100 then
m.Position -= (Vector3.yAxis * 100)
else
m.Position = Util.SetY(m.Position, floorHeight)
end
return m:SetAction(Action.SOFT_BONK)
end
local function climbUpLedge(m: Mario)
local x = 14 * Util.Sins(m.FaceAngle.Y)
local z = 14 * Util.Coss(m.FaceAngle.Y)
m:SetAnimation(Animations.IDLE_HEAD_LEFT)
m.Position += Vector3.new(x, 0, z)
end
local function updateLedgeClimb(m: Mario, anim: Animation, endAction: number)
m:StopAndSetHeightToFloor()
m:SetAnimation(anim)
if m:IsAnimAtEnd() then
m:SetAction(endAction)
if endAction == Action.IDLE then
climbUpLedge(m)
end
end
end
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
-- Actions
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
local DEF_ACTION: (number, (Mario) -> boolean) -> () = System.RegisterAction
DEF_ACTION(Action.LEDGE_GRAB, function(m: Mario)
local intendedDYaw = m.IntendedYaw - m.FaceAngle.Y
local hasSpaceForMario = m.CeilHeight - m.FloorHeight >= 160
if m.ActionTimer < 10 then
m.ActionTimer += 1
end
if m.Floor and m.Floor.Normal.Y < 0.9063078 then
return letGoOfLedge(m)
end
if m.Input:Has(InputFlags.Z_PRESSED, InputFlags.OFF_FLOOR) then
return letGoOfLedge(m)
end
if m.Input:Has(InputFlags.A_PRESSED) and hasSpaceForMario then
return m:SetAction(Action.LEDGE_CLIMB_FAST)
end
if m.Input:Has(InputFlags.STOMPED) then
return letGoOfLedge(m)
end
if m.ActionTimer == 10 and m.Input:Has(InputFlags.NONZERO_ANALOG) then
if math.abs(intendedDYaw) <= 0x4000 then
if hasSpaceForMario then
return m:SetAction(Action.LEDGE_CLIMB_SLOW)
end
else
return letGoOfLedge(m)
end
end
local heightAboveFloor = m.Position.Y - m:FindFloorHeightRelativePolar(-0x8000, 30)
if hasSpaceForMario and heightAboveFloor < 100 then
return m:SetAction(Action.LEDGE_CLIMB_FAST)
end
if m.ActionArg == 0 then
m:PlaySoundIfNoFlag(Sounds.MARIO_WHOA, MarioFlags.MARIO_SOUND_PLAYED)
end
m:StopAndSetHeightToFloor()
m:SetAnimation(Animations.IDLE_ON_LEDGE)
return false
end)
DEF_ACTION(Action.LEDGE_CLIMB_SLOW, function(m: Mario)
if m.Input:Has(InputFlags.OFF_FLOOR) then
return letGoOfLedge(m)
end
if m.ActionTimer >= 28 then
if
m.Input:Has(InputFlags.NONZERO_ANALOG, InputFlags.A_PRESSED, InputFlags.OFF_FLOOR, InputFlags.ABOVE_SLIDE)
then
climbUpLedge(m)
return m:CheckCommonActionExits()
end
end
if m.ActionTimer == 10 then
m:PlaySoundIfNoFlag(Sounds.MARIO_EEUH, MarioFlags.MARIO_SOUND_PLAYED)
end
updateLedgeClimb(m, Animations.SLOW_LEDGE_GRAB, Action.IDLE)
return false
end)
DEF_ACTION(Action.LEDGE_CLIMB_DOWN, function(m: Mario)
if m.Input:Has(InputFlags.OFF_FLOOR) then
return letGoOfLedge(m)
end
m:PlaySoundIfNoFlag(Sounds.MARIO_WHOA, MarioFlags.MARIO_SOUND_PLAYED)
updateLedgeClimb(m, Animations.CLIMB_DOWN_LEDGE, Action.LEDGE_GRAB)
m.ActionArg = 1
return false
end)
DEF_ACTION(Action.LEDGE_CLIMB_FAST, function(m: Mario)
if m.Input:Has(InputFlags.OFF_FLOOR) then
return letGoOfLedge(m)
end
m:PlaySoundIfNoFlag(Sounds.MARIO_UH2, MarioFlags.MARIO_SOUND_PLAYED)
updateLedgeClimb(m, Animations.FAST_LEDGE_GRAB, Action.IDLE)
if m.AnimFrame == 8 then
m:PlayLandingSound(Sounds.ACTION_TERRAIN_LANDING)
end
return false
end)

1496
sm64/Mario/Moving.client.lua Normal file

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,677 @@
--!strict
local System = require(script.Parent)
local Animations = System.Animations
local Sounds = System.Sounds
local Enums = System.Enums
local Util = System.Util
local Action = Enums.Action
local ActionFlags = Enums.ActionFlags
local ActionGroup = Enums.ActionGroups
local AirStep = Enums.AirStep
local MarioEyes = Enums.MarioEyes
local InputFlags = Enums.InputFlags
local MarioFlags = Enums.MarioFlags
local ParticleFlags = Enums.ParticleFlags
type Mario = System.Mario
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
-- Helpers
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
local DEF_ACTION: (number, (Mario) -> boolean) -> () = System.RegisterAction
local function checkCommonIdleCancels(m: Mario)
local floor = m.Floor
if floor and floor.Normal.Y < 0.29237169 then
return m:PushOffSteepFloor(Action.FREEFALL, 0)
end
if m.Input:Has(InputFlags.STOMPED) then
return m:SetAction(Action.SHOCKWAVE_BOUNCE)
end
if m.Input:Has(InputFlags.A_PRESSED) then
return m:SetJumpingAction(Action.JUMP, 0)
end
if m.Input:Has(InputFlags.OFF_FLOOR) then
return m:SetAction(Action.FREEFALL)
end
if m.Input:Has(InputFlags.ABOVE_SLIDE) then
return m:SetAction(Action.BEGIN_SLIDING)
end
if m.Input:Has(InputFlags.NONZERO_ANALOG) then
m.FaceAngle = Util.SetYint16(m.FaceAngle, m.IntendedYaw)
return m:SetAction(Action.WALKING)
end
if m.Input:Has(InputFlags.B_PRESSED) then
return m:SetAction(Action.PUNCHING)
end
if m.Input:Has(InputFlags.Z_DOWN) then
return m:SetAction(Action.START_CROUCHING)
end
return false
end
local function playAnimSound(m: Mario, actionState: number, animFrame: number, sound: Sound)
if m.ActionState == actionState and m.AnimFrame == animFrame then
m:PlaySound(sound)
end
end
local function stoppingStep(m: Mario, anim: Animation, action: number)
m:StationaryGroundStep()
m:SetAnimation(anim)
if m:IsAnimPastEnd() then
m:SetAction(action)
end
end
local function landingStep(m: Mario, anim: Animation, action: number)
stoppingStep(m, anim, action)
return false
end
local function checkCommonLandingCancels(m: Mario, action: number)
if m.Input:Has(InputFlags.STOMPED) then
return m:SetAction(Action.SHOCKWAVE_BOUNCE)
end
if m.Input:Has(InputFlags.A_PRESSED) then
if action == 0 then
m:SetJumpFromLanding()
else
m:SetJumpingAction(action, 0)
end
end
if m.Input:Has(InputFlags.NONZERO_ANALOG, InputFlags.A_PRESSED, InputFlags.OFF_FLOOR, InputFlags.ABOVE_SLIDE) then
return m:CheckCommonActionExits()
end
if m.Input:Has(InputFlags.B_PRESSED) then
return m:SetAction(Action.PUNCHING)
end
return false
end
local function animatedStationaryGroundStep(m: Mario, anim: Animation, endAction: number)
m:StationaryGroundStep()
m:SetAnimation(anim)
if m:IsAnimAtEnd() then
m:SetAction(endAction)
end
end
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
-- Actions
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
DEF_ACTION(Action.IDLE, function(m: Mario)
if not bit32.btest(m.ActionArg, 1) and m.Health < 0x300 then
return m:SetAction(Action.PANTING)
end
if checkCommonIdleCancels(m) then
return true
end
if m.ActionState == 3 then
return m:SetAction(Action.START_SLEEPING)
end
if bit32.btest(m.ActionArg, 1) then
m:SetAnimation(Animations.STAND_AGAINST_WALL)
else
if m.ActionState == 0 then
m:SetAnimation(Animations.IDLE_HEAD_LEFT)
elseif m.ActionState == 1 then
m:SetAnimation(Animations.IDLE_HEAD_RIGHT)
elseif m.ActionState == 2 then
m:SetAnimation(Animations.IDLE_HEAD_CENTER)
end
if m:IsAnimAtEnd() then
m.ActionState += 1
if m.ActionState == 3 then
local deltaYOfFloorBehindMario = m.Position.Y - m:FindFloorHeightRelativePolar(-0x8000, 60)
if 24 < math.abs(deltaYOfFloorBehindMario) then
m.ActionState = 0
else
m.ActionTimer += 1
if m.ActionTimer < 10 then
m.ActionState = 0
end
end
end
end
end
m:StationaryGroundStep()
return false
end)
DEF_ACTION(Action.START_SLEEPING, function(m: Mario)
local animFrame
if checkCommonIdleCancels(m) then
return true
end
if m.ActionState == 4 then
m:SetAction(Action.SLEEPING)
end
if m.ActionState == 0 then
animFrame = m:SetAnimation(Animations.START_SLEEP_IDLE)
elseif m.ActionState == 1 then
animFrame = m:SetAnimation(Animations.START_SLEEP_SCRATCH)
elseif m.ActionState == 2 then
animFrame = m:SetAnimation(Animations.START_SLEEP_YAWN)
m.BodyState.EyeState = MarioEyes.HALF_CLOSED
elseif m.ActionState == 3 then
animFrame = m:SetAnimation(Animations.START_SLEEP_SITTING)
m.BodyState.EyeState = MarioEyes.HALF_CLOSED
end
playAnimSound(m, 1, 41, Sounds.ACTION_PAT_BACK)
playAnimSound(m, 1, 49, Sounds.ACTION_PAT_BACK)
if m:IsAnimAtEnd() then
m.ActionState += 1
end
if m.ActionState == 2 and animFrame == -1 then
m:PlaySound(Sounds.MARIO_YAWNING)
end
if m.ActionState == 1 and animFrame == -1 then
m:PlaySound(Sounds.MARIO_IMA_TIRED)
end
m:StationaryGroundStep()
return false
end)
DEF_ACTION(Action.SLEEPING, function(m: Mario)
local animFrame
if
m.Input:Has(
InputFlags.NONZERO_ANALOG,
InputFlags.A_PRESSED,
InputFlags.OFF_FLOOR,
InputFlags.ABOVE_SLIDE,
InputFlags.FIRST_PERSON,
InputFlags.STOMPED,
InputFlags.B_PRESSED,
InputFlags.Z_PRESSED
)
then
return m:SetAction(Action.WAKING_UP, m.ActionState)
end
if m.Position.Y - m:FindFloorHeightRelativePolar(-0x8000, 60) > 24 then
return m:SetAction(Action.WAKING_UP, m.ActionState)
end
m.BodyState.EyeState = MarioEyes.CLOSED
m:StationaryGroundStep()
if m.ActionState == 0 then
animFrame = m:SetAnimation(Animations.SLEEP_IDLE)
if animFrame == 2 then
m:PlaySound(Sounds.MARIO_SNORING1)
end
if animFrame == 20 then
m:PlaySound(Sounds.MARIO_SNORING2)
end
if m:IsAnimAtEnd() then
m.ActionTimer += 1
if m.ActionTimer > 45 then
m.ActionState += 1
end
end
elseif m.ActionState == 1 then
if m:SetAnimation(Animations.SLEEP_START_LYING) == 18 then
m:PlayHeavyLandingSound(Sounds.ACTION_TERRAIN_BODY_HIT_GROUND)
end
if m:IsAnimAtEnd() then
m.ActionState += 1
end
elseif m.ActionState == 2 then
m:SetAnimation(Animations.SLEEP_LYING)
m:PlaySoundIfNoFlag(Sounds.MARIO_SNORING3, MarioFlags.ACTION_SOUND_PLAYED)
end
return false
end)
DEF_ACTION(Action.WAKING_UP, function(m: Mario)
if m.Input:Has(InputFlags.STOMPED) then
return m:SetAction(Action.SHOCKWAVE_BOUNCE)
end
if m.Input:Has(InputFlags.OFF_FLOOR) then
return m:SetAction(Action.FREEFALL)
end
if m.Input:Has(InputFlags.ABOVE_SLIDE) then
return m:SetAction(Action.BEGIN_SLIDING)
end
m.ActionTimer += 1
if m.ActionTimer > 20 then
return m:SetAction(Action.IDLE)
end
m:StationaryGroundStep()
m:SetAnimation(if m.ActionArg == 0 then Animations.WAKE_FROM_SLEEP else Animations.WAKE_FROM_LYING)
return false
end)
DEF_ACTION(Action.STANDING_AGAINST_WALL, function(m: Mario)
if m.Input:Has(InputFlags.STOMPED) then
return m:SetAction(Action.SHOCKWAVE_BOUNCE)
end
if m.Input:Has(InputFlags.NONZERO_ANALOG, InputFlags.A_PRESSED, InputFlags.OFF_FLOOR, InputFlags.ABOVE_SLIDE) then
return m:CheckCommonActionExits()
end
if m.Input:Has(InputFlags.B_PRESSED) then
return m:SetAction(Action.PUNCHING)
end
m:SetAnimation(Animations.A_POSE)
m:StationaryGroundStep()
return false
end)
DEF_ACTION(Action.CROUCHING, function(m: Mario)
if m.Input:Has(InputFlags.STOMPED) then
return m:SetAction(Action.SHOCKWAVE_BOUNCE)
end
if m.Input:Has(InputFlags.A_PRESSED) then
return m:SetAction(Action.BACKFLIP)
end
if m.Input:Has(InputFlags.OFF_FLOOR) then
return m:SetAction(Action.FREEFALL)
end
if m.Input:Has(InputFlags.ABOVE_SLIDE) then
return m:SetAction(Action.BEGIN_SLIDING)
end
if not m.Input:Has(InputFlags.Z_DOWN) then
return m:SetAction(Action.STOP_CROUCHING)
end
if m.Input:Has(InputFlags.NONZERO_ANALOG) then
return m:SetAction(Action.START_CRAWLING)
end
if m.Input:Has(InputFlags.B_PRESSED) then
return m:SetAction(Action.PUNCHING, 9)
end
m:StationaryGroundStep()
m:SetAnimation(Animations.CROUCHING)
return false
end)
DEF_ACTION(Action.PANTING, function(m: Mario)
if m.Input:Has(InputFlags.STOMPED) then
return m:SetAction(Action.SHOCKWAVE_BOUNCE)
end
if m.Health >= 0x500 then
return m:SetAction(Action.IDLE)
end
if checkCommonIdleCancels(m) then
return true
end
if m:SetAnimation(Animations.PANTING) == 1 then
m:PlaySound(Sounds.MARIO_PANTING)
end
m:StationaryGroundStep()
m.BodyState.EyeState = MarioEyes.HALF_CLOSED
return false
end)
DEF_ACTION(Action.BRAKING_STOP, function(m: Mario)
if m.Input:Has(InputFlags.STOMPED) then
return m:SetAction(Action.SHOCKWAVE_BOUNCE)
end
if m.Input:Has(InputFlags.OFF_FLOOR) then
return m:SetAction(Action.FREEFALL)
end
if m.Input:Has(InputFlags.B_PRESSED) then
return m:SetAction(Action.PUNCHING)
end
if m.Input:Has(InputFlags.NONZERO_ANALOG, InputFlags.A_PRESSED, InputFlags.OFF_FLOOR, InputFlags.ABOVE_SLIDE) then
return m:CheckCommonActionExits()
end
stoppingStep(m, Animations.STOP_SKID, Action.IDLE)
return false
end)
DEF_ACTION(Action.BUTT_SLIDE_STOP, function(m: Mario)
if m.Input:Has(InputFlags.STOMPED) then
return m:SetAction(Action.SHOCKWAVE_BOUNCE)
end
if m.Input:Has(InputFlags.NONZERO_ANALOG, InputFlags.A_PRESSED, InputFlags.OFF_FLOOR, InputFlags.ABOVE_SLIDE) then
return m:CheckCommonActionExits()
end
stoppingStep(m, Animations.STOP_SLIDE, Action.IDLE)
if m.AnimFrame == 6 then
m:PlayLandingSound()
end
return false
end)
DEF_ACTION(Action.SLIDE_KICK_SLIDE_STOP, function(m: Mario)
if m.Input:Has(InputFlags.STOMPED) then
return m:SetAction(Action.SHOCKWAVE_BOUNCE)
end
if m.Input:Has(InputFlags.OFF_FLOOR) then
return m:SetAction(Action.FREEFALL)
end
stoppingStep(m, Animations.CROUCH_FROM_SLIDE_KICK, Action.CROUCHING)
return false
end)
DEF_ACTION(Action.START_CROUCHING, function(m: Mario)
if m:CheckCommonActionExits() then
return true
end
m:StationaryGroundStep()
m:SetAnimation(Animations.START_CROUCHING)
if m:IsAnimPastEnd() then
m:SetAction(Action.CROUCHING)
end
return false
end)
DEF_ACTION(Action.STOP_CROUCHING, function(m: Mario)
if m:CheckCommonActionExits() then
return true
end
m:StationaryGroundStep()
m:SetAnimation(Animations.START_CROUCHING)
if m:IsAnimPastEnd() then
m:SetAction(Action.IDLE)
end
return false
end)
DEF_ACTION(Action.START_CRAWLING, function(m: Mario)
if m.Input:Has(InputFlags.OFF_FLOOR) then
return m:SetAction(Action.FREEFALL)
end
if m.Input:Has(InputFlags.STOMPED) then
return m:SetAction(Action.SHOCKWAVE_BOUNCE)
end
if m.Input:Has(InputFlags.ABOVE_SLIDE) then
return m:SetAction(Action.BEGIN_SLIDING)
end
m:StationaryGroundStep()
m:SetAnimation(Animations.START_CRAWLING)
if m:IsAnimPastEnd() then
m:SetAction(Action.CRAWLING)
end
return false
end)
DEF_ACTION(Action.STOP_CRAWLING, function(m: Mario)
if m.Input:Has(InputFlags.OFF_FLOOR) then
return m:SetAction(Action.FREEFALL)
end
if m.Input:Has(InputFlags.STOMPED) then
return m:SetAction(Action.SHOCKWAVE_BOUNCE)
end
if m.Input:Has(InputFlags.ABOVE_SLIDE) then
return m:SetAction(Action.BEGIN_SLIDING)
end
m:StationaryGroundStep()
m:SetAnimation(Animations.STOP_CRAWLING)
if m:IsAnimPastEnd() then
m:SetAction(Action.CROUCHING)
end
return false
end)
DEF_ACTION(Action.SHOCKWAVE_BOUNCE, function(m: Mario)
m.ActionTimer += 1
if m.ActionTimer == 48 then
m:SetAction(Action.IDLE)
end
local sp1E = bit32.lshift(m.ActionTimer % 16, 12)
local sp18 = ((6 - m.ActionTimer / 8) * 8) + 4
m:SetForwardVel(0)
m.Velocity = Vector3.zero
if Util.Sins(sp1E) >= 0 then
m.Position = Util.SetY(m.Position, Util.Sins(sp1E) * sp18 + m.FloorHeight)
else
m.Position = Util.SetY(m.Position, m.FloorHeight - Util.Sins(sp1E) * sp18)
end
m:SetAnimation(Animations.A_POSE)
return false
end)
DEF_ACTION(Action.JUMP_LAND_STOP, function(m: Mario)
if checkCommonLandingCancels(m, 0) then
return true
end
landingStep(m, Animations.LAND_FROM_SINGLE_JUMP, Action.IDLE)
return false
end)
DEF_ACTION(Action.DOUBLE_JUMP_LAND_STOP, function(m: Mario)
if checkCommonLandingCancels(m, 0) then
return true
end
landingStep(m, Animations.LAND_FROM_DOUBLE_JUMP, Action.IDLE)
return false
end)
DEF_ACTION(Action.SIDE_FLIP_LAND_STOP, function(m: Mario)
if checkCommonLandingCancels(m, 0) then
return true
end
landingStep(m, Animations.SLIDEFLIP_LAND, Action.IDLE)
return false
end)
DEF_ACTION(Action.FREEFALL_LAND_STOP, function(m: Mario)
if checkCommonLandingCancels(m, 0) then
return true
end
landingStep(m, Animations.GENERAL_LAND, Action.IDLE)
return false
end)
DEF_ACTION(Action.TRIPLE_JUMP_LAND_STOP, function(m: Mario)
if checkCommonLandingCancels(m, Action.JUMP) then
return true
end
landingStep(m, Animations.GENERAL_LAND, Action.IDLE)
return false
end)
DEF_ACTION(Action.BACKFLIP_LAND_STOP, function(m: Mario)
if not m.Input:Has(InputFlags.Z_DOWN) and m.AnimFrame >= 6 then
m.Input:Remove(InputFlags.A_PRESSED)
end
if checkCommonLandingCancels(m, Action.BACKFLIP) then
return true
end
landingStep(m, Animations.TRIPLE_JUMP_LAND, Action.IDLE)
return false
end)
DEF_ACTION(Action.LAVA_BOOST_LAND, function(m: Mario)
m.Input:Remove(InputFlags.FIRST_PERSON, InputFlags.B_PRESSED)
if checkCommonLandingCancels(m, 0) then
return true
end
landingStep(m, Animations.STAND_UP_FROM_LAVA_BOOST, Action.IDLE)
return false
end)
DEF_ACTION(Action.LONG_JUMP_LAND_STOP, function(m: Mario)
m.Input:Remove(InputFlags.B_PRESSED)
if checkCommonLandingCancels(m, Action.JUMP) then
return true
end
landingStep(
m,
if m.LongJumpIsSlow then Animations.CROUCH_FROM_FAST_LONGJUMP else Animations.CROUCH_FROM_SLOW_LONGJUMP,
Action.CROUCHING
)
return false
end)
DEF_ACTION(Action.TWIRL_LAND, function(m: Mario)
m.ActionState = 1
if m.Input:Has(InputFlags.STOMPED) then
return m:SetAction(Action.SHOCKWAVE_BOUNCE)
end
if m.Input:Has(InputFlags.OFF_FLOOR) then
return m:SetAction(Action.FREEFALL)
end
m:StationaryGroundStep()
m:SetAnimation(Animations.TWIRL_LAND)
if m.AngleVel.Y > 0 then
m.AngleVel -= Vector3int16.new(0, 0x400, 0)
if m.AngleVel.Y < 0 then
m.AngleVel *= Vector3int16.new(1, 0, 1)
end
m.TwirlYaw += m.AngleVel.Y
end
m.GfxAngle += Vector3int16.new(0, m.TwirlYaw, 0)
if m:IsAnimAtEnd() and m.AngleVel.Y == 0 then
m.FaceAngle += Vector3int16.new(0, m.TwirlYaw, 0)
m:SetAction(Action.IDLE)
end
return false
end)
DEF_ACTION(Action.GROUND_POUND_LAND, function(m: Mario)
if m.Input:Has(InputFlags.STOMPED) then
return m:SetAction(Action.SHOCKWAVE_BOUNCE)
end
if m.Input:Has(InputFlags.OFF_FLOOR) then
return m:SetAction(Action.FREEFALL)
end
if m.Input:Has(InputFlags.ABOVE_SLIDE) then
return m:SetAction(Action.BUTT_SLIDE)
end
landingStep(m, Animations.GROUND_POUND_LANDING, Action.BUTT_SLIDE_STOP)
return false
end)
DEF_ACTION(Action.STOMACH_SLIDE_STOP, function(m: Mario)
if m.Input:Has(InputFlags.STOMPED) then
return m:SetAction(Action.SHOCKWAVE_BOUNCE)
end
if m.Input:Has(InputFlags.OFF_FLOOR) then
return m:SetAction(Action.FREEFALL)
end
if m.Input:Has(InputFlags.ABOVE_SLIDE) then
return m:SetAction(Action.BEGIN_SLIDING)
end
animatedStationaryGroundStep(m, Animations.SLOW_LAND_FROM_DIVE, Action.IDLE)
return false
end)
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

1599
sm64/Mario/init.lua Normal file

File diff suppressed because it is too large Load diff

96
sm64/Sounds.lua Normal file
View file

@ -0,0 +1,96 @@
--!strict
local System = script.Parent
local Assets = System.Assets
local Sounds = Assets.Sounds
local Data = {
ACTION_BONK = Sounds.ACTION_BONK,
ACTION_FLYING_FAST = Sounds.ACTION_FLYING_FAST,
ACTION_HIT = Sounds.ACTION_HIT,
ACTION_METAL_BONK = Sounds.ACTION_METAL_BONK,
ACTION_METAL_HEAVY_LANDING = Sounds.ACTION_METAL_HEAVY_LANDING,
ACTION_METAL_LANDING = Sounds.ACTION_METAL_LANDING,
ACTION_METAL_STEP = Sounds.ACTION_METAL_STEP,
ACTION_PAT_BACK = Sounds.ACTION_PAT_BACK,
ACTION_SIDE_FLIP = Sounds.ACTION_SIDE_FLIP,
ACTION_SPIN = Sounds.ACTION_SPIN,
ACTION_HEAVY_LANDING = Sounds.ACTION_HEAVY_LANDING,
ACTION_TERRAIN_BODY_HIT_GROUND = Sounds.ACTION_TERRAIN_BODY_HIT_GROUND,
ACTION_TERRAIN_JUMP = Sounds.ACTION_TERRAIN_JUMP,
ACTION_TERRAIN_LANDING = Sounds.ACTION_TERRAIN_LANDING,
ACTION_TERRAIN_STEP = Sounds.ACTION_TERRAIN_STEP,
ACTION_THROW = Sounds.ACTION_THROW,
ACTION_TWIRL = Sounds.ACTION_TWIRL,
MARIO_ATTACKED = Sounds.MARIO_ATTACKED,
MARIO_DOH = Sounds.MARIO_DOH,
MARIO_GROUND_POUND_WAH = Sounds.MARIO_GROUND_POUND_WAH,
MARIO_HAHA = Sounds.MARIO_HAHA,
MARIO_HOO = Sounds.MARIO_HOO,
MARIO_HOOHOO = Sounds.MARIO_HOOHOO,
MARIO_IMA_TIRED = Sounds.MARIO_IMA_TIRED,
MARIO_MAMA_MIA = Sounds.MARIO_MAMA_MIA,
MARIO_ON_FIRE = Sounds.MARIO_ON_FIRE,
MARIO_OOOF = Sounds.MARIO_OOOF,
MARIO_PANTING = Sounds.MARIO_PANTING,
MARIO_PUNCH_YAH = Sounds.MARIO_PUNCH_YAH,
MARIO_PUNCH_WAH = Sounds.MARIO_PUNCH_WAH,
MARIO_PUNCH_HOO = Sounds.MARIO_PUNCH_HOO,
MARIO_SNORING1 = Sounds.MARIO_SNORING1,
MARIO_SNORING2 = Sounds.MARIO_SNORING2,
MARIO_SNORING3 = Sounds.MARIO_SNORING3,
MARIO_UH = Sounds.MARIO_UH,
MARIO_UH2 = Sounds.MARIO_UH2,
MARIO_WAAAOOOW = Sounds.MARIO_WAAAOOOW,
MARIO_WAH = Sounds.MARIO_WAH,
MARIO_WAHA = Sounds.MARIO_WAHA,
MARIO_WHOA = Sounds.MARIO_WHOA,
MARIO_YAH = Sounds.MARIO_YAH,
MARIO_YAHOO = Sounds.MARIO_YAHOO,
MARIO_YAWNING = Sounds.MARIO_YAWNING,
MARIO_YIPPEE = Sounds.MARIO_YIPPEE,
MOVING_FLYING = Sounds.MOVING_FLYING,
MOVING_LAVA_BURN = Sounds.MOVING_LAVA_BURN,
MOVING_TERRAIN_SLIDE = Sounds.MOVING_TERRAIN_SLIDE,
MARIO_JUMP = Sounds.MARIO_JUMP,
MARIO_YAH_WAH_HOO = Sounds.MARIO_YAH_WAH_HOO,
MARIO_YAHOO_WAHA_YIPPEE = Sounds.MARIO_YAHOO_WAHA_YIPPEE,
ACTION_TERRAIN_STEP_DEFAULT = Sounds.ACTION_TERRAIN_STEP_DEFAULT,
ACTION_TERRAIN_STEP_GRASS = Sounds.ACTION_TERRAIN_STEP_GRASS,
ACTION_TERRAIN_STEP_ICE = Sounds.ACTION_TERRAIN_STEP_ICE,
ACTION_TERRAIN_STEP_METAL = Sounds.ACTION_TERRAIN_STEP_METAL,
ACTION_TERRAIN_STEP_SAND = Sounds.ACTION_TERRAIN_STEP_SAND,
ACTION_TERRAIN_STEP_SNOW = Sounds.ACTION_TERRAIN_STEP_SNOW,
ACTION_TERRAIN_STEP_SPOOKY = Sounds.ACTION_TERRAIN_STEP_SPOOKY,
ACTION_TERRAIN_STEP_STONE = Sounds.ACTION_TERRAIN_STEP_STONE,
ACTION_TERRAIN_LANDING_DEFAULT = Sounds.ACTION_TERRAIN_LANDING_DEFAULT,
ACTION_TERRAIN_LANDING_GRASS = Sounds.ACTION_TERRAIN_LANDING_GRASS,
ACTION_TERRAIN_LANDING_ICE = Sounds.ACTION_TERRAIN_LANDING_ICE,
ACTION_TERRAIN_LANDING_METAL = Sounds.ACTION_TERRAIN_LANDING_METAL,
ACTION_TERRAIN_LANDING_SAND = Sounds.ACTION_TERRAIN_LANDING_SAND,
ACTION_TERRAIN_LANDING_SNOW = Sounds.ACTION_TERRAIN_LANDING_SNOW,
ACTION_TERRAIN_LANDING_SPOOKY = Sounds.ACTION_TERRAIN_LANDING_SPOOKY,
ACTION_TERRAIN_LANDING_STONE = Sounds.ACTION_TERRAIN_LANDING_STONE,
ACTION_TERRAIN_JUMP_DEFAULT = Sounds.ACTION_TERRAIN_LANDING_DEFAULT,
ACTION_TERRAIN_JUMP_GRASS = Sounds.ACTION_TERRAIN_LANDING_GRASS,
ACTION_TERRAIN_JUMP_ICE = Sounds.ACTION_TERRAIN_LANDING_ICE,
ACTION_TERRAIN_JUMP_METAL = Sounds.ACTION_TERRAIN_LANDING_METAL,
ACTION_TERRAIN_JUMP_SAND = Sounds.ACTION_TERRAIN_LANDING_SAND,
ACTION_TERRAIN_JUMP_SNOW = Sounds.ACTION_TERRAIN_LANDING_SNOW,
ACTION_TERRAIN_JUMP_SPOOKY = Sounds.ACTION_TERRAIN_LANDING_SPOOKY,
ACTION_TERRAIN_JUMP_STONE = Sounds.ACTION_TERRAIN_LANDING_STONE,
}
setmetatable(Data, {
__index = function(t, k)
warn("UNKNOWN SOUND:", k)
end,
})
return table.freeze(Data)

53
sm64/Types/Flags.lua Normal file
View file

@ -0,0 +1,53 @@
--!strict
local Flags = {}
Flags.__index = Flags
export type Flags = { Value: number }
export type Class = typeof(setmetatable({} :: Flags, Flags))
function Flags.new(...: number): Class
local flags = { Value = bit32.bor(...) }
return setmetatable(flags, Flags)
end
function Flags.__call(self: Class): number
return self.Value
end
function Flags.Get(self: Class): number
return self.Value
end
function Flags.Set(self: Class, ...: number)
self.Value = bit32.bor(...)
end
function Flags.Copy(self: Class, flags: Class)
self.Value = flags.Value
end
function Flags.Add(self: Class, ...: number)
self.Value = bit32.bor(self.Value, ...)
end
function Flags.Has(self: Class, ...: number): boolean
local mask = bit32.bor(...)
return bit32.btest(self.Value, mask)
end
function Flags.Remove(self: Class, ...: number)
local mask = bit32.bor(...)
local invert = bit32.bnot(mask)
self.Value = bit32.band(self.Value, invert)
end
function Flags.Band(self: Class, ...: number)
self.Value = bit32.band(self.Value, ...)
end
function Flags.Clear(self: Class)
self.Value = 0
end
return Flags

112
sm64/Types/init.lua Normal file
View file

@ -0,0 +1,112 @@
--!strict
local Flags = require(script.Flags)
export type Flags = Flags.Class
export type Controller = {
RawStickX: number,
RawStickY: number,
StickX: number,
StickY: number,
StickMag: number,
ButtonDown: Flags,
ButtonPressed: Flags,
}
export type BodyState = {
Action: number,
CapState: Flags,
EyeState: number,
HandState: Flags,
WingFlutter: boolean,
ModelState: Flags,
GrabPos: number,
PunchType: number,
PunchTimer: number,
TorsoAngle: Vector3int16,
HeadAngle: Vector3int16,
HeldObjLastPos: Vector3,
}
export type MarioState = {
Input: Flags,
Flags: Flags,
Action: Flags,
PrevAction: Flags,
ParticleFlags: Flags,
HitboxHeight: number,
TerrainType: number,
HeldObj: Instance?,
ActionState: number,
ActionTimer: number,
ActionArg: number,
IntendedMag: number,
IntendedYaw: number,
InvincTimer: number,
FramesSinceA: number,
FramesSinceB: number,
WallKickTimer: number,
DoubleJumpTimer: number,
FaceAngle: Vector3int16,
GfxAngle: Vector3int16,
AngleVel: Vector3int16,
ThrowMatrix: CFrame?,
SlideYaw: number,
TwirlYaw: number,
Position: Vector3,
Velocity: Vector3,
ForwardVel: number,
SlideVelX: number,
SlideVelZ: number,
Wall: RaycastResult?,
Ceil: RaycastResult?,
Floor: RaycastResult?,
CeilHeight: number,
FloorHeight: number,
FloorAngle: number,
WaterLevel: number,
BodyState: BodyState,
Controller: Controller,
Health: number,
HurtCounter: number,
HealCounter: number,
SquishTimer: number,
CapTimer: number,
BurnTimer: number,
PeakHeight: number,
SteepJumpYaw: number,
WalkingPitch: number,
QuicksandDepth: number,
LongJumpIsSlow: boolean,
AnimCurrent: Animation?,
AnimFrameCount: number,
AnimAccel: number,
AnimAccelAssist: number,
AnimFrame: number,
AnimDirty: boolean,
AnimReset: boolean,
AnimSetFrame: number,
AnimSkipInterp: boolean?,
}
local result = { Flags = Flags }
return table.freeze(result)

267
sm64/Util/init.lua Normal file
View file

@ -0,0 +1,267 @@
--!strict
local Util = {
GlobalTimer = 0,
Scale = 1 / 16,
}
local rayParams = RaycastParams.new()
rayParams.CollisionGroup = "Player"
local SHORT_TO_RAD = (2 * math.pi) / 0x10000
local VECTOR3_XZ = Vector3.one - Vector3.yAxis
local CARDINAL = {
-Vector3.xAxis,
-Vector3.zAxis,
Vector3.xAxis,
Vector3.zAxis,
}
function Util.SetX(vec: Vector3, x: number): Vector3
return Vector3.new(x, vec.Y, vec.Z)
end
function Util.SetXint16(vec: Vector3int16, x: number): Vector3int16
return Vector3int16.new(x, vec.Y, vec.Z)
end
function Util.SetY(vec: Vector3, y: number): Vector3
return Vector3.new(vec.X, y, vec.Z)
end
function Util.SetYint16(vec: Vector3int16, y: number): Vector3int16
return Vector3int16.new(vec.X, y, vec.Z)
end
function Util.SetZ(vec: Vector3, z: number): Vector3
return Vector3.new(vec.X, vec.Y, z)
end
function Util.SetZint16(vec: Vector3int16, z: number): Vector3int16
return Vector3int16.new(vec.X, vec.Y, z)
end
function Util.ToRoblox(v: Vector3)
return v * Util.Scale
end
function Util.ToSM64(v: Vector3)
return v / Util.Scale
end
function Util.ToEulerAngles(v: Vector3int16): Vector3
return Vector3.new(v.X, v.Y, v.Z) * SHORT_TO_RAD
end
function Util.ToRotation(v: Vector3int16): CFrame
local angle = Util.ToEulerAngles(v)
local matrix = CFrame.fromAxisAngle(Vector3.yAxis, angle.Y)
* CFrame.fromAxisAngle(Vector3.xAxis, -angle.X)
* CFrame.fromAxisAngle(Vector3.zAxis, -angle.Z)
return matrix
end
function Util.Raycast(pos: Vector3, dir: Vector3, rayParams: RaycastParams?, worldRoot: WorldRoot?): RaycastResult?
local root = worldRoot or workspace
local result: RaycastResult? = root:Raycast(pos, dir)
if script:GetAttribute("Debug") then
local color = Color3.new(result and 0 or 1, result and 1 or 0, 0)
local line = Instance.new("LineHandleAdornment")
line.CFrame = CFrame.new(pos, pos + dir)
line.Length = dir.Magnitude
line.Thickness = 3
line.Color3 = color
line.Adornee = workspace.Terrain
line.Parent = workspace.Terrain
task.delay(2, line.Destroy, line)
end
return result
end
function Util.RaycastSM64(pos: Vector3, dir: Vector3, rayParams: RaycastParams?, worldRoot: WorldRoot?): RaycastResult?
local result: RaycastResult? = Util.Raycast(pos * Util.Scale, dir * Util.Scale, rayParams, worldRoot)
if result then
-- Cast back to SM64 unit scale.
result = {
Normal = result.Normal,
Material = result.Material,
Instance = result.Instance,
Distance = result.Distance / Util.Scale,
Position = result.Position / Util.Scale,
} :: any
end
return result
end
function Util.FindFloor(pos: Vector3): (number, RaycastResult?)
local trunc = Vector3int16.new(pos.X, pos.Y, pos.Z)
local height = -11000
if math.abs(trunc.X) >= 0x2000 then
return height, nil
end
if math.abs(trunc.Z) >= 0x2000 then
return height, nil
end
local newPos = Vector3.new(trunc.X, trunc.Y, trunc.Z)
local result = Util.RaycastSM64(newPos + (Vector3.yAxis * 100), -Vector3.yAxis * 10000)
if result then
local height = Util.SignedShort(result.Position.Y)
result.Position = Vector3.new(pos.X, height, pos.Z)
return height, result
else
return height, nil
end
end
function Util.FindCeil(pos: Vector3, height: number?): (number, RaycastResult?)
local pos = Vector3.new(pos.X, (height or pos.Y) + 80, pos.Z)
local result = Util.RaycastSM64(pos, Vector3.yAxis * 10000)
if result then
return result.Position.Y, result
else
return 10000, nil
end
end
function Util.FindWallCollisions(pos: Vector3, offset: number, radius: number): (Vector3, RaycastResult?)
local origin = pos + Vector3.new(0, offset, 0)
local walls: { RaycastResult } = {}
local lastWall: RaycastResult?
local disp = Vector3.zero
for i, dir in CARDINAL do
local contact = Util.RaycastSM64(origin, dir * radius)
if contact then
local normal = contact.Normal
if math.abs(normal.Y) < 0.01 then
local surface = contact.Position
local offset = (surface - pos) * VECTOR3_XZ
local dist = offset.Magnitude
if dist < radius then
disp += (contact.Normal * VECTOR3_XZ) * (radius - dist)
lastWall = contact
end
end
end
end
return pos + disp, lastWall
end
function Util.SignedShort(x: number)
return -0x8000 + math.floor((x + 0x8000) % 0x10000)
end
function Util.SignedInt(x: number)
return -0x80000000 + math.floor(x + 0x80000000) % 0x100000000
end
function Util.ApproachFloat(current: number, target: number, inc: number, dec: number?): number
if dec == nil then
dec = inc
end
assert(dec)
if current < target then
current = math.min(target, current + inc)
else
current = math.max(target, current - dec)
end
return current
end
function Util.ApproachInt(current: number, target: number, inc: number, dec: number?): number
if dec == nil then
dec = inc
end
assert(dec)
if current < target then
current = Util.SignedInt(current + inc)
current = math.min(target, current)
else
current = Util.SignedInt(current - dec)
current = math.max(target, current)
end
return Util.SignedInt(current)
end
function Util.Sins(short: number): number
short = Util.SignedShort(short)
return math.sin(short * SHORT_TO_RAD)
end
function Util.Coss(short: number): number
short = Util.SignedShort(short)
return math.cos(short * SHORT_TO_RAD)
end
local function atan2_lookup(y: number, x: number)
return math.atan2(y, x) / SHORT_TO_RAD
end
function Util.Atan2s(y: number, x: number): number
local ret: number
if x >= 0 then
if y >= 0 then
if y >= x then
ret = atan2_lookup(x, y)
else
ret = 0x4000 - atan2_lookup(y, x)
end
else
y = -y
if y < x then
ret = 0x4000 + atan2_lookup(y, x)
else
ret = 0x8000 - atan2_lookup(x, y)
end
end
else
x = -x
if y < 0 then
y = -y
if y >= x then
ret = 0x8000 + atan2_lookup(x, y)
else
ret = 0xC000 - atan2_lookup(y, x)
end
else
if y < x then
ret = 0xC000 + atan2_lookup(y, x)
else
ret = -atan2_lookup(x, y)
end
end
end
return Util.SignedShort(ret)
end
return table.freeze(Util)

5
sm64/Util/init.meta.json Normal file
View file

@ -0,0 +1,5 @@
{
"attributes": {
"Debug": false
}
}

473
sm64/init.client.lua Normal file
View file

@ -0,0 +1,473 @@
--!strict
local Players = game:GetService("Players") :: Players
local RunService = game:GetService("RunService") :: RunService
local StarterGui = game:GetService("StarterGui") :: StarterGui
local TweenService = game:GetService("TweenService") :: TweenService
local UserInputService = game:GetService("UserInputService") :: UserInputService
local ReplicatedStorage = game:GetService("ReplicatedStorage") :: ReplicatedStorage
local ContextActionService = game:GetService("ContextActionService") :: ContextActionService
local Sounds = require(script.Sounds)
local Enums = require(script.Enums)
local Mario = require(script.Mario)
local Types = require(script.Types)
local Util = require(script.Util)
local Action = Enums.Action
local Buttons = Enums.Buttons
local InputFlags = Enums.InputFlags
local ParticleFlags = Enums.ParticleFlags
type InputType = Enum.UserInputType | Enum.KeyCode
type Controller = Types.Controller
type Mario = Mario.Class
local player: Player = assert(Players.LocalPlayer)
local STEP_RATE = 30
local PARTICLE_CLASSES = {
Fire = true,
Smoke = true,
Sparkles = true,
ParticleEmitter = true,
}
local FLIP = CFrame.Angles(0, math.pi, 0)
-------------------------------------------------------------------------------------------------------------------------------------------------
-- Input Driver
-------------------------------------------------------------------------------------------------------------------------------------------------
local MATH_TAU = math.pi * 2
local BUTTON_FEED: { Enum.UserInputState } = {}
local BUTTON_A = "BTN_" .. Buttons.A_BUTTON
local function toStrictNumber(str: string): number
local result = tonumber(str)
return assert(result, "Invalid number!")
end
local function processAction(id: string, state: Enum.UserInputState)
if id == "MarioDebug" then
if state == Enum.UserInputState.Begin then
local isDebug = not script.Util:GetAttribute("Debug")
local character = player.Character
local rootPart = if character then character.PrimaryPart else nil
if rootPart then
local action = rootPart:FindFirstChild("Action")
if action and action:IsA("BillboardGui") then
action.Enabled = isDebug
end
end
script.Util:SetAttribute("Debug", isDebug)
end
else
local button = toStrictNumber(id:sub(5))
BUTTON_FEED[button] = state
end
end
local function bindInput(button: number, label: string, ...: InputType)
local id = "BTN_" .. button
ContextActionService:BindAction(id, processAction, true, ...)
if UserInputService.TouchEnabled then
ContextActionService:SetTitle(id, label)
end
end
local function updateCollisions()
for i, player in Players:GetPlayers() do
assert(player:IsA("Player"))
local rootPart = if player.Character then player.Character.PrimaryPart else nil
if rootPart then
local parts = rootPart:GetConnectedParts(true)
for i, part in parts do
if part:IsA("BasePart") then
part.CanCollide = false
end
end
end
end
end
local function updateController(controller: Controller, humanoid: Humanoid)
local moveDir = humanoid.MoveDirection
local pos = Vector2.new(moveDir.X, -moveDir.Z)
local len = math.min(1, pos.Magnitude)
controller.StickMag = len * 64
controller.StickX = pos.X * 64
controller.StickY = pos.Y * 64
humanoid:ChangeState(Enum.HumanoidStateType.Physics)
controller.ButtonPressed:Clear()
if humanoid.Jump then
BUTTON_FEED[Buttons.A_BUTTON] = Enum.UserInputState.Begin
humanoid.Jump = false
elseif controller.ButtonDown:Has(Buttons.A_BUTTON) then
BUTTON_FEED[Buttons.A_BUTTON] = Enum.UserInputState.End
end
for button, state in pairs(BUTTON_FEED) do
if state == Enum.UserInputState.Begin then
controller.ButtonDown:Add(button)
controller.ButtonPressed:Add(button)
elseif state == Enum.UserInputState.End then
controller.ButtonDown:Remove(button)
end
end
table.clear(BUTTON_FEED)
end
ContextActionService:BindAction("MarioDebug", processAction, false, Enum.KeyCode.P)
bindInput(Buttons.B_BUTTON, "B", Enum.UserInputType.MouseButton1, Enum.KeyCode.ButtonX)
bindInput(Buttons.Z_TRIG, "Z", Enum.KeyCode.LeftShift, Enum.KeyCode.RightShift, Enum.KeyCode.ButtonL2)
-------------------------------------------------------------------------------------------------------------------------------------------------------------
-- Network Dispatch
-------------------------------------------------------------------------------------------------------------------------------------------------------------
local Commands = {}
local lazyNetwork = ReplicatedStorage:WaitForChild("LazyNetwork")
assert(lazyNetwork:IsA("RemoteEvent"), "bad lazyNetwork!")
function Commands.PlaySound(player: Player, name: string)
local sound: Sound? = Sounds[name]
local character = player.Character
local rootPart = if character then character.PrimaryPart else nil
if rootPart and sound then
local oldSound: Instance? = rootPart:FindFirstChild(name)
if oldSound and oldSound:IsA("Sound") and name:find("MARIO") then
oldSound.TimePosition = 0
else
local newSound: Sound = sound:Clone()
newSound.Parent = rootPart
newSound:Play()
newSound.Ended:Connect(function()
newSound:Destroy()
end)
end
end
end
function Commands.SetParticle(player: Player, name: string, set: boolean)
local character = player.Character
local rootPart = if character then character.PrimaryPart else nil
if rootPart then
local particles = rootPart:FindFirstChild("Particles")
local inst = if particles then particles:FindFirstChild(name) else nil
if inst and PARTICLE_CLASSES[inst.ClassName] then
local particle = inst :: ParticleEmitter
local emit = particle:GetAttribute("Emit")
if typeof(emit) == "number" then
particle:Emit(emit)
elseif set ~= nil then
particle.Enabled = set
end
end
end
end
function Commands.SetAngle(player: Player, angle: Vector3int16)
local character = player.Character
local waist = if character then character:FindFirstChild("Waist", true) else nil
if waist and waist:IsA("Motor6D") then
local props = { C1 = Util.ToRotation(-angle) + waist.C1.Position }
local tween = TweenService:Create(waist, TweenInfo.new(0.1), props)
tween:Play()
end
end
local function processCommand(player: Player, cmd: string, ...: any)
local command = Commands[cmd]
if command then
task.spawn(command, player, ...)
else
warn("Unknown Command:", cmd, ...)
end
end
local function networkDispatch(cmd: string, ...: any)
lazyNetwork:FireServer(cmd, ...)
processCommand(player, cmd, ...)
end
local function onNetworkReceive(target: Player, cmd: string, ...: any)
if target ~= player then
processCommand(target, cmd, ...)
end
end
lazyNetwork.OnClientEvent:Connect(onNetworkReceive)
-------------------------------------------------------------------------------------------------------------------------------------------------------------
-- Mario Driver
-------------------------------------------------------------------------------------------------------------------------------------------------------------
local lastUpdate = os.clock()
local lastAngle: Vector3int16?
local mario: Mario = Mario.new()
local controller = mario.Controller
local enumMap = {}
local goalCF: CFrame
local activeTrack: AnimationTrack?
local peakSpeed = 0
local reset = Instance.new("BindableEvent")
reset.Archivable = false
reset.Parent = script
reset.Name = "Reset"
while not player.Character do
player.CharacterAdded:Wait()
end
local character = assert(player.Character)
local pivot = character:GetPivot().Position
mario.Position = Util.ToSM64(pivot)
local function onReset()
local roblox = Vector3.yAxis * 100
local sm64 = Util.ToSM64(roblox)
local char = player.Character
if char then
local reset = char:FindFirstChild("Reset")
local cf = CFrame.new(roblox)
if reset and reset:IsA("RemoteEvent") then
reset:FireServer()
end
char:PivotTo(cf)
end
mario.SlideVelX = 0
mario.SlideVelZ = 0
mario.ForwardVel = 0
mario.IntendedYaw = 0
mario.Position = sm64
mario.Velocity = Vector3.zero
mario.FaceAngle = Vector3int16.new()
mario:SetAction(Action.SPAWN_SPIN_AIRBORNE)
end
local function update()
local character = player.Character
if not character then
return
end
local now = os.clock()
local gfxRot = CFrame.identity
local humanoid = if character then character:FindFirstChildOfClass("Humanoid") else nil
local simSpeed = tonumber(script:GetAttribute("TimeScale") or nil) or 1
local frames = math.floor((now - lastUpdate) * (STEP_RATE * simSpeed))
if frames > 0 and humanoid then
lastUpdate = now
updateCollisions()
for i = 1, math.min(4, frames) do
updateController(mario.Controller, humanoid)
mario:ExecuteAction()
end
local pos = Util.ToRoblox(mario.Position)
local rot = Util.ToRotation(mario.FaceAngle)
gfxRot = Util.ToRotation(mario.GfxAngle)
goalCF = CFrame.new(pos) * FLIP * gfxRot
end
local interp = math.min(1, simSpeed / 2)
if character and goalCF then
local cf = character:GetPivot()
local rootPart = character.PrimaryPart
local animator = character:FindFirstChildWhichIsA("Animator", true)
if animator and (mario.AnimDirty or mario.AnimReset) and mario.AnimFrame >= 0 then
local anim = mario.AnimCurrent
local animSpeed = 0.1 / simSpeed
if activeTrack and (activeTrack.Animation ~= anim or mario.AnimReset) then
activeTrack:Stop(animSpeed)
activeTrack = nil
end
if not activeTrack and anim then
local track = animator:LoadAnimation(anim)
track:Play(animSpeed, 1, 0)
activeTrack = track
end
if activeTrack then
local speed = mario.AnimAccel / 0x10000
if speed > 0 then
activeTrack:AdjustSpeed(speed * simSpeed)
else
activeTrack:AdjustSpeed(simSpeed)
end
end
mario.AnimDirty = false
mario.AnimReset = false
end
if activeTrack and mario.AnimSetFrame > -1 then
activeTrack.TimePosition = mario.AnimSetFrame / STEP_RATE
mario.AnimSetFrame = -1
end
if rootPart then
local action = rootPart:FindFirstChild("Action")
local particles = rootPart:FindFirstChild("Particles")
local alignPos = rootPart:FindFirstChildOfClass("AlignPosition")
local alignCF = rootPart:FindFirstChildOfClass("AlignOrientation")
local throw = mario.ThrowMatrix
if throw then
local pos = Util.ToRoblox(throw.Position)
goalCF = throw.Rotation * FLIP + pos
end
if alignCF then
cf = cf:Lerp(goalCF, interp)
alignCF.CFrame = cf.Rotation
end
local debugLabel = if action then action:FindFirstChildOfClass("TextLabel") else nil
if debugLabel then
local actionId = mario.Action()
local anim = if activeTrack then activeTrack.Animation else nil
local animName = if anim then anim.Name else nil
local debugText = "Action: "
.. Enums.GetName(Action, actionId)
.. "\n"
.. "Animation: "
.. tostring(animName)
.. "\n"
.. "ForwardVel: "
.. string.format("%.2f", mario.ForwardVel)
debugLabel.Text = debugText
end
if alignPos then
alignPos.Position = cf.Position
end
local bodyState = mario.BodyState
local action = mario.Action()
if action ~= Action.BUTT_SLIDE and action ~= Action.WALKING then
bodyState.TorsoAngle *= 0
end
local ang = bodyState.TorsoAngle
if ang ~= lastAngle then
networkDispatch("SetAngle", ang)
lastAngle = ang
end
if particles then
for name, flag in pairs(ParticleFlags) do
local inst = particles:FindFirstChild(name)
if inst and PARTICLE_CLASSES[inst.ClassName] then
local name = inst.Name
local particle = inst :: ParticleEmitter
local emit = particle:GetAttribute("Emit")
local hasFlag = mario.ParticleFlags:Has(flag)
if emit then
if hasFlag then
networkDispatch("SetParticle", name)
end
elseif particle.Enabled ~= hasFlag then
networkDispatch("SetParticle", name, hasFlag)
end
end
end
end
for name: string, sound: Sound in pairs(Sounds) do
local looped = false
if sound:IsA("Sound") then
if sound.TimeLength == 0 then
continue
end
looped = sound.Looped
end
if sound:GetAttribute("Play") then
networkDispatch("PlaySound", sound.Name)
if not looped then
sound:SetAttribute("Play", false)
end
elseif looped then
sound:Stop()
end
end
character:PivotTo(cf)
end
end
end
reset.Event:Connect(onReset)
RunService.Heartbeat:Connect(update)
while task.wait(1) do
local success = pcall(function()
return StarterGui:SetCore("ResetButtonCallback", reset)
end)
if success then
break
end
end
-------------------------------------------------------------------------------------------------------------------------------------------------------------

View file

@ -0,0 +1,33 @@
local AvatarImportService = game:GetService("AvatarImportService")
local resume = Instance.new("BindableEvent")
for i, anim in pairs(game.ReplicatedFirst.SM64.Assets.Animations:GetChildren()) do
local path = "C:/Users/clone/Desktop/MarioAnims/" .. anim.Name .. ".fbx"
print("Importing", anim)
task.defer(function()
local success, err = pcall(function()
AvatarImportService:ImportFBXAnimationFromFilePathUserMayChooseModel(path, workspace.Mario, function()
local bin = game.ServerStorage.AnimSaves
local old = bin:FindFirstChild(anim.Name)
if old then
old:Destroy()
end
local kfs = AvatarImportService:ImportLoadedFBXAnimation(false)
kfs.Name = anim.Name
kfs.Parent = bin
resume:Fire()
end)
end)
if not success then
warn("ERROR IMPORTING", anim, err)
resume:Fire()
end
end)
resume.Event:Wait()
end

View file

@ -0,0 +1,175 @@
--!strict
local ServerStorage = game:GetService("ServerStorage")
local StarterCharacter = workspace.StarterCharacter
local MarioAnim = workspace.MarioAnim
local MarioBase = workspace.MarioBase
local Player = workspace.Player
local HIERARCHY: { [string]: { [string]: string }? } = {
HumanoidRootPart = { LowerTorso = "Root" },
LowerTorso = {
UpperTorso = "Waist",
LeftUpperLeg = "LeftHip",
RightUpperLeg = "RightHip",
},
UpperTorso = {
Head = "Neck",
LeftUpperArm = "LeftShoulder",
RightUpperArm = "RightShoulder",
},
LeftUpperArm = { LeftLowerArm = "LeftElbow" },
LeftLowerArm = { LeftHand = "LeftWrist" },
RightUpperArm = { RightLowerArm = "RightElbow" },
RightLowerArm = { RightHand = "RightWrist" },
LeftUpperLeg = { LeftLowerLeg = "LeftKnee" },
LeftLowerLeg = { LeftFoot = "LeftAnkle" },
RightUpperLeg = { RightLowerLeg = "RightKnee" },
RightLowerLeg = { RightFoot = "RightAnkle" },
}
local BASE_KEYFRAME = ServerStorage.BASE_KEYFRAME
local statusHint = Instance.new("Hint")
local statusText = "%s [%d/%d]"
statusHint.Parent = workspace
statusHint.Name = "Status"
local function updateAnim()
StarterCharacter.Humanoid.Animator:StepAnimations(0)
Player.Humanoid.Animator:StepAnimations(0)
task.wait()
end
local function clearAnims()
for i, desc: Instance in pairs(workspace:GetDescendants()) do
if desc:IsA("Bone") then
desc.Transform = CFrame.identity
elseif desc:IsA("Motor6D") then
desc.Transform = CFrame.identity
elseif desc:IsA("Animator") then
task.defer(desc.StepAnimations, desc, 0)
end
end
task.wait()
end
local function applyMotors(at: Instance)
local name0 = if at:IsA("Keyframe") then "HumanoidRootPart" else at.Name
local part0 = StarterCharacter:FindFirstChild(name0)
local data = HIERARCHY[name0]
if data and part0 and part0:IsA("BasePart") then
for name1, motorName in data do
local part1 = StarterCharacter:FindFirstChild(name1)
if part1 and part1:IsA("BasePart") then
local att: Attachment = part1:FindFirstChild(motorName .. "RigAttachment")
local bone: Bone = MarioBase:FindFirstChild(motorName, true)
local motor: Motor6D = part1:FindFirstChild(motorName)
motor.Transform = att.WorldCFrame:ToObjectSpace(bone.TransformedWorldCFrame)
local playerMotor = workspace.Player:FindFirstChild(motorName, true)
local pose = at:FindFirstChild(name1)
if playerMotor and playerMotor:IsA("Motor6D") then
if motorName:find("Left") or motorName:find("Right") then
playerMotor.Transform = motor.Transform.Rotation
else
playerMotor.Transform = motor.Transform
end
end
updateAnim()
if pose and pose:IsA("Pose") then
if motorName:find("Left") or motorName:find("Right") then
pose.CFrame = motor.Transform.Rotation
else
pose.CFrame = motor.Transform
end
applyMotors(pose)
end
end
end
end
end
local function remapKeyframe(keyframe: Keyframe): Keyframe
clearAnims()
for i, desc: Instance in pairs(keyframe:GetDescendants()) do
if desc:IsA("Pose") then
local bone: Instance? = MarioAnim:FindFirstChild(desc.Name, true)
if bone and bone:IsA("Bone") then
bone.Transform = desc.CFrame
end
end
end
for i, desc in MarioBase:GetDescendants() do
if desc:IsA("Bone") then
local anim = MarioAnim:FindFirstChild(desc.Name, true)
if anim then
local offset = desc.TransformedWorldCFrame:ToObjectSpace(anim.TransformedWorldCFrame)
desc.Transform = offset
end
end
end
local newKeyframe = BASE_KEYFRAME:Clone()
newKeyframe.Name = keyframe.Name
newKeyframe.Time = keyframe.Time
applyMotors(newKeyframe)
return newKeyframe
end
local function remapKeyframeSequence(kfs: KeyframeSequence): KeyframeSequence
local keyframes = kfs:GetKeyframes()
clearAnims()
local newKfs = kfs:Clone()
newKfs:ClearAllChildren()
for i, keyframe in keyframes do
if keyframe:IsA("Keyframe") then
local text = statusText:format(kfs.Name, i, #keyframes)
statusHint.Text = text
local newKeyframe = remapKeyframe(keyframe)
newKeyframe.Parent = newKfs
end
end
return newKfs
end
local animSaves = ServerStorage.AnimSaves:GetChildren()
local animSavesR15 = ServerStorage.AnimSaves_R15
table.sort(animSaves, function(a, b)
return a.Name < b.Name
end)
for i, animSave in animSaves do
if animSave:IsA("KeyframeSequence") then
local kfs = remapKeyframeSequence(animSave)
kfs.Parent = animSavesR15
end
end
clearAnims()
statusHint:Destroy()

316
tools/UploadAnimations.lua Normal file
View file

@ -0,0 +1,316 @@
------------------------------------------------------------------------------------------------------------------------------------------------------------------------
-- SHA256
------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--!strict
local band = bit32.band
local bnot = bit32.bnot
local bxor = bit32.bxor
local rrotate = bit32.rrotate
local rshift = bit32.rshift
local primes = {
0x428a2f98,
0x71374491,
0xb5c0fbcf,
0xe9b5dba5,
0x3956c25b,
0x59f111f1,
0x923f82a4,
0xab1c5ed5,
0xd807aa98,
0x12835b01,
0x243185be,
0x550c7dc3,
0x72be5d74,
0x80deb1fe,
0x9bdc06a7,
0xc19bf174,
0xe49b69c1,
0xefbe4786,
0x0fc19dc6,
0x240ca1cc,
0x2de92c6f,
0x4a7484aa,
0x5cb0a9dc,
0x76f988da,
0x983e5152,
0xa831c66d,
0xb00327c8,
0xbf597fc7,
0xc6e00bf3,
0xd5a79147,
0x06ca6351,
0x14292967,
0x27b70a85,
0x2e1b2138,
0x4d2c6dfc,
0x53380d13,
0x650a7354,
0x766a0abb,
0x81c2c92e,
0x92722c85,
0xa2bfe8a1,
0xa81a664b,
0xc24b8b70,
0xc76c51a3,
0xd192e819,
0xd6990624,
0xf40e3585,
0x106aa070,
0x19a4c116,
0x1e376c08,
0x2748774c,
0x34b0bcb5,
0x391c0cb3,
0x4ed8aa4a,
0x5b9cca4f,
0x682e6ff3,
0x748f82ee,
0x78a5636f,
0x84c87814,
0x8cc70208,
0x90befffa,
0xa4506ceb,
0xbef9a3f7,
0xc67178f2,
}
local function toHex(str: string): string
local result = str:gsub(".", function(char)
return string.format("%02x", char:byte())
end)
return result
end
local function toBytes(value: number, length: number)
local str = ""
for i = 1, length do
local rem = value % 256
str = string.char(rem) .. str
value = (value - rem) / 256
end
return str
end
local function digestBlock(msg: string, i: number, hash: { number }, digest: { number })
for j = 1, 16 do
local offset = i + (j - 1) * 4
local a, b, c, d = string.byte(msg, offset, offset + 3)
digest[j] = ((a * 256 + b) * 256 + c) * 256 + d
end
for j = 17, 64 do
local v = digest[j - 15]
local s0 = bxor(rrotate(v, 7), rrotate(v, 18), rshift(v, 3))
v = digest[j - 2]
digest[j] = digest[j - 16] + s0 + digest[j - 7] + bxor(rrotate(v, 17), rrotate(v, 19), rshift(v, 10))
end
local a, b, c, d, e, f, g, h = table.unpack(hash)
for i = 1, 64 do
local s0 = bxor(rrotate(a, 2), rrotate(a, 13), rrotate(a, 22))
local maj = bxor(band(a, b), band(a, c), band(b, c))
local t2 = s0 + maj
local s1 = bxor(rrotate(e, 6), rrotate(e, 11), rrotate(e, 25))
local ch = bxor(band(e, f), band(bnot(e), g))
local t1 = h + s1 + ch + primes[i] + digest[i]
h, g, f, e, d, c, b, a = g, f, e, d + t1, c, b, a, t1 + t2
end
hash[1] = band(hash[1] + a)
hash[2] = band(hash[2] + b)
hash[3] = band(hash[3] + c)
hash[4] = band(hash[4] + d)
hash[5] = band(hash[5] + e)
hash[6] = band(hash[6] + f)
hash[7] = band(hash[7] + g)
hash[8] = band(hash[8] + h)
end
local function sha256(msg: string): string
local extra = 64 - ((#msg + 9) % 64)
local len = toBytes(8 * #msg, 8)
msg ..= "\128" .. string.rep("\0", extra) .. len
assert(#msg % 64 == 0)
local hash = {
0x6a09e667,
0xbb67ae85,
0x3c6ef372,
0xa54ff53a,
0x510e527f,
0x9b05688c,
0x1f83d9ab,
0x5be0cd19,
}
local digest = {}
for i = 1, #msg, 64 do
digestBlock(msg, i, hash, digest)
end
local result = ""
for i = 1, 8 do
local value = hash[i]
result = result .. toBytes(value, 4)
end
return toHex(result)
end
------------------------------------------------------------------------------------------------------------------------------------------------------------------------
-- Upload Animations
------------------------------------------------------------------------------------------------------------------------------------------------------------------------
local StudioAssetService = game:GetService("StudioAssetService")
local ContentProvider = game:GetService("ContentProvider")
local HttpService = game:GetService("HttpService")
local FLIP = CFrame.Angles(0, math.pi, 0)
type Params = { [string]: any }
local function makeQueryString(data: Params)
-- NOTE - This function can be used to create a query string of parameters
-- at the end of url query, or create a application/form-url-encoded post body string
local params = {}
-- NOTE - Arrays are handled, but generally data is expected to be flat.
for key, value in data do
if value ~= nil then -- for optional params
if type(value) == "table" then
for i = 1, #value do
local str = HttpService:UrlEncode(value[i])
table.insert(params, key .. "=" .. str)
end
else
local str = HttpService:UrlEncode(value)
table.insert(params, key .. "=" .. str)
end
end
end
return table.concat(params, "&")
end
local function uploadAnimation(anim: Animation)
local loop: boolean = not not (anim:GetAttribute("Loop"))
local flip: boolean = not not (anim:GetAttribute("Flip"))
local kfs: KeyframeSequence = game.ServerStorage.AnimSaves:FindFirstChild(anim.Name)
local startFrame: number = tonumber(anim:GetAttribute("StartFrame") or nil) or -1
if kfs and kfs:IsA("KeyframeSequence") then
kfs = kfs:Clone()
else
return
end
local id = tonumber(anim.AnimationId:match("%d+$"))
local params: Params = {}
local uploadUrl: string
if id then
uploadUrl = "ide/publish/uploadexistinganimation?"
params.assetID = id
else
uploadUrl = "ide/publish/uploadnewanimation?"
params.allowComments = "True"
params.assetTypeName = "Animation"
params.ispublic = "False"
params.isGamesAsset = "False"
params.description = ""
params.name = anim.Name
params.groupId = ""
params.AllID = 1
end
local baseUrl = ContentProvider.BaseUrl
uploadUrl = baseUrl .. uploadUrl .. makeQueryString(params)
if not loop then
local endAt = kfs:FindFirstChild("End")
if endAt and endAt:IsA("Keyframe") then
local stall = endAt:Clone()
stall.Name = "Freeze"
stall.Parent = kfs
stall.Time = 9999
end
end
if startFrame then
local timeDiff = startFrame / 30
for i, kf in kfs:GetChildren() do
if kf:IsA("Keyframe") then
kf.Time -= timeDiff
if kf.Time < 0 then
kf:Destroy()
end
end
end
end
if flip then
for i, kf in kfs:GetChildren() do
if kf:IsA("Keyframe") then
local lowerTorso = kf:FindFirstChild("LowerTorso", true)
if lowerTorso and lowerTorso:IsA("Pose") then
local cf = lowerTorso.CFrame
lowerTorso.CFrame = FLIP * cf
end
end
end
end
local tmp = Instance.new("Folder")
tmp.Parent = workspace
tmp.Name = "Upload"
kfs.Parent = tmp
local body = StudioAssetService:SerializeInstances(tmp:GetChildren())
local newHash = sha256(body)
tmp:Destroy()
if anim:GetAttribute("UploadHash") ~= newHash then
warn("Uploading Animation", anim.Name .. "...")
local success, response = pcall(function()
print("POST", uploadUrl)
return game:HttpPostAsync(uploadUrl, body, "application/octet-stream")
end)
if success then
anim.AnimationId = "rbxassetid://" .. response
anim:SetAttribute("UploadHash", newHash)
print("\tSuccess!")
else
print("\tError uploading", anim.Name .. ": ", response)
end
else
warn(anim.Name, "is up to date!")
end
end
for i, anim in game.ReplicatedFirst.SM64.Assets.Animations:GetChildren() do
if anim:IsA("Animation") then
uploadAnimation(anim)
end
end

225
tools/extract_anims.py Normal file
View file

@ -0,0 +1,225 @@
import subprocess
anim_dict = {
"4EC690": "SLOW_LEDGE_GRAB",
"4ED1D0": "FALL_OVER_BACKWARDS",
"4ED1E8": "BACKWARD_AIR_KB",
"4EECAC": "DYING_ON_BACK",
"4EFED4": "BACKFLIP",
"4F08C0": "CLIMB_UP_POLE",
"4F2078": "GRAB_POLE_SHORT",
"4F2508": "GRAB_POLE_SWING_PART1",
"4F2520": "GRAB_POLE_SWING_PART2",
"4F38F0": "HANDSTAND_IDLE",
"4F43F4": "HANDSTAND_JUMP",
"4F440C": "START_HANDSTAND",
"4F2BF0": "RETURN_FROM_HANDSTAND",
"4F4A64": "IDLE_ON_POLE",
"4F4E7C": "A_POSE",
"4F4FE0": "SKID_ON_GROUND",
"4F4FF8": "STOP_SKID",
"4F56EC": "CROUCH_FROM_FAST_LONGJUMP",
"4F5C98": "CROUCH_FROM_SLOW_LONGJUMP",
"4F62D4": "FAST_LONGJUMP",
"4F6A78": "SLOW_LONGJUMP",
"4F6FDC": "AIRBORNE_ON_STOMACH",
"4F7494": "WALK_WITH_LIGHT_OBJ",
"4F870C": "RUN_WITH_LIGHT_OBJ",
"4F93A0": "SLOW_WALK_WITH_LIGHT_OBJ",
"4FA618": "SHIVERING_WARMING_HAND",
"4FBC18": "SHIVERING_RETURN_TO_IDLE",
"4FC1A8": "SHIVERING",
"4FCDE8": "CLIMB_DOWN_LEDGE",
"4FD208": "CREDITS_WAVING",
"4FD880": "CREDITS_LOOK_UP",
"4FDF90": "CREDITS_RETURN_FROM_LOOK_UP",
"4FE3F4": "CREDITS_RAISE_HAND",
"5000DC": "CREDITS_LOWER_HAND",
"500C24": "CREDITS_TAKE_OFF_CAP",
"501410": "CREDITS_START_WALK_LOOK_UP",
"50353C": "CREDITS_LOOK_BACK_THEN_RUN",
"505AF0": "FINAL_BOWSER_RAISE_HAND_SPIN",
"507B58": "FINAL_BOWSER_WING_CAP_TAKE_OFF",
"509924": "CREDITS_PEACE_SIGN",
"50BD4C": "STAND_UP_FROM_LAVA_BOOST",
"50C254": "FIRE_LAVA_BURN",
"50C5B0": "WING_CAP_FLY",
"50CBA8": "HANG_ON_OWL",
"50D2EC": "LAND_ON_STOMACH",
"50D304": "FORWARD_AIR_KB",
"50EA0C": "DYING_ON_STOMACH",
"50F6F4": "SUFFOCATING",
"511504": "COUGHING",
"512B4C": "THROW_CATCH_KEY",
"515604": "DYING_FALL_OVER",
"5175EC": "IDLE_ON_LEDGE",
"518218": "FAST_LEDGE_GRAB",
"518840": "HANG_ON_CEILING",
"5197CC": "PUT_CAP_ON",
"51A754": "TAKE_CAP_OFF_THEN_ON",
"51C314": "QUICKLY_PUT_CAP_ON",
"51C774": "HEAD_STUCK_IN_GROUND",
"51F90C": "GROUND_POUND_LANDING",
"51FB98": "TRIPLE_JUMP_GROUND_POUND",
"520160": "START_GROUND_POUND",
"520178": "GROUND_POUND",
"520594": "BOTTOM_STUCK_IN_GROUND",
"52338C": "IDLE_WITH_LIGHT_OBJ",
"5240B8": "JUMP_LAND_WITH_LIGHT_OBJ",
"524614": "JUMP_WITH_LIGHT_OBJ",
"524940": "FALL_LAND_WITH_LIGHT_OBJ",
"524E10": "FALL_WITH_LIGHT_OBJ",
"524F78": "FALL_FROM_SLIDING_WITH_LIGHT_OBJ",
"525318": "SLIDING_ON_BOTTOM_WITH_LIGHT_OBJ",
"525330": "STAND_UP_FROM_SLIDING_WITH_LIGHT_OBJ",
"5258EC": "RIDING_SHELL",
"525D48": "WALKING",
"527248": "FORWARD_FLIP",
"527870": "JUMP_RIDING_SHELL",
"527BEC": "LAND_FROM_DOUBLE_JUMP",
"52826C": "DOUBLE_JUMP_FALL",
"528620": "SINGLE_JUMP",
"528638": "LAND_FROM_SINGLE_JUMP",
"5290E4": "AIR_KICK",
"529824": "DOUBLE_JUMP_RISE",
"529ADC": "START_FORWARD_SPINNING",
"529FDC": "THROW_LIGHT_OBJECT",
"52A460": "FALL_FROM_SLIDE_KICK",
"52AD28": "BEND_KNESS_RIDING_SHELL",
"52B360": "LEGS_STUCK_IN_GROUND",
"52E078": "GENERAL_FALL",
"52E090": "GENERAL_LAND",
"52E7BC": "BEING_GRABBED",
"52ED0C": "GRAB_HEAVY_OBJECT",
"52FA0C": "SLOW_LAND_FROM_DIVE",
"5307F0": "FLY_FROM_CANNON",
"530BD4": "MOVE_ON_WIRE_NET_RIGHT",
"5311D4": "MOVE_ON_WIRE_NET_LEFT",
"531760": "MISSING_CAP",
"5347C4": "PULL_DOOR_WALK_IN",
"535C9C": "PUSH_DOOR_WALK_IN",
"536D64": "UNLOCK_DOOR",
"539FEC": "START_REACH_POCKET",
"53A3E8": "REACH_POCKET",
"53AB58": "STOP_REACH_POCKET",
"53B14C": "GROUND_THROW",
"53B904": "GROUND_KICK",
"53C1B4": "FIRST_PUNCH",
"53C44C": "SECOND_PUNCH",
"53C6B4": "FIRST_PUNCH_FAST",
"53CAC4": "SECOND_PUNCH_FAST",
"53CFFC": "PICK_UP_LIGHT_OBJ",
"53D4BC": "PUSHING",
"53DAD4": "START_RIDING_SHELL",
"53E0F0": "PLACE_LIGHT_OBJ",
"53E674": "FORWARD_SPINNING",
"53E68C": "BACKWARD_SPINNING",
"53E804": "BREAKDANCE",
"53F138": "RUNNING",
"53F150": "RUNNING_UNUSED",
"54035C": "SOFT_BACK_KB",
"540BA4": "SOFT_FRONT_KB",
"54141C": "DYING_IN_QUICKSAND",
"542758": "IDLE_IN_QUICKSAND",
"54320C": "MOVE_IN_QUICKSAND",
"545BF8": "ELECTROCUTION",
"546B40": "SHOCKED",
"546DE8": "BACKWARD_KB",
"547834": "FORWARD_KB",
"548244": "IDLE_HEAVY_OBJ",
"543B40": "STAND_AGAINST_WALL",
"549A84": "SIDESTEP_LEFT",
"54A9C0": "SIDESTEP_RIGHT",
"54BB6C": "START_SLEEP_IDLE",
"54CD54": "START_SLEEP_SCRATCH",
"54E4F4": "START_SLEEP_YAWN",
"54F888": "START_SLEEP_SITTING",
"550C30": "SLEEP_IDLE",
"550E88": "SLEEP_START_LYING",
"551AF4": "SLEEP_LYING",
"552224": "DIVE",
"55223C": "SLIDE_DIVE",
"55283C": "GROUND_BONK",
"5534F4": "STOP_SLIDE_LIGHT_OBJ",
"5541A4": "SLIDE_KICK",
"554540": "CROUCH_FROM_SLIDE_KICK",
"554A94": "SLIDE_MOTIONLESS",
"554AAC": "STOP_SLIDE",
"555214": "FALL_FROM_SLIDE",
"55571C": "SLIDE",
"55593C": "TIPTOE",
"557030": "TWIRL_LAND",
"5573A0": "TWIRL",
"557504": "START_TWIRL",
"557730": "STOP_CROUCHING",
"557AEC": "START_CROUCHING",
"557DA0": "CROUCHING",
"55897C": "CRAWLING",
"55A5F8": "STOP_CRAWLING",
"55A990": "START_CRAWLING",
"55AD1C": "SUMMON_STAR",
"55C144": "RETURN_STAR_APPROACH_DOOR",
"55C9F0": "BACKWARDS_WATER_KB",
"55DAAC": "SWIM_WITH_OBJ_PART1",
"55DEC8": "SWIM_WITH_OBJ_PART2",
"55E164": "FLUTTERKICK_WITH_OBJ",
"55E610": "WATER_ACTION_END_WITH_OBJ",
"55ECCC": "STOP_GRAB_OBJ_WATER",
"55F800": "WATER_IDLE_WITH_OBJ",
"55FF88": "DROWNING_PART1",
"5614B8": "DROWNING_PART2",
"5627F4": "WATER_DYING",
"5634FC": "WATER_FORWARD_KB",
"564558": "FALL_FROM_WATER",
"564D2C": "SWIM_PART1",
"56520C": "SWIM_PART2",
"565610": "FLUTTERKICK",
"565DD0": "WATER_ACTION_END",
"566628": "WATER_PICK_UP_OBJ",
"566AF8": "WATER_GRAB_OBJ_PART2",
"56747C": "WATER_GRAB_OBJ_PART1",
"567748": "WATER_THROW_OBJ",
"5681D0": "WATER_IDLE",
"568A04": "WATER_STAR_DANCE",
"56A478": "RETURN_FROM_WATER_STAR_DANCE",
"56ACC4": "GRAB_BOWSER",
"56ACDC": "SWINGING_BOWSER",
"56B358": "RELEASE_BOWSER",
"56C010": "HOLDING_BOWSER",
"56C42C": "HEAVY_THROW",
"56CD54": "WALK_PANTING",
"56D244": "WALK_WITH_HEAVY_OBJ",
"56E37C": "TURNING_PART1",
"56E394": "TURNING_PART2",
"56EAA0": "SLIDEFLIP_LAND",
"56EEAC": "SLIDEFLIP",
"56F750": "TRIPLE_JUMP_LAND",
"5701F8": "TRIPLE_JUMP",
"570CB0": "FIRST_PERSON",
"5722F4": "IDLE_HEAD_LEFT",
"572BA0": "IDLE_HEAD_RIGHT",
"57344C": "IDLE_HEAD_CENTER",
"573CF8": "HANDSTAND_LEFT",
"574490": "HANDSTAND_RIGHT",
"5750C0": "WAKE_FROM_SLEEP",
"575844": "WAKE_FROM_LYING",
"5760EC": "START_TIPTOE",
"5769D0": "SLIDEJUMP",
"5769E8": "START_WALLKICK",
"577064": "STAR_DANCE",
"5785B8": "RETURN_FROM_STAR_DANCE",
"578C80": "FORWARD_SPINNING_FLIP",
"579828": "TRIPLE_JUMP_FLY",
}
for offset, name in anim_dict.items():
print("WRITING ANIMATION: " + name + " FROM OFFSET: " + offset)
subprocess.run([
"C:/Program Files/Blender Foundation/Blender 2.91/blender.exe",
"C:/Users/clone/Desktop/mario_skel.blend", "-b",
"-P", "C:/Users/clone/Desktop/mass_export.py",
"--", offset, name
])
print("DONE!")

33
tools/mass_export.py Normal file
View file

@ -0,0 +1,33 @@
import bpy
import sys
import time
from fast64.fast64_internal.sm64 import *
argv = sys.argv
try:
index = argv.index("--") + 1
except ValueError:
index = len(argv)
argv = argv[index:]
offset = argv[0]
name = argv[1]
romfileSrc = open("C:/Users/clone/Downloads/Super Mario 64 (USA)/sm64.z64", 'rb')
mario_geo = bpy.data.objects['mario_geo']
levelParsed = sm64_level_parser.parseLevelAtPointer(romfileSrc, sm64_level_parser.level_pointers[bpy.context.scene.levelAnimImport])
segmentData = levelParsed.segmentData
animStart = int(offset, 16)
sm64_anim.importAnimationToBlender(romfileSrc, animStart, mario_geo, segmentData, True)
bpy.ops.export_scene.fbx(filepath="C:/Users/clone/Desktop/MarioAnims/" + name + ".fbx", add_leaf_bones=False, global_scale=3)
mario_geo.animation_data_clear()
print("Exported: " + name)
romfileSrc.close()
bpy.ops.wm.quit_blender()