Commit 78dcf33c authored by edo9300's avatar edo9300

Merge remote-tracking branch 'refs/remotes/origin/master' into advanced-rules--tset

parents 1a754caf 3e07dd40
......@@ -2605,12 +2605,13 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
return true;
}
case MSG_SUMMONING: {
mainGame->PlaySoundEffect("./sound/summon.wav");
unsigned int code = (unsigned int)BufferIO::ReadInt32(pbuf);
/*int cc = */mainGame->LocalPlayer(BufferIO::ReadInt8(pbuf));
/*int cl = */BufferIO::ReadInt8(pbuf);
/*int cs = */BufferIO::ReadInt8(pbuf);
/*int cp = */BufferIO::ReadInt8(pbuf);
if(!mainGame->PlayChant(code))
mainGame->PlaySoundEffect("./sound/summon.wav");
if(!mainGame->dInfo.isReplay || !mainGame->dInfo.isReplaySkiping) {
myswprintf(event_string, dataManager.GetSysString(1603), dataManager.GetName(code));
mainGame->showcardcode = code;
......@@ -2628,12 +2629,13 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
return true;
}
case MSG_SPSUMMONING: {
mainGame->PlaySoundEffect("./sound/specialsummon.wav");
unsigned int code = (unsigned int)BufferIO::ReadInt32(pbuf);
/*int cc = */mainGame->LocalPlayer(BufferIO::ReadInt8(pbuf));
/*int cl = */BufferIO::ReadInt8(pbuf);
/*int cs = */BufferIO::ReadInt8(pbuf);
/*int cp = */BufferIO::ReadInt8(pbuf);
if(!mainGame->PlayChant(code))
mainGame->PlaySoundEffect("./sound/specialsummon.wav");
if(!mainGame->dInfo.isReplay || !mainGame->dInfo.isReplaySkiping) {
myswprintf(event_string, dataManager.GetSysString(1605), dataManager.GetName(code));
mainGame->showcardcode = code;
......@@ -2650,12 +2652,13 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
return true;
}
case MSG_FLIPSUMMONING: {
mainGame->PlaySoundEffect("./sound/flip.wav");
unsigned int code = (unsigned int)BufferIO::ReadInt32(pbuf);
int cc = mainGame->LocalPlayer(BufferIO::ReadInt8(pbuf));
int cl = BufferIO::ReadInt8(pbuf);
int cs = 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);
pcard->SetCode(code);
pcard->position = cp;
......
......@@ -716,10 +716,12 @@ void Game::MainLoop() {
driver->setMaterial(irr::video::IdentityMaterial);
driver->clearZBuffer();
} else if(is_building) {
engineSound->stopAllSounds();
DrawBackImage(imageManager.tBackGround_deck);
DrawDeckBd();
PlayMusic("./sound/deck.mp3", true);
} else {
engineSound->stopAllSounds();
DrawBackImage(imageManager.tBackGround_menu);
PlayMusic("./sound/menu.mp3", true);
}
......@@ -776,6 +778,7 @@ void Game::MainLoop() {
usleep(500000);
#endif
SaveConfig();
engineSound->drop();
engineMusic->drop();
// device->drop();
}
......@@ -1161,6 +1164,18 @@ void Game::SaveConfig() {
fprintf(fp, "volume = %d\n", vol);
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) {
if(chkEnableSound->isChecked()) {
engineSound->play2D(sound);
......
......@@ -120,6 +120,7 @@ public:
void AddDebugMsg(char* msgbuf);
void ClearTextures();
void CloseDuelWindow();
bool PlayChant(unsigned int code);
void PlaySoundEffect(char* sound);
void PlayMusic(char* song, bool loop);
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