Commit 8a354fb5 authored by mercury233's avatar mercury233

Merge branch 'patch-auto-save-replay' into test

parents 48c4c493 a5ab7da1
......@@ -690,11 +690,22 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) {
wchar_t timetext[80];
mbstowcs(timetext, timebuf, size);
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();
}
else {
mainGame->actionParam = 1;
wchar_t msgbuf[256];
myswprintf(msgbuf, dataManager.GetSysString(1367), timetext);
mainGame->SetStaticText(mainGame->stACMessage, 310, mainGame->textFont, msgbuf);
mainGame->PopupElement(mainGame->wACMessage, 20);
mainGame->gMutex.Unlock();
mainGame->WaitFrameSignal(30);
}
if(mainGame->actionParam || !is_host) {
char* prep = pdata;
Replay new_replay;
......
......@@ -304,7 +304,10 @@ bool Game::Initialize() {
posY += 30;
chkQuickAnimation = env->addCheckBox(false, rect<s32>(posX, posY, posX + 260, posY + 25), tabHelper, CHECKBOX_QUICK_ANIMATION, dataManager.GetSysString(1299));
chkQuickAnimation->setChecked(gameConf.quick_animation != 0);
elmTabHelperLast = chkQuickAnimation;
posY += 30;
chkAutoSaveReplay = env->addCheckBox(false, rect<s32>(posX, posY, posX + 260, posY + 25), tabHelper, -1, dataManager.GetSysString(1366));
chkAutoSaveReplay->setChecked(gameConf.auto_save_replay != 0);
elmTabHelperLast = chkAutoSaveReplay;
//system
irr::gui::IGUITab* _tabSystem = wInfos->addTab(dataManager.GetSysString(1273));
_tabSystem->setRelativePosition(recti(16, 49, 299, 362));
......@@ -1136,6 +1139,7 @@ void Game::LoadConfig() {
gameConf.defaultOT = 1;
gameConf.enable_bot_mode = 0;
gameConf.quick_animation = 0;
gameConf.auto_save_replay = 0;
gameConf.enable_sound = true;
gameConf.sound_volume = 0.5;
gameConf.enable_music = true;
......@@ -1211,6 +1215,8 @@ void Game::LoadConfig() {
gameConf.enable_bot_mode = atoi(valbuf);
} else if(!strcmp(strbuf, "quick_animation")) {
gameConf.quick_animation = atoi(valbuf);
} else if(!strcmp(strbuf, "auto_save_replay")) {
gameConf.auto_save_replay = atoi(valbuf);
} else if(!strcmp(strbuf, "window_maximized")) {
gameConf.window_maximized = atoi(valbuf) > 0;
} else if(!strcmp(strbuf, "window_width")) {
......@@ -1294,6 +1300,7 @@ void Game::SaveConfig() {
fprintf(fp, "default_ot = %d\n", gameConf.defaultOT);
fprintf(fp, "enable_bot_mode = %d\n", gameConf.enable_bot_mode);
fprintf(fp, "quick_animation = %d\n", gameConf.quick_animation);
fprintf(fp, "auto_save_replay = %d\n", (chkAutoSaveReplay->isChecked() ? 1 : 0));
fprintf(fp, "window_maximized = %d\n", (gameConf.window_maximized ? 1 : 0));
fprintf(fp, "window_width = %d\n", gameConf.window_width);
fprintf(fp, "window_height = %d\n", gameConf.window_height);
......
......@@ -44,6 +44,7 @@ struct Config {
int defaultOT;
int enable_bot_mode;
int quick_animation;
int auto_save_replay;
bool enable_sound;
bool enable_music;
double sound_volume;
......@@ -272,6 +273,7 @@ public:
irr::gui::IGUICheckBox* chkAutoChain;
irr::gui::IGUICheckBox* chkWaitChain;
irr::gui::IGUICheckBox* chkQuickAnimation;
irr::gui::IGUICheckBox* chkAutoSaveReplay;
irr::gui::IGUIWindow* tabSystem;
irr::gui::IGUIElement* elmTabSystemLast;
irr::gui::IGUIScrollBar* scrTabSystem;
......
......@@ -135,11 +135,21 @@ int SingleMode::SinglePlayThread(void* param) {
wchar_t timetext[80];
mbstowcs(timetext, timebuf, size);
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();
} else {
mainGame->actionParam = 1;
wchar_t msgbuf[256];
myswprintf(msgbuf, dataManager.GetSysString(1367), timetext);
mainGame->SetStaticText(mainGame->stACMessage, 310, mainGame->textFont, msgbuf);
mainGame->PopupElement(mainGame->wACMessage, 20);
mainGame->gMutex.Unlock();
mainGame->WaitFrameSignal(30);
}
if(mainGame->actionParam)
last_replay.SaveReplay(mainGame->ebRSName->getText());
end_duel(pduel);
......
......@@ -392,6 +392,8 @@
!system 1363 是否删除这个录像?
!system 1364 重命名录像
!system 1365 重命名失败,可能存在同名文件
!system 1366 自动保存录像
!system 1367 录像已自动保存为%ls.yrp
!system 1370 星数↑
!system 1371 攻击↑
!system 1372 守备↑
......
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