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
YGOPRO-520DIY
ygopro
Commits
5179735f
Commit
5179735f
authored
Jul 08, 2020
by
mercury233
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'fh' into patch-deck-category
parents
77b65772
1c36764c
Changes
14
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
838 additions
and
155 deletions
+838
-155
gframe/CGUITTFont.cpp
gframe/CGUITTFont.cpp
+6
-4
gframe/deck_con.cpp
gframe/deck_con.cpp
+92
-1
gframe/deck_con.h
gframe/deck_con.h
+2
-0
gframe/drawing.cpp
gframe/drawing.cpp
+45
-23
gframe/duelclient.cpp
gframe/duelclient.cpp
+18
-37
gframe/event_handler.cpp
gframe/event_handler.cpp
+12
-10
gframe/game.cpp
gframe/game.cpp
+47
-10
gframe/game.h
gframe/game.h
+16
-0
gframe/image_manager.cpp
gframe/image_manager.cpp
+121
-15
gframe/image_manager.h
gframe/image_manager.h
+9
-0
gframe/replay_mode.cpp
gframe/replay_mode.cpp
+1
-2
lflist.conf
lflist.conf
+401
-13
strings.conf
strings.conf
+19
-1
system.conf
system.conf
+49
-39
No files found.
gframe/CGUITTFont.cpp
View file @
5179735f
...
...
@@ -153,10 +153,12 @@ void SGUITTGlyph::preload(u32 char_index, FT_Face face, video::IVideoDriver* dri
}
glyph_page
=
parent
->
getLastGlyphPageIndex
();
u32
texture_side_length
=
page
->
texture_size
.
Width
;
u32
texture_side_length
=
page
->
texture_size
.
Width
-
font_size
;
u32
margin
=
font_size
*
0.5
;
u32
sprite_size
=
font_size
*
1.5
;
core
::
vector2di
page_position
(
(
page
->
used_slots
%
(
texture_side_length
/
font_size
))
*
font_size
,
(
page
->
used_slots
/
(
texture_side_length
/
font_size
))
*
font_size
(
s32
)(
page
->
used_slots
%
(
s32
)(
texture_side_length
/
sprite_size
))
*
sprite_size
+
margin
,
(
s32
)(
page
->
used_slots
/
(
s32
)(
texture_side_length
/
sprite_size
))
*
sprite_size
+
margin
);
source_rect
.
UpperLeftCorner
=
page_position
;
source_rect
.
LowerRightCorner
=
core
::
vector2di
(
page_position
.
X
+
bits
.
width
,
page_position
.
Y
+
bits
.
rows
);
...
...
@@ -466,7 +468,7 @@ CGUITTGlyphPage* CGUITTFont::createGlyphPage(const u8& pixel_mode) {
if
(
page
)
{
// Determine the number of glyph slots on the page and add it to the list of pages.
page
->
available_slots
=
(
page_texture_size
.
Width
/
size
)
*
(
page_texture_size
.
Height
/
size
);
page
->
available_slots
=
(
u32
)((
page_texture_size
.
Width
-
size
)
/
(
u32
)(
size
*
1.5
))
*
(
u32
)((
page_texture_size
.
Height
-
size
)
/
(
u32
)(
size
*
1.5
)
);
Glyph_Pages
.
push_back
(
page
);
}
return
page
;
...
...
gframe/deck_con.cpp
View file @
5179735f
...
...
@@ -122,6 +122,52 @@ inline void showDeckManage() {
mainGame
->
PopupElement
(
mainGame
->
wDeckManage
);
}
inline
void
ShowBigCard
(
int
code
,
float
zoom
)
{
mainGame
->
deckBuilder
.
bigcard_code
=
code
;
mainGame
->
deckBuilder
.
bigcard_zoom
=
zoom
;
ITexture
*
img
=
imageManager
.
GetBigPicture
(
code
,
zoom
);
mainGame
->
imgBigCard
->
setImage
(
img
);
auto
size
=
img
->
getSize
();
s32
left
=
mainGame
->
window_size
.
Width
/
2
-
size
.
Width
/
2
;
s32
top
=
mainGame
->
window_size
.
Height
/
2
-
size
.
Height
/
2
;
mainGame
->
imgBigCard
->
setRelativePosition
(
recti
(
0
,
0
,
size
.
Width
,
size
.
Height
));
mainGame
->
wBigCard
->
setRelativePosition
(
recti
(
left
,
top
,
left
+
size
.
Width
,
top
+
size
.
Height
));
mainGame
->
gMutex
.
lock
();
mainGame
->
btnBigCardOriginalSize
->
setVisible
(
true
);
mainGame
->
btnBigCardZoomIn
->
setVisible
(
true
);
mainGame
->
btnBigCardZoomOut
->
setVisible
(
true
);
mainGame
->
btnBigCardClose
->
setVisible
(
true
);
mainGame
->
ShowElement
(
mainGame
->
wBigCard
);
mainGame
->
env
->
getRootGUIElement
()
->
bringToFront
(
mainGame
->
wBigCard
);
mainGame
->
gMutex
.
unlock
();
}
inline
void
ZoomBigCard
(
s32
centerx
=
-
1
,
s32
centery
=
-
1
)
{
if
(
mainGame
->
deckBuilder
.
bigcard_zoom
>=
4
)
mainGame
->
deckBuilder
.
bigcard_zoom
=
4
;
if
(
mainGame
->
deckBuilder
.
bigcard_zoom
<=
0.2
)
mainGame
->
deckBuilder
.
bigcard_zoom
=
0.2
;
ITexture
*
img
=
imageManager
.
GetBigPicture
(
mainGame
->
deckBuilder
.
bigcard_code
,
mainGame
->
deckBuilder
.
bigcard_zoom
);
mainGame
->
imgBigCard
->
setImage
(
img
);
auto
size
=
img
->
getSize
();
auto
pos
=
mainGame
->
wBigCard
->
getRelativePosition
();
if
(
centerx
==
-
1
)
{
centerx
=
pos
.
UpperLeftCorner
.
X
+
pos
.
getWidth
()
/
2
;
centery
=
pos
.
UpperLeftCorner
.
Y
+
pos
.
getHeight
()
*
0.444
f
;
}
float
posx
=
(
float
)(
centerx
-
pos
.
UpperLeftCorner
.
X
)
/
pos
.
getWidth
();
float
posy
=
(
float
)(
centery
-
pos
.
UpperLeftCorner
.
Y
)
/
pos
.
getHeight
();
s32
left
=
centerx
-
size
.
Width
*
posx
;
s32
top
=
centery
-
size
.
Height
*
posy
;
mainGame
->
imgBigCard
->
setRelativePosition
(
recti
(
0
,
0
,
size
.
Width
,
size
.
Height
));
mainGame
->
wBigCard
->
setRelativePosition
(
recti
(
left
,
top
,
left
+
size
.
Width
,
top
+
size
.
Height
));
}
inline
void
CloseBigCard
()
{
mainGame
->
HideElement
(
mainGame
->
wBigCard
);
mainGame
->
btnBigCardOriginalSize
->
setVisible
(
false
);
mainGame
->
btnBigCardZoomIn
->
setVisible
(
false
);
mainGame
->
btnBigCardZoomOut
->
setVisible
(
false
);
mainGame
->
btnBigCardClose
->
setVisible
(
false
);
}
void
DeckBuilder
::
Initialize
()
{
mainGame
->
is_building
=
true
;
mainGame
->
is_siding
=
false
;
...
...
@@ -167,6 +213,11 @@ void DeckBuilder::Terminate() {
mainGame
->
wCardImg
->
setVisible
(
false
);
mainGame
->
wInfos
->
setVisible
(
false
);
mainGame
->
btnLeaveGame
->
setVisible
(
false
);
mainGame
->
wBigCard
->
setVisible
(
false
);
mainGame
->
btnBigCardOriginalSize
->
setVisible
(
false
);
mainGame
->
btnBigCardZoomIn
->
setVisible
(
false
);
mainGame
->
btnBigCardZoomOut
->
setVisible
(
false
);
mainGame
->
btnBigCardClose
->
setVisible
(
false
);
mainGame
->
PopupElement
(
mainGame
->
wMainMenu
);
mainGame
->
device
->
setEventReceiver
(
&
mainGame
->
menuHandler
);
mainGame
->
wACMessage
->
setVisible
(
false
);
...
...
@@ -713,6 +764,24 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
deckManager
.
LoadDeck
(
mainGame
->
cbCategorySelect
,
mainGame
->
cbDeckSelect
);
break
;
}
case
BUTTON_BIG_CARD_ORIG_SIZE
:
{
ShowBigCard
(
bigcard_code
,
1
);
break
;
}
case
BUTTON_BIG_CARD_ZOOM_IN
:
{
bigcard_zoom
+=
0.2
;
ZoomBigCard
();
break
;
}
case
BUTTON_BIG_CARD_ZOOM_OUT
:
{
bigcard_zoom
-=
0.2
;
ZoomBigCard
();
break
;
}
case
BUTTON_BIG_CARD_CLOSE
:
{
CloseBigCard
();
break
;
}
case
BUTTON_MSG_OK
:
{
mainGame
->
HideElement
(
mainGame
->
wMessage
);
mainGame
->
actionSignal
.
Set
();
...
...
@@ -1070,6 +1139,11 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
}
case
irr
:
:
EMIE_LMOUSE_LEFT_UP
:
{
is_starting_dragging
=
false
;
irr
::
gui
::
IGUIElement
*
root
=
mainGame
->
env
->
getRootGUIElement
();
if
(
!
is_draging
&&
!
mainGame
->
is_siding
&&
root
->
getElementFromPoint
(
mouse_pos
)
==
mainGame
->
imgCard
)
{
ShowBigCard
(
mainGame
->
showingcode
,
1
);
break
;
}
if
(
!
is_draging
)
break
;
soundManager
.
PlaySoundEffect
(
SOUND_CARD_DROP
);
...
...
@@ -1093,6 +1167,14 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
is_draging
=
false
;
break
;
}
case
irr
:
:
EMIE_LMOUSE_DOUBLE_CLICK
:
{
irr
::
gui
::
IGUIElement
*
root
=
mainGame
->
env
->
getRootGUIElement
();
if
(
!
is_draging
&&
!
mainGame
->
is_siding
&&
root
->
getElementFromPoint
(
mouse_pos
)
==
root
&&
hovered_code
)
{
ShowBigCard
(
hovered_code
,
1
);
break
;
}
break
;
}
case
irr
:
:
EMIE_RMOUSE_LEFT_UP
:
{
if
(
mainGame
->
is_siding
)
{
if
(
is_draging
)
...
...
@@ -1115,6 +1197,10 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
}
break
;
}
if
(
mainGame
->
wBigCard
->
isVisible
())
{
CloseBigCard
();
break
;
}
if
(
havePopupWindow
())
break
;
if
(
!
is_draging
)
{
...
...
@@ -1197,11 +1283,16 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
break
;
}
case
irr
:
:
EMIE_MOUSE_WHEEL
:
{
irr
::
gui
::
IGUIElement
*
root
=
mainGame
->
env
->
getRootGUIElement
();
if
(
root
->
getElementFromPoint
(
mouse_pos
)
==
mainGame
->
imgBigCard
)
{
bigcard_zoom
+=
0.1
f
*
event
.
MouseInput
.
Wheel
;
ZoomBigCard
(
mouse_pos
.
X
,
mouse_pos
.
Y
);
break
;
}
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
)
{
...
...
gframe/deck_con.h
View file @
5179735f
...
...
@@ -56,6 +56,8 @@ public:
bool
is_starting_dragging
;
int
dragx
;
int
dragy
;
int
bigcard_code
;
float
bigcard_zoom
;
size_t
pre_mainc
;
size_t
pre_extrac
;
size_t
pre_sidec
;
...
...
gframe/drawing.cpp
View file @
5179735f
...
...
@@ -452,31 +452,45 @@ void Game::DrawMisc() {
driver
->
drawVertexPrimitiveList
(
matManager
.
vActivate
,
4
,
matManager
.
iRectangle
,
2
);
}
if
(
dField
.
conti_act
)
{
im
.
setTranslation
(
vector3df
((
matManager
.
vFieldContiAct
[
0
].
X
+
matManager
.
vFieldContiAct
[
1
].
X
)
/
2
,
(
matManager
.
vFieldContiAct
[
0
].
Y
+
matManager
.
vFieldContiAct
[
2
].
Y
)
/
2
,
0.03
f
));
irr
::
core
::
vector3df
pos
=
vector3df
((
matManager
.
vFieldContiAct
[
0
].
X
+
matManager
.
vFieldContiAct
[
1
].
X
)
/
2
,
(
matManager
.
vFieldContiAct
[
0
].
Y
+
matManager
.
vFieldContiAct
[
2
].
Y
)
/
2
,
0
);
im
.
setRotationRadians
(
irr
::
core
::
vector3df
(
0
,
0
,
0
));
for
(
auto
cit
=
dField
.
conti_cards
.
begin
();
cit
!=
dField
.
conti_cards
.
end
();
++
cit
)
{
im
.
setTranslation
(
pos
);
driver
->
setTransform
(
irr
::
video
::
ETS_WORLD
,
im
);
matManager
.
mCard
.
setTexture
(
0
,
imageManager
.
GetTexture
((
*
cit
)
->
code
));
driver
->
setMaterial
(
matManager
.
mCard
);
driver
->
drawVertexPrimitiveList
(
matManager
.
vCardFront
,
4
,
matManager
.
iRectangle
,
2
);
pos
.
Z
+=
0.03
f
;
}
im
.
setTranslation
(
pos
);
im
.
setRotationRadians
(
act_rot
);
driver
->
setTransform
(
irr
::
video
::
ETS_WORLD
,
im
);
driver
->
setMaterial
(
matManager
.
mTexture
);
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
)
...
...
@@ -987,9 +1001,12 @@ void Game::ShowElement(irr::gui::IGUIElement * win, int autoframe) {
btnCardDisplay
[
i
]
->
setDrawImage
(
false
);
}
win
->
setRelativePosition
(
irr
::
core
::
recti
(
center
.
X
,
center
.
Y
,
0
,
0
));
win
->
setVisible
(
true
);
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
)
...
...
@@ -1197,8 +1214,13 @@ void Game::DrawSearchResults() {
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 @
5179735f
...
...
@@ -370,24 +370,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
();
...
...
@@ -488,12 +481,9 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) {
mainGame
->
RefreshCategoryDeck
(
mainGame
->
cbCategorySelect
,
mainGame
->
cbDeckSelect
);
mainGame
->
cbCategorySelect
->
setEnabled
(
true
);
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
);
...
...
@@ -651,12 +641,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
();
...
...
@@ -690,14 +675,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
));
...
...
@@ -2392,8 +2372,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
);
...
...
@@ -2908,13 +2887,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 @
5179735f
...
...
@@ -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
;
...
...
@@ -1801,10 +1794,14 @@ bool ClientField::OnCommonEvent(const irr::SEvent& event) {
mainGame
->
SetCursor
(
event
.
GUIEvent
.
Caller
->
isEnabled
()
?
ECI_IBEAM
:
ECI_NORMAL
);
return
true
;
}
if
(
event
.
GUIEvent
.
Caller
==
mainGame
->
imgCard
&&
mainGame
->
is_building
&&
!
mainGame
->
is_siding
)
{
mainGame
->
SetCursor
(
ECI_HAND
);
return
true
;
}
break
;
}
case
irr
:
:
gui
::
EGET_ELEMENT_LEFT
:
{
if
(
event
.
GUIEvent
.
Caller
->
getType
()
==
EGUIET_EDIT_BOX
)
{
if
(
event
.
GUIEvent
.
Caller
->
getType
()
==
EGUIET_EDIT_BOX
||
event
.
GUIEvent
.
Caller
==
mainGame
->
imgCard
)
{
mainGame
->
SetCursor
(
ECI_NORMAL
);
return
true
;
}
...
...
@@ -1877,6 +1874,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 @
5179735f
...
...
@@ -288,6 +288,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
;
...
...
@@ -772,6 +775,23 @@ bool Game::Initialize() {
//cancel or finish
btnCancelOrFinish
=
env
->
addButton
(
rect
<
s32
>
(
205
,
230
,
295
,
265
),
0
,
BUTTON_CANCEL_OR_FINISH
,
dataManager
.
GetSysString
(
1295
));
btnCancelOrFinish
->
setVisible
(
false
);
//big picture
wBigCard
=
env
->
addWindow
(
rect
<
s32
>
(
0
,
0
,
0
,
0
),
false
,
L""
);
wBigCard
->
getCloseButton
()
->
setVisible
(
false
);
wBigCard
->
setDrawTitlebar
(
false
);
wBigCard
->
setDrawBackground
(
false
);
wBigCard
->
setVisible
(
false
);
imgBigCard
=
env
->
addImage
(
rect
<
s32
>
(
0
,
0
,
0
,
0
),
wBigCard
);
imgBigCard
->
setScaleImage
(
false
);
imgBigCard
->
setUseAlphaChannel
(
true
);
btnBigCardOriginalSize
=
env
->
addButton
(
rect
<
s32
>
(
205
,
100
,
295
,
135
),
0
,
BUTTON_BIG_CARD_ORIG_SIZE
,
dataManager
.
GetSysString
(
1443
));
btnBigCardZoomIn
=
env
->
addButton
(
rect
<
s32
>
(
205
,
140
,
295
,
175
),
0
,
BUTTON_BIG_CARD_ZOOM_IN
,
dataManager
.
GetSysString
(
1441
));
btnBigCardZoomOut
=
env
->
addButton
(
rect
<
s32
>
(
205
,
180
,
295
,
215
),
0
,
BUTTON_BIG_CARD_ZOOM_OUT
,
dataManager
.
GetSysString
(
1442
));
btnBigCardClose
=
env
->
addButton
(
rect
<
s32
>
(
205
,
230
,
295
,
265
),
0
,
BUTTON_BIG_CARD_CLOSE
,
dataManager
.
GetSysString
(
1440
));
btnBigCardOriginalSize
->
setVisible
(
false
);
btnBigCardZoomIn
->
setVisible
(
false
);
btnBigCardZoomOut
->
setVisible
(
false
);
btnBigCardClose
->
setVisible
(
false
);
//leave/surrender/exit
btnLeaveGame
=
env
->
addButton
(
rect
<
s32
>
(
205
,
5
,
295
,
80
),
0
,
BUTTON_LEAVE_GAME
,
L""
);
btnLeaveGame
->
setVisible
(
false
);
...
...
@@ -1165,6 +1185,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
;
...
...
@@ -1247,6 +1268,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"
))
{
...
...
@@ -1344,6 +1367,7 @@ void Game::SaveConfig() {
fprintf
(
fp
,
"bot_deck_path = %s
\n
"
,
linebuf
);
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
);
...
...
@@ -1556,7 +1580,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
;
...
...
@@ -1566,34 +1600,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
();
...
...
@@ -1796,6 +1828,11 @@ void Game::OnResize() {
btnChainWhenAvail
->
setRelativePosition
(
Resize
(
205
,
180
,
295
,
215
));
btnShuffle
->
setRelativePosition
(
Resize
(
205
,
230
,
295
,
265
));
btnCancelOrFinish
->
setRelativePosition
(
Resize
(
205
,
230
,
295
,
265
));
btnBigCardOriginalSize
->
setRelativePosition
(
Resize
(
205
,
100
,
295
,
135
));
btnBigCardZoomIn
->
setRelativePosition
(
Resize
(
205
,
140
,
295
,
175
));
btnBigCardZoomOut
->
setRelativePosition
(
Resize
(
205
,
180
,
295
,
215
));
btnBigCardClose
->
setRelativePosition
(
Resize
(
205
,
230
,
295
,
265
));
}
recti
Game
::
Resize
(
s32
x
,
s32
y
,
s32
x2
,
s32
y2
)
{
x
=
x
*
xScale
;
...
...
gframe/game.h
View file @
5179735f
...
...
@@ -48,6 +48,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
;
...
...
@@ -155,6 +156,8 @@ public:
void
AddDebugMsg
(
const
char
*
msgbuf
);
void
ErrorLog
(
const
char
*
msgbuf
);
void
ClearTextures
();
void
CloseGameButtons
();
void
CloseGameWindow
();
void
CloseDuelWindow
();
int
LocalPlayer
(
int
player
);
...
...
@@ -289,6 +292,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
;
...
...
@@ -565,6 +569,13 @@ public:
irr
::
gui
::
IGUIButton
*
btnChainWhenAvail
;
//cancel or finish
irr
::
gui
::
IGUIButton
*
btnCancelOrFinish
;
//big picture
irr
::
gui
::
IGUIWindow
*
wBigCard
;
irr
::
gui
::
IGUIImage
*
imgBigCard
;
irr
::
gui
::
IGUIButton
*
btnBigCardOriginalSize
;
irr
::
gui
::
IGUIButton
*
btnBigCardZoomIn
;
irr
::
gui
::
IGUIButton
*
btnBigCardZoomOut
;
irr
::
gui
::
IGUIButton
*
btnBigCardClose
;
};
extern
Game
*
mainGame
;
...
...
@@ -769,6 +780,11 @@ 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 BUTTON_BIG_CARD_CLOSE 380
#define BUTTON_BIG_CARD_ZOOM_IN 381
#define BUTTON_BIG_CARD_ZOOM_OUT 382
#define BUTTON_BIG_CARD_ORIG_SIZE 383
#define DEFAULT_DUEL_RULE 5
...
...
gframe/image_manager.cpp
View file @
5179735f
...
...
@@ -15,6 +15,9 @@ bool ImageManager::Initial() {
tUnknown
=
NULL
;
tUnknownFit
=
NULL
;
tUnknownThumb
=
NULL
;
tBigPicture
=
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 +58,22 @@ 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
);
}
if
(
tBigPicture
!=
NULL
)
{
driver
->
removeTexture
(
tBigPicture
);
tBigPicture
=
NULL
;
}
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 +109,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 +251,121 @@ 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
::
Get
TextureThumb
(
int
code
)
{
irr
::
video
::
ITexture
*
ImageManager
::
Get
BigPicture
(
int
code
,
float
zoom
)
{
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
())
{
return
tUnknown
;
if
(
tBigPicture
!=
NULL
)
{
driver
->
removeTexture
(
tBigPicture
);
tBigPicture
=
NULL
;
}
irr
::
video
::
ITexture
*
texture
;
char
file
[
256
];
sprintf
(
file
,
"expansions/pics/%d.jpg"
,
code
);
irr
::
video
::
IImage
*
srcimg
=
driver
->
createImageFromFile
(
file
);
if
(
srcimg
==
NULL
)
{
sprintf
(
file
,
"pics/%d.jpg"
,
code
);
srcimg
=
driver
->
createImageFromFile
(
file
);
}
if
(
srcimg
==
NULL
)
{
return
tUnknown
;
}
if
(
zoom
==
1
)
{
texture
=
driver
->
addTexture
(
file
,
srcimg
);
}
else
{
auto
origsize
=
srcimg
->
getDimension
();
video
::
IImage
*
destimg
=
driver
->
createImage
(
srcimg
->
getColorFormat
(),
irr
::
core
::
dimension2d
<
u32
>
(
origsize
.
Width
*
zoom
,
origsize
.
Height
*
zoom
));
imageScaleNNAA
(
srcimg
,
destimg
);
texture
=
driver
->
addTexture
(
file
,
destimg
);
destimg
->
drop
();
}
srcimg
->
drop
();
tBigPicture
=
texture
;
return
texture
;
}
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 @
5179735f
...
...
@@ -4,6 +4,7 @@
#include "config.h"
#include "data_manager.h"
#include <unordered_map>
#include <queue>
namespace
ygo
{
...
...
@@ -16,18 +17,26 @@ public:
void
ResizeTexture
();
irr
::
video
::
ITexture
*
GetTextureFromFile
(
const
char
*
file
,
s32
width
,
s32
height
);
irr
::
video
::
ITexture
*
GetTexture
(
int
code
,
bool
fit
=
false
);
irr
::
video
::
ITexture
*
GetBigPicture
(
int
code
,
float
zoom
);
irr
::
video
::
ITexture
*
GetTextureThumb
(
int
code
);
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
*
tBigPicture
;
irr
::
video
::
ITexture
*
tLoading
;
irr
::
video
::
ITexture
*
tAct
;
irr
::
video
::
ITexture
*
tAttack
;
irr
::
video
::
ITexture
*
tNegated
;
...
...
gframe/replay_mode.cpp
View file @
5179735f
...
...
@@ -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
();
...
...
lflist.conf
View file @
5179735f
This diff is collapsed.
Click to expand it.
strings.conf
View file @
5179735f
...
...
@@ -334,6 +334,7 @@
!
system
1284
中
!
system
1285
大
!
system
1286
特大
!
system
1287
只有连锁
1
也显示连锁动画
!
system
1290
禁用聊天功能
!
system
1291
忽略观战者发言
!
system
1292
忽略时点
...
...
@@ -456,6 +457,10 @@
!
system
1429
选择的位置不符合条件。
!
system
1430
选择的表示形式不符合条件。
!
system
1431
选择的指示物不符合条件。
!
system
1440
关闭大图
!
system
1441
放大
!
system
1442
缩小
!
system
1443
原始尺寸
!
system
1450
卡包展示
!
system
1451
人机卡组
!
system
1452
未分类卡组
...
...
@@ -648,6 +653,7 @@
!
setname
0
x12
青蛙 ガエル
!
setname
0
x13
机皇 機皇
!
setname
0
x3013
机皇帝 機皇帝
!
setname
0
x5013
机皇神 機皇神
!
setname
0
x6013
机皇兵 機皇兵
#setname 0x14 N/A
!
setname
0
x15
巨大战舰 巨大戦艦
...
...
@@ -876,7 +882,8 @@
!
setname
0
xbd
暗黑骑士 盖亚 暗黒騎士ガイア
!
setname
0
xbe
帝王 帝王
!
setname
0
xbf
灵使 霊使い
!
setname
0
xc0
凭依装着 憑依装着
!
setname
0
xc0
凭依 憑依
!
setname
0
x10c0
凭依装着 憑依装着
!
setname
0
xc1
PSY
骨架
PSY
フレーム
!
setname
0
x10c1
PSY
骨架装备
PSY
フレームギア
!
setname
0
xc2
动力工具 パワー・ツール
...
...
@@ -1034,3 +1041,14 @@
!
setname
0
x146
童话动物 メルフィー
!
setname
0
x147
波波 ポータン
!
setname
0
x148
罗兰 ローラン
!
setname
0
x149
化石
!
setname
0
x14a
源数 ヌメロン
!
setname
0
x114a
源数之门 ゲート・オブ・ヌメロン
!
setname
0
x14b
机块 機塊
#setname 0x14c 灵术 霊術
!
setname
0
x314c
地灵术 地霊術
#setname 0x514c 水灵术 水霊術
!
setname
0
x614c
火灵术 火霊術
#setname 0x914c 风灵术 風霊術
#setname 0xa14c 光灵术 光霊術
#setname 0xc14c 暗灵术 闇霊術
system.conf
View file @
5179735f
#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