Document behavior headers (54.07%)

This commit is contained in:
Agent X 2024-12-08 18:12:04 -05:00
parent 79ef7e8e12
commit 66e23c0cbf
5 changed files with 60 additions and 6 deletions

View file

@ -2916,66 +2916,78 @@ function vec3f_copy_2(dest, src)
end
--- @return number
--- Gets the draw distance scalar
function draw_distance_scalar()
-- ...
end
--- @param obj Object
--- Updates an object's graphical position and angle
function obj_update_gfx_pos_and_angle(obj)
-- ...
end
--- @return number
--- Sets the current object's position to random floats between 0.0 and 1.0
function position_based_random_float_position()
-- ...
end
--- @return integer
--- Sets the current object's position to random integers between 0 and 65536
function position_based_random_u16()
-- ...
end
--- @return number
--- Generates a psuedo random float between 0.0 and 1.0
function random_float()
-- ...
end
--- @return integer
--- Returns either 1 or -1 with a psuedo 50:50 chance
function random_sign()
-- ...
end
--- @return integer
--- Generates a psuedo random integer between 0 and 65535
function random_u16()
-- ...
end
--- @param id BehaviorId
--- @return Pointer_BehaviorScript
--- Gets a behavior script from a behavior ID
function get_behavior_from_id(id)
-- ...
end
--- @param id BehaviorId
--- @return string
--- Gets a behavior name from a behavior ID (bhvMyGreatMODCustom004)
function get_behavior_name_from_id(id)
-- ...
end
--- @param behavior Pointer_BehaviorScript
--- @return BehaviorId
--- Gets a behavior ID from a behavior script
function get_id_from_behavior(behavior)
-- ...
end
--- @param name string
--- @return BehaviorId
--- gets a behavior ID from a behavior name
function get_id_from_behavior_name(name)
-- ...
end
--- @param behavior Pointer_BehaviorScript
--- @return BehaviorId
--- Gets a behavior ID from only vanilla behavior scripts
function get_id_from_vanilla_behavior(behavior)
-- ...
end

View file

@ -13,6 +13,9 @@
## [draw_distance_scalar](#draw_distance_scalar)
### Description
Gets the draw distance scalar
### Lua Example
`local numberValue = draw_distance_scalar()`
@ -31,6 +34,9 @@
## [obj_update_gfx_pos_and_angle](#obj_update_gfx_pos_and_angle)
### Description
Updates an object's graphical position and angle
### Lua Example
`obj_update_gfx_pos_and_angle(obj)`
@ -51,6 +57,9 @@
## [position_based_random_float_position](#position_based_random_float_position)
### Description
Sets the current object's position to random floats between 0.0 and 1.0
### Lua Example
`local numberValue = position_based_random_float_position()`
@ -69,6 +78,9 @@
## [position_based_random_u16](#position_based_random_u16)
### Description
Sets the current object's position to random integers between 0 and 65536
### Lua Example
`local integerValue = position_based_random_u16()`
@ -87,6 +99,9 @@
## [random_float](#random_float)
### Description
Generates a psuedo random float between 0.0 and 1.0
### Lua Example
`local numberValue = random_float()`
@ -105,6 +120,9 @@
## [random_sign](#random_sign)
### Description
Returns either 1 or -1 with a psuedo 50:50 chance
### Lua Example
`local integerValue = random_sign()`
@ -123,6 +141,9 @@
## [random_u16](#random_u16)
### Description
Generates a psuedo random integer between 0 and 65535
### Lua Example
`local integerValue = random_u16()`
@ -147,6 +168,9 @@
## [get_behavior_from_id](#get_behavior_from_id)
### Description
Gets a behavior script from a behavior ID
### Lua Example
`local PointerValue = get_behavior_from_id(id)`
@ -167,6 +191,9 @@
## [get_behavior_name_from_id](#get_behavior_name_from_id)
### Description
Gets a behavior name from a behavior ID (bhvMyGreatMODCustom004)
### Lua Example
`local stringValue = get_behavior_name_from_id(id)`
@ -187,6 +214,9 @@
## [get_id_from_behavior](#get_id_from_behavior)
### Description
Gets a behavior ID from a behavior script
### Lua Example
`local enumValue = get_id_from_behavior(behavior)`
@ -207,6 +237,9 @@
## [get_id_from_behavior_name](#get_id_from_behavior_name)
### Description
gets a behavior ID from a behavior name
### Lua Example
`local enumValue = get_id_from_behavior_name(name)`
@ -227,6 +260,9 @@
## [get_id_from_vanilla_behavior](#get_id_from_vanilla_behavior)
### Description
Gets a behavior ID from only vanilla behavior scripts
### Lua Example
`local enumValue = get_id_from_vanilla_behavior(behavior)`

View file

@ -547,10 +547,15 @@ enum BehaviorId {
id_bhv_max_count // must be the last in the list
};
/* |description|Gets a behavior ID from a behavior script|descriptionEnd| */
enum BehaviorId get_id_from_behavior(const BehaviorScript* behavior);
/* |description|Gets a behavior ID from only vanilla behavior scripts|descriptionEnd| */
enum BehaviorId get_id_from_vanilla_behavior(const BehaviorScript* behavior);
/* |description|Gets a behavior script from a behavior ID|descriptionEnd| */
const BehaviorScript* get_behavior_from_id(enum BehaviorId id);
/* |description|Gets a behavior name from a behavior ID (bhvMyGreatMODCustom004)|descriptionEnd| */
const char* get_behavior_name_from_id(enum BehaviorId id);
/* |description|gets a behavior ID from a behavior name|descriptionEnd| */
enum BehaviorId get_id_from_behavior_name(const char* name);
#endif

View file

@ -19,18 +19,25 @@
#define obj_and_int(object, offset, value) object->OBJECT_FIELD_S32(offset) &= (s32)(value)
/* |description|Generates a psuedo random integer between 0 and 65535|descriptionEnd| */
u16 random_u16(void);
/* |description|Generates a psuedo random float between 0.0 and 1.0|descriptionEnd| */
float random_float(void);
/* |description|Returns either 1 or -1 with a psuedo 50:50 chance|descriptionEnd| */
s32 random_sign(void);
void stub_behavior_script_2(void);
void cur_obj_update(void);
/* |description|Updates an object's graphical position and angle|descriptionEnd| */
void obj_update_gfx_pos_and_angle(struct Object *obj);
/* |description|Sets the current object's position to random integers between 0 and 65536|descriptionEnd| */
u16 position_based_random_u16(void);
/* |description|Sets the current object's position to random floats between 0.0 and 1.0|descriptionEnd| */
f32 position_based_random_float_position(void);
/* |description|Gets the draw distance scalar|descriptionEnd| */
f32 draw_distance_scalar(void);
#endif // BEHAVIOR_SCRIPT_H

View file

@ -588,9 +588,6 @@ void spawn_objects_from_info(UNUSED s32 unused, struct SpawnInfo *spawnInfo) {
}
}
void stub_obj_list_processor_1(void) {
}
/**
* Clear objects, dynamic surfaces, and some miscellaneous level data used by objects.
*/
@ -619,9 +616,6 @@ void clear_objects(void) {
init_free_object_list();
clear_object_lists(gObjectListArray);
stub_behavior_script_2();
stub_obj_list_processor_1();
for (i = 0; i < OBJECT_POOL_CAPACITY; i++) {
gObjectPool[i].activeFlags = ACTIVE_FLAG_DEACTIVATED;
geo_reset_object_node(&gObjectPool[i].header.gfx);