Commit a7cdd846 authored by mercury233's avatar mercury233

Merge branch 'fh' into sound

parents 1a960e99 a2aac58a
...@@ -72,11 +72,15 @@ void DeckBuilder::Initialize() { ...@@ -72,11 +72,15 @@ void DeckBuilder::Initialize() {
filterList = deckManager._lfList[0].content; filterList = deckManager._lfList[0].content;
mainGame->cbDBLFList->setSelected(0); mainGame->cbDBLFList->setSelected(0);
ClearSearch(); ClearSearch();
mouse_pos.set(0, 0);
hovered_code = 0;
hovered_pos = 0;
hovered_seq = -1;
is_draging = false; is_draging = false;
prev_deck = mainGame->cbDBDecks->getSelected(); prev_deck = mainGame->cbDBDecks->getSelected();
prev_operation = 0; prev_operation = 0;
is_modified = false; is_modified = false;
mainGame->device->setEventReceiver(&mainGame->deckBuilder); mainGame->device->setEventReceiver(this);
} }
void DeckBuilder::Terminate() { void DeckBuilder::Terminate() {
mainGame->is_building = false; mainGame->is_building = false;
...@@ -915,6 +919,9 @@ bool DeckBuilder::CardNameContains(const wchar_t *haystack, const wchar_t *needl ...@@ -915,6 +919,9 @@ bool DeckBuilder::CardNameContains(const wchar_t *haystack, const wchar_t *needl
if (!needle[0]) { if (!needle[0]) {
return true; return true;
} }
if (!haystack) {
return false;
}
int i = 0; int i = 0;
int j = 0; int j = 0;
while (haystack[i]) { while (haystack[i]) {
......
...@@ -935,6 +935,11 @@ void Game::DrawSpec() { ...@@ -935,6 +935,11 @@ void Game::DrawSpec() {
} }
} }
} }
void Game::DrawBackImage(irr::video::ITexture* texture) {
if(!texture)
return;
driver->draw2DImage(texture, recti(0, 0, 1024, 640), recti(0, 0, texture->getOriginalSize().Width, texture->getOriginalSize().Height));
}
void Game::ShowElement(irr::gui::IGUIElement * win, int autoframe) { void Game::ShowElement(irr::gui::IGUIElement * win, int autoframe) {
FadingUnit fu; FadingUnit fu;
fu.fadingSize = win->getRelativePosition(); fu.fadingSize = win->getRelativePosition();
......
...@@ -2426,6 +2426,11 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -2426,6 +2426,11 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
return true; return true;
} }
case MSG_CHAIN_END: { case MSG_CHAIN_END: {
for(auto chit = mainGame->dField.chains.begin(); chit != mainGame->dField.chains.end(); ++chit) {
for(auto tgit = chit->target.begin(); tgit != chit->target.end(); ++tgit)
(*tgit)->is_showchaintarget = false;
chit->chain_card->is_showchaintarget = false;
}
mainGame->dField.chains.clear(); mainGame->dField.chains.clear();
return true; return true;
} }
......
...@@ -662,8 +662,6 @@ void Game::MainLoop() { ...@@ -662,8 +662,6 @@ void Game::MainLoop() {
atkframe += 0.1f; atkframe += 0.1f;
atkdy = (float)sin(atkframe); atkdy = (float)sin(atkframe);
driver->beginScene(true, true, SColor(0, 0, 0, 0)); driver->beginScene(true, true, SColor(0, 0, 0, 0));
if(imageManager.tBackGround)
driver->draw2DImage(imageManager.tBackGround, recti(0, 0, 1024, 640), recti(0, 0, imageManager.tBackGround->getOriginalSize().Width, imageManager.tBackGround->getOriginalSize().Height));
gMutex.Lock(); gMutex.Lock();
if(dInfo.isStarted) { if(dInfo.isStarted) {
if(mainGame->showcardcode == 1 || mainGame->showcardcode == 3) if(mainGame->showcardcode == 1 || mainGame->showcardcode == 3)
...@@ -676,6 +674,7 @@ void Game::MainLoop() { ...@@ -676,6 +674,7 @@ void Game::MainLoop() {
PlayMusic("./sound/song-advantage.mp3", true); PlayMusic("./sound/song-advantage.mp3", true);
else else
PlayBGM(); PlayBGM();
DrawBackImage(imageManager.tBackGround);
DrawBackGround(); DrawBackGround();
DrawCards(); DrawCards();
DrawMisc(); DrawMisc();
...@@ -683,14 +682,12 @@ void Game::MainLoop() { ...@@ -683,14 +682,12 @@ void Game::MainLoop() {
driver->setMaterial(irr::video::IdentityMaterial); driver->setMaterial(irr::video::IdentityMaterial);
driver->clearZBuffer(); driver->clearZBuffer();
} else if(is_building) { } else if(is_building) {
if(imageManager.tBackGround_deck)
driver->draw2DImage(imageManager.tBackGround_deck, recti(0, 0, 1024, 640), recti(0, 0, imageManager.tBackGround->getOriginalSize().Width, imageManager.tBackGround->getOriginalSize().Height));
DrawDeckBd();
PlayMusic("./sound/deck.mp3", true); PlayMusic("./sound/deck.mp3", true);
DrawBackImage(imageManager.tBackGround_deck);
DrawDeckBd();
} else { } else {
if(imageManager.tBackGround_menu)
driver->draw2DImage(imageManager.tBackGround_menu, recti(0, 0, 1024, 640), recti(0, 0, imageManager.tBackGround->getOriginalSize().Width, imageManager.tBackGround->getOriginalSize().Height));
PlayMusic("./sound/menu.mp3", true); PlayMusic("./sound/menu.mp3", true);
DrawBackImage(imageManager.tBackGround_menu);
} }
DrawGUI(); DrawGUI();
DrawSpec(); DrawSpec();
......
...@@ -106,6 +106,7 @@ public: ...@@ -106,6 +106,7 @@ public:
void DrawStatus(ClientCard* pcard, int x1, int y1, int x2, int y2); void DrawStatus(ClientCard* pcard, int x1, int y1, int x2, int y2);
void DrawGUI(); void DrawGUI();
void DrawSpec(); void DrawSpec();
void DrawBackImage(irr::video::ITexture* texture);
void ShowElement(irr::gui::IGUIElement* element, int autoframe = 0); void ShowElement(irr::gui::IGUIElement* element, int autoframe = 0);
void HideElement(irr::gui::IGUIElement* element, bool set_action = false); void HideElement(irr::gui::IGUIElement* element, bool set_action = false);
void PopupElement(irr::gui::IGUIElement* element, int hideframe = 0); void PopupElement(irr::gui::IGUIElement* element, int hideframe = 0);
......
...@@ -28,7 +28,11 @@ bool ImageManager::Initial() { ...@@ -28,7 +28,11 @@ bool ImageManager::Initial() {
tHand[2] = driver->getTexture("textures/f3.jpg"); tHand[2] = driver->getTexture("textures/f3.jpg");
tBackGround = driver->getTexture("textures/bg.jpg"); tBackGround = driver->getTexture("textures/bg.jpg");
tBackGround_menu = driver->getTexture("textures/bg_menu.jpg"); tBackGround_menu = driver->getTexture("textures/bg_menu.jpg");
if(!tBackGround_menu)
tBackGround_menu = tBackGround;
tBackGround_deck = driver->getTexture("textures/bg_deck.jpg"); tBackGround_deck = driver->getTexture("textures/bg_deck.jpg");
if(!tBackGround_deck)
tBackGround_deck = tBackGround;
tField[0] = driver->getTexture("textures/field2.png"); tField[0] = driver->getTexture("textures/field2.png");
tFieldTransparent[0] = driver->getTexture("textures/field-transparent2.png"); tFieldTransparent[0] = driver->getTexture("textures/field-transparent2.png");
tField[1] = driver->getTexture("textures/field3.png"); tField[1] = driver->getTexture("textures/field3.png");
......
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