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
List
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
wind2009
ygopro
Commits
5bda065d
Commit
5bda065d
authored
May 25, 2020
by
mercury233
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
https://github.com/Fluorohydride/ygopro
into server
parents
65fa1912
3aeb7721
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
229 additions
and
134 deletions
+229
-134
gframe/drawing.cpp
gframe/drawing.cpp
+30
-21
gframe/duelclient.cpp
gframe/duelclient.cpp
+18
-37
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
strings.conf
strings.conf
+1
-0
system.conf
system.conf
+49
-39
No files found.
gframe/drawing.cpp
View file @
5bda065d
...
...
@@ -457,26 +457,28 @@ void Game::DrawMisc() {
driver
->
setTransform
(
irr
::
video
::
ETS_WORLD
,
im
);
driver
->
drawVertexPrimitiveList
(
matManager
.
vActivate
,
4
,
matManager
.
iRectangle
,
2
);
}
for
(
size_t
i
=
0
;
i
<
dField
.
chains
.
size
();
++
i
)
{
if
(
dField
.
chains
[
i
].
solved
)
break
;
matManager
.
mTRTexture
.
setTexture
(
0
,
imageManager
.
tChain
);
matManager
.
mTRTexture
.
AmbientColor
=
0xffffff00
;
ic
.
setRotationRadians
(
act_rot
);
ic
.
setTranslation
(
dField
.
chains
[
i
].
chain_pos
);
driver
->
setMaterial
(
matManager
.
mTRTexture
);
driver
->
setTransform
(
irr
::
video
::
ETS_WORLD
,
ic
);
driver
->
drawVertexPrimitiveList
(
matManager
.
vSymbol
,
4
,
matManager
.
iRectangle
,
2
);
it
.
setScale
(
0.6
f
);
it
.
setTranslation
(
dField
.
chains
[
i
].
chain_pos
);
matManager
.
mTRTexture
.
setTexture
(
0
,
imageManager
.
tNumber
);
matManager
.
vChainNum
[
0
].
TCoords
=
vector2df
(
0.19375
f
*
(
i
%
5
),
0.2421875
f
*
(
i
/
5
));
matManager
.
vChainNum
[
1
].
TCoords
=
vector2df
(
0.19375
f
*
(
i
%
5
+
1
),
0.2421875
f
*
(
i
/
5
));
matManager
.
vChainNum
[
2
].
TCoords
=
vector2df
(
0.19375
f
*
(
i
%
5
),
0.2421875
f
*
(
i
/
5
+
1
));
matManager
.
vChainNum
[
3
].
TCoords
=
vector2df
(
0.19375
f
*
(
i
%
5
+
1
),
0.2421875
f
*
(
i
/
5
+
1
));
driver
->
setMaterial
(
matManager
.
mTRTexture
);
driver
->
setTransform
(
irr
::
video
::
ETS_WORLD
,
it
);
driver
->
drawVertexPrimitiveList
(
matManager
.
vChainNum
,
4
,
matManager
.
iRectangle
,
2
);
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
;
matManager
.
mTRTexture
.
setTexture
(
0
,
imageManager
.
tChain
);
matManager
.
mTRTexture
.
AmbientColor
=
0xffffff00
;
ic
.
setRotationRadians
(
act_rot
);
ic
.
setTranslation
(
dField
.
chains
[
i
].
chain_pos
);
driver
->
setMaterial
(
matManager
.
mTRTexture
);
driver
->
setTransform
(
irr
::
video
::
ETS_WORLD
,
ic
);
driver
->
drawVertexPrimitiveList
(
matManager
.
vSymbol
,
4
,
matManager
.
iRectangle
,
2
);
it
.
setScale
(
0.6
f
);
it
.
setTranslation
(
dField
.
chains
[
i
].
chain_pos
);
matManager
.
mTRTexture
.
setTexture
(
0
,
imageManager
.
tNumber
);
matManager
.
vChainNum
[
0
].
TCoords
=
vector2df
(
0.19375
f
*
(
i
%
5
),
0.2421875
f
*
(
i
/
5
));
matManager
.
vChainNum
[
1
].
TCoords
=
vector2df
(
0.19375
f
*
(
i
%
5
+
1
),
0.2421875
f
*
(
i
/
5
));
matManager
.
vChainNum
[
2
].
TCoords
=
vector2df
(
0.19375
f
*
(
i
%
5
),
0.2421875
f
*
(
i
/
5
+
1
));
matManager
.
vChainNum
[
3
].
TCoords
=
vector2df
(
0.19375
f
*
(
i
%
5
+
1
),
0.2421875
f
*
(
i
/
5
+
1
));
driver
->
setMaterial
(
matManager
.
mTRTexture
);
driver
->
setTransform
(
irr
::
video
::
ETS_WORLD
,
it
);
driver
->
drawVertexPrimitiveList
(
matManager
.
vChainNum
,
4
,
matManager
.
iRectangle
,
2
);
}
}
//finish button
if
(
btnCancelOrFinish
->
isVisible
()
&&
dField
.
select_ready
)
...
...
@@ -990,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
)
...
...
@@ -1153,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 @
5bda065d
...
...
@@ -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,13 +2885,15 @@ 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
.
last_chain
)
mainGame
->
WaitFrameSignal
(
11
);
for
(
int
i
=
0
;
i
<
5
;
++
i
)
{
mainGame
->
dField
.
chains
[
ct
-
1
].
solved
=
false
;
mainGame
->
WaitFrameSignal
(
3
);
mainGame
->
dField
.
chains
[
ct
-
1
].
solved
=
true
;
mainGame
->
WaitFrameSignal
(
3
);
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
)
{
mainGame
->
dField
.
chains
[
ct
-
1
].
solved
=
false
;
mainGame
->
WaitFrameSignal
(
3
);
mainGame
->
dField
.
chains
[
ct
-
1
].
solved
=
true
;
mainGame
->
WaitFrameSignal
(
3
);
}
}
mainGame
->
dField
.
last_chain
=
false
;
return
true
;
...
...
gframe/event_handler.cpp
View file @
5bda065d
...
...
@@ -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 @
5bda065d
...
...
@@ -313,6 +313,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
;
...
...
@@ -1123,6 +1126,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
;
...
...
@@ -1205,6 +1209,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"
))
{
...
...
@@ -1292,6 +1298,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
);
...
...
@@ -1510,7 +1517,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
;
...
...
@@ -1520,34 +1537,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 @
5bda065d
...
...
@@ -51,6 +51,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
;
...
...
@@ -161,6 +162,8 @@ public:
void
AddDebugMsg
(
const
char
*
msgbuf
);
void
ErrorLog
(
const
char
*
msgbuf
);
void
ClearTextures
();
void
CloseGameButtons
();
void
CloseGameWindow
();
void
CloseDuelWindow
();
int
LocalPlayer
(
int
player
);
...
...
@@ -295,6 +298,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
;
...
...
@@ -742,6 +746,7 @@ extern time_t pre_seed[3];
#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 @
5bda065d
...
...
@@ -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 @
5bda065d
...
...
@@ -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 @
5bda065d
...
...
@@ -233,8 +233,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
();
...
...
strings.conf
View file @
5bda065d
...
...
@@ -334,6 +334,7 @@
!
system
1284
中
!
system
1285
大
!
system
1286
特大
!
system
1287
只有连锁
1
也显示连锁动画
!
system
1290
禁用聊天功能
!
system
1291
忽略观战者发言
!
system
1292
忽略时点
...
...
system.conf
View file @
5bda065d
#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
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