Commit 79549d88 authored by nanahira's avatar nanahira

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

parents f219906c b1cbe233
name: Automated Test Build
on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]
jobs:
build-windows:
strategy:
fail-fast: false
matrix:
os: [windows-2019, windows-2022]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout repository with submodules
uses: actions/checkout@v4
with:
fetch-depth: 1
submodules: true
- name: Update submodules
run: |
cd ocgcore
git checkout master
git pull origin master
cd ..
# cd script
# git checkout master
# git pull origin master
# cd ..
- name: Download premake
id: premake
uses: mercury233/action-cache-download-file@v1.0.0
with:
url: https://github.com/premake/premake-core/releases/download/v5.0.0-beta5/premake-5.0.0-beta5-windows.zip
filename: premake5.zip
- name: Extract premake
run: |
7z x ${{ steps.premake.outputs.filepath }}
- name: Download libevent
id: libevent
uses: mercury233/action-cache-download-file@v1.0.0
with:
url: https://github.com/libevent/libevent/releases/download/release-2.0.22-stable/libevent-2.0.22-stable.tar.gz
filename: libevent.tar.gz
- name: Extract libevent
run: |
tar xf ${{ steps.libevent.outputs.filepath }}
move libevent-2.0.22-stable event
xcopy /E event\WIN32-Code event\include
- name: Download freetype
id: freetype
uses: mercury233/action-cache-download-file@v1.0.0
with:
url: http://downloads.sourceforge.net/freetype/freetype-2.13.3.tar.gz
- name: Extract freetype
run: |
tar xf ${{ steps.freetype.outputs.filepath }}
move freetype-2.13.3 freetype
- name: Download lua
id: lua
uses: mercury233/action-cache-download-file@v1.0.0
with:
url: https://www.lua.org/ftp/lua-5.4.7.tar.gz
- name: Extract lua
run: |
tar xf ${{ steps.lua.outputs.filepath }}
move lua-5.4.7 lua
- name: Download sqlite
id: sqlite
uses: mercury233/action-cache-download-file@v1.0.0
with:
url: https://www.sqlite.org/2025/sqlite-amalgamation-3490100.zip
- name: Extract sqlite
run: |
7z x ${{ steps.sqlite.outputs.filepath }}
move sqlite-amalgamation-3490100 sqlite3
- name: Download irrKlang
id: irrKlang
uses: mercury233/action-cache-download-file@v1.0.0
with:
url: https://www.ambiera.at/downloads/irrKlang-32bit-1.6.0.zip
- name: Extract irrKlang
run: |
7z x ${{ steps.irrKlang.outputs.filepath }}
move irrKlang-1.6.0 irrKlang
- name: Download irrlicht
run: |
git clone --depth=1 https://github.com/mercury233/irrlicht
- name: Check DirectX SDK
id: dxsdk
uses: actions/cache@v4
with:
key: dxsdk
path: DXSDK
- name: Download DirectX SDK
if: steps.dxsdk.outputs.cache-hit != 'true'
id: dxsdk-download
uses: mercury233/action-cache-download-file@v1.0.0
with:
url: https://download.microsoft.com/download/a/e/7/ae743f1f-632b-4809-87a9-aa1bb3458e31/DXSDK_Jun10.exe
- name: Install DirectX SDK
if: steps.dxsdk.outputs.cache-hit != 'true'
run: |
7z x ${{ steps.dxsdk-download.outputs.filepath }} -aoa
- name: Set DirectX SDK environment variable
run: |
$dxsdkPath = Resolve-Path 'DXSDK'
"DXSDK_DIR=$($dxsdkPath.ProviderPath)\" | Out-File -FilePath $env:GITHUB_ENV -Append
- name: Copy premake files
run: |
xcopy /E premake\* .
- name: Use premake to generate Visual Studio solution (2019)
if: matrix.os == 'windows-2019'
run: |
.\premake5.exe vs2019 --winxp-support
- name: Use premake to generate Visual Studio solution (2022)
if: matrix.os == 'windows-2022'
run: |
.\premake5.exe vs2022
- name: Add msbuild to PATH
uses: microsoft/setup-msbuild@v2
- name: Build solution
run: |
MSBuild.exe build\YGOPro.sln /m /p:Configuration=Release
- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: YGOPro-${{ matrix.os }}
path: |
bin/release/YGOPro.exe
build-linux:
strategy:
fail-fast: false
matrix:
os:
# - ubuntu-20.04
- ubuntu-22.04
- ubuntu-24.04
include:
# - os: ubuntu-20.04
# premake_version: 5.0.0-beta2
- os: ubuntu-22.04
premake_version: 5.0.0-beta4
- os: ubuntu-24.04
premake_version: 5.0.0-beta5
runs-on: ${{ matrix.os }}
steps:
- name: Checkout repository with submodules
uses: actions/checkout@v4
with:
fetch-depth: 1
submodules: true
- name: Update submodules
run: |
cd ocgcore
git checkout master
git pull origin master
cd ..
# cd script
# git checkout master
# git pull origin master
# cd ..
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y libevent-dev libfreetype6-dev libgl1-mesa-dev libglu1-mesa-dev libsqlite3-dev libxxf86vm-dev
- name: Download premake
id: premake
uses: mercury233/action-cache-download-file@v1.0.0
with:
url: https://github.com/premake/premake-core/releases/download/v${{ matrix.premake_version }}/premake-${{ matrix.premake_version }}-linux.tar.gz
filename: premake5.tar.gz
- name: Extract premake
run: |
tar xf ${{ steps.premake.outputs.filepath }}
chmod +x ./premake5
- name: Download lua
id: lua
uses: mercury233/action-cache-download-file@v1.0.0
with:
url: https://www.lua.org/ftp/lua-5.4.7.tar.gz
- name: Extract lua
run: |
tar xf ${{ steps.lua.outputs.filepath }}
mv lua-5.4.7 lua
- name: Download irrlicht
run: |
git clone --depth=1 https://github.com/mercury233/irrlicht
- name: Copy premake files
run: |
cp -r premake/* .
- name: Use premake to generate make files
run: |
./premake5 gmake \
--no-use-irrklang \
--freetype-include-dir="/usr/include/freetype2"
- name: Make
run: |
cd build
make -j 4 config=release
cd ..
- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: YGOPro-${{ matrix.os }}
path: |
bin/release/YGOPro
build-macos:
strategy:
fail-fast: false
matrix:
os:
- macos-13
- macos-15
include:
- os: macos-13
premake_version: 5.0.0-beta5
- os: macos-15
premake_version: 5.0.0-beta5
runs-on: ${{ matrix.os }}
steps:
- name: Checkout repository with submodules
uses: actions/checkout@v4
with:
fetch-depth: 1
submodules: true
- name: Update submodules
run: |
cd ocgcore
git checkout master
git pull origin master
cd ..
# cd script
# git checkout master
# git pull origin master
# cd ..
# - name: Install dependencies
# run: |
# brew install freetype libevent libx11 sqlite zlib
- name: Download premake
id: premake
uses: mercury233/action-cache-download-file@v1.0.0
with:
url: https://github.com/premake/premake-core/releases/download/v${{ matrix.premake_version }}/premake-${{ matrix.premake_version }}-macosx.tar.gz
filename: premake5.tar.gz
- name: Extract premake
run: |
tar xf ${{ steps.premake.outputs.filepath }}
chmod +x ./premake5
- name: Download lua
id: lua
uses: mercury233/action-cache-download-file@v1.0.0
with:
url: https://www.lua.org/ftp/lua-5.4.7.tar.gz
- name: Extract lua
run: |
tar xf ${{ steps.lua.outputs.filepath }}
mv lua-5.4.7 lua
- name: Download irrlicht
run: |
git clone --depth=1 https://github.com/mercury233/irrlicht
- name: Build irrlicht
run: |
cd irrlicht/source/Irrlicht/MacOSX
xcodebuild -project MacOSX.xcodeproj
cd ../../../..
- name: Copy premake files
run: |
cp -r premake/* .
- name: Use premake to generate make files (Intel)
if: runner.arch == 'X64'
run: |
./premake5 gmake \
--cc=clang \
--no-use-irrklang \
--freetype-include-dir="/usr/local/include/freetype2" \
--irrlicht-include-dir="../irrlicht/include" \
--irrlicht-lib-dir="../irrlicht/source/Irrlicht/MacOSX/build/Release"
- name: Use premake to generate make files (ARM64)
if: runner.arch == 'ARM64'
run: |
./premake5 gmake \
--cc=clang \
--no-use-irrklang \
--event-include-dir="/opt/homebrew/include" \
--event-lib-dir="/opt/homebrew/lib" \
--freetype-include-dir="/opt/homebrew/include/freetype2" \
--freetype-lib-dir="/opt/homebrew/lib" \
--sqlite-include-dir="/opt/homebrew/opt/sqlite/include" \
--sqlite-lib-dir="/opt/homebrew/opt/sqlite/lib" \
--irrlicht-include-dir="../irrlicht/include" \
--irrlicht-lib-dir="../irrlicht/source/Irrlicht/MacOSX/build/Release"
- name: Make
run: |
cd build
make -j 3 config=release
cd ..
- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: YGOPro-${{ matrix.os }}
path: |
bin/*
...@@ -313,8 +313,8 @@ void CGUIImageButton::draw() { ...@@ -313,8 +313,8 @@ void CGUIImageButton::draw() {
return; return;
IGUISkin* skin = Environment->getSkin(); IGUISkin* skin = Environment->getSkin();
video::IVideoDriver* driver = Environment->getVideoDriver(); video::IVideoDriver* driver = Environment->getVideoDriver();
core::vector2di center = AbsoluteRect.getCenter(); irr::core::vector2di center = AbsoluteRect.getCenter();
core::vector2di pos = center; irr::core::vector2di pos = center;
pos.X -= (s32)(ImageRect.getWidth() * imageScale.X * 0.5f); pos.X -= (s32)(ImageRect.getWidth() * imageScale.X * 0.5f);
pos.Y -= (s32)(ImageRect.getHeight() * imageScale.Y * 0.5f); pos.Y -= (s32)(ImageRect.getHeight() * imageScale.Y * 0.5f);
if(Pressed) { if(Pressed) {
......
...@@ -561,7 +561,7 @@ void CGUITTFont::drawUstring(const core::ustring& utext, const core::rect<s32>&p ...@@ -561,7 +561,7 @@ void CGUITTFont::drawUstring(const core::ustring& utext, const core::rect<s32>&p
// Determine rendering information. // Determine rendering information.
SGUITTGlyph& glyph = Glyphs[n - 1]; SGUITTGlyph& glyph = Glyphs[n - 1];
CGUITTGlyphPage* const page = Glyph_Pages[glyph.glyph_page]; CGUITTGlyphPage* const page = Glyph_Pages[glyph.glyph_page];
page->render_positions.push_back(core::vector2di(offset.X + offx, offset.Y + offy)); page->render_positions.push_back(irr::core::vector2di(offset.X + offx, offset.Y + offy));
page->render_source_rects.push_back(glyph.source_rect); page->render_source_rects.push_back(glyph.source_rect);
Render_Map.set(glyph.glyph_page, page); Render_Map.set(glyph.glyph_page, page);
} }
...@@ -832,7 +832,7 @@ video::IImage* CGUITTFont::createTextureFromChar(const uchar32_t& ch) { ...@@ -832,7 +832,7 @@ video::IImage* CGUITTFont::createTextureFromChar(const uchar32_t& ch) {
// Copy the image data out of the page texture. // Copy the image data out of the page texture.
core::dimension2du glyph_size(glyph.source_rect.getSize()); core::dimension2du glyph_size(glyph.source_rect.getSize());
video::IImage* image = Driver->createImage(format, glyph_size); video::IImage* image = Driver->createImage(format, glyph_size);
pageholder->copyTo(image, core::vector2di(0, 0), glyph.source_rect); pageholder->copyTo(image, irr::core::vector2di(0, 0), glyph.source_rect);
tex->unlock(); tex->unlock();
return image; return image;
...@@ -854,17 +854,14 @@ void CGUITTFont::createSharedPlane() { ...@@ -854,17 +854,14 @@ void CGUITTFont::createSharedPlane() {
0---1 0---1
*/ */
using namespace core; video::S3DVertex vertices[4];
using namespace video;
using namespace scene;
S3DVertex vertices[4];
u16 indices[6] = {0, 2, 3, 3, 1, 0}; u16 indices[6] = {0, 2, 3, 3, 1, 0};
vertices[0] = S3DVertex(vector3df(0, -1, 0), vector3df(0, 0, -1), SColor(255, 255, 255, 255), vector2df(0, 1)); vertices[0] = video::S3DVertex(core::vector3df(0, -1, 0), core::vector3df(0, 0, -1), video::SColor(255, 255, 255, 255), core::vector2df(0, 1));
vertices[1] = S3DVertex(vector3df(1, -1, 0), vector3df(0, 0, -1), SColor(255, 255, 255, 255), vector2df(1, 1)); vertices[1] = video::S3DVertex(core::vector3df(1, -1, 0), core::vector3df(0, 0, -1), video::SColor(255, 255, 255, 255), core::vector2df(1, 1));
vertices[2] = S3DVertex(vector3df(0, 0, 0), vector3df(0, 0, -1), SColor(255, 255, 255, 255), vector2df(0, 0)); vertices[2] = video::S3DVertex(core::vector3df(0, 0, 0), core::vector3df(0, 0, -1), video::SColor(255, 255, 255, 255), core::vector2df(0, 0));
vertices[3] = S3DVertex(vector3df(1, 0, 0), vector3df(0, 0, -1), SColor(255, 255, 255, 255), vector2df(1, 0)); vertices[3] = video::S3DVertex(core::vector3df(1, 0, 0), core::vector3df(0, 0, -1), video::SColor(255, 255, 255, 255), core::vector2df(1, 0));
SMeshBuffer* buf = new SMeshBuffer(); scene::SMeshBuffer* buf = new scene::SMeshBuffer();
buf->append(vertices, 4, indices, 6); buf->append(vertices, 4, indices, 6);
shared_plane_.addMeshBuffer( buf ); shared_plane_.addMeshBuffer( buf );
...@@ -882,11 +879,7 @@ core::dimension2d<u32> CGUITTFont::getDimensionUntilEndOfLine(const wchar_t* p) ...@@ -882,11 +879,7 @@ core::dimension2d<u32> CGUITTFont::getDimensionUntilEndOfLine(const wchar_t* p)
} }
core::array<scene::ISceneNode*> CGUITTFont::addTextSceneNode(const wchar_t* text, scene::ISceneManager* smgr, scene::ISceneNode* parent, const video::SColor& color, bool center) { core::array<scene::ISceneNode*> CGUITTFont::addTextSceneNode(const wchar_t* text, scene::ISceneManager* smgr, scene::ISceneNode* parent, const video::SColor& color, bool center) {
using namespace core; core::array<scene::ISceneNode*> container;
using namespace video;
using namespace scene;
array<scene::ISceneNode*> container;
if (!Driver || !smgr) return container; if (!Driver || !smgr) return container;
if (!parent) if (!parent)
...@@ -897,8 +890,8 @@ core::array<scene::ISceneNode*> CGUITTFont::addTextSceneNode(const wchar_t* text ...@@ -897,8 +890,8 @@ core::array<scene::ISceneNode*> CGUITTFont::addTextSceneNode(const wchar_t* text
if (!shared_plane_ptr_) //this points to a static mesh that contains the plane if (!shared_plane_ptr_) //this points to a static mesh that contains the plane
createSharedPlane(); //if it's not initialized, we create one. createSharedPlane(); //if it's not initialized, we create one.
dimension2d<s32> text_size(getDimension(text)); //convert from unsigned to signed. core::dimension2d<s32> text_size(getDimension(text)); //convert from unsigned to signed.
vector3df start_point(0, 0, 0), offset; core::vector3df start_point(0, 0, 0), offset;
/** NOTICE: /** NOTICE:
Because we are considering adding texts into 3D world, all Y axis vectors are inverted. Because we are considering adding texts into 3D world, all Y axis vectors are inverted.
...@@ -912,7 +905,7 @@ core::array<scene::ISceneNode*> CGUITTFont::addTextSceneNode(const wchar_t* text ...@@ -912,7 +905,7 @@ core::array<scene::ISceneNode*> CGUITTFont::addTextSceneNode(const wchar_t* text
} }
// the default font material // the default font material
SMaterial mat; video::SMaterial mat;
mat.setFlag(video::EMF_LIGHTING, true); mat.setFlag(video::EMF_LIGHTING, true);
mat.setFlag(video::EMF_ZWRITE_ENABLE, false); mat.setFlag(video::EMF_ZWRITE_ENABLE, false);
mat.setFlag(video::EMF_NORMALIZE_NORMALS, true); mat.setFlag(video::EMF_NORMALIZE_NORMALS, true);
...@@ -924,7 +917,7 @@ core::array<scene::ISceneNode*> CGUITTFont::addTextSceneNode(const wchar_t* text ...@@ -924,7 +917,7 @@ core::array<scene::ISceneNode*> CGUITTFont::addTextSceneNode(const wchar_t* text
wchar_t current_char = 0, previous_char = 0; wchar_t current_char = 0, previous_char = 0;
u32 n = 0; u32 n = 0;
array<u32> glyph_indices; core::array<u32> glyph_indices;
while (*text) { while (*text) {
current_char = *text; current_char = *text;
...@@ -957,23 +950,23 @@ core::array<scene::ISceneNode*> CGUITTFont::addTextSceneNode(const wchar_t* text ...@@ -957,23 +950,23 @@ core::array<scene::ISceneNode*> CGUITTFont::addTextSceneNode(const wchar_t* text
s32 offy = (font_metrics.ascender / 64) - glyph.offset.Y; s32 offy = (font_metrics.ascender / 64) - glyph.offset.Y;
// Apply kerning. // Apply kerning.
vector2di k = getKerning(current_char, previous_char); core::vector2di k = getKerning(current_char, previous_char);
offset.X += k.X; offset.X += k.X;
offset.Y += k.Y; offset.Y += k.Y;
vector3df current_pos(offset.X + offx, offset.Y - offy, 0); core::vector3df current_pos(offset.X + offx, offset.Y - offy, 0);
dimension2d<u32> letter_size = dimension2d<u32>(texw, texh); core::dimension2d<u32> letter_size = core::dimension2d<u32>(texw, texh);
// Now we copy planes corresponding to the letter size. // Now we copy planes corresponding to the letter size.
IMeshManipulator* mani = smgr->getMeshManipulator(); scene::IMeshManipulator* mani = smgr->getMeshManipulator();
IMesh* meshcopy = mani->createMeshCopy(shared_plane_ptr_); scene::IMesh* meshcopy = mani->createMeshCopy(shared_plane_ptr_);
mani->scale(meshcopy, vector3df((f32)letter_size.Width, (f32)letter_size.Height, 1)); mani->scale(meshcopy, core::vector3df((f32)letter_size.Width, (f32)letter_size.Height, 1));
ISceneNode* current_node = smgr->addMeshSceneNode(meshcopy, parent, -1, current_pos); scene::ISceneNode* current_node = smgr->addMeshSceneNode(meshcopy, parent, -1, current_pos);
meshcopy->drop(); meshcopy->drop();
current_node->getMaterial(0) = mat; current_node->getMaterial(0) = mat;
current_node->setAutomaticCulling(EAC_OFF); current_node->setAutomaticCulling(scene::EAC_OFF);
current_node->setIsDebugObject(true); //so the picking won't have any effect on individual letter current_node->setIsDebugObject(true); //so the picking won't have any effect on individual letter
//current_node->setDebugDataVisible(EDS_BBOX); //de-comment this when debugging //current_node->setDebugDataVisible(EDS_BBOX); //de-comment this when debugging
...@@ -991,7 +984,7 @@ core::array<scene::ISceneNode*> CGUITTFont::addTextSceneNode(const wchar_t* text ...@@ -991,7 +984,7 @@ core::array<scene::ISceneNode*> CGUITTFont::addTextSceneNode(const wchar_t* text
for (u32 i = 0; i < glyph_indices.size(); ++i) { for (u32 i = 0; i < glyph_indices.size(); ++i) {
u32 n = glyph_indices[i]; u32 n = glyph_indices[i];
SGUITTGlyph const& glyph = Glyphs[n - 1]; SGUITTGlyph const& glyph = Glyphs[n - 1];
ITexture* current_tex = Glyph_Pages[glyph.glyph_page]->texture; video::ITexture* current_tex = Glyph_Pages[glyph.glyph_page]->texture;
f32 page_texture_size = (f32)current_tex->getSize().Width; f32 page_texture_size = (f32)current_tex->getSize().Width;
//Now we calculate the UV position according to the texture size and the source rect. //Now we calculate the UV position according to the texture size and the source rect.
// //
...@@ -1007,15 +1000,15 @@ core::array<scene::ISceneNode*> CGUITTFont::addTextSceneNode(const wchar_t* text ...@@ -1007,15 +1000,15 @@ core::array<scene::ISceneNode*> CGUITTFont::addTextSceneNode(const wchar_t* text
f32 v2 = v1 + (glyph.source_rect.getHeight() / page_texture_size); f32 v2 = v1 + (glyph.source_rect.getHeight() / page_texture_size);
//we can be quite sure that this is IMeshSceneNode, because we just added them in the above loop. //we can be quite sure that this is IMeshSceneNode, because we just added them in the above loop.
IMeshSceneNode* node = static_cast<IMeshSceneNode*>(container[i]); scene::IMeshSceneNode* node = static_cast<scene::IMeshSceneNode*>(container[i]);
S3DVertex* pv = static_cast<S3DVertex*>(node->getMesh()->getMeshBuffer(0)->getVertices()); video::S3DVertex* pv = static_cast<video::S3DVertex*>(node->getMesh()->getMeshBuffer(0)->getVertices());
//pv[0].TCoords.Y = pv[1].TCoords.Y = (letter_size.Height - 1) / static_cast<f32>(letter_size.Height); //pv[0].TCoords.Y = pv[1].TCoords.Y = (letter_size.Height - 1) / static_cast<f32>(letter_size.Height);
//pv[1].TCoords.X = pv[3].TCoords.X = (letter_size.Width - 1) / static_cast<f32>(letter_size.Width); //pv[1].TCoords.X = pv[3].TCoords.X = (letter_size.Width - 1) / static_cast<f32>(letter_size.Width);
pv[0].TCoords = vector2df(u1, v2); pv[0].TCoords = core::vector2df(u1, v2);
pv[1].TCoords = vector2df(u2, v2); pv[1].TCoords = core::vector2df(u2, v2);
pv[2].TCoords = vector2df(u1, v1); pv[2].TCoords = core::vector2df(u1, v1);
pv[3].TCoords = vector2df(u2, v1); pv[3].TCoords = core::vector2df(u2, v1);
container[i]->getMaterial(0).setTexture(0, current_tex); container[i]->getMaterial(0).setTexture(0, current_tex);
} }
......
...@@ -56,7 +56,7 @@ void ClientCard::UpdateInfo(unsigned char* buf) { ...@@ -56,7 +56,7 @@ void ClientCard::UpdateInfo(unsigned char* buf) {
} }
if(flag & QUERY_POSITION) { if(flag & QUERY_POSITION) {
int pdata = (BufferIO::ReadInt32(buf) >> 24) & 0xff; int pdata = (BufferIO::ReadInt32(buf) >> 24) & 0xff;
if((location & (LOCATION_EXTRA | LOCATION_REMOVED)) && (u8)pdata != position) { if((location & (LOCATION_EXTRA | LOCATION_REMOVED)) && pdata != position) {
position = pdata; position = pdata;
mainGame->dField.MoveCard(this, 1); mainGame->dField.MoveCard(this, 1);
} else } else
......
...@@ -15,9 +15,9 @@ public: ...@@ -15,9 +15,9 @@ public:
irr::core::vector3df curRot; irr::core::vector3df curRot;
irr::core::vector3df dPos; irr::core::vector3df dPos;
irr::core::vector3df dRot; irr::core::vector3df dRot;
u32 curAlpha{ 255 }; irr::u32 curAlpha{ 255 };
u32 dAlpha{ 0 }; irr::u32 dAlpha{ 0 };
u32 aniFrame{ 0 }; irr::u32 aniFrame{ 0 };
bool is_moving{ false }; bool is_moving{ false };
bool is_fading{ false }; bool is_fading{ false };
bool is_hovered{ false }; bool is_hovered{ false };
......
...@@ -440,7 +440,7 @@ void ClientField::ShowSelectCard(bool buttonok, bool chain) { ...@@ -440,7 +440,7 @@ void ClientField::ShowSelectCard(bool buttonok, bool chain) {
mainGame->imageLoading.insert(std::make_pair(mainGame->btnCardSelect[i], selectable_cards[i]->chain_code)); mainGame->imageLoading.insert(std::make_pair(mainGame->btnCardSelect[i], selectable_cards[i]->chain_code));
else else
mainGame->btnCardSelect[i]->setImage(imageManager.tCover[selectable_cards[i]->controler + 2]); mainGame->btnCardSelect[i]->setImage(imageManager.tCover[selectable_cards[i]->controler + 2]);
mainGame->btnCardSelect[i]->setRelativePosition(rect<s32>(startpos + i * 125, 55, startpos + 120 + i * 125, 225)); mainGame->btnCardSelect[i]->setRelativePosition(irr::core::rect<irr::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);
if(mainGame->dInfo.curMsg != MSG_SORT_CARD) { if(mainGame->dInfo.curMsg != MSG_SORT_CARD) {
...@@ -497,7 +497,7 @@ void ClientField::ShowSelectCard(bool buttonok, bool chain) { ...@@ -497,7 +497,7 @@ void ClientField::ShowSelectCard(bool buttonok, bool chain) {
mainGame->stCardPos[i]->setBackgroundColor(0xffffffff); mainGame->stCardPos[i]->setBackgroundColor(0xffffffff);
} }
mainGame->stCardPos[i]->setVisible(true); mainGame->stCardPos[i]->setVisible(true);
mainGame->stCardPos[i]->setRelativePosition(rect<s32>(startpos + i * 125, 30, startpos + 120 + i * 125, 50)); mainGame->stCardPos[i]->setRelativePosition(irr::core::rect<irr::s32>(startpos + i * 125, 30, startpos + 120 + i * 125, 50));
} }
if(selectable_cards.size() <= 5) { if(selectable_cards.size() <= 5) {
for(int i = selectable_cards.size(); i < 5; ++i) { for(int i = selectable_cards.size(); i < 5; ++i) {
...@@ -530,7 +530,7 @@ void ClientField::ShowChainCard() { ...@@ -530,7 +530,7 @@ void ClientField::ShowChainCard() {
mainGame->imageLoading.insert(std::make_pair(mainGame->btnCardSelect[i], selectable_cards[i]->code)); mainGame->imageLoading.insert(std::make_pair(mainGame->btnCardSelect[i], selectable_cards[i]->code));
else else
mainGame->btnCardSelect[i]->setImage(imageManager.tCover[selectable_cards[i]->controler + 2]); mainGame->btnCardSelect[i]->setImage(imageManager.tCover[selectable_cards[i]->controler + 2]);
mainGame->btnCardSelect[i]->setRelativePosition(rect<s32>(startpos + i * 125, 55, startpos + 120 + i * 125, 225)); mainGame->btnCardSelect[i]->setRelativePosition(irr::core::rect<irr::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]; wchar_t formatBuffer[2048];
...@@ -549,7 +549,7 @@ void ClientField::ShowChainCard() { ...@@ -549,7 +549,7 @@ void ClientField::ShowChainCard() {
else mainGame->stCardPos[i]->setBackgroundColor(0xffffffff); else mainGame->stCardPos[i]->setBackgroundColor(0xffffffff);
} }
mainGame->stCardPos[i]->setVisible(true); mainGame->stCardPos[i]->setVisible(true);
mainGame->stCardPos[i]->setRelativePosition(rect<s32>(startpos + i * 125, 30, startpos + 120 + i * 125, 50)); mainGame->stCardPos[i]->setRelativePosition(irr::core::rect<irr::s32>(startpos + i * 125, 30, startpos + 120 + i * 125, 50));
} }
if(selectable_cards.size() <= 5) { if(selectable_cards.size() <= 5) {
for(int i = selectable_cards.size(); i < 5; ++i) { for(int i = selectable_cards.size(); i < 5; ++i) {
...@@ -585,7 +585,7 @@ void ClientField::ShowLocationCard() { ...@@ -585,7 +585,7 @@ void ClientField::ShowLocationCard() {
mainGame->imageLoading.insert(std::make_pair(mainGame->btnCardDisplay[i], display_cards[i]->code)); mainGame->imageLoading.insert(std::make_pair(mainGame->btnCardDisplay[i], display_cards[i]->code));
else else
mainGame->btnCardDisplay[i]->setImage(imageManager.tCover[display_cards[i]->controler + 2]); mainGame->btnCardDisplay[i]->setImage(imageManager.tCover[display_cards[i]->controler + 2]);
mainGame->btnCardDisplay[i]->setRelativePosition(rect<s32>(startpos + i * 125, 55, startpos + 120 + i * 125, 225)); mainGame->btnCardDisplay[i]->setRelativePosition(irr::core::rect<irr::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]; wchar_t formatBuffer[2048];
...@@ -618,7 +618,7 @@ void ClientField::ShowLocationCard() { ...@@ -618,7 +618,7 @@ void ClientField::ShowLocationCard() {
mainGame->stDisplayPos[i]->setBackgroundColor(0xffffffff); mainGame->stDisplayPos[i]->setBackgroundColor(0xffffffff);
} }
mainGame->stDisplayPos[i]->setVisible(true); mainGame->stDisplayPos[i]->setVisible(true);
mainGame->stDisplayPos[i]->setRelativePosition(rect<s32>(startpos + i * 125, 30, startpos + 120 + i * 125, 50)); mainGame->stDisplayPos[i]->setRelativePosition(irr::core::rect<irr::s32>(startpos + i * 125, 30, startpos + 120 + i * 125, 50));
} }
if(display_cards.size() <= 5) { if(display_cards.size() <= 5) {
for(int i = display_cards.size(); i < 5; ++i) { for(int i = display_cards.size(); i < 5; ++i) {
...@@ -663,7 +663,7 @@ void ClientField::ShowSelectOption(int select_hint) { ...@@ -663,7 +663,7 @@ void ClientField::ShowSelectOption(int select_hint) {
mainGame->btnOptionOK->setVisible(false); mainGame->btnOptionOK->setVisible(false);
for(int i = 0; i < 5; i++) for(int i = 0; i < 5; i++)
mainGame->btnOption[i]->setVisible(i < count); mainGame->btnOption[i]->setVisible(i < count);
recti pos = mainGame->wOptions->getRelativePosition(); irr::core::recti pos = mainGame->wOptions->getRelativePosition();
int newheight = 30 + 40 * (scrollbar ? 5 : count); int newheight = 30 + 40 * (scrollbar ? 5 : count);
int oldheight = pos.LowerRightCorner.Y - pos.UpperLeftCorner.Y; int oldheight = pos.LowerRightCorner.Y - pos.UpperLeftCorner.Y;
pos.UpperLeftCorner.Y = pos.UpperLeftCorner.Y + (oldheight - newheight) / 2; pos.UpperLeftCorner.Y = pos.UpperLeftCorner.Y + (oldheight - newheight) / 2;
...@@ -678,7 +678,7 @@ void ClientField::ShowSelectOption(int select_hint) { ...@@ -678,7 +678,7 @@ void ClientField::ShowSelectOption(int select_hint) {
mainGame->btnOptionOK->setVisible(true); mainGame->btnOptionOK->setVisible(true);
for(int i = 0; i < 5; i++) for(int i = 0; i < 5; i++)
mainGame->btnOption[i]->setVisible(false); mainGame->btnOption[i]->setVisible(false);
recti pos = mainGame->wOptions->getRelativePosition(); irr::core::recti pos = mainGame->wOptions->getRelativePosition();
pos.LowerRightCorner.Y = pos.UpperLeftCorner.Y + 140; pos.LowerRightCorner.Y = pos.UpperLeftCorner.Y + 140;
mainGame->wOptions->setRelativePosition(pos); mainGame->wOptions->setRelativePosition(pos);
} }
......
...@@ -53,7 +53,7 @@ inline int _wtoi(const wchar_t * str){ ...@@ -53,7 +53,7 @@ inline int _wtoi(const wchar_t * str){
#endif #endif
#include <cstdio> #include <cstdio>
#include <stdlib.h> #include <cstdlib>
#include <iostream> #include <iostream>
#include <algorithm> #include <algorithm>
#include <string> #include <string>
...@@ -80,12 +80,6 @@ inline FILE* mywfopen(const wchar_t* filename, const char* mode) { ...@@ -80,12 +80,6 @@ inline FILE* mywfopen(const wchar_t* filename, const char* mode) {
} }
#include <irrlicht.h> #include <irrlicht.h>
using namespace irr;
using namespace core;
using namespace scene;
using namespace video;
using namespace io;
using namespace gui;
extern unsigned short PRO_VERSION; extern unsigned short PRO_VERSION;
extern unsigned int enable_log; extern unsigned int enable_log;
......
...@@ -13,23 +13,21 @@ DataManager::DataManager() : _datas(32768), _strings(32768) { ...@@ -13,23 +13,21 @@ DataManager::DataManager() : _datas(32768), _strings(32768) {
extra_setcode = { {8512558u, {0x8f, 0x54, 0x59, 0x82, 0x13a}}, }; extra_setcode = { {8512558u, {0x8f, 0x54, 0x59, 0x82, 0x13a}}, };
} }
bool DataManager::ReadDB(sqlite3* pDB) { bool DataManager::ReadDB(sqlite3* pDB) {
sqlite3_stmt* pStmt{}; sqlite3_stmt* pStmt = nullptr;
const char* sql = "select * from datas,texts where datas.id=texts.id"; const char* sql = "select * from datas,texts where datas.id=texts.id";
if (sqlite3_prepare_v2(pDB, sql, -1, &pStmt, 0) != SQLITE_OK) if (sqlite3_prepare_v2(pDB, sql, -1, &pStmt, 0) != SQLITE_OK)
return Error(pDB); return Error(pDB, pStmt);
wchar_t strBuffer[4096]; wchar_t strBuffer[4096];
int step = 0; int step = 0;
do { do {
CardDataC cd; CardDataC cd;
CardString cs; CardString cs;
step = sqlite3_step(pStmt); step = sqlite3_step(pStmt);
if (step == SQLITE_BUSY || step == SQLITE_ERROR || step == SQLITE_MISUSE) if (step == SQLITE_ROW) {
return Error(pDB, pStmt);
else if (step == SQLITE_ROW) {
cd.code = sqlite3_column_int(pStmt, 0); cd.code = sqlite3_column_int(pStmt, 0);
cd.ot = sqlite3_column_int(pStmt, 1); cd.ot = sqlite3_column_int(pStmt, 1);
cd.alias = sqlite3_column_int(pStmt, 2); cd.alias = sqlite3_column_int(pStmt, 2);
auto setcode = sqlite3_column_int64(pStmt, 3); uint64_t setcode = static_cast<uint64_t>(sqlite3_column_int64(pStmt, 3));
if (setcode) { if (setcode) {
auto it = extra_setcode.find(cd.code); auto it = extra_setcode.find(cd.code);
if (it != extra_setcode.end()) { if (it != extra_setcode.end()) {
...@@ -42,7 +40,7 @@ bool DataManager::ReadDB(sqlite3* pDB) { ...@@ -42,7 +40,7 @@ bool DataManager::ReadDB(sqlite3* pDB) {
else else
cd.set_setcode(setcode); cd.set_setcode(setcode);
} }
cd.type = sqlite3_column_int(pStmt, 4); cd.type = static_cast<decltype(cd.type)>(sqlite3_column_int64(pStmt, 4));
cd.attack = sqlite3_column_int(pStmt, 5); cd.attack = sqlite3_column_int(pStmt, 5);
cd.defense = sqlite3_column_int(pStmt, 6); cd.defense = sqlite3_column_int(pStmt, 6);
if (cd.type & TYPE_LINK) { if (cd.type & TYPE_LINK) {
...@@ -51,13 +49,13 @@ bool DataManager::ReadDB(sqlite3* pDB) { ...@@ -51,13 +49,13 @@ bool DataManager::ReadDB(sqlite3* pDB) {
} }
else else
cd.link_marker = 0; cd.link_marker = 0;
unsigned int level = sqlite3_column_int(pStmt, 7); uint32_t level = static_cast<uint32_t>(sqlite3_column_int(pStmt, 7));
cd.level = level & 0xff; cd.level = level & 0xff;
cd.lscale = (level >> 24) & 0xff; cd.lscale = (level >> 24) & 0xff;
cd.rscale = (level >> 16) & 0xff; cd.rscale = (level >> 16) & 0xff;
cd.race = sqlite3_column_int(pStmt, 8); cd.race = static_cast<decltype(cd.race)>(sqlite3_column_int64(pStmt, 8));
cd.attribute = sqlite3_column_int(pStmt, 9); cd.attribute = static_cast<decltype(cd.attribute)>(sqlite3_column_int64(pStmt, 9));
cd.category = sqlite3_column_int(pStmt, 10); cd.category = static_cast<decltype(cd.category)>(sqlite3_column_int64(pStmt, 10));
_datas[cd.code] = cd; _datas[cd.code] = cd;
if (const char* text = (const char*)sqlite3_column_text(pStmt, 12)) { if (const char* text = (const char*)sqlite3_column_text(pStmt, 12)) {
BufferIO::DecodeUTF8(text, strBuffer); BufferIO::DecodeUTF8(text, strBuffer);
...@@ -76,7 +74,9 @@ bool DataManager::ReadDB(sqlite3* pDB) { ...@@ -76,7 +74,9 @@ bool DataManager::ReadDB(sqlite3* pDB) {
} }
_strings[cd.code] = cs; _strings[cd.code] = cs;
} }
} while (step != SQLITE_DONE); else if (step != SQLITE_DONE)
return Error(pDB, pStmt);
} while (step == SQLITE_ROW);
sqlite3_finalize(pStmt); sqlite3_finalize(pStmt);
return true; return true;
} }
...@@ -84,17 +84,17 @@ bool DataManager::LoadDB(const wchar_t* wfile) { ...@@ -84,17 +84,17 @@ bool DataManager::LoadDB(const wchar_t* wfile) {
char file[256]; char file[256];
BufferIO::EncodeUTF8(wfile, file); BufferIO::EncodeUTF8(wfile, file);
#ifdef _WIN32 #ifdef _WIN32
IReadFile* reader = FileSystem->createAndOpenFile(wfile); auto reader = FileSystem->createAndOpenFile(wfile);
#else #else
IReadFile* reader = FileSystem->createAndOpenFile(file); auto reader = FileSystem->createAndOpenFile(file);
#endif #endif
if(reader == nullptr) if(reader == nullptr)
return false; return false;
spmemvfs_db_t db; spmemvfs_db_t db;
spmembuffer_t* mem = (spmembuffer_t*)calloc(sizeof(spmembuffer_t), 1); spmembuffer_t* mem = (spmembuffer_t*)std::calloc(sizeof(spmembuffer_t), 1);
spmemvfs_env_init(); spmemvfs_env_init();
mem->total = mem->used = reader->getSize(); mem->total = mem->used = reader->getSize();
mem->data = (char*)malloc(mem->total + 1); mem->data = (char*)std::malloc(mem->total + 1);
reader->read(mem->data, mem->total); reader->read(mem->data, mem->total);
reader->drop(); reader->drop();
(mem->data)[mem->total] = '\0'; (mem->data)[mem->total] = '\0';
...@@ -423,9 +423,9 @@ unsigned char* DataManager::ReadScriptFromIrrFS(const char* script_name, int* sl ...@@ -423,9 +423,9 @@ unsigned char* DataManager::ReadScriptFromIrrFS(const char* script_name, int* sl
#ifdef _WIN32 #ifdef _WIN32
wchar_t fname[256]{}; wchar_t fname[256]{};
BufferIO::DecodeUTF8(script_name, fname); BufferIO::DecodeUTF8(script_name, fname);
IReadFile* reader = FileSystem->createAndOpenFile(fname); auto reader = FileSystem->createAndOpenFile(fname);
#else #else
IReadFile* reader = FileSystem->createAndOpenFile(script_name); auto reader = FileSystem->createAndOpenFile(script_name);
#endif #endif
if (!reader) if (!reader)
return nullptr; return nullptr;
......
...@@ -69,7 +69,18 @@ void DeckBuilder::Initialize() { ...@@ -69,7 +69,18 @@ void DeckBuilder::Initialize() {
mainGame->btnSideShuffle->setVisible(false); mainGame->btnSideShuffle->setVisible(false);
mainGame->btnSideSort->setVisible(false); mainGame->btnSideSort->setVisible(false);
mainGame->btnSideReload->setVisible(false); mainGame->btnSideReload->setVisible(false);
filterList = &deckManager._lfList[mainGame->gameConf.use_lflist ? mainGame->gameConf.default_lflist : deckManager._lfList.size() - 1].content; if (mainGame->gameConf.use_lflist) {
if (mainGame->gameConf.default_lflist >= 0 && mainGame->gameConf.default_lflist < (int)deckManager._lfList.size()) {
filterList = &deckManager._lfList[mainGame->gameConf.default_lflist];
}
else {
mainGame->gameConf.default_lflist = 0;
filterList = &deckManager._lfList.front();
}
}
else {
filterList = &deckManager._lfList.back();
}
ClearSearch(); ClearSearch();
rnd.reset((uint_fast32_t)std::time(nullptr)); rnd.reset((uint_fast32_t)std::time(nullptr));
mouse_pos.set(0, 0); mouse_pos.set(0, 0);
...@@ -126,7 +137,7 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) { ...@@ -126,7 +137,7 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
return false; return false;
switch(event.EventType) { switch(event.EventType) {
case irr::EET_GUI_EVENT: { case irr::EET_GUI_EVENT: {
s32 id = event.GUIEvent.Caller->getID(); irr::s32 id = event.GUIEvent.Caller->getID();
if(((mainGame->wCategories->isVisible() && id != BUTTON_CATEGORY_OK) || if(((mainGame->wCategories->isVisible() && id != BUTTON_CATEGORY_OK) ||
(mainGame->wQuery->isVisible() && id != BUTTON_YES && id != BUTTON_NO) || (mainGame->wQuery->isVisible() && id != BUTTON_YES && id != BUTTON_NO) ||
(mainGame->wLinkMarks->isVisible() && id != BUTTON_MARKERS_OK) || (mainGame->wLinkMarks->isVisible() && id != BUTTON_MARKERS_OK) ||
...@@ -1523,7 +1534,7 @@ void DeckBuilder::FilterCards() { ...@@ -1523,7 +1534,7 @@ void DeckBuilder::FilterCards() {
if(filter_marks && (data.link_marker & filter_marks) != filter_marks) if(filter_marks && (data.link_marker & filter_marks) != filter_marks)
continue; continue;
if(filter_lm) { if(filter_lm) {
if(filter_lm <= 3 && (!filterList->count(ptr->first) || (*filterList).at(ptr->first) != filter_lm - 1)) if(filter_lm <= 3 && (!filterList->content.count(ptr->first) || filterList->content.at(ptr->first) != filter_lm - 1))
continue; continue;
if(filter_lm == 4 && !(data.ot & AVAIL_OCG)) if(filter_lm == 4 && !(data.ot & AVAIL_OCG))
continue; continue;
...@@ -1713,13 +1724,13 @@ void DeckBuilder::ShowDeckManage() { ...@@ -1713,13 +1724,13 @@ void DeckBuilder::ShowDeckManage() {
void DeckBuilder::ShowBigCard(int code, float zoom) { void DeckBuilder::ShowBigCard(int code, float zoom) {
bigcard_code = code; bigcard_code = code;
bigcard_zoom = zoom; bigcard_zoom = zoom;
ITexture* img = imageManager.GetBigPicture(code, zoom); auto img = imageManager.GetBigPicture(code, zoom);
mainGame->imgBigCard->setImage(img); mainGame->imgBigCard->setImage(img);
auto size = img->getSize(); auto size = img->getSize();
s32 left = mainGame->window_size.Width / 2 - size.Width / 2; irr::s32 left = mainGame->window_size.Width / 2 - size.Width / 2;
s32 top = mainGame->window_size.Height / 2 - size.Height / 2; irr::s32 top = mainGame->window_size.Height / 2 - size.Height / 2;
mainGame->imgBigCard->setRelativePosition(recti(0, 0, size.Width, size.Height)); mainGame->imgBigCard->setRelativePosition(irr::core::recti(0, 0, size.Width, size.Height));
mainGame->wBigCard->setRelativePosition(recti(left, top, left + size.Width, top + size.Height)); mainGame->wBigCard->setRelativePosition(irr::core::recti(left, top, left + size.Width, top + size.Height));
mainGame->gMutex.lock(); mainGame->gMutex.lock();
mainGame->btnBigCardOriginalSize->setVisible(true); mainGame->btnBigCardOriginalSize->setVisible(true);
mainGame->btnBigCardZoomIn->setVisible(true); mainGame->btnBigCardZoomIn->setVisible(true);
...@@ -1729,12 +1740,12 @@ void DeckBuilder::ShowBigCard(int code, float zoom) { ...@@ -1729,12 +1740,12 @@ void DeckBuilder::ShowBigCard(int code, float zoom) {
mainGame->env->getRootGUIElement()->bringToFront(mainGame->wBigCard); mainGame->env->getRootGUIElement()->bringToFront(mainGame->wBigCard);
mainGame->gMutex.unlock(); mainGame->gMutex.unlock();
} }
void DeckBuilder::ZoomBigCard(s32 centerx, s32 centery) { void DeckBuilder::ZoomBigCard(irr::s32 centerx, irr::s32 centery) {
if(bigcard_zoom >= 4) if(bigcard_zoom >= 4)
bigcard_zoom = 4; bigcard_zoom = 4;
if(bigcard_zoom <= 0.2f) if(bigcard_zoom <= 0.2f)
bigcard_zoom = 0.2f; bigcard_zoom = 0.2f;
ITexture* img = imageManager.GetBigPicture(bigcard_code, bigcard_zoom); auto img = imageManager.GetBigPicture(bigcard_code, bigcard_zoom);
mainGame->imgBigCard->setImage(img); mainGame->imgBigCard->setImage(img);
auto size = img->getSize(); auto size = img->getSize();
auto pos = mainGame->wBigCard->getRelativePosition(); auto pos = mainGame->wBigCard->getRelativePosition();
...@@ -1744,10 +1755,10 @@ void DeckBuilder::ZoomBigCard(s32 centerx, s32 centery) { ...@@ -1744,10 +1755,10 @@ void DeckBuilder::ZoomBigCard(s32 centerx, s32 centery) {
} }
float posx = (float)(centerx - pos.UpperLeftCorner.X) / pos.getWidth(); float posx = (float)(centerx - pos.UpperLeftCorner.X) / pos.getWidth();
float posy = (float)(centery - pos.UpperLeftCorner.Y) / pos.getHeight(); float posy = (float)(centery - pos.UpperLeftCorner.Y) / pos.getHeight();
s32 left = centerx - size.Width * posx; irr::s32 left = centerx - size.Width * posx;
s32 top = centery - size.Height * posy; irr::s32 top = centery - size.Height * posy;
mainGame->imgBigCard->setRelativePosition(recti(0, 0, size.Width, size.Height)); mainGame->imgBigCard->setRelativePosition(irr::core::recti(0, 0, size.Width, size.Height));
mainGame->wBigCard->setRelativePosition(recti(left, top, left + size.Width, top + size.Height)); mainGame->wBigCard->setRelativePosition(irr::core::recti(left, top, left + size.Width, top + size.Height));
} }
void DeckBuilder::CloseBigCard() { void DeckBuilder::CloseBigCard() {
mainGame->HideElement(mainGame->wBigCard); mainGame->HideElement(mainGame->wBigCard);
...@@ -1868,8 +1879,8 @@ void DeckBuilder::pop_side(int seq) { ...@@ -1868,8 +1879,8 @@ void DeckBuilder::pop_side(int seq) {
bool DeckBuilder::check_limit(code_pointer pointer) { bool DeckBuilder::check_limit(code_pointer pointer) {
unsigned int limitcode = pointer->second.alias ? pointer->second.alias : pointer->first; unsigned int limitcode = pointer->second.alias ? pointer->second.alias : pointer->first;
int limit = 3; int limit = 3;
auto flit = filterList->find(limitcode); auto flit = filterList->content.find(limitcode);
if(flit != filterList->end()) if(flit != filterList->content.end())
limit = flit->second; limit = flit->second;
for(auto it = deckManager.current_deck.main.begin(); it != deckManager.current_deck.main.end(); ++it) { for(auto it = deckManager.current_deck.main.begin(); it != deckManager.current_deck.main.end(); ++it) {
if((*it)->first == limitcode || (*it)->second.alias == limitcode) if((*it)->first == limitcode || (*it)->second.alias == limitcode)
......
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
#include <vector> #include <vector>
#include <irrlicht.h> #include <irrlicht.h>
#include "data_manager.h" #include "data_manager.h"
#include "deck_manager.h"
#include "../ocgcore/mtrandom.h" #include "../ocgcore/mtrandom.h"
namespace ygo { namespace ygo {
...@@ -81,7 +82,7 @@ public: ...@@ -81,7 +82,7 @@ public:
bool showing_pack{}; bool showing_pack{};
mt19937 rnd; mt19937 rnd;
const std::unordered_map<int, int>* filterList; const LFList* filterList{};
std::vector<code_pointer> results; std::vector<code_pointer> results;
wchar_t result_string[8]{}; wchar_t result_string[8]{};
std::vector<std::wstring> expansionPacks; std::vector<std::wstring> expansionPacks;
......
...@@ -31,17 +31,14 @@ void DeckManager::LoadLFListSingle(const char* path) { ...@@ -31,17 +31,14 @@ void DeckManager::LoadLFListSingle(const char* path) {
} }
if (cur == _lfList.rend()) if (cur == _lfList.rend())
continue; continue;
int code = 0; unsigned int code = 0;
int count = -1; int count = -1;
if (std::sscanf(linebuf, "%9d%*[ ]%9d", &code, &count) != 2) if (std::sscanf(linebuf, "%9u%*[ ]%9d", &code, &count) != 2)
continue;
if (code <= 0 || code > MAX_CARD_ID)
continue; continue;
if (count < 0 || count > 2) if (count < 0 || count > 2)
continue; continue;
unsigned int hcode = code;
cur->content[code] = count; cur->content[code] = count;
cur->hash = cur->hash ^ ((hcode << 18) | (hcode >> 14)) ^ ((hcode << (27 + count)) | (hcode >> (5 - count))); cur->hash = cur->hash ^ ((code << 18) | (code >> 14)) ^ ((code << (27 + count)) | (code >> (5 - count)));
} }
std::fclose(fp); std::fclose(fp);
} }
...@@ -54,7 +51,7 @@ void DeckManager::LoadLFList() { ...@@ -54,7 +51,7 @@ void DeckManager::LoadLFList() {
nolimit.hash = 0; nolimit.hash = 0;
_lfList.push_back(nolimit); _lfList.push_back(nolimit);
} }
const wchar_t* DeckManager::GetLFListName(int lfhash) { const wchar_t* DeckManager::GetLFListName(unsigned int lfhash) {
auto lit = std::find_if(_lfList.begin(), _lfList.end(), [lfhash](const ygo::LFList& list) { auto lit = std::find_if(_lfList.begin(), _lfList.end(), [lfhash](const ygo::LFList& list) {
return list.hash == lfhash; return list.hash == lfhash;
}); });
...@@ -62,12 +59,12 @@ const wchar_t* DeckManager::GetLFListName(int lfhash) { ...@@ -62,12 +59,12 @@ const wchar_t* DeckManager::GetLFListName(int lfhash) {
return lit->listName.c_str(); return lit->listName.c_str();
return dataManager.unknown_string; return dataManager.unknown_string;
} }
const std::unordered_map<int, int>* DeckManager::GetLFListContent(int lfhash) { const LFList* DeckManager::GetLFList(unsigned int lfhash) {
auto lit = std::find_if(_lfList.begin(), _lfList.end(), [lfhash](const ygo::LFList& list) { auto lit = std::find_if(_lfList.begin(), _lfList.end(), [lfhash](const ygo::LFList& list) {
return list.hash == lfhash; return list.hash == lfhash;
}); });
if(lit != _lfList.end()) if (lit != _lfList.end())
return &lit->content; return &(*lit);
return nullptr; return nullptr;
} }
static unsigned int checkAvail(unsigned int ot, unsigned int avail) { static unsigned int checkAvail(unsigned int ot, unsigned int avail) {
...@@ -90,9 +87,10 @@ unsigned int DeckManager::CheckDeck(Deck& deck, int lfhash, int rule) { ...@@ -90,9 +87,10 @@ unsigned int DeckManager::CheckDeck(Deck& deck, int lfhash, int rule) {
return (DECKERROR_EXTRACOUNT << 28) | (unsigned)deck.extra.size(); return (DECKERROR_EXTRACOUNT << 28) | (unsigned)deck.extra.size();
if(deck.side.size() > SIDE_MAX_SIZE) if(deck.side.size() > SIDE_MAX_SIZE)
return (DECKERROR_SIDECOUNT << 28) | (unsigned)deck.side.size(); return (DECKERROR_SIDECOUNT << 28) | (unsigned)deck.side.size();
auto list = GetLFListContent(lfhash); auto lflist = GetLFList(lfhash);
if (!list) if (!lflist)
return 0; return 0;
auto& list = lflist->content;
const unsigned int rule_map[6] = { AVAIL_OCG, AVAIL_TCG, AVAIL_SC, AVAIL_CUSTOM, AVAIL_OCGTCG, 0 }; const unsigned int rule_map[6] = { AVAIL_OCG, AVAIL_TCG, AVAIL_SC, AVAIL_CUSTOM, AVAIL_OCGTCG, 0 };
unsigned int avail = 0; unsigned int avail = 0;
if (rule >= 0 && rule < (int)(sizeof rule_map / sizeof rule_map[0])) if (rule >= 0 && rule < (int)(sizeof rule_map / sizeof rule_map[0]))
...@@ -108,8 +106,8 @@ unsigned int DeckManager::CheckDeck(Deck& deck, int lfhash, int rule) { ...@@ -108,8 +106,8 @@ unsigned int DeckManager::CheckDeck(Deck& deck, int lfhash, int rule) {
int dc = ccount[code]; int dc = ccount[code];
if(dc > 3) if(dc > 3)
return (DECKERROR_CARDCOUNT << 28) | cit->first; return (DECKERROR_CARDCOUNT << 28) | cit->first;
auto it = list->find(code); auto it = list.find(code);
if(it != list->end() && dc > it->second) if(it != list.end() && dc > it->second)
return (DECKERROR_LFLIST << 28) | cit->first; return (DECKERROR_LFLIST << 28) | cit->first;
} }
for (auto& cit : deck.extra) { for (auto& cit : deck.extra) {
...@@ -123,8 +121,8 @@ unsigned int DeckManager::CheckDeck(Deck& deck, int lfhash, int rule) { ...@@ -123,8 +121,8 @@ unsigned int DeckManager::CheckDeck(Deck& deck, int lfhash, int rule) {
int dc = ccount[code]; int dc = ccount[code];
if(dc > 3) if(dc > 3)
return (DECKERROR_CARDCOUNT << 28) | cit->first; return (DECKERROR_CARDCOUNT << 28) | cit->first;
auto it = list->find(code); auto it = list.find(code);
if(it != list->end() && dc > it->second) if(it != list.end() && dc > it->second)
return (DECKERROR_LFLIST << 28) | cit->first; return (DECKERROR_LFLIST << 28) | cit->first;
} }
for (auto& cit : deck.side) { for (auto& cit : deck.side) {
...@@ -138,8 +136,8 @@ unsigned int DeckManager::CheckDeck(Deck& deck, int lfhash, int rule) { ...@@ -138,8 +136,8 @@ unsigned int DeckManager::CheckDeck(Deck& deck, int lfhash, int rule) {
int dc = ccount[code]; int dc = ccount[code];
if(dc > 3) if(dc > 3)
return (DECKERROR_CARDCOUNT << 28) | cit->first; return (DECKERROR_CARDCOUNT << 28) | cit->first;
auto it = list->find(code); auto it = list.find(code);
if(it != list->end() && dc > it->second) if(it != list.end() && dc > it->second)
return (DECKERROR_LFLIST << 28) | cit->first; return (DECKERROR_LFLIST << 28) | cit->first;
} }
return 0; return 0;
...@@ -201,7 +199,7 @@ int DeckManager::LoadDeck(Deck& deck, std::istringstream& deckStream, bool is_pa ...@@ -201,7 +199,7 @@ int DeckManager::LoadDeck(Deck& deck, std::istringstream& deckStream, bool is_pa
if (linebuf[0] < '0' || linebuf[0] > '9') if (linebuf[0] < '0' || linebuf[0] > '9')
continue; continue;
errno = 0; errno = 0;
code = strtol(linebuf.c_str(), nullptr, 10); code = std::strtol(linebuf.c_str(), nullptr, 10);
if (errno == ERANGE) if (errno == ERANGE)
continue; continue;
cardlist[ct++] = code; cardlist[ct++] = code;
...@@ -288,7 +286,7 @@ irr::io::IReadFile* DeckManager::OpenDeckReader(const wchar_t* file) { ...@@ -288,7 +286,7 @@ irr::io::IReadFile* DeckManager::OpenDeckReader(const wchar_t* file) {
} }
bool DeckManager::LoadCurrentDeck(const wchar_t* file, bool is_packlist) { bool DeckManager::LoadCurrentDeck(const wchar_t* file, bool is_packlist) {
current_deck.clear(); current_deck.clear();
IReadFile* reader = OpenDeckReader(file); auto reader = OpenDeckReader(file);
if(!reader) { if(!reader) {
wchar_t localfile[256]; wchar_t localfile[256];
myswprintf(localfile, L"./deck/%ls.ydk", file); myswprintf(localfile, L"./deck/%ls.ydk", file);
......
...@@ -32,7 +32,7 @@ namespace ygo { ...@@ -32,7 +32,7 @@ namespace ygo {
struct LFList { struct LFList {
unsigned int hash{}; unsigned int hash{};
std::wstring listName; std::wstring listName;
std::unordered_map<int, int> content; std::unordered_map<unsigned int, int> content;
}; };
struct Deck { struct Deck {
std::vector<code_pointer> main; std::vector<code_pointer> main;
...@@ -60,8 +60,8 @@ public: ...@@ -60,8 +60,8 @@ public:
void LoadLFListSingle(const char* path); void LoadLFListSingle(const char* path);
void LoadLFList(); void LoadLFList();
const wchar_t* GetLFListName(int lfhash); const wchar_t* GetLFListName(unsigned int lfhash);
const std::unordered_map<int, int>* GetLFListContent(int lfhash); const LFList* GetLFList(unsigned int lfhash);
unsigned int CheckDeck(Deck& deck, int lfhash, int rule); unsigned int CheckDeck(Deck& deck, int lfhash, int rule);
int LoadDeck(Deck& deck, int* dbuf, int mainc, int sidec, bool is_packlist = false); int LoadDeck(Deck& deck, int* dbuf, int mainc, int sidec, bool is_packlist = false);
int LoadDeck(Deck& deck, std::istringstream& deckStream, bool is_packlist = false); int LoadDeck(Deck& deck, std::istringstream& deckStream, bool is_packlist = false);
......
This diff is collapsed.
...@@ -602,9 +602,9 @@ void DuelClient::HandleSTOCPacketLan(unsigned char* data, int len) { ...@@ -602,9 +602,9 @@ void DuelClient::HandleSTOCPacketLan(unsigned char* data, int len) {
mainGame->dInfo.time_left[0] = 0; mainGame->dInfo.time_left[0] = 0;
mainGame->dInfo.time_left[1] = 0; mainGame->dInfo.time_left[1] = 0;
mainGame->RefreshTimeDisplay(); mainGame->RefreshTimeDisplay();
mainGame->deckBuilder.filterList = deckManager.GetLFListContent(pkt->info.lflist); mainGame->deckBuilder.filterList = deckManager.GetLFList(pkt->info.lflist);
if(mainGame->deckBuilder.filterList == nullptr) if(mainGame->deckBuilder.filterList == nullptr)
mainGame->deckBuilder.filterList = &deckManager._lfList[0].content; mainGame->deckBuilder.filterList = &deckManager._lfList[0];
mainGame->stHostPrepOB->setText(L""); mainGame->stHostPrepOB->setText(L"");
mainGame->SetStaticText(mainGame->stHostPrepRule, 180, mainGame->guiFont, str.c_str()); mainGame->SetStaticText(mainGame->stHostPrepRule, 180, mainGame->guiFont, str.c_str());
mainGame->RefreshCategoryDeck(mainGame->cbCategorySelect, mainGame->cbDeckSelect); mainGame->RefreshCategoryDeck(mainGame->cbCategorySelect, mainGame->cbDeckSelect);
...@@ -2082,23 +2082,23 @@ bool DuelClient::ClientAnalyze(unsigned char* msg, int len) { ...@@ -2082,23 +2082,23 @@ bool DuelClient::ClientAnalyze(unsigned char* msg, int len) {
else startpos = 155; else startpos = 155;
if(positions & 0x1) { if(positions & 0x1) {
mainGame->imageLoading.insert(std::make_pair(mainGame->btnPSAU, code)); mainGame->imageLoading.insert(std::make_pair(mainGame->btnPSAU, code));
mainGame->btnPSAU->setRelativePosition(rect<s32>(startpos, 45, startpos + 140, 185)); mainGame->btnPSAU->setRelativePosition(irr::core::rect<irr::s32>(startpos, 45, startpos + 140, 185));
mainGame->btnPSAU->setVisible(true); mainGame->btnPSAU->setVisible(true);
startpos += 145; startpos += 145;
} else mainGame->btnPSAU->setVisible(false); } else mainGame->btnPSAU->setVisible(false);
if(positions & 0x2) { if(positions & 0x2) {
mainGame->btnPSAD->setRelativePosition(rect<s32>(startpos, 45, startpos + 140, 185)); mainGame->btnPSAD->setRelativePosition(irr::core::rect<irr::s32>(startpos, 45, startpos + 140, 185));
mainGame->btnPSAD->setVisible(true); mainGame->btnPSAD->setVisible(true);
startpos += 145; startpos += 145;
} else mainGame->btnPSAD->setVisible(false); } else mainGame->btnPSAD->setVisible(false);
if(positions & 0x4) { if(positions & 0x4) {
mainGame->imageLoading.insert(std::make_pair(mainGame->btnPSDU, code)); mainGame->imageLoading.insert(std::make_pair(mainGame->btnPSDU, code));
mainGame->btnPSDU->setRelativePosition(rect<s32>(startpos, 45, startpos + 140, 185)); mainGame->btnPSDU->setRelativePosition(irr::core::rect<irr::s32>(startpos, 45, startpos + 140, 185));
mainGame->btnPSDU->setVisible(true); mainGame->btnPSDU->setVisible(true);
startpos += 145; startpos += 145;
} else mainGame->btnPSDU->setVisible(false); } else mainGame->btnPSDU->setVisible(false);
if(positions & 0x8) { if(positions & 0x8) {
mainGame->btnPSDD->setRelativePosition(rect<s32>(startpos, 45, startpos + 140, 185)); mainGame->btnPSDD->setRelativePosition(irr::core::rect<irr::s32>(startpos, 45, startpos + 140, 185));
mainGame->btnPSDD->setVisible(true); mainGame->btnPSDD->setVisible(true);
startpos += 145; startpos += 145;
} else mainGame->btnPSDD->setVisible(false); } else mainGame->btnPSDD->setVisible(false);
...@@ -3680,11 +3680,11 @@ bool DuelClient::ClientAnalyze(unsigned char* msg, int len) { ...@@ -3680,11 +3680,11 @@ bool DuelClient::ClientAnalyze(unsigned char* msg, int len) {
float xd = mainGame->dField.attack_target->curPos.X; float xd = mainGame->dField.attack_target->curPos.X;
float yd = mainGame->dField.attack_target->curPos.Y; float yd = mainGame->dField.attack_target->curPos.Y;
sy = (float)sqrt((xa - xd) * (xa - xd) + (ya - yd) * (ya - yd)) / 2; sy = (float)sqrt((xa - xd) * (xa - xd) + (ya - yd) * (ya - yd)) / 2;
mainGame->atk_t = vector3df((xa + xd) / 2, (ya + yd) / 2, 0); mainGame->atk_t = irr::core::vector3df((xa + xd) / 2, (ya + yd) / 2, 0);
if (ca == 0) if (ca == 0)
mainGame->atk_r = vector3df(0, 0, -atan((xd - xa) / (yd - ya))); mainGame->atk_r = irr::core::vector3df(0, 0, -atan((xd - xa) / (yd - ya)));
else else
mainGame->atk_r = vector3df(0, 0, 3.1415926 - atan((xd - xa) / (yd - ya))); mainGame->atk_r = irr::core::vector3df(0, 0, 3.1415926 - atan((xd - xa) / (yd - ya)));
} else { } else {
soundManager.PlaySoundEffect(SOUND_DIRECT_ATTACK); soundManager.PlaySoundEffect(SOUND_DIRECT_ATTACK);
myswprintf(event_string, dataManager.GetSysString(1620), dataManager.GetName(mainGame->dField.attacker->code)); myswprintf(event_string, dataManager.GetSysString(1620), dataManager.GetName(mainGame->dField.attacker->code));
...@@ -3695,11 +3695,11 @@ bool DuelClient::ClientAnalyze(unsigned char* msg, int len) { ...@@ -3695,11 +3695,11 @@ bool DuelClient::ClientAnalyze(unsigned char* msg, int len) {
if (ca == 0) if (ca == 0)
yd = -3.5f; yd = -3.5f;
sy = (float)sqrt((xa - xd) * (xa - xd) + (ya - yd) * (ya - yd)) / 2; sy = (float)sqrt((xa - xd) * (xa - xd) + (ya - yd) * (ya - yd)) / 2;
mainGame->atk_t = vector3df((xa + xd) / 2, (ya + yd) / 2, 0); mainGame->atk_t = irr::core::vector3df((xa + xd) / 2, (ya + yd) / 2, 0);
if (ca == 0) if (ca == 0)
mainGame->atk_r = vector3df(0, 0, -atan((xd - xa) / (yd - ya))); mainGame->atk_r = irr::core::vector3df(0, 0, -atan((xd - xa) / (yd - ya)));
else else
mainGame->atk_r = vector3df(0, 0, 3.1415926 - atan((xd - xa) / (yd - ya))); mainGame->atk_r = irr::core::vector3df(0, 0, 3.1415926 - atan((xd - xa) / (yd - ya)));
} }
if (auto_watch_mode) { if (auto_watch_mode) {
int code = mainGame->dField.attacker->code; int code = mainGame->dField.attacker->code;
...@@ -3936,9 +3936,9 @@ bool DuelClient::ClientAnalyze(unsigned char* msg, int len) { ...@@ -3936,9 +3936,9 @@ bool DuelClient::ClientAnalyze(unsigned char* msg, int len) {
mainGame->cbANNumber->setSelected(0); mainGame->cbANNumber->setSelected(0);
if(quickmode) { if(quickmode) {
mainGame->cbANNumber->setVisible(false); mainGame->cbANNumber->setVisible(false);
mainGame->btnANNumberOK->setRelativePosition(rect<s32>(20, 195, 210, 230)); mainGame->btnANNumberOK->setRelativePosition(irr::core::rect<irr::s32>(20, 195, 210, 230));
mainGame->btnANNumberOK->setEnabled(false); mainGame->btnANNumberOK->setEnabled(false);
recti pos = mainGame->wANNumber->getRelativePosition(); irr::core::recti pos = mainGame->wANNumber->getRelativePosition();
pos.LowerRightCorner.Y = pos.UpperLeftCorner.Y + 250; pos.LowerRightCorner.Y = pos.UpperLeftCorner.Y + 250;
mainGame->wANNumber->setRelativePosition(pos); mainGame->wANNumber->setRelativePosition(pos);
} else { } else {
...@@ -3946,8 +3946,8 @@ bool DuelClient::ClientAnalyze(unsigned char* msg, int len) { ...@@ -3946,8 +3946,8 @@ bool DuelClient::ClientAnalyze(unsigned char* msg, int len) {
mainGame->btnANNumber[i]->setVisible(false); mainGame->btnANNumber[i]->setVisible(false);
} }
mainGame->cbANNumber->setVisible(true); mainGame->cbANNumber->setVisible(true);
mainGame->btnANNumberOK->setRelativePosition(rect<s32>(80, 60, 150, 85)); mainGame->btnANNumberOK->setRelativePosition(irr::core::rect<irr::s32>(80, 60, 150, 85));
recti pos = mainGame->wANNumber->getRelativePosition(); irr::core::recti pos = mainGame->wANNumber->getRelativePosition();
pos.LowerRightCorner.Y = pos.UpperLeftCorner.Y + 95; pos.LowerRightCorner.Y = pos.UpperLeftCorner.Y + 95;
mainGame->wANNumber->setRelativePosition(pos); mainGame->wANNumber->setRelativePosition(pos);
} }
......
...@@ -103,7 +103,7 @@ public: ...@@ -103,7 +103,7 @@ public:
bufferevent_write(client_bev, duel_client_write, 3); bufferevent_write(client_bev, duel_client_write, 3);
} }
template<typename ST> template<typename ST>
static void SendPacketToServer(unsigned char proto, ST& st) { static void SendPacketToServer(unsigned char proto, const ST& st) {
auto p = duel_client_write; auto p = duel_client_write;
if (sizeof(ST) > MAX_DATA_SIZE) if (sizeof(ST) > MAX_DATA_SIZE)
return; return;
......
This diff is collapsed.
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -163,9 +163,9 @@ public: ...@@ -163,9 +163,9 @@ public:
bool Initialize(); bool Initialize();
void MainLoop(); void MainLoop();
void RefreshTimeDisplay(); void RefreshTimeDisplay();
void BuildProjectionMatrix(irr::core::matrix4& mProjection, f32 left, f32 right, f32 bottom, f32 top, f32 znear, f32 zfar); void BuildProjectionMatrix(irr::core::matrix4& mProjection, irr::f32 left, irr::f32 right, irr::f32 bottom, irr::f32 top, irr::f32 znear, irr::f32 zfar);
void InitStaticText(irr::gui::IGUIStaticText* pControl, u32 cWidth, u32 cHeight, irr::gui::CGUITTFont* font, const wchar_t* text); void InitStaticText(irr::gui::IGUIStaticText* pControl, irr::u32 cWidth, irr::u32 cHeight, irr::gui::CGUITTFont* font, const wchar_t* text);
std::wstring SetStaticText(irr::gui::IGUIStaticText* pControl, u32 cWidth, irr::gui::CGUITTFont* font, const wchar_t* text, u32 pos = 0); std::wstring SetStaticText(irr::gui::IGUIStaticText* pControl, irr::u32 cWidth, irr::gui::CGUITTFont* font, const wchar_t* text, irr::u32 pos = 0);
void LoadExpansions(); void LoadExpansions();
void RefreshCategoryDeck(irr::gui::IGUIComboBox* cbCategory, irr::gui::IGUIComboBox* cbDeck, bool selectlastused = true); void RefreshCategoryDeck(irr::gui::IGUIComboBox* cbCategory, irr::gui::IGUIComboBox* cbDeck, bool selectlastused = true);
void RefreshDeck(irr::gui::IGUIComboBox* cbCategory, irr::gui::IGUIComboBox* cbDeck); void RefreshDeck(irr::gui::IGUIComboBox* cbCategory, irr::gui::IGUIComboBox* cbDeck);
...@@ -191,7 +191,7 @@ public: ...@@ -191,7 +191,7 @@ public:
void HideElement(irr::gui::IGUIElement* element, bool set_action = false); void HideElement(irr::gui::IGUIElement* element, bool set_action = false);
void PopupElement(irr::gui::IGUIElement* element, int hideframe = 0); void PopupElement(irr::gui::IGUIElement* element, int hideframe = 0);
void WaitFrameSignal(int frame); void WaitFrameSignal(int frame);
void DrawThumb(code_pointer cp, irr::core::vector2di pos, const std::unordered_map<int,int>* lflist, bool drag = false); void DrawThumb(code_pointer cp, irr::core::vector2di pos, const LFList* lflist, bool drag = false);
void DrawDeckBd(); void DrawDeckBd();
bool LoadConfigFromFile(const char* file); bool LoadConfigFromFile(const char* file);
void LoadConfig(); void LoadConfig();
...@@ -217,7 +217,7 @@ public: ...@@ -217,7 +217,7 @@ public:
const wchar_t* GetLocaleDirWide(const char* dir); const wchar_t* GetLocaleDirWide(const char* dir);
bool CheckRegEx(const std::wstring& text, const std::wstring& exp, bool exact = false); bool CheckRegEx(const std::wstring& text, const std::wstring& exp, bool exact = false);
bool HasFocus(EGUI_ELEMENT_TYPE type) const { bool HasFocus(irr::gui::EGUI_ELEMENT_TYPE type) const {
irr::gui::IGUIElement* focus = env->getFocus(); irr::gui::IGUIElement* focus = env->getFocus();
return focus && focus->hasType(type); return focus && focus->hasType(type);
} }
...@@ -230,27 +230,27 @@ public: ...@@ -230,27 +230,27 @@ public:
void OnResize(); void OnResize();
void ResizeChatInputWindow(); void ResizeChatInputWindow();
recti Resize(s32 x, s32 y, s32 x2, s32 y2); irr::core::recti Resize(irr::s32 x, irr::s32 y, irr::s32 x2, irr::s32 y2);
recti Resize(s32 x, s32 y, s32 x2, s32 y2, s32 dx, s32 dy, s32 dx2, s32 dy2); irr::core::recti Resize(irr::s32 x, irr::s32 y, irr::s32 x2, irr::s32 y2, irr::s32 dx, irr::s32 dy, irr::s32 dx2, irr::s32 dy2);
irr::core::vector2di Resize(s32 x, s32 y); irr::core::vector2di Resize(irr::s32 x, irr::s32 y);
irr::core::vector2di ResizeReverse(s32 x, s32 y); irr::core::vector2di ResizeReverse(irr::s32 x, irr::s32 y);
recti ResizePhaseHint(s32 x, s32 y, s32 x2, s32 y2, s32 width); irr::core::recti ResizePhaseHint(irr::s32 x, irr::s32 y, irr::s32 x2, irr::s32 y2, irr::s32 width);
recti ResizeWin(s32 x, s32 y, s32 x2, s32 y2); irr::core::recti ResizeWin(irr::s32 x, irr::s32 y, irr::s32 x2, irr::s32 y2);
recti ResizeCardImgWin(s32 x, s32 y, s32 mx, s32 my); irr::core::recti ResizeCardImgWin(irr::s32 x, irr::s32 y, irr::s32 mx, irr::s32 my);
recti ResizeCardHint(s32 x, s32 y, s32 x2, s32 y2); irr::core::recti ResizeCardHint(irr::s32 x, irr::s32 y, irr::s32 x2, irr::s32 y2);
irr::core::vector2di ResizeCardHint(s32 x, s32 y); irr::core::vector2di ResizeCardHint(irr::s32 x, irr::s32 y);
recti ResizeCardMid(s32 x, s32 y, s32 x2, s32 y2, s32 midx, s32 midy); irr::core::recti ResizeCardMid(irr::s32 x, irr::s32 y, irr::s32 x2, irr::s32 y2, irr::s32 midx, irr::s32 midy);
irr::core::vector2di ResizeCardMid(s32 x, s32 y, s32 midx, s32 midy); irr::core::vector2di ResizeCardMid(irr::s32 x, irr::s32 y, irr::s32 midx, irr::s32 midy);
recti ResizeFit(s32 x, s32 y, s32 x2, s32 y2); irr::core::recti ResizeFit(irr::s32 x, irr::s32 y, irr::s32 x2, irr::s32 y2);
void SetWindowsIcon(); void SetWindowsIcon();
void SetWindowsScale(float scale); void SetWindowsScale(float scale);
void FlashWindow(); void FlashWindow();
void takeScreenshot(); void takeScreenshot();
void SetCursor(ECURSOR_ICON icon); void SetCursor(irr::gui::ECURSOR_ICON icon);
template<typename T> template<typename T>
static void DrawShadowText(irr::gui::CGUITTFont* font, const T& text, const core::rect<s32>& position, const core::rect<s32>& padding, static void DrawShadowText(irr::gui::CGUITTFont* font, const T& text, const irr::core::rect<irr::s32>& position, const irr::core::rect<irr::s32>& padding,
video::SColor color = 0xffffffff, video::SColor shadowcolor = 0xff000000, bool hcenter = false, bool vcenter = false, const core::rect<s32>* clip = nullptr); irr::video::SColor color = 0xffffffff, irr::video::SColor shadowcolor = 0xff000000, bool hcenter = false, bool vcenter = false, const irr::core::rect<irr::s32>* clip = nullptr);
std::mutex gMutex; std::mutex gMutex;
Signal frameSignal; Signal frameSignal;
...@@ -267,41 +267,41 @@ public: ...@@ -267,41 +267,41 @@ public:
std::wstring chatMsg[8]; std::wstring chatMsg[8];
std::vector<BotInfo> botInfo; std::vector<BotInfo> botInfo;
int hideChatTimer; int hideChatTimer{};
bool hideChat; bool hideChat{};
int chatTiming[8]{}; int chatTiming[8]{};
int chatType[8]{}; int chatType[8]{};
unsigned short linePatternD3D; unsigned short linePatternD3D{};
unsigned short linePatternGL; unsigned short linePatternGL{ 0x0f0f };
int waitFrame; int waitFrame{};
int signalFrame; int signalFrame{};
int actionParam; int actionParam{};
int showingcode; int showingcode{};
const wchar_t* showingtext; const wchar_t* showingtext{};
int showcard; int showcard{};
int showcardcode; int showcardcode{};
int showcarddif; int showcarddif{};
int showcardp; int showcardp{};
int is_attacking; int is_attacking{};
int attack_sv; int attack_sv{};
irr::core::vector3df atk_r; irr::core::vector3df atk_r;
irr::core::vector3df atk_t; irr::core::vector3df atk_t;
float atkdy; float atkdy{};
int lpframe; int lpframe{};
int lpd; int lpd{};
int lpplayer; int lpplayer{};
int lpccolor; int lpccolor{};
std::wstring lpcstring; std::wstring lpcstring;
bool always_chain; bool always_chain{};
bool ignore_chain; bool ignore_chain{};
bool chain_when_avail; bool chain_when_avail{};
bool is_building; bool is_building{};
bool is_siding; bool is_siding{};
irr::core::dimension2d<irr::u32> window_size; irr::core::dimension2d<irr::u32> window_size;
float xScale; float xScale{ 1.0f };
float yScale; float yScale{ 1.0f };
CGUISkinSystem *skinSystem; CGUISkinSystem *skinSystem;
wchar_t locale_buf[256]; wchar_t locale_buf[256];
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
#include "game.h" #include "game.h"
#include "data_manager.h" #include "data_manager.h"
#include <event2/thread.h> #include <event2/thread.h>
#include <locale.h> #include <clocale>
#include <memory> #include <memory>
#ifdef __APPLE__ #ifdef __APPLE__
...@@ -26,7 +26,7 @@ void ClickButton(irr::gui::IGUIElement* btn) { ...@@ -26,7 +26,7 @@ void ClickButton(irr::gui::IGUIElement* btn) {
int main(int argc, char* argv[]) { int main(int argc, char* argv[]) {
#ifndef _WIN32 #ifndef _WIN32
setlocale(LC_CTYPE, "UTF-8"); std::setlocale(LC_CTYPE, "UTF-8");
#endif #endif
#ifdef __APPLE__ #ifdef __APPLE__
CFURLRef bundle_url = CFBundleCopyBundleURL(CFBundleGetMainBundle()); CFURLRef bundle_url = CFBundleCopyBundleURL(CFBundleGetMainBundle());
......
...@@ -222,7 +222,7 @@ void ImageManager::ResizeTexture() { ...@@ -222,7 +222,7 @@ void ImageManager::ResizeTexture() {
// function by Warr1024, from https://github.com/minetest/minetest/issues/2419 , modified // function by Warr1024, from https://github.com/minetest/minetest/issues/2419 , modified
void imageScaleNNAA(irr::video::IImage *src, irr::video::IImage *dest) { void imageScaleNNAA(irr::video::IImage *src, irr::video::IImage *dest) {
double sx, sy, minsx, maxsx, minsy, maxsy, area, ra, ga, ba, aa, pw, ph, pa; double sx, sy, minsx, maxsx, minsy, maxsy, area, ra, ga, ba, aa, pw, ph, pa;
u32 dy, dx; irr::u32 dy, dx;
irr::video::SColor pxl; irr::video::SColor pxl;
// Cache rectsngle boundaries. // Cache rectsngle boundaries.
...@@ -231,7 +231,7 @@ void imageScaleNNAA(irr::video::IImage *src, irr::video::IImage *dest) { ...@@ -231,7 +231,7 @@ void imageScaleNNAA(irr::video::IImage *src, irr::video::IImage *dest) {
// Walk each destination image pixel. // Walk each destination image pixel.
// Note: loop y around x for better cache locality. // Note: loop y around x for better cache locality.
irr::core::dimension2d<u32> dim = dest->getDimension(); irr::core::dimension2d<irr::u32> dim = dest->getDimension();
for(dy = 0; dy < dim.Height; dy++) for(dy = 0; dy < dim.Height; dy++)
for(dx = 0; dx < dim.Width; dx++) { for(dx = 0; dx < dim.Width; dx++) {
...@@ -269,7 +269,7 @@ void imageScaleNNAA(irr::video::IImage *src, irr::video::IImage *dest) { ...@@ -269,7 +269,7 @@ void imageScaleNNAA(irr::video::IImage *src, irr::video::IImage *dest) {
// Get source pixel and add it to totals, weighted // Get source pixel and add it to totals, weighted
// by covered area and alpha. // by covered area and alpha.
pxl = src->getPixel((u32)sx, (u32)sy); pxl = src->getPixel((irr::u32)sx, (irr::u32)sy);
area += pa; area += pa;
ra += pa * pxl.getRed(); ra += pa * pxl.getRed();
ga += pa * pxl.getGreen(); ga += pa * pxl.getGreen();
...@@ -292,16 +292,16 @@ void imageScaleNNAA(irr::video::IImage *src, irr::video::IImage *dest) { ...@@ -292,16 +292,16 @@ void imageScaleNNAA(irr::video::IImage *src, irr::video::IImage *dest) {
dest->setPixel(dx, dy, pxl); dest->setPixel(dx, dy, pxl);
} }
} }
irr::video::ITexture* ImageManager::GetTextureFromFile(const char* file, s32 width, s32 height) { irr::video::ITexture* ImageManager::GetTextureFromFile(const char* file, irr::s32 width, irr::s32 height) {
if(mainGame->gameConf.use_image_scale) { if(mainGame->gameConf.use_image_scale) {
irr::video::ITexture* texture; irr::video::ITexture* texture;
irr::video::IImage* srcimg = driver->createImageFromFile(file); irr::video::IImage* srcimg = driver->createImageFromFile(file);
if(srcimg == nullptr) if(srcimg == nullptr)
return nullptr; return nullptr;
if(srcimg->getDimension() == irr::core::dimension2d<u32>(width, height)) { if(srcimg->getDimension() == irr::core::dimension2d<irr::u32>(width, height)) {
texture = driver->addTexture(file, srcimg); texture = driver->addTexture(file, srcimg);
} else { } else {
video::IImage *destimg = driver->createImage(srcimg->getColorFormat(), irr::core::dimension2d<u32>(width, height)); irr::video::IImage *destimg = driver->createImage(srcimg->getColorFormat(), irr::core::dimension2d<irr::u32>(width, height));
imageScaleNNAA(srcimg, destimg); imageScaleNNAA(srcimg, destimg);
texture = driver->addTexture(file, destimg); texture = driver->addTexture(file, destimg);
destimg->drop(); destimg->drop();
...@@ -383,7 +383,7 @@ irr::video::ITexture* ImageManager::GetBigPicture(int code, float zoom) { ...@@ -383,7 +383,7 @@ irr::video::ITexture* ImageManager::GetBigPicture(int code, float zoom) {
texture = driver->addTexture(file, srcimg); texture = driver->addTexture(file, srcimg);
} else { } else {
auto origsize = srcimg->getDimension(); auto origsize = srcimg->getDimension();
video::IImage* destimg = driver->createImage(srcimg->getColorFormat(), irr::core::dimension2d<u32>(origsize.Width * zoom, origsize.Height * zoom)); irr::video::IImage* destimg = driver->createImage(srcimg->getColorFormat(), irr::core::dimension2d<irr::u32>(origsize.Width * zoom, origsize.Height * zoom));
imageScaleNNAA(srcimg, destimg); imageScaleNNAA(srcimg, destimg);
texture = driver->addTexture(file, destimg); texture = driver->addTexture(file, destimg);
destimg->drop(); destimg->drop();
...@@ -448,14 +448,14 @@ int ImageManager::LoadThumbThread() { ...@@ -448,14 +448,14 @@ int ImageManager::LoadThumbThread() {
if(img != nullptr) { if(img != nullptr) {
int width = CARD_THUMB_WIDTH * mainGame->xScale; int width = CARD_THUMB_WIDTH * mainGame->xScale;
int height = CARD_THUMB_HEIGHT * mainGame->yScale; int height = CARD_THUMB_HEIGHT * mainGame->yScale;
if(img->getDimension() == irr::core::dimension2d<u32>(width, height)) { if(img->getDimension() == irr::core::dimension2d<irr::u32>(width, height)) {
img->grab(); img->grab();
imageManager.tThumbLoadingMutex.lock(); imageManager.tThumbLoadingMutex.lock();
if(imageManager.tThumbLoadingThreadRunning) if(imageManager.tThumbLoadingThreadRunning)
imageManager.tThumbLoading[code] = img; imageManager.tThumbLoading[code] = img;
imageManager.tThumbLoadingMutex.unlock(); imageManager.tThumbLoadingMutex.unlock();
} else { } else {
irr::video::IImage *destimg = imageManager.driver->createImage(img->getColorFormat(), irr::core::dimension2d<u32>(width, height)); irr::video::IImage *destimg = imageManager.driver->createImage(img->getColorFormat(), irr::core::dimension2d<irr::u32>(width, height));
imageScaleNNAA(img, destimg); imageScaleNNAA(img, destimg);
img->drop(); img->drop();
destimg->grab(); destimg->grab();
......
...@@ -16,14 +16,14 @@ public: ...@@ -16,14 +16,14 @@ public:
bool Initial(); bool Initial();
//random image //random image
irr::video::ITexture* GetRandomImage(int image_type); irr::video::ITexture* GetRandomImage(int image_type);
irr::video::ITexture* GetRandomImage(int image_type, s32 width, s32 height); irr::video::ITexture* GetRandomImage(int image_type, irr::s32 width, irr::s32 height);
void RefreshRandomImageList(); void RefreshRandomImageList();
void RefreshImageDir(std::wstring path, int image_type); void RefreshImageDir(std::wstring path, int image_type);
void SetDevice(irr::IrrlichtDevice* dev); void SetDevice(irr::IrrlichtDevice* dev);
void ClearTexture(); void ClearTexture();
void RemoveTexture(int code); void RemoveTexture(int code);
void ResizeTexture(); void ResizeTexture();
irr::video::ITexture* GetTextureFromFile(const char* file, s32 width, s32 height); irr::video::ITexture* GetTextureFromFile(const char* file, irr::s32 width, irr::s32 height);
irr::video::ITexture* GetTexture(int code, bool fit = false); irr::video::ITexture* GetTexture(int code, bool fit = false);
irr::video::ITexture* GetBigPicture(int code, float zoom); irr::video::ITexture* GetBigPicture(int code, float zoom);
irr::video::ITexture* GetTextureThumb(int code); irr::video::ITexture* GetTextureThumb(int code);
......
project "clzma" project "clzma"
kind "StaticLib" kind "StaticLib"
cdialect "C11"
files { "*.c", "*.h" } files { "*.c", "*.h" }
...@@ -33,7 +33,7 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) { ...@@ -33,7 +33,7 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
switch(event.EventType) { switch(event.EventType) {
case irr::EET_GUI_EVENT: { case irr::EET_GUI_EVENT: {
irr::gui::IGUIElement* caller = event.GUIEvent.Caller; irr::gui::IGUIElement* caller = event.GUIEvent.Caller;
s32 id = caller->getID(); irr::s32 id = caller->getID();
if(mainGame->wQuery->isVisible() && id != BUTTON_YES && id != BUTTON_NO) { if(mainGame->wQuery->isVisible() && id != BUTTON_YES && id != BUTTON_NO) {
mainGame->wQuery->getParent()->bringToFront(mainGame->wQuery); mainGame->wQuery->getParent()->bringToFront(mainGame->wQuery);
break; break;
...@@ -386,7 +386,7 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) { ...@@ -386,7 +386,7 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
char arg3[8]; char arg3[8];
std::snprintf(arg3, sizeof arg3, "%d", mainGame->gameConf.serverport); std::snprintf(arg3, sizeof arg3, "%d", mainGame->gameConf.serverport);
execl("./bot", "bot", arg1, arg2, arg3, nullptr); execl("./bot", "bot", arg1, arg2, arg3, nullptr);
exit(0); std::exit(0);
} else { } else {
if(!NetServer::StartServer(mainGame->gameConf.serverport)) { if(!NetServer::StartServer(mainGame->gameConf.serverport)) {
soundManager.PlaySoundEffect(SOUND_INFO); soundManager.PlaySoundEffect(SOUND_INFO);
......
...@@ -41,7 +41,7 @@ public: ...@@ -41,7 +41,7 @@ public:
bufferevent_write(dp->bev, net_server_write, 3); bufferevent_write(dp->bev, net_server_write, 3);
} }
template<typename ST> template<typename ST>
static void SendPacketToPlayer(DuelPlayer* dp, unsigned char proto, ST& st) { static void SendPacketToPlayer(DuelPlayer* dp, unsigned char proto, const ST& st) {
auto p = net_server_write; auto p = net_server_write;
if (sizeof(ST) > MAX_DATA_SIZE) if (sizeof(ST) > MAX_DATA_SIZE)
return; return;
......
...@@ -6,6 +6,7 @@ end ...@@ -6,6 +6,7 @@ end
project "YGOPro" project "YGOPro"
kind "WindowedApp" kind "WindowedApp"
cppdialect "C++14"
files { "*.cpp", "*.h", "CGUISkinSystem/*.cpp", "CGUISkinSystem/*.h", "CXMLRegistry/*.cpp", "CXMLRegistry/*.h" } files { "*.cpp", "*.h", "CGUISkinSystem/*.cpp", "CGUISkinSystem/*.h", "CXMLRegistry/*.cpp", "CXMLRegistry/*.h" }
includedirs { "../ocgcore" } includedirs { "../ocgcore" }
...@@ -50,7 +51,7 @@ project "YGOPro" ...@@ -50,7 +51,7 @@ project "YGOPro"
libdirs { "$(DXSDK_DIR)Lib/x86" } libdirs { "$(DXSDK_DIR)Lib/x86" }
links { "opengl32", "ws2_32", "winmm", "gdi32", "kernel32", "user32", "imm32", "Dnsapi" } links { "opengl32", "ws2_32", "winmm", "gdi32", "kernel32", "user32", "imm32", "Dnsapi" }
filter "not action:vs*" filter "not action:vs*"
buildoptions { "-std=c++14", "-fno-rtti" } buildoptions { "-fno-rtti" }
filter "not system:windows" filter "not system:windows"
links { "event_pthreads", "dl", "pthread", "resolv" } links { "event_pthreads", "dl", "pthread", "resolv" }
filter "system:macosx" filter "system:macosx"
......
#ifndef REPLAY_MODE_H #ifndef REPLAY_MODE_H
#define REPLAY_MODE_H #define REPLAY_MODE_H
#include <stdint.h> #include <cstdint>
#include <vector> #include <vector>
#include "replay.h" #include "replay.h"
......
#ifndef SINGLE_MODE_H #ifndef SINGLE_MODE_H
#define SINGLE_MODE_H #define SINGLE_MODE_H
#include <stdint.h> #include <cstdint>
#include <vector> #include <vector>
#include "replay.h" #include "replay.h"
......
project "cspmemvfs" project "cspmemvfs"
kind "StaticLib" kind "StaticLib"
cdialect "C11"
files { "*.c", "*.h" } files { "*.c", "*.h" }
if BUILD_SQLITE then if BUILD_SQLITE then
includedirs { "../../sqlite3" } includedirs { "../../sqlite3" }
end end
filter "not action:vs*"
defines { "_POSIX_C_SOURCE=200809L" }
project "event" project "event"
kind "StaticLib" kind "StaticLib"
cdialect "C11"
includedirs { "include", "compat" } includedirs { "include", "compat" }
......
project "freetype" project "freetype"
kind "StaticLib" kind "StaticLib"
cdialect "C11"
includedirs { "include" } includedirs { "include" }
defines { "FT2_BUILD_LIBRARY" } defines { "FT2_BUILD_LIBRARY" }
......
project "irrlicht" project "irrlicht"
kind "StaticLib" kind "StaticLib"
cdialect "C11"
includedirs { "include", "source/Irrlicht", "source/Irrlicht/jpeglib", "source/Irrlicht/libpng", "source/Irrlicht/zlib" } includedirs { "include", "source/Irrlicht", "source/Irrlicht/jpeglib", "source/Irrlicht/libpng", "source/Irrlicht/zlib" }
...@@ -318,7 +319,7 @@ project "irrlicht" ...@@ -318,7 +319,7 @@ project "irrlicht"
filter { "system:windows" } filter { "system:windows" }
defines { "_IRR_WCHAR_FILESYSTEM" } defines { "_IRR_WCHAR_FILESYSTEM" }
includedirs { "$(DXSDK_DIR)include" } includedirs { "$(DXSDK_DIR)Include" }
libdirs { "$(DXSDK_DIR)Lib/x86" } libdirs { "$(DXSDK_DIR)Lib/x86" }
links { "imm32" } links { "imm32" }
......
project "sqlite3" project "sqlite3"
kind "StaticLib" kind "StaticLib"
cdialect "C11"
files { "sqlite3.c", "sqlite3.h" } files { "sqlite3.c", "sqlite3.h" }
...@@ -37,7 +37,7 @@ newoption { trigger = "irrlicht-include-dir", category = "YGOPro - irrlicht", de ...@@ -37,7 +37,7 @@ newoption { trigger = "irrlicht-include-dir", category = "YGOPro - irrlicht", de
newoption { trigger = "irrlicht-lib-dir", category = "YGOPro - irrlicht", description = "", value = "PATH" } newoption { trigger = "irrlicht-lib-dir", category = "YGOPro - irrlicht", description = "", value = "PATH" }
newoption { trigger = "winxp-support", category = "YGOPro", description = "" } newoption { trigger = "winxp-support", category = "YGOPro", description = "" }
newoption { trigger = "mac-arm", category = "YGOPro", description = "M1" } newoption { trigger = "mac-arm", category = "YGOPro", description = "Cross compile for Apple Silicon" }
-- koishipro specific -- koishipro specific
...@@ -91,9 +91,9 @@ end ...@@ -91,9 +91,9 @@ end
if not BUILD_LUA then if not BUILD_LUA then
-- at most times you need to change this if you change BUILD_LUA to false -- at most times you need to change this if you change BUILD_LUA to false
-- make sure your lua lib is built with C++ and version >= 5.3 -- make sure your lua lib is built with C++ and version >= 5.3
LUA_INCLUDE_DIR = GetParam("lua-include-dir") or "/usr/local/include/lua"
LUA_LIB_DIR = GetParam("lua-lib-dir") or "/usr/local/lib"
LUA_LIB_NAME = GetParam("lua-lib-name") LUA_LIB_NAME = GetParam("lua-lib-name")
LUA_INCLUDE_DIR = GetParam("lua-include-dir") or os.findheader(LUA_LIB_NAME)
LUA_LIB_DIR = GetParam("lua-lib-dir") or os.findlib(LUA_LIB_NAME)
end end
if GetParam("lua-deb") then if GetParam("lua-deb") then
...@@ -109,8 +109,8 @@ elseif GetParam("no-build-event") then ...@@ -109,8 +109,8 @@ elseif GetParam("no-build-event") then
BUILD_EVENT = false BUILD_EVENT = false
end end
if not BUILD_EVENT then if not BUILD_EVENT then
EVENT_INCLUDE_DIR = GetParam("event-include-dir") or "/usr/local/include/event2" EVENT_INCLUDE_DIR = GetParam("event-include-dir") or os.findheader("event")
EVENT_LIB_DIR = GetParam("event-lib-dir") or "/usr/local/lib" EVENT_LIB_DIR = GetParam("event-lib-dir") or os.findlib("event")
end end
if GetParam("build-freetype") then if GetParam("build-freetype") then
...@@ -119,13 +119,8 @@ elseif GetParam("no-build-freetype") then ...@@ -119,13 +119,8 @@ elseif GetParam("no-build-freetype") then
BUILD_FREETYPE = false BUILD_FREETYPE = false
end end
if not BUILD_FREETYPE then if not BUILD_FREETYPE then
if os.istarget("linux") then FREETYPE_INCLUDE_DIR = GetParam("freetype-include-dir") or os.findheader("freetype")
FREETYPE_INCLUDE_DIR = "/usr/include/freetype2" FREETYPE_LIB_DIR = GetParam("freetype-lib-dir") or os.findlib("freetype")
elseif os.istarget("macosx") then
FREETYPE_INCLUDE_DIR = "/usr/local/include/freetype2"
end
FREETYPE_INCLUDE_DIR = GetParam("freetype-include-dir") or FREETYPE_INCLUDE_DIR
FREETYPE_LIB_DIR = GetParam("freetype-lib-dir") or "/usr/local/lib"
end end
if GetParam("build-sqlite") then if GetParam("build-sqlite") then
...@@ -134,8 +129,8 @@ elseif GetParam("no-build-sqlite") then ...@@ -134,8 +129,8 @@ elseif GetParam("no-build-sqlite") then
BUILD_SQLITE = false BUILD_SQLITE = false
end end
if not BUILD_SQLITE then if not BUILD_SQLITE then
SQLITE_INCLUDE_DIR = GetParam("sqlite-include-dir") or "/usr/local/include" SQLITE_INCLUDE_DIR = GetParam("sqlite-include-dir") or os.findheader("sqlite3")
SQLITE_LIB_DIR = GetParam("sqlite-lib-dir") or "/usr/local/lib" SQLITE_LIB_DIR = GetParam("sqlite-lib-dir") or os.findlib("sqlite3")
end end
if GetParam("build-irrlicht") then if GetParam("build-irrlicht") then
...@@ -144,8 +139,8 @@ elseif GetParam("no-build-irrlicht") then ...@@ -144,8 +139,8 @@ elseif GetParam("no-build-irrlicht") then
BUILD_IRRLICHT = false BUILD_IRRLICHT = false
end end
if not BUILD_IRRLICHT then if not BUILD_IRRLICHT then
IRRLICHT_INCLUDE_DIR = GetParam("irrlicht-include-dir") or "/usr/local/include/irrlicht" IRRLICHT_INCLUDE_DIR = GetParam("irrlicht-include-dir") or os.findheader("irrlicht")
IRRLICHT_LIB_DIR = GetParam("irrlicht-lib-dir") or "/usr/local/lib" IRRLICHT_LIB_DIR = GetParam("irrlicht-lib-dir") or os.findlib("irrlicht")
end end
USE_AUDIO = not GetParam("no-audio") USE_AUDIO = not GetParam("no-audio")
...@@ -210,7 +205,7 @@ workspace "YGOPro" ...@@ -210,7 +205,7 @@ workspace "YGOPro"
targetdir "bin/debug" targetdir "bin/debug"
filter { "configurations:Release", "action:vs*" } filter { "configurations:Release", "action:vs*" }
flags { "LinkTimeOptimization" } linktimeoptimization "On"
staticruntime "On" staticruntime "On"
disablewarnings { "4244", "4267", "4838", "4577", "4018", "4996", "4477", "4091", "4800", "6011", "6031", "6054", "6262" } disablewarnings { "4244", "4267", "4838", "4577", "4018", "4996", "4477", "4091", "4800", "6011", "6031", "6054", "6262" }
...@@ -228,7 +223,7 @@ workspace "YGOPro" ...@@ -228,7 +223,7 @@ workspace "YGOPro"
vectorextensions "SSE2" vectorextensions "SSE2"
buildoptions { "/utf-8" } buildoptions { "/utf-8" }
defines { "_CRT_SECURE_NO_WARNINGS" } defines { "_CRT_SECURE_NO_WARNINGS" }
filter "not action:vs*" filter "not action:vs*"
buildoptions { "-fno-strict-aliasing", "-Wno-multichar", "-Wno-format-security" } buildoptions { "-fno-strict-aliasing", "-Wno-multichar", "-Wno-format-security" }
......
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