Commit 3e07dd40 authored by edo9300's avatar edo9300

Added custom summoning music for specific monsters

parent 42b51d9c
...@@ -2583,12 +2583,13 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -2583,12 +2583,13 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
return true; return true;
} }
case MSG_SUMMONING: { case MSG_SUMMONING: {
mainGame->PlaySoundEffect("./sound/summon.wav");
unsigned int code = (unsigned int)BufferIO::ReadInt32(pbuf); unsigned int code = (unsigned int)BufferIO::ReadInt32(pbuf);
/*int cc = */mainGame->LocalPlayer(BufferIO::ReadInt8(pbuf)); /*int cc = */mainGame->LocalPlayer(BufferIO::ReadInt8(pbuf));
/*int cl = */BufferIO::ReadInt8(pbuf); /*int cl = */BufferIO::ReadInt8(pbuf);
/*int cs = */BufferIO::ReadInt8(pbuf); /*int cs = */BufferIO::ReadInt8(pbuf);
/*int cp = */BufferIO::ReadInt8(pbuf); /*int cp = */BufferIO::ReadInt8(pbuf);
if(!mainGame->PlayChant(code))
mainGame->PlaySoundEffect("./sound/summon.wav");
if(!mainGame->dInfo.isReplay || !mainGame->dInfo.isReplaySkiping) { if(!mainGame->dInfo.isReplay || !mainGame->dInfo.isReplaySkiping) {
myswprintf(event_string, dataManager.GetSysString(1603), dataManager.GetName(code)); myswprintf(event_string, dataManager.GetSysString(1603), dataManager.GetName(code));
mainGame->showcardcode = code; mainGame->showcardcode = code;
...@@ -2606,12 +2607,13 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -2606,12 +2607,13 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
return true; return true;
} }
case MSG_SPSUMMONING: { case MSG_SPSUMMONING: {
mainGame->PlaySoundEffect("./sound/specialsummon.wav");
unsigned int code = (unsigned int)BufferIO::ReadInt32(pbuf); unsigned int code = (unsigned int)BufferIO::ReadInt32(pbuf);
/*int cc = */mainGame->LocalPlayer(BufferIO::ReadInt8(pbuf)); /*int cc = */mainGame->LocalPlayer(BufferIO::ReadInt8(pbuf));
/*int cl = */BufferIO::ReadInt8(pbuf); /*int cl = */BufferIO::ReadInt8(pbuf);
/*int cs = */BufferIO::ReadInt8(pbuf); /*int cs = */BufferIO::ReadInt8(pbuf);
/*int cp = */BufferIO::ReadInt8(pbuf); /*int cp = */BufferIO::ReadInt8(pbuf);
if(!mainGame->PlayChant(code))
mainGame->PlaySoundEffect("./sound/specialsummon.wav");
if(!mainGame->dInfo.isReplay || !mainGame->dInfo.isReplaySkiping) { if(!mainGame->dInfo.isReplay || !mainGame->dInfo.isReplaySkiping) {
myswprintf(event_string, dataManager.GetSysString(1605), dataManager.GetName(code)); myswprintf(event_string, dataManager.GetSysString(1605), dataManager.GetName(code));
mainGame->showcardcode = code; mainGame->showcardcode = code;
...@@ -2628,12 +2630,13 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -2628,12 +2630,13 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
return true; return true;
} }
case MSG_FLIPSUMMONING: { case MSG_FLIPSUMMONING: {
mainGame->PlaySoundEffect("./sound/flip.wav");
unsigned int code = (unsigned int)BufferIO::ReadInt32(pbuf); unsigned int code = (unsigned int)BufferIO::ReadInt32(pbuf);
int cc = mainGame->LocalPlayer(BufferIO::ReadInt8(pbuf)); int cc = mainGame->LocalPlayer(BufferIO::ReadInt8(pbuf));
int cl = BufferIO::ReadInt8(pbuf); int cl = BufferIO::ReadInt8(pbuf);
int cs = BufferIO::ReadInt8(pbuf); int cs = BufferIO::ReadInt8(pbuf);
int cp = BufferIO::ReadInt8(pbuf); int cp = BufferIO::ReadInt8(pbuf);
if(!mainGame->PlayChant(code))
mainGame->PlaySoundEffect("./sound/flip.wav");
ClientCard* pcard = mainGame->dField.GetCard(cc, cl, cs); ClientCard* pcard = mainGame->dField.GetCard(cc, cl, cs);
pcard->SetCode(code); pcard->SetCode(code);
pcard->position = cp; pcard->position = cp;
......
...@@ -705,10 +705,12 @@ void Game::MainLoop() { ...@@ -705,10 +705,12 @@ void Game::MainLoop() {
driver->setMaterial(irr::video::IdentityMaterial); driver->setMaterial(irr::video::IdentityMaterial);
driver->clearZBuffer(); driver->clearZBuffer();
} else if(is_building) { } else if(is_building) {
engineSound->stopAllSounds();
DrawBackImage(imageManager.tBackGround_deck); DrawBackImage(imageManager.tBackGround_deck);
DrawDeckBd(); DrawDeckBd();
PlayMusic("./sound/deck.mp3", true); PlayMusic("./sound/deck.mp3", true);
} else { } else {
engineSound->stopAllSounds();
DrawBackImage(imageManager.tBackGround_menu); DrawBackImage(imageManager.tBackGround_menu);
PlayMusic("./sound/menu.mp3", true); PlayMusic("./sound/menu.mp3", true);
} }
...@@ -765,6 +767,7 @@ void Game::MainLoop() { ...@@ -765,6 +767,7 @@ void Game::MainLoop() {
usleep(500000); usleep(500000);
#endif #endif
SaveConfig(); SaveConfig();
engineSound->drop();
engineMusic->drop(); engineMusic->drop();
// device->drop(); // device->drop();
} }
...@@ -1150,6 +1153,18 @@ void Game::SaveConfig() { ...@@ -1150,6 +1153,18 @@ void Game::SaveConfig() {
fprintf(fp, "volume = %d\n", vol); fprintf(fp, "volume = %d\n", vol);
fclose(fp); fclose(fp);
} }
bool Game::PlayChant(unsigned int code) {
char sound[1000];
sprintf(sound, "./sound/chants/%d.wav", code);
FILE *file = fopen(sound, "r");
if(file) {
fclose(file);
if (!engineSound->isCurrentlyPlaying(sound))
PlaySoundEffect(sound);
return true;
}
return false;
}
void Game::PlaySoundEffect(char* sound) { void Game::PlaySoundEffect(char* sound) {
if(chkEnableSound->isChecked()) { if(chkEnableSound->isChecked()) {
engineSound->play2D(sound); engineSound->play2D(sound);
......
...@@ -120,6 +120,7 @@ public: ...@@ -120,6 +120,7 @@ public:
void AddDebugMsg(char* msgbuf); void AddDebugMsg(char* msgbuf);
void ClearTextures(); void ClearTextures();
void CloseDuelWindow(); void CloseDuelWindow();
bool PlayChant(unsigned int code);
void PlaySoundEffect(char* sound); void PlaySoundEffect(char* sound);
void PlayMusic(char* song, bool loop); void PlayMusic(char* song, bool loop);
void PlayBGM(); void PlayBGM();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment