Commit 6f122f83 authored by nanahira's avatar nanahira

dream start

parent 9760efb0
/bak/ # data files
/bin/ /beta
/build/ /expansions
/event/ /specials
/freetype/
# build files
/bin
/build
/obj
# dependencies
/event
/freetype
/sqlite3
/ikpmp3
/irrklang
/irrlicht
/lua
# gframe additionals
/gframe/ygopro.ico /gframe/ygopro.ico
/gframe/ygopro.rc /gframe/ygopro.rc
/gframe/ygopro.aps /gframe/ygopro.aps
/gframe/__iob_func_fix.cpp /gframe/ygopro.icns
/irrlicht/ /gframe/dirent.h
/lua/
/obj/ # git repos
/sqlite3/ /CustomTools
/irrklang/ /DataEditorX
/ikpmp3/ /Magic*
premake5.exe /pics
/Printer
/script
/ygopro-*
/*-Cards
# libs
/*.dll
/*.so
/*.dylib
# windbot related files
/[Bb]ot
/[Bb]ot.conf
/[Bb]ot.exe
/[Bb]ot.sh
/[Ww]ind[Bb]ot
# ygopro config file
/system_user.conf
# ygopro folders
/deck
/fonts
/replay
/single
/sound/*.wav
/sound/custom
/sound/BGM
/update
/update*
# ygopro main program
/ygopro
/ygopro_*
/ygopro.exe
/ygopro_*.exe
/ygopro.app
/ygopro_*.app
/premake4
/premake4.exe
/premake5
/premake5.exe
# others
*.log
/.vscode
/bak/
/temp
/PrinterData.txt
/ygopro_*.bat
/ygopro_*.sh
language: cpp language: cpp
os: os:
- linux - linux
#- osx - osx
sudo: required sudo: required
dist: trusty dist: trusty
osx_image: xcode8 osx_image: xcode8
git:
submodules: false
addons: addons:
ssh_known_hosts: ssh_known_hosts:
- github.com - github.com
...@@ -16,32 +14,68 @@ addons: ...@@ -16,32 +14,68 @@ addons:
- libevent-dev - libevent-dev
- libsqlite3-dev - libsqlite3-dev
- libirrlicht-dev - libirrlicht-dev
- libgl1-mesa-dev
- libglu-dev - libglu-dev
env:
- USE_IRRKLANG=1
before_install: before_install:
- git submodule update --init --recursive - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew update; brew install freetype libevent brew update > /dev/null;
sqlite lua dylibbundler; curl --location --retry 5 https://github.com/premake/premake-core/releases/download/v5.0.0-alpha12/premake-5.0.0-alpha12-macosx.tar.gz brew install freetype libevent sqlite dylibbundler > /dev/null;
| tar zfx -; fi fi
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then curl --retry 5 --connect-timeout 30 --location --remote-header-name --remote-name http://downloads.sourceforge.net/irrlicht/irrlicht-1.8.4.zip; unzip irrlicht-1.8.4.zip ; cd irrlicht-1.8.4/ ; cp ../premake/irrlicht/irrlicht-mac.patch . ; patch -p1 < irrlicht-mac.patch ; cd source/Irrlicht/MacOSX/ ; xcodebuild -project MacOSX.xcodeproj ; cp build/Release/libIrrlicht.a /usr/local/lib/ ; cp -r ../../../include /usr/local/include/irrlicht ; cd ../../../../ ; fi
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then wget -O - https://github.com/premake/premake-core/releases/download/v5.0.0-alpha12/premake-5.0.0-alpha12-linux.tar.gz - curl --location --retry 5 http://www.lua.org/ftp/lua-5.3.4.tar.gz | tar zfx -
| tar zfx -; fi - cd lua-5.3.4
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then curl --location --retry 5 --output 'irrKlang-64bit-1.5.0.zip' http://www.ambiera.at/downloads/irrKlang-64bit-1.5.0.zip; unzip -q irrKlang-64bit-1.5.0.zip; mv irrKlang-64bit-1.5.0 irrklang; fi - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then wget -O - https://www.lua.org/ftp/lua-5.3.4.tar.gz sudo make macosx test install > /dev/null;
| tar zfx -; cd lua-5.3.4; sudo make linux install; cd .. ; fi fi
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then
sudo make linux test install > /dev/null;
fi
- cd ..
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then
curl --location --retry 5 https://github.com/premake/premake-core/releases/download/v5.0.0-alpha12/premake-5.0.0-alpha12-macosx.tar.gz | tar zfx -;
fi
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then
curl --location --retry 5 https://github.com/premake/premake-core/releases/download/v5.0.0-alpha12/premake-5.0.0-alpha12-linux.tar.gz | tar zfx -;
fi
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then
curl --retry 5 --connect-timeout 30 --location --remote-header-name --remote-name http://downloads.sourceforge.net/irrlicht/irrlicht-1.8.4.zip;
unzip -q irrlicht-1.8.4.zip;
cd irrlicht-1.8.4/;
curl --location --retry 5 https://github.com/moecube/ygopro/raw/master/premake/irrlicht/irrlicht-mac.patch | patch -p1;
cd source/Irrlicht/MacOSX/;
xcodebuild -project MacOSX.xcodeproj > /dev/null;
sudo cp -rf build/Release/libIrrlicht.a /usr/local/lib/;
sudo cp -rf ../../../include /usr/local/include/irrlicht;
cd ../../../../;
fi
- git clone --depth=1 https://$NANAHIRA@github.com/purerosefallen/irrklang
- mv -f irrklang/plugins/ikpmp3 .
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then
sudo cp -rf irrklang/bin/macosx-gcc/libirrKlang.dylib /usr/local/lib/;
fi
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then
cp -rf irrklang/bin/linux-gcc-64/libirrKlang.so .;
fi
script: script:
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then ./premake5 gmake --cc=clang; fi - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then ./premake5 gmake --cc=clang; fi
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then ./premake5 gmake; fi - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then ./premake5 gmake; fi
- cd build - cd build
- make config=release -j2 - make config=release ygopro -j4
- cd .. - cd ..
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then mv bin/release/ygopro ./; strip ygopro; - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then mv -f bin/release/ygopro ./; strip ygopro;
fi fi
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then
mkdir -p ygopro.app/Contents/MacOS; mkdir -p ygopro.app/Contents/MacOS;
mv bin/release/ygopro ygopro.app/Contents/MacOS; mv -f bin/release/ygopro ygopro.app/Contents/MacOS;
dylibbundler -x ygopro.app/Contents/MacOS/ygopro -b -d ygopro.app/Contents/Frameworks/ -p @executable_path/../Frameworks/ -cd; dylibbundler -x ygopro.app/Contents/MacOS/ygopro -b -d ygopro.app/Contents/Frameworks/ -p @executable_path/../Frameworks/ -cd;
strip ygopro.app/Contents/MacOS/ygopro; mkdir ygopro.app/Contents/Resources; strip ygopro.app/Contents/MacOS/ygopro; mkdir ygopro.app/Contents/Resources;
mv premake/gframe/ygopro.icns ygopro.app/Contents/Resources/Icon.icns; mv -f premake/gframe/ygopro.icns ygopro.app/Contents/Resources/Icon.icns;
defaults write "$PWD/ygopro.app/Contents/Info.plist" "CFBundleIconFile" "Icon.icns"; defaults write "$PWD/ygopro.app/Contents/Info.plist" "CFBundleIconFile" "Icon.icns";
defaults write "$PWD/ygopro.app/Contents/Info.plist" "CFBundleIdentifier" "moe.mycard.ygopro"; defaults write "$PWD/ygopro.app/Contents/Info.plist" "CFBundleIdentifier" "moe.mycard.ygopro";
if [[ "$TRAVIS_PULL_REQUEST" == "false" ]]; then if [[ "$TRAVIS_PULL_REQUEST" == "false" ]]; then
...@@ -52,35 +86,62 @@ script: ...@@ -52,35 +86,62 @@ script:
codesigning build.keychain | head -1 | grep -o '".*"' | tr -d '"')" ygopro.app; codesigning build.keychain | head -1 | grep -o '".*"' | tr -d '"')" ygopro.app;
fi fi
fi fi
before_deploy: before_deploy:
- curl --location --retry 5 'https://github.com/moecube/ygopro-database/archive/master.tar.gz' - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then
| tar --strip-components=1 -zxf - ygopro-database-master/locales zip -q -r ygopro-koishi-$TRAVIS_OS_NAME.zip ygopro libirrKlang.so;
- cp locales/zh-CN/cards.cdb . fi
- mkdir replay - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then
- mkdir pics zip -q -r ygopro-koishi-$TRAVIS_OS_NAME.zip ygopro.app;
- curl --location --retry 5 --output 'ygopro-starter-pack-master.zip' https://github.com/moecube/ygopro-starter-pack/archive/master.zip fi
- curl --retry 5 --connect-timeout 30 --location --remote-header-name --remote-name https://github.com/Smile-DK/ygopro-scripts/archive/master.zip
- unzip -q ygopro-scripts-master.zip
- mv -f ygopro-scripts-master script
- rm -rf ygopro-scripts-master.zip
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then
curl --retry 5 --connect-timeout 30 --location --remote-header-name --remote-name https://github.com/Fluorohydride/ygopro-scripts/archive/master.zip;
unzip -q ygopro-scripts-master.zip;
cp -rf ygopro-scripts-master/* script;
fi
- curl --retry 5 --connect-timeout 30 --location --remote-header-name --remote-name https://github.com/HuangYuNan/ygopro222-images/archive/master.zip
- unzip -q ygopro222-images-master.zip
- mv -f ygopro222-images-master pics
- curl --retry 5 --connect-timeout 30 --location --remote-header-name --remote-name https://github.com/purerosefallen/ygopro-222DIY-data/archive/master.zip
- rm -rf sound
- unzip -q ygopro-222DIY-data-master.zip
- mv -f ygopro-222DIY-data-master/deck .
- mv -f ygopro-222DIY-data-master/expansions .
- mv -f ygopro-222DIY-data-master/sound .
- curl --retry 5 --connect-timeout 30 --location --remote-header-name --remote-name https://github.com/moecube/ygopro-starter-pack/archive/master.zip
- unzip -q ygopro-starter-pack-master.zip - unzip -q ygopro-starter-pack-master.zip
- mv ygopro-starter-pack-master/* . - cp -rf ygopro-starter-pack-master/* .
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then tar -zcf ygopro-ver.233-$TRAVIS_OS_NAME.tar.gz
--format=posix --exclude='.git*' ygopro.app LICENSE README.md lflist.conf strings.conf - rm -rf pics/thumbnail pics/*.db
system.conf cards.cdb script textures deck single pics replay; fi - mkdir replay
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then tar -zcf ygopro-ver.233-$TRAVIS_OS_NAME.tar.gz - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then
--format=posix --exclude='.git*' ygopro LICENSE README.md lflist.conf strings.conf zip -q -r ygopro-222DIY-$TRAVIS_OS_NAME-full.zip ygopro libirrKlang.so LICENSE README.md lflist.conf strings.conf system.conf cards.cdb script textures deck single pics replay expansions;
system.conf cards.cdb script textures deck single pics replay; fi zip -q -r ygopro-222DIY-$TRAVIS_OS_NAME-full-with-sound.zip ygopro libirrKlang.so LICENSE README.md lflist.conf strings.conf system.conf cards.cdb script textures deck single pics replay sound expansions;
- git config --local user.name "mercury233" fi
- git config --local user.email "me@mercury233.me" - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then
- bash -c "git tag -d latest ; exit 0" zip -q -r ygopro-222DIY-$TRAVIS_OS_NAME-full.zip ygopro.app LICENSE README.md lflist.conf strings.conf system.conf cards.cdb script textures deck single pics replay expansions;
- git tag latest HEAD zip -q -r ygopro-222DIY-$TRAVIS_OS_NAME-full-with-sound.zip ygopro.app LICENSE README.md lflist.conf strings.conf system.conf cards.cdb script textures deck single pics replay sound expansions;
#deploy: fi
# provider: releases
# on:
# branch: test
# file:
# - ygopro-ver.233-$TRAVIS_OS_NAME.tar.gz
# skip_cleanup: true
# overwrite: true
# api-key: $ak
branches: deploy:
only: provider: releases
- test file:
- ygopro-koishi-$TRAVIS_OS_NAME.zip
- ygopro-222DIY-$TRAVIS_OS_NAME-full.zip
- ygopro-222DIY-$TRAVIS_OS_NAME-full-with-sound.zip
skip_cleanup: true
overwrite: true
on:
tags: true
api-key: $NANAHIRA
version: '{build}' version: '{build}'
skip_tags: true
environment: environment:
irrklang_pro: 1
access_token: access_token:
secure: DOOS4g7CT8ctOgiMr62K56qQ1FO6s2ESpqNZlhf8F4nomemvvwxV/pRj9nbKmtjR secure: EQ9miMjfX/QAoBvgc6D+JLmHatLyxOEKZ/uo68QijxWW5Gp4MzB/pOH9+u2GlDVO
install: install:
- git submodule update --init --recursive
# environment and system dependency # environment and system dependency
- bash -c "curl --retry 5 --connect-timeout 30 --location --remote-header-name --remote-name https://github.com/premake/premake-core/releases/download/v5.0.0-alpha12/premake-5.0.0-alpha12-windows.zip ; exit 0" - bash -c "curl --retry 5 --connect-timeout 30 --location --remote-header-name --remote-name https://github.com/premake/premake-core/releases/download/v5.0.0-alpha12/premake-5.0.0-alpha12-windows.zip ; exit 0"
- 7z x premake-5.0.0-alpha12-windows.zip - 7z x premake-5.0.0-alpha12-windows.zip
...@@ -39,9 +37,9 @@ install: ...@@ -39,9 +37,9 @@ install:
- mv -f irrklang/plugins/ikpmp3 . - mv -f irrklang/plugins/ikpmp3 .
# let premake happy # let premake happy
- xcopy /E premake\* . - cp -rf premake/* .
# patch irrlicht # patch irrlicht & ikpmp3
- patch -p0 < irrlicht\irrlicht.patch - patch -p0 < irrlicht\irrlicht.patch
# premake # premake
...@@ -54,40 +52,78 @@ build: ...@@ -54,40 +52,78 @@ build:
parallel: true parallel: true
after_build: after_build:
- mv bin\release\ygopro.exe . - mv -f bin/release/ygopro.exe ygopro_222.exe
#- mv irrklang\bin\win32-visualStudio\irrKlang.dll .
#- mv irrklang\bin\win32-visualStudio\ikpMP3.dll . - git config --global user.name "Smile-DK"
- mkdir pics - git config --global user.email "2236141431@qq.com"
- rm -rf sound
- git clone --depth=1 https://github.com/purerosefallen/ygopro-222DIY-data
- cd ygopro-222DIY-data
# - cp -rf ../ygopro_222.exe .
# - git add . -A
# - git commit -m "Builded by Appveyor"
# - git push https://%AUTH_TOKEN%@github.com/purerosefallen/ygopro-222DIY-data master
- mv -f deck ..
- mv -f expansions ..
- mv -f sound ..
- mv -f update ..
- cd ..
- bash -c "curl --retry 5 --connect-timeout 30 --location --remote-header-name --remote-name https://github.com/purerosefallen/windbot/archive/master.zip ; exit 0"
- 7z x windbot-master.zip
- cd windbot-master
- msbuild /property:Configuration=Release /property:Platform=x86
- rm -rf bin/Release/WindBot.exe.config
- mv -f bin/Release ../WindBot
- mv -f BotWrapper/bin/Release/Bot.exe ./..
- mv -f BotWrapper/bin/Release/Bot.conf ./..
- cd ..
- bash -c "curl --retry 5 --connect-timeout 30 --location --remote-header-name --remote-name https://github.com/Smile-DK/ygopro-scripts/archive/master.zip ; exit 0"
- 7z x -y ygopro-scripts-master.zip
- mv -f ygopro-scripts-master script
- bash -c "curl --retry 5 --connect-timeout 30 --location --remote-header-name --remote-name https://github.com/HuangYuNan/ygopro222-images/archive/master.zip ; exit 0"
- 7z x ygopro222-images-master.zip
- mv -f ygopro222-images-master pics
- bash -c "curl --retry 5 --connect-timeout 30 --location --remote-header-name --remote-name https://github.com/purerosefallen/update-koishipro/archive/master.zip ; exit 0"
- 7z x update-koishipro-master.zip
- mv -f update-koishipro-master update-koishipro
- rm -rf pics/thumbnail pics/*.db expansions/pics/thumbnail expansions/pics/*.db
- mkdir replay - mkdir replay
- bash -c "curl --retry 5 --connect-timeout 30 --location --remote-header-name --remote-name https://github.com/mycard/ygopro-database/raw/master/locales/zh-CN/cards.cdb ; exit 0"
- bash -c "curl --retry 5 --connect-timeout 30 --location --remote-header-name --remote-name https://github.com/mycard/ygopro-starter-pack/archive/master.zip ; exit 0" - bash -c "curl --retry 5 --connect-timeout 30 --location --remote-header-name --remote-name https://github.com/moecube/ygopro-starter-pack/archive/master.zip ; exit 0"
- 7z x ygopro-starter-pack-master.zip - 7z x ygopro-starter-pack-master.zip
- xcopy /E ygopro-starter-pack-master\* . - cp -rf ygopro-starter-pack-master/* .
#- 7z a ygopro-ver.233.7z ygopro.exe irrKlang.dll ikpMP3.dll LICENSE README.md lflist.conf strings.conf system.conf cards.cdb script textures deck single pics replay -xr!.git*
- 7z a ygopro-ver.233.7z ygopro.exe LICENSE README.md lflist.conf strings.conf system.conf cards.cdb script textures deck single pics replay -xr!.git*
- git config --global credential.helper store - 7z a -mx9 -xr!.git* ygopro-222DIY-full.7z ygopro_222.exe lflist.conf expansions update update-koishipro LICENSE README.md strings.conf system.conf cards.cdb script textures deck single pics replay WindBot Bot.exe bot.conf
- ps: Add-Content "$env:USERPROFILE\.git-credentials" "https://$($env:access_token):x-oauth-basic@github.com`n" - cp -rf ygopro-222DIY-full.7z ygopro-222DIY-full-with-sound.7z
- bash -c "git tag -d latest ; exit 0" - 7z a -mx9 -xr!.git* ygopro-222DIY-full-with-sound.7z sound
- git tag latest HEAD
- git push -f origin latest
test: off test: off
artifacts: artifacts:
- path: ygopro.exe - path: ygopro_222.exe
name: ygopro name: ygopro client for 222
- path: ygopro-ver.233.7z - path: ygopro-222DIY-full.7z
name: ygopro-ver.233 name: ygopro-222DIY-full
- path: ygopro-222DIY-full-with-sound.7z
name: ygopro-222DIY-full-with-sound
deploy: deploy:
release: latest description: 'Automatic build commit $(APPVEYOR_REPO_COMMIT) $(APPVEYOR_REPO_COMMIT_TIMESTAMP)'
description: 'Automatic build by Appveyor.\nUpdated on $(APPVEYOR_REPO_COMMIT_TIMESTAMP).' provider: GitHub
provider: GitHub force_update: true
auth_token: $(access_token) auth_token: $(access_token)
force_update: true on:
on: appveyor_repo_tag: true
branch: test
cache: cache:
- premake-5.0.0-alpha12-windows.zip - premake-5.0.0-alpha12-windows.zip
...@@ -96,4 +132,4 @@ cache: ...@@ -96,4 +132,4 @@ cache:
- irrlicht-1.8.4.zip - irrlicht-1.8.4.zip
- lua-5.3.4.tar.gz - lua-5.3.4.tar.gz
- sqlite-amalgamation-3210000.zip - sqlite-amalgamation-3210000.zip
- irrKlang-32bit-1.5.0.zip - Redis-x64-3.2.100.zip
File added
project (ygopro)
if (NOT WIN32 AND NOT APPLE)
include (FindX11)
endif ()
set (AUTO_FILES_RESULT)
if (MSVC)
AutoFiles("." "res" "\\.(rc)$")
AutoFiles("." "src" "\\.(cpp|c|h)$" "CGUIButton.cpp")
else ()
AutoFiles("." "src" "\\.(cpp|c|h)$")
endif ()
if (MSVC)
SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /ENTRY:mainCRTStartup")
add_executable (ygopro WIN32 ${AUTO_FILES_RESULT})
else ()
add_executable (ygopro ${AUTO_FILES_RESULT})
endif ()
target_link_libraries (ygopro ocgcore)
if (MSVC)
target_link_libraries (ygopro opengl32 irrlicht freetype sqlite3 lua event)
include_directories ( "../irrlicht/include" "../freetype/include" "../event/include" "../sqlite3" )
else ()
target_link_libraries (ygopro ${FREETYPE_LIBRARY} ${LUA_LIBRARIES}
${LIBEVENT_LIBRARIES} ${IRRLICHT_LIBRARIES}
${SQLITE3_LIBRARIES} ${OPENGL_gl_LIBRARY})
include_directories (${FREETYPE_INCLUDE_DIRS} ${LUA_INCLUDE_DIR}
${LIBEVENT_INCLUDE_DIR} ${IRRLICHT_INCLUDE_DIR}
${SQLITE3_INCLUDE_DIR} ${OPENGL_INCLUDE_DIR})
target_link_libraries (ygopro ${CMAKE_THREAD_LIBS_INIT} ${DL_LIBRARIES})
endif ()
if (WIN32)
target_link_libraries (ygopro ws2_32 winmm gdi32 kernel32 user32 imm32)
endif ()
create_target_launcher(ygopro WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
create_default_target_launcher(ygopro WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
...@@ -60,6 +60,9 @@ void ClientField::Clear() { ...@@ -60,6 +60,9 @@ void ClientField::Clear() {
delete *cit; delete *cit;
extra[i].clear(); extra[i].clear();
} }
for(auto cit = limbo_temp.begin(); cit != limbo_temp.end(); ++cit)
delete *cit;
limbo_temp.clear();
for(auto sit = overlay_cards.begin(); sit != overlay_cards.end(); ++sit) for(auto sit = overlay_cards.begin(); sit != overlay_cards.end(); ++sit)
delete *sit; delete *sit;
overlay_cards.clear(); overlay_cards.clear();
...@@ -415,6 +418,8 @@ void ClientField::ShowSelectCard(bool buttonok, bool chain) { ...@@ -415,6 +418,8 @@ void ClientField::ShowSelectCard(bool buttonok, bool chain) {
myswprintf(formatBuffer, L"%ls[%d](%d)", myswprintf(formatBuffer, L"%ls[%d](%d)",
dataManager.FormatLocation(selectable_cards[i]->overlayTarget->location, selectable_cards[i]->overlayTarget->sequence), dataManager.FormatLocation(selectable_cards[i]->overlayTarget->location, selectable_cards[i]->overlayTarget->sequence),
selectable_cards[i]->overlayTarget->sequence + 1, selectable_cards[i]->sequence + 1); selectable_cards[i]->overlayTarget->sequence + 1, selectable_cards[i]->sequence + 1);
else if (selectable_cards[i]->location == 0)
myswprintf(formatBuffer, L"");
else else
myswprintf(formatBuffer, L"%ls[%d]", dataManager.FormatLocation(selectable_cards[i]->location, selectable_cards[i]->sequence), myswprintf(formatBuffer, L"%ls[%d]", dataManager.FormatLocation(selectable_cards[i]->location, selectable_cards[i]->sequence),
selectable_cards[i]->sequence + 1); selectable_cards[i]->sequence + 1);
...@@ -652,6 +657,7 @@ void ClientField::ReplaySwap() { ...@@ -652,6 +657,7 @@ void ClientField::ReplaySwap() {
mainGame->dInfo.isReplaySwapped = !mainGame->dInfo.isReplaySwapped; mainGame->dInfo.isReplaySwapped = !mainGame->dInfo.isReplaySwapped;
std::swap(mainGame->dInfo.lp[0], mainGame->dInfo.lp[1]); std::swap(mainGame->dInfo.lp[0], mainGame->dInfo.lp[1]);
std::swap(mainGame->dInfo.strLP[0], mainGame->dInfo.strLP[1]); std::swap(mainGame->dInfo.strLP[0], mainGame->dInfo.strLP[1]);
std::swap(mainGame->dInfo.start_lp[0], mainGame->dInfo.start_lp[1]);
std::swap(mainGame->dInfo.hostname, mainGame->dInfo.clientname); std::swap(mainGame->dInfo.hostname, mainGame->dInfo.clientname);
std::swap(mainGame->dInfo.hostname_tag, mainGame->dInfo.clientname_tag); std::swap(mainGame->dInfo.hostname_tag, mainGame->dInfo.clientname_tag);
for(auto chit = chains.begin(); chit != chains.end(); ++chit) { for(auto chit = chains.begin(); chit != chains.end(); ++chit) {
...@@ -953,24 +959,44 @@ void ClientField::GetCardLocation(ClientCard* pcard, irr::core::vector3df* t, ir ...@@ -953,24 +959,44 @@ void ClientField::GetCardLocation(ClientCard* pcard, irr::core::vector3df* t, ir
break; break;
} }
case LOCATION_OVERLAY: { case LOCATION_OVERLAY: {
if (pcard->overlayTarget->location != 0x4) { if (!(pcard->overlayTarget->location & LOCATION_ONFIELD)) {
return; return;
} }
int oseq = pcard->overlayTarget->sequence; int oseq = pcard->overlayTarget->sequence;
if (pcard->overlayTarget->controler == 0) { if (pcard->overlayTarget->location == LOCATION_MZONE) {
t->X = (matManager.vFieldMzone[0][oseq][0].Pos.X + matManager.vFieldMzone[0][oseq][1].Pos.X) / 2 - 0.12f + 0.06f * sequence; if (pcard->overlayTarget->controler == 0) {
t->Y = (matManager.vFieldMzone[0][oseq][0].Pos.Y + matManager.vFieldMzone[0][oseq][2].Pos.Y) / 2 + 0.05f; t->X = (matManager.vFieldMzone[0][oseq][0].Pos.X + matManager.vFieldMzone[0][oseq][1].Pos.X) / 2 - 0.12f + 0.06f * sequence;
t->Z = 0.005f + pcard->sequence * 0.0001f; t->Y = (matManager.vFieldMzone[0][oseq][0].Pos.Y + matManager.vFieldMzone[0][oseq][2].Pos.Y) / 2 + 0.05f;
r->X = 0.0f; t->Z = 0.005f + pcard->sequence * 0.0001f;
r->Y = 0.0f; r->X = 0.0f;
r->Z = 0.0f; r->Y = 0.0f;
r->Z = 0.0f;
}
else {
t->X = (matManager.vFieldMzone[1][oseq][0].Pos.X + matManager.vFieldMzone[1][oseq][1].Pos.X) / 2 + 0.12f - 0.06f * sequence;
t->Y = (matManager.vFieldMzone[1][oseq][0].Pos.Y + matManager.vFieldMzone[1][oseq][2].Pos.Y) / 2 - 0.05f;
t->Z = 0.005f + pcard->sequence * 0.0001f;
r->X = 0.0f;
r->Y = 0.0f;
r->Z = 3.1415926f;
}
} else { } else {
t->X = (matManager.vFieldMzone[1][oseq][0].Pos.X + matManager.vFieldMzone[1][oseq][1].Pos.X) / 2 + 0.12f - 0.06f * sequence; if (pcard->overlayTarget->controler == 0) {
t->Y = (matManager.vFieldMzone[1][oseq][0].Pos.Y + matManager.vFieldMzone[1][oseq][2].Pos.Y) / 2 - 0.05f; t->X = (matManager.vFieldSzone[0][oseq][rule][0].Pos.X + matManager.vFieldSzone[0][oseq][rule][1].Pos.X) / 2 - 0.12f + 0.06f * sequence;
t->Z = 0.005f + pcard->sequence * 0.0001f; t->Y = (matManager.vFieldSzone[0][oseq][rule][0].Pos.Y + matManager.vFieldSzone[0][oseq][rule][2].Pos.Y) / 2 + 0.05f;
r->X = 0.0f; t->Z = 0.005f + pcard->sequence * 0.0001f;
r->Y = 0.0f; r->X = 0.0f;
r->Z = 3.1415926f; r->Y = 0.0f;
r->Z = 0.0f;
}
else {
t->X = (matManager.vFieldSzone[1][oseq][rule][0].Pos.X + matManager.vFieldSzone[1][oseq][rule][1].Pos.X) / 2 + 0.12f - 0.06f * sequence;
t->Y = (matManager.vFieldSzone[1][oseq][rule][0].Pos.Y + matManager.vFieldSzone[1][oseq][rule][2].Pos.Y) / 2 - 0.05f;
t->Z = 0.005f + pcard->sequence * 0.0001f;
r->X = 0.0f;
r->Y = 0.0f;
r->Z = 3.1415926f;
}
} }
break; break;
} }
......
...@@ -30,6 +30,7 @@ public: ...@@ -30,6 +30,7 @@ public:
std::vector<ClientCard*> grave[2]; std::vector<ClientCard*> grave[2];
std::vector<ClientCard*> remove[2]; std::vector<ClientCard*> remove[2];
std::vector<ClientCard*> extra[2]; std::vector<ClientCard*> extra[2];
std::vector<ClientCard*> limbo_temp;
std::set<ClientCard*> overlay_cards; std::set<ClientCard*> overlay_cards;
std::vector<ClientCard*> summonable_cards; std::vector<ClientCard*> summonable_cards;
std::vector<ClientCard*> spsummonable_cards; std::vector<ClientCard*> spsummonable_cards;
...@@ -64,6 +65,7 @@ public: ...@@ -64,6 +65,7 @@ public:
int select_counter_type; int select_counter_type;
std::vector<ClientCard*> selectable_cards; std::vector<ClientCard*> selectable_cards;
std::vector<ClientCard*> selected_cards; std::vector<ClientCard*> selected_cards;
std::vector<ClientCard*> unselected_cards;
std::set<ClientCard*> selectsum_cards; std::set<ClientCard*> selectsum_cards;
std::vector<ClientCard*> selectsum_all; std::vector<ClientCard*> selectsum_all;
std::vector<int> opcode; std::vector<int> opcode;
......
...@@ -54,8 +54,13 @@ inline int _wtoi(const wchar_t * s) { ...@@ -54,8 +54,13 @@ inline int _wtoi(const wchar_t * s) {
#endif #endif
#include <irrlicht.h> #include <irrlicht.h>
#ifdef __APPLE__
#include <OpenGL/gl.h>
#include <OpenGL/glu.h>
#else
#include <GL/gl.h> #include <GL/gl.h>
#include <GL/glu.h> #include <GL/glu.h>
#endif
#include "CGUITTFont.h" #include "CGUITTFont.h"
#include "CGUIImageButton.h" #include "CGUIImageButton.h"
#include <iostream> #include <iostream>
...@@ -77,7 +82,7 @@ using namespace video; ...@@ -77,7 +82,7 @@ using namespace video;
using namespace io; using namespace io;
using namespace gui; using namespace gui;
extern const unsigned short PRO_VERSION; extern unsigned short PRO_VERSION;
extern int enable_log; extern int enable_log;
extern bool exit_on_return; extern bool exit_on_return;
extern bool open_file; extern bool open_file;
......
...@@ -777,7 +777,7 @@ void DeckBuilder::FilterCards() { ...@@ -777,7 +777,7 @@ void DeckBuilder::FilterCards() {
results.clear(); results.clear();
const wchar_t* pstr = mainGame->ebCardName->getText(); const wchar_t* pstr = mainGame->ebCardName->getText();
int trycode = BufferIO::GetVal(pstr); int trycode = BufferIO::GetVal(pstr);
if(dataManager.GetData(trycode, 0)) { if (dataManager.GetData(trycode, 0)) {
auto ptr = dataManager.GetCodePointer(trycode); // verified by GetData() auto ptr = dataManager.GetCodePointer(trycode); // verified by GetData()
results.push_back(ptr); results.push_back(ptr);
mainGame->scrFilter->setVisible(false); mainGame->scrFilter->setVisible(false);
...@@ -785,106 +785,146 @@ void DeckBuilder::FilterCards() { ...@@ -785,106 +785,146 @@ void DeckBuilder::FilterCards() {
myswprintf(result_string, L"%d", results.size()); myswprintf(result_string, L"%d", results.size());
return; return;
} }
unsigned int set_code = 0; std::wstring str = std::wstring(pstr);
if(pstr[0] == L'@') std::vector<std::wstring> query_elements;
set_code = dataManager.GetSetCode(&pstr[1]); std::vector<std::vector<std::wstring>::iterator> query_elements_track;
else size_t element_start = 0;
set_code = dataManager.GetSetCode(&pstr[0]); while (1) {
if(pstr[0] == 0 || (pstr[0] == L'$' && pstr[1] == 0) || (pstr[0] == L'@' && pstr[1] == 0)) size_t element_end = str.find_first_of(L' ', element_start);
pstr = 0; if (element_end == std::wstring::npos) {
break;
}
size_t length = element_end - element_start;
if(length > 0) {
query_elements.push_back(str.substr(element_start, length));
element_start = element_end + 1;
} else {
element_start++;
}
}
query_elements.push_back(str.substr(element_start));
std::unordered_map<std::wstring, unsigned int> set_code_map;
for (auto elements_iterator = query_elements.begin(); elements_iterator != query_elements.end(); elements_iterator++) {
const wchar_t* element_pointer = elements_iterator->c_str();
if (element_pointer[0] == L'@')
set_code_map[*elements_iterator] = dataManager.GetSetCode(&element_pointer[1]);
else
set_code_map[*elements_iterator] = dataManager.GetSetCode(&element_pointer[0]);
if (element_pointer[0] == 0 || (element_pointer[0] == L'$' && element_pointer[1] == 0) || (element_pointer[0] == L'@' && element_pointer[1] == 0))
query_elements_track.push_back(elements_iterator);
}
for (auto elements_track_iterator = query_elements_track.begin(); elements_track_iterator != query_elements_track.end(); elements_track_iterator++) {
query_elements.erase(*elements_track_iterator);
}
auto strpointer = dataManager._strings.begin(); auto strpointer = dataManager._strings.begin();
for(code_pointer ptr = dataManager._datas.begin(); ptr != dataManager._datas.end(); ++ptr, ++strpointer) { for (code_pointer ptr = dataManager._datas.begin(); ptr != dataManager._datas.end(); ++ptr, ++strpointer) {
const CardDataC& data = ptr->second; const CardDataC& data = ptr->second;
const CardString& text = strpointer->second; const CardString& text = strpointer->second;
if(data.type & TYPE_TOKEN) if (data.type & TYPE_TOKEN)
continue; continue;
switch(filter_type) { switch (filter_type) {
case 1: { case 1: {
if(!(data.type & TYPE_MONSTER) || (data.type & filter_type2) != filter_type2) if (!(data.type & TYPE_MONSTER) || (data.type & filter_type2) != filter_type2)
continue; continue;
if(filter_race && data.race != filter_race) if (filter_race && data.race != filter_race)
continue; continue;
if(filter_attrib && data.attribute != filter_attrib) if (filter_attrib && data.attribute != filter_attrib)
continue; continue;
if(filter_atktype) { if (filter_atktype) {
if((filter_atktype == 1 && data.attack != filter_atk) || (filter_atktype == 2 && data.attack < filter_atk) if ((filter_atktype == 1 && data.attack != filter_atk) || (filter_atktype == 2 && data.attack < filter_atk)
|| (filter_atktype == 3 && data.attack <= filter_atk) || (filter_atktype == 4 && (data.attack > filter_atk || data.attack < 0)) || (filter_atktype == 3 && data.attack <= filter_atk) || (filter_atktype == 4 && (data.attack > filter_atk || data.attack < 0))
|| (filter_atktype == 5 && (data.attack >= filter_atk || data.attack < 0)) || (filter_atktype == 6 && data.attack != -2)) || (filter_atktype == 5 && (data.attack >= filter_atk || data.attack < 0)) || (filter_atktype == 6 && data.attack != -2))
continue; continue;
} }
if(filter_deftype) { if(filter_deftype) {
if((filter_deftype == 1 && data.defense != filter_def) || (filter_deftype == 2 && data.defense < filter_def) if((filter_deftype == 1 && data.defense != filter_def) || (filter_deftype == 2 && data.defense < filter_def)
|| (filter_deftype == 3 && data.defense <= filter_def) || (filter_deftype == 4 && (data.defense > filter_def || data.defense < 0)) || (filter_deftype == 3 && data.defense <= filter_def) || (filter_deftype == 4 && (data.defense > filter_def || data.defense < 0))
|| (filter_deftype == 5 && (data.defense >= filter_def || data.defense < 0)) || (filter_deftype == 6 && data.defense != -2) || (filter_deftype == 5 && (data.defense >= filter_def || data.defense < 0)) || (filter_deftype == 6 && data.defense != -2)
|| (data.type & TYPE_LINK)) || (data.type & TYPE_LINK))
continue; continue;
} }
if(filter_lvtype) { if (filter_lvtype) {
if((filter_lvtype == 1 && data.level != filter_lv) || (filter_lvtype == 2 && data.level < filter_lv) if ((filter_lvtype == 1 && data.level != filter_lv) || (filter_lvtype == 2 && data.level < filter_lv)
|| (filter_lvtype == 3 && data.level <= filter_lv) || (filter_lvtype == 4 && data.level > filter_lv) || (filter_lvtype == 3 && data.level <= filter_lv) || (filter_lvtype == 4 && data.level > filter_lv)
|| (filter_lvtype == 5 && data.level >= filter_lv) || filter_lvtype == 6) || (filter_lvtype == 5 && data.level >= filter_lv) || filter_lvtype == 6)
continue; continue;
} }
if(filter_scltype) { if(filter_scltype) {
if((filter_scltype == 1 && data.lscale != filter_scl) || (filter_scltype == 2 && data.lscale < filter_scl) if((filter_scltype == 1 && data.lscale != filter_scl) || (filter_scltype == 2 && data.lscale < filter_scl)
|| (filter_scltype == 3 && data.lscale <= filter_scl) || (filter_scltype == 4 && (data.lscale > filter_scl || data.lscale == 0)) || (filter_scltype == 3 && data.lscale <= filter_scl) || (filter_scltype == 4 && (data.lscale > filter_scl || data.lscale == 0))
|| (filter_scltype == 5 && (data.lscale >= filter_scl || data.lscale == 0)) || filter_scltype == 6 || (filter_scltype == 5 && (data.lscale >= filter_scl || data.lscale == 0)) || filter_scltype == 6
|| !(data.type & TYPE_PENDULUM)) || !(data.type & TYPE_PENDULUM))
continue; continue;
} }
break; break;
} }
case 2: { case 2: {
if(!(data.type & TYPE_SPELL)) if (!(data.type & TYPE_SPELL))
continue; continue;
if(filter_type2 && data.type != filter_type2) if (filter_type2 && data.type != filter_type2)
continue; continue;
break; break;
} }
case 3: { case 3: {
if(!(data.type & TYPE_TRAP)) if (!(data.type & TYPE_TRAP))
continue; continue;
if(filter_type2 && data.type != filter_type2) if (filter_type2 && data.type != filter_type2)
continue; continue;
break; break;
} }
} }
if(filter_effect && !(data.category & filter_effect)) if (filter_effect && !(data.category & filter_effect))
continue; continue;
if(filter_marks && (data.link_marker & filter_marks)!= filter_marks) if(filter_marks && (data.link_marker & filter_marks)!= filter_marks)
continue; continue;
if(filter_lm) { if(filter_lm) {
if(filter_lm <= 3 && (!filterList->count(ptr->first) || (*filterList)[ptr->first] != filter_lm - 1)) if(filter_lm <= 3 && (!filterList->count(ptr->first) || (*filterList)[ptr->first] != filter_lm - 1))
continue; continue;
if(filter_lm == 4 && data.ot != 1) if (filter_lm == 4 && data.ot != 1)
continue; continue;
if(filter_lm == 5 && data.ot != 2) if (filter_lm == 5 && data.ot != 2)
continue; continue;
if(filter_lm == 6 && data.ot != 3) if(filter_lm == 6 && data.ot != 3)
continue; continue;
if(filter_lm == 7 && data.ot != 4) if(filter_lm == 7 && data.ot != 4)
continue; continue;
} }
if(pstr) { bool is_target = true;
if(pstr[0] == L'$') { for (auto elements_iterator = query_elements.begin(); elements_iterator != query_elements.end(); elements_iterator++) {
if(!CardNameContains(text.name.c_str(), &pstr[1])) const wchar_t* element_pointer = elements_iterator->c_str();
continue; if (element_pointer[0] == L'$') {
} else if(pstr[0] == L'@' && set_code) { if(!CardNameContains(text.name.c_str(), &element_pointer[1])){
if(!check_set_code(data, set_code)) continue; is_target = false;
break;
}
}
else if (element_pointer[0] == L'@' && set_code_map[*elements_iterator]) {
if(!check_set_code(data, set_code_map[*elements_iterator])) {
is_target = false;
break;
}
} else { } else {
if(!CardNameContains(text.name.c_str(), pstr) && text.text.find(pstr) == std::wstring::npos if (!CardNameContains(text.name.c_str(), elements_iterator->c_str()) && text.text.find(elements_iterator->c_str()) == std::wstring::npos
&& (!set_code || !check_set_code(data, set_code))) && (!set_code_map[*elements_iterator] || !check_set_code(data, set_code_map[*elements_iterator]))) {
continue; is_target = false;
break;
}
} }
} }
results.push_back(ptr); if (is_target) {
results.push_back(ptr);
} else {
continue;
}
} }
myswprintf(result_string, L"%d", results.size()); myswprintf(result_string, L"%d", results.size());
if(results.size() > 7) { if (results.size() > 7) {
mainGame->scrFilter->setVisible(true); mainGame->scrFilter->setVisible(true);
mainGame->scrFilter->setMax(results.size() - 7); mainGame->scrFilter->setMax(results.size() - 7);
mainGame->scrFilter->setPos(0); mainGame->scrFilter->setPos(0);
} else { }
else {
mainGame->scrFilter->setVisible(false); mainGame->scrFilter->setVisible(false);
mainGame->scrFilter->setPos(0); mainGame->scrFilter->setPos(0);
} }
......
...@@ -11,8 +11,44 @@ DeckManager deckManager; ...@@ -11,8 +11,44 @@ DeckManager deckManager;
void DeckManager::LoadLFList() { void DeckManager::LoadLFList() {
LFList* cur = NULL; LFList* cur = NULL;
FILE* fp = fopen("lflist.conf", "r"); FILE* fp = fopen("lflist.conf", "r");
FILE* fp_custom = fopen("expansions/lflist.conf", "r");
char linebuf[256]; char linebuf[256];
wchar_t strBuffer[256]; wchar_t strBuffer[256];
if(fp_custom) {
while(fgets(linebuf, 256, fp_custom)) {
if(linebuf[0] == '#')
continue;
int p = 0, sa = 0, code, count;
if(linebuf[0] == '!') {
sa = BufferIO::DecodeUTF8((const char*)(&linebuf[1]), strBuffer);
while(strBuffer[sa - 1] == L'\r' || strBuffer[sa - 1] == L'\n' ) sa--;
LFList newlist;
_lfList.push_back(newlist);
cur = &_lfList[_lfList.size() - 1];
memcpy(cur->listName, (const void*)strBuffer, 40);
cur->listName[sa] = 0;
cur->content = new std::unordered_map<int, int>;
cur->hash = 0x7dfcee6a;
continue;
}
while(linebuf[p] != ' ' && linebuf[p] != '\t' && linebuf[p] != 0) p++;
if(linebuf[p] == 0)
continue;
linebuf[p++] = 0;
sa = p;
code = atoi(linebuf);
if(code == 0)
continue;
while(linebuf[p] == ' ' || linebuf[p] == '\t') p++;
while(linebuf[p] != ' ' && linebuf[p] != '\t' && linebuf[p] != 0) p++;
linebuf[p] = 0;
count = atoi(&linebuf[sa]);
if(cur == NULL) continue;
(*cur->content)[code] = count;
cur->hash = cur->hash ^ ((code << 18) | (code >> 14)) ^ ((code << (27 + count)) | (code >> (5 - count)));
}
fclose(fp_custom);
}
if(fp) { if(fp) {
while(fgets(linebuf, 256, fp)) { while(fgets(linebuf, 256, fp)) {
if(linebuf[0] == '#') if(linebuf[0] == '#')
......
...@@ -482,7 +482,7 @@ void Game::DrawMisc() { ...@@ -482,7 +482,7 @@ void Game::DrawMisc() {
if(btnCancelOrFinish->isVisible() && dField.select_ready) if(btnCancelOrFinish->isVisible() && dField.select_ready)
DrawSelectionLine(btnCancelOrFinish, 2, 0xffffff00); DrawSelectionLine(btnCancelOrFinish, 2, 0xffffff00);
//lp bar //lp bar
if((dInfo.turn % 2 && dInfo.isFirst) || (!(dInfo.turn % 2) && !dInfo.isFirst)) { if((dInfo.turn % 2 && dInfo.isFirst && !dInfo.is_swapped) || (!(dInfo.turn % 2) && !dInfo.isFirst && !dInfo.is_swapped) || (!(dInfo.turn % 2) && dInfo.isFirst && dInfo.is_swapped) || (dInfo.turn % 2 && !dInfo.isFirst && dInfo.is_swapped)) {
driver->draw2DRectangle(0xa0000000, Resize(327, 8, 630, 51)); driver->draw2DRectangle(0xa0000000, Resize(327, 8, 630, 51));
driver->draw2DRectangleOutline(Resize(327, 8, 630, 51), 0xffff8080); driver->draw2DRectangleOutline(Resize(327, 8, 630, 51), 0xffff8080);
} else { } else {
...@@ -491,12 +491,16 @@ void Game::DrawMisc() { ...@@ -491,12 +491,16 @@ void Game::DrawMisc() {
} }
driver->draw2DImage(imageManager.tLPFrame, Resize(330, 10, 629, 30), recti(0, 0, 200, 20), 0, 0, true); 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(691, 10, 990, 30), recti(0, 0, 200, 20), 0, 0, true);
if(dInfo.lp[0] >= 8000) if(!dInfo.start_lp[0])
driver->draw2DImage(imageManager.tLPBar, Resize(335, 12, 335, 28), recti(0, 0, 16, 16), 0, 0, true);
else if(dInfo.lp[0] >= dInfo.start_lp[0])
driver->draw2DImage(imageManager.tLPBar, Resize(335, 12, 625, 28), recti(0, 0, 16, 16), 0, 0, true); driver->draw2DImage(imageManager.tLPBar, Resize(335, 12, 625, 28), recti(0, 0, 16, 16), 0, 0, true);
else driver->draw2DImage(imageManager.tLPBar, Resize(335, 12, 335 + 290 * dInfo.lp[0] / 8000, 28), recti(0, 0, 16, 16), 0, 0, true); else driver->draw2DImage(imageManager.tLPBar, Resize(335, 12, 335 + 290 * dInfo.lp[0] / dInfo.start_lp[0], 28), recti(0, 0, 16, 16), 0, 0, true);
if(dInfo.lp[1] >= 8000) if(!dInfo.start_lp[1])
driver->draw2DImage(imageManager.tLPBar, Resize(986, 12, 986, 28), recti(0, 0, 16, 16), 0, 0, true);
else if(dInfo.lp[1] >= dInfo.start_lp[1])
driver->draw2DImage(imageManager.tLPBar, Resize(696, 12, 986, 28), recti(0, 0, 16, 16), 0, 0, true); driver->draw2DImage(imageManager.tLPBar, Resize(696, 12, 986, 28), recti(0, 0, 16, 16), 0, 0, true);
else driver->draw2DImage(imageManager.tLPBar, Resize(986 - 290 * dInfo.lp[1] / 8000, 12, 986, 28), recti(0, 0, 16, 16), 0, 0, true); else driver->draw2DImage(imageManager.tLPBar, Resize(986 - 290 * dInfo.lp[1] / dInfo.start_lp[1], 12, 986, 28), recti(0, 0, 16, 16), 0, 0, true);
if(lpframe) { if(lpframe) {
dInfo.lp[lpplayer] -= lpd; dInfo.lp[lpplayer] -= lpd;
myswprintf(dInfo.strLP[lpplayer], L"%d", dInfo.lp[lpplayer]); myswprintf(dInfo.strLP[lpplayer], L"%d", dInfo.lp[lpplayer]);
...@@ -511,6 +515,14 @@ void Game::DrawMisc() { ...@@ -511,6 +515,14 @@ void Game::DrawMisc() {
} }
} }
if(!dInfo.isReplay && dInfo.player_type < 7 && dInfo.time_limit) { if(!dInfo.isReplay && dInfo.player_type < 7 && dInfo.time_limit) {
DrawShadowText(numFont, L"/", Resize(455, 31, 525, 50), Resize(0, 1, 2, 0), dInfo.time_color[0], 0xff000000, true, false, 0);
DrawShadowText(numFont, dInfo.str_time_left[0], Resize(455, 31, 490, 50), Resize(0, 1, 2, 0), dInfo.time_color[0], 0xff000000, true, false, 0);
DrawShadowText(numFont, dInfo.str_time_limit, Resize(490, 31, 525, 50), Resize(0, 1, 2, 0), dInfo.time_color[0], 0xff000000, true, false, 0);
DrawShadowText(numFont, L"/", Resize(795, 31, 865, 50), Resize(0, 1, 2, 0), dInfo.time_color[1], 0xff000000, true, false, 0);
DrawShadowText(numFont, dInfo.str_time_left[1], Resize(795, 31, 830, 50), Resize(0, 1, 2, 0), dInfo.time_color[1], 0xff000000, true, false, 0);
DrawShadowText(numFont, dInfo.str_time_limit, Resize(830, 31, 865, 50), Resize(0, 1, 2, 0), dInfo.time_color[1], 0xff000000, true, false, 0);
driver->draw2DRectangle(Resize(525, 34, 525 + dInfo.time_left[0] * 100 / dInfo.time_limit, 44), 0xa0e0e0e0, 0xa0e0e0e0, 0xa0c0c0c0, 0xa0c0c0c0); driver->draw2DRectangle(Resize(525, 34, 525 + dInfo.time_left[0] * 100 / dInfo.time_limit, 44), 0xa0e0e0e0, 0xa0e0e0e0, 0xa0c0c0c0, 0xa0c0c0c0);
driver->draw2DRectangleOutline(Resize(525, 34, 625, 44), 0xffffffff); driver->draw2DRectangleOutline(Resize(525, 34, 625, 44), 0xffffffff);
driver->draw2DRectangle(Resize(795 - dInfo.time_left[1] * 100 / dInfo.time_limit, 34, 795, 44), 0xa0e0e0e0, 0xa0e0e0e0, 0xa0c0c0c0, 0xa0c0c0c0); driver->draw2DRectangle(Resize(795 - dInfo.time_left[1] * 100 / dInfo.time_limit, 34, 795, 44), 0xa0e0e0e0, 0xa0e0e0e0, 0xa0c0c0c0, 0xa0c0c0c0);
......
This diff is collapsed.
...@@ -33,6 +33,12 @@ private: ...@@ -33,6 +33,12 @@ private:
static wchar_t event_string[256]; static wchar_t event_string[256];
static mtrandom rnd; static mtrandom rnd;
public: public:
//modded
static unsigned int temp_ip;
static unsigned short temp_port;
static unsigned short temp_ver;
static bool try_needed;
static bool StartClient(unsigned int ip, unsigned short port, bool create_game = true); static bool StartClient(unsigned int ip, unsigned short port, bool create_game = true);
static void ConnectTimeout(evutil_socket_t fd, short events, void* arg); static void ConnectTimeout(evutil_socket_t fd, short events, void* arg);
static void StopClient(bool is_exiting = false); static void StopClient(bool is_exiting = false);
......
...@@ -858,6 +858,8 @@ bool ClientField::OnEvent(const irr::SEvent& event) { ...@@ -858,6 +858,8 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
myswprintf(formatBuffer, L"%ls[%d](%d)", myswprintf(formatBuffer, L"%ls[%d](%d)",
dataManager.FormatLocation(selectable_cards[i + pos]->overlayTarget->location, selectable_cards[i + pos]->overlayTarget->sequence), dataManager.FormatLocation(selectable_cards[i + pos]->overlayTarget->location, selectable_cards[i + pos]->overlayTarget->sequence),
selectable_cards[i + pos]->overlayTarget->sequence + 1, selectable_cards[i + pos]->sequence + 1); selectable_cards[i + pos]->overlayTarget->sequence + 1, selectable_cards[i + pos]->sequence + 1);
else if (selectable_cards[i]->location == 0)
myswprintf(formatBuffer, L"");
else else
myswprintf(formatBuffer, L"%ls[%d]", dataManager.FormatLocation(selectable_cards[i + pos]->location, selectable_cards[i + pos]->sequence), myswprintf(formatBuffer, L"%ls[%d]", dataManager.FormatLocation(selectable_cards[i + pos]->location, selectable_cards[i + pos]->sequence),
selectable_cards[i + pos]->sequence + 1); selectable_cards[i + pos]->sequence + 1);
...@@ -1791,12 +1793,21 @@ bool ClientField::OnCommonEvent(const irr::SEvent& event) { ...@@ -1791,12 +1793,21 @@ bool ClientField::OnCommonEvent(const irr::SEvent& event) {
return true; return true;
break; break;
} }
#ifdef YGOPRO_USE_IRRKLANG
case CHECKBOX_ENABLE_MUSIC: { case CHECKBOX_ENABLE_MUSIC: {
if(!mainGame->chkEnableMusic->isChecked()) if(!mainGame->chkEnableMusic->isChecked())
soundManager.StopBGM(); soundManager.StopBGM();
return true; return true;
break; break;
} }
//modded
case CHECKBOX_ENABLE_SOUND: {
if(!mainGame->chkEnableSound->isChecked())
soundManager.StopSound();
return true;
break;
}
#endif
} }
break; break;
} }
...@@ -1838,6 +1849,7 @@ bool ClientField::OnCommonEvent(const irr::SEvent& event) { ...@@ -1838,6 +1849,7 @@ bool ClientField::OnCommonEvent(const irr::SEvent& event) {
return true; return true;
break; break;
} }
#ifdef YGOPRO_USE_IRRKLANG
case SCROLL_VOLUME: { case SCROLL_VOLUME: {
mainGame->gameConf.sound_volume = (double)mainGame->scrSoundVolume->getPos() / 100; mainGame->gameConf.sound_volume = (double)mainGame->scrSoundVolume->getPos() / 100;
mainGame->gameConf.music_volume = (double)mainGame->scrMusicVolume->getPos() / 100; mainGame->gameConf.music_volume = (double)mainGame->scrMusicVolume->getPos() / 100;
...@@ -1846,6 +1858,7 @@ bool ClientField::OnCommonEvent(const irr::SEvent& event) { ...@@ -1846,6 +1858,7 @@ bool ClientField::OnCommonEvent(const irr::SEvent& event) {
return true; return true;
break; break;
} }
#endif
} }
break; break;
} }
......
This diff is collapsed.
...@@ -42,15 +42,15 @@ struct Config { ...@@ -42,15 +42,15 @@ struct Config {
int chkIgnoreDeckChanges; int chkIgnoreDeckChanges;
int defaultOT; int defaultOT;
int enable_bot_mode; int enable_bot_mode;
bool window_maximized;
int window_width;
int window_height;
bool resize_popup_menu;
bool enable_sound; bool enable_sound;
bool enable_music; bool enable_music;
double sound_volume; double sound_volume;
double music_volume; double music_volume;
int music_mode; int music_mode;
bool window_maximized;
int window_width;
int window_height;
bool resize_popup_menu;
}; };
struct DuelInfo { struct DuelInfo {
...@@ -62,8 +62,11 @@ struct DuelInfo { ...@@ -62,8 +62,11 @@ struct DuelInfo {
bool isTag; bool isTag;
bool isSingleMode; bool isSingleMode;
bool is_shuffling; bool is_shuffling;
//modded - to check swapped
bool is_swapped;
bool tag_player[2]; bool tag_player[2];
int lp[2]; int lp[2];
int start_lp[2];
int duel_rule; int duel_rule;
int turn; int turn;
short curMsg; short curMsg;
...@@ -77,6 +80,9 @@ struct DuelInfo { ...@@ -77,6 +80,9 @@ struct DuelInfo {
unsigned char time_player; unsigned char time_player;
unsigned short time_limit; unsigned short time_limit;
unsigned short time_left[2]; unsigned short time_left[2];
wchar_t str_time_limit[16];
wchar_t str_time_left[2][16];
video::SColor time_color[2];
bool isReplaySwapped; bool isReplaySwapped;
}; };
...@@ -105,6 +111,7 @@ class Game { ...@@ -105,6 +111,7 @@ class Game {
public: public:
bool Initialize(); bool Initialize();
void MainLoop(); void MainLoop();
void RefreshTimeDisplay();
void BuildProjectionMatrix(irr::core::matrix4& mProjection, f32 left, f32 right, f32 bottom, f32 top, f32 znear, f32 zfar); void BuildProjectionMatrix(irr::core::matrix4& mProjection, 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); void InitStaticText(irr::gui::IGUIStaticText* pControl, u32 cWidth, u32 cHeight, irr::gui::CGUITTFont* font, const wchar_t* text);
void SetStaticText(irr::gui::IGUIStaticText* pControl, u32 cWidth, irr::gui::CGUITTFont* font, const wchar_t* text, u32 pos = 0); void SetStaticText(irr::gui::IGUIStaticText* pControl, u32 cWidth, irr::gui::CGUITTFont* font, const wchar_t* text, u32 pos = 0);
...@@ -649,5 +656,16 @@ extern Game* mainGame; ...@@ -649,5 +656,16 @@ extern Game* mainGame;
#define BUTTON_MARKS_FILTER 380 #define BUTTON_MARKS_FILTER 380
#define BUTTON_MARKERS_OK 381 #define BUTTON_MARKERS_OK 381
#define TEXTURE_DUEL 0
#define TEXTURE_DECK 1
#define TEXTURE_MENU 2
#define TEXTURE_COVER_S 3
#define TEXTURE_COVER_O 4
#define TEXTURE_ATTACK 5
#define TEXTURE_ACTIVATE 6
#define DEFAULT_DUEL_RULE 4 #define DEFAULT_DUEL_RULE 4
#endif // GAME_H #endif // GAME_H
#include "image_manager.h" #include "image_manager.h"
#include "game.h" #include "game.h"
#ifndef _WIN32
#include <dirent.h>
#endif
namespace ygo { namespace ygo {
ImageManager imageManager; ImageManager imageManager;
bool ImageManager::Initial() { bool ImageManager::Initial() {
tCover[0] = driver->getTexture("textures/cover.jpg"); RefreshRandomImageList();
tCover[1] = driver->getTexture("textures/cover2.jpg");
tCover[0] = GetRandomImage(TEXTURE_COVER_S);
if(!tCover[0])
tCover[0] = driver->getTexture("textures/cover.jpg");
tCover[1] = GetRandomImage(TEXTURE_COVER_O);
if(!tCover[1])
tCover[1] = driver->getTexture("textures/cover2.jpg");
if(!tCover[1])
tCover[1] = GetRandomImage(TEXTURE_COVER_S);
if(!tCover[1]) if(!tCover[1])
tCover[1] = tCover[0]; tCover[1] = tCover[0];
tUnknown = driver->getTexture("textures/unknown.jpg"); tUnknown = driver->getTexture("textures/unknown.jpg");
tAct = driver->getTexture("textures/act.png"); tAct = GetRandomImage(TEXTURE_ACTIVATE);
tAttack = driver->getTexture("textures/attack.png"); tAttack = GetRandomImage(TEXTURE_ATTACK);
if(!tAct)
tAct = driver->getTexture("textures/act.png");
if(!tAttack)
tAttack = driver->getTexture("textures/attack.png");
tChain = driver->getTexture("textures/chain.png"); tChain = driver->getTexture("textures/chain.png");
tNegated = driver->getTexture("textures/negated.png"); tNegated = driver->getTexture("textures/negated.png");
tNumber = driver->getTexture("textures/number.png"); tNumber = driver->getTexture("textures/number.png");
...@@ -27,19 +42,89 @@ bool ImageManager::Initial() { ...@@ -27,19 +42,89 @@ bool ImageManager::Initial() {
tHand[0] = driver->getTexture("textures/f1.jpg"); tHand[0] = driver->getTexture("textures/f1.jpg");
tHand[1] = driver->getTexture("textures/f2.jpg"); tHand[1] = driver->getTexture("textures/f2.jpg");
tHand[2] = driver->getTexture("textures/f3.jpg"); tHand[2] = driver->getTexture("textures/f3.jpg");
tBackGround = driver->getTexture("textures/bg.jpg"); tBackGround = GetRandomImage(TEXTURE_DUEL);
tBackGround_menu = driver->getTexture("textures/bg_menu.jpg"); if(!tBackGround)
tBackGround = driver->getTexture("textures/bg.jpg");
if(!tBackGround)
tBackGround = driver->getTexture("textures/bg_duel.jpg");
tBackGround_menu = GetRandomImage(TEXTURE_MENU);
if(!tBackGround_menu)
tBackGround_menu = driver->getTexture("textures/bg_menu.jpg");
if(!tBackGround_menu)
tBackGround_menu = GetRandomImage(TEXTURE_DUEL);
if(!tBackGround_menu) if(!tBackGround_menu)
tBackGround_menu = tBackGround; tBackGround_menu = tBackGround;
tBackGround_deck = driver->getTexture("textures/bg_deck.jpg"); tBackGround_deck = GetRandomImage(TEXTURE_DECK);
if(!tBackGround_deck)
tBackGround_deck = driver->getTexture("textures/bg_deck.jpg");
if(!tBackGround_deck) if(!tBackGround_deck)
tBackGround_deck = tBackGround; tBackGround_deck = GetRandomImage(TEXTURE_DUEL);
if(!tBackGround_deck)
tBackGround_deck = tBackGround;
tField[0] = driver->getTexture("textures/field2.png"); tField[0] = driver->getTexture("textures/field2.png");
tFieldTransparent[0] = driver->getTexture("textures/field-transparent2.png"); tFieldTransparent[0] = driver->getTexture("textures/field-transparent2.png");
tField[1] = driver->getTexture("textures/field3.png"); tField[1] = driver->getTexture("textures/field3.png");
tFieldTransparent[1] = driver->getTexture("textures/field-transparent3.png"); tFieldTransparent[1] = driver->getTexture("textures/field-transparent3.png");
return true; return true;
} }
irr::video::ITexture* ImageManager::GetRandomImage(int image_type) {
int count = ImageList[image_type].size();
if(count <= 0)
return 0;
char ImageName[1024];
wchar_t fname[1024];
int image_id = rand() % count;
auto name = ImageList[image_type][image_id].c_str();
myswprintf(fname, L"./textures/%ls", name);
BufferIO::EncodeUTF8(fname, ImageName);
return driver->getTexture(ImageName);
}
void ImageManager::RefreshRandomImageList() {
RefreshImageDir(L"bg/", TEXTURE_DUEL);
RefreshImageDir(L"bg_duel/", TEXTURE_DUEL);
RefreshImageDir(L"bg_deck/", TEXTURE_DECK);
RefreshImageDir(L"bg_menu/", TEXTURE_MENU);
RefreshImageDir(L"cover/", TEXTURE_COVER_S);
RefreshImageDir(L"cover2/", TEXTURE_COVER_O);
RefreshImageDir(L"attack/", TEXTURE_ATTACK);
RefreshImageDir(L"act/", TEXTURE_ACTIVATE);
}
void ImageManager::RefreshImageDir(std::wstring path, int image_type) {
#ifdef _WIN32
WIN32_FIND_DATAW fdataw;
std::wstring search = L"./textures/" + path + L"*.*";
HANDLE fh = FindFirstFileW(search.c_str(), &fdataw);
if(fh == INVALID_HANDLE_VALUE)
return;
do {
size_t len = wcslen(fdataw.cFileName);
if((fdataw.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) || len < 5
|| !(_wcsicmp(fdataw.cFileName + len - 4, L".jpg") == 0 || _wcsicmp(fdataw.cFileName + len - 4, L".png") == 0))
continue;
std::wstring filename = path + (std::wstring)fdataw.cFileName;
ImageList[image_type].push_back(filename);
} while(FindNextFileW(fh, &fdataw));
FindClose(fh);
#else
DIR * dir;
struct dirent * dirp;
std::wstring wsearchpath = L"./textures/" + path;
char searchpath[256];
BufferIO::EncodeUTF8(wsearchpath.c_str(), searchpath);
if((dir = opendir(searchpath)) == NULL)
return;
while((dirp = readdir(dir)) != NULL) {
size_t len = strlen(dirp->d_name);
if(len < 5 || !(strcasecmp(dirp->d_name + len - 4, ".jpg") == 0 || strcasecmp(dirp->d_name + len - 4, ".png")))
continue;
wchar_t wname[256];
BufferIO::DecodeUTF8(dirp->d_name, wname);
std::wstring filename = path + (std::wstring)wname;
ImageList[image_type].push_back(filename);
}
closedir(dir);
#endif
}
void ImageManager::SetDevice(irr::IrrlichtDevice* dev) { void ImageManager::SetDevice(irr::IrrlichtDevice* dev) {
device = dev; device = dev;
driver = dev->getVideoDriver(); driver = dev->getVideoDriver();
......
...@@ -9,7 +9,12 @@ namespace ygo { ...@@ -9,7 +9,12 @@ namespace ygo {
class ImageManager { class ImageManager {
public: public:
std::vector<std::wstring> ImageList[7];
bool Initial(); bool Initial();
//random image
irr::video::ITexture* GetRandomImage(int image_type);
void RefreshRandomImageList();
void RefreshImageDir(std::wstring path, int image_type);
void SetDevice(irr::IrrlichtDevice* dev); void SetDevice(irr::IrrlichtDevice* dev);
void ClearTexture(); void ClearTexture();
void RemoveTexture(int code); void RemoveTexture(int code);
......
...@@ -7,20 +7,21 @@ project "ygopro" ...@@ -7,20 +7,21 @@ project "ygopro"
excludes "lzma/**" excludes "lzma/**"
includedirs { "../ocgcore" } includedirs { "../ocgcore" }
links { "ocgcore", "clzma", "Irrlicht", "freetype", "sqlite3", "lua" , "event" } links { "ocgcore", "clzma", "Irrlicht", "freetype", "sqlite3", "lua" , "event" }
if USE_IRRKLANG then
defines { "YGOPRO_USE_IRRKLANG" }
links { "irrKlang", "ikpmp3" }
includedirs { "../irrklang/include" }
if IRRKLANG_PRO then
defines { "IRRKLANG_STATIC" }
end
end
configuration "windows" configuration "windows"
files "ygopro.rc" files "ygopro.rc"
excludes "CGUIButton.cpp" excludes "CGUIButton.cpp"
includedirs { "../irrlicht/include", "../freetype/include", "../event/include", "../sqlite3" } includedirs { "../irrlicht/include", "../freetype/include", "../event/include", "../sqlite3" }
if USE_IRRKLANG then if USE_IRRKLANG then
defines { "YGOPRO_USE_IRRKLANG" }
links { "irrKlang" }
includedirs { "../irrklang/include" }
libdirs { "../irrklang/lib/Win32-visualStudio" } libdirs { "../irrklang/lib/Win32-visualStudio" }
if IRRKLANG_PRO then
defines { "IRRKLANG_STATIC" }
links { "ikpmp3" }
end
end end
links { "opengl32", "ws2_32", "winmm", "gdi32", "kernel32", "user32", "imm32" } links { "opengl32", "ws2_32", "winmm", "gdi32", "kernel32", "user32", "imm32" }
configuration {"windows", "not vs*"} configuration {"windows", "not vs*"}
...@@ -33,9 +34,6 @@ project "ygopro" ...@@ -33,9 +34,6 @@ project "ygopro"
links { "event_pthreads", "GL", "dl", "pthread" } links { "event_pthreads", "GL", "dl", "pthread" }
configuration "linux" configuration "linux"
if USE_IRRKLANG then if USE_IRRKLANG then
defines { "YGOPRO_USE_IRRKLANG" } linkoptions{ "-Wl,-rpath=./" }
links { "IrrKlang" }
linkoptions{ "-Wl,-rpath=./irrklang/bin/linux-gcc-64/" }
libdirs { "../irrklang/bin/linux-gcc-64" } libdirs { "../irrklang/bin/linux-gcc-64" }
includedirs { "../irrklang/include" }
end end
...@@ -166,6 +166,8 @@ bool ReplayMode::StartDuel() { ...@@ -166,6 +166,8 @@ bool ReplayMode::StartDuel() {
set_player_info(pduel, 1, start_lp, start_hand, draw_count); set_player_info(pduel, 1, start_lp, start_hand, draw_count);
mainGame->dInfo.lp[0] = start_lp; mainGame->dInfo.lp[0] = start_lp;
mainGame->dInfo.lp[1] = start_lp; mainGame->dInfo.lp[1] = start_lp;
mainGame->dInfo.start_lp[0] = start_lp;
mainGame->dInfo.start_lp[1] = start_lp;
myswprintf(mainGame->dInfo.strLP[0], L"%d", mainGame->dInfo.lp[0]); myswprintf(mainGame->dInfo.strLP[0], L"%d", mainGame->dInfo.lp[0]);
myswprintf(mainGame->dInfo.strLP[1], L"%d", mainGame->dInfo.lp[1]); myswprintf(mainGame->dInfo.strLP[1], L"%d", mainGame->dInfo.lp[1]);
mainGame->dInfo.turn = 0; mainGame->dInfo.turn = 0;
......
...@@ -31,6 +31,10 @@ void SingleDuel::Chat(DuelPlayer* dp, void* pdata, int len) { ...@@ -31,6 +31,10 @@ void SingleDuel::Chat(DuelPlayer* dp, void* pdata, int len) {
NetServer::ReSendToPlayer(players[1]); NetServer::ReSendToPlayer(players[1]);
for(auto pit = observers.begin(); pit != observers.end(); ++pit) for(auto pit = observers.begin(); pit != observers.end(); ++pit)
NetServer::ReSendToPlayer(*pit); NetServer::ReSendToPlayer(*pit);
#ifdef YGOPRO_SERVER_MODE
if(cache_recorder)
NetServer::ReSendToPlayer(cache_recorder);
#endif
} }
void SingleDuel::JoinGame(DuelPlayer* dp, void* pdata, bool is_creater) { void SingleDuel::JoinGame(DuelPlayer* dp, void* pdata, bool is_creater) {
if(!is_creater) { if(!is_creater) {
...@@ -43,6 +47,7 @@ void SingleDuel::JoinGame(DuelPlayer* dp, void* pdata, bool is_creater) { ...@@ -43,6 +47,7 @@ void SingleDuel::JoinGame(DuelPlayer* dp, void* pdata, bool is_creater) {
return; return;
} }
CTOS_JoinGame* pkt = (CTOS_JoinGame*)pdata; CTOS_JoinGame* pkt = (CTOS_JoinGame*)pdata;
/* disabled version check
if(pkt->version != PRO_VERSION) { if(pkt->version != PRO_VERSION) {
STOC_ErrorMsg scem; STOC_ErrorMsg scem;
scem.msg = ERRMSG_VERERROR; scem.msg = ERRMSG_VERERROR;
...@@ -51,6 +56,7 @@ void SingleDuel::JoinGame(DuelPlayer* dp, void* pdata, bool is_creater) { ...@@ -51,6 +56,7 @@ void SingleDuel::JoinGame(DuelPlayer* dp, void* pdata, bool is_creater) {
NetServer::DisconnectPlayer(dp); NetServer::DisconnectPlayer(dp);
return; return;
} }
*/
wchar_t jpass[20]; wchar_t jpass[20];
BufferIO::CopyWStr(pkt->pass, jpass, 20); BufferIO::CopyWStr(pkt->pass, jpass, 20);
if(wcscmp(jpass, pass)) { if(wcscmp(jpass, pass)) {
...@@ -582,7 +588,11 @@ int SingleDuel::Analyze(char* msgbuffer, unsigned int len) { ...@@ -582,7 +588,11 @@ int SingleDuel::Analyze(char* msgbuffer, unsigned int len) {
NetServer::ReSendToPlayer(*oit); NetServer::ReSendToPlayer(*oit);
break; break;
} }
case 10: { //modded
case 10:
case 11:
case 12:
case 13: {
NetServer::SendBufferToPlayer(players[0], STOC_GAME_MSG, offset, pbuf - offset); NetServer::SendBufferToPlayer(players[0], STOC_GAME_MSG, offset, pbuf - offset);
NetServer::SendBufferToPlayer(players[1], STOC_GAME_MSG, offset, pbuf - offset); NetServer::SendBufferToPlayer(players[1], STOC_GAME_MSG, offset, pbuf - offset);
for(auto oit = observers.begin(); oit != observers.end(); ++oit) for(auto oit = observers.begin(); oit != observers.end(); ++oit)
......
...@@ -47,6 +47,8 @@ int SingleMode::SinglePlayThread(void* param) { ...@@ -47,6 +47,8 @@ int SingleMode::SinglePlayThread(void* param) {
set_player_info(pduel, 1, start_lp, start_hand, draw_count); set_player_info(pduel, 1, start_lp, start_hand, draw_count);
mainGame->dInfo.lp[0] = start_lp; mainGame->dInfo.lp[0] = start_lp;
mainGame->dInfo.lp[1] = start_lp; mainGame->dInfo.lp[1] = start_lp;
mainGame->dInfo.start_lp[0] = start_lp;
mainGame->dInfo.start_lp[1] = start_lp;
myswprintf(mainGame->dInfo.strLP[0], L"%d", mainGame->dInfo.lp[0]); myswprintf(mainGame->dInfo.strLP[0], L"%d", mainGame->dInfo.lp[0]);
myswprintf(mainGame->dInfo.strLP[1], L"%d", mainGame->dInfo.lp[1]); myswprintf(mainGame->dInfo.strLP[1], L"%d", mainGame->dInfo.lp[1]);
BufferIO::CopyWStr(mainGame->ebNickName->getText(), mainGame->dInfo.hostname, 20); BufferIO::CopyWStr(mainGame->ebNickName->getText(), mainGame->dInfo.hostname, 20);
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
#ifndef _WIN32 #ifndef _WIN32
#include <dirent.h> #include <dirent.h>
#endif #endif
#ifdef IRRKLANG_STATIC #ifdef YGOPRO_USE_IRRKLANG
#include "../ikpmp3/ikpMP3.h" #include "../ikpmp3/ikpMP3.h"
#endif #endif
...@@ -13,15 +13,15 @@ SoundManager soundManager; ...@@ -13,15 +13,15 @@ SoundManager soundManager;
bool SoundManager::Init() { bool SoundManager::Init() {
#ifdef YGOPRO_USE_IRRKLANG #ifdef YGOPRO_USE_IRRKLANG
bgm_scene = -1; bgm_scene = -1;
previous_bgm_scene = -1;
RefreshBGMList(); RefreshBGMList();
bgm_process = false;
engineSound = irrklang::createIrrKlangDevice(); engineSound = irrklang::createIrrKlangDevice();
engineMusic = irrklang::createIrrKlangDevice(); engineMusic = irrklang::createIrrKlangDevice();
if(!engineSound || !engineMusic) { if(!engineSound || !engineMusic) {
return false; return false;
} else { } else {
#ifdef IRRKLANG_STATIC
irrklang::ikpMP3Init(engineMusic); irrklang::ikpMP3Init(engineMusic);
#endif
return true; return true;
} }
#endif // YGOPRO_USE_IRRKLANG #endif // YGOPRO_USE_IRRKLANG
...@@ -29,6 +29,7 @@ bool SoundManager::Init() { ...@@ -29,6 +29,7 @@ bool SoundManager::Init() {
return false; return false;
} }
void SoundManager::RefreshBGMList() { void SoundManager::RefreshBGMList() {
#ifdef YGOPRO_USE_IRRKLANG
RefershBGMDir(L"", BGM_DUEL); RefershBGMDir(L"", BGM_DUEL);
RefershBGMDir(L"duel/", BGM_DUEL); RefershBGMDir(L"duel/", BGM_DUEL);
RefershBGMDir(L"menu/", BGM_MENU); RefershBGMDir(L"menu/", BGM_MENU);
...@@ -37,8 +38,11 @@ void SoundManager::RefreshBGMList() { ...@@ -37,8 +38,11 @@ void SoundManager::RefreshBGMList() {
RefershBGMDir(L"disadvantage/", BGM_DISADVANTAGE); RefershBGMDir(L"disadvantage/", BGM_DISADVANTAGE);
RefershBGMDir(L"win/", BGM_WIN); RefershBGMDir(L"win/", BGM_WIN);
RefershBGMDir(L"lose/", BGM_LOSE); RefershBGMDir(L"lose/", BGM_LOSE);
RefershBGMDir(L"custom/", BGM_CUSTOM);
#endif
} }
void SoundManager::RefershBGMDir(std::wstring path, int scene) { void SoundManager::RefershBGMDir(std::wstring path, int scene) {
#ifdef YGOPRO_USE_IRRKLANG
#ifdef _WIN32 #ifdef _WIN32
WIN32_FIND_DATAW fdataw; WIN32_FIND_DATAW fdataw;
std::wstring search = L"./sound/BGM/" + path + L"*.*"; std::wstring search = L"./sound/BGM/" + path + L"*.*";
...@@ -75,6 +79,7 @@ void SoundManager::RefershBGMDir(std::wstring path, int scene) { ...@@ -75,6 +79,7 @@ void SoundManager::RefershBGMDir(std::wstring path, int scene) {
} }
closedir(dir); closedir(dir);
#endif #endif
#endif
} }
void SoundManager::PlaySoundEffect(int sound) { void SoundManager::PlaySoundEffect(int sound) {
#ifdef YGOPRO_USE_IRRKLANG #ifdef YGOPRO_USE_IRRKLANG
...@@ -239,12 +244,12 @@ void SoundManager::PlayMusic(char* song, bool loop) { ...@@ -239,12 +244,12 @@ void SoundManager::PlayMusic(char* song, bool loop) {
} }
void SoundManager::PlayBGM(int scene) { void SoundManager::PlayBGM(int scene) {
#ifdef YGOPRO_USE_IRRKLANG #ifdef YGOPRO_USE_IRRKLANG
if(!mainGame->chkEnableMusic->isChecked()) if(!mainGame->chkEnableMusic->isChecked() || bgm_process)
return; return;
if(!mainGame->chkMusicMode->isChecked()) if(!mainGame->chkMusicMode->isChecked())
scene = BGM_ALL; scene = BGM_ALL;
char BGMName[1024]; char BGMName[1024];
if(scene != bgm_scene || (soundBGM && soundBGM->isFinished())) { if (((scene != bgm_scene) && (bgm_scene != BGM_CUSTOM)) || ((scene != previous_bgm_scene) && (bgm_scene == BGM_CUSTOM)) || (soundBGM && soundBGM->isFinished())) {
int count = BGMList[scene].size(); int count = BGMList[scene].size();
if(count <= 0) if(count <= 0)
return; return;
...@@ -258,11 +263,39 @@ void SoundManager::PlayBGM(int scene) { ...@@ -258,11 +263,39 @@ void SoundManager::PlayBGM(int scene) {
} }
#endif #endif
} }
void SoundManager::PlayCustomBGM(char* BGMName) {
#ifdef YGOPRO_USE_IRRKLANG
if(!mainGame->chkEnableMusic->isChecked() || !mainGame->chkMusicMode->isChecked() || bgm_process)
return;
if(engineMusic->isCurrentlyPlaying(BGMName))
return;
bgm_process = true;
int pscene = bgm_scene;
if (pscene != BGM_CUSTOM)
previous_bgm_scene = pscene;
bgm_scene = BGM_CUSTOM;
PlayMusic(BGMName, false);
bgm_process = false;
#endif
}
void SoundManager::PlayCustomSound(char* SoundName) {
#ifdef YGOPRO_USE_IRRKLANG
if(!mainGame->chkEnableSound->isChecked())
return;
engineSound->play2D(SoundName);
engineSound->setSoundVolume(mainGame->gameConf.sound_volume);
#endif
}
void SoundManager::StopBGM() { void SoundManager::StopBGM() {
#ifdef YGOPRO_USE_IRRKLANG #ifdef YGOPRO_USE_IRRKLANG
engineMusic->stopAllSounds(); engineMusic->stopAllSounds();
#endif #endif
} }
void SoundManager::StopSound() {
#ifdef YGOPRO_USE_IRRKLANG
engineSound->stopAllSounds();
#endif
}
void SoundManager::SetSoundVolume(double volume) { void SoundManager::SetSoundVolume(double volume) {
#ifdef YGOPRO_USE_IRRKLANG #ifdef YGOPRO_USE_IRRKLANG
engineSound->setSoundVolume(volume); engineSound->setSoundVolume(volume);
......
...@@ -10,8 +10,10 @@ namespace ygo { ...@@ -10,8 +10,10 @@ namespace ygo {
class SoundManager { class SoundManager {
private: private:
std::vector<std::wstring> BGMList[8]; std::vector<std::wstring> BGMList[9];
int bgm_scene; int bgm_scene;
int previous_bgm_scene;
bool bgm_process;
#ifdef YGOPRO_USE_IRRKLANG #ifdef YGOPRO_USE_IRRKLANG
irrklang::ISoundEngine* engineSound; irrklang::ISoundEngine* engineSound;
irrklang::ISoundEngine* engineMusic; irrklang::ISoundEngine* engineMusic;
...@@ -26,7 +28,10 @@ public: ...@@ -26,7 +28,10 @@ public:
void PlayDialogSound(irr::gui::IGUIElement * element); void PlayDialogSound(irr::gui::IGUIElement * element);
void PlayMusic(char* song, bool loop); void PlayMusic(char* song, bool loop);
void PlayBGM(int scene); void PlayBGM(int scene);
void PlayCustomBGM(char* BGMName);
void PlayCustomSound(char* SoundName);
void StopBGM(); void StopBGM();
void StopSound();
void SetSoundVolume(double volume); void SetSoundVolume(double volume);
void SetMusicVolume(double volume); void SetMusicVolume(double volume);
}; };
...@@ -74,6 +79,8 @@ extern SoundManager soundManager; ...@@ -74,6 +79,8 @@ extern SoundManager soundManager;
#define BGM_DISADVANTAGE 5 #define BGM_DISADVANTAGE 5
#define BGM_WIN 6 #define BGM_WIN 6
#define BGM_LOSE 7 #define BGM_LOSE 7
//modded
#define BGM_CUSTOM 8
} }
......
...@@ -39,6 +39,7 @@ void TagDuel::JoinGame(DuelPlayer* dp, void* pdata, bool is_creater) { ...@@ -39,6 +39,7 @@ void TagDuel::JoinGame(DuelPlayer* dp, void* pdata, bool is_creater) {
return; return;
} }
CTOS_JoinGame* pkt = (CTOS_JoinGame*)pdata; CTOS_JoinGame* pkt = (CTOS_JoinGame*)pdata;
/* disabled version check
if(pkt->version != PRO_VERSION) { if(pkt->version != PRO_VERSION) {
STOC_ErrorMsg scem; STOC_ErrorMsg scem;
scem.msg = ERRMSG_VERERROR; scem.msg = ERRMSG_VERERROR;
...@@ -47,6 +48,7 @@ void TagDuel::JoinGame(DuelPlayer* dp, void* pdata, bool is_creater) { ...@@ -47,6 +48,7 @@ void TagDuel::JoinGame(DuelPlayer* dp, void* pdata, bool is_creater) {
NetServer::DisconnectPlayer(dp); NetServer::DisconnectPlayer(dp);
return; return;
} }
*/
wchar_t jpass[20]; wchar_t jpass[20];
BufferIO::CopyWStr(pkt->pass, jpass, 20); BufferIO::CopyWStr(pkt->pass, jpass, 20);
if(wcscmp(jpass, pass)) { if(wcscmp(jpass, pass)) {
...@@ -535,6 +537,16 @@ int TagDuel::Analyze(char* msgbuffer, unsigned int len) { ...@@ -535,6 +537,16 @@ int TagDuel::Analyze(char* msgbuffer, unsigned int len) {
NetServer::ReSendToPlayer(*oit); NetServer::ReSendToPlayer(*oit);
break; break;
} }
//modded
case 11:
case 12:
case 13: {
for(int i = 0; i < 4; ++i)
NetServer::SendBufferToPlayer(players[i], STOC_GAME_MSG, offset, pbuf - offset);
for(auto oit = observers.begin(); oit != observers.end(); ++oit)
NetServer::ReSendToPlayer(*oit);
break;
}
} }
break; break;
} }
...@@ -845,7 +857,7 @@ int TagDuel::Analyze(char* msgbuffer, unsigned int len) { ...@@ -845,7 +857,7 @@ int TagDuel::Analyze(char* msgbuffer, unsigned int len) {
break; break;
} }
case MSG_NEW_TURN: { case MSG_NEW_TURN: {
pbuf++; int r_player = BufferIO::ReadInt8(pbuf);
time_limit[0] = host_info.time_limit; time_limit[0] = host_info.time_limit;
time_limit[1] = host_info.time_limit; time_limit[1] = host_info.time_limit;
NetServer::SendBufferToPlayer(players[0], STOC_GAME_MSG, offset, pbuf - offset); NetServer::SendBufferToPlayer(players[0], STOC_GAME_MSG, offset, pbuf - offset);
...@@ -854,20 +866,22 @@ int TagDuel::Analyze(char* msgbuffer, unsigned int len) { ...@@ -854,20 +866,22 @@ int TagDuel::Analyze(char* msgbuffer, unsigned int len) {
NetServer::ReSendToPlayer(players[3]); NetServer::ReSendToPlayer(players[3]);
for(auto oit = observers.begin(); oit != observers.end(); ++oit) for(auto oit = observers.begin(); oit != observers.end(); ++oit)
NetServer::ReSendToPlayer(*oit); NetServer::ReSendToPlayer(*oit);
if(turn_count > 0) { if(!(r_player & 0x2)) {
if(turn_count % 2 == 0) { if(turn_count > 0) {
if(cur_player[0] == players[0]) if(turn_count % 2 == 0) {
cur_player[0] = players[1]; if(cur_player[0] == players[0])
else cur_player[0] = players[1];
cur_player[0] = players[0]; else
} else { cur_player[0] = players[0];
if(cur_player[1] == players[2]) } else {
cur_player[1] = players[3]; if(cur_player[1] == players[2])
else cur_player[1] = players[3];
cur_player[1] = players[2]; else
cur_player[1] = players[2];
}
} }
turn_count++;
} }
turn_count++;
break; break;
} }
case MSG_NEW_PHASE: { case MSG_NEW_PHASE: {
......
premake/gframe/ygopro.ico

176 KB | W: | H:

premake/gframe/ygopro.ico

32.2 KB | W: | H:

premake/gframe/ygopro.ico
premake/gframe/ygopro.ico
premake/gframe/ygopro.ico
premake/gframe/ygopro.ico
  • 2-up
  • Swipe
  • Onion skin
...@@ -11,13 +11,13 @@ BLOCK "StringFileInfo" ...@@ -11,13 +11,13 @@ BLOCK "StringFileInfo"
BEGIN BEGIN
BLOCK "080404b0" BLOCK "080404b0"
BEGIN BEGIN
VALUE "FileDescription", "YGOPro ver.233 test" VALUE "FileDescription", "YGOPro by Koishi"
VALUE "InternalName", "YGOPro" VALUE "InternalName", "YGOPro"
VALUE "LegalCopyright", "Copyright (C) 2017 Fluorohydride" VALUE "LegalCopyright", "Copyright (C) 2017 Fluorohydride"
VALUE "OriginalFilename", "YGOPro_test.exe" VALUE "OriginalFilename", "ygopro.exe"
VALUE "ProductName", "YGOPro" VALUE "ProductName", "YGOPro"
VALUE "FileVersion", "1.034.2.233" VALUE "FileVersion", "1.034.2.Koishi"
VALUE "ProductVersion", "1.034.2.233" VALUE "ProductVersion", "1.034.2.Koishi"
END END
END END
BLOCK "VarFileInfo" BLOCK "VarFileInfo"
......
diff --git a/source/Irrlicht/CGUIEditBox.cpp b/source/Irrlicht/CGUIEditBox.cpp
index 395fb69..323c9a2 100644
--- a/source/Irrlicht/CGUIEditBox.cpp
+++ b/source/Irrlicht/CGUIEditBox.cpp
@@ -287,9 +287,11 @@ bool CGUIEditBox::processKey(const SEvent& event)
const s32 realmbgn = MarkBegin < MarkEnd ? MarkBegin : MarkEnd;
const s32 realmend = MarkBegin < MarkEnd ? MarkEnd : MarkBegin;
- core::stringc s;
- s = Text.subString(realmbgn, realmend - realmbgn).c_str();
- Operator->copyToClipboard(s.c_str());
+ const int max_char_size = sizeof(wchar_t) * 3 / 2;
+ int max_size = (realmend - realmbgn)*max_char_size + 1;
+ c8 *s = new char[max_size];
+ wcstombs(s, Text.subString(realmbgn, realmend-realmbgn).c_str(), max_size);
+ Operator->copyToClipboard(s);
}
break;
case KEY_KEY_X:
@@ -300,9 +302,11 @@ bool CGUIEditBox::processKey(const SEvent& event)
const s32 realmend = MarkBegin < MarkEnd ? MarkEnd : MarkBegin;
// copy
- core::stringc sc;
- sc = Text.subString(realmbgn, realmend - realmbgn).c_str();
- Operator->copyToClipboard(sc.c_str());
+ const int max_char_size = sizeof(wchar_t) * 3 / 2;
+ int max_size = (realmend - realmbgn)*max_char_size + 1;
+ c8 *s = new char[max_size];
+ wcstombs(s, Text.subString(realmbgn, realmend-realmbgn).c_str(), max_size);
+ Operator->copyToClipboard(s);
if (isEnabled())
{
diff --git a/source/Irrlicht/MacOSX/AppDelegate.h b/source/Irrlicht/MacOSX/AppDelegate.h
index ccb116d..29705f2 100644
--- a/source/Irrlicht/MacOSX/AppDelegate.h
+++ b/source/Irrlicht/MacOSX/AppDelegate.h
@@ -10,7 +10,7 @@
#import <Cocoa/Cocoa.h>
#import "CIrrDeviceMacOSX.h"
-@interface AppDelegate : NSObject
+@interface AppDelegate : NSTextView <NSApplicationDelegate>
{
BOOL _quit;
irr::CIrrDeviceMacOSX *_device;
diff --git a/source/Irrlicht/MacOSX/AppDelegate.mm b/source/Irrlicht/MacOSX/AppDelegate.mm
index 14a7f86..0ab0c43 100644
--- a/source/Irrlicht/MacOSX/AppDelegate.mm
+++ b/source/Irrlicht/MacOSX/AppDelegate.mm
@@ -74,6 +74,30 @@
return (_quit);
}
+
+- (void)keyDown:(NSEvent *)event
+{
+ [self interpretKeyEvents:@[event]];
+}
+
+- (void)insertText:(id)string
+{
+ [self setString: @""];
+ if ([string isKindOfClass:[NSAttributedString class]])
+ {
+ _device->handleInputEvent([[string string] UTF8String]);
+ }
+ else
+ {
+ _device->handleInputEvent([string UTF8String]);
+ }
+}
+
+- (void)doCommandBySelector:(SEL)selector
+{
+ _device->processKeyEvent();
+}
+
@end
#endif // _IRR_COMPILE_WITH_OSX_DEVICE_
diff --git a/source/Irrlicht/MacOSX/CIrrDeviceMacOSX.h b/source/Irrlicht/MacOSX/CIrrDeviceMacOSX.h
index f629588..d2fefae 100644
--- a/source/Irrlicht/MacOSX/CIrrDeviceMacOSX.h
+++ b/source/Irrlicht/MacOSX/CIrrDeviceMacOSX.h
@@ -95,6 +95,8 @@ namespace irr
void setMouseLocation(int x, int y);
void setResize(int width, int height);
void setCursorVisible(bool visible);
+ void handleInputEvent(const char *str);
+ void processKeyEvent();
private:
diff --git a/source/Irrlicht/MacOSX/CIrrDeviceMacOSX.mm b/source/Irrlicht/MacOSX/CIrrDeviceMacOSX.mm
index ad493fc..8692d0c 100644
--- a/source/Irrlicht/MacOSX/CIrrDeviceMacOSX.mm
+++ b/source/Irrlicht/MacOSX/CIrrDeviceMacOSX.mm
@@ -496,7 +496,7 @@ CIrrDeviceMacOSX::CIrrDeviceMacOSX(const SIrrlichtCreationParameters& param)
{
[[NSAutoreleasePool alloc] init];
[NSApplication sharedApplication];
- [NSApp setDelegate:(id<NSFileManagerDelegate>)[[[AppDelegate alloc] initWithDevice:this] autorelease]];
+ [NSApp setDelegate:[[[[AppDelegate alloc] initWithDevice:this] initWithFrame:NSZeroRect] autorelease]];
[NSBundle loadNibNamed:@"MainMenu" owner:[NSApp delegate]];
[NSApp finishLaunching];
}
@@ -592,6 +592,38 @@ void CIrrDeviceMacOSX::closeDevice()
CGLContext = NULL;
}
+void CIrrDeviceMacOSX::processKeyEvent()
+{
+ irr::SEvent ievent;
+ NSEvent *event = [[NSApplication sharedApplication] currentEvent];
+ postKeyEvent(event, ievent, true);
+}
+
+void CIrrDeviceMacOSX::handleInputEvent(const char *cStr)
+{
+ SEvent ievent;
+
+ // TODO: we should have such a function in core::string
+ size_t lenOld = strlen(cStr);
+ wchar_t *ws = new wchar_t[lenOld + 1];
+ size_t len = mbstowcs(ws,cStr,lenOld);
+ ws[len] = 0;
+ irr::core::stringw widep(ws);
+ delete[] ws;
+
+ ievent.EventType = irr::EET_KEY_INPUT_EVENT;
+ ievent.KeyInput.Key = (irr::EKEY_CODE)0;
+ ievent.KeyInput.PressedDown = true;
+ ievent.KeyInput.Shift = false;
+ ievent.KeyInput.Control = false;
+
+ for (int i = 0; i < widep.size(); ++i)
+ {
+ ievent.KeyInput.Char = widep[i];
+ postEventFromUser(ievent);
+ }
+}
+
bool CIrrDeviceMacOSX::createWindow()
{
CGDisplayErr error;
@@ -881,6 +913,8 @@ bool CIrrDeviceMacOSX::createWindow()
newSwapInterval = (CreationParams.Vsync) ? 1 : 0;
CGLSetParameter(CGLContext,kCGLCPSwapInterval,&newSwapInterval);
}
+
+ [[Window contentView] addSubview:(AppDelegate*)[NSApp delegate]];
}
return (result);
@@ -971,6 +1005,33 @@ bool CIrrDeviceMacOSX::run()
os::Timer::tick();
storeMouseLocation();
+ auto focusElement = getGUIEnvironment()->getFocus();
+ bool editing = focusElement && focusElement->getType() == irr::gui::EGUIET_EDIT_BOX;
+
+ if (!editing)
+ {
+ [Window makeFirstResponder:nil];
+ }
+ else
+ {
+ auto textView = (NSTextView*)[NSApp delegate];
+ auto crect = focusElement->getAbsolutePosition();
+
+ // ensure font height enough to fill the rect, otherwize ime window will overlaps the edit box
+ [textView setFont:[NSFont userFontOfSize:crect.getHeight()]];
+
+ // change origin from top left to bottom right
+ NSRect rect = {
+ crect.UpperLeftCorner.X,
+ [[textView superview] frame].size.height - crect.LowerRightCorner.Y,
+ crect.getWidth(), crect.getHeight(),
+ };
+ [textView setFrame:rect];
+
+ // start to receive input events
+ [Window makeFirstResponder:textView];
+ }
+
event = [NSApp nextEventMatchingMask:NSAnyEventMask untilDate:[NSDate distantPast] inMode:NSDefaultRunLoopMode dequeue:YES];
if (event != nil)
{
@@ -979,6 +1040,13 @@ bool CIrrDeviceMacOSX::run()
switch([(NSEvent *)event type])
{
case NSKeyDown:
+ if (editing)
+ {
+ // delegate to text edit control to handle text input
+ [NSApp sendEvent:event];
+ break;
+ }
+
postKeyEvent(event,ievent,true);
break;
@@ -1199,22 +1267,22 @@ void CIrrDeviceMacOSX::postKeyEvent(void *event,irr::SEvent &ievent,bool pressed
}
else
{
- cStr = (unsigned char *)[str cStringUsingEncoding:NSWindowsCP1252StringEncoding];
+ cStr = (unsigned char *)[str UTF8String];
if (cStr != NULL && strlen((char*)cStr) > 0)
{
mchar = cStr[0];
mkey = toupper(mchar);
- if ([(NSEvent *)event modifierFlags] & NSCommandKeyMask)
- {
- if (mkey == 'C' || mkey == 'V' || mkey == 'X')
- {
- mchar = 0;
- skipCommand = true;
- }
- }
}
}
}
+ if ([(NSEvent *)event modifierFlags] & NSCommandKeyMask)
+ {
+ if (mkey == 'C' || mkey == 'V' || mkey == 'X')
+ {
+ mchar = 0;
+ skipCommand = true;
+ }
+ }
ievent.EventType = irr::EET_KEY_INPUT_EVENT;
ievent.KeyInput.Key = (irr::EKEY_CODE)mkey;
diff --git a/source/Irrlicht/MacOSX/OSXClipboard.mm b/source/Irrlicht/MacOSX/OSXClipboard.mm
index d549911..1925e80 100644
--- a/source/Irrlicht/MacOSX/OSXClipboard.mm
+++ b/source/Irrlicht/MacOSX/OSXClipboard.mm
@@ -13,7 +13,7 @@ void OSXCopyToClipboard(const char *text)
if ((text != NULL) && (strlen(text) > 0))
{
- str = [NSString stringWithCString:text encoding:NSWindowsCP1252StringEncoding];
+ str = [NSString stringWithUTF8String:text];
board = [NSPasteboard generalPasteboard];
[board declareTypes:[NSArray arrayWithObject:NSStringPboardType] owner:NSApp];
[board setString:str forType:NSStringPboardType];
@@ -30,7 +30,7 @@ char* OSXCopyFromClipboard()
board = [NSPasteboard generalPasteboard];
str = [board stringForType:NSStringPboardType];
if (str != nil)
- result = (char*)[str cStringUsingEncoding:NSWindowsCP1252StringEncoding];
+ result = (char*)[str UTF8String];
return (result);
}
...@@ -2,8 +2,10 @@ solution "ygo" ...@@ -2,8 +2,10 @@ solution "ygo"
location "build" location "build"
language "C++" language "C++"
objdir "obj" objdir "obj"
startproject "ygopro"
configurations { "Debug", "Release" } configurations { "Debug", "Release" }
defines { "LUA_COMPAT_5_2" }
configuration "windows" configuration "windows"
defines { "WIN32", "_WIN32" } defines { "WIN32", "_WIN32" }
...@@ -15,8 +17,10 @@ solution "ygo" ...@@ -15,8 +17,10 @@ solution "ygo"
configuration "macosx" configuration "macosx"
defines { "LUA_USE_MACOSX" } defines { "LUA_USE_MACOSX" }
includedirs { "/opt/local/include" } includedirs { "/usr/local/include/*" }
libdirs { "/opt/local/lib" } libdirs { "/usr/local/lib", "/usr/X11/lib" }
buildoptions { "-stdlib=libc++" }
links {"OpenGL.framework","Cocoa.framework","IOKit.framework"}
configuration "linux" configuration "linux"
defines { "LUA_USE_LINUX" } defines { "LUA_USE_LINUX" }
...@@ -45,7 +49,7 @@ solution "ygo" ...@@ -45,7 +49,7 @@ solution "ygo"
defines { "_ITERATOR_DEBUG_LEVEL=0" } defines { "_ITERATOR_DEBUG_LEVEL=0" }
configuration "Release" configuration "Release"
flags { "OptimizeSpeed" } --flags { "OptimizeSpeed" }
targetdir "bin/release" targetdir "bin/release"
include "ocgcore" include "ocgcore"
......
...@@ -2,12 +2,18 @@ solution "ygo" ...@@ -2,12 +2,18 @@ solution "ygo"
location "build" location "build"
language "C++" language "C++"
objdir "obj" objdir "obj"
if os.ishost("windows") or os.getenv("USE_IRRKLANG") then
USE_IRRKLANG = true
if os.getenv("irrklang_pro") then
IRRKLANG_PRO = true
end
end
USE_IRRKLANG = true configurations { "Debug", "Release" }
IRRKLANG_PRO = true defines { "LUA_COMPAT_5_2" }
if os.getenv("YGOPRO_COMPAT_MYCARD") then
configurations { "Release", "Debug" } defines { "YGOPRO_COMPAT_MYCARD" }
end
configuration "windows" configuration "windows"
defines { "WIN32", "_WIN32", "WINVER=0x0501" } defines { "WIN32", "_WIN32", "WINVER=0x0501" }
libdirs { "$(DXSDK_DIR)Lib/x86" } libdirs { "$(DXSDK_DIR)Lib/x86" }
...@@ -29,7 +35,6 @@ solution "ygo" ...@@ -29,7 +35,6 @@ solution "ygo"
configuration "linux" configuration "linux"
defines { "LUA_USE_LINUX" } defines { "LUA_USE_LINUX" }
buildoptions { "-U_FORTIFY_SOURCE" }
configuration "Release" configuration "Release"
optimize "Speed" optimize "Speed"
...@@ -65,13 +70,13 @@ solution "ygo" ...@@ -65,13 +70,13 @@ solution "ygo"
include "ocgcore" include "ocgcore"
include "gframe" include "gframe"
if os.ishost("windows") then if os.ishost("windows") then
include "event" include "event"
include "freetype" include "freetype"
include "irrlicht" include "irrlicht"
include "lua" include "lua"
include "sqlite3" include "sqlite3"
if IRRKLANG_PRO then end
include "ikpmp3" if USE_IRRKLANG then
end include "ikpmp3"
end end
...@@ -2,37 +2,42 @@ ...@@ -2,37 +2,42 @@
#nickname & gamename should be less than 20 characters #nickname & gamename should be less than 20 characters
use_d3d = 0 use_d3d = 0
use_image_scale = 1 use_image_scale = 1
pro_version = 4930
antialias = 2 antialias = 2
errorlog = 1 errorlog = 3
nickname = YGO233 Player nickname = Komeiji Koishi
gamename = Game gamename = Game
lastdeck = new lastdeck = new
textfont = c:/windows/fonts/msyh.ttf 14 textfont = c:/windows/fonts/simhei.ttf 14
numfont = c:/windows/fonts/arialbd.ttf numfont = c:/windows/fonts/arial.ttf
serverport = 7911 serverport = 7911
lasthost = s1.ygo233.com lasthost = 127.0.0.1
lastport = 233 lastport = 7911
automonsterpos = 0 automonsterpos = 0
autospellpos = 1 autospellpos = 0
randompos = 0 randompos = 0
autochain = 0 autochain = 0
waitchain = 0 waitchain = 0
mute_opponent = 0 mute_opponent = 0
mute_spectators = 0 mute_spectators = 0
hide_setname = 0 hide_setname = 0
hide_hint_button = 0 hide_hint_button = 1
#control_mode = 0: Key A/S/D/R Chain Buttons. control_mode = 1: MouseLeft/MouseRight/NULL/F9 Without Chain Buttons #control_mode = 0: Key A/S/D/R Chain Buttons. control_mode = 1: MouseLeft/MouseRight/NULL/F9 Without Chain Buttons
control_mode = 0 control_mode = 0
draw_field_spell = 1 draw_field_spell = 1
separate_clear_button = 1 separate_clear_button = 1
#auto_search_limit >= 0: Start search automatically when the user enters N chars #auto_search_limit >= 0: Start search automatically when the user enters N chars
auto_search_limit = -1 auto_search_limit = 2
ignore_deck_changes = 0 ignore_deck_changes = 0
default_ot = 1 default_ot = 1
enable_bot_mode = 1 enable_bot_mode = 1
enable_sound = 1 enable_sound = 1
enable_music = 1 enable_music = 1
#Volume of sound and music, between 0 and 100 #Volume of sound and music, between 0 and 100
sound_volume = 50 sound_volume = 100
music_volume = 50 music_volume = 100
music_mode = 1 music_mode = 1
window_maximized = 0
window_width = 1024
window_height = 640
resize_popup_menu = 0
textures/act.png

6.73 KB | W: | H:

textures/act.png

30.7 KB | W: | H:

textures/act.png
textures/act.png
textures/act.png
textures/act.png
  • 2-up
  • Swipe
  • Onion skin
textures/attack.png

10.7 KB | W: | H:

textures/attack.png

8.03 KB | W: | H:

textures/attack.png
textures/attack.png
textures/attack.png
textures/attack.png
  • 2-up
  • Swipe
  • Onion skin
textures/bg.jpg

108 KB | W: | H:

textures/bg.jpg

395 KB | W: | H:

textures/bg.jpg
textures/bg.jpg
textures/bg.jpg
textures/bg.jpg
  • 2-up
  • Swipe
  • Onion skin
textures/bg_deck.jpg

141 KB | W: | H:

textures/bg_deck.jpg

484 KB | W: | H:

textures/bg_deck.jpg
textures/bg_deck.jpg
textures/bg_deck.jpg
textures/bg_deck.jpg
  • 2-up
  • Swipe
  • Onion skin
textures/bg_menu.jpg

212 KB | W: | H:

textures/bg_menu.jpg

804 KB | W: | H:

textures/bg_menu.jpg
textures/bg_menu.jpg
textures/bg_menu.jpg
textures/bg_menu.jpg
  • 2-up
  • Swipe
  • Onion skin
textures/chain.png

3.78 KB | W: | H:

textures/chain.png

11.4 KB | W: | H:

textures/chain.png
textures/chain.png
textures/chain.png
textures/chain.png
  • 2-up
  • Swipe
  • Onion skin
textures/cover.jpg

34.2 KB | W: | H:

textures/cover.jpg

123 KB | W: | H:

textures/cover.jpg
textures/cover.jpg
textures/cover.jpg
textures/cover.jpg
  • 2-up
  • Swipe
  • Onion skin
textures/cover2.jpg

34.2 KB | W: | H:

textures/cover2.jpg

201 KB | W: | H:

textures/cover2.jpg
textures/cover2.jpg
textures/cover2.jpg
textures/cover2.jpg
  • 2-up
  • Swipe
  • Onion skin
textures/equip.png

3.9 KB | W: | H:

textures/equip.png

25.3 KB | W: | H:

textures/equip.png
textures/equip.png
textures/equip.png
textures/equip.png
  • 2-up
  • Swipe
  • Onion skin
textures/field-transparent2.png

1.95 KB | W: | H:

textures/field-transparent2.png

17.4 KB | W: | H:

textures/field-transparent2.png
textures/field-transparent2.png
textures/field-transparent2.png
textures/field-transparent2.png
  • 2-up
  • Swipe
  • Onion skin
textures/field2.png

3.99 KB | W: | H:

textures/field2.png

17.4 KB | W: | H:

textures/field2.png
textures/field2.png
textures/field2.png
textures/field2.png
  • 2-up
  • Swipe
  • Onion skin
textures/number.png

54.3 KB | W: | H:

textures/number.png

22.8 KB | W: | H:

textures/number.png
textures/number.png
textures/number.png
textures/number.png
  • 2-up
  • Swipe
  • Onion skin
textures/target.png

4.5 KB | W: | H:

textures/target.png

29.2 KB | W: | H:

textures/target.png
textures/target.png
textures/target.png
textures/target.png
  • 2-up
  • Swipe
  • Onion skin
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