better kick/punch/trip, gp and flying detection (#388)

This commit is contained in:
PeachyPeach 2023-05-09 21:38:29 +02:00 committed by GitHub
parent cb499491f4
commit 3ab4c944ac
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
14 changed files with 175 additions and 102 deletions

View file

@ -3461,44 +3461,6 @@ GRAPH_RENDER_PLAYER = (1 << 7)
--- @type integer --- @type integer
GRAPH_RENDER_Z_BUFFER = (1 << 3) GRAPH_RENDER_Z_BUFFER = (1 << 3)
--- @type integer
INT_ANY_ATTACK = (INT_GROUND_POUND_OR_TWIRL | INT_PUNCH | INT_KICK | INT_TRIP | INT_SLIDE_KICK | INT_FAST_ATTACK_OR_SHELL | INT_HIT_FROM_ABOVE | INT_HIT_FROM_BELOW)
--- @type integer
INT_ATTACK_NOT_FROM_BELOW = (INT_GROUND_POUND_OR_TWIRL | INT_PUNCH | INT_KICK | INT_TRIP | INT_SLIDE_KICK | INT_FAST_ATTACK_OR_SHELL | INT_HIT_FROM_ABOVE)
--- @type integer
INT_ATTACK_NOT_WEAK_FROM_ABOVE = (INT_GROUND_POUND_OR_TWIRL | INT_PUNCH | INT_KICK | INT_TRIP | INT_HIT_FROM_BELOW)
--- @type integer
INT_ATTACK_SLIDE = (INT_SLIDE_KICK | INT_FAST_ATTACK_OR_SHELL)
--- @class InteractionFlag
--- @type InteractionFlag
INT_GROUND_POUND_OR_TWIRL = (1 << 0)
--- @type InteractionFlag
INT_PUNCH = (1 << 1)
--- @type InteractionFlag
INT_KICK = (1 << 2)
--- @type InteractionFlag
INT_TRIP = (1 << 3)
--- @type InteractionFlag
INT_SLIDE_KICK = (1 << 4)
--- @type InteractionFlag
INT_FAST_ATTACK_OR_SHELL = (1 << 5)
--- @type InteractionFlag
INT_HIT_FROM_ABOVE = (1 << 6)
--- @type InteractionFlag
INT_HIT_FROM_BELOW = (1 << 7)
--- @type integer --- @type integer
ATTACK_FAST_ATTACK = 5 ATTACK_FAST_ATTACK = 5
@ -3517,6 +3479,18 @@ ATTACK_KICK_OR_TRIP = 2
--- @type integer --- @type integer
ATTACK_PUNCH = 1 ATTACK_PUNCH = 1
--- @type integer
INT_ANY_ATTACK = (INT_GROUND_POUND_OR_TWIRL | INT_PUNCH | INT_KICK | INT_TRIP | INT_SLIDE_KICK | INT_FAST_ATTACK_OR_SHELL | INT_HIT_FROM_ABOVE | INT_HIT_FROM_BELOW)
--- @type integer
INT_ATTACK_NOT_FROM_BELOW = (INT_GROUND_POUND_OR_TWIRL | INT_PUNCH | INT_KICK | INT_TRIP | INT_SLIDE_KICK | INT_FAST_ATTACK_OR_SHELL | INT_HIT_FROM_ABOVE)
--- @type integer
INT_ATTACK_NOT_WEAK_FROM_ABOVE = (INT_GROUND_POUND_OR_TWIRL | INT_PUNCH | INT_KICK | INT_TRIP | INT_HIT_FROM_BELOW)
--- @type integer
INT_ATTACK_SLIDE = (INT_SLIDE_KICK | INT_FAST_ATTACK_OR_SHELL)
--- @type integer --- @type integer
INT_STATUS_ATTACKED_MARIO = (1 << 13) INT_STATUS_ATTACKED_MARIO = (1 << 13)
@ -3613,6 +3587,38 @@ INT_SUBTYPE_STAR_DOOR = 0x00000020
--- @type integer --- @type integer
INT_SUBTYPE_TWIRL_BOUNCE = 0x00000080 INT_SUBTYPE_TWIRL_BOUNCE = 0x00000080
--- @class InteractionFlag
--- @type InteractionFlag
INT_GROUND_POUND = (1 << 0)
--- @type InteractionFlag
INT_PUNCH = (1 << 1)
--- @type InteractionFlag
INT_KICK = (1 << 2)
--- @type InteractionFlag
INT_TRIP = (1 << 3)
--- @type InteractionFlag
INT_SLIDE_KICK = (1 << 4)
--- @type InteractionFlag
INT_FAST_ATTACK_OR_SHELL = (1 << 5)
--- @type InteractionFlag
INT_HIT_FROM_ABOVE = (1 << 6)
--- @type InteractionFlag
INT_HIT_FROM_BELOW = (1 << 7)
--- @type InteractionFlag
INT_TWIRL = (1 << 8)
--- @type InteractionFlag
INT_GROUND_POUND_OR_TWIRL = (INT_GROUND_POUND | INT_TWIRL)
--- @class InteractionType --- @class InteractionType
--- @type InteractionType --- @type InteractionType
@ -7286,6 +7292,9 @@ ACT_FLAG_CUSTOM_ACTION = (1 << 30)
--- @type integer --- @type integer
ACT_FLAG_DIVING = (1 << 19) ACT_FLAG_DIVING = (1 << 19)
--- @type integer
ACT_FLAG_FLYING = (ACT_FLAG_AIR | ACT_FLAG_DIVING | ACT_FLAG_ATTACKING | ACT_FLAG_SWIMMING_OR_FLYING)
--- @type integer --- @type integer
ACT_FLAG_HANGING = (1 << 21) ACT_FLAG_HANGING = (1 << 21)

View file

@ -3931,6 +3931,13 @@ function stop_sounds_in_continuous_banks()
-- ... -- ...
end end
--- @param m MarioState
--- @param o Object
--- @return integer
function determine_interaction(m, o)
-- ...
end
--- @param m MarioState --- @param m MarioState
--- @return integer --- @return integer
function does_mario_have_normal_cap_on_head(m) function does_mario_have_normal_cap_on_head(m)

View file

@ -19,8 +19,8 @@
- [geo_commands.h](#geo_commandsh) - [geo_commands.h](#geo_commandsh)
- [graph_node.h](#graph_nodeh) - [graph_node.h](#graph_nodeh)
- [interaction.c](#interactionc) - [interaction.c](#interactionc)
- [enum InteractionFlag](#enum-InteractionFlag)
- [interaction.h](#interactionh) - [interaction.h](#interactionh)
- [enum InteractionFlag](#enum-InteractionFlag)
- [enum InteractionType](#enum-InteractionType) - [enum InteractionType](#enum-InteractionType)
- [level_commands.h](#level_commandsh) - [level_commands.h](#level_commandsh)
- [level_defines.h](#level_definesh) - [level_defines.h](#level_definesh)
@ -1193,22 +1193,6 @@
<br /> <br />
## [interaction.c](#interaction.c) ## [interaction.c](#interaction.c)
- INT_ANY_ATTACK
- INT_ATTACK_NOT_FROM_BELOW
- INT_ATTACK_NOT_WEAK_FROM_ABOVE
- INT_ATTACK_SLIDE
### [enum InteractionFlag](#InteractionFlag)
| Identifier | Value |
| :--------- | :---- |
| INT_GROUND_POUND_OR_TWIRL | (1 << 0) |
| INT_PUNCH | (1 << 1) |
| INT_KICK | (1 << 2) |
| INT_TRIP | (1 << 3) |
| INT_SLIDE_KICK | (1 << 4) |
| INT_FAST_ATTACK_OR_SHELL | (1 << 5) |
| INT_HIT_FROM_ABOVE | (1 << 6) |
| INT_HIT_FROM_BELOW | (1 << 7) |
[:arrow_up_small:](#) [:arrow_up_small:](#)
@ -1221,6 +1205,10 @@
- ATTACK_GROUND_POUND_OR_TWIRL - ATTACK_GROUND_POUND_OR_TWIRL
- ATTACK_KICK_OR_TRIP - ATTACK_KICK_OR_TRIP
- ATTACK_PUNCH - ATTACK_PUNCH
- INT_ANY_ATTACK
- INT_ATTACK_NOT_FROM_BELOW
- INT_ATTACK_NOT_WEAK_FROM_ABOVE
- INT_ATTACK_SLIDE
- INT_STATUS_ATTACKED_MARIO - INT_STATUS_ATTACKED_MARIO
- INT_STATUS_ATTACK_MASK - INT_STATUS_ATTACK_MASK
- INT_STATUS_GRABBED_MARIO - INT_STATUS_GRABBED_MARIO
@ -1254,6 +1242,20 @@
- INT_SUBTYPE_STAR_DOOR - INT_SUBTYPE_STAR_DOOR
- INT_SUBTYPE_TWIRL_BOUNCE - INT_SUBTYPE_TWIRL_BOUNCE
### [enum InteractionFlag](#InteractionFlag)
| Identifier | Value |
| :--------- | :---- |
| INT_GROUND_POUND | (1 << 0) |
| INT_PUNCH | (1 << 1) |
| INT_KICK | (1 << 2) |
| INT_TRIP | (1 << 3) |
| INT_SLIDE_KICK | (1 << 4) |
| INT_FAST_ATTACK_OR_SHELL | (1 << 5) |
| INT_HIT_FROM_ABOVE | (1 << 6) |
| INT_HIT_FROM_BELOW | (1 << 7) |
| INT_TWIRL | (1 << 8) |
| INT_GROUND_POUND_OR_TWIRL | (INT_GROUND_POUND | INT_TWIRL) |
### [enum InteractionType](#InteractionType) ### [enum InteractionType](#InteractionType)
| Identifier | Value | | Identifier | Value |
| :--------- | :---- | | :--------- | :---- |
@ -2614,6 +2616,7 @@
- ACT_FLAG_CONTROL_JUMP_HEIGHT - ACT_FLAG_CONTROL_JUMP_HEIGHT
- ACT_FLAG_CUSTOM_ACTION - ACT_FLAG_CUSTOM_ACTION
- ACT_FLAG_DIVING - ACT_FLAG_DIVING
- ACT_FLAG_FLYING
- ACT_FLAG_HANGING - ACT_FLAG_HANGING
- ACT_FLAG_IDLE - ACT_FLAG_IDLE
- ACT_FLAG_INTANGIBLE - ACT_FLAG_INTANGIBLE

View file

@ -3037,6 +3037,27 @@
<br /> <br />
## [determine_interaction](#determine_interaction)
### Lua Example
`local integerValue = determine_interaction(m, o)`
### Parameters
| Field | Type |
| ----- | ---- |
| m | [MarioState](structs.md#MarioState) |
| o | [Object](structs.md#Object) |
### Returns
- `integer`
### C Prototype
`u32 determine_interaction(struct MarioState *m, struct Object *o);`
[:arrow_up_small:](#)
<br />
## [does_mario_have_normal_cap_on_head](#does_mario_have_normal_cap_on_head) ## [does_mario_have_normal_cap_on_head](#does_mario_have_normal_cap_on_head)
### Lua Example ### Lua Example

View file

@ -776,6 +776,7 @@
<br /> <br />
- interaction.h - interaction.h
- [determine_interaction](functions-3.md#determine_interaction)
- [does_mario_have_normal_cap_on_head](functions-3.md#does_mario_have_normal_cap_on_head) - [does_mario_have_normal_cap_on_head](functions-3.md#does_mario_have_normal_cap_on_head)
- [get_door_save_file_flag](functions-3.md#get_door_save_file_flag) - [get_door_save_file_flag](functions-3.md#get_door_save_file_flag)
- [interact_damage](functions-3.md#interact_damage) - [interact_damage](functions-3.md#interact_damage)

View file

@ -169,6 +169,7 @@
#define ACT_FLAG_WATER_OR_TEXT /* 0x20000000 */ (1 << 29) #define ACT_FLAG_WATER_OR_TEXT /* 0x20000000 */ (1 << 29)
#define ACT_FLAG_CUSTOM_ACTION /* 0x40000000 */ (1 << 30) #define ACT_FLAG_CUSTOM_ACTION /* 0x40000000 */ (1 << 30)
#define ACT_FLAG_THROWING /* 0x80000000 */ (1 << 31) #define ACT_FLAG_THROWING /* 0x80000000 */ (1 << 31)
#define ACT_FLAG_FLYING (ACT_FLAG_AIR | ACT_FLAG_DIVING | ACT_FLAG_ATTACKING | ACT_FLAG_SWIMMING_OR_FLYING)
#define ACT_UNINITIALIZED 0x00000000 // (0x000) #define ACT_UNINITIALIZED 0x00000000 // (0x000)

View file

@ -136,7 +136,7 @@ void bhv_blue_coin_switch_loop(void) {
// If Mario is on the switch and has ground-pounded, // If Mario is on the switch and has ground-pounded,
// recede and get ready to start ticking. // recede and get ready to start ticking.
if (gMarioObject->platform == o) { if (gMarioObject->platform == o) {
if (gMarioStates[0].action == ACT_GROUND_POUND_LAND) { if (determine_interaction(&gMarioStates[0], o) & INT_GROUND_POUND) {
// Set to BLUE_COIN_SWITCH_ACT_RECEDING // Set to BLUE_COIN_SWITCH_ACT_RECEDING
o->oAction++; o->oAction++;

View file

@ -31,7 +31,7 @@ void bhv_thi_tiny_island_top_loop(void) {
if (!(gTHIWaterDrained & 1)) { if (!(gTHIWaterDrained & 1)) {
if (o->oAction == 0) { if (o->oAction == 0) {
if (distanceToPlayer < 500.0f) if (distanceToPlayer < 500.0f)
if (marioState && marioState->action == ACT_GROUND_POUND_LAND) { if (marioState && !(marioState->action & ACT_FLAG_AIR) && (determine_interaction(marioState, o) & INT_GROUND_POUND) != 0) {
o->oAction++; o->oAction++;
cur_obj_spawn_particles(&D_8032F134); cur_obj_spawn_particles(&D_8032F134);
spawn_triangle_break_particles(20, 138, 0.3f, 3); spawn_triangle_break_particles(20, 138, 0.3f, 3);

View file

@ -463,8 +463,8 @@ static void newcam_update_values(void) {
} }
} }
switch (gMarioStates[0].action) { if ((gMarioStates[0].action & ACT_FLAG_FLYING) == ACT_FLAG_FLYING) {
case ACT_FLYING: centering = 1; break; centering = 1;
} }
static u32 sLastAction = 0; static u32 sLastAction = 0;

View file

@ -33,31 +33,6 @@
#include "pc/lua/smlua_hooks.h" #include "pc/lua/smlua_hooks.h"
#include "pc/cheats.h" #include "pc/cheats.h"
enum InteractionFlag {
INT_GROUND_POUND_OR_TWIRL = (1 << 0), // 0x01
INT_PUNCH = (1 << 1), // 0x02
INT_KICK = (1 << 2), // 0x04
INT_TRIP = (1 << 3), // 0x08
INT_SLIDE_KICK = (1 << 4), // 0x10
INT_FAST_ATTACK_OR_SHELL = (1 << 5), // 0x20
INT_HIT_FROM_ABOVE = (1 << 6), // 0x40
INT_HIT_FROM_BELOW = (1 << 7), // 0x80
};
#define INT_ATTACK_NOT_FROM_BELOW \
(INT_GROUND_POUND_OR_TWIRL | INT_PUNCH | INT_KICK | INT_TRIP | INT_SLIDE_KICK \
| INT_FAST_ATTACK_OR_SHELL | INT_HIT_FROM_ABOVE)
#define INT_ANY_ATTACK \
(INT_GROUND_POUND_OR_TWIRL | INT_PUNCH | INT_KICK | INT_TRIP | INT_SLIDE_KICK \
| INT_FAST_ATTACK_OR_SHELL | INT_HIT_FROM_ABOVE | INT_HIT_FROM_BELOW)
#define INT_ATTACK_NOT_WEAK_FROM_ABOVE \
(INT_GROUND_POUND_OR_TWIRL | INT_PUNCH | INT_KICK | INT_TRIP | INT_HIT_FROM_BELOW)
#define INT_ATTACK_SLIDE \
(INT_SLIDE_KICK | INT_FAST_ATTACK_OR_SHELL)
u8 sDelayInvincTimer; u8 sDelayInvincTimer;
s16 gInteractionInvulnerable; s16 gInteractionInvulnerable;
u32 interact_coin(struct MarioState *, u32, struct Object *); u32 interact_coin(struct MarioState *, u32, struct Object *);
@ -208,7 +183,7 @@ static u32 determine_interaction_internal(struct MarioState *m, struct Object *o
} }
if (interaction == 0 && action & ACT_FLAG_ATTACKING) { if (interaction == 0 && action & ACT_FLAG_ATTACKING) {
if (action == ACT_PUNCHING || action == ACT_MOVE_PUNCHING || action == ACT_JUMP_KICK) { if (m->flags & (MARIO_PUNCHING | MARIO_KICKING | MARIO_TRIPPING)) {
s16 dYawToObject = mario_obj_angle_to_object(m, o) - m->faceAngle[1]; s16 dYawToObject = mario_obj_angle_to_object(m, o) - m->faceAngle[1];
if (m->flags & MARIO_PUNCHING) { if (m->flags & MARIO_PUNCHING) {
@ -230,17 +205,29 @@ static u32 determine_interaction_internal(struct MarioState *m, struct Object *o
} }
} }
} else if (action == ACT_GROUND_POUND || action == ACT_TWIRLING) { } else if (action == ACT_GROUND_POUND) {
if (m->vel[1] < 0.0f) { if (m->vel[1] < 0.0f) {
interaction = INT_GROUND_POUND_OR_TWIRL; interaction = INT_GROUND_POUND;
} }
} else if (action == ACT_GROUND_POUND_LAND || action == ACT_TWIRL_LAND) { } else if (action == ACT_TWIRLING) {
if (m->vel[1] < 0.0f) {
interaction = INT_TWIRL;
}
} else if (action == ACT_GROUND_POUND_LAND) {
// Neither ground pounding nor twirling change Mario's vertical speed on landing., // Neither ground pounding nor twirling change Mario's vertical speed on landing.,
// so the speed check is nearly always true (perhaps not if you land while going upwards?) // so the speed check is nearly always true (perhaps not if you land while going upwards?)
// Additionally, actionState it set on each first thing in their action, so this is // Additionally, actionState it set on each first thing in their action, so this is
// only true prior to the very first frame (i.e. active 1 frame prior to it run). // only true prior to the very first frame (i.e. active 1 frame prior to it run).
if (m->vel[1] < 0.0f && m->actionState == 0) { if (m->vel[1] < 0.0f && m->actionState == 0) {
interaction = INT_GROUND_POUND_OR_TWIRL; interaction = INT_GROUND_POUND;
}
} else if (action == ACT_TWIRL_LAND) {
// Neither ground pounding nor twirling change Mario's vertical speed on landing.,
// so the speed check is nearly always true (perhaps not if you land while going upwards?)
// Additionally, actionState it set on each first thing in their action, so this is
// only true prior to the very first frame (i.e. active 1 frame prior to it run).
if (m->vel[1] < 0.0f && m->actionState == 0) {
interaction = INT_TWIRL;
} }
} else if (action == ACT_SLIDE_KICK || action == ACT_SLIDE_KICK_SLIDE) { } else if (action == ACT_SLIDE_KICK || action == ACT_SLIDE_KICK_SLIDE) {
interaction = INT_SLIDE_KICK; interaction = INT_SLIDE_KICK;
@ -284,6 +271,8 @@ u32 attack_object(struct Object *o, s32 interaction) {
u32 attackType = 0; u32 attackType = 0;
switch (interaction) { switch (interaction) {
case INT_GROUND_POUND:
case INT_TWIRL:
case INT_GROUND_POUND_OR_TWIRL: case INT_GROUND_POUND_OR_TWIRL:
attackType = ATTACK_GROUND_POUND_OR_TWIRL; attackType = ATTACK_GROUND_POUND_OR_TWIRL;
break; break;

View file

@ -40,6 +40,24 @@ enum InteractionType {
INTERACT_PLAYER = /* 0x80000000 */ (1 << 31), INTERACT_PLAYER = /* 0x80000000 */ (1 << 31),
}; };
enum InteractionFlag {
INT_GROUND_POUND = /* 0x00000001 */ (1 << 0),
INT_PUNCH = /* 0x00000002 */ (1 << 1),
INT_KICK = /* 0x00000004 */ (1 << 2),
INT_TRIP = /* 0x00000008 */ (1 << 3),
INT_SLIDE_KICK = /* 0x00000010 */ (1 << 4),
INT_FAST_ATTACK_OR_SHELL = /* 0x00000020 */ (1 << 5),
INT_HIT_FROM_ABOVE = /* 0x00000040 */ (1 << 6),
INT_HIT_FROM_BELOW = /* 0x00000080 */ (1 << 7),
INT_TWIRL = /* 0x00000100 */ (1 << 8),
INT_GROUND_POUND_OR_TWIRL = (INT_GROUND_POUND | INT_TWIRL),
};
#define INT_ATTACK_NOT_FROM_BELOW (INT_GROUND_POUND_OR_TWIRL | INT_PUNCH | INT_KICK | INT_TRIP | INT_SLIDE_KICK | INT_FAST_ATTACK_OR_SHELL | INT_HIT_FROM_ABOVE)
#define INT_ANY_ATTACK (INT_GROUND_POUND_OR_TWIRL | INT_PUNCH | INT_KICK | INT_TRIP | INT_SLIDE_KICK | INT_FAST_ATTACK_OR_SHELL | INT_HIT_FROM_ABOVE | INT_HIT_FROM_BELOW)
#define INT_ATTACK_NOT_WEAK_FROM_ABOVE (INT_GROUND_POUND_OR_TWIRL | INT_PUNCH | INT_KICK | INT_TRIP | INT_HIT_FROM_BELOW)
#define INT_ATTACK_SLIDE (INT_SLIDE_KICK | INT_FAST_ATTACK_OR_SHELL)
// INTERACT_WARP // INTERACT_WARP
#define INT_SUBTYPE_FADING_WARP 0x00000001 #define INT_SUBTYPE_FADING_WARP 0x00000001
@ -119,5 +137,6 @@ void mario_handle_special_floors(struct MarioState *m);
u8 passes_pvp_interaction_checks(struct MarioState* attacker, struct MarioState* victim); u8 passes_pvp_interaction_checks(struct MarioState* attacker, struct MarioState* victim);
u32 take_damage_and_knock_back(struct MarioState *m, struct Object *o); u32 take_damage_and_knock_back(struct MarioState *m, struct Object *o);
u32 interact_damage(struct MarioState *m, UNUSED u32 interactType, struct Object *o); u32 interact_damage(struct MarioState *m, UNUSED u32 interactType, struct Object *o);
u32 determine_interaction(struct MarioState *m, struct Object *o);
#endif // INTERACTION_H #endif // INTERACTION_H

View file

@ -2533,7 +2533,7 @@ s32 cur_obj_is_mario_ground_pounding_platform(void) {
for (s32 i = 0; i < MAX_PLAYERS; i++) { for (s32 i = 0; i < MAX_PLAYERS; i++) {
if (!is_player_active(&gMarioStates[i])) { continue; } if (!is_player_active(&gMarioStates[i])) { continue; }
if (gMarioStates[i].marioObj->platform == o) { if (gMarioStates[i].marioObj->platform == o) {
if (gMarioStates[i].action == ACT_GROUND_POUND_LAND) { if (determine_interaction(&gMarioStates[i], o) & INT_GROUND_POUND) {
return TRUE; return TRUE;
} }
} }

View file

@ -1344,18 +1344,6 @@ char gSmluaConstants[] = ""
"GEO_CONTEXT_AREA_LOAD = 3\n" "GEO_CONTEXT_AREA_LOAD = 3\n"
"GEO_CONTEXT_AREA_INIT = 4\n" "GEO_CONTEXT_AREA_INIT = 4\n"
"GEO_CONTEXT_HELD_OBJ = 5\n" "GEO_CONTEXT_HELD_OBJ = 5\n"
"INT_GROUND_POUND_OR_TWIRL = (1 << 0)\n"
"INT_PUNCH = (1 << 1)\n"
"INT_KICK = (1 << 2)\n"
"INT_TRIP = (1 << 3)\n"
"INT_SLIDE_KICK = (1 << 4)\n"
"INT_FAST_ATTACK_OR_SHELL = (1 << 5)\n"
"INT_HIT_FROM_ABOVE = (1 << 6)\n"
"INT_HIT_FROM_BELOW = (1 << 7)\n"
"INT_ATTACK_NOT_FROM_BELOW = (INT_GROUND_POUND_OR_TWIRL | INT_PUNCH | INT_KICK | INT_TRIP | INT_SLIDE_KICK | INT_FAST_ATTACK_OR_SHELL | INT_HIT_FROM_ABOVE)\n"
"INT_ANY_ATTACK = (INT_GROUND_POUND_OR_TWIRL | INT_PUNCH | INT_KICK | INT_TRIP | INT_SLIDE_KICK | INT_FAST_ATTACK_OR_SHELL | INT_HIT_FROM_ABOVE | INT_HIT_FROM_BELOW)\n"
"INT_ATTACK_NOT_WEAK_FROM_ABOVE = (INT_GROUND_POUND_OR_TWIRL | INT_PUNCH | INT_KICK | INT_TRIP | INT_HIT_FROM_BELOW)\n"
"INT_ATTACK_SLIDE = (INT_SLIDE_KICK | INT_FAST_ATTACK_OR_SHELL)\n"
"INTERACT_HOOT = (1 << 0)\n" "INTERACT_HOOT = (1 << 0)\n"
"INTERACT_GRABBABLE = (1 << 1)\n" "INTERACT_GRABBABLE = (1 << 1)\n"
"INTERACT_DOOR = (1 << 2)\n" "INTERACT_DOOR = (1 << 2)\n"
@ -1388,6 +1376,20 @@ char gSmluaConstants[] = ""
"INTERACT_SHOCK = (1 << 29)\n" "INTERACT_SHOCK = (1 << 29)\n"
"INTERACT_IGLOO_BARRIER = (1 << 30)\n" "INTERACT_IGLOO_BARRIER = (1 << 30)\n"
"INTERACT_PLAYER = (1 << 31)\n" "INTERACT_PLAYER = (1 << 31)\n"
"INT_GROUND_POUND = (1 << 0)\n"
"INT_PUNCH = (1 << 1)\n"
"INT_KICK = (1 << 2)\n"
"INT_TRIP = (1 << 3)\n"
"INT_SLIDE_KICK = (1 << 4)\n"
"INT_FAST_ATTACK_OR_SHELL = (1 << 5)\n"
"INT_HIT_FROM_ABOVE = (1 << 6)\n"
"INT_HIT_FROM_BELOW = (1 << 7)\n"
"INT_TWIRL = (1 << 8)\n"
"INT_GROUND_POUND_OR_TWIRL = (INT_GROUND_POUND | INT_TWIRL)\n"
"INT_ATTACK_NOT_FROM_BELOW = (INT_GROUND_POUND_OR_TWIRL | INT_PUNCH | INT_KICK | INT_TRIP | INT_SLIDE_KICK | INT_FAST_ATTACK_OR_SHELL | INT_HIT_FROM_ABOVE)\n"
"INT_ANY_ATTACK = (INT_GROUND_POUND_OR_TWIRL | INT_PUNCH | INT_KICK | INT_TRIP | INT_SLIDE_KICK | INT_FAST_ATTACK_OR_SHELL | INT_HIT_FROM_ABOVE | INT_HIT_FROM_BELOW)\n"
"INT_ATTACK_NOT_WEAK_FROM_ABOVE = (INT_GROUND_POUND_OR_TWIRL | INT_PUNCH | INT_KICK | INT_TRIP | INT_HIT_FROM_BELOW)\n"
"INT_ATTACK_SLIDE = (INT_SLIDE_KICK | INT_FAST_ATTACK_OR_SHELL)\n"
"INT_SUBTYPE_FADING_WARP = 0x00000001\n" "INT_SUBTYPE_FADING_WARP = 0x00000001\n"
"INT_SUBTYPE_DELAY_INVINCIBILITY = 0x00000002\n" "INT_SUBTYPE_DELAY_INVINCIBILITY = 0x00000002\n"
"INT_SUBTYPE_BIG_KNOCKBACK = 0x00000008\n" "INT_SUBTYPE_BIG_KNOCKBACK = 0x00000008\n"
@ -2658,6 +2660,7 @@ char gSmluaConstants[] = ""
"ACT_FLAG_WATER_OR_TEXT = (1 << 29)\n" "ACT_FLAG_WATER_OR_TEXT = (1 << 29)\n"
"ACT_FLAG_CUSTOM_ACTION = (1 << 30)\n" "ACT_FLAG_CUSTOM_ACTION = (1 << 30)\n"
"ACT_FLAG_THROWING = (1 << 31)\n" "ACT_FLAG_THROWING = (1 << 31)\n"
"ACT_FLAG_FLYING = (ACT_FLAG_AIR | ACT_FLAG_DIVING | ACT_FLAG_ATTACKING | ACT_FLAG_SWIMMING_OR_FLYING)\n"
"ACT_UNINITIALIZED = 0x00000000\n" "ACT_UNINITIALIZED = 0x00000000\n"
"ACT_IDLE = 0x0C400201\n" "ACT_IDLE = 0x0C400201\n"
"ACT_START_SLEEPING = 0x0C400202\n" "ACT_START_SLEEPING = 0x0C400202\n"

View file

@ -12425,6 +12425,25 @@ int smlua_func_stop_sounds_in_continuous_banks(UNUSED lua_State* L) {
// interaction.h // // interaction.h //
/////////////////// ///////////////////
int smlua_func_determine_interaction(lua_State* L) {
if (L == NULL) { return 0; }
int top = lua_gettop(L);
if (top != 2) {
LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "determine_interaction", 2, top);
return 0;
}
struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIOSTATE);
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "determine_interaction"); return 0; }
struct Object* o = (struct Object*)smlua_to_cobject(L, 2, LOT_OBJECT);
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "determine_interaction"); return 0; }
lua_pushinteger(L, determine_interaction(m, o));
return 1;
}
int smlua_func_does_mario_have_normal_cap_on_head(lua_State* L) { int smlua_func_does_mario_have_normal_cap_on_head(lua_State* L) {
if (L == NULL) { return 0; } if (L == NULL) { return 0; }
@ -30163,6 +30182,7 @@ void smlua_bind_functions_autogen(void) {
smlua_bind_function(L, "stop_sounds_in_continuous_banks", smlua_func_stop_sounds_in_continuous_banks); smlua_bind_function(L, "stop_sounds_in_continuous_banks", smlua_func_stop_sounds_in_continuous_banks);
// interaction.h // interaction.h
smlua_bind_function(L, "determine_interaction", smlua_func_determine_interaction);
smlua_bind_function(L, "does_mario_have_normal_cap_on_head", smlua_func_does_mario_have_normal_cap_on_head); smlua_bind_function(L, "does_mario_have_normal_cap_on_head", smlua_func_does_mario_have_normal_cap_on_head);
smlua_bind_function(L, "get_door_save_file_flag", smlua_func_get_door_save_file_flag); smlua_bind_function(L, "get_door_save_file_flag", smlua_func_get_door_save_file_flag);
smlua_bind_function(L, "interact_damage", smlua_func_interact_damage); smlua_bind_function(L, "interact_damage", smlua_func_interact_damage);