Commit e7b0c400 authored by VanillaSalt's avatar VanillaSalt

add MSG_PLAYER_HINT

parent e825a8f7
...@@ -380,6 +380,7 @@ void ClientField::ShowSelectCard(bool buttonok, bool chain) { ...@@ -380,6 +380,7 @@ void ClientField::ShowSelectCard(bool buttonok, bool chain) {
mainGame->btnCardSelect[i]->setPressed(false); mainGame->btnCardSelect[i]->setPressed(false);
mainGame->btnCardSelect[i]->setVisible(true); mainGame->btnCardSelect[i]->setVisible(true);
if(mainGame->dInfo.curMsg != MSG_SORT_CHAIN && mainGame->dInfo.curMsg != MSG_SORT_CARD) { if(mainGame->dInfo.curMsg != MSG_SORT_CHAIN && mainGame->dInfo.curMsg != MSG_SORT_CARD) {
wchar_t formatBuffer[2048];
if(chain && selectable_cards[i]->is_conti && !selectable_cards[i]->code) if(chain && selectable_cards[i]->is_conti && !selectable_cards[i]->code)
myswprintf(formatBuffer, L"%ls", DataManager::unknown_string); myswprintf(formatBuffer, L"%ls", DataManager::unknown_string);
else if(selectable_cards[i]->location == LOCATION_OVERLAY) else if(selectable_cards[i]->location == LOCATION_OVERLAY)
...@@ -403,6 +404,7 @@ void ClientField::ShowSelectCard(bool buttonok, bool chain) { ...@@ -403,6 +404,7 @@ void ClientField::ShowSelectCard(bool buttonok, bool chain) {
} }
} else { } else {
if(sort_list[i]) { if(sort_list[i]) {
wchar_t formatBuffer[2048];
myswprintf(formatBuffer, L"%d", sort_list[i]); myswprintf(formatBuffer, L"%d", sort_list[i]);
mainGame->stCardPos[i]->setText(formatBuffer); mainGame->stCardPos[i]->setText(formatBuffer);
} else mainGame->stCardPos[i]->setText(L""); } else mainGame->stCardPos[i]->setText(L"");
...@@ -447,6 +449,7 @@ void ClientField::ShowChainCard() { ...@@ -447,6 +449,7 @@ void ClientField::ShowChainCard() {
mainGame->btnCardSelect[i]->setRelativePosition(rect<s32>(startpos + i * 125, 55, startpos + 120 + i * 125, 225)); mainGame->btnCardSelect[i]->setRelativePosition(rect<s32>(startpos + i * 125, 55, startpos + 120 + i * 125, 225));
mainGame->btnCardSelect[i]->setPressed(false); mainGame->btnCardSelect[i]->setPressed(false);
mainGame->btnCardSelect[i]->setVisible(true); mainGame->btnCardSelect[i]->setVisible(true);
wchar_t formatBuffer[2048];
myswprintf(formatBuffer, L"%ls[%d]", dataManager.FormatLocation(selectable_cards[i]->location, selectable_cards[i]->sequence), myswprintf(formatBuffer, L"%ls[%d]", dataManager.FormatLocation(selectable_cards[i]->location, selectable_cards[i]->sequence),
selectable_cards[i]->sequence + 1); selectable_cards[i]->sequence + 1);
mainGame->stCardPos[i]->setText(formatBuffer); mainGame->stCardPos[i]->setText(formatBuffer);
...@@ -501,6 +504,7 @@ void ClientField::ShowLocationCard() { ...@@ -501,6 +504,7 @@ void ClientField::ShowLocationCard() {
mainGame->btnCardDisplay[i]->setRelativePosition(rect<s32>(startpos + i * 125, 55, startpos + 120 + i * 125, 225)); mainGame->btnCardDisplay[i]->setRelativePosition(rect<s32>(startpos + i * 125, 55, startpos + 120 + i * 125, 225));
mainGame->btnCardDisplay[i]->setPressed(false); mainGame->btnCardDisplay[i]->setPressed(false);
mainGame->btnCardDisplay[i]->setVisible(true); mainGame->btnCardDisplay[i]->setVisible(true);
wchar_t formatBuffer[2048];
if(display_cards[i]->location == LOCATION_OVERLAY) if(display_cards[i]->location == LOCATION_OVERLAY)
myswprintf(formatBuffer, L"%ls[%d](%d)", myswprintf(formatBuffer, L"%ls[%d](%d)",
dataManager.FormatLocation(display_cards[i]->overlayTarget->location, display_cards[i]->overlayTarget->sequence), dataManager.FormatLocation(display_cards[i]->overlayTarget->location, display_cards[i]->overlayTarget->sequence),
......
...@@ -65,6 +65,7 @@ public: ...@@ -65,6 +65,7 @@ public:
std::vector<ClientCard*> selectsum_all; std::vector<ClientCard*> selectsum_all;
std::vector<ClientCard*> display_cards; std::vector<ClientCard*> display_cards;
std::vector<int> sort_list; std::vector<int> sort_list;
std::map<int, int> player_desc_hints[2];
bool grave_act; bool grave_act;
bool remove_act; bool remove_act;
bool deck_act; bool deck_act;
...@@ -114,11 +115,11 @@ public: ...@@ -114,11 +115,11 @@ public:
int command_location; int command_location;
size_t command_sequence; size_t command_sequence;
ClientCard* hovered_card; ClientCard* hovered_card;
int hovered_player;
ClientCard* clicked_card; ClientCard* clicked_card;
ClientCard* command_card; ClientCard* command_card;
ClientCard* highlighting_card; ClientCard* highlighting_card;
int list_command; int list_command;
wchar_t formatBuffer[2048];
virtual bool OnEvent(const irr::SEvent& event); virtual bool OnEvent(const irr::SEvent& event);
void GetHoverField(int x, int y); void GetHoverField(int x, int y);
......
...@@ -2977,6 +2977,20 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -2977,6 +2977,20 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
} }
return true; return true;
} }
case MSG_PLAYER_HINT: {
int player = mainGame->LocalPlayer(BufferIO::ReadInt8(pbuf));
int chtype = BufferIO::ReadInt8(pbuf);
int value = BufferIO::ReadInt32(pbuf);
auto& player_desc_hints = mainGame->dField.player_desc_hints[player];
if(chtype == PHINT_DESC_ADD) {
player_desc_hints[value]++;
} else if(chtype == PHINT_DESC_REMOVE) {
player_desc_hints[value]--;
if(player_desc_hints[value] == 0)
player_desc_hints.erase(value);
}
return true;
}
case MSG_MATCH_KILL: { case MSG_MATCH_KILL: {
match_kill = BufferIO::ReadInt32(pbuf); match_kill = BufferIO::ReadInt32(pbuf);
return true; return true;
......
This diff is collapsed.
...@@ -5,23 +5,4 @@ ...@@ -5,23 +5,4 @@
#include "game.h" #include "game.h"
#include "client_card.h" #include "client_card.h"
namespace ygo {
class EventHandler : public irr::IEventReceiver {
public:
virtual bool OnEvent(const irr::SEvent& event);
void GetHoverField(int x, int y);
void ShowMenu(int flag, int x, int y);
irr::gui::IGUIElement* panel;
int hovered_controler;
int hovered_location;
int hovered_sequence;
ClientCard* hovered_card;
ClientCard* clicked_card;
wchar_t formatBuffer[256];
};
}
#endif //EVENT_HANDLER_H #endif //EVENT_HANDLER_H
...@@ -765,6 +765,11 @@ bool ReplayMode::ReplayAnalyze(char* msg, unsigned int len) { ...@@ -765,6 +765,11 @@ bool ReplayMode::ReplayAnalyze(char* msg, unsigned int len) {
DuelClient::ClientAnalyze(offset, pbuf - offset); DuelClient::ClientAnalyze(offset, pbuf - offset);
break; break;
} }
case MSG_PLAYER_HINT: {
pbuf += 6;
DuelClient::ClientAnalyze(offset, pbuf - offset);
break;
}
case MSG_MATCH_KILL: { case MSG_MATCH_KILL: {
pbuf += 4; pbuf += 4;
break; break;
......
...@@ -1289,6 +1289,14 @@ int SingleDuel::Analyze(char* msgbuffer, unsigned int len) { ...@@ -1289,6 +1289,14 @@ int SingleDuel::Analyze(char* msgbuffer, unsigned int len) {
NetServer::ReSendToPlayer(*oit); NetServer::ReSendToPlayer(*oit);
break; break;
} }
case MSG_PLAYER_HINT: {
pbuf += 6;
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);
break;
}
case MSG_MATCH_KILL: { case MSG_MATCH_KILL: {
int code = BufferIO::ReadInt32(pbuf); int code = BufferIO::ReadInt32(pbuf);
if(match_mode) { if(match_mode) {
......
...@@ -601,6 +601,11 @@ bool SingleMode::SinglePlayAnalyze(char* msg, unsigned int len) { ...@@ -601,6 +601,11 @@ bool SingleMode::SinglePlayAnalyze(char* msg, unsigned int len) {
DuelClient::ClientAnalyze(offset, pbuf - offset); DuelClient::ClientAnalyze(offset, pbuf - offset);
break; break;
} }
case MSG_PLAYER_HINT: {
pbuf += 6;
DuelClient::ClientAnalyze(offset, pbuf - offset);
break;
}
case MSG_TAG_SWAP: { case MSG_TAG_SWAP: {
player = pbuf[0]; player = pbuf[0];
pbuf += pbuf[2] * 4 + pbuf[4] * 4 + 9; pbuf += pbuf[2] * 4 + pbuf[4] * 4 + 9;
......
...@@ -1330,6 +1330,16 @@ int TagDuel::Analyze(char* msgbuffer, unsigned int len) { ...@@ -1330,6 +1330,16 @@ int TagDuel::Analyze(char* msgbuffer, unsigned int len) {
NetServer::ReSendToPlayer(*oit); NetServer::ReSendToPlayer(*oit);
break; break;
} }
case MSG_PLAYER_HINT: {
pbuf += 6;
NetServer::SendBufferToPlayer(players[0], STOC_GAME_MSG, offset, pbuf - offset);
NetServer::ReSendToPlayer(players[1]);
NetServer::ReSendToPlayer(players[2]);
NetServer::ReSendToPlayer(players[3]);
for(auto oit = observers.begin(); oit != observers.end(); ++oit)
NetServer::ReSendToPlayer(*oit);
break;
}
case MSG_TAG_SWAP: { case MSG_TAG_SWAP: {
player = BufferIO::ReadInt8(pbuf); player = BufferIO::ReadInt8(pbuf);
/*int mcount = */BufferIO::ReadInt8(pbuf); /*int mcount = */BufferIO::ReadInt8(pbuf);
......
Subproject commit 42c1de39dc2562d7485a962cef4cf494e36b900d Subproject commit 0c58f35e90a3baa10af009776235a53e11eae620
Subproject commit 7362fd18381b3fadd0682ae97388dee3cfc79794 Subproject commit 4de8d4093e5767d90696c8abdd2f1d75215d6adb
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