![]() |
Jo Engine 2026.11.6
Jo Sega Saturn Engine
|
Entities: the things of a level that live (barrels that explode, trigger zones, relays, doors, enemies...). They are read from a level (sections ENTI, PROP and LINK, see Documentation/level_format.md). More...
#include "level.h"Go to the source code of this file.
Data Structures | |
| struct | jo_entity_class |
| Class of entities: its callbacks (JO_NULL: nothing to do). More... | |
| struct | __jo_entity |
| An entity. More... | |
| struct | jo_actor |
| Data of an actor (the first member of the data of a class of actors). More... | |
Macros | |
| #define | JO_ENTITY_MAX |
| Entities at most (they are allocated with their count when a level is loaded). | |
| #define | JO_ENTITY_MAX_CLASSES |
| Classes at most (the engine uses 8). | |
| #define | JO_ENTITY_MAX_PENDING |
| Actions waiting for their delay at most. | |
| #define | JO_ENTITY_MAX_MODELS |
| Different models of the entities at most (the models of the classes too: the things broken, the pieces). | |
| #define | JO_ENTITY_WAKE_DISTANCE |
| The entities farther from the player are not updated (world units), unless they wait for something (timer), see jo_entities_set_wake(). | |
| #define | JO_ENTITY_DRAW_DISTANCE |
| The models of the entities farther are not drawn (world units), see the property draw_distance. | |
| #define | JO_ENTITY_FAR_DISTANCE |
| The far model of the entities is drawn farther (world units), see the properties far_model and far_distance. | |
| #define | JO_ENTITY_FLAG_DISABLED |
| Flags of an entity: the ones of the level (ENTITY_FLAG_xxx of the schema). | |
| #define | JO_ENTITY_FLAG_SOLID |
| A solid entity (the collisions, the bullets): set it with jo_entity_set_solid(); set in the flags directly, it is solid from the next jo_entities_update() (the collisions read a list of the solid entities). | |
| #define | JO_ENTITY_FLAG_HIDDEN |
| #define | JO_ENTITY_FLAG_DEAD |
| Flags of an entity: the state. | |
| #define | JO_ENTITY_FLAG_PLAYER_INSIDE |
| #define | JO_ENTITY_FLAG_DOORWAY |
| Flag of an entity set by its class: in a doorway between 2 cells (a door), drawn when one of the cells around it (its position +- its radius on X and Z) is drawn (its position alone: a cell hidden behind the door closed). | |
Typedefs | |
| typedef struct __jo_entity | jo_entity |
| typedef void(*) | jo_entity_area_damage_callback(const jo_pos3D_fixed *const center, const int radius, const int damage, jo_entity *const source) |
| Damage around a point given to the game (the player is not an entity). | |
| typedef void(*) | jo_actor_bone_callback(jo_entity *const entity, const int bone, const jo_fixed(*const matrix)[3]) |
| Called when an actor is drawn, after each bone (a weapon in a hand, a muzzle flash). | |
| typedef typedef | __attribute__ |
| 16 bits word of any memory (see __jo_uint32_alias) | |
Functions | |
| struct __jo_entity | __attribute__ ((aligned(16))) |
| void | jo_entity_register_class (const jo_entity_class *const cls) |
| Register a class of the game (before jo_entities_load()). | |
| void | jo_entity_class_set_parallel_draw (const jo_entity_class *const cls, const bool parallel) |
| Let the master CPU draw the entities of a class (its draw callback) while the slave CPU draws others of the same class (its draw_slave callback), see jo_entities_draw(). | |
| int | jo_entities_load (jo_level *const level) |
| Create the entities of a level (sections ENTI, PROP, LINK): the previous ones are freed. | |
| void | jo_entities_free (void) |
| Free the entities (and their models). | |
| void | jo_entities_update (const jo_pos3D_fixed *const player, const int elapsed) |
| Update the entities: the delayed actions, the classes, the trigger zones. | |
| void | jo_entities_set_wake (const int distance, const bool when_seen) |
| The entities updated by jo_entities_update(): the ones that wait for something (timer > 0), the ones near the player, and the ones seen. | |
| void | jo_entities_prepare_draw (const int slave_share) |
| Prepare the drawing of the entities of the frame (the camera matrix is the current matrix, see jo_3d_set_depth_bias()): the ones seen, their tint (the light of the lamps, see jo_3d_point_lights_sample()), the share of the slave CPU (see jo_entities_draw_slave()). Before jo_3d_slave_begin() and the job of the slave CPU. | |
| int | jo_entities_draw (void) |
| Draw the entities of the master CPU (the camera matrix is the current matrix, see jo_3d_set_depth_bias()). | |
| int | jo_entities_draw_slave (void) |
| Draw the entities of the slave CPU (call it on the slave CPU, in the job between jo_3d_slave_begin() and jo_3d_slave_end(), see jo_entities_prepare_draw()): first the ones with a draw_slave callback, then the models. | |
| int | jo_entities_slave_wait_time (void) |
| Time the master CPU waited for the entities of the slave CPU in the last frame (see jo_entities_draw()). | |
| int | jo_entities_test_counts (const int which) |
| int | jo_entities_polygon_count (const bool slave) |
| Polygons of the entities of a CPU in the frame (see jo_entities_prepare_draw(): the polygons of their models, plus 8 each), to balance the CPUs. | |
| int | jo_entity_count (void) |
| Number of entities. | |
| jo_entity * | jo_entity_get (const int index) |
| An entity. | |
| jo_entity * | jo_entity_find (const char *const name) |
| Find an entity by its name. | |
| void | jo_entity_send (jo_entity *const target, const int action, const int param, jo_entity *const source) |
| Send an action to an entity now. | |
| void | jo_entity_fire (jo_entity *const source, const int event, const int param) |
| Fire an event of an entity: its links send their actions (now or after their delay). | |
| void | jo_entity_damage (jo_entity *const entity, const int damage, jo_entity *const source) |
| Damage an entity: EVENT_DAMAGE, or the death (class death(), EVENT_DEATH) when its health reaches 0. | |
| void | jo_entities_damage_area (const jo_pos3D_fixed *const center, const int radius, const int damage, jo_entity *const source) |
| Damage everything around a point: the entities (their foot) and the game (see jo_entities_set_area_damage_callback()). | |
| void | jo_entities_set_area_damage_callback (const jo_entity_area_damage_callback callback) |
| Give the damage around a point to the game (the player). | |
| jo_entity * | jo_entities_ray_hit (const jo_pos3D_fixed *const origin, const jo_pos3D_fixed *const dir, const jo_fixed max_t, jo_fixed *const t, jo_pos3D_fixed *const normal) |
| First solid entity hit by a ray (its cylinder). | |
| bool | jo_entities_is_blocked (const jo_fixed x, const jo_fixed z, const int radius) |
| Check if a circle on the ground is in a solid entity (collisions of the player). | |
| bool | jo_entities_is_blocked_at (const jo_fixed x, const jo_fixed y, const jo_fixed z, const int radius, const int height, const jo_entity *const except) |
| Like jo_entities_is_blocked(), with the heights: a solid entity blocks only a body at its level (a low piece of furniture doesn't block the player in a duct over it). | |
| void | jo_entity_set_solid (jo_entity *const entity, const bool solid) |
| Make an entity solid or not (see JO_ENTITY_FLAG_SOLID). | |
| jo_entity * | jo_entities_get_blocking (const jo_fixed x, const jo_fixed z, const int radius, const jo_entity *const except) |
| The solid entity in a circle on the ground (collisions of a vehicle). | |
| int | jo_entity_get_int (const jo_entity *const entity, const char *const key, const int default_value) |
| Property of an entity (PROP). | |
| jo_fixed | jo_entity_get_fixed (const jo_entity *const entity, const char *const key, const jo_fixed default_value) |
| const char * | jo_entity_get_string (const jo_entity *const entity, const char *const key, const char *const default_value) |
| bool | jo_entities_get_zone_request (const char **const level, const char **const spawn) |
| Change of level asked by an entity zone_link (the player went in it): the game fades the screen, loads the level (jo_entities_load(), jo_cells_load()...), puts the player on the entity spawn, then calls jo_entities_clear_zone_request(). | |
| void | jo_entities_clear_zone_request (void) |
| The change of level is done (see jo_entities_get_zone_request()). | |
| jo_3d_mesh * | jo_entity_load_model (const char *const filename) |
| Load a model for the entities (loaded once: shared by all the entities). | |
| jo_3d_model * | jo_entity_get_model (const char *const filename) |
| Load a model for the entities (loaded once: shared by all the entities). | |
| void | jo_entity_set_mesh (jo_entity *const entity, jo_3d_mesh *const mesh) |
| Change the model of an entity (the dead model of an explosive...). | |
| int | jo_entity_view_distance (const jo_entity *const entity) |
| Check if the model of an entity is drawn (near enough, in the view). | |
| void | jo_entities_set_lod_scale (const int scale) |
| A magnified view (binoculars, a sniper scope): the entities are drawn and detailed as far as they look. | |
| int | jo_entity_turn_to (jo_entity *const entity, const jo_fixed x, const jo_fixed z, const int max_step) |
| Turn an entity toward a point on the ground (its model looks toward +Z turned by its yaw: the direction (sin yaw, cos yaw)). | |
| void | jo_actor_spawn (jo_entity *const entity) |
| Create the actor of an entity: its model (the model of the entity, it has a skeleton), the animation of its property animation ("idle" by default). | |
| void | jo_actor_set_shadow (jo_entity *const entity, const int radius) |
| The shadow of an actor on the ground: a dark disc under its position (its feet), drawn with its model by jo_actor_draw() and jo_actor_draw_slave() (the VDP1 darkens the pixels under it: 1 to 3 commands). | |
| void | jo_actor_update (jo_entity *const entity, const int elapsed) |
| Advance the animation of an actor. | |
| void | jo_actor_draw (jo_entity *const entity) |
| Draw an actor (its model in the pose of its animation) at its position, turned by its yaw. | |
| void | jo_actor_draw_slave (jo_entity *const entity, const int far_distance, const unsigned int hidden_bones) |
| Draw an actor on the slave CPU (call it on the slave CPU, see jo_entities_draw_slave()): its model in the pose of its animation at its position, turned by its yaw, with the distance and the tint prepared (see jo_entities_prepare_draw()). | |
| bool | jo_actor_play (jo_entity *const entity, const char *const name, const int blend) |
| Play an animation (nothing if it is already played). | |
| bool | jo_actor_restart (jo_entity *const entity, const char *const name, const int blend) |
| Play an animation again from its start. | |
| bool | jo_actor_is_done (const jo_entity *const entity) |
| Check if the animation of an actor is at its end (the last key of an animation that doesn't loop). | |
| bool | jo_actor_is_playing (const jo_entity *const entity, const char *const name) |
| Check which animation an actor plays. | |
Variables | |
| unsigned int | flags |
| jo_pos3D_fixed | position |
| int | radius |
| int | height |
| short | box_x |
| short | box_z |
| int | yaw |
| const jo_entity_class * | cls |
| const char * | name |
| int | health |
| jo_3d_mesh * | mesh |
| jo_3d_mesh * | far_mesh |
| jo_pos3D_fixed | center |
| int | mesh_radius |
| int | far_distance |
| int | draw_distance |
| int | timer |
| int | state |
| void * | data |
| unsigned short | first_prop |
| unsigned short | prop_count |
| unsigned short | first_link |
| unsigned short | link_count |
| jo_pos3D_fixed | cell_position |
| short | cells [5] |
| unsigned short | cell_generation |
| short | view_distance |
| unsigned short | tint |
| jo_fixed | center_dy |
Entities: the things of a level that live (barrels that explode, trigger zones, relays, doors, enemies...). They are read from a level (sections ENTI, PROP and LINK, see Documentation/level_format.md).
| struct __jo_entity |
An entity.
| Data Fields | ||
|---|---|---|
| short | box_x | |
| short | box_z | |
| unsigned short | cell_generation | |
| jo_pos3D_fixed | cell_position | |
| short | cells[5] | |
| jo_pos3D_fixed | center | |
| jo_fixed | center_dy | |
| const jo_entity_class * | cls | |
| void * | data | |
| int | draw_distance | |
| int | far_distance | |
| jo_3d_mesh * | far_mesh | |
| unsigned short | first_link | |
| unsigned short | first_prop | |
| unsigned int | flags | |
| int | health | |
| int | height | |
| unsigned short | link_count | |
| jo_3d_mesh * | mesh | |
| int | mesh_radius | |
| const char * | name | |
| jo_pos3D_fixed | position | |
| unsigned short | prop_count | |
| int | radius | |
| int | state | |
| int | timer | |
| unsigned short | tint | |
| short | view_distance | |
| int | yaw | |
| struct jo_actor |
Data of an actor (the first member of the data of a class of actors).
| Data Fields | ||
|---|---|---|
| short | animation | |
| int | blend | |
| int | blend_duration | |
| jo_actor_bone_callback | bone_callback | |
| jo_3d_model * | far_model | |
| jo_3d_model * | model | |
| short | previous | |
| int | previous_time | |
| int | shadow_radius | |
| int | time | |
| #define JO_ENTITY_DRAW_DISTANCE |
The models of the entities farther are not drawn (world units), see the property draw_distance.
| #define JO_ENTITY_FAR_DISTANCE |
The far model of the entities is drawn farther (world units), see the properties far_model and far_distance.
| #define JO_ENTITY_FLAG_DEAD |
Flags of an entity: the state.
| #define JO_ENTITY_FLAG_DISABLED |
Flags of an entity: the ones of the level (ENTITY_FLAG_xxx of the schema).
| #define JO_ENTITY_FLAG_DOORWAY |
Flag of an entity set by its class: in a doorway between 2 cells (a door), drawn when one of the cells around it (its position +- its radius on X and Z) is drawn (its position alone: a cell hidden behind the door closed).
| #define JO_ENTITY_FLAG_HIDDEN |
| #define JO_ENTITY_FLAG_PLAYER_INSIDE |
| #define JO_ENTITY_FLAG_SOLID |
A solid entity (the collisions, the bullets): set it with jo_entity_set_solid(); set in the flags directly, it is solid from the next jo_entities_update() (the collisions read a list of the solid entities).
| #define JO_ENTITY_MAX |
Entities at most (they are allocated with their count when a level is loaded).
| #define JO_ENTITY_MAX_CLASSES |
Classes at most (the engine uses 8).
| #define JO_ENTITY_MAX_MODELS |
Different models of the entities at most (the models of the classes too: the things broken, the pieces).
| #define JO_ENTITY_MAX_PENDING |
Actions waiting for their delay at most.
| #define JO_ENTITY_WAKE_DISTANCE |
The entities farther from the player are not updated (world units), unless they wait for something (timer), see jo_entities_set_wake().
| struct __attribute__ |
16 bits word of any memory (see __jo_uint32_alias)
Raw image struct.
| typedef void(*) jo_actor_bone_callback(jo_entity *const entity, const int bone, const jo_fixed(*const matrix)[3]) |
Called when an actor is drawn, after each bone (a weapon in a hand, a muzzle flash).
| entity | The actor |
| bone | Index of the bone |
| matrix | Matrix of the bone (see jo_3d_transform_point_by()) |
| typedef struct __jo_entity jo_entity |
| typedef void(*) jo_entity_area_damage_callback(const jo_pos3D_fixed *const center, const int radius, const int damage, jo_entity *const source) |
Damage around a point given to the game (the player is not an entity).
| center | Center (world space) |
| radius | Radius (world units) |
| damage | Damage at the center (less farther, 0 at the radius) |
| source | Entity that made it (JO_NULL: the game) |
| struct __jo_entity __attribute__ | ( | (aligned(16)) | ) |
| void jo_actor_draw | ( | jo_entity *const | entity | ) |
Draw an actor (its model in the pose of its animation) at its position, turned by its yaw.
| entity | Entity |
| void jo_actor_draw_slave | ( | jo_entity *const | entity, |
| const int | far_distance, | ||
| const unsigned int | hidden_bones ) |
Draw an actor on the slave CPU (call it on the slave CPU, see jo_entities_draw_slave()): its model in the pose of its animation at its position, turned by its yaw, with the distance and the tint prepared (see jo_entities_prepare_draw()).
| entity | Entity |
| far_distance | The far model farther (world units, on the ground), -1: the one of the entity |
| hidden_bones | Bones not drawn (bits, see jo_3d_model_set_hidden_bones()) |
| bool jo_actor_is_done | ( | const jo_entity *const | entity | ) |
Check if the animation of an actor is at its end (the last key of an animation that doesn't loop).
| entity | Entity |
| bool jo_actor_is_playing | ( | const jo_entity *const | entity, |
| const char *const | name ) |
Check which animation an actor plays.
| entity | Entity |
| name | Name of the animation |
| bool jo_actor_play | ( | jo_entity *const | entity, |
| const char *const | name, | ||
| const int | blend ) |
Play an animation (nothing if it is already played).
| entity | Entity |
| name | Name of the animation |
| blend | Milliseconds of the change (blend from the previous pose), 0: at once |
| bool jo_actor_restart | ( | jo_entity *const | entity, |
| const char *const | name, | ||
| const int | blend ) |
Play an animation again from its start.
| entity | Entity |
| name | Name of the animation |
| blend | Milliseconds of the change |
| void jo_actor_set_shadow | ( | jo_entity *const | entity, |
| const int | radius ) |
The shadow of an actor on the ground: a dark disc under its position (its feet), drawn with its model by jo_actor_draw() and jo_actor_draw_slave() (the VDP1 darkens the pixels under it: 1 to 3 commands).
| entity | The actor |
| radius | Radius (world units), 0: none (the property shadow of the entity, 0 by default) |
| void jo_actor_spawn | ( | jo_entity *const | entity | ) |
Create the actor of an entity: its model (the model of the entity, it has a skeleton), the animation of its property animation ("idle" by default).
| entity | Entity (its data starts with a jo_actor) |
| void jo_actor_update | ( | jo_entity *const | entity, |
| const int | elapsed ) |
Advance the animation of an actor.
| entity | Entity |
| elapsed | Milliseconds |
| void jo_entities_clear_zone_request | ( | void | ) |
The change of level is done (see jo_entities_get_zone_request()).
| void jo_entities_damage_area | ( | const jo_pos3D_fixed *const | center, |
| const int | radius, | ||
| const int | damage, | ||
| jo_entity *const | source ) |
Damage everything around a point: the entities (their foot) and the game (see jo_entities_set_area_damage_callback()).
| center | Center (world space) |
| radius | Radius (world units) |
| damage | Damage at the center (less farther, 0 at the radius) |
| source | Entity that made it (it isn't damaged), JO_NULL: the game |
| int jo_entities_draw | ( | void | ) |
Draw the entities of the master CPU (the camera matrix is the current matrix, see jo_3d_set_depth_bias()).
| int jo_entities_draw_slave | ( | void | ) |
Draw the entities of the slave CPU (call it on the slave CPU, in the job between jo_3d_slave_begin() and jo_3d_slave_end(), see jo_entities_prepare_draw()): first the ones with a draw_slave callback, then the models.
| void jo_entities_free | ( | void | ) |
Free the entities (and their models).
| jo_entity * jo_entities_get_blocking | ( | const jo_fixed | x, |
| const jo_fixed | z, | ||
| const int | radius, | ||
| const jo_entity *const | except ) |
The solid entity in a circle on the ground (collisions of a vehicle).
| x | Center (world space) |
| z | Center |
| radius | Radius (world units) |
| except | Entity not checked (the vehicle itself), JO_NULL: none |
| bool jo_entities_get_zone_request | ( | const char **const | level, |
| const char **const | spawn ) |
Change of level asked by an entity zone_link (the player went in it): the game fades the screen, loads the level (jo_entities_load(), jo_cells_load()...), puts the player on the entity spawn, then calls jo_entities_clear_zone_request().
| level | JOL file of the level (output, valid until the next request) |
| spawn | Name of the entity of the level where the player appears (output, "": the game chooses) |
Check if a circle on the ground is in a solid entity (collisions of the player).
| x | Center (world space) |
| z | Center |
| radius | Radius (world units) |
| bool jo_entities_is_blocked_at | ( | const jo_fixed | x, |
| const jo_fixed | y, | ||
| const jo_fixed | z, | ||
| const int | radius, | ||
| const int | height, | ||
| const jo_entity *const | except ) |
Like jo_entities_is_blocked(), with the heights: a solid entity blocks only a body at its level (a low piece of furniture doesn't block the player in a duct over it).
| x | Position of the feet |
| y | Position of the feet (Saturn Y: down) |
| z | Position of the feet |
| radius | Radius of the body (world units) |
| height | Height of the body (world units) |
| except | Entity not checked (the body itself), JO_NULL: none |
| int jo_entities_load | ( | jo_level *const | level | ) |
Create the entities of a level (sections ENTI, PROP, LINK): the previous ones are freed.
| level | Level (it can be freed after: what the entities need is copied) |
| int jo_entities_polygon_count | ( | const bool | slave | ) |
Polygons of the entities of a CPU in the frame (see jo_entities_prepare_draw(): the polygons of their models, plus 8 each), to balance the CPUs.
| slave | false: the master CPU, true: the slave CPU |
| void jo_entities_prepare_draw | ( | const int | slave_share | ) |
Prepare the drawing of the entities of the frame (the camera matrix is the current matrix, see jo_3d_set_depth_bias()): the ones seen, their tint (the light of the lamps, see jo_3d_point_lights_sample()), the share of the slave CPU (see jo_entities_draw_slave()). Before jo_3d_slave_begin() and the job of the slave CPU.
| slave_share | Share of the cost of the entities drawn by the slave CPU (0 to 1024, 0: all by the master CPU): the entities with a draw_slave callback or without draw callback, the others stay on the master CPU |
| jo_entity * jo_entities_ray_hit | ( | const jo_pos3D_fixed *const | origin, |
| const jo_pos3D_fixed *const | dir, | ||
| const jo_fixed | max_t, | ||
| jo_fixed *const | t, | ||
| jo_pos3D_fixed *const | normal ) |
First solid entity hit by a ray (its cylinder).
| origin | Origin (world space) |
| dir | Direction (unit vector, Q16.16) |
| max_t | Length of the ray (world units, Q16.16) |
| t | Distance of the hit (output, Q16.16) |
| normal | Normal of the cylinder at the hit (output, unit vector) |
| void jo_entities_set_area_damage_callback | ( | const jo_entity_area_damage_callback | callback | ) |
Give the damage around a point to the game (the player).
| callback | Callback, JO_NULL: none |
| void jo_entities_set_lod_scale | ( | const int | scale | ) |
A magnified view (binoculars, a sniper scope): the entities are drawn and detailed as far as they look.
| scale | The magnification (1: normal): the distances of jo_entity_view_distance() are divided by it |
| void jo_entities_set_wake | ( | const int | distance, |
| const bool | when_seen ) |
The entities updated by jo_entities_update(): the ones that wait for something (timer > 0), the ones near the player, and the ones seen.
| distance | Nearer than it on X and Z, from the edge of their cylinder (world units, JO_ENTITY_WAKE_DISTANCE by default; 0: none by the distance) |
| when_seen | true: also the ones drawn in the last frame (in a cell seen, in the view: see jo_entities_prepare_draw()), false by default. With a short distance, the entities behind the walls sleep (less CPU): their class wakes them by their timer (a noise, an alarm) |
| int jo_entities_slave_wait_time | ( | void | ) |
Time the master CPU waited for the entities of the slave CPU in the last frame (see jo_entities_draw()).
| int jo_entities_test_counts | ( | const int | which | ) |
| void jo_entities_update | ( | const jo_pos3D_fixed *const | player, |
| const int | elapsed ) |
Update the entities: the delayed actions, the classes, the trigger zones.
| player | Position of the player (foot, world space) |
| elapsed | Time since the last update (milliseconds) |
| void jo_entity_class_set_parallel_draw | ( | const jo_entity_class *const | cls, |
| const bool | parallel ) |
Let the master CPU draw the entities of a class (its draw callback) while the slave CPU draws others of the same class (its draw_slave callback), see jo_entities_draw().
| cls | Class (registered or not) |
| parallel | true: the 2 callbacks don't share data that they change while they draw (each one only reads the class data, or writes the data of its own entity), false (default): the master CPU waits until the slave CPU has drawn all its entities with a draw_slave callback before it draws them |
| int jo_entity_count | ( | void | ) |
Number of entities.
Damage an entity: EVENT_DAMAGE, or the death (class death(), EVENT_DEATH) when its health reaches 0.
| entity | Entity (nothing if it is dead, disabled or can't be damaged) |
| damage | Damage |
| source | Entity that did it (JO_NULL: the game, the player) |
| jo_entity * jo_entity_find | ( | const char *const | name | ) |
Find an entity by its name.
| void jo_entity_fire | ( | jo_entity *const | source, |
| const int | event, | ||
| const int | param ) |
Fire an event of an entity: its links send their actions (now or after their delay).
| source | Entity |
| event | JO_LEVEL_EVENT_xxx |
| param | Parameter (given to the actions of the links with the parameter -1) |
| jo_entity * jo_entity_get | ( | const int | index | ) |
An entity.
| index | Index (0 to jo_entity_count() - 1: the order of the level) |
| jo_fixed jo_entity_get_fixed | ( | const jo_entity *const | entity, |
| const char *const | key, | ||
| const jo_fixed | default_value ) |
| int jo_entity_get_int | ( | const jo_entity *const | entity, |
| const char *const | key, | ||
| const int | default_value ) |
Property of an entity (PROP).
| entity | Entity |
| key | Name |
| default_value | Value when the entity doesn't have it |
| jo_3d_model * jo_entity_get_model | ( | const char *const | filename | ) |
Load a model for the entities (loaded once: shared by all the entities).
| filename | JOM file |
| const char * jo_entity_get_string | ( | const jo_entity *const | entity, |
| const char *const | key, | ||
| const char *const | default_value ) |
| jo_3d_mesh * jo_entity_load_model | ( | const char *const | filename | ) |
Load a model for the entities (loaded once: shared by all the entities).
| filename | JOM file |
| void jo_entity_register_class | ( | const jo_entity_class *const | cls | ) |
Register a class of the game (before jo_entities_load()).
| cls | Class (it must stay in memory). A class with the name of a class of the engine replaces it |
| void jo_entity_send | ( | jo_entity *const | target, |
| const int | action, | ||
| const int | param, | ||
| jo_entity *const | source ) |
Send an action to an entity now.
| target | Target |
| action | JO_LEVEL_ACTION_xxx (or an action of the game: from 100) |
| param | Parameter (the damage of DAMAGE) |
| source | Entity that sent it (JO_NULL: the game) |
| void jo_entity_set_mesh | ( | jo_entity *const | entity, |
| jo_3d_mesh *const | mesh ) |
Change the model of an entity (the dead model of an explosive...).
| entity | Entity |
| mesh | Mesh (JO_NULL: none) |
| void jo_entity_set_solid | ( | jo_entity *const | entity, |
| const bool | solid ) |
Make an entity solid or not (see JO_ENTITY_FLAG_SOLID).
| entity | Entity |
| solid | true: solid |
| int jo_entity_turn_to | ( | jo_entity *const | entity, |
| const jo_fixed | x, | ||
| const jo_fixed | z, | ||
| const int | max_step ) |
Turn an entity toward a point on the ground (its model looks toward +Z turned by its yaw: the direction (sin yaw, cos yaw)).
| entity | Entity |
| x | Point (world space) |
| z | Point |
| max_step | The most it turns (degrees) |
| int jo_entity_view_distance | ( | const jo_entity *const | entity | ) |
Check if the model of an entity is drawn (near enough, in the view).
| entity | Entity |
| short box_x |
| short box_z |
| unsigned short cell_generation |
| jo_pos3D_fixed cell_position |
| short cells[5] |
| jo_pos3D_fixed center |
| jo_fixed center_dy |
| const jo_entity_class* cls |
| void* data |
| int draw_distance |
| int far_distance |
| jo_3d_mesh* far_mesh |
| unsigned short first_link |
| unsigned short first_prop |
| unsigned int flags |
| int health |
| int height |
| unsigned short link_count |
| jo_3d_mesh* mesh |
| int mesh_radius |
| const char* name |
| jo_pos3D_fixed position |
| unsigned short prop_count |
| int radius |
| int state |
| int timer |
| unsigned short tint |
| short view_distance |
| int yaw |