int shieldsleft = 400;
int tripshot = 0;
int laser = 0;
+int sound = 1;
struct game_object {
int number; //object number
int active; //object active, 1 or 0
//halfdelay(1);
};
- Mix_Chunk *shotsound = NULL;
- int shotchannel = -1;
- Mix_Chunk *boomsound = NULL;
- int boomchannel = -1;
+ Mix_Chunk *shotsound = NULL;
+ int shotchannel = -1;
+ Mix_Chunk *boomsound = NULL;
+ int boomchannel = -1;
- int audio_rate = 22050;
- Uint16 audio_format = AUDIO_S16;
- int audio_channels = 4;
- int audio_buffers = 4096;
+ int audio_rate = 22050;
+ Uint16 audio_format = AUDIO_S16;
+ int audio_channels = 4;
+ int audio_buffers = 4096;
- SDL_Init(SDL_INIT_AUDIO);
+ char *env_tty;
+ env_tty = getenv("SSH_TTY");
+ if(env_tty == NULL){
- if(Mix_OpenAudio(audio_rate, audio_format, audio_channels, audio_buffers)) {
- printf("Unable to open audio!\n");
- exit(1);
- }
+ SDL_Init(SDL_INIT_AUDIO);
+
+ if(Mix_OpenAudio(audio_rate, audio_format, audio_channels, audio_buffers)) {
+ printf("Unable to open audio!\n");
+ exit(1);
+ }
- shotsound = Mix_LoadWAV("shot.ogg");
- boomsound = Mix_LoadWAV("boom.ogg");
+ shotsound = Mix_LoadWAV("shot.ogg");
+ boomsound = Mix_LoadWAV("boom.ogg");
+ } else {
+ sound = 0;
+ }
while(loopvar == 0){
if(quit=='y'){
printw("\nBye Bye!\n");
loopvar=1;
- Mix_FreeChunk(shotsound);
- Mix_FreeChunk(boomsound);
- Mix_CloseAudio();
- SDL_Quit();
+ if(sound==1){
+ Mix_FreeChunk(shotsound);
+ Mix_FreeChunk(boomsound);
+ Mix_CloseAudio();
+ SDL_Quit();
+ };
};
halfdelay(1);
};
laser--;
} else {
//shot sound
- shotchannel = play_sound_effect(shotsound);
+ if(sound==1){shotchannel = play_sound_effect(shotsound);};
//get next inactive bullet, give it player's direction, speed, height, location +speed in direction, active, set vtime=1.
for(int bulletloop = 0; bulletloop<bulletmax; bulletloop++){
if(bullets[bulletloop].active==0){
if(check_collision(bullets[bulletloop], landers[landerloop])==1){
//kill lander and bullet
determine_powerup(powerups, landers[landerloop], 800);
- boomchannel = play_sound_effect(boomsound);
+ if(sound==1){boomchannel = play_sound_effect(boomsound);};
boom_object(boomstuff, landers[landerloop]);
landers[landerloop] = object_out(landers[landerloop]);
bullets[bulletloop].vtime = 100;