Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Y
YGOMobile-Cn-Ko-En
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
fallenstardust
YGOMobile-Cn-Ko-En
Commits
64ed2aae
Commit
64ed2aae
authored
May 05, 2024
by
fallenstardust
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
sync ocgcore
parent
03a89915
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
83 additions
and
18 deletions
+83
-18
Classes/ocgcore/card.cpp
Classes/ocgcore/card.cpp
+48
-1
Classes/ocgcore/card.h
Classes/ocgcore/card.h
+2
-0
Classes/ocgcore/field.h
Classes/ocgcore/field.h
+1
-0
Classes/ocgcore/libduel.cpp
Classes/ocgcore/libduel.cpp
+9
-0
Classes/ocgcore/playerop.cpp
Classes/ocgcore/playerop.cpp
+22
-7
Classes/ocgcore/premake4.lua
Classes/ocgcore/premake4.lua
+0
-10
Classes/ocgcore/scriptlib.h
Classes/ocgcore/scriptlib.h
+1
-0
No files found.
Classes/ocgcore/card.cpp
View file @
64ed2aae
...
@@ -96,6 +96,36 @@ bool card::card_operation_sort(card* c1, card* c2) {
...
@@ -96,6 +96,36 @@ bool card::card_operation_sort(card* c1, card* c2) {
return
c1
->
overlay_target
->
current
.
sequence
<
c2
->
overlay_target
->
current
.
sequence
;
return
c1
->
overlay_target
->
current
.
sequence
<
c2
->
overlay_target
->
current
.
sequence
;
else
else
return
c1
->
current
.
sequence
<
c2
->
current
.
sequence
;
return
c1
->
current
.
sequence
<
c2
->
current
.
sequence
;
}
else
if
(
c1
->
current
.
location
&
LOCATION_DECK
&&
!
pduel
->
game_field
->
core
.
select_deck_seq_preserved
)
{
// faceup deck cards should go at the very first
if
(
c1
->
current
.
position
!=
c2
->
current
.
position
)
{
if
(
c1
->
current
.
position
&
POS_FACEUP
)
return
false
;
else
return
true
;
}
// if deck reversed and the card being at the top, it should go first
if
(
pduel
->
game_field
->
core
.
deck_reversed
)
{
if
(
c1
->
current
.
sequence
==
pduel
->
game_field
->
player
[
cp1
].
list_main
.
size
()
-
1
)
return
false
;
if
(
c2
->
current
.
sequence
==
pduel
->
game_field
->
player
[
cp2
].
list_main
.
size
()
-
1
)
return
true
;
}
// sort deck as card property
auto
c1_type
=
c1
->
data
.
type
&
0x7
;
auto
c2_type
=
c2
->
data
.
type
&
0x7
;
// monster should go before spell, and then trap
if
(
c1_type
!=
c2_type
)
return
c1_type
>
c2_type
;
if
(
c1_type
&
TYPE_MONSTER
)
{
// sort monster by level, then code
if
(
c1
->
data
.
level
!=
c2
->
data
.
level
)
return
c1
->
data
.
level
<
c2
->
data
.
level
;
else
return
c1
->
data
.
code
>
c2
->
data
.
code
;
}
else
// spell and trap should go by code
return
c1
->
data
.
code
>
c2
->
data
.
code
;
}
else
{
}
else
{
if
(
c1
->
current
.
location
&
(
LOCATION_DECK
|
LOCATION_EXTRA
|
LOCATION_GRAVE
|
LOCATION_REMOVED
))
if
(
c1
->
current
.
location
&
(
LOCATION_DECK
|
LOCATION_EXTRA
|
LOCATION_GRAVE
|
LOCATION_REMOVED
))
return
c1
->
current
.
sequence
>
c2
->
current
.
sequence
;
return
c1
->
current
.
sequence
>
c2
->
current
.
sequence
;
...
@@ -1506,10 +1536,27 @@ int32 card::is_all_column() {
...
@@ -1506,10 +1536,27 @@ int32 card::is_all_column() {
return
TRUE
;
return
TRUE
;
return
FALSE
;
return
FALSE
;
}
}
uint8
card
::
get_select_sequence
(
uint8
*
deck_seq_pointer
)
{
if
(
current
.
location
==
LOCATION_DECK
&&
!
pduel
->
game_field
->
core
.
select_deck_seq_preserved
)
{
return
deck_seq_pointer
[
current
.
controler
]
++
;
}
else
{
return
current
.
sequence
;
}
}
uint32
card
::
get_select_info_location
(
uint8
*
deck_seq_pointer
)
{
if
(
current
.
location
==
LOCATION_DECK
)
{
uint32
c
=
current
.
controler
;
uint32
l
=
current
.
location
;
uint32
s
=
get_select_sequence
(
deck_seq_pointer
);
uint32
ss
=
current
.
position
;
return
c
+
(
l
<<
8
)
+
(
s
<<
16
)
+
(
ss
<<
24
);
}
else
{
return
get_info_location
();
}
}
int32
card
::
is_treated_as_not_on_field
()
{
int32
card
::
is_treated_as_not_on_field
()
{
return
get_status
(
STATUS_SUMMONING
|
STATUS_SUMMON_DISABLED
|
STATUS_ACTIVATE_DISABLED
|
STATUS_SPSUMMON_STEP
);
return
get_status
(
STATUS_SUMMONING
|
STATUS_SUMMON_DISABLED
|
STATUS_ACTIVATE_DISABLED
|
STATUS_SPSUMMON_STEP
);
}
}
void
card
::
equip
(
card
*
target
,
uint32
send_msg
)
{
void
card
::
equip
(
card
*
target
,
uint32
send_msg
)
{
if
(
equiping_target
)
if
(
equiping_target
)
return
;
return
;
...
...
Classes/ocgcore/card.h
View file @
64ed2aae
...
@@ -269,6 +269,8 @@ public:
...
@@ -269,6 +269,8 @@ public:
uint32
get_column_zone
(
int32
location
);
uint32
get_column_zone
(
int32
location
);
void
get_column_cards
(
card_set
*
cset
);
void
get_column_cards
(
card_set
*
cset
);
int32
is_all_column
();
int32
is_all_column
();
uint8
get_select_sequence
(
uint8
*
deck_seq_pointer
);
uint32
get_select_info_location
(
uint8
*
deck_seq_pointer
);
int32
is_treated_as_not_on_field
();
int32
is_treated_as_not_on_field
();
void
equip
(
card
*
target
,
uint32
send_msg
=
TRUE
);
void
equip
(
card
*
target
,
uint32
send_msg
=
TRUE
);
...
...
Classes/ocgcore/field.h
View file @
64ed2aae
...
@@ -346,6 +346,7 @@ struct processor {
...
@@ -346,6 +346,7 @@ struct processor {
uint32
hint_timing
[
2
]{};
uint32
hint_timing
[
2
]{};
uint8
current_player
{
PLAYER_NONE
};
uint8
current_player
{
PLAYER_NONE
};
uint8
conti_player
{
PLAYER_NONE
};
uint8
conti_player
{
PLAYER_NONE
};
uint8
select_deck_seq_preserved
{
FALSE
};
std
::
unordered_map
<
uint32
,
std
::
pair
<
uint32
,
uint32
>>
summon_counter
;
std
::
unordered_map
<
uint32
,
std
::
pair
<
uint32
,
uint32
>>
summon_counter
;
std
::
unordered_map
<
uint32
,
std
::
pair
<
uint32
,
uint32
>>
normalsummon_counter
;
std
::
unordered_map
<
uint32
,
std
::
pair
<
uint32
,
uint32
>>
normalsummon_counter
;
std
::
unordered_map
<
uint32
,
std
::
pair
<
uint32
,
uint32
>>
spsummon_counter
;
std
::
unordered_map
<
uint32
,
std
::
pair
<
uint32
,
uint32
>>
spsummon_counter
;
...
...
Classes/ocgcore/libduel.cpp
View file @
64ed2aae
...
@@ -1546,6 +1546,14 @@ int32 scriptlib::duel_disable_self_destroy_check(lua_State* L) {
...
@@ -1546,6 +1546,14 @@ int32 scriptlib::duel_disable_self_destroy_check(lua_State* L) {
pduel
->
game_field
->
core
.
selfdes_disabled
=
disable
;
pduel
->
game_field
->
core
.
selfdes_disabled
=
disable
;
return
0
;
return
0
;
}
}
int32
scriptlib
::
duel_preserve_select_deck_seq
(
lua_State
*
L
)
{
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
uint8
preserve
=
TRUE
;
if
(
lua_gettop
(
L
)
>
0
)
preserve
=
lua_toboolean
(
L
,
1
);
pduel
->
game_field
->
core
.
select_deck_seq_preserved
=
preserve
;
return
0
;
}
int32
scriptlib
::
duel_shuffle_deck
(
lua_State
*
L
)
{
int32
scriptlib
::
duel_shuffle_deck
(
lua_State
*
L
)
{
check_param_count
(
L
,
1
);
check_param_count
(
L
,
1
);
uint32
playerid
=
(
uint32
)
lua_tointeger
(
L
,
1
);
uint32
playerid
=
(
uint32
)
lua_tointeger
(
L
,
1
);
...
@@ -4850,6 +4858,7 @@ static const struct luaL_Reg duellib[] = {
...
@@ -4850,6 +4858,7 @@ static const struct luaL_Reg duellib[] = {
{
"DiscardHand"
,
scriptlib
::
duel_discard_hand
},
{
"DiscardHand"
,
scriptlib
::
duel_discard_hand
},
{
"DisableShuffleCheck"
,
scriptlib
::
duel_disable_shuffle_check
},
{
"DisableShuffleCheck"
,
scriptlib
::
duel_disable_shuffle_check
},
{
"DisableSelfDestroyCheck"
,
scriptlib
::
duel_disable_self_destroy_check
},
{
"DisableSelfDestroyCheck"
,
scriptlib
::
duel_disable_self_destroy_check
},
{
"PreserveSelectDeckSequence"
,
scriptlib
::
duel_preserve_select_deck_seq
},
{
"ShuffleDeck"
,
scriptlib
::
duel_shuffle_deck
},
{
"ShuffleDeck"
,
scriptlib
::
duel_shuffle_deck
},
{
"ShuffleExtra"
,
scriptlib
::
duel_shuffle_extra
},
{
"ShuffleExtra"
,
scriptlib
::
duel_shuffle_extra
},
{
"ShuffleHand"
,
scriptlib
::
duel_shuffle_hand
},
{
"ShuffleHand"
,
scriptlib
::
duel_shuffle_hand
},
...
...
Classes/ocgcore/playerop.cpp
View file @
64ed2aae
...
@@ -248,9 +248,12 @@ int32 field::select_card(uint16 step, uint8 playerid, uint8 cancelable, uint8 mi
...
@@ -248,9 +248,12 @@ int32 field::select_card(uint16 step, uint8 playerid, uint8 cancelable, uint8 mi
pduel
->
write_buffer8
(
min
);
pduel
->
write_buffer8
(
min
);
pduel
->
write_buffer8
(
max
);
pduel
->
write_buffer8
(
max
);
pduel
->
write_buffer8
((
uint8
)
core
.
select_cards
.
size
());
pduel
->
write_buffer8
((
uint8
)
core
.
select_cards
.
size
());
uint8
deck_seq_pointer
[
2
];
deck_seq_pointer
[
0
]
=
0
;
deck_seq_pointer
[
1
]
=
0
;
for
(
auto
&
pcard
:
core
.
select_cards
)
{
for
(
auto
&
pcard
:
core
.
select_cards
)
{
pduel
->
write_buffer32
(
pcard
->
data
.
code
);
pduel
->
write_buffer32
(
pcard
->
data
.
code
);
pduel
->
write_buffer32
(
pcard
->
get_
info_location
(
));
pduel
->
write_buffer32
(
pcard
->
get_
select_info_location
(
deck_seq_pointer
));
}
}
return
FALSE
;
return
FALSE
;
}
else
{
}
else
{
...
@@ -296,14 +299,17 @@ int32 field::select_unselect_card(uint16 step, uint8 playerid, uint8 cancelable,
...
@@ -296,14 +299,17 @@ int32 field::select_unselect_card(uint16 step, uint8 playerid, uint8 cancelable,
pduel
->
write_buffer8
(
min
);
pduel
->
write_buffer8
(
min
);
pduel
->
write_buffer8
(
max
);
pduel
->
write_buffer8
(
max
);
pduel
->
write_buffer8
((
uint8
)
core
.
select_cards
.
size
());
pduel
->
write_buffer8
((
uint8
)
core
.
select_cards
.
size
());
uint8
deck_seq_pointer
[
2
];
deck_seq_pointer
[
0
]
=
0
;
deck_seq_pointer
[
1
]
=
0
;
for
(
auto
&
pcard
:
core
.
select_cards
)
{
for
(
auto
&
pcard
:
core
.
select_cards
)
{
pduel
->
write_buffer32
(
pcard
->
data
.
code
);
pduel
->
write_buffer32
(
pcard
->
data
.
code
);
pduel
->
write_buffer32
(
pcard
->
get_
info_location
(
));
pduel
->
write_buffer32
(
pcard
->
get_
select_info_location
(
deck_seq_pointer
));
}
}
pduel
->
write_buffer8
((
uint8
)
core
.
unselect_cards
.
size
());
pduel
->
write_buffer8
((
uint8
)
core
.
unselect_cards
.
size
());
for
(
auto
&
pcard
:
core
.
unselect_cards
)
{
for
(
auto
&
pcard
:
core
.
unselect_cards
)
{
pduel
->
write_buffer32
(
pcard
->
data
.
code
);
pduel
->
write_buffer32
(
pcard
->
data
.
code
);
pduel
->
write_buffer32
(
pcard
->
get_
info_location
(
));
pduel
->
write_buffer32
(
pcard
->
get_
select_info_location
(
deck_seq_pointer
));
}
}
return
FALSE
;
return
FALSE
;
}
else
{
}
else
{
...
@@ -520,11 +526,14 @@ int32 field::select_tribute(uint16 step, uint8 playerid, uint8 cancelable, uint8
...
@@ -520,11 +526,14 @@ int32 field::select_tribute(uint16 step, uint8 playerid, uint8 cancelable, uint8
pduel
->
write_buffer8
(
min
);
pduel
->
write_buffer8
(
min
);
pduel
->
write_buffer8
(
max
);
pduel
->
write_buffer8
(
max
);
pduel
->
write_buffer8
((
uint8
)
core
.
select_cards
.
size
());
pduel
->
write_buffer8
((
uint8
)
core
.
select_cards
.
size
());
uint8
deck_seq_pointer
[
2
];
deck_seq_pointer
[
0
]
=
0
;
deck_seq_pointer
[
1
]
=
0
;
for
(
auto
&
pcard
:
core
.
select_cards
)
{
for
(
auto
&
pcard
:
core
.
select_cards
)
{
pduel
->
write_buffer32
(
pcard
->
data
.
code
);
pduel
->
write_buffer32
(
pcard
->
data
.
code
);
pduel
->
write_buffer8
(
pcard
->
current
.
controler
);
pduel
->
write_buffer8
(
pcard
->
current
.
controler
);
pduel
->
write_buffer8
(
pcard
->
current
.
location
);
pduel
->
write_buffer8
(
pcard
->
current
.
location
);
pduel
->
write_buffer8
(
pcard
->
current
.
sequence
);
pduel
->
write_buffer8
(
pcard
->
get_select_sequence
(
deck_seq_pointer
)
);
pduel
->
write_buffer8
(
pcard
->
release_param
);
pduel
->
write_buffer8
(
pcard
->
release_param
);
}
}
return
FALSE
;
return
FALSE
;
...
@@ -589,11 +598,14 @@ int32 field::select_counter(uint16 step, uint8 playerid, uint16 countertype, uin
...
@@ -589,11 +598,14 @@ int32 field::select_counter(uint16 step, uint8 playerid, uint16 countertype, uin
pduel
->
write_buffer16
(
count
);
pduel
->
write_buffer16
(
count
);
pduel
->
write_buffer8
((
uint8
)
core
.
select_cards
.
size
());
pduel
->
write_buffer8
((
uint8
)
core
.
select_cards
.
size
());
std
::
sort
(
core
.
select_cards
.
begin
(),
core
.
select_cards
.
end
(),
card
::
card_operation_sort
);
std
::
sort
(
core
.
select_cards
.
begin
(),
core
.
select_cards
.
end
(),
card
::
card_operation_sort
);
uint8
deck_seq_pointer
[
2
];
deck_seq_pointer
[
0
]
=
0
;
deck_seq_pointer
[
1
]
=
0
;
for
(
auto
&
pcard
:
core
.
select_cards
)
{
for
(
auto
&
pcard
:
core
.
select_cards
)
{
pduel
->
write_buffer32
(
pcard
->
data
.
code
);
pduel
->
write_buffer32
(
pcard
->
data
.
code
);
pduel
->
write_buffer8
(
pcard
->
current
.
controler
);
pduel
->
write_buffer8
(
pcard
->
current
.
controler
);
pduel
->
write_buffer8
(
pcard
->
current
.
location
);
pduel
->
write_buffer8
(
pcard
->
current
.
location
);
pduel
->
write_buffer8
(
pcard
->
current
.
sequence
);
pduel
->
write_buffer8
(
pcard
->
get_select_sequence
(
deck_seq_pointer
)
);
pduel
->
write_buffer16
(
pcard
->
get_counter
(
countertype
));
pduel
->
write_buffer16
(
pcard
->
get_counter
(
countertype
));
}
}
return
FALSE
;
return
FALSE
;
...
@@ -645,11 +657,14 @@ int32 field::select_with_sum_limit(int16 step, uint8 playerid, int32 acc, int32
...
@@ -645,11 +657,14 @@ int32 field::select_with_sum_limit(int16 step, uint8 playerid, int32 acc, int32
pduel
->
write_buffer8
(
min
);
pduel
->
write_buffer8
(
min
);
pduel
->
write_buffer8
(
max
);
pduel
->
write_buffer8
(
max
);
pduel
->
write_buffer8
((
uint8
)
core
.
must_select_cards
.
size
());
pduel
->
write_buffer8
((
uint8
)
core
.
must_select_cards
.
size
());
uint8
deck_seq_pointer
[
2
];
deck_seq_pointer
[
0
]
=
0
;
deck_seq_pointer
[
1
]
=
0
;
for
(
auto
&
pcard
:
core
.
must_select_cards
)
{
for
(
auto
&
pcard
:
core
.
must_select_cards
)
{
pduel
->
write_buffer32
(
pcard
->
data
.
code
);
pduel
->
write_buffer32
(
pcard
->
data
.
code
);
pduel
->
write_buffer8
(
pcard
->
current
.
controler
);
pduel
->
write_buffer8
(
pcard
->
current
.
controler
);
pduel
->
write_buffer8
(
pcard
->
current
.
location
);
pduel
->
write_buffer8
(
pcard
->
current
.
location
);
pduel
->
write_buffer8
(
pcard
->
current
.
sequence
);
pduel
->
write_buffer8
(
pcard
->
get_select_sequence
(
deck_seq_pointer
)
);
pduel
->
write_buffer32
(
pcard
->
sum_param
);
pduel
->
write_buffer32
(
pcard
->
sum_param
);
}
}
pduel
->
write_buffer8
((
uint8
)
core
.
select_cards
.
size
());
pduel
->
write_buffer8
((
uint8
)
core
.
select_cards
.
size
());
...
@@ -657,7 +672,7 @@ int32 field::select_with_sum_limit(int16 step, uint8 playerid, int32 acc, int32
...
@@ -657,7 +672,7 @@ int32 field::select_with_sum_limit(int16 step, uint8 playerid, int32 acc, int32
pduel
->
write_buffer32
(
pcard
->
data
.
code
);
pduel
->
write_buffer32
(
pcard
->
data
.
code
);
pduel
->
write_buffer8
(
pcard
->
current
.
controler
);
pduel
->
write_buffer8
(
pcard
->
current
.
controler
);
pduel
->
write_buffer8
(
pcard
->
current
.
location
);
pduel
->
write_buffer8
(
pcard
->
current
.
location
);
pduel
->
write_buffer8
(
pcard
->
current
.
sequence
);
pduel
->
write_buffer8
(
pcard
->
get_select_sequence
(
deck_seq_pointer
)
);
pduel
->
write_buffer32
(
pcard
->
sum_param
);
pduel
->
write_buffer32
(
pcard
->
sum_param
);
}
}
return
FALSE
;
return
FALSE
;
...
...
Classes/ocgcore/premake4.lua
deleted
100644 → 0
View file @
03a89915
project
"ocgcore"
kind
"StaticLib"
files
{
"**.cc"
,
"**.cpp"
,
"**.c"
,
"**.h"
}
configuration
"windows"
includedirs
{
"../lua"
}
configuration
"not vs*"
buildoptions
{
"-std=c++14"
}
configuration
"not windows"
includedirs
{
"/usr/include/lua5.3"
}
Classes/ocgcore/scriptlib.h
View file @
64ed2aae
...
@@ -462,6 +462,7 @@ public:
...
@@ -462,6 +462,7 @@ public:
static
int32
duel_discard_hand
(
lua_State
*
L
);
static
int32
duel_discard_hand
(
lua_State
*
L
);
static
int32
duel_disable_shuffle_check
(
lua_State
*
L
);
static
int32
duel_disable_shuffle_check
(
lua_State
*
L
);
static
int32
duel_disable_self_destroy_check
(
lua_State
*
L
);
static
int32
duel_disable_self_destroy_check
(
lua_State
*
L
);
static
int32
duel_preserve_select_deck_seq
(
lua_State
*
L
);
static
int32
duel_shuffle_deck
(
lua_State
*
L
);
static
int32
duel_shuffle_deck
(
lua_State
*
L
);
static
int32
duel_shuffle_extra
(
lua_State
*
L
);
static
int32
duel_shuffle_extra
(
lua_State
*
L
);
static
int32
duel_shuffle_hand
(
lua_State
*
L
);
static
int32
duel_shuffle_hand
(
lua_State
*
L
);
...
...
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