Commit f5e317b3 authored by mercury233's avatar mercury233

Merge branch 'fh' into resize

parents 9dba33af 5e48a10a
...@@ -62,6 +62,7 @@ static bool check_set_code(const CardDataC& data, int set_code) { ...@@ -62,6 +62,7 @@ static bool check_set_code(const CardDataC& data, int set_code) {
void DeckBuilder::Initialize() { void DeckBuilder::Initialize() {
mainGame->is_building = true; mainGame->is_building = true;
mainGame->is_siding = false; mainGame->is_siding = false;
mainGame->ShowCardNoInfo();
mainGame->wInfos->setVisible(true); mainGame->wInfos->setVisible(true);
mainGame->wCardImg->setVisible(true); mainGame->wCardImg->setVisible(true);
mainGame->wDeckEdit->setVisible(true); mainGame->wDeckEdit->setVisible(true);
...@@ -91,6 +92,7 @@ void DeckBuilder::Initialize() { ...@@ -91,6 +92,7 @@ void DeckBuilder::Initialize() {
} }
void DeckBuilder::Terminate() { void DeckBuilder::Terminate() {
mainGame->is_building = false; mainGame->is_building = false;
mainGame->ShowCardNoInfo();
mainGame->wDeckEdit->setVisible(false); mainGame->wDeckEdit->setVisible(false);
mainGame->wCategories->setVisible(false); mainGame->wCategories->setVisible(false);
mainGame->wFilter->setVisible(false); mainGame->wFilter->setVisible(false);
...@@ -235,8 +237,7 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) { ...@@ -235,8 +237,7 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
mainGame->env->addMessageBox(L"", dataManager.GetSysString(1410)); mainGame->env->addMessageBox(L"", dataManager.GetSysString(1410));
break; break;
} }
mainGame->imgCard->setImage(imageManager.tCover[0]); mainGame->ShowCardNoInfo();
mainGame->showingcode = 0;
char deckbuf[1024]; char deckbuf[1024];
char* pdeck = deckbuf; char* pdeck = deckbuf;
BufferIO::WriteInt32(pdeck, deckManager.current_deck.main.size() + deckManager.current_deck.extra.size()); BufferIO::WriteInt32(pdeck, deckManager.current_deck.main.size() + deckManager.current_deck.extra.size());
......
...@@ -979,14 +979,7 @@ bool ClientField::OnEvent(const irr::SEvent& event) { ...@@ -979,14 +979,7 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
if(mcard->code) { if(mcard->code) {
mainGame->ShowCardInfo(mcard->code); mainGame->ShowCardInfo(mcard->code);
} else { } else {
mainGame->imgCard->setImage(imageManager.tCover[mcard->controler]); mainGame->ShowCardNoInfo(mcard->controler);
mainGame->showingcode = 0;
mainGame->stName->setText(L"");
mainGame->stInfo->setText(L"");
mainGame->stDataInfo->setText(L"");
mainGame->stSetName->setText(L"");
mainGame->stText->setText(L"");
mainGame->scrCardText->setVisible(false);
} }
} }
if(id >= BUTTON_DISPLAY_0 && id <= BUTTON_DISPLAY_4) { if(id >= BUTTON_DISPLAY_0 && id <= BUTTON_DISPLAY_4) {
...@@ -995,14 +988,7 @@ bool ClientField::OnEvent(const irr::SEvent& event) { ...@@ -995,14 +988,7 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
if(mcard->code) { if(mcard->code) {
mainGame->ShowCardInfo(mcard->code); mainGame->ShowCardInfo(mcard->code);
} else { } else {
mainGame->imgCard->setImage(imageManager.tCover[mcard->controler]); mainGame->ShowCardNoInfo(mcard->controler);
mainGame->showingcode = 0;
mainGame->stName->setText(L"");
mainGame->stInfo->setText(L"");
mainGame->stDataInfo->setText(L"");
mainGame->stSetName->setText(L"");
mainGame->stText->setText(L"");
mainGame->scrCardText->setVisible(false);
} }
} }
break; break;
...@@ -1578,14 +1564,7 @@ bool ClientField::OnEvent(const irr::SEvent& event) { ...@@ -1578,14 +1564,7 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
} }
} else { } else {
should_show_tip = false; should_show_tip = false;
mainGame->imgCard->setImage(imageManager.tCover[mcard->controler]); mainGame->ShowCardNoInfo(mcard->controler);
mainGame->showingcode = 0;
mainGame->stName->setText(L"");
mainGame->stInfo->setText(L"");
mainGame->stDataInfo->setText(L"");
mainGame->stSetName->setText(L"");
mainGame->stText->setText(L"");
mainGame->scrCardText->setVisible(false);
} }
} }
hovered_card = mcard; hovered_card = mcard;
...@@ -1832,6 +1811,8 @@ bool ClientField::OnCommonEvent(const irr::SEvent& event) { ...@@ -1832,6 +1811,8 @@ bool ClientField::OnCommonEvent(const irr::SEvent& event) {
} }
case CHECKBOX_QUICK_ANIMATION: { case CHECKBOX_QUICK_ANIMATION: {
mainGame->gameConf.quick_animation = mainGame->chkQuickAnimation->isChecked() ? 1 : 0; mainGame->gameConf.quick_animation = mainGame->chkQuickAnimation->isChecked() ? 1 : 0;
return true;
break;
} }
} }
break; break;
......
...@@ -1331,6 +1331,15 @@ void Game::ShowCardInfo(int code, bool resize) { ...@@ -1331,6 +1331,15 @@ void Game::ShowCardInfo(int code, bool resize) {
const auto& tsize = stText->getRelativePosition(); const auto& tsize = stText->getRelativePosition();
InitStaticText(stText, tsize.getWidth(), tsize.getHeight(), guiFont, showingtext); InitStaticText(stText, tsize.getWidth(), tsize.getHeight(), guiFont, showingtext);
} }
void Game::ShowCardNoInfo(int player) {
imgCard->setImage(imageManager.tCover[player]);
stName->setText(L"");
stInfo->setText(L"");
stDataInfo->setText(L"");
stSetName->setText(L"");
stText->setText(L"");
scrCardText->setVisible(false);
}
void Game::AddChatMsg(wchar_t* msg, int player) { void Game::AddChatMsg(wchar_t* msg, int player) {
for(int i = 7; i > 0; --i) { for(int i = 7; i > 0; --i) {
chatMsg[i] = chatMsg[i - 1]; chatMsg[i] = chatMsg[i - 1];
......
...@@ -136,6 +136,7 @@ public: ...@@ -136,6 +136,7 @@ public:
void LoadConfig(); void LoadConfig();
void SaveConfig(); void SaveConfig();
void ShowCardInfo(int code, bool resize = false); void ShowCardInfo(int code, bool resize = false);
void ShowCardNoInfo(int player = 0);
void AddChatMsg(wchar_t* msg, int player); void AddChatMsg(wchar_t* msg, int player);
void ClearChatMsg(); void ClearChatMsg();
void AddDebugMsg(char* msgbuf); void AddDebugMsg(char* msgbuf);
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
#include "game.h" #include "game.h"
#include "data_manager.h" #include "data_manager.h"
#include <event2/thread.h> #include <event2/thread.h>
#include <memory>
#ifdef __APPLE__ #ifdef __APPLE__
#import <CoreFoundation/CoreFoundation.h> #import <CoreFoundation/CoreFoundation.h>
#endif #endif
...@@ -62,10 +63,12 @@ int main(int argc, char* argv[]) { ...@@ -62,10 +63,12 @@ int main(int argc, char* argv[]) {
#ifdef _WIN32 #ifdef _WIN32
int wargc; int wargc;
wchar_t** wargv = CommandLineToArgvW(GetCommandLineW(), &wargc); std::unique_ptr<wchar_t*[], void(*)(wchar_t**)> wargv(CommandLineToArgvW(GetCommandLineW(), &wargc), [](wchar_t** wargv) {
LocalFree(wargv);
});
#else #else
int wargc = argc; int wargc = argc;
wchar_t (*wargv)[256] = new wchar_t[wargc][256]; auto wargv = std::make_unique<wchar_t[][256]>(wargc);
for(int i = 0; i < argc; ++i) { for(int i = 0; i < argc; ++i) {
BufferIO::DecodeUTF8(argv[i], wargv[i]); BufferIO::DecodeUTF8(argv[i], wargv[i]);
} }
...@@ -175,11 +178,6 @@ int main(int argc, char* argv[]) { ...@@ -175,11 +178,6 @@ int main(int argc, char* argv[]) {
} }
} }
} }
#ifdef _WIN32
LocalFree(wargv);
#else
delete[] wargv;
#endif
ygo::mainGame->MainLoop(); ygo::mainGame->MainLoop();
#ifdef _WIN32 #ifdef _WIN32
WSACleanup(); WSACleanup();
......
...@@ -222,17 +222,10 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) { ...@@ -222,17 +222,10 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
if(!ReplayMode::cur_replay.OpenReplay(mainGame->lstReplayList->getListItem(mainGame->lstReplayList->getSelected()))) if(!ReplayMode::cur_replay.OpenReplay(mainGame->lstReplayList->getListItem(mainGame->lstReplayList->getSelected())))
break; break;
} }
mainGame->imgCard->setImage(imageManager.tCover[0]); mainGame->ShowCardNoInfo();
mainGame->showingcode = 0;
mainGame->wCardImg->setVisible(true); mainGame->wCardImg->setVisible(true);
mainGame->wInfos->setVisible(true); mainGame->wInfos->setVisible(true);
mainGame->wReplay->setVisible(true); mainGame->wReplay->setVisible(true);
mainGame->stName->setText(L"");
mainGame->stInfo->setText(L"");
mainGame->stDataInfo->setText(L"");
mainGame->stSetName->setText(L"");
mainGame->stText->setText(L"");
mainGame->scrCardText->setVisible(false);
mainGame->wReplayControl->setVisible(true); mainGame->wReplayControl->setVisible(true);
mainGame->btnReplayStart->setVisible(false); mainGame->btnReplayStart->setVisible(false);
mainGame->btnReplayPause->setVisible(true); mainGame->btnReplayPause->setVisible(true);
......
...@@ -83,16 +83,11 @@ int SingleMode::SinglePlayThread(void* param) { ...@@ -83,16 +83,11 @@ int SingleMode::SinglePlayThread(void* param) {
rh.seed = seed; rh.seed = seed;
mainGame->gMutex.Lock(); mainGame->gMutex.Lock();
mainGame->HideElement(mainGame->wSinglePlay); mainGame->HideElement(mainGame->wSinglePlay);
mainGame->ShowCardNoInfo();
mainGame->wCardImg->setVisible(true); mainGame->wCardImg->setVisible(true);
mainGame->wInfos->setVisible(true); mainGame->wInfos->setVisible(true);
mainGame->btnLeaveGame->setVisible(true); mainGame->btnLeaveGame->setVisible(true);
mainGame->btnLeaveGame->setText(dataManager.GetSysString(1210)); mainGame->btnLeaveGame->setText(dataManager.GetSysString(1210));
mainGame->stName->setText(L"");
mainGame->stInfo->setText(L"");
mainGame->stDataInfo->setText(L"");
mainGame->stSetName->setText(L"");
mainGame->stText->setText(L"");
mainGame->scrCardText->setVisible(false);
mainGame->wPhase->setVisible(true); mainGame->wPhase->setVisible(true);
mainGame->dField.Clear(); mainGame->dField.Clear();
mainGame->dInfo.isFirst = true; mainGame->dInfo.isFirst = true;
......
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