Player- or script-controlled world objects or "mobiles".
More...
|
file | mobile.h |
| Structs, functions and macros pertaining to interactive objects.
|
|
|
uint8_t | mobile_walk_start (struct MOBILE *m, uint8_t dir) SECTION_MOBILE |
| Have the given MOBILE attempt to begin walking movement/animation.
|
|
struct MOBILE * | mobile_get_facing (uint8_t x, uint8_t y, uint8_t dir, struct DSEKAI_STATE *state) |
| Get a MEMORY_PTR to the mobile m is currently facing.
|
|
struct MOBILE * | mobile_from_gid (MOBILE_GID m_gid, struct DSEKAI_STATE *state) |
|
struct MOBILE * | mobile_interact (struct MOBILE *actor, struct MOBILE *actee, struct DSEKAI_STATE *state) SECTION_MOBILE |
| Force a MOBILE to jump to the SCRIPT_ACTION_INTERACT in its SCRIPT.
|
|
void | mobile_state_animate (struct DSEKAI_STATE *state) |
| Map MOBILE animation frames to a number of real frames elapsed.
|
|
void | mobile_animate (struct MOBILE *m, struct DSEKAI_STATE *state) |
| Perform animation frame for the given MOBILE.
|
|
void | mobile_deactivate (struct MOBILE *m, struct DSEKAI_STATE *state) SECTION_MOBILE |
| Prepare a MOBILE for deallocation.
|
|
void | mobile_stack_push (struct MOBILE *m, int8_t v) SECTION_MOBILE |
| Push a value onto MOBILE::script_stack.
|
|
int8_t | mobile_stack_pop (struct MOBILE *m) SECTION_MOBILE |
| Pop a value from a MOBILE::script_stack.
|
|
void | mobile_execute (struct MOBILE *m, struct DSEKAI_STATE *state) |
| Execute the next available SCRIPT_STEP in the currently running SCRIPT on a MOBILE.
|
|
struct MOBILE * | mobile_spawn_single (uint16_t flags, struct DSEKAI_STATE *state) SECTION_MOBILE |
| Allocate a mobile or select player mobile slot and initialize it with configuration generic to ALL mobiles.
|
|
int16_t | mobile_spawner_match (struct TILEMAP_SPAWN *spawner, struct DSEKAI_STATE *state) SECTION_MOBILE |
|
void | mobile_spawns (struct DSEKAI_STATE *state) SECTION_MOBILE |
| Spawn from ::TILEMAP::spawners according to spawner rules.
|
|
|
const int8_t | gc_mobile_step_table_normal_pos [16] |
| Lookup table for next walking offset to assign to MOBILE::steps_remaining based on current offset.
|
|
const int8_t | gc_mobile_y_offsets [4] |
| Lookup table for vertical offset based on mobile_get_dir().
|
|
const int8_t | gc_mobile_x_offsets [4] |
| Lookup table for horizontal offset based on mobile_get_dir().
|
|
Player- or script-controlled world objects or "mobiles".
◆ DSEKAI_MOBILES_MAX
#define DSEKAI_MOBILES_MAX 200 |
Maximum count of DSEKAI_STATE::mobile.
- Note
- This may be overridden by passing a -D argument to the compiler.
- Attention
- Changing this value may break compatibility with tilemaps or saves! Please use caution.
◆ mobile_break_if_last
#define mobile_break_if_last |
( |
| m | ) |
|
Value:
#define MOBILE_FLAG_NOT_LAST
MOBILE::flags indicating this mobile is not the last used mobile slot.
Definition mobile.h:211
◆ mobile_get_dir
#define mobile_get_dir |
( |
| m | ) |
|
|
related |
Value:
#define MOBILE_DIR_MASK
Bitmask defining bits in MOBILE::flags used to indicate which of the Cardinal Directions a mobile is ...
Definition mobile.h:157
Get the Cardinal Directions the mobile is facing.
◆ mobile_get_gid
#define mobile_get_gid |
( |
| m | ) |
|
|
related |
Value:
uint16_t TILEMAP_GID
Globally unique identifier for TILEMAP objects.
Definition gid.h:26
uint32_t MOBILE_GID
Globally unique identifier for MOBILE objects.
Definition gid.h:22
SPAWN_GID spawner_gid
TILEMAP_SPAWN::gid of the spawner that spawned this mobile.
Definition mobile.h:259
TILEMAP_GID map_gid
TILEMAP::gid of the tilemap this mobile was spawned on.
Definition mobile.h:265
Get the globally unique identifier of the given MOBILE.
This identifier is/must be unique among all ::MOBILEs in DSEKAI_STATE::mobiles_handle and persists between Engine Locking cycles.
- Parameters
-
- Returns
- MOBILE_GID of the mobile m constructed from MOBILE::map_gid and MOBILE::spawner_gid.
◆ mobile_get_icount
#define mobile_get_icount |
( |
| m | ) |
|
|
related |
Value:
#define MOBILE_ICOUNT_MASK
Bitmask defining bits in MOBILE::flags used to indicate the number of Scripting Interactions this mob...
Definition mobile.h:151
Get the current interaction count of the specified MOBILE.
- Parameters
-
◆ mobile_get_map_gid
#define mobile_get_map_gid |
( |
| m, |
|
|
| state ) |
|
related |
Value:
#define MOBILE_GID_PLAYER
Special case unique identifier for the player-controlled MOBILE.
Definition gid.h:40
#define mobile_get_gid(m)
Get the globally unique identifier of the given MOBILE.
Definition mobile.h:129
Get the GID of the TILEMAP the given MOBILE is currently on.
- Parameters
-
- Warning
- Engine state must be locked with Engine Locking before use here!
◆ mobile_get_sprite
#define mobile_get_sprite |
( |
| m | ) |
|
|
related |
Value:
Get the pointer to the sprite graphic to use for a MOBILE.
◆ mobile_get_tx
#define mobile_get_tx |
( |
| m | ) |
|
◆ mobile_get_ty
#define mobile_get_ty |
( |
| m | ) |
|
◆ mobile_incr_icount
#define mobile_incr_icount |
( |
| m, |
|
|
| v ) |
|
related |
Value:
#define mobile_get_icount(m)
Get the current interaction count of the specified MOBILE.
Definition mobile.h:108
uint16_t flags
Mobile Object Flags affecting this mobile's display and behavior.
Definition mobile.h:253
Increment MOBILE_ICOUNT_MASK by a given value.
- Parameters
-
◆ mobile_is_active
#define mobile_is_active |
( |
| m | ) |
|
Value:
#define MOBILE_FLAG_ACTIVE
MOBILE::flags indicating that this mobile is extant and active.
Definition mobile.h:192
◆ mobile_is_walking
#define mobile_is_walking |
( |
| m | ) |
|
Value:((m)->coords[1].y != (m)->coords[0].y || (m)->coords[1].x != (m)->coords[0].x)
◆ mobile_set_dir
#define mobile_set_dir |
( |
| m, |
|
|
| v ) |
|
related |
◆ SCRIPT_STACK_DEPTH
#define SCRIPT_STACK_DEPTH 10 |
Maximum depth of available local stack for each MOBILE executing a script. Each stack is individual to that particular mobile. When this depth is exceeded, old excess items will be discarded off the bottom.
- Note
- This may be overridden by passing a -D argument to the compiler.
- Attention
- Changing this value may break compatibility with tilemaps or saves! Please use caution.
◆ mobile_animate()
Perform animation frame for the given MOBILE.
- Parameters
-
◆ mobile_deactivate()
Prepare a MOBILE for deallocation.
- Parameters
-
◆ mobile_execute()
◆ mobile_get_facing()
struct MOBILE * mobile_get_facing |
( |
uint8_t | x, |
|
|
uint8_t | y, |
|
|
uint8_t | dir, |
|
|
struct DSEKAI_STATE * | state ) |
Get a MEMORY_PTR to the mobile m is currently facing.
- Parameters
-
- Returns
- MEMORY_PTR to the colliding mobile in ms.
◆ mobile_interact()
Force a MOBILE to jump to the SCRIPT_ACTION_INTERACT in its SCRIPT.
- Parameters
-
◆ mobile_spawn_single()
Allocate a mobile or select player mobile slot and initialize it with configuration generic to ALL mobiles.
- Parameters
-
◆ mobile_spawns()
Spawn from ::TILEMAP::spawners according to spawner rules.
- Parameters
-
◆ mobile_stack_pop()
int8_t mobile_stack_pop |
( |
struct MOBILE * | m | ) |
|
◆ mobile_stack_push()
void mobile_stack_push |
( |
struct MOBILE * | m, |
|
|
int8_t | v ) |
◆ mobile_state_animate()
Map MOBILE animation frames to a number of real frames elapsed.
- Parameters
-
◆ mobile_walk_start()
uint8_t mobile_walk_start |
( |
struct MOBILE * | m, |
|
|
uint8_t | dir ) |
Have the given MOBILE attempt to begin walking movement/animation.
- Parameters
-
This may fail if the mobile is already walking, or is blocked from moving in that direction by a map obstacle or other mobile.
This uses MOBILE::steps_remaining and gc_mobile_step_table_normal_pos to track walking accross ticks.