Quellcode durchsuchen

Add option to disable sound

tags/sdlbomber-1.0.9
Stefan Bühler vor 10 Jahren
Ursprung
Commit
ccffdfef2e
3 geänderte Dateien mit 15 neuen und 4 gelöschten Zeilen
  1. 7
    2
      menu.c
  2. 6
    2
      sound.c
  3. 2
    0
      sound.h

+ 7
- 2
menu.c Datei anzeigen

@@ -173,8 +173,9 @@ static void addexit(char *item,...) {

/* game menues */

char *densities[]={"PACKED","HIGH","MEDIUM","LOW"};
char *generosities[]={"LOW","MEDIUM","HIGH","RIDICULOUS"};
static const char *densities[]={"PACKED","HIGH","MEDIUM","LOW"};
static const char *generosities[]={"LOW","MEDIUM","HIGH","RIDICULOUS"};
static const char *dis_en_abled[]={"DISABLED","ENABLED"};

static void config_menu(void) {
int sel;
@@ -187,6 +188,7 @@ static void config_menu(void) {
additem("GENEROSITY: %s",generosities[configopts.generosity]);
additem("INITIAL FLAME LENGTH: %d",configopts.flames+1);
additem("INITIAL NUMBER OF BOMBS: %d",configopts.bombs+1);
additem("SOUND: %s", dis_en_abled[sound_enabled]);
sel=domenu(MENU_CONFIG, NULL);
switch (sel) {
case 0:
@@ -207,6 +209,9 @@ static void config_menu(void) {
configopts.bombs+=menudelta;
configopts.bombs&=7;
break;
case 5:
sound_enabled = 1 - sound_enabled;
break;
}
}
}

+ 6
- 2
sound.c Datei anzeigen

@@ -11,6 +11,8 @@
#define DATADIR "data"
#endif

int sound_enabled = 1;

static char dirlist[]=DATADIR;

static int readsound(int num);
@@ -181,6 +183,8 @@ int i,file,size,len;
}

void playsound(int n) {
soundcommands[soundput]=n;
soundput=(soundput+1)&(MAXSOUNDCOMMANDS-1);
if (sound_enabled) {
soundcommands[soundput]=n;
soundput=(soundput+1)&(MAXSOUNDCOMMANDS-1);
}
}

+ 2
- 0
sound.h Datei anzeigen

@@ -5,4 +5,6 @@ int soundopen(void);
void soundclose(void);
void playsound(int n);

extern int sound_enabled;

#endif

Laden…
Abbrechen
Speichern