GetData()->ctx->Audio()->FlushSfx();
return;
}
- // Play command
- else {
- int count = 1;
- if (times != NULL)
- count = *times;
+ // Extension - Voiced auto-stop. If the next line contains quotes,
+ // it is voiced. We set a flag in response. If the flag is already
+ // set - e.g. the sound was a voice as well, we stop the previous
+ // sound before playing this one.
+
+ if(GetData()->vndc_enabled &&
+ (GetData()->next_line[6] == '"' ||
+ GetData()->next_line[strlen(GetData()->next_line) - 1] == '"')) {
+ if(GetData()->is_spoken_line == true) {
+ GetData()->ctx->Audio()->FlushSfx();
+ }
+ GetData()->is_spoken_line = true;
+ }
+ else
+ GetData()->is_spoken_line = false;
+
- char path[400];
- memset(path, 0, 400);
+ // Play command
+ int count = 1;
+ if (times != NULL)
+ count = *times;
- snprintf(path, 400, "sound/%s", file);
+ char path[400];
+ memset(path, 0, 400);
- //printf("[op_sound] path: '%s'\n", path);
+ snprintf(path, 400, "sound/%s", file);
- // Load displayable.
- int sfxi = GetData()->ctx->Audio()->LoadSfx(path);
+ // Load sfx.
+ int sfxi = GetData()->ctx->Audio()->LoadSfx(path);
- if (count == -1) {
- GetData()->ctx->Audio()->PlaySfx(sfxi, count);
- }
- else {
- GetData()->ctx->Audio()->PlaySfx(sfxi, count-1);
- }
+ if (count == -1) {
+ GetData()->ctx->Audio()->PlaySfx(sfxi, count);
+ }
+ else {
+ GetData()->ctx->Audio()->PlaySfx(sfxi, count-1);
}
}