summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBjørn Lindeijer <bjorn@lindeijer.nl>2004-12-29 14:12:39 +0000
committerBjørn Lindeijer <bjorn@lindeijer.nl>2004-12-29 14:12:39 +0000
commit4988b2ae63413a754196b915c2de34f74ad3ce8d (patch)
treec4a761a6ed2fe0df0706af05631ba05968ae4e78 /src
parentb2ee6c2da10288415e597d254a7694f7ddccbc78 (diff)
downloadmana-client-4988b2ae63413a754196b915c2de34f74ad3ce8d.tar.gz
mana-client-4988b2ae63413a754196b915c2de34f74ad3ce8d.tar.bz2
mana-client-4988b2ae63413a754196b915c2de34f74ad3ce8d.tar.xz
mana-client-4988b2ae63413a754196b915c2de34f74ad3ce8d.zip
Changes to disable sound on Windows.
Diffstat (limited to 'src')
-rw-r--r--src/game.cpp12
-rw-r--r--src/gui/setup.cpp55
-rw-r--r--src/main.cpp8
-rw-r--r--src/sound/sound.cpp7
-rw-r--r--src/sound/sound.h2
5 files changed, 56 insertions, 28 deletions
diff --git a/src/game.cpp b/src/game.cpp
index 4419b00c..1c12a5d9 100644
--- a/src/game.cpp
+++ b/src/game.cpp
@@ -38,7 +38,9 @@
char map_path[480];
+#ifndef WIN32
extern Sound sound;
+#endif /* not WIN32 */
unsigned short dest_x, dest_y, src_x, src_y;
unsigned int player_x, player_y;
@@ -119,7 +121,9 @@ void do_init() {
error("Could not find map file");
}
+#ifndef WIN32
sound.startBgm("./data/sound/Mods/somemp.xm", -1);
+#endif /* not WIN32 */
// Initialize timers
tick_time = 0;
@@ -279,12 +283,14 @@ bool handle_key(int unicode, int scancode)
case KEY_F1:
save_bitmap("./data/graphic/screenshot.bmp", buffer, NULL);
return true;
+#ifndef WIN32
case KEY_F12:
sound.adjustVolume(1);
return true;
case KEY_F11:
sound.adjustVolume(-1);
return true;
+#endif /* not WIN32 */
case KEY_F9:
setup = Setup::create_setup();
return true;
@@ -715,9 +721,11 @@ void do_parse() {
// Level up
case 0x019b:
if(RFIFOL(2)==player_node->id) {
+#ifndef WIN32
SOUND_SID sound_id = sound.loadItem("./data/sound/wavs/level.wav");
- sound.startItem(sound_id, 64);
- sound.clearCache();
+ sound.startItem(sound_id, 64);
+ sound.clearCache();
+#endif /* not WIN32 */
}
break;
// Emotion
diff --git a/src/gui/setup.cpp b/src/gui/setup.cpp
index d4396408..5be5fe5f 100644
--- a/src/gui/setup.cpp
+++ b/src/gui/setup.cpp
@@ -28,7 +28,9 @@
#include "setup.h"
+#ifndef WIN32
extern Sound sound;
+#endif /* no WIN32 */
/*
* Metod returns the number of elements in container
@@ -137,32 +139,33 @@ Setup::~Setup() {
*/
void Setup::action(const std::string& eventId)
{
- if(eventId == "apply") {
- setVisible(false);
+ if (eventId == "apply") {
+ setVisible(false);
- /* Display settings */
- if(fsCheckBox->isMarked() == true && config.getValue("screen",0) == 2) {
- config.setValue("screen",1);
- set_gfx_mode(GFX_AUTODETECT_FULLSCREEN,800,600,0,0);
-
- } else
- if(fsCheckBox->isMarked() == false && config.getValue("screen",0) == 1) {
- config.setValue("screen",2);
- set_gfx_mode(GFX_AUTODETECT_WINDOWED,800,600,0,0);
- }
+ /* Display settings */
+ if (fsCheckBox->isMarked() == true && config.getValue("screen",0) == 2) {
+ config.setValue("screen",1);
+ set_gfx_mode(GFX_AUTODETECT_FULLSCREEN,800,600,0,0);
+
+ } else
+ if (fsCheckBox->isMarked() == false && config.getValue("screen",0) == 1) {
+ config.setValue("screen",2);
+ set_gfx_mode(GFX_AUTODETECT_WINDOWED,800,600,0,0);
+ }
- /* Sound settings */
- if(soundCheckBox->isMarked() == true) {
+ /* Sound settings */
+#ifndef WIN32
+ if (soundCheckBox->isMarked() == true) {
config.setValue("sound",1);
sound.init(32, 20);
- } else {
- config.setValue("sound",0);
+ } else {
+ config.setValue("sound",0);
sound.close();
+ }
+#endif /* not WIN32 */
+ } else if(eventId == "cancel") {
+ setVisible(false);
}
-
- } else if(eventId == "cancel") {
- setVisible(false);
- }
}
/*
@@ -170,11 +173,13 @@ void Setup::action(const std::string& eventId)
*/
Setup * Setup::ptr = NULL;
Setup * Setup::create_setup() {
- if(ptr == NULL)
- ptr = new Setup(guiTop);
- else
- ptr->setVisible(true);
+ if(ptr == NULL) {
+ ptr = new Setup(guiTop);
+ }
+ else {
+ ptr->setVisible(true);
+ }
- return ptr;
+ return ptr;
}
diff --git a/src/main.cpp b/src/main.cpp
index eb830773..ffbd4f5a 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -91,7 +91,9 @@ unsigned char stretch_mode, screen_mode;
char *dir;
// new sound-engine /- kth5
+#ifndef WIN32
Sound sound;
+#endif /* not WIN32 */
// ini file configuration reader
Configuration config;
@@ -267,7 +269,9 @@ void exit_engine() {
config.write(dir);
delete dir;
gui_exit();
+#ifndef WIN32
SDL_Quit();
+#endif /* not WIN32 */
destroy_bitmap(buffer);
allegro_exit();
}
@@ -275,6 +279,7 @@ void exit_engine() {
/** Main */
int main() {
init_engine();
+#ifndef WIN32
// initialize sound-engine and start playing intro-theme /-kth5
try {
if (config.getValue("sound", 0) == 1) {
@@ -290,6 +295,7 @@ int main() {
ok("Sound Engine", err);
warning(err);
}
+#endif /* not WIN32 */
while (state != EXIT) {
switch(state) {
@@ -306,7 +312,9 @@ int main() {
charSelect();
break;
case GAME:
+#ifndef WIN32
sound.stopBgm();
+#endif /* not WIN32 */
status("GAME");
map_start();
if( state==GAME )
diff --git a/src/sound/sound.cpp b/src/sound/sound.cpp
index 2505f203..8ec29d7b 100644
--- a/src/sound/sound.cpp
+++ b/src/sound/sound.cpp
@@ -19,11 +19,14 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
+#ifndef WIN32
+
+#include "sound.h"
+
#ifdef WIN32
#pragma warning(disable:4312)
#endif
-#include "sound.h"
/**
\brief install the sound engine
@@ -233,3 +236,5 @@ bool Sound::isMaxVol(int vol) {
if( vol > 0 && vol < 128 ) return false;
else return true;
}
+
+#endif /* not WIN32 */
diff --git a/src/sound/sound.h b/src/sound/sound.h
index a1055b02..b0719854 100644
--- a/src/sound/sound.h
+++ b/src/sound/sound.h
@@ -22,6 +22,7 @@
#ifndef __SOUND_H
#define __SOUND_H
+#ifndef WIN32
#ifdef WIN32
#pragma warning(disable:4312)
@@ -82,4 +83,5 @@ class Sound {
bool isMaxVol(int);
};
+#endif /* not WIN32 */
#endif