User Tools

Site Tools


super_mario_64:custom_action

Custom action (decomp)

This page describes how to add a custom action for Mario. This tutorial was originally shared by “JoshDuMan” in the N64 Decompilation discord.

To add a movement function, define the action as “ACT_INSERTNAMEHERE” in /include/sm64.h. You'll want to find a vacant action slot (they are ordered sequentially) in the action group of your choice and any flags you want, add them together to get the number and define it there.

Next, go to the file for the action group (mario_actions_GROUP.c) and declare the action as “s32 act_insertnamehere(struct MarioState *m)”. You can add the code for this function here, defining the stuff it should do every frame. This will need to include any transitions/exits to other actions you might need here so you can leave the action, an action “step” to give movement (look at the “step” similar actions in the file use), and most importantly, a “return FALSE” at the end.

Next, go to the “mario_execute_GROUP_action” at the end of the file, and insert the function into that group's switch. This is what will give Mario his action info every frame.

Now navigate to “mario.c”. If you want to give the action initial behavior, go to the “set_mario_action_GROUP” function and add the initial behavior that will only happen when transitioning into the action.

Lastly, you'll need to define transitions from other actions or functions into your action. You can do this with “set_mario_action(ACT_INSERTNAMEHERE, 0)”. You may need to declare it in your group's header file (mario_actions_GROUP.h) if it's used in other files or earlier in that specific file.

super_mario_64/custom_action.txt · Last modified: 2020/11/04 20:57 by Tenry