Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Y
YGOProUnity_V2
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
YGOProUnity_V2
Commits
3e38ae11
Commit
3e38ae11
authored
Sep 04, 2021
by
神楽坂玲奈
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'remotes/origin/ci'
parents
b15c84b7
5879e358
Changes
14
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
223 additions
and
140 deletions
+223
-140
.gitlab-ci.yml
.gitlab-ci.yml
+136
-79
AI_core_vs2017solution/build/gmake.macos/lua.make
AI_core_vs2017solution/build/gmake.macos/lua.make
+2
-2
AI_core_vs2017solution/build/gmake.macos/ocgcore.make
AI_core_vs2017solution/build/gmake.macos/ocgcore.make
+2
-2
AI_core_vs2017solution/build/gmake.macos/sqlite3.make
AI_core_vs2017solution/build/gmake.macos/sqlite3.make
+2
-2
AI_core_vs2017solution/ocgcore/CMakeLists.txt
AI_core_vs2017solution/ocgcore/CMakeLists.txt
+18
-0
AI_core_vs2017solution/ocgcore/common.h
AI_core_vs2017solution/ocgcore/common.h
+0
-2
AI_core_vs2017solution/ocgcore/effect.cpp
AI_core_vs2017solution/ocgcore/effect.cpp
+2
-2
AI_core_vs2017solution/ocgcore/effectset.h
AI_core_vs2017solution/ocgcore/effectset.h
+10
-13
AI_core_vs2017solution/ocgcore/field.cpp
AI_core_vs2017solution/ocgcore/field.cpp
+1
-1
AI_core_vs2017solution/ocgcore/interpreter.cpp
AI_core_vs2017solution/ocgcore/interpreter.cpp
+4
-4
AI_core_vs2017solution/ocgcore/ocgapi.cpp
AI_core_vs2017solution/ocgcore/ocgapi.cpp
+17
-17
AI_core_vs2017solution/ocgcore/ocgapi.h
AI_core_vs2017solution/ocgcore/ocgapi.h
+18
-16
AI_core_vs2017solution/ocgcore/operations.cpp
AI_core_vs2017solution/ocgcore/operations.cpp
+1
-0
AI_core_vs2017solution/ocgcore/premake4.lua
AI_core_vs2017solution/ocgcore/premake4.lua
+10
-0
No files found.
.gitlab-ci.yml
View file @
3e38ae11
stages
:
-
ocgcore
-
build_and_test
-
deploy
...
...
@@ -15,26 +16,78 @@ variables:
image
:
$IMAGE:$UNITY_VERSION-base-$IMAGE_VERSION
.unity_before_script
:
&unity_before_script
.unity_before_script
:
before_script
:
-
chmod +x ./ci/before_script.sh && ./ci/before_script.sh
.cache
:
&cache
.cache
:
cache
:
key
:
"
$CI_PROJECT_NAMESPACE-$CI_PROJECT_NAME-$CI_COMMIT_REF_SLUG-$TEST_PLATFORM"
paths
:
-
$UNITY_DIR/Library/
.license
:
&license
.license
:
rules
:
-
if
:
'
$UNITY_LICENSE
!=
null'
when
:
always
.unity_defaults
:
&unity_defaults
<<
:
-
*unity_before_script
-
*cache
-
*license
.unity_defaults
:
extends
:
-
.unity_before_script
-
.cache
-
.license
.common_image
:
image
:
git-registry.mycard.moe/mycard/docker-runner-base
.ocgcore
:
extends
:
.common_image
stage
:
ocgcore
cache
:
key
:
"
$CI_JOB_NAME-$CI_COMMIT_REF_SLUG"
paths
:
-
AI_core_vs2017solution/x64/Release
-
AI_core_vs2017solution/Release
-
AI_core_vs2017solution/bin
-
AI_core_vs2017solution/obj
.ocgcore_unix
:
extends
:
.ocgcore
script
:
-
cd AI_core_vs2017solution/build/gmake.$GMAKE_PLATFORM/
-
make config=release -j$(nproc)
-
cd ../..
-
cp -rf bin/gmake.$GMAKE_PLATFORM/x64/*.so ../Assets/Plugins/$PLUGIN_PLATFORM/
ocgcore_windows
:
extends
:
-
.ocgcore
tags
:
-
vs
script
:
-
cd AI_core_vs2017solution
-
cmd /c '"C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\msbuild.exe" core.sln /m /p:Configuration=Release /p:Platform=x86'
-
cmd /c '"C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\msbuild.exe" core.sln /m /p:Configuration=Release /p:Platform=x64'
-
bash -c 'cp -rf Release/ocgcore.dll ../Assets/Plugins/x86/ ; cp -rf x64/Release/ocgcore.dll ../Assets/Plugins/x64/'
artifacts
:
paths
:
-
Assets/Plugins/Release
-
Assets/Plugins/x64/Release
ocgcore_linux
:
extends
:
-
.ocgcore_unix
tags
:
-
linux
image
:
git-registry.mycard.moe/mycard/docker-runner-base:buster
before_script
:
-
apt update; apt -y install clang build-essential
variables
:
GMAKE_PLATFORM
:
linux
PLUGIN_PLATFORM
:
Linux
artifacts
:
paths
:
-
Assets/Plugins/Linux
# run this job when you need to request a license
# you may need to follow activation steps from documentation
...
...
@@ -50,9 +103,9 @@ get-activation-file:
-
$UNITY_ACTIVATION_FILE
expire_in
:
10 min
# Expiring this as artifacts may contain sensitive data and should not be kept public
.test
:
&test
.test
:
stage
:
build_and_test
<<
:
*
unity_defaults
extends
:
.
unity_defaults
script
:
-
chmod +x ./ci/test.sh && ./ci/test.sh
artifacts
:
...
...
@@ -64,15 +117,15 @@ get-activation-file:
-
linux
coverage
:
/<Linecoverage>(.*?)</Linecoverage>/
test-playmode
:
<<
:
*
test
variables
:
TEST_PLATFORM
:
playmode
#
test-playmode:
# extends: .
test
#
variables:
#
TEST_PLATFORM: playmode
test-editmode
:
<<
:
*
test
variables
:
TEST_PLATFORM
:
editmode
#
test-editmode:
# extends: .
test
#
variables:
#
TEST_PLATFORM: editmode
# uncomment the following blocks if you'd like to have junit reporting unity test results in gitlab
# We currently have the following issue which prevents it from working right now, but you can give
...
...
@@ -81,7 +134,7 @@ test-editmode:
# .test-with-junit-reports: &test-with-junit-reports
# stage: build_and_test
#
<<: *
unity_defaults
#
extends: .
unity_defaults
# script:
# # This could be made faster by adding these packages to base image or running in a separate job (and step)
# # We could use an image with these two depencencies only and only do the saxonb-xslt command on
...
...
@@ -103,18 +156,18 @@ test-editmode:
# coverage: /<Linecoverage>(.*?)</Linecoverage>/
# test-playmode-with-junit-reports:
#
<<: *
test-with-junit-reports
#
extends: .
test-with-junit-reports
# variables:
# TEST_PLATFORM: playmode
# test-editmode-with-junit-reports:
#
<<: *
test-with-junit-reports
#
extends: .
test-with-junit-reports
# variables:
# TEST_PLATFORM: editmode
.build
:
&build
.build
:
stage
:
build_and_test
<<
:
*
unity_defaults
extends
:
.
unity_defaults
script
:
-
chmod +x ./ci/build.sh && ./ci/build.sh
artifacts
:
...
...
@@ -126,62 +179,67 @@ test-editmode:
-
linux
build-StandaloneLinux64
:
<<
:
*build
extends
:
.build
dependencies
:
-
ocgcore_linux
variables
:
BUILD_TARGET
:
StandaloneLinux64
build-StandaloneLinux64-il2cpp
:
<<
:
*
build
image
:
$IMAGE:$UNITY_VERSION-linux-il2cpp-$IMAGE_VERSION
variables
:
BUILD_TARGET
:
StandaloneLinux64
SCRIPTING_BACKEND
:
IL2CPP
#
build-StandaloneLinux64-il2cpp:
# extends: .
build
#
image: $IMAGE:$UNITY_VERSION-linux-il2cpp-$IMAGE_VERSION
#
variables:
#
BUILD_TARGET: StandaloneLinux64
#
SCRIPTING_BACKEND: IL2CPP
build-StandaloneOSX
:
<<
:
*build
extends
:
.build
dependencies
:
[]
# todo
image
:
$IMAGE:$UNITY_VERSION-mac-mono-$IMAGE_VERSION
variables
:
BUILD_TARGET
:
StandaloneOSX
#Note: build target names changed in recent versions, use this for versions < 2017.2:
# build-StandaloneOSXUniversal:
#
<<: *
build
#
extends: .
build
# variables:
# BUILD_TARGET: StandaloneOSXUniversal
build-StandaloneWindows64
:
<<
:
*build
extends
:
.build
dependencies
:
-
ocgcore_windows
image
:
$IMAGE:$UNITY_VERSION-windows-mono-$IMAGE_VERSION
variables
:
BUILD_TARGET
:
StandaloneWindows64
# For webgl support, you need to set Compression Format to Disabled for v0.9. See https://github.com/game-ci/docker/issues/75
build-WebGL
:
<<
:
*
build
image
:
$IMAGE:$UNITY_VERSION-webgl-$IMAGE_VERSION
#
build-WebGL:
# extends: .
build
#
image: $IMAGE:$UNITY_VERSION-webgl-$IMAGE_VERSION
# Temporary workaround for https://github.com/game-ci/docker/releases/tag/v0.9 and webgl support in current project to prevent errors with missing ffmpeg
before_script
:
-
chmod +x ./ci/before_script.sh && ./ci/before_script.sh
-
apt-get update && apt-get install ffmpeg -y
variables
:
BUILD_TARGET
:
WebGL
#
before_script:
#
- chmod +x ./ci/before_script.sh && ./ci/before_script.sh
#
- apt-get update && apt-get install ffmpeg -y
#
variables:
#
BUILD_TARGET: WebGL
build-android
:
<<
:
*
build
image
:
$IMAGE:$UNITY_VERSION-android-$IMAGE_VERSION
variables
:
BUILD_TARGET
:
Android
BUNDLE_VERSION_CODE
:
$CI_PIPELINE_IID
BUILD_APP_BUNDLE
:
"
false"
#
build-android:
# extends: .
build
#
image: $IMAGE:$UNITY_VERSION-android-$IMAGE_VERSION
#
variables:
#
BUILD_TARGET: Android
#
BUNDLE_VERSION_CODE: $CI_PIPELINE_IID
#
BUILD_APP_BUNDLE: "false"
build-android-il2cpp
:
<<
:
*
build
image
:
$IMAGE:$UNITY_VERSION-android-$IMAGE_VERSION
variables
:
BUILD_TARGET
:
Android
BUNDLE_VERSION_CODE
:
$CI_PIPELINE_IID
BUILD_APP_BUNDLE
:
"
false"
SCRIPTING_BACKEND
:
IL2CPP
#
build-android-il2cpp:
# extends: .
build
#
image: $IMAGE:$UNITY_VERSION-android-$IMAGE_VERSION
#
variables:
#
BUILD_TARGET: Android
#
BUNDLE_VERSION_CODE: $CI_PIPELINE_IID
#
BUILD_APP_BUNDLE: "false"
#
SCRIPTING_BACKEND: IL2CPP
#deploy-android:
# stage: deploy
...
...
@@ -194,11 +252,11 @@ build-android-il2cpp:
# - fastlane supply --aab $BUILD_NAME.aab --track internal --package_name com.youcompany.yourgame --json_key ./gpc_token.json
# needs: ["build-android"]
build-ios-xcode
:
<<
:
*
build
image
:
$IMAGE:$UNITY_VERSION-ios-$IMAGE_VERSION
variables
:
BUILD_TARGET
:
iOS
#
build-ios-xcode:
# extends: .
build
#
image: $IMAGE:$UNITY_VERSION-ios-$IMAGE_VERSION
#
variables:
#
BUILD_TARGET: iOS
#build-and-deploy-ios:
# stage: deploy
...
...
@@ -211,22 +269,21 @@ build-ios-xcode:
# - mac
# needs: ["build-ios-xcode"]
pages
:
image
:
alpine:latest
stage
:
deploy
script
:
-
mv "$UNITY_DIR/Builds/WebGL/${BUILD_NAME}" public
artifacts
:
paths
:
-
public
only
:
-
master
workflow
:
rules
:
-
if
:
$CI_MERGE_REQUEST_ID
when
:
never
-
if
:
$CI_COMMIT_TAG
when
:
never
-
when
:
always
#pages:
# image: alpine:latest
# stage: deploy
# script:
# - mv "$UNITY_DIR/Builds/WebGL/${BUILD_NAME}" public
# artifacts:
# paths:
# - public
# only:
# - master
#workflow:
# rules:
# - if: $CI_MERGE_REQUEST_ID
# when: never
# - if: $CI_COMMIT_TAG
# when: never
# - when: always
AI_core_vs2017solution/build/gmake.macos/lua.make
View file @
3e38ae11
...
...
@@ -27,7 +27,7 @@ endif
ifeq
($(origin AR), default)
AR
=
ar
endif
OSX_FLAGS
=
-mmacosx-version-min
=
10.9
-arch
i386
-arch
x86_64
OSX_FLAGS
=
-mmacosx-version-min
=
10.9
-arch
x86_64
DEFINES
+=
-DLUA_COMPAT_5_2
-DLUA_USE_MACOSX
INCLUDES
+=
FORCE_INCLUDE
+=
...
...
@@ -294,4 +294,4 @@ $(OBJDIR)/lzio.o: ../../lua/lzio.c
-include
$(OBJECTS:%.o=%.d)
ifneq
(,$(PCH))
-include
$(PCH_PLACEHOLDER).d
endif
\ No newline at end of file
endif
AI_core_vs2017solution/build/gmake.macos/ocgcore.make
View file @
3e38ae11
...
...
@@ -27,7 +27,7 @@ endif
ifeq
($(origin AR), default)
AR
=
ar
endif
OSX_FLAGS
=
-mmacosx-version-min
=
10.9
-arch
i386
-arch
x86_64
OSX_FLAGS
=
-mmacosx-version-min
=
10.9
-arch
x86_64
DEFINES
+=
-DUSE_LUA
INCLUDES
+=
-I
../../lua
FORCE_INCLUDE
+=
...
...
@@ -214,4 +214,4 @@ $(OBJDIR)/scriptlib.o: ../../ocgcore/scriptlib.cpp
-include
$(OBJECTS:%.o=%.d)
ifneq
(,$(PCH))
-include
$(PCH_PLACEHOLDER).d
endif
\ No newline at end of file
endif
AI_core_vs2017solution/build/gmake.macos/sqlite3.make
View file @
3e38ae11
...
...
@@ -27,7 +27,7 @@ endif
ifeq
($(origin AR), default)
AR
=
ar
endif
OSX_FLAGS
=
-mmacosx-version-min
=
10.9
-arch
i386
-arch
x86_64
OSX_FLAGS
=
-mmacosx-version-min
=
10.9
-arch
x86_64
DEFINES
+=
INCLUDES
+=
FORCE_INCLUDE
+=
...
...
@@ -134,4 +134,4 @@ $(OBJDIR)/sqlite3.o: ../../sqlite3/sqlite3.c
-include
$(OBJECTS:%.o=%.d)
ifneq
(,$(PCH))
-include
$(PCH_PLACEHOLDER).d
endif
\ No newline at end of file
endif
AI_core_vs2017solution/ocgcore/CMakeLists.txt
0 → 100644
View file @
3e38ae11
project
(
ocgcore
)
set
(
AUTO_FILES_RESULT
)
AutoFiles
(
"."
"src"
"
\\
.(cpp|c|h)$"
)
if
(
MSVC
)
include_directories
(
../lua
)
else
()
include_directories
(
${
LUA_INCLUDE_DIR
}
)
endif
()
add_library
(
ocgcore STATIC
${
AUTO_FILES_RESULT
}
)
if
(
MSVC
)
target_link_libraries
(
ocgcore lua
)
else
()
target_link_libraries
(
ocgcore
${
LUA_LIBRARIES
}
)
endif
()
AI_core_vs2017solution/ocgcore/common.h
View file @
3e38ae11
...
...
@@ -8,13 +8,11 @@
#ifndef COMMON_H_
#define COMMON_H_
typedef
void
*
uptr
;
typedef
unsigned
long
long
uint64
;
typedef
unsigned
int
uint32
;
typedef
unsigned
short
uint16
;
typedef
unsigned
char
uint8
;
typedef
unsigned
char
byte
;
typedef
void
*
ptr
;
typedef
long
long
int64
;
typedef
int
int32
;
typedef
short
int16
;
...
...
AI_core_vs2017solution/ocgcore/effect.cpp
View file @
3e38ae11
...
...
@@ -401,7 +401,7 @@ int32 effect::is_activate_ready(effect* reason_effect, uint8 playerid, const tev
pduel
->
lua
->
add_param
(
e
.
reason_effect
,
PARAM_TYPE_EFFECT
);
pduel
->
lua
->
add_param
(
e
.
reason
,
PARAM_TYPE_INT
);
pduel
->
lua
->
add_param
(
e
.
reason_player
,
PARAM_TYPE_INT
);
pduel
->
lua
->
add_param
(
(
ptr
)
0
,
PARAM_TYPE_INT
);
pduel
->
lua
->
add_param
(
0
,
PARAM_TYPE_INT
);
if
(
!
pduel
->
lua
->
check_condition
(
cost
,
9
))
{
return
FALSE
;
}
...
...
@@ -415,7 +415,7 @@ int32 effect::is_activate_ready(effect* reason_effect, uint8 playerid, const tev
pduel
->
lua
->
add_param
(
e
.
reason_effect
,
PARAM_TYPE_EFFECT
);
pduel
->
lua
->
add_param
(
e
.
reason
,
PARAM_TYPE_INT
);
pduel
->
lua
->
add_param
(
e
.
reason_player
,
PARAM_TYPE_INT
);
pduel
->
lua
->
add_param
(
(
ptr
)
0
,
PARAM_TYPE_INT
);
pduel
->
lua
->
add_param
(
0
,
PARAM_TYPE_INT
);
if
(
!
pduel
->
lua
->
check_condition
(
target
,
9
))
{
return
FALSE
;
}
...
...
AI_core_vs2017solution/ocgcore/effectset.h
View file @
3e38ae11
...
...
@@ -70,50 +70,47 @@ private:
};
struct
effect_set_v
{
effect_set_v
()
:
count
(
0
)
{}
effect_set_v
()
{}
void
add_item
(
effect
*
peffect
)
{
container
.
push_back
(
peffect
);
count
++
;
}
void
remove_item
(
int
index
)
{
if
(
index
>=
count
)
if
(
index
>=
(
int
)
container
.
size
()
)
return
;
container
.
erase
(
container
.
begin
()
+
index
);
count
--
;
}
void
clear
()
{
container
.
clear
();
count
=
0
;
}
int
size
()
const
{
return
count
;
return
(
int
)
container
.
size
()
;
}
void
sort
()
{
int
count
=
(
int
)
container
.
size
();
if
(
count
<
2
)
return
;
std
::
sort
(
container
.
begin
(),
container
.
begin
()
+
count
,
effect_sort_id
);
}
effect
*
const
&
get_last
()
const
{
return
container
[
count
-
1
]
;
return
container
.
back
()
;
}
effect
*&
get_last
()
{
return
container
[
count
-
1
]
;
return
container
.
back
()
;
}
effect
*
const
&
operator
[]
(
int
index
)
const
{
return
container
[
index
]
;
return
container
.
at
(
index
)
;
}
effect
*&
operator
[]
(
int
index
)
{
return
container
[
index
]
;
return
container
.
at
(
index
)
;
}
effect
*
const
&
at
(
int
index
)
const
{
return
container
[
index
]
;
return
container
.
at
(
index
)
;
}
effect
*&
at
(
int
index
)
{
return
container
[
index
]
;
return
container
.
at
(
index
)
;
}
private:
std
::
vector
<
effect
*>
container
;
int
count
;
};
#endif //EFFECTSET_H_
AI_core_vs2017solution/ocgcore/field.cpp
View file @
3e38ae11
...
...
@@ -3323,7 +3323,7 @@ int32 field::check_chain_target(uint8 chaincount, card * pcard) {
pduel
->
lua
->
add_param
(
pchain
->
evt
.
reason_effect
,
PARAM_TYPE_EFFECT
);
pduel
->
lua
->
add_param
(
pchain
->
evt
.
reason
,
PARAM_TYPE_INT
);
pduel
->
lua
->
add_param
(
pchain
->
evt
.
reason_player
,
PARAM_TYPE_INT
);
pduel
->
lua
->
add_param
(
(
ptr
)
0
,
PARAM_TYPE_INT
);
pduel
->
lua
->
add_param
(
0
,
PARAM_TYPE_INT
);
pduel
->
lua
->
add_param
(
pcard
,
PARAM_TYPE_CARD
);
return
pduel
->
lua
->
check_condition
(
peffect
->
target
,
10
);
}
...
...
AI_core_vs2017solution/ocgcore/interpreter.cpp
View file @
3e38ae11
...
...
@@ -184,13 +184,13 @@ void interpreter::push_param(lua_State* L, bool is_coroutine) {
uint32
type
=
it
.
second
;
switch
(
type
)
{
case
PARAM_TYPE_INT
:
lua_pushinteger
(
L
,
(
int32
)
it
.
first
);
lua_pushinteger
(
L
,
(
size_t
)
it
.
first
);
break
;
case
PARAM_TYPE_STRING
:
lua_pushstring
(
L
,
(
const
char
*
)
it
.
first
);
break
;
case
PARAM_TYPE_BOOLEAN
:
lua_pushboolean
(
L
,
(
int32
)(
ptr
)
it
.
first
);
lua_pushboolean
(
L
,
(
size_t
)
it
.
first
);
break
;
case
PARAM_TYPE_CARD
:
{
if
(
it
.
first
)
...
...
@@ -214,11 +214,11 @@ void interpreter::push_param(lua_State* L, bool is_coroutine) {
break
;
}
case
PARAM_TYPE_FUNCTION
:
{
function2value
(
L
,
(
int32
)(
ptr
)
it
.
first
);
function2value
(
L
,
(
size_t
)
it
.
first
);
break
;
}
case
PARAM_TYPE_INDEX
:
{
int32
index
=
(
int32
)(
ptr
)
it
.
first
;
int32
index
=
(
size_t
)
it
.
first
;
if
(
index
>
0
)
lua_pushvalue
(
L
,
index
);
else
if
(
is_coroutine
)
{
...
...
AI_core_vs2017solution/ocgcore/ocgapi.cpp
View file @
3e38ae11
...
...
@@ -57,13 +57,13 @@ uint32 default_card_reader(uint32 code, card_data* data) {
uint32
default_message_handler
(
void
*
pduel
,
uint32
message_type
)
{
return
0
;
}
extern
"C"
DECL_DLLEXPORT
ptr
create_duel
(
uint32
seed
)
{
extern
"C"
DECL_DLLEXPORT
intptr_t
create_duel
(
uint32
seed
)
{
duel
*
pduel
=
new
duel
();
duel_set
.
insert
(
pduel
);
pduel
->
random
.
reset
(
seed
);
return
(
ptr
)
pduel
;
return
(
intptr_t
)
pduel
;
}
extern
"C"
DECL_DLLEXPORT
void
start_duel
(
ptr
pduel
,
int32
options
)
{
extern
"C"
DECL_DLLEXPORT
void
start_duel
(
intptr_t
pduel
,
int32
options
)
{
duel
*
pd
=
(
duel
*
)
pduel
;
pd
->
game_field
->
core
.
duel_options
|=
options
&
0xffff
;
int32
duel_rule
=
options
>>
16
;
...
...
@@ -103,14 +103,14 @@ extern "C" DECL_DLLEXPORT void start_duel(ptr pduel, int32 options) {
}
pd
->
game_field
->
add_process
(
PROCESSOR_TURN
,
0
,
0
,
0
,
0
,
0
);
}
extern
"C"
DECL_DLLEXPORT
void
end_duel
(
ptr
pduel
)
{
extern
"C"
DECL_DLLEXPORT
void
end_duel
(
intptr_t
pduel
)
{
duel
*
pd
=
(
duel
*
)
pduel
;
if
(
duel_set
.
count
(
pd
))
{
duel_set
.
erase
(
pd
);
delete
pd
;
}
}
extern
"C"
DECL_DLLEXPORT
void
set_player_info
(
ptr
pduel
,
int32
playerid
,
int32
lp
,
int32
startcount
,
int32
drawcount
)
{
extern
"C"
DECL_DLLEXPORT
void
set_player_info
(
intptr_t
pduel
,
int32
playerid
,
int32
lp
,
int32
startcount
,
int32
drawcount
)
{
duel
*
pd
=
(
duel
*
)
pduel
;
if
(
lp
>
0
)
pd
->
game_field
->
player
[
playerid
].
lp
=
lp
;
...
...
@@ -119,22 +119,22 @@ extern "C" DECL_DLLEXPORT void set_player_info(ptr pduel, int32 playerid, int32
if
(
drawcount
>=
0
)
pd
->
game_field
->
player
[
playerid
].
draw_count
=
drawcount
;
}
extern
"C"
DECL_DLLEXPORT
void
get_log_message
(
ptr
pduel
,
byte
*
buf
)
{
extern
"C"
DECL_DLLEXPORT
void
get_log_message
(
intptr_t
pduel
,
byte
*
buf
)
{
strcpy
((
char
*
)
buf
,
((
duel
*
)
pduel
)
->
strbuffer
);
}
extern
"C"
DECL_DLLEXPORT
int32
get_message
(
ptr
pduel
,
byte
*
buf
)
{
extern
"C"
DECL_DLLEXPORT
int32
get_message
(
intptr_t
pduel
,
byte
*
buf
)
{
int32
len
=
((
duel
*
)
pduel
)
->
read_buffer
(
buf
);
((
duel
*
)
pduel
)
->
clear_buffer
();
return
len
;
}
extern
"C"
DECL_DLLEXPORT
int32
process
(
ptr
pduel
)
{
extern
"C"
DECL_DLLEXPORT
int32
process
(
intptr_t
pduel
)
{
duel
*
pd
=
(
duel
*
)
pduel
;
int
result
=
pd
->
game_field
->
process
();
while
((
result
&
0xffff
)
==
0
&&
(
result
&
0xf0000
)
==
0
)
result
=
pd
->
game_field
->
process
();
return
result
;
}
extern
"C"
DECL_DLLEXPORT
void
new_card
(
ptr
pduel
,
uint32
code
,
uint8
owner
,
uint8
playerid
,
uint8
location
,
uint8
sequence
,
uint8
position
)
{
extern
"C"
DECL_DLLEXPORT
void
new_card
(
intptr_t
pduel
,
uint32
code
,
uint8
owner
,
uint8
playerid
,
uint8
location
,
uint8
sequence
,
uint8
position
)
{
duel
*
ptduel
=
(
duel
*
)
pduel
;
if
(
ptduel
->
game_field
->
is_location_useable
(
playerid
,
location
,
sequence
))
{
card
*
pcard
=
ptduel
->
new_card
(
code
);
...
...
@@ -151,7 +151,7 @@ extern "C" DECL_DLLEXPORT void new_card(ptr pduel, uint32 code, uint8 owner, uin
}
}
}
extern
"C"
DECL_DLLEXPORT
void
new_tag_card
(
ptr
pduel
,
uint32
code
,
uint8
owner
,
uint8
location
)
{
extern
"C"
DECL_DLLEXPORT
void
new_tag_card
(
intptr_t
pduel
,
uint32
code
,
uint8
owner
,
uint8
location
)
{
duel
*
ptduel
=
(
duel
*
)
pduel
;
if
(
owner
>
1
||
!
(
location
&
(
LOCATION_DECK
|
LOCATION_EXTRA
)))
return
;
...
...
@@ -175,7 +175,7 @@ extern "C" DECL_DLLEXPORT void new_tag_card(ptr pduel, uint32 code, uint8 owner,
break
;
}
}
extern
"C"
DECL_DLLEXPORT
int32
query_card
(
ptr
pduel
,
uint8
playerid
,
uint8
location
,
uint8
sequence
,
int32
query_flag
,
byte
*
buf
,
int32
use_cache
)
{
extern
"C"
DECL_DLLEXPORT
int32
query_card
(
intptr_t
pduel
,
uint8
playerid
,
uint8
location
,
uint8
sequence
,
int32
query_flag
,
byte
*
buf
,
int32
use_cache
)
{
if
(
playerid
!=
0
&&
playerid
!=
1
)
return
0
;
duel
*
ptduel
=
(
duel
*
)
pduel
;
...
...
@@ -208,7 +208,7 @@ extern "C" DECL_DLLEXPORT int32 query_card(ptr pduel, uint8 playerid, uint8 loca
return
4
;
}
}
extern
"C"
DECL_DLLEXPORT
int32
query_field_count
(
ptr
pduel
,
uint8
playerid
,
uint8
location
)
{
extern
"C"
DECL_DLLEXPORT
int32
query_field_count
(
intptr_t
pduel
,
uint8
playerid
,
uint8
location
)
{
duel
*
ptduel
=
(
duel
*
)
pduel
;
if
(
playerid
!=
0
&&
playerid
!=
1
)
return
0
;
...
...
@@ -237,7 +237,7 @@ extern "C" DECL_DLLEXPORT int32 query_field_count(ptr pduel, uint8 playerid, uin
}
return
0
;
}
extern
"C"
DECL_DLLEXPORT
int32
query_field_card
(
ptr
pduel
,
uint8
playerid
,
uint8
location
,
int32
query_flag
,
byte
*
buf
,
int32
use_cache
)
{
extern
"C"
DECL_DLLEXPORT
int32
query_field_card
(
intptr_t
pduel
,
uint8
playerid
,
uint8
location
,
int32
query_flag
,
byte
*
buf
,
int32
use_cache
)
{
if
(
playerid
!=
0
&&
playerid
!=
1
)
return
0
;
duel
*
ptduel
=
(
duel
*
)
pduel
;
...
...
@@ -284,7 +284,7 @@ extern "C" DECL_DLLEXPORT int32 query_field_card(ptr pduel, uint8 playerid, uint
}
return
(
int32
)(
p
-
buf
);
}
extern
"C"
DECL_DLLEXPORT
int32
query_field_info
(
ptr
pduel
,
byte
*
buf
)
{
extern
"C"
DECL_DLLEXPORT
int32
query_field_info
(
intptr_t
pduel
,
byte
*
buf
)
{
duel
*
ptduel
=
(
duel
*
)
pduel
;
byte
*
p
=
buf
;
*
p
++
=
MSG_RELOAD_FIELD
;
...
...
@@ -332,12 +332,12 @@ extern "C" DECL_DLLEXPORT int32 query_field_info(ptr pduel, byte* buf) {
}
return
(
int32
)(
p
-
buf
);
}
extern
"C"
DECL_DLLEXPORT
void
set_responsei
(
ptr
pduel
,
int32
value
)
{
extern
"C"
DECL_DLLEXPORT
void
set_responsei
(
intptr_t
pduel
,
int32
value
)
{
((
duel
*
)
pduel
)
->
set_responsei
(
value
);
}
extern
"C"
DECL_DLLEXPORT
void
set_responseb
(
ptr
pduel
,
byte
*
buf
)
{
extern
"C"
DECL_DLLEXPORT
void
set_responseb
(
intptr_t
pduel
,
byte
*
buf
)
{
((
duel
*
)
pduel
)
->
set_responseb
(
buf
);
}
extern
"C"
DECL_DLLEXPORT
int32
preload_script
(
ptr
pduel
,
const
char
*
script
,
int32
len
)
{
extern
"C"
DECL_DLLEXPORT
int32
preload_script
(
intptr_t
pduel
,
const
char
*
script
,
int32
len
)
{
return
((
duel
*
)
pduel
)
->
lua
->
load_script
(
script
);
}
AI_core_vs2017solution/ocgcore/ocgapi.h
View file @
3e38ae11
...
...
@@ -9,6 +9,8 @@
#define OCGAPI_H_
#include "common.h"
#include <cstdint>
#ifdef WIN32
#define DECL_DLLEXPORT __declspec(dllexport)
#else
...
...
@@ -34,22 +36,22 @@ byte* read_script(const char* script_name, int* len);
uint32
read_card
(
uint32
code
,
card_data
*
data
);
uint32
handle_message
(
void
*
pduel
,
uint32
message_type
);
extern
"C"
DECL_DLLEXPORT
ptr
create_duel
(
uint32
seed
);
extern
"C"
DECL_DLLEXPORT
void
start_duel
(
ptr
pduel
,
int32
options
);
extern
"C"
DECL_DLLEXPORT
void
end_duel
(
ptr
pduel
);
extern
"C"
DECL_DLLEXPORT
void
set_player_info
(
ptr
pduel
,
int32
playerid
,
int32
lp
,
int32
startcount
,
int32
drawcount
);
extern
"C"
DECL_DLLEXPORT
void
get_log_message
(
ptr
pduel
,
byte
*
buf
);
extern
"C"
DECL_DLLEXPORT
int32
get_message
(
ptr
pduel
,
byte
*
buf
);
extern
"C"
DECL_DLLEXPORT
int32
process
(
ptr
pduel
);
extern
"C"
DECL_DLLEXPORT
void
new_card
(
ptr
pduel
,
uint32
code
,
uint8
owner
,
uint8
playerid
,
uint8
location
,
uint8
sequence
,
uint8
position
);
extern
"C"
DECL_DLLEXPORT
void
new_tag_card
(
ptr
pduel
,
uint32
code
,
uint8
owner
,
uint8
location
);
extern
"C"
DECL_DLLEXPORT
int32
query_card
(
ptr
pduel
,
uint8
playerid
,
uint8
location
,
uint8
sequence
,
int32
query_flag
,
byte
*
buf
,
int32
use_cache
);
extern
"C"
DECL_DLLEXPORT
int32
query_field_count
(
ptr
pduel
,
uint8
playerid
,
uint8
location
);
extern
"C"
DECL_DLLEXPORT
int32
query_field_card
(
ptr
pduel
,
uint8
playerid
,
uint8
location
,
int32
query_flag
,
byte
*
buf
,
int32
use_cache
);
extern
"C"
DECL_DLLEXPORT
int32
query_field_info
(
ptr
pduel
,
byte
*
buf
);
extern
"C"
DECL_DLLEXPORT
void
set_responsei
(
ptr
pduel
,
int32
value
);
extern
"C"
DECL_DLLEXPORT
void
set_responseb
(
ptr
pduel
,
byte
*
buf
);
extern
"C"
DECL_DLLEXPORT
int32
preload_script
(
ptr
pduel
,
const
char
*
script
,
int32
len
);
extern
"C"
DECL_DLLEXPORT
std
::
intptr_t
create_duel
(
uint32
seed
);
extern
"C"
DECL_DLLEXPORT
void
start_duel
(
std
::
intptr_t
pduel
,
int32
options
);
extern
"C"
DECL_DLLEXPORT
void
end_duel
(
std
::
intptr_t
pduel
);
extern
"C"
DECL_DLLEXPORT
void
set_player_info
(
std
::
intptr_t
pduel
,
int32
playerid
,
int32
lp
,
int32
startcount
,
int32
drawcount
);
extern
"C"
DECL_DLLEXPORT
void
get_log_message
(
std
::
intptr_t
pduel
,
byte
*
buf
);
extern
"C"
DECL_DLLEXPORT
int32
get_message
(
std
::
intptr_t
pduel
,
byte
*
buf
);
extern
"C"
DECL_DLLEXPORT
int32
process
(
std
::
intptr_t
pduel
);
extern
"C"
DECL_DLLEXPORT
void
new_card
(
std
::
intptr_t
pduel
,
uint32
code
,
uint8
owner
,
uint8
playerid
,
uint8
location
,
uint8
sequence
,
uint8
position
);
extern
"C"
DECL_DLLEXPORT
void
new_tag_card
(
std
::
intptr_t
pduel
,
uint32
code
,
uint8
owner
,
uint8
location
);
extern
"C"
DECL_DLLEXPORT
int32
query_card
(
std
::
intptr_t
pduel
,
uint8
playerid
,
uint8
location
,
uint8
sequence
,
int32
query_flag
,
byte
*
buf
,
int32
use_cache
);
extern
"C"
DECL_DLLEXPORT
int32
query_field_count
(
std
::
intptr_t
pduel
,
uint8
playerid
,
uint8
location
);
extern
"C"
DECL_DLLEXPORT
int32
query_field_card
(
std
::
intptr_t
pduel
,
uint8
playerid
,
uint8
location
,
int32
query_flag
,
byte
*
buf
,
int32
use_cache
);
extern
"C"
DECL_DLLEXPORT
int32
query_field_info
(
std
::
intptr_t
pduel
,
byte
*
buf
);
extern
"C"
DECL_DLLEXPORT
void
set_responsei
(
std
::
intptr_t
pduel
,
int32
value
);
extern
"C"
DECL_DLLEXPORT
void
set_responseb
(
std
::
intptr_t
pduel
,
byte
*
buf
);
extern
"C"
DECL_DLLEXPORT
int32
preload_script
(
std
::
intptr_t
pduel
,
const
char
*
script
,
int32
len
);
byte
*
default_script_reader
(
const
char
*
script_name
,
int
*
len
);
uint32
default_card_reader
(
uint32
code
,
card_data
*
data
);
uint32
default_message_handler
(
void
*
pduel
,
uint32
msg_type
);
...
...
AI_core_vs2017solution/ocgcore/operations.cpp
View file @
3e38ae11
...
...
@@ -194,6 +194,7 @@ void field::special_summon_complete(effect* reason_effect, uint8 reason_player)
group* ng = pduel->new_group();
ng->container.swap(core.special_summoning);
ng->is_readonly = TRUE;
core.hint_timing[reason_player] |= TIMING_SPSUMMON;
add_process(PROCESSOR_SPSUMMON, 1, reason_effect, ng, reason_player, 0);
}
void field::destroy(card_set* targets, effect* reason_effect, uint32 reason, uint32 reason_player, uint32 playerid, uint32 destination, uint32 sequence) {
...
...
AI_core_vs2017solution/ocgcore/premake4.lua
0 → 100644
View file @
3e38ae11
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"
}
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