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
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
MyCard
ygopro
Commits
b150b878
Commit
b150b878
authored
Feb 07, 2026
by
wind2009
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'upstream/master' into develop
parents
15e7e2c4
fcebe3ee
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
63 additions
and
59 deletions
+63
-59
gframe/image_manager.cpp
gframe/image_manager.cpp
+27
-22
gframe/sound_manager.cpp
gframe/sound_manager.cpp
+36
-37
No files found.
gframe/image_manager.cpp
View file @
b150b878
#include "image_manager.h"
#include "image_manager.h"
#include "game.h"
#include "game.h"
#include <cmath>
#include <thread>
#include <thread>
#ifdef _OPENMP
#ifdef _OPENMP
#include <omp.h>
#include <omp.h>
...
@@ -121,57 +122,61 @@ void ImageManager::ResizeTexture() {
...
@@ -121,57 +122,61 @@ void ImageManager::ResizeTexture() {
}
}
/** Scale image using nearest neighbor anti-aliasing.
/** Scale image using nearest neighbor anti-aliasing.
* Function by Warr1024, from https://github.com/minetest/minetest/issues/2419, modified. */
* Function by Warr1024, from https://github.com/minetest/minetest/issues/2419, modified. */
void
imageScaleNNAA
(
irr
::
video
::
IImage
*
src
,
irr
::
video
::
IImage
*
dest
)
{
void
imageScaleNNAA
(
irr
::
video
::
IImage
*
src
,
irr
::
video
::
IImage
*
dest
,
bool
use_threading
)
{
const
auto
&
srcDim
=
src
->
getDimension
();
const
auto
&
srcDim
=
src
->
getDimension
();
const
auto
&
destDim
=
dest
->
getDimension
();
const
auto
&
destDim
=
dest
->
getDimension
();
if
(
destDim
.
Width
==
0
||
destDim
.
Height
==
0
)
return
;
// Cache scale ratios.
// Cache scale ratios.
const
double
rx
=
(
double
)
srcDim
.
Width
/
destDim
.
Width
;
const
double
rx
=
(
double
)
srcDim
.
Width
/
destDim
.
Width
;
const
double
ry
=
(
double
)
srcDim
.
Height
/
destDim
.
Height
;
const
double
ry
=
(
double
)
srcDim
.
Height
/
destDim
.
Height
;
#pragma omp parallel if(
mainGame->gameConf.use_image_scale_multi_thread
)
#pragma omp parallel if(
use_threading
)
{
{
double
sx
,
sy
,
minsx
,
maxsx
,
minsy
,
maxsy
,
area
,
ra
,
ga
,
ba
,
aa
,
pw
,
ph
,
pa
;
irr
::
video
::
SColor
pxl
,
npxl
;
// Walk each destination image pixel.
// Walk each destination image pixel.
#pragma omp for schedule(dynamic)
#pragma omp for schedule(dynamic)
for
(
irr
::
s32
dy
=
0
;
dy
<
(
irr
::
s32
)
destDim
.
Height
;
dy
++
)
{
for
(
irr
::
s32
dy
=
0
;
dy
<
(
irr
::
s32
)
destDim
.
Height
;
dy
++
)
{
for
(
irr
::
s32
dx
=
0
;
dx
<
(
irr
::
s32
)
destDim
.
Width
;
dx
++
)
{
for
(
irr
::
s32
dx
=
0
;
dx
<
(
irr
::
s32
)
destDim
.
Width
;
dx
++
)
{
// Calculate floating-point source rectangle bounds.
// Calculate floating-point source rectangle bounds.
minsx
=
dx
*
rx
;
double
minsx
=
dx
*
rx
;
maxsx
=
minsx
+
rx
;
double
maxsx
=
minsx
+
rx
;
minsy
=
dy
*
ry
;
double
minsy
=
dy
*
ry
;
maxsy
=
minsy
+
ry
;
double
maxsy
=
minsy
+
ry
;
irr
::
u32
sx_begin
=
(
irr
::
u32
)
std
::
floor
(
minsx
);
irr
::
u32
sx_end
=
(
irr
::
u32
)
std
::
ceil
(
maxsx
);
if
(
sx_end
>
srcDim
.
Width
)
sx_end
=
srcDim
.
Width
;
irr
::
u32
sy_begin
=
(
irr
::
u32
)
std
::
floor
(
minsy
);
irr
::
u32
sy_end
=
(
irr
::
u32
)
std
::
ceil
(
maxsy
);
if
(
sy_end
>
srcDim
.
Height
)
sy_end
=
srcDim
.
Height
;
// Total area, and integral of r, g, b values over that area,
// Total area, and integral of r, g, b values over that area,
// initialized to zero, to be summed up in next loops.
// initialized to zero, to be summed up in next loops.
area
=
0
;
double
area
=
0
,
ra
=
0
,
ga
=
0
,
ba
=
0
,
aa
=
0
;
ra
=
0
;
irr
::
video
::
SColor
pxl
,
npxl
;
ga
=
0
;
ba
=
0
;
aa
=
0
;
// Loop over the integral pixel positions described by those bounds.
// Loop over the integral pixel positions described by those bounds.
for
(
sy
=
floor
(
minsy
);
sy
<
maxsy
;
sy
++
)
{
for
(
irr
::
u32
sy
=
sy_begin
;
sy
<
sy_end
;
sy
++
)
{
for
(
sx
=
floor
(
minsx
);
sx
<
maxsx
;
sx
++
)
{
for
(
irr
::
u32
sx
=
sx_begin
;
sx
<
sx_end
;
sx
++
)
{
// Calculate width, height, then area of dest pixel
// Calculate width, height, then area of dest pixel
// that's covered by this source pixel.
// that's covered by this source pixel.
pw
=
1
;
double
pw
=
1
;
if
(
minsx
>
sx
)
if
(
minsx
>
sx
)
pw
+=
sx
-
minsx
;
pw
+=
sx
-
minsx
;
if
(
maxsx
<
(
sx
+
1
))
if
(
maxsx
<
(
sx
+
1
))
pw
+=
maxsx
-
sx
-
1
;
pw
+=
maxsx
-
sx
-
1
;
ph
=
1
;
double
ph
=
1
;
if
(
minsy
>
sy
)
if
(
minsy
>
sy
)
ph
+=
sy
-
minsy
;
ph
+=
sy
-
minsy
;
if
(
maxsy
<
(
sy
+
1
))
if
(
maxsy
<
(
sy
+
1
))
ph
+=
maxsy
-
sy
-
1
;
ph
+=
maxsy
-
sy
-
1
;
pa
=
pw
*
ph
;
double
pa
=
pw
*
ph
;
// Get source pixel and add it to totals, weighted
// Get source pixel and add it to totals, weighted
// by covered area and alpha.
// by covered area and alpha.
pxl
=
src
->
getPixel
(
(
irr
::
u32
)
sx
,
(
irr
::
u32
)
sy
);
pxl
=
src
->
getPixel
(
sx
,
sy
);
area
+=
pa
;
area
+=
pa
;
ra
+=
pa
*
pxl
.
getRed
();
ra
+=
pa
*
pxl
.
getRed
();
ga
+=
pa
*
pxl
.
getGreen
();
ga
+=
pa
*
pxl
.
getGreen
();
...
@@ -205,7 +210,7 @@ irr::video::ITexture* ImageManager::addTexture(const char* name, irr::video::IIm
...
@@ -205,7 +210,7 @@ irr::video::ITexture* ImageManager::addTexture(const char* name, irr::video::IIm
texture
=
driver
->
addTexture
(
name
,
srcimg
);
texture
=
driver
->
addTexture
(
name
,
srcimg
);
}
else
{
}
else
{
irr
::
video
::
IImage
*
destimg
=
driver
->
createImage
(
srcimg
->
getColorFormat
(),
irr
::
core
::
dimension2d
<
irr
::
u32
>
(
width
,
height
));
irr
::
video
::
IImage
*
destimg
=
driver
->
createImage
(
srcimg
->
getColorFormat
(),
irr
::
core
::
dimension2d
<
irr
::
u32
>
(
width
,
height
));
imageScaleNNAA
(
srcimg
,
destimg
);
imageScaleNNAA
(
srcimg
,
destimg
,
mainGame
->
gameConf
.
use_image_scale_multi_thread
);
texture
=
driver
->
addTexture
(
name
,
destimg
);
texture
=
driver
->
addTexture
(
name
,
destimg
);
destimg
->
drop
();
destimg
->
drop
();
}
}
...
@@ -316,7 +321,7 @@ int ImageManager::LoadThumbThread() {
...
@@ -316,7 +321,7 @@ int ImageManager::LoadThumbThread() {
imageManager
.
tThumbLoadingMutex
.
unlock
();
imageManager
.
tThumbLoadingMutex
.
unlock
();
}
else
{
}
else
{
irr
::
video
::
IImage
*
destimg
=
imageManager
.
driver
->
createImage
(
img
->
getColorFormat
(),
irr
::
core
::
dimension2d
<
irr
::
u32
>
(
width
,
height
));
irr
::
video
::
IImage
*
destimg
=
imageManager
.
driver
->
createImage
(
img
->
getColorFormat
(),
irr
::
core
::
dimension2d
<
irr
::
u32
>
(
width
,
height
));
imageScaleNNAA
(
img
,
destimg
);
imageScaleNNAA
(
img
,
destimg
,
mainGame
->
gameConf
.
use_image_scale_multi_thread
);
img
->
drop
();
img
->
drop
();
imageManager
.
tThumbLoadingMutex
.
lock
();
imageManager
.
tThumbLoadingMutex
.
lock
();
if
(
imageManager
.
tThumbLoadingThreadRunning
)
if
(
imageManager
.
tThumbLoadingThreadRunning
)
...
...
gframe/sound_manager.cpp
View file @
b150b878
...
@@ -88,143 +88,142 @@ void SoundManager::PlaySoundEffect(int sound) {
...
@@ -88,143 +88,142 @@ void SoundManager::PlaySoundEffect(int sound) {
#ifdef YGOPRO_USE_AUDIO
#ifdef YGOPRO_USE_AUDIO
if
(
!
mainGame
->
chkEnableSound
->
isChecked
())
if
(
!
mainGame
->
chkEnableSound
->
isChecked
())
return
;
return
;
char
soundName
[
32
]
;
std
::
string
soundName
;
switch
(
sound
)
{
switch
(
sound
)
{
case
SOUND_SUMMON
:
{
case
SOUND_SUMMON
:
{
s
trcpy
(
soundName
,
"summon"
)
;
s
oundName
=
"summon"
;
break
;
break
;
}
}
case
SOUND_SPECIAL_SUMMON
:
{
case
SOUND_SPECIAL_SUMMON
:
{
s
trcpy
(
soundName
,
"specialsummon"
)
;
s
oundName
=
"specialsummon"
;
break
;
break
;
}
}
case
SOUND_ACTIVATE
:
{
case
SOUND_ACTIVATE
:
{
s
trcpy
(
soundName
,
"activate"
)
;
s
oundName
=
"activate"
;
break
;
break
;
}
}
case
SOUND_SET
:
{
case
SOUND_SET
:
{
s
trcpy
(
soundName
,
"set"
)
;
s
oundName
=
"set"
;
break
;
break
;
}
}
case
SOUND_FLIP
:
{
case
SOUND_FLIP
:
{
s
trcpy
(
soundName
,
"flip"
)
;
s
oundName
=
"flip"
;
break
;
break
;
}
}
case
SOUND_REVEAL
:
{
case
SOUND_REVEAL
:
{
s
trcpy
(
soundName
,
"reveal"
)
;
s
oundName
=
"reveal"
;
break
;
break
;
}
}
case
SOUND_EQUIP
:
{
case
SOUND_EQUIP
:
{
s
trcpy
(
soundName
,
"equip"
)
;
s
oundName
=
"equip"
;
break
;
break
;
}
}
case
SOUND_DESTROYED
:
{
case
SOUND_DESTROYED
:
{
s
trcpy
(
soundName
,
"destroyed"
)
;
s
oundName
=
"destroyed"
;
break
;
break
;
}
}
case
SOUND_BANISHED
:
{
case
SOUND_BANISHED
:
{
s
trcpy
(
soundName
,
"banished"
)
;
s
oundName
=
"banished"
;
break
;
break
;
}
}
case
SOUND_TOKEN
:
{
case
SOUND_TOKEN
:
{
s
trcpy
(
soundName
,
"token"
)
;
s
oundName
=
"token"
;
break
;
break
;
}
}
case
SOUND_NEGATE
:
{
case
SOUND_NEGATE
:
{
s
trcpy
(
soundName
,
"negate"
)
;
s
oundName
=
"negate"
;
break
;
break
;
}
}
case
SOUND_ATTACK
:
{
case
SOUND_ATTACK
:
{
s
trcpy
(
soundName
,
"attack"
)
;
s
oundName
=
"attack"
;
break
;
break
;
}
}
case
SOUND_DIRECT_ATTACK
:
{
case
SOUND_DIRECT_ATTACK
:
{
s
trcpy
(
soundName
,
"directattack"
)
;
s
oundName
=
"directattack"
;
break
;
break
;
}
}
case
SOUND_DRAW
:
{
case
SOUND_DRAW
:
{
s
trcpy
(
soundName
,
"draw"
)
;
s
oundName
=
"draw"
;
break
;
break
;
}
}
case
SOUND_SHUFFLE
:
{
case
SOUND_SHUFFLE
:
{
s
trcpy
(
soundName
,
"shuffle"
)
;
s
oundName
=
"shuffle"
;
break
;
break
;
}
}
case
SOUND_DAMAGE
:
{
case
SOUND_DAMAGE
:
{
s
trcpy
(
soundName
,
"damage"
)
;
s
oundName
=
"damage"
;
break
;
break
;
}
}
case
SOUND_RECOVER
:
{
case
SOUND_RECOVER
:
{
s
trcpy
(
soundName
,
"gainlp"
)
;
s
oundName
=
"gainlp"
;
break
;
break
;
}
}
case
SOUND_COUNTER_ADD
:
{
case
SOUND_COUNTER_ADD
:
{
s
trcpy
(
soundName
,
"addcounter"
)
;
s
oundName
=
"addcounter"
;
break
;
break
;
}
}
case
SOUND_COUNTER_REMOVE
:
{
case
SOUND_COUNTER_REMOVE
:
{
s
trcpy
(
soundName
,
"removecounter"
)
;
s
oundName
=
"removecounter"
;
break
;
break
;
}
}
case
SOUND_COIN
:
{
case
SOUND_COIN
:
{
s
trcpy
(
soundName
,
"coinflip"
)
;
s
oundName
=
"coinflip"
;
break
;
break
;
}
}
case
SOUND_DICE
:
{
case
SOUND_DICE
:
{
s
trcpy
(
soundName
,
"diceroll"
)
;
s
oundName
=
"diceroll"
;
break
;
break
;
}
}
case
SOUND_NEXT_TURN
:
{
case
SOUND_NEXT_TURN
:
{
s
trcpy
(
soundName
,
"nextturn"
)
;
s
oundName
=
"nextturn"
;
break
;
break
;
}
}
case
SOUND_PHASE
:
{
case
SOUND_PHASE
:
{
s
trcpy
(
soundName
,
"phase"
)
;
s
oundName
=
"phase"
;
break
;
break
;
}
}
case
SOUND_MENU
:
{
case
SOUND_MENU
:
{
s
trcpy
(
soundName
,
"menu"
)
;
s
oundName
=
"menu"
;
break
;
break
;
}
}
case
SOUND_BUTTON
:
{
case
SOUND_BUTTON
:
{
s
trcpy
(
soundName
,
"button"
)
;
s
oundName
=
"button"
;
break
;
break
;
}
}
case
SOUND_INFO
:
{
case
SOUND_INFO
:
{
s
trcpy
(
soundName
,
"info"
)
;
s
oundName
=
"info"
;
break
;
break
;
}
}
case
SOUND_QUESTION
:
{
case
SOUND_QUESTION
:
{
s
trcpy
(
soundName
,
"question"
)
;
s
oundName
=
"question"
;
break
;
break
;
}
}
case
SOUND_CARD_PICK
:
{
case
SOUND_CARD_PICK
:
{
s
trcpy
(
soundName
,
"cardpick"
)
;
s
oundName
=
"cardpick"
;
break
;
break
;
}
}
case
SOUND_CARD_DROP
:
{
case
SOUND_CARD_DROP
:
{
s
trcpy
(
soundName
,
"carddrop"
)
;
s
oundName
=
"carddrop"
;
break
;
break
;
}
}
case
SOUND_PLAYER_ENTER
:
{
case
SOUND_PLAYER_ENTER
:
{
s
trcpy
(
soundName
,
"playerenter"
)
;
s
oundName
=
"playerenter"
;
break
;
break
;
}
}
case
SOUND_CHAT
:
{
case
SOUND_CHAT
:
{
s
trcpy
(
soundName
,
"chatmessage"
)
;
s
oundName
=
"chatmessage"
;
break
;
break
;
}
}
default:
default:
break
;
return
;
}
}
char
soundPath
[
40
];
std
::
string
soundPath
=
"./sound/"
+
soundName
+
".wav"
;
mysnprintf
(
soundPath
,
"./sound/%s.wav"
,
soundName
);
SetSoundVolume
(
mainGame
->
gameConf
.
sound_volume
);
SetSoundVolume
(
mainGame
->
gameConf
.
sound_volume
);
#ifdef YGOPRO_USE_MINIAUDIO
#ifdef YGOPRO_USE_MINIAUDIO
ma_engine_play_sound
(
&
engineSound
,
soundPath
,
nullptr
);
ma_engine_play_sound
(
&
engineSound
,
soundPath
.
c_str
()
,
nullptr
);
#endif
#endif
#ifdef YGOPRO_USE_IRRKLANG
#ifdef YGOPRO_USE_IRRKLANG
engineSound
->
play2D
(
soundPath
);
engineSound
->
play2D
(
soundPath
.
c_str
()
);
#endif
#endif
#endif // YGOPRO_USE_AUDIO
#endif // YGOPRO_USE_AUDIO
}
}
...
...
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