Added allocate_mario_action()
This commit is contained in:
parent
9c502da395
commit
0cd2a91e9c
|
@ -4385,6 +4385,9 @@ ACT_FLAG_BUTT_OR_STOMACH_SLIDE = (1 << 18)
|
|||
--- @type integer
|
||||
ACT_FLAG_CONTROL_JUMP_HEIGHT = (1 << 25)
|
||||
|
||||
--- @type integer
|
||||
ACT_FLAG_CUSTOM_ACTION = (1 << 30)
|
||||
|
||||
--- @type integer
|
||||
ACT_FLAG_DIVING = (1 << 19)
|
||||
|
||||
|
|
|
@ -3476,6 +3476,12 @@ function collision_find_surface_on_ray(startX, startY, startZ, endX, endY, endZ)
|
|||
-- ...
|
||||
end
|
||||
|
||||
--- @param actFlags integer
|
||||
--- @return integer
|
||||
function allocate_mario_action(actFlags)
|
||||
-- ...
|
||||
end
|
||||
|
||||
--- @return integer
|
||||
function get_network_area_timer()
|
||||
-- ...
|
||||
|
|
|
@ -1550,6 +1550,7 @@
|
|||
- ACT_FLAG_ATTACKING
|
||||
- ACT_FLAG_BUTT_OR_STOMACH_SLIDE
|
||||
- ACT_FLAG_CONTROL_JUMP_HEIGHT
|
||||
- ACT_FLAG_CUSTOM_ACTION
|
||||
- ACT_FLAG_DIVING
|
||||
- ACT_FLAG_HANGING
|
||||
- ACT_FLAG_IDLE
|
||||
|
|
|
@ -634,6 +634,7 @@
|
|||
<br />
|
||||
|
||||
- smlua_misc_utils.h
|
||||
- [allocate_mario_action](#allocate_mario_action)
|
||||
- [get_network_area_timer](#get_network_area_timer)
|
||||
- [hud_hide](#hud_hide)
|
||||
- [hud_show](#hud_show)
|
||||
|
@ -11614,6 +11615,26 @@ The `reliable` field will ensure that the packet arrives, but should be used spa
|
|||
<br />
|
||||
|
||||
|
||||
## [allocate_mario_action](#allocate_mario_action)
|
||||
|
||||
### Lua Example
|
||||
`local integerValue = allocate_mario_action(actFlags)`
|
||||
|
||||
### Parameters
|
||||
| Field | Type |
|
||||
| ----- | ---- |
|
||||
| actFlags | `integer` |
|
||||
|
||||
### Returns
|
||||
- `integer`
|
||||
|
||||
### C Prototype
|
||||
`u32 allocate_mario_action(u32 actFlags);`
|
||||
|
||||
[:arrow_up_small:](#)
|
||||
|
||||
<br />
|
||||
|
||||
## [get_network_area_timer](#get_network_area_timer)
|
||||
|
||||
### Lua Example
|
||||
|
|
|
@ -167,6 +167,7 @@
|
|||
#define ACT_FLAG_PAUSE_EXIT /* 0x08000000 */ (1 << 27)
|
||||
#define ACT_FLAG_SWIMMING_OR_FLYING /* 0x10000000 */ (1 << 28)
|
||||
#define ACT_FLAG_WATER_OR_TEXT /* 0x20000000 */ (1 << 29)
|
||||
#define ACT_FLAG_CUSTOM_ACTION /* 0x40000000 */ (1 << 30)
|
||||
#define ACT_FLAG_THROWING /* 0x80000000 */ (1 << 31)
|
||||
|
||||
#define ACT_UNINITIALIZED 0x00000000 // (0x000)
|
||||
|
|
|
@ -36,8 +36,8 @@ end
|
|||
-- luigi --
|
||||
-----------
|
||||
|
||||
ACT_SPIN_POUND_LAND = (0x037 | ACT_FLAG_STATIONARY | ACT_FLAG_ATTACKING)
|
||||
ACT_SPIN_POUND = (0x08F | ACT_FLAG_AIR | ACT_FLAG_ATTACKING)
|
||||
ACT_SPIN_POUND_LAND = allocate_mario_action(ACT_FLAG_STATIONARY | ACT_FLAG_ATTACKING)
|
||||
ACT_SPIN_POUND = allocate_mario_action(ACT_FLAG_AIR | ACT_FLAG_ATTACKING)
|
||||
|
||||
function act_spin_pound(m)
|
||||
local e = gStateExtras[m.playerIndex]
|
||||
|
@ -360,7 +360,7 @@ gEventTable[CT_TOAD] = {
|
|||
-- waluigi --
|
||||
-------------
|
||||
|
||||
ACT_WALL_SLIDE = (0x0BF | ACT_FLAG_AIR | ACT_FLAG_MOVING | ACT_FLAG_ALLOW_VERTICAL_WIND_ACTION)
|
||||
ACT_WALL_SLIDE = allocate_mario_action(ACT_FLAG_AIR | ACT_FLAG_MOVING | ACT_FLAG_ALLOW_VERTICAL_WIND_ACTION)
|
||||
|
||||
function act_wall_slide(m)
|
||||
if (m.input & INPUT_A_PRESSED) ~= 0 then
|
||||
|
@ -482,10 +482,10 @@ gEventTable[CT_WALUIGI] = {
|
|||
-- wario --
|
||||
-----------
|
||||
|
||||
ACT_WARIO_DASH = (0x05B | ACT_FLAG_MOVING | ACT_FLAG_ATTACKING)
|
||||
ACT_WARIO_AIR_DASH = (0x05B | ACT_FLAG_AIR | ACT_FLAG_ATTACKING)
|
||||
ACT_CORKSCREW_CONK = (0x05D | ACT_FLAG_AIR | ACT_FLAG_ATTACKING | ACT_FLAG_ALLOW_VERTICAL_WIND_ACTION)
|
||||
ACT_WARIO_SPINNING_OBJ = (0x05B | ACT_FLAG_STATIONARY)
|
||||
ACT_WARIO_DASH = allocate_mario_action(ACT_FLAG_MOVING | ACT_FLAG_ATTACKING)
|
||||
ACT_WARIO_AIR_DASH = allocate_mario_action(ACT_FLAG_AIR | ACT_FLAG_ATTACKING)
|
||||
ACT_CORKSCREW_CONK = allocate_mario_action(ACT_FLAG_AIR | ACT_FLAG_ATTACKING | ACT_FLAG_ALLOW_VERTICAL_WIND_ACTION)
|
||||
ACT_WARIO_SPINNING_OBJ = allocate_mario_action(ACT_FLAG_STATIONARY)
|
||||
|
||||
function act_corkscrew_conk(m)
|
||||
local e = gStateExtras[m.playerIndex]
|
||||
|
|
|
@ -6,18 +6,18 @@
|
|||
-- initialize actions --
|
||||
------------------------
|
||||
|
||||
ACT_SPIN_POUND_LAND = (0x037 | ACT_FLAG_STATIONARY | ACT_FLAG_ATTACKING)
|
||||
ACT_ROLL = (0x05B | ACT_FLAG_MOVING | ACT_FLAG_BUTT_OR_STOMACH_SLIDE)
|
||||
ACT_GROUND_POUND_JUMP = (0x084 | ACT_FLAG_AIR | ACT_FLAG_ALLOW_VERTICAL_WIND_ACTION)
|
||||
ACT_SPIN_JUMP = (0x08B | ACT_FLAG_AIR | ACT_FLAG_ALLOW_VERTICAL_WIND_ACTION)
|
||||
ACT_SPIN_POUND = (0x08F | ACT_FLAG_AIR | ACT_FLAG_ATTACKING)
|
||||
ACT_LEDGE_PARKOUR = (0x09D | ACT_FLAG_AIR)
|
||||
ACT_ROLL_AIR = (0x0BA | ACT_FLAG_AIR | ACT_FLAG_ALLOW_VERTICAL_WIND_ACTION)
|
||||
ACT_WALL_SLIDE = (0x0BF | ACT_FLAG_AIR | ACT_FLAG_MOVING | ACT_FLAG_ALLOW_VERTICAL_WIND_ACTION)
|
||||
ACT_WATER_GROUND_POUND = (0x0C9 | ACT_FLAG_MOVING | ACT_FLAG_SWIMMING | ACT_FLAG_SWIMMING_OR_FLYING | ACT_FLAG_WATER_OR_TEXT | ACT_FLAG_ATTACKING)
|
||||
ACT_WATER_GROUND_POUND_LAND = (0x0CA | ACT_FLAG_STATIONARY | ACT_FLAG_SWIMMING | ACT_FLAG_SWIMMING_OR_FLYING | ACT_FLAG_WATER_OR_TEXT)
|
||||
ACT_WATER_GROUND_POUND_STROKE = (0x0CB | ACT_FLAG_MOVING | ACT_FLAG_SWIMMING | ACT_FLAG_SWIMMING_OR_FLYING | ACT_FLAG_WATER_OR_TEXT)
|
||||
ACT_WATER_GROUND_POUND_JUMP = (0x0CC | ACT_FLAG_MOVING | ACT_FLAG_SWIMMING | ACT_FLAG_SWIMMING_OR_FLYING | ACT_FLAG_WATER_OR_TEXT)
|
||||
ACT_SPIN_POUND_LAND = allocate_mario_action(ACT_FLAG_STATIONARY | ACT_FLAG_ATTACKING)
|
||||
ACT_ROLL = allocate_mario_action(ACT_FLAG_MOVING | ACT_FLAG_BUTT_OR_STOMACH_SLIDE)
|
||||
ACT_GROUND_POUND_JUMP = allocate_mario_action(ACT_FLAG_AIR | ACT_FLAG_ALLOW_VERTICAL_WIND_ACTION)
|
||||
ACT_SPIN_JUMP = allocate_mario_action(ACT_FLAG_AIR | ACT_FLAG_ALLOW_VERTICAL_WIND_ACTION)
|
||||
ACT_SPIN_POUND = allocate_mario_action(ACT_FLAG_AIR | ACT_FLAG_ATTACKING)
|
||||
ACT_LEDGE_PARKOUR = allocate_mario_action(ACT_FLAG_AIR)
|
||||
ACT_ROLL_AIR = allocate_mario_action(ACT_FLAG_AIR | ACT_FLAG_ALLOW_VERTICAL_WIND_ACTION)
|
||||
ACT_WALL_SLIDE = allocate_mario_action(ACT_FLAG_AIR | ACT_FLAG_MOVING | ACT_FLAG_ALLOW_VERTICAL_WIND_ACTION)
|
||||
ACT_WATER_GROUND_POUND = allocate_mario_action(ACT_FLAG_MOVING | ACT_FLAG_SWIMMING | ACT_FLAG_SWIMMING_OR_FLYING | ACT_FLAG_WATER_OR_TEXT | ACT_FLAG_ATTACKING)
|
||||
ACT_WATER_GROUND_POUND_LAND = allocate_mario_action(ACT_FLAG_STATIONARY | ACT_FLAG_SWIMMING | ACT_FLAG_SWIMMING_OR_FLYING | ACT_FLAG_WATER_OR_TEXT)
|
||||
ACT_WATER_GROUND_POUND_STROKE = allocate_mario_action(ACT_FLAG_MOVING | ACT_FLAG_SWIMMING | ACT_FLAG_SWIMMING_OR_FLYING | ACT_FLAG_WATER_OR_TEXT)
|
||||
ACT_WATER_GROUND_POUND_JUMP = allocate_mario_action(ACT_FLAG_MOVING | ACT_FLAG_SWIMMING | ACT_FLAG_SWIMMING_OR_FLYING | ACT_FLAG_WATER_OR_TEXT)
|
||||
|
||||
-----------------------------
|
||||
-- initialize extra fields --
|
||||
|
|
|
@ -1651,6 +1651,7 @@ char gSmluaConstants[] = ""
|
|||
"ACT_FLAG_PAUSE_EXIT = (1 << 27)\n"
|
||||
"ACT_FLAG_SWIMMING_OR_FLYING = (1 << 28)\n"
|
||||
"ACT_FLAG_WATER_OR_TEXT = (1 << 29)\n"
|
||||
"ACT_FLAG_CUSTOM_ACTION = (1 << 30)\n"
|
||||
"ACT_FLAG_THROWING = (1 << 31)\n"
|
||||
"ACT_UNINITIALIZED = 0x00000000\n"
|
||||
"ACT_IDLE = 0x0C400201\n"
|
||||
|
|
|
@ -7400,6 +7400,17 @@ int smlua_func_collision_find_surface_on_ray(lua_State* L) {
|
|||
// smlua_misc_utils.h //
|
||||
////////////////////////
|
||||
|
||||
int smlua_func_allocate_mario_action(lua_State* L) {
|
||||
if(!smlua_functions_valid_param_count(L, 1)) { return 0; }
|
||||
|
||||
u32 actFlags = smlua_to_integer(L, 1);
|
||||
if (!gSmLuaConvertSuccess) { return 0; }
|
||||
|
||||
lua_pushinteger(L, allocate_mario_action(actFlags));
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
int smlua_func_get_network_area_timer(UNUSED lua_State* L) {
|
||||
if(!smlua_functions_valid_param_count(L, 0)) { return 0; }
|
||||
|
||||
|
@ -8769,6 +8780,7 @@ void smlua_bind_functions_autogen(void) {
|
|||
smlua_bind_function(L, "collision_find_surface_on_ray", smlua_func_collision_find_surface_on_ray);
|
||||
|
||||
// smlua_misc_utils.h
|
||||
smlua_bind_function(L, "allocate_mario_action", smlua_func_allocate_mario_action);
|
||||
smlua_bind_function(L, "get_network_area_timer", smlua_func_get_network_area_timer);
|
||||
smlua_bind_function(L, "hud_hide", smlua_func_hud_hide);
|
||||
smlua_bind_function(L, "hud_show", smlua_func_hud_show);
|
||||
|
|
|
@ -230,6 +230,7 @@ struct LuaHookedMarioAction {
|
|||
|
||||
static struct LuaHookedMarioAction sHookedMarioActions[MAX_HOOKED_ACTIONS] = { 0 };
|
||||
static int sHookedMarioActionsCount = 0;
|
||||
u32 gLuaMarioActionIndex = 0;
|
||||
|
||||
int smlua_hook_mario_action(lua_State* L) {
|
||||
if (L == NULL) { return 0; }
|
||||
|
@ -742,6 +743,7 @@ static void smlua_clear_hooks(void) {
|
|||
hooked->mod = NULL;
|
||||
}
|
||||
sHookedBehaviorsCount = 0;
|
||||
gLuaMarioActionIndex = 0;
|
||||
}
|
||||
|
||||
void smlua_bind_hooks(void) {
|
||||
|
|
|
@ -40,6 +40,8 @@ static char* LuaHookedEventTypeName[] = {
|
|||
"HOOK_MAX"
|
||||
};
|
||||
|
||||
extern u32 gLuaMarioActionIndex;
|
||||
|
||||
void smlua_call_event_hooks(enum LuaHookedEventType hookType);
|
||||
void smlua_call_event_hooks_mario_param(enum LuaHookedEventType hookType, struct MarioState* m);
|
||||
void smlua_call_event_hooks_mario_params(enum LuaHookedEventType hookType, struct MarioState* m1, struct MarioState* m2);
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
#include "sm64.h"
|
||||
#include "types.h"
|
||||
|
||||
#include "data/dynos_coop.c.h"
|
||||
|
@ -33,3 +34,8 @@ bool warp_exit_level(s32 aDelay) {
|
|||
bool warp_to_castle(s32 aLevel) {
|
||||
return dynos_warp_to_castle(aLevel);
|
||||
}
|
||||
|
||||
u32 allocate_mario_action(u32 actFlags) {
|
||||
actFlags = actFlags & (~((u32)0xFF));
|
||||
return actFlags | ACT_FLAG_CUSTOM_ACTION | gLuaMarioActionIndex++;
|
||||
}
|
|
@ -11,4 +11,6 @@ bool warp_restart_level(void);
|
|||
bool warp_exit_level(s32 aDelay);
|
||||
bool warp_to_castle(s32 aLevel);
|
||||
|
||||
u32 allocate_mario_action(u32 actFlags);
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue