mirror of
https://github.com/kichikuou/xsystem35-sdl2.git
synced 2026-09-22 22:48:08 +03:00
Compare commits
266
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2936212967 | ||
|
|
e83f4da24f | ||
|
|
066295df2f | ||
|
|
40a4d8b2f6 | ||
|
|
0793b57e3c | ||
|
|
089520ec55 | ||
|
|
4bea33d852 | ||
|
|
6930acd3b1 | ||
|
|
f9a3ef8606 | ||
|
|
841deb6f81 | ||
|
|
d713e1470e | ||
|
|
6268cb6a9b | ||
|
|
a5aa8d0672 | ||
|
|
f8b7adf3d0 | ||
|
|
3e46c54ce6 | ||
|
|
0925ee86e0 | ||
|
|
7a77470a19 | ||
|
|
068a2910b5 | ||
|
|
6ef699e87d | ||
|
|
d6dd7d34b7 | ||
|
|
a4f0e18d70 | ||
|
|
80bd68214b | ||
|
|
4143cfc83b | ||
|
|
541cd22e56 | ||
|
|
d82175c9f5 | ||
|
|
21e43b5cc7 | ||
|
|
5283a0aa5d | ||
|
|
91d30c9b13 | ||
|
|
f66ebff002 | ||
|
|
98e1355461 | ||
|
|
35b1b12ab6 | ||
|
|
1e2ea9821c | ||
|
|
e5fab0f198 | ||
|
|
2e2fbbaa1b | ||
|
|
fb44e5b1e3 | ||
|
|
6690687d0f | ||
|
|
26c9f663ca | ||
|
|
d5a7040b54 | ||
|
|
3280d6073b | ||
|
|
ca09dc7413 | ||
|
|
cc60fdfb7d | ||
|
|
ac703b3448 | ||
|
|
2c6a66af8f | ||
|
|
fdcc3de352 | ||
|
|
dda7d7f077 | ||
|
|
a159e7cb24 | ||
|
|
785f46be2a | ||
|
|
7ca3f2527e | ||
|
|
f6221a04ba | ||
|
|
7069343e57 | ||
|
|
9be7b0ab68 | ||
|
|
8779763615 | ||
|
|
869e2e34dd | ||
|
|
c0daba25a5 | ||
|
|
9775c4569d | ||
|
|
21444ac1c0 | ||
|
|
d61ce9a18e | ||
|
|
04c3e22339 | ||
|
|
92f8120e4a | ||
|
|
3613358b7b | ||
|
|
fc6651642d | ||
|
|
0b15fa3506 | ||
|
|
2f8dd2d6a5 | ||
|
|
4e2d81cf47 | ||
|
|
29c85aad36 | ||
|
|
cd77cbfbf1 | ||
|
|
e18bb6cb75 | ||
|
|
34e2d60ab4 | ||
|
|
8894dd40fa | ||
|
|
2529a5b61b | ||
|
|
ca41501f6d | ||
|
|
36a0e01dcd | ||
|
|
81906641e1 | ||
|
|
da1c136b39 | ||
|
|
9878f5ca74 | ||
|
|
6da3dfef55 | ||
|
|
be1f048b33 | ||
|
|
6d5831c4e8 | ||
|
|
5ec0c0a7be | ||
|
|
4b002c676c | ||
|
|
f0bd336da1 | ||
|
|
704cfda6ef | ||
|
|
c0de87d0d8 | ||
|
|
3964a1bc27 | ||
|
|
b765332c27 | ||
|
|
9f9805128f | ||
|
|
ba0d59d5a4 | ||
|
|
d531fa3994 | ||
|
|
4d5fd5efca | ||
|
|
89a4ba2bd2 | ||
|
|
163c23af81 | ||
|
|
48d937a0c3 | ||
|
|
4aff7a1df7 | ||
|
|
303510e5c0 | ||
|
|
c7263a3082 | ||
|
|
aea53c1079 | ||
|
|
32f1e1ef8a | ||
|
|
500fffaee2 | ||
|
|
ebe3762809 | ||
|
|
4fd00a9088 | ||
|
|
44d0ddcec7 | ||
|
|
9541f3f85a | ||
|
|
b5c8b158c6 | ||
|
|
8d91657c14 | ||
|
|
ebb249cd47 | ||
|
|
379ca744d5 | ||
|
|
b892189f8b | ||
|
|
f1b4c2550b | ||
|
|
79c9bfc85a | ||
|
|
042f333564 | ||
|
|
417baec290 | ||
|
|
ec270f2378 | ||
|
|
55837e5115 | ||
|
|
97b8bcb22a | ||
|
|
862f639e2e | ||
|
|
316a06a168 | ||
|
|
c9ec20dcc8 | ||
|
|
023b8cd455 | ||
|
|
335681863c | ||
|
|
ecba592d82 | ||
|
|
dbac18c260 | ||
|
|
ed8f610f80 | ||
|
|
f753cf8670 | ||
|
|
c3cc4f3e44 | ||
|
|
e57913bfc6 | ||
|
|
f941916fb2 | ||
|
|
f5248bda8a | ||
|
|
988a072964 | ||
|
|
775b34cf1a | ||
|
|
5455bce8d6 | ||
|
|
5e5defb6bc | ||
|
|
05cca544c6 | ||
|
|
38758569bb | ||
|
|
e417811a94 | ||
|
|
b509be2b64 | ||
|
|
fa845a6439 | ||
|
|
b3cb185a35 | ||
|
|
87413d54dc | ||
|
|
440fb93b08 | ||
|
|
6d1ef1ba6f | ||
|
|
dd1f0fd230 | ||
|
|
15fb122148 | ||
|
|
91a6cf7e67 | ||
|
|
dc8025469a | ||
|
|
0bbace898d | ||
|
|
c4e5ef3c36 | ||
|
|
e039fb3193 | ||
|
|
e547c153fc | ||
|
|
fef74da3dd | ||
|
|
7baab6b616 | ||
|
|
54b219e435 | ||
|
|
a20363b901 | ||
|
|
bc9fc924ed | ||
|
|
d8fbf9a8b1 | ||
|
|
077e4d32e0 | ||
|
|
652e4b9111 | ||
|
|
3cecc58607 | ||
|
|
f31742a503 | ||
|
|
e830190537 | ||
|
|
7d8458c86d | ||
|
|
dfc10a7f34 | ||
|
|
a5684cffa4 | ||
|
|
cfa9dc3502 | ||
|
|
f978c43ee1 | ||
|
|
7871bb9328 | ||
|
|
ab32b1792f | ||
|
|
98d0a13a20 | ||
|
|
5456ac4219 | ||
|
|
f258ae42b1 | ||
|
|
6a459260e4 | ||
|
|
6580b864c0 | ||
|
|
bfd8e3e55a | ||
|
|
05cacb170f | ||
|
|
d2c861ad53 | ||
|
|
8a395a57e4 | ||
|
|
6706348c11 | ||
|
|
c66714bab6 | ||
|
|
730b15dfca | ||
|
|
ad6c84db4d | ||
|
|
9053583517 | ||
|
|
07f8f8a5f8 | ||
|
|
9f244c3dee | ||
|
|
2e895ed3ae | ||
|
|
b5010df10d | ||
|
|
fc5f89912e | ||
|
|
70ea305ca9 | ||
|
|
b4eb18c938 | ||
|
|
b9e0d97156 | ||
|
|
350d8bb367 | ||
|
|
fb10cbc52d | ||
|
|
55976a5816 | ||
|
|
827f98d24a | ||
|
|
ce67aa7028 | ||
|
|
50b3812364 | ||
|
|
616534621e | ||
|
|
1f5ec7a9a9 | ||
|
|
06223ea727 | ||
|
|
d15c770b4b | ||
|
|
60bb70c456 | ||
|
|
52322345b5 | ||
|
|
66693ad39a | ||
|
|
73fab9b628 | ||
|
|
bdfe0e8077 | ||
|
|
03f8af2241 | ||
|
|
c03b6cf6b5 | ||
|
|
1a3b779ace | ||
|
|
4c58510a37 | ||
|
|
b4c729a1f6 | ||
|
|
daf5098530 | ||
|
|
4223284781 | ||
|
|
3d70d00bce | ||
|
|
f2fbf54c32 | ||
|
|
b4d2c0832e | ||
|
|
d777b18b55 | ||
|
|
7b3efd9aaa | ||
|
|
90eb139994 | ||
|
|
aa87e3e8c0 | ||
|
|
1cd949f597 | ||
|
|
426cdaa836 | ||
|
|
8db5a9cd65 | ||
|
|
47f82e87c5 | ||
|
|
86470e543a | ||
|
|
a23ce19433 | ||
|
|
1cf197513c | ||
|
|
64c3c28336 | ||
|
|
7309ed012f | ||
|
|
515a92544b | ||
|
|
725b0ee6ab | ||
|
|
e17b447e73 | ||
|
|
6dbd31cdbc | ||
|
|
a217df39b1 | ||
|
|
80266d6454 | ||
|
|
2e17188f2b | ||
|
|
37f4d847e5 | ||
|
|
43c6688ce7 | ||
|
|
09e89e794d | ||
|
|
3fd7a58544 | ||
|
|
f0ccdcf40a | ||
|
|
1a6b7b33b9 | ||
|
|
7240971beb | ||
|
|
250fbd30a0 | ||
|
|
d3579186c6 | ||
|
|
54dcd8c5fc | ||
|
|
5c81929461 | ||
|
|
dbc15ca3b4 | ||
|
|
9a1f1c77a6 | ||
|
|
0fe5cb60a3 | ||
|
|
3e2c226866 | ||
|
|
0351f4cbcd | ||
|
|
f1eed8f2af | ||
|
|
9020e5ab1d | ||
|
|
697c15854a | ||
|
|
70a03ff02f | ||
|
|
d50e7ac150 | ||
|
|
ea5776108a | ||
|
|
8d72775daa | ||
|
|
73216073af | ||
|
|
2d237079db | ||
|
|
dbb396ae7c | ||
|
|
638e96f894 | ||
|
|
174f1ac359 | ||
|
|
af49f40d0b | ||
|
|
11442f1574 | ||
|
|
acd4dc239b | ||
|
|
70c6480181 | ||
|
|
ea747ffcc9 |
@@ -1,3 +0,0 @@
|
||||
((nil . ((indent-tabs-mode . t)
|
||||
(c-basic-offset . 4)
|
||||
(tab-width . 4))))
|
||||
@@ -0,0 +1,13 @@
|
||||
# https://EditorConfig.org
|
||||
root = true
|
||||
|
||||
[*]
|
||||
charset = utf-8
|
||||
|
||||
[*.{h,c}]
|
||||
indent_style = tab
|
||||
indent_size = 4
|
||||
|
||||
[CMakeLists.txt]
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
@@ -0,0 +1,29 @@
|
||||
name: Android Build
|
||||
on: [push, pull_request]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
- name: Install Deps
|
||||
run: sudo apt install ninja-build
|
||||
|
||||
# Workaround for https://github.com/actions/virtual-environments/issues/3078
|
||||
- name: Setup cmake
|
||||
uses: jwlawson/actions-setup-cmake@v1.9
|
||||
with:
|
||||
cmake-version: '3.19.x'
|
||||
|
||||
- name: Build
|
||||
run: |
|
||||
cd android
|
||||
ANDROID_NDK_HOME=$ANDROID_SDK_ROOT/ndk-bundle ./gradlew assembleRelease
|
||||
|
||||
- name: Upload artifacts
|
||||
uses: actions/upload-artifact@v1
|
||||
with:
|
||||
name: xsystem35-release-unsigned-apk
|
||||
path: android/app/build/outputs/apk/release/app-release-unsigned.apk
|
||||
@@ -0,0 +1,41 @@
|
||||
name: Emscripten Build
|
||||
on: [push, pull_request]
|
||||
|
||||
env:
|
||||
EM_VERSION: 2.0.25
|
||||
EM_CACHE_FOLDER: 'emsdk-cache'
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
- name: Setup cache
|
||||
id: cache-system-libraries
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: ${{env.EM_CACHE_FOLDER}}
|
||||
key: ${{env.EM_VERSION}}-${{ runner.os }}
|
||||
|
||||
- name: Setup Emscripten toolchain
|
||||
uses: mymindstorm/setup-emsdk@v10
|
||||
with:
|
||||
version: ${{ env.EM_VERSION }}
|
||||
actions-cache-folder: ${{env.EM_CACHE_FOLDER}}
|
||||
|
||||
- name: Build
|
||||
run: |
|
||||
mkdir -p out/wasm
|
||||
cd out/wasm
|
||||
emcmake cmake -DCMAKE_BUILD_TYPE=MinSizeRel ../../
|
||||
make
|
||||
mkdir xsystem35
|
||||
mv src/xsystem35.* xsystem35/
|
||||
|
||||
- name: Upload artifacts
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: xsystem35-wasm
|
||||
path: out/wasm/xsystem35
|
||||
@@ -0,0 +1,29 @@
|
||||
name: Linux Build
|
||||
on: [push, pull_request]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
build-type: ["Debug", "Release"]
|
||||
|
||||
name: Linux ${{ matrix.build-type }}
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
- name: Install Deps
|
||||
run: |
|
||||
sudo apt update
|
||||
sudo apt install libgtk-3-dev libsdl2-dev libsdl2-ttf-dev libsdl2-mixer-dev libportmidi-dev libcjson-dev
|
||||
|
||||
- name: Build
|
||||
run: |
|
||||
mkdir -p out/${{ matrix.build-type }}
|
||||
cd out/${{ matrix.build-type }}
|
||||
cmake -DCMAKE_BUILD_TYPE=${{ matrix.build-type }} ../../
|
||||
make
|
||||
|
||||
- name: Test
|
||||
run: ctest --output-on-failure
|
||||
working-directory: out/${{ matrix.build-type }}
|
||||
@@ -0,0 +1,60 @@
|
||||
name: Windows Build
|
||||
on: [push, pull_request]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: windows-2019
|
||||
strategy:
|
||||
matrix:
|
||||
mingw: ["MINGW32", "MINGW64"]
|
||||
include:
|
||||
- mingw: "MINGW32"
|
||||
package: "mingw-w64-i686"
|
||||
installer: "xsystem35-32bit"
|
||||
- mingw: "MINGW64"
|
||||
package: "mingw-w64-x86_64"
|
||||
installer: "xsystem35-64bit"
|
||||
defaults:
|
||||
run:
|
||||
shell: bash.exe --login -eo pipefail "{0}"
|
||||
env:
|
||||
MSYSTEM: ${{ matrix.mingw }}
|
||||
CHERE_INVOKING: 1
|
||||
name: MSYS2 ${{ matrix.mingw }}
|
||||
steps:
|
||||
|
||||
- name: Set up shell
|
||||
run: echo "C:\msys64\usr\bin\" >> $env:GITHUB_PATH
|
||||
shell: pwsh
|
||||
|
||||
- name: Print system version
|
||||
run: |
|
||||
uname
|
||||
echo PATH: $PATH
|
||||
|
||||
- name: Install Deps
|
||||
run: pacman -S --noconfirm ${{ matrix.package }}-SDL2 ${{ matrix.package }}-SDL2_ttf ${{ matrix.package }}-SDL2_mixer ${{ matrix.package }}-libjpeg-turbo ${{ matrix.package }}-cjson ${{ matrix.package }}-nsis ${{ matrix.package }}-ntldd-git
|
||||
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Build
|
||||
run: |
|
||||
mkdir -p out/release
|
||||
cd out/release
|
||||
cmake -G"MSYS Makefiles" -DCMAKE_BUILD_TYPE=Release ../../
|
||||
make
|
||||
|
||||
- name: Test
|
||||
run: ctest --output-on-failure
|
||||
working-directory: out/release
|
||||
|
||||
- name: Package
|
||||
working-directory: tools/installer
|
||||
run: ./make-installer.sh ../../out/release ${{ matrix.installer }}.nsi
|
||||
|
||||
- name: Upload
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: ${{ matrix.installer }}
|
||||
path: tools/installer/${{ matrix.installer }}.exe
|
||||
@@ -3,3 +3,7 @@ android/.gradle
|
||||
android/app/.externalNativeBuild
|
||||
android/app/build
|
||||
android/build
|
||||
.ccls-cache
|
||||
.dir-locals.el
|
||||
compile_commands.json
|
||||
build
|
||||
|
||||
+68
-112
@@ -2,6 +2,7 @@ cmake_minimum_required(VERSION 3.13)
|
||||
|
||||
project(xsystem35 LANGUAGES C)
|
||||
set(CMAKE_C_STANDARD 99)
|
||||
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
||||
enable_testing()
|
||||
|
||||
include(CheckIncludeFile)
|
||||
@@ -14,19 +15,11 @@ if (MSYS)
|
||||
list(APPEND CMAKE_LIBRARY_PATH $ENV{MINGW_PREFIX}/$ENV{MINGW_CHOST}/lib)
|
||||
endif ()
|
||||
|
||||
# A wrapper around find_package() that skips the check if ENABLE_<package> is false
|
||||
macro (optional_find_package package)
|
||||
option(ENABLE_${package} "Use ${package} if available" ON)
|
||||
if (ENABLE_${package})
|
||||
find_package(${package} ${ARGN})
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
# A wrapper around pkg_check_modules() that skips the check if ENABLE_<prefix> is false
|
||||
macro (optional_pkg_check_modules prefix)
|
||||
option(ENABLE_${prefix} "Use ${prefix} if available" ON)
|
||||
if (ENABLE_${prefix})
|
||||
pkg_check_modules(${prefix} ${ARGN})
|
||||
pkg_check_modules(${prefix} ${ARGN})
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
@@ -36,92 +29,85 @@ check_symbol_exists(sigaction "signal.h" HAVE_SIGACTION)
|
||||
check_symbol_exists(uname "sys/utsname.h" HAVE_UNAME)
|
||||
|
||||
if (EMSCRIPTEN)
|
||||
set(SDL2_FOUND 1)
|
||||
set(FREETYPE_FOUND 1)
|
||||
set(HAVE_JPEG 1)
|
||||
set(DEFAULT_FONT_PATH /fonts/)
|
||||
elseif (ANDROID)
|
||||
set(SDL2_FOUND 1)
|
||||
set(SDL2MIXER_FOUND 1)
|
||||
set(SDL2TTF_FOUND 1)
|
||||
find_library(ndk_zlib z)
|
||||
find_library(ndk_log log)
|
||||
else()
|
||||
include(TestBigEndian)
|
||||
TEST_BIG_ENDIAN(WORDS_BIGENDIAN)
|
||||
|
||||
if (NOT DEFINED ENABLE_MODULES)
|
||||
check_library_exists(dl dlopen "" ENABLE_MODULES)
|
||||
endif()
|
||||
if (ENABLE_MODULES)
|
||||
link_libraries(dl)
|
||||
endif()
|
||||
|
||||
find_package(ZLIB REQUIRED)
|
||||
|
||||
optional_find_package(X11)
|
||||
if (X11_xf86vmode_FOUND)
|
||||
set(HAVE_XF86VMODE 1)
|
||||
endif()
|
||||
|
||||
optional_find_package(GTK2 COMPONENTS gtk)
|
||||
if (GTK2_FOUND)
|
||||
set(ENABLE_GTK 1)
|
||||
endif()
|
||||
|
||||
optional_find_package(Freetype)
|
||||
|
||||
include(FindPkgConfig)
|
||||
if (NOT X11_FOUND)
|
||||
optional_pkg_check_modules(SDL2 IMPORTED_TARGET sdl2)
|
||||
optional_pkg_check_modules(GTK3 IMPORTED_TARGET gtk+-3.0)
|
||||
if (GTK3_FOUND)
|
||||
set(ENABLE_GTK 1)
|
||||
endif()
|
||||
|
||||
pkg_check_modules(SDL2 IMPORTED_TARGET sdl2)
|
||||
pkg_check_modules(SDL2TTF IMPORTED_TARGET SDL2_ttf)
|
||||
optional_pkg_check_modules(SDL2MIXER IMPORTED_TARGET SDL2_mixer)
|
||||
optional_pkg_check_modules(SDL2TTF IMPORTED_TARGET SDL2_ttf)
|
||||
|
||||
option(ENABLE_DEBUGGER "Enable built-in debugger" ON)
|
||||
if (ENABLE_DEBUGGER)
|
||||
pkg_check_modules(cJSON IMPORTED_TARGET libcjson)
|
||||
if (NOT cJSON_FOUND)
|
||||
# libcjson-dev of Debian buster / Ubuntu 20.04 does not install pkgconfig files.
|
||||
find_library(cJSON cjson)
|
||||
if (NOT cJSON)
|
||||
message(FATAL_ERROR "libcjson is required but not found.")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
include(FindJPEG)
|
||||
if (JPEG_FOUND)
|
||||
set(HAVE_JPEG 1)
|
||||
endif()
|
||||
|
||||
set(THREADS_PREFER_PTHREAD_FLAG ON)
|
||||
find_package(Threads)
|
||||
if (CMAKE_USE_PTHREADS_INIT)
|
||||
find_library(PORTMIDI portmidi)
|
||||
if (PORTMIDI)
|
||||
set(HAVE_PORTMIDI 1)
|
||||
set(ENABLE_MIDI_PORTMIDI 1)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
set(DEFAULT_FONT_PATH ${CMAKE_INSTALL_PREFIX}/share/xsystem35/fonts/)
|
||||
endif()
|
||||
|
||||
|
||||
# Menu
|
||||
|
||||
if (EMSCRIPTEN)
|
||||
set(SRC_MENU menu_emscripten.c)
|
||||
elseif (GTK2_FOUND)
|
||||
elseif (ANDROID)
|
||||
set(SRC_MENU menu_android.c)
|
||||
elseif (ENABLE_GTK)
|
||||
set(SRC_MENU menu.c menu_callback.c menu_gui.c s39init.c)
|
||||
|
||||
# i18n support (currently only menus are translated)
|
||||
include(FindIntl)
|
||||
include(FindGettext)
|
||||
if (Intl_FOUND AND GETTEXT_FOUND)
|
||||
set(ENABLE_NLS 1)
|
||||
add_compile_definitions(LOCALEDIR="${CMAKE_INSTALL_PREFIX}/share/locale")
|
||||
include_directories(${Intl_INCLUDE_DIRS})
|
||||
link_libraries(${Intl_LIBRARIES})
|
||||
set(ENABLE_NLS 1)
|
||||
add_compile_definitions(LOCALEDIR="${CMAKE_INSTALL_PREFIX}/share/locale")
|
||||
include_directories(${Intl_INCLUDE_DIRS})
|
||||
link_libraries(${Intl_LIBRARIES})
|
||||
endif()
|
||||
else()
|
||||
set(SRC_MENU menu_null.c)
|
||||
endif()
|
||||
|
||||
# Graphics
|
||||
|
||||
if (X11_FOUND)
|
||||
set(SRC_GRAPHDEV xcore_draw.c xcore_video.c xcore_mode.c xcore_event.c xcore_cursor.c xcore_maskupdate.c image.c xcore_image.c)
|
||||
set(SUMMARY_GRAPHDEV "X11")
|
||||
elseif (SDL2_FOUND)
|
||||
set(SRC_GRAPHDEV sdl_video.c sdl_mode.c sdl_draw.c sdl_event.c sdl_image.c sdl_cursor.c image.c)
|
||||
set(SUMMARY_GRAPHDEV "SDL2")
|
||||
set(ENABLE_SDL 1)
|
||||
else()
|
||||
message(FATAL_ERROR "*** No graphic device available ***")
|
||||
else ()
|
||||
set(SRC_MENU menu_sdl.c sdl_input.c)
|
||||
endif()
|
||||
|
||||
# PCM audio
|
||||
|
||||
if (EMSCRIPTEN)
|
||||
list(APPEND SRC_AUDIO)
|
||||
list(APPEND SRC_AUDIO pcm.emscripten.c bgm.dummy.c)
|
||||
list(APPEND SRC_AUDIO pcm.emscripten.c bgm.emscripten.c bgi.c)
|
||||
list(APPEND SUMMARY_AUDIO "Emscripten")
|
||||
elseif (SDL2MIXER_FOUND)
|
||||
list(APPEND SRC_AUDIO pcm.sdlmixer.c bgm.sdlmixer.c)
|
||||
list(APPEND SRC_AUDIO pcm.sdlmixer.c bgm.sdlmixer.c bgi.c)
|
||||
list(APPEND SUMMARY_AUDIO "SDL_mixer")
|
||||
set(ENABLE_SDLMIXER 1)
|
||||
else()
|
||||
@@ -154,7 +140,7 @@ if (SDL2MIXER_FOUND AND NOT ANDROID)
|
||||
list(APPEND SUMMARY_CDROM "SDL_mixer (wav|mp3|ogg...)")
|
||||
set(ENABLE_CDROM_MP3 1)
|
||||
endif()
|
||||
set(CDROM_DEVICE "/dev/cdrom" CACHE STRING "CDROM Device Name")
|
||||
set(CDROM_DEVICE "playlist.txt" CACHE STRING "CDROM Device Name")
|
||||
|
||||
# MIDI
|
||||
|
||||
@@ -174,82 +160,53 @@ else()
|
||||
endif()
|
||||
|
||||
if (CMAKE_SYSTEM_NAME STREQUAL "FreeBSD")
|
||||
check_symbol_exists(SNDCTL_SEQ_NRSYNTHS "machine/soundcard.h" ENABLE_MIDI_SEQMIDI)
|
||||
check_symbol_exists(SNDCTL_SEQ_NRSYNTHS "machine/soundcard.h" ENABLE_MIDI_SEQMIDI)
|
||||
elseif (CMAKE_SYSTEM_NAME MATCHES "(NetBSD|OpenBSD)")
|
||||
check_symbol_exists(SNDCTL_SEQ_NRSYNTHS "soundcard.h" ENABLE_MIDI_SEQMIDI)
|
||||
check_symbol_exists(SNDCTL_SEQ_NRSYNTHS "soundcard.h" ENABLE_MIDI_SEQMIDI)
|
||||
else ()
|
||||
check_symbol_exists(SNDCTL_SEQ_NRSYNTHS "sys/soundcard.h" ENABLE_MIDI_SEQMIDI)
|
||||
check_symbol_exists(SNDCTL_SEQ_NRSYNTHS "sys/soundcard.h" ENABLE_MIDI_SEQMIDI)
|
||||
endif()
|
||||
|
||||
if (ENABLE_MIDI_SEQMIDI)
|
||||
list(APPEND SUMMARY_MIDI "OSS sequencer")
|
||||
set(SEQ_DEVICE "/dev/sequencer" CACHE STRING "sequencer device")
|
||||
list(APPEND SUMMARY_MIDI "OSS sequencer")
|
||||
set(SEQ_DEVICE "/dev/sequencer" CACHE STRING "sequencer device")
|
||||
endif()
|
||||
|
||||
if (SDL2MIXER_FOUND)
|
||||
list(APPEND SRC_MIDI midi.sdlmixer.c)
|
||||
list(APPEND SUMMARY_MIDI "SDL_mixer")
|
||||
set(ENABLE_MIDI_SDLMIXER 1)
|
||||
list(APPEND SRC_MIDI midi.sdlmixer.c)
|
||||
list(APPEND SUMMARY_MIDI "SDL_mixer")
|
||||
set(ENABLE_MIDI_SDLMIXER 1)
|
||||
endif()
|
||||
|
||||
if (HAVE_PORTMIDI AND ENABLE_MIDI_PORTMIDI)
|
||||
list(APPEND SRC_MIDI midi.portmidi.c)
|
||||
list(APPEND SUMMARY_MIDI "PortMidi")
|
||||
link_libraries(${PORTMIDI} Threads::Threads)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Joystick
|
||||
|
||||
if (EMSCRIPTEN OR ANDROID)
|
||||
set(SRC_JOYSTICK joystick_dmy.c)
|
||||
elseif (SDL2_FOUND)
|
||||
set(SRC_JOYSTICK joystick_sdl.c)
|
||||
set(SUMMARY_JOYSTICK "SDL")
|
||||
if (NOT EMSCRIPTEN AND NOT ANDROID)
|
||||
set(HAVE_SDLJOY 1)
|
||||
else()
|
||||
check_include_file(linux/joystick.h HAVE_LINUX_JOYSTICK_H)
|
||||
if (HAVE_LINUX_JOYSTICK_H)
|
||||
set(SRC_JOYSTICK joystick_linux.c)
|
||||
set(SUMMARY_JOYSTICK "Linux ioctl")
|
||||
set(JOY_DEVICE "/dev/js0" CACHE STRING "joystick device")
|
||||
else ()
|
||||
set(SRC_JOYSTICK joystick_dmy.c)
|
||||
endif ()
|
||||
endif()
|
||||
|
||||
# Font
|
||||
|
||||
if (X11_FOUND)
|
||||
list(APPEND SRC_FONT font_x11.c)
|
||||
list(APPEND SUMMARY_FONT "x11")
|
||||
set(ENABLE_X11FONT 1)
|
||||
endif()
|
||||
if (FREETYPE_FOUND)
|
||||
list(APPEND SRC_FONT font_freetype2.c cp932tojis0213.c)
|
||||
list(APPEND SUMMARY_FONT "freetype2")
|
||||
set(ENABLE_FT2 1)
|
||||
endif()
|
||||
if (NOT X11_FOUND AND SDL2TTF_FOUND)
|
||||
list(APPEND SRC_FONT font_sdlttf.c)
|
||||
list(APPEND SUMMARY_FONT "SDL_ttf")
|
||||
set(ENABLE_SDLTTF 1)
|
||||
endif()
|
||||
if (NOT SRC_FONT)
|
||||
message(FATAL_ERROR "*** No font device available ***")
|
||||
endif()
|
||||
|
||||
# TODO: MMX
|
||||
|
||||
function (print_summary name)
|
||||
if (ARGN)
|
||||
list(JOIN ARGN ", " MSG)
|
||||
list(JOIN ARGN ", " MSG)
|
||||
else()
|
||||
set(MSG "none")
|
||||
set(MSG "none")
|
||||
endif()
|
||||
message(" ${name}: ${MSG}")
|
||||
endfunction()
|
||||
|
||||
message("xsystem35 summary:")
|
||||
message("------------------")
|
||||
print_summary(graphics ${SUMMARY_GRAPHDEV})
|
||||
print_summary(audio ${SUMMARY_AUDIO})
|
||||
print_summary(cdrom ${SUMMARY_CDROM})
|
||||
print_summary(midi ${SUMMARY_MIDI})
|
||||
print_summary(font ${SUMMARY_FONT})
|
||||
print_summary(joystick ${SUMMARY_JOYSTICK})
|
||||
message("------------------")
|
||||
|
||||
@@ -266,6 +223,5 @@ if (ENABLE_NLS)
|
||||
add_subdirectory(po)
|
||||
endif()
|
||||
|
||||
if (ENABLE_MODULES)
|
||||
add_subdirectory(modules)
|
||||
endif()
|
||||
add_subdirectory(modules)
|
||||
target_link_libraries(xsystem35 PRIVATE modules)
|
||||
|
||||
@@ -1,26 +1,24 @@
|
||||
# xsytem35-sdl2
|
||||
|
||||
アリスソフトのゲームエンジン System3.x のフリー実装である xsystem35 を SDL2 に対応して、emscripten でコンパイルできるようにしたものです。
|
||||
This is a multi-platform port of xsystem35, a free implementation of AriceSoft's System3.x game engine.
|
||||
|
||||
## ビルド方法
|
||||
### Linux
|
||||
## Download
|
||||
Prebuilt binaries for Windows and Android can be downloaded from the [Releases](https://github.com/kichikuou/xsystem35-sdl2/releases) page.
|
||||
|
||||
[cmake](https://cmake.org/) が必要です。
|
||||
## Build
|
||||
### Linux (Debian / Ubuntu)
|
||||
|
||||
$ sudo apt install build-essential cmake libgtk-3-dev libsdl2-dev libsdl2-ttf-dev libsdl2-mixer-dev libcjson-dev
|
||||
$ mkdir -p out/debug
|
||||
$ cd out/debug
|
||||
$ cmake -DCMAKE_BUILD_TYPE=Debug ../../
|
||||
$ make && make install
|
||||
|
||||
cmake の実行でエラーになる場合は必要なライブラリをインストールしてください。
|
||||
|
||||
グラフィックスシステムとして X11 と SDL2 が使用可能です。両方存在する場合は X11 が優先されますが、`cmake` のオプションに `-DENABLE_X11=NO` を指定すると SDL2 が使われます。
|
||||
|
||||
### MacOS
|
||||
|
||||
[Homebrew](https://brew.sh/index_ja) が必要です。
|
||||
[Homebrew](https://brew.sh/index_ja) is needed.
|
||||
|
||||
$ brew install cmake pkg-config sdl2 sdl2_mixer freetype
|
||||
$ brew install cmake pkg-config sdl2 sdl2_mixer sdl2_ttf libjpeg cjson
|
||||
$ mkdir -p out/debug
|
||||
$ cd out/debug
|
||||
$ cmake -DCMAKE_BUILD_TYPE=Debug ../../
|
||||
@@ -28,9 +26,9 @@ cmake の実行でエラーになる場合は必要なライブラリをイン
|
||||
|
||||
### Windows
|
||||
|
||||
[MSYS2](https://www.msys2.org) が必要です。
|
||||
[MSYS2](https://www.msys2.org) is needed.
|
||||
|
||||
$ pacman -S cmake mingw-w64-x86_64-cmake mingw-w64-x86_64-SDL2 mingw-w64-x86_64-SDL2_ttf mingw-w64-x86_64-SDL2_mixer
|
||||
$ pacman -S cmake mingw-w64-x86_64-cmake mingw-w64-x86_64-SDL2 mingw-w64-x86_64-SDL2_ttf mingw-w64-x86_64-SDL2_mixer mingw-w64-x86_64-libjpeg-turbo mingw-w64-x86_64-cjson
|
||||
$ mkdir -p out/debug
|
||||
$ cd out/debug
|
||||
$ cmake -G"MSYS Makefiles" -DCMAKE_BUILD_TYPE=Debug ../../
|
||||
@@ -43,8 +41,8 @@ cmake の実行でエラーになる場合は必要なライブラリをイン
|
||||
$ emcmake cmake -DCMAKE_BUILD_TYPE=MinSizeRel ../../
|
||||
$ make
|
||||
|
||||
実行するには、[鬼畜王 on Webのリポジトリ](https://github.com/kichikuou/web)をチェックアウトして、`docs`ディレクトリに `out/xsystem35.*` をすべてコピーしてください。
|
||||
To use the generated binary, checkout [Kichikuou on Web](https://github.com/kichikuou/web) and copy `out/xsystem35.*` into its `docs` directory.
|
||||
|
||||
### Android
|
||||
|
||||
[android/README.md](android/) を参照してください。
|
||||
See [android/README.md](android/).
|
||||
|
||||
+12
-13
@@ -6,7 +6,7 @@ Prebuilt APKs are [here](https://github.com/kichikuou/xsystem35-sdl2/releases).
|
||||
## Build
|
||||
Prerequisites:
|
||||
- CMake >=3.13
|
||||
- Android SDK >=26
|
||||
- Android SDK >=28
|
||||
- Android NDK >=r15c
|
||||
|
||||
### Using Android Studio
|
||||
@@ -15,20 +15,20 @@ Open this directory as an Android Studio project.
|
||||
### Command line build
|
||||
Configure environment variables and run the `gradlew` script in this folder.
|
||||
|
||||
Example build instructions (for Debian Stretch):
|
||||
Example build instructions (for Debian buster):
|
||||
```sh
|
||||
# Install necessary packages
|
||||
sudo apt install git wget unzip default-jdk-headless ninja-build
|
||||
sudo apt -t stretch-backports install cmake
|
||||
sudo apt install git wget unzip default-jdk-headless cmake ninja-build
|
||||
|
||||
# Install Android SDK / NDK
|
||||
export ANDROID_HOME=$HOME/android-sdk
|
||||
export PATH=$PATH:$ANDROID_HOME/tools
|
||||
export PATH=$PATH:$ANDROID_HOME/platform-tools
|
||||
wget https://dl.google.com/android/repository/sdk-tools-linux-4333796.zip
|
||||
unzip sdk-tools-linux-4333796.zip -d $ANDROID_HOME
|
||||
yes |$ANDROID_HOME/tools/bin/sdkmanager --licenses
|
||||
$ANDROID_HOME/tools/bin/sdkmanager ndk-bundle
|
||||
export ANDROID_SDK_ROOT=$HOME/android-sdk
|
||||
mkdir -p $ANDROID_SDK_ROOT/cmdline-tools
|
||||
wget https://dl.google.com/android/repository/commandlinetools-linux-7302050_latest.zip
|
||||
unzip commandlinetools-linux-7302050_latest.zip -d $ANDROID_SDK_ROOT/cmdline-tools
|
||||
mv $ANDROID_SDK_ROOT/cmdline-tools/cmdline-tools $ANDROID_SDK_ROOT/cmdline-tools/tools
|
||||
yes |$ANDROID_SDK_ROOT/cmdline-tools/tools/bin/sdkmanager --licenses
|
||||
$ANDROID_SDK_ROOT/cmdline-tools/tools/bin/sdkmanager ndk-bundle
|
||||
export ANDROID_NDK_HOME=$ANDROID_SDK_ROOT/ndk-bundle
|
||||
|
||||
# Check out and build xsystem35
|
||||
git clone https://github.com/kichikuou/xsystem35-sdl2.git
|
||||
@@ -44,7 +44,7 @@ cd xsystem35-sdl2/android
|
||||
4. The game starts. Two-finger touch is treated as a right click.
|
||||
|
||||
### Preparing a ZIP
|
||||
- Include all `.ALD` files and `.ain` files if any.
|
||||
- Include all files in the `GAMEDATA` folder (`.ALD` files and others). `.EXE` and `.DLL` are not really needed, but you can include them as well.
|
||||
- Music files (`.mp3`, `.ogg` or `.wav`) whose file names end with a number are recognized as BGM files. For example:
|
||||
- `Track2.mp3`
|
||||
- `15.ogg`
|
||||
@@ -58,4 +58,3 @@ Note: This form of ZIP can be used in [Kichikuou on Web](http://kichikuou.github
|
||||
|
||||
## Known Issues
|
||||
- Android versions older than 7.0 cannot handle ZIPs containing Shift-JIS file names. This is the case with some ZIPs distributed on [retroc.net](http://retropc.net/alice/). If you get the error "This type of ZIP is not supported.", unzip the ZIP file on your PC and re-archive it with a modern ZIP creation software.
|
||||
- DLL modules used in System3.9 games (大悪司 and later) are not supported yet.
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
def buildAsLibrary = project.hasProperty('BUILD_AS_LIBRARY');
|
||||
def buildAsLibrary = project.hasProperty('BUILD_AS_LIBRARY')
|
||||
def buildAsApplication = !buildAsLibrary
|
||||
if (buildAsApplication) {
|
||||
apply plugin: 'com.android.application'
|
||||
@@ -9,15 +9,15 @@ else {
|
||||
apply plugin: 'kotlin-android'
|
||||
|
||||
android {
|
||||
compileSdkVersion 26
|
||||
compileSdkVersion 28
|
||||
defaultConfig {
|
||||
if (buildAsApplication) {
|
||||
applicationId "io.github.kichikuou.xsystem35"
|
||||
}
|
||||
minSdkVersion 19
|
||||
targetSdkVersion 26
|
||||
versionCode 1
|
||||
versionName "0.1.0"
|
||||
targetSdkVersion 28
|
||||
versionCode 5
|
||||
versionName "0.2.3"
|
||||
externalNativeBuild {
|
||||
cmake {
|
||||
arguments "-DANDROID_APP_PLATFORM=android-16", "-DANDROID_STL=c++_static"
|
||||
|
||||
@@ -7,24 +7,23 @@ project(GAME)
|
||||
# android_ndk_import_module_cpufeatures()
|
||||
|
||||
include(FetchContent)
|
||||
# TODO: Use SDL2 2.0.11 once released
|
||||
FetchContent_Declare(
|
||||
SDL
|
||||
URL https://hg.libsdl.org/SDL/archive/a5f93b21dfe0.tar.gz # rev 13383
|
||||
URL_HASH SHA1=a7e9696f7ef8af7c4b89671b096c38d1a4cbf90c
|
||||
URL https://libsdl.org/release/SDL2-2.0.16.tar.gz
|
||||
URL_HASH SHA1=57825428174adb2ac947e4014080c262505aa972
|
||||
PATCH_COMMAND patch -p1 -i ${CMAKE_CURRENT_LIST_DIR}/SDL.patch
|
||||
)
|
||||
# TODO: Use SDL2_ttf 2.0.16 once released
|
||||
FetchContent_Declare(
|
||||
SDL_ttf
|
||||
URL https://hg.libsdl.org/SDL_ttf/archive/d56d67db41d8.tar.gz # rev 420
|
||||
URL_HASH SHA1=143089a2b2973a5baeee0914af43608cfe8e1d87
|
||||
GIT_REPOSITORY https://github.com/libsdl-org/SDL_ttf.git
|
||||
GIT_TAG 11722a2bb4335d489d724c08cfdbb45f97d07aa7
|
||||
)
|
||||
# TODO: Use SDL2_mixer 2.0.5 once released
|
||||
FetchContent_Declare(
|
||||
SDL_mixer
|
||||
URL https://hg.libsdl.org/SDL_mixer/archive/d2686bcfcba2.tar.gz # rev 1127
|
||||
URL_HASH SHA1=4e62e29bd5628b262b3ffb6d5d29861c76a1500e
|
||||
GIT_REPOSITORY https://github.com/libsdl-org/SDL_mixer.git
|
||||
GIT_TAG 20433729fb318f7b6f773a42ffa410114cb067f2
|
||||
)
|
||||
|
||||
# Compilation of SDL and companion libraries
|
||||
@@ -41,11 +40,9 @@ endif()
|
||||
FetchContent_GetProperties(SDL_mixer)
|
||||
if(NOT sdl_mixer_POPULATED)
|
||||
FetchContent_Populate(SDL_mixer)
|
||||
SET(SUPPORT_OGG ON CACHE BOOL "Enable OGG support in SDL_mixer" FORCE)
|
||||
add_subdirectory(${sdl_mixer_SOURCE_DIR} ${sdl_mixer_BINARY_DIR})
|
||||
# Workaround for CMakeLists.txt bugs of SDL_mixer.
|
||||
# TODO: Fix these in upstream
|
||||
add_library(vorbisfile INTERFACE)
|
||||
target_include_directories(SDL2_mixer PUBLIC ${sdl_mixer_SOURCE_DIR}/include)
|
||||
target_compile_definitions(SDL2_mixer PRIVATE MUSIC_WAV)
|
||||
endif()
|
||||
|
||||
# The main CMakeLists.txt of xsystem35
|
||||
|
||||
@@ -16,17 +16,31 @@
|
||||
android:required="false" />
|
||||
|
||||
<!-- Game controller support -->
|
||||
<uses-feature
|
||||
android:name="android.hardware.bluetooth"
|
||||
android:required="false" />
|
||||
<uses-feature
|
||||
android:name="android.hardware.gamepad"
|
||||
android:required="false" />
|
||||
<uses-feature
|
||||
android:name="android.hardware.usb.host"
|
||||
android:required="false" />
|
||||
|
||||
<!-- External mouse input events -->
|
||||
<uses-feature
|
||||
android:name="android.hardware.type.pc"
|
||||
android:required="false" />
|
||||
|
||||
<!-- Allow reading from external storage -->
|
||||
<!-- Audio recording support -->
|
||||
<!-- if you want to capture audio, uncomment this. -->
|
||||
<!-- <uses-feature
|
||||
android:name="android.hardware.microphone"
|
||||
android:required="false" /> -->
|
||||
|
||||
<!-- Allow writing to external storage -->
|
||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
||||
<!-- Allow access to Bluetooth devices -->
|
||||
<!-- <uses-permission android:name="android.permission.BLUETOOTH" /> -->
|
||||
<!-- Allow access to the vibrator -->
|
||||
<!-- <uses-permission android:name="android.permission.VIBRATE" /> -->
|
||||
|
||||
@@ -60,7 +74,7 @@
|
||||
<activity android:name=".GameActivity"
|
||||
android:label="@string/app_name"
|
||||
android:alwaysRetainTaskState="true"
|
||||
android:configChanges="orientation|uiMode|screenLayout|screenSize|smallestScreenSize|keyboard|keyboardHidden|navigation"
|
||||
android:configChanges="layoutDirection|locale|orientation|uiMode|screenLayout|screenSize|smallestScreenSize|keyboard|keyboardHidden|navigation"
|
||||
android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
|
||||
android:hardwareAccelerated="true"
|
||||
>
|
||||
|
||||
@@ -17,10 +17,13 @@
|
||||
*/
|
||||
package io.github.kichikuou.xsystem35
|
||||
|
||||
import android.app.AlertDialog
|
||||
import android.media.MediaPlayer
|
||||
import android.os.Bundle
|
||||
import android.util.Base64
|
||||
import android.text.InputType
|
||||
import android.util.Log
|
||||
import android.widget.EditText
|
||||
import android.widget.NumberPicker
|
||||
import org.libsdl.app.SDLActivity
|
||||
import java.io.File
|
||||
import java.io.IOException
|
||||
@@ -30,6 +33,7 @@ import java.io.IOException
|
||||
class GameActivity : SDLActivity() {
|
||||
companion object {
|
||||
const val EXTRA_GAME_ROOT = "GAME_ROOT"
|
||||
const val EXTRA_ARCHIVE_NAME = "ARCHIVE_NAME"
|
||||
}
|
||||
|
||||
private lateinit var gameRoot: File
|
||||
@@ -64,20 +68,92 @@ class GameActivity : SDLActivity() {
|
||||
|
||||
override fun setTitle(title: CharSequence?) {
|
||||
super.setTitle(title)
|
||||
val str = title?.toString()?.substringAfter(':', "")
|
||||
if (str.isNullOrEmpty())
|
||||
return
|
||||
var str = title?.toString()?.substringAfter(':', "")
|
||||
if (str.isNullOrEmpty()) {
|
||||
str = intent.getStringExtra(EXTRA_ARCHIVE_NAME)
|
||||
if (str == null)
|
||||
return
|
||||
}
|
||||
File(gameRoot, Launcher.TITLE_FILE).writeText(str)
|
||||
Launcher.updateGameList()
|
||||
}
|
||||
|
||||
// These functions are called in the SDL thread by JNI.
|
||||
@Suppress("unused") fun cddaStart(track: Int, loop: Int) = cdda.start(track, loop)
|
||||
private fun textInputDialog(msg: String, oldVal: String, maxLen: Int, result: Array<String?>) {
|
||||
val input = EditText(this)
|
||||
input.inputType = InputType.TYPE_CLASS_TEXT
|
||||
input.setText(oldVal)
|
||||
AlertDialog.Builder(this)
|
||||
.setMessage(msg)
|
||||
.setView(input)
|
||||
.setPositiveButton(R.string.ok) {_, _ ->
|
||||
val s = input.text.toString()
|
||||
result[0] = if (s.length <= maxLen) s else s.substring(0, maxLen)
|
||||
}
|
||||
.setNegativeButton(R.string.cancel) {_, _ -> }
|
||||
.setOnDismissListener {
|
||||
synchronized(result) {
|
||||
@Suppress("PLATFORM_CLASS_MAPPED_TO_KOTLIN") (result as Object).notify()
|
||||
}
|
||||
}
|
||||
.show()
|
||||
}
|
||||
|
||||
private fun numberInputDialog(msg: String, min: Int, max: Int, initial: Int, result: IntArray) {
|
||||
val input = NumberPicker(this)
|
||||
input.minValue = min
|
||||
input.maxValue = max
|
||||
input.value = initial
|
||||
AlertDialog.Builder(this)
|
||||
.setMessage(msg)
|
||||
.setView(input)
|
||||
.setPositiveButton(R.string.ok) {_, _ ->
|
||||
input.clearFocus()
|
||||
result[0] = input.value
|
||||
}
|
||||
.setNegativeButton(R.string.cancel) {_, _ -> }
|
||||
.setOnDismissListener {
|
||||
synchronized(result) {
|
||||
@Suppress("PLATFORM_CLASS_MAPPED_TO_KOTLIN") (result as Object).notify()
|
||||
}
|
||||
}
|
||||
.show()
|
||||
}
|
||||
|
||||
// The functions below are called in the SDL thread by JNI.
|
||||
@Suppress("unused") fun cddaStart(track: Int, loop: Boolean) = cdda.start(track, loop)
|
||||
@Suppress("unused") fun cddaStop() = cdda.stop()
|
||||
@Suppress("unused") fun cddaCurrentPosition() = cdda.currentPosition()
|
||||
@Suppress("unused") fun midiStart(buf: ByteArray, loop: Int) = midi.start(buf, loop)
|
||||
@Suppress("unused") fun midiStart(path: String, loop: Boolean) = midi.start(path, loop)
|
||||
@Suppress("unused") fun midiStop() = midi.stop()
|
||||
@Suppress("unused") fun midiCurrentPosition() = midi.currentPosition()
|
||||
|
||||
@Suppress("unused") fun inputString(msg: String, oldVal: String, maxLen: Int): String? {
|
||||
val result = arrayOfNulls<String?>(1)
|
||||
runOnUiThread { textInputDialog(msg, oldVal, maxLen, result) }
|
||||
// Block the calling thread.
|
||||
synchronized(result) {
|
||||
try {
|
||||
@Suppress("PLATFORM_CLASS_MAPPED_TO_KOTLIN") (result as Object).wait()
|
||||
} catch (ex: InterruptedException) {
|
||||
ex.printStackTrace()
|
||||
}
|
||||
}
|
||||
return result[0]
|
||||
}
|
||||
|
||||
@Suppress("unused") fun inputNumber(msg: String, min: Int, max: Int, initial: Int): Int {
|
||||
val result = intArrayOf(-1)
|
||||
runOnUiThread { numberInputDialog(msg, min, max, initial, result) }
|
||||
// Block the calling thread.
|
||||
synchronized(result) {
|
||||
try {
|
||||
@Suppress("PLATFORM_CLASS_MAPPED_TO_KOTLIN") (result as Object).wait()
|
||||
} catch (ex: InterruptedException) {
|
||||
ex.printStackTrace()
|
||||
}
|
||||
}
|
||||
return result[0]
|
||||
}
|
||||
}
|
||||
|
||||
private class CddaPlayer(private val playlistPath: File) {
|
||||
@@ -92,18 +168,18 @@ private class CddaPlayer(private val playlistPath: File) {
|
||||
private val player = MediaPlayer()
|
||||
private var playerPaused = false
|
||||
|
||||
fun start(track: Int, loop: Int) {
|
||||
fun start(track: Int, loop: Boolean) {
|
||||
val f = playlist.elementAtOrNull(track)
|
||||
if (f.isNullOrEmpty()) {
|
||||
Log.w("cddaStart", "No playlist entry for track $track")
|
||||
return
|
||||
}
|
||||
Log.v("cddaStart", f)
|
||||
Log.v("cddaStart", "$f Loop:$loop")
|
||||
try {
|
||||
player.apply {
|
||||
reset()
|
||||
setDataSource(File(playlistPath.parent, f).path)
|
||||
isLooping = loop == 0
|
||||
isLooping = loop
|
||||
prepare()
|
||||
start()
|
||||
}
|
||||
@@ -148,13 +224,12 @@ private class MidiPlayer {
|
||||
private var playing = false
|
||||
private var playerPaused = false
|
||||
|
||||
fun start(buf: ByteArray, loop: Int) {
|
||||
val url = "data:audio/midi;base64," + Base64.encodeToString(buf, Base64.DEFAULT)
|
||||
fun start(path: String, loop: Boolean) {
|
||||
try {
|
||||
player.apply {
|
||||
reset()
|
||||
setDataSource(url)
|
||||
isLooping = loop == 0
|
||||
setDataSource(path)
|
||||
isLooping = loop
|
||||
prepare()
|
||||
start()
|
||||
}
|
||||
|
||||
@@ -23,6 +23,7 @@ import android.os.Handler
|
||||
import android.os.Message
|
||||
import android.util.Log
|
||||
import java.io.*
|
||||
import java.lang.StringBuilder
|
||||
import java.nio.charset.Charset
|
||||
import java.util.*
|
||||
import java.util.zip.ZipEntry
|
||||
@@ -34,7 +35,7 @@ private var gLauncher: Launcher? = null
|
||||
interface LauncherObserver {
|
||||
fun onGameListChange()
|
||||
fun onInstallProgress(path: String)
|
||||
fun onInstallSuccess(path: File)
|
||||
fun onInstallSuccess(path: File, archiveName: String?)
|
||||
fun onInstallFailure(msgId: Int)
|
||||
}
|
||||
|
||||
@@ -60,7 +61,7 @@ class Launcher private constructor(private val rootDir: File) {
|
||||
}
|
||||
}
|
||||
|
||||
data class Entry(val path: File, val title: String)
|
||||
data class Entry(val path: File, val title: String, val timestamp: Long)
|
||||
val games = arrayListOf<Entry>()
|
||||
val titles: List<String>
|
||||
get() = games.map(Entry::title)
|
||||
@@ -72,7 +73,7 @@ class Launcher private constructor(private val rootDir: File) {
|
||||
updateGameList()
|
||||
}
|
||||
|
||||
fun install(input: InputStream) {
|
||||
fun install(input: InputStream, archiveName: String?) {
|
||||
val dir = createDirForGame()
|
||||
@SuppressLint("HandlerLeak")
|
||||
val handler = object : Handler() {
|
||||
@@ -83,7 +84,7 @@ class Launcher private constructor(private val rootDir: File) {
|
||||
}
|
||||
SUCCESS -> {
|
||||
isInstalling = false
|
||||
observer?.onInstallSuccess(msg.obj as File)
|
||||
observer?.onInstallSuccess(msg.obj as File, archiveName)
|
||||
}
|
||||
FAILURE -> {
|
||||
isInstalling = false
|
||||
@@ -107,6 +108,7 @@ class Launcher private constructor(private val rootDir: File) {
|
||||
|
||||
private fun updateGameList() {
|
||||
var saveDirFound = false
|
||||
games.clear()
|
||||
for (path in rootDir.listFiles()) {
|
||||
if (!path.isDirectory)
|
||||
continue
|
||||
@@ -115,13 +117,15 @@ class Launcher private constructor(private val rootDir: File) {
|
||||
continue
|
||||
}
|
||||
try {
|
||||
val title = File(path, TITLE_FILE).readText()
|
||||
games.add(Entry(path, title))
|
||||
val titleFile = File(path, TITLE_FILE)
|
||||
val title = titleFile.readText()
|
||||
games.add(Entry(path, title, titleFile.lastModified()))
|
||||
} catch (e: IOException) {
|
||||
// Incomplete game installation. Delete it.
|
||||
path.deleteRecursively()
|
||||
}
|
||||
}
|
||||
games.sortByDescending(Entry::timestamp)
|
||||
if (!saveDirFound) {
|
||||
File(rootDir, SAVE_DIR).mkdir()
|
||||
}
|
||||
@@ -139,11 +143,7 @@ class Launcher private constructor(private val rootDir: File) {
|
||||
|
||||
// Throws IOException
|
||||
fun exportSaveData(output: OutputStream) {
|
||||
if (Build.VERSION.SDK_INT >= 24) {
|
||||
ZipOutputStream(output.buffered(), Charset.forName("Shift_JIS"))
|
||||
} else {
|
||||
ZipOutputStream(output.buffered())
|
||||
}.use { zip ->
|
||||
ZipOutputStream(output.buffered()).use { zip ->
|
||||
for (path in File(rootDir, SAVE_DIR).listFiles()) {
|
||||
if (path.isDirectory || path.name.endsWith(".asd."))
|
||||
continue
|
||||
@@ -184,7 +184,7 @@ class Launcher private constructor(private val rootDir: File) {
|
||||
private fun extractFiles(input: InputStream, outDir: File, handler: Handler) {
|
||||
try {
|
||||
val configWriter = GameConfigWriter()
|
||||
forEachZipEntry(input) { zipEntry, zip ->
|
||||
val hadDecodeError = forEachZipEntry(input) { zipEntry, zip ->
|
||||
Log.i("extractFiles", zipEntry.name)
|
||||
val path = File(outDir, zipEntry.name)
|
||||
if (zipEntry.isDirectory)
|
||||
@@ -196,49 +196,57 @@ class Launcher private constructor(private val rootDir: File) {
|
||||
}
|
||||
configWriter.maybeAdd(zipEntry.name)
|
||||
}
|
||||
if (!configWriter.readyToWrite()) {
|
||||
val msgId = if (hadDecodeError) R.string.unsupported_zip else R.string.cannot_find_ald
|
||||
handler.sendMessage(handler.obtainMessage(FAILURE, msgId))
|
||||
return
|
||||
}
|
||||
configWriter.write(outDir)
|
||||
handler.sendMessage(handler.obtainMessage(SUCCESS, outDir))
|
||||
} catch (e: InstallFailureException) {
|
||||
handler.sendMessage(handler.obtainMessage(FAILURE, e.msgId))
|
||||
} catch (e: UTFDataFormatException) {
|
||||
// Attempted to read Shift_JIS zip in Android < 7
|
||||
handler.sendMessage(handler.obtainMessage(FAILURE, R.string.unsupported_zip))
|
||||
} catch (e: IOException) {
|
||||
Log.e("launcher", "Failed to extract ZIP", e)
|
||||
handler.sendMessage(handler.obtainMessage(FAILURE, R.string.zip_extraction_error))
|
||||
}
|
||||
}
|
||||
|
||||
class InstallFailureException(val msgId: Int) : Exception()
|
||||
|
||||
// A helper class which generates xsystem35.gr and playlist.txt in the game root directory.
|
||||
private class GameConfigWriter {
|
||||
private val grLines = arrayListOf<String>()
|
||||
private val grb = StringBuilder()
|
||||
private var basename: String? = null
|
||||
private val aldRegex = """(.*?)([a-z])([a-z])\.ald""".toRegex(RegexOption.IGNORE_CASE)
|
||||
private val resourceType = mapOf(
|
||||
private val aldRegex = """(.*?)([a-z])([a-z])\.(ald|wai|bgi)""".toRegex(RegexOption.IGNORE_CASE)
|
||||
private val aldType = mapOf(
|
||||
"b" to "BGM",
|
||||
"d" to "Data",
|
||||
"g" to "Graphics",
|
||||
"m" to "Midi",
|
||||
"r" to "Resource",
|
||||
"s" to "Scenario",
|
||||
"w" to "Wave")
|
||||
|
||||
private val specialResources = mapOf(
|
||||
"system39.ain" to "Ain",
|
||||
"system39.ini" to "Init",
|
||||
"sactefam.kld" to "SACT01"
|
||||
)
|
||||
private val audioRegex = """.*?(\d+)\.(wav|mp3|ogg)""".toRegex(RegexOption.IGNORE_CASE)
|
||||
private val audioFiles: Array<String?> = arrayOfNulls(100)
|
||||
|
||||
fun maybeAdd(path: String) {
|
||||
val name = File(path).name
|
||||
|
||||
if (name.toLowerCase(Locale.US) == "system39.ain") {
|
||||
grLines.add("Ain $path")
|
||||
specialResources[name.toLowerCase(Locale.US)]?.let {
|
||||
grb.appendln("$it $path")
|
||||
return
|
||||
}
|
||||
aldRegex.matchEntire(name)?.let {
|
||||
val type = resourceType[it.groupValues[2].toLowerCase(Locale.US)]
|
||||
val ext = it.groupValues[4].toUpperCase(Locale.US)
|
||||
val type = if (ext == "ALD") {
|
||||
aldType[it.groupValues[2].toLowerCase(Locale.US)]
|
||||
} else {
|
||||
ext
|
||||
}
|
||||
val id = it.groupValues[3].toUpperCase(Locale.US)
|
||||
if (type != null) {
|
||||
grLines.add("$type$id $path")
|
||||
grb.appendln("$type$id $path")
|
||||
basename = it.groupValues[1]
|
||||
}
|
||||
}
|
||||
@@ -249,13 +257,13 @@ class Launcher private constructor(private val rootDir: File) {
|
||||
}
|
||||
}
|
||||
|
||||
fun readyToWrite() = basename != null
|
||||
|
||||
fun write(outDir: File) {
|
||||
basename ?: throw InstallFailureException(R.string.cannot_find_ald)
|
||||
for (id in 'A' .. 'Z') {
|
||||
grLines.add("Save$id ../save/${basename}s${id.toLowerCase()}.asd")
|
||||
grb.appendln("Save$id ../save/${basename}s${id.toLowerCase()}.asd")
|
||||
}
|
||||
grLines.add("")
|
||||
val gr = grLines.joinToString("\n")
|
||||
val gr = grb.toString()
|
||||
Log.i("xsystem35.gr", gr)
|
||||
File(outDir, "xsystem35.gr").writeText(gr)
|
||||
|
||||
@@ -265,16 +273,25 @@ class Launcher private constructor(private val rootDir: File) {
|
||||
}
|
||||
}
|
||||
|
||||
private fun forEachZipEntry(input: InputStream, action: (ZipEntry, ZipInputStream) -> Unit) {
|
||||
private fun forEachZipEntry(input: InputStream, action: (ZipEntry, ZipInputStream) -> Unit): Boolean {
|
||||
val zip = if (Build.VERSION.SDK_INT >= 24) {
|
||||
ZipInputStream(input.buffered(), Charset.forName("Shift_JIS"))
|
||||
} else {
|
||||
ZipInputStream(input.buffered())
|
||||
}
|
||||
var hadDecodeError = false
|
||||
zip.use {
|
||||
while (true) {
|
||||
val zipEntry = zip.nextEntry ?: break
|
||||
action(zipEntry, zip)
|
||||
try {
|
||||
val zipEntry = zip.nextEntry ?: break
|
||||
action(zipEntry, zip)
|
||||
} catch (e: UTFDataFormatException) {
|
||||
// Attempted to read Shift_JIS zip in Android < 7
|
||||
Log.w("forEachZipEntry", "UTFDataFormatException: skipping a zip entry")
|
||||
zip.closeEntry()
|
||||
hadDecodeError = true
|
||||
}
|
||||
}
|
||||
}
|
||||
return hadDecodeError
|
||||
}
|
||||
|
||||
@@ -19,7 +19,9 @@ package io.github.kichikuou.xsystem35
|
||||
|
||||
import android.app.*
|
||||
import android.content.Intent
|
||||
import android.net.Uri
|
||||
import android.os.Bundle
|
||||
import android.provider.OpenableColumns
|
||||
import android.util.Log
|
||||
import android.view.Menu
|
||||
import android.view.MenuItem
|
||||
@@ -60,7 +62,7 @@ class LauncherActivity : ListActivity(), AdapterView.OnItemLongClickListener, La
|
||||
override fun onListItemClick(l: ListView?, v: View?, position: Int, id: Long) {
|
||||
super.onListItemClick(l, v, position, id)
|
||||
if (position < launcher.games.size) {
|
||||
startGame(launcher.games[position].path)
|
||||
startGame(launcher.games[position].path, null)
|
||||
} else {
|
||||
val i = Intent(Intent.ACTION_GET_CONTENT)
|
||||
i.type = CONTENT_TYPE_ZIP
|
||||
@@ -112,7 +114,7 @@ class LauncherActivity : ListActivity(), AdapterView.OnItemLongClickListener, La
|
||||
INSTALL_REQUEST -> {
|
||||
val input = contentResolver.openInputStream(uri) ?: return
|
||||
showProgressDialog()
|
||||
launcher.install(input)
|
||||
launcher.install(input, getArchiveName(uri))
|
||||
}
|
||||
SAVEDATA_EXPORT_REQUEST -> try {
|
||||
launcher.exportSaveData(contentResolver.openOutputStream(uri)!!)
|
||||
@@ -144,9 +146,9 @@ class LauncherActivity : ListActivity(), AdapterView.OnItemLongClickListener, La
|
||||
progressDialog?.setProgress(getString(R.string.install_progress, path))
|
||||
}
|
||||
|
||||
override fun onInstallSuccess(path: File) {
|
||||
override fun onInstallSuccess(path: File, archiveName: String?) {
|
||||
dismissProgressDialog()
|
||||
startGame(path)
|
||||
startGame(path, archiveName)
|
||||
}
|
||||
|
||||
override fun onInstallFailure(msgId: Int) {
|
||||
@@ -154,10 +156,11 @@ class LauncherActivity : ListActivity(), AdapterView.OnItemLongClickListener, La
|
||||
errorDialog(msgId)
|
||||
}
|
||||
|
||||
private fun startGame(path: File) {
|
||||
private fun startGame(path: File, archiveName: String?) {
|
||||
val i = Intent()
|
||||
i.setClass(applicationContext, GameActivity::class.java)
|
||||
i.putExtra(GameActivity.EXTRA_GAME_ROOT, path.path)
|
||||
i.putExtra(GameActivity.EXTRA_ARCHIVE_NAME, archiveName)
|
||||
startActivity(i)
|
||||
}
|
||||
|
||||
@@ -181,6 +184,17 @@ class LauncherActivity : ListActivity(), AdapterView.OnItemLongClickListener, La
|
||||
.setPositiveButton(R.string.ok) {_, _ -> }
|
||||
.show()
|
||||
}
|
||||
|
||||
private fun getArchiveName(uri: Uri): String? {
|
||||
val cursor = contentResolver.query(uri, null, null, null, null, null)
|
||||
cursor?.use {
|
||||
if (it.moveToFirst()) {
|
||||
val fname = it.getString(it.getColumnIndex(OpenableColumns.DISPLAY_NAME))
|
||||
return if (fname.endsWith(".zip", true)) fname.dropLast(4) else fname
|
||||
}
|
||||
}
|
||||
return null
|
||||
}
|
||||
}
|
||||
|
||||
@Suppress("DEPRECATION") // for ProgressDialog
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package org.libsdl.app;
|
||||
|
||||
import android.hardware.usb.UsbDevice;
|
||||
|
||||
interface HIDDevice
|
||||
{
|
||||
public int getId();
|
||||
@@ -9,6 +11,7 @@ interface HIDDevice
|
||||
public int getVersion();
|
||||
public String getManufacturerName();
|
||||
public String getProductName();
|
||||
public UsbDevice getDevice();
|
||||
public boolean open();
|
||||
public int sendFeatureReport(byte[] report);
|
||||
public int sendOutputReport(byte[] report);
|
||||
|
||||
@@ -9,6 +9,7 @@ import android.bluetooth.BluetoothGattDescriptor;
|
||||
import android.bluetooth.BluetoothManager;
|
||||
import android.bluetooth.BluetoothProfile;
|
||||
import android.bluetooth.BluetoothGattService;
|
||||
import android.hardware.usb.UsbDevice;
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
import android.util.Log;
|
||||
@@ -165,13 +166,13 @@ class HIDDeviceBLESteamController extends BluetoothGattCallback implements HIDDe
|
||||
mHandler = new Handler(Looper.getMainLooper());
|
||||
|
||||
mGatt = connectGatt();
|
||||
final HIDDeviceBLESteamController finalThis = this;
|
||||
mHandler.postDelayed(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
finalThis.checkConnectionForChromebookIssue();
|
||||
}
|
||||
}, CHROMEBOOK_CONNECTION_CHECK_INTERVAL);
|
||||
// final HIDDeviceBLESteamController finalThis = this;
|
||||
// mHandler.postDelayed(new Runnable() {
|
||||
// @Override
|
||||
// public void run() {
|
||||
// finalThis.checkConnectionForChromebookIssue();
|
||||
// }
|
||||
// }, CHROMEBOOK_CONNECTION_CHECK_INTERVAL);
|
||||
}
|
||||
|
||||
public String getIdentifier() {
|
||||
@@ -469,7 +470,7 @@ class HIDDeviceBLESteamController extends BluetoothGattCallback implements HIDDe
|
||||
// Only register controller with the native side once it has been fully configured
|
||||
if (!isRegistered()) {
|
||||
Log.v(TAG, "Registering Steam Controller with ID: " + getId());
|
||||
mManager.HIDDeviceConnected(getId(), getIdentifier(), getVendorId(), getProductId(), getSerialNumber(), getVersion(), getManufacturerName(), getProductName(), 0);
|
||||
mManager.HIDDeviceConnected(getId(), getIdentifier(), getVendorId(), getProductId(), getSerialNumber(), getVersion(), getManufacturerName(), getProductName(), 0, 0, 0, 0);
|
||||
setRegistered();
|
||||
}
|
||||
}
|
||||
@@ -563,6 +564,11 @@ class HIDDeviceBLESteamController extends BluetoothGattCallback implements HIDDe
|
||||
return "Steam Controller";
|
||||
}
|
||||
|
||||
@Override
|
||||
public UsbDevice getDevice() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean open() {
|
||||
return true;
|
||||
|
||||
@@ -7,6 +7,7 @@ import android.bluetooth.BluetoothAdapter;
|
||||
import android.bluetooth.BluetoothDevice;
|
||||
import android.bluetooth.BluetoothManager;
|
||||
import android.bluetooth.BluetoothProfile;
|
||||
import android.os.Build;
|
||||
import android.util.Log;
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.Context;
|
||||
@@ -19,8 +20,9 @@ import android.hardware.usb.*;
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
public class HIDDeviceManager {
|
||||
@@ -50,7 +52,6 @@ public class HIDDeviceManager {
|
||||
|
||||
private Context mContext;
|
||||
private HashMap<Integer, HIDDevice> mDevicesById = new HashMap<Integer, HIDDevice>();
|
||||
private HashMap<UsbDevice, HIDDeviceUSB> mUSBDevices = new HashMap<UsbDevice, HIDDeviceUSB>();
|
||||
private HashMap<BluetoothDevice, HIDDeviceBLESteamController> mBluetoothDevices = new HashMap<BluetoothDevice, HIDDeviceBLESteamController>();
|
||||
private int mNextDeviceId = 0;
|
||||
private SharedPreferences mSharedPreferences = null;
|
||||
@@ -241,17 +242,7 @@ public class HIDDeviceManager {
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isHIDDeviceUSB(UsbDevice usbDevice) {
|
||||
for (int interface_number = 0; interface_number < usbDevice.getInterfaceCount(); ++interface_number) {
|
||||
if (isHIDDeviceInterface(usbDevice, interface_number)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private boolean isHIDDeviceInterface(UsbDevice usbDevice, int interface_number) {
|
||||
UsbInterface usbInterface = usbDevice.getInterface(interface_number);
|
||||
private boolean isHIDDeviceInterface(UsbDevice usbDevice, UsbInterface usbInterface) {
|
||||
if (usbInterface.getInterfaceClass() == UsbConstants.USB_CLASS_HID) {
|
||||
return true;
|
||||
}
|
||||
@@ -285,6 +276,7 @@ public class HIDDeviceManager {
|
||||
0x15e4, // Numark
|
||||
0x162e, // Joytech
|
||||
0x1689, // Razer Onza
|
||||
0x1949, // Lab126, Inc.
|
||||
0x1bad, // Harmonix
|
||||
0x24c6, // PowerA
|
||||
};
|
||||
@@ -331,45 +323,54 @@ public class HIDDeviceManager {
|
||||
}
|
||||
|
||||
private void handleUsbDeviceAttached(UsbDevice usbDevice) {
|
||||
if (isHIDDeviceUSB(usbDevice)) {
|
||||
connectHIDDeviceUSB(usbDevice);
|
||||
}
|
||||
connectHIDDeviceUSB(usbDevice);
|
||||
}
|
||||
|
||||
private void handleUsbDeviceDetached(UsbDevice usbDevice) {
|
||||
HIDDeviceUSB device = mUSBDevices.get(usbDevice);
|
||||
if (device == null)
|
||||
return;
|
||||
|
||||
int id = device.getId();
|
||||
mUSBDevices.remove(usbDevice);
|
||||
mDevicesById.remove(id);
|
||||
device.shutdown();
|
||||
HIDDeviceDisconnected(id);
|
||||
List<Integer> devices = new ArrayList<Integer>();
|
||||
for (HIDDevice device : mDevicesById.values()) {
|
||||
if (usbDevice.equals(device.getDevice())) {
|
||||
devices.add(device.getId());
|
||||
}
|
||||
}
|
||||
for (int id : devices) {
|
||||
HIDDevice device = mDevicesById.get(id);
|
||||
mDevicesById.remove(id);
|
||||
device.shutdown();
|
||||
HIDDeviceDisconnected(id);
|
||||
}
|
||||
}
|
||||
|
||||
private void handleUsbDevicePermission(UsbDevice usbDevice, boolean permission_granted) {
|
||||
HIDDeviceUSB device = mUSBDevices.get(usbDevice);
|
||||
if (device == null)
|
||||
return;
|
||||
|
||||
boolean opened = false;
|
||||
if (permission_granted) {
|
||||
opened = device.open();
|
||||
for (HIDDevice device : mDevicesById.values()) {
|
||||
if (usbDevice.equals(device.getDevice())) {
|
||||
boolean opened = false;
|
||||
if (permission_granted) {
|
||||
opened = device.open();
|
||||
}
|
||||
HIDDeviceOpenResult(device.getId(), opened);
|
||||
}
|
||||
}
|
||||
HIDDeviceOpenResult(device.getId(), opened);
|
||||
}
|
||||
|
||||
private void connectHIDDeviceUSB(UsbDevice usbDevice) {
|
||||
synchronized (this) {
|
||||
for (int interface_number = 0; interface_number < usbDevice.getInterfaceCount(); interface_number++) {
|
||||
if (isHIDDeviceInterface(usbDevice, interface_number)) {
|
||||
HIDDeviceUSB device = new HIDDeviceUSB(this, usbDevice, interface_number);
|
||||
int interface_mask = 0;
|
||||
for (int interface_index = 0; interface_index < usbDevice.getInterfaceCount(); interface_index++) {
|
||||
UsbInterface usbInterface = usbDevice.getInterface(interface_index);
|
||||
if (isHIDDeviceInterface(usbDevice, usbInterface)) {
|
||||
// Check to see if we've already added this interface
|
||||
// This happens with the Xbox Series X controller which has a duplicate interface 0, which is inactive
|
||||
int interface_id = usbInterface.getId();
|
||||
if ((interface_mask & (1 << interface_id)) != 0) {
|
||||
continue;
|
||||
}
|
||||
interface_mask |= (1 << interface_id);
|
||||
|
||||
HIDDeviceUSB device = new HIDDeviceUSB(this, usbDevice, interface_index);
|
||||
int id = device.getId();
|
||||
mUSBDevices.put(usbDevice, device);
|
||||
mDevicesById.put(id, device);
|
||||
HIDDeviceConnected(id, device.getIdentifier(), device.getVendorId(), device.getProductId(), device.getSerialNumber(), device.getVersion(), device.getManufacturerName(), device.getProductName(), interface_number);
|
||||
break;
|
||||
HIDDeviceConnected(id, device.getIdentifier(), device.getVendorId(), device.getProductId(), device.getSerialNumber(), device.getVersion(), device.getManufacturerName(), device.getProductName(), usbInterface.getId(), usbInterface.getInterfaceClass(), usbInterface.getInterfaceSubclass(), usbInterface.getInterfaceProtocol());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -383,6 +384,11 @@ public class HIDDeviceManager {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!mContext.getPackageManager().hasSystemFeature(PackageManager.FEATURE_BLUETOOTH_LE) || (Build.VERSION.SDK_INT < 18)) {
|
||||
Log.d(TAG, "Couldn't initialize Bluetooth, this version of Android does not support Bluetooth LE");
|
||||
return;
|
||||
}
|
||||
|
||||
// Find bonded bluetooth controllers and create SteamControllers for them
|
||||
mBluetoothManager = (BluetoothManager)mContext.getSystemService(Context.BLUETOOTH_SERVICE);
|
||||
if (mBluetoothManager == null) {
|
||||
@@ -566,33 +572,27 @@ public class HIDDeviceManager {
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
public boolean openDevice(int deviceID) {
|
||||
Log.v(TAG, "openDevice deviceID=" + deviceID);
|
||||
HIDDevice device = getDevice(deviceID);
|
||||
if (device == null) {
|
||||
HIDDeviceDisconnected(deviceID);
|
||||
return false;
|
||||
}
|
||||
|
||||
// Look to see if this is a USB device and we have permission to access it
|
||||
for (HIDDeviceUSB device : mUSBDevices.values()) {
|
||||
if (deviceID == device.getId()) {
|
||||
UsbDevice usbDevice = device.getDevice();
|
||||
if (!mUsbManager.hasPermission(usbDevice)) {
|
||||
HIDDeviceOpenPending(deviceID);
|
||||
try {
|
||||
mUsbManager.requestPermission(usbDevice, PendingIntent.getBroadcast(mContext, 0, new Intent(HIDDeviceManager.ACTION_USB_PERMISSION), 0));
|
||||
} catch (Exception e) {
|
||||
Log.v(TAG, "Couldn't request permission for USB device " + usbDevice);
|
||||
HIDDeviceOpenResult(deviceID, false);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
UsbDevice usbDevice = device.getDevice();
|
||||
if (usbDevice != null && !mUsbManager.hasPermission(usbDevice)) {
|
||||
HIDDeviceOpenPending(deviceID);
|
||||
try {
|
||||
mUsbManager.requestPermission(usbDevice, PendingIntent.getBroadcast(mContext, 0, new Intent(HIDDeviceManager.ACTION_USB_PERMISSION), 0));
|
||||
} catch (Exception e) {
|
||||
Log.v(TAG, "Couldn't request permission for USB device " + usbDevice);
|
||||
HIDDeviceOpenResult(deviceID, false);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
try {
|
||||
Log.v(TAG, "openDevice deviceID=" + deviceID);
|
||||
HIDDevice device;
|
||||
device = getDevice(deviceID);
|
||||
if (device == null) {
|
||||
HIDDeviceDisconnected(deviceID);
|
||||
return false;
|
||||
}
|
||||
|
||||
return device.open();
|
||||
} catch (Exception e) {
|
||||
Log.e(TAG, "Got exception: " + Log.getStackTraceString(e));
|
||||
@@ -602,7 +602,7 @@ public class HIDDeviceManager {
|
||||
|
||||
public int sendOutputReport(int deviceID, byte[] report) {
|
||||
try {
|
||||
Log.v(TAG, "sendOutputReport deviceID=" + deviceID + " length=" + report.length);
|
||||
//Log.v(TAG, "sendOutputReport deviceID=" + deviceID + " length=" + report.length);
|
||||
HIDDevice device;
|
||||
device = getDevice(deviceID);
|
||||
if (device == null) {
|
||||
@@ -619,7 +619,7 @@ public class HIDDeviceManager {
|
||||
|
||||
public int sendFeatureReport(int deviceID, byte[] report) {
|
||||
try {
|
||||
Log.v(TAG, "sendFeatureReport deviceID=" + deviceID + " length=" + report.length);
|
||||
//Log.v(TAG, "sendFeatureReport deviceID=" + deviceID + " length=" + report.length);
|
||||
HIDDevice device;
|
||||
device = getDevice(deviceID);
|
||||
if (device == null) {
|
||||
@@ -636,7 +636,7 @@ public class HIDDeviceManager {
|
||||
|
||||
public boolean getFeatureReport(int deviceID, byte[] report) {
|
||||
try {
|
||||
Log.v(TAG, "getFeatureReport deviceID=" + deviceID);
|
||||
//Log.v(TAG, "getFeatureReport deviceID=" + deviceID);
|
||||
HIDDevice device;
|
||||
device = getDevice(deviceID);
|
||||
if (device == null) {
|
||||
@@ -675,7 +675,7 @@ public class HIDDeviceManager {
|
||||
private native void HIDDeviceRegisterCallback();
|
||||
private native void HIDDeviceReleaseCallback();
|
||||
|
||||
native void HIDDeviceConnected(int deviceID, String identifier, int vendorId, int productId, String serial_number, int release_number, String manufacturer_string, String product_string, int interface_number);
|
||||
native void HIDDeviceConnected(int deviceID, String identifier, int vendorId, int productId, String serial_number, int release_number, String manufacturer_string, String product_string, int interface_number, int interface_class, int interface_subclass, int interface_protocol);
|
||||
native void HIDDeviceOpenPending(int deviceID);
|
||||
native void HIDDeviceOpenResult(int deviceID, boolean opened);
|
||||
native void HIDDeviceDisconnected(int deviceID);
|
||||
|
||||
@@ -11,6 +11,7 @@ class HIDDeviceUSB implements HIDDevice {
|
||||
|
||||
protected HIDDeviceManager mManager;
|
||||
protected UsbDevice mDevice;
|
||||
protected int mInterfaceIndex;
|
||||
protected int mInterface;
|
||||
protected int mDeviceId;
|
||||
protected UsbDeviceConnection mConnection;
|
||||
@@ -20,16 +21,17 @@ class HIDDeviceUSB implements HIDDevice {
|
||||
protected boolean mRunning;
|
||||
protected boolean mFrozen;
|
||||
|
||||
public HIDDeviceUSB(HIDDeviceManager manager, UsbDevice usbDevice, int interface_number) {
|
||||
public HIDDeviceUSB(HIDDeviceManager manager, UsbDevice usbDevice, int interface_index) {
|
||||
mManager = manager;
|
||||
mDevice = usbDevice;
|
||||
mInterface = interface_number;
|
||||
mInterfaceIndex = interface_index;
|
||||
mInterface = mDevice.getInterface(mInterfaceIndex).getId();
|
||||
mDeviceId = manager.getDeviceIDForIdentifier(getIdentifier());
|
||||
mRunning = false;
|
||||
}
|
||||
|
||||
public String getIdentifier() {
|
||||
return String.format("%s/%x/%x", mDevice.getDeviceName(), mDevice.getVendorId(), mDevice.getProductId());
|
||||
return String.format("%s/%x/%x/%d", mDevice.getDeviceName(), mDevice.getVendorId(), mDevice.getProductId(), mInterfaceIndex);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -51,7 +53,12 @@ class HIDDeviceUSB implements HIDDevice {
|
||||
public String getSerialNumber() {
|
||||
String result = null;
|
||||
if (Build.VERSION.SDK_INT >= 21) {
|
||||
result = mDevice.getSerialNumber();
|
||||
try {
|
||||
result = mDevice.getSerialNumber();
|
||||
}
|
||||
catch (SecurityException exception) {
|
||||
//Log.w(TAG, "App permissions mean we cannot get serial number for device " + getDeviceName() + " message: " + exception.getMessage());
|
||||
}
|
||||
}
|
||||
if (result == null) {
|
||||
result = "";
|
||||
@@ -88,6 +95,7 @@ class HIDDeviceUSB implements HIDDevice {
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public UsbDevice getDevice() {
|
||||
return mDevice;
|
||||
}
|
||||
@@ -104,19 +112,15 @@ class HIDDeviceUSB implements HIDDevice {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Force claim all interfaces
|
||||
for (int i = 0; i < mDevice.getInterfaceCount(); i++) {
|
||||
UsbInterface iface = mDevice.getInterface(i);
|
||||
|
||||
if (!mConnection.claimInterface(iface, true)) {
|
||||
Log.w(TAG, "Failed to claim interfaces on USB device " + getDeviceName());
|
||||
close();
|
||||
return false;
|
||||
}
|
||||
// Force claim our interface
|
||||
UsbInterface iface = mDevice.getInterface(mInterfaceIndex);
|
||||
if (!mConnection.claimInterface(iface, true)) {
|
||||
Log.w(TAG, "Failed to claim interfaces on USB device " + getDeviceName());
|
||||
close();
|
||||
return false;
|
||||
}
|
||||
|
||||
// Find the endpoints
|
||||
UsbInterface iface = mDevice.getInterface(mInterface);
|
||||
for (int j = 0; j < iface.getEndpointCount(); j++) {
|
||||
UsbEndpoint endpt = iface.getEndpoint(j);
|
||||
switch (endpt.getDirection()) {
|
||||
@@ -166,7 +170,7 @@ class HIDDeviceUSB implements HIDDevice {
|
||||
UsbConstants.USB_TYPE_CLASS | 0x01 /*RECIPIENT_INTERFACE*/ | UsbConstants.USB_DIR_OUT,
|
||||
0x09/*HID set_report*/,
|
||||
(3/*HID feature*/ << 8) | report_number,
|
||||
0,
|
||||
mInterface,
|
||||
report, offset, length,
|
||||
1000/*timeout millis*/);
|
||||
|
||||
@@ -210,7 +214,7 @@ class HIDDeviceUSB implements HIDDevice {
|
||||
UsbConstants.USB_TYPE_CLASS | 0x01 /*RECIPIENT_INTERFACE*/ | UsbConstants.USB_DIR_IN,
|
||||
0x01/*HID get_report*/,
|
||||
(3/*HID feature*/ << 8) | report_number,
|
||||
0,
|
||||
mInterface,
|
||||
report, offset, length,
|
||||
1000/*timeout millis*/);
|
||||
|
||||
@@ -250,10 +254,8 @@ class HIDDeviceUSB implements HIDDevice {
|
||||
mInputThread = null;
|
||||
}
|
||||
if (mConnection != null) {
|
||||
for (int i = 0; i < mDevice.getInterfaceCount(); i++) {
|
||||
UsbInterface iface = mDevice.getInterface(i);
|
||||
mConnection.releaseInterface(iface);
|
||||
}
|
||||
UsbInterface iface = mDevice.getInterface(mInterfaceIndex);
|
||||
mConnection.releaseInterface(iface);
|
||||
mConnection.close();
|
||||
mConnection = null;
|
||||
}
|
||||
|
||||
@@ -2,7 +2,8 @@ package org.libsdl.app;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import java.lang.reflect.*;
|
||||
import java.lang.Class;
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
/**
|
||||
SDL library initialization
|
||||
@@ -51,16 +52,16 @@ public class SDL {
|
||||
// To use ReLinker, just add it as a dependency. For more information, see
|
||||
// https://github.com/KeepSafe/ReLinker for ReLinker's repository.
|
||||
//
|
||||
Class relinkClass = mContext.getClassLoader().loadClass("com.getkeepsafe.relinker.ReLinker");
|
||||
Class relinkListenerClass = mContext.getClassLoader().loadClass("com.getkeepsafe.relinker.ReLinker$LoadListener");
|
||||
Class contextClass = mContext.getClassLoader().loadClass("android.content.Context");
|
||||
Class stringClass = mContext.getClassLoader().loadClass("java.lang.String");
|
||||
Class<?> relinkClass = mContext.getClassLoader().loadClass("com.getkeepsafe.relinker.ReLinker");
|
||||
Class<?> relinkListenerClass = mContext.getClassLoader().loadClass("com.getkeepsafe.relinker.ReLinker$LoadListener");
|
||||
Class<?> contextClass = mContext.getClassLoader().loadClass("android.content.Context");
|
||||
Class<?> stringClass = mContext.getClassLoader().loadClass("java.lang.String");
|
||||
|
||||
// Get a 'force' instance of the ReLinker, so we can ensure libraries are reinstalled if
|
||||
// they've changed during updates.
|
||||
Method forceMethod = relinkClass.getDeclaredMethod("force");
|
||||
Object relinkInstance = forceMethod.invoke(null);
|
||||
Class relinkInstanceClass = relinkInstance.getClass();
|
||||
Class<?> relinkInstanceClass = relinkInstance.getClass();
|
||||
|
||||
// Actually load the library!
|
||||
Method loadMethod = relinkInstanceClass.getDeclaredMethod("loadLibrary", contextClass, stringClass, stringClass, relinkListenerClass);
|
||||
@@ -77,7 +78,7 @@ public class SDL {
|
||||
catch (final SecurityException se) {
|
||||
throw se;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected static Context mContext;
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,6 +1,10 @@
|
||||
package org.libsdl.app;
|
||||
|
||||
import android.media.*;
|
||||
import android.media.AudioFormat;
|
||||
import android.media.AudioManager;
|
||||
import android.media.AudioRecord;
|
||||
import android.media.AudioTrack;
|
||||
import android.media.MediaRecorder;
|
||||
import android.os.Build;
|
||||
import android.util.Log;
|
||||
|
||||
@@ -199,7 +203,6 @@ public class SDLAudioManager
|
||||
results[0] = mAudioRecord.getSampleRate();
|
||||
results[1] = mAudioRecord.getAudioFormat();
|
||||
results[2] = mAudioRecord.getChannelCount();
|
||||
results[3] = desiredFrames;
|
||||
|
||||
} else {
|
||||
if (mAudioTrack == null) {
|
||||
@@ -223,8 +226,8 @@ public class SDLAudioManager
|
||||
results[0] = mAudioTrack.getSampleRate();
|
||||
results[1] = mAudioTrack.getAudioFormat();
|
||||
results[2] = mAudioTrack.getChannelCount();
|
||||
results[3] = desiredFrames;
|
||||
}
|
||||
results[3] = desiredFrames;
|
||||
|
||||
Log.v(TAG, "Opening " + (isCapture ? "capture" : "playback") + ", got " + results[3] + " frames of " + results[2] + " channel " + getAudioFormatString(results[1]) + " audio at " + results[0] + " Hz");
|
||||
|
||||
|
||||
@@ -6,9 +6,14 @@ import java.util.Comparator;
|
||||
import java.util.List;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.*;
|
||||
import android.view.*;
|
||||
import android.os.Build;
|
||||
import android.os.VibrationEffect;
|
||||
import android.os.Vibrator;
|
||||
import android.util.Log;
|
||||
import android.view.InputDevice;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
|
||||
|
||||
public class SDLControllerManager
|
||||
@@ -98,7 +103,7 @@ public class SDLControllerManager
|
||||
int sources = device.getSources();
|
||||
|
||||
/* This is called for every button press, so let's not spam the logs */
|
||||
/**
|
||||
/*
|
||||
if ((sources & InputDevice.SOURCE_CLASS_JOYSTICK) != 0) {
|
||||
Log.v(TAG, "Input device " + device.getName() + " has class joystick.");
|
||||
}
|
||||
@@ -108,7 +113,7 @@ public class SDLControllerManager
|
||||
if ((sources & InputDevice.SOURCE_GAMEPAD) == InputDevice.SOURCE_GAMEPAD) {
|
||||
Log.v(TAG, "Input device " + device.getName() + " is a gamepad.");
|
||||
}
|
||||
**/
|
||||
*/
|
||||
|
||||
return ((sources & InputDevice.SOURCE_CLASS_JOYSTICK) != 0 ||
|
||||
((sources & InputDevice.SOURCE_DPAD) == InputDevice.SOURCE_DPAD) ||
|
||||
@@ -167,7 +172,7 @@ class SDLJoystickHandler_API16 extends SDLJoystickHandler {
|
||||
}
|
||||
}
|
||||
|
||||
private ArrayList<SDLJoystick> mJoysticks;
|
||||
private final ArrayList<SDLJoystick> mJoysticks;
|
||||
|
||||
public SDLJoystickHandler_API16() {
|
||||
|
||||
@@ -177,13 +182,14 @@ class SDLJoystickHandler_API16 extends SDLJoystickHandler {
|
||||
@Override
|
||||
public void pollInputDevices() {
|
||||
int[] deviceIds = InputDevice.getDeviceIds();
|
||||
for(int i=0; i < deviceIds.length; ++i) {
|
||||
SDLJoystick joystick = getJoystick(deviceIds[i]);
|
||||
if (joystick == null) {
|
||||
joystick = new SDLJoystick();
|
||||
InputDevice joystickDevice = InputDevice.getDevice(deviceIds[i]);
|
||||
if (SDLControllerManager.isDeviceSDLJoystick(deviceIds[i])) {
|
||||
joystick.device_id = deviceIds[i];
|
||||
|
||||
for (int device_id : deviceIds) {
|
||||
if (SDLControllerManager.isDeviceSDLJoystick(device_id)) {
|
||||
SDLJoystick joystick = getJoystick(device_id);
|
||||
if (joystick == null) {
|
||||
InputDevice joystickDevice = InputDevice.getDevice(device_id);
|
||||
joystick = new SDLJoystick();
|
||||
joystick.device_id = device_id;
|
||||
joystick.name = joystickDevice.getName();
|
||||
joystick.desc = getJoystickDescriptor(joystickDevice);
|
||||
joystick.axes = new ArrayList<InputDevice.MotionRange>();
|
||||
@@ -191,53 +197,57 @@ class SDLJoystickHandler_API16 extends SDLJoystickHandler {
|
||||
|
||||
List<InputDevice.MotionRange> ranges = joystickDevice.getMotionRanges();
|
||||
Collections.sort(ranges, new RangeComparator());
|
||||
for (InputDevice.MotionRange range : ranges ) {
|
||||
for (InputDevice.MotionRange range : ranges) {
|
||||
if ((range.getSource() & InputDevice.SOURCE_CLASS_JOYSTICK) != 0) {
|
||||
if (range.getAxis() == MotionEvent.AXIS_HAT_X ||
|
||||
range.getAxis() == MotionEvent.AXIS_HAT_Y) {
|
||||
if (range.getAxis() == MotionEvent.AXIS_HAT_X || range.getAxis() == MotionEvent.AXIS_HAT_Y) {
|
||||
joystick.hats.add(range);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
joystick.axes.add(range);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
mJoysticks.add(joystick);
|
||||
SDLControllerManager.nativeAddJoystick(joystick.device_id, joystick.name, joystick.desc, getVendorId(joystickDevice), getProductId(joystickDevice), false, getButtonMask(joystickDevice), joystick.axes.size(), joystick.hats.size()/2, 0);
|
||||
SDLControllerManager.nativeAddJoystick(joystick.device_id, joystick.name, joystick.desc,
|
||||
getVendorId(joystickDevice), getProductId(joystickDevice), false,
|
||||
getButtonMask(joystickDevice), joystick.axes.size(), joystick.hats.size()/2, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Check removed devices */
|
||||
ArrayList<Integer> removedDevices = new ArrayList<Integer>();
|
||||
for(int i=0; i < mJoysticks.size(); i++) {
|
||||
int device_id = mJoysticks.get(i).device_id;
|
||||
int j;
|
||||
for (j=0; j < deviceIds.length; j++) {
|
||||
if (device_id == deviceIds[j]) break;
|
||||
ArrayList<Integer> removedDevices = null;
|
||||
for (SDLJoystick joystick : mJoysticks) {
|
||||
int device_id = joystick.device_id;
|
||||
int i;
|
||||
for (i = 0; i < deviceIds.length; i++) {
|
||||
if (device_id == deviceIds[i]) break;
|
||||
}
|
||||
if (j == deviceIds.length) {
|
||||
removedDevices.add(Integer.valueOf(device_id));
|
||||
if (i == deviceIds.length) {
|
||||
if (removedDevices == null) {
|
||||
removedDevices = new ArrayList<Integer>();
|
||||
}
|
||||
removedDevices.add(device_id);
|
||||
}
|
||||
}
|
||||
|
||||
for(int i=0; i < removedDevices.size(); i++) {
|
||||
int device_id = removedDevices.get(i).intValue();
|
||||
SDLControllerManager.nativeRemoveJoystick(device_id);
|
||||
for (int j=0; j < mJoysticks.size(); j++) {
|
||||
if (mJoysticks.get(j).device_id == device_id) {
|
||||
mJoysticks.remove(j);
|
||||
break;
|
||||
if (removedDevices != null) {
|
||||
for (int device_id : removedDevices) {
|
||||
SDLControllerManager.nativeRemoveJoystick(device_id);
|
||||
for (int i = 0; i < mJoysticks.size(); i++) {
|
||||
if (mJoysticks.get(i).device_id == device_id) {
|
||||
mJoysticks.remove(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected SDLJoystick getJoystick(int device_id) {
|
||||
for(int i=0; i < mJoysticks.size(); i++) {
|
||||
if (mJoysticks.get(i).device_id == device_id) {
|
||||
return mJoysticks.get(i);
|
||||
for (SDLJoystick joystick : mJoysticks) {
|
||||
if (joystick.device_id == device_id) {
|
||||
return joystick;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
@@ -248,25 +258,21 @@ class SDLJoystickHandler_API16 extends SDLJoystickHandler {
|
||||
if ((event.getSource() & InputDevice.SOURCE_JOYSTICK) != 0) {
|
||||
int actionPointerIndex = event.getActionIndex();
|
||||
int action = event.getActionMasked();
|
||||
switch(action) {
|
||||
case MotionEvent.ACTION_MOVE:
|
||||
SDLJoystick joystick = getJoystick(event.getDeviceId());
|
||||
if ( joystick != null ) {
|
||||
for (int i = 0; i < joystick.axes.size(); i++) {
|
||||
InputDevice.MotionRange range = joystick.axes.get(i);
|
||||
/* Normalize the value to -1...1 */
|
||||
float value = ( event.getAxisValue( range.getAxis(), actionPointerIndex) - range.getMin() ) / range.getRange() * 2.0f - 1.0f;
|
||||
SDLControllerManager.onNativeJoy(joystick.device_id, i, value );
|
||||
}
|
||||
for (int i = 0; i < joystick.hats.size(); i+=2) {
|
||||
int hatX = Math.round(event.getAxisValue( joystick.hats.get(i).getAxis(), actionPointerIndex ) );
|
||||
int hatY = Math.round(event.getAxisValue( joystick.hats.get(i+1).getAxis(), actionPointerIndex ) );
|
||||
SDLControllerManager.onNativeHat(joystick.device_id, i/2, hatX, hatY );
|
||||
}
|
||||
if (action == MotionEvent.ACTION_MOVE) {
|
||||
SDLJoystick joystick = getJoystick(event.getDeviceId());
|
||||
if (joystick != null) {
|
||||
for (int i = 0; i < joystick.axes.size(); i++) {
|
||||
InputDevice.MotionRange range = joystick.axes.get(i);
|
||||
/* Normalize the value to -1...1 */
|
||||
float value = (event.getAxisValue(range.getAxis(), actionPointerIndex) - range.getMin()) / range.getRange() * 2.0f - 1.0f;
|
||||
SDLControllerManager.onNativeJoy(joystick.device_id, i, value);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
for (int i = 0; i < joystick.hats.size() / 2; i++) {
|
||||
int hatX = Math.round(event.getAxisValue(joystick.hats.get(2 * i).getAxis(), actionPointerIndex));
|
||||
int hatY = Math.round(event.getAxisValue(joystick.hats.get(2 * i + 1).getAxis(), actionPointerIndex));
|
||||
SDLControllerManager.onNativeHat(joystick.device_id, i, hatX, hatY);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
@@ -432,13 +438,13 @@ class SDLHapticHandler_API26 extends SDLHapticHandler {
|
||||
|
||||
class SDLHapticHandler {
|
||||
|
||||
class SDLHaptic {
|
||||
static class SDLHaptic {
|
||||
public int device_id;
|
||||
public String name;
|
||||
public Vibrator vib;
|
||||
}
|
||||
|
||||
private ArrayList<SDLHaptic> mHaptics;
|
||||
private final ArrayList<SDLHaptic> mHaptics;
|
||||
|
||||
public SDLHapticHandler() {
|
||||
mHaptics = new ArrayList<SDLHaptic>();
|
||||
@@ -504,37 +510,41 @@ class SDLHapticHandler {
|
||||
}
|
||||
|
||||
/* Check removed devices */
|
||||
ArrayList<Integer> removedDevices = new ArrayList<Integer>();
|
||||
for(int i=0; i < mHaptics.size(); i++) {
|
||||
int device_id = mHaptics.get(i).device_id;
|
||||
int j;
|
||||
for (j=0; j < deviceIds.length; j++) {
|
||||
if (device_id == deviceIds[j]) break;
|
||||
ArrayList<Integer> removedDevices = null;
|
||||
for (SDLHaptic haptic : mHaptics) {
|
||||
int device_id = haptic.device_id;
|
||||
int i;
|
||||
for (i = 0; i < deviceIds.length; i++) {
|
||||
if (device_id == deviceIds[i]) break;
|
||||
}
|
||||
|
||||
if (device_id == deviceId_VIBRATOR_SERVICE && hasVibratorService) {
|
||||
// don't remove the vibrator if it is still present
|
||||
} else if (j == deviceIds.length) {
|
||||
removedDevices.add(device_id);
|
||||
}
|
||||
if (device_id != deviceId_VIBRATOR_SERVICE || !hasVibratorService) {
|
||||
if (i == deviceIds.length) {
|
||||
if (removedDevices == null) {
|
||||
removedDevices = new ArrayList<Integer>();
|
||||
}
|
||||
removedDevices.add(device_id);
|
||||
}
|
||||
} // else: don't remove the vibrator if it is still present
|
||||
}
|
||||
|
||||
for(int i=0; i < removedDevices.size(); i++) {
|
||||
int device_id = removedDevices.get(i);
|
||||
SDLControllerManager.nativeRemoveHaptic(device_id);
|
||||
for (int j=0; j < mHaptics.size(); j++) {
|
||||
if (mHaptics.get(j).device_id == device_id) {
|
||||
mHaptics.remove(j);
|
||||
break;
|
||||
if (removedDevices != null) {
|
||||
for (int device_id : removedDevices) {
|
||||
SDLControllerManager.nativeRemoveHaptic(device_id);
|
||||
for (int i = 0; i < mHaptics.size(); i++) {
|
||||
if (mHaptics.get(i).device_id == device_id) {
|
||||
mHaptics.remove(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected SDLHaptic getHaptic(int device_id) {
|
||||
for(int i=0; i < mHaptics.size(); i++) {
|
||||
if (mHaptics.get(i).device_id == device_id) {
|
||||
return mHaptics.get(i);
|
||||
for (SDLHaptic haptic : mHaptics) {
|
||||
if (haptic.device_id == device_id) {
|
||||
return haptic;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
@@ -655,8 +665,7 @@ class SDLGenericMotionListener_API24 extends SDLGenericMotionListener_API12 {
|
||||
public float getEventX(MotionEvent event) {
|
||||
if (mRelativeModeEnabled) {
|
||||
return event.getAxisValue(MotionEvent.AXIS_RELATIVE_X);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
return event.getX(0);
|
||||
}
|
||||
}
|
||||
@@ -665,14 +674,12 @@ class SDLGenericMotionListener_API24 extends SDLGenericMotionListener_API12 {
|
||||
public float getEventY(MotionEvent event) {
|
||||
if (mRelativeModeEnabled) {
|
||||
return event.getAxisValue(MotionEvent.AXIS_RELATIVE_Y);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
return event.getY(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
class SDLGenericMotionListener_API26 extends SDLGenericMotionListener_API24 {
|
||||
// Generic Motion (mouse hover, joystick...) events go here
|
||||
private boolean mRelativeModeEnabled;
|
||||
@@ -753,15 +760,12 @@ class SDLGenericMotionListener_API26 extends SDLGenericMotionListener_API24 {
|
||||
if (!SDLActivity.isDeXMode() || (Build.VERSION.SDK_INT >= 27)) {
|
||||
if (enabled) {
|
||||
SDLActivity.getContentView().requestPointerCapture();
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
SDLActivity.getContentView().releasePointerCapture();
|
||||
}
|
||||
mRelativeModeEnabled = enabled;
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<string name="app_name">xsystem35</string>
|
||||
<string name="action_export_save_data">セーブデータをエクスポート</string>
|
||||
<string name="action_import_save_data">セーブデータをインポート</string>
|
||||
<string name="cancel">キャンセル</string>
|
||||
<string name="cannot_find_ald">System 3.x のファイル (*.ald) が見つかりません。</string>
|
||||
<string name="choose_a_file">ファイルを選択</string>
|
||||
<string name="error_dialog_title">エラー</string>
|
||||
<string name="install_dialog_title">インストール中…</string>
|
||||
<string name="install_from_zip">ZIP からインストール</string>
|
||||
<string name="install_progress">%s を展開中</string>
|
||||
<string name="no_data_to_import">ZIP アーカイブ中に save/ フォルダが見つかりません。</string>
|
||||
<string name="save_data_export_error">セーブデータのエクスポートに失敗しました。</string>
|
||||
<string name="save_data_export_success">エクスポートに成功しました。</string>
|
||||
<string name="save_data_import_success">インポートに成功しました。</string>
|
||||
<string name="uninstall_dialog_message">「%s」をアンインストールしますか?</string>
|
||||
<string name="uninstall_dialog_title">確認</string>
|
||||
<string name="unsupported_zip">この形式の ZIP はサポートしていません。</string>
|
||||
<string name="zip_extraction_error">ZIP の展開に失敗しました。</string>
|
||||
</resources>
|
||||
@@ -3,10 +3,10 @@
|
||||
<string name="action_export_save_data">Export Save Files</string>
|
||||
<string name="action_import_save_data">Import Save Files</string>
|
||||
<string name="cancel">Cancel</string>
|
||||
<string name="cannot_find_ald">Cannot find System 3.x game files (*.ald)</string>
|
||||
<string name="cannot_find_ald">Cannot find System 3.x game files (*.ald).</string>
|
||||
<string name="choose_a_file">Choose a file</string>
|
||||
<string name="error_dialog_title">Error</string>
|
||||
<string name="install_dialog_title">Installing...</string>
|
||||
<string name="install_dialog_title">Installing…</string>
|
||||
<string name="install_from_zip">Install from ZIP</string>
|
||||
<string name="install_progress">Extracting %s</string>
|
||||
<string name="no_data_to_import">No save/ folder in the ZIP archive.</string>
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
||||
|
||||
buildscript {
|
||||
ext.kotlin_version = '1.3.61'
|
||||
ext.kotlin_version = '1.3.72'
|
||||
repositories {
|
||||
jcenter()
|
||||
mavenCentral()
|
||||
google()
|
||||
}
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:3.2.0'
|
||||
classpath 'com.android.tools.build:gradle:4.0.1'
|
||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
||||
|
||||
// NOTE: Do not place your application dependencies here; they belong
|
||||
@@ -17,7 +17,7 @@ buildscript {
|
||||
|
||||
allprojects {
|
||||
repositories {
|
||||
jcenter()
|
||||
mavenCentral()
|
||||
google()
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
#Mon Oct 23 13:51:26 PDT 2017
|
||||
#Mon Aug 10 12:24:31 JST 2020
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-all.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip
|
||||
|
||||
+4
-10
@@ -1,11 +1,8 @@
|
||||
#cmakedefine PACKAGE "@PACKAGE@"
|
||||
#define VERSION "1.7.3sdl2"
|
||||
#define VERSION "2.0.0"
|
||||
|
||||
#cmakedefine CMAKE_SYSTEM_NAME "@CMAKE_SYSTEM_NAME@"
|
||||
|
||||
#define RGB_ORDER 1
|
||||
#cmakedefine WORDS_BIGENDIAN @WORDS_BIGENDIAN@
|
||||
|
||||
#cmakedefine CACHE_TOTALSIZE @CACHE_TOTALSIZE@
|
||||
|
||||
#cmakedefine ENABLE_CDROM_ANDROID @ENABLE_CDROM_ANDROID@
|
||||
@@ -13,17 +10,14 @@
|
||||
#cmakedefine ENABLE_CDROM_EMSCRIPTEN @ENABLE_CDROM_EMSCRIPTEN@
|
||||
#cmakedefine ENABLE_CDROM_LINUX @ENABLE_CDROM_LINUX@
|
||||
#cmakedefine ENABLE_CDROM_MP3 @ENABLE_CDROM_MP3@
|
||||
#cmakedefine ENABLE_FT2 @ENABLE_FT2@
|
||||
#cmakedefine ENABLE_DEBUGGER @ENABLE_DEBUGGER@
|
||||
#cmakedefine ENABLE_GTK @ENABLE_GTK@
|
||||
#cmakedefine ENABLE_MIDI_RAWMIDI @ENABLE_MIDI_RAWMIDI@
|
||||
#cmakedefine ENABLE_MIDI_SDLMIXER @ENABLE_MIDI_SDLMIXER@
|
||||
#cmakedefine ENABLE_MIDI_SEQMIDI @ENABLE_MIDI_SEQMIDI@
|
||||
#cmakedefine ENABLE_MODULES @ENABLE_MODULES@
|
||||
#cmakedefine ENABLE_MIDI_PORTMIDI @ENABLE_MIDI_PORTMIDI@
|
||||
#cmakedefine ENABLE_NLS @ENABLE_NLS@
|
||||
#cmakedefine ENABLE_SDL @ENABLE_SDL@
|
||||
#cmakedefine ENABLE_SDLMIXER @ENABLE_SDLMIXER@
|
||||
#cmakedefine ENABLE_SDLTTF @ENABLE_SDLTTF@
|
||||
#cmakedefine ENABLE_X11FONT @ENABLE_X11FONT@
|
||||
|
||||
#cmakedefine CDROM_DEVICE "@CDROM_DEVICE@"
|
||||
#cmakedefine JOY_DEVICE "@JOY_DEVICE@"
|
||||
@@ -33,11 +27,11 @@
|
||||
#cmakedefine QUIET_MIDI @QUIET_MIDI@
|
||||
|
||||
#cmakedefine HAVE_GETLOGIN @HAVE_GETLOGIN@
|
||||
#cmakedefine HAVE_JPEG @HAVE_JPEG@
|
||||
#cmakedefine HAVE_MMAP @HAVE_MMAP@
|
||||
#cmakedefine HAVE_SDLJOY @HAVE_SDLJOY@
|
||||
#cmakedefine HAVE_SIGACTION @HAVE_SIGACTION@
|
||||
#cmakedefine HAVE_UNAME @HAVE_UNAME@
|
||||
#cmakedefine HAVE_XF86VMODE @HAVE_XF86VMODE@
|
||||
|
||||
#define DEFAULT_GOTHIC_TTF "@DEFAULT_FONT_PATH@MTLc3m.ttf"
|
||||
#define DEFAULT_MINCHO_TTF "@DEFAULT_FONT_PATH@mincho.otf"
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
[鬼畜王ランス]
|
||||
|
||||
[ランス4(for Win95)]
|
||||
= マウスのクリック反応が悪い (fixed ?)
|
||||
|
||||
[闘神都市2(for Win95)]
|
||||
|
||||
|
||||
+1
-1
@@ -27,7 +27,7 @@
|
||||
Midi : MIDIデータ
|
||||
Data : その他データ
|
||||
Save : セーブデータ
|
||||
Resouce : リソースファイル(マウスカーソル形状)
|
||||
Resource : リソースファイル(マウスカーソル形状)
|
||||
Ain : DLL とその関数の情報のかかれた System39.ain
|
||||
BGM : BGMデータ(エスカレイヤー以降のBGMデータファイル)
|
||||
WAI : PCMデータの追加情報 (mixer channel 情報等)
|
||||
|
||||
+1
-5
@@ -223,11 +223,7 @@
|
||||
-Ms? : Sequencer device (?:device number)
|
||||
-M0 : disable midi
|
||||
|
||||
-devjoy name : joystick のデバイス名を name にします
|
||||
|
||||
-savekanji # : ゲーム内でファイル名を指定してセーブデータを記録するとき、
|
||||
日本語のファイル名を UTF-8 と SJIS のどちらで保存するかを
|
||||
指定します。(# は 0 または 1 ... 0:utf-8, 1:sjis)
|
||||
-devjoy n : n 番目の joystick のデバイスを使用します。
|
||||
|
||||
-version : バージョン情報を表示します。
|
||||
|
||||
|
||||
@@ -1,17 +0,0 @@
|
||||
|
||||
Joystick の使い方について
|
||||
|
||||
現在 linux の kernel 2.2.x 以降の Joystick インターフェイスに対応して
|
||||
います。対応環境をおもちの方は configure --enable-joy としてコンパイル
|
||||
コンパイルして下さい。
|
||||
|
||||
Joystick のデバイス名はデフォルトでは /dev/js0 で、実行時に -devjoy
|
||||
オプションで指定するか、.xsys35rc ファイルで joy_device のエントリー
|
||||
に加えて下さい。
|
||||
|
||||
他環境での動作報告、パッチなどお待ちしています。宛先は以下の両方に
|
||||
お願いします。
|
||||
|
||||
chikama (masaki-c@is.aist-nara.ac.jp)
|
||||
linux 版の作者の村田さん(fmurata@p1.tcnet.ne.jp)
|
||||
|
||||
+49
-49
@@ -84,7 +84,7 @@
|
||||
必要に応じてシナリオ内の変数に読み込みます。
|
||||
|
||||
f) リソースファイルは、マウスカーソルの形状とアニメーションマウスカーソルの
|
||||
データを格納しています。これまで DARCROW でのみ使用されました。
|
||||
データを格納しています。これまで DARCROWS でのみ使用されました。
|
||||
|
||||
g) セーブデータは、システム管理情報と数値変数、文字列変数のすべてを含んだ
|
||||
全セーブデータ(*.asd)と数値変数・文字列変数の一部を保存したデータの2種類が
|
||||
@@ -94,17 +94,17 @@
|
||||
h) その他のデータの範疇に入るものとしては外字ファイルとデータファイルがあり
|
||||
ます。
|
||||
外字ファイルは、PC9801の外字領域に16x16ドットのビットマップデータを並べた
|
||||
もので、オリジナルの外字を表示させるのに加えて、98機種依存文字の吸収も目指
|
||||
もので、オリジナルの外字を表示させるのに加えて、PC98機種依存文字の吸収も目指
|
||||
していたのですが、結局外字ファイルは「いけないかつみ先生」で使われたのみで、
|
||||
SYSTEM35.EXE Version 2.x 以降ではサポートすらされなくなりました。また、機種
|
||||
依存文字(まる文字やギリシャ数字など)はそれ以降のゲームでも機種存のコードで
|
||||
依存文字(まる文字やギリシャ数字など)はそれ以降のゲームでも機種依存のコードで
|
||||
継続して使われています。SYSTEM 3.9 では再び外字のサポートが復活するようです。
|
||||
|
||||
データファイルは、基本的には、シナリオ変数を外部に保存したものと考える事
|
||||
ができます。マップデータのようにあらかじめゲームに附属しているものもあれば、
|
||||
ゲームの途中経過を記録するために、ファイルに書き出す事もあります。
|
||||
かえるにょぱにょーんのマップデータ等のように e)のデータファイルで代用できる
|
||||
ものもあります。
|
||||
かえるにょ・ぱにょ〜んのマップデータ等のように e)のデータファイルで代用でき
|
||||
るものもあります。
|
||||
|
||||
3. データファイル (.ald) のフォーマット
|
||||
|
||||
@@ -143,15 +143,15 @@
|
||||
data そのものについても、ヘッダと実データに分ける事が出来ます。ヘッダは
|
||||
32バイト以上の長さで次のようになっています。
|
||||
|
||||
int32 prt;
|
||||
int32 ptr;
|
||||
int32 size;
|
||||
int32 time_l;
|
||||
int32 time_h;
|
||||
char name[?];
|
||||
|
||||
ptr は実際のデータへのヘッダからの相対アドレスです。size はデータの大きさを
|
||||
表します。 time_l と time_h は Windows 特有(?)の値で、データの作成時間をユリ
|
||||
ウス歴の最初の日付からの経過時間をナノ秒で表したものです。name はアーカイブ
|
||||
表します。 time_l と time_h は Windows の FILETIME 型の値で、データの作成時刻
|
||||
を1601-01-01からの100ナノ秒単位の経過時間で表したものです。name はアーカイブ
|
||||
する前のデータのファイル名で、16バイト以上の長さがあります。16バイト未満の時
|
||||
は0でパディングされます。またヘッダとデータを併せて 256バイト単位になるよう
|
||||
にデータの後ろは0でパディングされます。
|
||||
@@ -200,26 +200,26 @@
|
||||
int16 width;
|
||||
int16 height;
|
||||
int8 rsv;
|
||||
int8 pallet_bank;
|
||||
int8 palette_bank;
|
||||
int8 pal[3*16];
|
||||
|
||||
(x0,y0) は、CGを表示する位置を表します。シナリオから表示位置の指定のない場合
|
||||
この値を使います。x0 は 8で割った大きさになっていいますので、x0=10 とあった
|
||||
場合は実際には (80,y0) の位置に表示します。
|
||||
この値を使います。x0 は 8で割った大きさになっていますので、x0=10 とあった場
|
||||
合は実際には (80,y0) の位置に表示します。
|
||||
|
||||
(width, height) は CG の大きさを表します。widthは実際には8で割った大きさに
|
||||
なっています。これは、プレーン型のデータが元になっているためです。プレーン型
|
||||
のデータの場合、1バイトで表されるのは8ピクセル分だったため、width にいれる
|
||||
値は占めるバイト数を格納した方が有利だったんめと考えられます。よってCGの横の
|
||||
値は占めるバイト数を格納した方が有利だったためと考えられます。よってCGの横の
|
||||
サイズは常に8の倍数になります。8の倍数以外にしたい場合は、余る部分を透過
|
||||
パレット(スプライト)とする事で実現出来ます。
|
||||
|
||||
rsv は現在のところ、使われていません。
|
||||
|
||||
pallet_bank は、SYSTEM 3 の時代に 256色対応ゲームで、VSPファイルを読み込ませ
|
||||
palette_bank は、SYSTEM 3 の時代に 256色対応ゲームで、VSPファイルを読み込ませ
|
||||
るために、256個のパレットのどの場所に 16色分のパレットを置くかを決めます。
|
||||
bank=0 で 0-15, bank=1 で 16-31 となります。実装方法としては、plane->packed
|
||||
の変換の際に上位4bitにpalletを置いた場所の bitを立てます。bank=1 なら '| 0x10'
|
||||
の変換の際に上位4bitにpaletteを置いた場所の bitを立てます。bank=1 なら '| 0x10'
|
||||
という具合です。シナリオ側からパレットバンクを指定することもできます。しかし、
|
||||
シナリオ側から1度もパレットバンクの指定が無い場合はこのヘッダ内の情報が使用
|
||||
されます。(これは実装依存かもしれません)
|
||||
@@ -234,7 +234,7 @@
|
||||
です。
|
||||
|
||||
00, len;
|
||||
一つ上のプレーンと(len+1)の長さだけ同じ
|
||||
同じプレーンの一つ左の列と(len+1)の長さだけ同じ
|
||||
|
||||
01, len, pic;
|
||||
1バイト(pic)の繰り返し。長さは(len+1)
|
||||
@@ -277,32 +277,32 @@
|
||||
int8 bpp;
|
||||
int8 bppS;
|
||||
int8 trans_pal;
|
||||
int16 palett_bank;
|
||||
int32 rsv;
|
||||
int8 rsv1;
|
||||
int16 palette_bank;
|
||||
int32 rsv2;
|
||||
int32 x0;
|
||||
int32 y0;
|
||||
int32 width;
|
||||
int32 height;
|
||||
int32 data_ptr;
|
||||
int32 pallet_ptr;
|
||||
int32 palette_ptr;
|
||||
int32 comment_ptr;
|
||||
|
||||
sig はデータのマジックナンバーで 'PM' というデータが入っています。
|
||||
|
||||
ver はデータのバージョンで、現在は 1 が入っています。
|
||||
|
||||
bpp はデータの bit per pixel で 8または16です。256色データの場合は 8、64k色
|
||||
の場合は 16です。
|
||||
bpp はデータの bits per pixel で、256色データの場合は 8、64k色の場合は16です。
|
||||
|
||||
bppsはαチャンネルの bit per pixel で通常は8です。
|
||||
bppsはαチャンネルの bits per pixel で通常は8です。
|
||||
|
||||
trans_pal は透過するパレットの番号です。通常はシナリオから指定が来るので
|
||||
使用しません。
|
||||
|
||||
pallet_bank は データの中のパレットのどの部分をシステムに転送するかを
|
||||
palette_bank は データの中のパレットのどの部分をシステムに転送するかを
|
||||
表します。通常は 256個全部転送するのですが、CGデータがそれ以下しか色を使って
|
||||
ない場合には、一部のみ転送することができます。pallet_bank は 16bit の情報を
|
||||
持ち 256個を 16個づつに分割してどの部分を転送するかを指定します。bit-on で
|
||||
ない場合には、一部のみ転送することができます。palette_bank は 16bit の情報を
|
||||
持ち 256個を 16個ずつに分割してどの部分を転送するかを指定します。bit-on で
|
||||
転送です。LSB が0-15, MSB が 240-255 です。
|
||||
|
||||
(x0, y0) は CG の表示位置です。VSP と違って8で割った大きさではなく実際の
|
||||
@@ -312,10 +312,10 @@
|
||||
|
||||
data_ptr はデータ先頭からピクセルデータへの相対アドレスが入ります。
|
||||
|
||||
pallet_ptr は bppが8の場合にはパレットへの相対アドレスが入りますが、
|
||||
palette_ptr は bppが8の場合にはパレットへの相対アドレスが入りますが、
|
||||
16の場合にはαチャンネルデータへの相対アドレスが入ります。
|
||||
|
||||
comment_prt はデータにコメントをつける事ができて、そのデータへの相対アドレス
|
||||
comment_ptr はデータにコメントをつける事ができて、そのデータへの相対アドレス
|
||||
を指定します。
|
||||
|
||||
パレット
|
||||
@@ -333,31 +333,31 @@
|
||||
2つ上のラインと同じ。長さは (len+3:8bit, len+2:16bit)
|
||||
|
||||
0xfd, len, pic,
|
||||
1byte の picデータの連続。長さは (len+4:8bit, len+3:16bit)
|
||||
1ピクセルの picデータの連続。長さは (len+4:8bit, len+3:16bit)
|
||||
|
||||
0xfc, len, pic1, pic2
|
||||
2byte (pic1, pic2) データの連続。長さは ((len+3)*2:8bit, ((len+2)*2):16bit))
|
||||
2ピクセル (pic1, pic2) データの連続。長さは ((len+3)*2:8bit, (len+2)*2:16bit)
|
||||
|
||||
0xfb
|
||||
左上のデータと同じ。(PMS16専用)
|
||||
左上のピクセルと同じ。(PMS16専用)
|
||||
|
||||
0xfa
|
||||
右上のデータと同じ。(PMS16専用)
|
||||
右上のピクセルと同じ。(PMS16専用)
|
||||
|
||||
0xf9, len, pic_h, pic_l1, pic_l2, .... (PMS16専用)
|
||||
ピクセル間の色の差が小さいものの連続。長さは(len+1)
|
||||
各ピクセルのうち、R の上位 3bit, G の 2bit, B の 2bit が同じで、R の下位
|
||||
各ピクセルのうち、R の上位 3bit, G の 2bit, B の 3bit が同じで、R の下位
|
||||
2bit, G の 4bit, B の 2bit が異なるとき、下位の異なる部分のみを pic_l2,
|
||||
pic_l3... で表す。( RGB は 5bit, 6bit, 5bit で表される)
|
||||
pic_h, pic_l1 で最初のピクセルを構成し、ここから、RGB の上位が同じで、下位の
|
||||
異なる部分を pic_l2, pic_l3... で構成する
|
||||
異なる部分を pic_l2, pic_l3... で構成する。
|
||||
|
||||
0xf8, pic
|
||||
picそのもの。コードと同じピクセル用。8bit では pic は 1byte, 16bit では 2byte.
|
||||
|
||||
0xf7-0x00
|
||||
データそのもの 8bitでは 1byte, 16bit では 00-f7 の次のコードはすべて(00-ff)
|
||||
使用してピクセルを構成。
|
||||
データそのもの。 8bitでは 1byte, 16bit では次の 1byte と合わせてピクセルを
|
||||
構成。
|
||||
|
||||
|
||||
4.3 QNT フォーマット
|
||||
@@ -380,7 +380,7 @@
|
||||
int32 width;
|
||||
int32 height;
|
||||
int32 bpp;
|
||||
int32 rsv(?)
|
||||
int32 rsv; (?)
|
||||
int32 pixel_size;
|
||||
int32 alpha_size;
|
||||
|
||||
@@ -420,7 +420,7 @@
|
||||
header_size はヘッダの大きさをバイト数で表しています。Version 0 では 48
|
||||
バイト固定です。
|
||||
|
||||
(x0, y0) は CG の表示位置の指定です
|
||||
(x0, y0) は CG の表示位置の指定です。
|
||||
|
||||
(width, height) は CG の大きさの指定です。
|
||||
|
||||
@@ -472,8 +472,8 @@
|
||||
最新のものでは 'S380' となっています。途中混乱した時期があってこれと異なる
|
||||
場合もあります。
|
||||
|
||||
dat_prt は実際のシナリオデータの先頭への相対アドレスです。また、シナリオ中の
|
||||
ジャンプ命令のアドレスは、上のヘッダの最初からの相対アドレスを使用します。
|
||||
data_ptr は実際のシナリオデータの先頭のアドレスです。また、シナリオ中の
|
||||
ジャンプ命令のアドレスは、上のヘッダの先頭からの相対アドレスを使用します。
|
||||
|
||||
size はヘッダを含めたデータのサイズを示しています。
|
||||
|
||||
@@ -534,21 +534,21 @@
|
||||
04h 演算子(>= 以上)
|
||||
|
||||
数値は0から65535までの正の整数を扱えます。しかし、計算式上では word 定数は
|
||||
3FFFh しかあつかえませんので、それ以上の値を扱う場合は演算子を使います。
|
||||
3FFFh までしかあつかえませんので、それ以上の値を扱う場合は演算子を使います。
|
||||
65536 以上の数値を扱ったり、浮動小数を扱う場合は、64ビット変数を使用します。
|
||||
|
||||
配列を除く変数の最大は論理的には、16384 個ですが、実際には 2000 以下に実装上
|
||||
の限界があります。1000 以上になる場合は、配列変数を有効に使うと良いでしょう。
|
||||
配列を除く変数は論理的には最大 16384 個ですが、実際には 2000 以下に実装上の
|
||||
限界があります。1000 以上になる場合は、配列変数を有効に使うと良いでしょう。
|
||||
(xsystem35 の場合は 1024, 1.5.1pre1から 8192)
|
||||
|
||||
変数には、数値変数と配列変数があります。配列変数は、index 変数を用いた
|
||||
アクセス方法と、var[]のようなアクセス方法があります。var[]では上の 3.51拡張
|
||||
コードを使用して C0, 01, base_h, base_l, cali: というコーディングがなされま
|
||||
コードを使用して C0, 01, base_h, base_l, cali: というエンコードがなされま
|
||||
す。配列のベースとなる変数が (base_h << 8) + base_l で表され、インデックスは
|
||||
cali で指定されます。インデックスは配列変数も使用可能です。ex. var10[var20[5]]
|
||||
cali で指定されます。インデックスは配列参照も使用可能です。ex. var10[var20[5]]
|
||||
|
||||
計算式は逆ポーランド記述で格納されますので、基本的な処理はスタックから2つの
|
||||
数値または変数と1つの演算子を取り出して演算し、結果をスタックに戻します。
|
||||
計算式は逆ポーランド記述で格納されますので、基本的な処理はスタックから1つの
|
||||
演算子と2つの数値または変数を取り出して演算し、結果をスタックに戻します。
|
||||
この操作を 0x7f が出現するまで繰り返します。0x7f が来たら、スタックに残って
|
||||
いる数値を取り出します。コマンドの引数として変数を要求している場合の計算式
|
||||
は、変数へのポインタを返します。
|
||||
@@ -657,8 +657,8 @@
|
||||
|
||||
wav** など小文字系のコマンドはすべて 0x2f, 0x??, にエンコードされます。
|
||||
また引数として文字列を含むもの(ファイル名など)は、従来は ':' で終っていました
|
||||
が、system 3.8 以降では '\0' で終わるようになり、これらコマンドは新規に 0x2f
|
||||
コマンドとして新規に割り当てられました。
|
||||
が、system 3.8 以降では '\0' で終わるようになり、これらのコマンドは新規に
|
||||
0x2f コマンドとして割り当てられました。
|
||||
|
||||
0x2f, 0x0a, cali *2: [wavLoad]
|
||||
0x2f, 0x0b, cali *2: [wavPlay]
|
||||
@@ -807,7 +807,7 @@
|
||||
ここでは、コマンド表に載っていないけど、ゲームに出て来るものを紹介します。
|
||||
|
||||
5.8.1 VA
|
||||
* 機能: ユニットアニメーション (かえるにょ・ぱにょん初出)
|
||||
* 機能: ユニットアニメーション (かえるにょ・ぱにょ〜ん初出)
|
||||
* フォーマット: VA getd, cali, cali, cali:
|
||||
|
||||
* VA0 : 制御用コマンド
|
||||
@@ -821,7 +821,7 @@
|
||||
VA0, no, 1, num:
|
||||
no番のアニメーション開始。すぐに制御を戻す。
|
||||
numはコマ数, 0の場合と開始位置と終了位置が同じな時はアニメーションは
|
||||
動かずにコマ数だけが無限にされるカウント。
|
||||
動かずにコマ数だけが無限にカウントされる。
|
||||
|
||||
VA0, no, 2, num:
|
||||
no番のアニメーション開始。終るまで制御を戻さない。
|
||||
|
||||
@@ -10,12 +10,12 @@ find_program(PYFTSUBSET_FOUND pyftsubset)
|
||||
|
||||
if (PYFTSUBSET_FOUND)
|
||||
add_custom_target(fonts
|
||||
pyftsubset SourceHanSerifJP-Regular.otf --text-file=uchars.txt --output-file=${CMAKE_CURRENT_SOURCE_DIR}/mincho.otf
|
||||
DEPENDS uchars.txt SourceHanSerifJP-Regular.otf)
|
||||
pyftsubset SourceHanSerifJP-Regular.otf --text-file=uchars.txt --output-file=${CMAKE_CURRENT_SOURCE_DIR}/mincho.otf
|
||||
DEPENDS uchars.txt SourceHanSerifJP-Regular.otf)
|
||||
|
||||
add_custom_command(OUTPUT uchars.txt
|
||||
COMMAND uchars > uchars.txt)
|
||||
COMMAND uchars > uchars.txt)
|
||||
|
||||
add_custom_command(OUTPUT SourceHanSerifJP-Regular.otf
|
||||
COMMAND wget -O SourceHanSerifJP-Regular.otf https://github.com/adobe-fonts/source-han-serif/blob/release/SubsetOTF/JP/SourceHanSerifJP-Regular.otf?raw=true)
|
||||
COMMAND wget -O SourceHanSerifJP-Regular.otf https://github.com/adobe-fonts/source-han-serif/blob/release/SubsetOTF/JP/SourceHanSerifJP-Regular.otf?raw=true)
|
||||
endif()
|
||||
|
||||
@@ -5,9 +5,10 @@
|
||||
#include "portab.h"
|
||||
#include "system.h"
|
||||
#include "xsystem35.h"
|
||||
#include "modules.h"
|
||||
#include "nact.h"
|
||||
|
||||
void Init() {
|
||||
static void Init() {
|
||||
int p1 = getCaliValue(); /* ISys3x */
|
||||
int p2 = getCaliValue(); /* IWinMsg */
|
||||
int p3 = getCaliValue(); /* ITimer */
|
||||
@@ -18,17 +19,24 @@ void Init() {
|
||||
DEBUG_COMMAND_YET("AliceLogo.Init %d,%d,%d,%p:\n", p1, p2, p3, var);
|
||||
}
|
||||
|
||||
void SetWaveNum() {
|
||||
static void SetWaveNum() {
|
||||
int p1 = getCaliValue();
|
||||
int p2 = getCaliValue();
|
||||
|
||||
DEBUG_COMMAND_YET("AliceLogo.SetWaveNum %d,%d:\n", p1, p2);
|
||||
}
|
||||
|
||||
void Run() {
|
||||
static void Run() {
|
||||
int p1 = getCaliValue();
|
||||
int p2 = getCaliValue();
|
||||
|
||||
DEBUG_COMMAND_YET("AliceLogo.Run %d,%d:\n", p1, p2);
|
||||
}
|
||||
|
||||
static const ModuleFunc functions[] = {
|
||||
{"Init", Init},
|
||||
{"Run", Run},
|
||||
{"SetWaveNum", SetWaveNum},
|
||||
};
|
||||
|
||||
const Module module_AliceLogo = {"AliceLogo", functions, sizeof(functions) / sizeof(ModuleFunc)};
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
add_library(AliceLogo MODULE AliceLogo.c)
|
||||
|
||||
install(TARGETS AliceLogo DESTINATION lib/xsystem35)
|
||||
+123
-28
@@ -1,33 +1,128 @@
|
||||
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
|
||||
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../src)
|
||||
|
||||
if (APPLE)
|
||||
add_link_options("SHELL:-undefined dynamic_lookup")
|
||||
add_library(modules STATIC
|
||||
modules.c
|
||||
AliceLogo/AliceLogo.c
|
||||
Confirm/Confirm.c
|
||||
Gpx/Gpx.c
|
||||
Gpx/effectcopy.c
|
||||
Math/Math.c
|
||||
MsgSkip/MsgSkip.c
|
||||
NIGHTDLL/NIGHTDLL.c
|
||||
NIGHTDLL/nt_scenario.c
|
||||
NIGHTDLL/sactcg.c
|
||||
NIGHTDLL/sactstring.c
|
||||
NIGHTDLL/sprite.c
|
||||
NIGHTDLL/sprite_draw.c
|
||||
NIGHTDLL/sprite_update.c
|
||||
NIGHTDLL/sprite_eupdate.c
|
||||
NIGHTDLL/nt_event.c
|
||||
NIGHTDLL/nt_msg.c
|
||||
NIGHTDLL/nt_sel.c
|
||||
NIGHTDLL/nt_graph.c
|
||||
NIGHTDLL/nt_sound.c
|
||||
NightDemonDemo/NightDemonDemo.c
|
||||
RandMT/RandMT.c
|
||||
SACT/SACT.c
|
||||
SACT/sactcg.c
|
||||
SACT/sactsound.c
|
||||
SACT/sactbgm.c
|
||||
SACT/sacttimer.c
|
||||
SACT/sactstring.c
|
||||
SACT/sactcrypto.c
|
||||
SACT/sactchart.c
|
||||
SACT/sactamask.c
|
||||
SACT/sactlog.c
|
||||
SACT/sprite.c
|
||||
SACT/sprite_event.c
|
||||
SACT/sprite_tevent.c
|
||||
SACT/sprite_move.c
|
||||
SACT/sprite_anime.c
|
||||
SACT/sprite_get.c
|
||||
SACT/sprite_put.c
|
||||
SACT/sprite_switch.c
|
||||
SACT/sprite_sel.c
|
||||
SACT/sprite_msg.c
|
||||
SACT/sprite_draw.c
|
||||
SACT/sprite_update.c
|
||||
SACT/sprite_eupdate.c
|
||||
SACT/sprite_quake.c
|
||||
SACT/sprite_keywait.c
|
||||
SACT/screen_quake.c
|
||||
SACT/sprite_xmenu.c
|
||||
ShArray/ShArray.c
|
||||
ShCalc/ShCalc.c
|
||||
ShGraph/ShGraph.c
|
||||
ShPort/ShPort.c
|
||||
ShSound/ShSound.c
|
||||
ShString/ShString.c
|
||||
dDemo/dDemo.c
|
||||
eDemo/eDemo.c
|
||||
eeDemo/eeDemo.c
|
||||
lib/alk.c
|
||||
lib/drawtext.c
|
||||
lib/graph.c
|
||||
lib/list.c
|
||||
lib/surface.c
|
||||
lib/cg.c
|
||||
lib/graph_expandcolor_blend.c
|
||||
lib/graph_fillrect.c
|
||||
lib/graph_fillrect_amap.c
|
||||
lib/graph_fillrect_acolor.c
|
||||
lib/graph_rect.c
|
||||
lib/graph_copy.c
|
||||
lib/graph_copy_amap.c
|
||||
lib/graph_copy_bright.c
|
||||
lib/graph_copy_whiteout.c
|
||||
lib/graph_blend_amap.c
|
||||
lib/graph_blend_screen.c
|
||||
lib/graph_saturadd_amap.c
|
||||
lib/graph_draw_amap.c
|
||||
lib/graph_stretch.c
|
||||
lib/graph_cg.c
|
||||
lib/graph_buller.c
|
||||
lib/gre_blend_useamap.c
|
||||
lib/gre_blend.c
|
||||
lib/gre_blend_screen.c
|
||||
nDEMO/nDEMO.c
|
||||
nDEMOE/nDEMOE.c
|
||||
oDEMO/oDEMO.c
|
||||
oujimisc/oujimisc.c
|
||||
tDemo/tDemo.c
|
||||
)
|
||||
|
||||
target_include_directories(modules PUBLIC . lib)
|
||||
|
||||
if (NOT ANDROID AND NOT EMSCRIPTEN)
|
||||
add_executable(modules_tests lib/list_test.c)
|
||||
target_link_libraries(modules_tests PRIVATE modules)
|
||||
add_test(NAME modules_tests COMMAND modules_tests)
|
||||
endif()
|
||||
|
||||
include_directories(${CMAKE_SOURCE_DIR}/src)
|
||||
target_compile_options(modules PRIVATE -Wno-pointer-sign)
|
||||
|
||||
add_subdirectory(lib)
|
||||
if (EMSCRIPTEN)
|
||||
set(LIBS
|
||||
"SHELL:-s USE_LIBJPEG=1"
|
||||
"SHELL:-s USE_SDL=2")
|
||||
target_compile_options(modules PRIVATE ${LIBS})
|
||||
target_link_options(modules PRIVATE ${LIBS})
|
||||
endif()
|
||||
|
||||
add_subdirectory(AliceLogo)
|
||||
add_subdirectory(Confirm)
|
||||
add_subdirectory(Gpx)
|
||||
add_subdirectory(Math)
|
||||
add_subdirectory(MsgSkip)
|
||||
add_subdirectory(NIGHTDLL)
|
||||
add_subdirectory(NightDemonDemo)
|
||||
add_subdirectory(RandMT)
|
||||
add_subdirectory(SACT)
|
||||
add_subdirectory(ShArray)
|
||||
add_subdirectory(ShCalc)
|
||||
add_subdirectory(ShGraph)
|
||||
add_subdirectory(ShPort)
|
||||
add_subdirectory(ShSound)
|
||||
add_subdirectory(ShString)
|
||||
add_subdirectory(dDemo)
|
||||
add_subdirectory(eDemo)
|
||||
add_subdirectory(eeDemo)
|
||||
add_subdirectory(nDEMO)
|
||||
add_subdirectory(nDEMOE)
|
||||
add_subdirectory(oDEMO)
|
||||
add_subdirectory(oujimisc)
|
||||
add_subdirectory(tDemo)
|
||||
if (SDL2MIXER_FOUND)
|
||||
if (ANDROID)
|
||||
target_link_libraries(modules PRIVATE SDL2 SDL2_mixer)
|
||||
else()
|
||||
target_link_libraries(modules PRIVATE PkgConfig::SDL2MIXER)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if (HAVE_JPEG)
|
||||
target_sources(modules PRIVATE
|
||||
NightDemonDemo/ndd.c
|
||||
NightDemonDemo/jpeg2surface.c
|
||||
)
|
||||
if (NOT EMSCRIPTEN)
|
||||
target_link_libraries(modules PRIVATE JPEG::JPEG)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
add_library(Confirm MODULE Confirm.c)
|
||||
|
||||
install(TARGETS Confirm DESTINATION lib/xsystem35)
|
||||
@@ -5,15 +5,16 @@
|
||||
#include "portab.h"
|
||||
#include "system.h"
|
||||
#include "xsystem35.h"
|
||||
#include "modules.h"
|
||||
#include "nact.h"
|
||||
void Init() {
|
||||
static void Init() {
|
||||
int p1 = getCaliValue();
|
||||
|
||||
DEBUG_COMMAND_YET("Confirm.Init %d:\n", p1);
|
||||
}
|
||||
|
||||
void ExistKeyFile() {
|
||||
char *p1 = sys_getString(0);
|
||||
static void ExistKeyFile() {
|
||||
const char *p1 = sl_getString(0);
|
||||
int *p2 = getCaliVariable();
|
||||
int *var = getCaliVariable();
|
||||
|
||||
@@ -22,8 +23,8 @@ void ExistKeyFile() {
|
||||
DEBUG_COMMAND_YET("Confirm.ExistKeyFile %s,%p,%p:\n",p1, p2, var);
|
||||
}
|
||||
|
||||
void CheckProtectFile() {
|
||||
char *p1 = sys_getString(0);
|
||||
static void CheckProtectFile() {
|
||||
const char *p1 = sl_getString(0);
|
||||
int *p2 = getCaliVariable();
|
||||
int *var = getCaliVariable();
|
||||
|
||||
@@ -32,8 +33,8 @@ void CheckProtectFile() {
|
||||
DEBUG_COMMAND_YET("Confirm.CheckProtectFile %s,%p,%p:\n", p1,p2,var);
|
||||
}
|
||||
|
||||
void CreateKeyFile() {
|
||||
char *p1 = sys_getString(0);
|
||||
static void CreateKeyFile() {
|
||||
const char *p1 = sl_getString(0);
|
||||
int *p2 = getCaliVariable();
|
||||
int *var = getCaliVariable();
|
||||
|
||||
@@ -41,3 +42,12 @@ void CreateKeyFile() {
|
||||
|
||||
DEBUG_COMMAND_YET("Confirm.CreateKeyFile %s,%p,%p:\n", p1,p2,var);
|
||||
}
|
||||
|
||||
static const ModuleFunc functions[] = {
|
||||
{"CheckProtectFile", CheckProtectFile},
|
||||
{"CreateKeyFile", CreateKeyFile},
|
||||
{"ExistKeyFile", ExistKeyFile},
|
||||
{"Init", Init},
|
||||
};
|
||||
|
||||
const Module module_Confirm = {"Confirm", functions, sizeof(functions) / sizeof(ModuleFunc)};
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
add_library(Gpx MODULE Gpx.c effectcopy.c)
|
||||
|
||||
target_link_libraries(Gpx PRIVATE graph)
|
||||
|
||||
install(TARGETS Gpx DESTINATION lib/xsystem35)
|
||||
+119
-73
@@ -33,6 +33,7 @@
|
||||
#include "portab.h"
|
||||
#include "system.h"
|
||||
#include "xsystem35.h"
|
||||
#include "modules.h"
|
||||
#include "nact.h"
|
||||
#include "ags.h"
|
||||
#include "cg.h"
|
||||
@@ -119,13 +120,12 @@ static int load_cg_main(int no) {
|
||||
|
||||
sno = find_null_surface();
|
||||
|
||||
sf->no = sno;
|
||||
suf[sno] = sf;
|
||||
|
||||
return sf->no;
|
||||
return sno;
|
||||
}
|
||||
|
||||
void Init() {
|
||||
static void Init() {
|
||||
/*
|
||||
Gpx.Init(): Gpx モジュールの初期化
|
||||
*/
|
||||
@@ -140,7 +140,7 @@ void Init() {
|
||||
DEBUG_COMMAND("Gpx.Init %d:\n", p1);
|
||||
}
|
||||
|
||||
void Create() {
|
||||
static void Create() {
|
||||
/*
|
||||
Gpx.Create(): 新規 surface の作成(PixelとAlphaマップの両方)
|
||||
|
||||
@@ -164,14 +164,14 @@ void Create() {
|
||||
*var = 0;
|
||||
} else {
|
||||
int no = find_null_surface();
|
||||
*var = s->no = no;
|
||||
*var = no;
|
||||
suf[no] = s;
|
||||
}
|
||||
|
||||
DEBUG_COMMAND("Gpx.Create %p,%d,%d,%d:\n", var, width, height, bpp);
|
||||
}
|
||||
|
||||
void CreatePixelOnly() {
|
||||
static void CreatePixelOnly() {
|
||||
/*
|
||||
Gpx.CreatePixelOnly(): 新規 surface の作成(Pixelのみ)
|
||||
|
||||
@@ -192,14 +192,14 @@ void CreatePixelOnly() {
|
||||
*var = 0;
|
||||
} else {
|
||||
int no = find_null_surface();
|
||||
*var = s->no = no;
|
||||
*var = no;
|
||||
suf[no] = s;
|
||||
}
|
||||
|
||||
DEBUG_COMMAND("Gpx.CreatePixelOnly %d,%d,%d,%d:\n", *var, width, height, bpp);
|
||||
}
|
||||
|
||||
void CreateAMapOnly() {
|
||||
static void CreateAMapOnly() {
|
||||
/*
|
||||
Gpx.CreateAMapOnly(): 新規 surface の作成(AlphaMapのみ)
|
||||
|
||||
@@ -218,14 +218,14 @@ void CreateAMapOnly() {
|
||||
*var = 0;
|
||||
} else {
|
||||
int no = find_null_surface();
|
||||
*var = s->no = no;
|
||||
*var = no;
|
||||
suf[no] = s;
|
||||
}
|
||||
|
||||
DEBUG_COMMAND("Gpx.CreateAMapOnly %p,%d,%d:\n", var, width, height);
|
||||
}
|
||||
|
||||
void IsSurface() {
|
||||
static void IsSurface() {
|
||||
/*
|
||||
Gpx.IsSurface(): 指定の番号の surface が surface かどうか
|
||||
(pixel と alpha の両方のデータを持つ)を調べる
|
||||
@@ -242,13 +242,13 @@ void IsSurface() {
|
||||
if (s == NULL) {
|
||||
*var = 0;
|
||||
} else {
|
||||
*var = (s->has_alpha && s->has_pixel) ? 1 : 0;
|
||||
*var = (s->alpha && s->pixel) ? 1 : 0;
|
||||
}
|
||||
|
||||
DEBUG_COMMAND("Gpx.IsSurface %d,%p:\n", p1, var);
|
||||
}
|
||||
|
||||
void IsPixel() {
|
||||
static void IsPixel() {
|
||||
/*
|
||||
Gpx.IsPixel(): 指定の番号の surface が pixelデータかどうかを調べる
|
||||
|
||||
@@ -264,13 +264,13 @@ void IsPixel() {
|
||||
if (s == NULL) {
|
||||
*var = 0;
|
||||
} else {
|
||||
*var = s->has_pixel ? 1 : 0;
|
||||
*var = s->pixel ? 1 : 0;
|
||||
}
|
||||
|
||||
DEBUG_COMMAND("Gpx.IsPixel %d,%p:\n", p1, var);
|
||||
}
|
||||
|
||||
void IsAlpha() {
|
||||
static void IsAlpha() {
|
||||
/*
|
||||
Gpx.IsAlpha(): 指定の番号の surface が alpha mapかどうかを調べる
|
||||
|
||||
@@ -286,13 +286,13 @@ void IsAlpha() {
|
||||
if (s == NULL) {
|
||||
*var = 0;
|
||||
} else {
|
||||
*var = s->has_alpha ? 1 : 0;
|
||||
*var = s->alpha ? 1 : 0;
|
||||
}
|
||||
|
||||
DEBUG_COMMAND("Gpx.IsAlpha %d,%p:\n", p1, var);
|
||||
}
|
||||
|
||||
void GetWidth() {
|
||||
static void GetWidth() {
|
||||
/*
|
||||
Gpx.GetWidth(): 指定の番号の surface の幅を取得する
|
||||
|
||||
@@ -314,7 +314,7 @@ void GetWidth() {
|
||||
DEBUG_COMMAND("Gpx.GetWidth %d,%d:\n", p1, *var);
|
||||
}
|
||||
|
||||
void GetHeight() {
|
||||
static void GetHeight() {
|
||||
/*
|
||||
Gpx.GetWidth(): 指定の番号の surface の高さを取得する
|
||||
|
||||
@@ -336,13 +336,13 @@ void GetHeight() {
|
||||
DEBUG_COMMAND("Gpx.GetHeight %d,%d:\n", p1, *var);
|
||||
}
|
||||
|
||||
void GetCreatedSurface() { /* not used ? */
|
||||
static void GetCreatedSurface() { /* not used ? */
|
||||
int *var = getCaliVariable();
|
||||
|
||||
DEBUG_COMMAND_YET("Gpx.GetCreatedSurface %p:\n", var);
|
||||
}
|
||||
|
||||
void LoadCG() {
|
||||
static void LoadCG() {
|
||||
/*
|
||||
Gpx.LoadCG(): 新規 surface を作成してその上に CG を load
|
||||
|
||||
@@ -357,21 +357,21 @@ void LoadCG() {
|
||||
DEBUG_COMMAND("Gpx.LoadCG %p,%d (%d):\n", var, p1, *var);
|
||||
}
|
||||
|
||||
void GetCGPosX() { /* not useed ? */
|
||||
static void GetCGPosX() { /* not useed ? */
|
||||
int *var = getCaliVariable();
|
||||
int p1 = getCaliValue();
|
||||
|
||||
DEBUG_COMMAND_YET("Gpx.GetCgPosX %p,%d:\n", var, p1);
|
||||
}
|
||||
|
||||
void GetCGPosY() { /* not useed ? */
|
||||
static void GetCGPosY() { /* not useed ? */
|
||||
int *var = getCaliVariable();
|
||||
int p1 = getCaliValue();
|
||||
|
||||
DEBUG_COMMAND_YET("Gpx.GetCgPosY %p,%d:\n", var, p1);
|
||||
}
|
||||
|
||||
void Free() {
|
||||
static void Free() {
|
||||
/*
|
||||
Gpx.Free(): 指定の surface を開放する
|
||||
|
||||
@@ -386,7 +386,7 @@ void Free() {
|
||||
}
|
||||
}
|
||||
|
||||
void FreeAll() {
|
||||
static void FreeAll() {
|
||||
/*
|
||||
Gpx.FreeAll(): 全ての surface を開放する
|
||||
*/
|
||||
@@ -395,7 +395,7 @@ void FreeAll() {
|
||||
DEBUG_COMMAND("Gpx.FreeAll:\n");
|
||||
}
|
||||
|
||||
void Copy() {
|
||||
static void Copy() {
|
||||
/*
|
||||
Gpx.Copy(): 指定 surface 領域のコピー
|
||||
|
||||
@@ -420,13 +420,12 @@ void Copy() {
|
||||
|
||||
DEBUG_COMMAND("Gpx.Copy %d,%d,%d,%d,%d,%d,%d,%d:\n", ds, dx, dy, ss, sx, sy, sw, sh);
|
||||
|
||||
ags_sync();
|
||||
src = sf_get(ss);
|
||||
dst = sf_get(ds);
|
||||
gr_copy(dst, dx, dy, src, sx, sy, sw, sh);
|
||||
}
|
||||
|
||||
void CopyBright() { /* not used ? */
|
||||
static void CopyBright() { /* not used ? */
|
||||
int p1 = getCaliValue();
|
||||
int p2 = getCaliValue();
|
||||
int p3 = getCaliValue();
|
||||
@@ -440,7 +439,7 @@ void CopyBright() { /* not used ? */
|
||||
DEBUG_COMMAND_YET("Gpx.CopyBright %d,%d,%d,%d,%d,%d,%d,%d,%d:\n", p1, p2, p3, p4, p5, p6, p7, p8, p9);
|
||||
}
|
||||
|
||||
void CopyAMap() {
|
||||
static void CopyAMap() {
|
||||
/*
|
||||
Gpx.CopyAMap(): 指定 surface の alpha map 領域のコピー
|
||||
|
||||
@@ -465,13 +464,12 @@ void CopyAMap() {
|
||||
|
||||
DEBUG_COMMAND("Gpx.CopyAMap %d,%d,%d,%d,%d,%d,%d,%d:\n", da, dx, dy, sa, sx, sy, sw, sh);
|
||||
|
||||
ags_sync();
|
||||
src = sf_get(sa);
|
||||
dst = sf_get(da);
|
||||
gr_copy_alpha_map(dst, dx, dy, src, sx, sy, sw, sh);
|
||||
}
|
||||
|
||||
void Blend() { /* not used ? */
|
||||
static void Blend() { /* not used ? */
|
||||
int p1 = getCaliValue();
|
||||
int p2 = getCaliValue();
|
||||
int p3 = getCaliValue();
|
||||
@@ -485,7 +483,7 @@ void Blend() { /* not used ? */
|
||||
DEBUG_COMMAND_YET("Gpx.Blend %d,%d,%d,%d,%d,%d,%d,%d,%d:\n", p1, p2, p3, p4, p5, p6, p7, p8, p9);
|
||||
}
|
||||
|
||||
void BlendSrcBright() { /* not used ? */
|
||||
static void BlendSrcBright() { /* not used ? */
|
||||
int p1 = getCaliValue();
|
||||
int p2 = getCaliValue();
|
||||
int p3 = getCaliValue();
|
||||
@@ -500,7 +498,7 @@ void BlendSrcBright() { /* not used ? */
|
||||
DEBUG_COMMAND_YET("Gpx.BlendSrcBright %d,%d,%d,%d,%d,%d,%d,%d,%d,%d:\n", p1, p2, p3, p4, p5, p6, p7, p8, p9, p10);
|
||||
}
|
||||
|
||||
void BlendAddSatur() { /* not used ? */
|
||||
static void BlendAddSatur() { /* not used ? */
|
||||
int p1 = getCaliValue();
|
||||
int p2 = getCaliValue();
|
||||
int p3 = getCaliValue();
|
||||
@@ -513,7 +511,7 @@ void BlendAddSatur() { /* not used ? */
|
||||
DEBUG_COMMAND_YET("Gpx.BlendAddStatur %d,%d,%d,%d,%d,%d,%d,%d:\n", p1, p2, p3, p4, p5, p6, p7, p8);
|
||||
}
|
||||
|
||||
void BlendAMap() {
|
||||
static void BlendAMap() {
|
||||
/*
|
||||
Gpx.BlendAMap(): 転送元の alpha map を参照して 指定領域を alpha blend
|
||||
|
||||
@@ -538,13 +536,12 @@ void BlendAMap() {
|
||||
|
||||
DEBUG_COMMAND("Gpx.BlendAMap %d,%d,%d,%d,%d,%d,%d,%d:\n", ds, dx, dy, ss, sx, sy, sw, sh);
|
||||
|
||||
ags_sync();
|
||||
src = sf_get(ss);
|
||||
dst = sf_get(ds);
|
||||
gr_blend_alpha_map(dst, dx, dy, src, sx, sy, sw, sh);
|
||||
}
|
||||
|
||||
void BlendAMapSrcOnly() { /* not used ? */
|
||||
static void BlendAMapSrcOnly() { /* not used ? */
|
||||
int p1 = getCaliValue();
|
||||
int p2 = getCaliValue();
|
||||
int p3 = getCaliValue();
|
||||
@@ -557,7 +554,7 @@ void BlendAMapSrcOnly() { /* not used ? */
|
||||
DEBUG_COMMAND_YET("Gpx.BlendAMapSrcOnly %d,%d,%d,%d,%d,%d,%d,%d:\n", p1, p2, p3, p4, p5, p6, p7, p8);
|
||||
}
|
||||
|
||||
void BlendAMapColor() { /* not used ? */
|
||||
static void BlendAMapColor() { /* not used ? */
|
||||
int p1 = getCaliValue();
|
||||
int p2 = getCaliValue();
|
||||
int p3 = getCaliValue();
|
||||
@@ -573,7 +570,7 @@ void BlendAMapColor() { /* not used ? */
|
||||
DEBUG_COMMAND_YET("Gpx.BlendAMapColor %d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d:\n", p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11);
|
||||
}
|
||||
|
||||
void BlendAMapColorAlpha() { /* not used ? */
|
||||
static void BlendAMapColorAlpha() { /* not used ? */
|
||||
int p1 = getCaliValue();
|
||||
int p2 = getCaliValue();
|
||||
int p3 = getCaliValue();
|
||||
@@ -590,7 +587,7 @@ void BlendAMapColorAlpha() { /* not used ? */
|
||||
DEBUG_COMMAND_YET("Gpx.BlendAMapColorAlpha %d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d:\n", p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12);
|
||||
}
|
||||
|
||||
void BlendAMapAlpha() { /* not used ? */
|
||||
static void BlendAMapAlpha() { /* not used ? */
|
||||
int p1 = getCaliValue();
|
||||
int p2 = getCaliValue();
|
||||
int p3 = getCaliValue();
|
||||
@@ -604,7 +601,7 @@ void BlendAMapAlpha() { /* not used ? */
|
||||
DEBUG_COMMAND_YET("Gpx.BlendAMapAlpha %d,%d,%d,%d,%d,%d,%d,%d,%d:\n", p1, p2, p3, p4, p5, p6, p7, p8, p9);
|
||||
}
|
||||
|
||||
void BlendAMapBright() { /* not used ? */
|
||||
static void BlendAMapBright() { /* not used ? */
|
||||
int p1 = getCaliValue();
|
||||
int p2 = getCaliValue();
|
||||
int p3 = getCaliValue();
|
||||
@@ -618,7 +615,7 @@ void BlendAMapBright() { /* not used ? */
|
||||
DEBUG_COMMAND_YET("Gpx.BlendAMapBright %d,%d,%d,%d,%d,%d,%d,%d,%d:\n", p1, p2, p3, p4, p5, p6, p7, p8, p9);
|
||||
}
|
||||
|
||||
void BlendAMapAlphaSrcBright() { /* not used ? */
|
||||
static void BlendAMapAlphaSrcBright() { /* not used ? */
|
||||
int p1 = getCaliValue();
|
||||
int p2 = getCaliValue();
|
||||
int p3 = getCaliValue();
|
||||
@@ -633,7 +630,7 @@ void BlendAMapAlphaSrcBright() { /* not used ? */
|
||||
DEBUG_COMMAND_YET("Gpx.BlendAMapBright %d,%d,%d,%d,%d,%d,%d,%d,%d,%d:\n", p1, p2, p3, p4, p5, p6, p7, p8, p9, p10);
|
||||
}
|
||||
|
||||
void BlendUseAMapColor() { /* not used ? */
|
||||
static void BlendUseAMapColor() { /* not used ? */
|
||||
int p1 = getCaliValue();
|
||||
int p2 = getCaliValue();
|
||||
int p3 = getCaliValue();
|
||||
@@ -650,7 +647,7 @@ void BlendUseAMapColor() { /* not used ? */
|
||||
DEBUG_COMMAND_YET("Gpx.BlendUseAMapColor %d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d:\n", p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12);
|
||||
}
|
||||
|
||||
void BlendScreen() { /* not used ? */
|
||||
static void BlendScreen() { /* not used ? */
|
||||
int p1 = getCaliValue();
|
||||
int p2 = getCaliValue();
|
||||
int p3 = getCaliValue();
|
||||
@@ -663,7 +660,7 @@ void BlendScreen() { /* not used ? */
|
||||
DEBUG_COMMAND_YET("Gpx.BlendScreen %d,%d,%d,%d,%d,%d,%d,%d:\n", p1, p2, p3, p4, p5, p6, p7, p8);
|
||||
}
|
||||
|
||||
void BlendMultiply() { /* not used ? */
|
||||
static void BlendMultiply() { /* not used ? */
|
||||
int p1 = getCaliValue();
|
||||
int p2 = getCaliValue();
|
||||
int p3 = getCaliValue();
|
||||
@@ -676,7 +673,7 @@ void BlendMultiply() { /* not used ? */
|
||||
DEBUG_COMMAND_YET("Gpx.BlendMultiply %d,%d,%d,%d,%d,%d,%d,%d:\n", p1, p2, p3, p4, p5, p6, p7, p8);
|
||||
}
|
||||
|
||||
void BlendScreenAlpha() { /* not used ? */
|
||||
static void BlendScreenAlpha() { /* not used ? */
|
||||
int p1 = getCaliValue();
|
||||
int p2 = getCaliValue();
|
||||
int p3 = getCaliValue();
|
||||
@@ -690,7 +687,7 @@ void BlendScreenAlpha() { /* not used ? */
|
||||
DEBUG_COMMAND_YET("Gpx.BlendScreenAlpha %d,%d,%d,%d,%d,%d,%d,%d,%d:\n", p1, p2, p3, p4, p5, p6, p7, p8, p9);
|
||||
}
|
||||
|
||||
void Fill() {
|
||||
static void Fill() {
|
||||
/*
|
||||
Gpx.Fill(): 指定領域の塗りつぶし
|
||||
|
||||
@@ -715,12 +712,11 @@ void Fill() {
|
||||
|
||||
DEBUG_COMMAND("Gpx.Fill %d,%d,%d,%d,%d,%d,%d,%d:\n", ds, dx, dy, dw, dh, r, g, b);
|
||||
|
||||
ags_sync();
|
||||
dst = sf_get(ds);
|
||||
gr_fill(dst, dx, dy, dw, dh, r, g, b);
|
||||
}
|
||||
|
||||
void FillAlphaColor() { /* not used ? */
|
||||
static void FillAlphaColor() { /* not used ? */
|
||||
int ds = getCaliValue();
|
||||
int dx = getCaliValue();
|
||||
int dy = getCaliValue();
|
||||
@@ -734,12 +730,11 @@ void FillAlphaColor() { /* not used ? */
|
||||
|
||||
DEBUG_COMMAND_YET("Gpx.FillAlphaColor %d,%d,%d,%d,%d,%d,%d,%d,%d:\n", ds, dx, dy, dw, dh, r, g, b, lv);
|
||||
|
||||
ags_sync();
|
||||
dst = sf_get(ds);
|
||||
gr_fill_alpha_color(dst, dx, dy, dw, dh, r, g, b, lv);
|
||||
}
|
||||
|
||||
void FillAMap() { /* not used ? */
|
||||
static void FillAMap() { /* not used ? */
|
||||
int p1 = getCaliValue();
|
||||
int p2 = getCaliValue();
|
||||
int p3 = getCaliValue();
|
||||
@@ -750,7 +745,7 @@ void FillAMap() { /* not used ? */
|
||||
DEBUG_COMMAND_YET("Gpx.FillAMap %d,%d,%d,%d,%d,%d:\n", p1, p2, p3, p4, p5, p6);
|
||||
}
|
||||
|
||||
void FillAMapOverBorder() {
|
||||
static void FillAMapOverBorder() {
|
||||
/*
|
||||
Gpx.FillAMapOverBorder(): 矩形領域中の 閾値以上の alpha 値を持つ
|
||||
ものを指定の alpha 値に置き換え。
|
||||
@@ -772,13 +767,13 @@ void FillAMapOverBorder() {
|
||||
int d = getCaliValue();
|
||||
surface_t *dst;
|
||||
|
||||
DEBUG_COMMAND("Gpx.BlendAMapOverBorder %d,%d,%d,%d,%d,%d,%d:\n", ds, dx, dy, dw, dh, s, d);
|
||||
DEBUG_COMMAND("Gpx.FillAMapOverBorder %d,%d,%d,%d,%d,%d,%d:\n", ds, dx, dy, dw, dh, s, d);
|
||||
|
||||
dst = sf_get(ds);
|
||||
gr_fill_alpha_overborder(dst, dx, dy, dw, dh, s, d);
|
||||
}
|
||||
|
||||
void FillAMapUnderBorder() { /* not used ? */
|
||||
static void FillAMapUnderBorder() { /* not used ? */
|
||||
int p1 = getCaliValue();
|
||||
int p2 = getCaliValue();
|
||||
int p3 = getCaliValue();
|
||||
@@ -787,10 +782,10 @@ void FillAMapUnderBorder() { /* not used ? */
|
||||
int p6 = getCaliValue();
|
||||
int p7 = getCaliValue();
|
||||
|
||||
DEBUG_COMMAND_YET("Gpx.BlendAMapUnderBorder %d,%d,%d,%d,%d,%d,%d:\n", p1, p2, p3, p4, p5, p6, p7);
|
||||
DEBUG_COMMAND_YET("Gpx.FillAMapUnderBorder %d,%d,%d,%d,%d,%d,%d:\n", p1, p2, p3, p4, p5, p6, p7);
|
||||
}
|
||||
|
||||
void SaturDP_DPxSA() { /* not used ? */
|
||||
static void SaturDP_DPxSA() { /* not used ? */
|
||||
int p1 = getCaliValue();
|
||||
int p2 = getCaliValue();
|
||||
int p3 = getCaliValue();
|
||||
@@ -803,7 +798,7 @@ void SaturDP_DPxSA() { /* not used ? */
|
||||
DEBUG_COMMAND_YET("Gpx.SaturDP_DPxSA %d,%d,%d,%d,%d,%d,%d,%d:\n", p1, p2, p3, p4, p5, p6, p7, p8);
|
||||
}
|
||||
|
||||
void ScreenDA_DAxSA() { /* not used ? */
|
||||
static void ScreenDA_DAxSA() { /* not used ? */
|
||||
int p1 = getCaliValue();
|
||||
int p2 = getCaliValue();
|
||||
int p3 = getCaliValue();
|
||||
@@ -816,7 +811,7 @@ void ScreenDA_DAxSA() { /* not used ? */
|
||||
DEBUG_COMMAND_YET("Gpx.ScreenDA_DAxSA %d,%d,%d,%d,%d,%d,%d,%d:\n", p1, p2, p3, p4, p5, p6, p7, p8);
|
||||
}
|
||||
|
||||
void AddDA_DAxSA() { /* not used ? */
|
||||
static void AddDA_DAxSA() { /* not used ? */
|
||||
int p1 = getCaliValue();
|
||||
int p2 = getCaliValue();
|
||||
int p3 = getCaliValue();
|
||||
@@ -829,7 +824,7 @@ void AddDA_DAxSA() { /* not used ? */
|
||||
DEBUG_COMMAND_YET("Gpx.AddDA_DAxSA %d,%d,%d,%d,%d,%d,%d,%d:\n", p1, p2, p3, p4, p5, p6, p7, p8);
|
||||
}
|
||||
|
||||
void SpriteCopyAMap() {
|
||||
static void SpriteCopyAMap() {
|
||||
/*
|
||||
Gpx.SpriteCopyAMap(): 指定の alpha 値以外の領域の alpha map コピー
|
||||
|
||||
@@ -856,14 +851,13 @@ void SpriteCopyAMap() {
|
||||
|
||||
DEBUG_COMMAND("Gpx.SpriteCopyAMap %d,%d,%d,%d,%d,%d,%d,%d,%d:\n", da, dx, dy, sa, sx, sy, sw, sh, cl);
|
||||
|
||||
ags_sync();
|
||||
src = sf_get(sa);
|
||||
dst = sf_get(da);
|
||||
gr_copy_alpha_map_sprite(dst, dx, dy, src, sx, sy, sw, sh, cl);
|
||||
|
||||
}
|
||||
|
||||
void BrightDestOnly() {
|
||||
static void BrightDestOnly() {
|
||||
/*
|
||||
Gpx.BrightDestOnly(): 指定領域の明るさを設定
|
||||
|
||||
@@ -884,13 +878,12 @@ void BrightDestOnly() {
|
||||
|
||||
DEBUG_COMMAND("Gpx.BrightDestOnly %d,%d,%d,%d,%d,%d:\n", ds, dx, dy, dw, dh, r);
|
||||
|
||||
ags_sync();
|
||||
dst = sf_get(ds);
|
||||
|
||||
gr_bright_dst_only(dst, dx, dy, dw, dh, r);
|
||||
}
|
||||
|
||||
void CopyTextureWrap() { /* not used ? */
|
||||
static void CopyTextureWrap() { /* not used ? */
|
||||
int p1 = getCaliValue();
|
||||
int p2 = getCaliValue();
|
||||
int p3 = getCaliValue();
|
||||
@@ -907,7 +900,7 @@ void CopyTextureWrap() { /* not used ? */
|
||||
DEBUG_COMMAND_YET("Gpx.CopyTextureWrap %d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d:\n", p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12);
|
||||
}
|
||||
|
||||
void CopyTextureWrapAlpha() { /* not used ? */
|
||||
static void CopyTextureWrapAlpha() { /* not used ? */
|
||||
int p1 = getCaliValue();
|
||||
int p2 = getCaliValue();
|
||||
int p3 = getCaliValue();
|
||||
@@ -925,7 +918,7 @@ void CopyTextureWrapAlpha() { /* not used ? */
|
||||
DEBUG_COMMAND_YET("Gpx.CopyTextureWrapAlpha %d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d:\n", p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13);
|
||||
}
|
||||
|
||||
void CopyStretch() {
|
||||
static void CopyStretch() {
|
||||
/*
|
||||
Gpx.CopyStretch(): 拡大・縮小
|
||||
|
||||
@@ -959,7 +952,7 @@ void CopyStretch() {
|
||||
gr_copy_stretch(dst, dx, dy, dw, dh, src, sx, sy, sw, sh);
|
||||
}
|
||||
|
||||
void CopyStretchBlend() { /* not used ? */
|
||||
static void CopyStretchBlend() { /* not used ? */
|
||||
int p1 = getCaliValue();
|
||||
int p2 = getCaliValue();
|
||||
int p3 = getCaliValue();
|
||||
@@ -975,7 +968,7 @@ void CopyStretchBlend() { /* not used ? */
|
||||
DEBUG_COMMAND_YET("Gpx.CopyStretchBlend %d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d:\n", p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11);
|
||||
}
|
||||
|
||||
void CopyStretchBlendAMap() {
|
||||
static void CopyStretchBlendAMap() {
|
||||
/*
|
||||
Gpx.CopyStretchBlendAMap(): 拡大・縮小しながら alpha blend
|
||||
|
||||
@@ -1004,13 +997,12 @@ void CopyStretchBlendAMap() {
|
||||
|
||||
DEBUG_COMMAND("Gpx.CopyStretchBlendAMap %d,%d,%d,%d,%d,%d,%d,%d,%d,%d:\n", ds, dx, dy, dw, dh, ss, sx, sy, sw, sh);
|
||||
|
||||
ags_sync();
|
||||
src = sf_get(ss);
|
||||
dst = sf_get(ds);
|
||||
gr_copy_stretch_blend_alpha_map(dst, dx, dy, dw, dh, src, sx, sy, sw, sh);
|
||||
}
|
||||
|
||||
void StretchBlendScreen2x2() { /* not used ? */
|
||||
static void StretchBlendScreen2x2() { /* not used ? */
|
||||
int p1 = getCaliValue();
|
||||
int p2 = getCaliValue();
|
||||
int p3 = getCaliValue();
|
||||
@@ -1024,7 +1016,7 @@ void StretchBlendScreen2x2() { /* not used ? */
|
||||
}
|
||||
|
||||
|
||||
void StretchBlendScreen2x2WDS() {
|
||||
static void StretchBlendScreen2x2WDS() {
|
||||
/*
|
||||
Gpx.StretchBlenfScreen2x2WDS(): 2枚の surface を縦横2倍に拡大しつつ
|
||||
alpha blend (飽和加算)する
|
||||
@@ -1056,14 +1048,13 @@ void StretchBlendScreen2x2WDS() {
|
||||
|
||||
DEBUG_COMMAND("Gpx.StretchBlendScreen2x2WDS %d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d:\n", ds, dx, dy, ss1, sx1, sy1, ss2, sx2, sy2, sw, sh);
|
||||
|
||||
ags_sync();
|
||||
src1 = sf_get(ss1);
|
||||
src2 = sf_get(ss2);
|
||||
dst = sf_get(ds);
|
||||
gr_blend_alpha_wds_stretch2x2(src1, sx1, sy1, src2, sx2, sy2, sw, sh, dst, dx, dy);
|
||||
}
|
||||
|
||||
void BlendScreenWDS() {
|
||||
static void BlendScreenWDS() {
|
||||
/*
|
||||
Gpx.BlendScreenWDS(): 飽和加算 alpha blend
|
||||
|
||||
@@ -1094,14 +1085,13 @@ void BlendScreenWDS() {
|
||||
|
||||
DEBUG_COMMAND("Gpx.BlendScreenWDS %d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d:\n", ds, dx, dy, ss1, sx1, sy1, ss2, sx2, sy2, sw, sh);
|
||||
|
||||
ags_sync();
|
||||
src1 = sf_get(ss1);
|
||||
src2 = sf_get(ss2);
|
||||
dst = sf_get(ds);
|
||||
gr_blend_alpha_wds(src1, sx1, sy1, src2, sx2, sy2, sw, sh, dst, dx, dy);
|
||||
}
|
||||
|
||||
void EffectCopy() {
|
||||
static void EffectCopy() {
|
||||
/*
|
||||
Gpx.EffectCopy(): 効果つき領域コピー
|
||||
|
||||
@@ -1161,7 +1151,6 @@ void EffectCopy() {
|
||||
default:
|
||||
DEBUG_COMMAND_YET("Gpx.EffectCopy %d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%p:\n", no, dx, dy, ss1, sx1, sy1, ss2, sx2, sy2, sw, sh, time, var);
|
||||
}
|
||||
ags_sync();
|
||||
dib = sf_get(0);
|
||||
dst = sf_get(ss1);
|
||||
src = sf_get(ss2);
|
||||
@@ -1169,8 +1158,65 @@ void EffectCopy() {
|
||||
|
||||
}
|
||||
|
||||
void SetClickCancelFlag() { /* not used ? */
|
||||
static void SetClickCancelFlag() { /* not used ? */
|
||||
int p1 = getCaliValue();
|
||||
|
||||
DEBUG_COMMAND_YET("Gpx.SetClikCancelFlag %d:\n", p1);
|
||||
}
|
||||
|
||||
static const ModuleFunc functions[] = {
|
||||
{"AddDA_DAxSA", AddDA_DAxSA},
|
||||
{"Blend", Blend},
|
||||
{"BlendAMap", BlendAMap},
|
||||
{"BlendAMapAlpha", BlendAMapAlpha},
|
||||
{"BlendAMapAlphaSrcBright", BlendAMapAlphaSrcBright},
|
||||
{"BlendAMapBright", BlendAMapBright},
|
||||
{"BlendAMapColor", BlendAMapColor},
|
||||
{"BlendAMapColorAlpha", BlendAMapColorAlpha},
|
||||
{"BlendAMapSrcOnly", BlendAMapSrcOnly},
|
||||
{"BlendAddSatur", BlendAddSatur},
|
||||
{"BlendMultiply", BlendMultiply},
|
||||
{"BlendScreen", BlendScreen},
|
||||
{"BlendScreenAlpha", BlendScreenAlpha},
|
||||
{"BlendScreenWDS", BlendScreenWDS},
|
||||
{"BlendSrcBright", BlendSrcBright},
|
||||
{"BlendUseAMapColor", BlendUseAMapColor},
|
||||
{"BrightDestOnly", BrightDestOnly},
|
||||
{"Copy", Copy},
|
||||
{"CopyAMap", CopyAMap},
|
||||
{"CopyBright", CopyBright},
|
||||
{"CopyStretch", CopyStretch},
|
||||
{"CopyStretchBlend", CopyStretchBlend},
|
||||
{"CopyStretchBlendAMap", CopyStretchBlendAMap},
|
||||
{"CopyTextureWrap", CopyTextureWrap},
|
||||
{"CopyTextureWrapAlpha", CopyTextureWrapAlpha},
|
||||
{"Create", Create},
|
||||
{"CreateAMapOnly", CreateAMapOnly},
|
||||
{"CreatePixelOnly", CreatePixelOnly},
|
||||
{"EffectCopy", EffectCopy},
|
||||
{"Fill", Fill},
|
||||
{"FillAMap", FillAMap},
|
||||
{"FillAMapOverBorder", FillAMapOverBorder},
|
||||
{"FillAMapUnderBorder", FillAMapUnderBorder},
|
||||
{"FillAlphaColor", FillAlphaColor},
|
||||
{"Free", Free},
|
||||
{"FreeAll", FreeAll},
|
||||
{"GetCGPosX", GetCGPosX},
|
||||
{"GetCGPosY", GetCGPosY},
|
||||
{"GetCreatedSurface", GetCreatedSurface},
|
||||
{"GetHeight", GetHeight},
|
||||
{"GetWidth", GetWidth},
|
||||
{"Init", Init},
|
||||
{"IsAlpha", IsAlpha},
|
||||
{"IsPixel", IsPixel},
|
||||
{"IsSurface", IsSurface},
|
||||
{"LoadCG", LoadCG},
|
||||
{"SaturDP_DPxSA", SaturDP_DPxSA},
|
||||
{"ScreenDA_DAxSA", ScreenDA_DAxSA},
|
||||
{"SetClickCancelFlag", SetClickCancelFlag},
|
||||
{"SpriteCopyAMap", SpriteCopyAMap},
|
||||
{"StretchBlendScreen2x2", StretchBlendScreen2x2},
|
||||
{"StretchBlendScreen2x2WDS", StretchBlendScreen2x2WDS},
|
||||
};
|
||||
|
||||
const Module module_Gpx = {"Gpx", functions, sizeof(functions) / sizeof(ModuleFunc)};
|
||||
|
||||
@@ -169,21 +169,6 @@ void sf_blend_white_level(surface_t *dst, int dx, int dy, surface_t *src, int sx
|
||||
dp = GETOFFSET_PIXEL(dst, dx, dy);
|
||||
|
||||
switch(dst->depth) {
|
||||
case 15:
|
||||
{
|
||||
WORD *yls, *yld;
|
||||
|
||||
for (y = 0; y < sh; y++) {
|
||||
yls = (WORD *)(sp + y * src->bytes_per_line);
|
||||
yld = (WORD *)(dp + y * dst->bytes_per_line);
|
||||
|
||||
for (x = 0; x < sw; x++) {
|
||||
*yld = WHITELEVEL15(*yls, lv);
|
||||
yls++; yld++;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 16:
|
||||
{
|
||||
WORD *yls, *yld;
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
add_library(Math MODULE Math.c)
|
||||
|
||||
install(TARGETS Math DESTINATION lib/xsystem35)
|
||||
+14
-4
@@ -28,12 +28,13 @@
|
||||
#include "portab.h"
|
||||
#include "system.h"
|
||||
#include "xsystem35.h"
|
||||
#include "modules.h"
|
||||
#include "nact.h"
|
||||
#include "randMT.h"
|
||||
|
||||
static int numtblmax;
|
||||
|
||||
void RandMTInit() {
|
||||
static void RandMTInit() {
|
||||
/*
|
||||
(おそらく Mersenne Twister使用の) 乱数初期化
|
||||
|
||||
@@ -44,7 +45,7 @@ void RandMTInit() {
|
||||
DEBUG_COMMAND("Math.RandMTInit %d:\n", p1);
|
||||
}
|
||||
|
||||
void RandMTGet() {
|
||||
static void RandMTGet() {
|
||||
/*
|
||||
1 から num までの乱数を生成
|
||||
|
||||
@@ -63,7 +64,7 @@ void RandMTGet() {
|
||||
DEBUG_COMMAND("Math.RandMTGet %d,%p:\n", num, var);
|
||||
}
|
||||
|
||||
void RandMTMakeNumTable() {
|
||||
static void RandMTMakeNumTable() {
|
||||
/*
|
||||
乱数テーブルの最大値を設定
|
||||
|
||||
@@ -76,7 +77,7 @@ void RandMTMakeNumTable() {
|
||||
DEBUG_COMMAND("Math.RandMTMakeNumTable %d:\n", p1);
|
||||
}
|
||||
|
||||
void RandMTGetNumTable() {
|
||||
static void RandMTGetNumTable() {
|
||||
/*
|
||||
乱数テーブルから値を取得
|
||||
|
||||
@@ -88,3 +89,12 @@ void RandMTGetNumTable() {
|
||||
|
||||
DEBUG_COMMAND("Math.RandMTGetNumTable %d:\n", *var);
|
||||
}
|
||||
|
||||
static const ModuleFunc functions[] = {
|
||||
{"RandMTGet", RandMTGet},
|
||||
{"RandMTGetNumTable", RandMTGetNumTable},
|
||||
{"RandMTInit", RandMTInit},
|
||||
{"RandMTMakeNumTable", RandMTMakeNumTable},
|
||||
};
|
||||
|
||||
const Module module_Math = {"Math", functions, sizeof(functions) / sizeof(ModuleFunc)};
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
add_library(MsgSkip MODULE MsgSkip.c)
|
||||
|
||||
install(TARGETS MsgSkip DESTINATION lib/xsystem35)
|
||||
+65
-33
@@ -1,69 +1,101 @@
|
||||
#include "config.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "portab.h"
|
||||
#include "system.h"
|
||||
#include "filecheck.h"
|
||||
#include "xsystem35.h"
|
||||
#include "modules.h"
|
||||
#include "nact.h"
|
||||
#include "message.h"
|
||||
#include "msgskip.h"
|
||||
#include "utfsjis.h"
|
||||
|
||||
static char *msgskipfile;
|
||||
static boolean valid;
|
||||
static int action;
|
||||
|
||||
void Init() {
|
||||
int *p1 = getCaliVariable();
|
||||
int p2 = getCaliValue(); /* ISys3x */
|
||||
int p3 = getCaliValue();
|
||||
int p4 = getCaliValue();
|
||||
static void Init() {
|
||||
int *p1 = getCaliVariable();
|
||||
int p2 = getCaliValue(); /* ISys3x */
|
||||
int p3 = getCaliValue();
|
||||
int p4 = getCaliValue();
|
||||
|
||||
|
||||
DEBUG_COMMAND_YET("MsgSkip.Init %p,%d,%d,%d:\n", p1, p2, p3, p4);
|
||||
action = p3;
|
||||
valid = true;
|
||||
*p1 = 0;
|
||||
|
||||
DEBUG_COMMAND("MsgSkip.Init %p,%d,%d,%d:\n", p1, p2, p3, p4);
|
||||
}
|
||||
|
||||
void Start() {
|
||||
int *p1 = getCaliVariable();
|
||||
int p2 = getCaliValue();
|
||||
static void Start() {
|
||||
int *p1 = getCaliVariable();
|
||||
int p2 = getCaliValue();
|
||||
|
||||
msgskipfile = strdup(v_str(p2 -1));
|
||||
|
||||
DEBUG_COMMAND_YET("MsgSkip.Start %p,%d:\n", p1, p2);
|
||||
char *fname_utf8 = sjis2utf(svar_get(p2));
|
||||
char *path = fc_get_path(fname_utf8);
|
||||
msgskip_init(path);
|
||||
free(path);
|
||||
free(fname_utf8);
|
||||
|
||||
DEBUG_COMMAND("MsgSkip.Start %p,%d:\n", p1, p2);
|
||||
}
|
||||
|
||||
void SetValid() {
|
||||
int p1 = getCaliValue();
|
||||
static void SetValid() {
|
||||
int p1 = getCaliValue();
|
||||
|
||||
valid = p1;
|
||||
msgskip_pause(!valid);
|
||||
|
||||
|
||||
DEBUG_COMMAND("MsgSkip.SetValid %d:\n", p1);
|
||||
}
|
||||
|
||||
void GetValid() {
|
||||
int *p1 = getCaliVariable();
|
||||
|
||||
DEBUG_COMMAND_YET("MsgSkip.GetValid %p:\n", p1);
|
||||
static void GetValid() {
|
||||
int *p1 = getCaliVariable();
|
||||
|
||||
*p1 = valid;
|
||||
|
||||
DEBUG_COMMAND("MsgSkip.GetValid %p:\n", p1);
|
||||
}
|
||||
|
||||
void SetAction() {
|
||||
int p1 = getCaliValue();
|
||||
|
||||
static void SetAction() {
|
||||
int p1 = getCaliValue();
|
||||
|
||||
action = p1;
|
||||
|
||||
DEBUG_COMMAND("MsgSkip.SetAcion %d:\n", p1);
|
||||
}
|
||||
|
||||
void GetAction() {
|
||||
int *p1 = getCaliVariable();
|
||||
|
||||
DEBUG_COMMAND_YET("MsgSkip.GetAcion %p:\n", p1);
|
||||
static void GetAction() {
|
||||
int *p1 = getCaliVariable();
|
||||
|
||||
*p1 = action;
|
||||
|
||||
DEBUG_COMMAND("MsgSkip.GetAcion %p:\n", p1);
|
||||
}
|
||||
|
||||
void PushStr() {
|
||||
int p1 = getCaliValue();
|
||||
static void PushStr() {
|
||||
int p1 = getCaliValue();
|
||||
|
||||
DEBUG_COMMAND_YET("MsgSkip.PushStr %d:\n", p1);
|
||||
}
|
||||
|
||||
void PopStr() {
|
||||
int p1 = getCaliValue();
|
||||
static void PopStr() {
|
||||
int p1 = getCaliValue();
|
||||
|
||||
DEBUG_COMMAND_YET("MsgSkip.PopStr %d:\n", p1);
|
||||
}
|
||||
|
||||
static const ModuleFunc functions[] = {
|
||||
{"GetAction", GetAction},
|
||||
{"GetValid", GetValid},
|
||||
{"Init", Init},
|
||||
{"PopStr", PopStr},
|
||||
{"PushStr", PushStr},
|
||||
{"SetAction", SetAction},
|
||||
{"SetValid", SetValid},
|
||||
{"Start", Start},
|
||||
};
|
||||
|
||||
const Module module_MsgSkip = {"MsgSkip", functions, sizeof(functions) / sizeof(ModuleFunc)};
|
||||
|
||||
@@ -1,21 +0,0 @@
|
||||
add_library(NIGHTDLL MODULE
|
||||
NIGHTDLL.c
|
||||
nt_scenario.c
|
||||
sactcg.c
|
||||
sactstring.c
|
||||
sprite.c
|
||||
sprite_draw.c
|
||||
sprite_update.c
|
||||
sprite_eupdate.c
|
||||
nt_event.c
|
||||
nt_msg.c
|
||||
nt_sel.c
|
||||
nt_graph.c
|
||||
nt_sound.c
|
||||
)
|
||||
|
||||
target_compile_options(NIGHTDLL PRIVATE -Wno-pointer-sign -Wno-invalid-source-encoding)
|
||||
|
||||
target_link_libraries(NIGHTDLL PRIVATE graph drawtext list)
|
||||
|
||||
install(TARGETS NIGHTDLL DESTINATION lib/xsystem35)
|
||||
+143
-70
@@ -5,6 +5,7 @@
|
||||
#include "portab.h"
|
||||
#include "system.h"
|
||||
#include "xsystem35.h"
|
||||
#include "modules.h"
|
||||
#include "nact.h"
|
||||
#include "night.h"
|
||||
#include "nt_sound.h"
|
||||
@@ -19,7 +20,7 @@
|
||||
night_t nightprv;
|
||||
|
||||
|
||||
void Init(void) { /* 0 */
|
||||
static void Init(void) { /* 0 */
|
||||
int *var = getCaliVariable();
|
||||
int p1 = getCaliValue(); /* ISys3xCG */
|
||||
int p2 = getCaliValue(); /* ISys3xDIB */
|
||||
@@ -37,8 +38,8 @@ void Init(void) { /* 0 */
|
||||
DEBUG_COMMAND_YET("NIGHTDLL.Init %p:\n", var);
|
||||
}
|
||||
|
||||
void InitGame() { /* 1 */
|
||||
nact->ags.font->antialiase_on = TRUE;
|
||||
static void InitGame() { /* 1 */
|
||||
ags_setAntialiasedStringMode(TRUE);
|
||||
sys_setHankakuMode(2);
|
||||
|
||||
nact->msgout = ntmsg_add;
|
||||
@@ -47,13 +48,13 @@ void InitGame() { /* 1 */
|
||||
|
||||
nt_gr_init();
|
||||
ntmsg_init();
|
||||
sstr_init();
|
||||
nt_sstr_init();
|
||||
|
||||
DEBUG_COMMAND_YET("NIGHTDLL.InitGame:\n");
|
||||
}
|
||||
|
||||
// メッセージの枠の表示
|
||||
void SetMsgFrame() { /* 2 */
|
||||
static void SetMsgFrame() { /* 2 */
|
||||
int p1 = getCaliValue(); // 0=枠消去, 1=枠あり, 2=中央
|
||||
|
||||
ntmsg_set_frame(p1);
|
||||
@@ -62,7 +63,7 @@ void SetMsgFrame() { /* 2 */
|
||||
}
|
||||
|
||||
// メッセージの表示位置の設定
|
||||
void SetMsgPlaceMethod(void) { /* 3 */
|
||||
static void SetMsgPlaceMethod(void) { /* 3 */
|
||||
int p1 = getCaliValue(); // 0=メッセージ枠内, 1=中央,
|
||||
// 2=メッセージ枠+顔つき
|
||||
ntmsg_set_place(p1);
|
||||
@@ -71,21 +72,21 @@ void SetMsgPlaceMethod(void) { /* 3 */
|
||||
}
|
||||
|
||||
// 未実装?
|
||||
void SetMsgDrawEffect(void) { /* 4 */
|
||||
static void SetMsgDrawEffect(void) { /* 4 */
|
||||
int p1 = getCaliValue(); // 0, 1, 2, 3 (実際にはどれも機能しない?)
|
||||
|
||||
DEBUG_COMMAND_YET("NIGHTDLL.SetMsgDrawEffect %d:\n", p1);
|
||||
}
|
||||
|
||||
// 未実装?
|
||||
void SetMsgClearEffect(void) { /* 5 */
|
||||
static void SetMsgClearEffect(void) { /* 5 */
|
||||
int p1 = getCaliValue(); // 0, 1, 2, 4 (実際にはどれも機能しない?)
|
||||
|
||||
DEBUG_COMMAND_YET("NIGHTDLL.SetMsgClearEffect %d:\n", p1);
|
||||
}
|
||||
|
||||
// 壁紙CGの設定
|
||||
void SetWallPaper(void) { /* 6 */
|
||||
static void SetWallPaper(void) { /* 6 */
|
||||
int p1 = getCaliValue(); // 壁紙CG番号
|
||||
|
||||
nt_gr_set_wallpaper(p1);
|
||||
@@ -94,7 +95,7 @@ void SetWallPaper(void) { /* 6 */
|
||||
}
|
||||
|
||||
// 背景CGの設定
|
||||
void SetScenery(void) { /* 7 */
|
||||
static void SetScenery(void) { /* 7 */
|
||||
int p1 = getCaliValue(); // 背景GC番号
|
||||
|
||||
nt_gr_set_scenery(p1);
|
||||
@@ -103,7 +104,7 @@ void SetScenery(void) { /* 7 */
|
||||
}
|
||||
|
||||
// 顔CGの設定
|
||||
void SetFace(void) { /* 8 */
|
||||
static void SetFace(void) { /* 8 */
|
||||
int p1 = getCaliValue(); // 顔CG番号
|
||||
|
||||
nt_gr_set_face(p1);
|
||||
@@ -112,7 +113,7 @@ void SetFace(void) { /* 8 */
|
||||
}
|
||||
|
||||
// 立ち絵左の設定
|
||||
void SetSpriteL(void) { /* 9 */
|
||||
static void SetSpriteL(void) { /* 9 */
|
||||
int p1 = getCaliValue(); // 左人物スプライト番号
|
||||
|
||||
nt_gr_set_spL(p1);
|
||||
@@ -121,7 +122,7 @@ void SetSpriteL(void) { /* 9 */
|
||||
}
|
||||
|
||||
// 立ち絵中央の設定
|
||||
void SetSpriteM(void) { /* 10 */
|
||||
static void SetSpriteM(void) { /* 10 */
|
||||
int p1 = getCaliValue(); // 中央人物スプライト番号
|
||||
|
||||
nt_gr_set_spM(p1);
|
||||
@@ -130,7 +131,7 @@ void SetSpriteM(void) { /* 10 */
|
||||
}
|
||||
|
||||
// 立ち絵右の設定
|
||||
void SetSpriteR(void) { /* 11 */
|
||||
static void SetSpriteR(void) { /* 11 */
|
||||
int p1 = getCaliValue(); // 右人物スプライト番号
|
||||
|
||||
nt_gr_set_spR(p1);
|
||||
@@ -139,7 +140,7 @@ void SetSpriteR(void) { /* 11 */
|
||||
}
|
||||
|
||||
// 立ち絵左の設定(季節違い?)
|
||||
void SetSpriteSeasonL(void) { /* 12 */
|
||||
static void SetSpriteSeasonL(void) { /* 12 */
|
||||
int p1 = getCaliValue(); // 左人物スプライト番号
|
||||
|
||||
nt_gr_set_spsL(p1);
|
||||
@@ -148,7 +149,7 @@ void SetSpriteSeasonL(void) { /* 12 */
|
||||
}
|
||||
|
||||
// 立ち絵中央の設定(季節違い?)
|
||||
void SetSpriteSeasonM(void) { /* 13 */
|
||||
static void SetSpriteSeasonM(void) { /* 13 */
|
||||
int p1 = getCaliValue(); // 中央人物スプライト番号
|
||||
|
||||
nt_gr_set_spM(p1);
|
||||
@@ -157,7 +158,7 @@ void SetSpriteSeasonM(void) { /* 13 */
|
||||
}
|
||||
|
||||
// 立ち絵右の設定(季節違い?)
|
||||
void SetSpriteSeasonR(void) { /* 14 */
|
||||
static void SetSpriteSeasonR(void) { /* 14 */
|
||||
int p1 = getCaliValue(); // 右人物スプライト番号
|
||||
|
||||
nt_gr_set_spsR(p1);
|
||||
@@ -166,14 +167,14 @@ void SetSpriteSeasonR(void) { /* 14 */
|
||||
}
|
||||
|
||||
// 改行
|
||||
void StartNewLine(void) { /* 15 */
|
||||
static void StartNewLine(void) { /* 15 */
|
||||
ntmsg_newline();
|
||||
|
||||
DEBUG_COMMAND_YET("NIGHTDLL.StartNewLine:\n");
|
||||
}
|
||||
|
||||
// メッセージフォントサイズの設定
|
||||
void SetFontSize(void) { /* 16 */
|
||||
static void SetFontSize(void) { /* 16 */
|
||||
int p1 = getCaliValue(); // メッセージフォントサイズ
|
||||
|
||||
night.fontsize = p1;
|
||||
@@ -182,7 +183,7 @@ void SetFontSize(void) { /* 16 */
|
||||
}
|
||||
|
||||
// フォントの種類の設定
|
||||
void SetFont(void) { /* 17 */
|
||||
static void SetFont(void) { /* 17 */
|
||||
int p1 = getCaliValue(); // 0: ゴシック, 1: 明朝
|
||||
|
||||
night.fonttype = p1;
|
||||
@@ -191,7 +192,7 @@ void SetFont(void) { /* 17 */
|
||||
}
|
||||
|
||||
// 選択肢モード ON
|
||||
void SetSelMode(void) { /* 18 */
|
||||
static void SetSelMode(void) { /* 18 */
|
||||
int p1 = getCaliValue(); // 0, 1(ほとんど0)
|
||||
|
||||
night.selmode = p1;
|
||||
@@ -200,7 +201,7 @@ void SetSelMode(void) { /* 18 */
|
||||
}
|
||||
|
||||
// キー入力待ち後、改ページ
|
||||
void AnalyzeMessage(void) { /* 19 */
|
||||
static void AnalyzeMessage(void) { /* 19 */
|
||||
int *var = getCaliVariable(); // 入力されたキー
|
||||
|
||||
*var = ntmsg_ana();
|
||||
@@ -209,7 +210,7 @@ void AnalyzeMessage(void) { /* 19 */
|
||||
}
|
||||
|
||||
// ~DRAWの効果時間
|
||||
void SetDrawTime(void) { /* 20 */
|
||||
static void SetDrawTime(void) { /* 20 */
|
||||
int p1 = getCaliValue(); // 効果時間 (未使用?)
|
||||
|
||||
nt_gr_set_drawtime(p1);
|
||||
@@ -218,7 +219,7 @@ void SetDrawTime(void) { /* 20 */
|
||||
}
|
||||
|
||||
// 効果つき画面更新
|
||||
void Draw(void) { /* 21 */
|
||||
static void Draw(void) { /* 21 */
|
||||
int p1 = getCaliValue(); // 効果番号
|
||||
|
||||
nt_gr_draw(p1);
|
||||
@@ -227,7 +228,7 @@ void Draw(void) { /* 21 */
|
||||
}
|
||||
|
||||
// 音声データを再生
|
||||
void SetVoice(void) { /* 22 */
|
||||
static void SetVoice(void) { /* 22 */
|
||||
int p1 = getCaliValue(); // ファイル番号
|
||||
|
||||
nt_voice_set(p1);
|
||||
@@ -236,13 +237,13 @@ void SetVoice(void) { /* 22 */
|
||||
}
|
||||
|
||||
// 未使用
|
||||
void WaitKey(void) { /* 23 */
|
||||
static void WaitKey(void) { /* 23 */
|
||||
int p1 = getCaliValue(); //
|
||||
|
||||
DEBUG_COMMAND_YET("NIGHTDLL.WaitKey %d:\n", p1);
|
||||
}
|
||||
|
||||
void AddFeeling(void) { /* 24 */
|
||||
static void AddFeeling(void) { /* 24 */
|
||||
int p1 = getCaliValue(); // person(1:新開,2:星川,3:百瀬,4:いずみ,5:鏡花,6:真言美,7:マコト
|
||||
int p2 = getCaliValue(); // val
|
||||
|
||||
@@ -250,14 +251,14 @@ void AddFeeling(void) { /* 24 */
|
||||
|
||||
}
|
||||
|
||||
void SubFeeling(void) { /* 25 */
|
||||
static void SubFeeling(void) { /* 25 */
|
||||
int p1 = getCaliValue(); // person
|
||||
int p2 = getCaliValue(); // val
|
||||
|
||||
DEBUG_COMMAND_YET("NIGHTDLL.SubFeeling %d:\n", p1);
|
||||
}
|
||||
|
||||
void CallEvent(void) { /* 26 */
|
||||
static void CallEvent(void) { /* 26 */
|
||||
int p1 = getCaliValue(); // 1, 2 (Event Number)
|
||||
|
||||
nt_sco_callevent(p1);
|
||||
@@ -265,7 +266,7 @@ void CallEvent(void) { /* 26 */
|
||||
DEBUG_COMMAND_YET("NIGHTDLL.CallEvent %d:\n", p1);
|
||||
}
|
||||
|
||||
void ScreenCG(void) { /* 27 */
|
||||
static void ScreenCG(void) { /* 27 */
|
||||
/*
|
||||
CG を読み込んで、surface0 と BlendScreen で重ね合わせ
|
||||
|
||||
@@ -284,7 +285,7 @@ void ScreenCG(void) { /* 27 */
|
||||
DEBUG_COMMAND_YET("NIGHTDLL.ScreenCG %d,%d,%d:\n", x, y, no);
|
||||
}
|
||||
|
||||
void RunGameMain(void) { /* 28 */
|
||||
static void RunGameMain(void) { /* 28 */
|
||||
int *p1 = getCaliVariable(); // result
|
||||
int p2 = getCaliValue(); // month
|
||||
int p3 = getCaliValue(); // day
|
||||
@@ -300,7 +301,7 @@ void RunGameMain(void) { /* 28 */
|
||||
DEBUG_COMMAND_YET("NIGHTDLL.RunGameMain %p,%d,%d,%d,%d:\n", p1, p2, p3, p4, p5);
|
||||
}
|
||||
|
||||
void CheckNewGame(void) { /* 29 */
|
||||
static void CheckNewGame(void) { /* 29 */
|
||||
int *p1 = getCaliVariable();
|
||||
|
||||
*p1 = 0;
|
||||
@@ -308,21 +309,21 @@ void CheckNewGame(void) { /* 29 */
|
||||
DEBUG_COMMAND_YET("NIGHTDLL.CheckNewGame %p:\n", p1);
|
||||
}
|
||||
|
||||
void SaveStartData(void) { /* 30 */
|
||||
static void SaveStartData(void) { /* 30 */
|
||||
DEBUG_COMMAND_YET("NIGHTDLL.SaveStartData:\n");
|
||||
}
|
||||
|
||||
void PrintExitSystem(void) { /* 31 */
|
||||
static void PrintExitSystem(void) { /* 31 */
|
||||
DEBUG_COMMAND_YET("NIGHTDLL.PrintExitSystem:\n");
|
||||
}
|
||||
|
||||
void SetCalendar(void) { /* 32 */
|
||||
static void SetCalendar(void) { /* 32 */
|
||||
int p1 = getCaliValue(); // 0, 1, 2
|
||||
|
||||
DEBUG_COMMAND_YET("NIGHTDLL.SetCalendar %d:\n", p1);
|
||||
}
|
||||
|
||||
void SetDate(void) { /* 33 */
|
||||
static void SetDate(void) { /* 33 */
|
||||
int p1 = getCaliValue(); // month
|
||||
int p2 = getCaliValue(); // day
|
||||
int p3 = getCaliValue(); // day of week
|
||||
@@ -334,7 +335,7 @@ void SetDate(void) { /* 33 */
|
||||
DEBUG_COMMAND_YET("NIGHTDLL.SetDate %d,%d,%d:\n", p1, p2, p3);
|
||||
}
|
||||
|
||||
void GetDate(void) { /* 34 */
|
||||
static void GetDate(void) { /* 34 */
|
||||
int *p1 = getCaliVariable(); // month
|
||||
int *p2 = getCaliVariable(); // day
|
||||
int *p3 = getCaliVariable(); // day of weeek
|
||||
@@ -346,11 +347,11 @@ void GetDate(void) { /* 34 */
|
||||
DEBUG_COMMAND_YET("NIGHTDLL.GetDate %p,%p,%p:\n", p1, p2, p3);
|
||||
}
|
||||
|
||||
void SelectGameLevel(void) { /* 35 */
|
||||
static void SelectGameLevel(void) { /* 35 */
|
||||
DEBUG_COMMAND_YET("NIGHTDLL.SelectGameLevel:\n");
|
||||
}
|
||||
|
||||
void RunEventDungeon(void) { /* 36 */
|
||||
static void RunEventDungeon(void) { /* 36 */
|
||||
int *p1 = getCaliVariable();
|
||||
int p2 = getCaliValue();
|
||||
|
||||
@@ -359,14 +360,14 @@ void RunEventDungeon(void) { /* 36 */
|
||||
DEBUG_COMMAND_YET("NIGHTDLL.RunEventDungeon %p,%d:\n", p1, p2);
|
||||
}
|
||||
|
||||
void RunEventBattle(void) { /* 37 */
|
||||
static void RunEventBattle(void) { /* 37 */
|
||||
int p1 = getCaliValue(); // 実際には機能しない?
|
||||
|
||||
DEBUG_COMMAND_YET("NIGHTDLL.RunEventBattle %d:\n", p1);
|
||||
}
|
||||
|
||||
// CD再生開始
|
||||
void CDPlay(void) { /* 38 */
|
||||
static void CDPlay(void) { /* 38 */
|
||||
int p1 = getCaliValue(); // no
|
||||
|
||||
nt_cd_play(p1);
|
||||
@@ -375,7 +376,7 @@ void CDPlay(void) { /* 38 */
|
||||
}
|
||||
|
||||
// CD再生停止
|
||||
void CDStop(void) { /* 39 */
|
||||
static void CDStop(void) { /* 39 */
|
||||
int p1 = getCaliValue(); // time(msec)
|
||||
|
||||
nt_cd_stop(p1);
|
||||
@@ -384,7 +385,7 @@ void CDStop(void) { /* 39 */
|
||||
}
|
||||
|
||||
// CDのmute
|
||||
void CDMute(void) { /* 40 */
|
||||
static void CDMute(void) { /* 40 */
|
||||
int p1 = getCaliValue(); // 0: mute off, 1: mute on
|
||||
|
||||
nt_cd_mute(p1 == 0 ? FALSE : TRUE);
|
||||
@@ -393,7 +394,7 @@ void CDMute(void) { /* 40 */
|
||||
}
|
||||
|
||||
// ch に効果音番号をセット
|
||||
void SoundEffectSetWave(void) { /* 41 */
|
||||
static void SoundEffectSetWave(void) { /* 41 */
|
||||
int p1 = getCaliValue(); // ch
|
||||
int p2 = getCaliValue(); // linkno
|
||||
|
||||
@@ -403,7 +404,7 @@ void SoundEffectSetWave(void) { /* 41 */
|
||||
}
|
||||
|
||||
// ch にくり返し数をセット
|
||||
void SoundEffectSetLoop(void) { /* 42 */
|
||||
static void SoundEffectSetLoop(void) { /* 42 */
|
||||
int p1 = getCaliValue(); // ch
|
||||
int p2 = getCaliValue(); // numloop
|
||||
|
||||
@@ -413,7 +414,7 @@ void SoundEffectSetLoop(void) { /* 42 */
|
||||
}
|
||||
|
||||
// ch に音量をセット
|
||||
void SoundEffectSetVolume(void) { /* 43 */
|
||||
static void SoundEffectSetVolume(void) { /* 43 */
|
||||
int p1 = getCaliValue(); // ch
|
||||
int p2 = getCaliValue(); // vol
|
||||
|
||||
@@ -423,7 +424,7 @@ void SoundEffectSetVolume(void) { /* 43 */
|
||||
}
|
||||
|
||||
// 効果音の再生を終るまで待つか待たないか?
|
||||
void SoundEffectSetSyncFlag(void) { /* 44 */
|
||||
static void SoundEffectSetSyncFlag(void) { /* 44 */
|
||||
int p1 = getCaliValue(); // ch
|
||||
int p2 = getCaliValue(); // 0: 終るまで待たない, 1: 待つ
|
||||
|
||||
@@ -433,7 +434,7 @@ void SoundEffectSetSyncFlag(void) { /* 44 */
|
||||
}
|
||||
|
||||
// ch の効果音を再生
|
||||
void SoundEffectPlay(void) { /* 45 */
|
||||
static void SoundEffectPlay(void) { /* 45 */
|
||||
int p1 = getCaliValue(); // ch
|
||||
|
||||
nt_snd_play(p1);
|
||||
@@ -442,7 +443,7 @@ void SoundEffectPlay(void) { /* 45 */
|
||||
}
|
||||
|
||||
// ch の効果音を停止
|
||||
void SoundEffectStop(void) { /* 46 */
|
||||
static void SoundEffectStop(void) { /* 46 */
|
||||
int p1 = getCaliValue(); // ch
|
||||
int p2 = getCaliValue(); // time (止まるまでの時間)
|
||||
|
||||
@@ -452,7 +453,7 @@ void SoundEffectStop(void) { /* 46 */
|
||||
}
|
||||
|
||||
// 全てのチャンネルの再生を停止
|
||||
void SoundEffectStopAll(void) { /* 47 */
|
||||
static void SoundEffectStopAll(void) { /* 47 */
|
||||
int p1 = getCaliValue(); // time (止まるまでの時間)
|
||||
|
||||
nt_snd_stopall(p1);
|
||||
@@ -460,86 +461,86 @@ void SoundEffectStopAll(void) { /* 47 */
|
||||
DEBUG_COMMAND_YET("NIGHTDLL.SoundEffectStopAll %d:\n", p1);
|
||||
}
|
||||
|
||||
void RunSoundMode(void) { /* 48 */
|
||||
static void RunSoundMode(void) { /* 48 */
|
||||
|
||||
DEBUG_COMMAND_YET("NIGHTDLL.RunSoundMode:\n");
|
||||
}
|
||||
|
||||
void RunMapEditor(void) { /* 49 */
|
||||
static void RunMapEditor(void) { /* 49 */
|
||||
int *p1 = getCaliVariable();
|
||||
|
||||
DEBUG_COMMAND_YET("NIGHTDLL.RunMapEditor %p:\n", p1);
|
||||
}
|
||||
|
||||
void VisualListClear(void) { /* 50 */
|
||||
static void VisualListClear(void) { /* 50 */
|
||||
|
||||
DEBUG_COMMAND_YET("NIGHTDLL.VisualListClear:\n");
|
||||
}
|
||||
|
||||
void VisualListAdd(void) { /* 51 */
|
||||
static void VisualListAdd(void) { /* 51 */
|
||||
int p1 = getCaliValue();
|
||||
|
||||
DEBUG_COMMAND_YET("NIGHTDLL.VisualListAdd %d:\n", p1);
|
||||
}
|
||||
|
||||
void GetLocalCountCG(void) { /* 52 */
|
||||
static void GetLocalCountCG(void) { /* 52 */
|
||||
int *p1 = getCaliVariable();
|
||||
int p2 = getCaliValue();
|
||||
|
||||
DEBUG_COMMAND_YET("NIGHTDLL.GetLocalCountCG %p,%d:\n", p1, p2);
|
||||
}
|
||||
|
||||
void PlayMemory(void) { /* 53 */
|
||||
static void PlayMemory(void) { /* 53 */
|
||||
int *p1 = getCaliVariable(); // 回想ページ
|
||||
int *p2 = getCaliVariable(); // 回想RESULT
|
||||
|
||||
DEBUG_COMMAND_YET("NIGHTDLL.PlayMemory %p,%p:\n", p1, p2);
|
||||
}
|
||||
|
||||
void GetEventFlagTotal(void) { /* 54 */
|
||||
static void GetEventFlagTotal(void) { /* 54 */
|
||||
int *p1 = getCaliVariable();
|
||||
int p2 = getCaliValue();
|
||||
|
||||
DEBUG_COMMAND_YET("NIGHTDLL.GetEventFlagTotal %p,%d:\n", p1, p2);
|
||||
}
|
||||
|
||||
void SetPlayerName(void) { /* 55 */
|
||||
static void SetPlayerName(void) { /* 55 */
|
||||
int p1 = getCaliValue();
|
||||
|
||||
DEBUG_COMMAND_YET("NIGHTDLL.SetPlayerName %d:\n", p1);
|
||||
}
|
||||
|
||||
void GetPlayerName(void) { /* 56 */
|
||||
static void GetPlayerName(void) { /* 56 */
|
||||
int p1 = getCaliValue();
|
||||
|
||||
DEBUG_COMMAND_YET("NIGHTDLL.GetPlayerName %d:\n", p1);
|
||||
}
|
||||
|
||||
void SaveGame(void) { /* 57 */
|
||||
static void SaveGame(void) { /* 57 */
|
||||
int *p1 = getCaliVariable();
|
||||
|
||||
DEBUG_COMMAND_YET("NIGHTDLL.SaveGame %p:\n", p1);
|
||||
}
|
||||
|
||||
void LoadGame(void) { /* 58 */
|
||||
static void LoadGame(void) { /* 58 */
|
||||
int *p1 = getCaliVariable();
|
||||
|
||||
DEBUG_COMMAND_YET("NIGHTDLL.LoadGame %p:\n", p1);
|
||||
}
|
||||
|
||||
void ExistSaveData(void) { /* 59 */
|
||||
static void ExistSaveData(void) { /* 59 */
|
||||
int *p1 = getCaliVariable();
|
||||
|
||||
DEBUG_COMMAND_YET("NIGHTDLL.ExistSaveData %p:\n", p1);
|
||||
}
|
||||
|
||||
void ExistStartData(void) { /* 60 */
|
||||
static void ExistStartData(void) { /* 60 */
|
||||
int *p1 = getCaliVariable();
|
||||
|
||||
DEBUG_COMMAND_YET("NIGHTDLL.ExistStartData %p:\n", p1);
|
||||
}
|
||||
|
||||
void SetAreaData(void) { /* 61 */
|
||||
static void SetAreaData(void) { /* 61 */
|
||||
int p1 = getCaliValue();
|
||||
int p2 = getCaliValue();
|
||||
int p3 = getCaliValue();
|
||||
@@ -547,27 +548,27 @@ void SetAreaData(void) { /* 61 */
|
||||
DEBUG_COMMAND_YET("NIGHTDLL.SetAreaData %d,%d,%d:\n", p1, p2, p3);
|
||||
}
|
||||
|
||||
void RunBattleTest(void) { /* 62 */
|
||||
static void RunBattleTest(void) { /* 62 */
|
||||
DEBUG_COMMAND_YET("NIGHTDLL.RunBattleTest:\n");
|
||||
}
|
||||
|
||||
void RunTrainingTest(void) { /* 63 */
|
||||
static void RunTrainingTest(void) { /* 63 */
|
||||
DEBUG_COMMAND_YET("NIGHTDLL.RunTrainingTest:\n");
|
||||
}
|
||||
|
||||
void TestEventCall(void) { /* 64 */
|
||||
static void TestEventCall(void) { /* 64 */
|
||||
DEBUG_COMMAND_YET("NIGHTDLL.TestEventCall:\n");
|
||||
}
|
||||
|
||||
void Test(void) { /* 65 */
|
||||
static void Test(void) { /* 65 */
|
||||
DEBUG_COMMAND_YET("NIGHTDLL.Test:\n");
|
||||
}
|
||||
|
||||
void DebugScenario(void) { /* 66 */
|
||||
static void DebugScenario(void) { /* 66 */
|
||||
DEBUG_COMMAND_YET("NIGHTDLL.DebugScenario:\n");
|
||||
}
|
||||
|
||||
void GetDLLTime(void) { /* 67 */
|
||||
static void GetDLLTime(void) { /* 67 */
|
||||
int *p1 = getCaliVariable();
|
||||
int *p2 = getCaliVariable();
|
||||
int *p3 = getCaliVariable();
|
||||
@@ -579,3 +580,75 @@ void GetDLLTime(void) { /* 67 */
|
||||
DEBUG_COMMAND_YET("NIGHTDLL.GetDLLTime %p,%p,%p,%p,%p,%p,%p:\n", p1, p2, p3, p4, p5, p6, p7);
|
||||
}
|
||||
|
||||
static const ModuleFunc functions[] = {
|
||||
{"AddFeeling", AddFeeling},
|
||||
{"AnalyzeMessage", AnalyzeMessage},
|
||||
{"CDMute", CDMute},
|
||||
{"CDPlay", CDPlay},
|
||||
{"CDStop", CDStop},
|
||||
{"CallEvent", CallEvent},
|
||||
{"CheckNewGame", CheckNewGame},
|
||||
{"DebugScenario", DebugScenario},
|
||||
{"Draw", Draw},
|
||||
{"ExistSaveData", ExistSaveData},
|
||||
{"ExistStartData", ExistStartData},
|
||||
{"GetDLLTime", GetDLLTime},
|
||||
{"GetDate", GetDate},
|
||||
{"GetEventFlagTotal", GetEventFlagTotal},
|
||||
{"GetLocalCountCG", GetLocalCountCG},
|
||||
{"GetPlayerName", GetPlayerName},
|
||||
{"Init", Init},
|
||||
{"InitGame", InitGame},
|
||||
{"LoadGame", LoadGame},
|
||||
{"PlayMemory", PlayMemory},
|
||||
{"PrintExitSystem", PrintExitSystem},
|
||||
{"RunBattleTest", RunBattleTest},
|
||||
{"RunEventBattle", RunEventBattle},
|
||||
{"RunEventDungeon", RunEventDungeon},
|
||||
{"RunGameMain", RunGameMain},
|
||||
{"RunMapEditor", RunMapEditor},
|
||||
{"RunSoundMode", RunSoundMode},
|
||||
{"RunTrainingTest", RunTrainingTest},
|
||||
{"SaveGame", SaveGame},
|
||||
{"SaveStartData", SaveStartData},
|
||||
{"ScreenCG", ScreenCG},
|
||||
{"SelectGameLevel", SelectGameLevel},
|
||||
{"SetAreaData", SetAreaData},
|
||||
{"SetCalendar", SetCalendar},
|
||||
{"SetDate", SetDate},
|
||||
{"SetDrawTime", SetDrawTime},
|
||||
{"SetFace", SetFace},
|
||||
{"SetFont", SetFont},
|
||||
{"SetFontSize", SetFontSize},
|
||||
{"SetMsgClearEffect", SetMsgClearEffect},
|
||||
{"SetMsgDrawEffect", SetMsgDrawEffect},
|
||||
{"SetMsgFrame", SetMsgFrame},
|
||||
{"SetMsgPlaceMethod", SetMsgPlaceMethod},
|
||||
{"SetPlayerName", SetPlayerName},
|
||||
{"SetScenery", SetScenery},
|
||||
{"SetSelMode", SetSelMode},
|
||||
{"SetSpriteL", SetSpriteL},
|
||||
{"SetSpriteM", SetSpriteM},
|
||||
{"SetSpriteR", SetSpriteR},
|
||||
{"SetSpriteSeasonL", SetSpriteSeasonL},
|
||||
{"SetSpriteSeasonM", SetSpriteSeasonM},
|
||||
{"SetSpriteSeasonR", SetSpriteSeasonR},
|
||||
{"SetVoice", SetVoice},
|
||||
{"SetWallPaper", SetWallPaper},
|
||||
{"SoundEffectPlay", SoundEffectPlay},
|
||||
{"SoundEffectSetLoop", SoundEffectSetLoop},
|
||||
{"SoundEffectSetSyncFlag", SoundEffectSetSyncFlag},
|
||||
{"SoundEffectSetVolume", SoundEffectSetVolume},
|
||||
{"SoundEffectSetWave", SoundEffectSetWave},
|
||||
{"SoundEffectStop", SoundEffectStop},
|
||||
{"SoundEffectStopAll", SoundEffectStopAll},
|
||||
{"StartNewLine", StartNewLine},
|
||||
{"SubFeeling", SubFeeling},
|
||||
{"Test", Test},
|
||||
{"TestEventCall", TestEventCall},
|
||||
{"VisualListAdd", VisualListAdd},
|
||||
{"VisualListClear", VisualListClear},
|
||||
{"WaitKey", WaitKey},
|
||||
};
|
||||
|
||||
const Module module_NIGHTDLL = {"NIGHTDLL", functions, sizeof(functions) / sizeof(ModuleFunc)};
|
||||
|
||||
+34
-36
@@ -39,8 +39,8 @@ void nt_gr_set_wallpaper(int no) {
|
||||
sprite_t *sp = night.sp[SPNO_WALL];
|
||||
|
||||
if (sp) {
|
||||
sp_remove_updatelist(sp);
|
||||
sp_free(sp);
|
||||
nt_sp_remove_updatelist(sp);
|
||||
nt_sp_free(sp);
|
||||
}
|
||||
|
||||
if (no == 1013 && nt_sco_is_natsu()) {
|
||||
@@ -51,12 +51,12 @@ void nt_gr_set_wallpaper(int no) {
|
||||
no = 1012;
|
||||
}
|
||||
|
||||
sp = sp_new(SPNO_WALL, no, 0, 0, SPRITE_WP);
|
||||
sp_add_updatelist(sp);
|
||||
sp = nt_sp_new(SPNO_WALL, no, 0, 0, SPRITE_WP);
|
||||
nt_sp_add_updatelist(sp);
|
||||
if (no == 0) {
|
||||
sp->cursize.width = sf0->width;
|
||||
sp->cursize.height = sf0->height;
|
||||
sp->update = sp_draw_wall;
|
||||
sp->update = nt_sp_draw_wall;
|
||||
}
|
||||
|
||||
night.sp[SPNO_WALL] = sp;
|
||||
@@ -66,15 +66,15 @@ void nt_gr_set_scenery(int no) {
|
||||
sprite_t *sp = night.sp[SPNO_SCENERY];
|
||||
|
||||
if (sp) {
|
||||
sp_remove_updatelist(sp);
|
||||
sp_free(sp);
|
||||
nt_sp_remove_updatelist(sp);
|
||||
nt_sp_free(sp);
|
||||
sp = NULL;
|
||||
}
|
||||
|
||||
if (no) {
|
||||
sp = sp_new(SPNO_SCENERY, no, 0, 0, SPRITE_NORMAL);
|
||||
sp_add_updatelist(sp);
|
||||
sp_set_loc(sp, SCENERY_LOC_X, SCENERY_LOC_Y);
|
||||
sp = nt_sp_new(SPNO_SCENERY, no, 0, 0, SPRITE_NORMAL);
|
||||
nt_sp_add_updatelist(sp);
|
||||
nt_sp_set_loc(sp, SCENERY_LOC_X, SCENERY_LOC_Y);
|
||||
}
|
||||
|
||||
night.sp[SPNO_SCENERY] = sp;
|
||||
@@ -84,14 +84,14 @@ void nt_gr_set_face(int no) {
|
||||
sprite_t *sp = night.sp[SPNO_FACE];
|
||||
|
||||
if (sp) {
|
||||
sp_remove_updatelist(sp);
|
||||
sp_free(sp);
|
||||
nt_sp_remove_updatelist(sp);
|
||||
nt_sp_free(sp);
|
||||
sp = NULL;
|
||||
}
|
||||
if (no) {
|
||||
sp = sp_new(SPNO_FACE, no, 0, 0, SPRITE_NORMAL);
|
||||
sp_add_updatelist(sp);
|
||||
sp_set_loc(sp, FACE_LOC_X, FACE_LOC_Y);
|
||||
sp = nt_sp_new(SPNO_FACE, no, 0, 0, SPRITE_NORMAL);
|
||||
nt_sp_add_updatelist(sp);
|
||||
nt_sp_set_loc(sp, FACE_LOC_X, FACE_LOC_Y);
|
||||
night.msgplace = 2;
|
||||
} else {
|
||||
night.msgplace = 0;
|
||||
@@ -103,14 +103,14 @@ void nt_gr_set_spL(int no) {
|
||||
sprite_t *sp = night.sp[SPNO_TACHI_L];
|
||||
|
||||
if (sp) {
|
||||
sp_remove_updatelist(sp);
|
||||
sp_free(sp);
|
||||
nt_sp_remove_updatelist(sp);
|
||||
nt_sp_free(sp);
|
||||
sp = NULL;
|
||||
}
|
||||
if (no) {
|
||||
sp = sp_new(SPNO_TACHI_L, no, 0, 0, SPRITE_NORMAL);
|
||||
sp_add_updatelist(sp);
|
||||
sp_set_loc(sp, TACHI_L_LOC_X, TACHI_L_LOC_Y);
|
||||
sp = nt_sp_new(SPNO_TACHI_L, no, 0, 0, SPRITE_NORMAL);
|
||||
nt_sp_add_updatelist(sp);
|
||||
nt_sp_set_loc(sp, TACHI_L_LOC_X, TACHI_L_LOC_Y);
|
||||
}
|
||||
night.sp[SPNO_TACHI_L] = sp;
|
||||
}
|
||||
@@ -119,14 +119,14 @@ void nt_gr_set_spM(int no) {
|
||||
sprite_t *sp = night.sp[SPNO_TACHI_M];
|
||||
|
||||
if (sp) {
|
||||
sp_remove_updatelist(sp);
|
||||
sp_free(sp);
|
||||
nt_sp_remove_updatelist(sp);
|
||||
nt_sp_free(sp);
|
||||
sp = NULL;
|
||||
}
|
||||
if (no) {
|
||||
sp = sp_new(SPNO_TACHI_M, no, 0, 0, SPRITE_NORMAL);
|
||||
sp_add_updatelist(sp);
|
||||
sp_set_loc(sp, TACHI_M_LOC_X, TACHI_M_LOC_Y);
|
||||
sp = nt_sp_new(SPNO_TACHI_M, no, 0, 0, SPRITE_NORMAL);
|
||||
nt_sp_add_updatelist(sp);
|
||||
nt_sp_set_loc(sp, TACHI_M_LOC_X, TACHI_M_LOC_Y);
|
||||
}
|
||||
night.sp[SPNO_TACHI_M] = sp;
|
||||
}
|
||||
@@ -135,14 +135,14 @@ void nt_gr_set_spR(int no) {
|
||||
sprite_t *sp = night.sp[SPNO_TACHI_R];
|
||||
|
||||
if (sp) {
|
||||
sp_remove_updatelist(sp);
|
||||
sp_free(sp);
|
||||
nt_sp_remove_updatelist(sp);
|
||||
nt_sp_free(sp);
|
||||
sp = NULL;
|
||||
}
|
||||
if (no) {
|
||||
sp = sp_new(SPNO_TACHI_R, no, 0, 0, SPRITE_NORMAL);
|
||||
sp_add_updatelist(sp);
|
||||
sp_set_loc(sp, TACHI_R_LOC_X, TACHI_R_LOC_Y);
|
||||
sp = nt_sp_new(SPNO_TACHI_R, no, 0, 0, SPRITE_NORMAL);
|
||||
nt_sp_add_updatelist(sp);
|
||||
nt_sp_set_loc(sp, TACHI_R_LOC_X, TACHI_R_LOC_Y);
|
||||
}
|
||||
night.sp[SPNO_TACHI_R] = sp;
|
||||
}
|
||||
@@ -178,23 +178,21 @@ void nt_gr_draw(int effectno) {
|
||||
// 全消し
|
||||
break;
|
||||
case 1:
|
||||
sp_update_all(TRUE);
|
||||
nt_sp_update_all(TRUE);
|
||||
break;
|
||||
default:
|
||||
if (night.waitskiplv > 1) {
|
||||
sp_update_all(TRUE);
|
||||
nt_sp_update_all(TRUE);
|
||||
break;
|
||||
}
|
||||
//sp_eupdate(effectno, effecttime, TRUE);
|
||||
sp_eupdate(effectno, 1000, TRUE);
|
||||
//nt_sp_eupdate(effectno, effecttime, TRUE);
|
||||
nt_sp_eupdate(effectno, 1000, TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
void nt_gr_screencg(int no, int x, int y) {
|
||||
surface_t *sf;
|
||||
|
||||
ags_sync();
|
||||
|
||||
sf = sf_loadcg_no(no -1);
|
||||
|
||||
gre_BlendScreen(sf0, x, y, sf0, x, y, sf, 0, 0, sf->width, sf->height);
|
||||
|
||||
+48
-58
@@ -17,12 +17,14 @@
|
||||
#include "nt_msg.h"
|
||||
#include "sprite.h"
|
||||
#include "sactcg.h"
|
||||
#include "sjisname.h"
|
||||
#include "sactstring.h"
|
||||
|
||||
|
||||
extern int ntsel_dosel(void);
|
||||
|
||||
#define SNAME_RYO "亮 "
|
||||
#define SNAME_RYO_DEF "亮"
|
||||
|
||||
// 通常メッセージ表示位置と大きさ
|
||||
#define MSGFRAME_0_X 6
|
||||
#define MSGFRAME_0_Y 347
|
||||
@@ -67,34 +69,34 @@ void ntmsg_init() {
|
||||
sprite_t *sp;
|
||||
|
||||
// メッセージスプライト
|
||||
sp = night.sp[SPNO_MSGFRAME_FG] = sp_msg_new(SPNO_MSGFRAME_FG, 0, 0, sf0->width, sf0->height);
|
||||
sp_add_updatelist(sp);
|
||||
sp = night.sp[SPNO_MSGFRAME_FG] = nt_sp_msg_new(SPNO_MSGFRAME_FG, 0, 0, sf0->width, sf0->height);
|
||||
nt_sp_add_updatelist(sp);
|
||||
|
||||
// メッセージ背景用CG
|
||||
sp = night.sp[SPNO_MSGFRAME_BG] = sp_new(SPNO_MSGFRAME_BG, CGNO_MSGFRAME_LCG, 0, 0, SPRITE_NORMAL);
|
||||
sp_add_updatelist(sp);
|
||||
sp = night.sp[SPNO_MSGFRAME_BG] = nt_sp_new(SPNO_MSGFRAME_BG, CGNO_MSGFRAME_LCG, 0, 0, SPRITE_NORMAL);
|
||||
nt_sp_add_updatelist(sp);
|
||||
|
||||
// 文字背景CG作成
|
||||
scg_create(CGNO_MSGFR_BG,
|
||||
nt_scg_create(CGNO_MSGFR_BG,
|
||||
sf0->width, sf0->height,
|
||||
0, 0, 0, 255);
|
||||
// night.cg[CGNO_MSGFR_BG]->refcnt++;
|
||||
|
||||
// 文字背景CGのためのsprite
|
||||
sp = night.sp[SPNO_MSGBG] = sp_new(SPNO_MSGBG, CGNO_MSGFR_BG, 0, 0, SPRITE_NORMAL);
|
||||
sp_add_updatelist(sp);
|
||||
sp = night.sp[SPNO_MSGBG] = nt_sp_new(SPNO_MSGBG, CGNO_MSGFR_BG, 0, 0, SPRITE_NORMAL);
|
||||
nt_sp_add_updatelist(sp);
|
||||
|
||||
// キー入力アニメーションCG作成
|
||||
scg_cut(CGNO_MSGHAK_1, CGNO_MSGHAK_LCG, 0, 0, 9, 9);
|
||||
nt_scg_cut(CGNO_MSGHAK_1, CGNO_MSGHAK_LCG, 0, 0, 9, 9);
|
||||
//night.cg[CGNO_MSGHAK_1]->refcnt++;
|
||||
scg_cut(CGNO_MSGHAK_2, CGNO_MSGHAK_LCG, 0, 9, 9, 9);
|
||||
nt_scg_cut(CGNO_MSGHAK_2, CGNO_MSGHAK_LCG, 0, 9, 9, 9);
|
||||
//night.cg[CGNO_MSGHAK_2]->refcnt++;
|
||||
sp = night.sp[SPNO_MSG_KEYANIM] = sp_new(SPNO_MSG_KEYANIM, CGNO_MSGHAK_1, CGNO_MSGHAK_2, 0, SPRITE_ANIME);
|
||||
sp = night.sp[SPNO_MSG_KEYANIM] = nt_sp_new(SPNO_MSG_KEYANIM, CGNO_MSGHAK_1, CGNO_MSGHAK_2, 0, SPRITE_ANIME);
|
||||
sp->u.anime.interval = HAKANIM_INTERVAL;
|
||||
sp_add_updatelist(sp);
|
||||
sp_set_loc(sp, HAKANIM_LOC_X, HAKANIM_LOC_Y);
|
||||
sp_set_show(sp, FALSE);
|
||||
sp->update = sp_draw_scg;
|
||||
nt_sp_add_updatelist(sp);
|
||||
nt_sp_set_loc(sp, HAKANIM_LOC_X, HAKANIM_LOC_Y);
|
||||
nt_sp_set_show(sp, FALSE);
|
||||
sp->update = nt_sp_draw_scg;
|
||||
|
||||
|
||||
|
||||
@@ -102,7 +104,7 @@ void ntmsg_init() {
|
||||
|
||||
|
||||
// 主人公名前
|
||||
sstr_regist_replace(SNAME_RYO, SNAME_RYO_DEF);
|
||||
nt_sstr_regist_replace(fromUTF8(SNAME_RYO), fromUTF8(SNAME_RYO_DEF));
|
||||
|
||||
night.msg.cbmove = cb_mousemove;
|
||||
night.msg.cbrelease = cb_keyrelease;
|
||||
@@ -129,14 +131,14 @@ void ntmsg_set_frame(int type) {
|
||||
|
||||
switch(type) {
|
||||
case 0:
|
||||
sp_set_show(night.sp[SPNO_MSGBG], FALSE);
|
||||
sp_set_show(night.sp[SPNO_MSGFRAME_BG], FALSE);
|
||||
sp_set_show(night.sp[SPNO_MSGFRAME_FG], FALSE);
|
||||
nt_sp_set_show(night.sp[SPNO_MSGBG], FALSE);
|
||||
nt_sp_set_show(night.sp[SPNO_MSGFRAME_BG], FALSE);
|
||||
nt_sp_set_show(night.sp[SPNO_MSGFRAME_FG], FALSE);
|
||||
break;
|
||||
case 1:
|
||||
sp_set_show(night.sp[SPNO_MSGBG], TRUE);
|
||||
sp_set_show(night.sp[SPNO_MSGFRAME_BG], TRUE);
|
||||
sp_set_show(night.sp[SPNO_MSGFRAME_FG], TRUE);
|
||||
nt_sp_set_show(night.sp[SPNO_MSGBG], TRUE);
|
||||
nt_sp_set_show(night.sp[SPNO_MSGFRAME_BG], TRUE);
|
||||
nt_sp_set_show(night.sp[SPNO_MSGFRAME_FG], TRUE);
|
||||
|
||||
gr_fill(sf, MSGFRAME_0_X, MSGFRAME_0_Y,
|
||||
MSGFRAME_0_WIDTH, MSGFRAME_0_HEIGHT,
|
||||
@@ -144,12 +146,12 @@ void ntmsg_set_frame(int type) {
|
||||
gr_fill_alpha_map(sf, MSGFRAME_0_X, MSGFRAME_0_Y,
|
||||
MSGFRAME_0_WIDTH, MSGFRAME_0_HEIGHT, 192);
|
||||
ntmsg_clear(SPNO_MSGFRAME_FG);
|
||||
sp_update_all(TRUE);
|
||||
nt_sp_update_all(TRUE);
|
||||
break;
|
||||
case 2:
|
||||
sp_set_show(night.sp[SPNO_MSGBG], TRUE);
|
||||
sp_set_show(night.sp[SPNO_MSGFRAME_BG], FALSE);
|
||||
sp_set_show(night.sp[SPNO_MSGFRAME_FG], TRUE);
|
||||
nt_sp_set_show(night.sp[SPNO_MSGBG], TRUE);
|
||||
nt_sp_set_show(night.sp[SPNO_MSGFRAME_BG], FALSE);
|
||||
nt_sp_set_show(night.sp[SPNO_MSGFRAME_FG], TRUE);
|
||||
|
||||
gr_fill(sf, MSGFRAME_1_X, MSGFRAME_1_Y,
|
||||
MSGFRAME_1_WIDTH, MSGFRAME_1_HEIGHT,
|
||||
@@ -157,7 +159,7 @@ void ntmsg_set_frame(int type) {
|
||||
gr_fill_alpha_map(sf, MSGFRAME_1_X, MSGFRAME_1_Y,
|
||||
MSGFRAME_1_WIDTH, MSGFRAME_1_HEIGHT, 128);
|
||||
ntmsg_clear(SPNO_MSGFRAME_FG);
|
||||
sp_update_all(TRUE);
|
||||
nt_sp_update_all(TRUE);
|
||||
|
||||
break;
|
||||
}
|
||||
@@ -179,19 +181,13 @@ void ntmsg_newline() {
|
||||
ntmsg_add(buf);
|
||||
}
|
||||
|
||||
void ntmsg_add(char *msg) {
|
||||
void ntmsg_add(const char *msg) {
|
||||
int len;
|
||||
|
||||
WARNING("len = %d\n", strlen(msg));
|
||||
SACT_DEBUG("len = %d\n", strlen(msg));
|
||||
|
||||
if (msg[0] == '\0') return;
|
||||
|
||||
if (0) {
|
||||
char *b = sjis2lang(msg);
|
||||
fprintf(stderr, "add msg '%s'\n", b);
|
||||
free(b);
|
||||
}
|
||||
|
||||
len = MSGBUFMAX - (int)strlen(night.msgbuf);
|
||||
if (len < 0) {
|
||||
WARNING("buf shortage (%d)\n", len);
|
||||
@@ -210,12 +206,12 @@ int ntmsg_ana(void) {
|
||||
} else {
|
||||
// msg newpage
|
||||
ntmsg_out(SPNO_MSGFRAME_FG, night.fontsize, 255, 255, 255, night.fonttype, 0, 2);
|
||||
sp_update_clipped();
|
||||
nt_sp_update_clipped();
|
||||
ret = ntmsg_keywait();
|
||||
|
||||
// clear msgsprite
|
||||
ntmsg_clear(SPNO_MSGFRAME_FG);
|
||||
//sp_update_clipped();
|
||||
//nt_sp_update_clipped();
|
||||
}
|
||||
|
||||
night.selmode = -1;
|
||||
@@ -234,7 +230,7 @@ static void ntmsg_out(int wNum, int wSize, int wColorR, int wColorG, int wColorB
|
||||
// shortcut
|
||||
sp = night.sp[wNum];
|
||||
|
||||
msg = sstr_replacestr(night.msgbuf);
|
||||
msg = nt_sstr_replacestr(night.msgbuf);
|
||||
|
||||
// 文字アラインメントの調整
|
||||
set_align(msg, sp, wSize);
|
||||
@@ -258,12 +254,6 @@ static void ntmsg_out(int wNum, int wSize, int wColorR, int wColorG, int wColorB
|
||||
|
||||
dt_setfont(wFont, wSize);
|
||||
|
||||
if (1) {
|
||||
char *b = sjis2lang(mbuf);
|
||||
fprintf(stderr, "msg '%s'\n", b);
|
||||
free(b);
|
||||
}
|
||||
|
||||
cw = dt_drawtext_col(sp->u.msg.canvas,
|
||||
sp->u.msg.dspcur.x,
|
||||
sp->u.msg.dspcur.y,
|
||||
@@ -273,18 +263,18 @@ static void ntmsg_out(int wNum, int wSize, int wColorR, int wColorG, int wColorB
|
||||
needupdate = TRUE;
|
||||
|
||||
if (wSpeed > 0) {
|
||||
sp_updateme_part(sp,
|
||||
nt_sp_updateme_part(sp,
|
||||
sp->u.msg.dspcur.x,
|
||||
sp->u.msg.dspcur.y,
|
||||
cw,
|
||||
wSize);
|
||||
sp_update_clipped();
|
||||
nt_sp_update_clipped();
|
||||
needupdate = FALSE;
|
||||
|
||||
// keywait
|
||||
delta = get_high_counter(SYSTEMCOUNTER_MSEC) - wcnt;
|
||||
if (delta < wSpeed) {
|
||||
if (sys_keywait(wSpeed - delta, FALSE)) {
|
||||
if (sys_keywait(wSpeed - delta, KEYWAIT_NONCANCELABLE)) {
|
||||
|
||||
wSpeed = 0;
|
||||
}
|
||||
@@ -299,9 +289,9 @@ static void ntmsg_out(int wNum, int wSize, int wColorR, int wColorG, int wColorB
|
||||
|
||||
// Waitなしの出力は最後にupdate
|
||||
if (needupdate) {
|
||||
uparea.width = sp->cursize.width;
|
||||
uparea.height = min(sp->cursize.height, uparea.y - sp->u.msg.dspcur.y + wLineSpace + wLineSpace);
|
||||
sp_updateme_part(sp, uparea.x, uparea.y, uparea.width, uparea.height);
|
||||
uparea.w = sp->cursize.width;
|
||||
uparea.h = min(sp->cursize.height, uparea.y - sp->u.msg.dspcur.y + wLineSpace + wLineSpace);
|
||||
nt_sp_updateme_part(sp, uparea.x, uparea.y, uparea.w, uparea.h);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -322,7 +312,7 @@ static int ntmsg_keywait() {
|
||||
night.waittype = KEYWAIT_MESSAGE;
|
||||
night.waitkey = -1;
|
||||
|
||||
while (night.waitkey == -1) {
|
||||
while (night.waitkey == -1 && !nact->is_quit) {
|
||||
int st = get_high_counter(SYSTEMCOUNTER_MSEC);
|
||||
int interval = 25;
|
||||
|
||||
@@ -330,7 +320,7 @@ static int ntmsg_keywait() {
|
||||
interval = night.sp[SPNO_MSG_KEYANIM]->u.anime.interval;
|
||||
hakanim(i++);
|
||||
}
|
||||
sys_keywait(interval - (get_high_counter(SYSTEMCOUNTER_MSEC) - st), FALSE);
|
||||
sys_keywait(interval - (get_high_counter(SYSTEMCOUNTER_MSEC) - st), KEYWAIT_NONCANCELABLE);
|
||||
}
|
||||
|
||||
night.waittype = KEYWAIT_NONE;
|
||||
@@ -455,8 +445,8 @@ static void hakanim(int i) {
|
||||
sp->curcg = sp->cg2;
|
||||
}
|
||||
sp->show = TRUE;
|
||||
sp_updateme(sp);
|
||||
sp_update_clipped();
|
||||
nt_sp_updateme(sp);
|
||||
nt_sp_update_clipped();
|
||||
|
||||
sp->show = show;
|
||||
}
|
||||
@@ -469,8 +459,8 @@ int ntmsg_update(sprite_t *sp, MyRectangle *r) {
|
||||
// -> 説明スプライトのように、SetShowされたときに対応できないからだめ
|
||||
//if (sact.msgbufempty) return OK;
|
||||
|
||||
update.width = r->width;
|
||||
update.height = r->height;
|
||||
update.width = r->w;
|
||||
update.height = r->h;
|
||||
|
||||
dx = sp->cur.x - r->x;
|
||||
dy = sp->cur.y - r->y;
|
||||
@@ -489,7 +479,7 @@ int ntmsg_update(sprite_t *sp, MyRectangle *r) {
|
||||
|
||||
gre_BlendUseAMap(sf0, dx, dy, sf0, dx, dy, sp->u.msg.canvas, sx, sy, w, h, sp->u.msg.canvas, sx, sy, sp->blendrate);
|
||||
|
||||
WARNING("do update no=%d, sx=%d, sy=%d, w=%d, h=%d, dx=%d, dy=%d\n",
|
||||
SACT_DEBUG("do update no=%d, sx=%d, sy=%d, w=%d, h=%d, dx=%d, dy=%d\n",
|
||||
sp->no, sx, sy, w, h, dx, dy);
|
||||
|
||||
return OK;
|
||||
@@ -509,5 +499,5 @@ static void ntmsg_clear(int wNum) {
|
||||
memset(sf->pixel, 0, sf->bytes_per_line * sf->height);
|
||||
memset(sf->alpha, 0, sf->width * sf->height);
|
||||
|
||||
sp_updateme(sp);
|
||||
nt_sp_updateme(sp);
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ extern void ntmsg_init();
|
||||
extern void ntmsg_set_frame(int type);
|
||||
extern void ntmsg_set_place(int type);
|
||||
extern void ntmsg_newline();
|
||||
extern void ntmsg_add(char *msg);
|
||||
extern void ntmsg_add(const char *msg);
|
||||
extern int ntmsg_ana(void);
|
||||
extern int ntmsg_update(sprite_t *sp, MyRectangle *r);
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
#include "system.h"
|
||||
#include "counter.h"
|
||||
#include "input.h"
|
||||
#include "sdl_core.h"
|
||||
#include "xsystem35.h"
|
||||
#include "nact.h"
|
||||
#include "scenario.h"
|
||||
@@ -16,9 +17,6 @@
|
||||
#include "night.h"
|
||||
#include "nt_msg.h"
|
||||
|
||||
/* defined by cmd_check.c */
|
||||
extern void check_command(int c0);
|
||||
|
||||
#define MAINLOOP_EVENTCHECK_INTERVAL 16 /* 16 msec */
|
||||
|
||||
|
||||
@@ -33,7 +31,7 @@ static struct _scoadr scene2adr(int no) {
|
||||
struct _scoadr adr = {0, 0};
|
||||
|
||||
snprintf(label, 7, "E%05d", no);
|
||||
WARNING("seaching %6s\n", label);
|
||||
SACT_DEBUG("seaching %6s\n", label);
|
||||
for (i = 0; i < nact->ain.fncnum; i++) {
|
||||
if (0 == strncmp(nact->ain.fnc[i].name, label, 6)) {
|
||||
adr.page = nact->ain.fnc[i].page;
|
||||
@@ -56,10 +54,9 @@ static void ntmain(struct _scoadr inadr) {
|
||||
|
||||
while (!nact->is_quit) {
|
||||
for (int cnt = 0; !nact->wait_vsync && cnt < 10000; cnt++) {
|
||||
DEBUG_MESSAGE("%d:%x\n", sl_getPage(), sl_getIndex());
|
||||
//WARNING("%d:%x\n", sl_getPage(), sl_getIndex());
|
||||
//SACT_DEBUG("%d:%x\n", sl_getPage(), sl_getIndex());
|
||||
if (!nact->popupmenu_opened) {
|
||||
check_command(sl_getc());
|
||||
exec_command();
|
||||
if (sl_getPage() == inadr.page &&
|
||||
sl_getIndex() == inadr.index) {
|
||||
// ~E%05dからの戻り
|
||||
@@ -77,7 +74,7 @@ static void ntmain(struct _scoadr inadr) {
|
||||
if (!nact->is_message_locked) {
|
||||
sys_getInputInfo();
|
||||
}
|
||||
WaitVsync();
|
||||
sdl_wait_vsync();
|
||||
nact->frame_count++;
|
||||
nact->wait_vsync = FALSE;
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
int ntsel_dosel(int mode) {
|
||||
int ntsel_dosel(void) {
|
||||
// 選択肢を描画
|
||||
//
|
||||
return 0;
|
||||
|
||||
+46
-60
@@ -30,7 +30,6 @@
|
||||
#include "portab.h"
|
||||
#include "nact.h"
|
||||
#include "system.h"
|
||||
#include "utfsjis.h"
|
||||
#include "ags.h"
|
||||
#include "surface.h"
|
||||
#include "ngraph.h"
|
||||
@@ -61,7 +60,7 @@ static cginfo_t *cgs[CGMAX];
|
||||
spriteから参照されるときは増やし、CG_xxxを作る時に
|
||||
参照されるときは増やさない。
|
||||
*/
|
||||
cginfo_t *scg_loadcg_no(int no, boolean refinc) {
|
||||
cginfo_t *nt_scg_loadcg_no(int no, boolean refinc) {
|
||||
cginfo_t *i;
|
||||
|
||||
if (no >= (CGMAX -1)) {
|
||||
@@ -95,7 +94,7 @@ cginfo_t *scg_loadcg_no(int no, boolean refinc) {
|
||||
}
|
||||
|
||||
// 指定の大きさ、色の矩形の CG を作成
|
||||
int scg_create(int wNumCG, int wWidth, int wHeight, int wR, int wG, int wB, int wBlendRate) {
|
||||
int nt_scg_create(int wNumCG, int wWidth, int wHeight, int wR, int wG, int wB, int wBlendRate) {
|
||||
cginfo_t *i;
|
||||
|
||||
spcg_assert_no(wNumCG);
|
||||
@@ -109,7 +108,7 @@ int scg_create(int wNumCG, int wWidth, int wHeight, int wR, int wG, int wB, int
|
||||
gr_fill_alpha_map(i->sf, 0, 0, wWidth, wHeight, wBlendRate);
|
||||
|
||||
// もし前に作成したものがあり、未開放の場合は開放
|
||||
scg_free(wNumCG);
|
||||
nt_scg_free(wNumCG);
|
||||
|
||||
cgs[wNumCG] = i;
|
||||
|
||||
@@ -117,7 +116,7 @@ int scg_create(int wNumCG, int wWidth, int wHeight, int wR, int wG, int wB, int
|
||||
}
|
||||
|
||||
// 指定のCGを反転させたCGを作成
|
||||
int scg_create_reverse(int wNumCG, int wNumSrcCG, int wReverseX, int wReverseY) {
|
||||
int nt_scg_create_reverse(int wNumCG, int wNumSrcCG, int wReverseX, int wReverseY) {
|
||||
cginfo_t *i, *srccg;
|
||||
surface_t *src;
|
||||
|
||||
@@ -125,7 +124,7 @@ int scg_create_reverse(int wNumCG, int wNumSrcCG, int wReverseX, int wReverseY)
|
||||
spcg_assert_no(wNumSrcCG);
|
||||
|
||||
// 元にするCGを参照 (LINKCGなら読み込み)
|
||||
if (NULL == (srccg = scg_loadcg_no(wNumSrcCG, FALSE))) {
|
||||
if (NULL == (srccg = nt_scg_loadcg_no(wNumSrcCG, FALSE))) {
|
||||
return NG;
|
||||
}
|
||||
|
||||
@@ -137,7 +136,7 @@ int scg_create_reverse(int wNumCG, int wNumSrcCG, int wReverseX, int wReverseY)
|
||||
src = srccg->sf;
|
||||
i->sf = stretch(src, src->width, src->height, (wReverseX << 1) | wReverseY);
|
||||
// もし前に作成したものがあり、未開放の場合は開放
|
||||
scg_free(wNumCG);
|
||||
nt_scg_free(wNumCG);
|
||||
|
||||
cgs[wNumCG] = i;
|
||||
|
||||
@@ -145,7 +144,7 @@ int scg_create_reverse(int wNumCG, int wNumSrcCG, int wReverseX, int wReverseY)
|
||||
}
|
||||
|
||||
// 指定のCGを拡大/縮小したCGを作成
|
||||
int scg_create_stretch(int wNumCG, int wWidth, int wHeight, int wNumSrcCG) {
|
||||
int nt_scg_create_stretch(int wNumCG, int wWidth, int wHeight, int wNumSrcCG) {
|
||||
cginfo_t *i, *srccg;
|
||||
surface_t *src;
|
||||
|
||||
@@ -153,7 +152,7 @@ int scg_create_stretch(int wNumCG, int wWidth, int wHeight, int wNumSrcCG) {
|
||||
spcg_assert_no(wNumSrcCG);
|
||||
|
||||
// 元にするCGを参照 (LINKCGなら読み込み)
|
||||
if (NULL == (srccg = scg_loadcg_no(wNumSrcCG, FALSE))) {
|
||||
if (NULL == (srccg = nt_scg_loadcg_no(wNumSrcCG, FALSE))) {
|
||||
return NG;
|
||||
}
|
||||
|
||||
@@ -166,7 +165,7 @@ int scg_create_stretch(int wNumCG, int wWidth, int wHeight, int wNumSrcCG) {
|
||||
i->sf = stretch(src, wWidth, wHeight, 0);
|
||||
|
||||
// もし前に作成したものがあり、未開放の場合は開放
|
||||
scg_free(wNumCG);
|
||||
nt_scg_free(wNumCG);
|
||||
|
||||
cgs[wNumCG] = i;
|
||||
|
||||
@@ -174,7 +173,7 @@ int scg_create_stretch(int wNumCG, int wWidth, int wHeight, int wNumSrcCG) {
|
||||
}
|
||||
|
||||
// ベースCGの上にブレンドCGを重ねた CG を作成
|
||||
int scg_create_blend(int wNumDstCG, int wNumBaseCG, int wX, int wY, int wNumBlendCG, int wAlphaMapMode) {
|
||||
int nt_scg_create_blend(int wNumDstCG, int wNumBaseCG, int wX, int wY, int wNumBlendCG, int wAlphaMapMode) {
|
||||
cginfo_t *i, *basecg, *blendcg;
|
||||
|
||||
spcg_assert_no(wNumDstCG);
|
||||
@@ -182,8 +181,8 @@ int scg_create_blend(int wNumDstCG, int wNumBaseCG, int wX, int wY, int wNumBlen
|
||||
spcg_assert_no(wNumBlendCG);
|
||||
|
||||
// 元にするCGを参照 (LINKCGなら読み込み)
|
||||
basecg = scg_loadcg_no(wNumBaseCG, FALSE);
|
||||
blendcg = scg_loadcg_no(wNumBlendCG, FALSE);
|
||||
basecg = nt_scg_loadcg_no(wNumBaseCG, FALSE);
|
||||
blendcg = nt_scg_loadcg_no(wNumBlendCG, FALSE);
|
||||
if (basecg == NULL || blendcg == NULL) return NG;
|
||||
|
||||
i = malloc(sizeof(cginfo_t));
|
||||
@@ -194,7 +193,7 @@ int scg_create_blend(int wNumDstCG, int wNumBaseCG, int wX, int wY, int wNumBlen
|
||||
i->sf = blend(basecg->sf, wX , wY, blendcg->sf, wAlphaMapMode);
|
||||
|
||||
// もし前に作成したものがあり、未開放の場合は開放
|
||||
scg_free(wNumDstCG);
|
||||
nt_scg_free(wNumDstCG);
|
||||
|
||||
cgs[wNumDstCG] = i;
|
||||
|
||||
@@ -202,26 +201,16 @@ int scg_create_blend(int wNumDstCG, int wNumBaseCG, int wX, int wY, int wNumBlen
|
||||
}
|
||||
|
||||
// 指定の文字列のCGを作成
|
||||
int scg_create_text(int wNumCG, int wSize, int wR, int wG, int wB, char *cText) {
|
||||
int nt_scg_create_text(int wNumCG, int wSize, int wR, int wG, int wB, char *cText) {
|
||||
cginfo_t *i;
|
||||
agsurface_t *glyph;
|
||||
FONT *font;
|
||||
|
||||
if (0) {
|
||||
char *b = sjis2lang(cText);
|
||||
WARNING("str = '%s'\n", b);
|
||||
free(b);
|
||||
}
|
||||
|
||||
spcg_assert_no(wNumCG);
|
||||
|
||||
// 勝手に出ていいのかな?
|
||||
if (strlen(cText) == 0) return OK;
|
||||
|
||||
font = nact->ags.font;
|
||||
font->sel_font(FONT_GOTHIC, wSize);
|
||||
|
||||
glyph = font->get_glyph(cText);
|
||||
ags_setFont(FONT_GOTHIC, wSize);
|
||||
agsurface_t *glyph = ags_drawStringToSurface(cText);
|
||||
i = malloc(sizeof(cginfo_t));
|
||||
i->type = CG_SET;
|
||||
i->no = wNumCG;
|
||||
@@ -232,7 +221,7 @@ int scg_create_text(int wNumCG, int wSize, int wR, int wG, int wB, char *cText)
|
||||
gr_draw_amap(i->sf, 0, 0, glyph->pixel, glyph->width, wSize, glyph->bytes_per_line);
|
||||
|
||||
// もし前に作成したものがあり、未開放の場合は開放
|
||||
scg_free(wNumCG);
|
||||
nt_scg_free(wNumCG);
|
||||
|
||||
cgs[wNumCG] = i;
|
||||
|
||||
@@ -240,10 +229,8 @@ int scg_create_text(int wNumCG, int wSize, int wR, int wG, int wB, char *cText)
|
||||
}
|
||||
|
||||
// 数字文字列のCGを作成
|
||||
int scg_create_textnum(int wNumCG, int wSize, int wR, int wG, int wB, int wFigs, int wZeroPadding, int wValue) {
|
||||
int nt_scg_create_textnum(int wNumCG, int wSize, int wR, int wG, int wB, int wFigs, int wZeroPadding, int wValue) {
|
||||
cginfo_t *i;
|
||||
agsurface_t *glyph;
|
||||
FONT *font;
|
||||
char s[256], ss[256];
|
||||
|
||||
spcg_assert_no(wNumCG);
|
||||
@@ -257,9 +244,8 @@ int scg_create_textnum(int wNumCG, int wSize, int wR, int wG, int wB, int wFigs,
|
||||
}
|
||||
sprintf(s, ss, wValue);
|
||||
|
||||
font = nact->ags.font;
|
||||
font->sel_font(FONT_GOTHIC, wSize);
|
||||
glyph = font->get_glyph(s);
|
||||
ags_setFont(FONT_GOTHIC, wSize);
|
||||
agsurface_t *glyph = ags_drawStringToSurface(s);
|
||||
|
||||
i = malloc(sizeof(cginfo_t));
|
||||
i->type = CG_SET;
|
||||
@@ -270,7 +256,7 @@ int scg_create_textnum(int wNumCG, int wSize, int wR, int wG, int wB, int wFigs,
|
||||
gr_draw_amap(i->sf, 0, 0, glyph->pixel, glyph->width, wSize, glyph->bytes_per_line);
|
||||
|
||||
// もし前に作成したものがあり、未開放の場合は開放
|
||||
scg_free(wNumCG);
|
||||
nt_scg_free(wNumCG);
|
||||
|
||||
cgs[wNumCG] = i;
|
||||
|
||||
@@ -278,14 +264,14 @@ int scg_create_textnum(int wNumCG, int wSize, int wR, int wG, int wB, int wFigs,
|
||||
}
|
||||
|
||||
// CGを複製
|
||||
int scg_copy(int wNumDstCG, int wNumSrcCG) {
|
||||
int nt_scg_copy(int wNumDstCG, int wNumSrcCG) {
|
||||
cginfo_t *i, *srccg;
|
||||
|
||||
spcg_assert_no(wNumDstCG);
|
||||
spcg_assert_no(wNumSrcCG);
|
||||
|
||||
// 元にするCGを参照 (LINKCGなら読み込み)
|
||||
if (NULL == (srccg = scg_loadcg_no(wNumSrcCG, FALSE))) {
|
||||
if (NULL == (srccg = nt_scg_loadcg_no(wNumSrcCG, FALSE))) {
|
||||
return NG;
|
||||
}
|
||||
|
||||
@@ -296,7 +282,7 @@ int scg_copy(int wNumDstCG, int wNumSrcCG) {
|
||||
i->sf = sf_dup(srccg->sf);
|
||||
|
||||
// もし前に作成したものがあり、未開放の場合は開放
|
||||
scg_free(wNumDstCG);
|
||||
nt_scg_free(wNumDstCG);
|
||||
|
||||
cgs[wNumDstCG] = i;
|
||||
|
||||
@@ -304,7 +290,7 @@ int scg_copy(int wNumDstCG, int wNumSrcCG) {
|
||||
}
|
||||
|
||||
// CGの一部を切りぬいたCGを作成
|
||||
int scg_cut(int wNumDstCG, int wNumSrcCG, int wX, int wY, int wWidth, int wHeight) {
|
||||
int nt_scg_cut(int wNumDstCG, int wNumSrcCG, int wX, int wY, int wWidth, int wHeight) {
|
||||
cginfo_t *i, *srccg;
|
||||
surface_t *dst, *src;
|
||||
|
||||
@@ -312,7 +298,7 @@ int scg_cut(int wNumDstCG, int wNumSrcCG, int wX, int wY, int wWidth, int wHeigh
|
||||
spcg_assert_no(wNumSrcCG);
|
||||
|
||||
// 元にするCGを参照 (LINKCGなら読み込み)
|
||||
if (NULL == (srccg = scg_loadcg_no(wNumSrcCG, FALSE))) {
|
||||
if (NULL == (srccg = nt_scg_loadcg_no(wNumSrcCG, FALSE))) {
|
||||
return NG;
|
||||
}
|
||||
|
||||
@@ -322,22 +308,22 @@ int scg_cut(int wNumDstCG, int wNumSrcCG, int wX, int wY, int wWidth, int wHeigh
|
||||
i->refcnt = 0;
|
||||
|
||||
src = srccg->sf;
|
||||
if (src->has_alpha) {
|
||||
if (src->alpha) {
|
||||
dst = sf_create_surface(wWidth, wHeight, src->depth);
|
||||
} else {
|
||||
dst = sf_create_pixel(wWidth, wHeight, src->depth);
|
||||
}
|
||||
if (src->has_pixel) {
|
||||
if (src->pixel) {
|
||||
gr_copy(dst, 0, 0, src, wX, wY, wWidth, wHeight);
|
||||
}
|
||||
if (src->has_alpha) {
|
||||
if (src->alpha) {
|
||||
gr_copy_alpha_map(dst, 0, 0, src, wX, wY, wWidth, wHeight);
|
||||
}
|
||||
|
||||
i->sf = dst;
|
||||
|
||||
// もし前に作成したものがあり、未開放の場合は開放
|
||||
scg_free(wNumDstCG);
|
||||
nt_scg_free(wNumDstCG);
|
||||
|
||||
cgs[wNumDstCG] = i;
|
||||
|
||||
@@ -345,7 +331,7 @@ int scg_cut(int wNumDstCG, int wNumSrcCG, int wX, int wY, int wWidth, int wHeigh
|
||||
}
|
||||
|
||||
// 元のCGの一部を切りぬいたCGを作成
|
||||
int scg_partcopy(int wNumDstCG, int wNumSrcCG, int wX, int wY, int wWidth, int wHeight) {
|
||||
int nt_scg_partcopy(int wNumDstCG, int wNumSrcCG, int wX, int wY, int wWidth, int wHeight) {
|
||||
cginfo_t *i, *srccg;
|
||||
surface_t *dst, *src;
|
||||
|
||||
@@ -353,7 +339,7 @@ int scg_partcopy(int wNumDstCG, int wNumSrcCG, int wX, int wY, int wWidth, int w
|
||||
spcg_assert_no(wNumSrcCG);
|
||||
|
||||
// 元にするCGを参照 (LINKCGなら読み込み)
|
||||
if (NULL == (srccg = scg_loadcg_no(wNumSrcCG, FALSE))) {
|
||||
if (NULL == (srccg = nt_scg_loadcg_no(wNumSrcCG, FALSE))) {
|
||||
return NG;
|
||||
}
|
||||
|
||||
@@ -363,24 +349,24 @@ int scg_partcopy(int wNumDstCG, int wNumSrcCG, int wX, int wY, int wWidth, int w
|
||||
i->refcnt = 0;
|
||||
|
||||
src = srccg->sf;
|
||||
if (src->has_alpha) {
|
||||
if (src->alpha) {
|
||||
dst = sf_create_surface(src->width, src->height, src->depth);
|
||||
gr_fill_alpha_map(dst, 0, 0, src->width, src->height, 255);
|
||||
} else {
|
||||
dst = sf_create_pixel(src->width, src->height, src->depth);
|
||||
}
|
||||
|
||||
if (src->has_pixel) {
|
||||
if (src->pixel) {
|
||||
gr_copy(dst, wX, wY, src, wX, wY, wWidth, wHeight);
|
||||
}
|
||||
if (src->has_alpha) {
|
||||
if (src->alpha) {
|
||||
gr_copy_alpha_map(dst, wX, wY, src, wX, wY, wWidth, wHeight);
|
||||
}
|
||||
|
||||
i->sf = dst;
|
||||
|
||||
// もし前に作成したものがあり、未開放の場合は開放
|
||||
scg_free(wNumDstCG);
|
||||
nt_scg_free(wNumDstCG);
|
||||
|
||||
cgs[wNumDstCG] = i;
|
||||
|
||||
@@ -388,11 +374,11 @@ int scg_partcopy(int wNumDstCG, int wNumSrcCG, int wX, int wY, int wWidth, int w
|
||||
}
|
||||
|
||||
// 全てのCGの開放
|
||||
int scg_freeall() {
|
||||
int nt_scg_freeall() {
|
||||
int i;
|
||||
|
||||
for (i = 1; i < CGMAX; i++) {
|
||||
scg_free(i);
|
||||
nt_scg_free(i);
|
||||
}
|
||||
return OK;
|
||||
}
|
||||
@@ -401,7 +387,7 @@ int scg_freeall() {
|
||||
* 指定の番号の CG をオブジェクトリストから消し、オブジェクトがどこからも参照
|
||||
* されていない(参照数が0の)場合のみ、オブジェクトを削除
|
||||
*/
|
||||
int scg_free(int no) {
|
||||
int nt_scg_free(int no) {
|
||||
cginfo_t *cg;
|
||||
|
||||
spcg_assert_no(no);
|
||||
@@ -410,7 +396,7 @@ int scg_free(int no) {
|
||||
|
||||
// 参照数が0の時のみオブジェクトを開放
|
||||
if (cg->refcnt == 0) {
|
||||
scg_free_cgobj(cg);
|
||||
nt_scg_free_cgobj(cg);
|
||||
}
|
||||
|
||||
// 番号で消したときはオブジェクトが開放されなくても
|
||||
@@ -423,7 +409,7 @@ int scg_free(int no) {
|
||||
/**
|
||||
* CG オブジェクトの開放
|
||||
*/
|
||||
int scg_free_cgobj(cginfo_t *cg) {
|
||||
int nt_scg_free_cgobj(cginfo_t *cg) {
|
||||
if (cg == NULL) return NG;
|
||||
|
||||
(cg->refcnt)--;
|
||||
@@ -448,7 +434,7 @@ int scg_free_cgobj(cginfo_t *cg) {
|
||||
}
|
||||
|
||||
// CGの種類を取得
|
||||
int scg_querytype(int wNumCG, int *ret) {
|
||||
int nt_scg_querytype(int wNumCG, int *ret) {
|
||||
if (wNumCG >= (CGMAX -1)) goto errexit;
|
||||
if (cgs[wNumCG] == NULL) goto errexit;
|
||||
|
||||
@@ -462,7 +448,7 @@ int scg_querytype(int wNumCG, int *ret) {
|
||||
}
|
||||
|
||||
// CGの大きさを取得
|
||||
int scg_querysize(int wNumCG, int *w, int *h) {
|
||||
int nt_scg_querysize(int wNumCG, int *w, int *h) {
|
||||
if (wNumCG >= (CGMAX -1)) goto errexit;
|
||||
if (cgs[wNumCG] == NULL) goto errexit;
|
||||
if (cgs[wNumCG]->sf == NULL) goto errexit;
|
||||
@@ -478,7 +464,7 @@ int scg_querysize(int wNumCG, int *w, int *h) {
|
||||
}
|
||||
|
||||
// CGのBPPを取得
|
||||
int scg_querybpp(int wNumCG, int *ret) {
|
||||
int nt_scg_querybpp(int wNumCG, int *ret) {
|
||||
if (wNumCG >= (CGMAX -1)) goto errexit;
|
||||
if (cgs[wNumCG] == NULL) goto errexit;
|
||||
if (cgs[wNumCG]->sf == NULL) goto errexit;
|
||||
@@ -493,12 +479,12 @@ int scg_querybpp(int wNumCG, int *ret) {
|
||||
}
|
||||
|
||||
// CGの alphamap が存在するかを取得
|
||||
int scg_existalphamap(int wNumCG, int *ret) {
|
||||
int nt_scg_existalphamap(int wNumCG, int *ret) {
|
||||
if (wNumCG >= (CGMAX -1)) goto errexit;
|
||||
if (cgs[wNumCG] == NULL) goto errexit;
|
||||
if (cgs[wNumCG]->sf == NULL) goto errexit;
|
||||
|
||||
*ret = cgs[wNumCG]->sf->has_alpha ? 1 : 0;
|
||||
*ret = cgs[wNumCG]->sf->alpha ? 1 : 0;
|
||||
|
||||
errexit:
|
||||
*ret = 0;
|
||||
|
||||
+18
-18
@@ -27,23 +27,23 @@
|
||||
#include "portab.h"
|
||||
#include "night.h"
|
||||
|
||||
extern cginfo_t *scg_loadcg_no(int no, boolean refinc);
|
||||
extern int scg_create(int wNumCG, int wWidth, int wHeight, int wR, int wG, int wB, int wBlendRate);
|
||||
extern int scg_create_reverse(int NumCG, int wNumSrcCG, int wReverseX, int wReverseY);
|
||||
extern int scg_create_stretch(int wNumCG, int wWidth, int wHeight, int wNumSrcCG);
|
||||
extern int scg_create_blend(int wNumDstCG, int wNumBaseCG, int wX, int wY, int wNumBlendCG, int wAlphaMapMode);
|
||||
extern int scg_create_text(int wNumCG, int wSize, int wR, int wG, int wB, char *cText);
|
||||
extern int scg_create_textnum(int wNumCG, int wSize, int wR, int wG, int wB, int wFigs, int wZeroPadding, int wValue);
|
||||
extern int scg_copy(int wNumDstCG, int wNumSrcCG);
|
||||
extern int scg_cut(int wNumDstCG, int wNumSrcCG, int wX, int wY, int wWidth, int wHeight);
|
||||
extern int scg_partcopy(int wNumDstCG, int wNumSrcCG, int wX, int wY, int wWidth, int wHeight);
|
||||
extern int scg_freeall();
|
||||
extern int scg_free(int cg);
|
||||
extern int scg_free_cgobj(cginfo_t *cg);
|
||||
extern int scg_querytype(int wNumCG, int *ret);
|
||||
extern int scg_querysize(int wNumCG, int *w, int *h);
|
||||
extern int scg_querybpp(int wNumCG, int *ret);
|
||||
extern int scg_existalphamap(int wNumCG, int *ret);
|
||||
extern int scg_linkcgfree(int no);
|
||||
extern cginfo_t *nt_scg_loadcg_no(int no, boolean refinc);
|
||||
extern int nt_scg_create(int wNumCG, int wWidth, int wHeight, int wR, int wG, int wB, int wBlendRate);
|
||||
extern int nt_scg_create_reverse(int NumCG, int wNumSrcCG, int wReverseX, int wReverseY);
|
||||
extern int nt_scg_create_stretch(int wNumCG, int wWidth, int wHeight, int wNumSrcCG);
|
||||
extern int nt_scg_create_blend(int wNumDstCG, int wNumBaseCG, int wX, int wY, int wNumBlendCG, int wAlphaMapMode);
|
||||
extern int nt_scg_create_text(int wNumCG, int wSize, int wR, int wG, int wB, char *cText);
|
||||
extern int nt_scg_create_textnum(int wNumCG, int wSize, int wR, int wG, int wB, int wFigs, int wZeroPadding, int wValue);
|
||||
extern int nt_scg_copy(int wNumDstCG, int wNumSrcCG);
|
||||
extern int nt_scg_cut(int wNumDstCG, int wNumSrcCG, int wX, int wY, int wWidth, int wHeight);
|
||||
extern int nt_scg_partcopy(int wNumDstCG, int wNumSrcCG, int wX, int wY, int wWidth, int wHeight);
|
||||
extern int nt_scg_freeall();
|
||||
extern int nt_scg_free(int cg);
|
||||
extern int nt_scg_free_cgobj(cginfo_t *cg);
|
||||
extern int nt_scg_querytype(int wNumCG, int *ret);
|
||||
extern int nt_scg_querysize(int wNumCG, int *w, int *h);
|
||||
extern int nt_scg_querybpp(int wNumCG, int *ret);
|
||||
extern int nt_scg_existalphamap(int wNumCG, int *ret);
|
||||
extern int nt_scg_linkcgfree(int no);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -4,7 +4,7 @@ static surface_t *blend(surface_t *base, int x, int y, surface_t *blend, int mod
|
||||
|
||||
gr_copy(dst, 0, 0, base, 0, 0, base->width, base->height);
|
||||
|
||||
if (base->has_alpha) {
|
||||
if (base->alpha) {
|
||||
// ベースに alpha map がある場合はそれをコピー
|
||||
gr_copy_alpha_map(dst, 0, 0, base, 0, 0, base->width, base->height);
|
||||
} else {
|
||||
@@ -12,7 +12,7 @@ static surface_t *blend(surface_t *base, int x, int y, surface_t *blend, int mod
|
||||
gr_fill_alpha_map(dst, 0, 0, base->width, base->height, 255);
|
||||
}
|
||||
|
||||
if (blend->has_alpha) {
|
||||
if (blend->alpha) {
|
||||
// 重ね合わせ先の alpha map があるときはそれを使う
|
||||
gre_BlendUseAMap(dst, x, y, base, x, y, blend, 0, 0, blend->width, blend->height, blend, 0, 0, 255);
|
||||
} else {
|
||||
|
||||
@@ -12,13 +12,11 @@ static surface_t *stretch(surface_t *src, int dw, int dh, int mirror) {
|
||||
dst->depth = src->depth;
|
||||
dst->bytes_per_line = dw * src->bytes_per_pixel;
|
||||
dst->bytes_per_pixel = src->bytes_per_pixel;
|
||||
dst->has_pixel = src->has_pixel;
|
||||
dst->has_alpha = src->has_alpha;
|
||||
|
||||
if (src->has_pixel) {
|
||||
if (src->pixel) {
|
||||
dst->pixel = malloc(dh * dst->bytes_per_line);
|
||||
}
|
||||
if (src->has_alpha) {
|
||||
if (src->alpha) {
|
||||
dst->alpha = malloc(dw * dh);
|
||||
}
|
||||
|
||||
@@ -78,7 +76,6 @@ static surface_t *stretch(surface_t *src, int dw, int dh, int mirror) {
|
||||
switch(dst->depth) {
|
||||
case 8:
|
||||
SCALEDCOPYAREA(BYTE); break;
|
||||
case 15:
|
||||
case 16:
|
||||
SCALEDCOPYAREA(WORD); break;
|
||||
case 24:
|
||||
@@ -88,7 +85,7 @@ static surface_t *stretch(surface_t *src, int dw, int dh, int mirror) {
|
||||
break;
|
||||
}
|
||||
|
||||
if (src->has_alpha) {
|
||||
if (src->alpha) {
|
||||
int x, y;
|
||||
BYTE *sl, *dl;
|
||||
BYTE *_sl, *_dl;
|
||||
|
||||
@@ -51,7 +51,7 @@ static char *replacedst;
|
||||
/**
|
||||
* 文字列変数スタックの初期化
|
||||
*/
|
||||
int sstr_init() {
|
||||
int nt_sstr_init() {
|
||||
stack = malloc(sizeof(char *) * DEFSTACKSIZE);
|
||||
idx = 0;
|
||||
idxmax = DEFSTACKSIZE;
|
||||
@@ -62,7 +62,7 @@ int sstr_init() {
|
||||
* 文字列変数スタックに文字列を積む
|
||||
* @param strno: シナリオ上での文字列変数番号
|
||||
*/
|
||||
int sstr_push(char *str) {
|
||||
int nt_sstr_push(char *str) {
|
||||
if (idx >= idxmax) {
|
||||
stack = realloc(stack, sizeof(char *) * idx*2);
|
||||
idxmax = idx*2;
|
||||
@@ -77,7 +77,7 @@ int sstr_push(char *str) {
|
||||
* 文字列変数スタックから文字列を取り出す
|
||||
* @param strno: スタックから戻した文字列を格納する文字列変数番号
|
||||
*/
|
||||
int sstr_pop(char *str, int maxlen) {
|
||||
int nt_sstr_pop(char *str, int maxlen) {
|
||||
if (idx == 0) return NG;
|
||||
|
||||
strncpy(str, stack[--idx], maxlen);
|
||||
@@ -91,14 +91,14 @@ int sstr_pop(char *str, int maxlen) {
|
||||
* @param sstrno: 変換元文字列変数番号
|
||||
* @param dstrno: 変換先文字列変数番号
|
||||
*/
|
||||
int sstr_regist_replace(char *sstr, char *dstr) {
|
||||
int nt_sstr_regist_replace(char *sstr, char *dstr) {
|
||||
strexchange_t *ex;
|
||||
|
||||
if (sstr == dstr) return NG;
|
||||
|
||||
ex = malloc(sizeof(strexchange_t));
|
||||
ex->src = strdup(sstr);
|
||||
ex->dst = strdup(dstr);
|
||||
ex->src = sstr;
|
||||
ex->dst = dstr;
|
||||
strreplace = slist_append(strreplace, ex);
|
||||
return OK;
|
||||
}
|
||||
@@ -106,7 +106,7 @@ int sstr_regist_replace(char *sstr, char *dstr) {
|
||||
/**
|
||||
* 数値 -> 文字列化
|
||||
*/
|
||||
int sstr_num2str(int strno, int fig, int nzeropad, int num) {
|
||||
int nt_sstr_num2str(int strno, int fig, int nzeropad, int num) {
|
||||
char s[256], ss[256];
|
||||
|
||||
if (nzeropad) {
|
||||
@@ -118,7 +118,7 @@ int sstr_num2str(int strno, int fig, int nzeropad, int num) {
|
||||
}
|
||||
|
||||
sprintf(s, ss, num);
|
||||
v_strcpy(strno -1, s);
|
||||
svar_set(strno, s);
|
||||
|
||||
return OK;
|
||||
}
|
||||
@@ -148,7 +148,7 @@ static void replacestr_cb(void* data, void* userdata) {
|
||||
}
|
||||
|
||||
// 文字列の置き換え
|
||||
char *sstr_replacestr(char *msg) {
|
||||
char *nt_sstr_replacestr(char *msg) {
|
||||
if (strreplace == NULL) return msg;
|
||||
|
||||
repbuf[0][0] = '\0';
|
||||
|
||||
@@ -24,12 +24,12 @@
|
||||
#ifndef __SACTSTRING_H__
|
||||
#define __SACTSTRING_H__
|
||||
|
||||
extern int sstr_init();
|
||||
extern int sstr_push(char *str);
|
||||
extern int sstr_pop(char *str, int maxlen);
|
||||
extern int sstr_regist_replace(char *sstr, char *dstr);
|
||||
extern int sstr_num2str(int strno, int fig, int nzeropad, int num);
|
||||
extern char *sstr_replacestr(char *msg);
|
||||
extern int nt_sstr_init();
|
||||
extern int nt_sstr_push(char *str);
|
||||
extern int nt_sstr_pop(char *str, int maxlen);
|
||||
extern int nt_sstr_regist_replace(char *sstr, char *dstr);
|
||||
extern int nt_sstr_num2str(int strno, int fig, int nzeropad, int num);
|
||||
extern char *nt_sstr_replacestr(char *msg);
|
||||
|
||||
|
||||
#endif /* __SACTSTRING_H__ */
|
||||
|
||||
@@ -1,2 +0,0 @@
|
||||
#define SNAME_RYO "亮 "
|
||||
#define SNAME_RYO_DEF "亮"
|
||||
+15
-15
@@ -9,7 +9,7 @@
|
||||
#include "ngraph.h"
|
||||
#include "nt_msg.h"
|
||||
|
||||
sprite_t *sp_new(int no, int cg1, int cg2, int cg3, int type) {
|
||||
sprite_t *nt_sp_new(int no, int cg1, int cg2, int cg3, int type) {
|
||||
sprite_t *sp;
|
||||
|
||||
sp = calloc(1, sizeof(sprite_t));
|
||||
@@ -17,9 +17,9 @@ sprite_t *sp_new(int no, int cg1, int cg2, int cg3, int type) {
|
||||
sp->no = no;
|
||||
sp->type = type;
|
||||
|
||||
if (cg1) sp->cg1 = scg_loadcg_no(cg1, TRUE); else sp->cg1 = NULL;
|
||||
if (cg2) sp->cg2 = scg_loadcg_no(cg2, TRUE); else sp->cg2 = NULL;
|
||||
if (cg3) sp->cg3 = scg_loadcg_no(cg3, TRUE); else sp->cg3 = NULL;
|
||||
if (cg1) sp->cg1 = nt_scg_loadcg_no(cg1, TRUE); else sp->cg1 = NULL;
|
||||
if (cg2) sp->cg2 = nt_scg_loadcg_no(cg2, TRUE); else sp->cg2 = NULL;
|
||||
if (cg3) sp->cg3 = nt_scg_loadcg_no(cg3, TRUE); else sp->cg3 = NULL;
|
||||
|
||||
sp->curcg = sp->cg1;
|
||||
sp->show = TRUE;
|
||||
@@ -47,7 +47,7 @@ sprite_t *sp_new(int no, int cg1, int cg2, int cg3, int type) {
|
||||
return sp;
|
||||
}
|
||||
|
||||
sprite_t *sp_msg_new(int no, int x, int y, int width, int height) {
|
||||
sprite_t *nt_sp_msg_new(int no, int x, int y, int width, int height) {
|
||||
sprite_t *sp;
|
||||
|
||||
sp = calloc(1, sizeof(sprite_t));
|
||||
@@ -69,12 +69,12 @@ sprite_t *sp_msg_new(int no, int x, int y, int width, int height) {
|
||||
return sp;
|
||||
}
|
||||
|
||||
void sp_free(sprite_t *sp) {
|
||||
void nt_sp_free(sprite_t *sp) {
|
||||
if (sp == NULL) return;
|
||||
|
||||
if (sp->cg1) scg_free_cgobj(sp->cg1);
|
||||
if (sp->cg2) scg_free_cgobj(sp->cg2);
|
||||
if (sp->cg3) scg_free_cgobj(sp->cg3);
|
||||
if (sp->cg1) nt_scg_free_cgobj(sp->cg1);
|
||||
if (sp->cg2) nt_scg_free_cgobj(sp->cg2);
|
||||
if (sp->cg3) nt_scg_free_cgobj(sp->cg3);
|
||||
|
||||
if (sp->type == SPRITE_MSG) {
|
||||
sf_free(sp->u.msg.canvas);
|
||||
@@ -83,7 +83,7 @@ void sp_free(sprite_t *sp) {
|
||||
free(sp);
|
||||
}
|
||||
|
||||
void sp_set_show(sprite_t *sp, boolean show) {
|
||||
void nt_sp_set_show(sprite_t *sp, boolean show) {
|
||||
boolean oldshow;
|
||||
|
||||
if (sp == NULL) return;
|
||||
@@ -92,22 +92,22 @@ void sp_set_show(sprite_t *sp, boolean show) {
|
||||
sp->show = show;
|
||||
|
||||
if (oldshow != show) {
|
||||
sp_updateme(sp);
|
||||
nt_sp_updateme(sp);
|
||||
}
|
||||
}
|
||||
|
||||
#if 0
|
||||
void sp_set_cg(sprite_t *sp, int no) {
|
||||
void nt_sp_set_cg(sprite_t *sp, int no) {
|
||||
cginfo_t *cg;
|
||||
|
||||
if (sp == NULL) return;
|
||||
|
||||
if (sp->curcg) {
|
||||
scg_free_cgobj(sp->curcg);
|
||||
nt_scg_free_cgobj(sp->curcg);
|
||||
}
|
||||
|
||||
if (no) {
|
||||
cg = scg_loadcg_no(no, TRUE);
|
||||
cg = nt_scg_loadcg_no(no, TRUE);
|
||||
} else {
|
||||
cg = NULL;
|
||||
}
|
||||
@@ -124,7 +124,7 @@ void sp_set_cg(sprite_t *sp, int no) {
|
||||
}
|
||||
#endif
|
||||
|
||||
void sp_set_loc(sprite_t *sp, int x, int y) {
|
||||
void nt_sp_set_loc(sprite_t *sp, int x, int y) {
|
||||
if (sp == NULL) return;
|
||||
sp->cur.x = sp->loc.x = x;
|
||||
sp->cur.y = sp->loc.y = y;
|
||||
|
||||
+19
-19
@@ -6,7 +6,7 @@
|
||||
#include "surface.h"
|
||||
#include "graphics.h"
|
||||
|
||||
#define DEFAULT_UPDATE sp_draw
|
||||
#define DEFAULT_UPDATE nt_sp_draw
|
||||
|
||||
|
||||
#define SPRITEMAX 20
|
||||
@@ -107,30 +107,30 @@ typedef struct _sprite sprite_t;
|
||||
|
||||
|
||||
/* in nt_sprite.c */
|
||||
extern sprite_t *sp_new(int no, int cg1, int cg2, int cg3, int type);
|
||||
extern sprite_t *sp_msg_new(int no, int x, int y, int width, int height);
|
||||
extern void sp_free(sprite_t *sp);
|
||||
extern void sp_set_show(sprite_t *sp, boolean show);
|
||||
// extern void sp_set_cg(sprite_t *sp, int no);
|
||||
extern void sp_set_loc(sprite_t *sp, int x, int y);
|
||||
extern sprite_t *nt_sp_new(int no, int cg1, int cg2, int cg3, int type);
|
||||
extern sprite_t *nt_sp_msg_new(int no, int x, int y, int width, int height);
|
||||
extern void nt_sp_free(sprite_t *sp);
|
||||
extern void nt_sp_set_show(sprite_t *sp, boolean show);
|
||||
// extern void nt_sp_set_cg(sprite_t *sp, int no);
|
||||
extern void nt_sp_set_loc(sprite_t *sp, int x, int y);
|
||||
|
||||
/* in nt_sprite_update.c */
|
||||
extern int sp_update_clipped();
|
||||
extern int sp_update_all(boolean syncscreen);
|
||||
extern int sp_updateme(sprite_t *sp);
|
||||
extern int sp_updateme_part(sprite_t *sp, int x, int y, int w, int h);
|
||||
extern void sp_add_updatelist(sprite_t *sp);
|
||||
extern void sp_remove_updatelist(sprite_t *sp);
|
||||
extern int sp_draw_wall(sprite_t *sp, MyRectangle *r);
|
||||
extern int nt_sp_update_clipped();
|
||||
extern int nt_sp_update_all(boolean syncscreen);
|
||||
extern int nt_sp_updateme(sprite_t *sp);
|
||||
extern int nt_sp_updateme_part(sprite_t *sp, int x, int y, int w, int h);
|
||||
extern void nt_sp_add_updatelist(sprite_t *sp);
|
||||
extern void nt_sp_remove_updatelist(sprite_t *sp);
|
||||
extern int nt_sp_draw_wall(sprite_t *sp, MyRectangle *r);
|
||||
|
||||
/* in nt_sprite_draw.c */
|
||||
extern int sp_draw(sprite_t *sp, MyRectangle *r);
|
||||
extern int sp_draw2(sprite_t *sp, cginfo_t *cg, MyRectangle *r);
|
||||
extern void sp_draw_dmap(void* data, void* userdata);
|
||||
extern int sp_draw_scg(sprite_t *sp, MyRectangle *r);
|
||||
extern int nt_sp_draw(sprite_t *sp, MyRectangle *r);
|
||||
extern int nt_sp_draw2(sprite_t *sp, cginfo_t *cg, MyRectangle *r);
|
||||
extern void nt_sp_draw_dmap(void* data, void* userdata);
|
||||
extern int nt_sp_draw_scg(sprite_t *sp, MyRectangle *r);
|
||||
|
||||
/* in nt_sprite_eupdate.c */
|
||||
extern int sp_eupdate(int type, int time, int cancel);
|
||||
extern int nt_sp_eupdate(int type, int time, int cancel);
|
||||
|
||||
|
||||
#endif /* __SPRITE_H__ */
|
||||
|
||||
@@ -38,10 +38,10 @@
|
||||
@param sp: 描画するスプライト
|
||||
@param r : 再描画する領域
|
||||
*/
|
||||
int sp_draw(sprite_t *sp, MyRectangle *r) {
|
||||
int nt_sp_draw(sprite_t *sp, MyRectangle *r) {
|
||||
if (sp == NULL) return NG;
|
||||
|
||||
return sp_draw2(sp, sp->curcg, r);
|
||||
return nt_sp_draw2(sp, sp->curcg, r);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -52,7 +52,7 @@ int sp_draw(sprite_t *sp, MyRectangle *r) {
|
||||
@param cg: 描画するCG
|
||||
@param r : 再描画する領域
|
||||
*/
|
||||
int sp_draw2(sprite_t *sp, cginfo_t *cg, MyRectangle *r) {
|
||||
int nt_sp_draw2(sprite_t *sp, cginfo_t *cg, MyRectangle *r) {
|
||||
surface_t update;
|
||||
int sx, sy, w, h, dx, dy;
|
||||
|
||||
@@ -60,8 +60,8 @@ int sp_draw2(sprite_t *sp, cginfo_t *cg, MyRectangle *r) {
|
||||
if (cg->sf == NULL) return NG;
|
||||
|
||||
// 更新領域の確定
|
||||
update.width = r->width;
|
||||
update.height = r->height;
|
||||
update.width = r->w;
|
||||
update.height = r->h;
|
||||
sx = 0;
|
||||
sy = 0;
|
||||
dx = sp->cur.x - r->x;
|
||||
@@ -76,7 +76,7 @@ int sp_draw2(sprite_t *sp, cginfo_t *cg, MyRectangle *r) {
|
||||
dx += r->x;
|
||||
dy += r->y;
|
||||
|
||||
if (cg->sf->has_alpha) {
|
||||
if (cg->sf->alpha) {
|
||||
// alpha map がある場合
|
||||
gre_BlendUseAMap(sf0, dx, dy,
|
||||
sf0, dx, dy,
|
||||
@@ -96,14 +96,14 @@ int sp_draw2(sprite_t *sp, cginfo_t *cg, MyRectangle *r) {
|
||||
}
|
||||
}
|
||||
|
||||
WARNING("do update no=%d, sx=%d, sy=%d, w=%d, h=%d, dx=%d, dy=%d\n",
|
||||
SACT_DEBUG("do update no=%d, sx=%d, sy=%d, w=%d, h=%d, dx=%d, dy=%d\n",
|
||||
sp->no, sx, sy, w, h, dx, dy);
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
// BlendScreenによる描画
|
||||
int sp_draw_scg(sprite_t *sp, MyRectangle *r) {
|
||||
int nt_sp_draw_scg(sprite_t *sp, MyRectangle *r) {
|
||||
surface_t update;
|
||||
cginfo_t *cg;
|
||||
int sx, sy, w, h, dx, dy;
|
||||
@@ -116,8 +116,8 @@ int sp_draw_scg(sprite_t *sp, MyRectangle *r) {
|
||||
if (cg->sf == NULL) return NG;
|
||||
|
||||
// 更新領域の確定
|
||||
update.width = r->width;
|
||||
update.height = r->height;
|
||||
update.width = r->w;
|
||||
update.height = r->h;
|
||||
sx = 0;
|
||||
sy = 0;
|
||||
dx = sp->cur.x - r->x;
|
||||
@@ -136,7 +136,7 @@ int sp_draw_scg(sprite_t *sp, MyRectangle *r) {
|
||||
sf0, dx, dy,
|
||||
cg->sf, sx, sy, w, h);
|
||||
|
||||
WARNING("do update no=%d, sx=%d, sy=%d, w=%d, h=%d, dx=%d, dy=%d\n",
|
||||
SACT_DEBUG("do update no=%d, sx=%d, sy=%d, w=%d, h=%d, dx=%d, dy=%d\n",
|
||||
sp->no, sx, sy, w, h, dx, dy);
|
||||
|
||||
return OK;
|
||||
|
||||
@@ -37,7 +37,7 @@
|
||||
#include "surface.h"
|
||||
#include "sactcg.h"
|
||||
#include "counter.h"
|
||||
|
||||
#include "sdl_core.h"
|
||||
|
||||
|
||||
static void ec1_cb(surface_t *, surface_t *);
|
||||
@@ -88,7 +88,7 @@ static void ec1_cb(surface_t *sfsrc, surface_t *sfdst) {
|
||||
}
|
||||
gre_Blend(sf0, 0, 0, sfsrc, 0, 0, sfdst, 0, 0, sfsrc->width, sfsrc->height, curstep);
|
||||
|
||||
// WARNING("step = %d\n", curstep);
|
||||
// SACT_DEBUG("step = %d\n", curstep);
|
||||
ags_updateFull();
|
||||
|
||||
ecp.oldstep = curstep;
|
||||
@@ -101,7 +101,7 @@ static void ec7_cb(surface_t *sfsrc, surface_t *sfdst) {
|
||||
int i, t, y;
|
||||
|
||||
curstep = maxstep * (ecp.curtime - ecp.sttime)/ (ecp.edtime - ecp.sttime);
|
||||
//WARNING("step = %d\n", curstep);
|
||||
//SACT_DEBUG("step = %d\n", curstep);
|
||||
|
||||
if (ecp.oldstep == curstep) {
|
||||
usleep(0);
|
||||
@@ -129,7 +129,7 @@ static void ec8_cb(surface_t *sfsrc, surface_t *sfdst) {
|
||||
int i, t, x;
|
||||
|
||||
curstep = maxstep * (ecp.curtime - ecp.sttime) / (ecp.edtime - ecp.sttime);
|
||||
//WARNING("step = %d\n", curstep);
|
||||
//SACT_DEBUG("step = %d\n", curstep);
|
||||
|
||||
if (ecp.oldstep == curstep) {
|
||||
usleep(0);
|
||||
@@ -160,7 +160,7 @@ static void ec9_cb(surface_t *sfsrc, surface_t *sfdst) {
|
||||
sfsrc->width / EC9DELTA + EC9DELTA);
|
||||
|
||||
curstep = maxstep * (ecp.curtime - ecp.sttime)/ (ecp.edtime - ecp.sttime);
|
||||
//WARNING("step = %d\n", curstep);
|
||||
//SACT_DEBUG("step = %d\n", curstep);
|
||||
|
||||
if (ecp.oldstep == curstep) {
|
||||
usleep(0);
|
||||
@@ -194,7 +194,7 @@ static void ec12_cb(surface_t *src, surface_t *dst) {
|
||||
int j, st_i, ed_i, l;
|
||||
|
||||
curstep = maxstep * (ecp.curtime - ecp.sttime)/ (ecp.edtime - ecp.sttime);
|
||||
WARNING("step = %d\n", curstep);
|
||||
SACT_DEBUG("step = %d\n", curstep);
|
||||
|
||||
if (ecp.oldstep == curstep) {
|
||||
usleep(0); return;
|
||||
@@ -225,7 +225,7 @@ static void ec13_cb(surface_t *src, surface_t *dst) {
|
||||
int dyy = 0 + sf0->height -1;
|
||||
|
||||
curstep = maxstep * (ecp.curtime - ecp.sttime)/ (ecp.edtime - ecp.sttime);
|
||||
WARNING("step = %d\n", curstep);
|
||||
SACT_DEBUG("step = %d\n", curstep);
|
||||
|
||||
if (ecp.oldstep == curstep) {
|
||||
usleep(0); return;
|
||||
@@ -255,7 +255,7 @@ static void ec14_cb(surface_t *sfsrc, surface_t *sfdst) {
|
||||
if (ecp.oldstep == 0) {
|
||||
sf_copyall(sf0, sfdst);
|
||||
}
|
||||
Maskupdate(0, 0, sfsrc->width, sfsrc->height, 0, 0, 44, curstep);
|
||||
sdl_maskupdate(0, 0, sfsrc->width, sfsrc->height, 0, 0, 44, curstep);
|
||||
ecp.oldstep = curstep;
|
||||
}
|
||||
|
||||
@@ -268,7 +268,7 @@ static void ec15_cb(surface_t *sfsrc, surface_t *sfdst) {
|
||||
if (ecp.oldstep == 0) {
|
||||
sf_copyall(sf0, sfdst);
|
||||
}
|
||||
Maskupdate(0, 0, sfsrc->width, sfsrc->height, 0, 0, 45, curstep);
|
||||
sdl_maskupdate(0, 0, sfsrc->width, sfsrc->height, 0, 0, 45, curstep);
|
||||
ecp.oldstep = curstep;
|
||||
}
|
||||
|
||||
@@ -281,7 +281,7 @@ static void ec16_cb(surface_t *sfsrc, surface_t *sfdst) {
|
||||
if (ecp.oldstep == 0) {
|
||||
sf_copyall(sf0, sfdst);
|
||||
}
|
||||
Maskupdate(0, 0, sfsrc->width, sfsrc->height, 0, 0, 46, curstep);
|
||||
sdl_maskupdate(0, 0, sfsrc->width, sfsrc->height, 0, 0, 46, curstep);
|
||||
ecp.oldstep = curstep;
|
||||
}
|
||||
|
||||
@@ -294,7 +294,7 @@ static void ec17_cb(surface_t *sfsrc, surface_t *sfdst) {
|
||||
if (ecp.oldstep == 0) {
|
||||
sf_copyall(sf0, sfdst);
|
||||
}
|
||||
Maskupdate(0, 0, sfsrc->width, sfsrc->height, 0, 0, 47, curstep);
|
||||
sdl_maskupdate(0, 0, sfsrc->width, sfsrc->height, 0, 0, 47, curstep);
|
||||
ecp.oldstep = curstep;
|
||||
}
|
||||
|
||||
@@ -364,7 +364,7 @@ static void ec_whiteout_cb(surface_t *sfsrc, surface_t *sfdst) {
|
||||
@param time: 実行時間(msec)
|
||||
@param cancel: キー抜け(0:なし, 1:あり)
|
||||
*/
|
||||
int sp_eupdate(int type, int time, int cancel) {
|
||||
int nt_sp_eupdate(int type, int time, int cancel) {
|
||||
surface_t *sfsrc, *sfdst;
|
||||
int key;
|
||||
entrypoint *cb;
|
||||
@@ -372,7 +372,7 @@ int sp_eupdate(int type, int time, int cancel) {
|
||||
// 現在の sf0 をセーブ
|
||||
sfsrc = sf_dup(sf0);
|
||||
|
||||
sp_update_all(FALSE);
|
||||
nt_sp_update_all(FALSE);
|
||||
|
||||
sfdst = sf_dup(sf0);
|
||||
|
||||
@@ -415,7 +415,7 @@ int sp_eupdate(int type, int time, int cancel) {
|
||||
cb = ec_dummy_cb;
|
||||
break;
|
||||
case 1013:
|
||||
sp_update_all(TRUE); return OK;
|
||||
nt_sp_update_all(TRUE); return OK;
|
||||
// cb = ec_dummy_cb;
|
||||
break;
|
||||
default:
|
||||
@@ -428,7 +428,7 @@ int sp_eupdate(int type, int time, int cancel) {
|
||||
|
||||
cb(sfsrc, sfdst);
|
||||
rest = 15 - (get_high_counter(SYSTEMCOUNTER_MSEC) - ecp.curtime);
|
||||
key = sys_keywait(rest, cancel);
|
||||
key = sys_keywait(rest, cancel ? KEYWAIT_CANCELABLE : KEYWAIT_NONCANCELABLE);
|
||||
|
||||
if (cancel && key) break;
|
||||
}
|
||||
|
||||
@@ -43,52 +43,16 @@ static SList *updatearea;
|
||||
// 再描画するスプライトのリスト
|
||||
static SList *updatelist;
|
||||
|
||||
static void intersection(MyRectangle *r1, MyRectangle *r2, MyRectangle *rst);
|
||||
static void disjunction(void* region, void* data);
|
||||
static MyRectangle get_updatearea();
|
||||
static void do_update_each(void* data, void* userdata);
|
||||
|
||||
// 領域1と領域2の積を計算
|
||||
static void intersection(MyRectangle *r1, MyRectangle *r2, MyRectangle *rst) {
|
||||
int x1 = max(r1->x, r2->x);
|
||||
int x2 = min(r1->x + r1->width, r2->x + r2->width);
|
||||
int y1 = max(r1->y, r2->y);
|
||||
int y2 = min(r1->y + r1->height, r2->y + r2->height);
|
||||
|
||||
rst->x = x1;
|
||||
rst->y = y1;
|
||||
rst->width = x2 - x1;
|
||||
rst->height = y2 - y1;
|
||||
}
|
||||
|
||||
// 領域1と領域2をすべて含む矩形領域を計算
|
||||
static void disjunction(void* region, void* data) {
|
||||
MyRectangle *r1 = (MyRectangle *)region;
|
||||
MyRectangle *r2 = (MyRectangle *)data;
|
||||
int x1, x2, y1, y2;
|
||||
|
||||
//WARNING("r1x=%d,r1y=%d,r1w=%d,r1h=%d\n", r1->x, r1->y, r1->width, r1->height);
|
||||
//WARNING("r2x=%d,r2y=%d,r2w=%d,r2h=%d\n", r2->x, r2->y, r2->width, r2->height);
|
||||
|
||||
if (r2->width == 0) {
|
||||
r2->x = r1->x;
|
||||
r2->y = r1->y;
|
||||
r2->width = r1->width;
|
||||
r2->height = r1->height;
|
||||
return;
|
||||
}
|
||||
|
||||
x1 = min(r1->x, r2->x);
|
||||
x2 = max(r1->x + r1->width, r2->x + r2->width);
|
||||
y1 = min(r1->y, r2->y);
|
||||
y2 = max(r1->y + r1->height, r2->y + r2->height);
|
||||
|
||||
r2->x = x1;
|
||||
r2->y = y1;
|
||||
r2->width = x2 - x1;
|
||||
r2->height = y2 - y1;
|
||||
|
||||
//WARNING("res:r2x=%d,r2y=%d,r2w=%d,r2h=%d\n", r2->x, r2->y, r2->width, r2->height);
|
||||
SDL_UnionRect(r1, r2, r2);
|
||||
free(r1);
|
||||
}
|
||||
|
||||
// 更新の必要なスプライトの領域の和をとってクリッピングする
|
||||
@@ -103,11 +67,10 @@ static MyRectangle get_updatearea() {
|
||||
updatearea = NULL;
|
||||
|
||||
// surface0との領域の積をとる
|
||||
intersection(&rsf0, &clip, &result);
|
||||
SDL_IntersectRect(&rsf0, &clip, &result);
|
||||
|
||||
WARNING("clipped area x=%d y=%d w=%d h=%d\n",
|
||||
result.x, result.y,
|
||||
result.width, result.height);
|
||||
SACT_DEBUG("clipped area x=%d y=%d w=%d h=%d\n",
|
||||
result.x, result.y, result.w, result.h);
|
||||
|
||||
return result;
|
||||
}
|
||||
@@ -130,7 +93,7 @@ static void do_update_each(void* data, void* userdata) {
|
||||
画面全体の更新
|
||||
@param syncscreen: surface0 に描画したものを Screen に反映させるかどうか
|
||||
*/
|
||||
int sp_update_all(boolean syncscreen) {
|
||||
int nt_sp_update_all(boolean syncscreen) {
|
||||
// 画面全体を更新領域に
|
||||
MyRectangle r = {0, 0, sf0->width, sf0->height };
|
||||
|
||||
@@ -152,22 +115,20 @@ int sp_update_all(boolean syncscreen) {
|
||||
画面の一部を更新
|
||||
updateme(_part)で登録した更新が必要なspriteの和の領域をupdate
|
||||
*/
|
||||
int sp_update_clipped() {
|
||||
int nt_sp_update_clipped() {
|
||||
MyRectangle r;
|
||||
|
||||
// 更新領域の確定
|
||||
r = get_updatearea();
|
||||
|
||||
// 幅または高さが 0 の時はなにもしない
|
||||
if (r.width == 0 || r.height == 0) {
|
||||
if (SDL_RectEmpty(&r))
|
||||
return OK;
|
||||
}
|
||||
|
||||
// 更新領域に入っているスプライトの再描画
|
||||
slist_foreach(updatelist, do_update_each, &r);
|
||||
|
||||
// 更新領域を Window に転送
|
||||
ags_updateArea(r.x, r.y, r.width, r.height);
|
||||
ags_updateArea(r.x, r.y, r.w, r.h);
|
||||
|
||||
return OK;
|
||||
}
|
||||
@@ -176,7 +137,7 @@ int sp_update_clipped() {
|
||||
sprite全体の更新を登録
|
||||
@param sp: 更新するスプライト
|
||||
*/
|
||||
int sp_updateme(sprite_t *sp) {
|
||||
int nt_sp_updateme(sprite_t *sp) {
|
||||
MyRectangle *r;
|
||||
|
||||
if (sp == NULL) return NG;
|
||||
@@ -185,13 +146,13 @@ int sp_updateme(sprite_t *sp) {
|
||||
r = malloc(sizeof(MyRectangle));
|
||||
r->x = sp->cur.x;
|
||||
r->y = sp->cur.y;
|
||||
r->width = sp->cursize.width;
|
||||
r->height = sp->cursize.height;
|
||||
r->w = sp->cursize.width;
|
||||
r->h = sp->cursize.height;
|
||||
|
||||
updatearea = slist_append(updatearea, r);
|
||||
|
||||
WARNING("x = %d, y = %d, spno = %d w=%d,h=%d\n",
|
||||
r->x, r->y, sp->no, r->width, r->height);
|
||||
SACT_DEBUG("x = %d, y = %d, spno = %d w=%d,h=%d\n",
|
||||
r->x, r->y, sp->no, r->w, r->h);
|
||||
|
||||
return OK;
|
||||
}
|
||||
@@ -204,7 +165,7 @@ int sp_updateme(sprite_t *sp) {
|
||||
@param w: 更新領域幅
|
||||
@param h: 更新領域高さ
|
||||
*/
|
||||
int sp_updateme_part(sprite_t *sp, int x, int y, int w, int h) {
|
||||
int nt_sp_updateme_part(sprite_t *sp, int x, int y, int w, int h) {
|
||||
MyRectangle *r;
|
||||
|
||||
if (sp == NULL) return NG;
|
||||
@@ -213,13 +174,13 @@ int sp_updateme_part(sprite_t *sp, int x, int y, int w, int h) {
|
||||
r = malloc(sizeof(MyRectangle));
|
||||
r->x = sp->cur.x + x;
|
||||
r->y = sp->cur.y + y;
|
||||
r->width = w;
|
||||
r->height = h;
|
||||
r->w = w;
|
||||
r->h = h;
|
||||
|
||||
updatearea = slist_append(updatearea, r);
|
||||
|
||||
WARNING("x = %d, y = %d, spno = %d w=%d,h=%d\n",
|
||||
r->x, r->y, sp->no, r->width, r->height);
|
||||
SACT_DEBUG("x = %d, y = %d, spno = %d w=%d,h=%d\n",
|
||||
r->x, r->y, sp->no, r->w, r->h);
|
||||
|
||||
return OK;
|
||||
}
|
||||
@@ -238,25 +199,25 @@ static int compare_spriteno_smallfirst(const void *a, const void *b) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
void sp_add_updatelist(sprite_t *sp) {
|
||||
void nt_sp_add_updatelist(sprite_t *sp) {
|
||||
updatelist = slist_insert_sorted(updatelist, sp, compare_spriteno_smallfirst);
|
||||
}
|
||||
|
||||
void sp_remove_updatelist(sprite_t *sp) {
|
||||
void nt_sp_remove_updatelist(sprite_t *sp) {
|
||||
updatelist = slist_remove(updatelist, sp);
|
||||
}
|
||||
|
||||
// デフォルトの壁紙update
|
||||
int sp_draw_wall(sprite_t *sp, MyRectangle *area) {
|
||||
int nt_sp_draw_wall(sprite_t *sp, MyRectangle *area) {
|
||||
int sx, sy, w, h;
|
||||
|
||||
sx = area->x;
|
||||
sy = area->y;
|
||||
w = area->width;
|
||||
h = area->height;
|
||||
w = area->w;
|
||||
h = area->h;
|
||||
gr_fill(sf0, sx, sy, w, h, 0, 0, 0);
|
||||
|
||||
WARNING("do update no=%d, sx=%d, sy=%d, w=%d, h=%d, \n",
|
||||
SACT_DEBUG("do update no=%d, sx=%d, sy=%d, w=%d, h=%d, \n",
|
||||
sp->no, sx, sy, w, h);
|
||||
|
||||
return OK;
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
include(FindJPEG)
|
||||
|
||||
if (JPEG_FOUND)
|
||||
add_library(NightDemonDemo MODULE NightDemonDemo.c ndd.c jpeg2surface.c)
|
||||
|
||||
target_link_libraries(NightDemonDemo PRIVATE graph alk JPEG::JPEG)
|
||||
|
||||
install(TARGETS NightDemonDemo DESTINATION lib/xsystem35)
|
||||
endif()
|
||||
@@ -28,28 +28,40 @@
|
||||
#include "portab.h"
|
||||
#include "system.h"
|
||||
#include "xsystem35.h"
|
||||
#include "modules.h"
|
||||
#include "nact.h"
|
||||
|
||||
extern void ndd_init(char *files[], int n);
|
||||
extern void ndd_init(const char *files[], int n);
|
||||
extern void ndd_run(int demonum);
|
||||
|
||||
void Init() {
|
||||
static void Init() {
|
||||
int p1 = getCaliValue(); /* ISys3x */
|
||||
int p2 = getCaliValue(); /* IWinMsg */
|
||||
int p3 = getCaliValue(); /* ITimer */
|
||||
int *var = getCaliVariable();
|
||||
|
||||
#ifdef HAVE_JPEG
|
||||
ndd_init(nact->files.alk, 4);
|
||||
#endif
|
||||
*var = 1;
|
||||
|
||||
DEBUG_COMMAND("NightDemonDemo.Init %d,%d,%d,%p:\n", p1, p2, p3, var);
|
||||
}
|
||||
|
||||
void Run() {
|
||||
static void Run() {
|
||||
int p1 = getCaliValue(); // デモ番号 0,1,2
|
||||
int p2 = getCaliValue();
|
||||
|
||||
#ifdef HAVE_JPEG
|
||||
ndd_run(p1);
|
||||
#endif
|
||||
|
||||
DEBUG_COMMAND("NightDemonDemo.Run %d,%d:\n", p1, p2);
|
||||
}
|
||||
|
||||
static const ModuleFunc functions[] = {
|
||||
{"Init", Init},
|
||||
{"Run", Run},
|
||||
};
|
||||
|
||||
const Module module_NightDemonDemo = {"NightDemonDemo", functions, sizeof(functions) / sizeof(ModuleFunc)};
|
||||
|
||||
@@ -21,10 +21,12 @@
|
||||
*/
|
||||
/* $Id: jpeg2surface.c,v 1.2 2003/11/09 15:06:12 chikama Exp $ */
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <jpeglib.h>
|
||||
#undef max
|
||||
#undef min
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include "portab.h"
|
||||
#include "ags.h"
|
||||
@@ -35,16 +37,6 @@ static void ppm2surface(surface_t *sf, int curscanline, unsigned char *src, int
|
||||
BYTE *dp = GETOFFSET_PIXEL(sf, 0, curscanline);
|
||||
|
||||
switch (sf->depth) {
|
||||
case 15:
|
||||
{
|
||||
WORD *dst = (WORD *)dp;
|
||||
while (width--) {
|
||||
*dst = PIX15(*src, *(src +1), *(src +2));
|
||||
dst++; src+= 3;
|
||||
}
|
||||
break;
|
||||
|
||||
}
|
||||
case 16:
|
||||
{
|
||||
WORD *dst = (WORD *)dp;
|
||||
|
||||
@@ -39,7 +39,7 @@
|
||||
// 2: Meteo
|
||||
|
||||
struct nddemo {
|
||||
char **fn;
|
||||
const char **fn;
|
||||
alk_t *alk;
|
||||
surface_t *sf[10];
|
||||
};
|
||||
@@ -52,7 +52,7 @@ static int ndemo_nums[3] = {150, 603, 467};
|
||||
extern surface_t *jpeg2surface(FILE *fp, int offset);
|
||||
|
||||
// ALKファイルの登録
|
||||
void ndd_init(char *files[], int n) {
|
||||
void ndd_init(const char *files[], int n) {
|
||||
int i;
|
||||
ndd.fn = malloc(sizeof(char *) * n);
|
||||
|
||||
@@ -94,7 +94,7 @@ void ndd_run(int demonum) {
|
||||
|
||||
cur1 = get_high_counter(SYSTEMCOUNTER_MSEC);
|
||||
if (cur1 - cur < 33) {
|
||||
if (sys_keywait(33 - (cur1 - cur), TRUE)) break;
|
||||
if (sys_keywait(33 - (cur1 - cur), KEYWAIT_CANCELABLE)) break;
|
||||
} else {
|
||||
if (sys_getInputInfo()) break;
|
||||
}
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
add_library(RandMT MODULE RandMT.c)
|
||||
|
||||
install(TARGETS RandMT DESTINATION lib/xsystem35)
|
||||
+12
-3
@@ -28,10 +28,11 @@
|
||||
#include "portab.h"
|
||||
#include "system.h"
|
||||
#include "xsystem35.h"
|
||||
#include "modules.h"
|
||||
#include "nact.h"
|
||||
#include "randMT.h"
|
||||
|
||||
void Init() {
|
||||
static void Init() {
|
||||
/*
|
||||
乱数初期化
|
||||
|
||||
@@ -42,7 +43,7 @@ void Init() {
|
||||
DEBUG_COMMAND_YET("RandMT.Init %p:\n", p1);
|
||||
}
|
||||
|
||||
void Get() {
|
||||
static void Get() {
|
||||
/*
|
||||
1 から num までの乱数を生成
|
||||
|
||||
@@ -61,10 +62,18 @@ void Get() {
|
||||
DEBUG_COMMAND_YET("RandMT.Get %d,%p:\n", num, var);
|
||||
}
|
||||
|
||||
void GetNoOverlap() { /* not used ? */
|
||||
static void GetNoOverlap() { /* not used ? */
|
||||
int p1 = getCaliValue();
|
||||
int p2 = getCaliValue();
|
||||
int *var1 = getCaliVariable();
|
||||
|
||||
DEBUG_COMMAND_YET("RandMT.GetNoOverlap %p:\n", p1);
|
||||
}
|
||||
|
||||
static const ModuleFunc functions[] = {
|
||||
{"Get", Get},
|
||||
{"GetNoOverlap", GetNoOverlap},
|
||||
{"Init", Init},
|
||||
};
|
||||
|
||||
const Module module_RandMT = {"RandMT", functions, sizeof(functions) / sizeof(ModuleFunc)};
|
||||
|
||||
@@ -1,35 +0,0 @@
|
||||
add_library(SACT MODULE
|
||||
SACT.c
|
||||
sactcg.c
|
||||
sactsound.c
|
||||
sactbgm.c
|
||||
sacttimer.c
|
||||
sactstring.c
|
||||
sactcrypto.c
|
||||
sactchart.c
|
||||
sactamask.c
|
||||
sactlog.c
|
||||
sprite.c
|
||||
sprite_event.c
|
||||
sprite_tevent.c
|
||||
sprite_move.c
|
||||
sprite_anime.c
|
||||
sprite_get.c
|
||||
sprite_put.c
|
||||
sprite_switch.c
|
||||
sprite_sel.c
|
||||
sprite_msg.c
|
||||
sprite_draw.c
|
||||
sprite_update.c
|
||||
sprite_eupdate.c
|
||||
sprite_quake.c
|
||||
sprite_keywait.c
|
||||
screen_quake.c
|
||||
sprite_xmenu.c
|
||||
)
|
||||
|
||||
target_compile_options(SACT PRIVATE -Wno-pointer-sign -Wno-invalid-source-encoding)
|
||||
|
||||
target_link_libraries(SACT PRIVATE graph drawtext list)
|
||||
|
||||
install(TARGETS SACT DESTINATION lib/xsystem35)
|
||||
+257
-130
File diff suppressed because it is too large
Load Diff
+2
-4
@@ -32,7 +32,7 @@
|
||||
#include "surface.h"
|
||||
#include "sacttimer.h"
|
||||
#include "variable.h"
|
||||
|
||||
#include "mmap.h"
|
||||
|
||||
// スプライトの最大数
|
||||
#define SPRITEMAX 21845
|
||||
@@ -63,9 +63,7 @@ typedef struct {
|
||||
|
||||
// SACTEFAM を使ったマスク
|
||||
typedef struct {
|
||||
int fd; // SACTEFAM.KLD のファイルディスクプリタ
|
||||
char *mapadr; // mmap された最初のアドレス
|
||||
off_t size; // mmap した大きさ
|
||||
mmap_t *mmap;
|
||||
int datanum; // SACTEFAM.KLD 中のマスクファイルの数
|
||||
int *no; // シナリオ側での番号
|
||||
int *offset; // データへのオフセット
|
||||
|
||||
@@ -27,11 +27,6 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/mman.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
#include "portab.h"
|
||||
#include "system.h"
|
||||
@@ -60,40 +55,21 @@ static ecopyparam_t ecp;
|
||||
|
||||
// SACTEFAM.KLD の読み込み
|
||||
int smask_init(char *path) {
|
||||
struct stat sbuf;
|
||||
int i, fd;
|
||||
char *adr;
|
||||
int i;
|
||||
SACTEFAM_t *am;
|
||||
|
||||
if (0 > (fd = open(path, O_RDONLY))) {
|
||||
WARNING("open: %s\n", strerror(errno));
|
||||
mmap_t *m = map_file(path);
|
||||
if (!m)
|
||||
return NG;
|
||||
}
|
||||
|
||||
if (0 > fstat(fd, &sbuf)) {
|
||||
WARNING("fstat: %s\n", strerror(errno));
|
||||
close(fd);
|
||||
return NG;
|
||||
}
|
||||
|
||||
if (MAP_FAILED == (adr = mmap(0, sbuf.st_size, PROT_READ, MAP_SHARED, fd, 0))) {
|
||||
WARNING("mmap: %s\n", strerror(errno));
|
||||
close(fd);
|
||||
return NG;
|
||||
}
|
||||
|
||||
am = &sact.am;
|
||||
am->mapadr = adr;
|
||||
am->size = sbuf.st_size;
|
||||
am->fd = fd;
|
||||
|
||||
am->datanum = LittleEndian_getDW(adr, 0);
|
||||
am->mmap = m;
|
||||
am->datanum = LittleEndian_getDW(m->addr, 0);
|
||||
am->no = malloc(sizeof(int) * am->datanum);
|
||||
am->offset = malloc(sizeof(int) * am->datanum);
|
||||
|
||||
for (i = 0; i < am->datanum; i++) {
|
||||
am->no[i] = LittleEndian_getDW(adr, 16 + i * 16);
|
||||
am->offset[i] = LittleEndian_getDW(adr, 16 + i * 16 + 8);
|
||||
am->no[i] = LittleEndian_getDW(m->addr, 16 + i * 16);
|
||||
am->offset[i] = LittleEndian_getDW(m->addr, 16 + i * 16 + 8);
|
||||
}
|
||||
|
||||
return OK;
|
||||
@@ -110,7 +86,7 @@ static surface_t *smask_get(int no) {
|
||||
|
||||
if (i == am->datanum) return NULL;
|
||||
|
||||
return sf_getcg(am->mapadr + am->offset[i]);
|
||||
return sf_getcg(am->mmap->addr + am->offset[i]);
|
||||
}
|
||||
|
||||
// ベースになるマスクの alpha 値を拡大して取り出す
|
||||
@@ -163,7 +139,7 @@ int sp_eupdate_amap(int index, int time, int cancel) {
|
||||
gre_BlendUseAMap(sf0, 0, 0, sfsrc, 0, 0, sfdst, 0, 0, sfsrc->width, sfsrc->height, mask2, 0, 0, 255);
|
||||
ags_updateFull();
|
||||
|
||||
key = sys_keywait(10, cancel);
|
||||
key = sys_keywait(10, cancel ? KEYWAIT_CANCELABLE : KEYWAIT_NONCANCELABLE);
|
||||
if (cancel && key) break;
|
||||
|
||||
// 一時マスクを削除
|
||||
|
||||
@@ -24,6 +24,6 @@
|
||||
#ifndef __SACTAMASK_H__
|
||||
#define __SACTAMASK_H__
|
||||
|
||||
extern int smask_init(char *path);
|
||||
extern int smask_init(const char *path);
|
||||
|
||||
#endif
|
||||
|
||||
+15
-29
@@ -35,7 +35,6 @@
|
||||
#include "sactcg.h"
|
||||
#include "surface.h"
|
||||
#include "ngraph.h"
|
||||
#include "utfsjis.h"
|
||||
|
||||
#include "sactcg_stretch.c"
|
||||
#include "sactcg_blend.c"
|
||||
@@ -202,24 +201,14 @@ int scg_create_blend(int wNumDstCG, int wNumBaseCG, int wX, int wY, int wNumBlen
|
||||
// 指定の文字列のCGを作成
|
||||
int scg_create_text(int wNumCG, int wSize, int wR, int wG, int wB, int wText) {
|
||||
cginfo_t *i;
|
||||
agsurface_t *glyph;
|
||||
FONT *font;
|
||||
|
||||
if (0) {
|
||||
char *b = sjis2lang(v_str(wText-1));
|
||||
WARNING("str = '%s'\n", b);
|
||||
free(b);
|
||||
}
|
||||
|
||||
spcg_assert_no(wNumCG);
|
||||
|
||||
// 勝手に出ていいのかな?
|
||||
if (v_strlen(wText -1) == 0) return OK;
|
||||
|
||||
font = nact->ags.font;
|
||||
font->sel_font(FONT_GOTHIC, wSize);
|
||||
|
||||
glyph = font->get_glyph(v_str(wText -1));
|
||||
if (svar_length(wText) == 0) return OK;
|
||||
|
||||
ags_setFont(FONT_GOTHIC, wSize);
|
||||
agsurface_t *glyph = ags_drawStringToSurface(svar_get(wText));
|
||||
i = malloc(sizeof(cginfo_t));
|
||||
i->type = CG_SET;
|
||||
i->no = wNumCG;
|
||||
@@ -240,8 +229,6 @@ int scg_create_text(int wNumCG, int wSize, int wR, int wG, int wB, int wText) {
|
||||
// 数字文字列のCGを作成
|
||||
int scg_create_textnum(int wNumCG, int wSize, int wR, int wG, int wB, int wFigs, int wZeroPadding, int wValue) {
|
||||
cginfo_t *i;
|
||||
agsurface_t *glyph;
|
||||
FONT *font;
|
||||
char s[256], ss[256];
|
||||
|
||||
spcg_assert_no(wNumCG);
|
||||
@@ -254,11 +241,10 @@ int scg_create_textnum(int wNumCG, int wSize, int wR, int wG, int wB, int wFigs,
|
||||
sprintf(ss, sss, wFigs);
|
||||
}
|
||||
sprintf(s, ss, wValue);
|
||||
|
||||
font = nact->ags.font;
|
||||
font->sel_font(FONT_GOTHIC, wSize);
|
||||
glyph = font->get_glyph(s);
|
||||
|
||||
|
||||
ags_setFont(FONT_GOTHIC, wSize);
|
||||
agsurface_t *glyph = ags_drawStringToSurface(s);
|
||||
|
||||
i = malloc(sizeof(cginfo_t));
|
||||
i->type = CG_SET;
|
||||
i->no = wNumCG;
|
||||
@@ -320,15 +306,15 @@ int scg_cut(int wNumDstCG, int wNumSrcCG, int wX, int wY, int wWidth, int wHeigh
|
||||
i->refcnt = 0;
|
||||
|
||||
src = srccg->sf;
|
||||
if (src->has_alpha) {
|
||||
if (src->alpha) {
|
||||
dst = sf_create_surface(wWidth, wHeight, src->depth);
|
||||
} else {
|
||||
dst = sf_create_pixel(wWidth, wHeight, src->depth);
|
||||
}
|
||||
if (src->has_pixel) {
|
||||
if (src->pixel) {
|
||||
gr_copy(dst, 0, 0, src, wX, wY, wWidth, wHeight);
|
||||
}
|
||||
if (src->has_alpha) {
|
||||
if (src->alpha) {
|
||||
gr_copy_alpha_map(dst, 0, 0, src, wX, wY, wWidth, wHeight);
|
||||
}
|
||||
|
||||
@@ -361,17 +347,17 @@ int scg_partcopy(int wNumDstCG, int wNumSrcCG, int wX, int wY, int wWidth, int w
|
||||
i->refcnt = 0;
|
||||
|
||||
src = srccg->sf;
|
||||
if (src->has_alpha) {
|
||||
if (src->alpha) {
|
||||
dst = sf_create_surface(src->width, src->height, src->depth);
|
||||
gr_fill_alpha_map(dst, 0, 0, src->width, src->height, 255);
|
||||
} else {
|
||||
dst = sf_create_pixel(src->width, src->height, src->depth);
|
||||
}
|
||||
|
||||
if (src->has_pixel) {
|
||||
if (src->pixel) {
|
||||
gr_copy(dst, wX, wY, src, wX, wY, wWidth, wHeight);
|
||||
}
|
||||
if (src->has_alpha) {
|
||||
if (src->alpha) {
|
||||
gr_copy_alpha_map(dst, wX, wY, src, wX, wY, wWidth, wHeight);
|
||||
}
|
||||
|
||||
@@ -496,7 +482,7 @@ int scg_existalphamap(int wNumCG, int *ret) {
|
||||
if (sact.cg[wNumCG] == NULL) goto errexit;
|
||||
if (sact.cg[wNumCG]->sf == NULL) goto errexit;
|
||||
|
||||
*ret = sact.cg[wNumCG]->sf->has_alpha ? 1 : 0;
|
||||
*ret = sact.cg[wNumCG]->sf->alpha ? 1 : 0;
|
||||
|
||||
errexit:
|
||||
*ret = 0;
|
||||
|
||||
@@ -4,7 +4,7 @@ static surface_t *blend(surface_t *base, int x, int y, surface_t *blend, int mod
|
||||
|
||||
gr_copy(dst, 0, 0, base, 0, 0, base->width, base->height);
|
||||
|
||||
if (base->has_alpha) {
|
||||
if (base->alpha) {
|
||||
// ベースに alpha map がある場合はそれをコピー
|
||||
gr_copy_alpha_map(dst, 0, 0, base, 0, 0, base->width, base->height);
|
||||
} else {
|
||||
@@ -12,7 +12,7 @@ static surface_t *blend(surface_t *base, int x, int y, surface_t *blend, int mod
|
||||
gr_fill_alpha_map(dst, 0, 0, base->width, base->height, 255);
|
||||
}
|
||||
|
||||
if (blend->has_alpha) {
|
||||
if (blend->alpha) {
|
||||
// 重ね合わせ先の alpha map があるときはそれを使う
|
||||
gre_BlendUseAMap(dst, x, y, base, x, y, blend, 0, 0, blend->width, blend->height, blend, 0, 0, 255);
|
||||
} else {
|
||||
|
||||
@@ -12,13 +12,11 @@ static surface_t *stretch(surface_t *src, int dw, int dh, int mirror) {
|
||||
dst->depth = src->depth;
|
||||
dst->bytes_per_line = dw * src->bytes_per_pixel;
|
||||
dst->bytes_per_pixel = src->bytes_per_pixel;
|
||||
dst->has_pixel = src->has_pixel;
|
||||
dst->has_alpha = src->has_alpha;
|
||||
|
||||
if (src->has_pixel) {
|
||||
if (src->pixel) {
|
||||
dst->pixel = malloc(dh * dst->bytes_per_line);
|
||||
}
|
||||
if (src->has_alpha) {
|
||||
if (src->alpha) {
|
||||
dst->alpha = malloc(dw * dh);
|
||||
}
|
||||
|
||||
@@ -78,7 +76,6 @@ static surface_t *stretch(surface_t *src, int dw, int dh, int mirror) {
|
||||
switch(dst->depth) {
|
||||
case 8:
|
||||
SCALEDCOPYAREA(BYTE); break;
|
||||
case 15:
|
||||
case 16:
|
||||
SCALEDCOPYAREA(WORD); break;
|
||||
case 24:
|
||||
@@ -88,7 +85,7 @@ static surface_t *stretch(surface_t *src, int dw, int dh, int mirror) {
|
||||
break;
|
||||
}
|
||||
|
||||
if (src->has_alpha) {
|
||||
if (src->alpha) {
|
||||
int x, y;
|
||||
BYTE *sl, *dl;
|
||||
BYTE *_sl, *_dl;
|
||||
|
||||
@@ -47,7 +47,7 @@ int scryp_encrypt_str(int strno, int key) {
|
||||
}
|
||||
|
||||
int scryp_decrypt_str(int strno, int key) {
|
||||
WARNING("str = '%s'\n", v_str(strno -1));
|
||||
WARNING("str = '%s'\n", svar_get(strno));
|
||||
WARNING("NOT IMPLEMENTED\n");
|
||||
return OK;
|
||||
}
|
||||
|
||||
+21
-12
@@ -40,7 +40,17 @@
|
||||
#include "ngraph.h"
|
||||
#include "drawtext.h"
|
||||
#include "utfsjis.h"
|
||||
#include "sactlog_sjismsg.c"
|
||||
|
||||
#define LOGMSG_LINES 6
|
||||
|
||||
static const char *logmsg_utf8[LOGMSG_LINES] = {
|
||||
"\n",
|
||||
"※バックログ操作方法※",
|
||||
"[ESC]またはマウス右クリックでゲームに戻る",
|
||||
"[PageUp][PageDown]でページスクロール",
|
||||
"[↑][↓]またはマウスホイールで行スクロール",
|
||||
"\n",
|
||||
};
|
||||
|
||||
/*
|
||||
ホイールで上下スクロール
|
||||
@@ -73,21 +83,18 @@ static void draw_log() {
|
||||
// 表示始め位置
|
||||
node = list_nth(sact.log, list_length(sact.log) - curline);
|
||||
for (i = 0; i < LOGLINENUM; i++) {
|
||||
char *str, *streuc;
|
||||
if (cur <= 0) continue;
|
||||
|
||||
str = (char *)(node->data);
|
||||
char *str = (char *)(node->data);
|
||||
if (0 == strcmp(str, "\n")) {
|
||||
gr_fill(chr, 0, y + FONTSIZE/2, sf0->width, 3, 128, 0, 0);
|
||||
} else {
|
||||
streuc = sjis2lang(str);
|
||||
if (cur < 6) {
|
||||
dt_setfont(FONT_MINCHO, FONTSIZE);
|
||||
} else {
|
||||
dt_setfont(FONT_GOTHIC, FONTSIZE);
|
||||
}
|
||||
dt_drawtext(chr, 0, y, str);
|
||||
free(streuc);
|
||||
}
|
||||
y += FONTSIZE;
|
||||
cur--;
|
||||
@@ -103,13 +110,15 @@ static void draw_log() {
|
||||
|
||||
|
||||
int sblog_start(void) {
|
||||
static char *logmsg[LOGMSG_LINES];
|
||||
if (!logmsg[0]) {
|
||||
for (int i = 0; i < LOGMSG_LINES; i++)
|
||||
logmsg[i] = fromUTF8(logmsg_utf8[i]);
|
||||
}
|
||||
|
||||
// 説明文章を追加
|
||||
sact.log = list_append(sact.log, "\n");
|
||||
sact.log = list_append(sact.log, LOGMSG1);
|
||||
sact.log = list_append(sact.log, LOGMSG2);
|
||||
sact.log = list_append(sact.log, LOGMSG3);
|
||||
sact.log = list_append(sact.log, LOGMSG4);
|
||||
sact.log = list_append(sact.log, "\n");
|
||||
for (int i = 0; i < LOGMSG_LINES; i++)
|
||||
sact.log = list_append(sact.log, logmsg[i]);
|
||||
|
||||
back = sf_dup(sf0);
|
||||
chr = sf_create_surface(sf0->width, sf0->height, 8);
|
||||
@@ -129,7 +138,7 @@ int sblog_end(void) {
|
||||
sf_free(chr);
|
||||
|
||||
// 説明文章を削除
|
||||
for (i = 0; i < 6; i++) {
|
||||
for (i = 0; i < LOGMSG_LINES; i++) {
|
||||
node = list_last(sact.log);
|
||||
sact.log = list_remove(sact.log, node->data);
|
||||
}
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
#define LOGMSG1 "※バックログ操作方法※"
|
||||
#define LOGMSG2 "[ESC]またはマウス右クリックでゲームに戻る"
|
||||
#define LOGMSG3 "[PageUp][PageDown]でページスクロール"
|
||||
#define LOGMSG4 "[↑][↓]またはマウスホイールで行スクロール"
|
||||
|
||||
@@ -135,19 +135,18 @@ int ssnd_waitkey(int no, int *res) {
|
||||
sact.waittype = KEYWAIT_SIMPLE;
|
||||
sact.waitkey = -1;
|
||||
|
||||
while(sact.waitkey == -1 && mus_wav_get_playposition(slot)) {
|
||||
sys_keywait(25, TRUE);
|
||||
while (sact.waitkey == -1 && mus_wav_get_playposition(slot) && !nact->is_quit) {
|
||||
sys_keywait(25, KEYWAIT_CANCELABLE);
|
||||
}
|
||||
|
||||
if (sact.waitkey == -1) {
|
||||
cache[slot - SLOTOFFSET] = 0;
|
||||
*res = 0;
|
||||
} else {
|
||||
*res = sact.waitkey;
|
||||
}
|
||||
sact.waittype = KEYWAIT_NONE;
|
||||
|
||||
cache[slot - SLOTOFFSET] = 0;
|
||||
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
|
||||
@@ -56,7 +56,7 @@ int sstr_push(int strno) {
|
||||
idxmax = idx*2;
|
||||
}
|
||||
|
||||
stack[idx++] = strdup(v_str(strno -1));
|
||||
stack[idx++] = strdup(svar_get(strno));
|
||||
|
||||
return OK;
|
||||
}
|
||||
@@ -68,7 +68,7 @@ int sstr_push(int strno) {
|
||||
int sstr_pop(int strno) {
|
||||
if (idx == 0) return NG;
|
||||
|
||||
v_strcpy(strno -1, stack[--idx]);
|
||||
svar_set(strno, stack[--idx]);
|
||||
free(stack[idx]);
|
||||
|
||||
return OK;
|
||||
@@ -85,8 +85,8 @@ int sstr_regist_replace(int sstrno, int dstrno) {
|
||||
if (sstrno == dstrno) return NG;
|
||||
|
||||
ex = malloc(sizeof(strexchange_t));
|
||||
ex->src = strdup(v_str(sstrno -1));
|
||||
ex->dst = strdup(v_str(dstrno -1));
|
||||
ex->src = strdup(svar_get(sstrno));
|
||||
ex->dst = strdup(svar_get(dstrno));
|
||||
sact.strreplace = slist_append(sact.strreplace, ex);
|
||||
return OK;
|
||||
}
|
||||
@@ -106,7 +106,7 @@ int sstr_num2str(int strno, int fig, int nzeropad, int num) {
|
||||
}
|
||||
|
||||
sprintf(s, ss, num);
|
||||
v_strcpy(strno -1, s);
|
||||
svar_set(strno, s);
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
@@ -87,7 +87,7 @@ int sp_quake_screen(int type, int p1, int p2, int time, int cancel) {
|
||||
ags_setViewArea(adjx, adjy, sf0->width, sf0->height);
|
||||
ags_updateFull();
|
||||
|
||||
key = sys_keywait(10, cancel);
|
||||
key = sys_keywait(10, cancel ? KEYWAIT_CANCELABLE : KEYWAIT_NONCANCELABLE);
|
||||
if (cancel && key) break;
|
||||
}
|
||||
|
||||
|
||||
@@ -77,11 +77,11 @@ static int sp_draw_wall(sprite_t *sp) {
|
||||
|
||||
sx = sact.updaterect.x;
|
||||
sy = sact.updaterect.y;
|
||||
w = sact.updaterect.width;
|
||||
h = sact.updaterect.height;
|
||||
w = sact.updaterect.w;
|
||||
h = sact.updaterect.h;
|
||||
gr_fill(sf0, sx, sy, w, h, 0, 0, 0);
|
||||
|
||||
WARNING("do update no=%d, sx=%d, sy=%d, w=%d, h=%d, \n",
|
||||
SACT_DEBUG("do update no=%d, sx=%d, sy=%d, w=%d, h=%d, \n",
|
||||
sp->no, sx, sy, w, h);
|
||||
|
||||
return OK;
|
||||
|
||||
@@ -83,7 +83,7 @@ extern void sp_draw_dmap(void* data, void* userdata);
|
||||
|
||||
|
||||
// in sprite_msg.c
|
||||
extern void smsg_add(char *msg);
|
||||
extern void smsg_add(const char *msg);
|
||||
extern void smsg_newline(int wNum, int size);
|
||||
extern void smsg_out(int wNum, int wSize, int wColorR, int wColorG, int wColorB, int wFont, int wSpeed, int wLineSpace, int wAlign, int wRSize, int wRFont, int wRLineSpace, int *wLength);
|
||||
extern void smsg_clear(int wNum);
|
||||
|
||||
@@ -62,7 +62,7 @@ static int eventCB_ANIM(sprite_t *sp, agsevent_t *e) {
|
||||
sp->curcg = sp->cg3; break;
|
||||
}
|
||||
|
||||
// WARNING("anime update\n");
|
||||
// SACT_DEBUG("anime update\n");
|
||||
|
||||
// カウントアップ
|
||||
sp->u.anime.tick++;
|
||||
|
||||
@@ -101,8 +101,8 @@ int sp_draw2(sprite_t *sp, cginfo_t *cg) {
|
||||
if (cg->sf == NULL) return NG;
|
||||
|
||||
// 更新領域の確定
|
||||
update.width = sact.updaterect.width;
|
||||
update.height = sact.updaterect.height;
|
||||
update.width = sact.updaterect.w;
|
||||
update.height = sact.updaterect.h;
|
||||
sx = 0;
|
||||
sy = 0;
|
||||
dx = sp->cur.x - sact.updaterect.x;
|
||||
@@ -117,7 +117,7 @@ int sp_draw2(sprite_t *sp, cginfo_t *cg) {
|
||||
dx += sact.updaterect.x;
|
||||
dy += sact.updaterect.y;
|
||||
|
||||
if (cg->sf->has_alpha) {
|
||||
if (cg->sf->alpha) {
|
||||
// alpha map がある場合
|
||||
gre_BlendUseAMap(sf0, dx, dy,
|
||||
sf0, dx, dy,
|
||||
@@ -137,7 +137,7 @@ int sp_draw2(sprite_t *sp, cginfo_t *cg) {
|
||||
}
|
||||
}
|
||||
|
||||
WARNING("do update no=%d, sx=%d, sy=%d, w=%d, h=%d, dx=%d, dy=%d\n", sp->no, sx, sy, w, h, dx, dy);
|
||||
SACT_DEBUG("do update no=%d, sx=%d, sy=%d, w=%d, h=%d, dx=%d, dy=%d\n", sp->no, sx, sy, w, h, dx, dy);
|
||||
|
||||
return OK;
|
||||
}
|
||||
@@ -175,7 +175,7 @@ void sp_draw_dmap(void* data, void* userdata) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (cg->sf->has_alpha) {
|
||||
if (cg->sf->alpha) {
|
||||
fill_dmap_mask(cg->sf, sx, sy, dx, dy, w, h, sp->no);
|
||||
} else {
|
||||
fill_dmap(dx, dy, w, h, sp->no);
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
#include "surface.h"
|
||||
#include "sactcg.h"
|
||||
#include "counter.h"
|
||||
|
||||
#include "sdl_core.h"
|
||||
|
||||
|
||||
static void ec1_cb(surface_t *, surface_t *);
|
||||
@@ -131,7 +131,7 @@ static void ec1_cb(surface_t *sfsrc, surface_t *sfdst) {
|
||||
}
|
||||
gre_Blend(sf0, 0, 0, sfsrc, 0, 0, sfdst, 0, 0, sfsrc->width, sfsrc->height, curstep);
|
||||
|
||||
WARNING("step = %d\n", curstep);
|
||||
SACT_DEBUG("step = %d\n", curstep);
|
||||
ags_updateFull();
|
||||
|
||||
ecp.oldstep = curstep;
|
||||
@@ -144,7 +144,7 @@ static void ec7_cb(surface_t *sfsrc, surface_t *sfdst) {
|
||||
int i, t, y;
|
||||
|
||||
curstep = maxstep * (ecp.curtime - ecp.sttime)/ (ecp.edtime - ecp.sttime);
|
||||
WARNING("step = %d\n", curstep);
|
||||
SACT_DEBUG("step = %d\n", curstep);
|
||||
|
||||
if (ecp.oldstep == curstep) {
|
||||
usleep(0);
|
||||
@@ -172,7 +172,7 @@ static void ec8_cb(surface_t *sfsrc, surface_t *sfdst) {
|
||||
int i, t, x;
|
||||
|
||||
curstep = maxstep * (ecp.curtime - ecp.sttime) / (ecp.edtime - ecp.sttime);
|
||||
WARNING("step = %d\n", curstep);
|
||||
SACT_DEBUG("step = %d\n", curstep);
|
||||
|
||||
if (ecp.oldstep == curstep) {
|
||||
usleep(0);
|
||||
@@ -203,7 +203,7 @@ static void ec9_cb(surface_t *sfsrc, surface_t *sfdst) {
|
||||
sfsrc->width / EC9DELTA + EC9DELTA);
|
||||
|
||||
curstep = maxstep * (ecp.curtime - ecp.sttime)/ (ecp.edtime - ecp.sttime);
|
||||
WARNING("step = %d\n", curstep);
|
||||
SACT_DEBUG("step = %d\n", curstep);
|
||||
|
||||
if (ecp.oldstep == curstep) {
|
||||
usleep(0);
|
||||
@@ -237,7 +237,7 @@ static void ec12_cb(surface_t *src, surface_t *dst) {
|
||||
int j, st_i, ed_i, l;
|
||||
|
||||
curstep = maxstep * (ecp.curtime - ecp.sttime)/ (ecp.edtime - ecp.sttime);
|
||||
WARNING("step = %d\n", curstep);
|
||||
SACT_DEBUG("step = %d\n", curstep);
|
||||
|
||||
if (ecp.oldstep == curstep) {
|
||||
usleep(0); return;
|
||||
@@ -268,7 +268,7 @@ static void ec13_cb(surface_t *src, surface_t *dst) {
|
||||
int dyy = 0 + sf0->height -1;
|
||||
|
||||
curstep = maxstep * (ecp.curtime - ecp.sttime)/ (ecp.edtime - ecp.sttime);
|
||||
WARNING("step = %d\n", curstep);
|
||||
SACT_DEBUG("step = %d\n", curstep);
|
||||
|
||||
if (ecp.oldstep == curstep) {
|
||||
usleep(0); return;
|
||||
@@ -298,7 +298,7 @@ static void ec14_cb(surface_t *sfsrc, surface_t *sfdst) {
|
||||
if (ecp.oldstep == 0) {
|
||||
sf_copyall(sf0, sfdst);
|
||||
}
|
||||
Maskupdate(0, 0, sfsrc->width, sfsrc->height, 0, 0, 44, curstep);
|
||||
sdl_maskupdate(0, 0, sfsrc->width, sfsrc->height, 0, 0, 44, curstep);
|
||||
ecp.oldstep = curstep;
|
||||
}
|
||||
|
||||
@@ -311,7 +311,7 @@ static void ec15_cb(surface_t *sfsrc, surface_t *sfdst) {
|
||||
if (ecp.oldstep == 0) {
|
||||
sf_copyall(sf0, sfdst);
|
||||
}
|
||||
Maskupdate(0, 0, sfsrc->width, sfsrc->height, 0, 0, 45, curstep);
|
||||
sdl_maskupdate(0, 0, sfsrc->width, sfsrc->height, 0, 0, 45, curstep);
|
||||
ecp.oldstep = curstep;
|
||||
}
|
||||
|
||||
@@ -324,7 +324,7 @@ static void ec16_cb(surface_t *sfsrc, surface_t *sfdst) {
|
||||
if (ecp.oldstep == 0) {
|
||||
sf_copyall(sf0, sfdst);
|
||||
}
|
||||
Maskupdate(0, 0, sfsrc->width, sfsrc->height, 0, 0, 46, curstep);
|
||||
sdl_maskupdate(0, 0, sfsrc->width, sfsrc->height, 0, 0, 46, curstep);
|
||||
ecp.oldstep = curstep;
|
||||
}
|
||||
|
||||
@@ -337,7 +337,7 @@ static void ec17_cb(surface_t *sfsrc, surface_t *sfdst) {
|
||||
if (ecp.oldstep == 0) {
|
||||
sf_copyall(sf0, sfdst);
|
||||
}
|
||||
Maskupdate(0, 0, sfsrc->width, sfsrc->height, 0, 0, 47, curstep);
|
||||
sdl_maskupdate(0, 0, sfsrc->width, sfsrc->height, 0, 0, 47, curstep);
|
||||
ecp.oldstep = curstep;
|
||||
}
|
||||
|
||||
@@ -431,7 +431,7 @@ int sp_eupdate(int type, int time, int cancel) {
|
||||
|
||||
(*cb[type-1])(sfsrc, sfdst);
|
||||
rest = 15 - (get_high_counter(SYSTEMCOUNTER_MSEC) - ecp.curtime);
|
||||
key = sys_keywait(rest, cancel);
|
||||
key = sys_keywait(rest, cancel ? KEYWAIT_CANCELABLE : KEYWAIT_NONCANCELABLE);
|
||||
|
||||
if (cancel && key) break;
|
||||
}
|
||||
|
||||
@@ -10,7 +10,6 @@ static void do_aff(surface_t *in, surface_t *out, int deg, double zx, double zy)
|
||||
int i, j, m, n;
|
||||
|
||||
switch(in->depth) {
|
||||
case 15:
|
||||
case 16: {
|
||||
WORD *src, *dst;
|
||||
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
static void ec6_cb(surface_t *src, surface_t *dst) {
|
||||
int curstep, maxstep = 32;
|
||||
surface_t *st, *dt;
|
||||
static int slices[32]={4,8,12,16,20,28,36,40,44,48,56,64,72,80,88,96,
|
||||
88,80,72,64,56,48,44,40,36,28,24,20,16,12,8,4};
|
||||
static int slices[32]={4,8,12,16,20,28,36,40,44,48,56,64,72,80,88,96,
|
||||
88,80,72,64,56,48,44,40,36,28,24,20,16,12,8,4};
|
||||
|
||||
|
||||
curstep = maxstep * (ecp.curtime - ecp.sttime)/ (ecp.edtime - ecp.sttime);
|
||||
@@ -17,9 +17,13 @@ static void ec6_cb(surface_t *src, surface_t *dst) {
|
||||
st = sf_dup(src);
|
||||
dt = sf_dup(dst);
|
||||
|
||||
image_Mosaic(st, 0, 0, st->width, st->height, 0, 0, slices[curstep]);
|
||||
image_Mosaic(dt, 0, 0, dt->width, dt->height, 0, 0, slices[curstep]);
|
||||
|
||||
SDL_Surface *stt = com2surface(st);
|
||||
SDL_Surface *dtt = com2surface(dt);
|
||||
image_Mosaic(stt, 0, 0, stt->w, stt->h, 0, 0, slices[curstep]);
|
||||
image_Mosaic(dtt, 0, 0, dtt->w, dtt->h, 0, 0, slices[curstep]);
|
||||
SDL_FreeSurface(stt);
|
||||
SDL_FreeSurface(dtt);
|
||||
|
||||
gre_Blend(sf0, 0, 0, st, 0, 0, dt, 0, 0, st->width, st->height, curstep*8);
|
||||
ags_updateFull();
|
||||
|
||||
|
||||
@@ -44,7 +44,6 @@ static void do_per(surface_t *in, surface_t *out, float *k) {
|
||||
int ys = in->height /2;
|
||||
|
||||
switch(in->depth) {
|
||||
case 15:
|
||||
case 16: {
|
||||
WORD *src, *dst;
|
||||
|
||||
|
||||
@@ -4,7 +4,6 @@ static void uneune(surface_t *in, surface_t *out, int st) {
|
||||
int x, y, m, n;
|
||||
|
||||
switch(in->depth) {
|
||||
case 15:
|
||||
case 16: {
|
||||
WORD *src, *dst;
|
||||
for (y = 0; y < in->height; y++) {
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
#include <stdlib.h>
|
||||
#include "ngraph.h"
|
||||
#include "graph.h"
|
||||
|
||||
@@ -15,7 +16,7 @@ static void ec10_cb(surface_t *sfsrc, surface_t *sfdst) {
|
||||
|
||||
curstep = maxstep * (ecp.curtime - ecp.sttime)/ (ecp.edtime - ecp.sttime);
|
||||
turstep = maxstep / 2;
|
||||
WARNING("step = %d/%d\n", curstep, maxstep);
|
||||
SACT_DEBUG("step = %d/%d\n", curstep, maxstep);
|
||||
|
||||
if (curstep > turstep) {
|
||||
// 帰り
|
||||
@@ -42,7 +43,10 @@ static void ec10_cb(surface_t *sfsrc, surface_t *sfdst) {
|
||||
if (ec10_sf[0] == NULL) {
|
||||
ec10_sf[0] = sf_dup2(sfsrc, FALSE, FALSE);
|
||||
sf = ec10_sf[0];
|
||||
sf->has_alpha = FALSE;
|
||||
if (sf->alpha) {
|
||||
free(sf->alpha);
|
||||
sf->alpha = NULL;
|
||||
}
|
||||
gr_copy_stretch(sf, 0, 0, sf->width, sf->height, sfsrc, sx, sy, sw, sh);
|
||||
gr_bright_dst_only(sf, 0, 0, sf->width, sf->height, 255/6);
|
||||
return;
|
||||
|
||||
@@ -92,7 +92,7 @@ static void cb_focused_swsp(void* s, void* data) {
|
||||
int *update = (int *)data;
|
||||
boolean oldstate = sp->show;
|
||||
|
||||
WARNING("show up spex %d\n", sp->no);
|
||||
SACT_DEBUG("show up spex %d\n", sp->no);
|
||||
|
||||
sp->show = TRUE;
|
||||
if (oldstate != sp->show) {
|
||||
@@ -110,7 +110,7 @@ static void cb_defocused_swsp(void* s, void* data) {
|
||||
int *update = (int *)data;
|
||||
boolean oldstate = sp->show;
|
||||
|
||||
WARNING("hide spex %d\n", sp->no);
|
||||
SACT_DEBUG("hide spex %d\n", sp->no);
|
||||
|
||||
sp->show = FALSE;
|
||||
if (oldstate != sp->show) {
|
||||
@@ -174,7 +174,7 @@ static int cb_focused(sprite_t *sp) {
|
||||
update++;
|
||||
}
|
||||
sp->focused = TRUE;
|
||||
WARNING("get forcused %d, type %d\n", sp->no, sp->type);
|
||||
SACT_DEBUG("get forcused %d, type %d\n", sp->no, sp->type);
|
||||
if (sp->numsound1) {
|
||||
ssnd_play(sp->numsound1);
|
||||
}
|
||||
@@ -197,7 +197,7 @@ static int cb_defocused(sprite_t *sp) {
|
||||
sp->curcg = sp->cg1;
|
||||
update++;
|
||||
sp->focused = FALSE;
|
||||
WARNING("lost forcused %d\n", sp->no);
|
||||
SACT_DEBUG("lost forcused %d\n", sp->no);
|
||||
}
|
||||
|
||||
return update;
|
||||
@@ -270,7 +270,8 @@ static void cb_waitkey_simple(agsevent_t *e) {
|
||||
/*
|
||||
WaitKeySpriteのcallback
|
||||
*/
|
||||
static void cb_waitkey_sprite(agsevent_t *e) {
|
||||
EMSCRIPTEN_KEEPALIVE
|
||||
void cb_waitkey_sprite(agsevent_t *e) {
|
||||
SList *node;
|
||||
sprite_t *focused_sp = NULL; // focus を得ている sprite
|
||||
sprite_t *defocused_sp = NULL; // focus を失った sprite
|
||||
@@ -285,7 +286,7 @@ static void cb_waitkey_sprite(agsevent_t *e) {
|
||||
|
||||
if (sact.draggedsp) {
|
||||
// 先に drag中のspriteにイベントを送る
|
||||
update = sact.draggedsp->eventcb(sact.draggedsp, e);
|
||||
update = sact.draggedsp->eventcb(sact.draggedsp, e); // Async in emscripten
|
||||
} else {
|
||||
// 右クリックキャンセル
|
||||
// drag中でない時のみ、キャンセルを受け付ける
|
||||
|
||||
@@ -53,7 +53,7 @@ static void hidesprite(sprite_t *sp) {
|
||||
sp->blendrate = i;
|
||||
sp_updateme(sp);
|
||||
sp_update_clipped();
|
||||
sys_keywait(10, FALSE);
|
||||
sys_keywait(10, KEYWAIT_NONCANCELABLE);
|
||||
}
|
||||
|
||||
sp_updateme(sp);
|
||||
@@ -142,7 +142,7 @@ int sp_keywait(int *vOK, int *vRND, int *vD01, int *vD02, int *vD03, int timeout
|
||||
agse.d1 = p.x;
|
||||
agse.d2 = p.y;
|
||||
agse.d3 = 0;
|
||||
nact->ags.eventcb(&agse);
|
||||
spev_callback(&agse);
|
||||
}
|
||||
|
||||
// 終了時間の計算
|
||||
@@ -150,8 +150,8 @@ int sp_keywait(int *vOK, int *vRND, int *vD01, int *vD02, int *vD03, int timeout
|
||||
endtime = timeout < 0 ? INT_MAX : (curtime + timeout * 10);
|
||||
|
||||
// スプライトキー待ちメイン
|
||||
while (!waitcond(endtime)) {
|
||||
sys_keywait(25, TRUE);
|
||||
while (!waitcond(endtime) && !nact->is_quit) {
|
||||
sys_keywait(25, KEYWAIT_CANCELABLE);
|
||||
}
|
||||
|
||||
if (sact.waitkey == 0) {
|
||||
|
||||
@@ -33,6 +33,7 @@
|
||||
#include "sact.h"
|
||||
#include "sprite.h"
|
||||
#include "counter.h"
|
||||
#include "sdl_core.h"
|
||||
|
||||
/*
|
||||
|
||||
@@ -74,7 +75,7 @@ static int move_cb(sprite_t *sp, agsevent_t *e) {
|
||||
// 現在時刻の取得
|
||||
now = sact.movecurtime;
|
||||
|
||||
WARNING("no = %d now = %d st = %d, ed = %d\n",
|
||||
SACT_DEBUG("no = %d now = %d st = %d, ed = %d\n",
|
||||
sp->no, now, sp->move.starttime, sp->move.endtime);
|
||||
|
||||
if (now >= sp->move.endtime) {
|
||||
@@ -135,7 +136,7 @@ void spev_move_setup(void* data, void* userdata) {
|
||||
// タイマコールバック登録
|
||||
spev_add_teventlistener(sp, move_cb);
|
||||
|
||||
WARNING("no=%d,from(%d,%d@%d)to(%d,%d@%d),time=%d\n", sp->no,
|
||||
SACT_DEBUG("no=%d,from(%d,%d@%d)to(%d,%d@%d),time=%d\n", sp->no,
|
||||
sp->cur.x, sp->cur.y, sp->move.starttime,
|
||||
sp->move.to.x, sp->move.to.y, sp->move.endtime,
|
||||
sp->move.time);
|
||||
@@ -164,6 +165,7 @@ void spev_move_waitend(sprite_t *sp, int dx, int dy, int time) {
|
||||
|
||||
while (sp->move.moving) {
|
||||
nact->callback();
|
||||
sdl_wait_vsync();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -182,6 +184,7 @@ void spev_wait4moving_sp() {
|
||||
|
||||
while (sp->move.moving) {
|
||||
nact->callback();
|
||||
sdl_wait_vsync();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+12
-25
@@ -38,7 +38,6 @@
|
||||
#include "ngraph.h"
|
||||
#include "drawtext.h"
|
||||
#include "sactlog.h"
|
||||
#include "utfsjis.h"
|
||||
|
||||
// メッセージキー待ちの時、表示するアニメーションに関する情報
|
||||
struct markinfo {
|
||||
@@ -188,17 +187,11 @@ static int setupmark(int wNum1, int wNum2, struct markinfo *minfo) {
|
||||
|
||||
@param msg: 追加する文字列
|
||||
*/
|
||||
void smsg_add(char *msg) {
|
||||
void smsg_add(const char *msg) {
|
||||
int len;
|
||||
|
||||
if (msg[0] == '\0') return;
|
||||
|
||||
if (0) {
|
||||
char *b = sjis2lang(msg);
|
||||
fprintf(stderr, "add msg '%s'\n", b);
|
||||
free(b);
|
||||
}
|
||||
|
||||
len = MSGBUFMAX - (int)strlen(sact.msgbuf);
|
||||
if (len < 0) {
|
||||
WARNING("buf shortage (%d)\n", len);
|
||||
@@ -304,12 +297,6 @@ void smsg_out(int wNum, int wSize, int wColorR, int wColorG, int wColorB, int wF
|
||||
}
|
||||
dt_setfont(wFont, wSize);
|
||||
|
||||
if (0) {
|
||||
char *b = sjis2lang(mbuf);
|
||||
fprintf(stderr, "msg '%s'\n", b);
|
||||
free(b);
|
||||
}
|
||||
|
||||
cw = dt_drawtext_col(sp->u.msg.canvas,
|
||||
sp->u.msg.dspcur.x,
|
||||
sp->u.msg.dspcur.y + wRSize + wRLineSpace,
|
||||
@@ -332,7 +319,7 @@ void smsg_out(int wNum, int wSize, int wColorR, int wColorG, int wColorB, int wF
|
||||
// keywait
|
||||
delta = get_high_counter(SYSTEMCOUNTER_MSEC) - wcnt;
|
||||
if (delta < wSpeed) {
|
||||
if (sys_keywait(wSpeed - delta, FALSE)) {
|
||||
if (sys_keywait(wSpeed - delta, KEYWAIT_NONCANCELABLE)) {
|
||||
|
||||
wSpeed = 0;
|
||||
}
|
||||
@@ -349,9 +336,9 @@ void smsg_out(int wNum, int wSize, int wColorR, int wColorG, int wColorB, int wF
|
||||
|
||||
// Waitなしの出力は最後にupdate
|
||||
if (needupdate) {
|
||||
uparea.width = sp->cursize.width;
|
||||
uparea.height = min(sp->cursize.height, uparea.y - sp->u.msg.dspcur.y + wLineSpace + wLineSpace + wRSize);
|
||||
sp_updateme_part(sp, uparea.x, uparea.y, uparea.width, uparea.height);
|
||||
uparea.w = sp->cursize.width;
|
||||
uparea.h = min(sp->cursize.height, uparea.y - sp->u.msg.dspcur.y + wLineSpace + wLineSpace + wRSize);
|
||||
sp_updateme_part(sp, uparea.x, uparea.y, uparea.w, uparea.h);
|
||||
}
|
||||
|
||||
// ????
|
||||
@@ -392,10 +379,10 @@ void smsg_clear(int wNum) {
|
||||
|
||||
/*
|
||||
出力中の文字列があるかチェック
|
||||
@return: なし(0) , あり(1)
|
||||
@return: なし(1) , あり(0)
|
||||
*/
|
||||
int smsg_is_empty() {
|
||||
return (sact.msgbuf[0] != '\0');
|
||||
return (sact.msgbuf[0] == '\0');
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -416,7 +403,7 @@ int smsg_keywait(int wNum1, int wNum2, int msglen) {
|
||||
sact.waittype = KEYWAIT_MESSAGE;
|
||||
sact.waitkey = -1;
|
||||
|
||||
while (sact.waitkey == -1) {
|
||||
while (sact.waitkey == -1 && !nact->is_quit) {
|
||||
int st = get_high_counter(SYSTEMCOUNTER_MSEC);
|
||||
int interval = 25;
|
||||
|
||||
@@ -431,7 +418,7 @@ int smsg_keywait(int wNum1, int wNum2, int msglen) {
|
||||
update_mark(minfo[j].sp, minfo[j].cg);
|
||||
i++;
|
||||
}
|
||||
sys_keywait(interval - (get_high_counter(SYSTEMCOUNTER_MSEC) - st), FALSE);
|
||||
sys_keywait(interval - (get_high_counter(SYSTEMCOUNTER_MSEC) - st), KEYWAIT_NONCANCELABLE);
|
||||
}
|
||||
|
||||
sact.waittype = KEYWAIT_NONE;
|
||||
@@ -451,8 +438,8 @@ int smsg_update(sprite_t *sp) {
|
||||
// -> 説明スプライトのように、SetShowされたときに対応できないからだめ
|
||||
//if (sact.msgbufempty) return OK;
|
||||
|
||||
update.width = sact.updaterect.width;
|
||||
update.height = sact.updaterect.height;
|
||||
update.width = sact.updaterect.w;
|
||||
update.height = sact.updaterect.h;
|
||||
|
||||
dx = sp->cur.x - sact.updaterect.x;
|
||||
dy = sp->cur.y - sact.updaterect.y;
|
||||
@@ -471,7 +458,7 @@ int smsg_update(sprite_t *sp) {
|
||||
|
||||
gre_BlendUseAMap(sf0, dx, dy, sf0, dx, dy, sp->u.msg.canvas, sx, sy, w, h, sp->u.msg.canvas, sx, sy, sp->blendrate);
|
||||
|
||||
WARNING("do update no=%d, sx=%d, sy=%d, w=%d, h=%d, dx=%d, dy=%d\n",
|
||||
SACT_DEBUG("do update no=%d, sx=%d, sy=%d, w=%d, h=%d, dx=%d, dy=%d\n",
|
||||
sp->no, sx, sy, w, h, dx, dy);
|
||||
|
||||
return OK;
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user