Commit 073692e2 authored by mercury233's avatar mercury233

change side chat drawing

parent 59413027
...@@ -989,26 +989,40 @@ void Game::DrawSpec() { ...@@ -989,26 +989,40 @@ void Game::DrawSpec() {
showChat = false; showChat = false;
hideChatTimer--; hideChatTimer--;
} }
int chatRectY = 0;
for(int i = 0; i < 8; ++i) { for(int i = 0; i < 8; ++i) {
static unsigned int chatColor[] = {0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xff8080ff, 0xffff4040, 0xffff4040, static unsigned int chatColor[] = {0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xff8080ff, 0xffff4040, 0xffff4040,
0xffff4040, 0xff40ff40, 0xff4040ff, 0xff40ffff, 0xffff40ff, 0xffffff40, 0xffffffff, 0xff808080, 0xff404040}; 0xffff4040, 0xff40ff40, 0xff4040ff, 0xff40ffff, 0xffff40ff, 0xffffff40, 0xffffffff, 0xff808080, 0xff404040};
if(chatTiming[i]) { if(chatTiming[i]) {
chatTiming[i]--; chatTiming[i]--;
if(mainGame->dInfo.isStarted && i >= 5) if(is_building) {
continue; if(dInfo.isStarted && i >= 5)
if(!showChat && i > 2) continue;
continue; if(!showChat && i > 2)
int w = guiFont->getDimension(chatMsg[i].c_str()).Width; continue;
}
std::wstring msg(chatMsg[i]);
int x = wChat->getRelativePosition().UpperLeftCorner.X;
int y = window_size.Height - 25;
if(is_building) {
msg = SetStaticText(nullptr, 205 * xScale, guiFont, msg.c_str());
x = 810 * xScale;
}
recti rectloc(mainGame->wChat->getRelativePosition().UpperLeftCorner.X, mainGame->window_size.Height - 45, mainGame->wChat->getRelativePosition().UpperLeftCorner.X + 2 + w, mainGame->window_size.Height - 25); int w = guiFont->getDimension(msg).Width;
rectloc -= position2di(0, i * 20); int h = guiFont->getDimension(msg).Height + 2;
recti msgloc(mainGame->wChat->getRelativePosition().UpperLeftCorner.X, mainGame->window_size.Height - 45, mainGame->wChat->getRelativePosition().UpperLeftCorner.X - 4, mainGame->window_size.Height - 25);
msgloc -= position2di(0, i * 20); recti rectloc(x, y - chatRectY - h, x + 2 + w, y - chatRectY);
recti msgloc(x, y - chatRectY - h, x - 4, y - chatRectY);
recti shadowloc = msgloc + position2di(1, 1); recti shadowloc = msgloc + position2di(1, 1);
driver->draw2DRectangle(rectloc, 0xa0000000, 0xa0000000, 0xa0000000, 0xa0000000); driver->draw2DRectangle(rectloc, 0xa0000000, 0xa0000000, 0xa0000000, 0xa0000000);
guiFont->draw(chatMsg[i].c_str(), msgloc, 0xff000000, false, false); guiFont->draw(msg.c_str(), msgloc, 0xff000000, false, false);
guiFont->draw(chatMsg[i].c_str(), shadowloc, chatColor[chatType[i]], false, false); guiFont->draw(msg.c_str(), shadowloc, chatColor[chatType[i]], false, false);
chatRectY += h;
} }
} }
} }
...@@ -1235,70 +1249,75 @@ void Game::DrawDeckBd() { ...@@ -1235,70 +1249,75 @@ void Game::DrawDeckBd() {
driver->draw2DRectangleOutline(Resize(313 + i * dx, 563, 359 + i * dx, 629)); driver->draw2DRectangleOutline(Resize(313 + i * dx, 563, 359 + i * dx, 629));
} }
} }
//search result if (is_siding) {
driver->draw2DRectangle(Resize(805, 137, 926, 157), 0x400000ff, 0x400000ff, 0x40000000, 0x40000000); driver->draw2DRectangle(Resize(805, 10, 1020, 630), 0x400000ff, 0x400000ff, 0x40000000, 0x40000000);
driver->draw2DRectangleOutline(Resize(804, 136, 926, 157)); driver->draw2DRectangleOutline(Resize(804, 9, 1020, 630));
DrawShadowText(textFont, dataManager.GetSysString(1333), Resize(810, 137, 915, 157), Resize(1, 1, 1, 1), 0xffffffff, 0xff000000, false, true); } else {
DrawShadowText(numFont, deckBuilder.result_string, Resize(875, 137, 935, 157), Resize(1, 1, 1, 1), 0xffffffff, 0xff000000, false, true); //search result
driver->draw2DRectangle(Resize(805, 160, 1020, 630), 0x400000ff, 0x400000ff, 0x40000000, 0x40000000); driver->draw2DRectangle(Resize(805, 137, 926, 157), 0x400000ff, 0x400000ff, 0x40000000, 0x40000000);
driver->draw2DRectangleOutline(Resize(804, 159, 1020, 630)); driver->draw2DRectangleOutline(Resize(804, 136, 926, 157));
for(size_t i = 0; i < 9 && i + scrFilter->getPos() < deckBuilder.results.size(); ++i) { DrawShadowText(textFont, dataManager.GetSysString(1333), Resize(810, 137, 915, 157), Resize(1, 1, 1, 1), 0xffffffff, 0xff000000, false, true);
code_pointer ptr = deckBuilder.results[i + scrFilter->getPos()]; DrawShadowText(numFont, deckBuilder.result_string, Resize(875, 137, 935, 157), Resize(1, 1, 1, 1), 0xffffffff, 0xff000000, false, true);
if(i >= 7) driver->draw2DRectangle(Resize(805, 160, 1020, 630), 0x400000ff, 0x400000ff, 0x40000000, 0x40000000);
{ driver->draw2DRectangleOutline(Resize(804, 159, 1020, 630));
imageManager.GetTextureThumb(ptr->second.code); for(size_t i = 0; i < 9 && i + scrFilter->getPos() < deckBuilder.results.size(); ++i) {
break; code_pointer ptr = deckBuilder.results[i + scrFilter->getPos()];
} if(i >= 7)
if(deckBuilder.hovered_pos == 4 && deckBuilder.hovered_seq == (int)i) {
driver->draw2DRectangle(0x80000000, Resize(806, 164 + i * 66, 1019, 230 + i * 66)); imageManager.GetTextureThumb(ptr->second.code);
DrawThumb(ptr, position2di(810, 165 + i * 66), deckBuilder.filterList); break;
if(ptr->second.type & TYPE_MONSTER) {
myswprintf(textBuffer, L"%ls", dataManager.GetName(ptr->first));
DrawShadowText(textFont, textBuffer, Resize(860, 165 + i * 66, 955, 185 + i * 66), Resize(1, 1, 0, 0));
if(!(ptr->second.type & TYPE_LINK)) {
const wchar_t* form = L"\u2605";
if(ptr->second.type & TYPE_XYZ) form = L"\u2606";
myswprintf(textBuffer, L"%ls/%ls %ls%d", dataManager.FormatAttribute(ptr->second.attribute), dataManager.FormatRace(ptr->second.race), form, ptr->second.level);
DrawShadowText(textFont, textBuffer, Resize(860, 187 + i * 66, 955, 207 + i * 66), Resize(1, 1, 0, 0));
if(ptr->second.attack < 0 && ptr->second.defense < 0)
myswprintf(textBuffer, L"?/?");
else if(ptr->second.attack < 0)
myswprintf(textBuffer, L"?/%d", ptr->second.defense);
else if(ptr->second.defense < 0)
myswprintf(textBuffer, L"%d/?", ptr->second.attack);
else myswprintf(textBuffer, L"%d/%d", ptr->second.attack, ptr->second.defense);
} else {
myswprintf(textBuffer, L"%ls/%ls LINK-%d", dataManager.FormatAttribute(ptr->second.attribute), dataManager.FormatRace(ptr->second.race), ptr->second.level);
DrawShadowText(textFont, textBuffer, Resize(860, 187 + i * 66, 955, 207 + i * 66), Resize(1, 1, 0, 0));
if(ptr->second.attack < 0)
myswprintf(textBuffer, L"?/-");
else myswprintf(textBuffer, L"%d/-", ptr->second.attack);
} }
if(ptr->second.type & TYPE_PENDULUM) { if(deckBuilder.hovered_pos == 4 && deckBuilder.hovered_seq == (int)i)
wchar_t scaleBuffer[16]; driver->draw2DRectangle(0x80000000, Resize(806, 164 + i * 66, 1019, 230 + i * 66));
myswprintf(scaleBuffer, L" %d/%d", ptr->second.lscale, ptr->second.rscale); DrawThumb(ptr, position2di(810, 165 + i * 66), deckBuilder.filterList);
wcscat(textBuffer, scaleBuffer); if(ptr->second.type & TYPE_MONSTER) {
myswprintf(textBuffer, L"%ls", dataManager.GetName(ptr->first));
DrawShadowText(textFont, textBuffer, Resize(860, 165 + i * 66, 955, 185 + i * 66), Resize(1, 1, 0, 0));
if(!(ptr->second.type & TYPE_LINK)) {
const wchar_t* form = L"\u2605";
if(ptr->second.type & TYPE_XYZ) form = L"\u2606";
myswprintf(textBuffer, L"%ls/%ls %ls%d", dataManager.FormatAttribute(ptr->second.attribute), dataManager.FormatRace(ptr->second.race), form, ptr->second.level);
DrawShadowText(textFont, textBuffer, Resize(860, 187 + i * 66, 955, 207 + i * 66), Resize(1, 1, 0, 0));
if(ptr->second.attack < 0 && ptr->second.defense < 0)
myswprintf(textBuffer, L"?/?");
else if(ptr->second.attack < 0)
myswprintf(textBuffer, L"?/%d", ptr->second.defense);
else if(ptr->second.defense < 0)
myswprintf(textBuffer, L"%d/?", ptr->second.attack);
else myswprintf(textBuffer, L"%d/%d", ptr->second.attack, ptr->second.defense);
} else {
myswprintf(textBuffer, L"%ls/%ls LINK-%d", dataManager.FormatAttribute(ptr->second.attribute), dataManager.FormatRace(ptr->second.race), ptr->second.level);
DrawShadowText(textFont, textBuffer, Resize(860, 187 + i * 66, 955, 207 + i * 66), Resize(1, 1, 0, 0));
if(ptr->second.attack < 0)
myswprintf(textBuffer, L"?/-");
else myswprintf(textBuffer, L"%d/-", ptr->second.attack);
}
if(ptr->second.type & TYPE_PENDULUM) {
wchar_t scaleBuffer[16];
myswprintf(scaleBuffer, L" %d/%d", ptr->second.lscale, ptr->second.rscale);
wcscat(textBuffer, scaleBuffer);
}
if((ptr->second.ot & AVAIL_OCGTCG) == AVAIL_OCG)
wcscat(textBuffer, L" [OCG]");
else if((ptr->second.ot & AVAIL_OCGTCG) == AVAIL_TCG)
wcscat(textBuffer, L" [TCG]");
else if((ptr->second.ot & AVAIL_CUSTOM) == AVAIL_CUSTOM)
wcscat(textBuffer, L" [Custom]");
DrawShadowText(textFont, textBuffer, Resize(860, 209 + i * 66, 955, 229 + i * 66), Resize(1, 1, 0, 0));
} else {
myswprintf(textBuffer, L"%ls", dataManager.GetName(ptr->first));
DrawShadowText(textFont, textBuffer, Resize(860, 165 + i * 66, 955, 185 + i * 66), Resize(1, 1, 0, 0));
const wchar_t* ptype = dataManager.FormatType(ptr->second.type);
DrawShadowText(textFont, ptype, Resize(860, 187 + i * 66, 955, 207 + i * 66), Resize(1, 1, 0, 0));
textBuffer[0] = 0;
if((ptr->second.ot & AVAIL_OCGTCG) == AVAIL_OCG)
wcscat(textBuffer, L"[OCG]");
else if((ptr->second.ot & AVAIL_OCGTCG) == AVAIL_TCG)
wcscat(textBuffer, L"[TCG]");
else if((ptr->second.ot & AVAIL_CUSTOM) == AVAIL_CUSTOM)
wcscat(textBuffer, L"[Custom]");
DrawShadowText(textFont, textBuffer, Resize(860, 209 + i * 66, 955, 229 + i * 66), Resize(1, 1, 0, 0));
} }
if((ptr->second.ot & AVAIL_OCGTCG) == AVAIL_OCG)
wcscat(textBuffer, L" [OCG]");
else if((ptr->second.ot & AVAIL_OCGTCG) == AVAIL_TCG)
wcscat(textBuffer, L" [TCG]");
else if((ptr->second.ot & AVAIL_CUSTOM) == AVAIL_CUSTOM)
wcscat(textBuffer, L" [Custom]");
DrawShadowText(textFont, textBuffer, Resize(860, 209 + i * 66, 955, 229 + i * 66), Resize(1, 1, 0, 0));
} else {
myswprintf(textBuffer, L"%ls", dataManager.GetName(ptr->first));
DrawShadowText(textFont, textBuffer, Resize(860, 165 + i * 66, 955, 185 + i * 66), Resize(1, 1, 0, 0));
const wchar_t* ptype = dataManager.FormatType(ptr->second.type);
DrawShadowText(textFont, ptype, Resize(860, 187 + i * 66, 955, 207 + i * 66), Resize(1, 1, 0, 0));
textBuffer[0] = 0;
if((ptr->second.ot & AVAIL_OCGTCG) == AVAIL_OCG)
wcscat(textBuffer, L"[OCG]");
else if((ptr->second.ot & AVAIL_OCGTCG) == AVAIL_TCG)
wcscat(textBuffer, L"[TCG]");
else if((ptr->second.ot & AVAIL_CUSTOM) == AVAIL_CUSTOM)
wcscat(textBuffer, L"[Custom]");
DrawShadowText(textFont, textBuffer, Resize(860, 209 + i * 66, 955, 229 + i * 66), Resize(1, 1, 0, 0));
} }
} }
if(deckBuilder.is_draging) { if(deckBuilder.is_draging) {
......
...@@ -377,7 +377,7 @@ void DuelClient::HandleSTOCPacketLan(unsigned char* data, unsigned int len) { ...@@ -377,7 +377,7 @@ void DuelClient::HandleSTOCPacketLan(unsigned char* data, unsigned int len) {
mainGame->is_building = true; mainGame->is_building = true;
mainGame->is_siding = true; mainGame->is_siding = true;
mainGame->CloseGameWindow(); mainGame->CloseGameWindow();
mainGame->wChat->setVisible(false); mainGame->ResizeChatInputWindow(802);
mainGame->wDeckEdit->setVisible(false); mainGame->wDeckEdit->setVisible(false);
mainGame->wFilter->setVisible(false); mainGame->wFilter->setVisible(false);
mainGame->wSort->setVisible(false); mainGame->wSort->setVisible(false);
...@@ -493,6 +493,7 @@ void DuelClient::HandleSTOCPacketLan(unsigned char* data, unsigned int len) { ...@@ -493,6 +493,7 @@ void DuelClient::HandleSTOCPacketLan(unsigned char* data, unsigned int len) {
mainGame->HideElement(mainGame->wLanWindow); mainGame->HideElement(mainGame->wLanWindow);
mainGame->HideElement(mainGame->wSinglePlay); mainGame->HideElement(mainGame->wSinglePlay);
mainGame->ShowElement(mainGame->wHostPrepare); mainGame->ShowElement(mainGame->wHostPrepare);
mainGame->ResizeChatInputWindow();
if(!mainGame->chkIgnore1->isChecked()) if(!mainGame->chkIgnore1->isChecked())
mainGame->wChat->setVisible(true); mainGame->wChat->setVisible(true);
mainGame->gMutex.unlock(); mainGame->gMutex.unlock();
...@@ -604,6 +605,7 @@ void DuelClient::HandleSTOCPacketLan(unsigned char* data, unsigned int len) { ...@@ -604,6 +605,7 @@ void DuelClient::HandleSTOCPacketLan(unsigned char* data, unsigned int len) {
mainGame->btnM2->setVisible(false); mainGame->btnM2->setVisible(false);
mainGame->btnEP->setVisible(false); mainGame->btnEP->setVisible(false);
mainGame->btnShuffle->setVisible(false); mainGame->btnShuffle->setVisible(false);
mainGame->ResizeChatInputWindow();
if(!mainGame->chkIgnore1->isChecked()) if(!mainGame->chkIgnore1->isChecked())
mainGame->wChat->setVisible(true); mainGame->wChat->setVisible(true);
if(mainGame->chkDefaultShowChain->isChecked()) { if(mainGame->chkDefaultShowChain->isChecked()) {
......
...@@ -1904,7 +1904,7 @@ bool ClientField::OnCommonEvent(const irr::SEvent& event) { ...@@ -1904,7 +1904,7 @@ bool ClientField::OnCommonEvent(const irr::SEvent& event) {
break; break;
} }
case CHECKBOX_DISABLE_CHAT: { case CHECKBOX_DISABLE_CHAT: {
bool show = mainGame->is_building ? false : !mainGame->chkIgnore1->isChecked(); bool show = (mainGame->is_building && !mainGame->is_siding) ? false : !mainGame->chkIgnore1->isChecked();
mainGame->wChat->setVisible(show); mainGame->wChat->setVisible(show);
if(!show) if(!show)
mainGame->ClearChatMsg(); mainGame->ClearChatMsg();
......
...@@ -699,7 +699,7 @@ bool Game::Initialize() { ...@@ -699,7 +699,7 @@ bool Game::Initialize() {
btnShuffleDeck = env->addButton(rect<s32>(5, 99, 55, 120), wDeckEdit, BUTTON_SHUFFLE_DECK, dataManager.GetSysString(1307)); btnShuffleDeck = env->addButton(rect<s32>(5, 99, 55, 120), wDeckEdit, BUTTON_SHUFFLE_DECK, dataManager.GetSysString(1307));
btnSortDeck = env->addButton(rect<s32>(60, 99, 110, 120), wDeckEdit, BUTTON_SORT_DECK, dataManager.GetSysString(1305)); btnSortDeck = env->addButton(rect<s32>(60, 99, 110, 120), wDeckEdit, BUTTON_SORT_DECK, dataManager.GetSysString(1305));
btnClearDeck = env->addButton(rect<s32>(115, 99, 165, 120), wDeckEdit, BUTTON_CLEAR_DECK, dataManager.GetSysString(1304)); btnClearDeck = env->addButton(rect<s32>(115, 99, 165, 120), wDeckEdit, BUTTON_CLEAR_DECK, dataManager.GetSysString(1304));
btnSideOK = env->addButton(rect<s32>(510, 40, 820, 80), 0, BUTTON_SIDE_OK, dataManager.GetSysString(1334)); btnSideOK = env->addButton(rect<s32>(400, 40, 710, 80), 0, BUTTON_SIDE_OK, dataManager.GetSysString(1334));
btnSideOK->setVisible(false); btnSideOK->setVisible(false);
btnSideShuffle = env->addButton(rect<s32>(310, 100, 370, 130), 0, BUTTON_SHUFFLE_DECK, dataManager.GetSysString(1307)); btnSideShuffle = env->addButton(rect<s32>(310, 100, 370, 130), 0, BUTTON_SHUFFLE_DECK, dataManager.GetSysString(1307));
btnSideShuffle->setVisible(false); btnSideShuffle->setVisible(false);
...@@ -1131,7 +1131,7 @@ std::wstring Game::SetStaticText(irr::gui::IGUIStaticText* pControl, u32 cWidth, ...@@ -1131,7 +1131,7 @@ std::wstring Game::SetStaticText(irr::gui::IGUIStaticText* pControl, u32 cWidth,
strBuffer[pbuffer++] = c; strBuffer[pbuffer++] = c;
} }
strBuffer[pbuffer] = 0; strBuffer[pbuffer] = 0;
pControl->setText(strBuffer); if(pControl) pControl->setText(strBuffer);
ret.assign(strBuffer); ret.assign(strBuffer);
return ret; return ret;
} }
...@@ -1914,7 +1914,7 @@ void Game::OnResize() { ...@@ -1914,7 +1914,7 @@ void Game::OnResize() {
stStar->setRelativePosition(Resize(10, 62 + 100 / 6, 70, 82 + 100 / 6)); stStar->setRelativePosition(Resize(10, 62 + 100 / 6, 70, 82 + 100 / 6));
stSearch->setRelativePosition(Resize(205, 62 + 100 / 6, 280, 82 + 100 / 6)); stSearch->setRelativePosition(Resize(205, 62 + 100 / 6, 280, 82 + 100 / 6));
stScale->setRelativePosition(Resize(105, 62 + 100 / 6, 165, 82 + 100 / 6)); stScale->setRelativePosition(Resize(105, 62 + 100 / 6, 165, 82 + 100 / 6));
btnSideOK->setRelativePosition(Resize(510, 40, 820, 80)); btnSideOK->setRelativePosition(Resize(400, 40, 710, 80));
btnSideShuffle->setRelativePosition(Resize(310, 100, 370, 130)); btnSideShuffle->setRelativePosition(Resize(310, 100, 370, 130));
btnSideSort->setRelativePosition(Resize(375, 100, 435, 130)); btnSideSort->setRelativePosition(Resize(375, 100, 435, 130));
btnSideReload->setRelativePosition(Resize(440, 100, 500, 130)); btnSideReload->setRelativePosition(Resize(440, 100, 500, 130));
...@@ -2005,8 +2005,7 @@ void Game::OnResize() { ...@@ -2005,8 +2005,7 @@ void Game::OnResize() {
btnM2->setRelativePosition(Resize(160, 0, 210, 20)); btnM2->setRelativePosition(Resize(160, 0, 210, 20));
btnEP->setRelativePosition(Resize(320, 0, 370, 20)); btnEP->setRelativePosition(Resize(320, 0, 370, 20));
wChat->setRelativePosition(recti(wInfos->getRelativePosition().LowerRightCorner.X + 6, window_size.Height - 25, window_size.Width, window_size.Height)); ResizeChatInputWindow();
ebChatInput->setRelativePosition(recti(3, 2, window_size.Width - wChat->getRelativePosition().UpperLeftCorner.X - 6, 22));
btnLeaveGame->setRelativePosition(Resize(205, 5, 295, 80)); btnLeaveGame->setRelativePosition(Resize(205, 5, 295, 80));
wReplayControl->setRelativePosition(Resize(205, 143, 295, 273)); wReplayControl->setRelativePosition(Resize(205, 143, 295, 273));
...@@ -2029,6 +2028,14 @@ void Game::OnResize() { ...@@ -2029,6 +2028,14 @@ void Game::OnResize() {
btnBigCardZoomOut->setRelativePosition(Resize(205, 180, 295, 215)); btnBigCardZoomOut->setRelativePosition(Resize(205, 180, 295, 215));
btnBigCardClose->setRelativePosition(Resize(205, 230, 295, 265)); btnBigCardClose->setRelativePosition(Resize(205, 230, 295, 265));
} }
void Game::ResizeChatInputWindow(s32 x) {
if (x == -1)
x = wInfos->getRelativePosition().LowerRightCorner.X + 6;
else
x = x * xScale;
wChat->setRelativePosition(recti(x, window_size.Height - 25, window_size.Width, window_size.Height));
ebChatInput->setRelativePosition(recti(3, 2, window_size.Width - wChat->getRelativePosition().UpperLeftCorner.X - 6, 22));
}
recti Game::Resize(s32 x, s32 y, s32 x2, s32 y2) { recti Game::Resize(s32 x, s32 y, s32 x2, s32 y2) {
x = x * xScale; x = x * xScale;
y = y * yScale; y = y * yScale;
......
...@@ -185,6 +185,7 @@ public: ...@@ -185,6 +185,7 @@ public:
} }
void OnResize(); void OnResize();
void ResizeChatInputWindow(s32 x = -1);
recti Resize(s32 x, s32 y, s32 x2, s32 y2); recti Resize(s32 x, s32 y, s32 x2, s32 y2);
recti Resize(s32 x, s32 y, s32 x2, s32 y2, s32 dx, s32 dy, s32 dx2, s32 dy2); recti Resize(s32 x, s32 y, s32 x2, s32 y2, s32 dx, s32 dy, s32 dx2, s32 dy2);
position2di Resize(s32 x, s32 y); position2di Resize(s32 x, s32 y);
......
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