Added support for returning structs from C to Lua
This commit is contained in:
parent
fb01338278
commit
cf34aa0b08
|
@ -15,8 +15,10 @@ def get_path(p):
|
|||
return os.path.dirname(os.path.realpath(__file__)) + '/../' + p
|
||||
|
||||
def translate_type_to_lvt(ptype):
|
||||
if ptype == 'char*' or ('char' in ptype and '[' in ptype):
|
||||
if ('char' in ptype and '[' in ptype):
|
||||
return 'LVT_STRING'
|
||||
if ptype == 'char*':
|
||||
return 'LVT_STRING_P'
|
||||
|
||||
if '[' in ptype or '{' in ptype:
|
||||
return 'LOT_???'
|
||||
|
|
|
@ -193,6 +193,8 @@ def build_call(function):
|
|||
if ftype == 'void':
|
||||
return ' %s;\n' % ccall
|
||||
|
||||
flot = translate_type_to_lot(ftype)
|
||||
|
||||
lfunc = 'UNIMPLEMENTED -->'
|
||||
if ftype in integer_types:
|
||||
lfunc = 'lua_pushinteger'
|
||||
|
@ -200,6 +202,8 @@ def build_call(function):
|
|||
lfunc = 'lua_pushnumber'
|
||||
elif ftype == 'bool':
|
||||
lfunc = 'lua_pushboolean'
|
||||
elif '???' not in flot:
|
||||
return ' smlua_push_object(L, %s, %s);\n' % (flot, ccall)
|
||||
|
||||
return ' %s(L, %s);\n' % (lfunc, ccall)
|
||||
|
||||
|
|
|
@ -185,7 +185,7 @@ def get_struct_field_info(struct, field):
|
|||
|
||||
lvt = translate_type_to_lvt(ftype)
|
||||
lot = translate_type_to_lot(ftype)
|
||||
fimmutable = str(lvt == 'LVT_COBJECT' or lvt == 'LVT_COBJECT_P' or lvt == 'LVT_STRING').lower()
|
||||
fimmutable = str(lvt == 'LVT_COBJECT' or lvt == 'LVT_COBJECT_P' or lvt == 'LVT_STRING' or lvt == 'LVT_STRING_P').lower()
|
||||
|
||||
if sid in override_field_immutable:
|
||||
if fid in override_field_immutable[sid] or '*' in override_field_immutable[sid]:
|
||||
|
@ -317,7 +317,7 @@ def doc_struct(struct):
|
|||
|
||||
def doc_structs(structs):
|
||||
structs.extend(parse_structs(sLuaManuallyDefinedStructs))
|
||||
structs = sorted(structs, key=lambda d: d['identifier'])
|
||||
structs = sorted(structs, key=lambda d: d['identifier'])
|
||||
|
||||
s = '## [:rewind: Lua Reference](lua.md)\n\n'
|
||||
s += doc_struct_index(structs)
|
||||
|
@ -338,7 +338,7 @@ def build_files():
|
|||
extracted.extend(extract_structs(path))
|
||||
|
||||
parsed = parse_structs(extracted)
|
||||
parsed = sorted(parsed, key=lambda d: d['identifier'])
|
||||
parsed = sorted(parsed, key=lambda d: d['identifier'])
|
||||
|
||||
built_body = build_body(parsed)
|
||||
built_enum = build_lot_enum()
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
<br />
|
||||
|
||||
- characters.h
|
||||
- [get_character](#get_character)
|
||||
- [get_character_anim_offset](#get_character_anim_offset)
|
||||
- [play_character_sound](#play_character_sound)
|
||||
- [play_character_sound_if_no_flag](#play_character_sound_if_no_flag)
|
||||
|
@ -81,6 +82,7 @@
|
|||
- [play_mario_sound](#play_mario_sound)
|
||||
- [play_sound_and_spawn_particles](#play_sound_and_spawn_particles)
|
||||
- [play_sound_if_no_flag](#play_sound_if_no_flag)
|
||||
- [resolve_and_return_wall_collisions](#resolve_and_return_wall_collisions)
|
||||
- [return_mario_anim_y_translation](#return_mario_anim_y_translation)
|
||||
- [set_anim_to_frame](#set_anim_to_frame)
|
||||
- [set_jump_from_landing](#set_jump_from_landing)
|
||||
|
@ -402,6 +404,26 @@
|
|||
<br />
|
||||
|
||||
|
||||
## [get_character](#get_character)
|
||||
|
||||
### Lua Example
|
||||
`local CharacterValue = get_character(m)`
|
||||
|
||||
### Parameters
|
||||
| Field | Type |
|
||||
| ----- | ---- |
|
||||
| m | [MarioState](structs.md#MarioState) |
|
||||
|
||||
### Returns
|
||||
[Character](structs.md#Character)
|
||||
|
||||
### C Prototype
|
||||
`struct Character* get_character(struct MarioState* m);`
|
||||
|
||||
[:arrow_up_small:](#)
|
||||
|
||||
<br />
|
||||
|
||||
## [get_character_anim_offset](#get_character_anim_offset)
|
||||
|
||||
### Lua Example
|
||||
|
@ -1518,6 +1540,28 @@
|
|||
|
||||
<br />
|
||||
|
||||
## [resolve_and_return_wall_collisions](#resolve_and_return_wall_collisions)
|
||||
|
||||
### Lua Example
|
||||
`local SurfaceValue = resolve_and_return_wall_collisions(pos, offset, radius)`
|
||||
|
||||
### Parameters
|
||||
| Field | Type |
|
||||
| ----- | ---- |
|
||||
| pos | [Vec3f](structs.md#Vec3f) |
|
||||
| offset | number |
|
||||
| radius | number |
|
||||
|
||||
### Returns
|
||||
[Surface](structs.md#Surface)
|
||||
|
||||
### C Prototype
|
||||
`struct Surface *resolve_and_return_wall_collisions(Vec3f pos, f32 offset, f32 radius);`
|
||||
|
||||
[:arrow_up_small:](#)
|
||||
|
||||
<br />
|
||||
|
||||
## [return_mario_anim_y_translation](#return_mario_anim_y_translation)
|
||||
|
||||
### Lua Example
|
||||
|
|
|
@ -9,10 +9,14 @@ Hooks are a way for SM64 to trigger Lua code, whereas the functions listed in [f
|
|||
| Type | Description | Parameters |
|
||||
| :--- | :---------- | :--------- |
|
||||
| HOOK_UPDATE | Called once per frame | None |
|
||||
| HOOK_MARIO_UPDATE | Called once per player per frame at the end of a mario update | [MarioState](structs.md#MarioState) |
|
||||
| HOOK_BEFORE_MARIO_UPDATE | Called once per player per frame at the beginning of a mario update | [MarioState](structs.md#MarioState) |
|
||||
| HOOK_ON_SET_MARIO_ACTION | Called every time a player's current action is changed | [MarioState](structs.md#MarioState) |
|
||||
| HOOK_BEFORE_PHYS_STEP | Called once per player per frame before physics code is run | [MarioState](structs.md#MarioState) |
|
||||
| HOOK_MARIO_UPDATE | Called once per player per frame at the end of a mario update | [MarioState](structs.md#MarioState) mario |
|
||||
| HOOK_BEFORE_MARIO_UPDATE | Called once per player per frame at the beginning of a mario update | [MarioState](structs.md#MarioState) mario |
|
||||
| HOOK_ON_SET_MARIO_ACTION | Called every time a player's current action is changed | [MarioState](structs.md#MarioState) mario |
|
||||
| HOOK_BEFORE_PHYS_STEP | Called once per player per frame before physics code is run | [MarioState](structs.md#MarioState) mario |
|
||||
| HOOK_ON_PVP_ATTACK | Called when one player attacks another | [MarioState](structs.md#MarioState) attacker, [MarioState](structs.md#MarioState) victim |
|
||||
| HOOK_ON_PLAYER_CONNECTED | Called when a player connects | [MarioState](structs.md#MarioState) connector |
|
||||
| HOOK_ON_PLAYER_DISCONNECTED | Called when a player disconnects | [MarioState](structs.md#MarioState) disconnector |
|
||||
| HOOK_ON_CHAT_COMMAND | Called when a player types a chat message starting with '/' | `string` message -> `return` `true` on valid command |
|
||||
|
||||
<br />
|
||||
|
||||
|
|
|
@ -92,7 +92,8 @@ static int smlua__get_field(lua_State* L) {
|
|||
case LVT_F32: lua_pushnumber( L, *(f32*)p); break;
|
||||
case LVT_COBJECT: smlua_push_object(L, data->lot, p); break;
|
||||
case LVT_COBJECT_P: smlua_push_object(L, data->lot, *(u8**)p); break;
|
||||
case LVT_STRING: lua_pushstring(L, (char*)p); break;
|
||||
case LVT_STRING: lua_pushstring(L, (char*)p); break;
|
||||
case LVT_STRING_P: lua_pushstring(L, *(char**)p); break;
|
||||
default:
|
||||
LOG_LUA("_get_field on unimplemented type '%d', key '%s'", data->valueType, key);
|
||||
return 0;
|
||||
|
|
|
@ -13,6 +13,7 @@ enum LuaValueType {
|
|||
LVT_COBJECT,
|
||||
LVT_COBJECT_P,
|
||||
LVT_STRING,
|
||||
LVT_STRING_P,
|
||||
};
|
||||
|
||||
enum LuaObjectType {
|
||||
|
|
|
@ -97,66 +97,66 @@ static struct LuaObjectField sCameraTriggerFields[LUA_CAMERA_TRIGGER_FIELD_COUNT
|
|||
|
||||
#define LUA_CHARACTER_FIELD_COUNT 56
|
||||
static struct LuaObjectField sCharacterFields[LUA_CHARACTER_FIELD_COUNT] = {
|
||||
{ "animOffsetEnabled", LVT_U8, offsetof(struct Character, animOffsetEnabled), true, LOT_NONE },
|
||||
{ "animOffsetFeet", LVT_F32, offsetof(struct Character, animOffsetFeet), true, LOT_NONE },
|
||||
{ "animOffsetHand", LVT_F32, offsetof(struct Character, animOffsetHand), true, LOT_NONE },
|
||||
{ "animOffsetLowYPoint", LVT_F32, offsetof(struct Character, animOffsetLowYPoint), true, LOT_NONE },
|
||||
{ "cameraHudHead", LVT_U32, offsetof(struct Character, cameraHudHead), true, LOT_NONE },
|
||||
// { "capEnemyDecalGfx", LVT_???, offsetof(struct Character, capEnemyDecalGfx), true, LOT_??? }, <--- UNIMPLEMENTED
|
||||
// { "capEnemyGfx", LVT_???, offsetof(struct Character, capEnemyGfx), true, LOT_??? }, <--- UNIMPLEMENTED
|
||||
{ "capEnemyLayer", LVT_U8, offsetof(struct Character, capEnemyLayer), true, LOT_NONE },
|
||||
{ "capMetalModelId", LVT_U32, offsetof(struct Character, capMetalModelId), true, LOT_NONE },
|
||||
{ "capMetalWingModelId", LVT_U32, offsetof(struct Character, capMetalWingModelId), true, LOT_NONE },
|
||||
{ "capModelId", LVT_U32, offsetof(struct Character, capModelId), true, LOT_NONE },
|
||||
{ "capWingModelId", LVT_U32, offsetof(struct Character, capWingModelId), true, LOT_NONE },
|
||||
// { "hudHead", LVT_???, offsetof(struct Character, hudHead), true, LOT_??? }, <--- UNIMPLEMENTED
|
||||
// { "hudHeadTexture", LVT_???, offsetof(struct Character, hudHeadTexture), true, LOT_??? }, <--- UNIMPLEMENTED
|
||||
{ "modelId", LVT_U32, offsetof(struct Character, modelId), true, LOT_NONE },
|
||||
{ "name", LVT_STRING, offsetof(struct Character, name), true, LOT_NONE },
|
||||
{ "soundAttacked", LVT_S32, offsetof(struct Character, soundAttacked), true, LOT_NONE },
|
||||
{ "soundCoughing1", LVT_S32, offsetof(struct Character, soundCoughing1), true, LOT_NONE },
|
||||
{ "soundCoughing2", LVT_S32, offsetof(struct Character, soundCoughing2), true, LOT_NONE },
|
||||
{ "soundCoughing3", LVT_S32, offsetof(struct Character, soundCoughing3), true, LOT_NONE },
|
||||
{ "soundDoh", LVT_S32, offsetof(struct Character, soundDoh), true, LOT_NONE },
|
||||
{ "soundDrowning", LVT_S32, offsetof(struct Character, soundDrowning), true, LOT_NONE },
|
||||
{ "soundDying", LVT_S32, offsetof(struct Character, soundDying), true, LOT_NONE },
|
||||
{ "soundEeuh", LVT_S32, offsetof(struct Character, soundEeuh), true, LOT_NONE },
|
||||
{ "soundFreqScale", LVT_F32, offsetof(struct Character, soundFreqScale), true, LOT_NONE },
|
||||
{ "soundGameOver", LVT_S32, offsetof(struct Character, soundGameOver), true, LOT_NONE },
|
||||
{ "soundGroundPoundWah", LVT_S32, offsetof(struct Character, soundGroundPoundWah), true, LOT_NONE },
|
||||
{ "soundHaha", LVT_S32, offsetof(struct Character, soundHaha), true, LOT_NONE },
|
||||
{ "soundHaha_2", LVT_S32, offsetof(struct Character, soundHaha_2), true, LOT_NONE },
|
||||
{ "soundHello", LVT_S32, offsetof(struct Character, soundHello), true, LOT_NONE },
|
||||
{ "soundHereWeGo", LVT_S32, offsetof(struct Character, soundHereWeGo), true, LOT_NONE },
|
||||
{ "soundHoohoo", LVT_S32, offsetof(struct Character, soundHoohoo), true, LOT_NONE },
|
||||
{ "soundHrmm", LVT_S32, offsetof(struct Character, soundHrmm), true, LOT_NONE },
|
||||
{ "soundImaTired", LVT_S32, offsetof(struct Character, soundImaTired), true, LOT_NONE },
|
||||
{ "soundMamaMia", LVT_S32, offsetof(struct Character, soundMamaMia), true, LOT_NONE },
|
||||
{ "soundOnFire", LVT_S32, offsetof(struct Character, soundOnFire), true, LOT_NONE },
|
||||
{ "soundOoof", LVT_S32, offsetof(struct Character, soundOoof), true, LOT_NONE },
|
||||
{ "soundOoof2", LVT_S32, offsetof(struct Character, soundOoof2), true, LOT_NONE },
|
||||
{ "soundPanting", LVT_S32, offsetof(struct Character, soundPanting), true, LOT_NONE },
|
||||
{ "soundPantingCold", LVT_S32, offsetof(struct Character, soundPantingCold), true, LOT_NONE },
|
||||
{ "soundPressStartToPlay", LVT_S32, offsetof(struct Character, soundPressStartToPlay), true, LOT_NONE },
|
||||
{ "soundPunchHoo", LVT_S32, offsetof(struct Character, soundPunchHoo), true, LOT_NONE },
|
||||
{ "soundPunchWah", LVT_S32, offsetof(struct Character, soundPunchWah), true, LOT_NONE },
|
||||
{ "soundPunchYah", LVT_S32, offsetof(struct Character, soundPunchYah), true, LOT_NONE },
|
||||
{ "soundSnoring1", LVT_S32, offsetof(struct Character, soundSnoring1), true, LOT_NONE },
|
||||
{ "soundSnoring2", LVT_S32, offsetof(struct Character, soundSnoring2), true, LOT_NONE },
|
||||
{ "soundSnoring3", LVT_S32, offsetof(struct Character, soundSnoring3), true, LOT_NONE },
|
||||
{ "soundSoLongaBowser", LVT_S32, offsetof(struct Character, soundSoLongaBowser), true, LOT_NONE },
|
||||
{ "soundTwirlBounce", LVT_S32, offsetof(struct Character, soundTwirlBounce), true, LOT_NONE },
|
||||
{ "soundUh", LVT_S32, offsetof(struct Character, soundUh), true, LOT_NONE },
|
||||
{ "soundUh2", LVT_S32, offsetof(struct Character, soundUh2), true, LOT_NONE },
|
||||
{ "soundUh2_2", LVT_S32, offsetof(struct Character, soundUh2_2), true, LOT_NONE },
|
||||
{ "soundWaaaooow", LVT_S32, offsetof(struct Character, soundWaaaooow), true, LOT_NONE },
|
||||
{ "soundWah2", LVT_S32, offsetof(struct Character, soundWah2), true, LOT_NONE },
|
||||
{ "soundWhoa", LVT_S32, offsetof(struct Character, soundWhoa), true, LOT_NONE },
|
||||
{ "soundYahWahHoo", LVT_S32, offsetof(struct Character, soundYahWahHoo), true, LOT_NONE },
|
||||
{ "soundYahoo", LVT_S32, offsetof(struct Character, soundYahoo), true, LOT_NONE },
|
||||
{ "soundYahooWahaYippee", LVT_S32, offsetof(struct Character, soundYahooWahaYippee), true, LOT_NONE },
|
||||
{ "soundYawning", LVT_S32, offsetof(struct Character, soundYawning), true, LOT_NONE },
|
||||
{ "type", LVT_S32, offsetof(struct Character, type), true, LOT_NONE },
|
||||
{ "animOffsetEnabled", LVT_U8, offsetof(struct Character, animOffsetEnabled), true, LOT_NONE },
|
||||
{ "animOffsetFeet", LVT_F32, offsetof(struct Character, animOffsetFeet), true, LOT_NONE },
|
||||
{ "animOffsetHand", LVT_F32, offsetof(struct Character, animOffsetHand), true, LOT_NONE },
|
||||
{ "animOffsetLowYPoint", LVT_F32, offsetof(struct Character, animOffsetLowYPoint), true, LOT_NONE },
|
||||
{ "cameraHudHead", LVT_U32, offsetof(struct Character, cameraHudHead), true, LOT_NONE },
|
||||
// { "capEnemyDecalGfx", LVT_???, offsetof(struct Character, capEnemyDecalGfx), true, LOT_??? }, <--- UNIMPLEMENTED
|
||||
// { "capEnemyGfx", LVT_???, offsetof(struct Character, capEnemyGfx), true, LOT_??? }, <--- UNIMPLEMENTED
|
||||
{ "capEnemyLayer", LVT_U8, offsetof(struct Character, capEnemyLayer), true, LOT_NONE },
|
||||
{ "capMetalModelId", LVT_U32, offsetof(struct Character, capMetalModelId), true, LOT_NONE },
|
||||
{ "capMetalWingModelId", LVT_U32, offsetof(struct Character, capMetalWingModelId), true, LOT_NONE },
|
||||
{ "capModelId", LVT_U32, offsetof(struct Character, capModelId), true, LOT_NONE },
|
||||
{ "capWingModelId", LVT_U32, offsetof(struct Character, capWingModelId), true, LOT_NONE },
|
||||
// { "hudHead", LVT_???, offsetof(struct Character, hudHead), true, LOT_??? }, <--- UNIMPLEMENTED
|
||||
// { "hudHeadTexture", LVT_???, offsetof(struct Character, hudHeadTexture), true, LOT_??? }, <--- UNIMPLEMENTED
|
||||
{ "modelId", LVT_U32, offsetof(struct Character, modelId), true, LOT_NONE },
|
||||
{ "name", LVT_STRING_P, offsetof(struct Character, name), true, LOT_NONE },
|
||||
{ "soundAttacked", LVT_S32, offsetof(struct Character, soundAttacked), true, LOT_NONE },
|
||||
{ "soundCoughing1", LVT_S32, offsetof(struct Character, soundCoughing1), true, LOT_NONE },
|
||||
{ "soundCoughing2", LVT_S32, offsetof(struct Character, soundCoughing2), true, LOT_NONE },
|
||||
{ "soundCoughing3", LVT_S32, offsetof(struct Character, soundCoughing3), true, LOT_NONE },
|
||||
{ "soundDoh", LVT_S32, offsetof(struct Character, soundDoh), true, LOT_NONE },
|
||||
{ "soundDrowning", LVT_S32, offsetof(struct Character, soundDrowning), true, LOT_NONE },
|
||||
{ "soundDying", LVT_S32, offsetof(struct Character, soundDying), true, LOT_NONE },
|
||||
{ "soundEeuh", LVT_S32, offsetof(struct Character, soundEeuh), true, LOT_NONE },
|
||||
{ "soundFreqScale", LVT_F32, offsetof(struct Character, soundFreqScale), true, LOT_NONE },
|
||||
{ "soundGameOver", LVT_S32, offsetof(struct Character, soundGameOver), true, LOT_NONE },
|
||||
{ "soundGroundPoundWah", LVT_S32, offsetof(struct Character, soundGroundPoundWah), true, LOT_NONE },
|
||||
{ "soundHaha", LVT_S32, offsetof(struct Character, soundHaha), true, LOT_NONE },
|
||||
{ "soundHaha_2", LVT_S32, offsetof(struct Character, soundHaha_2), true, LOT_NONE },
|
||||
{ "soundHello", LVT_S32, offsetof(struct Character, soundHello), true, LOT_NONE },
|
||||
{ "soundHereWeGo", LVT_S32, offsetof(struct Character, soundHereWeGo), true, LOT_NONE },
|
||||
{ "soundHoohoo", LVT_S32, offsetof(struct Character, soundHoohoo), true, LOT_NONE },
|
||||
{ "soundHrmm", LVT_S32, offsetof(struct Character, soundHrmm), true, LOT_NONE },
|
||||
{ "soundImaTired", LVT_S32, offsetof(struct Character, soundImaTired), true, LOT_NONE },
|
||||
{ "soundMamaMia", LVT_S32, offsetof(struct Character, soundMamaMia), true, LOT_NONE },
|
||||
{ "soundOnFire", LVT_S32, offsetof(struct Character, soundOnFire), true, LOT_NONE },
|
||||
{ "soundOoof", LVT_S32, offsetof(struct Character, soundOoof), true, LOT_NONE },
|
||||
{ "soundOoof2", LVT_S32, offsetof(struct Character, soundOoof2), true, LOT_NONE },
|
||||
{ "soundPanting", LVT_S32, offsetof(struct Character, soundPanting), true, LOT_NONE },
|
||||
{ "soundPantingCold", LVT_S32, offsetof(struct Character, soundPantingCold), true, LOT_NONE },
|
||||
{ "soundPressStartToPlay", LVT_S32, offsetof(struct Character, soundPressStartToPlay), true, LOT_NONE },
|
||||
{ "soundPunchHoo", LVT_S32, offsetof(struct Character, soundPunchHoo), true, LOT_NONE },
|
||||
{ "soundPunchWah", LVT_S32, offsetof(struct Character, soundPunchWah), true, LOT_NONE },
|
||||
{ "soundPunchYah", LVT_S32, offsetof(struct Character, soundPunchYah), true, LOT_NONE },
|
||||
{ "soundSnoring1", LVT_S32, offsetof(struct Character, soundSnoring1), true, LOT_NONE },
|
||||
{ "soundSnoring2", LVT_S32, offsetof(struct Character, soundSnoring2), true, LOT_NONE },
|
||||
{ "soundSnoring3", LVT_S32, offsetof(struct Character, soundSnoring3), true, LOT_NONE },
|
||||
{ "soundSoLongaBowser", LVT_S32, offsetof(struct Character, soundSoLongaBowser), true, LOT_NONE },
|
||||
{ "soundTwirlBounce", LVT_S32, offsetof(struct Character, soundTwirlBounce), true, LOT_NONE },
|
||||
{ "soundUh", LVT_S32, offsetof(struct Character, soundUh), true, LOT_NONE },
|
||||
{ "soundUh2", LVT_S32, offsetof(struct Character, soundUh2), true, LOT_NONE },
|
||||
{ "soundUh2_2", LVT_S32, offsetof(struct Character, soundUh2_2), true, LOT_NONE },
|
||||
{ "soundWaaaooow", LVT_S32, offsetof(struct Character, soundWaaaooow), true, LOT_NONE },
|
||||
{ "soundWah2", LVT_S32, offsetof(struct Character, soundWah2), true, LOT_NONE },
|
||||
{ "soundWhoa", LVT_S32, offsetof(struct Character, soundWhoa), true, LOT_NONE },
|
||||
{ "soundYahWahHoo", LVT_S32, offsetof(struct Character, soundYahWahHoo), true, LOT_NONE },
|
||||
{ "soundYahoo", LVT_S32, offsetof(struct Character, soundYahoo), true, LOT_NONE },
|
||||
{ "soundYahooWahaYippee", LVT_S32, offsetof(struct Character, soundYahooWahaYippee), true, LOT_NONE },
|
||||
{ "soundYawning", LVT_S32, offsetof(struct Character, soundYawning), true, LOT_NONE },
|
||||
{ "type", LVT_S32, offsetof(struct Character, type), true, LOT_NONE },
|
||||
};
|
||||
|
||||
#define LUA_CONTROLLER_FIELD_COUNT 10
|
||||
|
|
|
@ -107,18 +107,16 @@ int smlua_func_set_environmental_camera_shake(lua_State* L) {
|
|||
// characters.h //
|
||||
//////////////////
|
||||
|
||||
/*
|
||||
int smlua_func_get_character(lua_State* L) {
|
||||
if(!smlua_functions_valid_param_count(L, 1)) { return 0; }
|
||||
|
||||
struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIOSTATE);
|
||||
if (!gSmLuaConvertSuccess) { return 0; }
|
||||
|
||||
UNIMPLEMENTED -->(L, get_character(m));
|
||||
smlua_push_object(L, LOT_CHARACTER, get_character(m));
|
||||
|
||||
return 1;
|
||||
}
|
||||
*/
|
||||
|
||||
int smlua_func_get_character_anim_offset(lua_State* L) {
|
||||
if(!smlua_functions_valid_param_count(L, 1)) { return 0; }
|
||||
|
@ -825,7 +823,6 @@ int smlua_func_play_sound_if_no_flag(lua_State* L) {
|
|||
return 1;
|
||||
}
|
||||
|
||||
/*
|
||||
int smlua_func_resolve_and_return_wall_collisions(lua_State* L) {
|
||||
if(!smlua_functions_valid_param_count(L, 3)) { return 0; }
|
||||
|
||||
|
@ -842,7 +839,7 @@ int smlua_func_resolve_and_return_wall_collisions(lua_State* L) {
|
|||
f32 radius = smlua_to_number(L, 3);
|
||||
if (!gSmLuaConvertSuccess) { return 0; }
|
||||
|
||||
UNIMPLEMENTED -->(L, resolve_and_return_wall_collisions(pos, offset, radius));
|
||||
smlua_push_object(L, LOT_SURFACE, resolve_and_return_wall_collisions(pos, offset, radius));
|
||||
|
||||
smlua_push_number_field(1, "x", pos[0]);
|
||||
smlua_push_number_field(1, "y", pos[1]);
|
||||
|
@ -850,7 +847,6 @@ int smlua_func_resolve_and_return_wall_collisions(lua_State* L) {
|
|||
|
||||
return 1;
|
||||
}
|
||||
*/
|
||||
|
||||
int smlua_func_return_mario_anim_y_translation(lua_State* L) {
|
||||
if(!smlua_functions_valid_param_count(L, 1)) { return 0; }
|
||||
|
@ -1677,7 +1673,7 @@ int smlua_func_spawn_obj_at_mario_rel_yaw(lua_State* L) {
|
|||
if (!gSmLuaConvertSuccess) { return 0; }
|
||||
|
||||
extern struct Object *spawn_obj_at_mario_rel_yaw(struct MarioState *m, s32 model, const BehaviorScript *behavior, s16 relYaw);
|
||||
UNIMPLEMENTED -->(L, spawn_obj_at_mario_rel_yaw(m, model, behavior, relYaw));
|
||||
smlua_push_object(L, LOT_OBJECT, spawn_obj_at_mario_rel_yaw(m, model, behavior, relYaw));
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
@ -2912,7 +2908,7 @@ void smlua_bind_functions_autogen(void) {
|
|||
smlua_bind_function(L, "set_environmental_camera_shake", smlua_func_set_environmental_camera_shake);
|
||||
|
||||
// characters.h
|
||||
//smlua_bind_function(L, "get_character", smlua_func_get_character); <--- UNIMPLEMENTED
|
||||
smlua_bind_function(L, "get_character", smlua_func_get_character);
|
||||
smlua_bind_function(L, "get_character_anim_offset", smlua_func_get_character_anim_offset);
|
||||
smlua_bind_function(L, "play_character_sound", smlua_func_play_character_sound);
|
||||
smlua_bind_function(L, "play_character_sound_if_no_flag", smlua_func_play_character_sound_if_no_flag);
|
||||
|
@ -2974,7 +2970,7 @@ void smlua_bind_functions_autogen(void) {
|
|||
smlua_bind_function(L, "play_mario_sound", smlua_func_play_mario_sound);
|
||||
smlua_bind_function(L, "play_sound_and_spawn_particles", smlua_func_play_sound_and_spawn_particles);
|
||||
smlua_bind_function(L, "play_sound_if_no_flag", smlua_func_play_sound_if_no_flag);
|
||||
//smlua_bind_function(L, "resolve_and_return_wall_collisions", smlua_func_resolve_and_return_wall_collisions); <--- UNIMPLEMENTED
|
||||
smlua_bind_function(L, "resolve_and_return_wall_collisions", smlua_func_resolve_and_return_wall_collisions);
|
||||
smlua_bind_function(L, "return_mario_anim_y_translation", smlua_func_return_mario_anim_y_translation);
|
||||
smlua_bind_function(L, "set_anim_to_frame", smlua_func_set_anim_to_frame);
|
||||
smlua_bind_function(L, "set_jump_from_landing", smlua_func_set_jump_from_landing);
|
||||
|
|
Loading…
Reference in New Issue