16#define MINIMAP_X (SCREEN_W - TILEMAP_TW - 10)
32#define DSEKAI_TRANSITION_MASK_FRAME 0x0f
41#define DSEKAI_TRANSITION_MASK_TYPE 0x70
47#define DSEKAI_TRANSITION_DIR_OPEN 0x80
49#define DSEKAI_TRANSITION_TYPE_CURTAIN 0x00
50#define DSEKAI_TRANSITION_TYPE_ZOOM 0x10
54#if defined( DEPTH_VGA )
55# define DSEKAI_TITLE_TEXT_COLOR GRAPHICS_COLOR_DARKRED
56#elif defined( DEPTH_CGA )
57# define DSEKAI_TITLE_TEXT_COLOR GRAPHICS_COLOR_MAGENTA
59# define DSEKAI_TITLE_TEXT_COLOR GRAPHICS_COLOR_WHITE
62#ifndef ENGINES_TOKENS_ONLY
75typedef void (*title_option_cb)(
struct DSEKAI_STATE* state );
81 RES_CONST
char** option_tokens;
82 title_option_cb* option_callbacks;
122#ifndef NO_ENGINE_EDITOR
133#define EDITOR_FLAG_ACTIVE 0x01
142#define EDITOR_FLAG_FORCE_FRAME 0x02
163#define DSEKAI_FLAG_INPUT_BLOCKED 0x01
165#define DSEKAI_FLAG_MENU_BLOCKED 0x02
172#define DSEKAI_FLAG_BLANK_FRAME 0x04
174#define DSEKAI_FLAG_UNLOCKED 0x08
181#define ENGINE_STATE_OPENING 1
187#define ENGINE_STATE_RUNNING 2
350#ifndef NO_ENGINE_EDITOR
398void engines_exit_to_title(
struct DSEKAI_STATE* state );
402void engines_set_transition(
403 struct DSEKAI_STATE* state, uint8_t trans_type, uint8_t trans_open );
405void engines_draw_transition(
struct DSEKAI_STATE* state );
412uint8_t engines_state_lock(
struct DSEKAI_STATE* state );
414uint8_t engines_state_unlock(
struct DSEKAI_STATE* state );
428#define ENGINE_TABLE( f ) f( 0, NONE, title ) f( 1, TOPDOWN, topdown ) f( 2, POV, pov )
435#define ENGINE_TABLE( f ) f( 0, NONE, title ) f( 1, TOPDOWN, topdown )
439#ifndef ENGINES_TOKENS_ONLY
444#define engines_active( state ) (0 == window_modal() && DSEKAI_FLAG_INPUT_BLOCKED != (DSEKAI_FLAG_INPUT_BLOCKED & (state)->flags) && 0 > (state)->menu.menu_id)
460 INPUT_VAL in_char, int16_t click_x, int16_t click_y,
475#define ENGINES_SETUP_PROTOTYPES( idx, eng, prefix ) int16_t prefix ## _setup( struct DSEKAI_STATE* state ) SECTION_SETUP;
477ENGINE_TABLE( ENGINES_SETUP_PROTOTYPES )
479#define ENGINES_INPUT_PROTOTYPES( idx, eng, prefix ) int16_t prefix ## _input( INPUT_VAL in_char, int16_t click_x, int16_t click_y, struct DSEKAI_STATE* state );
481ENGINE_TABLE( ENGINES_INPUT_PROTOTYPES )
483#define ENGINES_ANIMATE_PROTOTYPES( idx, eng, prefix ) void prefix ## _animate( struct DSEKAI_STATE* state );
485ENGINE_TABLE( ENGINES_ANIMATE_PROTOTYPES )
487#define ENGINES_DRAW_PROTOTYPES( idx, eng, prefix ) void prefix ## _draw( struct DSEKAI_STATE* state );
489ENGINE_TABLE( ENGINES_DRAW_PROTOTYPES )
491#define ENGINES_SHUTDOWN_PROTOTYPES( idx, eng, prefix ) void prefix ## _shutdown( struct DSEKAI_STATE* state ) SECTION_SETUP;
493ENGINE_TABLE( ENGINES_SHUTDOWN_PROTOTYPES )
499#define ENGINES_LIST_TOKENS( idx, eng, prefix ) #prefix,
501RES_CONST
char* gc_engines_tokens[] = {
502 ENGINE_TABLE( ENGINES_LIST_TOKENS )
506#ifndef ENGINES_TOKENS_ONLY
508#define ENGINES_LIST_SETUP( idx, eng, prefix ) prefix ## _setup,
511 ENGINE_TABLE( ENGINES_LIST_SETUP )
514#define ENGINES_LIST_INPUT( idx, eng, prefix ) prefix ## _input,
517 ENGINE_TABLE( ENGINES_LIST_INPUT )
520#define ENGINES_LIST_ANIMATE( idx, eng, prefix ) prefix ## _animate,
523 ENGINE_TABLE( ENGINES_LIST_ANIMATE )
526#define ENGINES_LIST_DRAW( idx, eng, prefix ) prefix ## _draw,
529 ENGINE_TABLE( ENGINES_LIST_DRAW )
532#define ENGINES_LIST_SHUTDOWN( idx, eng, prefix ) prefix ## _shutdown,
535 ENGINE_TABLE( ENGINES_LIST_SHUTDOWN )
542extern RES_CONST
char* gc_engines_tokens[];
544#ifndef ENGINES_TOKENS_ONLY
void(* ENGINES_ANIMATE)(struct DSEKAI_STATE *state)
Cycles animations and executes scripts relevant to the current engine.
Definition: engines.h:467
int16_t(* ENGINES_INPUT)(INPUT_VAL in_char, int16_t click_x, int16_t click_y, struct DSEKAI_STATE *state)
Handles polled input according to the rules of the current engine.
Definition: engines.h:459
int16_t(* ENGINES_SETUP)(struct DSEKAI_STATE *state)
Sets up the current engine (allocates specific state, etc).
Definition: engines.h:451
void(* ENGINES_DRAW)(struct DSEKAI_STATE *state)
Draws the engine sceen on-screen according to current state.
Definition: engines.h:473
void engines_animate_mobiles(struct DSEKAI_STATE *state)
Do generic mobile animation and execute their scripts.
Definition: engines.c:194
int16_t engines_warp_loop(MEMORY_HANDLE state_handle)
Handle transition to a new TILEMAP.
Definition: engines.c:23
int16_t engines_loop_iter(MEMORY_HANDLE state_handle)
Central loop iteration handler. Calls engine-specific callbacks.
Definition: engines.c:269
int8_t engines_input_movement(struct MOBILE *mover, int8_t dir_move, struct DSEKAI_STATE *state)
Handle generic player movement commmand.
Definition: engines.c:229
void engines_draw_loading_screen()
Draw a simple loading screen.
Definition: engines.c:11
#define TILEMAP_NAME_MAX
Maximum size of TILEMAP::name.
Definition: src/config.h:254
#define TILEMAP_TH
Maximum TILEMAP height in tiles.
Definition: tmstruct.h:22
#define TILEMAP_TW
Maximum TILEMAP width in tiles.
Definition: tmstruct.h:20
General/shared state of the running engine in memory.
Definition: engines.h:196
uint16_t ani_sprite_x
The horizontal offset of all on-screen MOBILE sprites on their spritesheets in pixels.
Definition: engines.h:289
MEMORY_HANDLE map_handle
Currently loaded TILEMAP.
Definition: engines.h:221
struct ITEM * items
Temporary pointer for use during Engine Locking.
Definition: engines.h:214
char warp_to[TILEMAP_NAME_MAX]
When holding a valid string, triggers the map change process.
Definition: engines.h:296
MEMORY_HANDLE items_handle
Array consisting of all items in the current game world.
Definition: engines.h:209
MEMORY_HANDLE engine_state_handle
Contains the currently loaded Engine-Specific Struct.
Definition: engines.h:274
MEMORY_HANDLE mobiles_handle
Array of currently loaded MOBILE objects on this map.
Definition: engines.h:255
struct TILEMAP * tilemap
Temporary pointer for use during Engine Locking.
Definition: engines.h:229
uint8_t warp_to_x
Sets the player MOBILE::coords horizontal on map change.
Definition: engines.h:302
RESOURCE_NAME player_sprite_name
Resource ID for the player sprite.
Definition: engines.h:333
struct MOBILE * mobiles
Temporary pointer for use during Engine Locking.
Definition: engines.h:260
uint8_t engine_type
Engine type tilemap is supposed to be used with.
Definition: engines.h:234
uint8_t engine_type_change
Engine type set to be changed to with engines_warp_loop().
Definition: engines.h:241
uint16_t engine_state
Current engine state (see below in struct reference).
Definition: engines.h:311
struct CROP_PLOT * crops
Temporary pointer for use during Engine Locking.
Definition: engines.h:346
uint8_t flags
Global boolean values dictating engine state and behavior.
Definition: engines.h:314
uint8_t warp_to_y
Sets the player MOBILE::coords vertical on map change.
Definition: engines.h:308
struct MOBILE player
Currently active player MOBILE. Stays between maps.
Definition: engines.h:269
uint8_t ani_sprite_countdown
The number of loops until DSEKAI_STATE::ani_sprite_countdown changes.
Definition: engines.h:281
MEMORY_HANDLE crops_handle
Array of all crops growing on all maps.
Definition: engines.h:341
uint8_t transition
The current frame of the playing Engine Transitions.
Definition: engines.h:325
Definition: engines.h:144
uint8_t selected_tile
Definition: engines.h:150
uint8_t current_tile
Definition: engines.h:148
struct TILEMAP_COORDS coords
Tile coordinates currently being edited.
Definition: engines.h:146
uint8_t flags
Bitfield controlling behavior and flow of editor.
Definition: engines.h:152
An emulated memory handle for modern systems. Overridden on most platforms.
Definition: memory.h:20
An instance of an item in the world.
Definition: itstruct.h:91
A moving/interactive object in the world.
Definition: mobile.h:248
State for ::ENGINE_TYPE_POV. Displays a first-person 3D view of the world using raycasting.
Definition: engines.h:114
X/Y coordinates of a tile on the current map.
Definition: tmstruct.h:33
Information pertaining to in-game world currently loaded.
Definition: tmstruct.h:87
State for ::ENGINE_TYPE_NONE. A simple title screen engine.
Definition: engines.h:80
uint8_t option_idx
Index of the currently highlighted option.
Definition: engines.h:84
State for ::ENGINE_TYPE_TOPDOWN. Displays a top-down 2-dimensional view of the world.
Definition: engines.h:93
int16_t screen_scroll_y
Top vertical offset of the current viewport in pixels.
Definition: engines.h:97
int16_t screen_scroll_x_tgt
Horizontal offset the viewport is scrolling to in pixels.
Definition: engines.h:103
int16_t screen_scroll_y_tgt
Vertical offset the viewport is scrolling to in pixels.
Definition: engines.h:105
int16_t screen_scroll_x
Left horizontal offset of the current viewport in pixels.
Definition: engines.h:95
int16_t screen_scroll_tx
Left horizontal offset of the current viewport in tiles.
Definition: engines.h:99
int16_t screen_scroll_ty
Top vertical offset of the current viewport in tiles.
Definition: engines.h:101