Commit 73b5d3ca authored by mercury233's avatar mercury233

Merge branch 'fh' into patch-myfopen

parents 9aeeb0e2 6684d2b7
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() {
return;
IGUISkin* skin = Environment->getSkin();
video::IVideoDriver* driver = Environment->getVideoDriver();
core::vector2di center = AbsoluteRect.getCenter();
core::vector2di pos = center;
irr::core::vector2di center = AbsoluteRect.getCenter();
irr::core::vector2di pos = center;
pos.X -= (s32)(ImageRect.getWidth() * imageScale.X * 0.5f);
pos.Y -= (s32)(ImageRect.getHeight() * imageScale.Y * 0.5f);
if(Pressed) {
......
......@@ -561,7 +561,7 @@ void CGUITTFont::drawUstring(const core::ustring& utext, const core::rect<s32>&p
// Determine rendering information.
SGUITTGlyph& glyph = Glyphs[n - 1];
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);
Render_Map.set(glyph.glyph_page, page);
}
......@@ -832,7 +832,7 @@ video::IImage* CGUITTFont::createTextureFromChar(const uchar32_t& ch) {
// Copy the image data out of the page texture.
core::dimension2du glyph_size(glyph.source_rect.getSize());
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();
return image;
......@@ -854,17 +854,14 @@ void CGUITTFont::createSharedPlane() {
0---1
*/
using namespace core;
using namespace video;
using namespace scene;
S3DVertex vertices[4];
video::S3DVertex vertices[4];
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[1] = S3DVertex(vector3df(1, -1, 0), vector3df(0, 0, -1), SColor(255, 255, 255, 255), vector2df(1, 1));
vertices[2] = S3DVertex(vector3df(0, 0, 0), vector3df(0, 0, -1), SColor(255, 255, 255, 255), vector2df(0, 0));
vertices[3] = S3DVertex(vector3df(1, 0, 0), vector3df(0, 0, -1), SColor(255, 255, 255, 255), vector2df(1, 0));
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] = video::S3DVertex(core::vector3df(1, -1, 0), core::vector3df(0, 0, -1), video::SColor(255, 255, 255, 255), core::vector2df(1, 1));
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] = 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);
shared_plane_.addMeshBuffer( buf );
......@@ -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) {
using namespace core;
using namespace video;
using namespace scene;
array<scene::ISceneNode*> container;
core::array<scene::ISceneNode*> container;
if (!Driver || !smgr) return container;
if (!parent)
......@@ -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
createSharedPlane(); //if it's not initialized, we create one.
dimension2d<s32> text_size(getDimension(text)); //convert from unsigned to signed.
vector3df start_point(0, 0, 0), offset;
core::dimension2d<s32> text_size(getDimension(text)); //convert from unsigned to signed.
core::vector3df start_point(0, 0, 0), offset;
/** NOTICE:
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
}
// the default font material
SMaterial mat;
video::SMaterial mat;
mat.setFlag(video::EMF_LIGHTING, true);
mat.setFlag(video::EMF_ZWRITE_ENABLE, false);
mat.setFlag(video::EMF_NORMALIZE_NORMALS, true);
......@@ -924,7 +917,7 @@ core::array<scene::ISceneNode*> CGUITTFont::addTextSceneNode(const wchar_t* text
wchar_t current_char = 0, previous_char = 0;
u32 n = 0;
array<u32> glyph_indices;
core::array<u32> glyph_indices;
while (*text) {
current_char = *text;
......@@ -957,23 +950,23 @@ core::array<scene::ISceneNode*> CGUITTFont::addTextSceneNode(const wchar_t* text
s32 offy = (font_metrics.ascender / 64) - glyph.offset.Y;
// Apply kerning.
vector2di k = getKerning(current_char, previous_char);
core::vector2di k = getKerning(current_char, previous_char);
offset.X += k.X;
offset.Y += k.Y;
vector3df current_pos(offset.X + offx, offset.Y - offy, 0);
dimension2d<u32> letter_size = dimension2d<u32>(texw, texh);
core::vector3df current_pos(offset.X + offx, offset.Y - offy, 0);
core::dimension2d<u32> letter_size = core::dimension2d<u32>(texw, texh);
// Now we copy planes corresponding to the letter size.
IMeshManipulator* mani = smgr->getMeshManipulator();
IMesh* meshcopy = mani->createMeshCopy(shared_plane_ptr_);
mani->scale(meshcopy, vector3df((f32)letter_size.Width, (f32)letter_size.Height, 1));
scene::IMeshManipulator* mani = smgr->getMeshManipulator();
scene::IMesh* meshcopy = mani->createMeshCopy(shared_plane_ptr_);
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();
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->setDebugDataVisible(EDS_BBOX); //de-comment this when debugging
......@@ -991,7 +984,7 @@ core::array<scene::ISceneNode*> CGUITTFont::addTextSceneNode(const wchar_t* text
for (u32 i = 0; i < glyph_indices.size(); ++i) {
u32 n = glyph_indices[i];
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;
//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
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.
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[1].TCoords.X = pv[3].TCoords.X = (letter_size.Width - 1) / static_cast<f32>(letter_size.Width);
pv[0].TCoords = vector2df(u1, v2);
pv[1].TCoords = vector2df(u2, v2);
pv[2].TCoords = vector2df(u1, v1);
pv[3].TCoords = vector2df(u2, v1);
pv[0].TCoords = core::vector2df(u1, v2);
pv[1].TCoords = core::vector2df(u2, v2);
pv[2].TCoords = core::vector2df(u1, v1);
pv[3].TCoords = core::vector2df(u2, v1);
container[i]->getMaterial(0).setTexture(0, current_tex);
}
......
......@@ -56,7 +56,7 @@ void ClientCard::UpdateInfo(unsigned char* buf) {
}
if(flag & QUERY_POSITION) {
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;
mainGame->dField.MoveCard(this, 1);
} else
......
......@@ -15,9 +15,9 @@ public:
irr::core::vector3df curRot;
irr::core::vector3df dPos;
irr::core::vector3df dRot;
u32 curAlpha{ 255 };
u32 dAlpha{ 0 };
u32 aniFrame{ 0 };
irr::u32 curAlpha{ 255 };
irr::u32 dAlpha{ 0 };
irr::u32 aniFrame{ 0 };
bool is_moving{ false };
bool is_fading{ false };
bool is_hovered{ false };
......
......@@ -431,7 +431,7 @@ void ClientField::ShowSelectCard(bool buttonok, bool chain) {
mainGame->imageLoading.insert(std::make_pair(mainGame->btnCardSelect[i], selectable_cards[i]->chain_code));
else
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]->setVisible(true);
if(mainGame->dInfo.curMsg != MSG_SORT_CARD) {
......@@ -486,7 +486,7 @@ void ClientField::ShowSelectCard(bool buttonok, bool chain) {
mainGame->stCardPos[i]->setBackgroundColor(0xffffffff);
}
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) {
for(int i = selectable_cards.size(); i < 5; ++i) {
......@@ -519,7 +519,7 @@ void ClientField::ShowChainCard() {
mainGame->imageLoading.insert(std::make_pair(mainGame->btnCardSelect[i], selectable_cards[i]->code));
else
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]->setVisible(true);
wchar_t formatBuffer[2048];
......@@ -538,7 +538,7 @@ void ClientField::ShowChainCard() {
else mainGame->stCardPos[i]->setBackgroundColor(0xffffffff);
}
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) {
for(int i = selectable_cards.size(); i < 5; ++i) {
......@@ -574,7 +574,7 @@ void ClientField::ShowLocationCard() {
mainGame->imageLoading.insert(std::make_pair(mainGame->btnCardDisplay[i], display_cards[i]->code));
else
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]->setVisible(true);
wchar_t formatBuffer[2048];
......@@ -607,7 +607,7 @@ void ClientField::ShowLocationCard() {
mainGame->stDisplayPos[i]->setBackgroundColor(0xffffffff);
}
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) {
for(int i = display_cards.size(); i < 5; ++i) {
......@@ -652,7 +652,7 @@ void ClientField::ShowSelectOption(int select_hint) {
mainGame->btnOptionOK->setVisible(false);
for(int i = 0; i < 5; i++)
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 oldheight = pos.LowerRightCorner.Y - pos.UpperLeftCorner.Y;
pos.UpperLeftCorner.Y = pos.UpperLeftCorner.Y + (oldheight - newheight) / 2;
......@@ -667,7 +667,7 @@ void ClientField::ShowSelectOption(int select_hint) {
mainGame->btnOptionOK->setVisible(true);
for(int i = 0; i < 5; i++)
mainGame->btnOption[i]->setVisible(false);
recti pos = mainGame->wOptions->getRelativePosition();
irr::core::recti pos = mainGame->wOptions->getRelativePosition();
pos.LowerRightCorner.Y = pos.UpperLeftCorner.Y + 140;
mainGame->wOptions->setRelativePosition(pos);
}
......
......@@ -46,7 +46,7 @@
#endif
#include <cstdio>
#include <stdlib.h>
#include <cstdlib>
#include <iostream>
#include <algorithm>
#include <string>
......@@ -85,12 +85,6 @@ inline FILE* myfopen(const char* filename, const char* mode) {
#endif
#include <irrlicht.h>
using namespace irr;
using namespace core;
using namespace scene;
using namespace video;
using namespace io;
using namespace gui;
extern const unsigned short PRO_VERSION;
extern unsigned int enable_log;
......
......@@ -13,23 +13,21 @@ DataManager::DataManager() : _datas(32768), _strings(32768) {
extra_setcode = { {8512558u, {0x8f, 0x54, 0x59, 0x82, 0x13a}}, };
}
bool DataManager::ReadDB(sqlite3* pDB) {
sqlite3_stmt* pStmt{};
sqlite3_stmt* pStmt = nullptr;
const char* sql = "select * from datas,texts where datas.id=texts.id";
if (sqlite3_prepare_v2(pDB, sql, -1, &pStmt, 0) != SQLITE_OK)
return Error(pDB);
return Error(pDB, pStmt);
wchar_t strBuffer[4096];
int step = 0;
do {
CardDataC cd;
CardString cs;
step = sqlite3_step(pStmt);
if (step == SQLITE_BUSY || step == SQLITE_ERROR || step == SQLITE_MISUSE)
return Error(pDB, pStmt);
else if (step == SQLITE_ROW) {
if (step == SQLITE_ROW) {
cd.code = sqlite3_column_int(pStmt, 0);
cd.ot = sqlite3_column_int(pStmt, 1);
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) {
auto it = extra_setcode.find(cd.code);
if (it != extra_setcode.end()) {
......@@ -42,7 +40,7 @@ bool DataManager::ReadDB(sqlite3* pDB) {
else
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.defense = sqlite3_column_int(pStmt, 6);
if (cd.type & TYPE_LINK) {
......@@ -51,13 +49,13 @@ bool DataManager::ReadDB(sqlite3* pDB) {
}
else
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.lscale = (level >> 24) & 0xff;
cd.rscale = (level >> 16) & 0xff;
cd.race = sqlite3_column_int(pStmt, 8);
cd.attribute = sqlite3_column_int(pStmt, 9);
cd.category = sqlite3_column_int(pStmt, 10);
cd.race = static_cast<decltype(cd.race)>(sqlite3_column_int64(pStmt, 8));
cd.attribute = static_cast<decltype(cd.attribute)>(sqlite3_column_int64(pStmt, 9));
cd.category = static_cast<decltype(cd.category)>(sqlite3_column_int64(pStmt, 10));
_datas[cd.code] = cd;
if (const char* text = (const char*)sqlite3_column_text(pStmt, 12)) {
BufferIO::DecodeUTF8(text, strBuffer);
......@@ -76,7 +74,9 @@ bool DataManager::ReadDB(sqlite3* pDB) {
}
_strings[cd.code] = cs;
}
} while (step != SQLITE_DONE);
else if (step != SQLITE_DONE)
return Error(pDB, pStmt);
} while (step == SQLITE_ROW);
sqlite3_finalize(pStmt);
return true;
}
......@@ -84,17 +84,17 @@ bool DataManager::LoadDB(const wchar_t* wfile) {
char file[256];
BufferIO::EncodeUTF8(wfile, file);
#ifdef _WIN32
IReadFile* reader = FileSystem->createAndOpenFile(wfile);
auto reader = FileSystem->createAndOpenFile(wfile);
#else
IReadFile* reader = FileSystem->createAndOpenFile(file);
auto reader = FileSystem->createAndOpenFile(file);
#endif
if(reader == nullptr)
return false;
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();
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->drop();
(mem->data)[mem->total] = '\0';
......@@ -417,9 +417,9 @@ unsigned char* DataManager::ReadScriptFromIrrFS(const char* script_name, int* sl
#ifdef _WIN32
wchar_t fname[256]{};
BufferIO::DecodeUTF8(script_name, fname);
IReadFile* reader = FileSystem->createAndOpenFile(fname);
auto reader = FileSystem->createAndOpenFile(fname);
#else
IReadFile* reader = FileSystem->createAndOpenFile(script_name);
auto reader = FileSystem->createAndOpenFile(script_name);
#endif
if (!reader)
return nullptr;
......
......@@ -69,7 +69,18 @@ void DeckBuilder::Initialize() {
mainGame->btnSideShuffle->setVisible(false);
mainGame->btnSideSort->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();
rnd.reset((uint_fast32_t)std::time(nullptr));
mouse_pos.set(0, 0);
......@@ -126,7 +137,7 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
return false;
switch(event.EventType) {
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) ||
(mainGame->wQuery->isVisible() && id != BUTTON_YES && id != BUTTON_NO) ||
(mainGame->wLinkMarks->isVisible() && id != BUTTON_MARKERS_OK) ||
......@@ -1480,7 +1491,7 @@ void DeckBuilder::FilterCards() {
if(filter_marks && (data.link_marker & filter_marks) != filter_marks)
continue;
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;
if(filter_lm == 4 && !(data.ot & AVAIL_OCG))
continue;
......@@ -1669,13 +1680,13 @@ void DeckBuilder::ShowDeckManage() {
void DeckBuilder::ShowBigCard(int code, float zoom) {
bigcard_code = code;
bigcard_zoom = zoom;
ITexture* img = imageManager.GetBigPicture(code, zoom);
auto img = imageManager.GetBigPicture(code, zoom);
mainGame->imgBigCard->setImage(img);
auto size = img->getSize();
s32 left = mainGame->window_size.Width / 2 - size.Width / 2;
s32 top = mainGame->window_size.Height / 2 - size.Height / 2;
mainGame->imgBigCard->setRelativePosition(recti(0, 0, size.Width, size.Height));
mainGame->wBigCard->setRelativePosition(recti(left, top, left + size.Width, top + size.Height));
irr::s32 left = mainGame->window_size.Width / 2 - size.Width / 2;
irr::s32 top = mainGame->window_size.Height / 2 - size.Height / 2;
mainGame->imgBigCard->setRelativePosition(irr::core::recti(0, 0, size.Width, size.Height));
mainGame->wBigCard->setRelativePosition(irr::core::recti(left, top, left + size.Width, top + size.Height));
mainGame->gMutex.lock();
mainGame->btnBigCardOriginalSize->setVisible(true);
mainGame->btnBigCardZoomIn->setVisible(true);
......@@ -1685,12 +1696,12 @@ void DeckBuilder::ShowBigCard(int code, float zoom) {
mainGame->env->getRootGUIElement()->bringToFront(mainGame->wBigCard);
mainGame->gMutex.unlock();
}
void DeckBuilder::ZoomBigCard(s32 centerx, s32 centery) {
void DeckBuilder::ZoomBigCard(irr::s32 centerx, irr::s32 centery) {
if(bigcard_zoom >= 4)
bigcard_zoom = 4;
if(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);
auto size = img->getSize();
auto pos = mainGame->wBigCard->getRelativePosition();
......@@ -1700,10 +1711,10 @@ void DeckBuilder::ZoomBigCard(s32 centerx, s32 centery) {
}
float posx = (float)(centerx - pos.UpperLeftCorner.X) / pos.getWidth();
float posy = (float)(centery - pos.UpperLeftCorner.Y) / pos.getHeight();
s32 left = centerx - size.Width * posx;
s32 top = centery - size.Height * posy;
mainGame->imgBigCard->setRelativePosition(recti(0, 0, size.Width, size.Height));
mainGame->wBigCard->setRelativePosition(recti(left, top, left + size.Width, top + size.Height));
irr::s32 left = centerx - size.Width * posx;
irr::s32 top = centery - size.Height * posy;
mainGame->imgBigCard->setRelativePosition(irr::core::recti(0, 0, size.Width, size.Height));
mainGame->wBigCard->setRelativePosition(irr::core::recti(left, top, left + size.Width, top + size.Height));
}
void DeckBuilder::CloseBigCard() {
mainGame->HideElement(mainGame->wBigCard);
......@@ -1822,8 +1833,8 @@ void DeckBuilder::pop_side(int seq) {
bool DeckBuilder::check_limit(code_pointer pointer) {
unsigned int limitcode = pointer->second.alias ? pointer->second.alias : pointer->first;
int limit = 3;
auto flit = filterList->find(limitcode);
if(flit != filterList->end())
auto flit = filterList->content.find(limitcode);
if(flit != filterList->content.end())
limit = flit->second;
for(auto it = deckManager.current_deck.main.begin(); it != deckManager.current_deck.main.end(); ++it) {
if((*it)->first == limitcode || (*it)->second.alias == limitcode)
......
......@@ -5,6 +5,7 @@
#include <vector>
#include <irrlicht.h>
#include "data_manager.h"
#include "deck_manager.h"
#include "../ocgcore/mtrandom.h"
namespace ygo {
......@@ -81,7 +82,7 @@ public:
bool showing_pack{};
mt19937 rnd;
const std::unordered_map<int, int>* filterList;
const LFList* filterList{};
std::vector<code_pointer> results;
wchar_t result_string[8]{};
std::vector<std::wstring> expansionPacks;
......
......@@ -30,17 +30,14 @@ void DeckManager::LoadLFListSingle(const char* path) {
}
if (cur == _lfList.rend())
continue;
int code = 0;
unsigned int code = 0;
int count = -1;
if (std::sscanf(linebuf, "%9d%*[ ]%9d", &code, &count) != 2)
continue;
if (code <= 0 || code > MAX_CARD_ID)
if (std::sscanf(linebuf, "%9u%*[ ]%9d", &code, &count) != 2)
continue;
if (count < 0 || count > 2)
continue;
unsigned int hcode = code;
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);
}
......@@ -53,7 +50,7 @@ void DeckManager::LoadLFList() {
nolimit.hash = 0;
_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) {
return list.hash == lfhash;
});
......@@ -61,12 +58,12 @@ const wchar_t* DeckManager::GetLFListName(int lfhash) {
return lit->listName.c_str();
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) {
return list.hash == lfhash;
});
if(lit != _lfList.end())
return &lit->content;
if (lit != _lfList.end())
return &(*lit);
return nullptr;
}
static unsigned int checkAvail(unsigned int ot, unsigned int avail) {
......@@ -87,9 +84,10 @@ unsigned int DeckManager::CheckDeck(Deck& deck, int lfhash, int rule) {
return (DECKERROR_EXTRACOUNT << 28) | (unsigned)deck.extra.size();
if(deck.side.size() > SIDE_MAX_SIZE)
return (DECKERROR_SIDECOUNT << 28) | (unsigned)deck.side.size();
auto list = GetLFListContent(lfhash);
if (!list)
auto lflist = GetLFList(lfhash);
if (!lflist)
return 0;
auto& list = lflist->content;
const unsigned int rule_map[6] = { AVAIL_OCG, AVAIL_TCG, AVAIL_SC, AVAIL_CUSTOM, AVAIL_OCGTCG, 0 };
unsigned int avail = 0;
if (rule >= 0 && rule < (int)(sizeof rule_map / sizeof rule_map[0]))
......@@ -105,8 +103,8 @@ unsigned int DeckManager::CheckDeck(Deck& deck, int lfhash, int rule) {
int dc = ccount[code];
if(dc > 3)
return (DECKERROR_CARDCOUNT << 28) | cit->first;
auto it = list->find(code);
if(it != list->end() && dc > it->second)
auto it = list.find(code);
if(it != list.end() && dc > it->second)
return (DECKERROR_LFLIST << 28) | cit->first;
}
for (auto& cit : deck.extra) {
......@@ -120,8 +118,8 @@ unsigned int DeckManager::CheckDeck(Deck& deck, int lfhash, int rule) {
int dc = ccount[code];
if(dc > 3)
return (DECKERROR_CARDCOUNT << 28) | cit->first;
auto it = list->find(code);
if(it != list->end() && dc > it->second)
auto it = list.find(code);
if(it != list.end() && dc > it->second)
return (DECKERROR_LFLIST << 28) | cit->first;
}
for (auto& cit : deck.side) {
......@@ -135,8 +133,8 @@ unsigned int DeckManager::CheckDeck(Deck& deck, int lfhash, int rule) {
int dc = ccount[code];
if(dc > 3)
return (DECKERROR_CARDCOUNT << 28) | cit->first;
auto it = list->find(code);
if(it != list->end() && dc > it->second)
auto it = list.find(code);
if(it != list.end() && dc > it->second)
return (DECKERROR_LFLIST << 28) | cit->first;
}
return 0;
......@@ -198,7 +196,7 @@ int DeckManager::LoadDeck(Deck& deck, std::istringstream& deckStream, bool is_pa
if (linebuf[0] < '0' || linebuf[0] > '9')
continue;
errno = 0;
code = strtol(linebuf.c_str(), nullptr, 10);
code = std::strtol(linebuf.c_str(), nullptr, 10);
if (errno == ERANGE)
continue;
cardlist[ct++] = code;
......@@ -281,7 +279,7 @@ irr::io::IReadFile* DeckManager::OpenDeckReader(const wchar_t* file) {
}
bool DeckManager::LoadCurrentDeck(const wchar_t* file, bool is_packlist) {
current_deck.clear();
IReadFile* reader = OpenDeckReader(file);
auto reader = OpenDeckReader(file);
if(!reader) {
wchar_t localfile[256];
myswprintf(localfile, L"./deck/%ls.ydk", file);
......
......@@ -16,7 +16,7 @@ namespace ygo {
struct LFList {
unsigned int hash{};
std::wstring listName;
std::unordered_map<int, int> content;
std::unordered_map<unsigned int, int> content;
};
struct Deck {
std::vector<code_pointer> main;
......@@ -44,8 +44,8 @@ public:
void LoadLFListSingle(const char* path);
void LoadLFList();
const wchar_t* GetLFListName(int lfhash);
const std::unordered_map<int, int>* GetLFListContent(int lfhash);
const wchar_t* GetLFListName(unsigned int lfhash);
const LFList* GetLFList(unsigned int lfhash);
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, std::istringstream& deckStream, bool is_packlist = false);
......
......@@ -50,7 +50,7 @@ void Game::DrawSelectionLine(irr::video::S3DVertex* vec, bool strip, int width,
}
}
void Game::DrawSelectionLine(irr::gui::IGUIElement* element, int width, irr::video::SColor color) {
recti pos = element->getAbsolutePosition();
irr::core::recti pos = element->getAbsolutePosition();
float x1 = pos.UpperLeftCorner.X;
float x2 = pos.LowerRightCorner.X;
float y1 = pos.UpperLeftCorner.Y;
......@@ -58,22 +58,22 @@ void Game::DrawSelectionLine(irr::gui::IGUIElement* element, int width, irr::vid
float w = pos.getWidth();
float h = pos.getHeight();
if(linePatternD3D < 15) {
driver->draw2DRectangle(color, recti(x1 - 1 - width, y1 - 1 - width, x1 + (w * (linePatternD3D + 1) / 15.0) + 1 + width, y1 - 1));
driver->draw2DRectangle(color, recti(x2 - (w * (linePatternD3D + 1) / 15.0) - 1 - width, y2 + 1, x2 + 1 + width, y2 + 1 + width));
driver->draw2DRectangle(color, recti(x1 - 1 - width, y1 - 1 - width, x1 - 1, y2 - (h * (linePatternD3D + 1) / 15.0) + 1 + width));
driver->draw2DRectangle(color, recti(x2 + 1, y1 + (h * (linePatternD3D + 1) / 15.0) - 1 - width, x2 + 1 + width, y2 + 1 + width));
driver->draw2DRectangle(color, irr::core::recti(x1 - 1 - width, y1 - 1 - width, x1 + (w * (linePatternD3D + 1) / 15.0) + 1 + width, y1 - 1));
driver->draw2DRectangle(color, irr::core::recti(x2 - (w * (linePatternD3D + 1) / 15.0) - 1 - width, y2 + 1, x2 + 1 + width, y2 + 1 + width));
driver->draw2DRectangle(color, irr::core::recti(x1 - 1 - width, y1 - 1 - width, x1 - 1, y2 - (h * (linePatternD3D + 1) / 15.0) + 1 + width));
driver->draw2DRectangle(color, irr::core::recti(x2 + 1, y1 + (h * (linePatternD3D + 1) / 15.0) - 1 - width, x2 + 1 + width, y2 + 1 + width));
} else {
driver->draw2DRectangle(color, recti(x1 - 1 - width + (w * (linePatternD3D - 14) / 15.0), y1 - 1 - width, x2 + 1 + width, y1 - 1));
driver->draw2DRectangle(color, recti(x1 - 1 - width, y2 + 1, x2 - (w * (linePatternD3D - 14) / 15.0) + 1 + width, y2 + 1 + width));
driver->draw2DRectangle(color, recti(x1 - 1 - width, y2 - (h * (linePatternD3D - 14) / 15.0) - 1 - width, x1 - 1, y2 + 1 + width));
driver->draw2DRectangle(color, recti(x2 + 1, y1 - 1 - width, x2 + 1 + width, y1 + (h * (linePatternD3D - 14) / 15.0) + 1 + width));
driver->draw2DRectangle(color, irr::core::recti(x1 - 1 - width + (w * (linePatternD3D - 14) / 15.0), y1 - 1 - width, x2 + 1 + width, y1 - 1));
driver->draw2DRectangle(color, irr::core::recti(x1 - 1 - width, y2 + 1, x2 - (w * (linePatternD3D - 14) / 15.0) + 1 + width, y2 + 1 + width));
driver->draw2DRectangle(color, irr::core::recti(x1 - 1 - width, y2 - (h * (linePatternD3D - 14) / 15.0) - 1 - width, x1 - 1, y2 + 1 + width));
driver->draw2DRectangle(color, irr::core::recti(x2 + 1, y1 - 1 - width, x2 + 1 + width, y1 + (h * (linePatternD3D - 14) / 15.0) + 1 + width));
}
}
void Game::DrawBackGround() {
static int selFieldAlpha = 255;
static int selFieldDAlpha = -10;
// matrix4 im = irr::core::IdentityMatrix;
// im.setTranslation(vector3df(0, 0, -0.01f));
// im.setTranslation(irr::core::vector3df(0, 0, -0.01f));
// driver->setTransform(irr::video::ETS_WORLD, im);
//dark shade
// matManager.mSelField.AmbientColor = 0xff000000;
......@@ -98,7 +98,7 @@ void Game::DrawBackGround() {
fieldcode2 = dField.szone[1][5]->code;
int fieldcode = (fieldcode1 > 0) ? fieldcode1 : fieldcode2;
if(fieldcode1 > 0 && fieldcode2 > 0 && fieldcode1 != fieldcode2) {
ITexture* texture = imageManager.GetTextureField(fieldcode1);
auto texture = imageManager.GetTextureField(fieldcode1);
if(texture) {
drawField = true;
matManager.mTexture.setTexture(0, texture);
......@@ -113,7 +113,7 @@ void Game::DrawBackGround() {
driver->drawVertexPrimitiveList(matManager.vFieldSpell2, 4, matManager.iRectangle, 2);
}
} else if(fieldcode > 0) {
ITexture* texture = imageManager.GetTextureField(fieldcode);
auto texture = imageManager.GetTextureField(fieldcode);
if(texture) {
drawField = true;
matManager.mTexture.setTexture(0, texture);
......@@ -186,7 +186,7 @@ void Game::DrawBackGround() {
if (dField.hovered_location != 0 && dField.hovered_location != 2 && dField.hovered_location != POSITION_HINT
&& !(dInfo.duel_rule < 4 && dField.hovered_location == LOCATION_MZONE && dField.hovered_sequence > 4)
&& !(dInfo.duel_rule >= 4 && dField.hovered_location == LOCATION_SZONE && dField.hovered_sequence > 5)) {
S3DVertex *vertex = 0;
irr::video::S3DVertex* vertex = 0;
if (dField.hovered_location == LOCATION_DECK)
vertex = matManager.vFieldDeck[dField.hovered_controler];
else if (dField.hovered_location == LOCATION_MZONE) {
......@@ -406,16 +406,16 @@ void Game::DrawCard(ClientCard* pcard) {
matManager.mTexture.setTexture(0, imageManager.tAttack);
driver->setMaterial(matManager.mTexture);
irr::core::matrix4 atk;
atk.setTranslation(pcard->curPos + vector3df(0, (pcard->controler == 0 ? -1 : 1) * (atkdy / 4.0f + 0.35f), 0.05f));
atk.setRotationRadians(vector3df(0, 0, pcard->controler == 0 ? 0 : 3.1415926f));
atk.setTranslation(pcard->curPos + irr::core::vector3df(0, (pcard->controler == 0 ? -1 : 1) * (atkdy / 4.0f + 0.35f), 0.05f));
atk.setRotationRadians(irr::core::vector3df(0, 0, pcard->controler == 0 ? 0 : 3.1415926f));
driver->setTransform(irr::video::ETS_WORLD, atk);
driver->drawVertexPrimitiveList(matManager.vSymbol, 4, matManager.iRectangle, 2);
}
}
template<typename T>
void Game::DrawShadowText(irr::gui::CGUITTFont* font, const T& text, const core::rect<s32>& position, const core::rect<s32>& padding,
video::SColor color, video::SColor shadowcolor, bool hcenter, bool vcenter, const core::rect<s32>* clip) {
core::rect<s32> shadowposition = recti(position.UpperLeftCorner.X - padding.UpperLeftCorner.X, position.UpperLeftCorner.Y - padding.UpperLeftCorner.Y,
void Game::DrawShadowText(irr::gui::CGUITTFont* font, const T& text, const irr::core::rect<irr::s32>& position, const irr::core::rect<irr::s32>& padding,
irr::video::SColor color, irr::video::SColor shadowcolor, bool hcenter, bool vcenter, const irr::core::rect<irr::s32>* clip) {
irr::core::rect<irr::s32> shadowposition = irr::core::recti(position.UpperLeftCorner.X - padding.UpperLeftCorner.X, position.UpperLeftCorner.Y - padding.UpperLeftCorner.Y,
position.LowerRightCorner.X - padding.LowerRightCorner.X, position.LowerRightCorner.Y - padding.LowerRightCorner.Y);
font->drawUstring(text, shadowposition, shadowcolor, hcenter, vcenter, clip);
font->drawUstring(text, position, color, hcenter, vcenter, clip);
......@@ -429,45 +429,45 @@ void Game::DrawMisc() {
matManager.mTexture.setTexture(0, imageManager.tAct);
driver->setMaterial(matManager.mTexture);
if(dField.deck_act) {
im.setTranslation(vector3df((matManager.vFieldDeck[0][0].Pos.X + matManager.vFieldDeck[0][1].Pos.X) / 2,
im.setTranslation(irr::core::vector3df((matManager.vFieldDeck[0][0].Pos.X + matManager.vFieldDeck[0][1].Pos.X) / 2,
(matManager.vFieldDeck[0][0].Pos.Y + matManager.vFieldDeck[0][2].Pos.Y) / 2, dField.deck[0].size() * 0.01f + 0.02f));
driver->setTransform(irr::video::ETS_WORLD, im);
driver->drawVertexPrimitiveList(matManager.vActivate, 4, matManager.iRectangle, 2);
}
if(dField.grave_act) {
im.setTranslation(vector3df((matManager.vFieldGrave[0][rule][0].Pos.X + matManager.vFieldGrave[0][rule][1].Pos.X) / 2,
im.setTranslation(irr::core::vector3df((matManager.vFieldGrave[0][rule][0].Pos.X + matManager.vFieldGrave[0][rule][1].Pos.X) / 2,
(matManager.vFieldGrave[0][rule][0].Pos.Y + matManager.vFieldGrave[0][rule][2].Pos.Y) / 2, dField.grave[0].size() * 0.01f + 0.02f));
driver->setTransform(irr::video::ETS_WORLD, im);
driver->drawVertexPrimitiveList(matManager.vActivate, 4, matManager.iRectangle, 2);
}
if(dField.remove_act) {
im.setTranslation(vector3df((matManager.vFieldRemove[0][rule][0].Pos.X + matManager.vFieldRemove[0][rule][1].Pos.X) / 2,
im.setTranslation(irr::core::vector3df((matManager.vFieldRemove[0][rule][0].Pos.X + matManager.vFieldRemove[0][rule][1].Pos.X) / 2,
(matManager.vFieldRemove[0][rule][0].Pos.Y + matManager.vFieldRemove[0][rule][2].Pos.Y) / 2, dField.remove[0].size() * 0.01f + 0.02f));
driver->setTransform(irr::video::ETS_WORLD, im);
driver->drawVertexPrimitiveList(matManager.vActivate, 4, matManager.iRectangle, 2);
}
if(dField.extra_act) {
im.setTranslation(vector3df((matManager.vFieldExtra[0][0].Pos.X + matManager.vFieldExtra[0][1].Pos.X) / 2,
im.setTranslation(irr::core::vector3df((matManager.vFieldExtra[0][0].Pos.X + matManager.vFieldExtra[0][1].Pos.X) / 2,
(matManager.vFieldExtra[0][0].Pos.Y + matManager.vFieldExtra[0][2].Pos.Y) / 2, dField.extra[0].size() * 0.01f + 0.02f));
driver->setTransform(irr::video::ETS_WORLD, im);
driver->drawVertexPrimitiveList(matManager.vActivate, 4, matManager.iRectangle, 2);
}
if(dField.pzone_act[0]) {
int seq = dInfo.duel_rule >= 4 ? 0 : 6;
im.setTranslation(vector3df((matManager.vFieldSzone[0][seq][rule][0].Pos.X + matManager.vFieldSzone[0][seq][rule][1].Pos.X) / 2,
im.setTranslation(irr::core::vector3df((matManager.vFieldSzone[0][seq][rule][0].Pos.X + matManager.vFieldSzone[0][seq][rule][1].Pos.X) / 2,
(matManager.vFieldSzone[0][seq][rule][0].Pos.Y + matManager.vFieldSzone[0][seq][rule][2].Pos.Y) / 2, 0.03f));
driver->setTransform(irr::video::ETS_WORLD, im);
driver->drawVertexPrimitiveList(matManager.vActivate, 4, matManager.iRectangle, 2);
}
if(dField.pzone_act[1]) {
int seq = dInfo.duel_rule >= 4 ? 0 : 6;
im.setTranslation(vector3df((matManager.vFieldSzone[1][seq][rule][0].Pos.X + matManager.vFieldSzone[1][seq][rule][1].Pos.X) / 2,
im.setTranslation(irr::core::vector3df((matManager.vFieldSzone[1][seq][rule][0].Pos.X + matManager.vFieldSzone[1][seq][rule][1].Pos.X) / 2,
(matManager.vFieldSzone[1][seq][rule][0].Pos.Y + matManager.vFieldSzone[1][seq][rule][2].Pos.Y) / 2, 0.03f));
driver->setTransform(irr::video::ETS_WORLD, im);
driver->drawVertexPrimitiveList(matManager.vActivate, 4, matManager.iRectangle, 2);
}
if(dField.conti_act) {
irr::core::vector3df pos = vector3df((matManager.vFieldContiAct[0].X + matManager.vFieldContiAct[1].X) / 2,
irr::core::vector3df pos = irr::core::vector3df((matManager.vFieldContiAct[0].X + matManager.vFieldContiAct[1].X) / 2,
(matManager.vFieldContiAct[0].Y + matManager.vFieldContiAct[2].Y) / 2, 0);
im.setRotationRadians(irr::core::vector3df(0, 0, 0));
for(auto cit = dField.conti_cards.begin(); cit != dField.conti_cards.end(); ++cit) {
......@@ -498,10 +498,10 @@ void Game::DrawMisc() {
it.setScale(0.6f);
it.setTranslation(dField.chains[i].chain_pos);
matManager.mTRTexture.setTexture(0, imageManager.tNumber);
matManager.vChainNum[0].TCoords = vector2df(0.19375f * (i % 5), 0.2421875f * (i / 5));
matManager.vChainNum[1].TCoords = vector2df(0.19375f * (i % 5 + 1), 0.2421875f * (i / 5));
matManager.vChainNum[2].TCoords = vector2df(0.19375f * (i % 5), 0.2421875f * (i / 5 + 1));
matManager.vChainNum[3].TCoords = vector2df(0.19375f * (i % 5 + 1), 0.2421875f * (i / 5 + 1));
matManager.vChainNum[0].TCoords = irr::core::vector2df(0.19375f * (i % 5), 0.2421875f * (i / 5));
matManager.vChainNum[1].TCoords = irr::core::vector2df(0.19375f * (i % 5 + 1), 0.2421875f * (i / 5));
matManager.vChainNum[2].TCoords = irr::core::vector2df(0.19375f * (i % 5), 0.2421875f * (i / 5 + 1));
matManager.vChainNum[3].TCoords = irr::core::vector2df(0.19375f * (i % 5 + 1), 0.2421875f * (i / 5 + 1));
driver->setMaterial(matManager.mTRTexture);
driver->setTransform(irr::video::ETS_WORLD, it);
driver->drawVertexPrimitiveList(matManager.vChainNum, 4, matManager.iRectangle, 2);
......@@ -510,11 +510,11 @@ void Game::DrawMisc() {
if(dField.cant_check_grave) {
matManager.mTexture.setTexture(0, imageManager.tNegated);
driver->setMaterial(matManager.mTexture);
ig.setTranslation(vector3df((matManager.vFieldGrave[0][rule][0].Pos.X + matManager.vFieldGrave[0][rule][1].Pos.X) / 2,
ig.setTranslation(irr::core::vector3df((matManager.vFieldGrave[0][rule][0].Pos.X + matManager.vFieldGrave[0][rule][1].Pos.X) / 2,
(matManager.vFieldGrave[0][rule][0].Pos.Y + matManager.vFieldGrave[0][rule][2].Pos.Y) / 2, dField.grave[0].size() * 0.01f + 0.02f));
driver->setTransform(irr::video::ETS_WORLD, ig);
driver->drawVertexPrimitiveList(matManager.vNegate, 4, matManager.iRectangle, 2);
ig.setTranslation(vector3df((matManager.vFieldGrave[1][rule][0].Pos.X + matManager.vFieldGrave[1][rule][1].Pos.X) / 2,
ig.setTranslation(irr::core::vector3df((matManager.vFieldGrave[1][rule][0].Pos.X + matManager.vFieldGrave[1][rule][1].Pos.X) / 2,
(matManager.vFieldGrave[1][rule][0].Pos.Y + matManager.vFieldGrave[1][rule][2].Pos.Y) / 2, dField.grave[1].size() * 0.01f + 0.02f));
driver->setTransform(irr::video::ETS_WORLD, ig);
driver->drawVertexPrimitiveList(matManager.vNegate, 4, matManager.iRectangle, 2);
......@@ -532,8 +532,8 @@ void Game::DrawMisc() {
driver->draw2DRectangle(0xa0000000, Resize(689, 8, 991, 51));
driver->draw2DRectangleOutline(Resize(689, 8, 991, 51), 0xffff8080);
}
driver->draw2DImage(imageManager.tLPFrame, Resize(330, 10, 629, 30), recti(0, 0, 200, 20), 0, 0, true);
driver->draw2DImage(imageManager.tLPFrame, Resize(691, 10, 990, 30), recti(0, 0, 200, 20), 0, 0, true);
driver->draw2DImage(imageManager.tLPFrame, Resize(330, 10, 629, 30), irr::core::recti(0, 0, 200, 20), 0, 0, true);
driver->draw2DImage(imageManager.tLPFrame, Resize(691, 10, 990, 30), irr::core::recti(0, 0, 200, 20), 0, 0, true);
if(dInfo.start_lp) {
auto maxLP = dInfo.isTag ? dInfo.start_lp / 2 : dInfo.start_lp;
if(dInfo.lp[0] >= maxLP) {
......@@ -541,23 +541,23 @@ void Game::DrawMisc() {
auto partialLP = dInfo.lp[0] % maxLP;
auto bgColorPos = (layerCount - 1) % 5;
auto fgColorPos = layerCount % 5;
driver->draw2DImage(imageManager.tLPBar, Resize(335 + 290 * partialLP / maxLP, 12, 625, 28), recti(0, bgColorPos * 16, 16, (bgColorPos + 1) * 16), 0, 0, true);
driver->draw2DImage(imageManager.tLPBar, Resize(335 + 290 * partialLP / maxLP, 12, 625, 28), irr::core::recti(0, bgColorPos * 16, 16, (bgColorPos + 1) * 16), 0, 0, true);
if(partialLP > 0) {
driver->draw2DImage(imageManager.tLPBar, Resize(335, 12, 335 + 290 * partialLP / maxLP, 28), recti(0, fgColorPos * 16, 16, (fgColorPos + 1) * 16), 0, 0, true);
driver->draw2DImage(imageManager.tLPBar, Resize(335, 12, 335 + 290 * partialLP / maxLP, 28), irr::core::recti(0, fgColorPos * 16, 16, (fgColorPos + 1) * 16), 0, 0, true);
}
}
else driver->draw2DImage(imageManager.tLPBar, Resize(335, 12, 335 + 290 * dInfo.lp[0] / maxLP, 28), recti(0, 0, 16, 16), 0, 0, true);
else driver->draw2DImage(imageManager.tLPBar, Resize(335, 12, 335 + 290 * dInfo.lp[0] / maxLP, 28), irr::core::recti(0, 0, 16, 16), 0, 0, true);
if(dInfo.lp[1] >= maxLP) {
auto layerCount = dInfo.lp[1] / maxLP;
auto partialLP = dInfo.lp[1] % maxLP;
auto bgColorPos = (layerCount - 1) % 5;
auto fgColorPos = layerCount % 5;
driver->draw2DImage(imageManager.tLPBar, Resize(696, 12, 986 - 290 * partialLP / maxLP, 28), recti(0, bgColorPos * 16, 16, (bgColorPos + 1) * 16), 0, 0, true);
driver->draw2DImage(imageManager.tLPBar, Resize(696, 12, 986 - 290 * partialLP / maxLP, 28), irr::core::recti(0, bgColorPos * 16, 16, (bgColorPos + 1) * 16), 0, 0, true);
if(partialLP > 0) {
driver->draw2DImage(imageManager.tLPBar, Resize(986 - 290 * partialLP / maxLP, 12, 986, 28), recti(0, fgColorPos * 16, 16, (fgColorPos + 1) * 16), 0, 0, true);
driver->draw2DImage(imageManager.tLPBar, Resize(986 - 290 * partialLP / maxLP, 12, 986, 28), irr::core::recti(0, fgColorPos * 16, 16, (fgColorPos + 1) * 16), 0, 0, true);
}
}
else driver->draw2DImage(imageManager.tLPBar, Resize(986 - 290 * dInfo.lp[1] / maxLP, 12, 986, 28), recti(0, 0, 16, 16), 0, 0, true);
else driver->draw2DImage(imageManager.tLPBar, Resize(986 - 290 * dInfo.lp[1] / maxLP, 12, 986, 28), irr::core::recti(0, 0, 16, 16), 0, 0, true);
}
if(lpframe) {
dInfo.lp[lpplayer] -= lpd;
......@@ -582,8 +582,8 @@ void Game::DrawMisc() {
DrawShadowText(numFont, dInfo.strLP[1], Resize(691, 12, 992, 30), Resize(0, 1, 2, 0), 0xffffff00, 0xff000000, true, false, 0);
if(!gameConf.hide_player_name) {
recti p1size = Resize(335, 31, 629, 50);
recti p2size = Resize(986, 31, 986, 50);
irr::core::recti p1size = Resize(335, 31, 629, 50);
irr::core::recti p2size = Resize(986, 31, 986, 50);
if(!dInfo.isTag || !dInfo.tag_player[0])
textFont->drawUstring(dInfo.hostname, p1size, 0xffffffff, false, false, 0);
else
......@@ -808,14 +808,14 @@ void Game::DrawGUI() {
env->drawAll();
}
void Game::DrawSpec() {
s32 midx = 574 + (CARD_IMG_WIDTH * 0.5);
s32 midy = 150 + (CARD_IMG_HEIGHT * 0.5);
irr::s32 midx = 574 + (CARD_IMG_WIDTH * 0.5);
irr::s32 midy = 150 + (CARD_IMG_HEIGHT * 0.5);
if(showcard) {
switch(showcard) {
case 1: {
driver->draw2DImage(imageManager.GetTexture(showcardcode, true), ResizeCardHint(574, 150));
driver->draw2DImage(imageManager.tMask, ResizeCardMid(574, 150, 574 + (showcarddif > CARD_IMG_WIDTH ? CARD_IMG_WIDTH : showcarddif), 150 + CARD_IMG_HEIGHT, midx, midy),
recti(CARD_IMG_HEIGHT - showcarddif, 0, CARD_IMG_HEIGHT - (showcarddif > CARD_IMG_WIDTH ? showcarddif - CARD_IMG_WIDTH : 0), CARD_IMG_HEIGHT), 0, 0, true);
irr::core::recti(CARD_IMG_HEIGHT - showcarddif, 0, CARD_IMG_HEIGHT - (showcarddif > CARD_IMG_WIDTH ? showcarddif - CARD_IMG_WIDTH : 0), CARD_IMG_HEIGHT), 0, 0, true);
showcarddif += 15;
if(showcarddif >= CARD_IMG_HEIGHT) {
showcard = 2;
......@@ -826,7 +826,7 @@ void Game::DrawSpec() {
case 2: {
driver->draw2DImage(imageManager.GetTexture(showcardcode, true), ResizeCardHint(574, 150));
driver->draw2DImage(imageManager.tMask, ResizeCardMid(574 + showcarddif, 150, 574 + CARD_IMG_WIDTH, 150 + CARD_IMG_HEIGHT, midx, midy),
recti(0, 0, CARD_IMG_WIDTH - showcarddif, CARD_IMG_HEIGHT), 0, 0, true);
irr::core::recti(0, 0, CARD_IMG_WIDTH - showcarddif, CARD_IMG_HEIGHT), 0, 0, true);
showcarddif += 15;
if(showcarddif >= CARD_IMG_WIDTH) {
showcard = 0;
......@@ -835,7 +835,7 @@ void Game::DrawSpec() {
}
case 3: {
driver->draw2DImage(imageManager.GetTexture(showcardcode, true), ResizeCardHint(574, 150));
driver->draw2DImage(imageManager.tNegated, ResizeCardMid(536 + showcarddif, 141 + showcarddif, 792 - showcarddif, 397 - showcarddif, midx, midy), recti(0, 0, 128, 128), 0, 0, true);
driver->draw2DImage(imageManager.tNegated, ResizeCardMid(536 + showcarddif, 141 + showcarddif, 792 - showcarddif, 397 - showcarddif, midx, midy), irr::core::recti(0, 0, 128, 128), 0, 0, true);
if(showcarddif < 64)
showcarddif += 4;
break;
......@@ -865,7 +865,7 @@ void Game::DrawSpec() {
case 6: {
driver->draw2DImage(imageManager.GetTexture(showcardcode, true), ResizeCardHint(574, 150));
driver->draw2DImage(imageManager.tNumber, ResizeCardMid(536 + showcarddif, 141 + showcarddif, 792 - showcarddif, 397 - showcarddif, midx, midy),
recti((showcardp % 5) * 64, (showcardp / 5) * 64, (showcardp % 5 + 1) * 64, (showcardp / 5 + 1) * 64), 0, 0, true);
irr::core::recti((showcardp % 5) * 64, (showcardp / 5) * 64, (showcardp % 5 + 1) * 64, (showcardp / 5 + 1) * 64), 0, 0, true);
if(showcarddif < 64)
showcarddif += 4;
break;
......@@ -874,15 +874,15 @@ void Game::DrawSpec() {
float mul = xScale;
if(xScale > yScale)
mul = yScale;
irr::core::vector2d<s32> corner[4];
irr::core::vector2d<irr::s32> corner[4];
float y = sin(showcarddif * 3.1415926f / 180.0f) * CARD_IMG_HEIGHT * mul;
s32 winx = midx * xScale + (574 - midx) * mul;
s32 winx2 = midx * xScale + (751 - midx) * mul;
s32 winy = midy * yScale + (404 - midy) * mul;
corner[0] = irr::core::vector2d<s32>(winx - (CARD_IMG_HEIGHT * mul - y) * 0.3f, winy - y);
corner[1] = irr::core::vector2d<s32>(winx2 + (CARD_IMG_HEIGHT * mul - y) * 0.3f, winy - y);
corner[2] = irr::core::vector2d<s32>(winx, winy);
corner[3] = irr::core::vector2d<s32>(winx2, winy);
irr::s32 winx = midx * xScale + (574 - midx) * mul;
irr::s32 winx2 = midx * xScale + (751 - midx) * mul;
irr::s32 winy = midy * yScale + (404 - midy) * mul;
corner[0] = irr::core::vector2d<irr::s32>(winx - (CARD_IMG_HEIGHT * mul - y) * 0.3f, winy - y);
corner[1] = irr::core::vector2d<irr::s32>(winx2 + (CARD_IMG_HEIGHT * mul - y) * 0.3f, winy - y);
corner[2] = irr::core::vector2d<irr::s32>(winx, winy);
corner[3] = irr::core::vector2d<irr::s32>(winx2, winy);
irr::gui::Draw2DImageQuad(driver, imageManager.GetTexture(showcardcode, true), ResizeFit(0, 0, CARD_IMG_WIDTH, CARD_IMG_HEIGHT), corner);
showcardp++;
showcarddif += 9;
......@@ -980,7 +980,7 @@ void Game::DrawSpec() {
matk.setRotationRadians(atk_r);
driver->setTransform(irr::video::ETS_WORLD, matk);
driver->setMaterial(matManager.mATK);
driver->drawVertexPrimitiveList(&matManager.vArrow[attack_sv], 12, matManager.iArrow, 10, EVT_STANDARD, EPT_TRIANGLE_STRIP);
driver->drawVertexPrimitiveList(&matManager.vArrow[attack_sv], 12, matManager.iArrow, 10, irr::video::EVT_STANDARD, irr::scene::EPT_TRIANGLE_STRIP);
attack_sv += 4;
if (attack_sv > 28)
attack_sv = 0;
......@@ -1018,9 +1018,9 @@ void Game::DrawSpec() {
int w = guiFont->getDimension(msg).Width;
int h = guiFont->getDimension(msg).Height + 2;
recti rectloc(x, y - chatRectY - h, x + 2 + w, y - chatRectY);
recti msgloc(x, y - chatRectY - h, x - 4, y - chatRectY);
recti shadowloc = msgloc + irr::core::vector2di(1, 1);
irr::core::recti rectloc(x, y - chatRectY - h, x + 2 + w, y - chatRectY);
irr::core::recti msgloc(x, y - chatRectY - h, x - 4, y - chatRectY);
irr::core::recti shadowloc = msgloc + irr::core::vector2di(1, 1);
driver->draw2DRectangle(rectloc, 0xa0000000, 0xa0000000, 0xa0000000, 0xa0000000);
guiFont->drawUstring(msg, msgloc, 0xff000000, false, false);
......@@ -1033,7 +1033,7 @@ void Game::DrawSpec() {
void Game::DrawBackImage(irr::video::ITexture* texture) {
if(!texture)
return;
driver->draw2DImage(texture, Resize(0, 0, 1024, 640), recti(0, 0, texture->getOriginalSize().Width, texture->getOriginalSize().Height));
driver->draw2DImage(texture, Resize(0, 0, 1024, 640), irr::core::recti(0, 0, texture->getOriginalSize().Width, texture->getOriginalSize().Height));
}
void Game::ShowElement(irr::gui::IGUIElement * win, int autoframe) {
FadingUnit fu;
......@@ -1126,34 +1126,35 @@ void Game::WaitFrameSignal(int frame) {
signalFrame = (gameConf.quick_animation && frame >= 12) ? 12 : frame;
frameSignal.Wait();
}
void Game::DrawThumb(code_pointer cp, irr::core::vector2di pos, const std::unordered_map<int,int>* lflist, bool drag) {
void Game::DrawThumb(code_pointer cp, irr::core::vector2di pos, const LFList* lflist, bool drag) {
int code = cp->first;
int lcode = cp->second.alias;
auto lcode = cp->second.alias;
if(lcode == 0)
lcode = code;
irr::video::ITexture* img = imageManager.GetTextureThumb(code);
if(img == nullptr)
return; //nullptr->getSize() will cause a crash
dimension2d<u32> size = img->getOriginalSize();
recti dragloc = mainGame->Resize(pos.X, pos.Y, pos.X + CARD_THUMB_WIDTH, pos.Y + CARD_THUMB_HEIGHT);
recti limitloc = mainGame->Resize(pos.X, pos.Y, pos.X + 20, pos.Y + 20);
recti otloc = Resize(pos.X + 7, pos.Y + 50, pos.X + 37, pos.Y + 65);
irr::core::dimension2d<irr::u32> size = img->getOriginalSize();
irr::core::recti dragloc = mainGame->Resize(pos.X, pos.Y, pos.X + CARD_THUMB_WIDTH, pos.Y + CARD_THUMB_HEIGHT);
irr::core::recti limitloc = mainGame->Resize(pos.X, pos.Y, pos.X + 20, pos.Y + 20);
irr::core::recti otloc = Resize(pos.X + 7, pos.Y + 50, pos.X + 37, pos.Y + 65);
if(drag) {
dragloc = recti(pos.X, pos.Y, pos.X + CARD_THUMB_WIDTH * mainGame->xScale, pos.Y + CARD_THUMB_HEIGHT * mainGame->yScale);
limitloc = recti(pos.X, pos.Y, pos.X + 20 * mainGame->xScale, pos.Y + 20 * mainGame->yScale);
otloc = recti(pos.X + 7, pos.Y + 50 * mainGame->yScale, pos.X + 37 * mainGame->xScale, pos.Y + 65 * mainGame->yScale);
}
driver->draw2DImage(img, dragloc, rect<s32>(0, 0, size.Width, size.Height));
if(lflist->count(lcode)) {
switch((*lflist).at(lcode)) {
dragloc = irr::core::recti(pos.X, pos.Y, pos.X + CARD_THUMB_WIDTH * mainGame->xScale, pos.Y + CARD_THUMB_HEIGHT * mainGame->yScale);
limitloc = irr::core::recti(pos.X, pos.Y, pos.X + 20 * mainGame->xScale, pos.Y + 20 * mainGame->yScale);
otloc = irr::core::recti(pos.X + 7, pos.Y + 50 * mainGame->yScale, pos.X + 37 * mainGame->xScale, pos.Y + 65 * mainGame->yScale);
}
driver->draw2DImage(img, dragloc, irr::core::rect<irr::s32>(0, 0, size.Width, size.Height));
auto lfit = lflist->content.find(lcode);
if (lfit != lflist->content.end()) {
switch(lfit->second) {
case 0:
driver->draw2DImage(imageManager.tLim, limitloc, recti(0, 0, 64, 64), 0, 0, true);
driver->draw2DImage(imageManager.tLim, limitloc, irr::core::recti(0, 0, 64, 64), 0, 0, true);
break;
case 1:
driver->draw2DImage(imageManager.tLim, limitloc, recti(64, 0, 128, 64), 0, 0, true);
driver->draw2DImage(imageManager.tLim, limitloc, irr::core::recti(64, 0, 128, 64), 0, 0, true);
break;
case 2:
driver->draw2DImage(imageManager.tLim, limitloc, recti(0, 64, 64, 128), 0, 0, true);
driver->draw2DImage(imageManager.tLim, limitloc, irr::core::recti(0, 64, 64, 128), 0, 0, true);
break;
}
}
......@@ -1173,16 +1174,16 @@ void Game::DrawThumb(code_pointer cp, irr::core::vector2di pos, const std::unord
}
if(showAvail) {
if((cp->second.ot & AVAIL_OCG) && !(cp->second.ot & AVAIL_TCG))
driver->draw2DImage(imageManager.tOT, otloc, recti(0, 128, 128, 192), 0, 0, true);
driver->draw2DImage(imageManager.tOT, otloc, irr::core::recti(0, 128, 128, 192), 0, 0, true);
else if((cp->second.ot & AVAIL_TCG) && !(cp->second.ot & AVAIL_OCG))
driver->draw2DImage(imageManager.tOT, otloc, recti(0, 192, 128, 256), 0, 0, true);
driver->draw2DImage(imageManager.tOT, otloc, irr::core::recti(0, 192, 128, 256), 0, 0, true);
} else if(showNotAvail) {
if(cp->second.ot & AVAIL_OCG)
driver->draw2DImage(imageManager.tOT, otloc, recti(0, 0, 128, 64), 0, 0, true);
driver->draw2DImage(imageManager.tOT, otloc, irr::core::recti(0, 0, 128, 64), 0, 0, true);
else if(cp->second.ot & AVAIL_TCG)
driver->draw2DImage(imageManager.tOT, otloc, recti(0, 64, 128, 128), 0, 0, true);
driver->draw2DImage(imageManager.tOT, otloc, irr::core::recti(0, 64, 128, 128), 0, 0, true);
else if(!avail)
driver->draw2DImage(imageManager.tLim, otloc, recti(0, 0, 64, 64), 0, 0, true);
driver->draw2DImage(imageManager.tLim, otloc, irr::core::recti(0, 0, 64, 64), 0, 0, true);
}
}
void Game::DrawDeckBd() {
......
......@@ -500,9 +500,9 @@ void DuelClient::HandleSTOCPacketLan(unsigned char* data, int len) {
mainGame->dInfo.time_limit = pkt->info.time_limit;
mainGame->dInfo.time_left[0] = 0;
mainGame->dInfo.time_left[1] = 0;
mainGame->deckBuilder.filterList = deckManager.GetLFListContent(pkt->info.lflist);
mainGame->deckBuilder.filterList = deckManager.GetLFList(pkt->info.lflist);
if(mainGame->deckBuilder.filterList == nullptr)
mainGame->deckBuilder.filterList = &deckManager._lfList[0].content;
mainGame->deckBuilder.filterList = &deckManager._lfList[0];
mainGame->stHostPrepOB->setText(L"");
mainGame->SetStaticText(mainGame->stHostPrepRule, 180, mainGame->guiFont, str.c_str());
mainGame->RefreshCategoryDeck(mainGame->cbCategorySelect, mainGame->cbDeckSelect);
......@@ -1900,23 +1900,23 @@ bool DuelClient::ClientAnalyze(unsigned char* msg, int len) {
else startpos = 155;
if(positions & 0x1) {
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);
startpos += 145;
} else mainGame->btnPSAU->setVisible(false);
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);
startpos += 145;
} else mainGame->btnPSAD->setVisible(false);
if(positions & 0x4) {
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);
startpos += 145;
} else mainGame->btnPSDU->setVisible(false);
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);
startpos += 145;
} else mainGame->btnPSDD->setVisible(false);
......@@ -3428,11 +3428,11 @@ bool DuelClient::ClientAnalyze(unsigned char* msg, int len) {
float xd = mainGame->dField.attack_target->curPos.X;
float yd = mainGame->dField.attack_target->curPos.Y;
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)
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
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 {
soundManager.PlaySoundEffect(SOUND_DIRECT_ATTACK);
myswprintf(event_string, dataManager.GetSysString(1620), dataManager.GetName(mainGame->dField.attacker->code));
......@@ -3443,11 +3443,11 @@ bool DuelClient::ClientAnalyze(unsigned char* msg, int len) {
if (ca == 0)
yd = -3.5f;
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)
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
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)));
}
matManager.GenArrow(sy);
mainGame->attack_sv = 0;
......@@ -3672,9 +3672,9 @@ bool DuelClient::ClientAnalyze(unsigned char* msg, int len) {
mainGame->cbANNumber->setSelected(0);
if(quickmode) {
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);
recti pos = mainGame->wANNumber->getRelativePosition();
irr::core::recti pos = mainGame->wANNumber->getRelativePosition();
pos.LowerRightCorner.Y = pos.UpperLeftCorner.Y + 250;
mainGame->wANNumber->setRelativePosition(pos);
} else {
......@@ -3682,8 +3682,8 @@ bool DuelClient::ClientAnalyze(unsigned char* msg, int len) {
mainGame->btnANNumber[i]->setVisible(false);
}
mainGame->cbANNumber->setVisible(true);
mainGame->btnANNumberOK->setRelativePosition(rect<s32>(80, 60, 150, 85));
recti pos = mainGame->wANNumber->getRelativePosition();
mainGame->btnANNumberOK->setRelativePosition(irr::core::rect<irr::s32>(80, 60, 150, 85));
irr::core::recti pos = mainGame->wANNumber->getRelativePosition();
pos.LowerRightCorner.Y = pos.UpperLeftCorner.Y + 95;
mainGame->wANNumber->setRelativePosition(pos);
}
......
......@@ -53,7 +53,7 @@ public:
bufferevent_write(client_bev, duel_client_write, 3);
}
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;
if (sizeof(ST) > MAX_DATA_SIZE)
return;
......
......@@ -22,7 +22,7 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
case irr::EET_GUI_EVENT: {
if(mainGame->fadingList.size())
break;
s32 id = event.GUIEvent.Caller->getID();
irr::s32 id = event.GUIEvent.Caller->getID();
switch(event.GUIEvent.EventType) {
case irr::gui::EGET_BUTTON_CLICKED: {
switch(id) {
......@@ -898,7 +898,7 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
mainGame->btnCardSelect[i]->setImage(imageManager.GetTexture(selectable_cards[i + pos]->chain_code));
else
mainGame->btnCardSelect[i]->setImage(imageManager.tCover[selectable_cards[i + pos]->controler + 2]);
mainGame->btnCardSelect[i]->setRelativePosition(rect<s32>(30 + i * 125, 55, 30 + 120 + i * 125, 225));
mainGame->btnCardSelect[i]->setRelativePosition(irr::core::rect<irr::s32>(30 + i * 125, 55, 30 + 120 + i * 125, 225));
// text
wchar_t formatBuffer[2048];
if(mainGame->dInfo.curMsg == MSG_SORT_CARD) {
......@@ -961,7 +961,7 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
mainGame->btnCardDisplay[i]->setImage(imageManager.GetTexture(display_cards[i + pos]->code));
else
mainGame->btnCardDisplay[i]->setImage(imageManager.tCover[display_cards[i + pos]->controler + 2]);
mainGame->btnCardDisplay[i]->setRelativePosition(rect<s32>(30 + i * 125, 55, 30 + 120 + i * 125, 225));
mainGame->btnCardDisplay[i]->setRelativePosition(irr::core::rect<irr::s32>(30 + i * 125, 55, 30 + 120 + i * 125, 225));
wchar_t formatBuffer[2048];
if(display_cards[i + pos]->location == LOCATION_OVERLAY) {
myswprintf(formatBuffer, L"%ls[%d](%d)",
......@@ -1075,8 +1075,8 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
hovered_location = 0;
irr::core::vector2di pos = mainGame->ResizeReverse(event.MouseInput.X, event.MouseInput.Y);
irr::core::vector2di mousepos(event.MouseInput.X, event.MouseInput.Y);
s32 x = pos.X;
s32 y = pos.Y;
irr::s32 x = pos.X;
irr::s32 y = pos.Y;
if(x < 300)
break;
if(mainGame->gameConf.control_mode == 1) {
......@@ -1498,8 +1498,8 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
bool should_show_tip = false;
irr::core::vector2di pos = mainGame->ResizeReverse(event.MouseInput.X, event.MouseInput.Y);
irr::core::vector2di mousepos = irr::core::vector2di(event.MouseInput.X, event.MouseInput.Y);
s32 x = pos.X;
s32 y = pos.Y;
irr::s32 x = pos.X;
irr::s32 y = pos.Y;
wchar_t formatBuffer[2048];
if(x < 300) {
irr::gui::IGUIElement* root = mainGame->env->getRootGUIElement();
......@@ -1638,7 +1638,7 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
}
should_show_tip = true;
irr::core::dimension2d<unsigned int> dtip = mainGame->guiFont->getDimension(str.c_str()) + irr::core::dimension2d<unsigned int>(10, 10);
mainGame->stTip->setRelativePosition(recti(mousepos.X - 10 - dtip.Width, mousepos.Y - 10 - dtip.Height, mousepos.X - 10, mousepos.Y - 10));
mainGame->stTip->setRelativePosition(irr::core::recti(mousepos.X - 10 - dtip.Width, mousepos.Y - 10 - dtip.Height, mousepos.X - 10, mousepos.Y - 10));
mainGame->stTip->setText(str.c_str());
}
} else {
......@@ -1677,7 +1677,7 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
}
should_show_tip = true;
irr::core::dimension2d<unsigned int> dtip = mainGame->guiFont->getDimension(str.c_str()) + irr::core::dimension2d<unsigned int>(10, 10);
mainGame->stTip->setRelativePosition(recti(mousepos.X - 10 - dtip.Width, mousepos.Y + 10, mousepos.X - 10, mousepos.Y + 10 + dtip.Height));
mainGame->stTip->setRelativePosition(irr::core::recti(mousepos.X - 10 - dtip.Width, mousepos.Y + 10, mousepos.X - 10, mousepos.Y + 10 + dtip.Height));
mainGame->stTip->setText(str.c_str());
}
hovered_player = mplayer;
......@@ -1718,7 +1718,7 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
case irr::EET_KEY_INPUT_EVENT: {
switch(event.KeyInput.Key) {
case irr::KEY_KEY_A: {
if(mainGame->gameConf.control_mode == 0 && !mainGame->HasFocus(EGUIET_EDIT_BOX)) {
if(mainGame->gameConf.control_mode == 0 && !mainGame->HasFocus(irr::gui::EGUIET_EDIT_BOX)) {
mainGame->always_chain = event.KeyInput.PressedDown;
mainGame->ignore_chain = false;
mainGame->chain_when_avail = false;
......@@ -1727,7 +1727,7 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
break;
}
case irr::KEY_KEY_S: {
if(mainGame->gameConf.control_mode == 0 && !mainGame->HasFocus(EGUIET_EDIT_BOX)) {
if(mainGame->gameConf.control_mode == 0 && !mainGame->HasFocus(irr::gui::EGUIET_EDIT_BOX)) {
mainGame->ignore_chain = event.KeyInput.PressedDown;
mainGame->always_chain = false;
mainGame->chain_when_avail = false;
......@@ -1736,7 +1736,7 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
break;
}
case irr::KEY_KEY_D: {
if(mainGame->gameConf.control_mode == 0 && !mainGame->HasFocus(EGUIET_EDIT_BOX)) {
if(mainGame->gameConf.control_mode == 0 && !mainGame->HasFocus(irr::gui::EGUIET_EDIT_BOX)) {
mainGame->chain_when_avail = event.KeyInput.PressedDown;
mainGame->always_chain = false;
mainGame->ignore_chain = false;
......@@ -1753,7 +1753,7 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
case irr::KEY_F7:
case irr::KEY_F8: {
if(!event.KeyInput.PressedDown && !mainGame->dInfo.isReplay && mainGame->dInfo.player_type != 7 && mainGame->dInfo.isStarted
&& !mainGame->wCardDisplay->isVisible() && !mainGame->HasFocus(EGUIET_EDIT_BOX)) {
&& !mainGame->wCardDisplay->isVisible() && !mainGame->HasFocus(irr::gui::EGUIET_EDIT_BOX)) {
int loc_id = 0;
display_cards.clear();
switch(event.KeyInput.Key) {
......@@ -1830,22 +1830,22 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
bool ClientField::OnCommonEvent(const irr::SEvent& event) {
switch(event.EventType) {
case irr::EET_GUI_EVENT: {
s32 id = event.GUIEvent.Caller->getID();
irr::s32 id = event.GUIEvent.Caller->getID();
switch(event.GUIEvent.EventType) {
case irr::gui::EGET_ELEMENT_HOVERED: {
if(event.GUIEvent.Caller->getType() == EGUIET_EDIT_BOX) {
mainGame->SetCursor(event.GUIEvent.Caller->isEnabled() ? ECI_IBEAM : ECI_NORMAL);
if(event.GUIEvent.Caller->getType() == irr::gui::EGUIET_EDIT_BOX) {
mainGame->SetCursor(event.GUIEvent.Caller->isEnabled() ? irr::gui::ECI_IBEAM : irr::gui::ECI_NORMAL);
return true;
}
if(event.GUIEvent.Caller == mainGame->imgCard && mainGame->is_building && !mainGame->is_siding) {
mainGame->SetCursor(ECI_HAND);
mainGame->SetCursor(irr::gui::ECI_HAND);
return true;
}
break;
}
case irr::gui::EGET_ELEMENT_LEFT: {
if(event.GUIEvent.Caller->getType() == EGUIET_EDIT_BOX || event.GUIEvent.Caller == mainGame->imgCard) {
mainGame->SetCursor(ECI_NORMAL);
if(event.GUIEvent.Caller->getType() == irr::gui::EGUIET_EDIT_BOX || event.GUIEvent.Caller == mainGame->imgCard) {
mainGame->SetCursor(irr::gui::ECI_NORMAL);
return true;
}
break;
......@@ -1939,7 +1939,7 @@ bool ClientField::OnCommonEvent(const irr::SEvent& event) {
mainGame->cbLFlist->setEnabled(mainGame->gameConf.use_lflist);
mainGame->cbLFlist->setSelected(mainGame->gameConf.use_lflist ? mainGame->gameConf.default_lflist : mainGame->cbLFlist->getItemCount() - 1);
mainGame->cbHostLFlist->setSelected(mainGame->gameConf.use_lflist ? mainGame->gameConf.default_lflist : mainGame->cbHostLFlist->getItemCount() - 1);
mainGame->deckBuilder.filterList = &deckManager._lfList[mainGame->cbLFlist->getSelected()].content;
mainGame->deckBuilder.filterList = &deckManager._lfList[mainGame->cbLFlist->getSelected()];
return true;
break;
}
......@@ -1951,7 +1951,7 @@ bool ClientField::OnCommonEvent(const irr::SEvent& event) {
case COMBOBOX_LFLIST: {
mainGame->gameConf.default_lflist = mainGame->cbLFlist->getSelected();
mainGame->cbHostLFlist->setSelected(mainGame->gameConf.default_lflist);
mainGame->deckBuilder.filterList = &deckManager._lfList[mainGame->gameConf.default_lflist].content;
mainGame->deckBuilder.filterList = &deckManager._lfList[mainGame->gameConf.default_lflist];
return true;
break;
}
......@@ -1991,7 +1991,7 @@ bool ClientField::OnCommonEvent(const irr::SEvent& event) {
return true;
break;
}
u32 pos = mainGame->scrCardText->getPos();
irr::u32 pos = mainGame->scrCardText->getPos();
mainGame->SetStaticText(mainGame->stText, mainGame->stText->getRelativePosition().getWidth() - 25, mainGame->guiFont, mainGame->showingtext, pos);
return true;
break;
......@@ -2005,14 +2005,14 @@ bool ClientField::OnCommonEvent(const irr::SEvent& event) {
break;
}
case SCROLL_TAB_HELPER: {
rect<s32> pos = mainGame->tabHelper->getRelativePosition();
mainGame->tabHelper->setRelativePosition(recti(0, mainGame->scrTabHelper->getPos() * -1, pos.LowerRightCorner.X, pos.LowerRightCorner.Y));
irr::core::rect<irr::s32> pos = mainGame->tabHelper->getRelativePosition();
mainGame->tabHelper->setRelativePosition(irr::core::recti(0, mainGame->scrTabHelper->getPos() * -1, pos.LowerRightCorner.X, pos.LowerRightCorner.Y));
return true;
break;
}
case SCROLL_TAB_SYSTEM: {
rect<s32> pos = mainGame->tabSystem->getRelativePosition();
mainGame->tabSystem->setRelativePosition(recti(0, mainGame->scrTabSystem->getPos() * -1, pos.LowerRightCorner.X, pos.LowerRightCorner.Y));
irr::core::rect<irr::s32> pos = mainGame->tabSystem->getRelativePosition();
mainGame->tabSystem->setRelativePosition(irr::core::recti(0, mainGame->scrTabSystem->getPos() * -1, pos.LowerRightCorner.X, pos.LowerRightCorner.Y));
return true;
break;
}
......@@ -2045,7 +2045,7 @@ bool ClientField::OnCommonEvent(const irr::SEvent& event) {
switch(event.KeyInput.Key) {
case irr::KEY_KEY_R: {
if(mainGame->gameConf.control_mode == 0
&& !event.KeyInput.PressedDown && !mainGame->HasFocus(EGUIET_EDIT_BOX)) {
&& !event.KeyInput.PressedDown && !mainGame->HasFocus(irr::gui::EGUIET_EDIT_BOX)) {
mainGame->textFont->setTransparency(true);
mainGame->guiFont->setTransparency(true);
}
......@@ -2054,7 +2054,7 @@ bool ClientField::OnCommonEvent(const irr::SEvent& event) {
}
case irr::KEY_F9: {
if(mainGame->gameConf.control_mode == 1
&& !event.KeyInput.PressedDown && !mainGame->HasFocus(EGUIET_EDIT_BOX)) {
&& !event.KeyInput.PressedDown && !mainGame->HasFocus(irr::gui::EGUIET_EDIT_BOX)) {
mainGame->textFont->setTransparency(true);
mainGame->guiFont->setTransparency(true);
}
......@@ -2062,7 +2062,7 @@ bool ClientField::OnCommonEvent(const irr::SEvent& event) {
break;
}
case irr::KEY_ESCAPE: {
if(!mainGame->HasFocus(EGUIET_EDIT_BOX))
if(!mainGame->HasFocus(irr::gui::EGUIET_EDIT_BOX))
mainGame->device->minimizeWindow();
return true;
break;
......@@ -2466,17 +2466,17 @@ void ClientField::ShowCardInfoInList(ClientCard* pcard, irr::gui::IGUIElement* e
}
if(str.length() > 0) {
parent->addChild(mainGame->stCardListTip);
irr::core::rect<s32> ePos = element->getRelativePosition();
s32 x = (ePos.UpperLeftCorner.X + ePos.LowerRightCorner.X) / 2;
s32 y = ePos.LowerRightCorner.Y;
irr::core::rect<irr::s32> ePos = element->getRelativePosition();
irr::s32 x = (ePos.UpperLeftCorner.X + ePos.LowerRightCorner.X) / 2;
irr::s32 y = ePos.LowerRightCorner.Y;
mainGame->SetStaticText(mainGame->stCardListTip, 320, mainGame->guiFont, str.c_str());
irr::core::dimension2d<unsigned int> dTip = mainGame->guiFont->getDimension(mainGame->stCardListTip->getText()) + irr::core::dimension2d<unsigned int>(10, 10);
s32 w = dTip.Width / 2;
irr::s32 w = dTip.Width / 2;
if(x - w < 10)
x = w + 10;
if(x + w > 670)
x = 670 - w;
mainGame->stCardListTip->setRelativePosition(recti(x - w, y - 10, x + w, y - 10 + dTip.Height));
mainGame->stCardListTip->setRelativePosition(irr::core::recti(x - w, y - 10, x + w, y - 10 + dTip.Height));
mainGame->stCardListTip->setVisible(true);
}
}
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -144,9 +144,9 @@ class Game {
public:
bool Initialize();
void MainLoop();
void BuildProjectionMatrix(irr::core::matrix4& mProjection, f32 left, f32 right, f32 bottom, f32 top, f32 znear, f32 zfar);
void InitStaticText(irr::gui::IGUIStaticText* pControl, u32 cWidth, 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);
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, irr::u32 cWidth, irr::u32 cHeight, irr::gui::CGUITTFont* font, const wchar_t* text);
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 RefreshCategoryDeck(irr::gui::IGUIComboBox* cbCategory, irr::gui::IGUIComboBox* cbDeck, bool selectlastused = true);
void RefreshDeck(irr::gui::IGUIComboBox* cbCategory, irr::gui::IGUIComboBox* cbDeck);
......@@ -170,7 +170,7 @@ public:
void HideElement(irr::gui::IGUIElement* element, bool set_action = false);
void PopupElement(irr::gui::IGUIElement* element, int hideframe = 0);
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 LoadConfig();
void SaveConfig();
......@@ -191,7 +191,7 @@ public:
int ChatLocalPlayer(int player);
const wchar_t* LocalName(int local_player);
bool HasFocus(EGUI_ELEMENT_TYPE type) const {
bool HasFocus(irr::gui::EGUI_ELEMENT_TYPE type) const {
irr::gui::IGUIElement* focus = env->getFocus();
return focus && focus->hasType(type);
}
......@@ -204,26 +204,26 @@ public:
void OnResize();
void ResizeChatInputWindow();
recti Resize(s32 x, s32 y, s32 x2, s32 y2);
recti Resize(s32 x, s32 y, s32 x2, s32 y2, s32 dx, s32 dy, s32 dx2, s32 dy2);
irr::core::vector2di Resize(s32 x, s32 y);
irr::core::vector2di ResizeReverse(s32 x, s32 y);
recti ResizePhaseHint(s32 x, s32 y, s32 x2, s32 y2, s32 width);
recti ResizeWin(s32 x, s32 y, s32 x2, s32 y2);
recti ResizeCardImgWin(s32 x, s32 y, s32 mx, s32 my);
recti ResizeCardHint(s32 x, s32 y, s32 x2, s32 y2);
irr::core::vector2di ResizeCardHint(s32 x, s32 y);
recti ResizeCardMid(s32 x, s32 y, s32 x2, s32 y2, s32 midx, s32 midy);
irr::core::vector2di ResizeCardMid(s32 x, s32 y, s32 midx, s32 midy);
recti ResizeFit(s32 x, s32 y, s32 x2, s32 y2);
irr::core::recti Resize(irr::s32 x, irr::s32 y, irr::s32 x2, irr::s32 y2);
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(irr::s32 x, irr::s32 y);
irr::core::vector2di ResizeReverse(irr::s32 x, irr::s32 y);
irr::core::recti ResizePhaseHint(irr::s32 x, irr::s32 y, irr::s32 x2, irr::s32 y2, irr::s32 width);
irr::core::recti ResizeWin(irr::s32 x, irr::s32 y, irr::s32 x2, irr::s32 y2);
irr::core::recti ResizeCardImgWin(irr::s32 x, irr::s32 y, irr::s32 mx, irr::s32 my);
irr::core::recti ResizeCardHint(irr::s32 x, irr::s32 y, irr::s32 x2, irr::s32 y2);
irr::core::vector2di ResizeCardHint(irr::s32 x, irr::s32 y);
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(irr::s32 x, irr::s32 y, irr::s32 midx, irr::s32 midy);
irr::core::recti ResizeFit(irr::s32 x, irr::s32 y, irr::s32 x2, irr::s32 y2);
void SetWindowsIcon();
void SetWindowsScale(float scale);
void FlashWindow();
void SetCursor(ECURSOR_ICON icon);
void SetCursor(irr::gui::ECURSOR_ICON icon);
template<typename T>
static void DrawShadowText(irr::gui::CGUITTFont* font, const T& text, const core::rect<s32>& position, const core::rect<s32>& padding,
video::SColor color = 0xffffffff, video::SColor shadowcolor = 0xff000000, bool hcenter = false, bool vcenter = false, const core::rect<s32>* clip = nullptr);
static void DrawShadowText(irr::gui::CGUITTFont* font, const T& text, const irr::core::rect<irr::s32>& position, const irr::core::rect<irr::s32>& padding,
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;
Signal frameSignal;
......@@ -240,41 +240,41 @@ public:
std::wstring chatMsg[8];
std::vector<BotInfo> botInfo;
int hideChatTimer;
bool hideChat;
int hideChatTimer{};
bool hideChat{};
int chatTiming[8]{};
int chatType[8]{};
unsigned short linePatternD3D;
unsigned short linePatternGL;
int waitFrame;
int signalFrame;
int actionParam;
int showingcode;
const wchar_t* showingtext;
int showcard;
int showcardcode;
int showcarddif;
int showcardp;
int is_attacking;
int attack_sv;
unsigned short linePatternD3D{};
unsigned short linePatternGL{ 0x0f0f };
int waitFrame{};
int signalFrame{};
int actionParam{};
int showingcode{};
const wchar_t* showingtext{};
int showcard{};
int showcardcode{};
int showcarddif{};
int showcardp{};
int is_attacking{};
int attack_sv{};
irr::core::vector3df atk_r;
irr::core::vector3df atk_t;
float atkdy;
int lpframe;
int lpd;
int lpplayer;
int lpccolor;
float atkdy{};
int lpframe{};
int lpd{};
int lpplayer{};
int lpccolor{};
std::wstring lpcstring;
bool always_chain;
bool ignore_chain;
bool chain_when_avail;
bool always_chain{};
bool ignore_chain{};
bool chain_when_avail{};
bool is_building;
bool is_siding;
bool is_building{};
bool is_siding{};
irr::core::dimension2d<irr::u32> window_size;
float xScale;
float yScale;
float xScale{ 1.0f };
float yScale{ 1.0f };
ClientField dField;
DeckBuilder deckBuilder;
......
......@@ -2,7 +2,7 @@
#include "game.h"
#include "data_manager.h"
#include <event2/thread.h>
#include <locale.h>
#include <clocale>
#include <memory>
#ifdef __APPLE__
#import <CoreFoundation/CoreFoundation.h>
......@@ -24,7 +24,7 @@ void ClickButton(irr::gui::IGUIElement* btn) {
int main(int argc, char* argv[]) {
#ifndef _WIN32
setlocale(LC_CTYPE, "UTF-8");
std::setlocale(LC_CTYPE, "UTF-8");
#endif
#ifdef __APPLE__
CFURLRef bundle_url = CFBundleCopyBundleURL(CFBundleGetMainBundle());
......@@ -61,7 +61,7 @@ int main(int argc, char* argv[]) {
return 0;
#ifdef _WIN32
int wargc;
int wargc = 0;
std::unique_ptr<wchar_t*[], void(*)(wchar_t**)> wargv(CommandLineToArgvW(GetCommandLineW(), &wargc), [](wchar_t** wargv) {
LocalFree(wargv);
});
......@@ -76,6 +76,24 @@ int main(int argc, char* argv[]) {
bool keep_on_return = false;
bool deckCategorySpecified = false;
for(int i = 1; i < wargc; ++i) {
if (wargc == 2 && std::wcslen(wargv[1]) >= 4) {
wchar_t* pstrext = wargv[1] + std::wcslen(wargv[1]) - 4;
if (!mywcsncasecmp(pstrext, L".ydk", 4)) {
open_file = true;
BufferIO::CopyWideString(wargv[1], open_file_name);
exit_on_return = true;
ClickButton(ygo::mainGame->btnDeckEdit);
break;
}
if (!mywcsncasecmp(pstrext, L".yrp", 4)) {
open_file = true;
BufferIO::CopyWideString(wargv[1], open_file_name);
exit_on_return = true;
ClickButton(ygo::mainGame->btnReplayMode);
ClickButton(ygo::mainGame->btnLoadReplay);
break;
}
}
if(wargv[i][0] == L'-' && wargv[i][1] == L'e' && wargv[i][2] != L'\0') {
ygo::dataManager.LoadDB(&wargv[i][2]);
continue;
......@@ -171,23 +189,6 @@ int main(int argc, char* argv[]) {
if(open_file)
ClickButton(ygo::mainGame->btnLoadSinglePlay);
break;
} else if(wargc == 2 && std::wcslen(wargv[1]) >= 4) {
wchar_t* pstrext = wargv[1] + std::wcslen(wargv[1]) - 4;
if(!mywcsncasecmp(pstrext, L".ydk", 4)) {
open_file = true;
BufferIO::CopyWideString(wargv[i], open_file_name);
exit_on_return = !keep_on_return;
ClickButton(ygo::mainGame->btnDeckEdit);
break;
}
if(!mywcsncasecmp(pstrext, L".yrp", 4)) {
open_file = true;
BufferIO::CopyWideString(wargv[i], open_file_name);
exit_on_return = !keep_on_return;
ClickButton(ygo::mainGame->btnReplayMode);
ClickButton(ygo::mainGame->btnLoadReplay);
break;
}
}
}
ygo::mainGame->MainLoop();
......
......@@ -129,7 +129,7 @@ void ImageManager::ResizeTexture() {
// function by Warr1024, from https://github.com/minetest/minetest/issues/2419 , modified
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;
u32 dy, dx;
irr::u32 dy, dx;
irr::video::SColor pxl;
// Cache rectsngle boundaries.
......@@ -138,7 +138,7 @@ void imageScaleNNAA(irr::video::IImage *src, irr::video::IImage *dest) {
// Walk each destination image pixel.
// 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(dx = 0; dx < dim.Width; dx++) {
......@@ -176,7 +176,7 @@ void imageScaleNNAA(irr::video::IImage *src, irr::video::IImage *dest) {
// Get source pixel and add it to totals, weighted
// by covered area and alpha.
pxl = src->getPixel((u32)sx, (u32)sy);
pxl = src->getPixel((irr::u32)sx, (irr::u32)sy);
area += pa;
ra += pa * pxl.getRed();
ga += pa * pxl.getGreen();
......@@ -199,16 +199,16 @@ void imageScaleNNAA(irr::video::IImage *src, irr::video::IImage *dest) {
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) {
irr::video::ITexture* texture;
irr::video::IImage* srcimg = driver->createImageFromFile(file);
if(srcimg == 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);
} 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);
texture = driver->addTexture(file, destimg);
destimg->drop();
......@@ -274,7 +274,7 @@ irr::video::ITexture* ImageManager::GetBigPicture(int code, float zoom) {
texture = driver->addTexture(file, srcimg);
} else {
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);
texture = driver->addTexture(file, destimg);
destimg->drop();
......@@ -307,14 +307,14 @@ int ImageManager::LoadThumbThread() {
if(img != nullptr) {
int width = CARD_THUMB_WIDTH * mainGame->xScale;
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();
imageManager.tThumbLoadingMutex.lock();
if(imageManager.tThumbLoadingThreadRunning)
imageManager.tThumbLoading[code] = img;
imageManager.tThumbLoadingMutex.unlock();
} 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);
img->drop();
destimg->grab();
......
......@@ -16,7 +16,7 @@ public:
void ClearTexture();
void RemoveTexture(int code);
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* GetBigPicture(int code, float zoom);
irr::video::ITexture* GetTextureThumb(int code);
......
project "clzma"
kind "StaticLib"
cdialect "C11"
files { "*.c", "*.h" }
......@@ -33,7 +33,7 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
switch(event.EventType) {
case irr::EET_GUI_EVENT: {
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) {
mainGame->wQuery->getParent()->bringToFront(mainGame->wQuery);
break;
......@@ -400,7 +400,7 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
char arg3[8];
std::snprintf(arg3, sizeof arg3, "%d", mainGame->gameConf.serverport);
execl("./bot", "bot", arg1, arg2, arg3, nullptr);
exit(0);
std::exit(0);
} else {
if(!NetServer::StartServer(mainGame->gameConf.serverport)) {
soundManager.PlaySoundEffect(SOUND_INFO);
......
......@@ -41,7 +41,7 @@ public:
bufferevent_write(dp->bev, net_server_write, 3);
}
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;
if (sizeof(ST) > MAX_DATA_SIZE)
return;
......
......@@ -3,6 +3,7 @@ include "spmemvfs/."
project "YGOPro"
kind "WindowedApp"
cppdialect "C++14"
files { "*.cpp", "*.h" }
includedirs { "../ocgcore" }
......@@ -65,7 +66,7 @@ project "YGOPro"
end
links { "opengl32", "ws2_32", "winmm", "gdi32", "kernel32", "user32", "imm32" }
filter "not action:vs*"
buildoptions { "-std=c++14", "-fno-rtti" }
buildoptions { "-fno-rtti" }
filter "not system:windows"
links { "event_pthreads", "dl", "pthread" }
filter "system:macosx"
......
#ifndef REPLAY_MODE_H
#define REPLAY_MODE_H
#include <stdint.h>
#include <cstdint>
#include <vector>
#include "replay.h"
......
#ifndef SINGLE_MODE_H
#define SINGLE_MODE_H
#include <stdint.h>
#include <cstdint>
#include <vector>
#include "replay.h"
......
project "cspmemvfs"
kind "StaticLib"
cdialect "C11"
files { "*.c", "*.h" }
if BUILD_SQLITE then
includedirs { "../../sqlite3" }
end
filter "not action:vs*"
defines { "_POSIX_C_SOURCE=200809L" }
project "event"
kind "StaticLib"
cdialect "C11"
includedirs { "include", "compat" }
......
project "freetype"
kind "StaticLib"
cdialect "C11"
includedirs { "include" }
defines { "FT2_BUILD_LIBRARY" }
......
......@@ -13,11 +13,11 @@ BLOCK "080404b0"
BEGIN
VALUE "FileDescription", "YGOPro"
VALUE "InternalName", "YGOPro"
VALUE "LegalCopyright", "Copyright (C) 2022 Fluorohydride"
VALUE "LegalCopyright", "Copyright (C) 2025 Fluorohydride"
VALUE "OriginalFilename", "YGOPro.exe"
VALUE "ProductName", "YGOPro"
VALUE "FileVersion", "1.035.3"
VALUE "ProductVersion", "1.035.3"
VALUE "FileVersion", "1.036.1"
VALUE "ProductVersion", "1.036.1"
END
END
BLOCK "VarFileInfo"
......
project "irrlicht"
kind "StaticLib"
cdialect "C11"
includedirs { "include", "source/Irrlicht", "source/Irrlicht/jpeglib", "source/Irrlicht/libpng", "source/Irrlicht/zlib" }
......@@ -318,7 +319,7 @@ project "irrlicht"
filter { "system:windows" }
defines { "_IRR_WCHAR_FILESYSTEM" }
includedirs { "$(DXSDK_DIR)include" }
includedirs { "$(DXSDK_DIR)Include" }
libdirs { "$(DXSDK_DIR)Lib/x86" }
links { "imm32" }
......
project "sqlite3"
kind "StaticLib"
cdialect "C11"
files { "sqlite3.c", "sqlite3.h" }
......@@ -49,7 +49,7 @@ newoption { trigger = "irrklang-pro-debug-lib-dir", category = "YGOPro - irrklan
newoption { trigger = 'build-ikpmp3', category = "YGOPro - irrklang - ikpmp3", 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" }
function GetParam(param)
return _OPTIONS[param] or os.getenv(string.upper(string.gsub(param,"-","_")))
......@@ -63,9 +63,9 @@ end
if not BUILD_LUA then
-- 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
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_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
if GetParam("build-event") then
......@@ -74,8 +74,8 @@ elseif GetParam("no-build-event") then
BUILD_EVENT = false
end
if not BUILD_EVENT then
EVENT_INCLUDE_DIR = GetParam("event-include-dir") or "/usr/local/include/event2"
EVENT_LIB_DIR = GetParam("event-lib-dir") or "/usr/local/lib"
EVENT_INCLUDE_DIR = GetParam("event-include-dir") or os.findheader("event")
EVENT_LIB_DIR = GetParam("event-lib-dir") or os.findlib("event")
end
if GetParam("build-freetype") then
......@@ -84,13 +84,8 @@ elseif GetParam("no-build-freetype") then
BUILD_FREETYPE = false
end
if not BUILD_FREETYPE then
if os.istarget("linux") then
FREETYPE_INCLUDE_DIR = "/usr/include/freetype2"
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"
FREETYPE_INCLUDE_DIR = GetParam("freetype-include-dir") or os.findheader("freetype")
FREETYPE_LIB_DIR = GetParam("freetype-lib-dir") or os.findlib("freetype")
end
if GetParam("build-sqlite") then
......@@ -99,8 +94,8 @@ elseif GetParam("no-build-sqlite") then
BUILD_SQLITE = false
end
if not BUILD_SQLITE then
SQLITE_INCLUDE_DIR = GetParam("sqlite-include-dir") or "/usr/local/include"
SQLITE_LIB_DIR = GetParam("sqlite-lib-dir") or "/usr/local/lib"
SQLITE_INCLUDE_DIR = GetParam("sqlite-include-dir") or os.findheader("sqlite3")
SQLITE_LIB_DIR = GetParam("sqlite-lib-dir") or os.findlib("sqlite3")
end
if GetParam("build-irrlicht") then
......@@ -109,8 +104,8 @@ elseif GetParam("no-build-irrlicht") then
BUILD_IRRLICHT = false
end
if not BUILD_IRRLICHT then
IRRLICHT_INCLUDE_DIR = GetParam("irrlicht-include-dir") or "/usr/local/include/irrlicht"
IRRLICHT_LIB_DIR = GetParam("irrlicht-lib-dir") or "/usr/local/lib"
IRRLICHT_INCLUDE_DIR = GetParam("irrlicht-include-dir") or os.findheader("irrlicht")
IRRLICHT_LIB_DIR = GetParam("irrlicht-lib-dir") or os.findlib("irrlicht")
end
if GetParam("use-irrklang") then
......@@ -139,7 +134,7 @@ end
if IRRKLANG_PRO then
-- irrklang pro can't use the pro lib to debug
IRRKLANG_PRO_RELEASE_LIB_DIR = GetParam("irrklang-pro-release-lib-dir") or "../irrklang/lib/Win32-vs2019"
IRRKLANG_PRO_DEBUG_LIB_DIR = GetParam("irrklang-pro-debug-lib-dir") or "../irrklang/lib/Win32-visualStudio-debug"
IRRKLANG_PRO_DEBUG_LIB_DIR = GetParam("irrklang-pro-debug-lib-dir") or "../irrklang/lib/Win32-visualStudio-debug"
end
BUILD_IKPMP3 = USE_IRRKLANG and (GetParam("build-ikpmp3") or IRRKLANG_PRO)
......@@ -191,7 +186,11 @@ workspace "YGOPro"
targetdir "bin/debug"
filter { "configurations:Release", "action:vs*" }
flags { "LinkTimeOptimization" }
if linktimeoptimization then
linktimeoptimization "On"
else
flags { "LinkTimeOptimization" }
end
staticruntime "On"
disablewarnings { "4244", "4267", "4838", "4577", "4018", "4996", "4477", "4091", "4800", "6011", "6031", "6054", "6262" }
......@@ -209,7 +208,7 @@ workspace "YGOPro"
vectorextensions "SSE2"
buildoptions { "/utf-8" }
defines { "_CRT_SECURE_NO_WARNINGS" }
filter "not action:vs*"
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