Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Y
ygopro
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
MyCard
ygopro
Commits
8f9e5424
Commit
8f9e5424
authored
May 26, 2020
by
mercury233
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
https://github.com/Fluorohydride/ygopro
parents
eb02897e
3aeb7721
Changes
13
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
203 additions
and
113 deletions
+203
-113
gframe/CMakeLists.txt
gframe/CMakeLists.txt
+1
-2
gframe/drawing.cpp
gframe/drawing.cpp
+9
-2
gframe/duelclient.cpp
gframe/duelclient.cpp
+10
-31
gframe/event_handler.cpp
gframe/event_handler.cpp
+7
-9
gframe/game.cpp
gframe/game.cpp
+25
-10
gframe/game.h
gframe/game.h
+5
-0
gframe/image_manager.cpp
gframe/image_manager.cpp
+86
-16
gframe/image_manager.h
gframe/image_manager.h
+7
-0
gframe/replay_mode.cpp
gframe/replay_mode.cpp
+1
-2
ocgcore
ocgcore
+1
-1
script
script
+1
-1
strings.conf
strings.conf
+1
-0
system.conf
system.conf
+49
-39
No files found.
gframe/CMakeLists.txt
View file @
8f9e5424
...
...
@@ -28,7 +28,7 @@ endif ()
target_link_libraries
(
ygopro ocgcore clzma
)
if
(
MSVC
)
target_link_libraries
(
ygopro irrlicht freetype sqlite3 event
lua
)
target_link_libraries
(
ygopro irrlicht freetype sqlite3 event
)
include_directories
(
"../irrlicht/include"
"../freetype/include"
"../event/include"
"../sqlite3"
)
else
()
target_link_libraries
(
ygopro
...
...
@@ -36,7 +36,6 @@ else ()
${
FREETYPE_LIBRARIES
}
${
SQLITE_LIBRARIES
}
${
LIBEVENT_LIBRARIES
}
${
LUA_LIBRARIES
}
${
OPENGL_gl_LIBRARY
}
)
include_directories
(
...
...
gframe/drawing.cpp
View file @
8f9e5424
...
...
@@ -457,7 +457,7 @@ void Game::DrawMisc() {
driver
->
setTransform
(
irr
::
video
::
ETS_WORLD
,
im
);
driver
->
drawVertexPrimitiveList
(
matManager
.
vActivate
,
4
,
matManager
.
iRectangle
,
2
);
}
if
(
dField
.
chains
.
size
()
>
1
)
{
if
(
dField
.
chains
.
size
()
>
1
||
mainGame
->
gameConf
.
draw_single_chain
)
{
for
(
size_t
i
=
0
;
i
<
dField
.
chains
.
size
();
++
i
)
{
if
(
dField
.
chains
[
i
].
solved
)
break
;
...
...
@@ -992,6 +992,8 @@ void Game::ShowElement(irr::gui::IGUIElement * win, int autoframe) {
fadingList
.
push_back
(
fu
);
}
void
Game
::
HideElement
(
irr
::
gui
::
IGUIElement
*
win
,
bool
set_action
)
{
if
(
!
win
->
isVisible
()
&&
!
set_action
)
return
;
FadingUnit
fu
;
fu
.
fadingSize
=
win
->
getRelativePosition
();
for
(
auto
fit
=
fadingList
.
begin
();
fit
!=
fadingList
.
end
();
++
fit
)
...
...
@@ -1155,8 +1157,13 @@ void Game::DrawDeckBd() {
DrawShadowText
(
numFont
,
deckBuilder
.
result_string
,
Resize
(
875
,
137
,
935
,
157
),
Resize
(
1
,
1
,
1
,
1
),
0xffffffff
,
0xff000000
,
false
,
true
);
driver
->
draw2DRectangle
(
Resize
(
805
,
160
,
1020
,
630
),
0x400000ff
,
0x400000ff
,
0x40000000
,
0x40000000
);
driver
->
draw2DRectangleOutline
(
Resize
(
804
,
159
,
1020
,
630
));
for
(
size_t
i
=
0
;
i
<
7
&&
i
+
scrFilter
->
getPos
()
<
deckBuilder
.
results
.
size
();
++
i
)
{
for
(
size_t
i
=
0
;
i
<
9
&&
i
+
scrFilter
->
getPos
()
<
deckBuilder
.
results
.
size
();
++
i
)
{
code_pointer
ptr
=
deckBuilder
.
results
[
i
+
scrFilter
->
getPos
()];
if
(
i
>=
7
)
{
imageManager
.
GetTextureThumb
(
ptr
->
second
.
code
);
break
;
}
if
(
deckBuilder
.
hovered_pos
==
4
&&
deckBuilder
.
hovered_seq
==
(
int
)
i
)
driver
->
draw2DRectangle
(
0x80000000
,
Resize
(
806
,
164
+
i
*
66
,
1019
,
230
+
i
*
66
));
DrawThumb
(
ptr
,
position2di
(
810
,
165
+
i
*
66
),
deckBuilder
.
filterList
);
...
...
gframe/duelclient.cpp
View file @
8f9e5424
...
...
@@ -369,24 +369,17 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) {
mainGame
->
dField
.
Clear
();
mainGame
->
is_building
=
true
;
mainGame
->
is_siding
=
true
;
mainGame
->
CloseGameWindow
();
mainGame
->
wChat
->
setVisible
(
false
);
mainGame
->
wPhase
->
setVisible
(
false
);
mainGame
->
wDeckEdit
->
setVisible
(
false
);
mainGame
->
wFilter
->
setVisible
(
false
);
mainGame
->
wSort
->
setVisible
(
false
);
mainGame
->
stTip
->
setVisible
(
false
);
if
(
mainGame
->
dInfo
.
player_type
<
7
)
mainGame
->
btnLeaveGame
->
setVisible
(
false
);
mainGame
->
btnSideOK
->
setVisible
(
true
);
mainGame
->
btnSideShuffle
->
setVisible
(
true
);
mainGame
->
btnSideSort
->
setVisible
(
true
);
mainGame
->
btnSideReload
->
setVisible
(
true
);
if
(
mainGame
->
dInfo
.
player_type
<
7
)
mainGame
->
btnLeaveGame
->
setVisible
(
false
);
mainGame
->
btnSpectatorSwap
->
setVisible
(
false
);
mainGame
->
btnChainIgnore
->
setVisible
(
false
);
mainGame
->
btnChainAlways
->
setVisible
(
false
);
mainGame
->
btnChainWhenAvail
->
setVisible
(
false
);
mainGame
->
btnCancelOrFinish
->
setVisible
(
false
);
mainGame
->
btnShuffle
->
setVisible
(
false
);
mainGame
->
deckBuilder
.
result_string
[
0
]
=
L'0'
;
mainGame
->
deckBuilder
.
result_string
[
1
]
=
0
;
mainGame
->
deckBuilder
.
results
.
clear
();
...
...
@@ -486,12 +479,9 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) {
mainGame
->
SetStaticText
(
mainGame
->
stHostPrepRule
,
180
,
mainGame
->
guiFont
,
str
.
c_str
());
mainGame
->
RefreshDeck
(
mainGame
->
cbDeckSelect
);
mainGame
->
cbDeckSelect
->
setEnabled
(
true
);
if
(
mainGame
->
wCreateHost
->
isVisible
())
mainGame
->
HideElement
(
mainGame
->
wCreateHost
);
else
if
(
mainGame
->
wLanWindow
->
isVisible
())
mainGame
->
HideElement
(
mainGame
->
wLanWindow
);
else
if
(
mainGame
->
wSinglePlay
->
isVisible
())
mainGame
->
HideElement
(
mainGame
->
wSinglePlay
);
mainGame
->
HideElement
(
mainGame
->
wCreateHost
);
mainGame
->
HideElement
(
mainGame
->
wLanWindow
);
mainGame
->
HideElement
(
mainGame
->
wSinglePlay
);
mainGame
->
ShowElement
(
mainGame
->
wHostPrepare
);
if
(
!
mainGame
->
chkIgnore1
->
isChecked
())
mainGame
->
wChat
->
setVisible
(
true
);
...
...
@@ -649,12 +639,7 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) {
mainGame
->
gMutex
.
lock
();
if
(
mainGame
->
dInfo
.
player_type
<
7
)
mainGame
->
btnLeaveGame
->
setVisible
(
false
);
mainGame
->
btnSpectatorSwap
->
setVisible
(
false
);
mainGame
->
btnChainIgnore
->
setVisible
(
false
);
mainGame
->
btnChainAlways
->
setVisible
(
false
);
mainGame
->
btnChainWhenAvail
->
setVisible
(
false
);
mainGame
->
btnCancelOrFinish
->
setVisible
(
false
);
mainGame
->
wSurrender
->
setVisible
(
false
);
mainGame
->
CloseGameButtons
();
mainGame
->
stMessage
->
setText
(
dataManager
.
GetSysString
(
1500
));
mainGame
->
PopupElement
(
mainGame
->
wMessage
);
mainGame
->
gMutex
.
unlock
();
...
...
@@ -688,14 +673,9 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) {
case
STOC_REPLAY
:
{
mainGame
->
gMutex
.
lock
();
mainGame
->
wPhase
->
setVisible
(
false
);
mainGame
->
wSurrender
->
setVisible
(
false
);
if
(
mainGame
->
dInfo
.
player_type
<
7
)
mainGame
->
btnLeaveGame
->
setVisible
(
false
);
mainGame
->
btnChainIgnore
->
setVisible
(
false
);
mainGame
->
btnChainAlways
->
setVisible
(
false
);
mainGame
->
btnChainWhenAvail
->
setVisible
(
false
);
mainGame
->
btnCancelOrFinish
->
setVisible
(
false
);
mainGame
->
btnShuffle
->
setVisible
(
false
);
mainGame
->
CloseGameButtons
();
char
*
prep
=
pdata
;
Replay
new_replay
;
memcpy
(
&
new_replay
.
pheader
,
prep
,
sizeof
(
ReplayHeader
));
...
...
@@ -2390,8 +2370,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
mainGame
->
btnLeaveGame
->
setText
(
dataManager
.
GetSysString
(
1351
));
mainGame
->
btnLeaveGame
->
setVisible
(
true
);
}
if
(
mainGame
->
wSurrender
->
isVisible
())
mainGame
->
HideElement
(
mainGame
->
wSurrender
);
mainGame
->
HideElement
(
mainGame
->
wSurrender
);
if
(
!
mainGame
->
dInfo
.
isReplay
&&
mainGame
->
dInfo
.
player_type
<
7
)
{
if
(
mainGame
->
gameConf
.
control_mode
==
0
)
{
mainGame
->
btnChainIgnore
->
setVisible
(
true
);
...
...
@@ -2906,7 +2885,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
int
ct
=
BufferIO
::
ReadInt8
(
pbuf
);
if
(
mainGame
->
dInfo
.
isReplay
&&
mainGame
->
dInfo
.
isReplaySkiping
)
return
true
;
if
(
mainGame
->
dField
.
chains
.
size
()
>
1
)
{
if
(
mainGame
->
dField
.
chains
.
size
()
>
1
||
mainGame
->
gameConf
.
draw_single_chain
)
{
if
(
mainGame
->
dField
.
last_chain
)
mainGame
->
WaitFrameSignal
(
11
);
for
(
int
i
=
0
;
i
<
5
;
++
i
)
{
...
...
gframe/event_handler.cpp
View file @
8f9e5424
...
...
@@ -129,13 +129,7 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
mainGame
->
dInfo
.
isStarted
=
false
;
mainGame
->
dInfo
.
isFinished
=
false
;
mainGame
->
device
->
setEventReceiver
(
&
mainGame
->
menuHandler
);
mainGame
->
stTip
->
setVisible
(
false
);
mainGame
->
wCardImg
->
setVisible
(
false
);
mainGame
->
wInfos
->
setVisible
(
false
);
mainGame
->
wPhase
->
setVisible
(
false
);
mainGame
->
btnLeaveGame
->
setVisible
(
false
);
mainGame
->
btnSpectatorSwap
->
setVisible
(
false
);
mainGame
->
wChat
->
setVisible
(
false
);
mainGame
->
CloseDuelWindow
();
mainGame
->
btnCreateHost
->
setEnabled
(
true
);
mainGame
->
btnJoinHost
->
setEnabled
(
true
);
mainGame
->
btnJoinCancel
->
setEnabled
(
true
);
...
...
@@ -1459,8 +1453,7 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
mainGame
->
chain_when_avail
=
false
;
UpdateChainButtons
();
}
if
(
mainGame
->
wSurrender
->
isVisible
())
mainGame
->
HideElement
(
mainGame
->
wSurrender
);
mainGame
->
HideElement
(
mainGame
->
wSurrender
);
mainGame
->
wCmdMenu
->
setVisible
(
false
);
if
(
mainGame
->
fadingList
.
size
())
break
;
...
...
@@ -1877,6 +1870,11 @@ bool ClientField::OnCommonEvent(const irr::SEvent& event) {
return
true
;
break
;
}
case
CHECKBOX_DRAW_SINGLE_CHAIN
:
{
mainGame
->
gameConf
.
draw_single_chain
=
mainGame
->
chkDrawSingleChain
->
isChecked
()
?
1
:
0
;
return
true
;
break
;
}
case
CHECKBOX_PREFER_EXPANSION
:
{
mainGame
->
gameConf
.
prefer_expansion_script
=
mainGame
->
chkPreferExpansionScript
->
isChecked
()
?
1
:
0
;
return
true
;
...
...
gframe/game.cpp
View file @
8f9e5424
...
...
@@ -286,6 +286,9 @@ bool Game::Initialize() {
chkQuickAnimation
=
env
->
addCheckBox
(
false
,
rect
<
s32
>
(
posX
,
posY
,
posX
+
260
,
posY
+
25
),
tabHelper
,
CHECKBOX_QUICK_ANIMATION
,
dataManager
.
GetSysString
(
1299
));
chkQuickAnimation
->
setChecked
(
gameConf
.
quick_animation
!=
0
);
posY
+=
30
;
chkDrawSingleChain
=
env
->
addCheckBox
(
false
,
rect
<
s32
>
(
posX
,
posY
,
posX
+
260
,
posY
+
25
),
tabHelper
,
CHECKBOX_DRAW_SINGLE_CHAIN
,
dataManager
.
GetSysString
(
1287
));
chkDrawSingleChain
->
setChecked
(
gameConf
.
draw_single_chain
!=
0
);
posY
+=
30
;
chkAutoSaveReplay
=
env
->
addCheckBox
(
false
,
rect
<
s32
>
(
posX
,
posY
,
posX
+
260
,
posY
+
25
),
tabHelper
,
-
1
,
dataManager
.
GetSysString
(
1366
));
chkAutoSaveReplay
->
setChecked
(
gameConf
.
auto_save_replay
!=
0
);
elmTabHelperLast
=
chkAutoSaveReplay
;
...
...
@@ -1090,6 +1093,7 @@ void Game::LoadConfig() {
gameConf
.
enable_bot_mode
=
0
;
gameConf
.
quick_animation
=
0
;
gameConf
.
auto_save_replay
=
0
;
gameConf
.
draw_single_chain
=
0
;
gameConf
.
prefer_expansion_script
=
0
;
gameConf
.
enable_sound
=
true
;
gameConf
.
sound_volume
=
0.5
;
...
...
@@ -1172,6 +1176,8 @@ void Game::LoadConfig() {
gameConf
.
quick_animation
=
atoi
(
valbuf
);
}
else
if
(
!
strcmp
(
strbuf
,
"auto_save_replay"
))
{
gameConf
.
auto_save_replay
=
atoi
(
valbuf
);
}
else
if
(
!
strcmp
(
strbuf
,
"draw_single_chain"
))
{
gameConf
.
draw_single_chain
=
atoi
(
valbuf
);
}
else
if
(
!
strcmp
(
strbuf
,
"prefer_expansion_script"
))
{
gameConf
.
prefer_expansion_script
=
atoi
(
valbuf
);
}
else
if
(
!
strcmp
(
strbuf
,
"window_maximized"
))
{
...
...
@@ -1259,6 +1265,7 @@ void Game::SaveConfig() {
fprintf
(
fp
,
"enable_bot_mode = %d
\n
"
,
gameConf
.
enable_bot_mode
);
fprintf
(
fp
,
"quick_animation = %d
\n
"
,
gameConf
.
quick_animation
);
fprintf
(
fp
,
"auto_save_replay = %d
\n
"
,
(
chkAutoSaveReplay
->
isChecked
()
?
1
:
0
));
fprintf
(
fp
,
"draw_single_chain = %d
\n
"
,
gameConf
.
draw_single_chain
);
fprintf
(
fp
,
"prefer_expansion_script = %d
\n
"
,
gameConf
.
prefer_expansion_script
);
fprintf
(
fp
,
"window_maximized = %d
\n
"
,
(
gameConf
.
window_maximized
?
1
:
0
));
fprintf
(
fp
,
"window_width = %d
\n
"
,
gameConf
.
window_width
);
...
...
@@ -1471,7 +1478,17 @@ void Game::ClearTextures() {
}
imageManager
.
ClearTexture
();
}
void
Game
::
CloseDuelWindow
()
{
void
Game
::
CloseGameButtons
()
{
btnChainIgnore
->
setVisible
(
false
);
btnChainAlways
->
setVisible
(
false
);
btnChainWhenAvail
->
setVisible
(
false
);
btnCancelOrFinish
->
setVisible
(
false
);
btnSpectatorSwap
->
setVisible
(
false
);
btnShuffle
->
setVisible
(
false
);
wSurrender
->
setVisible
(
false
);
}
void
Game
::
CloseGameWindow
()
{
CloseGameButtons
();
for
(
auto
wit
=
fadingList
.
begin
();
wit
!=
fadingList
.
end
();
++
wit
)
{
if
(
wit
->
isFadein
)
wit
->
autoFadeoutFrame
=
1
;
...
...
@@ -1481,34 +1498,32 @@ void Game::CloseDuelWindow() {
wANCard
->
setVisible
(
false
);
wANNumber
->
setVisible
(
false
);
wANRace
->
setVisible
(
false
);
wCardImg
->
setVisible
(
false
);
wCardSelect
->
setVisible
(
false
);
wCardDisplay
->
setVisible
(
false
);
wCmdMenu
->
setVisible
(
false
);
wFTSelect
->
setVisible
(
false
);
wHand
->
setVisible
(
false
);
wInfos
->
setVisible
(
false
);
wMessage
->
setVisible
(
false
);
wOptions
->
setVisible
(
false
);
wPhase
->
setVisible
(
false
);
wPosSelect
->
setVisible
(
false
);
wQuery
->
setVisible
(
false
);
wSurrender
->
setVisible
(
false
);
wReplayControl
->
setVisible
(
false
);
wReplaySave
->
setVisible
(
false
);
stHintMsg
->
setVisible
(
false
);
stTip
->
setVisible
(
false
);
}
void
Game
::
CloseDuelWindow
()
{
CloseGameWindow
();
wCardImg
->
setVisible
(
false
);
wInfos
->
setVisible
(
false
);
wChat
->
setVisible
(
false
);
btnSideOK
->
setVisible
(
false
);
btnSideShuffle
->
setVisible
(
false
);
btnSideSort
->
setVisible
(
false
);
btnSideReload
->
setVisible
(
false
);
btnLeaveGame
->
setVisible
(
false
);
btnSpectatorSwap
->
setVisible
(
false
);
btnChainIgnore
->
setVisible
(
false
);
btnChainAlways
->
setVisible
(
false
);
btnChainWhenAvail
->
setVisible
(
false
);
btnCancelOrFinish
->
setVisible
(
false
);
btnShuffle
->
setVisible
(
false
);
wChat
->
setVisible
(
false
);
lstLog
->
clear
();
logParam
.
clear
();
lstHostList
->
clear
();
...
...
gframe/game.h
View file @
8f9e5424
...
...
@@ -46,6 +46,7 @@ struct Config {
int
enable_bot_mode
;
int
quick_animation
;
int
auto_save_replay
;
int
draw_single_chain
;
int
prefer_expansion_script
;
bool
enable_sound
;
bool
enable_music
;
...
...
@@ -148,6 +149,8 @@ public:
void
AddDebugMsg
(
const
char
*
msgbuf
);
void
ErrorLog
(
const
char
*
msgbuf
);
void
ClearTextures
();
void
CloseGameButtons
();
void
CloseGameWindow
();
void
CloseDuelWindow
();
int
LocalPlayer
(
int
player
);
...
...
@@ -282,6 +285,7 @@ public:
irr
::
gui
::
IGUICheckBox
*
chkWaitChain
;
irr
::
gui
::
IGUICheckBox
*
chkQuickAnimation
;
irr
::
gui
::
IGUICheckBox
*
chkAutoSaveReplay
;
irr
::
gui
::
IGUICheckBox
*
chkDrawSingleChain
;
irr
::
gui
::
IGUIWindow
*
tabSystem
;
irr
::
gui
::
IGUIElement
*
elmTabSystemLast
;
irr
::
gui
::
IGUIScrollBar
*
scrTabSystem
;
...
...
@@ -723,6 +727,7 @@ extern Game* mainGame;
#define SCROLL_TAB_SYSTEM 371
#define CHECKBOX_MULTI_KEYWORDS 372
#define CHECKBOX_PREFER_EXPANSION 373
#define CHECKBOX_DRAW_SINGLE_CHAIN 374
#define DEFAULT_DUEL_RULE 5
...
...
gframe/image_manager.cpp
View file @
8f9e5424
...
...
@@ -15,6 +15,8 @@ bool ImageManager::Initial() {
tUnknown
=
NULL
;
tUnknownFit
=
NULL
;
tUnknownThumb
=
NULL
;
tLoading
=
NULL
;
tThumbLoadingThreadRunning
=
false
;
tAct
=
driver
->
getTexture
(
"textures/act.png"
);
tAttack
=
driver
->
getTexture
(
"textures/attack.png"
);
tChain
=
driver
->
getTexture
(
"textures/chain.png"
);
...
...
@@ -55,12 +57,18 @@ void ImageManager::ClearTexture() {
driver
->
removeTexture
(
tit
->
second
);
}
for
(
auto
tit
=
tThumb
.
begin
();
tit
!=
tThumb
.
end
();
++
tit
)
{
if
(
tit
->
second
)
if
(
tit
->
second
&&
tit
->
second
!=
tLoading
)
driver
->
removeTexture
(
tit
->
second
);
}
tMap
[
0
].
clear
();
tMap
[
1
].
clear
();
tThumb
.
clear
();
tThumbLoadingMutex
.
lock
();
tThumbLoading
.
clear
();
while
(
!
tThumbLoadingCodes
.
empty
())
tThumbLoadingCodes
.
pop
();
tThumbLoadingThreadRunning
=
false
;
tThumbLoadingMutex
.
unlock
();
tFields
.
clear
();
}
void
ImageManager
::
RemoveTexture
(
int
code
)
{
...
...
@@ -96,9 +104,11 @@ void ImageManager::ResizeTexture() {
driver
->
removeTexture
(
tUnknown
);
driver
->
removeTexture
(
tUnknownFit
);
driver
->
removeTexture
(
tUnknownThumb
);
driver
->
removeTexture
(
tLoading
);
tUnknown
=
GetTextureFromFile
(
"textures/unknown.jpg"
,
CARD_IMG_WIDTH
,
CARD_IMG_HEIGHT
);
tUnknownFit
=
GetTextureFromFile
(
"textures/unknown.jpg"
,
imgWidthFit
,
imgHeightFit
);
tUnknownThumb
=
GetTextureFromFile
(
"textures/unknown.jpg"
,
imgWidthThumb
,
imgHeightThumb
);
tLoading
=
GetTextureFromFile
(
"textures/cover.jpg"
,
imgWidthThumb
,
imgHeightThumb
);
driver
->
removeTexture
(
tBackGround
);
tBackGround
=
GetTextureFromFile
(
"textures/bg.jpg"
,
bgWidth
,
bgHeight
);
driver
->
removeTexture
(
tBackGround_menu
);
...
...
@@ -236,30 +246,90 @@ irr::video::ITexture* ImageManager::GetTexture(int code, bool fit) {
else
return
mainGame
->
gameConf
.
use_image_scale
?
(
fit
?
tUnknownFit
:
tUnknown
)
:
GetTextureThumb
(
code
);
}
irr
::
video
::
ITexture
*
ImageManager
::
GetTextureThumb
(
int
code
)
{
if
(
code
==
0
)
return
tUnknownThumb
;
auto
tit
=
tThumb
.
find
(
code
);
int
width
=
CARD_THUMB_WIDTH
*
mainGame
->
xScale
;
int
height
=
CARD_THUMB_HEIGHT
*
mainGame
->
yScale
;
if
(
tit
==
tThumb
.
end
())
{
int
ImageManager
::
LoadThumbThread
()
{
while
(
true
)
{
imageManager
.
tThumbLoadingMutex
.
lock
();
int
code
=
imageManager
.
tThumbLoadingCodes
.
front
();
imageManager
.
tThumbLoadingCodes
.
pop
();
imageManager
.
tThumbLoadingMutex
.
unlock
();
char
file
[
256
];
sprintf
(
file
,
"expansions/pics/thumbnail/%d.jpg"
,
code
);
irr
::
video
::
I
Texture
*
img
=
GetTextureFromFile
(
file
,
width
,
height
);
irr
::
video
::
I
Image
*
img
=
imageManager
.
driver
->
createImageFromFile
(
file
);
if
(
img
==
NULL
)
{
sprintf
(
file
,
"pics/thumbnail/%d.jpg"
,
code
);
img
=
GetTextureFromFile
(
file
,
width
,
height
);
img
=
imageManager
.
driver
->
createImageFromFile
(
file
);
}
if
(
img
==
NULL
&&
mainGame
->
gameConf
.
use_image_scale
)
{
sprintf
(
file
,
"expansions/pics/%d.jpg"
,
code
);
img
=
GetTextureFromFile
(
file
,
width
,
height
);
if
(
img
==
NULL
)
{
sprintf
(
file
,
"pics/%d.jpg"
,
code
);
img
=
GetTextureFromFile
(
file
,
width
,
height
);
img
=
imageManager
.
driver
->
createImageFromFile
(
file
);
}
if
(
img
==
NULL
&&
mainGame
->
gameConf
.
use_image_scale
)
{
sprintf
(
file
,
"pics/%d.jpg"
,
code
);
img
=
imageManager
.
driver
->
createImageFromFile
(
file
);
}
if
(
img
!=
NULL
)
{
int
width
=
CARD_THUMB_WIDTH
*
mainGame
->
xScale
;
int
height
=
CARD_THUMB_HEIGHT
*
mainGame
->
yScale
;
if
(
img
->
getDimension
()
==
irr
::
core
::
dimension2d
<
u32
>
(
width
,
height
))
{
img
->
grab
();
imageManager
.
tThumbLoadingMutex
.
lock
();
if
(
imageManager
.
tThumbLoadingThreadRunning
)
imageManager
.
tThumbLoading
[
code
]
=
img
;
imageManager
.
tThumbLoadingMutex
.
unlock
();
}
else
{
irr
::
video
::
IImage
*
destimg
=
imageManager
.
driver
->
createImage
(
img
->
getColorFormat
(),
irr
::
core
::
dimension2d
<
u32
>
(
width
,
height
));
imageScaleNNAA
(
img
,
destimg
);
img
->
drop
();
destimg
->
grab
();
imageManager
.
tThumbLoadingMutex
.
lock
();
if
(
imageManager
.
tThumbLoadingThreadRunning
)
imageManager
.
tThumbLoading
[
code
]
=
destimg
;
imageManager
.
tThumbLoadingMutex
.
unlock
();
}
}
else
{
imageManager
.
tThumbLoadingMutex
.
lock
();
if
(
imageManager
.
tThumbLoadingThreadRunning
)
imageManager
.
tThumbLoading
[
code
]
=
NULL
;
imageManager
.
tThumbLoadingMutex
.
unlock
();
}
imageManager
.
tThumbLoadingMutex
.
lock
();
imageManager
.
tThumbLoadingThreadRunning
=
!
imageManager
.
tThumbLoadingCodes
.
empty
();
if
(
!
imageManager
.
tThumbLoadingThreadRunning
)
break
;
imageManager
.
tThumbLoadingMutex
.
unlock
();
}
imageManager
.
tThumbLoadingMutex
.
unlock
();
return
0
;
}
irr
::
video
::
ITexture
*
ImageManager
::
GetTextureThumb
(
int
code
)
{
if
(
code
==
0
)
return
tUnknownThumb
;
imageManager
.
tThumbLoadingMutex
.
lock
();
auto
lit
=
tThumbLoading
.
find
(
code
);
if
(
lit
!=
tThumbLoading
.
end
())
{
if
(
lit
->
second
!=
NULL
)
{
char
file
[
256
];
sprintf
(
file
,
"pics/thumbnail/%d.jpg"
,
code
);
irr
::
video
::
ITexture
*
texture
=
driver
->
addTexture
(
file
,
lit
->
second
);
// textures must be added in the main thread due to OpenGL
lit
->
second
->
drop
();
tThumb
[
code
]
=
texture
;
}
else
{
tThumb
[
code
]
=
NULL
;
}
tThumbLoading
.
erase
(
lit
);
}
imageManager
.
tThumbLoadingMutex
.
unlock
();
auto
tit
=
tThumb
.
find
(
code
);
if
(
tit
==
tThumb
.
end
())
{
tThumb
[
code
]
=
tLoading
;
imageManager
.
tThumbLoadingMutex
.
lock
();
tThumbLoadingCodes
.
push
(
code
);
if
(
!
tThumbLoadingThreadRunning
)
{
tThumbLoadingThreadRunning
=
true
;
std
::
thread
(
LoadThumbThread
).
detach
();
}
tThumb
[
code
]
=
img
;
return
(
img
==
NULL
)
?
tUnknownThumb
:
im
g
;
imageManager
.
tThumbLoadingMutex
.
unlock
()
;
return
tLoadin
g
;
}
if
(
tit
->
second
)
return
tit
->
second
;
...
...
gframe/image_manager.h
View file @
8f9e5424
...
...
@@ -4,6 +4,7 @@
#include "config.h"
#include "data_manager.h"
#include <unordered_map>
#include <queue>
namespace
ygo
{
...
...
@@ -18,16 +19,22 @@ public:
irr
::
video
::
ITexture
*
GetTexture
(
int
code
,
bool
fit
=
false
);
irr
::
video
::
ITexture
*
GetTextureThumb
(
int
code
);
irr
::
video
::
ITexture
*
GetTextureField
(
int
code
);
static
int
LoadThumbThread
();
std
::
unordered_map
<
int
,
irr
::
video
::
ITexture
*>
tMap
[
2
];
std
::
unordered_map
<
int
,
irr
::
video
::
ITexture
*>
tThumb
;
std
::
unordered_map
<
int
,
irr
::
video
::
ITexture
*>
tFields
;
std
::
unordered_map
<
int
,
irr
::
video
::
IImage
*>
tThumbLoading
;
std
::
queue
<
int
>
tThumbLoadingCodes
;
std
::
mutex
tThumbLoadingMutex
;
bool
tThumbLoadingThreadRunning
;
irr
::
IrrlichtDevice
*
device
;
irr
::
video
::
IVideoDriver
*
driver
;
irr
::
video
::
ITexture
*
tCover
[
4
];
irr
::
video
::
ITexture
*
tUnknown
;
irr
::
video
::
ITexture
*
tUnknownFit
;
irr
::
video
::
ITexture
*
tUnknownThumb
;
irr
::
video
::
ITexture
*
tLoading
;
irr
::
video
::
ITexture
*
tAct
;
irr
::
video
::
ITexture
*
tAttack
;
irr
::
video
::
ITexture
*
tNegated
;
...
...
gframe/replay_mode.cpp
View file @
8f9e5424
...
...
@@ -230,8 +230,7 @@ void ReplayMode::EndDuel() {
mainGame
->
actionSignal
.
Reset
();
mainGame
->
gMutex
.
lock
();
mainGame
->
stMessage
->
setText
(
dataManager
.
GetSysString
(
1501
));
if
(
mainGame
->
wCardSelect
->
isVisible
())
mainGame
->
HideElement
(
mainGame
->
wCardSelect
);
mainGame
->
HideElement
(
mainGame
->
wCardSelect
);
mainGame
->
PopupElement
(
mainGame
->
wMessage
);
mainGame
->
gMutex
.
unlock
();
mainGame
->
actionSignal
.
Wait
();
...
...
ocgcore
@
032b7b22
Subproject commit
80f1ced5a185d25d6a421f71a28caacc04e564f2
Subproject commit
032b7b22e8b3021f0d67afbec7efb587556630e4
script
@
f0a30e61
Subproject commit
216c4754fb203fe2f598fee02ace05e54f7cea55
Subproject commit
f0a30e61e84259d3b7704a3f3e4560a47a1a5cd8
strings.conf
View file @
8f9e5424
...
...
@@ -334,6 +334,7 @@
!
system
1284
中
!
system
1285
大
!
system
1286
特大
!
system
1287
只有连锁
1
也显示连锁动画
!
system
1290
禁用聊天功能
!
system
1291
忽略观战者发言
!
system
1292
忽略时点
...
...
system.conf
View file @
8f9e5424
#config file
#nickname & gamename should be less than 20 characters
use_d3d
=
0
use_image_scale
=
1
antialias
=
2
errorlog
=
3
nickname
=
Player
gamename
=
Game
lastdeck
=
new
textfont
=
c
:/
windows
/
fonts
/
msyh
.
ttf
14
numfont
=
c
:/
windows
/
fonts
/
arialbd
.
ttf
serverport
=
7911
lasthost
=
127
.
0
.
0
.
1
lastport
=
7911
automonsterpos
=
0
autospellpos
=
0
randompos
=
0
autochain
=
0
waitchain
=
0
mute_opponent
=
0
mute_spectators
=
0
default_rule
=
0
hide_setname
=
0
hide_hint_button
=
0
#control_mode = 0: Key A/S/D/R Chain Buttons. control_mode = 1: MouseLeft/MouseRight/NULL/F9 Without Chain Buttons
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
ignore_deck_changes
=
0
default_ot
=
1
enable_bot_mode
=
0
enable_sound
=
1
enable_music
=
1
#Volume of sound and music, between 0 and 100
sound_volume
=
50
music_volume
=
50
music_mode
=
1
#config file
#nickname & gamename should be less than 20 characters
use_d3d
=
0
use_image_scale
=
1
antialias
=
2
errorlog
=
3
nickname
=
Player
gamename
=
Game
lastdeck
=
new
textfont
=
c
:/
windows
/
fonts
/
simsun
.
ttc
14
numfont
=
c
:/
windows
/
fonts
/
arialbd
.
ttf
serverport
=
7911
lasthost
=
127
.
0
.
0
.
1
lastport
=
7911
automonsterpos
=
0
autospellpos
=
0
randompos
=
0
autochain
=
0
waitchain
=
0
mute_opponent
=
0
mute_spectators
=
0
default_rule
=
0
hide_setname
=
0
hide_hint_button
=
0
#control_mode = 0: Key A/S/D/R Chain Buttons. control_mode = 1: MouseLeft/MouseRight/NULL/F9 Without Chain Buttons
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
#search_multiple_keywords = 0: Disable. 1: Search mutiple keywords with separator " ". 2: with separator "+"
search_multiple_keywords
=
1
ignore_deck_changes
=
0
default_ot
=
1
enable_bot_mode
=
0
quick_animation
=
0
auto_save_replay
=
0
draw_single_chain
=
0
prefer_expansion_script
=
0
window_maximized
=
0
window_width
=
1280
window_height
=
800
resize_popup_menu
=
0
enable_sound
=
1
enable_music
=
1
#Volume of sound and music, between 0 and 100
sound_volume
=
50
music_volume
=
50
music_mode
=
1
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment