Commit b61b06cf authored by mercury233's avatar mercury233

Merge branch 'sound' into link

parents 1cf89afc b8e25078
...@@ -169,6 +169,7 @@ void DuelClient::ClientEvent(bufferevent *bev, short events, void *ctx) { ...@@ -169,6 +169,7 @@ void DuelClient::ClientEvent(bufferevent *bev, short events, void *ctx) {
mainGame->closeDoneSignal.Wait(); mainGame->closeDoneSignal.Wait();
mainGame->gMutex.Lock(); mainGame->gMutex.Lock();
mainGame->dInfo.isStarted = false; mainGame->dInfo.isStarted = false;
mainGame->dInfo.isFinished = false;
mainGame->is_building = false; mainGame->is_building = false;
mainGame->device->setEventReceiver(&mainGame->menuHandler); mainGame->device->setEventReceiver(&mainGame->menuHandler);
mainGame->ShowElement(mainGame->wLanWindow); mainGame->ShowElement(mainGame->wLanWindow);
...@@ -449,6 +450,7 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) { ...@@ -449,6 +450,7 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) {
mainGame->gMutex.Lock(); mainGame->gMutex.Lock();
mainGame->dField.Clear(); mainGame->dField.Clear();
mainGame->dInfo.isStarted = true; mainGame->dInfo.isStarted = true;
mainGame->dInfo.isFinished = false;
mainGame->dInfo.lp[0] = 0; mainGame->dInfo.lp[0] = 0;
mainGame->dInfo.lp[1] = 0; mainGame->dInfo.lp[1] = 0;
mainGame->dInfo.strLP[0][0] = 0; mainGame->dInfo.strLP[0][0] = 0;
...@@ -529,6 +531,7 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) { ...@@ -529,6 +531,7 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) {
mainGame->closeDoneSignal.Wait(); mainGame->closeDoneSignal.Wait();
mainGame->gMutex.Lock(); mainGame->gMutex.Lock();
mainGame->dInfo.isStarted = false; mainGame->dInfo.isStarted = false;
mainGame->dInfo.isFinished = true;
mainGame->is_building = false; mainGame->is_building = false;
mainGame->wDeckEdit->setVisible(false); mainGame->wDeckEdit->setVisible(false);
mainGame->btnCreateHost->setEnabled(true); mainGame->btnCreateHost->setEnabled(true);
...@@ -744,6 +747,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -744,6 +747,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
mainGame->closeDoneSignal.Wait(); mainGame->closeDoneSignal.Wait();
mainGame->gMutex.Lock(); mainGame->gMutex.Lock();
mainGame->dInfo.isStarted = false; mainGame->dInfo.isStarted = false;
mainGame->dInfo.isFinished = false;
mainGame->btnCreateHost->setEnabled(true); mainGame->btnCreateHost->setEnabled(true);
mainGame->btnJoinHost->setEnabled(true); mainGame->btnJoinHost->setEnabled(true);
mainGame->btnJoinCancel->setEnabled(true); mainGame->btnJoinCancel->setEnabled(true);
...@@ -853,6 +857,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -853,6 +857,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
break; break;
} }
case MSG_WIN: { case MSG_WIN: {
mainGame->dInfo.isFinished = true;
int player = BufferIO::ReadInt8(pbuf); int player = BufferIO::ReadInt8(pbuf);
int type = BufferIO::ReadInt8(pbuf); int type = BufferIO::ReadInt8(pbuf);
mainGame->showcarddif = 110; mainGame->showcarddif = 110;
...@@ -1595,6 +1600,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -1595,6 +1600,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
} }
if(mainGame->dInfo.isReplay && mainGame->dInfo.isReplaySkiping) if(mainGame->dInfo.isReplay && mainGame->dInfo.isReplaySkiping)
return true; return true;
mainGame->PlaySoundEffect(SOUND_REVEAL);
myswprintf(textBuffer, dataManager.GetSysString(207), count); myswprintf(textBuffer, dataManager.GetSysString(207), count);
mainGame->lstLog->addItem(textBuffer); mainGame->lstLog->addItem(textBuffer);
mainGame->logParam.push_back(0); mainGame->logParam.push_back(0);
...@@ -1620,7 +1626,6 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -1620,7 +1626,6 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
return true; return true;
} }
case MSG_CONFIRM_CARDS: { case MSG_CONFIRM_CARDS: {
mainGame->PlaySoundEffect(SOUND_REVEAL);
/*int player = */mainGame->LocalPlayer(BufferIO::ReadInt8(pbuf)); /*int player = */mainGame->LocalPlayer(BufferIO::ReadInt8(pbuf));
int count = BufferIO::ReadInt8(pbuf); int count = BufferIO::ReadInt8(pbuf);
int code, c, l, s; int code, c, l, s;
...@@ -1631,6 +1636,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -1631,6 +1636,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
pbuf += count * 7; pbuf += count * 7;
return true; return true;
} }
mainGame->PlaySoundEffect(SOUND_REVEAL);
myswprintf(textBuffer, dataManager.GetSysString(208), count); myswprintf(textBuffer, dataManager.GetSysString(208), count);
mainGame->lstLog->addItem(textBuffer); mainGame->lstLog->addItem(textBuffer);
mainGame->logParam.push_back(0); mainGame->logParam.push_back(0);
...@@ -1722,7 +1728,6 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -1722,7 +1728,6 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
return true; return true;
} }
case MSG_SHUFFLE_DECK: { case MSG_SHUFFLE_DECK: {
mainGame->PlaySoundEffect(SOUND_SHUFFLE);
int player = mainGame->LocalPlayer(BufferIO::ReadInt8(pbuf)); int player = mainGame->LocalPlayer(BufferIO::ReadInt8(pbuf));
if(mainGame->dField.deck[player].size() < 2) if(mainGame->dField.deck[player].size() < 2)
return true; return true;
...@@ -1740,6 +1745,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -1740,6 +1745,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
mainGame->dField.deck[player][i]->is_reversed = false; mainGame->dField.deck[player][i]->is_reversed = false;
} }
if(!mainGame->dInfo.isReplay || !mainGame->dInfo.isReplaySkiping) { if(!mainGame->dInfo.isReplay || !mainGame->dInfo.isReplaySkiping) {
mainGame->PlaySoundEffect(SOUND_SHUFFLE);
for (int i = 0; i < 5; ++i) { for (int i = 0; i < 5; ++i) {
for (auto cit = mainGame->dField.deck[player].begin(); cit != mainGame->dField.deck[player].end(); ++cit) { for (auto cit = mainGame->dField.deck[player].begin(); cit != mainGame->dField.deck[player].end(); ++cit) {
(*cit)->dPos = irr::core::vector3df(rand() * 0.4f / RAND_MAX - 0.2f, 0, 0); (*cit)->dPos = irr::core::vector3df(rand() * 0.4f / RAND_MAX - 0.2f, 0, 0);
...@@ -1764,6 +1770,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -1764,6 +1770,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
int player = mainGame->LocalPlayer(BufferIO::ReadInt8(pbuf)); int player = mainGame->LocalPlayer(BufferIO::ReadInt8(pbuf));
/*int count = */BufferIO::ReadInt8(pbuf); /*int count = */BufferIO::ReadInt8(pbuf);
if(!mainGame->dInfo.isReplay || !mainGame->dInfo.isReplaySkiping) { if(!mainGame->dInfo.isReplay || !mainGame->dInfo.isReplaySkiping) {
mainGame->PlaySoundEffect(SOUND_SHUFFLE);
mainGame->WaitFrameSignal(5); mainGame->WaitFrameSignal(5);
if(player == 1 && !mainGame->dInfo.isReplay && !mainGame->dInfo.isSingleMode) { if(player == 1 && !mainGame->dInfo.isReplay && !mainGame->dInfo.isSingleMode) {
bool flip = false; bool flip = false;
...@@ -1907,6 +1914,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -1907,6 +1914,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
} }
} }
if(!mainGame->dInfo.isReplay || !mainGame->dInfo.isReplaySkiping) { if(!mainGame->dInfo.isReplay || !mainGame->dInfo.isReplaySkiping) {
mainGame->PlaySoundEffect(SOUND_SHUFFLE);
for (int i = 0; i < count; ++i) { for (int i = 0; i < count; ++i) {
mainGame->dField.MoveCard(mc[i], 10); mainGame->dField.MoveCard(mc[i], 10);
for (cit = mc[i]->overlayed.begin(); cit != mc[i]->overlayed.end(); ++cit) for (cit = mc[i]->overlayed.begin(); cit != mc[i]->overlayed.end(); ++cit)
...@@ -1917,7 +1925,6 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -1917,7 +1925,6 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
return true; return true;
} }
case MSG_NEW_TURN: { case MSG_NEW_TURN: {
mainGame->PlaySoundEffect(SOUND_NEXT_TURN);
int player = mainGame->LocalPlayer(BufferIO::ReadInt8(pbuf)); int player = mainGame->LocalPlayer(BufferIO::ReadInt8(pbuf));
mainGame->dInfo.turn++; mainGame->dInfo.turn++;
if(!mainGame->dInfo.isTag && !mainGame->dInfo.isReplay && mainGame->dInfo.player_type < 7) { if(!mainGame->dInfo.isTag && !mainGame->dInfo.isReplay && mainGame->dInfo.player_type < 7) {
...@@ -1944,6 +1951,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -1944,6 +1951,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
mainGame->dInfo.tag_player[1] = !mainGame->dInfo.tag_player[1]; mainGame->dInfo.tag_player[1] = !mainGame->dInfo.tag_player[1];
} }
if(!mainGame->dInfo.isReplay || !mainGame->dInfo.isReplaySkiping) { if(!mainGame->dInfo.isReplay || !mainGame->dInfo.isReplaySkiping) {
mainGame->PlaySoundEffect(SOUND_NEXT_TURN);
mainGame->showcardcode = 10; mainGame->showcardcode = 10;
mainGame->showcarddif = 30; mainGame->showcarddif = 30;
mainGame->showcardp = 0; mainGame->showcardp = 0;
...@@ -1954,7 +1962,6 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -1954,7 +1962,6 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
return true; return true;
} }
case MSG_NEW_PHASE: { case MSG_NEW_PHASE: {
mainGame->PlaySoundEffect(SOUND_PHASE);
unsigned short phase = BufferIO::ReadInt16(pbuf); unsigned short phase = BufferIO::ReadInt16(pbuf);
mainGame->btnPhaseStatus->setVisible(false); mainGame->btnPhaseStatus->setVisible(false);
mainGame->btnBP->setVisible(false); mainGame->btnBP->setVisible(false);
...@@ -1992,6 +1999,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -1992,6 +1999,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
mainGame->btnPhaseStatus->setPressed(true); mainGame->btnPhaseStatus->setPressed(true);
mainGame->btnPhaseStatus->setVisible(true); mainGame->btnPhaseStatus->setVisible(true);
if(!mainGame->dInfo.isReplay || !mainGame->dInfo.isReplaySkiping) { if(!mainGame->dInfo.isReplay || !mainGame->dInfo.isReplaySkiping) {
mainGame->PlaySoundEffect(SOUND_PHASE);
mainGame->showcard = 101; mainGame->showcard = 101;
mainGame->WaitFrameSignal(40); mainGame->WaitFrameSignal(40);
mainGame->showcard = 0; mainGame->showcard = 0;
...@@ -2009,10 +2017,12 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -2009,10 +2017,12 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
int cs = BufferIO::ReadInt8(pbuf); int cs = BufferIO::ReadInt8(pbuf);
int cp = BufferIO::ReadInt8(pbuf); int cp = BufferIO::ReadInt8(pbuf);
int reason = BufferIO::ReadInt32(pbuf); int reason = BufferIO::ReadInt32(pbuf);
if(!mainGame->dInfo.isReplay || !mainGame->dInfo.isReplaySkiping) {
if(cl & LOCATION_REMOVED) if(cl & LOCATION_REMOVED)
mainGame->PlaySoundEffect(SOUND_BANISHED); mainGame->PlaySoundEffect(SOUND_BANISHED);
else if(reason & REASON_DESTROY && pl != cl) else if(reason & REASON_DESTROY && pl != cl)
mainGame->PlaySoundEffect(SOUND_DESTROYED); mainGame->PlaySoundEffect(SOUND_DESTROYED);
}
if (pl == 0) { if (pl == 0) {
ClientCard* pcard = new ClientCard(); ClientCard* pcard = new ClientCard();
pcard->position = cp; pcard->position = cp;
...@@ -2228,12 +2238,13 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -2228,12 +2238,13 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
return true; return true;
} }
case MSG_SET: { case MSG_SET: {
mainGame->PlaySoundEffect(SOUND_SET);
/*int code = */BufferIO::ReadInt32(pbuf); /*int code = */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->dInfo.isReplay || !mainGame->dInfo.isReplaySkiping)
mainGame->PlaySoundEffect(SOUND_SET);
myswprintf(event_string, dataManager.GetSysString(1601)); myswprintf(event_string, dataManager.GetSysString(1601));
return true; return true;
} }
...@@ -2281,13 +2292,13 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -2281,13 +2292,13 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
return true; return true;
} }
case MSG_SUMMONING: { case MSG_SUMMONING: {
mainGame->PlaySoundEffect(SOUND_SUMMON);
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->dInfo.isReplay || !mainGame->dInfo.isReplaySkiping) { if(!mainGame->dInfo.isReplay || !mainGame->dInfo.isReplaySkiping) {
mainGame->PlaySoundEffect(SOUND_SUMMON);
myswprintf(event_string, dataManager.GetSysString(1603), dataManager.GetName(code)); myswprintf(event_string, dataManager.GetSysString(1603), dataManager.GetName(code));
mainGame->showcardcode = code; mainGame->showcardcode = code;
mainGame->showcarddif = 0; mainGame->showcarddif = 0;
...@@ -2304,13 +2315,17 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -2304,13 +2315,17 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
return true; return true;
} }
case MSG_SPSUMMONING: { case MSG_SPSUMMONING: {
mainGame->PlaySoundEffect(SOUND_SPECIAL_SUMMON);
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->dInfo.isReplay || !mainGame->dInfo.isReplaySkiping) { if(!mainGame->dInfo.isReplay || !mainGame->dInfo.isReplaySkiping) {
CardData cd;
if(dataManager.GetData(code, &cd) && (cd.type & TYPE_TOKEN))
mainGame->PlaySoundEffect(SOUND_TOKEN);
else
mainGame->PlaySoundEffect(SOUND_SPECIAL_SUMMON);
myswprintf(event_string, dataManager.GetSysString(1605), dataManager.GetName(code)); myswprintf(event_string, dataManager.GetSysString(1605), dataManager.GetName(code));
mainGame->showcardcode = code; mainGame->showcardcode = code;
mainGame->showcarddif = 1; mainGame->showcarddif = 1;
...@@ -2326,7 +2341,6 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -2326,7 +2341,6 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
return true; return true;
} }
case MSG_FLIPSUMMONING: { case MSG_FLIPSUMMONING: {
mainGame->PlaySoundEffect(SOUND_FILP);
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);
...@@ -2336,6 +2350,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -2336,6 +2350,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
pcard->SetCode(code); pcard->SetCode(code);
pcard->position = cp; pcard->position = cp;
if(!mainGame->dInfo.isReplay || !mainGame->dInfo.isReplaySkiping) { if(!mainGame->dInfo.isReplay || !mainGame->dInfo.isReplaySkiping) {
mainGame->PlaySoundEffect(SOUND_FILP);
myswprintf(event_string, dataManager.GetSysString(1607), dataManager.GetName(code)); myswprintf(event_string, dataManager.GetSysString(1607), dataManager.GetName(code));
mainGame->dField.MoveCard(pcard, 10); mainGame->dField.MoveCard(pcard, 10);
mainGame->WaitFrameSignal(11); mainGame->WaitFrameSignal(11);
...@@ -2354,7 +2369,6 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -2354,7 +2369,6 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
return true; return true;
} }
case MSG_CHAINING: { case MSG_CHAINING: {
mainGame->PlaySoundEffect(SOUND_ACTIVATE);
unsigned int code = (unsigned int)BufferIO::ReadInt32(pbuf); unsigned int code = (unsigned int)BufferIO::ReadInt32(pbuf);
int pcc = mainGame->LocalPlayer(BufferIO::ReadInt8(pbuf)); int pcc = mainGame->LocalPlayer(BufferIO::ReadInt8(pbuf));
int pcl = BufferIO::ReadInt8(pbuf); int pcl = BufferIO::ReadInt8(pbuf);
...@@ -2367,6 +2381,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -2367,6 +2381,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
/*int ct = */BufferIO::ReadInt8(pbuf); /*int ct = */BufferIO::ReadInt8(pbuf);
if(mainGame->dInfo.isReplay && mainGame->dInfo.isReplaySkiping) if(mainGame->dInfo.isReplay && mainGame->dInfo.isReplaySkiping)
return true; return true;
mainGame->PlaySoundEffect(SOUND_ACTIVATE);
ClientCard* pcard = mainGame->dField.GetCard(pcc, pcl, pcs, subs); ClientCard* pcard = mainGame->dField.GetCard(pcc, pcl, pcs, subs);
if(pcard->code != code) { if(pcard->code != code) {
pcard->code = code; pcard->code = code;
...@@ -2552,7 +2567,6 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -2552,7 +2567,6 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
return true; return true;
} }
case MSG_DAMAGE: { case MSG_DAMAGE: {
mainGame->PlaySoundEffect(SOUND_DAMAGE);
int player = mainGame->LocalPlayer(BufferIO::ReadInt8(pbuf)); int player = mainGame->LocalPlayer(BufferIO::ReadInt8(pbuf));
int val = BufferIO::ReadInt32(pbuf); int val = BufferIO::ReadInt32(pbuf);
int final = mainGame->dInfo.lp[player] - val; int final = mainGame->dInfo.lp[player] - val;
...@@ -2563,6 +2577,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -2563,6 +2577,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
myswprintf(mainGame->dInfo.strLP[player], L"%d", mainGame->dInfo.lp[player]); myswprintf(mainGame->dInfo.strLP[player], L"%d", mainGame->dInfo.lp[player]);
return true; return true;
} }
mainGame->PlaySoundEffect(SOUND_DAMAGE);
mainGame->lpd = (mainGame->dInfo.lp[player] - final) / 10; mainGame->lpd = (mainGame->dInfo.lp[player] - final) / 10;
if (player == 0) if (player == 0)
myswprintf(event_string, dataManager.GetSysString(1613), val); myswprintf(event_string, dataManager.GetSysString(1613), val);
...@@ -2583,7 +2598,6 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -2583,7 +2598,6 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
return true; return true;
} }
case MSG_RECOVER: { case MSG_RECOVER: {
mainGame->PlaySoundEffect(SOUND_RECOVER);
int player = mainGame->LocalPlayer(BufferIO::ReadInt8(pbuf)); int player = mainGame->LocalPlayer(BufferIO::ReadInt8(pbuf));
int val = BufferIO::ReadInt32(pbuf); int val = BufferIO::ReadInt32(pbuf);
int final = mainGame->dInfo.lp[player] + val; int final = mainGame->dInfo.lp[player] + val;
...@@ -2592,6 +2606,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -2592,6 +2606,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
myswprintf(mainGame->dInfo.strLP[player], L"%d", mainGame->dInfo.lp[player]); myswprintf(mainGame->dInfo.strLP[player], L"%d", mainGame->dInfo.lp[player]);
return true; return true;
} }
mainGame->PlaySoundEffect(SOUND_RECOVER);
mainGame->lpd = (mainGame->dInfo.lp[player] - final) / 10; mainGame->lpd = (mainGame->dInfo.lp[player] - final) / 10;
if (player == 0) if (player == 0)
myswprintf(event_string, dataManager.GetSysString(1615), val); myswprintf(event_string, dataManager.GetSysString(1615), val);
...@@ -2612,7 +2627,6 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -2612,7 +2627,6 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
return true; return true;
} }
case MSG_EQUIP: { case MSG_EQUIP: {
mainGame->PlaySoundEffect(SOUND_EQUIP);
int c1 = mainGame->LocalPlayer(BufferIO::ReadInt8(pbuf)); int c1 = mainGame->LocalPlayer(BufferIO::ReadInt8(pbuf));
int l1 = BufferIO::ReadInt8(pbuf); int l1 = BufferIO::ReadInt8(pbuf);
int s1 = BufferIO::ReadInt8(pbuf); int s1 = BufferIO::ReadInt8(pbuf);
...@@ -2629,6 +2643,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -2629,6 +2643,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
pc1->equipTarget = pc2; pc1->equipTarget = pc2;
pc2->equipped.insert(pc1); pc2->equipped.insert(pc1);
} else { } else {
mainGame->PlaySoundEffect(SOUND_EQUIP);
mainGame->gMutex.Lock(); mainGame->gMutex.Lock();
if(pc1->equipTarget) { if(pc1->equipTarget) {
pc1->is_showequip = false; pc1->is_showequip = false;
...@@ -2737,7 +2752,6 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -2737,7 +2752,6 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
break; break;
} }
case MSG_PAY_LPCOST: { case MSG_PAY_LPCOST: {
mainGame->PlaySoundEffect(SOUND_DAMAGE);
int player = mainGame->LocalPlayer(BufferIO::ReadInt8(pbuf)); int player = mainGame->LocalPlayer(BufferIO::ReadInt8(pbuf));
int cost = BufferIO::ReadInt32(pbuf); int cost = BufferIO::ReadInt32(pbuf);
int final = mainGame->dInfo.lp[player] - cost; int final = mainGame->dInfo.lp[player] - cost;
...@@ -2748,6 +2762,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -2748,6 +2762,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
myswprintf(mainGame->dInfo.strLP[player], L"%d", mainGame->dInfo.lp[player]); myswprintf(mainGame->dInfo.strLP[player], L"%d", mainGame->dInfo.lp[player]);
return true; return true;
} }
mainGame->PlaySoundEffect(SOUND_DAMAGE);
mainGame->lpd = (mainGame->dInfo.lp[player] - final) / 10; mainGame->lpd = (mainGame->dInfo.lp[player] - final) / 10;
mainGame->lpccolor = 0xff0000ff; mainGame->lpccolor = 0xff0000ff;
mainGame->lpplayer = player; mainGame->lpplayer = player;
...@@ -2764,7 +2779,6 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -2764,7 +2779,6 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
return true; return true;
} }
case MSG_ADD_COUNTER: { case MSG_ADD_COUNTER: {
mainGame->PlaySoundEffect(SOUND_COUNTER_ADD);
int type = BufferIO::ReadInt16(pbuf); int type = BufferIO::ReadInt16(pbuf);
int c = mainGame->LocalPlayer(BufferIO::ReadInt8(pbuf)); int c = mainGame->LocalPlayer(BufferIO::ReadInt8(pbuf));
int l = BufferIO::ReadInt8(pbuf); int l = BufferIO::ReadInt8(pbuf);
...@@ -2776,6 +2790,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -2776,6 +2790,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
else pc->counters[type] = count; else pc->counters[type] = count;
if(mainGame->dInfo.isReplay && mainGame->dInfo.isReplaySkiping) if(mainGame->dInfo.isReplay && mainGame->dInfo.isReplaySkiping)
return true; return true;
mainGame->PlaySoundEffect(SOUND_COUNTER_ADD);
myswprintf(textBuffer, dataManager.GetSysString(1617), dataManager.GetName(pc->code), count, dataManager.GetCounterName(type)); myswprintf(textBuffer, dataManager.GetSysString(1617), dataManager.GetName(pc->code), count, dataManager.GetCounterName(type));
pc->is_highlighting = true; pc->is_highlighting = true;
mainGame->gMutex.Lock(); mainGame->gMutex.Lock();
...@@ -2787,7 +2802,6 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -2787,7 +2802,6 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
return true; return true;
} }
case MSG_REMOVE_COUNTER: { case MSG_REMOVE_COUNTER: {
mainGame->PlaySoundEffect(SOUND_COUNTER_REMOVE);
int type = BufferIO::ReadInt16(pbuf); int type = BufferIO::ReadInt16(pbuf);
int c = mainGame->LocalPlayer(BufferIO::ReadInt8(pbuf)); int c = mainGame->LocalPlayer(BufferIO::ReadInt8(pbuf));
int l = BufferIO::ReadInt8(pbuf); int l = BufferIO::ReadInt8(pbuf);
...@@ -2799,6 +2813,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -2799,6 +2813,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
pc->counters.erase(type); pc->counters.erase(type);
if(mainGame->dInfo.isReplay && mainGame->dInfo.isReplaySkiping) if(mainGame->dInfo.isReplay && mainGame->dInfo.isReplaySkiping)
return true; return true;
mainGame->PlaySoundEffect(SOUND_COUNTER_REMOVE);
myswprintf(textBuffer, dataManager.GetSysString(1618), dataManager.GetName(pc->code), count, dataManager.GetCounterName(type)); myswprintf(textBuffer, dataManager.GetSysString(1618), dataManager.GetName(pc->code), count, dataManager.GetCounterName(type));
pc->is_highlighting = true; pc->is_highlighting = true;
mainGame->gMutex.Lock(); mainGame->gMutex.Lock();
...@@ -2819,14 +2834,11 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -2819,14 +2834,11 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
int ld = BufferIO::ReadInt8(pbuf); int ld = BufferIO::ReadInt8(pbuf);
int sd = BufferIO::ReadInt8(pbuf); int sd = BufferIO::ReadInt8(pbuf);
BufferIO::ReadInt8(pbuf); BufferIO::ReadInt8(pbuf);
if(ld != 0)
mainGame->PlaySoundEffect(SOUND_ATTACK);
else
mainGame->PlaySoundEffect(SOUND_DIRECT_ATTACK);
if(mainGame->dInfo.isReplay && mainGame->dInfo.isReplaySkiping) if(mainGame->dInfo.isReplay && mainGame->dInfo.isReplaySkiping)
return true; return true;
float sy; float sy;
if (ld != 0) { if (ld != 0) {
mainGame->PlaySoundEffect(SOUND_ATTACK);
mainGame->dField.attack_target = mainGame->dField.GetCard(cd, ld, sd); mainGame->dField.attack_target = mainGame->dField.GetCard(cd, ld, sd);
myswprintf(event_string, dataManager.GetSysString(1619), dataManager.GetName(mainGame->dField.attacker->code), myswprintf(event_string, dataManager.GetSysString(1619), dataManager.GetName(mainGame->dField.attacker->code),
dataManager.GetName(mainGame->dField.attack_target->code)); dataManager.GetName(mainGame->dField.attack_target->code));
...@@ -2841,6 +2853,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -2841,6 +2853,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
else else
mainGame->atk_r = vector3df(0, 0, 3.1415926 - atan((xd - xa) / (yd - ya))); mainGame->atk_r = vector3df(0, 0, 3.1415926 - atan((xd - xa) / (yd - ya)));
} else { } else {
mainGame->PlaySoundEffect(SOUND_DIRECT_ATTACK);
myswprintf(event_string, dataManager.GetSysString(1620), dataManager.GetName(mainGame->dField.attacker->code)); myswprintf(event_string, dataManager.GetSysString(1620), dataManager.GetName(mainGame->dField.attacker->code));
float xa = mainGame->dField.attacker->curPos.X; float xa = mainGame->dField.attacker->curPos.X;
float ya = mainGame->dField.attacker->curPos.Y; float ya = mainGame->dField.attacker->curPos.Y;
...@@ -2922,7 +2935,6 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -2922,7 +2935,6 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
return true; return true;
} }
case MSG_TOSS_COIN: { case MSG_TOSS_COIN: {
mainGame->PlaySoundEffect(SOUND_COIN);
/*int player = */mainGame->LocalPlayer(BufferIO::ReadInt8(pbuf)); /*int player = */mainGame->LocalPlayer(BufferIO::ReadInt8(pbuf));
int count = BufferIO::ReadInt8(pbuf); int count = BufferIO::ReadInt8(pbuf);
wchar_t* pwbuf = textBuffer; wchar_t* pwbuf = textBuffer;
...@@ -2936,6 +2948,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -2936,6 +2948,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
*pwbuf = 0; *pwbuf = 0;
if(mainGame->dInfo.isReplay && mainGame->dInfo.isReplaySkiping) if(mainGame->dInfo.isReplay && mainGame->dInfo.isReplaySkiping)
return true; return true;
mainGame->PlaySoundEffect(SOUND_COIN);
mainGame->gMutex.Lock(); mainGame->gMutex.Lock();
mainGame->lstLog->addItem(textBuffer); mainGame->lstLog->addItem(textBuffer);
mainGame->logParam.push_back(0); mainGame->logParam.push_back(0);
...@@ -2946,7 +2959,6 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -2946,7 +2959,6 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
return true; return true;
} }
case MSG_TOSS_DICE: { case MSG_TOSS_DICE: {
mainGame->PlaySoundEffect(SOUND_DICE);
/*int player = */mainGame->LocalPlayer(BufferIO::ReadInt8(pbuf)); /*int player = */mainGame->LocalPlayer(BufferIO::ReadInt8(pbuf));
int count = BufferIO::ReadInt8(pbuf); int count = BufferIO::ReadInt8(pbuf);
wchar_t* pwbuf = textBuffer; wchar_t* pwbuf = textBuffer;
...@@ -2960,6 +2972,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -2960,6 +2972,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
*pwbuf = 0; *pwbuf = 0;
if(mainGame->dInfo.isReplay && mainGame->dInfo.isReplaySkiping) if(mainGame->dInfo.isReplay && mainGame->dInfo.isReplaySkiping)
return true; return true;
mainGame->PlaySoundEffect(SOUND_DICE);
mainGame->gMutex.Lock(); mainGame->gMutex.Lock();
mainGame->lstLog->addItem(textBuffer); mainGame->lstLog->addItem(textBuffer);
mainGame->logParam.push_back(0); mainGame->logParam.push_back(0);
......
...@@ -124,6 +124,7 @@ bool ClientField::OnEvent(const irr::SEvent& event) { ...@@ -124,6 +124,7 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
if(mainGame->dInfo.player_type == 7) { if(mainGame->dInfo.player_type == 7) {
DuelClient::StopClient(); DuelClient::StopClient();
mainGame->dInfo.isStarted = false; mainGame->dInfo.isStarted = false;
mainGame->dInfo.isFinished = false;
mainGame->device->setEventReceiver(&mainGame->menuHandler); mainGame->device->setEventReceiver(&mainGame->menuHandler);
mainGame->wCardImg->setVisible(false); mainGame->wCardImg->setVisible(false);
mainGame->wInfos->setVisible(false); mainGame->wInfos->setVisible(false);
......
...@@ -684,13 +684,13 @@ void Game::MainLoop() { ...@@ -684,13 +684,13 @@ void Game::MainLoop() {
driver->beginScene(true, true, SColor(0, 0, 0, 0)); driver->beginScene(true, true, SColor(0, 0, 0, 0));
gMutex.Lock(); gMutex.Lock();
if(dInfo.isStarted) { if(dInfo.isStarted) {
if(mainGame->showcardcode == 1 || mainGame->showcardcode == 3) if(mainGame->dInfo.isFinished && mainGame->showcardcode == 1)
PlayBGM(BGM_WIN); PlayBGM(BGM_WIN);
else if(mainGame->showcardcode == 2) else if(mainGame->dInfo.isFinished && (mainGame->showcardcode == 2 || mainGame->showcardcode == 3))
PlayBGM(BGM_LOSE); PlayBGM(BGM_LOSE);
else if(mainGame->dInfo.lp[0] > 0 && mainGame->dInfo.lp[LocalPlayer(0)] <= mainGame->dInfo.lp[LocalPlayer(1)] / 2) else if(mainGame->dInfo.lp[0] > 0 && mainGame->dInfo.lp[0] <= mainGame->dInfo.lp[1] / 2)
PlayBGM(BGM_DISADVANTAGE); PlayBGM(BGM_DISADVANTAGE);
else if(mainGame->dInfo.lp[0] > 0 && mainGame->dInfo.lp[LocalPlayer(0)] >= mainGame->dInfo.lp[LocalPlayer(1)] * 2) else if(mainGame->dInfo.lp[0] > 0 && mainGame->dInfo.lp[0] >= mainGame->dInfo.lp[1] * 2)
PlayBGM(BGM_ADVANTAGE); PlayBGM(BGM_ADVANTAGE);
else else
PlayBGM(BGM_DUEL); PlayBGM(BGM_DUEL);
...@@ -1210,6 +1210,10 @@ void Game::PlaySoundEffect(int sound) { ...@@ -1210,6 +1210,10 @@ void Game::PlaySoundEffect(int sound) {
engineSound->play2D("./sound/banished.wav"); engineSound->play2D("./sound/banished.wav");
break; break;
} }
case SOUND_TOKEN: {
engineSound->play2D("./sound/token.wav");
break;
}
case SOUND_ATTACK: { case SOUND_ATTACK: {
engineSound->play2D("./sound/attack.wav"); engineSound->play2D("./sound/attack.wav");
break; break;
......
...@@ -48,6 +48,7 @@ struct Config { ...@@ -48,6 +48,7 @@ struct Config {
struct DuelInfo { struct DuelInfo {
bool isStarted; bool isStarted;
bool isFinished;
bool isReplay; bool isReplay;
bool isReplaySkiping; bool isReplaySkiping;
bool isFirst; bool isFirst;
...@@ -594,6 +595,7 @@ extern Game* mainGame; ...@@ -594,6 +595,7 @@ extern Game* mainGame;
#define SOUND_EQUIP 107 #define SOUND_EQUIP 107
#define SOUND_DESTROYED 108 #define SOUND_DESTROYED 108
#define SOUND_BANISHED 109 #define SOUND_BANISHED 109
#define SOUND_TOKEN 110
#define SOUND_ATTACK 201 #define SOUND_ATTACK 201
#define SOUND_DIRECT_ATTACK 202 #define SOUND_DIRECT_ATTACK 202
......
...@@ -138,6 +138,7 @@ int ReplayMode::ReplayThread(void* param) { ...@@ -138,6 +138,7 @@ int ReplayMode::ReplayThread(void* param) {
ReplayRefreshExtra(0); ReplayRefreshExtra(0);
ReplayRefreshExtra(1); ReplayRefreshExtra(1);
mainGame->dInfo.isStarted = true; mainGame->dInfo.isStarted = true;
mainGame->dInfo.isFinished = false;
mainGame->dInfo.isReplay = true; mainGame->dInfo.isReplay = true;
char engineBuffer[0x1000]; char engineBuffer[0x1000];
is_continuing = true; is_continuing = true;
...@@ -179,6 +180,7 @@ int ReplayMode::ReplayThread(void* param) { ...@@ -179,6 +180,7 @@ int ReplayMode::ReplayThread(void* param) {
mainGame->actionSignal.Wait(); mainGame->actionSignal.Wait();
mainGame->gMutex.Lock(); mainGame->gMutex.Lock();
mainGame->dInfo.isStarted = false; mainGame->dInfo.isStarted = false;
mainGame->dInfo.isFinished = true;
mainGame->dInfo.isReplay = false; mainGame->dInfo.isReplay = false;
mainGame->gMutex.Unlock(); mainGame->gMutex.Unlock();
mainGame->closeDoneSignal.Reset(); mainGame->closeDoneSignal.Reset();
...@@ -196,6 +198,7 @@ int ReplayMode::ReplayThread(void* param) { ...@@ -196,6 +198,7 @@ int ReplayMode::ReplayThread(void* param) {
void ReplayMode::Restart(bool refresh) { void ReplayMode::Restart(bool refresh) {
end_duel(pduel); end_duel(pduel);
mainGame->dInfo.isStarted = false; mainGame->dInfo.isStarted = false;
mainGame->dInfo.isFinished = false;
mainGame->dField.panel = 0; mainGame->dField.panel = 0;
mainGame->dField.hovered_card = 0; mainGame->dField.hovered_card = 0;
mainGame->dField.clicked_card = 0; mainGame->dField.clicked_card = 0;
......
...@@ -84,6 +84,7 @@ int SingleMode::SinglePlayThread(void* param) { ...@@ -84,6 +84,7 @@ int SingleMode::SinglePlayThread(void* param) {
mainGame->dField.Clear(); mainGame->dField.Clear();
mainGame->dInfo.isFirst = true; mainGame->dInfo.isFirst = true;
mainGame->dInfo.isStarted = true; mainGame->dInfo.isStarted = true;
mainGame->dInfo.isFinished = false;
mainGame->dInfo.isSingleMode = true; mainGame->dInfo.isSingleMode = true;
mainGame->device->setEventReceiver(&mainGame->dField); mainGame->device->setEventReceiver(&mainGame->dField);
mainGame->gMutex.Unlock(); mainGame->gMutex.Unlock();
...@@ -105,6 +106,7 @@ int SingleMode::SinglePlayThread(void* param) { ...@@ -105,6 +106,7 @@ int SingleMode::SinglePlayThread(void* param) {
if(!is_closing) { if(!is_closing) {
mainGame->gMutex.Lock(); mainGame->gMutex.Lock();
mainGame->dInfo.isStarted = false; mainGame->dInfo.isStarted = false;
mainGame->dInfo.isFinished = true;
mainGame->dInfo.isSingleMode = false; mainGame->dInfo.isSingleMode = false;
mainGame->gMutex.Unlock(); mainGame->gMutex.Unlock();
mainGame->closeDoneSignal.Reset(); mainGame->closeDoneSignal.Reset();
......
...@@ -7,6 +7,7 @@ reveal.wav ...@@ -7,6 +7,7 @@ reveal.wav
equip.wav equip.wav
destroyed.wav destroyed.wav
banished.wav banished.wav
token.wav
attack.wav attack.wav
directattack.wav directattack.wav
draw.wav draw.wav
......
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