Exemplo n.º 1
0
Arquivo: screen.c Projeto: BAM-X/frotz
/*
 * countdown
 *
 * Decrement the newline counter. Call the newline interrupt when the
 * counter hits zero. This is a helper function for screen_new_line.
 *
 */
static void countdown (void)
{
    if (cwp->nl_countdown != 0)
	if (--cwp->nl_countdown == 0)
	    direct_call (cwp->nl_routine);

}/* countdown */
Exemplo n.º 2
0
zchar Processor::stream_read_key(zword timeout, zword routine, bool hot_keys) {
	zchar key = ZC_BAD;

	flush_buffer();

	// Read key from current input stream
continue_input:

	do {
		if (istream_replay)
			key = replay_read_key();
		else
			key = console_read_key(timeout);
		if (shouldQuit())
			return ZC_BAD;
	} while (key == ZC_BAD);

	// Copy key to the command file
	if (ostream_record && !istream_replay)
		record_write_key(key);

	// Handle timeouts
	if (key == ZC_TIME_OUT)
		if (direct_call (routine) == 0)
			goto continue_input;

	// Return key
	return key;
}
Exemplo n.º 3
0
zchar stream_read_key ( zword timeout, zword routine,
			bool hot_keys )
{
    zchar key = ZC_BAD;

    flush_buffer ();

    /* Read key from current input stream */

continue_input:

    do {

	if (istream_replay)
	    key = replay_read_key ();
	else
	    key = console_read_key (timeout);

    } while (key == ZC_BAD);

    /* Verify mouse clicks */

    if (key == ZC_SINGLE_CLICK || key == ZC_DOUBLE_CLICK)
	if (!validate_click ())
	    goto continue_input;

    /* Copy key to the command file */

    if (ostream_record && !istream_replay)
	record_write_key (key);

    /* Handle timeouts */

    if (key == ZC_TIME_OUT)
	if (direct_call (routine) == 0)
	    goto continue_input;

    /* Handle hot keys */

    if (hot_keys && key >= ZC_HKEY_MIN && key <= ZC_HKEY_MAX) {

	if (h_version == V4 && key == ZC_HKEY_UNDO)
	    goto continue_input;
	if (!handle_hot_key (key))
	    goto continue_input;

	return ZC_BAD;

    }

    /* Return key */

    return key;

}/* stream_read_key */
Exemplo n.º 4
0
/*
 * end_of_sound
 *
 * Call the Z-code routine which was given as the last parameter of
 * a sound_effect call. This function may be called from a hardware
 * interrupt (which requires extremely careful programming).
 *
 */
void end_of_sound (zword routine)
{
#if defined(DJGPP) && defined(SOUND_SUPPORT)
    end_of_sound_flag = 0;
#endif
    playing = FALSE;
    if (!locked)
    {
        if (story_id == LURKING_HORROR)
            start_next_sample ();
        direct_call (routine);
    }
}/* end_of_sound */
Exemplo n.º 5
0
zchar Processor::stream_read_input(int max, zchar *buf, zword timeout, zword routine,
			  bool hot_keys, bool no_scripting) {
	zchar key = ZC_BAD;
	flush_buffer();

	// Remove initial input from the transscript file or from the screen
	if (ostream_script && enable_scripting && !no_scripting)
		script_erase_input(buf);

	// Read input line from current input stream
continue_input:

	do {
		if (istream_replay)
			key = replay_read_input(buf);
		else
			key = console_read_input(max, buf, timeout, key != ZC_BAD);
		if (shouldQuit())
			return ZC_BAD;
	} while (key == ZC_BAD);

	// Copy input line to the command file
	if (ostream_record && !istream_replay)
		record_write_input(buf, key);

	// Handle timeouts
	if (key == ZC_TIME_OUT)
	if (direct_call(routine) == 0)
		goto continue_input;

	// Copy input line to transscript file or to the screen
	if (ostream_script && enable_scripting && !no_scripting)
		script_write_input(buf, key);

	// Return terminating key
	return key;
}
Exemplo n.º 6
0
zchar stream_read_input ( int max, zchar *buf,
			  zword timeout, zword routine,
			  bool hot_keys,
			  bool no_scripting )
{
    zchar key = ZC_BAD;

    flush_buffer ();

    /* Remove initial input from the transscript file or from the screen */

    if (ostream_script && enable_scripting && !no_scripting)
	script_erase_input (buf);
    if (istream_replay)
	screen_erase_input (buf);

    /* Read input line from current input stream */

continue_input:

    do {

	if (istream_replay)
	    key = replay_read_input (buf);
	else
	    key = console_read_input (max, buf, timeout, key != ZC_BAD);

    } while (key == ZC_BAD);

    /* Verify mouse clicks */

    if (key == ZC_SINGLE_CLICK || key == ZC_DOUBLE_CLICK)
	if (!validate_click ())
	    goto continue_input;

    /* Copy input line to the command file */

    if (ostream_record && !istream_replay)
	record_write_input (buf, key);

    /* Handle timeouts */

    if (key == ZC_TIME_OUT)
	if (direct_call (routine) == 0)
	    goto continue_input;

    /* Handle hot keys */

    if (hot_keys && key >= ZC_HKEY_MIN && key <= ZC_HKEY_MAX) {

	if (!handle_hot_key (key))
	    goto continue_input;

	return ZC_BAD;

    }

    /* Copy input line to transscript file or to the screen */

    if (ostream_script && enable_scripting && !no_scripting)
	script_write_input (buf, key);
    if (istream_replay)
	screen_write_input (buf, key);

    /* Return terminating key */

    return key;

}/* stream_read_input */