sm64coopdx/docs/lua/functions-5.md
2023-04-01 00:04:45 -07:00

1502 lines
25 KiB
Markdown

## [:rewind: Lua Functions](functions.md)
---
[< prev](functions-4.md) | [1](functions.md) | [2](functions-2.md) | [3](functions-3.md) | [4](functions-4.md) | 5]
---
# functions from smlua_obj_utils.h
<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 />
## [get_trajectory](#get_trajectory)
### Lua Example
`local PointerValue = get_trajectory(name)`
### Parameters
| Field | Type |
| ----- | ---- |
| name | `string` |
### Returns
- `Pointer` <`Trajectory`>
### C Prototype
`Trajectory* get_trajectory(const char* name);`
[:arrow_up_small:](#)
<br />
## [obj_check_hitbox_overlap](#obj_check_hitbox_overlap)
### Lua Example
`local booleanValue = obj_check_hitbox_overlap(o1, o2)`
### Parameters
| Field | Type |
| ----- | ---- |
| o1 | [Object](structs.md#Object) |
| o2 | [Object](structs.md#Object) |
### Returns
- `boolean`
### C Prototype
`bool obj_check_hitbox_overlap(struct Object *o1, struct Object *o2);`
[:arrow_up_small:](#)
<br />
## [obj_check_overlap_with_hitbox_params](#obj_check_overlap_with_hitbox_params)
### Lua Example
`local booleanValue = obj_check_overlap_with_hitbox_params(o, x, y, z, h, r, d)`
### Parameters
| Field | Type |
| ----- | ---- |
| o | [Object](structs.md#Object) |
| x | `number` |
| y | `number` |
| z | `number` |
| h | `number` |
| r | `number` |
| d | `number` |
### Returns
- `boolean`
### C Prototype
`bool obj_check_overlap_with_hitbox_params(struct Object *o, f32 x, f32 y, f32 z, f32 h, f32 r, f32 d);`
[:arrow_up_small:](#)
<br />
## [obj_count_objects_with_behavior_id](#obj_count_objects_with_behavior_id)
### Lua Example
`local integerValue = obj_count_objects_with_behavior_id(behaviorId)`
### Parameters
| Field | Type |
| ----- | ---- |
| behaviorId | [enum BehaviorId](constants.md#enum-BehaviorId) |
### Returns
- `integer`
### C Prototype
`s32 obj_count_objects_with_behavior_id(enum BehaviorId behaviorId);`
[:arrow_up_small:](#)
<br />
## [obj_get_first](#obj_get_first)
### Lua Example
`local ObjectValue = obj_get_first(objList)`
### Parameters
| Field | Type |
| ----- | ---- |
| objList | [enum ObjectList](constants.md#enum-ObjectList) |
### Returns
[Object](structs.md#Object)
### C Prototype
`struct Object *obj_get_first(enum ObjectList objList);`
[:arrow_up_small:](#)
<br />
## [obj_get_first_with_behavior_id](#obj_get_first_with_behavior_id)
### Lua Example
`local ObjectValue = obj_get_first_with_behavior_id(behaviorId)`
### Parameters
| Field | Type |
| ----- | ---- |
| behaviorId | [enum BehaviorId](constants.md#enum-BehaviorId) |
### Returns
[Object](structs.md#Object)
### C Prototype
`struct Object *obj_get_first_with_behavior_id(enum BehaviorId behaviorId);`
[:arrow_up_small:](#)
<br />
## [obj_get_first_with_behavior_id_and_field_f32](#obj_get_first_with_behavior_id_and_field_f32)
### Lua Example
`local ObjectValue = obj_get_first_with_behavior_id_and_field_f32(behaviorId, fieldIndex, value)`
### Parameters
| Field | Type |
| ----- | ---- |
| behaviorId | [enum BehaviorId](constants.md#enum-BehaviorId) |
| fieldIndex | `integer` |
| value | `number` |
### Returns
[Object](structs.md#Object)
### C Prototype
`struct Object *obj_get_first_with_behavior_id_and_field_f32(enum BehaviorId behaviorId, s32 fieldIndex, f32 value);`
[:arrow_up_small:](#)
<br />
## [obj_get_first_with_behavior_id_and_field_s32](#obj_get_first_with_behavior_id_and_field_s32)
### Lua Example
`local ObjectValue = obj_get_first_with_behavior_id_and_field_s32(behaviorId, fieldIndex, value)`
### Parameters
| Field | Type |
| ----- | ---- |
| behaviorId | [enum BehaviorId](constants.md#enum-BehaviorId) |
| fieldIndex | `integer` |
| value | `integer` |
### Returns
[Object](structs.md#Object)
### C Prototype
`struct Object *obj_get_first_with_behavior_id_and_field_s32(enum BehaviorId behaviorId, s32 fieldIndex, s32 value);`
[:arrow_up_small:](#)
<br />
## [obj_get_nearest_object_with_behavior_id](#obj_get_nearest_object_with_behavior_id)
### Lua Example
`local ObjectValue = obj_get_nearest_object_with_behavior_id(o, behaviorId)`
### Parameters
| Field | Type |
| ----- | ---- |
| o | [Object](structs.md#Object) |
| behaviorId | [enum BehaviorId](constants.md#enum-BehaviorId) |
### Returns
[Object](structs.md#Object)
### C Prototype
`struct Object *obj_get_nearest_object_with_behavior_id(struct Object *o, enum BehaviorId behaviorId);`
[:arrow_up_small:](#)
<br />
## [obj_get_next](#obj_get_next)
### Lua Example
`local ObjectValue = obj_get_next(o)`
### Parameters
| Field | Type |
| ----- | ---- |
| o | [Object](structs.md#Object) |
### Returns
[Object](structs.md#Object)
### C Prototype
`struct Object *obj_get_next(struct Object *o);`
[:arrow_up_small:](#)
<br />
## [obj_get_next_with_same_behavior_id](#obj_get_next_with_same_behavior_id)
### Lua Example
`local ObjectValue = obj_get_next_with_same_behavior_id(o)`
### Parameters
| Field | Type |
| ----- | ---- |
| o | [Object](structs.md#Object) |
### Returns
[Object](structs.md#Object)
### C Prototype
`struct Object *obj_get_next_with_same_behavior_id(struct Object *o);`
[:arrow_up_small:](#)
<br />
## [obj_get_next_with_same_behavior_id_and_field_f32](#obj_get_next_with_same_behavior_id_and_field_f32)
### Lua Example
`local ObjectValue = obj_get_next_with_same_behavior_id_and_field_f32(o, fieldIndex, value)`
### Parameters
| Field | Type |
| ----- | ---- |
| o | [Object](structs.md#Object) |
| fieldIndex | `integer` |
| value | `number` |
### Returns
[Object](structs.md#Object)
### C Prototype
`struct Object *obj_get_next_with_same_behavior_id_and_field_f32(struct Object *o, s32 fieldIndex, f32 value);`
[:arrow_up_small:](#)
<br />
## [obj_get_next_with_same_behavior_id_and_field_s32](#obj_get_next_with_same_behavior_id_and_field_s32)
### Lua Example
`local ObjectValue = obj_get_next_with_same_behavior_id_and_field_s32(o, fieldIndex, value)`
### Parameters
| Field | Type |
| ----- | ---- |
| o | [Object](structs.md#Object) |
| fieldIndex | `integer` |
| value | `integer` |
### Returns
[Object](structs.md#Object)
### C Prototype
`struct Object *obj_get_next_with_same_behavior_id_and_field_s32(struct Object *o, s32 fieldIndex, s32 value);`
[:arrow_up_small:](#)
<br />
## [obj_get_temp_spawn_particles_info](#obj_get_temp_spawn_particles_info)
### Lua Example
`local SpawnParticlesInfoValue = obj_get_temp_spawn_particles_info(modelId)`
### Parameters
| Field | Type |
| ----- | ---- |
| modelId | [enum ModelExtendedId](constants.md#enum-ModelExtendedId) |
### Returns
[SpawnParticlesInfo](structs.md#SpawnParticlesInfo)
### C Prototype
`struct SpawnParticlesInfo* obj_get_temp_spawn_particles_info(enum ModelExtendedId modelId);`
[:arrow_up_small:](#)
<br />
## [obj_has_behavior_id](#obj_has_behavior_id)
### Lua Example
`local integerValue = obj_has_behavior_id(o, behaviorId)`
### Parameters
| Field | Type |
| ----- | ---- |
| o | [Object](structs.md#Object) |
| behaviorId | [enum BehaviorId](constants.md#enum-BehaviorId) |
### Returns
- `integer`
### C Prototype
`s32 obj_has_behavior_id(struct Object *o, enum BehaviorId behaviorId);`
[:arrow_up_small:](#)
<br />
## [obj_has_model_extended](#obj_has_model_extended)
### Lua Example
`local integerValue = obj_has_model_extended(o, modelId)`
### Parameters
| Field | Type |
| ----- | ---- |
| o | [Object](structs.md#Object) |
| modelId | [enum ModelExtendedId](constants.md#enum-ModelExtendedId) |
### Returns
- `integer`
### C Prototype
`s32 obj_has_model_extended(struct Object *o, enum ModelExtendedId modelId);`
[:arrow_up_small:](#)
<br />
## [obj_is_attackable](#obj_is_attackable)
### Lua Example
`local booleanValue = obj_is_attackable(o)`
### Parameters
| Field | Type |
| ----- | ---- |
| o | [Object](structs.md#Object) |
### Returns
- `boolean`
### C Prototype
`bool obj_is_attackable(struct Object *o);`
[:arrow_up_small:](#)
<br />
## [obj_is_breakable_object](#obj_is_breakable_object)
### Lua Example
`local booleanValue = obj_is_breakable_object(o)`
### Parameters
| Field | Type |
| ----- | ---- |
| o | [Object](structs.md#Object) |
### Returns
- `boolean`
### C Prototype
`bool obj_is_breakable_object(struct Object *o);`
[:arrow_up_small:](#)
<br />
## [obj_is_bully](#obj_is_bully)
### Lua Example
`local booleanValue = obj_is_bully(o)`
### Parameters
| Field | Type |
| ----- | ---- |
| o | [Object](structs.md#Object) |
### Returns
- `boolean`
### C Prototype
`bool obj_is_bully(struct Object *o);`
[:arrow_up_small:](#)
<br />
## [obj_is_coin](#obj_is_coin)
### Lua Example
`local booleanValue = obj_is_coin(o)`
### Parameters
| Field | Type |
| ----- | ---- |
| o | [Object](structs.md#Object) |
### Returns
- `boolean`
### C Prototype
`bool obj_is_coin(struct Object *o);`
[:arrow_up_small:](#)
<br />
## [obj_is_exclamation_box](#obj_is_exclamation_box)
### Lua Example
`local booleanValue = obj_is_exclamation_box(o)`
### Parameters
| Field | Type |
| ----- | ---- |
| o | [Object](structs.md#Object) |
### Returns
- `boolean`
### C Prototype
`bool obj_is_exclamation_box(struct Object *o);`
[:arrow_up_small:](#)
<br />
## [obj_is_grabbable](#obj_is_grabbable)
### Lua Example
`local booleanValue = obj_is_grabbable(o)`
### Parameters
| Field | Type |
| ----- | ---- |
| o | [Object](structs.md#Object) |
### Returns
- `boolean`
### C Prototype
`bool obj_is_grabbable(struct Object *o) ;`
[:arrow_up_small:](#)
<br />
## [obj_is_mushroom_1up](#obj_is_mushroom_1up)
### Lua Example
`local booleanValue = obj_is_mushroom_1up(o)`
### Parameters
| Field | Type |
| ----- | ---- |
| o | [Object](structs.md#Object) |
### Returns
- `boolean`
### C Prototype
`bool obj_is_mushroom_1up(struct Object *o);`
[:arrow_up_small:](#)
<br />
## [obj_is_secret](#obj_is_secret)
### Lua Example
`local booleanValue = obj_is_secret(o)`
### Parameters
| Field | Type |
| ----- | ---- |
| o | [Object](structs.md#Object) |
### Returns
- `boolean`
### C Prototype
`bool obj_is_secret(struct Object *o);`
[:arrow_up_small:](#)
<br />
## [obj_is_valid_for_interaction](#obj_is_valid_for_interaction)
### Lua Example
`local booleanValue = obj_is_valid_for_interaction(o)`
### Parameters
| Field | Type |
| ----- | ---- |
| o | [Object](structs.md#Object) |
### Returns
- `boolean`
### C Prototype
`bool obj_is_valid_for_interaction(struct Object *o);`
[:arrow_up_small:](#)
<br />
## [obj_move_xyz](#obj_move_xyz)
### Lua Example
`obj_move_xyz(o, dx, dy, dz)`
### Parameters
| Field | Type |
| ----- | ---- |
| o | [Object](structs.md#Object) |
| dx | `number` |
| dy | `number` |
| dz | `number` |
### Returns
- None
### C Prototype
`void obj_move_xyz(struct Object *o, f32 dx, f32 dy, f32 dz);`
[:arrow_up_small:](#)
<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 | [enum ModelExtendedId](constants.md#enum-ModelExtendedId) |
### Returns
- None
### C Prototype
`void obj_set_model_extended(struct Object *o, enum ModelExtendedId modelId);`
[:arrow_up_small:](#)
<br />
## [obj_set_vel](#obj_set_vel)
### Lua Example
`obj_set_vel(o, vx, vy, vz)`
### Parameters
| Field | Type |
| ----- | ---- |
| o | [Object](structs.md#Object) |
| vx | `number` |
| vy | `number` |
| vz | `number` |
### Returns
- None
### C Prototype
`void obj_set_vel(struct Object *o, f32 vx, f32 vy, f32 vz);`
[:arrow_up_small:](#)
<br />
## [set_whirlpools](#set_whirlpools)
### Lua Example
`set_whirlpools(x, y, z, strength, area, index)`
### Parameters
| Field | Type |
| ----- | ---- |
| x | `number` |
| y | `number` |
| z | `number` |
| strength | `integer` |
| area | `integer` |
| index | `integer` |
### Returns
- None
### C Prototype
`void set_whirlpools(f32 x, f32 y, f32 z, s16 strength, s16 area, s32 index);`
[:arrow_up_small:](#)
<br />
## [spawn_non_sync_object](#spawn_non_sync_object)
### Lua Example
`local ObjectValue = spawn_non_sync_object(behaviorId, modelId, x, y, z, objSetupFunction)`
### Parameters
| Field | Type |
| ----- | ---- |
| behaviorId | [enum BehaviorId](constants.md#enum-BehaviorId) |
| modelId | [enum ModelExtendedId](constants.md#enum-ModelExtendedId) |
| x | `number` |
| y | `number` |
| z | `number` |
| objSetupFunction | `Lua Function` () |
### Returns
[Object](structs.md#Object)
### C Prototype
`struct Object* spawn_non_sync_object(enum BehaviorId behaviorId, enum ModelExtendedId modelId, f32 x, f32 y, f32 z, LuaFunction objSetupFunction);`
[:arrow_up_small:](#)
<br />
## [spawn_sync_object](#spawn_sync_object)
### Lua Example
`local ObjectValue = spawn_sync_object(behaviorId, modelId, x, y, z, objSetupFunction)`
### Parameters
| Field | Type |
| ----- | ---- |
| behaviorId | [enum BehaviorId](constants.md#enum-BehaviorId) |
| modelId | [enum ModelExtendedId](constants.md#enum-ModelExtendedId) |
| x | `number` |
| y | `number` |
| z | `number` |
| objSetupFunction | `Lua Function` () |
### Returns
[Object](structs.md#Object)
### C Prototype
`struct Object* spawn_sync_object(enum BehaviorId behaviorId, enum ModelExtendedId modelId, f32 x, f32 y, f32 z, LuaFunction objSetupFunction);`
[:arrow_up_small:](#)
<br />
---
# functions from smlua_text_utils.h
<br />
## [smlua_text_utils_castle_secret_stars_replace](#smlua_text_utils_castle_secret_stars_replace)
### Lua Example
`smlua_text_utils_castle_secret_stars_replace(name)`
### Parameters
| Field | Type |
| ----- | ---- |
| name | `string` |
### Returns
- None
### C Prototype
`void smlua_text_utils_castle_secret_stars_replace(const char* name);`
[:arrow_up_small:](#)
<br />
## [smlua_text_utils_course_acts_replace](#smlua_text_utils_course_acts_replace)
### Lua Example
`smlua_text_utils_course_acts_replace(courseNum, courseName, act1, act2, act3, act4, act5, act6)`
### Parameters
| Field | Type |
| ----- | ---- |
| courseNum | `integer` |
| courseName | `string` |
| act1 | `string` |
| act2 | `string` |
| act3 | `string` |
| act4 | `string` |
| act5 | `string` |
| act6 | `string` |
### Returns
- None
### C Prototype
`void smlua_text_utils_course_acts_replace(s16 courseNum, const char* courseName, const char* act1, const char* act2, const char* act3, const char* act4, const char* act5, const char* act6);`
[:arrow_up_small:](#)
<br />
## [smlua_text_utils_dialog_replace](#smlua_text_utils_dialog_replace)
### Lua Example
`smlua_text_utils_dialog_replace(dialogId, unused, linesPerBox, leftOffset, width, str)`
### Parameters
| Field | Type |
| ----- | ---- |
| dialogId | [enum DialogId](constants.md#enum-DialogId) |
| unused | `integer` |
| linesPerBox | `integer` |
| leftOffset | `integer` |
| width | `integer` |
| str | `string` |
### Returns
- None
### C Prototype
`void smlua_text_utils_dialog_replace(enum DialogId dialogId, u32 unused, s8 linesPerBox, s16 leftOffset, s16 width, const char* str);`
[:arrow_up_small:](#)
<br />
## [smlua_text_utils_extra_text_replace](#smlua_text_utils_extra_text_replace)
### Lua Example
`smlua_text_utils_extra_text_replace(index, text)`
### Parameters
| Field | Type |
| ----- | ---- |
| index | `integer` |
| text | `string` |
### Returns
- None
### C Prototype
`void smlua_text_utils_extra_text_replace(s16 index, const char* text);`
[:arrow_up_small:](#)
<br />
## [smlua_text_utils_get_language](#smlua_text_utils_get_language)
### Lua Example
`local stringValue = smlua_text_utils_get_language()`
### Parameters
- None
### Returns
- `string`
### C Prototype
`char* smlua_text_utils_get_language(void);`
[:arrow_up_small:](#)
<br />
## [smlua_text_utils_reset_all](#smlua_text_utils_reset_all)
### Lua Example
`smlua_text_utils_reset_all()`
### Parameters
- None
### Returns
- None
### C Prototype
`void smlua_text_utils_reset_all(void);`
[:arrow_up_small:](#)
<br />
## [smlua_text_utils_secret_star_replace](#smlua_text_utils_secret_star_replace)
### Lua Example
`smlua_text_utils_secret_star_replace(courseNum, courseName)`
### Parameters
| Field | Type |
| ----- | ---- |
| courseNum | `integer` |
| courseName | `string` |
### Returns
- None
### C Prototype
`void smlua_text_utils_secret_star_replace(s16 courseNum, const char* courseName);`
[:arrow_up_small:](#)
<br />
---
# functions from sound_init.h
<br />
## [disable_background_sound](#disable_background_sound)
### Lua Example
`disable_background_sound()`
### Parameters
- None
### Returns
- None
### C Prototype
`void disable_background_sound(void);`
[:arrow_up_small:](#)
<br />
## [enable_background_sound](#enable_background_sound)
### Lua Example
`enable_background_sound()`
### Parameters
- None
### Returns
- None
### C Prototype
`void enable_background_sound(void);`
[:arrow_up_small:](#)
<br />
## [fadeout_cap_music](#fadeout_cap_music)
### Lua Example
`fadeout_cap_music()`
### Parameters
- None
### Returns
- None
### C Prototype
`void fadeout_cap_music(void);`
[:arrow_up_small:](#)
<br />
## [fadeout_level_music](#fadeout_level_music)
### Lua Example
`fadeout_level_music(fadeTimer)`
### Parameters
| Field | Type |
| ----- | ---- |
| fadeTimer | `integer` |
### Returns
- None
### C Prototype
`void fadeout_level_music(s16 fadeTimer);`
[:arrow_up_small:](#)
<br />
## [fadeout_music](#fadeout_music)
### Lua Example
`fadeout_music(fadeOutTime)`
### Parameters
| Field | Type |
| ----- | ---- |
| fadeOutTime | `integer` |
### Returns
- None
### C Prototype
`void fadeout_music(s16 fadeOutTime);`
[:arrow_up_small:](#)
<br />
## [lower_background_noise](#lower_background_noise)
### Lua Example
`lower_background_noise(a)`
### Parameters
| Field | Type |
| ----- | ---- |
| a | `integer` |
### Returns
- None
### C Prototype
`void lower_background_noise(s32 a);`
[:arrow_up_small:](#)
<br />
## [play_cap_music](#play_cap_music)
### Lua Example
`play_cap_music(seqArgs)`
### Parameters
| Field | Type |
| ----- | ---- |
| seqArgs | `integer` |
### Returns
- None
### C Prototype
`void play_cap_music(u16 seqArgs);`
[:arrow_up_small:](#)
<br />
## [play_cutscene_music](#play_cutscene_music)
### Lua Example
`play_cutscene_music(seqArgs)`
### Parameters
| Field | Type |
| ----- | ---- |
| seqArgs | `integer` |
### Returns
- None
### C Prototype
`void play_cutscene_music(u16 seqArgs);`
[:arrow_up_small:](#)
<br />
## [play_infinite_stairs_music](#play_infinite_stairs_music)
### Lua Example
`play_infinite_stairs_music()`
### Parameters
- None
### Returns
- None
### C Prototype
`void play_infinite_stairs_music(void);`
[:arrow_up_small:](#)
<br />
## [play_menu_sounds](#play_menu_sounds)
### Lua Example
`play_menu_sounds(soundMenuFlags)`
### Parameters
| Field | Type |
| ----- | ---- |
| soundMenuFlags | `integer` |
### Returns
- None
### C Prototype
`void play_menu_sounds(s16 soundMenuFlags);`
[:arrow_up_small:](#)
<br />
## [play_painting_eject_sound](#play_painting_eject_sound)
### Lua Example
`play_painting_eject_sound()`
### Parameters
- None
### Returns
- None
### C Prototype
`void play_painting_eject_sound(void);`
[:arrow_up_small:](#)
<br />
## [play_shell_music](#play_shell_music)
### Lua Example
`play_shell_music()`
### Parameters
- None
### Returns
- None
### C Prototype
`void play_shell_music(void);`
[:arrow_up_small:](#)
<br />
## [raise_background_noise](#raise_background_noise)
### Lua Example
`raise_background_noise(a)`
### Parameters
| Field | Type |
| ----- | ---- |
| a | `integer` |
### Returns
- None
### C Prototype
`void raise_background_noise(s32 a);`
[:arrow_up_small:](#)
<br />
## [reset_volume](#reset_volume)
### Lua Example
`reset_volume()`
### Parameters
- None
### Returns
- None
### C Prototype
`void reset_volume(void);`
[:arrow_up_small:](#)
<br />
## [set_background_music](#set_background_music)
### Lua Example
`set_background_music(a, seqArgs, fadeTimer)`
### Parameters
| Field | Type |
| ----- | ---- |
| a | `integer` |
| seqArgs | `integer` |
| fadeTimer | `integer` |
### Returns
- None
### C Prototype
`void set_background_music(u16 a, u16 seqArgs, s16 fadeTimer);`
[:arrow_up_small:](#)
<br />
## [stop_cap_music](#stop_cap_music)
### Lua Example
`stop_cap_music()`
### Parameters
- None
### Returns
- None
### C Prototype
`void stop_cap_music(void);`
[:arrow_up_small:](#)
<br />
## [stop_shell_music](#stop_shell_music)
### Lua Example
`stop_shell_music()`
### Parameters
- None
### Returns
- None
### C Prototype
`void stop_shell_music(void);`
[:arrow_up_small:](#)
<br />
---
# functions from spawn_sound.c
<br />
## [calc_dist_to_volume_range_1](#calc_dist_to_volume_range_1)
### Lua Example
`local integerValue = calc_dist_to_volume_range_1(distance)`
### Parameters
| Field | Type |
| ----- | ---- |
| distance | `number` |
### Returns
- `integer`
### C Prototype
`s32 calc_dist_to_volume_range_1(f32 distance);`
[:arrow_up_small:](#)
<br />
## [calc_dist_to_volume_range_2](#calc_dist_to_volume_range_2)
### Lua Example
`local integerValue = calc_dist_to_volume_range_2(distance)`
### Parameters
| Field | Type |
| ----- | ---- |
| distance | `number` |
### Returns
- `integer`
### C Prototype
`s32 calc_dist_to_volume_range_2(f32 distance);`
[:arrow_up_small:](#)
<br />
## [cur_obj_play_sound_1](#cur_obj_play_sound_1)
### Lua Example
`cur_obj_play_sound_1(soundMagic)`
### Parameters
| Field | Type |
| ----- | ---- |
| soundMagic | `integer` |
### Returns
- None
### C Prototype
`void cur_obj_play_sound_1(s32 soundMagic);`
[:arrow_up_small:](#)
<br />
## [cur_obj_play_sound_2](#cur_obj_play_sound_2)
### Lua Example
`cur_obj_play_sound_2(soundMagic)`
### Parameters
| Field | Type |
| ----- | ---- |
| soundMagic | `integer` |
### Returns
- None
### C Prototype
`void cur_obj_play_sound_2(s32 soundMagic);`
[:arrow_up_small:](#)
<br />
## [exec_anim_sound_state](#exec_anim_sound_state)
### Lua Example
`exec_anim_sound_state(soundStates)`
### Parameters
| Field | Type |
| ----- | ---- |
| soundStates | [SoundState](structs.md#SoundState) |
### Returns
- None
### C Prototype
`void exec_anim_sound_state(struct SoundState *soundStates);`
[:arrow_up_small:](#)
<br />
---
# functions from surface_collision.h
<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
`local numberValue = find_floor_height(x, y, z)`
### Parameters
| Field | Type |
| ----- | ---- |
| x | `number` |
| y | `number` |
| z | `number` |
### Returns
- `number`
### C Prototype
`f32 find_floor_height(f32 x, f32 y, f32 z);`
[:arrow_up_small:](#)
<br />
## [find_poison_gas_level](#find_poison_gas_level)
### Lua Example
`local numberValue = find_poison_gas_level(x, z)`
### Parameters
| Field | Type |
| ----- | ---- |
| x | `number` |
| z | `number` |
### Returns
- `number`
### C Prototype
`f32 find_poison_gas_level(f32 x, f32 z);`
[:arrow_up_small:](#)
<br />
## [find_wall_collisions](#find_wall_collisions)
### Lua Example
`local integerValue = find_wall_collisions(colData)`
### Parameters
| Field | Type |
| ----- | ---- |
| colData | [WallCollisionData](structs.md#WallCollisionData) |
### Returns
- `integer`
### C Prototype
`s32 find_wall_collisions(struct WallCollisionData *colData);`
[:arrow_up_small:](#)
<br />
## [find_water_level](#find_water_level)
### Lua Example
`local numberValue = find_water_level(x, z)`
### Parameters
| Field | Type |
| ----- | ---- |
| x | `number` |
| z | `number` |
### Returns
- `number`
### C Prototype
`f32 find_water_level(f32 x, f32 z);`
[:arrow_up_small:](#)
<br />
---
# functions from surface_load.h
<br />
## [alloc_surface_pools](#alloc_surface_pools)
### Lua Example
`alloc_surface_pools()`
### Parameters
- None
### Returns
- None
### C Prototype
`void alloc_surface_pools(void);`
[:arrow_up_small:](#)
<br />
## [clear_dynamic_surfaces](#clear_dynamic_surfaces)
### Lua Example
`clear_dynamic_surfaces()`
### Parameters
- None
### Returns
- None
### C Prototype
`void clear_dynamic_surfaces(void);`
[:arrow_up_small:](#)
<br />
## [get_area_terrain_size](#get_area_terrain_size)
### Lua Example
`local integerValue = get_area_terrain_size(data)`
### Parameters
| Field | Type |
| ----- | ---- |
| data | `Pointer` <`integer`> |
### Returns
- `integer`
### C Prototype
`u32 get_area_terrain_size(s16 *data);`
[:arrow_up_small:](#)
<br />
## [load_area_terrain](#load_area_terrain)
### Lua Example
`load_area_terrain(index, data, surfaceRooms, macroObjects)`
### Parameters
| Field | Type |
| ----- | ---- |
| index | `integer` |
| data | `Pointer` <`integer`> |
| surfaceRooms | `Pointer` <`integer`> |
| macroObjects | `Pointer` <`integer`> |
### Returns
- None
### C Prototype
`void load_area_terrain(s16 index, s16 *data, s8 *surfaceRooms, s16 *macroObjects);`
[:arrow_up_small:](#)
<br />
## [load_object_collision_model](#load_object_collision_model)
### Lua Example
`load_object_collision_model()`
### Parameters
- None
### Returns
- None
### C Prototype
`void load_object_collision_model(void);`
[:arrow_up_small:](#)
<br />
---
[< prev](functions-4.md) | [1](functions.md) | [2](functions-2.md) | [3](functions-3.md) | [4](functions-4.md) | 5]