Went back to end_of_sound taking no args, so sound.c got reverted.
Should be easier on DOS frotz, which I never attempted to fix. Made
interpret call os_tick, as SDL front end expects (WinFrotz also has
os_tick). os_tick calls end_of_sound as appropriate. Added os_tick
to the other front ends. In dumb it does nothing, in curses it
handles resizes.
void storeb (zword, zbyte);
void storew (zword, zword);
-void end_of_sound (zword routine);
+void end_of_sound (void);
int completion (const zchar *buffer, zchar *result);
void os_warn (const char *, ...);
void os_quit (void);
+/**
+ * Called regularly by the interpreter, at least every few instructions
+ * (only when interpreting: e.g., not when waiting for input).
+ */
+void os_tick (void);
+
/* Front ends call this if the terminal size changes. */
void resize_screen(void);
}
#if defined(DJGPP) && defined(SOUND_SUPPORT)
- if (end_of_sound_flag)
- end_of_sound ();
+ if (end_of_sound_flag)
+ end_of_sound ();
#endif
+ os_tick();
} while (finished == 0);
finished--;
extern int direct_call (zword);
+static zword routine = 0;
+
static int next_sample = 0;
static int next_volume = 0;
os_start_sample (number, volume, repeats, eos);
+ routine = eos;
playing = TRUE;
}/* start_sample */
* interrupt (which requires extremely careful programming).
*
*/
-void end_of_sound (zword routine)
+void end_of_sound (void)
{
#if defined(DJGPP) && defined(SOUND_SUPPORT)
end_of_sound_flag = 0;
#endif
+void os_tick()
+{
+ while (terminal_resized) {
+ terminal_resized = 0;
+ unix_resize_display();
+ }
+}
+
+
/*
* unix_read_char
*
/* Wait with select so that we get interrupted on SIGWINCH. */
FD_ZERO(&rsel);
FD_SET(fd, &rsel);
- while (terminal_resized) {
- terminal_resized = 0;
- unix_resize_display();
- }
+ os_tick();
refresh();
t_left = timeout_left(&tval) ? &tval : NULL;
sel = select(fd + 1, &rsel, NULL, NULL, t_left);
* Or visit http://www.fsf.org/
*/
-#include "dumb_frotz.h"
-
#include <string.h>
+#include "dumb_frotz.h"
+
f_setup_t f_setup;
static char runtime_usage[] =
/* NOT IMPLEMENTED */
return 0;
}
+
+void os_tick()
+{}
// NOTE: geteffect may return an already loaded effect
e = geteffect(number);
if (!e) return;
- if (e->type == SFX_TYPE) stopsample();
- else stopmodule();
+ if (e->type == SFX_TYPE)
+ stopsample();
+ else
+ stopmodule();
if (repeats < 1) repeats = 1;
if (repeats == 255) repeats = -1;
if (volume < 0) volume = 0;
if (e_sfx->eos)
{
end_of_sound_flag = 1;
- end_of_sound(e_sfx->eos);
+ end_of_sound();
}
}
if ((e_mod) && (e_mod->ended))
if (e_mod->eos)
{
end_of_sound_flag = 1;
- end_of_sound(e_mod->eos);
+ end_of_sound();
}
}
}