dsekai
World engine for retrocomputers.
Loading...
Searching...
No Matches
Data Structures | Macros | Functions | Variables
mobile.h File Reference

Structs, functions and macros pertaining to interactive objects. More...

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  MOBILE
 A moving/interactive object in the world. More...
 

Macros

#define MOBILE_HP_MASK   0x00ff
 Bitmask denoting half of MOBILE::mp_hp devoted to MP.
 
#define MOBILE_MP_MASK   0xff00
 Bitmask denoting half of MOBILE::mp_hp devoted to HP.
 
#define MOBILE_HP_DEATH   -10
 Value to set MOBILE::hp to on death but before deactivation.
 
#define MOBILE_ICOUNT_MASK   0xf000
 Bitmask defining bits in MOBILE::flags used to indicate the number of Scripting Interactions this mobile has had. Please see that section for details.
 
#define MOBILE_DIR_MASK   0x0007
 Bitmask defining bits in MOBILE::flags used to indicate which of the Cardinal Directions a mobile is currently facing.
 
#define MOBILE_TYPE_NORMAL   0x0000
 MOBILE::flags indicating single-map lifecycle for this mobile.
 
#define MOBILE_TYPE_SPECIAL   0x0008
 MOBILE::flags indicating that this mobile persists between tilemaps.
 
#define MOBILE_TYPE_RES1   0x0010
 Reserved for future use.
 
#define MOBILE_TYPE_RES2   0x0018
 Reserved for future use.
 
#define MOBILE_TYPE_MASK   0x0018
 Bitmask defining bits in MOBILE::flags used to indicate Mobile Object Type Flags.
 
#define MOBILE_FLAG_ACTIVE   0x0100
 MOBILE::flags indicating that this mobile is extant and active.
 
#define MOBILE_FLAG_PLAYER   0x0200
 MOBILE::flags indicating that this is a player MOBILE.
 
#define MOBILE_FLAG_DISABLED   0x0400
 MOBILE::flags indicating this mobile is not responding to interation.
 
#define MOBILE_FLAG_NOT_LAST   0x0800
 MOBILE::flags indicating this mobile is not the last used mobile slot.
 
#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)
 
#define MOBILE_ERROR_BLOCKED   -1
 Error code indicating MOBILE path is blocked.
 
#define MOBILE_DIR_SOUTH   0
 MOBILE::dir indicating down direction for movement/animation.
 
#define MOBILE_DIR_NORTH   1
 MOBILE::dir indicating up direction for movement/animation.
 
#define MOBILE_DIR_EAST   2
 MOBILE::dir indicating right direction for movement/animation.
 
#define MOBILE_DIR_WEST   3
 MOBILE::dir indicating left direction for movement/animation.
 

Functions

uint8_t mobile_walk_start (struct MOBILE *m, uint8_t dir) SECTION_MOBILE
 Have the given MOBILE attempt to begin walking movement/animation.
 
struct MOBILEmobile_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 MOBILEmobile_from_gid (MOBILE_GID m_gid, struct DSEKAI_STATE *state)
 
struct MOBILEmobile_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 MOBILEmobile_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.
 

Variables

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().
 

Detailed Description

Structs, functions and macros pertaining to interactive objects.