Commit de617a80 authored by salix5's avatar salix5

Merge branch 'sidschingis-shuffle'

parents 809191fe 7ceabb92
...@@ -1043,6 +1043,12 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -1043,6 +1043,12 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
mainGame->btnEP->setEnabled(true); mainGame->btnEP->setEnabled(true);
mainGame->btnEP->setPressed(false); mainGame->btnEP->setPressed(false);
} }
if (BufferIO::ReadInt8(pbuf)) {
mainGame->canShuffle = true;
}
else {
mainGame->canShuffle = false;
}
return false; return false;
} }
case MSG_SELECT_EFFECTYN: { case MSG_SELECT_EFFECTYN: {
......
...@@ -250,6 +250,12 @@ bool ClientField::OnEvent(const irr::SEvent& event) { ...@@ -250,6 +250,12 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
mainGame->HideElement(mainGame->wANCard, true); mainGame->HideElement(mainGame->wANCard, true);
break; break;
} }
case BUTTON_CMD_SHUFFLE: {
mainGame->wCmdMenu->setVisible(false);
DuelClient::SetResponseI(8);
DuelClient::SendResponse();
break;
}
case BUTTON_CMD_ACTIVATE: { case BUTTON_CMD_ACTIVATE: {
mainGame->wCmdMenu->setVisible(false); mainGame->wCmdMenu->setVisible(false);
if(!list_command) { if(!list_command) {
...@@ -983,7 +989,18 @@ bool ClientField::OnEvent(const irr::SEvent& event) { ...@@ -983,7 +989,18 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
ShowMenu(command_flag, x, y); ShowMenu(command_flag, x, y);
break; break;
} }
case LOCATION_HAND: case LOCATION_HAND: {
if (!clicked_card)
break;
int command_flag = clicked_card->cmdFlag;
if (clicked_card->overlayed.size())
command_flag |= COMMAND_LIST;
list_command = 0;
if (mainGame->canShuffle && mainGame->dInfo.curMsg == MSG_SELECT_IDLECMD)
command_flag |= COMMAND_SHUFFLE;
ShowMenu(command_flag, x, y);
break;
}
case LOCATION_MZONE: case LOCATION_MZONE:
case LOCATION_SZONE: { case LOCATION_SZONE: {
if(!clicked_card) if(!clicked_card)
...@@ -1725,6 +1742,11 @@ void ClientField::ShowMenu(int flag, int x, int y) { ...@@ -1725,6 +1742,11 @@ void ClientField::ShowMenu(int flag, int x, int y) {
mainGame->btnShowList->setRelativePosition(position2di(1, height)); mainGame->btnShowList->setRelativePosition(position2di(1, height));
height += 21; height += 21;
} else mainGame->btnShowList->setVisible(false); } else mainGame->btnShowList->setVisible(false);
if(flag & COMMAND_SHUFFLE) {
mainGame->btnShuffle->setVisible(true);
mainGame->btnShuffle->setRelativePosition(position2di(1, height));
height += 21;
} else mainGame->btnShuffle->setVisible(false);
panel = mainGame->wCmdMenu; panel = mainGame->wCmdMenu;
mainGame->wCmdMenu->setVisible(true); mainGame->wCmdMenu->setVisible(true);
mainGame->wCmdMenu->setRelativePosition(irr::core::recti(x - 20 , y - 20 - height, x + 80, y - 20)); mainGame->wCmdMenu->setRelativePosition(irr::core::recti(x - 20 , y - 20 - height, x + 80, y - 20));
......
...@@ -355,6 +355,7 @@ bool Game::Initialize() { ...@@ -355,6 +355,7 @@ bool Game::Initialize() {
btnRepos = env->addButton(rect<s32>(1, 106, 99, 126), wCmdMenu, BUTTON_CMD_REPOS, dataManager.GetSysString(1154)); btnRepos = env->addButton(rect<s32>(1, 106, 99, 126), wCmdMenu, BUTTON_CMD_REPOS, dataManager.GetSysString(1154));
btnAttack = env->addButton(rect<s32>(1, 127, 99, 147), wCmdMenu, BUTTON_CMD_ATTACK, dataManager.GetSysString(1157)); btnAttack = env->addButton(rect<s32>(1, 127, 99, 147), wCmdMenu, BUTTON_CMD_ATTACK, dataManager.GetSysString(1157));
btnShowList = env->addButton(rect<s32>(1, 148, 99, 168), wCmdMenu, BUTTON_CMD_SHOWLIST, dataManager.GetSysString(1158)); btnShowList = env->addButton(rect<s32>(1, 148, 99, 168), wCmdMenu, BUTTON_CMD_SHOWLIST, dataManager.GetSysString(1158));
btnShuffle = env->addButton(rect<s32>(1, 169, 99, 189), wCmdMenu, BUTTON_CMD_SHUFFLE, dataManager.GetSysString(1307));
//deck edit //deck edit
wDeckEdit = env->addStaticText(L"", rect<s32>(309, 8, 605, 130), true, false, 0, -1, true); wDeckEdit = env->addStaticText(L"", rect<s32>(309, 8, 605, 130), true, false, 0, -1, true);
wDeckEdit->setVisible(false); wDeckEdit->setVisible(false);
......
...@@ -112,6 +112,7 @@ public: ...@@ -112,6 +112,7 @@ public:
std::vector<int> logParam; std::vector<int> logParam;
std::wstring chatMsg[8]; std::wstring chatMsg[8];
bool canShuffle;
int hideChatTimer; int hideChatTimer;
bool hideChat; bool hideChat;
int chatTiming[8]; int chatTiming[8];
...@@ -298,6 +299,7 @@ public: ...@@ -298,6 +299,7 @@ public:
irr::gui::IGUIButton* btnRepos; irr::gui::IGUIButton* btnRepos;
irr::gui::IGUIButton* btnAttack; irr::gui::IGUIButton* btnAttack;
irr::gui::IGUIButton* btnShowList; irr::gui::IGUIButton* btnShowList;
irr::gui::IGUIButton* btnShuffle;
//chat window //chat window
irr::gui::IGUIWindow* wChat; irr::gui::IGUIWindow* wChat;
irr::gui::IGUIListBox* lstChatLog; irr::gui::IGUIListBox* lstChatLog;
...@@ -373,6 +375,7 @@ extern Game* mainGame; ...@@ -373,6 +375,7 @@ extern Game* mainGame;
#define COMMAND_REPOS 0x0020 #define COMMAND_REPOS 0x0020
#define COMMAND_ATTACK 0x0040 #define COMMAND_ATTACK 0x0040
#define COMMAND_LIST 0x0080 #define COMMAND_LIST 0x0080
#define COMMAND_SHUFFLE 0x0100
#define BUTTON_LAN_MODE 100 #define BUTTON_LAN_MODE 100
#define BUTTON_SINGLE_MODE 101 #define BUTTON_SINGLE_MODE 101
...@@ -427,6 +430,7 @@ extern Game* mainGame; ...@@ -427,6 +430,7 @@ extern Game* mainGame;
#define BUTTON_CMD_REPOS 245 #define BUTTON_CMD_REPOS 245
#define BUTTON_CMD_ATTACK 246 #define BUTTON_CMD_ATTACK 246
#define BUTTON_CMD_SHOWLIST 247 #define BUTTON_CMD_SHOWLIST 247
#define BUTTON_CMD_SHUFFLE 248
#define BUTTON_ANNUMBER_OK 250 #define BUTTON_ANNUMBER_OK 250
#define BUTTON_ANCARD_OK 251 #define BUTTON_ANCARD_OK 251
#define EDITBOX_ANCARD 252 #define EDITBOX_ANCARD 252
......
...@@ -250,7 +250,7 @@ bool ReplayMode::ReplayAnalyze(char* msg, unsigned int len) { ...@@ -250,7 +250,7 @@ bool ReplayMode::ReplayAnalyze(char* msg, unsigned int len) {
count = BufferIO::ReadInt8(pbuf); count = BufferIO::ReadInt8(pbuf);
pbuf += count * 7; pbuf += count * 7;
count = BufferIO::ReadInt8(pbuf); count = BufferIO::ReadInt8(pbuf);
pbuf += count * 11 + 2; pbuf += count * 11 + 3;
ReplayRefresh(); ReplayRefresh();
return ReadReplayResponse(); return ReadReplayResponse();
} }
......
...@@ -637,7 +637,7 @@ int SingleDuel::Analyze(char* msgbuffer, unsigned int len) { ...@@ -637,7 +637,7 @@ int SingleDuel::Analyze(char* msgbuffer, unsigned int len) {
count = BufferIO::ReadInt8(pbuf); count = BufferIO::ReadInt8(pbuf);
pbuf += count * 7; pbuf += count * 7;
count = BufferIO::ReadInt8(pbuf); count = BufferIO::ReadInt8(pbuf);
pbuf += count * 11 + 2; pbuf += count * 11 + 3;
RefreshMzone(0); RefreshMzone(0);
RefreshMzone(1); RefreshMzone(1);
RefreshSzone(0); RefreshSzone(0);
......
...@@ -161,7 +161,7 @@ bool SingleMode::SinglePlayAnalyze(char* msg, unsigned int len) { ...@@ -161,7 +161,7 @@ bool SingleMode::SinglePlayAnalyze(char* msg, unsigned int len) {
count = BufferIO::ReadInt8(pbuf); count = BufferIO::ReadInt8(pbuf);
pbuf += count * 7; pbuf += count * 7;
count = BufferIO::ReadInt8(pbuf); count = BufferIO::ReadInt8(pbuf);
pbuf += count * 11 + 2; pbuf += count * 11 + 3;
SinglePlayRefresh(); SinglePlayRefresh();
if(!DuelClient::ClientAnalyze(offset, pbuf - offset)) { if(!DuelClient::ClientAnalyze(offset, pbuf - offset)) {
mainGame->singleSignal.Reset(); mainGame->singleSignal.Reset();
......
...@@ -570,7 +570,7 @@ int TagDuel::Analyze(char* msgbuffer, unsigned int len) { ...@@ -570,7 +570,7 @@ int TagDuel::Analyze(char* msgbuffer, unsigned int len) {
count = BufferIO::ReadInt8(pbuf); count = BufferIO::ReadInt8(pbuf);
pbuf += count * 7; pbuf += count * 7;
count = BufferIO::ReadInt8(pbuf); count = BufferIO::ReadInt8(pbuf);
pbuf += count * 11 + 2; pbuf += count * 11 + 3;
RefreshMzone(0); RefreshMzone(0);
RefreshMzone(1); RefreshMzone(1);
RefreshSzone(0); RefreshSzone(0);
......
...@@ -27,6 +27,7 @@ field::field(duel* pduel) { ...@@ -27,6 +27,7 @@ field::field(duel* pduel) {
this->pduel = pduel; this->pduel = pduel;
infos.field_id = 1; infos.field_id = 1;
infos.copy_id = 1; infos.copy_id = 1;
infos.shuffle_count = 0;
infos.turn_id = 0; infos.turn_id = 0;
infos.card_id = 1; infos.card_id = 1;
infos.phase = 0; infos.phase = 0;
......
...@@ -114,6 +114,7 @@ struct field_info { ...@@ -114,6 +114,7 @@ struct field_info {
uint8 phase; uint8 phase;
uint8 turn_player; uint8 turn_player;
uint8 priorities[2]; uint8 priorities[2];
uint8 shuffle_count;
}; };
struct lpcost { struct lpcost {
int32 count; int32 count;
......
...@@ -139,11 +139,15 @@ int32 field::select_idle_command(uint16 step, uint8 playerid) { ...@@ -139,11 +139,15 @@ int32 field::select_idle_command(uint16 step, uint8 playerid) {
pduel->write_buffer8(1); pduel->write_buffer8(1);
else else
pduel->write_buffer8(0); pduel->write_buffer8(0);
if(infos.shuffle_count <5 && player[(uint32)playerid].list_hand.size() > 1)
pduel->write_buffer8(1);
else
pduel->write_buffer8(0);
return FALSE; return FALSE;
} else { } else {
uint32 t = returns.ivalue[0] & 0xffff; uint32 t = returns.ivalue[0] & 0xffff;
uint32 s = returns.ivalue[0] >> 16; uint32 s = returns.ivalue[0] >> 16;
if(t < 0 || t > 7 || s < 0 if(t < 0 || t > 8 || s < 0
|| (t == 0 && s >= core.summonable_cards.size()) || (t == 0 && s >= core.summonable_cards.size())
|| (t == 1 && s >= core.spsummonable_cards.size()) || (t == 1 && s >= core.spsummonable_cards.size())
|| (t == 2 && s >= core.repositionable_cards.size()) || (t == 2 && s >= core.repositionable_cards.size())
...@@ -151,7 +155,8 @@ int32 field::select_idle_command(uint16 step, uint8 playerid) { ...@@ -151,7 +155,8 @@ int32 field::select_idle_command(uint16 step, uint8 playerid) {
|| (t == 4 && s >= core.ssetable_cards.size()) || (t == 4 && s >= core.ssetable_cards.size())
|| (t == 5 && s >= core.select_chains.size()) || (t == 5 && s >= core.select_chains.size())
|| (t == 6 && (infos.phase != PHASE_MAIN1 || !core.to_bp)) || (t == 6 && (infos.phase != PHASE_MAIN1 || !core.to_bp))
|| (t == 7 && !core.to_ep)) { || (t == 7 && !core.to_ep)
|| (t == 8 && !(infos.shuffle_count <5 && player[(uint32)playerid].list_hand.size() > 1))) {
pduel->write_buffer8(MSG_RETRY); pduel->write_buffer8(MSG_RETRY);
return FALSE; return FALSE;
} }
......
...@@ -2701,6 +2701,11 @@ int32 field::process_idle_command(uint16 step) { ...@@ -2701,6 +2701,11 @@ int32 field::process_idle_command(uint16 step) {
} else if(ctype == 4) { } else if(ctype == 4) {
core.units.begin()->step = 8; core.units.begin()->step = 8;
return FALSE; return FALSE;
} else if (ctype == 8) {
core.units.begin()->step = -1;
shuffle(infos.turn_player, LOCATION_HAND);
infos.shuffle_count++;
return FALSE;
} else { } else {
core.units.begin()->step = 9; core.units.begin()->step = 9;
pduel->write_buffer8(MSG_HINT); pduel->write_buffer8(MSG_HINT);
...@@ -2789,6 +2794,7 @@ int32 field::process_idle_command(uint16 step) { ...@@ -2789,6 +2794,7 @@ int32 field::process_idle_command(uint16 step) {
} }
case 11: { case 11: {
returns.ivalue[0] = core.units.begin()->arg1; returns.ivalue[0] = core.units.begin()->arg1;
infos.shuffle_count = 0;
return TRUE; return TRUE;
} }
case 12: { case 12: {
...@@ -4142,7 +4148,6 @@ int32 field::process_turn(uint16 step, uint8 turn_player) { ...@@ -4142,7 +4148,6 @@ int32 field::process_turn(uint16 step, uint8 turn_player) {
} }
case 3: { case 3: {
//Standby Phase //Standby Phase
shuffle(turn_player, LOCATION_HAND);
infos.phase = PHASE_STANDBY; infos.phase = PHASE_STANDBY;
core.phase_action = FALSE; core.phase_action = FALSE;
raise_event((card*)0, EVENT_PHASE_PRESTART + PHASE_STANDBY, 0, 0, 0, turn_player, 0); raise_event((card*)0, EVENT_PHASE_PRESTART + PHASE_STANDBY, 0, 0, 0, turn_player, 0);
......
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