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
1
Merge Requests
1
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
nanahira
ygopro
Commits
bcab56c4
Commit
bcab56c4
authored
Mar 04, 2025
by
nanahira
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of github.com:Fluorohydride/ygopro into develop
parents
936d3852
7f962a99
Changes
20
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
252 additions
and
253 deletions
+252
-253
gframe/CGUIImageButton.cpp
gframe/CGUIImageButton.cpp
+8
-8
gframe/CGUIImageButton.h
gframe/CGUIImageButton.h
+2
-2
gframe/CGUITTFont.cpp
gframe/CGUITTFont.cpp
+3
-3
gframe/client_field.cpp
gframe/client_field.cpp
+33
-58
gframe/client_field.h
gframe/client_field.h
+1
-0
gframe/config.h
gframe/config.h
+3
-1
gframe/data_manager.cpp
gframe/data_manager.cpp
+3
-1
gframe/deck_con.cpp
gframe/deck_con.cpp
+1
-1
gframe/deck_con.h
gframe/deck_con.h
+4
-4
gframe/deck_manager.cpp
gframe/deck_manager.cpp
+12
-8
gframe/deck_manager.h
gframe/deck_manager.h
+1
-1
gframe/drawing.cpp
gframe/drawing.cpp
+15
-15
gframe/event_handler.cpp
gframe/event_handler.cpp
+16
-16
gframe/game.cpp
gframe/game.cpp
+17
-11
gframe/game.h
gframe/game.h
+6
-5
gframe/gframe.cpp
gframe/gframe.cpp
+25
-26
gframe/materials.cpp
gframe/materials.cpp
+64
-64
gframe/materials.h
gframe/materials.h
+31
-26
gframe/menu_handler.h
gframe/menu_handler.h
+3
-3
premake/freetype/premake5.lua
premake/freetype/premake5.lua
+4
-0
No files found.
gframe/CGUIImageButton.cpp
View file @
bcab56c4
...
@@ -15,7 +15,7 @@ namespace irr {
...
@@ -15,7 +15,7 @@ namespace irr {
namespace
gui
{
namespace
gui
{
void
Draw2DImageRotation
(
video
::
IVideoDriver
*
driver
,
video
::
ITexture
*
image
,
core
::
rect
<
s32
>
sourceRect
,
void
Draw2DImageRotation
(
video
::
IVideoDriver
*
driver
,
video
::
ITexture
*
image
,
core
::
rect
<
s32
>
sourceRect
,
core
::
position2d
<
s32
>
position
,
core
::
position
2d
<
s32
>
rotationPoint
,
f32
rotation
,
core
::
vector2df
scale
,
bool
useAlphaChannel
,
video
::
SColor
color
)
{
core
::
vector2d
<
s32
>
position
,
core
::
vector
2d
<
s32
>
rotationPoint
,
f32
rotation
,
core
::
vector2df
scale
,
bool
useAlphaChannel
,
video
::
SColor
color
)
{
irr
::
video
::
SMaterial
material
;
irr
::
video
::
SMaterial
material
;
irr
::
core
::
matrix4
oldProjMat
=
driver
->
getTransform
(
irr
::
video
::
ETS_PROJECTION
);
irr
::
core
::
matrix4
oldProjMat
=
driver
->
getTransform
(
irr
::
video
::
ETS_PROJECTION
);
driver
->
setTransform
(
irr
::
video
::
ETS_PROJECTION
,
irr
::
core
::
matrix4
());
driver
->
setTransform
(
irr
::
video
::
ETS_PROJECTION
,
irr
::
core
::
matrix4
());
...
@@ -63,7 +63,7 @@ void Draw2DImageRotation(video::IVideoDriver* driver, video::ITexture* image, co
...
@@ -63,7 +63,7 @@ void Draw2DImageRotation(video::IVideoDriver* driver, video::ITexture* image, co
driver
->
setTransform
(
irr
::
video
::
ETS_VIEW
,
oldViewMat
);
driver
->
setTransform
(
irr
::
video
::
ETS_VIEW
,
oldViewMat
);
}
}
void
Draw2DImageQuad
(
video
::
IVideoDriver
*
driver
,
video
::
ITexture
*
image
,
core
::
rect
<
s32
>
sourceRect
,
void
Draw2DImageQuad
(
video
::
IVideoDriver
*
driver
,
video
::
ITexture
*
image
,
core
::
rect
<
s32
>
sourceRect
,
core
::
position
2d
<
s32
>
corner
[
4
],
bool
useAlphaChannel
,
video
::
SColor
color
)
{
core
::
vector
2d
<
s32
>
corner
[
4
],
bool
useAlphaChannel
,
video
::
SColor
color
)
{
irr
::
video
::
SMaterial
material
;
irr
::
video
::
SMaterial
material
;
irr
::
core
::
matrix4
oldProjMat
=
driver
->
getTransform
(
irr
::
video
::
ETS_PROJECTION
);
irr
::
core
::
matrix4
oldProjMat
=
driver
->
getTransform
(
irr
::
video
::
ETS_PROJECTION
);
driver
->
setTransform
(
irr
::
video
::
ETS_PROJECTION
,
irr
::
core
::
matrix4
());
driver
->
setTransform
(
irr
::
video
::
ETS_PROJECTION
,
irr
::
core
::
matrix4
());
...
@@ -255,7 +255,7 @@ bool CGUIImageButton::OnEvent(const SEvent& event)
...
@@ -255,7 +255,7 @@ bool CGUIImageButton::OnEvent(const SEvent& event)
if
(
event
.
MouseInput
.
Event
==
EMIE_LMOUSE_PRESSED_DOWN
)
if
(
event
.
MouseInput
.
Event
==
EMIE_LMOUSE_PRESSED_DOWN
)
{
{
if
(
Environment
->
hasFocus
(
this
)
&&
if
(
Environment
->
hasFocus
(
this
)
&&
!
AbsoluteClippingRect
.
isPointInside
(
core
::
position
2d
<
s32
>
(
event
.
MouseInput
.
X
,
event
.
MouseInput
.
Y
)))
!
AbsoluteClippingRect
.
isPointInside
(
core
::
vector
2d
<
s32
>
(
event
.
MouseInput
.
X
,
event
.
MouseInput
.
Y
)))
{
{
Environment
->
removeFocus
(
this
);
Environment
->
removeFocus
(
this
);
return
false
;
return
false
;
...
@@ -272,7 +272,7 @@ bool CGUIImageButton::OnEvent(const SEvent& event)
...
@@ -272,7 +272,7 @@ bool CGUIImageButton::OnEvent(const SEvent& event)
{
{
bool
wasPressed
=
Pressed
;
bool
wasPressed
=
Pressed
;
if
(
!
AbsoluteClippingRect
.
isPointInside
(
core
::
position
2d
<
s32
>
(
event
.
MouseInput
.
X
,
event
.
MouseInput
.
Y
)))
if
(
!
AbsoluteClippingRect
.
isPointInside
(
core
::
vector
2d
<
s32
>
(
event
.
MouseInput
.
X
,
event
.
MouseInput
.
Y
)))
{
{
if
(
!
IsPushButton
)
if
(
!
IsPushButton
)
setPressed
(
false
);
setPressed
(
false
);
...
@@ -313,8 +313,8 @@ void CGUIImageButton::draw() {
...
@@ -313,8 +313,8 @@ void CGUIImageButton::draw() {
return
;
return
;
IGUISkin
*
skin
=
Environment
->
getSkin
();
IGUISkin
*
skin
=
Environment
->
getSkin
();
video
::
IVideoDriver
*
driver
=
Environment
->
getVideoDriver
();
video
::
IVideoDriver
*
driver
=
Environment
->
getVideoDriver
();
core
::
position
2di
center
=
AbsoluteRect
.
getCenter
();
core
::
vector
2di
center
=
AbsoluteRect
.
getCenter
();
core
::
position
2di
pos
=
center
;
core
::
vector
2di
pos
=
center
;
pos
.
X
-=
(
s32
)(
ImageRect
.
getWidth
()
*
imageScale
.
X
*
0.5
f
);
pos
.
X
-=
(
s32
)(
ImageRect
.
getWidth
()
*
imageScale
.
X
*
0.5
f
);
pos
.
Y
-=
(
s32
)(
ImageRect
.
getHeight
()
*
imageScale
.
Y
*
0.5
f
);
pos
.
Y
-=
(
s32
)(
ImageRect
.
getHeight
()
*
imageScale
.
Y
*
0.5
f
);
if
(
Pressed
)
{
if
(
Pressed
)
{
...
@@ -341,7 +341,7 @@ void CGUIImageButton::setImage(video::ITexture* image)
...
@@ -341,7 +341,7 @@ void CGUIImageButton::setImage(video::ITexture* image)
Image
=
image
;
Image
=
image
;
if
(
image
)
{
if
(
image
)
{
ImageRect
=
core
::
rect
<
s32
>
(
core
::
position
2d
<
s32
>
(
0
,
0
),
image
->
getOriginalSize
());
ImageRect
=
core
::
rect
<
s32
>
(
core
::
vector
2d
<
s32
>
(
0
,
0
),
image
->
getOriginalSize
());
if
(
isFixedSize
)
if
(
isFixedSize
)
imageScale
=
core
::
vector2df
((
irr
::
f32
)
imageSize
.
Width
/
image
->
getSize
().
Width
,
(
irr
::
f32
)
imageSize
.
Height
/
image
->
getSize
().
Height
);
imageScale
=
core
::
vector2df
((
irr
::
f32
)
imageSize
.
Width
/
image
->
getSize
().
Width
,
(
irr
::
f32
)
imageSize
.
Height
/
image
->
getSize
().
Height
);
}
}
...
@@ -413,7 +413,7 @@ void CGUIImageButton::setPressedImage(video::ITexture* image)
...
@@ -413,7 +413,7 @@ void CGUIImageButton::setPressedImage(video::ITexture* image)
PressedImage
=
image
;
PressedImage
=
image
;
if
(
image
)
if
(
image
)
PressedImageRect
=
core
::
rect
<
s32
>
(
core
::
position
2d
<
s32
>
(
0
,
0
),
image
->
getOriginalSize
());
PressedImageRect
=
core
::
rect
<
s32
>
(
core
::
vector
2d
<
s32
>
(
0
,
0
),
image
->
getOriginalSize
());
}
}
...
...
gframe/CGUIImageButton.h
View file @
bcab56c4
...
@@ -20,10 +20,10 @@ namespace gui {
...
@@ -20,10 +20,10 @@ namespace gui {
class
IGUISpriteBank
;
class
IGUISpriteBank
;
void
Draw2DImageRotation
(
video
::
IVideoDriver
*
driver
,
video
::
ITexture
*
image
,
core
::
rect
<
s32
>
sourceRect
,
void
Draw2DImageRotation
(
video
::
IVideoDriver
*
driver
,
video
::
ITexture
*
image
,
core
::
rect
<
s32
>
sourceRect
,
core
::
position2d
<
s32
>
position
,
core
::
position
2d
<
s32
>
rotationPoint
,
f32
rotation
=
0.0
f
,
core
::
vector2d
<
s32
>
position
,
core
::
vector
2d
<
s32
>
rotationPoint
,
f32
rotation
=
0.0
f
,
core
::
vector2df
scale
=
core
::
vector2df
(
1.0
,
1.0
),
bool
useAlphaChannel
=
true
,
video
::
SColor
color
=
0xffffffff
);
core
::
vector2df
scale
=
core
::
vector2df
(
1.0
,
1.0
),
bool
useAlphaChannel
=
true
,
video
::
SColor
color
=
0xffffffff
);
void
Draw2DImageQuad
(
video
::
IVideoDriver
*
driver
,
video
::
ITexture
*
image
,
core
::
rect
<
s32
>
sourceRect
,
void
Draw2DImageQuad
(
video
::
IVideoDriver
*
driver
,
video
::
ITexture
*
image
,
core
::
rect
<
s32
>
sourceRect
,
core
::
position
2d
<
s32
>
corner
[
4
],
bool
useAlphaChannel
=
true
,
video
::
SColor
color
=
0xffffffff
);
core
::
vector
2d
<
s32
>
corner
[
4
],
bool
useAlphaChannel
=
true
,
video
::
SColor
color
=
0xffffffff
);
class
CGUIImageButton
:
public
IGUIButton
{
class
CGUIImageButton
:
public
IGUIButton
{
public:
public:
...
...
gframe/CGUITTFont.cpp
View file @
bcab56c4
...
@@ -505,7 +505,7 @@ void CGUITTFont::drawUstring(const core::ustring& utext, const core::rect<s32>&p
...
@@ -505,7 +505,7 @@ void CGUITTFont::drawUstring(const core::ustring& utext, const core::rect<s32>&p
// Set up some variables.
// Set up some variables.
core
::
dimension2d
<
s32
>
textDimension
;
core
::
dimension2d
<
s32
>
textDimension
;
core
::
position
2d
<
s32
>
offset
=
position
.
UpperLeftCorner
;
core
::
vector
2d
<
s32
>
offset
=
position
.
UpperLeftCorner
;
// Determine offset positions.
// Determine offset positions.
if
(
hcenter
||
vcenter
)
{
if
(
hcenter
||
vcenter
)
{
...
@@ -561,7 +561,7 @@ void CGUITTFont::drawUstring(const core::ustring& utext, const core::rect<s32>&p
...
@@ -561,7 +561,7 @@ void CGUITTFont::drawUstring(const core::ustring& utext, const core::rect<s32>&p
// Determine rendering information.
// Determine rendering information.
SGUITTGlyph
&
glyph
=
Glyphs
[
n
-
1
];
SGUITTGlyph
&
glyph
=
Glyphs
[
n
-
1
];
CGUITTGlyphPage
*
const
page
=
Glyph_Pages
[
glyph
.
glyph_page
];
CGUITTGlyphPage
*
const
page
=
Glyph_Pages
[
glyph
.
glyph_page
];
page
->
render_positions
.
push_back
(
core
::
position
2di
(
offset
.
X
+
offx
,
offset
.
Y
+
offy
));
page
->
render_positions
.
push_back
(
core
::
vector
2di
(
offset
.
X
+
offx
,
offset
.
Y
+
offy
));
page
->
render_source_rects
.
push_back
(
glyph
.
source_rect
);
page
->
render_source_rects
.
push_back
(
glyph
.
source_rect
);
Render_Map
.
set
(
glyph
.
glyph_page
,
page
);
Render_Map
.
set
(
glyph
.
glyph_page
,
page
);
}
}
...
@@ -832,7 +832,7 @@ video::IImage* CGUITTFont::createTextureFromChar(const uchar32_t& ch) {
...
@@ -832,7 +832,7 @@ video::IImage* CGUITTFont::createTextureFromChar(const uchar32_t& ch) {
// Copy the image data out of the page texture.
// Copy the image data out of the page texture.
core
::
dimension2du
glyph_size
(
glyph
.
source_rect
.
getSize
());
core
::
dimension2du
glyph_size
(
glyph
.
source_rect
.
getSize
());
video
::
IImage
*
image
=
Driver
->
createImage
(
format
,
glyph_size
);
video
::
IImage
*
image
=
Driver
->
createImage
(
format
,
glyph_size
);
pageholder
->
copyTo
(
image
,
core
::
position
2di
(
0
,
0
),
glyph
.
source_rect
);
pageholder
->
copyTo
(
image
,
core
::
vector
2di
(
0
,
0
),
glyph
.
source_rect
);
tex
->
unlock
();
tex
->
unlock
();
return
image
;
return
image
;
...
...
gframe/client_field.cpp
View file @
bcab56c4
...
@@ -148,6 +148,16 @@ void ClientField::Initial(int player, int deckc, int extrac) {
...
@@ -148,6 +148,16 @@ void ClientField::Initial(int player, int deckc, int extrac) {
}
}
RefreshCardCountDisplay
();
RefreshCardCountDisplay
();
}
}
void
ClientField
::
ResetSequence
(
std
::
vector
<
ClientCard
*>&
list
,
bool
reset_height
)
{
unsigned
char
seq
=
0
;
for
(
auto
&
pcard
:
list
)
{
pcard
->
sequence
=
seq
++
;
if
(
reset_height
)
{
pcard
->
curPos
.
Z
=
0.01
f
+
0.01
f
*
pcard
->
sequence
;
pcard
->
mTransform
.
setTranslation
(
pcard
->
curPos
);
}
}
}
ClientCard
*
ClientField
::
GetCard
(
int
controler
,
int
location
,
int
sequence
,
int
sub_seq
)
{
ClientCard
*
ClientField
::
GetCard
(
int
controler
,
int
location
,
int
sequence
,
int
sub_seq
)
{
std
::
vector
<
ClientCard
*>*
lst
=
0
;
std
::
vector
<
ClientCard
*>*
lst
=
0
;
bool
is_xyz
=
(
location
&
LOCATION_OVERLAY
)
!=
0
;
bool
is_xyz
=
(
location
&
LOCATION_OVERLAY
)
!=
0
;
...
@@ -199,16 +209,10 @@ void ClientField::AddCard(ClientCard* pcard, int controler, int location, int se
...
@@ -199,16 +209,10 @@ void ClientField::AddCard(ClientCard* pcard, int controler, int location, int se
case
LOCATION_DECK
:
{
case
LOCATION_DECK
:
{
if
(
sequence
!=
0
||
deck
[
controler
].
size
()
==
0
)
{
if
(
sequence
!=
0
||
deck
[
controler
].
size
()
==
0
)
{
deck
[
controler
].
push_back
(
pcard
);
deck
[
controler
].
push_back
(
pcard
);
pcard
->
sequence
=
(
unsigned
char
)(
deck
[
controler
].
size
()
-
1
);
}
else
{
}
else
{
deck
[
controler
].
push_back
(
0
);
deck
[
controler
].
insert
(
deck
[
controler
].
begin
(),
pcard
);
for
(
int
i
=
deck
[
controler
].
size
()
-
1
;
i
>
0
;
--
i
)
{
deck
[
controler
][
i
]
=
deck
[
controler
][
i
-
1
];
deck
[
controler
][
i
]
->
sequence
++
;
}
deck
[
controler
][
0
]
=
pcard
;
pcard
->
sequence
=
0
;
}
}
ResetSequence
(
deck
[
controler
],
true
);
pcard
->
is_reversed
=
false
;
pcard
->
is_reversed
=
false
;
pcard
->
ClearData
();
pcard
->
ClearData
();
pcard
->
ClearTarget
();
pcard
->
ClearTarget
();
...
@@ -217,7 +221,7 @@ void ClientField::AddCard(ClientCard* pcard, int controler, int location, int se
...
@@ -217,7 +221,7 @@ void ClientField::AddCard(ClientCard* pcard, int controler, int location, int se
}
}
case
LOCATION_HAND
:
{
case
LOCATION_HAND
:
{
hand
[
controler
].
push_back
(
pcard
);
hand
[
controler
].
push_back
(
pcard
);
pcard
->
sequence
=
(
unsigned
char
)(
hand
[
controler
].
size
()
-
1
);
ResetSequence
(
hand
[
controler
],
false
);
break
;
break
;
}
}
case
LOCATION_MZONE
:
{
case
LOCATION_MZONE
:
{
...
@@ -230,30 +234,22 @@ void ClientField::AddCard(ClientCard* pcard, int controler, int location, int se
...
@@ -230,30 +234,22 @@ void ClientField::AddCard(ClientCard* pcard, int controler, int location, int se
}
}
case
LOCATION_GRAVE
:
{
case
LOCATION_GRAVE
:
{
grave
[
controler
].
push_back
(
pcard
);
grave
[
controler
].
push_back
(
pcard
);
pcard
->
sequence
=
(
unsigned
char
)(
grave
[
controler
].
size
()
-
1
);
ResetSequence
(
grave
[
controler
],
false
);
break
;
break
;
}
}
case
LOCATION_REMOVED
:
{
case
LOCATION_REMOVED
:
{
remove
[
controler
].
push_back
(
pcard
);
remove
[
controler
].
push_back
(
pcard
);
pcard
->
sequence
=
(
unsigned
char
)(
remove
[
controler
].
size
()
-
1
);
ResetSequence
(
remove
[
controler
],
false
);
break
;
break
;
}
}
case
LOCATION_EXTRA
:
{
case
LOCATION_EXTRA
:
{
if
(
extra_p_count
[
controler
]
==
0
||
(
pcard
->
position
&
POS_FACEUP
))
{
if
(
extra_p_count
[
controler
]
==
0
||
(
pcard
->
position
&
POS_FACEUP
))
{
extra
[
controler
].
push_back
(
pcard
);
extra
[
controler
].
push_back
(
pcard
);
pcard
->
sequence
=
(
unsigned
char
)(
extra
[
controler
].
size
()
-
1
);
}
else
{
}
else
{
extra
[
controler
].
push_back
(
0
);
size_t
faceup_begin
=
extra
[
controler
].
size
()
-
extra_p_count
[
controler
];
int
p
=
extra
[
controler
].
size
()
-
extra_p_count
[
controler
]
-
1
;
extra
[
controler
].
insert
(
extra
[
controler
].
begin
()
+
faceup_begin
,
pcard
);
for
(
int
i
=
extra
[
controler
].
size
()
-
1
;
i
>
p
;
--
i
)
{
extra
[
controler
][
i
]
=
extra
[
controler
][
i
-
1
];
extra
[
controler
][
i
]
->
sequence
++
;
extra
[
controler
][
i
]
->
curPos
+=
irr
::
core
::
vector3df
(
0
,
0
,
0.01
f
);
extra
[
controler
][
i
]
->
mTransform
.
setTranslation
(
extra
[
controler
][
i
]
->
curPos
);
}
extra
[
controler
][
p
]
=
pcard
;
pcard
->
sequence
=
p
;
}
}
ResetSequence
(
extra
[
controler
],
true
);
if
(
pcard
->
position
&
POS_FACEUP
)
if
(
pcard
->
position
&
POS_FACEUP
)
extra_p_count
[
controler
]
++
;
extra_p_count
[
controler
]
++
;
break
;
break
;
...
@@ -262,73 +258,52 @@ void ClientField::AddCard(ClientCard* pcard, int controler, int location, int se
...
@@ -262,73 +258,52 @@ void ClientField::AddCard(ClientCard* pcard, int controler, int location, int se
RefreshCardCountDisplay
();
RefreshCardCountDisplay
();
}
}
ClientCard
*
ClientField
::
RemoveCard
(
int
controler
,
int
location
,
int
sequence
)
{
ClientCard
*
ClientField
::
RemoveCard
(
int
controler
,
int
location
,
int
sequence
)
{
ClientCard
*
pcard
=
0
;
ClientCard
*
pcard
=
nullptr
;
switch
(
location
)
{
switch
(
location
)
{
case
LOCATION_DECK
:
{
case
LOCATION_DECK
:
{
pcard
=
deck
[
controler
][
sequence
];
pcard
=
deck
[
controler
][
sequence
];
for
(
size_t
i
=
sequence
;
i
<
deck
[
controler
].
size
()
-
1
;
++
i
)
{
deck
[
controler
].
erase
(
deck
[
controler
].
begin
()
+
sequence
);
deck
[
controler
][
i
]
=
deck
[
controler
][
i
+
1
];
ResetSequence
(
deck
[
controler
],
true
);
deck
[
controler
][
i
]
->
sequence
--
;
deck
[
controler
][
i
]
->
curPos
-=
irr
::
core
::
vector3df
(
0
,
0
,
0.01
f
);
deck
[
controler
][
i
]
->
mTransform
.
setTranslation
(
deck
[
controler
][
i
]
->
curPos
);
}
deck
[
controler
].
erase
(
deck
[
controler
].
end
()
-
1
);
break
;
break
;
}
}
case
LOCATION_HAND
:
{
case
LOCATION_HAND
:
{
pcard
=
hand
[
controler
][
sequence
];
pcard
=
hand
[
controler
][
sequence
];
for
(
size_t
i
=
sequence
;
i
<
hand
[
controler
].
size
()
-
1
;
++
i
)
{
hand
[
controler
].
erase
(
hand
[
controler
].
begin
()
+
sequence
);
hand
[
controler
][
i
]
=
hand
[
controler
][
i
+
1
];
ResetSequence
(
hand
[
controler
],
false
);
hand
[
controler
][
i
]
->
sequence
--
;
}
hand
[
controler
].
erase
(
hand
[
controler
].
end
()
-
1
);
break
;
break
;
}
}
case
LOCATION_MZONE
:
{
case
LOCATION_MZONE
:
{
pcard
=
mzone
[
controler
][
sequence
];
pcard
=
mzone
[
controler
][
sequence
];
mzone
[
controler
][
sequence
]
=
0
;
mzone
[
controler
][
sequence
]
=
nullptr
;
break
;
break
;
}
}
case
LOCATION_SZONE
:
{
case
LOCATION_SZONE
:
{
pcard
=
szone
[
controler
][
sequence
];
pcard
=
szone
[
controler
][
sequence
];
szone
[
controler
][
sequence
]
=
0
;
szone
[
controler
][
sequence
]
=
nullptr
;
break
;
break
;
}
}
case
LOCATION_GRAVE
:
{
case
LOCATION_GRAVE
:
{
pcard
=
grave
[
controler
][
sequence
];
pcard
=
grave
[
controler
][
sequence
];
for
(
size_t
i
=
sequence
;
i
<
grave
[
controler
].
size
()
-
1
;
++
i
)
{
grave
[
controler
].
erase
(
grave
[
controler
].
begin
()
+
sequence
);
grave
[
controler
][
i
]
=
grave
[
controler
][
i
+
1
];
ResetSequence
(
grave
[
controler
],
true
);
grave
[
controler
][
i
]
->
sequence
--
;
grave
[
controler
][
i
]
->
curPos
-=
irr
::
core
::
vector3df
(
0
,
0
,
0.01
f
);
grave
[
controler
][
i
]
->
mTransform
.
setTranslation
(
grave
[
controler
][
i
]
->
curPos
);
}
grave
[
controler
].
erase
(
grave
[
controler
].
end
()
-
1
);
break
;
break
;
}
}
case
LOCATION_REMOVED
:
{
case
LOCATION_REMOVED
:
{
pcard
=
remove
[
controler
][
sequence
];
pcard
=
remove
[
controler
][
sequence
];
for
(
size_t
i
=
sequence
;
i
<
remove
[
controler
].
size
()
-
1
;
++
i
)
{
remove
[
controler
].
erase
(
remove
[
controler
].
begin
()
+
sequence
);
remove
[
controler
][
i
]
=
remove
[
controler
][
i
+
1
];
ResetSequence
(
remove
[
controler
],
true
);
remove
[
controler
][
i
]
->
sequence
--
;
remove
[
controler
][
i
]
->
curPos
-=
irr
::
core
::
vector3df
(
0
,
0
,
0.01
f
);
remove
[
controler
][
i
]
->
mTransform
.
setTranslation
(
remove
[
controler
][
i
]
->
curPos
);
}
remove
[
controler
].
erase
(
remove
[
controler
].
end
()
-
1
);
break
;
break
;
}
}
case
LOCATION_EXTRA
:
{
case
LOCATION_EXTRA
:
{
pcard
=
extra
[
controler
][
sequence
];
pcard
=
extra
[
controler
][
sequence
];
for
(
size_t
i
=
sequence
;
i
<
extra
[
controler
].
size
()
-
1
;
++
i
)
{
extra
[
controler
].
erase
(
extra
[
controler
].
begin
()
+
sequence
);
extra
[
controler
][
i
]
=
extra
[
controler
][
i
+
1
];
ResetSequence
(
extra
[
controler
],
true
);
extra
[
controler
][
i
]
->
sequence
--
;
extra
[
controler
][
i
]
->
curPos
-=
irr
::
core
::
vector3df
(
0
,
0
,
0.01
f
);
extra
[
controler
][
i
]
->
mTransform
.
setTranslation
(
extra
[
controler
][
i
]
->
curPos
);
}
extra
[
controler
].
erase
(
extra
[
controler
].
end
()
-
1
);
if
(
pcard
->
position
&
POS_FACEUP
)
if
(
pcard
->
position
&
POS_FACEUP
)
extra_p_count
[
controler
]
--
;
extra_p_count
[
controler
]
--
;
break
;
break
;
}
}
default:
return
nullptr
;
}
}
pcard
->
location
=
0
;
pcard
->
location
=
0
;
RefreshCardCountDisplay
();
RefreshCardCountDisplay
();
...
...
gframe/client_field.h
View file @
bcab56c4
...
@@ -98,6 +98,7 @@ public:
...
@@ -98,6 +98,7 @@ public:
~
ClientField
();
~
ClientField
();
void
Clear
();
void
Clear
();
void
Initial
(
int
player
,
int
deckc
,
int
extrac
);
void
Initial
(
int
player
,
int
deckc
,
int
extrac
);
void
ResetSequence
(
std
::
vector
<
ClientCard
*>&
list
,
bool
reset_height
);
ClientCard
*
GetCard
(
int
controler
,
int
location
,
int
sequence
,
int
sub_seq
=
0
);
ClientCard
*
GetCard
(
int
controler
,
int
location
,
int
sequence
,
int
sub_seq
=
0
);
void
AddCard
(
ClientCard
*
pcard
,
int
controler
,
int
location
,
int
sequence
);
void
AddCard
(
ClientCard
*
pcard
,
int
controler
,
int
location
,
int
sequence
);
ClientCard
*
RemoveCard
(
int
controler
,
int
location
,
int
sequence
);
ClientCard
*
RemoveCard
(
int
controler
,
int
location
,
int
sequence
);
...
...
gframe/config.h
View file @
bcab56c4
...
@@ -3,6 +3,9 @@
...
@@ -3,6 +3,9 @@
#define _IRR_STATIC_LIB_
#define _IRR_STATIC_LIB_
#define IRR_COMPILE_WITH_DX9_DEV_PACK
#define IRR_COMPILE_WITH_DX9_DEV_PACK
#include <cerrno>
#ifdef _WIN32
#ifdef _WIN32
#define NOMINMAX
#define NOMINMAX
...
@@ -22,7 +25,6 @@
...
@@ -22,7 +25,6 @@
#else //_WIN32
#else //_WIN32
#include <errno.h>
#include <netinet/in.h>
#include <netinet/in.h>
#include <sys/socket.h>
#include <sys/socket.h>
#include <sys/ioctl.h>
#include <sys/ioctl.h>
...
...
gframe/data_manager.cpp
View file @
bcab56c4
...
@@ -437,7 +437,9 @@ unsigned char* DataManager::ReadScriptFromIrrFS(const char* script_name, int* sl
...
@@ -437,7 +437,9 @@ unsigned char* DataManager::ReadScriptFromIrrFS(const char* script_name, int* sl
return
scriptBuffer
;
return
scriptBuffer
;
}
}
unsigned
char
*
DataManager
::
ReadScriptFromFile
(
const
char
*
script_name
,
int
*
slen
)
{
unsigned
char
*
DataManager
::
ReadScriptFromFile
(
const
char
*
script_name
,
int
*
slen
)
{
FILE
*
fp
=
std
::
fopen
(
script_name
,
"rb"
);
wchar_t
fname
[
256
]{};
BufferIO
::
DecodeUTF8
(
script_name
,
fname
);
FILE
*
fp
=
mywfopen
(
fname
,
"rb"
);
if
(
!
fp
)
if
(
!
fp
)
return
nullptr
;
return
nullptr
;
size_t
len
=
std
::
fread
(
scriptBuffer
,
1
,
sizeof
scriptBuffer
,
fp
);
size_t
len
=
std
::
fread
(
scriptBuffer
,
1
,
sizeof
scriptBuffer
,
fp
);
...
...
gframe/deck_con.cpp
View file @
bcab56c4
...
@@ -1267,7 +1267,7 @@ void DeckBuilder::GetHoveredCard() {
...
@@ -1267,7 +1267,7 @@ void DeckBuilder::GetHoveredCard() {
irr
::
gui
::
IGUIElement
*
root
=
mainGame
->
env
->
getRootGUIElement
();
irr
::
gui
::
IGUIElement
*
root
=
mainGame
->
env
->
getRootGUIElement
();
if
(
root
->
getElementFromPoint
(
mouse_pos
)
!=
root
)
if
(
root
->
getElementFromPoint
(
mouse_pos
)
!=
root
)
return
;
return
;
position
2di
pos
=
mainGame
->
ResizeReverse
(
mouse_pos
.
X
,
mouse_pos
.
Y
);
irr
::
core
::
vector
2di
pos
=
mainGame
->
ResizeReverse
(
mouse_pos
.
X
,
mouse_pos
.
Y
);
int
x
=
pos
.
X
;
int
x
=
pos
.
X
;
int
y
=
pos
.
Y
;
int
y
=
pos
.
Y
;
is_lastcard
=
0
;
is_lastcard
=
0
;
...
...
gframe/deck_con.h
View file @
bcab56c4
#ifndef DECK_CON_H
#ifndef DECK_CON_H
#define DECK_CON_H
#define DECK_CON_H
#include "config.h"
#include <unordered_map>
#include <unordered_map>
#include <vector>
#include <vector>
#include <irrlicht.h>
#include "data_manager.h"
#include "data_manager.h"
#include "../ocgcore/mtrandom.h"
#include "../ocgcore/mtrandom.h"
...
@@ -28,7 +28,7 @@ public:
...
@@ -28,7 +28,7 @@ public:
void
ChangeCategory
(
int
catesel
);
void
ChangeCategory
(
int
catesel
);
void
ShowDeckManage
();
void
ShowDeckManage
();
void
ShowBigCard
(
int
code
,
float
zoom
);
void
ShowBigCard
(
int
code
,
float
zoom
);
void
ZoomBigCard
(
s32
centerx
=
-
1
,
s32
centery
=
-
1
);
void
ZoomBigCard
(
irr
::
s32
centerx
=
-
1
,
irr
::
s32
centery
=
-
1
);
void
CloseBigCard
();
void
CloseBigCard
();
bool
CardNameContains
(
const
wchar_t
*
haystack
,
const
wchar_t
*
needle
);
bool
CardNameContains
(
const
wchar_t
*
haystack
,
const
wchar_t
*
needle
);
...
@@ -56,7 +56,7 @@ public:
...
@@ -56,7 +56,7 @@ public:
unsigned
int
filter_scl
{};
unsigned
int
filter_scl
{};
unsigned
int
filter_marks
{};
unsigned
int
filter_marks
{};
int
filter_lm
{};
int
filter_lm
{};
position
2di
mouse_pos
;
irr
::
core
::
vector
2di
mouse_pos
;
int
hovered_code
{};
int
hovered_code
{};
int
hovered_pos
{};
int
hovered_pos
{};
int
hovered_seq
{
-
1
};
int
hovered_seq
{
-
1
};
...
@@ -74,7 +74,7 @@ public:
...
@@ -74,7 +74,7 @@ public:
code_pointer
draging_pointer
;
code_pointer
draging_pointer
;
int
prev_category
{};
int
prev_category
{};
int
prev_deck
{};
int
prev_deck
{};
s32
prev_operation
{};
irr
::
s32
prev_operation
{};
int
prev_sel
{
-
1
};
int
prev_sel
{
-
1
};
bool
is_modified
{};
bool
is_modified
{};
bool
readonly
{};
bool
readonly
{};
...
...
gframe/deck_manager.cpp
View file @
bcab56c4
...
@@ -15,7 +15,7 @@ void DeckManager::LoadLFListSingle(const char* path) {
...
@@ -15,7 +15,7 @@ void DeckManager::LoadLFListSingle(const char* path) {
char
linebuf
[
256
]{};
char
linebuf
[
256
]{};
wchar_t
strBuffer
[
256
]{};
wchar_t
strBuffer
[
256
]{};
if
(
fp
)
{
if
(
fp
)
{
while
(
std
::
fgets
(
linebuf
,
256
,
fp
))
{
while
(
std
::
fgets
(
linebuf
,
sizeof
linebuf
,
fp
))
{
if
(
linebuf
[
0
]
==
'#'
)
if
(
linebuf
[
0
]
==
'#'
)
continue
;
continue
;
if
(
linebuf
[
0
]
==
'!'
)
{
if
(
linebuf
[
0
]
==
'!'
)
{
...
@@ -29,16 +29,16 @@ void DeckManager::LoadLFListSingle(const char* path) {
...
@@ -29,16 +29,16 @@ void DeckManager::LoadLFListSingle(const char* path) {
cur
=
_lfList
.
rbegin
();
cur
=
_lfList
.
rbegin
();
continue
;
continue
;
}
}
if
(
cur
==
_lfList
.
rend
())
continue
;
int
code
=
0
;
int
code
=
0
;
int
count
=
-
1
;
int
count
=
-
1
;
if
(
std
::
sscanf
(
linebuf
,
"%
d %
d"
,
&
code
,
&
count
)
!=
2
)
if
(
std
::
sscanf
(
linebuf
,
"%
9d%*[ ]%9
d"
,
&
code
,
&
count
)
!=
2
)
continue
;
continue
;
if
(
code
<=
0
||
code
>
MAX_CARD_ID
)
if
(
code
<=
0
||
code
>
MAX_CARD_ID
)
continue
;
continue
;
if
(
count
<
0
||
count
>
2
)
if
(
count
<
0
||
count
>
2
)
continue
;
continue
;
if
(
cur
==
_lfList
.
rend
())
continue
;
unsigned
int
hcode
=
code
;
unsigned
int
hcode
=
code
;
cur
->
content
[
code
]
=
count
;
cur
->
content
[
code
]
=
count
;
cur
->
hash
=
cur
->
hash
^
((
hcode
<<
18
)
|
(
hcode
>>
14
))
^
((
hcode
<<
(
27
+
count
))
|
(
hcode
>>
(
5
-
count
)));
cur
->
hash
=
cur
->
hash
^
((
hcode
<<
18
)
|
(
hcode
>>
14
))
^
((
hcode
<<
(
27
+
count
))
|
(
hcode
>>
(
5
-
count
)));
...
@@ -188,25 +188,29 @@ int DeckManager::LoadDeck(Deck& deck, int* dbuf, int mainc, int sidec, bool is_p
...
@@ -188,25 +188,29 @@ int DeckManager::LoadDeck(Deck& deck, int* dbuf, int mainc, int sidec, bool is_p
return
errorcode
;
return
errorcode
;
}
}
int
DeckManager
::
LoadDeck
(
Deck
&
deck
,
std
::
istringstream
&
deckStream
,
bool
is_packlist
)
{
int
DeckManager
::
LoadDeck
(
Deck
&
deck
,
std
::
istringstream
&
deckStream
,
bool
is_packlist
)
{
int
ct
=
0
,
mainc
=
0
,
sidec
=
0
,
code
=
0
;
size_t
ct
=
0
;
int
mainc
=
0
,
sidec
=
0
,
code
=
0
;
int
cardlist
[
PACK_MAX_SIZE
]{};
int
cardlist
[
PACK_MAX_SIZE
]{};
bool
is_side
=
false
;
bool
is_side
=
false
;
std
::
string
linebuf
;
std
::
string
linebuf
;
while
(
std
::
getline
(
deckStream
,
linebuf
,
'\n'
)
&&
ct
<
(
int
)(
sizeof
cardlist
/
sizeof
cardlist
[
0
]))
{
while
(
std
::
getline
(
deckStream
,
linebuf
,
'\n'
)
&&
ct
<
(
sizeof
cardlist
/
sizeof
cardlist
[
0
]))
{
if
(
linebuf
[
0
]
==
'!'
)
{
if
(
linebuf
[
0
]
==
'!'
)
{
is_side
=
true
;
is_side
=
true
;
continue
;
continue
;
}
}
if
(
linebuf
[
0
]
<
'0'
||
linebuf
[
0
]
>
'9'
)
if
(
linebuf
[
0
]
<
'0'
||
linebuf
[
0
]
>
'9'
)
continue
;
continue
;
code
=
std
::
stoi
(
linebuf
);
errno
=
0
;
code
=
strtol
(
linebuf
.
c_str
(),
nullptr
,
10
);
if
(
errno
==
ERANGE
)
continue
;
cardlist
[
ct
++
]
=
code
;
cardlist
[
ct
++
]
=
code
;
if
(
is_side
)
if
(
is_side
)
++
sidec
;
++
sidec
;
else
else
++
mainc
;
++
mainc
;
}
}
return
LoadDeck
(
current_
deck
,
cardlist
,
mainc
,
sidec
,
is_packlist
);
return
LoadDeck
(
deck
,
cardlist
,
mainc
,
sidec
,
is_packlist
);
}
}
bool
DeckManager
::
LoadSide
(
Deck
&
deck
,
int
*
dbuf
,
int
mainc
,
int
sidec
)
{
bool
DeckManager
::
LoadSide
(
Deck
&
deck
,
int
*
dbuf
,
int
mainc
,
int
sidec
)
{
std
::
unordered_map
<
int
,
int
>
pcount
;
std
::
unordered_map
<
int
,
int
>
pcount
;
...
...
gframe/deck_manager.h
View file @
bcab56c4
...
@@ -38,7 +38,7 @@ struct Deck {
...
@@ -38,7 +38,7 @@ struct Deck {
std
::
vector
<
code_pointer
>
main
;
std
::
vector
<
code_pointer
>
main
;
std
::
vector
<
code_pointer
>
extra
;
std
::
vector
<
code_pointer
>
extra
;
std
::
vector
<
code_pointer
>
side
;
std
::
vector
<
code_pointer
>
side
;
Deck
()
{}
Deck
()
=
default
;
Deck
(
const
Deck
&
ndeck
)
{
Deck
(
const
Deck
&
ndeck
)
{
main
=
ndeck
.
main
;
main
=
ndeck
.
main
;
extra
=
ndeck
.
extra
;
extra
=
ndeck
.
extra
;
...
...
gframe/drawing.cpp
View file @
bcab56c4
...
@@ -947,15 +947,15 @@ void Game::DrawSpec() {
...
@@ -947,15 +947,15 @@ void Game::DrawSpec() {
float
mul
=
xScale
;
float
mul
=
xScale
;
if
(
xScale
>
yScale
)
if
(
xScale
>
yScale
)
mul
=
yScale
;
mul
=
yScale
;
core
::
position
2d
<
s32
>
corner
[
4
];
irr
::
core
::
vector
2d
<
s32
>
corner
[
4
];
float
y
=
sin
(
showcarddif
*
3.1415926
f
/
180.0
f
)
*
CARD_IMG_HEIGHT
*
mul
;
float
y
=
sin
(
showcarddif
*
3.1415926
f
/
180.0
f
)
*
CARD_IMG_HEIGHT
*
mul
;
s32
winx
=
midx
*
xScale
+
(
574
-
midx
)
*
mul
;
s32
winx
=
midx
*
xScale
+
(
574
-
midx
)
*
mul
;
s32
winx2
=
midx
*
xScale
+
(
751
-
midx
)
*
mul
;
s32
winx2
=
midx
*
xScale
+
(
751
-
midx
)
*
mul
;
s32
winy
=
midy
*
yScale
+
(
404
-
midy
)
*
mul
;
s32
winy
=
midy
*
yScale
+
(
404
-
midy
)
*
mul
;
corner
[
0
]
=
core
::
position
2d
<
s32
>
(
winx
-
(
CARD_IMG_HEIGHT
*
mul
-
y
)
*
0.3
f
,
winy
-
y
);
corner
[
0
]
=
irr
::
core
::
vector
2d
<
s32
>
(
winx
-
(
CARD_IMG_HEIGHT
*
mul
-
y
)
*
0.3
f
,
winy
-
y
);
corner
[
1
]
=
core
::
position
2d
<
s32
>
(
winx2
+
(
CARD_IMG_HEIGHT
*
mul
-
y
)
*
0.3
f
,
winy
-
y
);
corner
[
1
]
=
irr
::
core
::
vector
2d
<
s32
>
(
winx2
+
(
CARD_IMG_HEIGHT
*
mul
-
y
)
*
0.3
f
,
winy
-
y
);
corner
[
2
]
=
core
::
position
2d
<
s32
>
(
winx
,
winy
);
corner
[
2
]
=
irr
::
core
::
vector
2d
<
s32
>
(
winx
,
winy
);
corner
[
3
]
=
core
::
position
2d
<
s32
>
(
winx2
,
winy
);
corner
[
3
]
=
irr
::
core
::
vector
2d
<
s32
>
(
winx2
,
winy
);
irr
::
gui
::
Draw2DImageQuad
(
driver
,
imageManager
.
GetTexture
(
showcardcode
,
true
),
ResizeFit
(
0
,
0
,
CARD_IMG_WIDTH
,
CARD_IMG_HEIGHT
),
corner
);
irr
::
gui
::
Draw2DImageQuad
(
driver
,
imageManager
.
GetTexture
(
showcardcode
,
true
),
ResizeFit
(
0
,
0
,
CARD_IMG_WIDTH
,
CARD_IMG_HEIGHT
),
corner
);
showcardp
++
;
showcardp
++
;
showcarddif
+=
9
;
showcarddif
+=
9
;
...
@@ -969,8 +969,8 @@ void Game::DrawSpec() {
...
@@ -969,8 +969,8 @@ void Game::DrawSpec() {
}
}
case
100
:
{
case
100
:
{
if
(
showcardp
<
60
)
{
if
(
showcardp
<
60
)
{
driver
->
draw2DImage
(
imageManager
.
tHand
[(
showcardcode
>>
16
)
&
0x3
],
position
2di
((
615
+
44.5
)
*
xScale
-
44.5
,
(
showcarddif
+
64
)
*
yScale
-
64
));
driver
->
draw2DImage
(
imageManager
.
tHand
[(
showcardcode
>>
16
)
&
0x3
],
irr
::
core
::
vector
2di
((
615
+
44.5
)
*
xScale
-
44.5
,
(
showcarddif
+
64
)
*
yScale
-
64
));
driver
->
draw2DImage
(
imageManager
.
tHand
[
showcardcode
&
0x3
],
position
2di
((
615
+
44.5
)
*
xScale
-
44.5
,
(
540
-
showcarddif
+
64
)
*
yScale
-
64
));
driver
->
draw2DImage
(
imageManager
.
tHand
[
showcardcode
&
0x3
],
irr
::
core
::
vector
2di
((
615
+
44.5
)
*
xScale
-
44.5
,
(
540
-
showcarddif
+
64
)
*
yScale
-
64
));
float
dy
=
-
0.333333
f
*
showcardp
+
10
;
float
dy
=
-
0.333333
f
*
showcardp
+
10
;
showcardp
++
;
showcardp
++
;
if
(
showcardp
<
30
)
if
(
showcardp
<
30
)
...
@@ -1096,7 +1096,7 @@ void Game::DrawSpec() {
...
@@ -1096,7 +1096,7 @@ void Game::DrawSpec() {
recti
rectloc
(
x
,
y
-
chatRectY
-
h
,
x
+
2
+
w
,
y
-
chatRectY
);
recti
rectloc
(
x
,
y
-
chatRectY
-
h
,
x
+
2
+
w
,
y
-
chatRectY
);
recti
msgloc
(
x
,
y
-
chatRectY
-
h
,
x
-
4
,
y
-
chatRectY
);
recti
msgloc
(
x
,
y
-
chatRectY
-
h
,
x
-
4
,
y
-
chatRectY
);
recti
shadowloc
=
msgloc
+
position
2di
(
1
,
1
);
recti
shadowloc
=
msgloc
+
irr
::
core
::
vector
2di
(
1
,
1
);
driver
->
draw2DRectangle
(
rectloc
,
0xa0000000
,
0xa0000000
,
0xa0000000
,
0xa0000000
);
driver
->
draw2DRectangle
(
rectloc
,
0xa0000000
,
0xa0000000
,
0xa0000000
,
0xa0000000
);
guiFont
->
drawUstring
(
msg
,
msgloc
,
0xff000000
,
false
,
false
);
guiFont
->
drawUstring
(
msg
,
msgloc
,
0xff000000
,
false
,
false
);
...
@@ -1117,7 +1117,7 @@ void Game::ShowElement(irr::gui::IGUIElement * win, int autoframe) {
...
@@ -1117,7 +1117,7 @@ void Game::ShowElement(irr::gui::IGUIElement * win, int autoframe) {
for
(
auto
fit
=
fadingList
.
begin
();
fit
!=
fadingList
.
end
();
++
fit
)
for
(
auto
fit
=
fadingList
.
begin
();
fit
!=
fadingList
.
end
();
++
fit
)
if
(
win
==
fit
->
guiFading
&&
win
!=
wOptions
&&
win
!=
wANNumber
)
// the size of wOptions is always setted by ClientField::ShowSelectOption before showing it
if
(
win
==
fit
->
guiFading
&&
win
!=
wOptions
&&
win
!=
wANNumber
)
// the size of wOptions is always setted by ClientField::ShowSelectOption before showing it
fu
.
fadingSize
=
fit
->
fadingSize
;
fu
.
fadingSize
=
fit
->
fadingSize
;
irr
::
core
::
position
2di
center
=
fu
.
fadingSize
.
getCenter
();
irr
::
core
::
vector
2di
center
=
fu
.
fadingSize
.
getCenter
();
fu
.
fadingDiff
.
X
=
fu
.
fadingSize
.
getWidth
()
/
10
;
fu
.
fadingDiff
.
X
=
fu
.
fadingSize
.
getWidth
()
/
10
;
fu
.
fadingDiff
.
Y
=
(
fu
.
fadingSize
.
getHeight
()
-
4
)
/
10
;
fu
.
fadingDiff
.
Y
=
(
fu
.
fadingSize
.
getHeight
()
-
4
)
/
10
;
fu
.
fadingUL
=
center
;
fu
.
fadingUL
=
center
;
...
@@ -1202,7 +1202,7 @@ void Game::WaitFrameSignal(int frame) {
...
@@ -1202,7 +1202,7 @@ void Game::WaitFrameSignal(int frame) {
signalFrame
=
(
gameConf
.
quick_animation
&&
frame
>=
12
)
?
12
:
frame
;
signalFrame
=
(
gameConf
.
quick_animation
&&
frame
>=
12
)
?
12
:
frame
;
frameSignal
.
Wait
();
frameSignal
.
Wait
();
}
}
void
Game
::
DrawThumb
(
code_pointer
cp
,
position
2di
pos
,
const
std
::
unordered_map
<
int
,
int
>*
lflist
,
bool
drag
)
{
void
Game
::
DrawThumb
(
code_pointer
cp
,
irr
::
core
::
vector
2di
pos
,
const
std
::
unordered_map
<
int
,
int
>*
lflist
,
bool
drag
)
{
int
code
=
cp
->
first
;
int
code
=
cp
->
first
;
int
lcode
=
cp
->
second
.
alias
;
int
lcode
=
cp
->
second
.
alias
;
if
(
lcode
==
0
)
if
(
lcode
==
0
)
...
@@ -1294,7 +1294,7 @@ void Game::DrawDeckBd() {
...
@@ -1294,7 +1294,7 @@ void Game::DrawDeckBd() {
int
padding
=
scrPackCards
->
getPos
()
*
lx
;
int
padding
=
scrPackCards
->
getPos
()
*
lx
;
for
(
int
i
=
0
;
i
<
mainsize
-
padding
&&
i
<
7
*
lx
;
++
i
)
{
for
(
int
i
=
0
;
i
<
mainsize
-
padding
&&
i
<
7
*
lx
;
++
i
)
{
int
j
=
i
+
padding
;
int
j
=
i
+
padding
;
DrawThumb
(
deckManager
.
current_deck
.
main
[
j
],
position
2di
(
314
+
(
i
%
lx
)
*
dx
,
164
+
(
i
/
lx
)
*
dy
),
deckBuilder
.
filterList
);
DrawThumb
(
deckManager
.
current_deck
.
main
[
j
],
irr
::
core
::
vector
2di
(
314
+
(
i
%
lx
)
*
dx
,
164
+
(
i
/
lx
)
*
dy
),
deckBuilder
.
filterList
);
if
(
deckBuilder
.
hovered_pos
==
1
&&
deckBuilder
.
hovered_seq
==
j
)
if
(
deckBuilder
.
hovered_pos
==
1
&&
deckBuilder
.
hovered_seq
==
j
)
driver
->
draw2DRectangleOutline
(
Resize
(
313
+
(
i
%
lx
)
*
dx
,
163
+
(
i
/
lx
)
*
dy
,
359
+
(
i
%
lx
)
*
dx
,
228
+
(
i
/
lx
)
*
dy
));
driver
->
draw2DRectangleOutline
(
Resize
(
313
+
(
i
%
lx
)
*
dx
,
163
+
(
i
/
lx
)
*
dy
,
359
+
(
i
%
lx
)
*
dx
,
228
+
(
i
/
lx
)
*
dy
));
}
}
...
@@ -1347,7 +1347,7 @@ void Game::DrawDeckBd() {
...
@@ -1347,7 +1347,7 @@ void Game::DrawDeckBd() {
dx
=
436.0
f
/
9
;
dx
=
436.0
f
/
9
;
else
dx
=
436.0
f
/
(
deckManager
.
current_deck
.
extra
.
size
()
-
1
);
else
dx
=
436.0
f
/
(
deckManager
.
current_deck
.
extra
.
size
()
-
1
);
for
(
size_t
i
=
0
;
i
<
deckManager
.
current_deck
.
extra
.
size
();
++
i
)
{
for
(
size_t
i
=
0
;
i
<
deckManager
.
current_deck
.
extra
.
size
();
++
i
)
{
DrawThumb
(
deckManager
.
current_deck
.
extra
[
i
],
position
2di
(
314
+
i
*
dx
,
466
),
deckBuilder
.
filterList
);
DrawThumb
(
deckManager
.
current_deck
.
extra
[
i
],
irr
::
core
::
vector
2di
(
314
+
i
*
dx
,
466
),
deckBuilder
.
filterList
);
if
(
deckBuilder
.
hovered_pos
==
2
&&
deckBuilder
.
hovered_seq
==
(
int
)
i
)
if
(
deckBuilder
.
hovered_pos
==
2
&&
deckBuilder
.
hovered_seq
==
(
int
)
i
)
driver
->
draw2DRectangleOutline
(
Resize
(
313
+
i
*
dx
,
465
,
359
+
i
*
dx
,
531
));
driver
->
draw2DRectangleOutline
(
Resize
(
313
+
i
*
dx
,
465
,
359
+
i
*
dx
,
531
));
}
}
...
@@ -1379,7 +1379,7 @@ void Game::DrawDeckBd() {
...
@@ -1379,7 +1379,7 @@ void Game::DrawDeckBd() {
dx
=
436.0
f
/
9
;
dx
=
436.0
f
/
9
;
else
dx
=
436.0
f
/
(
deckManager
.
current_deck
.
side
.
size
()
-
1
);
else
dx
=
436.0
f
/
(
deckManager
.
current_deck
.
side
.
size
()
-
1
);
for
(
size_t
i
=
0
;
i
<
deckManager
.
current_deck
.
side
.
size
();
++
i
)
{
for
(
size_t
i
=
0
;
i
<
deckManager
.
current_deck
.
side
.
size
();
++
i
)
{
DrawThumb
(
deckManager
.
current_deck
.
side
[
i
],
position
2di
(
314
+
i
*
dx
,
564
),
deckBuilder
.
filterList
);
DrawThumb
(
deckManager
.
current_deck
.
side
[
i
],
irr
::
core
::
vector
2di
(
314
+
i
*
dx
,
564
),
deckBuilder
.
filterList
);
if
(
deckBuilder
.
hovered_pos
==
3
&&
deckBuilder
.
hovered_seq
==
(
int
)
i
)
if
(
deckBuilder
.
hovered_pos
==
3
&&
deckBuilder
.
hovered_seq
==
(
int
)
i
)
driver
->
draw2DRectangleOutline
(
Resize
(
313
+
i
*
dx
,
563
,
359
+
i
*
dx
,
629
));
driver
->
draw2DRectangleOutline
(
Resize
(
313
+
i
*
dx
,
563
,
359
+
i
*
dx
,
629
));
}
}
...
@@ -1406,7 +1406,7 @@ void Game::DrawDeckBd() {
...
@@ -1406,7 +1406,7 @@ void Game::DrawDeckBd() {
}
}
if
(
deckBuilder
.
hovered_pos
==
4
&&
deckBuilder
.
hovered_seq
==
(
int
)
i
)
if
(
deckBuilder
.
hovered_pos
==
4
&&
deckBuilder
.
hovered_seq
==
(
int
)
i
)
driver
->
draw2DRectangle
(
0x80000000
,
Resize
(
806
,
164
+
i
*
66
,
1019
,
230
+
i
*
66
));
driver
->
draw2DRectangle
(
0x80000000
,
Resize
(
806
,
164
+
i
*
66
,
1019
,
230
+
i
*
66
));
DrawThumb
(
ptr
,
position
2di
(
810
,
165
+
i
*
66
),
deckBuilder
.
filterList
);
DrawThumb
(
ptr
,
irr
::
core
::
vector
2di
(
810
,
165
+
i
*
66
),
deckBuilder
.
filterList
);
const
wchar_t
*
availBuffer
=
L""
;
const
wchar_t
*
availBuffer
=
L""
;
if
((
ptr
->
second
.
ot
&
AVAIL_OCGTCG
)
==
AVAIL_OCG
)
if
((
ptr
->
second
.
ot
&
AVAIL_OCGTCG
)
==
AVAIL_OCG
)
availBuffer
=
L" [OCG]"
;
availBuffer
=
L" [OCG]"
;
...
@@ -1456,7 +1456,7 @@ void Game::DrawDeckBd() {
...
@@ -1456,7 +1456,7 @@ void Game::DrawDeckBd() {
}
}
}
}
if
(
deckBuilder
.
is_draging
)
{
if
(
deckBuilder
.
is_draging
)
{
DrawThumb
(
deckBuilder
.
draging_pointer
,
position
2di
(
deckBuilder
.
dragx
-
CARD_THUMB_WIDTH
/
2
*
mainGame
->
xScale
,
deckBuilder
.
dragy
-
CARD_THUMB_HEIGHT
/
2
*
mainGame
->
yScale
),
deckBuilder
.
filterList
,
true
);
DrawThumb
(
deckBuilder
.
draging_pointer
,
irr
::
core
::
vector
2di
(
deckBuilder
.
dragx
-
CARD_THUMB_WIDTH
/
2
*
mainGame
->
xScale
,
deckBuilder
.
dragy
-
CARD_THUMB_HEIGHT
/
2
*
mainGame
->
yScale
),
deckBuilder
.
filterList
,
true
);
}
}
}
}
}
}
gframe/event_handler.cpp
View file @
bcab56c4
...
@@ -1091,8 +1091,8 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
...
@@ -1091,8 +1091,8 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
if
(
!
mainGame
->
dInfo
.
isStarted
)
if
(
!
mainGame
->
dInfo
.
isStarted
)
break
;
break
;
hovered_location
=
0
;
hovered_location
=
0
;
position
2di
pos
=
mainGame
->
ResizeReverse
(
event
.
MouseInput
.
X
,
event
.
MouseInput
.
Y
);
irr
::
core
::
vector
2di
pos
=
mainGame
->
ResizeReverse
(
event
.
MouseInput
.
X
,
event
.
MouseInput
.
Y
);
position
2di
mousepos
(
event
.
MouseInput
.
X
,
event
.
MouseInput
.
Y
);
irr
::
core
::
vector
2di
mousepos
(
event
.
MouseInput
.
X
,
event
.
MouseInput
.
Y
);
s32
x
=
pos
.
X
;
s32
x
=
pos
.
X
;
s32
y
=
pos
.
Y
;
s32
y
=
pos
.
Y
;
if
(
x
<
300
)
if
(
x
<
300
)
...
@@ -1514,8 +1514,8 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
...
@@ -1514,8 +1514,8 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
if
(
!
mainGame
->
dInfo
.
isStarted
)
if
(
!
mainGame
->
dInfo
.
isStarted
)
break
;
break
;
bool
should_show_tip
=
false
;
bool
should_show_tip
=
false
;
position
2di
pos
=
mainGame
->
ResizeReverse
(
event
.
MouseInput
.
X
,
event
.
MouseInput
.
Y
);
irr
::
core
::
vector
2di
pos
=
mainGame
->
ResizeReverse
(
event
.
MouseInput
.
X
,
event
.
MouseInput
.
Y
);
position2di
mousepos
=
position
2di
(
event
.
MouseInput
.
X
,
event
.
MouseInput
.
Y
);
irr
::
core
::
vector2di
mousepos
=
irr
::
core
::
vector
2di
(
event
.
MouseInput
.
X
,
event
.
MouseInput
.
Y
);
s32
x
=
pos
.
X
;
s32
x
=
pos
.
X
;
s32
y
=
pos
.
Y
;
s32
y
=
pos
.
Y
;
wchar_t
formatBuffer
[
2048
];
wchar_t
formatBuffer
[
2048
];
...
@@ -1572,7 +1572,7 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
...
@@ -1572,7 +1572,7 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
if
(
mainGame
->
stTip
->
isVisible
())
{
if
(
mainGame
->
stTip
->
isVisible
())
{
should_show_tip
=
true
;
should_show_tip
=
true
;
irr
::
core
::
recti
tpos
=
mainGame
->
stTip
->
getRelativePosition
();
irr
::
core
::
recti
tpos
=
mainGame
->
stTip
->
getRelativePosition
();
mainGame
->
stTip
->
setRelativePosition
(
irr
::
core
::
position
2di
(
mousepos
.
X
-
tpos
.
getWidth
()
-
10
,
mcard
?
mousepos
.
Y
-
tpos
.
getHeight
()
-
10
:
y
+
10
));
mainGame
->
stTip
->
setRelativePosition
(
irr
::
core
::
vector
2di
(
mousepos
.
X
-
tpos
.
getWidth
()
-
10
,
mcard
?
mousepos
.
Y
-
tpos
.
getHeight
()
-
10
:
y
+
10
));
}
}
}
}
if
(
mcard
!=
hovered_card
)
{
if
(
mcard
!=
hovered_card
)
{
...
@@ -2144,7 +2144,7 @@ bool ClientField::OnCommonEvent(const irr::SEvent& event) {
...
@@ -2144,7 +2144,7 @@ bool ClientField::OnCommonEvent(const irr::SEvent& event) {
void
ClientField
::
GetHoverField
(
int
x
,
int
y
)
{
void
ClientField
::
GetHoverField
(
int
x
,
int
y
)
{
irr
::
core
::
recti
sfRect
(
430
,
504
,
875
,
600
);
irr
::
core
::
recti
sfRect
(
430
,
504
,
875
,
600
);
irr
::
core
::
recti
ofRect
(
531
,
135
,
800
,
191
);
irr
::
core
::
recti
ofRect
(
531
,
135
,
800
,
191
);
irr
::
core
::
position
2di
pos
(
x
,
y
);
irr
::
core
::
vector
2di
pos
(
x
,
y
);
int
rule
=
(
mainGame
->
dInfo
.
duel_rule
>=
4
)
?
1
:
0
;
int
rule
=
(
mainGame
->
dInfo
.
duel_rule
>=
4
)
?
1
:
0
;
if
(
sfRect
.
isPointInside
(
pos
))
{
if
(
sfRect
.
isPointInside
(
pos
))
{
int
hc
=
hand
[
0
].
size
();
int
hc
=
hand
[
0
].
size
();
...
@@ -2381,22 +2381,22 @@ void ClientField::ShowMenu(int flag, int x, int y) {
...
@@ -2381,22 +2381,22 @@ void ClientField::ShowMenu(int flag, int x, int y) {
int
offset
=
mainGame
->
gameConf
.
resize_popup_menu
?
((
mainGame
->
yScale
>=
0.666
)
?
21
*
mainGame
->
yScale
:
14
)
:
21
;
int
offset
=
mainGame
->
gameConf
.
resize_popup_menu
?
((
mainGame
->
yScale
>=
0.666
)
?
21
*
mainGame
->
yScale
:
14
)
:
21
;
if
(
flag
&
COMMAND_ACTIVATE
)
{
if
(
flag
&
COMMAND_ACTIVATE
)
{
mainGame
->
btnActivate
->
setVisible
(
true
);
mainGame
->
btnActivate
->
setVisible
(
true
);
mainGame
->
btnActivate
->
setRelativePosition
(
position
2di
(
1
,
height
));
mainGame
->
btnActivate
->
setRelativePosition
(
irr
::
core
::
vector
2di
(
1
,
height
));
height
+=
offset
;
height
+=
offset
;
}
else
mainGame
->
btnActivate
->
setVisible
(
false
);
}
else
mainGame
->
btnActivate
->
setVisible
(
false
);
if
(
flag
&
COMMAND_SUMMON
)
{
if
(
flag
&
COMMAND_SUMMON
)
{
mainGame
->
btnSummon
->
setVisible
(
true
);
mainGame
->
btnSummon
->
setVisible
(
true
);
mainGame
->
btnSummon
->
setRelativePosition
(
position
2di
(
1
,
height
));
mainGame
->
btnSummon
->
setRelativePosition
(
irr
::
core
::
vector
2di
(
1
,
height
));
height
+=
offset
;
height
+=
offset
;
}
else
mainGame
->
btnSummon
->
setVisible
(
false
);
}
else
mainGame
->
btnSummon
->
setVisible
(
false
);
if
(
flag
&
COMMAND_SPSUMMON
)
{
if
(
flag
&
COMMAND_SPSUMMON
)
{
mainGame
->
btnSPSummon
->
setVisible
(
true
);
mainGame
->
btnSPSummon
->
setVisible
(
true
);
mainGame
->
btnSPSummon
->
setRelativePosition
(
position
2di
(
1
,
height
));
mainGame
->
btnSPSummon
->
setRelativePosition
(
irr
::
core
::
vector
2di
(
1
,
height
));
height
+=
offset
;
height
+=
offset
;
}
else
mainGame
->
btnSPSummon
->
setVisible
(
false
);
}
else
mainGame
->
btnSPSummon
->
setVisible
(
false
);
if
(
flag
&
COMMAND_MSET
)
{
if
(
flag
&
COMMAND_MSET
)
{
mainGame
->
btnMSet
->
setVisible
(
true
);
mainGame
->
btnMSet
->
setVisible
(
true
);
mainGame
->
btnMSet
->
setRelativePosition
(
position
2di
(
1
,
height
));
mainGame
->
btnMSet
->
setRelativePosition
(
irr
::
core
::
vector
2di
(
1
,
height
));
height
+=
offset
;
height
+=
offset
;
}
else
mainGame
->
btnMSet
->
setVisible
(
false
);
}
else
mainGame
->
btnMSet
->
setVisible
(
false
);
if
(
flag
&
COMMAND_SSET
)
{
if
(
flag
&
COMMAND_SSET
)
{
...
@@ -2405,7 +2405,7 @@ void ClientField::ShowMenu(int flag, int x, int y) {
...
@@ -2405,7 +2405,7 @@ void ClientField::ShowMenu(int flag, int x, int y) {
else
else
mainGame
->
btnSSet
->
setText
(
dataManager
.
GetSysString
(
1159
));
mainGame
->
btnSSet
->
setText
(
dataManager
.
GetSysString
(
1159
));
mainGame
->
btnSSet
->
setVisible
(
true
);
mainGame
->
btnSSet
->
setVisible
(
true
);
mainGame
->
btnSSet
->
setRelativePosition
(
position
2di
(
1
,
height
));
mainGame
->
btnSSet
->
setRelativePosition
(
irr
::
core
::
vector
2di
(
1
,
height
));
height
+=
offset
;
height
+=
offset
;
}
else
mainGame
->
btnSSet
->
setVisible
(
false
);
}
else
mainGame
->
btnSSet
->
setVisible
(
false
);
if
(
flag
&
COMMAND_REPOS
)
{
if
(
flag
&
COMMAND_REPOS
)
{
...
@@ -2416,27 +2416,27 @@ void ClientField::ShowMenu(int flag, int x, int y) {
...
@@ -2416,27 +2416,27 @@ void ClientField::ShowMenu(int flag, int x, int y) {
else
else
mainGame
->
btnRepos
->
setText
(
dataManager
.
GetSysString
(
1156
));
mainGame
->
btnRepos
->
setText
(
dataManager
.
GetSysString
(
1156
));
mainGame
->
btnRepos
->
setVisible
(
true
);
mainGame
->
btnRepos
->
setVisible
(
true
);
mainGame
->
btnRepos
->
setRelativePosition
(
position
2di
(
1
,
height
));
mainGame
->
btnRepos
->
setRelativePosition
(
irr
::
core
::
vector
2di
(
1
,
height
));
height
+=
offset
;
height
+=
offset
;
}
else
mainGame
->
btnRepos
->
setVisible
(
false
);
}
else
mainGame
->
btnRepos
->
setVisible
(
false
);
if
(
flag
&
COMMAND_ATTACK
)
{
if
(
flag
&
COMMAND_ATTACK
)
{
mainGame
->
btnAttack
->
setVisible
(
true
);
mainGame
->
btnAttack
->
setVisible
(
true
);
mainGame
->
btnAttack
->
setRelativePosition
(
position
2di
(
1
,
height
));
mainGame
->
btnAttack
->
setRelativePosition
(
irr
::
core
::
vector
2di
(
1
,
height
));
height
+=
offset
;
height
+=
offset
;
}
else
mainGame
->
btnAttack
->
setVisible
(
false
);
}
else
mainGame
->
btnAttack
->
setVisible
(
false
);
if
(
flag
&
COMMAND_LIST
)
{
if
(
flag
&
COMMAND_LIST
)
{
mainGame
->
btnShowList
->
setVisible
(
true
);
mainGame
->
btnShowList
->
setVisible
(
true
);
mainGame
->
btnShowList
->
setRelativePosition
(
position
2di
(
1
,
height
));
mainGame
->
btnShowList
->
setRelativePosition
(
irr
::
core
::
vector
2di
(
1
,
height
));
height
+=
offset
;
height
+=
offset
;
}
else
mainGame
->
btnShowList
->
setVisible
(
false
);
}
else
mainGame
->
btnShowList
->
setVisible
(
false
);
if
(
flag
&
COMMAND_OPERATION
)
{
if
(
flag
&
COMMAND_OPERATION
)
{
mainGame
->
btnOperation
->
setVisible
(
true
);
mainGame
->
btnOperation
->
setVisible
(
true
);
mainGame
->
btnOperation
->
setRelativePosition
(
position
2di
(
1
,
height
));
mainGame
->
btnOperation
->
setRelativePosition
(
irr
::
core
::
vector
2di
(
1
,
height
));
height
+=
offset
;
height
+=
offset
;
}
else
mainGame
->
btnOperation
->
setVisible
(
false
);
}
else
mainGame
->
btnOperation
->
setVisible
(
false
);
if
(
flag
&
COMMAND_RESET
)
{
if
(
flag
&
COMMAND_RESET
)
{
mainGame
->
btnReset
->
setVisible
(
true
);
mainGame
->
btnReset
->
setVisible
(
true
);
mainGame
->
btnReset
->
setRelativePosition
(
position
2di
(
1
,
height
));
mainGame
->
btnReset
->
setRelativePosition
(
irr
::
core
::
vector
2di
(
1
,
height
));
height
+=
offset
;
height
+=
offset
;
}
else
mainGame
->
btnReset
->
setVisible
(
false
);
}
else
mainGame
->
btnReset
->
setVisible
(
false
);
panel
=
mainGame
->
wCmdMenu
;
panel
=
mainGame
->
wCmdMenu
;
...
...
gframe/game.cpp
View file @
bcab56c4
...
@@ -74,10 +74,18 @@ bool IsExtension(const wchar_t* filename, const wchar_t* extension) {
...
@@ -74,10 +74,18 @@ bool IsExtension(const wchar_t* filename, const wchar_t* extension) {
return
!
mywcsncasecmp
(
filename
+
(
flen
-
elen
),
extension
,
elen
);
return
!
mywcsncasecmp
(
filename
+
(
flen
-
elen
),
extension
,
elen
);
}
}
bool
IsExtension
(
const
char
*
filename
,
const
char
*
extension
)
{
auto
flen
=
std
::
strlen
(
filename
);
auto
elen
=
std
::
strlen
(
extension
);
if
(
!
elen
||
flen
<
elen
)
return
false
;
return
!
mystrncasecmp
(
filename
+
(
flen
-
elen
),
extension
,
elen
);
}
bool
Game
::
Initialize
()
{
bool
Game
::
Initialize
()
{
initUtils
();
initUtils
();
LoadConfig
();
LoadConfig
();
irr
::
SIrrlichtCreationParameters
params
=
irr
::
SIrrlichtCreationParameters
()
;
irr
::
SIrrlichtCreationParameters
params
{}
;
params
.
LoggingLevel
=
ELL_NONE
;
params
.
LoggingLevel
=
ELL_NONE
;
params
.
AntiAlias
=
gameConf
.
antialias
;
params
.
AntiAlias
=
gameConf
.
antialias
;
if
(
gameConf
.
use_d3d
)
if
(
gameConf
.
use_d3d
)
...
@@ -125,8 +133,6 @@ bool Game::Initialize() {
...
@@ -125,8 +133,6 @@ bool Game::Initialize() {
ignore_chain
=
false
;
ignore_chain
=
false
;
chain_when_avail
=
false
;
chain_when_avail
=
false
;
is_building
=
false
;
is_building
=
false
;
menuHandler
.
prev_operation
=
0
;
menuHandler
.
prev_sel
=
-
1
;
deckManager
.
LoadLFList
();
deckManager
.
LoadLFList
();
driver
=
device
->
getVideoDriver
();
driver
=
device
->
getVideoDriver
();
driver
->
setTextureCreationFlag
(
irr
::
video
::
ETCF_CREATE_MIP_MAPS
,
false
);
driver
->
setTextureCreationFlag
(
irr
::
video
::
ETCF_CREATE_MIP_MAPS
,
false
);
...
@@ -2003,7 +2009,7 @@ void Game::AddDebugMsg(const char* msg) {
...
@@ -2003,7 +2009,7 @@ void Game::AddDebugMsg(const char* msg) {
}
}
}
}
void
Game
::
ErrorLog
(
const
char
*
msg
)
{
void
Game
::
ErrorLog
(
const
char
*
msg
)
{
FILE
*
fp
=
std
::
fopen
(
"error.log"
,
"a
t
"
);
FILE
*
fp
=
std
::
fopen
(
"error.log"
,
"a"
);
if
(
!
fp
)
if
(
!
fp
)
return
;
return
;
time_t
nowtime
=
std
::
time
(
nullptr
);
time_t
nowtime
=
std
::
time
(
nullptr
);
...
@@ -2379,15 +2385,15 @@ recti Game::Resize(s32 x, s32 y, s32 x2, s32 y2, s32 dx, s32 dy, s32 dx2, s32 dy
...
@@ -2379,15 +2385,15 @@ recti Game::Resize(s32 x, s32 y, s32 x2, s32 y2, s32 dx, s32 dy, s32 dx2, s32 dy
y2
=
y2
*
yScale
+
dy2
;
y2
=
y2
*
yScale
+
dy2
;
return
recti
(
x
,
y
,
x2
,
y2
);
return
recti
(
x
,
y
,
x2
,
y2
);
}
}
position
2di
Game
::
Resize
(
s32
x
,
s32
y
)
{
irr
::
core
::
vector
2di
Game
::
Resize
(
s32
x
,
s32
y
)
{
x
=
x
*
xScale
;
x
=
x
*
xScale
;
y
=
y
*
yScale
;
y
=
y
*
yScale
;
return
position
2di
(
x
,
y
);
return
irr
::
core
::
vector
2di
(
x
,
y
);
}
}
position
2di
Game
::
ResizeReverse
(
s32
x
,
s32
y
)
{
irr
::
core
::
vector
2di
Game
::
ResizeReverse
(
s32
x
,
s32
y
)
{
x
=
x
/
xScale
;
x
=
x
/
xScale
;
y
=
y
/
yScale
;
y
=
y
/
yScale
;
return
position
2di
(
x
,
y
);
return
irr
::
core
::
vector
2di
(
x
,
y
);
}
}
recti
Game
::
ResizeWin
(
s32
x
,
s32
y
,
s32
x2
,
s32
y2
)
{
recti
Game
::
ResizeWin
(
s32
x
,
s32
y
,
s32
x2
,
s32
y2
)
{
s32
w
=
x2
-
x
;
s32
w
=
x2
-
x
;
...
@@ -2418,7 +2424,7 @@ recti Game::ResizeCardImgWin(s32 x, s32 y, s32 mx, s32 my) {
...
@@ -2418,7 +2424,7 @@ recti Game::ResizeCardImgWin(s32 x, s32 y, s32 mx, s32 my) {
recti
Game
::
ResizeCardHint
(
s32
x
,
s32
y
,
s32
x2
,
s32
y2
)
{
recti
Game
::
ResizeCardHint
(
s32
x
,
s32
y
,
s32
x2
,
s32
y2
)
{
return
ResizeCardMid
(
x
,
y
,
x2
,
y2
,
(
x
+
x2
)
*
0.5
,
(
y
+
y2
)
*
0.5
);
return
ResizeCardMid
(
x
,
y
,
x2
,
y2
,
(
x
+
x2
)
*
0.5
,
(
y
+
y2
)
*
0.5
);
}
}
position
2di
Game
::
ResizeCardHint
(
s32
x
,
s32
y
)
{
irr
::
core
::
vector
2di
Game
::
ResizeCardHint
(
s32
x
,
s32
y
)
{
return
ResizeCardMid
(
x
,
y
,
x
+
CARD_IMG_WIDTH
*
0.5
,
y
+
CARD_IMG_HEIGHT
*
0.5
);
return
ResizeCardMid
(
x
,
y
,
x
+
CARD_IMG_WIDTH
*
0.5
,
y
+
CARD_IMG_HEIGHT
*
0.5
);
}
}
recti
Game
::
ResizeCardMid
(
s32
x
,
s32
y
,
s32
x2
,
s32
y2
,
s32
midx
,
s32
midy
)
{
recti
Game
::
ResizeCardMid
(
s32
x
,
s32
y
,
s32
x2
,
s32
y2
,
s32
midx
,
s32
midy
)
{
...
@@ -2433,7 +2439,7 @@ recti Game::ResizeCardMid(s32 x, s32 y, s32 x2, s32 y2, s32 midx, s32 midy) {
...
@@ -2433,7 +2439,7 @@ recti Game::ResizeCardMid(s32 x, s32 y, s32 x2, s32 y2, s32 midx, s32 midy) {
y2
=
cy
+
(
y2
-
midy
)
*
mul
;
y2
=
cy
+
(
y2
-
midy
)
*
mul
;
return
recti
(
x
,
y
,
x2
,
y2
);
return
recti
(
x
,
y
,
x2
,
y2
);
}
}
position
2di
Game
::
ResizeCardMid
(
s32
x
,
s32
y
,
s32
midx
,
s32
midy
)
{
irr
::
core
::
vector
2di
Game
::
ResizeCardMid
(
s32
x
,
s32
y
,
s32
midx
,
s32
midy
)
{
float
mul
=
xScale
;
float
mul
=
xScale
;
if
(
xScale
>
yScale
)
if
(
xScale
>
yScale
)
mul
=
yScale
;
mul
=
yScale
;
...
@@ -2441,7 +2447,7 @@ position2di Game::ResizeCardMid(s32 x, s32 y, s32 midx, s32 midy) {
...
@@ -2441,7 +2447,7 @@ position2di Game::ResizeCardMid(s32 x, s32 y, s32 midx, s32 midy) {
s32
cy
=
midy
*
yScale
;
s32
cy
=
midy
*
yScale
;
x
=
cx
+
(
x
-
midx
)
*
mul
;
x
=
cx
+
(
x
-
midx
)
*
mul
;
y
=
cy
+
(
y
-
midy
)
*
mul
;
y
=
cy
+
(
y
-
midy
)
*
mul
;
return
position
2di
(
x
,
y
);
return
irr
::
core
::
vector
2di
(
x
,
y
);
}
}
recti
Game
::
ResizeFit
(
s32
x
,
s32
y
,
s32
x2
,
s32
y2
)
{
recti
Game
::
ResizeFit
(
s32
x
,
s32
y
,
s32
x2
,
s32
y2
)
{
float
mul
=
xScale
;
float
mul
=
xScale
;
...
...
gframe/game.h
View file @
bcab56c4
...
@@ -32,6 +32,7 @@ constexpr int TEXT_LINE_SIZE = 256;
...
@@ -32,6 +32,7 @@ constexpr int TEXT_LINE_SIZE = 256;
namespace
ygo
{
namespace
ygo
{
bool
IsExtension
(
const
wchar_t
*
filename
,
const
wchar_t
*
extension
);
bool
IsExtension
(
const
wchar_t
*
filename
,
const
wchar_t
*
extension
);
bool
IsExtension
(
const
char
*
filename
,
const
char
*
extension
);
struct
Config
{
struct
Config
{
bool
use_d3d
{
false
};
bool
use_d3d
{
false
};
...
@@ -190,7 +191,7 @@ public:
...
@@ -190,7 +191,7 @@ public:
void
HideElement
(
irr
::
gui
::
IGUIElement
*
element
,
bool
set_action
=
false
);
void
HideElement
(
irr
::
gui
::
IGUIElement
*
element
,
bool
set_action
=
false
);
void
PopupElement
(
irr
::
gui
::
IGUIElement
*
element
,
int
hideframe
=
0
);
void
PopupElement
(
irr
::
gui
::
IGUIElement
*
element
,
int
hideframe
=
0
);
void
WaitFrameSignal
(
int
frame
);
void
WaitFrameSignal
(
int
frame
);
void
DrawThumb
(
code_pointer
cp
,
position
2di
pos
,
const
std
::
unordered_map
<
int
,
int
>*
lflist
,
bool
drag
=
false
);
void
DrawThumb
(
code_pointer
cp
,
irr
::
core
::
vector
2di
pos
,
const
std
::
unordered_map
<
int
,
int
>*
lflist
,
bool
drag
=
false
);
void
DrawDeckBd
();
void
DrawDeckBd
();
bool
LoadConfigFromFile
(
const
char
*
file
);
bool
LoadConfigFromFile
(
const
char
*
file
);
void
LoadConfig
();
void
LoadConfig
();
...
@@ -231,15 +232,15 @@ public:
...
@@ -231,15 +232,15 @@ public:
void
ResizeChatInputWindow
();
void
ResizeChatInputWindow
();
recti
Resize
(
s32
x
,
s32
y
,
s32
x2
,
s32
y2
);
recti
Resize
(
s32
x
,
s32
y
,
s32
x2
,
s32
y2
);
recti
Resize
(
s32
x
,
s32
y
,
s32
x2
,
s32
y2
,
s32
dx
,
s32
dy
,
s32
dx2
,
s32
dy2
);
recti
Resize
(
s32
x
,
s32
y
,
s32
x2
,
s32
y2
,
s32
dx
,
s32
dy
,
s32
dx2
,
s32
dy2
);
position
2di
Resize
(
s32
x
,
s32
y
);
irr
::
core
::
vector
2di
Resize
(
s32
x
,
s32
y
);
position
2di
ResizeReverse
(
s32
x
,
s32
y
);
irr
::
core
::
vector
2di
ResizeReverse
(
s32
x
,
s32
y
);
recti
ResizePhaseHint
(
s32
x
,
s32
y
,
s32
x2
,
s32
y2
,
s32
width
);
recti
ResizePhaseHint
(
s32
x
,
s32
y
,
s32
x2
,
s32
y2
,
s32
width
);
recti
ResizeWin
(
s32
x
,
s32
y
,
s32
x2
,
s32
y2
);
recti
ResizeWin
(
s32
x
,
s32
y
,
s32
x2
,
s32
y2
);
recti
ResizeCardImgWin
(
s32
x
,
s32
y
,
s32
mx
,
s32
my
);
recti
ResizeCardImgWin
(
s32
x
,
s32
y
,
s32
mx
,
s32
my
);
recti
ResizeCardHint
(
s32
x
,
s32
y
,
s32
x2
,
s32
y2
);
recti
ResizeCardHint
(
s32
x
,
s32
y
,
s32
x2
,
s32
y2
);
position
2di
ResizeCardHint
(
s32
x
,
s32
y
);
irr
::
core
::
vector
2di
ResizeCardHint
(
s32
x
,
s32
y
);
recti
ResizeCardMid
(
s32
x
,
s32
y
,
s32
x2
,
s32
y2
,
s32
midx
,
s32
midy
);
recti
ResizeCardMid
(
s32
x
,
s32
y
,
s32
x2
,
s32
y2
,
s32
midx
,
s32
midy
);
position
2di
ResizeCardMid
(
s32
x
,
s32
y
,
s32
midx
,
s32
midy
);
irr
::
core
::
vector
2di
ResizeCardMid
(
s32
x
,
s32
y
,
s32
midx
,
s32
midy
);
recti
ResizeFit
(
s32
x
,
s32
y
,
s32
x2
,
s32
y2
);
recti
ResizeFit
(
s32
x
,
s32
y
,
s32
x2
,
s32
y2
);
void
SetWindowsIcon
();
void
SetWindowsIcon
();
...
...
gframe/gframe.cpp
View file @
bcab56c4
...
@@ -38,17 +38,15 @@ int main(int argc, char* argv[]) {
...
@@ -38,17 +38,15 @@ int main(int argc, char* argv[]) {
CFRelease
(
path
);
CFRelease
(
path
);
#endif //__APPLE__
#endif //__APPLE__
#ifdef _WIN32
#ifdef _WIN32
#ifndef _DEBUG
if
(
argc
==
2
&&
(
ygo
::
IsExtension
(
argv
[
1
],
".ydk"
)
||
ygo
::
IsExtension
(
argv
[
1
],
".yrp"
)))
{
// open file from explorer
char
*
pstrext
;
if
(
argc
==
2
&&
(
pstrext
=
std
::
strrchr
(
argv
[
1
],
'.'
))
&&
(
!
mystrncasecmp
(
pstrext
,
".ydk"
,
4
)
||
!
mystrncasecmp
(
pstrext
,
".yrp"
,
4
)))
{
wchar_t
exepath
[
MAX_PATH
];
wchar_t
exepath
[
MAX_PATH
];
GetModuleFileNameW
(
nullptr
,
exepath
,
MAX_PATH
);
GetModuleFileNameW
(
nullptr
,
exepath
,
MAX_PATH
);
wchar_t
*
p
=
std
::
wcsrchr
(
exepath
,
'\\'
);
wchar_t
*
p
=
std
::
wcsrchr
(
exepath
,
L'\\'
);
*
p
=
'\0'
;
if
(
p
)
{
SetCurrentDirectoryW
(
exepath
);
*
p
=
0
;
SetCurrentDirectoryW
(
exepath
);
}
}
}
#endif //_DEBUG
#endif //_WIN32
#endif //_WIN32
#ifdef _WIN32
#ifdef _WIN32
WORD
wVersionRequested
;
WORD
wVersionRequested
;
...
@@ -65,7 +63,7 @@ int main(int argc, char* argv[]) {
...
@@ -65,7 +63,7 @@ int main(int argc, char* argv[]) {
return
0
;
return
0
;
#ifdef _WIN32
#ifdef _WIN32
int
wargc
;
int
wargc
=
0
;
std
::
unique_ptr
<
wchar_t
*
[],
void
(
*
)(
wchar_t
**
)
>
wargv
(
CommandLineToArgvW
(
GetCommandLineW
(),
&
wargc
),
[](
wchar_t
**
wargv
)
{
std
::
unique_ptr
<
wchar_t
*
[],
void
(
*
)(
wchar_t
**
)
>
wargv
(
CommandLineToArgvW
(
GetCommandLineW
(),
&
wargc
),
[](
wchar_t
**
wargv
)
{
LocalFree
(
wargv
);
LocalFree
(
wargv
);
});
});
...
@@ -81,6 +79,24 @@ int main(int argc, char* argv[]) {
...
@@ -81,6 +79,24 @@ int main(int argc, char* argv[]) {
bool
deckCategorySpecified
=
false
;
bool
deckCategorySpecified
=
false
;
bool
portSpecified
=
false
;
bool
portSpecified
=
false
;
for
(
int
i
=
1
;
i
<
wargc
;
++
i
)
{
for
(
int
i
=
1
;
i
<
wargc
;
++
i
)
{
if
(
wargc
==
2
&&
std
::
wcslen
(
wargv
[
1
])
>=
4
)
{
wchar_t
*
pstrext
=
wargv
[
1
]
+
std
::
wcslen
(
wargv
[
1
])
-
4
;
if
(
!
mywcsncasecmp
(
pstrext
,
L".ydk"
,
4
))
{
open_file
=
true
;
BufferIO
::
CopyWideString
(
wargv
[
1
],
open_file_name
);
exit_on_return
=
true
;
ClickButton
(
ygo
::
mainGame
->
btnDeckEdit
);
break
;
}
if
(
!
mywcsncasecmp
(
pstrext
,
L".yrp"
,
4
))
{
open_file
=
true
;
BufferIO
::
CopyWideString
(
wargv
[
1
],
open_file_name
);
exit_on_return
=
true
;
ClickButton
(
ygo
::
mainGame
->
btnReplayMode
);
ClickButton
(
ygo
::
mainGame
->
btnLoadReplay
);
break
;
}
}
if
(
wargv
[
i
][
0
]
==
L'-'
&&
wargv
[
i
][
1
]
==
L'e'
&&
wargv
[
i
][
2
]
!=
L'\0'
)
{
if
(
wargv
[
i
][
0
]
==
L'-'
&&
wargv
[
i
][
1
]
==
L'e'
&&
wargv
[
i
][
2
]
!=
L'\0'
)
{
ygo
::
dataManager
.
LoadDB
(
&
wargv
[
i
][
2
]);
ygo
::
dataManager
.
LoadDB
(
&
wargv
[
i
][
2
]);
continue
;
continue
;
...
@@ -190,23 +206,6 @@ int main(int argc, char* argv[]) {
...
@@ -190,23 +206,6 @@ int main(int argc, char* argv[]) {
if
(
open_file
)
if
(
open_file
)
ClickButton
(
ygo
::
mainGame
->
btnLoadSinglePlay
);
ClickButton
(
ygo
::
mainGame
->
btnLoadSinglePlay
);
break
;
break
;
}
else
if
(
wargc
==
2
&&
std
::
wcslen
(
wargv
[
1
])
>=
4
)
{
wchar_t
*
pstrext
=
wargv
[
1
]
+
std
::
wcslen
(
wargv
[
1
])
-
4
;
if
(
!
mywcsncasecmp
(
pstrext
,
L".ydk"
,
4
))
{
open_file
=
true
;
BufferIO
::
CopyWideString
(
wargv
[
i
],
open_file_name
);
exit_on_return
=
!
keep_on_return
;
ClickButton
(
ygo
::
mainGame
->
btnDeckEdit
);
break
;
}
if
(
!
mywcsncasecmp
(
pstrext
,
L".yrp"
,
4
))
{
open_file
=
true
;
BufferIO
::
CopyWideString
(
wargv
[
i
],
open_file_name
);
exit_on_return
=
!
keep_on_return
;
ClickButton
(
ygo
::
mainGame
->
btnReplayMode
);
ClickButton
(
ygo
::
mainGame
->
btnLoadReplay
);
break
;
}
}
}
}
}
ygo
::
mainGame
->
MainLoop
();
ygo
::
mainGame
->
MainLoop
();
...
...
gframe/materials.cpp
View file @
bcab56c4
This diff is collapsed.
Click to expand it.
gframe/materials.h
View file @
bcab56c4
#include "config.h"
#ifndef MATERIALS_H
#define MATERIALS_H
#include <irrlicht.h>
namespace
ygo
{
namespace
ygo
{
...
@@ -7,32 +10,32 @@ public:
...
@@ -7,32 +10,32 @@ public:
Materials
();
Materials
();
void
GenArrow
(
float
y
);
void
GenArrow
(
float
y
);
S3DVertex
vCardFront
[
4
];
irr
::
video
::
S3DVertex
vCardFront
[
4
];
S3DVertex
vCardOutline
[
4
];
irr
::
video
::
S3DVertex
vCardOutline
[
4
];
S3DVertex
vCardOutliner
[
4
];
irr
::
video
::
S3DVertex
vCardOutliner
[
4
];
S3DVertex
vCardBack
[
4
];
irr
::
video
::
S3DVertex
vCardBack
[
4
];
S3DVertex
vPScale
[
4
];
irr
::
video
::
S3DVertex
vPScale
[
4
];
S3DVertex
vSymbol
[
4
];
irr
::
video
::
S3DVertex
vSymbol
[
4
];
S3DVertex
vNegate
[
4
];
irr
::
video
::
S3DVertex
vNegate
[
4
];
S3DVertex
vChainNum
[
4
];
irr
::
video
::
S3DVertex
vChainNum
[
4
];
S3DVertex
vActivate
[
4
];
irr
::
video
::
S3DVertex
vActivate
[
4
];
S3DVertex
vField
[
4
];
irr
::
video
::
S3DVertex
vField
[
4
];
S3DVertex
vFieldSpell
[
4
];
irr
::
video
::
S3DVertex
vFieldSpell
[
4
];
S3DVertex
vFieldSpell1
[
4
];
irr
::
video
::
S3DVertex
vFieldSpell1
[
4
];
S3DVertex
vFieldSpell2
[
4
];
irr
::
video
::
S3DVertex
vFieldSpell2
[
4
];
//S3DVertex vBackLine[76];
//
irr::video::
S3DVertex vBackLine[76];
S3DVertex
vFieldDeck
[
2
][
4
];
irr
::
video
::
S3DVertex
vFieldDeck
[
2
][
4
];
S3DVertex
vFieldGrave
[
2
][
2
][
4
];
//[player][rule], rule = 0: dule_rule <= 3, 1: dule_rule >= 4
irr
::
video
::
S3DVertex
vFieldGrave
[
2
][
2
][
4
];
//[player][rule], rule = 0: dule_rule <= 3, 1: dule_rule >= 4
S3DVertex
vFieldExtra
[
2
][
4
];
irr
::
video
::
S3DVertex
vFieldExtra
[
2
][
4
];
S3DVertex
vFieldRemove
[
2
][
2
][
4
];
//[player][rule]
irr
::
video
::
S3DVertex
vFieldRemove
[
2
][
2
][
4
];
//[player][rule]
S3DVertex
vFieldMzone
[
2
][
7
][
4
];
//[player][sequence]
irr
::
video
::
S3DVertex
vFieldMzone
[
2
][
7
][
4
];
//[player][sequence]
S3DVertex
vFieldSzone
[
2
][
8
][
2
][
4
];
//[player][sequence][rule]
irr
::
video
::
S3DVertex
vFieldSzone
[
2
][
8
][
2
][
4
];
//[player][sequence][rule]
irr
::
core
::
vector3df
vFieldContiAct
[
4
];
irr
::
core
::
vector3df
vFieldContiAct
[
4
];
S3DVertex
vArrow
[
40
];
irr
::
video
::
S3DVertex
vArrow
[
40
];
SColor
c2d
[
4
];
irr
::
video
::
SColor
c2d
[
4
];
u16
iRectangle
[
6
];
irr
::
u16
iRectangle
[
6
];
//u16 iBackLine[116];
//
irr::
u16 iBackLine[116];
u16
iArrow
[
40
];
irr
::
u16
iArrow
[
40
];
irr
::
video
::
SMaterial
mCard
;
irr
::
video
::
SMaterial
mCard
;
irr
::
video
::
SMaterial
mTexture
;
irr
::
video
::
SMaterial
mTexture
;
irr
::
video
::
SMaterial
mBackLine
;
irr
::
video
::
SMaterial
mBackLine
;
...
@@ -45,3 +48,5 @@ public:
...
@@ -45,3 +48,5 @@ public:
extern
Materials
matManager
;
extern
Materials
matManager
;
}
}
#endif //MATERIALS_H
gframe/menu_handler.h
View file @
bcab56c4
#ifndef MENU_HANDLER_H
#ifndef MENU_HANDLER_H
#define MENU_HANDLER_H
#define MENU_HANDLER_H
#include
"config.h"
#include
<irrlicht.h>
namespace
ygo
{
namespace
ygo
{
class
MenuHandler
:
public
irr
::
IEventReceiver
{
class
MenuHandler
:
public
irr
::
IEventReceiver
{
public:
public:
bool
OnEvent
(
const
irr
::
SEvent
&
event
)
override
;
bool
OnEvent
(
const
irr
::
SEvent
&
event
)
override
;
s32
prev_operation
;
irr
::
s32
prev_operation
{
0
}
;
int
prev_sel
;
int
prev_sel
{
-
1
}
;
};
};
...
...
premake/freetype/premake5.lua
View file @
bcab56c4
...
@@ -43,6 +43,10 @@ project "freetype"
...
@@ -43,6 +43,10 @@ project "freetype"
"src/type42/type42.c"
,
"src/type42/type42.c"
,
"src/winfonts/winfnt.c"
}
"src/winfonts/winfnt.c"
}
if
os
.
isfile
(
"src/svg/svg.c"
)
then
files
{
"src/svg/svg.c"
}
end
filter
"system:windows"
filter
"system:windows"
files
{
"builds/windows/ftsystem.c"
,
files
{
"builds/windows/ftsystem.c"
,
"builds/windows/ftdebug.c"
}
"builds/windows/ftdebug.c"
}
...
...
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