Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Y
ygopro-2pick
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-2pick
Commits
7fba40e7
Commit
7fba40e7
authored
May 30, 2016
by
mercury233
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add chain buttons
parent
93aceb9b
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
131 additions
and
14 deletions
+131
-14
gframe/client_field.h
gframe/client_field.h
+1
-0
gframe/duelclient.cpp
gframe/duelclient.cpp
+26
-2
gframe/event_handler.cpp
gframe/event_handler.cpp
+67
-7
gframe/game.cpp
gframe/game.cpp
+21
-4
gframe/game.h
gframe/game.h
+10
-0
strings.conf
strings.conf
+4
-0
system.conf
system.conf
+2
-1
No files found.
gframe/client_field.h
View file @
7fba40e7
...
...
@@ -123,6 +123,7 @@ public:
virtual
bool
OnEvent
(
const
irr
::
SEvent
&
event
);
void
GetHoverField
(
int
x
,
int
y
);
void
ShowMenu
(
int
flag
,
int
x
,
int
y
);
void
UpdateChainButtons
();
void
SetResponseSelectedCards
()
const
;
};
...
...
gframe/duelclient.cpp
View file @
7fba40e7
...
...
@@ -284,6 +284,9 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) {
mainGame
->
btnSideOK
->
setVisible
(
true
);
if
(
mainGame
->
dInfo
.
player_type
<
7
)
mainGame
->
btnLeaveGame
->
setVisible
(
false
);
mainGame
->
btnChainIgnore
->
setVisible
(
false
);
mainGame
->
btnChainAlways
->
setVisible
(
false
);
mainGame
->
btnChainWhenAvail
->
setVisible
(
false
);
mainGame
->
deckBuilder
.
result_string
[
0
]
=
L'0'
;
mainGame
->
deckBuilder
.
result_string
[
1
]
=
0
;
mainGame
->
deckBuilder
.
results
.
clear
();
...
...
@@ -502,6 +505,11 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) {
}
case
STOC_DUEL_END
:
{
mainGame
->
gMutex
.
Lock
();
if
(
mainGame
->
dInfo
.
player_type
<
7
)
mainGame
->
btnLeaveGame
->
setVisible
(
false
);
mainGame
->
btnChainIgnore
->
setVisible
(
false
);
mainGame
->
btnChainAlways
->
setVisible
(
false
);
mainGame
->
btnChainWhenAvail
->
setVisible
(
false
);
mainGame
->
stMessage
->
setText
(
dataManager
.
GetSysString
(
1500
));
mainGame
->
PopupElement
(
mainGame
->
wMessage
);
mainGame
->
gMutex
.
Unlock
();
...
...
@@ -528,6 +536,9 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) {
mainGame
->
wPhase
->
setVisible
(
false
);
if
(
mainGame
->
dInfo
.
player_type
<
7
)
mainGame
->
btnLeaveGame
->
setVisible
(
false
);
mainGame
->
btnChainIgnore
->
setVisible
(
false
);
mainGame
->
btnChainAlways
->
setVisible
(
false
);
mainGame
->
btnChainWhenAvail
->
setVisible
(
false
);
time_t
nowtime
=
time
(
NULL
);
struct
tm
*
localedtime
=
localtime
(
&
nowtime
);
char
timebuf
[
40
];
...
...
@@ -1214,7 +1225,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
panelmode
=
true
;
}
}
if
(
!
forced
&&
(
mainGame
->
ignore_chain
||
((
count
==
0
||
specount
==
0
)
&&
!
mainGame
->
always_chain
)))
{
if
(
!
forced
&&
(
mainGame
->
ignore_chain
||
((
count
==
0
||
specount
==
0
)
&&
!
mainGame
->
always_chain
))
&&
(
count
==
0
||
!
mainGame
->
chain_when_avail
)
)
{
SetResponseI
(
-
1
);
mainGame
->
dField
.
ClearChainSelect
();
if
(
mainGame
->
chkWaitChain
->
isChecked
()
&&
!
mainGame
->
ignore_chain
)
{
...
...
@@ -1223,7 +1234,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
DuelClient
::
SendResponse
();
return
true
;
}
if
(
mainGame
->
chkAutoChain
->
isChecked
()
&&
forced
)
{
if
(
mainGame
->
chkAutoChain
->
isChecked
()
&&
forced
&&
!
(
mainGame
->
always_chain
||
mainGame
->
chain_when_avail
)
)
{
SetResponseI
(
0
);
mainGame
->
dField
.
ClearChainSelect
();
DuelClient
::
SendResponse
();
...
...
@@ -1836,6 +1847,19 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
mainGame
->
btnLeaveGame
->
setText
(
dataManager
.
GetSysString
(
1351
));
mainGame
->
btnLeaveGame
->
setVisible
(
true
);
}
if
(
!
mainGame
->
dInfo
.
isReplay
&&
mainGame
->
dInfo
.
player_type
<
7
)
{
if
(
!
mainGame
->
chkHideChainButton
->
isChecked
())
{
mainGame
->
btnChainIgnore
->
setVisible
(
true
);
mainGame
->
btnChainAlways
->
setVisible
(
true
);
mainGame
->
btnChainWhenAvail
->
setVisible
(
true
);
mainGame
->
dField
.
UpdateChainButtons
();
}
else
{
mainGame
->
btnChainIgnore
->
setVisible
(
false
);
mainGame
->
btnChainAlways
->
setVisible
(
false
);
mainGame
->
btnChainWhenAvail
->
setVisible
(
false
);
}
}
if
(
mainGame
->
dInfo
.
isTag
&&
mainGame
->
dInfo
.
turn
!=
1
)
{
if
(
player
==
0
)
mainGame
->
dInfo
.
tag_player
[
0
]
=
!
mainGame
->
dInfo
.
tag_player
[
0
];
...
...
gframe/event_handler.cpp
View file @
7fba40e7
...
...
@@ -127,6 +127,27 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
}
break
;
}
case
BUTTON_CHAIN_IGNORE
:
{
mainGame
->
ignore_chain
=
mainGame
->
btnChainIgnore
->
isPressed
();
mainGame
->
always_chain
=
false
;
mainGame
->
chain_when_avail
=
false
;
UpdateChainButtons
();
break
;
}
case
BUTTON_CHAIN_ALWAYS
:
{
mainGame
->
always_chain
=
mainGame
->
btnChainAlways
->
isPressed
();
mainGame
->
ignore_chain
=
false
;
mainGame
->
chain_when_avail
=
false
;
UpdateChainButtons
();
break
;
}
case
BUTTON_CHAIN_WHENAVAIL
:
{
mainGame
->
chain_when_avail
=
mainGame
->
btnChainWhenAvail
->
isPressed
();
mainGame
->
always_chain
=
false
;
mainGame
->
ignore_chain
=
false
;
UpdateChainButtons
();
break
;
}
case
BUTTON_MSG_OK
:
{
mainGame
->
HideElement
(
mainGame
->
wMessage
);
mainGame
->
actionSignal
.
Set
();
...
...
@@ -884,8 +905,12 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
irr
::
core
::
position2di
pos
(
x
,
y
);
if
(
x
<
300
)
break
;
if
(
mainGame
->
gameConf
.
control_mode
==
1
)
if
(
mainGame
->
gameConf
.
control_mode
==
1
)
{
mainGame
->
always_chain
=
event
.
MouseInput
.
isLeftPressed
();
mainGame
->
ignore_chain
=
false
;
mainGame
->
chain_when_avail
=
false
;
UpdateChainButtons
();
}
if
(
mainGame
->
wCmdMenu
->
isVisible
()
&&
!
mainGame
->
wCmdMenu
->
getRelativePosition
().
isPointInside
(
pos
))
mainGame
->
wCmdMenu
->
setVisible
(
false
);
if
(
panel
&&
panel
->
isVisible
())
...
...
@@ -1219,8 +1244,12 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
case
irr
:
:
EMIE_RMOUSE_LEFT_UP
:
{
if
(
mainGame
->
dInfo
.
isReplay
)
break
;
if
(
mainGame
->
gameConf
.
control_mode
==
1
&&
event
.
MouseInput
.
X
>
300
)
if
(
mainGame
->
gameConf
.
control_mode
==
1
&&
event
.
MouseInput
.
X
>
300
)
{
mainGame
->
ignore_chain
=
event
.
MouseInput
.
isRightPressed
();
mainGame
->
always_chain
=
false
;
mainGame
->
chain_when_avail
=
false
;
UpdateChainButtons
();
}
mainGame
->
wCmdMenu
->
setVisible
(
false
);
if
(
mainGame
->
fadingList
.
size
())
break
;
...
...
@@ -1518,15 +1547,23 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
case
irr
:
:
EMIE_LMOUSE_PRESSED_DOWN
:
{
if
(
!
mainGame
->
dInfo
.
isStarted
)
break
;
if
(
mainGame
->
gameConf
.
control_mode
==
1
&&
event
.
MouseInput
.
X
>
300
)
if
(
mainGame
->
gameConf
.
control_mode
==
1
&&
event
.
MouseInput
.
X
>
300
)
{
mainGame
->
always_chain
=
event
.
MouseInput
.
isLeftPressed
();
mainGame
->
ignore_chain
=
false
;
mainGame
->
chain_when_avail
=
false
;
UpdateChainButtons
();
}
break
;
}
case
irr
:
:
EMIE_RMOUSE_PRESSED_DOWN
:
{
if
(
!
mainGame
->
dInfo
.
isStarted
)
break
;
if
(
mainGame
->
gameConf
.
control_mode
==
1
&&
event
.
MouseInput
.
X
>
300
)
if
(
mainGame
->
gameConf
.
control_mode
==
1
&&
event
.
MouseInput
.
X
>
300
)
{
mainGame
->
ignore_chain
=
event
.
MouseInput
.
isRightPressed
();
mainGame
->
always_chain
=
false
;
mainGame
->
chain_when_avail
=
false
;
UpdateChainButtons
();
}
break
;
}
default:
...
...
@@ -1537,13 +1574,30 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
case
irr
:
:
EET_KEY_INPUT_EVENT
:
{
switch
(
event
.
KeyInput
.
Key
)
{
case
irr
:
:
KEY_KEY_A
:
{
if
(
mainGame
->
gameConf
.
control_mode
==
0
)
if
(
mainGame
->
gameConf
.
control_mode
==
0
)
{
mainGame
->
always_chain
=
event
.
KeyInput
.
PressedDown
;
mainGame
->
ignore_chain
=
false
;
mainGame
->
chain_when_avail
=
false
;
UpdateChainButtons
();
}
break
;
}
case
irr
:
:
KEY_KEY_S
:
{
if
(
mainGame
->
gameConf
.
control_mode
==
0
)
if
(
mainGame
->
gameConf
.
control_mode
==
0
)
{
mainGame
->
ignore_chain
=
event
.
KeyInput
.
PressedDown
;
mainGame
->
always_chain
=
false
;
mainGame
->
chain_when_avail
=
false
;
UpdateChainButtons
();
}
break
;
}
case
irr
:
:
KEY_KEY_D
:
{
if
(
mainGame
->
gameConf
.
control_mode
==
0
)
{
mainGame
->
chain_when_avail
=
event
.
KeyInput
.
PressedDown
;
mainGame
->
always_chain
=
false
;
mainGame
->
ignore_chain
=
false
;
UpdateChainButtons
();
}
break
;
}
case
irr
:
:
KEY_KEY_R
:
{
...
...
@@ -1852,7 +1906,13 @@ void ClientField::ShowMenu(int flag, int x, int y) {
mainGame
->
wCmdMenu
->
setVisible
(
true
);
mainGame
->
wCmdMenu
->
setRelativePosition
(
irr
::
core
::
recti
(
x
-
20
,
y
-
20
-
height
,
x
+
80
,
y
-
20
));
}
void
ClientField
::
UpdateChainButtons
()
{
if
(
mainGame
->
btnChainAlways
->
isVisible
())
{
mainGame
->
btnChainIgnore
->
setPressed
(
mainGame
->
ignore_chain
);
mainGame
->
btnChainAlways
->
setPressed
(
mainGame
->
always_chain
);
mainGame
->
btnChainWhenAvail
->
setPressed
(
mainGame
->
chain_when_avail
);
}
}
void
ClientField
::
SetResponseSelectedCards
()
const
{
unsigned
char
respbuf
[
64
];
respbuf
[
0
]
=
selected_cards
.
size
();
...
...
gframe/game.cpp
View file @
7fba40e7
...
...
@@ -239,6 +239,8 @@ bool Game::Initialize() {
chkIgnore2
->
setChecked
(
gameConf
.
chkIgnore2
!=
0
);
chkHideSetname
=
env
->
addCheckBox
(
false
,
rect
<
s32
>
(
20
,
260
,
280
,
285
),
tabSystem
,
-
1
,
dataManager
.
GetSysString
(
1354
));
chkHideSetname
->
setChecked
(
gameConf
.
chkHideSetname
!=
0
);
chkHideChainButton
=
env
->
addCheckBox
(
false
,
rect
<
s32
>
(
20
,
290
,
280
,
315
),
tabSystem
,
-
1
,
dataManager
.
GetSysString
(
1355
));
chkHideChainButton
->
setChecked
(
gameConf
.
chkHideChainButton
!=
0
);
//
wHand
=
env
->
addWindow
(
rect
<
s32
>
(
500
,
450
,
825
,
605
),
false
,
L""
);
wHand
->
getCloseButton
()
->
setVisible
(
false
);
...
...
@@ -522,7 +524,17 @@ bool Game::Initialize() {
wChat
->
setDrawTitlebar
(
false
);
wChat
->
setVisible
(
false
);
ebChatInput
=
env
->
addEditBox
(
L""
,
rect
<
s32
>
(
3
,
2
,
710
,
22
),
true
,
wChat
,
EDITBOX_CHAT
);
//
//chain buttons
btnChainIgnore
=
env
->
addButton
(
rect
<
s32
>
(
205
,
100
,
295
,
135
),
0
,
BUTTON_CHAIN_IGNORE
,
dataManager
.
GetSysString
(
1292
));
btnChainAlways
=
env
->
addButton
(
rect
<
s32
>
(
205
,
140
,
295
,
175
),
0
,
BUTTON_CHAIN_ALWAYS
,
dataManager
.
GetSysString
(
1293
));
btnChainWhenAvail
=
env
->
addButton
(
rect
<
s32
>
(
205
,
180
,
295
,
215
),
0
,
BUTTON_CHAIN_WHENAVAIL
,
dataManager
.
GetSysString
(
1294
));
btnChainIgnore
->
setIsPushButton
(
true
);
btnChainAlways
->
setIsPushButton
(
true
);
btnChainWhenAvail
->
setIsPushButton
(
true
);
btnChainIgnore
->
setVisible
(
false
);
btnChainAlways
->
setVisible
(
false
);
btnChainWhenAvail
->
setVisible
(
false
);
//leave/surrender/exit
btnLeaveGame
=
env
->
addButton
(
rect
<
s32
>
(
205
,
5
,
295
,
80
),
0
,
BUTTON_LEAVE_GAME
,
L""
);
btnLeaveGame
->
setVisible
(
false
);
device
->
setEventReceiver
(
&
menuHandler
);
...
...
@@ -600,8 +612,6 @@ void Game::MainLoop() {
driver
->
endScene
();
if
(
closeSignal
.
Wait
(
0
))
CloseDuelWindow
();
if
(
!
device
->
isWindowActive
())
ignore_chain
=
false
;
fps
++
;
cur_time
=
timer
->
getTime
();
if
(
cur_time
<
fps
*
17
-
20
)
...
...
@@ -842,6 +852,7 @@ void Game::LoadConfig() {
gameConf
.
chkIgnore1
=
0
;
gameConf
.
chkIgnore2
=
0
;
gameConf
.
chkHideSetname
=
0
;
gameConf
.
chkHideChainButton
=
0
;
gameConf
.
control_mode
=
0
;
gameConf
.
draw_field_spell
=
1
;
gameConf
.
separate_clear_button
=
1
;
...
...
@@ -891,6 +902,8 @@ void Game::LoadConfig() {
gameConf
.
chkIgnore2
=
atoi
(
valbuf
);
}
else
if
(
!
strcmp
(
strbuf
,
"hide_setname"
))
{
gameConf
.
chkHideSetname
=
atoi
(
valbuf
);
}
else
if
(
!
strcmp
(
strbuf
,
"hide_chain_button"
))
{
gameConf
.
chkHideChainButton
=
atoi
(
valbuf
);
}
else
if
(
!
strcmp
(
strbuf
,
"control_mode"
))
{
gameConf
.
control_mode
=
atoi
(
valbuf
);
}
else
if
(
!
strcmp
(
strbuf
,
"draw_field_spell"
))
{
...
...
@@ -945,7 +958,8 @@ void Game::SaveConfig() {
fprintf
(
fp
,
"mute_opponent = %d
\n
"
,
((
mainGame
->
chkIgnore1
->
isChecked
())
?
1
:
0
));
fprintf
(
fp
,
"mute_spectators = %d
\n
"
,
((
mainGame
->
chkIgnore2
->
isChecked
())
?
1
:
0
));
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
,
"hide_chain_button = %d
\n
"
,
((
mainGame
->
chkHideChainButton
->
isChecked
())
?
1
:
0
));
fprintf
(
fp
,
"#control_mode = 0: Key A/S/D/R. control_mode = 1: MouseLeft/MouseRight/NULL/F9
\n
"
);
fprintf
(
fp
,
"control_mode = %d
\n
"
,
gameConf
.
control_mode
);
fprintf
(
fp
,
"draw_field_spell = %d
\n
"
,
gameConf
.
draw_field_spell
);
fprintf
(
fp
,
"separate_clear_button = %d
\n
"
,
gameConf
.
separate_clear_button
);
...
...
@@ -1096,6 +1110,9 @@ void Game::CloseDuelWindow() {
stHintMsg
->
setVisible
(
false
);
btnSideOK
->
setVisible
(
false
);
btnLeaveGame
->
setVisible
(
false
);
btnChainIgnore
->
setVisible
(
false
);
btnChainAlways
->
setVisible
(
false
);
btnChainWhenAvail
->
setVisible
(
false
);
wChat
->
setVisible
(
false
);
lstLog
->
clear
();
logParam
.
clear
();
...
...
gframe/game.h
View file @
7fba40e7
...
...
@@ -32,6 +32,7 @@ struct Config {
int
chkIgnore1
;
int
chkIgnore2
;
int
chkHideSetname
;
int
chkHideChainButton
;
int
control_mode
;
int
draw_field_spell
;
int
separate_clear_button
;
...
...
@@ -153,6 +154,7 @@ public:
wchar_t
*
lpcstring
;
bool
always_chain
;
bool
ignore_chain
;
bool
chain_when_avail
;
bool
is_building
;
bool
is_siding
;
...
...
@@ -191,6 +193,7 @@ public:
irr
::
gui
::
IGUICheckBox
*
chkAutoChain
;
irr
::
gui
::
IGUICheckBox
*
chkWaitChain
;
irr
::
gui
::
IGUICheckBox
*
chkHideSetname
;
irr
::
gui
::
IGUICheckBox
*
chkHideChainButton
;
irr
::
gui
::
IGUIListBox
*
lstLog
;
irr
::
gui
::
IGUIButton
*
btnClearLog
;
irr
::
gui
::
IGUIButton
*
btnSaveLog
;
...
...
@@ -387,6 +390,10 @@ public:
irr
::
gui
::
IGUIButton
*
btnReplaySwap
;
//surrender/leave
irr
::
gui
::
IGUIButton
*
btnLeaveGame
;
//chain control
irr
::
gui
::
IGUIButton
*
btnChainIgnore
;
irr
::
gui
::
IGUIButton
*
btnChainAlways
;
irr
::
gui
::
IGUIButton
*
btnChainWhenAvail
;
};
...
...
@@ -470,6 +477,9 @@ extern Game* mainGame;
#define BUTTON_M2 261
#define BUTTON_EP 262
#define BUTTON_LEAVE_GAME 263
#define BUTTON_CHAIN_IGNORE 264
#define BUTTON_CHAIN_ALWAYS 265
#define BUTTON_CHAIN_WHENAVAIL 266
#define BUTTON_CLEAR_LOG 270
#define LISTBOX_LOG 271
#define SCROLL_CARDTEXT 280
...
...
strings.conf
View file @
7fba40e7
...
...
@@ -279,6 +279,9 @@
!
system
1281
自定义
!
system
1290
忽略对方发言
!
system
1291
忽略观战者发言
!
system
1292
忽略时点
!
system
1293
显示时点
!
system
1294
可用时点
!
system
1300
禁限卡表:
!
system
1301
卡组列表:
!
system
1302
保存
...
...
@@ -330,6 +333,7 @@
!
system
1352
主要信息:
!
system
1353
播放起始于回合:
!
system
1354
不显示卡片系列
!
system
1355
不显示询问连锁按钮
!
system
1360
上一步
!
system
1370
星数↑
!
system
1371
攻击↑
...
...
system.conf
View file @
7fba40e7
...
...
@@ -18,6 +18,7 @@ waitchain = 0
mute_opponent
=
0
mute_spectators
=
0
hide_setname
=
0
#control_mode = 0: Key A/S/R. control_mode = 1: MouseLeft/MouseRight/F9
hide_chain_button
=
0
#control_mode = 0: Key A/S/D/R. control_mode = 1: MouseLeft/MouseRight/NULL/F9
control_mode
=
0
draw_field_spell
=
1
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