diff --git a/polymer/eduke32/build/src/polymost.c b/polymer/eduke32/build/src/polymost.c index 79683fec0..03d92d908 100644 --- a/polymer/eduke32/build/src/polymost.c +++ b/polymer/eduke32/build/src/polymost.c @@ -6398,6 +6398,9 @@ void polymost_initosdfuncs(void) for (i=0; i=0?editorcolors[col&15]:(-col&255)); + drawline16(xofs+x1,yofs+y1, xofs+x2,yofs+y2, col>=0?editorcolors[col&15]:((-col)&255)); drawlinepat = odrawlinepat; continue; } @@ -2935,7 +2935,7 @@ dodefault: } drawlinepat = m32_drawlinepat; - drawcircle16(xofs+x1, yofs+y1, r, eccen, col>=0?editorcolors[col&15]:(-col&255)); + drawcircle16(xofs+x1, yofs+y1, r, eccen, col>=0?editorcolors[col&15]:((-col)&255)); drawlinepat = odrawlinepat; continue; } diff --git a/polymer/eduke32/source/sdlmusic.c b/polymer/eduke32/source/sdlmusic.c index 3d8f4c556..c599f7c61 100644 --- a/polymer/eduke32/source/sdlmusic.c +++ b/polymer/eduke32/source/sdlmusic.c @@ -342,11 +342,15 @@ int32_t MUSIC_StopSong(void) if (external_midi_pid > 0) { int32_t ret; + struct timespec ts; external_midi_restart = 0; // make SIGCHLD handler a no-op + ts.tv_sec = 0; + ts.tv_nsec = 5000000; // sleep 5ms at most + kill(external_midi_pid, SIGTERM); - nanosleep(&(const struct timespec) { .tv_sec=0, .tv_nsec=5000000 }, NULL); // sleep 5ms at most + nanosleep(&ts, NULL); ret = waitpid(external_midi_pid, NULL, WNOHANG|WUNTRACED); // printf("(%d)", ret); @@ -419,13 +423,16 @@ static void sigchld_handler(int signo) { int status; - if (waitpid(external_midi_pid, &status, WUNTRACED)==-1) - perror("waitpid (3)"); - - if (WIFEXITED(status) && WEXITSTATUS(status)==0) + if (external_midi_pid > 0) { - // loop ... - playmusic(); + if (waitpid(external_midi_pid, &status, WUNTRACED)==-1) + perror("waitpid (3)"); + + if (WIFEXITED(status) && WEXITSTATUS(status)==0) + { + // loop ... + playmusic(); + } } } }