mirror of
https://github.com/kichikuou/xsystem35-sdl2.git
synced 2026-09-22 22:48:08 +03:00
Compare commits
240
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 |
@@ -1,5 +1,5 @@
|
||||
name: Android Build
|
||||
on: [push]
|
||||
on: [push, pull_request]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
@@ -11,15 +11,16 @@ jobs:
|
||||
- name: Install Deps
|
||||
run: sudo apt install ninja-build
|
||||
|
||||
- name: set up JDK 1.8
|
||||
uses: actions/setup-java@v1
|
||||
# Workaround for https://github.com/actions/virtual-environments/issues/3078
|
||||
- name: Setup cmake
|
||||
uses: jwlawson/actions-setup-cmake@v1.9
|
||||
with:
|
||||
java-version: 1.8
|
||||
cmake-version: '3.19.x'
|
||||
|
||||
- name: Build
|
||||
run: |
|
||||
cd android
|
||||
./gradlew assembleRelease
|
||||
ANDROID_NDK_HOME=$ANDROID_SDK_ROOT/ndk-bundle ./gradlew assembleRelease
|
||||
|
||||
- name: Upload artifacts
|
||||
uses: actions/upload-artifact@v1
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
name: Emscripten Build
|
||||
on: [push]
|
||||
on: [push, pull_request]
|
||||
|
||||
env:
|
||||
emscripten-version: 1.39.16
|
||||
EM_VERSION: 2.0.25
|
||||
EM_CACHE_FOLDER: 'emsdk-cache'
|
||||
|
||||
jobs:
|
||||
build:
|
||||
@@ -11,32 +12,21 @@ jobs:
|
||||
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
- name: Cache emsdk
|
||||
uses: actions/cache@v1
|
||||
id: cache
|
||||
- name: Setup cache
|
||||
id: cache-system-libraries
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: emsdk-cache
|
||||
key: ${{ runner.os }}-emsdk-${{ env.emscripten-version }}
|
||||
|
||||
- name: Cache .emscripten_cache
|
||||
uses: actions/cache@v1
|
||||
with:
|
||||
path: emscripten-cache
|
||||
key: emscripten-cache-${{ env.emscripten-version }}
|
||||
path: ${{env.EM_CACHE_FOLDER}}
|
||||
key: ${{env.EM_VERSION}}-${{ runner.os }}
|
||||
|
||||
- name: Setup Emscripten toolchain
|
||||
uses: mymindstorm/setup-emsdk@v3
|
||||
uses: mymindstorm/setup-emsdk@v10
|
||||
with:
|
||||
version: ${{ env.emscripten-version }}
|
||||
actions-cache-folder: emsdk-cache
|
||||
no-cache: true
|
||||
version: ${{ env.EM_VERSION }}
|
||||
actions-cache-folder: ${{env.EM_CACHE_FOLDER}}
|
||||
|
||||
- name: Build
|
||||
env:
|
||||
EM_CACHE: ${{ github.workspace }}/emscripten-cache/cache
|
||||
EM_PORTS: ${{ github.workspace }}/emscripten-cache/ports
|
||||
run: |
|
||||
mkdir -p emscripten-cache
|
||||
mkdir -p out/wasm
|
||||
cd out/wasm
|
||||
emcmake cmake -DCMAKE_BUILD_TYPE=MinSizeRel ../../
|
||||
@@ -45,7 +35,7 @@ jobs:
|
||||
mv src/xsystem35.* xsystem35/
|
||||
|
||||
- name: Upload artifacts
|
||||
uses: actions/upload-artifact@v1
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: xsystem35-wasm
|
||||
path: out/wasm/xsystem35
|
||||
|
||||
@@ -1,25 +1,29 @@
|
||||
name: Linux Build
|
||||
on: [push]
|
||||
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 libsdl2-dev libsdl2-ttf-dev libsdl2-mixer-dev
|
||||
sudo apt install libgtk-3-dev libsdl2-dev libsdl2-ttf-dev libsdl2-mixer-dev libportmidi-dev libcjson-dev
|
||||
|
||||
- name: Build
|
||||
run: |
|
||||
mkdir -p out/debug
|
||||
cd out/debug
|
||||
cmake -DCMAKE_BUILD_TYPE=Debug ../../
|
||||
mkdir -p out/${{ matrix.build-type }}
|
||||
cd out/${{ matrix.build-type }}
|
||||
cmake -DCMAKE_BUILD_TYPE=${{ matrix.build-type }} ../../
|
||||
make
|
||||
|
||||
- name: Test
|
||||
run: ctest
|
||||
working-directory: out/debug
|
||||
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
|
||||
|
||||
+50
-96
@@ -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,14 +15,6 @@ 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)
|
||||
@@ -36,57 +29,62 @@ 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)
|
||||
if (NOT DEFINED ENABLE_MODULES)
|
||||
set(ENABLE_MODULES 1)
|
||||
endif()
|
||||
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)
|
||||
set(ENABLE_MODULES 1)
|
||||
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)
|
||||
include(FindPkgConfig)
|
||||
optional_pkg_check_modules(GTK3 IMPORTED_TARGET gtk+-3.0)
|
||||
if (GTK3_FOUND)
|
||||
set(ENABLE_GTK 1)
|
||||
endif()
|
||||
|
||||
optional_find_package(Freetype)
|
||||
pkg_check_modules(SDL2 IMPORTED_TARGET sdl2)
|
||||
pkg_check_modules(SDL2TTF IMPORTED_TARGET SDL2_ttf)
|
||||
optional_pkg_check_modules(SDL2MIXER IMPORTED_TARGET SDL2_mixer)
|
||||
|
||||
include(FindPkgConfig)
|
||||
if (NOT X11_FOUND)
|
||||
optional_pkg_check_modules(SDL2 IMPORTED_TARGET sdl2)
|
||||
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()
|
||||
|
||||
optional_pkg_check_modules(SDL2MIXER IMPORTED_TARGET SDL2_mixer)
|
||||
optional_pkg_check_modules(SDL2TTF IMPORTED_TARGET SDL2_ttf)
|
||||
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)
|
||||
@@ -98,31 +96,18 @@ elseif (GTK2_FOUND)
|
||||
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()
|
||||
@@ -155,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
|
||||
|
||||
@@ -181,6 +166,7 @@ else()
|
||||
else ()
|
||||
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")
|
||||
@@ -191,46 +177,18 @@ else()
|
||||
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
|
||||
@@ -246,11 +204,9 @@ 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("------------------")
|
||||
|
||||
@@ -267,7 +223,5 @@ if (ENABLE_NLS)
|
||||
add_subdirectory(po)
|
||||
endif()
|
||||
|
||||
if (ENABLE_MODULES)
|
||||
add_subdirectory(modules)
|
||||
target_link_libraries(xsystem35 PRIVATE 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/).
|
||||
|
||||
+11
-11
@@ -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
|
||||
|
||||
@@ -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 3
|
||||
versionName "0.2.0"
|
||||
targetSdkVersion 28
|
||||
versionCode 5
|
||||
versionName "0.2.3"
|
||||
externalNativeBuild {
|
||||
cmake {
|
||||
arguments "-DANDROID_APP_PLATFORM=android-16", "-DANDROID_STL=c++_static"
|
||||
|
||||
@@ -9,21 +9,21 @@ project(GAME)
|
||||
include(FetchContent)
|
||||
FetchContent_Declare(
|
||||
SDL
|
||||
URL http://libsdl.org/release/SDL2-2.0.12.tar.gz
|
||||
URL_HASH SHA1=e8ba91bf5eb438dbcf1fedf0530a1bcbe30d3bb6
|
||||
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
|
||||
@@ -40,11 +40,8 @@ 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()
|
||||
|
||||
|
||||
@@ -74,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,9 +17,13 @@
|
||||
*/
|
||||
package io.github.kichikuou.xsystem35
|
||||
|
||||
import android.app.AlertDialog
|
||||
import android.media.MediaPlayer
|
||||
import android.os.Bundle
|
||||
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
|
||||
@@ -29,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
|
||||
@@ -63,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.
|
||||
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(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) {
|
||||
|
||||
@@ -35,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)
|
||||
}
|
||||
|
||||
@@ -73,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() {
|
||||
@@ -84,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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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;
|
||||
@@ -275,6 +276,7 @@ public class HIDDeviceManager {
|
||||
0x15e4, // Numark
|
||||
0x162e, // Joytech
|
||||
0x1689, // Razer Onza
|
||||
0x1949, // Lab126, Inc.
|
||||
0x1bad, // Harmonix
|
||||
0x24c6, // PowerA
|
||||
};
|
||||
@@ -353,9 +355,18 @@ public class HIDDeviceManager {
|
||||
|
||||
private void connectHIDDeviceUSB(UsbDevice usbDevice) {
|
||||
synchronized (this) {
|
||||
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();
|
||||
mDevicesById.put(id, device);
|
||||
@@ -373,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) {
|
||||
|
||||
@@ -53,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 = "";
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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番のアニメーション開始。終るまで制御を戻さない。
|
||||
|
||||
+45
-9
@@ -1,7 +1,5 @@
|
||||
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../src)
|
||||
|
||||
add_subdirectory(lib)
|
||||
|
||||
add_library(modules STATIC
|
||||
modules.c
|
||||
AliceLogo/AliceLogo.c
|
||||
@@ -61,6 +59,31 @@ add_library(modules STATIC
|
||||
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
|
||||
@@ -68,10 +91,23 @@ add_library(modules STATIC
|
||||
tDemo/tDemo.c
|
||||
)
|
||||
|
||||
target_include_directories(modules PUBLIC .)
|
||||
target_include_directories(modules PUBLIC . lib)
|
||||
|
||||
target_compile_options(modules PRIVATE -Wno-pointer-sign -Wno-invalid-source-encoding)
|
||||
target_link_libraries(modules PRIVATE graph alk drawtext list)
|
||||
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()
|
||||
|
||||
target_compile_options(modules PRIVATE -Wno-pointer-sign)
|
||||
|
||||
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()
|
||||
|
||||
if (SDL2MIXER_FOUND)
|
||||
if (ANDROID)
|
||||
@@ -81,12 +117,12 @@ if (SDL2MIXER_FOUND)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
include(FindJPEG)
|
||||
if (JPEG_FOUND)
|
||||
target_compile_definitions(modules PRIVATE HAVE_JPEG)
|
||||
if (HAVE_JPEG)
|
||||
target_sources(modules PRIVATE
|
||||
NightDemonDemo/ndd.c
|
||||
NightDemonDemo/jpeg2surface.c
|
||||
)
|
||||
target_link_libraries(modules PRIVATE JPEG::JPEG)
|
||||
if (NOT EMSCRIPTEN)
|
||||
target_link_libraries(modules PRIVATE JPEG::JPEG)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
@@ -14,7 +14,7 @@ static void Init() {
|
||||
}
|
||||
|
||||
static void ExistKeyFile() {
|
||||
char *p1 = sys_getString(0);
|
||||
const char *p1 = sl_getString(0);
|
||||
int *p2 = getCaliVariable();
|
||||
int *var = getCaliVariable();
|
||||
|
||||
@@ -24,7 +24,7 @@ static void ExistKeyFile() {
|
||||
}
|
||||
|
||||
static void CheckProtectFile() {
|
||||
char *p1 = sys_getString(0);
|
||||
const char *p1 = sl_getString(0);
|
||||
int *p2 = getCaliVariable();
|
||||
int *var = getCaliVariable();
|
||||
|
||||
@@ -34,7 +34,7 @@ static void CheckProtectFile() {
|
||||
}
|
||||
|
||||
static void CreateKeyFile() {
|
||||
char *p1 = sys_getString(0);
|
||||
const char *p1 = sl_getString(0);
|
||||
int *p2 = getCaliVariable();
|
||||
int *var = getCaliVariable();
|
||||
|
||||
|
||||
+7
-19
@@ -120,10 +120,9 @@ static int load_cg_main(int no) {
|
||||
|
||||
sno = find_null_surface();
|
||||
|
||||
sf->no = sno;
|
||||
suf[sno] = sf;
|
||||
|
||||
return sf->no;
|
||||
return sno;
|
||||
}
|
||||
|
||||
static void Init() {
|
||||
@@ -165,7 +164,7 @@ static void Create() {
|
||||
*var = 0;
|
||||
} else {
|
||||
int no = find_null_surface();
|
||||
*var = s->no = no;
|
||||
*var = no;
|
||||
suf[no] = s;
|
||||
}
|
||||
|
||||
@@ -193,7 +192,7 @@ static void CreatePixelOnly() {
|
||||
*var = 0;
|
||||
} else {
|
||||
int no = find_null_surface();
|
||||
*var = s->no = no;
|
||||
*var = no;
|
||||
suf[no] = s;
|
||||
}
|
||||
|
||||
@@ -219,7 +218,7 @@ static void CreateAMapOnly() {
|
||||
*var = 0;
|
||||
} else {
|
||||
int no = find_null_surface();
|
||||
*var = s->no = no;
|
||||
*var = no;
|
||||
suf[no] = s;
|
||||
}
|
||||
|
||||
@@ -243,7 +242,7 @@ static 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);
|
||||
@@ -265,7 +264,7 @@ static 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);
|
||||
@@ -287,7 +286,7 @@ static 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);
|
||||
@@ -421,7 +420,6 @@ static 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);
|
||||
@@ -466,7 +464,6 @@ static 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);
|
||||
@@ -539,7 +536,6 @@ static 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);
|
||||
@@ -716,7 +712,6 @@ static 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);
|
||||
}
|
||||
@@ -735,7 +730,6 @@ static 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);
|
||||
}
|
||||
@@ -857,7 +851,6 @@ static 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);
|
||||
@@ -885,7 +878,6 @@ static 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);
|
||||
@@ -1005,7 +997,6 @@ static 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);
|
||||
@@ -1057,7 +1048,6 @@ static 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);
|
||||
@@ -1095,7 +1085,6 @@ static 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);
|
||||
@@ -1162,7 +1151,6 @@ static 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);
|
||||
|
||||
@@ -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;
|
||||
|
||||
+44
-25
@@ -1,69 +1,88 @@
|
||||
#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;
|
||||
|
||||
static void Init() {
|
||||
int *p1 = getCaliVariable();
|
||||
int p2 = getCaliValue(); /* ISys3x */
|
||||
int p3 = getCaliValue();
|
||||
int p4 = getCaliValue();
|
||||
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);
|
||||
}
|
||||
|
||||
static void Start() {
|
||||
int *p1 = getCaliVariable();
|
||||
int p2 = getCaliValue();
|
||||
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);
|
||||
}
|
||||
|
||||
static void SetValid() {
|
||||
int p1 = getCaliValue();
|
||||
int p1 = getCaliValue();
|
||||
|
||||
valid = p1;
|
||||
msgskip_pause(!valid);
|
||||
|
||||
|
||||
DEBUG_COMMAND("MsgSkip.SetValid %d:\n", p1);
|
||||
}
|
||||
|
||||
static void GetValid() {
|
||||
int *p1 = getCaliVariable();
|
||||
|
||||
DEBUG_COMMAND_YET("MsgSkip.GetValid %p:\n", p1);
|
||||
int *p1 = getCaliVariable();
|
||||
|
||||
*p1 = valid;
|
||||
|
||||
DEBUG_COMMAND("MsgSkip.GetValid %p:\n", p1);
|
||||
}
|
||||
|
||||
static void SetAction() {
|
||||
int p1 = getCaliValue();
|
||||
|
||||
int p1 = getCaliValue();
|
||||
|
||||
action = p1;
|
||||
|
||||
DEBUG_COMMAND("MsgSkip.SetAcion %d:\n", p1);
|
||||
}
|
||||
|
||||
static void GetAction() {
|
||||
int *p1 = getCaliVariable();
|
||||
|
||||
DEBUG_COMMAND_YET("MsgSkip.GetAcion %p:\n", p1);
|
||||
int *p1 = getCaliVariable();
|
||||
|
||||
*p1 = action;
|
||||
|
||||
DEBUG_COMMAND("MsgSkip.GetAcion %p:\n", p1);
|
||||
}
|
||||
|
||||
static void PushStr() {
|
||||
int p1 = getCaliValue();
|
||||
int p1 = getCaliValue();
|
||||
|
||||
DEBUG_COMMAND_YET("MsgSkip.PushStr %d:\n", p1);
|
||||
}
|
||||
|
||||
static void PopStr() {
|
||||
int p1 = getCaliValue();
|
||||
int p1 = getCaliValue();
|
||||
|
||||
DEBUG_COMMAND_YET("MsgSkip.PopStr %d:\n", p1);
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ static void Init(void) { /* 0 */
|
||||
}
|
||||
|
||||
static void InitGame() { /* 1 */
|
||||
nact->ags.font->antialiase_on = TRUE;
|
||||
ags_setAntialiasedStringMode(TRUE);
|
||||
sys_setHankakuMode(2);
|
||||
|
||||
nact->msgout = ntmsg_add;
|
||||
|
||||
@@ -193,8 +193,6 @@ void nt_gr_draw(int effectno) {
|
||||
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);
|
||||
|
||||
+13
-23
@@ -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
|
||||
@@ -102,7 +104,7 @@ void ntmsg_init() {
|
||||
|
||||
|
||||
// 主人公名前
|
||||
nt_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;
|
||||
@@ -179,19 +181,13 @@ void ntmsg_newline() {
|
||||
ntmsg_add(buf);
|
||||
}
|
||||
|
||||
void ntmsg_add(char *msg) {
|
||||
void ntmsg_add(const char *msg) {
|
||||
int len;
|
||||
|
||||
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);
|
||||
@@ -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,
|
||||
@@ -284,7 +274,7 @@ static void ntmsg_out(int wNum, int wSize, int wColorR, int wColorG, int wColorB
|
||||
// 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);
|
||||
nt_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;
|
||||
@@ -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;
|
||||
|
||||
@@ -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 */
|
||||
|
||||
|
||||
@@ -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());
|
||||
//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;
|
||||
|
||||
+11
-25
@@ -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"
|
||||
@@ -204,24 +203,14 @@ int nt_scg_create_blend(int wNumDstCG, int wNumBaseCG, int wX, int wY, int wNumB
|
||||
// 指定の文字列のCGを作成
|
||||
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;
|
||||
@@ -242,8 +231,6 @@ int nt_scg_create_text(int wNumCG, int wSize, int wR, int wG, int wB, char *cTex
|
||||
// 数字文字列のCGを作成
|
||||
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 nt_scg_create_textnum(int wNumCG, int wSize, int wR, int wG, int wB, int wFi
|
||||
}
|
||||
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;
|
||||
@@ -322,15 +308,15 @@ int nt_scg_cut(int wNumDstCG, int wNumSrcCG, int wX, int wY, int wWidth, int wHe
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -363,17 +349,17 @@ int nt_scg_partcopy(int wNumDstCG, int wNumSrcCG, int wX, int wY, int wWidth, in
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -498,7 +484,7 @@ int nt_scg_existalphamap(int wNumCG, int *ret) {
|
||||
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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -97,8 +97,8 @@ int nt_sstr_regist_replace(char *sstr, char *dstr) {
|
||||
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;
|
||||
}
|
||||
@@ -118,7 +118,7 @@ int nt_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;
|
||||
}
|
||||
|
||||
@@ -1,2 +0,0 @@
|
||||
#define SNAME_RYO "亮 "
|
||||
#define SNAME_RYO_DEF "亮"
|
||||
@@ -60,8 +60,8 @@ int nt_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 nt_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,
|
||||
@@ -116,8 +116,8 @@ int nt_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;
|
||||
|
||||
@@ -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 *);
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -428,7 +428,7 @@ int nt_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;
|
||||
|
||||
//SACT_DEBUG("r1x=%d,r1y=%d,r1w=%d,r1h=%d\n", r1->x, r1->y, r1->width, r1->height);
|
||||
//SACT_DEBUG("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;
|
||||
|
||||
//SACT_DEBUG("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);
|
||||
|
||||
SACT_DEBUG("clipped area x=%d y=%d w=%d h=%d\n",
|
||||
result.x, result.y,
|
||||
result.width, result.height);
|
||||
result.x, result.y, result.w, result.h);
|
||||
|
||||
return result;
|
||||
}
|
||||
@@ -158,16 +121,14 @@ int nt_sp_update_clipped() {
|
||||
// 更新領域の確定
|
||||
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;
|
||||
}
|
||||
@@ -185,13 +146,13 @@ int nt_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);
|
||||
|
||||
SACT_DEBUG("x = %d, y = %d, spno = %d w=%d,h=%d\n",
|
||||
r->x, r->y, sp->no, r->width, r->height);
|
||||
r->x, r->y, sp->no, r->w, r->h);
|
||||
|
||||
return OK;
|
||||
}
|
||||
@@ -213,13 +174,13 @@ int nt_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);
|
||||
|
||||
SACT_DEBUG("x = %d, y = %d, spno = %d w=%d,h=%d\n",
|
||||
r->x, r->y, sp->no, r->width, r->height);
|
||||
r->x, r->y, sp->no, r->w, r->h);
|
||||
|
||||
return OK;
|
||||
}
|
||||
@@ -252,8 +213,8 @@ int nt_sp_draw_wall(sprite_t *sp, MyRectangle *area) {
|
||||
|
||||
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);
|
||||
|
||||
SACT_DEBUG("do update no=%d, sx=%d, sy=%d, w=%d, h=%d, \n",
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
#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);
|
||||
|
||||
static void Init() {
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
+11
-10
@@ -29,6 +29,7 @@
|
||||
#include "portab.h"
|
||||
#include "system.h"
|
||||
#include "input.h"
|
||||
#include "msgskip.h"
|
||||
#include "xsystem35.h"
|
||||
#include "gametitle.h"
|
||||
#include "message.h"
|
||||
@@ -103,9 +104,9 @@ static void Init() {
|
||||
int p1 = getCaliValue(); /* ISys3x */
|
||||
|
||||
// ゲームタイトルによるバージョン設定
|
||||
if (0 == strcmp(nact->game_title_name, GT_ESUKA)) {
|
||||
if (0 == strcmp(nact->game_title_utf8, GT_ESUKA)) {
|
||||
sact.version = 100;
|
||||
} else if (0 == strcmp(nact->game_title_name, GT_RANCE5D)){
|
||||
} else if (0 == strcmp(nact->game_title_utf8, GT_RANCE5D)){
|
||||
sact.version = 110;
|
||||
} else {
|
||||
sact.version = 120;
|
||||
@@ -132,7 +133,7 @@ static void Init() {
|
||||
sact.dmap = sf_create_pixel(sf0->width, sf0->height, 16);
|
||||
|
||||
// その他 System35 のデフォルト動作の変更
|
||||
nact->ags.font->antialiase_on = TRUE;
|
||||
ags_setAntialiasedStringMode(TRUE);
|
||||
sys_setHankakuMode(2); // 全角半角変換無し
|
||||
ags_autorepeat(FALSE); // key auto repeat off
|
||||
|
||||
@@ -1011,8 +1012,8 @@ static void WaitKeySimple() {
|
||||
sact.waittype = KEYWAIT_SIMPLE;
|
||||
sact.waitkey = -1;
|
||||
|
||||
while(sact.waitkey == -1) {
|
||||
sys_keywait(25, TRUE);
|
||||
while (sact.waitkey == -1 && !nact->is_quit) {
|
||||
sys_keywait(25, KEYWAIT_CANCELABLE);
|
||||
}
|
||||
|
||||
sact.waittype = KEYWAIT_NONE;
|
||||
@@ -1101,7 +1102,7 @@ static void WaitKeySimpleTimeOut() {
|
||||
sact.waittype = KEYWAIT_SIMPLE;
|
||||
sact.waitkey = -1;
|
||||
|
||||
sys_keywait(wTime * 10, TRUE);
|
||||
sys_keywait(wTime * 10, KEYWAIT_CANCELABLE);
|
||||
if (sact.waitkey == -1) {
|
||||
*vD03 = 1;
|
||||
*vRND = 0;
|
||||
@@ -1146,7 +1147,7 @@ static void WaitKeySpriteTimeOut() {
|
||||
static void QueryMessageSkip() {
|
||||
int *vSkip = getCaliVariable();
|
||||
|
||||
*vSkip = get_skipMode() ? 1 : 0;
|
||||
*vSkip = msgskip_isSkipping() ? 1 : 0;
|
||||
|
||||
DEBUG_COMMAND_YET("SACT.QueryMessageSkip %p:\n", vSkip);
|
||||
}
|
||||
@@ -1586,8 +1587,8 @@ static void TimerWait() {
|
||||
int wTimerID = getCaliValue();
|
||||
int wCount = getCaliValue();
|
||||
|
||||
while(wCount > stimer_get(wTimerID)) {
|
||||
sys_keywait(10, FALSE);
|
||||
while (wCount > stimer_get(wTimerID) && !nact->is_quit) {
|
||||
sys_keywait(10, KEYWAIT_NONCANCELABLE);
|
||||
}
|
||||
|
||||
DEBUG_COMMAND("SACT.TimerWait %d,%d:\n", wTimerID, wCount);
|
||||
@@ -1601,7 +1602,7 @@ static void TimerWait() {
|
||||
static void Wait() {
|
||||
int wCount = getCaliValue();
|
||||
|
||||
sys_keywait(wCount*10, FALSE);
|
||||
sys_keywait(wCount*10, KEYWAIT_NONCANCELABLE);
|
||||
|
||||
DEBUG_COMMAND_YET("SACT.Wait %d:\n", wCount);
|
||||
}
|
||||
|
||||
+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,8 +135,8 @@ 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) {
|
||||
|
||||
@@ -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,8 +77,8 @@ 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);
|
||||
|
||||
SACT_DEBUG("do update no=%d, sx=%d, sy=%d, w=%d, h=%d, \n",
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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,
|
||||
@@ -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 *);
|
||||
@@ -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"
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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"
|
||||
|
||||
/*
|
||||
|
||||
@@ -164,7 +165,7 @@ void spev_move_waitend(sprite_t *sp, int dx, int dy, int time) {
|
||||
|
||||
while (sp->move.moving) {
|
||||
nact->callback();
|
||||
WaitVsync();
|
||||
sdl_wait_vsync();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -183,7 +184,7 @@ void spev_wait4moving_sp() {
|
||||
|
||||
while (sp->move.moving) {
|
||||
nact->callback();
|
||||
WaitVsync();
|
||||
sdl_wait_vsync();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+11
-24
@@ -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;
|
||||
|
||||
@@ -85,7 +85,7 @@ int sp_quake_sprite(int wType, int wAmplitudeX, int wAmplitudeY, int wCount, int
|
||||
i++;
|
||||
|
||||
// ウェイトとキャンセルチェック
|
||||
key = sys_keywait(10, cancel);
|
||||
key = sys_keywait(10, cancel ? KEYWAIT_CANCELABLE : KEYWAIT_NONCANCELABLE);
|
||||
if (cancel && key != 0) break;
|
||||
}
|
||||
|
||||
|
||||
+12
-10
@@ -65,14 +65,14 @@ static int sel_main();
|
||||
* マージン内はsprite内部とは判断しない
|
||||
*/
|
||||
static boolean sp_is_insprite2(sprite_t *sp, int x, int y, int margin) {
|
||||
MyRectangle r;
|
||||
cginfo_t *curcg = sp->curcg;
|
||||
|
||||
r.x = sp->cur.x + margin;
|
||||
r.y = sp->cur.y + margin;
|
||||
r.width = curcg->sf->width - 2 * margin;
|
||||
r.height = curcg->sf->height - 2 * margin;
|
||||
return ags_regionContains(&r, x, y);
|
||||
MyPoint p = {x, y};
|
||||
MyRectangle r = {
|
||||
sp->cur.x + margin,
|
||||
sp->cur.y + margin,
|
||||
sp->curcg->sf->width - 2 * margin,
|
||||
sp->curcg->sf->height - 2 * margin
|
||||
};
|
||||
return SDL_PointInRect(&p, &r);
|
||||
}
|
||||
|
||||
// マウスが移動したときの callback
|
||||
@@ -237,7 +237,9 @@ static int sel_main() {
|
||||
selected_item = -1;
|
||||
|
||||
while(selected_item == -1) {
|
||||
sys_keywait(25, TRUE);
|
||||
sys_keywait(25, KEYWAIT_CANCELABLE);
|
||||
if (nact->is_quit)
|
||||
selected_item = 0;
|
||||
}
|
||||
|
||||
sact.waittype = KEYWAIT_NONE;
|
||||
@@ -284,7 +286,7 @@ void ssel_add(int nString, int wI) {
|
||||
free(sact.sel.elem[wI]);
|
||||
}
|
||||
|
||||
sact.sel.elem[wI] = strdup(v_str(nString -1));
|
||||
sact.sel.elem[wI] = strdup(svar_get(nString));
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -39,52 +39,16 @@
|
||||
// スプライト再描画間の間に変更のあったスプライトの領域の和
|
||||
static SList *updatearea;
|
||||
|
||||
static void intersection(MyRectangle *r1, MyRectangle *r2, MyRectangle *rst);
|
||||
static void disjunction(void* region, void* data);
|
||||
static void 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;
|
||||
|
||||
//SACT_DEBUG("r1x=%d,r1y=%d,r1w=%d,r1h=%d\n", r1->x, r1->y, r1->width, r1->height);
|
||||
//SACT_DEBUG("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;
|
||||
|
||||
//SACT_DEBUG("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);
|
||||
}
|
||||
|
||||
// 更新の必要なスプライトの領域の和をとってクリッピングする
|
||||
@@ -98,11 +62,11 @@ static void get_updatearea() {
|
||||
updatearea = NULL;
|
||||
|
||||
// surface0との領域の積をとる
|
||||
intersection(&rsf0, &clip, &sact.updaterect);
|
||||
SDL_IntersectRect(&rsf0, &clip, &sact.updaterect);
|
||||
|
||||
SACT_DEBUG("clipped area x=%d y=%d w=%d h=%d\n",
|
||||
sact.updaterect.x, sact.updaterect.y,
|
||||
sact.updaterect.width, sact.updaterect.height);
|
||||
sact.updaterect.w, sact.updaterect.h);
|
||||
|
||||
return;
|
||||
}
|
||||
@@ -140,8 +104,8 @@ int sp_update_all(boolean syncscreen) {
|
||||
// 画面全体を更新領域に
|
||||
sact.updaterect.x = 0;
|
||||
sact.updaterect.y = 0;
|
||||
sact.updaterect.width = sf0->width;
|
||||
sact.updaterect.height = sf0->height;
|
||||
sact.updaterect.w = sf0->width;
|
||||
sact.updaterect.h = sf0->height;
|
||||
|
||||
// updatelistに登録してあるスプライトを再描画
|
||||
// updatelistはスプライトの番号順に並んでいる
|
||||
@@ -169,10 +133,8 @@ int sp_update_clipped() {
|
||||
// 更新領域の確定
|
||||
get_updatearea();
|
||||
|
||||
// 幅または高さが 0 の時はなにもしない
|
||||
if (sact.updaterect.width == 0 || sact.updaterect.height == 0) {
|
||||
if (SDL_RectEmpty(&sact.updaterect))
|
||||
return OK;
|
||||
}
|
||||
|
||||
// 更新領域に入っているスプライトの再描画
|
||||
slist_foreach(sact.updatelist, do_update_each, NULL);
|
||||
@@ -183,7 +145,7 @@ int sp_update_clipped() {
|
||||
}
|
||||
|
||||
// 更新領域を Window に転送
|
||||
ags_updateArea(sact.updaterect.x, sact.updaterect.y, sact.updaterect.width, sact.updaterect.height);
|
||||
ags_updateArea(sact.updaterect.x, sact.updaterect.y, sact.updaterect.w, sact.updaterect.h);
|
||||
|
||||
return OK;
|
||||
}
|
||||
@@ -201,13 +163,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);
|
||||
|
||||
SACT_DEBUG("x = %d, y = %d, spno = %d w=%d,h=%d\n",
|
||||
r->x, r->y, sp->no, r->width, r->height);
|
||||
r->x, r->y, sp->no, r->w, r->h);
|
||||
|
||||
return OK;
|
||||
}
|
||||
@@ -229,13 +191,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);
|
||||
|
||||
SACT_DEBUG("x = %d, y = %d, spno = %d w=%d,h=%d\n",
|
||||
r->x, r->y, sp->no, r->width, r->height);
|
||||
r->x, r->y, sp->no, r->w, r->h);
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
@@ -67,7 +67,7 @@ int spxm_getnum(int reginum) {
|
||||
|
||||
int spxm_gettext(int reginum, int strno) {
|
||||
if (reginum > SEL_ELEMENT_MAX) return NG;
|
||||
v_strcpy(strno -1, xmenu.item[reginum]);
|
||||
svar_set(strno, xmenu.item[reginum]);
|
||||
return OK;
|
||||
}
|
||||
|
||||
@@ -78,6 +78,6 @@ int spxm_titlereg(void) {
|
||||
}
|
||||
|
||||
int spxm_titleget(int strno) {
|
||||
v_strcpy(strno -1, xmenu.title);
|
||||
svar_set(strno, xmenu.title);
|
||||
return OK;
|
||||
}
|
||||
|
||||
+13
-52
@@ -37,7 +37,7 @@
|
||||
#include "ags.h"
|
||||
#include "counter.h"
|
||||
#include "music.h"
|
||||
#include "graphicsdevice.h"
|
||||
#include "sdl_core.h"
|
||||
|
||||
#define SLOT 40
|
||||
|
||||
@@ -142,29 +142,11 @@ static void ChangeNotColor() {
|
||||
DEBUG_COMMAND("ShGraph.ChangeNotColor %d,%d,%d,%d,%p,%p,%d:\n", x0, y0, width, height, src, dst, p7);
|
||||
|
||||
ags_check_param(&x0, &y0, &width, &height);
|
||||
ags_sync();
|
||||
|
||||
dib = nact->ags.dib;
|
||||
dp = GETOFFSET_PIXEL(dib, x0, y0);
|
||||
|
||||
switch(dib->depth) {
|
||||
case 15:
|
||||
{
|
||||
WORD pic15s = PIX15(*src, *(src+1), *(src+2));
|
||||
WORD pic15d = PIX15(*dst, *(dst+1), *(dst+2));
|
||||
WORD *yl;
|
||||
|
||||
for (y = 0; y < height; y++) {
|
||||
yl = (WORD *)(dp + y * dib->bytes_per_line);
|
||||
for (x = 0; x < width; x++) {
|
||||
if (*yl != pic15s) {
|
||||
*yl = pic15d;
|
||||
}
|
||||
yl++;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 16:
|
||||
{
|
||||
WORD pic16s = PIX16(*src, *(src+1), *(src+2));
|
||||
@@ -420,8 +402,8 @@ static void SetAnimeRect() {
|
||||
|
||||
maprect.x = x;
|
||||
maprect.y = y;
|
||||
maprect.width = w;
|
||||
maprect.height = h;
|
||||
maprect.w = w;
|
||||
maprect.h = h;
|
||||
}
|
||||
|
||||
static void SetAnimeBack() {
|
||||
@@ -446,8 +428,8 @@ static void SetAnimeBack() {
|
||||
|
||||
mapback.x = sx;
|
||||
mapback.y = sy;
|
||||
mapback.width = w;
|
||||
mapback.height = h;
|
||||
mapback.w = w;
|
||||
mapback.h = h;
|
||||
mapback_p5 = p5;
|
||||
mapback_p6 = p6;
|
||||
}
|
||||
@@ -505,10 +487,8 @@ static void PlayAnimeData() {
|
||||
|
||||
if (!is_backcopied) {
|
||||
is_backcopied = TRUE;
|
||||
ags_copyArea(mapback.x, mapback.y,
|
||||
mapback.width, mapback.height,
|
||||
mapback_p5, mapback_p6);
|
||||
ags_sync();
|
||||
ags_copyArea(mapback.x, mapback.y, mapback.w, mapback.h,
|
||||
mapback_p5, mapback_p6);
|
||||
}
|
||||
|
||||
if (wavno != 0) {
|
||||
@@ -560,14 +540,12 @@ static void PlayAnimeData() {
|
||||
// printf("wavPlay %d\n", wavno % 256);
|
||||
}
|
||||
}
|
||||
if (is_backcopied && maprect.width != 0 && maprect.height != 0) {
|
||||
ags_updateArea(maprect.x, maprect.y, maprect.width, maprect.height);
|
||||
}
|
||||
{
|
||||
int now = get_high_counter(SYSTEMCOUNTER_MSEC);
|
||||
if (now - cnt < interval) {
|
||||
Sleep(interval - (now-cnt));
|
||||
}
|
||||
if (is_backcopied && !SDL_RectEmpty(&maprect))
|
||||
ags_updateArea(maprect.x, maprect.y, maprect.w, maprect.h);
|
||||
|
||||
int now = get_high_counter(SYSTEMCOUNTER_MSEC);
|
||||
if (now - cnt < interval) {
|
||||
sdl_sleep(interval - (now-cnt));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -588,23 +566,6 @@ static void copy_sprite(int sx, int sy, int width, int height, int dx, int dy, i
|
||||
dp = GETOFFSET_PIXEL(dib, dx, dy);
|
||||
|
||||
switch(dib->depth) {
|
||||
case 15:
|
||||
{
|
||||
WORD pic15 = PIX15(r, g, b);
|
||||
WORD *yls, *yld;
|
||||
|
||||
for (y = 0; y < height; y++) {
|
||||
yls = (WORD *)(sp + y * dib->bytes_per_line);
|
||||
yld = (WORD *)(dp + y * dib->bytes_per_line);
|
||||
for (x = 0; x < width; x++) {
|
||||
if (*yls != pic15) {
|
||||
*yld = *yls;
|
||||
}
|
||||
yls++; yld++;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 16:
|
||||
{
|
||||
WORD pic16 = PIX16(r, g, b);
|
||||
|
||||
+40
-14
@@ -35,7 +35,9 @@
|
||||
#include "system.h"
|
||||
#include "xsystem35.h"
|
||||
#include "modules.h"
|
||||
#include "graphicsdevice.h"
|
||||
#include "sdl_core.h"
|
||||
#include "sdl_private.h"
|
||||
#include "menu.h"
|
||||
|
||||
// キー変換テーブル
|
||||
#define KEYMAP_MAX 8
|
||||
@@ -44,24 +46,48 @@ static BYTE *keymap[KEYMAP_MAX];
|
||||
static void OutputMessageBox(void) { /* 0 */
|
||||
int p1 = getCaliValue();
|
||||
int p2 = getCaliValue();
|
||||
int p3 = getCaliValue();
|
||||
int p4 = getCaliValue();
|
||||
int p5 = getCaliValue();
|
||||
int p6 = getCaliValue();
|
||||
int title = getCaliValue();
|
||||
int msg = getCaliValue();
|
||||
int *res = getCaliVariable();
|
||||
int ISys3xSystem = getCaliValue();
|
||||
|
||||
DEBUG_COMMAND_YET("ShPort.OutputMessageBox: %d,%d,%d,%d,%d,%d:\n", p1, p2, p3, p3, p4, p5, p6);
|
||||
char *title_utf8 = toUTF8(svar_get(title));
|
||||
char *msg_utf8 = toUTF8(svar_get(msg));
|
||||
|
||||
SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_INFORMATION, title_utf8, msg_utf8, sdl_window);
|
||||
|
||||
free(title_utf8);
|
||||
free(msg_utf8);
|
||||
|
||||
DEBUG_COMMAND("ShPort.OutputMessageBox: %d,%d,%d,%d,%p,%d:\n", p1, p2, title, msg, res, ISys3xSystem);
|
||||
}
|
||||
|
||||
static void InputListNum(void) { /* 1 */
|
||||
int p1 = getCaliValue();
|
||||
int p2 = getCaliValue();
|
||||
int p3 = getCaliValue();
|
||||
int p4 = getCaliValue();
|
||||
int p5 = getCaliValue();
|
||||
int p6 = getCaliValue();
|
||||
int p7 = getCaliValue();
|
||||
int flags = getCaliValue();
|
||||
int title = getCaliValue();
|
||||
int *val = getCaliVariable();
|
||||
int minval = getCaliValue();
|
||||
int maxval = getCaliValue();
|
||||
int *res = getCaliVariable();
|
||||
int ISys3xSystem = getCaliValue();
|
||||
|
||||
DEBUG_COMMAND_YET("ShPortInputListNum: %d,%d,%d,%d,%d,%d,%d:\n", p1, p2, p3, p3, p4, p5, p6, p7);
|
||||
INPUTNUM_PARAM ni_param = {
|
||||
.def = minval,
|
||||
.min = minval,
|
||||
.max = maxval,
|
||||
.title = toUTF8(svar_get(title)),
|
||||
};
|
||||
|
||||
menu_inputnumber(&ni_param);
|
||||
if (ni_param.value < 0) {
|
||||
*res = 0;
|
||||
} else {
|
||||
*val = (WORD)ni_param.value;
|
||||
*res = 1;
|
||||
}
|
||||
|
||||
free(ni_param.title);
|
||||
DEBUG_COMMAND("ShPort.InputListNum: %d,%d,%p,%d,%d,%p,%d:\n", flags, title, val, minval, maxval, res, ISys3xSystem);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -45,26 +45,8 @@ static void ExchangeString(void) {
|
||||
int target = getCaliValue();
|
||||
int pat = getCaliValue();
|
||||
int patr = getCaliValue();
|
||||
char *start = v_str(target -1);
|
||||
char *next;
|
||||
char dst[STRVAR_LEN] = "";
|
||||
|
||||
svar_replaceAll(target, pat, patr);
|
||||
DEBUG_COMMAND("ShString.ExchangeString: %d,%d,%d:\n", target, pat, patr);
|
||||
|
||||
if (v_strlen(target -1) == 0 || v_strlen(pat -1) == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
while(TRUE) {
|
||||
next = strstr(start, v_str(pat -1));
|
||||
if (next == NULL) break;
|
||||
strncat(dst, start, (size_t)(next - start));
|
||||
strncat(dst, v_str(patr -1), sizeof(dst) - strlen(dst));
|
||||
start = next + v_strlen(pat -1);
|
||||
}
|
||||
|
||||
strncat(dst, start, sizeof(dst) - strlen(dst));
|
||||
v_strcpy(target -1, dst);
|
||||
}
|
||||
|
||||
static void SetNum16String(void) { /* 1 */
|
||||
@@ -107,7 +89,7 @@ static void SetWindowTitle(void) { /* 6 */
|
||||
int strno = getCaliValue();
|
||||
int p2 = getCaliValue(); /* ISys3xSystem */
|
||||
|
||||
ags_setWindowTitle(v_str(strno - 1));
|
||||
ags_setWindowTitle(svar_get(strno));
|
||||
|
||||
DEBUG_COMMAND("ShString.SetWindowTitle: %d,%d:\n", strno, p2);
|
||||
}
|
||||
@@ -127,8 +109,8 @@ static void FillString() {
|
||||
int i;
|
||||
|
||||
for (i = 0; i < cnt; i++) {
|
||||
if (st - 1 != src)
|
||||
v_strcpy(st -1, v_str(src));
|
||||
if (st + i != src)
|
||||
svar_set(st + i, svar_get(src));
|
||||
}
|
||||
|
||||
DEBUG_COMMAND("ShString.FillString: %d,%d,%d,%d:\n", st, cnt, src, p4);
|
||||
@@ -144,7 +126,7 @@ static void SetStringNum16(void) {
|
||||
*/
|
||||
int st = getCaliValue();
|
||||
int *var = getCaliVariable();
|
||||
char *str = v_str(st -1);
|
||||
const char *str = svar_get(st);
|
||||
char _dst[100];
|
||||
char *dst = _dst;
|
||||
|
||||
|
||||
@@ -1,41 +0,0 @@
|
||||
add_library(graph STATIC
|
||||
graph.c
|
||||
surface.c
|
||||
cg.c
|
||||
graph_expandcolor_blend.c
|
||||
graph_fillrect.c
|
||||
graph_fillrect_amap.c
|
||||
graph_fillrect_acolor.c
|
||||
graph_rect.c
|
||||
graph_copy.c
|
||||
graph_copy_amap.c
|
||||
graph_copy_bright.c
|
||||
graph_copy_whiteout.c
|
||||
graph_blend_amap.c
|
||||
graph_blend_screen.c
|
||||
graph_saturadd_amap.c
|
||||
graph_draw_amap.c
|
||||
graph_stretch.c
|
||||
graph_cg.c
|
||||
graph_buller.c
|
||||
gre_blend_useamap.c
|
||||
gre_blend.c
|
||||
gre_blend_screen.c
|
||||
)
|
||||
|
||||
add_library(alk STATIC alk.c)
|
||||
target_compile_options(alk PRIVATE -Wno-pointer-sign)
|
||||
|
||||
add_library(drawtext STATIC drawtext.c)
|
||||
target_compile_options(drawtext PRIVATE -Wno-pointer-sign)
|
||||
|
||||
add_library(list STATIC list.c)
|
||||
|
||||
target_include_directories(graph PUBLIC .)
|
||||
target_include_directories(alk PUBLIC .)
|
||||
target_include_directories(drawtext PUBLIC .)
|
||||
target_include_directories(list PUBLIC .)
|
||||
|
||||
add_executable(lib_test list_test.c)
|
||||
target_link_libraries(lib_test PRIVATE list)
|
||||
add_test(NAME lib_test COMMAND lib_test)
|
||||
+11
-39
@@ -27,58 +27,31 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.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"
|
||||
#include "LittleEndian.h"
|
||||
#include "alk.h"
|
||||
|
||||
alk_t *alk_new(char *path) {
|
||||
alk_t *alk_new(const char *path) {
|
||||
alk_t *alk;
|
||||
int i, fd;
|
||||
char *adr;
|
||||
struct stat sbuf;
|
||||
int i;
|
||||
|
||||
if (0 > (fd = open(path, O_RDONLY))) {
|
||||
WARNING("open: %s\n", strerror(errno));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (0 > fstat(fd, &sbuf)) {
|
||||
WARNING("fstat: %s\n", strerror(errno));
|
||||
close(fd);
|
||||
return NULL;
|
||||
}
|
||||
mmap_t *m = map_file(path);
|
||||
|
||||
if (MAP_FAILED == (adr = mmap(0, sbuf.st_size, PROT_READ, MAP_SHARED, fd, 0))) {
|
||||
WARNING("mmap: %s\n", strerror(errno));
|
||||
close(fd);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (0 != strncmp(adr, "ALK0", 4)) {
|
||||
WARNING("mmap: %s\n", strerror(errno));
|
||||
munmap(adr, sbuf.st_size);
|
||||
close(fd);
|
||||
if (0 != strncmp(m->addr, "ALK0", 4)) {
|
||||
WARNING("%s: not an ALK file\n", path);
|
||||
unmap_file(m);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
alk = calloc(1, sizeof(alk_t));
|
||||
alk->mapadr = adr;
|
||||
alk->size = sbuf.st_size;
|
||||
alk->fd = fd;
|
||||
|
||||
alk->datanum = LittleEndian_getDW(adr, 4);
|
||||
alk->mmap = m;
|
||||
alk->datanum = LittleEndian_getDW(m->addr, 4);
|
||||
alk->offset = malloc(sizeof(int) * alk->datanum);
|
||||
|
||||
for (i = 0; i < alk->datanum; i++) {
|
||||
alk->offset[i] = LittleEndian_getDW(adr, 8 + i * 8);
|
||||
alk->offset[i] = LittleEndian_getDW(m->addr, 8 + i * 8);
|
||||
}
|
||||
|
||||
return alk;
|
||||
@@ -87,8 +60,7 @@ alk_t *alk_new(char *path) {
|
||||
int alk_free(alk_t *alk) {
|
||||
if (alk == NULL) return OK;
|
||||
|
||||
munmap(alk->mapadr, alk->size);
|
||||
close(alk->fd);
|
||||
unmap_file(alk->mmap);
|
||||
free(alk->offset);
|
||||
free(alk);
|
||||
|
||||
@@ -98,5 +70,5 @@ int alk_free(alk_t *alk) {
|
||||
char *alk_get(alk_t *alk, int no) {
|
||||
if (no >= alk->datanum) return NULL;
|
||||
|
||||
return alk->mapadr + alk->offset[no];
|
||||
return (char *)alk->mmap->addr + alk->offset[no];
|
||||
}
|
||||
|
||||
+3
-4
@@ -27,6 +27,7 @@
|
||||
|
||||
#include <unistd.h>
|
||||
#include <sys/types.h>
|
||||
#include "mmap.h"
|
||||
|
||||
/*
|
||||
.ALK データ構造
|
||||
@@ -38,14 +39,12 @@
|
||||
*/
|
||||
|
||||
typedef struct {
|
||||
int fd; /* .alk ファイルの file discpriter */
|
||||
char *mapadr; /* mmap したファイルの先頭アドレス */
|
||||
off_t size; /* mmap したバイト数(ファイルサイズ) */
|
||||
mmap_t *mmap; /* mmap したファイル */
|
||||
int datanum; /* .alk ファイル中のファイル数 */
|
||||
int *offset; /* 各ファイルへのオフセット */
|
||||
} alk_t;
|
||||
|
||||
extern alk_t *alk_new(char *path);
|
||||
extern alk_t *alk_new(const char *path);
|
||||
extern int alk_free(alk_t *alk);
|
||||
extern char *alk_get(alk_t *alk, int no);
|
||||
|
||||
|
||||
+6
-13
@@ -29,7 +29,6 @@
|
||||
#include "system.h"
|
||||
#include "nact.h"
|
||||
#include "ags.h"
|
||||
#include "font.h"
|
||||
#include "surface.h"
|
||||
#include "ngraph.h"
|
||||
|
||||
@@ -59,13 +58,10 @@ int dt_setfont(int type, int size) {
|
||||
* @return: 実際に描画した幅
|
||||
*/
|
||||
int dt_drawtext(surface_t *sf, int x, int y, char *buf) {
|
||||
agsurface_t *glyph;
|
||||
int sx, sy, sw, sh;
|
||||
FONT *font = nact->ags.font;
|
||||
|
||||
font->sel_font(ftype, fsize);
|
||||
|
||||
glyph = font->get_glyph(buf);
|
||||
|
||||
ags_setFont(ftype, fsize);
|
||||
agsurface_t *glyph = ags_drawStringToSurface(buf);
|
||||
if (glyph == NULL) return 0;
|
||||
|
||||
sx = x; sy = y;
|
||||
@@ -92,13 +88,10 @@ int dt_drawtext(surface_t *sf, int x, int y, char *buf) {
|
||||
* @return: 実際に描画した幅
|
||||
*/
|
||||
int dt_drawtext_col(surface_t *sf, int x, int y, char *buf, int r, int g, int b) {
|
||||
agsurface_t *glyph;
|
||||
int sx, sy, sw, sh;
|
||||
FONT *font = nact->ags.font;
|
||||
|
||||
font->sel_font(ftype, fsize);
|
||||
|
||||
glyph = font->get_glyph(buf);
|
||||
|
||||
ags_setFont(ftype, fsize);
|
||||
agsurface_t *glyph = ags_drawStringToSurface(buf);
|
||||
if (glyph == NULL) return 0;
|
||||
|
||||
sx = x; sy = y;
|
||||
|
||||
@@ -272,28 +272,6 @@ void gr_copy_stretch_blend_alpha_map(surface_t *dst, int dx, int dy, int dw, int
|
||||
}
|
||||
|
||||
switch(dst->depth) {
|
||||
case 15:
|
||||
{
|
||||
WORD *yls, *yld;
|
||||
BYTE *yla;
|
||||
|
||||
for (y = 0; y < dh; y++) {
|
||||
yls = (WORD *)(sp + *(y + col) * src->bytes_per_line);
|
||||
yld = (WORD *)(dp + y * dst->bytes_per_line);
|
||||
yla = (BYTE *)(sa + *(y + col) * src->width);
|
||||
for (x = 0; x < dw; x++) {
|
||||
*(yld + x) = ALPHABLEND15(*(yls+ *(row + x)), *(yld+x), *(yla+*(row+x)));
|
||||
}
|
||||
while(*(col + y) == *(col + y + 1)) {
|
||||
yld += dst->width;
|
||||
for (x = 0; x < dw; x++) {
|
||||
*(yld + x) = ALPHABLEND15(*(yls+ *(row+x)), *(yld+x), *(yla+*(row+x)));
|
||||
}
|
||||
y++;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 16:
|
||||
{
|
||||
WORD *yls, *yld;
|
||||
|
||||
@@ -94,24 +94,6 @@ void gr_blend_alpha_wds(surface_t *src1, int sx1, int sy1, surface_t *src2, int
|
||||
dp = GETOFFSET_PIXEL(dst, dx, dy);
|
||||
|
||||
switch(dst->depth) {
|
||||
case 15:
|
||||
{
|
||||
WORD *yls1, *yls2, *yld;
|
||||
BYTE *yla;
|
||||
|
||||
for (y = 0; y < sh; y++) {
|
||||
yls1 = (WORD *)(sp1 + y * src1->bytes_per_line);
|
||||
yls2 = (WORD *)(sp2 + y * src2->bytes_per_line);
|
||||
yld = (WORD *)(dp + y * dst->bytes_per_line);
|
||||
yla = (BYTE *)(sa + y * src1->width);
|
||||
|
||||
for (x = 0; x < sw; x++) {
|
||||
*yld = SUTURADD15(*yls1, ALPHABLEND15(*yls1, *yls2, *yla));
|
||||
yls1++; yls2++; yld++; yla++;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 16:
|
||||
// if (nact->mmx_is_ok) {
|
||||
if (0) {
|
||||
|
||||
@@ -19,39 +19,6 @@ int gr_buller(surface_t *dst, int dx, int dy, surface_t *src, int sx, int sy, in
|
||||
sp = GETOFFSET_PIXEL(src, sx, sy);
|
||||
dp = GETOFFSET_PIXEL(dst, dx, dy);
|
||||
switch(dst->depth) {
|
||||
case 15:
|
||||
{
|
||||
WORD *yld, *yls;
|
||||
|
||||
for (y = 0; y < height; y++) {
|
||||
yls = (WORD *)(sp + y * src->bytes_per_line);
|
||||
yld = (WORD *)(dp + y * dst->bytes_per_line);
|
||||
for (x = 0; x < step; x++) {
|
||||
*yld = *(yls+step);
|
||||
yls++; yld++;
|
||||
}
|
||||
|
||||
for (; x < (width - step*2); x++) {
|
||||
r1 = PIXR15((*(yls+step)));
|
||||
g1 = PIXG15((*(yls+step)));
|
||||
b1 = PIXB15((*(yls+step)));
|
||||
r2 = PIXR15((*(yls-step)));
|
||||
g2 = PIXG15((*(yls-step)));
|
||||
b2 = PIXB15((*(yls-step)));
|
||||
r3 = min(255, (r1+r2) >> 1);
|
||||
g3 = min(255, (g1+g2) >> 1);
|
||||
b3 = min(255, (b1+b2) >> 1);
|
||||
|
||||
*yld = PIX15(r3, g3, b3);
|
||||
yld++; yls++;
|
||||
}
|
||||
for (; x < width; x++) {
|
||||
*yld = *(yls-step);
|
||||
yls++; yld++;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 16:
|
||||
{
|
||||
WORD *yld, *yls;
|
||||
@@ -137,36 +104,6 @@ int gr_buller_v(surface_t *dst, int dx, int dy, surface_t *src, int sx, int sy,
|
||||
sp = GETOFFSET_PIXEL(src, sx, sy);
|
||||
dp = GETOFFSET_PIXEL(dst, dx, dy);
|
||||
switch(dst->depth) {
|
||||
case 15:
|
||||
{
|
||||
WORD *yld, *yls;
|
||||
|
||||
for (x = 0; x < width; x++) {
|
||||
yls = (WORD *)(sp + x * src->bytes_per_pixel);
|
||||
yld = (WORD *)(dp + x * dst->bytes_per_pixel);
|
||||
for (y = 0; y < step; y++) {
|
||||
*(yld+y*dst->width) = *(yls+(y+step)*src->width);
|
||||
}
|
||||
|
||||
for (; y < (height - step*2); y++) {
|
||||
r1 = PIXR15((*(yls+(y+step)*src->width)));
|
||||
g1 = PIXG15((*(yls+(y+step)*src->width)));
|
||||
b1 = PIXB15((*(yls+(y+step)*src->width)));
|
||||
r2 = PIXR15((*(yls+(y-step)*src->width)));
|
||||
g2 = PIXG15((*(yls+(y-step)*src->width)));
|
||||
b2 = PIXB15((*(yls+(y-step)*src->width)));
|
||||
r3 = min(255, (r1+r2) >> 1);
|
||||
g3 = min(255, (g1+g2) >> 1);
|
||||
b3 = min(255, (b1+b2) >> 1);
|
||||
|
||||
*(yld+y*dst->width) = PIX15(r3, g3, b3);
|
||||
}
|
||||
for (; y < height; y++) {
|
||||
*(yld+y*dst->width) = *(yls+(y-step)*src->width);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 16:
|
||||
{
|
||||
WORD *yld, *yls;
|
||||
|
||||
+1
-33
@@ -57,23 +57,6 @@ void gr_drawimage24(surface_t *ds, cgdata *cg, int x, int y) {
|
||||
dp = GETOFFSET_PIXEL(ds, dx, dy);
|
||||
|
||||
switch(ds->depth) {
|
||||
case 15:
|
||||
{
|
||||
WORD *yl;
|
||||
|
||||
for (y = 0; y < dh; y++) {
|
||||
yl = (WORD *)(dp + y * ds->bytes_per_line);
|
||||
for (x = 0; x < dw; x++) {
|
||||
r = *sp;
|
||||
g = *(sp +1);
|
||||
b = *(sp +2);
|
||||
*yl = PIX15(r, g, b);
|
||||
yl++; sp += 3;
|
||||
}
|
||||
sp += ((cg->width - dw) * 3);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 16:
|
||||
{
|
||||
WORD *yl;
|
||||
@@ -138,21 +121,6 @@ void gr_drawimage16(surface_t *ds, cgdata *cg, int x, int y) {
|
||||
dp = GETOFFSET_PIXEL(ds, dx, dy);
|
||||
|
||||
switch(ds->depth) {
|
||||
case 15:
|
||||
{
|
||||
WORD *yl;
|
||||
|
||||
for (y = 0; y < dh; y++) {
|
||||
yl = (WORD *)(dp + y * ds->bytes_per_line);
|
||||
for (x = 0; x < dw; x++) {
|
||||
pic16 = *sp;
|
||||
*yl = PIX15(RGB_PIXR16(pic16), RGB_PIXG16(pic16), RGB_PIXB16(pic16));
|
||||
yl++; sp ++;
|
||||
}
|
||||
sp += (cg->width - dw);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 16:
|
||||
{
|
||||
for (y = 0; y < dh; y++) {
|
||||
@@ -172,7 +140,7 @@ void gr_drawimage16(surface_t *ds, cgdata *cg, int x, int y) {
|
||||
yl = (DWORD *)(dp + y * ds->bytes_per_line);
|
||||
for (x = 0; x < dw; x++) {
|
||||
pic16 = *sp;
|
||||
*yl = PIX24(RGB_PIXR16(pic16), RGB_PIXG16(pic16), RGB_PIXB16(pic16));
|
||||
*yl = PIX24(PIXR16(pic16), PIXG16(pic16), PIXB16(pic16));
|
||||
yl++; sp++;
|
||||
}
|
||||
sp += (cg->width - dw);
|
||||
|
||||
@@ -19,21 +19,6 @@ void gr_copy_bright(surface_t *dst, int dx, int dy, surface_t *src, int sx, int
|
||||
if (sp == NULL || dp == NULL) return;
|
||||
|
||||
switch(dst->depth) {
|
||||
case 15:
|
||||
{
|
||||
WORD *yls, *yld;
|
||||
|
||||
for (y = 0; y < height; y++) {
|
||||
yls = (WORD *)(sp + y * src->bytes_per_line);
|
||||
yld = (WORD *)(dp + y * dst->bytes_per_line);
|
||||
|
||||
for (x = 0; x < width; x++) {
|
||||
*yld = ALPHALEVEL15(*yls, lv);
|
||||
yls++; yld++;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 16:
|
||||
if (nact->mmx_is_ok) {
|
||||
// if (0) {
|
||||
|
||||
@@ -20,21 +20,6 @@ void gr_copy_whiteout(surface_t *dst, int dx, int dy, surface_t *src, int sx, in
|
||||
if (sp == NULL || dp == NULL) return;
|
||||
|
||||
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;
|
||||
|
||||
@@ -19,22 +19,6 @@ int gr_expandcolor_blend(surface_t *dst, int dx, int dy, surface_t *src, int sx,
|
||||
dp = GETOFFSET_PIXEL(dst, dx, dy);
|
||||
|
||||
switch(dst->depth) {
|
||||
case 15: {
|
||||
WORD *yd;
|
||||
BYTE *ys;
|
||||
col = PIX15(r, g, b);
|
||||
for (y = 0; y < sh; y++) {
|
||||
ys = (BYTE *)(sp + y * src->bytes_per_line);
|
||||
yd = (WORD *)(dp + y * dst->bytes_per_line);
|
||||
for (x = 0; x < sw; x++) {
|
||||
if (*ys) {
|
||||
*yd = ALPHABLEND15(col, *yd, (BYTE)*ys);
|
||||
}
|
||||
ys++; yd++;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 16:
|
||||
col = PIX16(r, g, b);
|
||||
//if (nact->mmx_is_ok) {
|
||||
|
||||
@@ -21,15 +21,6 @@ int gr_fill(surface_t *dst, int dx, int dy, int dw, int dh, int r, int g, int b)
|
||||
memset(dp, r, dw);
|
||||
break;
|
||||
|
||||
case 15:
|
||||
{
|
||||
WORD pic15 = PIX15(r, g, b);
|
||||
|
||||
for (x = 0; x < dw; x++) {
|
||||
*((WORD *)dp + x) = pic15;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 16:
|
||||
{
|
||||
WORD pic16 = PIX16(r, g, b);
|
||||
|
||||
@@ -18,20 +18,6 @@ int gr_fill_alpha_color(surface_t *dst, int dx, int dy, int dw, int dh, int r, i
|
||||
dp = GETOFFSET_PIXEL(dst, dx, dy);
|
||||
|
||||
switch(dst->depth) {
|
||||
case 15:
|
||||
{
|
||||
WORD pic15 = PIX15(r, g, b);
|
||||
WORD *yls;
|
||||
|
||||
for (y = 0; y < dh; y++) {
|
||||
yls = (WORD *)(dp + y * dst->bytes_per_line);
|
||||
for (x = 0; x < dw; x++) {
|
||||
*yls = ALPHABLEND15(pic15, *yls, lv);
|
||||
yls++;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 16:
|
||||
if (nact->mmx_is_ok) {
|
||||
#ifdef ENABLE_MMX
|
||||
|
||||
@@ -19,8 +19,6 @@ int gr_drawrect(surface_t *dst, int x, int y, int w, int h, int r, int g, int b)
|
||||
switch(dst->depth) {
|
||||
case 8:
|
||||
col = r; break;
|
||||
case 15:
|
||||
col = PIX15(r, g, b); break;
|
||||
case 16:
|
||||
col = PIX16(r, g, b); break;
|
||||
case 24:
|
||||
@@ -49,7 +47,6 @@ int gr_drawrect(surface_t *dst, int x, int y, int w, int h, int r, int g, int b)
|
||||
*((BYTE *)dp + i) = col;
|
||||
}
|
||||
break;
|
||||
case 15:
|
||||
case 16:
|
||||
/* top */
|
||||
for (i = 0; i < w; i++) {
|
||||
|
||||
@@ -38,7 +38,6 @@ void gr_copy_stretch(surface_t *dst, int dx, int dy, int dw, int dh, surface_t *
|
||||
}
|
||||
|
||||
switch(dst->depth) {
|
||||
case 15:
|
||||
case 16:
|
||||
{
|
||||
WORD *yls, *yld;
|
||||
|
||||
@@ -16,22 +16,6 @@ int gre_Blend(surface_t *write, int wx, int wy, surface_t *dst, int dx, int dy,
|
||||
dp = GETOFFSET_PIXEL(dst, dx, dy);
|
||||
|
||||
switch(dst->depth) {
|
||||
case 15:
|
||||
{
|
||||
WORD *yls, *yld, *ylw;
|
||||
|
||||
for (y = 0; y < height; y++) {
|
||||
yls = (WORD *)(sp + y * src->bytes_per_line);
|
||||
yld = (WORD *)(dp + y * dst->bytes_per_line);
|
||||
ylw = (WORD *)(wp + y * write->bytes_per_line);
|
||||
|
||||
for (x = 0; x < width; x++) {
|
||||
*ylw = ALPHABLEND15(*yls, *yld, lv);
|
||||
yls++; yld++; ylw++;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 16:
|
||||
if (nact->mmx_is_ok) {
|
||||
// if (0) {
|
||||
|
||||
@@ -15,22 +15,6 @@ int gre_BlendScreen(surface_t *write, int wx, int wy, surface_t *dst, int dx, in
|
||||
dp = GETOFFSET_PIXEL(dst, dx, dy);
|
||||
|
||||
switch(dst->depth) {
|
||||
case 15:
|
||||
{
|
||||
WORD *yls, *yld, *ylw;
|
||||
|
||||
for (y = 0; y < height; y++) {
|
||||
yls = (WORD *)(sp + y * src->bytes_per_line);
|
||||
yld = (WORD *)(dp + y * dst->bytes_per_line);
|
||||
ylw = (WORD *)(wp + y * write->bytes_per_line);
|
||||
|
||||
for (x = 0; x < width; x++) {
|
||||
*ylw = SUTURADD15(*yls, *yld);
|
||||
yls++; yld++; ylw++;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 16:
|
||||
{
|
||||
WORD *yls, *yld, *ylw;
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user