summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDusan Durech <dusan@debian.(none)>2008-12-10 23:12:22 +0100
committerDusan Durech <dusan@debian.(none)>2008-12-10 23:12:22 +0100
commitb2d2cf4f53748051ace835d27564cb2922c13db9 (patch)
tree02004c36772311bdc1ba6b9a2508b20691cca5c6 /src
parent12cd785edb4aa147790fda4371aaab485fde42fe (diff)
parentb8ee91d4bebd10eb49a1f1951402882779d828c2 (diff)
Merge branch 'master' of ssh://oroborus@repo.or.cz/srv/git/tuxanci
Diffstat (limited to 'src')
-rw-r--r--src/audio/audio.c11
-rw-r--r--src/audio/music.c35
-rw-r--r--src/audio/music.h16
-rw-r--r--src/audio/sound.c18
-rw-r--r--src/audio/sound.h16
-rw-r--r--src/server/publicServer.c3
6 files changed, 53 insertions, 46 deletions
diff --git a/src/audio/audio.c b/src/audio/audio.c
index 9d629eb..14297af 100644
--- a/src/audio/audio.c
+++ b/src/audio/audio.c
@@ -8,6 +8,7 @@
#include "interface.h"
static bool_t isAudioInit = FALSE;
+
/*
* Returns state of audio
*/
@@ -17,16 +18,16 @@ bool_t isAudioInicialized()
}
/*
- * Inicialize audio
+ * Initialize audio
*/
void initAudio()
{
- if (isParamFlag("--noaudio")) {
+ if (isParamFlag("--no-audio")) {
return;
}
if (SDL_Init(SDL_INIT_AUDIO) == -1) {
- fprintf(stderr, _("Unable to initialize audio: %s\n"), SDL_GetError());
+ fprintf(stderr, _("Error! Unable to initialize audio: %s\n"), SDL_GetError());
return;
}
@@ -40,7 +41,7 @@ void initAudio()
Mix_AllocateChannels(16);
Mix_Volume(-1, MIX_MAX_VOLUME);
- DEBUG_MSG(_("Initializing audio system...\n"));
+ DEBUG_MSG(_("Initializing audio\n"));
isAudioInit = TRUE;
}
@@ -53,5 +54,5 @@ void quitAudio()
Mix_CloseAudio();
isAudioInit = TRUE;
- DEBUG_MSG(_("Quitting audio...\n"));
+ DEBUG_MSG(_("Quitting audio\n"));
}
diff --git a/src/audio/music.c b/src/audio/music.c
index 5af9dda..feabb90 100644
--- a/src/audio/music.c
+++ b/src/audio/music.c
@@ -15,6 +15,7 @@ static list_t *listStorage;
static bool_t isMusicInit = FALSE;
static bool_t var_isMusicActive = TRUE;
static Mix_Music *currentMusic;
+
/*
* Return state of music initialization
*/
@@ -38,24 +39,24 @@ void initMusic()
isMusicInit = TRUE;
var_isMusicActive = TRUE;
- if (isParamFlag("--nomusic"))
+ if (isParamFlag("--no-music"))
setMusicActive(FALSE);
if (isParamFlag("--music"))
setMusicActive(TRUE);
- DEBUG_MSG(_("Initializing music...\n"));
+ DEBUG_MSG(_("Initializing music\n"));
}
/*
- * Load music file and returns it
+ * Load a file with music and returns it
*/
static Mix_Music *loadMixMusic(char *file)
{
Mix_Music *mixer;
char str[STR_PATH_SIZE];
- DEBUG_MSG(_("Loading music file: %s\n"), file);
+ DEBUG_MSG(_("Loading a file with music: %s\n"), file);
if (isFillPath(file)) {
strcpy(str, file);
@@ -68,7 +69,7 @@ static Mix_Music *loadMixMusic(char *file)
mixer = Mix_LoadMUS(str);
if (mixer == NULL) {
- fprintf(stderr, _("Unable to load music from file: %s\n"), file);
+ fprintf(stderr, _("Unable to load music from file %s\n"), file);
return NULL;
}
@@ -80,8 +81,9 @@ static Mix_Music *loadMixMusic(char *file)
*/
static void playMixMusic()
{
- if (currentMusic != NULL)
+ if (currentMusic != NULL) {
Mix_PlayMusic(currentMusic, 1000);
+ }
}
/*
@@ -115,11 +117,12 @@ void addMusic(char *file, char *name, char *group)
*/
void stopMusic()
{
- if (isMusicInit == FALSE || var_isMusicActive == FALSE)
+ if (isMusicInit == FALSE || var_isMusicActive == FALSE) {
return;
+ }
if (currentMusic != NULL) {
- DEBUG_MSG(_("Stopping music...\n"));
+ DEBUG_MSG(_("Stopping music\n"));
Mix_HaltMusic();
currentMusic = NULL;
@@ -127,7 +130,7 @@ void stopMusic()
}
/*
- * start music playback
+ * Play music playback
*/
void playMusic(char *name, char *group)
{
@@ -145,27 +148,28 @@ void playMusic(char *name, char *group)
return;
if (currentMusic != NULL &&
- strcmp(currentMusic_group, group) == 0 &&
- strcmp(currentMusic_name, name) == 0) {
+ strcmp(currentMusic_group, group) == 0 &&
+ strcmp(currentMusic_name, name) == 0) {
return;
}
- if (currentMusic != NULL)
+ if (currentMusic != NULL) {
stopMusic();
+ }
currentMusic = getItemFromStorage(listStorage, group, name);
strcpy(currentMusic_group, group);
strcpy(currentMusic_name, name);
if (currentMusic != NULL) {
- DEBUG_MSG(_("Playing music file %s\n"), name);
+ DEBUG_MSG(_("Playing music from file %s\n"), name);
playMixMusic();
}
}
/*
- * Set music active/deactivated
+ * Set music status to active/inactive
*/
void setMusicActive(bool_t n)
{
@@ -206,6 +210,7 @@ void delAllMusicInGroup(char *group)
{
if (isMusicInit == FALSE)
return;
+
delAllItemFromStorage(listStorage, group, destroyMusic);
}
@@ -221,5 +226,5 @@ void quitMusic()
destroyStorage(listStorage, destroyMusic);
isMusicInit = FALSE;
- DEBUG_MSG(_("Quitting music...\n"));
+ DEBUG_MSG(_("Quitting music\n"));
}
diff --git a/src/audio/music.h b/src/audio/music.h
index 1b0e1fb..17e4409 100644
--- a/src/audio/music.h
+++ b/src/audio/music.h
@@ -8,14 +8,14 @@
# define MUSIC_GROUP_BASE "base"
# define MUSIC_GROUP_USER "user"
- /*
- typedef struct music_struct
- {
- char *name;
- int group;
- Mix_Music *music;
- } music_t;
- */
+/*
+ typedef struct music_struct
+ {
+ char *name;
+ int group;
+ Mix_Music *music;
+ } music_t;
+ */
extern bool_t isMusicInicialized();
extern void initMusic();
diff --git a/src/audio/sound.c b/src/audio/sound.c
index 63d4566..dee6c2d 100644
--- a/src/audio/sound.c
+++ b/src/audio/sound.c
@@ -13,8 +13,9 @@
static list_t *listStorage;
static bool_t isSoundInit = FALSE;
static bool_t var_isSoundActive = TRUE;
+
/*
- * Return state of sound
+ * Return status of sound
*/
bool_t isSoundInicialized()
{
@@ -22,7 +23,7 @@ bool_t isSoundInicialized()
}
/*
- * Audio initialization
+ * Initialize sound
*/
void initSound()
{
@@ -35,18 +36,18 @@ void initSound()
isSoundInit = TRUE;
var_isSoundActive = TRUE;
- if (isParamFlag("--nosound"))
+ if (isParamFlag("--no-sound"))
setSoundActive(FALSE);
if (isParamFlag("--sound"))
setSoundActive(TRUE);
- DEBUG_MSG(_("Initializing sound...\n"));
+ DEBUG_MSG(_("Initializing sound\n"));
}
/*
- * Load sound file (Null/mixer)
+ * Load sound from file (Null/mixer)
*/
static Mix_Chunk *loadMixSound(char *file)
{
@@ -60,7 +61,7 @@ static Mix_Chunk *loadMixSound(char *file)
new = Mix_LoadWAV(str);
if (new == NULL) {
- fprintf(stderr, _("Unable to load sound file: %s with error: %s\n"), str, Mix_GetError());
+ fprintf(stderr, _("Unable to load sound from file %s with error: %s\n"), str, Mix_GetError());
return NULL;
}
@@ -73,7 +74,7 @@ static Mix_Chunk *loadMixSound(char *file)
static void playMixSound(Mix_Chunk * p)
{
if (Mix_PlayChannel(-1, p, 0) == -1) {
- fprintf(stderr, _("Unable to playback sound with error: %s\n"), Mix_GetError());
+ fprintf(stderr, _("Unable to play sound with error: %s\n"), Mix_GetError());
return;
}
}
@@ -138,8 +139,9 @@ void quitSound()
{
if (isSoundInit == FALSE)
return;
+
destroyStorage(listStorage, destroySound);
isSoundInit = FALSE;
- DEBUG_MSG(_("Quitting sound...\n"));
+ DEBUG_MSG(_("Quitting sound\n"));
}
diff --git a/src/audio/sound.h b/src/audio/sound.h
index f63af13..a5d69d4 100644
--- a/src/audio/sound.h
+++ b/src/audio/sound.h
@@ -8,14 +8,14 @@
# define SOUND_GROUP_BASE "base"
# define SOUND_GROUP_USER "user"
- /*
- typedef struct sound_struct
- {
- char *name;
- int group;
- Mix_Chunk *sound;
- } sound_t;
- */
+/*
+ typedef struct sound_struct
+ {
+ char *name;
+ int group;
+ Mix_Chunk *sound;
+ } sound_t;
+ */
extern bool_t isSoundInicialized();
extern void initSound();
diff --git a/src/server/publicServer.c b/src/server/publicServer.c
index 10ac39f..ccf044f 100644
--- a/src/server/publicServer.c
+++ b/src/server/publicServer.c
@@ -226,8 +226,7 @@ static void loadArena()
{
choice_arenaFile = getArenaFileFormNetName(getSetting("ARENA", "--arena", "FAGN"));
- if( choice_arenaFile == NULL )
- {
+ if (choice_arenaFile == NULL) {
fprintf(stderr, _("I dont load arena %s!\n"), getSetting("ARENA", "--arena", "FAGN"));
exit(-1);
}