Player- or script-controlled world objects or "mobiles".
More...
|
file | mobile.h |
| Structs, functions and macros pertaining to interactive objects.
|
|
|
#define | DSEKAI_MOBILES_MAX 200 |
| Maximum count of DSEKAI_STATE::mobile.
|
|
#define | DSEKAI_MOBILES_ONSCREEN (GRAPHICS_SPRITES_ONSCREEN / 3) |
|
#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.
|
|
#define | mobile_get_tx(m) ((m)->coords[1].x) |
|
#define | mobile_get_ty(m) ((m)->coords[1].y) |
|
#define | mobile_break_if_last(m) if( MOBILE_FLAG_NOT_LAST != (MOBILE_FLAG_NOT_LAST & (m)->flags) ) { debug_printf( 0, "breaking early on mobile" ); break; } |
|
#define | mobile_is_active(m) (MOBILE_FLAG_ACTIVE == (MOBILE_FLAG_ACTIVE & (m)->flags)) |
|
#define | mobile_is_walking(m) ((m)->coords[1].y != (m)->coords[0].y || (m)->coords[1].x != (m)->coords[0].x) |
|
|
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.
◆ 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.