Commit 610fcd65 authored by IMJoyJ's avatar IMJoyJ Committed by nanahira

auto_watch_mode rework (#21)

* fix the white card bug in auto_watch_mode;
Game::DrawSpec improvement in auto_watch_mode

* fix

* improve auto_watch_mode behavior when connection failed; fix DrawSpec function bug

* auto_watch_mode visual effect rework

* no longer use ShowCardInfo in auto_watch_mode
parent c20c7332
......@@ -806,11 +806,13 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) {
wcsftime(timetext, 40, L"%Y-%m-%d %H-%M-%S", localedtime);
mainGame->ebRSName->setText(timetext);
if(!mainGame->chkAutoSaveReplay->isChecked()) {
mainGame->wReplaySave->setText(dataManager.GetSysString(1340));
mainGame->PopupElement(mainGame->wReplaySave);
mainGame->gMutex.unlock();
mainGame->replaySignal.Reset();
mainGame->replaySignal.Wait();
if (!auto_watch_mode) {
mainGame->wReplaySave->setText(dataManager.GetSysString(1340));
mainGame->PopupElement(mainGame->wReplaySave);
mainGame->gMutex.unlock();
mainGame->replaySignal.Reset();
mainGame->replaySignal.Wait();
}
}
else {
mainGame->actionParam = 1;
......@@ -3041,6 +3043,18 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
int ct = BufferIO::ReadInt8(pbuf);
if(mainGame->dInfo.isReplaySkiping)
return true;
if (auto_watch_mode && mainGame->dField.chains.size() > 1) {
int code = mainGame->dField.chains[ct - 1].chain_card->code;
if (code > 0) {
mainGame->showcardcode = code;
mainGame->showcarddif = 0;
mainGame->showcardp = 0;
mainGame->showcard = 1;
mainGame->WaitFrameSignal(30);
mainGame->showcard = 0;
mainGame->WaitFrameSignal(11);
}
}
if (mainGame->dField.chains.size() > 1) {
if (mainGame->dField.last_chain)
mainGame->WaitFrameSignal(11);
......@@ -3051,10 +3065,6 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
mainGame->WaitFrameSignal(3);
}
}
if (auto_watch_mode) {
int code = mainGame->dField.chains[ct - 1].chain_card->code;
mainGame->ShowCardInfo(code);
}
mainGame->dField.last_chain = false;
return true;
}
......@@ -3125,8 +3135,11 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
int s = BufferIO::ReadInt8(pbuf);
/*int ss = */BufferIO::ReadInt8(pbuf);
ClientCard* pcard = mainGame->dField.GetCard(c, l, s);
if (auto_watch_mode && i == 0 && (pcard->position & POS_FACEUP) && (pcard->location & LOCATION_ONFIELD)) {
mainGame->ShowCardInfo(pcard->code);
if (auto_watch_mode && pcard->code > 0) {
mainGame->showcardcode = pcard->code;
mainGame->showcarddif = 0;
mainGame->showcardp = 0;
mainGame->showcard = 4;
}
pcard->is_highlighting = true;
mainGame->dField.current_chain.target.insert(pcard);
......@@ -3148,6 +3161,9 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
mainGame->dField.MoveCard(pcard, 5);
} else
mainGame->WaitFrameSignal(30);
if (auto_watch_mode && pcard->code > 0) {
mainGame->showcard = 0;
}
myswprintf(textBuffer, dataManager.GetSysString(1610), dataManager.GetName(pcard->code), dataManager.FormatLocation(l, s), s + 1);
mainGame->AddLog(textBuffer, pcard->code);
pcard->is_highlighting = false;
......@@ -3407,6 +3423,16 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
int s = BufferIO::ReadInt8(pbuf);
int count = BufferIO::ReadInt16(pbuf);
ClientCard* pc = mainGame->dField.GetCard(c, l, s);
if (auto_watch_mode && pc->code > 0) {
myswprintf(event_string, dataManager.GetSysString(1610), dataManager.GetName(pc->code));
mainGame->showcardcode = pc->code;
mainGame->showcarddif = 0;
mainGame->showcardp = 0;
mainGame->showcard = 5;
mainGame->WaitFrameSignal(30);
mainGame->showcard = 0;
mainGame->WaitFrameSignal(11);
}
if (pc->counters.count(type))
pc->counters[type] += count;
else pc->counters[type] = count;
......@@ -3490,13 +3516,22 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
else
mainGame->atk_r = vector3df(0, 0, 3.1415926 - atan((xd - xa) / (yd - ya)));
}
matManager.GenArrow(sy);
if (auto_watch_mode) {
mainGame->ShowCardInfo(mainGame->dField.attacker->code);
int code = mainGame->dField.attacker->code;
if (code > 0) {
mainGame->showcardcode = code;
mainGame->showcarddif = 0;
mainGame->showcardp = 0;
mainGame->showcard = 2;
}
}
matManager.GenArrow(sy);
mainGame->attack_sv = 0;
mainGame->is_attacking = true;
mainGame->WaitFrameSignal(40);
if (auto_watch_mode) {
mainGame->showcard = 0;
}
mainGame->is_attacking = false;
return 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