45#ifndef __JO_ENTITY_H__
46# define __JO_ENTITY_H__
48#if defined(JO_COMPILE_WITH_LEVEL_SUPPORT) && defined(JO_COMPILE_WITH_3D_SUPPORT)
53# define JO_ENTITY_MAX (1024)
55# define JO_ENTITY_MAX_CLASSES (24)
57# define JO_ENTITY_MAX_PENDING (32)
59# define JO_ENTITY_MAX_MODELS (16)
61# define JO_ENTITY_WAKE_DISTANCE (3000)
63# define JO_ENTITY_DRAW_DISTANCE (2000)
65# define JO_ENTITY_FAR_DISTANCE (600)
68# define JO_ENTITY_FLAG_DISABLED (0x0001)
71# define JO_ENTITY_FLAG_SOLID (0x0002)
72# define JO_ENTITY_FLAG_HIDDEN (0x0004)
74# define JO_ENTITY_FLAG_DEAD (0x0100)
75# define JO_ENTITY_FLAG_PLAYER_INSIDE (0x0200)
78# define JO_ENTITY_FLAG_DOORWAY (0x0400)
80typedef struct __jo_entity jo_entity;
86 unsigned int data_size;
88 void (*spawn)(jo_entity *
const entity);
92 void (*update)(jo_entity *
const entity,
const int elapsed);
96 bool (*action)(jo_entity *
const entity,
const int action,
const int param, jo_entity *
const source);
98 void (*death)(jo_entity *
const entity, jo_entity *
const source);
100 void (*draw)(jo_entity *
const entity);
108 jo_pos3D_fixed position;
114 const jo_entity_class *cls;
118 jo_3d_mesh *far_mesh;
119 jo_pos3D_fixed center;
126 unsigned short first_prop;
127 unsigned short prop_count;
128 unsigned short first_link;
129 unsigned short link_count;
132 jo_pos3D_fixed cell_position;
134 unsigned short cell_generation;
135} __attribute__((aligned(16)));
143typedef void (*jo_entity_area_damage_callback)(
const jo_pos3D_fixed *
const center,
const int radius,
144 const int damage, jo_entity *
const source);
149void jo_entity_register_class(
const jo_entity_class *
const cls);
157int jo_entities_load(jo_level *
const level);
160void jo_entities_free(
void);
166void jo_entities_update(
const jo_pos3D_fixed *
const player,
const int elapsed);
171int jo_entities_draw(
void);
174int jo_entity_count(
void);
179jo_entity *jo_entity_get(
const int index);
184jo_entity *jo_entity_find(
const char *
const name);
194void jo_entity_send(jo_entity *
const target,
const int action,
const int param, jo_entity *
const source);
201void jo_entity_fire(jo_entity *
const source,
const int event,
const int param);
208void jo_entity_damage(jo_entity *
const entity,
const int damage, jo_entity *
const source);
216void jo_entities_damage_area(
const jo_pos3D_fixed *
const center,
const int radius,
const int damage,
217 jo_entity *
const source);
222void jo_entities_set_area_damage_callback(
const jo_entity_area_damage_callback callback);
241bool jo_entities_is_blocked(
const jo_fixed x,
const jo_fixed z,
const int radius);
254 const int height,
const jo_entity *
const except);
260void jo_entity_set_solid(jo_entity *
const entity,
const bool solid);
269jo_entity *jo_entities_get_blocking(
const jo_fixed x,
const jo_fixed z,
const int radius,
270 const jo_entity *
const except);
278int jo_entity_get_int(
const jo_entity *
const entity,
const char *
const key,
const int default_value);
279jo_fixed jo_entity_get_fixed(
const jo_entity *
const entity,
const char *
const key,
const jo_fixed default_value);
280const char *jo_entity_get_string(
const jo_entity *
const entity,
const char *
const key,
281 const char *
const default_value);
290bool jo_entities_get_zone_request(
const char **
const level,
const char **
const spawn);
293void jo_entities_clear_zone_request(
void);
299jo_3d_mesh *jo_entity_load_model(
const char *
const filename);
305jo_3d_model *jo_entity_get_model(
const char *
const filename);
312void jo_entity_set_mesh(jo_entity *
const entity,
jo_3d_mesh *
const mesh);
319int jo_entity_view_distance(
const jo_entity *
const entity);
324void jo_entities_set_lod_scale(
const int scale);
334int jo_entity_turn_to(jo_entity *
const entity,
const jo_fixed x,
const jo_fixed z,
const int max_step);
347typedef void (*jo_actor_bone_callback)(jo_entity *
const entity,
const int bone,
const jo_fixed (*
const matrix)[3]);
360 jo_actor_bone_callback bone_callback;
367void jo_actor_spawn(jo_entity *
const entity);
373void jo_actor_update(jo_entity *
const entity,
const int elapsed);
378void jo_actor_draw(jo_entity *
const entity);
386bool jo_actor_play(jo_entity *
const entity,
const char *
const name,
const int blend);
394bool jo_actor_restart(jo_entity *
const entity,
const char *
const name,
const int blend);
400bool jo_actor_is_done(
const jo_entity *
const entity);
407bool jo_actor_is_playing(
const jo_entity *
const entity,
const char *
const name);
Mesh structure.
Definition 3d.h:216
Levels (.JOL files): the data of a level of a game (terrain, models, plants, decals....
3D model loaded from a JOM file
Definition model.h:195
int jo_fixed
Fixed point Q16.16 number.
Definition types.h:48
3D position using fixed numbers
Definition types.h:92