Commit 48d84bcc authored by nanahira's avatar nanahira

Merge branch 'master' into side

parents 9f632d6e ee40e6d0
......@@ -76,6 +76,7 @@
*.log
/.vscode
/bak/
/output
/temp
[Tt]humbs.cdb
......
No preview for this file type
......@@ -94,6 +94,7 @@ void ClientField::Clear() {
pzone_act[1] = false;
conti_act = false;
deck_reversed = false;
RefreshCardCountDisplay();
}
void ClientField::Initial(int player, int deckc, int extrac) {
ClientCard* pcard;
......@@ -117,6 +118,7 @@ void ClientField::Initial(int player, int deckc, int extrac) {
pcard->position = POS_FACEDOWN_DEFENSE;
GetCardLocation(pcard, &pcard->curPos, &pcard->curRot, true);
}
RefreshCardCountDisplay();
}
ClientCard* ClientField::GetCard(int controler, int location, int sequence, int sub_seq) {
std::vector<ClientCard*>* lst = 0;
......@@ -226,6 +228,7 @@ void ClientField::AddCard(ClientCard* pcard, int controler, int location, int se
break;
}
}
RefreshCardCountDisplay();
}
ClientCard* ClientField::RemoveCard(int controler, int location, int sequence) {
ClientCard* pcard = 0;
......@@ -297,6 +300,7 @@ ClientCard* ClientField::RemoveCard(int controler, int location, int sequence) {
}
}
pcard->location = 0;
RefreshCardCountDisplay();
return pcard;
}
void ClientField::UpdateCard(int controler, int location, int sequence, char* data) {
......@@ -1462,4 +1466,28 @@ void ClientField::UpdateDeclarableCode(bool enter) {
else
UpdateDeclarableCodeOpcode(enter);
}
void ClientField::RefreshCardCountDisplay() {
for(int p = 0; p < 2; ++p) {
mainGame->dInfo.card_count[p] = hand[p].size();
for(auto it = mzone[p].begin(); it != mzone[p].end(); ++it) {
if(*it)
mainGame->dInfo.card_count[p]++;
}
for(auto it = szone[p].begin(); it != szone[p].end(); ++it) {
if(*it)
mainGame->dInfo.card_count[p]++;
}
myswprintf(mainGame->dInfo.str_card_count[p], L"%d", mainGame->dInfo.card_count[p]);
}
if(mainGame->dInfo.card_count[0] > mainGame->dInfo.card_count[1]) {
mainGame->dInfo.card_count_color[0] = 0xffffff00;
mainGame->dInfo.card_count_color[1] = 0xffff0000;
} else if(mainGame->dInfo.card_count[1] > mainGame->dInfo.card_count[0]) {
mainGame->dInfo.card_count_color[1] = 0xffffff00;
mainGame->dInfo.card_count_color[0] = 0xffff0000;
} else {
mainGame->dInfo.card_count_color[0] = 0xffffffff;
mainGame->dInfo.card_count_color[1] = 0xffffffff;
}
}
}
......@@ -115,6 +115,8 @@ public:
void UpdateDeclarableCodeOpcode(bool enter);
void UpdateDeclarableCode(bool enter);
void RefreshCardCountDisplay();
irr::gui::IGUIElement* panel;
std::vector<int> ancard;
int hovered_controler;
......
......@@ -313,24 +313,7 @@ bool DeckManager::DeleteDeck(Deck& deck, const wchar_t* name) {
return result == 0;
#endif
}
const wchar_t* DeckManager::GetMainFormatString() {
myswprintf(DeckFormatBuffer, L"%d ( Monster: %d / Spell: %d / Trap: %d )", deckManager.current_deck.main.size(), GetTypeCount(deckManager.current_deck.main, TYPE_MONSTER), GetTypeCount(deckManager.current_deck.main, TYPE_SPELL), GetTypeCount(deckManager.current_deck.main, TYPE_TRAP));
wchar_t* result = DeckFormatBuffer;
return result;
}
const wchar_t* DeckManager::GetExtraFormatString() {
myswprintf(DeckFormatBuffer, L"%d ( Fusion: %d / Synchro: %d / Xyz: %d / Link: %d )", deckManager.current_deck.extra.size(), GetTypeCount(deckManager.current_deck.extra, TYPE_FUSION), GetTypeCount(deckManager.current_deck.extra, TYPE_SYNCHRO), GetTypeCount(deckManager.current_deck.extra, TYPE_XYZ), GetTypeCount(deckManager.current_deck.extra, TYPE_LINK));
wchar_t* result = DeckFormatBuffer;
return result;
}
const wchar_t* DeckManager::GetSideFormatString() {
int mc = GetTypeCount(deckManager.current_deck.side, TYPE_MONSTER);
int ec = GetTypeCount(deckManager.current_deck.side, TYPE_FUSION | TYPE_SYNCHRO | TYPE_XYZ | TYPE_LINK);
myswprintf(DeckFormatBuffer, L"%d ( Monster: %d / Spell: %d / Trap: %d / Extra: %d )", deckManager.current_deck.side.size(), mc - ec, GetTypeCount(deckManager.current_deck.side, TYPE_SPELL), GetTypeCount(deckManager.current_deck.side, TYPE_TRAP), ec);
wchar_t* result = DeckFormatBuffer;
return result;
}
int DeckManager::GetTypeCount(std::vector<code_pointer> list, unsigned int ctype) {
int DeckManager::TypeCount(std::vector<code_pointer> list, unsigned int ctype) {
int res = 0;
for(size_t i = 0; i < list.size(); ++i) {
code_pointer cur = list[i];
......
......@@ -46,10 +46,7 @@ public:
bool DeleteDeck(Deck& deck, const wchar_t* name);
static bool RenameDeck(const wchar_t* oldname, const wchar_t* newname);
wchar_t DeckFormatBuffer[128];
const wchar_t* GetMainFormatString();
const wchar_t* GetSideFormatString();
const wchar_t* GetExtraFormatString();
int GetTypeCount(std::vector<code_pointer> list, unsigned int ctype);
int TypeCount(std::vector<code_pointer> list, unsigned int ctype);
};
extern DeckManager deckManager;
......
This diff is collapsed.
......@@ -2334,7 +2334,13 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
}
case MSG_SHUFFLE_SET_CARD: {
std::vector<ClientCard*>::iterator cit;
std::vector<ClientCard*>* lst = 0;
int loc = BufferIO::ReadInt8(pbuf);
int count = BufferIO::ReadInt8(pbuf);
if(loc == LOCATION_MZONE)
lst = mainGame->dField.mzone;
else
lst = mainGame->dField.szone;
ClientCard* mc[5];
ClientCard* swp;
int c, l, s, ps;
......@@ -2343,7 +2349,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
l = BufferIO::ReadInt8(pbuf);
s = BufferIO::ReadInt8(pbuf);
BufferIO::ReadInt8(pbuf);
mc[i] = mainGame->dField.mzone[c][s];
mc[i] = lst[c][s];
mc[i]->SetCode(0);
if(!mainGame->dInfo.isReplaySkiping) {
mc[i]->dPos = irr::core::vector3df((3.95f - mc[i]->curPos.X) / 10, 0, 0.05f);
......@@ -2361,9 +2367,9 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
BufferIO::ReadInt8(pbuf);
ps = mc[i]->sequence;
if (l > 0) {
swp = mainGame->dField.mzone[c][s];
mainGame->dField.mzone[c][ps] = swp;
mainGame->dField.mzone[c][s] = mc[i];
swp = lst[c][s];
lst[c][ps] = swp;
lst[c][s] = mc[i];
mc[i]->sequence = s;
swp->sequence = ps;
}
......
......@@ -1858,7 +1858,7 @@ bool ClientField::OnCommonEvent(const irr::SEvent& event) {
break;
}
u32 pos = mainGame->scrCardText->getPos();
mainGame->SetStaticText(mainGame->stText, mainGame->stText->getRelativePosition().getWidth() - 25, mainGame->textFont, mainGame->showingtext, pos);
mainGame->SetStaticText(mainGame->stText, mainGame->stText->getRelativePosition().getWidth() - 25, mainGame->guiFont, mainGame->showingtext, pos);
return true;
break;
}
......
......@@ -855,7 +855,6 @@ void Game::RefreshTimeDisplay() {
}
myswprintf(dInfo.str_time_left[0], L"%d", dInfo.time_left[0]);
myswprintf(dInfo.str_time_left[1], L"%d", dInfo.time_left[1]);
myswprintf(dInfo.str_time_limit, L"%d", dInfo.time_limit);
}
void Game::BuildProjectionMatrix(irr::core::matrix4& mProjection, f32 left, f32 right, f32 bottom, f32 top, f32 znear, f32 zfar) {
for(int i = 0; i < 16; ++i)
......@@ -1435,7 +1434,7 @@ void Game::ShowCardInfo(int code, bool resize) {
sc = aptr->second.setcode;
}
if(sc) {
offset = 23 * yScale;
offset = 23;// *yScale;
myswprintf(formatBuffer, L"%ls%ls", dataManager.GetSysString(1329), dataManager.FormatSetName(sc));
stSetName->setText(formatBuffer);
} else
......@@ -1476,24 +1475,24 @@ void Game::ShowCardInfo(int code, bool resize) {
wcscat(formatBuffer, scaleBuffer);
}
stDataInfo->setText(formatBuffer);
if (cd.type & TYPE_LINK && cd.level > 5 && window_size.Width < 1220.0) {
stDataInfo->setRelativePosition(recti(15, 60 * yScale, 300 * xScale - 13, (83 + 15) * yScale));
stSetName->setRelativePosition(rect<s32>(15, (83 + 15) * yScale, 296 * xScale, (83 + 15) * yScale + offset));
stText->setRelativePosition(rect<s32>(15, (83 + 15) * yScale + offset, 287 * xScale, 324 * yScale));
scrCardText->setRelativePosition(rect<s32>(287 * xScale - 20, (83 + 15) + offset, 287 * xScale, 324 * yScale));
} else {
stDataInfo->setRelativePosition(recti(15, 60 * yScale, 300 * xScale - 13, 83 * yScale));
stSetName->setRelativePosition(rect<s32>(15, 83 * yScale, 296 * xScale, 83 * yScale + offset));
stText->setRelativePosition(rect<s32>(15, 83 * yScale + offset, 287 * xScale, 324 * yScale));
scrCardText->setRelativePosition(rect<s32>(287 * xScale - 20, 83 + offset, 287 * xScale, 324 * yScale));
}
int offset_sayuri = 0;
if(cd.type & TYPE_LINK && cd.level > 5 && window_size.Width < 1220.0)
offset_sayuri = 15;
stDataInfo->setRelativePosition(rect<s32>(15, 60, 300 * xScale - 13, (83 + offset_sayuri)));
//stSetName->setRelativePosition(rect<s32>(15, (83 + offset_sayuri) * yScale, 296 * xScale, (83 + offset_sayuri) * yScale + offset));
//stText->setRelativePosition(rect<s32>(15, (83 + offset_sayuri) * yScale + offset, 287 * xScale, 324 * yScale));
stSetName->setRelativePosition(rect<s32>(15, (83 + offset_sayuri), 296 * xScale, (83 + offset_sayuri) + offset));
stText->setRelativePosition(rect<s32>(15, (83 + offset_sayuri) + offset, 287 * xScale, 324 * yScale));
scrCardText->setRelativePosition(rect<s32>(287 * xScale - 20, (83 + offset_sayuri) + offset, 287 * xScale, 324 * yScale));
} else {
myswprintf(formatBuffer, L"[%ls]", dataManager.FormatType(cd.type));
stInfo->setText(formatBuffer);
stDataInfo->setRelativePosition(recti(15, 60 * yScale, 300 * xScale - 13, 83 * yScale));
stDataInfo->setRelativePosition(recti(15, 60, 300 * xScale - 13, 83));
stDataInfo->setText(L"");
stSetName->setRelativePosition(rect<s32>(15, 60 * yScale, 296 * xScale, 60 * yScale + offset));
stText->setRelativePosition(rect<s32>(15, 60 * yScale + offset, 287 * xScale, 324 * yScale));
//stSetName->setRelativePosition(rect<s32>(15, 60 * yScale, 296 * xScale, 60 * yScale + offset));
//stText->setRelativePosition(rect<s32>(15, 60 * yScale + offset, 287 * xScale, 324 * yScale));
stSetName->setRelativePosition(rect<s32>(15, 60, 296 * xScale, 60 + offset));
stText->setRelativePosition(rect<s32>(15, 60 + offset, 287 * xScale, 324 * yScale));
scrCardText->setRelativePosition(rect<s32>(287 * xScale - 20, 60 + offset, 287 * xScale, 324 * yScale));
}
showingcode = code;
......@@ -1673,6 +1672,9 @@ void Game::CloseDuelWindow() {
wReplaySave->setVisible(false);
stHintMsg->setVisible(false);
btnSideOK->setVisible(false);
btnSideShuffle->setVisible(false);
btnSideSort->setVisible(false);
btnSideReload->setVisible(false);
btnLeaveGame->setVisible(false);
btnSpectatorSwap->setVisible(false);
btnChainIgnore->setVisible(false);
......@@ -1716,7 +1718,7 @@ void Game::OnResize() {
lpcFont = irr::gui::CGUITTFont::createTTFont(env, gameConf.numfont, 48 * yScale);
//guiFont = irr::gui::CGUITTFont::createTTFont(env, gameConf.textfont, gameConf.textfontsize * yScale);
//env->getSkin()->setFont(guiFont);
textFont = irr::gui::CGUITTFont::createTTFont(env, gameConf.textfont, gameConf.textfontsize * yScale);
textFont = irr::gui::CGUITTFont::createTTFont(env, gameConf.textfont, (yScale > 0.642 ? gameConf.textfontsize * yScale : 9));
old_numFont->drop();
old_adFont->drop();
old_lpcFont->drop();
......@@ -1819,8 +1821,9 @@ void Game::OnResize() {
wCardImg->setRelativePosition(ResizeCard(1, 1, 20, 18));
imgCard->setRelativePosition(ResizeCard(10, 9, 0, 0));
wInfos->setRelativePosition(Resize(1, 275, 301, 639));
stName->setRelativePosition(recti(10, 10, 300 * xScale - 13, 10 + 22 * yScale));
stInfo->setRelativePosition(recti(15, 37 * yScale, 300 * xScale - 13, 60 * yScale));
stName->setRelativePosition(recti(10, 10, 300 * xScale - 13, 10 + 22));
//stName->setRelativePosition(recti(10, 10, 300 * xScale - 13, 10 + 22 * yScale));
//stInfo->setRelativePosition(recti(15, 37 * yScale, 300 * xScale - 13, 60 * yScale));
//stDataInfo->setRelativePosition(recti(15, 60 * yScale, 300 * xScale - 13, 83 * yScale));
lstLog->setRelativePosition(Resize(10, 10, 290, 290));
//const auto& tsize = stText->getRelativePosition();
......
......@@ -69,6 +69,7 @@ struct DuelInfo {
bool tag_player[2];
int lp[2];
int start_lp[2];
int card_count[2];
int duel_rule;
int turn;
short curMsg;
......@@ -82,9 +83,10 @@ struct DuelInfo {
unsigned char time_player;
unsigned short time_limit;
unsigned short time_left[2];
wchar_t str_time_limit[16];
wchar_t str_time_left[2][16];
video::SColor time_color[2];
wchar_t str_card_count[2][16];
video::SColor card_count_color[2];
bool isReplaySwapped;
};
......
......@@ -74,6 +74,7 @@ bool ImageManager::Initial() {
snprintf(buff, 100, "textures/pscale/lscale_%d.png", i);
tLScale[i] = driver->getTexture(buff);
}
tClock = driver->getTexture("textures/clock.png");
return true;
}
irr::video::ITexture* ImageManager::GetRandomImage(int image_type) {
......
......@@ -51,6 +51,7 @@ public:
irr::video::ITexture* tFieldTransparent[2];
irr::video::ITexture* tRScale[14];
irr::video::ITexture* tLScale[14];
irr::video::ITexture* tClock;
};
extern ImageManager imageManager;
......
......@@ -499,6 +499,7 @@ bool ReplayMode::ReplayAnalyze(char* msg, unsigned int len) {
break;
}
case MSG_SHUFFLE_SET_CARD: {
pbuf++;
count = BufferIO::ReadInt8(pbuf);
pbuf += count * 8;
DuelClient::ClientAnalyze(offset, pbuf - offset);
......
......@@ -879,14 +879,21 @@ int SingleDuel::Analyze(char* msgbuffer, unsigned int len) {
break;
}
case MSG_SHUFFLE_SET_CARD: {
int loc = BufferIO::ReadInt8(pbuf);
count = BufferIO::ReadInt8(pbuf);
pbuf += count * 8;
NetServer::SendBufferToPlayer(players[0], STOC_GAME_MSG, offset, pbuf - offset);
NetServer::ReSendToPlayer(players[1]);
for(auto oit = observers.begin(); oit != observers.end(); ++oit)
NetServer::ReSendToPlayer(*oit);
if(loc == LOCATION_MZONE) {
RefreshMzone(0, 0x181fff, 0);
RefreshMzone(1, 0x181fff, 0);
}
else {
RefreshSzone(0, 0x181fff, 0);
RefreshSzone(1, 0x181fff, 0);
}
break;
}
case MSG_NEW_TURN: {
......
......@@ -417,6 +417,7 @@ bool SingleMode::SinglePlayAnalyze(char* msg, unsigned int len) {
break;
}
case MSG_SHUFFLE_SET_CARD: {
pbuf++;
count = BufferIO::ReadInt8(pbuf);
pbuf += count * 8;
DuelClient::ClientAnalyze(offset, pbuf - offset);
......
......@@ -843,6 +843,7 @@ int TagDuel::Analyze(char* msgbuffer, unsigned int len) {
break;
}
case MSG_SHUFFLE_SET_CARD: {
int loc = BufferIO::ReadInt8(pbuf);
count = BufferIO::ReadInt8(pbuf);
pbuf += count * 8;
NetServer::SendBufferToPlayer(players[0], STOC_GAME_MSG, offset, pbuf - offset);
......@@ -851,8 +852,13 @@ int TagDuel::Analyze(char* msgbuffer, unsigned int len) {
NetServer::ReSendToPlayer(players[3]);
for(auto oit = observers.begin(); oit != observers.end(); ++oit)
NetServer::ReSendToPlayer(*oit);
if(loc == LOCATION_MZONE) {
RefreshMzone(0, 0x181fff, 0);
RefreshMzone(1, 0x181fff, 0);
} else {
RefreshSzone(0, 0x181fff, 0);
RefreshSzone(1, 0x181fff, 0);
}
break;
}
case MSG_NEW_TURN: {
......
Subproject commit 5484e52fd1a9e81c36101e0bb8e4e1e859368fe5
Subproject commit 9fb43bf0ef49641ba985b7b7a6666221acf5cf1e
......@@ -2,11 +2,9 @@ solution "ygo"
location "build"
language "C++"
objdir "obj"
startproject "ygopro"
configurations { "Debug", "Release" }
configurations { "Release", "Debug" }
defines { "LUA_COMPAT_5_2" }
configuration "windows"
defines { "WIN32", "_WIN32" }
......
Subproject commit eadaf7e6d270095cc47c5980c6fc1de95cfce530
Subproject commit ace33ce35cf778cb38fb187148c4ed58d63f8460
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