Commit b7e52db7 authored by nanahira's avatar nanahira

Merge branch 'master' of github.com:Fluorohydride/ygopro into develop

parents 4672bd84 1d647270
......@@ -35,8 +35,12 @@ void ClientCard::SetCode(unsigned int x) {
if((location == LOCATION_HAND) && (code != x)) {
code = x;
mainGame->dField.MoveCard(this, 5);
} else
} else {
if (x == 0 && code != 0) {
chain_code = code;
}
code = x;
}
}
void ClientCard::UpdateInfo(unsigned char* buf) {
int flag = BufferIO::Read<int32_t>(buf);
......@@ -48,11 +52,7 @@ void ClientCard::UpdateInfo(unsigned char* buf) {
int pdata = BufferIO::Read<int32_t>(buf);
if (!pdata)
ClearData();
if((location == LOCATION_HAND) && ((unsigned int)pdata != code)) {
code = pdata;
mainGame->dField.MoveCard(this, 5);
} else
code = pdata;
SetCode(pdata);
}
if(flag & QUERY_POSITION) {
int pdata = (BufferIO::Read<int32_t>(buf) >> 24) & 0xff;
......
......@@ -73,8 +73,12 @@ extern char** environ;
#include "../ocgcore/ocgapi.h"
template<size_t N, typename... TR>
inline int myswprintf(wchar_t(&buf)[N], const wchar_t* fmt, TR... args) {
return std::swprintf(buf, N, fmt, args...);
inline int myswprintf(wchar_t(&buf)[N], const wchar_t* fmt, TR&&... args) {
return std::swprintf(buf, N, fmt, std::forward<TR>(args)...);
}
template<size_t N, typename... TR>
inline int mysnprintf(char(&buf)[N], const char* fmt, TR&&... args) {
return std::snprintf(buf, N, fmt, std::forward<TR>(args)...);
}
inline FILE* mywfopen(const wchar_t* filename, const char* mode) {
......
......@@ -327,7 +327,7 @@ void DataManager::InsertServerList() {
}
bool DataManager::Error(sqlite3* pDB, sqlite3_stmt* pStmt) {
if (const char* msg = sqlite3_errmsg(pDB))
std::snprintf(errmsg, sizeof errmsg, "%s", msg);
mysnprintf(errmsg, "%s", msg);
else
errmsg[0] = '\0';
sqlite3_finalize(pStmt);
......@@ -565,7 +565,7 @@ unsigned char* DataManager::ScriptReaderEx(const char* script_name, int* slen) {
}
unsigned char* DataManager::ScriptReaderExSingle(const char* path, const char* script_name, int* slen, int pre_len, unsigned int use_irr) {
char sname[256];
std::snprintf(sname, sizeof sname, "%s%s", path, script_name + pre_len); //default script name: ./script/c%d.lua
mysnprintf(sname, "%s%s", path, script_name + pre_len); //default script name: ./script/c%d.lua
if (use_irr) {
return ReadScriptFromIrrFS(sname, slen);
}
......
......@@ -215,6 +215,7 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
mainGame->cbDBDecks->addItem(dname);
mainGame->cbDBDecks->setSelected(mainGame->cbDBDecks->getItemCount() - 1);
}
prev_deck = mainGame->cbDBDecks->getSelected();
int catesel = mainGame->cbDBCategory->getSelected();
wchar_t catepath[256];
DeckManager::GetCategoryPath(catepath, catesel, mainGame->cbDBCategory->getText());
......
......@@ -371,6 +371,7 @@ void Game::DrawCard(ClientCard* pcard) {
if(pcard->aniFrame == 0) {
pcard->is_moving = false;
pcard->is_fading = false;
pcard->chain_code = 0;
}
}
matManager.mCard.AmbientColor = 0xffffffff;
......@@ -378,7 +379,10 @@ void Game::DrawCard(ClientCard* pcard) {
driver->setTransform(irr::video::ETS_WORLD, pcard->mTransform);
auto m22 = pcard->mTransform(2, 2);
if(m22 > -0.99 || pcard->is_moving) {
matManager.mCard.setTexture(0, imageManager.GetTexture(pcard->code));
auto code = pcard->code;
if (code == 0 && pcard->is_moving)
code = pcard->chain_code;
matManager.mCard.setTexture(0, imageManager.GetTexture(code));
driver->setMaterial(matManager.mCard);
driver->drawVertexPrimitiveList(matManager.vCardFront, 4, matManager.iRectangle, 2);
}
......
......@@ -2084,7 +2084,7 @@ void Game::AddDebugMsg(const char* msg) {
}
if (enable_log & 0x2) {
char msgbuf[1040];
std::snprintf(msgbuf, sizeof msgbuf, "[Script Error]: %s", msg);
mysnprintf(msgbuf, "[Script Error]: %s", msg);
ErrorLog(msgbuf);
}
}
......
This diff is collapsed.
......@@ -365,9 +365,9 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
int flag = 0;
flag += (mainGame->chkBotHand->isChecked() ? 0x1 : 0);
char arg2[8];
std::snprintf(arg2, sizeof arg2, "%d", flag);
mysnprintf(arg2, "%d", flag);
char arg3[8];
std::snprintf(arg3, sizeof arg3, "%d", mainGame->gameConf.serverport);
mysnprintf(arg3, "%d", mainGame->gameConf.serverport);
execl("./bot", "bot", arg1, arg2, arg3, nullptr);
std::exit(0);
} else {
......
......@@ -182,7 +182,7 @@ public:
bool success = true;
TraversalDir(dir, [dir, &success](const char *name, bool isdir) {
char full_path[1024];
int len = std::snprintf(full_path, sizeof full_path, "%s/%s", dir, name);
int len = mysnprintf(full_path, "%s/%s", dir, name);
if (len < 0 || len >= (int)(sizeof full_path)) {
success = false;
return;
......@@ -228,7 +228,7 @@ public:
while((dirp = readdir(dir)) != nullptr) {
file_unit funit;
char fname[1024];
int len = std::snprintf(fname, sizeof fname, "%s/%s", path, dirp->d_name);
int len = mysnprintf(fname, "%s/%s", path, dirp->d_name);
if (len < 0 || len >= (int)(sizeof fname))
continue;
stat(fname, &fileStat);
......
......@@ -30,7 +30,7 @@ project "YGOPro"
end
if BUILD_FREETYPE then
includedirs { "../freetype/include" }
includedirs { "../freetype/custom", "../freetype/include" }
else
includedirs { FREETYPE_INCLUDE_DIR }
libdirs { FREETYPE_LIB_DIR }
......
......@@ -140,17 +140,12 @@ bool Replay::RenameReplay(const wchar_t* oldname, const wchar_t* newname) {
wchar_t newfname[256];
myswprintf(oldfname, L"./replay/%ls", oldname);
myswprintf(newfname, L"./replay/%ls", newname);
#ifdef _WIN32
BOOL result = MoveFileW(oldfname, newfname);
return !!result;
#else
char oldfilefn[256];
char newfilefn[256];
char oldfilefn[1024];
char newfilefn[1024];
BufferIO::EncodeUTF8(oldfname, oldfilefn);
BufferIO::EncodeUTF8(newfname, newfilefn);
int result = rename(oldfilefn, newfilefn);
int result = std::rename(oldfilefn, newfilefn);
return result == 0;
#endif
}
bool Replay::ReadNextResponse(unsigned char resp[]) {
unsigned char len{};
......
......@@ -228,7 +228,7 @@ bool ReplayMode::StartDuel() {
}
} else {
char filename[256]{};
std::snprintf(filename, sizeof filename, "./single/%s", cur_replay.script_name.c_str());
mysnprintf(filename, "./single/%s", cur_replay.script_name.c_str());
if(!preload_script(pduel, filename)) {
return false;
}
......
Subproject commit d2d3e31e382d71b460cd7f3842b4d332f3d5446c
Subproject commit 0c4898b2d1da022aff1fcf766d87336327aebeaf
......@@ -10,9 +10,6 @@ project "event"
if EVENT_VERSION>=0x02020000 then
print("Warning: Using libevent version 2.2.x is not supported, please use 2.1.x, otherwise you may encounter issues.")
end
if EVENT_VERSION>=0x02010000 and WINXP_SUPPORT then
print("Warning: libevent 2.1 uses some new APIs which require Windows Vista or later, so WinXP support will be invalid.")
end
includedirs { "include", "compat" }
......
/*
* This file registers the FreeType modules compiled into the library.
*
* YGOPro only uses modules that are needed for TrueType fonts.
* YGOPro only uses modules that are needed for TrueType and OpenType fonts.
*
*/
......
......@@ -5,7 +5,7 @@
* User-selectable configuration macros (specification only).
*
* This file is customized for YGOPro to include only the necessary
* configuration options for the TrueType font driver.
* configuration options for the TrueType and OpenType font driver.
*
* See the original FreeType source code for more information.
* /include/freetype/config/ftoption.h
......
......@@ -11,5 +11,6 @@ if not SERVER_PRO3_SUPPORT then
"SQLITE_OMIT_DEPRECATED",
"SQLITE_OMIT_PROGRESS_CALLBACK",
"SQLITE_OMIT_SHARED_CACHE",
"SQLITE_TRUSTED_SCHEMA=0",
}
end
......@@ -83,7 +83,6 @@ newoption { trigger = "irrklang-pro-release-lib-dir", category = "YGOPro - irrkl
newoption { trigger = "irrklang-pro-debug-lib-dir", category = "YGOPro - irrklang - pro", description = "", value = "PATH" }
newoption { trigger = 'build-ikpmp3', category = "YGOPro - irrklang - ikpmp3", description = "" }
newoption { trigger = "winxp-support", category = "YGOPro", description = "" }
newoption { trigger = "mac-arm", category = "YGOPro", description = "Compile for Apple Silicon Mac" }
newoption { trigger = "mac-intel", category = "YGOPro", description = "Compile for Intel Mac" }
......@@ -295,10 +294,6 @@ if USE_AUDIO then
end
end
if GetParam("winxp-support") and os.istarget("windows") then
WINXP_SUPPORT = true
end
IS_ARM=false
function spawn(cmd)
......@@ -395,12 +390,7 @@ workspace "YGOPro"
filter "system:windows"
systemversion "latest"
startproject "YGOPro"
if WINXP_SUPPORT then
defines { "WINVER=0x0501" }
toolset "v141_xp"
else
defines { "WINVER=0x0601" } -- WIN7
end
defines { "WINVER=0x0601" } -- WIN7
platforms { "Win32", "x64" }
filter { "system:windows", "platforms:Win32" }
......@@ -458,9 +448,7 @@ workspace "YGOPro"
filter "action:vs*"
cdialect "C11"
if not WINXP_SUPPORT then
conformancemode "On"
end
conformancemode "On"
vectorextensions "SSE2"
buildoptions { "/utf-8" }
defines { "_CRT_SECURE_NO_WARNINGS" }
......
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