Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Y
ygopro-core
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
xiaoye
ygopro-core
Commits
a29b95c4
Commit
a29b95c4
authored
Dec 15, 2021
by
nanahira
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'mc' of ../../versions/ygopro-dynamic/ocgcore
parents
a982b748
550622ba
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
60 additions
and
23 deletions
+60
-23
interpreter.cpp
interpreter.cpp
+18
-12
interpreter.h
interpreter.h
+0
-1
libduel.cpp
libduel.cpp
+6
-6
operations.cpp
operations.cpp
+2
-0
premake5.lua
premake5.lua
+32
-0
processor.cpp
processor.cpp
+2
-4
No files found.
interpreter.cpp
View file @
a29b95c4
...
@@ -17,11 +17,10 @@ interpreter::interpreter(duel* pd): coroutines(256) {
...
@@ -17,11 +17,10 @@ interpreter::interpreter(duel* pd): coroutines(256) {
lua_state
=
luaL_newstate
();
lua_state
=
luaL_newstate
();
current_state
=
lua_state
;
current_state
=
lua_state
;
pduel
=
pd
;
pduel
=
pd
;
memcpy
(
lua_getextraspace
(
lua_state
),
&
pd
,
LUA_EXTRASPACE
);
//set_duel_info
no_action
=
0
;
no_action
=
0
;
call_depth
=
0
;
call_depth
=
0
;
disable_action_check
=
0
;
disable_action_check
=
0
;
set_duel_info
(
lua_state
,
pd
);
//Initial
//Initial
luaL_openlibs
(
lua_state
);
luaL_openlibs
(
lua_state
);
#ifdef YGOPRO_LUA_SAFE
#ifdef YGOPRO_LUA_SAFE
...
@@ -668,12 +667,25 @@ int32 interpreter::call_coroutine(int32 f, uint32 param_count, uint32 * yield_va
...
@@ -668,12 +667,25 @@ int32 interpreter::call_coroutine(int32 f, uint32 param_count, uint32 * yield_va
}
}
}
}
push_param
(
rthread
,
true
);
push_param
(
rthread
,
true
);
lua_State
*
prev_state
=
current_state
;
current_state
=
rthread
;
current_state
=
rthread
;
#if (LUA_VERSION_NUM >= 504)
int32
nresults
;
int32
result
=
lua_resume
(
rthread
,
prev_state
,
param_count
,
&
nresults
);
#else
int32
result
=
lua_resume
(
rthread
,
0
,
param_count
);
int32
result
=
lua_resume
(
rthread
,
0
,
param_count
);
int32
nresults
=
lua_gettop
(
rthread
);
#endif
if
(
result
==
0
)
{
if
(
result
==
0
)
{
coroutines
.
erase
(
f
);
coroutines
.
erase
(
f
);
if
(
yield_value
)
if
(
yield_value
)
{
*
yield_value
=
lua_isboolean
(
rthread
,
-
1
)
?
lua_toboolean
(
rthread
,
-
1
)
:
(
uint32
)
lua_tointeger
(
rthread
,
-
1
);
if
(
nresults
==
0
)
*
yield_value
=
0
;
else
if
(
lua_isboolean
(
rthread
,
-
1
))
*
yield_value
=
lua_toboolean
(
rthread
,
-
1
);
else
*
yield_value
=
(
uint32
)
lua_tointeger
(
rthread
,
-
1
);
}
current_state
=
lua_state
;
current_state
=
lua_state
;
call_depth
--
;
call_depth
--
;
if
(
call_depth
==
0
)
{
if
(
call_depth
==
0
)
{
...
@@ -747,14 +759,8 @@ int32 interpreter::get_function_handle(lua_State* L, int32 index) {
...
@@ -747,14 +759,8 @@ int32 interpreter::get_function_handle(lua_State* L, int32 index) {
int32
ref
=
luaL_ref
(
L
,
LUA_REGISTRYINDEX
);
int32
ref
=
luaL_ref
(
L
,
LUA_REGISTRYINDEX
);
return
ref
;
return
ref
;
}
}
void
interpreter
::
set_duel_info
(
lua_State
*
L
,
duel
*
pduel
)
{
lua_pushlightuserdata
(
L
,
pduel
);
luaL_ref
(
L
,
LUA_REGISTRYINDEX
);
}
duel
*
interpreter
::
get_duel_info
(
lua_State
*
L
)
{
duel
*
interpreter
::
get_duel_info
(
lua_State
*
L
)
{
luaL_checkstack
(
L
,
1
,
NULL
);
duel
*
pduel
;
lua_rawgeti
(
L
,
LUA_REGISTRYINDEX
,
3
);
memcpy
(
&
pduel
,
lua_getextraspace
(
L
),
LUA_EXTRASPACE
);
duel
*
pduel
=
(
duel
*
)
lua_topointer
(
L
,
-
1
);
lua_pop
(
L
,
1
);
return
pduel
;
return
pduel
;
}
}
interpreter.h
View file @
a29b95c4
...
@@ -75,7 +75,6 @@ public:
...
@@ -75,7 +75,6 @@ public:
static
void
effect2value
(
lua_State
*
L
,
effect
*
peffect
);
static
void
effect2value
(
lua_State
*
L
,
effect
*
peffect
);
static
void
function2value
(
lua_State
*
L
,
int32
pointer
);
static
void
function2value
(
lua_State
*
L
,
int32
pointer
);
static
int32
get_function_handle
(
lua_State
*
L
,
int32
index
);
static
int32
get_function_handle
(
lua_State
*
L
,
int32
index
);
static
void
set_duel_info
(
lua_State
*
L
,
duel
*
pduel
);
static
duel
*
get_duel_info
(
lua_State
*
L
);
static
duel
*
get_duel_info
(
lua_State
*
L
);
template
<
size_t
N
,
typename
...
TR
>
template
<
size_t
N
,
typename
...
TR
>
...
...
libduel.cpp
View file @
a29b95c4
...
@@ -1368,13 +1368,13 @@ int32 scriptlib::duel_is_environment(lua_State *L) {
...
@@ -1368,13 +1368,13 @@ int32 scriptlib::duel_is_environment(lua_State *L) {
int32
ret
=
0
,
fc
=
0
;
int32
ret
=
0
,
fc
=
0
;
if
(
loc
&
(
LOCATION_FZONE
+
LOCATION_SZONE
))
{
if
(
loc
&
(
LOCATION_FZONE
+
LOCATION_SZONE
))
{
card
*
pcard
=
pduel
->
game_field
->
player
[
0
].
list_szone
[
5
];
card
*
pcard
=
pduel
->
game_field
->
player
[
0
].
list_szone
[
5
];
if
(
pcard
&&
pcard
->
is_position
(
POS_FACEUP
)
&&
pcard
->
get_status
(
STATUS_EFFECT_ENABLED
)
)
{
if
(
pcard
&&
pcard
->
is_position
(
POS_FACEUP
))
{
fc
=
1
;
fc
=
1
;
if
(
code
==
pcard
->
get_code
()
&&
(
playerid
==
0
||
playerid
==
PLAYER_ALL
))
if
(
code
==
pcard
->
get_code
()
&&
(
playerid
==
0
||
playerid
==
PLAYER_ALL
))
ret
=
1
;
ret
=
1
;
}
}
pcard
=
pduel
->
game_field
->
player
[
1
].
list_szone
[
5
];
pcard
=
pduel
->
game_field
->
player
[
1
].
list_szone
[
5
];
if
(
pcard
&&
pcard
->
is_position
(
POS_FACEUP
)
&&
pcard
->
get_status
(
STATUS_EFFECT_ENABLED
)
)
{
if
(
pcard
&&
pcard
->
is_position
(
POS_FACEUP
))
{
fc
=
1
;
fc
=
1
;
if
(
code
==
pcard
->
get_code
()
&&
(
playerid
==
1
||
playerid
==
PLAYER_ALL
))
if
(
code
==
pcard
->
get_code
()
&&
(
playerid
==
1
||
playerid
==
PLAYER_ALL
))
ret
=
1
;
ret
=
1
;
...
@@ -1383,13 +1383,13 @@ int32 scriptlib::duel_is_environment(lua_State *L) {
...
@@ -1383,13 +1383,13 @@ int32 scriptlib::duel_is_environment(lua_State *L) {
if
(
!
ret
&&
(
loc
&
LOCATION_SZONE
))
{
if
(
!
ret
&&
(
loc
&
LOCATION_SZONE
))
{
if
(
playerid
==
0
||
playerid
==
PLAYER_ALL
)
{
if
(
playerid
==
0
||
playerid
==
PLAYER_ALL
)
{
for
(
auto
&
pcard
:
pduel
->
game_field
->
player
[
0
].
list_szone
)
{
for
(
auto
&
pcard
:
pduel
->
game_field
->
player
[
0
].
list_szone
)
{
if
(
pcard
&&
pcard
->
is_position
(
POS_FACEUP
)
&&
pcard
->
get_status
(
STATUS_EFFECT_ENABLED
)
&&
code
==
pcard
->
get_code
())
if
(
pcard
&&
pcard
->
is_position
(
POS_FACEUP
)
&&
code
==
pcard
->
get_code
())
ret
=
1
;
ret
=
1
;
}
}
}
}
if
(
playerid
==
1
||
playerid
==
PLAYER_ALL
)
{
if
(
playerid
==
1
||
playerid
==
PLAYER_ALL
)
{
for
(
auto
&
pcard
:
pduel
->
game_field
->
player
[
1
].
list_szone
)
{
for
(
auto
&
pcard
:
pduel
->
game_field
->
player
[
1
].
list_szone
)
{
if
(
pcard
&&
pcard
->
is_position
(
POS_FACEUP
)
&&
pcard
->
get_status
(
STATUS_EFFECT_ENABLED
)
&&
code
==
pcard
->
get_code
())
if
(
pcard
&&
pcard
->
is_position
(
POS_FACEUP
)
&&
code
==
pcard
->
get_code
())
ret
=
1
;
ret
=
1
;
}
}
}
}
...
@@ -1397,13 +1397,13 @@ int32 scriptlib::duel_is_environment(lua_State *L) {
...
@@ -1397,13 +1397,13 @@ int32 scriptlib::duel_is_environment(lua_State *L) {
if
(
!
ret
&&
(
loc
&
LOCATION_MZONE
))
{
if
(
!
ret
&&
(
loc
&
LOCATION_MZONE
))
{
if
(
playerid
==
0
||
playerid
==
PLAYER_ALL
)
{
if
(
playerid
==
0
||
playerid
==
PLAYER_ALL
)
{
for
(
auto
&
pcard
:
pduel
->
game_field
->
player
[
0
].
list_mzone
)
{
for
(
auto
&
pcard
:
pduel
->
game_field
->
player
[
0
].
list_mzone
)
{
if
(
pcard
&&
pcard
->
is_position
(
POS_FACEUP
)
&&
pcard
->
get_status
(
STATUS_EFFECT_ENABLED
)
&&
code
==
pcard
->
get_code
())
if
(
pcard
&&
pcard
->
is_position
(
POS_FACEUP
)
&&
code
==
pcard
->
get_code
())
ret
=
1
;
ret
=
1
;
}
}
}
}
if
(
playerid
==
1
||
playerid
==
PLAYER_ALL
)
{
if
(
playerid
==
1
||
playerid
==
PLAYER_ALL
)
{
for
(
auto
&
pcard
:
pduel
->
game_field
->
player
[
1
].
list_mzone
)
{
for
(
auto
&
pcard
:
pduel
->
game_field
->
player
[
1
].
list_mzone
)
{
if
(
pcard
&&
pcard
->
is_position
(
POS_FACEUP
)
&&
pcard
->
get_status
(
STATUS_EFFECT_ENABLED
)
&&
code
==
pcard
->
get_code
())
if
(
pcard
&&
pcard
->
is_position
(
POS_FACEUP
)
&&
code
==
pcard
->
get_code
())
ret
=
1
;
ret
=
1
;
}
}
}
}
...
...
operations.cpp
View file @
a29b95c4
...
@@ -377,6 +377,8 @@ int32 field::draw(uint16 step, effect* reason_effect, uint32 reason, uint8 reaso
...
@@ -377,6 +377,8 @@ int32 field::draw(uint16 step, effect* reason_effect, uint32 reason, uint8 reaso
}
}
core
.
hint_timing
[
playerid
]
|=
TIMING_DRAW
+
TIMING_TOHAND
;
core
.
hint_timing
[
playerid
]
|=
TIMING_DRAW
+
TIMING_TOHAND
;
adjust_instant
();
adjust_instant
();
if
(
core
.
overdraw
[
playerid
]
&&
(
reason
&
REASON_RULE
))
adjust_all
();
core
.
units
.
begin
()
->
arg2
=
(
core
.
units
.
begin
()
->
arg2
&
0xff000000
)
+
drawed
;
core
.
units
.
begin
()
->
arg2
=
(
core
.
units
.
begin
()
->
arg2
&
0xff000000
)
+
drawed
;
card_set
*
drawed_set
=
new
card_set
;
card_set
*
drawed_set
=
new
card_set
;
core
.
units
.
begin
()
->
ptarget
=
(
group
*
)
drawed_set
;
core
.
units
.
begin
()
->
ptarget
=
(
group
*
)
drawed_set
;
...
...
premake
4
.lua
→
premake
5
.lua
View file @
a29b95c4
project
"ocgcore"
project
"ocgcore"
kind
"StaticLib"
kind
"StaticLib"
files
{
"**.cc"
,
"**.cpp"
,
"**.c"
,
"**.h"
}
files
{
"*.cpp"
,
"*.h"
}
configuration
"windows"
links
{
"lua"
}
if
BUILD_LUA
then
includedirs
{
"../lua"
}
includedirs
{
"../lua"
}
configuration
"not vs*"
end
filter
"action:vs*"
if
not
BUILD_LUA
then
includedirs
{
"../lua"
}
end
filter
"not action:vs*"
buildoptions
{
"-std=c++14"
}
buildoptions
{
"-std=c++14"
}
configuration
"linux"
if
BUILD_LUA
then
filter
"system:bsd"
defines
{
"LUA_USE_POSIX"
}
filter
"system:macosx"
defines
{
"LUA_USE_MACOSX"
}
if
not
BUILD_LUA
then
includedirs
{
"../lua"
}
includedirs
{
"../lua"
}
else
end
filter
"system:linux"
defines
{
"LUA_USE_LINUX"
}
if
not
BUILD_LUA
then
includedirs
{
"/usr/include/lua5.3"
}
includedirs
{
"/usr/include/lua5.3"
}
end
end
configuration
"macosx"
includedirs
{
"../lua"
}
processor.cpp
View file @
a29b95c4
...
@@ -5043,10 +5043,8 @@ int32 field::adjust_step(uint16 step) {
...
@@ -5043,10 +5043,8 @@ int32 field::adjust_step(uint16 step) {
return
FALSE
;
return
FALSE
;
}
}
case
15
:
{
case
15
:
{
if
(
!
check_event
(
EVENT_ADJUST
))
{
raise_event
((
card
*
)
0
,
EVENT_ADJUST
,
0
,
0
,
PLAYER_NONE
,
PLAYER_NONE
,
0
);
raise_event
((
card
*
)
0
,
EVENT_ADJUST
,
0
,
0
,
PLAYER_NONE
,
PLAYER_NONE
,
0
);
process_instant_event
();
process_instant_event
();
}
return
FALSE
;
return
FALSE
;
}
}
case
16
:
{
case
16
:
{
...
...
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