Skip to content

Commit

Permalink
Fixed invalid signatures/calls in engines.
Browse files Browse the repository at this point in the history
  • Loading branch information
indigoparadox committed Oct 22, 2022
1 parent 5542a8b commit 16ea24c
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 6 deletions.
19 changes: 13 additions & 6 deletions src/engines.c
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ void engines_animate_mobiles( struct DSEKAI_STATE* state ) {
for( i = 0 ; DSEKAI_MOBILES_MAX > i ; i++ ) {
if(
/* Pause scripts if modal window is pending. */
0 >= window_modal( state ) &&
0 >= window_modal() &&
/* Pause scripts if screen is scrolling. */
DSEKAI_FLAG_INPUT_BLOCKED !=
(DSEKAI_FLAG_INPUT_BLOCKED & state->flags) &&
Expand All @@ -185,7 +185,7 @@ void engines_animate_mobiles( struct DSEKAI_STATE* state ) {

if(
/* Pause crops if modal window is pending. */
0 >= window_modal( state ) &&
0 >= window_modal() &&
/* Pause crops if screen is scrolling. */
DSEKAI_FLAG_INPUT_BLOCKED != (DSEKAI_FLAG_INPUT_BLOCKED & state->flags) &&
/* Pause crops if menu is open. */
Expand All @@ -200,7 +200,7 @@ int16_t engines_handle_movement(
int8_t dir_move, struct DSEKAI_STATE* state, struct TILEMAP* t
) {

if( 0 < window_modal( state ) ) {
if( 0 < window_modal() ) {
return 1;
}

Expand All @@ -223,7 +223,12 @@ int16_t engines_handle_movement(
return dir_move;
}

#ifdef PLATFORM_WASM
void engines_loop_iter( void* state_handle_p ) {
MEMORY_HANDLE state_handle = (MEMORY_HANDLE)state_handle_p;
#else
int16_t engines_loop_iter( MEMORY_HANDLE state_handle ) {
#endif /* PLATFORM_WASM */
uint8_t in_char = 0;
struct DSEKAI_STATE* state = NULL;
struct TILEMAP* t = NULL;
Expand Down Expand Up @@ -283,7 +288,7 @@ int16_t engines_loop_iter( MEMORY_HANDLE state_handle ) {

} else {
/* Draw the engine. */
if( 0 >= window_modal( state ) ) {
if( 0 >= window_modal() ) {
gc_engines_draw[state->engine_type]( state );
}
}
Expand Down Expand Up @@ -311,7 +316,7 @@ int16_t engines_loop_iter( MEMORY_HANDLE state_handle ) {
/* Only open the menu if no modal windows are open and it's not
* blocked.
*/
0 >= window_modal( state ) &&
0 >= window_modal() &&
INPUT_KEY_QUIT == in_char &&
DSEKAI_FLAG_MENU_BLOCKED != (DSEKAI_FLAG_MENU_BLOCKED & state->flags)
) {
Expand All @@ -321,7 +326,7 @@ int16_t engines_loop_iter( MEMORY_HANDLE state_handle ) {
menu_open( state );
}

} else if( 0 >= window_modal( state ) && 0 != in_char ) {
} else if( 0 >= window_modal() && 0 != in_char ) {
retval = gc_engines_input[state->engine_type]( in_char, state );

} else if( INPUT_KEY_OK == in_char ) {
Expand Down Expand Up @@ -368,7 +373,9 @@ int16_t engines_loop_iter( MEMORY_HANDLE state_handle ) {

graphics_flip();

#ifndef PLATFORM_WASM
return retval;
#endif /* !PLATFORM_WASM */
}

#ifndef NO_TITLE
Expand Down
4 changes: 4 additions & 0 deletions src/engines.h
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,11 @@ void engines_animate_mobiles( struct DSEKAI_STATE* state );
* \param state_handle Unlocked ::MEMORY_HANDLE for current ::DSEKAI_STATE.
* \return 1 if engine should continue executing or 0 if it should quit.
*/
#ifdef PLATFORM_WASM
void engines_loop_iter( void* state_handle );
#else
int16_t engines_loop_iter( MEMORY_HANDLE state_handle );
#endif /* PLATFORM_WASM */

/**
* \brief Handle generic player movement commmand.
Expand Down

0 comments on commit 16ea24c

Please sign in to comment.