Commit 3f327a72 authored by mercury233's avatar mercury233

Merge branch 'sound' into link

parents 96a6ad46 da811668
...@@ -130,6 +130,7 @@ public: ...@@ -130,6 +130,7 @@ public:
int list_command; int list_command;
virtual bool OnEvent(const irr::SEvent& event); virtual bool OnEvent(const irr::SEvent& event);
virtual bool OnCommonEvent(const irr::SEvent& event);
void GetHoverField(int x, int y); void GetHoverField(int x, int y);
void ShowMenu(int flag, int x, int y); void ShowMenu(int flag, int x, int y);
void UpdateChainButtons(); void UpdateChainButtons();
......
...@@ -47,6 +47,7 @@ inline int _wtoi(const wchar_t * s) { ...@@ -47,6 +47,7 @@ inline int _wtoi(const wchar_t * s) {
#endif #endif
#include <irrlicht.h> #include <irrlicht.h>
#include <irrKlang.h>
#include <GL/gl.h> #include <GL/gl.h>
#include <GL/glu.h> #include <GL/glu.h>
#include "CGUITTFont.h" #include "CGUITTFont.h"
......
...@@ -99,6 +99,8 @@ void DeckBuilder::Terminate() { ...@@ -99,6 +99,8 @@ void DeckBuilder::Terminate() {
mainGame->device->closeDevice(); mainGame->device->closeDevice();
} }
bool DeckBuilder::OnEvent(const irr::SEvent& event) { bool DeckBuilder::OnEvent(const irr::SEvent& event) {
if(mainGame->dField.OnCommonEvent(event))
return false;
switch(event.EventType) { switch(event.EventType) {
case irr::EET_GUI_EVENT: { case irr::EET_GUI_EVENT: {
s32 id = event.GUIEvent.Caller->getID(); s32 id = event.GUIEvent.Caller->getID();
...@@ -176,7 +178,7 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) { ...@@ -176,7 +178,7 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
break; break;
} }
case BUTTON_LEAVE_GAME: { case BUTTON_LEAVE_GAME: {
if(is_modified && mainGame->gameConf.prompt_to_discard_deck_changes) { if(is_modified && !mainGame->chkIgnoreDeckChanges->isChecked()) {
mainGame->gMutex.Lock(); mainGame->gMutex.Lock();
mainGame->SetStaticText(mainGame->stQMessage, 310, mainGame->textFont, (wchar_t*)dataManager.GetSysString(1356)); mainGame->SetStaticText(mainGame->stQMessage, 310, mainGame->textFont, (wchar_t*)dataManager.GetSysString(1356));
mainGame->PopupElement(mainGame->wQuery); mainGame->PopupElement(mainGame->wQuery);
...@@ -305,14 +307,7 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) { ...@@ -305,14 +307,7 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
break; break;
} }
case irr::gui::EGET_SCROLL_BAR_CHANGED: { case irr::gui::EGET_SCROLL_BAR_CHANGED: {
switch(id) {
case SCROLL_CARDTEXT: {
u32 pos = mainGame->scrCardText->getPos();
mainGame->SetStaticText(mainGame->stText, mainGame->stText->getRelativePosition().getWidth()-25, mainGame->textFont, mainGame->showingtext, pos);
break;
}
break; break;
}
} }
case irr::gui::EGET_EDITBOX_ENTER: { case irr::gui::EGET_EDITBOX_ENTER: {
switch(id) { switch(id) {
...@@ -340,7 +335,7 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) { ...@@ -340,7 +335,7 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
break; break;
} }
case COMBOBOX_DBDECKS: { case COMBOBOX_DBDECKS: {
if(is_modified && mainGame->gameConf.prompt_to_discard_deck_changes) { if(is_modified && !mainGame->chkIgnoreDeckChanges->isChecked()) {
mainGame->gMutex.Lock(); mainGame->gMutex.Lock();
mainGame->SetStaticText(mainGame->stQMessage, 310, mainGame->textFont, (wchar_t*)dataManager.GetSysString(1356)); mainGame->SetStaticText(mainGame->stQMessage, 310, mainGame->textFont, (wchar_t*)dataManager.GetSysString(1356));
mainGame->PopupElement(mainGame->wQuery); mainGame->PopupElement(mainGame->wQuery);
...@@ -626,19 +621,6 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) { ...@@ -626,19 +621,6 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
break; break;
} }
case irr::EET_KEY_INPUT_EVENT: { case irr::EET_KEY_INPUT_EVENT: {
switch(event.KeyInput.Key) {
case irr::KEY_KEY_R: {
if(!event.KeyInput.PressedDown && !mainGame->HasFocus(EGUIET_EDIT_BOX))
mainGame->textFont->setTransparency(true);
break;
}
case irr::KEY_ESCAPE: {
if(!mainGame->HasFocus(EGUIET_EDIT_BOX))
mainGame->device->minimizeWindow();
break;
}
default: break;
}
break; break;
} }
default: break; default: break;
......
...@@ -211,7 +211,9 @@ void Game::DrawLinkedZones(ClientCard* pcard) { ...@@ -211,7 +211,9 @@ void Game::DrawLinkedZones(ClientCard* pcard) {
driver->drawVertexPrimitiveList(&matManager.vFieldMzone[dField.hovered_controler][dField.hovered_sequence + 1], 4, matManager.iRectangle, 2); driver->drawVertexPrimitiveList(&matManager.vFieldMzone[dField.hovered_controler][dField.hovered_sequence + 1], 4, matManager.iRectangle, 2);
} }
if (dInfo.duel_rule >= 4) { if (dInfo.duel_rule >= 4) {
if ((mark & LINK_MARKER_TOP_LEFT && dField.hovered_sequence == 2) || (mark & LINK_MARKER_TOP && dField.hovered_sequence == 1) || (mark & LINK_MARKER_TOP_RIGHT && dField.hovered_sequence == 0)) { if ((mark & LINK_MARKER_TOP_LEFT && dField.hovered_sequence == 2)
|| (mark & LINK_MARKER_TOP && dField.hovered_sequence == 1)
|| (mark & LINK_MARKER_TOP_RIGHT && dField.hovered_sequence == 0)) {
int mark = (dField.hovered_sequence == 2) ? LINK_MARKER_BOTTOM_RIGHT : (dField.hovered_sequence == 1) ? LINK_MARKER_BOTTOM : LINK_MARKER_BOTTOM_LEFT; int mark = (dField.hovered_sequence == 2) ? LINK_MARKER_BOTTOM_RIGHT : (dField.hovered_sequence == 1) ? LINK_MARKER_BOTTOM : LINK_MARKER_BOTTOM_LEFT;
pcard2 = mainGame->dField.mzone[dField.hovered_controler][5]; pcard2 = mainGame->dField.mzone[dField.hovered_controler][5];
if (!pcard2) { if (!pcard2) {
...@@ -221,7 +223,9 @@ void Game::DrawLinkedZones(ClientCard* pcard) { ...@@ -221,7 +223,9 @@ void Game::DrawLinkedZones(ClientCard* pcard) {
CheckMutual(pcard2, mark); CheckMutual(pcard2, mark);
driver->drawVertexPrimitiveList(&matManager.vFieldMzone[dField.hovered_controler][5], 4, matManager.iRectangle, 2); driver->drawVertexPrimitiveList(&matManager.vFieldMzone[dField.hovered_controler][5], 4, matManager.iRectangle, 2);
} }
if ((mark & LINK_MARKER_TOP_LEFT && dField.hovered_sequence == 4) || (mark & LINK_MARKER_TOP && dField.hovered_sequence == 3) || (mark & LINK_MARKER_TOP_RIGHT && dField.hovered_sequence == 2)) { if ((mark & LINK_MARKER_TOP_LEFT && dField.hovered_sequence == 4)
|| (mark & LINK_MARKER_TOP && dField.hovered_sequence == 3)
|| (mark & LINK_MARKER_TOP_RIGHT && dField.hovered_sequence == 2)) {
int mark = (dField.hovered_sequence == 4) ? LINK_MARKER_BOTTOM_RIGHT : (dField.hovered_sequence == 3) ? LINK_MARKER_BOTTOM : LINK_MARKER_BOTTOM_LEFT; int mark = (dField.hovered_sequence == 4) ? LINK_MARKER_BOTTOM_RIGHT : (dField.hovered_sequence == 3) ? LINK_MARKER_BOTTOM : LINK_MARKER_BOTTOM_LEFT;
pcard2 = mainGame->dField.mzone[dField.hovered_controler][6]; pcard2 = mainGame->dField.mzone[dField.hovered_controler][6];
if (!pcard2) { if (!pcard2) {
......
...@@ -626,6 +626,7 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) { ...@@ -626,6 +626,7 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) {
break; break;
} }
case STOC_HS_PLAYER_ENTER: { case STOC_HS_PLAYER_ENTER: {
mainGame->PlaySoundEffect("./sound/playerenter.wav");
STOC_HS_PlayerEnter* pkt = (STOC_HS_PlayerEnter*)pdata; STOC_HS_PlayerEnter* pkt = (STOC_HS_PlayerEnter*)pdata;
if(pkt->pos > 3) if(pkt->pos > 3)
break; break;
...@@ -660,6 +661,7 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) { ...@@ -660,6 +661,7 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) {
break; break;
mainGame->gMutex.Lock(); mainGame->gMutex.Lock();
if(state < 8) { if(state < 8) {
mainGame->PlaySoundEffect("./sound/playerenter.wav");
wchar_t* prename = (wchar_t*)mainGame->stHostPrepDuelist[pos]->getText(); wchar_t* prename = (wchar_t*)mainGame->stHostPrepDuelist[pos]->getText();
mainGame->stHostPrepDuelist[state]->setText(prename); mainGame->stHostPrepDuelist[state]->setText(prename);
mainGame->stHostPrepDuelist[pos]->setText(L""); mainGame->stHostPrepDuelist[pos]->setText(L"");
...@@ -1710,6 +1712,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -1710,6 +1712,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
return true; return true;
} }
case MSG_SHUFFLE_DECK: { case MSG_SHUFFLE_DECK: {
mainGame->PlaySoundEffect("./sound/shuffle.wav");
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;
...@@ -1904,6 +1907,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -1904,6 +1907,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
return true; return true;
} }
case MSG_NEW_TURN: { case MSG_NEW_TURN: {
mainGame->PlaySoundEffect("./sound/nextturn.wav");
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) {
...@@ -1940,6 +1944,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -1940,6 +1944,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
return true; return true;
} }
case MSG_NEW_PHASE: { case MSG_NEW_PHASE: {
mainGame->PlaySoundEffect("./sound/phase.wav");
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);
...@@ -1993,7 +1998,9 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -1993,7 +1998,9 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
int cl = BufferIO::ReadUInt8(pbuf); int cl = BufferIO::ReadUInt8(pbuf);
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(reason & REASON_DESTROY && pl != cl)
mainGame->PlaySoundEffect("./sound/destroyed.wav");
if (pl == 0) { if (pl == 0) {
ClientCard* pcard = new ClientCard(); ClientCard* pcard = new ClientCard();
pcard->position = cp; pcard->position = cp;
...@@ -2209,6 +2216,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -2209,6 +2216,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
return true; return true;
} }
case MSG_SET: { case MSG_SET: {
mainGame->PlaySoundEffect("./sound/set.wav");
/*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);
...@@ -2261,6 +2269,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -2261,6 +2269,7 @@ 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);
...@@ -2283,6 +2292,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -2283,6 +2292,7 @@ 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);
...@@ -2304,6 +2314,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -2304,6 +2314,7 @@ 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);
...@@ -2331,6 +2342,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -2331,6 +2342,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
return true; return true;
} }
case MSG_CHAINING: { case MSG_CHAINING: {
mainGame->PlaySoundEffect("./sound/activate.wav");
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);
...@@ -2504,6 +2516,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -2504,6 +2516,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
} }
} else { } else {
for (int i = 0; i < count; ++i) { for (int i = 0; i < count; ++i) {
mainGame->PlaySoundEffect("./sound/draw.wav");
mainGame->gMutex.Lock(); mainGame->gMutex.Lock();
pcard = mainGame->dField.GetCard(player, LOCATION_DECK, mainGame->dField.deck[player].size() - 1); pcard = mainGame->dField.GetCard(player, LOCATION_DECK, mainGame->dField.deck[player].size() - 1);
mainGame->dField.deck[player].erase(mainGame->dField.deck[player].end() - 1); mainGame->dField.deck[player].erase(mainGame->dField.deck[player].end() - 1);
...@@ -2520,6 +2533,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -2520,6 +2533,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
return true; return true;
} }
case MSG_DAMAGE: { case MSG_DAMAGE: {
mainGame->PlaySoundEffect("./sound/damage.wav");
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;
...@@ -2550,6 +2564,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -2550,6 +2564,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
return true; return true;
} }
case MSG_RECOVER: { case MSG_RECOVER: {
mainGame->PlaySoundEffect("./sound/gainlp.wav");
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;
...@@ -2578,6 +2593,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -2578,6 +2593,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
return true; return true;
} }
case MSG_EQUIP: { case MSG_EQUIP: {
mainGame->PlaySoundEffect("./sound/equip.wav");
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);
...@@ -2702,6 +2718,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -2702,6 +2718,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
break; break;
} }
case MSG_PAY_LPCOST: { case MSG_PAY_LPCOST: {
mainGame->PlaySoundEffect("./sound/damage.wav");
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;
...@@ -2728,6 +2745,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -2728,6 +2745,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
return true; return true;
} }
case MSG_ADD_COUNTER: { case MSG_ADD_COUNTER: {
mainGame->PlaySoundEffect("./sound/addcounter.wav");
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);
...@@ -2750,6 +2768,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -2750,6 +2768,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
return true; return true;
} }
case MSG_REMOVE_COUNTER: { case MSG_REMOVE_COUNTER: {
mainGame->PlaySoundEffect("./sound/removecounter.wav");
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);
...@@ -2772,6 +2791,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -2772,6 +2791,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
return true; return true;
} }
case MSG_ATTACK: { case MSG_ATTACK: {
mainGame->PlaySoundEffect("./sound/attack.wav");
int ca = mainGame->LocalPlayer(BufferIO::ReadInt8(pbuf)); int ca = mainGame->LocalPlayer(BufferIO::ReadInt8(pbuf));
int la = BufferIO::ReadInt8(pbuf); int la = BufferIO::ReadInt8(pbuf);
int sa = BufferIO::ReadInt8(pbuf); int sa = BufferIO::ReadInt8(pbuf);
...@@ -2880,6 +2900,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -2880,6 +2900,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
return true; return true;
} }
case MSG_TOSS_COIN: { case MSG_TOSS_COIN: {
mainGame->PlaySoundEffect("./sound/coinflip.wav");
/*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;
...@@ -2903,6 +2924,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -2903,6 +2924,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
return true; return true;
} }
case MSG_TOSS_DICE: { case MSG_TOSS_DICE: {
mainGame->PlaySoundEffect("./sound/diceroll.wav");
/*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;
......
...@@ -14,17 +14,14 @@ ...@@ -14,17 +14,14 @@
namespace ygo { namespace ygo {
bool ClientField::OnEvent(const irr::SEvent& event) { bool ClientField::OnEvent(const irr::SEvent& event) {
if(OnCommonEvent(event))
return false;
switch(event.EventType) { switch(event.EventType) {
case irr::EET_GUI_EVENT: { case irr::EET_GUI_EVENT: {
s32 id = event.GUIEvent.Caller->getID(); s32 id = event.GUIEvent.Caller->getID();
switch(event.GUIEvent.EventType) { switch(event.GUIEvent.EventType) {
case irr::gui::EGET_BUTTON_CLICKED: { case irr::gui::EGET_BUTTON_CLICKED: {
switch(id) { switch(id) {
case BUTTON_CLEAR_LOG: {
mainGame->lstLog->clear();
mainGame->logParam.clear();
break;
}
case BUTTON_HAND1: case BUTTON_HAND1:
case BUTTON_HAND2: case BUTTON_HAND2:
case BUTTON_HAND3: { case BUTTON_HAND3: {
...@@ -896,13 +893,6 @@ bool ClientField::OnEvent(const irr::SEvent& event) { ...@@ -896,13 +893,6 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
} }
case irr::gui::EGET_LISTBOX_CHANGED: { case irr::gui::EGET_LISTBOX_CHANGED: {
switch(id) { switch(id) {
case LISTBOX_LOG: {
int sel = mainGame->lstLog->getSelected();
if(sel != -1 && (int)mainGame->logParam.size() >= sel && mainGame->logParam[sel]) {
mainGame->ShowCardInfo(mainGame->logParam[sel]);
}
break;
}
case LISTBOX_ANCARD: { case LISTBOX_ANCARD: {
int sel = mainGame->lstANCard->getSelected(); int sel = mainGame->lstANCard->getSelected();
if(sel != -1) { if(sel != -1) {
...@@ -913,18 +903,6 @@ bool ClientField::OnEvent(const irr::SEvent& event) { ...@@ -913,18 +903,6 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
} }
break; break;
} }
case irr::gui::EGET_LISTBOX_SELECTED_AGAIN: {
switch(id) {
case LISTBOX_LOG: {
int sel = mainGame->lstLog->getSelected();
if(sel != -1 && (int)mainGame->logParam.size() >= sel && mainGame->logParam[sel]) {
mainGame->wInfos->setActiveTab(0);
}
break;
}
}
break;
}
case irr::gui::EGET_SCROLL_BAR_CHANGED: { case irr::gui::EGET_SCROLL_BAR_CHANGED: {
switch(id) { switch(id) {
case SCROLL_CARD_SELECT: { case SCROLL_CARD_SELECT: {
...@@ -1034,11 +1012,6 @@ bool ClientField::OnEvent(const irr::SEvent& event) { ...@@ -1034,11 +1012,6 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
} }
break; break;
} }
case SCROLL_CARDTEXT: {
u32 pos = mainGame->scrCardText->getPos();
mainGame->SetStaticText(mainGame->stText, mainGame->stText->getRelativePosition().getWidth()-25, mainGame->textFont, mainGame->showingtext, pos);
break;
}
break; break;
} }
} }
...@@ -1893,12 +1866,6 @@ bool ClientField::OnEvent(const irr::SEvent& event) { ...@@ -1893,12 +1866,6 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
} }
break; break;
} }
case irr::KEY_KEY_R: {
if(mainGame->gameConf.control_mode == 0
&& !event.KeyInput.PressedDown && !mainGame->HasFocus(EGUIET_EDIT_BOX))
mainGame->textFont->setTransparency(true);
break;
}
case irr::KEY_F1: case irr::KEY_F1:
case irr::KEY_F2: case irr::KEY_F2:
case irr::KEY_F3: case irr::KEY_F3:
...@@ -1970,15 +1937,114 @@ bool ClientField::OnEvent(const irr::SEvent& event) { ...@@ -1970,15 +1937,114 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
} }
break; break;
} }
default: break;
}
break;
}
default: break;
}
return false;
}
bool ClientField::OnCommonEvent(const irr::SEvent& event) {
switch(event.EventType) {
case irr::EET_GUI_EVENT: {
s32 id = event.GUIEvent.Caller->getID();
switch(event.GUIEvent.EventType) {
case irr::gui::EGET_BUTTON_CLICKED: {
switch(id) {
case BUTTON_CLEAR_LOG: {
mainGame->lstLog->clear();
mainGame->logParam.clear();
return true;
break;
}
}
break;
}
case irr::gui::EGET_CHECKBOX_CHANGED: {
switch(id) {
case CHECKBOX_AUTO_SEARCH: {
mainGame->gameConf.auto_search_limit = mainGame->chkAutoSearch->isChecked() ? 0 : -1;
return true;
break;
}
case CHECKBOX_ENABLE_MUSIC: {
if(!mainGame->chkEnableMusic->isChecked())
mainGame->engineMusic->stopAllSounds();
return true;
break;
}
}
break;
}
case irr::gui::EGET_LISTBOX_CHANGED: {
switch(id) {
case LISTBOX_LOG: {
int sel = mainGame->lstLog->getSelected();
if(sel != -1 && (int)mainGame->logParam.size() >= sel && mainGame->logParam[sel]) {
mainGame->ShowCardInfo(mainGame->logParam[sel]);
}
return true;
break;
}
}
break;
}
case irr::gui::EGET_LISTBOX_SELECTED_AGAIN: {
switch(id) {
case LISTBOX_LOG: {
int sel = mainGame->lstLog->getSelected();
if(sel != -1 && (int)mainGame->logParam.size() >= sel && mainGame->logParam[sel]) {
mainGame->wInfos->setActiveTab(0);
}
return true;
break;
}
}
break;
}
case irr::gui::EGET_SCROLL_BAR_CHANGED: {
switch(id) {
case SCROLL_CARDTEXT: {
u32 pos = mainGame->scrCardText->getPos();
mainGame->SetStaticText(mainGame->stText, mainGame->stText->getRelativePosition().getWidth() - 25, mainGame->textFont, mainGame->showingtext, pos);
return true;
break;
}
case SCROLL_VOLUME: {
mainGame->gameConf.soundvolume = (double)mainGame->srcSoundVolume->getPos() / 100;
mainGame->gameConf.musicvolume = (double)mainGame->srcMusicVolume->getPos() / 100;
mainGame->engineSound->setSoundVolume(mainGame->gameConf.soundvolume);
mainGame->engineMusic->setSoundVolume(mainGame->gameConf.musicvolume);
break;
}
}
break;
}
default: break;
}
break;
}
case irr::EET_KEY_INPUT_EVENT: {
switch(event.KeyInput.Key) {
case irr::KEY_KEY_R: {
if(mainGame->gameConf.control_mode == 0
&& !event.KeyInput.PressedDown && !mainGame->HasFocus(EGUIET_EDIT_BOX))
mainGame->textFont->setTransparency(true);
return true;
break;
}
case irr::KEY_F9: { case irr::KEY_F9: {
if(mainGame->gameConf.control_mode == 1 if(mainGame->gameConf.control_mode == 1
&& !event.KeyInput.PressedDown && !mainGame->HasFocus(EGUIET_EDIT_BOX)) && !event.KeyInput.PressedDown && !mainGame->HasFocus(EGUIET_EDIT_BOX))
mainGame->textFont->setTransparency(true); mainGame->textFont->setTransparency(true);
return true;
break; break;
} }
case irr::KEY_ESCAPE: { case irr::KEY_ESCAPE: {
if(!mainGame->HasFocus(EGUIET_EDIT_BOX)) if(!mainGame->HasFocus(EGUIET_EDIT_BOX))
mainGame->device->minimizeWindow(); mainGame->device->minimizeWindow();
return true;
break; break;
} }
default: break; default: break;
......
This diff is collapsed.
...@@ -38,7 +38,12 @@ struct Config { ...@@ -38,7 +38,12 @@ struct Config {
int draw_field_spell; int draw_field_spell;
int separate_clear_button; int separate_clear_button;
int auto_search_limit; int auto_search_limit;
int prompt_to_discard_deck_changes; int chkIgnoreDeckChanges;
bool enablesound;
bool enablemusic;
double soundvolume;
double musicvolume;
int BGM_index;
}; };
struct DuelInfo { struct DuelInfo {
...@@ -90,6 +95,7 @@ public: ...@@ -90,6 +95,7 @@ public:
void RefreshDeck(irr::gui::IGUIComboBox* cbDeck); void RefreshDeck(irr::gui::IGUIComboBox* cbDeck);
void RefreshReplay(); void RefreshReplay();
void RefreshSingleplay(); void RefreshSingleplay();
void RefreshBGMList();
void DrawSelectionLine(irr::video::S3DVertex* vec, bool strip, int width, float* cv); void DrawSelectionLine(irr::video::S3DVertex* vec, bool strip, int width, float* cv);
void DrawBackGround(); void DrawBackGround();
void DrawLinkedZones(ClientCard* pcard); void DrawLinkedZones(ClientCard* pcard);
...@@ -113,6 +119,9 @@ public: ...@@ -113,6 +119,9 @@ public:
void AddDebugMsg(char* msgbuf); void AddDebugMsg(char* msgbuf);
void ClearTextures(); void ClearTextures();
void CloseDuelWindow(); void CloseDuelWindow();
void PlaySoundEffect(char* sound);
void PlayMusic(char* song, bool loop);
void PlayBGM();
int LocalPlayer(int player); int LocalPlayer(int player);
const wchar_t* LocalName(int local_player); const wchar_t* LocalName(int local_player);
...@@ -139,6 +148,7 @@ public: ...@@ -139,6 +148,7 @@ public:
std::list<FadingUnit> fadingList; std::list<FadingUnit> fadingList;
std::vector<int> logParam; std::vector<int> logParam;
std::wstring chatMsg[8]; std::wstring chatMsg[8];
std::vector<std::wstring> BGMList;
int hideChatTimer; int hideChatTimer;
bool hideChat; bool hideChat;
...@@ -211,9 +221,15 @@ public: ...@@ -211,9 +221,15 @@ public:
irr::gui::IGUICheckBox* chkWaitChain; irr::gui::IGUICheckBox* chkWaitChain;
irr::gui::IGUICheckBox* chkHideSetname; irr::gui::IGUICheckBox* chkHideSetname;
irr::gui::IGUICheckBox* chkHideHintButton; irr::gui::IGUICheckBox* chkHideHintButton;
irr::gui::IGUICheckBox* chkIgnoreDeckChanges;
irr::gui::IGUICheckBox* chkAutoSearch;
irr::gui::IGUICheckBox* chkEnableSound;
irr::gui::IGUICheckBox* chkEnableMusic;
irr::gui::IGUIListBox* lstLog; irr::gui::IGUIListBox* lstLog;
irr::gui::IGUIButton* btnClearLog; irr::gui::IGUIButton* btnClearLog;
irr::gui::IGUIButton* btnSaveLog; irr::gui::IGUIButton* btnSaveLog;
irr::gui::IGUIScrollBar* srcSoundVolume;
irr::gui::IGUIScrollBar* srcMusicVolume;
//main menu //main menu
irr::gui::IGUIWindow* wMainMenu; irr::gui::IGUIWindow* wMainMenu;
irr::gui::IGUIButton* btnLanMode; irr::gui::IGUIButton* btnLanMode;
...@@ -418,6 +434,10 @@ public: ...@@ -418,6 +434,10 @@ public:
irr::gui::IGUIButton* btnChainWhenAvail; irr::gui::IGUIButton* btnChainWhenAvail;
//cancel or finish //cancel or finish
irr::gui::IGUIButton* btnCancelOrFinish; irr::gui::IGUIButton* btnCancelOrFinish;
//soundEngine
irrklang::ISoundEngine* engineSound;
irrklang::ISoundEngine* engineMusic;
}; };
extern Game* mainGame; extern Game* mainGame;
...@@ -549,6 +569,11 @@ extern Game* mainGame; ...@@ -549,6 +569,11 @@ extern Game* mainGame;
#define LISTBOX_SINGLEPLAY_LIST 350 #define LISTBOX_SINGLEPLAY_LIST 350
#define BUTTON_LOAD_SINGLEPLAY 351 #define BUTTON_LOAD_SINGLEPLAY 351
#define BUTTON_CANCEL_SINGLEPLAY 352 #define BUTTON_CANCEL_SINGLEPLAY 352
#define CHECKBOX_AUTO_SEARCH 360
#define CHECKBOX_ENABLE_SOUND 361
#define CHECKBOX_ENABLE_MUSIC 362
#define SCROLL_VOLUME 363
#define COMBOBOX_SORTTYPE 370 #define COMBOBOX_SORTTYPE 370
#define BUTTON_MARKS_FILTER 380 #define BUTTON_MARKS_FILTER 380
......
...@@ -6,12 +6,13 @@ project "ygopro" ...@@ -6,12 +6,13 @@ project "ygopro"
files { "**.cpp", "**.cc", "**.c", "**.h" } files { "**.cpp", "**.cc", "**.c", "**.h" }
excludes "lzma/**" excludes "lzma/**"
includedirs { "../ocgcore" } includedirs { "../ocgcore" }
links { "ocgcore", "clzma", "Irrlicht", "freetype", "sqlite3", "lua" , "event"} links { "ocgcore", "clzma", "Irrlicht", "freetype", "sqlite3", "lua" , "event", "irrKlang"}
configuration "windows" configuration "windows"
files "ygopro.rc" files "ygopro.rc"
excludes "CGUIButton.cpp" excludes "CGUIButton.cpp"
includedirs { "../irrlicht/include", "../freetype/include", "../event/include", "../sqlite3" } includedirs { "../irrlicht/include", "../freetype/include", "../event/include", "../sqlite3", "../irrklang/include" }
libdirs { "../irrklang/lib/Win32-visualStudio" }
links { "opengl32", "ws2_32", "winmm", "gdi32", "kernel32", "user32", "imm32" } links { "opengl32", "ws2_32", "winmm", "gdi32", "kernel32", "user32", "imm32" }
configuration {"windows", "not vs*"} configuration {"windows", "not vs*"}
includedirs { "/mingw/include/irrlicht", "/mingw/include/freetype2" } includedirs { "/mingw/include/irrlicht", "/mingw/include/freetype2" }
......
...@@ -303,6 +303,7 @@ ...@@ -303,6 +303,7 @@
!system 1295 取消操作 !system 1295 取消操作
!system 1296 完成选择 !system 1296 完成选择
!system 1297 切洗手卡 !system 1297 切洗手卡
!system 1298 辅助功能
!system 1300 禁限卡表: !system 1300 禁限卡表:
!system 1301 卡组列表: !system 1301 卡组列表:
!system 1302 保存 !system 1302 保存
...@@ -357,12 +358,16 @@ ...@@ -357,12 +358,16 @@
!system 1354 不显示卡片系列 !system 1354 不显示卡片系列
!system 1355 不显示提示按钮 !system 1355 不显示提示按钮
!system 1356 是否要放弃对卡组的修改? !system 1356 是否要放弃对卡组的修改?
!system 1357 不提示保留对卡组的修改
!system 1358 键入关键字后自动进行搜索
!system 1360 上一步 !system 1360 上一步
!system 1370 星数↑ !system 1370 星数↑
!system 1371 攻击↑ !system 1371 攻击↑
!system 1372 守备↑ !system 1372 守备↑
!system 1373 名称↓ !system 1373 名称↓
!system 1374 连接标记 !system 1374 连接标记
!system 1380 开启音效
!system 1381 开启音乐
!system 1390 等待行动中... !system 1390 等待行动中...
!system 1391 等待行动中.... !system 1391 等待行动中....
!system 1392 等待行动中..... !system 1392 等待行动中.....
......
...@@ -28,3 +28,11 @@ separate_clear_button = 1 ...@@ -28,3 +28,11 @@ separate_clear_button = 1
#auto_search_limit >= 0: Start search automatically when the user enters N chars. #auto_search_limit >= 0: Start search automatically when the user enters N chars.
auto_search_limit = 0 auto_search_limit = 0
prompt_to_discard_deck_changes = 1 prompt_to_discard_deck_changes = 1
enable_sound = 1
enable_music = 1
#Volume of sound and music, between 0 and 100
soundvolume = 50
musicvolume = 50
#playing the music corresponding to the sequence(start from 0) under folder /BGM
#-1 means playing one of them randomly
BGM_index = -1
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