Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Y
ygopro
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
YGOPRO-520DIY
ygopro
Commits
4ed0c5f4
Commit
4ed0c5f4
authored
May 26, 2025
by
mercury233
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'fh' into patch-build-all
parents
2d86d0c3
051949fb
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
44 additions
and
37 deletions
+44
-37
gframe/game.cpp
gframe/game.cpp
+5
-19
gframe/game.h
gframe/game.h
+17
-2
gframe/image_manager.cpp
gframe/image_manager.cpp
+4
-4
gframe/menu_handler.cpp
gframe/menu_handler.cpp
+10
-9
gframe/menu_handler.h
gframe/menu_handler.h
+2
-1
gframe/replay.cpp
gframe/replay.cpp
+5
-1
gframe/replay.h
gframe/replay.h
+1
-0
gframe/replay_mode.h
gframe/replay_mode.h
+0
-1
No files found.
gframe/game.cpp
View file @
4ed0c5f4
...
...
@@ -50,22 +50,6 @@ void DuelInfo::Clear() {
time_left
[
1
]
=
0
;
}
bool
IsExtension
(
const
wchar_t
*
filename
,
const
wchar_t
*
extension
)
{
auto
flen
=
std
::
wcslen
(
filename
);
auto
elen
=
std
::
wcslen
(
extension
);
if
(
!
elen
||
flen
<
elen
)
return
false
;
return
!
mywcsncasecmp
(
filename
+
(
flen
-
elen
),
extension
,
elen
);
}
bool
IsExtension
(
const
char
*
filename
,
const
char
*
extension
)
{
auto
flen
=
std
::
strlen
(
filename
);
auto
elen
=
std
::
strlen
(
extension
);
if
(
!
elen
||
flen
<
elen
)
return
false
;
return
!
mystrncasecmp
(
filename
+
(
flen
-
elen
),
extension
,
elen
);
}
bool
Game
::
Initialize
()
{
LoadConfig
();
irr
::
SIrrlichtCreationParameters
params
{};
...
...
@@ -1141,19 +1125,21 @@ std::wstring Game::SetStaticText(irr::gui::IGUIStaticText* pControl, irr::u32 cW
}
void
Game
::
LoadExpansions
()
{
FileSystem
::
TraversalDir
(
L"./expansions"
,
[](
const
wchar_t
*
name
,
bool
isdir
)
{
if
(
isdir
)
return
;
wchar_t
fpath
[
1024
];
myswprintf
(
fpath
,
L"./expansions/%ls"
,
name
);
if
(
!
isdir
&&
IsExtension
(
name
,
L".cdb"
))
{
if
(
IsExtension
(
name
,
L".cdb"
))
{
dataManager
.
LoadDB
(
fpath
);
return
;
}
if
(
!
isdir
&&
IsExtension
(
name
,
L".conf"
))
{
if
(
IsExtension
(
name
,
L".conf"
))
{
char
upath
[
1024
];
BufferIO
::
EncodeUTF8
(
fpath
,
upath
);
dataManager
.
LoadStrings
(
upath
);
return
;
}
if
(
!
isdir
&&
(
IsExtension
(
name
,
L".zip"
)
||
IsExtension
(
name
,
L".ypk"
)
))
{
if
(
IsExtension
(
name
,
L".zip"
)
||
IsExtension
(
name
,
L".ypk"
))
{
#ifdef _WIN32
DataManager
::
FileSystem
->
addFileArchive
(
fpath
,
true
,
false
,
irr
::
io
::
EFAT_ZIP
);
#else
...
...
gframe/game.h
View file @
4ed0c5f4
...
...
@@ -28,8 +28,23 @@ constexpr int TEXT_LINE_SIZE = 256;
namespace
ygo
{
bool
IsExtension
(
const
wchar_t
*
filename
,
const
wchar_t
*
extension
);
bool
IsExtension
(
const
char
*
filename
,
const
char
*
extension
);
template
<
size_t
N
>
bool
IsExtension
(
const
wchar_t
*
filename
,
const
wchar_t
(
&
extension
)[
N
])
{
auto
flen
=
std
::
wcslen
(
filename
);
constexpr
size_t
elen
=
N
-
1
;
if
(
!
elen
||
flen
<
elen
)
return
false
;
return
!
mywcsncasecmp
(
filename
+
(
flen
-
elen
),
extension
,
elen
);
}
template
<
size_t
N
>
bool
IsExtension
(
const
char
*
filename
,
const
char
(
&
extension
)[
N
])
{
auto
flen
=
std
::
strlen
(
filename
);
constexpr
size_t
elen
=
N
-
1
;
if
(
!
elen
||
flen
<
elen
)
return
false
;
return
!
mystrncasecmp
(
filename
+
(
flen
-
elen
),
extension
,
elen
);
}
struct
Config
{
bool
use_d3d
{
false
};
...
...
gframe/image_manager.cpp
View file @
4ed0c5f4
...
...
@@ -143,8 +143,8 @@ void ImageManager::ResizeTexture() {
}
// function by Warr1024, from https://github.com/minetest/minetest/issues/2419 , modified
void
imageScaleNNAA
(
irr
::
video
::
IImage
*
src
,
irr
::
video
::
IImage
*
dest
)
{
const
irr
::
core
::
dimension2d
<
irr
::
u32
>
srcDim
=
src
->
getDimension
();
const
irr
::
core
::
dimension2d
<
irr
::
u32
>
destDim
=
dest
->
getDimension
();
const
auto
&
srcDim
=
src
->
getDimension
();
const
auto
&
destDim
=
dest
->
getDimension
();
// Cache scale ratios.
const
double
rx
=
(
double
)
srcDim
.
Width
/
destDim
.
Width
;
...
...
@@ -157,8 +157,8 @@ void imageScaleNNAA(irr::video::IImage *src, irr::video::IImage *dest) {
// Walk each destination image pixel.
#pragma omp for schedule(dynamic)
for
(
irr
::
s32
dy
=
0
;
dy
<
destDim
.
Height
;
dy
++
)
{
for
(
irr
::
s32
dx
=
0
;
dx
<
destDim
.
Width
;
dx
++
)
{
for
(
irr
::
s32
dy
=
0
;
dy
<
(
irr
::
s32
)
destDim
.
Height
;
dy
++
)
{
for
(
irr
::
s32
dx
=
0
;
dx
<
(
irr
::
s32
)
destDim
.
Width
;
dx
++
)
{
// Calculate floating-point source rectangle bounds.
minsx
=
dx
*
rx
;
maxsx
=
minsx
+
rx
;
...
...
gframe/menu_handler.cpp
View file @
4ed0c5f4
...
...
@@ -232,6 +232,7 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
break
;
}
case
BUTTON_LOAD_REPLAY
:
{
int
start_turn
=
1
;
if
(
open_file
)
{
ReplayMode
::
cur_replay
.
OpenReplay
(
open_file_name
);
open_file
=
false
;
...
...
@@ -243,6 +244,7 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
myswprintf
(
replay_path
,
L"./replay/%ls"
,
mainGame
->
lstReplayList
->
getListItem
(
selected
));
if
(
!
ReplayMode
::
cur_replay
.
OpenReplay
(
replay_path
))
break
;
start_turn
=
std
::
wcstol
(
mainGame
->
ebRepStartTurn
->
getText
(),
nullptr
,
10
);
}
mainGame
->
ClearCardInfo
();
mainGame
->
wCardImg
->
setVisible
(
true
);
...
...
@@ -257,7 +259,6 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
mainGame
->
dField
.
Clear
();
mainGame
->
HideElement
(
mainGame
->
wReplay
);
mainGame
->
device
->
setEventReceiver
(
&
mainGame
->
dField
);
unsigned
int
start_turn
=
std
::
wcstol
(
mainGame
->
ebRepStartTurn
->
getText
(),
nullptr
,
10
);
if
(
start_turn
==
1
)
start_turn
=
0
;
ReplayMode
::
StartReplay
(
start_turn
);
...
...
@@ -526,27 +527,27 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
break
;
wchar_t
replay_path
[
256
]{};
myswprintf
(
replay_path
,
L"./replay/%ls"
,
mainGame
->
lstReplayList
->
getListItem
(
sel
));
if
(
!
ReplayMode
::
cur
_replay
.
OpenReplay
(
replay_path
))
{
if
(
!
temp
_replay
.
OpenReplay
(
replay_path
))
{
mainGame
->
stReplayInfo
->
setText
(
L"Error"
);
break
;
}
wchar_t
infobuf
[
256
]{};
std
::
wstring
repinfo
;
time_t
curtime
;
if
(
ReplayMode
::
cur
_replay
.
pheader
.
flag
&
REPLAY_UNIFORM
)
curtime
=
ReplayMode
::
cur
_replay
.
pheader
.
start_time
;
if
(
temp
_replay
.
pheader
.
flag
&
REPLAY_UNIFORM
)
curtime
=
temp
_replay
.
pheader
.
start_time
;
else
curtime
=
ReplayMode
::
cur
_replay
.
pheader
.
seed
;
curtime
=
temp
_replay
.
pheader
.
seed
;
std
::
wcsftime
(
infobuf
,
sizeof
infobuf
/
sizeof
infobuf
[
0
],
L"%Y/%m/%d %H:%M:%S
\n
"
,
std
::
localtime
(
&
curtime
));
repinfo
.
append
(
infobuf
);
if
(
ReplayMode
::
cur
_replay
.
pheader
.
flag
&
REPLAY_SINGLE_MODE
)
{
if
(
temp
_replay
.
pheader
.
flag
&
REPLAY_SINGLE_MODE
)
{
wchar_t
path
[
256
]{};
BufferIO
::
DecodeUTF8
(
ReplayMode
::
cur
_replay
.
script_name
.
c_str
(),
path
);
BufferIO
::
DecodeUTF8
(
temp
_replay
.
script_name
.
c_str
(),
path
);
repinfo
.
append
(
path
);
repinfo
.
append
(
L"
\n
"
);
}
const
auto
&
player_names
=
ReplayMode
::
cur
_replay
.
players
;
if
(
ReplayMode
::
cur
_replay
.
pheader
.
flag
&
REPLAY_TAG
)
const
auto
&
player_names
=
temp
_replay
.
players
;
if
(
temp
_replay
.
pheader
.
flag
&
REPLAY_TAG
)
myswprintf
(
infobuf
,
L"%ls
\n
%ls
\n
===VS===
\n
%ls
\n
%ls
\n
"
,
player_names
[
0
].
c_str
(),
player_names
[
1
].
c_str
(),
player_names
[
2
].
c_str
(),
player_names
[
3
].
c_str
());
else
myswprintf
(
infobuf
,
L"%ls
\n
===VS===
\n
%ls
\n
"
,
player_names
[
0
].
c_str
(),
player_names
[
1
].
c_str
());
...
...
gframe/menu_handler.h
View file @
4ed0c5f4
...
...
@@ -2,6 +2,7 @@
#define MENU_HANDLER_H
#include <irrlicht.h>
#include "replay.h"
namespace
ygo
{
...
...
@@ -10,7 +11,7 @@ public:
bool
OnEvent
(
const
irr
::
SEvent
&
event
)
override
;
irr
::
s32
prev_operation
{
0
};
int
prev_sel
{
-
1
};
Replay
temp_replay
;
};
}
...
...
gframe/replay.cpp
View file @
4ed0c5f4
...
...
@@ -227,7 +227,11 @@ void Replay::Reset() {
script_name
.
clear
();
}
void
Replay
::
SkipInfo
(){
data_position
+=
info_offset
;
if
(
data_position
==
0
)
data_position
+=
info_offset
;
}
bool
Replay
::
IsReplaying
()
const
{
return
is_replaying
;
}
bool
Replay
::
ReadInfo
()
{
int
player_count
=
(
pheader
.
flag
&
REPLAY_TAG
)
?
4
:
2
;
...
...
gframe/replay.h
View file @
4ed0c5f4
...
...
@@ -81,6 +81,7 @@ public:
void
Rewind
();
void
Reset
();
void
SkipInfo
();
bool
IsReplaying
()
const
;
FILE
*
fp
{
nullptr
};
#ifdef _WIN32
...
...
gframe/replay_mode.h
View file @
4ed0c5f4
...
...
@@ -25,7 +25,6 @@ private:
public:
static
Replay
cur_replay
;
public:
static
bool
StartReplay
(
int
skipturn
);
static
void
StopReplay
(
bool
is_exiting
=
false
);
static
void
SwapField
();
...
...
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