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
bc999cbb
Commit
bc999cbb
authored
Jun 08, 2025
by
nanahira
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'patch-std-mt19937' of github.com:Fluorohydride/ygopro into develop
parents
74919cbc
a50beb6f
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
40 additions
and
33 deletions
+40
-33
gframe/client_field.cpp
gframe/client_field.cpp
+2
-2
gframe/client_field.h
gframe/client_field.h
+2
-2
gframe/deck_con.cpp
gframe/deck_con.cpp
+10
-4
gframe/deck_con.h
gframe/deck_con.h
+3
-2
gframe/duelclient.cpp
gframe/duelclient.cpp
+12
-10
gframe/duelclient.h
gframe/duelclient.h
+3
-2
gframe/replay_mode.cpp
gframe/replay_mode.cpp
+1
-1
gframe/sound_manager.cpp
gframe/sound_manager.cpp
+2
-5
gframe/sound_manager.h
gframe/sound_manager.h
+5
-5
No files found.
gframe/client_field.cpp
View file @
bc999cbb
...
@@ -15,7 +15,7 @@ ClientField::ClientField() {
...
@@ -15,7 +15,7 @@ ClientField::ClientField() {
mzone
[
p
].
resize
(
7
,
0
);
mzone
[
p
].
resize
(
7
,
0
);
szone
[
p
].
resize
(
8
,
0
);
szone
[
p
].
resize
(
8
,
0
);
}
}
rnd
.
reset
((
uint_fast32_t
)
std
::
random_device
()());
rnd
.
seed
(
std
::
random_device
()());
}
}
ClientField
::~
ClientField
()
{
ClientField
::~
ClientField
()
{
for
(
int
i
=
0
;
i
<
2
;
++
i
)
{
for
(
int
i
=
0
;
i
<
2
;
++
i
)
{
...
@@ -418,7 +418,7 @@ void ClientField::ShowSelectCard(bool buttonok, bool chain) {
...
@@ -418,7 +418,7 @@ void ClientField::ShowSelectCard(bool buttonok, bool chain) {
}
}
}
}
if
(
has_card_in_grave
)
{
if
(
has_card_in_grave
)
{
rnd
.
shuffle_vector
(
selectable_cards
);
std
::
shuffle
(
selectable_cards
.
begin
(),
selectable_cards
.
end
(),
rnd
);
}
}
}
}
int
startpos
;
int
startpos
;
...
...
gframe/client_field.h
View file @
bc999cbb
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
#define CLIENT_FIELD_H
#define CLIENT_FIELD_H
#include "config.h"
#include "config.h"
#include
"../ocgcore/mtrandom.h"
#include
<random>
#include <vector>
#include <vector>
#include <set>
#include <set>
#include <map>
#include <map>
...
@@ -92,7 +92,7 @@ public:
...
@@ -92,7 +92,7 @@ public:
bool
cant_check_grave
{
false
};
bool
cant_check_grave
{
false
};
bool
tag_surrender
{
false
};
bool
tag_surrender
{
false
};
bool
tag_teammate_surrender
{
false
};
bool
tag_teammate_surrender
{
false
};
mt19937
rnd
;
std
::
mt19937
rnd
;
ClientField
();
ClientField
();
~
ClientField
();
~
ClientField
();
...
...
gframe/deck_con.cpp
View file @
bc999cbb
#include <array>
#include "config.h"
#include "config.h"
#include "deck_con.h"
#include "deck_con.h"
#include "myfilesystem.h"
#include "myfilesystem.h"
#include "data_manager.h"
#include "deck_manager.h"
#include "image_manager.h"
#include "image_manager.h"
#include "sound_manager.h"
#include "sound_manager.h"
#include "game.h"
#include "game.h"
...
@@ -54,6 +53,14 @@ static inline void load_current_deck(irr::gui::IGUIComboBox* cbCategory, irr::gu
...
@@ -54,6 +53,14 @@ static inline void load_current_deck(irr::gui::IGUIComboBox* cbCategory, irr::gu
deckManager
.
LoadCurrentDeck
(
cbCategory
->
getSelected
(),
cbCategory
->
getText
(),
cbDeck
->
getText
());
deckManager
.
LoadCurrentDeck
(
cbCategory
->
getSelected
(),
cbCategory
->
getText
(),
cbDeck
->
getText
());
}
}
DeckBuilder
::
DeckBuilder
()
{
std
::
random_device
rd
;
std
::
array
<
uint32_t
,
8
>
seed
{};
for
(
auto
&
x
:
seed
)
x
=
rd
();
std
::
seed_seq
seq
(
seed
.
begin
(),
seed
.
end
());
rnd
.
seed
(
seq
);
}
void
DeckBuilder
::
Initialize
()
{
void
DeckBuilder
::
Initialize
()
{
mainGame
->
is_building
=
true
;
mainGame
->
is_building
=
true
;
mainGame
->
is_siding
=
false
;
mainGame
->
is_siding
=
false
;
...
@@ -82,7 +89,6 @@ void DeckBuilder::Initialize() {
...
@@ -82,7 +89,6 @@ void DeckBuilder::Initialize() {
filterList
=
&
deckManager
.
_lfList
.
back
();
filterList
=
&
deckManager
.
_lfList
.
back
();
}
}
ClearSearch
();
ClearSearch
();
rnd
.
reset
((
uint_fast32_t
)
std
::
time
(
nullptr
));
mouse_pos
.
set
(
0
,
0
);
mouse_pos
.
set
(
0
,
0
);
hovered_code
=
0
;
hovered_code
=
0
;
hovered_pos
=
0
;
hovered_pos
=
0
;
...
@@ -176,7 +182,7 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
...
@@ -176,7 +182,7 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
break
;
break
;
}
}
case
BUTTON_SHUFFLE_DECK
:
{
case
BUTTON_SHUFFLE_DECK
:
{
rnd
.
shuffle_vector
(
deckManager
.
current_deck
.
main
);
std
::
shuffle
(
deckManager
.
current_deck
.
main
.
begin
(),
deckManager
.
current_deck
.
main
.
end
(),
rnd
);
break
;
break
;
}
}
case
BUTTON_SAVE_DECK
:
{
case
BUTTON_SAVE_DECK
:
{
...
...
gframe/deck_con.h
View file @
bc999cbb
...
@@ -3,15 +3,16 @@
...
@@ -3,15 +3,16 @@
#include <unordered_map>
#include <unordered_map>
#include <vector>
#include <vector>
#include <random>
#include <irrlicht.h>
#include <irrlicht.h>
#include "data_manager.h"
#include "data_manager.h"
#include "deck_manager.h"
#include "deck_manager.h"
#include "../ocgcore/mtrandom.h"
namespace
ygo
{
namespace
ygo
{
class
DeckBuilder
:
public
irr
::
IEventReceiver
{
class
DeckBuilder
:
public
irr
::
IEventReceiver
{
public:
public:
DeckBuilder
();
bool
OnEvent
(
const
irr
::
SEvent
&
event
)
override
;
bool
OnEvent
(
const
irr
::
SEvent
&
event
)
override
;
void
Initialize
();
void
Initialize
();
void
Terminate
();
void
Terminate
();
...
@@ -80,7 +81,7 @@ public:
...
@@ -80,7 +81,7 @@ public:
bool
is_modified
{};
bool
is_modified
{};
bool
readonly
{};
bool
readonly
{};
bool
showing_pack
{};
bool
showing_pack
{};
mt19937
rnd
;
std
::
mt19937
rnd
;
const
LFList
*
filterList
{};
const
LFList
*
filterList
{};
std
::
vector
<
code_pointer
>
results
;
std
::
vector
<
code_pointer
>
results
;
...
...
gframe/duelclient.cpp
View file @
bc999cbb
...
@@ -32,7 +32,8 @@ int DuelClient::last_select_hint = 0;
...
@@ -32,7 +32,8 @@ int DuelClient::last_select_hint = 0;
unsigned
char
DuelClient
::
last_successful_msg
[
SIZE_NETWORK_BUFFER
];
unsigned
char
DuelClient
::
last_successful_msg
[
SIZE_NETWORK_BUFFER
];
size_t
DuelClient
::
last_successful_msg_length
=
0
;
size_t
DuelClient
::
last_successful_msg_length
=
0
;
wchar_t
DuelClient
::
event_string
[
256
];
wchar_t
DuelClient
::
event_string
[
256
];
mt19937
DuelClient
::
rnd
;
std
::
mt19937
DuelClient
::
rnd
;
std
::
uniform_real_distribution
<
float
>
DuelClient
::
real_dist
;
bool
DuelClient
::
is_refreshing
=
false
;
bool
DuelClient
::
is_refreshing
=
false
;
int
DuelClient
::
match_kill
=
0
;
int
DuelClient
::
match_kill
=
0
;
...
@@ -69,7 +70,7 @@ bool DuelClient::StartClient(unsigned int ip, unsigned short port, bool create_g
...
@@ -69,7 +70,7 @@ bool DuelClient::StartClient(unsigned int ip, unsigned short port, bool create_g
return
false
;
return
false
;
}
}
connect_state
=
0x1
;
connect_state
=
0x1
;
rnd
.
reset
((
uint_fast32_t
)
std
::
random_device
()());
rnd
.
seed
(
std
::
random_device
()());
if
(
!
create_game
)
{
if
(
!
create_game
)
{
timeval
timeout
=
{
5
,
0
};
timeval
timeout
=
{
5
,
0
};
event
*
timeout_event
=
event_new
(
client_base
,
0
,
EV_TIMEOUT
,
ConnectTimeout
,
0
);
event
*
timeout_event
=
event_new
(
client_base
,
0
,
EV_TIMEOUT
,
ConnectTimeout
,
0
);
...
@@ -1929,7 +1930,7 @@ bool DuelClient::ClientAnalyze(unsigned char* msg, int len) {
...
@@ -1929,7 +1930,7 @@ bool DuelClient::ClientAnalyze(unsigned char* msg, int len) {
SetResponseI
(
-
1
);
SetResponseI
(
-
1
);
mainGame
->
dField
.
ClearChainSelect
();
mainGame
->
dField
.
ClearChainSelect
();
if
(
mainGame
->
chkWaitChain
->
isChecked
()
&&
!
mainGame
->
ignore_chain
)
{
if
(
mainGame
->
chkWaitChain
->
isChecked
()
&&
!
mainGame
->
ignore_chain
)
{
mainGame
->
WaitFrameSignal
(
rnd
.
get_random_integer
(
20
,
40
));
mainGame
->
WaitFrameSignal
(
std
::
uniform_int_distribution
<>
(
20
,
40
)(
rnd
));
}
}
DuelClient
::
SendResponse
();
DuelClient
::
SendResponse
();
return
true
;
return
true
;
...
@@ -2028,9 +2029,10 @@ bool DuelClient::ClientAnalyze(unsigned char* msg, int len) {
...
@@ -2028,9 +2029,10 @@ bool DuelClient::ClientAnalyze(unsigned char* msg, int len) {
}
}
if
(
!
pzone
)
{
if
(
!
pzone
)
{
if
(
mainGame
->
chkRandomPos
->
isChecked
())
{
if
(
mainGame
->
chkRandomPos
->
isChecked
())
{
std
::
uniform_int_distribution
<>
dist
(
0
,
6
);
do
{
do
{
respbuf
[
2
]
=
rnd
.
get_random_integer
(
0
,
6
);
respbuf
[
2
]
=
dist
(
rnd
);
}
while
(
!
(
filter
&
(
1
<<
respbuf
[
2
])));
}
while
(
!
(
filter
&
(
0x1U
<<
respbuf
[
2
])));
}
else
{
}
else
{
if
(
filter
&
0x40
)
respbuf
[
2
]
=
6
;
if
(
filter
&
0x40
)
respbuf
[
2
]
=
6
;
else
if
(
filter
&
0x20
)
respbuf
[
2
]
=
5
;
else
if
(
filter
&
0x20
)
respbuf
[
2
]
=
5
;
...
@@ -2475,7 +2477,7 @@ bool DuelClient::ClientAnalyze(unsigned char* msg, int len) {
...
@@ -2475,7 +2477,7 @@ bool DuelClient::ClientAnalyze(unsigned char* msg, int len) {
soundManager
.
PlaySoundEffect
(
SOUND_SHUFFLE
);
soundManager
.
PlaySoundEffect
(
SOUND_SHUFFLE
);
for
(
int
i
=
0
;
i
<
5
;
++
i
)
{
for
(
int
i
=
0
;
i
<
5
;
++
i
)
{
for
(
auto
cit
=
mainGame
->
dField
.
deck
[
player
].
begin
();
cit
!=
mainGame
->
dField
.
deck
[
player
].
end
();
++
cit
)
{
for
(
auto
cit
=
mainGame
->
dField
.
deck
[
player
].
begin
();
cit
!=
mainGame
->
dField
.
deck
[
player
].
end
();
++
cit
)
{
(
*
cit
)
->
dPos
=
irr
::
core
::
vector3df
(
r
nd
.
rand
()
*
0.4
f
/
rnd
.
rand_max
-
0.2
f
,
0
,
0
);
(
*
cit
)
->
dPos
=
irr
::
core
::
vector3df
(
r
eal_dist
(
rnd
)
*
0.4
f
-
0.2
f
,
0
,
0
);
(
*
cit
)
->
dRot
=
irr
::
core
::
vector3df
(
0
,
0
,
0
);
(
*
cit
)
->
dRot
=
irr
::
core
::
vector3df
(
0
,
0
,
0
);
(
*
cit
)
->
is_moving
=
true
;
(
*
cit
)
->
is_moving
=
true
;
(
*
cit
)
->
aniFrame
=
3
;
(
*
cit
)
->
aniFrame
=
3
;
...
@@ -2547,7 +2549,7 @@ bool DuelClient::ClientAnalyze(unsigned char* msg, int len) {
...
@@ -2547,7 +2549,7 @@ bool DuelClient::ClientAnalyze(unsigned char* msg, int len) {
for
(
int
i
=
0
;
i
<
5
;
++
i
)
{
for
(
int
i
=
0
;
i
<
5
;
++
i
)
{
for
(
auto
cit
=
mainGame
->
dField
.
extra
[
player
].
begin
();
cit
!=
mainGame
->
dField
.
extra
[
player
].
end
();
++
cit
)
{
for
(
auto
cit
=
mainGame
->
dField
.
extra
[
player
].
begin
();
cit
!=
mainGame
->
dField
.
extra
[
player
].
end
();
++
cit
)
{
if
(
!
((
*
cit
)
->
position
&
POS_FACEUP
))
{
if
(
!
((
*
cit
)
->
position
&
POS_FACEUP
))
{
(
*
cit
)
->
dPos
=
irr
::
core
::
vector3df
(
r
nd
.
rand
()
*
0.4
f
/
rnd
.
rand_max
-
0.2
f
,
0
,
0
);
(
*
cit
)
->
dPos
=
irr
::
core
::
vector3df
(
r
eal_dist
(
rnd
)
*
0.4
f
-
0.2
f
,
0
,
0
);
(
*
cit
)
->
dRot
=
irr
::
core
::
vector3df
(
0
,
0
,
0
);
(
*
cit
)
->
dRot
=
irr
::
core
::
vector3df
(
0
,
0
,
0
);
(
*
cit
)
->
is_moving
=
true
;
(
*
cit
)
->
is_moving
=
true
;
(
*
cit
)
->
aniFrame
=
3
;
(
*
cit
)
->
aniFrame
=
3
;
...
@@ -4478,9 +4480,9 @@ bool DuelClient::LookupSRV(char *hostname, HostResult* result) {
...
@@ -4478,9 +4480,9 @@ bool DuelClient::LookupSRV(char *hostname, HostResult* result) {
}
}
if
(
!
records
.
size
())
if
(
!
records
.
size
())
return
false
;
return
false
;
rnd
.
reset
((
unsigned
int
)
time
(
nullptr
));
rnd
.
seed
(
std
::
random_device
()(
));
rnd
.
shuffle_vector
(
records
);
std
::
uniform_int_distribution
<
size_t
>
dist
(
0
,
records
.
size
()
-
1
);
auto
record
=
records
.
front
()
;
auto
record
=
records
[
dist
(
rnd
)]
;
memcpy
(
resolved
,
record
.
host
,
100
);
memcpy
(
resolved
,
record
.
host
,
100
);
result
->
port
=
record
.
port
;
result
->
port
=
record
.
port
;
#endif
#endif
...
...
gframe/duelclient.h
View file @
bc999cbb
...
@@ -3,8 +3,8 @@
...
@@ -3,8 +3,8 @@
#include <vector>
#include <vector>
#include <set>
#include <set>
#include <random>
#include "network.h"
#include "network.h"
#include "../ocgcore/mtrandom.h"
namespace
ygo
{
namespace
ygo
{
...
@@ -65,7 +65,8 @@ private:
...
@@ -65,7 +65,8 @@ private:
static
unsigned
char
last_successful_msg
[
SIZE_NETWORK_BUFFER
];
static
unsigned
char
last_successful_msg
[
SIZE_NETWORK_BUFFER
];
static
size_t
last_successful_msg_length
;
static
size_t
last_successful_msg_length
;
static
wchar_t
event_string
[
256
];
static
wchar_t
event_string
[
256
];
static
mt19937
rnd
;
static
std
::
mt19937
rnd
;
static
std
::
uniform_real_distribution
<
float
>
real_dist
;
static
bool
is_refreshing
;
static
bool
is_refreshing
;
static
int
match_kill
;
static
int
match_kill
;
static
event
*
resp_event
;
static
event
*
resp_event
;
...
...
gframe/replay_mode.cpp
View file @
bc999cbb
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
#include "duelclient.h"
#include "duelclient.h"
#include "game.h"
#include "game.h"
#include "data_manager.h"
#include "data_manager.h"
#include
"../ocgcore/mtrandom.h"
#include
<random>
#include <thread>
#include <thread>
namespace
ygo
{
namespace
ygo
{
...
...
gframe/sound_manager.cpp
View file @
bc999cbb
...
@@ -14,11 +14,8 @@ SoundManager soundManager;
...
@@ -14,11 +14,8 @@ SoundManager soundManager;
bool
SoundManager
::
Init
()
{
bool
SoundManager
::
Init
()
{
#ifdef YGOPRO_USE_AUDIO
#ifdef YGOPRO_USE_AUDIO
bgm_scene
=
-
1
;
previous_bgm_scene
=
-
1
;
RefreshBGMList
();
RefreshBGMList
();
bgm_process
=
false
;
rnd
.
seed
(
std
::
random_device
()());
rnd
.
reset
((
unsigned
int
)
std
::
time
(
nullptr
));
#ifdef YGOPRO_USE_MINIAUDIO
#ifdef YGOPRO_USE_MINIAUDIO
engineConfig
=
ma_engine_config_init
();
engineConfig
=
ma_engine_config_init
();
#ifdef YGOPRO_MINIAUDIO_SUPPORT_OPUS_VORBIS
#ifdef YGOPRO_MINIAUDIO_SUPPORT_OPUS_VORBIS
...
@@ -337,7 +334,7 @@ void SoundManager::PlayBGM(int scene) {
...
@@ -337,7 +334,7 @@ void SoundManager::PlayBGM(int scene) {
if
(
count
<=
0
)
if
(
count
<=
0
)
return
;
return
;
bgm_scene
=
scene
;
bgm_scene
=
scene
;
int
bgm
=
rnd
.
get_random_integer
(
0
,
count
-
1
)
;
int
bgm
=
(
count
>
1
)
?
std
::
uniform_int_distribution
<>
(
0
,
count
-
1
)(
rnd
)
:
0
;
auto
name
=
BGMList
[
scene
][
bgm
].
c_str
();
auto
name
=
BGMList
[
scene
][
bgm
].
c_str
();
wchar_t
BGMName
[
1024
];
wchar_t
BGMName
[
1024
];
myswprintf
(
BGMName
,
L"./sound/BGM/%ls"
,
name
);
myswprintf
(
BGMName
,
L"./sound/BGM/%ls"
,
name
);
...
...
gframe/sound_manager.h
View file @
bc999cbb
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
#define SOUNDMANAGER_H
#define SOUNDMANAGER_H
#include "game.h"
#include "game.h"
#include
"../ocgcore/mtrandom.h"
#include
<random>
#ifdef YGOPRO_USE_MINIAUDIO
#ifdef YGOPRO_USE_MINIAUDIO
#include <miniaudio.h>
#include <miniaudio.h>
#endif
#endif
...
@@ -15,10 +15,10 @@ namespace ygo {
...
@@ -15,10 +15,10 @@ namespace ygo {
class
SoundManager
{
class
SoundManager
{
private:
private:
std
::
vector
<
std
::
wstring
>
BGMList
[
9
];
std
::
vector
<
std
::
wstring
>
BGMList
[
9
];
int
bgm_scene
{};
int
bgm_scene
{
-
1
};
int
previous_bgm_scene
{};
int
previous_bgm_scene
{
-
1
};
bool
bgm_process
;
bool
bgm_process
{
false
}
;
mt19937
rnd
;
std
::
mt19937
rnd
;
#ifdef YGOPRO_USE_MINIAUDIO
#ifdef YGOPRO_USE_MINIAUDIO
ma_engine_config
engineConfig
;
ma_engine_config
engineConfig
;
#ifdef YGOPRO_MINIAUDIO_SUPPORT_OPUS_VORBIS
#ifdef YGOPRO_MINIAUDIO_SUPPORT_OPUS_VORBIS
...
...
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