![]() |
dsekai
World engine for retrocomputers.
|
A moving/interactive object in the world. More...
#include <mobile.h>

Data Fields | |
| uint16_t | flags |
| Mobile Object Flags affecting this mobile's display and behavior. | |
| SPAWN_GID | spawner_gid |
| TILEMAP_SPAWN::gid of the spawner that spawned this mobile. | |
| TILEMAP_GID | map_gid |
| TILEMAP::gid of the tilemap this mobile was spawned on. | |
| char | name [TILEMAP_SPAWN_NAME_SZ] |
| char | sprite_name [RESOURCE_NAME_MAX] |
| int16_t | mp_hp |
| The combined dsekai_mobiles_mp_hp field. | |
| int16_t | screen_px |
| Current on-screen pixel left of sprite. -1 if off-screen. | |
| int16_t | screen_py |
| Current on-screen pixel left of sprite. -1 if off-screen. | |
| int16_t | sprite_cache_id |
| Index of the mobile's Mobile Spritesheets loaded in the Unilayer Graphics Cache. | |
| unsigned char | ascii |
| int8_t | coords_sz |
| Number of coordinates in MOBILE::coords. | |
| struct TILEMAP_COORDS | coords [MOBILE_COORDS_QUEUE_SZ] |
| The mobile's current location (in tiles) as well as queued future locations. | |
| uint8_t | steps_remaining |
| Number of steps remaining in current walk animation. | |
| int16_t | script_id |
| Index currently executing behavior script in TILEMAP::scripts. | |
| int16_t | script_pc |
| Position in currently executing behavior script. | |
| int8_t | script_stack [SCRIPT_STACK_DEPTH] |
| Local stack used to store state for this mobile's SCRIPT. | |
| uint16_t | script_wait_frames |
| Delay script for this many frames. | |
Related Symbols | |
(Note that these are not member symbols.) | |
| #define | MOBILE_MAP_GID_ALL 0xffff |
| MOBILE::map_gid value indicating mobile is present on all tilemaps. | |
| #define | MOBILE_GID_FMT "%04d:%04d" |
| Insert into logging format strings when a mobile's Globally Unique Identifiers is needed. | |
| #define | mobile_get_gid_fmt(m) |
| Insert into the args provided to a format string using MOBILE_GID_FMT. | |
| #define | MOBILE_COORDS_QUEUE_SZ 5 |
| Number of positions available in the MOBILE::coords queue. | |
| #define | mobile_incr_hp(m, v) |
| Increment just the HP half of MOBILE::mp_hp. | |
| #define | mobile_get_dir(m) |
| Get the Cardinal Directions the mobile is facing. | |
| #define | mobile_set_dir(m, v) |
| Set MOBILE_DIR_MASK in MOBILE::flags to the specified Cardinal Directions. | |
| #define | mobile_get_icount(m) |
| Get the current interaction count of the specified MOBILE. | |
| #define | mobile_incr_icount(m, v) |
| Increment MOBILE_ICOUNT_MASK by a given value. | |
| #define | mobile_get_gid(m) |
| Get the globally unique identifier of the given MOBILE. | |
| #define | mobile_get_map_gid(m, state) |
| Get the GID of the TILEMAP the given MOBILE is currently on. | |
| #define | mobile_get_sprite(m) |
| Get the pointer to the sprite graphic to use for a MOBILE. | |
A moving/interactive object in the world.
| struct TILEMAP_COORDS MOBILE::coords[MOBILE_COORDS_QUEUE_SZ] |
The mobile's current location (in tiles) as well as queued future locations.
The first two location indexes (0 and 1) should be equal if the mobile is standing still. Otherwise, 1 contains the location the mobile is moving to and 0 contains the location it is moving from. This allows 0 to become 1 and if MOBILE::coords_sz > 2, then 2 can be moved down to 1.
| TILEMAP_GID MOBILE::map_gid |
TILEMAP::gid of the tilemap this mobile was spawned on.
This is part of the MOBILE_GID.
| int16_t MOBILE::screen_px |
Current on-screen pixel left of sprite. -1 if off-screen.
This may vary, depending on the engine type, but is also used to place animations over the mobile.
| int16_t MOBILE::screen_py |
Current on-screen pixel left of sprite. -1 if off-screen.
This may vary, depending on the engine type, but is also used to place animations over the mobile.
| int8_t MOBILE::script_stack[SCRIPT_STACK_DEPTH] |
Local stack used to store state for this mobile's SCRIPT.
This should only be manipulated directly via mobile_stack_push() and mobile_stack_pop().
Values stored on the stack can go up to SCRIPT_STACK_MAX.
| uint16_t MOBILE::script_wait_frames |
Delay script for this many frames.
This is an absolute value of frames to count down and may be safely serialized.
| SPAWN_GID MOBILE::spawner_gid |
TILEMAP_SPAWN::gid of the spawner that spawned this mobile.
This is part of the MOBILE_GID.
| int16_t MOBILE::sprite_cache_id |
Index of the mobile's Mobile Spritesheets loaded in the Unilayer Graphics Cache.
| uint8_t MOBILE::steps_remaining |
Number of steps remaining in current walk animation.
This is set to SPRITE_W to start and then incrementally determined using the table gc_mobile_step_table_normal_pos on each tick.