mirror of
https://github.com/kichikuou/xsystem35-sdl2.git
synced 2026-09-25 07:58:04 +03:00
Compare commits
61
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
48d937a0c3 | ||
|
|
4aff7a1df7 | ||
|
|
303510e5c0 | ||
|
|
c7263a3082 | ||
|
|
aea53c1079 | ||
|
|
32f1e1ef8a | ||
|
|
500fffaee2 | ||
|
|
ebe3762809 | ||
|
|
4fd00a9088 | ||
|
|
44d0ddcec7 | ||
|
|
9541f3f85a | ||
|
|
b5c8b158c6 | ||
|
|
8d91657c14 | ||
|
|
ebb249cd47 | ||
|
|
379ca744d5 | ||
|
|
b892189f8b | ||
|
|
f1b4c2550b | ||
|
|
79c9bfc85a | ||
|
|
042f333564 | ||
|
|
417baec290 | ||
|
|
ec270f2378 | ||
|
|
55837e5115 | ||
|
|
97b8bcb22a | ||
|
|
862f639e2e | ||
|
|
316a06a168 | ||
|
|
c9ec20dcc8 | ||
|
|
023b8cd455 | ||
|
|
335681863c | ||
|
|
ecba592d82 | ||
|
|
dbac18c260 | ||
|
|
ed8f610f80 | ||
|
|
f753cf8670 | ||
|
|
c3cc4f3e44 | ||
|
|
e57913bfc6 | ||
|
|
f941916fb2 | ||
|
|
f5248bda8a | ||
|
|
988a072964 | ||
|
|
775b34cf1a | ||
|
|
5455bce8d6 | ||
|
|
5e5defb6bc | ||
|
|
05cca544c6 | ||
|
|
38758569bb | ||
|
|
e417811a94 | ||
|
|
b509be2b64 | ||
|
|
fa845a6439 | ||
|
|
b3cb185a35 | ||
|
|
87413d54dc | ||
|
|
440fb93b08 | ||
|
|
6d1ef1ba6f | ||
|
|
dd1f0fd230 | ||
|
|
15fb122148 | ||
|
|
91a6cf7e67 | ||
|
|
dc8025469a | ||
|
|
0bbace898d | ||
|
|
c4e5ef3c36 | ||
|
|
e039fb3193 | ||
|
|
e547c153fc | ||
|
|
fef74da3dd | ||
|
|
7baab6b616 | ||
|
|
54b219e435 | ||
|
|
a20363b901 |
@@ -11,15 +11,10 @@ jobs:
|
||||
- name: Install Deps
|
||||
run: sudo apt install ninja-build
|
||||
|
||||
- name: set up JDK 1.8
|
||||
uses: actions/setup-java@v1
|
||||
with:
|
||||
java-version: 1.8
|
||||
|
||||
- name: Build
|
||||
run: |
|
||||
cd android
|
||||
./gradlew assembleRelease
|
||||
ANDROID_NDK_HOME=$ANDROID_SDK_ROOT/ndk-bundle ./gradlew assembleRelease
|
||||
|
||||
- name: Upload artifacts
|
||||
uses: actions/upload-artifact@v1
|
||||
|
||||
@@ -18,7 +18,7 @@ jobs:
|
||||
key: emscripten-cache-${{ env.emscripten-version }}
|
||||
|
||||
- name: Setup Emscripten toolchain
|
||||
uses: mymindstorm/setup-emsdk@v6
|
||||
uses: mymindstorm/setup-emsdk@v7
|
||||
with:
|
||||
version: ${{ env.emscripten-version }}
|
||||
actions-cache-folder: emsdk-cache
|
||||
|
||||
@@ -15,33 +15,15 @@ jobs:
|
||||
- name: Install Deps
|
||||
run: |
|
||||
sudo apt update
|
||||
sudo apt install libsdl2-dev libsdl2-ttf-dev libsdl2-mixer-dev
|
||||
sudo apt install libgtk2.0-dev libsdl2-dev libsdl2-ttf-dev libsdl2-mixer-dev
|
||||
|
||||
- name: Build
|
||||
run: |
|
||||
mkdir -p out/${{ matrix.build-type }}
|
||||
cd out/${{ matrix.build-type }}
|
||||
cmake -DENABLE_X11=NO -DCMAKE_BUILD_TYPE=${{ matrix.build-type }} ../../
|
||||
cmake -DCMAKE_BUILD_TYPE=${{ matrix.build-type }} ../../
|
||||
make
|
||||
|
||||
- name: Test
|
||||
run: ctest --output-on-failure
|
||||
working-directory: out/${{ matrix.build-type }}
|
||||
|
||||
build-x11:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
name: Linux X11
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
- name: Build
|
||||
run: |
|
||||
mkdir -p out
|
||||
cd out
|
||||
cmake ../
|
||||
make
|
||||
|
||||
- name: Test
|
||||
run: ctest --output-on-failure
|
||||
working-directory: out
|
||||
|
||||
@@ -24,7 +24,7 @@ jobs:
|
||||
steps:
|
||||
|
||||
- name: Set up shell
|
||||
run: echo ::add-path::C:\msys64\usr\bin\
|
||||
run: echo "C:\msys64\usr\bin\" >> $env:GITHUB_PATH
|
||||
shell: pwsh
|
||||
|
||||
- name: Print system version
|
||||
|
||||
+8
-61
@@ -36,16 +36,13 @@ check_symbol_exists(sigaction "signal.h" HAVE_SIGACTION)
|
||||
check_symbol_exists(uname "sys/utsname.h" HAVE_UNAME)
|
||||
|
||||
if (EMSCRIPTEN)
|
||||
set(SDL2_FOUND 1)
|
||||
set(FREETYPE_FOUND 1)
|
||||
set(HAVE_JPEG 1)
|
||||
set(DEFAULT_FONT_PATH /fonts/)
|
||||
elseif (ANDROID)
|
||||
if (NOT DEFINED ENABLE_MODULES)
|
||||
set(ENABLE_MODULES 1)
|
||||
endif()
|
||||
set(SDL2_FOUND 1)
|
||||
set(SDL2MIXER_FOUND 1)
|
||||
set(SDL2TTF_FOUND 1)
|
||||
find_library(ndk_zlib z)
|
||||
find_library(ndk_log log)
|
||||
else()
|
||||
@@ -58,22 +55,15 @@ else()
|
||||
|
||||
find_package(ZLIB REQUIRED)
|
||||
|
||||
optional_find_package(X11)
|
||||
if (X11_xf86vmode_FOUND)
|
||||
set(HAVE_XF86VMODE 1)
|
||||
endif()
|
||||
|
||||
optional_find_package(GTK2 COMPONENTS gtk)
|
||||
if (GTK2_FOUND)
|
||||
set(ENABLE_GTK 1)
|
||||
endif()
|
||||
|
||||
optional_find_package(Freetype)
|
||||
|
||||
include(FindPkgConfig)
|
||||
optional_pkg_check_modules(SDL2 IMPORTED_TARGET sdl2)
|
||||
pkg_check_modules(SDL2 IMPORTED_TARGET sdl2)
|
||||
pkg_check_modules(SDL2TTF IMPORTED_TARGET SDL2_ttf)
|
||||
optional_pkg_check_modules(SDL2MIXER IMPORTED_TARGET SDL2_mixer)
|
||||
optional_pkg_check_modules(SDL2TTF IMPORTED_TARGET SDL2_ttf)
|
||||
|
||||
include(FindJPEG)
|
||||
if (JPEG_FOUND)
|
||||
@@ -88,6 +78,8 @@ endif()
|
||||
|
||||
if (EMSCRIPTEN)
|
||||
set(SRC_MENU menu_emscripten.c)
|
||||
elseif (ANDROID)
|
||||
set(SRC_MENU menu_android.c)
|
||||
elseif (GTK2_FOUND)
|
||||
set(SRC_MENU menu.c menu_callback.c menu_gui.c s39init.c)
|
||||
|
||||
@@ -100,21 +92,8 @@ elseif (GTK2_FOUND)
|
||||
include_directories(${Intl_INCLUDE_DIRS})
|
||||
link_libraries(${Intl_LIBRARIES})
|
||||
endif()
|
||||
else()
|
||||
set(SRC_MENU menu_null.c)
|
||||
endif()
|
||||
|
||||
# Graphics
|
||||
|
||||
if (X11_FOUND)
|
||||
set(SRC_GRAPHDEV xcore_draw.c xcore_video.c xcore_mode.c xcore_event.c xcore_cursor.c xcore_maskupdate.c image.c xcore_image.c)
|
||||
set(SUMMARY_GRAPHDEV "X11")
|
||||
elseif (SDL2_FOUND)
|
||||
set(SRC_GRAPHDEV sdl_video.c sdl_mode.c sdl_draw.c sdl_event.c sdl_image.c sdl_cursor.c image.c)
|
||||
set(SUMMARY_GRAPHDEV "SDL2")
|
||||
set(ENABLE_SDL 1)
|
||||
else()
|
||||
message(FATAL_ERROR "*** No graphic device available ***")
|
||||
else ()
|
||||
set(SRC_MENU menu_sdl.c sdl_input.c)
|
||||
endif()
|
||||
|
||||
# PCM audio
|
||||
@@ -199,40 +178,10 @@ endif()
|
||||
|
||||
if (EMSCRIPTEN OR ANDROID)
|
||||
set(SRC_JOYSTICK joystick_dmy.c)
|
||||
elseif (ENABLE_SDL)
|
||||
else()
|
||||
set(SRC_JOYSTICK joystick_sdl.c)
|
||||
set(SUMMARY_JOYSTICK "SDL")
|
||||
set(HAVE_SDLJOY 1)
|
||||
else()
|
||||
check_include_file(linux/joystick.h HAVE_LINUX_JOYSTICK_H)
|
||||
if (HAVE_LINUX_JOYSTICK_H)
|
||||
set(SRC_JOYSTICK joystick_linux.c)
|
||||
set(SUMMARY_JOYSTICK "Linux ioctl")
|
||||
set(JOY_DEVICE "/dev/js0" CACHE STRING "joystick device")
|
||||
else ()
|
||||
set(SRC_JOYSTICK joystick_dmy.c)
|
||||
endif ()
|
||||
endif()
|
||||
|
||||
# Font
|
||||
|
||||
if (X11_FOUND)
|
||||
list(APPEND SRC_FONT font_x11.c)
|
||||
list(APPEND SUMMARY_FONT "x11")
|
||||
set(ENABLE_X11FONT 1)
|
||||
endif()
|
||||
if (FREETYPE_FOUND)
|
||||
list(APPEND SRC_FONT font_freetype2.c)
|
||||
list(APPEND SUMMARY_FONT "freetype2")
|
||||
set(ENABLE_FT2 1)
|
||||
endif()
|
||||
if (NOT X11_FOUND AND SDL2TTF_FOUND)
|
||||
list(APPEND SRC_FONT font_sdlttf.c)
|
||||
list(APPEND SUMMARY_FONT "SDL_ttf")
|
||||
set(ENABLE_SDLTTF 1)
|
||||
endif()
|
||||
if (NOT SRC_FONT)
|
||||
message(FATAL_ERROR "*** No font device available ***")
|
||||
endif()
|
||||
|
||||
# TODO: MMX
|
||||
@@ -248,11 +197,9 @@ endfunction()
|
||||
|
||||
message("xsystem35 summary:")
|
||||
message("------------------")
|
||||
print_summary(graphics ${SUMMARY_GRAPHDEV})
|
||||
print_summary(audio ${SUMMARY_AUDIO})
|
||||
print_summary(cdrom ${SUMMARY_CDROM})
|
||||
print_summary(midi ${SUMMARY_MIDI})
|
||||
print_summary(font ${SUMMARY_FONT})
|
||||
print_summary(joystick ${SUMMARY_JOYSTICK})
|
||||
message("------------------")
|
||||
|
||||
|
||||
@@ -8,19 +8,17 @@ Prebuilt binaries for Windows and Android can be downloaded from the [Releases](
|
||||
## Build
|
||||
### Linux (Debian / Ubuntu)
|
||||
|
||||
$ sudo apt install build-essential cmake libsdl2-dev libsdl2-ttf-dev libsdl2-mixer-dev
|
||||
$ sudo apt install build-essential cmake libgtk2.0-dev libsdl2-dev libsdl2-ttf-dev libsdl2-mixer-dev
|
||||
$ mkdir -p out/debug
|
||||
$ cd out/debug
|
||||
$ cmake -DCMAKE_BUILD_TYPE=Debug ../../
|
||||
$ make && make install
|
||||
|
||||
You can choose between X11 and SDL2 as the graphics backend. If both libraries are found, X11 is used by default, but if `-DENABLE_X11=NO` flag is given to the `cmake` invocation, then SDL2 will be used.
|
||||
|
||||
### MacOS
|
||||
|
||||
[Homebrew](https://brew.sh/index_ja) is needed.
|
||||
|
||||
$ brew install cmake pkg-config sdl2 sdl2_mixer freetype libjpeg
|
||||
$ brew install cmake pkg-config sdl2 sdl2_mixer sdl2_ttf libjpeg
|
||||
$ mkdir -p out/debug
|
||||
$ cd out/debug
|
||||
$ cmake -DCMAKE_BUILD_TYPE=Debug ../../
|
||||
|
||||
+10
-11
@@ -6,7 +6,7 @@ Prebuilt APKs are [here](https://github.com/kichikuou/xsystem35-sdl2/releases).
|
||||
## Build
|
||||
Prerequisites:
|
||||
- CMake >=3.13
|
||||
- Android SDK >=26
|
||||
- Android SDK >=28
|
||||
- Android NDK >=r15c
|
||||
|
||||
### Using Android Studio
|
||||
@@ -15,20 +15,19 @@ Open this directory as an Android Studio project.
|
||||
### Command line build
|
||||
Configure environment variables and run the `gradlew` script in this folder.
|
||||
|
||||
Example build instructions (for Debian Stretch):
|
||||
Example build instructions (for Debian buster):
|
||||
```sh
|
||||
# Install necessary packages
|
||||
sudo apt install git wget unzip default-jdk-headless ninja-build
|
||||
sudo apt -t stretch-backports install cmake
|
||||
sudo apt install git wget unzip default-jdk-headless cmake ninja-build
|
||||
|
||||
# Install Android SDK / NDK
|
||||
export ANDROID_HOME=$HOME/android-sdk
|
||||
export PATH=$PATH:$ANDROID_HOME/tools
|
||||
export PATH=$PATH:$ANDROID_HOME/platform-tools
|
||||
wget https://dl.google.com/android/repository/sdk-tools-linux-4333796.zip
|
||||
unzip sdk-tools-linux-4333796.zip -d $ANDROID_HOME
|
||||
yes |$ANDROID_HOME/tools/bin/sdkmanager --licenses
|
||||
$ANDROID_HOME/tools/bin/sdkmanager ndk-bundle
|
||||
export ANDROID_SDK_ROOT=$HOME/android-sdk
|
||||
mkdir -p $ANDROID_SDK_ROOT/cmdline-tools
|
||||
wget https://dl.google.com/android/repository/commandlinetools-linux-6609375_latest.zip
|
||||
unzip commandlinetools-linux-6609375_latest.zip -d $ANDROID_SDK_ROOT/cmdline-tools
|
||||
yes |$ANDROID_SDK_ROOT/cmdline-tools/tools/bin/sdkmanager --licenses
|
||||
$ANDROID_SDK_ROOT/cmdline-tools/tools/bin/sdkmanager ndk-bundle
|
||||
export ANDROID_NDK_HOME=$ANDROID_SDK_ROOT/ndk-bundle
|
||||
|
||||
# Check out and build xsystem35
|
||||
git clone https://github.com/kichikuou/xsystem35-sdl2.git
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
def buildAsLibrary = project.hasProperty('BUILD_AS_LIBRARY');
|
||||
def buildAsLibrary = project.hasProperty('BUILD_AS_LIBRARY')
|
||||
def buildAsApplication = !buildAsLibrary
|
||||
if (buildAsApplication) {
|
||||
apply plugin: 'com.android.application'
|
||||
@@ -9,15 +9,15 @@ else {
|
||||
apply plugin: 'kotlin-android'
|
||||
|
||||
android {
|
||||
compileSdkVersion 26
|
||||
compileSdkVersion 28
|
||||
defaultConfig {
|
||||
if (buildAsApplication) {
|
||||
applicationId "io.github.kichikuou.xsystem35"
|
||||
}
|
||||
minSdkVersion 19
|
||||
targetSdkVersion 26
|
||||
versionCode 4
|
||||
versionName "0.2.1"
|
||||
targetSdkVersion 28
|
||||
versionCode 5
|
||||
versionName "0.2.3"
|
||||
externalNativeBuild {
|
||||
cmake {
|
||||
arguments "-DANDROID_APP_PLATFORM=android-16", "-DANDROID_STL=c++_static"
|
||||
|
||||
@@ -17,9 +17,13 @@
|
||||
*/
|
||||
package io.github.kichikuou.xsystem35
|
||||
|
||||
import android.app.AlertDialog
|
||||
import android.media.MediaPlayer
|
||||
import android.os.Bundle
|
||||
import android.text.InputType
|
||||
import android.util.Log
|
||||
import android.widget.EditText
|
||||
import android.widget.NumberPicker
|
||||
import org.libsdl.app.SDLActivity
|
||||
import java.io.File
|
||||
import java.io.IOException
|
||||
@@ -74,13 +78,82 @@ class GameActivity : SDLActivity() {
|
||||
Launcher.updateGameList()
|
||||
}
|
||||
|
||||
// These functions are called in the SDL thread by JNI.
|
||||
private fun textInputDialog(msg: String, oldVal: String, maxLen: Int, result: Array<String?>) {
|
||||
val input = EditText(this)
|
||||
input.inputType = InputType.TYPE_CLASS_TEXT
|
||||
input.setText(oldVal)
|
||||
AlertDialog.Builder(this)
|
||||
.setMessage(msg)
|
||||
.setView(input)
|
||||
.setPositiveButton(R.string.ok) {_, _ ->
|
||||
val s = input.text.toString()
|
||||
result[0] = if (s.length <= maxLen) s else s.substring(0, maxLen)
|
||||
}
|
||||
.setNegativeButton(R.string.cancel) {_, _ -> }
|
||||
.setOnDismissListener {
|
||||
synchronized(result) {
|
||||
@Suppress("PLATFORM_CLASS_MAPPED_TO_KOTLIN") (result as Object).notify()
|
||||
}
|
||||
}
|
||||
.show()
|
||||
}
|
||||
|
||||
private fun numberInputDialog(msg: String, min: Int, max: Int, initial: Int, result: IntArray) {
|
||||
val input = NumberPicker(this)
|
||||
input.minValue = min
|
||||
input.maxValue = max
|
||||
input.value = initial
|
||||
AlertDialog.Builder(this)
|
||||
.setMessage(msg)
|
||||
.setView(input)
|
||||
.setPositiveButton(R.string.ok) {_, _ ->
|
||||
input.clearFocus()
|
||||
result[0] = input.value
|
||||
}
|
||||
.setNegativeButton(R.string.cancel) {_, _ -> }
|
||||
.setOnDismissListener {
|
||||
synchronized(result) {
|
||||
@Suppress("PLATFORM_CLASS_MAPPED_TO_KOTLIN") (result as Object).notify()
|
||||
}
|
||||
}
|
||||
.show()
|
||||
}
|
||||
|
||||
// The functions below are called in the SDL thread by JNI.
|
||||
@Suppress("unused") fun cddaStart(track: Int, loop: Boolean) = cdda.start(track, loop)
|
||||
@Suppress("unused") fun cddaStop() = cdda.stop()
|
||||
@Suppress("unused") fun cddaCurrentPosition() = cdda.currentPosition()
|
||||
@Suppress("unused") fun midiStart(path: String, loop: Boolean) = midi.start(path, loop)
|
||||
@Suppress("unused") fun midiStop() = midi.stop()
|
||||
@Suppress("unused") fun midiCurrentPosition() = midi.currentPosition()
|
||||
|
||||
@Suppress("unused") fun inputString(msg: String, oldVal: String, maxLen: Int): String? {
|
||||
val result = arrayOfNulls<String?>(1)
|
||||
runOnUiThread { textInputDialog(msg, oldVal, maxLen, result) }
|
||||
// Block the calling thread.
|
||||
synchronized(result) {
|
||||
try {
|
||||
@Suppress("PLATFORM_CLASS_MAPPED_TO_KOTLIN") (result as Object).wait()
|
||||
} catch (ex: InterruptedException) {
|
||||
ex.printStackTrace()
|
||||
}
|
||||
}
|
||||
return result[0]
|
||||
}
|
||||
|
||||
@Suppress("unused") fun inputNumber(msg: String, min: Int, max: Int, initial: Int): Int {
|
||||
val result = intArrayOf(-1)
|
||||
runOnUiThread { numberInputDialog(msg, min, max, initial, result) }
|
||||
// Block the calling thread.
|
||||
synchronized(result) {
|
||||
try {
|
||||
@Suppress("PLATFORM_CLASS_MAPPED_TO_KOTLIN") (result as Object).wait()
|
||||
} catch (ex: InterruptedException) {
|
||||
ex.printStackTrace()
|
||||
}
|
||||
}
|
||||
return result[0]
|
||||
}
|
||||
}
|
||||
|
||||
private class CddaPlayer(private val playlistPath: File) {
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
||||
|
||||
buildscript {
|
||||
ext.kotlin_version = '1.3.61'
|
||||
ext.kotlin_version = '1.3.72'
|
||||
repositories {
|
||||
jcenter()
|
||||
google()
|
||||
}
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:3.2.0'
|
||||
classpath 'com.android.tools.build:gradle:4.0.1'
|
||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
||||
|
||||
// NOTE: Do not place your application dependencies here; they belong
|
||||
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
#Mon Oct 23 13:51:26 PDT 2017
|
||||
#Mon Aug 10 12:24:31 JST 2020
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-all.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
|
||||
#cmakedefine CMAKE_SYSTEM_NAME "@CMAKE_SYSTEM_NAME@"
|
||||
|
||||
#define RGB_ORDER 1
|
||||
#cmakedefine WORDS_BIGENDIAN @WORDS_BIGENDIAN@
|
||||
|
||||
#cmakedefine CACHE_TOTALSIZE @CACHE_TOTALSIZE@
|
||||
@@ -13,17 +12,13 @@
|
||||
#cmakedefine ENABLE_CDROM_EMSCRIPTEN @ENABLE_CDROM_EMSCRIPTEN@
|
||||
#cmakedefine ENABLE_CDROM_LINUX @ENABLE_CDROM_LINUX@
|
||||
#cmakedefine ENABLE_CDROM_MP3 @ENABLE_CDROM_MP3@
|
||||
#cmakedefine ENABLE_FT2 @ENABLE_FT2@
|
||||
#cmakedefine ENABLE_GTK @ENABLE_GTK@
|
||||
#cmakedefine ENABLE_MIDI_RAWMIDI @ENABLE_MIDI_RAWMIDI@
|
||||
#cmakedefine ENABLE_MIDI_SDLMIXER @ENABLE_MIDI_SDLMIXER@
|
||||
#cmakedefine ENABLE_MIDI_SEQMIDI @ENABLE_MIDI_SEQMIDI@
|
||||
#cmakedefine ENABLE_MODULES @ENABLE_MODULES@
|
||||
#cmakedefine ENABLE_NLS @ENABLE_NLS@
|
||||
#cmakedefine ENABLE_SDL @ENABLE_SDL@
|
||||
#cmakedefine ENABLE_SDLMIXER @ENABLE_SDLMIXER@
|
||||
#cmakedefine ENABLE_SDLTTF @ENABLE_SDLTTF@
|
||||
#cmakedefine ENABLE_X11FONT @ENABLE_X11FONT@
|
||||
|
||||
#cmakedefine CDROM_DEVICE "@CDROM_DEVICE@"
|
||||
#cmakedefine JOY_DEVICE "@JOY_DEVICE@"
|
||||
@@ -38,7 +33,6 @@
|
||||
#cmakedefine HAVE_SDLJOY @HAVE_SDLJOY@
|
||||
#cmakedefine HAVE_SIGACTION @HAVE_SIGACTION@
|
||||
#cmakedefine HAVE_UNAME @HAVE_UNAME@
|
||||
#cmakedefine HAVE_XF86VMODE @HAVE_XF86VMODE@
|
||||
|
||||
#define DEFAULT_GOTHIC_TTF "@DEFAULT_FONT_PATH@MTLc3m.ttf"
|
||||
#define DEFAULT_MINCHO_TTF "@DEFAULT_FONT_PATH@mincho.otf"
|
||||
|
||||
+49
-49
@@ -84,7 +84,7 @@
|
||||
必要に応じてシナリオ内の変数に読み込みます。
|
||||
|
||||
f) リソースファイルは、マウスカーソルの形状とアニメーションマウスカーソルの
|
||||
データを格納しています。これまで DARCROW でのみ使用されました。
|
||||
データを格納しています。これまで DARCROWS でのみ使用されました。
|
||||
|
||||
g) セーブデータは、システム管理情報と数値変数、文字列変数のすべてを含んだ
|
||||
全セーブデータ(*.asd)と数値変数・文字列変数の一部を保存したデータの2種類が
|
||||
@@ -94,17 +94,17 @@
|
||||
h) その他のデータの範疇に入るものとしては外字ファイルとデータファイルがあり
|
||||
ます。
|
||||
外字ファイルは、PC9801の外字領域に16x16ドットのビットマップデータを並べた
|
||||
もので、オリジナルの外字を表示させるのに加えて、98機種依存文字の吸収も目指
|
||||
もので、オリジナルの外字を表示させるのに加えて、PC98機種依存文字の吸収も目指
|
||||
していたのですが、結局外字ファイルは「いけないかつみ先生」で使われたのみで、
|
||||
SYSTEM35.EXE Version 2.x 以降ではサポートすらされなくなりました。また、機種
|
||||
依存文字(まる文字やギリシャ数字など)はそれ以降のゲームでも機種存のコードで
|
||||
依存文字(まる文字やギリシャ数字など)はそれ以降のゲームでも機種依存のコードで
|
||||
継続して使われています。SYSTEM 3.9 では再び外字のサポートが復活するようです。
|
||||
|
||||
データファイルは、基本的には、シナリオ変数を外部に保存したものと考える事
|
||||
ができます。マップデータのようにあらかじめゲームに附属しているものもあれば、
|
||||
ゲームの途中経過を記録するために、ファイルに書き出す事もあります。
|
||||
かえるにょぱにょーんのマップデータ等のように e)のデータファイルで代用できる
|
||||
ものもあります。
|
||||
かえるにょ・ぱにょ〜んのマップデータ等のように e)のデータファイルで代用でき
|
||||
るものもあります。
|
||||
|
||||
3. データファイル (.ald) のフォーマット
|
||||
|
||||
@@ -143,15 +143,15 @@
|
||||
data そのものについても、ヘッダと実データに分ける事が出来ます。ヘッダは
|
||||
32バイト以上の長さで次のようになっています。
|
||||
|
||||
int32 prt;
|
||||
int32 ptr;
|
||||
int32 size;
|
||||
int32 time_l;
|
||||
int32 time_h;
|
||||
char name[?];
|
||||
|
||||
ptr は実際のデータへのヘッダからの相対アドレスです。size はデータの大きさを
|
||||
表します。 time_l と time_h は Windows 特有(?)の値で、データの作成時間をユリ
|
||||
ウス歴の最初の日付からの経過時間をナノ秒で表したものです。name はアーカイブ
|
||||
表します。 time_l と time_h は Windows の FILETIME 型の値で、データの作成時刻
|
||||
を1601-01-01からの100ナノ秒単位の経過時間で表したものです。name はアーカイブ
|
||||
する前のデータのファイル名で、16バイト以上の長さがあります。16バイト未満の時
|
||||
は0でパディングされます。またヘッダとデータを併せて 256バイト単位になるよう
|
||||
にデータの後ろは0でパディングされます。
|
||||
@@ -200,26 +200,26 @@
|
||||
int16 width;
|
||||
int16 height;
|
||||
int8 rsv;
|
||||
int8 pallet_bank;
|
||||
int8 palette_bank;
|
||||
int8 pal[3*16];
|
||||
|
||||
(x0,y0) は、CGを表示する位置を表します。シナリオから表示位置の指定のない場合
|
||||
この値を使います。x0 は 8で割った大きさになっていいますので、x0=10 とあった
|
||||
場合は実際には (80,y0) の位置に表示します。
|
||||
この値を使います。x0 は 8で割った大きさになっていますので、x0=10 とあった場
|
||||
合は実際には (80,y0) の位置に表示します。
|
||||
|
||||
(width, height) は CG の大きさを表します。widthは実際には8で割った大きさに
|
||||
なっています。これは、プレーン型のデータが元になっているためです。プレーン型
|
||||
のデータの場合、1バイトで表されるのは8ピクセル分だったため、width にいれる
|
||||
値は占めるバイト数を格納した方が有利だったんめと考えられます。よってCGの横の
|
||||
値は占めるバイト数を格納した方が有利だったためと考えられます。よってCGの横の
|
||||
サイズは常に8の倍数になります。8の倍数以外にしたい場合は、余る部分を透過
|
||||
パレット(スプライト)とする事で実現出来ます。
|
||||
|
||||
rsv は現在のところ、使われていません。
|
||||
|
||||
pallet_bank は、SYSTEM 3 の時代に 256色対応ゲームで、VSPファイルを読み込ませ
|
||||
palette_bank は、SYSTEM 3 の時代に 256色対応ゲームで、VSPファイルを読み込ませ
|
||||
るために、256個のパレットのどの場所に 16色分のパレットを置くかを決めます。
|
||||
bank=0 で 0-15, bank=1 で 16-31 となります。実装方法としては、plane->packed
|
||||
の変換の際に上位4bitにpalletを置いた場所の bitを立てます。bank=1 なら '| 0x10'
|
||||
の変換の際に上位4bitにpaletteを置いた場所の bitを立てます。bank=1 なら '| 0x10'
|
||||
という具合です。シナリオ側からパレットバンクを指定することもできます。しかし、
|
||||
シナリオ側から1度もパレットバンクの指定が無い場合はこのヘッダ内の情報が使用
|
||||
されます。(これは実装依存かもしれません)
|
||||
@@ -234,7 +234,7 @@
|
||||
です。
|
||||
|
||||
00, len;
|
||||
一つ上のプレーンと(len+1)の長さだけ同じ
|
||||
同じプレーンの一つ左の列と(len+1)の長さだけ同じ
|
||||
|
||||
01, len, pic;
|
||||
1バイト(pic)の繰り返し。長さは(len+1)
|
||||
@@ -277,32 +277,32 @@
|
||||
int8 bpp;
|
||||
int8 bppS;
|
||||
int8 trans_pal;
|
||||
int16 palett_bank;
|
||||
int32 rsv;
|
||||
int8 rsv1;
|
||||
int16 palette_bank;
|
||||
int32 rsv2;
|
||||
int32 x0;
|
||||
int32 y0;
|
||||
int32 width;
|
||||
int32 height;
|
||||
int32 data_ptr;
|
||||
int32 pallet_ptr;
|
||||
int32 palette_ptr;
|
||||
int32 comment_ptr;
|
||||
|
||||
sig はデータのマジックナンバーで 'PM' というデータが入っています。
|
||||
|
||||
ver はデータのバージョンで、現在は 1 が入っています。
|
||||
|
||||
bpp はデータの bit per pixel で 8または16です。256色データの場合は 8、64k色
|
||||
の場合は 16です。
|
||||
bpp はデータの bits per pixel で、256色データの場合は 8、64k色の場合は16です。
|
||||
|
||||
bppsはαチャンネルの bit per pixel で通常は8です。
|
||||
bppsはαチャンネルの bits per pixel で通常は8です。
|
||||
|
||||
trans_pal は透過するパレットの番号です。通常はシナリオから指定が来るので
|
||||
使用しません。
|
||||
|
||||
pallet_bank は データの中のパレットのどの部分をシステムに転送するかを
|
||||
palette_bank は データの中のパレットのどの部分をシステムに転送するかを
|
||||
表します。通常は 256個全部転送するのですが、CGデータがそれ以下しか色を使って
|
||||
ない場合には、一部のみ転送することができます。pallet_bank は 16bit の情報を
|
||||
持ち 256個を 16個づつに分割してどの部分を転送するかを指定します。bit-on で
|
||||
ない場合には、一部のみ転送することができます。palette_bank は 16bit の情報を
|
||||
持ち 256個を 16個ずつに分割してどの部分を転送するかを指定します。bit-on で
|
||||
転送です。LSB が0-15, MSB が 240-255 です。
|
||||
|
||||
(x0, y0) は CG の表示位置です。VSP と違って8で割った大きさではなく実際の
|
||||
@@ -312,10 +312,10 @@
|
||||
|
||||
data_ptr はデータ先頭からピクセルデータへの相対アドレスが入ります。
|
||||
|
||||
pallet_ptr は bppが8の場合にはパレットへの相対アドレスが入りますが、
|
||||
palette_ptr は bppが8の場合にはパレットへの相対アドレスが入りますが、
|
||||
16の場合にはαチャンネルデータへの相対アドレスが入ります。
|
||||
|
||||
comment_prt はデータにコメントをつける事ができて、そのデータへの相対アドレス
|
||||
comment_ptr はデータにコメントをつける事ができて、そのデータへの相対アドレス
|
||||
を指定します。
|
||||
|
||||
パレット
|
||||
@@ -333,31 +333,31 @@
|
||||
2つ上のラインと同じ。長さは (len+3:8bit, len+2:16bit)
|
||||
|
||||
0xfd, len, pic,
|
||||
1byte の picデータの連続。長さは (len+4:8bit, len+3:16bit)
|
||||
1ピクセルの picデータの連続。長さは (len+4:8bit, len+3:16bit)
|
||||
|
||||
0xfc, len, pic1, pic2
|
||||
2byte (pic1, pic2) データの連続。長さは ((len+3)*2:8bit, ((len+2)*2):16bit))
|
||||
2ピクセル (pic1, pic2) データの連続。長さは ((len+3)*2:8bit, (len+2)*2:16bit)
|
||||
|
||||
0xfb
|
||||
左上のデータと同じ。(PMS16専用)
|
||||
左上のピクセルと同じ。(PMS16専用)
|
||||
|
||||
0xfa
|
||||
右上のデータと同じ。(PMS16専用)
|
||||
右上のピクセルと同じ。(PMS16専用)
|
||||
|
||||
0xf9, len, pic_h, pic_l1, pic_l2, .... (PMS16専用)
|
||||
ピクセル間の色の差が小さいものの連続。長さは(len+1)
|
||||
各ピクセルのうち、R の上位 3bit, G の 2bit, B の 2bit が同じで、R の下位
|
||||
各ピクセルのうち、R の上位 3bit, G の 2bit, B の 3bit が同じで、R の下位
|
||||
2bit, G の 4bit, B の 2bit が異なるとき、下位の異なる部分のみを pic_l2,
|
||||
pic_l3... で表す。( RGB は 5bit, 6bit, 5bit で表される)
|
||||
pic_h, pic_l1 で最初のピクセルを構成し、ここから、RGB の上位が同じで、下位の
|
||||
異なる部分を pic_l2, pic_l3... で構成する
|
||||
異なる部分を pic_l2, pic_l3... で構成する。
|
||||
|
||||
0xf8, pic
|
||||
picそのもの。コードと同じピクセル用。8bit では pic は 1byte, 16bit では 2byte.
|
||||
|
||||
0xf7-0x00
|
||||
データそのもの 8bitでは 1byte, 16bit では 00-f7 の次のコードはすべて(00-ff)
|
||||
使用してピクセルを構成。
|
||||
データそのもの。 8bitでは 1byte, 16bit では次の 1byte と合わせてピクセルを
|
||||
構成。
|
||||
|
||||
|
||||
4.3 QNT フォーマット
|
||||
@@ -380,7 +380,7 @@
|
||||
int32 width;
|
||||
int32 height;
|
||||
int32 bpp;
|
||||
int32 rsv(?)
|
||||
int32 rsv; (?)
|
||||
int32 pixel_size;
|
||||
int32 alpha_size;
|
||||
|
||||
@@ -420,7 +420,7 @@
|
||||
header_size はヘッダの大きさをバイト数で表しています。Version 0 では 48
|
||||
バイト固定です。
|
||||
|
||||
(x0, y0) は CG の表示位置の指定です
|
||||
(x0, y0) は CG の表示位置の指定です。
|
||||
|
||||
(width, height) は CG の大きさの指定です。
|
||||
|
||||
@@ -472,8 +472,8 @@
|
||||
最新のものでは 'S380' となっています。途中混乱した時期があってこれと異なる
|
||||
場合もあります。
|
||||
|
||||
dat_prt は実際のシナリオデータの先頭への相対アドレスです。また、シナリオ中の
|
||||
ジャンプ命令のアドレスは、上のヘッダの最初からの相対アドレスを使用します。
|
||||
data_ptr は実際のシナリオデータの先頭のアドレスです。また、シナリオ中の
|
||||
ジャンプ命令のアドレスは、上のヘッダの先頭からの相対アドレスを使用します。
|
||||
|
||||
size はヘッダを含めたデータのサイズを示しています。
|
||||
|
||||
@@ -534,21 +534,21 @@
|
||||
04h 演算子(>= 以上)
|
||||
|
||||
数値は0から65535までの正の整数を扱えます。しかし、計算式上では word 定数は
|
||||
3FFFh しかあつかえませんので、それ以上の値を扱う場合は演算子を使います。
|
||||
3FFFh までしかあつかえませんので、それ以上の値を扱う場合は演算子を使います。
|
||||
65536 以上の数値を扱ったり、浮動小数を扱う場合は、64ビット変数を使用します。
|
||||
|
||||
配列を除く変数の最大は論理的には、16384 個ですが、実際には 2000 以下に実装上
|
||||
の限界があります。1000 以上になる場合は、配列変数を有効に使うと良いでしょう。
|
||||
配列を除く変数は論理的には最大 16384 個ですが、実際には 2000 以下に実装上の
|
||||
限界があります。1000 以上になる場合は、配列変数を有効に使うと良いでしょう。
|
||||
(xsystem35 の場合は 1024, 1.5.1pre1から 8192)
|
||||
|
||||
変数には、数値変数と配列変数があります。配列変数は、index 変数を用いた
|
||||
アクセス方法と、var[]のようなアクセス方法があります。var[]では上の 3.51拡張
|
||||
コードを使用して C0, 01, base_h, base_l, cali: というコーディングがなされま
|
||||
コードを使用して C0, 01, base_h, base_l, cali: というエンコードがなされま
|
||||
す。配列のベースとなる変数が (base_h << 8) + base_l で表され、インデックスは
|
||||
cali で指定されます。インデックスは配列変数も使用可能です。ex. var10[var20[5]]
|
||||
cali で指定されます。インデックスは配列参照も使用可能です。ex. var10[var20[5]]
|
||||
|
||||
計算式は逆ポーランド記述で格納されますので、基本的な処理はスタックから2つの
|
||||
数値または変数と1つの演算子を取り出して演算し、結果をスタックに戻します。
|
||||
計算式は逆ポーランド記述で格納されますので、基本的な処理はスタックから1つの
|
||||
演算子と2つの数値または変数を取り出して演算し、結果をスタックに戻します。
|
||||
この操作を 0x7f が出現するまで繰り返します。0x7f が来たら、スタックに残って
|
||||
いる数値を取り出します。コマンドの引数として変数を要求している場合の計算式
|
||||
は、変数へのポインタを返します。
|
||||
@@ -657,8 +657,8 @@
|
||||
|
||||
wav** など小文字系のコマンドはすべて 0x2f, 0x??, にエンコードされます。
|
||||
また引数として文字列を含むもの(ファイル名など)は、従来は ':' で終っていました
|
||||
が、system 3.8 以降では '\0' で終わるようになり、これらコマンドは新規に 0x2f
|
||||
コマンドとして新規に割り当てられました。
|
||||
が、system 3.8 以降では '\0' で終わるようになり、これらのコマンドは新規に
|
||||
0x2f コマンドとして割り当てられました。
|
||||
|
||||
0x2f, 0x0a, cali *2: [wavLoad]
|
||||
0x2f, 0x0b, cali *2: [wavPlay]
|
||||
@@ -807,7 +807,7 @@
|
||||
ここでは、コマンド表に載っていないけど、ゲームに出て来るものを紹介します。
|
||||
|
||||
5.8.1 VA
|
||||
* 機能: ユニットアニメーション (かえるにょ・ぱにょん初出)
|
||||
* 機能: ユニットアニメーション (かえるにょ・ぱにょ〜ん初出)
|
||||
* フォーマット: VA getd, cali, cali, cali:
|
||||
|
||||
* VA0 : 制御用コマンド
|
||||
@@ -821,7 +821,7 @@
|
||||
VA0, no, 1, num:
|
||||
no番のアニメーション開始。すぐに制御を戻す。
|
||||
numはコマ数, 0の場合と開始位置と終了位置が同じな時はアニメーションは
|
||||
動かずにコマ数だけが無限にされるカウント。
|
||||
動かずにコマ数だけが無限にカウントされる。
|
||||
|
||||
VA0, no, 2, num:
|
||||
no番のアニメーション開始。終るまで制御を戻さない。
|
||||
|
||||
+30
-4
@@ -1,7 +1,5 @@
|
||||
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../src)
|
||||
|
||||
add_subdirectory(lib)
|
||||
|
||||
add_library(modules STATIC
|
||||
modules.c
|
||||
AliceLogo/AliceLogo.c
|
||||
@@ -61,6 +59,31 @@ add_library(modules STATIC
|
||||
dDemo/dDemo.c
|
||||
eDemo/eDemo.c
|
||||
eeDemo/eeDemo.c
|
||||
lib/alk.c
|
||||
lib/drawtext.c
|
||||
lib/graph.c
|
||||
lib/list.c
|
||||
lib/surface.c
|
||||
lib/cg.c
|
||||
lib/graph_expandcolor_blend.c
|
||||
lib/graph_fillrect.c
|
||||
lib/graph_fillrect_amap.c
|
||||
lib/graph_fillrect_acolor.c
|
||||
lib/graph_rect.c
|
||||
lib/graph_copy.c
|
||||
lib/graph_copy_amap.c
|
||||
lib/graph_copy_bright.c
|
||||
lib/graph_copy_whiteout.c
|
||||
lib/graph_blend_amap.c
|
||||
lib/graph_blend_screen.c
|
||||
lib/graph_saturadd_amap.c
|
||||
lib/graph_draw_amap.c
|
||||
lib/graph_stretch.c
|
||||
lib/graph_cg.c
|
||||
lib/graph_buller.c
|
||||
lib/gre_blend_useamap.c
|
||||
lib/gre_blend.c
|
||||
lib/gre_blend_screen.c
|
||||
nDEMO/nDEMO.c
|
||||
nDEMOE/nDEMOE.c
|
||||
oDEMO/oDEMO.c
|
||||
@@ -68,10 +91,13 @@ add_library(modules STATIC
|
||||
tDemo/tDemo.c
|
||||
)
|
||||
|
||||
target_include_directories(modules PUBLIC .)
|
||||
target_include_directories(modules PUBLIC . lib)
|
||||
|
||||
add_executable(modules_tests lib/list_test.c)
|
||||
target_link_libraries(modules_tests PRIVATE modules)
|
||||
add_test(NAME modules_tests COMMAND modules_tests)
|
||||
|
||||
target_compile_options(modules PRIVATE -Wno-pointer-sign)
|
||||
target_link_libraries(modules PRIVATE graph alk drawtext list)
|
||||
|
||||
if (SDL2MIXER_FOUND)
|
||||
if (ANDROID)
|
||||
|
||||
+7
-19
@@ -120,10 +120,9 @@ static int load_cg_main(int no) {
|
||||
|
||||
sno = find_null_surface();
|
||||
|
||||
sf->no = sno;
|
||||
suf[sno] = sf;
|
||||
|
||||
return sf->no;
|
||||
return sno;
|
||||
}
|
||||
|
||||
static void Init() {
|
||||
@@ -165,7 +164,7 @@ static void Create() {
|
||||
*var = 0;
|
||||
} else {
|
||||
int no = find_null_surface();
|
||||
*var = s->no = no;
|
||||
*var = no;
|
||||
suf[no] = s;
|
||||
}
|
||||
|
||||
@@ -193,7 +192,7 @@ static void CreatePixelOnly() {
|
||||
*var = 0;
|
||||
} else {
|
||||
int no = find_null_surface();
|
||||
*var = s->no = no;
|
||||
*var = no;
|
||||
suf[no] = s;
|
||||
}
|
||||
|
||||
@@ -219,7 +218,7 @@ static void CreateAMapOnly() {
|
||||
*var = 0;
|
||||
} else {
|
||||
int no = find_null_surface();
|
||||
*var = s->no = no;
|
||||
*var = no;
|
||||
suf[no] = s;
|
||||
}
|
||||
|
||||
@@ -243,7 +242,7 @@ static void IsSurface() {
|
||||
if (s == NULL) {
|
||||
*var = 0;
|
||||
} else {
|
||||
*var = (s->has_alpha && s->has_pixel) ? 1 : 0;
|
||||
*var = (s->alpha && s->pixel) ? 1 : 0;
|
||||
}
|
||||
|
||||
DEBUG_COMMAND("Gpx.IsSurface %d,%p:\n", p1, var);
|
||||
@@ -265,7 +264,7 @@ static void IsPixel() {
|
||||
if (s == NULL) {
|
||||
*var = 0;
|
||||
} else {
|
||||
*var = s->has_pixel ? 1 : 0;
|
||||
*var = s->pixel ? 1 : 0;
|
||||
}
|
||||
|
||||
DEBUG_COMMAND("Gpx.IsPixel %d,%p:\n", p1, var);
|
||||
@@ -287,7 +286,7 @@ static void IsAlpha() {
|
||||
if (s == NULL) {
|
||||
*var = 0;
|
||||
} else {
|
||||
*var = s->has_alpha ? 1 : 0;
|
||||
*var = s->alpha ? 1 : 0;
|
||||
}
|
||||
|
||||
DEBUG_COMMAND("Gpx.IsAlpha %d,%p:\n", p1, var);
|
||||
@@ -421,7 +420,6 @@ static void Copy() {
|
||||
|
||||
DEBUG_COMMAND("Gpx.Copy %d,%d,%d,%d,%d,%d,%d,%d:\n", ds, dx, dy, ss, sx, sy, sw, sh);
|
||||
|
||||
ags_sync();
|
||||
src = sf_get(ss);
|
||||
dst = sf_get(ds);
|
||||
gr_copy(dst, dx, dy, src, sx, sy, sw, sh);
|
||||
@@ -466,7 +464,6 @@ static void CopyAMap() {
|
||||
|
||||
DEBUG_COMMAND("Gpx.CopyAMap %d,%d,%d,%d,%d,%d,%d,%d:\n", da, dx, dy, sa, sx, sy, sw, sh);
|
||||
|
||||
ags_sync();
|
||||
src = sf_get(sa);
|
||||
dst = sf_get(da);
|
||||
gr_copy_alpha_map(dst, dx, dy, src, sx, sy, sw, sh);
|
||||
@@ -539,7 +536,6 @@ static void BlendAMap() {
|
||||
|
||||
DEBUG_COMMAND("Gpx.BlendAMap %d,%d,%d,%d,%d,%d,%d,%d:\n", ds, dx, dy, ss, sx, sy, sw, sh);
|
||||
|
||||
ags_sync();
|
||||
src = sf_get(ss);
|
||||
dst = sf_get(ds);
|
||||
gr_blend_alpha_map(dst, dx, dy, src, sx, sy, sw, sh);
|
||||
@@ -716,7 +712,6 @@ static void Fill() {
|
||||
|
||||
DEBUG_COMMAND("Gpx.Fill %d,%d,%d,%d,%d,%d,%d,%d:\n", ds, dx, dy, dw, dh, r, g, b);
|
||||
|
||||
ags_sync();
|
||||
dst = sf_get(ds);
|
||||
gr_fill(dst, dx, dy, dw, dh, r, g, b);
|
||||
}
|
||||
@@ -735,7 +730,6 @@ static void FillAlphaColor() { /* not used ? */
|
||||
|
||||
DEBUG_COMMAND_YET("Gpx.FillAlphaColor %d,%d,%d,%d,%d,%d,%d,%d,%d:\n", ds, dx, dy, dw, dh, r, g, b, lv);
|
||||
|
||||
ags_sync();
|
||||
dst = sf_get(ds);
|
||||
gr_fill_alpha_color(dst, dx, dy, dw, dh, r, g, b, lv);
|
||||
}
|
||||
@@ -857,7 +851,6 @@ static void SpriteCopyAMap() {
|
||||
|
||||
DEBUG_COMMAND("Gpx.SpriteCopyAMap %d,%d,%d,%d,%d,%d,%d,%d,%d:\n", da, dx, dy, sa, sx, sy, sw, sh, cl);
|
||||
|
||||
ags_sync();
|
||||
src = sf_get(sa);
|
||||
dst = sf_get(da);
|
||||
gr_copy_alpha_map_sprite(dst, dx, dy, src, sx, sy, sw, sh, cl);
|
||||
@@ -885,7 +878,6 @@ static void BrightDestOnly() {
|
||||
|
||||
DEBUG_COMMAND("Gpx.BrightDestOnly %d,%d,%d,%d,%d,%d:\n", ds, dx, dy, dw, dh, r);
|
||||
|
||||
ags_sync();
|
||||
dst = sf_get(ds);
|
||||
|
||||
gr_bright_dst_only(dst, dx, dy, dw, dh, r);
|
||||
@@ -1005,7 +997,6 @@ static void CopyStretchBlendAMap() {
|
||||
|
||||
DEBUG_COMMAND("Gpx.CopyStretchBlendAMap %d,%d,%d,%d,%d,%d,%d,%d,%d,%d:\n", ds, dx, dy, dw, dh, ss, sx, sy, sw, sh);
|
||||
|
||||
ags_sync();
|
||||
src = sf_get(ss);
|
||||
dst = sf_get(ds);
|
||||
gr_copy_stretch_blend_alpha_map(dst, dx, dy, dw, dh, src, sx, sy, sw, sh);
|
||||
@@ -1057,7 +1048,6 @@ static void StretchBlendScreen2x2WDS() {
|
||||
|
||||
DEBUG_COMMAND("Gpx.StretchBlendScreen2x2WDS %d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d:\n", ds, dx, dy, ss1, sx1, sy1, ss2, sx2, sy2, sw, sh);
|
||||
|
||||
ags_sync();
|
||||
src1 = sf_get(ss1);
|
||||
src2 = sf_get(ss2);
|
||||
dst = sf_get(ds);
|
||||
@@ -1095,7 +1085,6 @@ static void BlendScreenWDS() {
|
||||
|
||||
DEBUG_COMMAND("Gpx.BlendScreenWDS %d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d:\n", ds, dx, dy, ss1, sx1, sy1, ss2, sx2, sy2, sw, sh);
|
||||
|
||||
ags_sync();
|
||||
src1 = sf_get(ss1);
|
||||
src2 = sf_get(ss2);
|
||||
dst = sf_get(ds);
|
||||
@@ -1162,7 +1151,6 @@ static void EffectCopy() {
|
||||
default:
|
||||
DEBUG_COMMAND_YET("Gpx.EffectCopy %d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%p:\n", no, dx, dy, ss1, sx1, sy1, ss2, sx2, sy2, sw, sh, time, var);
|
||||
}
|
||||
ags_sync();
|
||||
dib = sf_get(0);
|
||||
dst = sf_get(ss1);
|
||||
src = sf_get(ss2);
|
||||
|
||||
@@ -169,21 +169,6 @@ void sf_blend_white_level(surface_t *dst, int dx, int dy, surface_t *src, int sx
|
||||
dp = GETOFFSET_PIXEL(dst, dx, dy);
|
||||
|
||||
switch(dst->depth) {
|
||||
case 15:
|
||||
{
|
||||
WORD *yls, *yld;
|
||||
|
||||
for (y = 0; y < sh; y++) {
|
||||
yls = (WORD *)(sp + y * src->bytes_per_line);
|
||||
yld = (WORD *)(dp + y * dst->bytes_per_line);
|
||||
|
||||
for (x = 0; x < sw; x++) {
|
||||
*yld = WHITELEVEL15(*yls, lv);
|
||||
yls++; yld++;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 16:
|
||||
{
|
||||
WORD *yls, *yld;
|
||||
|
||||
@@ -26,7 +26,7 @@ static void Start() {
|
||||
int *p1 = getCaliVariable();
|
||||
int p2 = getCaliValue();
|
||||
|
||||
msgskipfile = strdup(v_str(p2 -1));
|
||||
msgskipfile = strdup(svar_get(p2));
|
||||
|
||||
DEBUG_COMMAND_YET("MsgSkip.Start %p,%d:\n", p1, p2);
|
||||
}
|
||||
|
||||
@@ -193,8 +193,6 @@ void nt_gr_draw(int effectno) {
|
||||
void nt_gr_screencg(int no, int x, int y) {
|
||||
surface_t *sf;
|
||||
|
||||
ags_sync();
|
||||
|
||||
sf = sf_loadcg_no(no -1);
|
||||
|
||||
gre_BlendScreen(sf0, x, y, sf0, x, y, sf, 0, 0, sf->width, sf->height);
|
||||
|
||||
@@ -77,7 +77,7 @@ static void ntmain(struct _scoadr inadr) {
|
||||
if (!nact->is_message_locked) {
|
||||
sys_getInputInfo();
|
||||
}
|
||||
WaitVsync();
|
||||
sdl_wait_vsync();
|
||||
nact->frame_count++;
|
||||
nact->wait_vsync = FALSE;
|
||||
}
|
||||
|
||||
@@ -308,15 +308,15 @@ int nt_scg_cut(int wNumDstCG, int wNumSrcCG, int wX, int wY, int wWidth, int wHe
|
||||
i->refcnt = 0;
|
||||
|
||||
src = srccg->sf;
|
||||
if (src->has_alpha) {
|
||||
if (src->alpha) {
|
||||
dst = sf_create_surface(wWidth, wHeight, src->depth);
|
||||
} else {
|
||||
dst = sf_create_pixel(wWidth, wHeight, src->depth);
|
||||
}
|
||||
if (src->has_pixel) {
|
||||
if (src->pixel) {
|
||||
gr_copy(dst, 0, 0, src, wX, wY, wWidth, wHeight);
|
||||
}
|
||||
if (src->has_alpha) {
|
||||
if (src->alpha) {
|
||||
gr_copy_alpha_map(dst, 0, 0, src, wX, wY, wWidth, wHeight);
|
||||
}
|
||||
|
||||
@@ -349,17 +349,17 @@ int nt_scg_partcopy(int wNumDstCG, int wNumSrcCG, int wX, int wY, int wWidth, in
|
||||
i->refcnt = 0;
|
||||
|
||||
src = srccg->sf;
|
||||
if (src->has_alpha) {
|
||||
if (src->alpha) {
|
||||
dst = sf_create_surface(src->width, src->height, src->depth);
|
||||
gr_fill_alpha_map(dst, 0, 0, src->width, src->height, 255);
|
||||
} else {
|
||||
dst = sf_create_pixel(src->width, src->height, src->depth);
|
||||
}
|
||||
|
||||
if (src->has_pixel) {
|
||||
if (src->pixel) {
|
||||
gr_copy(dst, wX, wY, src, wX, wY, wWidth, wHeight);
|
||||
}
|
||||
if (src->has_alpha) {
|
||||
if (src->alpha) {
|
||||
gr_copy_alpha_map(dst, wX, wY, src, wX, wY, wWidth, wHeight);
|
||||
}
|
||||
|
||||
@@ -484,7 +484,7 @@ int nt_scg_existalphamap(int wNumCG, int *ret) {
|
||||
if (cgs[wNumCG] == NULL) goto errexit;
|
||||
if (cgs[wNumCG]->sf == NULL) goto errexit;
|
||||
|
||||
*ret = cgs[wNumCG]->sf->has_alpha ? 1 : 0;
|
||||
*ret = cgs[wNumCG]->sf->alpha ? 1 : 0;
|
||||
|
||||
errexit:
|
||||
*ret = 0;
|
||||
|
||||
@@ -4,7 +4,7 @@ static surface_t *blend(surface_t *base, int x, int y, surface_t *blend, int mod
|
||||
|
||||
gr_copy(dst, 0, 0, base, 0, 0, base->width, base->height);
|
||||
|
||||
if (base->has_alpha) {
|
||||
if (base->alpha) {
|
||||
// ベースに alpha map がある場合はそれをコピー
|
||||
gr_copy_alpha_map(dst, 0, 0, base, 0, 0, base->width, base->height);
|
||||
} else {
|
||||
@@ -12,7 +12,7 @@ static surface_t *blend(surface_t *base, int x, int y, surface_t *blend, int mod
|
||||
gr_fill_alpha_map(dst, 0, 0, base->width, base->height, 255);
|
||||
}
|
||||
|
||||
if (blend->has_alpha) {
|
||||
if (blend->alpha) {
|
||||
// 重ね合わせ先の alpha map があるときはそれを使う
|
||||
gre_BlendUseAMap(dst, x, y, base, x, y, blend, 0, 0, blend->width, blend->height, blend, 0, 0, 255);
|
||||
} else {
|
||||
|
||||
@@ -12,13 +12,11 @@ static surface_t *stretch(surface_t *src, int dw, int dh, int mirror) {
|
||||
dst->depth = src->depth;
|
||||
dst->bytes_per_line = dw * src->bytes_per_pixel;
|
||||
dst->bytes_per_pixel = src->bytes_per_pixel;
|
||||
dst->has_pixel = src->has_pixel;
|
||||
dst->has_alpha = src->has_alpha;
|
||||
|
||||
if (src->has_pixel) {
|
||||
if (src->pixel) {
|
||||
dst->pixel = malloc(dh * dst->bytes_per_line);
|
||||
}
|
||||
if (src->has_alpha) {
|
||||
if (src->alpha) {
|
||||
dst->alpha = malloc(dw * dh);
|
||||
}
|
||||
|
||||
@@ -78,7 +76,6 @@ static surface_t *stretch(surface_t *src, int dw, int dh, int mirror) {
|
||||
switch(dst->depth) {
|
||||
case 8:
|
||||
SCALEDCOPYAREA(BYTE); break;
|
||||
case 15:
|
||||
case 16:
|
||||
SCALEDCOPYAREA(WORD); break;
|
||||
case 24:
|
||||
@@ -88,7 +85,7 @@ static surface_t *stretch(surface_t *src, int dw, int dh, int mirror) {
|
||||
break;
|
||||
}
|
||||
|
||||
if (src->has_alpha) {
|
||||
if (src->alpha) {
|
||||
int x, y;
|
||||
BYTE *sl, *dl;
|
||||
BYTE *_sl, *_dl;
|
||||
|
||||
@@ -118,7 +118,7 @@ int nt_sstr_num2str(int strno, int fig, int nzeropad, int num) {
|
||||
}
|
||||
|
||||
sprintf(s, ss, num);
|
||||
v_strcpy(strno -1, s);
|
||||
svar_set(strno, s);
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
@@ -76,7 +76,7 @@ int nt_sp_draw2(sprite_t *sp, cginfo_t *cg, MyRectangle *r) {
|
||||
dx += r->x;
|
||||
dy += r->y;
|
||||
|
||||
if (cg->sf->has_alpha) {
|
||||
if (cg->sf->alpha) {
|
||||
// alpha map がある場合
|
||||
gre_BlendUseAMap(sf0, dx, dy,
|
||||
sf0, dx, dy,
|
||||
|
||||
@@ -255,7 +255,7 @@ static void ec14_cb(surface_t *sfsrc, surface_t *sfdst) {
|
||||
if (ecp.oldstep == 0) {
|
||||
sf_copyall(sf0, sfdst);
|
||||
}
|
||||
Maskupdate(0, 0, sfsrc->width, sfsrc->height, 0, 0, 44, curstep);
|
||||
sdl_maskupdate(0, 0, sfsrc->width, sfsrc->height, 0, 0, 44, curstep);
|
||||
ecp.oldstep = curstep;
|
||||
}
|
||||
|
||||
@@ -268,7 +268,7 @@ static void ec15_cb(surface_t *sfsrc, surface_t *sfdst) {
|
||||
if (ecp.oldstep == 0) {
|
||||
sf_copyall(sf0, sfdst);
|
||||
}
|
||||
Maskupdate(0, 0, sfsrc->width, sfsrc->height, 0, 0, 45, curstep);
|
||||
sdl_maskupdate(0, 0, sfsrc->width, sfsrc->height, 0, 0, 45, curstep);
|
||||
ecp.oldstep = curstep;
|
||||
}
|
||||
|
||||
@@ -281,7 +281,7 @@ static void ec16_cb(surface_t *sfsrc, surface_t *sfdst) {
|
||||
if (ecp.oldstep == 0) {
|
||||
sf_copyall(sf0, sfdst);
|
||||
}
|
||||
Maskupdate(0, 0, sfsrc->width, sfsrc->height, 0, 0, 46, curstep);
|
||||
sdl_maskupdate(0, 0, sfsrc->width, sfsrc->height, 0, 0, 46, curstep);
|
||||
ecp.oldstep = curstep;
|
||||
}
|
||||
|
||||
@@ -294,7 +294,7 @@ static void ec17_cb(surface_t *sfsrc, surface_t *sfdst) {
|
||||
if (ecp.oldstep == 0) {
|
||||
sf_copyall(sf0, sfdst);
|
||||
}
|
||||
Maskupdate(0, 0, sfsrc->width, sfsrc->height, 0, 0, 47, curstep);
|
||||
sdl_maskupdate(0, 0, sfsrc->width, sfsrc->height, 0, 0, 47, curstep);
|
||||
ecp.oldstep = curstep;
|
||||
}
|
||||
|
||||
|
||||
@@ -67,28 +67,23 @@ static void disjunction(void* region, void* data) {
|
||||
MyRectangle *r2 = (MyRectangle *)data;
|
||||
int x1, x2, y1, y2;
|
||||
|
||||
//SACT_DEBUG("r1x=%d,r1y=%d,r1w=%d,r1h=%d\n", r1->x, r1->y, r1->width, r1->height);
|
||||
//SACT_DEBUG("r2x=%d,r2y=%d,r2w=%d,r2h=%d\n", r2->x, r2->y, r2->width, r2->height);
|
||||
|
||||
if (r2->width == 0) {
|
||||
r2->x = r1->x;
|
||||
r2->y = r1->y;
|
||||
r2->width = r1->width;
|
||||
r2->height = r1->height;
|
||||
return;
|
||||
} else {
|
||||
x1 = min(r1->x, r2->x);
|
||||
x2 = max(r1->x + r1->width, r2->x + r2->width);
|
||||
y1 = min(r1->y, r2->y);
|
||||
y2 = max(r1->y + r1->height, r2->y + r2->height);
|
||||
|
||||
r2->x = x1;
|
||||
r2->y = y1;
|
||||
r2->width = x2 - x1;
|
||||
r2->height = y2 - y1;
|
||||
}
|
||||
|
||||
x1 = min(r1->x, r2->x);
|
||||
x2 = max(r1->x + r1->width, r2->x + r2->width);
|
||||
y1 = min(r1->y, r2->y);
|
||||
y2 = max(r1->y + r1->height, r2->y + r2->height);
|
||||
|
||||
r2->x = x1;
|
||||
r2->y = y1;
|
||||
r2->width = x2 - x1;
|
||||
r2->height = y2 - y1;
|
||||
|
||||
//SACT_DEBUG("res:r2x=%d,r2y=%d,r2w=%d,r2h=%d\n", r2->x, r2->y, r2->width, r2->height);
|
||||
free(r1);
|
||||
}
|
||||
|
||||
// 更新の必要なスプライトの領域の和をとってクリッピングする
|
||||
|
||||
@@ -37,16 +37,6 @@ static void ppm2surface(surface_t *sf, int curscanline, unsigned char *src, int
|
||||
BYTE *dp = GETOFFSET_PIXEL(sf, 0, curscanline);
|
||||
|
||||
switch (sf->depth) {
|
||||
case 15:
|
||||
{
|
||||
WORD *dst = (WORD *)dp;
|
||||
while (width--) {
|
||||
*dst = PIX15(*src, *(src +1), *(src +2));
|
||||
dst++; src+= 3;
|
||||
}
|
||||
break;
|
||||
|
||||
}
|
||||
case 16:
|
||||
{
|
||||
WORD *dst = (WORD *)dp;
|
||||
|
||||
@@ -205,10 +205,10 @@ int scg_create_text(int wNumCG, int wSize, int wR, int wG, int wB, int wText) {
|
||||
spcg_assert_no(wNumCG);
|
||||
|
||||
// 勝手に出ていいのかな?
|
||||
if (v_strlen(wText -1) == 0) return OK;
|
||||
if (svar_length(wText) == 0) return OK;
|
||||
|
||||
ags_setFont(FONT_GOTHIC, wSize);
|
||||
agsurface_t *glyph = ags_drawStringToSurface(v_str(wText -1));
|
||||
agsurface_t *glyph = ags_drawStringToSurface(svar_get(wText));
|
||||
i = malloc(sizeof(cginfo_t));
|
||||
i->type = CG_SET;
|
||||
i->no = wNumCG;
|
||||
@@ -306,15 +306,15 @@ int scg_cut(int wNumDstCG, int wNumSrcCG, int wX, int wY, int wWidth, int wHeigh
|
||||
i->refcnt = 0;
|
||||
|
||||
src = srccg->sf;
|
||||
if (src->has_alpha) {
|
||||
if (src->alpha) {
|
||||
dst = sf_create_surface(wWidth, wHeight, src->depth);
|
||||
} else {
|
||||
dst = sf_create_pixel(wWidth, wHeight, src->depth);
|
||||
}
|
||||
if (src->has_pixel) {
|
||||
if (src->pixel) {
|
||||
gr_copy(dst, 0, 0, src, wX, wY, wWidth, wHeight);
|
||||
}
|
||||
if (src->has_alpha) {
|
||||
if (src->alpha) {
|
||||
gr_copy_alpha_map(dst, 0, 0, src, wX, wY, wWidth, wHeight);
|
||||
}
|
||||
|
||||
@@ -347,17 +347,17 @@ int scg_partcopy(int wNumDstCG, int wNumSrcCG, int wX, int wY, int wWidth, int w
|
||||
i->refcnt = 0;
|
||||
|
||||
src = srccg->sf;
|
||||
if (src->has_alpha) {
|
||||
if (src->alpha) {
|
||||
dst = sf_create_surface(src->width, src->height, src->depth);
|
||||
gr_fill_alpha_map(dst, 0, 0, src->width, src->height, 255);
|
||||
} else {
|
||||
dst = sf_create_pixel(src->width, src->height, src->depth);
|
||||
}
|
||||
|
||||
if (src->has_pixel) {
|
||||
if (src->pixel) {
|
||||
gr_copy(dst, wX, wY, src, wX, wY, wWidth, wHeight);
|
||||
}
|
||||
if (src->has_alpha) {
|
||||
if (src->alpha) {
|
||||
gr_copy_alpha_map(dst, wX, wY, src, wX, wY, wWidth, wHeight);
|
||||
}
|
||||
|
||||
@@ -482,7 +482,7 @@ int scg_existalphamap(int wNumCG, int *ret) {
|
||||
if (sact.cg[wNumCG] == NULL) goto errexit;
|
||||
if (sact.cg[wNumCG]->sf == NULL) goto errexit;
|
||||
|
||||
*ret = sact.cg[wNumCG]->sf->has_alpha ? 1 : 0;
|
||||
*ret = sact.cg[wNumCG]->sf->alpha ? 1 : 0;
|
||||
|
||||
errexit:
|
||||
*ret = 0;
|
||||
|
||||
@@ -4,7 +4,7 @@ static surface_t *blend(surface_t *base, int x, int y, surface_t *blend, int mod
|
||||
|
||||
gr_copy(dst, 0, 0, base, 0, 0, base->width, base->height);
|
||||
|
||||
if (base->has_alpha) {
|
||||
if (base->alpha) {
|
||||
// ベースに alpha map がある場合はそれをコピー
|
||||
gr_copy_alpha_map(dst, 0, 0, base, 0, 0, base->width, base->height);
|
||||
} else {
|
||||
@@ -12,7 +12,7 @@ static surface_t *blend(surface_t *base, int x, int y, surface_t *blend, int mod
|
||||
gr_fill_alpha_map(dst, 0, 0, base->width, base->height, 255);
|
||||
}
|
||||
|
||||
if (blend->has_alpha) {
|
||||
if (blend->alpha) {
|
||||
// 重ね合わせ先の alpha map があるときはそれを使う
|
||||
gre_BlendUseAMap(dst, x, y, base, x, y, blend, 0, 0, blend->width, blend->height, blend, 0, 0, 255);
|
||||
} else {
|
||||
|
||||
@@ -12,13 +12,11 @@ static surface_t *stretch(surface_t *src, int dw, int dh, int mirror) {
|
||||
dst->depth = src->depth;
|
||||
dst->bytes_per_line = dw * src->bytes_per_pixel;
|
||||
dst->bytes_per_pixel = src->bytes_per_pixel;
|
||||
dst->has_pixel = src->has_pixel;
|
||||
dst->has_alpha = src->has_alpha;
|
||||
|
||||
if (src->has_pixel) {
|
||||
if (src->pixel) {
|
||||
dst->pixel = malloc(dh * dst->bytes_per_line);
|
||||
}
|
||||
if (src->has_alpha) {
|
||||
if (src->alpha) {
|
||||
dst->alpha = malloc(dw * dh);
|
||||
}
|
||||
|
||||
@@ -78,7 +76,6 @@ static surface_t *stretch(surface_t *src, int dw, int dh, int mirror) {
|
||||
switch(dst->depth) {
|
||||
case 8:
|
||||
SCALEDCOPYAREA(BYTE); break;
|
||||
case 15:
|
||||
case 16:
|
||||
SCALEDCOPYAREA(WORD); break;
|
||||
case 24:
|
||||
@@ -88,7 +85,7 @@ static surface_t *stretch(surface_t *src, int dw, int dh, int mirror) {
|
||||
break;
|
||||
}
|
||||
|
||||
if (src->has_alpha) {
|
||||
if (src->alpha) {
|
||||
int x, y;
|
||||
BYTE *sl, *dl;
|
||||
BYTE *_sl, *_dl;
|
||||
|
||||
@@ -47,7 +47,7 @@ int scryp_encrypt_str(int strno, int key) {
|
||||
}
|
||||
|
||||
int scryp_decrypt_str(int strno, int key) {
|
||||
WARNING("str = '%s'\n", v_str(strno -1));
|
||||
WARNING("str = '%s'\n", svar_get(strno));
|
||||
WARNING("NOT IMPLEMENTED\n");
|
||||
return OK;
|
||||
}
|
||||
|
||||
@@ -56,7 +56,7 @@ int sstr_push(int strno) {
|
||||
idxmax = idx*2;
|
||||
}
|
||||
|
||||
stack[idx++] = strdup(v_str(strno -1));
|
||||
stack[idx++] = strdup(svar_get(strno));
|
||||
|
||||
return OK;
|
||||
}
|
||||
@@ -68,7 +68,7 @@ int sstr_push(int strno) {
|
||||
int sstr_pop(int strno) {
|
||||
if (idx == 0) return NG;
|
||||
|
||||
v_strcpy(strno -1, stack[--idx]);
|
||||
svar_set(strno, stack[--idx]);
|
||||
free(stack[idx]);
|
||||
|
||||
return OK;
|
||||
@@ -85,8 +85,8 @@ int sstr_regist_replace(int sstrno, int dstrno) {
|
||||
if (sstrno == dstrno) return NG;
|
||||
|
||||
ex = malloc(sizeof(strexchange_t));
|
||||
ex->src = strdup(v_str(sstrno -1));
|
||||
ex->dst = strdup(v_str(dstrno -1));
|
||||
ex->src = strdup(svar_get(sstrno));
|
||||
ex->dst = strdup(svar_get(dstrno));
|
||||
sact.strreplace = slist_append(sact.strreplace, ex);
|
||||
return OK;
|
||||
}
|
||||
@@ -106,7 +106,7 @@ int sstr_num2str(int strno, int fig, int nzeropad, int num) {
|
||||
}
|
||||
|
||||
sprintf(s, ss, num);
|
||||
v_strcpy(strno -1, s);
|
||||
svar_set(strno, s);
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
@@ -117,7 +117,7 @@ int sp_draw2(sprite_t *sp, cginfo_t *cg) {
|
||||
dx += sact.updaterect.x;
|
||||
dy += sact.updaterect.y;
|
||||
|
||||
if (cg->sf->has_alpha) {
|
||||
if (cg->sf->alpha) {
|
||||
// alpha map がある場合
|
||||
gre_BlendUseAMap(sf0, dx, dy,
|
||||
sf0, dx, dy,
|
||||
@@ -175,7 +175,7 @@ void sp_draw_dmap(void* data, void* userdata) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (cg->sf->has_alpha) {
|
||||
if (cg->sf->alpha) {
|
||||
fill_dmap_mask(cg->sf, sx, sy, dx, dy, w, h, sp->no);
|
||||
} else {
|
||||
fill_dmap(dx, dy, w, h, sp->no);
|
||||
|
||||
@@ -298,7 +298,7 @@ static void ec14_cb(surface_t *sfsrc, surface_t *sfdst) {
|
||||
if (ecp.oldstep == 0) {
|
||||
sf_copyall(sf0, sfdst);
|
||||
}
|
||||
Maskupdate(0, 0, sfsrc->width, sfsrc->height, 0, 0, 44, curstep);
|
||||
sdl_maskupdate(0, 0, sfsrc->width, sfsrc->height, 0, 0, 44, curstep);
|
||||
ecp.oldstep = curstep;
|
||||
}
|
||||
|
||||
@@ -311,7 +311,7 @@ static void ec15_cb(surface_t *sfsrc, surface_t *sfdst) {
|
||||
if (ecp.oldstep == 0) {
|
||||
sf_copyall(sf0, sfdst);
|
||||
}
|
||||
Maskupdate(0, 0, sfsrc->width, sfsrc->height, 0, 0, 45, curstep);
|
||||
sdl_maskupdate(0, 0, sfsrc->width, sfsrc->height, 0, 0, 45, curstep);
|
||||
ecp.oldstep = curstep;
|
||||
}
|
||||
|
||||
@@ -324,7 +324,7 @@ static void ec16_cb(surface_t *sfsrc, surface_t *sfdst) {
|
||||
if (ecp.oldstep == 0) {
|
||||
sf_copyall(sf0, sfdst);
|
||||
}
|
||||
Maskupdate(0, 0, sfsrc->width, sfsrc->height, 0, 0, 46, curstep);
|
||||
sdl_maskupdate(0, 0, sfsrc->width, sfsrc->height, 0, 0, 46, curstep);
|
||||
ecp.oldstep = curstep;
|
||||
}
|
||||
|
||||
@@ -337,7 +337,7 @@ static void ec17_cb(surface_t *sfsrc, surface_t *sfdst) {
|
||||
if (ecp.oldstep == 0) {
|
||||
sf_copyall(sf0, sfdst);
|
||||
}
|
||||
Maskupdate(0, 0, sfsrc->width, sfsrc->height, 0, 0, 47, curstep);
|
||||
sdl_maskupdate(0, 0, sfsrc->width, sfsrc->height, 0, 0, 47, curstep);
|
||||
ecp.oldstep = curstep;
|
||||
}
|
||||
|
||||
|
||||
@@ -10,7 +10,6 @@ static void do_aff(surface_t *in, surface_t *out, int deg, double zx, double zy)
|
||||
int i, j, m, n;
|
||||
|
||||
switch(in->depth) {
|
||||
case 15:
|
||||
case 16: {
|
||||
WORD *src, *dst;
|
||||
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
static void ec6_cb(surface_t *src, surface_t *dst) {
|
||||
int curstep, maxstep = 32;
|
||||
surface_t *st, *dt;
|
||||
static int slices[32]={4,8,12,16,20,28,36,40,44,48,56,64,72,80,88,96,
|
||||
88,80,72,64,56,48,44,40,36,28,24,20,16,12,8,4};
|
||||
static int slices[32]={4,8,12,16,20,28,36,40,44,48,56,64,72,80,88,96,
|
||||
88,80,72,64,56,48,44,40,36,28,24,20,16,12,8,4};
|
||||
|
||||
|
||||
curstep = maxstep * (ecp.curtime - ecp.sttime)/ (ecp.edtime - ecp.sttime);
|
||||
@@ -17,9 +17,13 @@ static void ec6_cb(surface_t *src, surface_t *dst) {
|
||||
st = sf_dup(src);
|
||||
dt = sf_dup(dst);
|
||||
|
||||
image_Mosaic(st, 0, 0, st->width, st->height, 0, 0, slices[curstep]);
|
||||
image_Mosaic(dt, 0, 0, dt->width, dt->height, 0, 0, slices[curstep]);
|
||||
|
||||
SDL_Surface *stt = com2surface(st);
|
||||
SDL_Surface *dtt = com2surface(dt);
|
||||
image_Mosaic(stt, 0, 0, stt->w, stt->h, 0, 0, slices[curstep]);
|
||||
image_Mosaic(dtt, 0, 0, dtt->w, dtt->h, 0, 0, slices[curstep]);
|
||||
SDL_FreeSurface(stt);
|
||||
SDL_FreeSurface(dtt);
|
||||
|
||||
gre_Blend(sf0, 0, 0, st, 0, 0, dt, 0, 0, st->width, st->height, curstep*8);
|
||||
ags_updateFull();
|
||||
|
||||
|
||||
@@ -44,7 +44,6 @@ static void do_per(surface_t *in, surface_t *out, float *k) {
|
||||
int ys = in->height /2;
|
||||
|
||||
switch(in->depth) {
|
||||
case 15:
|
||||
case 16: {
|
||||
WORD *src, *dst;
|
||||
|
||||
|
||||
@@ -4,7 +4,6 @@ static void uneune(surface_t *in, surface_t *out, int st) {
|
||||
int x, y, m, n;
|
||||
|
||||
switch(in->depth) {
|
||||
case 15:
|
||||
case 16: {
|
||||
WORD *src, *dst;
|
||||
for (y = 0; y < in->height; y++) {
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
#include <stdlib.h>
|
||||
#include "ngraph.h"
|
||||
#include "graph.h"
|
||||
|
||||
@@ -42,7 +43,10 @@ static void ec10_cb(surface_t *sfsrc, surface_t *sfdst) {
|
||||
if (ec10_sf[0] == NULL) {
|
||||
ec10_sf[0] = sf_dup2(sfsrc, FALSE, FALSE);
|
||||
sf = ec10_sf[0];
|
||||
sf->has_alpha = FALSE;
|
||||
if (sf->alpha) {
|
||||
free(sf->alpha);
|
||||
sf->alpha = NULL;
|
||||
}
|
||||
gr_copy_stretch(sf, 0, 0, sf->width, sf->height, sfsrc, sx, sy, sw, sh);
|
||||
gr_bright_dst_only(sf, 0, 0, sf->width, sf->height, 255/6);
|
||||
return;
|
||||
|
||||
@@ -164,7 +164,7 @@ void spev_move_waitend(sprite_t *sp, int dx, int dy, int time) {
|
||||
|
||||
while (sp->move.moving) {
|
||||
nact->callback();
|
||||
WaitVsync();
|
||||
sdl_wait_vsync();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -183,7 +183,7 @@ void spev_wait4moving_sp() {
|
||||
|
||||
while (sp->move.moving) {
|
||||
nact->callback();
|
||||
WaitVsync();
|
||||
sdl_wait_vsync();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -284,7 +284,7 @@ void ssel_add(int nString, int wI) {
|
||||
free(sact.sel.elem[wI]);
|
||||
}
|
||||
|
||||
sact.sel.elem[wI] = strdup(v_str(nString -1));
|
||||
sact.sel.elem[wI] = strdup(svar_get(nString));
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -63,28 +63,23 @@ static void disjunction(void* region, void* data) {
|
||||
MyRectangle *r2 = (MyRectangle *)data;
|
||||
int x1, x2, y1, y2;
|
||||
|
||||
//SACT_DEBUG("r1x=%d,r1y=%d,r1w=%d,r1h=%d\n", r1->x, r1->y, r1->width, r1->height);
|
||||
//SACT_DEBUG("r2x=%d,r2y=%d,r2w=%d,r2h=%d\n", r2->x, r2->y, r2->width, r2->height);
|
||||
|
||||
if (r2->width == 0) {
|
||||
r2->x = r1->x;
|
||||
r2->y = r1->y;
|
||||
r2->width = r1->width;
|
||||
r2->height = r1->height;
|
||||
return;
|
||||
} else {
|
||||
x1 = min(r1->x, r2->x);
|
||||
x2 = max(r1->x + r1->width, r2->x + r2->width);
|
||||
y1 = min(r1->y, r2->y);
|
||||
y2 = max(r1->y + r1->height, r2->y + r2->height);
|
||||
|
||||
r2->x = x1;
|
||||
r2->y = y1;
|
||||
r2->width = x2 - x1;
|
||||
r2->height = y2 - y1;
|
||||
}
|
||||
|
||||
x1 = min(r1->x, r2->x);
|
||||
x2 = max(r1->x + r1->width, r2->x + r2->width);
|
||||
y1 = min(r1->y, r2->y);
|
||||
y2 = max(r1->y + r1->height, r2->y + r2->height);
|
||||
|
||||
r2->x = x1;
|
||||
r2->y = y1;
|
||||
r2->width = x2 - x1;
|
||||
r2->height = y2 - y1;
|
||||
|
||||
//SACT_DEBUG("res:r2x=%d,r2y=%d,r2w=%d,r2h=%d\n", r2->x, r2->y, r2->width, r2->height);
|
||||
free(r1);
|
||||
}
|
||||
|
||||
// 更新の必要なスプライトの領域の和をとってクリッピングする
|
||||
|
||||
@@ -67,7 +67,7 @@ int spxm_getnum(int reginum) {
|
||||
|
||||
int spxm_gettext(int reginum, int strno) {
|
||||
if (reginum > SEL_ELEMENT_MAX) return NG;
|
||||
v_strcpy(strno -1, xmenu.item[reginum]);
|
||||
svar_set(strno, xmenu.item[reginum]);
|
||||
return OK;
|
||||
}
|
||||
|
||||
@@ -78,6 +78,6 @@ int spxm_titlereg(void) {
|
||||
}
|
||||
|
||||
int spxm_titleget(int strno) {
|
||||
v_strcpy(strno -1, xmenu.title);
|
||||
svar_set(strno, xmenu.title);
|
||||
return OK;
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@
|
||||
#include "ags.h"
|
||||
#include "counter.h"
|
||||
#include "music.h"
|
||||
#include "graphicsdevice.h"
|
||||
#include "sdl_core.h"
|
||||
|
||||
#define SLOT 40
|
||||
|
||||
@@ -142,29 +142,11 @@ static void ChangeNotColor() {
|
||||
DEBUG_COMMAND("ShGraph.ChangeNotColor %d,%d,%d,%d,%p,%p,%d:\n", x0, y0, width, height, src, dst, p7);
|
||||
|
||||
ags_check_param(&x0, &y0, &width, &height);
|
||||
ags_sync();
|
||||
|
||||
dib = nact->ags.dib;
|
||||
dp = GETOFFSET_PIXEL(dib, x0, y0);
|
||||
|
||||
switch(dib->depth) {
|
||||
case 15:
|
||||
{
|
||||
WORD pic15s = PIX15(*src, *(src+1), *(src+2));
|
||||
WORD pic15d = PIX15(*dst, *(dst+1), *(dst+2));
|
||||
WORD *yl;
|
||||
|
||||
for (y = 0; y < height; y++) {
|
||||
yl = (WORD *)(dp + y * dib->bytes_per_line);
|
||||
for (x = 0; x < width; x++) {
|
||||
if (*yl != pic15s) {
|
||||
*yl = pic15d;
|
||||
}
|
||||
yl++;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 16:
|
||||
{
|
||||
WORD pic16s = PIX16(*src, *(src+1), *(src+2));
|
||||
@@ -508,7 +490,6 @@ static void PlayAnimeData() {
|
||||
ags_copyArea(mapback.x, mapback.y,
|
||||
mapback.width, mapback.height,
|
||||
mapback_p5, mapback_p6);
|
||||
ags_sync();
|
||||
}
|
||||
|
||||
if (wavno != 0) {
|
||||
@@ -566,7 +547,7 @@ static void PlayAnimeData() {
|
||||
{
|
||||
int now = get_high_counter(SYSTEMCOUNTER_MSEC);
|
||||
if (now - cnt < interval) {
|
||||
Sleep(interval - (now-cnt));
|
||||
sdl_sleep(interval - (now-cnt));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -588,23 +569,6 @@ static void copy_sprite(int sx, int sy, int width, int height, int dx, int dy, i
|
||||
dp = GETOFFSET_PIXEL(dib, dx, dy);
|
||||
|
||||
switch(dib->depth) {
|
||||
case 15:
|
||||
{
|
||||
WORD pic15 = PIX15(r, g, b);
|
||||
WORD *yls, *yld;
|
||||
|
||||
for (y = 0; y < height; y++) {
|
||||
yls = (WORD *)(sp + y * dib->bytes_per_line);
|
||||
yld = (WORD *)(dp + y * dib->bytes_per_line);
|
||||
for (x = 0; x < width; x++) {
|
||||
if (*yls != pic15) {
|
||||
*yld = *yls;
|
||||
}
|
||||
yls++; yld++;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 16:
|
||||
{
|
||||
WORD pic16 = PIX16(r, g, b);
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
#include "system.h"
|
||||
#include "xsystem35.h"
|
||||
#include "modules.h"
|
||||
#include "graphicsdevice.h"
|
||||
#include "sdl_core.h"
|
||||
|
||||
// キー変換テーブル
|
||||
#define KEYMAP_MAX 8
|
||||
|
||||
@@ -45,7 +45,7 @@ static void ExchangeString(void) {
|
||||
int target = getCaliValue();
|
||||
int pat = getCaliValue();
|
||||
int patr = getCaliValue();
|
||||
v_strReplaceAll(target - 1, pat - 1, patr - 1);
|
||||
svar_replaceAll(target, pat, patr);
|
||||
DEBUG_COMMAND("ShString.ExchangeString: %d,%d,%d:\n", target, pat, patr);
|
||||
}
|
||||
|
||||
@@ -89,7 +89,7 @@ static void SetWindowTitle(void) { /* 6 */
|
||||
int strno = getCaliValue();
|
||||
int p2 = getCaliValue(); /* ISys3xSystem */
|
||||
|
||||
ags_setWindowTitle(v_str(strno - 1));
|
||||
ags_setWindowTitle(svar_get(strno));
|
||||
|
||||
DEBUG_COMMAND("ShString.SetWindowTitle: %d,%d:\n", strno, p2);
|
||||
}
|
||||
@@ -109,8 +109,8 @@ static void FillString() {
|
||||
int i;
|
||||
|
||||
for (i = 0; i < cnt; i++) {
|
||||
if (st - 1 != src)
|
||||
v_strcpy(st -1, v_str(src));
|
||||
if (st + i != src)
|
||||
svar_set(st + i, svar_get(src));
|
||||
}
|
||||
|
||||
DEBUG_COMMAND("ShString.FillString: %d,%d,%d,%d:\n", st, cnt, src, p4);
|
||||
@@ -126,7 +126,7 @@ static void SetStringNum16(void) {
|
||||
*/
|
||||
int st = getCaliValue();
|
||||
int *var = getCaliVariable();
|
||||
const char *str = v_str(st -1);
|
||||
const char *str = svar_get(st);
|
||||
char _dst[100];
|
||||
char *dst = _dst;
|
||||
|
||||
|
||||
@@ -1,41 +0,0 @@
|
||||
add_library(graph STATIC
|
||||
graph.c
|
||||
surface.c
|
||||
cg.c
|
||||
graph_expandcolor_blend.c
|
||||
graph_fillrect.c
|
||||
graph_fillrect_amap.c
|
||||
graph_fillrect_acolor.c
|
||||
graph_rect.c
|
||||
graph_copy.c
|
||||
graph_copy_amap.c
|
||||
graph_copy_bright.c
|
||||
graph_copy_whiteout.c
|
||||
graph_blend_amap.c
|
||||
graph_blend_screen.c
|
||||
graph_saturadd_amap.c
|
||||
graph_draw_amap.c
|
||||
graph_stretch.c
|
||||
graph_cg.c
|
||||
graph_buller.c
|
||||
gre_blend_useamap.c
|
||||
gre_blend.c
|
||||
gre_blend_screen.c
|
||||
)
|
||||
|
||||
add_library(alk STATIC alk.c)
|
||||
target_compile_options(alk PRIVATE -Wno-pointer-sign)
|
||||
|
||||
add_library(drawtext STATIC drawtext.c)
|
||||
target_compile_options(drawtext PRIVATE -Wno-pointer-sign)
|
||||
|
||||
add_library(list STATIC list.c)
|
||||
|
||||
target_include_directories(graph PUBLIC .)
|
||||
target_include_directories(alk PUBLIC .)
|
||||
target_include_directories(drawtext PUBLIC .)
|
||||
target_include_directories(list PUBLIC .)
|
||||
|
||||
add_executable(lib_test list_test.c)
|
||||
target_link_libraries(lib_test PRIVATE list)
|
||||
add_test(NAME lib_test COMMAND lib_test)
|
||||
@@ -272,28 +272,6 @@ void gr_copy_stretch_blend_alpha_map(surface_t *dst, int dx, int dy, int dw, int
|
||||
}
|
||||
|
||||
switch(dst->depth) {
|
||||
case 15:
|
||||
{
|
||||
WORD *yls, *yld;
|
||||
BYTE *yla;
|
||||
|
||||
for (y = 0; y < dh; y++) {
|
||||
yls = (WORD *)(sp + *(y + col) * src->bytes_per_line);
|
||||
yld = (WORD *)(dp + y * dst->bytes_per_line);
|
||||
yla = (BYTE *)(sa + *(y + col) * src->width);
|
||||
for (x = 0; x < dw; x++) {
|
||||
*(yld + x) = ALPHABLEND15(*(yls+ *(row + x)), *(yld+x), *(yla+*(row+x)));
|
||||
}
|
||||
while(*(col + y) == *(col + y + 1)) {
|
||||
yld += dst->width;
|
||||
for (x = 0; x < dw; x++) {
|
||||
*(yld + x) = ALPHABLEND15(*(yls+ *(row+x)), *(yld+x), *(yla+*(row+x)));
|
||||
}
|
||||
y++;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 16:
|
||||
{
|
||||
WORD *yls, *yld;
|
||||
|
||||
@@ -94,24 +94,6 @@ void gr_blend_alpha_wds(surface_t *src1, int sx1, int sy1, surface_t *src2, int
|
||||
dp = GETOFFSET_PIXEL(dst, dx, dy);
|
||||
|
||||
switch(dst->depth) {
|
||||
case 15:
|
||||
{
|
||||
WORD *yls1, *yls2, *yld;
|
||||
BYTE *yla;
|
||||
|
||||
for (y = 0; y < sh; y++) {
|
||||
yls1 = (WORD *)(sp1 + y * src1->bytes_per_line);
|
||||
yls2 = (WORD *)(sp2 + y * src2->bytes_per_line);
|
||||
yld = (WORD *)(dp + y * dst->bytes_per_line);
|
||||
yla = (BYTE *)(sa + y * src1->width);
|
||||
|
||||
for (x = 0; x < sw; x++) {
|
||||
*yld = SUTURADD15(*yls1, ALPHABLEND15(*yls1, *yls2, *yla));
|
||||
yls1++; yls2++; yld++; yla++;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 16:
|
||||
// if (nact->mmx_is_ok) {
|
||||
if (0) {
|
||||
|
||||
@@ -19,39 +19,6 @@ int gr_buller(surface_t *dst, int dx, int dy, surface_t *src, int sx, int sy, in
|
||||
sp = GETOFFSET_PIXEL(src, sx, sy);
|
||||
dp = GETOFFSET_PIXEL(dst, dx, dy);
|
||||
switch(dst->depth) {
|
||||
case 15:
|
||||
{
|
||||
WORD *yld, *yls;
|
||||
|
||||
for (y = 0; y < height; y++) {
|
||||
yls = (WORD *)(sp + y * src->bytes_per_line);
|
||||
yld = (WORD *)(dp + y * dst->bytes_per_line);
|
||||
for (x = 0; x < step; x++) {
|
||||
*yld = *(yls+step);
|
||||
yls++; yld++;
|
||||
}
|
||||
|
||||
for (; x < (width - step*2); x++) {
|
||||
r1 = PIXR15((*(yls+step)));
|
||||
g1 = PIXG15((*(yls+step)));
|
||||
b1 = PIXB15((*(yls+step)));
|
||||
r2 = PIXR15((*(yls-step)));
|
||||
g2 = PIXG15((*(yls-step)));
|
||||
b2 = PIXB15((*(yls-step)));
|
||||
r3 = min(255, (r1+r2) >> 1);
|
||||
g3 = min(255, (g1+g2) >> 1);
|
||||
b3 = min(255, (b1+b2) >> 1);
|
||||
|
||||
*yld = PIX15(r3, g3, b3);
|
||||
yld++; yls++;
|
||||
}
|
||||
for (; x < width; x++) {
|
||||
*yld = *(yls-step);
|
||||
yls++; yld++;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 16:
|
||||
{
|
||||
WORD *yld, *yls;
|
||||
@@ -137,36 +104,6 @@ int gr_buller_v(surface_t *dst, int dx, int dy, surface_t *src, int sx, int sy,
|
||||
sp = GETOFFSET_PIXEL(src, sx, sy);
|
||||
dp = GETOFFSET_PIXEL(dst, dx, dy);
|
||||
switch(dst->depth) {
|
||||
case 15:
|
||||
{
|
||||
WORD *yld, *yls;
|
||||
|
||||
for (x = 0; x < width; x++) {
|
||||
yls = (WORD *)(sp + x * src->bytes_per_pixel);
|
||||
yld = (WORD *)(dp + x * dst->bytes_per_pixel);
|
||||
for (y = 0; y < step; y++) {
|
||||
*(yld+y*dst->width) = *(yls+(y+step)*src->width);
|
||||
}
|
||||
|
||||
for (; y < (height - step*2); y++) {
|
||||
r1 = PIXR15((*(yls+(y+step)*src->width)));
|
||||
g1 = PIXG15((*(yls+(y+step)*src->width)));
|
||||
b1 = PIXB15((*(yls+(y+step)*src->width)));
|
||||
r2 = PIXR15((*(yls+(y-step)*src->width)));
|
||||
g2 = PIXG15((*(yls+(y-step)*src->width)));
|
||||
b2 = PIXB15((*(yls+(y-step)*src->width)));
|
||||
r3 = min(255, (r1+r2) >> 1);
|
||||
g3 = min(255, (g1+g2) >> 1);
|
||||
b3 = min(255, (b1+b2) >> 1);
|
||||
|
||||
*(yld+y*dst->width) = PIX15(r3, g3, b3);
|
||||
}
|
||||
for (; y < height; y++) {
|
||||
*(yld+y*dst->width) = *(yls+(y-step)*src->width);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 16:
|
||||
{
|
||||
WORD *yld, *yls;
|
||||
|
||||
+1
-33
@@ -57,23 +57,6 @@ void gr_drawimage24(surface_t *ds, cgdata *cg, int x, int y) {
|
||||
dp = GETOFFSET_PIXEL(ds, dx, dy);
|
||||
|
||||
switch(ds->depth) {
|
||||
case 15:
|
||||
{
|
||||
WORD *yl;
|
||||
|
||||
for (y = 0; y < dh; y++) {
|
||||
yl = (WORD *)(dp + y * ds->bytes_per_line);
|
||||
for (x = 0; x < dw; x++) {
|
||||
r = *sp;
|
||||
g = *(sp +1);
|
||||
b = *(sp +2);
|
||||
*yl = PIX15(r, g, b);
|
||||
yl++; sp += 3;
|
||||
}
|
||||
sp += ((cg->width - dw) * 3);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 16:
|
||||
{
|
||||
WORD *yl;
|
||||
@@ -138,21 +121,6 @@ void gr_drawimage16(surface_t *ds, cgdata *cg, int x, int y) {
|
||||
dp = GETOFFSET_PIXEL(ds, dx, dy);
|
||||
|
||||
switch(ds->depth) {
|
||||
case 15:
|
||||
{
|
||||
WORD *yl;
|
||||
|
||||
for (y = 0; y < dh; y++) {
|
||||
yl = (WORD *)(dp + y * ds->bytes_per_line);
|
||||
for (x = 0; x < dw; x++) {
|
||||
pic16 = *sp;
|
||||
*yl = PIX15(RGB_PIXR16(pic16), RGB_PIXG16(pic16), RGB_PIXB16(pic16));
|
||||
yl++; sp ++;
|
||||
}
|
||||
sp += (cg->width - dw);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 16:
|
||||
{
|
||||
for (y = 0; y < dh; y++) {
|
||||
@@ -172,7 +140,7 @@ void gr_drawimage16(surface_t *ds, cgdata *cg, int x, int y) {
|
||||
yl = (DWORD *)(dp + y * ds->bytes_per_line);
|
||||
for (x = 0; x < dw; x++) {
|
||||
pic16 = *sp;
|
||||
*yl = PIX24(RGB_PIXR16(pic16), RGB_PIXG16(pic16), RGB_PIXB16(pic16));
|
||||
*yl = PIX24(PIXR16(pic16), PIXG16(pic16), PIXB16(pic16));
|
||||
yl++; sp++;
|
||||
}
|
||||
sp += (cg->width - dw);
|
||||
|
||||
@@ -19,21 +19,6 @@ void gr_copy_bright(surface_t *dst, int dx, int dy, surface_t *src, int sx, int
|
||||
if (sp == NULL || dp == NULL) return;
|
||||
|
||||
switch(dst->depth) {
|
||||
case 15:
|
||||
{
|
||||
WORD *yls, *yld;
|
||||
|
||||
for (y = 0; y < height; y++) {
|
||||
yls = (WORD *)(sp + y * src->bytes_per_line);
|
||||
yld = (WORD *)(dp + y * dst->bytes_per_line);
|
||||
|
||||
for (x = 0; x < width; x++) {
|
||||
*yld = ALPHALEVEL15(*yls, lv);
|
||||
yls++; yld++;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 16:
|
||||
if (nact->mmx_is_ok) {
|
||||
// if (0) {
|
||||
|
||||
@@ -20,21 +20,6 @@ void gr_copy_whiteout(surface_t *dst, int dx, int dy, surface_t *src, int sx, in
|
||||
if (sp == NULL || dp == NULL) return;
|
||||
|
||||
switch(dst->depth) {
|
||||
case 15:
|
||||
{
|
||||
WORD *yls, *yld;
|
||||
|
||||
for (y = 0; y < sh; y++) {
|
||||
yls = (WORD *)(sp + y * src->bytes_per_line);
|
||||
yld = (WORD *)(dp + y * dst->bytes_per_line);
|
||||
|
||||
for (x = 0; x < sw; x++) {
|
||||
*yld = WHITELEVEL15(*yls, lv);
|
||||
yls++; yld++;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 16:
|
||||
{
|
||||
WORD *yls, *yld;
|
||||
|
||||
@@ -19,22 +19,6 @@ int gr_expandcolor_blend(surface_t *dst, int dx, int dy, surface_t *src, int sx,
|
||||
dp = GETOFFSET_PIXEL(dst, dx, dy);
|
||||
|
||||
switch(dst->depth) {
|
||||
case 15: {
|
||||
WORD *yd;
|
||||
BYTE *ys;
|
||||
col = PIX15(r, g, b);
|
||||
for (y = 0; y < sh; y++) {
|
||||
ys = (BYTE *)(sp + y * src->bytes_per_line);
|
||||
yd = (WORD *)(dp + y * dst->bytes_per_line);
|
||||
for (x = 0; x < sw; x++) {
|
||||
if (*ys) {
|
||||
*yd = ALPHABLEND15(col, *yd, (BYTE)*ys);
|
||||
}
|
||||
ys++; yd++;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 16:
|
||||
col = PIX16(r, g, b);
|
||||
//if (nact->mmx_is_ok) {
|
||||
|
||||
@@ -21,15 +21,6 @@ int gr_fill(surface_t *dst, int dx, int dy, int dw, int dh, int r, int g, int b)
|
||||
memset(dp, r, dw);
|
||||
break;
|
||||
|
||||
case 15:
|
||||
{
|
||||
WORD pic15 = PIX15(r, g, b);
|
||||
|
||||
for (x = 0; x < dw; x++) {
|
||||
*((WORD *)dp + x) = pic15;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 16:
|
||||
{
|
||||
WORD pic16 = PIX16(r, g, b);
|
||||
|
||||
@@ -18,20 +18,6 @@ int gr_fill_alpha_color(surface_t *dst, int dx, int dy, int dw, int dh, int r, i
|
||||
dp = GETOFFSET_PIXEL(dst, dx, dy);
|
||||
|
||||
switch(dst->depth) {
|
||||
case 15:
|
||||
{
|
||||
WORD pic15 = PIX15(r, g, b);
|
||||
WORD *yls;
|
||||
|
||||
for (y = 0; y < dh; y++) {
|
||||
yls = (WORD *)(dp + y * dst->bytes_per_line);
|
||||
for (x = 0; x < dw; x++) {
|
||||
*yls = ALPHABLEND15(pic15, *yls, lv);
|
||||
yls++;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 16:
|
||||
if (nact->mmx_is_ok) {
|
||||
#ifdef ENABLE_MMX
|
||||
|
||||
@@ -19,8 +19,6 @@ int gr_drawrect(surface_t *dst, int x, int y, int w, int h, int r, int g, int b)
|
||||
switch(dst->depth) {
|
||||
case 8:
|
||||
col = r; break;
|
||||
case 15:
|
||||
col = PIX15(r, g, b); break;
|
||||
case 16:
|
||||
col = PIX16(r, g, b); break;
|
||||
case 24:
|
||||
@@ -49,7 +47,6 @@ int gr_drawrect(surface_t *dst, int x, int y, int w, int h, int r, int g, int b)
|
||||
*((BYTE *)dp + i) = col;
|
||||
}
|
||||
break;
|
||||
case 15:
|
||||
case 16:
|
||||
/* top */
|
||||
for (i = 0; i < w; i++) {
|
||||
|
||||
@@ -38,7 +38,6 @@ void gr_copy_stretch(surface_t *dst, int dx, int dy, int dw, int dh, surface_t *
|
||||
}
|
||||
|
||||
switch(dst->depth) {
|
||||
case 15:
|
||||
case 16:
|
||||
{
|
||||
WORD *yls, *yld;
|
||||
|
||||
@@ -16,22 +16,6 @@ int gre_Blend(surface_t *write, int wx, int wy, surface_t *dst, int dx, int dy,
|
||||
dp = GETOFFSET_PIXEL(dst, dx, dy);
|
||||
|
||||
switch(dst->depth) {
|
||||
case 15:
|
||||
{
|
||||
WORD *yls, *yld, *ylw;
|
||||
|
||||
for (y = 0; y < height; y++) {
|
||||
yls = (WORD *)(sp + y * src->bytes_per_line);
|
||||
yld = (WORD *)(dp + y * dst->bytes_per_line);
|
||||
ylw = (WORD *)(wp + y * write->bytes_per_line);
|
||||
|
||||
for (x = 0; x < width; x++) {
|
||||
*ylw = ALPHABLEND15(*yls, *yld, lv);
|
||||
yls++; yld++; ylw++;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 16:
|
||||
if (nact->mmx_is_ok) {
|
||||
// if (0) {
|
||||
|
||||
@@ -15,22 +15,6 @@ int gre_BlendScreen(surface_t *write, int wx, int wy, surface_t *dst, int dx, in
|
||||
dp = GETOFFSET_PIXEL(dst, dx, dy);
|
||||
|
||||
switch(dst->depth) {
|
||||
case 15:
|
||||
{
|
||||
WORD *yls, *yld, *ylw;
|
||||
|
||||
for (y = 0; y < height; y++) {
|
||||
yls = (WORD *)(sp + y * src->bytes_per_line);
|
||||
yld = (WORD *)(dp + y * dst->bytes_per_line);
|
||||
ylw = (WORD *)(wp + y * write->bytes_per_line);
|
||||
|
||||
for (x = 0; x < width; x++) {
|
||||
*ylw = SUTURADD15(*yls, *yld);
|
||||
yls++; yld++; ylw++;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 16:
|
||||
{
|
||||
WORD *yls, *yld, *ylw;
|
||||
|
||||
@@ -19,24 +19,6 @@ int gre_BlendUseAMap(surface_t *write, int wx, int wy, surface_t *dst, int dx, i
|
||||
|
||||
if (lv == 255) {
|
||||
switch(dst->depth) {
|
||||
case 15:
|
||||
{
|
||||
WORD *yls, *yld, *ylw;
|
||||
BYTE *yla;
|
||||
|
||||
for (y = 0; y < height; y++) {
|
||||
yls = (WORD *)(sp + y * src->bytes_per_line);
|
||||
yld = (WORD *)(dp + y * dst->bytes_per_line);
|
||||
ylw = (WORD *)(wp + y * write->bytes_per_line);
|
||||
yla = (BYTE *)(ap + y * alpha->width);
|
||||
|
||||
for (x = 0; x < width; x++) {
|
||||
*ylw = ALPHABLEND15(*yls, *yld, *yla);
|
||||
yls++; yld++; ylw++; yla++;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 16:
|
||||
if (nact->mmx_is_ok) {
|
||||
// if (0) {
|
||||
@@ -88,24 +70,6 @@ int gre_BlendUseAMap(surface_t *write, int wx, int wy, surface_t *dst, int dx, i
|
||||
|
||||
} else {
|
||||
switch(dst->depth) {
|
||||
case 15:
|
||||
{
|
||||
WORD *yls, *yld, *ylw;
|
||||
BYTE *yla;
|
||||
|
||||
for (y = 0; y < height; y++) {
|
||||
yls = (WORD *)(sp + y * src->bytes_per_line);
|
||||
yld = (WORD *)(dp + y * dst->bytes_per_line);
|
||||
ylw = (WORD *)(wp + y * write->bytes_per_line);
|
||||
yla = (BYTE *)(ap + y * alpha->width);
|
||||
|
||||
for (x = 0; x < width; x++) {
|
||||
*ylw = ALPHABLEND15(*yls, *yld, (*yla * lv) / 255);
|
||||
yls++; yld++; ylw++; yla++;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 16:
|
||||
if (nact->mmx_is_ok) {
|
||||
// if (0) {
|
||||
|
||||
+10
-15
@@ -13,21 +13,18 @@ static surface_t *create(int width, int height, int depth, boolean has_pixel, bo
|
||||
|
||||
s->width = width;
|
||||
s->height = height;
|
||||
s->has_alpha = has_alpha;
|
||||
s->has_pixel = has_pixel;
|
||||
|
||||
s->bytes_per_line = width;
|
||||
s->bytes_per_pixel = 1;
|
||||
s->depth = depth;
|
||||
|
||||
if (s->has_pixel) {
|
||||
if (has_pixel) {
|
||||
switch (s->depth) {
|
||||
case 8:
|
||||
s->pixel = calloc(width * (height +1), sizeof(BYTE));
|
||||
s->bytes_per_line = width;
|
||||
s->bytes_per_pixel = 1;
|
||||
break;
|
||||
case 15:
|
||||
case 16:
|
||||
s->pixel = calloc(width * (height +1) * 2, sizeof(BYTE));
|
||||
s->bytes_per_line = width * 2;
|
||||
@@ -42,11 +39,9 @@ static surface_t *create(int width, int height, int depth, boolean has_pixel, bo
|
||||
default:
|
||||
WARNING("depth %d is not supported\n", s->depth);
|
||||
}
|
||||
} else {
|
||||
s->pixel = NULL;
|
||||
}
|
||||
|
||||
if (s->has_alpha) {
|
||||
if (has_alpha) {
|
||||
s->alpha = calloc(width * (height +1), sizeof(BYTE));
|
||||
}
|
||||
|
||||
@@ -57,7 +52,7 @@ static surface_t *create(int width, int height, int depth, boolean has_pixel, bo
|
||||
* surfaceの生成 (pixel + alpha)
|
||||
* @param width: surfaceの幅
|
||||
* @param height: surfaceの高さ
|
||||
* @param depth: surfaceのpixelのBPP (8|15|16|24|32), alphaは8固定
|
||||
* @param depth: surfaceのpixelのBPP (8|16|24|32), alphaは8固定
|
||||
* @return 生成した surface オブジェクト
|
||||
*/
|
||||
surface_t *sf_create_surface(int width, int height, int depth) {
|
||||
@@ -78,7 +73,7 @@ surface_t *sf_create_alpha(int width, int height) {
|
||||
* surfaceの生成 (pixelのみ)
|
||||
* @param width: surfaceの幅
|
||||
* @param height: surfaceの高さ
|
||||
* @param depth: surfaceのBPP(8|15|16|24|32)
|
||||
* @param depth: surfaceのBPP(8|16|24|32)
|
||||
* @return 生成した surface オブジェクト
|
||||
*/
|
||||
surface_t *sf_create_pixel(int width, int height, int depth) {
|
||||
@@ -111,13 +106,13 @@ surface_t *sf_dup(surface_t *in) {
|
||||
sf = malloc(sizeof(surface_t));
|
||||
memcpy(sf, in, sizeof(surface_t));
|
||||
|
||||
if (in->has_pixel) {
|
||||
if (in->pixel) {
|
||||
len = sf->bytes_per_line * sf->height;
|
||||
sf->pixel = malloc(sizeof(BYTE) * (len + sf->bytes_per_line));
|
||||
memcpy(sf->pixel, in->pixel, len);
|
||||
}
|
||||
|
||||
if (in->has_alpha) {
|
||||
if (in->alpha) {
|
||||
len = sf->width * sf->height;
|
||||
sf->alpha = malloc(sizeof(BYTE) * (len + sf->width));
|
||||
memcpy(sf->alpha, in->alpha, len);
|
||||
@@ -143,12 +138,12 @@ void sf_copyall(surface_t *dst, surface_t *src) {
|
||||
|
||||
if (src->bytes_per_pixel != dst->bytes_per_pixel) return;
|
||||
|
||||
if (src->has_alpha && dst->has_alpha) {
|
||||
if (src->alpha && dst->alpha) {
|
||||
len = src->width * src->height;
|
||||
memcpy(dst->alpha, src->alpha, len);
|
||||
}
|
||||
|
||||
if (src->has_pixel && dst->has_pixel) {
|
||||
if (src->pixel && dst->pixel) {
|
||||
len = src->bytes_per_line * src->height;
|
||||
memcpy(dst->pixel, src->pixel, len);
|
||||
}
|
||||
@@ -170,7 +165,7 @@ surface_t *sf_dup2(surface_t *in, boolean copypixel, boolean copyalpha) {
|
||||
sf = malloc(sizeof(surface_t));
|
||||
memcpy(sf, in, sizeof(surface_t));
|
||||
|
||||
if (in->has_pixel) {
|
||||
if (in->pixel) {
|
||||
len = sf->bytes_per_line * sf->height;
|
||||
sf->pixel = malloc(sizeof(BYTE) * (len + sf->bytes_per_line));
|
||||
if (copypixel) {
|
||||
@@ -178,7 +173,7 @@ surface_t *sf_dup2(surface_t *in, boolean copypixel, boolean copyalpha) {
|
||||
}
|
||||
}
|
||||
|
||||
if (in->has_alpha) {
|
||||
if (in->alpha) {
|
||||
len = sf->width * sf->height;
|
||||
sf->alpha = malloc(sizeof(BYTE) * (len + sf->width));
|
||||
if (copyalpha) {
|
||||
|
||||
+22
-27
@@ -3,7 +3,7 @@ add_library(src_lib STATIC
|
||||
hankaku.c
|
||||
utfsjis.c
|
||||
)
|
||||
target_compile_options(src_lib PRIVATE -Wno-pointer-sign)
|
||||
target_compile_options(src_lib PRIVATE -Wno-pointer-sign -Wall)
|
||||
target_include_directories(src_lib PRIVATE .)
|
||||
|
||||
if (ANDROID)
|
||||
@@ -12,7 +12,7 @@ else()
|
||||
add_executable(xsystem35)
|
||||
endif()
|
||||
|
||||
target_compile_options(xsystem35 PRIVATE -Wno-pointer-sign)
|
||||
target_compile_options(xsystem35 PRIVATE -Wno-pointer-sign $<$<CONFIG:Debug>:-Wall>)
|
||||
target_include_directories(xsystem35 PRIVATE .)
|
||||
target_link_libraries(xsystem35 PRIVATE src_lib)
|
||||
|
||||
@@ -24,8 +24,6 @@ target_sources(xsystem35 PRIVATE
|
||||
${SRC_AUDIO}
|
||||
${SRC_CDROM}
|
||||
${SRC_MIDI}
|
||||
${SRC_GRAPHDEV}
|
||||
${SRC_FONT}
|
||||
${SRC_MENU}
|
||||
${SRC_JOYSTICK})
|
||||
|
||||
@@ -35,12 +33,19 @@ target_sources(xsystem35 PRIVATE
|
||||
cmdk.c cmdl.c cmdm.c cmdn.c cmdo.c cmdp.c cmdq.c cmds.c cmdt.c
|
||||
cmdu.c cmdv.c cmdw.c cmdy.c cmdz.c cmd2F.c cmd2F60.c)
|
||||
|
||||
# Graphics
|
||||
|
||||
target_sources(xsystem35 PRIVATE
|
||||
sdl_video.c sdl_draw.c sdl_event.c sdl_image.c sdl_cursor.c image.c font.c)
|
||||
|
||||
# CG
|
||||
target_sources(xsystem35 PRIVATE
|
||||
pms.c vsp.c bmp.c qnt.c)
|
||||
if (HAVE_JPEG)
|
||||
target_sources(xsystem35 PRIVATE jpeg.c)
|
||||
target_link_libraries(xsystem35 PRIVATE JPEG::JPEG)
|
||||
if (NOT EMSCRIPTEN)
|
||||
target_link_libraries(xsystem35 PRIVATE JPEG::JPEG)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Music
|
||||
@@ -58,7 +63,7 @@ target_sources(xsystem35 PRIVATE
|
||||
|
||||
# Graphics
|
||||
target_sources(xsystem35 PRIVATE
|
||||
ags.c font.c flood.c cg.c ecopy.c antialiase.c alpha_plane.c cursor.c)
|
||||
ags.c flood.c cg.c ecopy.c antialiase.c alpha_plane.c cursor.c)
|
||||
|
||||
# Network
|
||||
target_sources(xsystem35 PRIVATE
|
||||
@@ -70,7 +75,11 @@ endif()
|
||||
|
||||
if (EMSCRIPTEN)
|
||||
|
||||
set(LIBS "SHELL:-s USE_ZLIB=1 -s USE_FREETYPE=1 -s USE_SDL=2")
|
||||
set(LIBS
|
||||
"SHELL:-s USE_ZLIB=1"
|
||||
"SHELL:-s USE_LIBJPEG=1"
|
||||
"SHELL:-s USE_SDL=2"
|
||||
"SHELL:-s USE_SDL_TTF=2")
|
||||
target_compile_options(xsystem35 PRIVATE ${LIBS})
|
||||
target_link_options(xsystem35 PRIVATE ${LIBS})
|
||||
target_link_libraries(xsystem35 PRIVATE idbfs.js)
|
||||
@@ -93,28 +102,14 @@ elseif (ANDROID)
|
||||
|
||||
else() # non-emscripten, non-android
|
||||
target_link_libraries(xsystem35 PRIVATE m ZLIB::ZLIB)
|
||||
if (X11_FOUND)
|
||||
target_include_directories(xsystem35 PRIVATE ${X11_INCLUDE_DIR})
|
||||
target_link_libraries(xsystem35 PRIVATE ${X11_LIBRARIES})
|
||||
if (X11_xf86vmode_FOUND)
|
||||
target_link_libraries(xsystem35 PRIVATE ${X11_Xxf86vm_LIB})
|
||||
endif()
|
||||
endif()
|
||||
target_link_libraries(xsystem35 PRIVATE PkgConfig::SDL2)
|
||||
target_link_libraries(xsystem35 PRIVATE PkgConfig::SDL2TTF)
|
||||
if (GTK2_FOUND)
|
||||
target_link_libraries(xsystem35 PRIVATE GTK2::gtk)
|
||||
endif()
|
||||
if (FREETYPE_FOUND)
|
||||
target_link_libraries(xsystem35 PRIVATE Freetype::Freetype)
|
||||
endif()
|
||||
if (ENABLE_SDL)
|
||||
target_link_libraries(xsystem35 PRIVATE PkgConfig::SDL2)
|
||||
endif()
|
||||
if (SDL2MIXER_FOUND)
|
||||
target_link_libraries(xsystem35 PRIVATE PkgConfig::SDL2MIXER)
|
||||
endif()
|
||||
if (SDL2TTF_FOUND)
|
||||
target_link_libraries(xsystem35 PRIVATE PkgConfig::SDL2TTF)
|
||||
endif()
|
||||
|
||||
install(TARGETS xsystem35 RUNTIME DESTINATION bin)
|
||||
|
||||
@@ -123,15 +118,15 @@ else() # non-emscripten, non-android
|
||||
gameresource_test.c
|
||||
hankaku_test.c
|
||||
)
|
||||
target_compile_options(src_tests PRIVATE -Wno-pointer-sign)
|
||||
target_compile_options(src_tests PRIVATE -Wno-pointer-sign -Wall)
|
||||
target_link_libraries(src_tests PRIVATE src_lib)
|
||||
add_test(NAME src_tests COMMAND src_tests)
|
||||
configure_file(testdata/test.gr ${CMAKE_CURRENT_BINARY_DIR}/testdata/test.gr COPYONLY)
|
||||
endif()
|
||||
|
||||
# FIXME: set up dependency for xsystem35 on this
|
||||
if (ENABLE_SDL AND NOT EMSCRIPTEN AND NOT ANDROID)
|
||||
add_custom_target(sdl_input.c
|
||||
COMMAND perl xsyskey.pl ${SDL2_INCLUDE_DIRS} > sdl_input.c
|
||||
if (NOT EMSCRIPTEN AND NOT ANDROID)
|
||||
add_custom_target(sdl_keytable.h
|
||||
COMMAND perl ../tools/xsyskey.pl ${SDL2_INCLUDE_DIRS} > sdl_keytable.h
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
endif()
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
#include "portab.h"
|
||||
#include "xsystem35.h"
|
||||
#include "ags.h"
|
||||
#include "graphicsdevice.h"
|
||||
#include "sdl_core.h"
|
||||
#include "alpha_plane.h"
|
||||
#include "counter.h"
|
||||
#include "utfsjis.h"
|
||||
@@ -45,15 +45,15 @@
|
||||
#define check_param_xy ags_check_param_xy
|
||||
#define intersection ags_intersection
|
||||
|
||||
static void initPal(Pallet256 *sys_pal);
|
||||
static void initPal(Palette256 *sys_pal);
|
||||
static boolean intersects(MyRectangle *r1, MyRectangle *r2);
|
||||
|
||||
static Pallet256 pal_256;
|
||||
static Palette256 pal_256;
|
||||
static boolean need_update = TRUE;
|
||||
static boolean fade_outed = FALSE;
|
||||
static int cursor_move_time = 50; /* カーソル移動にかかる時間(ms) */
|
||||
|
||||
static void initPal(Pallet256 *pal) {
|
||||
static void initPal(Palette256 *pal) {
|
||||
int i;
|
||||
for (i = 0; i < 256; i++) {
|
||||
pal->red[i] = 0; pal->green[i] = 0; pal->blue[i] = 0;
|
||||
@@ -62,7 +62,7 @@ static void initPal(Pallet256 *pal) {
|
||||
pal->red[7] = 255; pal->green[7] = 255; pal->blue[7] = 255;
|
||||
pal->red[15] = 255; pal->green[15] = 255; pal->blue[15] = 255;
|
||||
pal->red[255] = 255; pal->green[255] = 255; pal->blue[255] = 255;
|
||||
SetPallet(pal, 0, 256);
|
||||
sdl_setPalette(pal, 0, 256);
|
||||
nact->sys_pal_changed = TRUE;
|
||||
}
|
||||
|
||||
@@ -137,38 +137,35 @@ void ags_init() {
|
||||
nact->sys_view_area.width = SYS35_DEFAULT_WIDTH;
|
||||
nact->sys_view_area.height = SYS35_DEFAULT_HEIGHT;
|
||||
|
||||
GraphicsInitilize();
|
||||
|
||||
font_init(nact->fontdev);
|
||||
SetFontDevice(nact->ags.font);
|
||||
|
||||
sdl_Initilize();
|
||||
font_init();
|
||||
|
||||
initPal(&pal_256);
|
||||
cg_init();
|
||||
}
|
||||
|
||||
void ags_remove() {
|
||||
ags_autorepeat(TRUE);
|
||||
GraphicsRemove();
|
||||
sdl_Remove();
|
||||
}
|
||||
|
||||
void ags_setWorldSize(int width, int height, int depth) {
|
||||
nact->sys_world_size.width = width;
|
||||
nact->sys_world_size.height = height;
|
||||
nact->sys_world_depth = depth;
|
||||
SetWorldSize(width, height, depth);
|
||||
|
||||
if (nact->ags.dib && nact->ags.dib->alpha) {
|
||||
free(nact->ags.dib->alpha);
|
||||
nact->ags.dib->alpha = NULL;
|
||||
}
|
||||
|
||||
sdl_setWorldSize(width, height, depth);
|
||||
|
||||
nact->ags.dib = GetDIB();
|
||||
nact->ags.dib->has_alpha = FALSE;
|
||||
nact->ags.dib->has_pixel = TRUE;
|
||||
nact->ags.dib = sdl_getDIB();
|
||||
|
||||
/* DIBが8以上の場合は、alpha plane を用意 */
|
||||
if (depth > 8) {
|
||||
if (nact->ags.dib->alpha != NULL) {
|
||||
free(nact->ags.dib->alpha);
|
||||
}
|
||||
if (depth > 8)
|
||||
nact->ags.dib->alpha = calloc(width * height, sizeof(BYTE));
|
||||
nact->ags.dib->has_alpha = TRUE;
|
||||
}
|
||||
|
||||
fade_outed = FALSE; /* thanx tajiri@wizard */
|
||||
|
||||
@@ -181,7 +178,7 @@ void ags_setViewArea(int x, int y, int width, int height) {
|
||||
|
||||
nact->sys_view_area.width = width;
|
||||
nact->sys_view_area.height = height;
|
||||
SetWindowSize(x, y, width, height);
|
||||
sdl_setWindowSize(x, y, width, height);
|
||||
}
|
||||
|
||||
void ags_setWindowTitle(const char *src) {
|
||||
@@ -194,7 +191,7 @@ void ags_setWindowTitle(const char *src) {
|
||||
}
|
||||
strcpy(d, TITLEHEAD);
|
||||
strcat(d, utf);
|
||||
SetWindowTitle(d);
|
||||
sdl_setWindowTitle(d);
|
||||
free(utf);
|
||||
free(d);
|
||||
}
|
||||
@@ -206,13 +203,13 @@ void ags_getDIBInfo(DispInfo *info) {
|
||||
}
|
||||
|
||||
void ags_getViewAreaInfo(DispInfo *info) {
|
||||
GetWindowInfo(info);
|
||||
sdl_getWindowInfo(info);
|
||||
info->width = nact->sys_view_area.width;
|
||||
info->height = nact->sys_view_area.height;
|
||||
}
|
||||
|
||||
void ags_getWindowInfo(DispInfo *info) {
|
||||
GetWindowInfo(info);
|
||||
sdl_getWindowInfo(info);
|
||||
}
|
||||
|
||||
void ags_setExposeSwitch(boolean bool) {
|
||||
@@ -231,7 +228,7 @@ void ags_updateArea(int x, int y, int w, int h) {
|
||||
intersection(&nact->sys_view_area, &r, &update);
|
||||
p.x = update.x - nact->sys_view_area.x;
|
||||
p.y = update.y - nact->sys_view_area.y;
|
||||
UpdateArea(&update, &p);
|
||||
sdl_updateArea(&update, &p);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -247,11 +244,11 @@ void ags_updateFull() {
|
||||
r.y = nact->sys_view_area.y;
|
||||
r.width = min(nact->sys_view_area.width, nact->sys_world_size.width);
|
||||
r.height = min(nact->sys_view_area.height, nact->sys_world_size.height);
|
||||
UpdateArea(&r, &p);
|
||||
sdl_updateArea(&r, &p);
|
||||
}
|
||||
}
|
||||
|
||||
void ags_setPallets(Pallet256 *src_pal, int src, int dst, int cnt) {
|
||||
void ags_setPalettes(Palette256 *src_pal, int src, int dst, int cnt) {
|
||||
int i;
|
||||
for (i = 0; i < cnt; i++) {
|
||||
nact->sys_pal->red [dst + i] = src_pal->red [src + i];
|
||||
@@ -261,58 +258,56 @@ void ags_setPallets(Pallet256 *src_pal, int src, int dst, int cnt) {
|
||||
nact->sys_pal_changed = TRUE;
|
||||
}
|
||||
|
||||
void ags_setPallet(int no, int red, int green, int blue) {
|
||||
void ags_setPalette(int no, int red, int green, int blue) {
|
||||
nact->sys_pal->red[no] = red;
|
||||
nact->sys_pal->green[no] = green;
|
||||
nact->sys_pal->blue[no] = blue;
|
||||
nact->sys_pal_changed = TRUE;
|
||||
}
|
||||
|
||||
void ags_setPalletToSystem(int src, int cnt) {
|
||||
void ags_setPaletteToSystem(int src, int cnt) {
|
||||
if (!fade_outed)
|
||||
SetPallet(nact->sys_pal, src, cnt);
|
||||
sdl_setPalette(nact->sys_pal, src, cnt);
|
||||
}
|
||||
|
||||
void ags_drawRectangle(int x, int y, int w, int h, int col) {
|
||||
if (!check_param(&x, &y, &w, &h)) return;
|
||||
|
||||
DrawRectangle(x, y, w, h, col);
|
||||
sdl_drawRectangle(x, y, w, h, col);
|
||||
}
|
||||
|
||||
void ags_fillRectangle(int x, int y, int w, int h, int col) {
|
||||
if (!check_param(&x, &y, &w, &h)) return;
|
||||
|
||||
FillRectangle(x, y, w, h, col);
|
||||
sdl_fillRectangle(x, y, w, h, col);
|
||||
}
|
||||
|
||||
void ags_drawLine(int x0, int y0, int x1, int y1, int col) {
|
||||
if (!check_param_xy(&x0, &y0)) return;
|
||||
if (!check_param_xy(&x1, &y1)) return;
|
||||
|
||||
DrawLine(x0, y0, x1, y1, col);
|
||||
sdl_drawLine(x0, y0, x1, y1, col);
|
||||
}
|
||||
|
||||
void ags_copyArea(int sx, int sy, int w, int h, int dx, int dy) {
|
||||
if (!check_param(&sx, &sy, &w, &h)) return;
|
||||
if (!check_param(&dx, &dy, &w, &h)) return;
|
||||
|
||||
CopyArea(sx, sy, w, h, dx, dy);
|
||||
sdl_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 (!check_param(&sx, &sy, &sw, &sh)) return;
|
||||
if (!check_param(&dx, &dy, &dw, &dh)) return;
|
||||
|
||||
DspDeviceSync(); /* Device依存の sync (ex. XSync()) */
|
||||
ScaledCopyArea(sx, sy, sw, sh, dx, dy, dw, dh, mirror_sw);
|
||||
sdl_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 (!check_param(&sx, &sy, &w, &h)) return;
|
||||
if (!check_param(&dx, &dy, &w, &h)) return;
|
||||
|
||||
DspDeviceSync();
|
||||
CopyAreaSP(sx, sy, w, h, dx, dy, col);
|
||||
sdl_copyAreaSP(sx, sy, w, h, dx, dy, col);
|
||||
}
|
||||
|
||||
void ags_wrapColor(int x, int y, int w, int h, int p1, int p2) {
|
||||
@@ -320,15 +315,13 @@ void ags_wrapColor(int x, int y, int w, int h, int p1, int p2) {
|
||||
|
||||
if (!check_param(&x, &y, &w, &h)) return;
|
||||
|
||||
DspDeviceSync();
|
||||
WrapColor(x, y, w, h, p1, p2);
|
||||
sdl_wrapColor(x, y, w, h, p1, p2);
|
||||
}
|
||||
|
||||
void ags_getPixel(int x, int y, Pallet *cell) {
|
||||
void ags_getPixel(int x, int y, Palette *cell) {
|
||||
if (!check_param_xy(&x, &y)) return;
|
||||
|
||||
DspDeviceSync();
|
||||
GetPixel(x, y, cell);
|
||||
sdl_getPixel(x, y, cell);
|
||||
}
|
||||
|
||||
void ags_changeColorArea(int sx, int sy, int w, int h, int dst, int src, int cnt) {
|
||||
@@ -336,7 +329,6 @@ void ags_changeColorArea(int sx, int sy, int w, int h, int dst, int src, int cnt
|
||||
|
||||
if (!check_param(&sx, &sy, &w, &h)) return;
|
||||
|
||||
DspDeviceSync();
|
||||
{
|
||||
agsurface_t *dib = nact->ags.dib;
|
||||
int x, y;
|
||||
@@ -357,8 +349,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 (!check_param(&x, &y, &w, &h)) return NULL;
|
||||
|
||||
DspDeviceSync();
|
||||
return (void *)SaveRegion(x, y, w, h);
|
||||
return (void *)sdl_saveRegion(x, y, w, h);
|
||||
}
|
||||
|
||||
void ags_restoreRegion(void *region, int x, int y) {
|
||||
@@ -366,8 +357,7 @@ void ags_restoreRegion(void *region, int x, int y) {
|
||||
|
||||
if (!check_param_xy(&x, &y)) return;
|
||||
|
||||
DspDeviceSync();
|
||||
RestoreRegion(region, x, y);
|
||||
sdl_restoreRegion(region, x, y);
|
||||
}
|
||||
|
||||
void ags_putRegion(void *region, int x, int y) {
|
||||
@@ -375,8 +365,7 @@ void ags_putRegion(void *region, int x, int y) {
|
||||
|
||||
if (!check_param_xy(&x, &y)) return;
|
||||
|
||||
DspDeviceSync();
|
||||
PutRegion(region, x, y);
|
||||
sdl_putRegion(region, x, y);
|
||||
}
|
||||
|
||||
void ags_copyRegion(void *region, int sx, int sy , int w, int h, int dx, int dy) {
|
||||
@@ -385,15 +374,13 @@ void ags_copyRegion(void *region, int sx, int sy , int w, int h, int dx, int dy)
|
||||
if (!check_param_xy(&dx, &dy)) return;
|
||||
if (!check_param(&dx, &dy, &w, &h)) return;
|
||||
|
||||
DspDeviceSync();
|
||||
CopyRegion(region, sx, sy, w, h, dx, dy);
|
||||
sdl_CopyRegion(region, sx, sy, w, h, dx, dy);
|
||||
}
|
||||
|
||||
void ags_delRegion(void *region) {
|
||||
if (region == NULL) return;
|
||||
|
||||
DspDeviceSync();
|
||||
DelRegion(region);
|
||||
sdl_delRegion(region);
|
||||
}
|
||||
|
||||
int ags_drawString(int x, int y, const char *src, int col) {
|
||||
@@ -401,19 +388,32 @@ int ags_drawString(int x, int y, const char *src, int col) {
|
||||
|
||||
if (!check_param_xy(&x, &y)) return 0;
|
||||
|
||||
DspDeviceSync();
|
||||
char *utf8 = toUTF8(src);
|
||||
w = DrawString(x, y, utf8, col);
|
||||
w = sdl_drawString(x, y, utf8, col);
|
||||
free(utf8);
|
||||
|
||||
return w;
|
||||
}
|
||||
|
||||
agsurface_t *ags_drawStringToSurface(const char *str) {
|
||||
static SDL_Surface *fs;
|
||||
static agsurface_t result;
|
||||
if (fs) {
|
||||
SDL_FreeSurface(fs);
|
||||
fs = NULL;
|
||||
}
|
||||
|
||||
char *utf8 = toUTF8(str);
|
||||
agsurface_t *sf = nact->ags.font->get_glyph(utf8);
|
||||
fs = font_get_glyph(utf8);
|
||||
free(utf8);
|
||||
return sf;
|
||||
|
||||
result.depth = fs->format->BitsPerPixel;
|
||||
result.bytes_per_pixel = fs->format->BytesPerPixel;
|
||||
result.bytes_per_line = fs->pitch;
|
||||
result.pixel = fs->pixels;
|
||||
result.width = fs->w;
|
||||
result.height = fs->h;
|
||||
return &result;
|
||||
}
|
||||
|
||||
void ags_drawCg8bit(cgdata *cg, int x, int y) {
|
||||
@@ -427,8 +427,7 @@ void ags_drawCg8bit(cgdata *cg, int x, int y) {
|
||||
if (!check_param(&x, &y, &w, &h)) return;
|
||||
|
||||
cg->data_offset = abs(sy - y) * cg->width + abs(sx - x);
|
||||
DspDeviceSync();
|
||||
DrawImage8_fromData(cg, x, y, w, h);
|
||||
sdl_drawImage8_fromData(cg, x, y, w, h);
|
||||
}
|
||||
|
||||
void ags_drawCg16bit(cgdata *cg, int x, int y) {
|
||||
@@ -442,8 +441,7 @@ void ags_drawCg16bit(cgdata *cg, int x, int y) {
|
||||
if (!check_param(&x, &y, &w, &h)) return;
|
||||
|
||||
cg->data_offset = abs(sy - y) * cg->width + abs(sx - x);
|
||||
DspDeviceSync();
|
||||
DrawImage16_fromData(cg, x, y, w, h);
|
||||
sdl_drawImage16_fromData(cg, x, y, w, h);
|
||||
}
|
||||
|
||||
void ags_copyArea_shadow(int sx, int sy, int w, int h, int dx, int dy) {
|
||||
@@ -452,8 +450,7 @@ void ags_copyArea_shadow(int sx, int sy, int w, int h, int dx, int dy) {
|
||||
if (!check_param(&sx, &sy, &w, &h)) return;
|
||||
if (!check_param(&dx, &dy, &w, &h)) return;
|
||||
|
||||
DspDeviceSync();
|
||||
CopyAreaSP16_shadow(sx, sy, w, h, dx, dy);
|
||||
sdl_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) {
|
||||
@@ -462,8 +459,7 @@ void ags_copyArea_transparent(int sx, int sy, int w, int h, int dx, int dy, int
|
||||
if (!check_param(&sx, &sy, &w, &h)) return;
|
||||
if (!check_param(&dx, &dy, &w, &h)) return;
|
||||
|
||||
DspDeviceSync();
|
||||
CopyAreaSP(sx, sy, w, h, dx, dy, col);
|
||||
sdl_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) {
|
||||
@@ -472,8 +468,7 @@ void ags_copyArea_alphaLevel(int sx, int sy, int w, int h, int dx, int dy, int l
|
||||
if (!check_param(&sx, &sy, &w, &h)) return;
|
||||
if (!check_param(&dx, &dy, &w, &h)) return;
|
||||
|
||||
DspDeviceSync();
|
||||
CopyAreaSP16_alphaLevel(sx, sy, w, h, dx, dy, lv);
|
||||
sdl_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) {
|
||||
@@ -482,8 +477,7 @@ void ags_copyArea_alphaBlend(int sx, int sy, int w, int h, int dx, int dy, int l
|
||||
if (!check_param(&sx, &sy, &w, &h)) return;
|
||||
if (!check_param(&dx, &dy, &w, &h)) return;
|
||||
|
||||
DspDeviceSync();
|
||||
CopyAreaSP16_alphaBlend(sx, sy, w, h, dx, dy, lv);
|
||||
sdl_copyAreaSP16_alphaBlend(sx, sy, w, h, dx, dy, lv);
|
||||
}
|
||||
|
||||
void ags_copyArea_whiteLevel(int sx, int sy, int w, int h, int dx, int dy, int lv) {
|
||||
@@ -492,8 +486,7 @@ void ags_copyArea_whiteLevel(int sx, int sy, int w, int h, int dx, int dy, int l
|
||||
if (!check_param(&sx, &sy, &w, &h)) return;
|
||||
if (!check_param(&dx, &dy, &w, &h)) return;
|
||||
|
||||
DspDeviceSync();
|
||||
CopyAreaSP16_whiteLevel(sx, sy, w, h, dx, dy, lv);
|
||||
sdl_copyAreaSP16_whiteLevel(sx, sy, w, h, dx, dy, lv);
|
||||
}
|
||||
|
||||
|
||||
@@ -538,8 +531,6 @@ MyRectangle* ags_imageFlood(int x, int y, int c) {
|
||||
|
||||
if (!check_param_xy(&x, &y)) return NULL;
|
||||
|
||||
DspDeviceSync();
|
||||
|
||||
{
|
||||
agsurface_t *dib = nact->ags.dib;
|
||||
BYTE *dst = GETOFFSET_PIXEL(dib, x, y);
|
||||
@@ -573,8 +564,7 @@ void ags_copyFromAlpha(int sx, int sy, int w, int h, int dx, int dy, ALPHA_DIB_C
|
||||
if (!check_param(&sx, &sy, &w, &h)) return;
|
||||
if (!check_param(&dx, &dy, &w, &h)) return;
|
||||
|
||||
DspDeviceSync();
|
||||
Copy_from_alpha(sx, sy, w, h, dx, dy, flg);
|
||||
sdl_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) {
|
||||
@@ -583,8 +573,7 @@ void ags_copyToAlpha(int sx, int sy, int w, int h, int dx, int dy, ALPHA_DIB_COP
|
||||
if (!check_param(&sx, &sy, &w, &h)) return;
|
||||
if (!check_param(&dx, &dy, &w, &h)) return;
|
||||
|
||||
DspDeviceSync();
|
||||
Copy_to_alpha(sx, sy, w, h, dx, dy, flg);
|
||||
sdl_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) {
|
||||
@@ -631,12 +620,11 @@ void ags_alpha_getPixel(int x, int y, int *pic) {
|
||||
}
|
||||
|
||||
void ags_alpha_setPixel(int x, int y, int w, int h, BYTE *b) {
|
||||
int savex, savey, savew, saveh, offset;
|
||||
int savex, savey, savew, offset;
|
||||
|
||||
savex = x;
|
||||
savey = y;
|
||||
savew = w;
|
||||
saveh = h;
|
||||
|
||||
if (!check_param(&x, &y, &w, &h)) return;
|
||||
|
||||
@@ -664,7 +652,7 @@ void ags_fader(ags_faderinfo_t *i) {
|
||||
i->callback(step);
|
||||
key = sys_getInputInfo();
|
||||
/* 実際の fade にかかった時間 */
|
||||
Sleep(0); /* It's a magic !!! */
|
||||
sdl_sleep(0); /* It's a magic !!! */
|
||||
cnt2 = get_high_counter(SYSTEMCOUNTER_MSEC) - cnt1;
|
||||
|
||||
lefttime = i->effect_time - (cnt1 + cnt2 - cnt_st); /* fade 残り時間 */
|
||||
@@ -714,7 +702,7 @@ void ags_fadeIn(int rate, boolean flag) {
|
||||
|
||||
nact->waitcancel_key = 0;
|
||||
|
||||
i.callback = FadeIn;
|
||||
i.callback = sdl_fadeIn;
|
||||
i.step_max = 255;
|
||||
ags_fader(&i);
|
||||
}
|
||||
@@ -732,7 +720,7 @@ void ags_fadeOut(int rate, boolean flag) {
|
||||
|
||||
nact->waitcancel_key = 0;
|
||||
|
||||
i.callback = FadeOut;
|
||||
i.callback = sdl_fadeOut;
|
||||
i.step_max = 255;
|
||||
ags_fader(&i);
|
||||
}
|
||||
@@ -749,7 +737,7 @@ void ags_whiteIn(int rate, boolean flag) {
|
||||
|
||||
nact->waitcancel_key = 0;
|
||||
|
||||
i.callback = WhiteIn;
|
||||
i.callback = sdl_whiteIn;
|
||||
i.step_max = 255;
|
||||
ags_fader(&i);
|
||||
}
|
||||
@@ -766,18 +754,18 @@ void ags_whiteOut(int rate, boolean flag) {
|
||||
|
||||
nact->waitcancel_key = 0;
|
||||
|
||||
i.callback = WhiteOut;
|
||||
i.callback = sdl_whiteOut;
|
||||
i.step_max = 255;
|
||||
ags_fader(&i);
|
||||
}
|
||||
|
||||
void ags_setFont(int type, int size) {
|
||||
nact->ags.font->sel_font(type, size);
|
||||
font_select(type, size);
|
||||
}
|
||||
|
||||
void ags_setCursorType(int type) {
|
||||
if (nact->noimagecursor && type >= 100) return;
|
||||
SetCursorType(type);
|
||||
sdl_setCursorType(type);
|
||||
}
|
||||
|
||||
void ags_loadCursor(int p1,int p2) {
|
||||
@@ -802,7 +790,7 @@ void ags_setCursorLocation(int x, int y, boolean is_dibgeo) {
|
||||
case 0:
|
||||
return;
|
||||
case 1:
|
||||
SetCursorLocation(x, y); break;
|
||||
sdl_setCursorLocation(x, y); break;
|
||||
case 2:
|
||||
sys_getMouseInfo(&p, is_dibgeo);
|
||||
delx = x - p.x;
|
||||
@@ -815,7 +803,7 @@ void ags_setCursorLocation(int x, int y, boolean is_dibgeo) {
|
||||
dx[7] = x; dy[7] = y;
|
||||
|
||||
for (i = 0; i < 8; i++) {
|
||||
SetCursorLocation(dx[i], dy[i]);
|
||||
sdl_setCursorLocation(dx[i], dy[i]);
|
||||
usleep(cursor_move_time * 1000 / 8);
|
||||
}
|
||||
break;
|
||||
@@ -826,17 +814,17 @@ void ags_setCursorLocation(int x, int y, boolean is_dibgeo) {
|
||||
|
||||
void ags_setAntialiasedStringMode(boolean on) {
|
||||
if (!nact->noantialias) {
|
||||
nact->ags.font->antialiase_on = on;
|
||||
font_set_antialias(on);
|
||||
}
|
||||
}
|
||||
|
||||
boolean ags_getAntialiasedStringMode() {
|
||||
return nact->ags.font->antialiase_on;
|
||||
return font_get_antialias();
|
||||
}
|
||||
|
||||
void ags_fullscreen(boolean on) {
|
||||
nact->sys_fullscreen_on = on;
|
||||
FullScreen(on);
|
||||
sdl_FullScreen(on);
|
||||
}
|
||||
|
||||
void ags_copyArea_shadow_withrate(int sx, int sy, int w, int h, int dx, int dy, int lv) {
|
||||
@@ -847,8 +835,7 @@ void ags_copyArea_shadow_withrate(int sx, int sy, int w, int h, int dx, int dy,
|
||||
if (!check_param(&sx, &sy, &w, &h)) return;
|
||||
if (!check_param(&dx, &dy, &w, &h)) return;
|
||||
|
||||
DspDeviceSync();
|
||||
CopyAreaSP16_shadow_withRate(sx, sy, w, h, dx, dy, lv);
|
||||
sdl_copyAreaSP16_shadow(sx, sy, w, h, dx, dy, lv);
|
||||
}
|
||||
|
||||
void ags_setCursorMoveTime(int msec) {
|
||||
@@ -866,25 +853,13 @@ int ags_getCursorMoveTime() {
|
||||
void ags_zoom(int x, int y, int w, int h) {
|
||||
if (!check_param(&x, &y, &w, &h)) return;
|
||||
|
||||
DspDeviceSync();
|
||||
Zoom(x, y, w, h);
|
||||
sdl_zoom(x, y, w, h);
|
||||
}
|
||||
|
||||
agsurface_t *ags_getDIB() {
|
||||
return nact->ags.dib;
|
||||
}
|
||||
|
||||
void ags_sync() {
|
||||
DspDeviceSync();
|
||||
}
|
||||
|
||||
void ags_fillRectangleNeg(int x, int y, int w, int h, int col) {
|
||||
if (!check_param(&x, &y, &w, &h)) return;
|
||||
|
||||
DspDeviceSync();
|
||||
image_fillRectangleNeg(nact->ags.dib, x, y, w, h, col);
|
||||
}
|
||||
|
||||
void ags_autorepeat(boolean bool) {
|
||||
SetAutoRepeat(bool);
|
||||
sdl_setAutoRepeat(bool);
|
||||
}
|
||||
|
||||
@@ -30,8 +30,6 @@
|
||||
#include "cg.h"
|
||||
#include "graphics.h"
|
||||
|
||||
struct _FONT;
|
||||
|
||||
/* マウスカーソルの種類 */
|
||||
#define CURSOR_ARROW 1
|
||||
#define CURSOR_CROSS 2
|
||||
@@ -62,26 +60,23 @@ typedef enum {
|
||||
} ALPHA_DIB_COPY_TYPE;
|
||||
|
||||
struct agsurface {
|
||||
int no; /* surface number, primary DIB is 0 */
|
||||
|
||||
int width; /* width of surface */
|
||||
int height; /* height of surface */
|
||||
int depth; /* depth of surface, 8/15/16/24/32 is available */
|
||||
int depth; /* depth of surface, 8/16/24/32 is available */
|
||||
|
||||
int bytes_per_line; /* bytes per line */
|
||||
int bytes_per_pixel; /* bytes per pixel */
|
||||
|
||||
BYTE *pixel; /* pointer to pixel data */
|
||||
BYTE *alpha; /* pointer to alpha pixel data */
|
||||
|
||||
boolean has_alpha;
|
||||
boolean has_pixel;
|
||||
|
||||
BYTE *pixel; /* pixel data (can be NULL) */
|
||||
BYTE *alpha; /* alpha pixel data (can be NULL) */
|
||||
};
|
||||
typedef struct agsurface agsurface_t;
|
||||
|
||||
// for agsurface_t
|
||||
#define GETOFFSET_PIXEL(suf, x, y) ((suf)->pixel + (y) * (suf)->bytes_per_line + (x) * (suf)->bytes_per_pixel)
|
||||
#define GETOFFSET_ALPHA(suf, x, y) ((suf)->alpha + (y) * (suf)->width + (x))
|
||||
// for SDL_surface
|
||||
#define PIXEL_AT(suf, x, y) ((suf)->pixels + (y) * (suf)->pitch + (x) * (suf)->format->BytesPerPixel)
|
||||
|
||||
struct _agsevent {
|
||||
int type;
|
||||
@@ -118,8 +113,8 @@ typedef struct ags_faderinfo ags_faderinfo_t;
|
||||
|
||||
|
||||
struct _ags {
|
||||
Pallet256 pal; /* system pallet */
|
||||
boolean pal_changed; /* system pallet has changed */
|
||||
Palette256 pal; /* system palette */
|
||||
boolean pal_changed; /* system palette has changed */
|
||||
|
||||
MyDimension world_size; /* size of off-screen */
|
||||
|
||||
@@ -135,8 +130,6 @@ struct _ags {
|
||||
|
||||
boolean fullscree_is_on; /* if full-screen mode then true */
|
||||
|
||||
|
||||
struct _FONT *font; /* font device */
|
||||
agsurface_t *dib; /* main surface */
|
||||
void (*eventcb)(agsevent_t *e); /* deliver event */
|
||||
};
|
||||
@@ -161,7 +154,6 @@ extern boolean ags_check_param(int *x, int *y, int *w, int *h);
|
||||
extern boolean ags_check_param_xy(int *x, int *y);
|
||||
extern void ags_intersection(MyRectangle *r1, MyRectangle *r2, MyRectangle *rst);
|
||||
extern agsurface_t *ags_getDIB();
|
||||
extern void ags_sync();
|
||||
|
||||
/* 画面更新 */
|
||||
extern void ags_setExposeSwitch(boolean bool);
|
||||
@@ -169,14 +161,13 @@ extern void ags_updateFull(void);
|
||||
extern void ags_updateArea(int x, int y, int width, int height);
|
||||
|
||||
/* パレット関係 */
|
||||
extern void ags_setPallets(Pallet256 *src_pal, int src, int dst, int cnt);
|
||||
extern void ags_setPallet(int no, int red, int green, int blue);
|
||||
extern void ags_setPalletToSystem(int src, int cnt);
|
||||
extern void ags_setPalettes(Palette256 *src_pal, int src, int dst, int cnt);
|
||||
extern void ags_setPalette(int no, int red, int green, int blue);
|
||||
extern void ags_setPaletteToSystem(int src, int cnt);
|
||||
|
||||
/* 描画関係 */
|
||||
extern void ags_drawRectangle(int x, int y, int w, int h, int col);
|
||||
extern void ags_fillRectangle(int x, int y, int w, int h, int col);
|
||||
extern void ags_fillRectangleNeg(int x, int y, int w, int h, int col);
|
||||
extern void ags_drawLine(int x0, int y0, int x1, int y1, int col);
|
||||
extern void ags_copyArea(int sx, int sy, int w, int h, int dx, int dy);
|
||||
extern void ags_scaledCopyArea(int sx, int sy, int sw, int sh, int dx, int dy, int dw, int dh, int mirror_sw);
|
||||
@@ -185,7 +176,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, Pallet *cell);
|
||||
extern void ags_getPixel(int x, int y, Palette *cell);
|
||||
extern void ags_changeColorArea(int x, int y, int w, int h, int dst, int src, int cnt);
|
||||
|
||||
extern void* ags_saveRegion(int x, int y, int w, int h);
|
||||
@@ -224,12 +215,6 @@ extern void ags_whiteOut(int rate, boolean flg);
|
||||
extern void ags_fader_callback();
|
||||
|
||||
/* フォント関連 */
|
||||
typedef enum {
|
||||
FONT_X11,
|
||||
FONT_FT2,
|
||||
FONT_SDLTTF
|
||||
} fontdev_t;
|
||||
|
||||
enum FontType {
|
||||
FONT_GOTHIC,
|
||||
FONT_MINCHO,
|
||||
@@ -250,102 +235,30 @@ extern boolean ags_getAntialiasedStringMode();
|
||||
extern void ags_fader(ags_faderinfo_t *);
|
||||
extern void ags_autorepeat(boolean bool);
|
||||
|
||||
#define RGB_RMASK15 0x7c00
|
||||
#define RGB_GMASK15 0x03e0
|
||||
#define RGB_BMASK15 0x001f
|
||||
#define RGB_RMASK16 0xf800
|
||||
#define RGB_GMASK16 0x07e0
|
||||
#define RGB_BMASK16 0x001f
|
||||
#define RGB_RMASK24 0x00ff0000
|
||||
#define RGB_GMASK24 0x0000ff00
|
||||
#define RGB_BMASK24 0x000000ff
|
||||
#define RMASK16 0xf800
|
||||
#define GMASK16 0x07e0
|
||||
#define BMASK16 0x001f
|
||||
#define RMASK24 0x00ff0000
|
||||
#define GMASK24 0x0000ff00
|
||||
#define BMASK24 0x000000ff
|
||||
|
||||
#define BGR_RMASK15 0x001f
|
||||
#define BGR_GMASK15 0x03e0
|
||||
#define BGR_BMASK15 0x7c00
|
||||
#define BGR_RMASK16 0x001f
|
||||
#define BGR_GMASK16 0x07e0
|
||||
#define BGR_BMASK16 0xf800
|
||||
#define BGR_RMASK24 0x000000ff
|
||||
#define BGR_GMASK24 0x0000ff00
|
||||
#define BGR_BMASK24 0x00ff0000
|
||||
#define PIXR16(pic) (BYTE)(((pic) & RMASK16) >> 8)
|
||||
#define PIXG16(pic) (BYTE)(((pic) & GMASK16) >> 3)
|
||||
#define PIXB16(pic) (BYTE)(((pic) & BMASK16) << 3)
|
||||
#define PIX16(r,g,b) (WORD)((((r) & 0xf8) << 8) | (((g) & 0xfc) << 3) | ((b ) >> 3))
|
||||
|
||||
#define RGB_PIXR15(pic) (BYTE)(((pic) & RGB_RMASK15) >> 7)
|
||||
#define RGB_PIXG15(pic) (BYTE)(((pic) & RGB_GMASK15) >> 2)
|
||||
#define RGB_PIXB15(pic) (BYTE)(((pic) & RGB_BMASK15) << 3)
|
||||
#define BGR_PIXR15(pic) (BYTE)(((pic) & BGR_RMASK15) << 3)
|
||||
#define BGR_PIXG15(pic) (BYTE)(((pic) & BGR_GMASK15) >> 2)
|
||||
#define BGR_PIXB15(pic) (BYTE)(((pic) & BGR_BMASK15) >> 7)
|
||||
#define RGB_PIX15(r,g,b) (WORD)((((r) & 0xf8) << 7) | (((g) & 0xf8) << 2) | ((b ) >> 3))
|
||||
#define BGR_PIX15(r,g,b) (WORD)((((r) ) >> 3) | (((g) & 0xf8) << 2) | ((b & 0xf8) << 7))
|
||||
|
||||
#define RGB_PIXR16(pic) (BYTE)(((pic) & RGB_RMASK16) >> 8)
|
||||
#define RGB_PIXG16(pic) (BYTE)(((pic) & RGB_GMASK16) >> 3)
|
||||
#define RGB_PIXB16(pic) (BYTE)(((pic) & RGB_BMASK16) << 3)
|
||||
#define BGR_PIXR16(pic) (BYTE)(((pic) & BGR_RMASK16) << 3)
|
||||
#define BGR_PIXG16(pic) (BYTE)(((pic) & BGR_GMASK16) >> 3)
|
||||
#define BGR_PIXB16(pic) (BYTE)(((pic) & BGR_BMASK16) >> 8)
|
||||
#define RGB_PIX16(r,g,b) (WORD)((((r) & 0xf8) << 8) | (((g) & 0xfc) << 3) | ((b ) >> 3))
|
||||
#define BGR_PIX16(r,g,b) (WORD)((((r) ) >> 3) | (((g) & 0xfc) << 3) | ((b & 0xf8) << 8))
|
||||
|
||||
#define RGB_PIXR24(pic) (BYTE)(((pic) & RGB_RMASK24) >> 16)
|
||||
#define RGB_PIXG24(pic) (BYTE)(((pic) & RGB_GMASK24) >> 8)
|
||||
#define RGB_PIXB24(pic) (BYTE)(((pic) & RGB_BMASK24) )
|
||||
#define BGR_PIXR24(pic) (BYTE)(((pic) & BGR_RMASK24) )
|
||||
#define BGR_PIXG24(pic) (BYTE)(((pic) & BGR_GMASK24) >> 8)
|
||||
#define BGR_PIXB24(pic) (BYTE)(((pic) & BGR_BMASK24) >> 16)
|
||||
#define RGB_PIX24(r,g,b) (DWORD)((((r) << 16) | ((g) << 8) | (b) ))
|
||||
#define BGR_PIX24(r,g,b) (DWORD)((((r) ) | ((g) << 8) | (b) << 16))
|
||||
|
||||
#ifdef RGB_ORDER
|
||||
#define PIXR15 RGB_PIXR15
|
||||
#define PIXG15 RGB_PIXG15
|
||||
#define PIXB15 RGB_PIXB15
|
||||
#define PIXR16 RGB_PIXR16
|
||||
#define PIXG16 RGB_PIXG16
|
||||
#define PIXB16 RGB_PIXB16
|
||||
#define PIXR24 RGB_PIXR24
|
||||
#define PIXG24 RGB_PIXG24
|
||||
#define PIXB24 RGB_PIXB24
|
||||
#define PIX15 RGB_PIX15
|
||||
#define PIX16 RGB_PIX16
|
||||
#define PIX24 RGB_PIX24
|
||||
#else
|
||||
#define PIXR15 BGR_PIXR15
|
||||
#define PIXG15 BGR_PIXG15
|
||||
#define PIXB15 BGR_PIXB15
|
||||
#define PIXR16 BGR_PIXR16
|
||||
#define PIXG16 BGR_PIXG16
|
||||
#define PIXB16 BGR_PIXB16
|
||||
#define PIXR24 BGR_PIXR24
|
||||
#define PIXG24 BGR_PIXG24
|
||||
#define PIXB24 BGR_PIXB24
|
||||
#define PIX15 BGR_PIX15
|
||||
#define PIX16 BGR_PIX16
|
||||
#define PIX24 BGR_PIX24
|
||||
#endif
|
||||
|
||||
#define ALPHABLEND15(f, b, a) (PIX15((((PIXR15((f)) - PIXR15((b))) * (a)) >> 8) + PIXR15((b)),\
|
||||
(((PIXG15((f)) - PIXG15((b))) * (a)) >> 8) + PIXG15((b)),\
|
||||
(((PIXB15((f)) - PIXB15((b))) * (a)) >> 8) + PIXB15((b))))
|
||||
|
||||
#define ALPHALEVEL15(p, lv) (PIX15(((PIXR15(p) * (lv)) >> 8),\
|
||||
((PIXG15(p) * (lv)) >> 8),\
|
||||
((PIXB15(p) * (lv)) >> 8)))
|
||||
|
||||
#define WHITELEVEL15(p, lv) ALPHABLEND15(0x7fff, p, lv)
|
||||
#define PIXR24(pic) (BYTE)(((pic) & RMASK24) >> 16)
|
||||
#define PIXG24(pic) (BYTE)(((pic) & GMASK24) >> 8)
|
||||
#define PIXB24(pic) (BYTE)(((pic) & BMASK24) )
|
||||
#define PIX24(r,g,b) (DWORD)((((r) << 16) | ((g) << 8) | (b) ))
|
||||
|
||||
#define ALPHABLEND16(f, b, a) (PIX16((((PIXR16((f)) - PIXR16((b))) * (a)) >> 8)+ PIXR16((b)),\
|
||||
(((PIXG16((f)) - PIXG16((b))) * (a)) >> 8)+ PIXG16((b)),\
|
||||
(((PIXB16((f)) - PIXB16((b))) * (a)) >> 8)+ PIXB16((b))))
|
||||
|
||||
#define ALPHALEVEL16(p, lv) PIX16(((PIXR16(p) * (lv)) >> 8),\
|
||||
((PIXG16(p) * (lv)) >> 8),\
|
||||
((PIXB16(p) * (lv)) >> 8))
|
||||
|
||||
#define RGB_ALPHALEVEL16(p, lv) PIX16(((RGB_PIXR16(p) * (lv)) >> 8),\
|
||||
((RGB_PIXG16(p) * (lv)) >> 8),\
|
||||
((RGB_PIXB16(p) * (lv)) >> 8))
|
||||
((PIXG16(p) * (lv)) >> 8),\
|
||||
((PIXB16(p) * (lv)) >> 8))
|
||||
|
||||
#define WHITELEVEL16(p, lv) ALPHABLEND16(0xffff,p,lv)
|
||||
|
||||
@@ -359,7 +272,6 @@ extern void ags_autorepeat(boolean bool);
|
||||
|
||||
#define WHITELEVEL24(p, lv) ALPHABLEND24(0xffffffff, p, lv)
|
||||
|
||||
#define SUTURADD15(pa, pb) PIX15(min(255,PIXR15(pa)+PIXR15(pb)), min(255, PIXG15(pa)+PIXG15(pb)), min(255, PIXB15(pa)+PIXB15(pb)));
|
||||
#define SUTURADD16(pa, pb) PIX16(min(255,PIXR16(pa)+PIXR16(pb)), min(255, PIXG16(pa)+PIXG16(pb)), min(255, PIXB16(pa)+PIXB16(pb)));
|
||||
//#define SUTURADD16(pa, pb) PIX16(min(255,(int)(PIXR16(pa))+(int)(PIXR16(pb))), min(255, (int)(PIXG16(pa))+(int)(PIXG16(pb))), min(255, (int)(PIXB16(pa))+(int)(PIXB16(pb))));
|
||||
#define SUTURADD24(pa, pb) PIX24(min(255,PIXR24(pa)+PIXR24(pb)), min(255, PIXG24(pa)+PIXG24(pb)), min(255, PIXB24(pa)+PIXB24(pb)));
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
* static methods
|
||||
*/
|
||||
static bmp_header *extract_header(BYTE *b);
|
||||
static void getpal(Pallet256 *pal, BYTE *b);
|
||||
static void getpal(Palette256 *pal, BYTE *b);
|
||||
static void extract_8bit(bmp_header *bmp, BYTE *pic, BYTE *b);
|
||||
static void extract_24bit(bmp_header *bmp, WORD *pic, BYTE *b);
|
||||
|
||||
@@ -64,11 +64,11 @@ static bmp_header *extract_header(BYTE *b) {
|
||||
}
|
||||
|
||||
/*
|
||||
* Get pallet from raw data
|
||||
* pal: pallet to be stored
|
||||
* b : raw data (pointer to pallet)
|
||||
* Get palette from raw data
|
||||
* pal: palette to be stored
|
||||
* b : raw data (pointer to palette)
|
||||
*/
|
||||
static void getpal(Pallet256 *pal, BYTE *b) {
|
||||
static void getpal(Palette256 *pal, BYTE *b) {
|
||||
int i;
|
||||
|
||||
for (i = 0; i < 256; i++) {
|
||||
@@ -160,7 +160,7 @@ boolean bmp256_checkfmt(BYTE *data) {
|
||||
}
|
||||
|
||||
/*
|
||||
* Extract 8bit bmp, header, pallet and pixel
|
||||
* Extract 8bit bmp, header, palette and pixel
|
||||
* data: raw data (pointer to data top)
|
||||
* return: extracted image data and information
|
||||
*/
|
||||
@@ -168,7 +168,7 @@ cgdata *bmp256_extract(BYTE *data) {
|
||||
bmp_header *bmp = extract_header(data);
|
||||
cgdata *cg = calloc(1, sizeof(cgdata));
|
||||
|
||||
cg->pal = malloc(sizeof(Pallet256));
|
||||
cg->pal = malloc(sizeof(Palette256));
|
||||
getpal(cg->pal, data + bmp->bmpPp);
|
||||
|
||||
/* +10: margin for broken cg */
|
||||
@@ -208,7 +208,7 @@ boolean bmp16m_checkfmt(BYTE *data) {
|
||||
}
|
||||
|
||||
/*
|
||||
* Extract 24bit bmp, header, pallet and pixel
|
||||
* Extract 24bit bmp, header, palette and pixel
|
||||
* data: raw data (pointer to data top)
|
||||
* return: extracted image data and information
|
||||
*/
|
||||
@@ -232,24 +232,3 @@ cgdata *bmp16m_extract(BYTE *data) {
|
||||
|
||||
return cg;
|
||||
}
|
||||
|
||||
/*
|
||||
* Extract bmp pallet only
|
||||
* data: raw data (pointer to data top)
|
||||
* return: extracted pallet data
|
||||
*/
|
||||
cgdata *bmp_getpal(BYTE *data) {
|
||||
cgdata *cg = calloc(1, sizeof(cgdata));
|
||||
bmp_header *bmp = extract_header(data);
|
||||
|
||||
cg->pal = malloc(sizeof(Pallet256));
|
||||
getpal(cg->pal, data + bmp->bmpPp);
|
||||
|
||||
cg->type = ALCG_BMP8;
|
||||
cg->pic = NULL;
|
||||
cg->alpha = NULL;
|
||||
|
||||
free(bmp);
|
||||
|
||||
return cg;
|
||||
}
|
||||
|
||||
@@ -50,6 +50,5 @@ extern boolean bmp256_checkfmt(BYTE *data);
|
||||
extern cgdata *bmp256_extract(BYTE *data);
|
||||
extern boolean bmp16m_checkfmt(BYTE *data);
|
||||
extern cgdata *bmp16m_extract(BYTE *data);
|
||||
extern cgdata *bmp_getpal(BYTE *data);
|
||||
|
||||
#endif /* !__BMP__ */
|
||||
|
||||
+3
-6
@@ -208,7 +208,7 @@ int cdrom_getPlayingInfo (cd_time *info) {
|
||||
struct cd_sub_channel_info data;
|
||||
|
||||
if (!enabled)
|
||||
goto errexit;
|
||||
return NG;
|
||||
memset(&s, 0, sizeof(s));
|
||||
|
||||
s.data = &data;
|
||||
@@ -217,17 +217,14 @@ int cdrom_getPlayingInfo (cd_time *info) {
|
||||
s.data_format = CD_CURRENT_POSITION;
|
||||
if (do_ioctl(CDIOCREADSUBCHANNEL, &s) < 0) {
|
||||
perror("CDIOCREADSUBCHANNEL");
|
||||
goto errexit;
|
||||
return NG;
|
||||
}
|
||||
if (s.data->header.audio_status != CD_AS_PLAY_IN_PROGRESS) {
|
||||
goto errexit;
|
||||
return NG;
|
||||
}
|
||||
info->t = s.data->what.position.track_number;
|
||||
info->m = s.data->what.position.reladdr.msf.minute;
|
||||
info->s = s.data->what.position.reladdr.msf.second;
|
||||
info->f = s.data->what.position.reladdr.msf.frame;
|
||||
return OK;
|
||||
errexit:
|
||||
info->t = info->m = info->s = info->f = 999;
|
||||
return NG;
|
||||
}
|
||||
|
||||
+4
-7
@@ -213,7 +213,7 @@ static int cdrom_start(int trk, int loop) {
|
||||
return OK;
|
||||
} else {
|
||||
ti.cdti_trk0 = ti.cdti_trk1 = trk;
|
||||
ti.cdti_ind0 = ti.cdti_ind0 = 0;
|
||||
ti.cdti_ind0 = ti.cdti_ind1 = 0;
|
||||
if (do_ioctl(CDROMPLAYTRKIND, &ti) < 0) {
|
||||
perror("CDROMPLAYTRKIND");
|
||||
return NG;
|
||||
@@ -241,22 +241,19 @@ static int cdrom_getPlayingInfo (cd_time *info) {
|
||||
struct cdrom_subchnl sc;
|
||||
|
||||
if (!enabled)
|
||||
goto errexit;
|
||||
return NG;
|
||||
|
||||
sc.cdsc_format = CDROM_MSF;
|
||||
if (do_ioctl(CDROMSUBCHNL, &sc) < 0) {
|
||||
perror("CDROMSUBCHNL");
|
||||
goto errexit;
|
||||
return NG;
|
||||
}
|
||||
if (sc.cdsc_audiostatus != CDROM_AUDIO_PLAY) {
|
||||
goto errexit;
|
||||
return NG;
|
||||
}
|
||||
info->t = sc.cdsc_trk;
|
||||
info->m = sc.cdsc_reladdr.msf.minute;
|
||||
info->s = sc.cdsc_reladdr.msf.second;
|
||||
info->f = sc.cdsc_reladdr.msf.frame;
|
||||
return OK;
|
||||
errexit:
|
||||
info->t = info->m = info->s = info->f = 999;
|
||||
return NG;
|
||||
}
|
||||
|
||||
@@ -59,6 +59,5 @@ int cdrom_stop() {
|
||||
}
|
||||
|
||||
int cdrom_getPlayingInfo (cd_time *info) {
|
||||
info->t = info->m = info->s = info->f = 999;
|
||||
return NG;
|
||||
}
|
||||
|
||||
@@ -69,6 +69,8 @@ int cdrom_getPlayingInfo(cd_time *info) {
|
||||
frame_of_getpos = nact->frame_count;
|
||||
|
||||
int t = EM_ASM_INT_V( return xsystem35.cdPlayer.getPosition(); );
|
||||
if (!t)
|
||||
return NG;
|
||||
info->t = t & 0xff;
|
||||
FRAMES_TO_MSF(t >> 8, &info->m, &info->s, &info->f);
|
||||
return OK;
|
||||
|
||||
+4
-11
@@ -198,18 +198,15 @@ static int cdrom_stop() {
|
||||
|
||||
/* 現在演奏中のトラック情報の取得 */
|
||||
static int cdrom_getPlayingInfo (cd_time *inf) {
|
||||
int cnt;
|
||||
|
||||
if (!enabled || !mix_music) {
|
||||
goto errout;
|
||||
}
|
||||
if (!enabled || !mix_music)
|
||||
return NG;
|
||||
|
||||
if (!Mix_PlayingMusic()) {
|
||||
Mix_FreeMusic(mix_music);
|
||||
mix_music = NULL;
|
||||
goto errout;
|
||||
return NG;
|
||||
}
|
||||
cnt = get_high_counter(SYSTEMCOUNTER_MP3) - counter;
|
||||
int cnt = get_high_counter(SYSTEMCOUNTER_MP3) - counter;
|
||||
|
||||
inf->t = trackno;
|
||||
inf->m = cnt / (60*100); cnt %= (60*100);
|
||||
@@ -217,8 +214,4 @@ static int cdrom_getPlayingInfo (cd_time *inf) {
|
||||
inf->f = (cnt * CD_FPS) / 100;
|
||||
|
||||
return OK;
|
||||
|
||||
errout:
|
||||
inf->t = inf->m = inf->s = inf->f = 999;
|
||||
return NG;
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@
|
||||
|
||||
/* VSPのパレット展開バンク */
|
||||
int cg_vspPB = -1;
|
||||
/* cg,pallet 展開フラグ (funciotn flag) */
|
||||
/* cg,palette 展開フラグ (funciotn flag) */
|
||||
int cg_fflg = 7;
|
||||
/* CGをロードした回数を書き込む変数 */
|
||||
int *cg_loadCountVar = NULL;
|
||||
@@ -50,8 +50,8 @@ int *cg_loadCountVar = NULL;
|
||||
int cg_alphaLevel = 255;
|
||||
|
||||
#define GCMD_EXTRACTCG(c) ((c) & 0x01)
|
||||
#define GCMD_SET_PALLET(c) ((c) & 0x02)
|
||||
#define GCMD_LOAD_PALLET(c) ((c) & 0x04)
|
||||
#define GCMD_SET_PALETTE(c) ((c) & 0x02)
|
||||
#define GCMD_LOAD_PALETTE(c) ((c) & 0x04)
|
||||
|
||||
/* CG表示位置に関する情報 */
|
||||
static CG_WHERETODISP loc_policy = OFFSET_NOMOVE, loc_policy0;
|
||||
@@ -98,9 +98,9 @@ static CG_TYPE check_cgformat(BYTE *data) {
|
||||
}
|
||||
|
||||
/*
|
||||
* Modify pixel accoding to pallet bank (vsp only)
|
||||
* Modify pixel accoding to palette bank (vsp only)
|
||||
* pic : pixel to be modifyied.
|
||||
* bank : pallet bank (use only MSB 4bit)
|
||||
* bank : palette bank (use only MSB 4bit)
|
||||
* width : image width
|
||||
* height: image height
|
||||
*/
|
||||
@@ -225,63 +225,43 @@ static cgdata *loader(int no) {
|
||||
|
||||
/* extract cg */
|
||||
/* size is only pixel data size */
|
||||
if (GCMD_EXTRACTCG(cg_fflg)) {
|
||||
switch(type) {
|
||||
case ALCG_VSP:
|
||||
cg = vsp_extract(dfile->data);
|
||||
size = cg->width * cg->height;
|
||||
break;
|
||||
case ALCG_PMS8:
|
||||
cg = pms256_extract(dfile->data);
|
||||
size = cg->width * cg->height;
|
||||
break;
|
||||
case ALCG_PMS16:
|
||||
cg = pms64k_extract(dfile->data);
|
||||
size = (cg->width * cg->height) * sizeof(WORD);
|
||||
break;
|
||||
case ALCG_BMP8:
|
||||
cg = bmp256_extract(dfile->data);
|
||||
size = cg->width * cg->height;
|
||||
break;
|
||||
case ALCG_BMP24:
|
||||
cg = bmp16m_extract(dfile->data);
|
||||
size = (cg->width * cg->height) * sizeof(WORD);
|
||||
break;
|
||||
case ALCG_QNT:
|
||||
cg = qnt_extract(dfile->data);
|
||||
size = (cg->width * cg->height) * 3;
|
||||
break;
|
||||
switch(type) {
|
||||
case ALCG_VSP:
|
||||
cg = vsp_extract(dfile->data);
|
||||
size = cg->width * cg->height;
|
||||
break;
|
||||
case ALCG_PMS8:
|
||||
cg = pms256_extract(dfile->data);
|
||||
size = cg->width * cg->height;
|
||||
break;
|
||||
case ALCG_PMS16:
|
||||
cg = pms64k_extract(dfile->data);
|
||||
size = (cg->width * cg->height) * sizeof(WORD);
|
||||
break;
|
||||
case ALCG_BMP8:
|
||||
cg = bmp256_extract(dfile->data);
|
||||
size = cg->width * cg->height;
|
||||
break;
|
||||
case ALCG_BMP24:
|
||||
cg = bmp16m_extract(dfile->data);
|
||||
size = (cg->width * cg->height) * sizeof(WORD);
|
||||
break;
|
||||
case ALCG_QNT:
|
||||
cg = qnt_extract(dfile->data);
|
||||
size = (cg->width * cg->height) * 3;
|
||||
break;
|
||||
#ifdef HAVE_JPEG
|
||||
case ALCG_JPEG:
|
||||
cg = jpeg_extract(dfile->data, dfile->size);
|
||||
size = (cg->width * cg->height) * sizeof(WORD);
|
||||
break;
|
||||
case ALCG_JPEG:
|
||||
cg = jpeg_extract(dfile->data, dfile->size);
|
||||
size = (cg->width * cg->height) * sizeof(WORD);
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
break;
|
||||
}
|
||||
/* insert to cache */
|
||||
if (cg)
|
||||
cache_insert(cacheid, no, cg, size, NULL);
|
||||
}
|
||||
|
||||
/* load pallet if not extracted */
|
||||
if (GCMD_LOAD_PALLET(cg_fflg) && cg == NULL) {
|
||||
/* XXXX うむ、こいつらどこで解放するんだ */
|
||||
switch(type) {
|
||||
case ALCG_VSP:
|
||||
cg = vsp_getpal(dfile->data);
|
||||
break;
|
||||
case ALCG_PMS8:
|
||||
cg = pms_getpal(dfile->data);
|
||||
break;
|
||||
case ALCG_BMP8:
|
||||
cg = bmp_getpal(dfile->data);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
/* insert to cache */
|
||||
if (cg)
|
||||
cache_insert(cacheid, no, cg, size, NULL);
|
||||
|
||||
/* ok to free */
|
||||
ald_freedata(dfile);
|
||||
@@ -335,7 +315,7 @@ void cg_load(int no, int flg) {
|
||||
if (GCMD_EXTRACTCG(cg_fflg) && cg->type == ALCG_VSP) {
|
||||
bank = cg_vspPB == -1 ? cg->vsp_bank : cg_vspPB;
|
||||
set_vspbank(cg->pic, bank << 4, cg->width, cg->height);
|
||||
/* copy pallets 0 -> bank */
|
||||
/* copy palettes 0 -> bank */
|
||||
{
|
||||
int i, i_dst = bank << 4;
|
||||
for (i = 0; i < 16; i++) {
|
||||
@@ -349,43 +329,39 @@ void cg_load(int no, int flg) {
|
||||
}
|
||||
}
|
||||
|
||||
/* copy pallet to system */
|
||||
if (GCMD_LOAD_PALLET(cg_fflg)) {
|
||||
/* copy palette to system */
|
||||
if (GCMD_LOAD_PALETTE(cg_fflg)) {
|
||||
switch(cg->type) {
|
||||
case ALCG_VSP:
|
||||
ags_setPallets(cg->pal, 0, bank << 4, 16);
|
||||
ags_setPalettes(cg->pal, 0, bank << 4, 16);
|
||||
break;
|
||||
case ALCG_PMS8:
|
||||
if (cg->pms_bank & 1)
|
||||
ags_setPallets(cg->pal, 10, 10, 6);
|
||||
ags_setPalettes(cg->pal, 10, 10, 6);
|
||||
if (cg->pms_bank & (1 << 15))
|
||||
//ags_setPallets(cg->pal, 240, 240, 15);
|
||||
ags_setPallets(cg->pal, 240, 240, 10);
|
||||
//ags_setPalettes(cg->pal, 240, 240, 15);
|
||||
ags_setPalettes(cg->pal, 240, 240, 10);
|
||||
for (i = 1; i < 15; i++) {
|
||||
if (cg->pms_bank & (1 << i)) {
|
||||
ags_setPallets(cg->pal, i * 16, i * 16, 16);
|
||||
ags_setPalettes(cg->pal, i * 16, i * 16, 16);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case ALCG_BMP8:
|
||||
ags_setPallets(cg->pal, 10, 10, 236);
|
||||
ags_setPalettes(cg->pal, 10, 10, 236);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
/* pallet load only */
|
||||
if (cg->pic == NULL) {
|
||||
cgdata_free(cg);
|
||||
}
|
||||
}
|
||||
|
||||
/* refrect pallet change */
|
||||
if (GCMD_SET_PALLET(cg_fflg)) {
|
||||
/* refrect palette change */
|
||||
if (GCMD_SET_PALETTE(cg_fflg)) {
|
||||
switch(cg->type) {
|
||||
case ALCG_VSP:
|
||||
case ALCG_PMS8:
|
||||
case ALCG_BMP8:
|
||||
ags_setPalletToSystem(0, 256);
|
||||
ags_setPaletteToSystem(0, 256);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@@ -505,15 +481,15 @@ int cg_load_with_filename(char *fname_utf8, int x, int y) {
|
||||
return status;
|
||||
}
|
||||
|
||||
/* load pallet if not extracted */
|
||||
if (GCMD_LOAD_PALLET(cg_fflg)) {
|
||||
/* load palette if not extracted */
|
||||
if (GCMD_LOAD_PALETTE(cg_fflg)) {
|
||||
if (cg->type == ALCG_BMP8)
|
||||
ags_setPallets(cg->pal, 10, 10, 236);
|
||||
ags_setPalettes(cg->pal, 10, 10, 236);
|
||||
}
|
||||
|
||||
if (GCMD_SET_PALLET(cg_fflg)) {
|
||||
if (GCMD_SET_PALETTE(cg_fflg)) {
|
||||
if (cg->type == ALCG_BMP8)
|
||||
ags_setPalletToSystem(0, 256);
|
||||
ags_setPaletteToSystem(0, 256);
|
||||
}
|
||||
|
||||
/* draw cg */
|
||||
@@ -551,10 +527,6 @@ void cg_get_info(int no, MyRectangle *info) {
|
||||
}
|
||||
}
|
||||
|
||||
cgdata *cg_loadonly(int no) {
|
||||
return loader(no);
|
||||
}
|
||||
|
||||
void cg_clear_display_loc() {
|
||||
clear_display_loc();
|
||||
}
|
||||
|
||||
@@ -45,23 +45,23 @@ typedef enum {
|
||||
* information for display cg data
|
||||
*/
|
||||
typedef struct {
|
||||
CG_TYPE type; /* cg format type */
|
||||
int x; /* default display location x */
|
||||
int y; /* default display location y */
|
||||
int width; /* image width */
|
||||
int height; /* image height */
|
||||
CG_TYPE type; // cg format type
|
||||
int x; // default display location x
|
||||
int y; // default display location y
|
||||
int width; // image width
|
||||
int height; // image height
|
||||
|
||||
BYTE *pic; /* extracted pixel data */
|
||||
BYTE *alpha; /* extracted alpha data if exists */
|
||||
Pallet256 *pal; /* extracted pallet data if exists */
|
||||
BYTE *pic; // extracted pixel data
|
||||
BYTE *alpha; // extracted alpha data if exists
|
||||
Palette256 *pal; // extracted palette data if exists
|
||||
|
||||
int vsp_bank; /* pallet bank for vsp */
|
||||
int pms_bank; /* pallet bank for pms */
|
||||
int vsp_bank; // palette bank for vsp
|
||||
int pms_bank; // palette bank for pms
|
||||
|
||||
int spritecolor; /* sprite color for vsp and pms8 */
|
||||
int alphalevel; /* alpha level of image */
|
||||
int spritecolor; // sprite color for vsp and pms8
|
||||
int alphalevel; // alpha level of image
|
||||
|
||||
int data_offset; /* pic offset for clipping */
|
||||
int data_offset; // pic offset for clipping
|
||||
} cgdata;
|
||||
|
||||
/*
|
||||
@@ -81,7 +81,6 @@ 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 cgdata *cg_loadonly(int no);
|
||||
extern void cg_clear_display_loc();
|
||||
|
||||
extern int cg_vspPB;
|
||||
|
||||
+24
-28
@@ -35,7 +35,7 @@
|
||||
#include "utfsjis.h"
|
||||
#include "hankaku.h"
|
||||
#include "ags.h"
|
||||
#include "graphicsdevice.h"
|
||||
#include "sdl_core.h"
|
||||
#include "ald_manager.h"
|
||||
#include "LittleEndian.h"
|
||||
#include "gametitle.h"
|
||||
@@ -413,7 +413,7 @@ void commands2F26() {
|
||||
char *t1, *t2, *t3;
|
||||
|
||||
t1 = toUTF8(title);
|
||||
t2 = toUTF8(v_str(dst_no -1));
|
||||
t2 = toUTF8(svar_get(dst_no));
|
||||
|
||||
mi_param.title = t1;
|
||||
mi_param.oldstring = t2;
|
||||
@@ -421,17 +421,15 @@ void commands2F26() {
|
||||
|
||||
menu_inputstring(&mi_param);
|
||||
if (mi_param.newstring == NULL) {
|
||||
v_strcpy(dst_no -1, NULL);
|
||||
svar_set(dst_no, NULL);
|
||||
free(t1); free(t2);
|
||||
return;
|
||||
}
|
||||
|
||||
t3 = fromUTF8(mi_param.newstring);
|
||||
|
||||
/* 全角文字以外は不可 */
|
||||
if (nact->encoding != SHIFT_JIS || !sjis_has_hankaku(t3)) {
|
||||
v_strcpy(dst_no -1, t3);
|
||||
}
|
||||
svar_set(dst_no, t3);
|
||||
|
||||
free(t1);
|
||||
free(t2);
|
||||
free(t3);
|
||||
@@ -444,7 +442,7 @@ void commands2F27() {
|
||||
char *string = sys_getString(0);
|
||||
|
||||
if (num > 0) {
|
||||
v_strcpy(num - 1, string);
|
||||
svar_set(num, string);
|
||||
} else {
|
||||
WARNING("MS: num <= 0\n");
|
||||
}
|
||||
@@ -502,6 +500,8 @@ void commands2F2A() {
|
||||
sysVar[0] = save_save_str_with_file(fname_utf8, _var, cnt);
|
||||
break;
|
||||
default:
|
||||
_var = getCaliValue();
|
||||
cnt = getCaliValue();
|
||||
WARNING("Unknown QE command\n");
|
||||
break;
|
||||
}
|
||||
@@ -652,7 +652,7 @@ void commands2F3C() {
|
||||
int ePos = getCaliValue();
|
||||
int *vResult = getCaliVariable();
|
||||
|
||||
*vResult = v_strGetCharType(eNum - 1, ePos);
|
||||
*vResult = svar_getCharType(eNum, ePos);
|
||||
|
||||
DEBUG_COMMAND("strGetCharType %d, %d, %d:\n", eNum, ePos, *vResult);
|
||||
}
|
||||
@@ -661,7 +661,7 @@ void commands2F3D() {
|
||||
int eNum = getCaliValue();
|
||||
int *vResult = getCaliVariable();
|
||||
|
||||
*vResult = v_strWidth(eNum -1);
|
||||
*vResult = svar_width(eNum);
|
||||
|
||||
DEBUG_COMMAND("strGetLengthASCII %d, %d:\n", eNum, *vResult);
|
||||
}
|
||||
@@ -746,7 +746,7 @@ void commands2F44() {
|
||||
int num2 = getCaliValue();
|
||||
char buf[256];
|
||||
|
||||
v_strcpy(num1 - 1, format_number(num2, fig, buf));
|
||||
svar_set(num1, format_number(num2, fig, buf));
|
||||
|
||||
DEBUG_COMMAND("MHH %d, %d, %d:\n", num1, fig, num2);
|
||||
}
|
||||
@@ -815,7 +815,7 @@ void commands2F4C() {
|
||||
r.x = eSrcX; r.y = eSrcY; r.width = eWidth; r.height = eHeight;
|
||||
p.x = eX, p.y = eY;
|
||||
|
||||
UpdateArea(&r, &p);
|
||||
sdl_updateArea(&r, &p);
|
||||
|
||||
DEBUG_COMMAND("grBlt %d, %d, %d, %d, %d, %d:\n",
|
||||
eX, eY, eSrcX, eSrcY, eWidth, eHeight);
|
||||
@@ -874,7 +874,7 @@ void commands2F52() {
|
||||
const char *s = CMAKE_SYSTEM_NAME;
|
||||
#endif
|
||||
|
||||
v_strcpy(eNum -1, s);
|
||||
svar_set(eNum, s);
|
||||
DEBUG_COMMAND("sysGetOsName %d: %s\n", eNum, s);
|
||||
}
|
||||
|
||||
@@ -925,7 +925,7 @@ void commands2F57() {
|
||||
INPUTSTRING_PARAM p;
|
||||
|
||||
t1 = toUTF8(sTitle);
|
||||
t2 = toUTF8(v_str(eStrVar -1));
|
||||
t2 = toUTF8(svar_get(eStrVar));
|
||||
p.title = t1;
|
||||
p.oldstring = t2;
|
||||
p.max = eLength;
|
||||
@@ -935,12 +935,8 @@ void commands2F57() {
|
||||
*vResult = 65535;
|
||||
} else {
|
||||
t3 = fromUTF8(p.newstring);
|
||||
if (nact->encoding != SHIFT_JIS || !sjis_has_hankaku(t3)) {
|
||||
v_strcpy(eStrVar -1, t3);
|
||||
*vResult = v_strlen(eStrVar -1);
|
||||
} else {
|
||||
*vResult = 65535;
|
||||
}
|
||||
svar_set(eStrVar, t3);
|
||||
*vResult = svar_length(eStrVar);
|
||||
free(t3);
|
||||
}
|
||||
free(t1);
|
||||
@@ -953,7 +949,7 @@ void commands2F58() {
|
||||
int eNum = getCaliValue();
|
||||
int *vResult = getCaliVariable();
|
||||
|
||||
*vResult = sjis_has_hankaku(v_str(eNum - 1)) ? 1 : 0;
|
||||
*vResult = sjis_has_hankaku(svar_get(eNum)) ? 1 : 0;
|
||||
|
||||
DEBUG_COMMAND("strCheckASCII %d, %d:\n", eNum, *vResult);
|
||||
}
|
||||
@@ -962,7 +958,7 @@ void commands2F59() {
|
||||
int eNum = getCaliValue();
|
||||
int *vResult = getCaliVariable();
|
||||
|
||||
*vResult = sjis_has_zenkaku(v_str(eNum - 1)) ? 1 : 0;
|
||||
*vResult = sjis_has_zenkaku(svar_get(eNum)) ? 1 : 0;
|
||||
|
||||
DEBUG_COMMAND("strCheckSJIS %d, %d:\n", eNum, *vResult);
|
||||
}
|
||||
@@ -982,7 +978,7 @@ void commands2F5B() {
|
||||
int eNum = getCaliValue();
|
||||
char *t1;
|
||||
|
||||
t1 = toUTF8(v_str(eNum) - 1);
|
||||
t1 = toUTF8(svar_get(eNum));
|
||||
menu_msgbox_open(t1);
|
||||
free(t1);
|
||||
|
||||
@@ -1148,7 +1144,7 @@ void commands2F67() {
|
||||
int i;
|
||||
|
||||
for (i = 0; i < nact->ain.fncnum; i++) {
|
||||
if (0 == strcmp(nact->ain.fnc[i].name, v_str(eStrNum -1))) {
|
||||
if (0 == strcmp(nact->ain.fnc[i].name, svar_get(eStrNum))) {
|
||||
fnctbl[eNum].page = nact->ain.fnc[i].page;
|
||||
fnctbl[eNum].index = nact->ain.fnc[i].index;
|
||||
break;
|
||||
@@ -1297,7 +1293,7 @@ void commands2F77() {
|
||||
int eStrNum = getCaliValue();
|
||||
int eSelectNum = getCaliValue();
|
||||
|
||||
v_strcpy(eStrNum -1, sel_gettext(eSelectNum));
|
||||
svar_set(eStrNum, sel_gettext(eSelectNum));
|
||||
|
||||
DEBUG_COMMAND("menuGetText %d,%d:\n", eStrNum, eSelectNum);
|
||||
}
|
||||
@@ -1356,9 +1352,9 @@ void commands2F7F() {
|
||||
int index = sys_getdw();
|
||||
int p1 = sys_getCaliValue();
|
||||
|
||||
sys_addMsg(v_str(p1 -1));
|
||||
sys_addMsg(svar_get(p1));
|
||||
|
||||
DEBUG_COMMAND("2F7F %d, %d(%s,%s):\n", index, p1, nact->ain.msg[index], v_str(p1 -1));
|
||||
DEBUG_COMMAND("2F7F %d, %d(%s,%s):\n", index, p1, nact->ain.msg[index], svar_get(p1));
|
||||
}
|
||||
|
||||
void commands2F80() {
|
||||
@@ -1398,7 +1394,7 @@ void commands2F82() {
|
||||
DEBUG_COMMAND("dataGetString %d,%d:\n", eStrNum, eNumof);
|
||||
|
||||
for (i = 0; i < eNumof; i++) {
|
||||
v_strcpy(eStrNum + i -1, p);
|
||||
svar_set(eStrNum + i, p);
|
||||
p += (strlen(p) + 1);
|
||||
}
|
||||
|
||||
|
||||
@@ -36,7 +36,6 @@ typedef void *entrypoint (void);
|
||||
void commands2F60() {
|
||||
int type = sys_getdw(); /* DLL type */
|
||||
int fnum = sys_getdw(); /* function number */
|
||||
entrypoint *function = NULL;
|
||||
|
||||
#ifdef ENABLE_MODULES
|
||||
if (dll == NULL) {
|
||||
|
||||
+1
-1
@@ -1044,7 +1044,7 @@ void check_command(int c0) {
|
||||
case 'X':
|
||||
{
|
||||
int num=getCaliValue();
|
||||
sys_addMsg(v_str(num - 1));
|
||||
sys_addMsg(svar_get(num));
|
||||
DEBUG_COMMAND("X %d:\n", num);
|
||||
}
|
||||
break;
|
||||
|
||||
+1
-1
@@ -30,7 +30,7 @@
|
||||
#include "selection.h"
|
||||
|
||||
/* 選択肢Window情報 */
|
||||
Bcom_WindowInfo selWinInfo[SELWINMAX] = {{ 464, 80, 160, 160, TRUE}, 0};
|
||||
Bcom_WindowInfo selWinInfo[SELWINMAX] = {{ 464, 80, 160, 160, TRUE }};
|
||||
/* 現在の選択肢Window番号 */
|
||||
static int selWinNo;
|
||||
/* 現在のMessageWindow番号 */
|
||||
|
||||
+1
-1
@@ -87,7 +87,7 @@ static void commandF1() {
|
||||
p += (strlen(p) + 1);
|
||||
}
|
||||
|
||||
v_strcpy(str_number - 1 , p);
|
||||
svar_set(str_number, p);
|
||||
p += (strlen(p) + 1);
|
||||
nact->datatbl_addr = (void *)p;
|
||||
}
|
||||
|
||||
+1
-1
@@ -27,7 +27,7 @@
|
||||
#include "portab.h"
|
||||
#include "xsystem35.h"
|
||||
#include "ags.h"
|
||||
#include "graphicsdevice.h"
|
||||
#include "sdl_core.h"
|
||||
#include "input.h"
|
||||
|
||||
#define REPEAT_RATE_FAST 60
|
||||
|
||||
@@ -125,6 +125,8 @@ void commandLE() {
|
||||
sysVar[0] = save_load_str_with_file(fname_utf8, _var, num);
|
||||
break;
|
||||
default:
|
||||
_var = getCaliValue();
|
||||
num = getCaliValue();
|
||||
WARNING("Unknown LE command %d\n", type);
|
||||
break;
|
||||
}
|
||||
|
||||
+24
-29
@@ -51,7 +51,7 @@ void commandMS() {
|
||||
char *str = sys_getString(':');
|
||||
|
||||
if (num > 0) { /* thanx tajiri@wizard */
|
||||
v_strcpy(num - 1, str);
|
||||
svar_set(num, str);
|
||||
} else {
|
||||
WARNING("MS: num(%d) <= 0\n", num);
|
||||
}
|
||||
@@ -66,7 +66,7 @@ void commandMP() {
|
||||
[SHIFT_JIS] = "\x81\x40",
|
||||
[UTF8] = " ",
|
||||
};
|
||||
const char *src = v_str(num1 - 1);
|
||||
const char *src = svar_get(num1);
|
||||
int chars = num2;
|
||||
char *str;
|
||||
|
||||
@@ -109,7 +109,7 @@ void commandMI() { /* T2 */
|
||||
char *t1, *t2, *t3;
|
||||
|
||||
t1 = toUTF8(title);
|
||||
t2 = toUTF8(v_str(dst_no -1));
|
||||
t2 = toUTF8(svar_get(dst_no));
|
||||
|
||||
mi_param.title = t1;
|
||||
mi_param.oldstring = t2;
|
||||
@@ -117,17 +117,15 @@ void commandMI() { /* T2 */
|
||||
|
||||
menu_inputstring(&mi_param);
|
||||
if (mi_param.newstring == NULL) {
|
||||
v_strcpy(dst_no -1, NULL);
|
||||
svar_set(dst_no, NULL);
|
||||
free(t1); free(t2);
|
||||
return;
|
||||
}
|
||||
|
||||
t3 = fromUTF8(mi_param.newstring);
|
||||
|
||||
/* 全角文字以外は不可 */
|
||||
if (nact->encoding != SHIFT_JIS ||!sjis_has_hankaku(t3)) {
|
||||
v_strcpy(dst_no -1, t3);
|
||||
}
|
||||
svar_set(dst_no, t3);
|
||||
|
||||
free(t1);
|
||||
free(t2);
|
||||
free(t3);
|
||||
@@ -140,11 +138,11 @@ void commandMA() {
|
||||
int num2 = getCaliValue();
|
||||
|
||||
if (num1 == num2) {
|
||||
char *buf = strdup(v_str(num2 - 1));
|
||||
v_strcat(num1 - 1, buf);
|
||||
char *buf = strdup(svar_get(num2));
|
||||
svar_append(num1, buf);
|
||||
free(buf);
|
||||
} else {
|
||||
v_strcat(num1 - 1, v_str(num2 - 1));
|
||||
svar_append(num1, svar_get(num2));
|
||||
}
|
||||
|
||||
DEBUG_COMMAND("MA %d,%d:\n",num1,num2);
|
||||
@@ -155,7 +153,7 @@ void commandMC() {
|
||||
int num1 = getCaliValue();
|
||||
int num2 = getCaliValue();
|
||||
|
||||
sysVar[0] = strcmp(v_str(num1 - 1), v_str(num2 - 1)) == 0 ? 1 : 0;
|
||||
sysVar[0] = strcmp(svar_get(num1), svar_get(num2)) == 0 ? 1 : 0;
|
||||
|
||||
DEBUG_COMMAND("MC %d,%d:\n",num1,num2);
|
||||
}
|
||||
@@ -188,7 +186,7 @@ void commandMM() {
|
||||
int num2 = getCaliValue();
|
||||
|
||||
if (num1 != num2)
|
||||
v_strcpy(num1 - 1, v_str(num2 - 1));
|
||||
svar_set(num1, svar_get(num2));
|
||||
|
||||
DEBUG_COMMAND("MM %d,%d:\n",num1, num2);
|
||||
}
|
||||
@@ -201,7 +199,7 @@ void commandMH() {
|
||||
|
||||
char buf[512];
|
||||
char *s = fromSJIS(format_number_zenkaku(num2, fig, buf));
|
||||
v_strcpy(num1 - 1, s);
|
||||
svar_set(num1, s);
|
||||
free(s);
|
||||
|
||||
DEBUG_COMMAND("MH %d,%d,%d:\n",num1,fig,num2);
|
||||
@@ -220,7 +218,7 @@ void commandML() {
|
||||
int *var = getCaliVariable();
|
||||
int str_no = getCaliValue();
|
||||
|
||||
*var = v_strlen(str_no -1);
|
||||
*var = svar_length(str_no);
|
||||
|
||||
DEBUG_COMMAND("ML %p,%d:\n",var, str_no);
|
||||
}
|
||||
@@ -231,7 +229,7 @@ void commandMD() {
|
||||
int src_str_no = getCaliValue();
|
||||
int len = getCaliValue();
|
||||
|
||||
v_strncpy(dst_str_no - 1, 0, src_str_no - 1, 0, len);
|
||||
svar_copy(dst_str_no, 0, src_str_no, 0, len);
|
||||
|
||||
DEBUG_COMMAND("MD %d,%d,%d:\n",dst_str_no, src_str_no, len);
|
||||
}
|
||||
@@ -244,7 +242,7 @@ void commandME() {
|
||||
int src_pos = getCaliValue();
|
||||
int len = getCaliValue();
|
||||
|
||||
v_strncpy(dst_str_no - 1, dst_pos, src_str_no - 1, src_pos, len);
|
||||
svar_copy(dst_str_no, dst_pos, src_str_no, src_pos, len);
|
||||
|
||||
DEBUG_COMMAND("ME %d,%d,%d,%d,%d:\n",dst_str_no, dst_pos, src_str_no, src_pos, len);
|
||||
}
|
||||
@@ -256,7 +254,7 @@ void commandMF() {
|
||||
int key_no = getCaliValue();
|
||||
int start_pos = getCaliValue();
|
||||
|
||||
int pos = v_strstr(dst_no - 1, start_pos, v_str(key_no - 1));
|
||||
int pos = svar_find(dst_no, start_pos, svar_get(key_no));
|
||||
|
||||
if (pos < 0) {
|
||||
sysVar[0] = 255;
|
||||
@@ -279,7 +277,7 @@ void commandMZ0() {
|
||||
/* いつからか、文字列変数の最大長さは∞になったようだ */
|
||||
if (max_len == 0) max_len = STRVAR_LEN * 2;
|
||||
|
||||
v_initStringVars(max_num,max_len * 2 + 1);
|
||||
svar_init(max_num, max_len * 2 + 1);
|
||||
}
|
||||
|
||||
void commandMG() {
|
||||
@@ -306,7 +304,7 @@ void commandMG() {
|
||||
case 4:
|
||||
sw = getCaliValue();
|
||||
nact->msg.mg_curStrVarNo = nact->msg.mg_startStrVarNo + sw;
|
||||
v_strcpy(nact->msg.mg_curStrVarNo -1, "");
|
||||
svar_set(nact->msg.mg_curStrVarNo, "");
|
||||
break;
|
||||
case 5:
|
||||
var = getCaliVariable();
|
||||
@@ -318,7 +316,7 @@ void commandMG() {
|
||||
break;
|
||||
case 7:
|
||||
var = getCaliVariable();
|
||||
*var = v_strlen(nact->msg.mg_curStrVarNo -1);
|
||||
*var = svar_length(nact->msg.mg_curStrVarNo);
|
||||
break;
|
||||
case 100:
|
||||
sw = getCaliValue();
|
||||
@@ -343,7 +341,7 @@ void commandMJ() {
|
||||
INPUTSTRING_PARAM mj_param;
|
||||
char *t1, *t2;
|
||||
|
||||
t1 = toUTF8(v_str(num -1));
|
||||
t1 = toUTF8(svar_get(num));
|
||||
mj_param.max = max_len;
|
||||
mj_param.x = x;
|
||||
mj_param.y = y;
|
||||
@@ -355,9 +353,8 @@ void commandMJ() {
|
||||
if (mj_param.newstring == NULL) return;
|
||||
|
||||
t2 = fromUTF8(mj_param.newstring);
|
||||
if (nact->encoding != SHIFT_JIS || !sjis_has_hankaku(t2)) {
|
||||
v_strcpy(num -1, t2);
|
||||
}
|
||||
svar_set(num, t2);
|
||||
|
||||
free(t1);
|
||||
free(t2);
|
||||
DEBUG_COMMAND("MJ %d,%d,%d,%d,%d:\n", num, x, y, h, max_len);
|
||||
@@ -367,17 +364,15 @@ void commandMN() {
|
||||
int no = sys_getc();
|
||||
int num = getCaliValue();
|
||||
int *var = getCaliVariable();
|
||||
int i, len;
|
||||
const char *b;
|
||||
|
||||
switch(no) {
|
||||
case 0:
|
||||
/* 文字列を配列に変換する */
|
||||
sysVar[0] = v_strToVars(num - 1, var);
|
||||
sysVar[0] = svar_toVars(num, var);
|
||||
break;
|
||||
case 1:
|
||||
/* 配列を文字列に変換する */
|
||||
v_strFromVars(num - 1, var);
|
||||
svar_fromVars(num, var);
|
||||
break;
|
||||
default:
|
||||
WARNING("UnKnown MN command(%d)\n", no);
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <math.h>
|
||||
#include "portab.h"
|
||||
#include "utfsjis.h"
|
||||
@@ -359,6 +360,8 @@ void commandNI() { /* From Panyo */
|
||||
ni_param.def = def;
|
||||
ni_param.max = _max;
|
||||
ni_param.min = _min;
|
||||
if (!ni_param.title)
|
||||
ni_param.title = strdup("");
|
||||
|
||||
menu_inputnumber(&ni_param);
|
||||
|
||||
|
||||
+7
-7
@@ -98,8 +98,8 @@ void commandPS() {
|
||||
Green = getCaliValue();
|
||||
Blue = getCaliValue();
|
||||
|
||||
ags_setPallet(Plane , Red, Green, Blue);
|
||||
ags_setPalletToSystem(Plane, 1);
|
||||
ags_setPalette(Plane, Red, Green, Blue);
|
||||
ags_setPaletteToSystem(Plane, 1);
|
||||
DEBUG_COMMAND("PS %d,%d,%d,%d:\n", Plane, Red, Green, Blue);
|
||||
}
|
||||
|
||||
@@ -126,9 +126,9 @@ void commandPP() { /* T2 */
|
||||
int i;
|
||||
|
||||
for (i = 0; i < num2; i++) {
|
||||
ags_setPallet(num1 + i, *var, *(var +1), *(var +2)); var+=3;
|
||||
ags_setPalette(num1 + i, *var, *(var +1), *(var +2)); var+=3;
|
||||
}
|
||||
ags_setPalletToSystem(num1, num2);
|
||||
ags_setPaletteToSystem(num1, num2);
|
||||
DEBUG_COMMAND("PP %p,%d,%d:\n", var, num1, num2);
|
||||
}
|
||||
|
||||
@@ -155,7 +155,7 @@ void commandPT0() {
|
||||
int *var = getCaliVariable();
|
||||
int x = getCaliValue();
|
||||
int y = getCaliValue();
|
||||
Pallet cell;
|
||||
Palette cell;
|
||||
|
||||
ags_getPixel(x, y, &cell);
|
||||
*var = cell.pixel;
|
||||
@@ -170,7 +170,7 @@ void commandPT1() {
|
||||
int *b_var = getCaliVariable();
|
||||
int x = getCaliValue();
|
||||
int y = getCaliValue();
|
||||
Pallet cell;
|
||||
Palette cell;
|
||||
|
||||
ags_getPixel(x, y, &cell);
|
||||
*r_var = cell.r;
|
||||
@@ -186,7 +186,7 @@ void commandPT2() {
|
||||
int *low_var = getCaliVariable();
|
||||
int x = getCaliValue();
|
||||
int y = getCaliValue();
|
||||
Pallet cell;
|
||||
Palette cell;
|
||||
int r, g, b, pic;
|
||||
|
||||
ags_getPixel(x, y, &cell);
|
||||
|
||||
@@ -100,6 +100,8 @@ void commandQE() {
|
||||
sysVar[0] = save_save_str_with_file(fname_utf8, _var, cnt);
|
||||
break;
|
||||
default:
|
||||
_var = getCaliValue();
|
||||
cnt = getCaliValue();
|
||||
WARNING("Unknown QE command %d\n", type);
|
||||
break;
|
||||
}
|
||||
|
||||
+14
-13
@@ -56,17 +56,19 @@ void commandSS() {
|
||||
void commandSC() {
|
||||
/* CDのプレイ中のタイムを取得する */
|
||||
int *var = getCaliVariable();
|
||||
cd_time info;
|
||||
int t, m, s, f;
|
||||
|
||||
mus_cdrom_get_playposition(&info);
|
||||
if (info.t == 999) {
|
||||
*var++ = 999;
|
||||
if (mus_cdrom_get_playposition(&t, &m, &s, &f) == OK) {
|
||||
*var++ = t - 1;
|
||||
*var++ = m;
|
||||
*var++ = s;
|
||||
*var++ = f;
|
||||
} else {
|
||||
*var++ = info.t - 1;
|
||||
*var++ = 999;
|
||||
*var++ = 999;
|
||||
*var++ = 999;
|
||||
*var++ = 999;
|
||||
}
|
||||
*var++ = info.m;
|
||||
*var++ = info.s;
|
||||
*var++ = info.f;
|
||||
|
||||
DEBUG_COMMAND("SC %p:\n",var);
|
||||
}
|
||||
@@ -98,12 +100,11 @@ void commandSR() {
|
||||
var = getCaliVariable();
|
||||
|
||||
if (num == 0) {
|
||||
cd_time info;
|
||||
mus_cdrom_get_playposition(&info);
|
||||
if (info.t == 999) {
|
||||
*var = 0;
|
||||
int t, m, s, f;
|
||||
if (mus_cdrom_get_playposition(&t, &m, &s, &f) == OK) {
|
||||
*var = t - 1;
|
||||
} else {
|
||||
*var = info.t - 1;
|
||||
*var = 0;
|
||||
}
|
||||
} else {
|
||||
midiplaystate st;
|
||||
|
||||
+2
-2
@@ -794,7 +794,7 @@ void commandVA() { /* from Panyo */
|
||||
/* キー抜け無し ,p3=0は指定不可 */
|
||||
while(VAcmd[p1].state == VA_RUNNING) {
|
||||
va_animationAlone(p1);
|
||||
Sleep(10);
|
||||
sdl_sleep(10);
|
||||
}
|
||||
va_drawUnit(p1);
|
||||
va_updateUnit(p1);
|
||||
@@ -804,7 +804,7 @@ void commandVA() { /* from Panyo */
|
||||
VAcmd[p1].rewrite = TRUE;
|
||||
while(VAcmd[p1].state == VA_RUNNING) {
|
||||
va_animationAlone(p1);
|
||||
Sleep(10);
|
||||
sdl_sleep(10);
|
||||
key = sys_getInputInfo();
|
||||
if (key != 0) {
|
||||
sysVar[0] = key;
|
||||
|
||||
+3
-3
@@ -167,7 +167,7 @@ void commandZD() {
|
||||
break;
|
||||
case 2:
|
||||
sw = getCaliValue();
|
||||
DEBUG_MESSAGE("(ZD2)%s\n", v_str(sw -1));
|
||||
DEBUG_MESSAGE("(ZD2)%s\n", svar_get(sw));
|
||||
break;
|
||||
case 3:
|
||||
sw = getCaliValue(); break;
|
||||
@@ -352,7 +352,7 @@ void commandZZ2() {
|
||||
#else
|
||||
static BYTE str[] = {0x82, 0x74, 0x82, 0x8e, 0x82, 0x8b, 0x82, 0x8e, 0x82, 0x8f, 0x82, 0x97, 0x82, 0x8e, 0};
|
||||
#endif
|
||||
v_strcpy(num -1, str);
|
||||
svar_set(num, str);
|
||||
|
||||
DEBUG_COMMAND("ZZ2 %d:\n",num);
|
||||
}
|
||||
@@ -459,7 +459,7 @@ void commandZZ14() {
|
||||
#endif
|
||||
|
||||
if (no <= 0) return;
|
||||
v_strcpy(no -1, s);
|
||||
svar_set(no, s);
|
||||
|
||||
DEBUG_COMMAND("ZZ14 %d:\n", no);
|
||||
}
|
||||
|
||||
+4
-3
@@ -29,7 +29,7 @@
|
||||
#include "cursor.h"
|
||||
#include "LittleEndian.h"
|
||||
#include "ald_manager.h"
|
||||
#include "graphicsdevice.h"
|
||||
#include "sdl_core.h"
|
||||
|
||||
static CursorHeader cursorHeader;
|
||||
static TCursorDirEntry cursordirentry;
|
||||
@@ -228,9 +228,10 @@ static int read_bitmapinfo(BYTE* data) {
|
||||
|
||||
static int read_rgbquad(BYTE* data) {
|
||||
int j;
|
||||
int colors=2;
|
||||
const int colors=2;
|
||||
BYTE* p = data;
|
||||
|
||||
free(cursorImage.icColors);
|
||||
cursorImage.icColors = malloc(sizeof(TRGBQuad) * colors);
|
||||
|
||||
if (cursorImage.icColors == NULL) { /* shouldn't happen */
|
||||
@@ -292,7 +293,7 @@ static boolean cursor_load_mono(BYTE *d, int no) {
|
||||
pos += p1;
|
||||
|
||||
/* read pixedl data */
|
||||
if (CursorNew(d + pos, no, &cursorImage, &cursordirentry) == FALSE) {
|
||||
if (sdl_cursorNew(d + pos, no, &cursorImage, &cursordirentry) == FALSE) {
|
||||
WARNING("unable to read pixel data\n");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
+15
-16
@@ -74,7 +74,7 @@ static void eCopyUpdateArea(int sx, int sy, int w, int h, int dx, int dy) {
|
||||
dst.x = dx - nact->sys_view_area.x;
|
||||
dst.y = dy - nact->sys_view_area.y;
|
||||
|
||||
UpdateArea(&src, &dst);
|
||||
sdl_updateArea(&src, &dst);
|
||||
}
|
||||
|
||||
static int eCopyArea1(int dx, int dy, int w, int h, int opt) {
|
||||
@@ -243,13 +243,13 @@ static int eCopyArea9(int sx, int sy, int w, int h, int dx, int dy, int opt) {
|
||||
cnt+=waitcnt;
|
||||
for (y = 0; y < h -15; y+=16) {
|
||||
for (x = 0; x < (w -7); x+=16) {
|
||||
CopyArea(sx + x + hintX[i],sy + y + hintY[i], 8, 8, dx + x + hintX[i], dy + y + hintY[i]);
|
||||
sdl_copyArea(sx + x + hintX[i],sy + y + hintY[i], 8, 8, dx + x + hintX[i], dy + y + hintY[i]);
|
||||
}
|
||||
}
|
||||
ags_updateArea(dx, dy, w, h);
|
||||
EC_WAIT;
|
||||
}
|
||||
CopyArea(sx, sy, w, h, dx, dy);
|
||||
sdl_copyArea(sx, sy, w, h, dx, dy);
|
||||
ags_updateArea(dx, dy, w, h);
|
||||
return key;
|
||||
}
|
||||
@@ -259,7 +259,7 @@ static void eCopyArea10(int step) {
|
||||
return;
|
||||
}
|
||||
if (step == 64) {
|
||||
CopyArea(ecp.sx, ecp.sy, ecp.w, ecp.h, ecp.dx, ecp.dy);
|
||||
sdl_copyArea(ecp.sx, ecp.sy, ecp.w, ecp.h, ecp.dx, ecp.dy);
|
||||
ags_updateArea(ecp.dx, ecp.dy, ecp.w, ecp.h);
|
||||
return;
|
||||
}
|
||||
@@ -474,7 +474,7 @@ static int eCopyArea23(int sx, int sy, int w, int h, int dx, int dy, int opt) {
|
||||
cnt += waitcnt;
|
||||
for (y = 0; y < (h -3); y+=4) {
|
||||
for (x = 0; x < (w -3); x+=4) {
|
||||
CopyArea(sx + x + hintX[i], sy + y + hintY[i], 2, 2,
|
||||
sdl_copyArea(sx + x + hintX[i], sy + y + hintY[i], 2, 2,
|
||||
dx + x + hintX[i], dy + y + hintY[i]);
|
||||
}
|
||||
}
|
||||
@@ -494,7 +494,7 @@ static int eCopyArea24(int sx, int sy, int w, int h, int dx, int dy, int opt) {
|
||||
cnt = get_ecounter();
|
||||
for (i = 0; i < 8; i++ ) {
|
||||
cnt += waitcnt;
|
||||
Mosaic(sx, sy, w, h, dx, dy, slices[i]);
|
||||
sdl_Mosaic(sx, sy, w, h, dx, dy, slices[i]);
|
||||
ags_updateArea(dx, dy, w, h);
|
||||
EC_WAIT;
|
||||
}
|
||||
@@ -683,7 +683,7 @@ static void eCopyArea32(int step) {
|
||||
}
|
||||
ags_putRegion(save, ecp.dx, ecp.dy);
|
||||
ags_copyArea_alphaBlend(ecp.sx, ecp.sy, ecp.w, ecp.h, ecp.dx, ecp.dy, step*4);
|
||||
Mosaic(ecp.sx, ecp.sy, ecp.w, ecp.h, ecp.dx, ecp.dy, slices[step >> 1]);
|
||||
sdl_Mosaic(ecp.sx, ecp.sy, ecp.w, ecp.h, ecp.dx, ecp.dy, slices[step >> 1]);
|
||||
ags_updateArea(ecp.dx, ecp.dy, ecp.w, ecp.h);
|
||||
}
|
||||
|
||||
@@ -1085,19 +1085,19 @@ static void eCopyArea43(int step) {
|
||||
}
|
||||
|
||||
static void eCopyArea44(int step) {
|
||||
Maskupdate(ecp.sx, ecp.sy, ecp.w, ecp.h, ecp.dx, ecp.dy, 44, step);
|
||||
sdl_maskupdate(ecp.sx, ecp.sy, ecp.w, ecp.h, ecp.dx, ecp.dy, 44, step);
|
||||
}
|
||||
|
||||
static void eCopyArea45(int step) {
|
||||
Maskupdate(ecp.sx, ecp.sy, ecp.w, ecp.h, ecp.dx, ecp.dy, 45, step);
|
||||
sdl_maskupdate(ecp.sx, ecp.sy, ecp.w, ecp.h, ecp.dx, ecp.dy, 45, step);
|
||||
}
|
||||
|
||||
static void eCopyArea46(int step) {
|
||||
Maskupdate(ecp.sx, ecp.sy, ecp.w, ecp.h, ecp.dx, ecp.dy, 46, step);
|
||||
sdl_maskupdate(ecp.sx, ecp.sy, ecp.w, ecp.h, ecp.dx, ecp.dy, 46, step);
|
||||
}
|
||||
|
||||
static void eCopyArea47(int step) {
|
||||
Maskupdate(ecp.sx, ecp.sy, ecp.w, ecp.h, ecp.dx, ecp.dy, 47, step);
|
||||
sdl_maskupdate(ecp.sx, ecp.sy, ecp.w, ecp.h, ecp.dx, ecp.dy, 47, step);
|
||||
}
|
||||
|
||||
static int eCopyArea48(int dx, int dy, int w, int h, int opt) {
|
||||
@@ -1139,15 +1139,15 @@ static int eCopyArea49(int dx, int dy, int w, int h, int opt) {
|
||||
}
|
||||
|
||||
static void eCopyArea50(int step) {
|
||||
Maskupdate(ecp.sx, ecp.sy, ecp.w, ecp.h, ecp.dx, ecp.dy, 50, step);
|
||||
sdl_maskupdate(ecp.sx, ecp.sy, ecp.w, ecp.h, ecp.dx, ecp.dy, 50, step);
|
||||
}
|
||||
|
||||
static void eCopyArea51(int step) {
|
||||
Maskupdate(ecp.sx, ecp.sy, ecp.w, ecp.h, ecp.dx, ecp.dy, 51, step);
|
||||
sdl_maskupdate(ecp.sx, ecp.sy, ecp.w, ecp.h, ecp.dx, ecp.dy, 51, step);
|
||||
}
|
||||
|
||||
static void eCopyArea52(int step) {
|
||||
Maskupdate(ecp.sx, ecp.sy, ecp.w, ecp.h, ecp.dx, ecp.dy, 52, step);
|
||||
sdl_maskupdate(ecp.sx, ecp.sy, ecp.w, ecp.h, ecp.dx, ecp.dy, 52, step);
|
||||
}
|
||||
|
||||
static int eCopyArea1000(int sx, int sy, int w, int h, int dx, int dy, int opt, int spCol) {
|
||||
@@ -1161,7 +1161,7 @@ static int eCopyArea1001(int sx, int sy, int w, int h, int dx, int dy, int opt,
|
||||
}
|
||||
|
||||
static int eCopyArea2000(int sx, int sy, int w, int h, int dx, int dy, int opt) {
|
||||
FillRectangle(dx, dy, w, h, 0);
|
||||
sdl_fillRectangle(dx, dy, w, h, 0);
|
||||
ags_copyArea_alphaLevel(sx, sy, w, h, dx, dy, opt);
|
||||
ags_updateArea(dx, dy, w, h);
|
||||
return sys_getInputInfo();
|
||||
@@ -1209,7 +1209,6 @@ void ags_eCopyArea(int sx, int sy, int w, int h, int dx, int dy, int sw, int opt
|
||||
int ret = 0;
|
||||
ags_faderinfo_t i;
|
||||
|
||||
ags_sync();
|
||||
#if 0
|
||||
NOTICE("ec_area sx %d sy %d w %d h %d dx %d dy %d sw %d opt %d spc %d cancel %s\n",
|
||||
sx, sy, w, h, dx, dy, sw, opt, spCol, cancel ? "True" : "False");
|
||||
|
||||
+176
-29
@@ -1,6 +1,4 @@
|
||||
/*
|
||||
* font.c font device selecter
|
||||
*
|
||||
* Copyright (C) 1997-1998 Masaki Chikama (Wren) <chikama@kasumi.ipl.mech.nagoya-u.ac.jp>
|
||||
* 1998- <masaki-c@is.aist-nara.ac.jp>
|
||||
*
|
||||
@@ -19,44 +17,193 @@
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
/* $Id: font.c,v 1.1 2002/09/18 13:16:22 chikama Exp $ */
|
||||
#include "config.h"
|
||||
|
||||
#include <limits.h>
|
||||
#include <math.h>
|
||||
#include <SDL.h>
|
||||
#include <SDL_ttf.h>
|
||||
#ifdef __EMSCRIPTEN__
|
||||
#include <emscripten.h>
|
||||
#endif
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include "portab.h"
|
||||
#include "nact.h"
|
||||
#include "ags.h"
|
||||
#include "system.h"
|
||||
#include "font.h"
|
||||
#include "sdl_private.h"
|
||||
|
||||
void font_init(int dev) {
|
||||
switch(dev) {
|
||||
#ifdef ENABLE_X11FONT
|
||||
case FONT_X11:
|
||||
nact->ags.font = font_x11_new();
|
||||
break;
|
||||
#endif
|
||||
#ifdef ENABLE_FT2
|
||||
case FONT_FT2:
|
||||
nact->ags.font = font_ft2_new();
|
||||
break;
|
||||
#endif
|
||||
#ifdef ENABLE_SDLTTF
|
||||
case FONT_SDLTTF:
|
||||
nact->ags.font = font_sdlttf_new();
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
#ifndef ENABLE_SDL
|
||||
nact->ags.font = font_x11_new();
|
||||
#endif
|
||||
break;
|
||||
typedef struct {
|
||||
int size;
|
||||
int type;
|
||||
TTF_Font *id;
|
||||
} FontTable;
|
||||
|
||||
#define FONTTABLEMAX 256
|
||||
static FontTable fonttbl[FONTTABLEMAX];
|
||||
static int fontcnt = 0;
|
||||
|
||||
static FontTable *fontset;
|
||||
|
||||
static struct {
|
||||
boolean antialiase_on;
|
||||
const char *name[FONTTYPEMAX];
|
||||
int face[FONTTYPEMAX];
|
||||
} this;
|
||||
|
||||
static void font_insert(int size, int type, TTF_Font *font) {
|
||||
fonttbl[fontcnt].size = size;
|
||||
fonttbl[fontcnt].type = type;
|
||||
fonttbl[fontcnt].id = font;
|
||||
|
||||
if (fontcnt >= (FONTTABLEMAX -1)) {
|
||||
WARNING("Font table is full.\n");
|
||||
} else {
|
||||
fontcnt++;
|
||||
}
|
||||
}
|
||||
|
||||
static FontTable *font_lookup(int size, int type) {
|
||||
int i;
|
||||
|
||||
for (i = 0; i < fontcnt; i++) {
|
||||
if (fonttbl[i].size == size && fonttbl[i].type == type) {
|
||||
return &fonttbl[i];
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void font_select(int type, int size) {
|
||||
FontTable *tbl;
|
||||
|
||||
if (NULL == (tbl = font_lookup(size, type))) {
|
||||
TTF_Font *fs;
|
||||
|
||||
fs = TTF_OpenFontIndex(this.name[type], size, this.face[type]);
|
||||
|
||||
if (fs == NULL) {
|
||||
WARNING("%s is not found:\n", this.name[type]);
|
||||
return;
|
||||
}
|
||||
|
||||
font_insert(size, type, fs);
|
||||
fontset = &fonttbl[fontcnt - 1];
|
||||
} else {
|
||||
fontset = tbl;
|
||||
}
|
||||
}
|
||||
|
||||
SDL_Surface *font_get_glyph(const char *str_utf8) {
|
||||
if (!fontset)
|
||||
return NULL;
|
||||
|
||||
SDL_Surface *fs;
|
||||
SDL_Color color = {255, 255, 255, 0};
|
||||
if (this.antialiase_on) {
|
||||
fs = TTF_RenderUTF8_Shaded(fontset->id, str_utf8, color, color);
|
||||
} else {
|
||||
fs = TTF_RenderUTF8_Solid(fontset->id, str_utf8, color);
|
||||
}
|
||||
if (!fs)
|
||||
WARNING("Text rendering failed: %s\n", TTF_GetError());
|
||||
|
||||
return fs;
|
||||
}
|
||||
|
||||
// SDL can't blit ARGB to an indexed bitmap properly, so we do it ourselves.
|
||||
static void sdl_drawAntiAlias_8bpp(int dstx, int dsty, SDL_Surface *src, unsigned long col)
|
||||
{
|
||||
SDL_LockSurface(sdl_dib);
|
||||
|
||||
Uint8 cache[256*7];
|
||||
memset(cache, 0, 256);
|
||||
|
||||
for (int y = 0; y < src->h && dsty + y < sdl_dib->h; y++) {
|
||||
BYTE *sp = (BYTE*)src->pixels + y * src->pitch;
|
||||
BYTE *dp = (BYTE*)sdl_dib->pixels + (dsty + y) * sdl_dib->pitch + dstx;
|
||||
for (int x = 0; x < src->w && dstx + x < sdl_dib->w; x++) {
|
||||
Uint8 r, g, b, alpha;
|
||||
SDL_GetRGBA(*((Uint32*)sp), src->format, &r, &g, &b, &alpha);
|
||||
alpha = alpha >> 5; // reduce bit depth
|
||||
if (!alpha) {
|
||||
// Transparent, do nothing
|
||||
} else if (alpha == 7) {
|
||||
*dp = col; // Fully opaque
|
||||
} else if (cache[*dp] & 1 << alpha) {
|
||||
*dp = cache[alpha << 8 | *dp]; // use cached value
|
||||
} else {
|
||||
// find nearest color in palette
|
||||
cache[*dp] |= 1 << alpha;
|
||||
int c = sdl_nearest_color(
|
||||
(sdl_col[col].r * alpha + sdl_col[*dp].r * (7 - alpha)) / 7,
|
||||
(sdl_col[col].g * alpha + sdl_col[*dp].g * (7 - alpha)) / 7,
|
||||
(sdl_col[col].b * alpha + sdl_col[*dp].b * (7 - alpha)) / 7);
|
||||
cache[alpha << 8 | *dp] = c;
|
||||
*dp = c;
|
||||
}
|
||||
sp += src->format->BytesPerPixel;
|
||||
dp++;
|
||||
}
|
||||
}
|
||||
|
||||
SDL_UnlockSurface(sdl_dib);
|
||||
}
|
||||
|
||||
int font_draw_glyph(int x, int y, const char *str_utf8, int cl) {
|
||||
SDL_Surface *fs;
|
||||
SDL_Rect r_src, r_dst;
|
||||
int w, h;
|
||||
|
||||
if (!*str_utf8)
|
||||
return 0;
|
||||
if (!fontset)
|
||||
return 0;
|
||||
|
||||
if (this.antialiase_on) {
|
||||
fs = TTF_RenderUTF8_Blended(fontset->id, str_utf8, sdl_col[cl]);
|
||||
} else {
|
||||
fs = TTF_RenderUTF8_Solid(fontset->id, str_utf8, sdl_col[cl]);
|
||||
}
|
||||
if (!fs) {
|
||||
WARNING("Text rendering failed: %s\n", TTF_GetError());
|
||||
return 0;
|
||||
}
|
||||
|
||||
TTF_SizeUTF8(fontset->id, str_utf8, &w, &h);
|
||||
y = max(0, y - (TTF_FontAscent(fontset->id) - fontset->size * 0.9));
|
||||
|
||||
if (sdl_dib->format->BitsPerPixel == 8 && this.antialiase_on) {
|
||||
sdl_drawAntiAlias_8bpp(x, y, fs, cl);
|
||||
} else {
|
||||
setRect(r_src, 0, 0, w, h);
|
||||
setRect(r_dst, x, y, w, h);
|
||||
SDL_BlitSurface(fs, &r_src, sdl_dib, &r_dst);
|
||||
}
|
||||
|
||||
SDL_FreeSurface(fs);
|
||||
return w;
|
||||
}
|
||||
|
||||
void font_init(void) {
|
||||
this.antialiase_on = FALSE;
|
||||
|
||||
if (TTF_Init() == -1)
|
||||
SYSERROR("Failed to intialize SDL_ttf: %s\n", TTF_GetError());
|
||||
}
|
||||
|
||||
void font_set_name_and_index(int type, const char *name, int index) {
|
||||
this.name[type] = name;
|
||||
this.face[type] = index;
|
||||
}
|
||||
|
||||
void font_set_antialias(boolean enable) {
|
||||
this.antialiase_on = enable;
|
||||
}
|
||||
|
||||
boolean font_get_antialias(void) {
|
||||
return this.antialiase_on;
|
||||
}
|
||||
|
||||
#ifdef __EMSCRIPTEN__
|
||||
EM_JS(int, load_mincho_font, (void), {
|
||||
return Asyncify.handleSleep(function(wakeUp) {
|
||||
|
||||
+9
-37
@@ -24,51 +24,23 @@
|
||||
#ifndef __FONT_H__
|
||||
#define __FONT_H__
|
||||
|
||||
#include <SDL_surface.h>
|
||||
#include "config.h"
|
||||
#include "portab.h"
|
||||
|
||||
/* font の種類 */
|
||||
#define FONTTYPEMAX 2
|
||||
|
||||
struct agsurface;
|
||||
|
||||
struct _FONT {
|
||||
|
||||
boolean antialiase_on;
|
||||
|
||||
char *name[FONTTYPEMAX];
|
||||
char face[FONTTYPEMAX];
|
||||
|
||||
void (*sel_font)(int type, int size);
|
||||
|
||||
struct agsurface *(*get_glyph)(const char *str_utf8);
|
||||
|
||||
int (*draw_glyph)(int x, int y, const char *str_utf8, int col);
|
||||
|
||||
boolean (*self_drawable)();
|
||||
};
|
||||
|
||||
typedef struct _FONT FONT;
|
||||
|
||||
extern void font_init(int dev);
|
||||
|
||||
#ifdef ENABLE_FT2
|
||||
extern FONT *font_ft2_new();
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_SDLTTF
|
||||
extern FONT *font_sdlttf_new();
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_X11FONT
|
||||
extern FONT *font_x11_new();
|
||||
#endif
|
||||
|
||||
/* デフォルトのフォント名 */
|
||||
#define FONT_DEFAULTNAME_X "-*-*-medium-r-normal--%d-*-*-*-c-*-jisx0208.1983-0,-*-*-medium-r-normal--%d-*-*-*-c-*-jisx0201.1976-0,*"
|
||||
extern void font_init(void);
|
||||
extern void font_set_name_and_index(int type, const char *name, int index);
|
||||
extern void font_set_antialias(boolean enable);
|
||||
extern boolean font_get_antialias(void);
|
||||
extern void font_select(int type, int size);
|
||||
extern struct SDL_Surface *font_get_glyph(const char *str_utf8);
|
||||
extern int font_draw_glyph(int x, int y, const char *str_utf8, int col);
|
||||
|
||||
#ifdef __EMSCRIPTEN__
|
||||
int load_mincho_font(void);
|
||||
extern int load_mincho_font(void);
|
||||
#endif
|
||||
|
||||
#endif /* __FONT_H__ */
|
||||
|
||||
@@ -1,287 +0,0 @@
|
||||
/*
|
||||
* font_freetype2.c access to ttf font device
|
||||
*
|
||||
* 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: font_freetype2.c,v 1.12 2004/10/31 04:18:06 chikama Exp $ */
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <ft2build.h>
|
||||
#include FT_FREETYPE_H
|
||||
//#include <freetype/freetype.h>
|
||||
|
||||
#include "portab.h"
|
||||
#include "system.h"
|
||||
#include "font.h"
|
||||
#include "ags.h"
|
||||
#include "utfsjis.h"
|
||||
|
||||
extern const unsigned short *s2u[];
|
||||
|
||||
typedef struct {
|
||||
int size;
|
||||
int type;
|
||||
FT_Face face;
|
||||
} FontTable;
|
||||
|
||||
#define FONTTABLEMAX 256
|
||||
static FontTable fonttbl[FONTTABLEMAX];
|
||||
static int fontcnt = 0;
|
||||
static FT_Library eng;
|
||||
static FontTable *fontset;
|
||||
|
||||
#define GLYPH_PIXMAP_WIDTH 800 /* 文字イメージを取得する為のPixmapの大きさ */
|
||||
#define GLYPH_PIXMAP_HEIGHT 150
|
||||
|
||||
static agsurface_t img_glyph;
|
||||
|
||||
static FONT *this;
|
||||
|
||||
static void pixmap2comimg(BYTE *src, int x, int y, int w, int h, int src_bpl);
|
||||
static void pixmapmono2comimg(BYTE *src, int x, int y, int w, int h, int src_bpl);
|
||||
|
||||
static boolean select_charmap(FT_Face f, int type) {
|
||||
int i;
|
||||
|
||||
for (i = 0; i < f->num_charmaps; i++) {
|
||||
FT_CharMap map = f->charmaps[i];
|
||||
if (map->encoding == ft_encoding_unicode) {
|
||||
FT_Select_Charmap(f, ft_encoding_unicode);
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void font_insert(int size, int type, FT_Face face) {
|
||||
fonttbl[fontcnt].size = size;
|
||||
fonttbl[fontcnt].type = type;
|
||||
fonttbl[fontcnt].face = face;
|
||||
|
||||
if (fontcnt >= (FONTTABLEMAX -1)) {
|
||||
WARNING("Font table is full.\n");
|
||||
} else {
|
||||
fontcnt++;
|
||||
}
|
||||
}
|
||||
|
||||
static FontTable *font_lookup(int size, int type) {
|
||||
int i;
|
||||
|
||||
for (i = 0; i < fontcnt; i++) {
|
||||
if (fonttbl[i].size == size && fonttbl[i].type == type) {
|
||||
return &fonttbl[i];
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void font_ttf_sel_font(int type, int size) {
|
||||
FontTable *tbl;
|
||||
|
||||
// check too big size
|
||||
if (size > (GLYPH_PIXMAP_HEIGHT - 10)) {
|
||||
size = GLYPH_PIXMAP_HEIGHT - 10;
|
||||
}
|
||||
|
||||
if (NULL == (tbl = font_lookup(size, type))) {
|
||||
char *name;
|
||||
FT_Error err;
|
||||
FT_Face face;
|
||||
|
||||
if (type > FONTTYPEMAX) type = FONT_GOTHIC;
|
||||
|
||||
name = this->name[type];
|
||||
|
||||
err = FT_New_Face(eng, name, this->face[type], &face);
|
||||
if (err) {
|
||||
WARNING("face %d is not found. retry 0", this->face[type]);
|
||||
err = FT_New_Face(eng, name, 0, &face);
|
||||
}
|
||||
NOTICE("TTF open %s size %d\n", name, size);
|
||||
if (err) {
|
||||
WARNING("%s is not found\n", name);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!select_charmap(face, type))
|
||||
SYSERROR("TTfont %s has no unicode charmap\n", name);
|
||||
|
||||
err = FT_Set_Pixel_Sizes(face, 0, size);
|
||||
if (err) {
|
||||
WARNING("Font %s contains only fixed size(%d) font.\n",name, face->size);
|
||||
return;
|
||||
}
|
||||
|
||||
font_insert(size, type, face);
|
||||
fontset = &fonttbl[fontcnt -1];
|
||||
} else {
|
||||
fontset = tbl;
|
||||
}
|
||||
}
|
||||
|
||||
static void pixmap2comimg(BYTE *src, int x, int y, int w, int h, int src_bpl) {
|
||||
int yy;
|
||||
BYTE *dst = GETOFFSET_PIXEL(&img_glyph, x, y);
|
||||
if (w <= 0) return;
|
||||
|
||||
for (yy = 0; yy < h; yy++) {
|
||||
memcpy(dst, src, w);
|
||||
src += src_bpl;
|
||||
dst += img_glyph.bytes_per_line;
|
||||
}
|
||||
}
|
||||
|
||||
static void pixmapmono2comimg(BYTE *src, int x, int y, int w, int h, int src_bpl) {
|
||||
int i, xx, yy;
|
||||
int w1,w2;
|
||||
BYTE *dst = GETOFFSET_PIXEL(&img_glyph, x, y);
|
||||
if (w <= 0) return;
|
||||
|
||||
w1 = w / 8;
|
||||
w2 = w % 8;
|
||||
for (yy = 0; yy < h; yy++) {
|
||||
for (xx = 0; xx < w1; xx++){
|
||||
BYTE ch = src[xx];
|
||||
for (i = 0; i < 8; i++){
|
||||
*(dst + i + xx * 8) = (ch & 0x80 ? 255 : 0);
|
||||
ch <<= 1;
|
||||
}
|
||||
}
|
||||
if (w2) {
|
||||
BYTE ch = src[w1];
|
||||
for (i = 0; i < w2; i++){
|
||||
*(dst + i + w1 * 8) = (ch & 0x80 ? 255 : 0);
|
||||
ch <<= 1;
|
||||
}
|
||||
}
|
||||
src += src_bpl;
|
||||
dst += img_glyph.bytes_per_line;
|
||||
}
|
||||
}
|
||||
|
||||
static void clear_canvas(void) {
|
||||
memset(img_glyph.pixel, 0, GLYPH_PIXMAP_WIDTH * GLYPH_PIXMAP_HEIGHT);
|
||||
}
|
||||
|
||||
static agsurface_t *font_ttf_get_glyph(const char *str_utf8) {
|
||||
FT_GlyphSlot slot;
|
||||
FT_UShort code;
|
||||
FT_Error err;
|
||||
FT_Pixel_Mode pixelmode;
|
||||
FT_Int loadflag;
|
||||
int x = 0;
|
||||
|
||||
if (fontset == NULL) return &img_glyph;
|
||||
|
||||
clear_canvas();
|
||||
|
||||
while (*str_utf8) {
|
||||
code = utf8_next_codepoint(&str_utf8);
|
||||
|
||||
if (this->antialiase_on) {
|
||||
loadflag = FT_LOAD_RENDER;
|
||||
// if( 埋め込みビットマップを使いたくない時)
|
||||
// loadglag |= FT_LOAD_NO_BITMAP;
|
||||
} else {
|
||||
loadflag = (FT_LOAD_RENDER | FT_LOAD_MONOCHROME);
|
||||
}
|
||||
|
||||
err = FT_Load_Char(fontset->face, code, loadflag);
|
||||
/* gray scaleでもモノクロでもない埋め込みビットマップは使わず、
|
||||
アウトラインフォントを使用 */
|
||||
pixelmode = fontset->face->glyph->bitmap.pixel_mode ;
|
||||
if (!err &&
|
||||
pixelmode != ft_pixel_mode_mono &&
|
||||
pixelmode != ft_pixel_mode_grays){
|
||||
WARNING("Not supported type embeded bitmap font!!!");
|
||||
err = FT_Load_Char(fontset->face, code, loadflag | FT_LOAD_NO_BITMAP);
|
||||
pixelmode = fontset->face->glyph->bitmap.pixel_mode;
|
||||
}
|
||||
|
||||
if (err) continue;
|
||||
|
||||
slot = fontset->face->glyph;
|
||||
|
||||
// lazy check, but needed
|
||||
if (x + fontset->size > GLYPH_PIXMAP_WIDTH) {
|
||||
break;
|
||||
}
|
||||
|
||||
if (pixelmode == ft_pixel_mode_grays) {
|
||||
pixmap2comimg(slot->bitmap.buffer,
|
||||
x + slot->bitmap_left,
|
||||
max(0, fontset->size * 0.9 - slot->metrics.horiBearingY/64),
|
||||
slot->bitmap.width,
|
||||
slot->bitmap.rows,
|
||||
slot->bitmap.pitch);
|
||||
} else if (pixelmode == ft_pixel_mode_mono) {
|
||||
pixmapmono2comimg(slot->bitmap.buffer,
|
||||
x + slot->bitmap_left,
|
||||
max(0, fontset->size * 0.9 - slot->metrics.horiBearingY/64),
|
||||
slot->bitmap.width,
|
||||
slot->bitmap.rows,
|
||||
slot->bitmap.pitch);
|
||||
}
|
||||
x += slot->metrics.horiAdvance/64;
|
||||
}
|
||||
|
||||
img_glyph.width = x;
|
||||
img_glyph.height = fontset->size;
|
||||
|
||||
return &img_glyph;
|
||||
}
|
||||
|
||||
static int font_ttf_draw_glyph(int x, int y, const char *str_utf8, int col) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
static boolean drawable() {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
FONT *font_ft2_new() {
|
||||
int err;
|
||||
FONT *f = malloc(sizeof(FONT));
|
||||
|
||||
f->sel_font = font_ttf_sel_font;
|
||||
f->get_glyph = font_ttf_get_glyph;
|
||||
f->draw_glyph = font_ttf_draw_glyph;
|
||||
f->self_drawable = drawable;
|
||||
f->antialiase_on = FALSE;
|
||||
|
||||
err = FT_Init_FreeType(&eng);
|
||||
|
||||
img_glyph.width = GLYPH_PIXMAP_WIDTH;
|
||||
img_glyph.height = GLYPH_PIXMAP_HEIGHT;
|
||||
img_glyph.bytes_per_line = GLYPH_PIXMAP_WIDTH;
|
||||
img_glyph.depth = 8;
|
||||
img_glyph.bytes_per_pixel = 1;
|
||||
img_glyph.pixel = malloc(GLYPH_PIXMAP_WIDTH * GLYPH_PIXMAP_HEIGHT);
|
||||
|
||||
this = f;
|
||||
|
||||
NOTICE("FontDevice freetype2\n");
|
||||
|
||||
return f;
|
||||
}
|
||||
@@ -1,197 +0,0 @@
|
||||
#include "config.h"
|
||||
|
||||
#include <limits.h>
|
||||
#include <math.h>
|
||||
#include <SDL.h>
|
||||
#include <SDL_ttf.h>
|
||||
|
||||
#include "portab.h"
|
||||
#include "system.h"
|
||||
#include "font.h"
|
||||
#include "sdl_private.h"
|
||||
|
||||
typedef struct {
|
||||
int size;
|
||||
int type;
|
||||
TTF_Font *id;
|
||||
} FontTable;
|
||||
|
||||
#define FONTTABLEMAX 256
|
||||
static FontTable fonttbl[FONTTABLEMAX];
|
||||
static int fontcnt = 0;
|
||||
|
||||
static FontTable *fontset;
|
||||
|
||||
static FONT *this;
|
||||
|
||||
static void font_insert(int size, int type, TTF_Font *font) {
|
||||
fonttbl[fontcnt].size = size;
|
||||
fonttbl[fontcnt].type = type;
|
||||
fonttbl[fontcnt].id = font;
|
||||
|
||||
if (fontcnt >= (FONTTABLEMAX -1)) {
|
||||
WARNING("Font table is full.\n");
|
||||
} else {
|
||||
fontcnt++;
|
||||
}
|
||||
}
|
||||
|
||||
static FontTable *font_lookup(int size, int type) {
|
||||
int i;
|
||||
|
||||
for (i = 0; i < fontcnt; i++) {
|
||||
if (fonttbl[i].size == size && fonttbl[i].type == type) {
|
||||
return &fonttbl[i];
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void font_sdlttf_sel_font(int type, int size) {
|
||||
FontTable *tbl;
|
||||
|
||||
|
||||
if (NULL == (tbl = font_lookup(size, type))) {
|
||||
TTF_Font *fs;
|
||||
|
||||
fs = TTF_OpenFontIndex(this->name[type], size, this->face[type]);
|
||||
|
||||
if (fs == NULL) {
|
||||
WARNING("%s is not found:\n", this->name[type]);
|
||||
return;
|
||||
}
|
||||
|
||||
font_insert(size, type, fs);
|
||||
fontset = &fonttbl[fontcnt - 1];
|
||||
} else {
|
||||
fontset = tbl;
|
||||
}
|
||||
}
|
||||
|
||||
static agsurface_t *font_sdlttf_get_glyph(const char *str_utf8) {
|
||||
static SDL_Surface *fs;
|
||||
static agsurface_t result;
|
||||
|
||||
if (!fontset)
|
||||
return NULL;
|
||||
if (fs) {
|
||||
SDL_FreeSurface(fs);
|
||||
fs = NULL;
|
||||
}
|
||||
|
||||
SDL_Color color = {255, 255, 255, 0};
|
||||
if (this->antialiase_on) {
|
||||
fs = TTF_RenderUTF8_Shaded(fontset->id, str_utf8, color, color);
|
||||
} else {
|
||||
fs = TTF_RenderUTF8_Solid(fontset->id, str_utf8, color);
|
||||
}
|
||||
if (!fs) {
|
||||
WARNING("Text rendering failed: %s\n", TTF_GetError());
|
||||
return NULL;
|
||||
}
|
||||
|
||||
result.depth = fs->format->BitsPerPixel;
|
||||
result.bytes_per_pixel = fs->format->BytesPerPixel;
|
||||
result.bytes_per_line = fs->pitch;
|
||||
result.pixel = fs->pixels;
|
||||
result.width = fs->w;
|
||||
result.height = fs->h;
|
||||
return &result;
|
||||
}
|
||||
|
||||
// SDL can't blit ARGB to an indexed bitmap properly, so we do it ourselves.
|
||||
static void sdl_drawAntiAlias_8bpp(int dstx, int dsty, SDL_Surface *src, unsigned long col)
|
||||
{
|
||||
SDL_LockSurface(sdl_dib);
|
||||
|
||||
Uint8 cache[256*7];
|
||||
memset(cache, 0, 256);
|
||||
|
||||
for (int y = 0; y < src->h && dsty + y < sdl_dib->h; y++) {
|
||||
BYTE *sp = (BYTE*)src->pixels + y * src->pitch;
|
||||
BYTE *dp = (BYTE*)sdl_dib->pixels + (dsty + y) * sdl_dib->pitch + dstx;
|
||||
for (int x = 0; x < src->w && dstx + x < sdl_dib->w; x++) {
|
||||
Uint8 r, g, b, alpha;
|
||||
SDL_GetRGBA(*((Uint32*)sp), src->format, &r, &g, &b, &alpha);
|
||||
alpha = alpha >> 5; // reduce bit depth
|
||||
if (!alpha) {
|
||||
// Transparent, do nothing
|
||||
} else if (alpha == 7) {
|
||||
*dp = col; // Fully opaque
|
||||
} else if (cache[*dp] & 1 << alpha) {
|
||||
*dp = cache[alpha << 8 | *dp]; // use cached value
|
||||
} else {
|
||||
// find nearest color in palette
|
||||
cache[*dp] |= 1 << alpha;
|
||||
int c = sdl_nearest_color(
|
||||
(sdl_col[col].r * alpha + sdl_col[*dp].r * (7 - alpha)) / 7,
|
||||
(sdl_col[col].g * alpha + sdl_col[*dp].g * (7 - alpha)) / 7,
|
||||
(sdl_col[col].b * alpha + sdl_col[*dp].b * (7 - alpha)) / 7);
|
||||
cache[alpha << 8 | *dp] = c;
|
||||
*dp = c;
|
||||
}
|
||||
sp += src->format->BytesPerPixel;
|
||||
dp++;
|
||||
}
|
||||
}
|
||||
|
||||
SDL_UnlockSurface(sdl_dib);
|
||||
}
|
||||
|
||||
static int font_sdlttf_draw_glyph(int x, int y, const char *str_utf8, int cl) {
|
||||
SDL_Surface *fs;
|
||||
SDL_Rect r_src, r_dst;
|
||||
int w, h, maxy;
|
||||
|
||||
if (!*str_utf8)
|
||||
return 0;
|
||||
if (!fontset)
|
||||
return 0;
|
||||
|
||||
if (this->antialiase_on) {
|
||||
fs = TTF_RenderUTF8_Blended(fontset->id, str_utf8, sdl_col[cl]);
|
||||
} else {
|
||||
fs = TTF_RenderUTF8_Solid(fontset->id, str_utf8, sdl_col[cl]);
|
||||
}
|
||||
if (!fs) {
|
||||
WARNING("Text rendering failed: %s\n", TTF_GetError());
|
||||
return 0;
|
||||
}
|
||||
|
||||
TTF_SizeUTF8(fontset->id, str_utf8, &w, &h);
|
||||
y = max(0, y - (TTF_FontAscent(fontset->id) - fontset->size * 0.9));
|
||||
|
||||
if (sdl_dib->format->BitsPerPixel == 8 && this->antialiase_on) {
|
||||
sdl_drawAntiAlias_8bpp(x, y, fs, cl);
|
||||
} else {
|
||||
setRect(r_src, 0, 0, w, h);
|
||||
setRect(r_dst, x, y, w, h);
|
||||
SDL_BlitSurface(fs, &r_src, sdl_dib, &r_dst);
|
||||
}
|
||||
|
||||
SDL_FreeSurface(fs);
|
||||
return w;
|
||||
}
|
||||
|
||||
static boolean drawable() {
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
FONT *font_sdlttf_new() {
|
||||
FONT *f = malloc(sizeof(FONT));
|
||||
|
||||
f->sel_font = font_sdlttf_sel_font;
|
||||
f->get_glyph = font_sdlttf_get_glyph;
|
||||
f->draw_glyph = font_sdlttf_draw_glyph;
|
||||
f->self_drawable = drawable;
|
||||
f->antialiase_on = FALSE;
|
||||
|
||||
if (TTF_Init() == -1)
|
||||
SYSERROR("Failed to intialize SDL_ttf: %s\n", TTF_GetError());
|
||||
|
||||
this = f;
|
||||
|
||||
NOTICE("FontDevice SDL_ttf\n");
|
||||
|
||||
return f;
|
||||
}
|
||||
-228
@@ -1,228 +0,0 @@
|
||||
/*
|
||||
* font_x11.c access to x11 font device
|
||||
*
|
||||
* 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: font_x11.c,v 1.11 2003/01/31 12:58:28 chikama Exp $ */
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/Xutil.h>
|
||||
|
||||
#include "portab.h"
|
||||
#include "system.h"
|
||||
#include "font.h"
|
||||
#include "ags.h"
|
||||
#include "xcore.h"
|
||||
#include "xcore_private.h"
|
||||
#include "antialiase.h"
|
||||
|
||||
/* fontset の為の情報 */
|
||||
typedef struct {
|
||||
int size;
|
||||
int type;
|
||||
XFontSet id;
|
||||
} FontTable;
|
||||
|
||||
#define FONTTABLEMAX 256
|
||||
static FontTable fonttbl[FONTTABLEMAX];
|
||||
static int fontcnt = 0;
|
||||
static XFontSet fontset;
|
||||
static int font_ascent, font_descent;
|
||||
|
||||
/* Font Glyph を取得するためのPixmapとGC */
|
||||
static Pixmap pix_glyph;
|
||||
static GC gc_pix_glyph;
|
||||
static agsurface_t img_glyph;
|
||||
|
||||
static FONT *this;
|
||||
|
||||
#define GLYPH_PIXMAP_WIDTH 800 /* 文字イメージを取得する為のPixmapの大きさ */
|
||||
#define GLYPH_PIXMAP_HEIGHT 150
|
||||
|
||||
static void font_insert(int size, int type, XFontSet fontset) {
|
||||
fonttbl[fontcnt].size = size;
|
||||
fonttbl[fontcnt].type = type;
|
||||
fonttbl[fontcnt].id = fontset;
|
||||
|
||||
if (fontcnt >= (FONTTABLEMAX -1)) {
|
||||
WARNING("Font table is full.\n");
|
||||
} else {
|
||||
fontcnt++;
|
||||
}
|
||||
}
|
||||
|
||||
static FontTable *font_lookup(int size, int type) {
|
||||
int i;
|
||||
|
||||
for (i = 0; i < fontcnt; i++) {
|
||||
if (fonttbl[i].size == size && fonttbl[i].type == type) {
|
||||
return &fonttbl[i];
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void font_x11_sel_font(int type, int size) {
|
||||
XFontStruct **font_structs;
|
||||
char **font_names;
|
||||
int i, num_fonts;
|
||||
FontTable *tbl;
|
||||
|
||||
if (NULL == (tbl = font_lookup(size, type))) {
|
||||
char name[256];
|
||||
char **miss, *def;
|
||||
int n_miss;
|
||||
XFontSet fs;
|
||||
|
||||
if (type > 3) type = FONT_GOTHIC;
|
||||
|
||||
/* set size */
|
||||
snprintf(name, sizeof(name), this->name[type], size, size);
|
||||
|
||||
fs = XCreateFontSet(x11_display, name, &miss, &n_miss, &def);
|
||||
if (n_miss > 0) {
|
||||
for (i = 0; i < n_miss; i++) {
|
||||
WARNING("can't load font %s\n", miss[i]);
|
||||
}
|
||||
XFreeStringList(miss);
|
||||
SYSERROR("Font Load failed\n");
|
||||
}
|
||||
font_insert(size, type, fs);
|
||||
fontset = fs;
|
||||
} else {
|
||||
fontset = tbl->id;
|
||||
}
|
||||
|
||||
/* 最大のフォントの高さの取得 */
|
||||
num_fonts = XFontsOfFontSet(fontset, &font_structs, &font_names);
|
||||
font_ascent = font_descent = 0;
|
||||
for (i = 0; i < num_fonts; i++) {
|
||||
font_ascent = max(font_ascent, font_structs[i]->ascent);
|
||||
font_descent = max(font_descent, font_structs[i]->descent);
|
||||
}
|
||||
}
|
||||
|
||||
static agsurface_t *get_drawn_glyph(const char *str, int w) {
|
||||
XImage *src;
|
||||
agsurface_t *dst;
|
||||
|
||||
XSetForeground(x11_display, gc_pix_glyph, 0);
|
||||
XFillRectangle(x11_display, pix_glyph, gc_pix_glyph, 0, 0, GLYPH_PIXMAP_WIDTH, GLYPH_PIXMAP_HEIGHT);
|
||||
|
||||
XSetForeground(x11_display, gc_pix_glyph, 1);
|
||||
XmbDrawString(x11_display, pix_glyph, fontset, gc_pix_glyph, 0, font_ascent, str, strlen(str));
|
||||
|
||||
src = XGetImage(x11_display, pix_glyph, 0, 0, w, font_ascent + font_descent, AllPlanes, ZPixmap);
|
||||
|
||||
dst = malloc(sizeof(agsurface_t));
|
||||
|
||||
dst->width = w;
|
||||
dst->height = font_ascent + font_descent;
|
||||
dst->bytes_per_line = src->bytes_per_line;
|
||||
dst->pixel = (BYTE *)src->data;
|
||||
dst->bytes_per_pixel = x11_workinfo->cimg.bytes_per_pixel;
|
||||
|
||||
src->data = NULL;
|
||||
XDestroyImage(src);
|
||||
|
||||
return dst;
|
||||
}
|
||||
|
||||
static agsurface_t *font_x11_get_glyph(const char *str_utf8) {
|
||||
int w = XmbTextEscapement(fontset, str_utf8, strlen(str_utf8));
|
||||
|
||||
if (w == 0)
|
||||
return NULL;
|
||||
|
||||
agsurface_t *dst = get_drawn_glyph(str_utf8, w);
|
||||
image_get_glyph(dst, &img_glyph);
|
||||
|
||||
if (this->antialiase_on) {
|
||||
aa_make(img_glyph.pixel, w, dst->height, img_glyph.bytes_per_line);
|
||||
}
|
||||
|
||||
img_glyph.width = dst->width;
|
||||
img_glyph.height = dst->height;
|
||||
|
||||
free(dst->pixel);
|
||||
free(dst);
|
||||
return &img_glyph;
|
||||
}
|
||||
|
||||
static int font_x11_draw_glyph(int x, int y, const char *str_utf8, int col) {
|
||||
int w = XmbTextEscapement(fontset, str_utf8, strlen(str_utf8));
|
||||
if (w == 0)
|
||||
return 0;
|
||||
|
||||
if (!x11_dibinfo->shared) {
|
||||
/* 一度 Pixmap に書いてからイメージを取得してDIBへ */
|
||||
agsurface_t *dst = get_drawn_glyph(str_utf8, w);
|
||||
|
||||
if (DIB_DEPTH == dib_depth_candidate) {
|
||||
image_getGlyphImage(DIB, dst, x, y, PAL2PIC(col));
|
||||
} else {
|
||||
image_getGlyphImageNto8(DIB, dst, x, y, col);
|
||||
}
|
||||
free(dst);
|
||||
} else {
|
||||
Xcore_setForeground(col);
|
||||
XmbDrawString(x11_display, x11_pixmap, fontset, x11_gc_pix, x, y + font_ascent, str_utf8, strlen(str_utf8));
|
||||
x11_needSync = TRUE;
|
||||
}
|
||||
return w;
|
||||
}
|
||||
|
||||
static boolean drawable() {
|
||||
return !this->antialiase_on;
|
||||
}
|
||||
|
||||
|
||||
FONT *font_x11_new() {
|
||||
FONT *f = malloc(sizeof(FONT));
|
||||
|
||||
f->sel_font = font_x11_sel_font;
|
||||
f->get_glyph = font_x11_get_glyph;
|
||||
f->draw_glyph = font_x11_draw_glyph;
|
||||
f->self_drawable = drawable;
|
||||
f->antialiase_on = FALSE;
|
||||
|
||||
/* Glyph取得のためのPixmapとGCとagsurface_tを用意 */
|
||||
pix_glyph = XCreatePixmap(x11_display, x11_window,
|
||||
GLYPH_PIXMAP_WIDTH, GLYPH_PIXMAP_HEIGHT, WIN_DEPTH);
|
||||
gc_pix_glyph = XCreateGC(x11_display, pix_glyph, 0, 0);
|
||||
|
||||
img_glyph.width = GLYPH_PIXMAP_WIDTH;
|
||||
img_glyph.height = GLYPH_PIXMAP_HEIGHT;
|
||||
img_glyph.bytes_per_line = GLYPH_PIXMAP_WIDTH;
|
||||
img_glyph.depth = 8;
|
||||
img_glyph.bytes_per_pixel = 1;
|
||||
img_glyph.pixel = malloc(GLYPH_PIXMAP_WIDTH * GLYPH_PIXMAP_HEIGHT);
|
||||
|
||||
this = f;
|
||||
|
||||
NOTICE("FontDevice X11\n");
|
||||
|
||||
return f;
|
||||
}
|
||||
+2
-2
@@ -30,12 +30,12 @@ typedef struct {
|
||||
BYTE red[256];
|
||||
BYTE green[256];
|
||||
BYTE blue[256];
|
||||
} Pallet256;
|
||||
} Palette256;
|
||||
|
||||
typedef struct {
|
||||
BYTE r,g,b;
|
||||
DWORD pixel;
|
||||
} Pallet;
|
||||
} Palette;
|
||||
|
||||
typedef struct {
|
||||
int x;
|
||||
|
||||
@@ -1,35 +0,0 @@
|
||||
/*
|
||||
* graphicdevice.h 実際の graphicデバイスのinclude
|
||||
*
|
||||
* 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: graphicsdevice.h,v 1.6 2006/04/21 16:40:48 chikama Exp $ */
|
||||
|
||||
#ifndef __GRAPHICDEVICE__
|
||||
#define __GRAPHICDEVICE__
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#if ENABLE_SDL
|
||||
#include "sdl_core.h"
|
||||
#else
|
||||
#include "xcore.h"
|
||||
#endif
|
||||
|
||||
#endif /* !__GRAPHICDEVICE__ */
|
||||
+22
-30
@@ -107,37 +107,29 @@ static const BYTE hankakutable[3][192] = {{
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
}};
|
||||
|
||||
static const BYTE kanatbl[][2] = {
|
||||
0x81, 0x40, 0x81, 0x42, 0x81, 0x75, 0x81, 0x76,
|
||||
0x81, 0x41, 0x81, 0x45, 0x82, 0xf0, 0x82, 0x9f,
|
||||
0x82, 0xa1, 0x82, 0xa3, 0x82, 0xa5, 0x82, 0xa7,
|
||||
0x82, 0xe1, 0x82, 0xe3, 0x82, 0xe5, 0x82, 0xc1,
|
||||
0x81, 0x5b, 0x82, 0xa0, 0x82, 0xa2, 0x82, 0xa4,
|
||||
0x82, 0xa6, 0x82, 0xa8, 0x82, 0xa9, 0x82, 0xab,
|
||||
0x82, 0xad, 0x82, 0xaf, 0x82, 0xb1, 0x82, 0xb3,
|
||||
0x82, 0xb5, 0x82, 0xb7, 0x82, 0xb9, 0x82, 0xbb,
|
||||
0x82, 0xbd, 0x82, 0xbf, 0x82, 0xc2, 0x82, 0xc4,
|
||||
0x82, 0xc6, 0x82, 0xc8, 0x82, 0xc9, 0x82, 0xca,
|
||||
0x82, 0xcb, 0x82, 0xcc, 0x82, 0xcd, 0x82, 0xd0,
|
||||
0x82, 0xd3, 0x82, 0xd6, 0x82, 0xd9, 0x82, 0xdc,
|
||||
0x82, 0xdd, 0x82, 0xde, 0x82, 0xdf, 0x82, 0xe0,
|
||||
0x82, 0xe2, 0x82, 0xe4, 0x82, 0xe6, 0x82, 0xe7,
|
||||
0x82, 0xe8, 0x82, 0xe9, 0x82, 0xea, 0x82, 0xeb,
|
||||
0x82, 0xed, 0x82, 0xf1, 0x81, 0x4a, 0x81, 0x4b
|
||||
static const WORD kanatbl[] = {
|
||||
0x8140, 0x8142, 0x8175, 0x8176, 0x8141, 0x8145, 0x82f0, 0x829f,
|
||||
0x82a1, 0x82a3, 0x82a5, 0x82a7, 0x82e1, 0x82e3, 0x82e5, 0x82c1,
|
||||
0x815b, 0x82a0, 0x82a2, 0x82a4, 0x82a6, 0x82a8, 0x82a9, 0x82ab,
|
||||
0x82ad, 0x82af, 0x82b1, 0x82b3, 0x82b5, 0x82b7, 0x82b9, 0x82bb,
|
||||
0x82bd, 0x82bf, 0x82c2, 0x82c4, 0x82c6, 0x82c8, 0x82c9, 0x82ca,
|
||||
0x82cb, 0x82cc, 0x82cd, 0x82d0, 0x82d3, 0x82d6, 0x82d9, 0x82dc,
|
||||
0x82dd, 0x82de, 0x82df, 0x82e0, 0x82e2, 0x82e4, 0x82e6, 0x82e7,
|
||||
0x82e8, 0x82e9, 0x82ea, 0x82eb, 0x82ed, 0x82f1, 0x814a, 0x814b
|
||||
};
|
||||
|
||||
static const char zenkaku_digits[][3] = {
|
||||
0x82,0x4f,0x00, /* 0 */
|
||||
0x82,0x50,0x00, /* 1 */
|
||||
0x82,0x51,0x00, /* 2 */
|
||||
0x82,0x52,0x00, /* 3 */
|
||||
0x82,0x53,0x00, /* 4 */
|
||||
0x82,0x54,0x00, /* 5 */
|
||||
0x82,0x55,0x00, /* 6 */
|
||||
0x82,0x56,0x00, /* 7 */
|
||||
0x82,0x57,0x00, /* 8 */
|
||||
0x82,0x58,0x00, /* 9 */
|
||||
0x81,0x40,0x00, /* space */
|
||||
{0x82, 0x4f, 0x00}, /* 0 */
|
||||
{0x82, 0x50, 0x00}, /* 1 */
|
||||
{0x82, 0x51, 0x00}, /* 2 */
|
||||
{0x82, 0x52, 0x00}, /* 3 */
|
||||
{0x82, 0x53, 0x00}, /* 4 */
|
||||
{0x82, 0x54, 0x00}, /* 5 */
|
||||
{0x82, 0x55, 0x00}, /* 6 */
|
||||
{0x82, 0x56, 0x00}, /* 7 */
|
||||
{0x82, 0x57, 0x00}, /* 8 */
|
||||
{0x82, 0x58, 0x00}, /* 9 */
|
||||
{0x81, 0x40, 0x00}, /* space */
|
||||
};
|
||||
|
||||
static BYTE *zen2han_sjis(const BYTE *src) {
|
||||
@@ -385,8 +377,8 @@ BYTE *han2zen(const BYTE *src, CharacterEncoding enc) {
|
||||
} else if (c0 >= 0xe0) {
|
||||
*dst++ = (char)c0; *dst++ = *src++;
|
||||
} else if (c0 >= 0xa0) {
|
||||
const BYTE *kindex = kanatbl[c0 - 0xa0];
|
||||
*dst++ = *kindex; *dst++ = *(kindex+1);
|
||||
const WORD kana = kanatbl[c0 - 0xa0];
|
||||
*dst++ = kana >> 8; *dst++ = kana & 0xff;
|
||||
} else {
|
||||
*dst++ = (char)c0; *dst++ = *src++;
|
||||
}
|
||||
|
||||
@@ -25,6 +25,11 @@ typedef struct {
|
||||
const char *han;
|
||||
} Zen2hanTestCase;
|
||||
|
||||
typedef struct {
|
||||
const char *han;
|
||||
const char *zen;
|
||||
} Han2ZenTestCase;
|
||||
|
||||
static void zen2han_test(void) {
|
||||
const Zen2hanTestCase testcases[] = {
|
||||
{"", ""},
|
||||
@@ -59,6 +64,21 @@ static void zen2han_test(void) {
|
||||
ASSERT_STRCMP(zen2han(unconvertable, UTF8), unconvertable);
|
||||
}
|
||||
|
||||
static void han2zen_test(void) {
|
||||
const Han2ZenTestCase testcases[] = {
|
||||
{"", ""},
|
||||
{" ", " "},
|
||||
{"ァアィイゥウェエォオカキクケコサシスセソタチッツテトナニヌネノハヒフヘホマミムメモャヤュユョヨラリルレロワヲン", "ぁあぃいぅうぇえぉおかきくけこさしすせそたちっつてとなにぬねのはひふへほまみむめもゃやゅゆょよらりるれろわをん"},
|
||||
{"、。「」・゙゚", "、。「」・゛゜"},
|
||||
{"0123456789", "0123456789"},
|
||||
{"ABCDEFGHIJKLMNOPQRSTUVWXYZ", "ABCDEFGHIJKLMNOPQRSTUVWXYZ"},
|
||||
{"abcdefghijklmnopqrstuvwxyz", "abcdefghijklmnopqrstuvwxyz"},
|
||||
{NULL, NULL},
|
||||
};
|
||||
for (const Han2ZenTestCase *tc = testcases; tc->han; tc++)
|
||||
ASSERT_STRCMP(sjis2utf(han2zen(utf2sjis(tc->han), SHIFT_JIS)), tc->zen);
|
||||
}
|
||||
|
||||
static void format_number_test(void) {
|
||||
char buf[256];
|
||||
ASSERT_STRCMP(format_number(0, 0, buf), "0");
|
||||
@@ -79,6 +99,7 @@ static void format_number_zenkaku_test(void) {
|
||||
|
||||
void hankaku_test(void) {
|
||||
zen2han_test();
|
||||
han2zen_test();
|
||||
format_number_test();
|
||||
format_number_zenkaku_test();
|
||||
}
|
||||
|
||||
+58
-549
@@ -29,7 +29,7 @@
|
||||
#include "cg.h"
|
||||
#include "config.h"
|
||||
#include "nact.h"
|
||||
#include "graphicsdevice.h"
|
||||
#include "sdl_core.h"
|
||||
#include "alpha_plane.h"
|
||||
#include "ags.h"
|
||||
|
||||
@@ -37,362 +37,40 @@
|
||||
static const int fadeX[16] = {0,2,2,0,1,3,3,1,1,3,3,1,0,2,2,0};
|
||||
static const int fadeY[16] = {0,2,0,2,1,3,1,3,0,2,0,2,1,3,1,3};
|
||||
|
||||
static void (*draw_line)(agsurface_t*, int, int, int, int, int);
|
||||
static void (*fill_rectangle)(agsurface_t*, int, int, int, int, int);
|
||||
static void (*copy_from_alpha)(agsurface_t *, BYTE *, BYTE *, int, int, ALPHA_DIB_COPY_TYPE);
|
||||
static void (*copy_to_alpha)(agsurface_t *, BYTE *, BYTE *, int, int, ALPHA_DIB_COPY_TYPE);
|
||||
|
||||
/******************************************************************************/
|
||||
/* private methods image操作 8bpp */
|
||||
/******************************************************************************/
|
||||
|
||||
static void image_drawLine8(agsurface_t *dib, int x0, int y0, int x1, int y1, int col) {
|
||||
int dx = abs(x0 - x1), dy = abs(y0 - y1);
|
||||
BYTE *p;
|
||||
|
||||
if (dx == 0) {
|
||||
int i = min(y0, y1);
|
||||
p = GETOFFSET_PIXEL(dib, x0, i);
|
||||
|
||||
for (i = 0; i < dy; i++) {
|
||||
*p = col;
|
||||
p += dib->bytes_per_line;
|
||||
}
|
||||
|
||||
} else if (dy == 0) {
|
||||
int i = min(x0, x1);
|
||||
p = GETOFFSET_PIXEL(dib, i, y0);
|
||||
memset(p, col, dx);
|
||||
|
||||
} else if (dx == dy) {
|
||||
int i;
|
||||
if (x0 < x1) {
|
||||
p = GETOFFSET_PIXEL(dib, x0, y0);
|
||||
if (y0 < y1) {
|
||||
dy = dib->bytes_per_line + dib->bytes_per_pixel;
|
||||
} else {
|
||||
dy = -dib->bytes_per_line + dib->bytes_per_pixel;
|
||||
}
|
||||
} else {
|
||||
p = GETOFFSET_PIXEL(dib, x1, y1);
|
||||
if (y0 < y1) {
|
||||
dy = -dib->bytes_per_line + dib->bytes_per_pixel;
|
||||
} else {
|
||||
dy = dib->bytes_per_line + dib->bytes_per_pixel;
|
||||
}
|
||||
}
|
||||
for (i = 0; i < dx; i++) {
|
||||
*p = col;
|
||||
p += dy;
|
||||
}
|
||||
} else {
|
||||
int i, d1, d2, ds, dd, imax;
|
||||
|
||||
if (dx < dy) {
|
||||
d1 = dib->bytes_per_line;
|
||||
if (y0 > y1) {
|
||||
p = GETOFFSET_PIXEL(dib, x1, y1);
|
||||
d2 = dib->bytes_per_pixel * (x0 < x1 ? -1 : 1);
|
||||
} else {
|
||||
p = GETOFFSET_PIXEL(dib, x0, y0);
|
||||
d2 = dib->bytes_per_pixel * (x0 < x1 ? 1 : -1);
|
||||
}
|
||||
ds = dx;
|
||||
imax = dy;
|
||||
} else {
|
||||
d1 = dib->bytes_per_pixel;
|
||||
if (x0 > x1) {
|
||||
p = GETOFFSET_PIXEL(dib, x1, y1);
|
||||
d2 = dib->bytes_per_line * (y0 < y1 ? -1 : 1);
|
||||
} else {
|
||||
p = GETOFFSET_PIXEL(dib, x0, y0);
|
||||
d2 = dib->bytes_per_line * (y0 < y1 ? 1 : -1);
|
||||
}
|
||||
ds = dy;
|
||||
imax = dx;
|
||||
}
|
||||
dd = 0;
|
||||
for (i = 0; i < imax; i++) {
|
||||
*p = col;
|
||||
p += d1;
|
||||
dd += ds;
|
||||
if (dd > imax) {
|
||||
p += d2;
|
||||
dd -= imax;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void image_fillRectangle8(agsurface_t *dib, int x, int y, int w, int h, int col) {
|
||||
BYTE *dst = GETOFFSET_PIXEL(dib, x, y);
|
||||
int i;
|
||||
|
||||
for (i = 0; i < h; i++) {
|
||||
memset(dst, col, w);
|
||||
dst += dib->bytes_per_line;
|
||||
}
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
/* private methods image操作 15bpp */
|
||||
/******************************************************************************/
|
||||
|
||||
static void image_copy_from_alpha15(agsurface_t *dib, BYTE *sdata, BYTE *ddata, int w, int h, ALPHA_DIB_COPY_TYPE flag) {
|
||||
int x, y;
|
||||
BYTE *yls;
|
||||
WORD *yld;
|
||||
|
||||
switch(flag) {
|
||||
case TO_16H:
|
||||
for (y = 0; y < h; y++) {
|
||||
yls = (BYTE *)(sdata + y * dib->width);
|
||||
yld = (WORD *)(ddata + y * dib->bytes_per_line);
|
||||
for (x = 0; x < w; x++) {
|
||||
/* *yld = */
|
||||
yld++; yls++;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case TO_16L:
|
||||
for (y = 0; y < h; y++) {
|
||||
yls = (BYTE *)(sdata + y * dib->width);
|
||||
yld = (WORD *)(ddata + y * dib->bytes_per_line);
|
||||
for (x = 0; x < w; x++) {
|
||||
/* *yld = (WORD)(*yls) | (*yld & 0xff00); */
|
||||
yld++; yls++;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case TO_24R:
|
||||
for (y = 0; y < h; y++) {
|
||||
yls = (BYTE *)(sdata + y * dib->width);
|
||||
yld = (WORD *)(ddata + y * dib->bytes_per_line);
|
||||
for (x = 0; x < w; x++) {
|
||||
*yld = PIX15(*yls, PIXG15(*yld), PIXB15(*yld));
|
||||
yld++; yls++;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case TO_24G:
|
||||
for (y = 0; y < h; y++) {
|
||||
yls = (BYTE *)(sdata + y * dib->width);
|
||||
yld = (WORD *)(ddata + y * dib->bytes_per_line);
|
||||
for (x = 0; x < w; x++) {
|
||||
*yld = PIX15(PIXR15(*yls), *yls, PIXB15(*yld));
|
||||
yld++; yls++;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case TO_24B:
|
||||
for (y = 0; y < h; y++) {
|
||||
yls = (BYTE *)(sdata + y * dib->width);
|
||||
yld = (WORD *)(ddata + y * dib->bytes_per_line);
|
||||
for (x = 0; x < w; x++) {
|
||||
*yld = PIX15(PIXR15(*yld), PIXG15(*yld), *yls);
|
||||
yld++; yls++;
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void image_copy_to_alpha15(agsurface_t *dib, BYTE *sdata, BYTE *ddata, int w, int h, ALPHA_DIB_COPY_TYPE flag) {
|
||||
int x, y;
|
||||
BYTE *yld;
|
||||
WORD *yls;
|
||||
|
||||
switch(flag) {
|
||||
case FROM_16H:
|
||||
for (y = 0; y < h; y++) {
|
||||
yls = (WORD *)(sdata + y * dib->bytes_per_line);
|
||||
yld = (BYTE *)(ddata + y * dib->width);
|
||||
for (x = 0; x < w; x++) {
|
||||
*yld = (BYTE)(PIX16(PIXR15(*yls), PIXG15(*yls), PIXB15(*yls)) >> 8);
|
||||
yld++; yls++;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case FROM_16L:
|
||||
for (y = 0; y < h; y++) {
|
||||
yls = (WORD *)(sdata + y * dib->bytes_per_line);
|
||||
yld = (BYTE *)(ddata + y * dib->width);
|
||||
for (x = 0; x < w; x++) {
|
||||
*yld = (BYTE)(PIX16(PIXR15(*yls), PIXG15(*yls), PIXB15(*yls)));
|
||||
yld++; yls++;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case FROM_24R:
|
||||
for (y = 0; y < h; y++) {
|
||||
yls = (WORD *)(sdata + y * dib->bytes_per_line);
|
||||
yld = (BYTE *)(ddata + y * dib->width);
|
||||
for (x = 0; x < w; x++) {
|
||||
*yld = (BYTE)PIXR15(*yls);
|
||||
yld++; yls++;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case FROM_24G:
|
||||
for (y = 0; y < h; y++) {
|
||||
yls = (WORD *)(sdata + y * dib->bytes_per_line);
|
||||
yld = (BYTE *)(ddata + y * dib->width);
|
||||
for (x = 0; x < w; x++) {
|
||||
*yld = (BYTE)PIXG15(*yls);
|
||||
yld++; yls++;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case FROM_24B:
|
||||
for (y = 0; y < h; y++) {
|
||||
yls = (WORD *)(sdata + y * dib->bytes_per_line);
|
||||
yld = (BYTE *)(ddata + y * dib->width);
|
||||
for (x = 0; x < w; x++) {
|
||||
*yld = (BYTE)PIXB15(*yls);
|
||||
yld++; yls++;
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
/* private methods image操作 16bpp */
|
||||
/******************************************************************************/
|
||||
|
||||
static void fadeOut16(agsurface_t *dst, int lv, int col) {
|
||||
static void fadeOut16(SDL_Surface *dst, int lv, int col) {
|
||||
WORD *yld;
|
||||
int x, y;
|
||||
|
||||
for (y = 0; y < dst->height; y+=4) {
|
||||
yld = (WORD *)(dst->pixel + (y + fadeY[lv]) * dst->bytes_per_line);
|
||||
for (x = 0; x < dst->width; x+=4) {
|
||||
for (y = 0; y < dst->h; y += 4) {
|
||||
yld = PIXEL_AT(dst, 0, y + fadeY[lv]);
|
||||
for (x = 0; x < dst->w; x += 4) {
|
||||
*(yld + fadeX[lv]) = col;
|
||||
yld+=4;
|
||||
yld += 4;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void fadeIn16(agsurface_t *src, agsurface_t *dst, int lv) {
|
||||
static void fadeIn16(SDL_Surface *src, SDL_Surface *dst, int lv) {
|
||||
WORD *yls, *yld;
|
||||
int x, y;
|
||||
|
||||
for (y = 0; y < src->height; y+=4) {
|
||||
yls = (WORD *)(src->pixel + (y + fadeY[lv]) * src->bytes_per_line);
|
||||
yld = (WORD *)(dst->pixel + (y + fadeY[lv]) * dst->bytes_per_line);
|
||||
for (x = 0; x < src->width; x+=4) {
|
||||
for (y = 0; y < src->h; y += 4) {
|
||||
yls = PIXEL_AT(src, 0, y + fadeY[lv]);
|
||||
yld = PIXEL_AT(dst, 0, y + fadeY[lv]);
|
||||
for (x = 0; x < src->w; x += 4) {
|
||||
*(yld + fadeX[lv]) = *(yls + fadeX[lv]);
|
||||
yls+=4; yld+=4;
|
||||
yls += 4; yld += 4;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void image_drawLine16(agsurface_t *dib, int x0, int y0, int x1, int y1, int col) {
|
||||
int dx = abs(x0 - x1), dy = abs(y0 - y1);
|
||||
|
||||
if (dx == 0) {
|
||||
int i = min(y0, y1), d = dib->bytes_per_line / 2;
|
||||
WORD *p = (WORD *)GETOFFSET_PIXEL(dib, x0, i);
|
||||
|
||||
for (i = 0; i < dy; i++) {
|
||||
*p = col;
|
||||
p += d;
|
||||
}
|
||||
|
||||
} else if (dy == 0) {
|
||||
int i = min(x0, x1), j;
|
||||
WORD *p = (WORD *)GETOFFSET_PIXEL(dib, i, y0);
|
||||
|
||||
for (j = 0; j < dx; j++) {
|
||||
*(p++) = col;
|
||||
}
|
||||
|
||||
} else if (dx == dy) {
|
||||
int i;
|
||||
WORD *p;
|
||||
|
||||
if (x0 < x1) {
|
||||
p = (WORD *)GETOFFSET_PIXEL(dib, x0, y0);
|
||||
if (y0 < y1) {
|
||||
dy = dib->bytes_per_line + dib->bytes_per_pixel;
|
||||
} else {
|
||||
dy = -dib->bytes_per_line + dib->bytes_per_pixel;
|
||||
}
|
||||
} else {
|
||||
p = (WORD *)GETOFFSET_PIXEL(dib, x1, y1);
|
||||
if (y0 < y1) {
|
||||
dy = -dib->bytes_per_line + dib->bytes_per_pixel;
|
||||
} else {
|
||||
dy = dib->bytes_per_line + dib->bytes_per_pixel;
|
||||
}
|
||||
}
|
||||
dy /= 2;
|
||||
for (i = 0; i < dx; i++) {
|
||||
*p = col;
|
||||
p += dy;
|
||||
}
|
||||
} else {
|
||||
int i, d1, d2, ds, dd, imax;
|
||||
WORD *p;
|
||||
|
||||
if (dx < dy) {
|
||||
d1 = dib->bytes_per_line;
|
||||
if (y0 > y1) {
|
||||
p = (WORD *)GETOFFSET_PIXEL(dib, x1, y1);
|
||||
d2 = dib->bytes_per_pixel * (x0 < x1 ? -1 : 1);
|
||||
} else {
|
||||
p = (WORD *)GETOFFSET_PIXEL(dib, x0, y0);
|
||||
d2 = dib->bytes_per_pixel * (x0 < x1 ? 1 : -1);
|
||||
}
|
||||
ds = dx;
|
||||
imax = dy;
|
||||
} else {
|
||||
d1 = dib->bytes_per_pixel;
|
||||
if (x0 > x1) {
|
||||
p = (WORD *)GETOFFSET_PIXEL(dib, x1, y1);
|
||||
d2 = dib->bytes_per_line * (y0 < y1 ? -1 : 1);
|
||||
} else {
|
||||
p = (WORD *)GETOFFSET_PIXEL(dib, x0, y0);
|
||||
d2 = dib->bytes_per_line * (y0 < y1 ? 1 : -1);
|
||||
}
|
||||
ds = dy;
|
||||
imax = dx;
|
||||
}
|
||||
dd = 0;
|
||||
d1 /= 2;
|
||||
d2 /= 2;
|
||||
for (i = 0; i < imax; i++) {
|
||||
*p = col;
|
||||
p += d1;
|
||||
dd += ds;
|
||||
if (dd > imax) {
|
||||
p += d2;
|
||||
dd -= imax;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void image_fillRectangle16(agsurface_t *dib, int x, int y, int w, int h, int col) {
|
||||
BYTE *_dst, *dst = GETOFFSET_PIXEL(dib, x, y);
|
||||
int i;
|
||||
|
||||
_dst = dst;
|
||||
|
||||
for (i = 0; i < w; i++) {
|
||||
*((WORD *)dst + i) = col;
|
||||
}
|
||||
|
||||
for (i = 0; i < h -1; i++) {
|
||||
dst += dib->bytes_per_line;
|
||||
memcpy(dst, _dst, w * 2);
|
||||
}
|
||||
}
|
||||
|
||||
static void image_copy_from_alpha16(agsurface_t *dib, BYTE *sdata, BYTE *ddata, int w, int h, ALPHA_DIB_COPY_TYPE flag) {
|
||||
int x, y;
|
||||
BYTE *yls;
|
||||
@@ -519,13 +197,13 @@ static void image_copy_to_alpha16(agsurface_t *dib, BYTE *sdata, BYTE *ddata, in
|
||||
/* private methods image操作 packed 24bpp */
|
||||
/******************************************************************************/
|
||||
|
||||
static void fadeOut24p(agsurface_t *dst, int lv, int col) {
|
||||
static void fadeOut24p(SDL_Surface *dst, int lv, int col) {
|
||||
BYTE *yld;
|
||||
int x, y;
|
||||
|
||||
for (y = 0; y < dst->height; y+=4) {
|
||||
yld = (BYTE *)(dst->pixel + (y + fadeY[lv]) * dst->bytes_per_line);
|
||||
for (x = 0; x < dst->width; x+=4) {
|
||||
for (y = 0; y < dst->h; y += 4) {
|
||||
yld = PIXEL_AT(dst, 0, y + fadeY[lv]);
|
||||
for (x = 0; x < dst->w; x += 4) {
|
||||
*(yld + fadeX[lv]) =
|
||||
*(yld + fadeX[lv] +1) =
|
||||
*(yld + fadeX[lv] +2) = (BYTE)col;
|
||||
@@ -534,19 +212,19 @@ static void fadeOut24p(agsurface_t *dst, int lv, int col) {
|
||||
}
|
||||
}
|
||||
|
||||
static void fadeIn24p(agsurface_t *src, agsurface_t *dst, int lv) {
|
||||
static void fadeIn24p(SDL_Surface *src, SDL_Surface *dst, int lv) {
|
||||
DWORD *yls;
|
||||
BYTE *yld;
|
||||
int x, y;
|
||||
|
||||
for (y = 0; y < src->height; y+=4) {
|
||||
yls = (DWORD *)(src->pixel + (y + fadeY[lv]) * src->bytes_per_line);
|
||||
yld = (BYTE *)(dst->pixel + (y + fadeY[lv]) * dst->bytes_per_line);
|
||||
for (x = 0; x < src->width; x+=4) {
|
||||
for (y = 0; y < src->h; y += 4) {
|
||||
yls = PIXEL_AT(src, 0, y + fadeY[lv]);
|
||||
yld = PIXEL_AT(dst, 0, y + fadeY[lv]);
|
||||
for (x = 0; x < src->w; x += 4) {
|
||||
*(yld + fadeX[lv] ) = PIXB24(*(yls + fadeX[lv]));
|
||||
*(yld + fadeX[lv] +1) = PIXG24(*(yls + fadeX[lv]));
|
||||
*(yld + fadeX[lv] +2) = PIXR24(*(yls + fadeX[lv]));
|
||||
yls+=4; yld+=(4*3);
|
||||
yls += 4; yld += (4*3);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -555,135 +233,33 @@ static void fadeIn24p(agsurface_t *src, agsurface_t *dst, int lv) {
|
||||
/* private methods image操作 24/32bpp */
|
||||
/******************************************************************************/
|
||||
|
||||
static void fadeOut24(agsurface_t *dst, int lv, int col) {
|
||||
static void fadeOut24(SDL_Surface *dst, int lv, int col) {
|
||||
DWORD *yld;
|
||||
int x, y;
|
||||
|
||||
for (y = 0; y < dst->height; y+=4) {
|
||||
yld = (DWORD *)(dst->pixel + (y + fadeY[lv]) * dst->bytes_per_line);
|
||||
for (x = 0; x < dst->width; x+=4) {
|
||||
for (y = 0; y < dst->h; y += 4) {
|
||||
yld = PIXEL_AT(dst, 0, y + fadeY[lv]);
|
||||
for (x = 0; x < dst->w; x += 4) {
|
||||
*(yld + fadeX[lv]) = col;
|
||||
yld+=4;
|
||||
yld += 4;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void fadeIn24(agsurface_t *src, agsurface_t *dst, int lv) {
|
||||
static void fadeIn24(SDL_Surface *src, SDL_Surface *dst, int lv) {
|
||||
DWORD *yls, *yld;
|
||||
int x, y;
|
||||
|
||||
for (y = 0; y < src->height; y+=4) {
|
||||
yls = (DWORD *)(src->pixel + (y + fadeY[lv]) * src->bytes_per_line);
|
||||
yld = (DWORD *)(dst->pixel + (y + fadeY[lv]) * dst->bytes_per_line);
|
||||
for (x = 0; x < src->width; x+=4) {
|
||||
for (y = 0; y < src->h; y += 4) {
|
||||
yls = PIXEL_AT(src, 0, y + fadeY[lv]);
|
||||
yld = PIXEL_AT(dst, 0, y + fadeY[lv]);
|
||||
for (x = 0; x < src->w; x += 4) {
|
||||
*(yld + fadeX[lv]) = *(yls + fadeX[lv]);
|
||||
yls+=4; yld+=4;
|
||||
yls += 4; yld += 4;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void image_drawLine24(agsurface_t *dib, int x0, int y0, int x1, int y1, int col) {
|
||||
int dx = abs(x0 - x1), dy = abs(y0 - y1);
|
||||
|
||||
if (dx == 0) {
|
||||
int i = min(y0, y1), d = dib->bytes_per_line / 4;
|
||||
DWORD *p = (DWORD *)GETOFFSET_PIXEL(dib, x0, i);
|
||||
|
||||
for (i = 0; i < dy; i++) {
|
||||
*p = col;
|
||||
p += d;
|
||||
}
|
||||
|
||||
} else if (dy == 0) {
|
||||
int i = min(x0, x1), j;
|
||||
DWORD *p = (DWORD *)GETOFFSET_PIXEL(dib, i, y0);
|
||||
|
||||
for (j = 0; j < dx; j++) {
|
||||
*(p++) = col;
|
||||
}
|
||||
|
||||
} else if (dx == dy) {
|
||||
int i;
|
||||
DWORD *p;
|
||||
|
||||
if (x0 < x1) {
|
||||
p = (DWORD *)GETOFFSET_PIXEL(dib, x0, y0);
|
||||
if (y0 < y1) {
|
||||
dy = dib->bytes_per_line + dib->bytes_per_pixel;
|
||||
} else {
|
||||
dy = -dib->bytes_per_line + dib->bytes_per_pixel;
|
||||
}
|
||||
} else {
|
||||
p = (DWORD *)GETOFFSET_PIXEL(dib, x1, y1);
|
||||
if (y0 < y1) {
|
||||
dy = -dib->bytes_per_line + dib->bytes_per_pixel;
|
||||
} else {
|
||||
dy = dib->bytes_per_line + dib->bytes_per_pixel;
|
||||
}
|
||||
}
|
||||
dy /= 4;
|
||||
for (i = 0; i < dx; i++) {
|
||||
*p = col;
|
||||
p += dy;
|
||||
}
|
||||
} else {
|
||||
int i, d1, d2, ds, dd, imax;
|
||||
DWORD *p;
|
||||
|
||||
if (dx < dy) {
|
||||
d1 = dib->bytes_per_line;
|
||||
if (y0 > y1) {
|
||||
p = (DWORD *)GETOFFSET_PIXEL(dib, x1, y1);
|
||||
d2 = dib->bytes_per_pixel * (x0 < x1 ? -1 : 1);
|
||||
} else {
|
||||
p = (DWORD *)GETOFFSET_PIXEL(dib, x0, y0);
|
||||
d2 = dib->bytes_per_pixel * (x0 < x1 ? 1 : -1);
|
||||
}
|
||||
ds = dx;
|
||||
imax = dy;
|
||||
} else {
|
||||
d1 = dib->bytes_per_pixel;
|
||||
if (x0 > x1) {
|
||||
p = (DWORD *)GETOFFSET_PIXEL(dib, x1, y1);
|
||||
d2 = dib->bytes_per_line * (y0 < y1 ? -1 : 1);
|
||||
} else {
|
||||
p = (DWORD *)GETOFFSET_PIXEL(dib, x0, y0);
|
||||
d2 = dib->bytes_per_line * (y0 < y1 ? 1 : -1);
|
||||
}
|
||||
ds = dy;
|
||||
imax = dx;
|
||||
}
|
||||
dd = 0;
|
||||
d1 /= 4;
|
||||
d2 /= 4;
|
||||
for (i = 0; i < imax; i++) {
|
||||
*p = col;
|
||||
p += d1;
|
||||
dd += ds;
|
||||
if (dd > imax) {
|
||||
p += d2;
|
||||
dd -= imax;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void image_fillRectangle24(agsurface_t *dib, int x, int y, int w, int h, int col) {
|
||||
BYTE *_dst, *dst = GETOFFSET_PIXEL(dib, x, y);
|
||||
int i;
|
||||
|
||||
_dst = dst;
|
||||
|
||||
for (i = 0; i < w; i++) {
|
||||
*((DWORD *)dst + i) = col;
|
||||
}
|
||||
|
||||
for (i = 0; i < h -1; i++) {
|
||||
dst += dib->bytes_per_line;
|
||||
memcpy(dst, _dst, w * 4);
|
||||
}
|
||||
}
|
||||
|
||||
static void image_copy_from_alpha24(agsurface_t *dib, BYTE *sdata, BYTE *ddata, int w, int h, ALPHA_DIB_COPY_TYPE flag) {
|
||||
int x, y;
|
||||
BYTE *yls;
|
||||
@@ -814,25 +390,13 @@ static void image_copy_to_alpha24(agsurface_t *dib, BYTE *sdata, BYTE *ddata, in
|
||||
void image_setdepth(int depth) {
|
||||
switch(depth) {
|
||||
case 8:
|
||||
draw_line = image_drawLine8;
|
||||
fill_rectangle = image_fillRectangle8;
|
||||
break;
|
||||
case 15:
|
||||
draw_line = image_drawLine16;
|
||||
fill_rectangle = image_fillRectangle16;
|
||||
copy_from_alpha = image_copy_from_alpha15;
|
||||
copy_to_alpha = image_copy_to_alpha15;
|
||||
break;
|
||||
case 16:
|
||||
draw_line = image_drawLine16;
|
||||
fill_rectangle = image_fillRectangle16;
|
||||
copy_from_alpha = image_copy_from_alpha16;
|
||||
copy_to_alpha = image_copy_to_alpha16;
|
||||
break;
|
||||
case 24:
|
||||
case 32:
|
||||
draw_line = image_drawLine24;
|
||||
fill_rectangle = image_fillRectangle24;
|
||||
copy_from_alpha = image_copy_from_alpha24;
|
||||
copy_to_alpha = image_copy_to_alpha24;
|
||||
break;
|
||||
@@ -844,8 +408,8 @@ void image_setdepth(int depth) {
|
||||
/*
|
||||
fade out for 16/24/32
|
||||
*/
|
||||
void image_fadeOut(agsurface_t *img, int lv, int col) {
|
||||
switch(img->bytes_per_pixel) {
|
||||
void image_fadeOut(SDL_Surface *img, int lv, int col) {
|
||||
switch(img->format->BytesPerPixel) {
|
||||
case 2:
|
||||
fadeOut16(img, lv, col); break;
|
||||
case 3:
|
||||
@@ -860,8 +424,8 @@ void image_fadeOut(agsurface_t *img, int lv, int col) {
|
||||
/*
|
||||
fade in for 16/24/32
|
||||
*/
|
||||
void image_fadeIn(agsurface_t *src, agsurface_t *dst, int lv) {
|
||||
switch(dst->bytes_per_pixel) {
|
||||
void image_fadeIn(SDL_Surface *src, SDL_Surface *dst, int lv) {
|
||||
switch(dst->format->BytesPerPixel) {
|
||||
case 2:
|
||||
fadeIn16(src, dst, lv); break;
|
||||
case 3:
|
||||
@@ -873,24 +437,6 @@ void image_fadeIn(agsurface_t *src, agsurface_t *dst, int lv) {
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* dib に線を描画
|
||||
*/
|
||||
void image_drawLine(agsurface_t *dib, int x0, int y0, int x1, int y1, int col) {
|
||||
draw_line(dib, x0, y0, x1, y1, col);
|
||||
}
|
||||
|
||||
/*
|
||||
* dib に矩形塗りつぶしを描画
|
||||
*/
|
||||
void image_fillRectangle(agsurface_t *dib, int x, int y, int w, int h, int col) {
|
||||
fill_rectangle(dib, x, y, w, h, col);
|
||||
}
|
||||
|
||||
void image_fillRectangleNeg(agsurface_t *dib, int x, int y, int w, int h, int col) {
|
||||
fill_rectangle(dib, x, y, w, h, -1 ^ image_index2pixel(dib->depth, col));
|
||||
}
|
||||
|
||||
void image_copy_from_alpha(agsurface_t *dib, int sx, int sy, int w, int h, int dx, int dy, ALPHA_DIB_COPY_TYPE flag) {
|
||||
BYTE *sdata = GETOFFSET_ALPHA(dib, sx, sy);
|
||||
BYTE *ddata = GETOFFSET_PIXEL(dib, dx, dy);
|
||||
@@ -905,65 +451,28 @@ void image_copy_to_alpha(agsurface_t *dib, int sx, int sy, int w, int h, int dx,
|
||||
copy_to_alpha(dib, sdata, ddata, w, h, flag);
|
||||
}
|
||||
|
||||
int image_index2pixel(int depth, int i) {
|
||||
Pallet256 *pal = nact->sys_pal;
|
||||
|
||||
switch(depth) {
|
||||
case 8:
|
||||
return i;
|
||||
case 15:
|
||||
return PIX15(pal->red[i], pal->green[i], pal->blue[i]);
|
||||
case 16:
|
||||
return PIX16(pal->red[i], pal->green[i], pal->blue[i]);
|
||||
case 24:
|
||||
case 32:
|
||||
return PIX24(pal->red[i], pal->green[i], pal->blue[i]);
|
||||
default:
|
||||
WARNING("Unknown depth\n");
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
/* モザイク */
|
||||
|
||||
void image_Mosaic(agsurface_t *dib, int sx, int sy, int w, int h, int dx, int dy, int slice) {
|
||||
#define m_mozaic(type) { \
|
||||
type *p_ss = (type *)GETOFFSET_PIXEL(dib, sx, sy); \
|
||||
type *p_src; \
|
||||
int l = dib->bytes_per_line / dib->bytes_per_pixel * slice; \
|
||||
for (y = 0; y < h; y += slice) { \
|
||||
p_src = p_ss; \
|
||||
if ((y + slice) > h ) r.height = h - y; \
|
||||
r.width = slice; \
|
||||
for (x = 0; x < w; x += slice) { \
|
||||
cl = *p_src; \
|
||||
r.x = dx + x; \
|
||||
r.y = dy + y; \
|
||||
if ((r.x + slice) > w) r.width = w - x; \
|
||||
fill_rectangle(dib, r.x, r.y, r.width, r.height, cl); \
|
||||
p_src += slice; \
|
||||
} \
|
||||
p_ss += l; \
|
||||
}}
|
||||
|
||||
int cl;
|
||||
int x,y;
|
||||
MyRectangle r;
|
||||
|
||||
r.width=slice;
|
||||
r.height=slice;
|
||||
|
||||
switch(dib->depth) {
|
||||
case 8:
|
||||
m_mozaic(BYTE);
|
||||
break;
|
||||
case 16:
|
||||
m_mozaic(WORD);
|
||||
break;
|
||||
case 24:
|
||||
case 32:
|
||||
m_mozaic(DWORD);
|
||||
break;
|
||||
void image_Mosaic(SDL_Surface *dib, int sx, int sy, int w, int h, int dx, int dy, int slice) {
|
||||
SDL_Rect r = {.h = slice};
|
||||
for (int y = 0; y < h; y += slice) {
|
||||
if (y + slice > h)
|
||||
r.h = h - y;
|
||||
r.w = slice;
|
||||
for (int x = 0; x < w; x += slice) {
|
||||
void *src = PIXEL_AT(dib, sx + x, sy + y);
|
||||
Uint32 color;
|
||||
switch (dib->format->BytesPerPixel) {
|
||||
case 1: color = *(BYTE *)src; break;
|
||||
case 2: color = *(WORD *)src; break;
|
||||
default: color = *(DWORD *)src; break;
|
||||
}
|
||||
r.x = dx + x;
|
||||
r.y = dy + y;
|
||||
if (r.x + slice > w)
|
||||
r.w = w - x;
|
||||
SDL_FillRect(dib, &r, color);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -976,7 +485,7 @@ BYTE *changeImage16AlphaLevel(cgdata *cg) {
|
||||
new_pic_ = new_pic;
|
||||
|
||||
while (pixels--) {
|
||||
*new_pic = RGB_ALPHALEVEL16(*pic, cg->alphalevel);
|
||||
*new_pic = ALPHALEVEL16(*pic, cg->alphalevel);
|
||||
new_pic++; pic++;
|
||||
}
|
||||
return (BYTE *)new_pic_;
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user