mirror of
https://github.com/coop-deluxe/sm64coopdx.git
synced 2024-11-25 05:25:14 +00:00
Merge branch 'unstable' of github.com:sm64ex-coop-dev/sm64ex-coop into unstable-dev
This commit is contained in:
commit
bac0879ee7
6 changed files with 90 additions and 0 deletions
|
@ -618,6 +618,7 @@
|
|||
- [obj_get_next_with_same_behavior_id](#obj_get_next_with_same_behavior_id)
|
||||
- [obj_get_next_with_same_behavior_id_and_field_f32](#obj_get_next_with_same_behavior_id_and_field_f32)
|
||||
- [obj_get_next_with_same_behavior_id_and_field_s32](#obj_get_next_with_same_behavior_id_and_field_s32)
|
||||
- [obj_set_model_extended](#obj_set_model_extended)
|
||||
- [spawn_sync_object](#spawn_sync_object)
|
||||
|
||||
<br />
|
||||
|
@ -644,6 +645,7 @@
|
|||
<br />
|
||||
|
||||
- surface_collision.h
|
||||
- [find_ceil_height](#find_ceil_height)
|
||||
- [find_floor_height](#find_floor_height)
|
||||
- [find_poison_gas_level](#find_poison_gas_level)
|
||||
- [find_wall_collisions](#find_wall_collisions)
|
||||
|
@ -11465,6 +11467,27 @@
|
|||
|
||||
<br />
|
||||
|
||||
## [obj_set_model_extended](#obj_set_model_extended)
|
||||
|
||||
### Lua Example
|
||||
`obj_set_model_extended(o, modelId)`
|
||||
|
||||
### Parameters
|
||||
| Field | Type |
|
||||
| ----- | ---- |
|
||||
| o | [Object](structs.md#Object) |
|
||||
| modelId | integer |
|
||||
|
||||
### Returns
|
||||
- None
|
||||
|
||||
### C Prototype
|
||||
`void obj_set_model_extended(struct Object *o, enum ModelExtendedId modelId);`
|
||||
|
||||
[:arrow_up_small:](#)
|
||||
|
||||
<br />
|
||||
|
||||
## [spawn_sync_object](#spawn_sync_object)
|
||||
|
||||
### Lua Example
|
||||
|
@ -11826,6 +11849,28 @@
|
|||
<br />
|
||||
|
||||
|
||||
## [find_ceil_height](#find_ceil_height)
|
||||
|
||||
### Lua Example
|
||||
`local numberValue = find_ceil_height(x, y, z)`
|
||||
|
||||
### Parameters
|
||||
| Field | Type |
|
||||
| ----- | ---- |
|
||||
| x | number |
|
||||
| y | number |
|
||||
| z | number |
|
||||
|
||||
### Returns
|
||||
- number
|
||||
|
||||
### C Prototype
|
||||
`f32 find_ceil_height(f32 x, f32 y, f32 z);`
|
||||
|
||||
[:arrow_up_small:](#)
|
||||
|
||||
<br />
|
||||
|
||||
## [find_floor_height](#find_floor_height)
|
||||
|
||||
### Lua Example
|
||||
|
|
|
@ -358,6 +358,14 @@ f32 find_ceil(f32 posX, f32 posY, f32 posZ, struct Surface **pceil) {
|
|||
return height;
|
||||
}
|
||||
|
||||
f32 find_ceil_height(f32 x, f32 y, f32 z) {
|
||||
struct Surface *ceil;
|
||||
|
||||
f32 ceilHeight = find_ceil(x, y, z, &ceil);
|
||||
|
||||
return ceilHeight;
|
||||
}
|
||||
|
||||
/**************************************************
|
||||
* FLOORS *
|
||||
**************************************************/
|
||||
|
|
|
@ -33,6 +33,7 @@ struct FloorGeometry
|
|||
s32 f32_find_wall_collision(f32 *xPtr, f32 *yPtr, f32 *zPtr, f32 offsetY, f32 radius);
|
||||
s32 find_wall_collisions(struct WallCollisionData *colData);
|
||||
f32 find_ceil(f32 posX, f32 posY, f32 posZ, struct Surface **pceil);
|
||||
f32 find_ceil_height(f32 x, f32 y, f32 z);
|
||||
f32 find_floor_height_and_data(f32 xPos, f32 yPos, f32 zPos, struct FloorGeometry **floorGeo);
|
||||
f32 find_floor_height(f32 x, f32 y, f32 z);
|
||||
f32 find_floor(f32 xPos, f32 yPos, f32 zPos, struct Surface **pfloor);
|
||||
|
|
|
@ -7371,6 +7371,19 @@ int smlua_func_obj_get_next_with_same_behavior_id_and_field_s32(lua_State* L) {
|
|||
return 1;
|
||||
}
|
||||
|
||||
int smlua_func_obj_set_model_extended(lua_State* L) {
|
||||
if(!smlua_functions_valid_param_count(L, 2)) { return 0; }
|
||||
|
||||
struct Object* o = (struct Object*)smlua_to_cobject(L, 1, LOT_OBJECT);
|
||||
if (!gSmLuaConvertSuccess) { return 0; }
|
||||
int modelId = smlua_to_integer(L, 2);
|
||||
if (!gSmLuaConvertSuccess) { return 0; }
|
||||
|
||||
obj_set_model_extended(o, modelId);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
int smlua_func_spawn_sync_object(lua_State* L) {
|
||||
if(!smlua_functions_valid_param_count(L, 6)) { return 0; }
|
||||
|
||||
|
@ -7592,6 +7605,21 @@ int smlua_func_find_ceil(lua_State* L) {
|
|||
}
|
||||
*/
|
||||
|
||||
int smlua_func_find_ceil_height(lua_State* L) {
|
||||
if(!smlua_functions_valid_param_count(L, 3)) { return 0; }
|
||||
|
||||
f32 x = smlua_to_number(L, 1);
|
||||
if (!gSmLuaConvertSuccess) { return 0; }
|
||||
f32 y = smlua_to_number(L, 2);
|
||||
if (!gSmLuaConvertSuccess) { return 0; }
|
||||
f32 z = smlua_to_number(L, 3);
|
||||
if (!gSmLuaConvertSuccess) { return 0; }
|
||||
|
||||
lua_pushnumber(L, find_ceil_height(x, y, z));
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
/*
|
||||
int smlua_func_find_floor(lua_State* L) {
|
||||
if(!smlua_functions_valid_param_count(L, 4)) { return 0; }
|
||||
|
@ -8372,6 +8400,7 @@ void smlua_bind_functions_autogen(void) {
|
|||
smlua_bind_function(L, "obj_get_next_with_same_behavior_id", smlua_func_obj_get_next_with_same_behavior_id);
|
||||
smlua_bind_function(L, "obj_get_next_with_same_behavior_id_and_field_f32", smlua_func_obj_get_next_with_same_behavior_id_and_field_f32);
|
||||
smlua_bind_function(L, "obj_get_next_with_same_behavior_id_and_field_s32", smlua_func_obj_get_next_with_same_behavior_id_and_field_s32);
|
||||
smlua_bind_function(L, "obj_set_model_extended", smlua_func_obj_set_model_extended);
|
||||
smlua_bind_function(L, "spawn_sync_object", smlua_func_spawn_sync_object);
|
||||
|
||||
// sound_init.h
|
||||
|
@ -8395,6 +8424,7 @@ void smlua_bind_functions_autogen(void) {
|
|||
|
||||
// surface_collision.h
|
||||
//smlua_bind_function(L, "find_ceil", smlua_func_find_ceil); <--- UNIMPLEMENTED
|
||||
smlua_bind_function(L, "find_ceil_height", smlua_func_find_ceil_height);
|
||||
//smlua_bind_function(L, "find_floor", smlua_func_find_floor); <--- UNIMPLEMENTED
|
||||
smlua_bind_function(L, "find_floor_height", smlua_func_find_floor_height);
|
||||
//smlua_bind_function(L, "find_floor_height_and_data", smlua_func_find_floor_height_and_data); <--- UNIMPLEMENTED
|
||||
|
|
|
@ -78,6 +78,10 @@ struct Object* spawn_non_sync_object(enum BehaviorId behaviorId, enum ModelExten
|
|||
spawn_object_internal(behaviorId, modelId, x, y, z, 0, false);
|
||||
}
|
||||
|
||||
void obj_set_model_extended(struct Object *o, enum ModelExtendedId modelId) {
|
||||
o->header.gfx.sharedChild = gLoadedGraphNodes[smlua_model_util_load(modelId)];
|
||||
}
|
||||
|
||||
//
|
||||
// Helpers to iterate through the object table
|
||||
//
|
||||
|
|
|
@ -10,6 +10,8 @@ struct Object* spawn_sync_object(enum BehaviorId behaviorId, enum ModelExtendedI
|
|||
// this is too dangerous for now
|
||||
//struct Object* spawn_non_sync_object(enum BehaviorId behaviorId, enum ModelExtendedId modelId, f32 x, f32 y, f32 z);
|
||||
|
||||
void obj_set_model_extended(struct Object *o, enum ModelExtendedId modelId);
|
||||
|
||||
//
|
||||
// Helpers to iterate through the object table
|
||||
//
|
||||
|
|
Loading…
Reference in a new issue