mirror of
https://github.com/coop-deluxe/sm64coopdx.git
synced 2025-12-10 18:12:40 +00:00
Document behavior headers (54.07%)
This commit is contained in:
parent
79ef7e8e12
commit
66e23c0cbf
5 changed files with 60 additions and 6 deletions
|
|
@ -2916,66 +2916,78 @@ function vec3f_copy_2(dest, src)
|
||||||
end
|
end
|
||||||
|
|
||||||
--- @return number
|
--- @return number
|
||||||
|
--- Gets the draw distance scalar
|
||||||
function draw_distance_scalar()
|
function draw_distance_scalar()
|
||||||
-- ...
|
-- ...
|
||||||
end
|
end
|
||||||
|
|
||||||
--- @param obj Object
|
--- @param obj Object
|
||||||
|
--- Updates an object's graphical position and angle
|
||||||
function obj_update_gfx_pos_and_angle(obj)
|
function obj_update_gfx_pos_and_angle(obj)
|
||||||
-- ...
|
-- ...
|
||||||
end
|
end
|
||||||
|
|
||||||
--- @return number
|
--- @return number
|
||||||
|
--- Sets the current object's position to random floats between 0.0 and 1.0
|
||||||
function position_based_random_float_position()
|
function position_based_random_float_position()
|
||||||
-- ...
|
-- ...
|
||||||
end
|
end
|
||||||
|
|
||||||
--- @return integer
|
--- @return integer
|
||||||
|
--- Sets the current object's position to random integers between 0 and 65536
|
||||||
function position_based_random_u16()
|
function position_based_random_u16()
|
||||||
-- ...
|
-- ...
|
||||||
end
|
end
|
||||||
|
|
||||||
--- @return number
|
--- @return number
|
||||||
|
--- Generates a psuedo random float between 0.0 and 1.0
|
||||||
function random_float()
|
function random_float()
|
||||||
-- ...
|
-- ...
|
||||||
end
|
end
|
||||||
|
|
||||||
--- @return integer
|
--- @return integer
|
||||||
|
--- Returns either 1 or -1 with a psuedo 50:50 chance
|
||||||
function random_sign()
|
function random_sign()
|
||||||
-- ...
|
-- ...
|
||||||
end
|
end
|
||||||
|
|
||||||
--- @return integer
|
--- @return integer
|
||||||
|
--- Generates a psuedo random integer between 0 and 65535
|
||||||
function random_u16()
|
function random_u16()
|
||||||
-- ...
|
-- ...
|
||||||
end
|
end
|
||||||
|
|
||||||
--- @param id BehaviorId
|
--- @param id BehaviorId
|
||||||
--- @return Pointer_BehaviorScript
|
--- @return Pointer_BehaviorScript
|
||||||
|
--- Gets a behavior script from a behavior ID
|
||||||
function get_behavior_from_id(id)
|
function get_behavior_from_id(id)
|
||||||
-- ...
|
-- ...
|
||||||
end
|
end
|
||||||
|
|
||||||
--- @param id BehaviorId
|
--- @param id BehaviorId
|
||||||
--- @return string
|
--- @return string
|
||||||
|
--- Gets a behavior name from a behavior ID (bhvMyGreatMODCustom004)
|
||||||
function get_behavior_name_from_id(id)
|
function get_behavior_name_from_id(id)
|
||||||
-- ...
|
-- ...
|
||||||
end
|
end
|
||||||
|
|
||||||
--- @param behavior Pointer_BehaviorScript
|
--- @param behavior Pointer_BehaviorScript
|
||||||
--- @return BehaviorId
|
--- @return BehaviorId
|
||||||
|
--- Gets a behavior ID from a behavior script
|
||||||
function get_id_from_behavior(behavior)
|
function get_id_from_behavior(behavior)
|
||||||
-- ...
|
-- ...
|
||||||
end
|
end
|
||||||
|
|
||||||
--- @param name string
|
--- @param name string
|
||||||
--- @return BehaviorId
|
--- @return BehaviorId
|
||||||
|
--- gets a behavior ID from a behavior name
|
||||||
function get_id_from_behavior_name(name)
|
function get_id_from_behavior_name(name)
|
||||||
-- ...
|
-- ...
|
||||||
end
|
end
|
||||||
|
|
||||||
--- @param behavior Pointer_BehaviorScript
|
--- @param behavior Pointer_BehaviorScript
|
||||||
--- @return BehaviorId
|
--- @return BehaviorId
|
||||||
|
--- Gets a behavior ID from only vanilla behavior scripts
|
||||||
function get_id_from_vanilla_behavior(behavior)
|
function get_id_from_vanilla_behavior(behavior)
|
||||||
-- ...
|
-- ...
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -13,6 +13,9 @@
|
||||||
|
|
||||||
## [draw_distance_scalar](#draw_distance_scalar)
|
## [draw_distance_scalar](#draw_distance_scalar)
|
||||||
|
|
||||||
|
### Description
|
||||||
|
Gets the draw distance scalar
|
||||||
|
|
||||||
### Lua Example
|
### Lua Example
|
||||||
`local numberValue = draw_distance_scalar()`
|
`local numberValue = draw_distance_scalar()`
|
||||||
|
|
||||||
|
|
@ -31,6 +34,9 @@
|
||||||
|
|
||||||
## [obj_update_gfx_pos_and_angle](#obj_update_gfx_pos_and_angle)
|
## [obj_update_gfx_pos_and_angle](#obj_update_gfx_pos_and_angle)
|
||||||
|
|
||||||
|
### Description
|
||||||
|
Updates an object's graphical position and angle
|
||||||
|
|
||||||
### Lua Example
|
### Lua Example
|
||||||
`obj_update_gfx_pos_and_angle(obj)`
|
`obj_update_gfx_pos_and_angle(obj)`
|
||||||
|
|
||||||
|
|
@ -51,6 +57,9 @@
|
||||||
|
|
||||||
## [position_based_random_float_position](#position_based_random_float_position)
|
## [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
|
### Lua Example
|
||||||
`local numberValue = position_based_random_float_position()`
|
`local numberValue = position_based_random_float_position()`
|
||||||
|
|
||||||
|
|
@ -69,6 +78,9 @@
|
||||||
|
|
||||||
## [position_based_random_u16](#position_based_random_u16)
|
## [position_based_random_u16](#position_based_random_u16)
|
||||||
|
|
||||||
|
### Description
|
||||||
|
Sets the current object's position to random integers between 0 and 65536
|
||||||
|
|
||||||
### Lua Example
|
### Lua Example
|
||||||
`local integerValue = position_based_random_u16()`
|
`local integerValue = position_based_random_u16()`
|
||||||
|
|
||||||
|
|
@ -87,6 +99,9 @@
|
||||||
|
|
||||||
## [random_float](#random_float)
|
## [random_float](#random_float)
|
||||||
|
|
||||||
|
### Description
|
||||||
|
Generates a psuedo random float between 0.0 and 1.0
|
||||||
|
|
||||||
### Lua Example
|
### Lua Example
|
||||||
`local numberValue = random_float()`
|
`local numberValue = random_float()`
|
||||||
|
|
||||||
|
|
@ -105,6 +120,9 @@
|
||||||
|
|
||||||
## [random_sign](#random_sign)
|
## [random_sign](#random_sign)
|
||||||
|
|
||||||
|
### Description
|
||||||
|
Returns either 1 or -1 with a psuedo 50:50 chance
|
||||||
|
|
||||||
### Lua Example
|
### Lua Example
|
||||||
`local integerValue = random_sign()`
|
`local integerValue = random_sign()`
|
||||||
|
|
||||||
|
|
@ -123,6 +141,9 @@
|
||||||
|
|
||||||
## [random_u16](#random_u16)
|
## [random_u16](#random_u16)
|
||||||
|
|
||||||
|
### Description
|
||||||
|
Generates a psuedo random integer between 0 and 65535
|
||||||
|
|
||||||
### Lua Example
|
### Lua Example
|
||||||
`local integerValue = random_u16()`
|
`local integerValue = random_u16()`
|
||||||
|
|
||||||
|
|
@ -147,6 +168,9 @@
|
||||||
|
|
||||||
## [get_behavior_from_id](#get_behavior_from_id)
|
## [get_behavior_from_id](#get_behavior_from_id)
|
||||||
|
|
||||||
|
### Description
|
||||||
|
Gets a behavior script from a behavior ID
|
||||||
|
|
||||||
### Lua Example
|
### Lua Example
|
||||||
`local PointerValue = get_behavior_from_id(id)`
|
`local PointerValue = get_behavior_from_id(id)`
|
||||||
|
|
||||||
|
|
@ -167,6 +191,9 @@
|
||||||
|
|
||||||
## [get_behavior_name_from_id](#get_behavior_name_from_id)
|
## [get_behavior_name_from_id](#get_behavior_name_from_id)
|
||||||
|
|
||||||
|
### Description
|
||||||
|
Gets a behavior name from a behavior ID (bhvMyGreatMODCustom004)
|
||||||
|
|
||||||
### Lua Example
|
### Lua Example
|
||||||
`local stringValue = get_behavior_name_from_id(id)`
|
`local stringValue = get_behavior_name_from_id(id)`
|
||||||
|
|
||||||
|
|
@ -187,6 +214,9 @@
|
||||||
|
|
||||||
## [get_id_from_behavior](#get_id_from_behavior)
|
## [get_id_from_behavior](#get_id_from_behavior)
|
||||||
|
|
||||||
|
### Description
|
||||||
|
Gets a behavior ID from a behavior script
|
||||||
|
|
||||||
### Lua Example
|
### Lua Example
|
||||||
`local enumValue = get_id_from_behavior(behavior)`
|
`local enumValue = get_id_from_behavior(behavior)`
|
||||||
|
|
||||||
|
|
@ -207,6 +237,9 @@
|
||||||
|
|
||||||
## [get_id_from_behavior_name](#get_id_from_behavior_name)
|
## [get_id_from_behavior_name](#get_id_from_behavior_name)
|
||||||
|
|
||||||
|
### Description
|
||||||
|
gets a behavior ID from a behavior name
|
||||||
|
|
||||||
### Lua Example
|
### Lua Example
|
||||||
`local enumValue = get_id_from_behavior_name(name)`
|
`local enumValue = get_id_from_behavior_name(name)`
|
||||||
|
|
||||||
|
|
@ -227,6 +260,9 @@
|
||||||
|
|
||||||
## [get_id_from_vanilla_behavior](#get_id_from_vanilla_behavior)
|
## [get_id_from_vanilla_behavior](#get_id_from_vanilla_behavior)
|
||||||
|
|
||||||
|
### Description
|
||||||
|
Gets a behavior ID from only vanilla behavior scripts
|
||||||
|
|
||||||
### Lua Example
|
### Lua Example
|
||||||
`local enumValue = get_id_from_vanilla_behavior(behavior)`
|
`local enumValue = get_id_from_vanilla_behavior(behavior)`
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -547,10 +547,15 @@ enum BehaviorId {
|
||||||
id_bhv_max_count // must be the last in the list
|
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);
|
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);
|
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);
|
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);
|
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);
|
enum BehaviorId get_id_from_behavior_name(const char* name);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -19,18 +19,25 @@
|
||||||
|
|
||||||
#define obj_and_int(object, offset, value) object->OBJECT_FIELD_S32(offset) &= (s32)(value)
|
#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);
|
u16 random_u16(void);
|
||||||
|
/* |description|Generates a psuedo random float between 0.0 and 1.0|descriptionEnd| */
|
||||||
float random_float(void);
|
float random_float(void);
|
||||||
|
/* |description|Returns either 1 or -1 with a psuedo 50:50 chance|descriptionEnd| */
|
||||||
s32 random_sign(void);
|
s32 random_sign(void);
|
||||||
|
|
||||||
void stub_behavior_script_2(void);
|
void stub_behavior_script_2(void);
|
||||||
|
|
||||||
void cur_obj_update(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);
|
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);
|
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);
|
f32 position_based_random_float_position(void);
|
||||||
|
/* |description|Gets the draw distance scalar|descriptionEnd| */
|
||||||
f32 draw_distance_scalar(void);
|
f32 draw_distance_scalar(void);
|
||||||
|
|
||||||
#endif // BEHAVIOR_SCRIPT_H
|
#endif // BEHAVIOR_SCRIPT_H
|
||||||
|
|
|
||||||
|
|
@ -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.
|
* Clear objects, dynamic surfaces, and some miscellaneous level data used by objects.
|
||||||
*/
|
*/
|
||||||
|
|
@ -619,9 +616,6 @@ void clear_objects(void) {
|
||||||
init_free_object_list();
|
init_free_object_list();
|
||||||
clear_object_lists(gObjectListArray);
|
clear_object_lists(gObjectListArray);
|
||||||
|
|
||||||
stub_behavior_script_2();
|
|
||||||
stub_obj_list_processor_1();
|
|
||||||
|
|
||||||
for (i = 0; i < OBJECT_POOL_CAPACITY; i++) {
|
for (i = 0; i < OBJECT_POOL_CAPACITY; i++) {
|
||||||
gObjectPool[i].activeFlags = ACTIVE_FLAG_DEACTIVATED;
|
gObjectPool[i].activeFlags = ACTIVE_FLAG_DEACTIVATED;
|
||||||
geo_reset_object_node(&gObjectPool[i].header.gfx);
|
geo_reset_object_node(&gObjectPool[i].header.gfx);
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue