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
ce46da81
Commit
ce46da81
authored
Oct 23, 2017
by
edo9300
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Changed master rule handling
parent
42b51d9c
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
175 additions
and
19 deletions
+175
-19
gframe/duelclient.cpp
gframe/duelclient.cpp
+17
-4
gframe/game.cpp
gframe/game.cpp
+14
-2
gframe/game.h
gframe/game.h
+8
-0
gframe/menu_handler.cpp
gframe/menu_handler.cpp
+84
-8
gframe/network.h
gframe/network.h
+1
-1
gframe/replay_mode.cpp
gframe/replay_mode.cpp
+5
-2
gframe/single_duel.cpp
gframe/single_duel.cpp
+23
-1
gframe/tag_duel.cpp
gframe/tag_duel.cpp
+23
-1
No files found.
gframe/duelclient.cpp
View file @
ce46da81
...
...
@@ -127,7 +127,7 @@ void DuelClient::ClientEvent(bufferevent *bev, short events, void *ctx) {
cscg
.
info
.
draw_count
=
_wtoi
(
mainGame
->
ebDrawCount
->
getText
());
cscg
.
info
.
time_limit
=
_wtoi
(
mainGame
->
ebTimeLimit
->
getText
());
cscg
.
info
.
lflist
=
mainGame
->
cbLFlist
->
getItemData
(
mainGame
->
cbLFlist
->
getSelected
());
cscg
.
info
.
duel_rule
=
mainGame
->
cbDuelRule
->
getSelected
()
+
1
;
cscg
.
info
.
duel_rule
=
((
mainGame
->
cbDuelRule
->
getSelected
()
+
1
)
<<
16
)
|
mainGame
->
duel_param
;
cscg
.
info
.
no_check_deck
=
mainGame
->
chkNoCheckDeck
->
isChecked
();
cscg
.
info
.
no_shuffle_deck
=
mainGame
->
chkNoShuffleDeck
->
isChecked
();
cscg
.
info
.
sealed
=
mainGame
->
chkRules
[
0
]
->
isChecked
()
?
2
:
0
;
...
...
@@ -377,8 +377,17 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) {
str
.
append
(
msgbuf
);
myswprintf
(
msgbuf
,
L"%ls%d
\n
"
,
dataManager
.
GetSysString
(
1233
),
pkt
->
info
.
draw_count
);
str
.
append
(
msgbuf
);
if
(
pkt
->
info
.
duel_rule
!=
DEFAULT_DUEL_RULE
)
{
myswprintf
(
msgbuf
,
L"*%ls
\n
"
,
dataManager
.
GetSysString
(
1260
+
pkt
->
info
.
duel_rule
-
1
));
uint32
rule
=
pkt
->
info
.
duel_rule
>>
16
;
if
(
rule
==
5
)
{
uint32
flag
=
pkt
->
info
.
duel_rule
&
0xffff
,
filter
=
0x100
;
for
(
int
i
=
0
;
i
<
5
;
++
i
,
filter
<<=
1
)
if
(
flag
&
filter
)
{
myswprintf
(
msgbuf
,
L"*%ls
\n
"
,
dataManager
.
GetSysString
(
1265
+
i
));
str2
.
append
(
msgbuf
);
host2
=
true
;
}
}
else
if
(
rule
!=
DEFAULT_DUEL_RULE
)
{
myswprintf
(
msgbuf
,
L"*%ls
\n
"
,
dataManager
.
GetSysString
(
1260
+
rule
-
1
));
str
.
append
(
msgbuf
);
}
if
(
pkt
->
info
.
no_check_deck
)
{
...
...
@@ -512,7 +521,11 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) {
mainGame
->
ShowElement
(
mainGame
->
wHostPrepare2
);
mainGame
->
wChat
->
setVisible
(
true
);
mainGame
->
gMutex
.
Unlock
();
mainGame
->
dInfo
.
duel_rule
=
pkt
->
info
.
duel_rule
;
mainGame
->
dInfo
.
duel_rule
=
4
;
if
(((
pkt
->
info
.
duel_rule
&
0xffff
)
&
DUEL_NO_PZONE
)
&&
((
pkt
->
info
.
duel_rule
&
0xffff
)
&
DUEL_NO_EMZONE
))
mainGame
->
dInfo
.
duel_rule
=
2
;
else
if
((
pkt
->
info
.
duel_rule
&
0xffff
)
&
DUEL_NO_EMZONE
)
mainGame
->
dInfo
.
duel_rule
=
3
;
mainGame
->
dInfo
.
speed
=
(
pkt
->
info
.
speed
==
2
)
?
1
:
0
;
watching
=
0
;
connect_state
|=
0x4
;
...
...
gframe/game.cpp
View file @
ce46da81
...
...
@@ -162,12 +162,23 @@ bool Game::Initialize() {
for
(
int
i
=
0
;
i
<
14
;
++
i
)
chkRules
[
i
]
=
env
->
addCheckBox
(
false
,
recti
(
10
+
(
i
%
2
)
*
150
,
10
+
(
i
/
2
)
*
20
,
200
+
(
i
%
2
)
*
120
,
30
+
(
i
/
2
)
*
20
),
wRules
,
353
+
i
,
dataManager
.
GetSysString
(
1132
+
i
));
env
->
addStaticText
(
dataManager
.
GetSysString
(
1236
),
rect
<
s32
>
(
20
,
180
,
220
,
200
),
false
,
false
,
wCreateHost
);
cbDuelRule
=
env
->
addComboBox
(
rect
<
s32
>
(
140
,
175
,
300
,
200
),
wCreateHost
);
cbDuelRule
=
env
->
addComboBox
(
rect
<
s32
>
(
140
,
175
,
300
,
200
),
wCreateHost
,
COMBOBOX_DUEL_RULE
);
cbDuelRule
->
addItem
(
dataManager
.
GetSysString
(
1260
));
cbDuelRule
->
addItem
(
dataManager
.
GetSysString
(
1261
));
cbDuelRule
->
addItem
(
dataManager
.
GetSysString
(
1262
));
cbDuelRule
->
addItem
(
dataManager
.
GetSysString
(
1263
));
//cbDuelRule->addItem(dataManager.GetSysString(1264));
cbDuelRule
->
setSelected
(
DEFAULT_DUEL_RULE
-
1
);
btnCustomRule
=
env
->
addButton
(
rect
<
s32
>
(
305
,
175
,
370
,
200
),
wCreateHost
,
BUTTON_CUSTOM_RULE
,
dataManager
.
GetSysString
(
1626
));
wCustomRules
=
env
->
addWindow
(
rect
<
s32
>
(
700
,
100
,
910
,
280
),
false
,
dataManager
.
strBuffer
);
wCustomRules
->
getCloseButton
()
->
setVisible
(
false
);
wCustomRules
->
setDrawTitlebar
(
false
);
wCustomRules
->
setDraggable
(
true
);
wCustomRules
->
setVisible
(
false
);
for
(
int
i
=
0
;
i
<
5
;
++
i
)
chkCustomRules
[
i
]
=
env
->
addCheckBox
(
false
,
recti
(
10
,
10
+
i
*
20
,
200
,
30
+
i
*
20
),
wCustomRules
,
353
+
i
,
dataManager
.
GetSysString
(
1265
+
i
));
btnCustomRulesOK
=
env
->
addButton
(
rect
<
s32
>
(
55
,
130
,
155
,
155
),
wCustomRules
,
BUTTON_CUSTOM_RULE_OK
,
dataManager
.
GetSysString
(
1211
));
duel_param
=
0
;
chkNoCheckDeck
=
env
->
addCheckBox
(
false
,
rect
<
s32
>
(
20
,
210
,
170
,
230
),
wCreateHost
,
-
1
,
dataManager
.
GetSysString
(
1229
));
chkNoShuffleDeck
=
env
->
addCheckBox
(
false
,
rect
<
s32
>
(
180
,
210
,
360
,
230
),
wCreateHost
,
-
1
,
dataManager
.
GetSysString
(
1230
));
env
->
addStaticText
(
dataManager
.
GetSysString
(
1231
),
rect
<
s32
>
(
20
,
240
,
320
,
260
),
false
,
false
,
wCreateHost
);
...
...
@@ -194,7 +205,7 @@ bool Game::Initialize() {
wHostPrepare2
=
env
->
addWindow
(
rect
<
s32
>
(
750
,
120
,
950
,
440
),
false
,
dataManager
.
GetSysString
(
1625
));
wHostPrepare2
->
getCloseButton
()
->
setVisible
(
false
);
wHostPrepare2
->
setVisible
(
false
);
stHostPrepRule2
=
env
->
addStaticText
(
L""
,
rect
<
s32
>
(
10
,
30
,
460
,
23
0
),
false
,
true
,
wHostPrepare2
);
stHostPrepRule2
=
env
->
addStaticText
(
L""
,
rect
<
s32
>
(
10
,
30
,
460
,
35
0
),
false
,
true
,
wHostPrepare2
);
wHostPrepare
=
env
->
addWindow
(
rect
<
s32
>
(
270
,
120
,
750
,
440
),
false
,
dataManager
.
GetSysString
(
1250
));
wHostPrepare
->
getCloseButton
()
->
setVisible
(
false
);
wHostPrepare
->
setVisible
(
false
);
...
...
@@ -1439,6 +1450,7 @@ void Game::OnResize()
wHostPrepare
->
setRelativePosition
(
ResizeWin
(
270
,
120
,
750
,
440
));
wHostPrepare2
->
setRelativePosition
(
ResizeWin
(
750
,
120
,
950
,
440
));
wRules
->
setRelativePosition
(
ResizeWin
(
630
,
100
,
1000
,
310
));
wCustomRules
->
setRelativePosition
(
ResizeWin
(
700
,
100
,
910
,
280
));
wReplay
->
setRelativePosition
(
ResizeWin
(
220
,
100
,
800
,
520
));
wSinglePlay
->
setRelativePosition
(
ResizeWin
(
220
,
100
,
800
,
520
));
...
...
gframe/game.h
View file @
ce46da81
...
...
@@ -184,6 +184,7 @@ public:
bool
is_building
;
bool
is_siding
;
uint32
duel_param
;
irr
::
core
::
dimension2d
<
irr
::
u32
>
window_size
;
...
...
@@ -267,6 +268,10 @@ public:
irr
::
gui
::
IGUICheckBox
*
chkRules
[
14
];
irr
::
gui
::
IGUIButton
*
btnRulesOK
;
irr
::
gui
::
IGUIComboBox
*
cbDuelRule
;
irr
::
gui
::
IGUIButton
*
btnCustomRule
;
irr
::
gui
::
IGUICheckBox
*
chkCustomRules
[
5
];
irr
::
gui
::
IGUIWindow
*
wCustomRules
;
irr
::
gui
::
IGUIButton
*
btnCustomRulesOK
;
irr
::
gui
::
IGUICheckBox
*
chkNoCheckDeck
;
irr
::
gui
::
IGUICheckBox
*
chkNoShuffleDeck
;
irr
::
gui
::
IGUIButton
*
btnHostConfirm
;
...
...
@@ -506,6 +511,7 @@ extern Game* mainGame;
#define BUTTON_LAN_REFRESH 116
#define BUTTON_RULE_CARDS 117
#define BUTTON_RULE_OK 118
#define BUTTON_CUSTOM_RULE 119
#define BUTTON_HP_DUELIST 120
#define BUTTON_HP_OBSERVER 121
#define BUTTON_HP_START 122
...
...
@@ -514,6 +520,8 @@ extern Game* mainGame;
#define CHECKBOX_HP_READY 125
#define BUTTON_HP_READY 126
#define BUTTON_HP_NOTREADY 127
#define COMBOBOX_DUEL_RULE 128
#define BUTTON_CUSTOM_RULE_OK 129
#define LISTBOX_REPLAY_LIST 130
#define BUTTON_LOAD_REPLAY 131
#define BUTTON_CANCEL_REPLAY 132
...
...
gframe/menu_handler.cpp
View file @
ce46da81
...
...
@@ -31,6 +31,10 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
case
irr
:
:
EET_GUI_EVENT
:
{
irr
::
gui
::
IGUIElement
*
caller
=
event
.
GUIEvent
.
Caller
;
s32
id
=
caller
->
getID
();
if
(
mainGame
->
wRules
->
isVisible
()
&&
(
id
!=
BUTTON_RULE_OK
&&
(
id
<
CHECK_SEALED_DUEL
||
id
>
CHECK_DECK_MASTER_DUEL
)))
break
;
if
(
mainGame
->
wCustomRules
->
isVisible
()
&&
id
!=
BUTTON_CUSTOM_RULE_OK
)
break
;
switch
(
event
.
GUIEvent
.
EventType
)
{
case
irr
:
:
gui
::
EGET_ELEMENT_HOVERED
:
{
// Set cursor to an I-Beam if hovering over an edit box
...
...
@@ -120,17 +124,55 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
break
;
}
case
BUTTON_RULE_CARDS
:
{
if
(
mainGame
->
wRules
->
isVisible
()){
mainGame
->
HideElement
(
mainGame
->
wRules
);
}
else
{
mainGame
->
PopupElement
(
mainGame
->
wRules
);
}
mainGame
->
PopupElement
(
mainGame
->
wRules
);
break
;
}
case
BUTTON_RULE_OK
:
{
case
BUTTON_RULE_OK
:
{
mainGame
->
HideElement
(
mainGame
->
wRules
);
break
;
}
case
BUTTON_CUSTOM_RULE
:
{
mainGame
->
PopupElement
(
mainGame
->
wCustomRules
);
break
;
}
case
BUTTON_CUSTOM_RULE_OK
:
{
uint32
flag
=
0
,
filter
=
0x100
;
for
(
int
i
=
0
;
i
<
5
;
++
i
,
filter
<<=
1
)
if
(
mainGame
->
chkCustomRules
[
i
]
->
isChecked
())
{
flag
|=
filter
;
}
mainGame
->
cbDuelRule
->
clear
();
mainGame
->
cbDuelRule
->
addItem
(
dataManager
.
GetSysString
(
1260
));
mainGame
->
cbDuelRule
->
addItem
(
dataManager
.
GetSysString
(
1261
));
mainGame
->
cbDuelRule
->
addItem
(
dataManager
.
GetSysString
(
1262
));
mainGame
->
cbDuelRule
->
addItem
(
dataManager
.
GetSysString
(
1263
));
switch
(
flag
)
{
case
0x1F00
:
{
mainGame
->
cbDuelRule
->
setSelected
(
0
);
break
;
}
case
0x1E00
:
{
mainGame
->
cbDuelRule
->
setSelected
(
1
);
break
;
}
case
0x1000
:
{
mainGame
->
cbDuelRule
->
setSelected
(
2
);
break
;
}
case
0
:
{
mainGame
->
cbDuelRule
->
setSelected
(
3
);
break
;
}
default:
{
mainGame
->
cbDuelRule
->
addItem
(
dataManager
.
GetSysString
(
1264
));
mainGame
->
cbDuelRule
->
setSelected
(
4
);
break
;
}
}
mainGame
->
duel_param
=
flag
;
mainGame
->
HideElement
(
mainGame
->
wCustomRules
);
break
;
}
case
BUTTON_HOST_CONFIRM
:
{
BufferIO
::
CopyWStr
(
mainGame
->
ebServerName
->
getText
(),
mainGame
->
gameConf
.
gamename
,
20
);
if
(
!
NetServer
::
StartServer
(
mainGame
->
gameConf
.
serverport
))
...
...
@@ -139,7 +181,6 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
NetServer
::
StopServer
();
break
;
}
mainGame
->
HideElement
(
mainGame
->
wRules
);
mainGame
->
btnHostConfirm
->
setEnabled
(
false
);
mainGame
->
btnHostCancel
->
setEnabled
(
false
);
break
;
...
...
@@ -202,7 +243,8 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
mainGame
->
btnJoinHost
->
setEnabled
(
true
);
mainGame
->
btnJoinCancel
->
setEnabled
(
true
);
mainGame
->
HideElement
(
mainGame
->
wHostPrepare
);
mainGame
->
HideElement
(
mainGame
->
wHostPrepare2
);
if
(
mainGame
->
wHostPrepare2
->
isVisible
())
mainGame
->
HideElement
(
mainGame
->
wHostPrepare2
);
mainGame
->
ShowElement
(
mainGame
->
wLanWindow
);
mainGame
->
wChat
->
setVisible
(
false
);
if
(
exit_on_return
)
...
...
@@ -495,6 +537,40 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
}
break
;
}
case
irr
:
:
gui
::
EGET_COMBO_BOX_CHANGED
:
{
switch
(
id
)
{
case
COMBOBOX_DUEL_RULE
:
{
switch
(
mainGame
->
cbDuelRule
->
getSelected
())
{
case
0
:{
mainGame
->
cbDuelRule
->
removeItem
(
4
);
mainGame
->
duel_param
=
0x1F00
;
break
;
}
case
1
:
{
mainGame
->
cbDuelRule
->
removeItem
(
4
);
mainGame
->
duel_param
=
0x1E00
;
break
;
}
case
2
:
{
mainGame
->
cbDuelRule
->
removeItem
(
4
);
mainGame
->
duel_param
=
0x1000
;
break
;
}
case
3
:
{
mainGame
->
cbDuelRule
->
removeItem
(
4
);
mainGame
->
duel_param
=
0
;
break
;
}
}
uint32
flag
=
0
,
filter
=
0x100
;
for
(
int
i
=
0
;
i
<
5
;
++
i
,
filter
<<=
1
)
if
(
mainGame
->
duel_param
&
filter
)
mainGame
->
chkCustomRules
[
i
]
->
setChecked
(
true
);
else
mainGame
->
chkCustomRules
[
i
]
->
setChecked
(
false
);
}
}
}
default:
break
;
}
break
;
...
...
gframe/network.h
View file @
ce46da81
...
...
@@ -15,7 +15,7 @@ struct HostInfo {
unsigned
int
lflist
;
unsigned
char
rule
;
unsigned
char
mode
;
unsigned
char
duel_rule
;
unsigned
int
duel_rule
;
bool
no_check_deck
;
bool
no_shuffle_deck
;
unsigned
int
start_lp
;
...
...
gframe/replay_mode.cpp
View file @
ce46da81
...
...
@@ -80,8 +80,11 @@ int ReplayMode::ReplayThread(void* param) {
int
start_hand
=
cur_replay
.
ReadInt32
();
int
draw_count
=
cur_replay
.
ReadInt32
();
int
opt
=
cur_replay
.
ReadInt32
();
int
duel_rule
=
opt
>>
16
;
mainGame
->
dInfo
.
duel_rule
=
duel_rule
;
mainGame
->
dInfo
.
duel_rule
=
4
;
if
(((
opt
&
0xffff
)
&
DUEL_NO_PZONE
)
&&
((
opt
&
0xffff
)
&
DUEL_NO_EMZONE
))
mainGame
->
dInfo
.
duel_rule
=
2
;
else
if
((
opt
&
0xffff
)
&
DUEL_NO_EMZONE
)
mainGame
->
dInfo
.
duel_rule
=
3
;
mainGame
->
dInfo
.
speed
=
(
opt
&
SPEED_DUEL
)
?
1
:
0
;
set_player_info
(
pduel
,
0
,
start_lp
,
start_hand
,
draw_count
);
set_player_info
(
pduel
,
1
,
start_lp
,
start_hand
,
draw_count
);
...
...
gframe/single_duel.cpp
View file @
ce46da81
...
...
@@ -413,7 +413,29 @@ void SingleDuel::TPResult(DuelPlayer* dp, unsigned char tp) {
pduel
=
create_duel
(
rnd
.
rand
());
set_player_info
(
pduel
,
0
,
host_info
.
start_lp
,
host_info
.
start_hand
,
host_info
.
draw_count
);
set_player_info
(
pduel
,
1
,
host_info
.
start_lp
,
host_info
.
start_hand
,
host_info
.
draw_count
);
int
opt
=
(
int
)
host_info
.
duel_rule
<<
16
;
int
opt
=
host_info
.
duel_rule
;
switch
(
opt
)
{
case
0x1F00
:
{
opt
|=
(
1
<<
16
);
break
;
}
case
0x1E00
:
{
opt
|=
(
2
<<
16
);
break
;
}
case
0x1000
:
{
opt
|=
(
3
<<
16
);
break
;
}
case
0
:
{
opt
|=
(
4
<<
16
);
break
;
}
default:
{
opt
|=
(
5
<<
16
);
break
;
}
}
if
(
host_info
.
no_shuffle_deck
)
opt
|=
DUEL_PSEUDO_SHUFFLE
;
if
(
host_info
.
speed
)
...
...
gframe/tag_duel.cpp
View file @
ce46da81
...
...
@@ -382,7 +382,29 @@ void TagDuel::TPResult(DuelPlayer* dp, unsigned char tp) {
pduel
=
create_duel
(
rnd
.
rand
());
set_player_info
(
pduel
,
0
,
host_info
.
start_lp
,
host_info
.
start_hand
,
host_info
.
draw_count
);
set_player_info
(
pduel
,
1
,
host_info
.
start_lp
,
host_info
.
start_hand
,
host_info
.
draw_count
);
int
opt
=
(
int
)
host_info
.
duel_rule
<<
16
;
int
opt
=
host_info
.
duel_rule
;
switch
(
opt
)
{
case
0x1F00
:
{
opt
|=
(
1
<<
16
);
break
;
}
case
0x1E00
:
{
opt
|=
(
2
<<
16
);
break
;
}
case
0x1000
:
{
opt
|=
(
3
<<
16
);
break
;
}
case
0
:
{
opt
|=
(
4
<<
16
);
break
;
}
default:
{
opt
|=
(
5
<<
16
);
break
;
}
}
if
(
host_info
.
no_shuffle_deck
)
opt
|=
DUEL_PSEUDO_SHUFFLE
;
if
(
host_info
.
speed
)
...
...
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