Commit dde8ce20 authored by edo9300's avatar edo9300

Merge remote-tracking branch 'refs/remotes/Fluorohydride/master'

parents bf279620 b5bae3aa
......@@ -3,7 +3,7 @@ A script engine for "yu-gi-oh!" and sample gui
[中文说明](https://github.com/Fluorohydride/ygopro/wiki/%E4%B8%AD%E6%96%87%E8%AF%B4%E6%98%8E)
###Keys:
### Keys:
* ESC: Minimize the window.
* A: Holding down this button will let the system stop at every timing.
* S: Holding down this button will let the system skip every timing.
......@@ -11,25 +11,25 @@ A script engine for "yu-gi-oh!" and sample gui
* F1~F4: Show the cards in your grave, banished zone, extra deck, xyz materials.
* F5~F8: Show the cards in your opponent's grave, banished zone, extra deck, xyz materials.
###Color in card list:
####Background:
### Color in card list:
#### Background:
* White = your card, Grey = your opponent's card
####Text:
#### Text:
Cards in deck, extra deck and banished zone:
* Black = face-up, Blue = face-down
Xyz materials:
* Black = default, Blue = the owner of the xyz material is different from its controller
###Sequence:
### Sequence:
* Monster Zone: 1~5, starting from the left hand side.
* Spell & Trap Zone: 1~5, starting from the left hand side.
* Field Zone: 6
* Pendulum Zone: 7~8, starting from the left hand side.
* The others: 1~n, starting from the bottom.
###Deck edit page:
### Deck edit page:
* All numeric textboxs: They support >, =, <, >=, <= signs.
* Card name: Search card names and texts by default, $foo will only search foo in card names, and @foo will search cards of "foo" archetype(due to translation, card name contains "foo" does not mean that card is "foo" card).
......
......@@ -342,14 +342,20 @@ void Game::DrawMisc() {
driver->drawVertexPrimitiveList(matManager.vActivate, 4, matManager.iRectangle, 2);
}
if(dField.pzone_act[0]) {
im.setTranslation(vector3df((matManager.vFieldSzone[0][6][0].Pos.X + matManager.vFieldSzone[0][6][1].Pos.X) / 2,
(matManager.vFieldSzone[0][6][0].Pos.Y + matManager.vFieldSzone[0][6][2].Pos.Y) / 2, 0.03f));
int seq = 0;
if(dField.szone[0][6] && dField.szone[0][6]->lscale)
seq = 6;
im.setTranslation(vector3df((matManager.vFieldSzone[0][seq][0].Pos.X + matManager.vFieldSzone[0][seq][1].Pos.X) / 2,
(matManager.vFieldSzone[0][seq][0].Pos.Y + matManager.vFieldSzone[0][seq][2].Pos.Y) / 2, 0.03f));
driver->setTransform(irr::video::ETS_WORLD, im);
driver->drawVertexPrimitiveList(matManager.vActivate, 4, matManager.iRectangle, 2);
}
if(dField.pzone_act[1]) {
im.setTranslation(vector3df((matManager.vFieldSzone[0][7][0].Pos.X + matManager.vFieldSzone[0][7][1].Pos.X) / 2,
(matManager.vFieldSzone[0][7][0].Pos.Y + matManager.vFieldSzone[0][7][2].Pos.Y) / 2, 0.03f));
int seq = 0;
if(dField.szone[1][6] && dField.szone[1][6]->lscale)
seq = 6;
im.setTranslation(vector3df((matManager.vFieldSzone[1][seq][0].Pos.X + matManager.vFieldSzone[1][seq][1].Pos.X) / 2,
(matManager.vFieldSzone[1][seq][0].Pos.Y + matManager.vFieldSzone[1][seq][2].Pos.Y) / 2, 0.03f));
driver->setTransform(irr::video::ETS_WORLD, im);
driver->drawVertexPrimitiveList(matManager.vActivate, 4, matManager.iRectangle, 2);
}
......
......@@ -1114,7 +1114,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
mainGame->dField.remove_act = true;
else if (pcard->location == LOCATION_EXTRA)
mainGame->dField.extra_act = true;
else if (pcard->location == LOCATION_SZONE && pcard->sequence == 6)
else if (pcard->location == LOCATION_SZONE && (pcard->sequence == 0 || pcard->sequence == 6) && pcard->lscale)
mainGame->dField.pzone_act[pcard->controler] = true;
}
mainGame->dField.reposable_cards.clear();
......@@ -1469,9 +1469,14 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
mainGame->dField.selected_field = 0;
unsigned char respbuf[64];
int pzone = 0;
if (mainGame->dInfo.curMsg == MSG_SELECT_PLACE)
mainGame->stHintMsg->setText(dataManager.GetSysString(569));
else
if (mainGame->dInfo.curMsg == MSG_SELECT_PLACE) {
if (select_hint) {
myswprintf(textBuffer, dataManager.GetSysString(569), dataManager.GetName(select_hint));
} else
myswprintf(textBuffer, dataManager.GetSysString(560));
select_hint = 0;
mainGame->stHintMsg->setText(textBuffer);
} else
mainGame->stHintMsg->setText(dataManager.GetSysString(570));
mainGame->stHintMsg->setVisible(true);
if (mainGame->dInfo.curMsg == MSG_SELECT_PLACE && mainGame->chkAutoPos->isChecked()) {
......
......@@ -1836,7 +1836,7 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
myswprintf(formatBuffer, L"\n(%ls)", dataManager.GetName(mcard->alias));
str.append(formatBuffer);
}
if(mcard->location == LOCATION_SZONE && (mcard->sequence == 6 || mcard->sequence == 7)) {
if(mcard->location == LOCATION_SZONE && mcard->lscale) {
myswprintf(formatBuffer, L"\n%d/%d", mcard->lscale, mcard->rscale);
str.append(formatBuffer);
}
......
......@@ -1281,7 +1281,7 @@ void Game::AddChatMsg(wchar_t* msg, int player) {
chatMsg[0].append(L"[System]: ");
break;
case 9: //error message
chatMsg[0].append(L"[Script error:] ");
chatMsg[0].append(L"[Script Error]: ");
break;
default: //from watcher or unknown
if(player < 11 || player > 19)
......@@ -1289,6 +1289,25 @@ void Game::AddChatMsg(wchar_t* msg, int player) {
}
chatMsg[0].append(msg);
}
void Game::AddDebugMsg(char* msg)
{
if (enable_log & 0x1) {
wchar_t wbuf[1024];
BufferIO::DecodeUTF8(msg, wbuf);
mainGame->AddChatMsg(wbuf, 9);
}
if (enable_log & 0x2) {
FILE* fp = fopen("error.log", "at");
if (!fp)
return;
time_t nowtime = time(NULL);
struct tm *localedtime = localtime(&nowtime);
char timebuf[40];
strftime(timebuf, 40, "%Y-%m-%d %H:%M:%S", localedtime);
fprintf(fp, "[%s][Script Error]: %s\n", timebuf, msg);
fclose(fp);
}
}
void Game::ClearTextures() {
matManager.mCard.setTexture(0, 0);
imgCard->setImage(0);
......
......@@ -112,6 +112,7 @@ public:
void SaveConfig();
void ShowCardInfo(int code);
void AddChatMsg(wchar_t* msg, int player);
void AddDebugMsg(char* msgbuf);
void ClearTextures();
void CloseDuelWindow();
void PlaySoundEffect(char* sound);
......
......@@ -23,7 +23,7 @@ Materials::Materials() {
SetS3DVertex(vField, -1.0f, -4.0f, 9.0f, 4.0f, 0, 1, 0, 0, 1, 1);
SetS3DVertex(vFieldSpell, 1.2f, -3.2f, 6.7f, 3.2f, 0, 1, 0, 0, 1, 1);
SetS3DVertex(vFieldSpell1, 1.2f, 0.8f, 6.7f, 3.2f, 0, 1, 0, 0.2f, 1, 0.63636f);
SetS3DVertex(vFieldSpell2, 1.2f, -3.2f, 6.7f, -0.8f, 0, 1, 0, 0.63636f, 1, 0.2f);
SetS3DVertex(vFieldSpell2, 1.2f, -3.2f, 6.7f, -0.8f, 0, 1, 1, 0.63636f, 0, 0.2f);
/*
//background grids
......
......@@ -864,17 +864,7 @@ int ReplayMode::MessageHandler(long fduel, int type) {
return 0;
char msgbuf[1024];
get_log_message(fduel, (byte*)msgbuf);
if(enable_log == 1) {
wchar_t wbuf[1024];
BufferIO::DecodeUTF8(msgbuf, wbuf);
mainGame->AddChatMsg(wbuf, 9);
} else if(enable_log == 2) {
FILE* fp = fopen("error.log", "at");
if(!fp)
return 0;
fprintf(fp, "[Script error:] %s\n", msgbuf);
fclose(fp);
}
mainGame->AddDebugMsg(msgbuf);
return 0;
}
......
......@@ -1562,17 +1562,7 @@ int SingleDuel::MessageHandler(long fduel, int type) {
return 0;
char msgbuf[1024];
get_log_message(fduel, (byte*)msgbuf);
if(enable_log == 1) {
wchar_t wbuf[1024];
BufferIO::DecodeUTF8(msgbuf, wbuf);
mainGame->AddChatMsg(wbuf, 9);
} else if(enable_log == 2) {
FILE* fp = fopen("error.log", "at");
if(!fp)
return 0;
fprintf(fp, "[Script error:] %s\n", msgbuf);
fclose(fp);
}
mainGame->AddDebugMsg(msgbuf);
return 0;
}
void SingleDuel::SingleTimer(evutil_socket_t fd, short events, void* arg) {
......
......@@ -842,17 +842,7 @@ int SingleMode::MessageHandler(long fduel, int type) {
return 0;
char msgbuf[1024];
get_log_message(fduel, (byte*)msgbuf);
if(enable_log == 1) {
wchar_t wbuf[1024];
BufferIO::DecodeUTF8(msgbuf, wbuf);
mainGame->AddChatMsg(wbuf, 9);
} else if(enable_log == 2) {
FILE* fp = fopen("error.log", "at");
if(!fp)
return 0;
fprintf(fp, "[Script error:] %s\n", msgbuf);
fclose(fp);
}
mainGame->AddDebugMsg(msgbuf);
return 0;
}
......
......@@ -1675,17 +1675,7 @@ int TagDuel::MessageHandler(long fduel, int type) {
return 0;
char msgbuf[1024];
get_log_message(fduel, (byte*)msgbuf);
if(enable_log == 1) {
wchar_t wbuf[1024];
BufferIO::DecodeUTF8(msgbuf, wbuf);
mainGame->AddChatMsg(wbuf, 9);
} else if(enable_log == 2) {
FILE* fp = fopen("error.log", "at");
if(!fp)
return 0;
fprintf(fp, "[Script error:] %s\n", msgbuf);
fclose(fp);
}
mainGame->AddDebugMsg(msgbuf);
return 0;
}
void TagDuel::TagTimer(evutil_socket_t fd, short events, void* arg) {
......
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