mirror of
https://github.com/coop-deluxe/sm64coopdx.git
synced 2024-11-22 12:05:11 +00:00
Added get_temp_object_hitbox() to Lua API
This commit is contained in:
parent
24df92fa48
commit
5544be21a3
4 changed files with 40 additions and 3 deletions
|
@ -634,6 +634,7 @@
|
|||
<br />
|
||||
|
||||
- smlua_obj_utils.h
|
||||
- [get_temp_object_hitbox](#get_temp_object_hitbox)
|
||||
- [obj_get_first](#obj_get_first)
|
||||
- [obj_get_first_with_behavior_id](#obj_get_first_with_behavior_id)
|
||||
- [obj_get_first_with_behavior_id_and_field_f32](#obj_get_first_with_behavior_id_and_field_f32)
|
||||
|
@ -11589,6 +11590,24 @@ The `reliable` field will ensure that the packet arrives, but should be used spa
|
|||
<br />
|
||||
|
||||
|
||||
## [get_temp_object_hitbox](#get_temp_object_hitbox)
|
||||
|
||||
### Lua Example
|
||||
`local ObjectHitboxValue = get_temp_object_hitbox()`
|
||||
|
||||
### Parameters
|
||||
- None
|
||||
|
||||
### Returns
|
||||
[ObjectHitbox](structs.md#ObjectHitbox)
|
||||
|
||||
### C Prototype
|
||||
`struct ObjectHitbox* get_temp_object_hitbox(void);`
|
||||
|
||||
[:arrow_up_small:](#)
|
||||
|
||||
<br />
|
||||
|
||||
## [obj_get_first](#obj_get_first)
|
||||
|
||||
### Lua Example
|
||||
|
|
|
@ -7372,6 +7372,15 @@ int smlua_func_warp_to_level(lua_State* L) {
|
|||
// smlua_obj_utils.h //
|
||||
///////////////////////
|
||||
|
||||
int smlua_func_get_temp_object_hitbox(UNUSED lua_State* L) {
|
||||
if(!smlua_functions_valid_param_count(L, 0)) { return 0; }
|
||||
|
||||
|
||||
smlua_push_object(L, LOT_OBJECTHITBOX, get_temp_object_hitbox());
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
int smlua_func_obj_get_first(lua_State* L) {
|
||||
if(!smlua_functions_valid_param_count(L, 1)) { return 0; }
|
||||
|
||||
|
@ -8690,6 +8699,7 @@ void smlua_bind_functions_autogen(void) {
|
|||
smlua_bind_function(L, "warp_to_level", smlua_func_warp_to_level);
|
||||
|
||||
// smlua_obj_utils.h
|
||||
smlua_bind_function(L, "get_temp_object_hitbox", smlua_func_get_temp_object_hitbox);
|
||||
smlua_bind_function(L, "obj_get_first", smlua_func_obj_get_first);
|
||||
smlua_bind_function(L, "obj_get_first_with_behavior_id", smlua_func_obj_get_first_with_behavior_id);
|
||||
smlua_bind_function(L, "obj_get_first_with_behavior_id_and_field_f32", smlua_func_obj_get_first_with_behavior_id_and_field_f32);
|
||||
|
|
|
@ -195,14 +195,21 @@ struct Object *obj_get_next_with_same_behavior_id_and_field_f32(struct Object *o
|
|||
}
|
||||
|
||||
struct SpawnParticlesInfo* obj_get_temp_spawn_particles_info(enum ModelExtendedId modelId) {
|
||||
static struct SpawnParticlesInfo spi = { 0 };
|
||||
static struct SpawnParticlesInfo sTmpSpi = { 0 };
|
||||
memset(&sTmpSpi, 0, sizeof(struct SpawnParticlesInfo));
|
||||
|
||||
u8 loadedModelId = smlua_model_util_load(modelId);
|
||||
if (loadedModelId == 0xFF) {
|
||||
LOG_ERROR("failed to load model %u", modelId);
|
||||
return NULL;
|
||||
}
|
||||
spi.model = loadedModelId;
|
||||
sTmpSpi.model = loadedModelId;
|
||||
|
||||
return &spi;
|
||||
return &sTmpSpi;
|
||||
}
|
||||
|
||||
struct ObjectHitbox* get_temp_object_hitbox(void) {
|
||||
static struct ObjectHitbox sTmpHitbox = { 0 };
|
||||
memset(&sTmpHitbox, 0, sizeof(struct ObjectHitbox));
|
||||
return &sTmpHitbox;
|
||||
}
|
||||
|
|
|
@ -29,5 +29,6 @@ struct Object *obj_get_next_with_same_behavior_id_and_field_f32(struct Object *o
|
|||
// misc obj helpers
|
||||
|
||||
struct SpawnParticlesInfo* obj_get_temp_spawn_particles_info(enum ModelExtendedId modelId);
|
||||
struct ObjectHitbox* get_temp_object_hitbox(void);
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in a new issue