Commit deed80f6 authored by fallenstardust's avatar fallenstardust

sync gframe

parent 780173ad
......@@ -213,14 +213,17 @@ bool ClientCard::client_card_sort(ClientCard* c1, ClientCard* c2) {
else return c1->sequence < c2->sequence;
else {
if(c1->location & (LOCATION_DECK | LOCATION_GRAVE | LOCATION_REMOVED | LOCATION_EXTRA)) {
for(size_t i = 0; i < mainGame->dField.chains.size(); ++i) {
auto chit = mainGame->dField.chains[i];
if(c1 == chit.chain_card || chit.target.find(c1) != chit.target.end())
return true;
auto it1 = std::find_if(mainGame->dField.chains.rbegin(), mainGame->dField.chains.rend(), [c1](const auto& ch) {
return c1 == ch.chain_card || ch.target.find(c1) != ch.target.end();
});
auto it2 = std::find_if(mainGame->dField.chains.rbegin(), mainGame->dField.chains.rend(), [c2](const auto& ch) {
return c2 == ch.chain_card || ch.target.find(c2) != ch.target.end();
});
if(it1 != mainGame->dField.chains.rend() || it2 != mainGame->dField.chains.rend()) {
return it1 < it2;
}
return c1->sequence > c2->sequence;
}
else
} else
return c1->sequence < c2->sequence;
}
}
......
......@@ -18,6 +18,8 @@ ClientField::ClientField() {
hovered_controler = 0;
hovered_location = 0;
hovered_sequence = 0;
selectable_field = 0;
selected_field = 0;
deck_act = false;
grave_act = false;
remove_act = false;
......
......@@ -92,6 +92,7 @@ inline int _wtoi(const wchar_t * s) {
#include <time.h>
#include <thread>
#include <mutex>
#include <algorithm>
#ifdef _IRR_ANDROID_PLATFORM_
#include <android/bufferio_android.h>
#else
......
......@@ -6,7 +6,6 @@
#include "myfilesystem.h"
#include "game.h"
#include "duelclient.h"
#include <algorithm>
namespace ygo {
......
......@@ -3,7 +3,6 @@
#include "network.h"
#include "game.h"
#include "myfilesystem.h"
#include <algorithm>
namespace ygo {
......@@ -146,7 +145,9 @@ int DeckManager::LoadDeck(Deck& deck, int* dbuf, int mainc, int sidec) {
}
if(cd.type & TYPE_TOKEN)
continue;
else if(cd.type & (TYPE_FUSION | TYPE_SYNCHRO | TYPE_XYZ | TYPE_LINK) && deck.extra.size() < 15) {
else if(cd.type & (TYPE_FUSION | TYPE_SYNCHRO | TYPE_XYZ | TYPE_LINK)) {
if(deck.extra.size() >= 15)
continue;
deck.extra.push_back(dataManager.GetCodePointer(code)); //verified by GetData()
} else if(deck.main.size() < 60) {
deck.main.push_back(dataManager.GetCodePointer(code));
......
......@@ -156,7 +156,7 @@ void Game::DrawBackGround() {
driver->drawVertexPrimitiveList(matManager.vField, 4, matManager.iRectangle, 2);
driver->setMaterial(matManager.mBackLine);
//select field
if(dInfo.curMsg == MSG_SELECT_PLACE || dInfo.curMsg == MSG_SELECT_DISFIELD) {
if(dInfo.curMsg == MSG_SELECT_PLACE || dInfo.curMsg == MSG_SELECT_DISFIELD || dInfo.curMsg == MSG_HINT) {
float cv[4] = {0.0f, 0.0f, 1.0f, 1.0f};
unsigned int filter = 0x1;
for (int i = 0; i < 7; ++i, filter <<= 1) {
......@@ -1127,10 +1127,16 @@ void Game::HideElement(irr::gui::IGUIElement * win, bool set_action) {
for(int i = 0; i < 5; ++i)
btnCardSelect[i]->setDrawImage(false);
dField.conti_selecting = false;
stCardListTip->setVisible(false);
for(auto& pcard : dField.selectable_cards)
dField.SetShowMark(pcard, false);
}
if(win == wCardDisplay) {
for(int i = 0; i < 5; ++i)
btnCardDisplay[i]->setDrawImage(false);
stCardListTip->setVisible(false);
for(auto& pcard : dField.display_cards)
dField.SetShowMark(pcard, false);
}
fadingList.push_back(fu);
}
......
......@@ -7,7 +7,6 @@
#include "game.h"
#include "replay.h"
#include "replay_mode.h"
#include <algorithm>
#ifdef _IRR_ANDROID_PLATFORM_
#include <android/android_tools.h>
#endif
......@@ -1079,6 +1078,48 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
mainGame->WaitFrameSignal(30);
break;
}
case HINT_ZONE: {
if(mainGame->LocalPlayer(player) == 1)
data = (data >> 16) | (data << 16);
for(unsigned filter = 0x1; filter != 0; filter <<= 1) {
std::wstring str;
if(unsigned s = filter & data) {
if(s & 0x60) {
str += dataManager.GetSysString(1081);
data &= ~0x600000;
} else if(s & 0xffff)
str += dataManager.GetSysString(102);
else if(s & 0xffff0000) {
str += dataManager.GetSysString(103);
s >>= 16;
}
if(s & 0x1f)
str += dataManager.GetSysString(1002);
else if(s & 0xff00) {
s >>= 8;
if(s & 0x1f)
str += dataManager.GetSysString(1003);
else if(s & 0x20)
str += dataManager.GetSysString(1008);
else if(s & 0xc0)
str += dataManager.GetSysString(1009);
}
int seq = 1;
for(int i = 0x1; i < 0x100; i <<= 1) {
if(s & i)
break;
++seq;
}
str += L"(" + std::to_wstring(seq) + L")";
myswprintf(textBuffer, dataManager.GetSysString(1510), str.c_str());
mainGame->AddLog(textBuffer);
}
}
mainGame->dField.selectable_field = data;
mainGame->WaitFrameSignal(40);
mainGame->dField.selectable_field = 0;
break;
}
}
break;
}
......@@ -1095,7 +1136,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
else if(mainGame->LocalPlayer(player) == 0) {
mainGame->showcardcode = 1;
if(match_kill)
myswprintf(vic_buf, dataManager.GetVictoryString(0x20), dataManager.GetName(match_kill));
myswprintf(vic_buf, dataManager.GetVictoryString(0xffff), dataManager.GetName(match_kill));
else if(type < 0x10)
myswprintf(vic_buf, L"[%ls] %ls", mainGame->dInfo.clientname, dataManager.GetVictoryString(type));
else
......@@ -1104,7 +1145,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
} else {
mainGame->showcardcode = 2;
if(match_kill)
myswprintf(vic_buf, dataManager.GetVictoryString(0x20), dataManager.GetName(match_kill));
myswprintf(vic_buf, dataManager.GetVictoryString(0xffff), dataManager.GetName(match_kill));
else if(type < 0x10)
myswprintf(vic_buf, L"[%ls] %ls", mainGame->dInfo.hostname, dataManager.GetVictoryString(type));
else
......
......@@ -10,7 +10,6 @@
#include "single_mode.h"
#include "materials.h"
#include "../ocgcore/common.h"
#include <algorithm>
namespace ygo {
......@@ -644,7 +643,6 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
case BUTTON_CARD_4: {
if(mainGame->dInfo.isReplay)
break;
mainGame->stCardListTip->setVisible(false);
switch(mainGame->dInfo.curMsg) {
case MSG_SELECT_IDLECMD:
case MSG_SELECT_BATTLECMD:
......@@ -741,7 +739,8 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
if (selected_cards.size() > 0) {
SetResponseSelectedCards();
ShowCancelOrFinishButton(0);
mainGame->HideElement(mainGame->wCardSelect, true);}
mainGame->HideElement(mainGame->wCardSelect, true);
}
break;
}
case MSG_SELECT_SUM: {
......@@ -790,7 +789,6 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
break;
}
case BUTTON_CARD_SEL_OK: {
mainGame->stCardListTip->setVisible(false);
if(mainGame->dInfo.isReplay) {
mainGame->HideElement(mainGame->wCardSelect);
break;
......@@ -1037,13 +1035,13 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
break;
}
case irr::gui::EGET_ELEMENT_LEFT: {
if(id >= BUTTON_CARD_0 && id <= BUTTON_CARD_4) {
if(id >= BUTTON_CARD_0 && id <= BUTTON_CARD_4 && mainGame->stCardListTip->isVisible()) {
int pos = mainGame->scrCardList->getPos() / 10;
ClientCard* mcard = selectable_cards[id - BUTTON_CARD_0 + pos];
SetShowMark(mcard, false);
mainGame->stCardListTip->setVisible(false);
}
if(id >= BUTTON_DISPLAY_0 && id <= BUTTON_DISPLAY_4) {
if(id >= BUTTON_DISPLAY_0 && id <= BUTTON_DISPLAY_4 && mainGame->stCardListTip->isVisible()) {
int pos = mainGame->scrDisplayList->getPos() / 10;
ClientCard* mcard = display_cards[id - BUTTON_DISPLAY_0 + pos];
SetShowMark(mcard, false);
......
#include "replay.h"
#include "../ocgcore/ocgapi.h"
#include "../ocgcore/common.h"
#include <algorithm>
#include "lzma/LzmaLib.h"
#include "myfilesystem.h"
......
......@@ -589,7 +589,8 @@ int SingleDuel::Analyze(char* msgbuffer, unsigned int len) {
case 6:
case 7:
case 8:
case 9: {
case 9:
case 11: {
NetServer::SendBufferToPlayer(players[1 - player], STOC_GAME_MSG, offset, pbuf - offset);
for(auto oit = observers.begin(); oit != observers.end(); ++oit)
NetServer::ReSendToPlayer(*oit);
......
......@@ -536,7 +536,8 @@ int TagDuel::Analyze(char* msgbuffer, unsigned int len) {
case 6:
case 7:
case 8:
case 9: {
case 9:
case 11: {
for(int i = 0; i < 4; ++i)
if(players[i] != cur_player[player])
NetServer::SendBufferToPlayer(players[i], STOC_GAME_MSG, offset, pbuf - offset);
......
......@@ -53,6 +53,8 @@
!system 98 是否要解放对方怪兽?
!system 100 先攻
!system 101 后攻
!system 102 我方
!system 103 对方
!system 200 是否在[%ls]发动[%ls]的效果?
!system 201 此时没有可以发动的效果
!system 202 是否要确认场上的情况?
......@@ -204,6 +206,7 @@
!system 1075 特殊召唤
!system 1076 连接
!system 1080 (N/A)
!system 1081 额外怪兽区
#GUI
!system 1100 魔陷破坏
!system 1101 怪兽破坏
......@@ -524,7 +527,8 @@
!victory 0x1d 「方程式运动员胜利团队」效果胜利
!victory 0x1e 「飞行象」效果胜利
!victory 0x1f 「守护神 艾克佐迪亚」效果胜利
!victory 0x20 由于「%ls」的效果获得比赛胜利
!victory 0x20 「真艾克佐迪亚」效果胜利
!victory 0xffff 由于「%ls」的效果获得比赛胜利
#counters
!counter 0x1 魔力指示物
!counter 0x1002 楔指示物
......@@ -1009,3 +1013,6 @@
!setname 0x139 守护神官 守護神官
!setname 0x13a 拟声 オノマト
!setname 0x13b 叛逆 リベリオン
!setname 0x13c 代码破坏者 コードブレイカー
!setname 0x13d 星义 ネメシス
!setname 0x13e 巴巴罗斯 バルバロス
\ No newline at end of file
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