dsekai
World engine for retrocomputers.
Loading...
Searching...
No Matches
Data Fields | Related Functions
DSEKAI_STATE Struct Reference

General/shared state of the running engine in memory. More...

#include <engines.h>

Collaboration diagram for DSEKAI_STATE:
Collaboration graph
[legend]

Data Fields

uint8_t version
 
MEMORY_HANDLE items_handle
 Array consisting of all items in the current game world.
 
struct ITEMitems
 Temporary pointer for use during Engine Locking.
 
int16_t items_sz
 
MEMORY_HANDLE map_handle
 Currently loaded TILEMAP.
 
struct TILEMAPtilemap
 Temporary pointer for use during Engine Locking.
 
uint8_t engine_type
 Engine type tilemap is supposed to be used with.
 
uint8_t engine_type_change
 Engine type set to be changed to with engines_warp_loop().
 
MEMORY_HANDLE mobiles_handle
 Array of currently loaded MOBILE objects on this map.
 
struct MOBILEmobiles
 Temporary pointer for use during Engine Locking.
 
uint16_t mobiles_sz
 
struct MOBILE player
 Currently active player MOBILE. Stays between maps.
 
MEMORY_HANDLE engine_state_handle
 Contains the currently loaded Engine-Specific Struct.
 
uint8_t ani_sprite_countdown
 The number of loops until DSEKAI_STATE::ani_sprite_countdown changes.
 
uint16_t ani_sprite_x
 The horizontal offset of all on-screen MOBILE sprites on their spritesheets in pixels.
 
char warp_to [TILEMAP_NAME_MAX]
 When holding a valid string, triggers the map change process.
 
uint8_t warp_to_x
 Sets the player MOBILE::coords horizontal on map change.
 
uint8_t warp_to_y
 Sets the player MOBILE::coords vertical on map change.
 
uint16_t engine_state
 Current engine state (see below in struct reference).
 
uint8_t flags
 Global boolean values dictating engine state and behavior.
 
uint8_t transition
 The current frame of the playing Engine Transitions.
 
RESOURCE_NAME player_sprite_name
 Resource ID for the player sprite.
 
MEMORY_HANDLE crops_handle
 Array of all crops growing on all maps.
 
struct CROP_PLOTcrops
 Temporary pointer for use during Engine Locking.
 
int16_t crops_sz
 
struct EDITOR_STATE editor
 
struct MENU_STATE menu
 

Related Functions

(Note that these are not member functions.)

#define DSEKAI_FLAG_INPUT_BLOCKED   0x01
 DSEKAI_STATE::flags indicating no player input should be accepted.
 
#define DSEKAI_FLAG_BLANK_FRAME   0x04
 DSEKAI_STATE::flags indicating every frame should be drawn fresh on a clean black canvas (unless the menu is open).
 
#define ENGINE_STATE_OPENING   1
 DSEKAI_STATE::engine_state indicating engine is has not yet initialized its specific structures.
 
#define ENGINE_STATE_RUNNING   2
 DSEKAI_STATE::engine_state indicating engine is running.
 

Detailed Description

General/shared state of the running engine in memory.

Attention
engines_asn_save() and engines_asn_load() MUST be updated manually when changes are made to this struct in order to serialize properly.

Field Documentation

◆ ani_sprite_countdown

uint8_t DSEKAI_STATE::ani_sprite_countdown

The number of loops until DSEKAI_STATE::ani_sprite_countdown changes.

Attention
This field should not be serialized!

◆ ani_sprite_x

uint16_t DSEKAI_STATE::ani_sprite_x

The horizontal offset of all on-screen MOBILE sprites on their spritesheets in pixels.

Attention
This field should not be serialized!

◆ crops_handle

MEMORY_HANDLE DSEKAI_STATE::crops_handle

Array of all crops growing on all maps.

This is kept as part of the state so that crops can continue growing in the background.

◆ engine_type_change

uint8_t DSEKAI_STATE::engine_type_change

Engine type set to be changed to with engines_warp_loop().

Attention
This field should not be serialized!

◆ items_handle

MEMORY_HANDLE DSEKAI_STATE::items_handle

Array consisting of all items in the current game world.

Items in this array are considered to "exist" when the ITEM::flags field has the ITEM_FLAG_ACTIVE bit set. Inactive items may be replaced by new items.

Warning
The state must be locked with Engine Locking before use!

◆ mobiles_handle

MEMORY_HANDLE DSEKAI_STATE::mobiles_handle

Array of currently loaded MOBILE objects on this map.

Mobiles in this array are considered to "exist" when MOBILE_FLAG_ACTIVE is enabled in their MOBILE::flags.

Warning
Index in this array is persistant and unique in the world! Be sure to preserve it (including empty spots) during serialize!
The state must be locked with Engine Locking before use!

◆ player

struct MOBILE DSEKAI_STATE::player

Currently active player MOBILE. Stays between maps.

This is kept separately from DSEKAI_STATE::mobiles because... TODO

◆ player_sprite_name

RESOURCE_NAME DSEKAI_STATE::player_sprite_name

Resource ID for the player sprite.

This is necessary since the player is spawned in the first map, but travels to other maps (unlike other mobiles).

◆ tilemap

struct TILEMAP* DSEKAI_STATE::tilemap

Temporary pointer for use during Engine Locking.

Warning
The state must be locked with Engine Locking before use!

◆ transition

uint8_t DSEKAI_STATE::transition

The current frame of the playing Engine Transitions.

If set to 0, then no transition is currently playing.

If a transition is currently playing, then input and scripts are blocked.

Attention
This field should not be serialized!

◆ warp_to

char DSEKAI_STATE::warp_to[TILEMAP_NAME_MAX]

When holding a valid string, triggers the map change process.

Attention
This field should not be serialized!

◆ warp_to_x

uint8_t DSEKAI_STATE::warp_to_x

Sets the player MOBILE::coords horizontal on map change.

Attention
This field should not be serialized!

◆ warp_to_y

uint8_t DSEKAI_STATE::warp_to_y

Sets the player MOBILE::coords vertical on map change.

Attention
This field should not be serialized!

The documentation for this struct was generated from the following file: