Compare commits

...
43 Commits
Author SHA1 Message Date
kichikuou c4026f9eb1 Version 2.18.0 2026-06-23 19:18:38 +09:00
kichikuou 3318bebf6c fonts: Replace mincho font with IPA Mincho
Switch the bundled mincho font from a Source Han Serif JP subset to a
subset of IPA Mincho, which has monospace ASCII glyphs.

IPA Mincho's hhea ascent/descent already match its OS/2 typo metrics, so
adjust_metrics.py is no longer needed. However, IPA Mincho is distributed
under the IPA Font License v1.0, under which a subset is a "Derived
Program"; Article 3.1(4) forbids the derived font's name from containing
the licensed program's name ("IPA"). Add rename_font.py to rewrite the
name table accordingly, and replace licenses/mincho.txt with the IPA Font
License.
2026-06-23 17:40:22 +09:00
kichikuou d4ad329583 game_compatibility.md: Fix typo 2026-06-18 07:34:45 +09:00
kichikuou 2e828710ca gtk: Fix popup menu on Wayland
gtk_menu_popup() is deprecated since GTK 3.22. Since no GdkEvent is
available at the call site, use gtk_menu_popup_at_rect() with the
current pointer position obtained via gdk_device_get_position().
2026-05-03 16:37:28 +09:00
kichikuou fad4236458 CI: Fix emscripten build failure 2026-04-12 22:43:27 +09:00
kichikuou 77d62c7c13 CI: Update GitHub Actions 2026-04-12 22:43:24 +09:00
kichikuou a726d577ef modules: Move SACT/sactcg.c to lib/ and use it from NIGHTDLL 2026-03-17 11:09:47 +09:00
kichikuou 4a5cd4a1c1 dDemo/tDemo: Fix .alk filename case sensitivity
Instead of hardcoding "dDEMO.alk" / "tDEMO.alk", use the actual filename
stored in nact->files.alk[0] from the directory scan. This fixes loading
failures on case-sensitive filesystems where the actual file may be
named "dDemo.alk" or "tDemo.alk".

Also update gameresource.c to store .alk files without a numeric suffix
at index 0 (these games have only one .alk file).
2026-03-15 11:13:08 +09:00
kichikuou 022d6af4f1 Implement dDemo HLL (Daiakuji intro demo) 2026-03-08 10:09:01 +09:00
kichikuou df816e3708 README.md: Specify supported audio formats (MP3, Ogg) 2026-01-17 07:32:26 +09:00
kichikuou 2c9079c875 Version 2.17.1 2026-01-10 16:13:16 +09:00
kichikuou 54b8d6c993 android/README.md: Add Obtainium installation instructions 2026-01-10 14:57:43 +09:00
kichikuou f2fe6b9724 SACT: Ctrl key cancels SACT.Wait and SACT.TimerWait
This fixes an issue where the roulette in Rance 5D could not be fast
forwarded using the Ctrl key.
2026-01-09 16:16:13 +09:00
kichikuou 38dc9a7b0b Refactor sacttimer.c 2026-01-09 13:14:48 +09:00
kichikuou d2ac3889b5 QE/LE: Handle for paths with subdirectories correctly
This resolves issues where saving to and loading from paths with
subdirectories (e.g., "Save\file.asd") would fail.

The original problems were:
 1. Writing failure: A path mismatch between directory creation in
    commandQE and file writing in fc_open.
 2. Loading failure: fc_search could not handle paths containing
    directory separators, preventing saved files in subdirectories from
    being found.

This commit addresses these issues with the following changes:
 - fc_open now automatically creates parent directories when writing a
   file.
 - fc_search is updated to support two modes:
     - It performs a case-insensitive search for simple filenames
       (preserving original behavior).
     - It performs a case-sensitive existence check for full paths.

Fixes #74.
2026-01-09 08:31:40 +09:00
kichikuou 0342141358 Add is_available function to CD-ROM devices
Now `SI 2` command returns zero if no audio track is available.
2025-11-28 10:45:24 +09:00
kichikuou 8806bc9545 Version 2.17.0 2025-11-09 22:27:45 +09:00
kichikuou 5e62405f17 Move patch/ to misc/patch/ 2025-11-09 22:26:15 +09:00
kichikuou 714c7d44b5 Android: Update SDL to 2.32.10 2025-11-09 22:08:54 +09:00
kichikuou 0f6d4e2343 Add Streamer Mode with -censor option
This introduces "Streamer Mode" to mosaic specified NSFW images, making
the game suitable for streaming or public viewing. This feature is
enabled via the '-censor <file>' command-line option, which takes a file
containing a list of image numbers to be filtered.
2025-11-09 11:47:13 +09:00
kichikuou f1536a801a QE/LE: Handle backslashes in filenames
Rance 5D uses filename `Save\\Rance5dSystem.asd`. This caused issues:

- On Windows, saving would fail if the `Save` directory did not exist.
- On other platforms, files were created with literal backslashes in
  their names.

This change addresses these problems by:

- In commandQE, normalizing backslashes to forward slashes in the path
  and ensuring that the target directory exists by calling mkdir_p().
- In commandLE, first attempting to load files with normalized forward
  slashes. If that fails, it retries with the original path (containing
  backslashes) for compatibility with older saves.
2025-11-06 11:05:23 +09:00
kichikuou ab372b7873 Unify old and new command implementations
Consolidate logic for parsing string arguments by introducing a
parameter to handle different terminators.
2025-11-06 09:39:51 +09:00
kichikuou 2c02f40dc4 Move uppercase commands from cmd2F.c to cmd<first_letter>.c 2025-11-06 09:39:46 +09:00
kichikuou a395366cf8 Version 2.16.1 2025-08-28 13:00:30 +09:00
kichikuou e416fc20d3 CI: Disable portmidi on mingw32
mingw-w64-i686-portmidi is no longer provided.
2025-08-28 12:47:02 +09:00
kichikuou 7d03fc6757 sactlog: Hold log text in UTF-8 2025-08-28 12:24:49 +09:00
kichikuou e3b8c90611 sactlog: Draw text using gfx_drawString()
This fixes #71. It was a regression by commit ec071d4.
2025-08-28 11:41:51 +09:00
kichikuou 361ca89016 Windows: #undef min / max in portab.h 2025-06-20 08:11:35 +09:00
kichikuou 5bd4622031 Version 2.16.0 2025-06-13 17:20:47 +09:00
kichikuou c7c0f69ec4 Split sdl_core.h to event.h and editor.h
And rename sdl_event.c to event.c, sdl_input.c to editor.c.
2025-06-11 10:12:25 +09:00
kichikuou f38a3eda5c Merge sdl_cursor.c to cursor.c 2025-06-11 10:12:22 +09:00
kichikuou dc17b78365 Move miscellaneous low-level functions to system.[ch] 2025-06-11 09:23:44 +09:00
kichikuou b9f68eedd3 Move joystick initialization code to sdl_event.c 2025-06-11 09:23:44 +09:00
kichikuou adf362ea57 Rename sdl_effect_* to effect_* 2025-06-11 09:23:44 +09:00
kichikuou b5bf439b8e Remove graphics.h 2025-06-11 09:23:42 +09:00
kichikuou 9a01d28075 Move gfx_* functions from sdl_core.h to gfx.h 2025-06-11 09:22:36 +09:00
kichikuou 945dbd7722 Rename graphics functions from sdl_* to gfx_*
And rename sdl_{video,draw,image}.c to gfx_{video,draw,image}.c.
2025-06-10 15:00:27 +09:00
kichikuou 1c54487041 cmake: Use new policies up to CMake 4.0 2025-06-10 13:58:40 +09:00
kichikuou 92389289da Android: Add "clear save files" launcher menu command 2025-06-10 13:17:27 +09:00
kichikuou 4de03cc77f Move font license files to license/ 2025-05-30 20:54:28 +09:00
kichikuou 5a81ac6fc8 Windows: Add cancel button to text/number input dialog 2025-05-30 16:06:29 +09:00
kichikuou d7bac22059 Windows: Implement number input dialog (NI command)
Fixes #68.
2025-05-30 16:06:26 +09:00
kichikuou 8d4424061d Switch JPEG decoder to NanoJPEG and disable fancy upsampling
Graymerca uses JPEG images for map tiles, which suffers from color
bleeding due to chroma upsampling in the JPEG decoder.

Since stb_image cannot disable the bilinear upsampling filter, this
switches the JPEG decoder to NanoJPEG.

Fixes #67.
2025-05-29 08:39:59 +09:00
163 changed files with 4676 additions and 10495 deletions
+3 -3
View File
@@ -6,7 +6,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6
- name: Install Deps
run: sudo apt install ninja-build
@@ -22,7 +22,7 @@ jobs:
KEYSTORE_PASSWORD: ${{ secrets.KEYSTORE_PASSWORD }}
- name: Upload artifacts
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v7
with:
name: xsystem35-apk
path: android/app/build/outputs/apk/release/app-release.apk
archive: false
+7 -4
View File
@@ -10,21 +10,24 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6
- name: Setup cache
id: cache-system-libraries
uses: actions/cache@v4
uses: actions/cache@v5
with:
path: ${{env.EM_CACHE_FOLDER}}
key: ${{env.EM_VERSION}}-${{ runner.os }}
- name: Setup Emscripten toolchain
uses: mymindstorm/setup-emsdk@v14
uses: emscripten-core/setup-emsdk@v16
with:
version: ${{ env.EM_VERSION }}
actions-cache-folder: ${{env.EM_CACHE_FOLDER}}
- name: Work around emscripten-core/emscripten#26534
run: npm install -g typescript@5
- name: Build
run: |
mkdir -p out/wasm
@@ -35,7 +38,7 @@ jobs:
mv src/xsystem35.* xsystem35/
- name: Upload artifacts
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v7
with:
name: xsystem35-wasm
path: out/wasm/xsystem35
+1 -1
View File
@@ -10,7 +10,7 @@ jobs:
name: Linux ${{ matrix.build-type }}
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6
- name: Install Deps
run: |
+6 -5
View File
@@ -15,7 +15,9 @@ jobs:
- sys: ucrt64
package: "xsystem35-64bit"
cmake_args: ""
deps: "cjson:p"
deps: >-
cjson:p
portmidi:p
defaults:
run:
shell: msys2 {0}
@@ -31,18 +33,17 @@ jobs:
SDL2_ttf:p
SDL2_mixer:p
libwebp:p
portmidi:p
${{ matrix.deps }}
- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@v6
- name: Copy licenses
run: |
ls /${{ matrix.sys }}/share/licenses
mkdir dist
cp -r /${{ matrix.sys }}/share/licenses dist/
cp fonts/*.license dist/licenses/
cp licenses/* dist/licenses/
- name: Install dev dependencies
run: pacboy --noconfirm -S --needed gcc:p cmake:p ninja:p asciidoctor:p
@@ -63,7 +64,7 @@ jobs:
cp out/release/src/xsystem35.exe out/release/doc/*.html *.md COPYING xsys35rc.sample dist/
- name: Upload
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v7
with:
name: ${{ matrix.package }}
path: dist
+28 -6
View File
@@ -1,26 +1,48 @@
# Changelog
## 2.15.1 - 2024-05-14
## 2.18.0 - 2026-06-23
- Added support for the intro demo of Daiakuji.
- Replaced the bundled mincho font with IPA Mincho.
## 2.17.1 - 2026-01-10
- Fixed an issue where Rance 5D could not save files on non-Windows systems.
- Improved fast-forward behavior using the Ctrl key in Rance 5D.
- The `SI 2` command now returns 0 if a playlist file is not provided.
## 2.17.0 - 2025-11-09
- Added "Streamer Mode" to mosaic specified (NSFW) images. This is enabled via the `-censor <file>` command-line option.
- Windows: Fixed an issue where Rance 5D could not save files if the `Save` directory did not exist.
## 2.16.1 - 2025-08-28
- Fixed text rendering issue in SACT log (#71)
- Windows: The 32-bit version no longer supports the portmidi MIDI backend
## 2.16.0 - 2025-06-13
- Fixed map tile color issue in Graymerca (#67)
- Windows: Implemented number input dialog for the `NI` command (#68)
- Android: Added "Clear Save Files" launcher menu command
## 2.15.1 - 2025-05-14
- Fixed a text rendering issue in Rance 5D (#66)
## 2.15.0 - 2024-04-21
## 2.15.0 - 2025-04-21
- Fixed color palette bug introduced in v2.14.2.
- Fixed uncancellable message waiting mode.
- Android: "Install from ZIP" button is moved to the top-right option menu.
- Android: Improved extraction logic of track numbers from audio file names.
## 2.14.3 - 2024-04-01
## 2.14.3 - 2025-04-01
- Fixed build for big endian architectures.
## 2.14.2 - 2024-03-09
## 2.14.2 - 2025-03-09
- Android: Back button to exit the game (#50)
- Improved touch input usability in ママトト (#64)
## 2.14.1 - 2024-02-07
## 2.14.1 - 2025-02-07
- Fixed font selection and text decoration not working in selection menus.
- Fixed a graphic issue in DALK intro.
## 2.14.0 - 2024-01-09
## 2.14.0 - 2025-01-09
- New supported games: 俺の下であがけ and 楽園行.
- Windows: On Windows 10 version 1903 or above, now xsystem35 can handle
Japanese filenames correctly even if the system locale is not Japanese.
+2 -7
View File
@@ -1,16 +1,11 @@
cmake_minimum_required(VERSION 3.13)
# Rebuild external projects when download URL changes
if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.24.0")
cmake_policy(SET CMP0135 NEW)
endif()
cmake_minimum_required(VERSION 3.13...4.0)
project(xsystem35 LANGUAGES C)
set(CMAKE_C_STANDARD 99)
enable_testing()
set(CMAKE_EXPORT_COMPILE_COMMANDS TRUE)
set(XSYSTEM35_VERSION "2.15.1")
set(XSYSTEM35_VERSION "2.18.0")
include(CheckSymbolExists)
include(FetchContent)
+12 -3
View File
@@ -16,9 +16,10 @@ the following features:
### Playing Audio Files as Virtual CD Music
Many System 3.x games feature music as audio tracks on the CD-ROM. xsystem35
can play music from audio files, eliminating the need to insert CDs. To use
ripped audio files, create a file named `playlist.txt` in the game directory
and list the paths to your tracks, one per line. For example:
can play music from audio files, eliminating the need to insert CDs. Supported
audio file formats are MP3 and Ogg. To use ripped audio files, create a file
named `playlist.txt` in the game directory and list the paths to your tracks,
one per line. For example:
```
# The first line is not used
@@ -60,6 +61,14 @@ and examine or modify game variables. There are two ways to use the debugger:
launch the debugger with a console interface. Type `help` to see a list of
available commands.
### Streamer Mode
xsystem35 introduces a "Streamer Mode" to make playing games with NSFW content
safer for streaming or public viewing. When enabled with the `-censor <file>`
option, images specified in the provided file will be automatically mosaiced.
The `misc/censor/` directory contains example censor list files for some games.
## Installation
Prebuilt packages for Windows and Android can be downloaded from the
+8
View File
@@ -6,6 +6,14 @@ Minimum supported Android version: 5.0
You can download prebuilt APKs
[here](https://github.com/kichikuou/xsystem35-sdl2/releases).
### Installing with Obtainium
Alternatively, you can install `xsystem35-sdl2` using [Obtainium](https://github.com/ImranR98/Obtainium). Obtainium will detect new releases and allow you to update the app directly.
1. Install Obtainium on your Android device.
2. Click the badge below to add the app to Obtainium:
[<img src="https://raw.githubusercontent.com/ImranR98/Obtainium/main/assets/graphics/badge_obtainium.png" alt="Get it on Obtainium" height="60">](https://apps.obtainium.imranr.dev/redirect?r=obtainium://app/%7B%22id%22%3A%22io.github.kichikuou.xsystem35%22%2C%22url%22%3A%22https%3A%2F%2Fgithub.com%2Fkichikuou%2Fxsystem35-sdl2%22%2C%22author%22%3A%22kichikuou%22%2C%22name%22%3A%22xsystem35%22%2C%22categories%22%3A%5B%22games%22%5D%7D)
## Usage
### Basic Usage
1. Create a ZIP file containing all the game files and BGM files (see
+2 -2
View File
@@ -16,8 +16,8 @@ android {
defaultConfig {
minSdkVersion 21
targetSdkVersion 34
versionCode 34
versionName "2.15.1" + gitRevision()
versionCode 36
versionName "2.18.0" + gitRevision()
externalNativeBuild {
cmake {
arguments "-DANDROID_APP_PLATFORM=android-19", "-DANDROID_STL=c++_static"
+6 -5
View File
@@ -7,8 +7,8 @@ set(PROJECT_ROOT_DIR ../../..)
include(FetchContent)
FetchContent_Declare(
SDL
URL https://github.com/libsdl-org/SDL/releases/download/release-2.32.4/SDL2-2.32.4.tar.gz
URL_HASH SHA1=4fb68f43891ca4def414cc7cf0f3b2a053cb6aaf
URL https://github.com/libsdl-org/SDL/releases/download/release-2.32.10/SDL2-2.32.10.tar.gz
URL_HASH SHA1=ce98fa93e31836a751feca374ab28a0770b63c16
)
FetchContent_Declare(
SDL_ttf
@@ -42,10 +42,11 @@ add_subdirectory(${PROJECT_ROOT_DIR} xsystem35)
set(ASSETS_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../src/main/assets)
file(MAKE_DIRECTORY ${ASSETS_DIR}/licenses)
file(COPY_FILE ${PROJECT_ROOT_DIR}/fonts/MTLc3m.ttf ${ASSETS_DIR}/MTLc3m.ttf)
file(COPY_FILE ${PROJECT_ROOT_DIR}/fonts/mincho.otf ${ASSETS_DIR}/mincho.otf)
file(COPY_FILE ${PROJECT_ROOT_DIR}/fonts/mincho.ttf ${ASSETS_DIR}/mincho.ttf)
file(COPY_FILE ${PROJECT_ROOT_DIR}/COPYING ${ASSETS_DIR}/licenses/xsystem35)
file(COPY_FILE ${PROJECT_ROOT_DIR}/fonts/MTLc3m.ttf.license ${ASSETS_DIR}/licenses/MTLc3m)
file(COPY_FILE ${PROJECT_ROOT_DIR}/fonts/mincho.otf.license ${ASSETS_DIR}/licenses/mincho)
file(COPY_FILE ${PROJECT_ROOT_DIR}/licenses/MTLc3m.txt ${ASSETS_DIR}/licenses/MTLc3m)
file(COPY_FILE ${PROJECT_ROOT_DIR}/licenses/mincho.txt ${ASSETS_DIR}/licenses/mincho)
file(COPY_FILE ${PROJECT_ROOT_DIR}/licenses/nanojpeg.txt ${ASSETS_DIR}/licenses/nanojpeg)
file(COPY_FILE ${sdl_SOURCE_DIR}/LICENSE.txt ${ASSETS_DIR}/licenses/SDL)
file(COPY_FILE ${sdl_ttf_SOURCE_DIR}/LICENSE.txt ${ASSETS_DIR}/licenses/SDL_ttf)
file(COPY_FILE ${sdl_ttf_SOURCE_DIR}/external/freetype/docs/GPLv2.TXT ${ASSETS_DIR}/licenses/freetype)
@@ -253,6 +253,14 @@ class Launcher private constructor(private val rootDir: File) {
}
}
}
fun clearSaveData(): Boolean {
var success = true
File(rootDir, SAVE_DIR).listFiles()?.forEach { file ->
if (!file.deleteRecursively()) success = false
}
return success
}
}
private fun forEachZipEntry(input: InputStream, action: (ZipEntry, ZipInputStream) -> Unit): Boolean {
@@ -82,7 +82,7 @@ class LauncherActivity : Activity(), LauncherObserver {
}
private fun onItemLongClick(position: Int): Boolean {
AlertDialog.Builder(this).setTitle(R.string.uninstall_dialog_title)
AlertDialog.Builder(this).setTitle(R.string.confirm)
.setMessage(getString(R.string.uninstall_dialog_message, launcher.games[position].title))
.setPositiveButton(R.string.ok) {_, _ -> uninstall(position)}
.setNegativeButton(R.string.cancel) {_, _ -> }
@@ -117,6 +117,21 @@ class LauncherActivity : Activity(), LauncherObserver {
SAVEDATA_IMPORT_REQUEST)
true
}
R.id.clear_savedata -> {
AlertDialog.Builder(this)
.setTitle(R.string.confirm)
.setMessage(R.string.clear_save_data_confirm)
.setPositiveButton(R.string.ok) { _, _ ->
if (launcher.clearSaveData()) {
Toast.makeText(this, R.string.save_data_clear_success, Toast.LENGTH_SHORT).show()
} else {
errorDialog(R.string.save_data_clear_error)
}
}
.setNegativeButton(R.string.cancel, null)
.show()
true
}
R.id.help -> {
AlertDialog.Builder(this)
.setMessage(Html.fromHtml(getString(R.string.usage)))
@@ -13,10 +13,11 @@ class LicensesMenuActivity : Activity() {
Entry("SDL", "SDL", "https://www.libsdl.org/"),
Entry("SDL_mixer", "SDL_mixer", "https://github.com/libsdl-org/SDL_mixer"),
Entry("SDL_ttf", "SDL_ttf", "https://github.com/libsdl-org/SDL_ttf"),
Entry("NanoJPEG", "nanojpeg", "https://keyj.emphy.de/nanojpeg/"),
Entry("FreeType", "freetype", "https://freetype.org/"),
Entry("HarfBuzz", "harfbuzz", "https://harfbuzz.github.io/"),
Entry("MotoyaLCedar W3 mono", "MTLc3m", "https://github.com/aosp-mirror/platform_frameworks_base/tree/lollipop-release/data/fonts"),
Entry("Source Han Serif", "mincho", "https://github.com/adobe-fonts/source-han-serif/"),
Entry("IPA明朝", "mincho", "https://moji.or.jp/ipafont/"),
)
override fun onCreate(savedInstanceState: Bundle?) {
@@ -61,7 +61,7 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
private static final String TAG = "SDL";
private static final int SDL_MAJOR_VERSION = 2;
private static final int SDL_MINOR_VERSION = 32;
private static final int SDL_MICRO_VERSION = 4;
private static final int SDL_MICRO_VERSION = 10;
/*
// Display InputType.SOURCE/CLASS of events and devices
//
@@ -9,6 +9,9 @@
<item
android:id="@+id/import_savedata"
android:title="@string/action_import_save_data" />
<item
android:id="@+id/clear_savedata"
android:title="@string/action_clear_save_data" />
<item
android:id="@+id/help"
android:title="@string/action_help" />
@@ -6,9 +6,12 @@
<string name="action_import_save_data">セーブデータをインポート</string>
<string name="action_install_from_zip">ZIPからインストール</string>
<string name="action_licenses">オープンソースライセンス</string>
<string name="action_clear_save_data">セーブデータをクリア</string>
<string name="cancel">キャンセル</string>
<string name="cannot_find_ald">System 3.x のファイル (*.ald) が見つかりません。</string>
<string name="choose_a_file">ファイルを選択</string>
<string name="clear_save_data_confirm">セーブデータをすべて削除します。元には戻せません。本当によろしいですか?</string>
<string name="confirm">確認</string>
<string name="error_dialog_title">エラー</string>
<string name="install_dialog_title">インストール中…</string>
<string name="install_progress">%s を展開中</string>
@@ -16,8 +19,9 @@
<string name="save_data_export_error">セーブデータのエクスポートに失敗しました。</string>
<string name="save_data_export_success">エクスポートに成功しました。</string>
<string name="save_data_import_success">インポートに成功しました。</string>
<string name="save_data_clear_success">セーブデータをクリアしました。</string>
<string name="save_data_clear_error">セーブデータのクリアに失敗しました。</string>
<string name="uninstall_dialog_message">「%s」をアンインストールしますか?</string>
<string name="uninstall_dialog_title">確認</string>
<string name="unsupported_zip">この形式の ZIP はサポートしていません。</string>
<string name="zip_extraction_error">ZIP の展開に失敗しました。</string>
<string name="usage">
+5 -1
View File
@@ -1,5 +1,6 @@
<resources>
<string name="app_name">xsystem35</string>
<string name="action_clear_save_data">Clear Save Files</string>
<string name="action_export_save_data">Export Save Files</string>
<string name="action_help">Help</string>
<string name="action_import_save_data">Import Save Files</string>
@@ -8,16 +9,19 @@
<string name="cancel">Cancel</string>
<string name="cannot_find_ald">Cannot find System 3.x game files (*.ald).</string>
<string name="choose_a_file">Choose a file</string>
<string name="clear_save_data_confirm">Are you sure you want to clear all save files? This cannot be undone.</string>
<string name="confirm">Confirm</string>
<string name="error_dialog_title">Error</string>
<string name="install_dialog_title">Installing…</string>
<string name="install_progress">Extracting %s</string>
<string name="no_data_to_import">No save/ folder in the ZIP archive.</string>
<string name="ok">OK</string>
<string name="save_data_clear_error">Failed to clear save files.</string>
<string name="save_data_clear_success">Save files cleared.</string>
<string name="save_data_export_error">Failed to export save files.</string>
<string name="save_data_import_success">Imported successfully.</string>
<string name="save_data_export_success">Exported successfully.</string>
<string name="uninstall_dialog_message">Uninstall \"%s\"?</string>
<string name="uninstall_dialog_title">Confirm</string>
<string name="unsupported_zip">This type of ZIP is not supported.</string>
<string name="zip_extraction_error">Failed to extract ZIP.</string>
<string name="usage">
+1 -1
View File
@@ -18,4 +18,4 @@
#cmakedefine HAVE_WEBP @HAVE_WEBP@
#define DEFAULT_GOTHIC_TTF "@DEFAULT_FONT_PATH@MTLc3m.ttf"
#define DEFAULT_MINCHO_TTF "@DEFAULT_FONT_PATH@mincho.otf"
#define DEFAULT_MINCHO_TTF "@DEFAULT_FONT_PATH@mincho.ttf"
+5
View File
@@ -49,6 +49,11 @@ finds System 3.x game files (*.ALD) from the current directory.
Suppress text hook on specified scenario pages. _list_ is a comma-separated
list of page numbers. Used to suppress system messages, etc.
*-censor* _file_::
Enable Streamer Mode, which mosaics specific images to make them safe for
streaming. The _file_ is a text file containing a list of image numbers
to censor, one per line. Lines starting with '#' are treated as comments.
*-renderer* _name_::
Use the SDL rendering driver named _name_.
+5 -6
View File
@@ -1,8 +1,6 @@
install(FILES
MTLc3m.ttf
MTLc3m.ttf.license
mincho.otf
mincho.otf.license
mincho.ttf
DESTINATION share/xsystem35/fonts)
# pyftsubset is included in fonttools.
@@ -11,8 +9,9 @@ find_program(PYFTSUBSET_FOUND pyftsubset)
if (PYFTSUBSET_FOUND)
add_custom_target(fonts
COMMAND uchars > uchars.txt
COMMAND wget -O SourceHanSerifJP-Regular.otf https://github.com/adobe-fonts/source-han-serif/blob/release/SubsetOTF/JP/SourceHanSerifJP-Regular.otf?raw=true
COMMAND pyftsubset SourceHanSerifJP-Regular.otf --text-file=uchars.txt --output-file=subset.otf
COMMAND python3 ${CMAKE_CURRENT_SOURCE_DIR}/adjust_metrics.py subset.otf ${CMAKE_CURRENT_SOURCE_DIR}/mincho.otf
COMMAND wget -O ipam.zip https://moji.or.jp/wp-content/ipafont/IPAfont/ipam00303.zip
COMMAND unzip -o -j ipam.zip ipam00303/ipam.ttf
COMMAND pyftsubset ipam.ttf --text-file=uchars.txt --output-file=subset.ttf
COMMAND python3 ${CMAKE_CURRENT_SOURCE_DIR}/rename_font.py subset.ttf ${CMAKE_CURRENT_SOURCE_DIR}/mincho.ttf
)
endif()
-22
View File
@@ -1,22 +0,0 @@
#!/usr/bin/env python3
import sys
from fontTools.ttLib import TTFont
if len(sys.argv) != 3:
print('Usage: adjust_metrics.py infile outfile')
exit(1)
font = TTFont(sys.argv[1])
hhea = font['hhea']
os2 = font['OS/2']
if hhea.ascent != os2.sTypoAscender:
print(f'Changing hhea.ascent from {hhea.ascent} to {os2.sTypoAscender}')
hhea.ascent = os2.sTypoAscender
if hhea.descent != os2.sTypoDescender:
print(f'Changing hhea.descent from {hhea.descent} to {os2.sTypoDescender}')
hhea.descent = os2.sTypoDescender
font.save(sys.argv[2])
BIN
View File
Binary file not shown.
-92
View File
@@ -1,92 +0,0 @@
This Font Software is licensed under the SIL Open Font License,
Version 1.1.
This license is copied below, and is also available with a FAQ at:
http://scripts.sil.org/OFL
-----------------------------------------------------------
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
-----------------------------------------------------------
PREAMBLE
The goals of the Open Font License (OFL) are to stimulate worldwide
development of collaborative font projects, to support the font
creation efforts of academic and linguistic communities, and to
provide a free and open framework in which fonts may be shared and
improved in partnership with others.
The OFL allows the licensed fonts to be used, studied, modified and
redistributed freely as long as they are not sold by themselves. The
fonts, including any derivative works, can be bundled, embedded,
redistributed and/or sold with any software provided that any reserved
names are not used by derivative works. The fonts and derivatives,
however, cannot be released under any other type of license. The
requirement for fonts to remain under this license does not apply to
any document created using the fonts or their derivatives.
DEFINITIONS
"Font Software" refers to the set of files released by the Copyright
Holder(s) under this license and clearly marked as such. This may
include source files, build scripts and documentation.
"Reserved Font Name" refers to any names specified as such after the
copyright statement(s).
"Original Version" refers to the collection of Font Software
components as distributed by the Copyright Holder(s).
"Modified Version" refers to any derivative made by adding to,
deleting, or substituting -- in part or in whole -- any of the
components of the Original Version, by changing formats or by porting
the Font Software to a new environment.
"Author" refers to any designer, engineer, programmer, technical
writer or other person who contributed to the Font Software.
PERMISSION & CONDITIONS
Permission is hereby granted, free of charge, to any person obtaining
a copy of the Font Software, to use, study, copy, merge, embed,
modify, redistribute, and sell modified and unmodified copies of the
Font Software, subject to the following conditions:
1) Neither the Font Software nor any of its individual components, in
Original or Modified Versions, may be sold by itself.
2) Original or Modified Versions of the Font Software may be bundled,
redistributed and/or sold with any software, provided that each copy
contains the above copyright notice and this license. These can be
included either as stand-alone text files, human-readable headers or
in the appropriate machine-readable metadata fields within text or
binary files as long as those fields can be easily viewed by the user.
3) No Modified Version of the Font Software may use the Reserved Font
Name(s) unless explicit written permission is granted by the
corresponding Copyright Holder. This restriction only applies to the
primary font name as presented to the users.
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
Software shall not be used to promote, endorse or advertise any
Modified Version, except to acknowledge the contribution(s) of the
Copyright Holder(s) and the Author(s) or with their explicit written
permission.
5) The Font Software, modified or unmodified, in part or in whole,
must be distributed entirely under this license, and must not be
distributed under any other license. The requirement for fonts to
remain under this license does not apply to any document created using
the Font Software.
TERMINATION
This license becomes null and void if any of the above conditions are
not met.
DISCLAIMER
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
OTHER DEALINGS IN THE FONT SOFTWARE.
BIN
View File
Binary file not shown.
+33
View File
@@ -0,0 +1,33 @@
#!/usr/bin/env python3
# Rename the font's internal name records.
#
# IPA明朝 is distributed under the IPA Font License v1.0. A subset of it is a
# "Derived Program" under that license, and Article 3.1(4) forbids using or
# including the Licensed Program's name ("IPA"/"IPAMincho") as the program,
# font, or file name of the Derived Program. pyftsubset preserves the original
# name table, so rename it here to a name that does not contain "IPA".
import sys
from fontTools.ttLib import TTFont
if len(sys.argv) != 3:
print('Usage: rename_font.py infile outfile')
exit(1)
FAMILY = 'xsystem35 Mincho'
PSNAME = 'xsystem35-Mincho'
font = TTFont(sys.argv[1])
name = font['name']
# Rewrite the family / full / typographic-family / PostScript / unique-ID
# records in place, preserving each record's platform, encoding and language.
for rec in list(name.names):
if rec.nameID in (1, 4, 16):
value = FAMILY
elif rec.nameID in (3, 6):
value = PSNAME
else:
continue
name.setName(value, rec.nameID, rec.platformID, rec.platEncID, rec.langID)
font.save(sys.argv[2])
+2 -2
View File
@@ -42,7 +42,7 @@ Game Compatibility
| これD・P・S? | Supported | From 20世紀アリス |
| 夜が来る! | Unsupported | |
| Only you ~リ・クルス~ | Supported | |
| 大悪司 | Supported | Opening demo is not supported |
| 大悪司 | Supported | |
| 王子さまLv1 | Supported | |
| 王子さま1ヵ月後 | Supported | From 王子さまLV1.5 |
| 白鳳の子分叩き | Supported | From 王子さまLV1.5 |
@@ -62,7 +62,7 @@ Game Compatibility
| 翡翠の眸 | Unsupported | |
| 学園KING | Supported | From アリスCD |
| 学園KING 番外編 | Supported | From アリスCD |
| 蒼海にちて | Supported | From アリスCD |
| 蒼海にちて | Supported | From アリスCD |
| ぶろぶろ | Supported | From アリスCD |
| 裸ぶろぶろ狂 | Supported | From アリスCD |
| メイドのススメ | Supported | From アリスCD |
+117
View File
@@ -0,0 +1,117 @@
--------------------------------------------------
IPA Font License Agreement v1.0 <Japanese/English>
--------------------------------------------------
IPAフォントライセンスv1.0
許諾者は、この使用許諾(以下「本契約」といいます。)に定める条件の下で、許諾プログラム(1条に定義するところによります。)を提供します。受領者(1条に定義するところによります。)が、許諾プログラムを使用し、複製し、または頒布する行為、その他、本契約に定める権利の利用を行った場合、受領者は本契約に同意したものと見なします。
第1条 用語の定義
本契約において、次の各号に掲げる用語は、当該各号に定めるところによります。
1.「デジタル・フォント・プログラム」とは、フォントを含み、レンダリングしまたは表示するために用いられるコンピュータ・プログラムをいいます。
2.「許諾プログラム」とは、許諾者が本契約の下で許諾するデジタル・フォント・プログラムをいいます。
3.「派生プログラム」とは、許諾プログラムの一部または全部を、改変し、加除修正等し、入れ替え、その他翻案したデジタル・フォント・プログラムをいい、許諾プログラムの一部もしくは全部から文字情報を取り出し、またはデジタル・ドキュメント・ファイルからエンベッドされたフォントを取り出し、取り出された文字情報をそのまま、または改変をなして新たなデジタル・フォント・プログラムとして製作されたものを含みます。
4.「デジタル・コンテンツ」とは、デジタル・データ形式によってエンド・ユーザに提供される制作物のことをいい、動画・静止画等の映像コンテンツおよびテレビ番組等の放送コンテンツ、ならびに文字テキスト、画像、図形等を含んで構成された制作物を含みます。
5.「デジタル・ドキュメント・ファイル」とは、PDFファイルその他、各種ソフトウェア・プログラムによって製作されたデジタル・コンテンツであって、その中にフォントを表示するために許諾プログラムの全部または一部が埋め込まれた(エンベッドされた)ものをいいます。フォントが「エンベッドされた」とは、当該フォントが埋め込まれた特定の「デジタル・ドキュメント・ファイル」においてのみ表示されるために使用されている状態を指し、その特定の「デジタル・ドキュメント・ファイル」以外でフォントを表示するために使用できるデジタル・フォント・プログラムに含まれている場合と区別されます。
6.「コンピュータ」とは、本契約においては、サーバを含みます。
7.「複製その他の利用」とは、複製、譲渡、頒布、貸与、公衆送信、上映、展示、翻案その他の利用をいいます。
8.「受領者」とは、許諾プログラムを本契約の下で受領した人をいい、受領者から許諾プログラムを受領した人を含みます。
第2条 使用許諾の付与
許諾者は受領者に対し、本契約の条項に従い、すべての国で、許諾プログラムを使用することを許諾します。ただし、許諾プログラムに存在する一切の権利はすべて許諾者が保有しています。本契約は、本契約で明示的に定められている場合を除き、いかなる意味においても、許諾者が保有する許諾プログラムに関する一切の権利および、いかなる商標、商号、もしくはサービス・マークに関する権利をも受領者に移転するものではありません。
1.受領者は本契約に定める条件に従い、許諾プログラムを任意の数のコンピュータにインストールし、当該コンピュータで使用することができます。
2.受領者はコンピュータにインストールされた許諾プログラムをそのまま、または改変を行ったうえで、印刷物およびデジタル・コンテンツにおいて、文字テキスト表現等として使用することができます。
3.受領者は前項の定めに従い作成した印刷物およびデジタル・コンテンツにつき、その商用・非商用の別、および放送、通信、各種記録メディアなどの媒体の形式を問わず、複製その他の利用をすることができます。
4.受領者がデジタル・ドキュメント・ファイルからエンベッドされたフォントを取り出して派生プログラムを作成した場合には、かかる派生プログラムは本契約に定める条件に従う必要があります。
5.許諾プログラムのエンベッドされたフォントがデジタル・ドキュメント・ファイル内のデジタル・コンテンツをレンダリングするためにのみ使用される場合において、受領者が当該デジタル・ドキュメント・ファイルを複製その他の利用をする場合には、受領者はかかる行為に関しては本契約の下ではいかなる義務をも負いません。
6.受領者は、3条2項の定めに従い、商用・非商用を問わず、許諾プログラムをそのままの状態で改変することなく複製して第三者への譲渡し、公衆送信し、その他の方法で再配布することができます(以下、「再配布」といいます。)。
7.受領者は、上記の許諾プログラムについて定められた条件と同様の条件に従って、派生プログラムを作成し、使用し、複製し、再配布することができます。ただし、受領者が派生プログラムを再配布する場合には、3条1項の定めに従うものとします。
第3条 制限
前条により付与された使用許諾は、以下の制限に服します。
1.派生プログラムが前条4項及び7項に基づき再配布される場合には、以下の全ての条件を満たさなければなりません。
 (1)派生プログラムを再配布する際には、下記もまた、当該派生プログラムと一緒に再配布され、オンラインで提供され、または、郵送費・媒体及び取扱手数料の合計を超えない実費と引き換えに媒体を郵送する方法により提供されなければなりません。
  (a)派生プログラムの写し; および
  (b)派生プログラムを作成する過程でフォント開発プログラムによって作成された追加のファイルであって派生プログラムをさらに加工するにあたって利用できるファイルが存在すれば、当該ファイル
 (2)派生プログラムの受領者が、派生プログラムを、このライセンスの下で最初にリリースされた許諾プログラム(以下、「オリジナル・プログラム」といいます。)に置き換えることができる方法を再配布するものとします。かかる方法は、オリジナル・ファイルからの差分ファイルの提供、または、派生プログラムをオリジナル・プログラムに置き換える方法を示す指示の提供などが考えられます。
 (3)派生プログラムを、本契約書に定められた条件の下でライセンスしなければなりません。
 (4)派生プログラムのプログラム名、フォント名またはファイル名として、許諾プログラムが用いているのと同一の名称、またはこれを含む名称を使用してはなりません。
 (5)本項の要件を満たすためにオンラインで提供し、または媒体を郵送する方法で提供されるものは、その提供を希望するいかなる者によっても提供が可能です。
2.受領者が前条6項に基づき許諾プログラムを再配布する場合には、以下の全ての条件を満たさなければなりません。
 (1)許諾プログラムの名称を変更してはなりません。
 (2)許諾プログラムに加工その他の改変を加えてはなりません。
 (3)本契約の写しを許諾プログラムに添付しなければなりません。
3.許諾プログラムは、現状有姿で提供されており、許諾プログラムまたは派生プログラムについて、許諾者は一切の明示または黙示の保証(権利の所在、非侵害、商品性、特定目的への適合性を含むがこれに限られません)を行いません。いかなる場合にも、その原因を問わず、契約上の責任か厳格責任か過失その他の不法行為責任かにかかわらず、また事前に通知されたか否かにかかわらず、許諾者は、許諾プログラムまたは派生プログラムのインストール、使用、複製その他の利用または本契約上の権利の行使によって生じた一切の損害(直接・間接・付随的・特別・拡大・懲罰的または結果的損害)(商品またはサービスの代替品の調達、システム障害から生じた損害、現存するデータまたはプログラムの紛失または破損、逸失利益を含むがこれに限られません)について責任を負いません。
4.許諾プログラムまたは派生プログラムのインストール、使用、複製その他の利用に関して、許諾者は技術的な質問や問い合わせ等に対する対応その他、いかなるユーザ・サポートをも行う義務を負いません。
第4条 契約の終了
1.本契約の有効期間は、受領者が許諾プログラムを受領した時に開始し、受領者が許諾プログラムを何らかの方法で保持する限り続くものとします。
2.前項の定めにかかわらず、受領者が本契約に定める各条項に違反したときは、本契約は、何らの催告を要することなく、自動的に終了し、当該受領者はそれ以後、許諾プログラムおよび派生プログラムを一切使用しまたは複製その他の利用をすることができないものとします。ただし、かかる契約の終了は、当該違反した受領者から許諾プログラムまたは派生プログラムの配布を受けた受領者の権利に影響を及ぼすものではありません。
第5条 準拠法
1.IPAは、本契約の変更バージョンまたは新しいバージョンを公表することができます。その場合には、受領者は、許諾プログラムまたは派生プログラムの使用、複製その他の利用または再配布にあたり、本契約または変更後の契約のいずれかを選択することができます。その他、上記に記載されていない条項に関しては日本の著作権法および関連法規に従うものとします。
2.本契約は、日本法に基づき解釈されます。
----------
IPA Font License Agreement v1.0
The Licensor provides the Licensed Program (as defined in Article 1 below) under the terms of this license agreement (“Agreement”). Any use, reproduction or distribution of the Licensed Program, or any exercise of rights under this Agreement by a Recipient (as defined in Article 1 below) constitutes the Recipient's acceptance of this Agreement.
Article 1 (Definitions)
1.“Digital Font Program” shall mean a computer program containing, or used to render or display fonts.
2.“Licensed Program” shall mean a Digital Font Program licensed by the Licensor under this Agreement.
3.“Derived Program” shall mean a Digital Font Program created as a result of a modification, addition, deletion, replacement or any other adaptation to or of a part or all of the Licensed Program, and includes a case where a Digital Font Program newly created by retrieving font information from a part or all of the Licensed Program or Embedded Fonts from a Digital Document File with or without modification of the retrieved font information.
4.“Digital Content” shall mean products provided to end users in the form of digital data, including video content, motion and/or still pictures, TV programs or other broadcasting content and products consisting of character text, pictures, photographic images, graphic symbols and/or the like.
5.“Digital Document File” shall mean a PDF file or other Digital Content created by various software programs in which a part or all of the Licensed Program becomes embedded or contained in the file for the display of the font (“Embedded Fonts”). Embedded Fonts are used only in the display of characters in the particular Digital Document File within which they are embedded, and shall be distinguished from those in any Digital Font Program, which may be used for display of characters outside that particular Digital Document File.
6.“Computer” shall include a server in this Agreement.
7.“Reproduction and Other Exploitation” shall mean reproduction, transfer, distribution, lease, public transmission, presentation, exhibition, adaptation and any other exploitation.
8.“Recipient” shall mean anyone who receives the Licensed Program under this Agreement, including one that receives the Licensed Program from a Recipient.
Article 2 (Grant of License)
The Licensor grants to the Recipient a license to use the Licensed Program in any and all countries in accordance with each of the provisions set forth in this Agreement. However, any and all rights underlying in the Licensed Program shall be held by the Licensor. In no sense is this Agreement intended to transfer any right relating to the Licensed Program held by the Licensor except as specifically set forth herein or any right relating to any trademark, trade name, or service mark to the Recipient.
1.The Recipient may install the Licensed Program on any number of Computers and use the same in accordance with the provisions set forth in this Agreement.
2.The Recipient may use the Licensed Program, with or without modification in printed materials or in Digital Content as an expression of character texts or the like.
3.The Recipient may conduct Reproduction and Other Exploitation of the printed materials and Digital Content created in accordance with the preceding Paragraph, for commercial or non-commercial purposes and in any form of media including but not limited to broadcasting, communication and various recording media.
4.If any Recipient extracts Embedded Fonts from a Digital Document File to create a Derived Program, such Derived Program shall be subject to the terms of this agreement.
5.If any Recipient performs Reproduction or Other Exploitation of a Digital Document File in which Embedded Fonts of the Licensed Program are used only for rendering the Digital Content within such Digital Document File then such Recipient shall have no further obligations under this Agreement in relation to such actions.
6.The Recipient may reproduce the Licensed Program as is without modification and transfer such copies, publicly transmit or otherwise redistribute the Licensed Program to a third party for commercial or non-commercial purposes (“Redistribute”), in accordance with the provisions set forth in Article 3 Paragraph 2.
7.The Recipient may create, use, reproduce and/or Redistribute a Derived Program under the terms stated above for the Licensed Program: provided, that the Recipient shall follow the provisions set forth in Article 3 Paragraph 1 when Redistributing the Derived Program.
Article 3 (Restriction)
The license granted in the preceding Article shall be subject to the following restrictions:
1.If a Derived Program is Redistributed pursuant to Paragraph 4 and 7 of the preceding Article, the following conditions must be met :
 (1)The following must be also Redistributed together with the Derived Program, or be made available online or by means of mailing mechanisms in exchange for a cost which does not exceed the total costs of postage, storage medium and handling fees:
  (a)a copy of the Derived Program; and
  (b)any additional file created by the font developing program in the course of creating the Derived Program that can be used for further modification of the Derived Program, if any.
 (2)It is required to also Redistribute means to enable recipients of the Derived Program to replace the Derived Program with the Licensed Program first released under this License (the “Original Program”). Such means may be to provide a difference file from the Original Program, or instructions setting out a method to replace the Derived Program with the Original Program.
 (3)The Recipient must license the Derived Program under the terms and conditions of this Agreement.
 (4)No one may use or include the name of the Licensed Program as a program name, font name or file name of the Derived Program.
 (5)Any material to be made available online or by means of mailing a medium to satisfy the requirements of this paragraph may be provided, verbatim, by any party wishing to do so.
2.If the Recipient Redistributes the Licensed Program pursuant to Paragraph 6 of the preceding Article, the Recipient shall meet all of the following conditions:
 (1)The Recipient may not change the name of the Licensed Program.
 (2)The Recipient may not alter or otherwise modify the Licensed Program.
 (3)The Recipient must attach a copy of this Agreement to the Licensed Program.
3.THIS LICENSED PROGRAM IS PROVIDED BY THE LICENSOR “AS IS” AND ANY EXPRESSED OR IMPLIED WARRANTY AS TO THE LICENSED PROGRAM OR ANY DERIVED PROGRAM, INCLUDING, BUT NOT LIMITED TO, WARRANTIES OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE, ARE DISCLAIMED. IN NO EVENT SHALL THE LICENSOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXTENDED, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO; PROCUREMENT OF SUBSTITUTED GOODS OR SERVICE; DAMAGES ARISING FROM SYSTEM FAILURE; LOSS OR CORRUPTION OF EXISTING DATA OR PROGRAM; LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE INSTALLATION, USE, THE REPRODUCTION OR OTHER EXPLOITATION OF THE LICENSED PROGRAM OR ANY DERIVED PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
4.The Licensor is under no obligation to respond to any technical questions or inquiries, or provide any other user support in connection with the installation, use or the Reproduction and Other Exploitation of the Licensed Program or Derived Programs thereof.
Article 4 (Termination of Agreement)
1.The term of this Agreement shall begin from the time of receipt of the Licensed Program by the Recipient and shall continue as long as the Recipient retains any such Licensed Program in any way.
2.Notwithstanding the provision set forth in the preceding Paragraph, in the event of the breach of any of the provisions set forth in this Agreement by the Recipient, this Agreement shall automatically terminate without any notice. In the case of such termination, the Recipient may not use or conduct Reproduction and Other Exploitation of the Licensed Program or a Derived Program: provided that such termination shall not affect any rights of any other Recipient receiving the Licensed Program or the Derived Program from such Recipient who breached this Agreement.
Article 5 (Governing Law)
1.IPA may publish revised and/or new versions of this License. In such an event, the Recipient may select either this Agreement or any subsequent version of the Agreement in using, conducting the Reproduction and Other Exploitation of, or Redistributing the Licensed Program or a Derived Program. Other matters not specified above shall be subject to the Copyright Law of Japan and other related laws and regulations of Japan.
2.This Agreement shall be construed under the laws of Japan.
+22
View File
@@ -0,0 +1,22 @@
// NanoJPEG -- KeyJ's Tiny Baseline JPEG Decoder
// version 1.3.5 (2016-11-14)
// Copyright (c) 2009-2016 Martin J. Fiedler <martin.fiedler@gmx.net>
// published under the terms of the MIT license
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to
// deal in the Software without restriction, including without limitation the
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
// sell copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
+21
View File
@@ -0,0 +1,21 @@
# Censor Lists for Streamer Mode
This directory contains sample censor lists for various games, intended for use
with xsystem35's Streamer Mode.
## Usage
To use a censor list, specify its path with the `-censor` command-line option
or in your `.xsys35rc` file. For example:
```bash
xsystem35 -censor misc/censor/kichikuou.txt
```
The list files contain image numbers (integers), one per line. Lines starting
with `#` are treated as comments.
## Contributing
We welcome contributions of censor lists for other games! If you have created
a censor list that you'd like to share, please open a Pull Request.
+164
View File
@@ -0,0 +1,164 @@
# Censor list for 鬼畜王ランス (Kichikuou Rance)
27
70
93
101
102
103
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
123
124
125
126
127
128
129
130
131
132
133
134
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
160
161
162
163
164
165
166
167
168
169
171
172
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
193
195
196
197
198
199
200
201
203
204
205
206
207
208
209
210
214
215
216
217
218
219
221
222
224
225
226
227
228
229
230
231
232
233
234
235
239
299
300
361
362
363
375
376
377
393
422
461
466
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
517
844
845
846
847
848
851
852
853
854
855
+1 -2
View File
@@ -15,7 +15,6 @@ add_library(modules STATIC
MsgSkip/MsgSkip.c
NIGHTDLL/NIGHTDLL.c
NIGHTDLL/nt_scenario.c
NIGHTDLL/sactcg.c
NIGHTDLL/sactstring.c
NIGHTDLL/sprite.c
NIGHTDLL/sprite_draw.c
@@ -30,7 +29,6 @@ add_library(modules STATIC
RandMT/RandMT.c
S3xMusic/S3xMusic.c
SACT/SACT.c
SACT/sactcg.c
SACT/sactsound.c
SACT/sacttimer.c
SACT/sactstring.c
@@ -68,6 +66,7 @@ add_library(modules STATIC
lib/drawtext.c
lib/list.c
lib/graph_blend_amap.c
lib/sactcg.c
nDEMO/nDEMO.c
nDEMOE/nDEMOE.c
oDEMO/oDEMO.c
+4 -4
View File
@@ -33,7 +33,7 @@
#include "ags.h"
#include "pms.h"
#include "qnt.h"
#include "sdl_core.h"
#include "gfx.h"
#include "ngraph.h"
#include "dri.h"
#include "ald_manager.h"
@@ -73,21 +73,21 @@ static surface_t *sf_getcg(void *b, size_t size) {
cg->alpha = cg->pic;
cg->pic = NULL;
sf = sf_create_alpha(cg->width, cg->height);
sdl_drawImageAlphaMap(cg, sf, 0, 0);
gfx_drawImageAlphaMap(cg, sf, 0, 0);
break;
case ALCG_PMS16:
cg = pms64k_extract(b);
sf = cg->alpha
? sf_create_surface(cg->width, cg->height)
: sf_create_pixel(cg->width, cg->height);
sdl_drawImage16(cg, sf, 0, 0, 255, false);
gfx_drawImage16(cg, sf, 0, 0, 255, false);
break;
case ALCG_QNT:
cg = qnt_extract(b);
sf = cg->alpha
? sf_create_surface(cg->width, cg->height)
: sf_create_pixel(cg->width, cg->height);
sdl_drawImage24(cg, sf, 0, 0, 255);
gfx_drawImage24(cg, sf, 0, 0, 255);
break;
default:
WARNING("Unknown Cg Type");
+5 -5
View File
@@ -5,7 +5,7 @@
#include "portab.h"
#include "system.h"
#include "surface.h"
#include "sdl_core.h"
#include "effect.h"
#include "ags.h"
#include "input.h"
#include "graph.h"
@@ -24,17 +24,17 @@ void gpx_effect(int no,
*endtype = 0;
enum sdl_effect_type type = from_sact_effect(no);
enum effect_type type = from_sact_effect(no);
if (type == EFFECT_INVALID) {
WARNING("Unimplemented effect %d", no);
type = EFFECT_CROSSFADE;
}
SDL_Rect rect = { wx, wy, width, height };
struct sdl_effect *eff = sdl_effect_init(&rect, dst, dx, dy, src, sx, sy, type);
struct effect *eff = effect_init(&rect, dst, dx, dy, src, sx, sy, type);
if (!time)
time = (no == SACT_EFFECT_CROSSFADE_DOWN || no == SACT_EFFECT_CROSSFADE_UP) ? 1150 : 2700;
ags_runEffect(time, false, (ags_EffectStepFunc)sdl_effect_step, eff);
sdl_effect_finish(eff);
ags_runEffect(time, false, (ags_EffectStepFunc)effect_step, eff);
effect_finish(eff);
switch (no) {
case SACT_EFFECT_FADEOUT:
+4 -4
View File
@@ -11,7 +11,7 @@
#include "graph.h"
#include "ngraph.h"
#include "ags.h"
#include "sdl_core.h"
#include "gfx.h"
/**
* surface から surface にコピーなどをする際に、転送元と転送先のsurface
@@ -33,8 +33,8 @@
*/
bool gr_clip(surface_t *ss, int *sx, int *sy, int *sw, int *sh, surface_t *ds, int *dx, int *dy) {
if (!ss || !ds) return false;
MyRectangle src_window = { 0, 0, ss->width, ss->height };
MyRectangle dst_window = { 0, 0, ds->width, ds->height };
SDL_Rect src_window = { 0, 0, ss->width, ss->height };
SDL_Rect dst_window = { 0, 0, ds->width, ds->height };
return ags_clipCopyRect(&src_window, &dst_window, sx, sy, dx, dy, sw, sh);
}
@@ -75,7 +75,7 @@ void gr_copy(surface_t *dst, int dx, int dy, surface_t *src, int sx, int sy, int
if (dst == src) {
SDL_Rect r;
if (SDL_IntersectRect(&src_rect, &dst_rect, &r)) {
SDL_Surface *view = sdl_createSurfaceView(src->sdl_surface, sx, sy, sw, sh);
SDL_Surface *view = gfx_createSurfaceView(src->sdl_surface, sx, sy, sw, sh);
SDL_Surface *tmp = SDL_ConvertSurface(view, dst->sdl_surface->format, 0);
src_rect.x = 0;
src_rect.y = 0;
+1 -1
View File
@@ -46,7 +46,7 @@ static void NIGHTDLL_reset(void) {
if (night.sp[i])
nt_sp_free(night.sp[i]);
}
nt_scg_freeall();
scg_freeall();
memset(&night, 0, sizeof(night));
}
+1 -6
View File
@@ -3,7 +3,6 @@
#include "config.h"
#include "portab.h"
#include "graphics.h"
#include "ags.h"
#include "sprite.h"
@@ -38,11 +37,7 @@ struct _night {
int waitskiplv;
int waitkey;
// graph
// cginfo_t *cg[CGMAX];
MyRectangle updaterect;
SDL_Rect updaterect;
FontType fonttype;
int fontsize;
+2 -2
View File
@@ -53,8 +53,8 @@ void nt_gr_set_wallpaper(int no) {
sp = nt_sp_new(SPNO_WALL, no, 0, 0, SPRITE_WP);
nt_sp_add_updatelist(sp);
if (no == 0) {
sp->cursize.width = main_surface->w;
sp->cursize.height = main_surface->h;
sp->width = main_surface->w;
sp->height = main_surface->h;
sp->update = nt_sp_draw_wall;
}
+16 -17
View File
@@ -7,7 +7,6 @@
#include "portab.h"
#include "system.h"
#include "sdl_core.h"
#include "utfsjis.h"
#include "ags.h"
#include "nact.h"
@@ -83,7 +82,7 @@ void ntmsg_init() {
nt_sp_add_updatelist(sp);
// 文字背景CG作成
nt_scg_create(CGNO_MSGFR_BG,
scg_create(CGNO_MSGFR_BG,
main_surface->w, main_surface->h,
0, 0, 0, 255);
// night.cg[CGNO_MSGFR_BG]->refcnt++;
@@ -93,9 +92,9 @@ void ntmsg_init() {
nt_sp_add_updatelist(sp);
// キー入力アニメーションCG作成
nt_scg_cut(CGNO_MSGHAK_1, CGNO_MSGHAK_LCG, 0, 0, 9, 9);
scg_cut(CGNO_MSGHAK_1, CGNO_MSGHAK_LCG, 0, 0, 9, 9);
//night.cg[CGNO_MSGHAK_1]->refcnt++;
nt_scg_cut(CGNO_MSGHAK_2, CGNO_MSGHAK_LCG, 0, 9, 9, 9);
scg_cut(CGNO_MSGHAK_2, CGNO_MSGHAK_LCG, 0, 9, 9, 9);
//night.cg[CGNO_MSGHAK_2]->refcnt++;
sp = night.sp[SPNO_MSG_KEYANIM] = nt_sp_new(SPNO_MSG_KEYANIM, CGNO_MSGHAK_1, CGNO_MSGHAK_2, 0, SPRITE_ANIME);
sp->u.anime.interval = HAKANIM_INTERVAL;
@@ -217,7 +216,7 @@ static void ntmsg_out(int wNum, int wSize, int wColorR, int wColorG, int wColorB
char *msg;
sprite_t *sp;
bool needupdate = false;
MyRectangle uparea = {0,0,0,0};
SDL_Rect uparea = {0,0,0,0};
int savex;
if (night.msgbuf[0] == '\0') return;
@@ -236,7 +235,7 @@ static void ntmsg_out(int wNum, int wSize, int wColorR, int wColorG, int wColorB
char mbuf[20];
int cw, delta, wcnt;
wcnt = sdl_getTicks();
wcnt = sys_get_ticks();
mbuf[0] = '\0';
msg = get_char(msg, mbuf, sizeof(mbuf) -1);
@@ -267,7 +266,7 @@ static void ntmsg_out(int wNum, int wSize, int wColorR, int wColorG, int wColorB
needupdate = false;
// keywait
delta = sdl_getTicks() - wcnt;
delta = sys_get_ticks() - wcnt;
if (delta < wSpeed) {
if (sys_keywait(wSpeed - delta, KEYWAIT_NONCANCELABLE)) {
@@ -284,8 +283,8 @@ static void ntmsg_out(int wNum, int wSize, int wColorR, int wColorG, int wColorB
// Waitなしの出力は最後にupdate
if (needupdate) {
uparea.w = sp->cursize.width;
uparea.h = min(sp->cursize.height, uparea.y - sp->u.msg.dspcur.y + wLineSpace + wLineSpace);
uparea.w = sp->width;
uparea.h = min(sp->height, uparea.y - sp->u.msg.dspcur.y + wLineSpace + wLineSpace);
nt_sp_updateme_part(sp, uparea.x, uparea.y, uparea.w, uparea.h);
}
@@ -311,14 +310,14 @@ static int ntmsg_keywait() {
night.waitkey = -1;
while (night.waitkey == -1 && !nact->is_quit) {
int st = sdl_getTicks();
int st = sys_get_ticks();
int interval = 25;
if (!night.zhiding) {
interval = night.sp[SPNO_MSG_KEYANIM]->u.anime.interval;
hakanim(i++);
}
sys_keywait(interval - (sdl_getTicks() - st), KEYWAIT_NONCANCELABLE);
sys_keywait(interval - (sys_get_ticks() - st), KEYWAIT_NONCANCELABLE);
}
night.waittype = KEYWAIT_NONE;
@@ -355,8 +354,8 @@ static void set_align(char *msg, sprite_t *sp, int wSize) {
maxchar = max(maxchar, c);
line++;
sp->u.msg.dspcur.x = (sp->cursize.width - (maxchar * wSize/2)) /2;
sp->u.msg.dspcur.y = (sp->cursize.height - (line * (wSize+2))) /2;
sp->u.msg.dspcur.x = (sp->width - (maxchar * wSize/2)) /2;
sp->u.msg.dspcur.y = (sp->height - (line * (wSize+2))) /2;
break;
case 2:
sp->u.msg.dspcur.x = msgframe_2.x;
@@ -436,14 +435,14 @@ static void hakanim(int i) {
sp->show = show;
}
void ntmsg_update(sprite_t *sp, MyRectangle *r) {
SDL_Rect sp_rect = {0, 0, sp->cursize.width, sp->cursize.height};
void ntmsg_update(sprite_t *sp, SDL_Rect *r) {
SDL_Rect sp_rect = {0, 0, sp->width, sp->height};
int sx = 0;
int sy = 0;
int dx = sp->cur.x;
int dy = sp->cur.y;
int w = sp->cursize.width;
int h = sp->cursize.height;
int w = sp->width;
int h = sp->height;
if (!ags_clipCopyRect(&sp_rect, r, &sx, &sy, &dx, &dy, &w, &h)) {
return;
}
+1 -1
View File
@@ -7,6 +7,6 @@ void ntmsg_set_place(int type);
void ntmsg_newline();
void ntmsg_add(const char *msg);
int ntmsg_ana(void);
void ntmsg_update(sprite_t *sp, MyRectangle *r);
void ntmsg_update(sprite_t *sp, SDL_Rect *r);
#endif /* __NT_MSG_H__ */
-1
View File
@@ -8,7 +8,6 @@
#include "portab.h"
#include "system.h"
#include "input.h"
#include "sdl_core.h"
#include "scheduler.h"
#include "xsystem35.h"
#include "nact.h"
-146
View File
@@ -1,146 +0,0 @@
/*
* sactcg.c: CG作成
*
* Copyright (C) 1997-1998 Masaki Chikama (Wren) <chikama@kasumi.ipl.mech.nagoya-u.ac.jp>
* 1998- <masaki-c@is.aist-nara.ac.jp>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
/* $Id: sactcg.c,v 1.2 2003/11/16 15:29:52 chikama Exp $ */
#include "config.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <SDL.h>
#include "portab.h"
#include "nact.h"
#include "system.h"
#include "ags.h"
#include "cg.h"
#include "sactcg.h"
#define CGMAX 65536
static cginfo_t *cgs[CGMAX];
#define SPCG_ASSERT_NO(no) \
if ((no) > (CGMAX -1)) { \
WARNING("no is too large (should be %d < %d)", (no), CGMAX); \
return; \
} \
static cginfo_t *nt_scg_new(enum cgtype type, int no, SDL_Surface *sf) {
cginfo_t *info = calloc(1, sizeof(cginfo_t));
info->type = type;
info->no = no;
info->sf = sf;
info->refcnt = 1;
nt_scg_free(no);
cgs[no] = info;
return info;
}
/*
cgの読み込み
指定の番号のCGをリンクファイルから読み込んだり、
CG_xxxで作成したCGを参照する
@param no: 読み込むCG番号
*/
static cginfo_t *nt_scg_get(int no) {
if (no >= (CGMAX -1)) {
WARNING("no is too large (should be %d < %d)", (no), CGMAX);
return NULL;
}
if (cgs[no] != NULL)
return cgs[no];
SDL_Surface *sf = cg_load_as_sdlsurface(no - 1);
if (!sf) {
WARNING("load fail (%d)", no -1);
return NULL;
}
return nt_scg_new(CG_LINKED, no, sf);
}
cginfo_t *nt_scg_addref(int no) {
cginfo_t *info = nt_scg_get(no);
if (info)
info->refcnt++;
return info;
}
void nt_scg_deref(cginfo_t *cg) {
if (--cg->refcnt > 0)
return;
if (cg->sf)
SDL_FreeSurface(cg->sf);
free(cg);
}
// 指定の大きさ、色の矩形の CG を作成
void nt_scg_create(int wNumCG, int wWidth, int wHeight, int wR, int wG, int wB, int wBlendRate) {
SPCG_ASSERT_NO(wNumCG);
SDL_Surface *sf = SDL_CreateRGBSurfaceWithFormat(0, wWidth, wHeight, 32, SDL_PIXELFORMAT_ARGB8888);
SDL_FillRect(sf, NULL, SDL_MapRGBA(sf->format, wR, wG, wB, wBlendRate));
nt_scg_new(CG_SET, wNumCG, sf);
}
// CGの一部を切りぬいたCGを作成
void nt_scg_cut(int wNumDstCG, int wNumSrcCG, int wX, int wY, int wWidth, int wHeight) {
SPCG_ASSERT_NO(wNumDstCG);
SPCG_ASSERT_NO(wNumSrcCG);
cginfo_t *src = nt_scg_get(wNumSrcCG);
if (!src)
return;
SDL_Surface *sf = SDL_CreateRGBSurfaceWithFormat(0, wWidth, wHeight, src->sf->format->BitsPerPixel, src->sf->format->format);
SDL_BlitSurface(src->sf, &(SDL_Rect){wX, wY, wWidth, wHeight}, sf, NULL);
nt_scg_new(CG_SET, wNumDstCG, sf);
}
// 全てのCGの開放
void nt_scg_freeall(void) {
int i;
for (i = 1; i < CGMAX; i++) {
nt_scg_free(i);
}
}
/**
* 指定の番号の CG をオブジェクトリストから消し、オブジェクトがどこからも参照
* されていない(参照数が0の)場合のみ、オブジェクトを削除
*/
void nt_scg_free(int no) {
SPCG_ASSERT_NO(no);
cginfo_t *cg = cgs[no];
if (!cg) return;
nt_scg_deref(cg);
cgs[no] = NULL;
}
+18 -18
View File
@@ -16,9 +16,9 @@ sprite_t *nt_sp_new(int no, int cg1, int cg2, int cg3, int type) {
sp->no = no;
sp->type = type;
sp->cg1 = cg1 ? nt_scg_addref(cg1) : NULL;
sp->cg2 = cg2 ? nt_scg_addref(cg2) : NULL;
sp->cg3 = cg3 ? nt_scg_addref(cg3) : NULL;
sp->cg1 = cg1 ? scg_addref(cg1) : NULL;
sp->cg2 = cg2 ? scg_addref(cg2) : NULL;
sp->cg3 = cg3 ? scg_addref(cg3) : NULL;
sp->curcg = sp->cg1;
sp->show = true;
@@ -28,11 +28,11 @@ sprite_t *nt_sp_new(int no, int cg1, int cg2, int cg3, int type) {
sp->cur = sp->loc;
if (sp->curcg == NULL) {
sp->cursize.width = 0;
sp->cursize.height = 0;
sp->width = 0;
sp->height = 0;
} else {
sp->cursize.width = sp->curcg->sf->w;
sp->cursize.height = sp->curcg->sf->h;
sp->width = sp->curcg->sf->w;
sp->height = sp->curcg->sf->h;
}
sp->update = DEFAULT_UPDATE;
@@ -58,8 +58,8 @@ sprite_t *nt_sp_msg_new(int no, int x, int y, int width, int height) {
sp->loc.x = x;
sp->loc.y = y;
sp->cur = sp->loc;
sp->cursize.width = width;
sp->cursize.height = height;
sp->width = width;
sp->height = height;
sp->u.msg.dspcur.x = 0;
sp->u.msg.dspcur.y = 0;
sp->u.msg.canvas = SDL_CreateRGBSurfaceWithFormat(0, width, height, 32, SDL_PIXELFORMAT_ARGB8888);
@@ -71,9 +71,9 @@ sprite_t *nt_sp_msg_new(int no, int x, int y, int width, int height) {
void nt_sp_free(sprite_t *sp) {
if (sp == NULL) return;
if (sp->cg1) nt_scg_deref(sp->cg1);
if (sp->cg2) nt_scg_deref(sp->cg2);
if (sp->cg3) nt_scg_deref(sp->cg3);
if (sp->cg1) scg_deref(sp->cg1);
if (sp->cg2) scg_deref(sp->cg2);
if (sp->cg3) scg_deref(sp->cg3);
if (sp->type == SPRITE_MSG) {
SDL_FreeSurface(sp->u.msg.canvas);
@@ -102,16 +102,16 @@ void nt_sp_set_cg(sprite_t *sp, int no) {
if (sp == NULL) return;
if (sp->curcg)
nt_scg_deref(sp->curcg);
scg_deref(sp->curcg);
cg = no ? nt_scg_addref(no) : NULL;
cg = no ? scg_addref(no) : NULL;
if (cg == NULL) {
sp->cursize.width = 0;
sp->cursize.height = 0;
sp->width = 0;
sp->height = 0;
} else {
sp->cursize.width = cg->sf->w;
sp->cursize.height = cg->sf->h;
sp->width = cg->sf->w;
sp->height = cg->sf->h;
}
sp->curcg = cg;
+11 -29
View File
@@ -3,7 +3,8 @@
#define __SPRITE_H__
#include "portab.h"
#include "graphics.h"
#include <SDL_rect.h>
#include "sactcg.h"
#define DEFAULT_UPDATE nt_sp_draw
@@ -21,7 +22,6 @@
#define SPNO_MSG_KEYANIM 12 // メッセージキー入力アニメーション
#define SPNO_MSG_ICON_MUTE 13 // メッセージウィンドアイコン
#define CGMAX 65536
// 0-9999: reserve for Link CG
// 2051: メッセージウィンド枠CG
#define CGNO_MSGFRAME_LCG 2051
@@ -40,25 +40,6 @@
#define CGNO_MSGFR_BG 10002
// CG_XX で作るCGの種類
enum cgtype {
CG_NOTUSED = 0,
CG_LINKED = 1,
CG_SET = 2,
CG_REVERSE = 3,
CG_STRETCH = 4
};
// cgに関する情報
struct _cginfo {
enum cgtype type; // CGの種類, 0: 未使用, 1:リンクされている, ...
int no; // CGの番号
struct SDL_Surface *sf;
int refcnt; // 参照カウンタ。0になったら開放してもよい。
};
typedef struct _cginfo cginfo_t;
enum spritetype {
SPRITE_NORMAL = 0,
SPRITE_ANIME = 5,
@@ -72,7 +53,8 @@ struct _sprite {
int no;
MyDimension cursize;
int width;
int height;
cginfo_t *curcg;
cginfo_t *cg1, *cg2, *cg3;
@@ -81,11 +63,11 @@ struct _sprite {
int blendrate;
MyPoint loc;
SDL_Point loc;
MyPoint cur;
SDL_Point cur;
void (* update)(struct _sprite *sp, MyRectangle *updatearea);
void (* update)(struct _sprite *sp, SDL_Rect *updatearea);
union {
struct {
@@ -97,7 +79,7 @@ struct _sprite {
struct {
struct SDL_Surface *canvas;
MyPoint dspcur;
SDL_Point dspcur;
} msg;
} u;
};
@@ -120,12 +102,12 @@ void nt_sp_updateme(sprite_t *sp);
void nt_sp_updateme_part(sprite_t *sp, int x, int y, int w, int h);
void nt_sp_add_updatelist(sprite_t *sp);
void nt_sp_remove_updatelist(sprite_t *sp);
void nt_sp_draw_wall(sprite_t *sp, MyRectangle *r);
void nt_sp_draw_wall(sprite_t *sp, SDL_Rect *r);
void nt_sp_clear_updatelist(void);
/* in nt_sprite_draw.c */
void nt_sp_draw(sprite_t *sp, MyRectangle *r);
void nt_sp_draw_scg(sprite_t *sp, MyRectangle *r);
void nt_sp_draw(sprite_t *sp, SDL_Rect *r);
void nt_sp_draw_scg(sprite_t *sp, SDL_Rect *r);
/* in nt_sprite_eupdate.c */
void nt_sp_eupdate(int type, int time, int cancel);
+2 -3
View File
@@ -29,7 +29,6 @@
#include "portab.h"
#include "system.h"
#include "ags.h"
#include "graphics.h"
#include "sprite.h"
/*
@@ -37,7 +36,7 @@
@param sp: 描画するスプライト
@param r : 再描画する領域
*/
void nt_sp_draw(sprite_t *sp, MyRectangle *r) {
void nt_sp_draw(sprite_t *sp, SDL_Rect *r) {
if (sp == NULL) return;
cginfo_t *cg = sp->curcg;
if (cg == NULL) return;
@@ -69,7 +68,7 @@ void nt_sp_draw(sprite_t *sp, MyRectangle *r) {
}
// BlendScreenによる描画
void nt_sp_draw_scg(sprite_t *sp, MyRectangle *r) {
void nt_sp_draw_scg(sprite_t *sp, SDL_Rect *r) {
if (sp == NULL) return;
cginfo_t *cg = sp->curcg;
if (cg == NULL) return;
+9 -8
View File
@@ -28,7 +28,8 @@
#include "ags.h"
#include "input.h"
#include "sprite.h"
#include "sdl_core.h"
#include "gfx.h"
#include "effect.h"
/*
効果つき画面更新
@@ -44,25 +45,25 @@ void nt_sp_eupdate(int no, int time, int cancel) {
nt_sp_update_all(false);
enum sdl_effect_type type = from_sact_effect(no - 100);
enum effect_type type = from_sact_effect(no - 100);
if (type == EFFECT_INVALID) {
WARNING("Unimplemented effect %d", no);
type = EFFECT_CROSSFADE;
}
SDL_Rect rect = { 0, 0, main_surface->w, main_surface->h };
struct sdl_effect *eff = sdl_effect_init(&rect, NULL, 0, 0, sdl_getDIB(), 0, 0, type);
struct effect *eff = effect_init(&rect, NULL, 0, 0, gfx_getDIB(), 0, 0, type);
int sttime, curtime;
sttime = curtime = sdl_getTicks();
sttime = curtime = sys_get_ticks();
int edtime = curtime + time;
while ((curtime = sdl_getTicks()) < edtime) {
sdl_effect_step(eff, (float)(curtime - sttime) / (edtime - sttime));
int rest = 16 - (sdl_getTicks() - curtime);
while ((curtime = sys_get_ticks()) < edtime) {
effect_step(eff, (float)(curtime - sttime) / (edtime - sttime));
int rest = 16 - (sys_get_ticks() - curtime);
int key = sys_keywait(rest, cancel ? KEYWAIT_CANCELABLE : KEYWAIT_NONCANCELABLE);
if (cancel && key)
break;
}
sdl_effect_finish(eff);
effect_finish(eff);
ags_updateFull();
}
+18 -19
View File
@@ -31,7 +31,6 @@
#include "system.h"
#include "list.h"
#include "ags.h"
#include "graphics.h"
#include "sprite.h"
// スプライト再描画間の間に変更のあったスプライトの領域の和
@@ -41,22 +40,22 @@ static SList *updatearea;
static SList *updatelist;
static void disjunction(void* region, void* data);
static MyRectangle get_updatearea();
static SDL_Rect get_updatearea();
static void do_update_each(void* data, void* userdata);
// 領域1と領域2をすべて含む矩形領域を計算
static void disjunction(void* region, void* data) {
MyRectangle *r1 = (MyRectangle *)region;
MyRectangle *r2 = (MyRectangle *)data;
SDL_Rect *r1 = (SDL_Rect *)region;
SDL_Rect *r2 = (SDL_Rect *)data;
SDL_UnionRect(r1, r2, r2);
free(r1);
}
// 更新の必要なスプライトの領域の和をとってクリッピングする
static MyRectangle get_updatearea() {
MyRectangle clip = {0, 0, 0, 0};
MyRectangle screen = {0, 0, main_surface->w, main_surface->h};
MyRectangle result;
static SDL_Rect get_updatearea() {
SDL_Rect clip = {0, 0, 0, 0};
SDL_Rect screen = {0, 0, main_surface->w, main_surface->h};
SDL_Rect result;
slist_foreach(updatearea, disjunction, &clip);
@@ -75,7 +74,7 @@ static MyRectangle get_updatearea() {
// updatelist に登録してあるすべてのスプライトを更新
static void do_update_each(void* data, void* userdata) {
sprite_t *sp = (sprite_t *)data;
MyRectangle *r = (MyRectangle *)userdata;
SDL_Rect *r = (SDL_Rect *)userdata;
// 非表示の場合はなにもしない
if (!sp->show) return;
@@ -92,7 +91,7 @@ static void do_update_each(void* data, void* userdata) {
*/
void nt_sp_update_all(bool syncscreen) {
// 画面全体を更新領域に
MyRectangle r = {0, 0, main_surface->w, main_surface->h };
SDL_Rect r = {0, 0, main_surface->w, main_surface->h };
// updatelistに登録してあるスプライトを再描画
// updatelistはスプライトの番号順に並んでいる
@@ -111,7 +110,7 @@ void nt_sp_update_all(bool syncscreen) {
updateme(_part)で登録した更新が必要なspriteの和の領域をupdate
*/
void nt_sp_update_clipped() {
MyRectangle r;
SDL_Rect r;
// 更新領域の確定
r = get_updatearea();
@@ -131,16 +130,16 @@ void nt_sp_update_clipped() {
@param sp: 更新するスプライト
*/
void nt_sp_updateme(sprite_t *sp) {
MyRectangle *r;
SDL_Rect *r;
if (sp == NULL) return;
if (sp->cursize.width == 0 || sp->cursize.height == 0) return;
if (sp->width == 0 || sp->height == 0) return;
r = malloc(sizeof(MyRectangle));
r = malloc(sizeof(SDL_Rect));
r->x = sp->cur.x;
r->y = sp->cur.y;
r->w = sp->cursize.width;
r->h = sp->cursize.height;
r->w = sp->width;
r->h = sp->height;
updatearea = slist_append(updatearea, r);
@@ -157,12 +156,12 @@ void nt_sp_updateme(sprite_t *sp) {
@param h: 更新領域高さ
*/
void nt_sp_updateme_part(sprite_t *sp, int x, int y, int w, int h) {
MyRectangle *r;
SDL_Rect *r;
if (sp == NULL) return;
if (w == 0 || h == 0) return;
r = malloc(sizeof(MyRectangle));
r = malloc(sizeof(SDL_Rect));
r->x = sp->cur.x + x;
r->y = sp->cur.y + y;
r->w = w;
@@ -204,6 +203,6 @@ void nt_sp_clear_updatelist(void) {
}
// デフォルトの壁紙update
void nt_sp_draw_wall(sprite_t *sp, MyRectangle *area) {
void nt_sp_draw_wall(sprite_t *sp, SDL_Rect *area) {
SDL_FillRect(main_surface, area, SDL_MapRGB(main_surface->format, 0, 0, 0));
}
+5 -5
View File
@@ -32,7 +32,7 @@
#include "nact.h"
#include "alk.h"
#include "music.h"
#include "sdl_core.h"
#include "gfx.h"
#include "input.h"
#include "cg.h"
#include "jpeg.h"
@@ -52,9 +52,9 @@ static void ndd_run(int demonum) {
if (mus)
musbgm_play(mus, 0, 100, 0);
uint32_t start = sdl_getTicks();
uint32_t start = sys_get_ticks();
while (!nact->is_quit) {
int i = (sdl_getTicks() - start) / (1000 / FPS);
int i = (sys_get_ticks() - start) / (1000 / FPS);
if (i >= alk->datanum)
break;
@@ -69,12 +69,12 @@ static void ndd_run(int demonum) {
WARNING("Cannot decode CG %d in %s", i, alk_path);
}
int wait_ms = (i + 1) * (1000 / FPS) - (sdl_getTicks() - start);
int wait_ms = (i + 1) * (1000 / FPS) - (sys_get_ticks() - start);
if (wait_ms > 0) {
if (sys_keywait(wait_ms, KEYWAIT_CANCELABLE))
break;
} else {
sdl_updateScreen();
gfx_updateScreen();
if (sys_getInputInfo())
break;
}
+7 -7
View File
@@ -1613,10 +1613,10 @@ static void TimerWait() {
int wTimerID = getCaliValue();
int wCount = getCaliValue();
while (wCount > stimer_get(wTimerID) && !nact->is_quit) {
sys_keywait(10, KEYWAIT_NONCANCELABLE);
}
int msec = (wCount - stimer_get(wTimerID)) * 10;
if (msec > 0)
sys_keywait(msec, KEYWAIT_CTRL_CANCELABLE);
TRACE("SACT.TimerWait %d,%d:", wTimerID, wCount);
}
@@ -1627,9 +1627,9 @@ static void TimerWait() {
*/
static void Wait() {
int wCount = getCaliValue();
sys_keywait(wCount*10, KEYWAIT_NONCANCELABLE);
sys_keywait(wCount * 10, KEYWAIT_CTRL_CANCELABLE);
TRACE("SACT.Wait %d:", wCount);
}
+14 -40
View File
@@ -25,20 +25,16 @@
#define __SACT_H__
#include "config.h"
#include <SDL_rect.h>
#include "portab.h"
#include "list.h"
#include "graphics.h"
#include "ags.h"
#include "sacttimer.h"
#include "variable.h"
#include "sactcg.h"
// スプライトの最大数
#define SPRITEMAX 21845
// CGの最大数
#define CGMAX 63336
// メッセージの最大長さ
#define MSGBUFMAX 257*10
@@ -60,24 +56,6 @@ typedef struct {
char *dst; // 置き換え文字列
} strexchange_t;
// CG_XX で作るCGの種類
enum cgtype {
CG_NOTUSED = 0,
CG_LINKED = 1,
CG_SET = 2,
CG_REVERSE = 3,
CG_STRETCH = 4
};
// cgに関する情報
struct _cginfo {
enum cgtype type; // CGの種類, 0: 未使用, 1:リンクされている, ...
int no; // CGの番号
struct SDL_Surface *sf;
int refcnt; // 参照カウンタ。0になったら開放してもよい。
};
typedef struct _cginfo cginfo_t;
// スプライトのタイプ
enum spritetype {
SPRITE_NORMAL = 0,
@@ -107,7 +85,8 @@ struct _sprite {
int numsound1, numsound2, numsound3;
// 初期 sprite の大きさ(cg1の大きさ)
MyDimension cursize;
int width;
int height;
// それぞれの状態で表示する CG
cginfo_t *cg1, *cg2, *cg3;
@@ -126,10 +105,10 @@ struct _sprite {
int freezed_state;
// 表示位置 (SetPos)
MyPoint loc;
SDL_Point loc;
// 現在のスプライトの表示位置
MyPoint cur;
SDL_Point cur;
// event callback
int (* eventcb)(struct _sprite *sp, agsevent_t *e); // for key/mouse
@@ -146,7 +125,7 @@ struct _sprite {
// move command 用パラメータ
struct {
MyPoint to; // 移動先
SDL_Point to; // 移動先
int time; // 移動完了時間
int speed; // 移動速度
int starttime; // 移動開始時刻
@@ -157,7 +136,7 @@ struct _sprite {
// SACT.Numeral用パラメータ
struct {
int cg[10];
MyPoint pos;
SDL_Point pos;
int span;
} numeral;
@@ -171,7 +150,7 @@ struct _sprite {
// ゲットスプライト
struct {
bool dragging; // ドラッグ中
MyPoint dragstart; // ドラッグ開始位置
SDL_Point dragstart; // ドラッグ開始位置
} get;
// プットスプライト
@@ -191,7 +170,7 @@ struct _sprite {
struct {
SList *buf; // 表示する文字のリスト
struct SDL_Surface *canvas;
MyPoint dspcur; // 現在の表示位置
SDL_Point dspcur; // 現在の表示位置
} msg;
} u;
};
@@ -209,11 +188,9 @@ struct _sact {
SList *sp_quake; // Quakeで揺らすスプライトのリスト
SList *updatelist; // 再描画するスプライトのリスト
cginfo_t *cg[CGMAX]; // cgまたはCG_xxで作った CG
// 座標系の原点
MyPoint origin;
SDL_Point origin;
// 文字列 replce 用
SList *strreplace;
@@ -247,10 +224,7 @@ struct _sact {
int movestarttime; // 一斉に移動を開始するための開始時間
int movecurtime;
MyRectangle updaterect; // 更新が必要なspriteの領域の和
// sact timer
stimer_t timer[65536];
SDL_Rect updaterect; // 更新が必要なspriteの領域の和
// DnDに関するもの
sprite_t *draggedsp; // drag中のスプライト
@@ -281,7 +255,7 @@ struct _sact {
// バックログ
bool logging;
List *log;
List *log; // UTF-8 strings
};
typedef struct _sact sact_t;
+5 -5
View File
@@ -34,7 +34,7 @@
#include "sact.h"
#include "pms.h"
#include "sprite.h"
#include "sdl_core.h"
#include "effect.h"
#include "mmap.h"
// SACTEFAM を使ったマスク
@@ -91,10 +91,10 @@ void sp_eupdate_amap(int index, int time, int cancel) {
return;
}
SDL_Surface *mask_sf = SDL_CreateRGBSurfaceFrom(mask->pic, mask->width, mask->height, 8, mask->width, 0, 0, 0, 0);
sp_update_all(false); // old = sdl_texture, new = main_surface
struct sdl_effect *eff = sdl_effect_sactamask_init(mask_sf);
ags_runEffect(time * 10, cancel, (ags_EffectStepFunc)sdl_effect_step, eff);
sdl_effect_finish(eff);
sp_update_all(false); // old = gfx_texture, new = main_surface
struct effect *eff = effect_sactamask_init(mask_sf);
ags_runEffect(time * 10, cancel, (ags_EffectStepFunc)effect_step, eff);
effect_finish(eff);
ags_updateFull();
SDL_FreeSurface(mask_sf);
+17 -19
View File
@@ -36,12 +36,13 @@
#include "nact.h"
#include "sact.h"
#include "sprite.h"
#include "drawtext.h"
#include "utfsjis.h"
#include "gfx.h"
#include "ags.h"
#include "font.h"
#define LOGMSG_LINES 6
static const char *logmsg_utf8[LOGMSG_LINES] = {
static char *logmsg[LOGMSG_LINES] = {
"\n",
"※バックログ操作方法※",
"[ESC]またはマウス右クリックでゲームに戻る",
@@ -56,7 +57,7 @@ static const char *logmsg_utf8[LOGMSG_LINES] = {
PageUP/Downで1ページ送り
*/
#define FONTSIZEINDEX 10
#define INDEX_FONTSIZE 10
#define FONTSIZE 20
#define LOGLINENUM (main_surface->h / FONTSIZE)
static int curline;
@@ -68,6 +69,10 @@ static void draw_log() {
char pinfo[256];
List *node;
#ifdef __EMSCRIPTEN__
load_mincho_font();
#endif
SDL_Surface *hline = SDL_CreateRGBSurfaceWithFormat(0, main_surface->w, 3, 32, SDL_PIXELFORMAT_RGB888);
SDL_FillRect(hline, NULL, SDL_MapRGB(hline->format, 255, 255, 255));
SDL_SetSurfaceBlendMode(hline, SDL_BLENDMODE_BLEND);
@@ -80,8 +85,8 @@ static void draw_log() {
// ページ位置情報
len = snprintf(pinfo, sizeof(pinfo) -1, "%d/%d", curline, list_length(sact.log));
dt_setfont(FONT_GOTHIC, FONTSIZEINDEX);
dt_drawtext_col(main_surface, main_surface->w - FONTSIZEINDEX *len /2, 0, pinfo, 255, 255, 255);
ags_setFont(FONT_GOTHIC, INDEX_FONTSIZE);
gfx_drawString(main_surface->w - INDEX_FONTSIZE * len / 2, 0, pinfo, 255);
// 表示始め位置
node = list_nth(sact.log, list_length(sact.log) - curline);
@@ -93,11 +98,11 @@ static void draw_log() {
SDL_BlitSurface(hline, NULL, main_surface, &(SDL_Rect){0, y + FONTSIZE/2, main_surface->w, 3});
} else {
if (cur < 6) {
dt_setfont(FONT_MINCHO, FONTSIZE);
ags_setFont(FONT_MINCHO, FONTSIZE);
} else {
dt_setfont(FONT_GOTHIC, FONTSIZE);
ags_setFont(FONT_GOTHIC, FONTSIZE);
}
dt_drawtext_col(main_surface, 0, y, str, 255, 255, 255);
gfx_drawString(0, y, str, 255);
}
y += FONTSIZE;
cur--;
@@ -113,13 +118,7 @@ bool sblog_start(void) {
if (sact.version < 120)
return false;
static char *logmsg[LOGMSG_LINES];
if (!logmsg[0]) {
for (int i = 0; i < LOGMSG_LINES; i++)
logmsg[i] = fromUTF8(logmsg_utf8[i]);
}
// 説明文章を追加
// Append instruction text
for (int i = 0; i < LOGMSG_LINES; i++)
sact.log = list_append(sact.log, logmsg[i]);
@@ -138,10 +137,9 @@ void sblog_end(void) {
SDL_FreeSurface(back);
// 説明文章を削除
// Remove instruction text
for (i = 0; i < LOGMSG_LINES; i++) {
node = list_last(sact.log);
sact.log = list_remove(sact.log, node->data);
sact.log = list_remove(sact.log, logmsg[i]);
}
}
+20 -21
View File
@@ -22,36 +22,35 @@
/* $Id: sacttimer.c,v 1.1 2003/04/22 16:29:52 chikama Exp $ */
#include <stdlib.h>
#include <sys/time.h>
#include <unistd.h>
#include <string.h>
#include "portab.h"
#include "sact.h"
#include "sacttimer.h"
#include "system.h"
#define MAX_TIMER 10
#define TICKS_PER_CENTISECOND 10
uint32_t ticks_base[MAX_TIMER];
/*
sact timer subsystem
*/
void stimer_init(void) {
stimer_reset(0, 0);
memset(ticks_base, 0, sizeof(ticks_base));
}
// 指定IDのタイマーのリセット
void stimer_reset(int id, int val) {
gettimeofday(&(sact.timer[id].tv_base), NULL);
sact.timer[id].val = val;
if (id < 0 || id >= MAX_TIMER) {
WARNING("Invalid timer ID: %d", id);
return;
}
ticks_base[id] = sys_get_ticks() - (val * TICKS_PER_CENTISECOND);
}
// 指定IDのタイマーの取得
int stimer_get(int id) {
long sec, usec, usec2;
struct timeval tv;
struct timeval tv_base = sact.timer[id].tv_base;
int division = 10;
gettimeofday(&tv, NULL);
sec = tv.tv_sec - tv_base.tv_sec;
usec = tv.tv_usec - tv_base.tv_usec;
usec2 = sec * (1000l/division)+ usec / 1000l /division;
return sact.timer[id].val + usec2;
if (id < 0 || id >= MAX_TIMER) {
WARNING("Invalid timer ID: %d", id);
return 0;
}
uint32_t ticks = sys_get_ticks();
uint32_t diff = ticks - ticks_base[id];
return diff / TICKS_PER_CENTISECOND;
}
-10
View File
@@ -24,16 +24,6 @@
#ifndef __SACTTIMER_H__
#define __SACTTIMER_H__
#include <sys/time.h>
#include <unistd.h>
struct _stimer {
int val;
struct timeval tv_base;
};
typedef struct _stimer stimer_t;
void stimer_init(void);
void stimer_reset(int id, int val);
int stimer_get(int id);
+2 -3
View File
@@ -34,7 +34,6 @@
#include "input.h"
#include "sact.h"
#include "sprite.h"
#include "sdl_core.h"
#include "randMT.h"
#define M_PIf ((float)M_PI)
@@ -78,9 +77,9 @@ void sp_quake_screen(int type, int p1, int p2, int time, int cancel) {
if (type > 1) return;
sttime = sdl_getTicks();
sttime = sys_get_ticks();
edtime = time * 10 + sttime;
while ((curtime = sdl_getTicks()) < edtime) {
while ((curtime = sys_get_ticks()) < edtime) {
int adjx, adjy;
cb[type]((float)(curtime - sttime)/(edtime - sttime), p1, p2, &adjx, &adjy);
+11 -11
View File
@@ -145,11 +145,11 @@ void sp_new(int no, int cg1, int cg2, int cg3, int type) {
// cg1の大きさをスプライトの大きさとする
if (sp->curcg == NULL) {
sp->cursize.width = 0;
sp->cursize.height = 0;
sp->width = 0;
sp->height = 0;
} else {
sp->cursize.width = sp->curcg->sf->w;
sp->cursize.height = sp->curcg->sf->h;
sp->width = sp->curcg->sf->w;
sp->height = sp->curcg->sf->h;
}
sp->freezed_state = 0; // 状態固定は無し
@@ -201,8 +201,8 @@ void sp_new_msg(int no, int x, int y, int width, int height) {
sp->loc.y = y - sact.origin.y;
sp->u.msg.dspcur.x = 0; // 文字描画開始位置
sp->u.msg.dspcur.y = 0;
sp->cursize.width = width; // スプライトの大きさ
sp->cursize.height = height;
sp->width = width; // スプライトの大きさ
sp->height = height;
sp->cur = sp->loc;
sp->u.msg.buf = NULL;
@@ -224,10 +224,10 @@ void sp_set_wall_paper(int no) {
if (sp->curcg) { // display specified CG
sp->update = DEFAULT_UPDATE;
sp->cursize.width = sp->curcg->sf->w;
sp->cursize.height = sp->curcg->sf->h;
sp->width = sp->curcg->sf->w;
sp->height = sp->curcg->sf->h;
} else { // Black
sp->cursize.height = main_surface->h;
sp->height = main_surface->h;
sp->curcg = NULL;
sp->update = sp_draw_wall;
}
@@ -516,8 +516,8 @@ bool sp_query_size(int wNum, int *vw, int *vh) {
if (sp->type == SPRITE_NONE) goto errexit;
*vw = sp->cursize.width;
*vh = sp->cursize.height;
*vw = sp->width;
*vh = sp->height;
return true;
+2 -3
View File
@@ -28,7 +28,6 @@
#include "portab.h"
#include "system.h"
#include "ags.h"
#include "sdl_core.h"
#include "sact.h"
#include "sprite.h"
@@ -44,7 +43,7 @@ static int eventCB_ANIM(sprite_t *sp, agsevent_t *e) {
if (e->type != AGSEVENT_TIMER) return 0;
// 現在時刻の取得
now = sdl_getTicks();
now = sys_get_ticks();
// 指定時間までスキップ
if ((now - sp->u.anime.starttime) < sp->u.anime.interval) return 0;
@@ -85,7 +84,7 @@ void sp_anime_setup(sprite_t *sp) {
int n = 0;
sp->u.anime.interval = 500; // デフォルトの間隔 0.5秒
sp->u.anime.starttime = sdl_getTicks(); // 開始時刻
sp->u.anime.starttime = sys_get_ticks(); // 開始時刻
sp->u.anime.tick = 0; // カウンタ初期化
// アニメパターンはいくつあるか
-1
View File
@@ -31,7 +31,6 @@
#include "portab.h"
#include "system.h"
#include "ags.h"
#include "graphics.h"
#include "sact.h"
#include "sprite.h"
+10 -9
View File
@@ -29,7 +29,8 @@
#include "input.h"
#include "sact.h"
#include "sprite.h"
#include "sdl_core.h"
#include "gfx.h"
#include "effect.h"
/*
@@ -45,25 +46,25 @@ void sp_eupdate(int type, int time, int cancel) {
sp_update_all(false);
enum sdl_effect_type sdl_effect = from_sact_effect(type);
if (sdl_effect == EFFECT_INVALID) {
enum effect_type effect = from_sact_effect(type);
if (effect == EFFECT_INVALID) {
WARNING("Unimplemented effect %d", type);
type = EFFECT_CROSSFADE;
}
SDL_Rect rect = { 0, 0, main_surface->w, main_surface->h };
struct sdl_effect *eff = sdl_effect_init(&rect, NULL, 0, 0, sdl_getDIB(), 0, 0, sdl_effect);
struct effect *eff = effect_init(&rect, NULL, 0, 0, gfx_getDIB(), 0, 0, effect);
int sttime, curtime;
sttime = curtime = sdl_getTicks();
sttime = curtime = sys_get_ticks();
int edtime = curtime + time * 10;
while ((curtime = sdl_getTicks()) < edtime) {
sdl_effect_step(eff, (float)(curtime - sttime) / (edtime - sttime));
int rest = 16 - (sdl_getTicks() - curtime);
while ((curtime = sys_get_ticks()) < edtime) {
effect_step(eff, (float)(curtime - sttime) / (edtime - sttime));
int rest = 16 - (sys_get_ticks() - curtime);
int key = sys_keywait(rest, cancel ? KEYWAIT_CANCELABLE : KEYWAIT_NONCANCELABLE);
if (cancel && key)
break;
}
sdl_effect_finish(eff);
effect_finish(eff);
ags_updateFull();
}
+2 -3
View File
@@ -30,7 +30,6 @@
#include "portab.h"
#include "system.h"
#include "sdl_core.h"
#include "menu.h"
#include "input.h"
#include "nact.h"
@@ -213,7 +212,7 @@ static void cb_waitkey_simple(agsevent_t *e) {
switch (e->type) {
case AGSEVENT_KEY_PRESS:
if (e->code == KEY_Z) {
cur = sdl_getTicks();
cur = sys_get_ticks();
if (!sact.zhiding) {
slist_foreach(sact.sp_zhide, cb_defocused_zkey, &update);
sact.zhiding = true;
@@ -243,7 +242,7 @@ static void cb_waitkey_simple(agsevent_t *e) {
case AGSEVENT_KEY_RELEASE:
switch(e->code) {
case KEY_Z:
cur = sdl_getTicks();
cur = sys_get_ticks();
if (500 < (cur - sact.zofftime) || !sact.zdooff) {
slist_foreach(sact.sp_zhide, cb_focused_zkey, &update);
sact.zhiding = false;
+3 -4
View File
@@ -29,7 +29,6 @@
#include "portab.h"
#include "system.h"
#include "list.h"
#include "sdl_core.h"
#include "ags.h"
#include "nact.h"
#include "input.h"
@@ -67,7 +66,7 @@ static void hidesprite(sprite_t *sp) {
*/
static bool waitcond(int endtime) {
int curtime = sdl_getTicks();
int curtime = sys_get_ticks();
if (curtime >= endtime) return true;
if (sact.dropped) {
@@ -133,7 +132,7 @@ void sp_keywait(int *vOK, int *vRND, int *vD01, int *vD02, int *vD03, int timeou
{
// とりあえず、現在のマウス位置を送って、switch sprite の
// 状態を更新しておく
MyPoint p;
SDL_Point p;
sys_getMouseInfo(&p, false);
agsevent_t agse = {
.type = AGSEVENT_MOUSE_MOTION,
@@ -144,7 +143,7 @@ void sp_keywait(int *vOK, int *vRND, int *vD01, int *vD02, int *vD03, int timeou
}
// 終了時間の計算
curtime = sdl_getTicks();
curtime = sys_get_ticks();
endtime = timeout < 0 ? INT_MAX : (curtime + timeout * 10);
// スプライトキー待ちメイン
+3 -6
View File
@@ -32,7 +32,6 @@
#include "nact.h"
#include "sact.h"
#include "sprite.h"
#include "sdl_core.h"
/*
@@ -99,8 +98,6 @@ static int move_cb(sprite_t *sp, agsevent_t *e) {
// 新しい場所のupdate
sp_updateme(sp);
update++;
} else {
usleep(1);
}
return update;
@@ -161,14 +158,14 @@ void spev_move_waitend(sprite_t *sp, int dx, int dy, int time) {
sp->move.time = 0;
sact.movelist = slist_append(sact.movelist, sp);
sact.movestarttime = sdl_getTicks();
sact.movestarttime = sys_get_ticks();
slist_foreach(sact.movelist, spev_move_setup, NULL);
slist_free(sact.movelist);
sact.movelist = NULL;
while (sp->move.moving) {
nact->callback();
sdl_wait_vsync();
sys_wait_vsync();
}
}
@@ -187,7 +184,7 @@ void spev_wait4moving_sp() {
while (sp->move.moving) {
nact->callback();
sdl_wait_vsync();
sys_wait_vsync();
}
}
}
+14 -14
View File
@@ -29,9 +29,9 @@
#include "portab.h"
#include "system.h"
#include "sdl_core.h"
#include "ags.h"
#include "nact.h"
#include "variable.h"
#include "input.h"
#include "sact.h"
#include "sprite.h"
@@ -241,7 +241,7 @@ void smsg_out(int wNum, int wSize, int wColorR, int wColorG, int wColorB, int wF
sprite_t *sp;
int len = 0; // 処理した文字数?
bool needupdate = false;
MyRectangle uparea = {0,0,0,0};
SDL_Rect uparea = {0,0,0,0};
// wRSize == 0 -> ルビ無し(SACT.MessageOutputからの呼出)
@@ -268,7 +268,7 @@ void smsg_out(int wNum, int wSize, int wColorR, int wColorG, int wColorB, int wF
char mbuf[20], rbuf[20];
int cw, delta, wcnt;
wcnt = sdl_getTicks();
wcnt = sys_get_ticks();
mbuf[0] = rbuf[0] = '\0';
msg = get_char(msg, mbuf, rbuf, sizeof(mbuf) -1);
@@ -316,7 +316,7 @@ void smsg_out(int wNum, int wSize, int wColorR, int wColorG, int wColorB, int wF
needupdate = false;
// keywait
delta = sdl_getTicks() - wcnt;
delta = sys_get_ticks() - wcnt;
if (delta < wSpeed) {
if (sys_keywait(wSpeed - delta, KEYWAIT_NONCANCELABLE)) {
@@ -335,8 +335,8 @@ void smsg_out(int wNum, int wSize, int wColorR, int wColorG, int wColorB, int wF
// Waitなしの出力は最後にupdate
if (needupdate) {
uparea.w = sp->cursize.width;
uparea.h = min(sp->cursize.height, uparea.y - sp->u.msg.dspcur.y + wLineSpace + wLineSpace + wRSize);
uparea.w = sp->width;
uparea.h = min(sp->height, uparea.y - sp->u.msg.dspcur.y + wLineSpace + wLineSpace + wRSize);
sp_updateme_part(sp, uparea.x, uparea.y, uparea.w, uparea.h);
}
@@ -420,7 +420,7 @@ int smsg_keywait(int wNum1, int wNum2, int msglen) {
sact.waitkey = -1;
while (sact.waitkey == -1 && !nact->is_quit) {
int st = sdl_getTicks();
int st = sys_get_ticks();
int interval = 25;
// アニメパターンがある場合、その更新
@@ -434,7 +434,7 @@ int smsg_keywait(int wNum1, int wNum2, int msglen) {
update_mark(minfo[j].sp, minfo[j].cg);
i++;
}
sys_keywait(interval - (sdl_getTicks() - st), KEYWAIT_NONCANCELABLE);
sys_keywait(interval - (sys_get_ticks() - st), KEYWAIT_NONCANCELABLE);
}
sact.waittype = KEYWAIT_NONE;
@@ -447,13 +447,13 @@ int smsg_keywait(int wNum1, int wNum2, int msglen) {
@param sp:
*/
void smsg_update(sprite_t *sp) {
SDL_Rect sp_rect = {0, 0, sp->cursize.width, sp->cursize.height};
SDL_Rect sp_rect = {0, 0, sp->width, sp->height};
int sx = 0;
int sy = 0;
int dx = sp->cur.x;
int dy = sp->cur.y;
int w = sp->cursize.width;
int h = sp->cursize.height;
int w = sp->width;
int h = sp->height;
if (!ags_clipCopyRect(&sp_rect, &sact.updaterect, &sx, &sy, &dx, &dy, &w, &h)) {
return;
}
@@ -534,7 +534,7 @@ static void append_to_log(char *msg) {
static void sactlog_newline() {
if (sact.logging) {
if (sact.msgbuf2[0] == '\0') return;
sact.log = list_append(sact.log, strdup(sact.msgbuf2));
sact.log = list_append(sact.log, toUTF8(sact.msgbuf2));
sact.msgbuf2[0] = '\0';
}
}
@@ -547,10 +547,10 @@ static void set_align(char *msg, sprite_t *sp, int wSize, int wAlign) {
switch (wAlign) {
case 1: // センタリング
adjx = (sp->cursize.width - mlen) / 2;
adjx = (sp->width - mlen) / 2;
break;
case 2: // 右寄せ
adjx = (sp->cursize.width - mlen);
adjx = (sp->width - mlen);
break;
}
sp->u.msg.dspcur.x = max(0, adjx);
+2 -3
View File
@@ -31,7 +31,6 @@
#include "input.h"
#include "sact.h"
#include "sprite.h"
#include "sdl_core.h"
#include "randMT.h"
/*
@@ -49,9 +48,9 @@ void sp_quake_sprite(int wType, int wAmplitudeX, int wAmplitudeY, int wCount, in
int i = 0, key;
SList *node;
edtime = wCount * 10 + sdl_getTicks();
edtime = wCount * 10 + sys_get_ticks();
while ((curtime = sdl_getTicks()) < edtime) {
while ((curtime = sys_get_ticks()) < edtime) {
if (wType == 0) { // 全てのスプライトを同じように動かす
int adjx = (int)(genrand() * wAmplitudeX/2);
int adjy = (int)(genrand() * wAmplitudeY/2);
+3 -2
View File
@@ -30,6 +30,7 @@
#include "portab.h"
#include "nact.h"
#include "variable.h"
#include "ags.h"
#include "input.h"
#include "sact.h"
@@ -60,8 +61,8 @@ static int sel_main();
* sprite内部とは判断しない
*/
static bool sp_is_insprite2(sprite_t *sp, int x, int y, int margin) {
MyPoint p = {x, y};
MyRectangle r = {
SDL_Point p = {x, y};
SDL_Rect r = {
sp->cur.x + margin,
sp->cur.y + margin,
sp->curcg->sf->w - 2 * margin,
+1 -2
View File
@@ -33,7 +33,6 @@
#include "nact.h"
#include "sact.h"
#include "sprite.h"
#include "sdl_core.h"
/*
@@ -63,7 +62,7 @@ static void tevent_callback(agsevent_t *e) {
int update = 0;
// SP_MOVE の同期移動のためのカウンタの読み込み
sact.movecurtime = sdl_getTicks();
sact.movecurtime = sys_get_ticks();
for (node = sact.teventlisteners; node; node = node->next) {
sprite_t *sp = (sprite_t *)node->data;
+12 -14
View File
@@ -28,9 +28,7 @@
#include "portab.h"
#include "system.h"
#include "sdl_core.h"
#include "ags.h"
#include "graphics.h"
#include "sact.h"
#include "sprite.h"
@@ -43,16 +41,16 @@ static void do_update_each(void* data, void* userdata);
// 領域1と領域2をすべて含む矩形領域を計算
static void disjunction(void* region, void* data) {
MyRectangle *r1 = (MyRectangle *)region;
MyRectangle *r2 = (MyRectangle *)data;
SDL_Rect *r1 = (SDL_Rect *)region;
SDL_Rect *r2 = (SDL_Rect *)data;
SDL_UnionRect(r1, r2, r2);
free(r1);
}
// 更新の必要なスプライトの領域の和をとってクリッピングする
static void get_updatearea() {
MyRectangle clip = {0, 0, 0, 0};
MyRectangle screen = {0, 0, main_surface->w, main_surface->h};
SDL_Rect clip = {0, 0, 0, 0};
SDL_Rect screen = {0, 0, main_surface->w, main_surface->h};
slist_foreach(updatearea, disjunction, &clip);
@@ -93,7 +91,7 @@ void sp_update_all(bool syncscreen) {
// スプライト移動がある場合は移動開始
if (sact.movelist) {
// 移動開始時間を合わせる
sact.movestarttime = sdl_getTicks();
sact.movestarttime = sys_get_ticks();
slist_foreach(sact.movelist, spev_move_setup, NULL);
slist_free(sact.movelist);
sact.movelist = NULL;
@@ -149,16 +147,16 @@ void sp_update_clipped() {
@param sp:
*/
void sp_updateme(sprite_t *sp) {
MyRectangle *r;
SDL_Rect *r;
if (sp == NULL) return;
if (sp->cursize.width == 0 || sp->cursize.height == 0) return;
if (sp->width == 0 || sp->height == 0) return;
r = malloc(sizeof(MyRectangle));
r = malloc(sizeof(SDL_Rect));
r->x = sp->cur.x;
r->y = sp->cur.y;
r->w = sp->cursize.width;
r->h = sp->cursize.height;
r->w = sp->width;
r->h = sp->height;
updatearea = slist_append(updatearea, r);
@@ -175,12 +173,12 @@ void sp_updateme(sprite_t *sp) {
@param h:
*/
void sp_updateme_part(sprite_t *sp, int x, int y, int w, int h) {
MyRectangle *r;
SDL_Rect *r;
if (sp == NULL) return;
if (w == 0 || h == 0) return;
r = malloc(sizeof(MyRectangle));
r = malloc(sizeof(SDL_Rect));
r->x = sp->cur.x + x;
r->y = sp->cur.y + y;
r->w = w;
+5 -6
View File
@@ -36,13 +36,12 @@
#include "nact.h"
#include "ags.h"
#include "music.h"
#include "sdl_core.h"
#include "hacks.h"
#define SLOT 40
static MyRectangle maprect; /* アニメーション表示領域 */
static MyRectangle mapback; /* 背景セーブ領域 */
static SDL_Rect maprect; /* アニメーション表示領域 */
static SDL_Rect mapback; /* 背景セーブ領域 */
static int mapback_p5; /* 背景転送先 X */
static int mapback_p6; /* 背景転送先 Y */
@@ -451,7 +450,7 @@ static void PlayAnimeData() {
dib = ags_getDIB();
for (loop = 0; loop < p1; loop++) {
int cnt = sdl_getTicks();
int cnt = sys_get_ticks();
is_backcopied = false;
for (i = 0; i < SLOT; i++) {
@@ -528,9 +527,9 @@ static void PlayAnimeData() {
if (is_backcopied && !SDL_RectEmpty(&maprect))
ags_updateArea(maprect.x, maprect.y, maprect.w, maprect.h);
int now = sdl_getTicks();
int now = sys_get_ticks();
if (now - cnt < interval) {
sdl_sleep(interval - (now-cnt));
sys_sleep(interval - (now-cnt));
}
}
}
+1 -2
View File
@@ -35,7 +35,6 @@
#include "system.h"
#include "xsystem35.h"
#include "modules.h"
#include "sdl_core.h"
#include "input.h"
#include "menu.h"
@@ -54,7 +53,7 @@ static void OutputMessageBox(void) { /* 0 */
char *title_utf8 = toUTF8(svar_get(title));
char *msg_utf8 = toUTF8(svar_get(msg));
sdl_showMessageBox(MESSAGEBOX_INFO, title_utf8, msg_utf8);
sys_show_message_box(MESSAGEBOX_INFO, title_utf8, msg_utf8);
free(title_utf8);
free(msg_utf8);
+919 -26
View File
@@ -1,8 +1,8 @@
// #define DDEMODEV
#include "config.h"
#include <stdio.h>
#include <math.h>
#include <SDL.h>
#include "portab.h"
#include "system.h"
@@ -11,12 +11,84 @@
#include "nact.h"
#include "input.h"
#include "music.h"
#include "alk.h"
#include "cg.h"
#include "gfx.h"
#include "gfx_private.h"
#ifdef DDEMODEV
#include "dDemo.h"
static struct ddemo dd;
#include "scene.c"
#endif
// Perspective projection parameters
#define PROJ_SCALE_X 1.2993f // cot(30°) / (4/3)
#define PROJ_SCALE_Y 1.7321f // cot(30°) = √3
#define PROJ_W_DENOM 0.5000625f
static inline float lerpf(float a, float b, float t) { return a + (b - a) * t; }
static void render_quad(SDL_Texture *tex, SDL_Vertex verts[4]) {
static const int indices[] = {0, 1, 2, 0, 2, 3};
SDL_RenderGeometry(gfx_renderer, tex, verts, 4, indices, 6);
}
static void fade_overlay(Uint8 r, Uint8 g, Uint8 b, Uint8 alpha) {
SDL_SetRenderDrawBlendMode(gfx_renderer, SDL_BLENDMODE_BLEND);
SDL_SetRenderDrawColor(gfx_renderer, r, g, b, alpha);
SDL_RenderFillRect(gfx_renderer, NULL);
}
#define NR_SCENES 13
static const int scene_duration[] = {
5400,
4752,
24963,
4000,
20000,
4000,
21000,
4000,
6402,
4000,
10370,
31613,
10338,
};
#define NR_TEXTURES 86
static struct {
bool loop;
bool key_cancel;
SDL_Texture *images[NR_TEXTURES];
} dd;
// For each corner, if a coordinate is out of [0, view_w-1] x [0, view_h-1],
// shift all other corners by the overshoot amount, then hard-clamp everything
// to the screen boundary.
static void clamp_rect_to_screen(int xs[4], int ys[4]) {
for (int i = 0; i < 4; i++) {
if (xs[i] < 0) {
for (int j = 0; j < 4; j++) if (j != i) xs[j] -= xs[i];
xs[i] = 0;
}
if (ys[i] < 0) {
for (int j = 0; j < 4; j++) if (j != i) ys[j] -= ys[i];
ys[i] = 0;
}
if (xs[i] >= view_w - 1) {
for (int j = 0; j < 4; j++) if (j != i) xs[j] += (view_w - 1 - xs[i]);
xs[i] = view_w - 1;
}
if (ys[i] >= view_h - 1) {
for (int j = 0; j < 4; j++) if (j != i) ys[j] += (view_h - 1 - ys[i]);
ys[i] = view_h - 1;
}
}
for (int i = 0; i < 4; i++) {
if (xs[i] < 0) xs[i] = 0;
if (xs[i] >= view_w) xs[i] = view_w - 1;
if (ys[i] < 0) ys[i] = 0;
if (ys[i] >= view_h) ys[i] = view_h - 1;
}
}
static void Init() {
int p1 = getCaliValue();
@@ -24,40 +96,861 @@ static void Init() {
int p3 = getCaliValue();
int *var = getCaliVariable();
if (!nact->files.alk[0]) {
WARNING("dDEMO.alk not found");
return;
}
alk_t *alk = alk_new(nact->files.alk[0]); // dDEMO.alk
if (!alk) {
WARNING("Cannot open %s", nact->files.alk[0]);
*var = 0;
return;
}
if (alk->datanum < NR_TEXTURES) {
WARNING("dDEMO.alk has %d entries, expected %d", alk->datanum, NR_TEXTURES);
alk_free(alk);
*var = 0;
return;
}
for (int i = 0; i < NR_TEXTURES; i++) {
bool load_as_alpha_map = i < 18 || i > 60;
SDL_Surface *sf = cg_load_as_sdlsurface_from_data(alk->entries[i].data, alk->entries[i].size, false, load_as_alpha_map);
if (!sf) {
WARNING("failed to load image %d in dDEMO.alk", i);
dd.images[i] = NULL;
continue;
}
dd.images[i] = SDL_CreateTextureFromSurface(gfx_renderer, sf);
SDL_FreeSurface(sf);
}
*var = 1;
#ifdef DDEMODEV
dd.alk = alk_new("/home/masaki-c/game/daiakuji/dDemo.alk");
#endif
TRACE_UNIMPLEMENTED("dDemo.Init %d,%d,%d,%p:", p1, p2, p3, var);
TRACE("dDemo.Init %d,%d,%d,%p:", p1, p2, p3, var);
}
static void SetKeyCancelFlag() {
int cancelflag = getCaliValue();
TRACE_UNIMPLEMENTED("dDemo.SetKeyCancelFlag %d:", cancelflag);
dd.key_cancel = cancelflag != 0;
TRACE("dDemo.SetKeyCancelFlag %d:", cancelflag);
}
static void SetLoopFlag() {
/* Loop Flag */
int loopflag = getCaliValue(); /* 0 なら無限繰り返し */
TRACE_UNIMPLEMENTED("dDemo.SetLoopFlag %d:", loopflag);
int loopflag = getCaliValue();
dd.loop = loopflag != 0;
TRACE("dDemo.SetLoopFlag %d:", loopflag);
}
static void render_affine_bg(SDL_Texture *scroll_bg, int elapsed, int duration,
float angle_deg, float scale, int offset_x, int offset_y) {
if (!scroll_bg) return;
int bg_w, bg_h;
SDL_QueryTexture(scroll_bg, NULL, NULL, &bg_w, &bg_h);
int xs[4], ys[4];
const float angle = angle_deg * (float)M_PI / 180.0f;
const float hw = view_w * 0.5f, hh = view_h * 0.5f;
const float cosA = cosf(angle), sinA = sinf(angle);
const float cxs[4] = {-hw, hw, hw, -hw};
const float cys[4] = {-hh, -hh, hh, hh};
for (int i = 0; i < 4; i++) {
xs[i] = (int)((cosA * cxs[i] - sinA * cys[i]) * scale + hw) + offset_x;
ys[i] = (int)((sinA * cxs[i] + cosA * cys[i]) * scale + hh) + offset_y;
}
clamp_rect_to_screen(xs, ys);
float t = (float)elapsed / (float)duration;
float w = (float)view_w, h = (float)view_h;
float uv[4][2];
uv[0][0] = 0.0f;
uv[0][1] = lerpf(0.0f, (float)ys[0], t);
uv[1][0] = lerpf(w - 1.0f, (float)xs[1], t);
uv[1][1] = lerpf(0.0f, (float)ys[1], t);
uv[2][0] = lerpf(w - 1.0f, (float)xs[2], t);
uv[2][1] = lerpf(h - 1.0f, (float)ys[2], t);
uv[3][0] = lerpf(0.0f, (float)xs[3], t);
uv[3][1] = lerpf(h - 1.0f, (float)ys[3], t);
for (int i = 0; i < 4; i++) {
uv[i][0] /= (float)bg_w;
uv[i][1] /= (float)bg_h;
}
SDL_Vertex verts[4];
static int y_toggle = 0;
// Pass 1: Forward mapping layer
for (int i = 0; i < 4; i++) {
verts[i].position.x = (i == 1 || i == 2) ? w : 0;
verts[i].position.y = (i == 2 || i == 3) ? h : (float)y_toggle;
verts[i].color = (SDL_Color){255, 255, 255, 255};
verts[i].tex_coord.x = uv[i][0];
verts[i].tex_coord.y = uv[i][1];
}
SDL_SetTextureBlendMode(scroll_bg, SDL_BLENDMODE_NONE);
render_quad(scroll_bg, verts);
// Pass 2: 180° rotated mapping layer
y_toggle = (y_toggle + 1) & 1;
for (int i = 0; i < 4; i++) {
verts[i].position.y = (i == 2 || i == 3) ? h : (float)y_toggle;
verts[i].color = (SDL_Color){255, 255, 255, 128};
}
// Swap mapping: TL<->BR, TR<->BL for 180° rotation effect
verts[0].tex_coord.x = uv[2][0]; verts[0].tex_coord.y = uv[2][1];
verts[1].tex_coord.x = uv[3][0]; verts[1].tex_coord.y = uv[3][1];
verts[2].tex_coord.x = uv[0][0]; verts[2].tex_coord.y = uv[0][1];
verts[3].tex_coord.x = uv[1][0]; verts[3].tex_coord.y = uv[1][1];
SDL_SetTextureBlendMode(scroll_bg, SDL_BLENDMODE_BLEND);
render_quad(scroll_bg, verts);
}
static void render_scene0(int elapsed) {
SDL_Texture *scroll_bg = dd.images[79];
SDL_Texture *sprite = dd.images[77];
if (!sprite) return;
int spr_w, spr_h;
SDL_QueryTexture(sprite, NULL, NULL, &spr_w, &spr_h);
const int slide_end = 4700;
const int duration = scene_duration[0]; // 5400
// --- Background: DrawAffineSurfaceAlpha50 x2 (alpha=50%) ---
// Source coordinates are linear-interpolated between identity and a transformed state.
// Two layers (identity and 180° rotated) are blended together.
render_affine_bg(scroll_bg, elapsed, duration, 40.0f, 0.55f, -20, 100);
// --- Sprite and UI elements ---
// 2. Sprite (ALK 77) with 3-echo horizontal slide-in.
// Each copy starts wider/further left and converges to the final position.
SDL_SetTextureBlendMode(sprite, SDL_BLENDMODE_BLEND);
int dest_y = (view_h - spr_h) / 2;
if (elapsed < slide_end) {
SDL_SetTextureAlphaMod(sprite, 0x80);
const int a0_vals[] = {640, 480, 320};
for (int i = 0; i < 3; i++) {
int a0 = a0_vals[i];
int dest_w = a0 - ((a0 - spr_w) * elapsed) / slide_end;
if (dest_w <= 0) continue;
SDL_Rect dst = {view_w - 2 * dest_w, dest_y, dest_w, spr_h};
SDL_RenderCopy(gfx_renderer, sprite, NULL, &dst);
}
} else {
SDL_SetTextureAlphaMod(sprite, 0xd0);
SDL_Rect dst = {view_w - 2 * spr_w, dest_y, spr_w, spr_h};
SDL_RenderCopy(gfx_renderer, sprite, NULL, &dst);
}
// 3. Horizontal accent line (grows rightward over 4700ms)
int line_w = elapsed < slide_end ? 639 * elapsed / slide_end + 1 : 640;
SDL_SetRenderDrawBlendMode(gfx_renderer, SDL_BLENDMODE_NONE);
SDL_SetRenderDrawColor(gfx_renderer, 0xc0, 0xc0, 0xc0, 0xff);
SDL_Rect hline = {0, (spr_h + view_h) / 2 - 4, line_w, 2};
SDL_RenderFillRect(gfx_renderer, &hline);
// 4. Vertical accent line (right edge of sprite, grows downward)
int line_h = elapsed < slide_end ? 479 * elapsed / slide_end + 1 : 480;
SDL_Rect vline = {view_w - spr_w, 0, 2, line_h};
SDL_RenderFillRect(gfx_renderer, &vline);
}
static void render_scene1(int elapsed) {
SDL_Texture *scroll_bg = dd.images[78];
SDL_Texture *sprite = dd.images[76];
if (!sprite) return;
int spr_w, spr_h;
SDL_QueryTexture(sprite, NULL, NULL, &spr_w, &spr_h);
const int duration = scene_duration[1]; // 4752
// --- Background: DrawAffineSurfaceAlpha50 x2 (alpha=50%) ---
render_affine_bg(scroll_bg, elapsed, duration, -45.0f, 0.1f, 0, 200);
// Foreground (ALK 76): centered, fades in over first 3000ms.
// graph_BlendAlphaMapColorAlpha (alpha 0->255) for elapsed < 3000,
// graph_BlendAlphaMapColor (full opacity) for elapsed >= 3000.
{
int alpha = elapsed < 3000 ? (elapsed * 255) / 3000 : 255;
SDL_SetTextureBlendMode(sprite, SDL_BLENDMODE_BLEND);
SDL_SetTextureAlphaMod(sprite, (Uint8)alpha);
SDL_Rect dst = {(view_w - spr_w) / 2, (view_h - spr_h) / 2, spr_w, spr_h};
SDL_RenderCopy(gfx_renderer, sprite, NULL, &dst);
}
// Fade to black: graph_FillAlphaColor(0,0,0), starts at 4000ms.
if (elapsed > 4000) {
int fade_alpha = ((elapsed - 4000) * 255) / (duration - 4000);
fade_overlay(0, 0, 0, (Uint8)SDL_min(fade_alpha, 255));
}
}
// 3D rendering for render_scene2_4_6.
//
// Background quad (model space, XY plane):
// v0=(-1, -0.73446, 0) v1=(+1, -0.73446, 0)
// v2=(+1, +0.73446, 0) v3=(-1, +0.73446, 0)
// Object border quad (slightly oversized):
// v0=(-1.00885, -0.74655, 0) ... v3=(-1.00885, +0.74655, 0)
//
// Animation phases (phaseDuration = (sceneDuration - 1000) / 8):
// Phase 0 [0..1pd): approach from Z=-9 to Z=-3.75, Y-rot -90°→0°, tex1
// Phase 1 [1..3pd): static at Z=-3.75, rot=0°, tex1
// Phase 2 [3..4pd): recede from Z=-3.75 to Z=-9, Y-rot 0°→90°, tex1
// Phase 3 [4..5pd): approach from Z=-9 to Z=-3.75, Y-rot -90°→0°, tex2
// Phase 4 [5..7pd): static at Z=-3.75, rot=0°, tex2
// Phase 5 [7..8pd): recede from Z=-3.75 to Z=-9, Y-rot 0°→90°, tex2
//
// All phases also have an X-swing: tx = sin(π*t) * swing_amp
// approach swing_amp = -1.5, recede = +1.5
//
// Projection: same parameters as render_scene12_3d.
static void render_scene_2_4_6_3d(int elapsed, int phase_dur, SDL_Texture *tex1, SDL_Texture *tex2) {
static const float bg_mv[4][3] = {
{-1.00000f, -0.73446f, 0.0f},
{+1.00000f, -0.73446f, 0.0f},
{+1.00000f, +0.73446f, 0.0f},
{-1.00000f, +0.73446f, 0.0f},
};
static const float obj_mv[4][3] = {
{-1.00885f, -0.74655f, 0.0f},
{+1.00885f, -0.74655f, 0.0f},
{+1.00885f, +0.74655f, 0.0f},
{-1.00885f, +0.74655f, 0.0f},
};
static const float muv[4][2] = {
{0.0f, 0.0f}, {1.0f, 0.0f}, {1.0f, 1.0f}, {0.0f, 1.0f},
};
float tx, tz, rot_y_deg;
SDL_Texture *tex;
if (elapsed < phase_dur) {
// Phase 0: approach with X-swing, tex1
float t = (float)elapsed / (float)phase_dur;
tx = sinf(t * (float)M_PI) * (-1.5f);
tz = lerpf(-9.0f, -3.75f, t);
rot_y_deg = lerpf(-90.0f, 0.0f, t);
tex = tex1;
} else if (elapsed < phase_dur * 3) {
// Phase 1: static, tex1
tx = 0.0f; tz = -3.75f; rot_y_deg = 0.0f;
tex = tex1;
} else if (elapsed < phase_dur * 4) {
// Phase 2: recede with X-swing, tex1
float t = (float)(elapsed - phase_dur * 3) / (float)phase_dur;
tx = sinf(t * (float)M_PI) * 1.5f;
tz = lerpf(-3.75f, -9.0f, t);
rot_y_deg = lerpf(0.0f, 90.0f, t);
tex = tex1;
} else if (elapsed < phase_dur * 5) {
// Phase 3: approach with X-swing, tex2
float t = (float)(elapsed - phase_dur * 4) / (float)phase_dur;
tx = sinf(t * (float)M_PI) * (-1.5f);
tz = lerpf(-9.0f, -3.75f, t);
rot_y_deg = lerpf(-90.0f, 0.0f, t);
tex = tex2;
} else if (elapsed < phase_dur * 7) {
// Phase 4: static, tex2
tx = 0.0f; tz = -3.75f; rot_y_deg = 0.0f;
tex = tex2;
} else if (elapsed < phase_dur * 8) {
// Phase 5: recede with X-swing, tex2
float t = (float)(elapsed - phase_dur * 7) / (float)phase_dur;
tx = sinf(t * (float)M_PI) * 1.5f;
tz = lerpf(-3.75f, -9.0f, t);
rot_y_deg = lerpf(0.0f, 90.0f, t);
tex = tex2;
} else {
return;
}
if (!tex) return;
float angle_rad = rot_y_deg * (float)M_PI / 180.0f;
float cos_a = cosf(angle_rad);
float sin_a = sinf(angle_rad);
const float half_w = (float)view_w * 0.5f;
const float half_h = (float)view_h * 0.5f;
SDL_Vertex bg_verts[4], obj_verts[4];
for (int i = 0; i < 4; i++) {
for (int pass = 0; pass < 2; pass++) {
const float (*mv)[3] = (pass == 0) ? bg_mv : obj_mv;
SDL_Vertex *v = (pass == 0) ? &bg_verts[i] : &obj_verts[i];
float rx = cos_a * mv[i][0] + sin_a * mv[i][2];
float ry = mv[i][1];
float rz = -sin_a * mv[i][0] + cos_a * mv[i][2];
float wx = rx + tx;
float wy = ry;
float wz = rz + tz;
float w = -wz * PROJ_W_DENOM;
if (w <= 0.0f) w = 1e-5f;
v->position.x = (wx * PROJ_SCALE_X / w + 1.0f) * half_w;
v->position.y = (wy * PROJ_SCALE_Y / w + 1.0f) * half_h;
v->tex_coord.x = muv[i][0];
v->tex_coord.y = muv[i][1];
}
}
// Object border quad: solid color RGB(244,221,181) = BGR(0xb5,0xdd,0xf4),
// drawn first as a backdrop. The bg quad drawn on top leaves only the thin
// border ring visible.
for (int i = 0; i < 4; i++) obj_verts[i].color = (SDL_Color){0xf4, 0xdd, 0xb5, 0xff};
SDL_SetRenderDrawBlendMode(gfx_renderer, SDL_BLENDMODE_NONE);
render_quad(NULL, obj_verts);
// Background quad: textured, opaque, drawn on top (covers center of border quad)
for (int i = 0; i < 4; i++) bg_verts[i].color = (SDL_Color){255, 255, 255, 255};
SDL_SetTextureBlendMode(tex, SDL_BLENDMODE_NONE);
render_quad(tex, bg_verts);
}
// Scenes 2, 4, and 6 share the same structure:
// - Fixed background (ALK[9]) full-screen blit
// - 3D quad animation (see render_scene_2_4_6_3d above)
// - Sprite + shadow scroll linearly left-to-right over the full scene duration
//
// sprite_idx: ALK index of the scrolling sprite (shadow is at sprite_idx + 73)
// tex1_idx: ALK index of the 3D quad texture for phases 0-2
// tex2_idx: ALK index of the 3D quad texture for phases 3-5
static void render_scene_2_4_6(int elapsed, int scene_idx, int sprite_idx, int tex1_idx, int tex2_idx) {
const int duration = scene_duration[scene_idx];
SDL_Texture *bg = dd.images[9];
SDL_Texture *sprite = dd.images[sprite_idx];
SDL_Texture *sprite_shadow = dd.images[sprite_idx + 73];
// 1. Background: full-screen blit, no blending
if (bg) {
SDL_SetTextureBlendMode(bg, SDL_BLENDMODE_NONE);
SDL_SetTextureColorMod(bg, 0xff, 0xff, 0xff);
SDL_RenderCopy(gfx_renderer, bg, NULL, NULL);
}
// 2. 3D rotating quad animation (8-phase timing)
{
int phase_dur = (duration - 1000) / 8;
SDL_Texture *tex1 = dd.images[tex1_idx];
SDL_Texture *tex2 = dd.images[tex2_idx];
render_scene_2_4_6_3d(elapsed, phase_dur, tex1, tex2);
}
// 3. Scrolling sprite: x moves from -sprite_w (off-screen left) to view_w (off-screen right)
int sprite_w = 0, sprite_h = 0;
if (sprite)
SDL_QueryTexture(sprite, NULL, NULL, &sprite_w, &sprite_h);
int x = sprite_w ? ((sprite_w + view_w) * elapsed) / duration - sprite_w : 0;
// Shadow drawn first (color-modded to black), sprite on top (full color)
if (sprite_shadow) {
int sw, sh;
SDL_QueryTexture(sprite_shadow, NULL, NULL, &sw, &sh);
SDL_SetTextureBlendMode(sprite_shadow, SDL_BLENDMODE_BLEND);
SDL_SetTextureColorMod(sprite_shadow, 0, 0, 0);
SDL_Rect dst = {x, 0, sw, sh};
SDL_RenderCopy(gfx_renderer, sprite_shadow, NULL, &dst);
}
if (sprite) {
SDL_SetTextureBlendMode(sprite, SDL_BLENDMODE_BLEND);
SDL_SetTextureColorMod(sprite, 0xff, 0xff, 0xff);
SDL_Rect dst = {x, 0, sprite_w, sprite_h};
SDL_RenderCopy(gfx_renderer, sprite, NULL, &dst);
}
}
// Scenes 3, 5, 7, and 9 share the same structure:
// - Main image (image_idx) fades in and out over 4 seconds
// - ALK[9] overlay drawn at 50% alpha with an animated quad-warp throughout
//
// Timing of main image:
// 0250ms: black (no image)
// 2501000ms: fade in (alpha 0→255)
// 10003000ms: full opacity
// 30004000ms: fade out (alpha 255→0)
//
// Overlay quad-warp: source corners rotate clockwise along image edges over the full duration.
// At t=0: source = full image (no warp).
// At t=1: each corner has shifted 1/3 of its edge length, creating a rotation-like distortion.
static void render_scene_3_5_7_9(int elapsed, int image_idx) {
SDL_Texture *main_img = dd.images[image_idx];
SDL_Texture *overlay = dd.images[9];
if (main_img) {
int alpha;
if (elapsed < 250)
alpha = 0;
else if (elapsed < 1000)
alpha = ((elapsed - 250) * 255) / 750;
else if (elapsed < 3000)
alpha = 255;
else
alpha = ((4000 - elapsed) * 255) / 1000;
alpha = SDL_max(0, SDL_min(255, alpha));
if (alpha > 0) {
SDL_SetTextureBlendMode(main_img, alpha < 255 ? SDL_BLENDMODE_BLEND : SDL_BLENDMODE_NONE);
SDL_SetTextureAlphaMod(main_img, (Uint8)alpha);
SDL_RenderCopy(gfx_renderer, main_img, NULL, NULL);
}
}
// Overlay: 50% alpha blend with animated quad-warp.
// UV corner positions (normalized): corners shift by t/3 along each edge.
if (overlay) {
float t3 = (float)elapsed / (4000.0f * 3.0f); // 0 → 1/3
float w = (float)view_w, h = (float)view_h;
SDL_Vertex verts[4] = {
/* TL */ {{0.f, 0.f}, {255, 255, 255, 128}, {t3, 0.f }},
/* TR */ {{w, 0.f}, {255, 255, 255, 128}, {1.0f, t3 }},
/* BR */ {{w, h }, {255, 255, 255, 128}, {1.0f - t3, 1.0f }},
/* BL */ {{0.f, h }, {255, 255, 255, 128}, {0.f, 1.0f-t3}},
};
SDL_SetTextureBlendMode(overlay, SDL_BLENDMODE_BLEND);
render_quad(overlay, verts);
}
}
// Scene 8 is a slideshow of 6 images (ALK 8085) with crossfade transitions.
// Total duration (scene_duration[8] = 6402ms) is divided into 7 equal segments:
// Segment 1: fade in image[0] (black → full)
// Segments 26: crossfade image[i-1] → image[i]
// Segment 7: hold image[5] at full opacity
static void render_scene8(int elapsed) {
const int duration = scene_duration[8];
const int seg = duration / 7;
SDL_Texture **imgs = dd.images + 80; // ALK[80..85]
if (elapsed < seg) {
// Segment 1: fade in image[0] from black
int alpha = seg > 0 ? (elapsed * 255) / seg : 255;
if (imgs[0]) {
SDL_SetTextureBlendMode(imgs[0], SDL_BLENDMODE_BLEND);
SDL_SetTextureAlphaMod(imgs[0], (Uint8)SDL_min(alpha, 255));
SDL_RenderCopy(gfx_renderer, imgs[0], NULL, NULL);
}
} else if (elapsed < 6 * seg) {
// Segments 26: crossfade image[idx] → image[idx+1]
int idx = elapsed / seg - 1; // 0..4
int alpha = ((elapsed - (idx + 1) * seg) * 255) / seg;
if (imgs[idx]) {
SDL_SetTextureBlendMode(imgs[idx], SDL_BLENDMODE_NONE);
SDL_SetTextureAlphaMod(imgs[idx], 255);
SDL_RenderCopy(gfx_renderer, imgs[idx], NULL, NULL);
}
if (imgs[idx + 1]) {
SDL_SetTextureBlendMode(imgs[idx + 1], SDL_BLENDMODE_BLEND);
SDL_SetTextureAlphaMod(imgs[idx + 1], (Uint8)SDL_min(alpha, 255));
SDL_RenderCopy(gfx_renderer, imgs[idx + 1], NULL, NULL);
}
} else {
// Segment 7: hold image[5] at full opacity
if (imgs[5]) {
SDL_SetTextureBlendMode(imgs[5], SDL_BLENDMODE_NONE);
SDL_SetTextureAlphaMod(imgs[5], 255);
SDL_RenderCopy(gfx_renderer, imgs[5], NULL, NULL);
}
}
}
// Scene 10 is a 10.37s animation with 3 phases:
// images[18..31]: surfaces1, 14 animation frames (type A)
// images[32..59]: surfaces2, 28 animation frames (type B/C pairs per slot)
// images[10]: surface3, static full-screen image for zoom/fade
//
// Phase 1 (06453ms): slideshow of 14 frames × 461ms each.
// Within each frame, 3 sub-images are shown in sequence:
// 0152ms: images[18+frame] (surfaces1[frame])
// 153306ms: images[32+frame*2] (surfaces2[frame*2])
// 307460ms: images[32+frame*2+1] (surfaces2[frame*2+1])
//
// Phase 2 (64549609ms): ZoomBlend images[10] zooms in from a tiny
// bottom-centered region (16 × view_h/4) to full screen with pow(4) ease-in.
//
// Phase 3 (961010370ms): images[10] fades out to black (alpha 255→0).
static void render_scene10(int elapsed) {
const int duration = scene_duration[10];
SDL_Texture *surface3 = dd.images[10];
if (elapsed < 6454) {
// Phase 1: frame animation
int frame = elapsed / 461;
int phase = elapsed % 461;
int idx;
if (phase < 153)
idx = 18 + frame;
else if (phase < 307)
idx = 32 + frame * 2;
else
idx = 32 + frame * 2 + 1;
SDL_Texture *tex = dd.images[idx];
if (tex) {
SDL_SetTextureBlendMode(tex, SDL_BLENDMODE_NONE);
SDL_SetTextureAlphaMod(tex, 255);
SDL_SetTextureColorMod(tex, 255, 255, 255);
SDL_RenderCopy(gfx_renderer, tex, NULL, NULL);
}
} else if (elapsed < 9610) {
// Phase 2: zoom in
int h4 = view_h / 4;
float progress = 1.0f - (float)(elapsed - 6454) / (float)(9610 - 6454);
float ease = powf(progress, 4.0f);
float src_w = lerpf((float)view_w, 16.0f, ease);
float src_h = lerpf((float)view_h, (float)h4, ease);
SDL_Rect src_rect = {
(int)((view_w - src_w) * 0.5f),
(int)(view_h - src_h),
(int)src_w,
(int)src_h,
};
if (surface3) {
SDL_SetTextureBlendMode(surface3, SDL_BLENDMODE_BLEND);
SDL_SetTextureAlphaMod(surface3, 255);
SDL_SetTextureColorMod(surface3, 255, 255, 255);
SDL_RenderCopy(gfx_renderer, surface3, &src_rect, NULL);
}
} else {
// Phase 3: fade out to black
int blend_alpha = (elapsed - 9610) * 255 / (duration - 9610);
int combined = 255 - SDL_min(blend_alpha, 255);
if (surface3) {
SDL_SetTextureBlendMode(surface3,
combined < 255 ? SDL_BLENDMODE_BLEND : SDL_BLENDMODE_NONE);
SDL_SetTextureAlphaMod(surface3, (Uint8)combined);
SDL_SetTextureColorMod(surface3, 255, 255, 255);
SDL_RenderCopy(gfx_renderer, surface3, NULL, NULL);
}
}
}
// Scene 11 is a complex layered animation with 8 segments over 31.6s:
// Background (ALK 60) scrolls upward over the full scene duration.
// The scene duration (31613ms) is divided into 8 equal segments (~3951ms each):
// Segment 0: background only
// Segments 1, 3, 5: one of 3 images (ALK 63, 62, 61) slides top-to-bottom at 50% alpha
// Segments 2, 4, 6: one of 3 overlay images (ALK 69, 70, 71) pingpong-fades in/out
// Segment 7: white fade out
static void render_scene11(int elapsed) {
const int duration = scene_duration[11]; // 31613
const int unit = duration / 8; // ~3951
SDL_Texture *bg = dd.images[60];
// Slide images (alpha maps, drawn at 50% alpha, pass top-to-bottom)
SDL_Texture **slide = dd.images + 61; // ALK[61..63]
// Overlay images (alpha maps, pingpong blend)
SDL_Texture **overlay = dd.images + 69; // ALK[69..71]
// Background: scrolls from bottom to top of source image over full duration.
// srcY = (bg_h - view_h) * (duration - elapsed) / duration
if (bg) {
int bg_w, bg_h;
SDL_QueryTexture(bg, NULL, NULL, &bg_w, &bg_h);
int scroll = (int)((long long)(bg_h - view_h) * elapsed / duration);
int src_y = SDL_max(0, (bg_h - view_h) - scroll);
SDL_Rect src = {0, src_y, SDL_min(view_w, bg_w), view_h};
SDL_SetTextureBlendMode(bg, SDL_BLENDMODE_NONE);
SDL_RenderCopy(gfx_renderer, bg, &src, NULL);
}
if (elapsed < unit) {
// Segment 0: background only, nothing extra
} else if (elapsed < unit * 2) {
// Segment 1: slide[2] (ALK 63) passes top-to-bottom at 50% alpha
SDL_Texture *tex = slide[2];
if (tex) {
int tw, th;
SDL_QueryTexture(tex, NULL, NULL, &tw, &th);
int y = (int)((long long)(th + view_h) * (elapsed - unit) / unit) - th;
SDL_SetTextureBlendMode(tex, SDL_BLENDMODE_BLEND);
SDL_SetTextureAlphaMod(tex, 0x80);
SDL_Rect dst = {(view_w - tw) / 2, y, tw, th};
SDL_RenderCopy(gfx_renderer, tex, NULL, &dst);
}
} else if (elapsed < unit * 3) {
// Segment 2: overlay[0] (ALK 69) pingpong fade
SDL_Texture *tex = overlay[0];
if (tex) {
int t2 = elapsed % unit;
if (t2 >= unit / 2) t2 = unit - t2;
int alpha = (t2 * 255) / (unit / 2);
SDL_SetTextureBlendMode(tex, SDL_BLENDMODE_BLEND);
SDL_SetTextureAlphaMod(tex, (Uint8)SDL_min(alpha, 255));
SDL_RenderCopy(gfx_renderer, tex, NULL, NULL);
}
} else if (elapsed < unit * 4) {
// Segment 3: slide[1] (ALK 62) passes top-to-bottom at 50% alpha
SDL_Texture *tex = slide[1];
if (tex) {
int tw, th;
SDL_QueryTexture(tex, NULL, NULL, &tw, &th);
int y = (int)((long long)(th + view_h) * (elapsed - unit * 3) / unit) - th;
SDL_SetTextureBlendMode(tex, SDL_BLENDMODE_BLEND);
SDL_SetTextureAlphaMod(tex, 0x80);
SDL_Rect dst = {(view_w - tw) / 2, y, tw, th};
SDL_RenderCopy(gfx_renderer, tex, NULL, &dst);
}
} else if (elapsed < unit * 5) {
// Segment 4: overlay[1] (ALK 70) pingpong fade
SDL_Texture *tex = overlay[1];
if (tex) {
int t2 = elapsed % unit;
if (t2 >= unit / 2) t2 = unit - t2;
int alpha = (t2 * 255) / (unit / 2);
SDL_SetTextureBlendMode(tex, SDL_BLENDMODE_BLEND);
SDL_SetTextureAlphaMod(tex, (Uint8)SDL_min(alpha, 255));
SDL_RenderCopy(gfx_renderer, tex, NULL, NULL);
}
} else if (elapsed < unit * 6) {
// Segment 5: slide[0] (ALK 61) passes top-to-bottom at 50% alpha
SDL_Texture *tex = slide[0];
if (tex) {
int tw, th;
SDL_QueryTexture(tex, NULL, NULL, &tw, &th);
int y = (int)((long long)(th + view_h) * (elapsed - unit * 5) / unit) - th;
SDL_SetTextureBlendMode(tex, SDL_BLENDMODE_BLEND);
SDL_SetTextureAlphaMod(tex, 0x80);
SDL_Rect dst = {(view_w - tw) / 2, y, tw, th};
SDL_RenderCopy(gfx_renderer, tex, NULL, &dst);
}
} else if (elapsed < unit * 7) {
// Segment 6: overlay[2] (ALK 71) pingpong fade
SDL_Texture *tex = overlay[2];
if (tex) {
int t2 = elapsed % unit;
if (t2 >= unit / 2) t2 = unit - t2;
int alpha = (t2 * 255) / (unit / 2);
SDL_SetTextureBlendMode(tex, SDL_BLENDMODE_BLEND);
SDL_SetTextureAlphaMod(tex, (Uint8)SDL_min(alpha, 255));
SDL_RenderCopy(gfx_renderer, tex, NULL, NULL);
}
} else {
// Segment 7: white fade out
int fade_alpha = (duration > unit * 7)
? ((elapsed - unit * 7) * 255) / (duration - unit * 7)
: 255;
fade_overlay(0xff, 0xff, 0xff, (Uint8)SDL_min(fade_alpha, 255));
}
}
// Scene 12 is a complex 10.37s animation with multiple layers and a 3D spinning quad:
// ALK[64]: background image A
// ALK[65]: background image B
// ALK[66]: overlay image
// ALK[67]: 3D quad texture
//
// Timeline (relative to scene start):
// 02076ms: fade in bg_a from white (white overlay 255→0)
// 20762226ms: bg_a static
// 22263826ms: crossfade bg_a → bg_b
// 38263976ms: bg_b static
// 39767803ms: bg_b wave distortion (TODO) + bg_b at α=0xB0 + fade to white
// 78039397ms: white bg + 3D rotating quad + overlay fade in (0→255)
// 939710338ms: overlay static
//
// 3D rendering (78039397ms):
// A rhombus-shaped textured quad in the XY plane at z=-2.4 (world space),
// spinning around the Y axis (2 full rotations over 1594ms).
// Projection: vertical FoV=60°, aspect=4:3, near=0.25, far=2000.
// Vertex positions (model space):
// v0=(0, -0.51524, 0) UV:(0,0)
// v1=(0.28806, 0.22720, 0) UV:(1,0)
// v2=(0, 0.51524, 0) UV:(1,1)
// v3=(-0.28806, -0.22720, 0) UV:(0,1)
static void render_scene12_3d(int elapsed) {
SDL_Texture *tex = dd.images[67];
if (!tex) return;
// Model-space vertices (x, y, z) forming a rhombus in the XY plane.
static const float mv[4][3] = {
{ 0.00000f, -0.51524f, 0.0f }, // v0
{ 0.28806f, 0.22720f, 0.0f }, // v1
{ 0.00000f, 0.51524f, 0.0f }, // v2
{ -0.28806f, -0.22720f, 0.0f }, // v3
};
// Normalized texture UV per vertex
static const float muv[4][2] = {
{0.0f, 0.0f}, {1.0f, 0.0f}, {1.0f, 1.0f}, {0.0f, 1.0f},
};
// Y-rotation: 2 full rotations over the 1594ms 3D phase.
float t = (float)(elapsed - 7803);
float angle = t * (4.0f * (float)M_PI / 1594.0f);
float cos_a = cosf(angle);
float sin_a = sinf(angle);
// Perspective projection parameters: see PROJ_SCALE_X/Y, PROJ_W_DENOM
const float half_w = (float)view_w * 0.5f;
const float half_h = (float)view_h * 0.5f;
SDL_Vertex verts[4];
for (int i = 0; i < 4; i++) {
// World transform: Y-rotate first, then translate(+0.01, 0, -2.4).
float rx = cos_a * mv[i][0] + sin_a * mv[i][2];
float ry = mv[i][1];
float rz = -sin_a * mv[i][0] + cos_a * mv[i][2];
float wx = rx + 0.01f;
float wy = ry;
float wz = rz - 2.4f;
// Perspective divide: w = -wz * PROJ_W_DENOM (wz is negative → w positive)
float w = -wz * PROJ_W_DENOM;
if (w <= 0.0f) w = 1e-5f;
// NDC → screen
verts[i].position.x = (wx * PROJ_SCALE_X / w + 1.0f) * half_w;
verts[i].position.y = (wy * PROJ_SCALE_Y / w + 1.0f) * half_h;
verts[i].color = (SDL_Color){255, 255, 255, 255};
verts[i].tex_coord.x = muv[i][0];
verts[i].tex_coord.y = muv[i][1];
}
SDL_SetTextureBlendMode(tex, SDL_BLENDMODE_NONE);
render_quad(tex, verts);
}
static void render_scene12(int elapsed) {
SDL_Texture *bg_a = dd.images[64];
SDL_Texture *bg_b = dd.images[65];
SDL_Texture *overlay = dd.images[66];
if (elapsed < 2076) {
// 02076ms: bg_a with white fade-in overlay
if (bg_a) {
SDL_SetTextureBlendMode(bg_a, SDL_BLENDMODE_NONE);
SDL_RenderCopy(gfx_renderer, bg_a, NULL, NULL);
}
int white_alpha = 0xff - (elapsed * 0xff) / 2076;
fade_overlay(0xff, 0xff, 0xff, (Uint8)white_alpha);
} else if (elapsed < 2226) {
// 20762226ms: bg_a static
if (bg_a) {
SDL_SetTextureBlendMode(bg_a, SDL_BLENDMODE_NONE);
SDL_RenderCopy(gfx_renderer, bg_a, NULL, NULL);
}
} else if (elapsed < 3826) {
// 22263826ms: crossfade bg_a → bg_b
if (bg_a) {
SDL_SetTextureBlendMode(bg_a, SDL_BLENDMODE_NONE);
SDL_RenderCopy(gfx_renderer, bg_a, NULL, NULL);
}
if (bg_b) {
int alpha = ((elapsed - 2226) * 0xff) / 1600;
SDL_SetTextureBlendMode(bg_b, SDL_BLENDMODE_BLEND);
SDL_SetTextureAlphaMod(bg_b, (Uint8)SDL_min(alpha, 0xff));
SDL_RenderCopy(gfx_renderer, bg_b, NULL, NULL);
}
} else if (elapsed < 3976) {
// 38263976ms: bg_b static
if (bg_b) {
SDL_SetTextureBlendMode(bg_b, SDL_BLENDMODE_NONE);
SDL_RenderCopy(gfx_renderer, bg_b, NULL, NULL);
}
} else if (elapsed < 7803) {
// 39767803ms: TODO wave distortion on bg_b; for now just show bg_b,
// then fade to white
if (bg_b) {
SDL_SetTextureBlendMode(bg_b, SDL_BLENDMODE_BLEND);
SDL_RenderCopy(gfx_renderer, bg_b, NULL, NULL);
}
int white_alpha = ((elapsed - 3976) * 0xff) / 3827;
fade_overlay(0xff, 0xff, 0xff, (Uint8)SDL_min(white_alpha, 0xff));
} else if (elapsed < 9397) {
// 78039397ms: white bg + 3D rotating quad + overlay fade-in
SDL_SetRenderDrawBlendMode(gfx_renderer, SDL_BLENDMODE_NONE);
SDL_SetRenderDrawColor(gfx_renderer, 0xff, 0xff, 0xff, 0xff);
SDL_RenderFillRect(gfx_renderer, NULL);
render_scene12_3d(elapsed);
if (overlay) {
int alpha = ((elapsed - 7803) * 0xff) / 1594;
SDL_SetTextureBlendMode(overlay, SDL_BLENDMODE_BLEND);
SDL_SetTextureAlphaMod(overlay, (Uint8)SDL_min(alpha, 0xff));
SDL_RenderCopy(gfx_renderer, overlay, NULL, NULL);
}
} else {
// 939710338ms: overlay static
if (overlay) {
SDL_SetTextureBlendMode(overlay, SDL_BLENDMODE_NONE);
SDL_RenderCopy(gfx_renderer, overlay, NULL, NULL);
}
}
}
static void Run() {
TRACE_UNIMPLEMENTED("dDemo.Run:");
#ifdef DDEMODEV
TRACE("dDemo.Run:");
muscd_start(13, 1);
// ddemo_scene();
while(0 == sys_getInputInfo()) {
usleep(1000 * 100);
uint32_t start = sys_get_ticks();
int current_scene = 0;
while (!nact->is_quit && !(sys_getInputInfo() && dd.key_cancel)) {
uint32_t now = sys_get_ticks();
if (current_scene < NR_SCENES && now - start >= (uint32_t)scene_duration[current_scene]) {
current_scene++;
if (current_scene < NR_SCENES) {
start = now;
} else if (dd.loop) {
muscd_stop();
current_scene = 0;
start = now;
muscd_start(13, 1);
}
}
if (current_scene >= NR_SCENES) {
break;
}
SDL_SetRenderDrawColor(gfx_renderer, 0, 0, 0, 255);
SDL_RenderClear(gfx_renderer);
switch (current_scene) {
case 0:
render_scene0(now - start);
break;
case 1:
render_scene1(now - start);
break;
case 2:
render_scene_2_4_6(now - start, 2, 0, 3, 4);
break;
case 3:
render_scene_3_5_7_9(now - start, 11);
break;
case 4:
render_scene_2_4_6(now - start, 4, 1, 5, 6);
break;
case 5:
render_scene_3_5_7_9(now - start, 12);
break;
case 6:
render_scene_2_4_6(now - start, 6, 2, 7, 8);
break;
case 7:
render_scene_3_5_7_9(now - start, 13);
break;
case 8:
render_scene8(now - start);
break;
case 9:
render_scene_3_5_7_9(now - start, 14);
break;
case 10:
render_scene10(now - start);
break;
case 11:
render_scene11(now - start);
break;
case 12:
render_scene12(now - start);
break;
}
SDL_RenderPresent(gfx_renderer);
sys_wait_vsync();
}
muscd_stop();
#endif
for (int i = 0; i < NR_TEXTURES; i++) {
if (dd.images[i])
SDL_DestroyTexture(dd.images[i]);
dd.images[i] = NULL;
}
}
static const ModuleFunc functions[] = {
+1 -1
View File
@@ -24,7 +24,7 @@
#ifndef __DRAWTEXT_H__
#define __DRAWTEXT_H__
#include "graphics.h"
#include "font.h"
struct SDL_Surface;
+2 -2
View File
@@ -44,8 +44,8 @@ static void gre_BlendUseAMap(surface_t *dst, int dx, int dy, surface_t *src, int
void gr_blend_alpha_map(surface_t *dst, int dx, int dy, surface_t *src, int sx, int sy, int sw, int sh) {
if (src == NULL || dst == NULL) return;
MyRectangle src_window = { 0, 0, src->width, src->height };
MyRectangle dst_window = { 0, 0, dst->width, dst->height };
SDL_Rect src_window = { 0, 0, src->width, src->height };
SDL_Rect dst_window = { 0, 0, dst->width, dst->height };
if (!ags_clipCopyRect(&src_window, &dst_window, &sx, &sy, &dx, &dy, &sw, &sh)) return;
if (src->alpha == NULL) {
+37 -25
View File
@@ -33,10 +33,13 @@
#include "nact.h"
#include "system.h"
#include "ags.h"
#include "sact.h"
#include "variable.h"
#include "sactcg.h"
#include "cg.h"
#include "sdl_core.h"
#include "gfx.h"
#define CGMAX 65536
static cginfo_t **cg_store;
#define SPCG_ASSERT_NO(no) \
if ((no) > (CGMAX -1)) { \
@@ -44,15 +47,21 @@
return; \
} \
static cginfo_t *scg_new(enum cgtype type, int no, SDL_Surface *sf) {
static void scg_ensure_store(void) {
if (!cg_store)
cg_store = calloc(CGMAX, sizeof(cginfo_t *));
}
static cginfo_t *scg_new(enum sactcg_type type, int no, SDL_Surface *sf) {
cginfo_t *info = calloc(1, sizeof(cginfo_t));
info->type = type;
info->no = no;
info->sf = sf;
info->refcnt = 1;
scg_ensure_store();
scg_free(no);
sact.cg[no] = info;
cg_store[no] = info;
return info;
}
@@ -71,8 +80,8 @@ static cginfo_t *scg_get(int no) {
return NULL;
}
if (sact.cg[no] != NULL)
return sact.cg[no];
if (cg_store && cg_store[no])
return cg_store[no];
SDL_Surface *sf = cg_load_as_sdlsurface(no - 1);
if (!sf) {
@@ -118,9 +127,9 @@ void scg_create_reverse(int wNumCG, int wNumSrcCG, int wReverseX, int wReverseY)
SDL_Surface *sf = SDL_ConvertSurface(src->sf, src->sf->format, 0);
if (wReverseX)
sdl_FlipSurfaceHorizontal(sf);
gfx_FlipSurfaceHorizontal(sf);
if (wReverseY)
sdl_FlipSurfaceVertical(sf);
gfx_FlipSurfaceVertical(sf);
scg_new(CG_REVERSE, wNumCG, sf);
}
@@ -292,11 +301,13 @@ void scg_partcopy(int wNumDstCG, int wNumSrcCG, int wX, int wY, int wWidth, int
// 全てのCGの開放
void scg_freeall(void) {
int i;
for (i = 1; i < CGMAX; i++) {
if (!cg_store)
return;
for (int i = 1; i < CGMAX; i++) {
scg_free(i);
}
free(cg_store);
cg_store = NULL;
}
/**
@@ -306,28 +317,29 @@ void scg_freeall(void) {
void scg_free(int no) {
SPCG_ASSERT_NO(no);
cginfo_t *cg = sact.cg[no];
if (!cg_store) return;
cginfo_t *cg = cg_store[no];
if (!cg) return;
scg_deref(cg);
sact.cg[no] = NULL;
cg_store[no] = NULL;
}
// CGの種類を取得
int scg_querytype(int wNumCG) {
if (wNumCG >= (CGMAX -1)) return CG_NOTUSED;
if (sact.cg[wNumCG] == NULL) return CG_NOTUSED;
return sact.cg[wNumCG]->type;
if (!cg_store || !cg_store[wNumCG]) return CG_NOTUSED;
return cg_store[wNumCG]->type;
}
// CGの大きさを取得
bool scg_querysize(int wNumCG, int *w, int *h) {
if (wNumCG >= (CGMAX -1)) goto errexit;
if (sact.cg[wNumCG] == NULL) goto errexit;
if (sact.cg[wNumCG]->sf == NULL) goto errexit;
if (!cg_store || !cg_store[wNumCG]) goto errexit;
if (cg_store[wNumCG]->sf == NULL) goto errexit;
*w = sact.cg[wNumCG]->sf->w;
*h = sact.cg[wNumCG]->sf->h;
*w = cg_store[wNumCG]->sf->w;
*h = cg_store[wNumCG]->sf->h;
return true;
@@ -339,15 +351,15 @@ bool scg_querysize(int wNumCG, int *w, int *h) {
// CGのBPPを取得
int scg_querybpp(int wNumCG) {
if (wNumCG >= (CGMAX -1)) return 0;
if (sact.cg[wNumCG] == NULL) return 0;
if (sact.cg[wNumCG]->sf == NULL) return 0;
return sact.cg[wNumCG]->sf->format->BitsPerPixel;
if (!cg_store || !cg_store[wNumCG]) return 0;
if (cg_store[wNumCG]->sf == NULL) return 0;
return cg_store[wNumCG]->sf->format->BitsPerPixel;
}
// CGの alphamap が存在するかを取得
bool scg_existalphamap(int wNumCG) {
if (wNumCG >= (CGMAX -1)) return false;
if (sact.cg[wNumCG] == NULL) return false;
if (sact.cg[wNumCG]->sf == NULL) return false;
return SDL_ISPIXELFORMAT_ALPHA(sact.cg[wNumCG]->sf->format->format);
if (!cg_store || !cg_store[wNumCG]) return false;
if (cg_store[wNumCG]->sf == NULL) return false;
return SDL_ISPIXELFORMAT_ALPHA(cg_store[wNumCG]->sf->format->format);
}
+15 -1
View File
@@ -25,7 +25,21 @@
#define __SACTCG_H__
#include "portab.h"
#include "sact.h"
enum sactcg_type {
CG_NOTUSED = 0,
CG_LINKED = 1,
CG_SET = 2,
CG_REVERSE = 3,
CG_STRETCH = 4
};
typedef struct {
enum sactcg_type type;
int no;
struct SDL_Surface *sf;
int refcnt;
} cginfo_t;
cginfo_t *scg_addref(int no);
void scg_deref(cginfo_t *cg);
+5 -5
View File
@@ -22,7 +22,7 @@ typedef struct {
static void *mapdata[NUM_MAPS];
static int setChipParam_index;
static MyRectangle chip_params[NUM_LAYERS];
static SDL_Rect chip_params[NUM_LAYERS];
static int window_width;
static int window_height;
static int map_width;
@@ -68,7 +68,7 @@ static void MakeMapSetChipParam() {
WARNING("unexpected MakeMapSeChipParam call");
return;
}
MyRectangle *r = &chip_params[setChipParam_index++];
SDL_Rect *r = &chip_params[setChipParam_index++];
r->x = p1;
r->y = p2;
r->w = p3;
@@ -93,9 +93,9 @@ static void MakeMapDraw() {
int c1 = a1[index];
int c2 = a2[index];
int c3 = a3[index];
MyRectangle *r1 = &chip_params[0];
MyRectangle *r2 = &chip_params[1];
MyRectangle *r3 = &chip_params[2];
SDL_Rect *r1 = &chip_params[0];
SDL_Rect *r2 = &chip_params[1];
SDL_Rect *r3 = &chip_params[2];
surface_t *dib = ags_getDIB();
if (c3) {
ags_copyArea(r3->x + c3 * r3->w, r3->y, r3->w, r3->h, dstX + x * r3->w, dstY + y * r3->h);
+11 -7
View File
@@ -30,7 +30,7 @@
#include "alk.h"
#include "input.h"
#include "bgm.h"
#include "sdl_core.h"
#include "gfx.h"
#include "cg.h"
#include "jpeg.h"
@@ -62,9 +62,13 @@ static void SetLoopFlag() {
}
static void Run() {
alk_t *alk = alk_new("tDEMO.alk");
if (!nact->files.alk[0]) {
WARNING("tDEMO.alk not found");
return;
}
alk_t *alk = alk_new(nact->files.alk[0]); // tDEMO.alk
if (!alk) {
WARNING("Cannot open tDEMO.alk");
WARNING("Cannot open %s", nact->files.alk[0]);
return;
}
@@ -72,9 +76,9 @@ static void Run() {
musbgm_play(TDEMO_MUSIC_NO, 0, 100, 0);
uint32_t start = sdl_getTicks();
uint32_t start = sys_get_ticks();
while (!nact->is_quit) {
int i = (sdl_getTicks() - start) / (1000 / FPS);
int i = (sys_get_ticks() - start) / (1000 / FPS);
if (i >= alk->datanum)
break;
@@ -89,12 +93,12 @@ static void Run() {
WARNING("Cannot decode CG %d", i);
}
int wait_ms = (i + 1) * (1000 / FPS) - (sdl_getTicks() - start);
int wait_ms = (i + 1) * (1000 / FPS) - (sys_get_ticks() - start);
if (wait_ms > 0) {
if (sys_keywait(wait_ms, KEYWAIT_CANCELABLE))
break;
} else {
sdl_updateScreen();
gfx_updateScreen();
if (sys_getInputInfo())
break;
}
+7 -7
View File
@@ -59,9 +59,14 @@ target_sources(xsystem35 PRIVATE
cursor.c
dri.c
ecopy.c
effect.c
event.c
filecheck.c
font.c
hacks.c
gfx_draw.c
gfx_image.c
gfx_video.c
image.c
input.c
jpeg.c
@@ -82,13 +87,8 @@ target_sources(xsystem35 PRIVATE
savedata.c
scenario.c
scheduler.c
sdl_cursor.c
sdl_draw.c
sdl_effect.c
sdl_event.c
sdl_image.c
sdl_video.c
selection.c
system.c
texthook.c
variable.c
vsp.c
@@ -125,7 +125,7 @@ elseif (ANDROID)
elseif (ENABLE_GTK)
target_sources(xsystem35 PRIVATE menu.c menu_callback.c menu_gui.c s39init.c)
else ()
target_sources(xsystem35 PRIVATE menu_sdl.c sdl_input.c)
target_sources(xsystem35 PRIVATE menu_sdl.c editor.c)
endif()
if (HAVE_WEBP)
+116 -102
View File
@@ -35,7 +35,9 @@
#include "xsystem35.h"
#include "scenario.h"
#include "ags.h"
#include "sdl_core.h"
#include "gfx.h"
#include "effect.h"
#include "event.h"
#include "alpha_plane.h"
#include "utfsjis.h"
#include "input.h"
@@ -81,25 +83,25 @@ static void initPal(void) {
for (int i = 0; i < 256; i++) {
nact->ags.pal[i].a = 255;
}
sdl_setPalette(nact->ags.pal, 0, 256);
gfx_setPalette(nact->ags.pal, 0, 256);
palette_changed();
}
bool ags_check_param(int *x, int *y, int *w, int *h) {
if (*x >= nact->ags.world_size.width) {
WARNING("Illegal Param x = %d (max=%d)(@%03x:%05x)", *x, nact->ags.world_size.width, sl_getPage(), sl_getIndex());
if (*x >= nact->ags.world_width) {
WARNING("Illegal Param x = %d (max=%d)(@%03x:%05x)", *x, nact->ags.world_width, sl_getPage(), sl_getIndex());
return false;
}
if (*y >= nact->ags.world_size.height) {
WARNING("Illegal Param y = %d (max=%d)", *y, nact->ags.world_size.height);
if (*y >= nact->ags.world_height) {
WARNING("Illegal Param y = %d (max=%d)", *y, nact->ags.world_height);
return false;
}
if (*x < 0) { *w += *x; *x = 0; }
if (*y < 0) { *h += *y; *y = 0; }
if ((*x + *w) > nact->ags.world_size.width) { *w = nact->ags.world_size.width - *x;}
if ((*y + *h) > nact->ags.world_size.height) { *h = nact->ags.world_size.height - *y;}
if ((*x + *w) > nact->ags.world_width) { *w = nact->ags.world_width - *x;}
if ((*y + *h) > nact->ags.world_height) { *h = nact->ags.world_height - *y;}
if (*w <= 0) return false;
if (*h <= 0) return false;
@@ -108,11 +110,11 @@ bool ags_check_param(int *x, int *y, int *w, int *h) {
}
bool ags_check_param_xy(int *x, int *y) {
if (*x >= nact->ags.world_size.width) {
if (*x >= nact->ags.world_width) {
WARNING("Illegal Param x = %d", *x);
return false;
}
if (*y >= nact->ags.world_size.height) {
if (*y >= nact->ags.world_height) {
WARNING("Illegal Param y = %d", *y);
return false;
}
@@ -125,8 +127,8 @@ bool ags_check_param_xy(int *x, int *y) {
void ags_init(const char *render_driver, bool enable_zb) {
nact->ags.mouse_warp_enabled = true;
nact->ags.world_size.width = SYS35_DEFAULT_WIDTH;
nact->ags.world_size.height = SYS35_DEFAULT_HEIGHT;
nact->ags.world_width = SYS35_DEFAULT_WIDTH;
nact->ags.world_height = SYS35_DEFAULT_HEIGHT;
nact->ags.world_depth = SYS35_DEFAULT_DEPTH;
nact->ags.view_area.x = 0;
nact->ags.view_area.y = 0;
@@ -139,7 +141,9 @@ void ags_init(const char *render_driver, bool enable_zb) {
nact->ags.enable_zb = enable_zb;
nact->ags.font_weight = enable_zb ? FONT_WEIGHT_BOLD : FONT_WEIGHT_NORMAL;
sdl_Initialize(render_driver);
gfx_Initialize(render_driver);
event_init();
cursor_init();
font_init();
initPal();
@@ -148,7 +152,8 @@ void ags_init(const char *render_driver, bool enable_zb) {
void ags_remove(void) {
ags_autorepeat(true);
sdl_Remove();
event_remove();
gfx_Remove();
}
void ags_reset(void) {
@@ -159,8 +164,8 @@ void ags_reset(void) {
}
void ags_setWorldSize(int width, int height, int depth) {
nact->ags.world_size.width = width;
nact->ags.world_size.height = height;
nact->ags.world_width = width;
nact->ags.world_height = height;
nact->ags.world_depth = depth;
if (nact->ags.dib && nact->ags.dib->alpha) {
@@ -168,9 +173,9 @@ void ags_setWorldSize(int width, int height, int depth) {
nact->ags.dib->alpha = NULL;
}
sdl_setWorldSize(width, height, depth);
gfx_setWorldSize(width, height, depth);
nact->ags.dib = sdl_getDIB();
nact->ags.dib = gfx_getDIB();
/* DIBが8以上の場合は、alpha plane を用意 */
if (depth > 8) {
@@ -188,29 +193,29 @@ void ags_setViewArea(int x, int y, int width, int height) {
nact->ags.view_area.y = y;
nact->ags.view_area.w = width;
nact->ags.view_area.h = height;
sdl_setWindowSize(width, height);
gfx_setWindowSize(width, height);
}
void ags_setWindowTitle(const char *title_utf8) {
char buf[256];
snprintf(buf, sizeof(buf), "XSystem35 Version %s: %s", VERSION, title_utf8);
sdl_setWindowTitle(buf);
gfx_setWindowTitle(buf);
}
void ags_getDIBInfo(DispInfo *info) {
info->width = nact->ags.world_size.width;
info->height = nact->ags.world_size.height;
info->width = nact->ags.world_width;
info->height = nact->ags.world_height;
info->depth = nact->ags.world_depth;
}
void ags_getViewAreaInfo(DispInfo *info) {
sdl_getWindowInfo(info);
gfx_getWindowInfo(NULL, NULL, &info->depth);
info->width = nact->ags.view_area.w;
info->height = nact->ags.view_area.h;
}
void ags_getWindowInfo(DispInfo *info) {
sdl_getWindowInfo(info);
gfx_getWindowInfo(&info->width, &info->height, &info->depth);
}
void ags_setExposeSwitch(bool expose) {
@@ -221,13 +226,13 @@ void ags_updateArea(int x, int y, int w, int h) {
if (fade_outed || !need_update)
return;
MyRectangle r = {x, y, w, h}, update;
SDL_Rect r = {x, y, w, h}, update;
if (SDL_IntersectRect(&nact->ags.view_area, &r, &update)) {
MyPoint p = {
SDL_Point p = {
update.x - nact->ags.view_area.x,
update.y - nact->ags.view_area.y
};
sdl_updateArea(&update, &p);
gfx_updateArea(&update, &p);
}
}
@@ -235,14 +240,14 @@ void ags_updateFull() {
if (fade_outed || !need_update)
return;
MyRectangle r = {
SDL_Rect r = {
nact->ags.view_area.x,
nact->ags.view_area.y,
min(nact->ags.view_area.w, nact->ags.world_size.width),
min(nact->ags.view_area.h, nact->ags.world_size.height)
min(nact->ags.view_area.w, nact->ags.world_width),
min(nact->ags.view_area.h, nact->ags.world_height)
};
MyPoint p = {0, 0};
sdl_updateArea(&r, &p);
SDL_Point p = {0, 0};
gfx_updateArea(&r, &p);
}
void ags_setPalettes(SDL_Color *src, int dst, int cnt) {
@@ -261,47 +266,47 @@ void ags_setPalette(int no, int red, int green, int blue) {
void ags_setPaletteToSystem(int src, int cnt) {
if (!fade_outed)
sdl_setPalette(nact->ags.pal, src, cnt);
gfx_setPalette(nact->ags.pal, src, cnt);
}
void ags_drawRectangle(int x, int y, int w, int h, int col) {
if (!ags_check_param(&x, &y, &w, &h)) return;
sdl_drawRectangle(x, y, w, h, col);
gfx_drawRectangle(x, y, w, h, col);
}
void ags_fillRectangle(int x, int y, int w, int h, int col) {
if (!ags_check_param(&x, &y, &w, &h)) return;
sdl_fillRectangle(x, y, w, h, col);
gfx_fillRectangle(x, y, w, h, col);
}
void ags_drawLine(int x0, int y0, int x1, int y1, int col) {
if (!ags_check_param_xy(&x0, &y0)) return;
if (!ags_check_param_xy(&x1, &y1)) return;
sdl_drawLine(x0, y0, x1, y1, col);
gfx_drawLine(x0, y0, x1, y1, col);
}
void ags_copyArea(int sx, int sy, int w, int h, int dx, int dy) {
if (!ags_check_param(&sx, &sy, &w, &h)) return;
if (!ags_check_param(&dx, &dy, &w, &h)) return;
sdl_copyArea(sx, sy, w, h, dx, dy);
gfx_copyArea(sx, sy, w, h, dx, dy);
}
void ags_scaledCopyArea(int sx, int sy, int sw, int sh, int dx, int dy, int dw, int dh, int mirror_sw) {
if (!ags_check_param(&sx, &sy, &sw, &sh)) return;
if (!ags_check_param(&dx, &dy, &dw, &dh)) return;
sdl_scaledCopyArea(sx, sy, sw, sh, dx, dy, dw, dh, mirror_sw);
gfx_scaledCopyArea(sx, sy, sw, sh, dx, dy, dw, dh, mirror_sw);
}
void ags_copyAreaSP(int sx, int sy, int w, int h, int dx, int dy, int col) {
if (!ags_check_param(&sx, &sy, &w, &h)) return;
if (!ags_check_param(&dx, &dy, &w, &h)) return;
sdl_copyAreaSP(sx, sy, w, h, dx, dy, col);
gfx_copyAreaSP(sx, sy, w, h, dx, dy, col);
}
void ags_wrapColor(int x, int y, int w, int h, int p1, int p2) {
@@ -309,13 +314,18 @@ void ags_wrapColor(int x, int y, int w, int h, int p1, int p2) {
if (!ags_check_param(&x, &y, &w, &h)) return;
sdl_wrapColor(x, y, w, h, p1, p2);
gfx_wrapColor(x, y, w, h, p1, p2);
}
void ags_getPixel(int x, int y, Palette *cell) {
void ags_getPixel(int x, int y, PixelColor *cell) {
if (!ags_check_param_xy(&x, &y)) return;
sdl_getPixel(x, y, cell);
uint32_t pixel = gfx_getPixel(x, y);
if (main_surface->format->BitsPerPixel == 8) {
cell->index = pixel;
} else {
SDL_GetRGB(pixel, main_surface->format, &cell->r, &cell->g, &cell->b);
}
}
void ags_copyPaletteShift(int sx, int sy, int w, int h, int dx, int dy, uint8_t sprite) {
@@ -357,7 +367,7 @@ void ags_changeColorArea(int sx, int sy, int w, int h, int dst, int src, int cnt
void* ags_saveRegion(int x, int y, int w, int h) {
if (!ags_check_param(&x, &y, &w, &h)) return NULL;
return (void *)sdl_saveRegion(x, y, w, h);
return (void *)gfx_saveRegion(x, y, w, h);
}
void ags_restoreRegion(void *region, int x, int y) {
@@ -365,7 +375,7 @@ void ags_restoreRegion(void *region, int x, int y) {
if (!ags_check_param_xy(&x, &y)) return;
sdl_restoreRegion(region, x, y);
gfx_restoreRegion(region, x, y);
}
void ags_putRegion(void *region, int x, int y) {
@@ -373,16 +383,16 @@ void ags_putRegion(void *region, int x, int y) {
if (!ags_check_param_xy(&x, &y)) return;
sdl_putRegion(region, x, y);
gfx_putRegion(region, x, y);
}
void ags_delRegion(void *region) {
if (region == NULL) return;
sdl_delRegion(region);
gfx_delRegion(region);
}
int ags_drawString(int x, int y, const char *src, int col, MyRectangle *rect_out) {
int ags_drawString(int x, int y, const char *src, int col, SDL_Rect *rect_out) {
if (!ags_check_param_xy(&x, &y)) {
if (rect_out) {
rect_out->x = x;
@@ -393,7 +403,7 @@ int ags_drawString(int x, int y, const char *src, int col, MyRectangle *rect_out
return 0;
}
MyRectangle adj;
SDL_Rect adj;
char *utf8 = toUTF8(src);
switch(nact->ags.text_decoration_type) {
case TEXT_DECORATION_NONE:
@@ -401,46 +411,46 @@ int ags_drawString(int x, int y, const char *src, int col, MyRectangle *rect_out
adj.x = 0; adj.y = 0; adj.w = 0; adj.h = 0;
break;
case TEXT_DECORATION_DROP_SHADOW_BOTTOM:
sdl_drawString(x, y +1, utf8, nact->ags.text_decoration_color);
gfx_drawString(x, y +1, utf8, nact->ags.text_decoration_color);
adj.x = 0; adj.y = 0; adj.w = 0; adj.h = 1;
break;
case TEXT_DECORATION_DROP_SHADOW_RIGHT:
sdl_drawString(x +1, y, utf8, nact->ags.text_decoration_color);
gfx_drawString(x +1, y, utf8, nact->ags.text_decoration_color);
adj.x = 0; adj.y = 0; adj.w = 1; adj.h = 0;
break;
case TEXT_DECORATION_DROP_SHADOW_BOTTOM_RIGHT:
sdl_drawString(x +1, y +1, utf8, nact->ags.text_decoration_color);
gfx_drawString(x +1, y +1, utf8, nact->ags.text_decoration_color);
adj.x = 0; adj.y = 0; adj.w = 1; adj.h = 1;
break;
case TEXT_DECORATION_OUTLINE:
sdl_drawString(x -1, y, utf8, nact->ags.text_decoration_color);
sdl_drawString(x +1, y, utf8, nact->ags.text_decoration_color);
sdl_drawString(x, y -1, utf8, nact->ags.text_decoration_color);
sdl_drawString(x, y +1, utf8, nact->ags.text_decoration_color);
gfx_drawString(x -1, y, utf8, nact->ags.text_decoration_color);
gfx_drawString(x +1, y, utf8, nact->ags.text_decoration_color);
gfx_drawString(x, y -1, utf8, nact->ags.text_decoration_color);
gfx_drawString(x, y +1, utf8, nact->ags.text_decoration_color);
adj.x = -1; adj.y = -1; adj.w = 2; adj.h = 2;
break;
case TEXT_DECORATION_BOLD_HORIZONTAL:
sdl_drawString(x +1, y, utf8, col);
gfx_drawString(x +1, y, utf8, col);
adj.x = 0; adj.y = 0; adj.w = 1; adj.h = 0;
break;
case TEXT_DECORATION_BOLD_VERTICAL:
sdl_drawString(x, y +1, utf8, col);
gfx_drawString(x, y +1, utf8, col);
adj.x = 0; adj.y = 0; adj.w = 0; adj.h = 1;
break;
case TEXT_DECORATION_BOLD_HORIZONTAL_VERTICAL:
sdl_drawString(x +1, y +1, utf8, col);
gfx_drawString(x +1, y +1, utf8, col);
adj.x = 0; adj.y = 0; adj.w = 1; adj.h = 1;
break;
case TEXT_DECORATION_DROP_SHADOW_OUTLINE:
sdl_drawString(x -1, y , utf8, nact->ags.text_decoration_color);
sdl_drawString(x +1, y , utf8, nact->ags.text_decoration_color);
sdl_drawString(x , y -1, utf8, nact->ags.text_decoration_color);
sdl_drawString(x , y +1, utf8, nact->ags.text_decoration_color);
sdl_drawString(x +2, y +2, utf8, nact->ags.text_decoration_color);
gfx_drawString(x -1, y , utf8, nact->ags.text_decoration_color);
gfx_drawString(x +1, y , utf8, nact->ags.text_decoration_color);
gfx_drawString(x , y -1, utf8, nact->ags.text_decoration_color);
gfx_drawString(x , y +1, utf8, nact->ags.text_decoration_color);
gfx_drawString(x +2, y +2, utf8, nact->ags.text_decoration_color);
adj.x = -1; adj.y = -1; adj.w = 3; adj.h = 3;
break;
}
SDL_Rect r = sdl_drawString(x, y, utf8, col);
SDL_Rect r = gfx_drawString(x, y, utf8, col);
if (rect_out) {
rect_out->x = r.x + adj.x;
rect_out->y = r.y + adj.y;
@@ -461,13 +471,13 @@ SDL_Surface *ags_drawStringToSurface(const char *str, int r, int g, int b) {
void ags_drawCg(cgdata *cg, int x, int y, int brightness, int sprite_color, bool alpha_blend) {
switch (cg->depth) {
case 8:
sdl_drawImage8(cg, x, y, sprite_color);
gfx_drawImage8(cg, x, y, sprite_color);
break;
case 16:
sdl_drawImage16(cg, nact->ags.dib, x, y, brightness, alpha_blend);
gfx_drawImage16(cg, nact->ags.dib, x, y, brightness, alpha_blend);
break;
case 24:
sdl_drawImage24(cg, nact->ags.dib, x, y, brightness);
gfx_drawImage24(cg, nact->ags.dib, x, y, brightness);
break;
}
}
@@ -478,7 +488,7 @@ void ags_copyArea_shadow(int sx, int sy, int w, int h, int dx, int dy) {
if (!ags_check_param(&sx, &sy, &w, &h)) return;
if (!ags_check_param(&dx, &dy, &w, &h)) return;
sdl_copyAreaSP16_shadow(sx, sy, w, h, dx, dy, 255);
gfx_copyAreaSP16_shadow(sx, sy, w, h, dx, dy, 255);
}
void ags_copyArea_transparent(int sx, int sy, int w, int h, int dx, int dy, int col) {
@@ -487,7 +497,7 @@ void ags_copyArea_transparent(int sx, int sy, int w, int h, int dx, int dy, int
if (!ags_check_param(&sx, &sy, &w, &h)) return;
if (!ags_check_param(&dx, &dy, &w, &h)) return;
sdl_copyAreaSP(sx, sy, w, h, dx, dy, col);
gfx_copyAreaSP(sx, sy, w, h, dx, dy, col);
}
void ags_copyArea_alphaLevel(int sx, int sy, int w, int h, int dx, int dy, int lv) {
@@ -496,7 +506,7 @@ void ags_copyArea_alphaLevel(int sx, int sy, int w, int h, int dx, int dy, int l
if (!ags_check_param(&sx, &sy, &w, &h)) return;
if (!ags_check_param(&dx, &dy, &w, &h)) return;
sdl_copyAreaSP16_alphaLevel(sx, sy, w, h, dx, dy, lv);
gfx_copyAreaSP16_alphaLevel(sx, sy, w, h, dx, dy, lv);
}
void ags_copyArea_alphaBlend(int sx, int sy, int w, int h, int dx, int dy, int lv) {
@@ -505,14 +515,14 @@ void ags_copyArea_alphaBlend(int sx, int sy, int w, int h, int dx, int dy, int l
if (!ags_check_param(&sx, &sy, &w, &h)) return;
if (!ags_check_param(&dx, &dy, &w, &h)) return;
sdl_copyAreaSP16_alphaBlend(sx, sy, w, h, dx, dy, lv);
gfx_copyAreaSP16_alphaBlend(sx, sy, w, h, dx, dy, lv);
}
MyRectangle ags_floodFill(int x, int y, int col) {
SDL_Rect ags_floodFill(int x, int y, int col) {
if (!ags_check_param_xy(&x, &y))
return (MyRectangle){};
return (SDL_Rect){};
return sdl_floodFill(x, y, col);
return gfx_floodFill(x, y, col);
}
void ags_copyFromAlpha(int sx, int sy, int w, int h, int dx, int dy, ALPHA_DIB_COPY_TYPE flg) {
@@ -521,7 +531,7 @@ void ags_copyFromAlpha(int sx, int sy, int w, int h, int dx, int dy, ALPHA_DIB_C
if (!ags_check_param(&sx, &sy, &w, &h)) return;
if (!ags_check_param(&dx, &dy, &w, &h)) return;
sdl_copy_from_alpha(sx, sy, w, h, dx, dy, flg);
gfx_copy_from_alpha(sx, sy, w, h, dx, dy, flg);
}
void ags_copyToAlpha(int sx, int sy, int w, int h, int dx, int dy, ALPHA_DIB_COPY_TYPE flg) {
@@ -530,7 +540,7 @@ void ags_copyToAlpha(int sx, int sy, int w, int h, int dx, int dy, ALPHA_DIB_COP
if (!ags_check_param(&sx, &sy, &w, &h)) return;
if (!ags_check_param(&dx, &dy, &w, &h)) return;
sdl_copy_to_alpha(sx, sy, w, h, dx, dy, flg);
gfx_copy_to_alpha(sx, sy, w, h, dx, dy, flg);
}
void ags_alpha_uppercut(int sx, int sy, int w, int h, int s, int d) {
@@ -592,10 +602,10 @@ void ags_alpha_setPixel(int x, int y, int w, int h, uint8_t *b) {
void ags_runEffect(int duration_ms, bool cancelable, ags_EffectStepFunc step, void *arg) {
unsigned wflags = cancelable ? KEYWAIT_CANCELABLE : KEYWAIT_NONCANCELABLE;
int start = sdl_getTicks();
for (int t = 0; t < duration_ms; t = sdl_getTicks() - start) {
int start = sys_get_ticks();
for (int t = 0; t < duration_ms; t = sys_get_ticks() - start) {
step(arg, (float)t / duration_ms);
int key = sys_keywait(start + t + 16 - sdl_getTicks(), wflags);
int key = sys_keywait(start + t + 16 - sys_get_ticks(), wflags);
if (cancelable && key) {
nact->waitcancel_key = key;
break;
@@ -604,22 +614,22 @@ void ags_runEffect(int duration_ms, bool cancelable, ags_EffectStepFunc step, vo
step(arg, 1.0);
}
static void fade(int duration, bool cancelable, enum sdl_effect_type type) {
static void fade(int duration, bool cancelable, enum effect_type type) {
nact->waitcancel_key = 0;
SDL_Rect rect = {0, 0, nact->ags.view_area.w, nact->ags.view_area.h};
struct sdl_effect *eff = sdl_effect_init(
struct effect *eff = effect_init(
&rect, NULL, 0, 0,
sdl_getDIB(), nact->ags.view_area.x, nact->ags.view_area.y,
gfx_getDIB(), nact->ags.view_area.x, nact->ags.view_area.y,
type);
ags_runEffect(duration, cancelable, (ags_EffectStepFunc)sdl_effect_step, eff);
sdl_effect_finish(eff);
ags_runEffect(duration, cancelable, (ags_EffectStepFunc)effect_step, eff);
effect_finish(eff);
}
void ags_fadeIn(int rate, bool flag) {
fade_outed = false;
if (nact->ags.world_depth == 8)
sdl_setPalette(nact->ags.pal, 0, 256);
gfx_setPalette(nact->ags.pal, 0, 256);
if (!need_update)
return;
@@ -627,7 +637,7 @@ void ags_fadeIn(int rate, bool flag) {
int duration = rate * 16 * 1000 / 60;
fade(duration, flag, nact->ags.world_depth == 8 ? EFFECT_FADEIN : EFFECT_DITHERING_FADEIN);
sdl_updateAll(&nact->ags.view_area);
gfx_updateAll(&nact->ags.view_area);
}
void ags_fadeOut(int rate, bool flag) {
@@ -642,14 +652,14 @@ void ags_fadeOut(int rate, bool flag) {
for (int i = 0; i < 256; i++) {
pal[i] = (SDL_Color){0, 0, 0, 255};
}
sdl_setPalette(pal, 0, 256);
gfx_setPalette(pal, 0, 256);
}
}
void ags_whiteIn(int rate, bool flag) {
fade_outed = false;
if (nact->ags.world_depth == 8)
sdl_setPalette(nact->ags.pal, 0, 256);
gfx_setPalette(nact->ags.pal, 0, 256);
if (!need_update)
return;
@@ -657,7 +667,7 @@ void ags_whiteIn(int rate, bool flag) {
int duration = rate * 16 * 1000 / 60;
fade(duration, flag, nact->ags.world_depth == 8 ? EFFECT_WHITEIN : EFFECT_DITHERING_WHITEIN);
sdl_updateAll(&nact->ags.view_area);
gfx_updateAll(&nact->ags.view_area);
}
void ags_whiteOut(int rate, bool flag) {
@@ -670,7 +680,7 @@ void ags_whiteOut(int rate, bool flag) {
if (nact->ags.world_depth == 8) {
SDL_Color pal[256];
memset(&pal, 255, sizeof(pal));
sdl_setPalette(pal, 0, 256);
gfx_setPalette(pal, 0, 256);
}
}
@@ -692,7 +702,7 @@ void ags_setTextDecorationColor(int col) {
void ags_setCursorType(int type) {
if (nact->ags.noimagecursor && type >= 100) return;
sdl_setCursorType(type);
cursor_set_type(type);
}
void ags_loadCursor(int p1,int p2) {
@@ -715,26 +725,26 @@ void ags_setCursorLocation(int x, int y, bool is_dibgeo, bool for_selection) {
// We can't move the actual cursor in the browser, but can change the
// internal mouse coordinates. This can help with keyboard/gamepad
// navigation.
sdl_setCursorInternalLocation(x, y);
event_set_mouse_internal_location(x, y);
EM_ASM({ xsystem35.shell.showMouseMoveEffect($0, $1); }, x, y);
sdl_sleep(cursor_move_time);
sys_sleep(cursor_move_time);
}
#else
if (nact->ags.mouse_warp_enabled) {
MyPoint p;
SDL_Point p;
sys_getMouseInfo(&p, is_dibgeo);
int dx = x - p.x;
int dy = y - p.y;
for (int i = 1; i < 8; i++) {
int xi = ((dx*i*i*i) >> 9) - ((3*dx*i*i)>> 6) + ((3*dx*i) >> 3) + p.x;
int yi = ((dy*i*i*i) >> 9) - ((3*dy*i*i)>> 6) + ((3*dy*i) >> 3) + p.y;
sdl_setCursorLocation(xi, yi);
sdl_sleep(cursor_move_time / 7);
event_set_mouse_location(xi, yi);
sys_sleep(cursor_move_time / 7);
}
sdl_setCursorLocation(x, y);
event_set_mouse_location(x, y);
} else if (!for_selection) {
sdl_setCursorInternalLocation(x, y);
sdl_sleep(cursor_move_time);
event_set_mouse_internal_location(x, y);
sys_sleep(cursor_move_time);
}
#endif
}
@@ -758,7 +768,7 @@ void ags_copyArea_shadow_withrate(int sx, int sy, int w, int h, int dx, int dy,
if (!ags_check_param(&sx, &sy, &w, &h)) return;
if (!ags_check_param(&dx, &dy, &w, &h)) return;
sdl_copyAreaSP16_shadow(sx, sy, w, h, dx, dy, lv);
gfx_copyAreaSP16_shadow(sx, sy, w, h, dx, dy, lv);
}
void ags_setCursorMoveTime(int msec) {
@@ -774,10 +784,14 @@ surface_t *ags_getDIB() {
}
void ags_autorepeat(bool enable) {
sdl_setAutoRepeat(enable);
if (enable) {
// SDL_EnableKeyRepeat(SDL_DEFAULT_REPEAT_DELAY, SDL_DEFAULT_REPEAT_INTERVAL);
} else {
// SDL_EnableKeyRepeat(0, 0);
}
}
bool ags_clipCopyRect(const MyRectangle *sw, const MyRectangle *dw, int *sx, int *sy, int *dx, int *dy, int *w, int *h) {
bool ags_clipCopyRect(const SDL_Rect *sw, const SDL_Rect *dw, int *sx, int *sy, int *dx, int *dy, int *w, int *h) {
// Clip source rectangle to source window
SDL_Rect sr = {*sx, *sy, *w, *h};
if (!SDL_IntersectRect(&sr, sw, &sr))
+21 -23
View File
@@ -29,22 +29,7 @@
#include <SDL_surface.h>
#include "portab.h"
#include "cg.h"
#include "graphics.h"
/* マウスカーソルの種類 */
#define CURSOR_ARROW 1
#define CURSOR_CROSS 2
#define CURSOR_IBEAM 3
#define CURSOR_ICON 4
#define CURSOR_NO 5
#define CURSOR_SIZE 6
#define CURSOR_SIZEALL 7
#define CURSOR_SIZENESW 8
#define CURSOR_SIZENS 9
#define CURSOR_SIZENWSE 10
#define CURSOR_SIZEWE 11
#define CURSOR_UPARROW 12
#define CURSOR_WAIT 13
#include "font.h"
/* RGB <-> alpha plane copy type */
typedef enum {
@@ -111,13 +96,26 @@ typedef enum {
TEXT_DECORATION_DROP_SHADOW_OUTLINE = 10,
} TextDecorationType;
typedef struct {
uint8_t r, g, b;
uint32_t index;
} PixelColor;
typedef struct {
int width;
int height;
int depth;
} DispInfo;
struct _ags {
SDL_Color pal[256]; /* system palette */
bool pal_changed; /* system palette has changed */
MyDimension world_size; /* size of off-screen */
MyRectangle view_area; /* view region in off-screen */
int world_width;
int world_height;
SDL_Rect view_area; /* view region in off-screen */
int world_depth; /* depth of off-screen (bits per pixel) */
@@ -174,7 +172,7 @@ extern void ags_copyAreaSP(int sx, int sy, int w, int h, int dx, int dy, int col
extern void ags_copyArea_shadow_withrate(int sx, int sy, int w, int h, int dx, int dy, int lv);
extern void ags_wrapColor(int x, int y, int w, int h, int p1, int p2);
extern void ags_getPixel(int x, int y, Palette *cell);
extern void ags_getPixel(int x, int y, PixelColor *cell);
extern void ags_copyPaletteShift(int sx, int sy, int w, int h, int dx, int dy, uint8_t sprite);
extern void ags_changeColorArea(int x, int y, int w, int h, int dst, int src, int cnt);
@@ -183,14 +181,14 @@ extern void ags_restoreRegion(void *region, int x, int y);
extern void ags_putRegion(void *region, int x, int y);
extern void ags_delRegion(void *region);
extern int ags_drawString(int x, int y, const char *src, int col, MyRectangle *rect_out);
extern int ags_drawString(int x, int y, const char *src, int col, SDL_Rect *rect_out);
extern void ags_drawCg(cgdata *cg, int x, int y, int brightness, int sprite_color, bool alpha_blend);
extern void ags_copyArea_shadow(int sx, int sy, int w, int h, int dx, int dy);
extern void ags_copyArea_transparent(int sx, int sy, int w, int h, int dx, int dy, int col);
extern void ags_copyArea_alphaLevel(int sx, int sy, int w, int h, int dx, int dy, int lv);
extern void ags_copyArea_alphaBlend(int sx, int sy, int w, int h, int dx, int dy, int lv);
extern MyRectangle ags_floodFill(int x, int y, int col);
extern SDL_Rect ags_floodFill(int x, int y, int col);
extern void ags_eCopyArea(int sx, int sy, int w, int h, int dx, int dy, int sw, int opt, bool cancel);
extern void ags_eSpriteCopyArea(int sx, int sy, int w, int h, int dx, int dy, int sw, int opt, bool cancel, int spCol);
@@ -228,7 +226,7 @@ extern int ags_getCursorMoveTime();
extern void ags_setAntialiasedStringMode(bool mode);
extern bool ags_getAntialiasedStringMode();
extern void ags_autorepeat(bool enable);
extern bool ags_clipCopyRect(const MyRectangle *sr, const MyRectangle *dr, int *sx, int *sy, int *dx, int *dy, int *w, int *h);
extern bool ags_clipCopyRect(const SDL_Rect *sr, const SDL_Rect *dr, int *sx, int *sy, int *dx, int *dy, int *w, int *h);
typedef void (*ags_EffectStepFunc)(void *, float);
void ags_runEffect(int duration_ms, bool cancelable, ags_EffectStepFunc step, void *arg);
+2 -2
View File
@@ -24,7 +24,7 @@
#include "nact.h"
#include "bgm.h"
#include "bgi.h"
#include "sdl_core.h"
#include "system.h"
bool musbgm_init(DRIFILETYPE type, int base_no) {
if (type == DRIFILE_BGM)
@@ -84,6 +84,6 @@ void musbgm_wait(int no, int timeout) {
for (int i = 0; i * 16 < timeout * 10; i++) {
if (!musbgm_isplaying(no))
break;
sdl_wait_vsync();
sys_wait_vsync();
}
}
-1
View File
@@ -28,7 +28,6 @@
#include <stdlib.h>
#include "portab.h"
#include "LittleEndian.h"
#include "graphics.h"
#include "cg.h"
#include "bmp.h"
+16
View File
@@ -130,3 +130,19 @@ void *cache_foreach(cacher *id, int key) {
}
return NULL;
}
void cache_clear(cacher *id) {
cacheinfo *ic = id->top->next;
cacheinfo *next;
while (ic != NULL) {
next = ic->next;
if (ic->data) {
totalsize -= ic->size;
id->free_(ic->data);
}
free(ic);
ic = next;
}
id->top->next = NULL;
}
+1
View File
@@ -46,5 +46,6 @@ typedef struct _cacher cacher;
extern cacher *cache_new(void *delcallback);
extern void cache_insert(cacher *id, int key, void *data, int size, int *in_use);
extern void *cache_foreach(cacher *id, int key);
extern void cache_clear(cacher *id);
#endif /* !__CASHE__ */
+5
View File
@@ -63,6 +63,10 @@ static bool cdrom_bgm_getPlayingInfo(cd_time *info) {
return true;
}
static bool cdrom_bgm_is_available(void) {
return true;
}
cdromdevice_t cdrom_bgm = {
.init = cdrom_bgm_init,
.exit = cdrom_bgm_exit,
@@ -70,4 +74,5 @@ cdromdevice_t cdrom_bgm = {
.start = cdrom_bgm_start,
.stop = cdrom_bgm_stop,
.getpos = cdrom_bgm_getPlayingInfo,
.is_available = cdrom_bgm_is_available,
};
+6
View File
@@ -24,6 +24,7 @@
#include "portab.h"
#include "cdrom.h"
#include "scheduler.h"
#include "system.h"
static bool cdrom_init(char *playlist) {
return true;
@@ -61,6 +62,10 @@ static bool cdrom_getPlayingInfo(cd_time *info) {
return true;
}
static bool cdrom_is_available(void) {
return EM_ASM_INT({ return xsystem35.cdPlayer.hasAudioTrack(); });
}
cdromdevice_t cdrom_emscripten = {
.init = cdrom_init,
.exit = cdrom_exit,
@@ -68,4 +73,5 @@ cdromdevice_t cdrom_emscripten = {
.start = cdrom_start,
.stop = cdrom_stop,
.getpos = cdrom_getPlayingInfo,
.is_available = cdrom_is_available,
};
+1
View File
@@ -38,6 +38,7 @@ typedef struct {
bool (*start)(int trk, int loop);
void (*stop)(void);
bool (*getpos)(cd_time *);
bool (*is_available)(void);
} cdromdevice_t;
extern cdromdevice_t cdrom_bgm;
+5
View File
@@ -164,6 +164,10 @@ static bool cdrom_getPlayingInfo (cd_time *inf) {
return true;
}
static bool cdrom_is_available(void) {
return enabled;
}
cdromdevice_t cdrom_mp3 = {
.init = cdrom_init,
.exit = cdrom_exit,
@@ -171,4 +175,5 @@ cdromdevice_t cdrom_mp3 = {
.start = cdrom_start,
.stop = cdrom_stop,
.getpos = cdrom_getPlayingInfo,
.is_available = cdrom_is_available,
};
+171 -30
View File
@@ -21,12 +21,16 @@
*/
/* $Id: cg.c,v 1.12 2001/09/16 15:59:11 chikama Exp $ */
#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <SDL.h>
#ifdef __EMSCRIPTEN__
#include <emscripten.h>
#endif
#include "portab.h"
#include "system.h"
#include "graphics.h"
#include "nact.h"
#include "ags.h"
#include "cg.h"
@@ -42,6 +46,9 @@
#include "filecheck.h"
#include "cache.h"
static int *censor_list; // sorted list of cg numbers
static int censor_list_size;
/* VSPのパレット展開バンク */
int cg_vspPB;
/* cg,palette 展開フラグ (funciotn flag) */
@@ -51,13 +58,15 @@ int *cg_loadCountVar;
/* Brightness (PD command) */
int cg_brightness;
#define MOSAIC_SIZE 16
#define GCMD_EXTRACTCG(c) ((c) & 0x01)
#define GCMD_SET_PALETTE(c) ((c) & 0x02)
#define GCMD_LOAD_PALETTE(c) ((c) & 0x04)
/* CG表示位置に関する情報 */
static CG_WHERETODISP loc_policy, loc_policy0;
static MyPoint loc_where, loc_where0;
static SDL_Point loc_where, loc_where0;
/* extracted cg data cache control object */
static cacher *cacheid;
@@ -65,11 +74,51 @@ static cacher *cacheid;
/* static methods */
static CG_TYPE check_cgformat(uint8_t *data);
static void set_vspbank(uint8_t *pic, int bank, int width, int height);
static MyPoint set_display_loc(cgdata *cg);
static SDL_Point set_display_loc(cgdata *cg);
static void clear_display_loc();
static void display_cg(cgdata *cg, int x, int y, int sprite_color, bool alpha_blend);
static cgdata *loader(int no);
static int compare_integers(const void *a, const void *b) {
int int_a = *(const int *)a;
int int_b = *(const int *)b;
return (int_a > int_b) - (int_a < int_b);
}
static bool is_censored_cg(int no) {
no += 1; // CG numbers are 1-based.
if (!censor_list)
return false;
return bsearch(&no, censor_list, censor_list_size, sizeof(int), compare_integers) != NULL;
}
static void cg_mosaic(cgdata *cg) {
Uint32 format;
switch (cg->depth) {
case 8:
format = SDL_PIXELFORMAT_INDEX8;
break;
case 16:
format = SDL_PIXELFORMAT_RGB565;
break;
case 24:
format = SDL_PIXELFORMAT_RGB24;
break;
default:
SYSERROR("Unsupported cg depth %d", cg->depth);
}
SDL_Surface *sf = SDL_CreateRGBSurfaceWithFormatFrom(
cg->pic, cg->width, cg->height, cg->depth, cg->width * (cg->depth / 8), format);
SDL_Surface *tmp = SDL_CreateRGBSurfaceWithFormat(
0, (cg->width + MOSAIC_SIZE - 1) / MOSAIC_SIZE, (cg->height + MOSAIC_SIZE - 1) / MOSAIC_SIZE, cg->depth, format);
if (sf->format->palette)
SDL_SetSurfacePalette(tmp, sf->format->palette);
// NOTE: SDL_BlitScaled() does not support 8-bit surfaces.
SDL_SoftStretch(sf, NULL, tmp, NULL);
SDL_SoftStretch(tmp, NULL, sf, NULL);
SDL_FreeSurface(tmp);
SDL_FreeSurface(sf);
}
/*
* Identify cg format
@@ -131,8 +180,8 @@ void cgdata_free(cgdata *cg) {
* cg: cg information
* return: x and y for display location
*/
static MyPoint set_display_loc(cgdata *cg) {
MyPoint p;
static SDL_Point set_display_loc(cgdata *cg) {
SDL_Point p;
switch(loc_policy) {
case OFFSET_ABSOLUTE_GC:
@@ -231,8 +280,12 @@ static cgdata *loader(int no) {
default:
break;
}
/* insert to cache */
if (cg) {
if (is_censored_cg(no)) {
cg_mosaic(cg);
}
/* insert to cache */
int size = cg->width * cg->height * (cg->depth / 8);
cache_insert(cacheid, no, cg, size, NULL);
}
@@ -288,7 +341,7 @@ void cg_set_display_location(int x, int y, CG_WHERETODISP policy) {
*/
void cg_load(int no, int flg) {
cgdata *cg;
MyPoint p;
SDL_Point p;
int i, bank = cg_vspPB;
/* load and extract cg */
@@ -361,7 +414,7 @@ void cg_load(int no, int flg) {
*/
void cg_load_with_alpha(int cgno, int shadowno) {
cgdata *cg = NULL, *scg;
MyPoint p;
SDL_Point p;
/* load pixel */
if (cgno >= 0) {
@@ -441,7 +494,7 @@ int cg_load_with_filename(char *fname_utf8, int x, int y) {
long filesize;
uint8_t *data;
cgdata *cg = NULL;
MyPoint p;
SDL_Point p;
data = load_cg_from_file(fname_utf8, &status, &filesize);
if (data == NULL) return status;
@@ -490,9 +543,9 @@ int cg_load_with_filename(char *fname_utf8, int x, int y) {
* no : file no for cg ( >= 0 )
* info: information to be retored
*/
void cg_get_info(int no, MyRectangle *info) {
void cg_get_info(int no, SDL_Rect *info) {
cgdata *cg = loader(no);
MyPoint p;
SDL_Point p;
if (cg == NULL) {
info->x = info->y = info->w = info->h = 0;
@@ -509,42 +562,67 @@ void cg_clear_display_loc() {
clear_display_loc();
}
SDL_Surface *cg_load_as_sdlsurface(int no) {
dridata *dfile = ald_getdata(DRIFILE_CG, no);
if (!dfile) return NULL;
SDL_Surface *cg_load_as_sdlsurface_from_data(uint8_t *data, size_t size, bool mosaic, bool as_alpha) {
CG_TYPE type = check_cgformat(dfile->data);
CG_TYPE type = check_cgformat(data);
#ifdef HAVE_WEBP
if (type == ALCG_WEBP) {
SDL_Surface *sf = webp_extract(dfile->data, dfile->size);
ald_freedata(dfile);
return sf;
}
if (type == ALCG_WEBP)
return webp_extract(data, size);
#endif
cgdata *cg = NULL;
switch (type) {
case ALCG_PMS8:
cg = pms256_extract(data);
break;
case ALCG_PMS16:
cg = pms64k_extract(dfile->data);
cg = pms64k_extract(data);
break;
case ALCG_QNT:
cg = qnt_extract(dfile->data);
cg = qnt_extract(data);
break;
case ALCG_BMP24:
cg = bmp16m_extract(data);
break;
default:
WARNING("Invalid CG type");
break;
}
ald_freedata(dfile);
if (!cg) return NULL;
SDL_Surface *pic = type == ALCG_PMS16
? SDL_CreateRGBSurfaceWithFormatFrom(cg->pic, cg->width, cg->height, 16, cg->width * 2, SDL_PIXELFORMAT_RGB565)
: SDL_CreateRGBSurfaceWithFormatFrom(cg->pic, cg->width, cg->height, 24, cg->width * 3, SDL_PIXELFORMAT_RGB24);
if (mosaic) {
cg_mosaic(cg);
}
SDL_Surface *sf = SDL_CreateRGBSurfaceWithFormat(0, cg->width, cg->height, 32,
cg->alpha ? SDL_PIXELFORMAT_ARGB8888 : SDL_PIXELFORMAT_XRGB8888);
SDL_BlitSurface(pic, NULL, sf, NULL);
(cg->alpha || (type == ALCG_PMS8 && as_alpha)) ? SDL_PIXELFORMAT_ARGB8888 : SDL_PIXELFORMAT_XRGB8888);
if (type == ALCG_PMS8) {
if (as_alpha) {
// Treat PMS8 as an alpha map. Palette is ignored.
SDL_FillRect(sf, NULL, SDL_MapRGBA(sf->format, 255, 255, 255, 0));
cg->alpha = cg->pic;
cg->pic = NULL;
} else {
// Treat PMS8 as a paletted image.
SDL_Surface *pic = SDL_CreateRGBSurfaceWithFormatFrom(cg->pic, cg->width, cg->height, 8, cg->width, SDL_PIXELFORMAT_INDEX8);
SDL_Palette *palette = SDL_AllocPalette(256);
SDL_SetPaletteColors(palette, cg->pal, 0, 256);
SDL_SetSurfacePalette(pic, palette);
SDL_FreePalette(palette);
SDL_BlitSurface(pic, NULL, sf, NULL);
SDL_FreeSurface(pic);
}
} else {
SDL_Surface *pic;
if (type == ALCG_PMS16 || type == ALCG_BMP24) {
pic = SDL_CreateRGBSurfaceWithFormatFrom(cg->pic, cg->width, cg->height, 16, cg->width * 2, SDL_PIXELFORMAT_RGB565);
} else {
pic = SDL_CreateRGBSurfaceWithFormatFrom(cg->pic, cg->width, cg->height, 24, cg->width * 3, SDL_PIXELFORMAT_RGB24);
}
SDL_BlitSurface(pic, NULL, sf, NULL);
SDL_FreeSurface(pic);
}
if (cg->alpha) {
// Copy alpha values from cg->alpha to sf->pixels.
uint8_t *p_ds = ALPHA_AT(sf, 0, 0);
@@ -558,8 +636,71 @@ SDL_Surface *cg_load_as_sdlsurface(int no) {
p_ds += sf->pitch;
}
}
SDL_FreeSurface(pic);
cgdata_free(cg);
return sf;
}
SDL_Surface *cg_load_as_sdlsurface(int no) {
dridata *dfile = ald_getdata(DRIFILE_CG, no);
if (!dfile) return NULL;
SDL_Surface *sf = cg_load_as_sdlsurface_from_data(dfile->data, dfile->size, is_censored_cg(no), false);
ald_freedata(dfile);
return sf;
}
EMSCRIPTEN_KEEPALIVE
void load_censor_list(const char *path) {
if (cacheid)
cache_clear(cacheid);
if (censor_list) {
free(censor_list);
censor_list = NULL;
censor_list_size = 0;
}
if (!path || !*path)
return;
FILE *fp = fopen(path, "r");
if (!fp) {
SYSERROR("failed to open censor list file %s", path);
return;
}
char line[256];
int count = 0, cap = 256;
censor_list = malloc(cap * sizeof(int));
int line_no = 0;
while (fgets(line, sizeof(line), fp)) {
line_no++;
char *p = line;
char *comment = strchr(p, '#');
if (comment)
*comment = '\0';
while (*p && isspace((unsigned char)*p))
p++;
if (*p == '\0')
continue;
if (count >= cap) {
cap *= 2;
censor_list = realloc(censor_list, cap * sizeof(int));
}
char *endptr;
censor_list[count++] = (int)strtol(p, &endptr, 10);
while (*endptr && isspace((unsigned char)*endptr))
endptr++;
if (*endptr != '\0')
WARNING("invalid line %d in %s", line_no, path);
}
censor_list_size = count;
fclose(fp);
if (censor_list_size > 0) {
qsort(censor_list, censor_list_size, sizeof(int), compare_integers);
} else {
free(censor_list);
censor_list = NULL;
}
}
+4 -2
View File
@@ -24,8 +24,8 @@
#ifndef __CG__
#define __CG__
#include <SDL_rect.h>
#include "portab.h"
#include "graphics.h"
struct SDL_Surface;
@@ -80,10 +80,12 @@ extern void cg_set_display_location(int x, int y, CG_WHERETODISP policy);
extern void cg_load(int no, int flg);
extern void cg_load_with_alpha(int cgno, int shadowno);
extern int cg_load_with_filename(char *fname_utf8, int x, int y);
extern void cg_get_info(int no, MyRectangle *info);
extern void cg_get_info(int no, SDL_Rect *info);
extern void cg_clear_display_loc();
extern void cgdata_free(cgdata *cg);
extern struct SDL_Surface *cg_load_as_sdlsurface(int no);
struct SDL_Surface *cg_load_as_sdlsurface_from_data(uint8_t *data, size_t size, bool mosaic, bool as_alpha);
extern void load_censor_list(const char *path);
extern int cg_vspPB;
extern int cg_fflg;
+8 -293
View File
@@ -24,7 +24,6 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include "portab.h"
#include "xsystem35.h"
#include "scenario.h"
@@ -33,16 +32,15 @@
#include "input.h"
#include "msgskip.h"
#include "selection.h"
#include "message.h"
#include "music.h"
#include "utfsjis.h"
#include "hankaku.h"
#include "ags.h"
#include "sdl_core.h"
#include "gfx.h"
#include "ald_manager.h"
#include "LittleEndian.h"
#include "hacks.h"
#include "filecheck.h"
#include "cmd_check.h"
/* 選択 Window OPEN 時 callback */
static int cb_sel_init_page = 0;
@@ -52,11 +50,6 @@ static const char REGREADSTRING_RESULT[] = "*regReadString*";
static SDL_Rect clip_window;
extern INPUTSTRING_PARAM mi_param;
extern void commandH();
extern void commandHH();
typedef struct {
int page;
int index;
@@ -65,72 +58,6 @@ typedef struct {
#define FCTBL_MAX 1024
static fncall_table fnctbl[FCTBL_MAX];
void commands2F00() {
/* テキストカラーをスタックからポップして設定する */
sl_popState(STACK_TEXTCOLOR);
TRACE("TOC:");
}
void commands2F01() {
/* テキストフォントサイズをスタックからポップして設定する */
sl_popState(STACK_TEXTSIZE);
TRACE("TOS:");
}
void commands2F02() {
/* 現在のテキストカラーをスタックにプッシュする */
int type = getCaliValue();
switch (type) {
case 0: sl_pushTextColor(type, nact->msg.MsgFontColor); break;
case 1: sl_pushTextColor(type, nact->sel.MsgFontColor); break;
default: WARNING("TPC: unknown type %d", type); break;
}
TRACE("TPC %d", exp);
}
void commands2F03() {
/* 現在のテキストフォントサイズをスタックにプッシュする */
int type = getCaliValue();
switch (type) {
case 0: sl_pushTextSize(type, nact->msg.MsgFontSize); break;
case 1: sl_pushTextSize(type, nact->sel.MsgFontSize); break;
default: WARNING("TPS: unknown type %d", type); break;
}
TRACE("TPS %d", exp);
}
void commands2F04() {
/* テキスト表示位置をスタックからポップして設定する */
sl_popState(STACK_TEXTLOC);
TRACE("TOP:");
}
void commands2F05() {
/* 現在のテキスト表示位置をスタックにプッシュする */
MyPoint loc;
msg_getMessageLocation(&loc);
sl_pushTextLoc(loc.x, loc.y);
TRACE("TPP:");
}
void commands2F08() {
/* アンチエイリアシング付きテキスト描画のフラグ設定 */
int exp = getCaliValue();
ags_setAntialiasedStringMode(exp == 1);
TRACE("TAA %d:", exp);
}
void commands2F09() {
/* アンチエイリアシング付きテキスト描画のフラグ取得 */
int *var = getCaliVariable();
*var = ags_getAntialiasedStringMode() ? 1 : 0;
TRACE("TAB %d:", *var);
}
void commands2F0A() {
/* Wavデータを読み込む */
int eCh = getCaliValue();
@@ -331,162 +258,6 @@ void commands2F21() {
sys_addMsg(str);
}
void commands2F23() {
int x = getCaliValue();
int y = getCaliValue();
const char *vFileName = sl_getString(0);
char *fname_utf8 = toUTF8(vFileName);
sysVar[0] = cg_load_with_filename(fname_utf8, x, y);
free(fname_utf8);
TRACE("LC(new) %d, %d, %s:", x, y, vFileName);
}
void commands2F24() {
int type = sl_getc();
const char *file_name = sl_getString(0);
int var, cnt;
struct VarRef vref;
char *fname_utf8 = toUTF8(file_name);
switch (type) {
case 0:
getCaliArray(&vref);
var = vref.var;
cnt = getCaliValue();
sysVar[0] = load_vars_from_file(fname_utf8, &vref, cnt);
break;
case 1:
var = getCaliValue();
cnt = getCaliValue();
sysVar[0] = load_strs_from_file(fname_utf8, var, cnt);
break;
default:
var = getCaliValue();
cnt = getCaliValue();
WARNING("Unknown LE command type %d", type);
break;
}
free(fname_utf8);
TRACE("LE(new) %d, %s, %d, %d:", type, file_name, var, cnt);
}
void commands2F25() {
int file_name = getCaliValue();
const char *title = sl_getString(0);
const char *filter = sl_getString(0);
TRACE_UNIMPLEMENTED("LXG %d, %s, %s:", file_name, title, filter);
}
void commands2F26() {
int dst_no = getCaliValue();
int max_len = getCaliValue();
const char *title = sl_getString(0);
char *t1, *t2, *t3;
t1 = toUTF8(title);
t2 = toUTF8(svar_get(dst_no));
mi_param.title = t1;
mi_param.oldstring = t2;
mi_param.max = max_len;
menu_inputstring(&mi_param);
if (mi_param.newstring == NULL) {
svar_set(dst_no, NULL);
free(t1); free(t2);
return;
}
t3 = fromUTF8(mi_param.newstring);
svar_set(dst_no, t3);
free(t1);
free(t2);
free(t3);
TRACE("MI(new) %d, %d, %s:", dst_no, max_len, title);
}
void commands2F27() {
int num = getCaliValue();
const char *string = sl_getString(0);
svar_set(num, string);
TRACE("MS(new) %d, %s:", num, string);
}
void commands2F28() {
const char *title = sl_getString(0);
if (nact->game_title_utf8)
free(nact->game_title_utf8);
nact->game_title_utf8 = toUTF8(title);
ags_setWindowTitle(nact->game_title_utf8);
enable_hack_by_title(nact->game_title_utf8);
TRACE("MT(new) %s:",title);
}
/* defined in cmdn.c */
extern INPUTNUM_PARAM ni_param;
void commands2F29() {
const char *title = sl_getString(0);
char *t;
if (ni_param.title != NULL) {
free(ni_param.title);
}
t = toUTF8(title);
ni_param.title = t;
TRACE("NT(new) %s:", title);
}
void commands2F2A() {
int type = sl_getc();
const char *file_name = sl_getString(0);
int var, cnt;
struct VarRef vref;
char *fname_utf8 = toUTF8(file_name);
switch(type) {
case 0:
getCaliArray(&vref);
var = vref.var;
cnt = getCaliValue();
sysVar[0] = save_vars_to_file(fname_utf8, &vref, cnt);
break;
case 1:
var = getCaliValue();
cnt = getCaliValue();
sysVar[0] = save_strs_to_file(fname_utf8, var, cnt);
break;
default:
var = getCaliValue();
cnt = getCaliValue();
WARNING("Unknown QE command");
break;
}
free(fname_utf8);
TRACE("QE(new) %d, %s, %d, %d:", type, file_name, var, cnt);
}
void commands2F2B() {
int type = sl_getc();
const char *work_dir = sl_getString(0);
const char *file_name = sl_getString(0);
TRACE_UNIMPLEMENTED("UP(new) %d, %s, %s:", type, work_dir, file_name);
}
void commands2F2D() {
int eCh = getCaliValue();
int eTime = getCaliValue();
@@ -706,23 +477,12 @@ void commands2F43() {
int eLength = getCaliValue();
int eColor = getCaliValue();
sdl_fillCircle(eX, eY, eLength, eColor);
gfx_fillCircle(eX, eY, eLength, eColor);
ags_updateArea(eX, eY, eLength, eLength);
TRACE("grDrawFillCircle %d, %d, %d, %d:", eX, eY, eLength, eColor);
}
void commands2F44() {
int num1 = getCaliValue();
int fig = getCaliValue();
int num2 = getCaliValue();
char buf[256];
svar_set(num1, format_number(num2, fig, buf));
TRACE("MHH %d, %d, %d:", num1, fig, num2);
}
void commands2F45() {
int fPage = sl_getw();
int fIndex = sl_getaddr();
@@ -781,52 +541,15 @@ void commands2F4C() {
int eWidth = getCaliValue();
int eHeight = getCaliValue();
MyRectangle r = {eSrcX, eSrcY, eWidth, eHeight};
MyPoint p = {eX, eY};
SDL_Rect r = {eSrcX, eSrcY, eWidth, eHeight};
SDL_Point p = {eX, eY};
sdl_updateArea(&r, &p);
gfx_updateArea(&r, &p);
TRACE("grBlt %d, %d, %d, %d, %d, %d:",
eX, eY, eSrcX, eSrcY, eWidth, eHeight);
}
void commands2F4D() {
int eNum = getCaliValue();
const char *sText = sl_getString(0);
TRACE_UNIMPLEMENTED("LXWT %d, %s:", eNum, sText);
}
void commands2F4E() {
int eNum = getCaliValue();
int eTextNum = getCaliValue();
TRACE_UNIMPLEMENTED("LXWS %d, %d:", eNum, eTextNum);
}
void commands2F4F() {
int eNum = getCaliValue();
int eType = getCaliValue();
TRACE_UNIMPLEMENTED("LXWE %d, %d:", eNum, eType);
}
void commands2F50() {
int eFile = getCaliValue();
int nFlg = sl_getc();
int eNum = getCaliValue();
TRACE_UNIMPLEMENTED("LXWH %d, %d, %d:", eFile, nFlg, eNum);
}
void commands2F51() {
int eFile = getCaliValue();
int nFlg = sl_getc();
int eNum = getCaliValue();
TRACE_UNIMPLEMENTED("LXWHH %d, %d, %d:", eFile, nFlg, eNum);
}
void commands2F52() {
int eNum = getCaliValue();
if (eNum <= 0) return;
@@ -882,14 +605,6 @@ void commands2F55() {
}
}
void commands2F56() {
int file_name = getCaliValue();
const char *title = sl_getString(0);
const char *folder = sl_getString(0);
TRACE_UNIMPLEMENTED("LXF %d, %s, %s:", file_name, title, folder);
}
void commands2F57() {
const char *sTitle = sl_getString(0);
int eStrVar = getCaliValue();
@@ -943,7 +658,7 @@ void commands2F5A() {
char *t1;
t1 = toUTF8(sText);
sdl_showMessageBox(MESSAGEBOX_INFO, nact->game_title_utf8, t1);
sys_show_message_box(MESSAGEBOX_INFO, nact->game_title_utf8, t1);
free(t1);
TRACE("strMessageBox %s:", sText);
@@ -954,7 +669,7 @@ void commands2F5B() {
char *t1;
t1 = toUTF8(svar_get(eNum));
sdl_showMessageBox(MESSAGEBOX_INFO, nact->game_title_utf8, t1);
sys_show_message_box(MESSAGEBOX_INFO, nact->game_title_utf8, t1);
free(t1);
TRACE("strMessageBoxStr %d:", eNum);
+34 -34
View File
@@ -32,7 +32,7 @@
#include "selection.h"
#include "message.h"
#include "input.h"
#include "sdl_core.h"
#include "gfx.h"
static void undeferr();
@@ -181,7 +181,7 @@ void exec_command(void) {
int c0 = sl_getc();
if (c0 == BREAKPOINT) {
sdl_updateScreen();
gfx_updateScreen();
c0 = dbg_handle_breakpoint(sl_getPage(), sl_getIndex() - 1);
}
@@ -249,25 +249,25 @@ void exec_command(void) {
/* 小文字コマンド */
switch(sl_getc()) {
case 0x00:
commands2F00(); break;
commandTOC(); break;
case 0x01:
commands2F01(); break;
commandTOS(); break;
case 0x02:
commands2F02(); break;
commandTPC(); break;
case 0x03:
commands2F03(); break;
commandTPS(); break;
case 0x04:
commands2F04(); break;
commandTOP(); break;
case 0x05:
commands2F05(); break;
commandTPP(); break;
case 0x06:
commandsINC(); break;
case 0x07:
commandsDEC(); break;
case 0x08:
commands2F08(); break;
commandTAA(); break;
case 0x09:
commands2F09(); break;
commandTAB(); break;
case 0x0a:
commands2F0A(); break;
case 0x0b:
@@ -319,23 +319,23 @@ void exec_command(void) {
case 0x22:
commandHH(); break;
case 0x23:
commands2F23(); break;
commandLC(0); break;
case 0x24:
commands2F24(); break;
commandLE(0); break;
case 0x25:
commands2F25(); break;
commandLXG(0); break;
case 0x26:
commands2F26(); break;
commandMI(0); break;
case 0x27:
commands2F27(); break;
commandMS(0); break;
case 0x28:
commands2F28(); break;
commandMT(0); break;
case 0x29:
commands2F29(); break;
commandNT(0); break;
case 0x2a:
commands2F2A(); break;
commandQE(0); break;
case 0x2b:
commands2F2B(); break;
commandUP(); break;
case 0x2c:
commandF(); break;
case 0x2d:
@@ -385,7 +385,7 @@ void exec_command(void) {
case 0x43:
commands2F43(); break;
case 0x44:
commands2F44(); break;
commandMHH(); break;
case 0x45:
commands2F45(); break;
case 0x46:
@@ -403,15 +403,15 @@ void exec_command(void) {
case 0x4c:
commands2F4C(); break;
case 0x4d:
commands2F4D(); break;
commandLXWT(); break;
case 0x4e:
commands2F4E(); break;
commandLXWS(); break;
case 0x4f:
commands2F4F(); break;
commandLXWE(); break;
case 0x50:
commands2F50(); break;
commandLXWH(); break;
case 0x51:
commands2F51(); break;
commandLXWHH(); break;
case 0x52:
commands2F52(); break;
case 0x53:
@@ -421,7 +421,7 @@ void exec_command(void) {
case 0x55:
commands2F55(); break;
case 0x56:
commands2F56(); break;
commandLXF(); break;
case 0x57:
commands2F57(); break;
case 0x58:
@@ -731,7 +731,7 @@ void exec_command(void) {
case 'L':
switch(sl_getc()) {
case 'C':
commandLC(); break;
commandLC(':'); break;
case 'D':
commandLD(); break;
case 'P':
@@ -739,7 +739,7 @@ void exec_command(void) {
case 'T':
commandLT(); break;
case 'E':
commandLE(); break;
commandLE(':'); break;
case 'L':
commandLL(); break;
case 'H':
@@ -761,7 +761,7 @@ void exec_command(void) {
case 'X':
switch(sl_getc()) {
case 'G':
commandLXG(); break;
commandLXG(':'); break;
case 'O':
commandLXO(); break;
case 'C':
@@ -803,7 +803,7 @@ void exec_command(void) {
case 'H':
commandMH(); break;
case 'I':
commandMI(); break;
commandMI(':'); break;
case 'J':
commandMJ(); break;
case 'L':
@@ -815,9 +815,9 @@ void exec_command(void) {
case 'P':
commandMP(); break;
case 'S':
commandMS(); break;
commandMS(':'); break;
case 'T':
commandMT(); break;
commandMT(':'); break;
case 'V':
commandMV(); break;
case 'Z':
@@ -871,7 +871,7 @@ void exec_command(void) {
case 'O':
commandNO(); break;
case 'T':
commandNT(); break;
commandNT(':'); break;
case 'D':
switch(sl_getc()) {
case 'C':
@@ -943,7 +943,7 @@ void exec_command(void) {
case 'D':
commandQD(); break;
case 'E':
commandQE(); break;
commandQE(':'); break;
case 'P':
commandQP(); break;
default:
+24 -32
View File
@@ -116,9 +116,9 @@ extern void commandKR();
extern void commandKW();
/* defined by cmdl.c */
extern void commandLC();
extern void commandLC(char terminator);
extern void commandLD();
extern void commandLE();
extern void commandLE(char terminator);
extern void commandLHD();
extern void commandLHG();
extern void commandLHM();
@@ -127,7 +127,7 @@ extern void commandLHW();
extern void commandLL();
extern void commandLP();
extern void commandLT();
extern void commandLXG();
extern void commandLXG(char terminator);
extern void commandLXO();
extern void commandLXC();
extern void commandLXL();
@@ -136,6 +136,12 @@ extern void commandLXP();
extern void commandLXR();
extern void commandLXW();
extern void commandLXX();
extern void commandLXWT();
extern void commandLXWS();
extern void commandLXWE();
extern void commandLXWH();
extern void commandLXWHH();
extern void commandLXF();
/* defined by cmdm.c */
extern void commandMA();
@@ -145,14 +151,15 @@ extern void commandME();
extern void commandMF();
extern void commandMG();
extern void commandMH();
extern void commandMI();
extern void commandMHH();
extern void commandMI(char terminator);
extern void commandMJ();
extern void commandML();
extern void commandMM();
extern void commandMN();
extern void commandMP();
extern void commandMS();
extern void commandMT();
extern void commandMS(char terminator);
extern void commandMT(char terminator);
extern void commandMV();
extern void commandMZ0();
@@ -175,7 +182,7 @@ extern void commandNI();
extern void commandNP();
extern void commandNR();
extern void commandNO();
extern void commandNT();
extern void commandNT(char terminator);
extern void commandND_ADD();
extern void commandND_SUB();
extern void commandND_MUL();
@@ -205,7 +212,7 @@ extern void commandPW();
/* defined by cmdq.c */
extern void commandQC();
extern void commandQD();
extern void commandQE();
extern void commandQE(char terminator);
extern void commandQP();
/* defined by cmds.c */
@@ -227,6 +234,14 @@ extern void commandSI();
/* defined by cmdt.c */
extern void commandT();
extern void commandTOC();
extern void commandTOS();
extern void commandTPC();
extern void commandTPS();
extern void commandTOP();
extern void commandTPP();
extern void commandTAA();
extern void commandTAB();
/* defined by cmdu.c */
extern void commandUC();
@@ -237,6 +252,7 @@ extern void commandUG();
extern void commandUP0();
extern void commandUP1();
extern void commandUP3();
extern void commandUP();
/* defined by cmdv.c */
extern void commandVC();
@@ -308,14 +324,6 @@ extern void commandZR();
extern void commandZU();
/* define in cmd2F.c */
extern void commands2F00();
extern void commands2F01();
extern void commands2F02();
extern void commands2F03();
extern void commands2F04();
extern void commands2F05();
extern void commands2F08();
extern void commands2F09();
extern void commands2F0A();
extern void commands2F0B();
extern void commands2F0C();
@@ -340,15 +348,6 @@ extern void commands2F1E();
extern void commands2F1F();
extern void commands2F20();
extern void commands2F21();
extern void commands2F23();
extern void commands2F24();
extern void commands2F25();
extern void commands2F26();
extern void commands2F27();
extern void commands2F28();
extern void commands2F29();
extern void commands2F2A();
extern void commands2F2B();
extern void commands2F2D();
extern void commands2F2E();
extern void commands2F2F();
@@ -372,7 +371,6 @@ extern void commands2F40();
extern void commands2F41();
extern void commands2F42();
extern void commands2F43();
extern void commands2F44();
extern void commands2F45();
extern void commands2F46();
extern void commands2F47();
@@ -381,16 +379,10 @@ extern void commands2F49();
extern void commands2F4A();
extern void commands2F4B();
extern void commands2F4C();
extern void commands2F4D();
extern void commands2F4E();
extern void commands2F4F();
extern void commands2F50();
extern void commands2F51();
extern void commands2F52();
extern void commands2F53();
extern void commands2F54();
extern void commands2F55();
extern void commands2F56();
extern void commands2F57();
extern void commands2F58();
extern void commands2F59();
+1 -1
View File
@@ -134,7 +134,7 @@ void commandB4() {
}
void commandB10() {
MyPoint p;
SDL_Point p;
int *x_var = getCaliVariable();
int *y_var = getCaliVariable();
+1 -1
View File
@@ -265,7 +265,7 @@ void commandCP() {
int y = getCaliValue();
int color = getCaliValue();
MyRectangle rec = ags_floodFill(x, y, color);
SDL_Rect rec = ags_floodFill(x, y, color);
if (!SDL_RectEmpty(&rec))
ags_updateArea(rec.x, rec.y, rec.w, rec.h);
+6 -7
View File
@@ -26,10 +26,9 @@
#include "xsystem35.h"
#include "scenario.h"
#include "ags.h"
#include "graphics.h"
typedef struct {
MyRectangle r;
SDL_Rect r;
int pal;
} Ecomtbl;
@@ -55,7 +54,7 @@ void commandES() {
void commandEC() {
int num = getCaliValue();
Ecomtbl *e;
MyRectangle *r;
SDL_Rect *r;
if (num == 0) {
r = &nact->ags.view_area;
@@ -91,8 +90,8 @@ void commandEM() {
int x = getCaliValue();
int y = getCaliValue();
MyPoint p = {x, y};
MyRectangle r = tbl[num - 1].r;
SDL_Point p = {x, y};
SDL_Rect r = tbl[num - 1].r;
if (nact->patch_emen == 0) {
r.w -= 1;
r.h -= 1;
@@ -108,11 +107,11 @@ void commandEN() {
int x = getCaliValue();
int y = getCaliValue();
MyPoint p = {x, y};
SDL_Point p = {x, y};
*var = 0;
for (int i = min; i <= max; i++) {
MyRectangle r = tbl[i - 1].r;
SDL_Rect r = tbl[i - 1].r;
if (nact->patch_emen == 0) {
r.w -= 1;
r.h -= 1;
+1 -1
View File
@@ -57,7 +57,7 @@ void commandG1() {
void commandGS() {
/* num 番にリンクされているCGの座標とサイズを取得する */
MyRectangle r;
SDL_Rect r;
int num = getCaliValue();
int *var = getCaliVariable();
+1 -2
View File
@@ -28,7 +28,6 @@
#include "xsystem35.h"
#include "scenario.h"
#include "ags.h"
#include "sdl_core.h"
#include "input.h"
#include "msgskip.h"
@@ -102,7 +101,7 @@ void commandIM() {
/* マウスカーソルの座標取得 */
int *x_var = getCaliVariable();
int *y_var = getCaliVariable();
MyPoint p;
SDL_Point p;
sysVar[0] = sys_getMouseInfo(&p, false);
*x_var = p.x;
+72 -10
View File
@@ -36,6 +36,7 @@
#include "savedata.h"
#include "utfsjis.h"
#include "cg.h"
#include "cmd_check.h"
void commandLD() {
/* 変数領域などのデータをロードする。(全ロード)*/
@@ -106,24 +107,38 @@ void commandLT() {
TRACE("LT %d,%p",num, var);
}
void commandLE() {
void commandLE(char terminator) {
int type = sl_getc();
const char *filename = sl_getString(':');
const char *filename = sl_getString(terminator);
char *fname_utf8 = toUTF8(filename);
char *fallback_fname = NULL;
if (strchr(fname_utf8, '\\')) {
fallback_fname = strdup(fname_utf8);
for (char *p = fname_utf8; *p; p++) {
if (*p == '\\')
*p = '/';
}
}
int var, cnt;
struct VarRef vref;
char *fname_utf8 = toUTF8(filename);
switch (type) {
case 0:
getCaliArray(&vref);
var = vref.var;
cnt = getCaliValue();
sysVar[0] = load_vars_from_file(fname_utf8, &vref, cnt);
// For compatibility; the QE command in v2.16.1 and earlier did not
// convert backslashes to slashes.
if (sysVar[0] == SAVE_LOADERR && fallback_fname)
sysVar[0] = load_vars_from_file(fallback_fname, &vref, cnt);
break;
case 1:
var = getCaliValue();
cnt = getCaliValue();
sysVar[0] = load_strs_from_file(fname_utf8, var, cnt);
if (sysVar[0] == SAVE_LOADERR && fallback_fname)
sysVar[0] = load_strs_from_file(fallback_fname, var, cnt);
break;
default:
var = getCaliValue();
@@ -131,6 +146,8 @@ void commandLE() {
WARNING("Unknown LE command %d", type);
break;
}
if (fallback_fname)
free(fallback_fname);
free(fname_utf8);
TRACE("LE %d,%s,%d,%d:",type, filename, var, cnt);
@@ -254,11 +271,11 @@ void commandLHW() {
TRACE("LHW %d,%d:",p1,no);
}
void commandLC() {
void commandLC(char terminator) {
int x = getCaliValue();
int y = getCaliValue();
const char *filename = sl_getString(':');
const char *filename = sl_getString(terminator);
char *fname_utf8 = toUTF8(filename);
sysVar[0] = cg_load_with_filename(fname_utf8, x, y);
free(fname_utf8);
@@ -266,11 +283,11 @@ void commandLC() {
TRACE("LC %d,%d,%s:", x, y, filename);
}
void commandLXG() {
void commandLXG(char terminator) {
/* ファイルを選択する */
int file_name = getCaliValue();
const char *title = sl_getString(':');
const char *filter = sl_getString(':');
const char *title = sl_getString(terminator);
const char *filter = sl_getString(terminator);
TRACE_UNIMPLEMENTED("LXG %d,%s,%s:", file_name, title, filter);
}
@@ -376,3 +393,48 @@ void commandLXX() {
TRACE("LXX %d,%d,%d:", type, num, *var);
}
void commandLXWT() {
int eNum = getCaliValue();
const char *sText = sl_getString(0);
TRACE_UNIMPLEMENTED("LXWT %d, %s:", eNum, sText);
}
void commandLXWS() {
int eNum = getCaliValue();
int eTextNum = getCaliValue();
TRACE_UNIMPLEMENTED("LXWS %d, %d:", eNum, eTextNum);
}
void commandLXWE() {
int eNum = getCaliValue();
int eType = getCaliValue();
TRACE_UNIMPLEMENTED("LXWE %d, %d:", eNum, eType);
}
void commandLXWH() {
int eFile = getCaliValue();
int nFlg = sl_getc();
int eNum = getCaliValue();
TRACE_UNIMPLEMENTED("LXWH %d, %d, %d:", eFile, nFlg, eNum);
}
void commandLXWHH() {
int eFile = getCaliValue();
int nFlg = sl_getc();
int eNum = getCaliValue();
TRACE_UNIMPLEMENTED("LXWHH %d, %d, %d:", eFile, nFlg, eNum);
}
void commandLXF() {
int file_name = getCaliValue();
const char *title = sl_getString(0);
const char *folder = sl_getString(0);
TRACE_UNIMPLEMENTED("LXF %d, %s, %s:", file_name, title, folder);
}

Some files were not shown because too many files have changed in this diff Show More