Commit 58105a17 authored by fallenstardust's avatar fallenstardust

sync

parent c9f042a6
......@@ -38,6 +38,7 @@ ClientCard::ClientCard() {
lscale = 0;
rscale = 0;
link_marker = 0;
position = 0;
cHint = 0;
chValue = 0;
atkstring[0] = 0;
......@@ -70,8 +71,12 @@ void ClientCard::UpdateInfo(char* buf) {
code = pdata;
}
if(flag & QUERY_POSITION) {
pdata = BufferIO::ReadInt32(buf);
position = (pdata >> 24) & 0xff;
pdata = (BufferIO::ReadInt32(buf) >> 24) & 0xff;
if((location & (LOCATION_EXTRA | LOCATION_REMOVED)) && (u8)pdata != position) {
position = pdata;
mainGame->dField.MoveCard(this, 1);
} else
position = pdata;
}
if(flag & QUERY_ALIAS)
alias = BufferIO::ReadInt32(buf);
......
......@@ -596,6 +596,55 @@ void ClientField::ShowLocationCard() {
mainGame->btnDisplayOK->setVisible(true);
mainGame->PopupElement(mainGame->wCardDisplay);
}
void ClientField::ShowSelectOption(int select_hint) {
selected_option = 0;
wchar_t textBuffer[256];
int count = select_options.size();
bool quickmode = (count <= 5);
mainGame->gMutex.Lock();
for(int i = 0; (i < count) && quickmode; i++) {
const wchar_t* option = dataManager.GetDesc(select_options[i]);
irr::core::dimension2d<unsigned int> dtxt = mainGame->guiFont->getDimension(option);
if(dtxt.Width > 310 * mainGame->xScale) {
quickmode = false;
break;
}
mainGame->btnOption[i]->setText(option);
}
if(quickmode) {
mainGame->stOptions->setVisible(false);
mainGame->btnOptionp->setVisible(false);
mainGame->btnOptionn->setVisible(false);
mainGame->btnOptionOK->setVisible(false);
for(int i = 0; i < 5; i++)
mainGame->btnOption[i]->setVisible(i < count);
recti pos = mainGame->wOptions->getRelativePosition();
int newheight = 30 + 40 * count;
int oldheight = pos.LowerRightCorner.Y - pos.UpperLeftCorner.Y;
pos.UpperLeftCorner.Y = pos.UpperLeftCorner.Y + (oldheight - newheight) / 2;
pos.LowerRightCorner.Y = pos.UpperLeftCorner.Y + newheight;
mainGame->wOptions->setRelativePosition(pos);
} else {
mainGame->SetStaticText(mainGame->stOptions, 310 * mainGame->xScale, mainGame->guiFont,
(wchar_t*)dataManager.GetDesc(select_options[0]));
mainGame->stOptions->setVisible(true);
mainGame->btnOptionp->setVisible(false);
mainGame->btnOptionn->setVisible(count > 1);
mainGame->btnOptionOK->setVisible(true);
for(int i = 0; i < 5; i++)
mainGame->btnOption[i]->setVisible(false);
recti pos = mainGame->wOptions->getRelativePosition();
pos.LowerRightCorner.Y = pos.UpperLeftCorner.Y + 140;
mainGame->wOptions->setRelativePosition(pos);
}
if(select_hint)
myswprintf(textBuffer, L"%ls", dataManager.GetDesc(select_hint));
else
myswprintf(textBuffer, dataManager.GetSysString(555));
mainGame->wOptions->setText(textBuffer);
mainGame->PopupElement(mainGame->wOptions);
mainGame->gMutex.Unlock();
}
void ClientField::ReplaySwap() {
std::swap(deck[0], deck[1]);
std::swap(hand[0], hand[1]);
......
......@@ -100,6 +100,7 @@ public:
void ShowSelectCard(bool buttonok = false, bool chain = false);
void ShowChainCard();
void ShowLocationCard();
void ShowSelectOption(int select_hint = 0);
void ReplaySwap();
void RefreshAllCards();
......@@ -117,7 +118,6 @@ public:
void UpdateDeclarableCodeType(bool enter);
void UpdateDeclarableCodeOpcode(bool enter);
void UpdateDeclarableCode(bool enter);
void RefreshCardCountDisplay();
irr::gui::IGUIElement* panel;
......@@ -143,6 +143,7 @@ public:
void ShowCancelOrFinishButton(int buttonOp);
void SetShowMark(ClientCard* pcard, bool enable);
void SetResponseSelectedCards() const;
void SetResponseSelectedOption() const;
void CancelOrFinish();
};
......
......@@ -1323,21 +1323,8 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
mainGame->dField.select_options.clear();
for (int i = 0; i < count; ++i)
mainGame->dField.select_options.push_back(BufferIO::ReadInt32(pbuf));
mainGame->gMutex.Lock();
mainGame->SetStaticText(mainGame->stOptions, 310 * mainGame->xScale, mainGame->textFont,
(wchar_t*)dataManager.GetDesc(mainGame->dField.select_options[0]));
mainGame->btnOptionp->setVisible(false);
if(count > 1)
mainGame->btnOptionn->setVisible(true);
else mainGame->btnOptionn->setVisible(false);
mainGame->dField.selected_option = 0;
if(select_hint)
myswprintf(textBuffer, L"%ls", dataManager.GetDesc(select_hint));
else myswprintf(textBuffer, dataManager.GetSysString(555));
mainGame->dField.ShowSelectOption(select_hint);
select_hint = 0;
mainGame->wOptions->setText(textBuffer);
mainGame->PopupElement(mainGame->wOptions);
mainGame->gMutex.Unlock();
return false;
}
case MSG_SELECT_CARD: {
......@@ -3406,13 +3393,13 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
list<IGUIElement*> children = mainGame->wANAttribute->getChildren();
int count = children.size();
int i = 0;
int filter = 0x1;//属性种族宣言fixme
int filter = 0x1;
list<IGUIElement*>::Iterator current = children.begin();
contents = (char **) malloc(count * sizeof(char *));
do {
if ((*current)->getType() == EGUIET_CHECK_BOX) {
content = (char *) malloc(256 * 4);
if (filter & available) {//属性种族宣言fixme
if (filter & available) {
BufferIO::EncodeUTF8(((IGUICheckBox*) (*current))->getText(),
content);
}
......
......@@ -283,6 +283,7 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
break;
}
case BUTTON_OPTION_PREV: {
mainGame->soundEffectPlayer->doPressButton();
selected_option--;
mainGame->btnOptionn->setVisible(true);
if(selected_option == 0)
......@@ -291,6 +292,7 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
break;
}
case BUTTON_OPTION_NEXT: {
mainGame->soundEffectPlayer->doPressButton();
selected_option++;
mainGame->btnOptionp->setVisible(true);
if(selected_option == select_options.size() - 1)
......@@ -298,22 +300,39 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
mainGame->SetStaticText(mainGame->stOptions, 310 * mainGame->xScale, mainGame->textFont, (wchar_t*)dataManager.GetDesc(select_options[selected_option]));
break;
}
case BUTTON_OPTION_OK: {
case BUTTON_OPTION_0: {
mainGame->soundEffectPlayer->doPressButton();
if (mainGame->dInfo.curMsg == MSG_SELECT_OPTION) {
DuelClient::SetResponseI(selected_option);
} else {
int index = 0;
while(activatable_cards[index] != command_card || activatable_descs[index].first != select_options[selected_option]) index++;
if (mainGame->dInfo.curMsg == MSG_SELECT_IDLECMD) {
DuelClient::SetResponseI((index << 16) + 5);
} else if (mainGame->dInfo.curMsg == MSG_SELECT_BATTLECMD) {
DuelClient::SetResponseI(index << 16);
} else {
DuelClient::SetResponseI(index);
selected_option = 0;
SetResponseSelectedOption();
break;
}
case BUTTON_OPTION_1: {
mainGame->soundEffectPlayer->doPressButton();
selected_option = 1;
SetResponseSelectedOption();
break;
}
mainGame->HideElement(mainGame->wOptions, true);
case BUTTON_OPTION_2: {
mainGame->soundEffectPlayer->doPressButton();
selected_option = 2;
SetResponseSelectedOption();
break;
}
case BUTTON_OPTION_3: {
mainGame->soundEffectPlayer->doPressButton();
selected_option = 3;
SetResponseSelectedOption();
break;
}
case BUTTON_OPTION_4: {
mainGame->soundEffectPlayer->doPressButton();
selected_option = 4;
SetResponseSelectedOption();
break;
}
case BUTTON_OPTION_OK: {
mainGame->soundEffectPlayer->doPressButton();
SetResponseSelectedOption();
break;
}
case BUTTON_ANNUMBER_OK: {
......@@ -368,12 +387,8 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
}
DuelClient::SendResponse();
} else {
mainGame->SetStaticText(mainGame->stOptions, 310 * mainGame->xScale, mainGame->textFont, (wchar_t*)dataManager.GetDesc(select_options[0]));
selected_option = 0;
command_card = clicked_card;
mainGame->btnOptionp->setVisible(false);
mainGame->btnOptionn->setVisible(true);
mainGame->ShowElement(mainGame->wOptions);
ShowSelectOption();
}
} else {
selectable_cards.clear();
......@@ -654,12 +669,8 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
}
mainGame->HideElement(mainGame->wCardSelect, true);
} else {
mainGame->SetStaticText(mainGame->stOptions, 310 * mainGame->xScale, mainGame->textFont, (wchar_t*)dataManager.GetDesc(select_options[0]));
selected_option = 0;
mainGame->btnOptionp->setVisible(false);
mainGame->btnOptionn->setVisible(true);
mainGame->wCardSelect->setVisible(false);
mainGame->ShowElement(mainGame->wOptions);
ShowSelectOption();
}
break;
}
......@@ -2246,6 +2257,22 @@ void ClientField::SetResponseSelectedCards() const {
respbuf[i + 1] = selected_cards[i]->select_seq;
DuelClient::SetResponseB(respbuf, selected_cards.size() + 1);
}
void ClientField::SetResponseSelectedOption() const {
if(mainGame->dInfo.curMsg == MSG_SELECT_OPTION) {
DuelClient::SetResponseI(selected_option);
} else {
int index = 0;
while(activatable_cards[index] != command_card || activatable_descs[index].first != select_options[selected_option]) index++;
if(mainGame->dInfo.curMsg == MSG_SELECT_IDLECMD) {
DuelClient::SetResponseI((index << 16) + 5);
} else if(mainGame->dInfo.curMsg == MSG_SELECT_BATTLECMD) {
DuelClient::SetResponseI(index << 16);
} else {
DuelClient::SetResponseI(index);
}
}
mainGame->HideElement(mainGame->wOptions, true);
}
void ClientField::CancelOrFinish() {
switch(mainGame->dInfo.curMsg) {
case MSG_WAITING: {
......
......@@ -609,45 +609,9 @@ bool Game::Initialize() {
btnOptionOK = env->addButton(rect<s32>(130 * xScale, 115 * yScale, 260 * xScale, 165 * yScale), wOptions, BUTTON_OPTION_OK, dataManager.GetSysString(1211));
btnOptionp = env->addButton(rect<s32>(20 * xScale, 115 * yScale, 100 * xScale, 165 * yScale), wOptions, BUTTON_OPTION_PREV, L"<<<");
btnOptionn = env->addButton(rect<s32>(290 * xScale, 115 * yScale, 370 * xScale, 165 * yScale), wOptions, BUTTON_OPTION_NEXT, L">>>");
#else
wFTSelect = env->addWindow(rect<s32>(550 * xScale, 240 * yScale, 780 * xScale, 340 * yScale), false, L"");
wFTSelect->getCloseButton()->setVisible(false);
wFTSelect->setVisible(false);
btnFirst = env->addButton(rect<s32>(10 * xScale, 30 * yScale, 220 * xScale, 55 * yScale), wFTSelect, BUTTON_FIRST, dataManager.GetSysString(100));
btnSecond = env->addButton(rect<s32>(10 * xScale, 60 * yScale, 220 * xScale, 85 * yScale), wFTSelect, BUTTON_SECOND, dataManager.GetSysString(101));
wMessage = env->addWindow(rect<s32>(490 * xScale, 200 * yScale, 840 * xScale, 340 * yScale), false, dataManager.GetSysString(1216));
wMessage->getCloseButton()->setVisible(false);
wMessage->setVisible(false);
stMessage = env->addStaticText(L"", rect<s32>(20 * xScale, 20 * yScale, 350 * xScale, 100 * yScale), false, true, wMessage, -1, false);
stMessage->setTextAlignment(irr::gui::EGUIA_UPPERLEFT, irr::gui::EGUIA_CENTER);
btnMsgOK = env->addButton(rect<s32>(130 * xScale, 105 * yScale, 220 * xScale, 130 * yScale), wMessage, BUTTON_MSG_OK, dataManager.GetSysString(1211));
//auto fade message (310)
wACMessage = env->addWindow(rect<s32>(490 * xScale, 240 * yScale, 840 * xScale, 300 * yScale), false, L"");
wACMessage->getCloseButton()->setVisible(false);
wACMessage->setVisible(false);
wACMessage->setDrawBackground(false);
stACMessage = env->addStaticText(L"", rect<s32>(0 * xScale, 0 * yScale, 350 * xScale, 60 * yScale), true, true, wACMessage, -1, true);
stACMessage->setBackgroundColor(0x6011113d);
stACMessage->setTextAlignment(irr::gui::EGUIA_CENTER, irr::gui::EGUIA_CENTER);
//yes/no (310)
wQuery = env->addWindow(rect<s32>(490 * xScale, 200 * yScale, 840 * xScale, 340 * yScale), false, dataManager.GetSysString(560));
wQuery->getCloseButton()->setVisible(false);
wQuery->setVisible(false);
stQMessage = env->addStaticText(L"", rect<s32>(20 * xScale, 20 * yScale, 350 * xScale, 100 * yScale), false, true, wQuery, -1, false);
stQMessage->setTextAlignment(irr::gui::EGUIA_UPPERLEFT, irr::gui::EGUIA_CENTER);
btnYes = env->addButton(rect<s32>(100 * xScale, 105 * yScale, 150 * xScale, 130 * yScale), wQuery, BUTTON_YES, dataManager.GetSysString(1213));
btnNo = env->addButton(rect<s32>(200 * xScale, 105 * yScale, 250 * xScale, 130 * yScale), wQuery, BUTTON_NO, dataManager.GetSysString(1214));
//options (310)
wOptions = env->addWindow(rect<s32>(490 * xScale, 200 * yScale, 840 * xScale, 340 * yScale), false, L"");
wOptions->getCloseButton()->setVisible(false);
wOptions->setVisible(false);
stOptions = env->addStaticText(L"", rect<s32>(20 * xScale, 20 * yScale, 350 * xScale, 100 * yScale), false, true, wOptions, -1, false);
stOptions->setTextAlignment(irr::gui::EGUIA_UPPERLEFT, irr::gui::EGUIA_CENTER);
btnOptionOK = env->addButton(rect<s32>(130 * xScale, 105 * yScale, 220 * xScale, 130 * yScale), wOptions, BUTTON_OPTION_OK, dataManager.GetSysString(1211));
btnOptionp = env->addButton(rect<s32>(20 * xScale, 105 * yScale, 60 * xScale, 130 * yScale), wOptions, BUTTON_OPTION_PREV, L"<<<");
btnOptionn = env->addButton(rect<s32>(290 * xScale, 105 * yScale, 330 * xScale, 130 * yScale), wOptions, BUTTON_OPTION_NEXT, L">>>");
for(int i = 0; i < 5; ++i) {
btnOption[i] = env->addButton(rect<s32>(10 * xScale, (30 + 40 * i) * yScale, 340 * xScale, (60 + 40 * i) * yScale), wOptions, BUTTON_OPTION_0 + i, L"");
}
#endif
//pos select
wPosSelect = env->addWindow(rect<s32>(340 * xScale, 200 * yScale, 935 * xScale, 410 * yScale), false, dataManager.GetSysString(561));
......@@ -668,8 +632,6 @@ bool Game::Initialize() {
//card select
#ifdef _IRR_ANDROID_PLATFORM_
wCardSelect = env->addWindow(rect<s32>(320 * xScale, 100 * yScale, 1000 * xScale, 430 * yScale), false, L"");
#else
wCardSelect = env->addWindow(rect<s32>(320 * xScale, 100 * yScale, 1000 * xScale, 400 * yScale), false, L"");
#endif
wCardSelect->getCloseButton()->setVisible(false);
wCardSelect->setVisible(false);
......
......@@ -141,6 +141,8 @@ public:
void AddChatMsg(wchar_t* msg, int player);
void ClearChatMsg();
void AddDebugMsg(char* msgbuf);
bool MakeDirectory(const std::string folder);
void initUtils();
void ClearTextures();
void CloseDuelWindow();
......@@ -340,6 +342,7 @@ public:
irr::gui::IGUIButton* btnOptionp;
irr::gui::IGUIButton* btnOptionn;
irr::gui::IGUIButton* btnOptionOK;
irr::gui::IGUIButton* btnOption[5];
//pos selection
irr::gui::IGUIWindow* wPosSelect;
irr::gui::CGUIImageButton* btnPSAU;
......@@ -551,6 +554,11 @@ extern Game* mainGame;
#define BUTTON_OPTION_PREV 220
#define BUTTON_OPTION_NEXT 221
#define BUTTON_OPTION_OK 222
#define BUTTON_OPTION_0 223
#define BUTTON_OPTION_1 224
#define BUTTON_OPTION_2 225
#define BUTTON_OPTION_3 226
#define BUTTON_OPTION_4 227
#define BUTTON_CARD_0 230
#define BUTTON_CARD_1 231
#define BUTTON_CARD_2 232
......
......@@ -1409,18 +1409,18 @@ int32 field::process_phase_event(int16 step, int32 phase) {
effect* peffect = *eit++;
if(peffect->code != EFFECT_SET_CONTROL)
continue;
if(peffect->get_owner_player() != check_player)
continue;
if(!(peffect->reset_flag & phase))
continue;
uint8 pid = peffect->get_handler_player();
if(pid != check_player)
continue;
uint8 tp = infos.turn_player;
if(!(((peffect->reset_flag & RESET_SELF_TURN) && pid == tp) || ((peffect->reset_flag & RESET_OPPO_TURN) && pid != tp)))
continue;
if(peffect->reset_count != 1)
continue;
card* phandler = peffect->get_handler();
if(peffect->get_owner_player() != phandler->current.controler) {
if(pid != phandler->current.controler) {
if(peffect->is_flag(EFFECT_FLAG_FIELD_ONLY))
remove_effect(peffect);
else
......
......@@ -905,3 +905,7 @@
!setname 0x11b 自奏圣乐 オルフェゴール
!setname 0x11c 雷龙 サンダー·ドラゴン
!setname 0x11d 禁忌的 禁じられた
!setname 0x11e 危险! Danger!
!setname 0x11f 奈芙提斯 ネフティス
!setname 0x120 调皮宝贝 プランキッズ
!setname 0x121 魔妖
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