Commit 62e61afc authored by nanahira's avatar nanahira

server init

parent b1d95cf8
# data files
/beta
/expansions
/specials
/obj
# build files
/bin
/build
/obj
# dependencies
/event
/lua
/freetype
/sqlite3
/replay
/deck
/.vscode
/ikpmp3
/irrklang
/irrlicht
/lua
# gframe additionals
/gframe/ygopro.ico
/gframe/ygopro.rc
/gframe/ygopro.aps
ygopro
premake5.exe
premake5
/gframe/ygopro.icns
/gframe/dirent.h
# git repos
/CustomTools
/DataEditorX
/Magic*
/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
......@@ -9,12 +9,18 @@ addons:
packages:
- libevent-dev
- libsqlite3-dev
- liblua5.2-dev
before_install:
- git submodule update --init --recursive
- wget -O - https://github.com/premake/premake-core/releases/download/v5.0.0-alpha10/premake-5.0.0-alpha10-linux.tar.gz | tar zfx -
- wget 'http://www.lua.org/ftp/lua-5.3.4.tar.gz'
- tar zxf lua-5.3.4.tar.gz
- cd lua-5.3.4
- make linux test
- sudo make install
- cd ..
- wget -O - https://github.com/premake/premake-core/releases/download/v5.0.0-alpha12/premake-5.0.0-alpha12-linux.tar.gz | tar zfx -
script:
- ./premake5 gmake
- cd build
- sed -i 's/-llua/-llua5.2/g' ygopro.make
- make config=release
......@@ -4,25 +4,31 @@ install:
- git submodule update --init --recursive
# 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-alpha10/premake-5.0.0-alpha10-windows.zip ; exit 0"
- 7z x premake-5.0.0-alpha10-windows.zip
- 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
- bash -c "curl --retry 5 --connect-timeout 30 --location --remote-header-name --remote-name https://github.com/libevent/libevent/releases/download/release-2.0.22-stable/libevent-2.0.22-stable.tar.gz ; exit 0"
- tar xf libevent-2.0.22-stable.tar.gz
- move libevent-2.0.22-stable event
- xcopy /E event\WIN32-Code event\include
- bash -c "curl --retry 5 --connect-timeout 30 --location --remote-header-name --remote-name https://www.lua.org/ftp/lua-5.2.4.tar.gz ; exit 0"
- tar xf lua-5.2.4.tar.gz
- move lua-5.2.4\src lua
- bash -c "curl --retry 5 --connect-timeout 30 --location --remote-header-name --remote-name https://www.lua.org/ftp/lua-5.3.4.tar.gz ; exit 0"
- tar xf lua-5.3.4.tar.gz
- move lua-5.3.4\src lua
- bash -c "curl --retry 5 --connect-timeout 30 --location --remote-header-name --remote-name https://www.sqlite.org/2017/sqlite-amalgamation-3200000.zip ; exit 0"
- 7z x sqlite-amalgamation-3200000.zip
- move sqlite-amalgamation-3200000 sqlite3
- bash -c "curl --retry 5 --connect-timeout 30 --location --remote-header-name --remote-name https://www.sqlite.org/2017/sqlite-amalgamation-3210000.zip ; exit 0"
- 7z x sqlite-amalgamation-3210000.zip
- move sqlite-amalgamation-3210000 sqlite3
- appveyor DownloadFile https://github.com/tronkko/dirent/raw/master/include/dirent.h
- move dirent.h gframe\
# let premake happy
- xcopy /E premake\* .
# patch lua
# - patch -p0 < lua\lua.patch
# premake
- premake5 vs2015
......@@ -34,15 +40,82 @@ build:
after_build:
- ps: move bin\release\ygopro.exe .
- git clone https://github.com/Smile-DK/ygopro-svrelease
- bash -c "curl --retry 5 --connect-timeout 30 --location --remote-header-name --remote-name https://github.com/purerosefallen/ygopro-server/archive/master.zip ; exit 0"
- 7z x ygopro-server-master.zip
- mv -f ygopro-server-master ygopro-server
- bash -c "curl --retry 5 --connect-timeout 30 --location --remote-header-name --remote-name https://nodejs.org/dist/v9.1.0/node-v9.1.0-win-x64.zip ; exit 0"
- bash -c "curl --retry 5 --connect-timeout 30 --location --remote-header-name --remote-name https://github.com/MicrosoftArchive/redis/releases/download/win-3.2.100/Redis-x64-3.2.100.zip ; exit 0"
- 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:OutDir=../ygopro-server/windbot
- cd ../ygopro-server
- mkdir ygopro
- cd ygopro
- 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
- mkdir replay
- mv -f ../../gframe .
- mv -f ../../ocgcore .
- mv -f ../../premake .
- mv -f ../../event .
- mv -f ../../lua .
- mv -f ../../sqlite3 .
- mv -f ../../cards.cdb .
- mv -f ../../textures .
- mv -f ../../premake4.lua .
- mv -f ../../premake5.lua .
- mv -f ../../lflist.conf .
- mv -f ../../strings.conf .
- mv -f ../../system.conf .
- cp -rf ../../ygopro.exe .
- mv -f ../../premake5.exe .
- cd ..
- mkdir redis
- cd redis
- cp -rf ../../Redis-x64-3.2.100.zip .
- 7z x Redis-x64-3.2.100.zip
- rm -rf Redis-x64-3.2.100.zip
- cd ..
- cp -rf ygopro/cards.cdb windbot
- cp -rf config_build config
- cp -rf ../node-v9.1.0-win-x64.zip .
- 7z x node-v9.1.0-win-x64.zip
- rm -rf node-v9.1.0-win-x64.zip
- cp -rf node-v9.1.0-win-x64/* .
- rm -rf node-v9.1.0-win-x64
- npm install
- npm install pm2@latest -g
- npm install ws
- npm install redis
- 7z a -mx9 -xr!.git* ../ygopro-server.7z ./*
- cd ..
test: off
artifacts:
- path: ygopro.exe
name: ygopro(server)
name: ygopro
- path: ygopro-server.7z
name: ygopro-server
cache:
- premake-5.0.0-alpha10-windows.zip
- premake-5.0.0-alpha12-windows.zip
- libevent-2.0.22-stable.tar.gz
- lua-5.2.4.tar.gz
- sqlite-amalgamation-3200000.zip
- freetype-2.8.1.tar.bz2
- irrlicht-1.8.4.zip
- lua-5.3.4.tar.gz
- sqlite-amalgamation-3210000.zip
- Redis-x64-3.2.100.zip
No preview for this file type
......@@ -420,26 +420,30 @@ void ClientField::ShowSelectCard(bool buttonok, bool chain) {
selectable_cards[i]->sequence + 1);
mainGame->stCardPos[i]->setText(formatBuffer);
// color
if(conti_selecting)
mainGame->stCardPos[i]->setBackgroundColor(0xffffffff);
else if(selectable_cards[i]->location == LOCATION_OVERLAY) {
if(selectable_cards[i]->owner != selectable_cards[i]->overlayTarget->controler)
mainGame->stCardPos[i]->setOverrideColor(0xff0000ff);
if(selectable_cards[i]->overlayTarget->controler)
mainGame->stCardPos[i]->setBackgroundColor(0xffd0d0d0);
else mainGame->stCardPos[i]->setBackgroundColor(0xffffffff);
} else if(selectable_cards[i]->location == LOCATION_DECK || selectable_cards[i]->location == LOCATION_EXTRA || selectable_cards[i]->location == LOCATION_REMOVED) {
if(selectable_cards[i]->position & POS_FACEDOWN)
mainGame->stCardPos[i]->setOverrideColor(0xff0000ff);
if(selectable_cards[i]->controler)
mainGame->stCardPos[i]->setBackgroundColor(0xffd0d0d0);
else
mainGame->stCardPos[i]->setBackgroundColor(0xffffffff);
} else {
if(selectable_cards[i]->controler)
mainGame->stCardPos[i]->setBackgroundColor(0xffd0d0d0);
else
if (selectable_cards[i]->is_selected)
mainGame->stCardPos[i]->setBackgroundColor(0xffffff00);
else {
if(conti_selecting)
mainGame->stCardPos[i]->setBackgroundColor(0xffffffff);
else if(selectable_cards[i]->location == LOCATION_OVERLAY) {
if(selectable_cards[i]->owner != selectable_cards[i]->overlayTarget->controler)
mainGame->stCardPos[i]->setOverrideColor(0xff0000ff);
if(selectable_cards[i]->overlayTarget->controler)
mainGame->stCardPos[i]->setBackgroundColor(0xffd0d0d0);
else mainGame->stCardPos[i]->setBackgroundColor(0xffffffff);
} else if(selectable_cards[i]->location == LOCATION_DECK || selectable_cards[i]->location == LOCATION_EXTRA || selectable_cards[i]->location == LOCATION_REMOVED) {
if(selectable_cards[i]->position & POS_FACEDOWN)
mainGame->stCardPos[i]->setOverrideColor(0xff0000ff);
if(selectable_cards[i]->controler)
mainGame->stCardPos[i]->setBackgroundColor(0xffd0d0d0);
else
mainGame->stCardPos[i]->setBackgroundColor(0xffffffff);
} else {
if(selectable_cards[i]->controler)
mainGame->stCardPos[i]->setBackgroundColor(0xffd0d0d0);
else
mainGame->stCardPos[i]->setBackgroundColor(0xffffffff);
}
}
} else {
if(sort_list[i]) {
......
......@@ -64,6 +64,7 @@ public:
int select_counter_type;
std::vector<ClientCard*> selectable_cards;
std::vector<ClientCard*> selected_cards;
std::vector<ClientCard*> unselected_cards;
std::set<ClientCard*> selectsum_cards;
std::vector<ClientCard*> selectsum_all;
std::vector<int> opcode;
......
......@@ -3,6 +3,7 @@
#include "data_manager.h"
#include "deck_manager.h"
#include "image_manager.h"
#include "sound_manager.h"
#include "game.h"
#include "duelclient.h"
#include <algorithm>
......@@ -122,6 +123,7 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
break;
switch(event.GUIEvent.EventType) {
case irr::gui::EGET_BUTTON_CLICKED: {
soundManager.PlaySoundEffect(SOUND_BUTTON);
switch(id) {
case BUTTON_CLEAR_DECK: {
mainGame->gMutex.Lock();
......@@ -220,6 +222,7 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
for(int i = 0; i < 32; ++i, filter <<= 1)
if(mainGame->chkCategory[i]->isChecked())
filter_effect |= filter;
mainGame->btnEffectFilter->setPressed(filter_effect > 0);
mainGame->HideElement(mainGame->wCategories);
InstantSearch();
break;
......@@ -227,6 +230,7 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
case BUTTON_SIDE_OK: {
if(deckManager.current_deck.main.size() != pre_mainc || deckManager.current_deck.extra.size() != pre_extrac
|| deckManager.current_deck.side.size() != pre_sidec) {
soundManager.PlaySoundEffect(SOUND_INFO);
mainGame->env->addMessageBox(L"", dataManager.GetSysString(1410));
break;
}
......@@ -319,6 +323,7 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
if (mainGame->btnMark[7]->isPressed())
filter_marks |= 0004;
mainGame->HideElement(mainGame->wLinkMarks);
mainGame->btnMarksFilter->setPressed(filter_marks > 0);
InstantSearch();
break;
}
......@@ -514,6 +519,7 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
is_starting_dragging = false;
if(!is_draging)
break;
soundManager.PlaySoundEffect(SOUND_CARD_DROP);
bool pushed = false;
if(hovered_pos == 1)
pushed = push_main(draging_pointer, hovered_seq);
......@@ -543,6 +549,7 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
auto pointer = dataManager.GetCodePointer(hovered_code);
if(pointer == dataManager._datas.end())
break;
soundManager.PlaySoundEffect(SOUND_CARD_DROP);
if(hovered_pos == 1) {
if(push_side(pointer))
pop_main(hovered_seq);
......@@ -560,6 +567,7 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
if(!is_draging) {
if(hovered_pos == 0 || hovered_seq == -1)
break;
soundManager.PlaySoundEffect(SOUND_CARD_DROP);
if(hovered_pos == 1) {
pop_main(hovered_seq);
} else if(hovered_pos == 2) {
......@@ -576,6 +584,7 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
push_side(pointer);
}
} else {
soundManager.PlaySoundEffect(SOUND_CARD_PICK);
if(click_pos == 1) {
push_side(draging_pointer);
} else if(click_pos == 2) {
......@@ -602,6 +611,7 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
auto pointer = dataManager.GetCodePointer(hovered_code);
if(!check_limit(pointer))
break;
soundManager.PlaySoundEffect(SOUND_CARD_PICK);
if (hovered_pos == 1) {
if(!push_main(pointer))
push_side(pointer);
......@@ -620,6 +630,7 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
case irr::EMIE_MOUSE_MOVED: {
if(is_starting_dragging) {
is_draging = true;
soundManager.PlaySoundEffect(SOUND_CARD_PICK);
if(hovered_pos == 1)
pop_main(hovered_seq);
else if(hovered_pos == 2)
......@@ -635,6 +646,11 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
case irr::EMIE_MOUSE_WHEEL: {
if(!mainGame->scrFilter->isVisible())
break;
if(mainGame->env->hasFocus(mainGame->scrFilter))
break;
irr::gui::IGUIElement* root = mainGame->env->getRootGUIElement();
if(root->getElementFromPoint(mouse_pos) != root)
break;
if(event.MouseInput.Wheel < 0) {
if(mainGame->scrFilter->getPos() < mainGame->scrFilter->getMax())
mainGame->scrFilter->setPos(mainGame->scrFilter->getPos() + 1);
......@@ -904,6 +920,8 @@ void DeckBuilder::ClearFilter() {
filter_marks = 0;
for(int i = 0; i < 8; i++)
mainGame->btnMark[i]->setPressed(false);
mainGame->btnEffectFilter->setPressed(false);
mainGame->btnMarksFilter->setPressed(false);
}
void DeckBuilder::SortList() {
auto left = results.begin();
......
......@@ -11,8 +11,44 @@ DeckManager deckManager;
void DeckManager::LoadLFList() {
LFList* cur = NULL;
FILE* fp = fopen("lflist.conf", "r");
FILE* fp_custom = fopen("expansions/lflist.conf", "r");
char linebuf[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) {
while(fgets(linebuf, 256, fp)) {
if(linebuf[0] == '#')
......
......@@ -2,6 +2,7 @@
#include "materials.h"
#include "image_manager.h"
#include "deck_manager.h"
#include "sound_manager.h"
#include "duelclient.h"
#include "../ocgcore/field.h"
......@@ -11,7 +12,7 @@ void Game::DrawSelectionLine(irr::video::S3DVertex* vec, bool strip, int width,
if(!gameConf.use_d3d) {
float origin[4] = {1.0f, 1.0f, 1.0f, 1.0f};
glLineWidth(width);
glLineStipple(1, linePattern);
glLineStipple(1, linePatternGL);
if(strip)
glEnable(GL_LINE_STIPPLE);
glDisable(GL_TEXTURE_2D);
......@@ -28,16 +29,16 @@ void Game::DrawSelectionLine(irr::video::S3DVertex* vec, bool strip, int width,
} else {
driver->setMaterial(matManager.mOutLine);
if(strip) {
if(linePattern < 15) {
driver->draw3DLine(vec[0].Pos, vec[0].Pos + (vec[1].Pos - vec[0].Pos) * (linePattern + 1) / 15.0);
driver->draw3DLine(vec[1].Pos, vec[1].Pos + (vec[3].Pos - vec[1].Pos) * (linePattern + 1) / 15.0);
driver->draw3DLine(vec[3].Pos, vec[3].Pos + (vec[2].Pos - vec[3].Pos) * (linePattern + 1) / 15.0);
driver->draw3DLine(vec[2].Pos, vec[2].Pos + (vec[0].Pos - vec[2].Pos) * (linePattern + 1) / 15.0);
if(linePatternD3D < 15) {
driver->draw3DLine(vec[0].Pos, vec[0].Pos + (vec[1].Pos - vec[0].Pos) * (linePatternD3D + 1) / 15.0);
driver->draw3DLine(vec[1].Pos, vec[1].Pos + (vec[3].Pos - vec[1].Pos) * (linePatternD3D + 1) / 15.0);
driver->draw3DLine(vec[3].Pos, vec[3].Pos + (vec[2].Pos - vec[3].Pos) * (linePatternD3D + 1) / 15.0);
driver->draw3DLine(vec[2].Pos, vec[2].Pos + (vec[0].Pos - vec[2].Pos) * (linePatternD3D + 1) / 15.0);
} else {
driver->draw3DLine(vec[0].Pos + (vec[1].Pos - vec[0].Pos) * (linePattern - 14) / 15.0, vec[1].Pos);
driver->draw3DLine(vec[1].Pos + (vec[3].Pos - vec[1].Pos) * (linePattern - 14) / 15.0, vec[3].Pos);
driver->draw3DLine(vec[3].Pos + (vec[2].Pos - vec[3].Pos) * (linePattern - 14) / 15.0, vec[2].Pos);
driver->draw3DLine(vec[2].Pos + (vec[0].Pos - vec[2].Pos) * (linePattern - 14) / 15.0, vec[0].Pos);
driver->draw3DLine(vec[0].Pos + (vec[1].Pos - vec[0].Pos) * (linePatternD3D - 14) / 15.0, vec[1].Pos);
driver->draw3DLine(vec[1].Pos + (vec[3].Pos - vec[1].Pos) * (linePatternD3D - 14) / 15.0, vec[3].Pos);
driver->draw3DLine(vec[3].Pos + (vec[2].Pos - vec[3].Pos) * (linePatternD3D - 14) / 15.0, vec[2].Pos);
driver->draw3DLine(vec[2].Pos + (vec[0].Pos - vec[2].Pos) * (linePatternD3D - 14) / 15.0, vec[0].Pos);
}
} else {
driver->draw3DLine(vec[0].Pos, vec[1].Pos);
......@@ -47,6 +48,26 @@ 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();
float x1 = pos.UpperLeftCorner.X;
float x2 = pos.LowerRightCorner.X;
float y1 = pos.UpperLeftCorner.Y;
float y2 = pos.LowerRightCorner.Y;
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));
} 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));
}
}
void Game::DrawBackGround() {
static int selFieldAlpha = 255;
static int selFieldDAlpha = -10;
......@@ -450,6 +471,9 @@ void Game::DrawMisc() {
driver->drawVertexPrimitiveList(matManager.vChainNum, 4, matManager.iRectangle, 2);
}
}
//finish button
if(btnCancelOrFinish->isVisible() && dField.select_ready)
DrawSelectionLine(btnCancelOrFinish, 2, 0xffffff00);
//lp bar
if((dInfo.turn % 2 && dInfo.isFirst) || (!(dInfo.turn % 2) && !dInfo.isFirst)) {
driver->draw2DRectangle(0xa0000000, recti(327, 8, 630, 51));
......@@ -1008,6 +1032,7 @@ void Game::HideElement(irr::gui::IGUIElement * win, bool set_action) {
fadingList.push_back(fu);
}
void Game::PopupElement(irr::gui::IGUIElement * element, int hideframe) {
soundManager.PlayDialogSound(element);
element->getParent()->bringToFront(element);
if(!mainGame->is_building)
dField.panel = element;
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -47,10 +47,16 @@ struct Config {
int chkIgnoreDeckChanges;
int defaultOT;
int enable_bot_mode;
bool enable_sound;
bool enable_music;
double sound_volume;
double music_volume;
int music_mode;
};
struct DuelInfo {
bool isStarted;
bool isFinished;
bool isReplay;
bool isReplaySkiping;
bool isFirst;
......@@ -103,6 +109,7 @@ public:
#ifdef YGOPRO_SERVER_MODE
void MainServerLoop();
void LoadExpansionDB();
void LoadBetaDB();
void AddDebugMsg(char* msgbuf);
#else
void MainLoop();
......@@ -115,6 +122,7 @@ public:
void RefreshSingleplay();
void RefreshBot();
void DrawSelectionLine(irr::video::S3DVertex* vec, bool strip, int width, float* cv);
void DrawSelectionLine(irr::gui::IGUIElement* element, int width, irr::video::SColor color);
void DrawBackGround();
void DrawLinkedZones(ClientCard* pcard);
void CheckMutual(ClientCard* pcard, int mark);
......@@ -149,6 +157,7 @@ public:
void SetWindowsIcon();
void FlashWindow();
void SetCursor(ECURSOR_ICON icon);
Mutex gMutex;
Mutex gBuffer;
......@@ -170,7 +179,8 @@ public:
bool hideChat;
int chatTiming[8];
int chatType[8];
unsigned short linePattern;
unsigned short linePatternD3D;
unsigned short linePatternGL;
int waitFrame;
int signalFrame;
int actionParam;
......@@ -230,6 +240,9 @@ public:
irr::gui::IGUIStaticText* stSetName;
irr::gui::IGUIStaticText* stText;
irr::gui::IGUIScrollBar* scrCardText;
irr::gui::IGUIListBox* lstLog;
irr::gui::IGUIButton* btnClearLog;
irr::gui::IGUIButton* btnSaveLog;
irr::gui::IGUICheckBox* chkMAutoPos;
irr::gui::IGUICheckBox* chkSTAutoPos;
irr::gui::IGUICheckBox* chkRandomPos;
......@@ -239,9 +252,11 @@ public:
irr::gui::IGUICheckBox* chkHideHintButton;
irr::gui::IGUICheckBox* chkIgnoreDeckChanges;
irr::gui::IGUICheckBox* chkAutoSearch;
irr::gui::IGUIListBox* lstLog;
irr::gui::IGUIButton* btnClearLog;
irr::gui::IGUIButton* btnSaveLog;
irr::gui::IGUICheckBox* chkEnableSound;
irr::gui::IGUICheckBox* chkEnableMusic;
irr::gui::IGUIScrollBar* scrSoundVolume;
irr::gui::IGUIScrollBar* scrMusicVolume;
irr::gui::IGUICheckBox* chkMusicMode;
//main menu
irr::gui::IGUIWindow* wMainMenu;
irr::gui::IGUIButton* btnLanMode;
......@@ -613,6 +628,10 @@ extern HostInfo game_info;
#define BUTTON_LOAD_SINGLEPLAY 351
#define BUTTON_CANCEL_SINGLEPLAY 352
#define CHECKBOX_AUTO_SEARCH 360
#define CHECKBOX_ENABLE_SOUND 361
#define CHECKBOX_ENABLE_MUSIC 362
#define SCROLL_VOLUME 363
#define COMBOBOX_SORTTYPE 370
#define COMBOBOX_LIMIT 371
......
......@@ -6,6 +6,7 @@
#include "replay_mode.h"
#include "single_mode.h"
#include "image_manager.h"
#include "sound_manager.h"
#include "game.h"
namespace ygo {
......@@ -39,7 +40,21 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
break;
}
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);
break;
}
case irr::gui::EGET_ELEMENT_LEFT: {
if(event.GUIEvent.Caller->getType() == EGUIET_EDIT_BOX)
mainGame->SetCursor(ECI_NORMAL);
break;
}
case irr::gui::EGET_BUTTON_CLICKED: {
if(id < 110)
soundManager.PlaySoundEffect(SOUND_MENU);
else
soundManager.PlaySoundEffect(SOUND_BUTTON);
switch(id) {
case BUTTON_MODE_EXIT: {
mainGame->device->closeDevice();
......@@ -74,6 +89,7 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
int status = evutil_getaddrinfo(hostname, port, &hints, &answer);
if(status != 0) {
mainGame->gMutex.Lock();
soundManager.PlaySoundEffect(SOUND_INFO);
mainGame->env->addMessageBox(L"", dataManager.GetSysString(1412));
mainGame->gMutex.Unlock();
break;
......
......@@ -24,5 +24,5 @@ project "ygopro"
configuration "not vs*"
buildoptions { "-std=gnu++0x", "-fno-rtti" }
configuration "not windows"
includedirs { "/usr/include/lua", "/usr/include/lua5.2", "/usr/include/lua/5.2" }
includedirs { "/usr/include/lua", "/usr/include/lua5.3", "/usr/include/lua/5.3" }
links { "event_pthreads", "dl", "pthread" }
......@@ -78,6 +78,7 @@ int ReplayMode::ReplayThread(void* param) {
return 0;
}
mainGame->dInfo.isStarted = true;
mainGame->dInfo.isFinished = false;
mainGame->dInfo.isReplay = true;
mainGame->dInfo.isReplaySkiping = (skip_turn > 0);
char engineBuffer[0x1000];
......@@ -122,6 +123,7 @@ int ReplayMode::ReplayThread(void* param) {
if(step == 0) {
Pause(true, false);
mainGame->dInfo.isStarted = true;
mainGame->dInfo.isFinished = false;
mainGame->dInfo.isReplaySkiping = false;
mainGame->dField.RefreshAllCards();
mainGame->gMutex.Unlock();
......@@ -236,6 +238,7 @@ void ReplayMode::EndDuel() {
mainGame->actionSignal.Wait();
mainGame->gMutex.Lock();
mainGame->dInfo.isStarted = false;
mainGame->dInfo.isFinished = true;
mainGame->dInfo.isReplay = false;
mainGame->gMutex.Unlock();
mainGame->closeDoneSignal.Reset();
......@@ -253,6 +256,7 @@ void ReplayMode::EndDuel() {
void ReplayMode::Restart(bool refresh) {
end_duel(pduel);
mainGame->dInfo.isStarted = false;
mainGame->dInfo.isFinished = true;
mainGame->dField.Clear();
//mainGame->device->setEventReceiver(&mainGame->dField);
cur_replay.Rewind();
......@@ -265,6 +269,7 @@ void ReplayMode::Restart(bool refresh) {
if(refresh) {
mainGame->dField.RefreshAllCards();
mainGame->dInfo.isStarted = true;
mainGame->dInfo.isFinished = false;
//mainGame->dInfo.isReplay = true;
}
skip_turn = 0;
......@@ -378,6 +383,15 @@ bool ReplayMode::ReplayAnalyze(char* msg, unsigned int len) {
pbuf += count * 8;
return ReadReplayResponse();
}
case MSG_SELECT_UNSELECT_CARD: {
player = BufferIO::ReadInt8(pbuf);
pbuf += 4;
count = BufferIO::ReadInt8(pbuf);
pbuf += count * 8;
count = BufferIO::ReadInt8(pbuf);
pbuf += count * 8;
return ReadReplayResponse();
}
case MSG_SELECT_CHAIN: {
player = BufferIO::ReadInt8(pbuf);
count = BufferIO::ReadInt8(pbuf);
......@@ -833,6 +847,7 @@ bool ReplayMode::ReplayAnalyze(char* msg, unsigned int len) {
if(skip_step == 0) {
Pause(true, false);
mainGame->dInfo.isStarted = true;
mainGame->dInfo.isFinished = false;
mainGame->dInfo.isReplaySkiping = false;
mainGame->dField.RefreshAllCards();
mainGame->gMutex.Unlock();
......
......@@ -34,25 +34,14 @@ void SingleDuel::Chat(DuelPlayer* dp, void* pdata, int len) {
scc.player = dp->type;
unsigned short* msg = (unsigned short*)pdata;
int msglen = BufferIO::CopyWStr(msg, scc.msg, 256);
if(dp->type > 1) {
NetServer::SendBufferToPlayer(players[0], STOC_CHAT, &scc, 4 + msglen * 2);
NetServer::ReSendToPlayer(players[1]);
for(auto pit = observers.begin(); pit != observers.end(); ++pit)
if((*pit) != dp)
NetServer::ReSendToPlayer(*pit);
#ifdef YGOPRO_SERVER_MODE
if(cache_recorder)
NetServer::ReSendToPlayer(cache_recorder);
#endif
} else {
NetServer::SendBufferToPlayer(players[1 - dp->type], STOC_CHAT, &scc, 4 + msglen * 2);
for(auto pit = observers.begin(); pit != observers.end(); ++pit)
NetServer::ReSendToPlayer(*pit);
NetServer::SendBufferToPlayer(players[0], STOC_CHAT, &scc, 4 + msglen * 2);
NetServer::ReSendToPlayer(players[1]);
for(auto pit = observers.begin(); pit != observers.end(); ++pit)
NetServer::ReSendToPlayer(*pit);
#ifdef YGOPRO_SERVER_MODE
if(cache_recorder)
NetServer::ReSendToPlayer(cache_recorder);
if(cache_recorder)
NetServer::ReSendToPlayer(cache_recorder);
#endif
}
}
void SingleDuel::JoinGame(DuelPlayer* dp, void* pdata, bool is_creater) {
#ifdef YGOPRO_SERVER_MODE
......@@ -68,6 +57,7 @@ void SingleDuel::JoinGame(DuelPlayer* dp, void* pdata, bool is_creater) {
return;
}
CTOS_JoinGame* pkt = (CTOS_JoinGame*)pdata;
/* disabled version check
if(pkt->version != PRO_VERSION) {
STOC_ErrorMsg scem;
scem.msg = ERRMSG_VERERROR;
......@@ -76,6 +66,7 @@ void SingleDuel::JoinGame(DuelPlayer* dp, void* pdata, bool is_creater) {
NetServer::DisconnectPlayer(dp);
return;
}
*/
wchar_t jpass[20];
BufferIO::CopyWStr(pkt->pass, jpass, 20);
#ifdef YGOPRO_SERVER_MODE
......@@ -738,7 +729,11 @@ int SingleDuel::Analyze(char* msgbuffer, unsigned int len) {
#endif
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[1], STOC_GAME_MSG, offset, pbuf - offset);
for(auto oit = observers.begin(); oit != observers.end(); ++oit)
......@@ -855,6 +850,34 @@ int SingleDuel::Analyze(char* msgbuffer, unsigned int len) {
NetServer::SendBufferToPlayer(players[player], STOC_GAME_MSG, offset, pbuf - offset);
return 1;
}
case MSG_SELECT_UNSELECT_CARD: {
player = BufferIO::ReadInt8(pbuf);
pbuf += 4;
count = BufferIO::ReadInt8(pbuf);
int c/*, l, s, ss, code*/;
for (int i = 0; i < count; ++i) {
pbufw = pbuf;
/*code = */BufferIO::ReadInt32(pbuf);
c = BufferIO::ReadInt8(pbuf);
/*l = */BufferIO::ReadInt8(pbuf);
/*s = */BufferIO::ReadInt8(pbuf);
/*ss = */BufferIO::ReadInt8(pbuf);
if (c != player) BufferIO::WriteInt32(pbufw, 0);
}
count = BufferIO::ReadInt8(pbuf);
for (int i = 0; i < count; ++i) {
pbufw = pbuf;
/*code = */BufferIO::ReadInt32(pbuf);
c = BufferIO::ReadInt8(pbuf);
/*l = */BufferIO::ReadInt8(pbuf);
/*s = */BufferIO::ReadInt8(pbuf);
/*ss = */BufferIO::ReadInt8(pbuf);
if (c != player) BufferIO::WriteInt32(pbufw, 0);
}
WaitforResponse(player);
NetServer::SendBufferToPlayer(players[player], STOC_GAME_MSG, offset, pbuf - offset);
return 1;
}
case MSG_SELECT_CHAIN: {
player = BufferIO::ReadInt8(pbuf);
count = BufferIO::ReadInt8(pbuf);
......
......@@ -97,6 +97,7 @@ int SingleMode::SinglePlayThread(void* param) {
mainGame->dField.Clear();
mainGame->dInfo.isFirst = true;
mainGame->dInfo.isStarted = true;
mainGame->dInfo.isFinished = false;
mainGame->dInfo.isSingleMode = true;
mainGame->device->setEventReceiver(&mainGame->dField);
mainGame->gMutex.Unlock();
......@@ -150,6 +151,7 @@ int SingleMode::SinglePlayThread(void* param) {
if(!is_closing) {
mainGame->gMutex.Lock();
mainGame->dInfo.isStarted = false;
mainGame->dInfo.isFinished = true;
mainGame->dInfo.isSingleMode = false;
mainGame->gMutex.Unlock();
mainGame->closeDoneSignal.Reset();
......@@ -271,6 +273,19 @@ bool SingleMode::SinglePlayAnalyze(char* msg, unsigned int len) {
}
break;
}
case MSG_SELECT_UNSELECT_CARD: {
player = BufferIO::ReadInt8(pbuf);
pbuf += 4;
count = BufferIO::ReadInt8(pbuf);
pbuf += count * 8;
count = BufferIO::ReadInt8(pbuf);
pbuf += count * 8;
if(!DuelClient::ClientAnalyze(offset, pbuf - offset)) {
mainGame->singleSignal.Reset();
mainGame->singleSignal.Wait();
}
break;
}
case MSG_SELECT_CHAIN: {
player = BufferIO::ReadInt8(pbuf);
count = BufferIO::ReadInt8(pbuf);
......
#include "sound_manager.h"
#ifndef _WIN32
#include <dirent.h>
#endif
#ifdef IRRKLANG_STATIC
#include "../ikpmp3/ikpMP3.h"
#endif
namespace ygo {
SoundManager soundManager;
bool SoundManager::Init() {
#ifdef YGOPRO_USE_IRRKLANG
bgm_scene = -1;
RefreshBGMList();
engineSound = irrklang::createIrrKlangDevice();
engineMusic = irrklang::createIrrKlangDevice();
if(!engineSound || !engineMusic) {
return false;
} else {
#ifdef IRRKLANG_STATIC
irrklang::ikpMP3Init(engineMusic);
#endif
return true;
}
#endif // YGOPRO_USE_IRRKLANG
// TODO: Implement other sound engines
return false;
}
void SoundManager::RefreshBGMList() {
RefershBGMDir(L"", BGM_DUEL);
RefershBGMDir(L"duel/", BGM_DUEL);
RefershBGMDir(L"menu/", BGM_MENU);
RefershBGMDir(L"deck/", BGM_DECK);
RefershBGMDir(L"advantage/", BGM_ADVANTAGE);
RefershBGMDir(L"disadvantage/", BGM_DISADVANTAGE);
RefershBGMDir(L"win/", BGM_WIN);
RefershBGMDir(L"lose/", BGM_LOSE);
}
void SoundManager::RefershBGMDir(std::wstring path, int scene) {
#ifdef _WIN32
WIN32_FIND_DATAW fdataw;
std::wstring search = L"./sound/BGM/" + 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".mp3") == 0 || _wcsicmp(fdataw.cFileName + len - 4, L".ogg") == 0))
continue;
std::wstring filename = path + (std::wstring)fdataw.cFileName;
BGMList[BGM_ALL].push_back(filename);
BGMList[scene].push_back(filename);
} while(FindNextFileW(fh, &fdataw));
FindClose(fh);
#else
DIR * dir;
struct dirent * dirp;
std::wstring wsearchpath = L"./sound/BGM/" + 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, ".mp3") == 0 || strcasecmp(dirp->d_name + len - 4, ".ogg")))
continue;
wchar_t wname[256];
BufferIO::DecodeUTF8(dirp->d_name, wname);
std::wstring filename = path + (std::wstring)wname;
BGMList[BGM_ALL].push_back(filename);
BGMList[scene].push_back(filename);
}
closedir(dir);
#endif
}
void SoundManager::PlaySoundEffect(int sound) {
#ifdef YGOPRO_USE_IRRKLANG
if(!mainGame->chkEnableSound->isChecked())
return;
switch(sound) {
case SOUND_SUMMON: {
engineSound->play2D("./sound/summon.wav");
break;
}
case SOUND_SPECIAL_SUMMON: {
engineSound->play2D("./sound/specialsummon.wav");
break;
}
case SOUND_ACTIVATE: {
engineSound->play2D("./sound/activate.wav");
break;
}
case SOUND_SET: {
engineSound->play2D("./sound/set.wav");
break;
}
case SOUND_FILP: {
engineSound->play2D("./sound/flip.wav");
break;
}
case SOUND_REVEAL: {
engineSound->play2D("./sound/reveal.wav");
break;
}
case SOUND_EQUIP: {
engineSound->play2D("./sound/equip.wav");
break;
}
case SOUND_DESTROYED: {
engineSound->play2D("./sound/destroyed.wav");
break;
}
case SOUND_BANISHED: {
engineSound->play2D("./sound/banished.wav");
break;
}
case SOUND_TOKEN: {
engineSound->play2D("./sound/token.wav");
break;
}
case SOUND_ATTACK: {
engineSound->play2D("./sound/attack.wav");
break;
}
case SOUND_DIRECT_ATTACK: {
engineSound->play2D("./sound/directattack.wav");
break;
}
case SOUND_DRAW: {
engineSound->play2D("./sound/draw.wav");
break;
}
case SOUND_SHUFFLE: {
engineSound->play2D("./sound/shuffle.wav");
break;
}
case SOUND_DAMAGE: {
engineSound->play2D("./sound/damage.wav");
break;
}
case SOUND_RECOVER: {
engineSound->play2D("./sound/gainlp.wav");
break;
}
case SOUND_COUNTER_ADD: {
engineSound->play2D("./sound/addcounter.wav");
break;
}
case SOUND_COUNTER_REMOVE: {
engineSound->play2D("./sound/removecounter.wav");
break;
}
case SOUND_COIN: {
engineSound->play2D("./sound/coinflip.wav");
break;
}
case SOUND_DICE: {
engineSound->play2D("./sound/diceroll.wav");
break;
}
case SOUND_NEXT_TURN: {
engineSound->play2D("./sound/nextturn.wav");
break;
}
case SOUND_PHASE: {
engineSound->play2D("./sound/phase.wav");
break;
}
case SOUND_MENU: {
engineSound->play2D("./sound/menu.wav");
break;
}
case SOUND_BUTTON: {
engineSound->play2D("./sound/button.wav");
break;
}
case SOUND_INFO: {
engineSound->play2D("./sound/info.wav");
break;
}
case SOUND_QUESTION: {
engineSound->play2D("./sound/question.wav");
break;
}
case SOUND_CARD_PICK: {
engineSound->play2D("./sound/cardpick.wav");
break;
}
case SOUND_CARD_DROP: {
engineSound->play2D("./sound/carddrop.wav");
break;
}
case SOUND_PLAYER_ENTER: {
engineSound->play2D("./sound/playerenter.wav");
break;
}
case SOUND_CHAT: {
engineSound->play2D("./sound/chatmessage.wav");
break;
}
default:
break;
}
engineSound->setSoundVolume(mainGame->gameConf.sound_volume);
#endif
}
void SoundManager::PlayDialogSound(irr::gui::IGUIElement * element) {
if(element == mainGame->wMessage) {
PlaySoundEffect(SOUND_INFO);
} else if(element == mainGame->wQuery) {
PlaySoundEffect(SOUND_QUESTION);
} else if(element == mainGame->wOptions) {
PlaySoundEffect(SOUND_QUESTION);
} else if(element == mainGame->wANAttribute) {
PlaySoundEffect(SOUND_QUESTION);
} else if(element == mainGame->wANCard) {
PlaySoundEffect(SOUND_QUESTION);
} else if(element == mainGame->wANNumber) {
PlaySoundEffect(SOUND_QUESTION);
} else if(element == mainGame->wANRace) {
PlaySoundEffect(SOUND_QUESTION);
} else if(element == mainGame->wReplaySave) {
PlaySoundEffect(SOUND_QUESTION);
}
}
void SoundManager::PlayMusic(char* song, bool loop) {
#ifdef YGOPRO_USE_IRRKLANG
if(!mainGame->chkEnableMusic->isChecked())
return;
if(!engineMusic->isCurrentlyPlaying(song)) {
engineMusic->stopAllSounds();
soundBGM = engineMusic->play2D(song, loop, false, true);
engineMusic->setSoundVolume(mainGame->gameConf.music_volume);
}
#endif
}
void SoundManager::PlayBGM(int scene) {
#ifdef YGOPRO_USE_IRRKLANG
if(!mainGame->chkEnableMusic->isChecked())
return;
if(!mainGame->chkMusicMode->isChecked())
scene = BGM_ALL;
char BGMName[1024];
if(scene != bgm_scene || (soundBGM && soundBGM->isFinished())) {
int count = BGMList[scene].size();
if(count <= 0)
return;
bgm_scene = scene;
int bgm = rand() % count;
auto name = BGMList[scene][bgm].c_str();
wchar_t fname[1024];
myswprintf(fname, L"./sound/BGM/%ls", name);
BufferIO::EncodeUTF8(fname, BGMName);
PlayMusic(BGMName, false);
}
#endif
}
void SoundManager::StopBGM() {
#ifdef YGOPRO_USE_IRRKLANG
engineMusic->stopAllSounds();
#endif
}
void SoundManager::SetSoundVolume(double volume) {
#ifdef YGOPRO_USE_IRRKLANG
engineSound->setSoundVolume(volume);
#endif
}
void SoundManager::SetMusicVolume(double volume) {
#ifdef YGOPRO_USE_IRRKLANG
engineMusic->setSoundVolume(volume);
#endif
}
}
#ifndef SOUNDMANAGER_H
#define SOUNDMANAGER_H
#include "game.h"
#ifdef YGOPRO_USE_IRRKLANG
#include <irrKlang.h>
#endif
namespace ygo {
class SoundManager {
private:
std::vector<std::wstring> BGMList[8];
int bgm_scene;
#ifdef YGOPRO_USE_IRRKLANG
irrklang::ISoundEngine* engineSound;
irrklang::ISoundEngine* engineMusic;
irrklang::ISound* soundBGM;
#endif
void RefershBGMDir(std::wstring path, int scene);
public:
bool Init();
void RefreshBGMList();
void PlaySoundEffect(int sound);
void PlayDialogSound(irr::gui::IGUIElement * element);
void PlayMusic(char* song, bool loop);
void PlayBGM(int scene);
void StopBGM();
void SetSoundVolume(double volume);
void SetMusicVolume(double volume);
};
extern SoundManager soundManager;
#define SOUND_SUMMON 101
#define SOUND_SPECIAL_SUMMON 102
#define SOUND_ACTIVATE 103
#define SOUND_SET 104
#define SOUND_FILP 105
#define SOUND_REVEAL 106
#define SOUND_EQUIP 107
#define SOUND_DESTROYED 108
#define SOUND_BANISHED 109
#define SOUND_TOKEN 110
#define SOUND_ATTACK 201
#define SOUND_DIRECT_ATTACK 202
#define SOUND_DRAW 203
#define SOUND_SHUFFLE 204
#define SOUND_DAMAGE 205
#define SOUND_RECOVER 206
#define SOUND_COUNTER_ADD 207
#define SOUND_COUNTER_REMOVE 208
#define SOUND_COIN 209
#define SOUND_DICE 210
#define SOUND_NEXT_TURN 211
#define SOUND_PHASE 212
#define SOUND_MENU 301
#define SOUND_BUTTON 302
#define SOUND_INFO 303
#define SOUND_QUESTION 304
#define SOUND_CARD_PICK 305
#define SOUND_CARD_DROP 306
#define SOUND_PLAYER_ENTER 307
#define SOUND_CHAT 308
#define BGM_ALL 0
#define BGM_DUEL 1
#define BGM_MENU 2
#define BGM_DECK 3
#define BGM_ADVANTAGE 4
#define BGM_DISADVANTAGE 5
#define BGM_WIN 6
#define BGM_LOSE 7
}
#endif //SOUNDMANAGER_H
......@@ -31,8 +31,9 @@ void TagDuel::Chat(DuelPlayer* dp, void* pdata, int len) {
unsigned short* msg = (unsigned short*)pdata;
int msglen = BufferIO::CopyWStr(msg, scc.msg, 256);
for(int i = 0; i < 4; ++i)
if(players[i] != dp)
NetServer::SendBufferToPlayer(players[i], STOC_CHAT, &scc, 4 + msglen * 2);
NetServer::SendBufferToPlayer(players[i], STOC_CHAT, &scc, 4 + msglen * 2);
for(auto pit = observers.begin(); pit != observers.end(); ++pit)
NetServer::ReSendToPlayer(*pit);
#ifdef YGOPRO_SERVER_MODE
if(cache_recorder)
NetServer::ReSendToPlayer(cache_recorder);
......@@ -52,6 +53,7 @@ void TagDuel::JoinGame(DuelPlayer* dp, void* pdata, bool is_creater) {
return;
}
CTOS_JoinGame* pkt = (CTOS_JoinGame*)pdata;
/* disabled version check
if(pkt->version != PRO_VERSION) {
STOC_ErrorMsg scem;
scem.msg = ERRMSG_VERERROR;
......@@ -60,6 +62,7 @@ void TagDuel::JoinGame(DuelPlayer* dp, void* pdata, bool is_creater) {
NetServer::DisconnectPlayer(dp);
return;
}
*/
wchar_t jpass[20];
BufferIO::CopyWStr(pkt->pass, jpass, 20);
#ifdef YGOPRO_SERVER_MODE
......@@ -666,6 +669,19 @@ int TagDuel::Analyze(char* msgbuffer, unsigned int len) {
NetServer::ReSendToPlayer(*oit);
#ifdef YGOPRO_SERVER_MODE
NetServer::ReSendToPlayers(cache_recorder, replay_recorder);
#endif
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);
#ifdef YGOPRO_SERVER_MODE
NetServer::ReSendToPlayers(cache_recorder, replay_recorder);
#endif
break;
}
......@@ -768,6 +784,34 @@ int TagDuel::Analyze(char* msgbuffer, unsigned int len) {
NetServer::SendBufferToPlayer(cur_player[player], STOC_GAME_MSG, offset, pbuf - offset);
return 1;
}
case MSG_SELECT_UNSELECT_CARD: {
player = BufferIO::ReadInt8(pbuf);
pbuf += 4;
count = BufferIO::ReadInt8(pbuf);
int c/*, l, s, ss, code*/;
for (int i = 0; i < count; ++i) {
pbufw = pbuf;
/*code = */BufferIO::ReadInt32(pbuf);
c = BufferIO::ReadInt8(pbuf);
/*l = */BufferIO::ReadInt8(pbuf);
/*s = */BufferIO::ReadInt8(pbuf);
/*ss = */BufferIO::ReadInt8(pbuf);
if (c != player) BufferIO::WriteInt32(pbufw, 0);
}
count = BufferIO::ReadInt8(pbuf);
for (int i = 0; i < count; ++i) {
pbufw = pbuf;
/*code = */BufferIO::ReadInt32(pbuf);
c = BufferIO::ReadInt8(pbuf);
/*l = */BufferIO::ReadInt8(pbuf);
/*s = */BufferIO::ReadInt8(pbuf);
/*ss = */BufferIO::ReadInt8(pbuf);
if (c != player) BufferIO::WriteInt32(pbufw, 0);
}
WaitforResponse(player);
NetServer::SendBufferToPlayer(cur_player[player], STOC_GAME_MSG, offset, pbuf - offset);
return 1;
}
case MSG_SELECT_CHAIN: {
player = BufferIO::ReadInt8(pbuf);
count = BufferIO::ReadInt8(pbuf);
......@@ -993,7 +1037,7 @@ int TagDuel::Analyze(char* msgbuffer, unsigned int len) {
break;
}
case MSG_NEW_TURN: {
pbuf++;
int r_player = BufferIO::ReadInt8(pbuf);
time_limit[0] = host_info.time_limit;
time_limit[1] = host_info.time_limit;
NetServer::SendBufferToPlayer(players[0], STOC_GAME_MSG, offset, pbuf - offset);
......@@ -1005,20 +1049,22 @@ int TagDuel::Analyze(char* msgbuffer, unsigned int len) {
#ifdef YGOPRO_SERVER_MODE
NetServer::ReSendToPlayers(cache_recorder, replay_recorder);
#endif
if(turn_count > 0) {
if(turn_count % 2 == 0) {
if(cur_player[0] == players[0])
cur_player[0] = players[1];
else
cur_player[0] = players[0];
} else {
if(cur_player[1] == players[2])
cur_player[1] = players[3];
else
cur_player[1] = players[2];
if(!(r_player & 0x2)) {
if(turn_count > 0) {
if(turn_count % 2 == 0) {
if(cur_player[0] == players[0])
cur_player[0] = players[1];
else
cur_player[0] = players[0];
} else {
if(cur_player[1] == players[2])
cur_player[1] = players[3];
else
cur_player[1] = players[2];
}
}
turn_count++;
}
turn_count++;
break;
}
case MSG_NEW_PHASE: {
......
This diff is collapsed.
Subproject commit 35463ba465a0926f22f13340bb9d0fd5e5443e85
Subproject commit 6186590d0d584a0dea519570a8ce3f80bd1bd03e
project "freetype"
kind "StaticLib"
includedirs { "include" }
defines { "FT2_BUILD_LIBRARY" }
files { "src/autofit/autofit.c", "src/bdf/bdf.c", "src/cff/cff.c", "src/base/ftbase.c",
"src/base/ftbitmap.c", "src/cache/ftcache.c", "src/base/ftfstype.c", "src/base/ftgasp.c",
"src/base/ftglyph.c", "src/gzip/ftgzip.c", "src/base/ftinit.c", "src/lzw/ftlzw.c",
"src/base/ftstroke.c", "src/base/ftsystem.c", "src/smooth/smooth.c", "src/base/ftbbox.c",
"src/base/ftfntfmt.c", "src/base/ftmm.c", "src/base/ftpfr.c", "src/base/ftsynth.c",
"src/base/fttype1.c", "src/base/ftwinfnt.c", "src/base/ftlcdfil.c", "src/base/ftgxval.c",
"src/base/ftotval.c", "src/base/ftpatent.c", "src/pcf/pcf.c", "src/pfr/pfr.c",
"src/psaux/psaux.c", "src/pshinter/pshinter.c", "src/psnames/psmodule.c",
"src/raster/raster.c", "src/sfnt/sfnt.c", "src/truetype/truetype.c",
"src/type1/type1.c", "src/cid/type1cid.c", "src/type42/type42.c", "src/winfonts/winfnt.c" }
configuration "windows"
files { "builds/windows/ftdebug.c" }
This diff is collapsed.
This diff is collapsed.
......@@ -4,6 +4,7 @@ solution "ygo"
objdir "obj"
configurations { "Debug", "Release" }
defines { "LUA_COMPAT_5_2" }
configuration "windows"
defines { "WIN32", "_WIN32" }
......@@ -15,8 +16,10 @@ solution "ygo"
configuration "macosx"
defines { "LUA_USE_MACOSX" }
includedirs { "/opt/local/include" }
libdirs { "/opt/local/lib" }
includedirs { "/usr/local/include/*" }
libdirs { "/usr/local/lib", "/usr/X11/lib" }
buildoptions { "-stdlib=libc++" }
links {"OpenGL.framework","Cocoa.framework","IOKit.framework"}
configuration "linux"
defines { "LUA_USE_LINUX" }
......@@ -45,7 +48,7 @@ solution "ygo"
defines { "_ITERATOR_DEBUG_LEVEL=0" }
configuration "Release"
flags { "OptimizeSpeed" }
--flags { "OptimizeSpeed" }
targetdir "bin/release"
include "ocgcore"
......
......@@ -2,16 +2,31 @@ solution "ygo"
location "build"
language "C++"
objdir "obj"
startproject "ygopro"
configurations { "Release", "Debug" }
configurations { "Debug", "Release" }
defines { "LUA_COMPAT_5_2" }
configuration "windows"
defines { "WIN32", "_WIN32" }
configuration "bsd"
defines { "LUA_USE_POSIX" }
includedirs { "/usr/local/include" }
libdirs { "/usr/local/lib" }
configuration "macosx"
defines { "LUA_USE_MACOSX" }
includedirs { "/usr/local/include/*" }
libdirs { "/usr/local/lib", "/usr/X11/lib" }
buildoptions { "-stdlib=libc++" }
links {"OpenGL.framework","Cocoa.framework","IOKit.framework"}
configuration "linux"
defines { "LUA_USE_LINUX" }
configuration "Release"
flags { "OptimizeSpeed" }
targetdir "bin/release"
configuration "Debug"
......@@ -20,7 +35,6 @@ solution "ygo"
targetdir "bin/debug"
configuration { "Release", "vs*" }
optimize "Speed"
flags { "StaticRuntime", "LinkTimeOptimization" }
disablewarnings { "4244", "4267", "4838", "4577", "4819", "4018", "4996", "4477" }
......@@ -46,7 +60,7 @@ solution "ygo"
include "ocgcore"
include "gframe"
if os.is("windows") then
if os.ishost("windows") then
include "event"
include "lua"
include "sqlite3"
......
Subproject commit 47a1517ad08adc9ef37933cc2388b57d38ab277f
Subproject commit 693f76439f29d56d9052fb47fff679dbb76459ea
......@@ -302,6 +302,9 @@
!system 1276 自动排列连锁顺序
!system 1277 没有可连锁的卡时延迟回应
!system 1278 自动选择魔陷卡片位置
!system 1279 开启音效
!system 1280 开启音乐
!system 1281 按场景切换音乐
!system 1290 忽略对方发言
!system 1291 忽略观战者发言
!system 1292 忽略时点
......
......@@ -2,18 +2,19 @@
#nickname & gamename should be less than 20 characters
use_d3d = 0
use_image_scale = 1
pro_version = 4930
antialias = 2
errorlog = 1
nickname = Player
errorlog = 3
nickname = Komeiji Koishi
gamename = Game
lastdeck = new
textfont = c:/windows/fonts/simsun.ttc 14
numfont = c:/windows/fonts/arialbd.ttf
textfont = c:/windows/fonts/simhei.ttf 14
numfont = c:/windows/fonts/arial.ttf
serverport = 7911
lasthost = 127.0.0.1
lastport = 7911
automonsterpos = 0
autospellpos = 1
autospellpos = 0
randompos = 0
autochain = 0
waitchain = 0
......@@ -26,7 +27,17 @@ control_mode = 0
draw_field_spell = 1
separate_clear_button = 1
#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
default_ot = 1
enable_bot_mode = 0
enable_bot_mode = 1
enable_sound = 1
enable_music = 1
#Volume of sound and music, between 0 and 100
sound_volume = 100
music_volume = 100
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

343 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

343 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

343 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

12 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

12 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