Skip to content

Commit f78bd57

Browse files
authored
Merge pull request DescentDevelopers#489 from Lgt2x/mve-no-sound
Support -nosound option for movie playbacks
2 parents 5641ba4 + 998e834 commit f78bd57

File tree

3 files changed

+10
-7
lines changed

3 files changed

+10
-7
lines changed

libmve/mvelib.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,8 @@ void MVE_rmEndMovie(MVESTREAM *mve);
7575

7676
void MVE_getVideoSpec(MVE_videoSpec *vSpec);
7777

78-
void MVE_sndInit(int x);
78+
// Initialize MVE sound. Set `enable` to false if sound should not be enabled.
79+
void MVE_sndInit(const bool enable);
7980

8081
void MVE_ioCallbacks(mve_cb_Read io_read);
8182
void MVE_memCallbacks(mve_cb_Alloc mem_alloc, mve_cb_Free mem_free);

libmve/mveplay.cpp

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ static int play_audio_handler(unsigned char major, unsigned char minor, unsigned
202202
static int audio_data_handler(unsigned char major, unsigned char minor, unsigned char *data, int len, void *context) {
203203
#ifdef AUDIO
204204
static const int selected_chan = 1;
205-
if (snd_ds->IsInitialized()) {
205+
if (snd_ds && snd_ds->IsInitialized()) {
206206
int chan = get_ushort(data + 2);
207207
int size = get_ushort(data + 4);
208208
if (chan & selected_chan) {
@@ -470,11 +470,12 @@ void MVE_rmEndMovie(MVESTREAM *mve) {
470470

471471
void MVE_rmHoldMovie() { timer_started = 0; }
472472

473-
void MVE_sndInit(int x) {
473+
void MVE_sndInit(const bool enable) {
474474
#ifdef AUDIO
475-
if (x == -1)
476-
mve_audio_enabled = 0;
477-
else
475+
if (enable) {
478476
mve_audio_enabled = 1;
477+
} else {
478+
mve_audio_enabled = 0;
479+
}
479480
#endif
480481
}

movie/d3movie.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818

1919
#include <cstring>
2020

21+
#include "args.h"
2122
#include "movie.h"
2223
#include "mvelib.h"
2324
#include "pserror.h"
@@ -479,7 +480,7 @@ void mve_ClearRect(int16_t x1, int16_t y1, int16_t x2, int16_t y2) {
479480

480481
#ifndef NO_MOVIES
481482
bool mve_InitSound() {
482-
MVE_sndInit(1);
483+
MVE_sndInit(FindArg("-nosound") == 0);
483484

484485
return true;
485486
}

0 commit comments

Comments
 (0)