Commit 06700bd2 authored by nanahira's avatar nanahira

Merge branch 'master' into server

parents ba3168b2 a6205b94
No preview for this file type
......@@ -1066,6 +1066,8 @@ void DeckBuilder::ClearSearch() {
mainGame->ebStar->setEnabled(false);
mainGame->ebScale->setEnabled(false);
mainGame->ebCardName->setText(L"");
mainGame->scrFilter->setVisible(false);
mainGame->scrFilter->setPos(0);
ClearFilter();
results.clear();
myswprintf(result_string, L"%d", 0);
......
......@@ -422,7 +422,7 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) {
}
case STOC_SELECT_TP: {
mainGame->gMutex.Lock();
mainGame->ShowElement(mainGame->wFTSelect);
mainGame->PopupElement(mainGame->wFTSelect);
mainGame->gMutex.Unlock();
break;
}
......@@ -1033,8 +1033,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
}
case HINT_OPSELECTED: {
myswprintf(textBuffer, dataManager.GetSysString(1510), dataManager.GetDesc(data));
mainGame->lstLog->addItem(textBuffer);
mainGame->logParam.push_back(0);
mainGame->AddLog(textBuffer);
mainGame->gMutex.Lock();
mainGame->SetStaticText(mainGame->stACMessage, 310, mainGame->guiFont, textBuffer);
mainGame->PopupElement(mainGame->wACMessage, 20);
......@@ -1051,8 +1050,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
}
case HINT_RACE: {
myswprintf(textBuffer, dataManager.GetSysString(1511), dataManager.FormatRace(data));
mainGame->lstLog->addItem(textBuffer);
mainGame->logParam.push_back(0);
mainGame->AddLog(textBuffer);
mainGame->gMutex.Lock();
mainGame->SetStaticText(mainGame->stACMessage, 310, mainGame->guiFont, textBuffer);
mainGame->PopupElement(mainGame->wACMessage, 20);
......@@ -1062,8 +1060,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
}
case HINT_ATTRIB: {
myswprintf(textBuffer, dataManager.GetSysString(1511), dataManager.FormatAttribute(data));
mainGame->lstLog->addItem(textBuffer);
mainGame->logParam.push_back(0);
mainGame->AddLog(textBuffer);
mainGame->gMutex.Lock();
mainGame->SetStaticText(mainGame->stACMessage, 310, mainGame->guiFont, textBuffer);
mainGame->PopupElement(mainGame->wACMessage, 20);
......@@ -1073,8 +1070,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
}
case HINT_CODE: {
myswprintf(textBuffer, dataManager.GetSysString(1511), dataManager.GetName(data));
mainGame->lstLog->addItem(textBuffer);
mainGame->logParam.push_back(data);
mainGame->AddLog(textBuffer, data);
mainGame->gMutex.Lock();
mainGame->SetStaticText(mainGame->stACMessage, 310, mainGame->guiFont, textBuffer);
mainGame->PopupElement(mainGame->wACMessage, 20);
......@@ -1084,8 +1080,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
}
case HINT_NUMBER: {
myswprintf(textBuffer, dataManager.GetSysString(1512), data);
mainGame->lstLog->addItem(textBuffer);
mainGame->logParam.push_back(0);
mainGame->AddLog(textBuffer);
mainGame->gMutex.Lock();
mainGame->SetStaticText(mainGame->stACMessage, 310, mainGame->guiFont, textBuffer);
mainGame->PopupElement(mainGame->wACMessage, 20);
......@@ -2023,14 +2018,12 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
return true;
soundManager.PlaySoundEffect(SOUND_REVEAL);
myswprintf(textBuffer, dataManager.GetSysString(207), count);
mainGame->lstLog->addItem(textBuffer);
mainGame->logParam.push_back(0);
mainGame->AddLog(textBuffer);
for (int i = 0; i < count; ++i) {
pcard = *(mainGame->dField.deck[player].rbegin() + i);
mainGame->gMutex.Lock();
myswprintf(textBuffer, L"*[%ls]", dataManager.GetName(pcard->code));
mainGame->lstLog->addItem(textBuffer);
mainGame->logParam.push_back(pcard->code);
mainGame->AddLog(textBuffer, pcard->code);
mainGame->gMutex.Unlock();
float shift = -0.15f;
if (player == 1) shift = 0.15f;
......@@ -2063,14 +2056,12 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
return true;
soundManager.PlaySoundEffect(SOUND_REVEAL);
myswprintf(textBuffer, dataManager.GetSysString(207), count);
mainGame->lstLog->addItem(textBuffer);
mainGame->logParam.push_back(0);
mainGame->AddLog(textBuffer);
for (int i = 0; i < count; ++i) {
pcard = *(mainGame->dField.extra[player].rbegin() + i + mainGame->dField.extra_p_count[player]);
mainGame->gMutex.Lock();
myswprintf(textBuffer, L"*[%ls]", dataManager.GetName(pcard->code));
mainGame->lstLog->addItem(textBuffer);
mainGame->logParam.push_back(pcard->code);
mainGame->AddLog(textBuffer, pcard->code);
mainGame->gMutex.Unlock();
if (player == 0)
pcard->dPos = irr::core::vector3df(0, -0.20f, 0);
......@@ -2098,8 +2089,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
}
soundManager.PlaySoundEffect(SOUND_REVEAL);
myswprintf(textBuffer, dataManager.GetSysString(208), count);
mainGame->lstLog->addItem(textBuffer);
mainGame->logParam.push_back(0);
mainGame->AddLog(textBuffer);
for (int i = 0; i < count; ++i) {
code = BufferIO::ReadInt32(pbuf);
c = mainGame->LocalPlayer(BufferIO::ReadInt8(pbuf));
......@@ -2114,8 +2104,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
pcard->SetCode(code);
mainGame->gMutex.Lock();
myswprintf(textBuffer, L"*[%ls]", dataManager.GetName(code));
mainGame->lstLog->addItem(textBuffer);
mainGame->logParam.push_back(code);
mainGame->AddLog(textBuffer, code);
mainGame->gMutex.Unlock();
if (l & 0x41 || l == 0) {
if(count == 1 && l != 0) {
......@@ -3059,8 +3048,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
} else
mainGame->WaitFrameSignal(30);
myswprintf(textBuffer, dataManager.GetSysString(1610), dataManager.GetName(pcard->code), dataManager.FormatLocation(l, s), s + 1);
mainGame->lstLog->addItem(textBuffer);
mainGame->logParam.push_back(pcard->code);
mainGame->AddLog(textBuffer, pcard->code);
pcard->is_highlighting = false;
}
return true;
......@@ -3466,8 +3454,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
BufferIO::ReadInt32(pbuf);
unsigned int code = (unsigned int)BufferIO::ReadInt32(pbuf);
myswprintf(textBuffer, dataManager.GetSysString(1622), dataManager.GetName(code));
mainGame->lstLog->addItem(textBuffer);
mainGame->logParam.push_back(code);
mainGame->AddLog(textBuffer, code);
return true;
}
case MSG_TOSS_COIN: {
......@@ -3486,8 +3473,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
return true;
soundManager.PlaySoundEffect(SOUND_COIN);
mainGame->gMutex.Lock();
mainGame->lstLog->addItem(textBuffer);
mainGame->logParam.push_back(0);
mainGame->AddLog(textBuffer);
mainGame->stACMessage->setText(textBuffer);
mainGame->PopupElement(mainGame->wACMessage, 20);
mainGame->gMutex.Unlock();
......@@ -3510,8 +3496,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
return true;
soundManager.PlaySoundEffect(SOUND_DICE);
mainGame->gMutex.Lock();
mainGame->lstLog->addItem(textBuffer);
mainGame->logParam.push_back(0);
mainGame->AddLog(textBuffer);
mainGame->stACMessage->setText(textBuffer);
mainGame->PopupElement(mainGame->wACMessage, 20);
mainGame->gMutex.Unlock();
......
......@@ -843,6 +843,13 @@ bool Game::Initialize() {
col.setAlpha(224);
env->getSkin()->setColor((EGUI_DEFAULT_COLOR)i, col);
}
dimension2du size = driver->getScreenSize();
if(window_size != size) {
window_size = size;
xScale = window_size.Width / 1024.0;
yScale = window_size.Height / 640.0;
OnResize();
}
hideChat = false;
hideChatTimer = 0;
return true;
......@@ -1696,6 +1703,13 @@ void Game::ClearCardInfo(int player) {
stText->setText(L"");
scrCardText->setVisible(false);
}
void Game::AddLog(const wchar_t* msg, int param) {
logParam.push_back(param);
lstLog->addItem(msg);
if(!env->hasFocus(lstLog)) {
lstLog->setSelected(-1);
}
}
void Game::AddChatMsg(const wchar_t* msg, int player) {
for(int i = 7; i > 0; --i) {
chatMsg[i] = chatMsg[i - 1];
......@@ -1743,8 +1757,7 @@ void Game::AddChatMsg(const wchar_t* msg, int player) {
chatMsg[0].append(msg);
wchar_t msg_front[256];
myswprintf(msg_front, L"[Chat]%ls", chatMsg[0].c_str());
lstLog->addItem(msg_front);
logParam.push_back(0);
AddLog(msg_front);
}
void Game::ClearChatMsg() {
for(int i = 7; i >= 0; --i) {
......
......@@ -171,6 +171,7 @@ public:
void SaveConfig();
void ShowCardInfo(int code, bool resize = false);
void ClearCardInfo(int player = 0);
void AddLog(const wchar_t* msg, int param = 0);
void AddChatMsg(const wchar_t* msg, int player);
void ClearChatMsg();
void AddDebugMsg(const char* msgbuf);
......@@ -645,7 +646,22 @@ extern HostInfo game_info;
#define BUTTON_DELETE_REPLAY 133
#define BUTTON_RENAME_REPLAY 134
#define BUTTON_EXPORT_DECK 135
#define EDITBOX_CHAT 140
#define BUTTON_REPLAY_START 140
#define BUTTON_REPLAY_PAUSE 141
#define BUTTON_REPLAY_STEP 142
#define BUTTON_REPLAY_UNDO 143
#define BUTTON_REPLAY_EXIT 144
#define BUTTON_REPLAY_SWAP 145
#define BUTTON_REPLAY_SAVE 146
#define BUTTON_REPLAY_CANCEL 147
#define LISTBOX_SINGLEPLAY_LIST 150
#define BUTTON_LOAD_SINGLEPLAY 151
#define BUTTON_CANCEL_SINGLEPLAY 152
#define LISTBOX_BOT_LIST 153
#define BUTTON_BOT_START 154
#define CHECKBOX_BOT_OLD_RULE 155
#define EDITBOX_CHAT 199
#define BUTTON_MSG_OK 200
#define BUTTON_YES 201
#define BUTTON_NO 202
......@@ -710,9 +726,9 @@ extern HostInfo game_info;
#define BUTTON_DISPLAY_4 294
#define SCROLL_CARD_DISPLAY 295
#define BUTTON_CARD_DISP_OK 296
#define BUTTON_SURRENDER_YES 297
#define BUTTON_SURRENDER_NO 298
#define BUTTON_CATEGORY_OK 300
#define COMBOBOX_DBLFLIST 301
#define COMBOBOX_DBDECKS 302
#define BUTTON_CLEAR_DECK 303
......@@ -732,26 +748,12 @@ extern HostInfo game_info;
#define BUTTON_CLEAR_FILTER 317
#define COMBOBOX_ATTRIBUTE 318
#define COMBOBOX_RACE 319
#define BUTTON_REPLAY_START 320
#define BUTTON_REPLAY_PAUSE 321
#define BUTTON_REPLAY_STEP 322
#define BUTTON_REPLAY_UNDO 323
#define BUTTON_REPLAY_EXIT 324
#define BUTTON_REPLAY_SWAP 325
#define BUTTON_REPLAY_SAVE 330
#define BUTTON_REPLAY_CANCEL 331
#define BUTTON_BOT_START 340
#define LISTBOX_BOT_LIST 341
#define CHECKBOX_BOT_OLD_RULE 342
#define LISTBOX_SINGLEPLAY_LIST 343
#define BUTTON_LOAD_SINGLEPLAY 344
#define BUTTON_CANCEL_SINGLEPLAY 345
#define SCROLL_TAB_HELPER 350
#define SCROLL_TAB_SYSTEM 351
#define COMBOBOX_LIMIT 320
#define BUTTON_CATEGORY_OK 321
#define BUTTON_MARKS_FILTER 322
#define BUTTON_MARKERS_OK 323
#define COMBOBOX_SORTTYPE 324
#define CHECKBOX_AUTO_SEARCH 360
#define CHECKBOX_MULTI_KEYWORDS 372
#define CHECKBOX_PREFER_EXPANSION 373
#define CHECKBOX_REGEX 374
#define CHECKBOX_ENABLE_SOUND 361
#define CHECKBOX_ENABLE_MUSIC 362
#define SCROLL_VOLUME 363
......@@ -761,13 +763,12 @@ extern HostInfo game_info;
#define BUTTON_WINDOW_RESIZE_L 367
#define BUTTON_WINDOW_RESIZE_XL 368
#define CHECKBOX_QUICK_ANIMATION 369
#define COMBOBOX_SORTTYPE 370
#define COMBOBOX_LIMIT 371
#define COMBOBOX_LOCALE 372
#define BUTTON_MARKS_FILTER 380
#define BUTTON_MARKERS_OK 381
#define SCROLL_TAB_HELPER 370
#define SCROLL_TAB_SYSTEM 371
#define CHECKBOX_MULTI_KEYWORDS 372
#define CHECKBOX_PREFER_EXPANSION 373
#define CHECKBOX_REGEX 374
#define COMBOBOX_LOCALE 375
#define BUTTON_RENAME_DECK 386
#define BUTTON_RENAME_DECK_SAVE 387
......
......@@ -202,6 +202,8 @@ void SoundManager::PlayDialogSound(irr::gui::IGUIElement * element) {
PlaySoundEffect(SOUND_QUESTION);
} else if(element == mainGame->wReplaySave) {
PlaySoundEffect(SOUND_QUESTION);
} else if(element == mainGame->wFTSelect) {
PlaySoundEffect(SOUND_QUESTION);
}
}
void SoundManager::PlayMusic(char* song, bool loop) {
......
Subproject commit 2df1af0d752a3e958a7ac77b23a57695c5b99f65
Subproject commit 76bbf1edce45c7b199d03ea00d920ca7f2177e4f
Subproject commit bab4c6c7309838f4995e9d38cb33fa1852d70dca
Subproject commit c7a6b8abc9426ee7c5e9ed921856d2b58c75c0a1
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