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
xiaoye
ygopro
Commits
2b937193
Commit
2b937193
authored
Mar 12, 2025
by
wind2009
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'server' into server-develop
parents
0ad54f23
e6f9be30
Changes
24
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
24 changed files
with
885 additions
and
530 deletions
+885
-530
gframe/CGUIButton.h
gframe/CGUIButton.h
+0
-143
gframe/CGUIImageButton.cpp
gframe/CGUIImageButton.cpp
+370
-14
gframe/CGUIImageButton.h
gframe/CGUIImageButton.h
+138
-17
gframe/CGUITTFont.cpp
gframe/CGUITTFont.cpp
+3
-3
gframe/config.h
gframe/config.h
+6
-4
gframe/data_manager.cpp
gframe/data_manager.cpp
+9
-10
gframe/deck_con.cpp
gframe/deck_con.cpp
+20
-12
gframe/deck_con.h
gframe/deck_con.h
+4
-4
gframe/deck_manager.cpp
gframe/deck_manager.cpp
+42
-42
gframe/deck_manager.h
gframe/deck_manager.h
+5
-6
gframe/drawing.cpp
gframe/drawing.cpp
+15
-15
gframe/event_handler.cpp
gframe/event_handler.cpp
+16
-16
gframe/game.cpp
gframe/game.cpp
+90
-85
gframe/game.h
gframe/game.h
+6
-5
gframe/gframe.cpp
gframe/gframe.cpp
+6
-8
gframe/image_manager.cpp
gframe/image_manager.cpp
+13
-13
gframe/materials.cpp
gframe/materials.cpp
+64
-64
gframe/materials.h
gframe/materials.h
+30
-25
gframe/menu_handler.cpp
gframe/menu_handler.cpp
+10
-10
gframe/menu_handler.h
gframe/menu_handler.h
+3
-3
gframe/myfilesystem.h
gframe/myfilesystem.h
+2
-2
gframe/replay.cpp
gframe/replay.cpp
+24
-24
premake/freetype/premake5.lua
premake/freetype/premake5.lua
+4
-0
premake/gframe/ygopro.rc
premake/gframe/ygopro.rc
+5
-5
No files found.
gframe/CGUIButton.h
deleted
100644 → 0
View file @
0ad54f23
// Copyright (C) 2002-2012 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
#ifndef __C_GUI_BUTTON_H_INCLUDED__
#define __C_GUI_BUTTON_H_INCLUDED__
#include "IrrCompileConfig.h"
#ifdef _IRR_COMPILE_WITH_GUI_
#include "IGUIButton.h"
#include "IGUISpriteBank.h"
#include "SColor.h"
namespace
irr
{
namespace
gui
{
class
CGUIButton
:
public
IGUIButton
{
public:
//! constructor
CGUIButton
(
IGUIEnvironment
*
environment
,
IGUIElement
*
parent
,
s32
id
,
core
::
rect
<
s32
>
rectangle
,
bool
noclip
=
false
);
//! destructor
virtual
~
CGUIButton
();
//! called if an event happened.
virtual
bool
OnEvent
(
const
SEvent
&
event
);
//! draws the element and its children
virtual
void
draw
();
//! sets another skin independent font. if this is set to zero, the button uses the font of the skin.
virtual
void
setOverrideFont
(
IGUIFont
*
font
=
0
);
//! Gets the override font (if any)
virtual
IGUIFont
*
getOverrideFont
()
const
;
//! Get the font which is used right now for drawing
virtual
IGUIFont
*
getActiveFont
()
const
;
//! Sets an image which should be displayed on the button when it is in normal state.
virtual
void
setImage
(
video
::
ITexture
*
image
=
0
);
//! Sets an image which should be displayed on the button when it is in normal state.
virtual
void
setImage
(
video
::
ITexture
*
image
,
const
core
::
rect
<
s32
>&
pos
);
//! Sets an image which should be displayed on the button when it is in pressed state.
virtual
void
setPressedImage
(
video
::
ITexture
*
image
=
0
);
//! Sets an image which should be displayed on the button when it is in pressed state.
virtual
void
setPressedImage
(
video
::
ITexture
*
image
,
const
core
::
rect
<
s32
>&
pos
);
//! Sets the sprite bank used by the button
virtual
void
setSpriteBank
(
IGUISpriteBank
*
bank
=
0
);
//! Sets the animated sprite for a specific button state
/** \param index: Number of the sprite within the sprite bank, use -1 for no sprite
\param state: State of the button to set the sprite for
\param index: The sprite number from the current sprite bank
\param color: The color of the sprite
*/
virtual
void
setSprite
(
EGUI_BUTTON_STATE
state
,
s32
index
,
video
::
SColor
color
=
video
::
SColor
(
255
,
255
,
255
,
255
),
bool
loop
=
false
);
//! Sets if the button should behave like a push button. Which means it
//! can be in two states: Normal or Pressed. With a click on the button,
//! the user can change the state of the button.
virtual
void
setIsPushButton
(
bool
isPushButton
=
true
);
//! Checks whether the button is a push button
virtual
bool
isPushButton
()
const
;
//! Sets the pressed state of the button if this is a pushbutton
virtual
void
setPressed
(
bool
pressed
=
true
);
//! Returns if the button is currently pressed
virtual
bool
isPressed
()
const
;
//! Sets if the button should use the skin to draw its border
virtual
void
setDrawBorder
(
bool
border
=
true
);
//! Checks if the button face and border are being drawn
virtual
bool
isDrawingBorder
()
const
;
//! Sets if the alpha channel should be used for drawing images on the button (default is false)
virtual
void
setUseAlphaChannel
(
bool
useAlphaChannel
=
true
);
//! Checks if the alpha channel should be used for drawing images on the button
virtual
bool
isAlphaChannelUsed
()
const
;
//! Sets if the button should scale the button images to fit
virtual
void
setScaleImage
(
bool
scaleImage
=
true
);
//! Checks whether the button scales the used images
virtual
bool
isScalingImage
()
const
;
//! Writes attributes of the element.
virtual
void
serializeAttributes
(
io
::
IAttributes
*
out
,
io
::
SAttributeReadWriteOptions
*
options
)
const
;
//! Reads attributes of the element
virtual
void
deserializeAttributes
(
io
::
IAttributes
*
in
,
io
::
SAttributeReadWriteOptions
*
options
);
protected:
struct
ButtonSprite
{
s32
Index
;
video
::
SColor
Color
;
bool
Loop
;
};
ButtonSprite
ButtonSprites
[
EGBS_COUNT
];
IGUISpriteBank
*
SpriteBank
;
IGUIFont
*
OverrideFont
;
video
::
ITexture
*
Image
;
video
::
ITexture
*
PressedImage
;
core
::
rect
<
s32
>
ImageRect
;
core
::
rect
<
s32
>
PressedImageRect
;
u32
ClickTime
,
HoverTime
,
FocusTime
;
bool
IsPushButton
;
bool
Pressed
;
bool
UseAlphaChannel
;
bool
DrawBorder
;
bool
ScaleImage
;
};
}
// end namespace gui
}
// end namespace irr
#endif // _IRR_COMPILE_WITH_GUI_
#endif // __C_GUI_BUTTON_H_INCLUDED__
gframe/CGUIImageButton.cpp
View file @
2b937193
This diff is collapsed.
Click to expand it.
gframe/CGUIImageButton.h
View file @
2b937193
// Copyright (C) 2002-2012 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
#ifndef _C_GUI_IMAGE_BUTTON_H_
#ifndef _C_GUI_IMAGE_BUTTON_H_
#define _C_GUI_IMAGE_BUTTON_H_
#define _C_GUI_IMAGE_BUTTON_H_
#include <irrlicht.h>
#include <IrrCompileConfig.h>
#include "CGUIButton.h"
#ifdef _IRR_COMPILE_WITH_GUI_
#include <IGUIButton.h>
#include <SColor.h>
namespace
irr
{
namespace
irr
{
namespace
video
{
class
IVideoDriver
;
class
ITexture
;
}
namespace
gui
{
namespace
gui
{
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
::
position2d
<
s32
>
corner
[
4
],
bool
useAlphaChannel
=
true
,
video
::
SColor
color
=
0xffffffff
);
core
::
vector2d
<
s32
>
corner
[
4
],
bool
useAlphaChannel
=
true
,
video
::
SColor
color
=
0xffffffff
);
class
CGUIImageButton
:
public
CGUIButton
{
class
CGUIImageButton
:
public
IGUIButton
{
public:
public:
CGUIImageButton
(
IGUIEnvironment
*
environment
,
IGUIElement
*
parent
,
s32
id
,
core
::
rect
<
s32
>
rectangle
);
static
CGUIImageButton
*
addImageButton
(
IGUIEnvironment
*
env
,
const
core
::
rect
<
s32
>&
rectangle
,
IGUIElement
*
parent
,
s32
id
);
static
CGUIImageButton
*
addImageButton
(
IGUIEnvironment
*
env
,
const
core
::
rect
<
s32
>&
rectangle
,
IGUIElement
*
parent
,
s32
id
);
virtual
void
draw
();
//! constructor
virtual
void
setImage
(
video
::
ITexture
*
image
=
0
);
CGUIImageButton
(
IGUIEnvironment
*
environment
,
IGUIElement
*
parent
,
virtual
void
setDrawImage
(
bool
b
);
s32
id
,
core
::
rect
<
s32
>
rectangle
,
bool
noclip
=
false
);
virtual
void
setImageRotation
(
f32
r
);
virtual
void
setImageScale
(
core
::
vector2df
s
);
//! destructor
virtual
void
setImageSize
(
core
::
dimension2di
s
);
~
CGUIImageButton
()
override
;
virtual
IGUIFont
*
getOverrideFont
(
void
)
const
;
virtual
IGUIFont
*
getActiveFont
()
const
;
//! called if an event happened.
bool
OnEvent
(
const
SEvent
&
event
)
override
;
private:
//! draws the element and its children
void
draw
()
override
;
//! sets another skin independent font. if this is set to zero, the button uses the font of the skin.
void
setOverrideFont
(
IGUIFont
*
font
=
0
)
override
;
//! Gets the override font (if any)
IGUIFont
*
getOverrideFont
()
const
override
;
//! Get the font which is used right now for drawing
IGUIFont
*
getActiveFont
()
const
override
;
//! Sets an image which should be displayed on the button when it is in normal state.
void
setImage
(
video
::
ITexture
*
image
=
0
)
override
;
//! Sets an image which should be displayed on the button when it is in normal state.
void
setImage
(
video
::
ITexture
*
image
,
const
core
::
rect
<
s32
>&
pos
)
override
;
//! Sets an image which should be displayed on the button when it is in pressed state.
void
setPressedImage
(
video
::
ITexture
*
image
=
0
)
override
;
//! Sets an image which should be displayed on the button when it is in pressed state.
void
setPressedImage
(
video
::
ITexture
*
image
,
const
core
::
rect
<
s32
>&
pos
)
override
;
//! Sets the sprite bank used by the button
void
setSpriteBank
(
IGUISpriteBank
*
bank
=
0
)
override
;
//! Sets the animated sprite for a specific button state
/** \param index: Number of the sprite within the sprite bank, use -1 for no sprite
\param state: State of the button to set the sprite for
\param index: The sprite number from the current sprite bank
\param color: The color of the sprite
*/
void
setSprite
(
EGUI_BUTTON_STATE
state
,
s32
index
,
video
::
SColor
color
=
video
::
SColor
(
255
,
255
,
255
,
255
),
bool
loop
=
false
)
override
;
//! Sets if the button should behave like a push button. Which means it
//! can be in two states: Normal or Pressed. With a click on the button,
//! the user can change the state of the button.
void
setIsPushButton
(
bool
isPushButton
=
true
)
override
;
//! Checks whether the button is a push button
bool
isPushButton
()
const
override
;
//! Sets the pressed state of the button if this is a pushbutton
void
setPressed
(
bool
pressed
=
true
)
override
;
//! Returns if the button is currently pressed
bool
isPressed
()
const
override
;
//! Sets if the button should use the skin to draw its border
void
setDrawBorder
(
bool
border
=
true
)
override
;
//! Checks if the button face and border are being drawn
bool
isDrawingBorder
()
const
override
;
//! Sets if the alpha channel should be used for drawing images on the button (default is false)
void
setUseAlphaChannel
(
bool
useAlphaChannel
=
true
)
override
;
//! Checks if the alpha channel should be used for drawing images on the button
bool
isAlphaChannelUsed
()
const
override
;
//! Sets if the button should scale the button images to fit
void
setScaleImage
(
bool
scaleImage
=
true
)
override
;
//! Checks whether the button scales the used images
bool
isScalingImage
()
const
override
;
//! Writes attributes of the element.
void
serializeAttributes
(
io
::
IAttributes
*
out
,
io
::
SAttributeReadWriteOptions
*
options
)
const
override
;
//! Reads attributes of the element
void
deserializeAttributes
(
io
::
IAttributes
*
in
,
io
::
SAttributeReadWriteOptions
*
options
)
override
;
// from ygopro
void
setDrawImage
(
bool
b
);
void
setImageRotation
(
f32
r
);
void
setImageScale
(
core
::
vector2df
s
);
void
setImageSize
(
core
::
dimension2di
s
);
protected:
struct
ButtonSprite
{
s32
Index
;
video
::
SColor
Color
;
bool
Loop
;
};
ButtonSprite
ButtonSprites
[
EGBS_COUNT
];
IGUISpriteBank
*
SpriteBank
;
IGUIFont
*
OverrideFont
;
video
::
ITexture
*
Image
;
video
::
ITexture
*
PressedImage
;
core
::
rect
<
s32
>
ImageRect
;
core
::
rect
<
s32
>
PressedImageRect
;
bool
IsPushButton
;
bool
Pressed
;
bool
UseAlphaChannel
;
bool
DrawBorder
;
bool
ScaleImage
;
// from ygopro
bool
isDrawImage
;
bool
isDrawImage
;
bool
isFixedSize
;
bool
isFixedSize
;
f32
imageRotation
;
f32
imageRotation
;
...
@@ -36,4 +155,6 @@ private:
...
@@ -36,4 +155,6 @@ private:
}
}
}
}
#endif // _IRR_COMPILE_WITH_GUI_
#endif //_C_GUI_IMAGE_BUTTON_H_
#endif //_C_GUI_IMAGE_BUTTON_H_
gframe/CGUITTFont.cpp
View file @
2b937193
...
@@ -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/config.h
View file @
2b937193
...
@@ -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>
...
@@ -43,7 +45,7 @@
...
@@ -43,7 +45,7 @@
#define mystrncasecmp strncasecmp
#define mystrncasecmp strncasecmp
#endif
#endif
#include <
stdio.h
>
#include <
cstdio
>
#include <stdlib.h>
#include <stdlib.h>
#include <iostream>
#include <iostream>
#include <algorithm>
#include <algorithm>
...
@@ -56,7 +58,7 @@ inline int myswprintf(wchar_t(&buf)[N], const wchar_t* fmt, TR... args) {
...
@@ -56,7 +58,7 @@ inline int myswprintf(wchar_t(&buf)[N], const wchar_t* fmt, TR... args) {
return
std
::
swprintf
(
buf
,
N
,
fmt
,
args
...);
return
std
::
swprintf
(
buf
,
N
,
fmt
,
args
...);
}
}
inline
FILE
*
myfopen
(
const
wchar_t
*
filename
,
const
char
*
mode
)
{
inline
FILE
*
my
w
fopen
(
const
wchar_t
*
filename
,
const
char
*
mode
)
{
FILE
*
fp
{};
FILE
*
fp
{};
#ifdef _WIN32
#ifdef _WIN32
wchar_t
wmode
[
20
]{};
wchar_t
wmode
[
20
]{};
...
@@ -65,7 +67,7 @@ inline FILE* myfopen(const wchar_t* filename, const char* mode) {
...
@@ -65,7 +67,7 @@ inline FILE* myfopen(const wchar_t* filename, const char* mode) {
#else
#else
char
fname
[
1024
]{};
char
fname
[
1024
]{};
BufferIO
::
EncodeUTF8
(
filename
,
fname
);
BufferIO
::
EncodeUTF8
(
filename
,
fname
);
fp
=
fopen
(
fname
,
mode
);
fp
=
std
::
fopen
(
fname
,
mode
);
#endif
#endif
return
fp
;
return
fp
;
}
}
...
...
gframe/data_manager.cpp
View file @
2b937193
#include "data_manager.h"
#include "data_manager.h"
#include "game.h"
#include "game.h"
#include <stdio.h>
#if !defined(YGOPRO_SERVER_MODE) || defined(SERVER_ZIP_SUPPORT)
#if !defined(YGOPRO_SERVER_MODE) || defined(SERVER_ZIP_SUPPORT)
#include "spmemvfs/spmemvfs.h"
#include "spmemvfs/spmemvfs.h"
#endif
#endif
...
@@ -132,14 +131,14 @@ bool DataManager::LoadDB(const wchar_t* wfile) {
...
@@ -132,14 +131,14 @@ bool DataManager::LoadDB(const wchar_t* wfile) {
}
}
#ifndef YGOPRO_SERVER_MODE
#ifndef YGOPRO_SERVER_MODE
bool
DataManager
::
LoadStrings
(
const
char
*
file
)
{
bool
DataManager
::
LoadStrings
(
const
char
*
file
)
{
FILE
*
fp
=
fopen
(
file
,
"r"
);
FILE
*
fp
=
std
::
fopen
(
file
,
"r"
);
if
(
!
fp
)
if
(
!
fp
)
return
false
;
return
false
;
char
linebuf
[
TEXT_LINE_SIZE
]{};
char
linebuf
[
TEXT_LINE_SIZE
]{};
while
(
fgets
(
linebuf
,
sizeof
linebuf
,
fp
))
{
while
(
std
::
fgets
(
linebuf
,
sizeof
linebuf
,
fp
))
{
ReadStringConfLine
(
linebuf
);
ReadStringConfLine
(
linebuf
);
}
}
fclose
(
fp
);
std
::
fclose
(
fp
);
return
true
;
return
true
;
}
}
bool
DataManager
::
LoadStrings
(
irr
::
io
::
IReadFile
*
reader
)
{
bool
DataManager
::
LoadStrings
(
irr
::
io
::
IReadFile
*
reader
)
{
...
@@ -163,26 +162,26 @@ void DataManager::ReadStringConfLine(const char* linebuf) {
...
@@ -163,26 +162,26 @@ void DataManager::ReadStringConfLine(const char* linebuf) {
char
strbuf
[
TEXT_LINE_SIZE
]{};
char
strbuf
[
TEXT_LINE_SIZE
]{};
int
value
{};
int
value
{};
wchar_t
strBuffer
[
4096
]{};
wchar_t
strBuffer
[
4096
]{};
if
(
sscanf
(
linebuf
,
"!%63s"
,
strbuf
)
!=
1
)
if
(
s
td
::
s
scanf
(
linebuf
,
"!%63s"
,
strbuf
)
!=
1
)
return
;
return
;
if
(
!
std
::
strcmp
(
strbuf
,
"system"
))
{
if
(
!
std
::
strcmp
(
strbuf
,
"system"
))
{
if
(
sscanf
(
&
linebuf
[
7
],
"%d %240[^
\n
]"
,
&
value
,
strbuf
)
!=
2
)
if
(
s
td
::
s
scanf
(
&
linebuf
[
7
],
"%d %240[^
\n
]"
,
&
value
,
strbuf
)
!=
2
)
return
;
return
;
BufferIO
::
DecodeUTF8
(
strbuf
,
strBuffer
);
BufferIO
::
DecodeUTF8
(
strbuf
,
strBuffer
);
_sysStrings
[
value
]
=
strBuffer
;
_sysStrings
[
value
]
=
strBuffer
;
}
else
if
(
!
std
::
strcmp
(
strbuf
,
"victory"
))
{
}
else
if
(
!
std
::
strcmp
(
strbuf
,
"victory"
))
{
if
(
sscanf
(
&
linebuf
[
8
],
"%x %240[^
\n
]"
,
&
value
,
strbuf
)
!=
2
)
if
(
s
td
::
s
scanf
(
&
linebuf
[
8
],
"%x %240[^
\n
]"
,
&
value
,
strbuf
)
!=
2
)
return
;
return
;
BufferIO
::
DecodeUTF8
(
strbuf
,
strBuffer
);
BufferIO
::
DecodeUTF8
(
strbuf
,
strBuffer
);
_victoryStrings
[
value
]
=
strBuffer
;
_victoryStrings
[
value
]
=
strBuffer
;
}
else
if
(
!
std
::
strcmp
(
strbuf
,
"counter"
))
{
}
else
if
(
!
std
::
strcmp
(
strbuf
,
"counter"
))
{
if
(
sscanf
(
&
linebuf
[
8
],
"%x %240[^
\n
]"
,
&
value
,
strbuf
)
!=
2
)
if
(
s
td
::
s
scanf
(
&
linebuf
[
8
],
"%x %240[^
\n
]"
,
&
value
,
strbuf
)
!=
2
)
return
;
return
;
BufferIO
::
DecodeUTF8
(
strbuf
,
strBuffer
);
BufferIO
::
DecodeUTF8
(
strbuf
,
strBuffer
);
_counterStrings
[
value
]
=
strBuffer
;
_counterStrings
[
value
]
=
strBuffer
;
}
else
if
(
!
std
::
strcmp
(
strbuf
,
"setname"
))
{
}
else
if
(
!
std
::
strcmp
(
strbuf
,
"setname"
))
{
//using tab for comment
//using tab for comment
if
(
sscanf
(
&
linebuf
[
8
],
"%x %240[^
\t\n
]"
,
&
value
,
strbuf
)
!=
2
)
if
(
s
td
::
s
scanf
(
&
linebuf
[
8
],
"%x %240[^
\t\n
]"
,
&
value
,
strbuf
)
!=
2
)
return
;
return
;
BufferIO
::
DecodeUTF8
(
strbuf
,
strBuffer
);
BufferIO
::
DecodeUTF8
(
strbuf
,
strBuffer
);
_setnameStrings
[
value
]
=
strBuffer
;
_setnameStrings
[
value
]
=
strBuffer
;
...
@@ -478,7 +477,7 @@ unsigned char* DataManager::ReadScriptFromIrrFS(const char* script_name, int* sl
...
@@ -478,7 +477,7 @@ unsigned char* DataManager::ReadScriptFromIrrFS(const char* script_name, int* sl
unsigned
char
*
DataManager
::
ReadScriptFromFile
(
const
char
*
script_name
,
int
*
slen
)
{
unsigned
char
*
DataManager
::
ReadScriptFromFile
(
const
char
*
script_name
,
int
*
slen
)
{
wchar_t
fname
[
256
]{};
wchar_t
fname
[
256
]{};
BufferIO
::
DecodeUTF8
(
script_name
,
fname
);
BufferIO
::
DecodeUTF8
(
script_name
,
fname
);
FILE
*
fp
=
myfopen
(
fname
,
"rb"
);
FILE
*
fp
=
my
w
fopen
(
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 @
2b937193
...
@@ -46,6 +46,14 @@ static inline bool havePopupWindow() {
...
@@ -46,6 +46,14 @@ static inline bool havePopupWindow() {
return
mainGame
->
wQuery
->
isVisible
()
||
mainGame
->
wCategories
->
isVisible
()
||
mainGame
->
wLinkMarks
->
isVisible
()
||
mainGame
->
wDeckManage
->
isVisible
()
||
mainGame
->
wDMQuery
->
isVisible
();
return
mainGame
->
wQuery
->
isVisible
()
||
mainGame
->
wCategories
->
isVisible
()
||
mainGame
->
wLinkMarks
->
isVisible
()
||
mainGame
->
wDeckManage
->
isVisible
()
||
mainGame
->
wDMQuery
->
isVisible
();
}
}
static
inline
void
get_deck_file
(
wchar_t
*
ret
)
{
deckManager
.
GetDeckFile
(
ret
,
mainGame
->
cbDBCategory
->
getSelected
(),
mainGame
->
cbDBCategory
->
getText
(),
mainGame
->
cbDBDecks
->
getText
());
}
static
inline
void
load_current_deck
(
irr
::
gui
::
IGUIComboBox
*
cbCategory
,
irr
::
gui
::
IGUIComboBox
*
cbDeck
)
{
deckManager
.
LoadCurrentDeck
(
cbCategory
->
getSelected
(),
cbCategory
->
getText
(),
cbDeck
->
getText
());
}
void
DeckBuilder
::
Initialize
()
{
void
DeckBuilder
::
Initialize
()
{
mainGame
->
is_building
=
true
;
mainGame
->
is_building
=
true
;
mainGame
->
is_siding
=
false
;
mainGame
->
is_siding
=
false
;
...
@@ -164,7 +172,7 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
...
@@ -164,7 +172,7 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
if
(
sel
==
-
1
)
if
(
sel
==
-
1
)
break
;
break
;
wchar_t
filepath
[
256
];
wchar_t
filepath
[
256
];
deckManager
.
GetDeckFile
(
filepath
,
mainGame
->
cbDBCategory
,
mainGame
->
cbDBDecks
);
get_deck_file
(
filepath
);
if
(
deckManager
.
SaveDeck
(
deckManager
.
current_deck
,
filepath
))
{
if
(
deckManager
.
SaveDeck
(
deckManager
.
current_deck
,
filepath
))
{
mainGame
->
stACMessage
->
setText
(
dataManager
.
GetSysString
(
1335
));
mainGame
->
stACMessage
->
setText
(
dataManager
.
GetSysString
(
1335
));
mainGame
->
PopupElement
(
mainGame
->
wACMessage
,
20
);
mainGame
->
PopupElement
(
mainGame
->
wACMessage
,
20
);
...
@@ -480,7 +488,7 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
...
@@ -480,7 +488,7 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
int
decksel
=
mainGame
->
lstDecks
->
getSelected
();
int
decksel
=
mainGame
->
lstDecks
->
getSelected
();
const
wchar_t
*
catename
=
mainGame
->
lstCategories
->
getListItem
(
catesel
);
const
wchar_t
*
catename
=
mainGame
->
lstCategories
->
getListItem
(
catesel
);
wchar_t
oldfilepath
[
256
];
wchar_t
oldfilepath
[
256
];
deckManager
.
GetDeckFile
(
oldfilepath
,
mainGame
->
cbDBCategory
,
mainGame
->
cbDBDecks
);
get_deck_file
(
oldfilepath
);
const
wchar_t
*
newdeckname
=
mainGame
->
ebDMName
->
getText
();
const
wchar_t
*
newdeckname
=
mainGame
->
ebDMName
->
getText
();
wchar_t
newfilepath
[
256
];
wchar_t
newfilepath
[
256
];
if
(
catesel
==
2
)
{
if
(
catesel
==
2
)
{
...
@@ -512,7 +520,7 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
...
@@ -512,7 +520,7 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
case
BUTTON_DELETE_DECK_DM
:
{
case
BUTTON_DELETE_DECK_DM
:
{
int
decksel
=
mainGame
->
lstDecks
->
getSelected
();
int
decksel
=
mainGame
->
lstDecks
->
getSelected
();
wchar_t
filepath
[
256
];
wchar_t
filepath
[
256
];
deckManager
.
GetDeckFile
(
filepath
,
mainGame
->
cbDBCategory
,
mainGame
->
cbDBDecks
);
get_deck_file
(
filepath
);
if
(
deckManager
.
DeleteDeck
(
filepath
))
{
if
(
deckManager
.
DeleteDeck
(
filepath
))
{
mainGame
->
lstDecks
->
removeItem
(
decksel
);
mainGame
->
lstDecks
->
removeItem
(
decksel
);
mainGame
->
cbDBDecks
->
removeItem
(
decksel
);
mainGame
->
cbDBDecks
->
removeItem
(
decksel
);
...
@@ -523,7 +531,7 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
...
@@ -523,7 +531,7 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
if
(
decksel
!=
-
1
)
{
if
(
decksel
!=
-
1
)
{
mainGame
->
lstDecks
->
setSelected
(
decksel
);
mainGame
->
lstDecks
->
setSelected
(
decksel
);
mainGame
->
cbDBDecks
->
setSelected
(
decksel
);
mainGame
->
cbDBDecks
->
setSelected
(
decksel
);
deckManager
.
LoadCurrentD
eck
(
mainGame
->
cbDBCategory
,
mainGame
->
cbDBDecks
);
load_current_d
eck
(
mainGame
->
cbDBCategory
,
mainGame
->
cbDBDecks
);
}
}
RefreshReadonly
(
prev_category
);
RefreshReadonly
(
prev_category
);
prev_deck
=
decksel
;
prev_deck
=
decksel
;
...
@@ -542,7 +550,7 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
...
@@ -542,7 +550,7 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
wchar_t
deckname
[
256
];
wchar_t
deckname
[
256
];
BufferIO
::
CopyWideString
(
olddeckname
,
deckname
);
BufferIO
::
CopyWideString
(
olddeckname
,
deckname
);
wchar_t
oldfilepath
[
256
];
wchar_t
oldfilepath
[
256
];
deckManager
.
GetDeckFile
(
oldfilepath
,
mainGame
->
cbDBCategory
,
mainGame
->
cbDBDecks
);
get_deck_file
(
oldfilepath
);
wchar_t
newfilepath
[
256
];
wchar_t
newfilepath
[
256
];
if
(
oldcatesel
!=
2
&&
newcatesel
==
0
)
{
if
(
oldcatesel
!=
2
&&
newcatesel
==
0
)
{
myswprintf
(
newfilepath
,
L"./deck/%ls.ydk"
,
deckname
);
myswprintf
(
newfilepath
,
L"./deck/%ls.ydk"
,
deckname
);
...
@@ -651,7 +659,7 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
...
@@ -651,7 +659,7 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
break
;
break
;
}
}
case
BUTTON_SIDE_RELOAD
:
{
case
BUTTON_SIDE_RELOAD
:
{
deckManager
.
LoadCurrentD
eck
(
mainGame
->
cbCategorySelect
,
mainGame
->
cbDeckSelect
);
load_current_d
eck
(
mainGame
->
cbCategorySelect
,
mainGame
->
cbDeckSelect
);
break
;
break
;
}
}
case
BUTTON_BIG_CARD_ORIG_SIZE
:
{
case
BUTTON_BIG_CARD_ORIG_SIZE
:
{
...
@@ -689,7 +697,7 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
...
@@ -689,7 +697,7 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
int
sel
=
prev_sel
;
int
sel
=
prev_sel
;
mainGame
->
cbDBDecks
->
setSelected
(
sel
);
mainGame
->
cbDBDecks
->
setSelected
(
sel
);
wchar_t
filepath
[
256
];
wchar_t
filepath
[
256
];
deckManager
.
GetDeckFile
(
filepath
,
mainGame
->
cbDBCategory
,
mainGame
->
cbDBDecks
);
get_deck_file
(
filepath
);
if
(
deckManager
.
DeleteDeck
(
filepath
))
{
if
(
deckManager
.
DeleteDeck
(
filepath
))
{
mainGame
->
cbDBDecks
->
removeItem
(
sel
);
mainGame
->
cbDBDecks
->
removeItem
(
sel
);
int
count
=
mainGame
->
cbDBDecks
->
getItemCount
();
int
count
=
mainGame
->
cbDBDecks
->
getItemCount
();
...
@@ -697,7 +705,7 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
...
@@ -697,7 +705,7 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
sel
=
count
-
1
;
sel
=
count
-
1
;
mainGame
->
cbDBDecks
->
setSelected
(
sel
);
mainGame
->
cbDBDecks
->
setSelected
(
sel
);
if
(
sel
!=
-
1
)
if
(
sel
!=
-
1
)
deckManager
.
LoadCurrentD
eck
(
mainGame
->
cbDBCategory
,
mainGame
->
cbDBDecks
);
load_current_d
eck
(
mainGame
->
cbDBCategory
,
mainGame
->
cbDBDecks
);
mainGame
->
stACMessage
->
setText
(
dataManager
.
GetSysString
(
1338
));
mainGame
->
stACMessage
->
setText
(
dataManager
.
GetSysString
(
1338
));
mainGame
->
PopupElement
(
mainGame
->
wACMessage
,
20
);
mainGame
->
PopupElement
(
mainGame
->
wACMessage
,
20
);
prev_deck
=
sel
;
prev_deck
=
sel
;
...
@@ -711,7 +719,7 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
...
@@ -711,7 +719,7 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
ChangeCategory
(
catesel
);
ChangeCategory
(
catesel
);
}
else
if
(
prev_operation
==
COMBOBOX_DBDECKS
)
{
}
else
if
(
prev_operation
==
COMBOBOX_DBDECKS
)
{
int
decksel
=
mainGame
->
cbDBDecks
->
getSelected
();
int
decksel
=
mainGame
->
cbDBDecks
->
getSelected
();
deckManager
.
LoadCurrentD
eck
(
mainGame
->
cbDBCategory
,
mainGame
->
cbDBDecks
);
load_current_d
eck
(
mainGame
->
cbDBCategory
,
mainGame
->
cbDBDecks
);
prev_deck
=
decksel
;
prev_deck
=
decksel
;
is_modified
=
false
;
is_modified
=
false
;
}
else
if
(
prev_operation
==
BUTTON_MANAGE_DECK
)
{
}
else
if
(
prev_operation
==
BUTTON_MANAGE_DECK
)
{
...
@@ -828,7 +836,7 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
...
@@ -828,7 +836,7 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
}
}
int
decksel
=
mainGame
->
cbDBDecks
->
getSelected
();
int
decksel
=
mainGame
->
cbDBDecks
->
getSelected
();
if
(
decksel
>=
0
)
{
if
(
decksel
>=
0
)
{
deckManager
.
LoadCurrentD
eck
(
mainGame
->
cbDBCategory
,
mainGame
->
cbDBDecks
);
load_current_d
eck
(
mainGame
->
cbDBCategory
,
mainGame
->
cbDBDecks
);
}
}
prev_deck
=
decksel
;
prev_deck
=
decksel
;
is_modified
=
false
;
is_modified
=
false
;
...
@@ -1216,7 +1224,7 @@ void DeckBuilder::GetHoveredCard() {
...
@@ -1216,7 +1224,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
;
...
@@ -1630,7 +1638,7 @@ void DeckBuilder::ChangeCategory(int catesel) {
...
@@ -1630,7 +1638,7 @@ void DeckBuilder::ChangeCategory(int catesel) {
mainGame
->
RefreshDeck
(
mainGame
->
cbDBCategory
,
mainGame
->
cbDBDecks
);
mainGame
->
RefreshDeck
(
mainGame
->
cbDBCategory
,
mainGame
->
cbDBDecks
);
mainGame
->
cbDBDecks
->
setSelected
(
0
);
mainGame
->
cbDBDecks
->
setSelected
(
0
);
RefreshReadonly
(
catesel
);
RefreshReadonly
(
catesel
);
deckManager
.
LoadCurrentD
eck
(
mainGame
->
cbDBCategory
,
mainGame
->
cbDBDecks
);
load_current_d
eck
(
mainGame
->
cbDBCategory
,
mainGame
->
cbDBDecks
);
is_modified
=
false
;
is_modified
=
false
;
prev_category
=
catesel
;
prev_category
=
catesel
;
prev_deck
=
0
;
prev_deck
=
0
;
...
...
gframe/deck_con.h
View file @
2b937193
#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 @
2b937193
#include "deck_manager.h"
#include "deck_manager.h"
#include "game.h"
#include "myfilesystem.h"
#include "myfilesystem.h"
#include "network.h"
#include "network.h"
#include "game.h"
namespace
ygo
{
namespace
ygo
{
...
@@ -12,42 +12,39 @@ DeckManager deckManager;
...
@@ -12,42 +12,39 @@ DeckManager deckManager;
void
DeckManager
::
LoadLFListSingle
(
const
char
*
path
)
{
void
DeckManager
::
LoadLFListSingle
(
const
char
*
path
)
{
auto
cur
=
_lfList
.
rend
();
auto
cur
=
_lfList
.
rend
();
FILE
*
fp
=
fopen
(
path
,
"r"
);
FILE
*
fp
=
std
::
fopen
(
path
,
"r"
);
char
linebuf
[
256
]{};
char
linebuf
[
256
]{};
wchar_t
strBuffer
[
256
]{};
wchar_t
strBuffer
[
256
]{};
if
(
fp
)
{
if
(
fp
)
{
while
(
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
]
==
'!'
)
{
int
sa
=
BufferIO
::
DecodeUTF8
(
&
linebuf
[
1
],
strBuffer
);
auto
len
=
std
::
strcspn
(
linebuf
,
"
\r\n
"
);
while
(
strBuffer
[
sa
-
1
]
==
L'\r'
||
strBuffer
[
sa
-
1
]
==
L'\n'
)
linebuf
[
len
]
=
0
;
sa
--
;
BufferIO
::
DecodeUTF8
(
&
linebuf
[
1
],
strBuffer
);
strBuffer
[
sa
]
=
0
;
LFList
newlist
;
LFList
newlist
;
newlist
.
listName
=
strBuffer
;
newlist
.
hash
=
0x7dfcee6a
;
_lfList
.
push_back
(
newlist
);
_lfList
.
push_back
(
newlist
);
cur
=
_lfList
.
rbegin
();
cur
=
_lfList
.
rbegin
();
cur
->
listName
=
strBuffer
;
cur
->
hash
=
0x7dfcee6a
;
continue
;
continue
;
}
}
if
(
linebuf
[
0
]
==
0
)
if
(
cur
==
_lfList
.
rend
()
)
continue
;
continue
;
int
code
=
0
;
int
code
=
0
;
int
count
=
-
1
;
int
count
=
-
1
;
if
(
s
scanf
(
linebuf
,
"%d %
d"
,
&
code
,
&
count
)
!=
2
)
if
(
s
td
::
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
)));
}
}
fclose
(
fp
);
std
::
fclose
(
fp
);
}
}
}
}
void
DeckManager
::
LoadLFList
()
{
void
DeckManager
::
LoadLFList
()
{
...
@@ -193,25 +190,29 @@ int DeckManager::LoadDeck(Deck& deck, int* dbuf, int mainc, int sidec, bool is_p
...
@@ -193,25 +190,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
;
...
@@ -262,12 +263,11 @@ void DeckManager::GetCategoryPath(wchar_t* ret, int index, const wchar_t* text)
...
@@ -262,12 +263,11 @@ void DeckManager::GetCategoryPath(wchar_t* ret, int index, const wchar_t* text)
}
}
BufferIO
::
CopyWStr
(
catepath
,
ret
,
256
);
BufferIO
::
CopyWStr
(
catepath
,
ret
,
256
);
}
}
void
DeckManager
::
GetDeckFile
(
wchar_t
*
ret
,
i
rr
::
gui
::
IGUIComboBox
*
cbCategory
,
irr
::
gui
::
IGUIComboBox
*
cbDeck
)
{
void
DeckManager
::
GetDeckFile
(
wchar_t
*
ret
,
i
nt
category_index
,
const
wchar_t
*
category_name
,
const
wchar_t
*
deckname
)
{
wchar_t
filepath
[
256
];
wchar_t
filepath
[
256
];
wchar_t
catepath
[
256
];
wchar_t
catepath
[
256
];
const
wchar_t
*
deckname
=
cbDeck
->
getItem
(
cbDeck
->
getSelected
());
if
(
deckname
!=
nullptr
)
{
if
(
deckname
!=
nullptr
)
{
GetCategoryPath
(
catepath
,
c
bCategory
->
getSelected
(),
cbCategory
->
getText
()
);
GetCategoryPath
(
catepath
,
c
ategory_index
,
category_name
);
myswprintf
(
filepath
,
L"%ls/%ls.ydk"
,
catepath
,
deckname
);
myswprintf
(
filepath
,
L"%ls/%ls.ydk"
,
catepath
,
deckname
);
BufferIO
::
CopyWStr
(
filepath
,
ret
,
256
);
BufferIO
::
CopyWStr
(
filepath
,
ret
,
256
);
}
}
...
@@ -276,16 +276,16 @@ void DeckManager::GetDeckFile(wchar_t* ret, irr::gui::IGUIComboBox* cbCategory,
...
@@ -276,16 +276,16 @@ void DeckManager::GetDeckFile(wchar_t* ret, irr::gui::IGUIComboBox* cbCategory,
}
}
}
}
FILE
*
DeckManager
::
OpenDeckFile
(
const
wchar_t
*
file
,
const
char
*
mode
)
{
FILE
*
DeckManager
::
OpenDeckFile
(
const
wchar_t
*
file
,
const
char
*
mode
)
{
FILE
*
fp
=
myfopen
(
file
,
mode
);
FILE
*
fp
=
my
w
fopen
(
file
,
mode
);
return
fp
;
return
fp
;
}
}
IReadFile
*
DeckManager
::
OpenDeckReader
(
const
wchar_t
*
file
)
{
irr
::
io
::
IReadFile
*
DeckManager
::
OpenDeckReader
(
const
wchar_t
*
file
)
{
#ifdef _WIN32
#ifdef _WIN32
IReadFile
*
reader
=
DataManager
::
FileSystem
->
createAndOpenFile
(
file
);
auto
reader
=
DataManager
::
FileSystem
->
createAndOpenFile
(
file
);
#else
#else
char
file2
[
256
];
char
file2
[
256
];
BufferIO
::
EncodeUTF8
(
file
,
file2
);
BufferIO
::
EncodeUTF8
(
file
,
file2
);
IReadFile
*
reader
=
DataManager
::
FileSystem
->
createAndOpenFile
(
file2
);
auto
reader
=
DataManager
::
FileSystem
->
createAndOpenFile
(
file2
);
#endif
#endif
return
reader
;
return
reader
;
}
}
...
@@ -314,10 +314,10 @@ bool DeckManager::LoadCurrentDeck(const wchar_t* file, bool is_packlist) {
...
@@ -314,10 +314,10 @@ bool DeckManager::LoadCurrentDeck(const wchar_t* file, bool is_packlist) {
LoadDeck
(
current_deck
,
deckStream
,
is_packlist
);
LoadDeck
(
current_deck
,
deckStream
,
is_packlist
);
return
true
;
// the above LoadDeck has return value but we ignore it here for now
return
true
;
// the above LoadDeck has return value but we ignore it here for now
}
}
bool
DeckManager
::
LoadCurrentDeck
(
i
rr
::
gui
::
IGUIComboBox
*
cbCategory
,
irr
::
gui
::
IGUIComboBox
*
cbDeck
)
{
bool
DeckManager
::
LoadCurrentDeck
(
i
nt
category_index
,
const
wchar_t
*
category_name
,
const
wchar_t
*
deckname
)
{
wchar_t
filepath
[
256
];
wchar_t
filepath
[
256
];
GetDeckFile
(
filepath
,
c
bCategory
,
cbDeck
);
GetDeckFile
(
filepath
,
c
ategory_index
,
category_name
,
deckname
);
bool
is_packlist
=
cbCategory
->
getSelected
()
==
0
;
bool
is_packlist
=
(
category_index
==
0
)
;
bool
res
=
LoadCurrentDeck
(
filepath
,
is_packlist
);
bool
res
=
LoadCurrentDeck
(
filepath
,
is_packlist
);
if
(
res
&&
mainGame
->
is_building
)
if
(
res
&&
mainGame
->
is_building
)
mainGame
->
deckBuilder
.
RefreshPackListScroll
();
mainGame
->
deckBuilder
.
RefreshPackListScroll
();
...
@@ -329,16 +329,16 @@ bool DeckManager::SaveDeck(Deck& deck, const wchar_t* file) {
...
@@ -329,16 +329,16 @@ bool DeckManager::SaveDeck(Deck& deck, const wchar_t* file) {
FILE
*
fp
=
OpenDeckFile
(
file
,
"w"
);
FILE
*
fp
=
OpenDeckFile
(
file
,
"w"
);
if
(
!
fp
)
if
(
!
fp
)
return
false
;
return
false
;
fprintf
(
fp
,
"#created by ...
\n
#main
\n
"
);
std
::
fprintf
(
fp
,
"#created by ...
\n
#main
\n
"
);
for
(
size_t
i
=
0
;
i
<
deck
.
main
.
size
();
++
i
)
for
(
size_t
i
=
0
;
i
<
deck
.
main
.
size
();
++
i
)
fprintf
(
fp
,
"%d
\n
"
,
deck
.
main
[
i
]
->
first
);
std
::
fprintf
(
fp
,
"%d
\n
"
,
deck
.
main
[
i
]
->
first
);
fprintf
(
fp
,
"#extra
\n
"
);
std
::
fprintf
(
fp
,
"#extra
\n
"
);
for
(
size_t
i
=
0
;
i
<
deck
.
extra
.
size
();
++
i
)
for
(
size_t
i
=
0
;
i
<
deck
.
extra
.
size
();
++
i
)
fprintf
(
fp
,
"%d
\n
"
,
deck
.
extra
[
i
]
->
first
);
std
::
fprintf
(
fp
,
"%d
\n
"
,
deck
.
extra
[
i
]
->
first
);
fprintf
(
fp
,
"!side
\n
"
);
std
::
fprintf
(
fp
,
"!side
\n
"
);
for
(
size_t
i
=
0
;
i
<
deck
.
side
.
size
();
++
i
)
for
(
size_t
i
=
0
;
i
<
deck
.
side
.
size
();
++
i
)
fprintf
(
fp
,
"%d
\n
"
,
deck
.
side
[
i
]
->
first
);
std
::
fprintf
(
fp
,
"%d
\n
"
,
deck
.
side
[
i
]
->
first
);
fclose
(
fp
);
std
::
fclose
(
fp
);
return
true
;
return
true
;
}
}
bool
DeckManager
::
DeleteDeck
(
const
wchar_t
*
file
)
{
bool
DeckManager
::
DeleteDeck
(
const
wchar_t
*
file
)
{
...
@@ -388,26 +388,26 @@ bool DeckManager::SaveDeckBuffer(const int deckbuf[], const wchar_t* name) {
...
@@ -388,26 +388,26 @@ bool DeckManager::SaveDeckBuffer(const int deckbuf[], const wchar_t* name) {
int
it
=
0
;
int
it
=
0
;
const
int
mainc
=
deckbuf
[
it
];
const
int
mainc
=
deckbuf
[
it
];
++
it
;
++
it
;
fprintf
(
fp
,
"#created by ...
\n
#main
\n
"
);
std
::
fprintf
(
fp
,
"#created by ...
\n
#main
\n
"
);
for
(
int
i
=
0
;
i
<
mainc
;
++
i
)
{
for
(
int
i
=
0
;
i
<
mainc
;
++
i
)
{
fprintf
(
fp
,
"%d
\n
"
,
deckbuf
[
it
]);
std
::
fprintf
(
fp
,
"%d
\n
"
,
deckbuf
[
it
]);
++
it
;
++
it
;
}
}
const
int
extrac
=
deckbuf
[
it
];
const
int
extrac
=
deckbuf
[
it
];
++
it
;
++
it
;
fprintf
(
fp
,
"#extra
\n
"
);
std
::
fprintf
(
fp
,
"#extra
\n
"
);
for
(
int
i
=
0
;
i
<
extrac
;
++
i
)
{
for
(
int
i
=
0
;
i
<
extrac
;
++
i
)
{
fprintf
(
fp
,
"%d
\n
"
,
deckbuf
[
it
]);
std
::
fprintf
(
fp
,
"%d
\n
"
,
deckbuf
[
it
]);
++
it
;
++
it
;
}
}
const
int
sidec
=
deckbuf
[
it
];
const
int
sidec
=
deckbuf
[
it
];
++
it
;
++
it
;
fprintf
(
fp
,
"!side
\n
"
);
std
::
fprintf
(
fp
,
"!side
\n
"
);
for
(
int
i
=
0
;
i
<
sidec
;
++
i
)
{
for
(
int
i
=
0
;
i
<
sidec
;
++
i
)
{
fprintf
(
fp
,
"%d
\n
"
,
deckbuf
[
it
]);
std
::
fprintf
(
fp
,
"%d
\n
"
,
deckbuf
[
it
]);
++
it
;
++
it
;
}
}
fclose
(
fp
);
std
::
fclose
(
fp
);
return
true
;
return
true
;
}
}
#endif //YGOPRO_SERVER_MODE
#endif //YGOPRO_SERVER_MODE
...
...
gframe/deck_manager.h
View file @
2b937193
#ifndef DECKMANAGER_H
#ifndef DECKMANAGER_H
#define DECKMANAGER_H
#define DECKMANAGER_H
#include "config.h"
#include "data_manager.h"
#include <unordered_map>
#include <unordered_map>
#include <vector>
#include <vector>
#include <sstream>
#include <sstream>
#include "data_manager.h"
#ifndef YGOPRO_MAX_DECK
#ifndef YGOPRO_MAX_DECK
#define YGOPRO_MAX_DECK 60
#define YGOPRO_MAX_DECK 60
...
@@ -39,7 +38,7 @@ struct Deck {
...
@@ -39,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
;
...
@@ -71,11 +70,11 @@ public:
...
@@ -71,11 +70,11 @@ public:
bool
LoadSide
(
Deck
&
deck
,
int
*
dbuf
,
int
mainc
,
int
sidec
);
bool
LoadSide
(
Deck
&
deck
,
int
*
dbuf
,
int
mainc
,
int
sidec
);
#ifndef YGOPRO_SERVER_MODE
#ifndef YGOPRO_SERVER_MODE
void
GetCategoryPath
(
wchar_t
*
ret
,
int
index
,
const
wchar_t
*
text
);
void
GetCategoryPath
(
wchar_t
*
ret
,
int
index
,
const
wchar_t
*
text
);
void
GetDeckFile
(
wchar_t
*
ret
,
i
rr
::
gui
::
IGUIComboBox
*
cbCategory
,
irr
::
gui
::
IGUIComboBox
*
cbDeck
);
void
GetDeckFile
(
wchar_t
*
ret
,
i
nt
category_index
,
const
wchar_t
*
category_name
,
const
wchar_t
*
deckname
);
FILE
*
OpenDeckFile
(
const
wchar_t
*
file
,
const
char
*
mode
);
FILE
*
OpenDeckFile
(
const
wchar_t
*
file
,
const
char
*
mode
);
IReadFile
*
OpenDeckReader
(
const
wchar_t
*
file
);
irr
::
io
::
IReadFile
*
OpenDeckReader
(
const
wchar_t
*
file
);
bool
LoadCurrentDeck
(
const
wchar_t
*
file
,
bool
is_packlist
=
false
);
bool
LoadCurrentDeck
(
const
wchar_t
*
file
,
bool
is_packlist
=
false
);
bool
LoadCurrentDeck
(
i
rr
::
gui
::
IGUIComboBox
*
cbCategory
,
irr
::
gui
::
IGUIComboBox
*
cbDeck
);
bool
LoadCurrentDeck
(
i
nt
category_index
,
const
wchar_t
*
category_name
,
const
wchar_t
*
deckname
);
bool
SaveDeck
(
Deck
&
deck
,
const
wchar_t
*
file
);
bool
SaveDeck
(
Deck
&
deck
,
const
wchar_t
*
file
);
bool
DeleteDeck
(
const
wchar_t
*
file
);
bool
DeleteDeck
(
const
wchar_t
*
file
);
bool
CreateCategory
(
const
wchar_t
*
name
);
bool
CreateCategory
(
const
wchar_t
*
name
);
...
...
gframe/drawing.cpp
View file @
2b937193
...
@@ -874,15 +874,15 @@ void Game::DrawSpec() {
...
@@ -874,15 +874,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
;
...
@@ -896,8 +896,8 @@ void Game::DrawSpec() {
...
@@ -896,8 +896,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
)
...
@@ -1020,7 +1020,7 @@ void Game::DrawSpec() {
...
@@ -1020,7 +1020,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
);
...
@@ -1041,7 +1041,7 @@ void Game::ShowElement(irr::gui::IGUIElement * win, int autoframe) {
...
@@ -1041,7 +1041,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
;
...
@@ -1126,7 +1126,7 @@ void Game::WaitFrameSignal(int frame) {
...
@@ -1126,7 +1126,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
)
...
@@ -1217,7 +1217,7 @@ void Game::DrawDeckBd() {
...
@@ -1217,7 +1217,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
));
}
}
...
@@ -1233,7 +1233,7 @@ void Game::DrawDeckBd() {
...
@@ -1233,7 +1233,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
));
}
}
...
@@ -1248,7 +1248,7 @@ void Game::DrawDeckBd() {
...
@@ -1248,7 +1248,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
));
}
}
...
@@ -1275,7 +1275,7 @@ void Game::DrawDeckBd() {
...
@@ -1275,7 +1275,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]"
;
...
@@ -1325,7 +1325,7 @@ void Game::DrawDeckBd() {
...
@@ -1325,7 +1325,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 @
2b937193
...
@@ -1073,8 +1073,8 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
...
@@ -1073,8 +1073,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
)
...
@@ -1496,8 +1496,8 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
...
@@ -1496,8 +1496,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
];
...
@@ -1554,7 +1554,7 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
...
@@ -1554,7 +1554,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
)
{
...
@@ -2078,7 +2078,7 @@ bool ClientField::OnCommonEvent(const irr::SEvent& event) {
...
@@ -2078,7 +2078,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
();
...
@@ -2315,22 +2315,22 @@ void ClientField::ShowMenu(int flag, int x, int y) {
...
@@ -2315,22 +2315,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
)
{
...
@@ -2339,7 +2339,7 @@ void ClientField::ShowMenu(int flag, int x, int y) {
...
@@ -2339,7 +2339,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
)
{
...
@@ -2350,27 +2350,27 @@ void ClientField::ShowMenu(int flag, int x, int y) {
...
@@ -2350,27 +2350,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 @
2b937193
This diff is collapsed.
Click to expand it.
gframe/game.h
View file @
2b937193
...
@@ -37,6 +37,7 @@ constexpr int TEXT_LINE_SIZE = 256;
...
@@ -37,6 +37,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
);
#ifndef YGOPRO_SERVER_MODE
#ifndef YGOPRO_SERVER_MODE
struct
Config
{
struct
Config
{
...
@@ -184,7 +185,7 @@ public:
...
@@ -184,7 +185,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
();
void
LoadConfig
();
void
LoadConfig
();
void
SaveConfig
();
void
SaveConfig
();
...
@@ -220,15 +221,15 @@ public:
...
@@ -220,15 +221,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 @
2b937193
...
@@ -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
;
...
...
gframe/image_manager.cpp
View file @
2b937193
...
@@ -234,10 +234,10 @@ irr::video::ITexture* ImageManager::GetTexture(int code, bool fit) {
...
@@ -234,10 +234,10 @@ irr::video::ITexture* ImageManager::GetTexture(int code, bool fit) {
auto
tit
=
tMap
[
fit
?
1
:
0
].
find
(
code
);
auto
tit
=
tMap
[
fit
?
1
:
0
].
find
(
code
);
if
(
tit
==
tMap
[
fit
?
1
:
0
].
end
())
{
if
(
tit
==
tMap
[
fit
?
1
:
0
].
end
())
{
char
file
[
256
];
char
file
[
256
];
snprintf
(
file
,
sizeof
file
,
"expansions/pics/%d.jpg"
,
code
);
s
td
::
s
nprintf
(
file
,
sizeof
file
,
"expansions/pics/%d.jpg"
,
code
);
irr
::
video
::
ITexture
*
img
=
GetTextureFromFile
(
file
,
width
,
height
);
irr
::
video
::
ITexture
*
img
=
GetTextureFromFile
(
file
,
width
,
height
);
if
(
img
==
nullptr
)
{
if
(
img
==
nullptr
)
{
snprintf
(
file
,
sizeof
file
,
"pics/%d.jpg"
,
code
);
s
td
::
s
nprintf
(
file
,
sizeof
file
,
"pics/%d.jpg"
,
code
);
img
=
GetTextureFromFile
(
file
,
width
,
height
);
img
=
GetTextureFromFile
(
file
,
width
,
height
);
}
}
if
(
img
==
nullptr
&&
!
mainGame
->
gameConf
.
use_image_scale
)
{
if
(
img
==
nullptr
&&
!
mainGame
->
gameConf
.
use_image_scale
)
{
...
@@ -261,10 +261,10 @@ irr::video::ITexture* ImageManager::GetBigPicture(int code, float zoom) {
...
@@ -261,10 +261,10 @@ irr::video::ITexture* ImageManager::GetBigPicture(int code, float zoom) {
}
}
irr
::
video
::
ITexture
*
texture
;
irr
::
video
::
ITexture
*
texture
;
char
file
[
256
];
char
file
[
256
];
snprintf
(
file
,
sizeof
file
,
"expansions/pics/%d.jpg"
,
code
);
s
td
::
s
nprintf
(
file
,
sizeof
file
,
"expansions/pics/%d.jpg"
,
code
);
irr
::
video
::
IImage
*
srcimg
=
driver
->
createImageFromFile
(
file
);
irr
::
video
::
IImage
*
srcimg
=
driver
->
createImageFromFile
(
file
);
if
(
srcimg
==
nullptr
)
{
if
(
srcimg
==
nullptr
)
{
snprintf
(
file
,
sizeof
file
,
"pics/%d.jpg"
,
code
);
s
td
::
s
nprintf
(
file
,
sizeof
file
,
"pics/%d.jpg"
,
code
);
srcimg
=
driver
->
createImageFromFile
(
file
);
srcimg
=
driver
->
createImageFromFile
(
file
);
}
}
if
(
srcimg
==
nullptr
)
{
if
(
srcimg
==
nullptr
)
{
...
@@ -290,18 +290,18 @@ int ImageManager::LoadThumbThread() {
...
@@ -290,18 +290,18 @@ int ImageManager::LoadThumbThread() {
imageManager
.
tThumbLoadingCodes
.
pop
();
imageManager
.
tThumbLoadingCodes
.
pop
();
imageManager
.
tThumbLoadingMutex
.
unlock
();
imageManager
.
tThumbLoadingMutex
.
unlock
();
char
file
[
256
];
char
file
[
256
];
snprintf
(
file
,
sizeof
file
,
"expansions/pics/thumbnail/%d.jpg"
,
code
);
s
td
::
s
nprintf
(
file
,
sizeof
file
,
"expansions/pics/thumbnail/%d.jpg"
,
code
);
irr
::
video
::
IImage
*
img
=
imageManager
.
driver
->
createImageFromFile
(
file
);
irr
::
video
::
IImage
*
img
=
imageManager
.
driver
->
createImageFromFile
(
file
);
if
(
img
==
nullptr
)
{
if
(
img
==
nullptr
)
{
snprintf
(
file
,
sizeof
file
,
"pics/thumbnail/%d.jpg"
,
code
);
s
td
::
s
nprintf
(
file
,
sizeof
file
,
"pics/thumbnail/%d.jpg"
,
code
);
img
=
imageManager
.
driver
->
createImageFromFile
(
file
);
img
=
imageManager
.
driver
->
createImageFromFile
(
file
);
}
}
if
(
img
==
nullptr
&&
mainGame
->
gameConf
.
use_image_scale
)
{
if
(
img
==
nullptr
&&
mainGame
->
gameConf
.
use_image_scale
)
{
snprintf
(
file
,
sizeof
file
,
"expansions/pics/%d.jpg"
,
code
);
s
td
::
s
nprintf
(
file
,
sizeof
file
,
"expansions/pics/%d.jpg"
,
code
);
img
=
imageManager
.
driver
->
createImageFromFile
(
file
);
img
=
imageManager
.
driver
->
createImageFromFile
(
file
);
}
}
if
(
img
==
nullptr
&&
mainGame
->
gameConf
.
use_image_scale
)
{
if
(
img
==
nullptr
&&
mainGame
->
gameConf
.
use_image_scale
)
{
snprintf
(
file
,
sizeof
file
,
"pics/%d.jpg"
,
code
);
s
td
::
s
nprintf
(
file
,
sizeof
file
,
"pics/%d.jpg"
,
code
);
img
=
imageManager
.
driver
->
createImageFromFile
(
file
);
img
=
imageManager
.
driver
->
createImageFromFile
(
file
);
}
}
if
(
img
!=
nullptr
)
{
if
(
img
!=
nullptr
)
{
...
@@ -346,7 +346,7 @@ irr::video::ITexture* ImageManager::GetTextureThumb(int code) {
...
@@ -346,7 +346,7 @@ irr::video::ITexture* ImageManager::GetTextureThumb(int code) {
if
(
lit
!=
tThumbLoading
.
end
())
{
if
(
lit
!=
tThumbLoading
.
end
())
{
if
(
lit
->
second
!=
nullptr
)
{
if
(
lit
->
second
!=
nullptr
)
{
char
file
[
256
];
char
file
[
256
];
snprintf
(
file
,
sizeof
file
,
"pics/thumbnail/%d.jpg"
,
code
);
s
td
::
s
nprintf
(
file
,
sizeof
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
irr
::
video
::
ITexture
*
texture
=
driver
->
addTexture
(
file
,
lit
->
second
);
// textures must be added in the main thread due to OpenGL
lit
->
second
->
drop
();
lit
->
second
->
drop
();
tThumb
[
code
]
=
texture
;
tThumb
[
code
]
=
texture
;
...
@@ -379,18 +379,18 @@ irr::video::ITexture* ImageManager::GetTextureField(int code) {
...
@@ -379,18 +379,18 @@ irr::video::ITexture* ImageManager::GetTextureField(int code) {
auto
tit
=
tFields
.
find
(
code
);
auto
tit
=
tFields
.
find
(
code
);
if
(
tit
==
tFields
.
end
())
{
if
(
tit
==
tFields
.
end
())
{
char
file
[
256
];
char
file
[
256
];
snprintf
(
file
,
sizeof
file
,
"expansions/pics/field/%d.png"
,
code
);
s
td
::
s
nprintf
(
file
,
sizeof
file
,
"expansions/pics/field/%d.png"
,
code
);
irr
::
video
::
ITexture
*
img
=
GetTextureFromFile
(
file
,
512
*
mainGame
->
xScale
,
512
*
mainGame
->
yScale
);
irr
::
video
::
ITexture
*
img
=
GetTextureFromFile
(
file
,
512
*
mainGame
->
xScale
,
512
*
mainGame
->
yScale
);
if
(
img
==
nullptr
)
{
if
(
img
==
nullptr
)
{
snprintf
(
file
,
sizeof
file
,
"expansions/pics/field/%d.jpg"
,
code
);
s
td
::
s
nprintf
(
file
,
sizeof
file
,
"expansions/pics/field/%d.jpg"
,
code
);
img
=
GetTextureFromFile
(
file
,
512
*
mainGame
->
xScale
,
512
*
mainGame
->
yScale
);
img
=
GetTextureFromFile
(
file
,
512
*
mainGame
->
xScale
,
512
*
mainGame
->
yScale
);
}
}
if
(
img
==
nullptr
)
{
if
(
img
==
nullptr
)
{
snprintf
(
file
,
sizeof
file
,
"pics/field/%d.png"
,
code
);
s
td
::
s
nprintf
(
file
,
sizeof
file
,
"pics/field/%d.png"
,
code
);
img
=
GetTextureFromFile
(
file
,
512
*
mainGame
->
xScale
,
512
*
mainGame
->
yScale
);
img
=
GetTextureFromFile
(
file
,
512
*
mainGame
->
xScale
,
512
*
mainGame
->
yScale
);
}
}
if
(
img
==
nullptr
)
{
if
(
img
==
nullptr
)
{
snprintf
(
file
,
sizeof
file
,
"pics/field/%d.jpg"
,
code
);
s
td
::
s
nprintf
(
file
,
sizeof
file
,
"pics/field/%d.jpg"
,
code
);
img
=
GetTextureFromFile
(
file
,
512
*
mainGame
->
xScale
,
512
*
mainGame
->
yScale
);
img
=
GetTextureFromFile
(
file
,
512
*
mainGame
->
xScale
,
512
*
mainGame
->
yScale
);
if
(
img
==
nullptr
)
{
if
(
img
==
nullptr
)
{
tFields
[
code
]
=
nullptr
;
tFields
[
code
]
=
nullptr
;
...
...
gframe/materials.cpp
View file @
2b937193
This diff is collapsed.
Click to expand it.
gframe/materials.h
View file @
2b937193
#include "config.h"
#ifndef MATERIALS_H
#define MATERIALS_H
#include <irrlicht.h>
namespace
ygo
{
namespace
ygo
{
...
@@ -7,31 +10,31 @@ public:
...
@@ -7,31 +10,31 @@ 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
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
;
...
@@ -44,3 +47,5 @@ public:
...
@@ -44,3 +47,5 @@ public:
extern
Materials
matManager
;
extern
Materials
matManager
;
}
}
#endif //MATERIALS_H
gframe/menu_handler.cpp
View file @
2b937193
...
@@ -176,7 +176,7 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
...
@@ -176,7 +176,7 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
}
}
case
BUTTON_HP_READY
:
{
case
BUTTON_HP_READY
:
{
if
(
mainGame
->
cbCategorySelect
->
getSelected
()
==
-
1
||
mainGame
->
cbDeckSelect
->
getSelected
()
==
-
1
||
if
(
mainGame
->
cbCategorySelect
->
getSelected
()
==
-
1
||
mainGame
->
cbDeckSelect
->
getSelected
()
==
-
1
||
!
deckManager
.
LoadCurrentDeck
(
mainGame
->
cbCategorySelect
,
mainGame
->
cbDeckSelect
))
{
!
deckManager
.
LoadCurrentDeck
(
mainGame
->
cbCategorySelect
->
getSelected
(),
mainGame
->
cbCategorySelect
->
getText
(),
mainGame
->
cbDeckSelect
->
getText
()
))
{
mainGame
->
gMutex
.
lock
();
mainGame
->
gMutex
.
lock
();
soundManager
.
PlaySoundEffect
(
SOUND_INFO
);
soundManager
.
PlaySoundEffect
(
SOUND_INFO
);
mainGame
->
env
->
addMessageBox
(
L""
,
dataManager
.
GetSysString
(
1406
));
mainGame
->
env
->
addMessageBox
(
L""
,
dataManager
.
GetSysString
(
1406
));
...
@@ -367,7 +367,7 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
...
@@ -367,7 +367,7 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
wchar_t
arg1
[
512
];
wchar_t
arg1
[
512
];
if
(
mainGame
->
botInfo
[
sel
].
select_deckfile
)
{
if
(
mainGame
->
botInfo
[
sel
].
select_deckfile
)
{
wchar_t
botdeck
[
256
];
wchar_t
botdeck
[
256
];
deckManager
.
GetDeckFile
(
botdeck
,
mainGame
->
cbBotDeckCategory
,
mainGame
->
cbBotDeck
);
deckManager
.
GetDeckFile
(
botdeck
,
mainGame
->
cbBotDeckCategory
->
getSelected
(),
mainGame
->
cbBotDeckCategory
->
getText
(),
mainGame
->
cbBotDeck
->
getText
()
);
myswprintf
(
arg1
,
L"%ls DeckFile='%ls'"
,
mainGame
->
botInfo
[
sel
].
command
,
botdeck
);
myswprintf
(
arg1
,
L"%ls DeckFile='%ls'"
,
mainGame
->
botInfo
[
sel
].
command
,
botdeck
);
}
}
else
else
...
@@ -386,7 +386,7 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
...
@@ -386,7 +386,7 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
wchar_t
warg1
[
512
];
wchar_t
warg1
[
512
];
if
(
mainGame
->
botInfo
[
sel
].
select_deckfile
)
{
if
(
mainGame
->
botInfo
[
sel
].
select_deckfile
)
{
wchar_t
botdeck
[
256
];
wchar_t
botdeck
[
256
];
deckManager
.
GetDeckFile
(
botdeck
,
mainGame
->
cbBotDeckCategory
,
mainGame
->
cbBotDeck
);
deckManager
.
GetDeckFile
(
botdeck
,
mainGame
->
cbBotDeckCategory
->
getSelected
(),
mainGame
->
cbBotDeckCategory
->
getText
(),
mainGame
->
cbBotDeck
->
getText
()
);
myswprintf
(
warg1
,
L"%ls DeckFile='%ls'"
,
mainGame
->
botInfo
[
sel
].
command
,
botdeck
);
myswprintf
(
warg1
,
L"%ls DeckFile='%ls'"
,
mainGame
->
botInfo
[
sel
].
command
,
botdeck
);
}
}
else
else
...
@@ -396,9 +396,9 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
...
@@ -396,9 +396,9 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
int
flag
=
0
;
int
flag
=
0
;
flag
+=
(
mainGame
->
chkBotHand
->
isChecked
()
?
0x1
:
0
);
flag
+=
(
mainGame
->
chkBotHand
->
isChecked
()
?
0x1
:
0
);
char
arg2
[
8
];
char
arg2
[
8
];
snprintf
(
arg2
,
sizeof
arg2
,
"%d"
,
flag
);
s
td
::
s
nprintf
(
arg2
,
sizeof
arg2
,
"%d"
,
flag
);
char
arg3
[
8
];
char
arg3
[
8
];
snprintf
(
arg3
,
sizeof
arg3
,
"%d"
,
mainGame
->
gameConf
.
serverport
);
s
td
::
s
nprintf
(
arg3
,
sizeof
arg3
,
"%d"
,
mainGame
->
gameConf
.
serverport
);
execl
(
"./bot"
,
"bot"
,
arg1
,
arg2
,
arg3
,
nullptr
);
execl
(
"./bot"
,
"bot"
,
arg1
,
arg2
,
arg3
,
nullptr
);
exit
(
0
);
exit
(
0
);
}
else
{
}
else
{
...
@@ -472,7 +472,7 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
...
@@ -472,7 +472,7 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
open_file
=
false
;
open_file
=
false
;
}
}
else
if
(
mainGame
->
cbDBCategory
->
getSelected
()
!=
-
1
&&
mainGame
->
cbDBDecks
->
getSelected
()
!=
-
1
)
{
else
if
(
mainGame
->
cbDBCategory
->
getSelected
()
!=
-
1
&&
mainGame
->
cbDBDecks
->
getSelected
()
!=
-
1
)
{
deckManager
.
LoadCurrentDeck
(
mainGame
->
cbDBCategory
,
mainGame
->
cbDBDecks
);
deckManager
.
LoadCurrentDeck
(
mainGame
->
cbDBCategory
->
getSelected
(),
mainGame
->
cbDBCategory
->
getText
(),
mainGame
->
cbDBDecks
->
getText
()
);
mainGame
->
ebDeckname
->
setText
(
L""
);
mainGame
->
ebDeckname
->
setText
(
L""
);
}
}
mainGame
->
HideElement
(
mainGame
->
wMainMenu
);
mainGame
->
HideElement
(
mainGame
->
wMainMenu
);
...
@@ -581,7 +581,7 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
...
@@ -581,7 +581,7 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
const
wchar_t
*
name
=
mainGame
->
lstSinglePlayList
->
getListItem
(
sel
);
const
wchar_t
*
name
=
mainGame
->
lstSinglePlayList
->
getListItem
(
sel
);
wchar_t
fname
[
256
];
wchar_t
fname
[
256
];
myswprintf
(
fname
,
L"./single/%ls"
,
name
);
myswprintf
(
fname
,
L"./single/%ls"
,
name
);
FILE
*
fp
=
myfopen
(
fname
,
"rb"
);
FILE
*
fp
=
my
w
fopen
(
fname
,
"rb"
);
if
(
!
fp
)
{
if
(
!
fp
)
{
mainGame
->
stSinglePlayInfo
->
setText
(
L""
);
mainGame
->
stSinglePlayInfo
->
setText
(
L""
);
break
;
break
;
...
@@ -590,7 +590,7 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
...
@@ -590,7 +590,7 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
wchar_t
wlinebuf
[
1024
];
wchar_t
wlinebuf
[
1024
];
std
::
wstring
message
=
L""
;
std
::
wstring
message
=
L""
;
bool
in_message
=
false
;
bool
in_message
=
false
;
while
(
fgets
(
linebuf
,
1024
,
fp
))
{
while
(
std
::
fgets
(
linebuf
,
1024
,
fp
))
{
if
(
!
std
::
strncmp
(
linebuf
,
"--[[message"
,
11
))
{
if
(
!
std
::
strncmp
(
linebuf
,
"--[[message"
,
11
))
{
size_t
len
=
std
::
strlen
(
linebuf
);
size_t
len
=
std
::
strlen
(
linebuf
);
char
*
msgend
=
std
::
strrchr
(
linebuf
,
']'
);
char
*
msgend
=
std
::
strrchr
(
linebuf
,
']'
);
...
@@ -613,7 +613,7 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
...
@@ -613,7 +613,7 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
message
.
append
(
wlinebuf
);
message
.
append
(
wlinebuf
);
}
}
}
}
fclose
(
fp
);
std
::
fclose
(
fp
);
mainGame
->
SetStaticText
(
mainGame
->
stSinglePlayInfo
,
200
,
mainGame
->
guiFont
,
message
.
c_str
());
mainGame
->
SetStaticText
(
mainGame
->
stSinglePlayInfo
,
200
,
mainGame
->
guiFont
,
message
.
c_str
());
break
;
break
;
}
}
...
@@ -637,7 +637,7 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
...
@@ -637,7 +637,7 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
mainGame
->
env
->
setFocus
(
mainGame
->
wHostPrepare
);
mainGame
->
env
->
setFocus
(
mainGame
->
wHostPrepare
);
if
(
static_cast
<
irr
::
gui
::
IGUICheckBox
*>
(
caller
)
->
isChecked
())
{
if
(
static_cast
<
irr
::
gui
::
IGUICheckBox
*>
(
caller
)
->
isChecked
())
{
if
(
mainGame
->
cbCategorySelect
->
getSelected
()
==
-
1
||
mainGame
->
cbDeckSelect
->
getSelected
()
==
-
1
||
if
(
mainGame
->
cbCategorySelect
->
getSelected
()
==
-
1
||
mainGame
->
cbDeckSelect
->
getSelected
()
==
-
1
||
!
deckManager
.
LoadCurrentDeck
(
mainGame
->
cbCategorySelect
,
mainGame
->
cbDeckSelect
))
{
!
deckManager
.
LoadCurrentDeck
(
mainGame
->
cbCategorySelect
->
getSelected
(),
mainGame
->
cbCategorySelect
->
getText
(),
mainGame
->
cbDeckSelect
->
getText
()
))
{
mainGame
->
gMutex
.
lock
();
mainGame
->
gMutex
.
lock
();
static_cast
<
irr
::
gui
::
IGUICheckBox
*>
(
caller
)
->
setChecked
(
false
);
static_cast
<
irr
::
gui
::
IGUICheckBox
*>
(
caller
)
->
setChecked
(
false
);
soundManager
.
PlaySoundEffect
(
SOUND_INFO
);
soundManager
.
PlaySoundEffect
(
SOUND_INFO
);
...
...
gframe/menu_handler.h
View file @
2b937193
#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
}
;
};
};
...
...
gframe/myfilesystem.h
View file @
2b937193
...
@@ -94,7 +94,7 @@ public:
...
@@ -94,7 +94,7 @@ public:
if
(
fh
==
INVALID_HANDLE_VALUE
)
if
(
fh
==
INVALID_HANDLE_VALUE
)
return
;
return
;
do
{
do
{
if
(
mywcsncasecmp
(
fdataw
.
cFileName
,
L"."
,
1
)
&&
mywcsncasecmp
(
fdataw
.
cFileName
,
L".."
,
2
))
if
(
std
::
wcscmp
(
fdataw
.
cFileName
,
L"."
)
&&
std
::
wcscmp
(
fdataw
.
cFileName
,
L".."
))
cb
(
fdataw
.
cFileName
,
(
fdataw
.
dwFileAttributes
&
FILE_ATTRIBUTE_DIRECTORY
));
cb
(
fdataw
.
cFileName
,
(
fdataw
.
dwFileAttributes
&
FILE_ATTRIBUTE_DIRECTORY
));
}
while
(
FindNextFileW
(
fh
,
&
fdataw
));
}
while
(
FindNextFileW
(
fh
,
&
fdataw
));
FindClose
(
fh
);
FindClose
(
fh
);
...
@@ -228,7 +228,7 @@ public:
...
@@ -228,7 +228,7 @@ public:
#else
#else
funit
.
filename
=
std
::
string
(
dirp
->
d_name
);
funit
.
filename
=
std
::
string
(
dirp
->
d_name
);
funit
.
is_dir
=
S_ISDIR
(
fileStat
.
st_mode
);
funit
.
is_dir
=
S_ISDIR
(
fileStat
.
st_mode
);
if
(
funit
.
is_dir
&&
(
st
rcmp
(
dirp
->
d_name
,
"."
)
==
0
||
strcmp
(
dirp
->
d_name
,
".."
)
==
0
))
if
(
funit
.
is_dir
&&
(
st
d
::
strcmp
(
dirp
->
d_name
,
"."
)
==
0
||
std
::
strcmp
(
dirp
->
d_name
,
".."
)
==
0
))
continue
;
continue
;
file_list
.
push_back
(
funit
);
file_list
.
push_back
(
funit
);
#endif
#endif
...
...
gframe/replay.cpp
View file @
2b937193
...
@@ -40,7 +40,7 @@ void Replay::BeginRecord() {
...
@@ -40,7 +40,7 @@ void Replay::BeginRecord() {
return
;
return
;
#else
#else
if
(
is_recording
)
if
(
is_recording
)
fclose
(
fp
);
std
::
fclose
(
fp
);
#ifdef YGOPRO_SERVER_MODE
#ifdef YGOPRO_SERVER_MODE
time_t
nowtime
=
time
(
NULL
);
time_t
nowtime
=
time
(
NULL
);
struct
tm
*
localedtime
=
localtime
(
&
nowtime
);
struct
tm
*
localedtime
=
localtime
(
&
nowtime
);
...
@@ -48,9 +48,9 @@ void Replay::BeginRecord() {
...
@@ -48,9 +48,9 @@ void Replay::BeginRecord() {
strftime
(
tmppath
,
40
,
"./replay/%Y-%m-%d %H-%M-%S %%u.yrp"
,
localedtime
);
strftime
(
tmppath
,
40
,
"./replay/%Y-%m-%d %H-%M-%S %%u.yrp"
,
localedtime
);
char
path
[
40
];
char
path
[
40
];
sprintf
(
path
,
tmppath
,
server_port
);
sprintf
(
path
,
tmppath
,
server_port
);
fp
=
fopen
(
path
,
"wb"
);
fp
=
std
::
fopen
(
path
,
"wb"
);
#else
#else
fp
=
fopen
(
"./replay/_LastReplay.yrp"
,
"wb"
);
fp
=
std
::
fopen
(
"./replay/_LastReplay.yrp"
,
"wb"
);
#endif //YGOPRO_SERVER_MODE
#endif //YGOPRO_SERVER_MODE
if
(
!
fp
)
if
(
!
fp
)
return
;
return
;
...
@@ -72,8 +72,8 @@ void Replay::WriteHeader(ReplayHeader& header) {
...
@@ -72,8 +72,8 @@ void Replay::WriteHeader(ReplayHeader& header) {
DWORD
size
;
DWORD
size
;
WriteFile
(
recording_fp
,
&
header
,
sizeof
(
header
),
&
size
,
nullptr
);
WriteFile
(
recording_fp
,
&
header
,
sizeof
(
header
),
&
size
,
nullptr
);
#else
#else
fwrite
(
&
header
,
sizeof
(
header
),
1
,
fp
);
std
::
fwrite
(
&
header
,
sizeof
(
header
),
1
,
fp
);
fflush
(
fp
);
std
::
fflush
(
fp
);
#endif
#endif
}
}
void
Replay
::
WriteData
(
const
void
*
data
,
size_t
length
,
bool
flush
)
{
void
Replay
::
WriteData
(
const
void
*
data
,
size_t
length
,
bool
flush
)
{
...
@@ -90,9 +90,9 @@ void Replay::WriteData(const void* data, size_t length, bool flush) {
...
@@ -90,9 +90,9 @@ void Replay::WriteData(const void* data, size_t length, bool flush) {
DWORD
size
;
DWORD
size
;
WriteFile
(
recording_fp
,
data
,
length
,
&
size
,
nullptr
);
WriteFile
(
recording_fp
,
data
,
length
,
&
size
,
nullptr
);
#else
#else
fwrite
(
data
,
length
,
1
,
fp
);
std
::
fwrite
(
data
,
length
,
1
,
fp
);
if
(
flush
)
if
(
flush
)
fflush
(
fp
);
std
::
fflush
(
fp
);
#endif
#endif
}
}
void
Replay
::
WriteInt32
(
int32_t
data
,
bool
flush
)
{
void
Replay
::
WriteInt32
(
int32_t
data
,
bool
flush
)
{
...
@@ -106,7 +106,7 @@ void Replay::Flush() {
...
@@ -106,7 +106,7 @@ void Replay::Flush() {
#endif
#endif
#ifdef _WIN32
#ifdef _WIN32
#else
#else
fflush
(
fp
);
std
::
fflush
(
fp
);
#endif
#endif
}
}
void
Replay
::
EndRecord
()
{
void
Replay
::
EndRecord
()
{
...
@@ -118,7 +118,7 @@ void Replay::EndRecord() {
...
@@ -118,7 +118,7 @@ void Replay::EndRecord() {
#ifdef _WIN32
#ifdef _WIN32
CloseHandle
(
recording_fp
);
CloseHandle
(
recording_fp
);
#else
#else
fclose
(
fp
);
std
::
fclose
(
fp
);
#endif
#endif
#ifdef YGOPRO_SERVER_MODE
#ifdef YGOPRO_SERVER_MODE
}
}
...
@@ -139,19 +139,19 @@ void Replay::SaveReplay(const wchar_t* name) {
...
@@ -139,19 +139,19 @@ void Replay::SaveReplay(const wchar_t* name) {
return
;
return
;
wchar_t
fname
[
256
];
wchar_t
fname
[
256
];
myswprintf
(
fname
,
L"./replay/%ls.yrp"
,
name
);
myswprintf
(
fname
,
L"./replay/%ls.yrp"
,
name
);
FILE
*
rfp
=
myfopen
(
fname
,
"wb"
);
FILE
*
rfp
=
my
w
fopen
(
fname
,
"wb"
);
if
(
!
rfp
)
if
(
!
rfp
)
return
;
return
;
fwrite
(
&
pheader
,
sizeof
pheader
,
1
,
rfp
);
std
::
fwrite
(
&
pheader
,
sizeof
pheader
,
1
,
rfp
);
fwrite
(
comp_data
,
comp_size
,
1
,
rfp
);
std
::
fwrite
(
comp_data
,
comp_size
,
1
,
rfp
);
fclose
(
rfp
);
std
::
fclose
(
rfp
);
}
}
bool
Replay
::
OpenReplay
(
const
wchar_t
*
name
)
{
bool
Replay
::
OpenReplay
(
const
wchar_t
*
name
)
{
FILE
*
rfp
=
myfopen
(
name
,
"rb"
);
FILE
*
rfp
=
my
w
fopen
(
name
,
"rb"
);
if
(
!
rfp
)
{
if
(
!
rfp
)
{
wchar_t
fname
[
256
];
wchar_t
fname
[
256
];
myswprintf
(
fname
,
L"./replay/%ls"
,
name
);
myswprintf
(
fname
,
L"./replay/%ls"
,
name
);
rfp
=
myfopen
(
fname
,
"rb"
);
rfp
=
my
w
fopen
(
fname
,
"rb"
);
}
}
if
(
!
rfp
)
if
(
!
rfp
)
return
false
;
return
false
;
...
@@ -161,13 +161,13 @@ bool Replay::OpenReplay(const wchar_t* name) {
...
@@ -161,13 +161,13 @@ bool Replay::OpenReplay(const wchar_t* name) {
is_replaying
=
false
;
is_replaying
=
false
;
replay_size
=
0
;
replay_size
=
0
;
comp_size
=
0
;
comp_size
=
0
;
if
(
fread
(
&
pheader
,
sizeof
pheader
,
1
,
rfp
)
<
1
)
{
if
(
std
::
fread
(
&
pheader
,
sizeof
pheader
,
1
,
rfp
)
<
1
)
{
fclose
(
rfp
);
std
::
fclose
(
rfp
);
return
false
;
return
false
;
}
}
if
(
pheader
.
flag
&
REPLAY_COMPRESSED
)
{
if
(
pheader
.
flag
&
REPLAY_COMPRESSED
)
{
comp_size
=
fread
(
comp_data
,
1
,
MAX_COMP_SIZE
,
rfp
);
comp_size
=
std
::
fread
(
comp_data
,
1
,
MAX_COMP_SIZE
,
rfp
);
fclose
(
rfp
);
std
::
fclose
(
rfp
);
if
(
pheader
.
datasize
>
MAX_REPLAY_SIZE
)
if
(
pheader
.
datasize
>
MAX_REPLAY_SIZE
)
return
false
;
return
false
;
replay_size
=
pheader
.
datasize
;
replay_size
=
pheader
.
datasize
;
...
@@ -178,8 +178,8 @@ bool Replay::OpenReplay(const wchar_t* name) {
...
@@ -178,8 +178,8 @@ bool Replay::OpenReplay(const wchar_t* name) {
return
false
;
return
false
;
}
}
}
else
{
}
else
{
replay_size
=
fread
(
replay_data
,
1
,
MAX_REPLAY_SIZE
,
rfp
);
replay_size
=
std
::
fread
(
replay_data
,
1
,
MAX_REPLAY_SIZE
,
rfp
);
fclose
(
rfp
);
std
::
fclose
(
rfp
);
comp_size
=
0
;
comp_size
=
0
;
}
}
is_replaying
=
true
;
is_replaying
=
true
;
...
@@ -188,12 +188,12 @@ bool Replay::OpenReplay(const wchar_t* name) {
...
@@ -188,12 +188,12 @@ bool Replay::OpenReplay(const wchar_t* name) {
bool
Replay
::
CheckReplay
(
const
wchar_t
*
name
)
{
bool
Replay
::
CheckReplay
(
const
wchar_t
*
name
)
{
wchar_t
fname
[
256
];
wchar_t
fname
[
256
];
myswprintf
(
fname
,
L"./replay/%ls"
,
name
);
myswprintf
(
fname
,
L"./replay/%ls"
,
name
);
FILE
*
rfp
=
myfopen
(
fname
,
"rb"
);
FILE
*
rfp
=
my
w
fopen
(
fname
,
"rb"
);
if
(
!
rfp
)
if
(
!
rfp
)
return
false
;
return
false
;
ReplayHeader
rheader
;
ReplayHeader
rheader
;
size_t
count
=
fread
(
&
rheader
,
sizeof
rheader
,
1
,
rfp
);
size_t
count
=
std
::
fread
(
&
rheader
,
sizeof
rheader
,
1
,
rfp
);
fclose
(
rfp
);
std
::
fclose
(
rfp
);
return
count
==
1
&&
rheader
.
id
==
0x31707279
&&
rheader
.
version
>=
0x12d0u
&&
(
rheader
.
version
<
0x1353u
||
(
rheader
.
flag
&
REPLAY_UNIFORM
));
return
count
==
1
&&
rheader
.
id
==
0x31707279
&&
rheader
.
version
>=
0x12d0u
&&
(
rheader
.
version
<
0x1353u
||
(
rheader
.
flag
&
REPLAY_UNIFORM
));
}
}
bool
Replay
::
DeleteReplay
(
const
wchar_t
*
name
)
{
bool
Replay
::
DeleteReplay
(
const
wchar_t
*
name
)
{
...
...
premake/freetype/premake5.lua
View file @
2b937193
...
@@ -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"
}
...
...
premake/gframe/ygopro.rc
View file @
2b937193
1 ICON "ygopro.ico"
1 ICON "ygopro.ico"
1 VERSIONINFO
1 VERSIONINFO
FILEVERSION 1, 0, 3
5, 3
FILEVERSION 1, 0, 3
6, 1
PRODUCTVERSION 1, 0, 3
5, 3
PRODUCTVERSION 1, 0, 3
6, 1
FILEOS 0x4
FILEOS 0x4
FILETYPE 0x1
FILETYPE 0x1
...
@@ -13,11 +13,11 @@ BLOCK "080404b0"
...
@@ -13,11 +13,11 @@ BLOCK "080404b0"
BEGIN
BEGIN
VALUE "FileDescription", "YGOPro Server Mode"
VALUE "FileDescription", "YGOPro Server Mode"
VALUE "InternalName", "YGOPro Server Mode"
VALUE "InternalName", "YGOPro Server Mode"
VALUE "LegalCopyright", "Copyright (C) 202
2
Fluorohydride"
VALUE "LegalCopyright", "Copyright (C) 202
5
Fluorohydride"
VALUE "OriginalFilename", "YGOPro.exe"
VALUE "OriginalFilename", "YGOPro.exe"
VALUE "ProductName", "YGOPro Server Mode"
VALUE "ProductName", "YGOPro Server Mode"
VALUE "FileVersion", "1.03
5.3
"
VALUE "FileVersion", "1.03
6.1
"
VALUE "ProductVersion", "1.03
5.3
"
VALUE "ProductVersion", "1.03
6.1
"
END
END
END
END
BLOCK "VarFileInfo"
BLOCK "VarFileInfo"
...
...
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