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
Commits
c311b21b
Commit
c311b21b
authored
Mar 25, 2016
by
Frozen Water
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1661 from DailyShana/field-spell
draw field spell
parents
c3d63025
a3a0f8e5
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
82 additions
and
1 deletion
+82
-1
gframe/drawing.cpp
gframe/drawing.cpp
+36
-1
gframe/game.cpp
gframe/game.cpp
+4
-0
gframe/game.h
gframe/game.h
+1
-0
gframe/image_manager.cpp
gframe/image_manager.cpp
+22
-0
gframe/image_manager.h
gframe/image_manager.h
+3
-0
gframe/materials.cpp
gframe/materials.cpp
+12
-0
gframe/materials.h
gframe/materials.h
+3
-0
system.conf
system.conf
+1
-0
textures/field-transparent2.png
textures/field-transparent2.png
+0
-0
No files found.
gframe/drawing.cpp
View file @
c311b21b
...
...
@@ -62,8 +62,43 @@ void Game::DrawBackGround() {
// driver->setMaterial(matManager.mBackLine);
// driver->drawVertexPrimitiveList(matManager.vBackLine, 76, matManager.iBackLine, 58, irr::video::EVT_STANDARD, irr::scene::EPT_LINES);
//draw field
//draw field spell card
driver->setTransform(irr::video::ETS_WORLD, irr::core::IdentityMatrix);
matManager
.
mTexture
.
setTexture
(
0
,
imageManager
.
tField
);
int fieldcode1 = -1;
int fieldcode2 = -1;
bool drawField = false;
if(mainGame->gameConf.draw_field_spell
&& mainGame->dField.szone[0][5] && mainGame->dField.szone[0][5]->position & POS_FACEUP)
fieldcode1 = mainGame->dField.szone[0][5]->code;
if(mainGame->gameConf.draw_field_spell
&& mainGame->dField.szone[1][5] && mainGame->dField.szone[1][5]->position & POS_FACEUP)
fieldcode2 = mainGame->dField.szone[1][5]->code;
int fieldcode = (fieldcode1 > 0) ? fieldcode1 : fieldcode2;
if(fieldcode1 > 0 && fieldcode2 > 0 && fieldcode1 != fieldcode2) {
ITexture* texture = imageManager.GetTextureField(fieldcode1);
if(texture) {
drawField = true;
matManager.mTexture.setTexture(0, texture);
driver->setMaterial(matManager.mTexture);
driver->drawVertexPrimitiveList(matManager.vFieldSpell1, 4, matManager.iRectangle, 2);
}
texture = imageManager.GetTextureField(fieldcode2);
if(texture) {
drawField = true;
matManager.mTexture.setTexture(0, texture);
driver->setMaterial(matManager.mTexture);
driver->drawVertexPrimitiveList(matManager.vFieldSpell2, 4, matManager.iRectangle, 2);
}
} else if(fieldcode > 0) {
ITexture* texture = imageManager.GetTextureField(fieldcode);
if(texture) {
drawField = true;
matManager.mTexture.setTexture(0, texture);
driver->setMaterial(matManager.mTexture);
driver->drawVertexPrimitiveList(matManager.vFieldSpell, 4, matManager.iRectangle, 2);
}
}
matManager.mTexture.setTexture(0, drawField ? imageManager.tFieldTransparent : imageManager.tField);
driver->setMaterial(matManager.mTexture);
driver->drawVertexPrimitiveList(matManager.vField, 4, matManager.iRectangle, 2);
driver->setMaterial(matManager.mBackLine);
...
...
gframe/game.cpp
View file @
c311b21b
...
...
@@ -821,6 +821,7 @@ void Game::LoadConfig() {
gameConf
.
chkIgnore2
=
0
;
gameConf
.
chkHideSetname
=
0
;
gameConf
.
control_mode
=
0
;
gameConf
.
draw_field_spell
=
1
;
fseek
(
fp
,
0
,
SEEK_END
);
int
fsize
=
ftell
(
fp
);
fseek
(
fp
,
0
,
SEEK_SET
);
...
...
@@ -869,6 +870,8 @@ void Game::LoadConfig() {
gameConf
.
chkHideSetname
=
atoi
(
valbuf
);
}
else
if
(
!
strcmp
(
strbuf
,
"control_mode"
))
{
gameConf
.
control_mode
=
atoi
(
valbuf
);
}
else
if
(
!
strcmp
(
strbuf
,
"draw_field_spell"
))
{
gameConf
.
draw_field_spell
=
atoi
(
valbuf
);
}
else
{
// options allowing multiple words
sscanf
(
linebuf
,
"%s = %240[^
\n
]"
,
strbuf
,
valbuf
);
...
...
@@ -921,6 +924,7 @@ void Game::SaveConfig() {
fprintf
(
fp
,
"hide_setname = %d
\n
"
,
((
mainGame
->
chkHideSetname
->
isChecked
())
?
1
:
0
));
fprintf
(
fp
,
"#control_mode = 0: Key A/S/R. control_mode = 1: MouseLeft/MouseRight/F9
\n
"
);
fprintf
(
fp
,
"control_mode = %d
\n
"
,
gameConf
.
control_mode
);
fprintf
(
fp
,
"draw_field_spell = %d
\n
"
,
gameConf
.
draw_field_spell
);
fclose
(
fp
);
}
void
Game
::
ShowCardInfo
(
int
code
)
{
...
...
gframe/game.h
View file @
c311b21b
...
...
@@ -33,6 +33,7 @@ struct Config {
int
chkIgnore2
;
int
chkHideSetname
;
int
control_mode
;
int
draw_field_spell
;
};
struct
DuelInfo
{
...
...
gframe/image_manager.cpp
View file @
c311b21b
...
...
@@ -26,6 +26,7 @@ bool ImageManager::Initial() {
tBackGround_menu
=
driver
->
getTexture
(
"textures/bg_menu.jpg"
);
tBackGround_deck
=
driver
->
getTexture
(
"textures/bg_deck.jpg"
);
tField
=
driver
->
getTexture
(
"textures/field2.png"
);
tFieldTransparent
=
driver
->
getTexture
(
"textures/field-transparent2.png"
);
return
true
;
}
void
ImageManager
::
SetDevice
(
irr
::
IrrlichtDevice
*
dev
)
{
...
...
@@ -94,4 +95,25 @@ irr::video::ITexture* ImageManager::GetTextureThumb(int code) {
else
return
tUnknown
;
}
irr
::
video
::
ITexture
*
ImageManager
::
GetTextureField
(
int
code
)
{
if
(
code
==
0
)
return
NULL
;
auto
tit
=
tFields
.
find
(
code
);
if
(
tit
==
tFields
.
end
())
{
char
file
[
256
];
sprintf
(
file
,
"pics/field/%d.png"
,
code
);
irr
::
video
::
ITexture
*
img
=
driver
->
getTexture
(
file
);
if
(
img
==
NULL
)
{
tFields
[
code
]
=
NULL
;
return
NULL
;
}
else
{
tFields
[
code
]
=
img
;
return
img
;
}
}
if
(
tit
->
second
)
return
tit
->
second
;
else
return
NULL
;
}
}
gframe/image_manager.h
View file @
c311b21b
...
...
@@ -15,9 +15,11 @@ public:
void
RemoveTexture
(
int
code
);
irr
::
video
::
ITexture
*
GetTexture
(
int
code
);
irr
::
video
::
ITexture
*
GetTextureThumb
(
int
code
);
irr
::
video
::
ITexture
*
GetTextureField
(
int
code
);
std
::
unordered_map
<
int
,
irr
::
video
::
ITexture
*>
tMap
;
std
::
unordered_map
<
int
,
irr
::
video
::
ITexture
*>
tThumb
;
std
::
unordered_map
<
int
,
irr
::
video
::
ITexture
*>
tFields
;
irr
::
IrrlichtDevice
*
device
;
irr
::
video
::
IVideoDriver
*
driver
;
irr
::
video
::
ITexture
*
tCover
[
2
];
...
...
@@ -38,6 +40,7 @@ public:
irr
::
video
::
ITexture
*
tBackGround_menu
;
irr
::
video
::
ITexture
*
tBackGround_deck
;
irr
::
video
::
ITexture
*
tField
;
irr
::
video
::
ITexture
*
tFieldTransparent
;
};
extern
ImageManager
imageManager
;
...
...
gframe/materials.cpp
View file @
c311b21b
...
...
@@ -41,6 +41,18 @@ Materials::Materials() {
vField
[
1
]
=
S3DVertex
(
vector3df
(
9.0
f
,
-
4.0
f
,
0
),
vector3df
(
0
,
0
,
1
),
SColor
(
255
,
255
,
255
,
255
),
vector2df
(
1
,
0
));
vField
[
2
]
=
S3DVertex
(
vector3df
(
-
1.0
f
,
4.0
f
,
0
),
vector3df
(
0
,
0
,
1
),
SColor
(
255
,
255
,
255
,
255
),
vector2df
(
0
,
1
));
vField
[
3
]
=
S3DVertex
(
vector3df
(
9.0
f
,
4.0
f
,
0
),
vector3df
(
0
,
0
,
1
),
SColor
(
255
,
255
,
255
,
255
),
vector2df
(
1
,
1
));
vFieldSpell
[
0
]
=
S3DVertex
(
vector3df
(
1.2
f
,
-
3.2
f
,
0
),
vector3df
(
0
,
0
,
1
),
SColor
(
255
,
255
,
255
,
255
),
vector2df
(
0
,
0
));
vFieldSpell
[
1
]
=
S3DVertex
(
vector3df
(
6.7
f
,
-
3.2
f
,
0
),
vector3df
(
0
,
0
,
1
),
SColor
(
255
,
255
,
255
,
255
),
vector2df
(
1
,
0
));
vFieldSpell
[
2
]
=
S3DVertex
(
vector3df
(
1.2
f
,
3.2
f
,
0
),
vector3df
(
0
,
0
,
1
),
SColor
(
255
,
255
,
255
,
255
),
vector2df
(
0
,
1
));
vFieldSpell
[
3
]
=
S3DVertex
(
vector3df
(
6.7
f
,
3.2
f
,
0
),
vector3df
(
0
,
0
,
1
),
SColor
(
255
,
255
,
255
,
255
),
vector2df
(
1
,
1
));
vFieldSpell1
[
0
]
=
S3DVertex
(
vector3df
(
1.2
f
,
0.8
f
,
0
),
vector3df
(
0
,
0
,
1
),
SColor
(
255
,
255
,
255
,
255
),
vector2df
(
0
,
0
));
vFieldSpell1
[
1
]
=
S3DVertex
(
vector3df
(
6.7
f
,
0.8
f
,
0
),
vector3df
(
0
,
0
,
1
),
SColor
(
255
,
255
,
255
,
255
),
vector2df
(
1
,
0
));
vFieldSpell1
[
2
]
=
S3DVertex
(
vector3df
(
1.2
f
,
3.2
f
,
0
),
vector3df
(
0
,
0
,
1
),
SColor
(
255
,
255
,
255
,
255
),
vector2df
(
0
,
1
));
vFieldSpell1
[
3
]
=
S3DVertex
(
vector3df
(
6.7
f
,
3.2
f
,
0
),
vector3df
(
0
,
0
,
1
),
SColor
(
255
,
255
,
255
,
255
),
vector2df
(
1
,
1
));
vFieldSpell2
[
0
]
=
S3DVertex
(
vector3df
(
1.2
f
,
-
3.2
f
,
0
),
vector3df
(
0
,
0
,
1
),
SColor
(
255
,
255
,
255
,
255
),
vector2df
(
0
,
0
));
vFieldSpell2
[
1
]
=
S3DVertex
(
vector3df
(
6.7
f
,
-
3.2
f
,
0
),
vector3df
(
0
,
0
,
1
),
SColor
(
255
,
255
,
255
,
255
),
vector2df
(
1
,
0
));
vFieldSpell2
[
2
]
=
S3DVertex
(
vector3df
(
1.2
f
,
-
0.8
f
,
0
),
vector3df
(
0
,
0
,
1
),
SColor
(
255
,
255
,
255
,
255
),
vector2df
(
0
,
1
));
vFieldSpell2
[
3
]
=
S3DVertex
(
vector3df
(
6.7
f
,
-
0.8
f
,
0
),
vector3df
(
0
,
0
,
1
),
SColor
(
255
,
255
,
255
,
255
),
vector2df
(
1
,
1
));
//background grids
for
(
int
i
=
0
;
i
<
6
;
++
i
)
{
vBackLine
[
i
*
6
+
0
]
=
S3DVertex
(
vector3df
(
1.2
f
+
i
*
1.1
f
,
0.5
f
,
-
0.01
f
),
vector3df
(
0
,
0
,
1
),
SColor
(
255
,
255
,
255
,
255
),
vector2df
(
0
,
0
));
...
...
gframe/materials.h
View file @
c311b21b
...
...
@@ -16,6 +16,9 @@ public:
S3DVertex
vChainNum
[
4
];
S3DVertex
vActivate
[
4
];
S3DVertex
vField
[
4
];
S3DVertex
vFieldSpell
[
4
];
S3DVertex
vFieldSpell1
[
4
];
S3DVertex
vFieldSpell2
[
4
];
S3DVertex
vBackLine
[
76
];
S3DVertex
vFields
[
136
];
S3DVertex
vArrow
[
40
];
...
...
system.conf
View file @
c311b21b
...
...
@@ -20,3 +20,4 @@ mute_spectators = 0
hide_setname
=
0
#control_mode = 0: Key A/S/R. control_mode = 1: MouseLeft/MouseRight/F9
control_mode
=
0
draw_field_spell
=
1
textures/field-transparent2.png
0 → 100644
View file @
c311b21b
1.95 KB
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